@treasuredata/tdx 2026.3.23 → 2026.3.24
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/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/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/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/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/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a141_0x2cafae=a141_0x372a;(function(_0x304033,_0x41a26b){const _0xaa6287=a141_0x372a,_0x3946a3=_0x304033();while(!![]){try{const _0x524b2f=-parseInt(_0xaa6287(0x1da))/0x1*(-parseInt(_0xaa6287(0x1e5))/0x2)+-parseInt(_0xaa6287(0x1d2))/0x3+parseInt(_0xaa6287(0x1dd))/0x4*(-parseInt(_0xaa6287(0x1d0))/0x5)+-parseInt(_0xaa6287(0x1dc))/0x6*(-parseInt(_0xaa6287(0x1d6))/0x7)+parseInt(_0xaa6287(0x1e3))/0x8+parseInt(_0xaa6287(0x1db))/0x9+parseInt(_0xaa6287(0x1cb))/0xa;if(_0x524b2f===_0x41a26b)break;else _0x3946a3['push'](_0x3946a3['shift']());}catch(_0x305729){_0x3946a3['push'](_0x3946a3['shift']());}}}(a141_0x124b,0xc8e6a));import{readFileSync,writeFileSync,unlinkSync,existsSync,renameSync}from'fs';import a141_0x12b1d8 from'path';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a141_0x2cafae(0x1d1));export function getPushRecoveryPath(_0x1d3066){const _0x34c623=a141_0x2cafae,_0x38b6af=a141_0x12b1d8[_0x34c623(0x1df)](_0x1d3066),_0x1cf306=a141_0x12b1d8[_0x34c623(0x1d7)](_0x1d3066);return a141_0x12b1d8[_0x34c623(0x1e4)](_0x38b6af,'.'+_0x1cf306+_0x34c623(0x1d3));}export function readPushRecovery(_0x31f2e4){const _0x545a3a=a141_0x2cafae,_0x4849b8=getPushRecoveryPath(_0x31f2e4);if(!existsSync(_0x4849b8))return undefined;try{const _0x338a2f=readFileSync(_0x4849b8,_0x545a3a(0x1d8)),_0x54feb7=JSON[_0x545a3a(0x1e2)](_0x338a2f);if(_0x54feb7?.[_0x545a3a(0x1d4)]!==0x1||typeof _0x54feb7[_0x545a3a(0x1d9)]!=='string')return undefined;return _0x54feb7;}catch(_0xaa68d8){return _0xaa68d8 instanceof SyntaxError?logger[_0x545a3a(0x1cf)](_0x545a3a(0x1de)+_0xaa68d8):logger[_0x545a3a(0x1d5)](_0x545a3a(0x1cd)+_0xaa68d8),undefined;}}function a141_0x372a(_0x5d8463,_0xf9aab6){_0x5d8463=_0x5d8463-0x1c9;const _0x124b20=a141_0x124b();let _0x372a08=_0x124b20[_0x5d8463];return _0x372a08;}export function writePushRecovery(_0x1af673,_0x38ddeb){const _0x13dfc7=a141_0x2cafae,_0x319832=getPushRecoveryPath(_0x1af673),_0x4d8393=_0x319832+_0x13dfc7(0x1e0);writeFileSync(_0x4d8393,JSON[_0x13dfc7(0x1ca)](_0x38ddeb,null,0x2)+'\x0a',_0x13dfc7(0x1d8)),renameSync(_0x4d8393,_0x319832);}export function deletePushRecovery(_0x14f963){const _0x225abf=a141_0x2cafae,_0x4a1ee5=getPushRecoveryPath(_0x14f963);try{unlinkSync(_0x4a1ee5);}catch(_0x511eb5){_0x511eb5[_0x225abf(0x1e1)]!==_0x225abf(0x1c9)&&logger[_0x225abf(0x1cf)](_0x225abf(0x1cc)+_0x511eb5);}}function a141_0x124b(){const _0x2098d0=['10138992tKvYXl','join','220750fvNlwQ','ENOENT','stringify','736280VmHOtB','Failed\x20to\x20delete\x20push\x20recovery\x20file:\x20','Failed\x20to\x20read\x20push\x20recovery\x20file:\x20','toISOString','debug','3786655piZoae','tdx.sdk.push-recovery','2903412QFwnly','.push-recovery.json','version','warn','203rReZEZ','basename','utf-8','journeyName','9SjDwOC','5161023DhRNzP','82248JcFsiQ','8gRuMCl','Failed\x20to\x20parse\x20push\x20recovery\x20file:\x20','dirname','.tmp','code','parse'];a141_0x124b=function(){return _0x2098d0;};return a141_0x124b();}export function saveSegmentToPushRecovery(_0xae16e8,_0x1670aa,_0x23ffb3,_0x436733){const _0x44f00a=a141_0x2cafae,_0x2c859e=readPushRecovery(_0xae16e8),_0x5cc49a=_0x2c859e?.[_0x44f00a(0x1d9)]===_0x1670aa?{..._0x2c859e,'updatedAt':new Date()[_0x44f00a(0x1ce)]()}:{'version':0x1,'journeyName':_0x1670aa,'updatedAt':new Date()[_0x44f00a(0x1ce)](),'segments':{}};_0x5cc49a['segments'][_0x23ffb3]=_0x436733,writePushRecovery(_0xae16e8,_0x5cc49a);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a142_0x5a306c=a142_0x7272;(function(_0x11be6a,_0x4d1bcd){const _0x9ff299=a142_0x7272,_0x39bdc5=_0x11be6a();while(!![]){try{const _0x36bd22=-parseInt(_0x9ff299(0x20a))/0x1*(parseInt(_0x9ff299(0x1f8))/0x2)+-parseInt(_0x9ff299(0x284))/0x3+parseInt(_0x9ff299(0x214))/0x4*(parseInt(_0x9ff299(0x1bb))/0x5)+parseInt(_0x9ff299(0x2b6))/0x6*(-parseInt(_0x9ff299(0x280))/0x7)+parseInt(_0x9ff299(0x1e6))/0x8*(parseInt(_0x9ff299(0x257))/0x9)+-parseInt(_0x9ff299(0x22a))/0xa+parseInt(_0x9ff299(0x297))/0xb*(parseInt(_0x9ff299(0x1af))/0xc);if(_0x36bd22===_0x4d1bcd)break;else _0x39bdc5['push'](_0x39bdc5['shift']());}catch(_0x112d68){_0x39bdc5['push'](_0x39bdc5['shift']());}}}(a142_0x9770,0x361de));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a142_0x5a306c(0x1dd));export const PENDING_SEGMENT_PREFIX=a142_0x5a306c(0x28f);export const PENDING_ACTIVATION_PREFIX=a142_0x5a306c(0x286);export function createPendingSegmentId(_0x5e4778){return''+PENDING_SEGMENT_PREFIX+_0x5e4778+'__';}export function isPendingSegmentId(_0x3c4370){const _0x33efd3=a142_0x5a306c;return _0x3c4370[_0x33efd3(0x220)](PENDING_SEGMENT_PREFIX)&&!_0x3c4370['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x178cb3){const _0x47ed00=a142_0x5a306c;return _0x178cb3[_0x47ed00(0x291)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x44165e){return''+PENDING_ACTIVATION_PREFIX+_0x44165e+'__';}export function isPendingActivationId(_0x1f259d){const _0x4ebffd=a142_0x5a306c;return _0x1f259d[_0x4ebffd(0x220)](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x4d6349){const _0x2adfec=a142_0x5a306c;return _0x4d6349[_0x2adfec(0x291)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x4ea77,_0x18356c){const _0x3f486c=a142_0x5a306c,_0x17a8aa=_0x4ea77+'::'+(_0x18356c[_0x3f486c(0x22e)]()||_0x3f486c(0x293)),_0x43c501=createHash(_0x3f486c(0x227))['update'](_0x17a8aa)[_0x3f486c(0x1b7)](_0x3f486c(0x1bd))[_0x3f486c(0x25f)](0x0,0xc);return'journey_entry_criteria_'+_0x43c501;}export function ensureJourneyDefaults(_0x2f66da){const _0x2921de=a142_0x5a306c;!_0x2f66da[_0x2921de(0x1ba)]&&(_0x2f66da[_0x2921de(0x1ba)]=''),!_0x2f66da['state']&&(_0x2f66da[_0x2921de(0x26c)]=_0x2921de(0x23a));}export function injectExistingStageIds(_0x14c97d,_0x5324ff){const _0x4a080c=a142_0x5a306c,_0x2d7ed4=new Map(_0x5324ff[_0x4a080c(0x26f)](_0x227008=>[_0x227008[_0x4a080c(0x279)],_0x227008['id']]));for(const _0x3911bb of _0x14c97d){if(!_0x3911bb['id']){const _0x148f8a=_0x2d7ed4[_0x4a080c(0x219)](_0x3911bb[_0x4a080c(0x279)]);_0x148f8a&&(_0x3911bb['id']=_0x148f8a);}}}export function resolveTDFolderPath(_0x439de5,_0x2877d6,_0x2c9326){const _0x217f0a=a142_0x5a306c;if(!_0x2877d6)return _0x439de5;if(_0x439de5===_0x2c9326||_0x439de5[_0x217f0a(0x220)](_0x2c9326+'/'))return _0x439de5;return _0x439de5?_0x2c9326+'/'+_0x439de5:_0x2c9326;}export function addFoldersToCreate(_0x12f1cf,_0x121be0,_0x4f841e){const _0xe9dcf3=a142_0x5a306c;if(!_0x12f1cf)return;if(_0x121be0[_0xe9dcf3(0x26b)](_0x12f1cf))return;const _0x164cf5=_0x12f1cf[_0xe9dcf3(0x215)]('/');let _0xe76417='';for(const _0x3dddb8 of _0x164cf5){_0xe76417=_0xe76417?_0xe76417+'/'+_0x3dddb8:_0x3dddb8,!_0x121be0[_0xe9dcf3(0x26b)](_0xe76417)&&_0x4f841e[_0xe9dcf3(0x1c8)](_0xe76417);}}function a142_0x9770(){const _0x21c190=['join','has','state','created','activation_updated','map','deleted','folder_creating','reduce','match','segments','Created\x20segment\x20\x27','Segment\x20not\x20found:\x20','activationStepsById','conditionTimeoutUnit','name','logDeleted','Failed\x20to\x20fetch\x20referenced\x20segment\x20','../../utils/async.js','segmentByFolderAndName','\x20segment\x20from\x20file:\x20','segment_creating','1441370BzjdoY','parse','Creating\x20segment\x20\x27','getJourney','1284984OiPFwf','exitCriterias','__pending_act_','logInfo','idToName','hasChanges','list','updated','decision_point','diff','and\x20the\x20server\x20segment,\x20then\x20retry.','__pending_','Segment\x20not\x20found','replace','isNew','segment','Created\x20journey\x20\x27','SEGMENT_NOT_FOUND','uniqueServerName','81587YEhnpE','data','connector_config','toString','getSegmentEntity\x20also\x20failed\x20for\x20','nameToType','journeyActivationNameToId','folder','toISOString','journeyBundlesByFolderAndName','SEGMENT_SYNTAX_ERROR','nameToId','logWarning','Updated\x20segment\x20\x27','createSegment','yamlActivation','getSegment\x20failed\x20for\x20','Failed\x20to\x20','embedded_activation_creating','rootFolderId','activation_template_id','rule','conditionSegmentId','Activation','branches','getSegment','stages','valid','segment_updated','entryCriteria','parentId','6eUlWeG','journeyById','):\x20','set','\x27...','folderId','from','1464WJwDQv','\x27\x20from\x20file:\x20','Entry\x20criteria:\x20','deleteActivation','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','behavior',').\x20','./child-segment-yaml.js','digest','item','Updated\x20activation\x20\x27','description','1355JlSoJY','type','hex','run_after_journey_refresh','toLowerCase','debug','\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20','existingSegments','updateActivation','resolveJourneyId','journeys','JOURNEY_SYNTAX_ERROR','skipSegments','add','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','includes','segmentFolderId','activationActions','activationContext','Creating\x20folder\x20\x27','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','entry_criteria','DecisionPoint','columns','Created\x20folder\x20\x27','journeyBundleId','verbose','activationParams','folderPathToId','createJourneySegment','NOT_FOUND','folder_created','conditionTimeoutDuration','waitStep','tdx.sdk.push-workflow','deps','max','journeyName','segment_deleted','\x0a\x20\x20','journey_creating','\x20journey\x20from\x20file:\x20','isArray','123992zNvbeG','journeyId','delete','entry','Matched\x20server\x20segment\x20\x27','index','Fetching\x20','schedule','updateSegmentById','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','waitStepUnit','existingSegment','Journey\x20\x27','folderPath','goal','Stage\x20\x27','createdSegmentId','versionNumber','160978OHNZSq','Deleted\x20activation\x20\x27','connection','Created\x20activation\x20\x27','withProgress','Updating\x20activation\x20\x27','existingActivation','activation_updating','\x27\x20to\x20local\x20\x27','activation_creating','relationships','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','values','journeyActivationStepId','Failed\x20to\x20resolve\x20activation\x20','segment_deleting','size','update','2NPPaTK','Name\x20has\x20already\x20been\x20taken',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','yamlConfig','journeyBundleName','waitStepType','flatMap','absolutePath','activations','.$1.push-recovery.json','1972XaptNN','split','find','ACTIVATION_UPDATE_ERROR','goal\x20criteria','get','keys','segmentId','segmentNameToId','conditions','JOURNEY_UPDATE_ERROR','journeyStages','startsWith','errors','deleteSegment','resolvedRule','utf-8','Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27','dirname','sha1','createdSegmentIds','all','370980EtCagR','length','buildUserMaps','activation_created','trim','INTERNAL','embedded_segment_created','message','localName','Condition','with','attributes','results','idToEmailMap','\x27\x20wait\x20condition','milestone','draft','onProgress','createActivation','progress','validatedRequest','effectiveFolderId','\x27\x20entry\x20criteria','sort','parentFolder','Embedded\x20segment\x20\x27','create','Creating\x20activation\x20\x27','relative','parseDocument','logSuccess','steps','\x20activation\x20\x27','null','listActivations','filter','connectionIdToNameMap','uniqueSegmentName','entries','SEGMENT_UPDATE_ERROR','embedded_activation_created','Updated\x20journey\x20\x27','stage\x20\x27','notification','existingJourney','9JgSSdq','\x27\x20by\x20rule\x20content','Failed\x20to\x20resolve\x20segment\x20','\x27\x20exit\x20criteria','stringify','embeddedSegmentNameToId','\x27\x20not\x20found\x20in\x20journey\x20\x27','push','slice','WaitStep','action','Updating\x20segment\x20\x27','resolveSegment','unchanged','\x27\x20milestone','./journey-yaml.js','getActivation','journey','some'];a142_0x9770=function(){return _0x21c190;};return a142_0x9770();}export function sortFoldersByDepth(_0x522e2a){const _0x100cf3=a142_0x5a306c;return[..._0x522e2a][_0x100cf3(0x241)]((_0x328ce6,_0x4fc185)=>{const _0x55193a=_0x100cf3,_0x21bd3f=(_0x328ce6[_0x55193a(0x273)](/\//g)||[])[_0x55193a(0x22b)],_0xe43ddf=(_0x4fc185[_0x55193a(0x273)](/\//g)||[])['length'];return _0x21bd3f-_0xe43ddf;});}import*as a142_0x2f4ea7 from'yaml';function a142_0x7272(_0x3ff13e,_0x1ad1c6){_0x3ff13e=_0x3ff13e-0x1aa;const _0x97708f=a142_0x9770();let _0x7272f9=_0x97708f[_0x3ff13e];return _0x7272f9;}import{readFileSync}from'fs';import a142_0x45daf7 from'path';import{isJourneyDef,parseYamlString as a142_0x26fe56,toYamlString as a142_0x564648,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(_0x46f9ed){const _0x22fff8=a142_0x5a306c;if(Array[_0x22fff8(0x1e5)](_0x46f9ed))return'['+_0x46f9ed[_0x22fff8(0x26f)](_0x63d0e2=>stableStringify(_0x63d0e2))[_0x22fff8(0x26a)](',')+']';if(_0x46f9ed&&typeof _0x46f9ed==='object'){const _0x5d7736=_0x46f9ed,_0x582bcf=Object[_0x22fff8(0x21a)](_0x5d7736)[_0x22fff8(0x241)](),_0x4e2928=_0x582bcf[_0x22fff8(0x26f)](_0x7f718=>'\x22'+_0x7f718+'\x22:'+stableStringify(_0x5d7736[_0x7f718]));return'{'+_0x4e2928[_0x22fff8(0x26a)](',')+'}';}const _0x12b837=JSON[_0x22fff8(0x25b)](_0x46f9ed);return _0x12b837===undefined?_0x22fff8(0x24b):_0x12b837;}function activationSignature(_0x5610f6){const _0x24e578=a142_0x5a306c,_0x25a7e2={'connection':_0x5610f6['connection'],..._0x5610f6['all_columns']!==undefined&&{'all_columns':_0x5610f6['all_columns']},..._0x5610f6[_0x24e578(0x1d2)]!==undefined&&{'columns':_0x5610f6[_0x24e578(0x1d2)]},..._0x5610f6[_0x24e578(0x1b4)]!==undefined&&{'behavior':_0x5610f6['behavior']},..._0x5610f6[_0x24e578(0x1ed)]!==undefined&&{'schedule':_0x5610f6[_0x24e578(0x1ed)]},..._0x5610f6[_0x24e578(0x255)]!==undefined&&{'notification':_0x5610f6['notification']},..._0x5610f6[_0x24e578(0x299)]!==undefined&&{'connector_config':_0x5610f6[_0x24e578(0x299)]},..._0x5610f6[_0x24e578(0x2ab)]!==undefined&&{'activation_template_id':_0x5610f6[_0x24e578(0x2ab)]}};return stableStringify(_0x25a7e2);}async function fetchSegment(_0x2457f7,_0x25c947,_0x30c755,_0x36d36b){const _0x2337d0=a142_0x5a306c,_0x4f2af3=_0x36d36b?.[_0x2337d0(0x216)](_0x4569f6=>_0x4569f6['id']===_0x30c755);if(_0x4f2af3)return _0x4f2af3;try{return await _0x2457f7[_0x2337d0(0x293)][_0x2337d0(0x2b0)](_0x25c947,_0x30c755);}catch(_0x36fdd4){logger['debug'](_0x2337d0(0x2a7)+_0x30c755+_0x2337d0(0x20c)+_0x36fdd4);try{return await _0x2457f7[_0x2337d0(0x293)]['getSegmentEntity'](_0x30c755);}catch(_0x2992f0){return logger[_0x2337d0(0x1c0)](_0x2337d0(0x29b)+_0x30c755+':\x20'+_0x2992f0),null;}}}function recoverSegmentIdsFromPushRecovery(_0x190052,_0x5983b3,_0x1d2de2){const _0x5e4fd7=a142_0x5a306c,_0x2a2bf0=readPushRecovery(_0x190052[_0x5e4fd7(0x211)]);if(_0x2a2bf0?.[_0x5e4fd7(0x1e0)]===_0x190052['yamlConfig']['name'])for(const [_0x600770,_0x18224d]of Object[_0x5e4fd7(0x250)](_0x2a2bf0['segments'])){const _0x26e2b1=generateDeterministicJourneySegmentName(_0x190052[_0x5e4fd7(0x20d)][_0x5e4fd7(0x279)],_0x600770);_0x18224d[_0x5e4fd7(0x296)]===_0x26e2b1&&(_0x5983b3[_0x5e4fd7(0x1ab)](_0x600770,_0x18224d[_0x5e4fd7(0x21b)]),_0x1d2de2[_0x5e4fd7(0x1ab)](_0x600770,_0x18224d[_0x5e4fd7(0x21b)]));}}async function createOrRecoverEmbeddedSegment(_0x4543a0,_0x686662,_0x3308b5,_0x5e43f1){const _0x279d9d=a142_0x5a306c;let _0x37a0a1;try{_0x37a0a1=await _0x4543a0[_0x279d9d(0x293)][_0x279d9d(0x1d8)]({'name':_0x3308b5['uniqueSegmentName'],'description':_0x3308b5[_0x279d9d(0x1ba)],'journeyId':_0x3308b5[_0x279d9d(0x1e7)],'rule':_0x5e43f1(_0x3308b5[_0x279d9d(0x223)],!![]),'countPopulation':!![],'parentFolderId':_0x3308b5['folderId'],'audienceId':_0x3308b5[_0x279d9d(0x2b5)]});}catch(_0x578e11){const _0x16dd1e=_0x578e11 instanceof Error&&_0x578e11[_0x279d9d(0x231)][_0x279d9d(0x1ca)](_0x279d9d(0x20b));if(_0x16dd1e){const _0x5a8fe7=readPushRecovery(_0x686662[_0x279d9d(0x211)]),_0x4225c8=_0x5a8fe7?.[_0x279d9d(0x1e0)]===_0x686662[_0x279d9d(0x20d)]['name']?_0x5a8fe7[_0x279d9d(0x274)][_0x3308b5[_0x279d9d(0x232)]]:undefined;if(_0x4225c8?.[_0x279d9d(0x296)]===_0x3308b5[_0x279d9d(0x24f)])await _0x4543a0[_0x279d9d(0x293)][_0x279d9d(0x1ee)](_0x3308b5[_0x279d9d(0x2b5)],_0x4225c8[_0x279d9d(0x21b)],{'description':_0x3308b5['description'],'rule':_0x5e43f1(_0x3308b5[_0x279d9d(0x223)],!![]),'countPopulation':!![]}),_0x37a0a1=_0x4225c8[_0x279d9d(0x21b)];else throw new SDKError(ErrorCode[_0x279d9d(0x251)],_0x279d9d(0x243)+_0x3308b5[_0x279d9d(0x232)]+_0x279d9d(0x1c1)+('Delete\x20the\x20push\x20recovery\x20file\x20('+_0x686662['absolutePath'][_0x279d9d(0x291)](/([^/]+)$/,_0x279d9d(0x213))+')\x20')+_0x279d9d(0x28e),_0x578e11);}else throw _0x578e11;}return saveSegmentToPushRecovery(_0x686662[_0x279d9d(0x211)],_0x686662[_0x279d9d(0x20d)][_0x279d9d(0x279)],_0x3308b5['localName'],{'segmentId':_0x37a0a1,'uniqueServerName':_0x3308b5['uniqueSegmentName'],'createdAt':new Date()[_0x279d9d(0x29f)]()}),_0x37a0a1;}export async function prepareSegmentFiles(_0x373f01,_0x420385,_0x3b9702,_0x52087d,_0xafcdb3){const _0x54abf2=a142_0x5a306c,{activationDefToCreateRequest:_0x3207a0}=await import(_0x54abf2(0x1b6)),_0x692a3c=[],_0x3b5541=new Set();for(const {yamlConfig:_0x6469da,folderPath:_0x3bc138,sourcePath:_0x2a8fdd}of _0x373f01){const _0x23c85b=resolveTDFolderPath(_0x3bc138,_0x52087d,_0xafcdb3),_0x142ca5=_0x23c85b+':'+_0x6469da[_0x54abf2(0x279)],_0x554be1=_0x420385[_0x54abf2(0x27d)][_0x54abf2(0x219)](_0x142ca5),_0x52edbd=_0x554be1?_0x420385['activationsBySegmentId']['get'](_0x554be1['id'])||[]:[];addFoldersToCreate(_0x23c85b,_0x420385[_0x54abf2(0x1d7)],_0x3b5541);const _0x3db924=calculateActivationActions(_0x6469da[_0x54abf2(0x212)]||[],_0x52edbd,_0x420385[_0x54abf2(0x237)],_0x420385[_0x54abf2(0x24e)]);for(const _0x168a2a of _0x3db924){(_0x168a2a['type']===_0x54abf2(0x244)||_0x168a2a[_0x54abf2(0x1bc)]===_0x54abf2(0x209))&&_0x168a2a[_0x54abf2(0x2a6)]&&(_0x168a2a['validatedRequest']=await _0x3207a0(_0x168a2a['yamlActivation'],_0x3b9702));}const _0x350c00=calculateSegmentDiff(_0x6469da,_0x554be1,_0x52edbd,_0x420385[_0x54abf2(0x237)],_0x420385['connectionIdToNameMap']);_0x692a3c[_0x54abf2(0x25e)]({'relativePath':_0x6469da['name'],'absolutePath':_0x2a8fdd,'yamlConfig':_0x6469da,'folderPath':_0x23c85b,'existingSegment':_0x554be1,'existingActivations':_0x52edbd,'isNew':_0x350c00[_0x54abf2(0x292)],'hasChanges':_0x350c00[_0x54abf2(0x289)],'diff':_0x350c00[_0x54abf2(0x28d)],'activationActions':_0x3db924});}return{'segmentFiles':_0x692a3c,'foldersToCreate':_0x3b5541};}export async function prepareJourneyFiles(_0xf1d2d1,_0x5a21d3,_0x30a786,_0x169fad){const _0x4b2bd8=a142_0x5a306c,_0x4bbc43=[],_0x1d409a=new Set();for(const {yamlConfig:_0x204569,folderPath:_0x3ca2de,sourcePath:_0x46d807}of _0xf1d2d1){const _0xc33c4a=resolveTDFolderPath(_0x3ca2de,_0x30a786,_0x169fad),_0x2554bb=_0xc33c4a+':'+_0x204569[_0x4b2bd8(0x279)],_0x21124e=_0x5a21d3[_0x4b2bd8(0x2a0)][_0x4b2bd8(0x219)](_0x2554bb);let _0x2e1ec2,_0x174b14;if(_0x21124e&&_0x21124e[_0x4b2bd8(0x22b)]>0x0){const _0x367a3d=buildLocalExpandedRuleMappings(_0x204569),{createYamlContext:_0x57d692,prefetchJourneySegments:_0x5c0717}=createPushYamlContextForBundle(_0x5a21d3[_0x4b2bd8(0x1de)],_0x5a21d3[_0x4b2bd8(0x2b5)],_0x5a21d3[_0x4b2bd8(0x1c2)],_0x367a3d,_0x5a21d3['idToEmailMap'],_0x5a21d3[_0x4b2bd8(0x24e)],_0x5a21d3[_0x4b2bd8(0x277)],_0x5a21d3[_0x4b2bd8(0x2b7)]);await _0x5c0717(_0x21124e['map'](_0x3fa293=>_0x3fa293['id']));const _0x16dfb8=await _0x5a21d3[_0x4b2bd8(0x1de)]['journey']['getLatestJourneyId'](_0x21124e[0x0][_0x4b2bd8(0x1d4)]),_0x13dfcc=hasMultipleVersions(_0x204569),_0x2ab7d9=async _0x11b690=>{const _0x20ccc8=_0x4b2bd8,_0x562a6f=_0x5a21d3[_0x20ccc8(0x2b7)]?.[_0x20ccc8(0x219)](_0x11b690);if(_0x562a6f)return _0x562a6f;return _0x5a21d3['fetchJourney']({'journeyId':_0x11b690,'journeyName':_0x204569['name'],'isMultiVersion':_0x21124e[_0x20ccc8(0x22b)]>0x1});};if(_0x13dfcc&&_0x21124e[_0x4b2bd8(0x22b)]>0x1){const _0x5d0f39=[];for(const _0x1842e4 of _0x21124e){const _0x600190=_0x1842e4[_0x4b2bd8(0x1f7)]||0x1;_0x5a21d3[_0x4b2bd8(0x23d)]?.[_0x4b2bd8(0x209)](_0x4b2bd8(0x1ec)+_0x204569['name']+'\x20v'+_0x600190);const _0x5de595=await _0x2ab7d9(_0x1842e4['id']),_0x34a3d0=_0x57d692(_0x1842e4['id']),_0x435fe5=await journeyResponseToDef(_0x5de595,_0x34a3d0);_0x5d0f39['push']({'item':_0x1842e4,'yaml':_0x435fe5});}const _0x3b8751=buildLocalRuleToNameMappingFromJourney(_0x204569);_0x174b14=buildMergedJourneyDef(_0x5d0f39,_0x3b8751,_0x16dfb8);const _0x555d1f=Math[_0x4b2bd8(0x1df)](..._0x5d0f39[_0x4b2bd8(0x26f)](_0x33ddb6=>_0x33ddb6[_0x4b2bd8(0x1b8)][_0x4b2bd8(0x1f7)]||0x0)),_0x499b1f=_0x21124e[_0x4b2bd8(0x216)](_0x727b99=>(_0x727b99[_0x4b2bd8(0x1f7)]||0x0)===_0x555d1f);_0x499b1f&&(_0x5a21d3['progress']?.['update']('Fetching\x20'+_0x204569[_0x4b2bd8(0x279)]+'\x20v'+_0x555d1f),_0x2e1ec2=await _0x2ab7d9(_0x499b1f['id']));}else{const _0x22553d=_0x21124e[_0x21124e['length']-0x1];_0x5a21d3[_0x4b2bd8(0x23d)]?.[_0x4b2bd8(0x209)](_0x4b2bd8(0x1ec)+_0x204569[_0x4b2bd8(0x279)]),_0x2e1ec2=await _0x2ab7d9(_0x22553d['id']);const _0x538181=_0x57d692(_0x22553d['id']),_0x4049be=await journeyResponseToDef(_0x2e1ec2,_0x538181),_0x3ccf33=buildLocalRuleToNameMappingFromJourney(_0x204569);_0x174b14=buildMergedJourneyDef([{'item':_0x22553d,'yaml':_0x4049be}],_0x3ccf33,_0x16dfb8);}}addFoldersToCreate(_0xc33c4a,_0x5a21d3[_0x4b2bd8(0x1d7)],_0x1d409a);const _0x482e66=calculateJourneyDiff(_0x204569,_0x174b14);_0x4bbc43[_0x4b2bd8(0x25e)]({'relativePath':_0x204569[_0x4b2bd8(0x279)],'absolutePath':_0x46d807,'yamlConfig':_0x204569,'folderPath':_0xc33c4a,'existingJourney':_0x2e1ec2,'isNew':_0x482e66['isNew'],'hasChanges':_0x482e66[_0x4b2bd8(0x289)],'diff':_0x482e66[_0x4b2bd8(0x28d)]});}return{'journeyFiles':_0x4bbc43,'foldersToCreate':_0x1d409a};}export function calculateActivationActions(_0x1863c2,_0xa5ca35,_0x3bce3a,_0x152c9e){const _0xf1553a=a142_0x5a306c,_0x36c09e=[],_0x3513bc=new Map();for(const _0x338fa1 of _0xa5ca35){_0x3513bc[_0xf1553a(0x1ab)](_0x338fa1[_0xf1553a(0x279)],_0x338fa1);}const _0xea000b=new Map();for(const _0x307ea2 of _0x1863c2){_0xea000b[_0xf1553a(0x1ab)](_0x307ea2[_0xf1553a(0x279)],_0x307ea2);}for(const _0x5d711f of _0x1863c2){const _0x3ef883=_0x3513bc[_0xf1553a(0x219)](_0x5d711f[_0xf1553a(0x279)]);if(!_0x3ef883)_0x36c09e[_0xf1553a(0x25e)]({'type':_0xf1553a(0x244),'name':_0x5d711f['name'],'yamlActivation':_0x5d711f});else{const _0x524261=activationResponseToDef(_0x3ef883,_0x3bce3a,_0x152c9e),_0x1a0312=a142_0x2f4ea7[_0xf1553a(0x25b)](_0x524261),_0x162493=a142_0x2f4ea7[_0xf1553a(0x25b)](_0x5d711f);_0x1a0312!==_0x162493&&_0x36c09e[_0xf1553a(0x25e)]({'type':_0xf1553a(0x209),'name':_0x5d711f[_0xf1553a(0x279)],'yamlActivation':_0x5d711f,'existingActivation':_0x3ef883});}}for(const _0x3667b5 of _0xa5ca35){!_0xea000b[_0xf1553a(0x26b)](_0x3667b5[_0xf1553a(0x279)])&&_0x36c09e[_0xf1553a(0x25e)]({'type':_0xf1553a(0x1e8),'name':_0x3667b5[_0xf1553a(0x279)],'existingActivation':_0x3667b5});}return _0x36c09e;}function calculateYamlDiff(_0x6f2cb3,_0x3ac187){if(_0x3ac187){const _0x8ccc59=generateDiff(_0x3ac187,_0x6f2cb3),_0x6c4d15=hasChanges(_0x8ccc59);return{'isNew':![],'hasChanges':_0x6c4d15,'diff':_0x6c4d15?formatDiffWithColors(_0x8ccc59):undefined};}const _0x581cb4=generateDiff('',_0x6f2cb3);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x581cb4)};}export function calculateSegmentDiff(_0x3308b8,_0x436cd7,_0x54b692,_0x46685e,_0x781a1c){const _0x56ceda=segmentToYamlString(_0x3308b8),_0x419aae=_0x436cd7?segmentToYamlString(segmentWithActivationsToYaml(_0x436cd7,_0x54b692,undefined,_0x46685e,_0x781a1c)):undefined;return calculateYamlDiff(_0x56ceda,_0x419aae);}export function calculateJourneyDiff(_0x38141c,_0x19ecdd){const _0x726fb9=normalizeJourneyDef(_0x38141c,_0x38141c),_0x5437bb=a142_0x564648(_0x726fb9),_0x2ce9ae=_0x19ecdd?a142_0x564648(normalizeJourneyDef(_0x19ecdd,_0x38141c)):undefined;return calculateYamlDiff(_0x5437bb,_0x2ce9ae);}export function findSegmentsToDelete(_0x4ff70b,_0xaf7751,_0x1ebae1,_0x1bca0e,_0x31e0c5){const _0xb4b4c=a142_0x5a306c,_0x114cbe=new Set();for(const {yamlConfig:_0x4f1ebb,folderPath:_0x366d23}of _0xaf7751){_0x114cbe[_0xb4b4c(0x1c8)](_0x366d23+':'+_0x4f1ebb[_0xb4b4c(0x279)]);}return _0x4ff70b[_0xb4b4c(0x24d)](_0xb912e6=>{const _0x39613d=_0xb4b4c,_0x582aab=_0xb912e6['segmentFolderId']?_0x1ebae1[_0x39613d(0x219)](_0xb912e6[_0x39613d(0x1cb)][_0x39613d(0x29a)]())||'':'',_0x5ad74b=_0x582aab+':'+_0xb912e6[_0x39613d(0x279)];if(_0x114cbe[_0x39613d(0x26b)](_0x5ad74b))return![];if(_0x31e0c5)return _0x582aab===_0x1bca0e||_0x582aab[_0x39613d(0x220)](_0x1bca0e+'/');return!![];});}export function findJourneysToDelete(_0x341b79,_0x2d59be,_0x1fc4f9,_0x7ac910,_0x55484f){const _0x5678d4=a142_0x5a306c,_0x575168=new Set();for(const {yamlConfig:_0x23c9c7,folderPath:_0x237152}of _0x2d59be){_0x575168['add'](_0x237152+':'+_0x23c9c7[_0x5678d4(0x279)]);}return _0x341b79[_0x5678d4(0x24d)](_0x1f5409=>{const _0x29bc3b=_0x5678d4,_0x385672=_0x1f5409[_0x29bc3b(0x1ad)]?_0x1fc4f9[_0x29bc3b(0x219)](_0x1f5409[_0x29bc3b(0x1ad)])||'':'',_0x229a74=_0x385672+':'+_0x1f5409[_0x29bc3b(0x20e)];if(_0x575168[_0x29bc3b(0x26b)](_0x229a74))return![];if(_0x55484f)return _0x385672===_0x7ac910||_0x385672[_0x29bc3b(0x220)](_0x7ac910+'/');return!![];});}export function buildSegmentLookupMap(_0x514864,_0x496a50){const _0x5a5e3e=a142_0x5a306c,_0x2bc6a6=new Map();for(const _0x21cfdc of _0x514864){const _0x2f2fd1=_0x21cfdc[_0x5a5e3e(0x1cb)]?_0x496a50['get'](_0x21cfdc[_0x5a5e3e(0x1cb)][_0x5a5e3e(0x29a)]())||'':'',_0x50a526=_0x2f2fd1+':'+_0x21cfdc[_0x5a5e3e(0x279)];_0x2bc6a6[_0x5a5e3e(0x1ab)](_0x50a526,_0x21cfdc);}return _0x2bc6a6;}export function buildSegmentNameToIdMap(_0x1f0cc1){const _0x48a55d=new Map();for(const _0x257968 of _0x1f0cc1){_0x48a55d['set'](_0x257968['name'],_0x257968['id']);}return _0x48a55d;}export function buildJourneyBundleLookupMap(_0x3442ad,_0x4976c2){const _0x1881b8=a142_0x5a306c,_0x34b47e=new Map();for(const _0x558a12 of _0x3442ad){const _0x47ce37=_0x558a12['folderId']?_0x4976c2[_0x1881b8(0x219)](_0x558a12[_0x1881b8(0x1ad)])||'':'',_0x5a0e4c=_0x47ce37+':'+_0x558a12['journeyBundleName'];!_0x34b47e[_0x1881b8(0x26b)](_0x5a0e4c)&&_0x34b47e['set'](_0x5a0e4c,[]),_0x34b47e[_0x1881b8(0x219)](_0x5a0e4c)['push'](_0x558a12);}for(const _0x563440 of _0x34b47e[_0x1881b8(0x204)]()){_0x563440[_0x1881b8(0x241)]((_0x486fef,_0x5429d7)=>(_0x486fef[_0x1881b8(0x1f7)]||0x0)-(_0x5429d7[_0x1881b8(0x1f7)]||0x0));}return _0x34b47e;}export function collectFoldersToCreate(_0x2d7fa8,_0x39a4f6){const _0x29ed85=a142_0x5a306c,_0x588bfd=new Set();for(const _0x5a6632 of _0x2d7fa8){if(!_0x5a6632)continue;if(_0x39a4f6['has'](_0x5a6632))continue;const _0xd8db6c=_0x5a6632[_0x29ed85(0x215)]('/');let _0x4f7a33='';for(const _0x412651 of _0xd8db6c){_0x4f7a33=_0x4f7a33?_0x4f7a33+'/'+_0x412651:_0x412651,!_0x39a4f6[_0x29ed85(0x26b)](_0x4f7a33)&&_0x588bfd['add'](_0x4f7a33);}}return _0x588bfd;}export function parseAndClassifyYamlFiles(_0x324f21,_0x1705fe,_0x3b3476){const _0x5e7b61=a142_0x5a306c,_0x35f450=[],_0x346899=[];for(const _0x6b0907 of _0x324f21){const _0x3e7054=a142_0x45daf7[_0x5e7b61(0x246)](_0x1705fe,a142_0x45daf7[_0x5e7b61(0x226)](_0x6b0907)),_0x2a622c=_0x3e7054==='.'?'':_0x3e7054,_0x17d768=readFileSync(_0x6b0907,_0x5e7b61(0x224)),_0x5bf7c4=a142_0x2f4ea7[_0x5e7b61(0x281)](_0x17d768);if(isJourneyDef(_0x5bf7c4)){const _0x37b3d4=a142_0x26fe56(_0x17d768);_0x346899['push']({'yamlConfig':_0x37b3d4,'folderPath':_0x2a622c,'sourcePath':_0x6b0907});}else{if(!_0x3b3476?.[_0x5e7b61(0x1c7)]){const _0xd6e78e=parseSegmentYamlFile(_0x17d768),_0x16d112=normalizeChildSegmentYaml(_0xd6e78e);_0x35f450[_0x5e7b61(0x25e)]({'yamlConfig':_0x16d112,'folderPath':_0x2a622c,'sourcePath':_0x6b0907});}}}return{'segments':_0x35f450,'journeys':_0x346899};}export function validateParsedFiles(_0x5cf580,_0x2cd217){const _0x4c30f6=a142_0x5a306c,_0x4ea173=[];for(const {yamlConfig:_0x8bca1c,sourcePath:_0x55fa15}of _0x5cf580['segments']){const _0x2d8c78=readFileSync(_0x55fa15,_0x4c30f6(0x224)),_0x3fec05=a142_0x2f4ea7[_0x4c30f6(0x247)](_0x2d8c78),_0x4de930=validateSegmentDef(_0x8bca1c,{'source':_0x2d8c78,'document':_0x3fec05},{'skipSchema':!![]});if(!_0x4de930[_0x4c30f6(0x2b2)]){const _0x2b4368=a142_0x45daf7[_0x4c30f6(0x246)](_0x2cd217,_0x55fa15);_0x4ea173['push']({'filePath':_0x2b4368,'source':_0x2d8c78,'result':_0x4de930,'isJourney':![]});}}for(const {yamlConfig:_0x1a4c96,sourcePath:_0x2bd0e3}of _0x5cf580[_0x4c30f6(0x1c5)]){const _0x6fa27c=readFileSync(_0x2bd0e3,_0x4c30f6(0x224)),_0x26d728=a142_0x2f4ea7[_0x4c30f6(0x247)](_0x6fa27c),_0x22553c=validateJourneyDef(_0x1a4c96,{'source':_0x6fa27c,'document':_0x26d728},{'skipSchema':!![]});if(!_0x22553c[_0x4c30f6(0x2b2)]){const _0x1a4ea6=a142_0x45daf7[_0x4c30f6(0x246)](_0x2cd217,_0x2bd0e3);_0x4ea173['push']({'filePath':_0x1a4ea6,'source':_0x6fa27c,'result':_0x22553c,'isJourney':!![]});}}return _0x4ea173;}export function formatValidationErrors(_0x4b9066){const _0x466d99=a142_0x5a306c,_0x30c560=[];for(const {filePath:_0x33082f,source:_0x26d3f7,result:_0x5c0e12,isJourney:_0x2edb3c}of _0x4b9066){const _0x2bff42=_0x2edb3c?_0x466d99(0x268):_0x466d99(0x293);_0x30c560[_0x466d99(0x25e)]('\x0a'+_0x33082f+'\x20('+_0x2bff42+_0x466d99(0x1aa)+_0x5c0e12[_0x466d99(0x221)][_0x466d99(0x22b)]+'\x20error(s)'),_0x30c560[_0x466d99(0x25e)](formatValidationResult(_0x5c0e12,_0x26d3f7,_0x33082f));}return _0x30c560[_0x466d99(0x26a)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x18a83e){const _0x53995d=a142_0x5a306c,_0x50c6e8=new Set(),_0x1f83d2=new Map(),_0x2e7ec1=collectSegmentUsageCounts(_0x18a83e);if(_0x18a83e[_0x53995d(0x274)])for(const [_0x5da4a0,_0x2db724]of Object[_0x53995d(0x250)](_0x18a83e[_0x53995d(0x274)])){_0x50c6e8[_0x53995d(0x1c8)](_0x5da4a0);if(_0x2db724[_0x53995d(0x2ac)]){const _0x14d798=yamlRuleToApi(_0x2db724[_0x53995d(0x2ac)]),_0x556fa2=apiRuleToYaml(_0x14d798);_0x1f83d2[_0x53995d(0x1ab)](_0x5da4a0,_0x556fa2);}}const _0x44860c=new Map();let _0xd01709=0x0;for(const [_0x599197,_0x8e4bf]of _0x1f83d2){const _0x383940=serializeExpandedRule(_0x8e4bf,_0x1f83d2),_0x546902=_0x44860c[_0x53995d(0x219)](_0x383940)||[];_0x546902['push']({'name':_0x599197,'index':_0xd01709}),_0x44860c['set'](_0x383940,_0x546902),_0xd01709++;}const _0x1d4508=new Map();for(const [_0xad914d,_0x64614f]of _0x44860c){const _0x20703a=_0x64614f[_0x53995d(0x25f)]()[_0x53995d(0x241)]((_0x3dbed6,_0x12569b)=>{const _0x3f7d75=_0x53995d,_0x16f233=_0x2e7ec1[_0x3f7d75(0x219)](_0x3dbed6[_0x3f7d75(0x279)])||0x0,_0x46d393=_0x2e7ec1['get'](_0x12569b[_0x3f7d75(0x279)])||0x0;if(_0x16f233!==_0x46d393)return _0x46d393-_0x16f233;return _0x3dbed6['index']-_0x12569b[_0x3f7d75(0x1eb)];})['map'](_0x57fffe=>_0x57fffe['name']),_0x1a08c8=[];for(const _0x374b90 of _0x20703a){const _0x5c01f2=_0x2e7ec1[_0x53995d(0x219)](_0x374b90)||0x0,_0x20f860=Math[_0x53995d(0x1df)](_0x5c01f2,0x1);for(let _0x4d1715=0x0;_0x4d1715<_0x20f860;_0x4d1715++){_0x1a08c8[_0x53995d(0x25e)](_0x374b90);}}_0x1d4508['set'](_0xad914d,_0x1a08c8);}return{'existingLocalSegmentNames':_0x50c6e8,'localSegmentRules':_0x1f83d2,'localExpandedRuleToNames':_0x1d4508};}export function createSegmentIdResolver(_0x257afa,_0x521f6d){return async _0x2c84ce=>{const _0x298469=a142_0x7272,_0x10d52a=_0x257afa[_0x298469(0x219)](_0x2c84ce);if(!_0x10d52a)throw new SDKError(ErrorCode[_0x298469(0x295)],'Segment\x20not\x20found:\x20'+_0x2c84ce+'\x20(referenced\x20in\x20embedded\x20segment\x20\x27'+_0x521f6d+'\x27)');return _0x10d52a;};}export function extractRootFolderId(_0x42a6cc){const _0x3f7c17=a142_0x5a306c;return _0x42a6cc[_0x3f7c17(0x202)]?.['parentSegmentFolder']?.[_0x3f7c17(0x298)]?.['id']||_0x42a6cc[_0x3f7c17(0x202)]?.[_0x3f7c17(0x242)]?.[_0x3f7c17(0x298)]?.['id'];}export function buildConnectionMaps(_0x61f1dc){const _0x43632d=a142_0x5a306c,_0x54daec=new Map(),_0x531876=new Map(),_0x290580=new Map();for(const _0x4a00a7 of _0x61f1dc){_0x54daec[_0x43632d(0x1ab)](_0x4a00a7[_0x43632d(0x279)],parseInt(_0x4a00a7['id'],0xa)),_0x531876['set'](_0x4a00a7['id'],_0x4a00a7[_0x43632d(0x279)]),_0x290580[_0x43632d(0x1ab)](_0x4a00a7['name'],_0x4a00a7['type']);}return{'nameToId':_0x54daec,'idToName':_0x531876,'nameToType':_0x290580};}export function calculatePushStats(_0x21ebae,_0xaa84a2,_0x3e0692,_0x5589d6,_0x502451,_0x4bc4ef,_0x29563e){const _0x4872de=a142_0x5a306c,_0x48fe53=_0x21ebae[_0x4872de(0x24d)](_0x3a5d8a=>_0x3a5d8a[_0x4872de(0x292)]),_0x538800=_0x21ebae[_0x4872de(0x24d)](_0x532dee=>!_0x532dee[_0x4872de(0x292)]&&_0x532dee[_0x4872de(0x289)]),_0x41b663=_0x21ebae['filter'](_0x1f25c3=>!_0x1f25c3[_0x4872de(0x292)]&&!_0x1f25c3['hasChanges']),_0x4d00ee=_0x4bc4ef?_0x5589d6:[],_0x36d25f=_0xaa84a2[_0x4872de(0x24d)](_0x4907dd=>_0x4907dd[_0x4872de(0x292)]),_0x59ad0a=_0xaa84a2[_0x4872de(0x24d)](_0x5823e4=>!_0x5823e4[_0x4872de(0x292)]&&_0x5823e4[_0x4872de(0x289)]),_0x10df1c=_0xaa84a2[_0x4872de(0x24d)](_0x41f6e8=>!_0x41f6e8[_0x4872de(0x292)]&&!_0x41f6e8['hasChanges']),_0x2a8261=_0x4bc4ef?_0x502451:[],_0xe4c381=_0x21ebae[_0x4872de(0x210)](_0x3dbbfd=>_0x3dbbfd['activationActions']),_0x522ff1=_0xe4c381['filter'](_0x5f0c09=>_0x5f0c09[_0x4872de(0x1bc)]==='create'),_0x536e56=_0xe4c381[_0x4872de(0x24d)](_0x3cf32e=>_0x3cf32e[_0x4872de(0x1bc)]===_0x4872de(0x209)),_0x38e6bf=_0xe4c381['filter'](_0x4b4522=>_0x4b4522[_0x4872de(0x1bc)]===_0x4872de(0x1e8)),_0x2016cd=Array[_0x4872de(0x1ae)](_0x3e0692)['sort'](),_0x5f2708=_0x29563e?![]:_0x48fe53[_0x4872de(0x22b)]>0x0||_0x538800[_0x4872de(0x22b)]>0x0||_0x4d00ee[_0x4872de(0x22b)]>0x0,_0x4f9fde=_0x36d25f[_0x4872de(0x22b)]>0x0||_0x59ad0a[_0x4872de(0x22b)]>0x0||_0x2a8261[_0x4872de(0x22b)]>0x0,_0x184720=_0x29563e?![]:_0xe4c381[_0x4872de(0x22b)]>0x0,_0x56c8ba=_0x2016cd[_0x4872de(0x22b)]>0x0;return{'segments':{'new':_0x48fe53,'changed':_0x538800,'unchanged':_0x41b663,'toDelete':_0x4d00ee},'journeys':{'new':_0x36d25f,'changed':_0x59ad0a,'unchanged':_0x10df1c,'toDelete':_0x2a8261},'activations':{'all':_0xe4c381,'toCreate':_0x522ff1,'toUpdate':_0x536e56,'toDelete':_0x38e6bf},'folders':{'toCreate':_0x2016cd},'counts':{'segments':{'new':_0x48fe53['length'],'changed':_0x538800['length'],'unchanged':_0x41b663['length'],'toDelete':_0x4d00ee['length']},'journeys':{'new':_0x36d25f['length'],'changed':_0x59ad0a[_0x4872de(0x22b)],'unchanged':_0x10df1c['length'],'toDelete':_0x2a8261[_0x4872de(0x22b)]},'activations':{'create':_0x522ff1[_0x4872de(0x22b)],'update':_0x536e56[_0x4872de(0x22b)],'delete':_0x38e6bf[_0x4872de(0x22b)]},'folders':_0x2016cd[_0x4872de(0x22b)]},'hasChanges':_0x5f2708||_0x4f9fde||_0x184720||_0x56c8ba};}export async function buildPushExecutionContext(_0x7166f9,_0xbcb80b,_0x43c71f,_0x4a131f,_0x2db60e,_0x535b5a){const _0x55850b=a142_0x5a306c,_0x39a91a=extractRootFolderId(_0x43c71f),{pathToId:_0x2323bf,idToPath:_0x4d22e6}=buildFolderMaps(_0x2db60e),_0x4e0220=buildSegmentNameToIdMap(_0x4a131f),_0x520ee9=new Map(),{batchAsync:_0x535e44}=await import(_0x55850b(0x27c)),[_0x168305,_0x5aa83d]=await Promise[_0x55850b(0x229)]([_0x7166f9['user'][_0x55850b(0x22c)](),_0x7166f9[_0x55850b(0x1fa)][_0x55850b(0x28a)](),((async()=>{!_0x535b5a&&_0x4a131f['length']>0x0&&await _0x535e44(_0x4a131f,async _0x4e7736=>{const _0x70257b=a142_0x7272,_0x2f4280=await _0x7166f9[_0x70257b(0x293)][_0x70257b(0x24c)](_0xbcb80b,_0x4e7736['id']);_0x520ee9[_0x70257b(0x1ab)](_0x4e7736['id'],_0x2f4280);});})())]),{emailToId:_0x5c2345,idToEmail:_0x4265b0}=_0x168305,_0x18c804=buildConnectionMaps(_0x5aa83d);return{'rootFolderId':_0x39a91a,'folderPathToId':_0x2323bf,'folderIdToPath':_0x4d22e6,'segmentNameToId':_0x4e0220,'activationsBySegmentId':_0x520ee9,'emailToIdMap':_0x5c2345,'idToEmailMap':_0x4265b0,'connectionNameToIdMap':_0x18c804[_0x55850b(0x2a2)],'connectionIdToNameMap':_0x18c804[_0x55850b(0x288)],'connectionNameToTypeMap':_0x18c804[_0x55850b(0x29c)]};}export function createPushYamlContextForBundle(_0x168ebf,_0x15d846,_0x249795,_0x5aa28b,_0xd35264,_0x2ab58d,_0x55e8e8,_0x4de4f9){const {existingLocalSegmentNames:_0x50c8db,localExpandedRuleToNames:_0x39a97e}=_0x5aa28b,_0x4c415a=new Set(),_0x1b591c=new Map(),_0x57909a=new Map(),_0x52cade=new Map(),_0x14cc1d=createJumpTargetCache(),_0x5313dc=new Map(),_0xcd687c=new Map(),_0x94a18c=new Set();let _0x18f02c;const _0xa2406=_0x180a5c=>{const _0x25ca33={'resolveSegment':async _0x2eb0ef=>{const _0x40bdbe=a142_0x7272,_0x54c653=_0x52cade[_0x40bdbe(0x219)](_0x2eb0ef);if(_0x54c653!==undefined)return{'name':_0x54c653,'isJourneyLocal':!![]};try{const _0x178d78=await fetchSegment(_0x168ebf,_0x15d846,_0x2eb0ef,_0x249795);if(!_0x178d78)throw new Error(_0x40bdbe(0x290));const _0x5ba408=generateJourneyLocalName(_0x178d78['name']),_0x41e071=_0x178d78['kind']===SEGMENT_KIND_JOURNEY&&_0x5ba408!==undefined;let _0x18d734=_0x178d78[_0x40bdbe(0x279)],_0x44f422;if(_0x41e071&&_0x178d78['rule']){const _0x16cdac=apiRuleToYaml(_0x178d78[_0x40bdbe(0x2ac)]);_0xcd687c['set'](_0x2eb0ef,_0x16cdac);const _0x1dc7a8=async _0x335d79=>{const _0x54ebb5=_0x40bdbe,_0xf929f3=collectSegmentRefsFromRule(_0x335d79);for(const _0x1bffbf of _0xf929f3){if(!_0xcd687c['has'](_0x1bffbf))try{const _0x5ae07d=await fetchSegment(_0x168ebf,_0x15d846,_0x1bffbf,_0x249795);if(_0x5ae07d?.[_0x54ebb5(0x2ac)]){const _0x2cda1f=apiRuleToYaml(_0x5ae07d[_0x54ebb5(0x2ac)]);_0xcd687c['set'](_0x1bffbf,_0x2cda1f),await _0x1dc7a8(_0x2cda1f);}}catch(_0x418d1d){logger[_0x54ebb5(0x1c0)](_0x54ebb5(0x27b)+_0x1bffbf+':\x20'+_0x418d1d);}}};await _0x1dc7a8(_0x16cdac);const _0x4c3e93=serializeExpandedRule(_0x16cdac,_0xcd687c),_0x524d86=_0x39a97e[_0x40bdbe(0x219)](_0x4c3e93);if(_0x524d86&&_0x524d86[_0x40bdbe(0x22b)]>0x0){const _0x57b49f=_0x1b591c[_0x40bdbe(0x219)](_0x4c3e93)||0x0,_0x501b32=_0x524d86[_0x57b49f]||_0x524d86[_0x524d86[_0x40bdbe(0x22b)]-0x1];_0x1b591c[_0x40bdbe(0x1ab)](_0x4c3e93,_0x57b49f+0x1),_0x18d734=_0x501b32,_0x4c415a[_0x40bdbe(0x1c8)](_0x18d734),_0x52cade[_0x40bdbe(0x1ab)](_0x2eb0ef,_0x18d734);const _0x85622b=await resolveRuleSegmentRefs(_0x16cdac,async _0x217e8a=>{const _0xf001fe=_0x40bdbe,_0x577461=_0x52cade[_0xf001fe(0x219)](_0x217e8a);if(_0x577461)return _0x577461;const _0x4467b9=await _0x18f02c[_0xf001fe(0x263)](_0x217e8a);return _0x4467b9[_0xf001fe(0x279)];});_0x44f422={'description':_0x178d78['description'],'rule':_0x85622b};}else{const _0x3149ec=_0x5313dc[_0x40bdbe(0x219)](_0x4c3e93);if(_0x3149ec)_0x18d734=_0x3149ec,_0x52cade[_0x40bdbe(0x1ab)](_0x2eb0ef,_0x18d734);else{if(_0x5ba408){let _0xca47e=_0x5ba408,_0x48f3d2=0x2;while(_0x4c415a['has'](_0xca47e)||_0x50c8db[_0x40bdbe(0x26b)](_0xca47e)){_0xca47e=_0x5ba408+'_'+_0x48f3d2,_0x48f3d2++;}_0x4c415a[_0x40bdbe(0x1c8)](_0xca47e),_0x18d734=_0xca47e;}_0x52cade[_0x40bdbe(0x1ab)](_0x2eb0ef,_0x18d734),_0x5313dc[_0x40bdbe(0x1ab)](_0x4c3e93,_0x18d734);const _0x46bebf=await resolveRuleSegmentRefs(_0x16cdac,async _0x4a7046=>{const _0x47a03d=_0x40bdbe,_0x411b31=_0x52cade['get'](_0x4a7046);if(_0x411b31)return _0x411b31;const _0x4f96d7=await _0x18f02c['resolveSegment'](_0x4a7046);return _0x4f96d7[_0x47a03d(0x279)];});_0x44f422={'description':_0x178d78['description'],'rule':_0x46bebf};}}}return{'name':_0x18d734,'isJourneyLocal':_0x41e071,'definition':_0x44f422};}catch(_0xaca879){return logger[_0x40bdbe(0x1c0)](_0x40bdbe(0x259)+_0x2eb0ef+':\x20'+_0xaca879),{'name':_0x2eb0ef,'isJourneyLocal':![]};}},'resolveActivation':async _0x1b34aa=>{const _0xd1ba67=a142_0x7272,_0x32d11d=_0x57909a['get'](_0x1b34aa);if(_0x32d11d!==undefined)return{'name':_0x32d11d,'isJourneyLocal':!![]};try{let _0x453985=_0x55e8e8?.[_0xd1ba67(0x219)](_0x1b34aa);!_0x453985&&(_0x453985=await _0x168ebf[_0xd1ba67(0x268)][_0xd1ba67(0x267)](_0x180a5c,_0x1b34aa));const _0x1f5272=_0x453985[_0xd1ba67(0x235)][_0xd1ba67(0x1d6)]['name']||_0x1b34aa,_0x1b48ab=sanitizeYamlKey(_0x1f5272)||'activation_'+_0x1b34aa,_0x103fcf=_0x1b48ab;_0x57909a[_0xd1ba67(0x1ab)](_0x1b34aa,_0x103fcf);const _0x26b6eb=journeyActivationStepToYaml(_0x453985,_0xd35264,_0x2ab58d);return{'name':_0x103fcf,'isJourneyLocal':!![],'definition':_0x26b6eb};}catch(_0x3cf270){return logger[_0xd1ba67(0x1c0)](_0xd1ba67(0x206)+_0x1b34aa+':\x20'+_0x3cf270),{'name':_0x1b34aa,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x17de77,_0x4fbb39)=>resolveJumpTarget(_0x17de77,_0x4fbb39,_0x14cc1d,async _0x4314f2=>{const _0x3e6fed=a142_0x7272,_0x3c5d30=_0x4de4f9?.['get'](_0x4314f2);if(_0x3c5d30)return _0x3c5d30;return _0x168ebf[_0x3e6fed(0x268)][_0x3e6fed(0x283)](_0x4314f2);})};return _0x18f02c=_0x25ca33,_0x25ca33;},_0x34d256=async _0xa1a51f=>{const _0x4acd99=a142_0x7272,{collectSegmentIdsFromJourneyApi:_0x4ada1e}=await import(_0x4acd99(0x266)),{batchAsync:_0xd28e7d}=await import('../../utils/async.js'),_0x56a1d6=new Set();for(const _0x1a7564 of _0xa1a51f){let _0x482ec2=_0x4de4f9?.[_0x4acd99(0x219)](_0x1a7564);!_0x482ec2&&(_0x482ec2=await _0x168ebf[_0x4acd99(0x268)][_0x4acd99(0x283)](_0x1a7564));const _0x17ffef=_0x4ada1e(_0x482ec2);for(const _0x17a7a7 of _0x17ffef){_0x56a1d6[_0x4acd99(0x1c8)](_0x17a7a7);}}let _0x346771=Array[_0x4acd99(0x1ae)](_0x56a1d6);while(_0x346771[_0x4acd99(0x22b)]>0x0){const _0x5b885e=_0x346771['filter'](_0x1f0bcf=>!_0x94a18c[_0x4acd99(0x26b)](_0x1f0bcf));if(_0x5b885e['length']===0x0)break;const _0x1fb634=await _0xd28e7d(_0x5b885e,async _0x59b727=>{const _0x31290b=_0x4acd99;_0x94a18c[_0x31290b(0x1c8)](_0x59b727);const _0x4ab05d=await fetchSegment(_0x168ebf,_0x15d846,_0x59b727,_0x249795);if(!_0x4ab05d)return null;return{'segmentId':_0x59b727,'segment':_0x4ab05d};},0xa),_0x163f6c=new Set();for(const _0x25f9c0 of _0x1fb634){if(!_0x25f9c0?.[_0x4acd99(0x293)]?.[_0x4acd99(0x2ac)])continue;const _0x3210de=apiRuleToYaml(_0x25f9c0[_0x4acd99(0x293)][_0x4acd99(0x2ac)]);_0xcd687c[_0x4acd99(0x1ab)](_0x25f9c0[_0x4acd99(0x21b)],_0x3210de);const _0x1e5d53=collectSegmentRefsFromRule(_0x3210de);for(const _0x25a92e of _0x1e5d53){!_0x94a18c['has'](_0x25a92e)&&_0x163f6c['add'](_0x25a92e);}}_0x346771=Array[_0x4acd99(0x1ae)](_0x163f6c);}};return{'createYamlContext':_0xa2406,'prefetchJourneySegments':_0x34d256};}export async function executePushSegments(_0x54f7fd,_0x331ee6,_0x532ab5,_0x1ee0bf,_0x203a75){const _0x524681=a142_0x5a306c,{segmentDefToCreateRequest:_0x5852ab,segmentDefToUpdateRequest:_0x46817b}=await import(_0x524681(0x1b6)),_0x3feaa1=_0x532ab5[_0x524681(0x1d7)],_0x57e9e6=0x5,_0x2a5666=async _0xa2b9df=>{const _0x3cec86=_0x524681,_0x170dbd=_0xa2b9df[_0x3cec86(0x1f3)]?_0x3feaa1['get'](_0xa2b9df['folderPath']):undefined;let _0x23a8df;const _0x4e2240={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x37e4d9=_0xa2b9df[_0x3cec86(0x20d)];if(_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x2ac)]){const _0x305b9c=createSegmentIdResolver(_0x532ab5[_0x3cec86(0x21c)],_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]),_0x56e2f1=await resolveRuleSegmentIds(_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x2ac)],_0x305b9c);_0x37e4d9={..._0xa2b9df[_0x3cec86(0x20d)],'rule':_0x56e2f1};}try{if(_0xa2b9df['isNew']){_0x203a75[_0x3cec86(0x23b)]?.({'type':_0x3cec86(0x27f),'name':_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]});const _0x22157c=_0x5852ab(_0x37e4d9,_0x170dbd),_0x2b84a1=await _0x203a75[_0x3cec86(0x1fc)](_0x3cec86(0x282)+_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]+'\x27...',()=>_0x54f7fd[_0x3cec86(0x293)][_0x3cec86(0x2a5)](_0x1ee0bf[_0x3cec86(0x2b5)],_0x22157c));_0x23a8df=_0x2b84a1[_0x3cec86(0x298)]['id'],_0x532ab5[_0x3cec86(0x21c)]['set'](_0xa2b9df['yamlConfig'][_0x3cec86(0x279)],_0x23a8df),_0x4e2240[_0x3cec86(0x1f6)]={'name':_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)],'id':_0x23a8df},_0x203a75['onProgress']?.({'type':'segment_created','name':_0xa2b9df['yamlConfig'][_0x3cec86(0x279)],'segmentId':_0x23a8df}),_0x203a75[_0x3cec86(0x248)]?.(_0x3cec86(0x275)+_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]+'\x27'),_0x4e2240[_0x3cec86(0x26d)]=0x1;}else{if(_0xa2b9df[_0x3cec86(0x289)]){_0x203a75[_0x3cec86(0x23b)]?.({'type':'segment_updating','name':_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]});const _0x50ffb7=_0x46817b(_0x37e4d9);_0x170dbd!==_0xa2b9df[_0x3cec86(0x1f1)]?.[_0x3cec86(0x1cb)]&&(_0x50ffb7['segmentFolderId']=_0x170dbd?parseInt(_0x170dbd,0xa):undefined),await _0x203a75[_0x3cec86(0x1fc)](_0x3cec86(0x262)+_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]+'\x27...',()=>_0x54f7fd['segment'][_0x3cec86(0x1ee)](_0x1ee0bf['parentId'],_0xa2b9df[_0x3cec86(0x1f1)]['id'],_0x50ffb7)),_0x23a8df=_0xa2b9df['existingSegment']['id'],_0x203a75[_0x3cec86(0x23b)]?.({'type':_0x3cec86(0x2b3),'name':_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]}),_0x203a75[_0x3cec86(0x248)]?.(_0x3cec86(0x2a4)+_0xa2b9df['yamlConfig'][_0x3cec86(0x279)]+'\x27'),_0x4e2240[_0x3cec86(0x28b)]=0x1;}else _0x23a8df=_0xa2b9df[_0x3cec86(0x1f1)]['id'];}}catch(_0xc51819){const _0x1e37c8=isHttp400Error(_0xc51819),_0x3cf8b3=_0x1e37c8?ErrorCode[_0x3cec86(0x2a1)]:ErrorCode['SEGMENT_UPDATE_ERROR'],_0x3613e1=getErrorMessage(_0xc51819);throw new SDKError(_0x3cf8b3,_0x3cec86(0x2a8)+(_0xa2b9df['isNew']?_0x3cec86(0x244):_0x3cec86(0x209))+_0x3cec86(0x27e)+_0xa2b9df[_0x3cec86(0x211)]+_0x3cec86(0x1e2)+_0x3613e1,_0xc51819);}try{const _0x1dad4b=await syncActivationsForSegment(_0x54f7fd,_0x1ee0bf[_0x3cec86(0x2b5)],_0x23a8df,_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)],_0xa2b9df[_0x3cec86(0x1cc)],_0x203a75,_0xa2b9df[_0x3cec86(0x211)]);_0x4e2240[_0x3cec86(0x212)]=_0x1dad4b;}catch(_0x44fef0){if(_0x44fef0 instanceof SDKError)throw _0x44fef0;throw new SDKError(ErrorCode[_0x3cec86(0x217)],_0x3cec86(0x1b3)+_0xa2b9df[_0x3cec86(0x20d)][_0x3cec86(0x279)]+_0x3cec86(0x1b0)+_0xa2b9df[_0x3cec86(0x211)]+'\x0a\x20\x20'+getErrorMessage(_0x44fef0),_0x44fef0);}return _0x4e2240;},_0x178c08=await batchAsync(_0x331ee6,_0x2a5666,_0x57e9e6),_0x19a18e={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x20e46e of _0x178c08){_0x19a18e['created']+=_0x20e46e[_0x524681(0x26d)],_0x19a18e['updated']+=_0x20e46e[_0x524681(0x28b)],_0x20e46e[_0x524681(0x1f6)]&&_0x19a18e[_0x524681(0x228)][_0x524681(0x1ab)](_0x20e46e[_0x524681(0x1f6)][_0x524681(0x279)],_0x20e46e[_0x524681(0x1f6)]['id']),_0x19a18e[_0x524681(0x212)][_0x524681(0x26d)]+=_0x20e46e[_0x524681(0x212)][_0x524681(0x26d)],_0x19a18e['activations'][_0x524681(0x28b)]+=_0x20e46e[_0x524681(0x212)][_0x524681(0x28b)],_0x19a18e[_0x524681(0x212)][_0x524681(0x270)]+=_0x20e46e[_0x524681(0x212)][_0x524681(0x270)];}return _0x19a18e;}async function syncActivationsForSegment(_0x55343f,_0x36f8a5,_0x1f594a,_0x128923,_0x578f88,_0x4efab1,_0x4215fc){const _0x5461c8=a142_0x5a306c,_0x3ec185={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0xa89da9 of _0x578f88){try{if(_0xa89da9[_0x5461c8(0x1bc)]===_0x5461c8(0x244)&&_0xa89da9[_0x5461c8(0x23e)])_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x201),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),await _0x4efab1[_0x5461c8(0x1fc)](_0x5461c8(0x245)+_0xa89da9[_0x5461c8(0x279)]+_0x5461c8(0x1ac),()=>_0x55343f[_0x5461c8(0x293)][_0x5461c8(0x23c)](_0x36f8a5,_0x1f594a,_0xa89da9[_0x5461c8(0x23e)])),_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x22d),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),_0x4efab1[_0x5461c8(0x248)]?.(_0x5461c8(0x1fb)+_0xa89da9[_0x5461c8(0x279)]+'\x27'),_0x3ec185['created']++;else{if(_0xa89da9[_0x5461c8(0x1bc)]==='update'&&_0xa89da9['validatedRequest']&&_0xa89da9['existingActivation'])_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x1ff),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),await _0x4efab1[_0x5461c8(0x1fc)](_0x5461c8(0x1fd)+_0xa89da9['name']+_0x5461c8(0x1ac),()=>_0x55343f['segment'][_0x5461c8(0x1c3)](_0x36f8a5,_0x1f594a,_0xa89da9[_0x5461c8(0x1fe)]['id'],_0xa89da9[_0x5461c8(0x23e)])),_0x4efab1[_0x5461c8(0x23b)]?.({'type':_0x5461c8(0x26e),'segmentName':_0x128923,'activationName':_0xa89da9[_0x5461c8(0x279)]}),_0x4efab1['logSuccess']?.(_0x5461c8(0x1b9)+_0xa89da9['name']+'\x27'),_0x3ec185[_0x5461c8(0x28b)]++;else _0xa89da9[_0x5461c8(0x1bc)]==='delete'&&_0xa89da9['existingActivation']&&(_0x4efab1['onProgress']?.({'type':'activation_deleting','segmentName':_0x128923,'activationName':_0xa89da9['name']}),await _0x4efab1[_0x5461c8(0x1fc)]('Deleting\x20activation\x20\x27'+_0xa89da9[_0x5461c8(0x279)]+_0x5461c8(0x1ac),()=>_0x55343f['segment'][_0x5461c8(0x1b2)](_0x36f8a5,_0x1f594a,_0xa89da9[_0x5461c8(0x1fe)]['id'])),_0x4efab1[_0x5461c8(0x23b)]?.({'type':'activation_deleted','segmentName':_0x128923,'activationName':_0xa89da9['name']}),_0x4efab1[_0x5461c8(0x27a)]?.(_0x5461c8(0x1f9)+_0xa89da9[_0x5461c8(0x279)]+'\x27'),_0x3ec185[_0x5461c8(0x270)]++);}}catch(_0x639184){const _0x323c71=isHttp400Error(_0x639184),_0x222562=_0x323c71?ErrorCode['ACTIVATION_SYNTAX_ERROR']:ErrorCode['ACTIVATION_UPDATE_ERROR'],_0x76dd99=getErrorMessage(_0x639184);throw new SDKError(_0x222562,_0x5461c8(0x2a8)+_0xa89da9['type']+_0x5461c8(0x24a)+_0xa89da9[_0x5461c8(0x279)]+_0x5461c8(0x1b0)+_0x4215fc+'\x0a\x20\x20'+_0x76dd99,_0x639184);}}return _0x3ec185;}export async function executePushFolders(_0x1ee3de,_0x432e67,_0x313f51,_0x2450f2,_0x40f426){const _0x44b6ae=a142_0x5a306c,_0x4cdc30=new Map(_0x313f51),_0x53e781=sortFoldersByDepth(_0x432e67);for(const _0x548b15 of _0x53e781){const _0xdaa378=_0x548b15['split']('/'),_0x2cae8d=_0xdaa378[_0xdaa378[_0x44b6ae(0x22b)]-0x1],_0x98f1fa=_0xdaa378[_0x44b6ae(0x25f)](0x0,-0x1)[_0x44b6ae(0x26a)]('/'),_0x347f8c=_0x4cdc30[_0x44b6ae(0x219)](_0x98f1fa);_0x40f426['onProgress']?.({'type':_0x44b6ae(0x271),'folder':_0x548b15});const _0x2ffd59={'name':_0x2cae8d,'parentFolderId':_0x347f8c},_0x304984=await _0x40f426[_0x44b6ae(0x1fc)](_0x44b6ae(0x1ce)+_0x548b15+'\x27...',()=>_0x1ee3de[_0x44b6ae(0x293)]['createFolder'](_0x2450f2['parentId'],_0x2ffd59));_0x4cdc30['set'](_0x548b15,_0x304984['data']['id']),_0x40f426[_0x44b6ae(0x23b)]?.({'type':_0x44b6ae(0x1da),'folder':_0x548b15,'folderId':_0x304984[_0x44b6ae(0x298)]['id']}),_0x40f426[_0x44b6ae(0x287)]?.(_0x44b6ae(0x1d3)+_0x548b15+'\x27');}return _0x4cdc30;}export async function executePushSegmentDeletions(_0x17b8d1,_0x56494c,_0x534bd1){const _0x2bcb69=a142_0x5a306c;if(_0x56494c[_0x2bcb69(0x22b)]===0x0)return 0x0;const {batchAsync:_0x292003}=await import(_0x2bcb69(0x27c)),_0x23a56f=0x5,_0x4766e7=await _0x292003(_0x56494c,async _0x5e6b1a=>{const _0x171bab=_0x2bcb69;return _0x534bd1[_0x171bab(0x23b)]?.({'type':_0x171bab(0x207),'name':_0x5e6b1a[_0x171bab(0x279)]}),await _0x17b8d1[_0x171bab(0x293)][_0x171bab(0x222)](_0x5e6b1a['id']),_0x534bd1[_0x171bab(0x23b)]?.({'type':_0x171bab(0x1e1),'name':_0x5e6b1a[_0x171bab(0x279)]}),_0x534bd1[_0x171bab(0x27a)]?.('Deleted\x20segment\x20\x27'+_0x5e6b1a[_0x171bab(0x279)]+'\x27'),0x1;},_0x23a56f);return _0x4766e7[_0x2bcb69(0x272)]((_0x4f7c8b,_0x48a71e)=>_0x4f7c8b+_0x48a71e,0x0);}export async function executePushJourneys(_0x5cd9b2,_0x213369,_0x55b26d,_0x2bbe6b,_0x2ffd90){const _0x2bde97=a142_0x5a306c,{journeyDefToRequest:_0x411007}=await import(_0x2bde97(0x266)),{activationDefToCreateRequest:_0x2c3ac9,yamlRuleToApi:_0x283244,validateSegmentRule:_0x5e7b95}=await import(_0x2bde97(0x1b6)),_0x5c57a2={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x4d8251=new Map(_0x55b26d[_0x2bde97(0x21c)]),_0x395c30=0x5;for(let _0x46364c=0x0;_0x46364c<_0x213369[_0x2bde97(0x22b)];_0x46364c+=_0x395c30){const _0x50148a=_0x213369['slice'](_0x46364c,_0x46364c+_0x395c30),_0x577faa=await Promise[_0x2bde97(0x229)](_0x50148a[_0x2bde97(0x26f)](async _0x30f2f5=>{const _0x5c477a=_0x2bde97;if(!_0x30f2f5[_0x5c477a(0x292)]&&!_0x30f2f5[_0x5c477a(0x289)])return{'action':_0x5c477a(0x264),'name':_0x30f2f5['yamlConfig']['name'],'journeyId':_0x30f2f5[_0x5c477a(0x256)]?.['id']};const _0x394b66=_0x30f2f5[_0x5c477a(0x1f3)]?_0x55b26d[_0x5c477a(0x1d7)][_0x5c477a(0x219)](_0x30f2f5[_0x5c477a(0x1f3)]):undefined;_0x2ffd90[_0x5c477a(0x23b)]?.({'type':_0x30f2f5[_0x5c477a(0x292)]?_0x5c477a(0x1e3):'journey_updating','name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]});try{const _0x334b22=await executeSingleJourneyPush(_0x5cd9b2,_0x30f2f5,{..._0x55b26d,'segmentNameToId':_0x4d8251},{'parentId':_0x2bbe6b[_0x5c477a(0x2b5)],'rootFolderId':_0x2bbe6b[_0x5c477a(0x2aa)],'folderId':_0x394b66,'verbose':_0x2bbe6b[_0x5c477a(0x1d5)]},_0x2ffd90,{'journeyDefToRequest':_0x411007,'activationDefToCreateRequest':_0x2c3ac9,'yamlRuleToApi':_0x283244,'validateSegmentRule':_0x5e7b95});for(const [_0x3786b5,_0x3815a9]of _0x334b22[_0x5c477a(0x25c)]){_0x4d8251[_0x5c477a(0x1ab)](_0x3786b5,_0x3815a9),_0x5c57a2[_0x5c477a(0x25c)][_0x5c477a(0x1ab)](_0x3786b5,_0x3815a9);}if(_0x334b22[_0x5c477a(0x261)]===_0x5c477a(0x26d))_0x2ffd90[_0x5c477a(0x23b)]?.({'type':'journey_created','name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)],'journeyId':_0x334b22['journeyId']}),_0x2ffd90[_0x5c477a(0x248)]?.(_0x5c477a(0x294)+_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]+'\x27'),_0x5c57a2[_0x5c477a(0x26d)]++;else _0x334b22[_0x5c477a(0x261)]===_0x5c477a(0x28b)&&(_0x2ffd90['onProgress']?.({'type':'journey_updated','name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]}),_0x2ffd90[_0x5c477a(0x248)]?.(_0x5c477a(0x253)+_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)]+'\x27'),_0x5c57a2[_0x5c477a(0x28b)]++);return{'action':_0x334b22[_0x5c477a(0x261)],'name':_0x30f2f5[_0x5c477a(0x20d)][_0x5c477a(0x279)],'journeyId':_0x334b22['journeyId']};}catch(_0x437415){const _0x2a6ee9=isHttp400Error(_0x437415),_0x57c97d=_0x2a6ee9?ErrorCode[_0x5c477a(0x1c6)]:ErrorCode[_0x5c477a(0x21e)],_0x2e6ee1=getErrorMessage(_0x437415);throw new SDKError(_0x57c97d,_0x5c477a(0x2a8)+(_0x30f2f5[_0x5c477a(0x292)]?_0x5c477a(0x244):_0x5c477a(0x209))+_0x5c477a(0x1e4)+_0x30f2f5[_0x5c477a(0x211)]+_0x5c477a(0x1e2)+_0x2e6ee1,_0x437415);}}));_0x5c57a2[_0x2bde97(0x236)][_0x2bde97(0x25e)](..._0x577faa);}return _0x5c57a2;}async function matchExistingJourneySegments(_0x25b8d6,_0x44173d,_0x342fd5,_0x4c6dd4,_0x46c111){const _0x5e9559=a142_0x5a306c;if(!_0x44173d[_0x5e9559(0x256)]||!_0x44173d[_0x5e9559(0x20d)][_0x5e9559(0x274)])return;const _0x203aa4=new Map(),_0x5b5d87=new Set();for(const _0x3ddd1d of Object[_0x5e9559(0x21a)](_0x44173d[_0x5e9559(0x20d)][_0x5e9559(0x274)])){const _0x3498cb=generateDeterministicJourneySegmentName(_0x44173d[_0x5e9559(0x20d)]['name'],_0x3ddd1d);_0x203aa4[_0x5e9559(0x1ab)](_0x3498cb,_0x3ddd1d),_0x5b5d87['add'](_0x3ddd1d);}const _0x4c44e3=[],_0x315004=collectSegmentIdsFromJourneyApi(_0x44173d[_0x5e9559(0x256)]);for(const _0x33e9d8 of _0x315004){const _0x243bcf=await fetchSegment(_0x25b8d6,_0x342fd5,_0x33e9d8,_0x4c6dd4);if(!_0x243bcf?.[_0x5e9559(0x279)])continue;const _0x89685e=_0x203aa4[_0x5e9559(0x219)](_0x243bcf[_0x5e9559(0x279)]);_0x89685e?(_0x46c111[_0x5e9559(0x1ab)](_0x89685e,_0x33e9d8),_0x5b5d87['delete'](_0x89685e)):_0x4c44e3[_0x5e9559(0x25e)]({'id':_0x33e9d8,'seg':_0x243bcf});}if(_0x5b5d87[_0x5e9559(0x208)]>0x0&&_0x4c44e3[_0x5e9559(0x22b)]>0x0){const {localExpandedRuleToNames:_0x228fd0}=buildLocalExpandedRuleMappings(_0x44173d[_0x5e9559(0x20d)]),_0x25bc2f=new Map();for(const {id:_0x2dcf1b,seg:_0xf13506}of _0x4c44e3){if(_0xf13506[_0x5e9559(0x2ac)]){const _0x30680a=apiRuleToYaml(_0xf13506[_0x5e9559(0x2ac)]);_0x25bc2f[_0x5e9559(0x1ab)](_0x2dcf1b,_0x30680a);}}for(const {id:_0x15b6f5,seg:_0x32e59e}of _0x4c44e3){if(!_0x32e59e[_0x5e9559(0x2ac)])continue;const _0x773cd6=_0x25bc2f[_0x5e9559(0x219)](_0x15b6f5);if(!_0x773cd6)continue;const _0x31f5df=serializeExpandedRule(_0x773cd6,_0x25bc2f),_0x57b7ea=_0x228fd0[_0x5e9559(0x219)](_0x31f5df);if(_0x57b7ea){const _0xf0436f=_0x57b7ea[_0x5e9559(0x216)](_0x37efe4=>_0x5b5d87[_0x5e9559(0x26b)](_0x37efe4));_0xf0436f&&(_0x46c111[_0x5e9559(0x1ab)](_0xf0436f,_0x15b6f5),_0x5b5d87['delete'](_0xf0436f),logger[_0x5e9559(0x1c0)](_0x5e9559(0x1ea)+_0x32e59e[_0x5e9559(0x279)]+_0x5e9559(0x200)+_0xf0436f+_0x5e9559(0x258)));}}}}async function executeSingleJourneyPush(_0x469cd5,_0xed8866,_0xd380cd,_0x59a74c,_0x46f8be,_0xc0b28f){const _0x395fd4=a142_0x5a306c,{journeyDefToRequest:_0x3e4824,activationDefToCreateRequest:_0x492e4b,yamlRuleToApi:_0x173cce,validateSegmentRule:_0x5ed4b4}=_0xc0b28f,_0x4f0fcb=new Map(),_0x150810=new Map();recoverSegmentIdsFromPushRecovery(_0xed8866,_0x4f0fcb,_0xd380cd['segmentNameToId']);const _0x5dddb7=new Map(),_0x22020c=new Map(),_0x525947=new Map();let _0x99b9d1;const _0x5a0519=async()=>{const _0x3aaea0=a142_0x7272;if(_0x99b9d1)return;_0x99b9d1=new Map();if(!_0xed8866[_0x3aaea0(0x256)])return;const _0x5d44b5=await _0x469cd5['journey'][_0x3aaea0(0x24c)](_0xed8866[_0x3aaea0(0x256)]['id']);for(const _0x4b8a09 of _0x5d44b5){const _0x40256d=journeyActivationStepToYaml(_0x4b8a09,_0xd380cd['idToEmailMap'],_0xd380cd[_0x3aaea0(0x24e)]),_0x5f0c27=activationSignature(_0x40256d);!_0x99b9d1[_0x3aaea0(0x26b)](_0x5f0c27)&&_0x99b9d1[_0x3aaea0(0x1ab)](_0x5f0c27,_0x4b8a09['id']),_0x40256d['name']&&_0x150810[_0x3aaea0(0x1ab)](_0x40256d['name'],_0x4b8a09['id']);}};await matchExistingJourneySegments(_0x469cd5,_0xed8866,_0x59a74c[_0x395fd4(0x2b5)],_0xd380cd[_0x395fd4(0x1c2)],_0xd380cd[_0x395fd4(0x21c)]);const _0x473882={'resolveSegmentId':async _0x403950=>{const _0x1617f3=_0x395fd4,_0x187ef0=_0xd380cd[_0x1617f3(0x21c)][_0x1617f3(0x219)](_0x403950);if(!_0x187ef0)throw new SDKError(ErrorCode[_0x1617f3(0x295)],_0x1617f3(0x276)+_0x403950+'\x20(referenced\x20in\x20journey\x20'+_0xed8866[_0x1617f3(0x20d)][_0x1617f3(0x279)]+')');return _0x187ef0;},'resolveEmbeddedSegmentId':async(_0x5de2fe,_0x2b29c9)=>{const _0x29f0a4=_0x395fd4,_0x3df736=_0xd380cd['segmentNameToId']['get'](_0x5de2fe);if(_0x3df736)return _0x3df736;const _0x16c795=_0xd380cd[_0x29f0a4(0x1c2)][_0x29f0a4(0x216)](_0x2fd84f=>_0x2fd84f['name']===_0x5de2fe);if(_0x16c795)return _0xd380cd[_0x29f0a4(0x21c)]['set'](_0x5de2fe,_0x16c795['id']),_0x16c795['id'];if(_0xed8866['isNew']){const {stageName:_0x5c1e0c,criteriaName:_0x11276d}=findSegmentCriteriaLocation(_0xed8866[_0x29f0a4(0x20d)],_0x5de2fe);return _0x5ed4b4(_0x5de2fe,_0x2b29c9[_0x29f0a4(0x2ac)]),_0x22020c[_0x29f0a4(0x1ab)](_0x5de2fe,{'definition':_0x2b29c9,'stageName':_0x5c1e0c,'criteriaName':_0x11276d}),createPendingSegmentId(_0x5de2fe);}const _0x3bb3a5=_0xed8866[_0x29f0a4(0x256)]?.['id'];if(!_0x3bb3a5)throw new SDKError(ErrorCode[_0x29f0a4(0x22f)],_0x29f0a4(0x1cf));const _0x2c87c4=_0x5dddb7['get'](_0x5de2fe);if(_0x2c87c4)return _0x2c87c4;const _0x339150=((async()=>{const _0x5bccdb=_0x29f0a4;_0x5ed4b4(_0x5de2fe,_0x2b29c9['rule']);const _0x4f0f62=generateDeterministicJourneySegmentName(_0xed8866[_0x5bccdb(0x20d)][_0x5bccdb(0x279)],_0x5de2fe),_0x77c0ea=_0xd380cd[_0x5bccdb(0x1c2)][_0x5bccdb(0x216)](_0x27b25a=>_0x27b25a[_0x5bccdb(0x279)]===_0x4f0f62),_0x693feb=createSegmentIdResolver(_0xd380cd[_0x5bccdb(0x21c)],_0x5de2fe),_0x4d8542=await resolveRuleSegmentIds(_0x2b29c9['rule'],_0x693feb);let _0x4809da;return _0x77c0ea?(await _0x469cd5[_0x5bccdb(0x293)][_0x5bccdb(0x1ee)](_0x59a74c[_0x5bccdb(0x2b5)],_0x77c0ea['id'],{'description':_0x2b29c9[_0x5bccdb(0x1ba)]||_0x5bccdb(0x1b1)+_0x5de2fe,'rule':_0x173cce(_0x4d8542,!![]),'countPopulation':!![]}),_0x4809da=_0x77c0ea['id'],saveSegmentToPushRecovery(_0xed8866[_0x5bccdb(0x211)],_0xed8866[_0x5bccdb(0x20d)]['name'],_0x5de2fe,{'segmentId':_0x4809da,'uniqueServerName':_0x4f0f62,'createdAt':new Date()[_0x5bccdb(0x29f)]()})):_0x4809da=await createOrRecoverEmbeddedSegment(_0x469cd5,_0xed8866,{'localName':_0x5de2fe,'uniqueSegmentName':_0x4f0f62,'description':_0x2b29c9['description']||_0x5bccdb(0x1b1)+_0x5de2fe,'journeyId':_0x3bb3a5,'resolvedRule':_0x4d8542,'parentId':_0x59a74c['parentId'],'folderId':_0x59a74c['rootFolderId']||''},_0x173cce),_0xd380cd[_0x5bccdb(0x21c)][_0x5bccdb(0x1ab)](_0x5de2fe,_0x4809da),_0x4f0fcb[_0x5bccdb(0x1ab)](_0x5de2fe,_0x4809da),_0x4809da;})());_0x5dddb7[_0x29f0a4(0x1ab)](_0x5de2fe,_0x339150);try{return await _0x339150;}finally{_0x5dddb7[_0x29f0a4(0x1e8)](_0x5de2fe);}},'resolveActivationId':async _0x1f864c=>{const _0x3c3503=_0x395fd4,_0x444cd4=_0x150810['get'](_0x1f864c);if(_0x444cd4)return _0x444cd4;if(_0xed8866[_0x3c3503(0x256)]){await _0x5a0519();const _0x38a4f3=_0x150810[_0x3c3503(0x219)](_0x1f864c);if(_0x38a4f3)return _0x38a4f3;}throw new SDKError(ErrorCode['NOT_FOUND'],'Activation\x20not\x20found:\x20'+_0x1f864c+'\x20(referenced\x20in\x20journey\x20'+_0xed8866['yamlConfig'][_0x3c3503(0x279)]+_0x3c3503(0x1b5)+_0x3c3503(0x203));},'resolveEmbeddedActivationId':async(_0x2264c1,_0x71819)=>{const _0x5a5ae9=_0x395fd4,_0x2def73=_0x150810['get'](_0x2264c1);if(_0x2def73)return _0x2def73;if(_0xed8866[_0x5a5ae9(0x292)])return _0x525947[_0x5a5ae9(0x1ab)](_0x2264c1,_0x71819),createPendingActivationId(_0x2264c1);if(_0xed8866['existingJourney']){await _0x5a0519();const _0x36e78e=_0x150810[_0x5a5ae9(0x219)](_0x71819['name']);if(_0x36e78e)return _0x150810['set'](_0x2264c1,_0x36e78e),_0x36e78e;const _0x3e745f=activationSignature(_0x71819),_0x49b7de=_0x99b9d1?.[_0x5a5ae9(0x219)](_0x3e745f);if(_0x49b7de)return _0x150810[_0x5a5ae9(0x1ab)](_0x2264c1,_0x49b7de),_0x49b7de;const _0x41ae00=await _0x492e4b(_0x71819,_0xd380cd[_0x5a5ae9(0x1cd)]),_0x4af30a={..._0x41ae00,..._0x71819['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x71819['run_after_journey_refresh']}},_0x2a3765=await _0x469cd5['journey'][_0x5a5ae9(0x23c)](_0xed8866[_0x5a5ae9(0x256)]['id'],_0x4af30a);return _0x150810[_0x5a5ae9(0x1ab)](_0x2264c1,_0x2a3765['id']),_0x2a3765['id'];}throw new SDKError(ErrorCode[_0x5a5ae9(0x22f)],_0x5a5ae9(0x1ef));},'resolveJourneyId':async _0x4d05b5=>{const _0x29a4ea=_0x395fd4;try{return await _0x469cd5[_0x29a4ea(0x268)][_0x29a4ea(0x1c4)](_0x59a74c['parentId'],_0x4d05b5);}catch(_0x3f4e53){throw new SDKError(ErrorCode['NOT_FOUND'],_0x29a4ea(0x1f2)+_0x4d05b5+_0x29a4ea(0x1c9)+_0xed8866[_0x29a4ea(0x20d)][_0x29a4ea(0x279)]+'\x27)',_0x3f4e53);}},'resolveStageId':async(_0x306bd9,_0x3eb23d)=>{const _0xb9af77=_0x395fd4,_0x1df470=await _0x469cd5[_0xb9af77(0x268)]['getJourney'](_0x306bd9),_0x149fa5=_0x1df470[_0xb9af77(0x235)][_0xb9af77(0x21f)][_0xb9af77(0x216)](_0x32b7ed=>_0x32b7ed['name'][_0xb9af77(0x1bf)]()===_0x3eb23d[_0xb9af77(0x1bf)]());if(!_0x149fa5?.['id'])throw new SDKError(ErrorCode[_0xb9af77(0x1d9)],_0xb9af77(0x1f5)+_0x3eb23d+_0xb9af77(0x25d)+(_0x1df470[_0xb9af77(0x235)]['journeyBundleName']||_0x1df470[_0xb9af77(0x235)][_0xb9af77(0x279)])+'\x27');return _0x149fa5['id'];}},_0x42c89c=await _0x3e4824(_0xed8866[_0x395fd4(0x20d)],_0x59a74c['parentId'],_0x473882),_0x4ceb27=_0x59a74c[_0x395fd4(0x1ad)]||_0x59a74c[_0x395fd4(0x2aa)];_0x4ceb27&&(_0x42c89c['relationships']={'parentFolder':{'data':{'id':_0x4ceb27,'type':_0x395fd4(0x29e)}}});if(_0xed8866['isNew']){if(_0x22020c[_0x395fd4(0x208)]>0x0||_0x525947['size']>0x0)return await executeThreeStepJourneyCreate(_0x469cd5,_0xed8866,_0x42c89c,{'pendingEmbeddedSegments':_0x22020c,'pendingEmbeddedActivations':_0x525947,'embeddedSegmentNameToId':_0x4f0fcb,'journeyActivationNameToId':_0x150810},{..._0x59a74c,'effectiveFolderId':_0x4ceb27},_0xd380cd,_0x46f8be,_0xc0b28f);else{ensureJourneyDefaults(_0x42c89c[_0x395fd4(0x235)]);const _0x23dbb7=await _0x469cd5['journey'][_0x395fd4(0x244)](_0x42c89c);return deletePushRecovery(_0xed8866[_0x395fd4(0x211)]),{'action':_0x395fd4(0x26d),'journeyId':_0x23dbb7['id'],'embeddedSegmentNameToId':_0x4f0fcb};}}else{if(_0xed8866['hasChanges']&&_0xed8866[_0x395fd4(0x256)]){_0x42c89c['id']=_0xed8866[_0x395fd4(0x256)]['id'];const _0x51ff19=_0x42c89c[_0x395fd4(0x235)];_0xed8866[_0x395fd4(0x256)][_0x395fd4(0x235)]?.[_0x395fd4(0x20e)]&&(_0x51ff19[_0x395fd4(0x20e)]=_0xed8866[_0x395fd4(0x256)]['attributes'][_0x395fd4(0x20e)]);const _0x243bf0=_0xed8866[_0x395fd4(0x256)][_0x395fd4(0x235)]?.[_0x395fd4(0x21f)];return _0x243bf0&&_0x42c89c['attributes']['journeyStages']&&injectExistingStageIds(_0x42c89c[_0x395fd4(0x235)]['journeyStages'],_0x243bf0),ensureJourneyDefaults(_0x51ff19),await _0x469cd5['journey']['update'](_0xed8866[_0x395fd4(0x256)]['id'],_0x42c89c),deletePushRecovery(_0xed8866[_0x395fd4(0x211)]),{'action':_0x395fd4(0x28b),'journeyId':_0xed8866[_0x395fd4(0x256)]['id'],'embeddedSegmentNameToId':_0x4f0fcb};}}return deletePushRecovery(_0xed8866[_0x395fd4(0x211)]),{'action':_0x395fd4(0x264),'journeyId':_0xed8866[_0x395fd4(0x256)]?.['id'],'embeddedSegmentNameToId':_0x4f0fcb};}function findSegmentCriteriaLocation(_0x2e7807,_0x1ec05a){const _0xc4b345=a142_0x5a306c,_0x36586d=_0x2e7807[_0xc4b345(0x2b1)]||_0x2e7807['journeys']?.[0x0]?.[_0xc4b345(0x2b1)]||[];let _0x5d0c47=_0xc4b345(0x1e9),_0xf583f6=_0x1ec05a;const _0x3573f6=_0x2e7807[_0xc4b345(0x1f4)]||_0x2e7807[_0xc4b345(0x1c5)]?.[0x0]?.[_0xc4b345(0x1f4)];if(_0x3573f6?.[_0xc4b345(0x293)]===_0x1ec05a)return{'stageName':_0xc4b345(0x1f4),'criteriaName':_0x3573f6['name']||_0x1ec05a};_0x33382c:for(const _0x575337 of _0x36586d){if(_0x575337['entry_criteria']?.[_0xc4b345(0x293)]===_0x1ec05a){_0x5d0c47=_0x575337[_0xc4b345(0x279)],_0xf583f6=_0x575337[_0xc4b345(0x1d0)][_0xc4b345(0x279)]||_0x1ec05a;break;}if(_0x575337[_0xc4b345(0x249)])for(const _0x136f5a of _0x575337[_0xc4b345(0x249)]){if(_0x136f5a[_0xc4b345(0x1bc)]===_0xc4b345(0x28c)&&_0x136f5a[_0xc4b345(0x234)]?.['branches'])for(const _0x59dcc5 of _0x136f5a['with'][_0xc4b345(0x2af)]){if(_0x59dcc5[_0xc4b345(0x293)]===_0x1ec05a){_0x5d0c47=_0x575337['name'],_0xf583f6=_0x59dcc5[_0xc4b345(0x279)]||_0x1ec05a;break _0x33382c;}}}}return{'stageName':_0x5d0c47,'criteriaName':_0xf583f6};}async function executeThreeStepJourneyCreate(_0x2891ad,_0x457760,_0x27a347,_0x4ef0c2,_0x7a5f41,_0x3ca15f,_0x5a408c,_0xce49bf){const _0x3422ef=a142_0x5a306c,{activationDefToCreateRequest:_0x2a392a,yamlRuleToApi:_0x222641}=_0xce49bf,{pendingEmbeddedSegments:_0x47ee2b,pendingEmbeddedActivations:_0x226a35,embeddedSegmentNameToId:_0x2ba869}=_0x4ef0c2,_0x2caddd=JSON['parse'](JSON[_0x3422ef(0x25b)](_0x27a347));ensureJourneyDefaults(_0x2caddd[_0x3422ef(0x235)]),stripPendingIds(_0x2caddd);const _0x91e7a=await _0x2891ad[_0x3422ef(0x268)][_0x3422ef(0x244)](_0x2caddd),_0x5239da=_0x91e7a['id'],_0x15c939=new Map();for(const _0x51e899 of _0x91e7a[_0x3422ef(0x235)]['journeyStages']){_0x15c939[_0x3422ef(0x1ab)](_0x51e899[_0x3422ef(0x279)][_0x3422ef(0x1bf)](),_0x51e899['id']);}recoverSegmentIdsFromPushRecovery(_0x457760,_0x2ba869,_0x3ca15f[_0x3422ef(0x21c)]);for(const [_0x37a80c,{definition:_0x31a9cc}]of _0x47ee2b){if(_0x2ba869['has'](_0x37a80c)){_0x5a408c[_0x3422ef(0x23b)]?.({'type':'embedded_segment_created','journeyName':_0x457760[_0x3422ef(0x20d)][_0x3422ef(0x279)],'segmentName':_0x37a80c});continue;}const _0x5baf36=generateDeterministicJourneySegmentName(_0x457760['yamlConfig']['name'],_0x37a80c);_0x5a408c[_0x3422ef(0x23b)]?.({'type':'embedded_segment_creating','journeyName':_0x457760[_0x3422ef(0x20d)]['name'],'segmentName':_0x37a80c});const _0x3a4cf0=createSegmentIdResolver(_0x3ca15f[_0x3422ef(0x21c)],_0x37a80c),_0x44fddf=await resolveRuleSegmentIds(_0x31a9cc[_0x3422ef(0x2ac)],_0x3a4cf0),_0x564b19=await createOrRecoverEmbeddedSegment(_0x2891ad,_0x457760,{'localName':_0x37a80c,'uniqueSegmentName':_0x5baf36,'description':_0x31a9cc[_0x3422ef(0x1ba)]||_0x3422ef(0x1b1)+_0x37a80c,'journeyId':_0x5239da,'resolvedRule':_0x44fddf,'parentId':_0x7a5f41[_0x3422ef(0x2b5)],'folderId':_0x7a5f41[_0x3422ef(0x23f)]||''},_0x222641);_0x2ba869['set'](_0x37a80c,_0x564b19),_0x3ca15f[_0x3422ef(0x21c)][_0x3422ef(0x1ab)](_0x37a80c,_0x564b19),_0x5a408c[_0x3422ef(0x23b)]?.({'type':_0x3422ef(0x230),'journeyName':_0x457760[_0x3422ef(0x20d)][_0x3422ef(0x279)],'segmentName':_0x37a80c});}const _0x4b4f1c=new Map();for(const [_0x5595ae,_0x160930]of _0x226a35){_0x5a408c[_0x3422ef(0x23b)]?.({'type':_0x3422ef(0x2a9),'journeyName':_0x457760['yamlConfig'][_0x3422ef(0x279)],'activationName':_0x5595ae});const _0x3a38d1=await _0x2a392a(_0x160930,_0x3ca15f[_0x3422ef(0x1cd)]),_0x1996a0={..._0x3a38d1,..._0x160930['run_after_journey_refresh']!==undefined&&{'runAfterJourneyRefresh':_0x160930[_0x3422ef(0x1be)]}},_0x43ef5d=await _0x2891ad[_0x3422ef(0x268)]['createActivation'](_0x5239da,_0x1996a0);_0x4b4f1c[_0x3422ef(0x1ab)](_0x5595ae,_0x43ef5d['id']),_0x4ef0c2[_0x3422ef(0x29d)]['set'](_0x5595ae,_0x43ef5d['id']),_0x5a408c['onProgress']?.({'type':_0x3422ef(0x252),'journeyName':_0x457760[_0x3422ef(0x20d)]['name'],'activationName':_0x5595ae});}const _0x537a25=JSON[_0x3422ef(0x281)](JSON['stringify'](_0x27a347));return _0x537a25['id']=_0x5239da,ensureJourneyDefaults(_0x537a25[_0x3422ef(0x235)]),resolvePendingIdsInRequest(_0x537a25,_0x27a347,_0x15c939,_0x2ba869,_0x4b4f1c,_0x5a408c),await _0x2891ad[_0x3422ef(0x268)][_0x3422ef(0x209)](_0x5239da,_0x537a25),deletePushRecovery(_0x457760[_0x3422ef(0x211)]),{'action':_0x3422ef(0x26d),'journeyId':_0x5239da,'embeddedSegmentNameToId':_0x2ba869};}export function stripWaitStepPendingIds(_0x5f39ee){const _0x58a702=a142_0x5a306c,_0x19d704=_0x5f39ee['conditionSegmentId']&&isPendingSegmentId(_0x5f39ee[_0x58a702(0x2ad)]),_0x215287=_0x5f39ee[_0x58a702(0x21d)]?.[_0x58a702(0x269)](_0x5b755d=>_0x5b755d[_0x58a702(0x21b)]&&isPendingSegmentId(_0x5b755d['segmentId']));(_0x19d704||_0x215287)&&(_0x5f39ee[_0x58a702(0x20f)]='Duration',_0x5f39ee[_0x58a702(0x1dc)]=0x1,_0x5f39ee[_0x58a702(0x1f0)]='day',delete _0x5f39ee[_0x58a702(0x2ad)],delete _0x5f39ee[_0x58a702(0x1db)],delete _0x5f39ee[_0x58a702(0x278)],delete _0x5f39ee['conditions']);}export function resolveWaitStepPendingIds(_0x4e4be2,_0x1c4d88,_0x229ccf,_0x87fa72){const _0x2a9ad2=a142_0x5a306c;if(_0x1c4d88['conditionSegmentId']&&isPendingSegmentId(_0x1c4d88[_0x2a9ad2(0x2ad)])){const _0x4c1841=_0x229ccf(_0x1c4d88[_0x2a9ad2(0x2ad)],_0x2a9ad2(0x254)+_0x87fa72+_0x2a9ad2(0x238));_0x4c1841&&(_0x4e4be2[_0x2a9ad2(0x20f)]=_0x2a9ad2(0x233),_0x4e4be2[_0x2a9ad2(0x2ad)]=_0x4c1841,delete _0x4e4be2[_0x2a9ad2(0x1dc)],delete _0x4e4be2[_0x2a9ad2(0x1f0)],_0x1c4d88['conditionTimeoutDuration']!==undefined&&(_0x4e4be2[_0x2a9ad2(0x1db)]=_0x1c4d88[_0x2a9ad2(0x1db)]),_0x1c4d88[_0x2a9ad2(0x278)]&&(_0x4e4be2[_0x2a9ad2(0x278)]=_0x1c4d88[_0x2a9ad2(0x278)]));}if(_0x1c4d88[_0x2a9ad2(0x21d)]){const _0x3d9dc1=_0x1c4d88[_0x2a9ad2(0x21d)][_0x2a9ad2(0x269)](_0x2f0cd2=>_0x2f0cd2[_0x2a9ad2(0x21b)]&&isPendingSegmentId(_0x2f0cd2[_0x2a9ad2(0x21b)]));if(_0x3d9dc1){const _0x5aabfa=_0x1c4d88[_0x2a9ad2(0x21d)][_0x2a9ad2(0x26f)](_0x26c61e=>{const _0x535f90=_0x2a9ad2;if(_0x26c61e[_0x535f90(0x21b)]&&isPendingSegmentId(_0x26c61e['segmentId'])){const _0x25c8ce=_0x229ccf(_0x26c61e[_0x535f90(0x21b)],_0x535f90(0x254)+_0x87fa72+_0x535f90(0x238));return{..._0x26c61e,'segmentId':_0x25c8ce||_0x26c61e[_0x535f90(0x21b)]};}return{..._0x26c61e};});_0x4e4be2[_0x2a9ad2(0x20f)]='Condition',_0x4e4be2[_0x2a9ad2(0x21d)]=_0x5aabfa,delete _0x4e4be2['waitStep'],delete _0x4e4be2[_0x2a9ad2(0x1f0)],delete _0x4e4be2[_0x2a9ad2(0x2ad)],delete _0x4e4be2[_0x2a9ad2(0x1db)],delete _0x4e4be2[_0x2a9ad2(0x278)];}}}function stripPendingIds(_0x4bb7db){const _0x557559=a142_0x5a306c;_0x4bb7db[_0x557559(0x235)][_0x557559(0x1f4)]?.[_0x557559(0x21b)]&&isPendingSegmentId(_0x4bb7db['attributes']['goal'][_0x557559(0x21b)])&&delete _0x4bb7db[_0x557559(0x235)][_0x557559(0x1f4)];for(const _0x4bba76 of _0x4bb7db[_0x557559(0x235)][_0x557559(0x21f)]||[]){_0x4bba76[_0x557559(0x2b4)]?.['segmentId']&&isPendingSegmentId(_0x4bba76['entryCriteria'][_0x557559(0x21b)])&&delete _0x4bba76[_0x557559(0x2b4)];_0x4bba76[_0x557559(0x239)]?.[_0x557559(0x21b)]&&isPendingSegmentId(_0x4bba76[_0x557559(0x239)][_0x557559(0x21b)])&&delete _0x4bba76[_0x557559(0x239)];_0x4bba76[_0x557559(0x285)]&&(_0x4bba76[_0x557559(0x285)]=_0x4bba76[_0x557559(0x285)]['filter'](_0x540d63=>!_0x540d63['segmentId']||!isPendingSegmentId(_0x540d63['segmentId'])));if(_0x4bba76[_0x557559(0x249)])for(const _0x24d2e5 of Object['keys'](_0x4bba76[_0x557559(0x249)])){const _0x626179=_0x4bba76[_0x557559(0x249)][_0x24d2e5];_0x626179['type']===_0x557559(0x2ae)&&_0x626179['journeyActivationStepId']&&isPendingActivationId(_0x626179[_0x557559(0x205)])&&(_0x626179['journeyActivationStepId']='');if(_0x626179[_0x557559(0x1bc)]===_0x557559(0x1d1)&&_0x626179[_0x557559(0x2af)])for(const _0x20aa26 of _0x626179['branches']){_0x20aa26[_0x557559(0x21b)]&&isPendingSegmentId(_0x20aa26[_0x557559(0x21b)])&&(_0x20aa26['segmentId']='');}_0x626179[_0x557559(0x1bc)]===_0x557559(0x260)&&stripWaitStepPendingIds(_0x626179);}}}function resolvePendingIdsInRequest(_0x3b7dd0,_0xfbe5bb,_0x3bd5b4,_0x4d99ea,_0x29ba1d,_0x57cffd){const _0x2a6324=a142_0x5a306c,_0x30df2f=(_0x54072f,_0x20a4dd)=>{const _0xa97faa=a142_0x7272;if(!isPendingSegmentId(_0x54072f))return _0x54072f;const _0x251981=extractPendingSegmentName(_0x54072f),_0x3fa3e9=_0x4d99ea['get'](_0x251981);return!_0x3fa3e9&&_0x57cffd[_0xa97faa(0x2a3)]?.(_0xa97faa(0x225)+_0x251981+'\x27\x20for\x20'+_0x20a4dd),_0x3fa3e9;};if(_0x3b7dd0[_0x2a6324(0x235)][_0x2a6324(0x1f4)]?.[_0x2a6324(0x21b)]&&isPendingSegmentId(_0x3b7dd0['attributes']['goal'][_0x2a6324(0x21b)])){const _0x543d8c=_0x30df2f(_0x3b7dd0[_0x2a6324(0x235)][_0x2a6324(0x1f4)][_0x2a6324(0x21b)],_0x2a6324(0x218));_0x543d8c&&(_0x3b7dd0[_0x2a6324(0x235)][_0x2a6324(0x1f4)][_0x2a6324(0x21b)]=_0x543d8c);}for(const _0x2d460e of _0x3b7dd0[_0x2a6324(0x235)]['journeyStages']||[]){const _0x2b7db3=_0x3bd5b4[_0x2a6324(0x219)](_0x2d460e[_0x2a6324(0x279)][_0x2a6324(0x1bf)]());_0x2b7db3&&(_0x2d460e['id']=_0x2b7db3);if(_0x2d460e['entryCriteria']?.['segmentId']&&isPendingSegmentId(_0x2d460e[_0x2a6324(0x2b4)][_0x2a6324(0x21b)])){const _0x1ff389=_0x30df2f(_0x2d460e[_0x2a6324(0x2b4)][_0x2a6324(0x21b)],_0x2a6324(0x254)+_0x2d460e['name']+_0x2a6324(0x240));_0x1ff389&&(_0x2d460e[_0x2a6324(0x2b4)][_0x2a6324(0x21b)]=_0x1ff389);}if(_0x2d460e[_0x2a6324(0x285)])for(const _0x1467f7 of _0x2d460e[_0x2a6324(0x285)]){if(_0x1467f7['segmentId']&&isPendingSegmentId(_0x1467f7[_0x2a6324(0x21b)])){const _0x5a8684=_0x30df2f(_0x1467f7['segmentId'],_0x2a6324(0x254)+_0x2d460e['name']+_0x2a6324(0x25a));_0x5a8684&&(_0x1467f7[_0x2a6324(0x21b)]=_0x5a8684);}}if(_0x2d460e[_0x2a6324(0x239)]?.[_0x2a6324(0x21b)]&&isPendingSegmentId(_0x2d460e[_0x2a6324(0x239)][_0x2a6324(0x21b)])){const _0x4e13b6=_0x30df2f(_0x2d460e[_0x2a6324(0x239)][_0x2a6324(0x21b)],_0x2a6324(0x254)+_0x2d460e[_0x2a6324(0x279)]+_0x2a6324(0x265));_0x4e13b6&&(_0x2d460e[_0x2a6324(0x239)][_0x2a6324(0x21b)]=_0x4e13b6);}if(_0x2d460e['steps']){const _0x2bc0f9=_0x2d665b=>_0xfbe5bb[_0x2a6324(0x235)][_0x2a6324(0x21f)]?.[_0x2a6324(0x216)](_0x24e1ea=>_0x24e1ea[_0x2a6324(0x279)][_0x2a6324(0x1bf)]()===_0x2d460e[_0x2a6324(0x279)][_0x2a6324(0x1bf)]())?.[_0x2a6324(0x249)]?.[_0x2d665b];for(const _0x3d7687 of Object[_0x2a6324(0x21a)](_0x2d460e[_0x2a6324(0x249)])){const _0x27ad85=_0x2d460e['steps'][_0x3d7687],_0x7858fa=_0x2bc0f9(_0x3d7687);if(_0x27ad85['type']==='Activation'&&_0x27ad85[_0x2a6324(0x205)]&&(isPendingActivationId(_0x27ad85[_0x2a6324(0x205)])||_0x27ad85[_0x2a6324(0x205)]==='')){if(_0x7858fa?.[_0x2a6324(0x205)]&&isPendingActivationId(_0x7858fa[_0x2a6324(0x205)])){const _0x56e80a=extractPendingActivationName(_0x7858fa['journeyActivationStepId']),_0x358071=_0x29ba1d[_0x2a6324(0x219)](_0x56e80a);_0x358071&&(_0x27ad85['journeyActivationStepId']=_0x358071);}}if(_0x27ad85[_0x2a6324(0x1bc)]===_0x2a6324(0x1d1)&&_0x27ad85['branches']&&_0x7858fa?.[_0x2a6324(0x2af)])for(let _0x15d39c=0x0;_0x15d39c<_0x27ad85['branches'][_0x2a6324(0x22b)];_0x15d39c++){const _0x347790=_0x27ad85['branches'][_0x15d39c],_0x46a819=_0x7858fa['branches'][_0x15d39c];if(_0x46a819?.['segmentId']&&isPendingSegmentId(_0x46a819[_0x2a6324(0x21b)])){const _0x26bdd6=_0x30df2f(_0x46a819[_0x2a6324(0x21b)],_0x2a6324(0x254)+_0x2d460e['name']+'\x27\x20decision\x20point\x20branch\x20\x27'+(_0x347790[_0x2a6324(0x279)]||_0x15d39c)+'\x27');_0x26bdd6&&(_0x347790[_0x2a6324(0x21b)]=_0x26bdd6);}}_0x27ad85[_0x2a6324(0x1bc)]===_0x2a6324(0x260)&&_0x7858fa?.[_0x2a6324(0x1bc)]===_0x2a6324(0x260)&&resolveWaitStepPendingIds(_0x27ad85,_0x7858fa,_0x30df2f,_0x2d460e['name']);}}}}
|
|
1
|
+
const a142_0x3ef9cf=a142_0x3bff;(function(_0x554a80,_0x3216c9){const _0x544678=a142_0x3bff,_0x2c8489=_0x554a80();while(!![]){try{const _0x55a6ae=parseInt(_0x544678(0x21d))/0x1*(-parseInt(_0x544678(0x277))/0x2)+-parseInt(_0x544678(0x1cf))/0x3+-parseInt(_0x544678(0x1e0))/0x4+-parseInt(_0x544678(0x1de))/0x5*(-parseInt(_0x544678(0x22c))/0x6)+-parseInt(_0x544678(0x1eb))/0x7*(-parseInt(_0x544678(0x233))/0x8)+parseInt(_0x544678(0x232))/0x9+parseInt(_0x544678(0x1d3))/0xa;if(_0x55a6ae===_0x3216c9)break;else _0x2c8489['push'](_0x2c8489['shift']());}catch(_0x350141){_0x2c8489['push'](_0x2c8489['shift']());}}}(a142_0x570e,0x4c840));import{createHash}from'crypto';import{Logger}from'../../utils/logger/index.js';const logger=Logger['of'](a142_0x3ef9cf(0x2a0));export const PENDING_SEGMENT_PREFIX=a142_0x3ef9cf(0x296);export const PENDING_ACTIVATION_PREFIX=a142_0x3ef9cf(0x22b);export function createPendingSegmentId(_0x358f42){return''+PENDING_SEGMENT_PREFIX+_0x358f42+'__';}export function isPendingSegmentId(_0x4f67f6){const _0x3d3c34=a142_0x3ef9cf;return _0x4f67f6[_0x3d3c34(0x207)](PENDING_SEGMENT_PREFIX)&&!_0x4f67f6[_0x3d3c34(0x207)](PENDING_ACTIVATION_PREFIX);}export function extractPendingSegmentName(_0x23a6b5){const _0x444785=a142_0x3ef9cf;return _0x23a6b5[_0x444785(0x275)](/^__pending_(.+)__$/,'$1');}export function createPendingActivationId(_0x17378f){return''+PENDING_ACTIVATION_PREFIX+_0x17378f+'__';}export function isPendingActivationId(_0x1e2954){return _0x1e2954['startsWith'](PENDING_ACTIVATION_PREFIX);}export function extractPendingActivationName(_0x5839d0){const _0xb743bb=a142_0x3ef9cf;return _0x5839d0[_0xb743bb(0x275)](/^__pending_act_(.+)__$/,'$1');}export function generateDeterministicJourneySegmentName(_0x3dd469,_0x16e630){const _0xdc2d0a=a142_0x3ef9cf,_0x3ff77b=_0x3dd469+'::'+(_0x16e630[_0xdc2d0a(0x266)]()||_0xdc2d0a(0x1c7)),_0x2ca757=createHash('sha1')[_0xdc2d0a(0x26c)](_0x3ff77b)[_0xdc2d0a(0x28c)](_0xdc2d0a(0x1e4))[_0xdc2d0a(0x212)](0x0,0xc);return'journey_entry_criteria_'+_0x2ca757;}export function ensureJourneyDefaults(_0x23af51){const _0x119e00=a142_0x3ef9cf;!_0x23af51[_0x119e00(0x23e)]&&(_0x23af51[_0x119e00(0x23e)]=''),!_0x23af51[_0x119e00(0x1ca)]&&(_0x23af51[_0x119e00(0x1ca)]=_0x119e00(0x287));}export function injectExistingStageIds(_0x4c00ff,_0x44ee94){const _0xced3b7=a142_0x3ef9cf,_0x18e7bc=new Map(_0x44ee94[_0xced3b7(0x209)](_0xf6a41c=>[_0xf6a41c['name'],_0xf6a41c['id']]));for(const _0x446f92 of _0x4c00ff){if(!_0x446f92['id']){const _0x5612d1=_0x18e7bc['get'](_0x446f92[_0xced3b7(0x26e)]);_0x5612d1&&(_0x446f92['id']=_0x5612d1);}}}export function resolveTDFolderPath(_0x2ae020,_0x3612c2,_0x3fa3b6){const _0x4a1b80=a142_0x3ef9cf;if(!_0x3612c2)return _0x2ae020;if(_0x2ae020===_0x3fa3b6||_0x2ae020[_0x4a1b80(0x207)](_0x3fa3b6+'/'))return _0x2ae020;return _0x2ae020?_0x3fa3b6+'/'+_0x2ae020:_0x3fa3b6;}export function addFoldersToCreate(_0x5cea0b,_0x33fe4c,_0xb99772){const _0x124ba3=a142_0x3ef9cf;if(!_0x5cea0b)return;if(_0x33fe4c[_0x124ba3(0x1d5)](_0x5cea0b))return;const _0x4160d3=_0x5cea0b['split']('/');let _0x5f198d='';for(const _0x3b6b7e of _0x4160d3){_0x5f198d=_0x5f198d?_0x5f198d+'/'+_0x3b6b7e:_0x3b6b7e,!_0x33fe4c[_0x124ba3(0x1d5)](_0x5f198d)&&_0xb99772['add'](_0x5f198d);}}export function sortFoldersByDepth(_0x24fb24){return[..._0x24fb24]['sort']((_0x19388f,_0x17c0da)=>{const _0x265a48=a142_0x3bff,_0x21b1f4=(_0x19388f[_0x265a48(0x1ac)](/\//g)||[])['length'],_0x1b2d2e=(_0x17c0da[_0x265a48(0x1ac)](/\//g)||[])[_0x265a48(0x1f4)];return _0x21b1f4-_0x1b2d2e;});}import*as a142_0x4a29a2 from'yaml';import{readFileSync}from'fs';import a142_0x3c5b6d from'path';import{isJourneyDef,parseYamlString as a142_0x4a5f14,toYamlString as a142_0x2c1878,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(_0x371f39){const _0x37d65a=a142_0x3ef9cf;if(Array[_0x37d65a(0x272)](_0x371f39))return'['+_0x371f39[_0x37d65a(0x209)](_0x49f73d=>stableStringify(_0x49f73d))['join'](',')+']';if(_0x371f39&&typeof _0x371f39===_0x37d65a(0x248)){const _0x1feaee=_0x371f39,_0xd6dc49=Object[_0x37d65a(0x294)](_0x1feaee)[_0x37d65a(0x1d0)](),_0x557ae4=_0xd6dc49[_0x37d65a(0x209)](_0x2a7a60=>'\x22'+_0x2a7a60+'\x22:'+stableStringify(_0x1feaee[_0x2a7a60]));return'{'+_0x557ae4['join'](',')+'}';}const _0x567307=JSON[_0x37d65a(0x216)](_0x371f39);return _0x567307===undefined?'null':_0x567307;}function activationSignature(_0x5e9895){const _0x192a49=a142_0x3ef9cf,_0x342d17={'connection':_0x5e9895[_0x192a49(0x1f2)],..._0x5e9895['all_columns']!==undefined&&{'all_columns':_0x5e9895[_0x192a49(0x205)]},..._0x5e9895['columns']!==undefined&&{'columns':_0x5e9895[_0x192a49(0x21e)]},..._0x5e9895['behavior']!==undefined&&{'behavior':_0x5e9895[_0x192a49(0x1d6)]},..._0x5e9895[_0x192a49(0x242)]!==undefined&&{'schedule':_0x5e9895['schedule']},..._0x5e9895['notification']!==undefined&&{'notification':_0x5e9895[_0x192a49(0x1ab)]},..._0x5e9895[_0x192a49(0x280)]!==undefined&&{'connector_config':_0x5e9895[_0x192a49(0x280)]},..._0x5e9895[_0x192a49(0x1f7)]!==undefined&&{'activation_template_id':_0x5e9895[_0x192a49(0x1f7)]}};return stableStringify(_0x342d17);}async function fetchSegment(_0x5f02d9,_0x281f56,_0x59149d,_0x4add08){const _0x43cb94=a142_0x3ef9cf,_0x294b99=_0x4add08?.[_0x43cb94(0x1d9)](_0x31a52f=>_0x31a52f['id']===_0x59149d);if(_0x294b99)return _0x294b99;try{return await _0x5f02d9[_0x43cb94(0x1c7)]['getSegment'](_0x281f56,_0x59149d);}catch(_0xd8d4ea){logger[_0x43cb94(0x270)]('getSegment\x20failed\x20for\x20'+_0x59149d+_0x43cb94(0x241)+_0xd8d4ea);try{return await _0x5f02d9[_0x43cb94(0x1c7)][_0x43cb94(0x224)](_0x59149d);}catch(_0x1261ae){return logger[_0x43cb94(0x270)]('getSegmentEntity\x20also\x20failed\x20for\x20'+_0x59149d+':\x20'+_0x1261ae),null;}}}function recoverSegmentIdsFromPushRecovery(_0x399c6d,_0x39e025,_0xc1ef12){const _0x2bb764=a142_0x3ef9cf,_0x4aa918=readPushRecovery(_0x399c6d[_0x2bb764(0x27a)]);if(_0x4aa918?.[_0x2bb764(0x1b3)]===_0x399c6d[_0x2bb764(0x24a)][_0x2bb764(0x26e)])for(const [_0x14e49f,_0x3762ad]of Object['entries'](_0x4aa918[_0x2bb764(0x25b)])){const _0x2f63d0=generateDeterministicJourneySegmentName(_0x399c6d[_0x2bb764(0x24a)]['name'],_0x14e49f);_0x3762ad[_0x2bb764(0x1ec)]===_0x2f63d0&&(_0x39e025[_0x2bb764(0x21b)](_0x14e49f,_0x3762ad[_0x2bb764(0x221)]),_0xc1ef12[_0x2bb764(0x21b)](_0x14e49f,_0x3762ad[_0x2bb764(0x221)]));}}async function createOrRecoverEmbeddedSegment(_0x29a66a,_0x20ac3d,_0x8efa6,_0x236fbc){const _0x45040a=a142_0x3ef9cf;let _0x5019c5;try{_0x5019c5=await _0x29a66a[_0x45040a(0x1c7)][_0x45040a(0x293)]({'name':_0x8efa6['uniqueSegmentName'],'description':_0x8efa6[_0x45040a(0x23e)],'journeyId':_0x8efa6[_0x45040a(0x215)],'rule':_0x236fbc(_0x8efa6[_0x45040a(0x1e6)],!![]),'countPopulation':!![],'parentFolderId':_0x8efa6[_0x45040a(0x25e)],'audienceId':_0x8efa6[_0x45040a(0x23b)]});}catch(_0x46e390){const _0x29a3ee=_0x46e390 instanceof Error&&_0x46e390[_0x45040a(0x1da)][_0x45040a(0x1e2)](_0x45040a(0x1ea));if(_0x29a3ee){const _0x2a6c2d=readPushRecovery(_0x20ac3d['absolutePath']),_0x40620b=_0x2a6c2d?.[_0x45040a(0x1b3)]===_0x20ac3d[_0x45040a(0x24a)][_0x45040a(0x26e)]?_0x2a6c2d[_0x45040a(0x25b)][_0x8efa6[_0x45040a(0x267)]]:undefined;if(_0x40620b?.[_0x45040a(0x1ec)]===_0x8efa6['uniqueSegmentName'])await _0x29a66a['segment']['updateSegmentById'](_0x8efa6[_0x45040a(0x23b)],_0x40620b[_0x45040a(0x221)],{'description':_0x8efa6[_0x45040a(0x23e)],'rule':_0x236fbc(_0x8efa6[_0x45040a(0x1e6)],!![]),'countPopulation':!![]}),_0x5019c5=_0x40620b[_0x45040a(0x221)];else throw new SDKError(ErrorCode[_0x45040a(0x299)],_0x45040a(0x29c)+_0x8efa6['localName']+'\x27\x20already\x20exists\x20on\x20server\x20but\x20cannot\x20be\x20found.\x20'+(_0x45040a(0x1d1)+_0x20ac3d[_0x45040a(0x27a)][_0x45040a(0x275)](/([^/]+)$/,_0x45040a(0x25a))+')\x20')+_0x45040a(0x253),_0x46e390);}else throw _0x46e390;}return saveSegmentToPushRecovery(_0x20ac3d[_0x45040a(0x27a)],_0x20ac3d[_0x45040a(0x24a)][_0x45040a(0x26e)],_0x8efa6[_0x45040a(0x267)],{'segmentId':_0x5019c5,'uniqueServerName':_0x8efa6[_0x45040a(0x24c)],'createdAt':new Date()['toISOString']()}),_0x5019c5;}export async function prepareSegmentFiles(_0x40cf55,_0x15a4e8,_0x1e2548,_0x575919,_0x50d19f){const _0x31b50b=a142_0x3ef9cf,{activationDefToCreateRequest:_0x124188}=await import(_0x31b50b(0x201)),_0x5b4b14=[],_0x2b7fe9=new Set();for(const {yamlConfig:_0x4938c4,folderPath:_0x333b85,sourcePath:_0x178f2f}of _0x40cf55){const _0x9d79e3=resolveTDFolderPath(_0x333b85,_0x575919,_0x50d19f),_0x31571f=_0x9d79e3+':'+_0x4938c4[_0x31b50b(0x26e)],_0x671ca3=_0x15a4e8['segmentByFolderAndName']['get'](_0x31571f),_0x2f516c=_0x671ca3?_0x15a4e8[_0x31b50b(0x238)]['get'](_0x671ca3['id'])||[]:[];addFoldersToCreate(_0x9d79e3,_0x15a4e8[_0x31b50b(0x27f)],_0x2b7fe9);const _0x49fe0f=calculateActivationActions(_0x4938c4['activations']||[],_0x2f516c,_0x15a4e8[_0x31b50b(0x298)],_0x15a4e8['connectionIdToNameMap']);for(const _0x18d803 of _0x49fe0f){(_0x18d803[_0x31b50b(0x21a)]==='create'||_0x18d803['type']===_0x31b50b(0x26c))&&_0x18d803[_0x31b50b(0x24d)]&&(_0x18d803[_0x31b50b(0x22f)]=await _0x124188(_0x18d803['yamlActivation'],_0x1e2548));}const _0x29191c=calculateSegmentDiff(_0x4938c4,_0x671ca3,_0x2f516c,_0x15a4e8['idToEmailMap'],_0x15a4e8['connectionIdToNameMap']);_0x5b4b14[_0x31b50b(0x1a4)]({'relativePath':_0x4938c4[_0x31b50b(0x26e)],'absolutePath':_0x178f2f,'yamlConfig':_0x4938c4,'folderPath':_0x9d79e3,'existingSegment':_0x671ca3,'existingActivations':_0x2f516c,'isNew':_0x29191c[_0x31b50b(0x279)],'hasChanges':_0x29191c[_0x31b50b(0x1e3)],'diff':_0x29191c['diff'],'activationActions':_0x49fe0f});}return{'segmentFiles':_0x5b4b14,'foldersToCreate':_0x2b7fe9};}export async function prepareJourneyFiles(_0x3ef1b1,_0x41d667,_0x5266c3,_0x508b38){const _0x50358b=a142_0x3ef9cf,_0x36bd0c=[],_0x3574f0=new Set();for(const {yamlConfig:_0x5e05d6,folderPath:_0x21209e,sourcePath:_0x241ff7}of _0x3ef1b1){const _0x21356=resolveTDFolderPath(_0x21209e,_0x5266c3,_0x508b38),_0x3c6268=_0x21356+':'+_0x5e05d6[_0x50358b(0x26e)],_0x3c8b8c=_0x41d667[_0x50358b(0x1b7)]['get'](_0x3c6268);let _0x1aff22,_0x206d6c;if(_0x3c8b8c&&_0x3c8b8c[_0x50358b(0x1f4)]>0x0){const _0x4a1d8d=buildLocalExpandedRuleMappings(_0x5e05d6),{createYamlContext:_0x508a22,prefetchJourneySegments:_0x4cfc70}=createPushYamlContextForBundle(_0x41d667[_0x50358b(0x240)],_0x41d667[_0x50358b(0x23b)],_0x41d667[_0x50358b(0x222)],_0x4a1d8d,_0x41d667[_0x50358b(0x298)],_0x41d667['connectionIdToNameMap'],_0x41d667['activationStepsById'],_0x41d667[_0x50358b(0x1ed)]);await _0x4cfc70(_0x3c8b8c[_0x50358b(0x209)](_0x3c2555=>_0x3c2555['id']));const _0x3c34b8=await _0x41d667[_0x50358b(0x240)]['journey'][_0x50358b(0x265)](_0x3c8b8c[0x0][_0x50358b(0x23c)]),_0x48fac3=hasMultipleVersions(_0x5e05d6),_0x123aa0=async _0x3007eb=>{const _0x3ae20c=_0x50358b,_0x18a564=_0x41d667['journeyById']?.['get'](_0x3007eb);if(_0x18a564)return _0x18a564;return _0x41d667[_0x3ae20c(0x26d)]({'journeyId':_0x3007eb,'journeyName':_0x5e05d6[_0x3ae20c(0x26e)],'isMultiVersion':_0x3c8b8c['length']>0x1});};if(_0x48fac3&&_0x3c8b8c['length']>0x1){const _0x39a913=[];for(const _0x57c1d2 of _0x3c8b8c){const _0x39e3c2=_0x57c1d2[_0x50358b(0x210)]||0x1;_0x41d667['progress']?.[_0x50358b(0x26c)](_0x50358b(0x202)+_0x5e05d6[_0x50358b(0x26e)]+'\x20v'+_0x39e3c2);const _0x2e0246=await _0x123aa0(_0x57c1d2['id']),_0x26dbc6=_0x508a22(_0x57c1d2['id']),_0x17a79b=await journeyResponseToDef(_0x2e0246,_0x26dbc6);_0x39a913[_0x50358b(0x1a4)]({'item':_0x57c1d2,'yaml':_0x17a79b});}const _0x17be42=buildLocalRuleToNameMappingFromJourney(_0x5e05d6);_0x206d6c=buildMergedJourneyDef(_0x39a913,_0x17be42,_0x3c34b8);const _0xdacdfa=Math[_0x50358b(0x285)](..._0x39a913[_0x50358b(0x209)](_0x8c33fe=>_0x8c33fe[_0x50358b(0x251)][_0x50358b(0x210)]||0x0)),_0x39eb01=_0x3c8b8c[_0x50358b(0x1d9)](_0x1ef212=>(_0x1ef212['versionNumber']||0x0)===_0xdacdfa);_0x39eb01&&(_0x41d667[_0x50358b(0x1e1)]?.[_0x50358b(0x26c)]('Fetching\x20'+_0x5e05d6['name']+'\x20v'+_0xdacdfa),_0x1aff22=await _0x123aa0(_0x39eb01['id']));}else{const _0x4273fc=_0x3c8b8c[_0x3c8b8c[_0x50358b(0x1f4)]-0x1];_0x41d667['progress']?.['update'](_0x50358b(0x202)+_0x5e05d6[_0x50358b(0x26e)]),_0x1aff22=await _0x123aa0(_0x4273fc['id']);const _0x7ad1e9=_0x508a22(_0x4273fc['id']),_0x5ae31a=await journeyResponseToDef(_0x1aff22,_0x7ad1e9),_0x40c906=buildLocalRuleToNameMappingFromJourney(_0x5e05d6);_0x206d6c=buildMergedJourneyDef([{'item':_0x4273fc,'yaml':_0x5ae31a}],_0x40c906,_0x3c34b8);}}addFoldersToCreate(_0x21356,_0x41d667[_0x50358b(0x27f)],_0x3574f0);const _0x3f8a02=calculateJourneyDiff(_0x5e05d6,_0x206d6c);_0x36bd0c[_0x50358b(0x1a4)]({'relativePath':_0x5e05d6[_0x50358b(0x26e)],'absolutePath':_0x241ff7,'yamlConfig':_0x5e05d6,'folderPath':_0x21356,'existingJourney':_0x1aff22,'isNew':_0x3f8a02[_0x50358b(0x279)],'hasChanges':_0x3f8a02[_0x50358b(0x1e3)],'diff':_0x3f8a02[_0x50358b(0x1d2)]});}return{'journeyFiles':_0x36bd0c,'foldersToCreate':_0x3574f0};}export function calculateActivationActions(_0x47b983,_0x41372e,_0x31ea45,_0x12efa7){const _0x1edf35=a142_0x3ef9cf,_0x593d76=[],_0x223aa3=new Map();for(const _0xb9bb6e of _0x41372e){_0x223aa3[_0x1edf35(0x21b)](_0xb9bb6e[_0x1edf35(0x26e)],_0xb9bb6e);}const _0x9259f=new Map();for(const _0x1fbbaa of _0x47b983){_0x9259f['set'](_0x1fbbaa[_0x1edf35(0x26e)],_0x1fbbaa);}for(const _0x56855c of _0x47b983){const _0x1637b0=_0x223aa3['get'](_0x56855c[_0x1edf35(0x26e)]);if(!_0x1637b0)_0x593d76[_0x1edf35(0x1a4)]({'type':'create','name':_0x56855c[_0x1edf35(0x26e)],'yamlActivation':_0x56855c});else{const _0x27c091=activationResponseToDef(_0x1637b0,_0x31ea45,_0x12efa7),_0x2163bc=a142_0x4a29a2[_0x1edf35(0x216)](_0x27c091),_0xa2751=a142_0x4a29a2[_0x1edf35(0x216)](_0x56855c);_0x2163bc!==_0xa2751&&_0x593d76[_0x1edf35(0x1a4)]({'type':_0x1edf35(0x26c),'name':_0x56855c[_0x1edf35(0x26e)],'yamlActivation':_0x56855c,'existingActivation':_0x1637b0});}}for(const _0x166d73 of _0x41372e){!_0x9259f[_0x1edf35(0x1d5)](_0x166d73[_0x1edf35(0x26e)])&&_0x593d76[_0x1edf35(0x1a4)]({'type':_0x1edf35(0x1f9),'name':_0x166d73['name'],'existingActivation':_0x166d73});}return _0x593d76;}function calculateYamlDiff(_0x1a0237,_0x110a8e){if(_0x110a8e){const _0x5872f6=generateDiff(_0x110a8e,_0x1a0237),_0x2cf5cd=hasChanges(_0x5872f6);return{'isNew':![],'hasChanges':_0x2cf5cd,'diff':_0x2cf5cd?formatDiffWithColors(_0x5872f6):undefined};}const _0x220fa5=generateDiff('',_0x1a0237);return{'isNew':!![],'hasChanges':![],'diff':formatDiffWithColors(_0x220fa5)};}export function calculateSegmentDiff(_0x396c56,_0x36c1d0,_0x531544,_0xa64b62,_0x575cf7){const _0x3e11d1=segmentToYamlString(_0x396c56),_0x4f57d8=_0x36c1d0?segmentToYamlString(segmentWithActivationsToYaml(_0x36c1d0,_0x531544,undefined,_0xa64b62,_0x575cf7)):undefined;return calculateYamlDiff(_0x3e11d1,_0x4f57d8);}export function calculateJourneyDiff(_0x2614f1,_0x5cf900){const _0x389595=normalizeJourneyDef(_0x2614f1,_0x2614f1),_0x4cee39=a142_0x2c1878(_0x389595),_0x35ef69=_0x5cf900?a142_0x2c1878(normalizeJourneyDef(_0x5cf900,_0x2614f1)):undefined;return calculateYamlDiff(_0x4cee39,_0x35ef69);}function a142_0x570e(){const _0x27af4e=['debug','join','isArray','segment_updated','deleteSegment','replace','WaitStep','12jXipVF','dirname','isNew','absolutePath','\x20(referenced\x20in\x20embedded\x20segment\x20\x27','results','Cannot\x20create\x20embedded\x20activation\x20without\x20journey\x20context','\x20error(s)','folderPathToId','connector_config','journey_created','conditions','folder_created','folder','max','list','draft','parentSegmentFolder','activation_deleted','\x20activation\x20\x27','create','digest','activationContext','entry_criteria','listActivations','Failed\x20to\x20sync\x20activations\x20for\x20segment\x20\x27','Creating\x20folder\x20\x27','journey','createJourneySegment','keys','Creating\x20segment\x20\x27','__pending_','run_after_journey_refresh','idToEmailMap','SEGMENT_UPDATE_ERROR','conditionSegmentId','createActivation','Embedded\x20segment\x20\x27','activation_','filter','createdSegmentId','tdx.sdk.push-workflow','activation_creating','rule','rootFolderId','activations','):\x20','journeys','waitStepUnit','push','\x20(referenced\x20in\x20journey\x20','steps','deleteActivation','journey_updating','\x27...','connectionIdToNameMap','notification','match','exitCriterias','embedded_activation_creating','Updating\x20segment\x20\x27','Updating\x20activation\x20\x27','JOURNEY_UPDATE_ERROR','reduce','journeyName','activationActions','updated','activation_updating','journeyBundlesByFolderAndName','journeyBundleName','existingSegment','folderPath','parseDocument','activation_created','toString','embedded_activation_created','journeyActivationNameToId','Created\x20journey\x20\x27','getActivation','conditionTimeoutUnit','journey_updated','Activation\x20not\x20found:\x20','unchanged','with','segment','Stage\x20\x27','logDeleted','state','createSegment','existingActivation','activation_deleting','split','297660BTEkDB','sort','Delete\x20the\x20push\x20recovery\x20file\x20(','diff','6427540burXJe','segmentFolderId','has','behavior','values','buildUserMaps','find','message','valid','parse','Updated\x20segment\x20\x27','2005645bFjLBR','relative','1854340ZnUHWD','progress','includes','hasChanges','hex','embedded_segment_created','resolvedRule','created','getJourney','Activation','Name\x20has\x20already\x20been\x20taken','15393HeUaDj','uniqueServerName','journeyById','Cannot\x20create\x20embedded\x20segment\x20for\x20existing\x20journey\x20without\x20journey\x20ID','\x27\x20not\x20found\x20in\x20journey\x20\x27','createFolder','existingJourney','connection','logSuccess','length','Entry\x20criteria:\x20','relationships','activation_template_id','Failed\x20to\x20resolve\x20activation\x20','delete','Deleted\x20activation\x20\x27','index','segmentNameToId','stages','attributes','\x20journey\x20from\x20file:\x20','updateSegmentById','./child-segment-yaml.js','Fetching\x20','SEGMENT_NOT_FOUND','Created\x20activation\x20\x27','all_columns','\x27\x20for\x20','startsWith','day','map','Updated\x20journey\x20\x27','Segment\x20not\x20found:\x20','stage\x20\x27','journeyActivationStepId','entryCriteria','all','versionNumber','conditionTimeoutDuration','slice','toISOString','ACTIVATION_UPDATE_ERROR','journeyId','stringify','errors','add','Deleted\x20segment\x20\x27','type','set','\x27\x20decision\x20point\x20branch\x20\x27','104018rRkkOi','columns','journeyStages','SEGMENT_SYNTAX_ERROR','segmentId','existingSegments','./journey-yaml.js','getSegmentEntity','\x0a\x20\x20','utf-8','size','onProgress','resolveSegment','deleted','__pending_act_','6fISXEG','../../utils/async.js','waitStep','validatedRequest','Failed\x20to\x20','nameToType','3177765rfyDtB','376ELBQgR','verbose','withProgress','milestone','Created\x20segment\x20\x27','activationsBySegmentId','get','nameToId','parentId','journeyBundleId','Journey\x20\x27','description','INTERNAL','deps',',\x20falling\x20back\x20to\x20getSegmentEntity:\x20','schedule','some','ACTIVATION_SYNTAX_ERROR','branches','from','\x27\x20not\x20found\x20in\x20parent\x20segment\x20(referenced\x20in\x20jump\x20step\x20of\x20\x27','object','createdSegmentIds','yamlConfig','toLowerCase','uniqueSegmentName','yamlActivation','entry','\x27\x20exit\x20criteria','activation_updated','item','Creating\x20activation\x20\x27','and\x20the\x20server\x20segment,\x20then\x20retry.','segment_created','action','\x27\x20from\x20file:\x20',').\x20','JOURNEY_SYNTAX_ERROR','Updated\x20activation\x20\x27','.$1.push-recovery.json','segments','Failed\x20to\x20resolve\x20segment\x20','updateActivation','folderId','activationParams','NOT_FOUND','data','waitStepType','Define\x20it\x20in\x20the\x20journey\x27s\x20\x27activations\x27\x20section\x20or\x20use\x20an\x20existing\x20activation\x20ID.','\x27\x20wait\x20condition','getLatestJourneyId','trim','localName','flatMap','goal','embeddedSegmentNameToId','DecisionPoint','update','fetchJourney','name','\x20segment\x20from\x20file:\x20'];a142_0x570e=function(){return _0x27af4e;};return a142_0x570e();}export function findSegmentsToDelete(_0x33a1f5,_0x1388c2,_0x437af8,_0x4de174,_0x2b1e51){const _0x1e25e2=a142_0x3ef9cf,_0x2ff9c5=new Set();for(const {yamlConfig:_0x455b29,folderPath:_0x47a75e}of _0x1388c2){_0x2ff9c5['add'](_0x47a75e+':'+_0x455b29[_0x1e25e2(0x26e)]);}return _0x33a1f5[_0x1e25e2(0x29e)](_0x4590ed=>{const _0x48090f=_0x1e25e2,_0x52e94b=_0x4590ed['segmentFolderId']?_0x437af8['get'](_0x4590ed[_0x48090f(0x1d4)]['toString']())||'':'',_0x39f2f5=_0x52e94b+':'+_0x4590ed[_0x48090f(0x26e)];if(_0x2ff9c5[_0x48090f(0x1d5)](_0x39f2f5))return![];if(_0x2b1e51)return _0x52e94b===_0x4de174||_0x52e94b[_0x48090f(0x207)](_0x4de174+'/');return!![];});}export function findJourneysToDelete(_0xd2c845,_0x4172b8,_0x12bd70,_0x381b63,_0x210c70){const _0x4c0f02=a142_0x3ef9cf,_0x4ff9aa=new Set();for(const {yamlConfig:_0x5aab86,folderPath:_0x5a0fe6}of _0x4172b8){_0x4ff9aa[_0x4c0f02(0x218)](_0x5a0fe6+':'+_0x5aab86[_0x4c0f02(0x26e)]);}return _0xd2c845[_0x4c0f02(0x29e)](_0x7c25e2=>{const _0x1600d3=_0x4c0f02,_0x3fd7fe=_0x7c25e2['folderId']?_0x12bd70[_0x1600d3(0x239)](_0x7c25e2[_0x1600d3(0x25e)])||'':'',_0x5b70e9=_0x3fd7fe+':'+_0x7c25e2[_0x1600d3(0x1b8)];if(_0x4ff9aa[_0x1600d3(0x1d5)](_0x5b70e9))return![];if(_0x210c70)return _0x3fd7fe===_0x381b63||_0x3fd7fe[_0x1600d3(0x207)](_0x381b63+'/');return!![];});}export function buildSegmentLookupMap(_0x238649,_0x317c0c){const _0x549f85=a142_0x3ef9cf,_0x4cbd45=new Map();for(const _0x7bd865 of _0x238649){const _0x3eeeb4=_0x7bd865[_0x549f85(0x1d4)]?_0x317c0c[_0x549f85(0x239)](_0x7bd865[_0x549f85(0x1d4)][_0x549f85(0x1bd)]())||'':'',_0x1cd77e=_0x3eeeb4+':'+_0x7bd865[_0x549f85(0x26e)];_0x4cbd45[_0x549f85(0x21b)](_0x1cd77e,_0x7bd865);}return _0x4cbd45;}function a142_0x3bff(_0x1b776c,_0x143ee8){_0x1b776c=_0x1b776c-0x1a4;const _0x570e97=a142_0x570e();let _0x3bff15=_0x570e97[_0x1b776c];return _0x3bff15;}export function buildSegmentNameToIdMap(_0x139b51){const _0x4b1f62=a142_0x3ef9cf,_0x3f8afe=new Map();for(const _0x5319db of _0x139b51){_0x3f8afe[_0x4b1f62(0x21b)](_0x5319db[_0x4b1f62(0x26e)],_0x5319db['id']);}return _0x3f8afe;}export function buildJourneyBundleLookupMap(_0x178ddf,_0x53fda8){const _0x7bf2af=a142_0x3ef9cf,_0x10cfa1=new Map();for(const _0x2e2e4a of _0x178ddf){const _0x51b74e=_0x2e2e4a['folderId']?_0x53fda8['get'](_0x2e2e4a[_0x7bf2af(0x25e)])||'':'',_0x53fc05=_0x51b74e+':'+_0x2e2e4a[_0x7bf2af(0x1b8)];!_0x10cfa1[_0x7bf2af(0x1d5)](_0x53fc05)&&_0x10cfa1[_0x7bf2af(0x21b)](_0x53fc05,[]),_0x10cfa1[_0x7bf2af(0x239)](_0x53fc05)[_0x7bf2af(0x1a4)](_0x2e2e4a);}for(const _0x44857d of _0x10cfa1[_0x7bf2af(0x1d7)]()){_0x44857d[_0x7bf2af(0x1d0)]((_0x5e8e73,_0x31368e)=>(_0x5e8e73['versionNumber']||0x0)-(_0x31368e[_0x7bf2af(0x210)]||0x0));}return _0x10cfa1;}export function collectFoldersToCreate(_0x4521c7,_0x2fb469){const _0x574c94=a142_0x3ef9cf,_0x3508d5=new Set();for(const _0x80ffd4 of _0x4521c7){if(!_0x80ffd4)continue;if(_0x2fb469[_0x574c94(0x1d5)](_0x80ffd4))continue;const _0x3a6972=_0x80ffd4[_0x574c94(0x1ce)]('/');let _0x1709f6='';for(const _0x18e14d of _0x3a6972){_0x1709f6=_0x1709f6?_0x1709f6+'/'+_0x18e14d:_0x18e14d,!_0x2fb469[_0x574c94(0x1d5)](_0x1709f6)&&_0x3508d5[_0x574c94(0x218)](_0x1709f6);}}return _0x3508d5;}export function parseAndClassifyYamlFiles(_0x1702e6,_0x5a63a1,_0x332427){const _0x9c5754=a142_0x3ef9cf,_0x184e1f=[],_0x41c5bc=[];for(const _0x453e67 of _0x1702e6){const _0x576c68=a142_0x3c5b6d['relative'](_0x5a63a1,a142_0x3c5b6d[_0x9c5754(0x278)](_0x453e67)),_0x4b3159=_0x576c68==='.'?'':_0x576c68,_0xb06802=readFileSync(_0x453e67,'utf-8'),_0x32831d=a142_0x4a29a2[_0x9c5754(0x1dc)](_0xb06802);if(isJourneyDef(_0x32831d)){const _0x5f4f5b=a142_0x4a5f14(_0xb06802);_0x41c5bc['push']({'yamlConfig':_0x5f4f5b,'folderPath':_0x4b3159,'sourcePath':_0x453e67});}else{if(!_0x332427?.['skipSegments']){const _0x42622b=parseSegmentYamlFile(_0xb06802),_0x4297a2=normalizeChildSegmentYaml(_0x42622b);_0x184e1f[_0x9c5754(0x1a4)]({'yamlConfig':_0x4297a2,'folderPath':_0x4b3159,'sourcePath':_0x453e67});}}}return{'segments':_0x184e1f,'journeys':_0x41c5bc};}export function validateParsedFiles(_0x374afe,_0x376e3c){const _0x8c0e09=a142_0x3ef9cf,_0x2cd0ce=[];for(const {yamlConfig:_0x173472,sourcePath:_0x3f6d29}of _0x374afe[_0x8c0e09(0x25b)]){const _0x14c1d2=readFileSync(_0x3f6d29,_0x8c0e09(0x226)),_0x1c6d34=a142_0x4a29a2[_0x8c0e09(0x1bb)](_0x14c1d2),_0x5971d1=validateSegmentDef(_0x173472,{'source':_0x14c1d2,'document':_0x1c6d34},{'skipSchema':!![]});if(!_0x5971d1['valid']){const _0x46a348=a142_0x3c5b6d['relative'](_0x376e3c,_0x3f6d29);_0x2cd0ce['push']({'filePath':_0x46a348,'source':_0x14c1d2,'result':_0x5971d1,'isJourney':![]});}}for(const {yamlConfig:_0x18c92d,sourcePath:_0x3044c2}of _0x374afe[_0x8c0e09(0x2a6)]){const _0x5c6992=readFileSync(_0x3044c2,_0x8c0e09(0x226)),_0x37cb9b=a142_0x4a29a2[_0x8c0e09(0x1bb)](_0x5c6992),_0x466d62=validateJourneyDef(_0x18c92d,{'source':_0x5c6992,'document':_0x37cb9b},{'skipSchema':!![]});if(!_0x466d62[_0x8c0e09(0x1db)]){const _0x2fc8f3=a142_0x3c5b6d[_0x8c0e09(0x1df)](_0x376e3c,_0x3044c2);_0x2cd0ce[_0x8c0e09(0x1a4)]({'filePath':_0x2fc8f3,'source':_0x5c6992,'result':_0x466d62,'isJourney':!![]});}}return _0x2cd0ce;}export function formatValidationErrors(_0x5f2adb){const _0x214c8b=a142_0x3ef9cf,_0x2d3502=[];for(const {filePath:_0xf13c3c,source:_0x3c5e84,result:_0x489ee9,isJourney:_0x35c890}of _0x5f2adb){const _0xb3267d=_0x35c890?_0x214c8b(0x292):_0x214c8b(0x1c7);_0x2d3502[_0x214c8b(0x1a4)]('\x0a'+_0xf13c3c+'\x20('+_0xb3267d+_0x214c8b(0x2a5)+_0x489ee9[_0x214c8b(0x217)]['length']+_0x214c8b(0x27e)),_0x2d3502[_0x214c8b(0x1a4)](formatValidationResult(_0x489ee9,_0x3c5e84,_0xf13c3c));}return _0x2d3502[_0x214c8b(0x271)]('\x0a');}export function buildLocalExpandedRuleMappings(_0x328e47){const _0x35179b=a142_0x3ef9cf,_0x336371=new Set(),_0x43a277=new Map(),_0x127949=collectSegmentUsageCounts(_0x328e47);if(_0x328e47[_0x35179b(0x25b)])for(const [_0x39b242,_0x2ebb1f]of Object['entries'](_0x328e47[_0x35179b(0x25b)])){_0x336371[_0x35179b(0x218)](_0x39b242);if(_0x2ebb1f[_0x35179b(0x2a2)]){const _0x46fca0=yamlRuleToApi(_0x2ebb1f[_0x35179b(0x2a2)]),_0x10a7f6=apiRuleToYaml(_0x46fca0);_0x43a277[_0x35179b(0x21b)](_0x39b242,_0x10a7f6);}}const _0x36cd2c=new Map();let _0x580575=0x0;for(const [_0x420f23,_0xccab7f]of _0x43a277){const _0x66a5f9=serializeExpandedRule(_0xccab7f,_0x43a277),_0x3246bf=_0x36cd2c[_0x35179b(0x239)](_0x66a5f9)||[];_0x3246bf['push']({'name':_0x420f23,'index':_0x580575}),_0x36cd2c['set'](_0x66a5f9,_0x3246bf),_0x580575++;}const _0x566104=new Map();for(const [_0x4c69c4,_0x5b3047]of _0x36cd2c){const _0x990c0f=_0x5b3047[_0x35179b(0x212)]()[_0x35179b(0x1d0)]((_0x14770a,_0x5b4461)=>{const _0x342ce7=_0x35179b,_0x126e0a=_0x127949['get'](_0x14770a[_0x342ce7(0x26e)])||0x0,_0x3febcb=_0x127949['get'](_0x5b4461[_0x342ce7(0x26e)])||0x0;if(_0x126e0a!==_0x3febcb)return _0x3febcb-_0x126e0a;return _0x14770a[_0x342ce7(0x1fb)]-_0x5b4461[_0x342ce7(0x1fb)];})['map'](_0x495280=>_0x495280[_0x35179b(0x26e)]),_0x33d07d=[];for(const _0x1e79e8 of _0x990c0f){const _0x4f96b8=_0x127949['get'](_0x1e79e8)||0x0,_0xcebba8=Math[_0x35179b(0x285)](_0x4f96b8,0x1);for(let _0x3884f2=0x0;_0x3884f2<_0xcebba8;_0x3884f2++){_0x33d07d[_0x35179b(0x1a4)](_0x1e79e8);}}_0x566104[_0x35179b(0x21b)](_0x4c69c4,_0x33d07d);}return{'existingLocalSegmentNames':_0x336371,'localSegmentRules':_0x43a277,'localExpandedRuleToNames':_0x566104};}export function createSegmentIdResolver(_0x36bd57,_0x4f4fb9){return async _0x398b42=>{const _0x4e8806=a142_0x3bff,_0x2f10d4=_0x36bd57[_0x4e8806(0x239)](_0x398b42);if(!_0x2f10d4)throw new SDKError(ErrorCode[_0x4e8806(0x203)],_0x4e8806(0x20b)+_0x398b42+_0x4e8806(0x27b)+_0x4f4fb9+'\x27)');return _0x2f10d4;};}export function extractRootFolderId(_0x1d1451){const _0x2a2679=a142_0x3ef9cf;return _0x1d1451[_0x2a2679(0x1f6)]?.[_0x2a2679(0x288)]?.[_0x2a2679(0x261)]?.['id']||_0x1d1451['relationships']?.['parentFolder']?.[_0x2a2679(0x261)]?.['id'];}export function buildConnectionMaps(_0x5290ef){const _0x67a573=a142_0x3ef9cf,_0x5dbbdd=new Map(),_0x20abd8=new Map(),_0x23086f=new Map();for(const _0x4227d4 of _0x5290ef){_0x5dbbdd[_0x67a573(0x21b)](_0x4227d4['name'],parseInt(_0x4227d4['id'],0xa)),_0x20abd8[_0x67a573(0x21b)](_0x4227d4['id'],_0x4227d4[_0x67a573(0x26e)]),_0x23086f[_0x67a573(0x21b)](_0x4227d4[_0x67a573(0x26e)],_0x4227d4['type']);}return{'nameToId':_0x5dbbdd,'idToName':_0x20abd8,'nameToType':_0x23086f};}export function calculatePushStats(_0x14ab0a,_0x2d0425,_0x4a3c3f,_0x58dcfe,_0x218877,_0x3a5860,_0x279ba0){const _0x5b2d58=a142_0x3ef9cf,_0x3a48f9=_0x14ab0a['filter'](_0x53c074=>_0x53c074['isNew']),_0x52cd3f=_0x14ab0a[_0x5b2d58(0x29e)](_0x7bca4f=>!_0x7bca4f[_0x5b2d58(0x279)]&&_0x7bca4f['hasChanges']),_0x3fde8c=_0x14ab0a['filter'](_0x304114=>!_0x304114[_0x5b2d58(0x279)]&&!_0x304114[_0x5b2d58(0x1e3)]),_0x5a39ff=_0x3a5860?_0x58dcfe:[],_0x1327ac=_0x2d0425['filter'](_0x24780e=>_0x24780e[_0x5b2d58(0x279)]),_0x335ab9=_0x2d0425[_0x5b2d58(0x29e)](_0x5d6461=>!_0x5d6461[_0x5b2d58(0x279)]&&_0x5d6461[_0x5b2d58(0x1e3)]),_0xa4de92=_0x2d0425[_0x5b2d58(0x29e)](_0x3ba9b9=>!_0x3ba9b9[_0x5b2d58(0x279)]&&!_0x3ba9b9[_0x5b2d58(0x1e3)]),_0x3228e6=_0x3a5860?_0x218877:[],_0x56776c=_0x14ab0a[_0x5b2d58(0x268)](_0x15ed34=>_0x15ed34['activationActions']),_0x28b94d=_0x56776c['filter'](_0x8fe17f=>_0x8fe17f[_0x5b2d58(0x21a)]==='create'),_0x26de2a=_0x56776c[_0x5b2d58(0x29e)](_0x426b5b=>_0x426b5b[_0x5b2d58(0x21a)]===_0x5b2d58(0x26c)),_0x161501=_0x56776c[_0x5b2d58(0x29e)](_0x44cc3c=>_0x44cc3c['type']===_0x5b2d58(0x1f9)),_0x3002ca=Array[_0x5b2d58(0x246)](_0x4a3c3f)['sort'](),_0x5a4c29=_0x279ba0?![]:_0x3a48f9[_0x5b2d58(0x1f4)]>0x0||_0x52cd3f['length']>0x0||_0x5a39ff[_0x5b2d58(0x1f4)]>0x0,_0x566b35=_0x1327ac[_0x5b2d58(0x1f4)]>0x0||_0x335ab9[_0x5b2d58(0x1f4)]>0x0||_0x3228e6['length']>0x0,_0x51c454=_0x279ba0?![]:_0x56776c['length']>0x0,_0x2f030b=_0x3002ca[_0x5b2d58(0x1f4)]>0x0;return{'segments':{'new':_0x3a48f9,'changed':_0x52cd3f,'unchanged':_0x3fde8c,'toDelete':_0x5a39ff},'journeys':{'new':_0x1327ac,'changed':_0x335ab9,'unchanged':_0xa4de92,'toDelete':_0x3228e6},'activations':{'all':_0x56776c,'toCreate':_0x28b94d,'toUpdate':_0x26de2a,'toDelete':_0x161501},'folders':{'toCreate':_0x3002ca},'counts':{'segments':{'new':_0x3a48f9[_0x5b2d58(0x1f4)],'changed':_0x52cd3f[_0x5b2d58(0x1f4)],'unchanged':_0x3fde8c['length'],'toDelete':_0x5a39ff[_0x5b2d58(0x1f4)]},'journeys':{'new':_0x1327ac[_0x5b2d58(0x1f4)],'changed':_0x335ab9['length'],'unchanged':_0xa4de92[_0x5b2d58(0x1f4)],'toDelete':_0x3228e6['length']},'activations':{'create':_0x28b94d[_0x5b2d58(0x1f4)],'update':_0x26de2a[_0x5b2d58(0x1f4)],'delete':_0x161501['length']},'folders':_0x3002ca[_0x5b2d58(0x1f4)]},'hasChanges':_0x5a4c29||_0x566b35||_0x51c454||_0x2f030b};}export async function buildPushExecutionContext(_0xa56521,_0x1d95bf,_0x29d094,_0x5e43b3,_0x5364bb,_0x1a86e0){const _0xe1b4ce=a142_0x3ef9cf,_0x2bee9a=extractRootFolderId(_0x29d094),{pathToId:_0x337dca,idToPath:_0x4d0c4c}=buildFolderMaps(_0x5364bb),_0x3cde21=buildSegmentNameToIdMap(_0x5e43b3),_0x2066f6=new Map(),{batchAsync:_0x36bb4d}=await import(_0xe1b4ce(0x22d)),[_0x25fc6f,_0x4aaeff]=await Promise[_0xe1b4ce(0x20f)]([_0xa56521['user'][_0xe1b4ce(0x1d8)](),_0xa56521['connection'][_0xe1b4ce(0x286)](),((async()=>{const _0x3f84ad=_0xe1b4ce;!_0x1a86e0&&_0x5e43b3[_0x3f84ad(0x1f4)]>0x0&&await _0x36bb4d(_0x5e43b3,async _0x8cbc31=>{const _0xa8a093=_0x3f84ad,_0x437486=await _0xa56521['segment'][_0xa8a093(0x28f)](_0x1d95bf,_0x8cbc31['id']);_0x2066f6[_0xa8a093(0x21b)](_0x8cbc31['id'],_0x437486);});})())]),{emailToId:_0x4dafc9,idToEmail:_0x162c44}=_0x25fc6f,_0x5de609=buildConnectionMaps(_0x4aaeff);return{'rootFolderId':_0x2bee9a,'folderPathToId':_0x337dca,'folderIdToPath':_0x4d0c4c,'segmentNameToId':_0x3cde21,'activationsBySegmentId':_0x2066f6,'emailToIdMap':_0x4dafc9,'idToEmailMap':_0x162c44,'connectionNameToIdMap':_0x5de609[_0xe1b4ce(0x23a)],'connectionIdToNameMap':_0x5de609['idToName'],'connectionNameToTypeMap':_0x5de609[_0xe1b4ce(0x231)]};}export function createPushYamlContextForBundle(_0x3a9e98,_0x29f84a,_0x387cab,_0x3e8933,_0xa22d7b,_0x32bf2d,_0x107666,_0x2568e4){const {existingLocalSegmentNames:_0x4bbae4,localExpandedRuleToNames:_0x3c6b7f}=_0x3e8933,_0x13de0d=new Set(),_0x327203=new Map(),_0x1cc531=new Map(),_0x565804=new Map(),_0x42312d=createJumpTargetCache(),_0x45cbae=new Map(),_0x4cc3b9=new Map(),_0x270b2e=new Set();let _0x5484d9;const _0x568907=_0x181843=>{const _0x33368c={'resolveSegment':async _0x2b5984=>{const _0x39df6e=a142_0x3bff,_0x5b9db9=_0x565804[_0x39df6e(0x239)](_0x2b5984);if(_0x5b9db9!==undefined)return{'name':_0x5b9db9,'isJourneyLocal':!![]};try{const _0x3bee38=await fetchSegment(_0x3a9e98,_0x29f84a,_0x2b5984,_0x387cab);if(!_0x3bee38)throw new Error('Segment\x20not\x20found');const _0x112aa1=generateJourneyLocalName(_0x3bee38['name']),_0x1d7f9c=_0x3bee38['kind']===SEGMENT_KIND_JOURNEY&&_0x112aa1!==undefined;let _0x1900c5=_0x3bee38[_0x39df6e(0x26e)],_0x1f1590;if(_0x1d7f9c&&_0x3bee38[_0x39df6e(0x2a2)]){const _0x5194e9=apiRuleToYaml(_0x3bee38[_0x39df6e(0x2a2)]);_0x4cc3b9['set'](_0x2b5984,_0x5194e9);const _0x27abb7=async _0x79eaed=>{const _0x3ed4e8=_0x39df6e,_0x49f498=collectSegmentRefsFromRule(_0x79eaed);for(const _0x5f2dc6 of _0x49f498){if(!_0x4cc3b9[_0x3ed4e8(0x1d5)](_0x5f2dc6))try{const _0x3dd3c2=await fetchSegment(_0x3a9e98,_0x29f84a,_0x5f2dc6,_0x387cab);if(_0x3dd3c2?.[_0x3ed4e8(0x2a2)]){const _0x3ef4cf=apiRuleToYaml(_0x3dd3c2[_0x3ed4e8(0x2a2)]);_0x4cc3b9['set'](_0x5f2dc6,_0x3ef4cf),await _0x27abb7(_0x3ef4cf);}}catch(_0x5eded8){logger[_0x3ed4e8(0x270)]('Failed\x20to\x20fetch\x20referenced\x20segment\x20'+_0x5f2dc6+':\x20'+_0x5eded8);}}};await _0x27abb7(_0x5194e9);const _0x29bbef=serializeExpandedRule(_0x5194e9,_0x4cc3b9),_0x54413c=_0x3c6b7f['get'](_0x29bbef);if(_0x54413c&&_0x54413c['length']>0x0){const _0x21c96e=_0x327203[_0x39df6e(0x239)](_0x29bbef)||0x0,_0x4ff1ea=_0x54413c[_0x21c96e]||_0x54413c[_0x54413c[_0x39df6e(0x1f4)]-0x1];_0x327203[_0x39df6e(0x21b)](_0x29bbef,_0x21c96e+0x1),_0x1900c5=_0x4ff1ea,_0x13de0d[_0x39df6e(0x218)](_0x1900c5),_0x565804[_0x39df6e(0x21b)](_0x2b5984,_0x1900c5);const _0x1fb98b=await resolveRuleSegmentRefs(_0x5194e9,async _0x41dc25=>{const _0x5d603c=_0x39df6e,_0x1c9694=_0x565804['get'](_0x41dc25);if(_0x1c9694)return _0x1c9694;const _0x366d86=await _0x5484d9['resolveSegment'](_0x41dc25);return _0x366d86[_0x5d603c(0x26e)];});_0x1f1590={'description':_0x3bee38[_0x39df6e(0x23e)],'rule':_0x1fb98b};}else{const _0x82a6eb=_0x45cbae[_0x39df6e(0x239)](_0x29bbef);if(_0x82a6eb)_0x1900c5=_0x82a6eb,_0x565804[_0x39df6e(0x21b)](_0x2b5984,_0x1900c5);else{if(_0x112aa1){let _0x283185=_0x112aa1,_0x21bf8b=0x2;while(_0x13de0d[_0x39df6e(0x1d5)](_0x283185)||_0x4bbae4[_0x39df6e(0x1d5)](_0x283185)){_0x283185=_0x112aa1+'_'+_0x21bf8b,_0x21bf8b++;}_0x13de0d[_0x39df6e(0x218)](_0x283185),_0x1900c5=_0x283185;}_0x565804['set'](_0x2b5984,_0x1900c5),_0x45cbae['set'](_0x29bbef,_0x1900c5);const _0x22ec3e=await resolveRuleSegmentRefs(_0x5194e9,async _0x172a59=>{const _0x448abf=_0x39df6e,_0x58b92b=_0x565804[_0x448abf(0x239)](_0x172a59);if(_0x58b92b)return _0x58b92b;const _0x867c25=await _0x5484d9[_0x448abf(0x229)](_0x172a59);return _0x867c25['name'];});_0x1f1590={'description':_0x3bee38[_0x39df6e(0x23e)],'rule':_0x22ec3e};}}}return{'name':_0x1900c5,'isJourneyLocal':_0x1d7f9c,'definition':_0x1f1590};}catch(_0x37062a){return logger['debug'](_0x39df6e(0x25c)+_0x2b5984+':\x20'+_0x37062a),{'name':_0x2b5984,'isJourneyLocal':![]};}},'resolveActivation':async _0x57ab07=>{const _0x257636=a142_0x3bff,_0x59ca3f=_0x1cc531[_0x257636(0x239)](_0x57ab07);if(_0x59ca3f!==undefined)return{'name':_0x59ca3f,'isJourneyLocal':!![]};try{let _0x2d44d0=_0x107666?.[_0x257636(0x239)](_0x57ab07);!_0x2d44d0&&(_0x2d44d0=await _0x3a9e98['journey'][_0x257636(0x1c1)](_0x181843,_0x57ab07));const _0x3c7539=_0x2d44d0['attributes'][_0x257636(0x25f)]['name']||_0x57ab07,_0x2c3129=sanitizeYamlKey(_0x3c7539)||_0x257636(0x29d)+_0x57ab07,_0x235c17=_0x2c3129;_0x1cc531[_0x257636(0x21b)](_0x57ab07,_0x235c17);const _0x30002e=journeyActivationStepToYaml(_0x2d44d0,_0xa22d7b,_0x32bf2d);return{'name':_0x235c17,'isJourneyLocal':!![],'definition':_0x30002e};}catch(_0x53d189){return logger['debug'](_0x257636(0x1f8)+_0x57ab07+':\x20'+_0x53d189),{'name':_0x57ab07,'isJourneyLocal':![]};}},'resolveJumpTarget':(_0x34df31,_0x19d8ef)=>resolveJumpTarget(_0x34df31,_0x19d8ef,_0x42312d,async _0x5b0b31=>{const _0x416ae0=a142_0x3bff,_0x1e9cd7=_0x2568e4?.[_0x416ae0(0x239)](_0x5b0b31);if(_0x1e9cd7)return _0x1e9cd7;return _0x3a9e98[_0x416ae0(0x292)][_0x416ae0(0x1e8)](_0x5b0b31);})};return _0x5484d9=_0x33368c,_0x33368c;},_0x2f3876=async _0x347a81=>{const _0x4a186f=a142_0x3bff,{collectSegmentIdsFromJourneyApi:_0x691994}=await import(_0x4a186f(0x223)),{batchAsync:_0x3df0a2}=await import('../../utils/async.js'),_0x499c51=new Set();for(const _0x174f64 of _0x347a81){let _0xa4dddc=_0x2568e4?.['get'](_0x174f64);!_0xa4dddc&&(_0xa4dddc=await _0x3a9e98['journey'][_0x4a186f(0x1e8)](_0x174f64));const _0x18fc1f=_0x691994(_0xa4dddc);for(const _0x1c5d2b of _0x18fc1f){_0x499c51[_0x4a186f(0x218)](_0x1c5d2b);}}let _0x2f39dd=Array[_0x4a186f(0x246)](_0x499c51);while(_0x2f39dd[_0x4a186f(0x1f4)]>0x0){const _0x479fa2=_0x2f39dd[_0x4a186f(0x29e)](_0x40c743=>!_0x270b2e[_0x4a186f(0x1d5)](_0x40c743));if(_0x479fa2[_0x4a186f(0x1f4)]===0x0)break;const _0x553a1e=await _0x3df0a2(_0x479fa2,async _0xcacf25=>{const _0x264aac=_0x4a186f;_0x270b2e[_0x264aac(0x218)](_0xcacf25);const _0x5c05eb=await fetchSegment(_0x3a9e98,_0x29f84a,_0xcacf25,_0x387cab);if(!_0x5c05eb)return null;return{'segmentId':_0xcacf25,'segment':_0x5c05eb};},0xa),_0x4c29bd=new Set();for(const _0x5d2b3f of _0x553a1e){if(!_0x5d2b3f?.[_0x4a186f(0x1c7)]?.[_0x4a186f(0x2a2)])continue;const _0x3e1296=apiRuleToYaml(_0x5d2b3f[_0x4a186f(0x1c7)]['rule']);_0x4cc3b9[_0x4a186f(0x21b)](_0x5d2b3f[_0x4a186f(0x221)],_0x3e1296);const _0x4467bc=collectSegmentRefsFromRule(_0x3e1296);for(const _0x1c00d3 of _0x4467bc){!_0x270b2e['has'](_0x1c00d3)&&_0x4c29bd[_0x4a186f(0x218)](_0x1c00d3);}}_0x2f39dd=Array[_0x4a186f(0x246)](_0x4c29bd);}};return{'createYamlContext':_0x568907,'prefetchJourneySegments':_0x2f3876};}export async function executePushSegments(_0x515cf4,_0x85c758,_0x3178e4,_0x264d2e,_0x3aa130){const _0xeb6e8f=a142_0x3ef9cf,{segmentDefToCreateRequest:_0x5a61e0,segmentDefToUpdateRequest:_0x37b3a8}=await import(_0xeb6e8f(0x201)),_0x4fb077=_0x3178e4[_0xeb6e8f(0x27f)],_0x94706f=0x5,_0xfa4156=async _0x34e0f1=>{const _0x38c83d=_0xeb6e8f,_0x1c3d45=_0x34e0f1[_0x38c83d(0x1ba)]?_0x4fb077['get'](_0x34e0f1[_0x38c83d(0x1ba)]):undefined;let _0x5e0f50;const _0x45559f={'created':0x0,'updated':0x0,'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};let _0x1edce6=_0x34e0f1[_0x38c83d(0x24a)];if(_0x34e0f1['yamlConfig'][_0x38c83d(0x2a2)]){const _0x5e4513=createSegmentIdResolver(_0x3178e4['segmentNameToId'],_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]),_0x4dabe3=await resolveRuleSegmentIds(_0x34e0f1['yamlConfig'][_0x38c83d(0x2a2)],_0x5e4513);_0x1edce6={..._0x34e0f1['yamlConfig'],'rule':_0x4dabe3};}try{if(_0x34e0f1[_0x38c83d(0x279)]){_0x3aa130[_0x38c83d(0x228)]?.({'type':'segment_creating','name':_0x34e0f1['yamlConfig'][_0x38c83d(0x26e)]});const _0x53edf4=_0x5a61e0(_0x1edce6,_0x1c3d45),_0x3f7a25=await _0x3aa130[_0x38c83d(0x235)](_0x38c83d(0x295)+_0x34e0f1[_0x38c83d(0x24a)]['name']+_0x38c83d(0x1a9),()=>_0x515cf4[_0x38c83d(0x1c7)][_0x38c83d(0x1cb)](_0x264d2e[_0x38c83d(0x23b)],_0x53edf4));_0x5e0f50=_0x3f7a25[_0x38c83d(0x261)]['id'],_0x3178e4['segmentNameToId'][_0x38c83d(0x21b)](_0x34e0f1['yamlConfig']['name'],_0x5e0f50),_0x45559f[_0x38c83d(0x29f)]={'name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)],'id':_0x5e0f50},_0x3aa130[_0x38c83d(0x228)]?.({'type':_0x38c83d(0x254),'name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)],'segmentId':_0x5e0f50}),_0x3aa130[_0x38c83d(0x1f3)]?.(_0x38c83d(0x237)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+'\x27'),_0x45559f[_0x38c83d(0x1e7)]=0x1;}else{if(_0x34e0f1[_0x38c83d(0x1e3)]){_0x3aa130['onProgress']?.({'type':'segment_updating','name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]});const _0xc0bcc=_0x37b3a8(_0x1edce6);_0x1c3d45!==_0x34e0f1[_0x38c83d(0x1b9)]?.[_0x38c83d(0x1d4)]&&(_0xc0bcc[_0x38c83d(0x1d4)]=_0x1c3d45?parseInt(_0x1c3d45,0xa):undefined),await _0x3aa130[_0x38c83d(0x235)](_0x38c83d(0x1af)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+_0x38c83d(0x1a9),()=>_0x515cf4[_0x38c83d(0x1c7)][_0x38c83d(0x200)](_0x264d2e[_0x38c83d(0x23b)],_0x34e0f1[_0x38c83d(0x1b9)]['id'],_0xc0bcc)),_0x5e0f50=_0x34e0f1[_0x38c83d(0x1b9)]['id'],_0x3aa130[_0x38c83d(0x228)]?.({'type':_0x38c83d(0x273),'name':_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]}),_0x3aa130['logSuccess']?.(_0x38c83d(0x1dd)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+'\x27'),_0x45559f[_0x38c83d(0x1b5)]=0x1;}else _0x5e0f50=_0x34e0f1[_0x38c83d(0x1b9)]['id'];}}catch(_0x13fc7a){const _0x25479d=isHttp400Error(_0x13fc7a),_0x223b43=_0x25479d?ErrorCode[_0x38c83d(0x220)]:ErrorCode[_0x38c83d(0x299)],_0x86cb0b=getErrorMessage(_0x13fc7a);throw new SDKError(_0x223b43,_0x38c83d(0x230)+(_0x34e0f1['isNew']?_0x38c83d(0x28b):_0x38c83d(0x26c))+_0x38c83d(0x26f)+_0x34e0f1[_0x38c83d(0x27a)]+_0x38c83d(0x225)+_0x86cb0b,_0x13fc7a);}try{const _0x38767a=await syncActivationsForSegment(_0x515cf4,_0x264d2e[_0x38c83d(0x23b)],_0x5e0f50,_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)],_0x34e0f1[_0x38c83d(0x1b4)],_0x3aa130,_0x34e0f1['absolutePath']);_0x45559f[_0x38c83d(0x2a4)]=_0x38767a;}catch(_0x453449){if(_0x453449 instanceof SDKError)throw _0x453449;throw new SDKError(ErrorCode[_0x38c83d(0x214)],_0x38c83d(0x290)+_0x34e0f1[_0x38c83d(0x24a)][_0x38c83d(0x26e)]+_0x38c83d(0x256)+_0x34e0f1[_0x38c83d(0x27a)]+_0x38c83d(0x225)+getErrorMessage(_0x453449),_0x453449);}return _0x45559f;},_0x101e57=await batchAsync(_0x85c758,_0xfa4156,_0x94706f),_0x282c8d={'created':0x0,'updated':0x0,'deleted':0x0,'createdSegmentIds':new Map(),'activations':{'created':0x0,'updated':0x0,'deleted':0x0}};for(const _0x5c20dc of _0x101e57){_0x282c8d['created']+=_0x5c20dc[_0xeb6e8f(0x1e7)],_0x282c8d[_0xeb6e8f(0x1b5)]+=_0x5c20dc[_0xeb6e8f(0x1b5)],_0x5c20dc[_0xeb6e8f(0x29f)]&&_0x282c8d[_0xeb6e8f(0x249)][_0xeb6e8f(0x21b)](_0x5c20dc['createdSegmentId'][_0xeb6e8f(0x26e)],_0x5c20dc[_0xeb6e8f(0x29f)]['id']),_0x282c8d[_0xeb6e8f(0x2a4)][_0xeb6e8f(0x1e7)]+=_0x5c20dc[_0xeb6e8f(0x2a4)][_0xeb6e8f(0x1e7)],_0x282c8d['activations'][_0xeb6e8f(0x1b5)]+=_0x5c20dc[_0xeb6e8f(0x2a4)]['updated'],_0x282c8d['activations'][_0xeb6e8f(0x22a)]+=_0x5c20dc[_0xeb6e8f(0x2a4)][_0xeb6e8f(0x22a)];}return _0x282c8d;}async function syncActivationsForSegment(_0x5d3f3d,_0x19e6eb,_0x3f6b7b,_0xa4f5bd,_0x59d10d,_0x10e1d9,_0x3ceb17){const _0x259b75=a142_0x3ef9cf,_0x29be11={'created':0x0,'updated':0x0,'deleted':0x0};for(const _0x361c6a of _0x59d10d){try{if(_0x361c6a[_0x259b75(0x21a)]===_0x259b75(0x28b)&&_0x361c6a[_0x259b75(0x22f)])_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x2a1),'segmentName':_0xa4f5bd,'activationName':_0x361c6a['name']}),await _0x10e1d9[_0x259b75(0x235)](_0x259b75(0x252)+_0x361c6a[_0x259b75(0x26e)]+_0x259b75(0x1a9),()=>_0x5d3f3d['segment']['createActivation'](_0x19e6eb,_0x3f6b7b,_0x361c6a[_0x259b75(0x22f)])),_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x1bc),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),_0x10e1d9[_0x259b75(0x1f3)]?.(_0x259b75(0x204)+_0x361c6a[_0x259b75(0x26e)]+'\x27'),_0x29be11[_0x259b75(0x1e7)]++;else{if(_0x361c6a['type']===_0x259b75(0x26c)&&_0x361c6a[_0x259b75(0x22f)]&&_0x361c6a[_0x259b75(0x1cc)])_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x1b6),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),await _0x10e1d9['withProgress'](_0x259b75(0x1b0)+_0x361c6a[_0x259b75(0x26e)]+_0x259b75(0x1a9),()=>_0x5d3f3d[_0x259b75(0x1c7)][_0x259b75(0x25d)](_0x19e6eb,_0x3f6b7b,_0x361c6a[_0x259b75(0x1cc)]['id'],_0x361c6a[_0x259b75(0x22f)])),_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x250),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),_0x10e1d9[_0x259b75(0x1f3)]?.(_0x259b75(0x259)+_0x361c6a[_0x259b75(0x26e)]+'\x27'),_0x29be11['updated']++;else _0x361c6a[_0x259b75(0x21a)]==='delete'&&_0x361c6a[_0x259b75(0x1cc)]&&(_0x10e1d9['onProgress']?.({'type':_0x259b75(0x1cd),'segmentName':_0xa4f5bd,'activationName':_0x361c6a[_0x259b75(0x26e)]}),await _0x10e1d9[_0x259b75(0x235)]('Deleting\x20activation\x20\x27'+_0x361c6a['name']+'\x27...',()=>_0x5d3f3d[_0x259b75(0x1c7)][_0x259b75(0x1a7)](_0x19e6eb,_0x3f6b7b,_0x361c6a[_0x259b75(0x1cc)]['id'])),_0x10e1d9[_0x259b75(0x228)]?.({'type':_0x259b75(0x289),'segmentName':_0xa4f5bd,'activationName':_0x361c6a['name']}),_0x10e1d9[_0x259b75(0x1c9)]?.(_0x259b75(0x1fa)+_0x361c6a[_0x259b75(0x26e)]+'\x27'),_0x29be11[_0x259b75(0x22a)]++);}}catch(_0x45391b){const _0x1b4077=isHttp400Error(_0x45391b),_0x360f5e=_0x1b4077?ErrorCode[_0x259b75(0x244)]:ErrorCode[_0x259b75(0x214)],_0xd2b069=getErrorMessage(_0x45391b);throw new SDKError(_0x360f5e,'Failed\x20to\x20'+_0x361c6a[_0x259b75(0x21a)]+_0x259b75(0x28a)+_0x361c6a[_0x259b75(0x26e)]+'\x27\x20from\x20file:\x20'+_0x3ceb17+_0x259b75(0x225)+_0xd2b069,_0x45391b);}}return _0x29be11;}export async function executePushFolders(_0x3dc75c,_0x1c4e58,_0x724a67,_0x1c7c56,_0xef1eb0){const _0x4a80c1=a142_0x3ef9cf,_0x2137d8=new Map(_0x724a67),_0x37e1f6=sortFoldersByDepth(_0x1c4e58);for(const _0x28c332 of _0x37e1f6){const _0x37eea9=_0x28c332[_0x4a80c1(0x1ce)]('/'),_0x4d7014=_0x37eea9[_0x37eea9[_0x4a80c1(0x1f4)]-0x1],_0x8fe0b9=_0x37eea9[_0x4a80c1(0x212)](0x0,-0x1)[_0x4a80c1(0x271)]('/'),_0x24fd31=_0x2137d8[_0x4a80c1(0x239)](_0x8fe0b9);_0xef1eb0[_0x4a80c1(0x228)]?.({'type':'folder_creating','folder':_0x28c332});const _0x2eca18={'name':_0x4d7014,'parentFolderId':_0x24fd31},_0x39be64=await _0xef1eb0[_0x4a80c1(0x235)](_0x4a80c1(0x291)+_0x28c332+'\x27...',()=>_0x3dc75c[_0x4a80c1(0x1c7)][_0x4a80c1(0x1f0)](_0x1c7c56[_0x4a80c1(0x23b)],_0x2eca18));_0x2137d8['set'](_0x28c332,_0x39be64[_0x4a80c1(0x261)]['id']),_0xef1eb0['onProgress']?.({'type':_0x4a80c1(0x283),'folder':_0x28c332,'folderId':_0x39be64[_0x4a80c1(0x261)]['id']}),_0xef1eb0['logInfo']?.('Created\x20folder\x20\x27'+_0x28c332+'\x27');}return _0x2137d8;}export async function executePushSegmentDeletions(_0x5abd9e,_0x371803,_0x130695){const _0x326e08=a142_0x3ef9cf;if(_0x371803[_0x326e08(0x1f4)]===0x0)return 0x0;const {batchAsync:_0x3f6c82}=await import(_0x326e08(0x22d)),_0xb7b576=0x5,_0xa3c567=await _0x3f6c82(_0x371803,async _0x8dafe5=>{const _0x446ace=_0x326e08;return _0x130695['onProgress']?.({'type':'segment_deleting','name':_0x8dafe5[_0x446ace(0x26e)]}),await _0x5abd9e[_0x446ace(0x1c7)][_0x446ace(0x274)](_0x8dafe5['id']),_0x130695[_0x446ace(0x228)]?.({'type':'segment_deleted','name':_0x8dafe5['name']}),_0x130695[_0x446ace(0x1c9)]?.(_0x446ace(0x219)+_0x8dafe5['name']+'\x27'),0x1;},_0xb7b576);return _0xa3c567[_0x326e08(0x1b2)]((_0x13a7d0,_0x12cf1f)=>_0x13a7d0+_0x12cf1f,0x0);}export async function executePushJourneys(_0x39c8cf,_0x411c9f,_0x3e4b9e,_0x157f70,_0x10d8fc){const _0x1561fa=a142_0x3ef9cf,{journeyDefToRequest:_0x4ed490}=await import(_0x1561fa(0x223)),{activationDefToCreateRequest:_0x2dca40,yamlRuleToApi:_0x2723c6,validateSegmentRule:_0x470ef6}=await import(_0x1561fa(0x201)),_0x5209c9={'results':[],'created':0x0,'updated':0x0,'embeddedSegmentNameToId':new Map()},_0x5ee96e=new Map(_0x3e4b9e[_0x1561fa(0x1fc)]),_0x269afd=0x5;for(let _0x1274b2=0x0;_0x1274b2<_0x411c9f[_0x1561fa(0x1f4)];_0x1274b2+=_0x269afd){const _0x2e70eb=_0x411c9f['slice'](_0x1274b2,_0x1274b2+_0x269afd),_0x46c3ac=await Promise[_0x1561fa(0x20f)](_0x2e70eb[_0x1561fa(0x209)](async _0xba54b6=>{const _0x19ed66=_0x1561fa;if(!_0xba54b6[_0x19ed66(0x279)]&&!_0xba54b6[_0x19ed66(0x1e3)])return{'action':_0x19ed66(0x1c5),'name':_0xba54b6[_0x19ed66(0x24a)][_0x19ed66(0x26e)],'journeyId':_0xba54b6['existingJourney']?.['id']};const _0x30af03=_0xba54b6[_0x19ed66(0x1ba)]?_0x3e4b9e['folderPathToId'][_0x19ed66(0x239)](_0xba54b6[_0x19ed66(0x1ba)]):undefined;_0x10d8fc[_0x19ed66(0x228)]?.({'type':_0xba54b6[_0x19ed66(0x279)]?'journey_creating':_0x19ed66(0x1a8),'name':_0xba54b6[_0x19ed66(0x24a)]['name']});try{const _0x56a322=await executeSingleJourneyPush(_0x39c8cf,_0xba54b6,{..._0x3e4b9e,'segmentNameToId':_0x5ee96e},{'parentId':_0x157f70[_0x19ed66(0x23b)],'rootFolderId':_0x157f70[_0x19ed66(0x2a3)],'folderId':_0x30af03,'verbose':_0x157f70[_0x19ed66(0x234)]},_0x10d8fc,{'journeyDefToRequest':_0x4ed490,'activationDefToCreateRequest':_0x2dca40,'yamlRuleToApi':_0x2723c6,'validateSegmentRule':_0x470ef6});for(const [_0x25f90e,_0x5e540b]of _0x56a322['embeddedSegmentNameToId']){_0x5ee96e[_0x19ed66(0x21b)](_0x25f90e,_0x5e540b),_0x5209c9[_0x19ed66(0x26a)][_0x19ed66(0x21b)](_0x25f90e,_0x5e540b);}if(_0x56a322[_0x19ed66(0x255)]==='created')_0x10d8fc['onProgress']?.({'type':_0x19ed66(0x281),'name':_0xba54b6[_0x19ed66(0x24a)]['name'],'journeyId':_0x56a322[_0x19ed66(0x215)]}),_0x10d8fc[_0x19ed66(0x1f3)]?.(_0x19ed66(0x1c0)+_0xba54b6['yamlConfig'][_0x19ed66(0x26e)]+'\x27'),_0x5209c9[_0x19ed66(0x1e7)]++;else _0x56a322[_0x19ed66(0x255)]===_0x19ed66(0x1b5)&&(_0x10d8fc[_0x19ed66(0x228)]?.({'type':_0x19ed66(0x1c3),'name':_0xba54b6[_0x19ed66(0x24a)][_0x19ed66(0x26e)]}),_0x10d8fc[_0x19ed66(0x1f3)]?.(_0x19ed66(0x20a)+_0xba54b6[_0x19ed66(0x24a)][_0x19ed66(0x26e)]+'\x27'),_0x5209c9[_0x19ed66(0x1b5)]++);return{'action':_0x56a322[_0x19ed66(0x255)],'name':_0xba54b6[_0x19ed66(0x24a)]['name'],'journeyId':_0x56a322[_0x19ed66(0x215)]};}catch(_0x50b348){const _0x42fd14=isHttp400Error(_0x50b348),_0x1bd7fe=_0x42fd14?ErrorCode[_0x19ed66(0x258)]:ErrorCode[_0x19ed66(0x1b1)],_0x32da06=getErrorMessage(_0x50b348);throw new SDKError(_0x1bd7fe,_0x19ed66(0x230)+(_0xba54b6['isNew']?_0x19ed66(0x28b):_0x19ed66(0x26c))+_0x19ed66(0x1ff)+_0xba54b6['absolutePath']+_0x19ed66(0x225)+_0x32da06,_0x50b348);}}));_0x5209c9[_0x1561fa(0x27c)][_0x1561fa(0x1a4)](..._0x46c3ac);}return _0x5209c9;}async function matchExistingJourneySegments(_0x48d0cd,_0x29d426,_0x455e1d,_0x1944d9,_0x5d923e){const _0x86a001=a142_0x3ef9cf;if(!_0x29d426[_0x86a001(0x1f1)]||!_0x29d426[_0x86a001(0x24a)][_0x86a001(0x25b)])return;const _0x4cedb0=new Map(),_0x8c0ad4=new Set();for(const _0x1f4500 of Object[_0x86a001(0x294)](_0x29d426[_0x86a001(0x24a)]['segments'])){const _0x4bc281=generateDeterministicJourneySegmentName(_0x29d426[_0x86a001(0x24a)][_0x86a001(0x26e)],_0x1f4500);_0x4cedb0['set'](_0x4bc281,_0x1f4500),_0x8c0ad4[_0x86a001(0x218)](_0x1f4500);}const _0x2d66fa=[],_0x3dabfe=collectSegmentIdsFromJourneyApi(_0x29d426[_0x86a001(0x1f1)]);for(const _0x32bf43 of _0x3dabfe){const _0x512019=await fetchSegment(_0x48d0cd,_0x455e1d,_0x32bf43,_0x1944d9);if(!_0x512019?.[_0x86a001(0x26e)])continue;const _0x474985=_0x4cedb0['get'](_0x512019['name']);_0x474985?(_0x5d923e['set'](_0x474985,_0x32bf43),_0x8c0ad4[_0x86a001(0x1f9)](_0x474985)):_0x2d66fa[_0x86a001(0x1a4)]({'id':_0x32bf43,'seg':_0x512019});}if(_0x8c0ad4[_0x86a001(0x227)]>0x0&&_0x2d66fa[_0x86a001(0x1f4)]>0x0){const {localExpandedRuleToNames:_0x5ee4bf}=buildLocalExpandedRuleMappings(_0x29d426['yamlConfig']),_0x3158ca=new Map();for(const {id:_0x5ee772,seg:_0x1df42b}of _0x2d66fa){if(_0x1df42b[_0x86a001(0x2a2)]){const _0x366d75=apiRuleToYaml(_0x1df42b[_0x86a001(0x2a2)]);_0x3158ca[_0x86a001(0x21b)](_0x5ee772,_0x366d75);}}for(const {id:_0x3bce3c,seg:_0xf47c5f}of _0x2d66fa){if(!_0xf47c5f[_0x86a001(0x2a2)])continue;const _0x5892a1=_0x3158ca[_0x86a001(0x239)](_0x3bce3c);if(!_0x5892a1)continue;const _0x327850=serializeExpandedRule(_0x5892a1,_0x3158ca),_0xfdd2=_0x5ee4bf['get'](_0x327850);if(_0xfdd2){const _0x31a12a=_0xfdd2['find'](_0x520372=>_0x8c0ad4['has'](_0x520372));_0x31a12a&&(_0x5d923e['set'](_0x31a12a,_0x3bce3c),_0x8c0ad4[_0x86a001(0x1f9)](_0x31a12a),logger[_0x86a001(0x270)]('Matched\x20server\x20segment\x20\x27'+_0xf47c5f[_0x86a001(0x26e)]+'\x27\x20to\x20local\x20\x27'+_0x31a12a+'\x27\x20by\x20rule\x20content'));}}}}async function executeSingleJourneyPush(_0x2cabea,_0x26a4e7,_0x16c207,_0x3127b6,_0x5c90a6,_0x1c341a){const _0x41c72f=a142_0x3ef9cf,{journeyDefToRequest:_0x1bb1d9,activationDefToCreateRequest:_0x454e50,yamlRuleToApi:_0x4893e3,validateSegmentRule:_0x24b7c5}=_0x1c341a,_0x314f02=new Map(),_0x20f161=new Map();recoverSegmentIdsFromPushRecovery(_0x26a4e7,_0x314f02,_0x16c207[_0x41c72f(0x1fc)]);const _0xc7d9c8=new Map(),_0x24c57a=new Map(),_0x41c48e=new Map();let _0x46abb7;const _0x5bdaa1=async()=>{const _0x295e91=_0x41c72f;if(_0x46abb7)return;_0x46abb7=new Map();if(!_0x26a4e7['existingJourney'])return;const _0x58779e=await _0x2cabea[_0x295e91(0x292)][_0x295e91(0x28f)](_0x26a4e7['existingJourney']['id']);for(const _0x1763a5 of _0x58779e){const _0x484f32=journeyActivationStepToYaml(_0x1763a5,_0x16c207[_0x295e91(0x298)],_0x16c207[_0x295e91(0x1aa)]),_0x8dab28=activationSignature(_0x484f32);!_0x46abb7['has'](_0x8dab28)&&_0x46abb7['set'](_0x8dab28,_0x1763a5['id']),_0x484f32['name']&&_0x20f161['set'](_0x484f32[_0x295e91(0x26e)],_0x1763a5['id']);}};await matchExistingJourneySegments(_0x2cabea,_0x26a4e7,_0x3127b6['parentId'],_0x16c207[_0x41c72f(0x222)],_0x16c207['segmentNameToId']);const _0x331143={'resolveSegmentId':async _0x27242b=>{const _0x31e0a4=_0x41c72f,_0x5e5bb8=_0x16c207[_0x31e0a4(0x1fc)][_0x31e0a4(0x239)](_0x27242b);if(!_0x5e5bb8)throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],'Segment\x20not\x20found:\x20'+_0x27242b+_0x31e0a4(0x1a5)+_0x26a4e7['yamlConfig'][_0x31e0a4(0x26e)]+')');return _0x5e5bb8;},'resolveEmbeddedSegmentId':async(_0x30363c,_0x1ec0be)=>{const _0xabfca8=_0x41c72f,_0x24c569=_0x16c207['segmentNameToId'][_0xabfca8(0x239)](_0x30363c);if(_0x24c569)return _0x24c569;const _0x592181=_0x16c207[_0xabfca8(0x222)][_0xabfca8(0x1d9)](_0x46abea=>_0x46abea[_0xabfca8(0x26e)]===_0x30363c);if(_0x592181)return _0x16c207['segmentNameToId']['set'](_0x30363c,_0x592181['id']),_0x592181['id'];if(_0x26a4e7[_0xabfca8(0x279)]){const {stageName:_0x26c2f5,criteriaName:_0x5cba0f}=findSegmentCriteriaLocation(_0x26a4e7[_0xabfca8(0x24a)],_0x30363c);return _0x24b7c5(_0x30363c,_0x1ec0be[_0xabfca8(0x2a2)]),_0x24c57a[_0xabfca8(0x21b)](_0x30363c,{'definition':_0x1ec0be,'stageName':_0x26c2f5,'criteriaName':_0x5cba0f}),createPendingSegmentId(_0x30363c);}const _0x5d9804=_0x26a4e7[_0xabfca8(0x1f1)]?.['id'];if(!_0x5d9804)throw new SDKError(ErrorCode[_0xabfca8(0x23f)],_0xabfca8(0x1ee));const _0x1b1400=_0xc7d9c8[_0xabfca8(0x239)](_0x30363c);if(_0x1b1400)return _0x1b1400;const _0x43c190=((async()=>{const _0xcd0e0b=_0xabfca8;_0x24b7c5(_0x30363c,_0x1ec0be[_0xcd0e0b(0x2a2)]);const _0x202343=generateDeterministicJourneySegmentName(_0x26a4e7['yamlConfig']['name'],_0x30363c),_0x46d78c=_0x16c207[_0xcd0e0b(0x222)]['find'](_0xf6b213=>_0xf6b213[_0xcd0e0b(0x26e)]===_0x202343),_0x509757=createSegmentIdResolver(_0x16c207['segmentNameToId'],_0x30363c),_0xf1b700=await resolveRuleSegmentIds(_0x1ec0be[_0xcd0e0b(0x2a2)],_0x509757);let _0x3b09a4;return _0x46d78c?(await _0x2cabea[_0xcd0e0b(0x1c7)][_0xcd0e0b(0x200)](_0x3127b6[_0xcd0e0b(0x23b)],_0x46d78c['id'],{'description':_0x1ec0be[_0xcd0e0b(0x23e)]||_0xcd0e0b(0x1f5)+_0x30363c,'rule':_0x4893e3(_0xf1b700,!![]),'countPopulation':!![]}),_0x3b09a4=_0x46d78c['id'],saveSegmentToPushRecovery(_0x26a4e7[_0xcd0e0b(0x27a)],_0x26a4e7[_0xcd0e0b(0x24a)][_0xcd0e0b(0x26e)],_0x30363c,{'segmentId':_0x3b09a4,'uniqueServerName':_0x202343,'createdAt':new Date()[_0xcd0e0b(0x213)]()})):_0x3b09a4=await createOrRecoverEmbeddedSegment(_0x2cabea,_0x26a4e7,{'localName':_0x30363c,'uniqueSegmentName':_0x202343,'description':_0x1ec0be[_0xcd0e0b(0x23e)]||_0xcd0e0b(0x1f5)+_0x30363c,'journeyId':_0x5d9804,'resolvedRule':_0xf1b700,'parentId':_0x3127b6[_0xcd0e0b(0x23b)],'folderId':_0x3127b6[_0xcd0e0b(0x2a3)]||''},_0x4893e3),_0x16c207['segmentNameToId'][_0xcd0e0b(0x21b)](_0x30363c,_0x3b09a4),_0x314f02[_0xcd0e0b(0x21b)](_0x30363c,_0x3b09a4),_0x3b09a4;})());_0xc7d9c8['set'](_0x30363c,_0x43c190);try{return await _0x43c190;}finally{_0xc7d9c8[_0xabfca8(0x1f9)](_0x30363c);}},'resolveActivationId':async _0x1e6c4e=>{const _0x16fded=_0x41c72f,_0x517921=_0x20f161['get'](_0x1e6c4e);if(_0x517921)return _0x517921;if(_0x26a4e7[_0x16fded(0x1f1)]){await _0x5bdaa1();const _0x39817c=_0x20f161['get'](_0x1e6c4e);if(_0x39817c)return _0x39817c;}throw new SDKError(ErrorCode[_0x16fded(0x260)],_0x16fded(0x1c4)+_0x1e6c4e+'\x20(referenced\x20in\x20journey\x20'+_0x26a4e7[_0x16fded(0x24a)][_0x16fded(0x26e)]+_0x16fded(0x257)+_0x16fded(0x263));},'resolveEmbeddedActivationId':async(_0x4ec618,_0x2bde49)=>{const _0x1fe719=_0x41c72f,_0x287781=_0x20f161[_0x1fe719(0x239)](_0x4ec618);if(_0x287781)return _0x287781;if(_0x26a4e7[_0x1fe719(0x279)])return _0x41c48e[_0x1fe719(0x21b)](_0x4ec618,_0x2bde49),createPendingActivationId(_0x4ec618);if(_0x26a4e7['existingJourney']){await _0x5bdaa1();const _0x34f922=_0x20f161[_0x1fe719(0x239)](_0x2bde49['name']);if(_0x34f922)return _0x20f161[_0x1fe719(0x21b)](_0x4ec618,_0x34f922),_0x34f922;const _0x47513d=activationSignature(_0x2bde49),_0x3b3246=_0x46abb7?.[_0x1fe719(0x239)](_0x47513d);if(_0x3b3246)return _0x20f161[_0x1fe719(0x21b)](_0x4ec618,_0x3b3246),_0x3b3246;const _0x374d7b=await _0x454e50(_0x2bde49,_0x16c207[_0x1fe719(0x28d)]),_0x5615da={..._0x374d7b,..._0x2bde49[_0x1fe719(0x297)]!==undefined&&{'runAfterJourneyRefresh':_0x2bde49[_0x1fe719(0x297)]}},_0x2ad5da=await _0x2cabea[_0x1fe719(0x292)][_0x1fe719(0x29b)](_0x26a4e7[_0x1fe719(0x1f1)]['id'],_0x5615da);return _0x20f161[_0x1fe719(0x21b)](_0x4ec618,_0x2ad5da['id']),_0x2ad5da['id'];}throw new SDKError(ErrorCode[_0x1fe719(0x23f)],_0x1fe719(0x27d));},'resolveJourneyId':async _0x5ee2df=>{const _0x5cd087=_0x41c72f;try{return await _0x2cabea[_0x5cd087(0x292)]['resolveJourneyId'](_0x3127b6[_0x5cd087(0x23b)],_0x5ee2df);}catch(_0x443ca2){throw new SDKError(ErrorCode['NOT_FOUND'],_0x5cd087(0x23d)+_0x5ee2df+_0x5cd087(0x247)+_0x26a4e7[_0x5cd087(0x24a)][_0x5cd087(0x26e)]+'\x27)',_0x443ca2);}},'resolveStageId':async(_0x198bf1,_0x3a13e1)=>{const _0x2b7e37=_0x41c72f,_0x2cebf4=await _0x2cabea[_0x2b7e37(0x292)][_0x2b7e37(0x1e8)](_0x198bf1),_0x3d4f89=_0x2cebf4[_0x2b7e37(0x1fe)][_0x2b7e37(0x21f)][_0x2b7e37(0x1d9)](_0x46d7db=>_0x46d7db[_0x2b7e37(0x26e)][_0x2b7e37(0x24b)]()===_0x3a13e1[_0x2b7e37(0x24b)]());if(!_0x3d4f89?.['id'])throw new SDKError(ErrorCode[_0x2b7e37(0x260)],_0x2b7e37(0x1c8)+_0x3a13e1+_0x2b7e37(0x1ef)+(_0x2cebf4[_0x2b7e37(0x1fe)][_0x2b7e37(0x1b8)]||_0x2cebf4[_0x2b7e37(0x1fe)][_0x2b7e37(0x26e)])+'\x27');return _0x3d4f89['id'];}},_0x2b3b34=await _0x1bb1d9(_0x26a4e7[_0x41c72f(0x24a)],_0x3127b6[_0x41c72f(0x23b)],_0x331143),_0x21a3d0=_0x3127b6[_0x41c72f(0x25e)]||_0x3127b6[_0x41c72f(0x2a3)];_0x21a3d0&&(_0x2b3b34[_0x41c72f(0x1f6)]={'parentFolder':{'data':{'id':_0x21a3d0,'type':_0x41c72f(0x284)}}});if(_0x26a4e7['isNew']){if(_0x24c57a[_0x41c72f(0x227)]>0x0||_0x41c48e[_0x41c72f(0x227)]>0x0)return await executeThreeStepJourneyCreate(_0x2cabea,_0x26a4e7,_0x2b3b34,{'pendingEmbeddedSegments':_0x24c57a,'pendingEmbeddedActivations':_0x41c48e,'embeddedSegmentNameToId':_0x314f02,'journeyActivationNameToId':_0x20f161},{..._0x3127b6,'effectiveFolderId':_0x21a3d0},_0x16c207,_0x5c90a6,_0x1c341a);else{ensureJourneyDefaults(_0x2b3b34[_0x41c72f(0x1fe)]);const _0x564046=await _0x2cabea[_0x41c72f(0x292)]['create'](_0x2b3b34);return deletePushRecovery(_0x26a4e7['absolutePath']),{'action':'created','journeyId':_0x564046['id'],'embeddedSegmentNameToId':_0x314f02};}}else{if(_0x26a4e7[_0x41c72f(0x1e3)]&&_0x26a4e7['existingJourney']){_0x2b3b34['id']=_0x26a4e7['existingJourney']['id'];const _0x1b6571=_0x2b3b34[_0x41c72f(0x1fe)];_0x26a4e7[_0x41c72f(0x1f1)][_0x41c72f(0x1fe)]?.['journeyBundleName']&&(_0x1b6571[_0x41c72f(0x1b8)]=_0x26a4e7['existingJourney'][_0x41c72f(0x1fe)][_0x41c72f(0x1b8)]);const _0x2cfb2b=_0x26a4e7['existingJourney'][_0x41c72f(0x1fe)]?.['journeyStages'];return _0x2cfb2b&&_0x2b3b34[_0x41c72f(0x1fe)][_0x41c72f(0x21f)]&&injectExistingStageIds(_0x2b3b34['attributes'][_0x41c72f(0x21f)],_0x2cfb2b),ensureJourneyDefaults(_0x1b6571),await _0x2cabea['journey']['update'](_0x26a4e7[_0x41c72f(0x1f1)]['id'],_0x2b3b34),deletePushRecovery(_0x26a4e7['absolutePath']),{'action':_0x41c72f(0x1b5),'journeyId':_0x26a4e7[_0x41c72f(0x1f1)]['id'],'embeddedSegmentNameToId':_0x314f02};}}return deletePushRecovery(_0x26a4e7[_0x41c72f(0x27a)]),{'action':_0x41c72f(0x1c5),'journeyId':_0x26a4e7[_0x41c72f(0x1f1)]?.['id'],'embeddedSegmentNameToId':_0x314f02};}function findSegmentCriteriaLocation(_0x8e14f8,_0x4d815){const _0x1b6966=a142_0x3ef9cf,_0x4eb3b1=_0x8e14f8['stages']||_0x8e14f8[_0x1b6966(0x2a6)]?.[0x0]?.[_0x1b6966(0x1fd)]||[];let _0x2dfdc8=_0x1b6966(0x24e),_0x94c08f=_0x4d815;const _0x33350a=_0x8e14f8[_0x1b6966(0x269)]||_0x8e14f8[_0x1b6966(0x2a6)]?.[0x0]?.['goal'];if(_0x33350a?.[_0x1b6966(0x1c7)]===_0x4d815)return{'stageName':_0x1b6966(0x269),'criteriaName':_0x33350a[_0x1b6966(0x26e)]||_0x4d815};_0x28eae6:for(const _0x5c06d5 of _0x4eb3b1){if(_0x5c06d5[_0x1b6966(0x28e)]?.[_0x1b6966(0x1c7)]===_0x4d815){_0x2dfdc8=_0x5c06d5[_0x1b6966(0x26e)],_0x94c08f=_0x5c06d5['entry_criteria'][_0x1b6966(0x26e)]||_0x4d815;break;}if(_0x5c06d5[_0x1b6966(0x1a6)])for(const _0x22eef7 of _0x5c06d5['steps']){if(_0x22eef7[_0x1b6966(0x21a)]==='decision_point'&&_0x22eef7[_0x1b6966(0x1c6)]?.[_0x1b6966(0x245)])for(const _0x46c1e5 of _0x22eef7[_0x1b6966(0x1c6)][_0x1b6966(0x245)]){if(_0x46c1e5['segment']===_0x4d815){_0x2dfdc8=_0x5c06d5['name'],_0x94c08f=_0x46c1e5['name']||_0x4d815;break _0x28eae6;}}}}return{'stageName':_0x2dfdc8,'criteriaName':_0x94c08f};}async function executeThreeStepJourneyCreate(_0x1f968d,_0x16419c,_0x2db39b,_0x45ecc5,_0x350a61,_0x1d7529,_0x3598cf,_0x3c4ece){const _0x8d9cc1=a142_0x3ef9cf,{activationDefToCreateRequest:_0x471e03,yamlRuleToApi:_0x336715}=_0x3c4ece,{pendingEmbeddedSegments:_0xc2fb0d,pendingEmbeddedActivations:_0x1ab618,embeddedSegmentNameToId:_0x34af2c}=_0x45ecc5,_0x1c5b81=JSON[_0x8d9cc1(0x1dc)](JSON['stringify'](_0x2db39b));ensureJourneyDefaults(_0x1c5b81[_0x8d9cc1(0x1fe)]),stripPendingIds(_0x1c5b81);const _0x4c4ba7=await _0x1f968d[_0x8d9cc1(0x292)][_0x8d9cc1(0x28b)](_0x1c5b81),_0x33abf7=_0x4c4ba7['id'],_0x3286e4=new Map();for(const _0x4a73ce of _0x4c4ba7[_0x8d9cc1(0x1fe)][_0x8d9cc1(0x21f)]){_0x3286e4[_0x8d9cc1(0x21b)](_0x4a73ce['name'][_0x8d9cc1(0x24b)](),_0x4a73ce['id']);}recoverSegmentIdsFromPushRecovery(_0x16419c,_0x34af2c,_0x1d7529[_0x8d9cc1(0x1fc)]);for(const [_0x22dbaa,{definition:_0x253027}]of _0xc2fb0d){if(_0x34af2c[_0x8d9cc1(0x1d5)](_0x22dbaa)){_0x3598cf[_0x8d9cc1(0x228)]?.({'type':_0x8d9cc1(0x1e5),'journeyName':_0x16419c[_0x8d9cc1(0x24a)][_0x8d9cc1(0x26e)],'segmentName':_0x22dbaa});continue;}const _0x199a39=generateDeterministicJourneySegmentName(_0x16419c[_0x8d9cc1(0x24a)][_0x8d9cc1(0x26e)],_0x22dbaa);_0x3598cf[_0x8d9cc1(0x228)]?.({'type':'embedded_segment_creating','journeyName':_0x16419c['yamlConfig'][_0x8d9cc1(0x26e)],'segmentName':_0x22dbaa});const _0x3e7307=createSegmentIdResolver(_0x1d7529['segmentNameToId'],_0x22dbaa),_0x3c4098=await resolveRuleSegmentIds(_0x253027[_0x8d9cc1(0x2a2)],_0x3e7307),_0x4f784c=await createOrRecoverEmbeddedSegment(_0x1f968d,_0x16419c,{'localName':_0x22dbaa,'uniqueSegmentName':_0x199a39,'description':_0x253027[_0x8d9cc1(0x23e)]||_0x8d9cc1(0x1f5)+_0x22dbaa,'journeyId':_0x33abf7,'resolvedRule':_0x3c4098,'parentId':_0x350a61['parentId'],'folderId':_0x350a61['effectiveFolderId']||''},_0x336715);_0x34af2c[_0x8d9cc1(0x21b)](_0x22dbaa,_0x4f784c),_0x1d7529[_0x8d9cc1(0x1fc)][_0x8d9cc1(0x21b)](_0x22dbaa,_0x4f784c),_0x3598cf[_0x8d9cc1(0x228)]?.({'type':'embedded_segment_created','journeyName':_0x16419c[_0x8d9cc1(0x24a)][_0x8d9cc1(0x26e)],'segmentName':_0x22dbaa});}const _0x3221f4=new Map();for(const [_0x222694,_0x32302b]of _0x1ab618){_0x3598cf[_0x8d9cc1(0x228)]?.({'type':_0x8d9cc1(0x1ae),'journeyName':_0x16419c['yamlConfig'][_0x8d9cc1(0x26e)],'activationName':_0x222694});const _0x465c69=await _0x471e03(_0x32302b,_0x1d7529[_0x8d9cc1(0x28d)]),_0x38ed47={..._0x465c69,..._0x32302b[_0x8d9cc1(0x297)]!==undefined&&{'runAfterJourneyRefresh':_0x32302b['run_after_journey_refresh']}},_0x44be69=await _0x1f968d[_0x8d9cc1(0x292)][_0x8d9cc1(0x29b)](_0x33abf7,_0x38ed47);_0x3221f4[_0x8d9cc1(0x21b)](_0x222694,_0x44be69['id']),_0x45ecc5[_0x8d9cc1(0x1bf)]['set'](_0x222694,_0x44be69['id']),_0x3598cf[_0x8d9cc1(0x228)]?.({'type':_0x8d9cc1(0x1be),'journeyName':_0x16419c[_0x8d9cc1(0x24a)]['name'],'activationName':_0x222694});}const _0x590b19=JSON[_0x8d9cc1(0x1dc)](JSON[_0x8d9cc1(0x216)](_0x2db39b));return _0x590b19['id']=_0x33abf7,ensureJourneyDefaults(_0x590b19[_0x8d9cc1(0x1fe)]),resolvePendingIdsInRequest(_0x590b19,_0x2db39b,_0x3286e4,_0x34af2c,_0x3221f4,_0x3598cf),await _0x1f968d[_0x8d9cc1(0x292)][_0x8d9cc1(0x26c)](_0x33abf7,_0x590b19),deletePushRecovery(_0x16419c['absolutePath']),{'action':'created','journeyId':_0x33abf7,'embeddedSegmentNameToId':_0x34af2c};}export function stripWaitStepPendingIds(_0x225598){const _0x450c5d=a142_0x3ef9cf,_0x1b3b6a=_0x225598['conditionSegmentId']&&isPendingSegmentId(_0x225598[_0x450c5d(0x29a)]),_0x38c9ba=_0x225598[_0x450c5d(0x282)]?.[_0x450c5d(0x243)](_0x502d2e=>_0x502d2e[_0x450c5d(0x221)]&&isPendingSegmentId(_0x502d2e[_0x450c5d(0x221)]));(_0x1b3b6a||_0x38c9ba)&&(_0x225598[_0x450c5d(0x262)]='Duration',_0x225598[_0x450c5d(0x22e)]=0x1,_0x225598['waitStepUnit']=_0x450c5d(0x208),delete _0x225598[_0x450c5d(0x29a)],delete _0x225598[_0x450c5d(0x211)],delete _0x225598[_0x450c5d(0x1c2)],delete _0x225598[_0x450c5d(0x282)]);}export function resolveWaitStepPendingIds(_0x78135e,_0x11c531,_0x383f7f,_0xe1b83a){const _0x5e9149=a142_0x3ef9cf;if(_0x11c531[_0x5e9149(0x29a)]&&isPendingSegmentId(_0x11c531[_0x5e9149(0x29a)])){const _0x158253=_0x383f7f(_0x11c531[_0x5e9149(0x29a)],_0x5e9149(0x20c)+_0xe1b83a+_0x5e9149(0x264));_0x158253&&(_0x78135e[_0x5e9149(0x262)]='Condition',_0x78135e[_0x5e9149(0x29a)]=_0x158253,delete _0x78135e[_0x5e9149(0x22e)],delete _0x78135e[_0x5e9149(0x2a7)],_0x11c531[_0x5e9149(0x211)]!==undefined&&(_0x78135e[_0x5e9149(0x211)]=_0x11c531[_0x5e9149(0x211)]),_0x11c531[_0x5e9149(0x1c2)]&&(_0x78135e['conditionTimeoutUnit']=_0x11c531[_0x5e9149(0x1c2)]));}if(_0x11c531[_0x5e9149(0x282)]){const _0x3515ff=_0x11c531[_0x5e9149(0x282)]['some'](_0x27aa4f=>_0x27aa4f[_0x5e9149(0x221)]&&isPendingSegmentId(_0x27aa4f['segmentId']));if(_0x3515ff){const _0x4461d8=_0x11c531[_0x5e9149(0x282)][_0x5e9149(0x209)](_0x44b248=>{const _0x48abaf=_0x5e9149;if(_0x44b248['segmentId']&&isPendingSegmentId(_0x44b248[_0x48abaf(0x221)])){const _0x258c92=_0x383f7f(_0x44b248[_0x48abaf(0x221)],'stage\x20\x27'+_0xe1b83a+_0x48abaf(0x264));return{..._0x44b248,'segmentId':_0x258c92||_0x44b248[_0x48abaf(0x221)]};}return{..._0x44b248};});_0x78135e[_0x5e9149(0x262)]='Condition',_0x78135e[_0x5e9149(0x282)]=_0x4461d8,delete _0x78135e[_0x5e9149(0x22e)],delete _0x78135e['waitStepUnit'],delete _0x78135e[_0x5e9149(0x29a)],delete _0x78135e[_0x5e9149(0x211)],delete _0x78135e[_0x5e9149(0x1c2)];}}}function stripPendingIds(_0x4a925c){const _0x582a94=a142_0x3ef9cf;_0x4a925c['attributes']['goal']?.[_0x582a94(0x221)]&&isPendingSegmentId(_0x4a925c[_0x582a94(0x1fe)][_0x582a94(0x269)][_0x582a94(0x221)])&&delete _0x4a925c[_0x582a94(0x1fe)][_0x582a94(0x269)];for(const _0x19ae9f of _0x4a925c['attributes'][_0x582a94(0x21f)]||[]){_0x19ae9f['entryCriteria']?.[_0x582a94(0x221)]&&isPendingSegmentId(_0x19ae9f['entryCriteria'][_0x582a94(0x221)])&&delete _0x19ae9f[_0x582a94(0x20e)];_0x19ae9f[_0x582a94(0x236)]?.[_0x582a94(0x221)]&&isPendingSegmentId(_0x19ae9f['milestone']['segmentId'])&&delete _0x19ae9f[_0x582a94(0x236)];_0x19ae9f['exitCriterias']&&(_0x19ae9f[_0x582a94(0x1ad)]=_0x19ae9f[_0x582a94(0x1ad)][_0x582a94(0x29e)](_0x461d66=>!_0x461d66['segmentId']||!isPendingSegmentId(_0x461d66[_0x582a94(0x221)])));if(_0x19ae9f[_0x582a94(0x1a6)])for(const _0x4405e0 of Object[_0x582a94(0x294)](_0x19ae9f['steps'])){const _0x594ea1=_0x19ae9f[_0x582a94(0x1a6)][_0x4405e0];_0x594ea1[_0x582a94(0x21a)]==='Activation'&&_0x594ea1[_0x582a94(0x20d)]&&isPendingActivationId(_0x594ea1[_0x582a94(0x20d)])&&(_0x594ea1[_0x582a94(0x20d)]='');if(_0x594ea1[_0x582a94(0x21a)]==='DecisionPoint'&&_0x594ea1['branches'])for(const _0x11cb78 of _0x594ea1[_0x582a94(0x245)]){_0x11cb78[_0x582a94(0x221)]&&isPendingSegmentId(_0x11cb78[_0x582a94(0x221)])&&(_0x11cb78[_0x582a94(0x221)]='');}_0x594ea1['type']===_0x582a94(0x276)&&stripWaitStepPendingIds(_0x594ea1);}}}function resolvePendingIdsInRequest(_0x28a5b7,_0x510f82,_0x50325b,_0x49a709,_0x317a4c,_0x2ba210){const _0x3fc064=a142_0x3ef9cf,_0x13f962=(_0x521d79,_0x530d60)=>{const _0x2156b8=a142_0x3bff;if(!isPendingSegmentId(_0x521d79))return _0x521d79;const _0x4e683a=extractPendingSegmentName(_0x521d79),_0x3313db=_0x49a709['get'](_0x4e683a);return!_0x3313db&&_0x2ba210['logWarning']?.('Warning:\x20Could\x20not\x20resolve\x20embedded\x20segment\x20\x27'+_0x4e683a+_0x2156b8(0x206)+_0x530d60),_0x3313db;};if(_0x28a5b7['attributes'][_0x3fc064(0x269)]?.['segmentId']&&isPendingSegmentId(_0x28a5b7[_0x3fc064(0x1fe)]['goal']['segmentId'])){const _0x2e6ab0=_0x13f962(_0x28a5b7[_0x3fc064(0x1fe)]['goal'][_0x3fc064(0x221)],'goal\x20criteria');_0x2e6ab0&&(_0x28a5b7[_0x3fc064(0x1fe)][_0x3fc064(0x269)][_0x3fc064(0x221)]=_0x2e6ab0);}for(const _0x5bd20f of _0x28a5b7[_0x3fc064(0x1fe)][_0x3fc064(0x21f)]||[]){const _0x3d0baf=_0x50325b[_0x3fc064(0x239)](_0x5bd20f[_0x3fc064(0x26e)]['toLowerCase']());_0x3d0baf&&(_0x5bd20f['id']=_0x3d0baf);if(_0x5bd20f['entryCriteria']?.[_0x3fc064(0x221)]&&isPendingSegmentId(_0x5bd20f[_0x3fc064(0x20e)]['segmentId'])){const _0x13b3a9=_0x13f962(_0x5bd20f['entryCriteria'][_0x3fc064(0x221)],'stage\x20\x27'+_0x5bd20f[_0x3fc064(0x26e)]+'\x27\x20entry\x20criteria');_0x13b3a9&&(_0x5bd20f['entryCriteria'][_0x3fc064(0x221)]=_0x13b3a9);}if(_0x5bd20f[_0x3fc064(0x1ad)])for(const _0x55f958 of _0x5bd20f[_0x3fc064(0x1ad)]){if(_0x55f958['segmentId']&&isPendingSegmentId(_0x55f958['segmentId'])){const _0x12318b=_0x13f962(_0x55f958['segmentId'],'stage\x20\x27'+_0x5bd20f['name']+_0x3fc064(0x24f));_0x12318b&&(_0x55f958[_0x3fc064(0x221)]=_0x12318b);}}if(_0x5bd20f[_0x3fc064(0x236)]?.[_0x3fc064(0x221)]&&isPendingSegmentId(_0x5bd20f[_0x3fc064(0x236)]['segmentId'])){const _0x4a8dfb=_0x13f962(_0x5bd20f[_0x3fc064(0x236)][_0x3fc064(0x221)],_0x3fc064(0x20c)+_0x5bd20f[_0x3fc064(0x26e)]+'\x27\x20milestone');_0x4a8dfb&&(_0x5bd20f['milestone'][_0x3fc064(0x221)]=_0x4a8dfb);}if(_0x5bd20f['steps']){const _0x215284=_0x13dcf7=>_0x510f82[_0x3fc064(0x1fe)][_0x3fc064(0x21f)]?.[_0x3fc064(0x1d9)](_0x3c8b48=>_0x3c8b48[_0x3fc064(0x26e)][_0x3fc064(0x24b)]()===_0x5bd20f[_0x3fc064(0x26e)]['toLowerCase']())?.[_0x3fc064(0x1a6)]?.[_0x13dcf7];for(const _0x561bee of Object[_0x3fc064(0x294)](_0x5bd20f['steps'])){const _0xf81985=_0x5bd20f[_0x3fc064(0x1a6)][_0x561bee],_0x1c5022=_0x215284(_0x561bee);if(_0xf81985[_0x3fc064(0x21a)]===_0x3fc064(0x1e9)&&_0xf81985[_0x3fc064(0x20d)]&&(isPendingActivationId(_0xf81985['journeyActivationStepId'])||_0xf81985[_0x3fc064(0x20d)]==='')){if(_0x1c5022?.['journeyActivationStepId']&&isPendingActivationId(_0x1c5022['journeyActivationStepId'])){const _0x3a6a60=extractPendingActivationName(_0x1c5022['journeyActivationStepId']),_0x451da7=_0x317a4c[_0x3fc064(0x239)](_0x3a6a60);_0x451da7&&(_0xf81985[_0x3fc064(0x20d)]=_0x451da7);}}if(_0xf81985['type']===_0x3fc064(0x26b)&&_0xf81985['branches']&&_0x1c5022?.[_0x3fc064(0x245)])for(let _0x5170b7=0x0;_0x5170b7<_0xf81985['branches'][_0x3fc064(0x1f4)];_0x5170b7++){const _0x52e6f5=_0xf81985[_0x3fc064(0x245)][_0x5170b7],_0x10e105=_0x1c5022[_0x3fc064(0x245)][_0x5170b7];if(_0x10e105?.['segmentId']&&isPendingSegmentId(_0x10e105['segmentId'])){const _0x1db6a0=_0x13f962(_0x10e105[_0x3fc064(0x221)],'stage\x20\x27'+_0x5bd20f[_0x3fc064(0x26e)]+_0x3fc064(0x21c)+(_0x52e6f5[_0x3fc064(0x26e)]||_0x5170b7)+'\x27');_0x1db6a0&&(_0x52e6f5[_0x3fc064(0x221)]=_0x1db6a0);}}_0xf81985[_0x3fc064(0x21a)]===_0x3fc064(0x276)&&_0x1c5022?.[_0x3fc064(0x21a)]===_0x3fc064(0x276)&&resolveWaitStepPendingIds(_0xf81985,_0x1c5022,_0x13f962,_0x5bd20f[_0x3fc064(0x26e)]);}}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x58dc76,_0xf3f362){const _0x27ec8d=a143_0x2298,_0x5b12bb=_0x58dc76();while(!![]){try{const _0x31638a=-parseInt(_0x27ec8d(0xde))/0x1+parseInt(_0x27ec8d(0xd5))/0x2+-parseInt(_0x27ec8d(0xe4))/0x3+-parseInt(_0x27ec8d(0xe0))/0x4*(-parseInt(_0x27ec8d(0xdd))/0x5)+-parseInt(_0x27ec8d(0xd7))/0x6+parseInt(_0x27ec8d(0xe1))/0x7*(parseInt(_0x27ec8d(0xdc))/0x8)+-parseInt(_0x27ec8d(0xdf))/0x9*(parseInt(_0x27ec8d(0xda))/0xa);if(_0x31638a===_0xf3f362)break;else _0x5b12bb['push'](_0x5b12bb['shift']());}catch(_0x12d07e){_0x5b12bb['push'](_0x5b12bb['shift']());}}}(a143_0x555c,0x70836));export function buildFolderIdToPathMap(_0x4edab2){const _0x1684b6=new Map(),_0x30a7d6=new Map();for(const _0x4a8cbd of _0x4edab2){_0x30a7d6['set'](_0x4a8cbd['id'],_0x4a8cbd);}const _0xa7303c=new Set();for(const _0x43d883 of _0x4edab2){!_0x43d883['parentFolderId']&&_0xa7303c['add'](_0x43d883['id']);}function _0x5501c4(_0x1f92be){const _0x245960=a143_0x2298;if(_0x1684b6[_0x245960(0xd6)](_0x1f92be['id']))return _0x1684b6['get'](_0x1f92be['id']);if(_0xa7303c['has'](_0x1f92be['id']))return _0x1684b6[_0x245960(0xe3)](_0x1f92be['id'],''),'';if(_0x1f92be['parentFolderId']){const _0x63127d=_0x30a7d6['get'](_0x1f92be['parentFolderId']);if(_0x63127d){const _0x474178=_0x5501c4(_0x63127d),_0x220658=_0x474178?_0x474178+'/'+_0x1f92be[_0x245960(0xd8)]:_0x1f92be[_0x245960(0xd8)];return _0x1684b6['set'](_0x1f92be['id'],_0x220658),_0x220658;}}const _0x3fec9e=_0x1f92be[_0x245960(0xd8)];return _0x1684b6[_0x245960(0xe3)](_0x1f92be['id'],_0x3fec9e),_0x3fec9e;}for(const _0x3dab19 of _0x4edab2){_0x5501c4(_0x3dab19);}return _0x1684b6;}export function buildFolderPathToIdMap(_0x3b838c){const _0x576fb1=a143_0x2298,_0x437dbb=new Map(),_0x39aa94=new Map();for(const _0x545b86 of _0x3b838c){_0x39aa94[_0x576fb1(0xe3)](_0x545b86['id'],_0x545b86);}const _0x3c08a9=new Set();for(const _0x36b72a of _0x3b838c){!_0x36b72a[_0x576fb1(0xd9)]&&_0x3c08a9[_0x576fb1(0xe2)](_0x36b72a['id']);}function _0x2d32e5(_0x58c352){const _0x1f8e6c=_0x576fb1;if(_0x3c08a9['has'](_0x58c352['id']))return'';if(_0x58c352[_0x1f8e6c(0xd9)]){const _0xcb1d74=_0x39aa94[_0x1f8e6c(0xdb)](_0x58c352[_0x1f8e6c(0xd9)]);if(_0xcb1d74){const _0x4c6176=_0x2d32e5(_0xcb1d74);return _0x4c6176?_0x4c6176+'/'+_0x58c352[_0x1f8e6c(0xd8)]:_0x58c352[_0x1f8e6c(0xd8)];}}return _0x58c352[_0x1f8e6c(0xd8)];}for(const _0x3cb2bd of _0x3b838c){const _0x3266f3=_0x2d32e5(_0x3cb2bd);_0x437dbb[_0x576fb1(0xe3)](_0x3266f3,_0x3cb2bd['id']);}return _0x437dbb;}export function buildFolderMaps(_0x31c37a){const _0x312b5f=a143_0x2298,_0x43ae71=buildFolderIdToPathMap(_0x31c37a),_0x36e52d=new Map();for(const [_0x3e67b4,_0x3769da]of _0x43ae71){_0x36e52d[_0x312b5f(0xe3)](_0x3769da,_0x3e67b4);}return{'idToPath':_0x43ae71,'pathToId':_0x36e52d};}function a143_0x2298(_0x18733d,_0x1880f5){_0x18733d=_0x18733d-0xd5;const _0x555c78=a143_0x555c();let _0x2298a7=_0x555c78[_0x18733d];return _0x2298a7;}function a143_0x555c(){const _0x3326d8=['651425bFcLQW','45axmxNp','8FlRBUE','6003893fcMVUZ','add','set','2427999gRPAPT','1824440ERwjXD','has','1628904NLJNxB','name','parentFolderId','158410ibHsOf','get','8UEbqXL','1255955FYTHtp'];a143_0x555c=function(){return _0x3326d8;};return a143_0x555c();}export function getFolderPath(_0x47e15f,_0x17a44a){const _0x4499dc=a143_0x2298;if(!_0x47e15f)return'';return _0x17a44a[_0x4499dc(0xdb)](_0x47e15f)??'';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4dd94d,_0xb12f83){const _0x25b50f=a144_0x106d,_0xad60f5=_0x4dd94d();while(!![]){try{const _0xec7b9c=-parseInt(_0x25b50f(0x131))/0x1+-parseInt(_0x25b50f(0x12f))/0x2*(-parseInt(_0x25b50f(0x122))/0x3)+parseInt(_0x25b50f(0x13e))/0x4+-parseInt(_0x25b50f(0x12e))/0x5*(-parseInt(_0x25b50f(0x144))/0x6)+-parseInt(_0x25b50f(0x13a))/0x7*(-parseInt(_0x25b50f(0x139))/0x8)+parseInt(_0x25b50f(0x137))/0x9+-parseInt(_0x25b50f(0x14a))/0xa;if(_0xec7b9c===_0xb12f83)break;else _0xad60f5['push'](_0xad60f5['shift']());}catch(_0x25a24d){_0xad60f5['push'](_0xad60f5['shift']());}}}(a144_0x1361,0xa70e1));import a144_0x5632e8 from'path';import{parse as a144_0x16818f}from'yaml';function a144_0x1361(){const _0x3d1ebf=['259770eYLqQV','Path\x20cannot\x20be\x20empty','name','Cannot\x20split\x20empty\x20path','raw','filter','root','substring','endsWith','test','isAbsolute','type','485dWoyCT','2ewjnNL','tdx.json','622305gvWeLQ','Cannot\x20navigate\x20above\x20root','trim','segments','readFile','relative','1546326KJVlhH','startsWith','518632vSzshE','77lHPXdN','join','Hint:\x20Run\x20`tdx\x20sg\x20pull\x20\x22Parent\x20Segment\x20Name\x22`\x20first\x20to\x20create\x20a\x20project\x20directory,\x20then\x20work\x20within\x20that\x20directory.','length','1646224sxsfAS','Invalid\x20tdx.json:\x20missing\x20parent_segment\x20field','resolve','push','.yml','Relative\x20path\x20cannot\x20be\x20empty','84192DxpHNk','replace','split','parse','pop','No\x20tdx.json\x20found\x20for\x20file:\x20','14376210qDHkxb','Absolute\x20path\x20cannot\x20start\x20with\x20\x22..\x22','exists','slice','Path\x20segment\x20cannot\x20be\x20empty','journey'];a144_0x1361=function(){return _0x3d1ebf;};return a144_0x1361();}import{nodeFileSystem}from'../io/node-filesystem.js';export function parsePath(_0x215979){const _0x64d8e7=a144_0x106d;if(!_0x215979||_0x215979['trim']()==='')throw new Error(_0x64d8e7(0x123));const _0x1cbdc7=_0x215979[_0x64d8e7(0x133)]();if(_0x1cbdc7==='/')return{'segments':[],'isAbsolute':!![],'raw':_0x215979};const _0x504b5e=_0x1cbdc7[_0x64d8e7(0x138)]('/')?_0x1cbdc7[_0x64d8e7(0x129)](0x1):_0x1cbdc7,_0x515701=_0x504b5e[_0x64d8e7(0x146)]('/')[_0x64d8e7(0x127)](_0x5e0f53=>_0x5e0f53!=='');if(_0x515701['length']===0x0)throw new Error('Path\x20must\x20contain\x20at\x20least\x20one\x20segment');const _0x55f58b=_0x1cbdc7[_0x64d8e7(0x138)]('/')||!isRelativePathSegment(_0x515701[0x0]);for(const _0xac43f0 of _0x515701){validatePathSegment(_0xac43f0);}return{'segments':_0x515701,'isAbsolute':_0x55f58b,'raw':_0x215979};}function isRelativePathSegment(_0x22b14b){return _0x22b14b==='.'||_0x22b14b==='..';}function validatePathSegment(_0x4db287){const _0xf3e5d2=a144_0x106d;if(_0x4db287==='')throw new Error(_0xf3e5d2(0x120));if(_0x4db287==='.'||_0x4db287==='..')return;if(/[\x00-\x1F\x7F]/[_0xf3e5d2(0x12b)](_0x4db287))throw new Error('Path\x20segment\x20contains\x20invalid\x20control\x20characters:\x20'+_0x4db287);if(_0x4db287!==_0x4db287[_0xf3e5d2(0x133)]()){}}export function validatePath(_0x58c2ce){const _0x4c5f48=a144_0x106d;if(_0x58c2ce[_0x4c5f48(0x134)][_0x4c5f48(0x13d)]===0x0&&!_0x58c2ce[_0x4c5f48(0x12c)])throw new Error(_0x4c5f48(0x143));if(_0x58c2ce[_0x4c5f48(0x12c)]){if(_0x58c2ce[_0x4c5f48(0x134)][0x0]==='..')throw new Error(_0x4c5f48(0x14b));let _0x339bfe=0x0;for(const _0x219eec of _0x58c2ce[_0x4c5f48(0x134)]){if(_0x219eec==='..'){if(_0x339bfe===0x0)throw new Error('Path\x20attempts\x20to\x20navigate\x20above\x20root');_0x339bfe--;}else _0x219eec!=='.'&&_0x339bfe++;}}}function a144_0x106d(_0x2b9f2b,_0x3f446b){_0x2b9f2b=_0x2b9f2b-0x11f;const _0x1361bd=a144_0x1361();let _0x106dc4=_0x1361bd[_0x2b9f2b];return _0x106dc4;}export function joinPaths(_0x738496,_0x7fb17f){const _0x1f86a5=a144_0x106d;if(!_0x738496||_0x738496==='/')return _0x7fb17f;if(!_0x7fb17f||_0x7fb17f==='.')return _0x738496;if(_0x7fb17f[_0x1f86a5(0x138)]('/'))return _0x7fb17f;const _0x32df24=parsePath(_0x738496),_0x105258=parsePath(_0x7fb17f),_0x51f3c4=[..._0x32df24[_0x1f86a5(0x134)]];for(const _0x151e1e of _0x105258[_0x1f86a5(0x134)]){if(_0x151e1e==='.')continue;else{if(_0x151e1e==='..'){if(_0x51f3c4[_0x1f86a5(0x13d)]===0x0)throw new Error(_0x1f86a5(0x132));_0x51f3c4[_0x1f86a5(0x148)]();}else _0x51f3c4[_0x1f86a5(0x141)](_0x151e1e);}}const _0x28c61c=_0x51f3c4[_0x1f86a5(0x13b)]('/');return _0x32df24['raw']['startsWith']('/')?'/'+_0x28c61c:_0x28c61c;}export function normalizePath(_0x3b4a24){const _0x1d92e5=a144_0x106d,_0x13b2b8=parsePath(_0x3b4a24),_0x251547=[];for(const _0x17adda of _0x13b2b8[_0x1d92e5(0x134)]){if(_0x17adda==='.')continue;else{if(_0x17adda==='..'){if(_0x251547[_0x1d92e5(0x13d)]===0x0){if(_0x13b2b8[_0x1d92e5(0x12c)])throw new Error(_0x1d92e5(0x132));_0x251547[_0x1d92e5(0x141)]('..');}else _0x251547[_0x251547[_0x1d92e5(0x13d)]-0x1]==='..'?_0x251547[_0x1d92e5(0x141)]('..'):_0x251547[_0x1d92e5(0x148)]();}else _0x251547['push'](_0x17adda);}}if(_0x251547[_0x1d92e5(0x13d)]===0x0)return _0x13b2b8[_0x1d92e5(0x12c)]?'/':'.';const _0x3c8807=_0x251547['join']('/');return _0x13b2b8[_0x1d92e5(0x126)][_0x1d92e5(0x138)]('/')?'/'+_0x3c8807:_0x3c8807;}export function getParentPath(_0x15a9d2){const _0x18be58=a144_0x106d,_0x3ae165=parsePath(_0x15a9d2);if(_0x3ae165['segments'][_0x18be58(0x13d)]<=0x1)return'/';const _0x13d314=_0x3ae165[_0x18be58(0x134)][_0x18be58(0x11f)](0x0,-0x1)['join']('/');return _0x3ae165['raw'][_0x18be58(0x138)]('/')?'/'+_0x13d314:_0x13d314;}export function getBaseName(_0x5e7890){const _0x44ff46=a144_0x106d,_0x5645d2=parsePath(_0x5e7890);return _0x5645d2[_0x44ff46(0x134)][_0x5645d2['segments'][_0x44ff46(0x13d)]-0x1]||'';}export function isChildPath(_0x1f31f5,_0x16f107){const _0x35f891=a144_0x106d,_0xbcc8ec=parsePath(_0x1f31f5),_0x5761a5=parsePath(_0x16f107);if(_0xbcc8ec[_0x35f891(0x134)][_0x35f891(0x13d)]<=_0x5761a5[_0x35f891(0x134)][_0x35f891(0x13d)])return![];for(let _0x4fca1e=0x0;_0x4fca1e<_0x5761a5[_0x35f891(0x134)][_0x35f891(0x13d)];_0x4fca1e++){if(_0xbcc8ec[_0x35f891(0x134)][_0x4fca1e]!==_0x5761a5['segments'][_0x4fca1e])return![];}return!![];}export function splitPath(_0x1c6133){const _0x1d8a98=a144_0x106d,_0x1d4e48=parsePath(_0x1c6133);if(_0x1d4e48[_0x1d8a98(0x134)][_0x1d8a98(0x13d)]===0x0)throw new Error(_0x1d8a98(0x125));if(_0x1d4e48['segments'][_0x1d8a98(0x13d)]===0x1)return{'parent':_0x1d4e48['segments'][0x0]};return{'parent':_0x1d4e48[_0x1d8a98(0x134)][0x0],'child':_0x1d4e48[_0x1d8a98(0x134)][_0x1d8a98(0x11f)](0x1)[_0x1d8a98(0x13b)]('/')};}export function isYamlFilePath(_0x2e4f09){const _0x5302f3=a144_0x106d;return _0x2e4f09[_0x5302f3(0x12a)](_0x5302f3(0x142))||_0x2e4f09[_0x5302f3(0x12a)]('.yaml');}export async function resolveYamlFilePath(_0x5ce7a5,_0xcaa8=nodeFileSystem){const _0x27258d=a144_0x106d,_0x2a413d=a144_0x5632e8[_0x27258d(0x140)](_0x5ce7a5);if(!await _0xcaa8['exists'](_0x2a413d))throw new Error('File\x20not\x20found:\x20'+_0x5ce7a5);let _0x23df54=a144_0x5632e8['dirname'](_0x2a413d),_0x209e20=null,_0x32287a=null;const _0x55bad0=a144_0x5632e8[_0x27258d(0x147)](_0x23df54)[_0x27258d(0x128)];while(_0x23df54!==_0x55bad0){const _0x391d60=a144_0x5632e8[_0x27258d(0x13b)](_0x23df54,_0x27258d(0x130));if(await _0xcaa8[_0x27258d(0x14c)](_0x391d60)){_0x209e20=_0x391d60,_0x32287a=_0x23df54;break;}_0x23df54=a144_0x5632e8['dirname'](_0x23df54);}if(!_0x209e20||!_0x32287a)throw new Error(_0x27258d(0x149)+_0x5ce7a5+'\x0a'+_0x27258d(0x13c));const _0x37d4a3=await _0xcaa8['readFile'](_0x209e20),_0x2f5f92=JSON[_0x27258d(0x147)](_0x37d4a3),_0x25fb64=_0x2f5f92['parent_segment'];if(!_0x25fb64)throw new Error(_0x27258d(0x13f));const _0x181c97=await _0xcaa8[_0x27258d(0x135)](_0x2a413d),_0xacd358=a144_0x16818f(_0x181c97),_0x590f65=_0xacd358[_0x27258d(0x124)];if(!_0x590f65)throw new Error('Invalid\x20YAML:\x20missing\x20name\x20field\x20in\x20'+_0x5ce7a5);const _0x274b96=_0xacd358[_0x27258d(0x12d)]===_0x27258d(0x121)?_0x27258d(0x121):'segment',_0x10d25e=a144_0x5632e8[_0x27258d(0x136)](_0x32287a,_0x2a413d),_0x4362d0=a144_0x5632e8['dirname'](_0x10d25e),_0x5d822b=_0x4362d0==='.'?'':_0x4362d0[_0x27258d(0x145)](/\\/g,'/'),_0x546d05=_0x5d822b?_0x25fb64+'/'+_0x5d822b+'/'+_0x590f65:_0x25fb64+'/'+_0x590f65;return{'parentSegment':_0x25fb64,'segmentName':_0x590f65,'folderPath':_0x5d822b,'fullPath':_0x546d05,'resourceType':_0x274b96,'content':_0x181c97};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x202621,_0x388872){const _0x36464e=a145_0x4178,_0x1e1a5f=_0x202621();while(!![]){try{const _0x8fbe38=-parseInt(_0x36464e(0x1ca))/0x1+-parseInt(_0x36464e(0x1c8))/0x2*(parseInt(_0x36464e(0x1c7))/0x3)+parseInt(_0x36464e(0x1c2))/0x4+-parseInt(_0x36464e(0x1c6))/0x5*(-parseInt(_0x36464e(0x1c9))/0x6)+parseInt(_0x36464e(0x1c1))/0x7+-parseInt(_0x36464e(0x1c4))/0x8*(-parseInt(_0x36464e(0x1cd))/0x9)+-parseInt(_0x36464e(0x1c5))/0xa;if(_0x8fbe38===_0x388872)break;else _0x1e1a5f['push'](_0x1e1a5f['shift']());}catch(_0x3f1d01){_0x1e1a5f['push'](_0x1e1a5f['shift']());}}}(a145_0x27b2,0x6f139));function a145_0x4178(_0x33cf80,_0x288565){_0x33cf80=_0x33cf80-0x1c1;const _0x27b239=a145_0x27b2();let _0x417886=_0x27b239[_0x33cf80];return _0x417886;}function a145_0x27b2(){const _0x23488c=['825186KhWIia','Invalid\x20segment\x20reference\x20format:\x20','.\x20Child\x20name\x20cannot\x20be\x20empty','121833pAlxip','6051395FRDXJa','1543600BYGXFV','substring','168SNXasq','7775460SZiAhv','1938375EKVaYg','573NxyOix','2642fnLfzv','12KEJTnU'];a145_0x27b2=function(){return _0x23488c;};return a145_0x27b2();}export function parseSegmentRef(_0x266d9c){const _0x18503a=a145_0x4178,_0xc95caa=_0x266d9c['indexOf']('/');if(_0xc95caa===-0x1)return{'parentId':_0x266d9c};if(_0xc95caa===0x0)throw new Error(_0x18503a(0x1cb)+_0x266d9c+'.\x20Parent\x20name\x20cannot\x20be\x20empty');const _0x2e6523=_0x266d9c[_0x18503a(0x1c3)](0x0,_0xc95caa),_0x5d2529=_0x266d9c[_0x18503a(0x1c3)](_0xc95caa+0x1);if(_0x5d2529==='')throw new Error('Invalid\x20segment\x20reference\x20format:\x20'+_0x266d9c+_0x18503a(0x1cc));return{'parentId':_0x2e6523,'childId':_0x5d2529};}
|