@treasuredata/tdx 2026.3.10 → 2026.3.12
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/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/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_0x4e3584=a30_0x3107;(function(_0x2a65e0,_0x33a84b){const _0x5a5d3a=a30_0x3107,_0x176e4a=_0x2a65e0();while(!![]){try{const _0x357e7f=-parseInt(_0x5a5d3a(0x149))/0x1+parseInt(_0x5a5d3a(0x251))/0x2*(-parseInt(_0x5a5d3a(0x1d5))/0x3)+parseInt(_0x5a5d3a(0x22b))/0x4*(-parseInt(_0x5a5d3a(0x1e6))/0x5)+-parseInt(_0x5a5d3a(0x288))/0x6*(-parseInt(_0x5a5d3a(0x189))/0x7)+-parseInt(_0x5a5d3a(0x1a0))/0x8*(-parseInt(_0x5a5d3a(0x1f6))/0x9)+-parseInt(_0x5a5d3a(0x22f))/0xa+parseInt(_0x5a5d3a(0x29a))/0xb;if(_0x357e7f===_0x33a84b)break;else _0x176e4a['push'](_0x176e4a['shift']());}catch(_0x3dee95){_0x176e4a['push'](_0x176e4a['shift']());}}}(a30_0x1add,0x42aad));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x520b09 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_0x5f540c from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';function a30_0x1add(){const _0x208d3e=['displayColumns','\x20to\x20push\x20the\x20configuration','Creating\x20parent\x20segment\x20\x27','dim','\x20parent\x20segment','localeCompare','population','realtime','customerPercent','\x20\x20\x20','Master:','toLocaleString','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','yellow','ps:rt:validate','Resolving\x20parent\x20segment\x20\x27','Columns:','trim','`\x20to\x20download\x20the\x20configuration\x20first','Available\x20attributes:','Personalization\x20service\x20description','segment:parent:list','repeat','\x27\x20with\x20ID:\x20','Behaviors','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','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','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','3UpGvll','realtime_enabled','execute','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','green','stitchingKeys','displayValidateResults','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','Coverage:','displayPreviewHints','/\x20directories\x20exist.','behaviorsFile','Error:','interval','segment:parent:validate','displayBehaviorsStats','segment','215YYuncq','column_type','👥\x20','ignore','using\x20the\x20default\x20path:\x20','Options:','message','sampleData','\x0a\x20\x20]\x0a}\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','getOutputDatabaseName','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','YAML\x20file:\x20','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','resolveParentId','pullParentYaml','3523761zivZwT','\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','.yaml','parentSegment','\x20Added\x20RT\x202.0\x20template\x20section','last_page_viewed','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','addBehaviorsFile','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','segment:parent:preview','error','Options:\x0a','sourceTableValid','\x0a⚠️\x20\x20Both\x20','\x0a⚠️\x20\x20Migrating:\x20','Parent\x20segment:\x20','allValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20--attribute\x20\x22','query','win32','\x5c$&','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','\x20--behavior\x20\x22','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','No\x20personalization\x20services\x20configured','single','Fetching\x20customers\x20schema...','description','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','text','Validate:','SELECT\x20*\x20FROM\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','run','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','enriched','No\x20RT-enabled\x20parent\x20segments\x20found','\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','\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','rowCount','Master\x20Table','preview','sections','number','\x20Opening\x20','/\x20directory.\x0a','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Overwrite\x20\x27','stats','FINISHED','personalization_services','database','26480gpiKTf','replace','Options\x20(one\x20required):\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','556570hssSrz','\x20rows)','Listing\x20RT-enabled\x20parent\x20segments...','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x0aNo\x20sample\x20data\x20available','Error:\x20Parent\x20segment\x20name\x20is\x20required','Creating','Error\x20reading\x20file:\x20','workflowSessionId','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','length','Listing\x20parent\x20segments\x20matching\x20\x27','workflowAttemptId','\x20tdx\x20wf\x20attempt\x20','customers','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','List\x20available\x20fields\x20for\x20segmentation','displayRealtimeInfo','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Attributes','totalEvents','true','segment:parent:push','cyan','limit','To\x20view\x20sample\x20data:','displayMasterInfo','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','segment:parent:update','indexOf','Output\x20file:\x20','886186DogllF','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','apply','\x20service(s)\x20configured','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Database:\x20','\x20field','Available\x20behaviors:','\x20\x20\x20\x20','push','double','Aborted.','\x20+\x20[','stop','Attribute:','endsWith','displayPreviewResults','{\x0a\x20\x20\x22database\x22:\x20\x22','✔\x20Created\x20parent\x20segment\x20\x27','\x0aChanges\x20to\x20\x27','\x20Context\x20set:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Master\x20+\x20Attributes','/app/workflows/','darwin','%)\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','column_name','\x20Added\x20personalization\x20template\x20to\x20','Show\x20parent\x20segment\x20details','SQL\x20query:\x0a','segment:parent:show','Listing\x20personalization\x20services\x20for\x20\x27','\x20=\x20','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','collectSchema','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','log','Validating\x20configuration...','\x27\x20is\x20up\x20to\x20date','/sessions/','displaySampleData','parent_id','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','/{name}.yml\x0a','Attempt:','Fetching\x20sample\x20data...','status','.customers)','customerGroupFile','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','idStitching','Preview:','match','6VXMcor','segment:parent:create','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','/app/dw/parentSegments/','\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','Fetching\x20SQL\x20for\x20\x27','columns','master','scheduleOption','parent_segment','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x0aChanges\x20to\x20apply\x20to\x20\x27','Error\x20parsing\x20YAML:\x20','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','sourceTableError','✔\x20Found\x20','web','6560818HBrjTC','\x20RT-enabled\x20parent\x20segment','Error:\x20--database\x20and\x20--table\x20are\x20required','✔\x20Updated\x20parent\x20segment\x20\x27','Pattern:\x20','attribute','behavior_','list','Site:\x20','validateParentYaml','ps:pz:init','Validating\x20RT\x20configuration...','Source:','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','RT\x202.0:','\x22,\x20\x22type\x22:\x20\x22','Behavior:','displayAttributesStats','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x27...','map','open','schemaValid','\x20behaviors','Join:','utf-8','-1d','matchedCount','formatSchemaJson','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','audienceId','coveragePercent','\x27\x20and\x20run\x20workflow?','\x20\x20Columns:\x20','tdx\x20ps\x20push\x20','personalizationServices','⚡\x20Enabled','Rows:','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','Table:\x20','customersWithEvents','string','events','jobId','\x20--interval\x20','pushParentYaml','⚡\x20Not\x20enabled','.yml','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','tdx\x20ps\x20preview\x20','verbose','site','personalization','\x20kill','\x20\x20\x20\x20-\x20','\x20--behavior\x20\x22<name>\x22','filter','in\x20','segment:parent:view','listFields','yes','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','joinKey','previewParentYaml','Personalization:','\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','Created','timezone','Join\x20on:','trigger_event','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Audience\x20ID:','Errors:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','start','Events:','84847goIegc','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','getParentSQL','realtime:','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','workflowId','✔\x20No\x20changes\x20-\x20\x27','\x20trigger=','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Get\x20SQL\x20query\x20for\x20parent\x20segment','addAttributesFile','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','parent_segments','\x0a✔\x20Workflow\x20started','Attributes:','listParents','reduce','My\x20Service','json','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','segment:parent:sql','data','sort','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x27\x20is\x20already\x20up\x20to\x20date','toFixed','Listing\x20fields\x20for\x20\x27','displaySummary','\x20\x20Database:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','segment:parent:run','join','Updated','\x20Configuration\x20is\x20valid','segment:parent:desc','Customers:','\x20parent\x20segment\x20\x27','format','addBehaviors','keys','unref','table','Found\x20YAML\x20file:\x20','ps:rt:list','red','ID\x20Stitching:','\x0a\x20\x20\x20\x20]','✔\x20Query\x20completed:\x20Processed\x20','Apply\x20changes\x20to\x20\x27','bold','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','ps:pz:list','Analyzing\x20changes...','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','xdg-open','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Updating\x20parent\x20segment\x20\x27','attributesFile','Listing\x20parent\x20segments...','label','1073513thvBcE','test','createParent','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','SELECT\x20*\x20FROM\x20(\x0a','\x20RT\x20configuration\x20is\x20valid','\x20\x20Note:\x20','behavior','name','all','/\x20→\x20','scheduleType','primaryKey','\x20\x201.\x20Edit\x20','errors','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','column','updateParent','attributes','Enriched:','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','getBehaviorNames','8xOFQSx','page_view','\x20rows\x20','/attempt/','Updating','valid','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','/\x20and\x20','jsonl','customerGroup','Error:\x20File\x20not\x20found:\x20','runParent','behaviors','Create\x20parent\x20segment\x20\x27','getParentFull','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Status:','foreignKey','Name:\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','\x20\x20No\x20sample\x20data\x20available','type','output'];a30_0x1add=function(){return _0x208d3e;};return a30_0x1add();}const PARENT_SEGMENT_DIR=a30_0x4e3584(0x155),LEGACY_PARENT_SEGMENT_DIR=a30_0x4e3584(0x292);function openBrowser(_0x4cac7f){const _0x39b2f2=a30_0x4e3584,_0x225f50=process['platform'],_0x542b6a=_0x225f50===_0x39b2f2(0x269)?_0x39b2f2(0x2af):_0x225f50===_0x39b2f2(0x20a)?_0x39b2f2(0x147):_0x39b2f2(0x183);spawn(_0x542b6a,[_0x4cac7f],{'detached':!![],'stdio':_0x39b2f2(0x1e9)})[_0x39b2f2(0x172)]();}function migrateLegacyDirectory(){const _0x2b9f9d=a30_0x4e3584;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x28f0e5=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x28f0e5['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2b9f9d(0x200)](a30_0x5f540c['yellow'](_0x2b9f9d(0x203)+LEGACY_PARENT_SEGMENT_DIR+_0x2b9f9d(0x1a7)+PARENT_SEGMENT_DIR+_0x2b9f9d(0x1df))),console[_0x2b9f9d(0x200)](a30_0x5f540c[_0x2b9f9d(0x1bb)](_0x2b9f9d(0x28c)+LEGACY_PARENT_SEGMENT_DIR+_0x2b9f9d(0x224))),![];console['error'](a30_0x5f540c[_0x2b9f9d(0x1c5)](_0x2b9f9d(0x204)+LEGACY_PARENT_SEGMENT_DIR+_0x2b9f9d(0x194)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2b9f9d(0x200)](a30_0x5f540c[_0x2b9f9d(0x1d9)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2b89c4){const _0x1c56fc=_0x2b89c4 instanceof Error?_0x2b89c4[_0x2b9f9d(0x1ec)]:String(_0x2b89c4);return console['error'](a30_0x5f540c[_0x2b9f9d(0x176)](_0x2b9f9d(0x217)+_0x1c56fc+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x504a7b){const _0x20b3e8=a30_0x4e3584;return migrateLegacyDirectory(),super[_0x20b3e8(0x218)](_0x504a7b);}}function resolveYamlFile(_0x4aee8e){const _0x50d5c4=a30_0x4e3584;if(_0x4aee8e[_0x50d5c4(0x260)](_0x50d5c4(0x12b))||_0x4aee8e[_0x50d5c4(0x260)](_0x50d5c4(0x1f8)))return _0x4aee8e;return a30_0x520b09[_0x50d5c4(0x169)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4aee8e)+_0x50d5c4(0x12b));}function formatProgressMessage(_0x120626){const _0x147549=a30_0x4e3584,_0x5043b8=_0x120626[_0x147549(0x287)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5043b8){const [,_0x3c81e2,_0x21fb61,_0x31d04b='']=_0x5043b8;return a30_0x5f540c[_0x147549(0x1bb)](_0x3c81e2+':')+'\x20'+_0x21fb61+a30_0x5f540c['dim'](_0x31d04b);}return a30_0x5f540c['dim'](_0x120626);}function showFileNotFoundError(_0x2805ef,_0x2d5051){const _0x3ed618=a30_0x4e3584;console[_0x3ed618(0x200)](a30_0x5f540c['red'](_0x3ed618(0x1aa)+_0x2805ef+'\x0a')),console[_0x3ed618(0x200)](a30_0x5f540c[_0x3ed618(0x249)](_0x3ed618(0x18d)+_0x2d5051+_0x3ed618(0x1ca)));}function displayRealtimeValidation(_0x84eb61){const _0x41bd41=a30_0x4e3584;if(!_0x84eb61['realtime'])return;const _0x10e900=_0x84eb61[_0x41bd41(0x1bf)],_0x4b55bc=_0x10e900['enabled']?a30_0x5f540c[_0x41bd41(0x1d9)](_0x41bd41(0x2be)):a30_0x5f540c[_0x41bd41(0x1c5)](_0x41bd41(0x12a));console[_0x41bd41(0x200)]('\x0a'+a30_0x5f540c[_0x41bd41(0x1bb)](_0x41bd41(0x2a8))+'\x20'+_0x4b55bc);if(_0x10e900['events']&&_0x10e900['events'][_0x41bd41(0x23b)]>0x0){console['error']('\x20\x20'+a30_0x5f540c[_0x41bd41(0x1bb)](_0x41bd41(0x148))+'\x20'+_0x10e900[_0x41bd41(0x126)]['length']+'\x20configured');for(const _0x31ca7a of _0x10e900['events']){const _0x39f929=_0x31ca7a[_0x41bd41(0x202)]===![]?a30_0x5f540c['red']('✘'):a30_0x5f540c[_0x41bd41(0x1d9)]('✔');console[_0x41bd41(0x200)]('\x20\x20\x20\x20'+_0x39f929+'\x20'+_0x31ca7a[_0x41bd41(0x192)]),_0x31ca7a['sourceTableError']&&console[_0x41bd41(0x200)]('\x20\x20\x20\x20\x20\x20'+a30_0x5f540c[_0x41bd41(0x176)](_0x31ca7a[_0x41bd41(0x297)]));}}if(_0x10e900[_0x41bd41(0x19c)]&&_0x10e900[_0x41bd41(0x19c)][_0x41bd41(0x23b)]>0x0){console['error']('\x20\x20'+a30_0x5f540c[_0x41bd41(0x1bb)](_0x41bd41(0x157))+'\x20'+_0x10e900[_0x41bd41(0x19c)][_0x41bd41(0x23b)]+'\x20configured');for(const _0x2ae199 of _0x10e900[_0x41bd41(0x19c)]){const _0x1a94b2=_0x2ae199[_0x41bd41(0x1a5)]?a30_0x5f540c[_0x41bd41(0x1d9)]('✔'):a30_0x5f540c[_0x41bd41(0x176)]('✘');console['error'](_0x41bd41(0x259)+_0x1a94b2+'\x20'+_0x2ae199[_0x41bd41(0x192)]+'\x20'+a30_0x5f540c['dim']('('+_0x2ae199[_0x41bd41(0x1b6)]+')'));}}if(_0x10e900['idStitching']){const _0x30c535=_0x10e900['idStitching']['stitchingKeys']?.[_0x41bd41(0x23b)]?_0x41bd41(0x25d)+_0x10e900[_0x41bd41(0x285)][_0x41bd41(0x1da)][_0x41bd41(0x169)](',\x20')+']':'';console[_0x41bd41(0x200)]('\x20\x20'+a30_0x5f540c['dim'](_0x41bd41(0x177))+'\x20'+_0x10e900[_0x41bd41(0x285)][_0x41bd41(0x196)]+_0x30c535);}if(_0x10e900['personalizationServices']&&_0x10e900['personalizationServices'][_0x41bd41(0x23b)]>0x0){console[_0x41bd41(0x200)]('\x20\x20'+a30_0x5f540c[_0x41bd41(0x1bb)](_0x41bd41(0x13c))+'\x20'+_0x10e900[_0x41bd41(0x2bd)][_0x41bd41(0x23b)]+'\x20service'+(_0x10e900[_0x41bd41(0x2bd)][_0x41bd41(0x23b)]!==0x1?'s':''));for(const _0x24ac74 of _0x10e900[_0x41bd41(0x2bd)]){console[_0x41bd41(0x200)]('\x20\x20\x20\x20-\x20'+_0x24ac74[_0x41bd41(0x192)]);}}}function showParentSegmentNotSetError(_0x42afaa){const _0x1b9624=a30_0x4e3584;console[_0x1b9624(0x200)](a30_0x5f540c[_0x1b9624(0x1c5)](_0x1b9624(0x199))),console[_0x1b9624(0x200)](_0x42afaa);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x1cd);[a30_0x4e3584(0x212)]='List\x20parent\x20segments';async[a30_0x4e3584(0x1d7)](_0x5313f3){const _0x4c2000=a30_0x4e3584,{options:_0x19ba8c,args:_0x48d78a,tdx:_0x389055}=_0x5313f3,_0x3579d7=_0x48d78a[0x0];_0x19ba8c['verbose']&&(console[_0x4c2000(0x200)](_0x4c2000(0x2a2)+_0x19ba8c[_0x4c2000(0x12f)]),_0x3579d7&&console[_0x4c2000(0x200)](_0x4c2000(0x29e)+_0x3579d7));const _0x385e07=await withSpinner(_0x3579d7?_0x4c2000(0x23c)+_0x3579d7+_0x4c2000(0x2ad):_0x4c2000(0x187),()=>_0x389055[_0x4c2000(0x1e5)][_0x4c2000(0x158)](),{'verbose':_0x19ba8c[_0x4c2000(0x12e)]});let _0x483a48=_0x385e07[_0x4c2000(0x15e)];if(_0x3579d7){const _0x433387=_0x3579d7['replace'](/[.+^${}()|[\]\\]/g,_0x4c2000(0x20b))[_0x4c2000(0x22c)](/\*/g,'.*')[_0x4c2000(0x22c)](/\?/g,'.'),_0x15b8b6=new RegExp('^'+_0x433387+'$','i');_0x483a48=_0x483a48[_0x4c2000(0x134)](_0xfc8257=>_0x15b8b6[_0x4c2000(0x18a)](_0xfc8257[_0x4c2000(0x19c)][_0x4c2000(0x192)]));}_0x483a48[_0x4c2000(0x15f)]((_0x5114c8,_0x1406a7)=>_0x5114c8[_0x4c2000(0x19c)]['name'][_0x4c2000(0x1bd)](_0x1406a7['attributes']['name'])),console[_0x4c2000(0x200)](_0x4c2000(0x298)+_0x483a48['length']+_0x4c2000(0x1bc)+(_0x483a48[_0x4c2000(0x23b)]!==0x1?'s':''));const _0x5d853b=_0xcbec6f=>{const _0x241edd=_0x4c2000;return getConsoleNextUrl(_0x19ba8c[_0x241edd(0x12f)],_0x241edd(0x28b)+_0xcbec6f);};if(_0x19ba8c[_0x4c2000(0x16f)]===_0x4c2000(0x15b)||_0x19ba8c[_0x4c2000(0x16f)]===_0x4c2000(0x1a8)){const _0x124a35=_0x483a48['map'](_0x2ac798=>({..._0x2ac798,'url':_0x5d853b(_0x2ac798['id'])}));await handleSDKOutput(_0x124a35,_0x19ba8c);}else{if(_0x483a48[_0x4c2000(0x23b)]===0x0)_0x3579d7?console[_0x4c2000(0x277)](_0x4c2000(0x1b3)+_0x3579d7):console[_0x4c2000(0x277)]('No\x20parent\x20segments\x20found');else for(const _0x599545 of _0x483a48){const _0x5dc5e3=_0x599545[_0x4c2000(0x19c)]['population']?a30_0x5f540c[_0x4c2000(0x1bb)]('\x20('+formatRows(_0x599545[_0x4c2000(0x19c)][_0x4c2000(0x1be)])+')'):'',_0x55fc05=hyperlink(_0x599545[_0x4c2000(0x19c)][_0x4c2000(0x192)],_0x5d853b(_0x599545['id']));console[_0x4c2000(0x277)](_0x4c2000(0x1e8)+_0x55fc05+_0x5dc5e3);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x289);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x161);async[a30_0x4e3584(0x1d7)](_0x1c80da){const _0x137222=a30_0x4e3584,{options:_0x59f305,args:_0x138c54,tdx:_0x33b79a}=_0x1c80da;console[_0x137222(0x200)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x137222(0x252));const _0x4caf28=_0x59f305;if(_0x138c54[_0x137222(0x23b)]===0x0)return console[_0x137222(0x200)](a30_0x5f540c[_0x137222(0x176)](_0x137222(0x234))),console[_0x137222(0x200)](_0x137222(0x14a)),0x1;const _0x3c751c=_0x138c54[0x0];if(!_0x4caf28[_0x137222(0x22a)]||!_0x4caf28[_0x137222(0x173)])return console[_0x137222(0x200)](_0x137222(0x29c)),console[_0x137222(0x200)](_0x137222(0x14a)),0x1;_0x4caf28[_0x137222(0x12e)]&&(console[_0x137222(0x200)](_0x137222(0x2a2)+_0x4caf28[_0x137222(0x12f)]),console[_0x137222(0x200)](_0x137222(0x1b2)+_0x3c751c),console[_0x137222(0x200)](_0x137222(0x256)+_0x4caf28[_0x137222(0x22a)]),console[_0x137222(0x200)](_0x137222(0x123)+_0x4caf28[_0x137222(0x173)]));const _0x5c23ee=await loadJSONFromOptions(_0x4caf28[_0x137222(0x19c)],_0x4caf28[_0x137222(0x186)]),_0x798288=await loadJSONFromOptions(_0x4caf28[_0x137222(0x1ac)],_0x4caf28[_0x137222(0x1e0)]),_0x4838c1=await loadJSONFromOptions(_0x4caf28[_0x137222(0x1a9)],_0x4caf28[_0x137222(0x283)]),_0x56797d={'name':_0x3c751c,'description':_0x4caf28[_0x137222(0x212)],'scheduleType':_0x4caf28[_0x137222(0x195)],'scheduleOption':_0x4caf28[_0x137222(0x291)],'timezone':_0x4caf28[_0x137222(0x13f)],'master':{'parentDatabaseName':_0x4caf28[_0x137222(0x22a)],'parentTableName':_0x4caf28['table']},'attributes':_0x5c23ee,'behaviors':_0x798288,'customerGroup':_0x4838c1},_0x3b1008=await withSpinner(_0x137222(0x1ba)+_0x3c751c+_0x137222(0x2ad),()=>_0x33b79a[_0x137222(0x1e5)][_0x137222(0x18b)](_0x56797d),{'verbose':_0x59f305[_0x137222(0x12e)]}),_0x21b34f=_0x3b1008[_0x137222(0x15e)];return console[_0x137222(0x200)](_0x137222(0x263)+_0x21b34f[_0x137222(0x192)]+_0x137222(0x1cf)+_0x21b34f['id']),await handleSDKOutput([_0x21b34f],_0x59f305),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a30_0x4e3584(0x24e);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x12c);async[a30_0x4e3584(0x1d7)](_0x4233c1){const _0x2a7433=a30_0x4e3584,{options:_0x4624a3,args:_0x48be83,tdx:_0x36583b}=_0x4233c1;console[_0x2a7433(0x200)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x2a7433(0x232)+_0x2a7433(0x252));const _0x5a3959=_0x4624a3;if(_0x48be83[_0x2a7433(0x23b)]===0x0)return console[_0x2a7433(0x200)](a30_0x5f540c[_0x2a7433(0x176)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x2a7433(0x200)](_0x2a7433(0x1d8)),0x1;const _0x293468=_0x48be83[0x0];_0x5a3959[_0x2a7433(0x12e)]&&(console['error'](_0x2a7433(0x2a2)+_0x5a3959[_0x2a7433(0x12f)]),console[_0x2a7433(0x200)](_0x2a7433(0x205)+_0x293468));const _0x24bd7b=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x293468+'\x27...',()=>_0x36583b[_0x2a7433(0x1e5)][_0x2a7433(0x1ae)](_0x293468),{'verbose':_0x5a3959[_0x2a7433(0x12e)]}),_0x3e7ab8=_0x24bd7b[_0x2a7433(0x15e)],_0x2eaec0=await loadJSONFromOptions(_0x5a3959['addAttributes'],_0x5a3959[_0x2a7433(0x153)]),_0x2bf1b2=await loadJSONFromOptions(_0x5a3959[_0x2a7433(0x170)],_0x5a3959[_0x2a7433(0x1fd)]),_0x3c2cf9={'name':_0x3e7ab8[_0x2a7433(0x192)],'description':_0x5a3959[_0x2a7433(0x212)]!==undefined?_0x5a3959['description']:_0x3e7ab8[_0x2a7433(0x212)],'scheduleType':_0x5a3959[_0x2a7433(0x195)]!==undefined?_0x5a3959['scheduleType']:_0x3e7ab8[_0x2a7433(0x195)],'scheduleOption':_0x5a3959[_0x2a7433(0x291)]!==undefined?_0x5a3959[_0x2a7433(0x291)]:_0x3e7ab8[_0x2a7433(0x291)],'timezone':_0x5a3959[_0x2a7433(0x13f)]!==undefined?_0x5a3959[_0x2a7433(0x13f)]:_0x3e7ab8[_0x2a7433(0x13f)],'master':_0x3e7ab8['master'],'attributes':_0x2eaec0?[..._0x3e7ab8[_0x2a7433(0x19c)]||[],..._0x2eaec0]:_0x3e7ab8[_0x2a7433(0x19c)],'behaviors':_0x2bf1b2?[..._0x3e7ab8['behaviors']||[],..._0x2bf1b2]:_0x3e7ab8[_0x2a7433(0x1ac)],'customerGroup':_0x3e7ab8[_0x2a7433(0x1a9)]},_0x575e4f=await withSpinner(_0x2a7433(0x185)+_0x293468+_0x2a7433(0x2ad),()=>_0x36583b[_0x2a7433(0x1e5)][_0x2a7433(0x19b)](_0x293468,_0x3c2cf9),{'verbose':_0x5a3959[_0x2a7433(0x12e)]}),_0x1a8ad6=_0x575e4f[_0x2a7433(0x15e)];return console[_0x2a7433(0x200)](_0x2a7433(0x29d)+_0x1a8ad6['name']+'\x27'),await handleSDKOutput([_0x1a8ad6],_0x5a3959),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x4e3584(0x192)]='segment:parent:pull';[a30_0x4e3584(0x212)]=a30_0x4e3584(0x255);async['execute'](_0x41d206){const _0xdcd8e2=a30_0x4e3584,{options:_0x2c0af4,args:_0x1c624d,tdx:_0x368662}=_0x41d206,_0x1b9d8e=_0x2c0af4,_0x315116=_0x1c624d[0x0]||_0x2c0af4[_0xdcd8e2(0x1f9)];if(!_0x315116)return showParentSegmentNotSetError(_0xdcd8e2(0x18c)+_0xdcd8e2(0x28a)),0x1;if(_0x1b9d8e['use']&&_0x1b9d8e[_0xdcd8e2(0x1b7)])return console[_0xdcd8e2(0x200)](a30_0x5f540c['red'](_0xdcd8e2(0x219))),console[_0xdcd8e2(0x200)](a30_0x5f540c[_0xdcd8e2(0x1bb)](_0xdcd8e2(0x17f))),console[_0xdcd8e2(0x200)](a30_0x5f540c[_0xdcd8e2(0x1bb)](_0xdcd8e2(0x1ea)+PARENT_SEGMENT_DIR+_0xdcd8e2(0x27e))),console[_0xdcd8e2(0x200)](a30_0x5f540c[_0xdcd8e2(0x249)](_0xdcd8e2(0x1fc))),0x1;const _0x399790=_0x1b9d8e[_0xdcd8e2(0x1b7)]||a30_0x520b09['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x315116)+_0xdcd8e2(0x12b));_0x1b9d8e[_0xdcd8e2(0x12e)]&&(console[_0xdcd8e2(0x200)](_0xdcd8e2(0x2a2)+_0x1b9d8e['site']),console[_0xdcd8e2(0x200)]('Parent\x20segment:\x20'+_0x315116),console['error'](_0xdcd8e2(0x250)+_0x399790));const _0x281eb2=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x315116+_0xdcd8e2(0x2ad),()=>_0x368662['segment'][_0xdcd8e2(0x1f5)](_0x315116),{'verbose':_0x1b9d8e[_0xdcd8e2(0x12e)]}),_0xf602f3=_0x281eb2['data'];if(existsSync(_0x399790)){const _0x12e56c=readFileSync(_0x399790,_0xdcd8e2(0x2b3)),_0x2f1b36=generateDiff(_0x12e56c,_0xf602f3);if(!hasChanges(_0x2f1b36))console[_0xdcd8e2(0x200)](a30_0x5f540c[_0xdcd8e2(0x1d9)]('✔')+'\x20No\x20changes\x20-\x20'+a30_0x5f540c[_0xdcd8e2(0x249)](_0x399790)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0xdcd8e2(0x200)](_0xdcd8e2(0x264)+_0x399790+'\x27:'),console[_0xdcd8e2(0x200)]('─'[_0xdcd8e2(0x1ce)](0x3c)),console['error'](formatDiffWithColors(_0x2f1b36)),console[_0xdcd8e2(0x200)]('─'['repeat'](0x3c));if(!_0x1b9d8e[_0xdcd8e2(0x138)]){if(!isInteractive())return console['error'](a30_0x5f540c[_0xdcd8e2(0x176)]('\x0aError:'),_0xdcd8e2(0x240)),console[_0xdcd8e2(0x200)](a30_0x5f540c[_0xdcd8e2(0x1bb)](_0xdcd8e2(0x225))),0x1;const _0x3efba4=await confirmKey(_0xdcd8e2(0x226)+_0x399790+'\x27?');if(!_0x3efba4)return console[_0xdcd8e2(0x200)](a30_0x5f540c['yellow'](_0xdcd8e2(0x25c))),0x1;}writeFileSync(_0x399790,_0xf602f3,_0xdcd8e2(0x2b3)),console[_0xdcd8e2(0x200)](a30_0x5f540c[_0xdcd8e2(0x1d9)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x5f540c[_0xdcd8e2(0x249)](_0x399790));}}else{const _0x21e9cb=a30_0x520b09['dirname'](_0x399790);!existsSync(_0x21e9cb)&&mkdirSync(_0x21e9cb,{'recursive':!![]}),writeFileSync(_0x399790,_0xf602f3,_0xdcd8e2(0x2b3)),console[_0xdcd8e2(0x200)](a30_0x5f540c[_0xdcd8e2(0x1d9)]('✔')+_0xdcd8e2(0x15c)+a30_0x5f540c[_0xdcd8e2(0x249)](_0x399790));}return saveSessionContext({'parent_segment':_0x315116},_0x1b9d8e['session']),console['error'](a30_0x5f540c['green']('✔')+_0xdcd8e2(0x265)+a30_0x5f540c['dim'](_0xdcd8e2(0x292))+_0xdcd8e2(0x272)+a30_0x5f540c[_0xdcd8e2(0x249)](_0x315116)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x248);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x180);async['execute'](_0x1213cc){const _0x164299=a30_0x4e3584,{options:_0x334a5f,args:_0x48fc28,tdx:_0x3dbe7e}=_0x1213cc,_0x508589=_0x334a5f,_0x249b97=_0x48fc28[0x0]||_0x334a5f[_0x164299(0x1f9)];if(!_0x249b97)return showParentSegmentNotSetError(_0x164299(0x238)+_0x164299(0x266)),0x1;const _0xfb048e=resolveYamlFile(_0x249b97);if(!existsSync(_0xfb048e))return showFileNotFoundError(_0xfb048e,_0x249b97),0x1;_0x508589[_0x164299(0x12e)]&&(console['error'](_0x164299(0x2a2)+_0x508589[_0x164299(0x12f)]),console[_0x164299(0x200)](_0x164299(0x1f2)+_0xfb048e));let _0x3e0feb;try{_0x3e0feb=readFileSync(_0xfb048e,_0x164299(0x2b3));}catch(_0x4848b0){const _0x305aa4=_0x4848b0 instanceof Error?_0x4848b0[_0x164299(0x1ec)]:String(_0x4848b0);return console['error']('Error\x20reading\x20file:\x20'+_0x305aa4),0x1;}const _0x174a3f=await withSpinner(_0x164299(0x17e),()=>_0x3dbe7e[_0x164299(0x1e5)][_0x164299(0x129)](_0x3e0feb),{'verbose':_0x508589[_0x164299(0x12e)]}),_0x5d135b=_0x174a3f[_0x164299(0x15e)],{isNew:_0x507844,name:_0xb7a801,hasChanges:_0xc64e99,diffFormatted:_0x5c8ee0}=_0x5d135b;if(!_0xc64e99)return console[_0x164299(0x200)](_0x164299(0x14f)+_0xb7a801+_0x164299(0x162)),0x0;_0x507844?console[_0x164299(0x200)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xb7a801+'\x27:'):console[_0x164299(0x200)](_0x164299(0x294)+_0xb7a801+'\x27:');console[_0x164299(0x200)]('─'[_0x164299(0x1ce)](0x3c)),console[_0x164299(0x200)](_0x5c8ee0),console[_0x164299(0x200)]('─'[_0x164299(0x1ce)](0x3c));const _0x146a60=_0x507844?_0x164299(0x1ad)+_0xb7a801+'\x27?':_0x164299(0x17a)+_0xb7a801+'\x27?';if(!_0x508589[_0x164299(0x138)]){if(!isInteractive())return console['error'](a30_0x5f540c[_0x164299(0x176)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a30_0x5f540c[_0x164299(0x1bb)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x32afa0=await confirmKey(_0x146a60);if(!_0x32afa0)return console[_0x164299(0x200)](a30_0x5f540c[_0x164299(0x1c5)](_0x164299(0x25c))),0x1;}const _0x149e9a=_0x507844?_0x164299(0x235):'Updating',_0x4a2a7b=await withSpinner(_0x149e9a+_0x164299(0x16e)+_0xb7a801+'\x27...',()=>_0x5d135b[_0x164299(0x253)](),{'verbose':_0x508589[_0x164299(0x12e)]}),_0x1054c3=_0x4a2a7b[_0x164299(0x15e)],_0x376f57=getConsoleNextUrl(_0x508589[_0x164299(0x12f)],_0x164299(0x28b)+_0x1054c3['id']),_0x2c46bf=_0x507844?'Created':_0x164299(0x16a);return console['error']('✔\x20'+_0x2c46bf+'\x20parent\x20segment\x20\x27'+_0x1054c3[_0x164299(0x192)]+'\x27'),console[_0x164299(0x200)]('\x20\x20'+_0x376f57),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x1e3);['description']=a30_0x4e3584(0x244);async[a30_0x4e3584(0x1d7)](_0x23b74d){const _0x4a2c13=a30_0x4e3584,{options:_0x4a92eb,args:_0x2fccf2,tdx:_0x53a94b}=_0x23b74d,_0x292c71=_0x4a92eb,_0x5d7da3=_0x2fccf2[0x0]||_0x4a92eb[_0x4a2c13(0x1f9)];if(!_0x5d7da3)return showParentSegmentNotSetError(_0x4a2c13(0x184)+_0x4a2c13(0x142)+'Options:\x0a'+_0x4a2c13(0x1d1)+_0x4a2c13(0x27d)+_0x4a2c13(0x17c)),0x1;const _0x21d514=resolveYamlFile(_0x5d7da3);if(!existsSync(_0x21d514))return showFileNotFoundError(_0x21d514,_0x5d7da3),0x1;_0x292c71['verbose']&&(console[_0x4a2c13(0x200)](_0x4a2c13(0x2a2)+_0x292c71[_0x4a2c13(0x12f)]),console['error'](_0x4a2c13(0x1f2)+_0x21d514));let _0x4119bb;try{_0x4119bb=readFileSync(_0x21d514,_0x4a2c13(0x2b3));}catch(_0xefb75e){const _0xa73b8c=_0xefb75e instanceof Error?_0xefb75e[_0x4a2c13(0x1ec)]:String(_0xefb75e);return console['error'](_0x4a2c13(0x236)+_0xa73b8c),0x1;}const _0x51fd5f=createCommandSpinner(a30_0x5f540c[_0x4a2c13(0x1bb)](_0x4a2c13(0x278)),{'verbose':_0x292c71[_0x4a2c13(0x12e)]});_0x51fd5f[_0x4a2c13(0x147)]();const _0x694e3c={'onProgress':_0x54030c=>{const _0x5f0454=_0x4a2c13;_0x51fd5f[_0x5f0454(0x214)]=formatProgressMessage(_0x54030c);}};if(_0x292c71[_0x4a2c13(0x290)])_0x694e3c[_0x4a2c13(0x290)]=!![];if(_0x292c71[_0x4a2c13(0x21a)])_0x694e3c[_0x4a2c13(0x21a)]=!![];_0x292c71[_0x4a2c13(0x29f)]&&(_0x694e3c[_0x4a2c13(0x29f)]=_0x292c71['attribute']);_0x292c71[_0x4a2c13(0x191)]&&(_0x694e3c[_0x4a2c13(0x191)]=_0x292c71['behavior']);if(_0x292c71['interval'])_0x694e3c['interval']=_0x292c71['interval'];let _0x23b950;try{_0x23b950=await _0x53a94b[_0x4a2c13(0x1e5)][_0x4a2c13(0x2a3)](_0x4119bb,_0x694e3c),_0x51fd5f['stop']();}catch(_0xd4d46f){_0x51fd5f[_0x4a2c13(0x25e)]();throw _0xd4d46f;}const _0x4c07e1=_0x292c71[_0x4a2c13(0x1e2)]||_0x4a2c13(0x2b4);return this['displayValidateResults'](_0x23b950,_0x694e3c,_0x21d514,_0x4c07e1),_0x23b950[_0x4a2c13(0x206)]?0x0:0x1;}[a30_0x4e3584(0x1db)](_0x5b56cb,_0x2904cc,_0x27d4a8,_0x2fcebd){const _0xa27a24=a30_0x4e3584;console[_0xa27a24(0x200)]('\x0a'+a30_0x5f540c[_0xa27a24(0x17b)](_0xa27a24(0x215))+'\x20'+_0x5b56cb[_0xa27a24(0x192)]),console[_0xa27a24(0x200)]('═'[_0xa27a24(0x1ce)](0x3c)),this['displayMasterInfo'](_0x5b56cb);if(typeof _0x2904cc[_0xa27a24(0x29f)]===_0xa27a24(0x125)){this[_0xa27a24(0x2ab)](_0x5b56cb),this[_0xa27a24(0x165)](_0x5b56cb),this[_0xa27a24(0x1de)](_0x27d4a8,_0x2fcebd,_0xa27a24(0x29f),_0x2904cc[_0xa27a24(0x29f)]);return;}if(_0x2904cc[_0xa27a24(0x29f)]===!![]){this[_0xa27a24(0x2ab)](_0x5b56cb),this[_0xa27a24(0x165)](_0x5b56cb),this[_0xa27a24(0x1de)](_0x27d4a8,_0x2fcebd,_0xa27a24(0x19c));return;}if(typeof _0x2904cc[_0xa27a24(0x191)]===_0xa27a24(0x125)){this[_0xa27a24(0x1e4)](_0x5b56cb,_0x2fcebd),this[_0xa27a24(0x165)](_0x5b56cb),this[_0xa27a24(0x1de)](_0x27d4a8,_0x2fcebd,_0xa27a24(0x191),_0x2904cc['behavior']);return;}if(_0x2904cc[_0xa27a24(0x191)]===!![]){this[_0xa27a24(0x1e4)](_0x5b56cb,_0x2fcebd),this[_0xa27a24(0x165)](_0x5b56cb),this['displayPreviewHints'](_0x27d4a8,_0x2fcebd,_0xa27a24(0x1ac));return;}this[_0xa27a24(0x2ab)](_0x5b56cb),this[_0xa27a24(0x1e4)](_0x5b56cb,_0x2fcebd),this[_0xa27a24(0x243)](_0x5b56cb),this[_0xa27a24(0x165)](_0x5b56cb),this[_0xa27a24(0x1de)](_0x27d4a8,_0x2fcebd,_0xa27a24(0x193));}[a30_0x4e3584(0x243)](_0x49b093){displayRealtimeValidation(_0x49b093);}[a30_0x4e3584(0x1de)](_0x3de21a,_0x3d770c,_0x1f84d0,_0x11bcbe){const _0x1130f8=a30_0x4e3584;console[_0x1130f8(0x200)]('\x0a'+a30_0x5f540c[_0x1130f8(0x1bb)](_0x1130f8(0x24b)));const _0x5ddea4=_0x3d770c!==_0x1130f8(0x2b4)?_0x1130f8(0x128)+_0x3d770c:'';if(_0x1f84d0===_0x1130f8(0x29f)&&_0x11bcbe)console[_0x1130f8(0x200)]('\x20\x20'+a30_0x5f540c[_0x1130f8(0x1bb)](_0x1130f8(0x12d)+_0x3de21a+_0x1130f8(0x208)+_0x11bcbe+'\x22'+_0x5ddea4));else{if(_0x1f84d0==='behavior'&&_0x11bcbe)console[_0x1130f8(0x200)]('\x20\x20'+a30_0x5f540c['dim'](_0x1130f8(0x12d)+_0x3de21a+_0x1130f8(0x20d)+_0x11bcbe+'\x22'+_0x5ddea4));else(_0x1f84d0===_0x1130f8(0x19c)||_0x1f84d0===_0x1130f8(0x193))&&console[_0x1130f8(0x200)]('\x20\x20'+a30_0x5f540c[_0x1130f8(0x1bb)]('tdx\x20ps\x20preview\x20'+_0x3de21a+'\x20--attribute\x20\x22<name>\x22'+_0x5ddea4));}(_0x1f84d0===_0x1130f8(0x1ac)||_0x1f84d0===_0x1130f8(0x193))&&console['error']('\x20\x20'+a30_0x5f540c[_0x1130f8(0x1bb)](_0x1130f8(0x12d)+_0x3de21a+_0x1130f8(0x133)+_0x5ddea4)),_0x1f84d0==='all'&&console[_0x1130f8(0x200)]('\x20\x20'+a30_0x5f540c[_0x1130f8(0x1bb)](_0x1130f8(0x12d)+_0x3de21a+'\x20--enriched'+_0x5ddea4));}[a30_0x4e3584(0x24c)](_0x85542e){const _0x16d447=a30_0x4e3584,{master:_0x346aa9}=_0x85542e,_0xddc83d=_0x346aa9[_0x16d447(0x2b0)]?a30_0x5f540c[_0x16d447(0x1d9)]('✔'):a30_0x5f540c[_0x16d447(0x176)]('✘');console['error']('\x0a'+a30_0x5f540c['dim'](_0x16d447(0x21f))),console[_0x16d447(0x200)](_0xddc83d+'\x20'+a30_0x5f540c[_0x16d447(0x17b)](_0x346aa9[_0x16d447(0x22a)]+'.'+_0x346aa9[_0x16d447(0x173)])),_0x346aa9[_0x16d447(0x2b0)]?_0x346aa9[_0x16d447(0x21e)]!==undefined&&console['error']('\x20\x20'+a30_0x5f540c['dim'](_0x16d447(0x2bf))+'\x20'+a30_0x5f540c[_0x16d447(0x249)](formatRows(_0x346aa9[_0x16d447(0x21e)]))):console['error']('\x20\x20'+a30_0x5f540c[_0x16d447(0x176)](_0x16d447(0x1e1))+'\x20'+_0x346aa9['schemaError']);}[a30_0x4e3584(0x2ab)](_0x482ad1){const _0x520042=a30_0x4e3584;if(_0x482ad1[_0x520042(0x19c)][_0x520042(0x23b)]===0x0)return;console['error']('\x0a'+a30_0x5f540c[_0x520042(0x1bb)](_0x520042(0x245)));for(const _0x3b9b9c of _0x482ad1[_0x520042(0x19c)]){const _0x2c188a=_0x3b9b9c['schemaValid']?a30_0x5f540c['green']('✔'):a30_0x5f540c['red']('✘');let _0x20d05f='';if(_0x3b9b9c[_0x520042(0x2b0)]&&_0x3b9b9c[_0x520042(0x2b5)]!==undefined&&_0x3b9b9c[_0x520042(0x2b9)]!==undefined){const _0x1f0e6e=_0x3b9b9c[_0x520042(0x2b9)][_0x520042(0x163)](0x1),_0x3006e6=_0x3b9b9c[_0x520042(0x2b9)]>=0x50?a30_0x5f540c[_0x520042(0x1d9)]:_0x3b9b9c[_0x520042(0x2b9)]>=0x32?a30_0x5f540c[_0x520042(0x1c5)]:a30_0x5f540c[_0x520042(0x176)];_0x20d05f='\x20'+a30_0x5f540c[_0x520042(0x1bb)](_0x520042(0x1dd))+'\x20'+_0x3006e6(_0x1f0e6e+'%')+'\x20('+formatRows(_0x3b9b9c[_0x520042(0x2b5)])+_0x520042(0x230);}console['error'](_0x2c188a+'\x20'+a30_0x5f540c['bold'](_0x3b9b9c[_0x520042(0x192)])+_0x20d05f),console[_0x520042(0x200)]('\x20\x20'+a30_0x5f540c[_0x520042(0x1bb)](_0x520042(0x2a6))+'\x20'+a30_0x5f540c[_0x520042(0x17b)](_0x3b9b9c[_0x520042(0x22a)]+'.'+_0x3b9b9c[_0x520042(0x173)]));const _0x419199=_0x3b9b9c[_0x520042(0x13a)]===_0x3b9b9c[_0x520042(0x1b1)]?a30_0x5f540c[_0x520042(0x1bb)](_0x520042(0x140))+'\x20'+_0x3b9b9c[_0x520042(0x13a)]:a30_0x5f540c[_0x520042(0x1bb)](_0x520042(0x2b2))+'\x20'+_0x3b9b9c[_0x520042(0x13a)]+_0x520042(0x272)+_0x3b9b9c[_0x520042(0x1b1)];console['error']('\x20\x20'+_0x419199),console[_0x520042(0x200)]('\x20\x20'+a30_0x5f540c[_0x520042(0x1bb)](_0x520042(0x1c8))),this[_0x520042(0x1b8)](_0x3b9b9c[_0x520042(0x28f)]),!_0x3b9b9c['schemaValid']&&console[_0x520042(0x200)]('\x20\x20'+a30_0x5f540c[_0x520042(0x176)](_0x520042(0x1e1))+'\x20'+_0x3b9b9c['schemaError']);}}['displayBehaviorsStats'](_0x3a8358,_0x2e8926){const _0xb9bbb2=a30_0x4e3584;if(_0x3a8358[_0xb9bbb2(0x1ac)][_0xb9bbb2(0x23b)]===0x0)return;console['error']('\x0a'+a30_0x5f540c['dim'](_0xb9bbb2(0x1d0))+'\x20'+a30_0x5f540c[_0xb9bbb2(0x1bb)]('('+_0x2e8926+')'));for(const _0x388a29 of _0x3a8358['behaviors']){const _0x41ca5f=_0x388a29[_0xb9bbb2(0x2b0)]?a30_0x5f540c[_0xb9bbb2(0x1d9)]('✔'):a30_0x5f540c['red']('✘');let _0x49431c='';if(_0x388a29['schemaValid']&&_0x388a29[_0xb9bbb2(0x124)]!==undefined&&_0x388a29[_0xb9bbb2(0x246)]!==undefined){const _0x3d0129=_0x388a29[_0xb9bbb2(0x1c0)]?.[_0xb9bbb2(0x163)](0x1)||'?',_0x3edc89=(_0x388a29[_0xb9bbb2(0x1c0)]??0x0)>=0x32?a30_0x5f540c[_0xb9bbb2(0x1d9)]:(_0x388a29[_0xb9bbb2(0x1c0)]??0x0)>=0x14?a30_0x5f540c[_0xb9bbb2(0x1c5)]:a30_0x5f540c[_0xb9bbb2(0x176)];_0x49431c='\x20'+a30_0x5f540c[_0xb9bbb2(0x1bb)](_0xb9bbb2(0x16d))+'\x20'+_0x3edc89(formatRows(_0x388a29['customersWithEvents']))+'\x20('+_0x3d0129+_0xb9bbb2(0x26a)+a30_0x5f540c[_0xb9bbb2(0x1bb)]('Events:')+'\x20'+a30_0x5f540c[_0xb9bbb2(0x249)](formatRows(_0x388a29['totalEvents']));}console['error'](_0x41ca5f+'\x20'+a30_0x5f540c['bold'](_0x388a29[_0xb9bbb2(0x192)])+_0x49431c),console['error']('\x20\x20'+a30_0x5f540c[_0xb9bbb2(0x1bb)](_0xb9bbb2(0x2a6))+'\x20'+a30_0x5f540c[_0xb9bbb2(0x17b)](_0x388a29[_0xb9bbb2(0x22a)]+'.'+_0x388a29['table']));const _0x16b635=_0x388a29['joinKey']===_0x388a29[_0xb9bbb2(0x1b1)]?a30_0x5f540c['dim'](_0xb9bbb2(0x140))+'\x20'+_0x388a29[_0xb9bbb2(0x13a)]:a30_0x5f540c[_0xb9bbb2(0x1bb)](_0xb9bbb2(0x2b2))+'\x20'+_0x388a29[_0xb9bbb2(0x13a)]+_0xb9bbb2(0x272)+_0x388a29[_0xb9bbb2(0x1b1)];console['error']('\x20\x20'+_0x16b635),console[_0xb9bbb2(0x200)]('\x20\x20'+a30_0x5f540c[_0xb9bbb2(0x1bb)]('Columns:')),this[_0xb9bbb2(0x1b8)](_0x388a29[_0xb9bbb2(0x28f)]),!_0x388a29[_0xb9bbb2(0x2b0)]&&console[_0xb9bbb2(0x200)]('\x20\x20'+a30_0x5f540c[_0xb9bbb2(0x176)](_0xb9bbb2(0x1e1))+'\x20'+_0x388a29['schemaError']);}}['displayColumns'](_0x61c335){const _0xb1fd15=a30_0x4e3584;for(const _0x17edb5 of _0x61c335){_0x17edb5[_0xb1fd15(0x188)]===_0x17edb5[_0xb1fd15(0x19a)]||_0x17edb5[_0xb1fd15(0x19a)]==='*'?console[_0xb1fd15(0x200)](_0xb1fd15(0x132)+_0x17edb5[_0xb1fd15(0x188)]):console['error'](_0xb1fd15(0x132)+_0x17edb5[_0xb1fd15(0x188)]+'\x20'+a30_0x5f540c[_0xb1fd15(0x1bb)]('('+_0x17edb5[_0xb1fd15(0x19a)]+')'));}}[a30_0x4e3584(0x165)](_0x301fb7){const _0x4f04c7=a30_0x4e3584;console[_0x4f04c7(0x200)]('─'[_0x4f04c7(0x1ce)](0x3c));if(_0x301fb7[_0x4f04c7(0x198)][_0x4f04c7(0x23b)]>0x0){console[_0x4f04c7(0x200)]('\x0a'+a30_0x5f540c[_0x4f04c7(0x176)](_0x4f04c7(0x145)));for(const _0x434d3f of _0x301fb7[_0x4f04c7(0x198)]){console[_0x4f04c7(0x200)]('\x20\x20'+a30_0x5f540c['red']('•')+'\x20'+_0x434d3f);}}_0x301fb7[_0x4f04c7(0x206)]&&console[_0x4f04c7(0x200)]('\x0a'+a30_0x5f540c[_0x4f04c7(0x1d9)]('✔')+_0x4f04c7(0x16b));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x1ff);['description']='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a30_0x4e3584(0x1d7)](_0x32e153){const _0x551496=a30_0x4e3584,{options:_0x34df7a,args:_0x584bef,tdx:_0x40c053}=_0x32e153,_0x28c189=_0x34df7a,_0x10b003=_0x584bef[0x0]||_0x34df7a[_0x551496(0x1f9)];if(!_0x10b003)return showParentSegmentNotSetError(_0x551496(0x1f1)+_0x551496(0x2b7)+_0x551496(0x22d)+_0x551496(0x1a6)+_0x551496(0x181)+_0x551496(0x276)+_0x551496(0x1fe)+_0x551496(0x17c)),0x1;if(!_0x28c189[_0x551496(0x290)]&&!_0x28c189['attribute']&&!_0x28c189[_0x551496(0x191)]&&!_0x28c189[_0x551496(0x21a)])return console[_0x551496(0x200)](a30_0x5f540c[_0x551496(0x176)](_0x551496(0x23a))),console[_0x551496(0x200)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x551496(0x1eb)),console[_0x551496(0x200)](_0x551496(0x143)),console['error'](_0x551496(0x1c4)),console[_0x551496(0x200)](_0x551496(0x182)),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x5345a7=resolveYamlFile(_0x10b003);if(!existsSync(_0x5345a7))return showFileNotFoundError(_0x5345a7,_0x10b003),0x1;_0x28c189['verbose']&&(console[_0x551496(0x200)](_0x551496(0x2a2)+_0x28c189['site']),console['error'](_0x551496(0x1f2)+_0x5345a7));let _0x5dc593;try{_0x5dc593=readFileSync(_0x5345a7,_0x551496(0x2b3));}catch(_0xc0b34f){const _0x7c062=_0xc0b34f instanceof Error?_0xc0b34f[_0x551496(0x1ec)]:String(_0xc0b34f);return console[_0x551496(0x200)](_0x551496(0x236)+_0x7c062),0x1;}let _0x54f024;try{_0x54f024=parseDef(_0x5dc593);}catch(_0x208a5c){const _0x186333=_0x208a5c instanceof Error?_0x208a5c[_0x551496(0x1ec)]:String(_0x208a5c);return console[_0x551496(0x200)](a30_0x5f540c[_0x551496(0x176)](_0x551496(0x295)+_0x186333)),0x1;}if(_0x28c189['attribute']===!![]||_0x28c189[_0x551496(0x29f)]===''){const _0x529241=_0x54f024['attributes']?.['map'](_0x394a9e=>_0x394a9e[_0x551496(0x192)])||[];if(_0x529241[_0x551496(0x23b)]===0x0)console[_0x551496(0x200)](a30_0x5f540c[_0x551496(0x176)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x551496(0x200)](a30_0x5f540c[_0x551496(0x176)](_0x551496(0x146))),console[_0x551496(0x200)](_0x551496(0x1cb));for(const _0x3fa76f of _0x529241){console[_0x551496(0x200)]('\x20\x20'+a30_0x5f540c['cyan'](_0x3fa76f));}console[_0x551496(0x200)](_0x551496(0x1af)+_0x10b003+'\x20--attribute\x20\x22'+_0x529241[0x0]+'\x22');}return 0x1;}if(_0x28c189[_0x551496(0x191)]===!![]||_0x28c189[_0x551496(0x191)]===''){const _0x57dd99=_0x54f024[_0x551496(0x1ac)]?.['map'](_0xcfaed=>_0xcfaed[_0x551496(0x192)])||[];if(_0x57dd99[_0x551496(0x23b)]===0x0)console['error'](a30_0x5f540c[_0x551496(0x176)](_0x551496(0x213)));else{console['error'](a30_0x5f540c[_0x551496(0x176)](_0x551496(0x160))),console['error'](_0x551496(0x258));for(const _0x32fc8a of _0x57dd99){console[_0x551496(0x200)]('\x20\x20'+a30_0x5f540c[_0x551496(0x249)](_0x32fc8a));}console[_0x551496(0x200)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x10b003+_0x551496(0x20d)+_0x57dd99[0x0]+'\x22');}return 0x1;}const _0x18eadb=createCommandSpinner(a30_0x5f540c[_0x551496(0x1bb)](_0x551496(0x280)),{'verbose':_0x28c189['verbose']});_0x18eadb[_0x551496(0x147)]();const _0x29e4aa={'onProgress':_0x48ba85=>{_0x18eadb['text']=formatProgressMessage(_0x48ba85);}};if(_0x28c189[_0x551496(0x290)])_0x29e4aa[_0x551496(0x290)]=!![];if(_0x28c189[_0x551496(0x29f)]&&typeof _0x28c189[_0x551496(0x29f)]===_0x551496(0x125))_0x29e4aa['attribute']=_0x28c189[_0x551496(0x29f)];if(_0x28c189[_0x551496(0x191)]&&typeof _0x28c189[_0x551496(0x191)]==='string')_0x29e4aa[_0x551496(0x191)]=_0x28c189[_0x551496(0x191)];if(_0x28c189['enriched'])_0x29e4aa[_0x551496(0x21a)]=!![];if(_0x28c189[_0x551496(0x1e2)])_0x29e4aa[_0x551496(0x1e2)]=_0x28c189[_0x551496(0x1e2)];let _0x2e7ffc;try{_0x2e7ffc=await _0x40c053[_0x551496(0x1e5)][_0x551496(0x13b)](_0x5dc593,_0x29e4aa),_0x18eadb[_0x551496(0x25e)]();}catch(_0x23169a){_0x18eadb[_0x551496(0x25e)]();throw _0x23169a;}return await this[_0x551496(0x261)](_0x2e7ffc,{'master':_0x28c189[_0x551496(0x290)],'attribute':typeof _0x28c189[_0x551496(0x29f)]===_0x551496(0x125)?_0x28c189[_0x551496(0x29f)]:undefined,'behavior':typeof _0x28c189['behavior']===_0x551496(0x125)?_0x28c189[_0x551496(0x191)]:undefined,'enriched':_0x28c189[_0x551496(0x21a)]}),_0x2e7ffc[_0x551496(0x206)]?0x0:0x1;}async['displayPreviewResults'](_0x27bb19,_0xeac4fc){const _0x337d41=a30_0x4e3584;console[_0x337d41(0x200)]('\x0a'+a30_0x5f540c[_0x337d41(0x17b)](_0x337d41(0x286))+'\x20'+_0x27bb19[_0x337d41(0x192)]),console[_0x337d41(0x200)]('═'[_0x337d41(0x1ce)](0x3c));if(_0xeac4fc[_0x337d41(0x290)]&&_0x27bb19[_0x337d41(0x1ed)]){const _0x7f250b=a30_0x5f540c['dim'](_0x337d41(0x1c2))+'\x20'+a30_0x5f540c[_0x337d41(0x17b)](_0x27bb19['master'][_0x337d41(0x22a)]+'.'+_0x27bb19[_0x337d41(0x290)][_0x337d41(0x173)]);await this[_0x337d41(0x27b)](_0x7f250b,_0x27bb19[_0x337d41(0x1ed)]);}else{if(_0xeac4fc[_0x337d41(0x29f)]&&_0x27bb19[_0x337d41(0x1ed)]){const _0x2eb28d=a30_0x5f540c[_0x337d41(0x1bb)](_0x337d41(0x25f))+'\x20'+a30_0x5f540c[_0x337d41(0x17b)](_0xeac4fc[_0x337d41(0x29f)]);await this[_0x337d41(0x27b)](_0x2eb28d,_0x27bb19['sampleData']);}else{if(_0xeac4fc['behavior']&&_0x27bb19['sampleData']){const _0x5e380f=a30_0x5f540c[_0x337d41(0x1bb)](_0x337d41(0x2aa))+'\x20'+a30_0x5f540c[_0x337d41(0x17b)](_0xeac4fc['behavior']);await this[_0x337d41(0x27b)](_0x5e380f,_0x27bb19[_0x337d41(0x1ed)]);}else{if(_0xeac4fc['enriched']&&_0x27bb19[_0x337d41(0x1ed)]){const _0x4b8644=a30_0x5f540c[_0x337d41(0x1bb)](_0x337d41(0x19d))+'\x20'+a30_0x5f540c['bold'](_0x337d41(0x267));await this[_0x337d41(0x27b)](_0x4b8644,_0x27bb19['sampleData']);}else!_0x27bb19[_0x337d41(0x1ed)]&&console['error'](_0x337d41(0x233));}}}if(_0x27bb19[_0x337d41(0x198)][_0x337d41(0x23b)]>0x0){console['error']('─'['repeat'](0x3c)),console[_0x337d41(0x200)]('\x0a'+a30_0x5f540c[_0x337d41(0x176)]('Errors:'));for(const _0x3c2cc7 of _0x27bb19['errors']){console[_0x337d41(0x200)]('\x20\x20'+a30_0x5f540c[_0x337d41(0x176)]('•')+'\x20'+_0x3c2cc7);}}}async[a30_0x4e3584(0x27b)](_0x28940f,_0x18ae92){const _0x54ce5d=a30_0x4e3584;if(_0x18ae92[_0x54ce5d(0x23b)]===0x0){console[_0x54ce5d(0x200)]('\x0a'+_0x28940f),console[_0x54ce5d(0x200)](_0x54ce5d(0x1b5));return;}console['error']('\x0a'+_0x28940f);const _0x710e56=Object[_0x54ce5d(0x171)](_0x18ae92[0x0])['map'](_0x1c95d1=>({'name':_0x1c95d1,'type':typeof _0x18ae92[0x0][_0x1c95d1]===_0x54ce5d(0x222)?_0x54ce5d(0x25b):'varchar'})),_0x617bf4={'queryId':_0x54ce5d(0x220),'columns':_0x710e56,'data':_0x18ae92,'stats':{'state':_0x54ce5d(0x228),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x18ae92[_0x54ce5d(0x23b)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1c87dc=formatAsTable(_0x617bf4,_0x18ae92[_0x54ce5d(0x23b)],!![]);await writeOutput(_0x1c87dc,undefined,_0x54ce5d(0x173));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x168);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x293);async['execute'](_0x406b71){const _0x5c22e6=a30_0x4e3584,{options:_0x1c4d26,args:_0x26fc91,tdx:_0x549723}=_0x406b71,_0x481208=_0x1c4d26,_0x79aa3a=_0x26fc91[0x0]||_0x1c4d26[_0x5c22e6(0x1f9)];if(!_0x79aa3a)return showParentSegmentNotSetError(_0x5c22e6(0x28d)+_0x5c22e6(0x207)),0x1;const _0x9f24da=resolveYamlFile(_0x79aa3a);if(existsSync(_0x9f24da)){_0x481208['verbose']&&console[_0x5c22e6(0x200)](_0x5c22e6(0x174)+_0x9f24da);let _0x191709;try{_0x191709=readFileSync(_0x9f24da,_0x5c22e6(0x2b3));}catch(_0x14e2af){const _0x57a0fa=_0x14e2af instanceof Error?_0x14e2af[_0x5c22e6(0x1ec)]:String(_0x14e2af);return console['error'](_0x5c22e6(0x236)+_0x57a0fa),0x1;}const _0x15f7db=await withSpinner(_0x5c22e6(0x17e),()=>_0x549723[_0x5c22e6(0x1e5)][_0x5c22e6(0x129)](_0x191709),{'verbose':_0x481208[_0x5c22e6(0x12e)]}),_0x4cb4ae=_0x15f7db[_0x5c22e6(0x15e)],{isNew:_0x3fb0fb,name:_0x2041be,hasChanges:_0x3098cc,diffFormatted:_0x16788c}=_0x4cb4ae;if(_0x3098cc){_0x3fb0fb?console[_0x5c22e6(0x200)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x2041be+'\x27:'):console['error'](_0x5c22e6(0x294)+_0x2041be+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x5c22e6(0x200)](_0x16788c),console[_0x5c22e6(0x200)]('─'[_0x5c22e6(0x1ce)](0x3c));const _0x391601=_0x3fb0fb?'Create\x20parent\x20segment\x20\x27'+_0x2041be+_0x5c22e6(0x2ba):_0x5c22e6(0x17a)+_0x2041be+_0x5c22e6(0x2ba);if(!_0x481208[_0x5c22e6(0x138)]){if(!isInteractive())return console[_0x5c22e6(0x200)](a30_0x5f540c[_0x5c22e6(0x176)]('\x0aError:'),_0x5c22e6(0x240)),console['error'](a30_0x5f540c['dim'](_0x5c22e6(0x225))),0x1;const _0x169c65=await confirmKey(_0x391601);if(!_0x169c65)return console[_0x5c22e6(0x200)](a30_0x5f540c[_0x5c22e6(0x1c5)](_0x5c22e6(0x25c))),0x1;}const _0x581212=_0x3fb0fb?_0x5c22e6(0x235):_0x5c22e6(0x1a4);await withSpinner(_0x581212+_0x5c22e6(0x16e)+_0x2041be+_0x5c22e6(0x2ad),()=>_0x4cb4ae[_0x5c22e6(0x253)](),{'verbose':_0x481208[_0x5c22e6(0x12e)]});const _0x13d1be=_0x3fb0fb?_0x5c22e6(0x13e):_0x5c22e6(0x16a);console[_0x5c22e6(0x200)]('✔\x20'+_0x13d1be+'\x20parent\x20segment\x20\x27'+_0x2041be+'\x27');}else console[_0x5c22e6(0x200)](_0x5c22e6(0x14f)+_0x2041be+_0x5c22e6(0x279));}const _0x240778=await withSpinner(_0x5c22e6(0x14d)+_0x79aa3a+_0x5c22e6(0x2ad),()=>_0x549723[_0x5c22e6(0x1e5)][_0x5c22e6(0x1ab)](_0x79aa3a),{'verbose':_0x481208[_0x5c22e6(0x12e)]}),_0x5a0fb2=_0x240778['data'],_0x2fc2c1=getConsoleUrl(_0x481208[_0x5c22e6(0x12f)],_0x5c22e6(0x268)+_0x5a0fb2[_0x5c22e6(0x14e)]+_0x5c22e6(0x27a)+_0x5a0fb2[_0x5c22e6(0x237)]+_0x5c22e6(0x1a3)+_0x5a0fb2['workflowAttemptId']);return console[_0x5c22e6(0x200)](_0x5c22e6(0x156)),console[_0x5c22e6(0x200)]('\x20\x20'+a30_0x5f540c[_0x5c22e6(0x1bb)](_0x5c22e6(0x144))+'\x20'+_0x5a0fb2[_0x5c22e6(0x2b8)]),console['error']('\x20\x20'+a30_0x5f540c[_0x5c22e6(0x1bb)](_0x5c22e6(0x1b0))+'\x20'+_0x5a0fb2[_0x5c22e6(0x281)]),console['error']('\x20\x20'+a30_0x5f540c[_0x5c22e6(0x1bb)]('Session:')+'\x20'+_0x5a0fb2[_0x5c22e6(0x237)]),console[_0x5c22e6(0x200)]('\x20\x20'+a30_0x5f540c[_0x5c22e6(0x1bb)](_0x5c22e6(0x27f))+'\x20'+_0x5a0fb2[_0x5c22e6(0x23d)]),console['error']('\x20\x20'+_0x2fc2c1),console[_0x5c22e6(0x200)]('\x0a'+a30_0x5f540c['dim']('To\x20cancel:')+_0x5c22e6(0x23e)+_0x5a0fb2['workflowAttemptId']+_0x5c22e6(0x131)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x4e3584(0x192)]='segment:parent:fields';[a30_0x4e3584(0x212)]=a30_0x4e3584(0x242);async[a30_0x4e3584(0x1d7)](_0x27de6d){const _0x1f46c8=a30_0x4e3584,{options:_0x16976b,args:_0x14fe9d,tdx:_0x493a96}=_0x27de6d,_0x328ca1=_0x14fe9d[0x0]||_0x16976b[_0x1f46c8(0x1f9)];if(!_0x328ca1)return showParentSegmentNotSetError(_0x1f46c8(0x1ef)+'\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;_0x16976b[_0x1f46c8(0x12e)]&&(console['error'](_0x1f46c8(0x2a2)+_0x16976b['site']),console[_0x1f46c8(0x200)]('Parent\x20segment:\x20'+_0x328ca1));const _0x35b3aa=await withSpinner(_0x1f46c8(0x164)+_0x328ca1+_0x1f46c8(0x2ad),()=>_0x493a96['segment'][_0x1f46c8(0x137)](_0x328ca1),{'verbose':_0x16976b['verbose']}),_0x3daae4=_0x35b3aa[_0x1f46c8(0x15e)];console['error'](_0x1f46c8(0x298)+_0x3daae4['length']+_0x1f46c8(0x257)+(_0x3daae4[_0x1f46c8(0x23b)]!==0x1?'s':''));if(_0x16976b['json']||_0x16976b['jsonl'])return await handleSDKOutput(_0x3daae4,_0x16976b),0x0;return displayFieldsHumanReadable(_0x3daae4,_0x328ca1),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a30_0x4e3584(0x136);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x26e);async[a30_0x4e3584(0x1d7)](_0x5109c9){const _0x2d0700=a30_0x4e3584,{options:_0x3cf161,args:_0x14862e,tdx:_0xe0b222}=_0x5109c9,_0x5921da=_0x3cf161,_0x3b4cb8=_0x14862e[0x0]||_0x3cf161['parentSegment'];if(!_0x3b4cb8)return showParentSegmentNotSetError(_0x2d0700(0x139)+_0x2d0700(0x22e)+'Options:\x0a'+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x3cf161[_0x2d0700(0x12e)]&&(console['error'](_0x2d0700(0x2a2)+_0x3cf161[_0x2d0700(0x12f)]),console[_0x2d0700(0x200)]('Parent\x20segment:\x20'+_0x3b4cb8));const _0x2442bb=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x3b4cb8+_0x2d0700(0x2ad),()=>_0xe0b222['segment'][_0x2d0700(0x1ae)](_0x3b4cb8),{'verbose':_0x3cf161[_0x2d0700(0x12e)]}),_0x246a7f=_0x2442bb[_0x2d0700(0x15e)];if(_0x5921da[_0x2d0700(0x299)]){const _0x2fc2cb=getConsoleNextUrl(_0x5921da['site'],'/app/dw/parentSegments/'+_0x246a7f['id']);return console['error'](a30_0x5f540c[_0x2d0700(0x1d9)]('✔')+_0x2d0700(0x223)+a30_0x5f540c[_0x2d0700(0x249)](_0x2fc2cb)),openBrowser(_0x2fc2cb),0x0;}return await handleSingleObjectOutput(_0x246a7f,_0x3cf161),0x0;}}function a30_0x3107(_0xcf4b2,_0x23da58){_0xcf4b2=_0xcf4b2-0x122;const _0x1addaf=a30_0x1add();let _0x310730=_0x1addaf[_0xcf4b2];return _0x310730;}export class ParentSegmentDescCommand extends BaseCommand{['name']=a30_0x4e3584(0x16c);['description']=a30_0x4e3584(0x239);async[a30_0x4e3584(0x1d7)](_0x1522e5){const _0x565b6c=a30_0x4e3584,{options:_0x2c9393,args:_0x1aeffa,tdx:_0x520790}=_0x1522e5,_0x12cb18=_0x2c9393,_0x4714de=_0x1aeffa[0x0]||_0x2c9393[_0x565b6c(0x1f9)];if(!_0x4714de)return showParentSegmentNotSetError(_0x565b6c(0x26b)+_0x565b6c(0x13d)+_0x565b6c(0x201)+_0x565b6c(0x2a7)),0x1;_0x2c9393[_0x565b6c(0x12e)]&&(console['error'](_0x565b6c(0x2a2)+_0x2c9393[_0x565b6c(0x12f)]),console[_0x565b6c(0x200)](_0x565b6c(0x205)+_0x4714de));const _0x4b9562=await withSpinner(_0x565b6c(0x1c7)+_0x4714de+_0x565b6c(0x2ad),()=>_0x520790[_0x565b6c(0x1e5)][_0x565b6c(0x1f4)](_0x4714de),{'verbose':_0x2c9393[_0x565b6c(0x12e)]}),_0x366a84=_0x4b9562['data'],_0x386ba0=_0x520790['segment'][_0x565b6c(0x1f0)](_0x366a84);if(_0x12cb18[_0x565b6c(0x1b7)]){const _0x57a59a=await this[_0x565b6c(0x274)](_0x1522e5,_0x4714de,_0x366a84,_0x386ba0),_0x483d8b=this[_0x565b6c(0x2b6)](_0x57a59a);writeFileSync(_0x12cb18[_0x565b6c(0x1b7)],_0x483d8b);const _0x1f7e49=_0x57a59a[_0x565b6c(0x23f)]['columns']['length']+_0x57a59a[_0x565b6c(0x1ac)][_0x565b6c(0x159)]((_0x320531,_0x46b2c0)=>_0x320531+_0x46b2c0[_0x565b6c(0x28f)][_0x565b6c(0x23b)],0x0),_0x77a4a5=_0x57a59a[_0x565b6c(0x1ac)][_0x565b6c(0x134)](_0x39a3e5=>_0x39a3e5[_0x565b6c(0x28f)][_0x565b6c(0x23b)]===0x0)[_0x565b6c(0x23b)];return console[_0x565b6c(0x277)]('Schema\x20saved\x20to\x20'+_0x12cb18[_0x565b6c(0x1b7)]),console[_0x565b6c(0x277)](_0x565b6c(0x166)+_0x386ba0),console[_0x565b6c(0x277)](_0x565b6c(0x1b4)+_0x57a59a[_0x565b6c(0x1ac)][_0x565b6c(0x23b)]+_0x565b6c(0x2b1)),console[_0x565b6c(0x277)](_0x565b6c(0x2bb)+_0x1f7e49+'\x20total'),_0x77a4a5>0x0&&console[_0x565b6c(0x277)](_0x565b6c(0x190)+_0x77a4a5+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x565b6c(0x200)]('\x0a'+a30_0x5f540c[_0x565b6c(0x17b)]('Output\x20Database:')+'\x20'+a30_0x5f540c[_0x565b6c(0x249)](_0x386ba0));const _0x512a81=await withSpinner(_0x565b6c(0x211),()=>_0x520790[_0x565b6c(0x1e5)][_0x565b6c(0x14b)](_0x366a84),{'verbose':_0x2c9393[_0x565b6c(0x12e)]});console[_0x565b6c(0x200)]('\x0a'+a30_0x5f540c[_0x565b6c(0x17b)]('customers')+'\x20'+a30_0x5f540c['dim']('('+_0x386ba0+_0x565b6c(0x282)));const _0x357ee4=await executeSchemaQuery(_0x512a81[_0x565b6c(0x15e)],_0x520790,_0x2c9393);await handleQueryOutput(_0x357ee4,_0x2c9393);const _0x5b5b8f=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x520790['segment'][_0x565b6c(0x19f)](_0x366a84),{'verbose':_0x2c9393[_0x565b6c(0x12e)]});for(const _0x23f674 of _0x5b5b8f[_0x565b6c(0x15e)]){const _0x3835b0=_0x565b6c(0x2a0)+_0x23f674['toLowerCase']()[_0x565b6c(0x22c)](/\s+/g,'_'),_0x531374=_0x565b6c(0x216)+_0x386ba0+'.'+_0x3835b0;console[_0x565b6c(0x200)]('\x0a'+a30_0x5f540c['bold'](_0x23f674)+'\x20'+a30_0x5f540c[_0x565b6c(0x1bb)]('('+_0x386ba0+'.'+_0x3835b0+')'));try{const _0x379945=await executeSchemaQuery(_0x531374,_0x520790,_0x2c9393);await handleQueryOutput(_0x379945,_0x2c9393);}catch{console['error'](a30_0x5f540c[_0x565b6c(0x1c5)](_0x565b6c(0x154)));}}return 0x0;}async['collectSchema'](_0x4d3df7,_0x2ffedc,_0xef565c,_0x346ac5){const _0x49bbcb=a30_0x4e3584,{options:_0x1cbd8a,tdx:_0x544366}=_0x4d3df7,_0x58be51=await withSpinner(_0x49bbcb(0x211),()=>_0x544366[_0x49bbcb(0x1e5)][_0x49bbcb(0x14b)](_0xef565c),{'verbose':_0x1cbd8a[_0x49bbcb(0x12e)]}),_0x276ffa=await executeSchemaQuery(_0x58be51[_0x49bbcb(0x15e)],_0x544366,_0x1cbd8a),_0x5d9d0f=_0x276ffa[_0x49bbcb(0x15e)][_0x49bbcb(0x2ae)](_0x639532=>({'name':_0x639532[_0x49bbcb(0x26c)],'type':_0x639532[_0x49bbcb(0x1e7)]})),_0x1c6732=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x544366['segment'][_0x49bbcb(0x19f)](_0xef565c),{'verbose':_0x1cbd8a['verbose']}),_0x136157=[];for(const _0x58c31f of _0x1c6732[_0x49bbcb(0x15e)]){const _0x79d4d1=_0x49bbcb(0x2a0)+_0x58c31f['toLowerCase']()[_0x49bbcb(0x22c)](/\s+/g,'_'),_0x254c9e=_0x49bbcb(0x216)+_0x346ac5+'.'+_0x79d4d1;let _0x3adb16=[];try{const _0x281a2f=await executeSchemaQuery(_0x254c9e,_0x544366,_0x1cbd8a);_0x3adb16=_0x281a2f['data'][_0x49bbcb(0x2ae)](_0x124b4f=>({'name':_0x124b4f[_0x49bbcb(0x26c)],'type':_0x124b4f['column_type']}));}catch{}_0x136157[_0x49bbcb(0x25a)]({'table':_0x79d4d1,'columns':_0x3adb16});}return{'database':_0x346ac5,'parent_segment':_0x2ffedc,'parent_id':_0xef565c,'customers':{'table':_0x49bbcb(0x23f),'columns':_0x5d9d0f},'behaviors':_0x136157};}['formatSchemaJson'](_0x127074){const _0x35c286=a30_0x4e3584,_0x53341e=_0xd3be46=>{const _0x162f71=a30_0x3107;if(_0xd3be46['length']===0x0)return'[]';const _0xadb256=_0xd3be46[_0x162f71(0x2ae)](_0x4f6281=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x4f6281[_0x162f71(0x192)]+_0x162f71(0x2a9)+_0x4f6281[_0x162f71(0x1b6)]+'\x22\x20}');return'[\x0a'+_0xadb256[_0x162f71(0x169)](',\x0a')+_0x162f71(0x178);},_0x3f0803=_0x127074[_0x35c286(0x1ac)][_0x35c286(0x2ae)](_0x57b783=>{const _0x5a75b7=_0x35c286;return _0x5a75b7(0x1d2)+_0x57b783['table']+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x53341e(_0x57b783[_0x5a75b7(0x28f)])['replace'](/^/gm,'\x20\x20')['trim']()+'\x0a\x20\x20\x20\x20}';})['join'](',\x0a');return _0x35c286(0x262)+_0x127074[_0x35c286(0x22a)]+_0x35c286(0x2ac)+_0x127074[_0x35c286(0x292)]+_0x35c286(0x1d4)+_0x127074[_0x35c286(0x27c)]+_0x35c286(0x1f3)+_0x127074[_0x35c286(0x23f)]['table']+_0x35c286(0x24d)+_0x53341e(_0x127074[_0x35c286(0x23f)][_0x35c286(0x28f)])[_0x35c286(0x22c)](/^/gm,'\x20\x20')['trim']()+_0x35c286(0x167)+_0x3f0803+_0x35c286(0x1ee);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x15d);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x152);async[a30_0x4e3584(0x1d7)](_0x45484c){const _0xa4cd9=a30_0x4e3584,{options:_0x3e5403,args:_0x4ba388,tdx:_0x594eb4}=_0x45484c,_0x4bd5c5=_0x4ba388[0x0]||_0x3e5403[_0xa4cd9(0x1f9)];if(!_0x4bd5c5)return showParentSegmentNotSetError(_0xa4cd9(0x19e)+_0xa4cd9(0x151)),0x1;_0x3e5403['verbose']&&(console[_0xa4cd9(0x200)](_0xa4cd9(0x2a2)+_0x3e5403[_0xa4cd9(0x12f)]),console['error'](_0xa4cd9(0x205)+_0x4bd5c5));const _0x3f82cd=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4bd5c5+_0xa4cd9(0x2ad),()=>_0x594eb4['segment']['resolveParentId'](_0x4bd5c5),{'verbose':_0x3e5403['verbose']}),_0x5c7271=_0x3f82cd[_0xa4cd9(0x15e)],_0x24e243=await withSpinner(_0xa4cd9(0x28e)+_0x4bd5c5+_0xa4cd9(0x2ad),()=>_0x594eb4[_0xa4cd9(0x1e5)][_0xa4cd9(0x14b)](_0x5c7271),{'verbose':_0x3e5403[_0xa4cd9(0x12e)]}),_0x654901=_0x24e243[_0xa4cd9(0x15e)];return _0x3e5403[_0xa4cd9(0x16f)]===_0xa4cd9(0x15b)||_0x3e5403[_0xa4cd9(0x16f)]===_0xa4cd9(0x1a8)?await handleSDKOutput([{'sql':_0x654901}],_0x3e5403):console[_0xa4cd9(0x277)](_0x654901),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a30_0x4e3584(0x270);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x273);async[a30_0x4e3584(0x1d7)](_0x51f38a){const _0x241e98=a30_0x4e3584,{options:_0x35a558,args:_0x4fc8c4,tdx:_0x16a568}=_0x51f38a,_0x23e763=_0x4fc8c4[0x0]||_0x35a558['parentSegment'];if(!_0x23e763)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x35a558[_0x241e98(0x12e)]&&(console[_0x241e98(0x200)](_0x241e98(0x2a2)+_0x35a558[_0x241e98(0x12f)]),console[_0x241e98(0x200)]('Parent\x20segment:\x20'+_0x23e763));const _0xdea9f0=await withSpinner(_0x241e98(0x1c7)+_0x23e763+'\x27...',()=>_0x16a568[_0x241e98(0x1e5)][_0x241e98(0x1f4)](_0x23e763),{'verbose':_0x35a558[_0x241e98(0x12e)]}),_0xb57544=_0xdea9f0[_0x241e98(0x15e)],_0x1f5d6e=await withSpinner(_0x241e98(0x28e)+_0x23e763+_0x241e98(0x2ad),()=>_0x16a568[_0x241e98(0x1e5)][_0x241e98(0x14b)](_0xb57544),{'verbose':_0x35a558[_0x241e98(0x12e)]});let _0x2af247=_0x1f5d6e[_0x241e98(0x15e)];const _0x51d0ff=resolveLimit(_0x35a558[_0x241e98(0x24a)],DEFAULT_DISPLAY_LIMIT),_0x2f7858=/\bLIMIT\s+\d+/i[_0x241e98(0x18a)](_0x2af247);!_0x2f7858&&(_0x2af247=_0x2af247[_0x241e98(0x1c9)]()[_0x241e98(0x22c)](/;+$/,''),_0x2af247=_0x241e98(0x18e)+_0x2af247+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x51d0ff);_0x35a558[_0x241e98(0x12e)]&&console[_0x241e98(0x200)](_0x241e98(0x26f)+_0x2af247);const _0x585bba=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x77990=>{const _0x3c1eb3=_0x241e98,_0x2c297c=await _0x16a568[_0x3c1eb3(0x209)]['execute'](_0x2af247,{'catalog':'td','schema':'information_schema','onJobId':_0x1dcef0=>{_0x77990['setJobId'](_0x1dcef0);}});return _0x2c297c;},{'verbose':_0x35a558[_0x241e98(0x12e)]}),_0x4f8909=_0x585bba['data'],_0x2dcad5=_0x4f8909[_0x241e98(0x127)]?'\x20[Job\x20ID:\x20'+_0x4f8909[_0x241e98(0x127)]+']':'';return console[_0x241e98(0x200)](_0x241e98(0x179)+_0x4f8909['stats']['processedRows'][_0x241e98(0x1c3)]()+_0x241e98(0x1a2)+(_0x241e98(0x135)+formatElapsed(_0x4f8909[_0x241e98(0x227)]['elapsedTimeMillis'])+_0x2dcad5)),await handleQueryOutput(_0x4f8909,_0x35a558),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x4e3584(0x175);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x20e);async[a30_0x4e3584(0x1d7)](_0x367632){const _0x188d76=a30_0x4e3584,{options:_0x12f5ca,args:_0x22f34d,tdx:_0x5c7340}=_0x367632,_0x424180=_0x22f34d[0x0],_0x466dc1=await withSpinner(_0x424180?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x424180+_0x188d76(0x2ad):_0x188d76(0x231),()=>_0x5c7340[_0x188d76(0x1bf)][_0x188d76(0x2a1)](),{'verbose':_0x12f5ca[_0x188d76(0x12e)]});let _0xee9280=_0x466dc1[_0x188d76(0x15e)]['filter'](_0x316f44=>_0x316f44[_0x188d76(0x1d6)]);if(_0x424180){const _0x505f6d=_0x424180[_0x188d76(0x22c)](/[.+^${}()|[\]\\]/g,_0x188d76(0x20b))[_0x188d76(0x22c)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x16f6c4=new RegExp('^'+_0x505f6d+'$','i');_0xee9280=_0xee9280[_0x188d76(0x134)](_0x579049=>_0x16f6c4[_0x188d76(0x18a)](_0x579049[_0x188d76(0x192)]));}_0xee9280[_0x188d76(0x15f)]((_0x45ec32,_0x435e03)=>_0x45ec32['name'][_0x188d76(0x1bd)](_0x435e03[_0x188d76(0x192)])),console[_0x188d76(0x200)](_0x188d76(0x298)+_0xee9280[_0x188d76(0x23b)]+_0x188d76(0x29b)+(_0xee9280[_0x188d76(0x23b)]!==0x1?'s':''));const _0x2c4cd4=_0x34b0e7=>{const _0xe5a363=_0x188d76;return getConsoleNextUrl(_0x12f5ca[_0xe5a363(0x12f)],_0xe5a363(0x28b)+_0x34b0e7);};if(_0x12f5ca['format']===_0x188d76(0x15b)||_0x12f5ca[_0x188d76(0x16f)]==='jsonl'){const _0x11696b=_0xee9280[_0x188d76(0x2ae)](_0x5d448b=>({..._0x5d448b,'url':_0x2c4cd4(_0x5d448b['id'])}));await handleSDKOutput(_0x11696b,_0x12f5ca);}else{if(_0xee9280[_0x188d76(0x23b)]===0x0)console[_0x188d76(0x277)](_0x188d76(0x21b));else for(const _0x53670d of _0xee9280){const _0x5267a0=_0x53670d[_0x188d76(0x1be)]?a30_0x5f540c[_0x188d76(0x1bb)]('\x20('+formatRows(_0x53670d[_0x188d76(0x1be)])+')'):'',_0x53ff06=hyperlink(_0x53670d[_0x188d76(0x192)],_0x2c4cd4(_0x53670d['id']));console[_0x188d76(0x277)]('⚡\x20'+_0x53ff06+_0x5267a0);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x1c6);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x296);async['execute'](_0x152d2b){const _0x44a86f=a30_0x4e3584,{options:_0x332e80,args:_0x28afa6,tdx:_0x24f0e9}=_0x152d2b,_0x592950=_0x28afa6[0x0]||_0x332e80['parentSegment'];if(!_0x592950)return showParentSegmentNotSetError(_0x44a86f(0x20c)+_0x44a86f(0x21d)),0x1;const _0x35c84e=resolveYamlFile(_0x592950);if(!existsSync(_0x35c84e))return showFileNotFoundError(_0x35c84e,_0x592950),0x1;let _0x4ab4d0;try{_0x4ab4d0=readFileSync(_0x35c84e,_0x44a86f(0x2b3));}catch(_0x447af6){const _0x23b28c=_0x447af6 instanceof Error?_0x447af6[_0x44a86f(0x1ec)]:String(_0x447af6);return console[_0x44a86f(0x200)](_0x44a86f(0x236)+_0x23b28c),0x1;}const _0x4fb220=createCommandSpinner(a30_0x5f540c[_0x44a86f(0x1bb)](_0x44a86f(0x2a5)),{'verbose':_0x332e80['verbose']});_0x4fb220[_0x44a86f(0x147)]();const _0x1ca74a={'realtime':!![],'onProgress':_0x45c8e9=>{const _0x2b608f=_0x44a86f;_0x4fb220[_0x2b608f(0x214)]=formatProgressMessage(_0x45c8e9);}};let _0x3b0cbb;try{_0x3b0cbb=await _0x24f0e9[_0x44a86f(0x1e5)]['validateParentYaml'](_0x4ab4d0,_0x1ca74a),_0x4fb220[_0x44a86f(0x25e)]();}catch(_0x48e163){_0x4fb220[_0x44a86f(0x25e)]();throw _0x48e163;}console[_0x44a86f(0x200)]('\x0a'+a30_0x5f540c['bold']('RT\x202.0\x20Validate:')+'\x20'+_0x3b0cbb[_0x44a86f(0x192)]),console[_0x44a86f(0x200)]('═'[_0x44a86f(0x1ce)](0x3c)),displayRealtimeValidation(_0x3b0cbb),console['error']('─'[_0x44a86f(0x1ce)](0x3c));if(_0x3b0cbb[_0x44a86f(0x198)]['length']>0x0){console[_0x44a86f(0x200)]('\x0a'+a30_0x5f540c['red'](_0x44a86f(0x145)));for(const _0x29fa0c of _0x3b0cbb[_0x44a86f(0x198)]){console['error']('\x20\x20'+a30_0x5f540c['red']('•')+'\x20'+_0x29fa0c);}}return _0x3b0cbb[_0x44a86f(0x206)]&&console[_0x44a86f(0x200)]('\x0a'+a30_0x5f540c[_0x44a86f(0x1d9)]('✔')+_0x44a86f(0x18f)),_0x3b0cbb['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x17d);[a30_0x4e3584(0x212)]=a30_0x4e3584(0x1dc);async[a30_0x4e3584(0x1d7)](_0x1c1921){const _0x304692=a30_0x4e3584,{options:_0x10d353,args:_0x3939c1,tdx:_0x5f3b5}=_0x1c1921,_0x31c2d7=_0x3939c1[0x0]||_0x10d353[_0x304692(0x1f9)];if(!_0x31c2d7)return showParentSegmentNotSetError(_0x304692(0x122)+_0x304692(0x21c)),0x1;const _0x277af7=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x31c2d7+'\x27...',()=>_0x5f3b5['segment']['resolveParentId'](_0x31c2d7),{'verbose':_0x10d353[_0x304692(0x12e)]}),_0x1b8b8a=_0x277af7[_0x304692(0x15e)],_0x1a9459=await withSpinner(_0x304692(0x271)+_0x31c2d7+_0x304692(0x2ad),()=>_0x5f3b5[_0x304692(0x130)][_0x304692(0x2a1)](_0x1b8b8a),{'verbose':_0x10d353[_0x304692(0x12e)]}),_0x3ef165=_0x1a9459[_0x304692(0x15e)];console['error'](_0x304692(0x298)+_0x3ef165[_0x304692(0x23b)]+'\x20personalization\x20service'+(_0x3ef165[_0x304692(0x23b)]!==0x1?'s':''));if(_0x10d353[_0x304692(0x16f)]===_0x304692(0x15b)||_0x10d353[_0x304692(0x16f)]===_0x304692(0x1a8))await handleSDKOutput(_0x3ef165,_0x10d353);else{if(_0x3ef165['length']===0x0)console[_0x304692(0x277)](_0x304692(0x20f)),console[_0x304692(0x200)](a30_0x5f540c[_0x304692(0x249)](_0x304692(0x275)));else for(const _0x59d474 of _0x3ef165){const _0x38c83c=_0x59d474[_0x304692(0x221)]?.['length']||0x0,_0xdebb1b=_0x59d474[_0x304692(0x141)]?a30_0x5f540c[_0x304692(0x1bb)](_0x304692(0x150)+_0x59d474[_0x304692(0x141)]):'',_0x2cccf8=a30_0x5f540c[_0x304692(0x1bb)]('\x20('+_0x38c83c+'\x20section'+(_0x38c83c!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x59d474[_0x304692(0x192)]+_0xdebb1b+_0x2cccf8),_0x59d474[_0x304692(0x212)]&&console['log']('\x20\x20\x20\x20'+a30_0x5f540c[_0x304692(0x1bb)](_0x59d474[_0x304692(0x212)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x4e3584(0x192)]=a30_0x4e3584(0x2a4);['description']=a30_0x4e3584(0x284);async['execute'](_0x4ee6f1){const _0x13e451=a30_0x4e3584,{options:_0x2543ea,args:_0x4f51d9}=_0x4ee6f1,_0x10a1e5=_0x4f51d9[0x0]||_0x2543ea[_0x13e451(0x1f9)];if(!_0x10a1e5)return showParentSegmentNotSetError(_0x13e451(0x1d3)+_0x13e451(0x1f7)),0x1;const _0x47fb04=resolveYamlFile(_0x10a1e5);if(!existsSync(_0x47fb04))return showFileNotFoundError(_0x47fb04,_0x10a1e5),0x1;let _0x28f0cb;try{_0x28f0cb=readFileSync(_0x47fb04,'utf-8');}catch(_0x165d5c){const _0x18ec41=_0x165d5c instanceof Error?_0x165d5c['message']:String(_0x165d5c);return console[_0x13e451(0x200)]('Error\x20reading\x20file:\x20'+_0x18ec41),0x1;}let _0x524216;try{_0x524216=parseDef(_0x28f0cb);}catch(_0x27275c){const _0x3e681c=_0x27275c instanceof Error?_0x27275c[_0x13e451(0x1ec)]:String(_0x27275c);return console[_0x13e451(0x200)](a30_0x5f540c[_0x13e451(0x176)](_0x13e451(0x295)+_0x3e681c)),0x1;}if(_0x524216[_0x13e451(0x229)]&&_0x524216[_0x13e451(0x229)]['length']>0x0)return console[_0x13e451(0x200)](a30_0x5f540c[_0x13e451(0x1c5)](_0x13e451(0x241)+_0x47fb04)),console[_0x13e451(0x200)](a30_0x5f540c['dim'](_0x13e451(0x1c1)+_0x524216[_0x13e451(0x229)][_0x13e451(0x23b)]+_0x13e451(0x254))),0x1;!_0x524216[_0x13e451(0x1bf)]&&(_0x524216['realtime']={'events':[{'name':_0x13e451(0x1a1),'source_table':'<database>.<table>'}],'attributes':[{'name':'last_page_viewed','type':_0x13e451(0x210)}],'id_stitching':{'primary_key':_0x524216['master'][_0x13e451(0x173)]===_0x13e451(0x23f)?'td_client_id':'user_id'}});_0x524216[_0x13e451(0x229)]=[{'name':_0x13e451(0x15a),'description':_0x13e451(0x1cc),'trigger_event':_0x13e451(0x1a1),'sections':[{'name':'Default','criteria':_0x13e451(0x247),'attributes':[_0x13e451(0x1fb)]}]}];const _0x4145ba=serializeDef(_0x524216);return writeFileSync(_0x47fb04,_0x4145ba,_0x13e451(0x2b3)),console[_0x13e451(0x200)](a30_0x5f540c[_0x13e451(0x1d9)]('✔')+_0x13e451(0x26d)+a30_0x5f540c[_0x13e451(0x249)](_0x47fb04)),(!_0x524216['realtime']||_0x28f0cb[_0x13e451(0x24f)](_0x13e451(0x14c))===-0x1)&&console[_0x13e451(0x200)](a30_0x5f540c['green']('✔')+_0x13e451(0x1fa)),console[_0x13e451(0x200)]('\x0a'+a30_0x5f540c['dim']('Next\x20steps:')),console[_0x13e451(0x200)](_0x13e451(0x197)+_0x47fb04+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x13e451(0x200)]('\x20\x202.\x20Run\x20'+a30_0x5f540c[_0x13e451(0x1bb)](_0x13e451(0x2bc)+_0x10a1e5)+_0x13e451(0x1b9)),0x0;}}
|
|
1
|
+
const a30_0x2c3752=a30_0x3f31;(function(_0x371faf,_0x3502c5){const _0x1de1bb=a30_0x3f31,_0x44dbc8=_0x371faf();while(!![]){try{const _0x3ee653=-parseInt(_0x1de1bb(0x204))/0x1+parseInt(_0x1de1bb(0x171))/0x2*(parseInt(_0x1de1bb(0x19a))/0x3)+-parseInt(_0x1de1bb(0xda))/0x4*(-parseInt(_0x1de1bb(0x1ae))/0x5)+parseInt(_0x1de1bb(0x138))/0x6*(-parseInt(_0x1de1bb(0x111))/0x7)+parseInt(_0x1de1bb(0x23d))/0x8+parseInt(_0x1de1bb(0x20a))/0x9*(parseInt(_0x1de1bb(0x184))/0xa)+parseInt(_0x1de1bb(0x163))/0xb;if(_0x3ee653===_0x3502c5)break;else _0x44dbc8['push'](_0x44dbc8['shift']());}catch(_0x96bd7c){_0x44dbc8['push'](_0x44dbc8['shift']());}}}(a30_0x1c0d,0x76bd3));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x2bf7a6 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_0x2ea4fc 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=a30_0x2c3752(0xd3),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x2511fe){const _0x4612fb=a30_0x2c3752,_0x481555=process[_0x4612fb(0x1fd)],_0x4773ca=_0x481555===_0x4612fb(0xc8)?_0x4612fb(0x135):_0x481555===_0x4612fb(0xbc)?'start':_0x4612fb(0xe1);spawn(_0x4773ca,[_0x2511fe],{'detached':!![],'stdio':_0x4612fb(0xec)})[_0x4612fb(0x165)]();}function migrateLegacyDirectory(){const _0x48874c=a30_0x2c3752;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x19f17b=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x19f17b[_0x48874c(0x1b9)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x48874c(0x1d5)](a30_0x2ea4fc[_0x48874c(0x196)](_0x48874c(0x17a)+LEGACY_PARENT_SEGMENT_DIR+_0x48874c(0x1ca)+PARENT_SEGMENT_DIR+_0x48874c(0x1fa))),console['error'](a30_0x2ea4fc[_0x48874c(0x180)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x48874c(0x183))),![];console[_0x48874c(0x1d5)](a30_0x2ea4fc[_0x48874c(0x196)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x48874c(0x190)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x2ea4fc[_0x48874c(0x1dc)](_0x48874c(0x17e)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4b3ec4){const _0x543b90=_0x4b3ec4 instanceof Error?_0x4b3ec4['message']:String(_0x4b3ec4);return console[_0x48874c(0x1d5)](a30_0x2ea4fc[_0x48874c(0x221)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x543b90+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x42792e){const _0x36a8e8=a30_0x2c3752;return migrateLegacyDirectory(),super[_0x36a8e8(0x177)](_0x42792e);}}function resolveYamlFile(_0x4b2950){const _0x1fcecd=a30_0x2c3752;if(_0x4b2950[_0x1fcecd(0x218)]('.yml')||_0x4b2950[_0x1fcecd(0x218)]('.yaml'))return _0x4b2950;return a30_0x2bf7a6[_0x1fcecd(0x10d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4b2950)+'.yml');}function formatProgressMessage(_0x46e296){const _0x492f3d=a30_0x2c3752,_0x3188f7=_0x46e296[_0x492f3d(0x1fc)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3188f7){const [,_0x4a2885,_0x70f4b9,_0x1e99b3='']=_0x3188f7;return a30_0x2ea4fc[_0x492f3d(0x180)](_0x4a2885+':')+'\x20'+_0x70f4b9+a30_0x2ea4fc[_0x492f3d(0x180)](_0x1e99b3);}return a30_0x2ea4fc[_0x492f3d(0x180)](_0x46e296);}function showFileNotFoundError(_0x94289a,_0x185606){const _0x378cf1=a30_0x2c3752;console[_0x378cf1(0x1d5)](a30_0x2ea4fc[_0x378cf1(0x221)](_0x378cf1(0x19f)+_0x94289a+'\x0a')),console[_0x378cf1(0x1d5)](a30_0x2ea4fc[_0x378cf1(0x22e)](_0x378cf1(0x1f9)+_0x185606+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x522d52){const _0x167914=a30_0x2c3752;if(!_0x522d52[_0x167914(0x152)])return;const _0x488c08=_0x522d52[_0x167914(0x152)],_0x43ed04=_0x488c08[_0x167914(0x206)]?a30_0x2ea4fc['green']('⚡\x20Enabled'):a30_0x2ea4fc[_0x167914(0x196)](_0x167914(0x1f2));console[_0x167914(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x167914(0x180)](_0x167914(0x1b4))+'\x20'+_0x43ed04);if(_0x488c08['events']&&_0x488c08[_0x167914(0x203)][_0x167914(0x1fe)]>0x0){console[_0x167914(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x167914(0x180)](_0x167914(0x236))+'\x20'+_0x488c08[_0x167914(0x203)][_0x167914(0x1fe)]+'\x20configured');for(const _0x2b682a of _0x488c08[_0x167914(0x203)]){const _0x3bf6fe=_0x2b682a[_0x167914(0x154)]===![]?a30_0x2ea4fc[_0x167914(0x221)]('✘'):a30_0x2ea4fc['green']('✔');console[_0x167914(0x1d5)]('\x20\x20\x20\x20'+_0x3bf6fe+'\x20'+_0x2b682a['name']),_0x2b682a[_0x167914(0x1e9)]&&console['error'](_0x167914(0x125)+a30_0x2ea4fc[_0x167914(0x221)](_0x2b682a['sourceTableError']));}}if(_0x488c08[_0x167914(0x153)]&&_0x488c08[_0x167914(0x153)]['length']>0x0){console[_0x167914(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x167914(0x180)](_0x167914(0x1a1))+'\x20'+_0x488c08[_0x167914(0x153)][_0x167914(0x1fe)]+_0x167914(0x21b));for(const _0x2ca11c of _0x488c08[_0x167914(0x153)]){const _0x1f1b60=_0x2ca11c['valid']?a30_0x2ea4fc[_0x167914(0x1dc)]('✔'):a30_0x2ea4fc[_0x167914(0x221)]('✘');console['error'](_0x167914(0x1b1)+_0x1f1b60+'\x20'+_0x2ca11c[_0x167914(0x13d)]+'\x20'+a30_0x2ea4fc[_0x167914(0x180)]('('+_0x2ca11c[_0x167914(0x103)]+')'));}}if(_0x488c08[_0x167914(0x166)]){const _0x4f3cbd=_0x488c08['idStitching']['stitchingKeys']?.[_0x167914(0x1fe)]?_0x167914(0x241)+_0x488c08[_0x167914(0x166)][_0x167914(0x1a3)][_0x167914(0x10d)](',\x20')+']':'';console[_0x167914(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x167914(0x180)]('ID\x20Stitching:')+'\x20'+_0x488c08[_0x167914(0x166)][_0x167914(0xc5)]+_0x4f3cbd);}if(_0x488c08[_0x167914(0x13e)]&&_0x488c08[_0x167914(0x13e)][_0x167914(0x1fe)]>0x0){console[_0x167914(0x1d5)]('\x20\x20'+a30_0x2ea4fc['dim']('Personalization:')+'\x20'+_0x488c08[_0x167914(0x13e)][_0x167914(0x1fe)]+_0x167914(0x22d)+(_0x488c08[_0x167914(0x13e)][_0x167914(0x1fe)]!==0x1?'s':''));for(const _0x30ff1f of _0x488c08['personalizationServices']){console[_0x167914(0x1d5)](_0x167914(0x21f)+_0x30ff1f[_0x167914(0x13d)]);}}}function showParentSegmentNotSetError(_0x38c623){const _0x43f9eb=a30_0x2c3752;console[_0x43f9eb(0x1d5)](a30_0x2ea4fc[_0x43f9eb(0x196)](_0x43f9eb(0x150))),console[_0x43f9eb(0x1d5)](_0x38c623);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x112);[a30_0x2c3752(0x161)]='List\x20parent\x20segments';async[a30_0x2c3752(0x1c1)](_0xbbdacf){const _0x4e19f3=a30_0x2c3752,{options:_0x5dadc8,args:_0x665043,tdx:_0x13f60c}=_0xbbdacf,_0x28ba7e=_0x665043[0x0];_0x5dadc8[_0x4e19f3(0xf9)]&&(console[_0x4e19f3(0x1d5)](_0x4e19f3(0x113)+_0x5dadc8[_0x4e19f3(0x238)]),_0x28ba7e&&console[_0x4e19f3(0x1d5)]('Pattern:\x20'+_0x28ba7e));const _0xd23a29=await withSpinner(_0x28ba7e?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x28ba7e+_0x4e19f3(0x21d):_0x4e19f3(0x1bc),()=>_0x13f60c['segment'][_0x4e19f3(0x23a)](),{'verbose':_0x5dadc8[_0x4e19f3(0xf9)]});let _0x2ce886=_0xd23a29[_0x4e19f3(0x225)];if(_0x28ba7e){const _0x62ffab=_0x28ba7e[_0x4e19f3(0x202)](/[.+^${}()|[\]\\]/g,_0x4e19f3(0x151))[_0x4e19f3(0x202)](/\*/g,'.*')[_0x4e19f3(0x202)](/\?/g,'.'),_0x1785c9=new RegExp('^'+_0x62ffab+'$','i');_0x2ce886=_0x2ce886[_0x4e19f3(0xd9)](_0x267395=>_0x1785c9['test'](_0x267395[_0x4e19f3(0x153)][_0x4e19f3(0x13d)]));}_0x2ce886[_0x4e19f3(0x102)]((_0x8a6de0,_0xd042d7)=>_0x8a6de0[_0x4e19f3(0x153)]['name'][_0x4e19f3(0x159)](_0xd042d7[_0x4e19f3(0x153)][_0x4e19f3(0x13d)])),console[_0x4e19f3(0x1d5)](_0x4e19f3(0x239)+_0x2ce886[_0x4e19f3(0x1fe)]+_0x4e19f3(0x117)+(_0x2ce886[_0x4e19f3(0x1fe)]!==0x1?'s':''));const _0x5513d1=_0x1f6c05=>{return getConsoleNextUrl(_0x5dadc8['site'],'/app/dw/parentSegments/'+_0x1f6c05);};if(_0x5dadc8[_0x4e19f3(0x118)]===_0x4e19f3(0x1a2)||_0x5dadc8[_0x4e19f3(0x118)]==='jsonl'){const _0x1b6767=_0x2ce886[_0x4e19f3(0x13b)](_0x3496d1=>({..._0x3496d1,'url':_0x5513d1(_0x3496d1['id'])}));await handleSDKOutput(_0x1b6767,_0x5dadc8);}else{if(_0x2ce886['length']===0x0)_0x28ba7e?console[_0x4e19f3(0x20c)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x28ba7e):console[_0x4e19f3(0x20c)](_0x4e19f3(0xf2));else for(const _0x376119 of _0x2ce886){const _0x5e2ee6=_0x376119[_0x4e19f3(0x153)][_0x4e19f3(0x19c)]?a30_0x2ea4fc[_0x4e19f3(0x180)]('\x20('+formatRows(_0x376119['attributes'][_0x4e19f3(0x19c)])+')'):'',_0x286789=hyperlink(_0x376119['attributes'][_0x4e19f3(0x13d)],_0x5513d1(_0x376119['id']));console[_0x4e19f3(0x20c)](_0x4e19f3(0xdd)+_0x286789+_0x5e2ee6);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0xea);[a30_0x2c3752(0x161)]=a30_0x2c3752(0x201);async[a30_0x2c3752(0x1c1)](_0x28927a){const _0xd00c7f=a30_0x2c3752,{options:_0x3d233b,args:_0x4b9e79,tdx:_0x5c8cec}=_0x28927a;console[_0xd00c7f(0x1d5)](_0xd00c7f(0xf3)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0xd00c7f(0x1af));const _0x2faa8d=_0x3d233b;if(_0x4b9e79[_0xd00c7f(0x1fe)]===0x0)return console[_0xd00c7f(0x1d5)](a30_0x2ea4fc['red'](_0xd00c7f(0xd2))),console[_0xd00c7f(0x1d5)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x51d87f=_0x4b9e79[0x0];if(!_0x2faa8d[_0xd00c7f(0x1be)]||!_0x2faa8d[_0xd00c7f(0x155)])return console[_0xd00c7f(0x1d5)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0xd00c7f(0x1d5)](_0xd00c7f(0x1ec)),0x1;_0x2faa8d[_0xd00c7f(0xf9)]&&(console['error'](_0xd00c7f(0x113)+_0x2faa8d[_0xd00c7f(0x238)]),console[_0xd00c7f(0x1d5)](_0xd00c7f(0x132)+_0x51d87f),console[_0xd00c7f(0x1d5)]('Database:\x20'+_0x2faa8d[_0xd00c7f(0x1be)]),console[_0xd00c7f(0x1d5)](_0xd00c7f(0x1c3)+_0x2faa8d[_0xd00c7f(0x155)]));const _0x4629b4=await loadJSONFromOptions(_0x2faa8d[_0xd00c7f(0x153)],_0x2faa8d[_0xd00c7f(0x192)]),_0x264977=await loadJSONFromOptions(_0x2faa8d['behaviors'],_0x2faa8d[_0xd00c7f(0x198)]),_0xdf9d55=await loadJSONFromOptions(_0x2faa8d['customerGroup'],_0x2faa8d[_0xd00c7f(0x130)]),_0x3d9d46={'name':_0x51d87f,'description':_0x2faa8d[_0xd00c7f(0x161)],'scheduleType':_0x2faa8d[_0xd00c7f(0x23e)],'scheduleOption':_0x2faa8d[_0xd00c7f(0x168)],'timezone':_0x2faa8d['timezone'],'master':{'parentDatabaseName':_0x2faa8d['database'],'parentTableName':_0x2faa8d[_0xd00c7f(0x155)]},'attributes':_0x4629b4,'behaviors':_0x264977,'customerGroup':_0xdf9d55},_0x848445=await withSpinner(_0xd00c7f(0x1ba)+_0x51d87f+'\x27...',()=>_0x5c8cec[_0xd00c7f(0xb6)][_0xd00c7f(0x1f8)](_0x3d9d46),{'verbose':_0x3d233b[_0xd00c7f(0xf9)]}),_0x55c053=_0x848445['data'];return console[_0xd00c7f(0x1d5)](_0xd00c7f(0x10e)+_0x55c053['name']+_0xd00c7f(0x224)+_0x55c053['id']),await handleSDKOutput([_0x55c053],_0x3d233b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']='segment:parent:update';[a30_0x2c3752(0x161)]=a30_0x2c3752(0xbf);async[a30_0x2c3752(0x1c1)](_0x543301){const _0x4d9913=a30_0x2c3752,{options:_0x2042ad,args:_0x1b76d4,tdx:_0x27e810}=_0x543301;console[_0x4d9913(0x1d5)](_0x4d9913(0xcc)+_0x4d9913(0x1b0)+_0x4d9913(0x1af));const _0x48f693=_0x2042ad;if(_0x1b76d4[_0x4d9913(0x1fe)]===0x0)return console['error'](a30_0x2ea4fc[_0x4d9913(0x221)](_0x4d9913(0xd2))),console[_0x4d9913(0x1d5)](_0x4d9913(0x194)),0x1;const _0x31d360=_0x1b76d4[0x0];_0x48f693['verbose']&&(console[_0x4d9913(0x1d5)](_0x4d9913(0x113)+_0x48f693[_0x4d9913(0x238)]),console[_0x4d9913(0x1d5)](_0x4d9913(0x13c)+_0x31d360));const _0x5e4226=await withSpinner(_0x4d9913(0x14e)+_0x31d360+_0x4d9913(0x21d),()=>_0x27e810[_0x4d9913(0xb6)][_0x4d9913(0x207)](_0x31d360),{'verbose':_0x48f693[_0x4d9913(0xf9)]}),_0x5dd593=_0x5e4226[_0x4d9913(0x225)],_0x435140=await loadJSONFromOptions(_0x48f693['addAttributes'],_0x48f693[_0x4d9913(0x173)]),_0x283256=await loadJSONFromOptions(_0x48f693[_0x4d9913(0xb7)],_0x48f693[_0x4d9913(0x17f)]),_0x1b4df3={'name':_0x5dd593[_0x4d9913(0x13d)],'description':_0x48f693[_0x4d9913(0x161)]!==undefined?_0x48f693[_0x4d9913(0x161)]:_0x5dd593[_0x4d9913(0x161)],'scheduleType':_0x48f693['scheduleType']!==undefined?_0x48f693['scheduleType']:_0x5dd593[_0x4d9913(0x23e)],'scheduleOption':_0x48f693[_0x4d9913(0x168)]!==undefined?_0x48f693['scheduleOption']:_0x5dd593[_0x4d9913(0x168)],'timezone':_0x48f693[_0x4d9913(0x1b5)]!==undefined?_0x48f693['timezone']:_0x5dd593[_0x4d9913(0x1b5)],'master':_0x5dd593['master'],'attributes':_0x435140?[..._0x5dd593[_0x4d9913(0x153)]||[],..._0x435140]:_0x5dd593['attributes'],'behaviors':_0x283256?[..._0x5dd593[_0x4d9913(0xeb)]||[],..._0x283256]:_0x5dd593[_0x4d9913(0xeb)],'customerGroup':_0x5dd593['customerGroup']},_0x111f03=await withSpinner(_0x4d9913(0x1d3)+_0x31d360+'\x27...',()=>_0x27e810['segment'][_0x4d9913(0x104)](_0x31d360,_0x1b4df3),{'verbose':_0x48f693[_0x4d9913(0xf9)]}),_0x28635e=_0x111f03[_0x4d9913(0x225)];return console[_0x4d9913(0x1d5)](_0x4d9913(0x189)+_0x28635e[_0x4d9913(0x13d)]+'\x27'),await handleSDKOutput([_0x28635e],_0x48f693),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0xe6);['description']=a30_0x2c3752(0x1da);async['execute'](_0x143d2c){const _0x5f1ebf=a30_0x2c3752,{options:_0x428d2f,args:_0x4617d8,tdx:_0x365899}=_0x143d2c,_0x598462=_0x428d2f,_0x206971=_0x4617d8[0x0]||_0x428d2f['parentSegment'];if(!_0x206971)return showParentSegmentNotSetError(_0x5f1ebf(0x188)+_0x5f1ebf(0x1ce)),0x1;if(_0x598462['use']&&_0x598462[_0x5f1ebf(0x1c7)])return console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc[_0x5f1ebf(0x221)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc[_0x5f1ebf(0x180)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc['dim']('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc[_0x5f1ebf(0x22e)](_0x5f1ebf(0x167))),0x1;const _0x51d212=_0x598462[_0x5f1ebf(0x1c7)]||a30_0x2bf7a6[_0x5f1ebf(0x10d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x206971)+_0x5f1ebf(0x17c));_0x598462[_0x5f1ebf(0xf9)]&&(console[_0x5f1ebf(0x1d5)]('Site:\x20'+_0x598462[_0x5f1ebf(0x238)]),console[_0x5f1ebf(0x1d5)](_0x5f1ebf(0x13c)+_0x206971),console[_0x5f1ebf(0x1d5)](_0x5f1ebf(0xfb)+_0x51d212));const _0x4d4382=await withSpinner(_0x5f1ebf(0xe5)+_0x206971+_0x5f1ebf(0x21d),()=>_0x365899[_0x5f1ebf(0xb6)]['pullParentYaml'](_0x206971),{'verbose':_0x598462[_0x5f1ebf(0xf9)]}),_0x3fb9be=_0x4d4382[_0x5f1ebf(0x225)];if(existsSync(_0x51d212)){const _0x1bca18=readFileSync(_0x51d212,_0x5f1ebf(0x193)),_0x243032=generateDiff(_0x1bca18,_0x3fb9be);if(!hasChanges(_0x243032))console['error'](a30_0x2ea4fc[_0x5f1ebf(0x1dc)]('✔')+_0x5f1ebf(0x110)+a30_0x2ea4fc[_0x5f1ebf(0x22e)](_0x51d212)+_0x5f1ebf(0x12a));else{console[_0x5f1ebf(0x1d5)](_0x5f1ebf(0x1bb)+_0x51d212+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x5f1ebf(0x1d5)](formatDiffWithColors(_0x243032)),console['error']('─'[_0x5f1ebf(0x197)](0x3c));if(!_0x598462['yes']){if(!isInteractive())return console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc['red']('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc[_0x5f1ebf(0x180)](_0x5f1ebf(0x1e1))),0x1;const _0x46dc40=await confirmKey(_0x5f1ebf(0x114)+_0x51d212+'\x27?');if(!_0x46dc40)return console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc[_0x5f1ebf(0x196)](_0x5f1ebf(0x215))),0x1;}writeFileSync(_0x51d212,_0x3fb9be,_0x5f1ebf(0x193)),console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x2ea4fc[_0x5f1ebf(0x22e)](_0x51d212));}}else{const _0x4a848b=a30_0x2bf7a6[_0x5f1ebf(0xdc)](_0x51d212);!existsSync(_0x4a848b)&&mkdirSync(_0x4a848b,{'recursive':!![]}),writeFileSync(_0x51d212,_0x3fb9be,_0x5f1ebf(0x193)),console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc['green']('✔')+_0x5f1ebf(0x121)+a30_0x2ea4fc['cyan'](_0x51d212));}return saveSessionContext({'parent_segment':_0x206971},_0x598462['session']),console[_0x5f1ebf(0x1d5)](a30_0x2ea4fc['green']('✔')+_0x5f1ebf(0x1e6)+a30_0x2ea4fc[_0x5f1ebf(0x180)]('parent_segment')+_0x5f1ebf(0xf8)+a30_0x2ea4fc[_0x5f1ebf(0x22e)](_0x206971)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x2c3752(0x13d)]='segment:parent:push';[a30_0x2c3752(0x161)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a30_0x2c3752(0x1c1)](_0x4ed1fc){const _0x3eacb9=a30_0x2c3752,{options:_0x5b356f,args:_0x26fdac,tdx:_0x4f79c1}=_0x4ed1fc,_0x23f0e9=_0x5b356f,_0x44d553=_0x26fdac[0x0]||_0x5b356f[_0x3eacb9(0x122)];if(!_0x44d553)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x3eacb9(0x220)),0x1;const _0x4492fd=resolveYamlFile(_0x44d553);if(!existsSync(_0x4492fd))return showFileNotFoundError(_0x4492fd,_0x44d553),0x1;_0x23f0e9['verbose']&&(console[_0x3eacb9(0x1d5)]('Site:\x20'+_0x23f0e9[_0x3eacb9(0x238)]),console[_0x3eacb9(0x1d5)](_0x3eacb9(0x1a8)+_0x4492fd));let _0x3b8dbf;try{_0x3b8dbf=readFileSync(_0x4492fd,_0x3eacb9(0x193));}catch(_0x5d26e3){const _0x3602af=_0x5d26e3 instanceof Error?_0x5d26e3[_0x3eacb9(0xc6)]:String(_0x5d26e3);return console[_0x3eacb9(0x1d5)](_0x3eacb9(0x1b3)+_0x3602af),0x1;}const _0x55daf2=await withSpinner(_0x3eacb9(0xed),()=>_0x4f79c1[_0x3eacb9(0xb6)]['pushParentYaml'](_0x3b8dbf),{'verbose':_0x23f0e9[_0x3eacb9(0xf9)]}),_0x364473=_0x55daf2['data'],{isNew:_0x5de2fb,name:_0x4db76f,hasChanges:_0x5e00a3,diffFormatted:_0x556e05}=_0x364473;if(!_0x5e00a3)return console['error'](_0x3eacb9(0x14f)+_0x4db76f+_0x3eacb9(0x1f0)),0x0;_0x5de2fb?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x4db76f+'\x27:'):console['error'](_0x3eacb9(0x14d)+_0x4db76f+'\x27:');console[_0x3eacb9(0x1d5)]('─'[_0x3eacb9(0x197)](0x3c)),console['error'](_0x556e05),console['error']('─'[_0x3eacb9(0x197)](0x3c));const _0x5a3353=_0x5de2fb?_0x3eacb9(0x10f)+_0x4db76f+'\x27?':_0x3eacb9(0xb9)+_0x4db76f+'\x27?';if(!_0x23f0e9[_0x3eacb9(0x18f)]){if(!isInteractive())return console['error'](a30_0x2ea4fc[_0x3eacb9(0x221)]('\x0aError:'),_0x3eacb9(0x136)),console[_0x3eacb9(0x1d5)](a30_0x2ea4fc[_0x3eacb9(0x180)](_0x3eacb9(0x1e1))),0x1;const _0x1b5a36=await confirmKey(_0x5a3353);if(!_0x1b5a36)return console[_0x3eacb9(0x1d5)](a30_0x2ea4fc[_0x3eacb9(0x196)](_0x3eacb9(0x215))),0x1;}const _0x131b1f=_0x5de2fb?'Creating':_0x3eacb9(0x141),_0xfc9b6b=await withSpinner(_0x131b1f+_0x3eacb9(0x144)+_0x4db76f+_0x3eacb9(0x21d),()=>_0x364473[_0x3eacb9(0x16b)](),{'verbose':_0x23f0e9['verbose']}),_0x30216c=_0xfc9b6b[_0x3eacb9(0x225)],_0x4adbc5=getConsoleNextUrl(_0x23f0e9[_0x3eacb9(0x238)],_0x3eacb9(0xe2)+_0x30216c['id']),_0xc60101=_0x5de2fb?'Created':_0x3eacb9(0xbb);return console[_0x3eacb9(0x1d5)]('✔\x20'+_0xc60101+_0x3eacb9(0x144)+_0x30216c[_0x3eacb9(0x13d)]+'\x27'),console[_0x3eacb9(0x1d5)]('\x20\x20'+_0x4adbc5),0x0;}}function a30_0x1c0d(){const _0x4bbe40=['column','\x27\x20is\x20already\x20up\x20to\x20date','segment:parent:show','⚡\x20Not\x20enabled','tdx\x20ps\x20push\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Executing\x20parent\x20segment\x20query...','sampleData','createParent','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','/\x20directories\x20exist.','Fetching\x20customers\x20schema...','match','platform','length','ps:rt:validate','Errors:','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','replace','events','690784XXKMaW','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','enabled','getParentFull','formatSchemaJson','joinKey','837vJQRvw','Validating\x20RT\x20configuration...','log','text','parent_segment','\x0a\x20\x20]\x0a}\x0a','true','\x20--attribute\x20\x22','\x0a\x20\x20\x20\x20]','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','schemaValid','Aborted.','errors','string','endsWith','No\x20RT-enabled\x20parent\x20segments\x20found','displayBehaviorsStats','\x20configured','keys','\x27...','personalization_services','\x20\x20\x20\x20-\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','red','\x20\x20\x20','/sessions/','\x27\x20with\x20ID:\x20','data','displayValidateResults','Columns:','preview','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Resolving\x20parent\x20segment\x20\x27','customersWithEvents','coveragePercent','\x20service','cyan','displayMasterInfo','segment:parent:fields','allValid','\x20Added\x20personalization\x20template\x20to\x20','segment:parent:preview','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20--behavior\x20\x22<name>\x22','Events:','Source:','site','✔\x20Found\x20','listParents','Personalization\x20service\x20description','displayRealtimeInfo','660304brQNiA','scheduleType','customers','Schema\x20saved\x20to\x20','\x20+\x20[','resolveParentId','segment','addBehaviors','Validate:','Apply\x20changes\x20to\x20\x27','SQL\x20query:\x0a','Updated','win32','displayAttributesStats','Join:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','columns','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Next\x20steps:','Fetching\x20behavior\x20list...','primaryKey','message','\x20\x20Columns:\x20','darwin','interval','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','page_view','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','status','all','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','parent_segments','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','\x20\x201.\x20Edit\x20','/attempt/','varchar','Found\x20YAML\x20file:\x20','filter','1246468jtzGoS','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','dirname','👥\x20','ps:pz:list','jsonl','\x0aUsage:\x20tdx\x20ps\x20preview\x20','xdg-open','/app/dw/parentSegments/','segment:parent:desc','Available\x20behaviors:','Fetching\x20parent\x20segment\x20\x27','segment:parent:pull','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','segment:parent:create','behaviors','ignore','Analyzing\x20changes...','Enriched:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','My\x20Service','number','No\x20parent\x20segments\x20found','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20Database:\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','-1d','label','\x20=\x20','verbose','\x20RT\x20configuration\x20is\x20valid','Output\x20file:\x20','trim','Coverage:','Creating','\x20RT-enabled\x20parent\x20segment','column_name','FINISHED','sort','type','updateParent','Validating\x20configuration...','Options:\x0a','displayPreviewHints','Rows:','\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','pushParentYaml','Error\x20parsing\x20YAML:\x20','workflowAttemptId','join','✔\x20Created\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','\x20No\x20changes\x20-\x20','21CrnlVd','segment:parent:list','Site:\x20','Overwrite\x20\x27','\x20Configuration\x20is\x20valid','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','\x20parent\x20segment','format','\x20tdx\x20wf\x20attempt\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20personalization\x20service','listFields','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Options\x20(one\x20required):\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','parentSegment','Attributes','\x20trigger=','\x20\x20\x20\x20\x20\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','push','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20--interval\x20','\x20is\x20already\x20up\x20to\x20date','audienceId','Join\x20on:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','segment:parent:view','td_client_id','customerGroupFile','\x0a\x20\x20\x20\x20}','Name:\x20','\x20\x20Note:\x20','limit','open','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','bold','1233624KoLykN','\x27\x20and\x20run\x20workflow?','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','map','Parent\x20segment:\x20','name','personalizationServices','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','{\x0a\x20\x20\x22database\x22:\x20\x22','Updating','\x20\x20No\x20sample\x20data\x20available','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x20parent\x20segment\x20\x27','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','last_page_viewed','personalization','SELECT\x20*\x20FROM\x20(\x0a','Show\x20parent\x20segment\x20details','/app/workflows/','Behaviors','\x0aChanges\x20to\x20apply\x20to\x20\x27','Fetching\x20current\x20configuration\x20for\x20\x27','✔\x20No\x20changes\x20-\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x5c$&','realtime','attributes','sourceTableValid','table','collectSchema','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\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','localeCompare','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','Audience\x20ID:','\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','\x20to\x20configure\x20your\x20personalization\x20service','\x27\x20is\x20up\x20to\x20date','column_type','.customers)','description','realtime:','788348IbeQqy','Fetching\x20SQL\x20for\x20\x27','unref','idStitching','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','scheduleOption','Error:','segment:parent:sql','apply','processedRows','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','To\x20view\x20sample\x20data:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x22\x20}','6POelkv','parent_id','addAttributesFile','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','reduce','\x20\x202.\x20Run\x20','run','\x20total','displayPreviewResults','\x0a⚠️\x20\x20Both\x20','\x20Added\x20RT\x202.0\x20template\x20section','.yml','Behavior:','✔\x20Renamed\x20directory\x20to\x20','addBehaviorsFile','dim','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20behaviors','/\x20directory.\x0a','17510Gmobtw','Customers:','attribute','query','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','sections','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x0aNo\x20sample\x20data\x20available','information_schema','\x20rows\x20','yes','/\x20→\x20','schemaError','attributesFile','utf-8','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\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','yellow','repeat','behaviorsFile','Listing\x20RT-enabled\x20parent\x20segments...','853668LnmWVz','getOutputDatabaseName','population','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20File\x20not\x20found:\x20','matchedCount','Attributes:','json','stitchingKeys','segment:parent:validate','workflowId','Available\x20attributes:','Attribute:','YAML\x20file:\x20','Attempt:','trigger_event','master','%)\x20','To\x20cancel:','10OpdxhG','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20\x20\x20','setJobId','Error\x20reading\x20file:\x20','RT\x202.0:','timezone','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','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','getBehaviorNames','isDirectory','Creating\x20parent\x20segment\x20\x27','\x0aChanges\x20to\x20\x27','Listing\x20parent\x20segments...','displaySummary','database','start','validateParentYaml','execute','Output\x20Database:','Table:\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','foreignKey','Session:','output','jobId','stats','/\x20and\x20','rowCount','list','web','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Master:','displayColumns','RT\x202.0\x20Validate:','\x20--behavior\x20\x22','Updating\x20parent\x20segment\x20\x27','\x20\x20Tables:\x201\x20customers\x20+\x20','error','\x20--enriched','customerPercent','behavior_','behavior','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','stop','green','tdx\x20ps\x20preview\x20','Created','ps:rt:list','totalEvents','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x22,\x20\x22type\x22:\x20\x22','displaySampleData','SELECT\x20*\x20FROM\x20','\x20Context\x20set:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x0a✔\x20Workflow\x20started','sourceTableError','enriched','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','toLowerCase','<database>.<table>'];a30_0x1c0d=function(){return _0x4bbe40;};return a30_0x1c0d();}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x1a4);['description']=a30_0x2c3752(0x1e2);async[a30_0x2c3752(0x1c1)](_0x4cab99){const _0x1a0330=a30_0x2c3752,{options:_0x4f174f,args:_0x5ba130,tdx:_0x2f5a54}=_0x4cab99,_0x3df6cc=_0x4f174f,_0x79b790=_0x5ba130[0x0]||_0x4f174f[_0x1a0330(0x122)];if(!_0x79b790)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'+_0x1a0330(0x146)+_0x1a0330(0x106)+_0x1a0330(0xca)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x1a0330(0x174)),0x1;const _0x577e7e=resolveYamlFile(_0x79b790);if(!existsSync(_0x577e7e))return showFileNotFoundError(_0x577e7e,_0x79b790),0x1;_0x3df6cc[_0x1a0330(0xf9)]&&(console['error'](_0x1a0330(0x113)+_0x3df6cc[_0x1a0330(0x238)]),console['error'](_0x1a0330(0x1a8)+_0x577e7e));let _0x16f5f7;try{_0x16f5f7=readFileSync(_0x577e7e,_0x1a0330(0x193));}catch(_0x407155){const _0x4afada=_0x407155 instanceof Error?_0x407155[_0x1a0330(0xc6)]:String(_0x407155);return console['error'](_0x1a0330(0x1b3)+_0x4afada),0x1;}const _0x2b796c=createCommandSpinner(a30_0x2ea4fc[_0x1a0330(0x180)](_0x1a0330(0x105)),{'verbose':_0x3df6cc[_0x1a0330(0xf9)]});_0x2b796c[_0x1a0330(0x1bf)]();const _0x40c96c={'onProgress':_0x5b7dde=>{const _0x3f50b8=_0x1a0330;_0x2b796c[_0x3f50b8(0x20d)]=formatProgressMessage(_0x5b7dde);}};if(_0x3df6cc[_0x1a0330(0x1ab)])_0x40c96c[_0x1a0330(0x1ab)]=!![];if(_0x3df6cc[_0x1a0330(0x1ea)])_0x40c96c[_0x1a0330(0x1ea)]=!![];_0x3df6cc[_0x1a0330(0x186)]&&(_0x40c96c[_0x1a0330(0x186)]=_0x3df6cc[_0x1a0330(0x186)]);_0x3df6cc[_0x1a0330(0x1d9)]&&(_0x40c96c[_0x1a0330(0x1d9)]=_0x3df6cc[_0x1a0330(0x1d9)]);if(_0x3df6cc['interval'])_0x40c96c[_0x1a0330(0xc9)]=_0x3df6cc['interval'];let _0x291132;try{_0x291132=await _0x2f5a54[_0x1a0330(0xb6)][_0x1a0330(0x1c0)](_0x16f5f7,_0x40c96c),_0x2b796c[_0x1a0330(0x1db)]();}catch(_0x48de0d){_0x2b796c[_0x1a0330(0x1db)]();throw _0x48de0d;}const _0x52a1c1=_0x3df6cc['interval']||_0x1a0330(0xf6);return this[_0x1a0330(0x226)](_0x291132,_0x40c96c,_0x577e7e,_0x52a1c1),_0x291132['allValid']?0x0:0x1;}[a30_0x2c3752(0x226)](_0x4ed74b,_0x4924a1,_0x147d7f,_0x42b8bb){const _0x2a6923=a30_0x2c3752;console[_0x2a6923(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x2a6923(0x137)](_0x2a6923(0xb8))+'\x20'+_0x4ed74b[_0x2a6923(0x13d)]),console[_0x2a6923(0x1d5)]('═'[_0x2a6923(0x197)](0x3c)),this[_0x2a6923(0x22f)](_0x4ed74b);if(typeof _0x4924a1[_0x2a6923(0x186)]===_0x2a6923(0x217)){this['displayAttributesStats'](_0x4ed74b),this[_0x2a6923(0x1bd)](_0x4ed74b),this['displayPreviewHints'](_0x147d7f,_0x42b8bb,_0x2a6923(0x186),_0x4924a1['attribute']);return;}if(_0x4924a1['attribute']===!![]){this['displayAttributesStats'](_0x4ed74b),this[_0x2a6923(0x1bd)](_0x4ed74b),this[_0x2a6923(0x107)](_0x147d7f,_0x42b8bb,_0x2a6923(0x153));return;}if(typeof _0x4924a1[_0x2a6923(0x1d9)]==='string'){this['displayBehaviorsStats'](_0x4ed74b,_0x42b8bb),this[_0x2a6923(0x1bd)](_0x4ed74b),this['displayPreviewHints'](_0x147d7f,_0x42b8bb,_0x2a6923(0x1d9),_0x4924a1[_0x2a6923(0x1d9)]);return;}if(_0x4924a1[_0x2a6923(0x1d9)]===!![]){this[_0x2a6923(0x21a)](_0x4ed74b,_0x42b8bb),this[_0x2a6923(0x1bd)](_0x4ed74b),this['displayPreviewHints'](_0x147d7f,_0x42b8bb,'behaviors');return;}this[_0x2a6923(0xbd)](_0x4ed74b),this['displayBehaviorsStats'](_0x4ed74b,_0x42b8bb),this[_0x2a6923(0x23c)](_0x4ed74b),this[_0x2a6923(0x1bd)](_0x4ed74b),this[_0x2a6923(0x107)](_0x147d7f,_0x42b8bb,_0x2a6923(0xcf));}[a30_0x2c3752(0x23c)](_0x35f93b){displayRealtimeValidation(_0x35f93b);}[a30_0x2c3752(0x107)](_0x55e192,_0x67d0f6,_0x5d7ac7,_0x167dbc){const _0xb929f2=a30_0x2c3752;console[_0xb929f2(0x1d5)]('\x0a'+a30_0x2ea4fc[_0xb929f2(0x180)](_0xb929f2(0x16e)));const _0x5e9478=_0x67d0f6!=='-1d'?_0xb929f2(0x129)+_0x67d0f6:'';if(_0x5d7ac7===_0xb929f2(0x186)&&_0x167dbc)console['error']('\x20\x20'+a30_0x2ea4fc[_0xb929f2(0x180)](_0xb929f2(0x1dd)+_0x55e192+_0xb929f2(0x211)+_0x167dbc+'\x22'+_0x5e9478));else{if(_0x5d7ac7===_0xb929f2(0x1d9)&&_0x167dbc)console[_0xb929f2(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0xb929f2(0x180)](_0xb929f2(0x1dd)+_0x55e192+_0xb929f2(0x1d2)+_0x167dbc+'\x22'+_0x5e9478));else(_0x5d7ac7==='attributes'||_0x5d7ac7===_0xb929f2(0xcf))&&console[_0xb929f2(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0xb929f2(0x180)](_0xb929f2(0x1dd)+_0x55e192+'\x20--attribute\x20\x22<name>\x22'+_0x5e9478));}(_0x5d7ac7===_0xb929f2(0xeb)||_0x5d7ac7===_0xb929f2(0xcf))&&console[_0xb929f2(0x1d5)]('\x20\x20'+a30_0x2ea4fc['dim'](_0xb929f2(0x1dd)+_0x55e192+_0xb929f2(0x235)+_0x5e9478)),_0x5d7ac7===_0xb929f2(0xcf)&&console[_0xb929f2(0x1d5)]('\x20\x20'+a30_0x2ea4fc['dim'](_0xb929f2(0x1dd)+_0x55e192+_0xb929f2(0x1d6)+_0x5e9478));}[a30_0x2c3752(0x22f)](_0x3a3981){const _0xca722b=a30_0x2c3752,{master:_0x2b8f65}=_0x3a3981,_0x3947f1=_0x2b8f65[_0xca722b(0x214)]?a30_0x2ea4fc[_0xca722b(0x1dc)]('✔'):a30_0x2ea4fc[_0xca722b(0x221)]('✘');console[_0xca722b(0x1d5)]('\x0a'+a30_0x2ea4fc[_0xca722b(0x180)]('Master\x20Table')),console[_0xca722b(0x1d5)](_0x3947f1+'\x20'+a30_0x2ea4fc[_0xca722b(0x137)](_0x2b8f65[_0xca722b(0x1be)]+'.'+_0x2b8f65[_0xca722b(0x155)])),_0x2b8f65[_0xca722b(0x214)]?_0x2b8f65[_0xca722b(0x1cb)]!==undefined&&console['error']('\x20\x20'+a30_0x2ea4fc[_0xca722b(0x180)](_0xca722b(0x108))+'\x20'+a30_0x2ea4fc[_0xca722b(0x22e)](formatRows(_0x2b8f65[_0xca722b(0x1cb)]))):console[_0xca722b(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0xca722b(0x221)]('Error:')+'\x20'+_0x2b8f65[_0xca722b(0x191)]);}[a30_0x2c3752(0xbd)](_0x5c7247){const _0x12cdc4=a30_0x2c3752;if(_0x5c7247['attributes'][_0x12cdc4(0x1fe)]===0x0)return;console[_0x12cdc4(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x12cdc4(0x180)](_0x12cdc4(0x123)));for(const _0x37b106 of _0x5c7247[_0x12cdc4(0x153)]){const _0x20df8b=_0x37b106[_0x12cdc4(0x214)]?a30_0x2ea4fc['green']('✔'):a30_0x2ea4fc[_0x12cdc4(0x221)]('✘');let _0x2a4801='';if(_0x37b106[_0x12cdc4(0x214)]&&_0x37b106['matchedCount']!==undefined&&_0x37b106[_0x12cdc4(0x22c)]!==undefined){const _0x495cdb=_0x37b106['coveragePercent']['toFixed'](0x1),_0x4c828c=_0x37b106[_0x12cdc4(0x22c)]>=0x50?a30_0x2ea4fc[_0x12cdc4(0x1dc)]:_0x37b106[_0x12cdc4(0x22c)]>=0x32?a30_0x2ea4fc['yellow']:a30_0x2ea4fc[_0x12cdc4(0x221)];_0x2a4801='\x20'+a30_0x2ea4fc['dim'](_0x12cdc4(0xfd))+'\x20'+_0x4c828c(_0x495cdb+'%')+'\x20('+formatRows(_0x37b106[_0x12cdc4(0x1a0)])+'\x20rows)';}console[_0x12cdc4(0x1d5)](_0x20df8b+'\x20'+a30_0x2ea4fc[_0x12cdc4(0x137)](_0x37b106[_0x12cdc4(0x13d)])+_0x2a4801),console[_0x12cdc4(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x12cdc4(0x180)]('Source:')+'\x20'+a30_0x2ea4fc[_0x12cdc4(0x137)](_0x37b106['database']+'.'+_0x37b106[_0x12cdc4(0x155)]));const _0x4096a5=_0x37b106[_0x12cdc4(0x209)]===_0x37b106[_0x12cdc4(0x1c5)]?a30_0x2ea4fc[_0x12cdc4(0x180)](_0x12cdc4(0x12c))+'\x20'+_0x37b106['joinKey']:a30_0x2ea4fc[_0x12cdc4(0x180)](_0x12cdc4(0xbe))+'\x20'+_0x37b106['joinKey']+_0x12cdc4(0xf8)+_0x37b106[_0x12cdc4(0x1c5)];console[_0x12cdc4(0x1d5)]('\x20\x20'+_0x4096a5),console[_0x12cdc4(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x12cdc4(0x180)](_0x12cdc4(0x227))),this[_0x12cdc4(0x1d0)](_0x37b106[_0x12cdc4(0xc1)]),!_0x37b106[_0x12cdc4(0x214)]&&console[_0x12cdc4(0x1d5)]('\x20\x20'+a30_0x2ea4fc['red'](_0x12cdc4(0x169))+'\x20'+_0x37b106[_0x12cdc4(0x191)]);}}[a30_0x2c3752(0x21a)](_0x48be9d,_0x580eee){const _0x5f457b=a30_0x2c3752;if(_0x48be9d[_0x5f457b(0xeb)]['length']===0x0)return;console[_0x5f457b(0x1d5)]('\x0a'+a30_0x2ea4fc['dim'](_0x5f457b(0x14c))+'\x20'+a30_0x2ea4fc[_0x5f457b(0x180)]('('+_0x580eee+')'));for(const _0x52ce1e of _0x48be9d['behaviors']){const _0x2b7416=_0x52ce1e[_0x5f457b(0x214)]?a30_0x2ea4fc[_0x5f457b(0x1dc)]('✔'):a30_0x2ea4fc[_0x5f457b(0x221)]('✘');let _0x105d49='';if(_0x52ce1e[_0x5f457b(0x214)]&&_0x52ce1e[_0x5f457b(0x22b)]!==undefined&&_0x52ce1e[_0x5f457b(0x1e0)]!==undefined){const _0x481e78=_0x52ce1e[_0x5f457b(0x1d7)]?.['toFixed'](0x1)||'?',_0x1427d1=(_0x52ce1e['customerPercent']??0x0)>=0x32?a30_0x2ea4fc[_0x5f457b(0x1dc)]:(_0x52ce1e[_0x5f457b(0x1d7)]??0x0)>=0x14?a30_0x2ea4fc[_0x5f457b(0x196)]:a30_0x2ea4fc[_0x5f457b(0x221)];_0x105d49='\x20'+a30_0x2ea4fc[_0x5f457b(0x180)](_0x5f457b(0x185))+'\x20'+_0x1427d1(formatRows(_0x52ce1e[_0x5f457b(0x22b)]))+'\x20('+_0x481e78+_0x5f457b(0x1ac)+a30_0x2ea4fc[_0x5f457b(0x180)]('Events:')+'\x20'+a30_0x2ea4fc[_0x5f457b(0x22e)](formatRows(_0x52ce1e[_0x5f457b(0x1e0)]));}console[_0x5f457b(0x1d5)](_0x2b7416+'\x20'+a30_0x2ea4fc[_0x5f457b(0x137)](_0x52ce1e[_0x5f457b(0x13d)])+_0x105d49),console['error']('\x20\x20'+a30_0x2ea4fc[_0x5f457b(0x180)](_0x5f457b(0x237))+'\x20'+a30_0x2ea4fc[_0x5f457b(0x137)](_0x52ce1e['database']+'.'+_0x52ce1e[_0x5f457b(0x155)]));const _0x48df58=_0x52ce1e[_0x5f457b(0x209)]===_0x52ce1e[_0x5f457b(0x1c5)]?a30_0x2ea4fc[_0x5f457b(0x180)]('Join\x20on:')+'\x20'+_0x52ce1e[_0x5f457b(0x209)]:a30_0x2ea4fc[_0x5f457b(0x180)]('Join:')+'\x20'+_0x52ce1e[_0x5f457b(0x209)]+_0x5f457b(0xf8)+_0x52ce1e[_0x5f457b(0x1c5)];console[_0x5f457b(0x1d5)]('\x20\x20'+_0x48df58),console[_0x5f457b(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x5f457b(0x180)](_0x5f457b(0x227))),this['displayColumns'](_0x52ce1e[_0x5f457b(0xc1)]),!_0x52ce1e[_0x5f457b(0x214)]&&console[_0x5f457b(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x5f457b(0x221)](_0x5f457b(0x169))+'\x20'+_0x52ce1e['schemaError']);}}[a30_0x2c3752(0x1d0)](_0x5c5864){const _0x35d92c=a30_0x2c3752;for(const _0x5c84f3 of _0x5c5864){_0x5c84f3[_0x35d92c(0xf7)]===_0x5c84f3[_0x35d92c(0x1ef)]||_0x5c84f3[_0x35d92c(0x1ef)]==='*'?console[_0x35d92c(0x1d5)]('\x20\x20\x20\x20-\x20'+_0x5c84f3['label']):console['error'](_0x35d92c(0x21f)+_0x5c84f3[_0x35d92c(0xf7)]+'\x20'+a30_0x2ea4fc['dim']('('+_0x5c84f3['column']+')'));}}[a30_0x2c3752(0x1bd)](_0x3ce62f){const _0x471488=a30_0x2c3752;console[_0x471488(0x1d5)]('─'[_0x471488(0x197)](0x3c));if(_0x3ce62f[_0x471488(0x216)][_0x471488(0x1fe)]>0x0){console[_0x471488(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x471488(0x221)](_0x471488(0x200)));for(const _0x209990 of _0x3ce62f[_0x471488(0x216)]){console[_0x471488(0x1d5)]('\x20\x20'+a30_0x2ea4fc['red']('•')+'\x20'+_0x209990);}}_0x3ce62f[_0x471488(0x231)]&&console[_0x471488(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x471488(0x1dc)]('✔')+_0x471488(0x115));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x233);[a30_0x2c3752(0x161)]=a30_0x2c3752(0x205);async['execute'](_0x2dfc18){const _0x5cef21=a30_0x2c3752,{options:_0x516c44,args:_0x19d7ed,tdx:_0x564d14}=_0x2dfc18,_0xa010ce=_0x516c44,_0x12fa55=_0x19d7ed[0x0]||_0x516c44['parentSegment'];if(!_0x12fa55)return showParentSegmentNotSetError(_0x5cef21(0x1c4)+_0x5cef21(0x13a)+_0x5cef21(0x120)+_0x5cef21(0x11a)+_0x5cef21(0x12d)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x5cef21(0xcd)+_0x5cef21(0x174)),0x1;if(!_0xa010ce[_0x5cef21(0x1ab)]&&!_0xa010ce['attribute']&&!_0xa010ce[_0x5cef21(0x1d9)]&&!_0xa010ce[_0x5cef21(0x1ea)])return console[_0x5cef21(0x1d5)](a30_0x2ea4fc[_0x5cef21(0x221)](_0x5cef21(0xd0))),console[_0x5cef21(0x1d5)](_0x5cef21(0x234)),console['error']('Options:'),console['error'](_0x5cef21(0x213)),console['error'](_0x5cef21(0x181)),console[_0x5cef21(0x1d5)](_0x5cef21(0x1f5)),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x499e89=resolveYamlFile(_0x12fa55);if(!existsSync(_0x499e89))return showFileNotFoundError(_0x499e89,_0x12fa55),0x1;_0xa010ce[_0x5cef21(0xf9)]&&(console[_0x5cef21(0x1d5)](_0x5cef21(0x113)+_0xa010ce[_0x5cef21(0x238)]),console['error'](_0x5cef21(0x1a8)+_0x499e89));let _0xde0d30;try{_0xde0d30=readFileSync(_0x499e89,_0x5cef21(0x193));}catch(_0x3cb423){const _0x40aacb=_0x3cb423 instanceof Error?_0x3cb423[_0x5cef21(0xc6)]:String(_0x3cb423);return console[_0x5cef21(0x1d5)](_0x5cef21(0x1b3)+_0x40aacb),0x1;}let _0x18db25;try{_0x18db25=parseDef(_0xde0d30);}catch(_0x1f8dcc){const _0x18e0b3=_0x1f8dcc instanceof Error?_0x1f8dcc[_0x5cef21(0xc6)]:String(_0x1f8dcc);return console[_0x5cef21(0x1d5)](a30_0x2ea4fc[_0x5cef21(0x221)](_0x5cef21(0x10b)+_0x18e0b3)),0x1;}if(_0xa010ce['attribute']===!![]||_0xa010ce[_0x5cef21(0x186)]===''){const _0x4ed5e7=_0x18db25['attributes']?.[_0x5cef21(0x13b)](_0x44de8c=>_0x44de8c[_0x5cef21(0x13d)])||[];if(_0x4ed5e7[_0x5cef21(0x1fe)]===0x0)console[_0x5cef21(0x1d5)](a30_0x2ea4fc['red'](_0x5cef21(0x1f4)));else{console[_0x5cef21(0x1d5)](a30_0x2ea4fc['red']('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x5cef21(0x1d5)](_0x5cef21(0x1a6));for(const _0x314475 of _0x4ed5e7){console[_0x5cef21(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0x5cef21(0x22e)](_0x314475));}console[_0x5cef21(0x1d5)](_0x5cef21(0xe0)+_0x12fa55+_0x5cef21(0x211)+_0x4ed5e7[0x0]+'\x22');}return 0x1;}if(_0xa010ce[_0x5cef21(0x1d9)]===!![]||_0xa010ce[_0x5cef21(0x1d9)]===''){const _0x50a61f=_0x18db25[_0x5cef21(0xeb)]?.[_0x5cef21(0x13b)](_0xdb34e8=>_0xdb34e8[_0x5cef21(0x13d)])||[];if(_0x50a61f[_0x5cef21(0x1fe)]===0x0)console[_0x5cef21(0x1d5)](a30_0x2ea4fc[_0x5cef21(0x221)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x5cef21(0x1d5)](a30_0x2ea4fc[_0x5cef21(0x221)](_0x5cef21(0x11c))),console[_0x5cef21(0x1d5)](_0x5cef21(0xe4));for(const _0x130a4d of _0x50a61f){console[_0x5cef21(0x1d5)]('\x20\x20'+a30_0x2ea4fc['cyan'](_0x130a4d));}console[_0x5cef21(0x1d5)](_0x5cef21(0xe0)+_0x12fa55+_0x5cef21(0x1d2)+_0x50a61f[0x0]+'\x22');}return 0x1;}const _0x172dc2=createCommandSpinner(a30_0x2ea4fc['dim']('Fetching\x20sample\x20data...'),{'verbose':_0xa010ce['verbose']});_0x172dc2[_0x5cef21(0x1bf)]();const _0x193871={'onProgress':_0x59e0b6=>{const _0x1ef511=_0x5cef21;_0x172dc2[_0x1ef511(0x20d)]=formatProgressMessage(_0x59e0b6);}};if(_0xa010ce[_0x5cef21(0x1ab)])_0x193871[_0x5cef21(0x1ab)]=!![];if(_0xa010ce[_0x5cef21(0x186)]&&typeof _0xa010ce['attribute']===_0x5cef21(0x217))_0x193871[_0x5cef21(0x186)]=_0xa010ce[_0x5cef21(0x186)];if(_0xa010ce[_0x5cef21(0x1d9)]&&typeof _0xa010ce[_0x5cef21(0x1d9)]===_0x5cef21(0x217))_0x193871[_0x5cef21(0x1d9)]=_0xa010ce[_0x5cef21(0x1d9)];if(_0xa010ce['enriched'])_0x193871[_0x5cef21(0x1ea)]=!![];if(_0xa010ce[_0x5cef21(0xc9)])_0x193871[_0x5cef21(0xc9)]=_0xa010ce['interval'];let _0xca8328;try{_0xca8328=await _0x564d14[_0x5cef21(0xb6)]['previewParentYaml'](_0xde0d30,_0x193871),_0x172dc2[_0x5cef21(0x1db)]();}catch(_0x3e01c0){_0x172dc2[_0x5cef21(0x1db)]();throw _0x3e01c0;}return await this[_0x5cef21(0x179)](_0xca8328,{'master':_0xa010ce['master'],'attribute':typeof _0xa010ce['attribute']==='string'?_0xa010ce[_0x5cef21(0x186)]:undefined,'behavior':typeof _0xa010ce[_0x5cef21(0x1d9)]===_0x5cef21(0x217)?_0xa010ce[_0x5cef21(0x1d9)]:undefined,'enriched':_0xa010ce[_0x5cef21(0x1ea)]}),_0xca8328['allValid']?0x0:0x1;}async[a30_0x2c3752(0x179)](_0x3a27cf,_0x2924db){const _0xde1f69=a30_0x2c3752;console[_0xde1f69(0x1d5)]('\x0a'+a30_0x2ea4fc[_0xde1f69(0x137)]('Preview:')+'\x20'+_0x3a27cf[_0xde1f69(0x13d)]),console[_0xde1f69(0x1d5)]('═'['repeat'](0x3c));if(_0x2924db[_0xde1f69(0x1ab)]&&_0x3a27cf[_0xde1f69(0x1f7)]){const _0x5ce136=a30_0x2ea4fc['dim'](_0xde1f69(0x1cf))+'\x20'+a30_0x2ea4fc[_0xde1f69(0x137)](_0x3a27cf[_0xde1f69(0x1ab)][_0xde1f69(0x1be)]+'.'+_0x3a27cf[_0xde1f69(0x1ab)][_0xde1f69(0x155)]);await this[_0xde1f69(0x1e4)](_0x5ce136,_0x3a27cf[_0xde1f69(0x1f7)]);}else{if(_0x2924db['attribute']&&_0x3a27cf['sampleData']){const _0x1588f5=a30_0x2ea4fc[_0xde1f69(0x180)](_0xde1f69(0x1a7))+'\x20'+a30_0x2ea4fc[_0xde1f69(0x137)](_0x2924db[_0xde1f69(0x186)]);await this[_0xde1f69(0x1e4)](_0x1588f5,_0x3a27cf[_0xde1f69(0x1f7)]);}else{if(_0x2924db[_0xde1f69(0x1d9)]&&_0x3a27cf[_0xde1f69(0x1f7)]){const _0x5bd982=a30_0x2ea4fc[_0xde1f69(0x180)](_0xde1f69(0x17d))+'\x20'+a30_0x2ea4fc['bold'](_0x2924db['behavior']);await this[_0xde1f69(0x1e4)](_0x5bd982,_0x3a27cf[_0xde1f69(0x1f7)]);}else{if(_0x2924db[_0xde1f69(0x1ea)]&&_0x3a27cf[_0xde1f69(0x1f7)]){const _0x55e18e=a30_0x2ea4fc[_0xde1f69(0x180)](_0xde1f69(0xee))+'\x20'+a30_0x2ea4fc[_0xde1f69(0x137)]('Master\x20+\x20Attributes');await this['displaySampleData'](_0x55e18e,_0x3a27cf[_0xde1f69(0x1f7)]);}else!_0x3a27cf[_0xde1f69(0x1f7)]&&console[_0xde1f69(0x1d5)](_0xde1f69(0x18c));}}}if(_0x3a27cf[_0xde1f69(0x216)][_0xde1f69(0x1fe)]>0x0){console[_0xde1f69(0x1d5)]('─'['repeat'](0x3c)),console[_0xde1f69(0x1d5)]('\x0a'+a30_0x2ea4fc[_0xde1f69(0x221)]('Errors:'));for(const _0x5b6e4a of _0x3a27cf[_0xde1f69(0x216)]){console[_0xde1f69(0x1d5)]('\x20\x20'+a30_0x2ea4fc[_0xde1f69(0x221)]('•')+'\x20'+_0x5b6e4a);}}}async[a30_0x2c3752(0x1e4)](_0x4cfa47,_0x1180ef){const _0x4e205a=a30_0x2c3752;if(_0x1180ef['length']===0x0){console[_0x4e205a(0x1d5)]('\x0a'+_0x4cfa47),console[_0x4e205a(0x1d5)](_0x4e205a(0x142));return;}console['error']('\x0a'+_0x4cfa47);const _0x3f602d=Object[_0x4e205a(0x21c)](_0x1180ef[0x0])['map'](_0x4919bb=>({'name':_0x4919bb,'type':typeof _0x1180ef[0x0][_0x4919bb]===_0x4e205a(0xf1)?'double':_0x4e205a(0xd7)})),_0x5071f5={'queryId':_0x4e205a(0x228),'columns':_0x3f602d,'data':_0x1180ef,'stats':{'state':_0x4e205a(0x101),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1180ef[_0x4e205a(0x1fe)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x41c26b=formatAsTable(_0x5071f5,_0x1180ef[_0x4e205a(0x1fe)],!![]);await writeOutput(_0x41c26b,undefined,_0x4e205a(0x155));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x2c3752(0x13d)]='segment:parent:run';[a30_0x2c3752(0x161)]=a30_0x2c3752(0xe9);async[a30_0x2c3752(0x1c1)](_0x226dac){const _0x397e9a=a30_0x2c3752,{options:_0xdec864,args:_0x59a4c2,tdx:_0x81d598}=_0x226dac,_0x1ba597=_0xdec864,_0x21af77=_0x59a4c2[0x0]||_0xdec864[_0x397e9a(0x122)];if(!_0x21af77)return showParentSegmentNotSetError(_0x397e9a(0x126)+_0x397e9a(0x16d)),0x1;const _0x37c44f=resolveYamlFile(_0x21af77);if(existsSync(_0x37c44f)){_0x1ba597[_0x397e9a(0xf9)]&&console[_0x397e9a(0x1d5)](_0x397e9a(0xd8)+_0x37c44f);let _0x2a0b6e;try{_0x2a0b6e=readFileSync(_0x37c44f,'utf-8');}catch(_0x2e9b2a){const _0x2ca3f2=_0x2e9b2a instanceof Error?_0x2e9b2a[_0x397e9a(0xc6)]:String(_0x2e9b2a);return console['error']('Error\x20reading\x20file:\x20'+_0x2ca3f2),0x1;}const _0x493df6=await withSpinner(_0x397e9a(0xed),()=>_0x81d598[_0x397e9a(0xb6)][_0x397e9a(0x10a)](_0x2a0b6e),{'verbose':_0x1ba597[_0x397e9a(0xf9)]}),_0x3d1600=_0x493df6[_0x397e9a(0x225)],{isNew:_0x1cdafd,name:_0x5bf4ec,hasChanges:_0x23e127,diffFormatted:_0x2f1b1c}=_0x3d1600;if(_0x23e127){_0x1cdafd?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x5bf4ec+'\x27:'):console['error'](_0x397e9a(0x14d)+_0x5bf4ec+'\x27:');console[_0x397e9a(0x1d5)]('─'[_0x397e9a(0x197)](0x3c)),console[_0x397e9a(0x1d5)](_0x2f1b1c),console[_0x397e9a(0x1d5)]('─'['repeat'](0x3c));const _0x54c7d5=_0x1cdafd?_0x397e9a(0x10f)+_0x5bf4ec+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x5bf4ec+_0x397e9a(0x139);if(!_0x1ba597['yes']){if(!isInteractive())return console[_0x397e9a(0x1d5)](a30_0x2ea4fc[_0x397e9a(0x221)]('\x0aError:'),_0x397e9a(0x136)),console[_0x397e9a(0x1d5)](a30_0x2ea4fc[_0x397e9a(0x180)](_0x397e9a(0x1e1))),0x1;const _0x1f412b=await confirmKey(_0x54c7d5);if(!_0x1f412b)return console[_0x397e9a(0x1d5)](a30_0x2ea4fc['yellow']('Aborted.')),0x1;}const _0x37ab54=_0x1cdafd?_0x397e9a(0xfe):_0x397e9a(0x141);await withSpinner(_0x37ab54+'\x20parent\x20segment\x20\x27'+_0x5bf4ec+'\x27...',()=>_0x3d1600[_0x397e9a(0x16b)](),{'verbose':_0x1ba597[_0x397e9a(0xf9)]});const _0x543c2d=_0x1cdafd?_0x397e9a(0x1de):_0x397e9a(0xbb);console['error']('✔\x20'+_0x543c2d+_0x397e9a(0x144)+_0x5bf4ec+'\x27');}else console[_0x397e9a(0x1d5)](_0x397e9a(0x14f)+_0x5bf4ec+_0x397e9a(0x15e));}const _0x231366=await withSpinner(_0x397e9a(0x128)+_0x21af77+_0x397e9a(0x21d),()=>_0x81d598[_0x397e9a(0xb6)]['runParent'](_0x21af77),{'verbose':_0x1ba597[_0x397e9a(0xf9)]}),_0xf7ac4b=_0x231366['data'],_0x5596da=getConsoleUrl(_0x1ba597[_0x397e9a(0x238)],_0x397e9a(0x14b)+_0xf7ac4b[_0x397e9a(0x1a5)]+_0x397e9a(0x223)+_0xf7ac4b['workflowSessionId']+_0x397e9a(0xd6)+_0xf7ac4b[_0x397e9a(0x10c)]);return console[_0x397e9a(0x1d5)](_0x397e9a(0x1e8)),console[_0x397e9a(0x1d5)]('\x20\x20'+a30_0x2ea4fc['dim'](_0x397e9a(0x15b))+'\x20'+_0xf7ac4b[_0x397e9a(0x12b)]),console['error']('\x20\x20'+a30_0x2ea4fc['dim']('Status:')+'\x20'+_0xf7ac4b[_0x397e9a(0xce)]),console['error']('\x20\x20'+a30_0x2ea4fc[_0x397e9a(0x180)](_0x397e9a(0x1c6))+'\x20'+_0xf7ac4b['workflowSessionId']),console[_0x397e9a(0x1d5)]('\x20\x20'+a30_0x2ea4fc['dim'](_0x397e9a(0x1a9))+'\x20'+_0xf7ac4b[_0x397e9a(0x10c)]),console[_0x397e9a(0x1d5)]('\x20\x20'+_0x5596da),console[_0x397e9a(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x397e9a(0x180)](_0x397e9a(0x1ad))+_0x397e9a(0x119)+_0xf7ac4b[_0x397e9a(0x10c)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x230);[a30_0x2c3752(0x161)]='List\x20available\x20fields\x20for\x20segmentation';async[a30_0x2c3752(0x1c1)](_0x37d8fa){const _0x35ee81=a30_0x2c3752,{options:_0x28f9e1,args:_0x550453,tdx:_0x345381}=_0x37d8fa,_0x4eeb60=_0x550453[0x0]||_0x28f9e1[_0x35ee81(0x122)];if(!_0x4eeb60)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'+_0x35ee81(0x13f)),0x1;_0x28f9e1[_0x35ee81(0xf9)]&&(console[_0x35ee81(0x1d5)](_0x35ee81(0x113)+_0x28f9e1[_0x35ee81(0x238)]),console[_0x35ee81(0x1d5)](_0x35ee81(0x13c)+_0x4eeb60));const _0x523d9f=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x4eeb60+_0x35ee81(0x21d),()=>_0x345381['segment'][_0x35ee81(0x11e)](_0x4eeb60),{'verbose':_0x28f9e1['verbose']}),_0x2f35ba=_0x523d9f[_0x35ee81(0x225)];console['error'](_0x35ee81(0x239)+_0x2f35ba[_0x35ee81(0x1fe)]+'\x20field'+(_0x2f35ba[_0x35ee81(0x1fe)]!==0x1?'s':''));if(_0x28f9e1[_0x35ee81(0x1a2)]||_0x28f9e1[_0x35ee81(0xdf)])return await handleSDKOutput(_0x2f35ba,_0x28f9e1),0x0;return displayFieldsHumanReadable(_0x2f35ba,_0x4eeb60),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x12e);[a30_0x2c3752(0x161)]=a30_0x2c3752(0x14a);async[a30_0x2c3752(0x1c1)](_0x74530b){const _0x4af2de=a30_0x2c3752,{options:_0x1576c6,args:_0x3a8c7f,tdx:_0x1676cb}=_0x74530b,_0x4ac662=_0x1576c6,_0x3181ed=_0x3a8c7f[0x0]||_0x1576c6['parentSegment'];if(!_0x3181ed)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x4af2de(0xe8)+_0x4af2de(0x106)+_0x4af2de(0x18b)),0x1;_0x1576c6['verbose']&&(console[_0x4af2de(0x1d5)](_0x4af2de(0x113)+_0x1576c6[_0x4af2de(0x238)]),console['error'](_0x4af2de(0x13c)+_0x3181ed));const _0x51b8b4=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x3181ed+_0x4af2de(0x21d),()=>_0x1676cb[_0x4af2de(0xb6)][_0x4af2de(0x207)](_0x3181ed),{'verbose':_0x1576c6[_0x4af2de(0xf9)]}),_0xe14dc5=_0x51b8b4[_0x4af2de(0x225)];if(_0x4ac662[_0x4af2de(0x1cd)]){const _0x147b3a=getConsoleNextUrl(_0x4ac662[_0x4af2de(0x238)],_0x4af2de(0xe2)+_0xe14dc5['id']);return console[_0x4af2de(0x1d5)](a30_0x2ea4fc[_0x4af2de(0x1dc)]('✔')+'\x20Opening\x20'+a30_0x2ea4fc[_0x4af2de(0x22e)](_0x147b3a)),openBrowser(_0x147b3a),0x0;}return await handleSingleObjectOutput(_0xe14dc5,_0x1576c6),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a30_0x2c3752(0xe3);[a30_0x2c3752(0x161)]=a30_0x2c3752(0xef);async['execute'](_0x5b509a){const _0x27e428=a30_0x2c3752,{options:_0x185b03,args:_0x5616ed,tdx:_0x29beef}=_0x5b509a,_0x40af76=_0x185b03,_0x4fa879=_0x5616ed[0x0]||_0x185b03['parentSegment'];if(!_0x4fa879)return showParentSegmentNotSetError(_0x27e428(0x116)+_0x27e428(0x15c)+_0x27e428(0x106)+_0x27e428(0x19d)),0x1;_0x185b03[_0x27e428(0xf9)]&&(console[_0x27e428(0x1d5)](_0x27e428(0x113)+_0x185b03[_0x27e428(0x238)]),console[_0x27e428(0x1d5)]('Parent\x20segment:\x20'+_0x4fa879));const _0xed56df=await withSpinner(_0x27e428(0x22a)+_0x4fa879+_0x27e428(0x21d),()=>_0x29beef[_0x27e428(0xb6)][_0x27e428(0xb5)](_0x4fa879),{'verbose':_0x185b03[_0x27e428(0xf9)]}),_0x5ddcf9=_0xed56df[_0x27e428(0x225)],_0x2fbc87=_0x29beef[_0x27e428(0xb6)][_0x27e428(0x19b)](_0x5ddcf9);if(_0x40af76[_0x27e428(0x1c7)]){const _0x2c1ded=await this['collectSchema'](_0x5b509a,_0x4fa879,_0x5ddcf9,_0x2fbc87),_0xb326ee=this[_0x27e428(0x208)](_0x2c1ded);writeFileSync(_0x40af76[_0x27e428(0x1c7)],_0xb326ee);const _0x49c305=_0x2c1ded[_0x27e428(0x23f)][_0x27e428(0xc1)]['length']+_0x2c1ded[_0x27e428(0xeb)][_0x27e428(0x175)]((_0x24c257,_0x5825b3)=>_0x24c257+_0x5825b3[_0x27e428(0xc1)][_0x27e428(0x1fe)],0x0),_0x3be733=_0x2c1ded[_0x27e428(0xeb)]['filter'](_0x599652=>_0x599652[_0x27e428(0xc1)][_0x27e428(0x1fe)]===0x0)[_0x27e428(0x1fe)];return console['log'](_0x27e428(0x240)+_0x40af76[_0x27e428(0x1c7)]),console[_0x27e428(0x20c)](_0x27e428(0xf4)+_0x2fbc87),console[_0x27e428(0x20c)](_0x27e428(0x1d4)+_0x2c1ded[_0x27e428(0xeb)]['length']+_0x27e428(0x182)),console['log'](_0x27e428(0xc7)+_0x49c305+_0x27e428(0x178)),_0x3be733>0x0&&console[_0x27e428(0x20c)](_0x27e428(0x133)+_0x3be733+_0x27e428(0x229)),0x0;}console['error']('\x0a'+a30_0x2ea4fc[_0x27e428(0x137)](_0x27e428(0x1c2))+'\x20'+a30_0x2ea4fc[_0x27e428(0x22e)](_0x2fbc87));const _0x5f55ab=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x29beef[_0x27e428(0xb6)]['getParentSQL'](_0x5ddcf9),{'verbose':_0x185b03['verbose']});console['error']('\x0a'+a30_0x2ea4fc['bold']('customers')+'\x20'+a30_0x2ea4fc[_0x27e428(0x180)]('('+_0x2fbc87+_0x27e428(0x160)));const _0x5e4a3e=await executeSchemaQuery(_0x5f55ab[_0x27e428(0x225)],_0x29beef,_0x185b03);await handleQueryOutput(_0x5e4a3e,_0x185b03);const _0x3f3674=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x29beef[_0x27e428(0xb6)][_0x27e428(0x1b8)](_0x5ddcf9),{'verbose':_0x185b03[_0x27e428(0xf9)]});for(const _0x3f371d of _0x3f3674['data']){const _0x5d3417=_0x27e428(0x1d8)+_0x3f371d[_0x27e428(0x1ed)]()['replace'](/\s+/g,'_'),_0x200a62='SELECT\x20*\x20FROM\x20'+_0x2fbc87+'.'+_0x5d3417;console[_0x27e428(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x27e428(0x137)](_0x3f371d)+'\x20'+a30_0x2ea4fc[_0x27e428(0x180)]('('+_0x2fbc87+'.'+_0x5d3417+')'));try{const _0x308a52=await executeSchemaQuery(_0x200a62,_0x29beef,_0x185b03);await handleQueryOutput(_0x308a52,_0x185b03);}catch{console['error'](a30_0x2ea4fc['yellow'](_0x27e428(0xdb)));}}return 0x0;}async[a30_0x2c3752(0x156)](_0x3bbc57,_0x29afbf,_0x1eeff6,_0x1fd277){const _0x17d455=a30_0x2c3752,{options:_0x4d337c,tdx:_0x4a5347}=_0x3bbc57,_0x57f39f=await withSpinner(_0x17d455(0x1fb),()=>_0x4a5347[_0x17d455(0xb6)]['getParentSQL'](_0x1eeff6),{'verbose':_0x4d337c[_0x17d455(0xf9)]}),_0x4eb0a2=await executeSchemaQuery(_0x57f39f[_0x17d455(0x225)],_0x4a5347,_0x4d337c),_0x23c9f5=_0x4eb0a2['data'][_0x17d455(0x13b)](_0x10455a=>({'name':_0x10455a['column_name'],'type':_0x10455a[_0x17d455(0x15f)]})),_0x1a07d0=await withSpinner(_0x17d455(0xc4),()=>_0x4a5347[_0x17d455(0xb6)][_0x17d455(0x1b8)](_0x1eeff6),{'verbose':_0x4d337c[_0x17d455(0xf9)]}),_0x47d988=[];for(const _0x2c847b of _0x1a07d0[_0x17d455(0x225)]){const _0x27417c='behavior_'+_0x2c847b[_0x17d455(0x1ed)]()['replace'](/\s+/g,'_'),_0x130b4d=_0x17d455(0x1e5)+_0x1fd277+'.'+_0x27417c;let _0x24b34a=[];try{const _0x1d1851=await executeSchemaQuery(_0x130b4d,_0x4a5347,_0x4d337c);_0x24b34a=_0x1d1851[_0x17d455(0x225)][_0x17d455(0x13b)](_0xa82e52=>({'name':_0xa82e52[_0x17d455(0x100)],'type':_0xa82e52[_0x17d455(0x15f)]}));}catch{}_0x47d988[_0x17d455(0x127)]({'table':_0x27417c,'columns':_0x24b34a});}return{'database':_0x1fd277,'parent_segment':_0x29afbf,'parent_id':_0x1eeff6,'customers':{'table':_0x17d455(0x23f),'columns':_0x23c9f5},'behaviors':_0x47d988};}['formatSchemaJson'](_0x27fb84){const _0x299cee=a30_0x2c3752,_0x52fe09=_0x43cefb=>{const _0x28171a=a30_0x3f31;if(_0x43cefb['length']===0x0)return'[]';const _0x22f035=_0x43cefb[_0x28171a(0x13b)](_0x1cde76=>_0x28171a(0x15a)+_0x1cde76[_0x28171a(0x13d)]+_0x28171a(0x1e3)+_0x1cde76[_0x28171a(0x103)]+_0x28171a(0x170));return'[\x0a'+_0x22f035[_0x28171a(0x10d)](',\x0a')+_0x28171a(0x212);},_0x1d60f8=_0x27fb84['behaviors'][_0x299cee(0x13b)](_0x439028=>{const _0x57a5fd=_0x299cee;return _0x57a5fd(0xd1)+_0x439028[_0x57a5fd(0x155)]+_0x57a5fd(0x11f)+_0x52fe09(_0x439028[_0x57a5fd(0xc1)])[_0x57a5fd(0x202)](/^/gm,'\x20\x20')[_0x57a5fd(0xfc)]()+_0x57a5fd(0x131);})[_0x299cee(0x10d)](',\x0a');return _0x299cee(0x140)+_0x27fb84[_0x299cee(0x1be)]+_0x299cee(0x1eb)+_0x27fb84[_0x299cee(0x20e)]+_0x299cee(0xd4)+_0x27fb84[_0x299cee(0x172)]+_0x299cee(0x1b7)+_0x27fb84[_0x299cee(0x23f)][_0x299cee(0x155)]+_0x299cee(0xf5)+_0x52fe09(_0x27fb84[_0x299cee(0x23f)][_0x299cee(0xc1)])[_0x299cee(0x202)](/^/gm,'\x20\x20')[_0x299cee(0xfc)]()+_0x299cee(0x157)+_0x1d60f8+_0x299cee(0x20f);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x16a);[a30_0x2c3752(0x161)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x5a0b46){const _0x67c113=a30_0x2c3752,{options:_0x25b52d,args:_0x5d1f9e,tdx:_0x2cf613}=_0x5a0b46,_0x1bfff8=_0x5d1f9e[0x0]||_0x25b52d[_0x67c113(0x122)];if(!_0x1bfff8)return showParentSegmentNotSetError(_0x67c113(0xc2)+_0x67c113(0x16f)),0x1;_0x25b52d[_0x67c113(0xf9)]&&(console[_0x67c113(0x1d5)]('Site:\x20'+_0x25b52d[_0x67c113(0x238)]),console[_0x67c113(0x1d5)](_0x67c113(0x13c)+_0x1bfff8));const _0x2d1d32=await withSpinner(_0x67c113(0x22a)+_0x1bfff8+_0x67c113(0x21d),()=>_0x2cf613[_0x67c113(0xb6)][_0x67c113(0xb5)](_0x1bfff8),{'verbose':_0x25b52d['verbose']}),_0x2d0ded=_0x2d1d32['data'],_0x3ec5e3=await withSpinner(_0x67c113(0x164)+_0x1bfff8+_0x67c113(0x21d),()=>_0x2cf613[_0x67c113(0xb6)]['getParentSQL'](_0x2d0ded),{'verbose':_0x25b52d[_0x67c113(0xf9)]}),_0x1b784f=_0x3ec5e3['data'];return _0x25b52d['format']===_0x67c113(0x1a2)||_0x25b52d[_0x67c113(0x118)]===_0x67c113(0xdf)?await handleSDKOutput([{'sql':_0x1b784f}],_0x25b52d):console[_0x67c113(0x20c)](_0x1b784f),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a30_0x2c3752(0x1f1);[a30_0x2c3752(0x161)]=a30_0x2c3752(0x19e);async['execute'](_0x440a4f){const _0x58b3f4=a30_0x2c3752,{options:_0x3756e0,args:_0x2f12a7,tdx:_0x5ef6a2}=_0x440a4f,_0x6ef36e=_0x2f12a7[0x0]||_0x3756e0[_0x58b3f4(0x122)];if(!_0x6ef36e)return showParentSegmentNotSetError(_0x58b3f4(0xc0)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x3756e0['verbose']&&(console['error'](_0x58b3f4(0x113)+_0x3756e0[_0x58b3f4(0x238)]),console[_0x58b3f4(0x1d5)](_0x58b3f4(0x13c)+_0x6ef36e));const _0x1c9b5b=await withSpinner(_0x58b3f4(0x22a)+_0x6ef36e+_0x58b3f4(0x21d),()=>_0x5ef6a2['segment'][_0x58b3f4(0xb5)](_0x6ef36e),{'verbose':_0x3756e0[_0x58b3f4(0xf9)]}),_0x293b9b=_0x1c9b5b[_0x58b3f4(0x225)],_0x4122db=await withSpinner(_0x58b3f4(0x164)+_0x6ef36e+_0x58b3f4(0x21d),()=>_0x5ef6a2['segment']['getParentSQL'](_0x293b9b),{'verbose':_0x3756e0[_0x58b3f4(0xf9)]});let _0x171f1a=_0x4122db[_0x58b3f4(0x225)];const _0x2fd9e6=resolveLimit(_0x3756e0[_0x58b3f4(0x134)],DEFAULT_DISPLAY_LIMIT),_0x44dc33=/\bLIMIT\s+\d+/i['test'](_0x171f1a);!_0x44dc33&&(_0x171f1a=_0x171f1a[_0x58b3f4(0xfc)]()[_0x58b3f4(0x202)](/;+$/,''),_0x171f1a=_0x58b3f4(0x149)+_0x171f1a+_0x58b3f4(0x1e7)+_0x2fd9e6);_0x3756e0[_0x58b3f4(0xf9)]&&console[_0x58b3f4(0x1d5)](_0x58b3f4(0xba)+_0x171f1a);const _0x18d3e8=await withProgressSpinner(_0x58b3f4(0x1f6),async _0x3a662c=>{const _0x4369ba=_0x58b3f4,_0xf456fb=await _0x5ef6a2[_0x4369ba(0x187)][_0x4369ba(0x1c1)](_0x171f1a,{'catalog':'td','schema':_0x4369ba(0x18d),'onJobId':_0xb63eaf=>{const _0x32429c=_0x4369ba;_0x3a662c[_0x32429c(0x1b2)](_0xb63eaf);}});return _0xf456fb;},{'verbose':_0x3756e0[_0x58b3f4(0xf9)]}),_0x5c43bc=_0x18d3e8[_0x58b3f4(0x225)],_0x1ebc92=_0x5c43bc[_0x58b3f4(0x1c8)]?'\x20[Job\x20ID:\x20'+_0x5c43bc[_0x58b3f4(0x1c8)]+']':'';return console['error'](_0x58b3f4(0x11b)+_0x5c43bc[_0x58b3f4(0x1c9)][_0x58b3f4(0x16c)]['toLocaleString']()+_0x58b3f4(0x18e)+('in\x20'+formatElapsed(_0x5c43bc['stats']['elapsedTimeMillis'])+_0x1ebc92)),await handleQueryOutput(_0x5c43bc,_0x3756e0),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x1df);[a30_0x2c3752(0x161)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a30_0x2c3752(0x1c1)](_0x522394){const _0x32c87a=a30_0x2c3752,{options:_0x385c6f,args:_0x5eb5ca,tdx:_0x11684e}=_0x522394,_0x66d28=_0x5eb5ca[0x0],_0x1f6721=await withSpinner(_0x66d28?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x66d28+_0x32c87a(0x21d):_0x32c87a(0x199),()=>_0x11684e[_0x32c87a(0x152)]['list'](),{'verbose':_0x385c6f[_0x32c87a(0xf9)]});let _0x24b01f=_0x1f6721['data'][_0x32c87a(0xd9)](_0x55f936=>_0x55f936['realtime_enabled']);if(_0x66d28){const _0x4e314e=_0x66d28['replace'](/[.+^${}()|[\]\\]/g,_0x32c87a(0x151))[_0x32c87a(0x202)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x100b7c=new RegExp('^'+_0x4e314e+'$','i');_0x24b01f=_0x24b01f[_0x32c87a(0xd9)](_0x31a871=>_0x100b7c['test'](_0x31a871[_0x32c87a(0x13d)]));}_0x24b01f[_0x32c87a(0x102)]((_0x2b955e,_0x170c1c)=>_0x2b955e[_0x32c87a(0x13d)]['localeCompare'](_0x170c1c[_0x32c87a(0x13d)])),console['error'](_0x32c87a(0x239)+_0x24b01f[_0x32c87a(0x1fe)]+_0x32c87a(0xff)+(_0x24b01f[_0x32c87a(0x1fe)]!==0x1?'s':''));const _0x492728=_0x55d28b=>{const _0x5edf91=_0x32c87a;return getConsoleNextUrl(_0x385c6f[_0x5edf91(0x238)],_0x5edf91(0xe2)+_0x55d28b);};if(_0x385c6f[_0x32c87a(0x118)]===_0x32c87a(0x1a2)||_0x385c6f[_0x32c87a(0x118)]===_0x32c87a(0xdf)){const _0x2da9e1=_0x24b01f[_0x32c87a(0x13b)](_0x6f2944=>({..._0x6f2944,'url':_0x492728(_0x6f2944['id'])}));await handleSDKOutput(_0x2da9e1,_0x385c6f);}else{if(_0x24b01f[_0x32c87a(0x1fe)]===0x0)console[_0x32c87a(0x20c)](_0x32c87a(0x219));else for(const _0x176b1b of _0x24b01f){const _0x57c06f=_0x176b1b[_0x32c87a(0x19c)]?a30_0x2ea4fc[_0x32c87a(0x180)]('\x20('+formatRows(_0x176b1b[_0x32c87a(0x19c)])+')'):'',_0x21ebe8=hyperlink(_0x176b1b[_0x32c87a(0x13d)],_0x492728(_0x176b1b['id']));console[_0x32c87a(0x20c)]('⚡\x20'+_0x21ebe8+_0x57c06f);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0x1ff);[a30_0x2c3752(0x161)]=a30_0x2c3752(0xe7);async[a30_0x2c3752(0x1c1)](_0x28c0c7){const _0x1c757a=a30_0x2c3752,{options:_0x187818,args:_0x4060b0,tdx:_0x4d9bf1}=_0x28c0c7,_0x287e89=_0x4060b0[0x0]||_0x187818[_0x1c757a(0x122)];if(!_0x287e89)return showParentSegmentNotSetError('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'+_0x1c757a(0x158)),0x1;const _0x111d98=resolveYamlFile(_0x287e89);if(!existsSync(_0x111d98))return showFileNotFoundError(_0x111d98,_0x287e89),0x1;let _0x41a072;try{_0x41a072=readFileSync(_0x111d98,_0x1c757a(0x193));}catch(_0x38d4b4){const _0x2aa40f=_0x38d4b4 instanceof Error?_0x38d4b4[_0x1c757a(0xc6)]:String(_0x38d4b4);return console[_0x1c757a(0x1d5)](_0x1c757a(0x1b3)+_0x2aa40f),0x1;}const _0x566864=createCommandSpinner(a30_0x2ea4fc[_0x1c757a(0x180)](_0x1c757a(0x20b)),{'verbose':_0x187818[_0x1c757a(0xf9)]});_0x566864[_0x1c757a(0x1bf)]();const _0x2e5596={'realtime':!![],'onProgress':_0x421857=>{const _0x217b69=_0x1c757a;_0x566864[_0x217b69(0x20d)]=formatProgressMessage(_0x421857);}};let _0x3f54a5;try{_0x3f54a5=await _0x4d9bf1['segment'][_0x1c757a(0x1c0)](_0x41a072,_0x2e5596),_0x566864[_0x1c757a(0x1db)]();}catch(_0x147dd4){_0x566864['stop']();throw _0x147dd4;}console[_0x1c757a(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x1c757a(0x137)](_0x1c757a(0x1d1))+'\x20'+_0x3f54a5[_0x1c757a(0x13d)]),console[_0x1c757a(0x1d5)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x3f54a5),console[_0x1c757a(0x1d5)]('─'[_0x1c757a(0x197)](0x3c));if(_0x3f54a5[_0x1c757a(0x216)][_0x1c757a(0x1fe)]>0x0){console[_0x1c757a(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x1c757a(0x221)](_0x1c757a(0x200)));for(const _0xdbcbdd of _0x3f54a5['errors']){console['error']('\x20\x20'+a30_0x2ea4fc[_0x1c757a(0x221)]('•')+'\x20'+_0xdbcbdd);}}return _0x3f54a5[_0x1c757a(0x231)]&&console[_0x1c757a(0x1d5)]('\x0a'+a30_0x2ea4fc[_0x1c757a(0x1dc)]('✔')+_0x1c757a(0xfa)),_0x3f54a5[_0x1c757a(0x231)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x2c3752(0x13d)]=a30_0x2c3752(0xde);[a30_0x2c3752(0x161)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async['execute'](_0x72be39){const _0x35331e=a30_0x2c3752,{options:_0x3aaa82,args:_0x551a50,tdx:_0x40b914}=_0x72be39,_0x3978a6=_0x551a50[0x0]||_0x3aaa82[_0x35331e(0x122)];if(!_0x3978a6)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'+_0x35331e(0x195)),0x1;const _0xd2746=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3978a6+'\x27...',()=>_0x40b914[_0x35331e(0xb6)]['resolveParentId'](_0x3978a6),{'verbose':_0x3aaa82[_0x35331e(0xf9)]}),_0x138d1f=_0xd2746[_0x35331e(0x225)],_0x2b0996=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x3978a6+_0x35331e(0x21d),()=>_0x40b914[_0x35331e(0x148)][_0x35331e(0x1cc)](_0x138d1f),{'verbose':_0x3aaa82[_0x35331e(0xf9)]}),_0x4aba25=_0x2b0996[_0x35331e(0x225)];console[_0x35331e(0x1d5)](_0x35331e(0x239)+_0x4aba25[_0x35331e(0x1fe)]+_0x35331e(0x11d)+(_0x4aba25['length']!==0x1?'s':''));if(_0x3aaa82[_0x35331e(0x118)]===_0x35331e(0x1a2)||_0x3aaa82[_0x35331e(0x118)]===_0x35331e(0xdf))await handleSDKOutput(_0x4aba25,_0x3aaa82);else{if(_0x4aba25[_0x35331e(0x1fe)]===0x0)console[_0x35331e(0x20c)]('No\x20personalization\x20services\x20configured'),console[_0x35331e(0x1d5)](a30_0x2ea4fc[_0x35331e(0x22e)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x45d536 of _0x4aba25){const _0x3a0838=_0x45d536[_0x35331e(0x18a)]?.[_0x35331e(0x1fe)]||0x0,_0x2c2a8f=_0x45d536[_0x35331e(0x1aa)]?a30_0x2ea4fc[_0x35331e(0x180)](_0x35331e(0x124)+_0x45d536[_0x35331e(0x1aa)]):'',_0xac6d90=a30_0x2ea4fc[_0x35331e(0x180)]('\x20('+_0x3a0838+'\x20section'+(_0x3a0838!==0x1?'s':'')+')');console[_0x35331e(0x20c)]('\x20\x20'+_0x45d536[_0x35331e(0x13d)]+_0x2c2a8f+_0xac6d90),_0x45d536[_0x35331e(0x161)]&&console['log'](_0x35331e(0x1b1)+a30_0x2ea4fc[_0x35331e(0x180)](_0x45d536[_0x35331e(0x161)]));}}return 0x0;}}function a30_0x3f31(_0x397532,_0x5863f1){_0x397532=_0x397532-0xb5;const _0x1c0d9f=a30_0x1c0d();let _0x3f3155=_0x1c0d9f[_0x397532];return _0x3f3155;}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']='ps:pz:init';[a30_0x2c3752(0x161)]=a30_0x2c3752(0x143);async[a30_0x2c3752(0x1c1)](_0x46e3df){const _0x36ea7f=a30_0x2c3752,{options:_0x364a95,args:_0x5b8249}=_0x46e3df,_0x4b40cd=_0x5b8249[0x0]||_0x364a95[_0x36ea7f(0x122)];if(!_0x4b40cd)return showParentSegmentNotSetError(_0x36ea7f(0x1b6)+_0x36ea7f(0x109)),0x1;const _0x1e74c4=resolveYamlFile(_0x4b40cd);if(!existsSync(_0x1e74c4))return showFileNotFoundError(_0x1e74c4,_0x4b40cd),0x1;let _0x194d09;try{_0x194d09=readFileSync(_0x1e74c4,_0x36ea7f(0x193));}catch(_0x1e4e58){const _0x3b0b85=_0x1e4e58 instanceof Error?_0x1e4e58[_0x36ea7f(0xc6)]:String(_0x1e4e58);return console[_0x36ea7f(0x1d5)](_0x36ea7f(0x1b3)+_0x3b0b85),0x1;}let _0x197658;try{_0x197658=parseDef(_0x194d09);}catch(_0x2ae4b5){const _0x56eeed=_0x2ae4b5 instanceof Error?_0x2ae4b5[_0x36ea7f(0xc6)]:String(_0x2ae4b5);return console[_0x36ea7f(0x1d5)](a30_0x2ea4fc[_0x36ea7f(0x221)](_0x36ea7f(0x10b)+_0x56eeed)),0x1;}if(_0x197658['personalization_services']&&_0x197658[_0x36ea7f(0x21e)]['length']>0x0)return console[_0x36ea7f(0x1d5)](a30_0x2ea4fc['yellow'](_0x36ea7f(0x145)+_0x1e74c4)),console[_0x36ea7f(0x1d5)](a30_0x2ea4fc[_0x36ea7f(0x180)](_0x36ea7f(0x222)+_0x197658[_0x36ea7f(0x21e)][_0x36ea7f(0x1fe)]+'\x20service(s)\x20configured')),0x1;!_0x197658[_0x36ea7f(0x152)]&&(_0x197658[_0x36ea7f(0x152)]={'events':[{'name':_0x36ea7f(0xcb),'source_table':_0x36ea7f(0x1ee)}],'attributes':[{'name':_0x36ea7f(0x147),'type':'single'}],'id_stitching':{'primary_key':_0x197658[_0x36ea7f(0x1ab)]['table']===_0x36ea7f(0x23f)?_0x36ea7f(0x12f):'user_id'}});_0x197658['personalization_services']=[{'name':_0x36ea7f(0xf0),'description':_0x36ea7f(0x23b),'trigger_event':_0x36ea7f(0xcb),'sections':[{'name':'Default','criteria':_0x36ea7f(0x210),'attributes':['last_page_viewed']}]}];const _0x46d7e6=serializeDef(_0x197658);return writeFileSync(_0x1e74c4,_0x46d7e6,_0x36ea7f(0x193)),console[_0x36ea7f(0x1d5)](a30_0x2ea4fc[_0x36ea7f(0x1dc)]('✔')+_0x36ea7f(0x232)+a30_0x2ea4fc[_0x36ea7f(0x22e)](_0x1e74c4)),(!_0x197658[_0x36ea7f(0x152)]||_0x194d09['indexOf'](_0x36ea7f(0x162))===-0x1)&&console[_0x36ea7f(0x1d5)](a30_0x2ea4fc[_0x36ea7f(0x1dc)]('✔')+_0x36ea7f(0x17b)),console['error']('\x0a'+a30_0x2ea4fc[_0x36ea7f(0x180)](_0x36ea7f(0xc3))),console[_0x36ea7f(0x1d5)](_0x36ea7f(0xd5)+_0x1e74c4+_0x36ea7f(0x15d)),console[_0x36ea7f(0x1d5)](_0x36ea7f(0x176)+a30_0x2ea4fc[_0x36ea7f(0x180)](_0x36ea7f(0x1f3)+_0x4b40cd)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0x1c71d1=a31_0x7e72;(function(_0x108bb4,_0x53511b){const _0x4b202c=a31_0x7e72,_0x29f20f=_0x108bb4();while(!![]){try{const _0x52b4b8=-parseInt(_0x4b202c(0x118))/0x1+parseInt(_0x4b202c(0x101))/0x2*(-parseInt(_0x4b202c(0xd3))/0x3)+-parseInt(_0x4b202c(0xe7))/0x4+-parseInt(_0x4b202c(0xf1))/0x5*(parseInt(_0x4b202c(0xbf))/0x6)+parseInt(_0x4b202c(0x117))/0x7+-parseInt(_0x4b202c(0xfd))/0x8+parseInt(_0x4b202c(0xd6))/0x9;if(_0x52b4b8===_0x53511b)break;else _0x29f20f['push'](_0x29f20f['shift']());}catch(_0x27d5e7){_0x29f20f['push'](_0x29f20f['shift']());}}}(a31_0x1063,0x4459b));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 a31_0x1246e4 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a31_0x1063(){const _0x2a4b4b=['\x27\x20requires\x20API\x20key\x20validation.','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x27\x20does\x20not\x20exist.','llm_agent','(cleared)','Validating\x20API\x20key...','database','llm_project','includes','logLevel','\x27.\x0a\x0aValid\x20keys:\x20','Choose\x20authentication\x20method:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x0aOperation\x20cancelled','1177768LMLKth','Enter\x20your\x20TD\x20API\x20key:','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','confirm','Set\x20a\x20profile\x20configuration\x20value','\x27\x20updated:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20API\x20key\x20saved\x20to\x20system\x20keychain','execute','1853285luLWlV','Changing\x20site\x20to\x20\x27','Operation\x20cancelled','test','getUserInfo','yellow','parent_segment','red','profile:remove','tdx:\x20profile\x20set','validate','API\x20key\x20cannot\x20be\x20empty','883928tEVRQZ','profileName','tdx.json','Enter\x20description\x20(optional):','14nfXgkI','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','length','email','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','apiKey','dim','text','profile','Profile\x20name\x20cannot\x20be\x20empty','name','error','Set\x20session\x20profile','Remove\x20a\x20profile','\x27\x20created','warn','\x20--default\x27\x20to\x20save\x20permanently','Session\x20profile\x20set\x20to:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','join','\x20Profile\x20\x27','2404241dDlxAL','166973iWnrrO','tdx:\x20profile\x20remove','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','split','default','(session:\x20','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Site\x20was\x20not\x20changed.','site','✗\x20Validation\x20failed:\x20','apikey','Enter\x20profile\x20name:','jobs','password','VALID_KEYS','select','You\x20can\x20find\x20your\x20API\x20key\x20at:','Default\x20profile\x20set\x20to:\x20','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>','green','6RRvGGW','bold','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','config','method','\x0aSaved\x20to:\x20','\x20\x20tdx\x20--profile\x20','\x0aAvailable\x20profiles:','trim','API\x20Key','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','message','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','log','ERROR','Profile\x20\x27','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x0aSetup\x20cancelled','Create\x20a\x20new\x20profile','197031dXkLxZ','profile:set','Setup\x20cancelled','12049218TMrDrU','create','oauth'];a31_0x1063=function(){return _0x2a4b4b;};return a31_0x1063();}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';function a31_0x7e72(_0x28480f,_0xc64e76){_0x28480f=_0x28480f-0xb3;const _0x106347=a31_0x1063();let _0x7e72d7=_0x106347[_0x28480f];return _0x7e72d7;}import a31_0xa064c7 from'prompts';import a31_0x5ba1e7 from'chalk';function validateProfileName(_0x1f3d9a){const _0x366100=a31_0x7e72;if(!_0x1f3d9a||!_0x1f3d9a[_0x366100(0xc7)]())return _0x366100(0x10a);const _0x59e573=_0x1f3d9a[_0x366100(0xc7)]();if(!/^[a-zA-Z0-9_-]+$/[_0x366100(0xf4)](_0x59e573))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x59e573))return _0x366100(0xce)+_0x59e573+_0x366100(0xc1);return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x1c71d1(0x10b)]='profile:create';[a31_0x1c71d1(0x11e)]=a31_0x1c71d1(0xd2);async[a31_0x1c71d1(0xf0)](_0x1df68e){const _0x15ce95=a31_0x1c71d1,{options:_0x39471f,args:_0x368355}=_0x1df68e;console[_0x15ce95(0xcc)](a31_0x5ba1e7[_0x15ce95(0xc0)]('tdx:\x20profile\x20create'));let _0x2a95d3;if(_0x368355[_0x15ce95(0x103)]>0x0&&_0x368355[0x0]){const _0x11a74d=_0x368355[0x0]['trim'](),_0x26b274=validateProfileName(_0x11a74d);if(_0x26b274!==!![])return console[_0x15ce95(0x10c)](a31_0x5ba1e7[_0x15ce95(0xf8)](_0x26b274)),0x1;_0x2a95d3=_0x11a74d;}else{const _0x2b127c=await a31_0xa064c7({'type':_0x15ce95(0x108),'name':_0x15ce95(0xfe),'message':_0x15ce95(0xb6),'validate':validateProfileName});if(!_0x2b127c[_0x15ce95(0xfe)])return console['log'](_0x15ce95(0xd1)),0x1;_0x2a95d3=_0x2b127c['profileName'][_0x15ce95(0xc7)]();}const _0xa469d5=await a31_0xa064c7({'type':_0x15ce95(0x108),'name':_0x15ce95(0x11e),'message':_0x15ce95(0x100)}),_0x4d1136=_0xa469d5[_0x15ce95(0x11e)]?.[_0x15ce95(0xc7)]()||undefined,_0xb553a3=_0x39471f[_0x15ce95(0xb3)]||'us01',_0x428d3b=await promptSiteSelection(_0xb553a3,_0x2a95d3,_0x15ce95(0xd5));if(!_0x428d3b)return 0x1;const _0xa9648a=resolveSite(_0x428d3b);if(isOAuthSupported(_0xa9648a)){const _0x592cf1=await a31_0xa064c7({'type':_0x15ce95(0xba),'name':_0x15ce95(0xc3),'message':_0x15ce95(0xe4),'choices':[{'title':'OAuth\x20(browser\x20login)','value':'oauth'},{'title':_0x15ce95(0xc8),'value':_0x15ce95(0xb5)}]});if(!_0x592cf1[_0x15ce95(0xc3)])return console['log']('\x0aSetup\x20cancelled'),0x1;if(_0x592cf1[_0x15ce95(0xc3)]===_0x15ce95(0xd8)){if(_0x4d1136){const _0xf86bf4={'site':_0xa9648a,'description':_0x4d1136};saveProfileToUserConfig(_0x2a95d3,_0xf86bf4);}return await runOAuthLoginFlow(_0xa9648a,_0x2a95d3,_0x39471f['logLevel']??LogLevel['ERROR']),0x0;}}console['log'](_0x15ce95(0xd0)+_0xa9648a),console[_0x15ce95(0xcc)](_0x15ce95(0xbb)),console[_0x15ce95(0xcc)]('\x20\x20'+getConsoleUrl(_0xa9648a,'/app/mp/ak'));const _0x1db246=await a31_0xa064c7({'type':'password','name':'apiKey','message':_0x15ce95(0xe8),'validate':_0x166b8f=>{const _0x3652e0=_0x15ce95;if(!_0x166b8f||!_0x166b8f[_0x3652e0(0xc7)]())return _0x3652e0(0xfc);return!![];}});if(!_0x1db246[_0x15ce95(0x106)])return console[_0x15ce95(0xcc)](_0x15ce95(0xd1)),0x1;const _0x1f920d=_0x1db246[_0x15ce95(0x106)];console[_0x15ce95(0xcc)]('Validating\x20API\x20key...');try{const _0x2aa5e6=TDX['create']({'site':_0xa9648a,'apiKey':_0x1f920d[_0x15ce95(0xc7)](),'logLevel':_0x39471f[_0x15ce95(0xe2)]??LogLevel[_0x15ce95(0xcd)]}),_0x3a58c8=await _0x2aa5e6[_0x15ce95(0xb7)]['getUserInfo']();console[_0x15ce95(0xcc)](a31_0x5ba1e7[_0x15ce95(0xbe)]('✓')+_0x15ce95(0xda)+_0x3a58c8[_0x15ce95(0x104)]+')');const _0x5d08ad=await isKeychainAvailable();_0x5d08ad?(await saveAPIKeyAsync(_0x1f920d[_0x15ce95(0xc7)](),_0xa9648a,_0x2a95d3),console['log'](a31_0x5ba1e7[_0x15ce95(0xbe)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x2a95d3+')')):(console[_0x15ce95(0x110)](a31_0x5ba1e7[_0x15ce95(0xf6)](_0x15ce95(0xed))),console['warn'](a31_0x5ba1e7['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1ee80d={'site':_0xa9648a,..._0x4d1136&&{'description':_0x4d1136}};return saveProfileToUserConfig(_0x2a95d3,_0x1ee80d),console[_0x15ce95(0xcc)](a31_0x5ba1e7['green']('✓')+'\x20Profile\x20\x27'+_0x2a95d3+_0x15ce95(0x10f)),console[_0x15ce95(0xcc)](),console['log'](_0x15ce95(0x105)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x2a95d3+_0x15ce95(0xe9)),console['log'](_0x15ce95(0xc5)+_0x2a95d3+_0x15ce95(0xcb)),0x0;}catch(_0x3bb0fd){if(_0x3bb0fd instanceof HTTPClientError&&_0x3bb0fd['status']===0x191)return printAuthError(_0x3bb0fd),0x1;return console[_0x15ce95(0x10c)](a31_0x5ba1e7[_0x15ce95(0xf8)](_0x15ce95(0xb4)+(_0x3bb0fd instanceof Error?_0x3bb0fd[_0x15ce95(0xca)]:String(_0x3bb0fd)))),console[_0x15ce95(0x10c)](_0x15ce95(0xcf)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x1c71d1(0x10b)]=a31_0x1c71d1(0xf9);[a31_0x1c71d1(0x11e)]=a31_0x1c71d1(0x10e);[a31_0x1c71d1(0xfb)](_0x816c38){const _0x4679c2=a31_0x1c71d1,{args:_0x933abe}=_0x816c38;if(_0x933abe[_0x4679c2(0x103)]===0x0)return _0x4679c2(0xe5);return undefined;}async[a31_0x1c71d1(0xf0)](_0x1604a1){const _0x5687c5=a31_0x1c71d1,{args:_0x4def8f}=_0x1604a1,_0x58dc5e=_0x4def8f[0x0];console[_0x5687c5(0xcc)](a31_0x5ba1e7[_0x5687c5(0xc0)](_0x5687c5(0x119)));if(!profileExists(_0x58dc5e)){console[_0x5687c5(0x10c)](a31_0x5ba1e7[_0x5687c5(0xf8)](_0x5687c5(0xce)+_0x58dc5e+'\x27\x20does\x20not\x20exist.')),console[_0x5687c5(0xcc)](_0x5687c5(0xc6));const _0x4cbca3=listProfiles();if(_0x4cbca3[_0x5687c5(0x103)]===0x0)console[_0x5687c5(0xcc)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x22dbc1 of _0x4cbca3){console['log']('\x20\x20-\x20'+_0x22dbc1['name']);}return 0x1;}const _0x43f3f3=await a31_0xa064c7({'type':_0x5687c5(0xea),'name':_0x5687c5(0xea),'message':_0x5687c5(0x11a)+_0x58dc5e+'\x27?','initial':![]});if(!_0x43f3f3['confirm'])return console[_0x5687c5(0xcc)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x58dc5e),console[_0x5687c5(0xcc)](a31_0x5ba1e7[_0x5687c5(0xbe)]('✓')+_0x5687c5(0x116)+_0x58dc5e+'\x27\x20removed\x20from\x20configuration');}catch(_0x5a616d){return console[_0x5687c5(0x10c)](a31_0x5ba1e7[_0x5687c5(0xf8)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x5a616d instanceof Error?_0x5a616d[_0x5687c5(0xca)]:String(_0x5a616d)))),0x1;}const _0x2ba7a6=await isKeychainAvailable();if(_0x2ba7a6){const _0x441c49=await deleteKeychainAPIKey(_0x58dc5e);_0x441c49&&console['log'](a31_0x5ba1e7[_0x5687c5(0xbe)]('✓')+_0x5687c5(0x11f));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0x1c71d1(0x10b)]=a31_0x1c71d1(0xd4);['description']=a31_0x1c71d1(0xeb);static [a31_0x1c71d1(0xb9)]=[a31_0x1c71d1(0xb3),a31_0x1c71d1(0xdf),a31_0x1c71d1(0xf7),a31_0x1c71d1(0xe0),a31_0x1c71d1(0xdc),a31_0x1c71d1(0x11e)];[a31_0x1c71d1(0xfb)](_0x5b791c){const _0x4467ea=a31_0x1c71d1,{args:_0x1d1576,options:_0x1d7c0d}=_0x5b791c,_0x89a076=_0x1d7c0d[_0x4467ea(0x109)]||getActiveProfile();if(!_0x89a076)return _0x4467ea(0xbd);if(_0x1d1576['length']===0x0)return _0x4467ea(0xc9)+ProfileSetCommand[_0x4467ea(0xb9)][_0x4467ea(0x115)](',\x20');const _0x5178d2=_0x1d1576[0x0];if(!_0x5178d2[_0x4467ea(0xe1)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4467ea(0xb9)][_0x4467ea(0x115)](',\x20');const [_0x568871]=_0x5178d2[_0x4467ea(0x11b)]('=',0x2);if(!ProfileSetCommand[_0x4467ea(0xb9)][_0x4467ea(0xe1)](_0x568871))return'Unknown\x20key\x20\x27'+_0x568871+_0x4467ea(0xe3)+ProfileSetCommand[_0x4467ea(0xb9)][_0x4467ea(0x115)](',\x20');return undefined;}async['execute'](_0x5d2226){const _0x589f53=a31_0x1c71d1,{args:_0x505da7,options:_0xb3cf48}=_0x5d2226,_0x3e4435=_0xb3cf48['profile']||getActiveProfile(),[_0x52d00a,..._0x196929]=_0x505da7[0x0][_0x589f53(0x11b)]('='),_0x25598f=_0x196929[_0x589f53(0x115)]('=');console[_0x589f53(0xcc)](a31_0x5ba1e7[_0x589f53(0xc0)](_0x589f53(0xfa)));if(!profileExists(_0x3e4435)){const _0x20c606=await a31_0xa064c7({'type':'confirm','name':_0x589f53(0xd7),'message':_0x589f53(0xce)+_0x3e4435+_0x589f53(0xee),'initial':!![]});if(!_0x20c606[_0x589f53(0xd7)])return console['log'](_0x589f53(0xf3)),0x1;}const _0x274369=loadProfile(_0x3e4435),_0x283958=_0x274369?.[_0x589f53(0xc2)]||{};if(_0x52d00a===_0x589f53(0xb3)){const _0x214b8c=resolveSite(_0x25598f);console[_0x589f53(0xcc)](_0x589f53(0xf2)+_0x214b8c+_0x589f53(0xd9)),console[_0x589f53(0xcc)](_0x589f53(0x102)),console[_0x589f53(0xcc)]('\x20\x20'+getConsoleUrl(_0x214b8c,'/app/mp/ak'));const _0x691aa1=await a31_0xa064c7({'type':_0x589f53(0xb8),'name':_0x589f53(0x106),'message':_0x589f53(0x113),'validate':_0x533aa2=>{const _0x2cbec4=_0x589f53;if(!_0x533aa2||!_0x533aa2[_0x2cbec4(0xc7)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x691aa1[_0x589f53(0x106)])return console['log'](_0x589f53(0xe6)),0x1;console[_0x589f53(0xcc)](_0x589f53(0xde));try{const _0x460f52=TDX[_0x589f53(0xd7)]({'site':_0x214b8c,'apiKey':_0x691aa1[_0x589f53(0x106)][_0x589f53(0xc7)](),'logLevel':_0xb3cf48[_0x589f53(0xe2)]??LogLevel['ERROR']}),_0x2bab77=await _0x460f52[_0x589f53(0xb7)][_0x589f53(0xf5)]();console[_0x589f53(0xcc)](a31_0x5ba1e7['green']('✓')+_0x589f53(0xda)+_0x2bab77[_0x589f53(0x104)]+')');const _0x3ff613=await isKeychainAvailable();_0x3ff613?(await saveAPIKeyAsync(_0x691aa1[_0x589f53(0x106)][_0x589f53(0xc7)](),_0x214b8c,_0x3e4435),console[_0x589f53(0xcc)](a31_0x5ba1e7[_0x589f53(0xbe)]('✓')+_0x589f53(0xef))):console[_0x589f53(0x110)](a31_0x5ba1e7[_0x589f53(0xf6)](_0x589f53(0xed))),_0x283958['site']=_0x214b8c;}catch(_0x32c29d){if(_0x32c29d instanceof HTTPClientError&&_0x32c29d['status']===0x191)return printAuthError(_0x32c29d),0x1;return console[_0x589f53(0x10c)](a31_0x5ba1e7[_0x589f53(0xf8)]('✗\x20Validation\x20failed:\x20'+(_0x32c29d instanceof Error?_0x32c29d['message']:String(_0x32c29d)))),console['error'](_0x589f53(0x120)),0x1;}}else _0x283958[_0x52d00a]=_0x25598f||undefined;return saveProfileToUserConfig(_0x3e4435,_0x283958),console[_0x589f53(0xcc)](a31_0x5ba1e7[_0x589f53(0xbe)]('✓')+_0x589f53(0x116)+_0x3e4435+_0x589f53(0xec)+_0x52d00a+'='+(_0x25598f||_0x589f53(0xdd))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x1c71d1(0x10b)]='profile:use';['description']=a31_0x1c71d1(0x10d);['validate'](_0x5e5c7c){const _0x13e3b2=a31_0x1c71d1,{args:_0x3e6d12}=_0x5e5c7c;if(_0x3e6d12[_0x13e3b2(0x103)]===0x0)return _0x13e3b2(0x114);return undefined;}async[a31_0x1c71d1(0xf0)](_0x48175d){const _0x29e632=a31_0x1c71d1,{args:_0x4bd7e8,options:_0x9bc13f}=_0x48175d,_0x4769d3=_0x4bd7e8[0x0],_0x59cab3=_0x9bc13f[_0x29e632(0x11c)];cleanExpiredSessions();if(!profileExists(_0x4769d3)){console[_0x29e632(0x10c)](a31_0x5ba1e7[_0x29e632(0xf8)]('Profile\x20\x27'+_0x4769d3+_0x29e632(0xdb))),console[_0x29e632(0xcc)](_0x29e632(0xc6));const _0x2c74c9=listProfiles();if(_0x2c74c9[_0x29e632(0x103)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x68d568 of _0x2c74c9){console[_0x29e632(0xcc)]('\x20\x20-\x20'+_0x68d568[_0x29e632(0x10b)]);}return 0x1;}if(_0x59cab3){const _0x30c86f=a31_0x1246e4[_0x29e632(0x115)](getConfigDir(),_0x29e632(0xff));return saveActiveProfileToUserConfig(_0x4769d3),console[_0x29e632(0xcc)](_0x29e632(0xbc)+a31_0x5ba1e7[_0x29e632(0xbe)](_0x4769d3)),console[_0x29e632(0xcc)](a31_0x5ba1e7['dim'](_0x29e632(0xc4)+_0x30c86f)),0x0;}const _0x1eb0e3=getSessionID(_0x9bc13f['session']);return saveSessionContext({'profile':_0x4769d3},_0x9bc13f['session']),console['log'](_0x29e632(0x112)+a31_0x5ba1e7[_0x29e632(0xbe)](_0x4769d3)+'\x20'+a31_0x5ba1e7[_0x29e632(0x107)](_0x29e632(0x11d)+_0x1eb0e3+')')),console[_0x29e632(0xcc)](a31_0x5ba1e7['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4769d3+_0x29e632(0x111))),0x0;}}
|
|
1
|
+
const a31_0x213fb8=a31_0x474e;(function(_0x1ee401,_0x48a2d2){const _0x15c565=a31_0x474e,_0x50f156=_0x1ee401();while(!![]){try{const _0x4e50ff=-parseInt(_0x15c565(0x234))/0x1+-parseInt(_0x15c565(0x209))/0x2+-parseInt(_0x15c565(0x241))/0x3*(parseInt(_0x15c565(0x220))/0x4)+parseInt(_0x15c565(0x23e))/0x5+parseInt(_0x15c565(0x222))/0x6*(parseInt(_0x15c565(0x1f6))/0x7)+-parseInt(_0x15c565(0x206))/0x8+-parseInt(_0x15c565(0x1fd))/0x9*(-parseInt(_0x15c565(0x20a))/0xa);if(_0x4e50ff===_0x48a2d2)break;else _0x50f156['push'](_0x50f156['shift']());}catch(_0x35572e){_0x50f156['push'](_0x50f156['shift']());}}}(a31_0x5a7f,0xe12b5));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 a31_0x4f30fe 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';function a31_0x474e(_0x2a564e,_0x179039){_0x2a564e=_0x2a564e-0x1d8;const _0x5a7f2e=a31_0x5a7f();let _0x474e4a=_0x5a7f2e[_0x2a564e];return _0x474e4a;}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 a31_0x5a7f(){const _0x5ecfa2=['method','red','✗\x20Validation\x20failed:\x20','select','OAuth\x20(browser\x20login)','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','text','green','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Validating\x20API\x20key...','logLevel','name','status','Set\x20a\x20profile\x20configuration\x20value','Profile\x20\x27','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Enter\x20profile\x20name:','config','profile:use','\x0aOperation\x20cancelled','profile:set','Profile\x20name\x20cannot\x20be\x20empty','apikey','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Failed\x20to\x20remove\x20profile:\x20','13839xQcLGs','Session\x20profile\x20set\x20to:\x20','Operation\x20cancelled','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','jobs','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','trim','4635MoeAxF','execute','\x20\x20-\x20','profile','\x0aSetup\x20cancelled','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','1361616FnPDhH','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','database','1909794TtkpLh','60670jGCfgI','parent_segment','llm_agent','yellow','length','\x27\x20does\x20not\x20exist.','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','apiKey','Site\x20was\x20not\x20changed.','/app/mp/ak','API\x20Key','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','includes','\x0aSaved\x20to:\x20','bold','\x20\x20tdx\x20--profile\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','validate','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Remove\x20a\x20profile','Choose\x20authentication\x20method:','3922364nCaLmE','default','3246AsHpwC','Enter\x20description\x20(optional):','join','dim','llm_project','\x27\x20removed\x20from\x20configuration','Create\x20a\x20new\x20profile','Setup\x20cancelled','tdx.json','warn','\x27\x20created','description','profile:remove','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','VALID_KEYS','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x27\x20requires\x20API\x20key\x20validation.','message','1651864zHkZFD','session','profile:create','\x27\x20updated:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','ERROR','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','profileName','error','Unknown\x20key\x20\x27','2428925cVvTMw','us01','(cleared)','3unZfAG','split','You\x20can\x20find\x20your\x20API\x20key\x20at:','API\x20key\x20cannot\x20be\x20empty','\x20\x20(no\x20profiles\x20found)','\x20Profile\x20\x27','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Removal\x20cancelled','confirm','Default\x20profile\x20set\x20to:\x20','password','test','Set\x20session\x20profile','site','tdx:\x20profile\x20remove','create'];a31_0x5a7f=function(){return _0x5ecfa2;};return a31_0x5a7f();}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x15fb8b from'prompts';import a31_0x3f0d42 from'chalk';function validateProfileName(_0x4787b8){const _0x5e0d85=a31_0x474e;if(!_0x4787b8||!_0x4787b8['trim']())return _0x5e0d85(0x1f2);const _0x42979d=_0x4787b8[_0x5e0d85(0x1fc)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5e0d85(0x1d8)](_0x42979d))return _0x5e0d85(0x202);if(profileExists(_0x42979d))return _0x5e0d85(0x1eb)+_0x42979d+_0x5e0d85(0x215);return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x213fb8(0x1e8)]=a31_0x213fb8(0x236);[a31_0x213fb8(0x22d)]=a31_0x213fb8(0x228);async[a31_0x213fb8(0x1fe)](_0x3bbce4){const _0x192878=a31_0x213fb8,{options:_0x5566b5,args:_0xbe9364}=_0x3bbce4;console[_0x192878(0x21c)](a31_0x3f0d42[_0x192878(0x218)]('tdx:\x20profile\x20create'));let _0x144bf8;if(_0xbe9364[_0x192878(0x20e)]>0x0&&_0xbe9364[0x0]){const _0x40f0fe=_0xbe9364[0x0][_0x192878(0x1fc)](),_0x5661b9=validateProfileName(_0x40f0fe);if(_0x5661b9!==!![])return console[_0x192878(0x23c)](a31_0x3f0d42['red'](_0x5661b9)),0x1;_0x144bf8=_0x40f0fe;}else{const _0xa42c8e=await a31_0x15fb8b({'type':_0x192878(0x1e3),'name':'profileName','message':_0x192878(0x1ed),'validate':validateProfileName});if(!_0xa42c8e['profileName'])return console[_0x192878(0x21c)](_0x192878(0x201)),0x1;_0x144bf8=_0xa42c8e[_0x192878(0x23b)][_0x192878(0x1fc)]();}const _0x4ea52a=await a31_0x15fb8b({'type':_0x192878(0x1e3),'name':_0x192878(0x22d),'message':_0x192878(0x223)}),_0x3db21c=_0x4ea52a[_0x192878(0x22d)]?.[_0x192878(0x1fc)]()||undefined,_0x46104e=_0x5566b5[_0x192878(0x1da)]||_0x192878(0x23f),_0x38d3c2=await promptSiteSelection(_0x46104e,_0x144bf8,_0x192878(0x229));if(!_0x38d3c2)return 0x1;const _0x69c758=resolveSite(_0x38d3c2);if(isOAuthSupported(_0x69c758)){const _0x60933c=await a31_0x15fb8b({'type':_0x192878(0x1e0),'name':_0x192878(0x1dd),'message':_0x192878(0x21f),'choices':[{'title':_0x192878(0x1e1),'value':'oauth'},{'title':_0x192878(0x214),'value':_0x192878(0x1f3)}]});if(!_0x60933c[_0x192878(0x1dd)])return console[_0x192878(0x21c)](_0x192878(0x201)),0x1;if(_0x60933c[_0x192878(0x1dd)]==='oauth'){if(_0x3db21c){const _0x21f63c={'site':_0x69c758,'description':_0x3db21c};saveProfileToUserConfig(_0x144bf8,_0x21f63c);}return await runOAuthLoginFlow(_0x69c758,_0x144bf8,_0x5566b5[_0x192878(0x1e7)]??LogLevel[_0x192878(0x239)]),0x0;}}console[_0x192878(0x21c)](_0x192878(0x1fb)+_0x69c758),console[_0x192878(0x21c)](_0x192878(0x243)),console[_0x192878(0x21c)]('\x20\x20'+getConsoleUrl(_0x69c758,'/app/mp/ak'));const _0x437128=await a31_0x15fb8b({'type':'password','name':_0x192878(0x211),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x31f320=>{const _0x15c902=_0x192878;if(!_0x31f320||!_0x31f320[_0x15c902(0x1fc)]())return _0x15c902(0x244);return!![];}});if(!_0x437128[_0x192878(0x211)])return console[_0x192878(0x21c)]('\x0aSetup\x20cancelled'),0x1;const _0x212337=_0x437128['apiKey'];console[_0x192878(0x21c)](_0x192878(0x1e6));try{const _0x16bb73=TDX[_0x192878(0x1dc)]({'site':_0x69c758,'apiKey':_0x212337[_0x192878(0x1fc)](),'logLevel':_0x5566b5[_0x192878(0x1e7)]??LogLevel[_0x192878(0x239)]}),_0x380527=await _0x16bb73[_0x192878(0x1fa)]['getUserInfo']();console['log'](a31_0x3f0d42['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x380527['email']+')');const _0x4db8b5=await isKeychainAvailable();_0x4db8b5?(await saveAPIKeyAsync(_0x212337[_0x192878(0x1fc)](),_0x69c758,_0x144bf8),console['log'](a31_0x3f0d42[_0x192878(0x1e4)]('✓')+_0x192878(0x204)+_0x144bf8+')')):(console[_0x192878(0x22b)](a31_0x3f0d42[_0x192878(0x20d)](_0x192878(0x1e2))),console['warn'](a31_0x3f0d42[_0x192878(0x20d)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x11db80={'site':_0x69c758,..._0x3db21c&&{'description':_0x3db21c}};return saveProfileToUserConfig(_0x144bf8,_0x11db80),console['log'](a31_0x3f0d42[_0x192878(0x1e4)]('✓')+_0x192878(0x246)+_0x144bf8+_0x192878(0x22c)),console[_0x192878(0x21c)](),console['log'](_0x192878(0x1f4)),console[_0x192878(0x21c)](_0x192878(0x219)+_0x144bf8+_0x192878(0x1f9)),console[_0x192878(0x21c)](_0x192878(0x219)+_0x144bf8+_0x192878(0x1e5)),0x0;}catch(_0x5cce37){if(_0x5cce37 instanceof HTTPClientError&&_0x5cce37[_0x192878(0x1e9)]===0x191)return printAuthError(_0x5cce37),0x1;return console[_0x192878(0x23c)](a31_0x3f0d42['red'](_0x192878(0x1df)+(_0x5cce37 instanceof Error?_0x5cce37[_0x192878(0x233)]:String(_0x5cce37)))),console[_0x192878(0x23c)](_0x192878(0x22f)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a31_0x213fb8(0x22e);[a31_0x213fb8(0x22d)]=a31_0x213fb8(0x21e);[a31_0x213fb8(0x21b)](_0x48be33){const _0x59c174=a31_0x213fb8,{args:_0x1145fb}=_0x48be33;if(_0x1145fb['length']===0x0)return _0x59c174(0x247);return undefined;}async[a31_0x213fb8(0x1fe)](_0x3bb572){const _0x503ad9=a31_0x213fb8,{args:_0x4d8672}=_0x3bb572,_0x52e47a=_0x4d8672[0x0];console[_0x503ad9(0x21c)](a31_0x3f0d42[_0x503ad9(0x218)](_0x503ad9(0x1db)));if(!profileExists(_0x52e47a)){console[_0x503ad9(0x23c)](a31_0x3f0d42[_0x503ad9(0x1de)](_0x503ad9(0x1eb)+_0x52e47a+_0x503ad9(0x20f))),console[_0x503ad9(0x21c)]('\x0aAvailable\x20profiles:');const _0x481a2b=listProfiles();if(_0x481a2b[_0x503ad9(0x20e)]===0x0)console[_0x503ad9(0x21c)](_0x503ad9(0x245));else for(const _0xa0546f of _0x481a2b){console[_0x503ad9(0x21c)](_0x503ad9(0x1ff)+_0xa0546f['name']);}return 0x1;}const _0x5ea97a=await a31_0x15fb8b({'type':_0x503ad9(0x249),'name':_0x503ad9(0x249),'message':_0x503ad9(0x21a)+_0x52e47a+'\x27?','initial':![]});if(!_0x5ea97a['confirm'])return console[_0x503ad9(0x21c)](_0x503ad9(0x248)),0x0;try{removeProfileFromUserConfig(_0x52e47a),console[_0x503ad9(0x21c)](a31_0x3f0d42['green']('✓')+_0x503ad9(0x246)+_0x52e47a+_0x503ad9(0x227));}catch(_0x3ed5ac){return console['error'](a31_0x3f0d42[_0x503ad9(0x1de)](_0x503ad9(0x1f5)+(_0x3ed5ac instanceof Error?_0x3ed5ac[_0x503ad9(0x233)]:String(_0x3ed5ac)))),0x1;}const _0xd05a5b=await isKeychainAvailable();if(_0xd05a5b){const _0x58bd34=await deleteKeychainAPIKey(_0x52e47a);_0x58bd34&&console[_0x503ad9(0x21c)](a31_0x3f0d42[_0x503ad9(0x1e4)]('✓')+_0x503ad9(0x1ec));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a31_0x213fb8(0x1f1);[a31_0x213fb8(0x22d)]=a31_0x213fb8(0x1ea);static [a31_0x213fb8(0x230)]=[a31_0x213fb8(0x1da),a31_0x213fb8(0x208),a31_0x213fb8(0x20b),a31_0x213fb8(0x226),a31_0x213fb8(0x20c),a31_0x213fb8(0x22d)];['validate'](_0x82c89e){const _0x1c5423=a31_0x213fb8,{args:_0x322cfe,options:_0x401623}=_0x82c89e,_0x17a764=_0x401623[_0x1c5423(0x200)]||getActiveProfile();if(!_0x17a764)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(_0x322cfe[_0x1c5423(0x20e)]===0x0)return _0x1c5423(0x210)+ProfileSetCommand[_0x1c5423(0x230)][_0x1c5423(0x224)](',\x20');const _0x2c1f4c=_0x322cfe[0x0];if(!_0x2c1f4c[_0x1c5423(0x216)]('='))return _0x1c5423(0x21d)+ProfileSetCommand['VALID_KEYS'][_0x1c5423(0x224)](',\x20');const [_0x702d07]=_0x2c1f4c[_0x1c5423(0x242)]('=',0x2);if(!ProfileSetCommand[_0x1c5423(0x230)][_0x1c5423(0x216)](_0x702d07))return _0x1c5423(0x23d)+_0x702d07+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x1c5423(0x224)](',\x20');return undefined;}async[a31_0x213fb8(0x1fe)](_0x110043){const _0x226f17=a31_0x213fb8,{args:_0x31de8a,options:_0x40c6be}=_0x110043,_0x386392=_0x40c6be[_0x226f17(0x200)]||getActiveProfile(),[_0x54db4d,..._0x379915]=_0x31de8a[0x0][_0x226f17(0x242)]('='),_0x36642f=_0x379915[_0x226f17(0x224)]('=');console['log'](a31_0x3f0d42['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0x386392)){const _0x289988=await a31_0x15fb8b({'type':'confirm','name':'create','message':_0x226f17(0x1eb)+_0x386392+_0x226f17(0x231),'initial':!![]});if(!_0x289988[_0x226f17(0x1dc)])return console[_0x226f17(0x21c)](_0x226f17(0x1f8)),0x1;}const _0x43f044=loadProfile(_0x386392),_0x424a88=_0x43f044?.[_0x226f17(0x1ee)]||{};if(_0x54db4d==='site'){const _0x368002=resolveSite(_0x36642f);console[_0x226f17(0x21c)]('Changing\x20site\x20to\x20\x27'+_0x368002+_0x226f17(0x232)),console[_0x226f17(0x21c)](_0x226f17(0x238)),console[_0x226f17(0x21c)]('\x20\x20'+getConsoleUrl(_0x368002,_0x226f17(0x213)));const _0x31e81b=await a31_0x15fb8b({'type':_0x226f17(0x24b),'name':_0x226f17(0x211),'message':_0x226f17(0x207),'validate':_0xfb711c=>{const _0x286cf9=_0x226f17;if(!_0xfb711c||!_0xfb711c[_0x286cf9(0x1fc)]())return _0x286cf9(0x244);return!![];}});if(!_0x31e81b[_0x226f17(0x211)])return console[_0x226f17(0x21c)](_0x226f17(0x1f0)),0x1;console[_0x226f17(0x21c)]('Validating\x20API\x20key...');try{const _0x18c471=TDX[_0x226f17(0x1dc)]({'site':_0x368002,'apiKey':_0x31e81b[_0x226f17(0x211)]['trim'](),'logLevel':_0x40c6be['logLevel']??LogLevel[_0x226f17(0x239)]}),_0x4a5756=await _0x18c471[_0x226f17(0x1fa)]['getUserInfo']();console[_0x226f17(0x21c)](a31_0x3f0d42[_0x226f17(0x1e4)]('✓')+_0x226f17(0x203)+_0x4a5756['email']+')');const _0x175eea=await isKeychainAvailable();_0x175eea?(await saveAPIKeyAsync(_0x31e81b[_0x226f17(0x211)]['trim'](),_0x368002,_0x386392),console[_0x226f17(0x21c)](a31_0x3f0d42[_0x226f17(0x1e4)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x226f17(0x22b)](a31_0x3f0d42[_0x226f17(0x20d)](_0x226f17(0x1e2))),_0x424a88[_0x226f17(0x1da)]=_0x368002;}catch(_0x13d732){if(_0x13d732 instanceof HTTPClientError&&_0x13d732[_0x226f17(0x1e9)]===0x191)return printAuthError(_0x13d732),0x1;return console[_0x226f17(0x23c)](a31_0x3f0d42[_0x226f17(0x1de)](_0x226f17(0x1df)+(_0x13d732 instanceof Error?_0x13d732['message']:String(_0x13d732)))),console['error'](_0x226f17(0x212)),0x1;}}else _0x424a88[_0x54db4d]=_0x36642f||undefined;return saveProfileToUserConfig(_0x386392,_0x424a88),console[_0x226f17(0x21c)](a31_0x3f0d42[_0x226f17(0x1e4)]('✓')+'\x20Profile\x20\x27'+_0x386392+_0x226f17(0x237)+_0x54db4d+'='+(_0x36642f||_0x226f17(0x240))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a31_0x213fb8(0x1ef);[a31_0x213fb8(0x22d)]=a31_0x213fb8(0x1d9);[a31_0x213fb8(0x21b)](_0x160741){const _0x4d63ea=a31_0x213fb8,{args:_0x3ab5}=_0x160741;if(_0x3ab5[_0x4d63ea(0x20e)]===0x0)return _0x4d63ea(0x23a);return undefined;}async[a31_0x213fb8(0x1fe)](_0x27cffd){const _0x1458bb=a31_0x213fb8,{args:_0x56e206,options:_0x10b9ba}=_0x27cffd,_0x128cc0=_0x56e206[0x0],_0x4b9621=_0x10b9ba[_0x1458bb(0x221)];cleanExpiredSessions();if(!profileExists(_0x128cc0)){console[_0x1458bb(0x23c)](a31_0x3f0d42[_0x1458bb(0x1de)]('Profile\x20\x27'+_0x128cc0+_0x1458bb(0x20f))),console[_0x1458bb(0x21c)]('\x0aAvailable\x20profiles:');const _0x5cb3cc=listProfiles();if(_0x5cb3cc[_0x1458bb(0x20e)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x23906a of _0x5cb3cc){console[_0x1458bb(0x21c)](_0x1458bb(0x1ff)+_0x23906a[_0x1458bb(0x1e8)]);}return 0x1;}if(_0x4b9621){const _0x7819ba=a31_0x4f30fe[_0x1458bb(0x224)](getConfigDir(),_0x1458bb(0x22a));return saveActiveProfileToUserConfig(_0x128cc0),console['log'](_0x1458bb(0x24a)+a31_0x3f0d42[_0x1458bb(0x1e4)](_0x128cc0)),console[_0x1458bb(0x21c)](a31_0x3f0d42[_0x1458bb(0x225)](_0x1458bb(0x217)+_0x7819ba)),0x0;}const _0x3fe9b7=getSessionID(_0x10b9ba[_0x1458bb(0x235)]);return saveSessionContext({'profile':_0x128cc0},_0x10b9ba[_0x1458bb(0x235)]),console[_0x1458bb(0x21c)](_0x1458bb(0x1f7)+a31_0x3f0d42['green'](_0x128cc0)+'\x20'+a31_0x3f0d42[_0x1458bb(0x225)]('(session:\x20'+_0x3fe9b7+')')),console['log'](a31_0x3f0d42[_0x1458bb(0x225)](_0x1458bb(0x205)+_0x128cc0+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x25fd3b=a32_0x466b;function a32_0x466b(_0x5a6d94,_0x53f7a){_0x5a6d94=_0x5a6d94-0xa5;const _0x3f0f30=a32_0x3f0f();let _0x466b85=_0x3f0f30[_0x5a6d94];return _0x466b85;}(function(_0xea3f30,_0x208cfd){const _0x329e14=a32_0x466b,_0x444692=_0xea3f30();while(!![]){try{const _0x5835e1=parseInt(_0x329e14(0xbb))/0x1+-parseInt(_0x329e14(0xaa))/0x2+-parseInt(_0x329e14(0xb7))/0x3*(-parseInt(_0x329e14(0xab))/0x4)+parseInt(_0x329e14(0xb2))/0x5*(-parseInt(_0x329e14(0xae))/0x6)+-parseInt(_0x329e14(0xaf))/0x7+parseInt(_0x329e14(0xbc))/0x8*(parseInt(_0x329e14(0xb9))/0x9)+parseInt(_0x329e14(0xc0))/0xa;if(_0x5835e1===_0x208cfd)break;else _0x444692['push'](_0x444692['shift']());}catch(_0x17b79a){_0x444692['push'](_0x444692['shift']());}}}(a32_0x3f0f,0x5fc3d));function a32_0x3f0f(){const _0x4cd41a=['message','config','5CYJfpC','execute','name','length','List\x20all\x20available\x20profiles','336486tJZKJU','scope','1886373EvWKPP','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','708586Fbplxz','16ddetps','\x20\x20Global:\x20~/.config/tdx/tdx.json','site','dim','4284670RqQLuW','map','👤\x20','error','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','1508200HMgYkE','4BouWTQ','log','description','2335764UZYKUj','929334qwJKJG'];a32_0x3f0f=function(){return _0x4cd41a;};return a32_0x3f0f();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0x48285a from'chalk';export class ProfilesCommand extends BaseCommand{[a32_0x25fd3b(0xb4)]=a32_0x25fd3b(0xa9);[a32_0x25fd3b(0xad)]=a32_0x25fd3b(0xb6);async[a32_0x25fd3b(0xb3)](_0xb16cc3){const _0x4d0f4f=a32_0x25fd3b,{options:_0x2aca12}=_0xb16cc3;try{const _0x3eb7d2=listProfiles(),_0x4ad24e=getActiveProfile();if(_0x3eb7d2[_0x4d0f4f(0xb5)]===0x0)return console[_0x4d0f4f(0xac)](_0x4d0f4f(0xa8)),console[_0x4d0f4f(0xac)](_0x4d0f4f(0xba)),console[_0x4d0f4f(0xac)](_0x4d0f4f(0xbd)),0x0;const _0x17fc1c=_0x3eb7d2[_0x4d0f4f(0xa5)](_0x27c2ea=>{const _0x40f65d=_0x4d0f4f,_0x1abd4f=_0x27c2ea[_0x40f65d(0xb4)]===_0x4ad24e,_0x14a301=getProfileParams(_0x27c2ea[_0x40f65d(0xb1)]);return{'name':_0x27c2ea[_0x40f65d(0xb4)],'active':_0x1abd4f,'scope':_0x27c2ea[_0x40f65d(0xb8)],'description':_0x27c2ea['config'][_0x40f65d(0xad)]||'','params':_0x14a301};});if(isStructuredFormat(_0x2aca12))await handleSDKOutput(_0x17fc1c,_0x2aca12);else for(const _0x4afa62 of _0x3eb7d2){const _0x26d932=_0x4afa62['name']===_0x4ad24e?a32_0x48285a['green']('\x20✓'):'',_0x4049a6=_0x4afa62[_0x4d0f4f(0xb1)][_0x4d0f4f(0xbe)]?a32_0x48285a[_0x4d0f4f(0xbf)]('\x20'+_0x4afa62['config'][_0x4d0f4f(0xbe)]):'',_0x1a9971=_0x4afa62[_0x4d0f4f(0xb1)][_0x4d0f4f(0xad)]?a32_0x48285a['dim']('\x20\x20'+_0x4afa62[_0x4d0f4f(0xb1)][_0x4d0f4f(0xad)]):'';console[_0x4d0f4f(0xac)](_0x4d0f4f(0xa6)+_0x4afa62[_0x4d0f4f(0xb4)]+_0x26d932+_0x4049a6+_0x1a9971);}return 0x0;}catch(_0x573ae5){return _0x573ae5 instanceof Error&&console[_0x4d0f4f(0xa7)]('Error:\x20'+_0x573ae5[_0x4d0f4f(0xb0)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a33_0x1e0eb4=a33_0x41f7;(function(_0x15aebf,_0x274f96){const _0x5f1c5f=a33_0x41f7,_0x1f1a30=_0x15aebf();while(!![]){try{const _0x3c1560=-parseInt(_0x5f1c5f(0xba))/0x1+-parseInt(_0x5f1c5f(0xbf))/0x2+parseInt(_0x5f1c5f(0xa9))/0x3+parseInt(_0x5f1c5f(0xad))/0x4*(-parseInt(_0x5f1c5f(0xc6))/0x5)+-parseInt(_0x5f1c5f(0xaf))/0x6*(-parseInt(_0x5f1c5f(0xb1))/0x7)+-parseInt(_0x5f1c5f(0xc4))/0x8+parseInt(_0x5f1c5f(0xb7))/0x9*(parseInt(_0x5f1c5f(0xa4))/0xa);if(_0x3c1560===_0x274f96)break;else _0x1f1a30['push'](_0x1f1a30['shift']());}catch(_0x2e5fb4){_0x1f1a30['push'](_0x1f1a30['shift']());}}}(a33_0x3749,0x75b7f));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a33_0x3749(){const _0x3c7bba=['information_schema','413464iwoyOQ','jobId','setPhase','processedRows','output','866044fzItmn','Executing\x20statement\x20','Executing\x20query\x20[','name','SQL:\x20','4917512RAfaZP','options','10BddRXd','stats','Catalog:\x20','\x20splits','site','length','in\x20','\x20[Job\x20ID:\x20','message','Query\x20completed:\x20Processed\x20','Run\x20Trino\x20queries\x20(streaming)','setJobId','join','error','execute','query','data','No\x20SQL\x20provided','push','state','670EtZlHc','file','description','\x20rows\x20','\x20-\x20','2070270EEFdZT','Statement\x20','Executing\x20query...','Error:\x20','553444oeEDEY','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','6UCgBcJ','...','683123rVgsCX','verbose','\x0aAll\x20results\x20saved\x20to\x20','database','Schema:\x20','catalog','192411jHRUIA','Site:\x20'];a33_0x3749=function(){return _0x3c7bba;};return a33_0x3749();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a33_0x41f7(_0x3362ff,_0x4b2a7d){_0x3362ff=_0x3362ff-0x93;const _0x3749cf=a33_0x3749();let _0x41f779=_0x3749cf[_0x3362ff];return _0x41f779;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a33_0x1e0eb4(0xc2)]=a33_0x1e0eb4(0x9f);[a33_0x1e0eb4(0xa6)]=a33_0x1e0eb4(0x9a);async[a33_0x1e0eb4(0x9e)](_0x48c7d2){const _0x1bb825=a33_0x1e0eb4,{options:_0x33e8e5,args:_0x475f7a,tdx:_0x363f7e}=_0x48c7d2,_0x33fbd1={..._0x33e8e5,'limitStructuredFormats':!![]},_0xa8d8d4=_0x475f7a[0x0],_0x6fa816=_0x33e8e5[_0x1bb825(0xa5)];let _0x48ba39;try{if(_0x6fa816)_0x48ba39=readSqlStatementsFromFile(_0x6fa816);else{if(_0xa8d8d4==='-')_0x48ba39=await readSqlStatementsFromStdin();else{if(_0xa8d8d4&&isSqlFilePath(_0xa8d8d4))_0x48ba39=readSqlStatementsFromFile(_0xa8d8d4);else{if(_0xa8d8d4)_0x48ba39=splitSqlStatements(_0xa8d8d4);else throw new Error(_0x1bb825(0xa1));}}}}catch(_0x3f600a){return console['error'](_0x1bb825(0xac)+_0x3f600a[_0x1bb825(0x98)]),0x1;}const _0x17e717=_0x33e8e5[_0x1bb825(0xb4)]||_0x1bb825(0xb9),_0x1def22=_0x33e8e5[_0x1bb825(0xb6)];try{const _0x49d5e7=[],_0x1313c3=!!_0x33e8e5['output'];for(let _0x4b8f5=0x0;_0x4b8f5<_0x48ba39['length'];_0x4b8f5++){const _0x507751=_0x48ba39[_0x4b8f5],_0x147f4d=_0x4b8f5+0x1,_0x1d8a13=_0x48ba39[_0x1bb825(0x95)],_0x32350e=_0x1d8a13>0x1;_0x33e8e5[_0x1bb825(0xb2)]&&(console['error']('\x0a'+(_0x32350e?_0x1bb825(0xaa)+_0x147f4d+'/'+_0x1d8a13+':':'')),console['error'](_0x1bb825(0xb8)+_0x33e8e5[_0x1bb825(0x94)]),console[_0x1bb825(0x9d)](_0x1bb825(0xc8)+(_0x1def22||'td')),console[_0x1bb825(0x9d)](_0x1bb825(0xb5)+_0x17e717),console[_0x1bb825(0x9d)](_0x1bb825(0xc3)+_0x507751));const _0x343e3a=_0x32350e?_0x1bb825(0xc0)+_0x147f4d+'/'+_0x1d8a13+_0x1bb825(0xb0):_0x1bb825(0xab);try{const _0x4a158b=await withProgressSpinner(_0x343e3a,async _0x2383b6=>{const _0x1d81fb=_0x1bb825,_0x467610=await _0x363f7e[_0x1d81fb(0x9f)][_0x1d81fb(0x9e)](_0x507751,{'catalog':_0x1def22,'schema':_0x17e717,'onJobId':_0x1bd7db=>{const _0x5bb856=_0x1d81fb;_0x2383b6[_0x5bb856(0x9b)](_0x1bd7db);},'onProgress':_0x265a8a=>{const _0x314391=_0x1d81fb;_0x2383b6[_0x314391(0xbc)](_0x314391(0xc1)+_0x265a8a[_0x314391(0xa3)]+']'),_0x2383b6['setExtra'](formatRows(_0x265a8a['processedRows'])+_0x314391(0xa7)+_0x265a8a['completedSplits']+'/'+_0x265a8a['totalSplits']+_0x314391(0x93));}});return _0x467610;},{'verbose':_0x33e8e5[_0x1bb825(0xb2)]}),_0x2cff52=_0x4a158b[_0x1bb825(0xa0)],_0x3aebf2=_0x2cff52['jobId']?_0x1bb825(0x97)+_0x2cff52[_0x1bb825(0xbb)]+']':'',_0x58bee6=_0x32350e?_0x1bb825(0xaa)+_0x147f4d+'/'+_0x1d8a13+_0x1bb825(0xa8):'';console['error']('✔\x20'+_0x58bee6+_0x1bb825(0x99)+formatRows(_0x2cff52[_0x1bb825(0xc7)][_0x1bb825(0xbd)])+_0x1bb825(0xa7)+(_0x1bb825(0x96)+formatElapsed(_0x2cff52[_0x1bb825(0xc7)]['elapsedTimeMillis'])+_0x3aebf2));if(_0x32350e&&_0x1313c3){const _0x54cdfa=resolveOutputOptions(_0x33fbd1),_0x3ae177=await formatQueryOutput(_0x2cff52,_0x54cdfa);_0x49d5e7[_0x1bb825(0xa2)](_0x3ae177);}else await handleQueryOutput(_0x2cff52,_0x33fbd1);}catch(_0x3bd1bb){const _0x56c8ba=_0x32350e?'Statement\x20'+_0x147f4d+'/'+_0x1d8a13+':\x0a':'',_0x4a8992=_0x3bd1bb instanceof SDKError?_0x3bd1bb['originalMessage']:_0x3bd1bb[_0x1bb825(0x98)];return console[_0x1bb825(0x9d)](''+_0x56c8ba+_0x4a8992),0x1;}}if(_0x48ba39[_0x1bb825(0x95)]>0x1&&_0x1313c3&&_0x49d5e7['length']>0x0){const _0x177adb=_0x49d5e7[_0x1bb825(0x9c)]('\x0a');writeFileSync(_0x33e8e5[_0x1bb825(0xbe)],_0x177adb),console['error'](_0x1bb825(0xb3)+_0x33e8e5[_0x1bb825(0xbe)]);}return 0x0;}catch(_0x59c41b){throw _0x59c41b;}}['validate'](_0x25d610){const _0x1c5fb2=a33_0x1e0eb4,_0x109e83=_0x25d610['args'][0x0],_0x52d6b5=_0x25d610[_0x1c5fb2(0xc5)][_0x1c5fb2(0xa5)];if(!_0x109e83&&!_0x52d6b5)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x109e83&&_0x52d6b5)return _0x1c5fb2(0xae);return undefined;}}
|