@treasuredata/tdx 2026.4.3 → 2026.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/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_0x2ec71=a152_0x269d;(function(_0xbfec1,_0x2caea1){const _0x18afc8=a152_0x269d,_0x3d8217=_0xbfec1();while(!![]){try{const _0x403b42=-parseInt(_0x18afc8(0x147))/0x1*(-parseInt(_0x18afc8(0x1c1))/0x2)+parseInt(_0x18afc8(0x1db))/0x3+-parseInt(_0x18afc8(0x113))/0x4*(-parseInt(_0x18afc8(0x132))/0x5)+-parseInt(_0x18afc8(0x19a))/0x6*(-parseInt(_0x18afc8(0x1a7))/0x7)+parseInt(_0x18afc8(0x1ee))/0x8+-parseInt(_0x18afc8(0x1b9))/0x9*(-parseInt(_0x18afc8(0x1dd))/0xa)+-parseInt(_0x18afc8(0x192))/0xb*(parseInt(_0x18afc8(0x15e))/0xc);if(_0x403b42===_0x2caea1)break;else _0x3d8217['push'](_0x3d8217['shift']());}catch(_0x1d9b50){_0x3d8217['push'](_0x3d8217['shift']());}}}(a152_0xc304,0xf1190));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x2ec71(0x158));export const PENDING_SEGMENT_PREFIX=a152_0x2ec71(0x11f);export const PENDING_ACTIVATION_PREFIX=a152_0x2ec71(0x146);export function createPendingSegmentId(_0x2590df){return''+PENDING_SEGMENT_PREFIX+_0x2590df+'__';}function a152_0x269d(_0x565899,_0xc9e5a8){_0x565899=_0x565899-0xfd;const _0xc3048a=a152_0xc304();let _0x269d49=_0xc3048a[_0x565899];return _0x269d49;}export function isPendingSegmentId(_0x20e374){const _0x1ca5f7=a152_0x2ec71;return _0x20e374[_0x1ca5f7(0x12d)](PENDING_SEGMENT_PREFIX)&&!_0x20e374[_0x1ca5f7(0x12d)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0xb19b29){const _0x357a5e=a152_0x2ec71;return _0xb19b29[_0x357a5e(0x16e)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x3cb3bb){return''+PENDING_ACTIVATION_PREFIX+_0x3cb3bb+'__';}export function isPendingActivationId(_0x465360){const _0x8010d0=a152_0x2ec71;return _0x465360[_0x8010d0(0x12d)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5c4fc7){const _0x5b2b35=a152_0x2ec71;return _0x5c4fc7[_0x5b2b35(0x16e)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x38a007,_0x5d2414){const _0x524499=a152_0x2ec71,_0x481d21=_0x38a007+'::'+(_0x5d2414['trim']()||_0x524499(0x137)),_0x389232=createHash('sha1')[_0x524499(0x156)](_0x481d21)['digest'](_0x524499(0x1e7))['slice'](0x0,0xc);return _0x524499(0x15d)+_0x389232;}export function ensureJourneyDefaults(_0x40c7a9){const _0x40292d=a152_0x2ec71;!_0x40c7a9[_0x40292d(0x1cf)]&&(_0x40c7a9[_0x40292d(0x1cf)]=''),!_0x40c7a9['state']&&(_0x40c7a9[_0x40292d(0x115)]=_0x40292d(0x149));}export function injectExistingStageIds(_0x2b36ef,_0x29b5e3){const _0x1b9335=a152_0x2ec71,_0xcc7ed3=new Map(_0x29b5e3['map'](_0x528f9f=>[_0x528f9f[_0x1b9335(0x14c)],_0x528f9f['id']]));for(const _0x59302d of _0x2b36ef){if(!_0x59302d['id']){const _0x3013d5=_0xcc7ed3[_0x1b9335(0x1e4)](_0x59302d['name']);_0x3013d5&&(_0x59302d['id']=_0x3013d5);}}}export function resolveTDFolderPath(_0x497602,_0x27915c,_0x463e88){if(!_0x27915c)return _0x497602;if(_0x497602===_0x463e88||_0x497602['startsWith'](_0x463e88+'/'))return _0x497602;return _0x497602?_0x463e88+'/'+_0x497602:_0x463e88;}export function addFoldersToCreate(_0x50f404,_0x112ec6,_0x421260){const _0x584854=a152_0x2ec71;if(!_0x50f404)return;if(_0x112ec6[_0x584854(0x14d)](_0x50f404))return;const _0xa9ff8b=_0x50f404[_0x584854(0x1ab)]('/');let _0x5c7641='';for(const _0x37b8b7 of _0xa9ff8b){_0x5c7641=_0x5c7641?_0x5c7641+'/'+_0x37b8b7:_0x37b8b7,!_0x112ec6[_0x584854(0x14d)](_0x5c7641)&&_0x421260['add'](_0x5c7641);}}export function sortFoldersByDepth(_0x367b27){const _0x1fe914=a152_0x2ec71;return[..._0x367b27][_0x1fe914(0x1e0)]((_0x22403f,_0x4ca0f8)=>{const _0x41cb85=_0x1fe914,_0x345c6b=(_0x22403f[_0x41cb85(0x16b)](/\//g)||[])[_0x41cb85(0x138)],_0x424921=(_0x4ca0f8[_0x41cb85(0x16b)](/\//g)||[])[_0x41cb85(0x138)];return _0x345c6b-_0x424921;});}import*as a152_0x247b09 from'yaml';import{readFileSync}from'fs';import a152_0x519f44 from'path';import{isJourneyDef,parseYamlString as a152_0x4d5dab,toYamlString as a152_0x255d19,normalizeJourneyDef,hasMultipleVersions,journeyResponseToDef,collectSegmentIdsFromJourneyApi}from'./journey-yaml.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,createJumpTargetCache,resolveJumpTarget,buildMergedJourneyDef,buildLocalRuleToNameMappingFromJourney,collectSegmentUsageCounts}from'./journey-utils.js';function a152_0xc304(){const _0x1cb2d0=['Fetching\x20','notification','kind','ACTIVATION_UPDATE_ERROR','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','uniqueServerName','startsWith','Failed\x20to\x20','diff','absolutePath','\x27...','87510GpAsxY','localName','relative','deps','segment_updating','segment','length','createJourneySegment','stringify','embedded_segment_created','existingActivation','\x20(referenced\x20in\x20journey\x20','createdSegmentIds','createdSegmentId','results','object','idToEmailMap','getSegment','Activation','DecisionPoint','__pending_act_','17OihqUR','Created\x20segment\x20\x27','draft','values','activationStepsById','name','has','getLatestJourneyId','Updated\x20journey\x20\x27','JOURNEY_UPDATE_ERROR','includes','delete','conditionTimeoutDuration','journey','parentFolder','update','journeyId','tdx.sdk.push-workflow','Updated\x20segment\x20\x27','Deleted\x20activation\x20\x27','withProgress','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','journey_entry_criteria_','24JMhmiF','embedded_activation_created','logSuccess','):\x20','connectionIdToNameMap','Entry\x20criteria:\x20','connection','Name\x20has\x20already\x20been\x20taken','from','branches','journey_updating','Failed\x20to\x20resolve\x20activation\x20','Activation\x20not\x20found:\x20','match','activation_template_id','toString','replace','segments','connector_config','\x27\x20exit\x20criteria','logWarning','debug','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','isNew','size','activation_','SEGMENT_SYNTAX_ERROR','resolvedRule','decision_point','SEGMENT_UPDATE_ERROR','existingSegment','getJourney','journeyBundlesByFolderAndName','parentId','parseDocument',').\x20','entries','find','folder_creating','listActivations','entryCriteria','\x27\x20entry\x20criteria','map','created','journeyName','Failed\x20to\x20resolve\x20segment\x20','null','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','set','embedded_segment_creating','message','yamlConfig','33413501dXilSs','run_after_journey_refresh','uniqueSegmentName','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','day','milestone','Created\x20journey\x20\x27','parse','1842TqzhXf','updateSegmentById','valid','existingJourney','journeyById','type','Segment\x20not\x20found','./journey-yaml.js','behavior','activation_deleted','journeyActivationStepId','Creating\x20folder\x20\x27','activation_created','33691OlxtMw','journey_creating','folderPathToId','waitStep','split','keys','yamlActivation','slice','segmentByFolderAndName','./child-segment-yaml.js','with','schedule','push','hasChanges','exitCriterias','rule','fetchJourney','isArray','36ELsrwK','waitStepType','folder','skipSegments','all','max','unchanged','Segment\x20not\x20found:\x20','187494moiyST',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','Updating\x20activation\x20\x27','segment_deleting','Journey\x20\x27','Deleting\x20activation\x20\x27','ACTIVATION_SYNTAX_ERROR','\x27\x20milestone','Failed\x20to\x20fetch\x20referenced\x20segment\x20','resolveJourneyId','relationships','\x27\x20to\x20local\x20\x27','journey_created','conditionTimeoutUnit','description','Embedded\x20segment\x20\x27','Creating\x20activation\x20\x27','SEGMENT_NOT_FOUND','columns','progress','onProgress','deleted','folderPath','Created\x20folder\x20\x27','toISOString','filter','5433915jnmTYF','\x27\x20wait\x20condition','4285930JWleTV','versionNumber','goal\x20criteria','sort','item','waitStepUnit','parentSegmentFolder','get','journeyStages','resolveSegment','hex','folderId','utf-8','stage\x20\x27','activationActions','stages','Duration','3305960LrGwaE','Updated\x20activation\x20\x27','segmentFolderId','and\x20the\x20server\x20segment,\x20then\x20retry.','\x27\x20from\x20file:\x20','goal','action','Stage\x20\x27','embeddedSegmentNameToId','activationContext','updated','embedded_activation_creating','logInfo','NOT_FOUND','list','Condition','steps','conditions','all_columns','JOURNEY_SYNTAX_ERROR','segmentNameToId','logDeleted','deleteSegment','user','existingSegments','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','create','\x0a\x20\x20','dirname','entry_criteria','conditionSegmentId','\x27\x20for\x20','createFolder','createActivation','errors','getSegmentEntity','reduce','add','validatedRequest','attributes','effectiveFolderId','\x20error(s)','join','12RkdsKf','segmentId','state','deleteActivation','Updating\x20segment\x20\x27','WaitStep','idToName','Created\x20activation\x20\x27','activations','data','journeys','activationsBySegmentId','__pending_','entry','../../utils/async.js','some','journeyBundleName','toLowerCase','index','INTERNAL'];a152_0xc304=function(){return _0x1cb2d0;};return a152_0xc304();}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(_0x3ba9b7){const _0x28f4e9=a152_0x2ec71;if(Array[_0x28f4e9(0x1b8)](_0x3ba9b7))return'['+_0x3ba9b7[_0x28f4e9(0x188)](_0x544225=>stableStringify(_0x544225))[_0x28f4e9(0x112)](',')+']';if(_0x3ba9b7&&typeof _0x3ba9b7===_0x28f4e9(0x141)){const _0x1acffc=_0x3ba9b7,_0x281d07=Object[_0x28f4e9(0x1ac)](_0x1acffc)[_0x28f4e9(0x1e0)](),_0x5c4988=_0x281d07[_0x28f4e9(0x188)](_0x58b8a6=>'\x22'+_0x58b8a6+'\x22:'+stableStringify(_0x1acffc[_0x58b8a6]));return'{'+_0x5c4988[_0x28f4e9(0x112)](',')+'}';}const _0x5a5e47=JSON[_0x28f4e9(0x13a)](_0x3ba9b7);return _0x5a5e47===undefined?_0x28f4e9(0x18c):_0x5a5e47;}function activationSignature(_0x4e4472){const _0x98f089=a152_0x2ec71,_0x43702e={'connection':_0x4e4472[_0x98f089(0x164)],..._0x4e4472[_0x98f089(0x200)]!==undefined&&{'all_columns':_0x4e4472[_0x98f089(0x200)]},..._0x4e4472[_0x98f089(0x1d3)]!==undefined&&{'columns':_0x4e4472[_0x98f089(0x1d3)]},..._0x4e4472[_0x98f089(0x1a2)]!==undefined&&{'behavior':_0x4e4472[_0x98f089(0x1a2)]},..._0x4e4472[_0x98f089(0x1b2)]!==undefined&&{'schedule':_0x4e4472[_0x98f089(0x1b2)]},..._0x4e4472[_0x98f089(0x128)]!==undefined&&{'notification':_0x4e4472[_0x98f089(0x128)]},..._0x4e4472['connector_config']!==undefined&&{'connector_config':_0x4e4472[_0x98f089(0x170)]},..._0x4e4472['activation_template_id']!==undefined&&{'activation_template_id':_0x4e4472[_0x98f089(0x16c)]}};return stableStringify(_0x43702e);}async function fetchSegment(_0x3f05f6,_0x1f7481,_0x1d4ec0,_0x32d999){const _0x1ce285=a152_0x2ec71,_0x9a4f0=_0x32d999?.[_0x1ce285(0x183)](_0xa4c55b=>_0xa4c55b['id']===_0x1d4ec0);if(_0x9a4f0)return _0x9a4f0;try{return await _0x3f05f6[_0x1ce285(0x137)][_0x1ce285(0x143)](_0x1f7481,_0x1d4ec0);}catch(_0x14ce6){logger['debug']('getSegment\x20failed\x20for\x20'+_0x1d4ec0+_0x1ce285(0x1c2)+_0x14ce6);try{return await _0x3f05f6[_0x1ce285(0x137)][_0x1ce285(0x10b)](_0x1d4ec0);}catch(_0x20d814){return logger['debug']('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x1d4ec0+':\x20'+_0x20d814),null;}}}function recoverSegmentIdsFromPushRecovery(_0x33a42c,_0x5679a6,_0x5d9ca5){const _0x39875e=a152_0x2ec71,_0x5a2f87=readPushRecovery(_0x33a42c[_0x39875e(0x130)]);if(_0x5a2f87?.[_0x39875e(0x18a)]===_0x33a42c[_0x39875e(0x191)][_0x39875e(0x14c)])for(const [_0x5a0725,_0x2a9b04]of Object[_0x39875e(0x182)](_0x5a2f87['segments'])){const _0x411458=generateDeterministicJourneySegmentName(_0x33a42c[_0x39875e(0x191)][_0x39875e(0x14c)],_0x5a0725);_0x2a9b04['uniqueServerName']===_0x411458&&(_0x5679a6[_0x39875e(0x18e)](_0x5a0725,_0x2a9b04['segmentId']),_0x5d9ca5['set'](_0x5a0725,_0x2a9b04[_0x39875e(0x114)]));}}async function createOrRecoverEmbeddedSegment(_0x21d1c4,_0x262d68,_0x1c2901,_0x566737){const _0x250493=a152_0x2ec71;let _0x488ba9;try{_0x488ba9=await _0x21d1c4[_0x250493(0x137)][_0x250493(0x139)]({'name':_0x1c2901[_0x250493(0x194)],'description':_0x1c2901['description'],'journeyId':_0x1c2901[_0x250493(0x157)],'rule':_0x566737(_0x1c2901[_0x250493(0x179)],!![]),'countPopulation':!![],'parentFolderId':_0x1c2901[_0x250493(0x1e8)],'audienceId':_0x1c2901[_0x250493(0x17f)]});}catch(_0x198ca1){const _0x2bf491=_0x198ca1 instanceof Error&&_0x198ca1[_0x250493(0x190)][_0x250493(0x151)](_0x250493(0x165));if(_0x2bf491){const _0x2082f9=readPushRecovery(_0x262d68[_0x250493(0x130)]),_0x5cf415=_0x2082f9?.[_0x250493(0x18a)]===_0x262d68['yamlConfig'][_0x250493(0x14c)]?_0x2082f9[_0x250493(0x16f)][_0x1c2901[_0x250493(0x133)]]:undefined;if(_0x5cf415?.[_0x250493(0x12c)]===_0x1c2901[_0x250493(0x194)])await _0x21d1c4['segment'][_0x250493(0x19b)](_0x1c2901[_0x250493(0x17f)],_0x5cf415[_0x250493(0x114)],{'description':_0x1c2901[_0x250493(0x1cf)],'rule':_0x566737(_0x1c2901[_0x250493(0x179)],!![]),'countPopulation':!![]}),_0x488ba9=_0x5cf415[_0x250493(0x114)];else throw new SDKError(ErrorCode[_0x250493(0x17b)],_0x250493(0x1d0)+_0x1c2901[_0x250493(0x133)]+_0x250493(0x12b)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x262d68[_0x250493(0x130)][_0x250493(0x16e)](/([^/]+)$/,'.$1.push-recovery.json')+')\x20')+_0x250493(0x1f1),_0x198ca1);}else throw _0x198ca1;}return saveSegmentToPushRecovery(_0x262d68['absolutePath'],_0x262d68[_0x250493(0x191)][_0x250493(0x14c)],_0x1c2901[_0x250493(0x133)],{'segmentId':_0x488ba9,'uniqueServerName':_0x1c2901[_0x250493(0x194)],'createdAt':new Date()[_0x250493(0x1d9)]()}),_0x488ba9;}export async function prepareSegmentFiles(_0xd09893,_0x42d22a,_0x59e2bc,_0x4e19d3,_0x26d8b2){const _0x31fc55=a152_0x2ec71,{activationDefToCreateRequest:_0x11ca1c}=await import(_0x31fc55(0x1b0)),_0x4e57af=[],_0xf293c2=new Set();for(const {yamlConfig:_0x31b344,folderPath:_0x4bfd5a,sourcePath:_0x17745e}of _0xd09893){const _0x55b552=resolveTDFolderPath(_0x4bfd5a,_0x4e19d3,_0x26d8b2),_0x37979b=_0x55b552+':'+_0x31b344[_0x31fc55(0x14c)],_0x594ba1=_0x42d22a[_0x31fc55(0x1af)]['get'](_0x37979b),_0x1f2fcc=_0x594ba1?_0x42d22a[_0x31fc55(0x11e)]['get'](_0x594ba1['id'])||[]:[];addFoldersToCreate(_0x55b552,_0x42d22a[_0x31fc55(0x1a9)],_0xf293c2);const _0x1c27df=calculateActivationActions(_0x31b344['activations']||[],_0x1f2fcc,_0x42d22a[_0x31fc55(0x142)],_0x42d22a['connectionIdToNameMap']);for(const _0x1e94c1 of _0x1c27df){(_0x1e94c1[_0x31fc55(0x19f)]==='create'||_0x1e94c1[_0x31fc55(0x19f)]===_0x31fc55(0x156))&&_0x1e94c1[_0x31fc55(0x1ad)]&&(_0x1e94c1['validatedRequest']=await _0x11ca1c(_0x1e94c1[_0x31fc55(0x1ad)],_0x59e2bc));}const _0x7384a6=calculateSegmentDiff(_0x31b344,_0x594ba1,_0x1f2fcc,_0x42d22a[_0x31fc55(0x142)],_0x42d22a['connectionIdToNameMap']);_0x4e57af[_0x31fc55(0x1b3)]({'relativePath':_0x31b344[_0x31fc55(0x14c)],'absolutePath':_0x17745e,'yamlConfig':_0x31b344,'folderPath':_0x55b552,'existingSegment':_0x594ba1,'existingActivations':_0x1f2fcc,'isNew':_0x7384a6[_0x31fc55(0x175)],'hasChanges':_0x7384a6[_0x31fc55(0x1b4)],'diff':_0x7384a6['diff'],'activationActions':_0x1c27df});}return{'segmentFiles':_0x4e57af,'foldersToCreate':_0xf293c2};}export async function prepareJourneyFiles(_0x1c9792,_0x2824fb,_0x283250,_0x18494e){const _0xb4efee=a152_0x2ec71,_0x2a830b=[],_0x5a9f87=new Set();for(const {yamlConfig:_0x139317,folderPath:_0x10cc96,sourcePath:_0x457fdb}of _0x1c9792){const _0x4b148b=resolveTDFolderPath(_0x10cc96,_0x283250,_0x18494e),_0x5d5f97=_0x4b148b+':'+_0x139317['name'],_0x24acf1=_0x2824fb[_0xb4efee(0x17e)][_0xb4efee(0x1e4)](_0x5d5f97);let _0x1635a1,_0x292a3a;if(_0x24acf1&&_0x24acf1[_0xb4efee(0x138)]>0x0){const _0x49b152=buildLocalExpandedRuleMappings(_0x139317),{createYamlContext:_0x3312f2,prefetchJourneySegments:_0x12a17e}=createPushYamlContextForBundle(_0x2824fb[_0xb4efee(0x135)],_0x2824fb[_0xb4efee(0x17f)],_0x2824fb[_0xb4efee(0x100)],_0x49b152,_0x2824fb[_0xb4efee(0x142)],_0x2824fb[_0xb4efee(0x162)],_0x2824fb[_0xb4efee(0x14b)],_0x2824fb[_0xb4efee(0x19e)]);await _0x12a17e(_0x24acf1[_0xb4efee(0x188)](_0x3eb1f7=>_0x3eb1f7['id']));const _0x3bfa33=await _0x2824fb['deps'][_0xb4efee(0x154)][_0xb4efee(0x14e)](_0x24acf1[0x0]['journeyBundleId']),_0x4db68d=hasMultipleVersions(_0x139317),_0x183183=async _0x1592f8=>{const _0xa1a512=_0xb4efee,_0x287ddc=_0x2824fb['journeyById']?.['get'](_0x1592f8);if(_0x287ddc)return _0x287ddc;return _0x2824fb[_0xa1a512(0x1b7)]({'journeyId':_0x1592f8,'journeyName':_0x139317[_0xa1a512(0x14c)],'isMultiVersion':_0x24acf1[_0xa1a512(0x138)]>0x1});};if(_0x4db68d&&_0x24acf1[_0xb4efee(0x138)]>0x1){const _0x1599e1=[];for(const _0x24bbdd of _0x24acf1){const _0x270f3e=_0x24bbdd['versionNumber']||0x1;_0x2824fb[_0xb4efee(0x1d4)]?.[_0xb4efee(0x156)](_0xb4efee(0x127)+_0x139317[_0xb4efee(0x14c)]+'\x20v'+_0x270f3e);const _0x139d18=await _0x183183(_0x24bbdd['id']),_0x45eafa=_0x3312f2(_0x24bbdd['id']),_0x49681f=await journeyResponseToDef(_0x139d18,_0x45eafa);_0x1599e1[_0xb4efee(0x1b3)]({'item':_0x24bbdd,'yaml':_0x49681f});}const _0x59c323=buildLocalRuleToNameMappingFromJourney(_0x139317);_0x292a3a=buildMergedJourneyDef(_0x1599e1,_0x59c323,_0x3bfa33);const _0x3a2695=Math[_0xb4efee(0x1be)](..._0x1599e1['map'](_0x3ee0dd=>_0x3ee0dd[_0xb4efee(0x1e1)][_0xb4efee(0x1de)]||0x0)),_0x409437=_0x24acf1[_0xb4efee(0x183)](_0x45beb5=>(_0x45beb5[_0xb4efee(0x1de)]||0x0)===_0x3a2695);_0x409437&&(_0x2824fb[_0xb4efee(0x1d4)]?.[_0xb4efee(0x156)](_0xb4efee(0x127)+_0x139317[_0xb4efee(0x14c)]+'\x20v'+_0x3a2695),_0x1635a1=await _0x183183(_0x409437['id']));}else{const _0x33b4df=_0x24acf1[_0x24acf1[_0xb4efee(0x138)]-0x1];_0x2824fb[_0xb4efee(0x1d4)]?.[_0xb4efee(0x156)](_0xb4efee(0x127)+_0x139317[_0xb4efee(0x14c)]),_0x1635a1=await _0x183183(_0x33b4df['id']);const _0x2d8871=_0x3312f2(_0x33b4df['id']),_0x281159=await journeyResponseToDef(_0x1635a1,_0x2d8871),_0x146f8a=buildLocalRuleToNameMappingFromJourney(_0x139317);_0x292a3a=buildMergedJourneyDef([{'item':_0x33b4df,'yaml':_0x281159}],_0x146f8a,_0x3bfa33);}}addFoldersToCreate(_0x4b148b,_0x2824fb[_0xb4efee(0x1a9)],_0x5a9f87);const _0x323497=calculateJourneyDiff(_0x139317,_0x292a3a);_0x2a830b[_0xb4efee(0x1b3)]({'relativePath':_0x139317['name'],'absolutePath':_0x457fdb,'yamlConfig':_0x139317,'folderPath':_0x4b148b,'existingJourney':_0x1635a1,'isNew':_0x323497['isNew'],'hasChanges':_0x323497['hasChanges'],'diff':_0x323497[_0xb4efee(0x12f)]});}return{'journeyFiles':_0x2a830b,'foldersToCreate':_0x5a9f87};}export function calculateActivationActions(_0x33c15e,_0x47fbee,_0x294778,_0x303ab4){const _0x5d91d1=a152_0x2ec71,_0x25dd3d=[],_0x3e58fc=new Map();for(const _0x5bfdff of _0x47fbee){_0x3e58fc['set'](_0x5bfdff[_0x5d91d1(0x14c)],_0x5bfdff);}const _0x122049=new Map();for(const _0x3a836b of _0x33c15e){_0x122049[_0x5d91d1(0x18e)](_0x3a836b['name'],_0x3a836b);}for(const _0x10bb08 of _0x33c15e){const _0x328420=_0x3e58fc['get'](_0x10bb08[_0x5d91d1(0x14c)]);if(!_0x328420)_0x25dd3d[_0x5d91d1(0x1b3)]({'type':_0x5d91d1(0x102),'name':_0x10bb08[_0x5d91d1(0x14c)],'yamlActivation':_0x10bb08});else{const _0x335e33=activationResponseToDef(_0x328420,_0x294778,_0x303ab4),_0x10391a=a152_0x247b09[_0x5d91d1(0x13a)](_0x335e33),_0x4b69f1=a152_0x247b09[_0x5d91d1(0x13a)](_0x10bb08);_0x10391a!==_0x4b69f1&&_0x25dd3d[_0x5d91d1(0x1b3)]({'type':_0x5d91d1(0x156),'name':_0x10bb08[_0x5d91d1(0x14c)],'yamlActivation':_0x10bb08,'existingActivation':_0x328420});}}for(const _0x4da16d of _0x47fbee){!_0x122049['has'](_0x4da16d[_0x5d91d1(0x14c)])&&_0x25dd3d['push']({'type':_0x5d91d1(0x152),'name':_0x4da16d[_0x5d91d1(0x14c)],'existingActivation':_0x4da16d});}return _0x25dd3d;}function calculateYamlDiff(_0x39c5d5,_0x337437){if(_0x337437){const _0x58da07=generateDiff(_0x337437,_0x39c5d5),_0x43fcd5=hasChanges(_0x58da07);return{'isNew':![],'hasChanges':_0x43fcd5,'diff':_0x43fcd5?formatDiffWithColors(_0x58da07):undefined};}const _0x100b68=generateDiff('',_0x39c5d5);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x100b68)};}export function calculateSegmentDiff(_0x7226b3,_0x263d45,_0x51bf38,_0xbdcd70,_0x133880){const _0x5f06a3=segmentToYamlString(_0x7226b3),_0xfc9292=_0x263d45?segmentToYamlString(segmentWithActivationsToYaml(_0x263d45,_0x51bf38,undefined,_0xbdcd70,_0x133880)):undefined;return calculateYamlDiff(_0x5f06a3,_0xfc9292);}export function calculateJourneyDiff(_0x4ef5a1,_0x4cd6e2){const _0x3e4490=normalizeJourneyDef(_0x4ef5a1,_0x4ef5a1),_0x35bf23=a152_0x255d19(_0x3e4490),_0xad116d=_0x4cd6e2?a152_0x255d19(normalizeJourneyDef(_0x4cd6e2,_0x4ef5a1)):undefined;return calculateYamlDiff(_0x35bf23,_0xad116d);}export function findSegmentsToDelete(_0x3a096e,_0x2ebca1,_0x53b83e,_0x114577,_0x5a07b6){const _0x1cce30=a152_0x2ec71,_0x3763ea=new Set();for(const {yamlConfig:_0x3258c8,folderPath:_0x3e74c2}of _0x2ebca1){_0x3763ea['add'](_0x3e74c2+':'+_0x3258c8[_0x1cce30(0x14c)]);}return _0x3a096e[_0x1cce30(0x1da)](_0x59b035=>{const _0x2905bd=_0x1cce30,_0x4cd6fd=_0x59b035[_0x2905bd(0x1f0)]?_0x53b83e[_0x2905bd(0x1e4)](_0x59b035[_0x2905bd(0x1f0)][_0x2905bd(0x16d)]())||'':'',_0xea4afd=_0x4cd6fd+':'+_0x59b035['name'];if(_0x3763ea[_0x2905bd(0x14d)](_0xea4afd))return![];if(_0x5a07b6)return _0x4cd6fd===_0x114577||_0x4cd6fd['startsWith'](_0x114577+'/');return!![];});}export function findJourneysToDelete(_0x577b79,_0x2ca643,_0x57d14e,_0x7c3c85,_0x3cf7e1){const _0x395e4e=a152_0x2ec71,_0x3e2207=new Set();for(const {yamlConfig:_0x2f7ba4,folderPath:_0x381ef8}of _0x2ca643){_0x3e2207[_0x395e4e(0x10d)](_0x381ef8+':'+_0x2f7ba4[_0x395e4e(0x14c)]);}return _0x577b79[_0x395e4e(0x1da)](_0x115b62=>{const _0x5f04e2=_0x395e4e,_0x492abd=_0x115b62[_0x5f04e2(0x1e8)]?_0x57d14e[_0x5f04e2(0x1e4)](_0x115b62['folderId'])||'':'',_0x4ab638=_0x492abd+':'+_0x115b62[_0x5f04e2(0x123)];if(_0x3e2207[_0x5f04e2(0x14d)](_0x4ab638))return![];if(_0x3cf7e1)return _0x492abd===_0x7c3c85||_0x492abd['startsWith'](_0x7c3c85+'/');return!![];});}export function buildSegmentLookupMap(_0x828923,_0x2f1bfa){const _0x272e7a=a152_0x2ec71,_0x368c39=new Map();for(const _0x229be5 of _0x828923){const _0x20cbf3=_0x229be5['segmentFolderId']?_0x2f1bfa['get'](_0x229be5['segmentFolderId'][_0x272e7a(0x16d)]())||'':'',_0x25b52a=_0x20cbf3+':'+_0x229be5[_0x272e7a(0x14c)];_0x368c39[_0x272e7a(0x18e)](_0x25b52a,_0x229be5);}return _0x368c39;}export function buildSegmentNameToIdMap(_0x55ec4d){const _0x3288ed=a152_0x2ec71,_0x4242dc=new Map();for(const _0x175138 of _0x55ec4d){_0x4242dc[_0x3288ed(0x18e)](_0x175138[_0x3288ed(0x14c)],_0x175138['id']);}return _0x4242dc;}export function buildJourneyBundleLookupMap(_0x263afc,_0x4ea5e7){const _0x5ef73a=a152_0x2ec71,_0x258ad3=new Map();for(const _0x55e877 of _0x263afc){const _0x42af34=_0x55e877[_0x5ef73a(0x1e8)]?_0x4ea5e7['get'](_0x55e877[_0x5ef73a(0x1e8)])||'':'',_0x5dce52=_0x42af34+':'+_0x55e877[_0x5ef73a(0x123)];!_0x258ad3['has'](_0x5dce52)&&_0x258ad3[_0x5ef73a(0x18e)](_0x5dce52,[]),_0x258ad3[_0x5ef73a(0x1e4)](_0x5dce52)['push'](_0x55e877);}for(const _0x2de381 of _0x258ad3[_0x5ef73a(0x14a)]()){_0x2de381[_0x5ef73a(0x1e0)]((_0xacd885,_0x4fc03a)=>(_0xacd885[_0x5ef73a(0x1de)]||0x0)-(_0x4fc03a[_0x5ef73a(0x1de)]||0x0));}return _0x258ad3;}export function collectFoldersToCreate(_0x178e18,_0x5b6ba6){const _0x1911e5=a152_0x2ec71,_0x551fbf=new Set();for(const _0x141ceb of _0x178e18){if(!_0x141ceb)continue;if(_0x5b6ba6[_0x1911e5(0x14d)](_0x141ceb))continue;const _0x1b9f08=_0x141ceb[_0x1911e5(0x1ab)]('/');let _0xa201bd='';for(const _0x23107a of _0x1b9f08){_0xa201bd=_0xa201bd?_0xa201bd+'/'+_0x23107a:_0x23107a,!_0x5b6ba6[_0x1911e5(0x14d)](_0xa201bd)&&_0x551fbf[_0x1911e5(0x10d)](_0xa201bd);}}return _0x551fbf;}export function parseAndClassifyYamlFiles(_0x22af81,_0x33d58c,_0x36ab71){const _0x1924e1=a152_0x2ec71,_0x304f54=[],_0x3d0dae=[];for(const _0x16e8cd of _0x22af81){const _0xb7556f=a152_0x519f44[_0x1924e1(0x134)](_0x33d58c,a152_0x519f44[_0x1924e1(0x104)](_0x16e8cd)),_0x4d45aa=_0xb7556f==='.'?'':_0xb7556f[_0x1924e1(0x16e)](/\\/g,'/'),_0x5b1c76=readFileSync(_0x16e8cd,'utf-8'),_0x1df30a=a152_0x247b09[_0x1924e1(0x199)](_0x5b1c76);if(isJourneyDef(_0x1df30a)){const _0x25484e=a152_0x4d5dab(_0x5b1c76);_0x3d0dae[_0x1924e1(0x1b3)]({'yamlConfig':_0x25484e,'folderPath':_0x4d45aa,'sourcePath':_0x16e8cd});}else{if(!_0x36ab71?.[_0x1924e1(0x1bc)]){const _0x1b5db0=parseSegmentYamlFile(_0x5b1c76),_0x3ccf0a=normalizeChildSegmentYaml(_0x1b5db0);_0x304f54[_0x1924e1(0x1b3)]({'yamlConfig':_0x3ccf0a,'folderPath':_0x4d45aa,'sourcePath':_0x16e8cd});}}}return{'segments':_0x304f54,'journeys':_0x3d0dae};}export function validateParsedFiles(_0x44dc68,_0x5a88ac){const _0x37c239=a152_0x2ec71,_0x119325=[];for(const {yamlConfig:_0x15e9df,sourcePath:_0x1cc1f0}of _0x44dc68[_0x37c239(0x16f)]){const _0x5c5760=readFileSync(_0x1cc1f0,'utf-8'),_0x517fc8=a152_0x247b09['parseDocument'](_0x5c5760),_0x1600cb=validateSegmentDef(_0x15e9df,{'source':_0x5c5760,'document':_0x517fc8},{'skipSchema':!![]});if(!_0x1600cb[_0x37c239(0x19c)]){const _0x5ca447=a152_0x519f44[_0x37c239(0x134)](_0x5a88ac,_0x1cc1f0);_0x119325[_0x37c239(0x1b3)]({'filePath':_0x5ca447,'source':_0x5c5760,'result':_0x1600cb,'isJourney':![]});}}for(const {yamlConfig:_0x3347be,sourcePath:_0x220801}of _0x44dc68[_0x37c239(0x11d)]){const _0x16a979=readFileSync(_0x220801,_0x37c239(0x1e9)),_0x3b958a=a152_0x247b09[_0x37c239(0x180)](_0x16a979),_0x3d4124=validateJourneyDef(_0x3347be,{'source':_0x16a979,'document':_0x3b958a},{'skipSchema':!![]});if(!_0x3d4124[_0x37c239(0x19c)]){const _0x2384fd=a152_0x519f44[_0x37c239(0x134)](_0x5a88ac,_0x220801);_0x119325[_0x37c239(0x1b3)]({'filePath':_0x2384fd,'source':_0x16a979,'result':_0x3d4124,'isJourney':!![]});}}return _0x119325;}export function formatValidationErrors(_0x1e2a16){const _0x1de9ab=a152_0x2ec71,_0x46b8c7=[];for(const {filePath:_0x3d75c7,source:_0x378cb9,result:_0x487621,isJourney:_0x5551bd}of _0x1e2a16){const _0x327c10=_0x5551bd?_0x1de9ab(0x154):_0x1de9ab(0x137);_0x46b8c7['push']('\x0a'+_0x3d75c7+'\x20('+_0x327c10+_0x1de9ab(0x161)+_0x487621[_0x1de9ab(0x10a)][_0x1de9ab(0x138)]+_0x1de9ab(0x111)),_0x46b8c7['push'](formatValidationResult(_0x487621,_0x378cb9,_0x3d75c7));}return _0x46b8c7['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x154752){const _0x8dad7c=a152_0x2ec71,_0x6d8f7b=new Set(),_0x2cf801=new Map(),_0x38d6c2=collectSegmentUsageCounts(_0x154752);if(_0x154752[_0x8dad7c(0x16f)])for(const [_0x3b48ce,_0xec1d1b]of Object[_0x8dad7c(0x182)](_0x154752[_0x8dad7c(0x16f)])){_0x6d8f7b[_0x8dad7c(0x10d)](_0x3b48ce);if(_0xec1d1b['rule']){const _0x2a7044=yamlRuleToApi(_0xec1d1b[_0x8dad7c(0x1b6)]),_0x113a38=apiRuleToYaml(_0x2a7044);_0x2cf801['set'](_0x3b48ce,_0x113a38);}}const _0xf9c2f8=new Map();let _0x51bb53=0x0;for(const [_0x45566c,_0x2a9b87]of _0x2cf801){const _0x196126=serializeExpandedRule(_0x2a9b87,_0x2cf801),_0x5af13d=_0xf9c2f8[_0x8dad7c(0x1e4)](_0x196126)||[];_0x5af13d[_0x8dad7c(0x1b3)]({'name':_0x45566c,'index':_0x51bb53}),_0xf9c2f8['set'](_0x196126,_0x5af13d),_0x51bb53++;}const _0x4c3e12=new Map();for(const [_0x4079d2,_0x156850]of _0xf9c2f8){const _0x19b329=_0x156850['slice']()['sort']((_0x58a563,_0x262641)=>{const _0x52354a=_0x8dad7c,_0x2b95f5=_0x38d6c2[_0x52354a(0x1e4)](_0x58a563[_0x52354a(0x14c)])||0x0,_0x293140=_0x38d6c2[_0x52354a(0x1e4)](_0x262641[_0x52354a(0x14c)])||0x0;if(_0x2b95f5!==_0x293140)return _0x293140-_0x2b95f5;return _0x58a563[_0x52354a(0x125)]-_0x262641[_0x52354a(0x125)];})['map'](_0x237ae1=>_0x237ae1['name']),_0xdc1ce8=[];for(const _0xdf06f9 of _0x19b329){const _0x419c3e=_0x38d6c2[_0x8dad7c(0x1e4)](_0xdf06f9)||0x0,_0x27a2ec=Math[_0x8dad7c(0x1be)](_0x419c3e,0x1);for(let _0x37bc0b=0x0;_0x37bc0b<_0x27a2ec;_0x37bc0b++){_0xdc1ce8['push'](_0xdf06f9);}}_0x4c3e12[_0x8dad7c(0x18e)](_0x4079d2,_0xdc1ce8);}return{'existingLocalSegmentNames':_0x6d8f7b,'localSegmentRules':_0x2cf801,'localExpandedRuleToNames':_0x4c3e12};}export function createSegmentIdResolver(_0x1799c4,_0x207755){return async _0x26cbf2=>{const _0x3865fd=a152_0x269d,_0x30d519=_0x1799c4[_0x3865fd(0x1e4)](_0x26cbf2);if(!_0x30d519)throw new SDKError(ErrorCode[_0x3865fd(0x1d2)],_0x3865fd(0x1c0)+_0x26cbf2+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x207755+'\x27)');return _0x30d519;};}export function extractRootFolderId(_0x342f86){const _0x4205cf=a152_0x2ec71;return _0x342f86[_0x4205cf(0x1cb)]?.[_0x4205cf(0x1e3)]?.['data']?.['id']||_0x342f86[_0x4205cf(0x1cb)]?.[_0x4205cf(0x155)]?.['data']?.['id'];}export function buildConnectionMaps(_0x37805e){const _0x1cc04f=a152_0x2ec71,_0x141502=new Map(),_0xbfa556=new Map(),_0x457ef2=new Map();for(const _0x51774d of _0x37805e){_0x141502[_0x1cc04f(0x18e)](_0x51774d[_0x1cc04f(0x14c)],parseInt(_0x51774d['id'],0xa)),_0xbfa556['set'](_0x51774d['id'],_0x51774d[_0x1cc04f(0x14c)]),_0x457ef2[_0x1cc04f(0x18e)](_0x51774d[_0x1cc04f(0x14c)],_0x51774d['type']);}return{'nameToId':_0x141502,'idToName':_0xbfa556,'nameToType':_0x457ef2};}export function calculatePushStats(_0x4fde6a,_0x1dacb4,_0x2daf70,_0x20069c,_0xa472ef,_0x423b0f,_0x5bfcc4){const _0x28f278=a152_0x2ec71,_0x221700=_0x4fde6a[_0x28f278(0x1da)](_0x162d1d=>_0x162d1d[_0x28f278(0x175)]),_0x177bbf=_0x4fde6a['filter'](_0x42cdf5=>!_0x42cdf5[_0x28f278(0x175)]&&_0x42cdf5[_0x28f278(0x1b4)]),_0x20ea0f=_0x4fde6a[_0x28f278(0x1da)](_0x4ed467=>!_0x4ed467[_0x28f278(0x175)]&&!_0x4ed467[_0x28f278(0x1b4)]),_0x2a2b23=_0x423b0f?_0x20069c:[],_0x1ee840=_0x1dacb4[_0x28f278(0x1da)](_0x3df9a8=>_0x3df9a8['isNew']),_0x307088=_0x1dacb4[_0x28f278(0x1da)](_0x288e7f=>!_0x288e7f[_0x28f278(0x175)]&&_0x288e7f[_0x28f278(0x1b4)]),_0x188d5c=_0x1dacb4[_0x28f278(0x1da)](_0x4be824=>!_0x4be824[_0x28f278(0x175)]&&!_0x4be824[_0x28f278(0x1b4)]),_0x5996db=_0x423b0f?_0xa472ef:[],_0x2e7fb0=_0x4fde6a['flatMap'](_0x303242=>_0x303242['activationActions']),_0x305898=_0x2e7fb0[_0x28f278(0x1da)](_0x1fce1c=>_0x1fce1c[_0x28f278(0x19f)]===_0x28f278(0x102)),_0x1c5ea9=_0x2e7fb0[_0x28f278(0x1da)](_0x3c0f51=>_0x3c0f51[_0x28f278(0x19f)]===_0x28f278(0x156)),_0x8384eb=_0x2e7fb0['filter'](_0x571baa=>_0x571baa[_0x28f278(0x19f)]===_0x28f278(0x152)),_0x1db804=Array[_0x28f278(0x166)](_0x2daf70)[_0x28f278(0x1e0)](),_0x5196b1=_0x5bfcc4?![]:_0x221700[_0x28f278(0x138)]>0x0||_0x177bbf['length']>0x0||_0x2a2b23['length']>0x0,_0x47001d=_0x1ee840['length']>0x0||_0x307088[_0x28f278(0x138)]>0x0||_0x5996db[_0x28f278(0x138)]>0x0,_0x593a1b=_0x5bfcc4?![]:_0x2e7fb0['length']>0x0,_0x1a54d9=_0x1db804['length']>0x0;return{'segments':{'new':_0x221700,'changed':_0x177bbf,'unchanged':_0x20ea0f,'toDelete':_0x2a2b23},'journeys':{'new':_0x1ee840,'changed':_0x307088,'unchanged':_0x188d5c,'toDelete':_0x5996db},'activations':{'all':_0x2e7fb0,'toCreate':_0x305898,'toUpdate':_0x1c5ea9,'toDelete':_0x8384eb},'folders':{'toCreate':_0x1db804},'counts':{'segments':{'new':_0x221700[_0x28f278(0x138)],'changed':_0x177bbf[_0x28f278(0x138)],'unchanged':_0x20ea0f['length'],'toDelete':_0x2a2b23[_0x28f278(0x138)]},'journeys':{'new':_0x1ee840[_0x28f278(0x138)],'changed':_0x307088[_0x28f278(0x138)],'unchanged':_0x188d5c['length'],'toDelete':_0x5996db[_0x28f278(0x138)]},'activations':{'create':_0x305898[_0x28f278(0x138)],'update':_0x1c5ea9[_0x28f278(0x138)],'delete':_0x8384eb[_0x28f278(0x138)]},'folders':_0x1db804[_0x28f278(0x138)]},'hasChanges':_0x5196b1||_0x47001d||_0x593a1b||_0x1a54d9};}export async function buildPushExecutionContext(_0x3e7924,_0x5d2842,_0xabc238,_0x16be8f,_0x20327e,_0x1dd251){const _0x546e0c=a152_0x2ec71,_0x548759=extractRootFolderId(_0xabc238),{pathToId:_0x5e363a,idToPath:_0x321ec1}=buildFolderMaps(_0x20327e),_0x115894=buildSegmentNameToIdMap(_0x16be8f),_0xf0c378=new Map(),{batchAsync:_0x5f5cb2}=await import(_0x546e0c(0x121)),[_0x45ac54,_0x4cf951]=await Promise[_0x546e0c(0x1bd)]([_0x3e7924[_0x546e0c(0xff)]['buildUserMaps'](),_0x3e7924[_0x546e0c(0x164)][_0x546e0c(0x1fc)](),((async()=>{const _0x183642=_0x546e0c;!_0x1dd251&&_0x16be8f[_0x183642(0x138)]>0x0&&await _0x5f5cb2(_0x16be8f,async _0x34b204=>{const _0x4df9a2=_0x183642,_0x2a3aa5=await _0x3e7924[_0x4df9a2(0x137)][_0x4df9a2(0x185)](_0x5d2842,_0x34b204['id']);_0xf0c378[_0x4df9a2(0x18e)](_0x34b204['id'],_0x2a3aa5);});})())]),{emailToId:_0x103476,idToEmail:_0x4f89d1}=_0x45ac54,_0x2596e9=buildConnectionMaps(_0x4cf951);return{'rootFolderId':_0x548759,'folderPathToId':_0x5e363a,'folderIdToPath':_0x321ec1,'segmentNameToId':_0x115894,'activationsBySegmentId':_0xf0c378,'emailToIdMap':_0x103476,'idToEmailMap':_0x4f89d1,'connectionNameToIdMap':_0x2596e9['nameToId'],'connectionIdToNameMap':_0x2596e9[_0x546e0c(0x119)],'connectionNameToTypeMap':_0x2596e9['nameToType']};}export function createPushYamlContextForBundle(_0x592313,_0x1ab4be,_0xda8f1,_0x32035f,_0x24cb67,_0x4a1569,_0x2561e4,_0x456f4e){const {existingLocalSegmentNames:_0x5c08f5,localExpandedRuleToNames:_0xb282e9}=_0x32035f,_0x209eac=new Set(),_0x2b5eec=new Map(),_0x746603=new Map(),_0x5d0d41=new Map(),_0x249444=createJumpTargetCache(),_0x1290ce=new Map(),_0x2238c0=new Map(),_0x283288=new Set();let _0x53b162;const _0x21596e=_0x392c13=>{const _0x388bc8={'resolveSegment':async _0x2f6fc2=>{const _0x55e187=a152_0x269d,_0x2b7920=_0x5d0d41[_0x55e187(0x1e4)](_0x2f6fc2);if(_0x2b7920!==undefined)return{'name':_0x2b7920,'isJourneyLocal':!![]};try{const _0x56df2f=await fetchSegment(_0x592313,_0x1ab4be,_0x2f6fc2,_0xda8f1);if(!_0x56df2f)throw new Error(_0x55e187(0x1a0));const _0x141f6d=generateJourneyLocalName(_0x56df2f[_0x55e187(0x14c)]),_0x476097=_0x56df2f[_0x55e187(0x129)]===SEGMENT_KIND_JOURNEY&&_0x141f6d!==undefined;let _0x25444a=_0x56df2f[_0x55e187(0x14c)],_0x2fdecc;if(_0x476097&&_0x56df2f[_0x55e187(0x1b6)]){const _0x1c63cd=apiRuleToYaml(_0x56df2f['rule']);_0x2238c0[_0x55e187(0x18e)](_0x2f6fc2,_0x1c63cd);const _0xedd503=async _0x3a6cec=>{const _0x19b24a=_0x55e187,_0x5b9068=collectSegmentRefsFromRule(_0x3a6cec);for(const _0x14e6c4 of _0x5b9068){if(!_0x2238c0[_0x19b24a(0x14d)](_0x14e6c4))try{const _0x50305c=await fetchSegment(_0x592313,_0x1ab4be,_0x14e6c4,_0xda8f1);if(_0x50305c?.[_0x19b24a(0x1b6)]){const _0x7d5435=apiRuleToYaml(_0x50305c[_0x19b24a(0x1b6)]);_0x2238c0['set'](_0x14e6c4,_0x7d5435),await _0xedd503(_0x7d5435);}}catch(_0x4f4450){logger[_0x19b24a(0x173)](_0x19b24a(0x1c9)+_0x14e6c4+':\x20'+_0x4f4450);}}};await _0xedd503(_0x1c63cd);const _0x2963a5=serializeExpandedRule(_0x1c63cd,_0x2238c0),_0x36b4e7=_0xb282e9[_0x55e187(0x1e4)](_0x2963a5);if(_0x36b4e7&&_0x36b4e7[_0x55e187(0x138)]>0x0){const _0x163682=_0x2b5eec[_0x55e187(0x1e4)](_0x2963a5)||0x0,_0x529b8e=_0x36b4e7[_0x163682]||_0x36b4e7[_0x36b4e7['length']-0x1];_0x2b5eec[_0x55e187(0x18e)](_0x2963a5,_0x163682+0x1),_0x25444a=_0x529b8e,_0x209eac[_0x55e187(0x10d)](_0x25444a),_0x5d0d41[_0x55e187(0x18e)](_0x2f6fc2,_0x25444a);const _0xd91a1=await resolveRuleSegmentRefs(_0x1c63cd,async _0x33e4b4=>{const _0x30f5da=_0x55e187,_0x1aa0f1=_0x5d0d41['get'](_0x33e4b4);if(_0x1aa0f1)return _0x1aa0f1;const _0x13592c=await _0x53b162[_0x30f5da(0x1e6)](_0x33e4b4);return _0x13592c[_0x30f5da(0x14c)];});_0x2fdecc={'description':_0x56df2f[_0x55e187(0x1cf)],'rule':_0xd91a1};}else{const _0x33d630=_0x1290ce[_0x55e187(0x1e4)](_0x2963a5);if(_0x33d630)_0x25444a=_0x33d630,_0x5d0d41[_0x55e187(0x18e)](_0x2f6fc2,_0x25444a);else{if(_0x141f6d){let _0xdef7d9=_0x141f6d,_0x2056ca=0x2;while(_0x209eac[_0x55e187(0x14d)](_0xdef7d9)||_0x5c08f5[_0x55e187(0x14d)](_0xdef7d9)){_0xdef7d9=_0x141f6d+'_'+_0x2056ca,_0x2056ca++;}_0x209eac[_0x55e187(0x10d)](_0xdef7d9),_0x25444a=_0xdef7d9;}_0x5d0d41[_0x55e187(0x18e)](_0x2f6fc2,_0x25444a),_0x1290ce[_0x55e187(0x18e)](_0x2963a5,_0x25444a);const _0x51833d=await resolveRuleSegmentRefs(_0x1c63cd,async _0x5ae41d=>{const _0x249b18=_0x55e187,_0x5408e9=_0x5d0d41[_0x249b18(0x1e4)](_0x5ae41d);if(_0x5408e9)return _0x5408e9;const _0x2cbae0=await _0x53b162[_0x249b18(0x1e6)](_0x5ae41d);return _0x2cbae0[_0x249b18(0x14c)];});_0x2fdecc={'description':_0x56df2f[_0x55e187(0x1cf)],'rule':_0x51833d};}}}return{'name':_0x25444a,'isJourneyLocal':_0x476097,'definition':_0x2fdecc};}catch(_0x1c8b2d){return logger[_0x55e187(0x173)](_0x55e187(0x18b)+_0x2f6fc2+':\x20'+_0x1c8b2d),{'name':_0x2f6fc2,'isJourneyLocal':![]};}},'resolveActivation':async _0x3da0c7=>{const _0x56abd4=a152_0x269d,_0x246eb1=_0x746603[_0x56abd4(0x1e4)](_0x3da0c7);if(_0x246eb1!==undefined)return{'name':_0x246eb1,'isJourneyLocal':!![]};try{let _0x42feeb=_0x2561e4?.[_0x56abd4(0x1e4)](_0x3da0c7);!_0x42feeb&&(_0x42feeb=await _0x592313[_0x56abd4(0x154)]['getActivation'](_0x392c13,_0x3da0c7));const _0x58723c=_0x42feeb[_0x56abd4(0x10f)]['activationParams'][_0x56abd4(0x14c)]||_0x3da0c7,_0xd30a8=sanitizeYamlKey(_0x58723c)||_0x56abd4(0x177)+_0x3da0c7,_0x4cfbec=_0xd30a8;_0x746603['set'](_0x3da0c7,_0x4cfbec);const _0x2eba5f=journeyActivationStepToYaml(_0x42feeb,_0x24cb67,_0x4a1569);return{'name':_0x4cfbec,'isJourneyLocal':!![],'definition':_0x2eba5f};}catch(_0x291889){return logger[_0x56abd4(0x173)](_0x56abd4(0x169)+_0x3da0c7+':\x20'+_0x291889),{'name':_0x3da0c7,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x3220a7,_0x443b61)=>resolveJumpTarget(_0x3220a7,_0x443b61,_0x249444,async _0x18e611=>{const _0x496c3a=a152_0x269d,_0x588740=_0x456f4e?.[_0x496c3a(0x1e4)](_0x18e611);if(_0x588740)return _0x588740;return _0x592313['journey'][_0x496c3a(0x17d)](_0x18e611);})};return _0x53b162=_0x388bc8,_0x388bc8;},_0x345606=async _0x59a944=>{const _0x5243ac=a152_0x269d,{collectSegmentIdsFromJourneyApi:_0x411f75}=await import(_0x5243ac(0x1a1)),{batchAsync:_0x4adff5}=await import('../../utils/async.js'),_0x16dc9b=new Set();for(const _0x1594ae of _0x59a944){let _0x5f54f3=_0x456f4e?.[_0x5243ac(0x1e4)](_0x1594ae);!_0x5f54f3&&(_0x5f54f3=await _0x592313[_0x5243ac(0x154)]['getJourney'](_0x1594ae));const _0x331ca5=_0x411f75(_0x5f54f3);for(const _0x180f71 of _0x331ca5){_0x16dc9b[_0x5243ac(0x10d)](_0x180f71);}}let _0x1884c0=Array['from'](_0x16dc9b);while(_0x1884c0[_0x5243ac(0x138)]>0x0){const _0x4fb282=_0x1884c0['filter'](_0x30dd11=>!_0x283288[_0x5243ac(0x14d)](_0x30dd11));if(_0x4fb282[_0x5243ac(0x138)]===0x0)break;const _0x3cb96f=await _0x4adff5(_0x4fb282,async _0x81f402=>{const _0x758789=_0x5243ac;_0x283288[_0x758789(0x10d)](_0x81f402);const _0x412f42=await fetchSegment(_0x592313,_0x1ab4be,_0x81f402,_0xda8f1);if(!_0x412f42)return null;return{'segmentId':_0x81f402,'segment':_0x412f42};},0xa),_0x1b5f60=new Set();for(const _0x57dbf0 of _0x3cb96f){if(!_0x57dbf0?.['segment']?.[_0x5243ac(0x1b6)])continue;const _0x47c3dd=apiRuleToYaml(_0x57dbf0[_0x5243ac(0x137)][_0x5243ac(0x1b6)]);_0x2238c0[_0x5243ac(0x18e)](_0x57dbf0[_0x5243ac(0x114)],_0x47c3dd);const _0x2b88b1=collectSegmentRefsFromRule(_0x47c3dd);for(const _0x4e15bc of _0x2b88b1){!_0x283288[_0x5243ac(0x14d)](_0x4e15bc)&&_0x1b5f60[_0x5243ac(0x10d)](_0x4e15bc);}}_0x1884c0=Array[_0x5243ac(0x166)](_0x1b5f60);}};return{'createYamlContext':_0x21596e,'prefetchJourneySegments':_0x345606};}export async function executePushSegments(_0x5dd6c2,_0xb902d9,_0x260bbb,_0x3877ff,_0x11fa36){const _0xe582e6=a152_0x2ec71,{segmentDefToCreateRequest:_0x2fb24e,segmentDefToUpdateRequest:_0x1e7124}=await import(_0xe582e6(0x1b0)),_0xae183b=_0x260bbb[_0xe582e6(0x1a9)],_0x4b0692=0x5,_0x2324df=async _0x3e9c9b=>{const _0x5d2684=_0xe582e6,_0x33e657=_0x3e9c9b[_0x5d2684(0x1d7)]?_0xae183b[_0x5d2684(0x1e4)](_0x3e9c9b[_0x5d2684(0x1d7)]):undefined;let _0x1851af;const _0x302e50={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x41d4f4=_0x3e9c9b['yamlConfig'];if(_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x1b6)]){const _0x3ed4d4=createSegmentIdResolver(_0x260bbb[_0x5d2684(0x202)],_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)]),_0x19d82b=await resolveRuleSegmentIds(_0x3e9c9b['yamlConfig'][_0x5d2684(0x1b6)],_0x3ed4d4);_0x41d4f4={..._0x3e9c9b[_0x5d2684(0x191)],'rule':_0x19d82b};}try{if(_0x3e9c9b[_0x5d2684(0x175)]){_0x11fa36['onProgress']?.({'type':'segment_creating','name':_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)]});const _0x447c9a=_0x2fb24e(_0x41d4f4,_0x33e657),_0x174b70=await _0x11fa36[_0x5d2684(0x15b)]('Creating\x20segment\x20\x27'+_0x3e9c9b['yamlConfig'][_0x5d2684(0x14c)]+'\x27...',()=>_0x5dd6c2[_0x5d2684(0x137)]['createSegment'](_0x3877ff['parentId'],_0x447c9a));_0x1851af=_0x174b70[_0x5d2684(0x11c)]['id'],_0x260bbb[_0x5d2684(0x202)][_0x5d2684(0x18e)](_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)],_0x1851af),_0x302e50[_0x5d2684(0x13f)]={'name':_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)],'id':_0x1851af},_0x11fa36[_0x5d2684(0x1d5)]?.({'type':'segment_created','name':_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)],'segmentId':_0x1851af}),_0x11fa36[_0x5d2684(0x160)]?.(_0x5d2684(0x148)+_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)]+'\x27'),_0x302e50['created']=0x1;}else{if(_0x3e9c9b[_0x5d2684(0x1b4)]){_0x11fa36[_0x5d2684(0x1d5)]?.({'type':_0x5d2684(0x136),'name':_0x3e9c9b['yamlConfig'][_0x5d2684(0x14c)]});const _0x1ff0c0=_0x1e7124(_0x41d4f4);_0x33e657!==_0x3e9c9b['existingSegment']?.[_0x5d2684(0x1f0)]&&(_0x1ff0c0['segmentFolderId']=_0x33e657?parseInt(_0x33e657,0xa):undefined),await _0x11fa36[_0x5d2684(0x15b)](_0x5d2684(0x117)+_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)]+_0x5d2684(0x131),()=>_0x5dd6c2[_0x5d2684(0x137)]['updateSegmentById'](_0x3877ff[_0x5d2684(0x17f)],_0x3e9c9b[_0x5d2684(0x17c)]['id'],_0x1ff0c0)),_0x1851af=_0x3e9c9b['existingSegment']['id'],_0x11fa36[_0x5d2684(0x1d5)]?.({'type':'segment_updated','name':_0x3e9c9b['yamlConfig']['name']}),_0x11fa36[_0x5d2684(0x160)]?.(_0x5d2684(0x159)+_0x3e9c9b['yamlConfig'][_0x5d2684(0x14c)]+'\x27'),_0x302e50[_0x5d2684(0x1f8)]=0x1;}else _0x1851af=_0x3e9c9b[_0x5d2684(0x17c)]['id'];}}catch(_0x412784){const _0x4b456f=isHttp400Error(_0x412784),_0x574da9=_0x4b456f?ErrorCode[_0x5d2684(0x178)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x34a038=getErrorMessage(_0x412784);throw new SDKError(_0x574da9,_0x5d2684(0x12e)+(_0x3e9c9b['isNew']?_0x5d2684(0x102):_0x5d2684(0x156))+'\x20segment\x20from\x20file:\x20'+_0x3e9c9b['absolutePath']+_0x5d2684(0x103)+_0x34a038,_0x412784);}try{const _0x278a87=await syncActivationsForSegment(_0x5dd6c2,_0x3877ff['parentId'],_0x1851af,_0x3e9c9b['yamlConfig'][_0x5d2684(0x14c)],_0x3e9c9b[_0x5d2684(0x1eb)],_0x11fa36,_0x3e9c9b[_0x5d2684(0x130)]);_0x302e50[_0x5d2684(0x11b)]=_0x278a87;}catch(_0x1e5676){if(_0x1e5676 instanceof SDKError)throw _0x1e5676;throw new SDKError(ErrorCode[_0x5d2684(0x12a)],_0x5d2684(0x101)+_0x3e9c9b[_0x5d2684(0x191)][_0x5d2684(0x14c)]+_0x5d2684(0x1f2)+_0x3e9c9b[_0x5d2684(0x130)]+_0x5d2684(0x103)+getErrorMessage(_0x1e5676),_0x1e5676);}return _0x302e50;},_0x5a69bb=await batchAsync(_0xb902d9,_0x2324df,_0x4b0692),_0x4a6401={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x3a991d of _0x5a69bb){_0x4a6401[_0xe582e6(0x189)]+=_0x3a991d[_0xe582e6(0x189)],_0x4a6401[_0xe582e6(0x1f8)]+=_0x3a991d['updated'],_0x3a991d[_0xe582e6(0x13f)]&&_0x4a6401[_0xe582e6(0x13e)][_0xe582e6(0x18e)](_0x3a991d[_0xe582e6(0x13f)][_0xe582e6(0x14c)],_0x3a991d[_0xe582e6(0x13f)]['id']),_0x4a6401[_0xe582e6(0x11b)][_0xe582e6(0x189)]+=_0x3a991d[_0xe582e6(0x11b)][_0xe582e6(0x189)],_0x4a6401['activations'][_0xe582e6(0x1f8)]+=_0x3a991d['activations'][_0xe582e6(0x1f8)],_0x4a6401[_0xe582e6(0x11b)][_0xe582e6(0x1d6)]+=_0x3a991d[_0xe582e6(0x11b)]['deleted'];}return _0x4a6401;}async function syncActivationsForSegment(_0xd2b72,_0x1c9312,_0x2eb807,_0x39b91b,_0x389af7,_0x52e411,_0x412508){const _0x433a11=a152_0x2ec71,_0x42c4a3={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x365784 of _0x389af7){try{if(_0x365784['type']==='create'&&_0x365784[_0x433a11(0x10e)])_0x52e411['onProgress']?.({'type':'activation_creating','segmentName':_0x39b91b,'activationName':_0x365784[_0x433a11(0x14c)]}),await _0x52e411[_0x433a11(0x15b)](_0x433a11(0x1d1)+_0x365784[_0x433a11(0x14c)]+_0x433a11(0x131),()=>_0xd2b72['segment'][_0x433a11(0x109)](_0x1c9312,_0x2eb807,_0x365784['validatedRequest'])),_0x52e411[_0x433a11(0x1d5)]?.({'type':_0x433a11(0x1a6),'segmentName':_0x39b91b,'activationName':_0x365784[_0x433a11(0x14c)]}),_0x52e411['logSuccess']?.(_0x433a11(0x11a)+_0x365784[_0x433a11(0x14c)]+'\x27'),_0x42c4a3[_0x433a11(0x189)]++;else{if(_0x365784[_0x433a11(0x19f)]===_0x433a11(0x156)&&_0x365784[_0x433a11(0x10e)]&&_0x365784[_0x433a11(0x13c)])_0x52e411['onProgress']?.({'type':'activation_updating','segmentName':_0x39b91b,'activationName':_0x365784['name']}),await _0x52e411['withProgress'](_0x433a11(0x1c3)+_0x365784[_0x433a11(0x14c)]+_0x433a11(0x131),()=>_0xd2b72[_0x433a11(0x137)]['updateActivation'](_0x1c9312,_0x2eb807,_0x365784[_0x433a11(0x13c)]['id'],_0x365784['validatedRequest'])),_0x52e411['onProgress']?.({'type':'activation_updated','segmentName':_0x39b91b,'activationName':_0x365784[_0x433a11(0x14c)]}),_0x52e411['logSuccess']?.(_0x433a11(0x1ef)+_0x365784['name']+'\x27'),_0x42c4a3[_0x433a11(0x1f8)]++;else _0x365784[_0x433a11(0x19f)]===_0x433a11(0x152)&&_0x365784[_0x433a11(0x13c)]&&(_0x52e411[_0x433a11(0x1d5)]?.({'type':'activation_deleting','segmentName':_0x39b91b,'activationName':_0x365784[_0x433a11(0x14c)]}),await _0x52e411[_0x433a11(0x15b)](_0x433a11(0x1c6)+_0x365784['name']+_0x433a11(0x131),()=>_0xd2b72['segment'][_0x433a11(0x116)](_0x1c9312,_0x2eb807,_0x365784[_0x433a11(0x13c)]['id'])),_0x52e411[_0x433a11(0x1d5)]?.({'type':_0x433a11(0x1a3),'segmentName':_0x39b91b,'activationName':_0x365784[_0x433a11(0x14c)]}),_0x52e411[_0x433a11(0xfd)]?.(_0x433a11(0x15a)+_0x365784[_0x433a11(0x14c)]+'\x27'),_0x42c4a3[_0x433a11(0x1d6)]++);}}catch(_0x1583f0){const _0x452746=isHttp400Error(_0x1583f0),_0x45adc0=_0x452746?ErrorCode[_0x433a11(0x1c7)]:ErrorCode[_0x433a11(0x12a)],_0x2935f6=getErrorMessage(_0x1583f0);throw new SDKError(_0x45adc0,_0x433a11(0x12e)+_0x365784['type']+'\x20activation\x20\x27'+_0x365784[_0x433a11(0x14c)]+_0x433a11(0x1f2)+_0x412508+_0x433a11(0x103)+_0x2935f6,_0x1583f0);}}return _0x42c4a3;}export async function executePushFolders(_0x1df93a,_0x12e098,_0xbf4329,_0x5693cd,_0x28ca55){const _0x5c124e=a152_0x2ec71,_0x3f3bbd=new Map(_0xbf4329),_0x5146e3=sortFoldersByDepth(_0x12e098);for(const _0x3349af of _0x5146e3){const _0x1a259d=_0x3349af[_0x5c124e(0x1ab)]('/'),_0x405101=_0x1a259d[_0x1a259d[_0x5c124e(0x138)]-0x1],_0x39baf6=_0x1a259d['slice'](0x0,-0x1)['join']('/'),_0x187aaf=_0x3f3bbd[_0x5c124e(0x1e4)](_0x39baf6);_0x28ca55[_0x5c124e(0x1d5)]?.({'type':_0x5c124e(0x184),'folder':_0x3349af});const _0x370b04={'name':_0x405101,'parentFolderId':_0x187aaf},_0x5f1ced=await _0x28ca55['withProgress'](_0x5c124e(0x1a5)+_0x3349af+'\x27...',()=>_0x1df93a['segment'][_0x5c124e(0x108)](_0x5693cd[_0x5c124e(0x17f)],_0x370b04));_0x3f3bbd[_0x5c124e(0x18e)](_0x3349af,_0x5f1ced[_0x5c124e(0x11c)]['id']),_0x28ca55[_0x5c124e(0x1d5)]?.({'type':'folder_created','folder':_0x3349af,'folderId':_0x5f1ced[_0x5c124e(0x11c)]['id']}),_0x28ca55[_0x5c124e(0x1fa)]?.(_0x5c124e(0x1d8)+_0x3349af+'\x27');}return _0x3f3bbd;}export async function executePushSegmentDeletions(_0x2b8fe9,_0x581189,_0x218ca1){const _0x209944=a152_0x2ec71;if(_0x581189[_0x209944(0x138)]===0x0)return 0x0;const {batchAsync:_0x17e8a4}=await import(_0x209944(0x121)),_0x2b101d=0x5,_0x799ee8=await _0x17e8a4(_0x581189,async _0x55a381=>{const _0x40e2be=_0x209944;return _0x218ca1[_0x40e2be(0x1d5)]?.({'type':_0x40e2be(0x1c4),'name':_0x55a381['name']}),await _0x2b8fe9[_0x40e2be(0x137)][_0x40e2be(0xfe)](_0x55a381['id']),_0x218ca1['onProgress']?.({'type':'segment_deleted','name':_0x55a381['name']}),_0x218ca1['logDeleted']?.('Deleted\x20segment\x20\x27'+_0x55a381[_0x40e2be(0x14c)]+'\x27'),0x1;},_0x2b101d);return _0x799ee8[_0x209944(0x10c)]((_0x428d9c,_0x42c38c)=>_0x428d9c+_0x42c38c,0x0);}export async function executePushJourneys(_0x37372f,_0x456f84,_0x575706,_0x195b59,_0x1ab2f8){const _0x2fa791=a152_0x2ec71,{journeyDefToRequest:_0x15ab21}=await import(_0x2fa791(0x1a1)),{activationDefToCreateRequest:_0x3f4a58,yamlRuleToApi:_0x1eaa1c,validateSegmentRule:_0x4e746a}=await import('./child-segment-yaml.js'),_0x5a1678={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x2ce0cf=new Map(_0x575706[_0x2fa791(0x202)]),_0x46add4=0x5;for(let _0x5cb22e=0x0;_0x5cb22e<_0x456f84[_0x2fa791(0x138)];_0x5cb22e+=_0x46add4){const _0x56ed06=_0x456f84[_0x2fa791(0x1ae)](_0x5cb22e,_0x5cb22e+_0x46add4),_0x52119a=await Promise['all'](_0x56ed06[_0x2fa791(0x188)](async _0x2b7012=>{const _0x4f5740=_0x2fa791;if(!_0x2b7012[_0x4f5740(0x175)]&&!_0x2b7012[_0x4f5740(0x1b4)])return{'action':_0x4f5740(0x1bf),'name':_0x2b7012[_0x4f5740(0x191)][_0x4f5740(0x14c)],'journeyId':_0x2b7012[_0x4f5740(0x19d)]?.['id']};const _0x2e5c89=_0x2b7012[_0x4f5740(0x1d7)]?_0x575706[_0x4f5740(0x1a9)][_0x4f5740(0x1e4)](_0x2b7012[_0x4f5740(0x1d7)]):undefined;_0x1ab2f8[_0x4f5740(0x1d5)]?.({'type':_0x2b7012['isNew']?_0x4f5740(0x1a8):_0x4f5740(0x168),'name':_0x2b7012[_0x4f5740(0x191)][_0x4f5740(0x14c)]});try{const _0x323c7d=await executeSingleJourneyPush(_0x37372f,_0x2b7012,{..._0x575706,'segmentNameToId':_0x2ce0cf},{'parentId':_0x195b59[_0x4f5740(0x17f)],'rootFolderId':_0x195b59['rootFolderId'],'folderId':_0x2e5c89,'verbose':_0x195b59['verbose']},_0x1ab2f8,{'journeyDefToRequest':_0x15ab21,'activationDefToCreateRequest':_0x3f4a58,'yamlRuleToApi':_0x1eaa1c,'validateSegmentRule':_0x4e746a});for(const [_0x292543,_0x478d78]of _0x323c7d[_0x4f5740(0x1f6)]){_0x2ce0cf[_0x4f5740(0x18e)](_0x292543,_0x478d78),_0x5a1678[_0x4f5740(0x1f6)][_0x4f5740(0x18e)](_0x292543,_0x478d78);}if(_0x323c7d[_0x4f5740(0x1f4)]===_0x4f5740(0x189))_0x1ab2f8['onProgress']?.({'type':_0x4f5740(0x1cd),'name':_0x2b7012['yamlConfig'][_0x4f5740(0x14c)],'journeyId':_0x323c7d['journeyId']}),_0x1ab2f8[_0x4f5740(0x160)]?.(_0x4f5740(0x198)+_0x2b7012[_0x4f5740(0x191)][_0x4f5740(0x14c)]+'\x27'),_0x5a1678[_0x4f5740(0x189)]++;else _0x323c7d['action']==='updated'&&(_0x1ab2f8[_0x4f5740(0x1d5)]?.({'type':'journey_updated','name':_0x2b7012[_0x4f5740(0x191)]['name']}),_0x1ab2f8[_0x4f5740(0x160)]?.(_0x4f5740(0x14f)+_0x2b7012['yamlConfig']['name']+'\x27'),_0x5a1678[_0x4f5740(0x1f8)]++);return{'action':_0x323c7d[_0x4f5740(0x1f4)],'name':_0x2b7012['yamlConfig'][_0x4f5740(0x14c)],'journeyId':_0x323c7d[_0x4f5740(0x157)]};}catch(_0x38b660){const _0x5ad0cd=isHttp400Error(_0x38b660),_0x5f2eba=_0x5ad0cd?ErrorCode[_0x4f5740(0x201)]:ErrorCode[_0x4f5740(0x150)],_0x14fcfe=getErrorMessage(_0x38b660);throw new SDKError(_0x5f2eba,_0x4f5740(0x12e)+(_0x2b7012['isNew']?_0x4f5740(0x102):'update')+'\x20journey\x20from\x20file:\x20'+_0x2b7012[_0x4f5740(0x130)]+_0x4f5740(0x103)+_0x14fcfe,_0x38b660);}}));_0x5a1678[_0x2fa791(0x140)][_0x2fa791(0x1b3)](..._0x52119a);}return _0x5a1678;}async function matchExistingJourneySegments(_0x534b9b,_0x3e583b,_0x901f7a,_0x51a8c2,_0xa2ea01){const _0xc19c45=a152_0x2ec71;if(!_0x3e583b[_0xc19c45(0x19d)]||!_0x3e583b[_0xc19c45(0x191)][_0xc19c45(0x16f)])return;const _0x56e035=new Map(),_0x11e175=new Set();for(const _0x51ceb1 of Object[_0xc19c45(0x1ac)](_0x3e583b[_0xc19c45(0x191)][_0xc19c45(0x16f)])){const _0x53cb7f=generateDeterministicJourneySegmentName(_0x3e583b['yamlConfig']['name'],_0x51ceb1);_0x56e035[_0xc19c45(0x18e)](_0x53cb7f,_0x51ceb1),_0x11e175['add'](_0x51ceb1);}const _0x45578d=[],_0x51b82b=collectSegmentIdsFromJourneyApi(_0x3e583b['existingJourney']);for(const _0x4bdcff of _0x51b82b){const _0x2c6a73=await fetchSegment(_0x534b9b,_0x901f7a,_0x4bdcff,_0x51a8c2);if(!_0x2c6a73?.[_0xc19c45(0x14c)])continue;const _0x39c58c=_0x56e035['get'](_0x2c6a73[_0xc19c45(0x14c)]);_0x39c58c?(_0xa2ea01[_0xc19c45(0x18e)](_0x39c58c,_0x4bdcff),_0x11e175['delete'](_0x39c58c)):_0x45578d[_0xc19c45(0x1b3)]({'id':_0x4bdcff,'seg':_0x2c6a73});}if(_0x11e175[_0xc19c45(0x176)]>0x0&&_0x45578d[_0xc19c45(0x138)]>0x0){const {localExpandedRuleToNames:_0x38b654}=buildLocalExpandedRuleMappings(_0x3e583b[_0xc19c45(0x191)]),_0x469088=new Map();for(const {id:_0x5be5be,seg:_0x2a9495}of _0x45578d){if(_0x2a9495['rule']){const _0x27e79b=apiRuleToYaml(_0x2a9495[_0xc19c45(0x1b6)]);_0x469088[_0xc19c45(0x18e)](_0x5be5be,_0x27e79b);}}for(const {id:_0x1838a6,seg:_0x47e528}of _0x45578d){if(!_0x47e528[_0xc19c45(0x1b6)])continue;const _0xc73d08=_0x469088['get'](_0x1838a6);if(!_0xc73d08)continue;const _0x52858c=serializeExpandedRule(_0xc73d08,_0x469088),_0x12ae52=_0x38b654[_0xc19c45(0x1e4)](_0x52858c);if(_0x12ae52){const _0x4b97cf=_0x12ae52[_0xc19c45(0x183)](_0x576c96=>_0x11e175[_0xc19c45(0x14d)](_0x576c96));_0x4b97cf&&(_0xa2ea01[_0xc19c45(0x18e)](_0x4b97cf,_0x1838a6),_0x11e175[_0xc19c45(0x152)](_0x4b97cf),logger['debug']('Matched\x20server\x20segment\x20\x27'+_0x47e528[_0xc19c45(0x14c)]+_0xc19c45(0x1cc)+_0x4b97cf+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0xa06dc,_0x314631,_0x7a9d1e,_0x35cbe8,_0xe08495,_0x2f00c2){const _0x4e3dfb=a152_0x2ec71,{journeyDefToRequest:_0x160411,activationDefToCreateRequest:_0x282f24,yamlRuleToApi:_0x1b24fb,validateSegmentRule:_0x23a6a1}=_0x2f00c2,_0x4f34fd=new Map(),_0x558dac=new Map();recoverSegmentIdsFromPushRecovery(_0x314631,_0x4f34fd,_0x7a9d1e['segmentNameToId']);const _0x49d6dc=new Map(),_0x3e8d24=new Map(),_0x469651=new Map();let _0x426796;const _0x2b6f9d=async()=>{const _0xa6b3eb=a152_0x269d;if(_0x426796)return;_0x426796=new Map();if(!_0x314631['existingJourney'])return;const _0x332840=await _0xa06dc[_0xa6b3eb(0x154)]['listActivations'](_0x314631[_0xa6b3eb(0x19d)]['id']);for(const _0x12b64a of _0x332840){const _0x104479=journeyActivationStepToYaml(_0x12b64a,_0x7a9d1e[_0xa6b3eb(0x142)],_0x7a9d1e[_0xa6b3eb(0x162)]),_0x60a537=activationSignature(_0x104479);!_0x426796[_0xa6b3eb(0x14d)](_0x60a537)&&_0x426796[_0xa6b3eb(0x18e)](_0x60a537,_0x12b64a['id']),_0x104479['name']&&_0x558dac[_0xa6b3eb(0x18e)](_0x104479[_0xa6b3eb(0x14c)],_0x12b64a['id']);}};await matchExistingJourneySegments(_0xa06dc,_0x314631,_0x35cbe8[_0x4e3dfb(0x17f)],_0x7a9d1e['existingSegments'],_0x7a9d1e[_0x4e3dfb(0x202)]);const _0x11c75d={'resolveSegmentId':async _0x221bf3=>{const _0x50dd4c=_0x4e3dfb,_0x2a84b4=_0x7a9d1e[_0x50dd4c(0x202)][_0x50dd4c(0x1e4)](_0x221bf3);if(!_0x2a84b4)throw new SDKError(ErrorCode[_0x50dd4c(0x1d2)],_0x50dd4c(0x1c0)+_0x221bf3+_0x50dd4c(0x13d)+_0x314631[_0x50dd4c(0x191)][_0x50dd4c(0x14c)]+')');return _0x2a84b4;},'resolveEmbeddedSegmentId':async(_0xb0777e,_0x56aeb6)=>{const _0x314b8f=_0x4e3dfb,_0x1772fc=_0x7a9d1e['segmentNameToId']['get'](_0xb0777e);if(_0x1772fc)return _0x1772fc;const _0x3621a3=_0x7a9d1e[_0x314b8f(0x100)][_0x314b8f(0x183)](_0x213f0d=>_0x213f0d[_0x314b8f(0x14c)]===_0xb0777e);if(_0x3621a3)return _0x7a9d1e[_0x314b8f(0x202)][_0x314b8f(0x18e)](_0xb0777e,_0x3621a3['id']),_0x3621a3['id'];if(_0x314631['isNew']){const {stageName:_0x2a3bfc,criteriaName:_0x4b3292}=findSegmentCriteriaLocation(_0x314631['yamlConfig'],_0xb0777e);return _0x23a6a1(_0xb0777e,_0x56aeb6[_0x314b8f(0x1b6)]),_0x3e8d24[_0x314b8f(0x18e)](_0xb0777e,{'definition':_0x56aeb6,'stageName':_0x2a3bfc,'criteriaName':_0x4b3292}),createPendingSegmentId(_0xb0777e);}const _0x238d83=_0x314631[_0x314b8f(0x19d)]?.['id'];if(!_0x238d83)throw new SDKError(ErrorCode[_0x314b8f(0x126)],_0x314b8f(0x174));const _0x9f9dc8=_0x49d6dc[_0x314b8f(0x1e4)](_0xb0777e);if(_0x9f9dc8)return _0x9f9dc8;const _0xf3f454=((async()=>{const _0x521c1e=_0x314b8f;_0x23a6a1(_0xb0777e,_0x56aeb6['rule']);const _0xe2d5e7=generateDeterministicJourneySegmentName(_0x314631[_0x521c1e(0x191)]['name'],_0xb0777e),_0x534e79=_0x7a9d1e[_0x521c1e(0x100)][_0x521c1e(0x183)](_0xae855a=>_0xae855a[_0x521c1e(0x14c)]===_0xe2d5e7),_0x80b789=createSegmentIdResolver(_0x7a9d1e[_0x521c1e(0x202)],_0xb0777e),_0x3e538e=await resolveRuleSegmentIds(_0x56aeb6[_0x521c1e(0x1b6)],_0x80b789);let _0x3cd8b5;return _0x534e79?(await _0xa06dc[_0x521c1e(0x137)][_0x521c1e(0x19b)](_0x35cbe8[_0x521c1e(0x17f)],_0x534e79['id'],{'description':_0x56aeb6[_0x521c1e(0x1cf)]||'Entry\x20criteria:\x20'+_0xb0777e,'rule':_0x1b24fb(_0x3e538e),'countPopulation':!![]}),_0x3cd8b5=_0x534e79['id'],saveSegmentToPushRecovery(_0x314631[_0x521c1e(0x130)],_0x314631['yamlConfig']['name'],_0xb0777e,{'segmentId':_0x3cd8b5,'uniqueServerName':_0xe2d5e7,'createdAt':new Date()['toISOString']()})):_0x3cd8b5=await createOrRecoverEmbeddedSegment(_0xa06dc,_0x314631,{'localName':_0xb0777e,'uniqueSegmentName':_0xe2d5e7,'description':_0x56aeb6[_0x521c1e(0x1cf)]||_0x521c1e(0x163)+_0xb0777e,'journeyId':_0x238d83,'resolvedRule':_0x3e538e,'parentId':_0x35cbe8[_0x521c1e(0x17f)],'folderId':_0x35cbe8['rootFolderId']||''},_0x1b24fb),_0x7a9d1e['segmentNameToId'][_0x521c1e(0x18e)](_0xb0777e,_0x3cd8b5),_0x4f34fd['set'](_0xb0777e,_0x3cd8b5),_0x3cd8b5;})());_0x49d6dc[_0x314b8f(0x18e)](_0xb0777e,_0xf3f454);try{return await _0xf3f454;}finally{_0x49d6dc[_0x314b8f(0x152)](_0xb0777e);}},'resolveActivationId':async _0x462297=>{const _0x14e947=_0x4e3dfb,_0x1e65cd=_0x558dac['get'](_0x462297);if(_0x1e65cd)return _0x1e65cd;if(_0x314631[_0x14e947(0x19d)]){await _0x2b6f9d();const _0x336b82=_0x558dac[_0x14e947(0x1e4)](_0x462297);if(_0x336b82)return _0x336b82;}throw new SDKError(ErrorCode['NOT_FOUND'],_0x14e947(0x16a)+_0x462297+_0x14e947(0x13d)+_0x314631[_0x14e947(0x191)][_0x14e947(0x14c)]+_0x14e947(0x181)+_0x14e947(0x195));},'resolveEmbeddedActivationId':async(_0x1a0067,_0x507fd8)=>{const _0x483b3a=_0x4e3dfb,_0xe9c131=_0x558dac[_0x483b3a(0x1e4)](_0x1a0067);if(_0xe9c131)return _0xe9c131;if(_0x314631[_0x483b3a(0x175)])return _0x469651[_0x483b3a(0x18e)](_0x1a0067,_0x507fd8),createPendingActivationId(_0x1a0067);if(_0x314631[_0x483b3a(0x19d)]){await _0x2b6f9d();const _0x2d476a=_0x558dac[_0x483b3a(0x1e4)](_0x507fd8['name']);if(_0x2d476a)return _0x558dac[_0x483b3a(0x18e)](_0x1a0067,_0x2d476a),_0x2d476a;const _0x21ad27=activationSignature(_0x507fd8),_0x277426=_0x426796?.['get'](_0x21ad27);if(_0x277426)return _0x558dac[_0x483b3a(0x18e)](_0x1a0067,_0x277426),_0x277426;const _0x52bf98=await _0x282f24(_0x507fd8,_0x7a9d1e[_0x483b3a(0x1f7)]),_0xef4ca6={..._0x52bf98,..._0x507fd8[_0x483b3a(0x193)]!==undefined&&{'runAfterJourneyRefresh':_0x507fd8[_0x483b3a(0x193)]}},_0x34644a=await _0xa06dc[_0x483b3a(0x154)][_0x483b3a(0x109)](_0x314631['existingJourney']['id'],_0xef4ca6);return _0x558dac[_0x483b3a(0x18e)](_0x1a0067,_0x34644a['id']),_0x34644a['id'];}throw new SDKError(ErrorCode[_0x483b3a(0x126)],_0x483b3a(0x15c));},'resolveJourneyId':async _0x52b716=>{const _0x46a86e=_0x4e3dfb;try{return await _0xa06dc[_0x46a86e(0x154)][_0x46a86e(0x1ca)](_0x35cbe8[_0x46a86e(0x17f)],_0x52b716);}catch(_0x221aaa){throw new SDKError(ErrorCode[_0x46a86e(0x1fb)],_0x46a86e(0x1c5)+_0x52b716+'\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27'+_0x314631[_0x46a86e(0x191)][_0x46a86e(0x14c)]+'\x27)',_0x221aaa);}},'resolveStageId':async(_0x185c4c,_0x593eb9)=>{const _0x91baba=_0x4e3dfb,_0x5f1e95=await _0xa06dc['journey'][_0x91baba(0x17d)](_0x185c4c),_0x444d36=_0x5f1e95['attributes'][_0x91baba(0x1e5)][_0x91baba(0x183)](_0x1fa13a=>_0x1fa13a[_0x91baba(0x14c)][_0x91baba(0x124)]()===_0x593eb9[_0x91baba(0x124)]());if(!_0x444d36?.['id'])throw new SDKError(ErrorCode[_0x91baba(0x1fb)],_0x91baba(0x1f5)+_0x593eb9+'\x27\x20not\x20found\x20in\x20journey\x20\x27'+(_0x5f1e95[_0x91baba(0x10f)]['journeyBundleName']||_0x5f1e95[_0x91baba(0x10f)][_0x91baba(0x14c)])+'\x27');return _0x444d36['id'];}},_0x34b0c5=await _0x160411(_0x314631[_0x4e3dfb(0x191)],_0x35cbe8[_0x4e3dfb(0x17f)],_0x11c75d),_0x8dbb51=_0x35cbe8['folderId']||_0x35cbe8['rootFolderId'];_0x8dbb51&&(_0x34b0c5['relationships']={'parentFolder':{'data':{'id':_0x8dbb51,'type':_0x4e3dfb(0x1bb)}}});if(_0x314631[_0x4e3dfb(0x175)]){if(_0x3e8d24[_0x4e3dfb(0x176)]>0x0||_0x469651[_0x4e3dfb(0x176)]>0x0)return await executeThreeStepJourneyCreate(_0xa06dc,_0x314631,_0x34b0c5,{'pendingEmbeddedSegments':_0x3e8d24,'pendingEmbeddedActivations':_0x469651,'embeddedSegmentNameToId':_0x4f34fd,'journeyActivationNameToId':_0x558dac},{..._0x35cbe8,'effectiveFolderId':_0x8dbb51},_0x7a9d1e,_0xe08495,_0x2f00c2);else{ensureJourneyDefaults(_0x34b0c5[_0x4e3dfb(0x10f)]);const _0x5b8370=await _0xa06dc['journey'][_0x4e3dfb(0x102)](_0x34b0c5);return deletePushRecovery(_0x314631['absolutePath']),{'action':'created','journeyId':_0x5b8370['id'],'embeddedSegmentNameToId':_0x4f34fd};}}else{if(_0x314631[_0x4e3dfb(0x1b4)]&&_0x314631[_0x4e3dfb(0x19d)]){_0x34b0c5['id']=_0x314631[_0x4e3dfb(0x19d)]['id'];const _0x4964de=_0x34b0c5[_0x4e3dfb(0x10f)];_0x314631[_0x4e3dfb(0x19d)]['attributes']?.['journeyBundleName']&&(_0x4964de['journeyBundleName']=_0x314631['existingJourney'][_0x4e3dfb(0x10f)][_0x4e3dfb(0x123)]);const _0x4e7125=_0x314631[_0x4e3dfb(0x19d)][_0x4e3dfb(0x10f)]?.[_0x4e3dfb(0x1e5)];return _0x4e7125&&_0x34b0c5[_0x4e3dfb(0x10f)][_0x4e3dfb(0x1e5)]&&injectExistingStageIds(_0x34b0c5[_0x4e3dfb(0x10f)][_0x4e3dfb(0x1e5)],_0x4e7125),ensureJourneyDefaults(_0x4964de),await _0xa06dc[_0x4e3dfb(0x154)][_0x4e3dfb(0x156)](_0x314631[_0x4e3dfb(0x19d)]['id'],_0x34b0c5),deletePushRecovery(_0x314631[_0x4e3dfb(0x130)]),{'action':_0x4e3dfb(0x1f8),'journeyId':_0x314631[_0x4e3dfb(0x19d)]['id'],'embeddedSegmentNameToId':_0x4f34fd};}}return deletePushRecovery(_0x314631[_0x4e3dfb(0x130)]),{'action':_0x4e3dfb(0x1bf),'journeyId':_0x314631['existingJourney']?.['id'],'embeddedSegmentNameToId':_0x4f34fd};}function findSegmentCriteriaLocation(_0x5ea375,_0x4bc465){const _0x5e439e=a152_0x2ec71,_0x5661a7=_0x5ea375['stages']||_0x5ea375[_0x5e439e(0x11d)]?.[0x0]?.[_0x5e439e(0x1ec)]||[];let _0xaac778=_0x5e439e(0x120),_0x221d90=_0x4bc465;const _0x128855=_0x5ea375['goal']||_0x5ea375[_0x5e439e(0x11d)]?.[0x0]?.[_0x5e439e(0x1f3)];if(_0x128855?.[_0x5e439e(0x137)]===_0x4bc465)return{'stageName':_0x5e439e(0x1f3),'criteriaName':_0x128855[_0x5e439e(0x14c)]||_0x4bc465};_0x447881:for(const _0x2d6580 of _0x5661a7){if(_0x2d6580['entry_criteria']?.[_0x5e439e(0x137)]===_0x4bc465){_0xaac778=_0x2d6580['name'],_0x221d90=_0x2d6580[_0x5e439e(0x105)][_0x5e439e(0x14c)]||_0x4bc465;break;}if(_0x2d6580[_0x5e439e(0x1fe)])for(const _0x2eb0ea of _0x2d6580[_0x5e439e(0x1fe)]){if(_0x2eb0ea[_0x5e439e(0x19f)]===_0x5e439e(0x17a)&&_0x2eb0ea[_0x5e439e(0x1b1)]?.['branches'])for(const _0x4b3550 of _0x2eb0ea[_0x5e439e(0x1b1)][_0x5e439e(0x167)]){if(_0x4b3550[_0x5e439e(0x137)]===_0x4bc465){_0xaac778=_0x2d6580[_0x5e439e(0x14c)],_0x221d90=_0x4b3550['name']||_0x4bc465;break _0x447881;}}}}return{'stageName':_0xaac778,'criteriaName':_0x221d90};}async function executeThreeStepJourneyCreate(_0x4b7a8b,_0x543876,_0x4a5433,_0x4751f5,_0x673fa6,_0x1f73f5,_0x1eab2d,_0x336765){const _0x3732d9=a152_0x2ec71,{activationDefToCreateRequest:_0x1e2a0f,yamlRuleToApi:_0x4a59d7}=_0x336765,{pendingEmbeddedSegments:_0x2b520a,pendingEmbeddedActivations:_0x25e416,embeddedSegmentNameToId:_0x134063}=_0x4751f5,_0x144f48=JSON['parse'](JSON[_0x3732d9(0x13a)](_0x4a5433));ensureJourneyDefaults(_0x144f48['attributes']),stripPendingIds(_0x144f48);const _0x4610da=await _0x4b7a8b[_0x3732d9(0x154)][_0x3732d9(0x102)](_0x144f48),_0x278a5d=_0x4610da['id'],_0x844bdf=new Map();for(const _0x4e27b1 of _0x4610da[_0x3732d9(0x10f)][_0x3732d9(0x1e5)]){_0x844bdf[_0x3732d9(0x18e)](_0x4e27b1[_0x3732d9(0x14c)][_0x3732d9(0x124)](),_0x4e27b1['id']);}recoverSegmentIdsFromPushRecovery(_0x543876,_0x134063,_0x1f73f5['segmentNameToId']);for(const [_0x26900f,{definition:_0x5cdc2d}]of _0x2b520a){if(_0x134063[_0x3732d9(0x14d)](_0x26900f)){_0x1eab2d['onProgress']?.({'type':'embedded_segment_created','journeyName':_0x543876[_0x3732d9(0x191)][_0x3732d9(0x14c)],'segmentName':_0x26900f});continue;}const _0x5a5f4c=generateDeterministicJourneySegmentName(_0x543876['yamlConfig'][_0x3732d9(0x14c)],_0x26900f);_0x1eab2d['onProgress']?.({'type':_0x3732d9(0x18f),'journeyName':_0x543876['yamlConfig'][_0x3732d9(0x14c)],'segmentName':_0x26900f});const _0x4faa80=createSegmentIdResolver(_0x1f73f5[_0x3732d9(0x202)],_0x26900f),_0x37c35f=await resolveRuleSegmentIds(_0x5cdc2d['rule'],_0x4faa80),_0x193e52=await createOrRecoverEmbeddedSegment(_0x4b7a8b,_0x543876,{'localName':_0x26900f,'uniqueSegmentName':_0x5a5f4c,'description':_0x5cdc2d[_0x3732d9(0x1cf)]||_0x3732d9(0x163)+_0x26900f,'journeyId':_0x278a5d,'resolvedRule':_0x37c35f,'parentId':_0x673fa6['parentId'],'folderId':_0x673fa6[_0x3732d9(0x110)]||''},_0x4a59d7);_0x134063[_0x3732d9(0x18e)](_0x26900f,_0x193e52),_0x1f73f5[_0x3732d9(0x202)][_0x3732d9(0x18e)](_0x26900f,_0x193e52),_0x1eab2d[_0x3732d9(0x1d5)]?.({'type':_0x3732d9(0x13b),'journeyName':_0x543876[_0x3732d9(0x191)][_0x3732d9(0x14c)],'segmentName':_0x26900f});}const _0xee0b67=new Map();for(const [_0x1a78ac,_0xd224f5]of _0x25e416){_0x1eab2d['onProgress']?.({'type':_0x3732d9(0x1f9),'journeyName':_0x543876[_0x3732d9(0x191)][_0x3732d9(0x14c)],'activationName':_0x1a78ac});const _0x435d67=await _0x1e2a0f(_0xd224f5,_0x1f73f5[_0x3732d9(0x1f7)]),_0x572e14={..._0x435d67,..._0xd224f5[_0x3732d9(0x193)]!==undefined&&{'runAfterJourneyRefresh':_0xd224f5[_0x3732d9(0x193)]}},_0x3a5e0a=await _0x4b7a8b[_0x3732d9(0x154)][_0x3732d9(0x109)](_0x278a5d,_0x572e14);_0xee0b67[_0x3732d9(0x18e)](_0x1a78ac,_0x3a5e0a['id']),_0x4751f5['journeyActivationNameToId']['set'](_0x1a78ac,_0x3a5e0a['id']),_0x1eab2d[_0x3732d9(0x1d5)]?.({'type':_0x3732d9(0x15f),'journeyName':_0x543876['yamlConfig'][_0x3732d9(0x14c)],'activationName':_0x1a78ac});}const _0x405e07=JSON[_0x3732d9(0x199)](JSON[_0x3732d9(0x13a)](_0x4a5433));return _0x405e07['id']=_0x278a5d,ensureJourneyDefaults(_0x405e07[_0x3732d9(0x10f)]),resolvePendingIdsInRequest(_0x405e07,_0x4a5433,_0x844bdf,_0x134063,_0xee0b67,_0x1eab2d),await _0x4b7a8b[_0x3732d9(0x154)][_0x3732d9(0x156)](_0x278a5d,_0x405e07),deletePushRecovery(_0x543876[_0x3732d9(0x130)]),{'action':_0x3732d9(0x189),'journeyId':_0x278a5d,'embeddedSegmentNameToId':_0x134063};}export function stripWaitStepPendingIds(_0x1b142){const _0x49a960=a152_0x2ec71,_0x586503=_0x1b142[_0x49a960(0x106)]&&isPendingSegmentId(_0x1b142[_0x49a960(0x106)]),_0x19abe9=_0x1b142[_0x49a960(0x1ff)]?.[_0x49a960(0x122)](_0x4e022a=>_0x4e022a[_0x49a960(0x114)]&&isPendingSegmentId(_0x4e022a[_0x49a960(0x114)]));(_0x586503||_0x19abe9)&&(_0x1b142[_0x49a960(0x1ba)]=_0x49a960(0x1ed),_0x1b142[_0x49a960(0x1aa)]=0x1,_0x1b142[_0x49a960(0x1e2)]=_0x49a960(0x196),delete _0x1b142[_0x49a960(0x106)],delete _0x1b142[_0x49a960(0x153)],delete _0x1b142[_0x49a960(0x1ce)],delete _0x1b142[_0x49a960(0x1ff)]);}export function resolveWaitStepPendingIds(_0x54d2d8,_0x4b224e,_0x1b13a1,_0x1c200b){const _0x20b8c0=a152_0x2ec71;if(_0x4b224e[_0x20b8c0(0x106)]&&isPendingSegmentId(_0x4b224e[_0x20b8c0(0x106)])){const _0x23bb5b=_0x1b13a1(_0x4b224e[_0x20b8c0(0x106)],_0x20b8c0(0x1ea)+_0x1c200b+'\x27\x20wait\x20condition');_0x23bb5b&&(_0x54d2d8[_0x20b8c0(0x1ba)]=_0x20b8c0(0x1fd),_0x54d2d8[_0x20b8c0(0x106)]=_0x23bb5b,delete _0x54d2d8[_0x20b8c0(0x1aa)],delete _0x54d2d8['waitStepUnit'],_0x4b224e[_0x20b8c0(0x153)]!==undefined&&(_0x54d2d8['conditionTimeoutDuration']=_0x4b224e[_0x20b8c0(0x153)]),_0x4b224e['conditionTimeoutUnit']&&(_0x54d2d8[_0x20b8c0(0x1ce)]=_0x4b224e[_0x20b8c0(0x1ce)]));}if(_0x4b224e[_0x20b8c0(0x1ff)]){const _0x29e64f=_0x4b224e[_0x20b8c0(0x1ff)]['some'](_0x582fe2=>_0x582fe2[_0x20b8c0(0x114)]&&isPendingSegmentId(_0x582fe2['segmentId']));if(_0x29e64f){const _0x1187a9=_0x4b224e['conditions']['map'](_0x1f4a76=>{const _0x5b190a=_0x20b8c0;if(_0x1f4a76[_0x5b190a(0x114)]&&isPendingSegmentId(_0x1f4a76[_0x5b190a(0x114)])){const _0x4e259f=_0x1b13a1(_0x1f4a76[_0x5b190a(0x114)],_0x5b190a(0x1ea)+_0x1c200b+_0x5b190a(0x1dc));return{..._0x1f4a76,'segmentId':_0x4e259f||_0x1f4a76[_0x5b190a(0x114)]};}return{..._0x1f4a76};});_0x54d2d8[_0x20b8c0(0x1ba)]=_0x20b8c0(0x1fd),_0x54d2d8[_0x20b8c0(0x1ff)]=_0x1187a9,delete _0x54d2d8[_0x20b8c0(0x1aa)],delete _0x54d2d8[_0x20b8c0(0x1e2)],delete _0x54d2d8[_0x20b8c0(0x106)],delete _0x54d2d8[_0x20b8c0(0x153)],delete _0x54d2d8[_0x20b8c0(0x1ce)];}}}function stripPendingIds(_0x3ddb36){const _0x120de6=a152_0x2ec71;_0x3ddb36[_0x120de6(0x10f)][_0x120de6(0x1f3)]?.[_0x120de6(0x114)]&&isPendingSegmentId(_0x3ddb36[_0x120de6(0x10f)][_0x120de6(0x1f3)][_0x120de6(0x114)])&&delete _0x3ddb36[_0x120de6(0x10f)][_0x120de6(0x1f3)];for(const _0x1149e3 of _0x3ddb36['attributes'][_0x120de6(0x1e5)]||[]){_0x1149e3[_0x120de6(0x186)]?.[_0x120de6(0x114)]&&isPendingSegmentId(_0x1149e3[_0x120de6(0x186)][_0x120de6(0x114)])&&delete _0x1149e3[_0x120de6(0x186)];_0x1149e3[_0x120de6(0x197)]?.['segmentId']&&isPendingSegmentId(_0x1149e3['milestone'][_0x120de6(0x114)])&&delete _0x1149e3[_0x120de6(0x197)];_0x1149e3['exitCriterias']&&(_0x1149e3['exitCriterias']=_0x1149e3[_0x120de6(0x1b5)][_0x120de6(0x1da)](_0x51d825=>!_0x51d825['segmentId']||!isPendingSegmentId(_0x51d825[_0x120de6(0x114)])));if(_0x1149e3['steps'])for(const _0x4a4b3d of Object['keys'](_0x1149e3[_0x120de6(0x1fe)])){const _0x4b8757=_0x1149e3[_0x120de6(0x1fe)][_0x4a4b3d];_0x4b8757['type']==='Activation'&&_0x4b8757[_0x120de6(0x1a4)]&&isPendingActivationId(_0x4b8757[_0x120de6(0x1a4)])&&(_0x4b8757[_0x120de6(0x1a4)]='');if(_0x4b8757[_0x120de6(0x19f)]===_0x120de6(0x145)&&_0x4b8757[_0x120de6(0x167)])for(const _0xa93758 of _0x4b8757[_0x120de6(0x167)]){_0xa93758['segmentId']&&isPendingSegmentId(_0xa93758[_0x120de6(0x114)])&&(_0xa93758[_0x120de6(0x114)]='');}_0x4b8757[_0x120de6(0x19f)]===_0x120de6(0x118)&&stripWaitStepPendingIds(_0x4b8757);}}}function resolvePendingIdsInRequest(_0x815e3b,_0xc6a638,_0x3716f5,_0x3dcc09,_0x356f07,_0xeca516){const _0x345ed7=a152_0x2ec71,_0x134537=(_0x300e03,_0x3a4372)=>{const _0x2070c8=a152_0x269d;if(!isPendingSegmentId(_0x300e03))return _0x300e03;const _0x745ff5=extractPendingSegmentName(_0x300e03),_0x14ef59=_0x3dcc09[_0x2070c8(0x1e4)](_0x745ff5);return!_0x14ef59&&_0xeca516[_0x2070c8(0x172)]?.(_0x2070c8(0x18d)+_0x745ff5+_0x2070c8(0x107)+_0x3a4372),_0x14ef59;};if(_0x815e3b[_0x345ed7(0x10f)][_0x345ed7(0x1f3)]?.['segmentId']&&isPendingSegmentId(_0x815e3b[_0x345ed7(0x10f)][_0x345ed7(0x1f3)][_0x345ed7(0x114)])){const _0x1b2748=_0x134537(_0x815e3b[_0x345ed7(0x10f)]['goal'][_0x345ed7(0x114)],_0x345ed7(0x1df));_0x1b2748&&(_0x815e3b['attributes'][_0x345ed7(0x1f3)]['segmentId']=_0x1b2748);}for(const _0x22eb51 of _0x815e3b[_0x345ed7(0x10f)][_0x345ed7(0x1e5)]||[]){const _0x177527=_0x3716f5[_0x345ed7(0x1e4)](_0x22eb51[_0x345ed7(0x14c)]['toLowerCase']());_0x177527&&(_0x22eb51['id']=_0x177527);if(_0x22eb51['entryCriteria']?.[_0x345ed7(0x114)]&&isPendingSegmentId(_0x22eb51[_0x345ed7(0x186)][_0x345ed7(0x114)])){const _0x5956f8=_0x134537(_0x22eb51[_0x345ed7(0x186)][_0x345ed7(0x114)],_0x345ed7(0x1ea)+_0x22eb51[_0x345ed7(0x14c)]+_0x345ed7(0x187));_0x5956f8&&(_0x22eb51[_0x345ed7(0x186)][_0x345ed7(0x114)]=_0x5956f8);}if(_0x22eb51[_0x345ed7(0x1b5)])for(const _0x57aa85 of _0x22eb51[_0x345ed7(0x1b5)]){if(_0x57aa85[_0x345ed7(0x114)]&&isPendingSegmentId(_0x57aa85['segmentId'])){const _0x3daa89=_0x134537(_0x57aa85['segmentId'],_0x345ed7(0x1ea)+_0x22eb51['name']+_0x345ed7(0x171));_0x3daa89&&(_0x57aa85[_0x345ed7(0x114)]=_0x3daa89);}}if(_0x22eb51[_0x345ed7(0x197)]?.['segmentId']&&isPendingSegmentId(_0x22eb51[_0x345ed7(0x197)]['segmentId'])){const _0xc2d3c9=_0x134537(_0x22eb51['milestone'][_0x345ed7(0x114)],'stage\x20\x27'+_0x22eb51[_0x345ed7(0x14c)]+_0x345ed7(0x1c8));_0xc2d3c9&&(_0x22eb51[_0x345ed7(0x197)]['segmentId']=_0xc2d3c9);}if(_0x22eb51[_0x345ed7(0x1fe)]){const _0x30af10=_0x3e8548=>_0xc6a638[_0x345ed7(0x10f)]['journeyStages']?.['find'](_0x4b1344=>_0x4b1344[_0x345ed7(0x14c)][_0x345ed7(0x124)]()===_0x22eb51[_0x345ed7(0x14c)][_0x345ed7(0x124)]())?.['steps']?.[_0x3e8548];for(const _0x183812 of Object[_0x345ed7(0x1ac)](_0x22eb51['steps'])){const _0x44c01e=_0x22eb51[_0x345ed7(0x1fe)][_0x183812],_0x550e47=_0x30af10(_0x183812);if(_0x44c01e[_0x345ed7(0x19f)]===_0x345ed7(0x144)&&_0x44c01e[_0x345ed7(0x1a4)]&&(isPendingActivationId(_0x44c01e[_0x345ed7(0x1a4)])||_0x44c01e[_0x345ed7(0x1a4)]==='')){if(_0x550e47?.['journeyActivationStepId']&&isPendingActivationId(_0x550e47[_0x345ed7(0x1a4)])){const _0x30ee77=extractPendingActivationName(_0x550e47[_0x345ed7(0x1a4)]),_0x465c40=_0x356f07['get'](_0x30ee77);_0x465c40&&(_0x44c01e['journeyActivationStepId']=_0x465c40);}}if(_0x44c01e[_0x345ed7(0x19f)]==='DecisionPoint'&&_0x44c01e[_0x345ed7(0x167)]&&_0x550e47?.[_0x345ed7(0x167)])for(let _0xceb163=0x0;_0xceb163<_0x44c01e[_0x345ed7(0x167)]['length'];_0xceb163++){const _0xb5fbd2=_0x44c01e[_0x345ed7(0x167)][_0xceb163],_0x885c93=_0x550e47['branches'][_0xceb163];if(_0x885c93?.[_0x345ed7(0x114)]&&isPendingSegmentId(_0x885c93[_0x345ed7(0x114)])){const _0x119284=_0x134537(_0x885c93[_0x345ed7(0x114)],_0x345ed7(0x1ea)+_0x22eb51[_0x345ed7(0x14c)]+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0xb5fbd2[_0x345ed7(0x14c)]||_0xceb163)+'\x27');_0x119284&&(_0xb5fbd2['segmentId']=_0x119284);}}_0x44c01e['type']===_0x345ed7(0x118)&&_0x550e47?.[_0x345ed7(0x19f)]==='WaitStep'&&resolveWaitStepPendingIds(_0x44c01e,_0x550e47,_0x134537,_0x22eb51[_0x345ed7(0x14c)]);}}}}
|
|
1
|
+
const a152_0x240960=a152_0x3c71;(function(_0x2c8042,_0x508bc2){const _0x473d67=a152_0x3c71,_0x2d5cf6=_0x2c8042();while(!![]){try{const _0xecb848=parseInt(_0x473d67(0xc6))/0x1+-parseInt(_0x473d67(0x15a))/0x2*(parseInt(_0x473d67(0x166))/0x3)+-parseInt(_0x473d67(0x107))/0x4*(-parseInt(_0x473d67(0x122))/0x5)+parseInt(_0x473d67(0x8f))/0x6+parseInt(_0x473d67(0x152))/0x7*(-parseInt(_0x473d67(0x137))/0x8)+-parseInt(_0x473d67(0x98))/0x9*(parseInt(_0x473d67(0x170))/0xa)+parseInt(_0x473d67(0x14b))/0xb*(-parseInt(_0x473d67(0x87))/0xc);if(_0xecb848===_0x508bc2)break;else _0x2d5cf6['push'](_0x2d5cf6['shift']());}catch(_0x5d1982){_0x2d5cf6['push'](_0x2d5cf6['shift']());}}}(a152_0x2184,0x92b02));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a152_0x240960(0x14f));export const PENDING_SEGMENT_PREFIX=a152_0x240960(0xf6);export const PENDING_ACTIVATION_PREFIX=a152_0x240960(0x140);export function createPendingSegmentId(_0x637b42){return''+PENDING_SEGMENT_PREFIX+_0x637b42+'__';}export function isPendingSegmentId(_0x3a90fe){const _0x3788e0=a152_0x240960;return _0x3a90fe[_0x3788e0(0xe6)](PENDING_SEGMENT_PREFIX)&&!_0x3a90fe['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x218cb5){const _0x5e9862=a152_0x240960;return _0x218cb5[_0x5e9862(0xed)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x1ba7fb){return''+PENDING_ACTIVATION_PREFIX+_0x1ba7fb+'__';}export function isPendingActivationId(_0x222590){const _0x997f09=a152_0x240960;return _0x222590[_0x997f09(0xe6)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x1d3f7f){const _0x40e8ce=a152_0x240960;return _0x1d3f7f[_0x40e8ce(0xed)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x32db35,_0x1afd6f){const _0x17ec96=a152_0x240960,_0x3229fb=_0x32db35+'::'+(_0x1afd6f['trim']()||_0x17ec96(0xa2)),_0x307d07=createHash('sha1')[_0x17ec96(0xba)](_0x3229fb)[_0x17ec96(0x135)](_0x17ec96(0xa6))[_0x17ec96(0xec)](0x0,0xc);return'journey_entry_criteria_'+_0x307d07;}export function ensureJourneyDefaults(_0x8d3217){const _0x2e40f6=a152_0x240960;!_0x8d3217[_0x2e40f6(0xdc)]&&(_0x8d3217['description']=''),!_0x8d3217[_0x2e40f6(0xca)]&&(_0x8d3217[_0x2e40f6(0xca)]=_0x2e40f6(0x148));}export function injectExistingStageIds(_0x253cd2,_0x101628){const _0x17a6d5=a152_0x240960,_0x458ba0=new Map(_0x101628[_0x17a6d5(0xb0)](_0x43d963=>[_0x43d963['name'],_0x43d963['id']]));for(const _0x5bd697 of _0x253cd2){if(!_0x5bd697['id']){const _0x372808=_0x458ba0[_0x17a6d5(0x78)](_0x5bd697['name']);_0x372808&&(_0x5bd697['id']=_0x372808);}}}function a152_0x2184(){const _0x163737=['flatMap','63KdGKTx','DecisionPoint','activationParams','keys','segmentNameToId','action','Updated\x20segment\x20\x27','create','26862KvwKke','Delete\x20the\x20push\x20recovery\x20file\x20(','buildUserMaps','existingActivation','journeyById','listActivations','yamlActivation','Journey\x20\x27','sort','getSegment\x20failed\x20for\x20','activations','filter','99XNgkdV','set','reduce','parentFolder','journeys','folderId','parentSegmentFolder','decision_point','join','add','70rqqYyj','journeyActivationStepId','split','journeyName','segmentFolderId','waitStepType','behavior','conditionTimeoutUnit','segmentByFolderAndName','createJourneySegment','activation_deleted','length','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','validatedRequest','getSegmentEntity','activation_','activationContext','Updating\x20segment\x20\x27','Matched\x20server\x20segment\x20\x27','hasChanges','segment_creating','get','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','Activation\x20not\x20found:\x20','./child-segment-yaml.js','journeyId','notification','Created\x20segment\x20\x27','push','NOT_FOUND','null','Entry\x20criteria:\x20',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','logDeleted','JOURNEY_SYNTAX_ERROR','entry_criteria','3507060ptbqlo','goal','\x27\x20decision\x20point\x20branch\x20\x27','debug','folder_created','logSuccess','isNew','activationActions','7004604QsRvAt','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','activation_created','createdSegmentId','and\x20the\x20server\x20segment,\x20then\x20retry.','createFolder','waitStepUnit','INTERNAL','Name\x20has\x20already\x20been\x20taken','164763FdeQmR','embedded_segment_creating','activationsBySegmentId','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x20(referenced\x20in\x20journey\x20','embedded_segment_created','Failed\x20to\x20','segment_updated','\x20segment\x20from\x20file:\x20','schedule','segment','parseDocument','uniqueServerName','../../utils/async.js','hex','activation_updated','yamlConfig','Embedded\x20segment\x20\x27','\x27\x20for\x20','Created\x20journey\x20\x27','Creating\x20segment\x20\x27','Creating\x20folder\x20\x27','existingSegments','kind','map','ACTIVATION_UPDATE_ERROR','activationStepsById','milestone','progress','SEGMENT_NOT_FOUND','journey','updated','delete','name','update','connection','segment_updating','stages','withProgress','entries','idToName','branches','isArray','entryCriteria','./journey-yaml.js','journeyActivationNameToId','670291oefwHR','updateActivation','skipSegments','getSegment','state','Failed\x20to\x20fetch\x20referenced\x20segment\x20','journey_updated','toISOString','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','relationships','some','segments','segment_created','folderPath','type','parse','existingJourney','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','journey_created','embedded_activation_creating','createActivation','columns','description','Fetching\x20','rootFolderId','relative','versionNumber','absolutePath','data','\x27...','exitCriterias','entry','startsWith','segmentId','SEGMENT_UPDATE_ERROR','createdSegmentIds','\x27\x20wait\x20condition','valid','slice','replace','activation_updating','Updating\x20activation\x20\x27','user','attributes','WaitStep','ACTIVATION_SYNTAX_ERROR','conditionSegmentId','Duration','__pending_','Created\x20folder\x20\x27','max','all','conditions','results','Deleting\x20activation\x20\x27','run_after_journey_refresh','unchanged','with','uniqueSegmentName','journey_updating','toLowerCase','activation_template_id','day','\x27\x20not\x20found\x20in\x20journey\x20\x27','has','912772uqGnVe','deps','Segment\x20not\x20found','Created\x20activation\x20\x27','nameToType','find','Creating\x20activation\x20\x27','Segment\x20not\x20found:\x20','Deleted\x20activation\x20\x27','journeyBundleId','created','\x27\x20by\x20rule\x20content','logInfo','diff','idToEmailMap','activation_creating','Activation','connector_config','resolvedRule','from','getJourney','rule','\x27\x20entry\x20criteria','embedded_activation_created','connectionIdToNameMap','folder_creating','Condition','5nmUBhn','deleted','\x20journey\x20from\x20file:\x20','folderPathToId','stage\x20\x27','onProgress','\x0a\x20\x20','updateSegmentById','existingSegment','list','parentId','journeyBundleName','index','goal\x20criteria','embeddedSegmentNameToId','journeyStages','Updated\x20activation\x20\x27','nameToId','journeyBundlesByFolderAndName','digest','conditionTimeoutDuration','15064nGVpWs','createSegment','item','steps','stringify','\x27\x20to\x20local\x20\x27','journey_creating','toString','values','__pending_act_','utf-8','logWarning','.$1.push-recovery.json','\x27\x20exit\x20criteria','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','localName','folder','draft','size','\x27\x20from\x20file:\x20','33CZykfZ','verbose','effectiveFolderId','waitStep','tdx.sdk.push-workflow','activation_deleting'];a152_0x2184=function(){return _0x163737;};return a152_0x2184();}export function resolveTDFolderPath(_0x2dda76,_0x35dd3f,_0x4f847f){if(!_0x35dd3f)return _0x2dda76;if(_0x2dda76===_0x4f847f||_0x2dda76['startsWith'](_0x4f847f+'/'))return _0x2dda76;return _0x2dda76?_0x4f847f+'/'+_0x2dda76:_0x4f847f;}export function addFoldersToCreate(_0x53b84c,_0xcfbe9f,_0x64b991){const _0x1e05f7=a152_0x240960;if(!_0x53b84c)return;if(_0xcfbe9f[_0x1e05f7(0x106)](_0x53b84c))return;const _0x5e1c6a=_0x53b84c['split']('/');let _0x4e4e96='';for(const _0x15ce46 of _0x5e1c6a){_0x4e4e96=_0x4e4e96?_0x4e4e96+'/'+_0x15ce46:_0x15ce46,!_0xcfbe9f[_0x1e05f7(0x106)](_0x4e4e96)&&_0x64b991[_0x1e05f7(0x16f)](_0x4e4e96);}}export function sortFoldersByDepth(_0x36f3f5){const _0x5675e8=a152_0x240960;return[..._0x36f3f5][_0x5675e8(0x162)]((_0x3dbe6b,_0x379d78)=>{const _0x311e1f=_0x5675e8,_0x53e97c=(_0x3dbe6b['match'](/\//g)||[])[_0x311e1f(0x6e)],_0x19a928=(_0x379d78['match'](/\//g)||[])[_0x311e1f(0x6e)];return _0x53e97c-_0x19a928;});}import*as a152_0x4fea42 from'yaml';import{readFileSync}from'fs';import a152_0x3ab88b from'path';import{isJourneyDef,parseYamlString as a152_0x233513,toYamlString as a152_0x3b4573,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(_0x3e5c7c){const _0x1107fe=a152_0x240960;if(Array[_0x1107fe(0xc2)](_0x3e5c7c))return'['+_0x3e5c7c[_0x1107fe(0xb0)](_0x5078cb=>stableStringify(_0x5078cb))['join'](',')+']';if(_0x3e5c7c&&typeof _0x3e5c7c==='object'){const _0x484522=_0x3e5c7c,_0x56bead=Object[_0x1107fe(0x155)](_0x484522)['sort'](),_0x4c4283=_0x56bead[_0x1107fe(0xb0)](_0x221931=>'\x22'+_0x221931+'\x22:'+stableStringify(_0x484522[_0x221931]));return'{'+_0x4c4283[_0x1107fe(0x16e)](',')+'}';}const _0x19a9c0=JSON['stringify'](_0x3e5c7c);return _0x19a9c0===undefined?_0x1107fe(0x81):_0x19a9c0;}function activationSignature(_0x35c05d){const _0x170696=a152_0x240960,_0x511200={'connection':_0x35c05d[_0x170696(0xbb)],..._0x35c05d['all_columns']!==undefined&&{'all_columns':_0x35c05d['all_columns']},..._0x35c05d[_0x170696(0xdb)]!==undefined&&{'columns':_0x35c05d[_0x170696(0xdb)]},..._0x35c05d['behavior']!==undefined&&{'behavior':_0x35c05d[_0x170696(0x176)]},..._0x35c05d[_0x170696(0xa1)]!==undefined&&{'schedule':_0x35c05d['schedule']},..._0x35c05d[_0x170696(0x7d)]!==undefined&&{'notification':_0x35c05d[_0x170696(0x7d)]},..._0x35c05d[_0x170696(0x118)]!==undefined&&{'connector_config':_0x35c05d[_0x170696(0x118)]},..._0x35c05d['activation_template_id']!==undefined&&{'activation_template_id':_0x35c05d[_0x170696(0x103)]}};return stableStringify(_0x511200);}function a152_0x3c71(_0x1a7c32,_0x5ad188){_0x1a7c32=_0x1a7c32-0x6d;const _0x218428=a152_0x2184();let _0x3c718e=_0x218428[_0x1a7c32];return _0x3c718e;}async function fetchSegment(_0x3ccd49,_0x786eb3,_0x3694d6,_0x28fbe6){const _0x15ea38=a152_0x240960,_0x3e4c01=_0x28fbe6?.[_0x15ea38(0x10c)](_0x4e230c=>_0x4e230c['id']===_0x3694d6);if(_0x3e4c01)return _0x3e4c01;try{return await _0x3ccd49[_0x15ea38(0xa2)][_0x15ea38(0xc9)](_0x786eb3,_0x3694d6);}catch(_0x46674e){logger['debug'](_0x15ea38(0x163)+_0x3694d6+_0x15ea38(0x83)+_0x46674e);try{return await _0x3ccd49[_0x15ea38(0xa2)][_0x15ea38(0x71)](_0x3694d6);}catch(_0x3c33b3){return logger[_0x15ea38(0x8a)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x3694d6+':\x20'+_0x3c33b3),null;}}}function recoverSegmentIdsFromPushRecovery(_0x3eaf9e,_0x27ed6a,_0x49f935){const _0x10c79c=a152_0x240960,_0x492cec=readPushRecovery(_0x3eaf9e[_0x10c79c(0xe1)]);if(_0x492cec?.['journeyName']===_0x3eaf9e[_0x10c79c(0xa8)][_0x10c79c(0xb9)])for(const [_0x338142,_0x4e07df]of Object[_0x10c79c(0xbf)](_0x492cec[_0x10c79c(0xd1)])){const _0x4794a4=generateDeterministicJourneySegmentName(_0x3eaf9e[_0x10c79c(0xa8)][_0x10c79c(0xb9)],_0x338142);_0x4e07df['uniqueServerName']===_0x4794a4&&(_0x27ed6a['set'](_0x338142,_0x4e07df[_0x10c79c(0xe7)]),_0x49f935['set'](_0x338142,_0x4e07df[_0x10c79c(0xe7)]));}}async function createOrRecoverEmbeddedSegment(_0x1b516c,_0x1aadec,_0x54f590,_0x27a66a){const _0xe9257e=a152_0x240960;let _0x54d807;try{_0x54d807=await _0x1b516c[_0xe9257e(0xa2)][_0xe9257e(0x179)]({'name':_0x54f590[_0xe9257e(0x100)],'description':_0x54f590[_0xe9257e(0xdc)],'journeyId':_0x54f590[_0xe9257e(0x7c)],'rule':_0x27a66a(_0x54f590['resolvedRule'],!![]),'countPopulation':!![],'parentFolderId':_0x54f590[_0xe9257e(0x16b)],'audienceId':_0x54f590[_0xe9257e(0x12c)]});}catch(_0x1193a3){const _0x519107=_0x1193a3 instanceof Error&&_0x1193a3['message']['includes'](_0xe9257e(0x97));if(_0x519107){const _0xc6e9f9=readPushRecovery(_0x1aadec['absolutePath']),_0x30984d=_0xc6e9f9?.[_0xe9257e(0x173)]===_0x1aadec[_0xe9257e(0xa8)]['name']?_0xc6e9f9[_0xe9257e(0xd1)][_0x54f590[_0xe9257e(0x146)]]:undefined;if(_0x30984d?.[_0xe9257e(0xa4)]===_0x54f590['uniqueSegmentName'])await _0x1b516c[_0xe9257e(0xa2)][_0xe9257e(0x129)](_0x54f590[_0xe9257e(0x12c)],_0x30984d[_0xe9257e(0xe7)],{'description':_0x54f590[_0xe9257e(0xdc)],'rule':_0x27a66a(_0x54f590[_0xe9257e(0x119)],!![]),'countPopulation':!![]}),_0x54d807=_0x30984d[_0xe9257e(0xe7)];else throw new SDKError(ErrorCode[_0xe9257e(0xe8)],_0xe9257e(0xa9)+_0x54f590[_0xe9257e(0x146)]+_0xe9257e(0x145)+(_0xe9257e(0x15b)+_0x1aadec['absolutePath'][_0xe9257e(0xed)](/([^/]+)$/,_0xe9257e(0x143))+')\x20')+_0xe9257e(0x93),_0x1193a3);}else throw _0x1193a3;}return saveSegmentToPushRecovery(_0x1aadec['absolutePath'],_0x1aadec[_0xe9257e(0xa8)][_0xe9257e(0xb9)],_0x54f590['localName'],{'segmentId':_0x54d807,'uniqueServerName':_0x54f590['uniqueSegmentName'],'createdAt':new Date()[_0xe9257e(0xcd)]()}),_0x54d807;}export async function prepareSegmentFiles(_0xee458,_0x56538c,_0x37e753,_0xc8d1d8,_0x7a7cba){const _0x19b8a4=a152_0x240960,{activationDefToCreateRequest:_0x1fed7c}=await import(_0x19b8a4(0x7b)),_0x53cd62=[],_0x22611=new Set();for(const {yamlConfig:_0x387f81,folderPath:_0x421628,sourcePath:_0x9d3097}of _0xee458){const _0x2daa2d=resolveTDFolderPath(_0x421628,_0xc8d1d8,_0x7a7cba),_0x59cefd=_0x2daa2d+':'+_0x387f81[_0x19b8a4(0xb9)],_0x46e74a=_0x56538c[_0x19b8a4(0x178)][_0x19b8a4(0x78)](_0x59cefd),_0x1f97eb=_0x46e74a?_0x56538c[_0x19b8a4(0x9a)][_0x19b8a4(0x78)](_0x46e74a['id'])||[]:[];addFoldersToCreate(_0x2daa2d,_0x56538c[_0x19b8a4(0x125)],_0x22611);const _0x3b6020=calculateActivationActions(_0x387f81[_0x19b8a4(0x164)]||[],_0x1f97eb,_0x56538c[_0x19b8a4(0x115)],_0x56538c[_0x19b8a4(0x11f)]);for(const _0x3dc372 of _0x3b6020){(_0x3dc372[_0x19b8a4(0xd4)]===_0x19b8a4(0x159)||_0x3dc372[_0x19b8a4(0xd4)]===_0x19b8a4(0xba))&&_0x3dc372[_0x19b8a4(0x160)]&&(_0x3dc372['validatedRequest']=await _0x1fed7c(_0x3dc372[_0x19b8a4(0x160)],_0x37e753));}const _0x42f4b2=calculateSegmentDiff(_0x387f81,_0x46e74a,_0x1f97eb,_0x56538c[_0x19b8a4(0x115)],_0x56538c[_0x19b8a4(0x11f)]);_0x53cd62[_0x19b8a4(0x7f)]({'relativePath':_0x387f81[_0x19b8a4(0xb9)],'absolutePath':_0x9d3097,'yamlConfig':_0x387f81,'folderPath':_0x2daa2d,'existingSegment':_0x46e74a,'existingActivations':_0x1f97eb,'isNew':_0x42f4b2[_0x19b8a4(0x8d)],'hasChanges':_0x42f4b2[_0x19b8a4(0x76)],'diff':_0x42f4b2['diff'],'activationActions':_0x3b6020});}return{'segmentFiles':_0x53cd62,'foldersToCreate':_0x22611};}export async function prepareJourneyFiles(_0x26e75b,_0x5dc26a,_0x46e690,_0xb3fd48){const _0x2fd5e2=a152_0x240960,_0x2aefb1=[],_0x484704=new Set();for(const {yamlConfig:_0xa9fd7e,folderPath:_0x30a625,sourcePath:_0xcd3313}of _0x26e75b){const _0x55cea2=resolveTDFolderPath(_0x30a625,_0x46e690,_0xb3fd48),_0x37f08a=_0x55cea2+':'+_0xa9fd7e[_0x2fd5e2(0xb9)],_0x2e4387=_0x5dc26a[_0x2fd5e2(0x134)][_0x2fd5e2(0x78)](_0x37f08a);let _0x17a70e,_0xfe378e;if(_0x2e4387&&_0x2e4387['length']>0x0){const _0x1e9532=buildLocalExpandedRuleMappings(_0xa9fd7e),{createYamlContext:_0x31abb7,prefetchJourneySegments:_0x40b930}=createPushYamlContextForBundle(_0x5dc26a[_0x2fd5e2(0x108)],_0x5dc26a['parentId'],_0x5dc26a['existingSegments'],_0x1e9532,_0x5dc26a[_0x2fd5e2(0x115)],_0x5dc26a[_0x2fd5e2(0x11f)],_0x5dc26a[_0x2fd5e2(0xb2)],_0x5dc26a[_0x2fd5e2(0x15e)]);await _0x40b930(_0x2e4387[_0x2fd5e2(0xb0)](_0x3034ff=>_0x3034ff['id']));const _0x207235=await _0x5dc26a[_0x2fd5e2(0x108)][_0x2fd5e2(0xb6)]['getLatestJourneyId'](_0x2e4387[0x0][_0x2fd5e2(0x110)]),_0x493fbd=hasMultipleVersions(_0xa9fd7e),_0x39f45b=async _0x137f27=>{const _0x4baa52=_0x2fd5e2,_0x56983e=_0x5dc26a[_0x4baa52(0x15e)]?.[_0x4baa52(0x78)](_0x137f27);if(_0x56983e)return _0x56983e;return _0x5dc26a['fetchJourney']({'journeyId':_0x137f27,'journeyName':_0xa9fd7e[_0x4baa52(0xb9)],'isMultiVersion':_0x2e4387['length']>0x1});};if(_0x493fbd&&_0x2e4387[_0x2fd5e2(0x6e)]>0x1){const _0x37a015=[];for(const _0xe95fee of _0x2e4387){const _0x24fd99=_0xe95fee[_0x2fd5e2(0xe0)]||0x1;_0x5dc26a[_0x2fd5e2(0xb4)]?.[_0x2fd5e2(0xba)](_0x2fd5e2(0xdd)+_0xa9fd7e['name']+'\x20v'+_0x24fd99);const _0x54295c=await _0x39f45b(_0xe95fee['id']),_0x4be4c0=_0x31abb7(_0xe95fee['id']),_0x49ed19=await journeyResponseToDef(_0x54295c,_0x4be4c0);_0x37a015[_0x2fd5e2(0x7f)]({'item':_0xe95fee,'yaml':_0x49ed19});}const _0x3ea131=buildLocalRuleToNameMappingFromJourney(_0xa9fd7e);_0xfe378e=buildMergedJourneyDef(_0x37a015,_0x3ea131,_0x207235);const _0x5710dc=Math[_0x2fd5e2(0xf8)](..._0x37a015[_0x2fd5e2(0xb0)](_0x380808=>_0x380808[_0x2fd5e2(0x139)][_0x2fd5e2(0xe0)]||0x0)),_0xd750ff=_0x2e4387['find'](_0x30292c=>(_0x30292c[_0x2fd5e2(0xe0)]||0x0)===_0x5710dc);_0xd750ff&&(_0x5dc26a[_0x2fd5e2(0xb4)]?.[_0x2fd5e2(0xba)](_0x2fd5e2(0xdd)+_0xa9fd7e[_0x2fd5e2(0xb9)]+'\x20v'+_0x5710dc),_0x17a70e=await _0x39f45b(_0xd750ff['id']));}else{const _0x717849=_0x2e4387[_0x2e4387['length']-0x1];_0x5dc26a[_0x2fd5e2(0xb4)]?.[_0x2fd5e2(0xba)]('Fetching\x20'+_0xa9fd7e[_0x2fd5e2(0xb9)]),_0x17a70e=await _0x39f45b(_0x717849['id']);const _0x22f469=_0x31abb7(_0x717849['id']),_0x408e1c=await journeyResponseToDef(_0x17a70e,_0x22f469),_0x5a3209=buildLocalRuleToNameMappingFromJourney(_0xa9fd7e);_0xfe378e=buildMergedJourneyDef([{'item':_0x717849,'yaml':_0x408e1c}],_0x5a3209,_0x207235);}}addFoldersToCreate(_0x55cea2,_0x5dc26a[_0x2fd5e2(0x125)],_0x484704);const _0x4215ce=calculateJourneyDiff(_0xa9fd7e,_0xfe378e);_0x2aefb1['push']({'relativePath':_0xa9fd7e[_0x2fd5e2(0xb9)],'absolutePath':_0xcd3313,'yamlConfig':_0xa9fd7e,'folderPath':_0x55cea2,'existingJourney':_0x17a70e,'isNew':_0x4215ce[_0x2fd5e2(0x8d)],'hasChanges':_0x4215ce[_0x2fd5e2(0x76)],'diff':_0x4215ce[_0x2fd5e2(0x114)]});}return{'journeyFiles':_0x2aefb1,'foldersToCreate':_0x484704};}export function calculateActivationActions(_0x24d919,_0x50d709,_0x4ad398,_0x1d6aa6){const _0x52f1a6=a152_0x240960,_0x3fdb3e=[],_0x5bd877=new Map();for(const _0x2f7803 of _0x50d709){_0x5bd877['set'](_0x2f7803[_0x52f1a6(0xb9)],_0x2f7803);}const _0x8c9faa=new Map();for(const _0x415ddb of _0x24d919){_0x8c9faa['set'](_0x415ddb[_0x52f1a6(0xb9)],_0x415ddb);}for(const _0x37dc88 of _0x24d919){const _0x398ab3=_0x5bd877['get'](_0x37dc88[_0x52f1a6(0xb9)]);if(!_0x398ab3)_0x3fdb3e['push']({'type':'create','name':_0x37dc88[_0x52f1a6(0xb9)],'yamlActivation':_0x37dc88});else{const _0x2dd528=activationResponseToDef(_0x398ab3,_0x4ad398,_0x1d6aa6),_0x3ce33a=a152_0x4fea42['stringify'](_0x2dd528),_0x5cde44=a152_0x4fea42[_0x52f1a6(0x13b)](_0x37dc88);_0x3ce33a!==_0x5cde44&&_0x3fdb3e[_0x52f1a6(0x7f)]({'type':_0x52f1a6(0xba),'name':_0x37dc88[_0x52f1a6(0xb9)],'yamlActivation':_0x37dc88,'existingActivation':_0x398ab3});}}for(const _0x96cfd4 of _0x50d709){!_0x8c9faa[_0x52f1a6(0x106)](_0x96cfd4[_0x52f1a6(0xb9)])&&_0x3fdb3e['push']({'type':_0x52f1a6(0xb8),'name':_0x96cfd4['name'],'existingActivation':_0x96cfd4});}return _0x3fdb3e;}function calculateYamlDiff(_0x5ac0b6,_0x3ec5e0){if(_0x3ec5e0){const _0x27d99a=generateDiff(_0x3ec5e0,_0x5ac0b6),_0x4d4d2d=hasChanges(_0x27d99a);return{'isNew':![],'hasChanges':_0x4d4d2d,'diff':_0x4d4d2d?formatDiffWithColors(_0x27d99a):undefined};}const _0x1066af=generateDiff('',_0x5ac0b6);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x1066af)};}export function calculateSegmentDiff(_0x22cb3d,_0x242ff0,_0x165c06,_0x3bc175,_0x2b4587){const _0x123639=segmentToYamlString(_0x22cb3d),_0x1e1458=_0x242ff0?segmentToYamlString(segmentWithActivationsToYaml(_0x242ff0,_0x165c06,undefined,_0x3bc175,_0x2b4587)):undefined;return calculateYamlDiff(_0x123639,_0x1e1458);}export function calculateJourneyDiff(_0x53f71e,_0x17da75){const _0x542383=normalizeJourneyDef(_0x53f71e,_0x53f71e),_0x51de6c=a152_0x3b4573(_0x542383),_0x1577c8=_0x17da75?a152_0x3b4573(normalizeJourneyDef(_0x17da75,_0x53f71e)):undefined;return calculateYamlDiff(_0x51de6c,_0x1577c8);}export function findSegmentsToDelete(_0x78019d,_0x6effc3,_0x5641f3,_0x2c3fd3,_0x508ae3){const _0x5adce9=a152_0x240960,_0x33eb5e=new Set();for(const {yamlConfig:_0x457aa5,folderPath:_0x1d0e19}of _0x6effc3){_0x33eb5e[_0x5adce9(0x16f)](_0x1d0e19+':'+_0x457aa5['name']);}return _0x78019d[_0x5adce9(0x165)](_0x1c77f1=>{const _0x367ad9=_0x5adce9,_0x71b858=_0x1c77f1['segmentFolderId']?_0x5641f3[_0x367ad9(0x78)](_0x1c77f1['segmentFolderId']['toString']())||'':'',_0x3460cb=_0x71b858+':'+_0x1c77f1['name'];if(_0x33eb5e[_0x367ad9(0x106)](_0x3460cb))return![];if(_0x508ae3)return _0x71b858===_0x2c3fd3||_0x71b858[_0x367ad9(0xe6)](_0x2c3fd3+'/');return!![];});}export function findJourneysToDelete(_0x2e759d,_0x15cb64,_0x2ac13d,_0xc76ce3,_0x442cbc){const _0x974074=a152_0x240960,_0x420fb6=new Set();for(const {yamlConfig:_0x164488,folderPath:_0x5789cc}of _0x15cb64){_0x420fb6[_0x974074(0x16f)](_0x5789cc+':'+_0x164488[_0x974074(0xb9)]);}return _0x2e759d['filter'](_0x2b8f4e=>{const _0x4ded9d=_0x974074,_0x270fed=_0x2b8f4e[_0x4ded9d(0x16b)]?_0x2ac13d['get'](_0x2b8f4e['folderId'])||'':'',_0x314172=_0x270fed+':'+_0x2b8f4e[_0x4ded9d(0x12d)];if(_0x420fb6['has'](_0x314172))return![];if(_0x442cbc)return _0x270fed===_0xc76ce3||_0x270fed[_0x4ded9d(0xe6)](_0xc76ce3+'/');return!![];});}export function buildSegmentLookupMap(_0x366a39,_0x4553e4){const _0x167dde=a152_0x240960,_0x1f4df5=new Map();for(const _0x341bb0 of _0x366a39){const _0x3209c2=_0x341bb0[_0x167dde(0x174)]?_0x4553e4[_0x167dde(0x78)](_0x341bb0['segmentFolderId'][_0x167dde(0x13e)]())||'':'',_0x312177=_0x3209c2+':'+_0x341bb0[_0x167dde(0xb9)];_0x1f4df5[_0x167dde(0x167)](_0x312177,_0x341bb0);}return _0x1f4df5;}export function buildSegmentNameToIdMap(_0x5cfd2b){const _0x4ddaa3=a152_0x240960,_0x4857d9=new Map();for(const _0x1c76b1 of _0x5cfd2b){_0x4857d9['set'](_0x1c76b1[_0x4ddaa3(0xb9)],_0x1c76b1['id']);}return _0x4857d9;}export function buildJourneyBundleLookupMap(_0x18d92b,_0x57741f){const _0x4e0c4d=a152_0x240960,_0x18f88a=new Map();for(const _0x5dceaa of _0x18d92b){const _0x4ff896=_0x5dceaa[_0x4e0c4d(0x16b)]?_0x57741f['get'](_0x5dceaa[_0x4e0c4d(0x16b)])||'':'',_0x4798bf=_0x4ff896+':'+_0x5dceaa['journeyBundleName'];!_0x18f88a[_0x4e0c4d(0x106)](_0x4798bf)&&_0x18f88a[_0x4e0c4d(0x167)](_0x4798bf,[]),_0x18f88a[_0x4e0c4d(0x78)](_0x4798bf)['push'](_0x5dceaa);}for(const _0x404ce3 of _0x18f88a[_0x4e0c4d(0x13f)]()){_0x404ce3[_0x4e0c4d(0x162)]((_0x52df3a,_0xc333d7)=>(_0x52df3a['versionNumber']||0x0)-(_0xc333d7[_0x4e0c4d(0xe0)]||0x0));}return _0x18f88a;}export function collectFoldersToCreate(_0x14a889,_0x2d3890){const _0x281aca=a152_0x240960,_0x744ef9=new Set();for(const _0x34fcc5 of _0x14a889){if(!_0x34fcc5)continue;if(_0x2d3890[_0x281aca(0x106)](_0x34fcc5))continue;const _0x57dfb4=_0x34fcc5[_0x281aca(0x172)]('/');let _0x9167bd='';for(const _0x3a4767 of _0x57dfb4){_0x9167bd=_0x9167bd?_0x9167bd+'/'+_0x3a4767:_0x3a4767,!_0x2d3890['has'](_0x9167bd)&&_0x744ef9[_0x281aca(0x16f)](_0x9167bd);}}return _0x744ef9;}export function parseAndClassifyYamlFiles(_0xd590f5,_0x56d00a,_0xbeec50){const _0x137b84=a152_0x240960,_0x1dea0d=[],_0x36760e=[];for(const _0x29f8a5 of _0xd590f5){const _0x491d68=a152_0x3ab88b[_0x137b84(0xdf)](_0x56d00a,a152_0x3ab88b['dirname'](_0x29f8a5)),_0x4d88b2=_0x491d68==='.'?'':_0x491d68[_0x137b84(0xed)](/\\/g,'/'),_0x15820d=readFileSync(_0x29f8a5,_0x137b84(0x141)),_0x1ae05f=a152_0x4fea42[_0x137b84(0xd5)](_0x15820d);if(isJourneyDef(_0x1ae05f)){const _0xb715e6=a152_0x233513(_0x15820d);_0x36760e[_0x137b84(0x7f)]({'yamlConfig':_0xb715e6,'folderPath':_0x4d88b2,'sourcePath':_0x29f8a5});}else{if(!_0xbeec50?.[_0x137b84(0xc8)]){const _0x28baad=parseSegmentYamlFile(_0x15820d),_0x2ab573=normalizeChildSegmentYaml(_0x28baad);_0x1dea0d[_0x137b84(0x7f)]({'yamlConfig':_0x2ab573,'folderPath':_0x4d88b2,'sourcePath':_0x29f8a5});}}}return{'segments':_0x1dea0d,'journeys':_0x36760e};}export function validateParsedFiles(_0x9b46c1,_0x332fce){const _0x34d9c1=a152_0x240960,_0x5eaedf=[];for(const {yamlConfig:_0x7e2227,sourcePath:_0x41cbe3}of _0x9b46c1[_0x34d9c1(0xd1)]){const _0x249f9b=readFileSync(_0x41cbe3,_0x34d9c1(0x141)),_0x3058fc=a152_0x4fea42[_0x34d9c1(0xa3)](_0x249f9b),_0x26e003=validateSegmentDef(_0x7e2227,{'source':_0x249f9b,'document':_0x3058fc},{'skipSchema':!![]});if(!_0x26e003[_0x34d9c1(0xeb)]){const _0x1d97c6=a152_0x3ab88b[_0x34d9c1(0xdf)](_0x332fce,_0x41cbe3);_0x5eaedf[_0x34d9c1(0x7f)]({'filePath':_0x1d97c6,'source':_0x249f9b,'result':_0x26e003,'isJourney':![]});}}for(const {yamlConfig:_0x118ec1,sourcePath:_0x46871f}of _0x9b46c1[_0x34d9c1(0x16a)]){const _0x25c462=readFileSync(_0x46871f,'utf-8'),_0x508df2=a152_0x4fea42[_0x34d9c1(0xa3)](_0x25c462),_0x215051=validateJourneyDef(_0x118ec1,{'source':_0x25c462,'document':_0x508df2},{'skipSchema':!![]});if(!_0x215051['valid']){const _0x5bf630=a152_0x3ab88b[_0x34d9c1(0xdf)](_0x332fce,_0x46871f);_0x5eaedf[_0x34d9c1(0x7f)]({'filePath':_0x5bf630,'source':_0x25c462,'result':_0x215051,'isJourney':!![]});}}return _0x5eaedf;}export function formatValidationErrors(_0x5e0ba2){const _0x8ce0da=a152_0x240960,_0xbbb8db=[];for(const {filePath:_0x436404,source:_0x35c892,result:_0x6f1890,isJourney:_0x564102}of _0x5e0ba2){const _0x4c22dd=_0x564102?_0x8ce0da(0xb6):_0x8ce0da(0xa2);_0xbbb8db['push']('\x0a'+_0x436404+'\x20('+_0x4c22dd+'):\x20'+_0x6f1890['errors'][_0x8ce0da(0x6e)]+'\x20error(s)'),_0xbbb8db[_0x8ce0da(0x7f)](formatValidationResult(_0x6f1890,_0x35c892,_0x436404));}return _0xbbb8db['join']('\x0a');}export function buildLocalExpandedRuleMappings(_0x1b97b1){const _0x560164=a152_0x240960,_0x1971c3=new Set(),_0xde6cec=new Map(),_0x16d81b=collectSegmentUsageCounts(_0x1b97b1);if(_0x1b97b1[_0x560164(0xd1)])for(const [_0x2c674c,_0x11c7c7]of Object[_0x560164(0xbf)](_0x1b97b1[_0x560164(0xd1)])){_0x1971c3[_0x560164(0x16f)](_0x2c674c);if(_0x11c7c7['rule']){const _0x3f6b59=yamlRuleToApi(_0x11c7c7['rule']),_0x5789d0=apiRuleToYaml(_0x3f6b59);_0xde6cec[_0x560164(0x167)](_0x2c674c,_0x5789d0);}}const _0x4f9d75=new Map();let _0x297004=0x0;for(const [_0x43b0a9,_0x49af12]of _0xde6cec){const _0xcc9072=serializeExpandedRule(_0x49af12,_0xde6cec),_0x132cee=_0x4f9d75['get'](_0xcc9072)||[];_0x132cee[_0x560164(0x7f)]({'name':_0x43b0a9,'index':_0x297004}),_0x4f9d75['set'](_0xcc9072,_0x132cee),_0x297004++;}const _0x44ba3c=new Map();for(const [_0x52ae7b,_0x302de5]of _0x4f9d75){const _0xc6fd5e=_0x302de5[_0x560164(0xec)]()['sort']((_0xf61656,_0x57194)=>{const _0x57c031=_0x560164,_0x2dce3d=_0x16d81b[_0x57c031(0x78)](_0xf61656['name'])||0x0,_0x4db125=_0x16d81b[_0x57c031(0x78)](_0x57194[_0x57c031(0xb9)])||0x0;if(_0x2dce3d!==_0x4db125)return _0x4db125-_0x2dce3d;return _0xf61656[_0x57c031(0x12e)]-_0x57194[_0x57c031(0x12e)];})[_0x560164(0xb0)](_0x462687=>_0x462687[_0x560164(0xb9)]),_0x423fff=[];for(const _0x45844c of _0xc6fd5e){const _0xc0ea69=_0x16d81b[_0x560164(0x78)](_0x45844c)||0x0,_0x34ed38=Math[_0x560164(0xf8)](_0xc0ea69,0x1);for(let _0xc90a39=0x0;_0xc90a39<_0x34ed38;_0xc90a39++){_0x423fff[_0x560164(0x7f)](_0x45844c);}}_0x44ba3c[_0x560164(0x167)](_0x52ae7b,_0x423fff);}return{'existingLocalSegmentNames':_0x1971c3,'localSegmentRules':_0xde6cec,'localExpandedRuleToNames':_0x44ba3c};}export function createSegmentIdResolver(_0x10d393,_0x4ab11f){return async _0x15fef8=>{const _0x34ca47=a152_0x3c71,_0x12e0f4=_0x10d393[_0x34ca47(0x78)](_0x15fef8);if(!_0x12e0f4)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x34ca47(0x10e)+_0x15fef8+_0x34ca47(0xd7)+_0x4ab11f+'\x27)');return _0x12e0f4;};}export function extractRootFolderId(_0x27632a){const _0x53ab4=a152_0x240960;return _0x27632a[_0x53ab4(0xcf)]?.[_0x53ab4(0x16c)]?.['data']?.['id']||_0x27632a[_0x53ab4(0xcf)]?.[_0x53ab4(0x169)]?.[_0x53ab4(0xe2)]?.['id'];}export function buildConnectionMaps(_0x356213){const _0x4247e9=a152_0x240960,_0xe03fb=new Map(),_0x244eb2=new Map(),_0x4664c9=new Map();for(const _0x306c75 of _0x356213){_0xe03fb[_0x4247e9(0x167)](_0x306c75[_0x4247e9(0xb9)],parseInt(_0x306c75['id'],0xa)),_0x244eb2[_0x4247e9(0x167)](_0x306c75['id'],_0x306c75['name']),_0x4664c9[_0x4247e9(0x167)](_0x306c75[_0x4247e9(0xb9)],_0x306c75[_0x4247e9(0xd4)]);}return{'nameToId':_0xe03fb,'idToName':_0x244eb2,'nameToType':_0x4664c9};}export function calculatePushStats(_0x5a4b2b,_0x4850f7,_0x4125b5,_0x41886a,_0x39a1ba,_0xe48046,_0x15efdd){const _0x1dcc04=a152_0x240960,_0x5f55ac=_0x5a4b2b[_0x1dcc04(0x165)](_0x1f7228=>_0x1f7228[_0x1dcc04(0x8d)]),_0x1faac0=_0x5a4b2b['filter'](_0xfec60f=>!_0xfec60f[_0x1dcc04(0x8d)]&&_0xfec60f[_0x1dcc04(0x76)]),_0x587ad5=_0x5a4b2b[_0x1dcc04(0x165)](_0x4fbfaf=>!_0x4fbfaf[_0x1dcc04(0x8d)]&&!_0x4fbfaf[_0x1dcc04(0x76)]),_0x17ba60=_0xe48046?_0x41886a:[],_0x5d464c=_0x4850f7[_0x1dcc04(0x165)](_0x59d6ca=>_0x59d6ca[_0x1dcc04(0x8d)]),_0xe91ecc=_0x4850f7['filter'](_0x1d3709=>!_0x1d3709[_0x1dcc04(0x8d)]&&_0x1d3709[_0x1dcc04(0x76)]),_0x562f92=_0x4850f7['filter'](_0x1fff58=>!_0x1fff58[_0x1dcc04(0x8d)]&&!_0x1fff58[_0x1dcc04(0x76)]),_0x57b26b=_0xe48046?_0x39a1ba:[],_0x4c752b=_0x5a4b2b[_0x1dcc04(0x151)](_0x2295bc=>_0x2295bc['activationActions']),_0x52c6ac=_0x4c752b[_0x1dcc04(0x165)](_0x4082a7=>_0x4082a7['type']===_0x1dcc04(0x159)),_0x14cecb=_0x4c752b[_0x1dcc04(0x165)](_0x33c03a=>_0x33c03a['type']===_0x1dcc04(0xba)),_0x4c791a=_0x4c752b['filter'](_0x4cbbff=>_0x4cbbff[_0x1dcc04(0xd4)]===_0x1dcc04(0xb8)),_0x88c60b=Array['from'](_0x4125b5)[_0x1dcc04(0x162)](),_0x47818c=_0x15efdd?![]:_0x5f55ac[_0x1dcc04(0x6e)]>0x0||_0x1faac0[_0x1dcc04(0x6e)]>0x0||_0x17ba60[_0x1dcc04(0x6e)]>0x0,_0x24ef9b=_0x5d464c[_0x1dcc04(0x6e)]>0x0||_0xe91ecc[_0x1dcc04(0x6e)]>0x0||_0x57b26b[_0x1dcc04(0x6e)]>0x0,_0x2f9192=_0x15efdd?![]:_0x4c752b[_0x1dcc04(0x6e)]>0x0,_0x38ea21=_0x88c60b[_0x1dcc04(0x6e)]>0x0;return{'segments':{'new':_0x5f55ac,'changed':_0x1faac0,'unchanged':_0x587ad5,'toDelete':_0x17ba60},'journeys':{'new':_0x5d464c,'changed':_0xe91ecc,'unchanged':_0x562f92,'toDelete':_0x57b26b},'activations':{'all':_0x4c752b,'toCreate':_0x52c6ac,'toUpdate':_0x14cecb,'toDelete':_0x4c791a},'folders':{'toCreate':_0x88c60b},'counts':{'segments':{'new':_0x5f55ac['length'],'changed':_0x1faac0[_0x1dcc04(0x6e)],'unchanged':_0x587ad5[_0x1dcc04(0x6e)],'toDelete':_0x17ba60[_0x1dcc04(0x6e)]},'journeys':{'new':_0x5d464c[_0x1dcc04(0x6e)],'changed':_0xe91ecc[_0x1dcc04(0x6e)],'unchanged':_0x562f92[_0x1dcc04(0x6e)],'toDelete':_0x57b26b[_0x1dcc04(0x6e)]},'activations':{'create':_0x52c6ac['length'],'update':_0x14cecb[_0x1dcc04(0x6e)],'delete':_0x4c791a['length']},'folders':_0x88c60b[_0x1dcc04(0x6e)]},'hasChanges':_0x47818c||_0x24ef9b||_0x2f9192||_0x38ea21};}export async function buildPushExecutionContext(_0x484f84,_0x477bba,_0x147f60,_0x22f7eb,_0x206d27,_0x12e00f){const _0x9f8f65=a152_0x240960,_0x5579a7=extractRootFolderId(_0x147f60),{pathToId:_0x2e8d7d,idToPath:_0x3f8f27}=buildFolderMaps(_0x206d27),_0x267186=buildSegmentNameToIdMap(_0x22f7eb),_0x5c6b06=new Map(),{batchAsync:_0x32ecb0}=await import('../../utils/async.js'),[_0x367a2e,_0x1ad0a8]=await Promise[_0x9f8f65(0xf9)]([_0x484f84[_0x9f8f65(0xf0)][_0x9f8f65(0x15c)](),_0x484f84[_0x9f8f65(0xbb)][_0x9f8f65(0x12b)](),((async()=>{const _0x3540e5=_0x9f8f65;!_0x12e00f&&_0x22f7eb[_0x3540e5(0x6e)]>0x0&&await _0x32ecb0(_0x22f7eb,async _0x1a54ee=>{const _0x59680b=_0x3540e5,_0x549e59=await _0x484f84[_0x59680b(0xa2)][_0x59680b(0x15f)](_0x477bba,_0x1a54ee['id']);_0x5c6b06['set'](_0x1a54ee['id'],_0x549e59);});})())]),{emailToId:_0x2236c0,idToEmail:_0x32ec80}=_0x367a2e,_0x4be92c=buildConnectionMaps(_0x1ad0a8);return{'rootFolderId':_0x5579a7,'folderPathToId':_0x2e8d7d,'folderIdToPath':_0x3f8f27,'segmentNameToId':_0x267186,'activationsBySegmentId':_0x5c6b06,'emailToIdMap':_0x2236c0,'idToEmailMap':_0x32ec80,'connectionNameToIdMap':_0x4be92c[_0x9f8f65(0x133)],'connectionIdToNameMap':_0x4be92c[_0x9f8f65(0xc0)],'connectionNameToTypeMap':_0x4be92c[_0x9f8f65(0x10b)]};}export function createPushYamlContextForBundle(_0x26a93f,_0x162ba1,_0x4af19e,_0x6627ad,_0x51fb4d,_0x4c91a1,_0x13abc5,_0x122966){const {existingLocalSegmentNames:_0x12c3df,localExpandedRuleToNames:_0x534b24}=_0x6627ad,_0x16bea0=new Set(),_0x2eb79b=new Map(),_0x4c234d=new Map(),_0xe6c67b=new Map(),_0x4eba65=createJumpTargetCache(),_0x2e1286=new Map(),_0xbe51f3=new Map(),_0x366b7b=new Set();let _0x345c9c;const _0x54a6c2=_0x21cf91=>{const _0x8007ce={'resolveSegment':async _0x3210a7=>{const _0x2035d5=a152_0x3c71,_0x1a6252=_0xe6c67b[_0x2035d5(0x78)](_0x3210a7);if(_0x1a6252!==undefined)return{'name':_0x1a6252,'isJourneyLocal':!![]};try{const _0x344f80=await fetchSegment(_0x26a93f,_0x162ba1,_0x3210a7,_0x4af19e);if(!_0x344f80)throw new Error(_0x2035d5(0x109));const _0x137322=generateJourneyLocalName(_0x344f80[_0x2035d5(0xb9)]),_0x10a42d=_0x344f80[_0x2035d5(0xaf)]===SEGMENT_KIND_JOURNEY&&_0x137322!==undefined;let _0x312bfb=_0x344f80[_0x2035d5(0xb9)],_0x1f6ad1;if(_0x10a42d&&_0x344f80['rule']){const _0x455d7e=apiRuleToYaml(_0x344f80[_0x2035d5(0x11c)]);_0xbe51f3[_0x2035d5(0x167)](_0x3210a7,_0x455d7e);const _0x3ff23b=async _0x300a25=>{const _0x35bab3=_0x2035d5,_0x292076=collectSegmentRefsFromRule(_0x300a25);for(const _0x33d4ae of _0x292076){if(!_0xbe51f3[_0x35bab3(0x106)](_0x33d4ae))try{const _0x42e51d=await fetchSegment(_0x26a93f,_0x162ba1,_0x33d4ae,_0x4af19e);if(_0x42e51d?.[_0x35bab3(0x11c)]){const _0x1e702b=apiRuleToYaml(_0x42e51d['rule']);_0xbe51f3[_0x35bab3(0x167)](_0x33d4ae,_0x1e702b),await _0x3ff23b(_0x1e702b);}}catch(_0x4ea614){logger[_0x35bab3(0x8a)](_0x35bab3(0xcb)+_0x33d4ae+':\x20'+_0x4ea614);}}};await _0x3ff23b(_0x455d7e);const _0x5f1403=serializeExpandedRule(_0x455d7e,_0xbe51f3),_0x4a35bd=_0x534b24['get'](_0x5f1403);if(_0x4a35bd&&_0x4a35bd[_0x2035d5(0x6e)]>0x0){const _0x528808=_0x2eb79b[_0x2035d5(0x78)](_0x5f1403)||0x0,_0x13521c=_0x4a35bd[_0x528808]||_0x4a35bd[_0x4a35bd[_0x2035d5(0x6e)]-0x1];_0x2eb79b[_0x2035d5(0x167)](_0x5f1403,_0x528808+0x1),_0x312bfb=_0x13521c,_0x16bea0[_0x2035d5(0x16f)](_0x312bfb),_0xe6c67b['set'](_0x3210a7,_0x312bfb);const _0x3c7ddf=await resolveRuleSegmentRefs(_0x455d7e,async _0x116bfe=>{const _0x287bc6=_0x2035d5,_0x548061=_0xe6c67b[_0x287bc6(0x78)](_0x116bfe);if(_0x548061)return _0x548061;const _0x414147=await _0x345c9c['resolveSegment'](_0x116bfe);return _0x414147[_0x287bc6(0xb9)];});_0x1f6ad1={'description':_0x344f80[_0x2035d5(0xdc)],'rule':_0x3c7ddf};}else{const _0x541b28=_0x2e1286[_0x2035d5(0x78)](_0x5f1403);if(_0x541b28)_0x312bfb=_0x541b28,_0xe6c67b[_0x2035d5(0x167)](_0x3210a7,_0x312bfb);else{if(_0x137322){let _0x4fb7ec=_0x137322,_0x11a232=0x2;while(_0x16bea0['has'](_0x4fb7ec)||_0x12c3df[_0x2035d5(0x106)](_0x4fb7ec)){_0x4fb7ec=_0x137322+'_'+_0x11a232,_0x11a232++;}_0x16bea0['add'](_0x4fb7ec),_0x312bfb=_0x4fb7ec;}_0xe6c67b[_0x2035d5(0x167)](_0x3210a7,_0x312bfb),_0x2e1286[_0x2035d5(0x167)](_0x5f1403,_0x312bfb);const _0x17ef86=await resolveRuleSegmentRefs(_0x455d7e,async _0x107d01=>{const _0x37f70f=_0x2035d5,_0x427a45=_0xe6c67b[_0x37f70f(0x78)](_0x107d01);if(_0x427a45)return _0x427a45;const _0x8d8c6f=await _0x345c9c['resolveSegment'](_0x107d01);return _0x8d8c6f[_0x37f70f(0xb9)];});_0x1f6ad1={'description':_0x344f80[_0x2035d5(0xdc)],'rule':_0x17ef86};}}}return{'name':_0x312bfb,'isJourneyLocal':_0x10a42d,'definition':_0x1f6ad1};}catch(_0x374c6d){return logger[_0x2035d5(0x8a)]('Failed\x20to\x20resolve\x20segment\x20'+_0x3210a7+':\x20'+_0x374c6d),{'name':_0x3210a7,'isJourneyLocal':![]};}},'resolveActivation':async _0x495f4d=>{const _0xdcfaab=a152_0x3c71,_0x5dbf5c=_0x4c234d[_0xdcfaab(0x78)](_0x495f4d);if(_0x5dbf5c!==undefined)return{'name':_0x5dbf5c,'isJourneyLocal':!![]};try{let _0x455c0f=_0x13abc5?.['get'](_0x495f4d);!_0x455c0f&&(_0x455c0f=await _0x26a93f[_0xdcfaab(0xb6)]['getActivation'](_0x21cf91,_0x495f4d));const _0x1513ab=_0x455c0f[_0xdcfaab(0xf1)][_0xdcfaab(0x154)]['name']||_0x495f4d,_0x68eb84=sanitizeYamlKey(_0x1513ab)||_0xdcfaab(0x72)+_0x495f4d,_0xd20f5=_0x68eb84;_0x4c234d[_0xdcfaab(0x167)](_0x495f4d,_0xd20f5);const _0x4e9ba0=journeyActivationStepToYaml(_0x455c0f,_0x51fb4d,_0x4c91a1);return{'name':_0xd20f5,'isJourneyLocal':!![],'definition':_0x4e9ba0};}catch(_0x39e20b){return logger[_0xdcfaab(0x8a)]('Failed\x20to\x20resolve\x20activation\x20'+_0x495f4d+':\x20'+_0x39e20b),{'name':_0x495f4d,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x149afa,_0x25d4bf)=>resolveJumpTarget(_0x149afa,_0x25d4bf,_0x4eba65,async _0x1eb787=>{const _0x247379=a152_0x3c71,_0x4be15b=_0x122966?.[_0x247379(0x78)](_0x1eb787);if(_0x4be15b)return _0x4be15b;return _0x26a93f[_0x247379(0xb6)]['getJourney'](_0x1eb787);})};return _0x345c9c=_0x8007ce,_0x8007ce;},_0x3cde28=async _0x4b6224=>{const _0x1ba448=a152_0x3c71,{collectSegmentIdsFromJourneyApi:_0x3ab9c2}=await import(_0x1ba448(0xc4)),{batchAsync:_0x5a47a8}=await import(_0x1ba448(0xa5)),_0x28dec4=new Set();for(const _0x4bf930 of _0x4b6224){let _0x19248a=_0x122966?.['get'](_0x4bf930);!_0x19248a&&(_0x19248a=await _0x26a93f[_0x1ba448(0xb6)][_0x1ba448(0x11b)](_0x4bf930));const _0x20a729=_0x3ab9c2(_0x19248a);for(const _0x1a4cd3 of _0x20a729){_0x28dec4[_0x1ba448(0x16f)](_0x1a4cd3);}}let _0x489843=Array['from'](_0x28dec4);while(_0x489843[_0x1ba448(0x6e)]>0x0){const _0x4c0d89=_0x489843[_0x1ba448(0x165)](_0x85ce8c=>!_0x366b7b[_0x1ba448(0x106)](_0x85ce8c));if(_0x4c0d89[_0x1ba448(0x6e)]===0x0)break;const _0x2ded08=await _0x5a47a8(_0x4c0d89,async _0x506984=>{const _0x203ead=_0x1ba448;_0x366b7b[_0x203ead(0x16f)](_0x506984);const _0x1e18f9=await fetchSegment(_0x26a93f,_0x162ba1,_0x506984,_0x4af19e);if(!_0x1e18f9)return null;return{'segmentId':_0x506984,'segment':_0x1e18f9};},0xa),_0x2fbae6=new Set();for(const _0x53b848 of _0x2ded08){if(!_0x53b848?.['segment']?.[_0x1ba448(0x11c)])continue;const _0x5330f5=apiRuleToYaml(_0x53b848[_0x1ba448(0xa2)][_0x1ba448(0x11c)]);_0xbe51f3[_0x1ba448(0x167)](_0x53b848['segmentId'],_0x5330f5);const _0x326973=collectSegmentRefsFromRule(_0x5330f5);for(const _0x8b4a7a of _0x326973){!_0x366b7b[_0x1ba448(0x106)](_0x8b4a7a)&&_0x2fbae6['add'](_0x8b4a7a);}}_0x489843=Array[_0x1ba448(0x11a)](_0x2fbae6);}};return{'createYamlContext':_0x54a6c2,'prefetchJourneySegments':_0x3cde28};}export async function executePushSegments(_0x4bb9cf,_0xfd48e2,_0x280bbc,_0x5d5fa2,_0x201a9e){const _0x29dce7=a152_0x240960,{segmentDefToCreateRequest:_0xf3d572,segmentDefToUpdateRequest:_0x1602db}=await import(_0x29dce7(0x7b)),_0x4c5de8=_0x280bbc[_0x29dce7(0x125)],_0x5c18cd=0x5,_0x52ebd2=async _0x16a468=>{const _0x137342=_0x29dce7,_0x15fc14=_0x16a468[_0x137342(0xd3)]?_0x4c5de8[_0x137342(0x78)](_0x16a468[_0x137342(0xd3)]):undefined;let _0x21a516;const _0x5a4107={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x3458b9=_0x16a468[_0x137342(0xa8)];if(_0x16a468[_0x137342(0xa8)][_0x137342(0x11c)]){const _0x48d88=createSegmentIdResolver(_0x280bbc['segmentNameToId'],_0x16a468[_0x137342(0xa8)][_0x137342(0xb9)]),_0x5d887d=await resolveRuleSegmentIds(_0x16a468[_0x137342(0xa8)][_0x137342(0x11c)],_0x48d88);_0x3458b9={..._0x16a468[_0x137342(0xa8)],'rule':_0x5d887d};}try{if(_0x16a468[_0x137342(0x8d)]){_0x201a9e[_0x137342(0x127)]?.({'type':_0x137342(0x77),'name':_0x16a468[_0x137342(0xa8)]['name']});const _0x232adc=_0xf3d572(_0x3458b9,_0x15fc14),_0x56830a=await _0x201a9e[_0x137342(0xbe)](_0x137342(0xac)+_0x16a468[_0x137342(0xa8)][_0x137342(0xb9)]+'\x27...',()=>_0x4bb9cf[_0x137342(0xa2)][_0x137342(0x138)](_0x5d5fa2[_0x137342(0x12c)],_0x232adc));_0x21a516=_0x56830a['data']['id'],_0x280bbc[_0x137342(0x156)][_0x137342(0x167)](_0x16a468[_0x137342(0xa8)][_0x137342(0xb9)],_0x21a516),_0x5a4107[_0x137342(0x92)]={'name':_0x16a468['yamlConfig'][_0x137342(0xb9)],'id':_0x21a516},_0x201a9e[_0x137342(0x127)]?.({'type':_0x137342(0xd2),'name':_0x16a468['yamlConfig'][_0x137342(0xb9)],'segmentId':_0x21a516}),_0x201a9e[_0x137342(0x8c)]?.(_0x137342(0x7e)+_0x16a468[_0x137342(0xa8)]['name']+'\x27'),_0x5a4107['created']=0x1;}else{if(_0x16a468[_0x137342(0x76)]){_0x201a9e['onProgress']?.({'type':_0x137342(0xbc),'name':_0x16a468['yamlConfig'][_0x137342(0xb9)]});const _0x52809f=_0x1602db(_0x3458b9);_0x15fc14!==_0x16a468[_0x137342(0x12a)]?.[_0x137342(0x174)]&&(_0x52809f[_0x137342(0x174)]=_0x15fc14?parseInt(_0x15fc14,0xa):undefined),await _0x201a9e[_0x137342(0xbe)](_0x137342(0x74)+_0x16a468[_0x137342(0xa8)]['name']+_0x137342(0xe3),()=>_0x4bb9cf['segment']['updateSegmentById'](_0x5d5fa2['parentId'],_0x16a468[_0x137342(0x12a)]['id'],_0x52809f)),_0x21a516=_0x16a468[_0x137342(0x12a)]['id'],_0x201a9e[_0x137342(0x127)]?.({'type':_0x137342(0x9f),'name':_0x16a468['yamlConfig'][_0x137342(0xb9)]}),_0x201a9e['logSuccess']?.(_0x137342(0x158)+_0x16a468['yamlConfig'][_0x137342(0xb9)]+'\x27'),_0x5a4107['updated']=0x1;}else _0x21a516=_0x16a468['existingSegment']['id'];}}catch(_0x4a5e18){const _0x15479d=isHttp400Error(_0x4a5e18),_0x173561=_0x15479d?ErrorCode['SEGMENT_SYNTAX_ERROR']:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x5e4c67=getErrorMessage(_0x4a5e18);throw new SDKError(_0x173561,_0x137342(0x9e)+(_0x16a468[_0x137342(0x8d)]?'create':'update')+_0x137342(0xa0)+_0x16a468[_0x137342(0xe1)]+_0x137342(0x128)+_0x5e4c67,_0x4a5e18);}try{const _0x3a230e=await syncActivationsForSegment(_0x4bb9cf,_0x5d5fa2[_0x137342(0x12c)],_0x21a516,_0x16a468[_0x137342(0xa8)][_0x137342(0xb9)],_0x16a468[_0x137342(0x8e)],_0x201a9e,_0x16a468[_0x137342(0xe1)]);_0x5a4107[_0x137342(0x164)]=_0x3a230e;}catch(_0x1ba9d9){if(_0x1ba9d9 instanceof SDKError)throw _0x1ba9d9;throw new SDKError(ErrorCode[_0x137342(0xb1)],_0x137342(0x6f)+_0x16a468['yamlConfig'][_0x137342(0xb9)]+'\x27\x20from\x20file:\x20'+_0x16a468['absolutePath']+'\x0a\x20\x20'+getErrorMessage(_0x1ba9d9),_0x1ba9d9);}return _0x5a4107;},_0x545dda=await batchAsync(_0xfd48e2,_0x52ebd2,_0x5c18cd),_0x124095={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0xd055ba of _0x545dda){_0x124095[_0x29dce7(0x111)]+=_0xd055ba[_0x29dce7(0x111)],_0x124095['updated']+=_0xd055ba['updated'],_0xd055ba[_0x29dce7(0x92)]&&_0x124095[_0x29dce7(0xe9)][_0x29dce7(0x167)](_0xd055ba[_0x29dce7(0x92)][_0x29dce7(0xb9)],_0xd055ba[_0x29dce7(0x92)]['id']),_0x124095[_0x29dce7(0x164)][_0x29dce7(0x111)]+=_0xd055ba[_0x29dce7(0x164)][_0x29dce7(0x111)],_0x124095[_0x29dce7(0x164)][_0x29dce7(0xb7)]+=_0xd055ba['activations'][_0x29dce7(0xb7)],_0x124095['activations'][_0x29dce7(0x123)]+=_0xd055ba[_0x29dce7(0x164)][_0x29dce7(0x123)];}return _0x124095;}async function syncActivationsForSegment(_0x2bc682,_0x2e2d4e,_0x17221b,_0x5643ac,_0x30ef99,_0x4d7638,_0x7086fb){const _0x2049d0=a152_0x240960,_0x51b43f={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x932677 of _0x30ef99){try{if(_0x932677['type']===_0x2049d0(0x159)&&_0x932677[_0x2049d0(0x70)])_0x4d7638['onProgress']?.({'type':_0x2049d0(0x116),'segmentName':_0x5643ac,'activationName':_0x932677[_0x2049d0(0xb9)]}),await _0x4d7638[_0x2049d0(0xbe)](_0x2049d0(0x10d)+_0x932677[_0x2049d0(0xb9)]+_0x2049d0(0xe3),()=>_0x2bc682[_0x2049d0(0xa2)][_0x2049d0(0xda)](_0x2e2d4e,_0x17221b,_0x932677[_0x2049d0(0x70)])),_0x4d7638['onProgress']?.({'type':_0x2049d0(0x91),'segmentName':_0x5643ac,'activationName':_0x932677[_0x2049d0(0xb9)]}),_0x4d7638[_0x2049d0(0x8c)]?.(_0x2049d0(0x10a)+_0x932677['name']+'\x27'),_0x51b43f['created']++;else{if(_0x932677['type']==='update'&&_0x932677[_0x2049d0(0x70)]&&_0x932677[_0x2049d0(0x15d)])_0x4d7638[_0x2049d0(0x127)]?.({'type':_0x2049d0(0xee),'segmentName':_0x5643ac,'activationName':_0x932677[_0x2049d0(0xb9)]}),await _0x4d7638[_0x2049d0(0xbe)](_0x2049d0(0xef)+_0x932677[_0x2049d0(0xb9)]+_0x2049d0(0xe3),()=>_0x2bc682[_0x2049d0(0xa2)][_0x2049d0(0xc7)](_0x2e2d4e,_0x17221b,_0x932677[_0x2049d0(0x15d)]['id'],_0x932677['validatedRequest'])),_0x4d7638[_0x2049d0(0x127)]?.({'type':_0x2049d0(0xa7),'segmentName':_0x5643ac,'activationName':_0x932677[_0x2049d0(0xb9)]}),_0x4d7638[_0x2049d0(0x8c)]?.(_0x2049d0(0x132)+_0x932677['name']+'\x27'),_0x51b43f[_0x2049d0(0xb7)]++;else _0x932677[_0x2049d0(0xd4)]===_0x2049d0(0xb8)&&_0x932677[_0x2049d0(0x15d)]&&(_0x4d7638[_0x2049d0(0x127)]?.({'type':_0x2049d0(0x150),'segmentName':_0x5643ac,'activationName':_0x932677[_0x2049d0(0xb9)]}),await _0x4d7638['withProgress'](_0x2049d0(0xfc)+_0x932677[_0x2049d0(0xb9)]+'\x27...',()=>_0x2bc682[_0x2049d0(0xa2)]['deleteActivation'](_0x2e2d4e,_0x17221b,_0x932677[_0x2049d0(0x15d)]['id'])),_0x4d7638[_0x2049d0(0x127)]?.({'type':_0x2049d0(0x6d),'segmentName':_0x5643ac,'activationName':_0x932677[_0x2049d0(0xb9)]}),_0x4d7638['logDeleted']?.(_0x2049d0(0x10f)+_0x932677[_0x2049d0(0xb9)]+'\x27'),_0x51b43f[_0x2049d0(0x123)]++);}}catch(_0xf3f401){const _0x47e064=isHttp400Error(_0xf3f401),_0x41e933=_0x47e064?ErrorCode[_0x2049d0(0xf3)]:ErrorCode[_0x2049d0(0xb1)],_0x44cda9=getErrorMessage(_0xf3f401);throw new SDKError(_0x41e933,'Failed\x20to\x20'+_0x932677[_0x2049d0(0xd4)]+'\x20activation\x20\x27'+_0x932677['name']+_0x2049d0(0x14a)+_0x7086fb+_0x2049d0(0x128)+_0x44cda9,_0xf3f401);}}return _0x51b43f;}export async function executePushFolders(_0x34deae,_0x194b58,_0xab7390,_0x1da06f,_0x23c9e5){const _0x50d27a=a152_0x240960,_0x707a88=new Map(_0xab7390),_0x213023=sortFoldersByDepth(_0x194b58);for(const _0x3ca226 of _0x213023){const _0x9a093=_0x3ca226['split']('/'),_0x3fae73=_0x9a093[_0x9a093[_0x50d27a(0x6e)]-0x1],_0x437d76=_0x9a093['slice'](0x0,-0x1)[_0x50d27a(0x16e)]('/'),_0x4eb720=_0x707a88[_0x50d27a(0x78)](_0x437d76);_0x23c9e5[_0x50d27a(0x127)]?.({'type':_0x50d27a(0x120),'folder':_0x3ca226});const _0x4ced6b={'name':_0x3fae73,'parentFolderId':_0x4eb720},_0x334a40=await _0x23c9e5[_0x50d27a(0xbe)](_0x50d27a(0xad)+_0x3ca226+'\x27...',()=>_0x34deae[_0x50d27a(0xa2)][_0x50d27a(0x94)](_0x1da06f['parentId'],_0x4ced6b));_0x707a88[_0x50d27a(0x167)](_0x3ca226,_0x334a40[_0x50d27a(0xe2)]['id']),_0x23c9e5[_0x50d27a(0x127)]?.({'type':_0x50d27a(0x8b),'folder':_0x3ca226,'folderId':_0x334a40[_0x50d27a(0xe2)]['id']}),_0x23c9e5[_0x50d27a(0x113)]?.(_0x50d27a(0xf7)+_0x3ca226+'\x27');}return _0x707a88;}export async function executePushSegmentDeletions(_0x1927c4,_0x1c36e9,_0x3af0ca){const _0x2d0009=a152_0x240960;if(_0x1c36e9[_0x2d0009(0x6e)]===0x0)return 0x0;const {batchAsync:_0x39ba24}=await import('../../utils/async.js'),_0x3185e6=0x5,_0x5ec139=await _0x39ba24(_0x1c36e9,async _0x2c088a=>{const _0x432b95=_0x2d0009;return _0x3af0ca[_0x432b95(0x127)]?.({'type':'segment_deleting','name':_0x2c088a['name']}),await _0x1927c4[_0x432b95(0xa2)]['deleteSegment'](_0x2c088a['id']),_0x3af0ca['onProgress']?.({'type':'segment_deleted','name':_0x2c088a[_0x432b95(0xb9)]}),_0x3af0ca[_0x432b95(0x84)]?.('Deleted\x20segment\x20\x27'+_0x2c088a['name']+'\x27'),0x1;},_0x3185e6);return _0x5ec139[_0x2d0009(0x168)]((_0x5e0ccc,_0x555d58)=>_0x5e0ccc+_0x555d58,0x0);}export async function executePushJourneys(_0x311cf3,_0x4cfc62,_0x495605,_0x5f4e27,_0x179891){const _0x17e856=a152_0x240960,{journeyDefToRequest:_0xdbd065}=await import(_0x17e856(0xc4)),{activationDefToCreateRequest:_0xf5f6e0,yamlRuleToApi:_0x3c5de7,validateSegmentRule:_0x165bed}=await import(_0x17e856(0x7b)),_0xdc9d3={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x235f6d=new Map(_0x495605['segmentNameToId']),_0x4c4ed0=0x5;for(let _0x289bbd=0x0;_0x289bbd<_0x4cfc62[_0x17e856(0x6e)];_0x289bbd+=_0x4c4ed0){const _0xd45477=_0x4cfc62['slice'](_0x289bbd,_0x289bbd+_0x4c4ed0),_0x5cc4b6=await Promise[_0x17e856(0xf9)](_0xd45477[_0x17e856(0xb0)](async _0x351bcd=>{const _0x5a8f58=_0x17e856;if(!_0x351bcd[_0x5a8f58(0x8d)]&&!_0x351bcd[_0x5a8f58(0x76)])return{'action':_0x5a8f58(0xfe),'name':_0x351bcd[_0x5a8f58(0xa8)]['name'],'journeyId':_0x351bcd[_0x5a8f58(0xd6)]?.['id']};const _0x19ec56=_0x351bcd[_0x5a8f58(0xd3)]?_0x495605['folderPathToId']['get'](_0x351bcd[_0x5a8f58(0xd3)]):undefined;_0x179891[_0x5a8f58(0x127)]?.({'type':_0x351bcd[_0x5a8f58(0x8d)]?_0x5a8f58(0x13d):_0x5a8f58(0x101),'name':_0x351bcd[_0x5a8f58(0xa8)]['name']});try{const _0x3053c4=await executeSingleJourneyPush(_0x311cf3,_0x351bcd,{..._0x495605,'segmentNameToId':_0x235f6d},{'parentId':_0x5f4e27[_0x5a8f58(0x12c)],'rootFolderId':_0x5f4e27[_0x5a8f58(0xde)],'folderId':_0x19ec56,'verbose':_0x5f4e27[_0x5a8f58(0x14c)]},_0x179891,{'journeyDefToRequest':_0xdbd065,'activationDefToCreateRequest':_0xf5f6e0,'yamlRuleToApi':_0x3c5de7,'validateSegmentRule':_0x165bed});for(const [_0x5268ce,_0x257b21]of _0x3053c4[_0x5a8f58(0x130)]){_0x235f6d[_0x5a8f58(0x167)](_0x5268ce,_0x257b21),_0xdc9d3['embeddedSegmentNameToId'][_0x5a8f58(0x167)](_0x5268ce,_0x257b21);}if(_0x3053c4[_0x5a8f58(0x157)]===_0x5a8f58(0x111))_0x179891['onProgress']?.({'type':_0x5a8f58(0xd8),'name':_0x351bcd['yamlConfig'][_0x5a8f58(0xb9)],'journeyId':_0x3053c4['journeyId']}),_0x179891[_0x5a8f58(0x8c)]?.(_0x5a8f58(0xab)+_0x351bcd['yamlConfig'][_0x5a8f58(0xb9)]+'\x27'),_0xdc9d3[_0x5a8f58(0x111)]++;else _0x3053c4['action']===_0x5a8f58(0xb7)&&(_0x179891[_0x5a8f58(0x127)]?.({'type':_0x5a8f58(0xcc),'name':_0x351bcd[_0x5a8f58(0xa8)]['name']}),_0x179891[_0x5a8f58(0x8c)]?.('Updated\x20journey\x20\x27'+_0x351bcd['yamlConfig']['name']+'\x27'),_0xdc9d3[_0x5a8f58(0xb7)]++);return{'action':_0x3053c4[_0x5a8f58(0x157)],'name':_0x351bcd[_0x5a8f58(0xa8)][_0x5a8f58(0xb9)],'journeyId':_0x3053c4['journeyId']};}catch(_0x2be77c){const _0x18111e=isHttp400Error(_0x2be77c),_0x2cffd7=_0x18111e?ErrorCode[_0x5a8f58(0x85)]:ErrorCode['JOURNEY_UPDATE_ERROR'],_0x43b10b=getErrorMessage(_0x2be77c);throw new SDKError(_0x2cffd7,'Failed\x20to\x20'+(_0x351bcd[_0x5a8f58(0x8d)]?_0x5a8f58(0x159):_0x5a8f58(0xba))+_0x5a8f58(0x124)+_0x351bcd[_0x5a8f58(0xe1)]+_0x5a8f58(0x128)+_0x43b10b,_0x2be77c);}}));_0xdc9d3[_0x17e856(0xfb)][_0x17e856(0x7f)](..._0x5cc4b6);}return _0xdc9d3;}async function matchExistingJourneySegments(_0x433840,_0x6bbb40,_0x4fc9aa,_0x5bb12b,_0x22c14a){const _0x4a7ecb=a152_0x240960;if(!_0x6bbb40[_0x4a7ecb(0xd6)]||!_0x6bbb40[_0x4a7ecb(0xa8)][_0x4a7ecb(0xd1)])return;const _0x202986=new Map(),_0x14a7f9=new Set();for(const _0x15cf82 of Object[_0x4a7ecb(0x155)](_0x6bbb40[_0x4a7ecb(0xa8)][_0x4a7ecb(0xd1)])){const _0x4ac5e9=generateDeterministicJourneySegmentName(_0x6bbb40[_0x4a7ecb(0xa8)][_0x4a7ecb(0xb9)],_0x15cf82);_0x202986['set'](_0x4ac5e9,_0x15cf82),_0x14a7f9[_0x4a7ecb(0x16f)](_0x15cf82);}const _0x2d3bac=[],_0x2d643d=collectSegmentIdsFromJourneyApi(_0x6bbb40[_0x4a7ecb(0xd6)]);for(const _0x416078 of _0x2d643d){const _0x424c52=await fetchSegment(_0x433840,_0x4fc9aa,_0x416078,_0x5bb12b);if(!_0x424c52?.[_0x4a7ecb(0xb9)])continue;const _0x17b5f1=_0x202986[_0x4a7ecb(0x78)](_0x424c52[_0x4a7ecb(0xb9)]);_0x17b5f1?(_0x22c14a['set'](_0x17b5f1,_0x416078),_0x14a7f9['delete'](_0x17b5f1)):_0x2d3bac[_0x4a7ecb(0x7f)]({'id':_0x416078,'seg':_0x424c52});}if(_0x14a7f9[_0x4a7ecb(0x149)]>0x0&&_0x2d3bac[_0x4a7ecb(0x6e)]>0x0){const {localExpandedRuleToNames:_0x4dcd28}=buildLocalExpandedRuleMappings(_0x6bbb40['yamlConfig']),_0x4cd489=new Map();for(const {id:_0x222216,seg:_0x3d09d8}of _0x2d3bac){if(_0x3d09d8[_0x4a7ecb(0x11c)]){const _0x422b08=apiRuleToYaml(_0x3d09d8[_0x4a7ecb(0x11c)]);_0x4cd489[_0x4a7ecb(0x167)](_0x222216,_0x422b08);}}for(const {id:_0x2e3d53,seg:_0x34e9a4}of _0x2d3bac){if(!_0x34e9a4[_0x4a7ecb(0x11c)])continue;const _0x4f50d9=_0x4cd489[_0x4a7ecb(0x78)](_0x2e3d53);if(!_0x4f50d9)continue;const _0x3a4ff1=serializeExpandedRule(_0x4f50d9,_0x4cd489),_0x51e71e=_0x4dcd28[_0x4a7ecb(0x78)](_0x3a4ff1);if(_0x51e71e){const _0x294134=_0x51e71e[_0x4a7ecb(0x10c)](_0xfd283a=>_0x14a7f9['has'](_0xfd283a));_0x294134&&(_0x22c14a[_0x4a7ecb(0x167)](_0x294134,_0x2e3d53),_0x14a7f9[_0x4a7ecb(0xb8)](_0x294134),logger[_0x4a7ecb(0x8a)](_0x4a7ecb(0x75)+_0x34e9a4[_0x4a7ecb(0xb9)]+_0x4a7ecb(0x13c)+_0x294134+_0x4a7ecb(0x112)));}}}}async function executeSingleJourneyPush(_0x112401,_0x166f6f,_0x29ccec,_0x44902f,_0x5b7d6f,_0x54e1ac){const _0x584f16=a152_0x240960,{journeyDefToRequest:_0x546c61,activationDefToCreateRequest:_0xa6aa07,yamlRuleToApi:_0xb8d544,validateSegmentRule:_0x528da5}=_0x54e1ac,_0x29f1ab=new Map(),_0x39413f=new Map();recoverSegmentIdsFromPushRecovery(_0x166f6f,_0x29f1ab,_0x29ccec[_0x584f16(0x156)]);const _0x495ab1=new Map(),_0x4cdbe8=new Map(),_0x431437=new Map();let _0x1b2134;const _0x5b7d93=async()=>{const _0xe143a9=_0x584f16;if(_0x1b2134)return;_0x1b2134=new Map();if(!_0x166f6f[_0xe143a9(0xd6)])return;const _0x3b2424=await _0x112401[_0xe143a9(0xb6)][_0xe143a9(0x15f)](_0x166f6f['existingJourney']['id']);for(const _0x42622b of _0x3b2424){const _0x2c01e2=journeyActivationStepToYaml(_0x42622b,_0x29ccec[_0xe143a9(0x115)],_0x29ccec['connectionIdToNameMap']),_0x5bd2e9=activationSignature(_0x2c01e2);!_0x1b2134['has'](_0x5bd2e9)&&_0x1b2134['set'](_0x5bd2e9,_0x42622b['id']),_0x2c01e2['name']&&_0x39413f[_0xe143a9(0x167)](_0x2c01e2['name'],_0x42622b['id']);}};await matchExistingJourneySegments(_0x112401,_0x166f6f,_0x44902f[_0x584f16(0x12c)],_0x29ccec[_0x584f16(0xae)],_0x29ccec[_0x584f16(0x156)]);const _0x55ec49={'resolveSegmentId':async _0x5714c7=>{const _0x5c5253=_0x584f16,_0x57feb7=_0x29ccec['segmentNameToId'][_0x5c5253(0x78)](_0x5714c7);if(!_0x57feb7)throw new SDKError(ErrorCode[_0x5c5253(0xb5)],_0x5c5253(0x10e)+_0x5714c7+_0x5c5253(0x9c)+_0x166f6f[_0x5c5253(0xa8)]['name']+')');return _0x57feb7;},'resolveEmbeddedSegmentId':async(_0x25d487,_0x23370a)=>{const _0x5d7c77=_0x584f16,_0x54c184=_0x29ccec['segmentNameToId'][_0x5d7c77(0x78)](_0x25d487);if(_0x54c184)return _0x54c184;const _0x3b2893=_0x29ccec['existingSegments'][_0x5d7c77(0x10c)](_0x5aa369=>_0x5aa369[_0x5d7c77(0xb9)]===_0x25d487);if(_0x3b2893)return _0x29ccec[_0x5d7c77(0x156)][_0x5d7c77(0x167)](_0x25d487,_0x3b2893['id']),_0x3b2893['id'];if(_0x166f6f[_0x5d7c77(0x8d)]){const {stageName:_0x2c333c,criteriaName:_0x333b17}=findSegmentCriteriaLocation(_0x166f6f[_0x5d7c77(0xa8)],_0x25d487);return _0x528da5(_0x25d487,_0x23370a[_0x5d7c77(0x11c)]),_0x4cdbe8[_0x5d7c77(0x167)](_0x25d487,{'definition':_0x23370a,'stageName':_0x2c333c,'criteriaName':_0x333b17}),createPendingSegmentId(_0x25d487);}const _0x3798c7=_0x166f6f['existingJourney']?.['id'];if(!_0x3798c7)throw new SDKError(ErrorCode[_0x5d7c77(0x96)],'Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID');const _0x16331b=_0x495ab1[_0x5d7c77(0x78)](_0x25d487);if(_0x16331b)return _0x16331b;const _0x5b0136=((async()=>{const _0x438c3f=_0x5d7c77;_0x528da5(_0x25d487,_0x23370a[_0x438c3f(0x11c)]);const _0x44f163=generateDeterministicJourneySegmentName(_0x166f6f[_0x438c3f(0xa8)][_0x438c3f(0xb9)],_0x25d487),_0x2a88b2=_0x29ccec['existingSegments']['find'](_0x4183d1=>_0x4183d1[_0x438c3f(0xb9)]===_0x44f163),_0xf2cd63=createSegmentIdResolver(_0x29ccec[_0x438c3f(0x156)],_0x25d487),_0x5f9840=await resolveRuleSegmentIds(_0x23370a['rule'],_0xf2cd63);let _0x4b5b0a;return _0x2a88b2?(await _0x112401[_0x438c3f(0xa2)][_0x438c3f(0x129)](_0x44902f[_0x438c3f(0x12c)],_0x2a88b2['id'],{'description':_0x23370a['description']||'Entry\x20criteria:\x20'+_0x25d487,'rule':_0xb8d544(_0x5f9840),'countPopulation':!![]}),_0x4b5b0a=_0x2a88b2['id'],saveSegmentToPushRecovery(_0x166f6f['absolutePath'],_0x166f6f['yamlConfig'][_0x438c3f(0xb9)],_0x25d487,{'segmentId':_0x4b5b0a,'uniqueServerName':_0x44f163,'createdAt':new Date()[_0x438c3f(0xcd)]()})):_0x4b5b0a=await createOrRecoverEmbeddedSegment(_0x112401,_0x166f6f,{'localName':_0x25d487,'uniqueSegmentName':_0x44f163,'description':_0x23370a[_0x438c3f(0xdc)]||'Entry\x20criteria:\x20'+_0x25d487,'journeyId':_0x3798c7,'resolvedRule':_0x5f9840,'parentId':_0x44902f[_0x438c3f(0x12c)],'folderId':_0x44902f[_0x438c3f(0xde)]||''},_0xb8d544),_0x29ccec[_0x438c3f(0x156)][_0x438c3f(0x167)](_0x25d487,_0x4b5b0a),_0x29f1ab['set'](_0x25d487,_0x4b5b0a),_0x4b5b0a;})());_0x495ab1['set'](_0x25d487,_0x5b0136);try{return await _0x5b0136;}finally{_0x495ab1[_0x5d7c77(0xb8)](_0x25d487);}},'resolveActivationId':async _0x1757ab=>{const _0x24ac9c=_0x584f16,_0xa802b3=_0x39413f[_0x24ac9c(0x78)](_0x1757ab);if(_0xa802b3)return _0xa802b3;if(_0x166f6f[_0x24ac9c(0xd6)]){await _0x5b7d93();const _0x173b18=_0x39413f[_0x24ac9c(0x78)](_0x1757ab);if(_0x173b18)return _0x173b18;}throw new SDKError(ErrorCode[_0x24ac9c(0x80)],_0x24ac9c(0x7a)+_0x1757ab+_0x24ac9c(0x9c)+_0x166f6f[_0x24ac9c(0xa8)][_0x24ac9c(0xb9)]+').\x20'+_0x24ac9c(0x9b));},'resolveEmbeddedActivationId':async(_0x276659,_0x1b930e)=>{const _0x16c694=_0x584f16,_0x348683=_0x39413f[_0x16c694(0x78)](_0x276659);if(_0x348683)return _0x348683;if(_0x166f6f[_0x16c694(0x8d)])return _0x431437[_0x16c694(0x167)](_0x276659,_0x1b930e),createPendingActivationId(_0x276659);if(_0x166f6f[_0x16c694(0xd6)]){await _0x5b7d93();const _0x3fe780=_0x39413f[_0x16c694(0x78)](_0x1b930e['name']);if(_0x3fe780)return _0x39413f[_0x16c694(0x167)](_0x276659,_0x3fe780),_0x3fe780;const _0x36240f=activationSignature(_0x1b930e),_0x4ba216=_0x1b2134?.[_0x16c694(0x78)](_0x36240f);if(_0x4ba216)return _0x39413f[_0x16c694(0x167)](_0x276659,_0x4ba216),_0x4ba216;const _0x275b3c=await _0xa6aa07(_0x1b930e,_0x29ccec['activationContext']),_0x14af25={..._0x275b3c,..._0x1b930e['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x1b930e['run_after_journey_refresh']}},_0x59c551=await _0x112401[_0x16c694(0xb6)]['createActivation'](_0x166f6f['existingJourney']['id'],_0x14af25);return _0x39413f['set'](_0x276659,_0x59c551['id']),_0x59c551['id'];}throw new SDKError(ErrorCode[_0x16c694(0x96)],_0x16c694(0x79));},'resolveJourneyId':async _0xe52051=>{const _0x4f6f62=_0x584f16;try{return await _0x112401['journey']['resolveJourneyId'](_0x44902f[_0x4f6f62(0x12c)],_0xe52051);}catch(_0x1c9bf5){throw new SDKError(ErrorCode['NOT_FOUND'],_0x4f6f62(0x161)+_0xe52051+_0x4f6f62(0xce)+_0x166f6f['yamlConfig']['name']+'\x27)',_0x1c9bf5);}},'resolveStageId':async(_0x5c87e7,_0x92e980)=>{const _0x2606bd=_0x584f16,_0x34c76e=await _0x112401[_0x2606bd(0xb6)][_0x2606bd(0x11b)](_0x5c87e7),_0x16adc3=_0x34c76e[_0x2606bd(0xf1)][_0x2606bd(0x131)]['find'](_0x1eacc2=>_0x1eacc2[_0x2606bd(0xb9)][_0x2606bd(0x102)]()===_0x92e980[_0x2606bd(0x102)]());if(!_0x16adc3?.['id'])throw new SDKError(ErrorCode[_0x2606bd(0x80)],'Stage\x20\x27'+_0x92e980+_0x2606bd(0x105)+(_0x34c76e[_0x2606bd(0xf1)][_0x2606bd(0x12d)]||_0x34c76e[_0x2606bd(0xf1)][_0x2606bd(0xb9)])+'\x27');return _0x16adc3['id'];}},_0x665ef0=await _0x546c61(_0x166f6f[_0x584f16(0xa8)],_0x44902f[_0x584f16(0x12c)],_0x55ec49),_0x196ac7=_0x44902f[_0x584f16(0x16b)]||_0x44902f[_0x584f16(0xde)];_0x196ac7&&(_0x665ef0[_0x584f16(0xcf)]={'parentFolder':{'data':{'id':_0x196ac7,'type':_0x584f16(0x147)}}});if(_0x166f6f[_0x584f16(0x8d)]){if(_0x4cdbe8[_0x584f16(0x149)]>0x0||_0x431437['size']>0x0)return await executeThreeStepJourneyCreate(_0x112401,_0x166f6f,_0x665ef0,{'pendingEmbeddedSegments':_0x4cdbe8,'pendingEmbeddedActivations':_0x431437,'embeddedSegmentNameToId':_0x29f1ab,'journeyActivationNameToId':_0x39413f},{..._0x44902f,'effectiveFolderId':_0x196ac7},_0x29ccec,_0x5b7d6f,_0x54e1ac);else{ensureJourneyDefaults(_0x665ef0[_0x584f16(0xf1)]);const _0x2722b7=await _0x112401['journey']['create'](_0x665ef0);return deletePushRecovery(_0x166f6f[_0x584f16(0xe1)]),{'action':'created','journeyId':_0x2722b7['id'],'embeddedSegmentNameToId':_0x29f1ab};}}else{if(_0x166f6f['hasChanges']&&_0x166f6f[_0x584f16(0xd6)]){_0x665ef0['id']=_0x166f6f[_0x584f16(0xd6)]['id'];const _0xbef662=_0x665ef0[_0x584f16(0xf1)];_0x166f6f[_0x584f16(0xd6)][_0x584f16(0xf1)]?.[_0x584f16(0x12d)]&&(_0xbef662[_0x584f16(0x12d)]=_0x166f6f[_0x584f16(0xd6)][_0x584f16(0xf1)][_0x584f16(0x12d)]);const _0x447d06=_0x166f6f['existingJourney'][_0x584f16(0xf1)]?.['journeyStages'];return _0x447d06&&_0x665ef0[_0x584f16(0xf1)][_0x584f16(0x131)]&&injectExistingStageIds(_0x665ef0[_0x584f16(0xf1)][_0x584f16(0x131)],_0x447d06),ensureJourneyDefaults(_0xbef662),await _0x112401['journey'][_0x584f16(0xba)](_0x166f6f[_0x584f16(0xd6)]['id'],_0x665ef0),deletePushRecovery(_0x166f6f['absolutePath']),{'action':_0x584f16(0xb7),'journeyId':_0x166f6f['existingJourney']['id'],'embeddedSegmentNameToId':_0x29f1ab};}}return deletePushRecovery(_0x166f6f[_0x584f16(0xe1)]),{'action':_0x584f16(0xfe),'journeyId':_0x166f6f[_0x584f16(0xd6)]?.['id'],'embeddedSegmentNameToId':_0x29f1ab};}function findSegmentCriteriaLocation(_0x2772aa,_0x30a78e){const _0x5b2cf0=a152_0x240960,_0x3e38c4=_0x2772aa['stages']||_0x2772aa[_0x5b2cf0(0x16a)]?.[0x0]?.[_0x5b2cf0(0xbd)]||[];let _0x4e9303=_0x5b2cf0(0xe5),_0x17abe2=_0x30a78e;const _0x399cf1=_0x2772aa[_0x5b2cf0(0x88)]||_0x2772aa[_0x5b2cf0(0x16a)]?.[0x0]?.[_0x5b2cf0(0x88)];if(_0x399cf1?.[_0x5b2cf0(0xa2)]===_0x30a78e)return{'stageName':_0x5b2cf0(0x88),'criteriaName':_0x399cf1[_0x5b2cf0(0xb9)]||_0x30a78e};_0x182f8e:for(const _0x203ce3 of _0x3e38c4){if(_0x203ce3['entry_criteria']?.['segment']===_0x30a78e){_0x4e9303=_0x203ce3['name'],_0x17abe2=_0x203ce3[_0x5b2cf0(0x86)]['name']||_0x30a78e;break;}if(_0x203ce3[_0x5b2cf0(0x13a)])for(const _0xf3ca61 of _0x203ce3[_0x5b2cf0(0x13a)]){if(_0xf3ca61[_0x5b2cf0(0xd4)]===_0x5b2cf0(0x16d)&&_0xf3ca61[_0x5b2cf0(0xff)]?.[_0x5b2cf0(0xc1)])for(const _0x2c8273 of _0xf3ca61['with'][_0x5b2cf0(0xc1)]){if(_0x2c8273['segment']===_0x30a78e){_0x4e9303=_0x203ce3[_0x5b2cf0(0xb9)],_0x17abe2=_0x2c8273['name']||_0x30a78e;break _0x182f8e;}}}}return{'stageName':_0x4e9303,'criteriaName':_0x17abe2};}async function executeThreeStepJourneyCreate(_0x4e9c2c,_0x2fe185,_0x56001f,_0x20525c,_0x34e2e6,_0x45ea19,_0x365e7f,_0x2f55eb){const _0x4eb890=a152_0x240960,{activationDefToCreateRequest:_0x5852b6,yamlRuleToApi:_0x5375a5}=_0x2f55eb,{pendingEmbeddedSegments:_0x1a8c53,pendingEmbeddedActivations:_0x4769b7,embeddedSegmentNameToId:_0xd4b46f}=_0x20525c,_0x341a85=JSON[_0x4eb890(0xd5)](JSON[_0x4eb890(0x13b)](_0x56001f));ensureJourneyDefaults(_0x341a85[_0x4eb890(0xf1)]),stripPendingIds(_0x341a85);const _0x2bcb5c=await _0x4e9c2c[_0x4eb890(0xb6)][_0x4eb890(0x159)](_0x341a85),_0x5bcc4f=_0x2bcb5c['id'],_0x309e63=new Map();for(const _0x22961f of _0x2bcb5c[_0x4eb890(0xf1)][_0x4eb890(0x131)]){_0x309e63['set'](_0x22961f['name']['toLowerCase'](),_0x22961f['id']);}recoverSegmentIdsFromPushRecovery(_0x2fe185,_0xd4b46f,_0x45ea19[_0x4eb890(0x156)]);for(const [_0x903bf9,{definition:_0x45f76d}]of _0x1a8c53){if(_0xd4b46f['has'](_0x903bf9)){_0x365e7f[_0x4eb890(0x127)]?.({'type':_0x4eb890(0x9d),'journeyName':_0x2fe185[_0x4eb890(0xa8)][_0x4eb890(0xb9)],'segmentName':_0x903bf9});continue;}const _0x962cdd=generateDeterministicJourneySegmentName(_0x2fe185[_0x4eb890(0xa8)][_0x4eb890(0xb9)],_0x903bf9);_0x365e7f[_0x4eb890(0x127)]?.({'type':_0x4eb890(0x99),'journeyName':_0x2fe185[_0x4eb890(0xa8)][_0x4eb890(0xb9)],'segmentName':_0x903bf9});const _0x43dc22=createSegmentIdResolver(_0x45ea19[_0x4eb890(0x156)],_0x903bf9),_0x34bd18=await resolveRuleSegmentIds(_0x45f76d[_0x4eb890(0x11c)],_0x43dc22),_0x5a14f7=await createOrRecoverEmbeddedSegment(_0x4e9c2c,_0x2fe185,{'localName':_0x903bf9,'uniqueSegmentName':_0x962cdd,'description':_0x45f76d[_0x4eb890(0xdc)]||_0x4eb890(0x82)+_0x903bf9,'journeyId':_0x5bcc4f,'resolvedRule':_0x34bd18,'parentId':_0x34e2e6[_0x4eb890(0x12c)],'folderId':_0x34e2e6[_0x4eb890(0x14d)]||''},_0x5375a5);_0xd4b46f['set'](_0x903bf9,_0x5a14f7),_0x45ea19[_0x4eb890(0x156)][_0x4eb890(0x167)](_0x903bf9,_0x5a14f7),_0x365e7f[_0x4eb890(0x127)]?.({'type':_0x4eb890(0x9d),'journeyName':_0x2fe185[_0x4eb890(0xa8)][_0x4eb890(0xb9)],'segmentName':_0x903bf9});}const _0x31bc57=new Map();for(const [_0x37b282,_0x2b64c0]of _0x4769b7){_0x365e7f[_0x4eb890(0x127)]?.({'type':_0x4eb890(0xd9),'journeyName':_0x2fe185[_0x4eb890(0xa8)]['name'],'activationName':_0x37b282});const _0x346067=await _0x5852b6(_0x2b64c0,_0x45ea19[_0x4eb890(0x73)]),_0x49f149={..._0x346067,..._0x2b64c0[_0x4eb890(0xfd)]!==undefined&&{'runAfterJourneyRefresh':_0x2b64c0[_0x4eb890(0xfd)]}},_0x939c8c=await _0x4e9c2c[_0x4eb890(0xb6)][_0x4eb890(0xda)](_0x5bcc4f,_0x49f149);_0x31bc57[_0x4eb890(0x167)](_0x37b282,_0x939c8c['id']),_0x20525c[_0x4eb890(0xc5)][_0x4eb890(0x167)](_0x37b282,_0x939c8c['id']),_0x365e7f[_0x4eb890(0x127)]?.({'type':_0x4eb890(0x11e),'journeyName':_0x2fe185[_0x4eb890(0xa8)][_0x4eb890(0xb9)],'activationName':_0x37b282});}const _0x37ad37=JSON[_0x4eb890(0xd5)](JSON[_0x4eb890(0x13b)](_0x56001f));return _0x37ad37['id']=_0x5bcc4f,ensureJourneyDefaults(_0x37ad37[_0x4eb890(0xf1)]),resolvePendingIdsInRequest(_0x37ad37,_0x56001f,_0x309e63,_0xd4b46f,_0x31bc57,_0x365e7f),await _0x4e9c2c[_0x4eb890(0xb6)][_0x4eb890(0xba)](_0x5bcc4f,_0x37ad37),deletePushRecovery(_0x2fe185[_0x4eb890(0xe1)]),{'action':_0x4eb890(0x111),'journeyId':_0x5bcc4f,'embeddedSegmentNameToId':_0xd4b46f};}export function stripWaitStepPendingIds(_0xa20c1e){const _0x44c6d5=a152_0x240960,_0x55be74=_0xa20c1e['conditionSegmentId']&&isPendingSegmentId(_0xa20c1e[_0x44c6d5(0xf4)]),_0x178e12=_0xa20c1e['conditions']?.[_0x44c6d5(0xd0)](_0x42f111=>_0x42f111[_0x44c6d5(0xe7)]&&isPendingSegmentId(_0x42f111[_0x44c6d5(0xe7)]));(_0x55be74||_0x178e12)&&(_0xa20c1e['waitStepType']=_0x44c6d5(0xf5),_0xa20c1e[_0x44c6d5(0x14e)]=0x1,_0xa20c1e[_0x44c6d5(0x95)]=_0x44c6d5(0x104),delete _0xa20c1e[_0x44c6d5(0xf4)],delete _0xa20c1e[_0x44c6d5(0x136)],delete _0xa20c1e[_0x44c6d5(0x177)],delete _0xa20c1e['conditions']);}export function resolveWaitStepPendingIds(_0x1afc55,_0x46ccc2,_0x3999e0,_0x10deb2){const _0x3c3561=a152_0x240960;if(_0x46ccc2[_0x3c3561(0xf4)]&&isPendingSegmentId(_0x46ccc2['conditionSegmentId'])){const _0x1adf23=_0x3999e0(_0x46ccc2[_0x3c3561(0xf4)],_0x3c3561(0x126)+_0x10deb2+_0x3c3561(0xea));_0x1adf23&&(_0x1afc55[_0x3c3561(0x175)]='Condition',_0x1afc55[_0x3c3561(0xf4)]=_0x1adf23,delete _0x1afc55[_0x3c3561(0x14e)],delete _0x1afc55[_0x3c3561(0x95)],_0x46ccc2[_0x3c3561(0x136)]!==undefined&&(_0x1afc55['conditionTimeoutDuration']=_0x46ccc2['conditionTimeoutDuration']),_0x46ccc2[_0x3c3561(0x177)]&&(_0x1afc55[_0x3c3561(0x177)]=_0x46ccc2[_0x3c3561(0x177)]));}if(_0x46ccc2[_0x3c3561(0xfa)]){const _0x49030a=_0x46ccc2[_0x3c3561(0xfa)]['some'](_0x75fe0c=>_0x75fe0c['segmentId']&&isPendingSegmentId(_0x75fe0c[_0x3c3561(0xe7)]));if(_0x49030a){const _0x2a6a3d=_0x46ccc2[_0x3c3561(0xfa)][_0x3c3561(0xb0)](_0x55936c=>{const _0x174eee=_0x3c3561;if(_0x55936c['segmentId']&&isPendingSegmentId(_0x55936c['segmentId'])){const _0x47dec7=_0x3999e0(_0x55936c[_0x174eee(0xe7)],_0x174eee(0x126)+_0x10deb2+_0x174eee(0xea));return{..._0x55936c,'segmentId':_0x47dec7||_0x55936c[_0x174eee(0xe7)]};}return{..._0x55936c};});_0x1afc55[_0x3c3561(0x175)]=_0x3c3561(0x121),_0x1afc55[_0x3c3561(0xfa)]=_0x2a6a3d,delete _0x1afc55['waitStep'],delete _0x1afc55[_0x3c3561(0x95)],delete _0x1afc55[_0x3c3561(0xf4)],delete _0x1afc55['conditionTimeoutDuration'],delete _0x1afc55[_0x3c3561(0x177)];}}}function stripPendingIds(_0x1082b3){const _0x5e108b=a152_0x240960;_0x1082b3['attributes']['goal']?.[_0x5e108b(0xe7)]&&isPendingSegmentId(_0x1082b3[_0x5e108b(0xf1)][_0x5e108b(0x88)]['segmentId'])&&delete _0x1082b3['attributes'][_0x5e108b(0x88)];for(const _0xe1809c of _0x1082b3[_0x5e108b(0xf1)]['journeyStages']||[]){_0xe1809c[_0x5e108b(0xc3)]?.[_0x5e108b(0xe7)]&&isPendingSegmentId(_0xe1809c[_0x5e108b(0xc3)][_0x5e108b(0xe7)])&&delete _0xe1809c[_0x5e108b(0xc3)];_0xe1809c[_0x5e108b(0xb3)]?.[_0x5e108b(0xe7)]&&isPendingSegmentId(_0xe1809c['milestone'][_0x5e108b(0xe7)])&&delete _0xe1809c['milestone'];_0xe1809c[_0x5e108b(0xe4)]&&(_0xe1809c['exitCriterias']=_0xe1809c[_0x5e108b(0xe4)]['filter'](_0x29f084=>!_0x29f084[_0x5e108b(0xe7)]||!isPendingSegmentId(_0x29f084[_0x5e108b(0xe7)])));if(_0xe1809c[_0x5e108b(0x13a)])for(const _0x250b19 of Object['keys'](_0xe1809c[_0x5e108b(0x13a)])){const _0x1cb0b0=_0xe1809c[_0x5e108b(0x13a)][_0x250b19];_0x1cb0b0[_0x5e108b(0xd4)]===_0x5e108b(0x117)&&_0x1cb0b0[_0x5e108b(0x171)]&&isPendingActivationId(_0x1cb0b0[_0x5e108b(0x171)])&&(_0x1cb0b0[_0x5e108b(0x171)]='');if(_0x1cb0b0[_0x5e108b(0xd4)]==='DecisionPoint'&&_0x1cb0b0[_0x5e108b(0xc1)])for(const _0x2f0bf0 of _0x1cb0b0[_0x5e108b(0xc1)]){_0x2f0bf0['segmentId']&&isPendingSegmentId(_0x2f0bf0[_0x5e108b(0xe7)])&&(_0x2f0bf0['segmentId']='');}_0x1cb0b0['type']===_0x5e108b(0xf2)&&stripWaitStepPendingIds(_0x1cb0b0);}}}function resolvePendingIdsInRequest(_0x41c854,_0xb42bd2,_0x3cb220,_0x325c94,_0x4b6c0f,_0xa1839b){const _0x21f777=a152_0x240960,_0x3c7599=(_0x4e5fb2,_0x1f8f20)=>{const _0x2684cd=a152_0x3c71;if(!isPendingSegmentId(_0x4e5fb2))return _0x4e5fb2;const _0x48a0f6=extractPendingSegmentName(_0x4e5fb2),_0xd86a81=_0x325c94[_0x2684cd(0x78)](_0x48a0f6);return!_0xd86a81&&_0xa1839b[_0x2684cd(0x142)]?.(_0x2684cd(0x90)+_0x48a0f6+_0x2684cd(0xaa)+_0x1f8f20),_0xd86a81;};if(_0x41c854[_0x21f777(0xf1)]['goal']?.[_0x21f777(0xe7)]&&isPendingSegmentId(_0x41c854[_0x21f777(0xf1)][_0x21f777(0x88)][_0x21f777(0xe7)])){const _0x2d43fb=_0x3c7599(_0x41c854[_0x21f777(0xf1)][_0x21f777(0x88)][_0x21f777(0xe7)],_0x21f777(0x12f));_0x2d43fb&&(_0x41c854[_0x21f777(0xf1)][_0x21f777(0x88)]['segmentId']=_0x2d43fb);}for(const _0x556531 of _0x41c854[_0x21f777(0xf1)][_0x21f777(0x131)]||[]){const _0x5a820b=_0x3cb220['get'](_0x556531['name'][_0x21f777(0x102)]());_0x5a820b&&(_0x556531['id']=_0x5a820b);if(_0x556531['entryCriteria']?.[_0x21f777(0xe7)]&&isPendingSegmentId(_0x556531['entryCriteria'][_0x21f777(0xe7)])){const _0x1c437c=_0x3c7599(_0x556531[_0x21f777(0xc3)]['segmentId'],_0x21f777(0x126)+_0x556531['name']+_0x21f777(0x11d));_0x1c437c&&(_0x556531['entryCriteria'][_0x21f777(0xe7)]=_0x1c437c);}if(_0x556531[_0x21f777(0xe4)])for(const _0x1a517f of _0x556531[_0x21f777(0xe4)]){if(_0x1a517f['segmentId']&&isPendingSegmentId(_0x1a517f[_0x21f777(0xe7)])){const _0x2f0c96=_0x3c7599(_0x1a517f[_0x21f777(0xe7)],_0x21f777(0x126)+_0x556531[_0x21f777(0xb9)]+_0x21f777(0x144));_0x2f0c96&&(_0x1a517f['segmentId']=_0x2f0c96);}}if(_0x556531[_0x21f777(0xb3)]?.['segmentId']&&isPendingSegmentId(_0x556531['milestone'][_0x21f777(0xe7)])){const _0x69352c=_0x3c7599(_0x556531[_0x21f777(0xb3)][_0x21f777(0xe7)],_0x21f777(0x126)+_0x556531['name']+'\x27\x20milestone');_0x69352c&&(_0x556531[_0x21f777(0xb3)]['segmentId']=_0x69352c);}if(_0x556531[_0x21f777(0x13a)]){const _0x321a65=_0x4bda81=>_0xb42bd2[_0x21f777(0xf1)][_0x21f777(0x131)]?.[_0x21f777(0x10c)](_0x4efcc0=>_0x4efcc0[_0x21f777(0xb9)][_0x21f777(0x102)]()===_0x556531[_0x21f777(0xb9)][_0x21f777(0x102)]())?.['steps']?.[_0x4bda81];for(const _0x3c8cf8 of Object[_0x21f777(0x155)](_0x556531[_0x21f777(0x13a)])){const _0x3474ac=_0x556531[_0x21f777(0x13a)][_0x3c8cf8],_0x115020=_0x321a65(_0x3c8cf8);if(_0x3474ac[_0x21f777(0xd4)]===_0x21f777(0x117)&&_0x3474ac['journeyActivationStepId']&&(isPendingActivationId(_0x3474ac['journeyActivationStepId'])||_0x3474ac[_0x21f777(0x171)]==='')){if(_0x115020?.[_0x21f777(0x171)]&&isPendingActivationId(_0x115020['journeyActivationStepId'])){const _0x11859c=extractPendingActivationName(_0x115020[_0x21f777(0x171)]),_0x54890c=_0x4b6c0f[_0x21f777(0x78)](_0x11859c);_0x54890c&&(_0x3474ac[_0x21f777(0x171)]=_0x54890c);}}if(_0x3474ac[_0x21f777(0xd4)]===_0x21f777(0x153)&&_0x3474ac[_0x21f777(0xc1)]&&_0x115020?.['branches'])for(let _0x396504=0x0;_0x396504<_0x3474ac[_0x21f777(0xc1)][_0x21f777(0x6e)];_0x396504++){const _0x3f5c74=_0x3474ac[_0x21f777(0xc1)][_0x396504],_0x550ee6=_0x115020[_0x21f777(0xc1)][_0x396504];if(_0x550ee6?.[_0x21f777(0xe7)]&&isPendingSegmentId(_0x550ee6[_0x21f777(0xe7)])){const _0x3e3027=_0x3c7599(_0x550ee6[_0x21f777(0xe7)],'stage\x20\x27'+_0x556531[_0x21f777(0xb9)]+_0x21f777(0x89)+(_0x3f5c74[_0x21f777(0xb9)]||_0x396504)+'\x27');_0x3e3027&&(_0x3f5c74[_0x21f777(0xe7)]=_0x3e3027);}}_0x3474ac[_0x21f777(0xd4)]==='WaitStep'&&_0x115020?.['type']===_0x21f777(0xf2)&&resolveWaitStepPendingIds(_0x3474ac,_0x115020,_0x3c7599,_0x556531[_0x21f777(0xb9)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x372870,_0x1dfbf9){const _0xbdae51=a153_0x1032,_0x4a03b6=_0x372870();while(!![]){try{const _0x546dab=parseInt(_0xbdae51(0x169))/0x1*(-parseInt(_0xbdae51(0x166))/0x2)+-parseInt(_0xbdae51(0x16f))/0x3+parseInt(_0xbdae51(0x171))/0x4+parseInt(_0xbdae51(0x16b))/0x5+parseInt(_0xbdae51(0x16a))/0x6*(parseInt(_0xbdae51(0x165))/0x7)+parseInt(_0xbdae51(0x16c))/0x8*(-parseInt(_0xbdae51(0x168))/0x9)+parseInt(_0xbdae51(0x173))/0xa;if(_0x546dab===_0x1dfbf9)break;else _0x4a03b6['push'](_0x4a03b6['shift']());}catch(_0x5d6096){_0x4a03b6['push'](_0x4a03b6['shift']());}}}(a153_0x4e2b,0x67d4b));export function buildFolderIdToPathMap(_0x22ce4b){const _0x5bc309=a153_0x1032,_0x32bd8a=new Map(),_0x4d607a=new Map();for(const _0x447dc6 of _0x22ce4b){_0x4d607a[_0x5bc309(0x170)](_0x447dc6['id'],_0x447dc6);}const _0x117357=new Set();for(const _0x14fc76 of _0x22ce4b){!_0x14fc76[_0x5bc309(0x167)]&&_0x117357[_0x5bc309(0x172)](_0x14fc76['id']);}function _0x2dde4f(_0x8f8b87){const _0x567237=_0x5bc309;if(_0x32bd8a[_0x567237(0x16d)](_0x8f8b87['id']))return _0x32bd8a['get'](_0x8f8b87['id']);if(_0x117357[_0x567237(0x16d)](_0x8f8b87['id']))return _0x32bd8a[_0x567237(0x170)](_0x8f8b87['id'],''),'';if(_0x8f8b87['parentFolderId']){const _0x37e6a2=_0x4d607a[_0x567237(0x174)](_0x8f8b87[_0x567237(0x167)]);if(_0x37e6a2){const _0x576dac=_0x2dde4f(_0x37e6a2),_0x118448=_0x576dac?_0x576dac+'/'+_0x8f8b87[_0x567237(0x16e)]:_0x8f8b87[_0x567237(0x16e)];return _0x32bd8a['set'](_0x8f8b87['id'],_0x118448),_0x118448;}}const _0xfb37b0=_0x8f8b87[_0x567237(0x16e)];return _0x32bd8a[_0x567237(0x170)](_0x8f8b87['id'],_0xfb37b0),_0xfb37b0;}for(const _0x4f500f of _0x22ce4b){_0x2dde4f(_0x4f500f);}return _0x32bd8a;}function a153_0x1032(_0x3b408e,_0x11efca){_0x3b408e=_0x3b408e-0x165;const _0x4e2b28=a153_0x4e2b();let _0x10323d=_0x4e2b28[_0x3b408e];return _0x10323d;}function a153_0x4e2b(){const _0x11a7ab=['193916JliiGk','add','11134880XihuqM','get','49MypUTZ','160746jShzag','parentFolderId','27JVfDfT','7pzxwtJ','578286FyzWxY','7885tGBzqp','1846616CSaWuI','has','name','473484NhXiXz','set'];a153_0x4e2b=function(){return _0x11a7ab;};return a153_0x4e2b();}export function buildFolderPathToIdMap(_0xfa02fb){const _0x1566da=a153_0x1032,_0x5875e9=new Map(),_0x4b8718=new Map();for(const _0x405130 of _0xfa02fb){_0x4b8718[_0x1566da(0x170)](_0x405130['id'],_0x405130);}const _0x17d096=new Set();for(const _0x471b60 of _0xfa02fb){!_0x471b60[_0x1566da(0x167)]&&_0x17d096['add'](_0x471b60['id']);}function _0x55e804(_0x27c0a0){const _0x472921=_0x1566da;if(_0x17d096[_0x472921(0x16d)](_0x27c0a0['id']))return'';if(_0x27c0a0['parentFolderId']){const _0x15233e=_0x4b8718[_0x472921(0x174)](_0x27c0a0['parentFolderId']);if(_0x15233e){const _0x247fdd=_0x55e804(_0x15233e);return _0x247fdd?_0x247fdd+'/'+_0x27c0a0[_0x472921(0x16e)]:_0x27c0a0[_0x472921(0x16e)];}}return _0x27c0a0[_0x472921(0x16e)];}for(const _0x496465 of _0xfa02fb){const _0x324a99=_0x55e804(_0x496465);_0x5875e9[_0x1566da(0x170)](_0x324a99,_0x496465['id']);}return _0x5875e9;}export function buildFolderMaps(_0x3fd14b){const _0x28a9dc=buildFolderIdToPathMap(_0x3fd14b),_0x2e77db=new Map();for(const [_0x3786ac,_0x53b47f]of _0x28a9dc){_0x2e77db['set'](_0x53b47f,_0x3786ac);}return{'idToPath':_0x28a9dc,'pathToId':_0x2e77db};}export function getFolderPath(_0x2a77c2,_0x873312){const _0x3498b8=a153_0x1032;if(!_0x2a77c2)return'';return _0x873312[_0x3498b8(0x174)](_0x2a77c2)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x454acf,_0x11fbc9){const _0x4bdb1b=a154_0x5f8c,_0x24932d=_0x454acf();while(!![]){try{const _0x33e817=-parseInt(_0x4bdb1b(0x203))/0x1*(-parseInt(_0x4bdb1b(0x1ff))/0x2)+parseInt(_0x4bdb1b(0x1f9))/0x3+parseInt(_0x4bdb1b(0x205))/0x4+-parseInt(_0x4bdb1b(0x201))/0x5*(-parseInt(_0x4bdb1b(0x1f7))/0x6)+-parseInt(_0x4bdb1b(0x1f5))/0x7*(parseInt(_0x4bdb1b(0x1fd))/0x8)+-parseInt(_0x4bdb1b(0x1ed))/0x9+-parseInt(_0x4bdb1b(0x1da))/0xa*(parseInt(_0x4bdb1b(0x1dc))/0xb);if(_0x33e817===_0x11fbc9)break;else _0x24932d['push'](_0x24932d['shift']());}catch(_0x53546a){_0x24932d['push'](_0x24932d['shift']());}}}(a154_0x5439,0x657ca));import a154_0x4d86b5 from'path';function a154_0x5f8c(_0x378d00,_0x5ec40c){_0x378d00=_0x378d00-0x1d9;const _0x543977=a154_0x5439();let _0x5f8cc7=_0x543977[_0x378d00];return _0x5f8cc7;}import{parse as a154_0x5937c3}from'yaml';import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x5d121e){const _0x4d38ab=a154_0x5f8c;if(!_0x5d121e||_0x5d121e[_0x4d38ab(0x1e4)]()==='')throw new Error(_0x4d38ab(0x207));const _0x3fc0c5=_0x5d121e[_0x4d38ab(0x1e4)]();if(_0x3fc0c5==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x5d121e};const _0x52883b=_0x3fc0c5[_0x4d38ab(0x204)]('/')?_0x3fc0c5['substring'](0x1):_0x3fc0c5,_0x10f9cf=_0x52883b[_0x4d38ab(0x1ee)]('/')[_0x4d38ab(0x200)](_0x2c691d=>_0x2c691d!=='');if(_0x10f9cf['length']===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x53785f=_0x3fc0c5[_0x4d38ab(0x204)]('/')||!isRelativePathSegment(_0x10f9cf[0x0]);for(const _0x181ee4 of _0x10f9cf){validatePathSegment(_0x181ee4);}return{'segments':_0x10f9cf,'isAbsolute':_0x53785f,'raw':_0x5d121e};}function isRelativePathSegment(_0xf608ee){return _0xf608ee==='.'||_0xf608ee==='..';}function validatePathSegment(_0x3825ff){const _0x16d7ec=a154_0x5f8c;if(_0x3825ff==='')throw new Error(_0x16d7ec(0x1ef));if(_0x3825ff==='.'||_0x3825ff==='..')return;if(/[\x00-\x1F\x7F]/[_0x16d7ec(0x1d9)](_0x3825ff))throw new Error(_0x16d7ec(0x206)+_0x3825ff);if(_0x3825ff!==_0x3825ff[_0x16d7ec(0x1e4)]()){}}export function validatePath(_0x51cb47){const _0x3ae5d1=a154_0x5f8c;if(_0x51cb47['segments'][_0x3ae5d1(0x1f8)]===0x0&&!_0x51cb47[_0x3ae5d1(0x1ec)])throw new Error(_0x3ae5d1(0x1e0));if(_0x51cb47[_0x3ae5d1(0x1ec)]){if(_0x51cb47[_0x3ae5d1(0x1e9)][0x0]==='..')throw new Error(_0x3ae5d1(0x208));let _0x2e7760=0x0;for(const _0x502090 of _0x51cb47[_0x3ae5d1(0x1e9)]){if(_0x502090==='..'){if(_0x2e7760===0x0)throw new Error(_0x3ae5d1(0x1fc));_0x2e7760--;}else _0x502090!=='.'&&_0x2e7760++;}}}export function joinPaths(_0x282c49,_0x179084){const _0xf34f31=a154_0x5f8c;if(!_0x282c49||_0x282c49==='/')return _0x179084;if(!_0x179084||_0x179084==='.')return _0x282c49;if(_0x179084[_0xf34f31(0x204)]('/'))return _0x179084;const _0x361abf=parsePath(_0x282c49),_0x13ff01=parsePath(_0x179084),_0x5419c6=[..._0x361abf[_0xf34f31(0x1e9)]];for(const _0x37227f of _0x13ff01[_0xf34f31(0x1e9)]){if(_0x37227f==='.')continue;else{if(_0x37227f==='..'){if(_0x5419c6[_0xf34f31(0x1f8)]===0x0)throw new Error(_0xf34f31(0x202));_0x5419c6[_0xf34f31(0x1e1)]();}else _0x5419c6[_0xf34f31(0x1eb)](_0x37227f);}}const _0x4157ec=_0x5419c6['join']('/');return _0x361abf[_0xf34f31(0x20b)][_0xf34f31(0x204)]('/')?'/'+_0x4157ec:_0x4157ec;}export function normalizePath(_0x1f587a){const _0x285ae6=a154_0x5f8c,_0xd953c4=parsePath(_0x1f587a),_0xd16e28=[];for(const _0x13d2c5 of _0xd953c4[_0x285ae6(0x1e9)]){if(_0x13d2c5==='.')continue;else{if(_0x13d2c5==='..'){if(_0xd16e28[_0x285ae6(0x1f8)]===0x0){if(_0xd953c4[_0x285ae6(0x1ec)])throw new Error('Cannot\x20navigate\x20above\x20root');_0xd16e28[_0x285ae6(0x1eb)]('..');}else _0xd16e28[_0xd16e28[_0x285ae6(0x1f8)]-0x1]==='..'?_0xd16e28[_0x285ae6(0x1eb)]('..'):_0xd16e28['pop']();}else _0xd16e28[_0x285ae6(0x1eb)](_0x13d2c5);}}if(_0xd16e28[_0x285ae6(0x1f8)]===0x0)return _0xd953c4[_0x285ae6(0x1ec)]?'/':'.';const _0x125eef=_0xd16e28[_0x285ae6(0x1fe)]('/');return _0xd953c4[_0x285ae6(0x20b)][_0x285ae6(0x204)]('/')?'/'+_0x125eef:_0x125eef;}function a154_0x5439(){const _0x5ae111=['.yml','Path\x20attempts\x20to\x20navigate\x20above\x20root','9488YmqKdK','join','11644IVsrqv','filter','377335hCWYcS','Cannot\x20navigate\x20above\x20root','141EnsqMd','startsWith','2942340jlFopR','Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20','Path\x20cannot\x20be\x20empty','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','replace','root','raw','test','610sJqQiU','File\x20not\x20found:\x20','132946crDVbL','resolve','.yaml','endsWith','Relative\x20path\x20cannot\x20be\x20empty','pop','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','trim','Cannot\x20split\x20empty\x20path','type','relative','readFile','segments','No\x20tdx.json\x20found\x20for\x20file:\x20','push','isAbsolute','3866391CBwnJD','split','Path\x20segment\x20cannot\x20be\x20empty','slice','tdx.json','parent_segment','exists','dirname','658UOvGSo','Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20','6awJIYt','length','186195vGqdTh','parse'];a154_0x5439=function(){return _0x5ae111;};return a154_0x5439();}export function getParentPath(_0x2c475d){const _0x3280b4=a154_0x5f8c,_0x166eb1=parsePath(_0x2c475d);if(_0x166eb1[_0x3280b4(0x1e9)][_0x3280b4(0x1f8)]<=0x1)return'/';const _0x20fe3c=_0x166eb1[_0x3280b4(0x1e9)][_0x3280b4(0x1f0)](0x0,-0x1)[_0x3280b4(0x1fe)]('/');return _0x166eb1[_0x3280b4(0x20b)][_0x3280b4(0x204)]('/')?'/'+_0x20fe3c:_0x20fe3c;}export function getBaseName(_0x1b916c){const _0x534fa4=a154_0x5f8c,_0x208210=parsePath(_0x1b916c);return _0x208210[_0x534fa4(0x1e9)][_0x208210[_0x534fa4(0x1e9)][_0x534fa4(0x1f8)]-0x1]||'';}export function isChildPath(_0x23d8f0,_0x506623){const _0x2f3945=a154_0x5f8c,_0x24bc65=parsePath(_0x23d8f0),_0x1fae5f=parsePath(_0x506623);if(_0x24bc65[_0x2f3945(0x1e9)][_0x2f3945(0x1f8)]<=_0x1fae5f[_0x2f3945(0x1e9)][_0x2f3945(0x1f8)])return![];for(let _0x4c0fcc=0x0;_0x4c0fcc<_0x1fae5f['segments'][_0x2f3945(0x1f8)];_0x4c0fcc++){if(_0x24bc65[_0x2f3945(0x1e9)][_0x4c0fcc]!==_0x1fae5f['segments'][_0x4c0fcc])return![];}return!![];}export function splitPath(_0x374b14){const _0x2ffc47=a154_0x5f8c,_0x48e53c=parsePath(_0x374b14);if(_0x48e53c['segments'][_0x2ffc47(0x1f8)]===0x0)throw new Error(_0x2ffc47(0x1e5));if(_0x48e53c[_0x2ffc47(0x1e9)]['length']===0x1)return{'parent':_0x48e53c[_0x2ffc47(0x1e9)][0x0]};return{'parent':_0x48e53c[_0x2ffc47(0x1e9)][0x0],'child':_0x48e53c['segments'][_0x2ffc47(0x1f0)](0x1)[_0x2ffc47(0x1fe)]('/')};}export function isYamlFilePath(_0x4a084c){const _0x54c402=a154_0x5f8c;return _0x4a084c[_0x54c402(0x1df)](_0x54c402(0x1fb))||_0x4a084c['endsWith'](_0x54c402(0x1de));}export async function resolveYamlFilePath(_0x4e6bdd,_0x4a73ec=nodeFileSystem){const _0x2feec0=a154_0x5f8c,_0x5b38ba=a154_0x4d86b5[_0x2feec0(0x1dd)](_0x4e6bdd);if(!await _0x4a73ec[_0x2feec0(0x1f3)](_0x5b38ba))throw new Error(_0x2feec0(0x1db)+_0x4e6bdd);let _0xe9d3af=a154_0x4d86b5['dirname'](_0x5b38ba),_0x343974=null,_0x12bedb=null;const _0x86206e=a154_0x4d86b5[_0x2feec0(0x1fa)](_0xe9d3af)[_0x2feec0(0x20a)];while(_0xe9d3af!==_0x86206e){const _0x197772=a154_0x4d86b5[_0x2feec0(0x1fe)](_0xe9d3af,_0x2feec0(0x1f1));if(await _0x4a73ec[_0x2feec0(0x1f3)](_0x197772)){_0x343974=_0x197772,_0x12bedb=_0xe9d3af;break;}_0xe9d3af=a154_0x4d86b5[_0x2feec0(0x1f4)](_0xe9d3af);}if(!_0x343974||!_0x12bedb)throw new Error(_0x2feec0(0x1ea)+_0x4e6bdd+'\x0a'+_0x2feec0(0x1e2));const _0xc8e526=await _0x4a73ec[_0x2feec0(0x1e8)](_0x343974),_0x5479ab=JSON[_0x2feec0(0x1fa)](_0xc8e526),_0x1bad06=_0x5479ab[_0x2feec0(0x1f2)];if(!_0x1bad06)throw new Error(_0x2feec0(0x1e3));const _0x575586=await _0x4a73ec['readFile'](_0x5b38ba),_0x1d487e=a154_0x5937c3(_0x575586),_0x1ceda1=_0x1d487e['name'];if(!_0x1ceda1)throw new Error(_0x2feec0(0x1f6)+_0x4e6bdd);const _0x2f4442=_0x1d487e[_0x2feec0(0x1e6)]==='journey'?'journey':'segment',_0x587fbd=a154_0x4d86b5[_0x2feec0(0x1e7)](_0x12bedb,_0x5b38ba),_0x512a6b=a154_0x4d86b5['dirname'](_0x587fbd),_0x4922ec=_0x512a6b==='.'?'':_0x512a6b[_0x2feec0(0x209)](/\\/g,'/'),_0xd1381e=_0x4922ec?_0x1bad06+'/'+_0x4922ec+'/'+_0x1ceda1:_0x1bad06+'/'+_0x1ceda1;return{'parentSegment':_0x1bad06,'segmentName':_0x1ceda1,'folderPath':_0x4922ec,'fullPath':_0xd1381e,'resourceType':_0x2f4442,'content':_0x575586};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x607e0a,_0x34ff3e){const _0x2ff820=a155_0x596d,_0x1c3efa=_0x607e0a();while(!![]){try{const _0xcc6e70=-parseInt(_0x2ff820(0xa7))/0x1+parseInt(_0x2ff820(0xac))/0x2*(-parseInt(_0x2ff820(0xa4))/0x3)+-parseInt(_0x2ff820(0xa2))/0x4*(-parseInt(_0x2ff820(0xa8))/0x5)+-parseInt(_0x2ff820(0x9e))/0x6*(parseInt(_0x2ff820(0xa9))/0x7)+parseInt(_0x2ff820(0xa3))/0x8+parseInt(_0x2ff820(0xa1))/0x9*(parseInt(_0x2ff820(0xa6))/0xa)+-parseInt(_0x2ff820(0xaa))/0xb*(-parseInt(_0x2ff820(0x9f))/0xc);if(_0xcc6e70===_0x34ff3e)break;else _0x1c3efa['push'](_0x1c3efa['shift']());}catch(_0x1d2f41){_0x1c3efa['push'](_0x1c3efa['shift']());}}}(a155_0x4ecd,0x239dc));function a155_0x596d(_0x41813e,_0xcbed8c){_0x41813e=_0x41813e-0x9e;const _0x4ecdcb=a155_0x4ecd();let _0x596d8c=_0x4ecdcb[_0x41813e];return _0x596d8c;}function a155_0x4ecd(){const _0xa51a41=['774RPeFWk','.\x20Parent\x20name\x20cannot\x20be\x20empty','19470TNMtGC','289149NVsvLS','146515ZeQzjF','2019430CiadGM','11KNugUD','Invalid\x20segment\x20reference\x20format:\x20','2150AgmFNU','substring','6axwkIB','8846592rgIgQR','indexOf','945QtNzcC','4oIbMpG','239352eOJwbB'];a155_0x4ecd=function(){return _0xa51a41;};return a155_0x4ecd();}export function parseSegmentRef(_0x24e075){const _0x5d0779=a155_0x596d,_0x1b1a4e=_0x24e075[_0x5d0779(0xa0)]('/');if(_0x1b1a4e===-0x1)return{'parentId':_0x24e075};if(_0x1b1a4e===0x0)throw new Error(_0x5d0779(0xab)+_0x24e075+_0x5d0779(0xa5));const _0x4c2d2d=_0x24e075[_0x5d0779(0xad)](0x0,_0x1b1a4e),_0x4bc9b1=_0x24e075['substring'](_0x1b1a4e+0x1);if(_0x4bc9b1==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x24e075+'.\x20Child\x20name\x20cannot\x20be\x20empty');return{'parentId':_0x4c2d2d,'childId':_0x4bc9b1};}
|