@treasuredata/tdx 2026.4.6 → 2026.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.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/cas-command.js +1 -1
- package/dist/commands/cas-segment-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/policy-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/work-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/tools/work-create-item.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/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.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/policy.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/types/workspace.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/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a152_0x14882b=a152_0x4c54;(function(_0x4433ff,_0x1add72){const _0x4a75ab=a152_0x4c54,_0x25369f=_0x4433ff();while(!![]){try{const _0x16bab9=-parseInt(_0x4a75ab(0x221))/0x1+-parseInt(_0x4a75ab(0x2c1))/0x2*(-parseInt(_0x4a75ab(0x26f))/0x3)+parseInt(_0x4a75ab(0x253))/0x4+parseInt(_0x4a75ab(0x2ad))/0x5+parseInt(_0x4a75ab(0x283))/0x6*(parseInt(_0x4a75ab(0x257))/0x7)+parseInt(_0x4a75ab(0x25b))/0x8+-parseInt(_0x4a75ab(0x282))/0x9;if(_0x16bab9===_0x1add72)break;else _0x25369f['push'](_0x25369f['shift']());}catch(_0x2c67aa){_0x25369f['push'](_0x25369f['shift']());}}}(a152_0x2baf,0x6d499));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x14882b(0x2d0));export const PENDING_SEGMENT_PREFIX=a152_0x14882b(0x23e);export const PENDING_ACTIVATION_PREFIX=a152_0x14882b(0x242);export function createPendingSegmentId(_0x1bb59b){return''+PENDING_SEGMENT_PREFIX+_0x1bb59b+'__';}export function isPendingSegmentId(_0x1f6c01){const _0x5b24ea=a152_0x14882b;return _0x1f6c01['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x1f6c01[_0x5b24ea(0x281)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x594bd4){const _0x9fb554=a152_0x14882b;return _0x594bd4[_0x9fb554(0x2c2)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x452f32){return''+PENDING_ACTIVATION_PREFIX+_0x452f32+'__';}export function isPendingActivationId(_0xe7fecc){const _0x5c9980=a152_0x14882b;return _0xe7fecc[_0x5c9980(0x281)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1905fd){const _0x174e30=a152_0x14882b;return _0x1905fd[_0x174e30(0x2c2)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x11a1c2,_0x372c73){const _0x3a2e33=a152_0x14882b,_0xfb52dc=_0x11a1c2+'::'+(_0x372c73[_0x3a2e33(0x296)]()||'segment'),_0x3395c5=createHash(_0x3a2e33(0x265))[_0x3a2e33(0x250)](_0xfb52dc)[_0x3a2e33(0x2c0)]('hex')[_0x3a2e33(0x280)](0x0,0xc);return'journey_entry_criteria_'+_0x3395c5;}export function ensureJourneyDefaults(_0x55ccc4){const _0x315665=a152_0x14882b;!_0x55ccc4['description']&&(_0x55ccc4[_0x315665(0x2b4)]=''),!_0x55ccc4[_0x315665(0x1e3)]&&(_0x55ccc4[_0x315665(0x1e3)]=_0x315665(0x2ce));}export function injectExistingStageIds(_0x499add,_0xaeb5a8){const _0x2c42b7=a152_0x14882b,_0x32e393=new Map(_0xaeb5a8[_0x2c42b7(0x1de)](_0x16bfc3=>[_0x16bfc3['name'],_0x16bfc3['id']]));for(const _0x4f3f9c of _0x499add){if(!_0x4f3f9c['id']){const _0x255221=_0x32e393[_0x2c42b7(0x2c4)](_0x4f3f9c[_0x2c42b7(0x24d)]);_0x255221&&(_0x4f3f9c['id']=_0x255221);}}}export function resolveTDFolderPath(_0x3c2c1d,_0x595123,_0x322e3c){const _0x57e5e5=a152_0x14882b;if(!_0x595123)return _0x3c2c1d;if(_0x3c2c1d===_0x322e3c||_0x3c2c1d[_0x57e5e5(0x281)](_0x322e3c+'/'))return _0x3c2c1d;return _0x3c2c1d?_0x322e3c+'/'+_0x3c2c1d:_0x322e3c;}export function addFoldersToCreate(_0x3917e9,_0x34531b,_0x4a9588){const _0x51e26d=a152_0x14882b;if(!_0x3917e9)return;if(_0x34531b[_0x51e26d(0x20c)](_0x3917e9))return;const _0x8ffa45=_0x3917e9[_0x51e26d(0x2d7)]('/');let _0x7ec313='';for(const _0x212f26 of _0x8ffa45){_0x7ec313=_0x7ec313?_0x7ec313+'/'+_0x212f26:_0x212f26,!_0x34531b['has'](_0x7ec313)&&_0x4a9588['add'](_0x7ec313);}}export function sortFoldersByDepth(_0x665452){const _0x2b859d=a152_0x14882b;return[..._0x665452][_0x2b859d(0x232)]((_0x24e80f,_0x22db4c)=>{const _0x1529b7=_0x2b859d,_0x3ba773=(_0x24e80f[_0x1529b7(0x2d9)](/\//g)||[])[_0x1529b7(0x224)],_0x95553e=(_0x22db4c[_0x1529b7(0x2d9)](/\//g)||[])['length'];return _0x3ba773-_0x95553e;});}import*as a152_0x2adcdb from'yaml';function a152_0x4c54(_0x44fc0c,_0x2f4657){_0x44fc0c=_0x44fc0c-0x1cf;const _0x2baf7e=a152_0x2baf();let _0x4c547b=_0x2baf7e[_0x44fc0c];return _0x4c547b;}import{readFileSync}from'fs';import a152_0x35b22c from'path';import{isJourneyDef,parseYamlString as a152_0x23eb1a,toYamlString as a152_0x338dca,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(_0x322be1){const _0x234c3b=a152_0x14882b;if(Array['isArray'](_0x322be1))return'['+_0x322be1[_0x234c3b(0x1de)](_0x128077=>stableStringify(_0x128077))[_0x234c3b(0x1d5)](',')+']';if(_0x322be1&&typeof _0x322be1===_0x234c3b(0x1fe)){const _0x5c7059=_0x322be1,_0x343045=Object[_0x234c3b(0x24c)](_0x5c7059)[_0x234c3b(0x232)](),_0x40a47a=_0x343045[_0x234c3b(0x1de)](_0x139136=>'\x22'+_0x139136+'\x22:'+stableStringify(_0x5c7059[_0x139136]));return'{'+_0x40a47a[_0x234c3b(0x1d5)](',')+'}';}const _0x29bfcd=JSON['stringify'](_0x322be1);return _0x29bfcd===undefined?_0x234c3b(0x225):_0x29bfcd;}function activationSignature(_0x4a1bbf){const _0x4d8cb6=a152_0x14882b,_0x57ffab={'connection':_0x4a1bbf['connection'],..._0x4a1bbf['all_columns']!==undefined&&{'all_columns':_0x4a1bbf[_0x4d8cb6(0x20d)]},..._0x4a1bbf[_0x4d8cb6(0x216)]!==undefined&&{'columns':_0x4a1bbf[_0x4d8cb6(0x216)]},..._0x4a1bbf[_0x4d8cb6(0x1e5)]!==undefined&&{'behavior':_0x4a1bbf[_0x4d8cb6(0x1e5)]},..._0x4a1bbf[_0x4d8cb6(0x206)]!==undefined&&{'schedule':_0x4a1bbf[_0x4d8cb6(0x206)]},..._0x4a1bbf['notification']!==undefined&&{'notification':_0x4a1bbf[_0x4d8cb6(0x228)]},..._0x4a1bbf[_0x4d8cb6(0x2da)]!==undefined&&{'connector_config':_0x4a1bbf[_0x4d8cb6(0x2da)]},..._0x4a1bbf[_0x4d8cb6(0x26a)]!==undefined&&{'activation_template_id':_0x4a1bbf[_0x4d8cb6(0x26a)]}};return stableStringify(_0x57ffab);}async function fetchSegment(_0x2f55f1,_0x33872f,_0x25dc89,_0x397f3b){const _0x40b82b=a152_0x14882b,_0x7fb4cb=_0x397f3b?.[_0x40b82b(0x28e)](_0x5b096a=>_0x5b096a['id']===_0x25dc89);if(_0x7fb4cb)return _0x7fb4cb;try{return await _0x2f55f1[_0x40b82b(0x23d)][_0x40b82b(0x1eb)](_0x33872f,_0x25dc89);}catch(_0x1b8717){logger[_0x40b82b(0x2ab)]('getSegment\x20failed\x20for\x20'+_0x25dc89+_0x40b82b(0x28d)+_0x1b8717);try{return await _0x2f55f1[_0x40b82b(0x23d)][_0x40b82b(0x21e)](_0x25dc89);}catch(_0x41ff0f){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x25dc89+':\x20'+_0x41ff0f),null;}}}function recoverSegmentIdsFromPushRecovery(_0xb08426,_0x1ee28b,_0x3fb4f2){const _0x370795=a152_0x14882b,_0x1918a9=readPushRecovery(_0xb08426[_0x370795(0x20e)]);if(_0x1918a9?.[_0x370795(0x26d)]===_0xb08426[_0x370795(0x2db)]['name'])for(const [_0xa88dcf,_0x1337ed]of Object[_0x370795(0x1f7)](_0x1918a9[_0x370795(0x2bf)])){const _0x201a00=generateDeterministicJourneySegmentName(_0xb08426[_0x370795(0x2db)]['name'],_0xa88dcf);_0x1337ed[_0x370795(0x2d8)]===_0x201a00&&(_0x1ee28b['set'](_0xa88dcf,_0x1337ed[_0x370795(0x26b)]),_0x3fb4f2[_0x370795(0x1f4)](_0xa88dcf,_0x1337ed[_0x370795(0x26b)]));}}async function createOrRecoverEmbeddedSegment(_0x31b2e4,_0x386909,_0x3ba2ed,_0x30322d){const _0x484d0c=a152_0x14882b;let _0x4df39b;try{_0x4df39b=await _0x31b2e4[_0x484d0c(0x23d)][_0x484d0c(0x293)]({'name':_0x3ba2ed[_0x484d0c(0x269)],'description':_0x3ba2ed[_0x484d0c(0x2b4)],'journeyId':_0x3ba2ed[_0x484d0c(0x2d2)],'rule':_0x30322d(_0x3ba2ed[_0x484d0c(0x23a)],!![]),'countPopulation':!![],'parentFolderId':_0x3ba2ed[_0x484d0c(0x2aa)],'audienceId':_0x3ba2ed['parentId']});}catch(_0x17c00b){const _0x27c295=_0x17c00b instanceof Error&&_0x17c00b[_0x484d0c(0x212)][_0x484d0c(0x262)](_0x484d0c(0x230));if(_0x27c295){const _0x134d4e=readPushRecovery(_0x386909[_0x484d0c(0x20e)]),_0x1600fa=_0x134d4e?.[_0x484d0c(0x26d)]===_0x386909[_0x484d0c(0x2db)][_0x484d0c(0x24d)]?_0x134d4e[_0x484d0c(0x2bf)][_0x3ba2ed[_0x484d0c(0x211)]]:undefined;if(_0x1600fa?.['uniqueServerName']===_0x3ba2ed[_0x484d0c(0x269)])await _0x31b2e4[_0x484d0c(0x23d)]['updateSegmentById'](_0x3ba2ed['parentId'],_0x1600fa[_0x484d0c(0x26b)],{'description':_0x3ba2ed[_0x484d0c(0x2b4)],'rule':_0x30322d(_0x3ba2ed['resolvedRule'],!![]),'countPopulation':!![]}),_0x4df39b=_0x1600fa[_0x484d0c(0x26b)];else throw new SDKError(ErrorCode[_0x484d0c(0x2bd)],_0x484d0c(0x21d)+_0x3ba2ed[_0x484d0c(0x211)]+_0x484d0c(0x270)+(_0x484d0c(0x1d7)+_0x386909['absolutePath']['replace'](/([^/]+)$/,_0x484d0c(0x215))+')\x20')+_0x484d0c(0x203),_0x17c00b);}else throw _0x17c00b;}return saveSegmentToPushRecovery(_0x386909['absolutePath'],_0x386909[_0x484d0c(0x2db)][_0x484d0c(0x24d)],_0x3ba2ed['localName'],{'segmentId':_0x4df39b,'uniqueServerName':_0x3ba2ed[_0x484d0c(0x269)],'createdAt':new Date()[_0x484d0c(0x220)]()}),_0x4df39b;}export async function prepareSegmentFiles(_0xa77b02,_0x4e5124,_0x1c2751,_0x35d0be,_0xe18ddf){const _0x12646f=a152_0x14882b,{activationDefToCreateRequest:_0x3489ed}=await import(_0x12646f(0x2c5)),_0x25e99d=[],_0x2d7efa=new Set();for(const {yamlConfig:_0x57cec0,folderPath:_0x3cc0dd,sourcePath:_0x573cec}of _0xa77b02){const _0x51a765=resolveTDFolderPath(_0x3cc0dd,_0x35d0be,_0xe18ddf),_0x31390e=_0x51a765+':'+_0x57cec0[_0x12646f(0x24d)],_0x37c2d1=_0x4e5124[_0x12646f(0x266)][_0x12646f(0x2c4)](_0x31390e),_0x4a6afd=_0x37c2d1?_0x4e5124[_0x12646f(0x295)][_0x12646f(0x2c4)](_0x37c2d1['id'])||[]:[];addFoldersToCreate(_0x51a765,_0x4e5124['folderPathToId'],_0x2d7efa);const _0x4bed75=calculateActivationActions(_0x57cec0[_0x12646f(0x223)]||[],_0x4a6afd,_0x4e5124[_0x12646f(0x214)],_0x4e5124['connectionIdToNameMap']);for(const _0x152b58 of _0x4bed75){(_0x152b58[_0x12646f(0x20f)]===_0x12646f(0x2b0)||_0x152b58[_0x12646f(0x20f)]==='update')&&_0x152b58['yamlActivation']&&(_0x152b58[_0x12646f(0x246)]=await _0x3489ed(_0x152b58[_0x12646f(0x2a5)],_0x1c2751));}const _0xd734b7=calculateSegmentDiff(_0x57cec0,_0x37c2d1,_0x4a6afd,_0x4e5124[_0x12646f(0x214)],_0x4e5124[_0x12646f(0x298)]);_0x25e99d[_0x12646f(0x299)]({'relativePath':_0x57cec0[_0x12646f(0x24d)],'absolutePath':_0x573cec,'yamlConfig':_0x57cec0,'folderPath':_0x51a765,'existingSegment':_0x37c2d1,'existingActivations':_0x4a6afd,'isNew':_0xd734b7[_0x12646f(0x2b3)],'hasChanges':_0xd734b7['hasChanges'],'diff':_0xd734b7[_0x12646f(0x1e1)],'activationActions':_0x4bed75});}return{'segmentFiles':_0x25e99d,'foldersToCreate':_0x2d7efa};}export async function prepareJourneyFiles(_0x1a27f5,_0x4042b2,_0x427a4f,_0x368507){const _0x5cb1e5=a152_0x14882b,_0x4b6852=[],_0x41d234=new Set();for(const {yamlConfig:_0x54f8a3,folderPath:_0x115f03,sourcePath:_0x1fb879}of _0x1a27f5){const _0x58a275=resolveTDFolderPath(_0x115f03,_0x427a4f,_0x368507),_0x16f408=_0x58a275+':'+_0x54f8a3[_0x5cb1e5(0x24d)],_0x24199e=_0x4042b2[_0x5cb1e5(0x254)][_0x5cb1e5(0x2c4)](_0x16f408);let _0x4a471f,_0x35165e;if(_0x24199e&&_0x24199e[_0x5cb1e5(0x224)]>0x0){const _0xcaf91a=buildLocalExpandedRuleMappings(_0x54f8a3),{createYamlContext:_0x14bbc4,prefetchJourneySegments:_0x3eafd6}=createPushYamlContextForBundle(_0x4042b2['deps'],_0x4042b2[_0x5cb1e5(0x1f5)],_0x4042b2[_0x5cb1e5(0x217)],_0xcaf91a,_0x4042b2[_0x5cb1e5(0x214)],_0x4042b2['connectionIdToNameMap'],_0x4042b2[_0x5cb1e5(0x260)],_0x4042b2[_0x5cb1e5(0x287)]);await _0x3eafd6(_0x24199e[_0x5cb1e5(0x1de)](_0x4d325f=>_0x4d325f['id']));const _0x24c55e=await _0x4042b2[_0x5cb1e5(0x226)][_0x5cb1e5(0x2a4)][_0x5cb1e5(0x27c)](_0x24199e[0x0][_0x5cb1e5(0x229)]),_0x18739f=hasMultipleVersions(_0x54f8a3),_0x4d1126=async _0x55d203=>{const _0x5c1040=_0x5cb1e5,_0x27ce29=_0x4042b2['journeyById']?.['get'](_0x55d203);if(_0x27ce29)return _0x27ce29;return _0x4042b2[_0x5c1040(0x235)]({'journeyId':_0x55d203,'journeyName':_0x54f8a3[_0x5c1040(0x24d)],'isMultiVersion':_0x24199e[_0x5c1040(0x224)]>0x1});};if(_0x18739f&&_0x24199e['length']>0x1){const _0x38778f=[];for(const _0x41615c of _0x24199e){const _0x53624b=_0x41615c['versionNumber']||0x1;_0x4042b2[_0x5cb1e5(0x1d9)]?.[_0x5cb1e5(0x250)](_0x5cb1e5(0x25f)+_0x54f8a3['name']+'\x20v'+_0x53624b);const _0x16aece=await _0x4d1126(_0x41615c['id']),_0x542586=_0x14bbc4(_0x41615c['id']),_0x3e737b=await journeyResponseToDef(_0x16aece,_0x542586);_0x38778f[_0x5cb1e5(0x299)]({'item':_0x41615c,'yaml':_0x3e737b});}const _0x1dd7e4=buildLocalRuleToNameMappingFromJourney(_0x54f8a3);_0x35165e=buildMergedJourneyDef(_0x38778f,_0x1dd7e4,_0x24c55e);const _0x49343b=Math[_0x5cb1e5(0x2b5)](..._0x38778f['map'](_0x5a9d9d=>_0x5a9d9d[_0x5cb1e5(0x28b)][_0x5cb1e5(0x1d8)]||0x0)),_0x173dc5=_0x24199e['find'](_0x3bb1be=>(_0x3bb1be[_0x5cb1e5(0x1d8)]||0x0)===_0x49343b);_0x173dc5&&(_0x4042b2[_0x5cb1e5(0x1d9)]?.['update'](_0x5cb1e5(0x25f)+_0x54f8a3[_0x5cb1e5(0x24d)]+'\x20v'+_0x49343b),_0x4a471f=await _0x4d1126(_0x173dc5['id']));}else{const _0x508a0f=_0x24199e[_0x24199e[_0x5cb1e5(0x224)]-0x1];_0x4042b2['progress']?.[_0x5cb1e5(0x250)](_0x5cb1e5(0x25f)+_0x54f8a3[_0x5cb1e5(0x24d)]),_0x4a471f=await _0x4d1126(_0x508a0f['id']);const _0x140284=_0x14bbc4(_0x508a0f['id']),_0x16171c=await journeyResponseToDef(_0x4a471f,_0x140284),_0x345000=buildLocalRuleToNameMappingFromJourney(_0x54f8a3);_0x35165e=buildMergedJourneyDef([{'item':_0x508a0f,'yaml':_0x16171c}],_0x345000,_0x24c55e);}}addFoldersToCreate(_0x58a275,_0x4042b2[_0x5cb1e5(0x27d)],_0x41d234);const _0x2c9de1=calculateJourneyDiff(_0x54f8a3,_0x35165e);_0x4b6852[_0x5cb1e5(0x299)]({'relativePath':_0x54f8a3[_0x5cb1e5(0x24d)],'absolutePath':_0x1fb879,'yamlConfig':_0x54f8a3,'folderPath':_0x58a275,'existingJourney':_0x4a471f,'isNew':_0x2c9de1[_0x5cb1e5(0x2b3)],'hasChanges':_0x2c9de1[_0x5cb1e5(0x264)],'diff':_0x2c9de1['diff']});}return{'journeyFiles':_0x4b6852,'foldersToCreate':_0x41d234};}export function calculateActivationActions(_0x4acf8e,_0xa54fe9,_0x290477,_0x491b4d){const _0x32151a=a152_0x14882b,_0x181261=[],_0x481e69=new Map();for(const _0x213c92 of _0xa54fe9){_0x481e69[_0x32151a(0x1f4)](_0x213c92['name'],_0x213c92);}const _0x3e9f98=new Map();for(const _0x5ac9c5 of _0x4acf8e){_0x3e9f98[_0x32151a(0x1f4)](_0x5ac9c5['name'],_0x5ac9c5);}for(const _0x3f2534 of _0x4acf8e){const _0x521dc8=_0x481e69[_0x32151a(0x2c4)](_0x3f2534[_0x32151a(0x24d)]);if(!_0x521dc8)_0x181261[_0x32151a(0x299)]({'type':_0x32151a(0x2b0),'name':_0x3f2534[_0x32151a(0x24d)],'yamlActivation':_0x3f2534});else{const _0x41a2de=activationResponseToDef(_0x521dc8,_0x290477,_0x491b4d),_0x17537c=a152_0x2adcdb[_0x32151a(0x1fc)](_0x41a2de),_0x5e4c34=a152_0x2adcdb['stringify'](_0x3f2534);_0x17537c!==_0x5e4c34&&_0x181261[_0x32151a(0x299)]({'type':_0x32151a(0x250),'name':_0x3f2534[_0x32151a(0x24d)],'yamlActivation':_0x3f2534,'existingActivation':_0x521dc8});}}for(const _0x35d330 of _0xa54fe9){!_0x3e9f98['has'](_0x35d330[_0x32151a(0x24d)])&&_0x181261[_0x32151a(0x299)]({'type':'delete','name':_0x35d330[_0x32151a(0x24d)],'existingActivation':_0x35d330});}return _0x181261;}function calculateYamlDiff(_0x2617e0,_0x476357){if(_0x476357){const _0x3eb989=generateDiff(_0x476357,_0x2617e0),_0x24d413=hasChanges(_0x3eb989);return{'isNew':![],'hasChanges':_0x24d413,'diff':_0x24d413?formatDiffWithColors(_0x3eb989):undefined};}const _0x53729c=generateDiff('',_0x2617e0);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x53729c)};}export function calculateSegmentDiff(_0x277499,_0x241219,_0x12973d,_0x346ae3,_0x2cdba5){const _0x1e3b02=segmentToYamlString(_0x277499),_0x2bd798=_0x241219?segmentToYamlString(segmentWithActivationsToYaml(_0x241219,_0x12973d,undefined,_0x346ae3,_0x2cdba5)):undefined;return calculateYamlDiff(_0x1e3b02,_0x2bd798);}export function calculateJourneyDiff(_0x27fc91,_0x412782){const _0x53f9ae=normalizeJourneyDef(_0x27fc91,_0x27fc91),_0x4dc132=a152_0x338dca(_0x53f9ae),_0x17b7ea=_0x412782?a152_0x338dca(normalizeJourneyDef(_0x412782,_0x27fc91)):undefined;return calculateYamlDiff(_0x4dc132,_0x17b7ea);}export function findSegmentsToDelete(_0x2f529e,_0x5730d8,_0x26663d,_0x5d4827,_0x1c60e3){const _0x2f01dc=a152_0x14882b,_0x1ddef3=new Set();for(const {yamlConfig:_0x579f60,folderPath:_0x41732c}of _0x5730d8){_0x1ddef3[_0x2f01dc(0x25a)](_0x41732c+':'+_0x579f60[_0x2f01dc(0x24d)]);}return _0x2f529e[_0x2f01dc(0x274)](_0x2d1c69=>{const _0x232571=_0x2f01dc,_0x5a191f=_0x2d1c69['segmentFolderId']?_0x26663d['get'](_0x2d1c69[_0x232571(0x238)][_0x232571(0x28f)]())||'':'',_0x3d726d=_0x5a191f+':'+_0x2d1c69[_0x232571(0x24d)];if(_0x1ddef3['has'](_0x3d726d))return![];if(_0x1c60e3)return _0x5a191f===_0x5d4827||_0x5a191f[_0x232571(0x281)](_0x5d4827+'/');return!![];});}export function findJourneysToDelete(_0x3f14fe,_0x50f3f4,_0x2f7dae,_0x1266b2,_0x243733){const _0x4add7c=a152_0x14882b,_0xcad92e=new Set();for(const {yamlConfig:_0xf62a3,folderPath:_0x194d4c}of _0x50f3f4){_0xcad92e[_0x4add7c(0x25a)](_0x194d4c+':'+_0xf62a3[_0x4add7c(0x24d)]);}return _0x3f14fe[_0x4add7c(0x274)](_0x497362=>{const _0x13b6c1=_0x4add7c,_0x3da643=_0x497362[_0x13b6c1(0x2aa)]?_0x2f7dae[_0x13b6c1(0x2c4)](_0x497362['folderId'])||'':'',_0x55bd4d=_0x3da643+':'+_0x497362[_0x13b6c1(0x1d1)];if(_0xcad92e[_0x13b6c1(0x20c)](_0x55bd4d))return![];if(_0x243733)return _0x3da643===_0x1266b2||_0x3da643['startsWith'](_0x1266b2+'/');return!![];});}export function buildSegmentLookupMap(_0xeb14ae,_0x12e7b2){const _0x58c3d9=a152_0x14882b,_0x49abf3=new Map();for(const _0x204141 of _0xeb14ae){const _0xae7d6d=_0x204141[_0x58c3d9(0x238)]?_0x12e7b2[_0x58c3d9(0x2c4)](_0x204141[_0x58c3d9(0x238)][_0x58c3d9(0x28f)]())||'':'',_0x519f9f=_0xae7d6d+':'+_0x204141['name'];_0x49abf3[_0x58c3d9(0x1f4)](_0x519f9f,_0x204141);}return _0x49abf3;}export function buildSegmentNameToIdMap(_0x31a3ea){const _0x195c62=a152_0x14882b,_0x18c2da=new Map();for(const _0x55f8b0 of _0x31a3ea){_0x18c2da[_0x195c62(0x1f4)](_0x55f8b0[_0x195c62(0x24d)],_0x55f8b0['id']);}return _0x18c2da;}export function buildJourneyBundleLookupMap(_0x3cffe5,_0x5f1546){const _0x2118ba=a152_0x14882b,_0xb2df2a=new Map();for(const _0x162e2f of _0x3cffe5){const _0x21f0d2=_0x162e2f[_0x2118ba(0x2aa)]?_0x5f1546['get'](_0x162e2f['folderId'])||'':'',_0x36f9db=_0x21f0d2+':'+_0x162e2f[_0x2118ba(0x1d1)];!_0xb2df2a[_0x2118ba(0x20c)](_0x36f9db)&&_0xb2df2a[_0x2118ba(0x1f4)](_0x36f9db,[]),_0xb2df2a[_0x2118ba(0x2c4)](_0x36f9db)[_0x2118ba(0x299)](_0x162e2f);}for(const _0x478a5e of _0xb2df2a[_0x2118ba(0x205)]()){_0x478a5e[_0x2118ba(0x232)]((_0x4f0339,_0xf26a78)=>(_0x4f0339['versionNumber']||0x0)-(_0xf26a78[_0x2118ba(0x1d8)]||0x0));}return _0xb2df2a;}export function collectFoldersToCreate(_0x49118a,_0x5810ef){const _0x10a6cc=a152_0x14882b,_0x16da9a=new Set();for(const _0x4f0640 of _0x49118a){if(!_0x4f0640)continue;if(_0x5810ef['has'](_0x4f0640))continue;const _0x50fe77=_0x4f0640[_0x10a6cc(0x2d7)]('/');let _0x118c7f='';for(const _0x505fc7 of _0x50fe77){_0x118c7f=_0x118c7f?_0x118c7f+'/'+_0x505fc7:_0x505fc7,!_0x5810ef[_0x10a6cc(0x20c)](_0x118c7f)&&_0x16da9a[_0x10a6cc(0x25a)](_0x118c7f);}}return _0x16da9a;}export function parseAndClassifyYamlFiles(_0x1a985f,_0x35bf51,_0x906b83){const _0x126ecd=a152_0x14882b,_0x3bd17f=[],_0x421e36=[];for(const _0x39dc3d of _0x1a985f){const _0x4d323e=a152_0x35b22c[_0x126ecd(0x2a3)](_0x35bf51,a152_0x35b22c['dirname'](_0x39dc3d)),_0x697024=_0x4d323e==='.'?'':_0x4d323e[_0x126ecd(0x2c2)](/\\/g,'/'),_0x1d9f5d=readFileSync(_0x39dc3d,'utf-8'),_0x19826f=a152_0x2adcdb[_0x126ecd(0x26c)](_0x1d9f5d);if(isJourneyDef(_0x19826f)){const _0x651651=a152_0x23eb1a(_0x1d9f5d);_0x421e36[_0x126ecd(0x299)]({'yamlConfig':_0x651651,'folderPath':_0x697024,'sourcePath':_0x39dc3d});}else{if(!_0x906b83?.[_0x126ecd(0x1dd)]){const _0x3eb703=parseSegmentYamlFile(_0x1d9f5d),_0x27c914=normalizeChildSegmentYaml(_0x3eb703);_0x3bd17f[_0x126ecd(0x299)]({'yamlConfig':_0x27c914,'folderPath':_0x697024,'sourcePath':_0x39dc3d});}}}return{'segments':_0x3bd17f,'journeys':_0x421e36};}export function validateParsedFiles(_0x22bc5e,_0x1d002e){const _0x1a015a=a152_0x14882b,_0x29964b=[];for(const {yamlConfig:_0x55bbc8,sourcePath:_0x1eca23}of _0x22bc5e[_0x1a015a(0x2bf)]){const _0x595f9a=readFileSync(_0x1eca23,_0x1a015a(0x29b)),_0x3c4f20=a152_0x2adcdb[_0x1a015a(0x1da)](_0x595f9a),_0x1181b3=validateSegmentDef(_0x55bbc8,{'source':_0x595f9a,'document':_0x3c4f20},{'skipSchema':!![]});if(!_0x1181b3['valid']){const _0x11b0d5=a152_0x35b22c[_0x1a015a(0x2a3)](_0x1d002e,_0x1eca23);_0x29964b['push']({'filePath':_0x11b0d5,'source':_0x595f9a,'result':_0x1181b3,'isJourney':![]});}}for(const {yamlConfig:_0x4a18af,sourcePath:_0x6bb9d2}of _0x22bc5e[_0x1a015a(0x210)]){const _0x445864=readFileSync(_0x6bb9d2,_0x1a015a(0x29b)),_0x50eccc=a152_0x2adcdb[_0x1a015a(0x1da)](_0x445864),_0x4ce132=validateJourneyDef(_0x4a18af,{'source':_0x445864,'document':_0x50eccc},{'skipSchema':!![]});if(!_0x4ce132[_0x1a015a(0x243)]){const _0x3c293a=a152_0x35b22c['relative'](_0x1d002e,_0x6bb9d2);_0x29964b[_0x1a015a(0x299)]({'filePath':_0x3c293a,'source':_0x445864,'result':_0x4ce132,'isJourney':!![]});}}return _0x29964b;}export function formatValidationErrors(_0x3b08ee){const _0x3d9968=a152_0x14882b,_0x51cf97=[];for(const {filePath:_0x4c2319,source:_0x4a37d2,result:_0x3a6c66,isJourney:_0x19bd3f}of _0x3b08ee){const _0xe94222=_0x19bd3f?_0x3d9968(0x2a4):_0x3d9968(0x23d);_0x51cf97[_0x3d9968(0x299)]('\x0a'+_0x4c2319+'\x20('+_0xe94222+_0x3d9968(0x24f)+_0x3a6c66[_0x3d9968(0x200)][_0x3d9968(0x224)]+'\x20error(s)'),_0x51cf97[_0x3d9968(0x299)](formatValidationResult(_0x3a6c66,_0x4a37d2,_0x4c2319));}return _0x51cf97[_0x3d9968(0x1d5)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x3e5fee){const _0x6a1ce0=a152_0x14882b,_0x1abca6=new Set(),_0x9fe8c3=new Map(),_0x2f7b04=collectSegmentUsageCounts(_0x3e5fee);if(_0x3e5fee['segments'])for(const [_0x42847d,_0x4603ee]of Object[_0x6a1ce0(0x1f7)](_0x3e5fee[_0x6a1ce0(0x2bf)])){_0x1abca6[_0x6a1ce0(0x25a)](_0x42847d);if(_0x4603ee[_0x6a1ce0(0x202)]){const _0x10390f=yamlRuleToApi(_0x4603ee[_0x6a1ce0(0x202)]),_0x4093f5=apiRuleToYaml(_0x10390f);_0x9fe8c3[_0x6a1ce0(0x1f4)](_0x42847d,_0x4093f5);}}const _0x15611c=new Map();let _0x5a420d=0x0;for(const [_0x342c2a,_0x540846]of _0x9fe8c3){const _0x3d6249=serializeExpandedRule(_0x540846,_0x9fe8c3),_0x4a8e73=_0x15611c[_0x6a1ce0(0x2c4)](_0x3d6249)||[];_0x4a8e73[_0x6a1ce0(0x299)]({'name':_0x342c2a,'index':_0x5a420d}),_0x15611c['set'](_0x3d6249,_0x4a8e73),_0x5a420d++;}const _0x5923cf=new Map();for(const [_0xe1493f,_0x89636b]of _0x15611c){const _0x4032ca=_0x89636b[_0x6a1ce0(0x280)]()[_0x6a1ce0(0x232)]((_0x2e2b40,_0x34c1ae)=>{const _0x1c10f6=_0x6a1ce0,_0x32b05a=_0x2f7b04[_0x1c10f6(0x2c4)](_0x2e2b40[_0x1c10f6(0x24d)])||0x0,_0x51800b=_0x2f7b04[_0x1c10f6(0x2c4)](_0x34c1ae[_0x1c10f6(0x24d)])||0x0;if(_0x32b05a!==_0x51800b)return _0x51800b-_0x32b05a;return _0x2e2b40[_0x1c10f6(0x1e8)]-_0x34c1ae[_0x1c10f6(0x1e8)];})['map'](_0x2537fc=>_0x2537fc[_0x6a1ce0(0x24d)]),_0x485410=[];for(const _0x3b2049 of _0x4032ca){const _0x12d9f4=_0x2f7b04[_0x6a1ce0(0x2c4)](_0x3b2049)||0x0,_0x23422c=Math[_0x6a1ce0(0x2b5)](_0x12d9f4,0x1);for(let _0x3410f3=0x0;_0x3410f3<_0x23422c;_0x3410f3++){_0x485410[_0x6a1ce0(0x299)](_0x3b2049);}}_0x5923cf[_0x6a1ce0(0x1f4)](_0xe1493f,_0x485410);}return{'existingLocalSegmentNames':_0x1abca6,'localSegmentRules':_0x9fe8c3,'localExpandedRuleToNames':_0x5923cf};}export function createSegmentIdResolver(_0x270843,_0x55b76e){return async _0x36b197=>{const _0x3cd29d=a152_0x4c54,_0x568977=_0x270843[_0x3cd29d(0x2c4)](_0x36b197);if(!_0x568977)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x3cd29d(0x22f)+_0x36b197+_0x3cd29d(0x24e)+_0x55b76e+'\x27)');return _0x568977;};}export function extractRootFolderId(_0x51c37f){const _0x2dd336=a152_0x14882b;return _0x51c37f['relationships']?.['parentSegmentFolder']?.[_0x2dd336(0x22a)]?.['id']||_0x51c37f[_0x2dd336(0x2a6)]?.[_0x2dd336(0x1f9)]?.[_0x2dd336(0x22a)]?.['id'];}export function buildConnectionMaps(_0x11b8f3){const _0x55b909=a152_0x14882b,_0xd32a=new Map(),_0x425600=new Map(),_0x49d77b=new Map();for(const _0xf4d0d of _0x11b8f3){_0xd32a[_0x55b909(0x1f4)](_0xf4d0d[_0x55b909(0x24d)],parseInt(_0xf4d0d['id'],0xa)),_0x425600['set'](_0xf4d0d['id'],_0xf4d0d[_0x55b909(0x24d)]),_0x49d77b[_0x55b909(0x1f4)](_0xf4d0d[_0x55b909(0x24d)],_0xf4d0d[_0x55b909(0x20f)]);}return{'nameToId':_0xd32a,'idToName':_0x425600,'nameToType':_0x49d77b};}export function calculatePushStats(_0x38103a,_0x3f0e26,_0x590544,_0xeabda7,_0x346c09,_0x2e2df,_0x132346){const _0x5f1aef=a152_0x14882b,_0x523fc4=_0x38103a[_0x5f1aef(0x274)](_0x4bd9a4=>_0x4bd9a4['isNew']),_0x2ffabc=_0x38103a['filter'](_0x3661eb=>!_0x3661eb[_0x5f1aef(0x2b3)]&&_0x3661eb[_0x5f1aef(0x264)]),_0x5ed749=_0x38103a['filter'](_0x207557=>!_0x207557[_0x5f1aef(0x2b3)]&&!_0x207557[_0x5f1aef(0x264)]),_0x58e8fb=_0x2e2df?_0xeabda7:[],_0x267c29=_0x3f0e26['filter'](_0x3b7262=>_0x3b7262[_0x5f1aef(0x2b3)]),_0x2b6932=_0x3f0e26[_0x5f1aef(0x274)](_0x1c348a=>!_0x1c348a[_0x5f1aef(0x2b3)]&&_0x1c348a[_0x5f1aef(0x264)]),_0x56f79c=_0x3f0e26[_0x5f1aef(0x274)](_0x1c7ff5=>!_0x1c7ff5['isNew']&&!_0x1c7ff5[_0x5f1aef(0x264)]),_0x10bc0b=_0x2e2df?_0x346c09:[],_0x2a490b=_0x38103a['flatMap'](_0x2e7d14=>_0x2e7d14[_0x5f1aef(0x207)]),_0x2f440c=_0x2a490b[_0x5f1aef(0x274)](_0xee5f31=>_0xee5f31[_0x5f1aef(0x20f)]===_0x5f1aef(0x2b0)),_0x23b950=_0x2a490b[_0x5f1aef(0x274)](_0x4ec37c=>_0x4ec37c['type']==='update'),_0xf6adaf=_0x2a490b[_0x5f1aef(0x274)](_0x38162d=>_0x38162d[_0x5f1aef(0x20f)]===_0x5f1aef(0x1e6)),_0x5b6a3c=Array['from'](_0x590544)[_0x5f1aef(0x232)](),_0x3ee1a3=_0x132346?![]:_0x523fc4[_0x5f1aef(0x224)]>0x0||_0x2ffabc['length']>0x0||_0x58e8fb['length']>0x0,_0x17d43d=_0x267c29['length']>0x0||_0x2b6932[_0x5f1aef(0x224)]>0x0||_0x10bc0b[_0x5f1aef(0x224)]>0x0,_0x5edbea=_0x132346?![]:_0x2a490b[_0x5f1aef(0x224)]>0x0,_0x49b06c=_0x5b6a3c['length']>0x0;return{'segments':{'new':_0x523fc4,'changed':_0x2ffabc,'unchanged':_0x5ed749,'toDelete':_0x58e8fb},'journeys':{'new':_0x267c29,'changed':_0x2b6932,'unchanged':_0x56f79c,'toDelete':_0x10bc0b},'activations':{'all':_0x2a490b,'toCreate':_0x2f440c,'toUpdate':_0x23b950,'toDelete':_0xf6adaf},'folders':{'toCreate':_0x5b6a3c},'counts':{'segments':{'new':_0x523fc4[_0x5f1aef(0x224)],'changed':_0x2ffabc[_0x5f1aef(0x224)],'unchanged':_0x5ed749[_0x5f1aef(0x224)],'toDelete':_0x58e8fb[_0x5f1aef(0x224)]},'journeys':{'new':_0x267c29[_0x5f1aef(0x224)],'changed':_0x2b6932[_0x5f1aef(0x224)],'unchanged':_0x56f79c['length'],'toDelete':_0x10bc0b['length']},'activations':{'create':_0x2f440c[_0x5f1aef(0x224)],'update':_0x23b950[_0x5f1aef(0x224)],'delete':_0xf6adaf[_0x5f1aef(0x224)]},'folders':_0x5b6a3c[_0x5f1aef(0x224)]},'hasChanges':_0x3ee1a3||_0x17d43d||_0x5edbea||_0x49b06c};}export async function buildPushExecutionContext(_0x4d97b4,_0x5ea252,_0x6130c4,_0x155d39,_0x8b4c61,_0xa0de2d){const _0x3f2357=a152_0x14882b,_0x137a83=extractRootFolderId(_0x6130c4),{pathToId:_0x33f7e9,idToPath:_0x12616e}=buildFolderMaps(_0x8b4c61),_0xe0faf4=buildSegmentNameToIdMap(_0x155d39),_0x33de9c=new Map(),{batchAsync:_0x17d553}=await import('../../utils/async.js'),[_0x1d0c9d,_0x409ad5]=await Promise[_0x3f2357(0x2c7)]([_0x4d97b4['user'][_0x3f2357(0x25c)](),_0x4d97b4['connection'][_0x3f2357(0x251)](),((async()=>{const _0x4c425c=_0x3f2357;!_0xa0de2d&&_0x155d39[_0x4c425c(0x224)]>0x0&&await _0x17d553(_0x155d39,async _0x2325f0=>{const _0x360d07=_0x4c425c,_0x2d9e59=await _0x4d97b4[_0x360d07(0x23d)][_0x360d07(0x240)](_0x5ea252,_0x2325f0['id']);_0x33de9c[_0x360d07(0x1f4)](_0x2325f0['id'],_0x2d9e59);});})())]),{emailToId:_0x2f1c63,idToEmail:_0x4c2305}=_0x1d0c9d,_0x2c442f=buildConnectionMaps(_0x409ad5);return{'rootFolderId':_0x137a83,'folderPathToId':_0x33f7e9,'folderIdToPath':_0x12616e,'segmentNameToId':_0xe0faf4,'activationsBySegmentId':_0x33de9c,'emailToIdMap':_0x2f1c63,'idToEmailMap':_0x4c2305,'connectionNameToIdMap':_0x2c442f[_0x3f2357(0x1f0)],'connectionIdToNameMap':_0x2c442f['idToName'],'connectionNameToTypeMap':_0x2c442f[_0x3f2357(0x1cf)]};}export function createPushYamlContextForBundle(_0x48c3e1,_0x98d12f,_0x47c202,_0x5950b0,_0x4f65bb,_0x5dec88,_0x47f613,_0x4b94cb){const {existingLocalSegmentNames:_0x40e86f,localExpandedRuleToNames:_0x56429d}=_0x5950b0,_0x2e5d53=new Set(),_0x17894f=new Map(),_0x10ac93=new Map(),_0x6cf385=new Map(),_0x5eeb83=createJumpTargetCache(),_0x216da0=new Map(),_0x146795=new Map(),_0x277de9=new Set();let _0x152b8d;const _0x1a6fd7=_0x1b34ce=>{const _0x576d0a={'resolveSegment':async _0x40d964=>{const _0x22b2d4=a152_0x4c54,_0x859753=_0x6cf385[_0x22b2d4(0x2c4)](_0x40d964);if(_0x859753!==undefined)return{'name':_0x859753,'isJourneyLocal':!![]};try{const _0x37c7f0=await fetchSegment(_0x48c3e1,_0x98d12f,_0x40d964,_0x47c202);if(!_0x37c7f0)throw new Error(_0x22b2d4(0x2ba));const _0xe7a0a6=generateJourneyLocalName(_0x37c7f0['name']),_0x277054=_0x37c7f0[_0x22b2d4(0x27f)]===SEGMENT_KIND_JOURNEY&&_0xe7a0a6!==undefined;let _0x4215f6=_0x37c7f0[_0x22b2d4(0x24d)],_0xa90cf2;if(_0x277054&&_0x37c7f0[_0x22b2d4(0x202)]){const _0x4f83e9=apiRuleToYaml(_0x37c7f0[_0x22b2d4(0x202)]);_0x146795[_0x22b2d4(0x1f4)](_0x40d964,_0x4f83e9);const _0x32a19a=async _0x4fe02f=>{const _0x1fc840=_0x22b2d4,_0xf5bf92=collectSegmentRefsFromRule(_0x4fe02f);for(const _0x5e1761 of _0xf5bf92){if(!_0x146795[_0x1fc840(0x20c)](_0x5e1761))try{const _0x35e33b=await fetchSegment(_0x48c3e1,_0x98d12f,_0x5e1761,_0x47c202);if(_0x35e33b?.[_0x1fc840(0x202)]){const _0x1da281=apiRuleToYaml(_0x35e33b[_0x1fc840(0x202)]);_0x146795[_0x1fc840(0x1f4)](_0x5e1761,_0x1da281),await _0x32a19a(_0x1da281);}}catch(_0x3d6173){logger[_0x1fc840(0x2ab)](_0x1fc840(0x29d)+_0x5e1761+':\x20'+_0x3d6173);}}};await _0x32a19a(_0x4f83e9);const _0x16b413=serializeExpandedRule(_0x4f83e9,_0x146795),_0x142322=_0x56429d[_0x22b2d4(0x2c4)](_0x16b413);if(_0x142322&&_0x142322[_0x22b2d4(0x224)]>0x0){const _0xe7cd27=_0x17894f[_0x22b2d4(0x2c4)](_0x16b413)||0x0,_0x103bb4=_0x142322[_0xe7cd27]||_0x142322[_0x142322[_0x22b2d4(0x224)]-0x1];_0x17894f[_0x22b2d4(0x1f4)](_0x16b413,_0xe7cd27+0x1),_0x4215f6=_0x103bb4,_0x2e5d53[_0x22b2d4(0x25a)](_0x4215f6),_0x6cf385[_0x22b2d4(0x1f4)](_0x40d964,_0x4215f6);const _0x1a8918=await resolveRuleSegmentRefs(_0x4f83e9,async _0x3d1dcb=>{const _0x789c44=_0x22b2d4,_0x4fa1b9=_0x6cf385[_0x789c44(0x2c4)](_0x3d1dcb);if(_0x4fa1b9)return _0x4fa1b9;const _0x3a9e72=await _0x152b8d[_0x789c44(0x209)](_0x3d1dcb);return _0x3a9e72['name'];});_0xa90cf2={'description':_0x37c7f0[_0x22b2d4(0x2b4)],'rule':_0x1a8918};}else{const _0xe8bb34=_0x216da0['get'](_0x16b413);if(_0xe8bb34)_0x4215f6=_0xe8bb34,_0x6cf385[_0x22b2d4(0x1f4)](_0x40d964,_0x4215f6);else{if(_0xe7a0a6){let _0x5f4612=_0xe7a0a6,_0x5b9d39=0x2;while(_0x2e5d53[_0x22b2d4(0x20c)](_0x5f4612)||_0x40e86f['has'](_0x5f4612)){_0x5f4612=_0xe7a0a6+'_'+_0x5b9d39,_0x5b9d39++;}_0x2e5d53[_0x22b2d4(0x25a)](_0x5f4612),_0x4215f6=_0x5f4612;}_0x6cf385[_0x22b2d4(0x1f4)](_0x40d964,_0x4215f6),_0x216da0[_0x22b2d4(0x1f4)](_0x16b413,_0x4215f6);const _0x11c899=await resolveRuleSegmentRefs(_0x4f83e9,async _0x5b2300=>{const _0x31dbc8=_0x22b2d4,_0x22bfae=_0x6cf385[_0x31dbc8(0x2c4)](_0x5b2300);if(_0x22bfae)return _0x22bfae;const _0x74a224=await _0x152b8d[_0x31dbc8(0x209)](_0x5b2300);return _0x74a224[_0x31dbc8(0x24d)];});_0xa90cf2={'description':_0x37c7f0[_0x22b2d4(0x2b4)],'rule':_0x11c899};}}}return{'name':_0x4215f6,'isJourneyLocal':_0x277054,'definition':_0xa90cf2};}catch(_0x13994e){return logger[_0x22b2d4(0x2ab)](_0x22b2d4(0x286)+_0x40d964+':\x20'+_0x13994e),{'name':_0x40d964,'isJourneyLocal':![]};}},'resolveActivation':async _0x3c8b87=>{const _0x317ca5=a152_0x4c54,_0x4d9932=_0x10ac93[_0x317ca5(0x2c4)](_0x3c8b87);if(_0x4d9932!==undefined)return{'name':_0x4d9932,'isJourneyLocal':!![]};try{let _0x21b7de=_0x47f613?.['get'](_0x3c8b87);!_0x21b7de&&(_0x21b7de=await _0x48c3e1[_0x317ca5(0x2a4)][_0x317ca5(0x26e)](_0x1b34ce,_0x3c8b87));const _0x6677de=_0x21b7de[_0x317ca5(0x1ed)][_0x317ca5(0x25e)][_0x317ca5(0x24d)]||_0x3c8b87,_0x10e49d=sanitizeYamlKey(_0x6677de)||_0x317ca5(0x208)+_0x3c8b87,_0x45261c=_0x10e49d;_0x10ac93[_0x317ca5(0x1f4)](_0x3c8b87,_0x45261c);const _0x55e743=journeyActivationStepToYaml(_0x21b7de,_0x4f65bb,_0x5dec88);return{'name':_0x45261c,'isJourneyLocal':!![],'definition':_0x55e743};}catch(_0x1d9c25){return logger[_0x317ca5(0x2ab)](_0x317ca5(0x2b1)+_0x3c8b87+':\x20'+_0x1d9c25),{'name':_0x3c8b87,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3ab700,_0x579025)=>resolveJumpTarget(_0x3ab700,_0x579025,_0x5eeb83,async _0x35d15=>{const _0x2b4124=a152_0x4c54,_0x407d82=_0x4b94cb?.[_0x2b4124(0x2c4)](_0x35d15);if(_0x407d82)return _0x407d82;return _0x48c3e1[_0x2b4124(0x2a4)]['getJourney'](_0x35d15);})};return _0x152b8d=_0x576d0a,_0x576d0a;},_0x35485f=async _0x34c288=>{const _0x3a1984=a152_0x4c54,{collectSegmentIdsFromJourneyApi:_0x1facc6}=await import('./journey-yaml.js'),{batchAsync:_0x3c99f0}=await import('../../utils/async.js'),_0x2d133a=new Set();for(const _0x209c11 of _0x34c288){let _0x322192=_0x4b94cb?.[_0x3a1984(0x2c4)](_0x209c11);!_0x322192&&(_0x322192=await _0x48c3e1[_0x3a1984(0x2a4)][_0x3a1984(0x1fb)](_0x209c11));const _0x299c36=_0x1facc6(_0x322192);for(const _0x3e27e2 of _0x299c36){_0x2d133a[_0x3a1984(0x25a)](_0x3e27e2);}}let _0x4492d5=Array[_0x3a1984(0x28a)](_0x2d133a);while(_0x4492d5['length']>0x0){const _0x101c4e=_0x4492d5[_0x3a1984(0x274)](_0x87b068=>!_0x277de9[_0x3a1984(0x20c)](_0x87b068));if(_0x101c4e[_0x3a1984(0x224)]===0x0)break;const _0x4d0c95=await _0x3c99f0(_0x101c4e,async _0x838e75=>{const _0x596ef6=_0x3a1984;_0x277de9[_0x596ef6(0x25a)](_0x838e75);const _0x297378=await fetchSegment(_0x48c3e1,_0x98d12f,_0x838e75,_0x47c202);if(!_0x297378)return null;return{'segmentId':_0x838e75,'segment':_0x297378};},0xa),_0x38851a=new Set();for(const _0x3a8185 of _0x4d0c95){if(!_0x3a8185?.[_0x3a1984(0x23d)]?.[_0x3a1984(0x202)])continue;const _0x25d094=apiRuleToYaml(_0x3a8185[_0x3a1984(0x23d)][_0x3a1984(0x202)]);_0x146795['set'](_0x3a8185['segmentId'],_0x25d094);const _0x3cb1fe=collectSegmentRefsFromRule(_0x25d094);for(const _0x16f138 of _0x3cb1fe){!_0x277de9[_0x3a1984(0x20c)](_0x16f138)&&_0x38851a[_0x3a1984(0x25a)](_0x16f138);}}_0x4492d5=Array[_0x3a1984(0x28a)](_0x38851a);}};return{'createYamlContext':_0x1a6fd7,'prefetchJourneySegments':_0x35485f};}export async function executePushSegments(_0x1af817,_0x307f3a,_0x1a6a23,_0x8dad68,_0x16c99c){const _0xd92b90=a152_0x14882b,{segmentDefToCreateRequest:_0x3c5744,segmentDefToUpdateRequest:_0x23c406}=await import(_0xd92b90(0x2c5)),_0x2dce98=_0x1a6a23[_0xd92b90(0x27d)],_0x23924f=0x5,_0x1a5c2a=async _0x5c8e23=>{const _0x39eb43=_0xd92b90,_0x462902=_0x5c8e23['folderPath']?_0x2dce98[_0x39eb43(0x2c4)](_0x5c8e23[_0x39eb43(0x2a2)]):undefined;let _0x55b002;const _0x3ae965={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5065cf=_0x5c8e23[_0x39eb43(0x2db)];if(_0x5c8e23['yamlConfig'][_0x39eb43(0x202)]){const _0x3ffccb=createSegmentIdResolver(_0x1a6a23[_0x39eb43(0x24b)],_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]),_0x286752=await resolveRuleSegmentIds(_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x202)],_0x3ffccb);_0x5065cf={..._0x5c8e23['yamlConfig'],'rule':_0x286752};}try{if(_0x5c8e23['isNew']){_0x16c99c[_0x39eb43(0x241)]?.({'type':_0x39eb43(0x22b),'name':_0x5c8e23[_0x39eb43(0x2db)]['name']});const _0x2ce8b8=_0x3c5744(_0x5065cf,_0x462902),_0x146881=await _0x16c99c[_0x39eb43(0x27a)](_0x39eb43(0x252)+_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]+_0x39eb43(0x1d3),()=>_0x1af817['segment'][_0x39eb43(0x278)](_0x8dad68[_0x39eb43(0x1f5)],_0x2ce8b8));_0x55b002=_0x146881['data']['id'],_0x1a6a23[_0x39eb43(0x24b)][_0x39eb43(0x1f4)](_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)],_0x55b002),_0x3ae965[_0x39eb43(0x1e7)]={'name':_0x5c8e23[_0x39eb43(0x2db)]['name'],'id':_0x55b002},_0x16c99c[_0x39eb43(0x241)]?.({'type':_0x39eb43(0x289),'name':_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)],'segmentId':_0x55b002}),_0x16c99c['logSuccess']?.('Created\x20segment\x20\x27'+_0x5c8e23['yamlConfig']['name']+'\x27'),_0x3ae965[_0x39eb43(0x236)]=0x1;}else{if(_0x5c8e23[_0x39eb43(0x264)]){_0x16c99c['onProgress']?.({'type':_0x39eb43(0x247),'name':_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]});const _0x36ab91=_0x23c406(_0x5065cf);_0x462902!==_0x5c8e23[_0x39eb43(0x2ae)]?.[_0x39eb43(0x238)]&&(_0x36ab91['segmentFolderId']=_0x462902?parseInt(_0x462902,0xa):undefined),await _0x16c99c['withProgress']('Updating\x20segment\x20\x27'+_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]+'\x27...',()=>_0x1af817[_0x39eb43(0x23d)]['updateSegmentById'](_0x8dad68[_0x39eb43(0x1f5)],_0x5c8e23['existingSegment']['id'],_0x36ab91)),_0x55b002=_0x5c8e23[_0x39eb43(0x2ae)]['id'],_0x16c99c[_0x39eb43(0x241)]?.({'type':_0x39eb43(0x29f),'name':_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]}),_0x16c99c['logSuccess']?.(_0x39eb43(0x222)+_0x5c8e23[_0x39eb43(0x2db)]['name']+'\x27'),_0x3ae965[_0x39eb43(0x1f2)]=0x1;}else _0x55b002=_0x5c8e23['existingSegment']['id'];}}catch(_0x577e97){const _0x4b480a=isHttp400Error(_0x577e97),_0x1bd5e8=_0x4b480a?ErrorCode[_0x39eb43(0x20b)]:ErrorCode[_0x39eb43(0x2bd)],_0x5f3c8b=getErrorMessage(_0x577e97);throw new SDKError(_0x1bd5e8,_0x39eb43(0x245)+(_0x5c8e23[_0x39eb43(0x2b3)]?_0x39eb43(0x2b0):_0x39eb43(0x250))+_0x39eb43(0x2d5)+_0x5c8e23[_0x39eb43(0x20e)]+_0x39eb43(0x255)+_0x5f3c8b,_0x577e97);}try{const _0xbc44fc=await syncActivationsForSegment(_0x1af817,_0x8dad68[_0x39eb43(0x1f5)],_0x55b002,_0x5c8e23['yamlConfig']['name'],_0x5c8e23[_0x39eb43(0x207)],_0x16c99c,_0x5c8e23[_0x39eb43(0x20e)]);_0x3ae965[_0x39eb43(0x223)]=_0xbc44fc;}catch(_0x1983aa){if(_0x1983aa instanceof SDKError)throw _0x1983aa;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x39eb43(0x23b)+_0x5c8e23[_0x39eb43(0x2db)][_0x39eb43(0x24d)]+_0x39eb43(0x1e4)+_0x5c8e23[_0x39eb43(0x20e)]+'\x0a\x20\x20'+getErrorMessage(_0x1983aa),_0x1983aa);}return _0x3ae965;},_0x2b6b89=await batchAsync(_0x307f3a,_0x1a5c2a,_0x23924f),_0x3ec1ca={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xacadb8 of _0x2b6b89){_0x3ec1ca[_0xd92b90(0x236)]+=_0xacadb8[_0xd92b90(0x236)],_0x3ec1ca[_0xd92b90(0x1f2)]+=_0xacadb8['updated'],_0xacadb8[_0xd92b90(0x1e7)]&&_0x3ec1ca[_0xd92b90(0x277)][_0xd92b90(0x1f4)](_0xacadb8[_0xd92b90(0x1e7)][_0xd92b90(0x24d)],_0xacadb8[_0xd92b90(0x1e7)]['id']),_0x3ec1ca[_0xd92b90(0x223)][_0xd92b90(0x236)]+=_0xacadb8['activations']['created'],_0x3ec1ca[_0xd92b90(0x223)][_0xd92b90(0x1f2)]+=_0xacadb8['activations'][_0xd92b90(0x1f2)],_0x3ec1ca[_0xd92b90(0x223)][_0xd92b90(0x279)]+=_0xacadb8[_0xd92b90(0x223)]['deleted'];}return _0x3ec1ca;}async function syncActivationsForSegment(_0x2b9dd4,_0x332bd9,_0x1574ce,_0x15819b,_0x1507eb,_0x44d59e,_0x5f5aa1){const _0x2f5de1=a152_0x14882b,_0x1800bd={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x40203c of _0x1507eb){try{if(_0x40203c['type']===_0x2f5de1(0x2b0)&&_0x40203c[_0x2f5de1(0x246)])_0x44d59e[_0x2f5de1(0x241)]?.({'type':_0x2f5de1(0x22d),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),await _0x44d59e[_0x2f5de1(0x27a)](_0x2f5de1(0x28c)+_0x40203c[_0x2f5de1(0x24d)]+_0x2f5de1(0x1d3),()=>_0x2b9dd4['segment'][_0x2f5de1(0x294)](_0x332bd9,_0x1574ce,_0x40203c[_0x2f5de1(0x246)])),_0x44d59e['onProgress']?.({'type':_0x2f5de1(0x2d4),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),_0x44d59e[_0x2f5de1(0x248)]?.(_0x2f5de1(0x2be)+_0x40203c[_0x2f5de1(0x24d)]+'\x27'),_0x1800bd['created']++;else{if(_0x40203c[_0x2f5de1(0x20f)]===_0x2f5de1(0x250)&&_0x40203c['validatedRequest']&&_0x40203c['existingActivation'])_0x44d59e['onProgress']?.({'type':_0x2f5de1(0x213),'segmentName':_0x15819b,'activationName':_0x40203c[_0x2f5de1(0x24d)]}),await _0x44d59e[_0x2f5de1(0x27a)](_0x2f5de1(0x1f1)+_0x40203c[_0x2f5de1(0x24d)]+'\x27...',()=>_0x2b9dd4[_0x2f5de1(0x23d)][_0x2f5de1(0x2af)](_0x332bd9,_0x1574ce,_0x40203c['existingActivation']['id'],_0x40203c[_0x2f5de1(0x246)])),_0x44d59e['onProgress']?.({'type':_0x2f5de1(0x2a9),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),_0x44d59e[_0x2f5de1(0x248)]?.(_0x2f5de1(0x1d0)+_0x40203c['name']+'\x27'),_0x1800bd[_0x2f5de1(0x1f2)]++;else _0x40203c[_0x2f5de1(0x20f)]===_0x2f5de1(0x1e6)&&_0x40203c[_0x2f5de1(0x1e0)]&&(_0x44d59e[_0x2f5de1(0x241)]?.({'type':_0x2f5de1(0x1f8),'segmentName':_0x15819b,'activationName':_0x40203c['name']}),await _0x44d59e['withProgress'](_0x2f5de1(0x1f6)+_0x40203c[_0x2f5de1(0x24d)]+_0x2f5de1(0x1d3),()=>_0x2b9dd4[_0x2f5de1(0x23d)]['deleteActivation'](_0x332bd9,_0x1574ce,_0x40203c['existingActivation']['id'])),_0x44d59e[_0x2f5de1(0x241)]?.({'type':_0x2f5de1(0x297),'segmentName':_0x15819b,'activationName':_0x40203c[_0x2f5de1(0x24d)]}),_0x44d59e[_0x2f5de1(0x2bb)]?.(_0x2f5de1(0x24a)+_0x40203c[_0x2f5de1(0x24d)]+'\x27'),_0x1800bd[_0x2f5de1(0x279)]++);}}catch(_0x5a63f5){const _0x4b5e2e=isHttp400Error(_0x5a63f5),_0x3088cd=_0x4b5e2e?ErrorCode[_0x2f5de1(0x2cc)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x981f75=getErrorMessage(_0x5a63f5);throw new SDKError(_0x3088cd,_0x2f5de1(0x245)+_0x40203c['type']+_0x2f5de1(0x23f)+_0x40203c[_0x2f5de1(0x24d)]+_0x2f5de1(0x1e4)+_0x5f5aa1+'\x0a\x20\x20'+_0x981f75,_0x5a63f5);}}return _0x1800bd;}export async function executePushFolders(_0xb74b5f,_0x464e74,_0x1e98e3,_0x395a39,_0x5e2cf0){const _0x2bc17e=a152_0x14882b,_0x1934b7=new Map(_0x1e98e3),_0x1ec58f=sortFoldersByDepth(_0x464e74);for(const _0x440e2b of _0x1ec58f){const _0x3a924d=_0x440e2b[_0x2bc17e(0x2d7)]('/'),_0x3a1deb=_0x3a924d[_0x3a924d[_0x2bc17e(0x224)]-0x1],_0x46ce0b=_0x3a924d[_0x2bc17e(0x280)](0x0,-0x1)[_0x2bc17e(0x1d5)]('/'),_0x536db6=_0x1934b7[_0x2bc17e(0x2c4)](_0x46ce0b);_0x5e2cf0[_0x2bc17e(0x241)]?.({'type':'folder_creating','folder':_0x440e2b});const _0x43ac50={'name':_0x3a1deb,'parentFolderId':_0x536db6},_0x49abae=await _0x5e2cf0[_0x2bc17e(0x27a)](_0x2bc17e(0x2ca)+_0x440e2b+'\x27...',()=>_0xb74b5f[_0x2bc17e(0x23d)][_0x2bc17e(0x249)](_0x395a39[_0x2bc17e(0x1f5)],_0x43ac50));_0x1934b7[_0x2bc17e(0x1f4)](_0x440e2b,_0x49abae[_0x2bc17e(0x22a)]['id']),_0x5e2cf0['onProgress']?.({'type':_0x2bc17e(0x2b6),'folder':_0x440e2b,'folderId':_0x49abae['data']['id']}),_0x5e2cf0[_0x2bc17e(0x27b)]?.(_0x2bc17e(0x290)+_0x440e2b+'\x27');}return _0x1934b7;}export async function executePushSegmentDeletions(_0x1d14a7,_0x346974,_0x46af19){const _0x58dca3=a152_0x14882b;if(_0x346974['length']===0x0)return 0x0;const {batchAsync:_0x1024b5}=await import(_0x58dca3(0x288)),_0x4b5972=0x5,_0x4c9498=await _0x1024b5(_0x346974,async _0x20f2b2=>{const _0x45108e=_0x58dca3;return _0x46af19[_0x45108e(0x241)]?.({'type':_0x45108e(0x2cb),'name':_0x20f2b2[_0x45108e(0x24d)]}),await _0x1d14a7[_0x45108e(0x23d)]['deleteSegment'](_0x20f2b2['id']),_0x46af19[_0x45108e(0x241)]?.({'type':'segment_deleted','name':_0x20f2b2[_0x45108e(0x24d)]}),_0x46af19[_0x45108e(0x2bb)]?.(_0x45108e(0x239)+_0x20f2b2[_0x45108e(0x24d)]+'\x27'),0x1;},_0x4b5972);return _0x4c9498[_0x58dca3(0x1ff)]((_0x4c37fa,_0xacb201)=>_0x4c37fa+_0xacb201,0x0);}export async function executePushJourneys(_0x46eedb,_0x98386d,_0x2af7c3,_0x4a8e6a,_0x1394f3){const _0x316510=a152_0x14882b,{journeyDefToRequest:_0xa433c4}=await import(_0x316510(0x1dc)),{activationDefToCreateRequest:_0x4cac97,yamlRuleToApi:_0x3a491f,validateSegmentRule:_0xc18e2d}=await import(_0x316510(0x2c5)),_0x2e8b70={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4d8c51=new Map(_0x2af7c3[_0x316510(0x24b)]),_0x13b476=0x5;for(let _0x517e6c=0x0;_0x517e6c<_0x98386d[_0x316510(0x224)];_0x517e6c+=_0x13b476){const _0x3fc44a=_0x98386d[_0x316510(0x280)](_0x517e6c,_0x517e6c+_0x13b476),_0x15224b=await Promise[_0x316510(0x2c7)](_0x3fc44a['map'](async _0x5eeffa=>{const _0x2769d1=_0x316510;if(!_0x5eeffa[_0x2769d1(0x2b3)]&&!_0x5eeffa['hasChanges'])return{'action':_0x2769d1(0x1e2),'name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)],'journeyId':_0x5eeffa[_0x2769d1(0x1fd)]?.['id']};const _0x2368cf=_0x5eeffa[_0x2769d1(0x2a2)]?_0x2af7c3[_0x2769d1(0x27d)][_0x2769d1(0x2c4)](_0x5eeffa[_0x2769d1(0x2a2)]):undefined;_0x1394f3[_0x2769d1(0x241)]?.({'type':_0x5eeffa['isNew']?_0x2769d1(0x237):'journey_updating','name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)]});try{const _0x12e07f=await executeSingleJourneyPush(_0x46eedb,_0x5eeffa,{..._0x2af7c3,'segmentNameToId':_0x4d8c51},{'parentId':_0x4a8e6a[_0x2769d1(0x1f5)],'rootFolderId':_0x4a8e6a['rootFolderId'],'folderId':_0x2368cf,'verbose':_0x4a8e6a[_0x2769d1(0x2b9)]},_0x1394f3,{'journeyDefToRequest':_0xa433c4,'activationDefToCreateRequest':_0x4cac97,'yamlRuleToApi':_0x3a491f,'validateSegmentRule':_0xc18e2d});for(const [_0x543059,_0x575b6a]of _0x12e07f['embeddedSegmentNameToId']){_0x4d8c51[_0x2769d1(0x1f4)](_0x543059,_0x575b6a),_0x2e8b70['embeddedSegmentNameToId']['set'](_0x543059,_0x575b6a);}if(_0x12e07f[_0x2769d1(0x268)]===_0x2769d1(0x236))_0x1394f3[_0x2769d1(0x241)]?.({'type':_0x2769d1(0x201),'name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)],'journeyId':_0x12e07f['journeyId']}),_0x1394f3[_0x2769d1(0x248)]?.(_0x2769d1(0x1db)+_0x5eeffa['yamlConfig'][_0x2769d1(0x24d)]+'\x27'),_0x2e8b70[_0x2769d1(0x236)]++;else _0x12e07f[_0x2769d1(0x268)]==='updated'&&(_0x1394f3[_0x2769d1(0x241)]?.({'type':_0x2769d1(0x1ef),'name':_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)]}),_0x1394f3[_0x2769d1(0x248)]?.(_0x2769d1(0x22e)+_0x5eeffa[_0x2769d1(0x2db)][_0x2769d1(0x24d)]+'\x27'),_0x2e8b70[_0x2769d1(0x1f2)]++);return{'action':_0x12e07f[_0x2769d1(0x268)],'name':_0x5eeffa[_0x2769d1(0x2db)]['name'],'journeyId':_0x12e07f[_0x2769d1(0x2d2)]};}catch(_0x4c4d1e){const _0x3d5627=isHttp400Error(_0x4c4d1e),_0x7e705=_0x3d5627?ErrorCode[_0x2769d1(0x2dc)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x3227e9=getErrorMessage(_0x4c4d1e);throw new SDKError(_0x7e705,_0x2769d1(0x245)+(_0x5eeffa[_0x2769d1(0x2b3)]?_0x2769d1(0x2b0):'update')+_0x2769d1(0x231)+_0x5eeffa[_0x2769d1(0x20e)]+_0x2769d1(0x255)+_0x3227e9,_0x4c4d1e);}}));_0x2e8b70[_0x316510(0x1f3)][_0x316510(0x299)](..._0x15224b);}return _0x2e8b70;}async function matchExistingJourneySegments(_0x3fb00a,_0xa2d060,_0xe815b4,_0xead3bf,_0x3a13ef){const _0x5a3809=a152_0x14882b;if(!_0xa2d060[_0x5a3809(0x1fd)]||!_0xa2d060[_0x5a3809(0x2db)][_0x5a3809(0x2bf)])return;const _0x1564cb=new Map(),_0x2906cf=new Set();for(const _0x580d75 of Object[_0x5a3809(0x24c)](_0xa2d060[_0x5a3809(0x2db)]['segments'])){const _0x1d5b03=generateDeterministicJourneySegmentName(_0xa2d060[_0x5a3809(0x2db)][_0x5a3809(0x24d)],_0x580d75);_0x1564cb[_0x5a3809(0x1f4)](_0x1d5b03,_0x580d75),_0x2906cf[_0x5a3809(0x25a)](_0x580d75);}const _0x3b8ddc=[],_0x569f0e=collectSegmentIdsFromJourneyApi(_0xa2d060[_0x5a3809(0x1fd)]);for(const _0x20bc71 of _0x569f0e){const _0xd859ef=await fetchSegment(_0x3fb00a,_0xe815b4,_0x20bc71,_0xead3bf);if(!_0xd859ef?.[_0x5a3809(0x24d)])continue;const _0x18af68=_0x1564cb[_0x5a3809(0x2c4)](_0xd859ef['name']);_0x18af68?(_0x3a13ef['set'](_0x18af68,_0x20bc71),_0x2906cf[_0x5a3809(0x1e6)](_0x18af68)):_0x3b8ddc[_0x5a3809(0x299)]({'id':_0x20bc71,'seg':_0xd859ef});}if(_0x2906cf[_0x5a3809(0x21a)]>0x0&&_0x3b8ddc[_0x5a3809(0x224)]>0x0){const {localExpandedRuleToNames:_0x362514}=buildLocalExpandedRuleMappings(_0xa2d060[_0x5a3809(0x2db)]),_0x59a61f=new Map();for(const {id:_0x1818e2,seg:_0x34d026}of _0x3b8ddc){if(_0x34d026['rule']){const _0xe86d0e=apiRuleToYaml(_0x34d026['rule']);_0x59a61f[_0x5a3809(0x1f4)](_0x1818e2,_0xe86d0e);}}for(const {id:_0x39bcb6,seg:_0x155ef5}of _0x3b8ddc){if(!_0x155ef5['rule'])continue;const _0x48cc9c=_0x59a61f[_0x5a3809(0x2c4)](_0x39bcb6);if(!_0x48cc9c)continue;const _0x10103a=serializeExpandedRule(_0x48cc9c,_0x59a61f),_0x34caf1=_0x362514[_0x5a3809(0x2c4)](_0x10103a);if(_0x34caf1){const _0xedba66=_0x34caf1[_0x5a3809(0x28e)](_0x5a5e01=>_0x2906cf['has'](_0x5a5e01));_0xedba66&&(_0x3a13ef[_0x5a3809(0x1f4)](_0xedba66,_0x39bcb6),_0x2906cf[_0x5a3809(0x1e6)](_0xedba66),logger[_0x5a3809(0x2ab)](_0x5a3809(0x2c9)+_0x155ef5['name']+'\x27\x20to\x20local\x20\x27'+_0xedba66+_0x5a3809(0x2cd)));}}}}function a152_0x2baf(){const _0x3d3142=['\x20segment\x20from\x20file:\x20','embedded_segment_creating','split','uniqueServerName','match','connector_config','yamlConfig','JOURNEY_SYNTAX_ERROR','nameToType','Updated\x20activation\x20\x27','journeyBundleName','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','\x27...','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','join','resolveJourneyId','Delete\x20the\x20push\x20recovery\x20file\x20(','versionNumber','progress','parseDocument','Created\x20journey\x20\x27','./journey-yaml.js','skipSegments','map','some','existingActivation','diff','unchanged','state','\x27\x20from\x20file:\x20','behavior','delete','createdSegmentId','index','branches','\x27\x20entry\x20criteria','getSegment','entryCriteria','attributes','DecisionPoint','journey_updated','nameToId','Updating\x20activation\x20\x27','updated','results','set','parentId','Deleting\x20activation\x20\x27','entries','activation_deleting','parentFolder','\x20(referenced\x20in\x20journey\x20','getJourney','stringify','existingJourney','object','reduce','errors','journey_created','rule','and\x20the\x20server\x20segment,\x20then\x20retry.','journeyActivationStepId','values','schedule','activationActions','activation_','resolveSegment','effectiveFolderId','SEGMENT_SYNTAX_ERROR','has','all_columns','absolutePath','type','journeys','localName','message','activation_updating','idToEmailMap','.$1.push-recovery.json','columns','existingSegments','Activation','logWarning','size','conditions','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','Embedded\x20segment\x20\x27','getSegmentEntity','goal\x20criteria','toISOString','182234jLmbeY','Updated\x20segment\x20\x27','activations','length','null','deps','\x27\x20exit\x20criteria','notification','journeyBundleId','data','segment_creating','Activation\x20not\x20found:\x20','activation_creating','Updated\x20journey\x20\x27','Segment\x20not\x20found:\x20','Name\x20has\x20already\x20been\x20taken','\x20journey\x20from\x20file:\x20','sort','Condition','exitCriterias','fetchJourney','created','journey_creating','segmentFolderId','Deleted\x20segment\x20\x27','resolvedRule','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','\x27\x20wait\x20condition','segment','__pending_','\x20activation\x20\x27','listActivations','onProgress','__pending_act_','valid','\x27\x20decision\x20point\x20branch\x20\x27','Failed\x20to\x20','validatedRequest','segment_updating','logSuccess','createFolder','Deleted\x20activation\x20\x27','segmentNameToId','keys','name','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','):\x20','update','list','Creating\x20segment\x20\x27','3437060PGrPYi','journeyBundlesByFolderAndName','\x0a\x20\x20','steps','7bAqhFs','waitStepUnit','WaitStep','add','438728DRNrMm','buildUserMaps','toLowerCase','activationParams','Fetching\x20','activationStepsById','day','includes','with','hasChanges','sha1','segmentByFolderAndName','Stage\x20\x27','action','uniqueSegmentName','activation_template_id','segmentId','parse','journeyName','getActivation','6YrOaRL','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','embedded_segment_created','conditionSegmentId','stage\x20\x27','filter','decision_point','Journey\x20\x27','createdSegmentIds','createSegment','deleted','withProgress','logInfo','getLatestJourneyId','folderPathToId','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','kind','slice','startsWith','17272872JPvFEF','2954664qVNUXQ','NOT_FOUND','entry','Failed\x20to\x20resolve\x20segment\x20','journeyById','../../utils/async.js','segment_created','from','item','Creating\x20activation\x20\x27',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','find','toString','Created\x20folder\x20\x27','waitStepType','stages','createJourneySegment','createActivation','activationsBySegmentId','trim','activation_deleted','connectionIdToNameMap','push','\x27\x20not\x20found\x20in\x20journey\x20\x27','utf-8','\x27\x20milestone','Failed\x20to\x20fetch\x20referenced\x20segment\x20','entry_criteria','segment_updated','milestone','conditionTimeoutDuration','folderPath','relative','journey','yamlActivation','relationships','activationContext','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','activation_updated','folderId','debug','\x27\x20for\x20','3510595sebkPN','existingSegment','updateActivation','create','Failed\x20to\x20resolve\x20activation\x20','journeyStages','isNew','description','max','folder_created','rootFolderId','goal','verbose','Segment\x20not\x20found','logDeleted','Entry\x20criteria:\x20','SEGMENT_UPDATE_ERROR','Created\x20activation\x20\x27','segments','digest','440414CSmHUf','replace',').\x20','get','./child-segment-yaml.js','conditionTimeoutUnit','all','INTERNAL','Matched\x20server\x20segment\x20\x27','Creating\x20folder\x20\x27','segment_deleting','ACTIVATION_SYNTAX_ERROR','\x27\x20by\x20rule\x20content','draft','Duration','tdx.sdk.push-workflow','run_after_journey_refresh','journeyId','waitStep','activation_created'];a152_0x2baf=function(){return _0x3d3142;};return a152_0x2baf();}async function executeSingleJourneyPush(_0x285262,_0x15816f,_0x27fbcb,_0x4c22cd,_0x29e6b7,_0x1bc4e5){const _0xdb7285=a152_0x14882b,{journeyDefToRequest:_0x248ec0,activationDefToCreateRequest:_0x3a6792,yamlRuleToApi:_0x2730b0,validateSegmentRule:_0x12c544}=_0x1bc4e5,_0x8fa1a1=new Map(),_0x1df6c2=new Map();recoverSegmentIdsFromPushRecovery(_0x15816f,_0x8fa1a1,_0x27fbcb[_0xdb7285(0x24b)]);const _0x145822=new Map(),_0x1e5ba8=new Map(),_0x5757e9=new Map();let _0x4ebba7;const _0x3e6643=async()=>{const _0x1267c4=_0xdb7285;if(_0x4ebba7)return;_0x4ebba7=new Map();if(!_0x15816f[_0x1267c4(0x1fd)])return;const _0x240062=await _0x285262['journey']['listActivations'](_0x15816f[_0x1267c4(0x1fd)]['id']);for(const _0xa41e7b of _0x240062){const _0x43e06e=journeyActivationStepToYaml(_0xa41e7b,_0x27fbcb[_0x1267c4(0x214)],_0x27fbcb[_0x1267c4(0x298)]),_0x547680=activationSignature(_0x43e06e);!_0x4ebba7['has'](_0x547680)&&_0x4ebba7[_0x1267c4(0x1f4)](_0x547680,_0xa41e7b['id']),_0x43e06e[_0x1267c4(0x24d)]&&_0x1df6c2[_0x1267c4(0x1f4)](_0x43e06e[_0x1267c4(0x24d)],_0xa41e7b['id']);}};await matchExistingJourneySegments(_0x285262,_0x15816f,_0x4c22cd['parentId'],_0x27fbcb[_0xdb7285(0x217)],_0x27fbcb[_0xdb7285(0x24b)]);const _0x9fb26c={'resolveSegmentId':async _0x4f075f=>{const _0x294b75=_0xdb7285,_0x5b1baa=_0x27fbcb[_0x294b75(0x24b)][_0x294b75(0x2c4)](_0x4f075f);if(!_0x5b1baa)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x294b75(0x22f)+_0x4f075f+'\x20(referenced\x20in\x20journey\x20'+_0x15816f[_0x294b75(0x2db)][_0x294b75(0x24d)]+')');return _0x5b1baa;},'resolveEmbeddedSegmentId':async(_0x19ef9f,_0x514920)=>{const _0x4285a4=_0xdb7285,_0x2228c2=_0x27fbcb[_0x4285a4(0x24b)][_0x4285a4(0x2c4)](_0x19ef9f);if(_0x2228c2)return _0x2228c2;const _0x38d75e=_0x27fbcb[_0x4285a4(0x217)][_0x4285a4(0x28e)](_0x5ccfc7=>_0x5ccfc7[_0x4285a4(0x24d)]===_0x19ef9f);if(_0x38d75e)return _0x27fbcb[_0x4285a4(0x24b)][_0x4285a4(0x1f4)](_0x19ef9f,_0x38d75e['id']),_0x38d75e['id'];if(_0x15816f['isNew']){const {stageName:_0x37a47e,criteriaName:_0x3feb70}=findSegmentCriteriaLocation(_0x15816f[_0x4285a4(0x2db)],_0x19ef9f);return _0x12c544(_0x19ef9f,_0x514920[_0x4285a4(0x202)]),_0x1e5ba8['set'](_0x19ef9f,{'definition':_0x514920,'stageName':_0x37a47e,'criteriaName':_0x3feb70}),createPendingSegmentId(_0x19ef9f);}const _0x23ab03=_0x15816f['existingJourney']?.['id'];if(!_0x23ab03)throw new SDKError(ErrorCode[_0x4285a4(0x2c8)],_0x4285a4(0x2a8));const _0x1f292f=_0x145822[_0x4285a4(0x2c4)](_0x19ef9f);if(_0x1f292f)return _0x1f292f;const _0x3c8bc3=((async()=>{const _0x528748=_0x4285a4;_0x12c544(_0x19ef9f,_0x514920[_0x528748(0x202)]);const _0x174bb7=generateDeterministicJourneySegmentName(_0x15816f[_0x528748(0x2db)][_0x528748(0x24d)],_0x19ef9f),_0x342e19=_0x27fbcb[_0x528748(0x217)][_0x528748(0x28e)](_0x31df28=>_0x31df28[_0x528748(0x24d)]===_0x174bb7),_0xb1856c=createSegmentIdResolver(_0x27fbcb[_0x528748(0x24b)],_0x19ef9f),_0x144fa7=await resolveRuleSegmentIds(_0x514920[_0x528748(0x202)],_0xb1856c);let _0x360283;return _0x342e19?(await _0x285262['segment']['updateSegmentById'](_0x4c22cd[_0x528748(0x1f5)],_0x342e19['id'],{'description':_0x514920[_0x528748(0x2b4)]||_0x528748(0x2bc)+_0x19ef9f,'rule':_0x2730b0(_0x144fa7),'countPopulation':!![]}),_0x360283=_0x342e19['id'],saveSegmentToPushRecovery(_0x15816f[_0x528748(0x20e)],_0x15816f[_0x528748(0x2db)][_0x528748(0x24d)],_0x19ef9f,{'segmentId':_0x360283,'uniqueServerName':_0x174bb7,'createdAt':new Date()['toISOString']()})):_0x360283=await createOrRecoverEmbeddedSegment(_0x285262,_0x15816f,{'localName':_0x19ef9f,'uniqueSegmentName':_0x174bb7,'description':_0x514920['description']||_0x528748(0x2bc)+_0x19ef9f,'journeyId':_0x23ab03,'resolvedRule':_0x144fa7,'parentId':_0x4c22cd['parentId'],'folderId':_0x4c22cd['rootFolderId']||''},_0x2730b0),_0x27fbcb[_0x528748(0x24b)][_0x528748(0x1f4)](_0x19ef9f,_0x360283),_0x8fa1a1[_0x528748(0x1f4)](_0x19ef9f,_0x360283),_0x360283;})());_0x145822[_0x4285a4(0x1f4)](_0x19ef9f,_0x3c8bc3);try{return await _0x3c8bc3;}finally{_0x145822['delete'](_0x19ef9f);}},'resolveActivationId':async _0x35da5b=>{const _0x3d1d5c=_0xdb7285,_0x4ba930=_0x1df6c2[_0x3d1d5c(0x2c4)](_0x35da5b);if(_0x4ba930)return _0x4ba930;if(_0x15816f[_0x3d1d5c(0x1fd)]){await _0x3e6643();const _0x3be8fe=_0x1df6c2['get'](_0x35da5b);if(_0x3be8fe)return _0x3be8fe;}throw new SDKError(ErrorCode[_0x3d1d5c(0x284)],_0x3d1d5c(0x22c)+_0x35da5b+_0x3d1d5c(0x1fa)+_0x15816f[_0x3d1d5c(0x2db)]['name']+_0x3d1d5c(0x2c3)+_0x3d1d5c(0x21c));},'resolveEmbeddedActivationId':async(_0x4cc969,_0x33bfa5)=>{const _0x37c138=_0xdb7285,_0x2ea95c=_0x1df6c2[_0x37c138(0x2c4)](_0x4cc969);if(_0x2ea95c)return _0x2ea95c;if(_0x15816f[_0x37c138(0x2b3)])return _0x5757e9[_0x37c138(0x1f4)](_0x4cc969,_0x33bfa5),createPendingActivationId(_0x4cc969);if(_0x15816f[_0x37c138(0x1fd)]){await _0x3e6643();const _0x4780fc=_0x1df6c2['get'](_0x33bfa5['name']);if(_0x4780fc)return _0x1df6c2[_0x37c138(0x1f4)](_0x4cc969,_0x4780fc),_0x4780fc;const _0x1294cb=activationSignature(_0x33bfa5),_0x5a5113=_0x4ebba7?.[_0x37c138(0x2c4)](_0x1294cb);if(_0x5a5113)return _0x1df6c2[_0x37c138(0x1f4)](_0x4cc969,_0x5a5113),_0x5a5113;const _0x1e61b2=await _0x3a6792(_0x33bfa5,_0x27fbcb[_0x37c138(0x2a7)]),_0x5a303f={..._0x1e61b2,..._0x33bfa5['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x33bfa5['run_after_journey_refresh']}},_0x309a0b=await _0x285262[_0x37c138(0x2a4)][_0x37c138(0x294)](_0x15816f[_0x37c138(0x1fd)]['id'],_0x5a303f);return _0x1df6c2[_0x37c138(0x1f4)](_0x4cc969,_0x309a0b['id']),_0x309a0b['id'];}throw new SDKError(ErrorCode[_0x37c138(0x2c8)],_0x37c138(0x27e));},'resolveJourneyId':async _0x25eed6=>{const _0xba7d8e=_0xdb7285;try{return await _0x285262[_0xba7d8e(0x2a4)][_0xba7d8e(0x1d6)](_0x4c22cd[_0xba7d8e(0x1f5)],_0x25eed6);}catch(_0x328667){throw new SDKError(ErrorCode['NOT_FOUND'],_0xba7d8e(0x276)+_0x25eed6+_0xba7d8e(0x1d2)+_0x15816f[_0xba7d8e(0x2db)][_0xba7d8e(0x24d)]+'\x27)',_0x328667);}},'resolveStageId':async(_0x2ab4c9,_0x13f7f7)=>{const _0x164134=_0xdb7285,_0x2ed5e7=await _0x285262[_0x164134(0x2a4)][_0x164134(0x1fb)](_0x2ab4c9),_0x317dba=_0x2ed5e7[_0x164134(0x1ed)][_0x164134(0x2b2)]['find'](_0x450667=>_0x450667[_0x164134(0x24d)][_0x164134(0x25d)]()===_0x13f7f7[_0x164134(0x25d)]());if(!_0x317dba?.['id'])throw new SDKError(ErrorCode[_0x164134(0x284)],_0x164134(0x267)+_0x13f7f7+_0x164134(0x29a)+(_0x2ed5e7[_0x164134(0x1ed)]['journeyBundleName']||_0x2ed5e7['attributes']['name'])+'\x27');return _0x317dba['id'];}},_0x619625=await _0x248ec0(_0x15816f[_0xdb7285(0x2db)],_0x4c22cd[_0xdb7285(0x1f5)],_0x9fb26c),_0x43bf41=_0x4c22cd['folderId']||_0x4c22cd[_0xdb7285(0x2b7)];_0x43bf41&&(_0x619625['relationships']={'parentFolder':{'data':{'id':_0x43bf41,'type':'folder'}}});if(_0x15816f['isNew']){if(_0x1e5ba8[_0xdb7285(0x21a)]>0x0||_0x5757e9[_0xdb7285(0x21a)]>0x0)return await executeThreeStepJourneyCreate(_0x285262,_0x15816f,_0x619625,{'pendingEmbeddedSegments':_0x1e5ba8,'pendingEmbeddedActivations':_0x5757e9,'embeddedSegmentNameToId':_0x8fa1a1,'journeyActivationNameToId':_0x1df6c2},{..._0x4c22cd,'effectiveFolderId':_0x43bf41},_0x27fbcb,_0x29e6b7,_0x1bc4e5);else{ensureJourneyDefaults(_0x619625['attributes']);const _0x423b80=await _0x285262[_0xdb7285(0x2a4)][_0xdb7285(0x2b0)](_0x619625);return deletePushRecovery(_0x15816f['absolutePath']),{'action':_0xdb7285(0x236),'journeyId':_0x423b80['id'],'embeddedSegmentNameToId':_0x8fa1a1};}}else{if(_0x15816f[_0xdb7285(0x264)]&&_0x15816f[_0xdb7285(0x1fd)]){_0x619625['id']=_0x15816f[_0xdb7285(0x1fd)]['id'];const _0x5f10b3=_0x619625[_0xdb7285(0x1ed)];_0x15816f[_0xdb7285(0x1fd)][_0xdb7285(0x1ed)]?.[_0xdb7285(0x1d1)]&&(_0x5f10b3[_0xdb7285(0x1d1)]=_0x15816f['existingJourney'][_0xdb7285(0x1ed)][_0xdb7285(0x1d1)]);const _0x8fd1f3=_0x15816f[_0xdb7285(0x1fd)][_0xdb7285(0x1ed)]?.['journeyStages'];return _0x8fd1f3&&_0x619625[_0xdb7285(0x1ed)]['journeyStages']&&injectExistingStageIds(_0x619625[_0xdb7285(0x1ed)][_0xdb7285(0x2b2)],_0x8fd1f3),ensureJourneyDefaults(_0x5f10b3),await _0x285262['journey'][_0xdb7285(0x250)](_0x15816f['existingJourney']['id'],_0x619625),deletePushRecovery(_0x15816f[_0xdb7285(0x20e)]),{'action':_0xdb7285(0x1f2),'journeyId':_0x15816f[_0xdb7285(0x1fd)]['id'],'embeddedSegmentNameToId':_0x8fa1a1};}}return deletePushRecovery(_0x15816f['absolutePath']),{'action':_0xdb7285(0x1e2),'journeyId':_0x15816f['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x8fa1a1};}function findSegmentCriteriaLocation(_0xfa57af,_0x4a47a5){const _0x2dab18=a152_0x14882b,_0x4b93e0=_0xfa57af[_0x2dab18(0x292)]||_0xfa57af['journeys']?.[0x0]?.[_0x2dab18(0x292)]||[];let _0x1aea04=_0x2dab18(0x285),_0x5b3b35=_0x4a47a5;const _0x594fbd=_0xfa57af[_0x2dab18(0x2b8)]||_0xfa57af[_0x2dab18(0x210)]?.[0x0]?.[_0x2dab18(0x2b8)];if(_0x594fbd?.[_0x2dab18(0x23d)]===_0x4a47a5)return{'stageName':'goal','criteriaName':_0x594fbd[_0x2dab18(0x24d)]||_0x4a47a5};_0x4cdc00:for(const _0x3b9dc8 of _0x4b93e0){if(_0x3b9dc8[_0x2dab18(0x29e)]?.[_0x2dab18(0x23d)]===_0x4a47a5){_0x1aea04=_0x3b9dc8[_0x2dab18(0x24d)],_0x5b3b35=_0x3b9dc8[_0x2dab18(0x29e)][_0x2dab18(0x24d)]||_0x4a47a5;break;}if(_0x3b9dc8[_0x2dab18(0x256)])for(const _0x49eece of _0x3b9dc8[_0x2dab18(0x256)]){if(_0x49eece[_0x2dab18(0x20f)]===_0x2dab18(0x275)&&_0x49eece[_0x2dab18(0x263)]?.[_0x2dab18(0x1e9)])for(const _0x5363eb of _0x49eece[_0x2dab18(0x263)][_0x2dab18(0x1e9)]){if(_0x5363eb['segment']===_0x4a47a5){_0x1aea04=_0x3b9dc8[_0x2dab18(0x24d)],_0x5b3b35=_0x5363eb['name']||_0x4a47a5;break _0x4cdc00;}}}}return{'stageName':_0x1aea04,'criteriaName':_0x5b3b35};}async function executeThreeStepJourneyCreate(_0x51ff12,_0x577845,_0x45e170,_0x4f4ae0,_0x2edf52,_0x522dee,_0x26a011,_0x1cbf98){const _0x552846=a152_0x14882b,{activationDefToCreateRequest:_0x5ea601,yamlRuleToApi:_0xc8f11a}=_0x1cbf98,{pendingEmbeddedSegments:_0x41cb65,pendingEmbeddedActivations:_0x390509,embeddedSegmentNameToId:_0xd8de4b}=_0x4f4ae0,_0x35548a=JSON['parse'](JSON[_0x552846(0x1fc)](_0x45e170));ensureJourneyDefaults(_0x35548a['attributes']),stripPendingIds(_0x35548a);const _0x29aa4f=await _0x51ff12[_0x552846(0x2a4)][_0x552846(0x2b0)](_0x35548a),_0x3e9ffa=_0x29aa4f['id'],_0xad210f=new Map();for(const _0x4d7eba of _0x29aa4f[_0x552846(0x1ed)]['journeyStages']){_0xad210f['set'](_0x4d7eba[_0x552846(0x24d)]['toLowerCase'](),_0x4d7eba['id']);}recoverSegmentIdsFromPushRecovery(_0x577845,_0xd8de4b,_0x522dee[_0x552846(0x24b)]);for(const [_0x2f521e,{definition:_0x667f49}]of _0x41cb65){if(_0xd8de4b['has'](_0x2f521e)){_0x26a011['onProgress']?.({'type':'embedded_segment_created','journeyName':_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],'segmentName':_0x2f521e});continue;}const _0x35b359=generateDeterministicJourneySegmentName(_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],_0x2f521e);_0x26a011[_0x552846(0x241)]?.({'type':_0x552846(0x2d6),'journeyName':_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],'segmentName':_0x2f521e});const _0x1e9c11=createSegmentIdResolver(_0x522dee[_0x552846(0x24b)],_0x2f521e),_0x2cc377=await resolveRuleSegmentIds(_0x667f49[_0x552846(0x202)],_0x1e9c11),_0x2a828e=await createOrRecoverEmbeddedSegment(_0x51ff12,_0x577845,{'localName':_0x2f521e,'uniqueSegmentName':_0x35b359,'description':_0x667f49[_0x552846(0x2b4)]||'Entry\x20criteria:\x20'+_0x2f521e,'journeyId':_0x3e9ffa,'resolvedRule':_0x2cc377,'parentId':_0x2edf52[_0x552846(0x1f5)],'folderId':_0x2edf52[_0x552846(0x20a)]||''},_0xc8f11a);_0xd8de4b[_0x552846(0x1f4)](_0x2f521e,_0x2a828e),_0x522dee[_0x552846(0x24b)][_0x552846(0x1f4)](_0x2f521e,_0x2a828e),_0x26a011[_0x552846(0x241)]?.({'type':_0x552846(0x271),'journeyName':_0x577845[_0x552846(0x2db)][_0x552846(0x24d)],'segmentName':_0x2f521e});}const _0x725616=new Map();for(const [_0x40bc01,_0xf8102d]of _0x390509){_0x26a011[_0x552846(0x241)]?.({'type':'embedded_activation_creating','journeyName':_0x577845['yamlConfig'][_0x552846(0x24d)],'activationName':_0x40bc01});const _0x457e1b=await _0x5ea601(_0xf8102d,_0x522dee['activationContext']),_0x1d9e4e={..._0x457e1b,..._0xf8102d[_0x552846(0x2d1)]!==undefined&&{'runAfterJourneyRefresh':_0xf8102d[_0x552846(0x2d1)]}},_0x4bbe84=await _0x51ff12['journey'][_0x552846(0x294)](_0x3e9ffa,_0x1d9e4e);_0x725616[_0x552846(0x1f4)](_0x40bc01,_0x4bbe84['id']),_0x4f4ae0['journeyActivationNameToId']['set'](_0x40bc01,_0x4bbe84['id']),_0x26a011['onProgress']?.({'type':'embedded_activation_created','journeyName':_0x577845[_0x552846(0x2db)]['name'],'activationName':_0x40bc01});}const _0x228001=JSON[_0x552846(0x26c)](JSON['stringify'](_0x45e170));return _0x228001['id']=_0x3e9ffa,ensureJourneyDefaults(_0x228001[_0x552846(0x1ed)]),resolvePendingIdsInRequest(_0x228001,_0x45e170,_0xad210f,_0xd8de4b,_0x725616,_0x26a011),await _0x51ff12[_0x552846(0x2a4)][_0x552846(0x250)](_0x3e9ffa,_0x228001),deletePushRecovery(_0x577845[_0x552846(0x20e)]),{'action':'created','journeyId':_0x3e9ffa,'embeddedSegmentNameToId':_0xd8de4b};}export function stripWaitStepPendingIds(_0x3c3bfd){const _0x99b25e=a152_0x14882b,_0x2ab470=_0x3c3bfd[_0x99b25e(0x272)]&&isPendingSegmentId(_0x3c3bfd[_0x99b25e(0x272)]),_0x27b111=_0x3c3bfd[_0x99b25e(0x21b)]?.[_0x99b25e(0x1df)](_0xee0ce5=>_0xee0ce5[_0x99b25e(0x26b)]&&isPendingSegmentId(_0xee0ce5[_0x99b25e(0x26b)]));(_0x2ab470||_0x27b111)&&(_0x3c3bfd[_0x99b25e(0x291)]=_0x99b25e(0x2cf),_0x3c3bfd[_0x99b25e(0x2d3)]=0x1,_0x3c3bfd[_0x99b25e(0x258)]=_0x99b25e(0x261),delete _0x3c3bfd[_0x99b25e(0x272)],delete _0x3c3bfd['conditionTimeoutDuration'],delete _0x3c3bfd[_0x99b25e(0x2c6)],delete _0x3c3bfd['conditions']);}export function resolveWaitStepPendingIds(_0x2b442f,_0x99ef6b,_0x234fdf,_0x2f2756){const _0x1f5a13=a152_0x14882b;if(_0x99ef6b[_0x1f5a13(0x272)]&&isPendingSegmentId(_0x99ef6b['conditionSegmentId'])){const _0x1d64f8=_0x234fdf(_0x99ef6b['conditionSegmentId'],_0x1f5a13(0x273)+_0x2f2756+_0x1f5a13(0x23c));_0x1d64f8&&(_0x2b442f[_0x1f5a13(0x291)]=_0x1f5a13(0x233),_0x2b442f[_0x1f5a13(0x272)]=_0x1d64f8,delete _0x2b442f[_0x1f5a13(0x2d3)],delete _0x2b442f[_0x1f5a13(0x258)],_0x99ef6b[_0x1f5a13(0x2a1)]!==undefined&&(_0x2b442f[_0x1f5a13(0x2a1)]=_0x99ef6b[_0x1f5a13(0x2a1)]),_0x99ef6b[_0x1f5a13(0x2c6)]&&(_0x2b442f[_0x1f5a13(0x2c6)]=_0x99ef6b[_0x1f5a13(0x2c6)]));}if(_0x99ef6b[_0x1f5a13(0x21b)]){const _0xcab091=_0x99ef6b[_0x1f5a13(0x21b)][_0x1f5a13(0x1df)](_0x42c3a2=>_0x42c3a2[_0x1f5a13(0x26b)]&&isPendingSegmentId(_0x42c3a2[_0x1f5a13(0x26b)]));if(_0xcab091){const _0x2f244a=_0x99ef6b[_0x1f5a13(0x21b)][_0x1f5a13(0x1de)](_0x51fa2d=>{const _0x4b573c=_0x1f5a13;if(_0x51fa2d[_0x4b573c(0x26b)]&&isPendingSegmentId(_0x51fa2d[_0x4b573c(0x26b)])){const _0x328532=_0x234fdf(_0x51fa2d[_0x4b573c(0x26b)],_0x4b573c(0x273)+_0x2f2756+'\x27\x20wait\x20condition');return{..._0x51fa2d,'segmentId':_0x328532||_0x51fa2d['segmentId']};}return{..._0x51fa2d};});_0x2b442f['waitStepType']='Condition',_0x2b442f['conditions']=_0x2f244a,delete _0x2b442f[_0x1f5a13(0x2d3)],delete _0x2b442f[_0x1f5a13(0x258)],delete _0x2b442f[_0x1f5a13(0x272)],delete _0x2b442f[_0x1f5a13(0x2a1)],delete _0x2b442f[_0x1f5a13(0x2c6)];}}}function stripPendingIds(_0x326fcf){const _0x2f7550=a152_0x14882b;_0x326fcf['attributes'][_0x2f7550(0x2b8)]?.[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x326fcf[_0x2f7550(0x1ed)][_0x2f7550(0x2b8)][_0x2f7550(0x26b)])&&delete _0x326fcf[_0x2f7550(0x1ed)][_0x2f7550(0x2b8)];for(const _0x4b3ffb of _0x326fcf[_0x2f7550(0x1ed)][_0x2f7550(0x2b2)]||[]){_0x4b3ffb['entryCriteria']?.[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x4b3ffb[_0x2f7550(0x1ec)][_0x2f7550(0x26b)])&&delete _0x4b3ffb[_0x2f7550(0x1ec)];_0x4b3ffb[_0x2f7550(0x2a0)]?.[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x4b3ffb[_0x2f7550(0x2a0)][_0x2f7550(0x26b)])&&delete _0x4b3ffb[_0x2f7550(0x2a0)];_0x4b3ffb['exitCriterias']&&(_0x4b3ffb[_0x2f7550(0x234)]=_0x4b3ffb[_0x2f7550(0x234)][_0x2f7550(0x274)](_0xe4652d=>!_0xe4652d[_0x2f7550(0x26b)]||!isPendingSegmentId(_0xe4652d[_0x2f7550(0x26b)])));if(_0x4b3ffb['steps'])for(const _0x58fa13 of Object['keys'](_0x4b3ffb[_0x2f7550(0x256)])){const _0xdf4f5c=_0x4b3ffb[_0x2f7550(0x256)][_0x58fa13];_0xdf4f5c[_0x2f7550(0x20f)]==='Activation'&&_0xdf4f5c[_0x2f7550(0x204)]&&isPendingActivationId(_0xdf4f5c['journeyActivationStepId'])&&(_0xdf4f5c[_0x2f7550(0x204)]='');if(_0xdf4f5c[_0x2f7550(0x20f)]===_0x2f7550(0x1ee)&&_0xdf4f5c[_0x2f7550(0x1e9)])for(const _0x32b448 of _0xdf4f5c[_0x2f7550(0x1e9)]){_0x32b448[_0x2f7550(0x26b)]&&isPendingSegmentId(_0x32b448['segmentId'])&&(_0x32b448['segmentId']='');}_0xdf4f5c[_0x2f7550(0x20f)]===_0x2f7550(0x259)&&stripWaitStepPendingIds(_0xdf4f5c);}}}function resolvePendingIdsInRequest(_0x2278bb,_0x2a6a58,_0x171079,_0x32a826,_0x21b78b,_0x955328){const _0x1ee211=a152_0x14882b,_0xefcff8=(_0x650035,_0x2928b6)=>{const _0x3fa54b=a152_0x4c54;if(!isPendingSegmentId(_0x650035))return _0x650035;const _0xf601fd=extractPendingSegmentName(_0x650035),_0x1dd1cd=_0x32a826[_0x3fa54b(0x2c4)](_0xf601fd);return!_0x1dd1cd&&_0x955328[_0x3fa54b(0x219)]?.(_0x3fa54b(0x1d4)+_0xf601fd+_0x3fa54b(0x2ac)+_0x2928b6),_0x1dd1cd;};if(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)]?.['segmentId']&&isPendingSegmentId(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)][_0x1ee211(0x26b)])){const _0x5cec91=_0xefcff8(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)][_0x1ee211(0x26b)],_0x1ee211(0x21f));_0x5cec91&&(_0x2278bb[_0x1ee211(0x1ed)][_0x1ee211(0x2b8)][_0x1ee211(0x26b)]=_0x5cec91);}for(const _0x4ddcc3 of _0x2278bb['attributes'][_0x1ee211(0x2b2)]||[]){const _0x402f64=_0x171079['get'](_0x4ddcc3['name']['toLowerCase']());_0x402f64&&(_0x4ddcc3['id']=_0x402f64);if(_0x4ddcc3['entryCriteria']?.[_0x1ee211(0x26b)]&&isPendingSegmentId(_0x4ddcc3[_0x1ee211(0x1ec)][_0x1ee211(0x26b)])){const _0x35fdc0=_0xefcff8(_0x4ddcc3[_0x1ee211(0x1ec)][_0x1ee211(0x26b)],_0x1ee211(0x273)+_0x4ddcc3[_0x1ee211(0x24d)]+_0x1ee211(0x1ea));_0x35fdc0&&(_0x4ddcc3[_0x1ee211(0x1ec)][_0x1ee211(0x26b)]=_0x35fdc0);}if(_0x4ddcc3[_0x1ee211(0x234)])for(const _0x4c395e of _0x4ddcc3[_0x1ee211(0x234)]){if(_0x4c395e[_0x1ee211(0x26b)]&&isPendingSegmentId(_0x4c395e[_0x1ee211(0x26b)])){const _0x296ed2=_0xefcff8(_0x4c395e[_0x1ee211(0x26b)],_0x1ee211(0x273)+_0x4ddcc3[_0x1ee211(0x24d)]+_0x1ee211(0x227));_0x296ed2&&(_0x4c395e[_0x1ee211(0x26b)]=_0x296ed2);}}if(_0x4ddcc3['milestone']?.['segmentId']&&isPendingSegmentId(_0x4ddcc3[_0x1ee211(0x2a0)][_0x1ee211(0x26b)])){const _0x4caed4=_0xefcff8(_0x4ddcc3[_0x1ee211(0x2a0)][_0x1ee211(0x26b)],'stage\x20\x27'+_0x4ddcc3['name']+_0x1ee211(0x29c));_0x4caed4&&(_0x4ddcc3[_0x1ee211(0x2a0)]['segmentId']=_0x4caed4);}if(_0x4ddcc3[_0x1ee211(0x256)]){const _0x3fe2c9=_0x43c75f=>_0x2a6a58[_0x1ee211(0x1ed)][_0x1ee211(0x2b2)]?.['find'](_0x411227=>_0x411227[_0x1ee211(0x24d)]['toLowerCase']()===_0x4ddcc3[_0x1ee211(0x24d)][_0x1ee211(0x25d)]())?.[_0x1ee211(0x256)]?.[_0x43c75f];for(const _0x56b5eb of Object[_0x1ee211(0x24c)](_0x4ddcc3[_0x1ee211(0x256)])){const _0x1ff9e9=_0x4ddcc3[_0x1ee211(0x256)][_0x56b5eb],_0xd65c5=_0x3fe2c9(_0x56b5eb);if(_0x1ff9e9[_0x1ee211(0x20f)]===_0x1ee211(0x218)&&_0x1ff9e9['journeyActivationStepId']&&(isPendingActivationId(_0x1ff9e9[_0x1ee211(0x204)])||_0x1ff9e9[_0x1ee211(0x204)]==='')){if(_0xd65c5?.['journeyActivationStepId']&&isPendingActivationId(_0xd65c5['journeyActivationStepId'])){const _0x5a1196=extractPendingActivationName(_0xd65c5[_0x1ee211(0x204)]),_0xb09877=_0x21b78b[_0x1ee211(0x2c4)](_0x5a1196);_0xb09877&&(_0x1ff9e9[_0x1ee211(0x204)]=_0xb09877);}}if(_0x1ff9e9[_0x1ee211(0x20f)]===_0x1ee211(0x1ee)&&_0x1ff9e9['branches']&&_0xd65c5?.[_0x1ee211(0x1e9)])for(let _0x3303ab=0x0;_0x3303ab<_0x1ff9e9[_0x1ee211(0x1e9)][_0x1ee211(0x224)];_0x3303ab++){const _0x215eca=_0x1ff9e9[_0x1ee211(0x1e9)][_0x3303ab],_0x18d524=_0xd65c5[_0x1ee211(0x1e9)][_0x3303ab];if(_0x18d524?.['segmentId']&&isPendingSegmentId(_0x18d524[_0x1ee211(0x26b)])){const _0x3c0bed=_0xefcff8(_0x18d524[_0x1ee211(0x26b)],_0x1ee211(0x273)+_0x4ddcc3['name']+_0x1ee211(0x244)+(_0x215eca[_0x1ee211(0x24d)]||_0x3303ab)+'\x27');_0x3c0bed&&(_0x215eca[_0x1ee211(0x26b)]=_0x3c0bed);}}_0x1ff9e9[_0x1ee211(0x20f)]===_0x1ee211(0x259)&&_0xd65c5?.[_0x1ee211(0x20f)]===_0x1ee211(0x259)&&resolveWaitStepPendingIds(_0x1ff9e9,_0xd65c5,_0xefcff8,_0x4ddcc3['name']);}}}}
|
|
1
|
+
const a152_0x25b4a3=a152_0x3f4b;(function(_0x3d1f4e,_0x4187fb){const _0x5cf14=a152_0x3f4b,_0x311839=_0x3d1f4e();while(!![]){try{const _0x298b23=parseInt(_0x5cf14(0x135))/0x1+-parseInt(_0x5cf14(0x165))/0x2+parseInt(_0x5cf14(0x141))/0x3+parseInt(_0x5cf14(0x172))/0x4+parseInt(_0x5cf14(0x1a8))/0x5+-parseInt(_0x5cf14(0x1e9))/0x6*(parseInt(_0x5cf14(0x18a))/0x7)+-parseInt(_0x5cf14(0x1f4))/0x8*(parseInt(_0x5cf14(0x155))/0x9);if(_0x298b23===_0x4187fb)break;else _0x311839['push'](_0x311839['shift']());}catch(_0x4bcd86){_0x311839['push'](_0x311839['shift']());}}}(a152_0x4463,0xe0363));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of']('tdx.sdk.push-workflow');export const PENDING_SEGMENT_PREFIX=a152_0x25b4a3(0x19c);export const PENDING_ACTIVATION_PREFIX=a152_0x25b4a3(0x14c);export function createPendingSegmentId(_0x25912a){return''+PENDING_SEGMENT_PREFIX+_0x25912a+'__';}export function isPendingSegmentId(_0x3bdd2b){return _0x3bdd2b['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x3bdd2b['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x57fb8a){const _0xc13ea1=a152_0x25b4a3;return _0x57fb8a[_0xc13ea1(0x113)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x178bfb){return''+PENDING_ACTIVATION_PREFIX+_0x178bfb+'__';}export function isPendingActivationId(_0x78482d){const _0x19d03e=a152_0x25b4a3;return _0x78482d[_0x19d03e(0x1fc)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x117d2a){const _0x1d34b5=a152_0x25b4a3;return _0x117d2a[_0x1d34b5(0x113)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0xafaf94,_0x31c000){const _0x2af374=a152_0x25b4a3,_0x790ea6=_0xafaf94+'::'+(_0x31c000[_0x2af374(0x149)]()||'segment'),_0x8796d2=createHash('sha1')[_0x2af374(0x181)](_0x790ea6)[_0x2af374(0x1ea)](_0x2af374(0x1ed))[_0x2af374(0x197)](0x0,0xc);return'journey_entry_criteria_'+_0x8796d2;}export function ensureJourneyDefaults(_0x2c4af5){const _0x4aedde=a152_0x25b4a3;!_0x2c4af5['description']&&(_0x2c4af5[_0x4aedde(0x1b9)]=''),!_0x2c4af5['state']&&(_0x2c4af5['state']='draft');}export function injectExistingStageIds(_0x54e500,_0x445e21){const _0x454fe5=a152_0x25b4a3,_0x1d3dbe=new Map(_0x445e21[_0x454fe5(0x1e1)](_0x177da0=>[_0x177da0['name'],_0x177da0['id']]));for(const _0x5ccf92 of _0x54e500){if(!_0x5ccf92['id']){const _0x4cfacb=_0x1d3dbe[_0x454fe5(0x151)](_0x5ccf92['name']);_0x4cfacb&&(_0x5ccf92['id']=_0x4cfacb);}}}export function resolveTDFolderPath(_0x5bffc3,_0x4e1569,_0x38bea7){const _0x4b7654=a152_0x25b4a3;if(!_0x4e1569)return _0x5bffc3;if(_0x5bffc3===_0x38bea7||_0x5bffc3[_0x4b7654(0x1fc)](_0x38bea7+'/'))return _0x5bffc3;return _0x5bffc3?_0x38bea7+'/'+_0x5bffc3:_0x38bea7;}export function addFoldersToCreate(_0x3e0f92,_0x3f84be,_0x5b233c){const _0x543b1a=a152_0x25b4a3;if(!_0x3e0f92)return;if(_0x3f84be[_0x543b1a(0x12f)](_0x3e0f92))return;const _0x563903=_0x3e0f92[_0x543b1a(0x14d)]('/');let _0xe8b027='';for(const _0xaf4d5d of _0x563903){_0xe8b027=_0xe8b027?_0xe8b027+'/'+_0xaf4d5d:_0xaf4d5d,!_0x3f84be[_0x543b1a(0x12f)](_0xe8b027)&&_0x5b233c[_0x543b1a(0x1c5)](_0xe8b027);}}export function sortFoldersByDepth(_0x18e605){const _0x3f5ed8=a152_0x25b4a3;return[..._0x18e605][_0x3f5ed8(0x100)]((_0x31354f,_0x1c2ae0)=>{const _0x7dea2f=_0x3f5ed8,_0x25750f=(_0x31354f['match'](/\//g)||[])[_0x7dea2f(0x1d0)],_0x482eef=(_0x1c2ae0[_0x7dea2f(0x187)](/\//g)||[])[_0x7dea2f(0x1d0)];return _0x25750f-_0x482eef;});}import*as a152_0x19c01e from'yaml';import{readFileSync}from'fs';import a152_0x5c5da7 from'path';import{isJourneyDef,parseYamlString as a152_0x3b46a5,toYamlString as a152_0x9fc482,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 a152_0x4463(){const _0x3d193d=['343DVqaaj','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','stringify','Creating\x20activation\x20\x27','item','getActivation','\x0a\x20\x20','Activation','folder','Creating\x20folder\x20\x27','resolveJourneyId','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','toLowerCase','slice','ACTIVATION_SYNTAX_ERROR','yamlConfig','kind','journeyBundleName','__pending_','conditionTimeoutDuration',').\x20','DecisionPoint','folderPathToId','user','utf-8','existingSegment','Fetching\x20','with','parse','action','6165835bEqewm','Embedded\x20segment\x20\x27','onProgress','some','\x27\x20from\x20file:\x20','existingActivation','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','name','rootFolderId','buildUserMaps','max','.$1.push-recovery.json','branches','idToEmailMap','resolveSegment','columns','description','NOT_FOUND','):\x20','parentFolder','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','parseDocument','activations','withProgress','Created\x20segment\x20\x27','activation_deleted','activation_template_id','segment','add','updateActivation','\x27\x20by\x20rule\x20content','size','Updated\x20segment\x20\x27','object','unchanged','debug','SEGMENT_UPDATE_ERROR','keys','milestone','length','notification','deps','errors','updated','relative','journey_created','journey_updated','steps','null','toString','activation_','parentSegmentFolder','activationContext','decision_point','createdSegmentId','Failed\x20to\x20fetch\x20referenced\x20segment\x20','map','logSuccess','getJourney','segments','journeyById','all','\x20activation\x20\x27','Updating\x20segment\x20\x27','690AkHEIM','digest','waitStepUnit','\x20(referenced\x20in\x20journey\x20','hex','Segment\x20not\x20found:\x20','updateSegmentById','activation_updated','folder_created','find','diff','11596496KPqAWk','entry','Failed\x20to\x20','resolvedRule','from','hasChanges','includes','\x27\x20for\x20','startsWith','segment_deleted','conditionTimeoutUnit','createdSegmentIds','existingSegments','journeyActivationStepId','\x27\x20entry\x20criteria','sort','stage\x20\x27','reduce','filter','nameToId','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','localName','deleteActivation','createSegment','deleteSegment','values','isArray','entries','logWarning','entryCriteria','uniqueSegmentName','waitStepType','../../utils/async.js','conditions','replace','type','exitCriterias','journeyName','SEGMENT_NOT_FOUND','yamlActivation','\x27\x20exit\x20criteria','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','attributes','index','validatedRequest','Failed\x20to\x20resolve\x20segment\x20','activation_updating','Duration','SEGMENT_SYNTAX_ERROR','goal','connection','activation_creating','activation_deleting','\x27\x20to\x20local\x20\x27','Condition','flatMap','embedded_activation_created','\x27...','segmentFolderId','versionNumber','delete','journeyActivationNameToId','has','list','getLatestJourneyId','Created\x20activation\x20\x27','journeyBundleId','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','774447IvxiLi','WaitStep','journeyStages','join','deleted','Entry\x20criteria:\x20','./child-segment-yaml.js','segment_creating','createFolder','JOURNEY_UPDATE_ERROR','idToName','Updating\x20activation\x20\x27','203406HPCmlK','Updated\x20activation\x20\x27','conditionSegmentId','\x20segment\x20from\x20file:\x20','parentId','create','journeys','skipSegments','trim','Deleted\x20segment\x20\x27','segmentNameToId','__pending_act_','split','./journey-yaml.js','message','uniqueServerName','get','stages','segmentId','results','9IHEVsw','activationStepsById','getSegmentEntity\x20also\x20failed\x20for\x20','behavior','INTERNAL','logDeleted','journey_updating','absolutePath','Updated\x20journey\x20\x27','Matched\x20server\x20segment\x20\x27','Created\x20folder\x20\x27','folderPath','journeyId','rule','dirname','folderId','1199358vhOFAg','segment_deleting','created','set','ACTIVATION_UPDATE_ERROR','embedded_segment_created','day','Deleting\x20activation\x20\x27','JOURNEY_SYNTAX_ERROR','goal\x20criteria','existingJourney','embeddedSegmentNameToId','listActivations','3591324WQrJhq','toISOString','journey','waitStep','run_after_journey_refresh','Activation\x20not\x20found:\x20','data','all_columns','\x27\x20not\x20found\x20in\x20journey\x20\x27','relationships','activation_created','push','Name\x20has\x20already\x20been\x20taken','\x20journey\x20from\x20file:\x20','valid','update','\x27\x20decision\x20point\x20branch\x20\x27','progress','getSegment\x20failed\x20for\x20','isNew','connectionIdToNameMap','match','schedule','createActivation'];a152_0x4463=function(){return _0x3d193d;};return a152_0x4463();}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(_0x4aff42){const _0x187143=a152_0x25b4a3;if(Array[_0x187143(0x10b)](_0x4aff42))return'['+_0x4aff42[_0x187143(0x1e1)](_0x54581b=>stableStringify(_0x54581b))[_0x187143(0x138)](',')+']';if(_0x4aff42&&typeof _0x4aff42===_0x187143(0x1ca)){const _0x28b957=_0x4aff42,_0x3b1899=Object[_0x187143(0x1ce)](_0x28b957)[_0x187143(0x100)](),_0x34b4c8=_0x3b1899[_0x187143(0x1e1)](_0x206b6a=>'\x22'+_0x206b6a+'\x22:'+stableStringify(_0x28b957[_0x206b6a]));return'{'+_0x34b4c8[_0x187143(0x138)](',')+'}';}const _0x2d2733=JSON[_0x187143(0x18c)](_0x4aff42);return _0x2d2733===undefined?_0x187143(0x1d9):_0x2d2733;}function activationSignature(_0x575304){const _0x474242=a152_0x25b4a3,_0x33c4b7={'connection':_0x575304[_0x474242(0x123)],..._0x575304[_0x474242(0x179)]!==undefined&&{'all_columns':_0x575304['all_columns']},..._0x575304[_0x474242(0x1b8)]!==undefined&&{'columns':_0x575304[_0x474242(0x1b8)]},..._0x575304[_0x474242(0x158)]!==undefined&&{'behavior':_0x575304[_0x474242(0x158)]},..._0x575304[_0x474242(0x188)]!==undefined&&{'schedule':_0x575304['schedule']},..._0x575304[_0x474242(0x1d1)]!==undefined&&{'notification':_0x575304[_0x474242(0x1d1)]},..._0x575304['connector_config']!==undefined&&{'connector_config':_0x575304['connector_config']},..._0x575304['activation_template_id']!==undefined&&{'activation_template_id':_0x575304[_0x474242(0x1c3)]}};return stableStringify(_0x33c4b7);}async function fetchSegment(_0x2ecc1f,_0x77c94e,_0x2abe3a,_0x2e41c6){const _0x375b29=a152_0x25b4a3,_0x54eb5e=_0x2e41c6?.[_0x375b29(0x1f2)](_0x23d90b=>_0x23d90b['id']===_0x2abe3a);if(_0x54eb5e)return _0x54eb5e;try{return await _0x2ecc1f[_0x375b29(0x1c4)]['getSegment'](_0x77c94e,_0x2abe3a);}catch(_0x5469e5){logger['debug'](_0x375b29(0x184)+_0x2abe3a+_0x375b29(0x1af)+_0x5469e5);try{return await _0x2ecc1f['segment']['getSegmentEntity'](_0x2abe3a);}catch(_0x24ff89){return logger[_0x375b29(0x1cc)](_0x375b29(0x157)+_0x2abe3a+':\x20'+_0x24ff89),null;}}}function recoverSegmentIdsFromPushRecovery(_0x22107b,_0x415b82,_0x8f41f8){const _0x1a11e7=a152_0x25b4a3,_0x434c71=readPushRecovery(_0x22107b['absolutePath']);if(_0x434c71?.['journeyName']===_0x22107b['yamlConfig'][_0x1a11e7(0x1b0)])for(const [_0x451bed,_0x4addb1]of Object['entries'](_0x434c71[_0x1a11e7(0x1e4)])){const _0x4be6c8=generateDeterministicJourneySegmentName(_0x22107b[_0x1a11e7(0x199)][_0x1a11e7(0x1b0)],_0x451bed);_0x4addb1[_0x1a11e7(0x150)]===_0x4be6c8&&(_0x415b82[_0x1a11e7(0x168)](_0x451bed,_0x4addb1['segmentId']),_0x8f41f8[_0x1a11e7(0x168)](_0x451bed,_0x4addb1[_0x1a11e7(0x153)]));}}async function createOrRecoverEmbeddedSegment(_0x5aee3d,_0x363b62,_0x4c9deb,_0x4a02ab){const _0x31ff63=a152_0x25b4a3;let _0x5d2384;try{_0x5d2384=await _0x5aee3d[_0x31ff63(0x1c4)]['createJourneySegment']({'name':_0x4c9deb['uniqueSegmentName'],'description':_0x4c9deb['description'],'journeyId':_0x4c9deb[_0x31ff63(0x161)],'rule':_0x4a02ab(_0x4c9deb[_0x31ff63(0x1f7)],!![]),'countPopulation':!![],'parentFolderId':_0x4c9deb[_0x31ff63(0x164)],'audienceId':_0x4c9deb[_0x31ff63(0x145)]});}catch(_0x192617){const _0x4bad63=_0x192617 instanceof Error&&_0x192617[_0x31ff63(0x14f)][_0x31ff63(0x1fa)](_0x31ff63(0x17e));if(_0x4bad63){const _0x326415=readPushRecovery(_0x363b62[_0x31ff63(0x15c)]),_0xc623cf=_0x326415?.[_0x31ff63(0x116)]===_0x363b62[_0x31ff63(0x199)]['name']?_0x326415['segments'][_0x4c9deb[_0x31ff63(0x106)]]:undefined;if(_0xc623cf?.[_0x31ff63(0x150)]===_0x4c9deb[_0x31ff63(0x10f)])await _0x5aee3d[_0x31ff63(0x1c4)][_0x31ff63(0x1ef)](_0x4c9deb[_0x31ff63(0x145)],_0xc623cf[_0x31ff63(0x153)],{'description':_0x4c9deb[_0x31ff63(0x1b9)],'rule':_0x4a02ab(_0x4c9deb[_0x31ff63(0x1f7)],!![]),'countPopulation':!![]}),_0x5d2384=_0xc623cf[_0x31ff63(0x153)];else throw new SDKError(ErrorCode[_0x31ff63(0x1cd)],_0x31ff63(0x1a9)+_0x4c9deb[_0x31ff63(0x106)]+_0x31ff63(0x105)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x363b62[_0x31ff63(0x15c)]['replace'](/([^/]+)$/,_0x31ff63(0x1b4))+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x192617);}else throw _0x192617;}return saveSegmentToPushRecovery(_0x363b62['absolutePath'],_0x363b62[_0x31ff63(0x199)]['name'],_0x4c9deb[_0x31ff63(0x106)],{'segmentId':_0x5d2384,'uniqueServerName':_0x4c9deb[_0x31ff63(0x10f)],'createdAt':new Date()[_0x31ff63(0x173)]()}),_0x5d2384;}export async function prepareSegmentFiles(_0x5ea516,_0x43de64,_0x1a70d4,_0x358c5f,_0x11ac84){const _0x4307e4=a152_0x25b4a3,{activationDefToCreateRequest:_0x5535a9}=await import('./child-segment-yaml.js'),_0x108e4f=[],_0x2a2e62=new Set();for(const {yamlConfig:_0x4a77a8,folderPath:_0x458902,sourcePath:_0x52d4f9}of _0x5ea516){const _0x1defa8=resolveTDFolderPath(_0x458902,_0x358c5f,_0x11ac84),_0x10d3bf=_0x1defa8+':'+_0x4a77a8[_0x4307e4(0x1b0)],_0x4f8a65=_0x43de64['segmentByFolderAndName']['get'](_0x10d3bf),_0x5c73eb=_0x4f8a65?_0x43de64['activationsBySegmentId'][_0x4307e4(0x151)](_0x4f8a65['id'])||[]:[];addFoldersToCreate(_0x1defa8,_0x43de64[_0x4307e4(0x1a0)],_0x2a2e62);const _0x261bb1=calculateActivationActions(_0x4a77a8[_0x4307e4(0x1bf)]||[],_0x5c73eb,_0x43de64[_0x4307e4(0x1b6)],_0x43de64[_0x4307e4(0x186)]);for(const _0x117a25 of _0x261bb1){(_0x117a25['type']===_0x4307e4(0x146)||_0x117a25[_0x4307e4(0x114)]===_0x4307e4(0x181))&&_0x117a25[_0x4307e4(0x118)]&&(_0x117a25[_0x4307e4(0x11d)]=await _0x5535a9(_0x117a25['yamlActivation'],_0x1a70d4));}const _0xe31b25=calculateSegmentDiff(_0x4a77a8,_0x4f8a65,_0x5c73eb,_0x43de64[_0x4307e4(0x1b6)],_0x43de64['connectionIdToNameMap']);_0x108e4f[_0x4307e4(0x17d)]({'relativePath':_0x4a77a8['name'],'absolutePath':_0x52d4f9,'yamlConfig':_0x4a77a8,'folderPath':_0x1defa8,'existingSegment':_0x4f8a65,'existingActivations':_0x5c73eb,'isNew':_0xe31b25[_0x4307e4(0x185)],'hasChanges':_0xe31b25[_0x4307e4(0x1f9)],'diff':_0xe31b25[_0x4307e4(0x1f3)],'activationActions':_0x261bb1});}return{'segmentFiles':_0x108e4f,'foldersToCreate':_0x2a2e62};}export async function prepareJourneyFiles(_0x442215,_0x1cbcec,_0x419c2e,_0x5481f2){const _0x56176a=a152_0x25b4a3,_0x22a535=[],_0xdc16dc=new Set();for(const {yamlConfig:_0x2f1da2,folderPath:_0x3e9c08,sourcePath:_0x11ce71}of _0x442215){const _0x14dc5f=resolveTDFolderPath(_0x3e9c08,_0x419c2e,_0x5481f2),_0x1b7740=_0x14dc5f+':'+_0x2f1da2['name'],_0x3fa0cc=_0x1cbcec['journeyBundlesByFolderAndName'][_0x56176a(0x151)](_0x1b7740);let _0x2c318e,_0x117e58;if(_0x3fa0cc&&_0x3fa0cc[_0x56176a(0x1d0)]>0x0){const _0x33eca2=buildLocalExpandedRuleMappings(_0x2f1da2),{createYamlContext:_0x234c91,prefetchJourneySegments:_0x126ae3}=createPushYamlContextForBundle(_0x1cbcec[_0x56176a(0x1d2)],_0x1cbcec[_0x56176a(0x145)],_0x1cbcec[_0x56176a(0x200)],_0x33eca2,_0x1cbcec[_0x56176a(0x1b6)],_0x1cbcec['connectionIdToNameMap'],_0x1cbcec[_0x56176a(0x156)],_0x1cbcec['journeyById']);await _0x126ae3(_0x3fa0cc[_0x56176a(0x1e1)](_0x2fc6a7=>_0x2fc6a7['id']));const _0x1994e6=await _0x1cbcec[_0x56176a(0x1d2)][_0x56176a(0x174)][_0x56176a(0x131)](_0x3fa0cc[0x0][_0x56176a(0x133)]),_0x5f2093=hasMultipleVersions(_0x2f1da2),_0x166533=async _0x2cb234=>{const _0x17ffff=_0x56176a,_0x52f9de=_0x1cbcec[_0x17ffff(0x1e5)]?.[_0x17ffff(0x151)](_0x2cb234);if(_0x52f9de)return _0x52f9de;return _0x1cbcec['fetchJourney']({'journeyId':_0x2cb234,'journeyName':_0x2f1da2[_0x17ffff(0x1b0)],'isMultiVersion':_0x3fa0cc[_0x17ffff(0x1d0)]>0x1});};if(_0x5f2093&&_0x3fa0cc[_0x56176a(0x1d0)]>0x1){const _0x4fdb56=[];for(const _0x3568c4 of _0x3fa0cc){const _0x3ef090=_0x3568c4[_0x56176a(0x12c)]||0x1;_0x1cbcec[_0x56176a(0x183)]?.[_0x56176a(0x181)]('Fetching\x20'+_0x2f1da2[_0x56176a(0x1b0)]+'\x20v'+_0x3ef090);const _0x4d2403=await _0x166533(_0x3568c4['id']),_0x90150f=_0x234c91(_0x3568c4['id']),_0x4d6373=await journeyResponseToDef(_0x4d2403,_0x90150f);_0x4fdb56['push']({'item':_0x3568c4,'yaml':_0x4d6373});}const _0x4c0812=buildLocalRuleToNameMappingFromJourney(_0x2f1da2);_0x117e58=buildMergedJourneyDef(_0x4fdb56,_0x4c0812,_0x1994e6);const _0x10683f=Math['max'](..._0x4fdb56['map'](_0x4943c3=>_0x4943c3[_0x56176a(0x18e)]['versionNumber']||0x0)),_0xe56e57=_0x3fa0cc[_0x56176a(0x1f2)](_0x4a768c=>(_0x4a768c[_0x56176a(0x12c)]||0x0)===_0x10683f);_0xe56e57&&(_0x1cbcec[_0x56176a(0x183)]?.['update'](_0x56176a(0x1a4)+_0x2f1da2[_0x56176a(0x1b0)]+'\x20v'+_0x10683f),_0x2c318e=await _0x166533(_0xe56e57['id']));}else{const _0x11318e=_0x3fa0cc[_0x3fa0cc[_0x56176a(0x1d0)]-0x1];_0x1cbcec[_0x56176a(0x183)]?.['update'](_0x56176a(0x1a4)+_0x2f1da2[_0x56176a(0x1b0)]),_0x2c318e=await _0x166533(_0x11318e['id']);const _0x295f73=_0x234c91(_0x11318e['id']),_0x42a2b1=await journeyResponseToDef(_0x2c318e,_0x295f73),_0x235dcd=buildLocalRuleToNameMappingFromJourney(_0x2f1da2);_0x117e58=buildMergedJourneyDef([{'item':_0x11318e,'yaml':_0x42a2b1}],_0x235dcd,_0x1994e6);}}addFoldersToCreate(_0x14dc5f,_0x1cbcec[_0x56176a(0x1a0)],_0xdc16dc);const _0x2a59e6=calculateJourneyDiff(_0x2f1da2,_0x117e58);_0x22a535[_0x56176a(0x17d)]({'relativePath':_0x2f1da2[_0x56176a(0x1b0)],'absolutePath':_0x11ce71,'yamlConfig':_0x2f1da2,'folderPath':_0x14dc5f,'existingJourney':_0x2c318e,'isNew':_0x2a59e6[_0x56176a(0x185)],'hasChanges':_0x2a59e6[_0x56176a(0x1f9)],'diff':_0x2a59e6['diff']});}return{'journeyFiles':_0x22a535,'foldersToCreate':_0xdc16dc};}export function calculateActivationActions(_0x1a903d,_0xa2e208,_0x230bb3,_0x101b1e){const _0x3eb76d=a152_0x25b4a3,_0x3a7df3=[],_0x20203c=new Map();for(const _0x2bb2f8 of _0xa2e208){_0x20203c[_0x3eb76d(0x168)](_0x2bb2f8['name'],_0x2bb2f8);}const _0x3e70af=new Map();for(const _0xaeeb74 of _0x1a903d){_0x3e70af[_0x3eb76d(0x168)](_0xaeeb74[_0x3eb76d(0x1b0)],_0xaeeb74);}for(const _0x1ac972 of _0x1a903d){const _0x57f410=_0x20203c['get'](_0x1ac972['name']);if(!_0x57f410)_0x3a7df3[_0x3eb76d(0x17d)]({'type':_0x3eb76d(0x146),'name':_0x1ac972[_0x3eb76d(0x1b0)],'yamlActivation':_0x1ac972});else{const _0x4210de=activationResponseToDef(_0x57f410,_0x230bb3,_0x101b1e),_0x359984=a152_0x19c01e['stringify'](_0x4210de),_0x5df32a=a152_0x19c01e[_0x3eb76d(0x18c)](_0x1ac972);_0x359984!==_0x5df32a&&_0x3a7df3[_0x3eb76d(0x17d)]({'type':_0x3eb76d(0x181),'name':_0x1ac972[_0x3eb76d(0x1b0)],'yamlActivation':_0x1ac972,'existingActivation':_0x57f410});}}for(const _0x5a9bd7 of _0xa2e208){!_0x3e70af[_0x3eb76d(0x12f)](_0x5a9bd7[_0x3eb76d(0x1b0)])&&_0x3a7df3[_0x3eb76d(0x17d)]({'type':_0x3eb76d(0x12d),'name':_0x5a9bd7[_0x3eb76d(0x1b0)],'existingActivation':_0x5a9bd7});}return _0x3a7df3;}function calculateYamlDiff(_0xdea87,_0x5c8aab){if(_0x5c8aab){const _0x4ee6b9=generateDiff(_0x5c8aab,_0xdea87),_0x24e8f6=hasChanges(_0x4ee6b9);return{'isNew':![],'hasChanges':_0x24e8f6,'diff':_0x24e8f6?formatDiffWithColors(_0x4ee6b9):undefined};}const _0x2554c9=generateDiff('',_0xdea87);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x2554c9)};}function a152_0x3f4b(_0x7b46a5,_0x859462){_0x7b46a5=_0x7b46a5-0xff;const _0x446374=a152_0x4463();let _0x3f4be2=_0x446374[_0x7b46a5];return _0x3f4be2;}export function calculateSegmentDiff(_0x3b7113,_0x5ad451,_0x161090,_0x4e8792,_0x2d4f74){const _0x3ee320=segmentToYamlString(_0x3b7113),_0x478b80=_0x5ad451?segmentToYamlString(segmentWithActivationsToYaml(_0x5ad451,_0x161090,undefined,_0x4e8792,_0x2d4f74)):undefined;return calculateYamlDiff(_0x3ee320,_0x478b80);}export function calculateJourneyDiff(_0x50db96,_0x302b53){const _0x353320=normalizeJourneyDef(_0x50db96,_0x50db96),_0x42c0ea=a152_0x9fc482(_0x353320),_0x3e2ff7=_0x302b53?a152_0x9fc482(normalizeJourneyDef(_0x302b53,_0x50db96)):undefined;return calculateYamlDiff(_0x42c0ea,_0x3e2ff7);}export function findSegmentsToDelete(_0x3dcb69,_0x289635,_0x544ac2,_0x5c59dc,_0x5b1688){const _0x5847ab=a152_0x25b4a3,_0x4f2025=new Set();for(const {yamlConfig:_0x2439a9,folderPath:_0x15c6b2}of _0x289635){_0x4f2025[_0x5847ab(0x1c5)](_0x15c6b2+':'+_0x2439a9[_0x5847ab(0x1b0)]);}return _0x3dcb69[_0x5847ab(0x103)](_0x33d51c=>{const _0x526621=_0x5847ab,_0x2e2aca=_0x33d51c[_0x526621(0x12b)]?_0x544ac2[_0x526621(0x151)](_0x33d51c[_0x526621(0x12b)][_0x526621(0x1da)]())||'':'',_0x440a8d=_0x2e2aca+':'+_0x33d51c[_0x526621(0x1b0)];if(_0x4f2025[_0x526621(0x12f)](_0x440a8d))return![];if(_0x5b1688)return _0x2e2aca===_0x5c59dc||_0x2e2aca[_0x526621(0x1fc)](_0x5c59dc+'/');return!![];});}export function findJourneysToDelete(_0x4cf26e,_0x2749e3,_0x32b442,_0x9cc7c0,_0xc9aaf2){const _0x20650e=a152_0x25b4a3,_0x1868e2=new Set();for(const {yamlConfig:_0x327b01,folderPath:_0x1ea087}of _0x2749e3){_0x1868e2[_0x20650e(0x1c5)](_0x1ea087+':'+_0x327b01['name']);}return _0x4cf26e[_0x20650e(0x103)](_0x1fa307=>{const _0x3d313b=_0x20650e,_0x34feba=_0x1fa307['folderId']?_0x32b442['get'](_0x1fa307[_0x3d313b(0x164)])||'':'',_0x2c157b=_0x34feba+':'+_0x1fa307[_0x3d313b(0x19b)];if(_0x1868e2[_0x3d313b(0x12f)](_0x2c157b))return![];if(_0xc9aaf2)return _0x34feba===_0x9cc7c0||_0x34feba['startsWith'](_0x9cc7c0+'/');return!![];});}export function buildSegmentLookupMap(_0xaa0d9d,_0x16600a){const _0x470e02=a152_0x25b4a3,_0x9e69c1=new Map();for(const _0x503141 of _0xaa0d9d){const _0x916ff=_0x503141['segmentFolderId']?_0x16600a[_0x470e02(0x151)](_0x503141[_0x470e02(0x12b)]['toString']())||'':'',_0x49eb80=_0x916ff+':'+_0x503141[_0x470e02(0x1b0)];_0x9e69c1[_0x470e02(0x168)](_0x49eb80,_0x503141);}return _0x9e69c1;}export function buildSegmentNameToIdMap(_0x2e7903){const _0x151500=a152_0x25b4a3,_0x3d3fb2=new Map();for(const _0x189007 of _0x2e7903){_0x3d3fb2[_0x151500(0x168)](_0x189007[_0x151500(0x1b0)],_0x189007['id']);}return _0x3d3fb2;}export function buildJourneyBundleLookupMap(_0x1887ea,_0x1d7310){const _0xcb2970=a152_0x25b4a3,_0x19a6d9=new Map();for(const _0x2833a8 of _0x1887ea){const _0x484404=_0x2833a8[_0xcb2970(0x164)]?_0x1d7310[_0xcb2970(0x151)](_0x2833a8['folderId'])||'':'',_0x208a96=_0x484404+':'+_0x2833a8[_0xcb2970(0x19b)];!_0x19a6d9[_0xcb2970(0x12f)](_0x208a96)&&_0x19a6d9[_0xcb2970(0x168)](_0x208a96,[]),_0x19a6d9[_0xcb2970(0x151)](_0x208a96)[_0xcb2970(0x17d)](_0x2833a8);}for(const _0x5d3cbd of _0x19a6d9[_0xcb2970(0x10a)]()){_0x5d3cbd['sort']((_0x5e1f6d,_0x3bd3bb)=>(_0x5e1f6d['versionNumber']||0x0)-(_0x3bd3bb[_0xcb2970(0x12c)]||0x0));}return _0x19a6d9;}export function collectFoldersToCreate(_0xd5ad37,_0x15b853){const _0x101cbd=a152_0x25b4a3,_0x3d1b90=new Set();for(const _0x11258c of _0xd5ad37){if(!_0x11258c)continue;if(_0x15b853['has'](_0x11258c))continue;const _0x273038=_0x11258c['split']('/');let _0x5b1a28='';for(const _0x46a902 of _0x273038){_0x5b1a28=_0x5b1a28?_0x5b1a28+'/'+_0x46a902:_0x46a902,!_0x15b853[_0x101cbd(0x12f)](_0x5b1a28)&&_0x3d1b90[_0x101cbd(0x1c5)](_0x5b1a28);}}return _0x3d1b90;}export function parseAndClassifyYamlFiles(_0x45f68b,_0x3982b1,_0x15cebe){const _0xb7423d=a152_0x25b4a3,_0x51c84f=[],_0x28865c=[];for(const _0x5a812c of _0x45f68b){const _0x4c8f8a=a152_0x5c5da7[_0xb7423d(0x1d5)](_0x3982b1,a152_0x5c5da7[_0xb7423d(0x163)](_0x5a812c)),_0x31a776=_0x4c8f8a==='.'?'':_0x4c8f8a[_0xb7423d(0x113)](/\\/g,'/'),_0x5d0132=readFileSync(_0x5a812c,_0xb7423d(0x1a2)),_0x317009=a152_0x19c01e[_0xb7423d(0x1a6)](_0x5d0132);if(isJourneyDef(_0x317009)){const _0xdc84e3=a152_0x3b46a5(_0x5d0132);_0x28865c[_0xb7423d(0x17d)]({'yamlConfig':_0xdc84e3,'folderPath':_0x31a776,'sourcePath':_0x5a812c});}else{if(!_0x15cebe?.[_0xb7423d(0x148)]){const _0x3dc6e4=parseSegmentYamlFile(_0x5d0132),_0x200fc4=normalizeChildSegmentYaml(_0x3dc6e4);_0x51c84f[_0xb7423d(0x17d)]({'yamlConfig':_0x200fc4,'folderPath':_0x31a776,'sourcePath':_0x5a812c});}}}return{'segments':_0x51c84f,'journeys':_0x28865c};}export function validateParsedFiles(_0xcb9e3a,_0x4d575d){const _0x5d5bfb=a152_0x25b4a3,_0x2644d3=[];for(const {yamlConfig:_0x3d3df7,sourcePath:_0x2cb0dd}of _0xcb9e3a[_0x5d5bfb(0x1e4)]){const _0x5445b7=readFileSync(_0x2cb0dd,'utf-8'),_0x479ec8=a152_0x19c01e['parseDocument'](_0x5445b7),_0x425642=validateSegmentDef(_0x3d3df7,{'source':_0x5445b7,'document':_0x479ec8},{'skipSchema':!![]});if(!_0x425642[_0x5d5bfb(0x180)]){const _0x3e3bed=a152_0x5c5da7[_0x5d5bfb(0x1d5)](_0x4d575d,_0x2cb0dd);_0x2644d3[_0x5d5bfb(0x17d)]({'filePath':_0x3e3bed,'source':_0x5445b7,'result':_0x425642,'isJourney':![]});}}for(const {yamlConfig:_0x549eb3,sourcePath:_0x4e6cbe}of _0xcb9e3a[_0x5d5bfb(0x147)]){const _0x154c4b=readFileSync(_0x4e6cbe,_0x5d5bfb(0x1a2)),_0x470f28=a152_0x19c01e[_0x5d5bfb(0x1be)](_0x154c4b),_0x9d45aa=validateJourneyDef(_0x549eb3,{'source':_0x154c4b,'document':_0x470f28},{'skipSchema':!![]});if(!_0x9d45aa[_0x5d5bfb(0x180)]){const _0x39f2e3=a152_0x5c5da7[_0x5d5bfb(0x1d5)](_0x4d575d,_0x4e6cbe);_0x2644d3['push']({'filePath':_0x39f2e3,'source':_0x154c4b,'result':_0x9d45aa,'isJourney':!![]});}}return _0x2644d3;}export function formatValidationErrors(_0x46138e){const _0x327259=a152_0x25b4a3,_0x51e383=[];for(const {filePath:_0x582040,source:_0x3dff4b,result:_0xcb42ba,isJourney:_0x46b37a}of _0x46138e){const _0x40616b=_0x46b37a?'journey':_0x327259(0x1c4);_0x51e383['push']('\x0a'+_0x582040+'\x20('+_0x40616b+_0x327259(0x1bb)+_0xcb42ba[_0x327259(0x1d3)][_0x327259(0x1d0)]+'\x20error(s)'),_0x51e383['push'](formatValidationResult(_0xcb42ba,_0x3dff4b,_0x582040));}return _0x51e383[_0x327259(0x138)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x455533){const _0x1c0265=a152_0x25b4a3,_0x505446=new Set(),_0x51ef14=new Map(),_0x4fff7f=collectSegmentUsageCounts(_0x455533);if(_0x455533[_0x1c0265(0x1e4)])for(const [_0x1329d4,_0x4ec525]of Object[_0x1c0265(0x10c)](_0x455533[_0x1c0265(0x1e4)])){_0x505446['add'](_0x1329d4);if(_0x4ec525[_0x1c0265(0x162)]){const _0x8b5b51=yamlRuleToApi(_0x4ec525[_0x1c0265(0x162)]),_0x333e01=apiRuleToYaml(_0x8b5b51);_0x51ef14[_0x1c0265(0x168)](_0x1329d4,_0x333e01);}}const _0x3a51ee=new Map();let _0x152966=0x0;for(const [_0x26b35e,_0x2a356a]of _0x51ef14){const _0xc82131=serializeExpandedRule(_0x2a356a,_0x51ef14),_0x292291=_0x3a51ee['get'](_0xc82131)||[];_0x292291[_0x1c0265(0x17d)]({'name':_0x26b35e,'index':_0x152966}),_0x3a51ee['set'](_0xc82131,_0x292291),_0x152966++;}const _0x55eb2c=new Map();for(const [_0x3c6e41,_0x25e055]of _0x3a51ee){const _0x305fbf=_0x25e055[_0x1c0265(0x197)]()[_0x1c0265(0x100)]((_0x564610,_0x998dbd)=>{const _0x300509=_0x1c0265,_0xf00862=_0x4fff7f[_0x300509(0x151)](_0x564610['name'])||0x0,_0x268a0e=_0x4fff7f[_0x300509(0x151)](_0x998dbd[_0x300509(0x1b0)])||0x0;if(_0xf00862!==_0x268a0e)return _0x268a0e-_0xf00862;return _0x564610[_0x300509(0x11c)]-_0x998dbd['index'];})['map'](_0xf86a0b=>_0xf86a0b[_0x1c0265(0x1b0)]),_0x39490f=[];for(const _0x2eed6b of _0x305fbf){const _0x335c42=_0x4fff7f[_0x1c0265(0x151)](_0x2eed6b)||0x0,_0x205ff3=Math[_0x1c0265(0x1b3)](_0x335c42,0x1);for(let _0x4f1da4=0x0;_0x4f1da4<_0x205ff3;_0x4f1da4++){_0x39490f[_0x1c0265(0x17d)](_0x2eed6b);}}_0x55eb2c[_0x1c0265(0x168)](_0x3c6e41,_0x39490f);}return{'existingLocalSegmentNames':_0x505446,'localSegmentRules':_0x51ef14,'localExpandedRuleToNames':_0x55eb2c};}export function createSegmentIdResolver(_0x1745ab,_0x416635){return async _0x352f97=>{const _0x1fe629=a152_0x3f4b,_0x1450ed=_0x1745ab[_0x1fe629(0x151)](_0x352f97);if(!_0x1450ed)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x1fe629(0x1ee)+_0x352f97+_0x1fe629(0x18b)+_0x416635+'\x27)');return _0x1450ed;};}export function extractRootFolderId(_0xa5a856){const _0x83377f=a152_0x25b4a3;return _0xa5a856[_0x83377f(0x17b)]?.[_0x83377f(0x1dc)]?.[_0x83377f(0x178)]?.['id']||_0xa5a856[_0x83377f(0x17b)]?.[_0x83377f(0x1bc)]?.[_0x83377f(0x178)]?.['id'];}export function buildConnectionMaps(_0x46e27f){const _0x303de4=a152_0x25b4a3,_0x3c3dd5=new Map(),_0x223e10=new Map(),_0xca83b8=new Map();for(const _0x55ddde of _0x46e27f){_0x3c3dd5[_0x303de4(0x168)](_0x55ddde[_0x303de4(0x1b0)],parseInt(_0x55ddde['id'],0xa)),_0x223e10['set'](_0x55ddde['id'],_0x55ddde['name']),_0xca83b8[_0x303de4(0x168)](_0x55ddde[_0x303de4(0x1b0)],_0x55ddde[_0x303de4(0x114)]);}return{'nameToId':_0x3c3dd5,'idToName':_0x223e10,'nameToType':_0xca83b8};}export function calculatePushStats(_0xfe69c9,_0x2e6a0f,_0x39286b,_0x2e9a54,_0x4545b6,_0x1a921b,_0xb358d6){const _0x194222=a152_0x25b4a3,_0x34faab=_0xfe69c9[_0x194222(0x103)](_0x370979=>_0x370979[_0x194222(0x185)]),_0x5bcb27=_0xfe69c9['filter'](_0xdf0a9e=>!_0xdf0a9e[_0x194222(0x185)]&&_0xdf0a9e['hasChanges']),_0x213a97=_0xfe69c9[_0x194222(0x103)](_0x544583=>!_0x544583[_0x194222(0x185)]&&!_0x544583[_0x194222(0x1f9)]),_0x2339c0=_0x1a921b?_0x2e9a54:[],_0x3770a5=_0x2e6a0f[_0x194222(0x103)](_0x4435da=>_0x4435da[_0x194222(0x185)]),_0x3cd9b9=_0x2e6a0f['filter'](_0x557dad=>!_0x557dad[_0x194222(0x185)]&&_0x557dad[_0x194222(0x1f9)]),_0xa1eaf5=_0x2e6a0f[_0x194222(0x103)](_0x29123c=>!_0x29123c[_0x194222(0x185)]&&!_0x29123c['hasChanges']),_0x103206=_0x1a921b?_0x4545b6:[],_0x4eb9f0=_0xfe69c9[_0x194222(0x128)](_0x223cf7=>_0x223cf7['activationActions']),_0xbf8c0e=_0x4eb9f0[_0x194222(0x103)](_0x4ae39a=>_0x4ae39a[_0x194222(0x114)]===_0x194222(0x146)),_0x5be745=_0x4eb9f0['filter'](_0x555fde=>_0x555fde[_0x194222(0x114)]===_0x194222(0x181)),_0x5368c2=_0x4eb9f0[_0x194222(0x103)](_0x172a37=>_0x172a37[_0x194222(0x114)]===_0x194222(0x12d)),_0xcf1b81=Array[_0x194222(0x1f8)](_0x39286b)[_0x194222(0x100)](),_0x219bf5=_0xb358d6?![]:_0x34faab[_0x194222(0x1d0)]>0x0||_0x5bcb27[_0x194222(0x1d0)]>0x0||_0x2339c0[_0x194222(0x1d0)]>0x0,_0x5917f3=_0x3770a5['length']>0x0||_0x3cd9b9['length']>0x0||_0x103206[_0x194222(0x1d0)]>0x0,_0x15faca=_0xb358d6?![]:_0x4eb9f0[_0x194222(0x1d0)]>0x0,_0x24e329=_0xcf1b81['length']>0x0;return{'segments':{'new':_0x34faab,'changed':_0x5bcb27,'unchanged':_0x213a97,'toDelete':_0x2339c0},'journeys':{'new':_0x3770a5,'changed':_0x3cd9b9,'unchanged':_0xa1eaf5,'toDelete':_0x103206},'activations':{'all':_0x4eb9f0,'toCreate':_0xbf8c0e,'toUpdate':_0x5be745,'toDelete':_0x5368c2},'folders':{'toCreate':_0xcf1b81},'counts':{'segments':{'new':_0x34faab[_0x194222(0x1d0)],'changed':_0x5bcb27[_0x194222(0x1d0)],'unchanged':_0x213a97[_0x194222(0x1d0)],'toDelete':_0x2339c0[_0x194222(0x1d0)]},'journeys':{'new':_0x3770a5[_0x194222(0x1d0)],'changed':_0x3cd9b9[_0x194222(0x1d0)],'unchanged':_0xa1eaf5[_0x194222(0x1d0)],'toDelete':_0x103206[_0x194222(0x1d0)]},'activations':{'create':_0xbf8c0e[_0x194222(0x1d0)],'update':_0x5be745[_0x194222(0x1d0)],'delete':_0x5368c2[_0x194222(0x1d0)]},'folders':_0xcf1b81['length']},'hasChanges':_0x219bf5||_0x5917f3||_0x15faca||_0x24e329};}export async function buildPushExecutionContext(_0x44ea62,_0x711871,_0x2a42d4,_0x59dcac,_0x4f73f0,_0x509fad){const _0x1efda6=a152_0x25b4a3,_0x38347b=extractRootFolderId(_0x2a42d4),{pathToId:_0x1551c6,idToPath:_0x456b8e}=buildFolderMaps(_0x4f73f0),_0x3adc85=buildSegmentNameToIdMap(_0x59dcac),_0x406dd9=new Map(),{batchAsync:_0x3a6b4f}=await import('../../utils/async.js'),[_0x55e09e,_0x1bca7a]=await Promise[_0x1efda6(0x1e6)]([_0x44ea62[_0x1efda6(0x1a1)][_0x1efda6(0x1b2)](),_0x44ea62[_0x1efda6(0x123)][_0x1efda6(0x130)](),((async()=>{const _0x42018e=_0x1efda6;!_0x509fad&&_0x59dcac[_0x42018e(0x1d0)]>0x0&&await _0x3a6b4f(_0x59dcac,async _0x44dd0c=>{const _0x462d67=_0x42018e,_0x234e58=await _0x44ea62[_0x462d67(0x1c4)][_0x462d67(0x171)](_0x711871,_0x44dd0c['id']);_0x406dd9['set'](_0x44dd0c['id'],_0x234e58);});})())]),{emailToId:_0x2cf07a,idToEmail:_0x404385}=_0x55e09e,_0x2fe65f=buildConnectionMaps(_0x1bca7a);return{'rootFolderId':_0x38347b,'folderPathToId':_0x1551c6,'folderIdToPath':_0x456b8e,'segmentNameToId':_0x3adc85,'activationsBySegmentId':_0x406dd9,'emailToIdMap':_0x2cf07a,'idToEmailMap':_0x404385,'connectionNameToIdMap':_0x2fe65f[_0x1efda6(0x104)],'connectionIdToNameMap':_0x2fe65f[_0x1efda6(0x13f)],'connectionNameToTypeMap':_0x2fe65f['nameToType']};}export function createPushYamlContextForBundle(_0x508ccc,_0x220ff9,_0x3a695e,_0x86ac39,_0x36b2dd,_0x3c11e5,_0x428862,_0x4ab224){const {existingLocalSegmentNames:_0x1684b6,localExpandedRuleToNames:_0x1f4158}=_0x86ac39,_0xdc8eca=new Set(),_0x307e07=new Map(),_0x43899a=new Map(),_0x15c545=new Map(),_0x1b6141=createJumpTargetCache(),_0x4bcd4b=new Map(),_0x290e9b=new Map(),_0x260e83=new Set();let _0x57464f;const _0x15cc12=_0x2f9b7b=>{const _0x3b0580={'resolveSegment':async _0x4bff81=>{const _0x4ef71d=a152_0x3f4b,_0x15eced=_0x15c545['get'](_0x4bff81);if(_0x15eced!==undefined)return{'name':_0x15eced,'isJourneyLocal':!![]};try{const _0x4d2097=await fetchSegment(_0x508ccc,_0x220ff9,_0x4bff81,_0x3a695e);if(!_0x4d2097)throw new Error('Segment\x20not\x20found');const _0x3ed8e2=generateJourneyLocalName(_0x4d2097[_0x4ef71d(0x1b0)]),_0xb50200=_0x4d2097[_0x4ef71d(0x19a)]===SEGMENT_KIND_JOURNEY&&_0x3ed8e2!==undefined;let _0x4bc983=_0x4d2097['name'],_0x68e0d9;if(_0xb50200&&_0x4d2097['rule']){const _0x3fb695=apiRuleToYaml(_0x4d2097[_0x4ef71d(0x162)]);_0x290e9b[_0x4ef71d(0x168)](_0x4bff81,_0x3fb695);const _0x3118bd=async _0x343ea9=>{const _0x141569=_0x4ef71d,_0x1fa837=collectSegmentRefsFromRule(_0x343ea9);for(const _0x5db000 of _0x1fa837){if(!_0x290e9b[_0x141569(0x12f)](_0x5db000))try{const _0x520e59=await fetchSegment(_0x508ccc,_0x220ff9,_0x5db000,_0x3a695e);if(_0x520e59?.[_0x141569(0x162)]){const _0x8959e1=apiRuleToYaml(_0x520e59[_0x141569(0x162)]);_0x290e9b[_0x141569(0x168)](_0x5db000,_0x8959e1),await _0x3118bd(_0x8959e1);}}catch(_0x1958d8){logger['debug'](_0x141569(0x1e0)+_0x5db000+':\x20'+_0x1958d8);}}};await _0x3118bd(_0x3fb695);const _0x4eea98=serializeExpandedRule(_0x3fb695,_0x290e9b),_0x4f3b96=_0x1f4158[_0x4ef71d(0x151)](_0x4eea98);if(_0x4f3b96&&_0x4f3b96['length']>0x0){const _0x556e15=_0x307e07[_0x4ef71d(0x151)](_0x4eea98)||0x0,_0x21e16f=_0x4f3b96[_0x556e15]||_0x4f3b96[_0x4f3b96[_0x4ef71d(0x1d0)]-0x1];_0x307e07[_0x4ef71d(0x168)](_0x4eea98,_0x556e15+0x1),_0x4bc983=_0x21e16f,_0xdc8eca['add'](_0x4bc983),_0x15c545[_0x4ef71d(0x168)](_0x4bff81,_0x4bc983);const _0x5b8626=await resolveRuleSegmentRefs(_0x3fb695,async _0x257242=>{const _0x452c7d=_0x4ef71d,_0x12d310=_0x15c545[_0x452c7d(0x151)](_0x257242);if(_0x12d310)return _0x12d310;const _0x491a1e=await _0x57464f[_0x452c7d(0x1b7)](_0x257242);return _0x491a1e[_0x452c7d(0x1b0)];});_0x68e0d9={'description':_0x4d2097['description'],'rule':_0x5b8626};}else{const _0x183a80=_0x4bcd4b[_0x4ef71d(0x151)](_0x4eea98);if(_0x183a80)_0x4bc983=_0x183a80,_0x15c545[_0x4ef71d(0x168)](_0x4bff81,_0x4bc983);else{if(_0x3ed8e2){let _0x574d1b=_0x3ed8e2,_0x70ea83=0x2;while(_0xdc8eca[_0x4ef71d(0x12f)](_0x574d1b)||_0x1684b6['has'](_0x574d1b)){_0x574d1b=_0x3ed8e2+'_'+_0x70ea83,_0x70ea83++;}_0xdc8eca[_0x4ef71d(0x1c5)](_0x574d1b),_0x4bc983=_0x574d1b;}_0x15c545[_0x4ef71d(0x168)](_0x4bff81,_0x4bc983),_0x4bcd4b[_0x4ef71d(0x168)](_0x4eea98,_0x4bc983);const _0x1a3744=await resolveRuleSegmentRefs(_0x3fb695,async _0x5ef1f9=>{const _0x479564=_0x4ef71d,_0x1defdb=_0x15c545[_0x479564(0x151)](_0x5ef1f9);if(_0x1defdb)return _0x1defdb;const _0x4858f3=await _0x57464f[_0x479564(0x1b7)](_0x5ef1f9);return _0x4858f3[_0x479564(0x1b0)];});_0x68e0d9={'description':_0x4d2097[_0x4ef71d(0x1b9)],'rule':_0x1a3744};}}}return{'name':_0x4bc983,'isJourneyLocal':_0xb50200,'definition':_0x68e0d9};}catch(_0x22491d){return logger[_0x4ef71d(0x1cc)](_0x4ef71d(0x11e)+_0x4bff81+':\x20'+_0x22491d),{'name':_0x4bff81,'isJourneyLocal':![]};}},'resolveActivation':async _0x2617a6=>{const _0x66a7e5=a152_0x3f4b,_0x18f5a0=_0x43899a[_0x66a7e5(0x151)](_0x2617a6);if(_0x18f5a0!==undefined)return{'name':_0x18f5a0,'isJourneyLocal':!![]};try{let _0x273b53=_0x428862?.[_0x66a7e5(0x151)](_0x2617a6);!_0x273b53&&(_0x273b53=await _0x508ccc[_0x66a7e5(0x174)][_0x66a7e5(0x18f)](_0x2f9b7b,_0x2617a6));const _0x20866e=_0x273b53['attributes']['activationParams'][_0x66a7e5(0x1b0)]||_0x2617a6,_0x2badbf=sanitizeYamlKey(_0x20866e)||_0x66a7e5(0x1db)+_0x2617a6,_0x570d31=_0x2badbf;_0x43899a['set'](_0x2617a6,_0x570d31);const _0x78e362=journeyActivationStepToYaml(_0x273b53,_0x36b2dd,_0x3c11e5);return{'name':_0x570d31,'isJourneyLocal':!![],'definition':_0x78e362};}catch(_0x4deef7){return logger[_0x66a7e5(0x1cc)]('Failed\x20to\x20resolve\x20activation\x20'+_0x2617a6+':\x20'+_0x4deef7),{'name':_0x2617a6,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2da6d6,_0x16f55a)=>resolveJumpTarget(_0x2da6d6,_0x16f55a,_0x1b6141,async _0x3b00f6=>{const _0x3794ab=a152_0x3f4b,_0x172ddf=_0x4ab224?.[_0x3794ab(0x151)](_0x3b00f6);if(_0x172ddf)return _0x172ddf;return _0x508ccc[_0x3794ab(0x174)]['getJourney'](_0x3b00f6);})};return _0x57464f=_0x3b0580,_0x3b0580;},_0x49fee9=async _0x4974d9=>{const _0x1d3e29=a152_0x3f4b,{collectSegmentIdsFromJourneyApi:_0x4f90e0}=await import(_0x1d3e29(0x14e)),{batchAsync:_0x4c3da7}=await import(_0x1d3e29(0x111)),_0x37bf94=new Set();for(const _0x279586 of _0x4974d9){let _0x160bd8=_0x4ab224?.['get'](_0x279586);!_0x160bd8&&(_0x160bd8=await _0x508ccc[_0x1d3e29(0x174)][_0x1d3e29(0x1e3)](_0x279586));const _0x2a8310=_0x4f90e0(_0x160bd8);for(const _0x4b4511 of _0x2a8310){_0x37bf94[_0x1d3e29(0x1c5)](_0x4b4511);}}let _0x17ce1a=Array[_0x1d3e29(0x1f8)](_0x37bf94);while(_0x17ce1a[_0x1d3e29(0x1d0)]>0x0){const _0x54a3c6=_0x17ce1a[_0x1d3e29(0x103)](_0x418071=>!_0x260e83[_0x1d3e29(0x12f)](_0x418071));if(_0x54a3c6[_0x1d3e29(0x1d0)]===0x0)break;const _0x50fb4c=await _0x4c3da7(_0x54a3c6,async _0x22aeb9=>{_0x260e83['add'](_0x22aeb9);const _0x2c9fcf=await fetchSegment(_0x508ccc,_0x220ff9,_0x22aeb9,_0x3a695e);if(!_0x2c9fcf)return null;return{'segmentId':_0x22aeb9,'segment':_0x2c9fcf};},0xa),_0x305024=new Set();for(const _0x5ef99f of _0x50fb4c){if(!_0x5ef99f?.[_0x1d3e29(0x1c4)]?.[_0x1d3e29(0x162)])continue;const _0xb86270=apiRuleToYaml(_0x5ef99f[_0x1d3e29(0x1c4)][_0x1d3e29(0x162)]);_0x290e9b[_0x1d3e29(0x168)](_0x5ef99f[_0x1d3e29(0x153)],_0xb86270);const _0x1751e7=collectSegmentRefsFromRule(_0xb86270);for(const _0x2af9c4 of _0x1751e7){!_0x260e83[_0x1d3e29(0x12f)](_0x2af9c4)&&_0x305024['add'](_0x2af9c4);}}_0x17ce1a=Array['from'](_0x305024);}};return{'createYamlContext':_0x15cc12,'prefetchJourneySegments':_0x49fee9};}export async function executePushSegments(_0x472db3,_0x55e794,_0x422f8c,_0x2e560f,_0xf25fd3){const _0x1af19a=a152_0x25b4a3,{segmentDefToCreateRequest:_0x412e2d,segmentDefToUpdateRequest:_0x43ca78}=await import(_0x1af19a(0x13b)),_0x5baa7b=_0x422f8c['folderPathToId'],_0x5abf4a=0x5,_0x3e2f4f=async _0xfebeb=>{const _0x5f0b0f=_0x1af19a,_0x1c2a34=_0xfebeb['folderPath']?_0x5baa7b[_0x5f0b0f(0x151)](_0xfebeb[_0x5f0b0f(0x160)]):undefined;let _0x12f536;const _0x130e5a={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x33ca93=_0xfebeb[_0x5f0b0f(0x199)];if(_0xfebeb['yamlConfig']['rule']){const _0x471874=createSegmentIdResolver(_0x422f8c[_0x5f0b0f(0x14b)],_0xfebeb['yamlConfig'][_0x5f0b0f(0x1b0)]),_0x22a0ac=await resolveRuleSegmentIds(_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x162)],_0x471874);_0x33ca93={..._0xfebeb['yamlConfig'],'rule':_0x22a0ac};}try{if(_0xfebeb['isNew']){_0xf25fd3['onProgress']?.({'type':_0x5f0b0f(0x13c),'name':_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)]});const _0x2672ed=_0x412e2d(_0x33ca93,_0x1c2a34),_0x26c9cf=await _0xf25fd3[_0x5f0b0f(0x1c0)]('Creating\x20segment\x20\x27'+_0xfebeb[_0x5f0b0f(0x199)]['name']+_0x5f0b0f(0x12a),()=>_0x472db3['segment'][_0x5f0b0f(0x108)](_0x2e560f[_0x5f0b0f(0x145)],_0x2672ed));_0x12f536=_0x26c9cf['data']['id'],_0x422f8c[_0x5f0b0f(0x14b)][_0x5f0b0f(0x168)](_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)],_0x12f536),_0x130e5a[_0x5f0b0f(0x1df)]={'name':_0xfebeb['yamlConfig']['name'],'id':_0x12f536},_0xf25fd3[_0x5f0b0f(0x1aa)]?.({'type':'segment_created','name':_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)],'segmentId':_0x12f536}),_0xf25fd3[_0x5f0b0f(0x1e2)]?.(_0x5f0b0f(0x1c1)+_0xfebeb['yamlConfig'][_0x5f0b0f(0x1b0)]+'\x27'),_0x130e5a[_0x5f0b0f(0x167)]=0x1;}else{if(_0xfebeb[_0x5f0b0f(0x1f9)]){_0xf25fd3[_0x5f0b0f(0x1aa)]?.({'type':'segment_updating','name':_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)]});const _0x395b10=_0x43ca78(_0x33ca93);_0x1c2a34!==_0xfebeb[_0x5f0b0f(0x1a3)]?.[_0x5f0b0f(0x12b)]&&(_0x395b10['segmentFolderId']=_0x1c2a34?parseInt(_0x1c2a34,0xa):undefined),await _0xf25fd3[_0x5f0b0f(0x1c0)](_0x5f0b0f(0x1e8)+_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)]+_0x5f0b0f(0x12a),()=>_0x472db3[_0x5f0b0f(0x1c4)][_0x5f0b0f(0x1ef)](_0x2e560f[_0x5f0b0f(0x145)],_0xfebeb[_0x5f0b0f(0x1a3)]['id'],_0x395b10)),_0x12f536=_0xfebeb[_0x5f0b0f(0x1a3)]['id'],_0xf25fd3['onProgress']?.({'type':'segment_updated','name':_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)]}),_0xf25fd3['logSuccess']?.(_0x5f0b0f(0x1c9)+_0xfebeb[_0x5f0b0f(0x199)]['name']+'\x27'),_0x130e5a[_0x5f0b0f(0x1d4)]=0x1;}else _0x12f536=_0xfebeb['existingSegment']['id'];}}catch(_0x28698b){const _0x291457=isHttp400Error(_0x28698b),_0x3484d2=_0x291457?ErrorCode[_0x5f0b0f(0x121)]:ErrorCode[_0x5f0b0f(0x1cd)],_0x42db44=getErrorMessage(_0x28698b);throw new SDKError(_0x3484d2,_0x5f0b0f(0x1f6)+(_0xfebeb[_0x5f0b0f(0x185)]?'create':_0x5f0b0f(0x181))+_0x5f0b0f(0x144)+_0xfebeb[_0x5f0b0f(0x15c)]+_0x5f0b0f(0x190)+_0x42db44,_0x28698b);}try{const _0x48b93=await syncActivationsForSegment(_0x472db3,_0x2e560f[_0x5f0b0f(0x145)],_0x12f536,_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)],_0xfebeb['activationActions'],_0xf25fd3,_0xfebeb['absolutePath']);_0x130e5a[_0x5f0b0f(0x1bf)]=_0x48b93;}catch(_0x505fd4){if(_0x505fd4 instanceof SDKError)throw _0x505fd4;throw new SDKError(ErrorCode['ACTIVATION_UPDATE_ERROR'],'Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27'+_0xfebeb[_0x5f0b0f(0x199)][_0x5f0b0f(0x1b0)]+'\x27\x20from\x20file:\x20'+_0xfebeb[_0x5f0b0f(0x15c)]+'\x0a\x20\x20'+getErrorMessage(_0x505fd4),_0x505fd4);}return _0x130e5a;},_0x52d5d2=await batchAsync(_0x55e794,_0x3e2f4f,_0x5abf4a),_0xd34c6e={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x49a27b of _0x52d5d2){_0xd34c6e['created']+=_0x49a27b[_0x1af19a(0x167)],_0xd34c6e[_0x1af19a(0x1d4)]+=_0x49a27b[_0x1af19a(0x1d4)],_0x49a27b[_0x1af19a(0x1df)]&&_0xd34c6e[_0x1af19a(0x1ff)][_0x1af19a(0x168)](_0x49a27b[_0x1af19a(0x1df)][_0x1af19a(0x1b0)],_0x49a27b[_0x1af19a(0x1df)]['id']),_0xd34c6e[_0x1af19a(0x1bf)][_0x1af19a(0x167)]+=_0x49a27b['activations'][_0x1af19a(0x167)],_0xd34c6e['activations']['updated']+=_0x49a27b[_0x1af19a(0x1bf)][_0x1af19a(0x1d4)],_0xd34c6e[_0x1af19a(0x1bf)][_0x1af19a(0x139)]+=_0x49a27b[_0x1af19a(0x1bf)][_0x1af19a(0x139)];}return _0xd34c6e;}async function syncActivationsForSegment(_0x395e79,_0x49b752,_0x165758,_0x1715c0,_0x696048,_0x131750,_0x3337a3){const _0x3c012b=a152_0x25b4a3,_0x4e0fbc={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x2251d3 of _0x696048){try{if(_0x2251d3[_0x3c012b(0x114)]===_0x3c012b(0x146)&&_0x2251d3[_0x3c012b(0x11d)])_0x131750[_0x3c012b(0x1aa)]?.({'type':_0x3c012b(0x124),'segmentName':_0x1715c0,'activationName':_0x2251d3[_0x3c012b(0x1b0)]}),await _0x131750[_0x3c012b(0x1c0)](_0x3c012b(0x18d)+_0x2251d3['name']+_0x3c012b(0x12a),()=>_0x395e79[_0x3c012b(0x1c4)][_0x3c012b(0x189)](_0x49b752,_0x165758,_0x2251d3[_0x3c012b(0x11d)])),_0x131750[_0x3c012b(0x1aa)]?.({'type':_0x3c012b(0x17c),'segmentName':_0x1715c0,'activationName':_0x2251d3[_0x3c012b(0x1b0)]}),_0x131750['logSuccess']?.(_0x3c012b(0x132)+_0x2251d3['name']+'\x27'),_0x4e0fbc[_0x3c012b(0x167)]++;else{if(_0x2251d3[_0x3c012b(0x114)]===_0x3c012b(0x181)&&_0x2251d3[_0x3c012b(0x11d)]&&_0x2251d3['existingActivation'])_0x131750[_0x3c012b(0x1aa)]?.({'type':_0x3c012b(0x11f),'segmentName':_0x1715c0,'activationName':_0x2251d3['name']}),await _0x131750['withProgress'](_0x3c012b(0x140)+_0x2251d3['name']+_0x3c012b(0x12a),()=>_0x395e79[_0x3c012b(0x1c4)][_0x3c012b(0x1c6)](_0x49b752,_0x165758,_0x2251d3['existingActivation']['id'],_0x2251d3[_0x3c012b(0x11d)])),_0x131750['onProgress']?.({'type':_0x3c012b(0x1f0),'segmentName':_0x1715c0,'activationName':_0x2251d3[_0x3c012b(0x1b0)]}),_0x131750['logSuccess']?.(_0x3c012b(0x142)+_0x2251d3[_0x3c012b(0x1b0)]+'\x27'),_0x4e0fbc[_0x3c012b(0x1d4)]++;else _0x2251d3[_0x3c012b(0x114)]===_0x3c012b(0x12d)&&_0x2251d3[_0x3c012b(0x1ad)]&&(_0x131750['onProgress']?.({'type':_0x3c012b(0x125),'segmentName':_0x1715c0,'activationName':_0x2251d3[_0x3c012b(0x1b0)]}),await _0x131750[_0x3c012b(0x1c0)](_0x3c012b(0x16c)+_0x2251d3[_0x3c012b(0x1b0)]+_0x3c012b(0x12a),()=>_0x395e79[_0x3c012b(0x1c4)][_0x3c012b(0x107)](_0x49b752,_0x165758,_0x2251d3['existingActivation']['id'])),_0x131750['onProgress']?.({'type':_0x3c012b(0x1c2),'segmentName':_0x1715c0,'activationName':_0x2251d3[_0x3c012b(0x1b0)]}),_0x131750[_0x3c012b(0x15a)]?.('Deleted\x20activation\x20\x27'+_0x2251d3[_0x3c012b(0x1b0)]+'\x27'),_0x4e0fbc[_0x3c012b(0x139)]++);}}catch(_0xa6830e){const _0x2b1e12=isHttp400Error(_0xa6830e),_0x57c578=_0x2b1e12?ErrorCode[_0x3c012b(0x198)]:ErrorCode[_0x3c012b(0x169)],_0x159040=getErrorMessage(_0xa6830e);throw new SDKError(_0x57c578,_0x3c012b(0x1f6)+_0x2251d3[_0x3c012b(0x114)]+_0x3c012b(0x1e7)+_0x2251d3[_0x3c012b(0x1b0)]+_0x3c012b(0x1ac)+_0x3337a3+_0x3c012b(0x190)+_0x159040,_0xa6830e);}}return _0x4e0fbc;}export async function executePushFolders(_0x57f89b,_0x150ef1,_0x432a41,_0x463f5d,_0x4705a1){const _0x2443ae=a152_0x25b4a3,_0x3a0719=new Map(_0x432a41),_0x495a1f=sortFoldersByDepth(_0x150ef1);for(const _0x24107f of _0x495a1f){const _0x482da4=_0x24107f['split']('/'),_0x49b09a=_0x482da4[_0x482da4[_0x2443ae(0x1d0)]-0x1],_0x5c6aac=_0x482da4['slice'](0x0,-0x1)[_0x2443ae(0x138)]('/'),_0x133887=_0x3a0719[_0x2443ae(0x151)](_0x5c6aac);_0x4705a1[_0x2443ae(0x1aa)]?.({'type':'folder_creating','folder':_0x24107f});const _0x4b4bdf={'name':_0x49b09a,'parentFolderId':_0x133887},_0x54195c=await _0x4705a1[_0x2443ae(0x1c0)](_0x2443ae(0x193)+_0x24107f+_0x2443ae(0x12a),()=>_0x57f89b[_0x2443ae(0x1c4)][_0x2443ae(0x13d)](_0x463f5d['parentId'],_0x4b4bdf));_0x3a0719[_0x2443ae(0x168)](_0x24107f,_0x54195c[_0x2443ae(0x178)]['id']),_0x4705a1['onProgress']?.({'type':_0x2443ae(0x1f1),'folder':_0x24107f,'folderId':_0x54195c[_0x2443ae(0x178)]['id']}),_0x4705a1['logInfo']?.(_0x2443ae(0x15f)+_0x24107f+'\x27');}return _0x3a0719;}export async function executePushSegmentDeletions(_0x11de7d,_0x384cd3,_0x14172){const _0x5dc686=a152_0x25b4a3;if(_0x384cd3[_0x5dc686(0x1d0)]===0x0)return 0x0;const {batchAsync:_0x4eb526}=await import(_0x5dc686(0x111)),_0x43c125=0x5,_0x23a40c=await _0x4eb526(_0x384cd3,async _0x64648d=>{const _0x75184f=_0x5dc686;return _0x14172[_0x75184f(0x1aa)]?.({'type':_0x75184f(0x166),'name':_0x64648d[_0x75184f(0x1b0)]}),await _0x11de7d[_0x75184f(0x1c4)][_0x75184f(0x109)](_0x64648d['id']),_0x14172[_0x75184f(0x1aa)]?.({'type':_0x75184f(0x1fd),'name':_0x64648d[_0x75184f(0x1b0)]}),_0x14172[_0x75184f(0x15a)]?.(_0x75184f(0x14a)+_0x64648d[_0x75184f(0x1b0)]+'\x27'),0x1;},_0x43c125);return _0x23a40c[_0x5dc686(0x102)]((_0x3e453c,_0x478869)=>_0x3e453c+_0x478869,0x0);}export async function executePushJourneys(_0x8a7412,_0x102a17,_0x375072,_0x594d87,_0x4493ae){const _0x508822=a152_0x25b4a3,{journeyDefToRequest:_0x5273ab}=await import(_0x508822(0x14e)),{activationDefToCreateRequest:_0x468079,yamlRuleToApi:_0x79ee72,validateSegmentRule:_0x201f91}=await import(_0x508822(0x13b)),_0x214de9={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x56f928=new Map(_0x375072[_0x508822(0x14b)]),_0x5b7cbf=0x5;for(let _0x2c06a1=0x0;_0x2c06a1<_0x102a17['length'];_0x2c06a1+=_0x5b7cbf){const _0x4aa195=_0x102a17[_0x508822(0x197)](_0x2c06a1,_0x2c06a1+_0x5b7cbf),_0x14d143=await Promise['all'](_0x4aa195[_0x508822(0x1e1)](async _0x7cfc26=>{const _0xd3aa6b=_0x508822;if(!_0x7cfc26[_0xd3aa6b(0x185)]&&!_0x7cfc26['hasChanges'])return{'action':_0xd3aa6b(0x1cb),'name':_0x7cfc26['yamlConfig']['name'],'journeyId':_0x7cfc26['existingJourney']?.['id']};const _0x1c5ba3=_0x7cfc26[_0xd3aa6b(0x160)]?_0x375072[_0xd3aa6b(0x1a0)][_0xd3aa6b(0x151)](_0x7cfc26[_0xd3aa6b(0x160)]):undefined;_0x4493ae[_0xd3aa6b(0x1aa)]?.({'type':_0x7cfc26['isNew']?'journey_creating':_0xd3aa6b(0x15b),'name':_0x7cfc26['yamlConfig']['name']});try{const _0x3bbd14=await executeSingleJourneyPush(_0x8a7412,_0x7cfc26,{..._0x375072,'segmentNameToId':_0x56f928},{'parentId':_0x594d87[_0xd3aa6b(0x145)],'rootFolderId':_0x594d87[_0xd3aa6b(0x1b1)],'folderId':_0x1c5ba3,'verbose':_0x594d87['verbose']},_0x4493ae,{'journeyDefToRequest':_0x5273ab,'activationDefToCreateRequest':_0x468079,'yamlRuleToApi':_0x79ee72,'validateSegmentRule':_0x201f91});for(const [_0x2d6fb6,_0x4f5eb1]of _0x3bbd14['embeddedSegmentNameToId']){_0x56f928[_0xd3aa6b(0x168)](_0x2d6fb6,_0x4f5eb1),_0x214de9[_0xd3aa6b(0x170)][_0xd3aa6b(0x168)](_0x2d6fb6,_0x4f5eb1);}if(_0x3bbd14[_0xd3aa6b(0x1a7)]===_0xd3aa6b(0x167))_0x4493ae[_0xd3aa6b(0x1aa)]?.({'type':_0xd3aa6b(0x1d6),'name':_0x7cfc26[_0xd3aa6b(0x199)][_0xd3aa6b(0x1b0)],'journeyId':_0x3bbd14['journeyId']}),_0x4493ae[_0xd3aa6b(0x1e2)]?.('Created\x20journey\x20\x27'+_0x7cfc26['yamlConfig'][_0xd3aa6b(0x1b0)]+'\x27'),_0x214de9[_0xd3aa6b(0x167)]++;else _0x3bbd14['action']===_0xd3aa6b(0x1d4)&&(_0x4493ae[_0xd3aa6b(0x1aa)]?.({'type':_0xd3aa6b(0x1d7),'name':_0x7cfc26[_0xd3aa6b(0x199)][_0xd3aa6b(0x1b0)]}),_0x4493ae[_0xd3aa6b(0x1e2)]?.(_0xd3aa6b(0x15d)+_0x7cfc26[_0xd3aa6b(0x199)]['name']+'\x27'),_0x214de9[_0xd3aa6b(0x1d4)]++);return{'action':_0x3bbd14['action'],'name':_0x7cfc26['yamlConfig'][_0xd3aa6b(0x1b0)],'journeyId':_0x3bbd14[_0xd3aa6b(0x161)]};}catch(_0x3ed8f5){const _0x1814b6=isHttp400Error(_0x3ed8f5),_0xa545b=_0x1814b6?ErrorCode[_0xd3aa6b(0x16d)]:ErrorCode[_0xd3aa6b(0x13e)],_0x6777c7=getErrorMessage(_0x3ed8f5);throw new SDKError(_0xa545b,_0xd3aa6b(0x1f6)+(_0x7cfc26[_0xd3aa6b(0x185)]?_0xd3aa6b(0x146):_0xd3aa6b(0x181))+_0xd3aa6b(0x17f)+_0x7cfc26['absolutePath']+_0xd3aa6b(0x190)+_0x6777c7,_0x3ed8f5);}}));_0x214de9[_0x508822(0x154)][_0x508822(0x17d)](..._0x14d143);}return _0x214de9;}async function matchExistingJourneySegments(_0x22f461,_0x34c071,_0x44f985,_0x19481c,_0x42ad69){const _0x26ef74=a152_0x25b4a3;if(!_0x34c071[_0x26ef74(0x16f)]||!_0x34c071['yamlConfig'][_0x26ef74(0x1e4)])return;const _0x29ef8c=new Map(),_0x464682=new Set();for(const _0x2287b7 of Object['keys'](_0x34c071[_0x26ef74(0x199)][_0x26ef74(0x1e4)])){const _0x25cec7=generateDeterministicJourneySegmentName(_0x34c071[_0x26ef74(0x199)][_0x26ef74(0x1b0)],_0x2287b7);_0x29ef8c[_0x26ef74(0x168)](_0x25cec7,_0x2287b7),_0x464682[_0x26ef74(0x1c5)](_0x2287b7);}const _0x5a2cb2=[],_0xab44d5=collectSegmentIdsFromJourneyApi(_0x34c071[_0x26ef74(0x16f)]);for(const _0x3e03fd of _0xab44d5){const _0x88b976=await fetchSegment(_0x22f461,_0x44f985,_0x3e03fd,_0x19481c);if(!_0x88b976?.[_0x26ef74(0x1b0)])continue;const _0x531369=_0x29ef8c[_0x26ef74(0x151)](_0x88b976['name']);_0x531369?(_0x42ad69[_0x26ef74(0x168)](_0x531369,_0x3e03fd),_0x464682['delete'](_0x531369)):_0x5a2cb2[_0x26ef74(0x17d)]({'id':_0x3e03fd,'seg':_0x88b976});}if(_0x464682['size']>0x0&&_0x5a2cb2[_0x26ef74(0x1d0)]>0x0){const {localExpandedRuleToNames:_0x3e8070}=buildLocalExpandedRuleMappings(_0x34c071[_0x26ef74(0x199)]),_0xd5ad3b=new Map();for(const {id:_0x309217,seg:_0x10d973}of _0x5a2cb2){if(_0x10d973[_0x26ef74(0x162)]){const _0x1b81b2=apiRuleToYaml(_0x10d973[_0x26ef74(0x162)]);_0xd5ad3b[_0x26ef74(0x168)](_0x309217,_0x1b81b2);}}for(const {id:_0x4fd53e,seg:_0xa4285}of _0x5a2cb2){if(!_0xa4285[_0x26ef74(0x162)])continue;const _0x33c1e4=_0xd5ad3b[_0x26ef74(0x151)](_0x4fd53e);if(!_0x33c1e4)continue;const _0x1e29cd=serializeExpandedRule(_0x33c1e4,_0xd5ad3b),_0x3515e3=_0x3e8070['get'](_0x1e29cd);if(_0x3515e3){const _0x28e6b8=_0x3515e3[_0x26ef74(0x1f2)](_0x61d7c6=>_0x464682[_0x26ef74(0x12f)](_0x61d7c6));_0x28e6b8&&(_0x42ad69[_0x26ef74(0x168)](_0x28e6b8,_0x4fd53e),_0x464682[_0x26ef74(0x12d)](_0x28e6b8),logger[_0x26ef74(0x1cc)](_0x26ef74(0x15e)+_0xa4285[_0x26ef74(0x1b0)]+_0x26ef74(0x126)+_0x28e6b8+_0x26ef74(0x1c7)));}}}}async function executeSingleJourneyPush(_0x2e54dd,_0x2d1040,_0x1ddf13,_0x231e3d,_0x2daaf3,_0x380f7e){const _0x1951b2=a152_0x25b4a3,{journeyDefToRequest:_0x1aa36d,activationDefToCreateRequest:_0x22549b,yamlRuleToApi:_0x34dbde,validateSegmentRule:_0x3c9b86}=_0x380f7e,_0x11c96e=new Map(),_0x2b386c=new Map();recoverSegmentIdsFromPushRecovery(_0x2d1040,_0x11c96e,_0x1ddf13['segmentNameToId']);const _0x2a879b=new Map(),_0x25e77d=new Map(),_0x23d12c=new Map();let _0x29e602;const _0x22aa48=async()=>{const _0x1ce5db=a152_0x3f4b;if(_0x29e602)return;_0x29e602=new Map();if(!_0x2d1040['existingJourney'])return;const _0x2fe54c=await _0x2e54dd[_0x1ce5db(0x174)][_0x1ce5db(0x171)](_0x2d1040[_0x1ce5db(0x16f)]['id']);for(const _0xc5c18e of _0x2fe54c){const _0x2a15b2=journeyActivationStepToYaml(_0xc5c18e,_0x1ddf13[_0x1ce5db(0x1b6)],_0x1ddf13[_0x1ce5db(0x186)]),_0xdcf943=activationSignature(_0x2a15b2);!_0x29e602[_0x1ce5db(0x12f)](_0xdcf943)&&_0x29e602['set'](_0xdcf943,_0xc5c18e['id']),_0x2a15b2[_0x1ce5db(0x1b0)]&&_0x2b386c[_0x1ce5db(0x168)](_0x2a15b2['name'],_0xc5c18e['id']);}};await matchExistingJourneySegments(_0x2e54dd,_0x2d1040,_0x231e3d['parentId'],_0x1ddf13[_0x1951b2(0x200)],_0x1ddf13[_0x1951b2(0x14b)]);const _0x1139f3={'resolveSegmentId':async _0x1937c6=>{const _0x1be4e2=_0x1951b2,_0x75e896=_0x1ddf13[_0x1be4e2(0x14b)]['get'](_0x1937c6);if(!_0x75e896)throw new SDKError(ErrorCode[_0x1be4e2(0x117)],_0x1be4e2(0x1ee)+_0x1937c6+_0x1be4e2(0x1ec)+_0x2d1040['yamlConfig']['name']+')');return _0x75e896;},'resolveEmbeddedSegmentId':async(_0x1d618a,_0xc9ee75)=>{const _0x53c9cb=_0x1951b2,_0x4e5a96=_0x1ddf13[_0x53c9cb(0x14b)][_0x53c9cb(0x151)](_0x1d618a);if(_0x4e5a96)return _0x4e5a96;const _0x5472e1=_0x1ddf13[_0x53c9cb(0x200)][_0x53c9cb(0x1f2)](_0x352fb1=>_0x352fb1[_0x53c9cb(0x1b0)]===_0x1d618a);if(_0x5472e1)return _0x1ddf13['segmentNameToId'][_0x53c9cb(0x168)](_0x1d618a,_0x5472e1['id']),_0x5472e1['id'];if(_0x2d1040[_0x53c9cb(0x185)]){const {stageName:_0x440e06,criteriaName:_0xe53756}=findSegmentCriteriaLocation(_0x2d1040[_0x53c9cb(0x199)],_0x1d618a);return _0x3c9b86(_0x1d618a,_0xc9ee75[_0x53c9cb(0x162)]),_0x25e77d[_0x53c9cb(0x168)](_0x1d618a,{'definition':_0xc9ee75,'stageName':_0x440e06,'criteriaName':_0xe53756}),createPendingSegmentId(_0x1d618a);}const _0x4d2ac7=_0x2d1040[_0x53c9cb(0x16f)]?.['id'];if(!_0x4d2ac7)throw new SDKError(ErrorCode['INTERNAL'],_0x53c9cb(0x11a));const _0x25f007=_0x2a879b[_0x53c9cb(0x151)](_0x1d618a);if(_0x25f007)return _0x25f007;const _0x3b5a27=((async()=>{const _0x1f85b6=_0x53c9cb;_0x3c9b86(_0x1d618a,_0xc9ee75['rule']);const _0x3c6d56=generateDeterministicJourneySegmentName(_0x2d1040['yamlConfig']['name'],_0x1d618a),_0x4e20a3=_0x1ddf13[_0x1f85b6(0x200)][_0x1f85b6(0x1f2)](_0x43a3a9=>_0x43a3a9[_0x1f85b6(0x1b0)]===_0x3c6d56),_0x2e0d50=createSegmentIdResolver(_0x1ddf13[_0x1f85b6(0x14b)],_0x1d618a),_0x10e695=await resolveRuleSegmentIds(_0xc9ee75[_0x1f85b6(0x162)],_0x2e0d50);let _0x25d0e8;return _0x4e20a3?(await _0x2e54dd[_0x1f85b6(0x1c4)][_0x1f85b6(0x1ef)](_0x231e3d[_0x1f85b6(0x145)],_0x4e20a3['id'],{'description':_0xc9ee75[_0x1f85b6(0x1b9)]||'Entry\x20criteria:\x20'+_0x1d618a,'rule':_0x34dbde(_0x10e695),'countPopulation':!![]}),_0x25d0e8=_0x4e20a3['id'],saveSegmentToPushRecovery(_0x2d1040[_0x1f85b6(0x15c)],_0x2d1040[_0x1f85b6(0x199)]['name'],_0x1d618a,{'segmentId':_0x25d0e8,'uniqueServerName':_0x3c6d56,'createdAt':new Date()[_0x1f85b6(0x173)]()})):_0x25d0e8=await createOrRecoverEmbeddedSegment(_0x2e54dd,_0x2d1040,{'localName':_0x1d618a,'uniqueSegmentName':_0x3c6d56,'description':_0xc9ee75[_0x1f85b6(0x1b9)]||_0x1f85b6(0x13a)+_0x1d618a,'journeyId':_0x4d2ac7,'resolvedRule':_0x10e695,'parentId':_0x231e3d['parentId'],'folderId':_0x231e3d[_0x1f85b6(0x1b1)]||''},_0x34dbde),_0x1ddf13[_0x1f85b6(0x14b)][_0x1f85b6(0x168)](_0x1d618a,_0x25d0e8),_0x11c96e['set'](_0x1d618a,_0x25d0e8),_0x25d0e8;})());_0x2a879b[_0x53c9cb(0x168)](_0x1d618a,_0x3b5a27);try{return await _0x3b5a27;}finally{_0x2a879b[_0x53c9cb(0x12d)](_0x1d618a);}},'resolveActivationId':async _0x4b27a6=>{const _0x279bb1=_0x1951b2,_0x5f491e=_0x2b386c[_0x279bb1(0x151)](_0x4b27a6);if(_0x5f491e)return _0x5f491e;if(_0x2d1040['existingJourney']){await _0x22aa48();const _0x10e727=_0x2b386c[_0x279bb1(0x151)](_0x4b27a6);if(_0x10e727)return _0x10e727;}throw new SDKError(ErrorCode[_0x279bb1(0x1ba)],_0x279bb1(0x177)+_0x4b27a6+_0x279bb1(0x1ec)+_0x2d1040[_0x279bb1(0x199)][_0x279bb1(0x1b0)]+_0x279bb1(0x19e)+_0x279bb1(0x134));},'resolveEmbeddedActivationId':async(_0x428735,_0x10c073)=>{const _0x3589ce=_0x1951b2,_0x366c78=_0x2b386c[_0x3589ce(0x151)](_0x428735);if(_0x366c78)return _0x366c78;if(_0x2d1040['isNew'])return _0x23d12c[_0x3589ce(0x168)](_0x428735,_0x10c073),createPendingActivationId(_0x428735);if(_0x2d1040['existingJourney']){await _0x22aa48();const _0x562135=_0x2b386c[_0x3589ce(0x151)](_0x10c073['name']);if(_0x562135)return _0x2b386c[_0x3589ce(0x168)](_0x428735,_0x562135),_0x562135;const _0x789906=activationSignature(_0x10c073),_0x39a590=_0x29e602?.[_0x3589ce(0x151)](_0x789906);if(_0x39a590)return _0x2b386c[_0x3589ce(0x168)](_0x428735,_0x39a590),_0x39a590;const _0x485fae=await _0x22549b(_0x10c073,_0x1ddf13[_0x3589ce(0x1dd)]),_0x16b9a3={..._0x485fae,..._0x10c073['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x10c073['run_after_journey_refresh']}},_0x3b70c8=await _0x2e54dd[_0x3589ce(0x174)][_0x3589ce(0x189)](_0x2d1040[_0x3589ce(0x16f)]['id'],_0x16b9a3);return _0x2b386c[_0x3589ce(0x168)](_0x428735,_0x3b70c8['id']),_0x3b70c8['id'];}throw new SDKError(ErrorCode[_0x3589ce(0x159)],_0x3589ce(0x1bd));},'resolveJourneyId':async _0x57c502=>{const _0x549945=_0x1951b2;try{return await _0x2e54dd[_0x549945(0x174)][_0x549945(0x194)](_0x231e3d['parentId'],_0x57c502);}catch(_0x4bcebe){throw new SDKError(ErrorCode['NOT_FOUND'],'Journey\x20\x27'+_0x57c502+_0x549945(0x1ae)+_0x2d1040[_0x549945(0x199)]['name']+'\x27)',_0x4bcebe);}},'resolveStageId':async(_0x4078cc,_0x5f23a6)=>{const _0x5189d7=_0x1951b2,_0x30083a=await _0x2e54dd[_0x5189d7(0x174)][_0x5189d7(0x1e3)](_0x4078cc),_0x2a7266=_0x30083a[_0x5189d7(0x11b)][_0x5189d7(0x137)]['find'](_0x799f7f=>_0x799f7f['name'][_0x5189d7(0x196)]()===_0x5f23a6[_0x5189d7(0x196)]());if(!_0x2a7266?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],'Stage\x20\x27'+_0x5f23a6+_0x5189d7(0x17a)+(_0x30083a[_0x5189d7(0x11b)][_0x5189d7(0x19b)]||_0x30083a[_0x5189d7(0x11b)]['name'])+'\x27');return _0x2a7266['id'];}},_0x34e933=await _0x1aa36d(_0x2d1040[_0x1951b2(0x199)],_0x231e3d[_0x1951b2(0x145)],_0x1139f3),_0x467c20=_0x231e3d[_0x1951b2(0x164)]||_0x231e3d[_0x1951b2(0x1b1)];_0x467c20&&(_0x34e933[_0x1951b2(0x17b)]={'parentFolder':{'data':{'id':_0x467c20,'type':_0x1951b2(0x192)}}});if(_0x2d1040[_0x1951b2(0x185)]){if(_0x25e77d['size']>0x0||_0x23d12c[_0x1951b2(0x1c8)]>0x0)return await executeThreeStepJourneyCreate(_0x2e54dd,_0x2d1040,_0x34e933,{'pendingEmbeddedSegments':_0x25e77d,'pendingEmbeddedActivations':_0x23d12c,'embeddedSegmentNameToId':_0x11c96e,'journeyActivationNameToId':_0x2b386c},{..._0x231e3d,'effectiveFolderId':_0x467c20},_0x1ddf13,_0x2daaf3,_0x380f7e);else{ensureJourneyDefaults(_0x34e933[_0x1951b2(0x11b)]);const _0x1603fa=await _0x2e54dd[_0x1951b2(0x174)][_0x1951b2(0x146)](_0x34e933);return deletePushRecovery(_0x2d1040[_0x1951b2(0x15c)]),{'action':_0x1951b2(0x167),'journeyId':_0x1603fa['id'],'embeddedSegmentNameToId':_0x11c96e};}}else{if(_0x2d1040[_0x1951b2(0x1f9)]&&_0x2d1040[_0x1951b2(0x16f)]){_0x34e933['id']=_0x2d1040[_0x1951b2(0x16f)]['id'];const _0x4c5e54=_0x34e933[_0x1951b2(0x11b)];_0x2d1040[_0x1951b2(0x16f)][_0x1951b2(0x11b)]?.[_0x1951b2(0x19b)]&&(_0x4c5e54[_0x1951b2(0x19b)]=_0x2d1040['existingJourney'][_0x1951b2(0x11b)][_0x1951b2(0x19b)]);const _0x3c090c=_0x2d1040[_0x1951b2(0x16f)][_0x1951b2(0x11b)]?.['journeyStages'];return _0x3c090c&&_0x34e933[_0x1951b2(0x11b)][_0x1951b2(0x137)]&&injectExistingStageIds(_0x34e933['attributes'][_0x1951b2(0x137)],_0x3c090c),ensureJourneyDefaults(_0x4c5e54),await _0x2e54dd[_0x1951b2(0x174)]['update'](_0x2d1040[_0x1951b2(0x16f)]['id'],_0x34e933),deletePushRecovery(_0x2d1040[_0x1951b2(0x15c)]),{'action':'updated','journeyId':_0x2d1040[_0x1951b2(0x16f)]['id'],'embeddedSegmentNameToId':_0x11c96e};}}return deletePushRecovery(_0x2d1040[_0x1951b2(0x15c)]),{'action':_0x1951b2(0x1cb),'journeyId':_0x2d1040[_0x1951b2(0x16f)]?.['id'],'embeddedSegmentNameToId':_0x11c96e};}function findSegmentCriteriaLocation(_0x2549ac,_0x18bb8f){const _0x387ebe=a152_0x25b4a3,_0x3e5278=_0x2549ac[_0x387ebe(0x152)]||_0x2549ac[_0x387ebe(0x147)]?.[0x0]?.[_0x387ebe(0x152)]||[];let _0x3dac91=_0x387ebe(0x1f5),_0x1d51d2=_0x18bb8f;const _0x4c3125=_0x2549ac[_0x387ebe(0x122)]||_0x2549ac['journeys']?.[0x0]?.[_0x387ebe(0x122)];if(_0x4c3125?.['segment']===_0x18bb8f)return{'stageName':_0x387ebe(0x122),'criteriaName':_0x4c3125[_0x387ebe(0x1b0)]||_0x18bb8f};_0x153a32:for(const _0x310309 of _0x3e5278){if(_0x310309['entry_criteria']?.[_0x387ebe(0x1c4)]===_0x18bb8f){_0x3dac91=_0x310309['name'],_0x1d51d2=_0x310309['entry_criteria'][_0x387ebe(0x1b0)]||_0x18bb8f;break;}if(_0x310309[_0x387ebe(0x1d8)])for(const _0x5c3204 of _0x310309[_0x387ebe(0x1d8)]){if(_0x5c3204[_0x387ebe(0x114)]===_0x387ebe(0x1de)&&_0x5c3204[_0x387ebe(0x1a5)]?.[_0x387ebe(0x1b5)])for(const _0x174ea0 of _0x5c3204[_0x387ebe(0x1a5)]['branches']){if(_0x174ea0[_0x387ebe(0x1c4)]===_0x18bb8f){_0x3dac91=_0x310309[_0x387ebe(0x1b0)],_0x1d51d2=_0x174ea0['name']||_0x18bb8f;break _0x153a32;}}}}return{'stageName':_0x3dac91,'criteriaName':_0x1d51d2};}async function executeThreeStepJourneyCreate(_0x1b4084,_0x59e436,_0x697ce8,_0x345754,_0xce91c8,_0x2c3657,_0x2771ed,_0x1605f4){const _0x3f6be2=a152_0x25b4a3,{activationDefToCreateRequest:_0x311097,yamlRuleToApi:_0x8396f0}=_0x1605f4,{pendingEmbeddedSegments:_0xaccfa2,pendingEmbeddedActivations:_0x31f53f,embeddedSegmentNameToId:_0x1ac95f}=_0x345754,_0x8f56f1=JSON[_0x3f6be2(0x1a6)](JSON['stringify'](_0x697ce8));ensureJourneyDefaults(_0x8f56f1['attributes']),stripPendingIds(_0x8f56f1);const _0x45be82=await _0x1b4084[_0x3f6be2(0x174)][_0x3f6be2(0x146)](_0x8f56f1),_0x3c4af5=_0x45be82['id'],_0x53342a=new Map();for(const _0xc0d8f4 of _0x45be82[_0x3f6be2(0x11b)][_0x3f6be2(0x137)]){_0x53342a[_0x3f6be2(0x168)](_0xc0d8f4[_0x3f6be2(0x1b0)][_0x3f6be2(0x196)](),_0xc0d8f4['id']);}recoverSegmentIdsFromPushRecovery(_0x59e436,_0x1ac95f,_0x2c3657[_0x3f6be2(0x14b)]);for(const [_0x3d0184,{definition:_0x4ff48a}]of _0xaccfa2){if(_0x1ac95f[_0x3f6be2(0x12f)](_0x3d0184)){_0x2771ed['onProgress']?.({'type':_0x3f6be2(0x16a),'journeyName':_0x59e436[_0x3f6be2(0x199)][_0x3f6be2(0x1b0)],'segmentName':_0x3d0184});continue;}const _0x102df0=generateDeterministicJourneySegmentName(_0x59e436['yamlConfig']['name'],_0x3d0184);_0x2771ed[_0x3f6be2(0x1aa)]?.({'type':'embedded_segment_creating','journeyName':_0x59e436[_0x3f6be2(0x199)][_0x3f6be2(0x1b0)],'segmentName':_0x3d0184});const _0x30a41b=createSegmentIdResolver(_0x2c3657[_0x3f6be2(0x14b)],_0x3d0184),_0x1a0380=await resolveRuleSegmentIds(_0x4ff48a[_0x3f6be2(0x162)],_0x30a41b),_0x3cf726=await createOrRecoverEmbeddedSegment(_0x1b4084,_0x59e436,{'localName':_0x3d0184,'uniqueSegmentName':_0x102df0,'description':_0x4ff48a[_0x3f6be2(0x1b9)]||_0x3f6be2(0x13a)+_0x3d0184,'journeyId':_0x3c4af5,'resolvedRule':_0x1a0380,'parentId':_0xce91c8[_0x3f6be2(0x145)],'folderId':_0xce91c8['effectiveFolderId']||''},_0x8396f0);_0x1ac95f[_0x3f6be2(0x168)](_0x3d0184,_0x3cf726),_0x2c3657[_0x3f6be2(0x14b)][_0x3f6be2(0x168)](_0x3d0184,_0x3cf726),_0x2771ed[_0x3f6be2(0x1aa)]?.({'type':_0x3f6be2(0x16a),'journeyName':_0x59e436[_0x3f6be2(0x199)][_0x3f6be2(0x1b0)],'segmentName':_0x3d0184});}const _0x55e37c=new Map();for(const [_0x3cc059,_0x5831cd]of _0x31f53f){_0x2771ed['onProgress']?.({'type':'embedded_activation_creating','journeyName':_0x59e436[_0x3f6be2(0x199)][_0x3f6be2(0x1b0)],'activationName':_0x3cc059});const _0xf02cb5=await _0x311097(_0x5831cd,_0x2c3657[_0x3f6be2(0x1dd)]),_0x51dd9c={..._0xf02cb5,..._0x5831cd[_0x3f6be2(0x176)]!==undefined&&{'runAfterJourneyRefresh':_0x5831cd[_0x3f6be2(0x176)]}},_0x12ea42=await _0x1b4084['journey'][_0x3f6be2(0x189)](_0x3c4af5,_0x51dd9c);_0x55e37c[_0x3f6be2(0x168)](_0x3cc059,_0x12ea42['id']),_0x345754[_0x3f6be2(0x12e)][_0x3f6be2(0x168)](_0x3cc059,_0x12ea42['id']),_0x2771ed[_0x3f6be2(0x1aa)]?.({'type':_0x3f6be2(0x129),'journeyName':_0x59e436['yamlConfig'][_0x3f6be2(0x1b0)],'activationName':_0x3cc059});}const _0x17827f=JSON[_0x3f6be2(0x1a6)](JSON[_0x3f6be2(0x18c)](_0x697ce8));return _0x17827f['id']=_0x3c4af5,ensureJourneyDefaults(_0x17827f[_0x3f6be2(0x11b)]),resolvePendingIdsInRequest(_0x17827f,_0x697ce8,_0x53342a,_0x1ac95f,_0x55e37c,_0x2771ed),await _0x1b4084[_0x3f6be2(0x174)]['update'](_0x3c4af5,_0x17827f),deletePushRecovery(_0x59e436[_0x3f6be2(0x15c)]),{'action':'created','journeyId':_0x3c4af5,'embeddedSegmentNameToId':_0x1ac95f};}export function stripWaitStepPendingIds(_0xd1c05b){const _0x33b79e=a152_0x25b4a3,_0x11e38e=_0xd1c05b[_0x33b79e(0x143)]&&isPendingSegmentId(_0xd1c05b[_0x33b79e(0x143)]),_0x37b077=_0xd1c05b[_0x33b79e(0x112)]?.[_0x33b79e(0x1ab)](_0x4fba87=>_0x4fba87[_0x33b79e(0x153)]&&isPendingSegmentId(_0x4fba87[_0x33b79e(0x153)]));(_0x11e38e||_0x37b077)&&(_0xd1c05b['waitStepType']=_0x33b79e(0x120),_0xd1c05b[_0x33b79e(0x175)]=0x1,_0xd1c05b[_0x33b79e(0x1eb)]=_0x33b79e(0x16b),delete _0xd1c05b['conditionSegmentId'],delete _0xd1c05b[_0x33b79e(0x19d)],delete _0xd1c05b[_0x33b79e(0x1fe)],delete _0xd1c05b[_0x33b79e(0x112)]);}export function resolveWaitStepPendingIds(_0x3c0bb9,_0x4dc0f7,_0x308ccd,_0x2243d5){const _0x5e4cc5=a152_0x25b4a3;if(_0x4dc0f7[_0x5e4cc5(0x143)]&&isPendingSegmentId(_0x4dc0f7[_0x5e4cc5(0x143)])){const _0x3e9fca=_0x308ccd(_0x4dc0f7[_0x5e4cc5(0x143)],_0x5e4cc5(0x101)+_0x2243d5+'\x27\x20wait\x20condition');_0x3e9fca&&(_0x3c0bb9[_0x5e4cc5(0x110)]=_0x5e4cc5(0x127),_0x3c0bb9[_0x5e4cc5(0x143)]=_0x3e9fca,delete _0x3c0bb9['waitStep'],delete _0x3c0bb9[_0x5e4cc5(0x1eb)],_0x4dc0f7[_0x5e4cc5(0x19d)]!==undefined&&(_0x3c0bb9['conditionTimeoutDuration']=_0x4dc0f7[_0x5e4cc5(0x19d)]),_0x4dc0f7[_0x5e4cc5(0x1fe)]&&(_0x3c0bb9[_0x5e4cc5(0x1fe)]=_0x4dc0f7[_0x5e4cc5(0x1fe)]));}if(_0x4dc0f7[_0x5e4cc5(0x112)]){const _0x3acf4e=_0x4dc0f7[_0x5e4cc5(0x112)][_0x5e4cc5(0x1ab)](_0x4de8b7=>_0x4de8b7['segmentId']&&isPendingSegmentId(_0x4de8b7[_0x5e4cc5(0x153)]));if(_0x3acf4e){const _0xc287d6=_0x4dc0f7['conditions'][_0x5e4cc5(0x1e1)](_0x35ec12=>{const _0xd7f0b6=_0x5e4cc5;if(_0x35ec12[_0xd7f0b6(0x153)]&&isPendingSegmentId(_0x35ec12[_0xd7f0b6(0x153)])){const _0x27d320=_0x308ccd(_0x35ec12[_0xd7f0b6(0x153)],'stage\x20\x27'+_0x2243d5+'\x27\x20wait\x20condition');return{..._0x35ec12,'segmentId':_0x27d320||_0x35ec12['segmentId']};}return{..._0x35ec12};});_0x3c0bb9[_0x5e4cc5(0x110)]=_0x5e4cc5(0x127),_0x3c0bb9[_0x5e4cc5(0x112)]=_0xc287d6,delete _0x3c0bb9[_0x5e4cc5(0x175)],delete _0x3c0bb9['waitStepUnit'],delete _0x3c0bb9[_0x5e4cc5(0x143)],delete _0x3c0bb9['conditionTimeoutDuration'],delete _0x3c0bb9[_0x5e4cc5(0x1fe)];}}}function stripPendingIds(_0x5bc852){const _0x53d822=a152_0x25b4a3;_0x5bc852[_0x53d822(0x11b)][_0x53d822(0x122)]?.['segmentId']&&isPendingSegmentId(_0x5bc852['attributes'][_0x53d822(0x122)][_0x53d822(0x153)])&&delete _0x5bc852[_0x53d822(0x11b)][_0x53d822(0x122)];for(const _0xf436d4 of _0x5bc852[_0x53d822(0x11b)]['journeyStages']||[]){_0xf436d4[_0x53d822(0x10e)]?.['segmentId']&&isPendingSegmentId(_0xf436d4[_0x53d822(0x10e)]['segmentId'])&&delete _0xf436d4[_0x53d822(0x10e)];_0xf436d4[_0x53d822(0x1cf)]?.[_0x53d822(0x153)]&&isPendingSegmentId(_0xf436d4[_0x53d822(0x1cf)][_0x53d822(0x153)])&&delete _0xf436d4[_0x53d822(0x1cf)];_0xf436d4[_0x53d822(0x115)]&&(_0xf436d4[_0x53d822(0x115)]=_0xf436d4[_0x53d822(0x115)][_0x53d822(0x103)](_0x10547c=>!_0x10547c[_0x53d822(0x153)]||!isPendingSegmentId(_0x10547c['segmentId'])));if(_0xf436d4[_0x53d822(0x1d8)])for(const _0x30940d of Object['keys'](_0xf436d4['steps'])){const _0x539127=_0xf436d4['steps'][_0x30940d];_0x539127['type']===_0x53d822(0x191)&&_0x539127[_0x53d822(0x201)]&&isPendingActivationId(_0x539127[_0x53d822(0x201)])&&(_0x539127[_0x53d822(0x201)]='');if(_0x539127[_0x53d822(0x114)]==='DecisionPoint'&&_0x539127[_0x53d822(0x1b5)])for(const _0x5bd0f2 of _0x539127['branches']){_0x5bd0f2[_0x53d822(0x153)]&&isPendingSegmentId(_0x5bd0f2[_0x53d822(0x153)])&&(_0x5bd0f2[_0x53d822(0x153)]='');}_0x539127['type']==='WaitStep'&&stripWaitStepPendingIds(_0x539127);}}}function resolvePendingIdsInRequest(_0x41ce9c,_0x2a8d15,_0x2fbbc7,_0x77f9a6,_0x4432f3,_0x4a4735){const _0x3bd6c4=a152_0x25b4a3,_0x9fc26c=(_0x3d1cc8,_0x4a451d)=>{const _0x38d0d5=a152_0x3f4b;if(!isPendingSegmentId(_0x3d1cc8))return _0x3d1cc8;const _0x2d3eb6=extractPendingSegmentName(_0x3d1cc8),_0xc5db49=_0x77f9a6[_0x38d0d5(0x151)](_0x2d3eb6);return!_0xc5db49&&_0x4a4735[_0x38d0d5(0x10d)]?.(_0x38d0d5(0x195)+_0x2d3eb6+_0x38d0d5(0x1fb)+_0x4a451d),_0xc5db49;};if(_0x41ce9c[_0x3bd6c4(0x11b)][_0x3bd6c4(0x122)]?.[_0x3bd6c4(0x153)]&&isPendingSegmentId(_0x41ce9c[_0x3bd6c4(0x11b)][_0x3bd6c4(0x122)][_0x3bd6c4(0x153)])){const _0x26f5da=_0x9fc26c(_0x41ce9c['attributes'][_0x3bd6c4(0x122)][_0x3bd6c4(0x153)],_0x3bd6c4(0x16e));_0x26f5da&&(_0x41ce9c['attributes'][_0x3bd6c4(0x122)][_0x3bd6c4(0x153)]=_0x26f5da);}for(const _0x2d6f18 of _0x41ce9c[_0x3bd6c4(0x11b)][_0x3bd6c4(0x137)]||[]){const _0x5e558e=_0x2fbbc7[_0x3bd6c4(0x151)](_0x2d6f18[_0x3bd6c4(0x1b0)][_0x3bd6c4(0x196)]());_0x5e558e&&(_0x2d6f18['id']=_0x5e558e);if(_0x2d6f18[_0x3bd6c4(0x10e)]?.['segmentId']&&isPendingSegmentId(_0x2d6f18[_0x3bd6c4(0x10e)][_0x3bd6c4(0x153)])){const _0x439656=_0x9fc26c(_0x2d6f18[_0x3bd6c4(0x10e)][_0x3bd6c4(0x153)],_0x3bd6c4(0x101)+_0x2d6f18['name']+_0x3bd6c4(0xff));_0x439656&&(_0x2d6f18[_0x3bd6c4(0x10e)][_0x3bd6c4(0x153)]=_0x439656);}if(_0x2d6f18[_0x3bd6c4(0x115)])for(const _0x19c1f3 of _0x2d6f18['exitCriterias']){if(_0x19c1f3[_0x3bd6c4(0x153)]&&isPendingSegmentId(_0x19c1f3[_0x3bd6c4(0x153)])){const _0x331d7d=_0x9fc26c(_0x19c1f3[_0x3bd6c4(0x153)],'stage\x20\x27'+_0x2d6f18[_0x3bd6c4(0x1b0)]+_0x3bd6c4(0x119));_0x331d7d&&(_0x19c1f3[_0x3bd6c4(0x153)]=_0x331d7d);}}if(_0x2d6f18[_0x3bd6c4(0x1cf)]?.[_0x3bd6c4(0x153)]&&isPendingSegmentId(_0x2d6f18['milestone'][_0x3bd6c4(0x153)])){const _0x238160=_0x9fc26c(_0x2d6f18['milestone'][_0x3bd6c4(0x153)],_0x3bd6c4(0x101)+_0x2d6f18['name']+'\x27\x20milestone');_0x238160&&(_0x2d6f18[_0x3bd6c4(0x1cf)]['segmentId']=_0x238160);}if(_0x2d6f18[_0x3bd6c4(0x1d8)]){const _0x17ab4d=_0x480bee=>_0x2a8d15[_0x3bd6c4(0x11b)]['journeyStages']?.[_0x3bd6c4(0x1f2)](_0x355802=>_0x355802[_0x3bd6c4(0x1b0)][_0x3bd6c4(0x196)]()===_0x2d6f18[_0x3bd6c4(0x1b0)][_0x3bd6c4(0x196)]())?.[_0x3bd6c4(0x1d8)]?.[_0x480bee];for(const _0x5a0771 of Object['keys'](_0x2d6f18[_0x3bd6c4(0x1d8)])){const _0x1641de=_0x2d6f18[_0x3bd6c4(0x1d8)][_0x5a0771],_0x59dec6=_0x17ab4d(_0x5a0771);if(_0x1641de[_0x3bd6c4(0x114)]===_0x3bd6c4(0x191)&&_0x1641de[_0x3bd6c4(0x201)]&&(isPendingActivationId(_0x1641de[_0x3bd6c4(0x201)])||_0x1641de[_0x3bd6c4(0x201)]==='')){if(_0x59dec6?.[_0x3bd6c4(0x201)]&&isPendingActivationId(_0x59dec6[_0x3bd6c4(0x201)])){const _0x7ddf67=extractPendingActivationName(_0x59dec6[_0x3bd6c4(0x201)]),_0x7c538e=_0x4432f3[_0x3bd6c4(0x151)](_0x7ddf67);_0x7c538e&&(_0x1641de[_0x3bd6c4(0x201)]=_0x7c538e);}}if(_0x1641de['type']===_0x3bd6c4(0x19f)&&_0x1641de[_0x3bd6c4(0x1b5)]&&_0x59dec6?.['branches'])for(let _0x4518b3=0x0;_0x4518b3<_0x1641de[_0x3bd6c4(0x1b5)]['length'];_0x4518b3++){const _0x344851=_0x1641de[_0x3bd6c4(0x1b5)][_0x4518b3],_0x100e85=_0x59dec6['branches'][_0x4518b3];if(_0x100e85?.['segmentId']&&isPendingSegmentId(_0x100e85['segmentId'])){const _0x10d266=_0x9fc26c(_0x100e85[_0x3bd6c4(0x153)],_0x3bd6c4(0x101)+_0x2d6f18['name']+_0x3bd6c4(0x182)+(_0x344851[_0x3bd6c4(0x1b0)]||_0x4518b3)+'\x27');_0x10d266&&(_0x344851[_0x3bd6c4(0x153)]=_0x10d266);}}_0x1641de[_0x3bd6c4(0x114)]===_0x3bd6c4(0x136)&&_0x59dec6?.[_0x3bd6c4(0x114)]===_0x3bd6c4(0x136)&&resolveWaitStepPendingIds(_0x1641de,_0x59dec6,_0x9fc26c,_0x2d6f18[_0x3bd6c4(0x1b0)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1272da,_0x23331b){const _0x4a37fc=a153_0x5191,_0x37b281=_0x1272da();while(!![]){try{const _0x5ce36d=-parseInt(_0x4a37fc(0x110))/0x1+parseInt(_0x4a37fc(0x108))/0x2+-parseInt(_0x4a37fc(0x10e))/0x3+parseInt(_0x4a37fc(0x10d))/0x4*(-parseInt(_0x4a37fc(0x112))/0x5)+parseInt(_0x4a37fc(0x10f))/0x6*(-parseInt(_0x4a37fc(0x109))/0x7)+parseInt(_0x4a37fc(0x111))/0x8+parseInt(_0x4a37fc(0x106))/0x9;if(_0x5ce36d===_0x23331b)break;else _0x37b281['push'](_0x37b281['shift']());}catch(_0x152a49){_0x37b281['push'](_0x37b281['shift']());}}}(a153_0x9cc9,0x25aef));export function buildFolderIdToPathMap(_0x358ae7){const _0x3f29f0=a153_0x5191,_0x52d320=new Map(),_0x17cb27=new Map();for(const _0x582d45 of _0x358ae7){_0x17cb27[_0x3f29f0(0x105)](_0x582d45['id'],_0x582d45);}const _0x2ee9f8=new Set();for(const _0x51ba9e of _0x358ae7){!_0x51ba9e[_0x3f29f0(0x10c)]&&_0x2ee9f8[_0x3f29f0(0x10a)](_0x51ba9e['id']);}function _0x1eb136(_0x5b477a){const _0x561041=_0x3f29f0;if(_0x52d320[_0x561041(0x10b)](_0x5b477a['id']))return _0x52d320[_0x561041(0x107)](_0x5b477a['id']);if(_0x2ee9f8[_0x561041(0x10b)](_0x5b477a['id']))return _0x52d320[_0x561041(0x105)](_0x5b477a['id'],''),'';if(_0x5b477a['parentFolderId']){const _0x37ac4b=_0x17cb27[_0x561041(0x107)](_0x5b477a[_0x561041(0x10c)]);if(_0x37ac4b){const _0x5586e3=_0x1eb136(_0x37ac4b),_0x249eac=_0x5586e3?_0x5586e3+'/'+_0x5b477a['name']:_0x5b477a[_0x561041(0x104)];return _0x52d320[_0x561041(0x105)](_0x5b477a['id'],_0x249eac),_0x249eac;}}const _0x17615b=_0x5b477a[_0x561041(0x104)];return _0x52d320[_0x561041(0x105)](_0x5b477a['id'],_0x17615b),_0x17615b;}for(const _0x4a1707 of _0x358ae7){_0x1eb136(_0x4a1707);}return _0x52d320;}function a153_0x9cc9(){const _0x38e5bf=['1994704hPmfHx','10aEWLRi','name','set','5321628oApzZz','get','8282QmsOyz','7NBslNm','add','has','parentFolderId','284360YdeunF','924921kYEBMT','560706kusKEI','146482EnMBqx'];a153_0x9cc9=function(){return _0x38e5bf;};return a153_0x9cc9();}function a153_0x5191(_0x18b614,_0x8501f6){_0x18b614=_0x18b614-0x104;const _0x9cc97b=a153_0x9cc9();let _0x519101=_0x9cc97b[_0x18b614];return _0x519101;}export function buildFolderPathToIdMap(_0x2a31f8){const _0x5cf6b2=a153_0x5191,_0x4ed761=new Map(),_0x348e82=new Map();for(const _0x2ed17f of _0x2a31f8){_0x348e82[_0x5cf6b2(0x105)](_0x2ed17f['id'],_0x2ed17f);}const _0x153b96=new Set();for(const _0x5663b9 of _0x2a31f8){!_0x5663b9[_0x5cf6b2(0x10c)]&&_0x153b96[_0x5cf6b2(0x10a)](_0x5663b9['id']);}function _0x479b9f(_0x1893a9){const _0x4c6914=_0x5cf6b2;if(_0x153b96[_0x4c6914(0x10b)](_0x1893a9['id']))return'';if(_0x1893a9[_0x4c6914(0x10c)]){const _0x584703=_0x348e82[_0x4c6914(0x107)](_0x1893a9[_0x4c6914(0x10c)]);if(_0x584703){const _0x31d653=_0x479b9f(_0x584703);return _0x31d653?_0x31d653+'/'+_0x1893a9['name']:_0x1893a9[_0x4c6914(0x104)];}}return _0x1893a9[_0x4c6914(0x104)];}for(const _0x3fc7ef of _0x2a31f8){const _0x5d55ff=_0x479b9f(_0x3fc7ef);_0x4ed761['set'](_0x5d55ff,_0x3fc7ef['id']);}return _0x4ed761;}export function buildFolderMaps(_0x5245e6){const _0x319a5a=a153_0x5191,_0x52192d=buildFolderIdToPathMap(_0x5245e6),_0x2dbc4f=new Map();for(const [_0x3c54bf,_0x2c8fcd]of _0x52192d){_0x2dbc4f[_0x319a5a(0x105)](_0x2c8fcd,_0x3c54bf);}return{'idToPath':_0x52192d,'pathToId':_0x2dbc4f};}export function getFolderPath(_0x43d6a8,_0x41eacf){const _0x1618dc=a153_0x5191;if(!_0x43d6a8)return'';return _0x41eacf[_0x1618dc(0x107)](_0x43d6a8)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3a6c1f,_0x34bf65){const _0xa320e7=a154_0x46ce,_0x54157b=_0x3a6c1f();while(!![]){try{const _0x204da6=-parseInt(_0xa320e7(0xef))/0x1*(parseInt(_0xa320e7(0xf1))/0x2)+parseInt(_0xa320e7(0x111))/0x3*(-parseInt(_0xa320e7(0x110))/0x4)+parseInt(_0xa320e7(0x113))/0x5+parseInt(_0xa320e7(0xf4))/0x6+parseInt(_0xa320e7(0xfa))/0x7+parseInt(_0xa320e7(0xec))/0x8*(parseInt(_0xa320e7(0x10c))/0x9)+parseInt(_0xa320e7(0xf8))/0xa;if(_0x204da6===_0x34bf65)break;else _0x54157b['push'](_0x54157b['shift']());}catch(_0x55ce75){_0x54157b['push'](_0x54157b['shift']());}}}(a154_0x2508,0xeb3a4));import a154_0x500879 from'path';import{parse as a154_0x3e1851}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x184980){const _0x5eef2a=a154_0x46ce;if(!_0x184980||_0x184980[_0x5eef2a(0x10b)]()==='')throw new Error('Path\x20cannot\x20be\x20empty');const _0x5669cc=_0x184980[_0x5eef2a(0x10b)]();if(_0x5669cc==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x184980};const _0x54b7f3=_0x5669cc['startsWith']('/')?_0x5669cc[_0x5eef2a(0xed)](0x1):_0x5669cc,_0x348982=_0x54b7f3['split']('/')['filter'](_0xa17180=>_0xa17180!=='');if(_0x348982[_0x5eef2a(0x10d)]===0x0)throw new Error(_0x5eef2a(0x107));const _0x5d85a1=_0x5669cc[_0x5eef2a(0xe8)]('/')||!isRelativePathSegment(_0x348982[0x0]);for(const _0x547a04 of _0x348982){validatePathSegment(_0x547a04);}return{'segments':_0x348982,'isAbsolute':_0x5d85a1,'raw':_0x184980};}function isRelativePathSegment(_0x8db583){return _0x8db583==='.'||_0x8db583==='..';}function validatePathSegment(_0x3e8c7c){const _0x3e0644=a154_0x46ce;if(_0x3e8c7c==='')throw new Error(_0x3e0644(0xfe));if(_0x3e8c7c==='.'||_0x3e8c7c==='..')return;if(/[\x00-\x1F\x7F]/[_0x3e0644(0xe9)](_0x3e8c7c))throw new Error(_0x3e0644(0x10e)+_0x3e8c7c);if(_0x3e8c7c!==_0x3e8c7c[_0x3e0644(0x10b)]()){}}export function validatePath(_0x235b47){const _0x2f4068=a154_0x46ce;if(_0x235b47[_0x2f4068(0x100)][_0x2f4068(0x10d)]===0x0&&!_0x235b47[_0x2f4068(0x106)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x235b47[_0x2f4068(0x106)]){if(_0x235b47[_0x2f4068(0x100)][0x0]==='..')throw new Error(_0x2f4068(0xfc));let _0x54913f=0x0;for(const _0x23f762 of _0x235b47[_0x2f4068(0x100)]){if(_0x23f762==='..'){if(_0x54913f===0x0)throw new Error(_0x2f4068(0x101));_0x54913f--;}else _0x23f762!=='.'&&_0x54913f++;}}}export function joinPaths(_0x2175ec,_0x4b7578){const _0x48ed3f=a154_0x46ce;if(!_0x2175ec||_0x2175ec==='/')return _0x4b7578;if(!_0x4b7578||_0x4b7578==='.')return _0x2175ec;if(_0x4b7578['startsWith']('/'))return _0x4b7578;const _0xeb7efe=parsePath(_0x2175ec),_0x294366=parsePath(_0x4b7578),_0x3524d0=[..._0xeb7efe[_0x48ed3f(0x100)]];for(const _0x518378 of _0x294366[_0x48ed3f(0x100)]){if(_0x518378==='.')continue;else{if(_0x518378==='..'){if(_0x3524d0[_0x48ed3f(0x10d)]===0x0)throw new Error(_0x48ed3f(0xf7));_0x3524d0[_0x48ed3f(0x108)]();}else _0x3524d0[_0x48ed3f(0xf0)](_0x518378);}}const _0x3fdc27=_0x3524d0[_0x48ed3f(0x109)]('/');return _0xeb7efe[_0x48ed3f(0x10a)][_0x48ed3f(0xe8)]('/')?'/'+_0x3fdc27:_0x3fdc27;}function a154_0x2508(){const _0x23030a=['Cannot\x20navigate\x20above\x20root','2015650klTpqS','parse','3788652uopRuk','name','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','resolve','Path\x20segment\x20cannot\x20be\x20empty','No\x20tdx.json\x20found\x20for\x20file:\x20','segments','Path\x20attempts\x20to\x20navigate\x20above\x20root','replace','segment','readFile','.yml','isAbsolute','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','pop','join','raw','trim','2551509SeYyAF','length','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','journey','1602848JZmRDr','6PCMXzT','endsWith','3510795weHMsy','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','exists','startsWith','test','parent_segment','dirname','16xAYukc','substring','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','9EPyJTj','push','197160IPczkf','relative','slice','3841044izfwWF','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','.yaml'];a154_0x2508=function(){return _0x23030a;};return a154_0x2508();}export function normalizePath(_0x209381){const _0x27e8cc=a154_0x46ce,_0x1cc703=parsePath(_0x209381),_0x46bfeb=[];for(const _0x5ec697 of _0x1cc703['segments']){if(_0x5ec697==='.')continue;else{if(_0x5ec697==='..'){if(_0x46bfeb[_0x27e8cc(0x10d)]===0x0){if(_0x1cc703[_0x27e8cc(0x106)])throw new Error(_0x27e8cc(0xf7));_0x46bfeb[_0x27e8cc(0xf0)]('..');}else _0x46bfeb[_0x46bfeb[_0x27e8cc(0x10d)]-0x1]==='..'?_0x46bfeb[_0x27e8cc(0xf0)]('..'):_0x46bfeb['pop']();}else _0x46bfeb['push'](_0x5ec697);}}if(_0x46bfeb[_0x27e8cc(0x10d)]===0x0)return _0x1cc703[_0x27e8cc(0x106)]?'/':'.';const _0xa8746a=_0x46bfeb[_0x27e8cc(0x109)]('/');return _0x1cc703['raw'][_0x27e8cc(0xe8)]('/')?'/'+_0xa8746a:_0xa8746a;}export function getParentPath(_0x160b27){const _0x6fa857=a154_0x46ce,_0x50b9cd=parsePath(_0x160b27);if(_0x50b9cd[_0x6fa857(0x100)]['length']<=0x1)return'/';const _0xb9f96e=_0x50b9cd['segments'][_0x6fa857(0xf3)](0x0,-0x1)[_0x6fa857(0x109)]('/');return _0x50b9cd[_0x6fa857(0x10a)][_0x6fa857(0xe8)]('/')?'/'+_0xb9f96e:_0xb9f96e;}export function getBaseName(_0x190c11){const _0x10b403=a154_0x46ce,_0x3a15cf=parsePath(_0x190c11);return _0x3a15cf[_0x10b403(0x100)][_0x3a15cf[_0x10b403(0x100)]['length']-0x1]||'';}export function isChildPath(_0x450d48,_0x314a6e){const _0x419fa7=a154_0x46ce,_0x18b472=parsePath(_0x450d48),_0x26b743=parsePath(_0x314a6e);if(_0x18b472[_0x419fa7(0x100)]['length']<=_0x26b743['segments'][_0x419fa7(0x10d)])return![];for(let _0x8de940=0x0;_0x8de940<_0x26b743['segments'][_0x419fa7(0x10d)];_0x8de940++){if(_0x18b472[_0x419fa7(0x100)][_0x8de940]!==_0x26b743[_0x419fa7(0x100)][_0x8de940])return![];}return!![];}export function splitPath(_0x23fcc2){const _0x422bda=a154_0x46ce,_0x74e06=parsePath(_0x23fcc2);if(_0x74e06[_0x422bda(0x100)][_0x422bda(0x10d)]===0x0)throw new Error('Cannot\x20split\x20empty\x20path');if(_0x74e06[_0x422bda(0x100)][_0x422bda(0x10d)]===0x1)return{'parent':_0x74e06[_0x422bda(0x100)][0x0]};return{'parent':_0x74e06[_0x422bda(0x100)][0x0],'child':_0x74e06[_0x422bda(0x100)]['slice'](0x1)['join']('/')};}function a154_0x46ce(_0x4ce159,_0x20e52d){_0x4ce159=_0x4ce159-0xe6;const _0x250827=a154_0x2508();let _0x46ce30=_0x250827[_0x4ce159];return _0x46ce30;}export function isYamlFilePath(_0x5af392){const _0x49d80e=a154_0x46ce;return _0x5af392[_0x49d80e(0x112)](_0x49d80e(0x105))||_0x5af392['endsWith'](_0x49d80e(0xf6));}export async function resolveYamlFilePath(_0x3351de,_0x911783=nodeFileSystem){const _0xda5cee=a154_0x46ce,_0x325fe0=a154_0x500879[_0xda5cee(0xfd)](_0x3351de);if(!await _0x911783['exists'](_0x325fe0))throw new Error('File\x20not\x20found:\x20'+_0x3351de);let _0x3ec984=a154_0x500879[_0xda5cee(0xeb)](_0x325fe0),_0x23c78e=null,_0x4b272c=null;const _0x1935f4=a154_0x500879['parse'](_0x3ec984)['root'];while(_0x3ec984!==_0x1935f4){const _0x15c5d1=a154_0x500879['join'](_0x3ec984,'tdx.json');if(await _0x911783[_0xda5cee(0xe7)](_0x15c5d1)){_0x23c78e=_0x15c5d1,_0x4b272c=_0x3ec984;break;}_0x3ec984=a154_0x500879['dirname'](_0x3ec984);}if(!_0x23c78e||!_0x4b272c)throw new Error(_0xda5cee(0xff)+_0x3351de+'\x0a'+_0xda5cee(0xe6));const _0x109299=await _0x911783['readFile'](_0x23c78e),_0xdc78b5=JSON[_0xda5cee(0xf9)](_0x109299),_0x1bb12a=_0xdc78b5[_0xda5cee(0xea)];if(!_0x1bb12a)throw new Error(_0xda5cee(0xee));const _0x13bb56=await _0x911783[_0xda5cee(0x104)](_0x325fe0),_0x44e1c7=a154_0x3e1851(_0x13bb56),_0x48e641=_0x44e1c7[_0xda5cee(0xfb)];if(!_0x48e641)throw new Error(_0xda5cee(0xf5)+_0x3351de);const _0x4bb9f8=_0x44e1c7['type']===_0xda5cee(0x10f)?_0xda5cee(0x10f):_0xda5cee(0x103),_0x59e6eb=a154_0x500879[_0xda5cee(0xf2)](_0x4b272c,_0x325fe0),_0x2f0718=a154_0x500879[_0xda5cee(0xeb)](_0x59e6eb),_0x314041=_0x2f0718==='.'?'':_0x2f0718[_0xda5cee(0x102)](/\\/g,'/'),_0x23e063=_0x314041?_0x1bb12a+'/'+_0x314041+'/'+_0x48e641:_0x1bb12a+'/'+_0x48e641;return{'parentSegment':_0x1bb12a,'segmentName':_0x48e641,'folderPath':_0x314041,'fullPath':_0x23e063,'resourceType':_0x4bb9f8,'content':_0x13bb56};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a155_0x418a(){const _0x25b82f=['450231cABXIg','Invalid\x20segment\x20reference\x20format:\x20','130670eyFiZP','25RtZFJI','369MBwUbt','120072oukxHQ','.\x20Parent\x20name\x20cannot\x20be\x20empty','indexOf','6Yggxcx','3560FEFKJe','851315KMrUXK','49796roljPZ','substring','16JRIhiS','5188084FUgacf','1603RRCpNl'];a155_0x418a=function(){return _0x25b82f;};return a155_0x418a();}(function(_0x13a67e,_0xff2411){const _0x5b6ea7=a155_0x58a8,_0x5af4fe=_0x13a67e();while(!![]){try{const _0x5c1014=parseInt(_0x5b6ea7(0x1cc))/0x1*(parseInt(_0x5b6ea7(0x1d4))/0x2)+-parseInt(_0x5b6ea7(0x1c9))/0x3*(parseInt(_0x5b6ea7(0x1c6))/0x4)+-parseInt(_0x5b6ea7(0x1d3))/0x5*(-parseInt(_0x5b6ea7(0x1d1))/0x6)+parseInt(_0x5b6ea7(0x1c8))/0x7*(parseInt(_0x5b6ea7(0x1d2))/0x8)+parseInt(_0x5b6ea7(0x1cd))/0x9*(parseInt(_0x5b6ea7(0x1cb))/0xa)+-parseInt(_0x5b6ea7(0x1c7))/0xb+-parseInt(_0x5b6ea7(0x1ce))/0xc;if(_0x5c1014===_0xff2411)break;else _0x5af4fe['push'](_0x5af4fe['shift']());}catch(_0x420790){_0x5af4fe['push'](_0x5af4fe['shift']());}}}(a155_0x418a,0x550f7));function a155_0x58a8(_0xcac66e,_0x36e1cd){_0xcac66e=_0xcac66e-0x1c6;const _0x418ac8=a155_0x418a();let _0x58a861=_0x418ac8[_0xcac66e];return _0x58a861;}export function parseSegmentRef(_0x40319c){const _0x2c8400=a155_0x58a8,_0x404efb=_0x40319c[_0x2c8400(0x1d0)]('/');if(_0x404efb===-0x1)return{'parentId':_0x40319c};if(_0x404efb===0x0)throw new Error(_0x2c8400(0x1ca)+_0x40319c+_0x2c8400(0x1cf));const _0x49188f=_0x40319c[_0x2c8400(0x1d5)](0x0,_0x404efb),_0x4fe721=_0x40319c[_0x2c8400(0x1d5)](_0x404efb+0x1);if(_0x4fe721==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x40319c+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x49188f,'childId':_0x4fe721};}
|