@treasuredata/tdx 2026.4.22 → 2026.4.23
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.d.ts +7 -0
- package/dist/proxy/passthrough-server.d.ts.map +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/passthrough-server.js.map +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/task-graph.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_0xdbe0a=a152_0x3e4e;(function(_0x501ff3,_0x401c3c){const _0x3ae729=a152_0x3e4e,_0x1d98a2=_0x501ff3();while(!![]){try{const _0x4e3827=-parseInt(_0x3ae729(0x1ca))/0x1*(parseInt(_0x3ae729(0x193))/0x2)+-parseInt(_0x3ae729(0x135))/0x3+parseInt(_0x3ae729(0x175))/0x4*(parseInt(_0x3ae729(0x139))/0x5)+parseInt(_0x3ae729(0xff))/0x6*(-parseInt(_0x3ae729(0xf9))/0x7)+-parseInt(_0x3ae729(0xe6))/0x8*(-parseInt(_0x3ae729(0x132))/0x9)+-parseInt(_0x3ae729(0x143))/0xa+-parseInt(_0x3ae729(0x165))/0xb*(-parseInt(_0x3ae729(0xc5))/0xc);if(_0x4e3827===_0x401c3c)break;else _0x1d98a2['push'](_0x1d98a2['shift']());}catch(_0xb9739d){_0x1d98a2['push'](_0x1d98a2['shift']());}}}(a152_0x46f4,0x36eb6));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_0xdbe0a(0x11f);export const PENDING_ACTIVATION_PREFIX=a152_0xdbe0a(0x19a);export function createPendingSegmentId(_0x4e856d){return''+PENDING_SEGMENT_PREFIX+_0x4e856d+'__';}export function isPendingSegmentId(_0x24e790){const _0x1ae61b=a152_0xdbe0a;return _0x24e790[_0x1ae61b(0x1cd)](PENDING_SEGMENT_PREFIX)&&!_0x24e790[_0x1ae61b(0x1cd)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x4da99e){const _0x40d261=a152_0xdbe0a;return _0x4da99e[_0x40d261(0x191)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x102c29){return''+PENDING_ACTIVATION_PREFIX+_0x102c29+'__';}export function isPendingActivationId(_0x185f67){return _0x185f67['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x57dead){const _0x2e90f0=a152_0xdbe0a;return _0x57dead[_0x2e90f0(0x191)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x5e6473,_0x22fac1){const _0x348c49=a152_0xdbe0a,_0x1d32e5=_0x5e6473+'::'+(_0x22fac1[_0x348c49(0x14e)]()||_0x348c49(0x1c4)),_0x2c1cd5=createHash(_0x348c49(0x15b))[_0x348c49(0x172)](_0x1d32e5)['digest'](_0x348c49(0x150))[_0x348c49(0xe7)](0x0,0xc);return _0x348c49(0x166)+_0x2c1cd5;}export function ensureJourneyDefaults(_0x387147){const _0x27f1a8=a152_0xdbe0a;!_0x387147[_0x27f1a8(0x1cb)]&&(_0x387147[_0x27f1a8(0x1cb)]=''),!_0x387147[_0x27f1a8(0x130)]&&(_0x387147['state']=_0x27f1a8(0x186));}export function injectExistingStageIds(_0x166727,_0x251d45){const _0x3c4f19=a152_0xdbe0a,_0xe3281c=new Map(_0x251d45[_0x3c4f19(0x114)](_0x3a94ba=>[_0x3a94ba[_0x3c4f19(0x10d)],_0x3a94ba['id']]));for(const _0x52a77e of _0x166727){if(!_0x52a77e['id']){const _0x186275=_0xe3281c[_0x3c4f19(0x14b)](_0x52a77e['name']);_0x186275&&(_0x52a77e['id']=_0x186275);}}}export function resolveTDFolderPath(_0x34e965,_0x2e5a1a,_0x59f435){if(!_0x2e5a1a)return _0x34e965;if(_0x34e965===_0x59f435||_0x34e965['startsWith'](_0x59f435+'/'))return _0x34e965;return _0x34e965?_0x59f435+'/'+_0x34e965:_0x59f435;}export function addFoldersToCreate(_0x5d1dc,_0x318186,_0x1648c2){const _0x3933a6=a152_0xdbe0a;if(!_0x5d1dc)return;if(_0x318186[_0x3933a6(0x1a3)](_0x5d1dc))return;const _0x58d441=_0x5d1dc['split']('/');let _0x36cc0f='';for(const _0x5be148 of _0x58d441){_0x36cc0f=_0x36cc0f?_0x36cc0f+'/'+_0x5be148:_0x5be148,!_0x318186[_0x3933a6(0x1a3)](_0x36cc0f)&&_0x1648c2['add'](_0x36cc0f);}}export function sortFoldersByDepth(_0x10ae1c){return[..._0x10ae1c]['sort']((_0x4db3ef,_0x3090e)=>{const _0x1ace80=a152_0x3e4e,_0x2be06e=(_0x4db3ef[_0x1ace80(0xda)](/\//g)||[])[_0x1ace80(0x10e)],_0x34988d=(_0x3090e[_0x1ace80(0xda)](/\//g)||[])[_0x1ace80(0x10e)];return _0x2be06e-_0x34988d;});}import*as a152_0x14c7b5 from'yaml';import{readFileSync}from'fs';import a152_0x543d0d from'path';import{isJourneyDef,parseYamlString as a152_0x590d85,toYamlString as a152_0x57a5e6,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(_0x32c874){const _0x5717d3=a152_0xdbe0a;if(Array[_0x5717d3(0xf3)](_0x32c874))return'['+_0x32c874[_0x5717d3(0x114)](_0x24b3f7=>stableStringify(_0x24b3f7))[_0x5717d3(0x13d)](',')+']';if(_0x32c874&&typeof _0x32c874===_0x5717d3(0x18f)){const _0x151b18=_0x32c874,_0x4db7a0=Object[_0x5717d3(0x148)](_0x151b18)[_0x5717d3(0x163)](),_0x370d47=_0x4db7a0[_0x5717d3(0x114)](_0x219bcb=>'\x22'+_0x219bcb+'\x22:'+stableStringify(_0x151b18[_0x219bcb]));return'{'+_0x370d47[_0x5717d3(0x13d)](',')+'}';}const _0x3cede3=JSON[_0x5717d3(0x10f)](_0x32c874);return _0x3cede3===undefined?'null':_0x3cede3;}function activationSignature(_0x5b1e77){const _0x103134=a152_0xdbe0a,_0x1c6675={'connection':_0x5b1e77['connection'],..._0x5b1e77[_0x103134(0x185)]!==undefined&&{'all_columns':_0x5b1e77[_0x103134(0x185)]},..._0x5b1e77[_0x103134(0x121)]!==undefined&&{'columns':_0x5b1e77[_0x103134(0x121)]},..._0x5b1e77[_0x103134(0xf8)]!==undefined&&{'behavior':_0x5b1e77[_0x103134(0xf8)]},..._0x5b1e77[_0x103134(0x131)]!==undefined&&{'schedule':_0x5b1e77[_0x103134(0x131)]},..._0x5b1e77[_0x103134(0x1b1)]!==undefined&&{'notification':_0x5b1e77['notification']},..._0x5b1e77[_0x103134(0x126)]!==undefined&&{'connector_config':_0x5b1e77[_0x103134(0x126)]},..._0x5b1e77[_0x103134(0xee)]!==undefined&&{'activation_template_id':_0x5b1e77[_0x103134(0xee)]}};return stableStringify(_0x1c6675);}async function fetchSegment(_0x51d9f0,_0x1cabe0,_0xcfa708,_0x42194d){const _0x459531=a152_0xdbe0a,_0x51e40e=_0x42194d?.[_0x459531(0x1a1)](_0x528cfb=>_0x528cfb['id']===_0xcfa708);if(_0x51e40e)return _0x51e40e;try{return await _0x51d9f0[_0x459531(0x1c4)][_0x459531(0xe9)](_0x1cabe0,_0xcfa708);}catch(_0x2251a2){logger['debug'](_0x459531(0x136)+_0xcfa708+_0x459531(0xe8)+_0x2251a2);try{return await _0x51d9f0[_0x459531(0x1c4)][_0x459531(0x1c3)](_0xcfa708);}catch(_0x595350){return logger[_0x459531(0xc8)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0xcfa708+':\x20'+_0x595350),null;}}}function recoverSegmentIdsFromPushRecovery(_0x4eb114,_0xc1610c,_0x5825f9){const _0x365438=a152_0xdbe0a,_0xced2e1=readPushRecovery(_0x4eb114[_0x365438(0xfa)]);if(_0xced2e1?.[_0x365438(0x161)]===_0x4eb114[_0x365438(0x147)][_0x365438(0x10d)])for(const [_0x3f3f1e,_0x25dc4e]of Object[_0x365438(0x188)](_0xced2e1['segments'])){const _0x487c6a=generateDeterministicJourneySegmentName(_0x4eb114[_0x365438(0x147)][_0x365438(0x10d)],_0x3f3f1e);_0x25dc4e[_0x365438(0x145)]===_0x487c6a&&(_0xc1610c['set'](_0x3f3f1e,_0x25dc4e[_0x365438(0xe5)]),_0x5825f9['set'](_0x3f3f1e,_0x25dc4e['segmentId']));}}async function createOrRecoverEmbeddedSegment(_0x3b15b2,_0x4740ba,_0x32c8bb,_0x24f5e7){const _0x425245=a152_0xdbe0a;let _0x316fde;try{_0x316fde=await _0x3b15b2['segment'][_0x425245(0x108)]({'name':_0x32c8bb[_0x425245(0x1c7)],'description':_0x32c8bb[_0x425245(0x1cb)],'journeyId':_0x32c8bb[_0x425245(0x1c0)],'rule':_0x24f5e7(_0x32c8bb[_0x425245(0x16c)],!![]),'countPopulation':!![],'parentFolderId':_0x32c8bb[_0x425245(0x14a)],'audienceId':_0x32c8bb[_0x425245(0x129)]});}catch(_0x3757db){const _0x46a73e=_0x3757db instanceof Error&&_0x3757db[_0x425245(0x11e)][_0x425245(0xd2)](_0x425245(0x1b9));if(_0x46a73e){const _0x2abb46=readPushRecovery(_0x4740ba['absolutePath']),_0x164e17=_0x2abb46?.[_0x425245(0x161)]===_0x4740ba[_0x425245(0x147)]['name']?_0x2abb46['segments'][_0x32c8bb['localName']]:undefined;if(_0x164e17?.[_0x425245(0x145)]===_0x32c8bb[_0x425245(0x1c7)])await _0x3b15b2[_0x425245(0x1c4)][_0x425245(0x128)](_0x32c8bb[_0x425245(0x129)],_0x164e17['segmentId'],{'description':_0x32c8bb[_0x425245(0x1cb)],'rule':_0x24f5e7(_0x32c8bb[_0x425245(0x16c)],!![]),'countPopulation':!![]}),_0x316fde=_0x164e17[_0x425245(0xe5)];else throw new SDKError(ErrorCode[_0x425245(0x169)],'Embedded\x20segment\x20\x27'+_0x32c8bb['localName']+_0x425245(0x153)+(_0x425245(0x178)+_0x4740ba[_0x425245(0xfa)][_0x425245(0x191)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+'and\x20the\x20server\x20segment,\x20then\x20retry.',_0x3757db);}else throw _0x3757db;}return saveSegmentToPushRecovery(_0x4740ba['absolutePath'],_0x4740ba[_0x425245(0x147)][_0x425245(0x10d)],_0x32c8bb[_0x425245(0xd0)],{'segmentId':_0x316fde,'uniqueServerName':_0x32c8bb[_0x425245(0x1c7)],'createdAt':new Date()[_0x425245(0x106)]()}),_0x316fde;}export async function prepareSegmentFiles(_0x1a0b96,_0x4a4955,_0x1047a9,_0x2187e1,_0x5b359c){const _0x2f9461=a152_0xdbe0a,{activationDefToCreateRequest:_0x3099af}=await import(_0x2f9461(0xc7)),_0x53e6b0=[],_0x4e434c=new Set();for(const {yamlConfig:_0x496de7,folderPath:_0x10e8af,sourcePath:_0x3b338a}of _0x1a0b96){const _0x50bf75=resolveTDFolderPath(_0x10e8af,_0x2187e1,_0x5b359c),_0x43f170=_0x50bf75+':'+_0x496de7[_0x2f9461(0x10d)],_0x991666=_0x4a4955[_0x2f9461(0x1b4)][_0x2f9461(0x14b)](_0x43f170),_0x577d31=_0x991666?_0x4a4955['activationsBySegmentId'][_0x2f9461(0x14b)](_0x991666['id'])||[]:[];addFoldersToCreate(_0x50bf75,_0x4a4955['folderPathToId'],_0x4e434c);const _0x200fce=calculateActivationActions(_0x496de7[_0x2f9461(0x1ac)]||[],_0x577d31,_0x4a4955[_0x2f9461(0xf4)],_0x4a4955[_0x2f9461(0x1c5)]);for(const _0x460888 of _0x200fce){(_0x460888[_0x2f9461(0x146)]===_0x2f9461(0x182)||_0x460888[_0x2f9461(0x146)]===_0x2f9461(0x172))&&_0x460888[_0x2f9461(0x177)]&&(_0x460888[_0x2f9461(0xdf)]=await _0x3099af(_0x460888[_0x2f9461(0x177)],_0x1047a9));}const _0x2e1a62=calculateSegmentDiff(_0x496de7,_0x991666,_0x577d31,_0x4a4955[_0x2f9461(0xf4)],_0x4a4955['connectionIdToNameMap']);_0x53e6b0[_0x2f9461(0x1bc)]({'relativePath':_0x496de7[_0x2f9461(0x10d)],'absolutePath':_0x3b338a,'yamlConfig':_0x496de7,'folderPath':_0x50bf75,'existingSegment':_0x991666,'existingActivations':_0x577d31,'isNew':_0x2e1a62[_0x2f9461(0x190)],'hasChanges':_0x2e1a62[_0x2f9461(0x157)],'diff':_0x2e1a62[_0x2f9461(0xd1)],'activationActions':_0x200fce});}return{'segmentFiles':_0x53e6b0,'foldersToCreate':_0x4e434c};}export async function prepareJourneyFiles(_0xd749c8,_0xdd6429,_0x125113,_0xca4489){const _0x368b59=a152_0xdbe0a,_0x36e795=[],_0x441b1=new Set();for(const {yamlConfig:_0x5570d3,folderPath:_0x2a3a63,sourcePath:_0x3da22a}of _0xd749c8){const _0x9280a=resolveTDFolderPath(_0x2a3a63,_0x125113,_0xca4489),_0x8a20d0=_0x9280a+':'+_0x5570d3[_0x368b59(0x10d)],_0x507e86=_0xdd6429[_0x368b59(0x124)][_0x368b59(0x14b)](_0x8a20d0);let _0x24635c,_0x3dcf61;if(_0x507e86&&_0x507e86[_0x368b59(0x10e)]>0x0){const _0x388724=buildLocalExpandedRuleMappings(_0x5570d3),{createYamlContext:_0x162523,prefetchJourneySegments:_0x518121}=createPushYamlContextForBundle(_0xdd6429[_0x368b59(0x1a5)],_0xdd6429[_0x368b59(0x129)],_0xdd6429['existingSegments'],_0x388724,_0xdd6429['idToEmailMap'],_0xdd6429['connectionIdToNameMap'],_0xdd6429['activationStepsById'],_0xdd6429[_0x368b59(0xd4)]);await _0x518121(_0x507e86['map'](_0x3de66a=>_0x3de66a['id']));const _0x1db438=await _0xdd6429[_0x368b59(0x1a5)][_0x368b59(0xf0)][_0x368b59(0xd7)](_0x507e86[0x0][_0x368b59(0x11b)]),_0x1836fb=hasMultipleVersions(_0x5570d3),_0xeed6a1=async _0x2571c0=>{const _0x1ffb01=_0x368b59,_0x43fca5=_0xdd6429[_0x1ffb01(0xd4)]?.[_0x1ffb01(0x14b)](_0x2571c0);if(_0x43fca5)return _0x43fca5;return _0xdd6429[_0x1ffb01(0x1c2)]({'journeyId':_0x2571c0,'journeyName':_0x5570d3['name'],'isMultiVersion':_0x507e86[_0x1ffb01(0x10e)]>0x1});};if(_0x1836fb&&_0x507e86[_0x368b59(0x10e)]>0x1){const _0x37c022=[];for(const _0x37c5ca of _0x507e86){const _0x271829=_0x37c5ca[_0x368b59(0xe3)]||0x1;_0xdd6429[_0x368b59(0x17b)]?.[_0x368b59(0x172)](_0x368b59(0x19d)+_0x5570d3[_0x368b59(0x10d)]+'\x20v'+_0x271829);const _0x58db7d=await _0xeed6a1(_0x37c5ca['id']),_0xb38da7=_0x162523(_0x37c5ca['id']),_0x490717=await journeyResponseToDef(_0x58db7d,_0xb38da7);_0x37c022[_0x368b59(0x1bc)]({'item':_0x37c5ca,'yaml':_0x490717});}const _0x36e092=buildLocalRuleToNameMappingFromJourney(_0x5570d3);_0x3dcf61=buildMergedJourneyDef(_0x37c022,_0x36e092,_0x1db438);const _0xfb7c24=Math['max'](..._0x37c022[_0x368b59(0x114)](_0xf0dc99=>_0xf0dc99[_0x368b59(0x13f)]['versionNumber']||0x0)),_0x4ca7d3=_0x507e86[_0x368b59(0x1a1)](_0x136f55=>(_0x136f55[_0x368b59(0xe3)]||0x0)===_0xfb7c24);_0x4ca7d3&&(_0xdd6429[_0x368b59(0x17b)]?.[_0x368b59(0x172)](_0x368b59(0x19d)+_0x5570d3[_0x368b59(0x10d)]+'\x20v'+_0xfb7c24),_0x24635c=await _0xeed6a1(_0x4ca7d3['id']));}else{const _0x294fef=_0x507e86[_0x507e86['length']-0x1];_0xdd6429['progress']?.['update'](_0x368b59(0x19d)+_0x5570d3['name']),_0x24635c=await _0xeed6a1(_0x294fef['id']);const _0x3418a5=_0x162523(_0x294fef['id']),_0x49a0f4=await journeyResponseToDef(_0x24635c,_0x3418a5),_0x106c53=buildLocalRuleToNameMappingFromJourney(_0x5570d3);_0x3dcf61=buildMergedJourneyDef([{'item':_0x294fef,'yaml':_0x49a0f4}],_0x106c53,_0x1db438);}}addFoldersToCreate(_0x9280a,_0xdd6429[_0x368b59(0x102)],_0x441b1);const _0x2c634d=calculateJourneyDiff(_0x5570d3,_0x3dcf61);_0x36e795[_0x368b59(0x1bc)]({'relativePath':_0x5570d3[_0x368b59(0x10d)],'absolutePath':_0x3da22a,'yamlConfig':_0x5570d3,'folderPath':_0x9280a,'existingJourney':_0x24635c,'isNew':_0x2c634d[_0x368b59(0x190)],'hasChanges':_0x2c634d[_0x368b59(0x157)],'diff':_0x2c634d[_0x368b59(0xd1)]});}return{'journeyFiles':_0x36e795,'foldersToCreate':_0x441b1};}export function calculateActivationActions(_0x7616ef,_0xcfb78e,_0x1b7270,_0x3fdcbe){const _0x54c02b=a152_0xdbe0a,_0x2f4fdf=[],_0x518ed0=new Map();for(const _0x3af808 of _0xcfb78e){_0x518ed0[_0x54c02b(0xca)](_0x3af808['name'],_0x3af808);}const _0x3dbf7f=new Map();for(const _0x1fce47 of _0x7616ef){_0x3dbf7f[_0x54c02b(0xca)](_0x1fce47[_0x54c02b(0x10d)],_0x1fce47);}for(const _0x3647f9 of _0x7616ef){const _0x401167=_0x518ed0[_0x54c02b(0x14b)](_0x3647f9[_0x54c02b(0x10d)]);if(!_0x401167)_0x2f4fdf['push']({'type':_0x54c02b(0x182),'name':_0x3647f9[_0x54c02b(0x10d)],'yamlActivation':_0x3647f9});else{const _0x272ace=activationResponseToDef(_0x401167,_0x1b7270,_0x3fdcbe),_0x3f3013=a152_0x14c7b5[_0x54c02b(0x10f)](_0x272ace),_0x260723=a152_0x14c7b5[_0x54c02b(0x10f)](_0x3647f9);_0x3f3013!==_0x260723&&_0x2f4fdf['push']({'type':_0x54c02b(0x172),'name':_0x3647f9[_0x54c02b(0x10d)],'yamlActivation':_0x3647f9,'existingActivation':_0x401167});}}for(const _0x30d138 of _0xcfb78e){!_0x3dbf7f[_0x54c02b(0x1a3)](_0x30d138[_0x54c02b(0x10d)])&&_0x2f4fdf[_0x54c02b(0x1bc)]({'type':'delete','name':_0x30d138[_0x54c02b(0x10d)],'existingActivation':_0x30d138});}return _0x2f4fdf;}function calculateYamlDiff(_0x5b6af0,_0x56dde2){if(_0x56dde2){const _0x31e9bd=generateDiff(_0x56dde2,_0x5b6af0),_0x5ed653=hasChanges(_0x31e9bd);return{'isNew':![],'hasChanges':_0x5ed653,'diff':_0x5ed653?formatDiffWithColors(_0x31e9bd):undefined};}const _0xc9b85e=generateDiff('',_0x5b6af0);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0xc9b85e)};}export function calculateSegmentDiff(_0x43fec8,_0x135496,_0x549ad1,_0x3d3027,_0x23c0f3){const _0x1680ee=segmentToYamlString(_0x43fec8),_0x20f496=_0x135496?segmentToYamlString(segmentWithActivationsToYaml(_0x135496,_0x549ad1,undefined,_0x3d3027,_0x23c0f3)):undefined;return calculateYamlDiff(_0x1680ee,_0x20f496);}export function calculateJourneyDiff(_0xbf0822,_0x2ac9e9){const _0x17de0f=normalizeJourneyDef(_0xbf0822,_0xbf0822),_0x4d376d=a152_0x57a5e6(_0x17de0f),_0x561d87=_0x2ac9e9?a152_0x57a5e6(normalizeJourneyDef(_0x2ac9e9,_0xbf0822)):undefined;return calculateYamlDiff(_0x4d376d,_0x561d87);}export function findSegmentsToDelete(_0x2ed7d7,_0x363685,_0x28f314,_0x41d7d4,_0x46d3c2){const _0x1672a7=a152_0xdbe0a,_0x131914=new Set();for(const {yamlConfig:_0x2a97ae,folderPath:_0x5ed10d}of _0x363685){_0x131914[_0x1672a7(0x168)](_0x5ed10d+':'+_0x2a97ae[_0x1672a7(0x10d)]);}return _0x2ed7d7[_0x1672a7(0xf2)](_0x34b6f4=>{const _0x2b53d3=_0x1672a7,_0x5ca7c6=_0x34b6f4[_0x2b53d3(0xf7)]?_0x28f314[_0x2b53d3(0x14b)](_0x34b6f4['segmentFolderId'][_0x2b53d3(0x1a9)]())||'':'',_0x4c47b7=_0x5ca7c6+':'+_0x34b6f4[_0x2b53d3(0x10d)];if(_0x131914['has'](_0x4c47b7))return![];if(_0x46d3c2)return _0x5ca7c6===_0x41d7d4||_0x5ca7c6[_0x2b53d3(0x1cd)](_0x41d7d4+'/');return!![];});}export function findJourneysToDelete(_0x4dd4bd,_0x487fb2,_0x1533d6,_0x2f13bb,_0x4e7dd7){const _0x6f0ffb=a152_0xdbe0a,_0x9c2011=new Set();for(const {yamlConfig:_0x58606c,folderPath:_0x458d53}of _0x487fb2){_0x9c2011[_0x6f0ffb(0x168)](_0x458d53+':'+_0x58606c[_0x6f0ffb(0x10d)]);}return _0x4dd4bd[_0x6f0ffb(0xf2)](_0x587cb3=>{const _0x23d6f6=_0x6f0ffb,_0x10e192=_0x587cb3[_0x23d6f6(0x14a)]?_0x1533d6[_0x23d6f6(0x14b)](_0x587cb3[_0x23d6f6(0x14a)])||'':'',_0x265ea1=_0x10e192+':'+_0x587cb3[_0x23d6f6(0xf5)];if(_0x9c2011[_0x23d6f6(0x1a3)](_0x265ea1))return![];if(_0x4e7dd7)return _0x10e192===_0x2f13bb||_0x10e192[_0x23d6f6(0x1cd)](_0x2f13bb+'/');return!![];});}export function buildSegmentLookupMap(_0x36e7a2,_0x566931){const _0x252858=a152_0xdbe0a,_0x2800ef=new Map();for(const _0xe76a7 of _0x36e7a2){const _0x39e8c8=_0xe76a7[_0x252858(0xf7)]?_0x566931[_0x252858(0x14b)](_0xe76a7[_0x252858(0xf7)][_0x252858(0x1a9)]())||'':'',_0x42b46a=_0x39e8c8+':'+_0xe76a7[_0x252858(0x10d)];_0x2800ef[_0x252858(0xca)](_0x42b46a,_0xe76a7);}return _0x2800ef;}export function buildSegmentNameToIdMap(_0x5bb5cb){const _0x3a684f=a152_0xdbe0a,_0x528b84=new Map();for(const _0x29ef9b of _0x5bb5cb){_0x528b84[_0x3a684f(0xca)](_0x29ef9b[_0x3a684f(0x10d)],_0x29ef9b['id']);}return _0x528b84;}function a152_0x46f4(){const _0x5595e5=['conditionSegmentId','folderId','get','NOT_FOUND','\x20journey\x20from\x20file:\x20','trim','Segment\x20not\x20found:\x20','hex','journeyActivationNameToId','logDeleted','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','Deleted\x20segment\x20\x27','reduce','WaitStep','hasChanges','verbose','SEGMENT_NOT_FOUND','withProgress','sha1','updated','with','skipSegments','\x27\x20to\x20local\x20\x27','activationContext','journeyName','Creating\x20activation\x20\x27','sort','Creating\x20folder\x20\x27','11lMWKRA','journey_entry_criteria_','relationships','add','SEGMENT_UPDATE_ERROR','run_after_journey_refresh','embedded_segment_created','resolvedRule','milestone','parentFolder','Condition','deleted','\x27\x20exit\x20criteria','update','unchanged','existingJourney','112TELYya','kind','yamlActivation','Delete\x20the\x20push\x20recovery\x20file\x20(','rootFolderId','toLowerCase','progress','segment_updated','JOURNEY_SYNTAX_ERROR','created','\x27...','rule','valid','create','parseDocument','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','all_columns','draft','Activation','entries','Updating\x20activation\x20\x27','onProgress','journey_updated','listActivations','dirname','):\x20','object','isNew','replace','deleteActivation','110qwneoS','\x27\x20milestone','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','all','data','\x20(referenced\x20in\x20journey\x20','DecisionPoint','__pending_act_','Entry\x20criteria:\x20','branches','Fetching\x20','folderPath','resolveSegment','\x20error(s)','find','segment_deleting','has','index','deps','conditionTimeoutUnit','Deleting\x20activation\x20\x27','Journey\x20\x27','toString','Stage\x20\x27','journeyActivationStepId','activations','ACTIVATION_SYNTAX_ERROR','Updated\x20segment\x20\x27','segment_created','delete','notification','createdSegmentIds','embedded_activation_created','segmentByFolderAndName','Updating\x20segment\x20\x27','\x27\x20by\x20rule\x20content','\x27\x20entry\x20criteria','INTERNAL','Name\x20has\x20already\x20been\x20taken','steps','parse','push','day','nameToType','existingSegments','journeyId','Created\x20journey\x20\x27','fetchJourney','getSegmentEntity','segment','connectionIdToNameMap','size','uniqueSegmentName','JOURNEY_UPDATE_ERROR','journey_updating','5458lsWKFk','description','\x27\x20wait\x20condition','startsWith','getJourney','existingSegment','journeys','Deleted\x20activation\x20\x27','6047172znifmm','segment_updating','./child-segment-yaml.js','debug','Created\x20folder\x20\x27','set','createFolder','Created\x20segment\x20\x27','\x27\x20not\x20found\x20in\x20journey\x20\x27','activation_updated','entryCriteria','localName','diff','includes','\x27\x20for\x20','journeyById','exitCriterias','embedded_activation_creating','getLatestJourneyId','buildUserMaps','SEGMENT_SYNTAX_ERROR','match','resolveJourneyId','parentSegmentFolder','flatMap','Failed\x20to\x20','validatedRequest','../../utils/async.js','from','getActivation','versionNumber',').\x20','segmentId','2936WIBxvd','slice',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','getSegment','\x20segment\x20from\x20file:\x20','relative','list','\x27\x20from\x20file:\x20','activation_template_id','folder_creating','journey','activationActions','filter','isArray','idToEmailMap','journeyBundleName','nameToId','segmentFolderId','behavior','8435KnPceG','absolutePath','conditions','Failed\x20to\x20resolve\x20activation\x20','journeyStages','segment_deleted','666mdkKOt','stage\x20\x27','\x0a\x20\x20','folderPathToId','max','createdSegmentId','entry_criteria','toISOString','embeddedSegmentNameToId','createJourneySegment','activation_','goal','folder_created','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','name','length','stringify','entry','segments','activation_created','errors','map','journey_creating','./journey-yaml.js','Failed\x20to\x20fetch\x20referenced\x20segment\x20','logWarning','action','conditionTimeoutDuration','journeyBundleId','\x20activation\x20\x27','waitStep','message','__pending_','ACTIVATION_UPDATE_ERROR','columns','logSuccess','journey_created','journeyBundlesByFolderAndName','split','connector_config','createSegment','updateSegmentById','parentId','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','results','utf-8','deleteSegment','existingActivation','waitStepType','state','schedule','7317gxYQtE','idToName','activation_deleting','552723PQmEnz','getSegment\x20failed\x20for\x20','Duration','activationParams','11395jdjOFn','effectiveFolderId','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','waitStepUnit','join','attributes','item','segmentNameToId','stages','Activation\x20not\x20found:\x20','229780FEvONY','embedded_segment_creating','uniqueServerName','type','yamlConfig','keys'];a152_0x46f4=function(){return _0x5595e5;};return a152_0x46f4();}export function buildJourneyBundleLookupMap(_0x2fe92f,_0x393de2){const _0x22056b=a152_0xdbe0a,_0x4c0b00=new Map();for(const _0x1d2134 of _0x2fe92f){const _0x483017=_0x1d2134[_0x22056b(0x14a)]?_0x393de2[_0x22056b(0x14b)](_0x1d2134['folderId'])||'':'',_0x138a93=_0x483017+':'+_0x1d2134[_0x22056b(0xf5)];!_0x4c0b00[_0x22056b(0x1a3)](_0x138a93)&&_0x4c0b00['set'](_0x138a93,[]),_0x4c0b00[_0x22056b(0x14b)](_0x138a93)[_0x22056b(0x1bc)](_0x1d2134);}for(const _0x5f2c2b of _0x4c0b00['values']()){_0x5f2c2b[_0x22056b(0x163)]((_0x39e049,_0x3d27bc)=>(_0x39e049[_0x22056b(0xe3)]||0x0)-(_0x3d27bc[_0x22056b(0xe3)]||0x0));}return _0x4c0b00;}export function collectFoldersToCreate(_0x1b325d,_0x1df406){const _0x39b640=a152_0xdbe0a,_0x50fee7=new Set();for(const _0x41bfed of _0x1b325d){if(!_0x41bfed)continue;if(_0x1df406['has'](_0x41bfed))continue;const _0x3163f8=_0x41bfed[_0x39b640(0x125)]('/');let _0x1a68eb='';for(const _0x74d6bd of _0x3163f8){_0x1a68eb=_0x1a68eb?_0x1a68eb+'/'+_0x74d6bd:_0x74d6bd,!_0x1df406[_0x39b640(0x1a3)](_0x1a68eb)&&_0x50fee7['add'](_0x1a68eb);}}return _0x50fee7;}export function parseAndClassifyYamlFiles(_0x99e1a7,_0x3084f0,_0x2f7ece){const _0x4e6f39=a152_0xdbe0a,_0x21ebec=[],_0x51e5d9=[];for(const _0x347e08 of _0x99e1a7){const _0x22beb7=a152_0x543d0d[_0x4e6f39(0xeb)](_0x3084f0,a152_0x543d0d[_0x4e6f39(0x18d)](_0x347e08)),_0x1b29a1=_0x22beb7==='.'?'':_0x22beb7['replace'](/\\/g,'/'),_0x52dcc7=readFileSync(_0x347e08,_0x4e6f39(0x12c)),_0x34233e=a152_0x14c7b5[_0x4e6f39(0x1bb)](_0x52dcc7);if(isJourneyDef(_0x34233e)){const _0x5af029=a152_0x590d85(_0x52dcc7);_0x51e5d9[_0x4e6f39(0x1bc)]({'yamlConfig':_0x5af029,'folderPath':_0x1b29a1,'sourcePath':_0x347e08});}else{if(!_0x2f7ece?.[_0x4e6f39(0x15e)]){const _0x153203=parseSegmentYamlFile(_0x52dcc7),_0x368ec3=normalizeChildSegmentYaml(_0x153203);_0x21ebec['push']({'yamlConfig':_0x368ec3,'folderPath':_0x1b29a1,'sourcePath':_0x347e08});}}}return{'segments':_0x21ebec,'journeys':_0x51e5d9};}export function validateParsedFiles(_0x399f78,_0xbd1dbc){const _0x277646=a152_0xdbe0a,_0x453537=[];for(const {yamlConfig:_0x4a9f7d,sourcePath:_0xf82a0}of _0x399f78[_0x277646(0x111)]){const _0x5ac647=readFileSync(_0xf82a0,'utf-8'),_0x53ebdf=a152_0x14c7b5['parseDocument'](_0x5ac647),_0x3860ea=validateSegmentDef(_0x4a9f7d,{'source':_0x5ac647,'document':_0x53ebdf},{'skipSchema':!![]});if(!_0x3860ea[_0x277646(0x181)]){const _0x2782d5=a152_0x543d0d[_0x277646(0xeb)](_0xbd1dbc,_0xf82a0);_0x453537[_0x277646(0x1bc)]({'filePath':_0x2782d5,'source':_0x5ac647,'result':_0x3860ea,'isJourney':![]});}}for(const {yamlConfig:_0x51b186,sourcePath:_0x4f469f}of _0x399f78[_0x277646(0x1d0)]){const _0x551990=readFileSync(_0x4f469f,'utf-8'),_0x1d8599=a152_0x14c7b5[_0x277646(0x183)](_0x551990),_0x21cc00=validateJourneyDef(_0x51b186,{'source':_0x551990,'document':_0x1d8599},{'skipSchema':!![]});if(!_0x21cc00[_0x277646(0x181)]){const _0x16222c=a152_0x543d0d['relative'](_0xbd1dbc,_0x4f469f);_0x453537[_0x277646(0x1bc)]({'filePath':_0x16222c,'source':_0x551990,'result':_0x21cc00,'isJourney':!![]});}}return _0x453537;}export function formatValidationErrors(_0x3928b8){const _0x4c5dfe=a152_0xdbe0a,_0x10ee54=[];for(const {filePath:_0x250fd0,source:_0x2eeea6,result:_0x3adeb0,isJourney:_0x3f69ee}of _0x3928b8){const _0x2cd099=_0x3f69ee?'journey':_0x4c5dfe(0x1c4);_0x10ee54[_0x4c5dfe(0x1bc)]('\x0a'+_0x250fd0+'\x20('+_0x2cd099+_0x4c5dfe(0x18e)+_0x3adeb0[_0x4c5dfe(0x113)][_0x4c5dfe(0x10e)]+_0x4c5dfe(0x1a0)),_0x10ee54[_0x4c5dfe(0x1bc)](formatValidationResult(_0x3adeb0,_0x2eeea6,_0x250fd0));}return _0x10ee54['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x1542d6){const _0x483da3=a152_0xdbe0a,_0x7f256a=new Set(),_0x1881cc=new Map(),_0x4962d3=collectSegmentUsageCounts(_0x1542d6);if(_0x1542d6[_0x483da3(0x111)])for(const [_0x1cdb17,_0x188d70]of Object[_0x483da3(0x188)](_0x1542d6['segments'])){_0x7f256a[_0x483da3(0x168)](_0x1cdb17);if(_0x188d70[_0x483da3(0x180)]){const _0x2376b2=yamlRuleToApi(_0x188d70[_0x483da3(0x180)]),_0x3ea612=apiRuleToYaml(_0x2376b2);_0x1881cc[_0x483da3(0xca)](_0x1cdb17,_0x3ea612);}}const _0x1dee40=new Map();let _0x4c6991=0x0;for(const [_0x676544,_0x3a31ed]of _0x1881cc){const _0x43b407=serializeExpandedRule(_0x3a31ed,_0x1881cc),_0x47e0ec=_0x1dee40[_0x483da3(0x14b)](_0x43b407)||[];_0x47e0ec[_0x483da3(0x1bc)]({'name':_0x676544,'index':_0x4c6991}),_0x1dee40[_0x483da3(0xca)](_0x43b407,_0x47e0ec),_0x4c6991++;}const _0x3e68db=new Map();for(const [_0x3098bf,_0x471372]of _0x1dee40){const _0x185375=_0x471372[_0x483da3(0xe7)]()[_0x483da3(0x163)]((_0x11a985,_0x381bcd)=>{const _0x5c3105=_0x483da3,_0xa90c03=_0x4962d3[_0x5c3105(0x14b)](_0x11a985[_0x5c3105(0x10d)])||0x0,_0x5e01f8=_0x4962d3[_0x5c3105(0x14b)](_0x381bcd[_0x5c3105(0x10d)])||0x0;if(_0xa90c03!==_0x5e01f8)return _0x5e01f8-_0xa90c03;return _0x11a985[_0x5c3105(0x1a4)]-_0x381bcd['index'];})['map'](_0x3a404f=>_0x3a404f['name']),_0x24eb42=[];for(const _0x33520c of _0x185375){const _0x540df7=_0x4962d3[_0x483da3(0x14b)](_0x33520c)||0x0,_0x39c5c1=Math[_0x483da3(0x103)](_0x540df7,0x1);for(let _0x50e72c=0x0;_0x50e72c<_0x39c5c1;_0x50e72c++){_0x24eb42[_0x483da3(0x1bc)](_0x33520c);}}_0x3e68db[_0x483da3(0xca)](_0x3098bf,_0x24eb42);}return{'existingLocalSegmentNames':_0x7f256a,'localSegmentRules':_0x1881cc,'localExpandedRuleToNames':_0x3e68db};}export function createSegmentIdResolver(_0x54d62e,_0x1f3203){return async _0x43e295=>{const _0x5bcdea=a152_0x3e4e,_0x1d7e29=_0x54d62e['get'](_0x43e295);if(!_0x1d7e29)throw new SDKError(ErrorCode[_0x5bcdea(0x159)],'Segment\x20not\x20found:\x20'+_0x43e295+_0x5bcdea(0x10c)+_0x1f3203+'\x27)');return _0x1d7e29;};}export function extractRootFolderId(_0x2caca9){const _0x46786c=a152_0xdbe0a;return _0x2caca9[_0x46786c(0x167)]?.[_0x46786c(0xdc)]?.[_0x46786c(0x197)]?.['id']||_0x2caca9[_0x46786c(0x167)]?.[_0x46786c(0x16e)]?.[_0x46786c(0x197)]?.['id'];}function a152_0x3e4e(_0x49afd1,_0x5dc4d6){_0x49afd1=_0x49afd1-0xc5;const _0x46f47d=a152_0x46f4();let _0x3e4ea4=_0x46f47d[_0x49afd1];return _0x3e4ea4;}export function buildConnectionMaps(_0x31f13e){const _0x13ff1f=a152_0xdbe0a,_0x13df76=new Map(),_0x313f62=new Map(),_0x34d7da=new Map();for(const _0x210ad6 of _0x31f13e){_0x13df76[_0x13ff1f(0xca)](_0x210ad6['name'],parseInt(_0x210ad6['id'],0xa)),_0x313f62[_0x13ff1f(0xca)](_0x210ad6['id'],_0x210ad6['name']),_0x34d7da[_0x13ff1f(0xca)](_0x210ad6['name'],_0x210ad6[_0x13ff1f(0x146)]);}return{'nameToId':_0x13df76,'idToName':_0x313f62,'nameToType':_0x34d7da};}export function calculatePushStats(_0x24168a,_0x1a3f10,_0x3fd6dc,_0x1ce33c,_0x46e993,_0x439d86,_0x3d90df){const _0x4bb9d4=a152_0xdbe0a,_0x3de955=_0x24168a[_0x4bb9d4(0xf2)](_0x2a7167=>_0x2a7167[_0x4bb9d4(0x190)]),_0x42945e=_0x24168a[_0x4bb9d4(0xf2)](_0x1e2c4e=>!_0x1e2c4e[_0x4bb9d4(0x190)]&&_0x1e2c4e[_0x4bb9d4(0x157)]),_0x804386=_0x24168a[_0x4bb9d4(0xf2)](_0x12d7e6=>!_0x12d7e6['isNew']&&!_0x12d7e6[_0x4bb9d4(0x157)]),_0x1010f6=_0x439d86?_0x1ce33c:[],_0xc848d3=_0x1a3f10[_0x4bb9d4(0xf2)](_0x49b18d=>_0x49b18d[_0x4bb9d4(0x190)]),_0x499415=_0x1a3f10[_0x4bb9d4(0xf2)](_0x285df6=>!_0x285df6[_0x4bb9d4(0x190)]&&_0x285df6[_0x4bb9d4(0x157)]),_0x411e02=_0x1a3f10['filter'](_0x286c41=>!_0x286c41[_0x4bb9d4(0x190)]&&!_0x286c41['hasChanges']),_0xb468f4=_0x439d86?_0x46e993:[],_0x398b61=_0x24168a[_0x4bb9d4(0xdd)](_0x5069ae=>_0x5069ae['activationActions']),_0xd87335=_0x398b61[_0x4bb9d4(0xf2)](_0x16b383=>_0x16b383[_0x4bb9d4(0x146)]==='create'),_0x1afee1=_0x398b61[_0x4bb9d4(0xf2)](_0x29e827=>_0x29e827['type']===_0x4bb9d4(0x172)),_0x58a4c5=_0x398b61[_0x4bb9d4(0xf2)](_0x539608=>_0x539608[_0x4bb9d4(0x146)]===_0x4bb9d4(0x1b0)),_0x4408ad=Array[_0x4bb9d4(0xe1)](_0x3fd6dc)[_0x4bb9d4(0x163)](),_0x50f200=_0x3d90df?![]:_0x3de955[_0x4bb9d4(0x10e)]>0x0||_0x42945e[_0x4bb9d4(0x10e)]>0x0||_0x1010f6[_0x4bb9d4(0x10e)]>0x0,_0x3d4e74=_0xc848d3[_0x4bb9d4(0x10e)]>0x0||_0x499415['length']>0x0||_0xb468f4[_0x4bb9d4(0x10e)]>0x0,_0x12d5be=_0x3d90df?![]:_0x398b61[_0x4bb9d4(0x10e)]>0x0,_0x43ba55=_0x4408ad['length']>0x0;return{'segments':{'new':_0x3de955,'changed':_0x42945e,'unchanged':_0x804386,'toDelete':_0x1010f6},'journeys':{'new':_0xc848d3,'changed':_0x499415,'unchanged':_0x411e02,'toDelete':_0xb468f4},'activations':{'all':_0x398b61,'toCreate':_0xd87335,'toUpdate':_0x1afee1,'toDelete':_0x58a4c5},'folders':{'toCreate':_0x4408ad},'counts':{'segments':{'new':_0x3de955['length'],'changed':_0x42945e[_0x4bb9d4(0x10e)],'unchanged':_0x804386['length'],'toDelete':_0x1010f6[_0x4bb9d4(0x10e)]},'journeys':{'new':_0xc848d3[_0x4bb9d4(0x10e)],'changed':_0x499415[_0x4bb9d4(0x10e)],'unchanged':_0x411e02[_0x4bb9d4(0x10e)],'toDelete':_0xb468f4[_0x4bb9d4(0x10e)]},'activations':{'create':_0xd87335[_0x4bb9d4(0x10e)],'update':_0x1afee1[_0x4bb9d4(0x10e)],'delete':_0x58a4c5[_0x4bb9d4(0x10e)]},'folders':_0x4408ad['length']},'hasChanges':_0x50f200||_0x3d4e74||_0x12d5be||_0x43ba55};}export async function buildPushExecutionContext(_0x43f8ce,_0x4b66af,_0x12668f,_0x77609f,_0x3f2fda,_0x3992a1){const _0x50c036=a152_0xdbe0a,_0x5747d8=extractRootFolderId(_0x12668f),{pathToId:_0x3d067e,idToPath:_0xa51105}=buildFolderMaps(_0x3f2fda),_0x1e6d4f=buildSegmentNameToIdMap(_0x77609f),_0x1a805f=new Map(),{batchAsync:_0x118f70}=await import(_0x50c036(0xe0)),[_0x51948e,_0x204837]=await Promise[_0x50c036(0x196)]([_0x43f8ce['user'][_0x50c036(0xd8)](),_0x43f8ce['connection'][_0x50c036(0xec)](),((async()=>{const _0x5d23bd=_0x50c036;!_0x3992a1&&_0x77609f[_0x5d23bd(0x10e)]>0x0&&await _0x118f70(_0x77609f,async _0x413f56=>{const _0x2330fb=_0x5d23bd,_0x29ddd1=await _0x43f8ce[_0x2330fb(0x1c4)][_0x2330fb(0x18c)](_0x4b66af,_0x413f56['id']);_0x1a805f[_0x2330fb(0xca)](_0x413f56['id'],_0x29ddd1);});})())]),{emailToId:_0x48539e,idToEmail:_0x566836}=_0x51948e,_0x1fa4e9=buildConnectionMaps(_0x204837);return{'rootFolderId':_0x5747d8,'folderPathToId':_0x3d067e,'folderIdToPath':_0xa51105,'segmentNameToId':_0x1e6d4f,'activationsBySegmentId':_0x1a805f,'emailToIdMap':_0x48539e,'idToEmailMap':_0x566836,'connectionNameToIdMap':_0x1fa4e9[_0x50c036(0xf6)],'connectionIdToNameMap':_0x1fa4e9[_0x50c036(0x133)],'connectionNameToTypeMap':_0x1fa4e9[_0x50c036(0x1be)]};}export function createPushYamlContextForBundle(_0xf20718,_0x53e53f,_0x185d60,_0x330856,_0x5e80b2,_0x47695b,_0x57514d,_0x3245a8){const {existingLocalSegmentNames:_0x484af4,localExpandedRuleToNames:_0x216d9f}=_0x330856,_0x192f2a=new Set(),_0x476c13=new Map(),_0x1f1473=new Map(),_0x20a510=new Map(),_0x33ce0e=createJumpTargetCache(),_0x3ff8ef=new Map(),_0x152703=new Map(),_0x1b292e=new Set();let _0x5eea27;const _0x5994d0=_0x10193c=>{const _0x78d78b={'resolveSegment':async _0x31b7f1=>{const _0x535b22=a152_0x3e4e,_0x47c29c=_0x20a510[_0x535b22(0x14b)](_0x31b7f1);if(_0x47c29c!==undefined)return{'name':_0x47c29c,'isJourneyLocal':!![]};try{const _0x5f2831=await fetchSegment(_0xf20718,_0x53e53f,_0x31b7f1,_0x185d60);if(!_0x5f2831)throw new Error('Segment\x20not\x20found');const _0x883342=generateJourneyLocalName(_0x5f2831[_0x535b22(0x10d)]),_0x35fcea=_0x5f2831[_0x535b22(0x176)]===SEGMENT_KIND_JOURNEY&&_0x883342!==undefined;let _0x39d25d=_0x5f2831[_0x535b22(0x10d)],_0x2a9b6f;if(_0x35fcea&&_0x5f2831[_0x535b22(0x180)]){const _0x1d94d7=apiRuleToYaml(_0x5f2831['rule']);_0x152703[_0x535b22(0xca)](_0x31b7f1,_0x1d94d7);const _0x1323f1=async _0x26f2e7=>{const _0x4132f2=_0x535b22,_0x294734=collectSegmentRefsFromRule(_0x26f2e7);for(const _0x5f1e17 of _0x294734){if(!_0x152703['has'](_0x5f1e17))try{const _0x58f578=await fetchSegment(_0xf20718,_0x53e53f,_0x5f1e17,_0x185d60);if(_0x58f578?.[_0x4132f2(0x180)]){const _0x5740d2=apiRuleToYaml(_0x58f578[_0x4132f2(0x180)]);_0x152703[_0x4132f2(0xca)](_0x5f1e17,_0x5740d2),await _0x1323f1(_0x5740d2);}}catch(_0x32c103){logger[_0x4132f2(0xc8)](_0x4132f2(0x117)+_0x5f1e17+':\x20'+_0x32c103);}}};await _0x1323f1(_0x1d94d7);const _0x3d3cda=serializeExpandedRule(_0x1d94d7,_0x152703),_0x66e961=_0x216d9f[_0x535b22(0x14b)](_0x3d3cda);if(_0x66e961&&_0x66e961['length']>0x0){const _0x2470ab=_0x476c13[_0x535b22(0x14b)](_0x3d3cda)||0x0,_0x5bb3d2=_0x66e961[_0x2470ab]||_0x66e961[_0x66e961[_0x535b22(0x10e)]-0x1];_0x476c13['set'](_0x3d3cda,_0x2470ab+0x1),_0x39d25d=_0x5bb3d2,_0x192f2a[_0x535b22(0x168)](_0x39d25d),_0x20a510[_0x535b22(0xca)](_0x31b7f1,_0x39d25d);const _0xafcd11=await resolveRuleSegmentRefs(_0x1d94d7,async _0x41eb7b=>{const _0x4af78b=_0x535b22,_0x1e9bad=_0x20a510[_0x4af78b(0x14b)](_0x41eb7b);if(_0x1e9bad)return _0x1e9bad;const _0x9d3d78=await _0x5eea27[_0x4af78b(0x19f)](_0x41eb7b);return _0x9d3d78[_0x4af78b(0x10d)];});_0x2a9b6f={'description':_0x5f2831[_0x535b22(0x1cb)],'rule':_0xafcd11};}else{const _0x4b2daa=_0x3ff8ef[_0x535b22(0x14b)](_0x3d3cda);if(_0x4b2daa)_0x39d25d=_0x4b2daa,_0x20a510[_0x535b22(0xca)](_0x31b7f1,_0x39d25d);else{if(_0x883342){let _0x21bd5f=_0x883342,_0xf0e0e3=0x2;while(_0x192f2a['has'](_0x21bd5f)||_0x484af4[_0x535b22(0x1a3)](_0x21bd5f)){_0x21bd5f=_0x883342+'_'+_0xf0e0e3,_0xf0e0e3++;}_0x192f2a[_0x535b22(0x168)](_0x21bd5f),_0x39d25d=_0x21bd5f;}_0x20a510[_0x535b22(0xca)](_0x31b7f1,_0x39d25d),_0x3ff8ef['set'](_0x3d3cda,_0x39d25d);const _0x53bb87=await resolveRuleSegmentRefs(_0x1d94d7,async _0x2fd4b2=>{const _0x52cba9=_0x535b22,_0x21dcdb=_0x20a510[_0x52cba9(0x14b)](_0x2fd4b2);if(_0x21dcdb)return _0x21dcdb;const _0x1b57d2=await _0x5eea27[_0x52cba9(0x19f)](_0x2fd4b2);return _0x1b57d2[_0x52cba9(0x10d)];});_0x2a9b6f={'description':_0x5f2831[_0x535b22(0x1cb)],'rule':_0x53bb87};}}}return{'name':_0x39d25d,'isJourneyLocal':_0x35fcea,'definition':_0x2a9b6f};}catch(_0x5bea24){return logger[_0x535b22(0xc8)]('Failed\x20to\x20resolve\x20segment\x20'+_0x31b7f1+':\x20'+_0x5bea24),{'name':_0x31b7f1,'isJourneyLocal':![]};}},'resolveActivation':async _0x34f88e=>{const _0x9a077c=a152_0x3e4e,_0x24c868=_0x1f1473['get'](_0x34f88e);if(_0x24c868!==undefined)return{'name':_0x24c868,'isJourneyLocal':!![]};try{let _0x38eea4=_0x57514d?.[_0x9a077c(0x14b)](_0x34f88e);!_0x38eea4&&(_0x38eea4=await _0xf20718[_0x9a077c(0xf0)][_0x9a077c(0xe2)](_0x10193c,_0x34f88e));const _0x148dda=_0x38eea4[_0x9a077c(0x13e)][_0x9a077c(0x138)][_0x9a077c(0x10d)]||_0x34f88e,_0x348f33=sanitizeYamlKey(_0x148dda)||_0x9a077c(0x109)+_0x34f88e,_0x437f2b=_0x348f33;_0x1f1473[_0x9a077c(0xca)](_0x34f88e,_0x437f2b);const _0x4a1e18=journeyActivationStepToYaml(_0x38eea4,_0x5e80b2,_0x47695b);return{'name':_0x437f2b,'isJourneyLocal':!![],'definition':_0x4a1e18};}catch(_0xd1e59d){return logger['debug'](_0x9a077c(0xfc)+_0x34f88e+':\x20'+_0xd1e59d),{'name':_0x34f88e,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x33cbc8,_0x5cf931)=>resolveJumpTarget(_0x33cbc8,_0x5cf931,_0x33ce0e,async _0x2102e3=>{const _0x477132=a152_0x3e4e,_0x541294=_0x3245a8?.[_0x477132(0x14b)](_0x2102e3);if(_0x541294)return _0x541294;return _0xf20718['journey']['getJourney'](_0x2102e3);})};return _0x5eea27=_0x78d78b,_0x78d78b;},_0x13a514=async _0x31c655=>{const _0x399f1f=a152_0x3e4e,{collectSegmentIdsFromJourneyApi:_0x20bfcd}=await import(_0x399f1f(0x116)),{batchAsync:_0x2dc474}=await import('../../utils/async.js'),_0xf12b11=new Set();for(const _0x581a41 of _0x31c655){let _0x3e70a3=_0x3245a8?.['get'](_0x581a41);!_0x3e70a3&&(_0x3e70a3=await _0xf20718[_0x399f1f(0xf0)][_0x399f1f(0x1ce)](_0x581a41));const _0x1c9943=_0x20bfcd(_0x3e70a3);for(const _0x34c21a of _0x1c9943){_0xf12b11[_0x399f1f(0x168)](_0x34c21a);}}let _0x381b03=Array[_0x399f1f(0xe1)](_0xf12b11);while(_0x381b03[_0x399f1f(0x10e)]>0x0){const _0x5dfa33=_0x381b03['filter'](_0x3b543f=>!_0x1b292e[_0x399f1f(0x1a3)](_0x3b543f));if(_0x5dfa33[_0x399f1f(0x10e)]===0x0)break;const _0x38907e=await _0x2dc474(_0x5dfa33,async _0x26006d=>{const _0x272d28=_0x399f1f;_0x1b292e[_0x272d28(0x168)](_0x26006d);const _0x5e38a3=await fetchSegment(_0xf20718,_0x53e53f,_0x26006d,_0x185d60);if(!_0x5e38a3)return null;return{'segmentId':_0x26006d,'segment':_0x5e38a3};},0xa),_0x5b6b9c=new Set();for(const _0x368f7e of _0x38907e){if(!_0x368f7e?.['segment']?.[_0x399f1f(0x180)])continue;const _0x2374d9=apiRuleToYaml(_0x368f7e['segment'][_0x399f1f(0x180)]);_0x152703[_0x399f1f(0xca)](_0x368f7e['segmentId'],_0x2374d9);const _0x287ff3=collectSegmentRefsFromRule(_0x2374d9);for(const _0x118d2d of _0x287ff3){!_0x1b292e[_0x399f1f(0x1a3)](_0x118d2d)&&_0x5b6b9c[_0x399f1f(0x168)](_0x118d2d);}}_0x381b03=Array[_0x399f1f(0xe1)](_0x5b6b9c);}};return{'createYamlContext':_0x5994d0,'prefetchJourneySegments':_0x13a514};}export async function executePushSegments(_0xf4a3de,_0x3ba6cb,_0x559c73,_0x5a085a,_0x2dcd25){const _0x24b13=a152_0xdbe0a,{segmentDefToCreateRequest:_0x31c5fc,segmentDefToUpdateRequest:_0x525021}=await import(_0x24b13(0xc7)),_0x2de5c2=_0x559c73[_0x24b13(0x102)],_0x2a3efa=0x5,_0x41e037=async _0x30beb2=>{const _0x56d08a=_0x24b13,_0x433ccc=_0x30beb2[_0x56d08a(0x19e)]?_0x2de5c2[_0x56d08a(0x14b)](_0x30beb2[_0x56d08a(0x19e)]):undefined;let _0x336355;const _0xffce47={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x1a5ec1=_0x30beb2[_0x56d08a(0x147)];if(_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x180)]){const _0x4f53be=createSegmentIdResolver(_0x559c73[_0x56d08a(0x140)],_0x30beb2['yamlConfig']['name']),_0x31075b=await resolveRuleSegmentIds(_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x180)],_0x4f53be);_0x1a5ec1={..._0x30beb2[_0x56d08a(0x147)],'rule':_0x31075b};}try{if(_0x30beb2[_0x56d08a(0x190)]){_0x2dcd25[_0x56d08a(0x18a)]?.({'type':'segment_creating','name':_0x30beb2['yamlConfig'][_0x56d08a(0x10d)]});const _0xd751f6=_0x31c5fc(_0x1a5ec1,_0x433ccc),_0x29bc9b=await _0x2dcd25[_0x56d08a(0x15a)]('Creating\x20segment\x20\x27'+_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x10d)]+'\x27...',()=>_0xf4a3de['segment'][_0x56d08a(0x127)](_0x5a085a['parentId'],_0xd751f6));_0x336355=_0x29bc9b[_0x56d08a(0x197)]['id'],_0x559c73[_0x56d08a(0x140)][_0x56d08a(0xca)](_0x30beb2[_0x56d08a(0x147)]['name'],_0x336355),_0xffce47['createdSegmentId']={'name':_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x10d)],'id':_0x336355},_0x2dcd25[_0x56d08a(0x18a)]?.({'type':_0x56d08a(0x1af),'name':_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x10d)],'segmentId':_0x336355}),_0x2dcd25[_0x56d08a(0x122)]?.(_0x56d08a(0xcc)+_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x10d)]+'\x27'),_0xffce47[_0x56d08a(0x17e)]=0x1;}else{if(_0x30beb2[_0x56d08a(0x157)]){_0x2dcd25['onProgress']?.({'type':_0x56d08a(0xc6),'name':_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x10d)]});const _0x472b8c=_0x525021(_0x1a5ec1);_0x433ccc!==_0x30beb2['existingSegment']?.[_0x56d08a(0xf7)]&&(_0x472b8c[_0x56d08a(0xf7)]=_0x433ccc?parseInt(_0x433ccc,0xa):undefined),await _0x2dcd25['withProgress'](_0x56d08a(0x1b5)+_0x30beb2[_0x56d08a(0x147)]['name']+'\x27...',()=>_0xf4a3de[_0x56d08a(0x1c4)][_0x56d08a(0x128)](_0x5a085a[_0x56d08a(0x129)],_0x30beb2[_0x56d08a(0x1cf)]['id'],_0x472b8c)),_0x336355=_0x30beb2[_0x56d08a(0x1cf)]['id'],_0x2dcd25[_0x56d08a(0x18a)]?.({'type':_0x56d08a(0x17c),'name':_0x30beb2['yamlConfig'][_0x56d08a(0x10d)]}),_0x2dcd25[_0x56d08a(0x122)]?.(_0x56d08a(0x1ae)+_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x10d)]+'\x27'),_0xffce47[_0x56d08a(0x15c)]=0x1;}else _0x336355=_0x30beb2['existingSegment']['id'];}}catch(_0x277098){const _0x10b1a7=isHttp400Error(_0x277098),_0x4154c0=_0x10b1a7?ErrorCode[_0x56d08a(0xd9)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x279135=getErrorMessage(_0x277098);throw new SDKError(_0x4154c0,'Failed\x20to\x20'+(_0x30beb2[_0x56d08a(0x190)]?_0x56d08a(0x182):'update')+_0x56d08a(0xea)+_0x30beb2[_0x56d08a(0xfa)]+_0x56d08a(0x101)+_0x279135,_0x277098);}try{const _0x2c025c=await syncActivationsForSegment(_0xf4a3de,_0x5a085a[_0x56d08a(0x129)],_0x336355,_0x30beb2[_0x56d08a(0x147)][_0x56d08a(0x10d)],_0x30beb2[_0x56d08a(0xf1)],_0x2dcd25,_0x30beb2[_0x56d08a(0xfa)]);_0xffce47[_0x56d08a(0x1ac)]=_0x2c025c;}catch(_0x3ce9ef){if(_0x3ce9ef instanceof SDKError)throw _0x3ce9ef;throw new SDKError(ErrorCode[_0x56d08a(0x120)],_0x56d08a(0x195)+_0x30beb2['yamlConfig'][_0x56d08a(0x10d)]+_0x56d08a(0xed)+_0x30beb2[_0x56d08a(0xfa)]+_0x56d08a(0x101)+getErrorMessage(_0x3ce9ef),_0x3ce9ef);}return _0xffce47;},_0xed3431=await batchAsync(_0x3ba6cb,_0x41e037,_0x2a3efa),_0x44def1={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x4d58e2 of _0xed3431){_0x44def1[_0x24b13(0x17e)]+=_0x4d58e2['created'],_0x44def1['updated']+=_0x4d58e2[_0x24b13(0x15c)],_0x4d58e2[_0x24b13(0x104)]&&_0x44def1[_0x24b13(0x1b2)][_0x24b13(0xca)](_0x4d58e2[_0x24b13(0x104)][_0x24b13(0x10d)],_0x4d58e2[_0x24b13(0x104)]['id']),_0x44def1[_0x24b13(0x1ac)][_0x24b13(0x17e)]+=_0x4d58e2[_0x24b13(0x1ac)][_0x24b13(0x17e)],_0x44def1[_0x24b13(0x1ac)][_0x24b13(0x15c)]+=_0x4d58e2[_0x24b13(0x1ac)]['updated'],_0x44def1[_0x24b13(0x1ac)][_0x24b13(0x170)]+=_0x4d58e2['activations'][_0x24b13(0x170)];}return _0x44def1;}async function syncActivationsForSegment(_0x4c2e89,_0x12253c,_0x1c7059,_0x21869c,_0x231f44,_0x4c1c0c,_0x31f893){const _0x8e45e5=a152_0xdbe0a,_0x1c6c37={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x24caaa of _0x231f44){try{if(_0x24caaa[_0x8e45e5(0x146)]==='create'&&_0x24caaa[_0x8e45e5(0xdf)])_0x4c1c0c[_0x8e45e5(0x18a)]?.({'type':'activation_creating','segmentName':_0x21869c,'activationName':_0x24caaa[_0x8e45e5(0x10d)]}),await _0x4c1c0c['withProgress'](_0x8e45e5(0x162)+_0x24caaa['name']+_0x8e45e5(0x17f),()=>_0x4c2e89['segment']['createActivation'](_0x12253c,_0x1c7059,_0x24caaa[_0x8e45e5(0xdf)])),_0x4c1c0c[_0x8e45e5(0x18a)]?.({'type':_0x8e45e5(0x112),'segmentName':_0x21869c,'activationName':_0x24caaa[_0x8e45e5(0x10d)]}),_0x4c1c0c[_0x8e45e5(0x122)]?.('Created\x20activation\x20\x27'+_0x24caaa['name']+'\x27'),_0x1c6c37[_0x8e45e5(0x17e)]++;else{if(_0x24caaa[_0x8e45e5(0x146)]==='update'&&_0x24caaa[_0x8e45e5(0xdf)]&&_0x24caaa[_0x8e45e5(0x12e)])_0x4c1c0c['onProgress']?.({'type':'activation_updating','segmentName':_0x21869c,'activationName':_0x24caaa[_0x8e45e5(0x10d)]}),await _0x4c1c0c[_0x8e45e5(0x15a)](_0x8e45e5(0x189)+_0x24caaa[_0x8e45e5(0x10d)]+'\x27...',()=>_0x4c2e89[_0x8e45e5(0x1c4)]['updateActivation'](_0x12253c,_0x1c7059,_0x24caaa[_0x8e45e5(0x12e)]['id'],_0x24caaa[_0x8e45e5(0xdf)])),_0x4c1c0c[_0x8e45e5(0x18a)]?.({'type':_0x8e45e5(0xce),'segmentName':_0x21869c,'activationName':_0x24caaa[_0x8e45e5(0x10d)]}),_0x4c1c0c['logSuccess']?.('Updated\x20activation\x20\x27'+_0x24caaa[_0x8e45e5(0x10d)]+'\x27'),_0x1c6c37[_0x8e45e5(0x15c)]++;else _0x24caaa[_0x8e45e5(0x146)]===_0x8e45e5(0x1b0)&&_0x24caaa['existingActivation']&&(_0x4c1c0c['onProgress']?.({'type':_0x8e45e5(0x134),'segmentName':_0x21869c,'activationName':_0x24caaa[_0x8e45e5(0x10d)]}),await _0x4c1c0c[_0x8e45e5(0x15a)](_0x8e45e5(0x1a7)+_0x24caaa[_0x8e45e5(0x10d)]+'\x27...',()=>_0x4c2e89[_0x8e45e5(0x1c4)][_0x8e45e5(0x192)](_0x12253c,_0x1c7059,_0x24caaa[_0x8e45e5(0x12e)]['id'])),_0x4c1c0c['onProgress']?.({'type':'activation_deleted','segmentName':_0x21869c,'activationName':_0x24caaa[_0x8e45e5(0x10d)]}),_0x4c1c0c['logDeleted']?.(_0x8e45e5(0x1d1)+_0x24caaa[_0x8e45e5(0x10d)]+'\x27'),_0x1c6c37['deleted']++);}}catch(_0xbd035b){const _0x3895eb=isHttp400Error(_0xbd035b),_0x1bd547=_0x3895eb?ErrorCode[_0x8e45e5(0x1ad)]:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0xc133c4=getErrorMessage(_0xbd035b);throw new SDKError(_0x1bd547,_0x8e45e5(0xde)+_0x24caaa[_0x8e45e5(0x146)]+_0x8e45e5(0x11c)+_0x24caaa[_0x8e45e5(0x10d)]+_0x8e45e5(0xed)+_0x31f893+_0x8e45e5(0x101)+_0xc133c4,_0xbd035b);}}return _0x1c6c37;}export async function executePushFolders(_0x969a52,_0x5f10e7,_0x492273,_0x5339f6,_0x30f5c3){const _0x3d472c=a152_0xdbe0a,_0x57b485=new Map(_0x492273),_0x5ad780=sortFoldersByDepth(_0x5f10e7);for(const _0x3de730 of _0x5ad780){const _0x2e8ce1=_0x3de730[_0x3d472c(0x125)]('/'),_0x4cd269=_0x2e8ce1[_0x2e8ce1[_0x3d472c(0x10e)]-0x1],_0x4793b5=_0x2e8ce1[_0x3d472c(0xe7)](0x0,-0x1)[_0x3d472c(0x13d)]('/'),_0x2ffa71=_0x57b485[_0x3d472c(0x14b)](_0x4793b5);_0x30f5c3[_0x3d472c(0x18a)]?.({'type':_0x3d472c(0xef),'folder':_0x3de730});const _0x5c3ed7={'name':_0x4cd269,'parentFolderId':_0x2ffa71},_0x2f39c2=await _0x30f5c3['withProgress'](_0x3d472c(0x164)+_0x3de730+_0x3d472c(0x17f),()=>_0x969a52[_0x3d472c(0x1c4)][_0x3d472c(0xcb)](_0x5339f6[_0x3d472c(0x129)],_0x5c3ed7));_0x57b485[_0x3d472c(0xca)](_0x3de730,_0x2f39c2[_0x3d472c(0x197)]['id']),_0x30f5c3[_0x3d472c(0x18a)]?.({'type':_0x3d472c(0x10b),'folder':_0x3de730,'folderId':_0x2f39c2[_0x3d472c(0x197)]['id']}),_0x30f5c3['logInfo']?.(_0x3d472c(0xc9)+_0x3de730+'\x27');}return _0x57b485;}export async function executePushSegmentDeletions(_0x15a5b4,_0x291674,_0x55c342){const _0x12a2c4=a152_0xdbe0a;if(_0x291674[_0x12a2c4(0x10e)]===0x0)return 0x0;const {batchAsync:_0x3ce684}=await import('../../utils/async.js'),_0xb00834=0x5,_0x595666=await _0x3ce684(_0x291674,async _0x94deef=>{const _0x556add=_0x12a2c4;return _0x55c342[_0x556add(0x18a)]?.({'type':_0x556add(0x1a2),'name':_0x94deef['name']}),await _0x15a5b4['segment'][_0x556add(0x12d)](_0x94deef['id']),_0x55c342['onProgress']?.({'type':_0x556add(0xfe),'name':_0x94deef[_0x556add(0x10d)]}),_0x55c342[_0x556add(0x152)]?.(_0x556add(0x154)+_0x94deef[_0x556add(0x10d)]+'\x27'),0x1;},_0xb00834);return _0x595666[_0x12a2c4(0x155)]((_0x1a6467,_0x31f68c)=>_0x1a6467+_0x31f68c,0x0);}export async function executePushJourneys(_0x477ffb,_0x438309,_0x403476,_0x501a4f,_0x3de78d){const _0x3be99e=a152_0xdbe0a,{journeyDefToRequest:_0x59fe59}=await import(_0x3be99e(0x116)),{activationDefToCreateRequest:_0x40836f,yamlRuleToApi:_0x16fbc6,validateSegmentRule:_0x13767f}=await import('./child-segment-yaml.js'),_0x3b7bd0={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x1b0c2f=new Map(_0x403476[_0x3be99e(0x140)]),_0x554e29=0x5;for(let _0x3f946d=0x0;_0x3f946d<_0x438309[_0x3be99e(0x10e)];_0x3f946d+=_0x554e29){const _0x739b62=_0x438309['slice'](_0x3f946d,_0x3f946d+_0x554e29),_0x58ede2=await Promise[_0x3be99e(0x196)](_0x739b62[_0x3be99e(0x114)](async _0x3f316f=>{const _0xa32f10=_0x3be99e;if(!_0x3f316f['isNew']&&!_0x3f316f[_0xa32f10(0x157)])return{'action':_0xa32f10(0x173),'name':_0x3f316f[_0xa32f10(0x147)][_0xa32f10(0x10d)],'journeyId':_0x3f316f[_0xa32f10(0x174)]?.['id']};const _0x12a1b8=_0x3f316f[_0xa32f10(0x19e)]?_0x403476['folderPathToId']['get'](_0x3f316f[_0xa32f10(0x19e)]):undefined;_0x3de78d[_0xa32f10(0x18a)]?.({'type':_0x3f316f[_0xa32f10(0x190)]?_0xa32f10(0x115):_0xa32f10(0x1c9),'name':_0x3f316f[_0xa32f10(0x147)]['name']});try{const _0xdc15dd=await executeSingleJourneyPush(_0x477ffb,_0x3f316f,{..._0x403476,'segmentNameToId':_0x1b0c2f},{'parentId':_0x501a4f[_0xa32f10(0x129)],'rootFolderId':_0x501a4f[_0xa32f10(0x179)],'folderId':_0x12a1b8,'verbose':_0x501a4f[_0xa32f10(0x158)]},_0x3de78d,{'journeyDefToRequest':_0x59fe59,'activationDefToCreateRequest':_0x40836f,'yamlRuleToApi':_0x16fbc6,'validateSegmentRule':_0x13767f});for(const [_0x1c7865,_0x1b620a]of _0xdc15dd['embeddedSegmentNameToId']){_0x1b0c2f['set'](_0x1c7865,_0x1b620a),_0x3b7bd0[_0xa32f10(0x107)][_0xa32f10(0xca)](_0x1c7865,_0x1b620a);}if(_0xdc15dd[_0xa32f10(0x119)]===_0xa32f10(0x17e))_0x3de78d[_0xa32f10(0x18a)]?.({'type':_0xa32f10(0x123),'name':_0x3f316f[_0xa32f10(0x147)][_0xa32f10(0x10d)],'journeyId':_0xdc15dd['journeyId']}),_0x3de78d[_0xa32f10(0x122)]?.(_0xa32f10(0x1c1)+_0x3f316f[_0xa32f10(0x147)][_0xa32f10(0x10d)]+'\x27'),_0x3b7bd0[_0xa32f10(0x17e)]++;else _0xdc15dd['action']===_0xa32f10(0x15c)&&(_0x3de78d[_0xa32f10(0x18a)]?.({'type':_0xa32f10(0x18b),'name':_0x3f316f[_0xa32f10(0x147)]['name']}),_0x3de78d['logSuccess']?.('Updated\x20journey\x20\x27'+_0x3f316f['yamlConfig']['name']+'\x27'),_0x3b7bd0[_0xa32f10(0x15c)]++);return{'action':_0xdc15dd['action'],'name':_0x3f316f[_0xa32f10(0x147)][_0xa32f10(0x10d)],'journeyId':_0xdc15dd[_0xa32f10(0x1c0)]};}catch(_0xe1406f){const _0x2a9cd9=isHttp400Error(_0xe1406f),_0x2a8b32=_0x2a9cd9?ErrorCode[_0xa32f10(0x17d)]:ErrorCode[_0xa32f10(0x1c8)],_0x1bd961=getErrorMessage(_0xe1406f);throw new SDKError(_0x2a8b32,_0xa32f10(0xde)+(_0x3f316f[_0xa32f10(0x190)]?'create':_0xa32f10(0x172))+_0xa32f10(0x14d)+_0x3f316f['absolutePath']+_0xa32f10(0x101)+_0x1bd961,_0xe1406f);}}));_0x3b7bd0[_0x3be99e(0x12b)][_0x3be99e(0x1bc)](..._0x58ede2);}return _0x3b7bd0;}async function matchExistingJourneySegments(_0x2a9fe1,_0x4a1a5a,_0x17167c,_0x1bbfb1,_0x1d483d){const _0x1a74a0=a152_0xdbe0a;if(!_0x4a1a5a[_0x1a74a0(0x174)]||!_0x4a1a5a['yamlConfig']['segments'])return;const _0x47b7bf=new Map(),_0x211295=new Set();for(const _0x3081f2 of Object['keys'](_0x4a1a5a[_0x1a74a0(0x147)]['segments'])){const _0x575282=generateDeterministicJourneySegmentName(_0x4a1a5a[_0x1a74a0(0x147)][_0x1a74a0(0x10d)],_0x3081f2);_0x47b7bf[_0x1a74a0(0xca)](_0x575282,_0x3081f2),_0x211295['add'](_0x3081f2);}const _0x304455=[],_0x5135b6=collectSegmentIdsFromJourneyApi(_0x4a1a5a['existingJourney']);for(const _0xba708d of _0x5135b6){const _0x12f10a=await fetchSegment(_0x2a9fe1,_0x17167c,_0xba708d,_0x1bbfb1);if(!_0x12f10a?.['name'])continue;const _0x387aaa=_0x47b7bf[_0x1a74a0(0x14b)](_0x12f10a[_0x1a74a0(0x10d)]);_0x387aaa?(_0x1d483d[_0x1a74a0(0xca)](_0x387aaa,_0xba708d),_0x211295[_0x1a74a0(0x1b0)](_0x387aaa)):_0x304455['push']({'id':_0xba708d,'seg':_0x12f10a});}if(_0x211295[_0x1a74a0(0x1c6)]>0x0&&_0x304455[_0x1a74a0(0x10e)]>0x0){const {localExpandedRuleToNames:_0x49d788}=buildLocalExpandedRuleMappings(_0x4a1a5a[_0x1a74a0(0x147)]),_0x47c88e=new Map();for(const {id:_0x785be4,seg:_0x31fa9b}of _0x304455){if(_0x31fa9b[_0x1a74a0(0x180)]){const _0x1b923f=apiRuleToYaml(_0x31fa9b[_0x1a74a0(0x180)]);_0x47c88e[_0x1a74a0(0xca)](_0x785be4,_0x1b923f);}}for(const {id:_0x182a17,seg:_0x3ff0d6}of _0x304455){if(!_0x3ff0d6['rule'])continue;const _0x582079=_0x47c88e[_0x1a74a0(0x14b)](_0x182a17);if(!_0x582079)continue;const _0xfa7f07=serializeExpandedRule(_0x582079,_0x47c88e),_0x1415aa=_0x49d788[_0x1a74a0(0x14b)](_0xfa7f07);if(_0x1415aa){const _0x5553d5=_0x1415aa[_0x1a74a0(0x1a1)](_0x3cedb3=>_0x211295[_0x1a74a0(0x1a3)](_0x3cedb3));_0x5553d5&&(_0x1d483d['set'](_0x5553d5,_0x182a17),_0x211295[_0x1a74a0(0x1b0)](_0x5553d5),logger[_0x1a74a0(0xc8)]('Matched\x20server\x20segment\x20\x27'+_0x3ff0d6[_0x1a74a0(0x10d)]+_0x1a74a0(0x15f)+_0x5553d5+_0x1a74a0(0x1b6)));}}}}async function executeSingleJourneyPush(_0x2380c7,_0x19663c,_0x14fd3f,_0x5b3ec2,_0x32f622,_0x79dd93){const _0x2e6d63=a152_0xdbe0a,{journeyDefToRequest:_0x1442cd,activationDefToCreateRequest:_0x3627b5,yamlRuleToApi:_0x21da01,validateSegmentRule:_0x164745}=_0x79dd93,_0x5bb7bd=new Map(),_0x58d5fc=new Map();recoverSegmentIdsFromPushRecovery(_0x19663c,_0x5bb7bd,_0x14fd3f[_0x2e6d63(0x140)]);const _0x9cef7c=new Map(),_0x3ea76b=new Map(),_0x177c93=new Map();let _0x939c14;const _0x22417e=async()=>{const _0x4e6516=_0x2e6d63;if(_0x939c14)return;_0x939c14=new Map();if(!_0x19663c[_0x4e6516(0x174)])return;const _0x2a2467=await _0x2380c7['journey'][_0x4e6516(0x18c)](_0x19663c['existingJourney']['id']);for(const _0x367df9 of _0x2a2467){const _0x49deab=journeyActivationStepToYaml(_0x367df9,_0x14fd3f[_0x4e6516(0xf4)],_0x14fd3f['connectionIdToNameMap']),_0x3bb28a=activationSignature(_0x49deab);!_0x939c14['has'](_0x3bb28a)&&_0x939c14[_0x4e6516(0xca)](_0x3bb28a,_0x367df9['id']),_0x49deab[_0x4e6516(0x10d)]&&_0x58d5fc[_0x4e6516(0xca)](_0x49deab[_0x4e6516(0x10d)],_0x367df9['id']);}};await matchExistingJourneySegments(_0x2380c7,_0x19663c,_0x5b3ec2['parentId'],_0x14fd3f['existingSegments'],_0x14fd3f[_0x2e6d63(0x140)]);const _0x2bc658={'resolveSegmentId':async _0x316586=>{const _0x532ed6=_0x2e6d63,_0x6b82d7=_0x14fd3f['segmentNameToId'][_0x532ed6(0x14b)](_0x316586);if(!_0x6b82d7)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x532ed6(0x14f)+_0x316586+_0x532ed6(0x198)+_0x19663c['yamlConfig'][_0x532ed6(0x10d)]+')');return _0x6b82d7;},'resolveEmbeddedSegmentId':async(_0x18fd1e,_0x5e9203)=>{const _0x33af95=_0x2e6d63,_0xb9d601=_0x14fd3f[_0x33af95(0x140)]['get'](_0x18fd1e);if(_0xb9d601)return _0xb9d601;const _0x345ac7=_0x14fd3f[_0x33af95(0x1bf)][_0x33af95(0x1a1)](_0x2ed3ea=>_0x2ed3ea['name']===_0x18fd1e);if(_0x345ac7)return _0x14fd3f[_0x33af95(0x140)][_0x33af95(0xca)](_0x18fd1e,_0x345ac7['id']),_0x345ac7['id'];if(_0x19663c['isNew']){const {stageName:_0x4b5f4c,criteriaName:_0x2adb54}=findSegmentCriteriaLocation(_0x19663c[_0x33af95(0x147)],_0x18fd1e);return _0x164745(_0x18fd1e,_0x5e9203[_0x33af95(0x180)]),_0x3ea76b[_0x33af95(0xca)](_0x18fd1e,{'definition':_0x5e9203,'stageName':_0x4b5f4c,'criteriaName':_0x2adb54}),createPendingSegmentId(_0x18fd1e);}const _0x2d2a13=_0x19663c[_0x33af95(0x174)]?.['id'];if(!_0x2d2a13)throw new SDKError(ErrorCode[_0x33af95(0x1b8)],_0x33af95(0x12a));const _0x53196c=_0x9cef7c[_0x33af95(0x14b)](_0x18fd1e);if(_0x53196c)return _0x53196c;const _0xcd3ca6=((async()=>{const _0x34b9b2=_0x33af95;_0x164745(_0x18fd1e,_0x5e9203[_0x34b9b2(0x180)]);const _0x22c01e=generateDeterministicJourneySegmentName(_0x19663c['yamlConfig'][_0x34b9b2(0x10d)],_0x18fd1e),_0x2b9af3=_0x14fd3f[_0x34b9b2(0x1bf)]['find'](_0x2d5dff=>_0x2d5dff[_0x34b9b2(0x10d)]===_0x22c01e),_0x401a59=createSegmentIdResolver(_0x14fd3f[_0x34b9b2(0x140)],_0x18fd1e),_0x127cfc=await resolveRuleSegmentIds(_0x5e9203['rule'],_0x401a59);let _0x583415;return _0x2b9af3?(await _0x2380c7[_0x34b9b2(0x1c4)]['updateSegmentById'](_0x5b3ec2['parentId'],_0x2b9af3['id'],{'description':_0x5e9203[_0x34b9b2(0x1cb)]||_0x34b9b2(0x19b)+_0x18fd1e,'rule':_0x21da01(_0x127cfc),'countPopulation':!![]}),_0x583415=_0x2b9af3['id'],saveSegmentToPushRecovery(_0x19663c[_0x34b9b2(0xfa)],_0x19663c['yamlConfig'][_0x34b9b2(0x10d)],_0x18fd1e,{'segmentId':_0x583415,'uniqueServerName':_0x22c01e,'createdAt':new Date()['toISOString']()})):_0x583415=await createOrRecoverEmbeddedSegment(_0x2380c7,_0x19663c,{'localName':_0x18fd1e,'uniqueSegmentName':_0x22c01e,'description':_0x5e9203[_0x34b9b2(0x1cb)]||_0x34b9b2(0x19b)+_0x18fd1e,'journeyId':_0x2d2a13,'resolvedRule':_0x127cfc,'parentId':_0x5b3ec2[_0x34b9b2(0x129)],'folderId':_0x5b3ec2['rootFolderId']||''},_0x21da01),_0x14fd3f[_0x34b9b2(0x140)][_0x34b9b2(0xca)](_0x18fd1e,_0x583415),_0x5bb7bd[_0x34b9b2(0xca)](_0x18fd1e,_0x583415),_0x583415;})());_0x9cef7c[_0x33af95(0xca)](_0x18fd1e,_0xcd3ca6);try{return await _0xcd3ca6;}finally{_0x9cef7c[_0x33af95(0x1b0)](_0x18fd1e);}},'resolveActivationId':async _0x282227=>{const _0x348125=_0x2e6d63,_0x2a6033=_0x58d5fc[_0x348125(0x14b)](_0x282227);if(_0x2a6033)return _0x2a6033;if(_0x19663c[_0x348125(0x174)]){await _0x22417e();const _0x3a6a64=_0x58d5fc[_0x348125(0x14b)](_0x282227);if(_0x3a6a64)return _0x3a6a64;}throw new SDKError(ErrorCode[_0x348125(0x14c)],_0x348125(0x142)+_0x282227+'\x20(referenced\x20in\x20journey\x20'+_0x19663c[_0x348125(0x147)][_0x348125(0x10d)]+_0x348125(0xe4)+_0x348125(0x13b));},'resolveEmbeddedActivationId':async(_0xe92850,_0x12f80c)=>{const _0x43c728=_0x2e6d63,_0x16d2a4=_0x58d5fc[_0x43c728(0x14b)](_0xe92850);if(_0x16d2a4)return _0x16d2a4;if(_0x19663c['isNew'])return _0x177c93[_0x43c728(0xca)](_0xe92850,_0x12f80c),createPendingActivationId(_0xe92850);if(_0x19663c['existingJourney']){await _0x22417e();const _0x46c305=_0x58d5fc[_0x43c728(0x14b)](_0x12f80c[_0x43c728(0x10d)]);if(_0x46c305)return _0x58d5fc[_0x43c728(0xca)](_0xe92850,_0x46c305),_0x46c305;const _0x484c12=activationSignature(_0x12f80c),_0xdf5e33=_0x939c14?.[_0x43c728(0x14b)](_0x484c12);if(_0xdf5e33)return _0x58d5fc['set'](_0xe92850,_0xdf5e33),_0xdf5e33;const _0x1b1ae0=await _0x3627b5(_0x12f80c,_0x14fd3f['activationContext']),_0x419e11={..._0x1b1ae0,..._0x12f80c[_0x43c728(0x16a)]!==undefined&&{'runAfterJourneyRefresh':_0x12f80c['run_after_journey_refresh']}},_0x4e0730=await _0x2380c7[_0x43c728(0xf0)]['createActivation'](_0x19663c[_0x43c728(0x174)]['id'],_0x419e11);return _0x58d5fc[_0x43c728(0xca)](_0xe92850,_0x4e0730['id']),_0x4e0730['id'];}throw new SDKError(ErrorCode[_0x43c728(0x1b8)],'Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context');},'resolveJourneyId':async _0x37d09f=>{const _0x23caf9=_0x2e6d63;try{return await _0x2380c7[_0x23caf9(0xf0)][_0x23caf9(0xdb)](_0x5b3ec2[_0x23caf9(0x129)],_0x37d09f);}catch(_0x2388a2){throw new SDKError(ErrorCode[_0x23caf9(0x14c)],_0x23caf9(0x1a8)+_0x37d09f+_0x23caf9(0x184)+_0x19663c[_0x23caf9(0x147)]['name']+'\x27)',_0x2388a2);}},'resolveStageId':async(_0x3c49d0,_0x58e7e2)=>{const _0x46d175=_0x2e6d63,_0x3fed0d=await _0x2380c7[_0x46d175(0xf0)][_0x46d175(0x1ce)](_0x3c49d0),_0x6d815f=_0x3fed0d['attributes'][_0x46d175(0xfd)][_0x46d175(0x1a1)](_0x5ba818=>_0x5ba818[_0x46d175(0x10d)][_0x46d175(0x17a)]()===_0x58e7e2[_0x46d175(0x17a)]());if(!_0x6d815f?.['id'])throw new SDKError(ErrorCode['NOT_FOUND'],_0x46d175(0x1aa)+_0x58e7e2+_0x46d175(0xcd)+(_0x3fed0d[_0x46d175(0x13e)][_0x46d175(0xf5)]||_0x3fed0d[_0x46d175(0x13e)][_0x46d175(0x10d)])+'\x27');return _0x6d815f['id'];}},_0x4908ea=await _0x1442cd(_0x19663c[_0x2e6d63(0x147)],_0x5b3ec2[_0x2e6d63(0x129)],_0x2bc658),_0x2d5bd6=_0x5b3ec2[_0x2e6d63(0x14a)]||_0x5b3ec2[_0x2e6d63(0x179)];_0x2d5bd6&&(_0x4908ea['relationships']={'parentFolder':{'data':{'id':_0x2d5bd6,'type':'folder'}}});if(_0x19663c[_0x2e6d63(0x190)]){if(_0x3ea76b[_0x2e6d63(0x1c6)]>0x0||_0x177c93[_0x2e6d63(0x1c6)]>0x0)return await executeThreeStepJourneyCreate(_0x2380c7,_0x19663c,_0x4908ea,{'pendingEmbeddedSegments':_0x3ea76b,'pendingEmbeddedActivations':_0x177c93,'embeddedSegmentNameToId':_0x5bb7bd,'journeyActivationNameToId':_0x58d5fc},{..._0x5b3ec2,'effectiveFolderId':_0x2d5bd6},_0x14fd3f,_0x32f622,_0x79dd93);else{ensureJourneyDefaults(_0x4908ea[_0x2e6d63(0x13e)]);const _0x497c15=await _0x2380c7[_0x2e6d63(0xf0)][_0x2e6d63(0x182)](_0x4908ea);return deletePushRecovery(_0x19663c[_0x2e6d63(0xfa)]),{'action':'created','journeyId':_0x497c15['id'],'embeddedSegmentNameToId':_0x5bb7bd};}}else{if(_0x19663c[_0x2e6d63(0x157)]&&_0x19663c[_0x2e6d63(0x174)]){_0x4908ea['id']=_0x19663c[_0x2e6d63(0x174)]['id'];const _0x46c3f1=_0x4908ea[_0x2e6d63(0x13e)];_0x19663c['existingJourney'][_0x2e6d63(0x13e)]?.['journeyBundleName']&&(_0x46c3f1[_0x2e6d63(0xf5)]=_0x19663c[_0x2e6d63(0x174)][_0x2e6d63(0x13e)]['journeyBundleName']);const _0x49f808=_0x19663c[_0x2e6d63(0x174)][_0x2e6d63(0x13e)]?.[_0x2e6d63(0xfd)];return _0x49f808&&_0x4908ea['attributes'][_0x2e6d63(0xfd)]&&injectExistingStageIds(_0x4908ea[_0x2e6d63(0x13e)][_0x2e6d63(0xfd)],_0x49f808),ensureJourneyDefaults(_0x46c3f1),await _0x2380c7[_0x2e6d63(0xf0)][_0x2e6d63(0x172)](_0x19663c[_0x2e6d63(0x174)]['id'],_0x4908ea),deletePushRecovery(_0x19663c[_0x2e6d63(0xfa)]),{'action':_0x2e6d63(0x15c),'journeyId':_0x19663c[_0x2e6d63(0x174)]['id'],'embeddedSegmentNameToId':_0x5bb7bd};}}return deletePushRecovery(_0x19663c[_0x2e6d63(0xfa)]),{'action':_0x2e6d63(0x173),'journeyId':_0x19663c[_0x2e6d63(0x174)]?.['id'],'embeddedSegmentNameToId':_0x5bb7bd};}function findSegmentCriteriaLocation(_0x5d173f,_0x47f159){const _0x4ad693=a152_0xdbe0a,_0x2023d5=_0x5d173f[_0x4ad693(0x141)]||_0x5d173f[_0x4ad693(0x1d0)]?.[0x0]?.['stages']||[];let _0x399a5b=_0x4ad693(0x110),_0x3e4afe=_0x47f159;const _0x28a0d6=_0x5d173f[_0x4ad693(0x10a)]||_0x5d173f[_0x4ad693(0x1d0)]?.[0x0]?.[_0x4ad693(0x10a)];if(_0x28a0d6?.['segment']===_0x47f159)return{'stageName':'goal','criteriaName':_0x28a0d6[_0x4ad693(0x10d)]||_0x47f159};_0x131301:for(const _0xf08e86 of _0x2023d5){if(_0xf08e86[_0x4ad693(0x105)]?.['segment']===_0x47f159){_0x399a5b=_0xf08e86[_0x4ad693(0x10d)],_0x3e4afe=_0xf08e86[_0x4ad693(0x105)][_0x4ad693(0x10d)]||_0x47f159;break;}if(_0xf08e86[_0x4ad693(0x1ba)])for(const _0x5602b3 of _0xf08e86['steps']){if(_0x5602b3[_0x4ad693(0x146)]==='decision_point'&&_0x5602b3['with']?.[_0x4ad693(0x19c)])for(const _0xc45114 of _0x5602b3[_0x4ad693(0x15d)]['branches']){if(_0xc45114[_0x4ad693(0x1c4)]===_0x47f159){_0x399a5b=_0xf08e86[_0x4ad693(0x10d)],_0x3e4afe=_0xc45114[_0x4ad693(0x10d)]||_0x47f159;break _0x131301;}}}}return{'stageName':_0x399a5b,'criteriaName':_0x3e4afe};}async function executeThreeStepJourneyCreate(_0x4b071a,_0x139d09,_0x1e26c3,_0x387b64,_0x2986f1,_0x32bc37,_0x33791f,_0x477491){const _0x36c6a3=a152_0xdbe0a,{activationDefToCreateRequest:_0x63dfb3,yamlRuleToApi:_0x319327}=_0x477491,{pendingEmbeddedSegments:_0x59af82,pendingEmbeddedActivations:_0x4a4e10,embeddedSegmentNameToId:_0x4bcdfc}=_0x387b64,_0x139eac=JSON['parse'](JSON['stringify'](_0x1e26c3));ensureJourneyDefaults(_0x139eac[_0x36c6a3(0x13e)]),stripPendingIds(_0x139eac);const _0x341ec8=await _0x4b071a['journey'][_0x36c6a3(0x182)](_0x139eac),_0xde6fcf=_0x341ec8['id'],_0x332c77=new Map();for(const _0x54c4d3 of _0x341ec8[_0x36c6a3(0x13e)][_0x36c6a3(0xfd)]){_0x332c77[_0x36c6a3(0xca)](_0x54c4d3[_0x36c6a3(0x10d)][_0x36c6a3(0x17a)](),_0x54c4d3['id']);}recoverSegmentIdsFromPushRecovery(_0x139d09,_0x4bcdfc,_0x32bc37[_0x36c6a3(0x140)]);for(const [_0x34c23f,{definition:_0x3efd1b}]of _0x59af82){if(_0x4bcdfc['has'](_0x34c23f)){_0x33791f[_0x36c6a3(0x18a)]?.({'type':_0x36c6a3(0x16b),'journeyName':_0x139d09[_0x36c6a3(0x147)][_0x36c6a3(0x10d)],'segmentName':_0x34c23f});continue;}const _0x578020=generateDeterministicJourneySegmentName(_0x139d09[_0x36c6a3(0x147)][_0x36c6a3(0x10d)],_0x34c23f);_0x33791f['onProgress']?.({'type':_0x36c6a3(0x144),'journeyName':_0x139d09['yamlConfig'][_0x36c6a3(0x10d)],'segmentName':_0x34c23f});const _0x4f6a5e=createSegmentIdResolver(_0x32bc37[_0x36c6a3(0x140)],_0x34c23f),_0x6933d8=await resolveRuleSegmentIds(_0x3efd1b[_0x36c6a3(0x180)],_0x4f6a5e),_0x3aeff1=await createOrRecoverEmbeddedSegment(_0x4b071a,_0x139d09,{'localName':_0x34c23f,'uniqueSegmentName':_0x578020,'description':_0x3efd1b['description']||_0x36c6a3(0x19b)+_0x34c23f,'journeyId':_0xde6fcf,'resolvedRule':_0x6933d8,'parentId':_0x2986f1['parentId'],'folderId':_0x2986f1[_0x36c6a3(0x13a)]||''},_0x319327);_0x4bcdfc[_0x36c6a3(0xca)](_0x34c23f,_0x3aeff1),_0x32bc37[_0x36c6a3(0x140)]['set'](_0x34c23f,_0x3aeff1),_0x33791f[_0x36c6a3(0x18a)]?.({'type':_0x36c6a3(0x16b),'journeyName':_0x139d09[_0x36c6a3(0x147)][_0x36c6a3(0x10d)],'segmentName':_0x34c23f});}const _0x14a0d7=new Map();for(const [_0x307f32,_0x56a063]of _0x4a4e10){_0x33791f[_0x36c6a3(0x18a)]?.({'type':_0x36c6a3(0xd6),'journeyName':_0x139d09[_0x36c6a3(0x147)]['name'],'activationName':_0x307f32});const _0x12233e=await _0x63dfb3(_0x56a063,_0x32bc37[_0x36c6a3(0x160)]),_0x143468={..._0x12233e,..._0x56a063[_0x36c6a3(0x16a)]!==undefined&&{'runAfterJourneyRefresh':_0x56a063[_0x36c6a3(0x16a)]}},_0x14f16e=await _0x4b071a[_0x36c6a3(0xf0)]['createActivation'](_0xde6fcf,_0x143468);_0x14a0d7[_0x36c6a3(0xca)](_0x307f32,_0x14f16e['id']),_0x387b64[_0x36c6a3(0x151)]['set'](_0x307f32,_0x14f16e['id']),_0x33791f['onProgress']?.({'type':_0x36c6a3(0x1b3),'journeyName':_0x139d09[_0x36c6a3(0x147)][_0x36c6a3(0x10d)],'activationName':_0x307f32});}const _0x87bfb5=JSON[_0x36c6a3(0x1bb)](JSON[_0x36c6a3(0x10f)](_0x1e26c3));return _0x87bfb5['id']=_0xde6fcf,ensureJourneyDefaults(_0x87bfb5[_0x36c6a3(0x13e)]),resolvePendingIdsInRequest(_0x87bfb5,_0x1e26c3,_0x332c77,_0x4bcdfc,_0x14a0d7,_0x33791f),await _0x4b071a[_0x36c6a3(0xf0)]['update'](_0xde6fcf,_0x87bfb5),deletePushRecovery(_0x139d09[_0x36c6a3(0xfa)]),{'action':_0x36c6a3(0x17e),'journeyId':_0xde6fcf,'embeddedSegmentNameToId':_0x4bcdfc};}export function stripWaitStepPendingIds(_0x4073d4){const _0x27d5c5=a152_0xdbe0a,_0x21f6ef=_0x4073d4[_0x27d5c5(0x149)]&&isPendingSegmentId(_0x4073d4[_0x27d5c5(0x149)]),_0x55db61=_0x4073d4[_0x27d5c5(0xfb)]?.['some'](_0x9ef091=>_0x9ef091[_0x27d5c5(0xe5)]&&isPendingSegmentId(_0x9ef091[_0x27d5c5(0xe5)]));(_0x21f6ef||_0x55db61)&&(_0x4073d4[_0x27d5c5(0x12f)]=_0x27d5c5(0x137),_0x4073d4[_0x27d5c5(0x11d)]=0x1,_0x4073d4[_0x27d5c5(0x13c)]=_0x27d5c5(0x1bd),delete _0x4073d4['conditionSegmentId'],delete _0x4073d4['conditionTimeoutDuration'],delete _0x4073d4[_0x27d5c5(0x1a6)],delete _0x4073d4[_0x27d5c5(0xfb)]);}export function resolveWaitStepPendingIds(_0x37bd9e,_0x278143,_0xd7af4,_0x542b2c){const _0x4e8e77=a152_0xdbe0a;if(_0x278143[_0x4e8e77(0x149)]&&isPendingSegmentId(_0x278143[_0x4e8e77(0x149)])){const _0x5cce02=_0xd7af4(_0x278143[_0x4e8e77(0x149)],_0x4e8e77(0x100)+_0x542b2c+'\x27\x20wait\x20condition');_0x5cce02&&(_0x37bd9e[_0x4e8e77(0x12f)]=_0x4e8e77(0x16f),_0x37bd9e[_0x4e8e77(0x149)]=_0x5cce02,delete _0x37bd9e[_0x4e8e77(0x11d)],delete _0x37bd9e[_0x4e8e77(0x13c)],_0x278143['conditionTimeoutDuration']!==undefined&&(_0x37bd9e['conditionTimeoutDuration']=_0x278143[_0x4e8e77(0x11a)]),_0x278143[_0x4e8e77(0x1a6)]&&(_0x37bd9e['conditionTimeoutUnit']=_0x278143['conditionTimeoutUnit']));}if(_0x278143[_0x4e8e77(0xfb)]){const _0x13d9bf=_0x278143[_0x4e8e77(0xfb)]['some'](_0x78c4b0=>_0x78c4b0['segmentId']&&isPendingSegmentId(_0x78c4b0['segmentId']));if(_0x13d9bf){const _0x33d72b=_0x278143[_0x4e8e77(0xfb)][_0x4e8e77(0x114)](_0x397dd8=>{const _0xcae593=_0x4e8e77;if(_0x397dd8[_0xcae593(0xe5)]&&isPendingSegmentId(_0x397dd8[_0xcae593(0xe5)])){const _0x31db3a=_0xd7af4(_0x397dd8[_0xcae593(0xe5)],_0xcae593(0x100)+_0x542b2c+_0xcae593(0x1cc));return{..._0x397dd8,'segmentId':_0x31db3a||_0x397dd8[_0xcae593(0xe5)]};}return{..._0x397dd8};});_0x37bd9e[_0x4e8e77(0x12f)]=_0x4e8e77(0x16f),_0x37bd9e[_0x4e8e77(0xfb)]=_0x33d72b,delete _0x37bd9e[_0x4e8e77(0x11d)],delete _0x37bd9e[_0x4e8e77(0x13c)],delete _0x37bd9e[_0x4e8e77(0x149)],delete _0x37bd9e[_0x4e8e77(0x11a)],delete _0x37bd9e[_0x4e8e77(0x1a6)];}}}function stripPendingIds(_0x3872a1){const _0xc70f60=a152_0xdbe0a;_0x3872a1[_0xc70f60(0x13e)][_0xc70f60(0x10a)]?.[_0xc70f60(0xe5)]&&isPendingSegmentId(_0x3872a1['attributes'][_0xc70f60(0x10a)][_0xc70f60(0xe5)])&&delete _0x3872a1[_0xc70f60(0x13e)][_0xc70f60(0x10a)];for(const _0x1f3396 of _0x3872a1['attributes'][_0xc70f60(0xfd)]||[]){_0x1f3396[_0xc70f60(0xcf)]?.['segmentId']&&isPendingSegmentId(_0x1f3396['entryCriteria'][_0xc70f60(0xe5)])&&delete _0x1f3396[_0xc70f60(0xcf)];_0x1f3396[_0xc70f60(0x16d)]?.[_0xc70f60(0xe5)]&&isPendingSegmentId(_0x1f3396[_0xc70f60(0x16d)]['segmentId'])&&delete _0x1f3396[_0xc70f60(0x16d)];_0x1f3396[_0xc70f60(0xd5)]&&(_0x1f3396[_0xc70f60(0xd5)]=_0x1f3396['exitCriterias'][_0xc70f60(0xf2)](_0x351a26=>!_0x351a26['segmentId']||!isPendingSegmentId(_0x351a26[_0xc70f60(0xe5)])));if(_0x1f3396[_0xc70f60(0x1ba)])for(const _0x1086a9 of Object[_0xc70f60(0x148)](_0x1f3396['steps'])){const _0x9363a6=_0x1f3396[_0xc70f60(0x1ba)][_0x1086a9];_0x9363a6[_0xc70f60(0x146)]===_0xc70f60(0x187)&&_0x9363a6[_0xc70f60(0x1ab)]&&isPendingActivationId(_0x9363a6[_0xc70f60(0x1ab)])&&(_0x9363a6[_0xc70f60(0x1ab)]='');if(_0x9363a6[_0xc70f60(0x146)]===_0xc70f60(0x199)&&_0x9363a6['branches'])for(const _0x387021 of _0x9363a6[_0xc70f60(0x19c)]){_0x387021['segmentId']&&isPendingSegmentId(_0x387021['segmentId'])&&(_0x387021[_0xc70f60(0xe5)]='');}_0x9363a6[_0xc70f60(0x146)]===_0xc70f60(0x156)&&stripWaitStepPendingIds(_0x9363a6);}}}function resolvePendingIdsInRequest(_0x32b31f,_0x4a3599,_0x13c225,_0x58b35a,_0x27395e,_0x4d1b95){const _0x45495e=a152_0xdbe0a,_0x3d642c=(_0x3cd003,_0x27cdaf)=>{const _0x4a66d4=a152_0x3e4e;if(!isPendingSegmentId(_0x3cd003))return _0x3cd003;const _0x1b2438=extractPendingSegmentName(_0x3cd003),_0x11ba8a=_0x58b35a['get'](_0x1b2438);return!_0x11ba8a&&_0x4d1b95[_0x4a66d4(0x118)]?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x1b2438+_0x4a66d4(0xd3)+_0x27cdaf),_0x11ba8a;};if(_0x32b31f[_0x45495e(0x13e)][_0x45495e(0x10a)]?.[_0x45495e(0xe5)]&&isPendingSegmentId(_0x32b31f[_0x45495e(0x13e)][_0x45495e(0x10a)][_0x45495e(0xe5)])){const _0x2800df=_0x3d642c(_0x32b31f['attributes'][_0x45495e(0x10a)][_0x45495e(0xe5)],'goal\x20criteria');_0x2800df&&(_0x32b31f[_0x45495e(0x13e)][_0x45495e(0x10a)][_0x45495e(0xe5)]=_0x2800df);}for(const _0x15a1ee of _0x32b31f[_0x45495e(0x13e)][_0x45495e(0xfd)]||[]){const _0x58112c=_0x13c225[_0x45495e(0x14b)](_0x15a1ee[_0x45495e(0x10d)][_0x45495e(0x17a)]());_0x58112c&&(_0x15a1ee['id']=_0x58112c);if(_0x15a1ee[_0x45495e(0xcf)]?.['segmentId']&&isPendingSegmentId(_0x15a1ee[_0x45495e(0xcf)][_0x45495e(0xe5)])){const _0x41a039=_0x3d642c(_0x15a1ee[_0x45495e(0xcf)][_0x45495e(0xe5)],_0x45495e(0x100)+_0x15a1ee[_0x45495e(0x10d)]+_0x45495e(0x1b7));_0x41a039&&(_0x15a1ee[_0x45495e(0xcf)][_0x45495e(0xe5)]=_0x41a039);}if(_0x15a1ee['exitCriterias'])for(const _0x19b468 of _0x15a1ee[_0x45495e(0xd5)]){if(_0x19b468[_0x45495e(0xe5)]&&isPendingSegmentId(_0x19b468[_0x45495e(0xe5)])){const _0x13a4d1=_0x3d642c(_0x19b468[_0x45495e(0xe5)],_0x45495e(0x100)+_0x15a1ee[_0x45495e(0x10d)]+_0x45495e(0x171));_0x13a4d1&&(_0x19b468[_0x45495e(0xe5)]=_0x13a4d1);}}if(_0x15a1ee['milestone']?.[_0x45495e(0xe5)]&&isPendingSegmentId(_0x15a1ee[_0x45495e(0x16d)][_0x45495e(0xe5)])){const _0x109ec5=_0x3d642c(_0x15a1ee[_0x45495e(0x16d)][_0x45495e(0xe5)],'stage\x20\x27'+_0x15a1ee[_0x45495e(0x10d)]+_0x45495e(0x194));_0x109ec5&&(_0x15a1ee[_0x45495e(0x16d)][_0x45495e(0xe5)]=_0x109ec5);}if(_0x15a1ee['steps']){const _0x689636=_0x32694d=>_0x4a3599[_0x45495e(0x13e)][_0x45495e(0xfd)]?.[_0x45495e(0x1a1)](_0xe8d53=>_0xe8d53['name'][_0x45495e(0x17a)]()===_0x15a1ee[_0x45495e(0x10d)][_0x45495e(0x17a)]())?.[_0x45495e(0x1ba)]?.[_0x32694d];for(const _0x2aa980 of Object['keys'](_0x15a1ee[_0x45495e(0x1ba)])){const _0x1e1d02=_0x15a1ee['steps'][_0x2aa980],_0x375c9f=_0x689636(_0x2aa980);if(_0x1e1d02['type']===_0x45495e(0x187)&&_0x1e1d02[_0x45495e(0x1ab)]&&(isPendingActivationId(_0x1e1d02[_0x45495e(0x1ab)])||_0x1e1d02[_0x45495e(0x1ab)]==='')){if(_0x375c9f?.[_0x45495e(0x1ab)]&&isPendingActivationId(_0x375c9f[_0x45495e(0x1ab)])){const _0x4cc057=extractPendingActivationName(_0x375c9f[_0x45495e(0x1ab)]),_0x1e15b6=_0x27395e[_0x45495e(0x14b)](_0x4cc057);_0x1e15b6&&(_0x1e1d02[_0x45495e(0x1ab)]=_0x1e15b6);}}if(_0x1e1d02['type']===_0x45495e(0x199)&&_0x1e1d02[_0x45495e(0x19c)]&&_0x375c9f?.[_0x45495e(0x19c)])for(let _0x2bbe4b=0x0;_0x2bbe4b<_0x1e1d02[_0x45495e(0x19c)][_0x45495e(0x10e)];_0x2bbe4b++){const _0x2bb13b=_0x1e1d02[_0x45495e(0x19c)][_0x2bbe4b],_0x5c9488=_0x375c9f['branches'][_0x2bbe4b];if(_0x5c9488?.['segmentId']&&isPendingSegmentId(_0x5c9488[_0x45495e(0xe5)])){const _0x2bbfb5=_0x3d642c(_0x5c9488[_0x45495e(0xe5)],_0x45495e(0x100)+_0x15a1ee[_0x45495e(0x10d)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x2bb13b[_0x45495e(0x10d)]||_0x2bbe4b)+'\x27');_0x2bbfb5&&(_0x2bb13b[_0x45495e(0xe5)]=_0x2bbfb5);}}_0x1e1d02[_0x45495e(0x146)]===_0x45495e(0x156)&&_0x375c9f?.[_0x45495e(0x146)]==='WaitStep'&&resolveWaitStepPendingIds(_0x1e1d02,_0x375c9f,_0x3d642c,_0x15a1ee[_0x45495e(0x10d)]);}}}}
|
|
1
|
+
const a152_0x547b34=a152_0x57d7;(function(_0x1ef6e3,_0x544879){const _0x195237=a152_0x57d7,_0x4bf6ce=_0x1ef6e3();while(!![]){try{const _0x1b8406=-parseInt(_0x195237(0x174))/0x1*(parseInt(_0x195237(0x1f3))/0x2)+parseInt(_0x195237(0x1e5))/0x3*(-parseInt(_0x195237(0x1f6))/0x4)+parseInt(_0x195237(0x1bb))/0x5+parseInt(_0x195237(0x180))/0x6*(-parseInt(_0x195237(0x1b4))/0x7)+-parseInt(_0x195237(0x194))/0x8+-parseInt(_0x195237(0x15d))/0x9*(parseInt(_0x195237(0x234))/0xa)+parseInt(_0x195237(0x216))/0xb;if(_0x1b8406===_0x544879)break;else _0x4bf6ce['push'](_0x4bf6ce['shift']());}catch(_0x183c52){_0x4bf6ce['push'](_0x4bf6ce['shift']());}}}(a152_0x2ff5,0xa0fcf));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_0x547b34(0x248);export const PENDING_ACTIVATION_PREFIX=a152_0x547b34(0x1ee);export function createPendingSegmentId(_0x2f4ebf){return''+PENDING_SEGMENT_PREFIX+_0x2f4ebf+'__';}export function isPendingSegmentId(_0x7f3a06){return _0x7f3a06['startsWith'](PENDING_SEGMENT_PREFIX)&&!_0x7f3a06['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x27ea0f){const _0x3a2d8e=a152_0x547b34;return _0x27ea0f[_0x3a2d8e(0x220)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3a0a13){return''+PENDING_ACTIVATION_PREFIX+_0x3a0a13+'__';}export function isPendingActivationId(_0x98fcf7){return _0x98fcf7['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x3f0a6d){const _0x25af7d=a152_0x547b34;return _0x3f0a6d[_0x25af7d(0x220)](/^__pending_act_(.+)__$/,'$1');}function a152_0x2ff5(){const _0x264207=['relative','1276532mfydOU','split','Activation\x20not\x20found:\x20','journeys','localName','list','JOURNEY_UPDATE_ERROR','decision_point','INTERNAL','get','existingJourney','effectiveFolderId','push',').\x20','Name\x20has\x20already\x20been\x20taken','valid','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','nameToType','Failed\x20to\x20','buildUserMaps','journey_creating','existingSegments','folderPath','description','NOT_FOUND','\x20segment\x20from\x20file:\x20','./child-segment-yaml.js','conditionTimeoutDuration','run_after_journey_refresh','./journey-yaml.js','embeddedSegmentNameToId','deleteActivation','37140323PAfcGt','existingSegment','activationActions','segments','journeyBundleId','all_columns','createFolder','milestone','activations','stages','replace','folder_created','createdSegmentIds','getLatestJourneyId','item','notification','embedded_segment_created','Creating\x20activation\x20\x27','data','created','journeyBundleName','Created\x20activation\x20\x27','state','stage\x20\x27','schedule','set','createActivation','utf-8','match','\x20activation\x20\x27','10MtFfrK','debug','index','deps','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','isNew','all','segmentId','rootFolderId','../../utils/async.js','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','slice','dirname','JOURNEY_SYNTAX_ERROR','has','segment_created','segment','filter','journeyName','startsWith','__pending_','listActivations','existingActivation','createdSegmentId','attributes','size','Created\x20journey\x20\x27','Stage\x20\x27','getSegment','some','.$1.push-recovery.json','Created\x20folder\x20\x27','hasChanges','toISOString','rule','max','embedded_activation_created','waitStepType','relationships','\x27\x20not\x20found\x20in\x20journey\x20\x27','\x27\x20to\x20local\x20\x27','behavior','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','conditions','activation_updated','toString','logSuccess','isArray','updated','SEGMENT_UPDATE_ERROR','diff','9086751VRRtwS','DecisionPoint','\x27\x20by\x20rule\x20content','day','errors','Entry\x20criteria:\x20','Segment\x20not\x20found','getJourney','parentId','entry_criteria','Updated\x20journey\x20\x27','entries','\x27\x20decision\x20point\x20branch\x20\x27','WaitStep','Failed\x20to\x20resolve\x20segment\x20','toLowerCase','connector_config','update','from','steps','uniqueSegmentName','embedded_activation_creating','flatMap','707CaRitO','\x20error(s)','and\x20the\x20server\x20segment,\x20then\x20retry.','Creating\x20segment\x20\x27','includes','Segment\x20not\x20found:\x20','results','journey_updating','createJourneySegment','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','Activation','resolveSegment','25188qiDZEK','activation_deleted','segment_updated','keys','parse','\x27\x20wait\x20condition','activation_template_id','unchanged','user','length','journey_created','segment_deleted','\x20(referenced\x20in\x20journey\x20','\x0a\x20\x20','conditionSegmentId','yamlActivation','verbose','\x27\x20for\x20','goal','idToEmailMap','385184oBlebt','Deleted\x20activation\x20\x27','onProgress','folderPathToId','segmentByFolderAndName','Updating\x20activation\x20\x27','parseDocument','yamlConfig','\x27\x20milestone','add','name','skipSegments','exitCriterias','map','Updated\x20segment\x20\x27','Created\x20segment\x20\x27','absolutePath','find','delete','join','idToName','progress','segment_creating','Updating\x20segment\x20\x27','waitStepUnit','resolveJourneyId','journeyStages','getSegment\x20failed\x20for\x20','Condition','ACTIVATION_UPDATE_ERROR','waitStep','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','602rfxnLQ','journeyId','folder','\x27\x20entry\x20criteria','Journey\x20\x27','withProgress','segment_deleting','3858075SSpOuL','SEGMENT_SYNTAX_ERROR','Failed\x20to\x20fetch\x20referenced\x20segment\x20','Failed\x20to\x20resolve\x20activation\x20','branches','create','journeyActivationNameToId','entryCriteria','updateSegmentById','uniqueServerName','Deleting\x20activation\x20\x27','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','columns','connectionIdToNameMap','action','logDeleted',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','conditionTimeoutUnit','Matched\x20server\x20segment\x20\x27','activation_created','journeyById','\x27...','fetchJourney','journey','sort','parentSegmentFolder','connection','activationStepsById','reduce','Creating\x20folder\x20\x27','embedded_segment_creating','goal\x20criteria','versionNumber','resolvedRule','Fetching\x20','Duration','activation_creating','type','activation_deleting','sha1','with','folder_creating','12XvVJfE','validatedRequest','deleted','journeyBundlesByFolderAndName','segmentFolderId','logWarning','segmentNameToId','segment_updating','journeyActivationStepId','__pending_act_','message','activationContext','folderId','SEGMENT_NOT_FOUND','2244oYCGWW','stringify'];a152_0x2ff5=function(){return _0x264207;};return a152_0x2ff5();}export function generateDeterministicJourneySegmentName(_0x5379e5,_0x141f02){const _0x5a027b=a152_0x547b34,_0x169d14=_0x5379e5+'::'+(_0x141f02['trim']()||_0x5a027b(0x244)),_0x55b4a2=createHash(_0x5a027b(0x1e2))[_0x5a027b(0x16e)](_0x169d14)['digest']('hex')['slice'](0x0,0xc);return'journey_entry_criteria_'+_0x55b4a2;}export function ensureJourneyDefaults(_0x315e43){const _0x4416c4=a152_0x547b34;!_0x315e43['description']&&(_0x315e43[_0x4416c4(0x20d)]=''),!_0x315e43[_0x4416c4(0x22c)]&&(_0x315e43['state']='draft');}export function injectExistingStageIds(_0x377ea1,_0x23abd7){const _0x1173a7=a152_0x547b34,_0x5abd86=new Map(_0x23abd7['map'](_0x5a023f=>[_0x5a023f[_0x1173a7(0x19e)],_0x5a023f['id']]));for(const _0x2593f0 of _0x377ea1){if(!_0x2593f0['id']){const _0x2d70ad=_0x5abd86[_0x1173a7(0x1ff)](_0x2593f0['name']);_0x2d70ad&&(_0x2593f0['id']=_0x2d70ad);}}}export function resolveTDFolderPath(_0x4fcb50,_0x38a290,_0x259952){const _0x41e1ef=a152_0x547b34;if(!_0x38a290)return _0x4fcb50;if(_0x4fcb50===_0x259952||_0x4fcb50[_0x41e1ef(0x247)](_0x259952+'/'))return _0x4fcb50;return _0x4fcb50?_0x259952+'/'+_0x4fcb50:_0x259952;}export function addFoldersToCreate(_0x585d1d,_0x1d49f1,_0x43bb80){const _0x3ea224=a152_0x547b34;if(!_0x585d1d)return;if(_0x1d49f1['has'](_0x585d1d))return;const _0x3a792b=_0x585d1d['split']('/');let _0x402bca='';for(const _0x196a47 of _0x3a792b){_0x402bca=_0x402bca?_0x402bca+'/'+_0x196a47:_0x196a47,!_0x1d49f1['has'](_0x402bca)&&_0x43bb80[_0x3ea224(0x19d)](_0x402bca);}}export function sortFoldersByDepth(_0x169e21){const _0x140a7f=a152_0x547b34;return[..._0x169e21][_0x140a7f(0x1d3)]((_0x5f271f,_0x4ae736)=>{const _0x4d254e=_0x140a7f,_0x58958b=(_0x5f271f['match'](/\//g)||[])['length'],_0x45b74f=(_0x4ae736[_0x4d254e(0x232)](/\//g)||[])[_0x4d254e(0x189)];return _0x58958b-_0x45b74f;});}import*as a152_0x2edd9c from'yaml';import{readFileSync}from'fs';import a152_0x339632 from'path';import{isJourneyDef,parseYamlString as a152_0x27da22,toYamlString as a152_0x3aa9ed,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(_0x1dcd37){const _0x8a5867=a152_0x547b34;if(Array[_0x8a5867(0x159)](_0x1dcd37))return'['+_0x1dcd37[_0x8a5867(0x1a1)](_0x3295a7=>stableStringify(_0x3295a7))[_0x8a5867(0x1a7)](',')+']';if(_0x1dcd37&&typeof _0x1dcd37==='object'){const _0xeafb6=_0x1dcd37,_0x52e2b1=Object[_0x8a5867(0x183)](_0xeafb6)[_0x8a5867(0x1d3)](),_0xcd6ebe=_0x52e2b1[_0x8a5867(0x1a1)](_0x8f1dfa=>'\x22'+_0x8f1dfa+'\x22:'+stableStringify(_0xeafb6[_0x8f1dfa]));return'{'+_0xcd6ebe['join'](',')+'}';}const _0x5850ba=JSON[_0x8a5867(0x1f4)](_0x1dcd37);return _0x5850ba===undefined?'null':_0x5850ba;}function activationSignature(_0x5b35f9){const _0x5664ed=a152_0x547b34,_0x146729={'connection':_0x5b35f9[_0x5664ed(0x1d5)],..._0x5b35f9[_0x5664ed(0x21b)]!==undefined&&{'all_columns':_0x5b35f9['all_columns']},..._0x5b35f9[_0x5664ed(0x1c7)]!==undefined&&{'columns':_0x5b35f9[_0x5664ed(0x1c7)]},..._0x5b35f9['behavior']!==undefined&&{'behavior':_0x5b35f9[_0x5664ed(0x152)]},..._0x5b35f9[_0x5664ed(0x22e)]!==undefined&&{'schedule':_0x5b35f9['schedule']},..._0x5b35f9[_0x5664ed(0x225)]!==undefined&&{'notification':_0x5b35f9['notification']},..._0x5b35f9[_0x5664ed(0x16d)]!==undefined&&{'connector_config':_0x5b35f9[_0x5664ed(0x16d)]},..._0x5b35f9[_0x5664ed(0x186)]!==undefined&&{'activation_template_id':_0x5b35f9[_0x5664ed(0x186)]}};return stableStringify(_0x146729);}async function fetchSegment(_0x476734,_0x36e05e,_0x105df8,_0x2c9db9){const _0x54d378=a152_0x547b34,_0x120183=_0x2c9db9?.[_0x54d378(0x1a5)](_0x3120d5=>_0x3120d5['id']===_0x105df8);if(_0x120183)return _0x120183;try{return await _0x476734[_0x54d378(0x244)][_0x54d378(0x250)](_0x36e05e,_0x105df8);}catch(_0x1311d9){logger[_0x54d378(0x235)](_0x54d378(0x1af)+_0x105df8+_0x54d378(0x1cb)+_0x1311d9);try{return await _0x476734[_0x54d378(0x244)]['getSegmentEntity'](_0x105df8);}catch(_0x1b22b9){return logger[_0x54d378(0x235)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x105df8+':\x20'+_0x1b22b9),null;}}}function recoverSegmentIdsFromPushRecovery(_0x4b16ee,_0x57d393,_0x4b6d7a){const _0x284e85=a152_0x547b34,_0x3b1bba=readPushRecovery(_0x4b16ee[_0x284e85(0x1a4)]);if(_0x3b1bba?.['journeyName']===_0x4b16ee['yamlConfig']['name'])for(const [_0x3cdd85,_0x5b33ad]of Object[_0x284e85(0x168)](_0x3b1bba[_0x284e85(0x219)])){const _0x5ee21e=generateDeterministicJourneySegmentName(_0x4b16ee[_0x284e85(0x19b)]['name'],_0x3cdd85);_0x5b33ad[_0x284e85(0x1c4)]===_0x5ee21e&&(_0x57d393[_0x284e85(0x22f)](_0x3cdd85,_0x5b33ad[_0x284e85(0x23b)]),_0x4b6d7a[_0x284e85(0x22f)](_0x3cdd85,_0x5b33ad[_0x284e85(0x23b)]));}}async function createOrRecoverEmbeddedSegment(_0x549b70,_0x469a09,_0x12e61f,_0x3559f1){const _0x5d8c76=a152_0x547b34;let _0x27cb4b;try{_0x27cb4b=await _0x549b70['segment'][_0x5d8c76(0x17c)]({'name':_0x12e61f[_0x5d8c76(0x171)],'description':_0x12e61f[_0x5d8c76(0x20d)],'journeyId':_0x12e61f[_0x5d8c76(0x1b5)],'rule':_0x3559f1(_0x12e61f[_0x5d8c76(0x1dc)],!![]),'countPopulation':!![],'parentFolderId':_0x12e61f[_0x5d8c76(0x1f1)],'audienceId':_0x12e61f[_0x5d8c76(0x165)]});}catch(_0x35b4d3){const _0x19ca16=_0x35b4d3 instanceof Error&&_0x35b4d3[_0x5d8c76(0x1ef)][_0x5d8c76(0x178)](_0x5d8c76(0x204));if(_0x19ca16){const _0x36fe79=readPushRecovery(_0x469a09[_0x5d8c76(0x1a4)]),_0x151098=_0x36fe79?.[_0x5d8c76(0x246)]===_0x469a09[_0x5d8c76(0x19b)][_0x5d8c76(0x19e)]?_0x36fe79['segments'][_0x12e61f[_0x5d8c76(0x1fa)]]:undefined;if(_0x151098?.['uniqueServerName']===_0x12e61f[_0x5d8c76(0x171)])await _0x549b70['segment'][_0x5d8c76(0x1c3)](_0x12e61f[_0x5d8c76(0x165)],_0x151098[_0x5d8c76(0x23b)],{'description':_0x12e61f[_0x5d8c76(0x20d)],'rule':_0x3559f1(_0x12e61f[_0x5d8c76(0x1dc)],!![]),'countPopulation':!![]}),_0x27cb4b=_0x151098[_0x5d8c76(0x23b)];else throw new SDKError(ErrorCode[_0x5d8c76(0x15b)],'Embedded\x20segment\x20\x27'+_0x12e61f[_0x5d8c76(0x1fa)]+_0x5d8c76(0x17d)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x469a09[_0x5d8c76(0x1a4)]['replace'](/([^/]+)$/,_0x5d8c76(0x147))+')\x20')+_0x5d8c76(0x176),_0x35b4d3);}else throw _0x35b4d3;}return saveSegmentToPushRecovery(_0x469a09[_0x5d8c76(0x1a4)],_0x469a09[_0x5d8c76(0x19b)][_0x5d8c76(0x19e)],_0x12e61f[_0x5d8c76(0x1fa)],{'segmentId':_0x27cb4b,'uniqueServerName':_0x12e61f[_0x5d8c76(0x171)],'createdAt':new Date()[_0x5d8c76(0x14a)]()}),_0x27cb4b;}function a152_0x57d7(_0xa67ad2,_0xe04426){_0xa67ad2=_0xa67ad2-0x147;const _0x2ff589=a152_0x2ff5();let _0x57d70b=_0x2ff589[_0xa67ad2];return _0x57d70b;}export async function prepareSegmentFiles(_0x4c25c1,_0x5d99c7,_0x5cd59a,_0x2d64e0,_0xf2e2b5){const _0x547d0f=a152_0x547b34,{activationDefToCreateRequest:_0xeeb588}=await import(_0x547d0f(0x210)),_0xbc970=[],_0x4d6c55=new Set();for(const {yamlConfig:_0x1f12bb,folderPath:_0x2ce1c8,sourcePath:_0xeb31a7}of _0x4c25c1){const _0x43de31=resolveTDFolderPath(_0x2ce1c8,_0x2d64e0,_0xf2e2b5),_0x47348a=_0x43de31+':'+_0x1f12bb['name'],_0x32e662=_0x5d99c7[_0x547d0f(0x198)][_0x547d0f(0x1ff)](_0x47348a),_0x4b03b9=_0x32e662?_0x5d99c7['activationsBySegmentId'][_0x547d0f(0x1ff)](_0x32e662['id'])||[]:[];addFoldersToCreate(_0x43de31,_0x5d99c7[_0x547d0f(0x197)],_0x4d6c55);const _0x212edc=calculateActivationActions(_0x1f12bb[_0x547d0f(0x21e)]||[],_0x4b03b9,_0x5d99c7[_0x547d0f(0x193)],_0x5d99c7[_0x547d0f(0x1c8)]);for(const _0x4690ea of _0x212edc){(_0x4690ea['type']===_0x547d0f(0x1c0)||_0x4690ea[_0x547d0f(0x1e0)]==='update')&&_0x4690ea[_0x547d0f(0x18f)]&&(_0x4690ea[_0x547d0f(0x1e6)]=await _0xeeb588(_0x4690ea['yamlActivation'],_0x5cd59a));}const _0x935b74=calculateSegmentDiff(_0x1f12bb,_0x32e662,_0x4b03b9,_0x5d99c7[_0x547d0f(0x193)],_0x5d99c7[_0x547d0f(0x1c8)]);_0xbc970[_0x547d0f(0x202)]({'relativePath':_0x1f12bb[_0x547d0f(0x19e)],'absolutePath':_0xeb31a7,'yamlConfig':_0x1f12bb,'folderPath':_0x43de31,'existingSegment':_0x32e662,'existingActivations':_0x4b03b9,'isNew':_0x935b74['isNew'],'hasChanges':_0x935b74[_0x547d0f(0x149)],'diff':_0x935b74[_0x547d0f(0x15c)],'activationActions':_0x212edc});}return{'segmentFiles':_0xbc970,'foldersToCreate':_0x4d6c55};}export async function prepareJourneyFiles(_0x1c52dd,_0x3fe5ec,_0xaf524e,_0x36d46b){const _0xd8c6c8=a152_0x547b34,_0x274dab=[],_0x1f5f1b=new Set();for(const {yamlConfig:_0x4ade12,folderPath:_0x47ffd5,sourcePath:_0x85362c}of _0x1c52dd){const _0x54b409=resolveTDFolderPath(_0x47ffd5,_0xaf524e,_0x36d46b),_0x33d3c6=_0x54b409+':'+_0x4ade12['name'],_0x232484=_0x3fe5ec[_0xd8c6c8(0x1e8)][_0xd8c6c8(0x1ff)](_0x33d3c6);let _0x26c753,_0x371817;if(_0x232484&&_0x232484[_0xd8c6c8(0x189)]>0x0){const _0x238af3=buildLocalExpandedRuleMappings(_0x4ade12),{createYamlContext:_0x43ab7a,prefetchJourneySegments:_0x2d80f1}=createPushYamlContextForBundle(_0x3fe5ec['deps'],_0x3fe5ec[_0xd8c6c8(0x165)],_0x3fe5ec[_0xd8c6c8(0x20b)],_0x238af3,_0x3fe5ec['idToEmailMap'],_0x3fe5ec[_0xd8c6c8(0x1c8)],_0x3fe5ec[_0xd8c6c8(0x1d6)],_0x3fe5ec[_0xd8c6c8(0x1cf)]);await _0x2d80f1(_0x232484['map'](_0x4e826c=>_0x4e826c['id']));const _0x127f88=await _0x3fe5ec[_0xd8c6c8(0x237)][_0xd8c6c8(0x1d2)][_0xd8c6c8(0x223)](_0x232484[0x0][_0xd8c6c8(0x21a)]),_0x2907e9=hasMultipleVersions(_0x4ade12),_0x32ca88=async _0x3e5372=>{const _0x5b260a=_0xd8c6c8,_0xe59ed7=_0x3fe5ec[_0x5b260a(0x1cf)]?.['get'](_0x3e5372);if(_0xe59ed7)return _0xe59ed7;return _0x3fe5ec[_0x5b260a(0x1d1)]({'journeyId':_0x3e5372,'journeyName':_0x4ade12[_0x5b260a(0x19e)],'isMultiVersion':_0x232484[_0x5b260a(0x189)]>0x1});};if(_0x2907e9&&_0x232484['length']>0x1){const _0x51ef3f=[];for(const _0x315f2e of _0x232484){const _0x297153=_0x315f2e[_0xd8c6c8(0x1db)]||0x1;_0x3fe5ec[_0xd8c6c8(0x1a9)]?.[_0xd8c6c8(0x16e)](_0xd8c6c8(0x1dd)+_0x4ade12[_0xd8c6c8(0x19e)]+'\x20v'+_0x297153);const _0x15bb57=await _0x32ca88(_0x315f2e['id']),_0x326461=_0x43ab7a(_0x315f2e['id']),_0x36d4d3=await journeyResponseToDef(_0x15bb57,_0x326461);_0x51ef3f['push']({'item':_0x315f2e,'yaml':_0x36d4d3});}const _0x5df5f0=buildLocalRuleToNameMappingFromJourney(_0x4ade12);_0x371817=buildMergedJourneyDef(_0x51ef3f,_0x5df5f0,_0x127f88);const _0x2852fd=Math[_0xd8c6c8(0x14c)](..._0x51ef3f['map'](_0x233517=>_0x233517[_0xd8c6c8(0x224)][_0xd8c6c8(0x1db)]||0x0)),_0xd87b5d=_0x232484[_0xd8c6c8(0x1a5)](_0x80a182=>(_0x80a182[_0xd8c6c8(0x1db)]||0x0)===_0x2852fd);_0xd87b5d&&(_0x3fe5ec[_0xd8c6c8(0x1a9)]?.[_0xd8c6c8(0x16e)](_0xd8c6c8(0x1dd)+_0x4ade12['name']+'\x20v'+_0x2852fd),_0x26c753=await _0x32ca88(_0xd87b5d['id']));}else{const _0x4c35ad=_0x232484[_0x232484[_0xd8c6c8(0x189)]-0x1];_0x3fe5ec[_0xd8c6c8(0x1a9)]?.[_0xd8c6c8(0x16e)](_0xd8c6c8(0x1dd)+_0x4ade12[_0xd8c6c8(0x19e)]),_0x26c753=await _0x32ca88(_0x4c35ad['id']);const _0x118350=_0x43ab7a(_0x4c35ad['id']),_0x202e53=await journeyResponseToDef(_0x26c753,_0x118350),_0x40c45d=buildLocalRuleToNameMappingFromJourney(_0x4ade12);_0x371817=buildMergedJourneyDef([{'item':_0x4c35ad,'yaml':_0x202e53}],_0x40c45d,_0x127f88);}}addFoldersToCreate(_0x54b409,_0x3fe5ec['folderPathToId'],_0x1f5f1b);const _0x195acf=calculateJourneyDiff(_0x4ade12,_0x371817);_0x274dab[_0xd8c6c8(0x202)]({'relativePath':_0x4ade12['name'],'absolutePath':_0x85362c,'yamlConfig':_0x4ade12,'folderPath':_0x54b409,'existingJourney':_0x26c753,'isNew':_0x195acf['isNew'],'hasChanges':_0x195acf[_0xd8c6c8(0x149)],'diff':_0x195acf['diff']});}return{'journeyFiles':_0x274dab,'foldersToCreate':_0x1f5f1b};}export function calculateActivationActions(_0x2b0c8b,_0x48c460,_0x50f694,_0x14e994){const _0x155af2=a152_0x547b34,_0xf528ea=[],_0x5c51f9=new Map();for(const _0x5b38a0 of _0x48c460){_0x5c51f9[_0x155af2(0x22f)](_0x5b38a0[_0x155af2(0x19e)],_0x5b38a0);}const _0x1f8961=new Map();for(const _0x480e47 of _0x2b0c8b){_0x1f8961[_0x155af2(0x22f)](_0x480e47[_0x155af2(0x19e)],_0x480e47);}for(const _0x4c2714 of _0x2b0c8b){const _0x4daf1b=_0x5c51f9[_0x155af2(0x1ff)](_0x4c2714[_0x155af2(0x19e)]);if(!_0x4daf1b)_0xf528ea[_0x155af2(0x202)]({'type':_0x155af2(0x1c0),'name':_0x4c2714['name'],'yamlActivation':_0x4c2714});else{const _0x2a1be3=activationResponseToDef(_0x4daf1b,_0x50f694,_0x14e994),_0x1c4376=a152_0x2edd9c[_0x155af2(0x1f4)](_0x2a1be3),_0x562611=a152_0x2edd9c[_0x155af2(0x1f4)](_0x4c2714);_0x1c4376!==_0x562611&&_0xf528ea['push']({'type':_0x155af2(0x16e),'name':_0x4c2714[_0x155af2(0x19e)],'yamlActivation':_0x4c2714,'existingActivation':_0x4daf1b});}}for(const _0x166911 of _0x48c460){!_0x1f8961[_0x155af2(0x242)](_0x166911[_0x155af2(0x19e)])&&_0xf528ea['push']({'type':_0x155af2(0x1a6),'name':_0x166911[_0x155af2(0x19e)],'existingActivation':_0x166911});}return _0xf528ea;}function calculateYamlDiff(_0xcbc963,_0x55ed3b){if(_0x55ed3b){const _0x191931=generateDiff(_0x55ed3b,_0xcbc963),_0x4edc1d=hasChanges(_0x191931);return{'isNew':![],'hasChanges':_0x4edc1d,'diff':_0x4edc1d?formatDiffWithColors(_0x191931):undefined};}const _0x50b989=generateDiff('',_0xcbc963);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x50b989)};}export function calculateSegmentDiff(_0x33acd2,_0x448dcd,_0x4151d2,_0x2695b2,_0x411e79){const _0x17df91=segmentToYamlString(_0x33acd2),_0x1aed88=_0x448dcd?segmentToYamlString(segmentWithActivationsToYaml(_0x448dcd,_0x4151d2,undefined,_0x2695b2,_0x411e79)):undefined;return calculateYamlDiff(_0x17df91,_0x1aed88);}export function calculateJourneyDiff(_0x5f2eb5,_0x23dd6c){const _0x164523=normalizeJourneyDef(_0x5f2eb5,_0x5f2eb5),_0x15b739=a152_0x3aa9ed(_0x164523),_0x4aa784=_0x23dd6c?a152_0x3aa9ed(normalizeJourneyDef(_0x23dd6c,_0x5f2eb5)):undefined;return calculateYamlDiff(_0x15b739,_0x4aa784);}export function findSegmentsToDelete(_0x47b199,_0x3d71b,_0x390196,_0x35ffc6,_0x98bcd6){const _0xbb9678=a152_0x547b34,_0x41dd77=new Set();for(const {yamlConfig:_0x4ba77b,folderPath:_0x32a27f}of _0x3d71b){_0x41dd77[_0xbb9678(0x19d)](_0x32a27f+':'+_0x4ba77b[_0xbb9678(0x19e)]);}return _0x47b199[_0xbb9678(0x245)](_0x1509bc=>{const _0x2dfa4f=_0xbb9678,_0x52ad32=_0x1509bc['segmentFolderId']?_0x390196[_0x2dfa4f(0x1ff)](_0x1509bc[_0x2dfa4f(0x1e9)][_0x2dfa4f(0x157)]())||'':'',_0x2eeaf4=_0x52ad32+':'+_0x1509bc[_0x2dfa4f(0x19e)];if(_0x41dd77[_0x2dfa4f(0x242)](_0x2eeaf4))return![];if(_0x98bcd6)return _0x52ad32===_0x35ffc6||_0x52ad32[_0x2dfa4f(0x247)](_0x35ffc6+'/');return!![];});}export function findJourneysToDelete(_0x3504a8,_0x5bcaa9,_0x45e298,_0x4bbab8,_0x1988f3){const _0x1f1ffc=a152_0x547b34,_0x1e3c72=new Set();for(const {yamlConfig:_0x9698ab,folderPath:_0x1c0f43}of _0x5bcaa9){_0x1e3c72['add'](_0x1c0f43+':'+_0x9698ab[_0x1f1ffc(0x19e)]);}return _0x3504a8[_0x1f1ffc(0x245)](_0x4b9062=>{const _0x9904ef=_0x1f1ffc,_0x3a84bf=_0x4b9062[_0x9904ef(0x1f1)]?_0x45e298['get'](_0x4b9062[_0x9904ef(0x1f1)])||'':'',_0x3018e4=_0x3a84bf+':'+_0x4b9062[_0x9904ef(0x22a)];if(_0x1e3c72['has'](_0x3018e4))return![];if(_0x1988f3)return _0x3a84bf===_0x4bbab8||_0x3a84bf['startsWith'](_0x4bbab8+'/');return!![];});}export function buildSegmentLookupMap(_0x14e185,_0x432afd){const _0xc14349=a152_0x547b34,_0x3b43ed=new Map();for(const _0x274eed of _0x14e185){const _0xceeffe=_0x274eed[_0xc14349(0x1e9)]?_0x432afd['get'](_0x274eed['segmentFolderId'][_0xc14349(0x157)]())||'':'',_0x4d5beb=_0xceeffe+':'+_0x274eed['name'];_0x3b43ed[_0xc14349(0x22f)](_0x4d5beb,_0x274eed);}return _0x3b43ed;}export function buildSegmentNameToIdMap(_0x4eb3a1){const _0x40c71f=a152_0x547b34,_0x19656d=new Map();for(const _0x1edbb3 of _0x4eb3a1){_0x19656d[_0x40c71f(0x22f)](_0x1edbb3[_0x40c71f(0x19e)],_0x1edbb3['id']);}return _0x19656d;}export function buildJourneyBundleLookupMap(_0x209ccb,_0x3e3edb){const _0x2c8d13=a152_0x547b34,_0x56d1e9=new Map();for(const _0xdb4db4 of _0x209ccb){const _0x224fa2=_0xdb4db4[_0x2c8d13(0x1f1)]?_0x3e3edb[_0x2c8d13(0x1ff)](_0xdb4db4[_0x2c8d13(0x1f1)])||'':'',_0x19aaa9=_0x224fa2+':'+_0xdb4db4['journeyBundleName'];!_0x56d1e9[_0x2c8d13(0x242)](_0x19aaa9)&&_0x56d1e9[_0x2c8d13(0x22f)](_0x19aaa9,[]),_0x56d1e9[_0x2c8d13(0x1ff)](_0x19aaa9)['push'](_0xdb4db4);}for(const _0xa31830 of _0x56d1e9['values']()){_0xa31830[_0x2c8d13(0x1d3)]((_0x55ed8d,_0x374b8d)=>(_0x55ed8d[_0x2c8d13(0x1db)]||0x0)-(_0x374b8d[_0x2c8d13(0x1db)]||0x0));}return _0x56d1e9;}export function collectFoldersToCreate(_0xfbcfc0,_0x5d7df4){const _0x1f8674=a152_0x547b34,_0x31953e=new Set();for(const _0x5b34f2 of _0xfbcfc0){if(!_0x5b34f2)continue;if(_0x5d7df4[_0x1f8674(0x242)](_0x5b34f2))continue;const _0x25bdd2=_0x5b34f2[_0x1f8674(0x1f7)]('/');let _0x4b1df6='';for(const _0x3276e1 of _0x25bdd2){_0x4b1df6=_0x4b1df6?_0x4b1df6+'/'+_0x3276e1:_0x3276e1,!_0x5d7df4[_0x1f8674(0x242)](_0x4b1df6)&&_0x31953e[_0x1f8674(0x19d)](_0x4b1df6);}}return _0x31953e;}export function parseAndClassifyYamlFiles(_0x256426,_0x2c96a1,_0xbdb643){const _0x46778e=a152_0x547b34,_0x2db356=[],_0x1e3c3d=[];for(const _0x1a04ea of _0x256426){const _0x5979db=a152_0x339632[_0x46778e(0x1f5)](_0x2c96a1,a152_0x339632[_0x46778e(0x240)](_0x1a04ea)),_0x5d8874=_0x5979db==='.'?'':_0x5979db['replace'](/\\/g,'/'),_0x172b6c=readFileSync(_0x1a04ea,_0x46778e(0x231)),_0x9bdfc9=a152_0x2edd9c['parse'](_0x172b6c);if(isJourneyDef(_0x9bdfc9)){const _0x618835=a152_0x27da22(_0x172b6c);_0x1e3c3d[_0x46778e(0x202)]({'yamlConfig':_0x618835,'folderPath':_0x5d8874,'sourcePath':_0x1a04ea});}else{if(!_0xbdb643?.[_0x46778e(0x19f)]){const _0x5316bf=parseSegmentYamlFile(_0x172b6c),_0x27b453=normalizeChildSegmentYaml(_0x5316bf);_0x2db356[_0x46778e(0x202)]({'yamlConfig':_0x27b453,'folderPath':_0x5d8874,'sourcePath':_0x1a04ea});}}}return{'segments':_0x2db356,'journeys':_0x1e3c3d};}export function validateParsedFiles(_0x25d3d3,_0x38ad34){const _0x5a5c4f=a152_0x547b34,_0x157c5a=[];for(const {yamlConfig:_0x7be0e1,sourcePath:_0x314524}of _0x25d3d3[_0x5a5c4f(0x219)]){const _0x90ae9c=readFileSync(_0x314524,_0x5a5c4f(0x231)),_0x2b72ab=a152_0x2edd9c[_0x5a5c4f(0x19a)](_0x90ae9c),_0x5a8eec=validateSegmentDef(_0x7be0e1,{'source':_0x90ae9c,'document':_0x2b72ab},{'skipSchema':!![]});if(!_0x5a8eec[_0x5a5c4f(0x205)]){const _0x3b8531=a152_0x339632[_0x5a5c4f(0x1f5)](_0x38ad34,_0x314524);_0x157c5a[_0x5a5c4f(0x202)]({'filePath':_0x3b8531,'source':_0x90ae9c,'result':_0x5a8eec,'isJourney':![]});}}for(const {yamlConfig:_0x5d15c5,sourcePath:_0x4f5a89}of _0x25d3d3[_0x5a5c4f(0x1f9)]){const _0x402f3c=readFileSync(_0x4f5a89,_0x5a5c4f(0x231)),_0x3be16b=a152_0x2edd9c['parseDocument'](_0x402f3c),_0x384844=validateJourneyDef(_0x5d15c5,{'source':_0x402f3c,'document':_0x3be16b},{'skipSchema':!![]});if(!_0x384844[_0x5a5c4f(0x205)]){const _0x47ccbc=a152_0x339632[_0x5a5c4f(0x1f5)](_0x38ad34,_0x4f5a89);_0x157c5a['push']({'filePath':_0x47ccbc,'source':_0x402f3c,'result':_0x384844,'isJourney':!![]});}}return _0x157c5a;}export function formatValidationErrors(_0x41ddb8){const _0x19030a=a152_0x547b34,_0x179b39=[];for(const {filePath:_0x59be94,source:_0x1ccf9c,result:_0x46df7f,isJourney:_0x430402}of _0x41ddb8){const _0x1a3c4b=_0x430402?_0x19030a(0x1d2):_0x19030a(0x244);_0x179b39[_0x19030a(0x202)]('\x0a'+_0x59be94+'\x20('+_0x1a3c4b+'):\x20'+_0x46df7f[_0x19030a(0x161)][_0x19030a(0x189)]+_0x19030a(0x175)),_0x179b39[_0x19030a(0x202)](formatValidationResult(_0x46df7f,_0x1ccf9c,_0x59be94));}return _0x179b39['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x1adc1b){const _0x2c5c2a=a152_0x547b34,_0x2687cf=new Set(),_0x2511b0=new Map(),_0x2c68ad=collectSegmentUsageCounts(_0x1adc1b);if(_0x1adc1b[_0x2c5c2a(0x219)])for(const [_0x3e15b8,_0x433793]of Object[_0x2c5c2a(0x168)](_0x1adc1b[_0x2c5c2a(0x219)])){_0x2687cf['add'](_0x3e15b8);if(_0x433793['rule']){const _0x382c86=yamlRuleToApi(_0x433793[_0x2c5c2a(0x14b)]),_0x1b68e4=apiRuleToYaml(_0x382c86);_0x2511b0['set'](_0x3e15b8,_0x1b68e4);}}const _0x1d5f2e=new Map();let _0x36543c=0x0;for(const [_0x37dea3,_0x10f7f8]of _0x2511b0){const _0x2b4e45=serializeExpandedRule(_0x10f7f8,_0x2511b0),_0x1be5c8=_0x1d5f2e[_0x2c5c2a(0x1ff)](_0x2b4e45)||[];_0x1be5c8['push']({'name':_0x37dea3,'index':_0x36543c}),_0x1d5f2e[_0x2c5c2a(0x22f)](_0x2b4e45,_0x1be5c8),_0x36543c++;}const _0x568f4a=new Map();for(const [_0x3ae46a,_0x25ec82]of _0x1d5f2e){const _0x571890=_0x25ec82[_0x2c5c2a(0x23f)]()['sort']((_0x3de692,_0xe53ff)=>{const _0x4253da=_0x2c5c2a,_0x39ea30=_0x2c68ad[_0x4253da(0x1ff)](_0x3de692[_0x4253da(0x19e)])||0x0,_0x5ca007=_0x2c68ad[_0x4253da(0x1ff)](_0xe53ff[_0x4253da(0x19e)])||0x0;if(_0x39ea30!==_0x5ca007)return _0x5ca007-_0x39ea30;return _0x3de692['index']-_0xe53ff[_0x4253da(0x236)];})[_0x2c5c2a(0x1a1)](_0xa84a6b=>_0xa84a6b[_0x2c5c2a(0x19e)]),_0xe99dfc=[];for(const _0x129eee of _0x571890){const _0x2a00b6=_0x2c68ad['get'](_0x129eee)||0x0,_0x4fa7ca=Math['max'](_0x2a00b6,0x1);for(let _0x2a9d17=0x0;_0x2a9d17<_0x4fa7ca;_0x2a9d17++){_0xe99dfc[_0x2c5c2a(0x202)](_0x129eee);}}_0x568f4a[_0x2c5c2a(0x22f)](_0x3ae46a,_0xe99dfc);}return{'existingLocalSegmentNames':_0x2687cf,'localSegmentRules':_0x2511b0,'localExpandedRuleToNames':_0x568f4a};}export function createSegmentIdResolver(_0xe65d50,_0x1bbebf){return async _0x449d4e=>{const _0xeedc99=a152_0x57d7,_0x6f8fc4=_0xe65d50[_0xeedc99(0x1ff)](_0x449d4e);if(!_0x6f8fc4)throw new SDKError(ErrorCode[_0xeedc99(0x1f2)],'Segment\x20not\x20found:\x20'+_0x449d4e+_0xeedc99(0x23e)+_0x1bbebf+'\x27)');return _0x6f8fc4;};}export function extractRootFolderId(_0x565a6f){const _0x186972=a152_0x547b34;return _0x565a6f['relationships']?.[_0x186972(0x1d4)]?.[_0x186972(0x228)]?.['id']||_0x565a6f['relationships']?.['parentFolder']?.[_0x186972(0x228)]?.['id'];}export function buildConnectionMaps(_0x4386ee){const _0x1b7993=a152_0x547b34,_0xac8844=new Map(),_0x1bdbb3=new Map(),_0x30d22f=new Map();for(const _0x315d05 of _0x4386ee){_0xac8844['set'](_0x315d05['name'],parseInt(_0x315d05['id'],0xa)),_0x1bdbb3['set'](_0x315d05['id'],_0x315d05[_0x1b7993(0x19e)]),_0x30d22f[_0x1b7993(0x22f)](_0x315d05[_0x1b7993(0x19e)],_0x315d05['type']);}return{'nameToId':_0xac8844,'idToName':_0x1bdbb3,'nameToType':_0x30d22f};}export function calculatePushStats(_0x2a88d4,_0x33f8b1,_0x454dcf,_0x2eb637,_0x10cc3d,_0x2dcf9f,_0xe001fd){const _0x3064f4=a152_0x547b34,_0x234709=_0x2a88d4[_0x3064f4(0x245)](_0x251886=>_0x251886['isNew']),_0x63be0d=_0x2a88d4['filter'](_0x5a5817=>!_0x5a5817[_0x3064f4(0x239)]&&_0x5a5817[_0x3064f4(0x149)]),_0xaa1337=_0x2a88d4[_0x3064f4(0x245)](_0x4b0d34=>!_0x4b0d34['isNew']&&!_0x4b0d34['hasChanges']),_0x1e3878=_0x2dcf9f?_0x2eb637:[],_0x229896=_0x33f8b1[_0x3064f4(0x245)](_0x247432=>_0x247432[_0x3064f4(0x239)]),_0x25ff59=_0x33f8b1['filter'](_0x269262=>!_0x269262[_0x3064f4(0x239)]&&_0x269262[_0x3064f4(0x149)]),_0x3a8780=_0x33f8b1[_0x3064f4(0x245)](_0x20def6=>!_0x20def6['isNew']&&!_0x20def6['hasChanges']),_0x175ede=_0x2dcf9f?_0x10cc3d:[],_0x5dc12d=_0x2a88d4[_0x3064f4(0x173)](_0x5586e2=>_0x5586e2[_0x3064f4(0x218)]),_0x73a333=_0x5dc12d['filter'](_0xbdaacf=>_0xbdaacf[_0x3064f4(0x1e0)]==='create'),_0x1dc16d=_0x5dc12d['filter'](_0x44e4ba=>_0x44e4ba[_0x3064f4(0x1e0)]===_0x3064f4(0x16e)),_0x28bb8d=_0x5dc12d[_0x3064f4(0x245)](_0x2e8622=>_0x2e8622[_0x3064f4(0x1e0)]==='delete'),_0x51d35c=Array[_0x3064f4(0x16f)](_0x454dcf)[_0x3064f4(0x1d3)](),_0x27ed43=_0xe001fd?![]:_0x234709['length']>0x0||_0x63be0d[_0x3064f4(0x189)]>0x0||_0x1e3878[_0x3064f4(0x189)]>0x0,_0x1935a6=_0x229896['length']>0x0||_0x25ff59['length']>0x0||_0x175ede[_0x3064f4(0x189)]>0x0,_0x3bbd21=_0xe001fd?![]:_0x5dc12d[_0x3064f4(0x189)]>0x0,_0xae4f8d=_0x51d35c['length']>0x0;return{'segments':{'new':_0x234709,'changed':_0x63be0d,'unchanged':_0xaa1337,'toDelete':_0x1e3878},'journeys':{'new':_0x229896,'changed':_0x25ff59,'unchanged':_0x3a8780,'toDelete':_0x175ede},'activations':{'all':_0x5dc12d,'toCreate':_0x73a333,'toUpdate':_0x1dc16d,'toDelete':_0x28bb8d},'folders':{'toCreate':_0x51d35c},'counts':{'segments':{'new':_0x234709[_0x3064f4(0x189)],'changed':_0x63be0d[_0x3064f4(0x189)],'unchanged':_0xaa1337[_0x3064f4(0x189)],'toDelete':_0x1e3878[_0x3064f4(0x189)]},'journeys':{'new':_0x229896[_0x3064f4(0x189)],'changed':_0x25ff59[_0x3064f4(0x189)],'unchanged':_0x3a8780[_0x3064f4(0x189)],'toDelete':_0x175ede[_0x3064f4(0x189)]},'activations':{'create':_0x73a333[_0x3064f4(0x189)],'update':_0x1dc16d[_0x3064f4(0x189)],'delete':_0x28bb8d[_0x3064f4(0x189)]},'folders':_0x51d35c[_0x3064f4(0x189)]},'hasChanges':_0x27ed43||_0x1935a6||_0x3bbd21||_0xae4f8d};}export async function buildPushExecutionContext(_0x553d6c,_0x5a2c69,_0x461208,_0x38ff02,_0x477fe8,_0x449392){const _0x587811=a152_0x547b34,_0x24f42d=extractRootFolderId(_0x461208),{pathToId:_0xcaae49,idToPath:_0x2d4b9a}=buildFolderMaps(_0x477fe8),_0x1262ca=buildSegmentNameToIdMap(_0x38ff02),_0x12085e=new Map(),{batchAsync:_0x38ea96}=await import(_0x587811(0x23d)),[_0x83165c,_0x5e0341]=await Promise['all']([_0x553d6c[_0x587811(0x188)][_0x587811(0x209)](),_0x553d6c['connection'][_0x587811(0x1fb)](),((async()=>{const _0x49d397=_0x587811;!_0x449392&&_0x38ff02[_0x49d397(0x189)]>0x0&&await _0x38ea96(_0x38ff02,async _0x4a3c8f=>{const _0x373360=_0x49d397,_0x50ef78=await _0x553d6c[_0x373360(0x244)][_0x373360(0x249)](_0x5a2c69,_0x4a3c8f['id']);_0x12085e['set'](_0x4a3c8f['id'],_0x50ef78);});})())]),{emailToId:_0x4043ce,idToEmail:_0x39bbd7}=_0x83165c,_0x4a343a=buildConnectionMaps(_0x5e0341);return{'rootFolderId':_0x24f42d,'folderPathToId':_0xcaae49,'folderIdToPath':_0x2d4b9a,'segmentNameToId':_0x1262ca,'activationsBySegmentId':_0x12085e,'emailToIdMap':_0x4043ce,'idToEmailMap':_0x39bbd7,'connectionNameToIdMap':_0x4a343a['nameToId'],'connectionIdToNameMap':_0x4a343a[_0x587811(0x1a8)],'connectionNameToTypeMap':_0x4a343a[_0x587811(0x207)]};}export function createPushYamlContextForBundle(_0x272510,_0x15dbdf,_0x2b1bde,_0x349010,_0x11452f,_0x4f8a12,_0x596df2,_0x595922){const {existingLocalSegmentNames:_0x6e6817,localExpandedRuleToNames:_0x213d38}=_0x349010,_0x264928=new Set(),_0x227c52=new Map(),_0x591bf5=new Map(),_0x1f8e1f=new Map(),_0x48aacd=createJumpTargetCache(),_0x2fe59f=new Map(),_0x5e60d6=new Map(),_0x2cad72=new Set();let _0x4056ed;const _0xff15a=_0x122c92=>{const _0x367b48={'resolveSegment':async _0x87a69f=>{const _0x3c31c2=a152_0x57d7,_0x1685de=_0x1f8e1f[_0x3c31c2(0x1ff)](_0x87a69f);if(_0x1685de!==undefined)return{'name':_0x1685de,'isJourneyLocal':!![]};try{const _0x37abfb=await fetchSegment(_0x272510,_0x15dbdf,_0x87a69f,_0x2b1bde);if(!_0x37abfb)throw new Error(_0x3c31c2(0x163));const _0x2c74f6=generateJourneyLocalName(_0x37abfb[_0x3c31c2(0x19e)]),_0xa0fa0f=_0x37abfb['kind']===SEGMENT_KIND_JOURNEY&&_0x2c74f6!==undefined;let _0x3ddc67=_0x37abfb[_0x3c31c2(0x19e)],_0x2128d5;if(_0xa0fa0f&&_0x37abfb[_0x3c31c2(0x14b)]){const _0x267bd8=apiRuleToYaml(_0x37abfb[_0x3c31c2(0x14b)]);_0x5e60d6[_0x3c31c2(0x22f)](_0x87a69f,_0x267bd8);const _0x3063aa=async _0x2a8912=>{const _0x51b942=_0x3c31c2,_0x571dc9=collectSegmentRefsFromRule(_0x2a8912);for(const _0x2efbde of _0x571dc9){if(!_0x5e60d6[_0x51b942(0x242)](_0x2efbde))try{const _0x32717a=await fetchSegment(_0x272510,_0x15dbdf,_0x2efbde,_0x2b1bde);if(_0x32717a?.['rule']){const _0xf2f2ef=apiRuleToYaml(_0x32717a[_0x51b942(0x14b)]);_0x5e60d6[_0x51b942(0x22f)](_0x2efbde,_0xf2f2ef),await _0x3063aa(_0xf2f2ef);}}catch(_0x627297){logger[_0x51b942(0x235)](_0x51b942(0x1bd)+_0x2efbde+':\x20'+_0x627297);}}};await _0x3063aa(_0x267bd8);const _0x30a560=serializeExpandedRule(_0x267bd8,_0x5e60d6),_0x5aabc2=_0x213d38[_0x3c31c2(0x1ff)](_0x30a560);if(_0x5aabc2&&_0x5aabc2[_0x3c31c2(0x189)]>0x0){const _0x506309=_0x227c52[_0x3c31c2(0x1ff)](_0x30a560)||0x0,_0x1f9aee=_0x5aabc2[_0x506309]||_0x5aabc2[_0x5aabc2['length']-0x1];_0x227c52[_0x3c31c2(0x22f)](_0x30a560,_0x506309+0x1),_0x3ddc67=_0x1f9aee,_0x264928[_0x3c31c2(0x19d)](_0x3ddc67),_0x1f8e1f[_0x3c31c2(0x22f)](_0x87a69f,_0x3ddc67);const _0x15aa1d=await resolveRuleSegmentRefs(_0x267bd8,async _0x918b21=>{const _0x6ad2d8=_0x3c31c2,_0xcdc2a2=_0x1f8e1f[_0x6ad2d8(0x1ff)](_0x918b21);if(_0xcdc2a2)return _0xcdc2a2;const _0x469371=await _0x4056ed[_0x6ad2d8(0x17f)](_0x918b21);return _0x469371[_0x6ad2d8(0x19e)];});_0x2128d5={'description':_0x37abfb[_0x3c31c2(0x20d)],'rule':_0x15aa1d};}else{const _0x147d9f=_0x2fe59f['get'](_0x30a560);if(_0x147d9f)_0x3ddc67=_0x147d9f,_0x1f8e1f[_0x3c31c2(0x22f)](_0x87a69f,_0x3ddc67);else{if(_0x2c74f6){let _0x140c59=_0x2c74f6,_0x5e49c9=0x2;while(_0x264928[_0x3c31c2(0x242)](_0x140c59)||_0x6e6817['has'](_0x140c59)){_0x140c59=_0x2c74f6+'_'+_0x5e49c9,_0x5e49c9++;}_0x264928[_0x3c31c2(0x19d)](_0x140c59),_0x3ddc67=_0x140c59;}_0x1f8e1f[_0x3c31c2(0x22f)](_0x87a69f,_0x3ddc67),_0x2fe59f[_0x3c31c2(0x22f)](_0x30a560,_0x3ddc67);const _0x21801c=await resolveRuleSegmentRefs(_0x267bd8,async _0x485346=>{const _0x55a671=_0x3c31c2,_0x18285b=_0x1f8e1f['get'](_0x485346);if(_0x18285b)return _0x18285b;const _0x782da6=await _0x4056ed[_0x55a671(0x17f)](_0x485346);return _0x782da6[_0x55a671(0x19e)];});_0x2128d5={'description':_0x37abfb[_0x3c31c2(0x20d)],'rule':_0x21801c};}}}return{'name':_0x3ddc67,'isJourneyLocal':_0xa0fa0f,'definition':_0x2128d5};}catch(_0x29d5be){return logger[_0x3c31c2(0x235)](_0x3c31c2(0x16b)+_0x87a69f+':\x20'+_0x29d5be),{'name':_0x87a69f,'isJourneyLocal':![]};}},'resolveActivation':async _0xb9c740=>{const _0x350c33=a152_0x57d7,_0x5e8472=_0x591bf5['get'](_0xb9c740);if(_0x5e8472!==undefined)return{'name':_0x5e8472,'isJourneyLocal':!![]};try{let _0x1430f0=_0x596df2?.['get'](_0xb9c740);!_0x1430f0&&(_0x1430f0=await _0x272510[_0x350c33(0x1d2)]['getActivation'](_0x122c92,_0xb9c740));const _0x2ebd89=_0x1430f0[_0x350c33(0x24c)]['activationParams'][_0x350c33(0x19e)]||_0xb9c740,_0xf81cc5=sanitizeYamlKey(_0x2ebd89)||'activation_'+_0xb9c740,_0x60217d=_0xf81cc5;_0x591bf5[_0x350c33(0x22f)](_0xb9c740,_0x60217d);const _0x186e24=journeyActivationStepToYaml(_0x1430f0,_0x11452f,_0x4f8a12);return{'name':_0x60217d,'isJourneyLocal':!![],'definition':_0x186e24};}catch(_0x4d42b5){return logger[_0x350c33(0x235)](_0x350c33(0x1be)+_0xb9c740+':\x20'+_0x4d42b5),{'name':_0xb9c740,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x2a82e6,_0xd71d5e)=>resolveJumpTarget(_0x2a82e6,_0xd71d5e,_0x48aacd,async _0x27183b=>{const _0x555fb8=a152_0x57d7,_0x217c45=_0x595922?.[_0x555fb8(0x1ff)](_0x27183b);if(_0x217c45)return _0x217c45;return _0x272510[_0x555fb8(0x1d2)][_0x555fb8(0x164)](_0x27183b);})};return _0x4056ed=_0x367b48,_0x367b48;},_0x710666=async _0x19e7a9=>{const _0x1c69a6=a152_0x57d7,{collectSegmentIdsFromJourneyApi:_0x3b0ea7}=await import(_0x1c69a6(0x213)),{batchAsync:_0x514b7f}=await import(_0x1c69a6(0x23d)),_0x524ee0=new Set();for(const _0x47a80e of _0x19e7a9){let _0xbe378c=_0x595922?.[_0x1c69a6(0x1ff)](_0x47a80e);!_0xbe378c&&(_0xbe378c=await _0x272510[_0x1c69a6(0x1d2)][_0x1c69a6(0x164)](_0x47a80e));const _0x41626d=_0x3b0ea7(_0xbe378c);for(const _0x2be9f6 of _0x41626d){_0x524ee0[_0x1c69a6(0x19d)](_0x2be9f6);}}let _0x35f81b=Array[_0x1c69a6(0x16f)](_0x524ee0);while(_0x35f81b[_0x1c69a6(0x189)]>0x0){const _0x7526f7=_0x35f81b[_0x1c69a6(0x245)](_0x3e832e=>!_0x2cad72['has'](_0x3e832e));if(_0x7526f7[_0x1c69a6(0x189)]===0x0)break;const _0x474780=await _0x514b7f(_0x7526f7,async _0xef40eb=>{const _0xdc78a3=_0x1c69a6;_0x2cad72[_0xdc78a3(0x19d)](_0xef40eb);const _0x16c449=await fetchSegment(_0x272510,_0x15dbdf,_0xef40eb,_0x2b1bde);if(!_0x16c449)return null;return{'segmentId':_0xef40eb,'segment':_0x16c449};},0xa),_0x1703c6=new Set();for(const _0x47f2cb of _0x474780){if(!_0x47f2cb?.[_0x1c69a6(0x244)]?.[_0x1c69a6(0x14b)])continue;const _0x2fffd6=apiRuleToYaml(_0x47f2cb[_0x1c69a6(0x244)]['rule']);_0x5e60d6['set'](_0x47f2cb[_0x1c69a6(0x23b)],_0x2fffd6);const _0x3f3cee=collectSegmentRefsFromRule(_0x2fffd6);for(const _0x29299e of _0x3f3cee){!_0x2cad72[_0x1c69a6(0x242)](_0x29299e)&&_0x1703c6['add'](_0x29299e);}}_0x35f81b=Array[_0x1c69a6(0x16f)](_0x1703c6);}};return{'createYamlContext':_0xff15a,'prefetchJourneySegments':_0x710666};}export async function executePushSegments(_0x4bf5f0,_0x2c01b8,_0x20b00c,_0x511e9e,_0x343bca){const _0x57a46e=a152_0x547b34,{segmentDefToCreateRequest:_0x30f6ed,segmentDefToUpdateRequest:_0x6dd503}=await import('./child-segment-yaml.js'),_0x39059b=_0x20b00c[_0x57a46e(0x197)],_0x111024=0x5,_0x4c4a88=async _0x24c11d=>{const _0xc54177=_0x57a46e,_0x556e1b=_0x24c11d[_0xc54177(0x20c)]?_0x39059b[_0xc54177(0x1ff)](_0x24c11d[_0xc54177(0x20c)]):undefined;let _0x43fefc;const _0x13c977={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x5aa785=_0x24c11d['yamlConfig'];if(_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x14b)]){const _0x9de5e9=createSegmentIdResolver(_0x20b00c[_0xc54177(0x1eb)],_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]),_0x44753b=await resolveRuleSegmentIds(_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x14b)],_0x9de5e9);_0x5aa785={..._0x24c11d[_0xc54177(0x19b)],'rule':_0x44753b};}try{if(_0x24c11d['isNew']){_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x1aa),'name':_0x24c11d[_0xc54177(0x19b)]['name']});const _0x92cdaa=_0x30f6ed(_0x5aa785,_0x556e1b),_0x200cc2=await _0x343bca[_0xc54177(0x1b9)](_0xc54177(0x177)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+_0xc54177(0x1d0),()=>_0x4bf5f0[_0xc54177(0x244)]['createSegment'](_0x511e9e[_0xc54177(0x165)],_0x92cdaa));_0x43fefc=_0x200cc2[_0xc54177(0x228)]['id'],_0x20b00c['segmentNameToId'][_0xc54177(0x22f)](_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],_0x43fefc),_0x13c977[_0xc54177(0x24b)]={'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],'id':_0x43fefc},_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x243),'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],'segmentId':_0x43fefc}),_0x343bca[_0xc54177(0x158)]?.(_0xc54177(0x1a3)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+'\x27'),_0x13c977[_0xc54177(0x229)]=0x1;}else{if(_0x24c11d['hasChanges']){_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x1ec),'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]});const _0x451640=_0x6dd503(_0x5aa785);_0x556e1b!==_0x24c11d[_0xc54177(0x217)]?.[_0xc54177(0x1e9)]&&(_0x451640[_0xc54177(0x1e9)]=_0x556e1b?parseInt(_0x556e1b,0xa):undefined),await _0x343bca[_0xc54177(0x1b9)](_0xc54177(0x1ab)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+_0xc54177(0x1d0),()=>_0x4bf5f0['segment']['updateSegmentById'](_0x511e9e[_0xc54177(0x165)],_0x24c11d['existingSegment']['id'],_0x451640)),_0x43fefc=_0x24c11d['existingSegment']['id'],_0x343bca[_0xc54177(0x196)]?.({'type':_0xc54177(0x182),'name':_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]}),_0x343bca[_0xc54177(0x158)]?.(_0xc54177(0x1a2)+_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)]+'\x27'),_0x13c977[_0xc54177(0x15a)]=0x1;}else _0x43fefc=_0x24c11d[_0xc54177(0x217)]['id'];}}catch(_0x686bcb){const _0x3afd07=isHttp400Error(_0x686bcb),_0x1164d5=_0x3afd07?ErrorCode[_0xc54177(0x1bc)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x27e01a=getErrorMessage(_0x686bcb);throw new SDKError(_0x1164d5,_0xc54177(0x208)+(_0x24c11d['isNew']?_0xc54177(0x1c0):_0xc54177(0x16e))+_0xc54177(0x20f)+_0x24c11d['absolutePath']+_0xc54177(0x18d)+_0x27e01a,_0x686bcb);}try{const _0x1ed26e=await syncActivationsForSegment(_0x4bf5f0,_0x511e9e['parentId'],_0x43fefc,_0x24c11d[_0xc54177(0x19b)][_0xc54177(0x19e)],_0x24c11d[_0xc54177(0x218)],_0x343bca,_0x24c11d['absolutePath']);_0x13c977['activations']=_0x1ed26e;}catch(_0x1ff70f){if(_0x1ff70f instanceof SDKError)throw _0x1ff70f;throw new SDKError(ErrorCode[_0xc54177(0x1b1)],_0xc54177(0x153)+_0x24c11d[_0xc54177(0x19b)]['name']+'\x27\x20from\x20file:\x20'+_0x24c11d[_0xc54177(0x1a4)]+_0xc54177(0x18d)+getErrorMessage(_0x1ff70f),_0x1ff70f);}return _0x13c977;},_0x3e823e=await batchAsync(_0x2c01b8,_0x4c4a88,_0x111024),_0x2eff6d={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x265f90 of _0x3e823e){_0x2eff6d[_0x57a46e(0x229)]+=_0x265f90[_0x57a46e(0x229)],_0x2eff6d[_0x57a46e(0x15a)]+=_0x265f90[_0x57a46e(0x15a)],_0x265f90[_0x57a46e(0x24b)]&&_0x2eff6d[_0x57a46e(0x222)][_0x57a46e(0x22f)](_0x265f90[_0x57a46e(0x24b)][_0x57a46e(0x19e)],_0x265f90[_0x57a46e(0x24b)]['id']),_0x2eff6d[_0x57a46e(0x21e)][_0x57a46e(0x229)]+=_0x265f90[_0x57a46e(0x21e)][_0x57a46e(0x229)],_0x2eff6d['activations']['updated']+=_0x265f90[_0x57a46e(0x21e)]['updated'],_0x2eff6d[_0x57a46e(0x21e)][_0x57a46e(0x1e7)]+=_0x265f90['activations']['deleted'];}return _0x2eff6d;}async function syncActivationsForSegment(_0x1e865c,_0x4ba063,_0x1b7892,_0x461909,_0x43f95a,_0x1cc348,_0x3e719c){const _0xfc6ed8=a152_0x547b34,_0x3f9b48={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xd0f04a of _0x43f95a){try{if(_0xd0f04a[_0xfc6ed8(0x1e0)]===_0xfc6ed8(0x1c0)&&_0xd0f04a[_0xfc6ed8(0x1e6)])_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x1df),'segmentName':_0x461909,'activationName':_0xd0f04a['name']}),await _0x1cc348[_0xfc6ed8(0x1b9)](_0xfc6ed8(0x227)+_0xd0f04a[_0xfc6ed8(0x19e)]+_0xfc6ed8(0x1d0),()=>_0x1e865c[_0xfc6ed8(0x244)][_0xfc6ed8(0x230)](_0x4ba063,_0x1b7892,_0xd0f04a[_0xfc6ed8(0x1e6)])),_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x1ce),'segmentName':_0x461909,'activationName':_0xd0f04a['name']}),_0x1cc348[_0xfc6ed8(0x158)]?.(_0xfc6ed8(0x22b)+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27'),_0x3f9b48['created']++;else{if(_0xd0f04a[_0xfc6ed8(0x1e0)]===_0xfc6ed8(0x16e)&&_0xd0f04a[_0xfc6ed8(0x1e6)]&&_0xd0f04a[_0xfc6ed8(0x24a)])_0x1cc348[_0xfc6ed8(0x196)]?.({'type':'activation_updating','segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),await _0x1cc348[_0xfc6ed8(0x1b9)](_0xfc6ed8(0x199)+_0xd0f04a[_0xfc6ed8(0x19e)]+_0xfc6ed8(0x1d0),()=>_0x1e865c[_0xfc6ed8(0x244)]['updateActivation'](_0x4ba063,_0x1b7892,_0xd0f04a['existingActivation']['id'],_0xd0f04a[_0xfc6ed8(0x1e6)])),_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x156),'segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),_0x1cc348['logSuccess']?.('Updated\x20activation\x20\x27'+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27'),_0x3f9b48['updated']++;else _0xd0f04a[_0xfc6ed8(0x1e0)]===_0xfc6ed8(0x1a6)&&_0xd0f04a[_0xfc6ed8(0x24a)]&&(_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x1e1),'segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),await _0x1cc348[_0xfc6ed8(0x1b9)](_0xfc6ed8(0x1c5)+_0xd0f04a['name']+'\x27...',()=>_0x1e865c['segment'][_0xfc6ed8(0x215)](_0x4ba063,_0x1b7892,_0xd0f04a[_0xfc6ed8(0x24a)]['id'])),_0x1cc348[_0xfc6ed8(0x196)]?.({'type':_0xfc6ed8(0x181),'segmentName':_0x461909,'activationName':_0xd0f04a[_0xfc6ed8(0x19e)]}),_0x1cc348[_0xfc6ed8(0x1ca)]?.(_0xfc6ed8(0x195)+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27'),_0x3f9b48['deleted']++);}}catch(_0x41df82){const _0x3cc43e=isHttp400Error(_0x41df82),_0x1d0daf=_0x3cc43e?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode[_0xfc6ed8(0x1b1)],_0xe64495=getErrorMessage(_0x41df82);throw new SDKError(_0x1d0daf,_0xfc6ed8(0x208)+_0xd0f04a[_0xfc6ed8(0x1e0)]+_0xfc6ed8(0x233)+_0xd0f04a[_0xfc6ed8(0x19e)]+'\x27\x20from\x20file:\x20'+_0x3e719c+_0xfc6ed8(0x18d)+_0xe64495,_0x41df82);}}return _0x3f9b48;}export async function executePushFolders(_0x32b515,_0x337a38,_0x426063,_0xac7c0d,_0x355018){const _0x268fc7=a152_0x547b34,_0x10abde=new Map(_0x426063),_0x417451=sortFoldersByDepth(_0x337a38);for(const _0x2600d6 of _0x417451){const _0x2c0a0c=_0x2600d6[_0x268fc7(0x1f7)]('/'),_0x5b2dd7=_0x2c0a0c[_0x2c0a0c[_0x268fc7(0x189)]-0x1],_0xdc3124=_0x2c0a0c[_0x268fc7(0x23f)](0x0,-0x1)['join']('/'),_0x2276e0=_0x10abde[_0x268fc7(0x1ff)](_0xdc3124);_0x355018[_0x268fc7(0x196)]?.({'type':_0x268fc7(0x1e4),'folder':_0x2600d6});const _0x1a0d76={'name':_0x5b2dd7,'parentFolderId':_0x2276e0},_0x4d04a0=await _0x355018[_0x268fc7(0x1b9)](_0x268fc7(0x1d8)+_0x2600d6+'\x27...',()=>_0x32b515[_0x268fc7(0x244)][_0x268fc7(0x21c)](_0xac7c0d['parentId'],_0x1a0d76));_0x10abde[_0x268fc7(0x22f)](_0x2600d6,_0x4d04a0[_0x268fc7(0x228)]['id']),_0x355018[_0x268fc7(0x196)]?.({'type':_0x268fc7(0x221),'folder':_0x2600d6,'folderId':_0x4d04a0[_0x268fc7(0x228)]['id']}),_0x355018['logInfo']?.(_0x268fc7(0x148)+_0x2600d6+'\x27');}return _0x10abde;}export async function executePushSegmentDeletions(_0xedb0ed,_0x161b88,_0x24918e){const _0x4bb2d6=a152_0x547b34;if(_0x161b88[_0x4bb2d6(0x189)]===0x0)return 0x0;const {batchAsync:_0x7f9e23}=await import(_0x4bb2d6(0x23d)),_0x206624=0x5,_0x5a35f2=await _0x7f9e23(_0x161b88,async _0x2e03ad=>{const _0x4f947b=_0x4bb2d6;return _0x24918e[_0x4f947b(0x196)]?.({'type':_0x4f947b(0x1ba),'name':_0x2e03ad[_0x4f947b(0x19e)]}),await _0xedb0ed[_0x4f947b(0x244)]['deleteSegment'](_0x2e03ad['id']),_0x24918e[_0x4f947b(0x196)]?.({'type':_0x4f947b(0x18b),'name':_0x2e03ad[_0x4f947b(0x19e)]}),_0x24918e[_0x4f947b(0x1ca)]?.('Deleted\x20segment\x20\x27'+_0x2e03ad[_0x4f947b(0x19e)]+'\x27'),0x1;},_0x206624);return _0x5a35f2[_0x4bb2d6(0x1d7)]((_0x58803b,_0x366e98)=>_0x58803b+_0x366e98,0x0);}export async function executePushJourneys(_0xfab6f9,_0x25b28e,_0x12773f,_0x15c976,_0xcab0c9){const _0x515f52=a152_0x547b34,{journeyDefToRequest:_0x22e933}=await import(_0x515f52(0x213)),{activationDefToCreateRequest:_0x5d1af6,yamlRuleToApi:_0x59fddc,validateSegmentRule:_0xd85787}=await import(_0x515f52(0x210)),_0x4fcec5={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x547357=new Map(_0x12773f[_0x515f52(0x1eb)]),_0xfdae3a=0x5;for(let _0x5c28e7=0x0;_0x5c28e7<_0x25b28e[_0x515f52(0x189)];_0x5c28e7+=_0xfdae3a){const _0x23d0fe=_0x25b28e[_0x515f52(0x23f)](_0x5c28e7,_0x5c28e7+_0xfdae3a),_0x116c5a=await Promise[_0x515f52(0x23a)](_0x23d0fe['map'](async _0x132113=>{const _0x5b95a6=_0x515f52;if(!_0x132113[_0x5b95a6(0x239)]&&!_0x132113[_0x5b95a6(0x149)])return{'action':_0x5b95a6(0x187),'name':_0x132113[_0x5b95a6(0x19b)]['name'],'journeyId':_0x132113[_0x5b95a6(0x200)]?.['id']};const _0x589ad6=_0x132113['folderPath']?_0x12773f[_0x5b95a6(0x197)][_0x5b95a6(0x1ff)](_0x132113[_0x5b95a6(0x20c)]):undefined;_0xcab0c9[_0x5b95a6(0x196)]?.({'type':_0x132113[_0x5b95a6(0x239)]?_0x5b95a6(0x20a):_0x5b95a6(0x17b),'name':_0x132113['yamlConfig'][_0x5b95a6(0x19e)]});try{const _0x3c8dda=await executeSingleJourneyPush(_0xfab6f9,_0x132113,{..._0x12773f,'segmentNameToId':_0x547357},{'parentId':_0x15c976[_0x5b95a6(0x165)],'rootFolderId':_0x15c976[_0x5b95a6(0x23c)],'folderId':_0x589ad6,'verbose':_0x15c976[_0x5b95a6(0x190)]},_0xcab0c9,{'journeyDefToRequest':_0x22e933,'activationDefToCreateRequest':_0x5d1af6,'yamlRuleToApi':_0x59fddc,'validateSegmentRule':_0xd85787});for(const [_0x39c799,_0x3aa608]of _0x3c8dda[_0x5b95a6(0x214)]){_0x547357['set'](_0x39c799,_0x3aa608),_0x4fcec5[_0x5b95a6(0x214)]['set'](_0x39c799,_0x3aa608);}if(_0x3c8dda['action']===_0x5b95a6(0x229))_0xcab0c9[_0x5b95a6(0x196)]?.({'type':_0x5b95a6(0x18a),'name':_0x132113[_0x5b95a6(0x19b)][_0x5b95a6(0x19e)],'journeyId':_0x3c8dda[_0x5b95a6(0x1b5)]}),_0xcab0c9[_0x5b95a6(0x158)]?.(_0x5b95a6(0x24e)+_0x132113[_0x5b95a6(0x19b)][_0x5b95a6(0x19e)]+'\x27'),_0x4fcec5['created']++;else _0x3c8dda[_0x5b95a6(0x1c9)]===_0x5b95a6(0x15a)&&(_0xcab0c9[_0x5b95a6(0x196)]?.({'type':'journey_updated','name':_0x132113[_0x5b95a6(0x19b)][_0x5b95a6(0x19e)]}),_0xcab0c9[_0x5b95a6(0x158)]?.(_0x5b95a6(0x167)+_0x132113[_0x5b95a6(0x19b)]['name']+'\x27'),_0x4fcec5['updated']++);return{'action':_0x3c8dda[_0x5b95a6(0x1c9)],'name':_0x132113['yamlConfig'][_0x5b95a6(0x19e)],'journeyId':_0x3c8dda[_0x5b95a6(0x1b5)]};}catch(_0x2491d3){const _0x6f9407=isHttp400Error(_0x2491d3),_0x214304=_0x6f9407?ErrorCode[_0x5b95a6(0x241)]:ErrorCode[_0x5b95a6(0x1fc)],_0x2deb1d=getErrorMessage(_0x2491d3);throw new SDKError(_0x214304,'Failed\x20to\x20'+(_0x132113[_0x5b95a6(0x239)]?_0x5b95a6(0x1c0):_0x5b95a6(0x16e))+'\x20journey\x20from\x20file:\x20'+_0x132113['absolutePath']+_0x5b95a6(0x18d)+_0x2deb1d,_0x2491d3);}}));_0x4fcec5[_0x515f52(0x17a)][_0x515f52(0x202)](..._0x116c5a);}return _0x4fcec5;}async function matchExistingJourneySegments(_0x57f901,_0x6fe8e0,_0x15cca8,_0x3aeb0e,_0x49badc){const _0x23f147=a152_0x547b34;if(!_0x6fe8e0[_0x23f147(0x200)]||!_0x6fe8e0[_0x23f147(0x19b)]['segments'])return;const _0x8418b5=new Map(),_0x2940bd=new Set();for(const _0x1e35c1 of Object[_0x23f147(0x183)](_0x6fe8e0[_0x23f147(0x19b)]['segments'])){const _0x32eab2=generateDeterministicJourneySegmentName(_0x6fe8e0[_0x23f147(0x19b)][_0x23f147(0x19e)],_0x1e35c1);_0x8418b5[_0x23f147(0x22f)](_0x32eab2,_0x1e35c1),_0x2940bd[_0x23f147(0x19d)](_0x1e35c1);}const _0x37f769=[],_0x14892b=collectSegmentIdsFromJourneyApi(_0x6fe8e0['existingJourney']);for(const _0x30ae26 of _0x14892b){const _0x1387c7=await fetchSegment(_0x57f901,_0x15cca8,_0x30ae26,_0x3aeb0e);if(!_0x1387c7?.[_0x23f147(0x19e)])continue;const _0x111eb0=_0x8418b5['get'](_0x1387c7['name']);_0x111eb0?(_0x49badc[_0x23f147(0x22f)](_0x111eb0,_0x30ae26),_0x2940bd[_0x23f147(0x1a6)](_0x111eb0)):_0x37f769[_0x23f147(0x202)]({'id':_0x30ae26,'seg':_0x1387c7});}if(_0x2940bd[_0x23f147(0x24d)]>0x0&&_0x37f769['length']>0x0){const {localExpandedRuleToNames:_0x3513aa}=buildLocalExpandedRuleMappings(_0x6fe8e0['yamlConfig']),_0xefb764=new Map();for(const {id:_0x2f32d7,seg:_0x479dc3}of _0x37f769){if(_0x479dc3['rule']){const _0x37b6cc=apiRuleToYaml(_0x479dc3[_0x23f147(0x14b)]);_0xefb764[_0x23f147(0x22f)](_0x2f32d7,_0x37b6cc);}}for(const {id:_0x50fa31,seg:_0x3038ee}of _0x37f769){if(!_0x3038ee[_0x23f147(0x14b)])continue;const _0x5db973=_0xefb764[_0x23f147(0x1ff)](_0x50fa31);if(!_0x5db973)continue;const _0x2c079d=serializeExpandedRule(_0x5db973,_0xefb764),_0x2031b3=_0x3513aa[_0x23f147(0x1ff)](_0x2c079d);if(_0x2031b3){const _0x3f465e=_0x2031b3[_0x23f147(0x1a5)](_0x3172ed=>_0x2940bd[_0x23f147(0x242)](_0x3172ed));_0x3f465e&&(_0x49badc[_0x23f147(0x22f)](_0x3f465e,_0x50fa31),_0x2940bd[_0x23f147(0x1a6)](_0x3f465e),logger[_0x23f147(0x235)](_0x23f147(0x1cd)+_0x3038ee[_0x23f147(0x19e)]+_0x23f147(0x151)+_0x3f465e+_0x23f147(0x15f)));}}}}async function executeSingleJourneyPush(_0x5850df,_0x1e2fe3,_0x4a5978,_0x5d82bd,_0x2ea48f,_0x1a3a76){const _0x252e70=a152_0x547b34,{journeyDefToRequest:_0x22ea62,activationDefToCreateRequest:_0x14028b,yamlRuleToApi:_0x455a46,validateSegmentRule:_0xa8c6c9}=_0x1a3a76,_0xf3f02b=new Map(),_0x4ffbb6=new Map();recoverSegmentIdsFromPushRecovery(_0x1e2fe3,_0xf3f02b,_0x4a5978[_0x252e70(0x1eb)]);const _0x16e885=new Map(),_0x10de09=new Map(),_0x59462b=new Map();let _0x1f9696;const _0x1773ca=async()=>{const _0x36fbaa=_0x252e70;if(_0x1f9696)return;_0x1f9696=new Map();if(!_0x1e2fe3[_0x36fbaa(0x200)])return;const _0x250381=await _0x5850df[_0x36fbaa(0x1d2)][_0x36fbaa(0x249)](_0x1e2fe3[_0x36fbaa(0x200)]['id']);for(const _0x405319 of _0x250381){const _0x5be6dd=journeyActivationStepToYaml(_0x405319,_0x4a5978[_0x36fbaa(0x193)],_0x4a5978[_0x36fbaa(0x1c8)]),_0x2d256a=activationSignature(_0x5be6dd);!_0x1f9696[_0x36fbaa(0x242)](_0x2d256a)&&_0x1f9696[_0x36fbaa(0x22f)](_0x2d256a,_0x405319['id']),_0x5be6dd[_0x36fbaa(0x19e)]&&_0x4ffbb6[_0x36fbaa(0x22f)](_0x5be6dd[_0x36fbaa(0x19e)],_0x405319['id']);}};await matchExistingJourneySegments(_0x5850df,_0x1e2fe3,_0x5d82bd[_0x252e70(0x165)],_0x4a5978[_0x252e70(0x20b)],_0x4a5978[_0x252e70(0x1eb)]);const _0x5e543f={'resolveSegmentId':async _0x36e489=>{const _0x186ea2=_0x252e70,_0x11857a=_0x4a5978['segmentNameToId'][_0x186ea2(0x1ff)](_0x36e489);if(!_0x11857a)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x186ea2(0x179)+_0x36e489+_0x186ea2(0x18c)+_0x1e2fe3[_0x186ea2(0x19b)][_0x186ea2(0x19e)]+')');return _0x11857a;},'resolveEmbeddedSegmentId':async(_0x5743f2,_0x3a6419)=>{const _0x33c00e=_0x252e70,_0x2bb3a2=_0x4a5978[_0x33c00e(0x1eb)][_0x33c00e(0x1ff)](_0x5743f2);if(_0x2bb3a2)return _0x2bb3a2;const _0x26e142=_0x4a5978['existingSegments'][_0x33c00e(0x1a5)](_0x2e4902=>_0x2e4902[_0x33c00e(0x19e)]===_0x5743f2);if(_0x26e142)return _0x4a5978[_0x33c00e(0x1eb)]['set'](_0x5743f2,_0x26e142['id']),_0x26e142['id'];if(_0x1e2fe3[_0x33c00e(0x239)]){const {stageName:_0x295ac1,criteriaName:_0x20dded}=findSegmentCriteriaLocation(_0x1e2fe3[_0x33c00e(0x19b)],_0x5743f2);return _0xa8c6c9(_0x5743f2,_0x3a6419[_0x33c00e(0x14b)]),_0x10de09[_0x33c00e(0x22f)](_0x5743f2,{'definition':_0x3a6419,'stageName':_0x295ac1,'criteriaName':_0x20dded}),createPendingSegmentId(_0x5743f2);}const _0x4008bd=_0x1e2fe3['existingJourney']?.['id'];if(!_0x4008bd)throw new SDKError(ErrorCode[_0x33c00e(0x1fe)],_0x33c00e(0x1b3));const _0x31b2bd=_0x16e885[_0x33c00e(0x1ff)](_0x5743f2);if(_0x31b2bd)return _0x31b2bd;const _0x4e64d8=((async()=>{const _0x1f296c=_0x33c00e;_0xa8c6c9(_0x5743f2,_0x3a6419[_0x1f296c(0x14b)]);const _0x125b14=generateDeterministicJourneySegmentName(_0x1e2fe3[_0x1f296c(0x19b)]['name'],_0x5743f2),_0x10b209=_0x4a5978[_0x1f296c(0x20b)][_0x1f296c(0x1a5)](_0x2cc809=>_0x2cc809[_0x1f296c(0x19e)]===_0x125b14),_0x8b096f=createSegmentIdResolver(_0x4a5978[_0x1f296c(0x1eb)],_0x5743f2),_0x43f63c=await resolveRuleSegmentIds(_0x3a6419[_0x1f296c(0x14b)],_0x8b096f);let _0x2d3e4e;return _0x10b209?(await _0x5850df[_0x1f296c(0x244)][_0x1f296c(0x1c3)](_0x5d82bd[_0x1f296c(0x165)],_0x10b209['id'],{'description':_0x3a6419[_0x1f296c(0x20d)]||_0x1f296c(0x162)+_0x5743f2,'rule':_0x455a46(_0x43f63c),'countPopulation':!![]}),_0x2d3e4e=_0x10b209['id'],saveSegmentToPushRecovery(_0x1e2fe3['absolutePath'],_0x1e2fe3[_0x1f296c(0x19b)][_0x1f296c(0x19e)],_0x5743f2,{'segmentId':_0x2d3e4e,'uniqueServerName':_0x125b14,'createdAt':new Date()['toISOString']()})):_0x2d3e4e=await createOrRecoverEmbeddedSegment(_0x5850df,_0x1e2fe3,{'localName':_0x5743f2,'uniqueSegmentName':_0x125b14,'description':_0x3a6419[_0x1f296c(0x20d)]||_0x1f296c(0x162)+_0x5743f2,'journeyId':_0x4008bd,'resolvedRule':_0x43f63c,'parentId':_0x5d82bd['parentId'],'folderId':_0x5d82bd[_0x1f296c(0x23c)]||''},_0x455a46),_0x4a5978[_0x1f296c(0x1eb)][_0x1f296c(0x22f)](_0x5743f2,_0x2d3e4e),_0xf3f02b[_0x1f296c(0x22f)](_0x5743f2,_0x2d3e4e),_0x2d3e4e;})());_0x16e885[_0x33c00e(0x22f)](_0x5743f2,_0x4e64d8);try{return await _0x4e64d8;}finally{_0x16e885['delete'](_0x5743f2);}},'resolveActivationId':async _0x701edc=>{const _0x7578a2=_0x252e70,_0x11dc11=_0x4ffbb6[_0x7578a2(0x1ff)](_0x701edc);if(_0x11dc11)return _0x11dc11;if(_0x1e2fe3[_0x7578a2(0x200)]){await _0x1773ca();const _0x37f452=_0x4ffbb6[_0x7578a2(0x1ff)](_0x701edc);if(_0x37f452)return _0x37f452;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x7578a2(0x1f8)+_0x701edc+_0x7578a2(0x18c)+_0x1e2fe3[_0x7578a2(0x19b)]['name']+_0x7578a2(0x203)+_0x7578a2(0x206));},'resolveEmbeddedActivationId':async(_0x4ec027,_0x1152b9)=>{const _0x1b324a=_0x252e70,_0x46c8c1=_0x4ffbb6[_0x1b324a(0x1ff)](_0x4ec027);if(_0x46c8c1)return _0x46c8c1;if(_0x1e2fe3[_0x1b324a(0x239)])return _0x59462b[_0x1b324a(0x22f)](_0x4ec027,_0x1152b9),createPendingActivationId(_0x4ec027);if(_0x1e2fe3[_0x1b324a(0x200)]){await _0x1773ca();const _0x4cc9df=_0x4ffbb6[_0x1b324a(0x1ff)](_0x1152b9[_0x1b324a(0x19e)]);if(_0x4cc9df)return _0x4ffbb6['set'](_0x4ec027,_0x4cc9df),_0x4cc9df;const _0x2d423d=activationSignature(_0x1152b9),_0x29262d=_0x1f9696?.['get'](_0x2d423d);if(_0x29262d)return _0x4ffbb6[_0x1b324a(0x22f)](_0x4ec027,_0x29262d),_0x29262d;const _0x2c9f1a=await _0x14028b(_0x1152b9,_0x4a5978['activationContext']),_0x3c23d1={..._0x2c9f1a,..._0x1152b9[_0x1b324a(0x212)]!==undefined&&{'runAfterJourneyRefresh':_0x1152b9[_0x1b324a(0x212)]}},_0x5301e2=await _0x5850df['journey']['createActivation'](_0x1e2fe3['existingJourney']['id'],_0x3c23d1);return _0x4ffbb6[_0x1b324a(0x22f)](_0x4ec027,_0x5301e2['id']),_0x5301e2['id'];}throw new SDKError(ErrorCode[_0x1b324a(0x1fe)],_0x1b324a(0x238));},'resolveJourneyId':async _0x408f1f=>{const _0x4f8b30=_0x252e70;try{return await _0x5850df[_0x4f8b30(0x1d2)][_0x4f8b30(0x1ad)](_0x5d82bd[_0x4f8b30(0x165)],_0x408f1f);}catch(_0x542e88){throw new SDKError(ErrorCode['NOT_FOUND'],_0x4f8b30(0x1b8)+_0x408f1f+_0x4f8b30(0x1c6)+_0x1e2fe3[_0x4f8b30(0x19b)][_0x4f8b30(0x19e)]+'\x27)',_0x542e88);}},'resolveStageId':async(_0x20e79,_0x36da83)=>{const _0x93b809=_0x252e70,_0x574afe=await _0x5850df['journey'][_0x93b809(0x164)](_0x20e79),_0x223519=_0x574afe['attributes']['journeyStages'][_0x93b809(0x1a5)](_0x2cf562=>_0x2cf562[_0x93b809(0x19e)][_0x93b809(0x16c)]()===_0x36da83[_0x93b809(0x16c)]());if(!_0x223519?.['id'])throw new SDKError(ErrorCode[_0x93b809(0x20e)],_0x93b809(0x24f)+_0x36da83+_0x93b809(0x150)+(_0x574afe[_0x93b809(0x24c)]['journeyBundleName']||_0x574afe[_0x93b809(0x24c)][_0x93b809(0x19e)])+'\x27');return _0x223519['id'];}},_0x1aed60=await _0x22ea62(_0x1e2fe3[_0x252e70(0x19b)],_0x5d82bd[_0x252e70(0x165)],_0x5e543f),_0x799f6=_0x5d82bd[_0x252e70(0x1f1)]||_0x5d82bd[_0x252e70(0x23c)];_0x799f6&&(_0x1aed60[_0x252e70(0x14f)]={'parentFolder':{'data':{'id':_0x799f6,'type':_0x252e70(0x1b6)}}});if(_0x1e2fe3[_0x252e70(0x239)]){if(_0x10de09[_0x252e70(0x24d)]>0x0||_0x59462b[_0x252e70(0x24d)]>0x0)return await executeThreeStepJourneyCreate(_0x5850df,_0x1e2fe3,_0x1aed60,{'pendingEmbeddedSegments':_0x10de09,'pendingEmbeddedActivations':_0x59462b,'embeddedSegmentNameToId':_0xf3f02b,'journeyActivationNameToId':_0x4ffbb6},{..._0x5d82bd,'effectiveFolderId':_0x799f6},_0x4a5978,_0x2ea48f,_0x1a3a76);else{ensureJourneyDefaults(_0x1aed60[_0x252e70(0x24c)]);const _0x3ebc89=await _0x5850df[_0x252e70(0x1d2)][_0x252e70(0x1c0)](_0x1aed60);return deletePushRecovery(_0x1e2fe3[_0x252e70(0x1a4)]),{'action':_0x252e70(0x229),'journeyId':_0x3ebc89['id'],'embeddedSegmentNameToId':_0xf3f02b};}}else{if(_0x1e2fe3['hasChanges']&&_0x1e2fe3[_0x252e70(0x200)]){_0x1aed60['id']=_0x1e2fe3['existingJourney']['id'];const _0x51bd9a=_0x1aed60[_0x252e70(0x24c)];_0x1e2fe3[_0x252e70(0x200)][_0x252e70(0x24c)]?.[_0x252e70(0x22a)]&&(_0x51bd9a[_0x252e70(0x22a)]=_0x1e2fe3['existingJourney']['attributes']['journeyBundleName']);const _0x4cdaa4=_0x1e2fe3[_0x252e70(0x200)]['attributes']?.['journeyStages'];return _0x4cdaa4&&_0x1aed60[_0x252e70(0x24c)][_0x252e70(0x1ae)]&&injectExistingStageIds(_0x1aed60['attributes']['journeyStages'],_0x4cdaa4),ensureJourneyDefaults(_0x51bd9a),await _0x5850df['journey']['update'](_0x1e2fe3[_0x252e70(0x200)]['id'],_0x1aed60),deletePushRecovery(_0x1e2fe3[_0x252e70(0x1a4)]),{'action':_0x252e70(0x15a),'journeyId':_0x1e2fe3[_0x252e70(0x200)]['id'],'embeddedSegmentNameToId':_0xf3f02b};}}return deletePushRecovery(_0x1e2fe3[_0x252e70(0x1a4)]),{'action':_0x252e70(0x187),'journeyId':_0x1e2fe3[_0x252e70(0x200)]?.['id'],'embeddedSegmentNameToId':_0xf3f02b};}function findSegmentCriteriaLocation(_0x1842be,_0xd462fd){const _0x3f0a9d=a152_0x547b34,_0xe39ad1=_0x1842be[_0x3f0a9d(0x21f)]||_0x1842be['journeys']?.[0x0]?.['stages']||[];let _0x3b377d='entry',_0x30d45e=_0xd462fd;const _0x4fb5dc=_0x1842be[_0x3f0a9d(0x192)]||_0x1842be[_0x3f0a9d(0x1f9)]?.[0x0]?.[_0x3f0a9d(0x192)];if(_0x4fb5dc?.[_0x3f0a9d(0x244)]===_0xd462fd)return{'stageName':'goal','criteriaName':_0x4fb5dc['name']||_0xd462fd};_0x4122c0:for(const _0x386955 of _0xe39ad1){if(_0x386955[_0x3f0a9d(0x166)]?.['segment']===_0xd462fd){_0x3b377d=_0x386955[_0x3f0a9d(0x19e)],_0x30d45e=_0x386955[_0x3f0a9d(0x166)][_0x3f0a9d(0x19e)]||_0xd462fd;break;}if(_0x386955['steps'])for(const _0x58bb80 of _0x386955['steps']){if(_0x58bb80['type']===_0x3f0a9d(0x1fd)&&_0x58bb80[_0x3f0a9d(0x1e3)]?.[_0x3f0a9d(0x1bf)])for(const _0x3ed243 of _0x58bb80[_0x3f0a9d(0x1e3)][_0x3f0a9d(0x1bf)]){if(_0x3ed243['segment']===_0xd462fd){_0x3b377d=_0x386955[_0x3f0a9d(0x19e)],_0x30d45e=_0x3ed243[_0x3f0a9d(0x19e)]||_0xd462fd;break _0x4122c0;}}}}return{'stageName':_0x3b377d,'criteriaName':_0x30d45e};}async function executeThreeStepJourneyCreate(_0x3d6cef,_0x30c967,_0x39bf72,_0x1d1021,_0x4cbaee,_0x3ad2ee,_0x102b33,_0x57c35f){const _0x241986=a152_0x547b34,{activationDefToCreateRequest:_0x455cfb,yamlRuleToApi:_0x2d10e0}=_0x57c35f,{pendingEmbeddedSegments:_0x5628d6,pendingEmbeddedActivations:_0x2f178a,embeddedSegmentNameToId:_0x5da67a}=_0x1d1021,_0x286fe8=JSON[_0x241986(0x184)](JSON['stringify'](_0x39bf72));ensureJourneyDefaults(_0x286fe8[_0x241986(0x24c)]),stripPendingIds(_0x286fe8);const _0x2e4836=await _0x3d6cef[_0x241986(0x1d2)][_0x241986(0x1c0)](_0x286fe8),_0x19bd23=_0x2e4836['id'],_0x46ec5e=new Map();for(const _0x5f3389 of _0x2e4836['attributes']['journeyStages']){_0x46ec5e[_0x241986(0x22f)](_0x5f3389[_0x241986(0x19e)][_0x241986(0x16c)](),_0x5f3389['id']);}recoverSegmentIdsFromPushRecovery(_0x30c967,_0x5da67a,_0x3ad2ee[_0x241986(0x1eb)]);for(const [_0x5a9ce3,{definition:_0x415d83}]of _0x5628d6){if(_0x5da67a['has'](_0x5a9ce3)){_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x226),'journeyName':_0x30c967['yamlConfig'][_0x241986(0x19e)],'segmentName':_0x5a9ce3});continue;}const _0x322213=generateDeterministicJourneySegmentName(_0x30c967[_0x241986(0x19b)][_0x241986(0x19e)],_0x5a9ce3);_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x1d9),'journeyName':_0x30c967[_0x241986(0x19b)][_0x241986(0x19e)],'segmentName':_0x5a9ce3});const _0x280cd8=createSegmentIdResolver(_0x3ad2ee[_0x241986(0x1eb)],_0x5a9ce3),_0x2bc42f=await resolveRuleSegmentIds(_0x415d83[_0x241986(0x14b)],_0x280cd8),_0x55e85d=await createOrRecoverEmbeddedSegment(_0x3d6cef,_0x30c967,{'localName':_0x5a9ce3,'uniqueSegmentName':_0x322213,'description':_0x415d83[_0x241986(0x20d)]||_0x241986(0x162)+_0x5a9ce3,'journeyId':_0x19bd23,'resolvedRule':_0x2bc42f,'parentId':_0x4cbaee[_0x241986(0x165)],'folderId':_0x4cbaee[_0x241986(0x201)]||''},_0x2d10e0);_0x5da67a[_0x241986(0x22f)](_0x5a9ce3,_0x55e85d),_0x3ad2ee['segmentNameToId'][_0x241986(0x22f)](_0x5a9ce3,_0x55e85d),_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x226),'journeyName':_0x30c967[_0x241986(0x19b)][_0x241986(0x19e)],'segmentName':_0x5a9ce3});}const _0x2957c6=new Map();for(const [_0x2249f7,_0x121796]of _0x2f178a){_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x172),'journeyName':_0x30c967['yamlConfig'][_0x241986(0x19e)],'activationName':_0x2249f7});const _0x32f8b6=await _0x455cfb(_0x121796,_0x3ad2ee[_0x241986(0x1f0)]),_0x112d11={..._0x32f8b6,..._0x121796['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x121796['run_after_journey_refresh']}},_0x4ed264=await _0x3d6cef[_0x241986(0x1d2)][_0x241986(0x230)](_0x19bd23,_0x112d11);_0x2957c6[_0x241986(0x22f)](_0x2249f7,_0x4ed264['id']),_0x1d1021[_0x241986(0x1c1)]['set'](_0x2249f7,_0x4ed264['id']),_0x102b33[_0x241986(0x196)]?.({'type':_0x241986(0x14d),'journeyName':_0x30c967['yamlConfig'][_0x241986(0x19e)],'activationName':_0x2249f7});}const _0x54ad80=JSON[_0x241986(0x184)](JSON[_0x241986(0x1f4)](_0x39bf72));return _0x54ad80['id']=_0x19bd23,ensureJourneyDefaults(_0x54ad80[_0x241986(0x24c)]),resolvePendingIdsInRequest(_0x54ad80,_0x39bf72,_0x46ec5e,_0x5da67a,_0x2957c6,_0x102b33),await _0x3d6cef['journey'][_0x241986(0x16e)](_0x19bd23,_0x54ad80),deletePushRecovery(_0x30c967['absolutePath']),{'action':_0x241986(0x229),'journeyId':_0x19bd23,'embeddedSegmentNameToId':_0x5da67a};}export function stripWaitStepPendingIds(_0x458ba8){const _0x1f530c=a152_0x547b34,_0x509b6a=_0x458ba8[_0x1f530c(0x18e)]&&isPendingSegmentId(_0x458ba8[_0x1f530c(0x18e)]),_0x4013fc=_0x458ba8['conditions']?.[_0x1f530c(0x251)](_0x34be67=>_0x34be67[_0x1f530c(0x23b)]&&isPendingSegmentId(_0x34be67[_0x1f530c(0x23b)]));(_0x509b6a||_0x4013fc)&&(_0x458ba8['waitStepType']=_0x1f530c(0x1de),_0x458ba8[_0x1f530c(0x1b2)]=0x1,_0x458ba8[_0x1f530c(0x1ac)]=_0x1f530c(0x160),delete _0x458ba8['conditionSegmentId'],delete _0x458ba8[_0x1f530c(0x211)],delete _0x458ba8[_0x1f530c(0x1cc)],delete _0x458ba8[_0x1f530c(0x155)]);}export function resolveWaitStepPendingIds(_0x384cef,_0x3f6325,_0x3360a8,_0x55a724){const _0x414ca8=a152_0x547b34;if(_0x3f6325['conditionSegmentId']&&isPendingSegmentId(_0x3f6325[_0x414ca8(0x18e)])){const _0x49c2fd=_0x3360a8(_0x3f6325[_0x414ca8(0x18e)],'stage\x20\x27'+_0x55a724+_0x414ca8(0x185));_0x49c2fd&&(_0x384cef['waitStepType']=_0x414ca8(0x1b0),_0x384cef[_0x414ca8(0x18e)]=_0x49c2fd,delete _0x384cef[_0x414ca8(0x1b2)],delete _0x384cef['waitStepUnit'],_0x3f6325[_0x414ca8(0x211)]!==undefined&&(_0x384cef[_0x414ca8(0x211)]=_0x3f6325[_0x414ca8(0x211)]),_0x3f6325[_0x414ca8(0x1cc)]&&(_0x384cef['conditionTimeoutUnit']=_0x3f6325[_0x414ca8(0x1cc)]));}if(_0x3f6325[_0x414ca8(0x155)]){const _0x558e0e=_0x3f6325[_0x414ca8(0x155)][_0x414ca8(0x251)](_0x25b29b=>_0x25b29b[_0x414ca8(0x23b)]&&isPendingSegmentId(_0x25b29b['segmentId']));if(_0x558e0e){const _0x112c27=_0x3f6325['conditions']['map'](_0x5b308f=>{const _0x594ae0=_0x414ca8;if(_0x5b308f[_0x594ae0(0x23b)]&&isPendingSegmentId(_0x5b308f[_0x594ae0(0x23b)])){const _0x3ce599=_0x3360a8(_0x5b308f[_0x594ae0(0x23b)],'stage\x20\x27'+_0x55a724+_0x594ae0(0x185));return{..._0x5b308f,'segmentId':_0x3ce599||_0x5b308f[_0x594ae0(0x23b)]};}return{..._0x5b308f};});_0x384cef[_0x414ca8(0x14e)]=_0x414ca8(0x1b0),_0x384cef[_0x414ca8(0x155)]=_0x112c27,delete _0x384cef[_0x414ca8(0x1b2)],delete _0x384cef[_0x414ca8(0x1ac)],delete _0x384cef[_0x414ca8(0x18e)],delete _0x384cef[_0x414ca8(0x211)],delete _0x384cef['conditionTimeoutUnit'];}}}function stripPendingIds(_0x4c5dc1){const _0x59e5d8=a152_0x547b34;_0x4c5dc1[_0x59e5d8(0x24c)][_0x59e5d8(0x192)]?.[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x4c5dc1[_0x59e5d8(0x24c)][_0x59e5d8(0x192)][_0x59e5d8(0x23b)])&&delete _0x4c5dc1['attributes'][_0x59e5d8(0x192)];for(const _0x583d22 of _0x4c5dc1['attributes'][_0x59e5d8(0x1ae)]||[]){_0x583d22[_0x59e5d8(0x1c2)]?.[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x583d22[_0x59e5d8(0x1c2)]['segmentId'])&&delete _0x583d22['entryCriteria'];_0x583d22[_0x59e5d8(0x21d)]?.[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x583d22[_0x59e5d8(0x21d)][_0x59e5d8(0x23b)])&&delete _0x583d22[_0x59e5d8(0x21d)];_0x583d22[_0x59e5d8(0x1a0)]&&(_0x583d22['exitCriterias']=_0x583d22[_0x59e5d8(0x1a0)]['filter'](_0x50b479=>!_0x50b479[_0x59e5d8(0x23b)]||!isPendingSegmentId(_0x50b479['segmentId'])));if(_0x583d22[_0x59e5d8(0x170)])for(const _0x19294d of Object[_0x59e5d8(0x183)](_0x583d22[_0x59e5d8(0x170)])){const _0x248093=_0x583d22[_0x59e5d8(0x170)][_0x19294d];_0x248093[_0x59e5d8(0x1e0)]==='Activation'&&_0x248093[_0x59e5d8(0x1ed)]&&isPendingActivationId(_0x248093['journeyActivationStepId'])&&(_0x248093[_0x59e5d8(0x1ed)]='');if(_0x248093[_0x59e5d8(0x1e0)]===_0x59e5d8(0x15e)&&_0x248093[_0x59e5d8(0x1bf)])for(const _0x115407 of _0x248093[_0x59e5d8(0x1bf)]){_0x115407[_0x59e5d8(0x23b)]&&isPendingSegmentId(_0x115407[_0x59e5d8(0x23b)])&&(_0x115407['segmentId']='');}_0x248093['type']==='WaitStep'&&stripWaitStepPendingIds(_0x248093);}}}function resolvePendingIdsInRequest(_0x5e926a,_0xd557ad,_0x30e578,_0xb7a08b,_0x378c36,_0x45a2a5){const _0x136046=a152_0x547b34,_0x2625a6=(_0x24507a,_0xf4c273)=>{const _0x4c7423=a152_0x57d7;if(!isPendingSegmentId(_0x24507a))return _0x24507a;const _0x45f2b4=extractPendingSegmentName(_0x24507a),_0x30dca4=_0xb7a08b[_0x4c7423(0x1ff)](_0x45f2b4);return!_0x30dca4&&_0x45a2a5[_0x4c7423(0x1ea)]?.(_0x4c7423(0x154)+_0x45f2b4+_0x4c7423(0x191)+_0xf4c273),_0x30dca4;};if(_0x5e926a['attributes']['goal']?.[_0x136046(0x23b)]&&isPendingSegmentId(_0x5e926a[_0x136046(0x24c)][_0x136046(0x192)][_0x136046(0x23b)])){const _0x20b7a0=_0x2625a6(_0x5e926a[_0x136046(0x24c)][_0x136046(0x192)][_0x136046(0x23b)],_0x136046(0x1da));_0x20b7a0&&(_0x5e926a[_0x136046(0x24c)]['goal'][_0x136046(0x23b)]=_0x20b7a0);}for(const _0x2c541d of _0x5e926a[_0x136046(0x24c)][_0x136046(0x1ae)]||[]){const _0x357484=_0x30e578[_0x136046(0x1ff)](_0x2c541d[_0x136046(0x19e)][_0x136046(0x16c)]());_0x357484&&(_0x2c541d['id']=_0x357484);if(_0x2c541d[_0x136046(0x1c2)]?.['segmentId']&&isPendingSegmentId(_0x2c541d[_0x136046(0x1c2)][_0x136046(0x23b)])){const _0x31cbf2=_0x2625a6(_0x2c541d[_0x136046(0x1c2)][_0x136046(0x23b)],_0x136046(0x22d)+_0x2c541d[_0x136046(0x19e)]+_0x136046(0x1b7));_0x31cbf2&&(_0x2c541d['entryCriteria'][_0x136046(0x23b)]=_0x31cbf2);}if(_0x2c541d[_0x136046(0x1a0)])for(const _0x4905c2 of _0x2c541d['exitCriterias']){if(_0x4905c2[_0x136046(0x23b)]&&isPendingSegmentId(_0x4905c2[_0x136046(0x23b)])){const _0xba6d56=_0x2625a6(_0x4905c2[_0x136046(0x23b)],'stage\x20\x27'+_0x2c541d[_0x136046(0x19e)]+'\x27\x20exit\x20criteria');_0xba6d56&&(_0x4905c2[_0x136046(0x23b)]=_0xba6d56);}}if(_0x2c541d[_0x136046(0x21d)]?.['segmentId']&&isPendingSegmentId(_0x2c541d[_0x136046(0x21d)][_0x136046(0x23b)])){const _0x5c0a28=_0x2625a6(_0x2c541d['milestone'][_0x136046(0x23b)],'stage\x20\x27'+_0x2c541d[_0x136046(0x19e)]+_0x136046(0x19c));_0x5c0a28&&(_0x2c541d['milestone'][_0x136046(0x23b)]=_0x5c0a28);}if(_0x2c541d[_0x136046(0x170)]){const _0x1d0fa0=_0x118304=>_0xd557ad[_0x136046(0x24c)][_0x136046(0x1ae)]?.['find'](_0x653e81=>_0x653e81[_0x136046(0x19e)]['toLowerCase']()===_0x2c541d[_0x136046(0x19e)]['toLowerCase']())?.['steps']?.[_0x118304];for(const _0x55c76d of Object['keys'](_0x2c541d[_0x136046(0x170)])){const _0x55a90d=_0x2c541d['steps'][_0x55c76d],_0x526e06=_0x1d0fa0(_0x55c76d);if(_0x55a90d[_0x136046(0x1e0)]===_0x136046(0x17e)&&_0x55a90d[_0x136046(0x1ed)]&&(isPendingActivationId(_0x55a90d[_0x136046(0x1ed)])||_0x55a90d[_0x136046(0x1ed)]==='')){if(_0x526e06?.[_0x136046(0x1ed)]&&isPendingActivationId(_0x526e06[_0x136046(0x1ed)])){const _0x2c4aca=extractPendingActivationName(_0x526e06[_0x136046(0x1ed)]),_0x54a4c5=_0x378c36[_0x136046(0x1ff)](_0x2c4aca);_0x54a4c5&&(_0x55a90d[_0x136046(0x1ed)]=_0x54a4c5);}}if(_0x55a90d[_0x136046(0x1e0)]==='DecisionPoint'&&_0x55a90d[_0x136046(0x1bf)]&&_0x526e06?.[_0x136046(0x1bf)])for(let _0xefaf36=0x0;_0xefaf36<_0x55a90d[_0x136046(0x1bf)]['length'];_0xefaf36++){const _0x32a84d=_0x55a90d['branches'][_0xefaf36],_0x1a7326=_0x526e06['branches'][_0xefaf36];if(_0x1a7326?.['segmentId']&&isPendingSegmentId(_0x1a7326[_0x136046(0x23b)])){const _0x2ee94d=_0x2625a6(_0x1a7326[_0x136046(0x23b)],_0x136046(0x22d)+_0x2c541d[_0x136046(0x19e)]+_0x136046(0x169)+(_0x32a84d[_0x136046(0x19e)]||_0xefaf36)+'\x27');_0x2ee94d&&(_0x32a84d[_0x136046(0x23b)]=_0x2ee94d);}}_0x55a90d[_0x136046(0x1e0)]===_0x136046(0x16a)&&_0x526e06?.[_0x136046(0x1e0)]===_0x136046(0x16a)&&resolveWaitStepPendingIds(_0x55a90d,_0x526e06,_0x2625a6,_0x2c541d['name']);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x368f6b,_0xa5b264){const _0x38cc27=a153_0x34fe,_0x3741d8=_0x368f6b();while(!![]){try{const _0x556cea=-parseInt(_0x38cc27(0xe3))/0x1*(-parseInt(_0x38cc27(0xe9))/0x2)+parseInt(_0x38cc27(0xdd))/0x3*(parseInt(_0x38cc27(0xe4))/0x4)+-parseInt(_0x38cc27(0xdf))/0x5+-parseInt(_0x38cc27(0xe5))/0x6+parseInt(_0x38cc27(0xde))/0x7+-parseInt(_0x38cc27(0xe7))/0x8*(parseInt(_0x38cc27(0xe2))/0x9)+parseInt(_0x38cc27(0xe1))/0xa;if(_0x556cea===_0xa5b264)break;else _0x3741d8['push'](_0x3741d8['shift']());}catch(_0x247d86){_0x3741d8['push'](_0x3741d8['shift']());}}}(a153_0x2296,0xde1c5));export function buildFolderIdToPathMap(_0x4c5a4e){const _0x549ec1=a153_0x34fe,_0x1adc90=new Map(),_0x4a27e2=new Map();for(const _0x599ed7 of _0x4c5a4e){_0x4a27e2[_0x549ec1(0xea)](_0x599ed7['id'],_0x599ed7);}const _0x442762=new Set();for(const _0x566555 of _0x4c5a4e){!_0x566555[_0x549ec1(0xdb)]&&_0x442762[_0x549ec1(0xe6)](_0x566555['id']);}function _0x36c4c5(_0x131919){const _0x1b1ecf=_0x549ec1;if(_0x1adc90['has'](_0x131919['id']))return _0x1adc90[_0x1b1ecf(0xe0)](_0x131919['id']);if(_0x442762[_0x1b1ecf(0xe8)](_0x131919['id']))return _0x1adc90['set'](_0x131919['id'],''),'';if(_0x131919[_0x1b1ecf(0xdb)]){const _0x574e8b=_0x4a27e2[_0x1b1ecf(0xe0)](_0x131919[_0x1b1ecf(0xdb)]);if(_0x574e8b){const _0x385581=_0x36c4c5(_0x574e8b),_0x203203=_0x385581?_0x385581+'/'+_0x131919[_0x1b1ecf(0xdc)]:_0x131919[_0x1b1ecf(0xdc)];return _0x1adc90['set'](_0x131919['id'],_0x203203),_0x203203;}}const _0x5d0bfe=_0x131919[_0x1b1ecf(0xdc)];return _0x1adc90[_0x1b1ecf(0xea)](_0x131919['id'],_0x5d0bfe),_0x5d0bfe;}for(const _0x33e1a8 of _0x4c5a4e){_0x36c4c5(_0x33e1a8);}return _0x1adc90;}export function buildFolderPathToIdMap(_0x3da3c9){const _0x29b048=a153_0x34fe,_0x374ab2=new Map(),_0x507c40=new Map();for(const _0x1daaa5 of _0x3da3c9){_0x507c40[_0x29b048(0xea)](_0x1daaa5['id'],_0x1daaa5);}const _0x1f314b=new Set();for(const _0x5b2fe1 of _0x3da3c9){!_0x5b2fe1[_0x29b048(0xdb)]&&_0x1f314b[_0x29b048(0xe6)](_0x5b2fe1['id']);}function _0x1b27ec(_0x39dc3b){const _0x2bdfdc=_0x29b048;if(_0x1f314b[_0x2bdfdc(0xe8)](_0x39dc3b['id']))return'';if(_0x39dc3b['parentFolderId']){const _0x386fcf=_0x507c40[_0x2bdfdc(0xe0)](_0x39dc3b[_0x2bdfdc(0xdb)]);if(_0x386fcf){const _0x1af7b3=_0x1b27ec(_0x386fcf);return _0x1af7b3?_0x1af7b3+'/'+_0x39dc3b[_0x2bdfdc(0xdc)]:_0x39dc3b[_0x2bdfdc(0xdc)];}}return _0x39dc3b[_0x2bdfdc(0xdc)];}for(const _0x19189e of _0x3da3c9){const _0x24b893=_0x1b27ec(_0x19189e);_0x374ab2[_0x29b048(0xea)](_0x24b893,_0x19189e['id']);}return _0x374ab2;}export function buildFolderMaps(_0xddcb45){const _0x215f30=a153_0x34fe,_0x155f42=buildFolderIdToPathMap(_0xddcb45),_0x4d51c3=new Map();for(const [_0x13309a,_0x5775f8]of _0x155f42){_0x4d51c3[_0x215f30(0xea)](_0x5775f8,_0x13309a);}return{'idToPath':_0x155f42,'pathToId':_0x4d51c3};}function a153_0x34fe(_0x5b7380,_0x3070cb){_0x5b7380=_0x5b7380-0xdb;const _0x229640=a153_0x2296();let _0x34feb2=_0x229640[_0x5b7380];return _0x34feb2;}function a153_0x2296(){const _0x438d7b=['1EXvIZN','16ZbrRaa','2986734dKrtSw','add','30136ydBlCy','has','3528288ksrbzV','set','parentFolderId','name','373512QUZVso','9151072tjnjwn','5616360Otwsgk','get','5736460LceltG','3852CpiQSc'];a153_0x2296=function(){return _0x438d7b;};return a153_0x2296();}export function getFolderPath(_0x15bdb1,_0x2a26fe){const _0x411f71=a153_0x34fe;if(!_0x15bdb1)return'';return _0x2a26fe[_0x411f71(0xe0)](_0x15bdb1)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1cf657,_0x3013a6){const _0x19ec1d=a154_0x145f,_0x4e87b1=_0x1cf657();while(!![]){try{const _0x3a4fa1=-parseInt(_0x19ec1d(0x210))/0x1+parseInt(_0x19ec1d(0x206))/0x2*(-parseInt(_0x19ec1d(0x214))/0x3)+parseInt(_0x19ec1d(0x202))/0x4+parseInt(_0x19ec1d(0x1f5))/0x5*(parseInt(_0x19ec1d(0x204))/0x6)+-parseInt(_0x19ec1d(0x1f3))/0x7*(parseInt(_0x19ec1d(0x1eb))/0x8)+-parseInt(_0x19ec1d(0x1fd))/0x9+parseInt(_0x19ec1d(0x1f8))/0xa*(parseInt(_0x19ec1d(0x219))/0xb);if(_0x3a4fa1===_0x3013a6)break;else _0x4e87b1['push'](_0x4e87b1['shift']());}catch(_0x253af6){_0x4e87b1['push'](_0x4e87b1['shift']());}}}(a154_0x18b9,0xd4d64));function a154_0x18b9(){const _0x26d6fc=['exists','.yaml','parent_segment','filter','6936812yhyQtE','parse','20166NxHEHS','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','12cJwcnF','slice','segments','raw','Path\x20cannot\x20be\x20empty','Path\x20must\x20contain\x20at\x20least\x20one\x20segment','No\x20tdx.json\x20found\x20for\x20file:\x20','resolve','Path\x20attempts\x20to\x20navigate\x20above\x20root','isAbsolute','165065TvxESP','trim','Cannot\x20navigate\x20above\x20root','Cannot\x20split\x20empty\x20path','124830hEwILp','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','root','test','Path\x20segment\x20cannot\x20be\x20empty','13156979INvmWz','split','join','File\x20not\x20found:\x20','readFile','136dhXRjq','pop','name','dirname','length','tdx.json','endsWith','push','257705roTRdJ','journey','715rWQPxj','replace','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','10cdvBxa','startsWith','relative','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','substring','13486995zROLaN'];a154_0x18b9=function(){return _0x26d6fc;};return a154_0x18b9();}import a154_0x5ee219 from'path';import{parse as a154_0x537b20}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0xf292d1){const _0x2e2218=a154_0x145f;if(!_0xf292d1||_0xf292d1[_0x2e2218(0x211)]()==='')throw new Error(_0x2e2218(0x20a));const _0x2c3875=_0xf292d1[_0x2e2218(0x211)]();if(_0x2c3875==='/')return{'segments':[],'isAbsolute':!![],'raw':_0xf292d1};const _0x48bf27=_0x2c3875[_0x2e2218(0x1f9)]('/')?_0x2c3875[_0x2e2218(0x1fc)](0x1):_0x2c3875,_0x4da826=_0x48bf27[_0x2e2218(0x1e7)]('/')[_0x2e2218(0x201)](_0x5dea0a=>_0x5dea0a!=='');if(_0x4da826[_0x2e2218(0x1ef)]===0x0)throw new Error(_0x2e2218(0x20b));const _0x5732eb=_0x2c3875['startsWith']('/')||!isRelativePathSegment(_0x4da826[0x0]);for(const _0x3ff8c3 of _0x4da826){validatePathSegment(_0x3ff8c3);}return{'segments':_0x4da826,'isAbsolute':_0x5732eb,'raw':_0xf292d1};}function isRelativePathSegment(_0x120bc6){return _0x120bc6==='.'||_0x120bc6==='..';}function validatePathSegment(_0x442ece){const _0x4f8e1c=a154_0x145f;if(_0x442ece==='')throw new Error(_0x4f8e1c(0x218));if(_0x442ece==='.'||_0x442ece==='..')return;if(/[\x00-\x1F\x7F]/[_0x4f8e1c(0x217)](_0x442ece))throw new Error(_0x4f8e1c(0x205)+_0x442ece);if(_0x442ece!==_0x442ece['trim']()){}}export function validatePath(_0x439e42){const _0x46ea94=a154_0x145f;if(_0x439e42['segments'][_0x46ea94(0x1ef)]===0x0&&!_0x439e42[_0x46ea94(0x20f)])throw new Error('Relative\x20path\x20cannot\x20be\x20empty');if(_0x439e42[_0x46ea94(0x20f)]){if(_0x439e42[_0x46ea94(0x208)][0x0]==='..')throw new Error(_0x46ea94(0x215));let _0x2dce9e=0x0;for(const _0x13ab67 of _0x439e42[_0x46ea94(0x208)]){if(_0x13ab67==='..'){if(_0x2dce9e===0x0)throw new Error(_0x46ea94(0x20e));_0x2dce9e--;}else _0x13ab67!=='.'&&_0x2dce9e++;}}}function a154_0x145f(_0x56eca5,_0x540f86){_0x56eca5=_0x56eca5-0x1e7;const _0x18b9e4=a154_0x18b9();let _0x145fbf=_0x18b9e4[_0x56eca5];return _0x145fbf;}export function joinPaths(_0x2ec407,_0x33ef1e){const _0x5054a6=a154_0x145f;if(!_0x2ec407||_0x2ec407==='/')return _0x33ef1e;if(!_0x33ef1e||_0x33ef1e==='.')return _0x2ec407;if(_0x33ef1e[_0x5054a6(0x1f9)]('/'))return _0x33ef1e;const _0x1c71a9=parsePath(_0x2ec407),_0x1e3a5f=parsePath(_0x33ef1e),_0x2c43e2=[..._0x1c71a9[_0x5054a6(0x208)]];for(const _0x18a0e3 of _0x1e3a5f[_0x5054a6(0x208)]){if(_0x18a0e3==='.')continue;else{if(_0x18a0e3==='..'){if(_0x2c43e2['length']===0x0)throw new Error(_0x5054a6(0x212));_0x2c43e2[_0x5054a6(0x1ec)]();}else _0x2c43e2[_0x5054a6(0x1f2)](_0x18a0e3);}}const _0x198d22=_0x2c43e2[_0x5054a6(0x1e8)]('/');return _0x1c71a9[_0x5054a6(0x209)][_0x5054a6(0x1f9)]('/')?'/'+_0x198d22:_0x198d22;}export function normalizePath(_0x262ff1){const _0x1f2441=a154_0x145f,_0x5f2cb1=parsePath(_0x262ff1),_0x545d91=[];for(const _0x102077 of _0x5f2cb1[_0x1f2441(0x208)]){if(_0x102077==='.')continue;else{if(_0x102077==='..'){if(_0x545d91[_0x1f2441(0x1ef)]===0x0){if(_0x5f2cb1[_0x1f2441(0x20f)])throw new Error('Cannot\x20navigate\x20above\x20root');_0x545d91[_0x1f2441(0x1f2)]('..');}else _0x545d91[_0x545d91['length']-0x1]==='..'?_0x545d91[_0x1f2441(0x1f2)]('..'):_0x545d91[_0x1f2441(0x1ec)]();}else _0x545d91[_0x1f2441(0x1f2)](_0x102077);}}if(_0x545d91[_0x1f2441(0x1ef)]===0x0)return _0x5f2cb1[_0x1f2441(0x20f)]?'/':'.';const _0x3d2613=_0x545d91[_0x1f2441(0x1e8)]('/');return _0x5f2cb1[_0x1f2441(0x209)][_0x1f2441(0x1f9)]('/')?'/'+_0x3d2613:_0x3d2613;}export function getParentPath(_0xc544d2){const _0xf27b0e=a154_0x145f,_0x24f04d=parsePath(_0xc544d2);if(_0x24f04d['segments'][_0xf27b0e(0x1ef)]<=0x1)return'/';const _0x53b199=_0x24f04d[_0xf27b0e(0x208)][_0xf27b0e(0x207)](0x0,-0x1)['join']('/');return _0x24f04d[_0xf27b0e(0x209)][_0xf27b0e(0x1f9)]('/')?'/'+_0x53b199:_0x53b199;}export function getBaseName(_0x29f685){const _0x5940ff=a154_0x145f,_0x4f9e20=parsePath(_0x29f685);return _0x4f9e20['segments'][_0x4f9e20[_0x5940ff(0x208)][_0x5940ff(0x1ef)]-0x1]||'';}export function isChildPath(_0x5e880e,_0x366411){const _0x4a4856=a154_0x145f,_0x46c789=parsePath(_0x5e880e),_0x2e816a=parsePath(_0x366411);if(_0x46c789[_0x4a4856(0x208)][_0x4a4856(0x1ef)]<=_0x2e816a[_0x4a4856(0x208)]['length'])return![];for(let _0x27dbf1=0x0;_0x27dbf1<_0x2e816a[_0x4a4856(0x208)][_0x4a4856(0x1ef)];_0x27dbf1++){if(_0x46c789[_0x4a4856(0x208)][_0x27dbf1]!==_0x2e816a['segments'][_0x27dbf1])return![];}return!![];}export function splitPath(_0x7b1cd9){const _0x4682e6=a154_0x145f,_0x53d321=parsePath(_0x7b1cd9);if(_0x53d321['segments'][_0x4682e6(0x1ef)]===0x0)throw new Error(_0x4682e6(0x213));if(_0x53d321['segments'][_0x4682e6(0x1ef)]===0x1)return{'parent':_0x53d321[_0x4682e6(0x208)][0x0]};return{'parent':_0x53d321['segments'][0x0],'child':_0x53d321[_0x4682e6(0x208)]['slice'](0x1)[_0x4682e6(0x1e8)]('/')};}export function isYamlFilePath(_0x5b6458){const _0x121c6a=a154_0x145f;return _0x5b6458[_0x121c6a(0x1f1)]('.yml')||_0x5b6458[_0x121c6a(0x1f1)](_0x121c6a(0x1ff));}export async function resolveYamlFilePath(_0x8d0a9c,_0x36fa34=nodeFileSystem){const _0x341f33=a154_0x145f,_0x342bb2=a154_0x5ee219[_0x341f33(0x20d)](_0x8d0a9c);if(!await _0x36fa34[_0x341f33(0x1fe)](_0x342bb2))throw new Error(_0x341f33(0x1e9)+_0x8d0a9c);let _0x575070=a154_0x5ee219[_0x341f33(0x1ee)](_0x342bb2),_0x264316=null,_0x15a623=null;const _0x3abb48=a154_0x5ee219['parse'](_0x575070)[_0x341f33(0x216)];while(_0x575070!==_0x3abb48){const _0x4e8ad8=a154_0x5ee219[_0x341f33(0x1e8)](_0x575070,_0x341f33(0x1f0));if(await _0x36fa34['exists'](_0x4e8ad8)){_0x264316=_0x4e8ad8,_0x15a623=_0x575070;break;}_0x575070=a154_0x5ee219['dirname'](_0x575070);}if(!_0x264316||!_0x15a623)throw new Error(_0x341f33(0x20c)+_0x8d0a9c+'\x0a'+_0x341f33(0x1fb));const _0x95cb65=await _0x36fa34['readFile'](_0x264316),_0xd4a923=JSON[_0x341f33(0x203)](_0x95cb65),_0x4a0526=_0xd4a923[_0x341f33(0x200)];if(!_0x4a0526)throw new Error('Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field');const _0x1243b3=await _0x36fa34[_0x341f33(0x1ea)](_0x342bb2),_0x4200d8=a154_0x537b20(_0x1243b3),_0x4835d1=_0x4200d8[_0x341f33(0x1ed)];if(!_0x4835d1)throw new Error(_0x341f33(0x1f7)+_0x8d0a9c);const _0x43fb54=_0x4200d8['type']===_0x341f33(0x1f4)?_0x341f33(0x1f4):'segment',_0x17da4d=a154_0x5ee219[_0x341f33(0x1fa)](_0x15a623,_0x342bb2),_0x29ef29=a154_0x5ee219['dirname'](_0x17da4d),_0x14b719=_0x29ef29==='.'?'':_0x29ef29[_0x341f33(0x1f6)](/\\/g,'/'),_0x27f061=_0x14b719?_0x4a0526+'/'+_0x14b719+'/'+_0x4835d1:_0x4a0526+'/'+_0x4835d1;return{'parentSegment':_0x4a0526,'segmentName':_0x4835d1,'folderPath':_0x14b719,'fullPath':_0x27f061,'resourceType':_0x43fb54,'content':_0x1243b3};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5dffc0,_0x1df249){const _0x58701a=a155_0x53a7,_0x49ea3f=_0x5dffc0();while(!![]){try{const _0x5b5181=parseInt(_0x58701a(0x1e3))/0x1*(parseInt(_0x58701a(0x1d6))/0x2)+parseInt(_0x58701a(0x1d8))/0x3*(-parseInt(_0x58701a(0x1e4))/0x4)+parseInt(_0x58701a(0x1d5))/0x5*(-parseInt(_0x58701a(0x1de))/0x6)+-parseInt(_0x58701a(0x1dd))/0x7*(-parseInt(_0x58701a(0x1e1))/0x8)+-parseInt(_0x58701a(0x1e2))/0x9*(parseInt(_0x58701a(0x1d9))/0xa)+parseInt(_0x58701a(0x1da))/0xb+parseInt(_0x58701a(0x1df))/0xc;if(_0x5b5181===_0x1df249)break;else _0x49ea3f['push'](_0x49ea3f['shift']());}catch(_0x28aa59){_0x49ea3f['push'](_0x49ea3f['shift']());}}}(a155_0x34ca,0x1dcbc));export function parseSegmentRef(_0x10711d){const _0x16f8bf=a155_0x53a7,_0x27b3b0=_0x10711d[_0x16f8bf(0x1d7)]('/');if(_0x27b3b0===-0x1)return{'parentId':_0x10711d};if(_0x27b3b0===0x0)throw new Error(_0x16f8bf(0x1dc)+_0x10711d+_0x16f8bf(0x1db));const _0xb5ed08=_0x10711d['substring'](0x0,_0x27b3b0),_0xecf628=_0x10711d[_0x16f8bf(0x1e0)](_0x27b3b0+0x1);if(_0xecf628==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x10711d+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0xb5ed08,'childId':_0xecf628};}function a155_0x53a7(_0x174431,_0x3f70d8){_0x174431=_0x174431-0x1d5;const _0x34cacb=a155_0x34ca();let _0x53a739=_0x34cacb[_0x174431];return _0x53a739;}function a155_0x34ca(){const _0xef65b5=['12268cNaDoe','61025Mopdbx','280538MODLQi','indexOf','30WBnEES','1925260laoGBt','1056187iJVKYG','.\x20Parent\x20name\x20cannot\x20be\x20empty','Invalid\x20segment\x20reference\x20format:\x20','315vumzns','114GbJMmf','2704008EvRSrW','substring','20536DhdPHJ','9SYljMc','1rHTCjZ'];a155_0x34ca=function(){return _0xef65b5;};return a155_0x34ca();}
|