@treasuredata/tdx 2026.3.22 → 2026.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/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 a30_0x4c2f14=a30_0x5265;(function(_0x23b9a9,_0x4425d0){const _0x5c888a=a30_0x5265,_0x522749=_0x23b9a9();while(!![]){try{const _0x3a63a8=parseInt(_0x5c888a(0x235))/0x1+parseInt(_0x5c888a(0x115))/0x2*(parseInt(_0x5c888a(0x204))/0x3)+-parseInt(_0x5c888a(0x16e))/0x4*(parseInt(_0x5c888a(0x1c3))/0x5)+parseInt(_0x5c888a(0x1fe))/0x6+parseInt(_0x5c888a(0x1fb))/0x7+-parseInt(_0x5c888a(0x18a))/0x8+-parseInt(_0x5c888a(0x1ef))/0x9*(parseInt(_0x5c888a(0x1ec))/0xa);if(_0x3a63a8===_0x4425d0)break;else _0x522749['push'](_0x522749['shift']());}catch(_0x296e60){_0x522749['push'](_0x522749['shift']());}}}(a30_0x22a5,0xf13ea));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x1eec83 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x29defe from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a30_0x5265(_0x4337a3,_0x27c509){_0x4337a3=_0x4337a3-0xf0;const _0x22a56c=a30_0x22a5();let _0x52656f=_0x22a56c[_0x4337a3];return _0x52656f;}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x4c2f14(0x26b),LEGACY_PARENT_SEGMENT_DIR=a30_0x4c2f14(0x1fc);function openBrowser(_0x18bc94){const _0x509719=a30_0x4c2f14,_0x3e8106=process['platform'],_0x53a041=_0x3e8106===_0x509719(0x1eb)?_0x509719(0x253):_0x3e8106===_0x509719(0xfb)?'start':_0x509719(0x104);spawn(_0x53a041,[_0x18bc94],{'detached':!![],'stdio':_0x509719(0x13a)})[_0x509719(0x1b8)]();}function migrateLegacyDirectory(){const _0x2a1bbe=a30_0x4c2f14;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x542ed4=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x542ed4['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2a1bbe(0x1a2)](a30_0x29defe['yellow']('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x2a1bbe(0x136)+PARENT_SEGMENT_DIR+_0x2a1bbe(0x1c2))),console[_0x2a1bbe(0x1a2)](a30_0x29defe[_0x2a1bbe(0x277)](_0x2a1bbe(0x267)+LEGACY_PARENT_SEGMENT_DIR+_0x2a1bbe(0x156))),![];console[_0x2a1bbe(0x1a2)](a30_0x29defe['yellow'](_0x2a1bbe(0x161)+LEGACY_PARENT_SEGMENT_DIR+_0x2a1bbe(0x1ab)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2a1bbe(0x1a2)](a30_0x29defe[_0x2a1bbe(0x1c9)](_0x2a1bbe(0xf9)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2e490a){const _0x2e2983=_0x2e490a instanceof Error?_0x2e490a[_0x2a1bbe(0x19c)]:String(_0x2e490a);return console[_0x2a1bbe(0x1a2)](a30_0x29defe[_0x2a1bbe(0x11d)](_0x2a1bbe(0x19f)+_0x2e2983+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x4c2f14(0x26a)](_0x3d28a6){return migrateLegacyDirectory(),super['run'](_0x3d28a6);}}function resolveYamlFile(_0x13ec69){const _0x563da2=a30_0x4c2f14;if(_0x13ec69[_0x563da2(0x143)](_0x563da2(0x122))||_0x13ec69[_0x563da2(0x143)]('.yaml'))return _0x13ec69;return a30_0x1eec83[_0x563da2(0x25f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x13ec69)+'.yml');}function formatProgressMessage(_0x4352be){const _0x167651=a30_0x4c2f14,_0xedc309=_0x4352be[_0x167651(0x278)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xedc309){const [,_0x1307af,_0x17cb5e,_0xdff0ec='']=_0xedc309;return a30_0x29defe[_0x167651(0x277)](_0x1307af+':')+'\x20'+_0x17cb5e+a30_0x29defe[_0x167651(0x277)](_0xdff0ec);}return a30_0x29defe['dim'](_0x4352be);}function showFileNotFoundError(_0x1d0634,_0x5109ef){const _0x466b5a=a30_0x4c2f14;console[_0x466b5a(0x1a2)](a30_0x29defe[_0x466b5a(0x11d)]('Error:\x20File\x20not\x20found:\x20'+_0x1d0634+'\x0a')),console[_0x466b5a(0x1a2)](a30_0x29defe[_0x466b5a(0x1da)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x5109ef+_0x466b5a(0x133)));}function displayRealtimeValidation(_0x441788){const _0xc03d28=a30_0x4c2f14;if(!_0x441788[_0xc03d28(0x228)])return;const _0x12e11b=_0x441788[_0xc03d28(0x228)],_0x20336f=_0x12e11b[_0xc03d28(0x195)]?a30_0x29defe['green'](_0xc03d28(0x172)):a30_0x29defe[_0xc03d28(0x178)](_0xc03d28(0x263));console[_0xc03d28(0x1a2)]('\x0a'+a30_0x29defe[_0xc03d28(0x277)](_0xc03d28(0x237))+'\x20'+_0x20336f);if(_0x12e11b['events']&&_0x12e11b[_0xc03d28(0x215)][_0xc03d28(0x25e)]>0x0){console[_0xc03d28(0x1a2)]('\x20\x20'+a30_0x29defe[_0xc03d28(0x277)]('Events:')+'\x20'+_0x12e11b['events'][_0xc03d28(0x25e)]+_0xc03d28(0x1bf));for(const _0x1974d9 of _0x12e11b[_0xc03d28(0x215)]){const _0xa46096=_0x1974d9[_0xc03d28(0x12e)]===![]?a30_0x29defe[_0xc03d28(0x11d)]('✘'):a30_0x29defe['green']('✔');console[_0xc03d28(0x1a2)](_0xc03d28(0x130)+_0xa46096+'\x20'+_0x1974d9[_0xc03d28(0x202)]),_0x1974d9['sourceTableError']&&console[_0xc03d28(0x1a2)]('\x20\x20\x20\x20\x20\x20'+a30_0x29defe[_0xc03d28(0x11d)](_0x1974d9[_0xc03d28(0x24d)]));}}if(_0x12e11b[_0xc03d28(0x175)]&&_0x12e11b[_0xc03d28(0x175)][_0xc03d28(0x25e)]>0x0){console[_0xc03d28(0x1a2)]('\x20\x20'+a30_0x29defe['dim']('Attributes:')+'\x20'+_0x12e11b[_0xc03d28(0x175)][_0xc03d28(0x25e)]+_0xc03d28(0x1bf));for(const _0x37cae7 of _0x12e11b['attributes']){const _0x497a5e=_0x37cae7[_0xc03d28(0x176)]?a30_0x29defe[_0xc03d28(0x1c9)]('✔'):a30_0x29defe['red']('✘');console['error'](_0xc03d28(0x130)+_0x497a5e+'\x20'+_0x37cae7[_0xc03d28(0x202)]+'\x20'+a30_0x29defe[_0xc03d28(0x277)]('('+_0x37cae7['type']+')'));}}if(_0x12e11b[_0xc03d28(0x198)]){const _0x1c345e=_0x12e11b[_0xc03d28(0x198)]['stitchingKeys']?.['length']?_0xc03d28(0x15f)+_0x12e11b[_0xc03d28(0x198)]['stitchingKeys'][_0xc03d28(0x25f)](',\x20')+']':'';console[_0xc03d28(0x1a2)]('\x20\x20'+a30_0x29defe[_0xc03d28(0x277)]('ID\x20Stitching:')+'\x20'+_0x12e11b[_0xc03d28(0x198)][_0xc03d28(0x13d)]+_0x1c345e);}if(_0x12e11b['personalizationServices']&&_0x12e11b[_0xc03d28(0x132)]['length']>0x0){console['error']('\x20\x20'+a30_0x29defe[_0xc03d28(0x277)]('Personalization:')+'\x20'+_0x12e11b[_0xc03d28(0x132)][_0xc03d28(0x25e)]+'\x20service'+(_0x12e11b[_0xc03d28(0x132)][_0xc03d28(0x25e)]!==0x1?'s':''));for(const _0x3b33bf of _0x12e11b['personalizationServices']){console[_0xc03d28(0x1a2)]('\x20\x20\x20\x20-\x20'+_0x3b33bf[_0xc03d28(0x202)]);}}}function showParentSegmentNotSetError(_0x5820ca){const _0x329cdf=a30_0x4c2f14;console['error'](a30_0x29defe[_0x329cdf(0x178)](_0x329cdf(0x11e))),console['error'](_0x5820ca);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x23f);[a30_0x4c2f14(0x20e)]='List\x20parent\x20segments';async['execute'](_0x4714d3){const _0x3e6e9f=a30_0x4c2f14,{options:_0x5a33a1,args:_0x4ce601,tdx:_0x12a61a}=_0x4714d3,_0x1b7bf6=_0x4ce601[0x0];_0x5a33a1['verbose']&&(console[_0x3e6e9f(0x1a2)](_0x3e6e9f(0x184)+_0x5a33a1[_0x3e6e9f(0x260)]),_0x1b7bf6&&console[_0x3e6e9f(0x1a2)](_0x3e6e9f(0xf1)+_0x1b7bf6));const _0x3b807d=await withSpinner(_0x1b7bf6?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x1b7bf6+_0x3e6e9f(0x17c):'Listing\x20parent\x20segments...',()=>_0x12a61a[_0x3e6e9f(0x160)][_0x3e6e9f(0x11f)](),{'verbose':_0x5a33a1[_0x3e6e9f(0x248)]});let _0x1042eb=_0x3b807d['data'];if(_0x1b7bf6){const _0x48c611=_0x1b7bf6['replace'](/[.+^${}()|[\]\\]/g,_0x3e6e9f(0x279))['replace'](/\*/g,'.*')[_0x3e6e9f(0x241)](/\?/g,'.'),_0x1a2c4b=new RegExp('^'+_0x48c611+'$','i');_0x1042eb=_0x1042eb[_0x3e6e9f(0x262)](_0x674895=>_0x1a2c4b['test'](_0x674895[_0x3e6e9f(0x175)]['name']));}_0x1042eb['sort']((_0x1177d2,_0xcf65f8)=>_0x1177d2[_0x3e6e9f(0x175)]['name'][_0x3e6e9f(0x120)](_0xcf65f8[_0x3e6e9f(0x175)]['name'])),console[_0x3e6e9f(0x1a2)]('✔\x20Found\x20'+_0x1042eb[_0x3e6e9f(0x25e)]+_0x3e6e9f(0x272)+(_0x1042eb['length']!==0x1?'s':''));const _0xa87128=_0x4084bd=>{const _0x43c6d2=_0x3e6e9f;return getConsoleNextUrl(_0x5a33a1[_0x43c6d2(0x260)],_0x43c6d2(0x13e)+_0x4084bd);};if(_0x5a33a1[_0x3e6e9f(0x174)]===_0x3e6e9f(0x1a6)||_0x5a33a1['format']===_0x3e6e9f(0x19d)){const _0x22e3ce=_0x1042eb[_0x3e6e9f(0x22a)](_0x59cdbc=>({..._0x59cdbc,'url':_0xa87128(_0x59cdbc['id'])}));await handleSDKOutput(_0x22e3ce,_0x5a33a1);}else{if(_0x1042eb[_0x3e6e9f(0x25e)]===0x0)_0x1b7bf6?console[_0x3e6e9f(0x140)](_0x3e6e9f(0x242)+_0x1b7bf6):console['log']('No\x20parent\x20segments\x20found');else for(const _0x288be1 of _0x1042eb){const _0x4e8ea=_0x288be1[_0x3e6e9f(0x175)]['population']?a30_0x29defe[_0x3e6e9f(0x277)]('\x20('+formatRows(_0x288be1[_0x3e6e9f(0x175)][_0x3e6e9f(0x227)])+')'):'',_0xf14ea9=hyperlink(_0x288be1[_0x3e6e9f(0x175)][_0x3e6e9f(0x202)],_0xa87128(_0x288be1['id']));console['log'](_0x3e6e9f(0x221)+_0xf14ea9+_0x4e8ea);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x189);[a30_0x4c2f14(0x20e)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a30_0x4c2f14(0x23c)](_0x121ebc){const _0x3ca4a8=a30_0x4c2f14,{options:_0x45ef4c,args:_0x45ac82,tdx:_0x29b9a2}=_0x121ebc;console[_0x3ca4a8(0x1a2)](_0x3ca4a8(0x1e9)+_0x3ca4a8(0x1e4)+_0x3ca4a8(0x26c));const _0x4e7964=_0x45ef4c;if(_0x45ac82[_0x3ca4a8(0x25e)]===0x0)return console['error'](a30_0x29defe[_0x3ca4a8(0x11d)](_0x3ca4a8(0x14c))),console[_0x3ca4a8(0x1a2)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0xadd31f=_0x45ac82[0x0];if(!_0x4e7964[_0x3ca4a8(0x1cc)]||!_0x4e7964['table'])return console[_0x3ca4a8(0x1a2)](_0x3ca4a8(0x1e2)),console['error'](_0x3ca4a8(0x226)),0x1;_0x4e7964[_0x3ca4a8(0x248)]&&(console[_0x3ca4a8(0x1a2)](_0x3ca4a8(0x184)+_0x4e7964['site']),console[_0x3ca4a8(0x1a2)](_0x3ca4a8(0x1f2)+_0xadd31f),console[_0x3ca4a8(0x1a2)](_0x3ca4a8(0x154)+_0x4e7964[_0x3ca4a8(0x1cc)]),console[_0x3ca4a8(0x1a2)](_0x3ca4a8(0x19b)+_0x4e7964[_0x3ca4a8(0x207)]));const _0x132d41=await loadJSONFromOptions(_0x4e7964['attributes'],_0x4e7964[_0x3ca4a8(0x24f)]),_0x487630=await loadJSONFromOptions(_0x4e7964[_0x3ca4a8(0x106)],_0x4e7964[_0x3ca4a8(0x1ed)]),_0x53ada9=await loadJSONFromOptions(_0x4e7964[_0x3ca4a8(0x271)],_0x4e7964[_0x3ca4a8(0x173)]),_0x3093d0={'name':_0xadd31f,'description':_0x4e7964[_0x3ca4a8(0x20e)],'scheduleType':_0x4e7964[_0x3ca4a8(0x11c)],'scheduleOption':_0x4e7964[_0x3ca4a8(0x12b)],'timezone':_0x4e7964[_0x3ca4a8(0x18d)],'master':{'parentDatabaseName':_0x4e7964[_0x3ca4a8(0x1cc)],'parentTableName':_0x4e7964['table']},'attributes':_0x132d41,'behaviors':_0x487630,'customerGroup':_0x53ada9},_0x39d900=await withSpinner(_0x3ca4a8(0x17a)+_0xadd31f+_0x3ca4a8(0x17c),()=>_0x29b9a2[_0x3ca4a8(0x160)][_0x3ca4a8(0xf6)](_0x3093d0),{'verbose':_0x45ef4c[_0x3ca4a8(0x248)]}),_0x255cd8=_0x39d900['data'];return console[_0x3ca4a8(0x1a2)](_0x3ca4a8(0x1d1)+_0x255cd8[_0x3ca4a8(0x202)]+_0x3ca4a8(0x125)+_0x255cd8['id']),await handleSDKOutput([_0x255cd8],_0x45ef4c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']='segment:parent:update';['description']=a30_0x4c2f14(0x171);async[a30_0x4c2f14(0x23c)](_0x2859d7){const _0x31d86b=a30_0x4c2f14,{options:_0x533848,args:_0x4e095a,tdx:_0x4793db}=_0x2859d7;console[_0x31d86b(0x1a2)](_0x31d86b(0x1e8)+_0x31d86b(0x1e4)+_0x31d86b(0x26c));const _0x123fc2=_0x533848;if(_0x4e095a[_0x31d86b(0x25e)]===0x0)return console[_0x31d86b(0x1a2)](a30_0x29defe[_0x31d86b(0x11d)](_0x31d86b(0x14c))),console[_0x31d86b(0x1a2)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x1662a8=_0x4e095a[0x0];_0x123fc2[_0x31d86b(0x248)]&&(console['error']('Site:\x20'+_0x123fc2[_0x31d86b(0x260)]),console[_0x31d86b(0x1a2)](_0x31d86b(0x274)+_0x1662a8));const _0xe77af3=await withSpinner(_0x31d86b(0x13c)+_0x1662a8+_0x31d86b(0x17c),()=>_0x4793db[_0x31d86b(0x160)][_0x31d86b(0x214)](_0x1662a8),{'verbose':_0x123fc2[_0x31d86b(0x248)]}),_0x3fa974=_0xe77af3['data'],_0x27a6c8=await loadJSONFromOptions(_0x123fc2['addAttributes'],_0x123fc2[_0x31d86b(0x26e)]),_0x2cf833=await loadJSONFromOptions(_0x123fc2[_0x31d86b(0x269)],_0x123fc2[_0x31d86b(0x14b)]),_0x3df7fb={'name':_0x3fa974[_0x31d86b(0x202)],'description':_0x123fc2[_0x31d86b(0x20e)]!==undefined?_0x123fc2[_0x31d86b(0x20e)]:_0x3fa974[_0x31d86b(0x20e)],'scheduleType':_0x123fc2[_0x31d86b(0x11c)]!==undefined?_0x123fc2[_0x31d86b(0x11c)]:_0x3fa974[_0x31d86b(0x11c)],'scheduleOption':_0x123fc2['scheduleOption']!==undefined?_0x123fc2[_0x31d86b(0x12b)]:_0x3fa974[_0x31d86b(0x12b)],'timezone':_0x123fc2[_0x31d86b(0x18d)]!==undefined?_0x123fc2[_0x31d86b(0x18d)]:_0x3fa974[_0x31d86b(0x18d)],'master':_0x3fa974[_0x31d86b(0x261)],'attributes':_0x27a6c8?[..._0x3fa974[_0x31d86b(0x175)]||[],..._0x27a6c8]:_0x3fa974['attributes'],'behaviors':_0x2cf833?[..._0x3fa974['behaviors']||[],..._0x2cf833]:_0x3fa974[_0x31d86b(0x106)],'customerGroup':_0x3fa974[_0x31d86b(0x271)]},_0x16458d=await withSpinner(_0x31d86b(0x168)+_0x1662a8+_0x31d86b(0x17c),()=>_0x4793db[_0x31d86b(0x160)][_0x31d86b(0x134)](_0x1662a8,_0x3df7fb),{'verbose':_0x123fc2[_0x31d86b(0x248)]}),_0x395237=_0x16458d[_0x31d86b(0x1cb)];return console[_0x31d86b(0x1a2)](_0x31d86b(0x153)+_0x395237[_0x31d86b(0x202)]+'\x27'),await handleSDKOutput([_0x395237],_0x123fc2),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x1ac);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0xf5);async[a30_0x4c2f14(0x23c)](_0x297a90){const _0x10a3e6=a30_0x4c2f14,{options:_0x348123,args:_0x5be12a,tdx:_0x2da38a}=_0x297a90,_0x66020e=_0x348123,_0x45f9fc=_0x5be12a[0x0]||_0x348123[_0x10a3e6(0x1af)];if(!_0x45f9fc)return showParentSegmentNotSetError(_0x10a3e6(0x24c)+_0x10a3e6(0x150)),0x1;if(_0x66020e['use']&&_0x66020e['output'])return console['error'](a30_0x29defe[_0x10a3e6(0x11d)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x10a3e6(0x1a2)](a30_0x29defe[_0x10a3e6(0x277)](_0x10a3e6(0x19e))),console[_0x10a3e6(0x1a2)](a30_0x29defe['dim'](_0x10a3e6(0x270)+PARENT_SEGMENT_DIR+_0x10a3e6(0x1fa))),console[_0x10a3e6(0x1a2)](a30_0x29defe[_0x10a3e6(0x1da)](_0x10a3e6(0x1b3))),0x1;const _0x561fb5=_0x66020e[_0x10a3e6(0x217)]||a30_0x1eec83[_0x10a3e6(0x25f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x45f9fc)+'.yml');_0x66020e[_0x10a3e6(0x248)]&&(console[_0x10a3e6(0x1a2)]('Site:\x20'+_0x66020e['site']),console[_0x10a3e6(0x1a2)]('Parent\x20segment:\x20'+_0x45f9fc),console[_0x10a3e6(0x1a2)](_0x10a3e6(0x24e)+_0x561fb5));const _0x53e34a=await withSpinner(_0x10a3e6(0x1f4)+_0x45f9fc+_0x10a3e6(0x17c),()=>_0x2da38a[_0x10a3e6(0x160)][_0x10a3e6(0x13f)](_0x45f9fc),{'verbose':_0x66020e[_0x10a3e6(0x248)]}),_0x49bd7a=_0x53e34a[_0x10a3e6(0x1cb)];if(existsSync(_0x561fb5)){const _0x10c675=readFileSync(_0x561fb5,_0x10a3e6(0x275)),_0x6aaa3a=generateDiff(_0x10c675,_0x49bd7a);if(!hasChanges(_0x6aaa3a))console[_0x10a3e6(0x1a2)](a30_0x29defe[_0x10a3e6(0x1c9)]('✔')+_0x10a3e6(0x1c5)+a30_0x29defe[_0x10a3e6(0x1da)](_0x561fb5)+_0x10a3e6(0x1a1));else{console['error'](_0x10a3e6(0x197)+_0x561fb5+'\x27:'),console[_0x10a3e6(0x1a2)]('─'[_0x10a3e6(0x21a)](0x3c)),console[_0x10a3e6(0x1a2)](formatDiffWithColors(_0x6aaa3a)),console['error']('─'[_0x10a3e6(0x21a)](0x3c));if(!_0x66020e[_0x10a3e6(0x23b)]){if(!isInteractive())return console['error'](a30_0x29defe[_0x10a3e6(0x11d)](_0x10a3e6(0x1ba)),_0x10a3e6(0x1f1)),console[_0x10a3e6(0x1a2)](a30_0x29defe[_0x10a3e6(0x277)](_0x10a3e6(0x1ad))),0x1;const _0x30aa47=await confirmKey(_0x10a3e6(0x250)+_0x561fb5+'\x27?');if(!_0x30aa47)return console[_0x10a3e6(0x1a2)](a30_0x29defe[_0x10a3e6(0x178)](_0x10a3e6(0xfd))),0x1;}writeFileSync(_0x561fb5,_0x49bd7a,'utf-8'),console[_0x10a3e6(0x1a2)](a30_0x29defe[_0x10a3e6(0x1c9)]('✔')+_0x10a3e6(0x135)+a30_0x29defe['cyan'](_0x561fb5));}}else{const _0x485c7c=a30_0x1eec83[_0x10a3e6(0x1d4)](_0x561fb5);!existsSync(_0x485c7c)&&mkdirSync(_0x485c7c,{'recursive':!![]}),writeFileSync(_0x561fb5,_0x49bd7a,'utf-8'),console[_0x10a3e6(0x1a2)](a30_0x29defe[_0x10a3e6(0x1c9)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x29defe[_0x10a3e6(0x1da)](_0x561fb5));}return saveSessionContext({'parent_segment':_0x45f9fc},_0x66020e[_0x10a3e6(0x10e)]),console[_0x10a3e6(0x1a2)](a30_0x29defe['green']('✔')+_0x10a3e6(0x110)+a30_0x29defe[_0x10a3e6(0x277)](_0x10a3e6(0x1fc))+'\x20=\x20'+a30_0x29defe[_0x10a3e6(0x1da)](_0x45f9fc)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x210);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0x1aa);async[a30_0x4c2f14(0x23c)](_0x5d0612){const _0x4f726e=a30_0x4c2f14,{options:_0x1eb16b,args:_0x55ff71,tdx:_0x40d998}=_0x5d0612,_0x595202=_0x1eb16b,_0xa6ec92=_0x55ff71[0x0]||_0x1eb16b['parentSegment'];if(!_0xa6ec92)return showParentSegmentNotSetError(_0x4f726e(0x239)+_0x4f726e(0x105)),0x1;const _0x70c280=resolveYamlFile(_0xa6ec92);if(!existsSync(_0x70c280))return showFileNotFoundError(_0x70c280,_0xa6ec92),0x1;_0x595202[_0x4f726e(0x248)]&&(console['error'](_0x4f726e(0x184)+_0x595202['site']),console[_0x4f726e(0x1a2)](_0x4f726e(0x13b)+_0x70c280));let _0x185f3e;try{_0x185f3e=readFileSync(_0x70c280,_0x4f726e(0x275));}catch(_0x25df7a){const _0x24204e=_0x25df7a instanceof Error?_0x25df7a[_0x4f726e(0x19c)]:String(_0x25df7a);return console[_0x4f726e(0x1a2)](_0x4f726e(0x14a)+_0x24204e),0x1;}const _0x561aed=await withSpinner('Analyzing\x20changes...',()=>_0x40d998[_0x4f726e(0x160)][_0x4f726e(0x209)](_0x185f3e),{'verbose':_0x595202['verbose']}),_0x41c379=_0x561aed[_0x4f726e(0x1cb)],{isNew:_0x30693b,name:_0x32e1c2,hasChanges:_0x3f8ddb,diffFormatted:_0x5babf9}=_0x41c379;if(!_0x3f8ddb)return console[_0x4f726e(0x1a2)]('✔\x20No\x20changes\x20-\x20\x27'+_0x32e1c2+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x30693b?console['error'](_0x4f726e(0x100)+_0x32e1c2+'\x27:'):console[_0x4f726e(0x1a2)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x32e1c2+'\x27:');console[_0x4f726e(0x1a2)]('─'[_0x4f726e(0x21a)](0x3c)),console[_0x4f726e(0x1a2)](_0x5babf9),console[_0x4f726e(0x1a2)]('─'[_0x4f726e(0x21a)](0x3c));const _0x554764=_0x30693b?'Create\x20parent\x20segment\x20\x27'+_0x32e1c2+'\x27?':_0x4f726e(0x129)+_0x32e1c2+'\x27?';if(!_0x595202[_0x4f726e(0x23b)]){if(!isInteractive())return console[_0x4f726e(0x1a2)](a30_0x29defe[_0x4f726e(0x11d)](_0x4f726e(0x1ba)),_0x4f726e(0x1f1)),console[_0x4f726e(0x1a2)](a30_0x29defe[_0x4f726e(0x277)](_0x4f726e(0x1ad))),0x1;const _0x508623=await confirmKey(_0x554764);if(!_0x508623)return console['error'](a30_0x29defe[_0x4f726e(0x178)]('Aborted.')),0x1;}const _0x2943bc=_0x30693b?'Creating':'Updating',_0x121cb4=await withSpinner(_0x2943bc+'\x20parent\x20segment\x20\x27'+_0x32e1c2+_0x4f726e(0x17c),()=>_0x41c379['apply'](),{'verbose':_0x595202['verbose']}),_0x2f1177=_0x121cb4['data'],_0x1a8c1d=getConsoleNextUrl(_0x595202[_0x4f726e(0x260)],_0x4f726e(0x13e)+_0x2f1177['id']),_0x455bc1=_0x30693b?'Created':_0x4f726e(0x1b7);return console[_0x4f726e(0x1a2)]('✔\x20'+_0x455bc1+_0x4f726e(0x22f)+_0x2f1177['name']+'\x27'),console[_0x4f726e(0x1a2)]('\x20\x20'+_0x1a8c1d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x16a);['description']='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a30_0x4c2f14(0x23c)](_0x3c06d2){const _0x4fd736=a30_0x4c2f14,{options:_0x410252,args:_0xeabb49,tdx:_0x416dd7}=_0x3c06d2,_0x120001=_0x410252,_0x4b1f3c=_0xeabb49[0x0]||_0x410252['parentSegment'];if(!_0x4b1f3c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x4fd736(0x21d)+_0x4fd736(0x1a0)+_0x4fd736(0x18b)+_0x4fd736(0x25b)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x3020f1=resolveYamlFile(_0x4b1f3c);if(!existsSync(_0x3020f1))return showFileNotFoundError(_0x3020f1,_0x4b1f3c),0x1;_0x120001[_0x4fd736(0x248)]&&(console['error'](_0x4fd736(0x184)+_0x120001['site']),console[_0x4fd736(0x1a2)](_0x4fd736(0x13b)+_0x3020f1));let _0x7d770c;try{_0x7d770c=readFileSync(_0x3020f1,_0x4fd736(0x275));}catch(_0x4ad617){const _0x692f79=_0x4ad617 instanceof Error?_0x4ad617[_0x4fd736(0x19c)]:String(_0x4ad617);return console[_0x4fd736(0x1a2)](_0x4fd736(0x14a)+_0x692f79),0x1;}const _0xd75f53=createCommandSpinner(a30_0x29defe['dim']('Validating\x20configuration...'),{'verbose':_0x120001[_0x4fd736(0x248)]});_0xd75f53[_0x4fd736(0x159)]();const _0x4d37f8={'onProgress':_0x31b0f4=>{const _0x5f3355=_0x4fd736;_0xd75f53[_0x5f3355(0x212)]=formatProgressMessage(_0x31b0f4);}};if(_0x120001[_0x4fd736(0x261)])_0x4d37f8[_0x4fd736(0x261)]=!![];if(_0x120001['enriched'])_0x4d37f8['enriched']=!![];_0x120001[_0x4fd736(0x126)]&&(_0x4d37f8[_0x4fd736(0x126)]=_0x120001['attribute']);_0x120001[_0x4fd736(0x1db)]&&(_0x4d37f8[_0x4fd736(0x1db)]=_0x120001[_0x4fd736(0x1db)]);if(_0x120001[_0x4fd736(0x17d)])_0x4d37f8[_0x4fd736(0x17d)]=_0x120001[_0x4fd736(0x17d)];let _0x524892;try{_0x524892=await _0x416dd7[_0x4fd736(0x160)][_0x4fd736(0x1b6)](_0x7d770c,_0x4d37f8),_0xd75f53['stop']();}catch(_0x130f19){_0xd75f53[_0x4fd736(0x111)]();throw _0x130f19;}const _0x46d561=_0x120001[_0x4fd736(0x17d)]||_0x4fd736(0x146);return this['displayValidateResults'](_0x524892,_0x4d37f8,_0x3020f1,_0x46d561),_0x524892[_0x4fd736(0x182)]?0x0:0x1;}[a30_0x4c2f14(0x166)](_0x4a80a7,_0x24b14a,_0x518207,_0x148ff1){const _0x4c671c=a30_0x4c2f14;console['error']('\x0a'+a30_0x29defe['bold'](_0x4c671c(0xf0))+'\x20'+_0x4a80a7[_0x4c671c(0x202)]),console[_0x4c671c(0x1a2)]('═'[_0x4c671c(0x21a)](0x3c)),this['displayMasterInfo'](_0x4a80a7);if(typeof _0x24b14a[_0x4c671c(0x126)]===_0x4c671c(0x21c)){this[_0x4c671c(0x18f)](_0x4a80a7),this[_0x4c671c(0x114)](_0x4a80a7),this['displayPreviewHints'](_0x518207,_0x148ff1,_0x4c671c(0x126),_0x24b14a['attribute']);return;}if(_0x24b14a[_0x4c671c(0x126)]===!![]){this['displayAttributesStats'](_0x4a80a7),this[_0x4c671c(0x114)](_0x4a80a7),this[_0x4c671c(0x1b4)](_0x518207,_0x148ff1,_0x4c671c(0x175));return;}if(typeof _0x24b14a[_0x4c671c(0x1db)]===_0x4c671c(0x21c)){this[_0x4c671c(0x1d9)](_0x4a80a7,_0x148ff1),this[_0x4c671c(0x114)](_0x4a80a7),this[_0x4c671c(0x1b4)](_0x518207,_0x148ff1,'behavior',_0x24b14a[_0x4c671c(0x1db)]);return;}if(_0x24b14a['behavior']===!![]){this[_0x4c671c(0x1d9)](_0x4a80a7,_0x148ff1),this[_0x4c671c(0x114)](_0x4a80a7),this[_0x4c671c(0x1b4)](_0x518207,_0x148ff1,_0x4c671c(0x106));return;}this['displayAttributesStats'](_0x4a80a7),this[_0x4c671c(0x1d9)](_0x4a80a7,_0x148ff1),this[_0x4c671c(0x169)](_0x4a80a7),this[_0x4c671c(0x114)](_0x4a80a7),this['displayPreviewHints'](_0x518207,_0x148ff1,_0x4c671c(0x236));}['displayRealtimeInfo'](_0x227103){displayRealtimeValidation(_0x227103);}['displayPreviewHints'](_0xf05d4,_0x4f3bcb,_0x85a92e,_0x594834){const _0x43c74c=a30_0x4c2f14;console[_0x43c74c(0x1a2)]('\x0a'+a30_0x29defe[_0x43c74c(0x277)](_0x43c74c(0x108)));const _0x45989d=_0x4f3bcb!==_0x43c74c(0x146)?_0x43c74c(0x219)+_0x4f3bcb:'';if(_0x85a92e===_0x43c74c(0x126)&&_0x594834)console[_0x43c74c(0x1a2)]('\x20\x20'+a30_0x29defe[_0x43c74c(0x277)](_0x43c74c(0x180)+_0xf05d4+_0x43c74c(0x1b2)+_0x594834+'\x22'+_0x45989d));else{if(_0x85a92e===_0x43c74c(0x1db)&&_0x594834)console[_0x43c74c(0x1a2)]('\x20\x20'+a30_0x29defe['dim'](_0x43c74c(0x180)+_0xf05d4+_0x43c74c(0x116)+_0x594834+'\x22'+_0x45989d));else(_0x85a92e===_0x43c74c(0x175)||_0x85a92e===_0x43c74c(0x236))&&console[_0x43c74c(0x1a2)]('\x20\x20'+a30_0x29defe[_0x43c74c(0x277)]('tdx\x20ps\x20preview\x20'+_0xf05d4+_0x43c74c(0x10f)+_0x45989d));}(_0x85a92e===_0x43c74c(0x106)||_0x85a92e===_0x43c74c(0x236))&&console[_0x43c74c(0x1a2)]('\x20\x20'+a30_0x29defe[_0x43c74c(0x277)](_0x43c74c(0x180)+_0xf05d4+_0x43c74c(0x14d)+_0x45989d)),_0x85a92e===_0x43c74c(0x236)&&console[_0x43c74c(0x1a2)]('\x20\x20'+a30_0x29defe[_0x43c74c(0x277)](_0x43c74c(0x180)+_0xf05d4+'\x20--enriched'+_0x45989d));}['displayMasterInfo'](_0x2282b3){const _0x16d991=a30_0x4c2f14,{master:_0x4fb3a5}=_0x2282b3,_0x573e30=_0x4fb3a5[_0x16d991(0x23a)]?a30_0x29defe[_0x16d991(0x1c9)]('✔'):a30_0x29defe[_0x16d991(0x11d)]('✘');console[_0x16d991(0x1a2)]('\x0a'+a30_0x29defe[_0x16d991(0x277)](_0x16d991(0x113))),console[_0x16d991(0x1a2)](_0x573e30+'\x20'+a30_0x29defe[_0x16d991(0x151)](_0x4fb3a5[_0x16d991(0x1cc)]+'.'+_0x4fb3a5[_0x16d991(0x207)])),_0x4fb3a5[_0x16d991(0x23a)]?_0x4fb3a5[_0x16d991(0x164)]!==undefined&&console[_0x16d991(0x1a2)]('\x20\x20'+a30_0x29defe['dim']('Rows:')+'\x20'+a30_0x29defe[_0x16d991(0x1da)](formatRows(_0x4fb3a5[_0x16d991(0x164)]))):console[_0x16d991(0x1a2)]('\x20\x20'+a30_0x29defe['red']('Error:')+'\x20'+_0x4fb3a5[_0x16d991(0xfe)]);}[a30_0x4c2f14(0x18f)](_0x5e8596){const _0x44aac2=a30_0x4c2f14;if(_0x5e8596[_0x44aac2(0x175)][_0x44aac2(0x25e)]===0x0)return;console['error']('\x0a'+a30_0x29defe[_0x44aac2(0x277)](_0x44aac2(0x273)));for(const _0x1aabf7 of _0x5e8596[_0x44aac2(0x175)]){const _0xd6435f=_0x1aabf7[_0x44aac2(0x23a)]?a30_0x29defe[_0x44aac2(0x1c9)]('✔'):a30_0x29defe[_0x44aac2(0x11d)]('✘');let _0x43d69f='';if(_0x1aabf7[_0x44aac2(0x23a)]&&_0x1aabf7[_0x44aac2(0xf8)]!==undefined&&_0x1aabf7['coveragePercent']!==undefined){const _0x5d36d5=_0x1aabf7[_0x44aac2(0x22c)][_0x44aac2(0x101)](0x1),_0x1871d8=_0x1aabf7[_0x44aac2(0x22c)]>=0x50?a30_0x29defe[_0x44aac2(0x1c9)]:_0x1aabf7['coveragePercent']>=0x32?a30_0x29defe['yellow']:a30_0x29defe[_0x44aac2(0x11d)];_0x43d69f='\x20'+a30_0x29defe['dim'](_0x44aac2(0x1f3))+'\x20'+_0x1871d8(_0x5d36d5+'%')+'\x20('+formatRows(_0x1aabf7['matchedCount'])+'\x20rows)';}console['error'](_0xd6435f+'\x20'+a30_0x29defe[_0x44aac2(0x151)](_0x1aabf7[_0x44aac2(0x202)])+_0x43d69f),console[_0x44aac2(0x1a2)]('\x20\x20'+a30_0x29defe[_0x44aac2(0x277)]('Source:')+'\x20'+a30_0x29defe[_0x44aac2(0x151)](_0x1aabf7['database']+'.'+_0x1aabf7[_0x44aac2(0x207)]));const _0x2c5028=_0x1aabf7[_0x44aac2(0x179)]===_0x1aabf7[_0x44aac2(0x1a5)]?a30_0x29defe[_0x44aac2(0x277)]('Join\x20on:')+'\x20'+_0x1aabf7[_0x44aac2(0x179)]:a30_0x29defe[_0x44aac2(0x277)]('Join:')+'\x20'+_0x1aabf7[_0x44aac2(0x179)]+'\x20=\x20'+_0x1aabf7[_0x44aac2(0x1a5)];console[_0x44aac2(0x1a2)]('\x20\x20'+_0x2c5028),console['error']('\x20\x20'+a30_0x29defe[_0x44aac2(0x277)](_0x44aac2(0x240))),this[_0x44aac2(0x124)](_0x1aabf7[_0x44aac2(0x1f9)]),!_0x1aabf7['schemaValid']&&console[_0x44aac2(0x1a2)]('\x20\x20'+a30_0x29defe[_0x44aac2(0x11d)]('Error:')+'\x20'+_0x1aabf7['schemaError']);}}[a30_0x4c2f14(0x1d9)](_0x1dc522,_0x4d6c52){const _0x2f7086=a30_0x4c2f14;if(_0x1dc522['behaviors'][_0x2f7086(0x25e)]===0x0)return;console['error']('\x0a'+a30_0x29defe[_0x2f7086(0x277)](_0x2f7086(0x244))+'\x20'+a30_0x29defe['dim']('('+_0x4d6c52+')'));for(const _0x33c460 of _0x1dc522[_0x2f7086(0x106)]){const _0xcea967=_0x33c460[_0x2f7086(0x23a)]?a30_0x29defe[_0x2f7086(0x1c9)]('✔'):a30_0x29defe[_0x2f7086(0x11d)]('✘');let _0x112d87='';if(_0x33c460[_0x2f7086(0x23a)]&&_0x33c460['customersWithEvents']!==undefined&&_0x33c460[_0x2f7086(0x17e)]!==undefined){const _0x446a8d=_0x33c460[_0x2f7086(0x1f6)]?.[_0x2f7086(0x101)](0x1)||'?',_0x5e6ed9=(_0x33c460[_0x2f7086(0x1f6)]??0x0)>=0x32?a30_0x29defe[_0x2f7086(0x1c9)]:(_0x33c460[_0x2f7086(0x1f6)]??0x0)>=0x14?a30_0x29defe[_0x2f7086(0x178)]:a30_0x29defe[_0x2f7086(0x11d)];_0x112d87='\x20'+a30_0x29defe[_0x2f7086(0x277)](_0x2f7086(0x1b0))+'\x20'+_0x5e6ed9(formatRows(_0x33c460['customersWithEvents']))+'\x20('+_0x446a8d+_0x2f7086(0x187)+a30_0x29defe[_0x2f7086(0x277)](_0x2f7086(0x1ff))+'\x20'+a30_0x29defe['cyan'](formatRows(_0x33c460[_0x2f7086(0x17e)]));}console['error'](_0xcea967+'\x20'+a30_0x29defe[_0x2f7086(0x151)](_0x33c460[_0x2f7086(0x202)])+_0x112d87),console[_0x2f7086(0x1a2)]('\x20\x20'+a30_0x29defe[_0x2f7086(0x277)]('Source:')+'\x20'+a30_0x29defe[_0x2f7086(0x151)](_0x33c460[_0x2f7086(0x1cc)]+'.'+_0x33c460[_0x2f7086(0x207)]));const _0x2f2e0d=_0x33c460[_0x2f7086(0x179)]===_0x33c460[_0x2f7086(0x1a5)]?a30_0x29defe[_0x2f7086(0x277)](_0x2f7086(0x109))+'\x20'+_0x33c460[_0x2f7086(0x179)]:a30_0x29defe['dim'](_0x2f7086(0x258))+'\x20'+_0x33c460[_0x2f7086(0x179)]+_0x2f7086(0x238)+_0x33c460[_0x2f7086(0x1a5)];console[_0x2f7086(0x1a2)]('\x20\x20'+_0x2f2e0d),console[_0x2f7086(0x1a2)]('\x20\x20'+a30_0x29defe[_0x2f7086(0x277)]('Columns:')),this[_0x2f7086(0x124)](_0x33c460[_0x2f7086(0x1f9)]),!_0x33c460['schemaValid']&&console[_0x2f7086(0x1a2)]('\x20\x20'+a30_0x29defe[_0x2f7086(0x11d)](_0x2f7086(0x203))+'\x20'+_0x33c460['schemaError']);}}['displayColumns'](_0x1a815a){const _0x56c8f4=a30_0x4c2f14;for(const _0x4cfe5a of _0x1a815a){_0x4cfe5a[_0x56c8f4(0x148)]===_0x4cfe5a[_0x56c8f4(0x12a)]||_0x4cfe5a['column']==='*'?console['error'](_0x56c8f4(0x229)+_0x4cfe5a[_0x56c8f4(0x148)]):console[_0x56c8f4(0x1a2)](_0x56c8f4(0x229)+_0x4cfe5a[_0x56c8f4(0x148)]+'\x20'+a30_0x29defe['dim']('('+_0x4cfe5a['column']+')'));}}[a30_0x4c2f14(0x114)](_0x6cc8c1){const _0x3693bb=a30_0x4c2f14;console[_0x3693bb(0x1a2)]('─'[_0x3693bb(0x21a)](0x3c));if(_0x6cc8c1[_0x3693bb(0x23e)][_0x3693bb(0x25e)]>0x0){console[_0x3693bb(0x1a2)]('\x0a'+a30_0x29defe[_0x3693bb(0x11d)](_0x3693bb(0x1f5)));for(const _0x22fb5d of _0x6cc8c1[_0x3693bb(0x23e)]){console[_0x3693bb(0x1a2)]('\x20\x20'+a30_0x29defe['red']('•')+'\x20'+_0x22fb5d);}}_0x6cc8c1[_0x3693bb(0x182)]&&console[_0x3693bb(0x1a2)]('\x0a'+a30_0x29defe[_0x3693bb(0x1c9)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x1c7);['description']=a30_0x4c2f14(0x1b1);async[a30_0x4c2f14(0x23c)](_0x587f79){const _0x108865=a30_0x4c2f14,{options:_0x71323e,args:_0x55edbb,tdx:_0x57cbd7}=_0x587f79,_0x8f7798=_0x71323e,_0x3e2ed7=_0x55edbb[0x0]||_0x71323e[_0x108865(0x1af)];if(!_0x3e2ed7)return showParentSegmentNotSetError(_0x108865(0x1c4)+_0x108865(0x194)+_0x108865(0x21b)+_0x108865(0xf4)+_0x108865(0x123)+_0x108865(0x141)+_0x108865(0x1a8)+_0x108865(0x19a)),0x1;if(!_0x8f7798[_0x108865(0x261)]&&!_0x8f7798[_0x108865(0x126)]&&!_0x8f7798[_0x108865(0x1db)]&&!_0x8f7798[_0x108865(0x1dd)])return console[_0x108865(0x1a2)](a30_0x29defe['red'](_0x108865(0x1ce))),console[_0x108865(0x1a2)](_0x108865(0x23d)),console[_0x108865(0x1a2)](_0x108865(0x117)),console[_0x108865(0x1a2)](_0x108865(0x1c0)),console[_0x108865(0x1a2)](_0x108865(0x15a)),console['error'](_0x108865(0x1cd)),console[_0x108865(0x1a2)](_0x108865(0x196)),0x1;const _0x5ce833=resolveYamlFile(_0x3e2ed7);if(!existsSync(_0x5ce833))return showFileNotFoundError(_0x5ce833,_0x3e2ed7),0x1;_0x8f7798[_0x108865(0x248)]&&(console['error'](_0x108865(0x184)+_0x8f7798['site']),console[_0x108865(0x1a2)]('YAML\x20file:\x20'+_0x5ce833));let _0x4155f0;try{_0x4155f0=readFileSync(_0x5ce833,_0x108865(0x275));}catch(_0x59544d){const _0x539cf4=_0x59544d instanceof Error?_0x59544d[_0x108865(0x19c)]:String(_0x59544d);return console[_0x108865(0x1a2)](_0x108865(0x14a)+_0x539cf4),0x1;}let _0x2b7715;try{_0x2b7715=parseDef(_0x4155f0);}catch(_0xccb59d){const _0x1a5a76=_0xccb59d instanceof Error?_0xccb59d[_0x108865(0x19c)]:String(_0xccb59d);return console[_0x108865(0x1a2)](a30_0x29defe[_0x108865(0x11d)]('Error\x20parsing\x20YAML:\x20'+_0x1a5a76)),0x1;}if(_0x8f7798[_0x108865(0x126)]===!![]||_0x8f7798[_0x108865(0x126)]===''){const _0x26f2e0=_0x2b7715['attributes']?.['map'](_0x22cac4=>_0x22cac4[_0x108865(0x202)])||[];if(_0x26f2e0['length']===0x0)console[_0x108865(0x1a2)](a30_0x29defe[_0x108865(0x11d)](_0x108865(0x1e1)));else{console[_0x108865(0x1a2)](a30_0x29defe['red']('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x108865(0x1a2)](_0x108865(0x1c6));for(const _0x4a6c31 of _0x26f2e0){console[_0x108865(0x1a2)]('\x20\x20'+a30_0x29defe[_0x108865(0x1da)](_0x4a6c31));}console[_0x108865(0x1a2)](_0x108865(0x1d7)+_0x3e2ed7+'\x20--attribute\x20\x22'+_0x26f2e0[0x0]+'\x22');}return 0x1;}if(_0x8f7798[_0x108865(0x1db)]===!![]||_0x8f7798['behavior']===''){const _0x32add7=_0x2b7715[_0x108865(0x106)]?.[_0x108865(0x22a)](_0x53fb67=>_0x53fb67['name'])||[];if(_0x32add7['length']===0x0)console[_0x108865(0x1a2)](a30_0x29defe[_0x108865(0x11d)](_0x108865(0x16f)));else{console[_0x108865(0x1a2)](a30_0x29defe[_0x108865(0x11d)](_0x108865(0x10c))),console[_0x108865(0x1a2)](_0x108865(0x167));for(const _0x1747b2 of _0x32add7){console[_0x108865(0x1a2)]('\x20\x20'+a30_0x29defe['cyan'](_0x1747b2));}console[_0x108865(0x1a2)](_0x108865(0x1d7)+_0x3e2ed7+_0x108865(0x116)+_0x32add7[0x0]+'\x22');}return 0x1;}const _0x7f696=createCommandSpinner(a30_0x29defe[_0x108865(0x277)](_0x108865(0x225)),{'verbose':_0x8f7798[_0x108865(0x248)]});_0x7f696[_0x108865(0x159)]();const _0x29c7a9={'onProgress':_0x45d326=>{_0x7f696['text']=formatProgressMessage(_0x45d326);}};if(_0x8f7798['master'])_0x29c7a9[_0x108865(0x261)]=!![];if(_0x8f7798['attribute']&&typeof _0x8f7798['attribute']===_0x108865(0x21c))_0x29c7a9[_0x108865(0x126)]=_0x8f7798[_0x108865(0x126)];if(_0x8f7798['behavior']&&typeof _0x8f7798[_0x108865(0x1db)]==='string')_0x29c7a9[_0x108865(0x1db)]=_0x8f7798[_0x108865(0x1db)];if(_0x8f7798[_0x108865(0x1dd)])_0x29c7a9[_0x108865(0x1dd)]=!![];if(_0x8f7798[_0x108865(0x17d)])_0x29c7a9['interval']=_0x8f7798[_0x108865(0x17d)];let _0x3bd4b8;try{_0x3bd4b8=await _0x57cbd7[_0x108865(0x160)][_0x108865(0xf7)](_0x4155f0,_0x29c7a9),_0x7f696[_0x108865(0x111)]();}catch(_0x1e23ec){_0x7f696['stop']();throw _0x1e23ec;}return await this[_0x108865(0x1d5)](_0x3bd4b8,{'master':_0x8f7798['master'],'attribute':typeof _0x8f7798[_0x108865(0x126)]===_0x108865(0x21c)?_0x8f7798[_0x108865(0x126)]:undefined,'behavior':typeof _0x8f7798['behavior']===_0x108865(0x21c)?_0x8f7798[_0x108865(0x1db)]:undefined,'enriched':_0x8f7798[_0x108865(0x1dd)]}),_0x3bd4b8[_0x108865(0x182)]?0x0:0x1;}async['displayPreviewResults'](_0x57bfe9,_0x32c080){const _0x43ef3d=a30_0x4c2f14;console[_0x43ef3d(0x1a2)]('\x0a'+a30_0x29defe['bold']('Preview:')+'\x20'+_0x57bfe9[_0x43ef3d(0x202)]),console[_0x43ef3d(0x1a2)]('═'[_0x43ef3d(0x21a)](0x3c));if(_0x32c080[_0x43ef3d(0x261)]&&_0x57bfe9[_0x43ef3d(0x145)]){const _0x5b29b7=a30_0x29defe[_0x43ef3d(0x277)]('Master:')+'\x20'+a30_0x29defe[_0x43ef3d(0x151)](_0x57bfe9['master'][_0x43ef3d(0x1cc)]+'.'+_0x57bfe9[_0x43ef3d(0x261)][_0x43ef3d(0x207)]);await this[_0x43ef3d(0x1a4)](_0x5b29b7,_0x57bfe9[_0x43ef3d(0x145)]);}else{if(_0x32c080[_0x43ef3d(0x126)]&&_0x57bfe9[_0x43ef3d(0x145)]){const _0x1d562c=a30_0x29defe[_0x43ef3d(0x277)](_0x43ef3d(0x15b))+'\x20'+a30_0x29defe[_0x43ef3d(0x151)](_0x32c080[_0x43ef3d(0x126)]);await this[_0x43ef3d(0x1a4)](_0x1d562c,_0x57bfe9[_0x43ef3d(0x145)]);}else{if(_0x32c080[_0x43ef3d(0x1db)]&&_0x57bfe9[_0x43ef3d(0x145)]){const _0x55b481=a30_0x29defe['dim'](_0x43ef3d(0x26f))+'\x20'+a30_0x29defe[_0x43ef3d(0x151)](_0x32c080[_0x43ef3d(0x1db)]);await this['displaySampleData'](_0x55b481,_0x57bfe9['sampleData']);}else{if(_0x32c080['enriched']&&_0x57bfe9['sampleData']){const _0x3f37b5=a30_0x29defe[_0x43ef3d(0x277)](_0x43ef3d(0x158))+'\x20'+a30_0x29defe['bold'](_0x43ef3d(0x1d3));await this[_0x43ef3d(0x1a4)](_0x3f37b5,_0x57bfe9[_0x43ef3d(0x145)]);}else!_0x57bfe9[_0x43ef3d(0x145)]&&console['error'](_0x43ef3d(0x190));}}}if(_0x57bfe9['errors'][_0x43ef3d(0x25e)]>0x0){console[_0x43ef3d(0x1a2)]('─'[_0x43ef3d(0x21a)](0x3c)),console['error']('\x0a'+a30_0x29defe[_0x43ef3d(0x11d)]('Errors:'));for(const _0x3d8b59 of _0x57bfe9[_0x43ef3d(0x23e)]){console[_0x43ef3d(0x1a2)]('\x20\x20'+a30_0x29defe[_0x43ef3d(0x11d)]('•')+'\x20'+_0x3d8b59);}}}async[a30_0x4c2f14(0x1a4)](_0x2b31ec,_0x32856c){const _0xd357fc=a30_0x4c2f14;if(_0x32856c['length']===0x0){console[_0xd357fc(0x1a2)]('\x0a'+_0x2b31ec),console[_0xd357fc(0x1a2)]('\x20\x20No\x20sample\x20data\x20available');return;}console['error']('\x0a'+_0x2b31ec);const _0x54d241=Object[_0xd357fc(0x1dc)](_0x32856c[0x0])['map'](_0x3b0c87=>({'name':_0x3b0c87,'type':typeof _0x32856c[0x0][_0x3b0c87]==='number'?_0xd357fc(0x1ea):_0xd357fc(0x22b)})),_0x42ee42={'queryId':_0xd357fc(0x18c),'columns':_0x54d241,'data':_0x32856c,'stats':{'state':_0xd357fc(0x256),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x32856c['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0xbf7199=formatAsTable(_0x42ee42,_0x32856c[_0xd357fc(0x25e)],!![]);await writeOutput(_0xbf7199,undefined,_0xd357fc(0x207));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0xfc);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0xf3);async['execute'](_0xb3869d){const _0x5b0c0c=a30_0x4c2f14,{options:_0x497bff,args:_0x458ed9,tdx:_0xc525eb}=_0xb3869d,_0xc43e15=_0x497bff,_0x21a378=_0x458ed9[0x0]||_0x497bff[_0x5b0c0c(0x1af)];if(!_0x21a378)return showParentSegmentNotSetError(_0x5b0c0c(0x268)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x354736=resolveYamlFile(_0x21a378);if(existsSync(_0x354736)){_0xc43e15[_0x5b0c0c(0x248)]&&console[_0x5b0c0c(0x1a2)](_0x5b0c0c(0x1b5)+_0x354736);let _0x32a8bd;try{_0x32a8bd=readFileSync(_0x354736,_0x5b0c0c(0x275));}catch(_0x3f3acd){const _0x80de53=_0x3f3acd instanceof Error?_0x3f3acd[_0x5b0c0c(0x19c)]:String(_0x3f3acd);return console['error'](_0x5b0c0c(0x14a)+_0x80de53),0x1;}const _0x293ca9=await withSpinner(_0x5b0c0c(0x1bd),()=>_0xc525eb[_0x5b0c0c(0x160)]['pushParentYaml'](_0x32a8bd),{'verbose':_0xc43e15[_0x5b0c0c(0x248)]}),_0x25a04f=_0x293ca9['data'],{isNew:_0x249fd1,name:_0x1b16ec,hasChanges:_0xb433f3,diffFormatted:_0x3279fd}=_0x25a04f;if(_0xb433f3){_0x249fd1?console[_0x5b0c0c(0x1a2)](_0x5b0c0c(0x100)+_0x1b16ec+'\x27:'):console[_0x5b0c0c(0x1a2)](_0x5b0c0c(0x201)+_0x1b16ec+'\x27:');console[_0x5b0c0c(0x1a2)]('─'[_0x5b0c0c(0x21a)](0x3c)),console[_0x5b0c0c(0x1a2)](_0x3279fd),console[_0x5b0c0c(0x1a2)]('─'[_0x5b0c0c(0x21a)](0x3c));const _0x4ab832=_0x249fd1?_0x5b0c0c(0x139)+_0x1b16ec+_0x5b0c0c(0x149):_0x5b0c0c(0x129)+_0x1b16ec+'\x27\x20and\x20run\x20workflow?';if(!_0xc43e15[_0x5b0c0c(0x23b)]){if(!isInteractive())return console[_0x5b0c0c(0x1a2)](a30_0x29defe[_0x5b0c0c(0x11d)](_0x5b0c0c(0x1ba)),_0x5b0c0c(0x1f1)),console['error'](a30_0x29defe[_0x5b0c0c(0x277)](_0x5b0c0c(0x1ad))),0x1;const _0x2e1809=await confirmKey(_0x4ab832);if(!_0x2e1809)return console[_0x5b0c0c(0x1a2)](a30_0x29defe[_0x5b0c0c(0x178)]('Aborted.')),0x1;}const _0x34e2ee=_0x249fd1?_0x5b0c0c(0x138):_0x5b0c0c(0x131);await withSpinner(_0x34e2ee+_0x5b0c0c(0x22f)+_0x1b16ec+_0x5b0c0c(0x17c),()=>_0x25a04f[_0x5b0c0c(0x1e3)](),{'verbose':_0xc43e15[_0x5b0c0c(0x248)]});const _0x5bb48b=_0x249fd1?_0x5b0c0c(0x20b):'Updated';console[_0x5b0c0c(0x1a2)]('✔\x20'+_0x5bb48b+_0x5b0c0c(0x22f)+_0x1b16ec+'\x27');}else console[_0x5b0c0c(0x1a2)](_0x5b0c0c(0x1b9)+_0x1b16ec+_0x5b0c0c(0x186));}const _0x3c614c=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x21a378+'\x27...',()=>_0xc525eb[_0x5b0c0c(0x160)][_0x5b0c0c(0x119)](_0x21a378),{'verbose':_0xc43e15['verbose']}),_0x3aa5a0=_0x3c614c[_0x5b0c0c(0x1cb)],_0x3ddb57=getConsoleUrl(_0xc43e15[_0x5b0c0c(0x260)],_0x5b0c0c(0x191)+_0x3aa5a0[_0x5b0c0c(0x14e)]+'/sessions/'+_0x3aa5a0[_0x5b0c0c(0x264)]+_0x5b0c0c(0x276)+_0x3aa5a0[_0x5b0c0c(0x17f)]);return console[_0x5b0c0c(0x1a2)](_0x5b0c0c(0x22d)),console[_0x5b0c0c(0x1a2)]('\x20\x20'+a30_0x29defe[_0x5b0c0c(0x277)](_0x5b0c0c(0x192))+'\x20'+_0x3aa5a0[_0x5b0c0c(0x1fd)]),console[_0x5b0c0c(0x1a2)]('\x20\x20'+a30_0x29defe[_0x5b0c0c(0x277)]('Status:')+'\x20'+_0x3aa5a0['status']),console[_0x5b0c0c(0x1a2)]('\x20\x20'+a30_0x29defe[_0x5b0c0c(0x277)](_0x5b0c0c(0x206))+'\x20'+_0x3aa5a0['workflowSessionId']),console[_0x5b0c0c(0x1a2)]('\x20\x20'+a30_0x29defe['dim']('Attempt:')+'\x20'+_0x3aa5a0[_0x5b0c0c(0x17f)]),console['error']('\x20\x20'+_0x3ddb57),console['error']('\x0a'+a30_0x29defe[_0x5b0c0c(0x277)](_0x5b0c0c(0x11a))+_0x5b0c0c(0x1ee)+_0x3aa5a0[_0x5b0c0c(0x17f)]+_0x5b0c0c(0x147)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x1e0);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0x1bc);async[a30_0x4c2f14(0x23c)](_0xc5d362){const _0x1c6d1e=a30_0x4c2f14,{options:_0x1ea063,args:_0x500822,tdx:_0x5581df}=_0xc5d362,_0x56799a=_0x500822[0x0]||_0x1ea063[_0x1c6d1e(0x1af)];if(!_0x56799a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x1c6d1e(0x1d6)),0x1;_0x1ea063[_0x1c6d1e(0x248)]&&(console[_0x1c6d1e(0x1a2)](_0x1c6d1e(0x184)+_0x1ea063['site']),console[_0x1c6d1e(0x1a2)](_0x1c6d1e(0x274)+_0x56799a));const _0x2c4608=await withSpinner(_0x1c6d1e(0x1c1)+_0x56799a+_0x1c6d1e(0x17c),()=>_0x5581df[_0x1c6d1e(0x160)]['listFields'](_0x56799a),{'verbose':_0x1ea063[_0x1c6d1e(0x248)]}),_0x212ee3=_0x2c4608[_0x1c6d1e(0x1cb)];console[_0x1c6d1e(0x1a2)](_0x1c6d1e(0x26d)+_0x212ee3['length']+_0x1c6d1e(0xf2)+(_0x212ee3[_0x1c6d1e(0x25e)]!==0x1?'s':''));if(_0x1ea063['json']||_0x1ea063['jsonl'])return await handleSDKOutput(_0x212ee3,_0x1ea063),0x0;return displayFieldsHumanReadable(_0x212ee3,_0x56799a),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x1f0);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0x259);async[a30_0x4c2f14(0x23c)](_0x42590f){const _0x5f1a2d=a30_0x4c2f14,{options:_0x5b9943,args:_0x13cf75,tdx:_0xc2e676}=_0x42590f,_0x1bcf35=_0x5b9943,_0x4ebcf2=_0x13cf75[0x0]||_0x5b9943[_0x5f1a2d(0x1af)];if(!_0x4ebcf2)return showParentSegmentNotSetError(_0x5f1a2d(0xff)+_0x5f1a2d(0x1e6)+'Options:\x0a'+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x5b9943[_0x5f1a2d(0x248)]&&(console[_0x5f1a2d(0x1a2)](_0x5f1a2d(0x184)+_0x5b9943[_0x5f1a2d(0x260)]),console[_0x5f1a2d(0x1a2)](_0x5f1a2d(0x274)+_0x4ebcf2));const _0x4e0033=await withSpinner(_0x5f1a2d(0x1f4)+_0x4ebcf2+_0x5f1a2d(0x17c),()=>_0xc2e676['segment'][_0x5f1a2d(0x214)](_0x4ebcf2),{'verbose':_0x5b9943[_0x5f1a2d(0x248)]}),_0x49ec77=_0x4e0033[_0x5f1a2d(0x1cb)];if(_0x1bcf35['web']){const _0x2a2512=getConsoleNextUrl(_0x1bcf35['site'],_0x5f1a2d(0x13e)+_0x49ec77['id']);return console['error'](a30_0x29defe[_0x5f1a2d(0x1c9)]('✔')+_0x5f1a2d(0x177)+a30_0x29defe['cyan'](_0x2a2512)),openBrowser(_0x2a2512),0x0;}return await handleSingleObjectOutput(_0x49ec77,_0x5b9943),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x1be);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0x15d);async['execute'](_0x3170a0){const _0x15f435=a30_0x4c2f14,{options:_0x49e49c,args:_0x13ae1d,tdx:_0xaf7ca0}=_0x3170a0,_0x124d1e=_0x49e49c,_0x35ca6d=_0x13ae1d[0x0]||_0x49e49c['parentSegment'];if(!_0x35ca6d)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x15f435(0x12c)),0x1;_0x49e49c[_0x15f435(0x248)]&&(console[_0x15f435(0x1a2)](_0x15f435(0x184)+_0x49e49c[_0x15f435(0x260)]),console['error'](_0x15f435(0x274)+_0x35ca6d));const _0x38619f=await withSpinner(_0x15f435(0x16d)+_0x35ca6d+_0x15f435(0x17c),()=>_0xaf7ca0['segment'][_0x15f435(0x22e)](_0x35ca6d),{'verbose':_0x49e49c[_0x15f435(0x248)]}),_0x50c9f7=_0x38619f[_0x15f435(0x1cb)],_0x21152c=_0xaf7ca0[_0x15f435(0x160)][_0x15f435(0x103)](_0x50c9f7);if(_0x124d1e['output']){const _0x203f16=await this[_0x15f435(0x12f)](_0x3170a0,_0x35ca6d,_0x50c9f7,_0x21152c),_0x184d76=this[_0x15f435(0x27a)](_0x203f16);writeFileSync(_0x124d1e['output'],_0x184d76);const _0x4c9711=_0x203f16[_0x15f435(0x20f)][_0x15f435(0x1f9)]['length']+_0x203f16[_0x15f435(0x106)][_0x15f435(0x1a7)]((_0x1541f9,_0x15dca5)=>_0x1541f9+_0x15dca5['columns'][_0x15f435(0x25e)],0x0),_0x54c5d7=_0x203f16['behaviors']['filter'](_0x56af71=>_0x56af71[_0x15f435(0x1f9)]['length']===0x0)[_0x15f435(0x25e)];return console['log'](_0x15f435(0x15c)+_0x124d1e['output']),console[_0x15f435(0x140)](_0x15f435(0x211)+_0x21152c),console[_0x15f435(0x140)](_0x15f435(0x128)+_0x203f16[_0x15f435(0x106)][_0x15f435(0x25e)]+_0x15f435(0x181)),console[_0x15f435(0x140)](_0x15f435(0x222)+_0x4c9711+_0x15f435(0x1ae)),_0x54c5d7>0x0&&console[_0x15f435(0x140)](_0x15f435(0x1a9)+_0x54c5d7+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console['error']('\x0a'+a30_0x29defe['bold'](_0x15f435(0x1d2))+'\x20'+a30_0x29defe['cyan'](_0x21152c));const _0x37c965=await withSpinner(_0x15f435(0x118),()=>_0xaf7ca0['segment'][_0x15f435(0x1ca)](_0x50c9f7),{'verbose':_0x49e49c['verbose']});console[_0x15f435(0x1a2)]('\x0a'+a30_0x29defe[_0x15f435(0x151)](_0x15f435(0x20f))+'\x20'+a30_0x29defe[_0x15f435(0x277)]('('+_0x21152c+_0x15f435(0x218)));const _0x1d102d=await executeSchemaQuery(_0x37c965[_0x15f435(0x1cb)],_0xaf7ca0,_0x49e49c);await handleQueryOutput(_0x1d102d,_0x49e49c);const _0x43281f=await withSpinner('Fetching\x20behavior\x20list...',()=>_0xaf7ca0[_0x15f435(0x160)]['getBehaviorNames'](_0x50c9f7),{'verbose':_0x49e49c[_0x15f435(0x248)]});for(const _0xc5e383 of _0x43281f[_0x15f435(0x1cb)]){const _0x3d32ab=_0x15f435(0x1e7)+_0xc5e383['toLowerCase']()[_0x15f435(0x241)](/\s+/g,'_'),_0x5ef6c0='SELECT\x20*\x20FROM\x20'+_0x21152c+'.'+_0x3d32ab;console[_0x15f435(0x1a2)]('\x0a'+a30_0x29defe[_0x15f435(0x151)](_0xc5e383)+'\x20'+a30_0x29defe['dim']('('+_0x21152c+'.'+_0x3d32ab+')'));try{const _0x1a1a37=await executeSchemaQuery(_0x5ef6c0,_0xaf7ca0,_0x49e49c);await handleQueryOutput(_0x1a1a37,_0x49e49c);}catch{console['error'](a30_0x29defe['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a30_0x4c2f14(0x12f)](_0x1bbf3a,_0x4753d7,_0x2a816d,_0x148d21){const _0x2af12a=a30_0x4c2f14,{options:_0x2b99a9,tdx:_0x1e8271}=_0x1bbf3a,_0x1b184e=await withSpinner(_0x2af12a(0x118),()=>_0x1e8271[_0x2af12a(0x160)][_0x2af12a(0x1ca)](_0x2a816d),{'verbose':_0x2b99a9[_0x2af12a(0x248)]}),_0x2ac09f=await executeSchemaQuery(_0x1b184e[_0x2af12a(0x1cb)],_0x1e8271,_0x2b99a9),_0xa1840f=_0x2ac09f['data'][_0x2af12a(0x22a)](_0x69000c=>({'name':_0x69000c[_0x2af12a(0x155)],'type':_0x69000c[_0x2af12a(0x1d0)]})),_0x4f4175=await withSpinner(_0x2af12a(0x231),()=>_0x1e8271['segment'][_0x2af12a(0x20d)](_0x2a816d),{'verbose':_0x2b99a9['verbose']}),_0x592d08=[];for(const _0x14eebe of _0x4f4175[_0x2af12a(0x1cb)]){const _0x3387d4='behavior_'+_0x14eebe['toLowerCase']()[_0x2af12a(0x241)](/\s+/g,'_'),_0x2bebaa='SELECT\x20*\x20FROM\x20'+_0x148d21+'.'+_0x3387d4;let _0x4e3592=[];try{const _0x192b61=await executeSchemaQuery(_0x2bebaa,_0x1e8271,_0x2b99a9);_0x4e3592=_0x192b61[_0x2af12a(0x1cb)][_0x2af12a(0x22a)](_0x4647f7=>({'name':_0x4647f7[_0x2af12a(0x155)],'type':_0x4647f7['column_type']}));}catch{}_0x592d08[_0x2af12a(0x152)]({'table':_0x3387d4,'columns':_0x4e3592});}return{'database':_0x148d21,'parent_segment':_0x4753d7,'parent_id':_0x2a816d,'customers':{'table':_0x2af12a(0x20f),'columns':_0xa1840f},'behaviors':_0x592d08};}[a30_0x4c2f14(0x27a)](_0x55dd4c){const _0x5b521b=a30_0x4c2f14,_0x4cea93=_0x2858cc=>{const _0x31abe3=a30_0x5265;if(_0x2858cc[_0x31abe3(0x25e)]===0x0)return'[]';const _0x1a8e6c=_0x2858cc[_0x31abe3(0x22a)](_0x2bb212=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x2bb212['name']+'\x22,\x20\x22type\x22:\x20\x22'+_0x2bb212[_0x31abe3(0x144)]+'\x22\x20}');return'[\x0a'+_0x1a8e6c['join'](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x56c7f6=_0x55dd4c[_0x5b521b(0x106)][_0x5b521b(0x22a)](_0x2d30e6=>{const _0x3cad45=_0x5b521b;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x2d30e6[_0x3cad45(0x207)]+_0x3cad45(0x1df)+_0x4cea93(_0x2d30e6[_0x3cad45(0x1f9)])[_0x3cad45(0x241)](/^/gm,'\x20\x20')[_0x3cad45(0x10b)]()+_0x3cad45(0x233);})[_0x5b521b(0x25f)](',\x0a');return _0x5b521b(0x249)+_0x55dd4c[_0x5b521b(0x1cc)]+_0x5b521b(0x183)+_0x55dd4c[_0x5b521b(0x1fc)]+_0x5b521b(0x16c)+_0x55dd4c['parent_id']+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x55dd4c[_0x5b521b(0x20f)][_0x5b521b(0x207)]+_0x5b521b(0x25a)+_0x4cea93(_0x55dd4c[_0x5b521b(0x20f)]['columns'])[_0x5b521b(0x241)](/^/gm,'\x20\x20')['trim']()+_0x5b521b(0x1de)+_0x56c7f6+_0x5b521b(0x193);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x230);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0x254);async[a30_0x4c2f14(0x23c)](_0x2142ce){const _0x342c3b=a30_0x4c2f14,{options:_0x34e854,args:_0xe0996f,tdx:_0x425067}=_0x2142ce,_0x2d7aaf=_0xe0996f[0x0]||_0x34e854[_0x342c3b(0x1af)];if(!_0x2d7aaf)return showParentSegmentNotSetError(_0x342c3b(0x163)+_0x342c3b(0x255)),0x1;_0x34e854[_0x342c3b(0x248)]&&(console[_0x342c3b(0x1a2)](_0x342c3b(0x184)+_0x34e854[_0x342c3b(0x260)]),console[_0x342c3b(0x1a2)](_0x342c3b(0x274)+_0x2d7aaf));const _0x145cb1=await withSpinner(_0x342c3b(0x16d)+_0x2d7aaf+_0x342c3b(0x17c),()=>_0x425067[_0x342c3b(0x160)][_0x342c3b(0x22e)](_0x2d7aaf),{'verbose':_0x34e854['verbose']}),_0x2b0ebd=_0x145cb1[_0x342c3b(0x1cb)],_0x8e4f3f=await withSpinner(_0x342c3b(0x10a)+_0x2d7aaf+_0x342c3b(0x17c),()=>_0x425067[_0x342c3b(0x160)][_0x342c3b(0x1ca)](_0x2b0ebd),{'verbose':_0x34e854[_0x342c3b(0x248)]}),_0x73b017=_0x8e4f3f[_0x342c3b(0x1cb)];return _0x34e854[_0x342c3b(0x174)]===_0x342c3b(0x1a6)||_0x34e854[_0x342c3b(0x174)]===_0x342c3b(0x19d)?await handleSDKOutput([{'sql':_0x73b017}],_0x34e854):console[_0x342c3b(0x140)](_0x73b017),0x0;}}function a30_0x22a5(){const _0x4f77d0=['\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','length','join','site','master','filter','⚡\x20Not\x20enabled','workflowSessionId','RT\x202.0\x20Validate:','ps:pz:init','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','addBehaviors','run','parent_segments','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','✔\x20Found\x20','addAttributesFile','Behavior:','using\x20the\x20default\x20path:\x20','customerGroup','\x20parent\x20segment','Attributes','Parent\x20segment:\x20','utf-8','/attempt/','dim','match','\x5c$&','formatSchemaJson','Validate:','Pattern:\x20','\x20field','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','createParent','previewParentYaml','matchedCount','✔\x20Renamed\x20directory\x20to\x20','processedRows','win32','segment:parent:run','Aborted.','schemaError','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x0aNew\x20parent\x20segment\x20\x27','toFixed','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','getOutputDatabaseName','xdg-open','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','behaviors','Error\x20parsing\x20YAML:\x20','To\x20view\x20sample\x20data:','Join\x20on:','Fetching\x20SQL\x20for\x20\x27','trim','Error:\x20--behavior\x20requires\x20a\x20name\x0a','jobId','session','\x20--attribute\x20\x22<name>\x22','\x20Context\x20set:\x20','stop','true','Master\x20Table','displaySummary','22jCvLlf','\x20--behavior\x20\x22','Options:','Fetching\x20customers\x20schema...','runParent','To\x20cancel:','\x20\x201.\x20Edit\x20','scheduleType','red','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','listParents','localeCompare','ps:pz:list','.yml','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','displayColumns','\x27\x20with\x20ID:\x20','attribute','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x20\x20Tables:\x201\x20customers\x20+\x20','Apply\x20changes\x20to\x20\x27','column','scheduleOption','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20Added\x20RT\x202.0\x20template\x20section','sourceTableValid','collectSchema','\x20\x20\x20\x20','Updating','personalizationServices','`\x20to\x20download\x20the\x20configuration\x20first','updateParent','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','/\x20and\x20','page_view','Creating','Create\x20parent\x20segment\x20\x27','ignore','YAML\x20file:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','primaryKey','/app/dw/parentSegments/','pullParentYaml','log','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','endsWith','type','sampleData','-1d','\x20kill','label','\x27\x20and\x20run\x20workflow?','Error\x20reading\x20file:\x20','addBehaviorsFile','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20--behavior\x20\x22<name>\x22','workflowId','\x20personalization\x20service','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','bold','push','✔\x20Updated\x20parent\x20segment\x20\x27','Database:\x20','column_name','/\x20directory.\x0a','\x20rows\x20','Enriched:','start','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Attribute:','Schema\x20saved\x20to\x20','Show\x20parent\x20segment\x20schema\x20(column\x20types)','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x20+\x20[','segment','\x0a⚠️\x20\x20Migrating:\x20','limit','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','rowCount','\x20Added\x20personalization\x20template\x20to\x20','displayValidateResults','Available\x20behaviors:','Updating\x20parent\x20segment\x20\x27','displayRealtimeInfo','segment:parent:validate','last_page_viewed','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Resolving\x20parent\x20segment\x20\x27','4ujlmmM','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','⚡\x20Enabled','customerGroupFile','format','attributes','valid','\x20Opening\x20','yellow','joinKey','Creating\x20parent\x20segment\x20\x27','\x20RT\x20configuration\x20is\x20valid','\x27...','interval','totalEvents','workflowAttemptId','tdx\x20ps\x20preview\x20','\x20behaviors','allValid','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Site:\x20','\x20to\x20push\x20the\x20configuration','\x27\x20is\x20up\x20to\x20date','%)\x20','trigger_event','segment:parent:create','5985208Qyauir','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','preview','timezone','SELECT\x20*\x20FROM\x20(\x0a','displayAttributesStats','\x0aNo\x20sample\x20data\x20available','/app/workflows/','Audience\x20ID:','\x0a\x20\x20]\x0a}\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','enabled','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x0aChanges\x20to\x20\x27','idStitching','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Table:\x20','message','jsonl','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','✘\x20Failed\x20to\x20rename\x20directory:\x20','Options:\x0a','\x20is\x20already\x20up\x20to\x20date','error','\x20RT-enabled\x20parent\x20segment','displaySampleData','foreignKey','json','reduce','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20\x20Note:\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','/\x20→\x20','segment:parent:pull','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20total','parentSegment','Customers:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20--attribute\x20\x22','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displayPreviewHints','Found\x20YAML\x20file:\x20','validateParentYaml','Updated','unref','✔\x20No\x20changes\x20-\x20\x27','\x0aError:','Listing\x20personalization\x20services\x20for\x20\x27','List\x20available\x20fields\x20for\x20segmentation','Analyzing\x20changes...','segment:parent:desc','\x20configured','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Listing\x20fields\x20for\x20\x27','/\x20directories\x20exist.','2060095fITABL','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20No\x20changes\x20-\x20','Available\x20attributes:','segment:parent:preview','\x20\x20\x20','green','getParentSQL','data','database','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','single','column_type','✔\x20Created\x20parent\x20segment\x20\x27','Output\x20Database:','Master\x20+\x20Attributes','dirname','displayPreviewResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x0aUsage:\x20tdx\x20ps\x20preview\x20','elapsedTimeMillis','displayBehaviorsStats','cyan','behavior','keys','enriched','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','segment:parent:fields','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Error:\x20--database\x20and\x20--table\x20are\x20required','apply','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','td_client_id','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','behavior_','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','double','darwin','20jyIKLb','behaviorsFile','\x20tdx\x20wf\x20attempt\x20','10198332dvmuuc','segment:parent:view','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Name:\x20','Coverage:','Fetching\x20parent\x20segment\x20\x27','Errors:','customerPercent','\x20section','No\x20RT-enabled\x20parent\x20segments\x20found','columns','/{name}.yml\x0a','9523276ngNVdi','parent_segment','audienceId','10811130OcJKMX','Events:','information_schema','\x0aChanges\x20to\x20apply\x20to\x20\x27','name','Error:','42657dLhMQG','setJobId','Session:','table','personalization_services','pushParentYaml','query','Created','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','getBehaviorNames','description','customers','segment:parent:push','\x20\x20Database:\x20','text','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','getParentFull','events','SQL\x20query:\x0a','output','.customers)','\x20--interval\x20','repeat','Options\x20(one\x20required):\x0a','string','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','ps:rt:validate','realtime_enabled','👥\x20','\x20\x20Columns:\x20','sort','\x20to\x20configure\x20your\x20personalization\x20service','Fetching\x20sample\x20data...','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','population','realtime','\x20\x20\x20\x20-\x20','map','varchar','coveragePercent','\x0a✔\x20Workflow\x20started','resolveParentId','\x20parent\x20segment\x20\x27','segment:parent:sql','Fetching\x20behavior\x20list...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x0a\x20\x20\x20\x20}','Validating\x20RT\x20configuration...','1095872RRFMsV','all','RT\x202.0:','\x20=\x20','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','schemaValid','yes','execute','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','errors','segment:parent:list','Columns:','replace','No\x20parent\x20segments\x20match\x20pattern:\x20','Executing\x20parent\x20segment\x20query...','Behaviors','Personalization\x20service\x20description','\x20[Job\x20ID:\x20','stats','verbose','{\x0a\x20\x20\x22database\x22:\x20\x22','segment:parent:show','toLocaleString','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','sourceTableError','Output\x20file:\x20','attributesFile','Overwrite\x20\x27','in\x20','user_id','open','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','FINISHED','list','Join:','Show\x20parent\x20segment\x20details','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'];a30_0x22a5=function(){return _0x4f77d0;};return a30_0x22a5();}export class ParentSegmentShowCommand extends BaseCommand{['name']=a30_0x4c2f14(0x24a);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0x20c);async['execute'](_0x174a20){const _0x4afbe6=a30_0x4c2f14,{options:_0x53542c,args:_0x1256d3,tdx:_0x125683}=_0x174a20,_0x37bf36=_0x1256d3[0x0]||_0x53542c['parentSegment'];if(!_0x37bf36)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x4afbe6(0x232)),0x1;_0x53542c[_0x4afbe6(0x248)]&&(console[_0x4afbe6(0x1a2)](_0x4afbe6(0x184)+_0x53542c[_0x4afbe6(0x260)]),console['error'](_0x4afbe6(0x274)+_0x37bf36));const _0x38d037=await withSpinner(_0x4afbe6(0x16d)+_0x37bf36+_0x4afbe6(0x17c),()=>_0x125683['segment']['resolveParentId'](_0x37bf36),{'verbose':_0x53542c[_0x4afbe6(0x248)]}),_0x5f4b76=_0x38d037['data'],_0x6da865=await withSpinner(_0x4afbe6(0x10a)+_0x37bf36+_0x4afbe6(0x17c),()=>_0x125683['segment'][_0x4afbe6(0x1ca)](_0x5f4b76),{'verbose':_0x53542c[_0x4afbe6(0x248)]});let _0x382314=_0x6da865[_0x4afbe6(0x1cb)];const _0xeaaf12=resolveLimit(_0x53542c[_0x4afbe6(0x162)],DEFAULT_DISPLAY_LIMIT),_0x2ce27c=/\bLIMIT\s+\d+/i['test'](_0x382314);!_0x2ce27c&&(_0x382314=_0x382314[_0x4afbe6(0x10b)]()[_0x4afbe6(0x241)](/;+$/,''),_0x382314=_0x4afbe6(0x18e)+_0x382314+_0x4afbe6(0x170)+_0xeaaf12);_0x53542c[_0x4afbe6(0x248)]&&console[_0x4afbe6(0x1a2)](_0x4afbe6(0x216)+_0x382314);const _0x34ad01=await withProgressSpinner(_0x4afbe6(0x243),async _0x38cc29=>{const _0x1aec9f=_0x4afbe6,_0x56e768=await _0x125683[_0x1aec9f(0x20a)][_0x1aec9f(0x23c)](_0x382314,{'catalog':'td','schema':_0x1aec9f(0x200),'onJobId':_0x45ff40=>{const _0x5b3a77=_0x1aec9f;_0x38cc29[_0x5b3a77(0x205)](_0x45ff40);}});return _0x56e768;},{'verbose':_0x53542c[_0x4afbe6(0x248)]}),_0x5e2093=_0x34ad01[_0x4afbe6(0x1cb)],_0x339082=_0x5e2093['jobId']?_0x4afbe6(0x246)+_0x5e2093[_0x4afbe6(0x10d)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x5e2093[_0x4afbe6(0x247)][_0x4afbe6(0xfa)][_0x4afbe6(0x24b)]()+_0x4afbe6(0x157)+(_0x4afbe6(0x251)+formatElapsed(_0x5e2093[_0x4afbe6(0x247)][_0x4afbe6(0x1d8)])+_0x339082)),await handleQueryOutput(_0x5e2093,_0x53542c),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x4c2f14(0x202)]='ps:rt:list';['description']=a30_0x4c2f14(0x15e);async['execute'](_0x24aa5f){const _0x3a339c=a30_0x4c2f14,{options:_0xc8334e,args:_0x2e8296,tdx:_0x42fbe8}=_0x24aa5f,_0x4a7b48=_0x2e8296[0x0],_0x456579=await withSpinner(_0x4a7b48?_0x3a339c(0x25c)+_0x4a7b48+_0x3a339c(0x17c):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x42fbe8['realtime'][_0x3a339c(0x257)](),{'verbose':_0xc8334e['verbose']});let _0x31be6f=_0x456579[_0x3a339c(0x1cb)]['filter'](_0x57d671=>_0x57d671[_0x3a339c(0x220)]);if(_0x4a7b48){const _0x2d7273=_0x4a7b48[_0x3a339c(0x241)](/[.+^${}()|[\]\\]/g,_0x3a339c(0x279))['replace'](/\*/g,'.*')[_0x3a339c(0x241)](/\?/g,'.'),_0x3f698d=new RegExp('^'+_0x2d7273+'$','i');_0x31be6f=_0x31be6f[_0x3a339c(0x262)](_0x5917ee=>_0x3f698d['test'](_0x5917ee[_0x3a339c(0x202)]));}_0x31be6f[_0x3a339c(0x223)]((_0x3ef814,_0x12da5b)=>_0x3ef814[_0x3a339c(0x202)][_0x3a339c(0x120)](_0x12da5b['name'])),console[_0x3a339c(0x1a2)](_0x3a339c(0x26d)+_0x31be6f[_0x3a339c(0x25e)]+_0x3a339c(0x1a3)+(_0x31be6f[_0x3a339c(0x25e)]!==0x1?'s':''));const _0x516cac=_0x30a5dc=>{const _0x38712b=_0x3a339c;return getConsoleNextUrl(_0xc8334e['site'],_0x38712b(0x13e)+_0x30a5dc);};if(_0xc8334e[_0x3a339c(0x174)]===_0x3a339c(0x1a6)||_0xc8334e[_0x3a339c(0x174)]===_0x3a339c(0x19d)){const _0x32479c=_0x31be6f['map'](_0x57d980=>({..._0x57d980,'url':_0x516cac(_0x57d980['id'])}));await handleSDKOutput(_0x32479c,_0xc8334e);}else{if(_0x31be6f[_0x3a339c(0x25e)]===0x0)console[_0x3a339c(0x140)](_0x3a339c(0x1f8));else for(const _0x12f857 of _0x31be6f){const _0x16c371=_0x12f857[_0x3a339c(0x227)]?a30_0x29defe[_0x3a339c(0x277)]('\x20('+formatRows(_0x12f857[_0x3a339c(0x227)])+')'):'',_0x43cdc0=hyperlink(_0x12f857[_0x3a339c(0x202)],_0x516cac(_0x12f857['id']));console[_0x3a339c(0x140)]('⚡\x20'+_0x43cdc0+_0x16c371);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x21f);[a30_0x4c2f14(0x20e)]=a30_0x4c2f14(0x213);async['execute'](_0x4bc0bf){const _0x28092d=a30_0x4c2f14,{options:_0x107f50,args:_0x50aeac,tdx:_0x24bc3a}=_0x4bc0bf,_0x6d644f=_0x50aeac[0x0]||_0x107f50['parentSegment'];if(!_0x6d644f)return showParentSegmentNotSetError(_0x28092d(0x142)+_0x28092d(0x25d)),0x1;const _0x4dd950=resolveYamlFile(_0x6d644f);if(!existsSync(_0x4dd950))return showFileNotFoundError(_0x4dd950,_0x6d644f),0x1;let _0x2fbd92;try{_0x2fbd92=readFileSync(_0x4dd950,_0x28092d(0x275));}catch(_0x2f8f71){const _0x2c5fb0=_0x2f8f71 instanceof Error?_0x2f8f71[_0x28092d(0x19c)]:String(_0x2f8f71);return console[_0x28092d(0x1a2)](_0x28092d(0x14a)+_0x2c5fb0),0x1;}const _0xe83b31=createCommandSpinner(a30_0x29defe[_0x28092d(0x277)](_0x28092d(0x234)),{'verbose':_0x107f50['verbose']});_0xe83b31[_0x28092d(0x159)]();const _0x36630a={'realtime':!![],'onProgress':_0x4bad49=>{const _0x37980d=_0x28092d;_0xe83b31[_0x37980d(0x212)]=formatProgressMessage(_0x4bad49);}};let _0x12a29f;try{_0x12a29f=await _0x24bc3a[_0x28092d(0x160)]['validateParentYaml'](_0x2fbd92,_0x36630a),_0xe83b31['stop']();}catch(_0x59f378){_0xe83b31[_0x28092d(0x111)]();throw _0x59f378;}console[_0x28092d(0x1a2)]('\x0a'+a30_0x29defe[_0x28092d(0x151)](_0x28092d(0x265))+'\x20'+_0x12a29f[_0x28092d(0x202)]),console[_0x28092d(0x1a2)]('═'[_0x28092d(0x21a)](0x3c)),displayRealtimeValidation(_0x12a29f),console['error']('─'['repeat'](0x3c));if(_0x12a29f['errors'][_0x28092d(0x25e)]>0x0){console[_0x28092d(0x1a2)]('\x0a'+a30_0x29defe['red'](_0x28092d(0x1f5)));for(const _0x1ae2ac of _0x12a29f[_0x28092d(0x23e)]){console[_0x28092d(0x1a2)]('\x20\x20'+a30_0x29defe['red']('•')+'\x20'+_0x1ae2ac);}}return _0x12a29f[_0x28092d(0x182)]&&console[_0x28092d(0x1a2)]('\x0a'+a30_0x29defe[_0x28092d(0x1c9)]('✔')+_0x28092d(0x17b)),_0x12a29f[_0x28092d(0x182)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x121);['description']=a30_0x4c2f14(0x102);async['execute'](_0x5d4232){const _0x4116ac=a30_0x4c2f14,{options:_0x1b72c0,args:_0x5af53d,tdx:_0x438e7b}=_0x5d4232,_0x5bb234=_0x5af53d[0x0]||_0x1b72c0['parentSegment'];if(!_0x5bb234)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x4bcc66=await withSpinner(_0x4116ac(0x16d)+_0x5bb234+'\x27...',()=>_0x438e7b[_0x4116ac(0x160)]['resolveParentId'](_0x5bb234),{'verbose':_0x1b72c0[_0x4116ac(0x248)]}),_0x215925=_0x4bcc66[_0x4116ac(0x1cb)],_0x2681fb=await withSpinner(_0x4116ac(0x1bb)+_0x5bb234+'\x27...',()=>_0x438e7b['personalization'][_0x4116ac(0x257)](_0x215925),{'verbose':_0x1b72c0['verbose']}),_0x30b89c=_0x2681fb['data'];console[_0x4116ac(0x1a2)](_0x4116ac(0x26d)+_0x30b89c[_0x4116ac(0x25e)]+_0x4116ac(0x14f)+(_0x30b89c[_0x4116ac(0x25e)]!==0x1?'s':''));if(_0x1b72c0[_0x4116ac(0x174)]===_0x4116ac(0x1a6)||_0x1b72c0[_0x4116ac(0x174)]==='jsonl')await handleSDKOutput(_0x30b89c,_0x1b72c0);else{if(_0x30b89c[_0x4116ac(0x25e)]===0x0)console[_0x4116ac(0x140)]('No\x20personalization\x20services\x20configured'),console['error'](a30_0x29defe[_0x4116ac(0x1da)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x2c3347 of _0x30b89c){const _0x34606d=_0x2c3347['sections']?.[_0x4116ac(0x25e)]||0x0,_0x32f595=_0x2c3347['trigger_event']?a30_0x29defe['dim']('\x20trigger='+_0x2c3347[_0x4116ac(0x188)]):'',_0xde0f80=a30_0x29defe['dim']('\x20('+_0x34606d+_0x4116ac(0x1f7)+(_0x34606d!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x2c3347[_0x4116ac(0x202)]+_0x32f595+_0xde0f80),_0x2c3347[_0x4116ac(0x20e)]&&console['log']('\x20\x20\x20\x20'+a30_0x29defe[_0x4116ac(0x277)](_0x2c3347[_0x4116ac(0x20e)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x4c2f14(0x202)]=a30_0x4c2f14(0x266);['description']=a30_0x4c2f14(0x127);async[a30_0x4c2f14(0x23c)](_0x8a9c4a){const _0x2926f1=a30_0x4c2f14,{options:_0x728b,args:_0x2c2de6}=_0x8a9c4a,_0x2f8b03=_0x2c2de6[0x0]||_0x728b[_0x2926f1(0x1af)];if(!_0x2f8b03)return showParentSegmentNotSetError(_0x2926f1(0x21e)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x2f58e8=resolveYamlFile(_0x2f8b03);if(!existsSync(_0x2f58e8))return showFileNotFoundError(_0x2f58e8,_0x2f8b03),0x1;let _0x57852a;try{_0x57852a=readFileSync(_0x2f58e8,_0x2926f1(0x275));}catch(_0x2bddb4){const _0x87cde4=_0x2bddb4 instanceof Error?_0x2bddb4[_0x2926f1(0x19c)]:String(_0x2bddb4);return console[_0x2926f1(0x1a2)]('Error\x20reading\x20file:\x20'+_0x87cde4),0x1;}let _0x1e476f;try{_0x1e476f=parseDef(_0x57852a);}catch(_0x4a32d2){const _0x5561ee=_0x4a32d2 instanceof Error?_0x4a32d2[_0x2926f1(0x19c)]:String(_0x4a32d2);return console[_0x2926f1(0x1a2)](a30_0x29defe[_0x2926f1(0x11d)](_0x2926f1(0x107)+_0x5561ee)),0x1;}if(_0x1e476f[_0x2926f1(0x208)]&&_0x1e476f['personalization_services'][_0x2926f1(0x25e)]>0x0)return console['error'](a30_0x29defe['yellow'](_0x2926f1(0x199)+_0x2f58e8)),console[_0x2926f1(0x1a2)](a30_0x29defe['dim'](_0x2926f1(0x1c8)+_0x1e476f[_0x2926f1(0x208)]['length']+'\x20service(s)\x20configured')),0x1;!_0x1e476f[_0x2926f1(0x228)]&&(_0x1e476f['realtime']={'events':[{'name':_0x2926f1(0x137),'source_table':'<database>.<table>'}],'attributes':[{'name':_0x2926f1(0x16b),'type':_0x2926f1(0x1cf)}],'id_stitching':{'primary_key':_0x1e476f[_0x2926f1(0x261)]['table']===_0x2926f1(0x20f)?_0x2926f1(0x1e5):_0x2926f1(0x252)}});_0x1e476f['personalization_services']=[{'name':'My\x20Service','description':_0x2926f1(0x245),'trigger_event':'page_view','sections':[{'name':'Default','criteria':_0x2926f1(0x112),'attributes':[_0x2926f1(0x16b)]}]}];const _0xa5d0c0=serializeDef(_0x1e476f);return writeFileSync(_0x2f58e8,_0xa5d0c0,_0x2926f1(0x275)),console[_0x2926f1(0x1a2)](a30_0x29defe[_0x2926f1(0x1c9)]('✔')+_0x2926f1(0x165)+a30_0x29defe[_0x2926f1(0x1da)](_0x2f58e8)),(!_0x1e476f[_0x2926f1(0x228)]||_0x57852a['indexOf']('realtime:')===-0x1)&&console[_0x2926f1(0x1a2)](a30_0x29defe['green']('✔')+_0x2926f1(0x12d)),console[_0x2926f1(0x1a2)]('\x0a'+a30_0x29defe['dim']('Next\x20steps:')),console[_0x2926f1(0x1a2)](_0x2926f1(0x11b)+_0x2f58e8+_0x2926f1(0x224)),console[_0x2926f1(0x1a2)]('\x20\x202.\x20Run\x20'+a30_0x29defe['dim']('tdx\x20ps\x20push\x20'+_0x2f8b03)+_0x2926f1(0x185)),0x0;}}
|
|
1
|
+
const a30_0x1c117e=a30_0x30b0;function a30_0x3340(){const _0x467222=['tdx\x20ps\x20preview\x20','start','List\x20available\x20fields\x20for\x20segmentation','\x20parent\x20segment\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Fetching\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','✔\x20Query\x20completed:\x20Processed\x20','segment:parent:push','\x5c$&','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','jobId','Listing\x20parent\x20segments\x20matching\x20\x27','segment:parent:list','verbose','\x20Added\x20personalization\x20template\x20to\x20','\x20kill','70288sTycLR','/\x20→\x20','jsonl','stop','To\x20view\x20sample\x20data:','listFields','formatSchemaJson','behaviorsFile','{\x0a\x20\x20\x22database\x22:\x20\x22','toLowerCase','join','filter','personalization_services','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','SQL\x20query:\x0a','schemaError','indexOf','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','No\x20parent\x20segments\x20found','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','parent_segment','Rows:','segment:parent:sql','trim','json','table','Coverage:','345834gwTuYc','number','string','foreignKey','Created','1cfHsWx','label','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Show\x20parent\x20segment\x20details','segment:parent:validate','length','ps:pz:init','valid','459490VbbVNH','customerGroupFile','Creating\x20parent\x20segment\x20\x27','/sessions/','\x0a⚠️\x20\x20Migrating:\x20','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','Audience\x20ID:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','sourceTableError','displayMasterInfo','\x20--attribute\x20\x22','personalizationServices','errors','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','setJobId','attributes','.customers)','\x20tdx\x20wf\x20attempt\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Name:\x20','Personalization:','\x20\x20Note:\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Behavior:','displaySummary','ps:pz:list','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','/app/workflows/','getBehaviorNames','FINISHED','/\x20and\x20','124010JVwLDD','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','No\x20RT-enabled\x20parent\x20segments\x20found','validateParentYaml','page_view','collectSchema','Error:\x20--behavior\x20requires\x20a\x20name\x0a','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','coveragePercent','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','Creating','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x22\x20}','`\x20to\x20download\x20the\x20configuration\x20first','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','sampleData','Error\x20reading\x20file:\x20','personalization','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20\x20\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','realtime_enabled','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','log','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Site:\x20','sections','66UZoeCg','✔\x20Created\x20parent\x20segment\x20\x27','displayPreviewResults','\x0aUsage:\x20tdx\x20ps\x20preview\x20','behaviors','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Output\x20file:\x20','\x20RT-enabled\x20parent\x20segment','customerPercent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','✔\x20Found\x20','\x20=\x20','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','events','green','utf-8','text','/app/dw/parentSegments/','ignore','Analyzing\x20changes...','Overwrite\x20\x27','\x20--interval\x20','\x27\x20with\x20ID:\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20Columns:\x20','✔\x20No\x20changes\x20-\x20\x27','message','true','List\x20parent\x20segments','allValid','enriched','customersWithEvents','\x20[Job\x20ID:\x20','Status:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Listing\x20personalization\x20services\x20for\x20\x27','-1d','\x20service(s)\x20configured','\x27\x20and\x20run\x20workflow?','Join\x20on:','map','apply','Options:\x0a','query','\x20\x20Tables:\x201\x20customers\x20+\x20','segment:parent:desc','segment:parent:show','\x20Context\x20set:\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','double','Parent\x20segment:\x20','customers','\x20--behavior\x20\x22','\x0a\x20\x20]\x0a}\x0a','test','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Fetching\x20customers\x20schema...','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','segment:parent:update','getParentSQL','RT\x202.0:','repeat','description','Updating\x20parent\x20segment\x20\x27','Next\x20steps:','Fetching\x20sample\x20data...','\x20configured','workflowId','in\x20','open','dim','✘\x20Failed\x20to\x20rename\x20directory:\x20','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','session','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','\x20service','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','win32','/\x20directory.\x0a','resolveParentId','Resolving\x20parent\x20segment\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Output\x20Database:','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Attribute:','198888iuyIsN','attribute','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','isDirectory','workflowSessionId','pushParentYaml','812791wOENEd','columns','sourceTableValid','localeCompare','No\x20parent\x20segments\x20match\x20pattern:\x20','segment:parent:run','addBehaviorsFile','Source:','segment:parent:preview','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Behaviors','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Fetching\x20current\x20configuration\x20for\x20\x27','user_id','bold','Error:','152fJzoet','scheduleType','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','toFixed','<database>.<table>','push','displayAttributesStats','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Aborted.','Error\x20parsing\x20YAML:\x20','column_name','column_type','%)\x20','behavior_','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','limit','error','Get\x20SQL\x20query\x20for\x20parent\x20segment','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20Opening\x20','schemaValid','\x0aChanges\x20to\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','To\x20cancel:','keys','match','Options:','RT\x202.0\x20Validate:','\x0aNew\x20parent\x20segment\x20\x27','execute','timezone','Master:','No\x20personalization\x20services\x20configured','behavior','\x20\x202.\x20Run\x20','Columns:','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x20Configuration\x20is\x20valid','displayPreviewHints','\x20behaviors','Found\x20YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','yellow','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','information_schema','Attempt:','primaryKey','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','displayRealtimeInfo','\x27...','\x20trigger=','Create\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','segment','attributesFile','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Table:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','cyan','Database:\x20','toLocaleString','Default','Personalization\x20service\x20description','\x0a\x20\x20\x20\x20]','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','ps:rt:validate','type','⚡\x20Not\x20enabled','single','Fetching\x20SQL\x20for\x20\x27','red','rowCount','Preview:','dirname','replace','✔\x20Updated\x20parent\x20segment\x20\x27','sort','/attempt/','matchedCount','Session:','getParentFull','Schema\x20saved\x20to\x20','\x20--behavior\x20\x22<name>\x22','customerGroup','\x20\x20\x20\x20','Available\x20behaviors:','master','\x0aChanges\x20to\x20apply\x20to\x20\x27','web','output','ID\x20Stitching:','data','name','Join:','Events:','Error:\x20Parent\x20segment\x20name\x20is\x20required','processedRows','SELECT\x20*\x20FROM\x20(\x0a','\x20--enriched','runParent','/{name}.yml\x0a','elapsedTimeMillis','ps:rt:list','population','\x20is\x20already\x20up\x20to\x20date','\x20total','addAttributes','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Errors:','all','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','interval','site','17136SMHPTt','displaySampleData','Updated','yes','realtime:','preview','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x0a⚠️\x20\x20Both\x20','database','run','\x20+\x20[','displayBehaviorsStats','\x0aError:','addAttributesFile','⚡\x20Enabled','Updating','displayColumns','\x20rows\x20','stitchingKeys','.yml','\x20\x20Database:\x20','totalEvents','last_page_viewed','listParents','idStitching','segment:parent:pull','tdx\x20ps\x20push\x20','.yaml','\x20section','Validating\x20configuration...','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Apply\x20changes\x20to\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','YAML\x20file:\x20','18KAsFGb','segment:parent:create','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','parentSegment','unref','td_client_id','format','👥\x20','Listing\x20parent\x20segments...','Fetching\x20behavior\x20list...','\x20RT\x20configuration\x20is\x20valid','\x0aNo\x20sample\x20data\x20available','audienceId','scheduleOption','use','realtime','Attributes:','column','workflowAttemptId','joinKey','getOutputDatabaseName','\x0a\x20\x20\x20\x20}','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','endsWith','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20Added\x20RT\x202.0\x20template\x20section','previewParentYaml','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','addBehaviors'];a30_0x3340=function(){return _0x467222;};return a30_0x3340();}(function(_0x5daf52,_0x57a627){const _0xbd2ef5=a30_0x30b0,_0x267b5d=_0x5daf52();while(!![]){try{const _0x44f6ef=parseInt(_0xbd2ef5(0x29d))/0x1*(-parseInt(_0xbd2ef5(0x298))/0x2)+parseInt(_0xbd2ef5(0x24d))/0x3*(parseInt(_0xbd2ef5(0x27c))/0x4)+parseInt(_0xbd2ef5(0x132))/0x5+parseInt(_0xbd2ef5(0x1a4))/0x6+-parseInt(_0xbd2ef5(0x1aa))/0x7+parseInt(_0xbd2ef5(0x1ba))/0x8*(-parseInt(_0xbd2ef5(0x22b))/0x9)+-parseInt(_0xbd2ef5(0x2a5))/0xa*(-parseInt(_0xbd2ef5(0x14d))/0xb);if(_0x44f6ef===_0x57a627)break;else _0x267b5d['push'](_0x267b5d['shift']());}catch(_0xd2c34e){_0x267b5d['push'](_0x267b5d['shift']());}}}(a30_0x3340,0x1bcce));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x7edf6c from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';function a30_0x30b0(_0x5c2052,_0x490405){_0x5c2052=_0x5c2052-0x11c;const _0x334017=a30_0x3340();let _0x30b021=_0x334017[_0x5c2052];return _0x30b021;}import a30_0x2ac4a6 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a30_0x1c117e(0x291);function openBrowser(_0x29dbe6){const _0x1678c5=a30_0x1c117e,_0x20f164=process['platform'],_0x149a92=_0x20f164==='darwin'?_0x1678c5(0x193):_0x20f164===_0x1678c5(0x19b)?_0x1678c5(0x26c):'xdg-open';spawn(_0x149a92,[_0x29dbe6],{'detached':!![],'stdio':_0x1678c5(0x15f)})[_0x1678c5(0x251)]();}function migrateLegacyDirectory(){const _0x3f0b41=a30_0x1c117e;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3b29f9=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3b29f9[_0x3f0b41(0x1a7)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3f0b41(0x1ca)](a30_0x2ac4a6[_0x3f0b41(0x1e4)](_0x3f0b41(0x232)+LEGACY_PARENT_SEGMENT_DIR+_0x3f0b41(0x131)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x3f0b41(0x1ca)](a30_0x2ac4a6[_0x3f0b41(0x194)](_0x3f0b41(0x123)+LEGACY_PARENT_SEGMENT_DIR+_0x3f0b41(0x19c))),![];console[_0x3f0b41(0x1ca)](a30_0x2ac4a6['yellow'](_0x3f0b41(0x2a9)+LEGACY_PARENT_SEGMENT_DIR+_0x3f0b41(0x27d)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x2ac4a6[_0x3f0b41(0x15b)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x32bf1b){const _0x5f3fbd=_0x32bf1b instanceof Error?_0x32bf1b[_0x3f0b41(0x168)]:String(_0x32bf1b);return console[_0x3f0b41(0x1ca)](a30_0x2ac4a6[_0x3f0b41(0x200)](_0x3f0b41(0x195)+_0x5f3fbd+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x1c117e(0x234)](_0x4ff9a1){const _0x1f4816=a30_0x1c117e;return migrateLegacyDirectory(),super[_0x1f4816(0x234)](_0x4ff9a1);}}function resolveYamlFile(_0x598880){const _0x586d6c=a30_0x1c117e;if(_0x598880[_0x586d6c(0x264)]('.yml')||_0x598880[_0x586d6c(0x264)](_0x586d6c(0x246)))return _0x598880;return a30_0x7edf6c[_0x586d6c(0x286)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x598880)+_0x586d6c(0x23e));}function formatProgressMessage(_0x202183){const _0xab719a=a30_0x1c117e,_0x838882=_0x202183[_0xab719a(0x1d3)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x838882){const [,_0x159d44,_0x3dca4b,_0x21d1e0='']=_0x838882;return a30_0x2ac4a6[_0xab719a(0x194)](_0x159d44+':')+'\x20'+_0x3dca4b+a30_0x2ac4a6['dim'](_0x21d1e0);}return a30_0x2ac4a6[_0xab719a(0x194)](_0x202183);}function showFileNotFoundError(_0x151a98,_0xd1e482){const _0x149f58=a30_0x1c117e;console[_0x149f58(0x1ca)](a30_0x2ac4a6[_0x149f58(0x200)]('Error:\x20File\x20not\x20found:\x20'+_0x151a98+'\x0a')),console[_0x149f58(0x1ca)](a30_0x2ac4a6[_0x149f58(0x1f4)](_0x149f58(0x124)+_0xd1e482+_0x149f58(0x13f)));}function displayRealtimeValidation(_0x2ba4cf){const _0x3ae889=a30_0x1c117e;if(!_0x2ba4cf[_0x3ae889(0x25c)])return;const _0x5cb52d=_0x2ba4cf[_0x3ae889(0x25c)],_0x2d18c9=_0x5cb52d['enabled']?a30_0x2ac4a6['green'](_0x3ae889(0x239)):a30_0x2ac4a6[_0x3ae889(0x1e4)](_0x3ae889(0x1fd));console[_0x3ae889(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x3ae889(0x194)](_0x3ae889(0x18a))+'\x20'+_0x2d18c9);if(_0x5cb52d['events']&&_0x5cb52d[_0x3ae889(0x15a)][_0x3ae889(0x2a2)]>0x0){console[_0x3ae889(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x3ae889(0x194)](_0x3ae889(0x218))+'\x20'+_0x5cb52d['events'][_0x3ae889(0x2a2)]+_0x3ae889(0x190));for(const _0xf52d60 of _0x5cb52d['events']){const _0x46e0df=_0xf52d60[_0x3ae889(0x1ac)]===![]?a30_0x2ac4a6['red']('✘'):a30_0x2ac4a6['green']('✔');console['error'](_0x3ae889(0x20e)+_0x46e0df+'\x20'+_0xf52d60[_0x3ae889(0x216)]),_0xf52d60['sourceTableError']&&console['error']('\x20\x20\x20\x20\x20\x20'+a30_0x2ac4a6[_0x3ae889(0x200)](_0xf52d60[_0x3ae889(0x2ad)]));}}if(_0x5cb52d[_0x3ae889(0x120)]&&_0x5cb52d[_0x3ae889(0x120)][_0x3ae889(0x2a2)]>0x0){console[_0x3ae889(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x3ae889(0x194)](_0x3ae889(0x25d))+'\x20'+_0x5cb52d[_0x3ae889(0x120)][_0x3ae889(0x2a2)]+_0x3ae889(0x190));for(const _0x24996d of _0x5cb52d['attributes']){const _0x4dab2e=_0x24996d[_0x3ae889(0x2a4)]?a30_0x2ac4a6[_0x3ae889(0x15b)]('✔'):a30_0x2ac4a6[_0x3ae889(0x200)]('✘');console[_0x3ae889(0x1ca)](_0x3ae889(0x20e)+_0x4dab2e+'\x20'+_0x24996d[_0x3ae889(0x216)]+'\x20'+a30_0x2ac4a6[_0x3ae889(0x194)]('('+_0x24996d[_0x3ae889(0x1fc)]+')'));}}if(_0x5cb52d['idStitching']){const _0x2b079a=_0x5cb52d[_0x3ae889(0x243)]['stitchingKeys']?.['length']?_0x3ae889(0x235)+_0x5cb52d[_0x3ae889(0x243)][_0x3ae889(0x23d)][_0x3ae889(0x286)](',\x20')+']':'';console['error']('\x20\x20'+a30_0x2ac4a6[_0x3ae889(0x194)](_0x3ae889(0x214))+'\x20'+_0x5cb52d[_0x3ae889(0x243)][_0x3ae889(0x1e8)]+_0x2b079a);}if(_0x5cb52d['personalizationServices']&&_0x5cb52d[_0x3ae889(0x11c)]['length']>0x0){console[_0x3ae889(0x1ca)]('\x20\x20'+a30_0x2ac4a6['dim'](_0x3ae889(0x126))+'\x20'+_0x5cb52d[_0x3ae889(0x11c)][_0x3ae889(0x2a2)]+_0x3ae889(0x199)+(_0x5cb52d['personalizationServices'][_0x3ae889(0x2a2)]!==0x1?'s':''));for(const _0x192c07 of _0x5cb52d[_0x3ae889(0x11c)]){console[_0x3ae889(0x1ca)]('\x20\x20\x20\x20-\x20'+_0x192c07['name']);}}}function showParentSegmentNotSetError(_0x7b4da4){const _0x468364=a30_0x1c117e;console[_0x468364(0x1ca)](a30_0x2ac4a6[_0x468364(0x1e4)](_0x468364(0x139))),console[_0x468364(0x1ca)](_0x7b4da4);}export class ParentSegmentListCommand extends BaseCommand{['name']=a30_0x1c117e(0x278);['description']=a30_0x1c117e(0x16a);async[a30_0x1c117e(0x1d7)](_0x36b21e){const _0x1451de=a30_0x1c117e,{options:_0x129da9,args:_0x352daf,tdx:_0x3e81d0}=_0x36b21e,_0x279f21=_0x352daf[0x0];_0x129da9[_0x1451de(0x279)]&&(console[_0x1451de(0x1ca)](_0x1451de(0x14b)+_0x129da9[_0x1451de(0x22a)]),_0x279f21&&console[_0x1451de(0x1ca)]('Pattern:\x20'+_0x279f21));const _0x4f5314=await withSpinner(_0x279f21?_0x1451de(0x277)+_0x279f21+'\x27...':_0x1451de(0x255),()=>_0x3e81d0[_0x1451de(0x1ef)][_0x1451de(0x242)](),{'verbose':_0x129da9[_0x1451de(0x279)]});let _0x4d4895=_0x4f5314[_0x1451de(0x215)];if(_0x279f21){const _0xbacc7c=_0x279f21[_0x1451de(0x204)](/[.+^${}()|[\]\\]/g,_0x1451de(0x274))[_0x1451de(0x204)](/\*/g,'.*')[_0x1451de(0x204)](/\?/g,'.'),_0x2a7bd5=new RegExp('^'+_0xbacc7c+'$','i');_0x4d4895=_0x4d4895['filter'](_0x340df1=>_0x2a7bd5[_0x1451de(0x184)](_0x340df1['attributes'][_0x1451de(0x216)]));}_0x4d4895[_0x1451de(0x206)]((_0x3ffc7c,_0x291655)=>_0x3ffc7c[_0x1451de(0x120)][_0x1451de(0x216)][_0x1451de(0x1ad)](_0x291655[_0x1451de(0x120)][_0x1451de(0x216)])),console['error'](_0x1451de(0x157)+_0x4d4895['length']+'\x20parent\x20segment'+(_0x4d4895[_0x1451de(0x2a2)]!==0x1?'s':''));const _0x5a2cde=_0x3da991=>{const _0x539bf8=_0x1451de;return getConsoleNextUrl(_0x129da9[_0x539bf8(0x22a)],_0x539bf8(0x15e)+_0x3da991);};if(_0x129da9[_0x1451de(0x253)]===_0x1451de(0x295)||_0x129da9[_0x1451de(0x253)]===_0x1451de(0x27e)){const _0x5d19fd=_0x4d4895[_0x1451de(0x176)](_0x5e77d1=>({..._0x5e77d1,'url':_0x5a2cde(_0x5e77d1['id'])}));await handleSDKOutput(_0x5d19fd,_0x129da9);}else{if(_0x4d4895[_0x1451de(0x2a2)]===0x0)_0x279f21?console[_0x1451de(0x149)](_0x1451de(0x1ae)+_0x279f21):console[_0x1451de(0x149)](_0x1451de(0x28f));else for(const _0xf6251e of _0x4d4895){const _0x29778c=_0xf6251e[_0x1451de(0x120)]['population']?a30_0x2ac4a6['dim']('\x20('+formatRows(_0xf6251e[_0x1451de(0x120)][_0x1451de(0x221)])+')'):'',_0x28f791=hyperlink(_0xf6251e[_0x1451de(0x120)][_0x1451de(0x216)],_0x5a2cde(_0xf6251e['id']));console[_0x1451de(0x149)](_0x1451de(0x254)+_0x28f791+_0x29778c);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x24e);[a30_0x1c117e(0x18c)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a30_0x1c117e(0x1d7)](_0x1b5077){const _0x50dfa7=a30_0x1c117e,{options:_0x3c6db0,args:_0x2d91de,tdx:_0x508e60}=_0x1b5077;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x50dfa7(0x1f1)+_0x50dfa7(0x185));const _0x424293=_0x3c6db0;if(_0x2d91de[_0x50dfa7(0x2a2)]===0x0)return console[_0x50dfa7(0x1ca)](a30_0x2ac4a6['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x50dfa7(0x1ca)](_0x50dfa7(0x24b)),0x1;const _0x5c8457=_0x2d91de[0x0];if(!_0x424293[_0x50dfa7(0x233)]||!_0x424293['table'])return console[_0x50dfa7(0x1ca)](_0x50dfa7(0x1f3)),console[_0x50dfa7(0x1ca)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x424293[_0x50dfa7(0x279)]&&(console['error'](_0x50dfa7(0x14b)+_0x424293['site']),console[_0x50dfa7(0x1ca)](_0x50dfa7(0x125)+_0x5c8457),console[_0x50dfa7(0x1ca)](_0x50dfa7(0x1f5)+_0x424293[_0x50dfa7(0x233)]),console[_0x50dfa7(0x1ca)](_0x50dfa7(0x1f2)+_0x424293[_0x50dfa7(0x296)]));const _0x13a2ee=await loadJSONFromOptions(_0x424293[_0x50dfa7(0x120)],_0x424293[_0x50dfa7(0x1f0)]),_0x2a71b7=await loadJSONFromOptions(_0x424293[_0x50dfa7(0x151)],_0x424293[_0x50dfa7(0x283)]),_0x6f25be=await loadJSONFromOptions(_0x424293[_0x50dfa7(0x20d)],_0x424293[_0x50dfa7(0x2a6)]),_0x32870b={'name':_0x5c8457,'description':_0x424293[_0x50dfa7(0x18c)],'scheduleType':_0x424293['scheduleType'],'scheduleOption':_0x424293[_0x50dfa7(0x25a)],'timezone':_0x424293[_0x50dfa7(0x1d8)],'master':{'parentDatabaseName':_0x424293[_0x50dfa7(0x233)],'parentTableName':_0x424293[_0x50dfa7(0x296)]},'attributes':_0x13a2ee,'behaviors':_0x2a71b7,'customerGroup':_0x6f25be},_0x4740e2=await withSpinner(_0x50dfa7(0x2a7)+_0x5c8457+_0x50dfa7(0x1eb),()=>_0x508e60['segment']['createParent'](_0x32870b),{'verbose':_0x3c6db0[_0x50dfa7(0x279)]}),_0x559047=_0x4740e2[_0x50dfa7(0x215)];return console[_0x50dfa7(0x1ca)](_0x50dfa7(0x14e)+_0x559047[_0x50dfa7(0x216)]+_0x50dfa7(0x163)+_0x559047['id']),await handleSDKOutput([_0x559047],_0x3c6db0),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x188);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x269);async[a30_0x1c117e(0x1d7)](_0xbbb8eb){const _0x5e0184=a30_0x1c117e,{options:_0x5e1b47,args:_0x59070c,tdx:_0x3cce7b}=_0xbbb8eb;console[_0x5e0184(0x1ca)](_0x5e0184(0x290)+_0x5e0184(0x1f1)+_0x5e0184(0x185));const _0x5e4aad=_0x5e1b47;if(_0x59070c['length']===0x0)return console[_0x5e0184(0x1ca)](a30_0x2ac4a6[_0x5e0184(0x200)](_0x5e0184(0x219))),console[_0x5e0184(0x1ca)](_0x5e0184(0x1a6)),0x1;const _0x30ae2d=_0x59070c[0x0];_0x5e4aad[_0x5e0184(0x279)]&&(console[_0x5e0184(0x1ca)](_0x5e0184(0x14b)+_0x5e4aad[_0x5e0184(0x22a)]),console['error']('Parent\x20segment:\x20'+_0x30ae2d));const _0x88b050=await withSpinner(_0x5e0184(0x1b6)+_0x30ae2d+_0x5e0184(0x1eb),()=>_0x3cce7b[_0x5e0184(0x1ef)][_0x5e0184(0x20a)](_0x30ae2d),{'verbose':_0x5e4aad['verbose']}),_0x48fae8=_0x88b050[_0x5e0184(0x215)],_0x25981a=await loadJSONFromOptions(_0x5e4aad[_0x5e0184(0x224)],_0x5e4aad[_0x5e0184(0x238)]),_0x2ca58b=await loadJSONFromOptions(_0x5e4aad[_0x5e0184(0x26a)],_0x5e4aad[_0x5e0184(0x1b0)]),_0x4cd269={'name':_0x48fae8[_0x5e0184(0x216)],'description':_0x5e4aad[_0x5e0184(0x18c)]!==undefined?_0x5e4aad[_0x5e0184(0x18c)]:_0x48fae8[_0x5e0184(0x18c)],'scheduleType':_0x5e4aad[_0x5e0184(0x1bb)]!==undefined?_0x5e4aad[_0x5e0184(0x1bb)]:_0x48fae8[_0x5e0184(0x1bb)],'scheduleOption':_0x5e4aad[_0x5e0184(0x25a)]!==undefined?_0x5e4aad[_0x5e0184(0x25a)]:_0x48fae8[_0x5e0184(0x25a)],'timezone':_0x5e4aad[_0x5e0184(0x1d8)]!==undefined?_0x5e4aad[_0x5e0184(0x1d8)]:_0x48fae8[_0x5e0184(0x1d8)],'master':_0x48fae8[_0x5e0184(0x210)],'attributes':_0x25981a?[..._0x48fae8[_0x5e0184(0x120)]||[],..._0x25981a]:_0x48fae8[_0x5e0184(0x120)],'behaviors':_0x2ca58b?[..._0x48fae8[_0x5e0184(0x151)]||[],..._0x2ca58b]:_0x48fae8[_0x5e0184(0x151)],'customerGroup':_0x48fae8['customerGroup']},_0x45b1b0=await withSpinner(_0x5e0184(0x18d)+_0x30ae2d+'\x27...',()=>_0x3cce7b[_0x5e0184(0x1ef)]['updateParent'](_0x30ae2d,_0x4cd269),{'verbose':_0x5e4aad[_0x5e0184(0x279)]}),_0x42f711=_0x45b1b0[_0x5e0184(0x215)];return console['error'](_0x5e0184(0x205)+_0x42f711[_0x5e0184(0x216)]+'\x27'),await handleSDKOutput([_0x42f711],_0x5e4aad),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x244);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x128);async[a30_0x1c117e(0x1d7)](_0xc43359){const _0x3d6a68=a30_0x1c117e,{options:_0x45208d,args:_0x489e75,tdx:_0xaff340}=_0xc43359,_0x4dfde2=_0x45208d,_0x1f8b39=_0x489e75[0x0]||_0x45208d[_0x3d6a68(0x250)];if(!_0x1f8b39)return showParentSegmentNotSetError(_0x3d6a68(0x2ac)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x4dfde2[_0x3d6a68(0x25b)]&&_0x4dfde2[_0x3d6a68(0x213)])return console[_0x3d6a68(0x1ca)](a30_0x2ac4a6[_0x3d6a68(0x200)](_0x3d6a68(0x1c8))),console['error'](a30_0x2ac4a6[_0x3d6a68(0x194)](_0x3d6a68(0x1e9))),console['error'](a30_0x2ac4a6[_0x3d6a68(0x194)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x3d6a68(0x21e))),console['error'](a30_0x2ac4a6[_0x3d6a68(0x1f4)](_0x3d6a68(0x1cc))),0x1;const _0x5259fe=_0x4dfde2[_0x3d6a68(0x213)]||a30_0x7edf6c['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1f8b39)+_0x3d6a68(0x23e));_0x4dfde2[_0x3d6a68(0x279)]&&(console[_0x3d6a68(0x1ca)](_0x3d6a68(0x14b)+_0x4dfde2[_0x3d6a68(0x22a)]),console['error']('Parent\x20segment:\x20'+_0x1f8b39),console[_0x3d6a68(0x1ca)](_0x3d6a68(0x153)+_0x5259fe));const _0x16feba=await withSpinner(_0x3d6a68(0x270)+_0x1f8b39+_0x3d6a68(0x1eb),()=>_0xaff340[_0x3d6a68(0x1ef)]['pullParentYaml'](_0x1f8b39),{'verbose':_0x4dfde2[_0x3d6a68(0x279)]}),_0x1ecef5=_0x16feba[_0x3d6a68(0x215)];if(existsSync(_0x5259fe)){const _0x58f971=readFileSync(_0x5259fe,_0x3d6a68(0x15c)),_0x17d19d=generateDiff(_0x58f971,_0x1ecef5);if(!hasChanges(_0x17d19d))console[_0x3d6a68(0x1ca)](a30_0x2ac4a6['green']('✔')+'\x20No\x20changes\x20-\x20'+a30_0x2ac4a6[_0x3d6a68(0x1f4)](_0x5259fe)+_0x3d6a68(0x222));else{console[_0x3d6a68(0x1ca)](_0x3d6a68(0x1cf)+_0x5259fe+'\x27:'),console[_0x3d6a68(0x1ca)]('─'[_0x3d6a68(0x18b)](0x3c)),console[_0x3d6a68(0x1ca)](formatDiffWithColors(_0x17d19d)),console[_0x3d6a68(0x1ca)]('─'[_0x3d6a68(0x18b)](0x3c));if(!_0x4dfde2[_0x3d6a68(0x22e)]){if(!isInteractive())return console[_0x3d6a68(0x1ca)](a30_0x2ac4a6[_0x3d6a68(0x200)](_0x3d6a68(0x237)),_0x3d6a68(0x26f)),console['error'](a30_0x2ac4a6[_0x3d6a68(0x194)](_0x3d6a68(0x249))),0x1;const _0x484f35=await confirmKey(_0x3d6a68(0x161)+_0x5259fe+'\x27?');if(!_0x484f35)return console['error'](a30_0x2ac4a6[_0x3d6a68(0x1e4)](_0x3d6a68(0x1c2))),0x1;}writeFileSync(_0x5259fe,_0x1ecef5,_0x3d6a68(0x15c)),console[_0x3d6a68(0x1ca)](a30_0x2ac4a6['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x2ac4a6[_0x3d6a68(0x1f4)](_0x5259fe));}}else{const _0x20af30=a30_0x7edf6c[_0x3d6a68(0x203)](_0x5259fe);!existsSync(_0x20af30)&&mkdirSync(_0x20af30,{'recursive':!![]}),writeFileSync(_0x5259fe,_0x1ecef5,_0x3d6a68(0x15c)),console[_0x3d6a68(0x1ca)](a30_0x2ac4a6[_0x3d6a68(0x15b)]('✔')+_0x3d6a68(0x148)+a30_0x2ac4a6[_0x3d6a68(0x1f4)](_0x5259fe));}return saveSessionContext({'parent_segment':_0x1f8b39},_0x4dfde2[_0x3d6a68(0x197)]),console[_0x3d6a68(0x1ca)](a30_0x2ac4a6[_0x3d6a68(0x15b)]('✔')+_0x3d6a68(0x17d)+a30_0x2ac4a6[_0x3d6a68(0x194)](_0x3d6a68(0x291))+_0x3d6a68(0x158)+a30_0x2ac4a6['cyan'](_0x1f8b39)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x273);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x164);async[a30_0x1c117e(0x1d7)](_0x4ab833){const _0x5783f7=a30_0x1c117e,{options:_0x39d8f0,args:_0x597ebc,tdx:_0x4bd923}=_0x4ab833,_0x197f32=_0x39d8f0,_0x336a89=_0x597ebc[0x0]||_0x39d8f0[_0x5783f7(0x250)];if(!_0x336a89)return showParentSegmentNotSetError(_0x5783f7(0x14a)+_0x5783f7(0x165)),0x1;const _0x2aaed8=resolveYamlFile(_0x336a89);if(!existsSync(_0x2aaed8))return showFileNotFoundError(_0x2aaed8,_0x336a89),0x1;_0x197f32[_0x5783f7(0x279)]&&(console['error'](_0x5783f7(0x14b)+_0x197f32['site']),console[_0x5783f7(0x1ca)]('YAML\x20file:\x20'+_0x2aaed8));let _0xf66db6;try{_0xf66db6=readFileSync(_0x2aaed8,_0x5783f7(0x15c));}catch(_0x202d14){const _0x1a4dd5=_0x202d14 instanceof Error?_0x202d14['message']:String(_0x202d14);return console[_0x5783f7(0x1ca)](_0x5783f7(0x142)+_0x1a4dd5),0x1;}const _0x15a230=await withSpinner('Analyzing\x20changes...',()=>_0x4bd923[_0x5783f7(0x1ef)]['pushParentYaml'](_0xf66db6),{'verbose':_0x197f32[_0x5783f7(0x279)]}),_0x1af5ec=_0x15a230[_0x5783f7(0x215)],{isNew:_0x44db63,name:_0x378d0f,hasChanges:_0x339d29,diffFormatted:_0x2c70f8}=_0x1af5ec;if(!_0x339d29)return console[_0x5783f7(0x1ca)]('✔\x20No\x20changes\x20-\x20\x27'+_0x378d0f+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x44db63?console['error'](_0x5783f7(0x1d6)+_0x378d0f+'\x27:'):console['error'](_0x5783f7(0x211)+_0x378d0f+'\x27:');console[_0x5783f7(0x1ca)]('─'[_0x5783f7(0x18b)](0x3c)),console[_0x5783f7(0x1ca)](_0x2c70f8),console[_0x5783f7(0x1ca)]('─'[_0x5783f7(0x18b)](0x3c));const _0x32e5e8=_0x44db63?_0x5783f7(0x1ed)+_0x378d0f+'\x27?':_0x5783f7(0x24a)+_0x378d0f+'\x27?';if(!_0x197f32[_0x5783f7(0x22e)]){if(!isInteractive())return console[_0x5783f7(0x1ca)](a30_0x2ac4a6[_0x5783f7(0x200)](_0x5783f7(0x237)),_0x5783f7(0x26f)),console[_0x5783f7(0x1ca)](a30_0x2ac4a6['dim'](_0x5783f7(0x249))),0x1;const _0x2603c6=await confirmKey(_0x32e5e8);if(!_0x2603c6)return console[_0x5783f7(0x1ca)](a30_0x2ac4a6[_0x5783f7(0x1e4)](_0x5783f7(0x1c2))),0x1;}const _0x2817d5=_0x44db63?_0x5783f7(0x13c):_0x5783f7(0x23a),_0x46867e=await withSpinner(_0x2817d5+_0x5783f7(0x26e)+_0x378d0f+_0x5783f7(0x1eb),()=>_0x1af5ec[_0x5783f7(0x177)](),{'verbose':_0x197f32[_0x5783f7(0x279)]}),_0x17523e=_0x46867e[_0x5783f7(0x215)],_0x330d21=getConsoleNextUrl(_0x197f32[_0x5783f7(0x22a)],'/app/dw/parentSegments/'+_0x17523e['id']),_0x34243e=_0x44db63?'Created':'Updated';return console['error']('✔\x20'+_0x34243e+'\x20parent\x20segment\x20\x27'+_0x17523e[_0x5783f7(0x216)]+'\x27'),console['error']('\x20\x20'+_0x330d21),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x2a1);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x1b5);async[a30_0x1c117e(0x1d7)](_0x68f875){const _0x67c729=a30_0x1c117e,{options:_0x31c385,args:_0x5093ed,tdx:_0x3bf105}=_0x68f875,_0x545387=_0x31c385,_0x408999=_0x5093ed[0x0]||_0x31c385[_0x67c729(0x250)];if(!_0x408999)return showParentSegmentNotSetError(_0x67c729(0x152)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x67c729(0x178)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x67c729(0x140)+_0x67c729(0x11e)),0x1;const _0x3e7caf=resolveYamlFile(_0x408999);if(!existsSync(_0x3e7caf))return showFileNotFoundError(_0x3e7caf,_0x408999),0x1;_0x545387[_0x67c729(0x279)]&&(console[_0x67c729(0x1ca)](_0x67c729(0x14b)+_0x545387[_0x67c729(0x22a)]),console[_0x67c729(0x1ca)](_0x67c729(0x24c)+_0x3e7caf));let _0x1c9f19;try{_0x1c9f19=readFileSync(_0x3e7caf,_0x67c729(0x15c));}catch(_0x314e88){const _0x4c6be1=_0x314e88 instanceof Error?_0x314e88[_0x67c729(0x168)]:String(_0x314e88);return console[_0x67c729(0x1ca)]('Error\x20reading\x20file:\x20'+_0x4c6be1),0x1;}const _0x39a54b=createCommandSpinner(a30_0x2ac4a6[_0x67c729(0x194)](_0x67c729(0x248)),{'verbose':_0x545387[_0x67c729(0x279)]});_0x39a54b['start']();const _0x36d5d6={'onProgress':_0x275beb=>{_0x39a54b['text']=formatProgressMessage(_0x275beb);}};if(_0x545387[_0x67c729(0x210)])_0x36d5d6[_0x67c729(0x210)]=!![];if(_0x545387['enriched'])_0x36d5d6['enriched']=!![];_0x545387['attribute']&&(_0x36d5d6[_0x67c729(0x1a5)]=_0x545387[_0x67c729(0x1a5)]);_0x545387[_0x67c729(0x1db)]&&(_0x36d5d6[_0x67c729(0x1db)]=_0x545387['behavior']);if(_0x545387['interval'])_0x36d5d6['interval']=_0x545387[_0x67c729(0x229)];let _0xf1974a;try{_0xf1974a=await _0x3bf105[_0x67c729(0x1ef)][_0x67c729(0x135)](_0x1c9f19,_0x36d5d6),_0x39a54b[_0x67c729(0x27f)]();}catch(_0x5b304a){_0x39a54b[_0x67c729(0x27f)]();throw _0x5b304a;}const _0x39869f=_0x545387[_0x67c729(0x229)]||'-1d';return this['displayValidateResults'](_0xf1974a,_0x36d5d6,_0x3e7caf,_0x39869f),_0xf1974a[_0x67c729(0x16b)]?0x0:0x1;}['displayValidateResults'](_0x27f51e,_0x16f8f2,_0x5e0dc0,_0x42f143){const _0x332ca8=a30_0x1c117e;console['error']('\x0a'+a30_0x2ac4a6[_0x332ca8(0x1b8)]('Validate:')+'\x20'+_0x27f51e['name']),console[_0x332ca8(0x1ca)]('═'[_0x332ca8(0x18b)](0x3c)),this[_0x332ca8(0x2ae)](_0x27f51e);if(typeof _0x16f8f2[_0x332ca8(0x1a5)]===_0x332ca8(0x29a)){this[_0x332ca8(0x1c0)](_0x27f51e),this['displaySummary'](_0x27f51e),this['displayPreviewHints'](_0x5e0dc0,_0x42f143,'attribute',_0x16f8f2[_0x332ca8(0x1a5)]);return;}if(_0x16f8f2[_0x332ca8(0x1a5)]===!![]){this[_0x332ca8(0x1c0)](_0x27f51e),this[_0x332ca8(0x12b)](_0x27f51e),this[_0x332ca8(0x1e0)](_0x5e0dc0,_0x42f143,_0x332ca8(0x120));return;}if(typeof _0x16f8f2[_0x332ca8(0x1db)]==='string'){this[_0x332ca8(0x236)](_0x27f51e,_0x42f143),this[_0x332ca8(0x12b)](_0x27f51e),this[_0x332ca8(0x1e0)](_0x5e0dc0,_0x42f143,_0x332ca8(0x1db),_0x16f8f2[_0x332ca8(0x1db)]);return;}if(_0x16f8f2[_0x332ca8(0x1db)]===!![]){this['displayBehaviorsStats'](_0x27f51e,_0x42f143),this[_0x332ca8(0x12b)](_0x27f51e),this['displayPreviewHints'](_0x5e0dc0,_0x42f143,_0x332ca8(0x151));return;}this['displayAttributesStats'](_0x27f51e),this[_0x332ca8(0x236)](_0x27f51e,_0x42f143),this[_0x332ca8(0x1ea)](_0x27f51e),this['displaySummary'](_0x27f51e),this[_0x332ca8(0x1e0)](_0x5e0dc0,_0x42f143,'all');}[a30_0x1c117e(0x1ea)](_0x3b6fd5){displayRealtimeValidation(_0x3b6fd5);}[a30_0x1c117e(0x1e0)](_0x2c9931,_0x2b15ae,_0x1a111b,_0x49228b){const _0x55e9c1=a30_0x1c117e;console[_0x55e9c1(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x55e9c1(0x194)](_0x55e9c1(0x280)));const _0x314bd4=_0x2b15ae!==_0x55e9c1(0x172)?_0x55e9c1(0x162)+_0x2b15ae:'';if(_0x1a111b==='attribute'&&_0x49228b)console[_0x55e9c1(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x55e9c1(0x194)](_0x55e9c1(0x26b)+_0x2c9931+_0x55e9c1(0x2af)+_0x49228b+'\x22'+_0x314bd4));else{if(_0x1a111b===_0x55e9c1(0x1db)&&_0x49228b)console[_0x55e9c1(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x55e9c1(0x194)](_0x55e9c1(0x26b)+_0x2c9931+_0x55e9c1(0x182)+_0x49228b+'\x22'+_0x314bd4));else(_0x1a111b===_0x55e9c1(0x120)||_0x1a111b===_0x55e9c1(0x227))&&console['error']('\x20\x20'+a30_0x2ac4a6[_0x55e9c1(0x194)](_0x55e9c1(0x26b)+_0x2c9931+'\x20--attribute\x20\x22<name>\x22'+_0x314bd4));}(_0x1a111b===_0x55e9c1(0x151)||_0x1a111b===_0x55e9c1(0x227))&&console[_0x55e9c1(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x55e9c1(0x194)]('tdx\x20ps\x20preview\x20'+_0x2c9931+_0x55e9c1(0x20c)+_0x314bd4)),_0x1a111b===_0x55e9c1(0x227)&&console['error']('\x20\x20'+a30_0x2ac4a6[_0x55e9c1(0x194)]('tdx\x20ps\x20preview\x20'+_0x2c9931+_0x55e9c1(0x21c)+_0x314bd4));}['displayMasterInfo'](_0x10f9ef){const _0x410ec0=a30_0x1c117e,{master:_0x4e8b6d}=_0x10f9ef,_0x54651f=_0x4e8b6d[_0x410ec0(0x1ce)]?a30_0x2ac4a6['green']('✔'):a30_0x2ac4a6[_0x410ec0(0x200)]('✘');console['error']('\x0a'+a30_0x2ac4a6['dim']('Master\x20Table')),console[_0x410ec0(0x1ca)](_0x54651f+'\x20'+a30_0x2ac4a6[_0x410ec0(0x1b8)](_0x4e8b6d['database']+'.'+_0x4e8b6d[_0x410ec0(0x296)])),_0x4e8b6d[_0x410ec0(0x1ce)]?_0x4e8b6d[_0x410ec0(0x201)]!==undefined&&console[_0x410ec0(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x410ec0(0x194)](_0x410ec0(0x292))+'\x20'+a30_0x2ac4a6['cyan'](formatRows(_0x4e8b6d[_0x410ec0(0x201)]))):console[_0x410ec0(0x1ca)]('\x20\x20'+a30_0x2ac4a6['red'](_0x410ec0(0x1b9))+'\x20'+_0x4e8b6d[_0x410ec0(0x28c)]);}['displayAttributesStats'](_0x3ff55c){const _0x2f1a0b=a30_0x1c117e;if(_0x3ff55c[_0x2f1a0b(0x120)][_0x2f1a0b(0x2a2)]===0x0)return;console[_0x2f1a0b(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x2f1a0b(0x194)]('Attributes'));for(const _0x5c9b68 of _0x3ff55c[_0x2f1a0b(0x120)]){const _0x1e48d2=_0x5c9b68[_0x2f1a0b(0x1ce)]?a30_0x2ac4a6[_0x2f1a0b(0x15b)]('✔'):a30_0x2ac4a6['red']('✘');let _0x2545bf='';if(_0x5c9b68[_0x2f1a0b(0x1ce)]&&_0x5c9b68['matchedCount']!==undefined&&_0x5c9b68[_0x2f1a0b(0x13a)]!==undefined){const _0x41e404=_0x5c9b68[_0x2f1a0b(0x13a)][_0x2f1a0b(0x1bd)](0x1),_0x23477e=_0x5c9b68[_0x2f1a0b(0x13a)]>=0x50?a30_0x2ac4a6[_0x2f1a0b(0x15b)]:_0x5c9b68[_0x2f1a0b(0x13a)]>=0x32?a30_0x2ac4a6['yellow']:a30_0x2ac4a6[_0x2f1a0b(0x200)];_0x2545bf='\x20'+a30_0x2ac4a6[_0x2f1a0b(0x194)](_0x2f1a0b(0x297))+'\x20'+_0x23477e(_0x41e404+'%')+'\x20('+formatRows(_0x5c9b68[_0x2f1a0b(0x208)])+'\x20rows)';}console[_0x2f1a0b(0x1ca)](_0x1e48d2+'\x20'+a30_0x2ac4a6[_0x2f1a0b(0x1b8)](_0x5c9b68[_0x2f1a0b(0x216)])+_0x2545bf),console[_0x2f1a0b(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x2f1a0b(0x194)](_0x2f1a0b(0x1b1))+'\x20'+a30_0x2ac4a6[_0x2f1a0b(0x1b8)](_0x5c9b68['database']+'.'+_0x5c9b68[_0x2f1a0b(0x296)]));const _0x137bae=_0x5c9b68['joinKey']===_0x5c9b68[_0x2f1a0b(0x29b)]?a30_0x2ac4a6[_0x2f1a0b(0x194)](_0x2f1a0b(0x175))+'\x20'+_0x5c9b68[_0x2f1a0b(0x260)]:a30_0x2ac4a6['dim']('Join:')+'\x20'+_0x5c9b68['joinKey']+'\x20=\x20'+_0x5c9b68[_0x2f1a0b(0x29b)];console[_0x2f1a0b(0x1ca)]('\x20\x20'+_0x137bae),console['error']('\x20\x20'+a30_0x2ac4a6[_0x2f1a0b(0x194)](_0x2f1a0b(0x1dd))),this[_0x2f1a0b(0x23b)](_0x5c9b68[_0x2f1a0b(0x1ab)]),!_0x5c9b68[_0x2f1a0b(0x1ce)]&&console['error']('\x20\x20'+a30_0x2ac4a6[_0x2f1a0b(0x200)](_0x2f1a0b(0x1b9))+'\x20'+_0x5c9b68[_0x2f1a0b(0x28c)]);}}[a30_0x1c117e(0x236)](_0x3fed77,_0x577998){const _0x2e615e=a30_0x1c117e;if(_0x3fed77['behaviors'][_0x2e615e(0x2a2)]===0x0)return;console[_0x2e615e(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x2e615e(0x194)](_0x2e615e(0x1b4))+'\x20'+a30_0x2ac4a6['dim']('('+_0x577998+')'));for(const _0x1249f2 of _0x3fed77[_0x2e615e(0x151)]){const _0x29cdd1=_0x1249f2[_0x2e615e(0x1ce)]?a30_0x2ac4a6[_0x2e615e(0x15b)]('✔'):a30_0x2ac4a6[_0x2e615e(0x200)]('✘');let _0x50a96d='';if(_0x1249f2[_0x2e615e(0x1ce)]&&_0x1249f2[_0x2e615e(0x16d)]!==undefined&&_0x1249f2[_0x2e615e(0x240)]!==undefined){const _0x11737b=_0x1249f2[_0x2e615e(0x155)]?.[_0x2e615e(0x1bd)](0x1)||'?',_0x4c75b4=(_0x1249f2[_0x2e615e(0x155)]??0x0)>=0x32?a30_0x2ac4a6[_0x2e615e(0x15b)]:(_0x1249f2[_0x2e615e(0x155)]??0x0)>=0x14?a30_0x2ac4a6[_0x2e615e(0x1e4)]:a30_0x2ac4a6['red'];_0x50a96d='\x20'+a30_0x2ac4a6[_0x2e615e(0x194)]('Customers:')+'\x20'+_0x4c75b4(formatRows(_0x1249f2['customersWithEvents']))+'\x20('+_0x11737b+_0x2e615e(0x1c6)+a30_0x2ac4a6['dim'](_0x2e615e(0x218))+'\x20'+a30_0x2ac4a6[_0x2e615e(0x1f4)](formatRows(_0x1249f2[_0x2e615e(0x240)]));}console['error'](_0x29cdd1+'\x20'+a30_0x2ac4a6[_0x2e615e(0x1b8)](_0x1249f2[_0x2e615e(0x216)])+_0x50a96d),console[_0x2e615e(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x2e615e(0x194)](_0x2e615e(0x1b1))+'\x20'+a30_0x2ac4a6[_0x2e615e(0x1b8)](_0x1249f2[_0x2e615e(0x233)]+'.'+_0x1249f2[_0x2e615e(0x296)]));const _0x143a6a=_0x1249f2[_0x2e615e(0x260)]===_0x1249f2[_0x2e615e(0x29b)]?a30_0x2ac4a6[_0x2e615e(0x194)](_0x2e615e(0x175))+'\x20'+_0x1249f2['joinKey']:a30_0x2ac4a6[_0x2e615e(0x194)](_0x2e615e(0x217))+'\x20'+_0x1249f2[_0x2e615e(0x260)]+_0x2e615e(0x158)+_0x1249f2[_0x2e615e(0x29b)];console[_0x2e615e(0x1ca)]('\x20\x20'+_0x143a6a),console['error']('\x20\x20'+a30_0x2ac4a6[_0x2e615e(0x194)](_0x2e615e(0x1dd))),this[_0x2e615e(0x23b)](_0x1249f2[_0x2e615e(0x1ab)]),!_0x1249f2[_0x2e615e(0x1ce)]&&console['error']('\x20\x20'+a30_0x2ac4a6[_0x2e615e(0x200)](_0x2e615e(0x1b9))+'\x20'+_0x1249f2[_0x2e615e(0x28c)]);}}[a30_0x1c117e(0x23b)](_0x41c820){const _0x1baae0=a30_0x1c117e;for(const _0x583ae0 of _0x41c820){_0x583ae0[_0x1baae0(0x29e)]===_0x583ae0['column']||_0x583ae0[_0x1baae0(0x25e)]==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x583ae0[_0x1baae0(0x29e)]):console[_0x1baae0(0x1ca)]('\x20\x20\x20\x20-\x20'+_0x583ae0[_0x1baae0(0x29e)]+'\x20'+a30_0x2ac4a6[_0x1baae0(0x194)]('('+_0x583ae0['column']+')'));}}['displaySummary'](_0x3206d8){const _0x1559f3=a30_0x1c117e;console[_0x1559f3(0x1ca)]('─'[_0x1559f3(0x18b)](0x3c));if(_0x3206d8[_0x1559f3(0x11d)][_0x1559f3(0x2a2)]>0x0){console[_0x1559f3(0x1ca)]('\x0a'+a30_0x2ac4a6['red'](_0x1559f3(0x226)));for(const _0x1537d6 of _0x3206d8[_0x1559f3(0x11d)]){console[_0x1559f3(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x1559f3(0x200)]('•')+'\x20'+_0x1537d6);}}_0x3206d8[_0x1559f3(0x16b)]&&console[_0x1559f3(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x1559f3(0x15b)]('✔')+_0x1559f3(0x1df));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x1b2);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x275);async[a30_0x1c117e(0x1d7)](_0x36ce5b){const _0x59ce07=a30_0x1c117e,{options:_0x433dad,args:_0x37ebb9,tdx:_0x354af1}=_0x36ce5b,_0x13290a=_0x433dad,_0x6d17ef=_0x37ebb9[0x0]||_0x433dad[_0x59ce07(0x250)];if(!_0x6d17ef)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x59ce07(0x271)+'Options\x20(one\x20required):\x0a'+_0x59ce07(0x1b3)+_0x59ce07(0x146)+_0x59ce07(0x19f)+_0x59ce07(0x263)+_0x59ce07(0x11e)),0x1;if(!_0x13290a[_0x59ce07(0x210)]&&!_0x13290a['attribute']&&!_0x13290a[_0x59ce07(0x1db)]&&!_0x13290a['enriched'])return console[_0x59ce07(0x1ca)](a30_0x2ac4a6[_0x59ce07(0x200)](_0x59ce07(0x289))),console['error'](_0x59ce07(0x187)),console[_0x59ce07(0x1ca)](_0x59ce07(0x1d4)),console[_0x59ce07(0x1ca)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x59ce07(0x1d0)),console[_0x59ce07(0x1ca)](_0x59ce07(0x170)),console[_0x59ce07(0x1ca)](_0x59ce07(0x12d)),0x1;const _0x38a32b=resolveYamlFile(_0x6d17ef);if(!existsSync(_0x38a32b))return showFileNotFoundError(_0x38a32b,_0x6d17ef),0x1;_0x13290a[_0x59ce07(0x279)]&&(console[_0x59ce07(0x1ca)](_0x59ce07(0x14b)+_0x13290a[_0x59ce07(0x22a)]),console[_0x59ce07(0x1ca)](_0x59ce07(0x24c)+_0x38a32b));let _0x474990;try{_0x474990=readFileSync(_0x38a32b,_0x59ce07(0x15c));}catch(_0x5b1e8c){const _0x2445c8=_0x5b1e8c instanceof Error?_0x5b1e8c[_0x59ce07(0x168)]:String(_0x5b1e8c);return console['error']('Error\x20reading\x20file:\x20'+_0x2445c8),0x1;}let _0x2253ed;try{_0x2253ed=parseDef(_0x474990);}catch(_0xf36718){const _0x4d2294=_0xf36718 instanceof Error?_0xf36718[_0x59ce07(0x168)]:String(_0xf36718);return console[_0x59ce07(0x1ca)](a30_0x2ac4a6[_0x59ce07(0x200)]('Error\x20parsing\x20YAML:\x20'+_0x4d2294)),0x1;}if(_0x13290a[_0x59ce07(0x1a5)]===!![]||_0x13290a[_0x59ce07(0x1a5)]===''){const _0x5dce93=_0x2253ed[_0x59ce07(0x120)]?.[_0x59ce07(0x176)](_0x334734=>_0x334734['name'])||[];if(_0x5dce93[_0x59ce07(0x2a2)]===0x0)console[_0x59ce07(0x1ca)](a30_0x2ac4a6[_0x59ce07(0x200)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x59ce07(0x1ca)](a30_0x2ac4a6[_0x59ce07(0x200)](_0x59ce07(0x268))),console[_0x59ce07(0x1ca)]('Available\x20attributes:');for(const _0x54f557 of _0x5dce93){console[_0x59ce07(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x59ce07(0x1f4)](_0x54f557));}console[_0x59ce07(0x1ca)](_0x59ce07(0x150)+_0x6d17ef+_0x59ce07(0x2af)+_0x5dce93[0x0]+'\x22');}return 0x1;}if(_0x13290a[_0x59ce07(0x1db)]===!![]||_0x13290a[_0x59ce07(0x1db)]===''){const _0x2d011a=_0x2253ed['behaviors']?.['map'](_0x109761=>_0x109761[_0x59ce07(0x216)])||[];if(_0x2d011a[_0x59ce07(0x2a2)]===0x0)console['error'](a30_0x2ac4a6[_0x59ce07(0x200)](_0x59ce07(0x133)));else{console['error'](a30_0x2ac4a6[_0x59ce07(0x200)](_0x59ce07(0x138))),console['error'](_0x59ce07(0x20f));for(const _0x47076b of _0x2d011a){console[_0x59ce07(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x59ce07(0x1f4)](_0x47076b));}console['error'](_0x59ce07(0x150)+_0x6d17ef+_0x59ce07(0x182)+_0x2d011a[0x0]+'\x22');}return 0x1;}const _0x487c52=createCommandSpinner(a30_0x2ac4a6['dim'](_0x59ce07(0x18f)),{'verbose':_0x13290a[_0x59ce07(0x279)]});_0x487c52[_0x59ce07(0x26c)]();const _0x22c849={'onProgress':_0x422924=>{const _0x1fdc6c=_0x59ce07;_0x487c52[_0x1fdc6c(0x15d)]=formatProgressMessage(_0x422924);}};if(_0x13290a[_0x59ce07(0x210)])_0x22c849[_0x59ce07(0x210)]=!![];if(_0x13290a[_0x59ce07(0x1a5)]&&typeof _0x13290a[_0x59ce07(0x1a5)]==='string')_0x22c849[_0x59ce07(0x1a5)]=_0x13290a[_0x59ce07(0x1a5)];if(_0x13290a[_0x59ce07(0x1db)]&&typeof _0x13290a['behavior']==='string')_0x22c849[_0x59ce07(0x1db)]=_0x13290a[_0x59ce07(0x1db)];if(_0x13290a[_0x59ce07(0x16c)])_0x22c849[_0x59ce07(0x16c)]=!![];if(_0x13290a[_0x59ce07(0x229)])_0x22c849[_0x59ce07(0x229)]=_0x13290a[_0x59ce07(0x229)];let _0x5ba8f1;try{_0x5ba8f1=await _0x354af1['segment'][_0x59ce07(0x267)](_0x474990,_0x22c849),_0x487c52[_0x59ce07(0x27f)]();}catch(_0x44671c){_0x487c52['stop']();throw _0x44671c;}return await this['displayPreviewResults'](_0x5ba8f1,{'master':_0x13290a[_0x59ce07(0x210)],'attribute':typeof _0x13290a[_0x59ce07(0x1a5)]===_0x59ce07(0x29a)?_0x13290a['attribute']:undefined,'behavior':typeof _0x13290a[_0x59ce07(0x1db)]===_0x59ce07(0x29a)?_0x13290a['behavior']:undefined,'enriched':_0x13290a[_0x59ce07(0x16c)]}),_0x5ba8f1[_0x59ce07(0x16b)]?0x0:0x1;}async[a30_0x1c117e(0x14f)](_0x41a14c,_0x563c2c){const _0x52b1b5=a30_0x1c117e;console[_0x52b1b5(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x52b1b5(0x1b8)](_0x52b1b5(0x202))+'\x20'+_0x41a14c[_0x52b1b5(0x216)]),console[_0x52b1b5(0x1ca)]('═'[_0x52b1b5(0x18b)](0x3c));if(_0x563c2c[_0x52b1b5(0x210)]&&_0x41a14c[_0x52b1b5(0x141)]){const _0x5d0192=a30_0x2ac4a6[_0x52b1b5(0x194)](_0x52b1b5(0x1d9))+'\x20'+a30_0x2ac4a6[_0x52b1b5(0x1b8)](_0x41a14c['master'][_0x52b1b5(0x233)]+'.'+_0x41a14c[_0x52b1b5(0x210)]['table']);await this[_0x52b1b5(0x22c)](_0x5d0192,_0x41a14c[_0x52b1b5(0x141)]);}else{if(_0x563c2c['attribute']&&_0x41a14c['sampleData']){const _0x1e4f3b=a30_0x2ac4a6[_0x52b1b5(0x194)](_0x52b1b5(0x1a3))+'\x20'+a30_0x2ac4a6[_0x52b1b5(0x1b8)](_0x563c2c['attribute']);await this['displaySampleData'](_0x1e4f3b,_0x41a14c[_0x52b1b5(0x141)]);}else{if(_0x563c2c[_0x52b1b5(0x1db)]&&_0x41a14c['sampleData']){const _0x5f1cfb=a30_0x2ac4a6[_0x52b1b5(0x194)](_0x52b1b5(0x12a))+'\x20'+a30_0x2ac4a6[_0x52b1b5(0x1b8)](_0x563c2c['behavior']);await this[_0x52b1b5(0x22c)](_0x5f1cfb,_0x41a14c[_0x52b1b5(0x141)]);}else{if(_0x563c2c[_0x52b1b5(0x16c)]&&_0x41a14c[_0x52b1b5(0x141)]){const _0x5c919d=a30_0x2ac4a6[_0x52b1b5(0x194)]('Enriched:')+'\x20'+a30_0x2ac4a6['bold']('Master\x20+\x20Attributes');await this[_0x52b1b5(0x22c)](_0x5c919d,_0x41a14c[_0x52b1b5(0x141)]);}else!_0x41a14c[_0x52b1b5(0x141)]&&console['error'](_0x52b1b5(0x258));}}}if(_0x41a14c[_0x52b1b5(0x11d)][_0x52b1b5(0x2a2)]>0x0){console[_0x52b1b5(0x1ca)]('─'['repeat'](0x3c)),console[_0x52b1b5(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x52b1b5(0x200)](_0x52b1b5(0x226)));for(const _0x4175be of _0x41a14c[_0x52b1b5(0x11d)]){console[_0x52b1b5(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x52b1b5(0x200)]('•')+'\x20'+_0x4175be);}}}async[a30_0x1c117e(0x22c)](_0x102b60,_0x47cbf9){const _0x96c92c=a30_0x1c117e;if(_0x47cbf9[_0x96c92c(0x2a2)]===0x0){console['error']('\x0a'+_0x102b60),console['error']('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x96c92c(0x1ca)]('\x0a'+_0x102b60);const _0x5ccadd=Object[_0x96c92c(0x1d2)](_0x47cbf9[0x0])[_0x96c92c(0x176)](_0x40f5a6=>({'name':_0x40f5a6,'type':typeof _0x47cbf9[0x0][_0x40f5a6]===_0x96c92c(0x299)?_0x96c92c(0x17f):'varchar'})),_0x5233d0={'queryId':_0x96c92c(0x230),'columns':_0x5ccadd,'data':_0x47cbf9,'stats':{'state':_0x96c92c(0x130),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x47cbf9[_0x96c92c(0x2a2)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x11b7a2=formatAsTable(_0x5233d0,_0x47cbf9[_0x96c92c(0x2a2)],!![]);await writeOutput(_0x11b7a2,undefined,_0x96c92c(0x296));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a30_0x1c117e(0x1af);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x1e5);async[a30_0x1c117e(0x1d7)](_0x2be449){const _0x16337f=a30_0x1c117e,{options:_0x4ce94e,args:_0x12eed6,tdx:_0x3ecf4d}=_0x2be449,_0x6a08b3=_0x4ce94e,_0xe7903c=_0x12eed6[0x0]||_0x4ce94e['parentSegment'];if(!_0xe7903c)return showParentSegmentNotSetError(_0x16337f(0x225)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x49a9e2=resolveYamlFile(_0xe7903c);if(existsSync(_0x49a9e2)){_0x6a08b3['verbose']&&console['error'](_0x16337f(0x1e2)+_0x49a9e2);let _0x18046a;try{_0x18046a=readFileSync(_0x49a9e2,_0x16337f(0x15c));}catch(_0x5d6dbc){const _0x34c832=_0x5d6dbc instanceof Error?_0x5d6dbc[_0x16337f(0x168)]:String(_0x5d6dbc);return console['error'](_0x16337f(0x142)+_0x34c832),0x1;}const _0x39ce6d=await withSpinner(_0x16337f(0x160),()=>_0x3ecf4d[_0x16337f(0x1ef)][_0x16337f(0x1a9)](_0x18046a),{'verbose':_0x6a08b3[_0x16337f(0x279)]}),_0x4c90b7=_0x39ce6d[_0x16337f(0x215)],{isNew:_0x17fd16,name:_0x298bf0,hasChanges:_0x57932d,diffFormatted:_0x5ccb51}=_0x4c90b7;if(_0x57932d){_0x17fd16?console[_0x16337f(0x1ca)](_0x16337f(0x1d6)+_0x298bf0+'\x27:'):console[_0x16337f(0x1ca)](_0x16337f(0x211)+_0x298bf0+'\x27:');console['error']('─'[_0x16337f(0x18b)](0x3c)),console[_0x16337f(0x1ca)](_0x5ccb51),console[_0x16337f(0x1ca)]('─'[_0x16337f(0x18b)](0x3c));const _0x4745e6=_0x17fd16?_0x16337f(0x1ed)+_0x298bf0+_0x16337f(0x174):_0x16337f(0x24a)+_0x298bf0+'\x27\x20and\x20run\x20workflow?';if(!_0x6a08b3[_0x16337f(0x22e)]){if(!isInteractive())return console[_0x16337f(0x1ca)](a30_0x2ac4a6[_0x16337f(0x200)](_0x16337f(0x237)),_0x16337f(0x26f)),console[_0x16337f(0x1ca)](a30_0x2ac4a6['dim'](_0x16337f(0x249))),0x1;const _0x303a80=await confirmKey(_0x4745e6);if(!_0x303a80)return console[_0x16337f(0x1ca)](a30_0x2ac4a6[_0x16337f(0x1e4)](_0x16337f(0x1c2))),0x1;}const _0x41493d=_0x17fd16?_0x16337f(0x13c):'Updating';await withSpinner(_0x41493d+'\x20parent\x20segment\x20\x27'+_0x298bf0+_0x16337f(0x1eb),()=>_0x4c90b7[_0x16337f(0x177)](),{'verbose':_0x6a08b3[_0x16337f(0x279)]});const _0x32ce39=_0x17fd16?_0x16337f(0x29c):_0x16337f(0x22d);console[_0x16337f(0x1ca)]('✔\x20'+_0x32ce39+'\x20parent\x20segment\x20\x27'+_0x298bf0+'\x27');}else console[_0x16337f(0x1ca)](_0x16337f(0x167)+_0x298bf0+'\x27\x20is\x20up\x20to\x20date');}const _0x49c6b8=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0xe7903c+_0x16337f(0x1eb),()=>_0x3ecf4d[_0x16337f(0x1ef)][_0x16337f(0x21d)](_0xe7903c),{'verbose':_0x6a08b3[_0x16337f(0x279)]}),_0x5af587=_0x49c6b8[_0x16337f(0x215)],_0x9e98ac=getConsoleUrl(_0x6a08b3[_0x16337f(0x22a)],_0x16337f(0x12e)+_0x5af587[_0x16337f(0x191)]+_0x16337f(0x2a8)+_0x5af587[_0x16337f(0x1a8)]+_0x16337f(0x207)+_0x5af587['workflowAttemptId']);return console['error']('\x0a✔\x20Workflow\x20started'),console[_0x16337f(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x16337f(0x194)](_0x16337f(0x2ab))+'\x20'+_0x5af587[_0x16337f(0x259)]),console[_0x16337f(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x16337f(0x194)](_0x16337f(0x16f))+'\x20'+_0x5af587['status']),console['error']('\x20\x20'+a30_0x2ac4a6[_0x16337f(0x194)](_0x16337f(0x209))+'\x20'+_0x5af587[_0x16337f(0x1a8)]),console[_0x16337f(0x1ca)]('\x20\x20'+a30_0x2ac4a6[_0x16337f(0x194)](_0x16337f(0x1e7))+'\x20'+_0x5af587[_0x16337f(0x25f)]),console['error']('\x20\x20'+_0x9e98ac),console['error']('\x0a'+a30_0x2ac4a6[_0x16337f(0x194)](_0x16337f(0x1d1))+_0x16337f(0x122)+_0x5af587[_0x16337f(0x25f)]+_0x16337f(0x27b)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x1c117e(0x216)]='segment:parent:fields';[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x26d);async[a30_0x1c117e(0x1d7)](_0x21ca97){const _0x617bce=a30_0x1c117e,{options:_0xe4f68d,args:_0x2ed864,tdx:_0x14d6e1}=_0x21ca97,_0x3a5d64=_0x2ed864[0x0]||_0xe4f68d[_0x617bce(0x250)];if(!_0x3a5d64)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0xe4f68d['verbose']&&(console[_0x617bce(0x1ca)](_0x617bce(0x14b)+_0xe4f68d[_0x617bce(0x22a)]),console[_0x617bce(0x1ca)]('Parent\x20segment:\x20'+_0x3a5d64));const _0x57d912=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x3a5d64+_0x617bce(0x1eb),()=>_0x14d6e1[_0x617bce(0x1ef)][_0x617bce(0x281)](_0x3a5d64),{'verbose':_0xe4f68d[_0x617bce(0x279)]}),_0x54263f=_0x57d912[_0x617bce(0x215)];console[_0x617bce(0x1ca)]('✔\x20Found\x20'+_0x54263f[_0x617bce(0x2a2)]+'\x20field'+(_0x54263f[_0x617bce(0x2a2)]!==0x1?'s':''));if(_0xe4f68d['json']||_0xe4f68d[_0x617bce(0x27e)])return await handleSDKOutput(_0x54263f,_0xe4f68d),0x0;return displayFieldsHumanReadable(_0x54263f,_0x3a5d64),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x1c117e(0x216)]='segment:parent:view';['description']=a30_0x1c117e(0x2a0);async['execute'](_0xe41aff){const _0x510e48=a30_0x1c117e,{options:_0x22fd4c,args:_0x4d0417,tdx:_0x164859}=_0xe41aff,_0x106cd7=_0x22fd4c,_0x16937d=_0x4d0417[0x0]||_0x22fd4c[_0x510e48(0x250)];if(!_0x16937d)return showParentSegmentNotSetError(_0x510e48(0x1e3)+_0x510e48(0x265)+_0x510e48(0x178)+_0x510e48(0x28e)),0x1;_0x22fd4c[_0x510e48(0x279)]&&(console[_0x510e48(0x1ca)]('Site:\x20'+_0x22fd4c[_0x510e48(0x22a)]),console[_0x510e48(0x1ca)](_0x510e48(0x180)+_0x16937d));const _0x548533=await withSpinner(_0x510e48(0x270)+_0x16937d+_0x510e48(0x1eb),()=>_0x164859[_0x510e48(0x1ef)][_0x510e48(0x20a)](_0x16937d),{'verbose':_0x22fd4c[_0x510e48(0x279)]}),_0x597bf5=_0x548533['data'];if(_0x106cd7[_0x510e48(0x212)]){const _0x33352e=getConsoleNextUrl(_0x106cd7[_0x510e48(0x22a)],_0x510e48(0x15e)+_0x597bf5['id']);return console[_0x510e48(0x1ca)](a30_0x2ac4a6[_0x510e48(0x15b)]('✔')+_0x510e48(0x1cd)+a30_0x2ac4a6[_0x510e48(0x1f4)](_0x33352e)),openBrowser(_0x33352e),0x0;}return await handleSingleObjectOutput(_0x597bf5,_0x22fd4c),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x17b);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x1c1);async['execute'](_0x797cd7){const _0x195e69=a30_0x1c117e,{options:_0x5e603d,args:_0x40b94,tdx:_0x22ece1}=_0x797cd7,_0x416156=_0x5e603d,_0x4fc75a=_0x40b94[0x0]||_0x5e603d[_0x195e69(0x250)];if(!_0x4fc75a)return showParentSegmentNotSetError(_0x195e69(0x17e)+_0x195e69(0x198)+_0x195e69(0x178)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x5e603d[_0x195e69(0x279)]&&(console['error'](_0x195e69(0x14b)+_0x5e603d[_0x195e69(0x22a)]),console[_0x195e69(0x1ca)]('Parent\x20segment:\x20'+_0x4fc75a));const _0x397297=await withSpinner(_0x195e69(0x19e)+_0x4fc75a+_0x195e69(0x1eb),()=>_0x22ece1['segment'][_0x195e69(0x19d)](_0x4fc75a),{'verbose':_0x5e603d['verbose']}),_0x3c55e1=_0x397297[_0x195e69(0x215)],_0x4e7091=_0x22ece1[_0x195e69(0x1ef)][_0x195e69(0x261)](_0x3c55e1);if(_0x416156['output']){const _0x5af9ed=await this['collectSchema'](_0x797cd7,_0x4fc75a,_0x3c55e1,_0x4e7091),_0x38bdb9=this[_0x195e69(0x282)](_0x5af9ed);writeFileSync(_0x416156[_0x195e69(0x213)],_0x38bdb9);const _0x5e8509=_0x5af9ed[_0x195e69(0x181)][_0x195e69(0x1ab)][_0x195e69(0x2a2)]+_0x5af9ed[_0x195e69(0x151)]['reduce']((_0x32a598,_0x380196)=>_0x32a598+_0x380196[_0x195e69(0x1ab)][_0x195e69(0x2a2)],0x0),_0x4ad6e3=_0x5af9ed[_0x195e69(0x151)][_0x195e69(0x287)](_0x6dd7f0=>_0x6dd7f0[_0x195e69(0x1ab)][_0x195e69(0x2a2)]===0x0)['length'];return console[_0x195e69(0x149)](_0x195e69(0x20b)+_0x416156[_0x195e69(0x213)]),console[_0x195e69(0x149)](_0x195e69(0x23f)+_0x4e7091),console[_0x195e69(0x149)](_0x195e69(0x17a)+_0x5af9ed[_0x195e69(0x151)][_0x195e69(0x2a2)]+_0x195e69(0x1e1)),console['log'](_0x195e69(0x166)+_0x5e8509+_0x195e69(0x223)),_0x4ad6e3>0x0&&console[_0x195e69(0x149)](_0x195e69(0x127)+_0x4ad6e3+_0x195e69(0x1bc)),0x0;}console['error']('\x0a'+a30_0x2ac4a6[_0x195e69(0x1b8)](_0x195e69(0x1a0))+'\x20'+a30_0x2ac4a6[_0x195e69(0x1f4)](_0x4e7091));const _0x4519ca=await withSpinner(_0x195e69(0x186),()=>_0x22ece1[_0x195e69(0x1ef)][_0x195e69(0x189)](_0x3c55e1),{'verbose':_0x5e603d[_0x195e69(0x279)]});console[_0x195e69(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x195e69(0x1b8)](_0x195e69(0x181))+'\x20'+a30_0x2ac4a6[_0x195e69(0x194)]('('+_0x4e7091+_0x195e69(0x121)));const _0x3166a8=await executeSchemaQuery(_0x4519ca[_0x195e69(0x215)],_0x22ece1,_0x5e603d);await handleQueryOutput(_0x3166a8,_0x5e603d);const _0x4235ad=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x22ece1[_0x195e69(0x1ef)][_0x195e69(0x12f)](_0x3c55e1),{'verbose':_0x5e603d[_0x195e69(0x279)]});for(const _0x3c2828 of _0x4235ad[_0x195e69(0x215)]){const _0x39fa75=_0x195e69(0x1c7)+_0x3c2828['toLowerCase']()[_0x195e69(0x204)](/\s+/g,'_'),_0x4d7dad='SELECT\x20*\x20FROM\x20'+_0x4e7091+'.'+_0x39fa75;console[_0x195e69(0x1ca)]('\x0a'+a30_0x2ac4a6['bold'](_0x3c2828)+'\x20'+a30_0x2ac4a6[_0x195e69(0x194)]('('+_0x4e7091+'.'+_0x39fa75+')'));try{const _0x3248d=await executeSchemaQuery(_0x4d7dad,_0x22ece1,_0x5e603d);await handleQueryOutput(_0x3248d,_0x5e603d);}catch{console[_0x195e69(0x1ca)](a30_0x2ac4a6[_0x195e69(0x1e4)](_0x195e69(0x24f)));}}return 0x0;}async[a30_0x1c117e(0x137)](_0x187f12,_0xe66b28,_0x4309d1,_0x20cd42){const _0x1e8b50=a30_0x1c117e,{options:_0x3e01f7,tdx:_0x2fa52a}=_0x187f12,_0x4cf86c=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x2fa52a[_0x1e8b50(0x1ef)]['getParentSQL'](_0x4309d1),{'verbose':_0x3e01f7[_0x1e8b50(0x279)]}),_0x232f48=await executeSchemaQuery(_0x4cf86c[_0x1e8b50(0x215)],_0x2fa52a,_0x3e01f7),_0x4a191a=_0x232f48[_0x1e8b50(0x215)][_0x1e8b50(0x176)](_0x27827c=>({'name':_0x27827c[_0x1e8b50(0x1c4)],'type':_0x27827c['column_type']})),_0x4dc358=await withSpinner(_0x1e8b50(0x256),()=>_0x2fa52a[_0x1e8b50(0x1ef)]['getBehaviorNames'](_0x4309d1),{'verbose':_0x3e01f7[_0x1e8b50(0x279)]}),_0x56bf8a=[];for(const _0x46f973 of _0x4dc358[_0x1e8b50(0x215)]){const _0x32063d='behavior_'+_0x46f973[_0x1e8b50(0x285)]()[_0x1e8b50(0x204)](/\s+/g,'_'),_0x23ee58='SELECT\x20*\x20FROM\x20'+_0x20cd42+'.'+_0x32063d;let _0x99076=[];try{const _0x480531=await executeSchemaQuery(_0x23ee58,_0x2fa52a,_0x3e01f7);_0x99076=_0x480531[_0x1e8b50(0x215)][_0x1e8b50(0x176)](_0x1c5c8d=>({'name':_0x1c5c8d[_0x1e8b50(0x1c4)],'type':_0x1c5c8d[_0x1e8b50(0x1c5)]}));}catch{}_0x56bf8a[_0x1e8b50(0x1bf)]({'table':_0x32063d,'columns':_0x99076});}return{'database':_0x20cd42,'parent_segment':_0xe66b28,'parent_id':_0x4309d1,'customers':{'table':_0x1e8b50(0x181),'columns':_0x4a191a},'behaviors':_0x56bf8a};}[a30_0x1c117e(0x282)](_0x99ddbb){const _0x495e9a=a30_0x1c117e,_0xbbe50f=_0x5425d4=>{const _0x4c9b20=a30_0x30b0;if(_0x5425d4[_0x4c9b20(0x2a2)]===0x0)return'[]';const _0x36e520=_0x5425d4[_0x4c9b20(0x176)](_0x458705=>_0x4c9b20(0x1ee)+_0x458705[_0x4c9b20(0x216)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x458705['type']+_0x4c9b20(0x13e));return'[\x0a'+_0x36e520[_0x4c9b20(0x286)](',\x0a')+_0x4c9b20(0x1f9);},_0x1e9b0a=_0x99ddbb[_0x495e9a(0x151)][_0x495e9a(0x176)](_0x3cf8d7=>{const _0x5ee51e=_0x495e9a;return _0x5ee51e(0x1a1)+_0x3cf8d7[_0x5ee51e(0x296)]+_0x5ee51e(0x28a)+_0xbbe50f(_0x3cf8d7[_0x5ee51e(0x1ab)])[_0x5ee51e(0x204)](/^/gm,'\x20\x20')[_0x5ee51e(0x294)]()+_0x5ee51e(0x262);})[_0x495e9a(0x286)](',\x0a');return _0x495e9a(0x284)+_0x99ddbb['database']+_0x495e9a(0x228)+_0x99ddbb[_0x495e9a(0x291)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x99ddbb['parent_id']+_0x495e9a(0x231)+_0x99ddbb[_0x495e9a(0x181)][_0x495e9a(0x296)]+_0x495e9a(0x13d)+_0xbbe50f(_0x99ddbb['customers'][_0x495e9a(0x1ab)])[_0x495e9a(0x204)](/^/gm,'\x20\x20')['trim']()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x1e9b0a+_0x495e9a(0x183);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a30_0x1c117e(0x293);['description']=a30_0x1c117e(0x1cb);async[a30_0x1c117e(0x1d7)](_0x4109cf){const _0x9657=a30_0x1c117e,{options:_0x25a851,args:_0x22563a,tdx:_0x14dda7}=_0x4109cf,_0x52a236=_0x22563a[0x0]||_0x25a851[_0x9657(0x250)];if(!_0x52a236)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x9657(0x144)),0x1;_0x25a851[_0x9657(0x279)]&&(console[_0x9657(0x1ca)]('Site:\x20'+_0x25a851[_0x9657(0x22a)]),console[_0x9657(0x1ca)]('Parent\x20segment:\x20'+_0x52a236));const _0x1a4713=await withSpinner(_0x9657(0x19e)+_0x52a236+_0x9657(0x1eb),()=>_0x14dda7[_0x9657(0x1ef)]['resolveParentId'](_0x52a236),{'verbose':_0x25a851[_0x9657(0x279)]}),_0xdc9b72=_0x1a4713['data'],_0x556500=await withSpinner(_0x9657(0x1ff)+_0x52a236+_0x9657(0x1eb),()=>_0x14dda7[_0x9657(0x1ef)][_0x9657(0x189)](_0xdc9b72),{'verbose':_0x25a851[_0x9657(0x279)]}),_0x412ff3=_0x556500[_0x9657(0x215)];return _0x25a851[_0x9657(0x253)]===_0x9657(0x295)||_0x25a851[_0x9657(0x253)]===_0x9657(0x27e)?await handleSDKOutput([{'sql':_0x412ff3}],_0x25a851):console[_0x9657(0x149)](_0x412ff3),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a30_0x1c117e(0x17c);[a30_0x1c117e(0x18c)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a30_0x1c117e(0x1d7)](_0x812ac6){const _0x3d5be4=a30_0x1c117e,{options:_0x36bc08,args:_0x3f05df,tdx:_0x2aced0}=_0x812ac6,_0x1752f7=_0x3f05df[0x0]||_0x36bc08[_0x3d5be4(0x250)];if(!_0x1752f7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x3d5be4(0x129)),0x1;_0x36bc08[_0x3d5be4(0x279)]&&(console['error'](_0x3d5be4(0x14b)+_0x36bc08[_0x3d5be4(0x22a)]),console[_0x3d5be4(0x1ca)](_0x3d5be4(0x180)+_0x1752f7));const _0x4fed42=await withSpinner(_0x3d5be4(0x19e)+_0x1752f7+_0x3d5be4(0x1eb),()=>_0x2aced0[_0x3d5be4(0x1ef)][_0x3d5be4(0x19d)](_0x1752f7),{'verbose':_0x36bc08[_0x3d5be4(0x279)]}),_0x52c6a8=_0x4fed42[_0x3d5be4(0x215)],_0x5a3948=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x1752f7+'\x27...',()=>_0x2aced0[_0x3d5be4(0x1ef)][_0x3d5be4(0x189)](_0x52c6a8),{'verbose':_0x36bc08['verbose']});let _0x5d962f=_0x5a3948[_0x3d5be4(0x215)];const _0x27298d=resolveLimit(_0x36bc08[_0x3d5be4(0x1c9)],DEFAULT_DISPLAY_LIMIT),_0xa18436=/\bLIMIT\s+\d+/i['test'](_0x5d962f);!_0xa18436&&(_0x5d962f=_0x5d962f[_0x3d5be4(0x294)]()[_0x3d5be4(0x204)](/;+$/,''),_0x5d962f=_0x3d5be4(0x21b)+_0x5d962f+_0x3d5be4(0x29f)+_0x27298d);_0x36bc08[_0x3d5be4(0x279)]&&console[_0x3d5be4(0x1ca)](_0x3d5be4(0x28b)+_0x5d962f);const _0x9d254d=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x471b41=>{const _0x22c5bc=_0x3d5be4,_0x49ace6=await _0x2aced0[_0x22c5bc(0x179)][_0x22c5bc(0x1d7)](_0x5d962f,{'catalog':'td','schema':_0x22c5bc(0x1e6),'onJobId':_0x1868d9=>{const _0x598a45=_0x22c5bc;_0x471b41[_0x598a45(0x11f)](_0x1868d9);}});return _0x49ace6;},{'verbose':_0x36bc08['verbose']}),_0x185cbe=_0x9d254d[_0x3d5be4(0x215)],_0x32c230=_0x185cbe[_0x3d5be4(0x276)]?_0x3d5be4(0x16e)+_0x185cbe[_0x3d5be4(0x276)]+']':'';return console['error'](_0x3d5be4(0x272)+_0x185cbe['stats'][_0x3d5be4(0x21a)][_0x3d5be4(0x1f6)]()+_0x3d5be4(0x23c)+(_0x3d5be4(0x192)+formatElapsed(_0x185cbe['stats'][_0x3d5be4(0x21f)])+_0x32c230)),await handleQueryOutput(_0x185cbe,_0x36bc08),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x220);[a30_0x1c117e(0x18c)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async['execute'](_0x1247b1){const _0x2bfeef=a30_0x1c117e,{options:_0x41ad2d,args:_0x92c76c,tdx:_0x1e5cc1}=_0x1247b1,_0x16f27d=_0x92c76c[0x0],_0x28d880=await withSpinner(_0x16f27d?_0x2bfeef(0x13b)+_0x16f27d+_0x2bfeef(0x1eb):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x1e5cc1[_0x2bfeef(0x25c)]['list'](),{'verbose':_0x41ad2d[_0x2bfeef(0x279)]});let _0x151b15=_0x28d880['data']['filter'](_0x2d2552=>_0x2d2552[_0x2bfeef(0x147)]);if(_0x16f27d){const _0x5136cc=_0x16f27d[_0x2bfeef(0x204)](/[.+^${}()|[\]\\]/g,_0x2bfeef(0x274))[_0x2bfeef(0x204)](/\*/g,'.*')[_0x2bfeef(0x204)](/\?/g,'.'),_0x212f32=new RegExp('^'+_0x5136cc+'$','i');_0x151b15=_0x151b15[_0x2bfeef(0x287)](_0x693657=>_0x212f32[_0x2bfeef(0x184)](_0x693657[_0x2bfeef(0x216)]));}_0x151b15[_0x2bfeef(0x206)]((_0x34f991,_0x589884)=>_0x34f991[_0x2bfeef(0x216)][_0x2bfeef(0x1ad)](_0x589884[_0x2bfeef(0x216)])),console[_0x2bfeef(0x1ca)]('✔\x20Found\x20'+_0x151b15[_0x2bfeef(0x2a2)]+_0x2bfeef(0x154)+(_0x151b15[_0x2bfeef(0x2a2)]!==0x1?'s':''));const _0x4499bc=_0x270da7=>{const _0x3f00b1=_0x2bfeef;return getConsoleNextUrl(_0x41ad2d[_0x3f00b1(0x22a)],_0x3f00b1(0x15e)+_0x270da7);};if(_0x41ad2d[_0x2bfeef(0x253)]==='json'||_0x41ad2d[_0x2bfeef(0x253)]==='jsonl'){const _0x664e94=_0x151b15['map'](_0x28a779=>({..._0x28a779,'url':_0x4499bc(_0x28a779['id'])}));await handleSDKOutput(_0x664e94,_0x41ad2d);}else{if(_0x151b15[_0x2bfeef(0x2a2)]===0x0)console['log'](_0x2bfeef(0x134));else for(const _0x489421 of _0x151b15){const _0x1386a8=_0x489421[_0x2bfeef(0x221)]?a30_0x2ac4a6[_0x2bfeef(0x194)]('\x20('+formatRows(_0x489421[_0x2bfeef(0x221)])+')'):'',_0x303c43=hyperlink(_0x489421[_0x2bfeef(0x216)],_0x4499bc(_0x489421['id']));console['log']('⚡\x20'+_0x303c43+_0x1386a8);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x1fb);[a30_0x1c117e(0x18c)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async['execute'](_0x4f9e7c){const _0x2c7969=a30_0x1c117e,{options:_0x96b98d,args:_0x52e984,tdx:_0x4b9177}=_0x4f9e7c,_0x2cda3d=_0x52e984[0x0]||_0x96b98d[_0x2c7969(0x250)];if(!_0x2cda3d)return showParentSegmentNotSetError(_0x2c7969(0x2aa)+_0x2c7969(0x156)),0x1;const _0x852d88=resolveYamlFile(_0x2cda3d);if(!existsSync(_0x852d88))return showFileNotFoundError(_0x852d88,_0x2cda3d),0x1;let _0x477164;try{_0x477164=readFileSync(_0x852d88,_0x2c7969(0x15c));}catch(_0x133db2){const _0x569c29=_0x133db2 instanceof Error?_0x133db2[_0x2c7969(0x168)]:String(_0x133db2);return console[_0x2c7969(0x1ca)](_0x2c7969(0x142)+_0x569c29),0x1;}const _0xa4af00=createCommandSpinner(a30_0x2ac4a6[_0x2c7969(0x194)]('Validating\x20RT\x20configuration...'),{'verbose':_0x96b98d[_0x2c7969(0x279)]});_0xa4af00[_0x2c7969(0x26c)]();const _0x132a42={'realtime':!![],'onProgress':_0x34bbea=>{_0xa4af00['text']=formatProgressMessage(_0x34bbea);}};let _0x442f52;try{_0x442f52=await _0x4b9177[_0x2c7969(0x1ef)][_0x2c7969(0x135)](_0x477164,_0x132a42),_0xa4af00[_0x2c7969(0x27f)]();}catch(_0x42b41e){_0xa4af00[_0x2c7969(0x27f)]();throw _0x42b41e;}console[_0x2c7969(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x2c7969(0x1b8)](_0x2c7969(0x1d5))+'\x20'+_0x442f52[_0x2c7969(0x216)]),console[_0x2c7969(0x1ca)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x442f52),console['error']('─'[_0x2c7969(0x18b)](0x3c));if(_0x442f52[_0x2c7969(0x11d)][_0x2c7969(0x2a2)]>0x0){console[_0x2c7969(0x1ca)]('\x0a'+a30_0x2ac4a6['red'](_0x2c7969(0x226)));for(const _0x3544ab of _0x442f52[_0x2c7969(0x11d)]){console[_0x2c7969(0x1ca)]('\x20\x20'+a30_0x2ac4a6['red']('•')+'\x20'+_0x3544ab);}}return _0x442f52['allValid']&&console[_0x2c7969(0x1ca)]('\x0a'+a30_0x2ac4a6[_0x2c7969(0x15b)]('✔')+_0x2c7969(0x257)),_0x442f52[_0x2c7969(0x16b)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x1c117e(0x216)]=a30_0x1c117e(0x12c);['description']=a30_0x1c117e(0x1de);async[a30_0x1c117e(0x1d7)](_0x13d715){const _0x2afe31=a30_0x1c117e,{options:_0x308e43,args:_0x30f23f,tdx:_0x39e60a}=_0x13d715,_0x5eca29=_0x30f23f[0x0]||_0x308e43['parentSegment'];if(!_0x5eca29)return showParentSegmentNotSetError(_0x2afe31(0x196)+_0x2afe31(0x19a)),0x1;const _0x4d8113=await withSpinner(_0x2afe31(0x19e)+_0x5eca29+_0x2afe31(0x1eb),()=>_0x39e60a[_0x2afe31(0x1ef)][_0x2afe31(0x19d)](_0x5eca29),{'verbose':_0x308e43['verbose']}),_0x4010c5=_0x4d8113['data'],_0x11111a=await withSpinner(_0x2afe31(0x171)+_0x5eca29+'\x27...',()=>_0x39e60a[_0x2afe31(0x143)]['list'](_0x4010c5),{'verbose':_0x308e43[_0x2afe31(0x279)]}),_0x4dfbcd=_0x11111a[_0x2afe31(0x215)];console[_0x2afe31(0x1ca)](_0x2afe31(0x157)+_0x4dfbcd['length']+'\x20personalization\x20service'+(_0x4dfbcd[_0x2afe31(0x2a2)]!==0x1?'s':''));if(_0x308e43[_0x2afe31(0x253)]===_0x2afe31(0x295)||_0x308e43[_0x2afe31(0x253)]==='jsonl')await handleSDKOutput(_0x4dfbcd,_0x308e43);else{if(_0x4dfbcd['length']===0x0)console[_0x2afe31(0x149)](_0x2afe31(0x1da)),console[_0x2afe31(0x1ca)](a30_0x2ac4a6[_0x2afe31(0x1f4)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x59a928 of _0x4dfbcd){const _0x3abaf1=_0x59a928[_0x2afe31(0x14c)]?.[_0x2afe31(0x2a2)]||0x0,_0x55e75f=_0x59a928['trigger_event']?a30_0x2ac4a6[_0x2afe31(0x194)](_0x2afe31(0x1ec)+_0x59a928['trigger_event']):'',_0x3452b7=a30_0x2ac4a6[_0x2afe31(0x194)]('\x20('+_0x3abaf1+_0x2afe31(0x247)+(_0x3abaf1!==0x1?'s':'')+')');console[_0x2afe31(0x149)]('\x20\x20'+_0x59a928[_0x2afe31(0x216)]+_0x55e75f+_0x3452b7),_0x59a928[_0x2afe31(0x18c)]&&console['log'](_0x2afe31(0x20e)+a30_0x2ac4a6[_0x2afe31(0x194)](_0x59a928[_0x2afe31(0x18c)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x1c117e(0x2a3);[a30_0x1c117e(0x18c)]=a30_0x1c117e(0x1a2);async['execute'](_0x28e2ec){const _0x4ae4d8=a30_0x1c117e,{options:_0x5e85b9,args:_0x3b3b3e}=_0x28e2ec,_0x23eb9c=_0x3b3b3e[0x0]||_0x5e85b9[_0x4ae4d8(0x250)];if(!_0x23eb9c)return showParentSegmentNotSetError(_0x4ae4d8(0x159)+_0x4ae4d8(0x1fa)),0x1;const _0x48d67e=resolveYamlFile(_0x23eb9c);if(!existsSync(_0x48d67e))return showFileNotFoundError(_0x48d67e,_0x23eb9c),0x1;let _0x486bf1;try{_0x486bf1=readFileSync(_0x48d67e,_0x4ae4d8(0x15c));}catch(_0x40471c){const _0xb51e1c=_0x40471c instanceof Error?_0x40471c[_0x4ae4d8(0x168)]:String(_0x40471c);return console[_0x4ae4d8(0x1ca)](_0x4ae4d8(0x142)+_0xb51e1c),0x1;}let _0x24cec2;try{_0x24cec2=parseDef(_0x486bf1);}catch(_0x1fd96e){const _0x3f324f=_0x1fd96e instanceof Error?_0x1fd96e[_0x4ae4d8(0x168)]:String(_0x1fd96e);return console[_0x4ae4d8(0x1ca)](a30_0x2ac4a6['red'](_0x4ae4d8(0x1c3)+_0x3f324f)),0x1;}if(_0x24cec2['personalization_services']&&_0x24cec2[_0x4ae4d8(0x288)][_0x4ae4d8(0x2a2)]>0x0)return console[_0x4ae4d8(0x1ca)](a30_0x2ac4a6[_0x4ae4d8(0x1e4)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x48d67e)),console['error'](a30_0x2ac4a6['dim'](_0x4ae4d8(0x145)+_0x24cec2[_0x4ae4d8(0x288)][_0x4ae4d8(0x2a2)]+_0x4ae4d8(0x173))),0x1;!_0x24cec2[_0x4ae4d8(0x25c)]&&(_0x24cec2[_0x4ae4d8(0x25c)]={'events':[{'name':_0x4ae4d8(0x136),'source_table':_0x4ae4d8(0x1be)}],'attributes':[{'name':_0x4ae4d8(0x241),'type':_0x4ae4d8(0x1fe)}],'id_stitching':{'primary_key':_0x24cec2[_0x4ae4d8(0x210)]['table']===_0x4ae4d8(0x181)?_0x4ae4d8(0x252):_0x4ae4d8(0x1b7)}});_0x24cec2[_0x4ae4d8(0x288)]=[{'name':'My\x20Service','description':_0x4ae4d8(0x1f8),'trigger_event':_0x4ae4d8(0x136),'sections':[{'name':_0x4ae4d8(0x1f7),'criteria':_0x4ae4d8(0x169),'attributes':['last_page_viewed']}]}];const _0x29b736=serializeDef(_0x24cec2);return writeFileSync(_0x48d67e,_0x29b736,'utf-8'),console['error'](a30_0x2ac4a6[_0x4ae4d8(0x15b)]('✔')+_0x4ae4d8(0x27a)+a30_0x2ac4a6[_0x4ae4d8(0x1f4)](_0x48d67e)),(!_0x24cec2['realtime']||_0x486bf1[_0x4ae4d8(0x28d)](_0x4ae4d8(0x22f))===-0x1)&&console[_0x4ae4d8(0x1ca)](a30_0x2ac4a6['green']('✔')+_0x4ae4d8(0x266)),console['error']('\x0a'+a30_0x2ac4a6[_0x4ae4d8(0x194)](_0x4ae4d8(0x18e))),console[_0x4ae4d8(0x1ca)]('\x20\x201.\x20Edit\x20'+_0x48d67e+'\x20to\x20configure\x20your\x20personalization\x20service'),console['error'](_0x4ae4d8(0x1dc)+a30_0x2ac4a6[_0x4ae4d8(0x194)](_0x4ae4d8(0x245)+_0x23eb9c)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x2b5544=a31_0xbd0e;function a31_0x28c9(){const _0x2f16fe=['Show\x20a\x20specific\x20policy\x20details\x20and\x20permissions\x20(admin\x20only)','\x20polic','Usage:\x20tdx\x20policy\x20show\x20<policy-name-or-id>','21TSdtYY','all','execute','data','listPolicies','List\x20all\x20policies\x20in\x20the\x20account\x20(admin\x20only)','2124lMVwYQ','bold','max','✔\x20Found\x20','policy','Fetching\x20permissions...','args','(ID:\x20','join','27010bgjjVI','45330978DrmgEB','getMyPermissions','\x20\x20\x20','Show\x20current\x20user\x20policies\x20and\x20effective\x20permissions','permissions','\x20user','administrator','getCurrent','error','validate',',\x20user_id:','policy\x20list','operation','\x20—\x20','verbose','name','getPolicyPermissions','39362ElNfWh','\x20\x20No\x20policies\x20assigned','Administrator','getPolicy','entries','🔑\x20Effective\x20Permissions','5vaAvjc','938775hfwDde','description','ies','Listing\x20policies...','dim','👥\x20Assigned\x20Users','getPolicyUsers','log','policies','user','\x20\x20•\x20','28133umEYlc','5700608XuXMaZ','policy\x20show','Fetching\x20policy...','Member','map','\x20assigned','9408564PPFPIO','email','\x20\x20No\x20permissions','8eVInVk','site','length'];a31_0x28c9=function(){return _0x2f16fe;};return a31_0x28c9();}(function(_0x300e19,_0x4d973b){const _0x99fb86=a31_0xbd0e,_0x156633=_0x300e19();while(!![]){try{const _0x57c429=-parseInt(_0x99fb86(0x1ea))/0x1+parseInt(_0x99fb86(0x226))/0x2*(parseInt(_0x99fb86(0x205))/0x3)+-parseInt(_0x99fb86(0x1f6))/0x4*(parseInt(_0x99fb86(0x1e9))/0x5)+-parseInt(_0x99fb86(0x1fc))/0x6+-parseInt(_0x99fb86(0x1f5))/0x7*(parseInt(_0x99fb86(0x1ff))/0x8)+parseInt(_0x99fb86(0x20b))/0x9*(parseInt(_0x99fb86(0x214))/0xa)+parseInt(_0x99fb86(0x215))/0xb;if(_0x57c429===_0x4d973b)break;else _0x156633['push'](_0x156633['shift']());}catch(_0x54b85f){_0x156633['push'](_0x156633['shift']());}}}(a31_0x28c9,0xea6a1));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import a31_0x318ddc from'chalk';export class PolicyCommand extends BaseCommand{[a31_0x2b5544(0x224)]=a31_0x2b5544(0x20f);['description']=a31_0x2b5544(0x218);async['execute'](_0xcc102c){const _0x243aeb=a31_0x2b5544,{options:_0x125424,tdx:_0x27b61a}=_0xcc102c,_0x59ded1=await withSpinner(_0x243aeb(0x210),async()=>{const _0x212691=_0x243aeb,[_0x3cbd1b,_0x16d92e]=await Promise['all']([_0x27b61a[_0x212691(0x1f3)][_0x212691(0x21c)](),_0x27b61a[_0x212691(0x20f)][_0x212691(0x216)]()]);return{'userInfo':_0x3cbd1b,'permissions':_0x16d92e};},{'verbose':_0x125424['verbose']}),{userInfo:_0x46979b,permissions:_0x90d394}=_0x59ded1[_0x243aeb(0x208)];if(isStructuredFormat(_0x125424))return await handleSingleObjectOutput(_0x90d394,_0x125424),0x0;const _0x50eed1=_0x46979b['account_owner']?'Account\x20Owner':_0x46979b[_0x243aeb(0x21b)]?_0x243aeb(0x1e5):_0x243aeb(0x1f9);console['log']('\x0a'+a31_0x318ddc[_0x243aeb(0x20c)]('👤')+'\x20'+a31_0x318ddc[_0x243aeb(0x20c)](_0x46979b['name'])+'\x20'+a31_0x318ddc[_0x243aeb(0x1ee)]('('+_0x46979b[_0x243aeb(0x1fd)]+')')+_0x243aeb(0x222)+_0x50eed1),console['log'](a31_0x318ddc[_0x243aeb(0x1ee)](_0x243aeb(0x217)+_0x27b61a['context'][_0x243aeb(0x200)]+':'+_0x46979b['account_id']+_0x243aeb(0x21f)+_0x46979b['id']));const _0x4f7d6a=_0x90d394[_0x243aeb(0x1f2)];console[_0x243aeb(0x1f1)]('\x0a'+a31_0x318ddc[_0x243aeb(0x20c)]('📋\x20Assigned\x20Policies')+'\x20('+_0x4f7d6a[_0x243aeb(0x201)]+'):');if(_0x4f7d6a[_0x243aeb(0x201)]===0x0)console[_0x243aeb(0x1f1)](a31_0x318ddc[_0x243aeb(0x1ee)](_0x243aeb(0x227)));else for(const _0x2f8b37 of _0x4f7d6a){console[_0x243aeb(0x1f1)](_0x243aeb(0x1f4)+_0x2f8b37[_0x243aeb(0x224)]);}return printPermissionsMap(_0x90d394[_0x243aeb(0x219)]),console[_0x243aeb(0x1f1)](),0x0;}}export class PolicyListCommand extends BaseCommand{[a31_0x2b5544(0x224)]=a31_0x2b5544(0x220);[a31_0x2b5544(0x1eb)]=a31_0x2b5544(0x20a);async[a31_0x2b5544(0x207)](_0x110160){const _0x4d509b=a31_0x2b5544,{options:_0x4ef138,tdx:_0x3d56cb}=_0x110160,_0x41a71c=await withSpinner(_0x4d509b(0x1ed),()=>_0x3d56cb[_0x4d509b(0x20f)][_0x4d509b(0x209)](),{'verbose':_0x4ef138[_0x4d509b(0x223)]}),_0x113e13=_0x41a71c[_0x4d509b(0x208)];console[_0x4d509b(0x21d)](_0x4d509b(0x20e)+_0x113e13[_0x4d509b(0x201)]+_0x4d509b(0x203)+(_0x113e13['length']!==0x1?_0x4d509b(0x1ec):'y'));if(isStructuredFormat(_0x4ef138))return await handleSDKOutput(_0x113e13,_0x4ef138),0x0;if(_0x113e13['length']===0x0)console[_0x4d509b(0x1f1)](a31_0x318ddc[_0x4d509b(0x1ee)]('No\x20policies\x20found'));else for(const _0x5757af of _0x113e13){const _0x9d7bd1=_0x5757af[_0x4d509b(0x1eb)]?a31_0x318ddc[_0x4d509b(0x1ee)]('\x20—\x20'+_0x5757af[_0x4d509b(0x1eb)]):'';console['log']('\x20\x20•\x20'+_0x5757af['name']+_0x9d7bd1);}return 0x0;}}function a31_0xbd0e(_0x248ad1,_0x39a7b8){_0x248ad1=_0x248ad1-0x1e5;const _0x28c95f=a31_0x28c9();let _0xbd0e89=_0x28c95f[_0x248ad1];return _0xbd0e89;}export class PolicyShowCommand extends BaseCommand{[a31_0x2b5544(0x224)]=a31_0x2b5544(0x1f7);[a31_0x2b5544(0x1eb)]=a31_0x2b5544(0x202);[a31_0x2b5544(0x21e)](_0x56614c){const _0xd70480=a31_0x2b5544;if(_0x56614c[_0xd70480(0x211)]['length']===0x0)return _0xd70480(0x204);return undefined;}async[a31_0x2b5544(0x207)](_0x334ada){const _0x5f209b=a31_0x2b5544,{options:_0x366ff3,tdx:_0x48df34}=_0x334ada,_0x3f5e10=_0x334ada[_0x5f209b(0x211)][0x0],_0x55f41d=await withSpinner(_0x5f209b(0x1f8),async()=>{const _0x319dce=_0x5f209b,_0x2f2ecc=await _0x48df34['policy'][_0x319dce(0x1e6)](_0x3f5e10),[_0x37cbb0,_0x4de5f7]=await Promise[_0x319dce(0x206)]([_0x48df34[_0x319dce(0x20f)][_0x319dce(0x225)](_0x2f2ecc['id']),_0x48df34[_0x319dce(0x20f)][_0x319dce(0x1f0)](_0x2f2ecc['id'])]);return{'policy':_0x2f2ecc,'perms':_0x37cbb0,'users':_0x4de5f7};},{'verbose':_0x366ff3[_0x5f209b(0x223)]}),{policy:_0x2c0abb,perms:_0x4aa508,users:_0x402184}=_0x55f41d[_0x5f209b(0x208)];if(isStructuredFormat(_0x366ff3))return await handleSingleObjectOutput({..._0x2c0abb,'permissions':_0x4aa508[_0x5f209b(0x219)],'users':_0x402184},_0x366ff3),0x0;console[_0x5f209b(0x1f1)]('\x0a'+a31_0x318ddc[_0x5f209b(0x20c)]('📋')+'\x20'+a31_0x318ddc['bold'](_0x2c0abb[_0x5f209b(0x224)])+'\x20'+a31_0x318ddc['dim'](_0x5f209b(0x212)+_0x2c0abb['id']+')'));_0x2c0abb[_0x5f209b(0x1eb)]&&console[_0x5f209b(0x1f1)]('\x20\x20\x20'+a31_0x318ddc['dim'](_0x2c0abb[_0x5f209b(0x1eb)]));console['log']('\x20\x20\x20'+_0x402184[_0x5f209b(0x201)]+_0x5f209b(0x21a)+(_0x402184['length']!==0x1?'s':'')+_0x5f209b(0x1fb)),printPermissionsMap(_0x4aa508['permissions']);if(_0x402184[_0x5f209b(0x201)]>0x0){console['log']('\x0a'+a31_0x318ddc[_0x5f209b(0x20c)](_0x5f209b(0x1ef))+':');for(const _0xa51db5 of _0x402184){const _0xce535d=_0xa51db5[_0x5f209b(0x1fd)]&&_0xa51db5[_0x5f209b(0x1fd)]!==_0xa51db5[_0x5f209b(0x224)]?a31_0x318ddc[_0x5f209b(0x1ee)]('\x20<'+_0xa51db5[_0x5f209b(0x1fd)]+'>'):'';console[_0x5f209b(0x1f1)](_0x5f209b(0x1f4)+_0xa51db5[_0x5f209b(0x224)]+_0xce535d);}}return console[_0x5f209b(0x1f1)](),0x0;}}function printPermissionsMap(_0x52843f){const _0x504679=a31_0x2b5544,_0x4ec1d3=Object[_0x504679(0x1e7)](_0x52843f);console['log']('\x0a'+a31_0x318ddc[_0x504679(0x20c)](_0x504679(0x1e8))+':');if(_0x4ec1d3[_0x504679(0x201)]===0x0){console[_0x504679(0x1f1)](a31_0x318ddc[_0x504679(0x1ee)](_0x504679(0x1fe)));return;}const _0x1ed354=Math[_0x504679(0x20d)](..._0x4ec1d3[_0x504679(0x1fa)](([_0xe37457])=>_0xe37457['length']));for(const [_0x290e20,_0x58dde]of _0x4ec1d3){const _0x2f94b0=formatOperations(_0x58dde);console[_0x504679(0x1f1)]('\x20\x20'+_0x290e20['padEnd'](_0x1ed354+0x2)+_0x2f94b0);}}function formatOperations(_0x441b23){const _0x38b3ec=a31_0x2b5544,_0xad857c=[...new Set(_0x441b23['map'](_0x24f2f1=>_0x24f2f1[_0x38b3ec(0x221)]))];return _0xad857c[_0x38b3ec(0x213)](',\x20');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x12b288=a32_0x300d;(function(_0x8ce207,_0x101cd5){const _0x4eddd5=a32_0x300d,_0x33370c=_0x8ce207();while(!![]){try{const _0x4699e1=-parseInt(_0x4eddd5(0x209))/0x1+-parseInt(_0x4eddd5(0x238))/0x2*(-parseInt(_0x4eddd5(0x1f1))/0x3)+-parseInt(_0x4eddd5(0x244))/0x4*(-parseInt(_0x4eddd5(0x22a))/0x5)+-parseInt(_0x4eddd5(0x24d))/0x6+parseInt(_0x4eddd5(0x24c))/0x7*(-parseInt(_0x4eddd5(0x24e))/0x8)+parseInt(_0x4eddd5(0x20c))/0x9+parseInt(_0x4eddd5(0x205))/0xa;if(_0x4699e1===_0x101cd5)break;else _0x33370c['push'](_0x33370c['shift']());}catch(_0x854db5){_0x33370c['push'](_0x33370c['shift']());}}}(a32_0x22e7,0x60114));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a32_0x477203 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a32_0x22e7(){const _0x2078d1=['76280UsffVG','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Changing\x20site\x20to\x20\x27','\x27\x20does\x20not\x20exist.','yellow','Operation\x20cancelled','green','profile','115059eCZtDP','4232238GSoIzP','64zUKUgb','Enter\x20description\x20(optional):','\x20API\x20key\x20is\x20valid\x20(User:\x20','name','\x20\x20-\x20','validate','API\x20key\x20cannot\x20be\x20empty','\x0aSaved\x20to:\x20','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','✗\x20Validation\x20failed:\x20','includes','\x27\x20removed\x20from\x20configuration','Remove\x20a\x20profile','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','create','profileName','Failed\x20to\x20remove\x20profile:\x20','red','tdx:\x20profile\x20remove','parent_segment','bold','Choose\x20authentication\x20method:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','393ffpLMq','\x0aAvailable\x20profiles:','llm_agent','Profile\x20name\x20cannot\x20be\x20empty','text','execute','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Session\x20profile\x20set\x20to:\x20','Set\x20session\x20profile','jobs','error','password','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','split','\x20API\x20key\x20removed\x20from\x20system\x20keychain','warn','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','site','/app/mp/ak','description','12047580pePluD','Site\x20was\x20not\x20changed.','\x0aOperation\x20cancelled','email','539145oxgovF','OAuth\x20(browser\x20login)','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','3364416gsZnwm','\x27\x20requires\x20API\x20key\x20validation.','profile:set','\x20\x20(no\x20profiles\x20found)','Set\x20a\x20profile\x20configuration\x20value','config','trim','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','confirm','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','dim','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profile:remove','\x0aSetup\x20cancelled','oauth','message','API\x20Key','status','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','logLevel','Create\x20a\x20new\x20profile','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20\x27','profile:create','database','Setup\x20cancelled','join','apiKey','Unknown\x20key\x20\x27','30hOViBp','\x20--default\x27\x20to\x20save\x20permanently','ERROR','VALID_KEYS','Default\x20profile\x20set\x20to:\x20','test','Validating\x20API\x20key...','tdx:\x20profile\x20create','Removal\x20cancelled','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile:use','log','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20created','1168gAvdPZ','\x27\x20updated:\x20','\x20Profile\x20\x27','\x20\x20tdx\x20--profile\x20','(session:\x20','getUserInfo','llm_project','method','session','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','length','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'];a32_0x22e7=function(){return _0x2078d1;};return a32_0x22e7();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a32_0x9c7e87 from'prompts';import a32_0x3a5ad6 from'chalk';function validateProfileName(_0x3235b4){const _0x259dfe=a32_0x300d;if(!_0x3235b4||!_0x3235b4[_0x259dfe(0x212)]())return _0x259dfe(0x1f4);const _0x291d35=_0x3235b4[_0x259dfe(0x212)]();if(!/^[a-zA-Z0-9_-]+$/[_0x259dfe(0x22f)](_0x291d35))return _0x259dfe(0x216);if(profileExists(_0x291d35))return _0x259dfe(0x223)+_0x291d35+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a32_0x12b288(0x251)]=a32_0x12b288(0x224);[a32_0x12b288(0x204)]=a32_0x12b288(0x221);async[a32_0x12b288(0x1f6)](_0x59f3d3){const _0x2ee484=a32_0x12b288,{options:_0x14b437,args:_0x27df95}=_0x59f3d3;console[_0x2ee484(0x235)](a32_0x3a5ad6[_0x2ee484(0x262)](_0x2ee484(0x231)));let _0x1e54c3;if(_0x27df95[_0x2ee484(0x242)]>0x0&&_0x27df95[0x0]){const _0xe2d7a1=_0x27df95[0x0]['trim'](),_0x4d2630=validateProfileName(_0xe2d7a1);if(_0x4d2630!==!![])return console[_0x2ee484(0x1fb)](a32_0x3a5ad6['red'](_0x4d2630)),0x1;_0x1e54c3=_0xe2d7a1;}else{const _0x70700=await a32_0x9c7e87({'type':_0x2ee484(0x1f5),'name':_0x2ee484(0x25d),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x70700[_0x2ee484(0x25d)])return console[_0x2ee484(0x235)](_0x2ee484(0x21a)),0x1;_0x1e54c3=_0x70700[_0x2ee484(0x25d)][_0x2ee484(0x212)]();}const _0x151cea=await a32_0x9c7e87({'type':'text','name':_0x2ee484(0x204),'message':_0x2ee484(0x24f)}),_0x351ab8=_0x151cea[_0x2ee484(0x204)]?.[_0x2ee484(0x212)]()||undefined,_0x5b5292=_0x14b437[_0x2ee484(0x202)]||'us01',_0x83903b=await promptSiteSelection(_0x5b5292,_0x1e54c3,_0x2ee484(0x226));if(!_0x83903b)return 0x1;const _0x26453d=resolveSite(_0x83903b);if(isOAuthSupported(_0x26453d)){const _0x57cb78=await a32_0x9c7e87({'type':'select','name':_0x2ee484(0x23f),'message':_0x2ee484(0x263),'choices':[{'title':_0x2ee484(0x20a),'value':'oauth'},{'title':_0x2ee484(0x21d),'value':'apikey'}]});if(!_0x57cb78[_0x2ee484(0x23f)])return console[_0x2ee484(0x235)]('\x0aSetup\x20cancelled'),0x1;if(_0x57cb78[_0x2ee484(0x23f)]===_0x2ee484(0x21b)){if(_0x351ab8){const _0x268610={'site':_0x26453d,'description':_0x351ab8};saveProfileToUserConfig(_0x1e54c3,_0x268610);}return await runOAuthLoginFlow(_0x26453d,_0x1e54c3,_0x14b437[_0x2ee484(0x220)]??LogLevel[_0x2ee484(0x22c)]),0x0;}}console['log'](_0x2ee484(0x25b)+_0x26453d),console[_0x2ee484(0x235)](_0x2ee484(0x236)),console[_0x2ee484(0x235)]('\x20\x20'+getConsoleUrl(_0x26453d,_0x2ee484(0x203)));const _0x14d785=await a32_0x9c7e87({'type':_0x2ee484(0x1fc),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x373415=>{const _0x45de1c=_0x2ee484;if(!_0x373415||!_0x373415[_0x45de1c(0x212)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x14d785[_0x2ee484(0x228)])return console[_0x2ee484(0x235)](_0x2ee484(0x21a)),0x1;const _0x124415=_0x14d785[_0x2ee484(0x228)];console[_0x2ee484(0x235)](_0x2ee484(0x230));try{const _0xf06e21=TDX[_0x2ee484(0x25c)]({'site':_0x26453d,'apiKey':_0x124415[_0x2ee484(0x212)](),'logLevel':_0x14b437['logLevel']??LogLevel['ERROR']}),_0x1ee8c0=await _0xf06e21[_0x2ee484(0x1fa)]['getUserInfo']();console['log'](a32_0x3a5ad6[_0x2ee484(0x24a)]('✓')+_0x2ee484(0x250)+_0x1ee8c0[_0x2ee484(0x208)]+')');const _0x36c035=await isKeychainAvailable();_0x36c035?(await saveAPIKeyAsync(_0x124415['trim'](),_0x26453d,_0x1e54c3),console[_0x2ee484(0x235)](a32_0x3a5ad6[_0x2ee484(0x24a)]('✓')+_0x2ee484(0x243)+_0x1e54c3+')')):(console[_0x2ee484(0x200)](a32_0x3a5ad6[_0x2ee484(0x248)](_0x2ee484(0x222))),console['warn'](a32_0x3a5ad6[_0x2ee484(0x248)](_0x2ee484(0x1fd))));const _0x2e6e62={'site':_0x26453d,..._0x351ab8&&{'description':_0x351ab8}};return saveProfileToUserConfig(_0x1e54c3,_0x2e6e62),console['log'](a32_0x3a5ad6[_0x2ee484(0x24a)]('✓')+'\x20Profile\x20\x27'+_0x1e54c3+_0x2ee484(0x237)),console[_0x2ee484(0x235)](),console[_0x2ee484(0x235)](_0x2ee484(0x21f)),console[_0x2ee484(0x235)](_0x2ee484(0x23b)+_0x1e54c3+_0x2ee484(0x214)),console[_0x2ee484(0x235)](_0x2ee484(0x23b)+_0x1e54c3+_0x2ee484(0x241)),0x0;}catch(_0x5dc915){if(_0x5dc915 instanceof HTTPClientError&&_0x5dc915[_0x2ee484(0x21e)]===0x191)return printAuthError(_0x5dc915),0x1;return console[_0x2ee484(0x1fb)](a32_0x3a5ad6[_0x2ee484(0x25f)](_0x2ee484(0x257)+(_0x5dc915 instanceof Error?_0x5dc915[_0x2ee484(0x21c)]:String(_0x5dc915)))),console[_0x2ee484(0x1fb)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a32_0x300d(_0x158c32,_0x7d51ec){_0x158c32=_0x158c32-0x1f0;const _0x22e78f=a32_0x22e7();let _0x300da5=_0x22e78f[_0x158c32];return _0x300da5;}export class ProfileRemoveCommand extends BaseCommand{[a32_0x12b288(0x251)]=a32_0x12b288(0x219);['description']=a32_0x12b288(0x25a);[a32_0x12b288(0x253)](_0x5d5982){const _0x5889a7=a32_0x12b288,{args:_0x51b668}=_0x5d5982;if(_0x51b668[_0x5889a7(0x242)]===0x0)return _0x5889a7(0x201);return undefined;}async[a32_0x12b288(0x1f6)](_0x1e2fa2){const _0x404717=a32_0x12b288,{args:_0x122bf1}=_0x1e2fa2,_0x4fb182=_0x122bf1[0x0];console[_0x404717(0x235)](a32_0x3a5ad6[_0x404717(0x262)](_0x404717(0x260)));if(!profileExists(_0x4fb182)){console['error'](a32_0x3a5ad6[_0x404717(0x25f)](_0x404717(0x223)+_0x4fb182+_0x404717(0x247))),console[_0x404717(0x235)](_0x404717(0x1f2));const _0x54df5f=listProfiles();if(_0x54df5f[_0x404717(0x242)]===0x0)console[_0x404717(0x235)](_0x404717(0x20f));else for(const _0x4de2d8 of _0x54df5f){console[_0x404717(0x235)](_0x404717(0x252)+_0x4de2d8[_0x404717(0x251)]);}return 0x1;}const _0x4f8c85=await a32_0x9c7e87({'type':_0x404717(0x215),'name':_0x404717(0x215),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x4fb182+'\x27?','initial':![]});if(!_0x4f8c85[_0x404717(0x215)])return console[_0x404717(0x235)](_0x404717(0x232)),0x0;try{removeProfileFromUserConfig(_0x4fb182),console[_0x404717(0x235)](a32_0x3a5ad6[_0x404717(0x24a)]('✓')+_0x404717(0x23a)+_0x4fb182+_0x404717(0x259));}catch(_0x3570a6){return console[_0x404717(0x1fb)](a32_0x3a5ad6['red'](_0x404717(0x25e)+(_0x3570a6 instanceof Error?_0x3570a6[_0x404717(0x21c)]:String(_0x3570a6)))),0x1;}const _0x3a4d17=await isKeychainAvailable();if(_0x3a4d17){const _0xa43bba=await deleteKeychainAPIKey(_0x4fb182);_0xa43bba&&console['log'](a32_0x3a5ad6[_0x404717(0x24a)]('✓')+_0x404717(0x1ff));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a32_0x12b288(0x20e);[a32_0x12b288(0x204)]=a32_0x12b288(0x210);static [a32_0x12b288(0x22d)]=['site',a32_0x12b288(0x225),a32_0x12b288(0x261),a32_0x12b288(0x23e),a32_0x12b288(0x1f3),a32_0x12b288(0x204)];[a32_0x12b288(0x253)](_0x37c78d){const _0xb2c999=a32_0x12b288,{args:_0x1e4fc0,options:_0x417275}=_0x37c78d,_0x4e4a0f=_0x417275[_0xb2c999(0x24b)]||getActiveProfile();if(!_0x4e4a0f)return _0xb2c999(0x213);if(_0x1e4fc0['length']===0x0)return _0xb2c999(0x256)+ProfileSetCommand['VALID_KEYS'][_0xb2c999(0x227)](',\x20');const _0x115c7b=_0x1e4fc0[0x0];if(!_0x115c7b[_0xb2c999(0x258)]('='))return _0xb2c999(0x20b)+ProfileSetCommand[_0xb2c999(0x22d)]['join'](',\x20');const [_0x4e7145]=_0x115c7b['split']('=',0x2);if(!ProfileSetCommand[_0xb2c999(0x22d)][_0xb2c999(0x258)](_0x4e7145))return _0xb2c999(0x229)+_0x4e7145+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xb2c999(0x22d)][_0xb2c999(0x227)](',\x20');return undefined;}async[a32_0x12b288(0x1f6)](_0x3fa51b){const _0x400590=a32_0x12b288,{args:_0x352054,options:_0x17bef1}=_0x3fa51b,_0x2cda36=_0x17bef1[_0x400590(0x24b)]||getActiveProfile(),[_0x374a40,..._0x1f0094]=_0x352054[0x0][_0x400590(0x1fe)]('='),_0x17dbe1=_0x1f0094[_0x400590(0x227)]('=');console[_0x400590(0x235)](a32_0x3a5ad6[_0x400590(0x262)]('tdx:\x20profile\x20set'));if(!profileExists(_0x2cda36)){const _0x3ed48e=await a32_0x9c7e87({'type':'confirm','name':_0x400590(0x25c),'message':_0x400590(0x223)+_0x2cda36+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x3ed48e[_0x400590(0x25c)])return console[_0x400590(0x235)](_0x400590(0x249)),0x1;}const _0x3f7d28=loadProfile(_0x2cda36),_0x5ca9b4=_0x3f7d28?.[_0x400590(0x211)]||{};if(_0x374a40===_0x400590(0x202)){const _0x1e6869=resolveSite(_0x17dbe1);console['log'](_0x400590(0x246)+_0x1e6869+_0x400590(0x20d)),console[_0x400590(0x235)](_0x400590(0x218)),console[_0x400590(0x235)]('\x20\x20'+getConsoleUrl(_0x1e6869,'/app/mp/ak'));const _0x4cd7cd=await a32_0x9c7e87({'type':_0x400590(0x1fc),'name':_0x400590(0x228),'message':_0x400590(0x233),'validate':_0x50cb5a=>{const _0xc773ab=_0x400590;if(!_0x50cb5a||!_0x50cb5a[_0xc773ab(0x212)]())return _0xc773ab(0x254);return!![];}});if(!_0x4cd7cd[_0x400590(0x228)])return console['log'](_0x400590(0x207)),0x1;console[_0x400590(0x235)](_0x400590(0x230));try{const _0x4758e8=TDX[_0x400590(0x25c)]({'site':_0x1e6869,'apiKey':_0x4cd7cd[_0x400590(0x228)][_0x400590(0x212)](),'logLevel':_0x17bef1[_0x400590(0x220)]??LogLevel['ERROR']}),_0xffdc86=await _0x4758e8[_0x400590(0x1fa)][_0x400590(0x23d)]();console[_0x400590(0x235)](a32_0x3a5ad6['green']('✓')+_0x400590(0x250)+_0xffdc86['email']+')');const _0x1a1979=await isKeychainAvailable();_0x1a1979?(await saveAPIKeyAsync(_0x4cd7cd[_0x400590(0x228)][_0x400590(0x212)](),_0x1e6869,_0x2cda36),console['log'](a32_0x3a5ad6['green']('✓')+_0x400590(0x1f7))):console['warn'](a32_0x3a5ad6[_0x400590(0x248)](_0x400590(0x222))),_0x5ca9b4[_0x400590(0x202)]=_0x1e6869;}catch(_0x3e9035){if(_0x3e9035 instanceof HTTPClientError&&_0x3e9035['status']===0x191)return printAuthError(_0x3e9035),0x1;return console['error'](a32_0x3a5ad6[_0x400590(0x25f)]('✗\x20Validation\x20failed:\x20'+(_0x3e9035 instanceof Error?_0x3e9035['message']:String(_0x3e9035)))),console[_0x400590(0x1fb)](_0x400590(0x206)),0x1;}}else _0x5ca9b4[_0x374a40]=_0x17dbe1||undefined;return saveProfileToUserConfig(_0x2cda36,_0x5ca9b4),console[_0x400590(0x235)](a32_0x3a5ad6[_0x400590(0x24a)]('✓')+_0x400590(0x23a)+_0x2cda36+_0x400590(0x239)+_0x374a40+'='+(_0x17dbe1||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a32_0x12b288(0x234);[a32_0x12b288(0x204)]=a32_0x12b288(0x1f9);[a32_0x12b288(0x253)](_0x528573){const _0x2a2623=a32_0x12b288,{args:_0x1fe497}=_0x528573;if(_0x1fe497[_0x2a2623(0x242)]===0x0)return _0x2a2623(0x1f0);return undefined;}async[a32_0x12b288(0x1f6)](_0x5a418e){const _0x4ccf41=a32_0x12b288,{args:_0x54852e,options:_0x42cea7}=_0x5a418e,_0x2acb11=_0x54852e[0x0],_0xab8c11=_0x42cea7['default'];cleanExpiredSessions();if(!profileExists(_0x2acb11)){console[_0x4ccf41(0x1fb)](a32_0x3a5ad6[_0x4ccf41(0x25f)](_0x4ccf41(0x223)+_0x2acb11+_0x4ccf41(0x247))),console[_0x4ccf41(0x235)](_0x4ccf41(0x1f2));const _0x554e61=listProfiles();if(_0x554e61[_0x4ccf41(0x242)]===0x0)console[_0x4ccf41(0x235)](_0x4ccf41(0x20f));else for(const _0x32d1c3 of _0x554e61){console[_0x4ccf41(0x235)](_0x4ccf41(0x252)+_0x32d1c3[_0x4ccf41(0x251)]);}return 0x1;}if(_0xab8c11){const _0x208b2e=a32_0x477203[_0x4ccf41(0x227)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x2acb11),console[_0x4ccf41(0x235)](_0x4ccf41(0x22e)+a32_0x3a5ad6[_0x4ccf41(0x24a)](_0x2acb11)),console[_0x4ccf41(0x235)](a32_0x3a5ad6['dim'](_0x4ccf41(0x255)+_0x208b2e)),0x0;}const _0xbedb06=getSessionID(_0x42cea7[_0x4ccf41(0x240)]);return saveSessionContext({'profile':_0x2acb11},_0x42cea7[_0x4ccf41(0x240)]),console[_0x4ccf41(0x235)](_0x4ccf41(0x1f8)+a32_0x3a5ad6['green'](_0x2acb11)+'\x20'+a32_0x3a5ad6[_0x4ccf41(0x217)](_0x4ccf41(0x23c)+_0xbedb06+')')),console['log'](a32_0x3a5ad6[_0x4ccf41(0x217)](_0x4ccf41(0x245)+_0x2acb11+_0x4ccf41(0x22b))),0x0;}}
|
|
1
|
+
const a32_0x416cce=a32_0x2920;(function(_0x563b00,_0x59b2a0){const _0x467072=a32_0x2920,_0x27261d=_0x563b00();while(!![]){try{const _0x4a6681=-parseInt(_0x467072(0x19e))/0x1*(-parseInt(_0x467072(0x1da))/0x2)+-parseInt(_0x467072(0x1eb))/0x3+parseInt(_0x467072(0x1dc))/0x4+-parseInt(_0x467072(0x196))/0x5*(parseInt(_0x467072(0x1b6))/0x6)+parseInt(_0x467072(0x1b1))/0x7+parseInt(_0x467072(0x1ae))/0x8+parseInt(_0x467072(0x19c))/0x9*(parseInt(_0x467072(0x1bb))/0xa);if(_0x4a6681===_0x59b2a0)break;else _0x27261d['push'](_0x27261d['shift']());}catch(_0x57d712){_0x27261d['push'](_0x27261d['shift']());}}}(a32_0x54a5,0x7b52b));function a32_0x54a5(){const _0x3acdc2=['1574440JspPlS','\x20\x20tdx\x20--profile\x20','yellow','\x20API\x20key\x20saved\x20to\x20system\x20keychain','bold','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','2403KvBZLA','confirm','181JFNSme','\x20API\x20key\x20is\x20valid\x20(User:\x20','create','Removal\x20cancelled','includes','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','select','split','Choose\x20authentication\x20method:','execute','length','OAuth\x20(browser\x20login)','method','\x0aAvailable\x20profiles:','join','profile:create','1751536VbypUd','API\x20Key','Site\x20was\x20not\x20changed.','3911432lyFlDI','log','profile:remove','\x27\x20updated:\x20','\x20\x20(no\x20profiles\x20found)','12lrVAVe','profile','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20--default\x27\x20to\x20save\x20permanently','20260ePDfww','password','profile:use','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','validate','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20set','API\x20key\x20cannot\x20be\x20empty','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20API\x20key\x20removed\x20from\x20system\x20keychain','ERROR','default','profileName','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20Profile\x20\x27','/app/mp/ak','Set\x20a\x20profile\x20configuration\x20value','\x0aSetup\x20cancelled','green','name','dim','VALID_KEYS','Validating\x20API\x20key...','jobs','(cleared)','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20\x27','trim','getUserInfo','email','session','4788Gszofv','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','1006644nebQIE','Default\x20profile\x20set\x20to:\x20','Enter\x20your\x20TD\x20API\x20key:','status','red','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20created','\x27\x20requires\x20API\x20key\x20validation.','tdx.json','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','logLevel','message','Unknown\x20key\x20\x27','parent_segment','\x0aSaved\x20to:\x20','2606184oYoXWi','test','oauth','apiKey','error','Remove\x20a\x20profile','Set\x20session\x20profile','tdx:\x20profile\x20remove','\x27\x20removed\x20from\x20configuration','text','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','config','(session:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','llm_project','database','\x20\x20-\x20','Changing\x20site\x20to\x20\x27','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','✗\x20Validation\x20failed:\x20','\x27\x20does\x20not\x20exist.','site','warn','\x27.\x0a\x0aValid\x20keys:\x20','profile:set','description'];a32_0x54a5=function(){return _0x3acdc2;};return a32_0x54a5();}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a32_0x3cef21 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a32_0x285a44 from'prompts';import a32_0x1028c8 from'chalk';function validateProfileName(_0x466519){const _0x114e5d=a32_0x2920;if(!_0x466519||!_0x466519[_0x114e5d(0x1d6)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x4988d8=_0x466519[_0x114e5d(0x1d6)]();if(!/^[a-zA-Z0-9_-]+$/[_0x114e5d(0x1ec)](_0x4988d8))return _0x114e5d(0x1c3);if(profileExists(_0x4988d8))return _0x114e5d(0x1d5)+_0x4988d8+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a32_0x416cce(0x1ce)]=a32_0x416cce(0x1ad);[a32_0x416cce(0x195)]='Create\x20a\x20new\x20profile';async[a32_0x416cce(0x1a7)](_0x55ecaa){const _0x44dc0b=a32_0x416cce,{options:_0x31a7a9,args:_0x20ce80}=_0x55ecaa;console[_0x44dc0b(0x1b2)](a32_0x1028c8[_0x44dc0b(0x19a)]('tdx:\x20profile\x20create'));let _0x5cbe44;if(_0x20ce80[_0x44dc0b(0x1a8)]>0x0&&_0x20ce80[0x0]){const _0x105288=_0x20ce80[0x0][_0x44dc0b(0x1d6)](),_0x57ece6=validateProfileName(_0x105288);if(_0x57ece6!==!![])return console[_0x44dc0b(0x1ef)](a32_0x1028c8[_0x44dc0b(0x1e0)](_0x57ece6)),0x1;_0x5cbe44=_0x105288;}else{const _0x269cb3=await a32_0x285a44({'type':_0x44dc0b(0x1f4),'name':_0x44dc0b(0x1c7),'message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x269cb3[_0x44dc0b(0x1c7)])return console[_0x44dc0b(0x1b2)](_0x44dc0b(0x1cc)),0x1;_0x5cbe44=_0x269cb3[_0x44dc0b(0x1c7)][_0x44dc0b(0x1d6)]();}const _0xdbf8a8=await a32_0x285a44({'type':_0x44dc0b(0x1f4),'name':'description','message':'Enter\x20description\x20(optional):'}),_0x2ad393=_0xdbf8a8[_0x44dc0b(0x195)]?.['trim']()||undefined,_0x19cddf=_0x31a7a9[_0x44dc0b(0x201)]||'us01',_0x543b9a=await promptSiteSelection(_0x19cddf,_0x5cbe44,'Setup\x20cancelled');if(!_0x543b9a)return 0x1;const _0x572640=resolveSite(_0x543b9a);if(isOAuthSupported(_0x572640)){const _0x272388=await a32_0x285a44({'type':_0x44dc0b(0x1a4),'name':_0x44dc0b(0x1aa),'message':_0x44dc0b(0x1a6),'choices':[{'title':_0x44dc0b(0x1a9),'value':_0x44dc0b(0x1ed)},{'title':_0x44dc0b(0x1af),'value':'apikey'}]});if(!_0x272388[_0x44dc0b(0x1aa)])return console[_0x44dc0b(0x1b2)](_0x44dc0b(0x1cc)),0x1;if(_0x272388['method']==='oauth'){if(_0x2ad393){const _0x1c99a5={'site':_0x572640,'description':_0x2ad393};saveProfileToUserConfig(_0x5cbe44,_0x1c99a5);}return await runOAuthLoginFlow(_0x572640,_0x5cbe44,_0x31a7a9[_0x44dc0b(0x1e6)]??LogLevel[_0x44dc0b(0x1c5)]),0x0;}}console[_0x44dc0b(0x1b2)](_0x44dc0b(0x1d4)+_0x572640),console[_0x44dc0b(0x1b2)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x44dc0b(0x1b2)]('\x20\x20'+getConsoleUrl(_0x572640,_0x44dc0b(0x1ca)));const _0x305d78=await a32_0x285a44({'type':_0x44dc0b(0x1bc),'name':_0x44dc0b(0x1ee),'message':_0x44dc0b(0x1de),'validate':_0x460153=>{const _0x302437=_0x44dc0b;if(!_0x460153||!_0x460153['trim']())return _0x302437(0x1c2);return!![];}});if(!_0x305d78[_0x44dc0b(0x1ee)])return console[_0x44dc0b(0x1b2)](_0x44dc0b(0x1cc)),0x1;const _0x3a5c63=_0x305d78['apiKey'];console['log'](_0x44dc0b(0x1d1));try{const _0x4f99a1=TDX['create']({'site':_0x572640,'apiKey':_0x3a5c63['trim'](),'logLevel':_0x31a7a9[_0x44dc0b(0x1e6)]??LogLevel[_0x44dc0b(0x1c5)]}),_0x328106=await _0x4f99a1['jobs'][_0x44dc0b(0x1d7)]();console[_0x44dc0b(0x1b2)](a32_0x1028c8[_0x44dc0b(0x1cd)]('✓')+_0x44dc0b(0x19f)+_0x328106[_0x44dc0b(0x1d8)]+')');const _0xea40a3=await isKeychainAvailable();_0xea40a3?(await saveAPIKeyAsync(_0x3a5c63[_0x44dc0b(0x1d6)](),_0x572640,_0x5cbe44),console[_0x44dc0b(0x1b2)](a32_0x1028c8[_0x44dc0b(0x1cd)]('✓')+_0x44dc0b(0x1f9)+_0x5cbe44+')')):(console[_0x44dc0b(0x192)](a32_0x1028c8[_0x44dc0b(0x198)](_0x44dc0b(0x1fe))),console[_0x44dc0b(0x192)](a32_0x1028c8[_0x44dc0b(0x198)](_0x44dc0b(0x1db))));const _0x72bd0d={'site':_0x572640,..._0x2ad393&&{'description':_0x2ad393}};return saveProfileToUserConfig(_0x5cbe44,_0x72bd0d),console[_0x44dc0b(0x1b2)](a32_0x1028c8[_0x44dc0b(0x1cd)]('✓')+_0x44dc0b(0x1c9)+_0x5cbe44+_0x44dc0b(0x1e2)),console[_0x44dc0b(0x1b2)](),console[_0x44dc0b(0x1b2)](_0x44dc0b(0x1c8)),console[_0x44dc0b(0x1b2)](_0x44dc0b(0x197)+_0x5cbe44+_0x44dc0b(0x1b8)),console[_0x44dc0b(0x1b2)](_0x44dc0b(0x197)+_0x5cbe44+_0x44dc0b(0x19b)),0x0;}catch(_0x50b581){if(_0x50b581 instanceof HTTPClientError&&_0x50b581[_0x44dc0b(0x1df)]===0x191)return printAuthError(_0x50b581),0x1;return console[_0x44dc0b(0x1ef)](a32_0x1028c8[_0x44dc0b(0x1e0)](_0x44dc0b(0x1ff)+(_0x50b581 instanceof Error?_0x50b581['message']:String(_0x50b581)))),console[_0x44dc0b(0x1ef)](_0x44dc0b(0x1e1)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a32_0x416cce(0x1ce)]=a32_0x416cce(0x1b3);[a32_0x416cce(0x195)]=a32_0x416cce(0x1f0);['validate'](_0x2ad1aa){const _0x18ecda=a32_0x416cce,{args:_0x265571}=_0x2ad1aa;if(_0x265571[_0x18ecda(0x1a8)]===0x0)return _0x18ecda(0x1b9);return undefined;}async['execute'](_0x180493){const _0x3d1eeb=a32_0x416cce,{args:_0x197e3a}=_0x180493,_0x3d0ed4=_0x197e3a[0x0];console[_0x3d1eeb(0x1b2)](a32_0x1028c8['bold'](_0x3d1eeb(0x1f2)));if(!profileExists(_0x3d0ed4)){console[_0x3d1eeb(0x1ef)](a32_0x1028c8[_0x3d1eeb(0x1e0)](_0x3d1eeb(0x1d5)+_0x3d0ed4+_0x3d1eeb(0x200))),console[_0x3d1eeb(0x1b2)](_0x3d1eeb(0x1ab));const _0x3cd0d2=listProfiles();if(_0x3cd0d2[_0x3d1eeb(0x1a8)]===0x0)console['log'](_0x3d1eeb(0x1b5));else for(const _0xdb54ef of _0x3cd0d2){console[_0x3d1eeb(0x1b2)](_0x3d1eeb(0x1fc)+_0xdb54ef[_0x3d1eeb(0x1ce)]);}return 0x1;}const _0x3ca65e=await a32_0x285a44({'type':_0x3d1eeb(0x19d),'name':_0x3d1eeb(0x19d),'message':_0x3d1eeb(0x1f5)+_0x3d0ed4+'\x27?','initial':![]});if(!_0x3ca65e[_0x3d1eeb(0x19d)])return console[_0x3d1eeb(0x1b2)](_0x3d1eeb(0x1a1)),0x0;try{removeProfileFromUserConfig(_0x3d0ed4),console['log'](a32_0x1028c8[_0x3d1eeb(0x1cd)]('✓')+_0x3d1eeb(0x1c9)+_0x3d0ed4+_0x3d1eeb(0x1f3));}catch(_0x4b2c4d){return console[_0x3d1eeb(0x1ef)](a32_0x1028c8[_0x3d1eeb(0x1e0)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x4b2c4d instanceof Error?_0x4b2c4d[_0x3d1eeb(0x1e7)]:String(_0x4b2c4d)))),0x1;}const _0x45bc95=await isKeychainAvailable();if(_0x45bc95){const _0x180a03=await deleteKeychainAPIKey(_0x3d0ed4);_0x180a03&&console[_0x3d1eeb(0x1b2)](a32_0x1028c8[_0x3d1eeb(0x1cd)]('✓')+_0x3d1eeb(0x1c4));}return 0x0;}}function a32_0x2920(_0x242119,_0x9c743f){_0x242119=_0x242119-0x192;const _0x54a53e=a32_0x54a5();let _0x292067=_0x54a53e[_0x242119];return _0x292067;}export class ProfileSetCommand extends BaseCommand{[a32_0x416cce(0x1ce)]=a32_0x416cce(0x194);['description']=a32_0x416cce(0x1cb);static [a32_0x416cce(0x1d0)]=['site',a32_0x416cce(0x1fb),a32_0x416cce(0x1e9),a32_0x416cce(0x1fa),'llm_agent','description'];[a32_0x416cce(0x1bf)](_0x2bbd8c){const _0x3a8245=a32_0x416cce,{args:_0x4bc066,options:_0x3aa9db}=_0x2bbd8c,_0x384649=_0x3aa9db[_0x3a8245(0x1b7)]||getActiveProfile();if(!_0x384649)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x4bc066['length']===0x0)return _0x3a8245(0x1e5)+ProfileSetCommand[_0x3a8245(0x1d0)]['join'](',\x20');const _0x2be1a7=_0x4bc066[0x0];if(!_0x2be1a7[_0x3a8245(0x1a2)]('='))return _0x3a8245(0x1be)+ProfileSetCommand[_0x3a8245(0x1d0)][_0x3a8245(0x1ac)](',\x20');const [_0x247da7]=_0x2be1a7[_0x3a8245(0x1a5)]('=',0x2);if(!ProfileSetCommand[_0x3a8245(0x1d0)][_0x3a8245(0x1a2)](_0x247da7))return _0x3a8245(0x1e8)+_0x247da7+_0x3a8245(0x193)+ProfileSetCommand[_0x3a8245(0x1d0)][_0x3a8245(0x1ac)](',\x20');return undefined;}async['execute'](_0x585960){const _0x23fc0d=a32_0x416cce,{args:_0x5aea77,options:_0x1f3577}=_0x585960,_0x4e7dd6=_0x1f3577[_0x23fc0d(0x1b7)]||getActiveProfile(),[_0x13d54e,..._0x5273c5]=_0x5aea77[0x0][_0x23fc0d(0x1a5)]('='),_0xd63cf1=_0x5273c5['join']('=');console['log'](a32_0x1028c8[_0x23fc0d(0x19a)](_0x23fc0d(0x1c1)));if(!profileExists(_0x4e7dd6)){const _0x49fe4a=await a32_0x285a44({'type':'confirm','name':_0x23fc0d(0x1a0),'message':_0x23fc0d(0x1d5)+_0x4e7dd6+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x49fe4a['create'])return console[_0x23fc0d(0x1b2)]('Operation\x20cancelled'),0x1;}const _0x3a2776=loadProfile(_0x4e7dd6),_0x215af0=_0x3a2776?.[_0x23fc0d(0x1f6)]||{};if(_0x13d54e==='site'){const _0x2a7ea4=resolveSite(_0xd63cf1);console[_0x23fc0d(0x1b2)](_0x23fc0d(0x1fd)+_0x2a7ea4+_0x23fc0d(0x1e3)),console[_0x23fc0d(0x1b2)](_0x23fc0d(0x1c0)),console['log']('\x20\x20'+getConsoleUrl(_0x2a7ea4,_0x23fc0d(0x1ca)));const _0x28cc8b=await a32_0x285a44({'type':'password','name':_0x23fc0d(0x1ee),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x37df65=>{if(!_0x37df65||!_0x37df65['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x28cc8b[_0x23fc0d(0x1ee)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x23fc0d(0x1b2)](_0x23fc0d(0x1d1));try{const _0x1de368=TDX[_0x23fc0d(0x1a0)]({'site':_0x2a7ea4,'apiKey':_0x28cc8b[_0x23fc0d(0x1ee)]['trim'](),'logLevel':_0x1f3577[_0x23fc0d(0x1e6)]??LogLevel[_0x23fc0d(0x1c5)]}),_0x562823=await _0x1de368[_0x23fc0d(0x1d2)][_0x23fc0d(0x1d7)]();console[_0x23fc0d(0x1b2)](a32_0x1028c8[_0x23fc0d(0x1cd)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x562823[_0x23fc0d(0x1d8)]+')');const _0x42829f=await isKeychainAvailable();_0x42829f?(await saveAPIKeyAsync(_0x28cc8b['apiKey'][_0x23fc0d(0x1d6)](),_0x2a7ea4,_0x4e7dd6),console[_0x23fc0d(0x1b2)](a32_0x1028c8[_0x23fc0d(0x1cd)]('✓')+_0x23fc0d(0x199))):console[_0x23fc0d(0x192)](a32_0x1028c8[_0x23fc0d(0x198)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x215af0[_0x23fc0d(0x201)]=_0x2a7ea4;}catch(_0x8140cc){if(_0x8140cc instanceof HTTPClientError&&_0x8140cc[_0x23fc0d(0x1df)]===0x191)return printAuthError(_0x8140cc),0x1;return console['error'](a32_0x1028c8['red'](_0x23fc0d(0x1ff)+(_0x8140cc instanceof Error?_0x8140cc[_0x23fc0d(0x1e7)]:String(_0x8140cc)))),console[_0x23fc0d(0x1ef)](_0x23fc0d(0x1b0)),0x1;}}else _0x215af0[_0x13d54e]=_0xd63cf1||undefined;return saveProfileToUserConfig(_0x4e7dd6,_0x215af0),console[_0x23fc0d(0x1b2)](a32_0x1028c8[_0x23fc0d(0x1cd)]('✓')+'\x20Profile\x20\x27'+_0x4e7dd6+_0x23fc0d(0x1b4)+_0x13d54e+'='+(_0xd63cf1||_0x23fc0d(0x1d3))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a32_0x416cce(0x1ce)]=a32_0x416cce(0x1bd);['description']=a32_0x416cce(0x1f1);[a32_0x416cce(0x1bf)](_0x5a5fa1){const _0x1dfebe=a32_0x416cce,{args:_0x1551fc}=_0x5a5fa1;if(_0x1551fc[_0x1dfebe(0x1a8)]===0x0)return _0x1dfebe(0x1a3);return undefined;}async[a32_0x416cce(0x1a7)](_0x572e01){const _0x3846cf=a32_0x416cce,{args:_0x39f98a,options:_0x144c47}=_0x572e01,_0x1f34c6=_0x39f98a[0x0],_0x7a352a=_0x144c47[_0x3846cf(0x1c6)];cleanExpiredSessions();if(!profileExists(_0x1f34c6)){console[_0x3846cf(0x1ef)](a32_0x1028c8[_0x3846cf(0x1e0)](_0x3846cf(0x1d5)+_0x1f34c6+_0x3846cf(0x200))),console[_0x3846cf(0x1b2)](_0x3846cf(0x1ab));const _0x1fdee7=listProfiles();if(_0x1fdee7['length']===0x0)console['log'](_0x3846cf(0x1b5));else for(const _0x4d1b17 of _0x1fdee7){console['log'](_0x3846cf(0x1fc)+_0x4d1b17[_0x3846cf(0x1ce)]);}return 0x1;}if(_0x7a352a){const _0x5c8e22=a32_0x3cef21['join'](getConfigDir(),_0x3846cf(0x1e4));return saveActiveProfileToUserConfig(_0x1f34c6),console['log'](_0x3846cf(0x1dd)+a32_0x1028c8[_0x3846cf(0x1cd)](_0x1f34c6)),console[_0x3846cf(0x1b2)](a32_0x1028c8[_0x3846cf(0x1cf)](_0x3846cf(0x1ea)+_0x5c8e22)),0x0;}const _0x4c9014=getSessionID(_0x144c47['session']);return saveSessionContext({'profile':_0x1f34c6},_0x144c47[_0x3846cf(0x1d9)]),console[_0x3846cf(0x1b2)]('Session\x20profile\x20set\x20to:\x20'+a32_0x1028c8['green'](_0x1f34c6)+'\x20'+a32_0x1028c8[_0x3846cf(0x1cf)](_0x3846cf(0x1f7)+_0x4c9014+')')),console[_0x3846cf(0x1b2)](a32_0x1028c8['dim'](_0x3846cf(0x1f8)+_0x1f34c6+_0x3846cf(0x1ba))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x5830e0=a33_0x52b3;(function(_0x24e749,_0x128d5e){const _0x5adbaa=a33_0x52b3,_0x58778e=_0x24e749();while(!![]){try{const _0x5ca684=-parseInt(_0x5adbaa(0x19c))/0x1+parseInt(_0x5adbaa(0x197))/0x2+parseInt(_0x5adbaa(0x198))/0x3*(-parseInt(_0x5adbaa(0x195))/0x4)+-parseInt(_0x5adbaa(0x19d))/0x5*(-parseInt(_0x5adbaa(0x1a1))/0x6)+-parseInt(_0x5adbaa(0x18d))/0x7*(-parseInt(_0x5adbaa(0x19e))/0x8)+parseInt(_0x5adbaa(0x193))/0x9*(parseInt(_0x5adbaa(0x194))/0xa)+-parseInt(_0x5adbaa(0x187))/0xb;if(_0x5ca684===_0x128d5e)break;else _0x58778e['push'](_0x58778e['shift']());}catch(_0x35ff08){_0x58778e['push'](_0x58778e['shift']());}}}(a33_0xbd4b,0xac40b));import{BaseCommand}from'./command.js';function a33_0x52b3(_0x31e0c2,_0x39c996){_0x31e0c2=_0x31e0c2-0x187;const _0xbd4b47=a33_0xbd4b();let _0x52b37e=_0xbd4b47[_0x31e0c2];return _0x52b37e;}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a33_0xbd4b(){const _0x4c3a43=['214332yKOeEG','600852zKrbjG','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','green','1016433IbJmGR','5WvMalz','8JdxUnI','\x20\x20Global:\x20~/.config/tdx/tdx.json','site','7074834unzNWh','18193021AnUtmx','error','config','dim','log','List\x20all\x20available\x20profiles','6304949iSRBMA','Error:\x20','description','length','map','execute','12502467yMbYpA','10kUoSiR','4dXrzVn','message'];a33_0xbd4b=function(){return _0x4c3a43;};return a33_0xbd4b();}import a33_0x3f7a73 from'chalk';export class ProfilesCommand extends BaseCommand{[a33_0x5830e0(0x199)]='profiles';[a33_0x5830e0(0x18f)]=a33_0x5830e0(0x18c);async[a33_0x5830e0(0x192)](_0x29497d){const _0x2ced18=a33_0x5830e0,{options:_0x101016}=_0x29497d;try{const _0x5cab63=listProfiles(),_0x5b3809=getActiveProfile();if(_0x5cab63[_0x2ced18(0x190)]===0x0)return console['log'](_0x2ced18(0x19a)),console[_0x2ced18(0x18b)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log'](_0x2ced18(0x19f)),0x0;const _0x32edb2=_0x5cab63[_0x2ced18(0x191)](_0x10dd79=>{const _0x31075d=_0x2ced18,_0x243848=_0x10dd79['name']===_0x5b3809,_0x3c0659=getProfileParams(_0x10dd79[_0x31075d(0x189)]);return{'name':_0x10dd79['name'],'active':_0x243848,'scope':_0x10dd79['scope'],'description':_0x10dd79[_0x31075d(0x189)][_0x31075d(0x18f)]||'','params':_0x3c0659};});if(isStructuredFormat(_0x101016))await handleSDKOutput(_0x32edb2,_0x101016);else for(const _0x56f2d5 of _0x5cab63){const _0x23726d=_0x56f2d5[_0x2ced18(0x199)]===_0x5b3809?a33_0x3f7a73[_0x2ced18(0x19b)]('\x20✓'):'',_0x223b67=_0x56f2d5[_0x2ced18(0x189)][_0x2ced18(0x1a0)]?a33_0x3f7a73[_0x2ced18(0x18a)]('\x20'+_0x56f2d5[_0x2ced18(0x189)][_0x2ced18(0x1a0)]):'',_0x1e8889=_0x56f2d5[_0x2ced18(0x189)][_0x2ced18(0x18f)]?a33_0x3f7a73[_0x2ced18(0x18a)]('\x20\x20'+_0x56f2d5[_0x2ced18(0x189)][_0x2ced18(0x18f)]):'';console[_0x2ced18(0x18b)]('👤\x20'+_0x56f2d5[_0x2ced18(0x199)]+_0x23726d+_0x223b67+_0x1e8889);}return 0x0;}catch(_0x11f5d2){return _0x11f5d2 instanceof Error&&console[_0x2ced18(0x188)](_0x2ced18(0x18e)+_0x11f5d2[_0x2ced18(0x196)]),0x1;}}}
|