@treasuredata/tdx 0.28.2 → 0.28.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/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/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/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/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/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/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-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.d.ts.map +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-utils.js.map +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-validator.js.map +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +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/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.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/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/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 a26_0x3e1dba=a26_0x241c;(function(_0x1b70a2,_0x5f59ff){const _0x4e359c=a26_0x241c,_0x530b8f=_0x1b70a2();while(!![]){try{const _0xe81b65=parseInt(_0x4e359c(0x222))/0x1*(-parseInt(_0x4e359c(0x1ba))/0x2)+parseInt(_0x4e359c(0x289))/0x3+parseInt(_0x4e359c(0x1d2))/0x4+-parseInt(_0x4e359c(0x1ac))/0x5*(parseInt(_0x4e359c(0x2ad))/0x6)+-parseInt(_0x4e359c(0x20c))/0x7+-parseInt(_0x4e359c(0x28b))/0x8+parseInt(_0x4e359c(0x255))/0x9;if(_0xe81b65===_0x5f59ff)break;else _0x530b8f['push'](_0x530b8f['shift']());}catch(_0x115bb0){_0x530b8f['push'](_0x530b8f['shift']());}}}(a26_0x50f9,0x94a8b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x151967 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 a26_0x4d135b 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=a26_0x3e1dba(0x1b2),LEGACY_PARENT_SEGMENT_DIR=a26_0x3e1dba(0x249);function a26_0x241c(_0x3d53ec,_0x3d74fb){_0x3d53ec=_0x3d53ec-0x171;const _0x50f912=a26_0x50f9();let _0x241ca8=_0x50f912[_0x3d53ec];return _0x241ca8;}function openBrowser(_0x381ec5){const _0x11be3e=a26_0x3e1dba,_0x15732f=process[_0x11be3e(0x2d7)],_0x267cc1=_0x15732f===_0x11be3e(0x2a0)?'open':_0x15732f===_0x11be3e(0x28f)?_0x11be3e(0x1e7):_0x11be3e(0x1e9);spawn(_0x267cc1,[_0x381ec5],{'detached':!![],'stdio':'ignore'})[_0x11be3e(0x2a2)]();}function a26_0x50f9(){const _0x5502d0=['\x20Opening\x20','\x20rows)','✔\x20Found\x20','To\x20cancel:','text','Events:','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','YAML\x20file:\x20','displayAttributesStats','👥\x20','setJobId','label','matchedCount','Personalization\x20service\x20description','\x20\x20Database:\x20','\x20=\x20','schemaValid','/\x20→\x20','Customers:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','segment:parent:fields','apply','displaySummary','workflowAttemptId','Overwrite\x20\x27','getParentSQL','sourceTableValid','Status:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','behavior','column_name','segment:parent:preview','platform','Error\x20reading\x20file:\x20','Error\x20parsing\x20YAML:\x20','true','endsWith','\x20\x20Columns:\x20','Pattern:\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','personalizationServices','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','repeat','description','use','FINISHED','interval','cyan','Apply\x20changes\x20to\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','allValid','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','No\x20RT-enabled\x20parent\x20segments\x20found','utf-8','/app/dw/parentSegments/','Behaviors','customerPercent','run','table','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x22,\x20\x22type\x22:\x20\x22','single','\x5c$&','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Output\x20Database:','addBehaviors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','status','Master\x20Table','sort','valid','\x0a\x20\x20\x20\x20]','Attempt:','To\x20view\x20sample\x20data:','.yml','\x20rows\x20','Validate:','stats','personalization_services','verbose','schemaError','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','enabled','displayPreviewHints','timezone','\x20behaviors','varchar','✔\x20Query\x20completed:\x20Processed\x20','Fetching\x20sample\x20data...','\x27\x20and\x20run\x20workflow?','\x20to\x20push\x20the\x20configuration','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20[Job\x20ID:\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','displayBehaviorsStats','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\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','segment:parent:view','pushParentYaml','\x22\x20}','join','realtime','\x20Configuration\x20is\x20valid','Available\x20attributes:','\x0aChanges\x20to\x20apply\x20to\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Attributes','/app/workflows/','realtime:','Fetching\x20customers\x20schema...','getParentFull','\x20\x20Tables:\x201\x20customers\x20+\x20','Validating\x20configuration...','joinKey','collectSchema','Updating','\x20RT-enabled\x20parent\x20segment','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20configured','displayColumns','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','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','/{name}.yml\x0a','\x20--behavior\x20\x22','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Updating\x20parent\x20segment\x20\x27','\x20Added\x20RT\x202.0\x20template\x20section','dirname','audienceId','Error:','-1d','all','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','415bhygRm','master','name','\x20\x201.\x20Edit\x20','attributesFile','`\x20to\x20download\x20the\x20configuration\x20first','parent_segments','Output\x20file:\x20','behaviors','listParents','push','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Create\x20parent\x20segment\x20\x27','green','16BOEoSS','string','toFixed','dim','stitchingKeys','displayValidateResults','last_page_viewed','sampleData','site','yes','\x20parent\x20segment\x20\x27','No\x20parent\x20segments\x20found','foreignKey','\x20No\x20changes\x20-\x20','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','message','Error:\x20File\x20not\x20found:\x20','validateParentYaml','errors','\x20tdx\x20wf\x20attempt\x20','keys','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Personalization:','\x20service(s)\x20configured','1156308QCLsCE','format','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Source:','length','No\x20parent\x20segments\x20match\x20pattern:\x20','%)\x20','formatSchemaJson','/attempt/','isDirectory','SELECT\x20*\x20FROM\x20','Creating','Resolving\x20parent\x20segment\x20\x27','\x27...','listFields','Error:\x20Parent\x20segment\x20name\x20is\x20required','Show\x20parent\x20segment\x20schema\x20(column\x20types)','segment:parent:desc','output','double','start','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','xdg-open','data','segment','customerGroup','Next\x20steps:','\x20--attribute\x20\x22','Coverage:','population','Fetching\x20SQL\x20for\x20\x27','database','tdx\x20ps\x20preview\x20','\x27\x20is\x20already\x20up\x20to\x20date','ID\x20Stitching:','Name:\x20','segment:parent:show','\x20\x20\x20\x20-\x20','yellow','\x0aNew\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','/\x20directories\x20exist.','list','tdx\x20ps\x20push\x20','My\x20Service','rowCount','columns','\x20parent\x20segment','Attribute:','Listing\x20personalization\x20services\x20for\x20\x27','runParent','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','RT\x202.0\x20Validate:','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20RT\x20configuration\x20is\x20valid','enriched','Get\x20SQL\x20query\x20for\x20parent\x20segment','29120HfvcBX','customerGroupFile','toLowerCase','previewParentYaml','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','in\x20','addAttributes','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Created','SQL\x20query:\x0a','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','reduce','primaryKey','jobId','\x20total','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0aNo\x20sample\x20data\x20available','user_id','Fetching\x20parent\x20segment\x20\x27','displayRealtimeInfo','112289dgCadi','\x20\x20\x20\x20','Aborted.','stop','column_type','Error:\x20--database\x20and\x20--table\x20are\x20required','behavior_','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20--enriched','Schema\x20saved\x20to\x20','List\x20available\x20fields\x20for\x20segmentation','\x27\x20is\x20up\x20to\x20date','attribute','segment:parent:push','Behavior:','getOutputDatabaseName','toLocaleString','idStitching','map','displayPreviewResults','red','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x0aUsage:\x20tdx\x20ps\x20preview\x20','customersWithEvents','segment:parent:list','\x20--attribute\x20\x22<name>\x22','events','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Session:','Show\x20parent\x20segment\x20details','customers','realtime_enabled','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','trim','/\x20directory.\x0a','Columns:','sourceTableError','parent_segment','session','RT\x202.0:','/sessions/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','getBehaviorNames','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Listing\x20fields\x20for\x20\x27','Master:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20Context\x20set:\x20','15212376bQoPeK','List\x20parent\x20segments','test','coveragePercent','totalEvents','.customers)','sections','Table:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','type','Master\x20+\x20Attributes','Analyzing\x20changes...','Join\x20on:','\x20\x202.\x20Run\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Parent\x20segment:\x20','match','web','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','parentSegment','error','Site:\x20','Updated','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x20field','log','segment:parent:create','bold','/\x20and\x20','SELECT\x20*\x20FROM\x20(\x0a','personalization','Listing\x20parent\x20segments...','Errors:','resolveParentId','{\x0a\x20\x20\x22database\x22:\x20\x22','createParent','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','limit','\x20--behavior\x20\x22<name>\x22','addAttributesFile','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','replace','execute','workflowSessionId','✔\x20No\x20changes\x20-\x20\x27','<database>.<table>','Preview:','.yaml','\x0a✔\x20Workflow\x20started','segment:parent:run','\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','552510hdmQJk','Available\x20behaviors:','4833928bnbZEZ','attributes','Rows:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','win32','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20personalization\x20service','filter','\x0a⚠️\x20\x20Both\x20','behaviorsFile','Fetching\x20behavior\x20list...','parent_id','✔\x20Renamed\x20directory\x20to\x20','\x20\x20Note:\x20','localeCompare','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','updateParent','Found\x20YAML\x20file:\x20','pullParentYaml','using\x20the\x20default\x20path:\x20','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','darwin','Join:','unref','Default','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20is\x20already\x20up\x20to\x20date','Attributes:','displayMasterInfo','displaySampleData','\x20section','jsonl','scheduleType','\x20\x20\x20','3462xWSxoq','\x20kill','preview','column','segment:parent:pull','\x0aError:','Options:\x0a','\x20\x20No\x20sample\x20data\x20available','json','scheduleOption'];a26_0x50f9=function(){return _0x5502d0;};return a26_0x50f9();}function migrateLegacyDirectory(){const _0x5bc3ab=a26_0x3e1dba;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4e531c=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4e531c[_0x5bc3ab(0x1dc)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x1f9)](_0x5bc3ab(0x293)+LEGACY_PARENT_SEGMENT_DIR+_0x5bc3ab(0x271)+PARENT_SEGMENT_DIR+_0x5bc3ab(0x1fc))),console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x1bd)](_0x5bc3ab(0x238)+LEGACY_PARENT_SEGMENT_DIR+_0x5bc3ab(0x246))),![];console[_0x5bc3ab(0x269)](a26_0x4d135b['yellow']('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5bc3ab(0x2c8)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x1b9)](_0x5bc3ab(0x297)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2ebbd1){const _0x46b711=_0x2ebbd1 instanceof Error?_0x2ebbd1['message']:String(_0x2ebbd1);return console[_0x5bc3ab(0x269)](a26_0x4d135b[_0x5bc3ab(0x237)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x46b711+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x3e1dba(0x2f0)](_0x352d46){return migrateLegacyDirectory(),super['run'](_0x352d46);}}function resolveYamlFile(_0x225f20){const _0x56add1=a26_0x3e1dba;if(_0x225f20[_0x56add1(0x2db)]('.yml')||_0x225f20[_0x56add1(0x2db)](_0x56add1(0x285)))return _0x225f20;return a26_0x151967[_0x56add1(0x189)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x225f20)+_0x56add1(0x304));}function formatProgressMessage(_0x5ac2bf){const _0x3e4b79=a26_0x3e1dba,_0x320e54=_0x5ac2bf[_0x3e4b79(0x265)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x320e54){const [,_0x44e678,_0x521519,_0x16a590='']=_0x320e54;return a26_0x4d135b[_0x3e4b79(0x1bd)](_0x44e678+':')+'\x20'+_0x521519+a26_0x4d135b[_0x3e4b79(0x1bd)](_0x16a590);}return a26_0x4d135b[_0x3e4b79(0x1bd)](_0x5ac2bf);}function showFileNotFoundError(_0x56e69e,_0x438afa){const _0x49a928=a26_0x3e1dba;console['error'](a26_0x4d135b[_0x49a928(0x237)](_0x49a928(0x1ca)+_0x56e69e+'\x0a')),console[_0x49a928(0x269)](a26_0x4d135b[_0x49a928(0x2e6)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x438afa+_0x49a928(0x1b1)));}function displayRealtimeValidation(_0x20917c){const _0x79c225=a26_0x3e1dba;if(!_0x20917c['realtime'])return;const _0x5dea7f=_0x20917c['realtime'],_0x39daf2=_0x5dea7f[_0x79c225(0x176)]?a26_0x4d135b['green']('⚡\x20Enabled'):a26_0x4d135b[_0x79c225(0x1f9)]('⚡\x20Not\x20enabled');console[_0x79c225(0x269)]('\x0a'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x24b))+'\x20'+_0x39daf2);if(_0x5dea7f[_0x79c225(0x23e)]&&_0x5dea7f[_0x79c225(0x23e)][_0x79c225(0x1d7)]>0x0){console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b['dim'](_0x79c225(0x2bc))+'\x20'+_0x5dea7f[_0x79c225(0x23e)][_0x79c225(0x1d7)]+_0x79c225(0x19c));for(const _0x4fca72 of _0x5dea7f['events']){const _0x4dd9f8=_0x4fca72[_0x79c225(0x2d1)]===![]?a26_0x4d135b[_0x79c225(0x237)]('✘'):a26_0x4d135b[_0x79c225(0x1b9)]('✔');console[_0x79c225(0x269)](_0x79c225(0x223)+_0x4dd9f8+'\x20'+_0x4fca72[_0x79c225(0x1ae)]),_0x4fca72[_0x79c225(0x248)]&&console['error']('\x20\x20\x20\x20\x20\x20'+a26_0x4d135b['red'](_0x4fca72[_0x79c225(0x248)]));}}if(_0x5dea7f[_0x79c225(0x28c)]&&_0x5dea7f[_0x79c225(0x28c)]['length']>0x0){console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x2a6))+'\x20'+_0x5dea7f['attributes'][_0x79c225(0x1d7)]+_0x79c225(0x19c));for(const _0x328f28 of _0x5dea7f[_0x79c225(0x28c)]){const _0x395b5b=_0x328f28[_0x79c225(0x300)]?a26_0x4d135b[_0x79c225(0x1b9)]('✔'):a26_0x4d135b[_0x79c225(0x237)]('✘');console[_0x79c225(0x269)]('\x20\x20\x20\x20'+_0x395b5b+'\x20'+_0x328f28[_0x79c225(0x1ae)]+'\x20'+a26_0x4d135b['dim']('('+_0x328f28[_0x79c225(0x25e)]+')'));}}if(_0x5dea7f['idStitching']){const _0x563e23=_0x5dea7f['idStitching'][_0x79c225(0x1be)]?.[_0x79c225(0x1d7)]?'\x20+\x20['+_0x5dea7f[_0x79c225(0x234)]['stitchingKeys'][_0x79c225(0x189)](',\x20')+']':'';console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x1f5))+'\x20'+_0x5dea7f[_0x79c225(0x234)][_0x79c225(0x219)]+_0x563e23);}if(_0x5dea7f['personalizationServices']&&_0x5dea7f[_0x79c225(0x2df)][_0x79c225(0x1d7)]>0x0){console[_0x79c225(0x269)]('\x20\x20'+a26_0x4d135b[_0x79c225(0x1bd)](_0x79c225(0x1d0))+'\x20'+_0x5dea7f['personalizationServices'][_0x79c225(0x1d7)]+'\x20service'+(_0x5dea7f[_0x79c225(0x2df)][_0x79c225(0x1d7)]!==0x1?'s':''));for(const _0x148ae7 of _0x5dea7f[_0x79c225(0x2df)]){console['error'](_0x79c225(0x1f8)+_0x148ae7[_0x79c225(0x1ae)]);}}}function showParentSegmentNotSetError(_0x35d67d){const _0x389efd=a26_0x3e1dba;console[_0x389efd(0x269)](a26_0x4d135b[_0x389efd(0x1f9)](_0x389efd(0x2ca))),console[_0x389efd(0x269)](_0x35d67d);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x23c);['description']=a26_0x3e1dba(0x256);async[a26_0x3e1dba(0x280)](_0x1e3aa9){const _0x103fc6=a26_0x3e1dba,{options:_0x23f71a,args:_0x2040fe,tdx:_0x39c4a3}=_0x1e3aa9,_0x53b499=_0x2040fe[0x0];_0x23f71a[_0x103fc6(0x173)]&&(console[_0x103fc6(0x269)](_0x103fc6(0x26a)+_0x23f71a[_0x103fc6(0x1c2)]),_0x53b499&&console[_0x103fc6(0x269)](_0x103fc6(0x2dd)+_0x53b499));const _0x4732d5=await withSpinner(_0x53b499?_0x103fc6(0x229)+_0x53b499+_0x103fc6(0x1e0):_0x103fc6(0x274),()=>_0x39c4a3[_0x103fc6(0x1eb)][_0x103fc6(0x1b5)](),{'verbose':_0x23f71a[_0x103fc6(0x173)]});let _0x333ad6=_0x4732d5['data'];if(_0x53b499){const _0x1c2c93=_0x53b499[_0x103fc6(0x27f)](/[.+^${}()|[\]\\]/g,_0x103fc6(0x2f6))['replace'](/\*/g,'.*')[_0x103fc6(0x27f)](/\?/g,'.'),_0x3a4672=new RegExp('^'+_0x1c2c93+'$','i');_0x333ad6=_0x333ad6[_0x103fc6(0x292)](_0x5ad211=>_0x3a4672['test'](_0x5ad211[_0x103fc6(0x28c)][_0x103fc6(0x1ae)]));}_0x333ad6[_0x103fc6(0x2ff)]((_0x549002,_0x3da814)=>_0x549002[_0x103fc6(0x28c)][_0x103fc6(0x1ae)][_0x103fc6(0x299)](_0x3da814[_0x103fc6(0x28c)][_0x103fc6(0x1ae)])),console['error'](_0x103fc6(0x2b9)+_0x333ad6[_0x103fc6(0x1d7)]+_0x103fc6(0x202)+(_0x333ad6[_0x103fc6(0x1d7)]!==0x1?'s':''));const _0x41174a=_0x395a74=>{const _0x464e42=_0x103fc6;return getConsoleNextUrl(_0x23f71a[_0x464e42(0x1c2)],_0x464e42(0x2ed)+_0x395a74);};if(_0x23f71a[_0x103fc6(0x1d3)]==='json'||_0x23f71a[_0x103fc6(0x1d3)]===_0x103fc6(0x2aa)){const _0xd371f5=_0x333ad6[_0x103fc6(0x235)](_0x2e2a0f=>({..._0x2e2a0f,'url':_0x41174a(_0x2e2a0f['id'])}));await handleSDKOutput(_0xd371f5,_0x23f71a);}else{if(_0x333ad6['length']===0x0)_0x53b499?console[_0x103fc6(0x26e)](_0x103fc6(0x1d8)+_0x53b499):console[_0x103fc6(0x26e)](_0x103fc6(0x1c5));else for(const _0x21c13a of _0x333ad6){const _0x2bb0ac=_0x21c13a['attributes'][_0x103fc6(0x1f0)]?a26_0x4d135b[_0x103fc6(0x1bd)]('\x20('+formatRows(_0x21c13a[_0x103fc6(0x28c)][_0x103fc6(0x1f0)])+')'):'',_0x2a92da=hyperlink(_0x21c13a['attributes'][_0x103fc6(0x1ae)],_0x41174a(_0x21c13a['id']));console[_0x103fc6(0x26e)](_0x103fc6(0x2c0)+_0x2a92da+_0x2bb0ac);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x26f);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x1b7);async[a26_0x3e1dba(0x280)](_0x1cc63f){const _0x4d2a51=a26_0x3e1dba,{options:_0x186557,args:_0x562332,tdx:_0x2b9a76}=_0x1cc63f;console[_0x4d2a51(0x269)](_0x4d2a51(0x290)+_0x4d2a51(0x24e)+_0x4d2a51(0x2f8));const _0x49db19=_0x186557;if(_0x562332[_0x4d2a51(0x1d7)]===0x0)return console[_0x4d2a51(0x269)](a26_0x4d135b[_0x4d2a51(0x237)](_0x4d2a51(0x1e2))),console['error'](_0x4d2a51(0x214)),0x1;const _0x8aeefb=_0x562332[0x0];if(!_0x49db19[_0x4d2a51(0x1f2)]||!_0x49db19[_0x4d2a51(0x2f1)])return console[_0x4d2a51(0x269)](_0x4d2a51(0x227)),console['error'](_0x4d2a51(0x214)),0x1;_0x49db19[_0x4d2a51(0x173)]&&(console['error'](_0x4d2a51(0x26a)+_0x49db19[_0x4d2a51(0x1c2)]),console[_0x4d2a51(0x269)](_0x4d2a51(0x1f6)+_0x8aeefb),console[_0x4d2a51(0x269)]('Database:\x20'+_0x49db19[_0x4d2a51(0x1f2)]),console[_0x4d2a51(0x269)](_0x4d2a51(0x25c)+_0x49db19['table']));const _0xacfb3d=await loadJSONFromOptions(_0x49db19['attributes'],_0x49db19[_0x4d2a51(0x1b0)]),_0x4aaeb2=await loadJSONFromOptions(_0x49db19[_0x4d2a51(0x1b4)],_0x49db19[_0x4d2a51(0x294)]),_0x3eb1b2=await loadJSONFromOptions(_0x49db19[_0x4d2a51(0x1ec)],_0x49db19[_0x4d2a51(0x20d)]),_0x40ecbe={'name':_0x8aeefb,'description':_0x49db19['description'],'scheduleType':_0x49db19[_0x4d2a51(0x2ab)],'scheduleOption':_0x49db19[_0x4d2a51(0x2b6)],'timezone':_0x49db19[_0x4d2a51(0x178)],'master':{'parentDatabaseName':_0x49db19[_0x4d2a51(0x1f2)],'parentTableName':_0x49db19['table']},'attributes':_0xacfb3d,'behaviors':_0x4aaeb2,'customerGroup':_0x3eb1b2},_0x4900ec=await withSpinner(_0x4d2a51(0x1fb)+_0x8aeefb+_0x4d2a51(0x1e0),()=>_0x2b9a76[_0x4d2a51(0x1eb)][_0x4d2a51(0x278)](_0x40ecbe),{'verbose':_0x186557[_0x4d2a51(0x173)]}),_0x5943d7=_0x4900ec[_0x4d2a51(0x1ea)];return console[_0x4d2a51(0x269)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x5943d7['name']+'\x27\x20with\x20ID:\x20'+_0x5943d7['id']),await handleSDKOutput([_0x5943d7],_0x186557),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']='segment:parent:update';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x21d);async['execute'](_0x231654){const _0x36fef2=a26_0x3e1dba,{options:_0x33ecac,args:_0x19df17,tdx:_0x39bcd7}=_0x231654;console[_0x36fef2(0x269)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x36fef2(0x24e)+_0x36fef2(0x2f8));const _0x194b61=_0x33ecac;if(_0x19df17[_0x36fef2(0x1d7)]===0x0)return console[_0x36fef2(0x269)](a26_0x4d135b['red'](_0x36fef2(0x1e2))),console[_0x36fef2(0x269)](_0x36fef2(0x250)),0x1;const _0x2a3c40=_0x19df17[0x0];_0x194b61[_0x36fef2(0x173)]&&(console[_0x36fef2(0x269)](_0x36fef2(0x26a)+_0x194b61[_0x36fef2(0x1c2)]),console[_0x36fef2(0x269)](_0x36fef2(0x264)+_0x2a3c40));const _0x398981=await withSpinner(_0x36fef2(0x263)+_0x2a3c40+_0x36fef2(0x1e0),()=>_0x39bcd7[_0x36fef2(0x1eb)][_0x36fef2(0x193)](_0x2a3c40),{'verbose':_0x194b61[_0x36fef2(0x173)]}),_0x12b54e=_0x398981['data'],_0x2c1fb4=await loadJSONFromOptions(_0x194b61[_0x36fef2(0x213)],_0x194b61[_0x36fef2(0x27d)]),_0x4bfabb=await loadJSONFromOptions(_0x194b61[_0x36fef2(0x2fb)],_0x194b61['addBehaviorsFile']),_0x312552={'name':_0x12b54e[_0x36fef2(0x1ae)],'description':_0x194b61[_0x36fef2(0x2e2)]!==undefined?_0x194b61['description']:_0x12b54e[_0x36fef2(0x2e2)],'scheduleType':_0x194b61[_0x36fef2(0x2ab)]!==undefined?_0x194b61[_0x36fef2(0x2ab)]:_0x12b54e[_0x36fef2(0x2ab)],'scheduleOption':_0x194b61[_0x36fef2(0x2b6)]!==undefined?_0x194b61['scheduleOption']:_0x12b54e[_0x36fef2(0x2b6)],'timezone':_0x194b61[_0x36fef2(0x178)]!==undefined?_0x194b61['timezone']:_0x12b54e[_0x36fef2(0x178)],'master':_0x12b54e[_0x36fef2(0x1ad)],'attributes':_0x2c1fb4?[..._0x12b54e[_0x36fef2(0x28c)]||[],..._0x2c1fb4]:_0x12b54e[_0x36fef2(0x28c)],'behaviors':_0x4bfabb?[..._0x12b54e[_0x36fef2(0x1b4)]||[],..._0x4bfabb]:_0x12b54e[_0x36fef2(0x1b4)],'customerGroup':_0x12b54e[_0x36fef2(0x1ec)]},_0x5bb416=await withSpinner(_0x36fef2(0x1a4)+_0x2a3c40+_0x36fef2(0x1e0),()=>_0x39bcd7[_0x36fef2(0x1eb)][_0x36fef2(0x29b)](_0x2a3c40,_0x312552),{'verbose':_0x194b61[_0x36fef2(0x173)]}),_0x2b6e0a=_0x5bb416['data'];return console[_0x36fef2(0x269)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x2b6e0a['name']+'\x27'),await handleSDKOutput([_0x2b6e0a],_0x194b61),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x2b1);[a26_0x3e1dba(0x2e2)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a26_0x3e1dba(0x280)](_0x470a2c){const _0x2464b8=a26_0x3e1dba,{options:_0x5aa22e,args:_0x186f68,tdx:_0x5bd157}=_0x470a2c,_0x28e1cb=_0x5aa22e,_0x50e5e4=_0x186f68[0x0]||_0x5aa22e[_0x2464b8(0x268)];if(!_0x50e5e4)return showParentSegmentNotSetError(_0x2464b8(0x211)+_0x2464b8(0x24d)),0x1;if(_0x28e1cb[_0x2464b8(0x2e3)]&&_0x28e1cb[_0x2464b8(0x1e5)])return console['error'](a26_0x4d135b[_0x2464b8(0x237)](_0x2464b8(0x1d4))),console['error'](a26_0x4d135b['dim'](_0x2464b8(0x184))),console['error'](a26_0x4d135b[_0x2464b8(0x1bd)](_0x2464b8(0x29e)+PARENT_SEGMENT_DIR+_0x2464b8(0x1a1))),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x2e6)](_0x2464b8(0x27e))),0x1;const _0x210717=_0x28e1cb['output']||a26_0x151967[_0x2464b8(0x189)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x50e5e4)+_0x2464b8(0x304));_0x28e1cb[_0x2464b8(0x173)]&&(console[_0x2464b8(0x269)](_0x2464b8(0x26a)+_0x28e1cb[_0x2464b8(0x1c2)]),console['error'](_0x2464b8(0x264)+_0x50e5e4),console[_0x2464b8(0x269)](_0x2464b8(0x1b3)+_0x210717));const _0x52db54=await withSpinner(_0x2464b8(0x220)+_0x50e5e4+_0x2464b8(0x1e0),()=>_0x5bd157[_0x2464b8(0x1eb)][_0x2464b8(0x29d)](_0x50e5e4),{'verbose':_0x28e1cb[_0x2464b8(0x173)]}),_0x22066b=_0x52db54[_0x2464b8(0x1ea)];if(existsSync(_0x210717)){const _0xddc9a5=readFileSync(_0x210717,'utf-8'),_0x198727=generateDiff(_0xddc9a5,_0x22066b);if(!hasChanges(_0x198727))console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+_0x2464b8(0x1c7)+a26_0x4d135b['cyan'](_0x210717)+_0x2464b8(0x2a5));else{console[_0x2464b8(0x269)]('\x0aChanges\x20to\x20\x27'+_0x210717+'\x27:'),console[_0x2464b8(0x269)]('─'['repeat'](0x3c)),console[_0x2464b8(0x269)](formatDiffWithColors(_0x198727)),console[_0x2464b8(0x269)]('─'[_0x2464b8(0x2e1)](0x3c));if(!_0x28e1cb[_0x2464b8(0x1c3)]){if(!isInteractive())return console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x237)](_0x2464b8(0x2b2)),_0x2464b8(0x2e8)),console[_0x2464b8(0x269)](a26_0x4d135b['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x247ad2=await confirmKey(_0x2464b8(0x2cf)+_0x210717+'\x27?');if(!_0x247ad2)return console[_0x2464b8(0x269)](a26_0x4d135b['yellow']('Aborted.')),0x1;}writeFileSync(_0x210717,_0x22066b,_0x2464b8(0x2ec)),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+_0x2464b8(0x1cf)+a26_0x4d135b['cyan'](_0x210717));}}else{const _0x123dd8=a26_0x151967[_0x2464b8(0x1a6)](_0x210717);!existsSync(_0x123dd8)&&mkdirSync(_0x123dd8,{'recursive':!![]}),writeFileSync(_0x210717,_0x22066b,_0x2464b8(0x2ec)),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x4d135b[_0x2464b8(0x2e6)](_0x210717));}return saveSessionContext({'parent_segment':_0x50e5e4},_0x28e1cb[_0x2464b8(0x24a)]),console[_0x2464b8(0x269)](a26_0x4d135b[_0x2464b8(0x1b9)]('✔')+_0x2464b8(0x254)+a26_0x4d135b[_0x2464b8(0x1bd)](_0x2464b8(0x249))+_0x2464b8(0x2c6)+a26_0x4d135b[_0x2464b8(0x2e6)](_0x50e5e4)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x230);[a26_0x3e1dba(0x2e2)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x3e1dba(0x280)](_0x21db49){const _0x2aebaf=a26_0x3e1dba,{options:_0x37fad4,args:_0x145ac3,tdx:_0xabb668}=_0x21db49,_0x35891a=_0x37fad4,_0x21ae78=_0x145ac3[0x0]||_0x37fad4[_0x2aebaf(0x268)];if(!_0x21ae78)return showParentSegmentNotSetError(_0x2aebaf(0x244)+_0x2aebaf(0x2fc)),0x1;const _0x2e903e=resolveYamlFile(_0x21ae78);if(!existsSync(_0x2e903e))return showFileNotFoundError(_0x2e903e,_0x21ae78),0x1;_0x35891a[_0x2aebaf(0x173)]&&(console['error'](_0x2aebaf(0x26a)+_0x35891a[_0x2aebaf(0x1c2)]),console[_0x2aebaf(0x269)](_0x2aebaf(0x2be)+_0x2e903e));let _0x1278da;try{_0x1278da=readFileSync(_0x2e903e,_0x2aebaf(0x2ec));}catch(_0x28ae3f){const _0x5ae95b=_0x28ae3f instanceof Error?_0x28ae3f[_0x2aebaf(0x1c9)]:String(_0x28ae3f);return console[_0x2aebaf(0x269)](_0x2aebaf(0x2d8)+_0x5ae95b),0x1;}const _0x5abd6f=await withSpinner(_0x2aebaf(0x260),()=>_0xabb668[_0x2aebaf(0x1eb)]['pushParentYaml'](_0x1278da),{'verbose':_0x35891a['verbose']}),_0x130c85=_0x5abd6f['data'],{isNew:_0x5ca9d7,name:_0x108a07,hasChanges:_0x407fbb,diffFormatted:_0x3d7bff}=_0x130c85;if(!_0x407fbb)return console[_0x2aebaf(0x269)](_0x2aebaf(0x282)+_0x108a07+_0x2aebaf(0x1f4)),0x0;_0x5ca9d7?console[_0x2aebaf(0x269)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x108a07+'\x27:'):console[_0x2aebaf(0x269)](_0x2aebaf(0x18d)+_0x108a07+'\x27:');console[_0x2aebaf(0x269)]('─'[_0x2aebaf(0x2e1)](0x3c)),console['error'](_0x3d7bff),console[_0x2aebaf(0x269)]('─'['repeat'](0x3c));const _0x2ca3fd=_0x5ca9d7?_0x2aebaf(0x1b8)+_0x108a07+'\x27?':_0x2aebaf(0x2e7)+_0x108a07+'\x27?';if(!_0x35891a[_0x2aebaf(0x1c3)]){if(!isInteractive())return console[_0x2aebaf(0x269)](a26_0x4d135b[_0x2aebaf(0x237)](_0x2aebaf(0x2b2)),_0x2aebaf(0x2e8)),console[_0x2aebaf(0x269)](a26_0x4d135b[_0x2aebaf(0x1bd)](_0x2aebaf(0x17f))),0x1;const _0x525974=await confirmKey(_0x2ca3fd);if(!_0x525974)return console[_0x2aebaf(0x269)](a26_0x4d135b['yellow'](_0x2aebaf(0x224))),0x1;}const _0x3e87f1=_0x5ca9d7?_0x2aebaf(0x1de):_0x2aebaf(0x198),_0x224dcc=await withSpinner(_0x3e87f1+_0x2aebaf(0x1c4)+_0x108a07+_0x2aebaf(0x1e0),()=>_0x130c85[_0x2aebaf(0x2cc)](),{'verbose':_0x35891a[_0x2aebaf(0x173)]}),_0x32a154=_0x224dcc['data'],_0x515f60=getConsoleNextUrl(_0x35891a['site'],'/app/dw/parentSegments/'+_0x32a154['id']),_0x254d1=_0x5ca9d7?'Created':'Updated';return console[_0x2aebaf(0x269)]('✔\x20'+_0x254d1+_0x2aebaf(0x1c4)+_0x32a154[_0x2aebaf(0x1ae)]+'\x27'),console[_0x2aebaf(0x269)]('\x20\x20'+_0x515f60),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']='segment:parent:validate';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x18e);async['execute'](_0x1ed134){const _0x37a77f=a26_0x3e1dba,{options:_0x4306fd,args:_0x108944,tdx:_0x5980f4}=_0x1ed134,_0x385868=_0x4306fd,_0x29b44d=_0x108944[0x0]||_0x4306fd['parentSegment'];if(!_0x29b44d)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x37a77f(0x2b3)+_0x37a77f(0x175)+_0x37a77f(0x28e)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0xc0409=resolveYamlFile(_0x29b44d);if(!existsSync(_0xc0409))return showFileNotFoundError(_0xc0409,_0x29b44d),0x1;_0x385868[_0x37a77f(0x173)]&&(console['error'](_0x37a77f(0x26a)+_0x385868[_0x37a77f(0x1c2)]),console[_0x37a77f(0x269)](_0x37a77f(0x2be)+_0xc0409));let _0x2e4492;try{_0x2e4492=readFileSync(_0xc0409,_0x37a77f(0x2ec));}catch(_0x1484dd){const _0x41786e=_0x1484dd instanceof Error?_0x1484dd[_0x37a77f(0x1c9)]:String(_0x1484dd);return console[_0x37a77f(0x269)](_0x37a77f(0x2d8)+_0x41786e),0x1;}const _0x1584f0=createCommandSpinner(a26_0x4d135b[_0x37a77f(0x1bd)](_0x37a77f(0x195)),{'verbose':_0x385868[_0x37a77f(0x173)]});_0x1584f0[_0x37a77f(0x1e7)]();const _0xae4255={'onProgress':_0x450bc3=>{const _0xa8c910=_0x37a77f;_0x1584f0[_0xa8c910(0x2bb)]=formatProgressMessage(_0x450bc3);}};if(_0x385868['master'])_0xae4255[_0x37a77f(0x1ad)]=!![];if(_0x385868[_0x37a77f(0x20a)])_0xae4255['enriched']=!![];_0x385868[_0x37a77f(0x22f)]&&(_0xae4255[_0x37a77f(0x22f)]=_0x385868[_0x37a77f(0x22f)]);_0x385868[_0x37a77f(0x2d4)]&&(_0xae4255[_0x37a77f(0x2d4)]=_0x385868[_0x37a77f(0x2d4)]);if(_0x385868[_0x37a77f(0x2e5)])_0xae4255[_0x37a77f(0x2e5)]=_0x385868['interval'];let _0x4bae6c;try{_0x4bae6c=await _0x5980f4[_0x37a77f(0x1eb)][_0x37a77f(0x1cb)](_0x2e4492,_0xae4255),_0x1584f0[_0x37a77f(0x225)]();}catch(_0x3941de){_0x1584f0[_0x37a77f(0x225)]();throw _0x3941de;}const _0x55d3fa=_0x385868[_0x37a77f(0x2e5)]||'-1d';return this[_0x37a77f(0x1bf)](_0x4bae6c,_0xae4255,_0xc0409,_0x55d3fa),_0x4bae6c['allValid']?0x0:0x1;}[a26_0x3e1dba(0x1bf)](_0x209e81,_0x4c0c4b,_0x35347f,_0x340ebb){const _0x2311ab=a26_0x3e1dba;console['error']('\x0a'+a26_0x4d135b[_0x2311ab(0x270)](_0x2311ab(0x306))+'\x20'+_0x209e81[_0x2311ab(0x1ae)]),console[_0x2311ab(0x269)]('═'[_0x2311ab(0x2e1)](0x3c)),this[_0x2311ab(0x2a7)](_0x209e81);if(typeof _0x4c0c4b[_0x2311ab(0x22f)]===_0x2311ab(0x1bb)){this[_0x2311ab(0x2bf)](_0x209e81),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,'attribute',_0x4c0c4b[_0x2311ab(0x22f)]);return;}if(_0x4c0c4b['attribute']===!![]){this[_0x2311ab(0x2bf)](_0x209e81),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,_0x2311ab(0x28c));return;}if(typeof _0x4c0c4b[_0x2311ab(0x2d4)]===_0x2311ab(0x1bb)){this['displayBehaviorsStats'](_0x209e81,_0x340ebb),this[_0x2311ab(0x2cd)](_0x209e81),this['displayPreviewHints'](_0x35347f,_0x340ebb,'behavior',_0x4c0c4b[_0x2311ab(0x2d4)]);return;}if(_0x4c0c4b[_0x2311ab(0x2d4)]===!![]){this['displayBehaviorsStats'](_0x209e81,_0x340ebb),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,_0x2311ab(0x1b4));return;}this[_0x2311ab(0x2bf)](_0x209e81),this['displayBehaviorsStats'](_0x209e81,_0x340ebb),this[_0x2311ab(0x221)](_0x209e81),this[_0x2311ab(0x2cd)](_0x209e81),this[_0x2311ab(0x177)](_0x35347f,_0x340ebb,_0x2311ab(0x1aa));}[a26_0x3e1dba(0x221)](_0x35e295){displayRealtimeValidation(_0x35e295);}[a26_0x3e1dba(0x177)](_0x2c15dc,_0x41d1d2,_0x24cdeb,_0x2edbae){const _0x29c164=a26_0x3e1dba;console['error']('\x0a'+a26_0x4d135b[_0x29c164(0x1bd)](_0x29c164(0x303)));const _0x54c7fc=_0x41d1d2!==_0x29c164(0x1a9)?'\x20--interval\x20'+_0x41d1d2:'';if(_0x24cdeb==='attribute'&&_0x2edbae)console['error']('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)]('tdx\x20ps\x20preview\x20'+_0x2c15dc+_0x29c164(0x1ee)+_0x2edbae+'\x22'+_0x54c7fc));else{if(_0x24cdeb===_0x29c164(0x2d4)&&_0x2edbae)console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)](_0x29c164(0x1f3)+_0x2c15dc+_0x29c164(0x1a2)+_0x2edbae+'\x22'+_0x54c7fc));else(_0x24cdeb===_0x29c164(0x28c)||_0x24cdeb===_0x29c164(0x1aa))&&console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b['dim'](_0x29c164(0x1f3)+_0x2c15dc+_0x29c164(0x23d)+_0x54c7fc));}(_0x24cdeb==='behaviors'||_0x24cdeb===_0x29c164(0x1aa))&&console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)](_0x29c164(0x1f3)+_0x2c15dc+_0x29c164(0x27c)+_0x54c7fc)),_0x24cdeb===_0x29c164(0x1aa)&&console[_0x29c164(0x269)]('\x20\x20'+a26_0x4d135b[_0x29c164(0x1bd)]('tdx\x20ps\x20preview\x20'+_0x2c15dc+_0x29c164(0x22b)+_0x54c7fc));}[a26_0x3e1dba(0x2a7)](_0x496ac6){const _0x13b5cf=a26_0x3e1dba,{master:_0x57cd42}=_0x496ac6,_0x28a31b=_0x57cd42[_0x13b5cf(0x2c7)]?a26_0x4d135b[_0x13b5cf(0x1b9)]('✔'):a26_0x4d135b[_0x13b5cf(0x237)]('✘');console['error']('\x0a'+a26_0x4d135b[_0x13b5cf(0x1bd)](_0x13b5cf(0x2fe))),console[_0x13b5cf(0x269)](_0x28a31b+'\x20'+a26_0x4d135b['bold'](_0x57cd42[_0x13b5cf(0x1f2)]+'.'+_0x57cd42['table'])),_0x57cd42[_0x13b5cf(0x2c7)]?_0x57cd42[_0x13b5cf(0x200)]!==undefined&&console[_0x13b5cf(0x269)]('\x20\x20'+a26_0x4d135b[_0x13b5cf(0x1bd)](_0x13b5cf(0x28d))+'\x20'+a26_0x4d135b[_0x13b5cf(0x2e6)](formatRows(_0x57cd42['rowCount']))):console[_0x13b5cf(0x269)]('\x20\x20'+a26_0x4d135b['red'](_0x13b5cf(0x1a8))+'\x20'+_0x57cd42[_0x13b5cf(0x174)]);}[a26_0x3e1dba(0x2bf)](_0x57d981){const _0x57d719=a26_0x3e1dba;if(_0x57d981[_0x57d719(0x28c)][_0x57d719(0x1d7)]===0x0)return;console[_0x57d719(0x269)]('\x0a'+a26_0x4d135b['dim'](_0x57d719(0x18f)));for(const _0x3aa996 of _0x57d981[_0x57d719(0x28c)]){const _0x21ecf1=_0x3aa996[_0x57d719(0x2c7)]?a26_0x4d135b[_0x57d719(0x1b9)]('✔'):a26_0x4d135b[_0x57d719(0x237)]('✘');let _0x3d113d='';if(_0x3aa996[_0x57d719(0x2c7)]&&_0x3aa996[_0x57d719(0x2c3)]!==undefined&&_0x3aa996[_0x57d719(0x258)]!==undefined){const _0x47796c=_0x3aa996[_0x57d719(0x258)][_0x57d719(0x1bc)](0x1),_0x122532=_0x3aa996[_0x57d719(0x258)]>=0x50?a26_0x4d135b[_0x57d719(0x1b9)]:_0x3aa996[_0x57d719(0x258)]>=0x32?a26_0x4d135b['yellow']:a26_0x4d135b['red'];_0x3d113d='\x20'+a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x1ef))+'\x20'+_0x122532(_0x47796c+'%')+'\x20('+formatRows(_0x3aa996['matchedCount'])+_0x57d719(0x2b8);}console[_0x57d719(0x269)](_0x21ecf1+'\x20'+a26_0x4d135b[_0x57d719(0x270)](_0x3aa996[_0x57d719(0x1ae)])+_0x3d113d),console[_0x57d719(0x269)]('\x20\x20'+a26_0x4d135b['dim'](_0x57d719(0x1d6))+'\x20'+a26_0x4d135b[_0x57d719(0x270)](_0x3aa996[_0x57d719(0x1f2)]+'.'+_0x3aa996[_0x57d719(0x2f1)]));const _0x15af0c=_0x3aa996['joinKey']===_0x3aa996[_0x57d719(0x1c6)]?a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x261))+'\x20'+_0x3aa996[_0x57d719(0x196)]:a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x2a1))+'\x20'+_0x3aa996[_0x57d719(0x196)]+'\x20=\x20'+_0x3aa996[_0x57d719(0x1c6)];console[_0x57d719(0x269)]('\x20\x20'+_0x15af0c),console[_0x57d719(0x269)]('\x20\x20'+a26_0x4d135b[_0x57d719(0x1bd)](_0x57d719(0x247))),this[_0x57d719(0x19d)](_0x3aa996[_0x57d719(0x201)]),!_0x3aa996['schemaValid']&&console[_0x57d719(0x269)]('\x20\x20'+a26_0x4d135b[_0x57d719(0x237)](_0x57d719(0x1a8))+'\x20'+_0x3aa996[_0x57d719(0x174)]);}}[a26_0x3e1dba(0x183)](_0x223435,_0x46078f){const _0x548d30=a26_0x3e1dba;if(_0x223435[_0x548d30(0x1b4)][_0x548d30(0x1d7)]===0x0)return;console[_0x548d30(0x269)]('\x0a'+a26_0x4d135b['dim'](_0x548d30(0x2ee))+'\x20'+a26_0x4d135b['dim']('('+_0x46078f+')'));for(const _0x331033 of _0x223435[_0x548d30(0x1b4)]){const _0x241b8a=_0x331033[_0x548d30(0x2c7)]?a26_0x4d135b[_0x548d30(0x1b9)]('✔'):a26_0x4d135b['red']('✘');let _0x17ce1b='';if(_0x331033[_0x548d30(0x2c7)]&&_0x331033[_0x548d30(0x23b)]!==undefined&&_0x331033[_0x548d30(0x259)]!==undefined){const _0x1a9f31=_0x331033['customerPercent']?.[_0x548d30(0x1bc)](0x1)||'?',_0x434574=(_0x331033[_0x548d30(0x2ef)]??0x0)>=0x32?a26_0x4d135b['green']:(_0x331033[_0x548d30(0x2ef)]??0x0)>=0x14?a26_0x4d135b[_0x548d30(0x1f9)]:a26_0x4d135b['red'];_0x17ce1b='\x20'+a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x2c9))+'\x20'+_0x434574(formatRows(_0x331033[_0x548d30(0x23b)]))+'\x20('+_0x1a9f31+_0x548d30(0x1d9)+a26_0x4d135b['dim'](_0x548d30(0x2bc))+'\x20'+a26_0x4d135b['cyan'](formatRows(_0x331033['totalEvents']));}console[_0x548d30(0x269)](_0x241b8a+'\x20'+a26_0x4d135b[_0x548d30(0x270)](_0x331033[_0x548d30(0x1ae)])+_0x17ce1b),console[_0x548d30(0x269)]('\x20\x20'+a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x1d6))+'\x20'+a26_0x4d135b[_0x548d30(0x270)](_0x331033[_0x548d30(0x1f2)]+'.'+_0x331033[_0x548d30(0x2f1)]));const _0xf6983=_0x331033[_0x548d30(0x196)]===_0x331033[_0x548d30(0x1c6)]?a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x261))+'\x20'+_0x331033[_0x548d30(0x196)]:a26_0x4d135b['dim']('Join:')+'\x20'+_0x331033[_0x548d30(0x196)]+_0x548d30(0x2c6)+_0x331033[_0x548d30(0x1c6)];console[_0x548d30(0x269)]('\x20\x20'+_0xf6983),console[_0x548d30(0x269)]('\x20\x20'+a26_0x4d135b[_0x548d30(0x1bd)](_0x548d30(0x247))),this[_0x548d30(0x19d)](_0x331033[_0x548d30(0x201)]),!_0x331033[_0x548d30(0x2c7)]&&console[_0x548d30(0x269)]('\x20\x20'+a26_0x4d135b[_0x548d30(0x237)](_0x548d30(0x1a8))+'\x20'+_0x331033[_0x548d30(0x174)]);}}[a26_0x3e1dba(0x19d)](_0x5e34b8){const _0x3a7bcd=a26_0x3e1dba;for(const _0x33e37e of _0x5e34b8){_0x33e37e['label']===_0x33e37e[_0x3a7bcd(0x2b0)]||_0x33e37e[_0x3a7bcd(0x2b0)]==='*'?console[_0x3a7bcd(0x269)](_0x3a7bcd(0x1f8)+_0x33e37e[_0x3a7bcd(0x2c2)]):console[_0x3a7bcd(0x269)](_0x3a7bcd(0x1f8)+_0x33e37e[_0x3a7bcd(0x2c2)]+'\x20'+a26_0x4d135b[_0x3a7bcd(0x1bd)]('('+_0x33e37e[_0x3a7bcd(0x2b0)]+')'));}}[a26_0x3e1dba(0x2cd)](_0x4e50cb){const _0x4a27a7=a26_0x3e1dba;console['error']('─'[_0x4a27a7(0x2e1)](0x3c));if(_0x4e50cb[_0x4a27a7(0x1cc)][_0x4a27a7(0x1d7)]>0x0){console[_0x4a27a7(0x269)]('\x0a'+a26_0x4d135b[_0x4a27a7(0x237)](_0x4a27a7(0x275)));for(const _0x52a1e1 of _0x4e50cb[_0x4a27a7(0x1cc)]){console[_0x4a27a7(0x269)]('\x20\x20'+a26_0x4d135b[_0x4a27a7(0x237)]('•')+'\x20'+_0x52a1e1);}}_0x4e50cb[_0x4a27a7(0x2e9)]&&console[_0x4a27a7(0x269)]('\x0a'+a26_0x4d135b[_0x4a27a7(0x1b9)]('✔')+_0x4a27a7(0x18b));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x2d6);[a26_0x3e1dba(0x2e2)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0x1fcd5c){const _0x3b4223=a26_0x3e1dba,{options:_0x17c226,args:_0x2cd8f1,tdx:_0x58c271}=_0x1fcd5c,_0xaeca30=_0x17c226,_0x166223=_0x2cd8f1[0x0]||_0x17c226[_0x3b4223(0x268)];if(!_0x166223)return showParentSegmentNotSetError(_0x3b4223(0x1ab)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x3b4223(0x2f7)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x3b4223(0x180)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x3b4223(0x25d)),0x1;if(!_0xaeca30[_0x3b4223(0x1ad)]&&!_0xaeca30[_0x3b4223(0x22f)]&&!_0xaeca30[_0x3b4223(0x2d4)]&&!_0xaeca30[_0x3b4223(0x20a)])return console['error'](a26_0x4d135b[_0x3b4223(0x237)](_0x3b4223(0x2f9))),console[_0x3b4223(0x269)](_0x3b4223(0x267)),console[_0x3b4223(0x269)]('Options:'),console[_0x3b4223(0x269)](_0x3b4223(0x19f)),console['error'](_0x3b4223(0x182)),console[_0x3b4223(0x269)](_0x3b4223(0x2a4)),console[_0x3b4223(0x269)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x3fe59d=resolveYamlFile(_0x166223);if(!existsSync(_0x3fe59d))return showFileNotFoundError(_0x3fe59d,_0x166223),0x1;_0xaeca30[_0x3b4223(0x173)]&&(console[_0x3b4223(0x269)](_0x3b4223(0x26a)+_0xaeca30[_0x3b4223(0x1c2)]),console[_0x3b4223(0x269)](_0x3b4223(0x2be)+_0x3fe59d));let _0x2ea1fe;try{_0x2ea1fe=readFileSync(_0x3fe59d,'utf-8');}catch(_0x4a1976){const _0x31ebf8=_0x4a1976 instanceof Error?_0x4a1976[_0x3b4223(0x1c9)]:String(_0x4a1976);return console[_0x3b4223(0x269)]('Error\x20reading\x20file:\x20'+_0x31ebf8),0x1;}let _0x257995;try{_0x257995=parseDef(_0x2ea1fe);}catch(_0x287635){const _0x520e44=_0x287635 instanceof Error?_0x287635[_0x3b4223(0x1c9)]:String(_0x287635);return console[_0x3b4223(0x269)](a26_0x4d135b[_0x3b4223(0x237)]('Error\x20parsing\x20YAML:\x20'+_0x520e44)),0x1;}if(_0xaeca30[_0x3b4223(0x22f)]===!![]||_0xaeca30[_0x3b4223(0x22f)]===''){const _0x71427e=_0x257995[_0x3b4223(0x28c)]?.[_0x3b4223(0x235)](_0x3b7597=>_0x3b7597['name'])||[];if(_0x71427e[_0x3b4223(0x1d7)]===0x0)console['error'](a26_0x4d135b['red'](_0x3b4223(0x19e)));else{console[_0x3b4223(0x269)](a26_0x4d135b[_0x3b4223(0x237)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x3b4223(0x18c));for(const _0x2983c2 of _0x71427e){console[_0x3b4223(0x269)]('\x20\x20'+a26_0x4d135b[_0x3b4223(0x2e6)](_0x2983c2));}console[_0x3b4223(0x269)](_0x3b4223(0x23a)+_0x166223+'\x20--attribute\x20\x22'+_0x71427e[0x0]+'\x22');}return 0x1;}if(_0xaeca30[_0x3b4223(0x2d4)]===!![]||_0xaeca30[_0x3b4223(0x2d4)]===''){const _0x3cfd27=_0x257995['behaviors']?.[_0x3b4223(0x235)](_0x47026d=>_0x47026d[_0x3b4223(0x1ae)])||[];if(_0x3cfd27['length']===0x0)console['error'](a26_0x4d135b[_0x3b4223(0x237)](_0x3b4223(0x19b)));else{console[_0x3b4223(0x269)](a26_0x4d135b[_0x3b4223(0x237)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x3b4223(0x269)](_0x3b4223(0x28a));for(const _0x4aa98d of _0x3cfd27){console['error']('\x20\x20'+a26_0x4d135b[_0x3b4223(0x2e6)](_0x4aa98d));}console[_0x3b4223(0x269)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x166223+_0x3b4223(0x1a2)+_0x3cfd27[0x0]+'\x22');}return 0x1;}const _0x35fef2=createCommandSpinner(a26_0x4d135b['dim'](_0x3b4223(0x17c)),{'verbose':_0xaeca30[_0x3b4223(0x173)]});_0x35fef2[_0x3b4223(0x1e7)]();const _0x2c5eb2={'onProgress':_0x168eda=>{const _0x2d41e3=_0x3b4223;_0x35fef2[_0x2d41e3(0x2bb)]=formatProgressMessage(_0x168eda);}};if(_0xaeca30[_0x3b4223(0x1ad)])_0x2c5eb2['master']=!![];if(_0xaeca30[_0x3b4223(0x22f)]&&typeof _0xaeca30[_0x3b4223(0x22f)]===_0x3b4223(0x1bb))_0x2c5eb2['attribute']=_0xaeca30[_0x3b4223(0x22f)];if(_0xaeca30[_0x3b4223(0x2d4)]&&typeof _0xaeca30[_0x3b4223(0x2d4)]===_0x3b4223(0x1bb))_0x2c5eb2[_0x3b4223(0x2d4)]=_0xaeca30[_0x3b4223(0x2d4)];if(_0xaeca30['enriched'])_0x2c5eb2['enriched']=!![];if(_0xaeca30['interval'])_0x2c5eb2[_0x3b4223(0x2e5)]=_0xaeca30['interval'];let _0x278f90;try{_0x278f90=await _0x58c271[_0x3b4223(0x1eb)][_0x3b4223(0x20f)](_0x2ea1fe,_0x2c5eb2),_0x35fef2[_0x3b4223(0x225)]();}catch(_0x50493c){_0x35fef2[_0x3b4223(0x225)]();throw _0x50493c;}return await this[_0x3b4223(0x236)](_0x278f90,{'master':_0xaeca30[_0x3b4223(0x1ad)],'attribute':typeof _0xaeca30[_0x3b4223(0x22f)]==='string'?_0xaeca30[_0x3b4223(0x22f)]:undefined,'behavior':typeof _0xaeca30[_0x3b4223(0x2d4)]==='string'?_0xaeca30[_0x3b4223(0x2d4)]:undefined,'enriched':_0xaeca30[_0x3b4223(0x20a)]}),_0x278f90['allValid']?0x0:0x1;}async[a26_0x3e1dba(0x236)](_0x5189d8,_0x4fa508){const _0x59b86c=a26_0x3e1dba;console['error']('\x0a'+a26_0x4d135b['bold'](_0x59b86c(0x284))+'\x20'+_0x5189d8['name']),console[_0x59b86c(0x269)]('═'[_0x59b86c(0x2e1)](0x3c));if(_0x4fa508['master']&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x2ea278=a26_0x4d135b['dim'](_0x59b86c(0x252))+'\x20'+a26_0x4d135b[_0x59b86c(0x270)](_0x5189d8[_0x59b86c(0x1ad)][_0x59b86c(0x1f2)]+'.'+_0x5189d8['master'][_0x59b86c(0x2f1)]);await this[_0x59b86c(0x2a8)](_0x2ea278,_0x5189d8[_0x59b86c(0x1c1)]);}else{if(_0x4fa508['attribute']&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x46ee22=a26_0x4d135b[_0x59b86c(0x1bd)](_0x59b86c(0x203))+'\x20'+a26_0x4d135b['bold'](_0x4fa508['attribute']);await this[_0x59b86c(0x2a8)](_0x46ee22,_0x5189d8['sampleData']);}else{if(_0x4fa508[_0x59b86c(0x2d4)]&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x47a337=a26_0x4d135b[_0x59b86c(0x1bd)](_0x59b86c(0x231))+'\x20'+a26_0x4d135b[_0x59b86c(0x270)](_0x4fa508[_0x59b86c(0x2d4)]);await this[_0x59b86c(0x2a8)](_0x47a337,_0x5189d8[_0x59b86c(0x1c1)]);}else{if(_0x4fa508[_0x59b86c(0x20a)]&&_0x5189d8[_0x59b86c(0x1c1)]){const _0x244db9=a26_0x4d135b[_0x59b86c(0x1bd)]('Enriched:')+'\x20'+a26_0x4d135b[_0x59b86c(0x270)](_0x59b86c(0x25f));await this[_0x59b86c(0x2a8)](_0x244db9,_0x5189d8[_0x59b86c(0x1c1)]);}else!_0x5189d8[_0x59b86c(0x1c1)]&&console[_0x59b86c(0x269)](_0x59b86c(0x21e));}}}if(_0x5189d8[_0x59b86c(0x1cc)]['length']>0x0){console[_0x59b86c(0x269)]('─'[_0x59b86c(0x2e1)](0x3c)),console[_0x59b86c(0x269)]('\x0a'+a26_0x4d135b['red'](_0x59b86c(0x275)));for(const _0x167563 of _0x5189d8[_0x59b86c(0x1cc)]){console[_0x59b86c(0x269)]('\x20\x20'+a26_0x4d135b[_0x59b86c(0x237)]('•')+'\x20'+_0x167563);}}}async[a26_0x3e1dba(0x2a8)](_0x6fae60,_0x20a7b2){const _0x365bc8=a26_0x3e1dba;if(_0x20a7b2['length']===0x0){console['error']('\x0a'+_0x6fae60),console[_0x365bc8(0x269)](_0x365bc8(0x2b4));return;}console[_0x365bc8(0x269)]('\x0a'+_0x6fae60);const _0x5b5a3c=Object[_0x365bc8(0x1ce)](_0x20a7b2[0x0])[_0x365bc8(0x235)](_0x163317=>({'name':_0x163317,'type':typeof _0x20a7b2[0x0][_0x163317]==='number'?_0x365bc8(0x1e6):_0x365bc8(0x17a)})),_0x411752={'queryId':_0x365bc8(0x2af),'columns':_0x5b5a3c,'data':_0x20a7b2,'stats':{'state':_0x365bc8(0x2e4),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x20a7b2['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1428e7=formatAsTable(_0x411752,_0x20a7b2[_0x365bc8(0x1d7)],!![]);await writeOutput(_0x1428e7,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a26_0x3e1dba(0x287);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x279);async[a26_0x3e1dba(0x280)](_0x24ef76){const _0x97c0d8=a26_0x3e1dba,{options:_0xa69d68,args:_0x5131bf,tdx:_0xfd705e}=_0x24ef76,_0x3ac880=_0xa69d68,_0x27190e=_0x5131bf[0x0]||_0xa69d68['parentSegment'];if(!_0x27190e)return showParentSegmentNotSetError(_0x97c0d8(0x1e8)+_0x97c0d8(0x1d5)),0x1;const _0x30f428=resolveYamlFile(_0x27190e);if(existsSync(_0x30f428)){_0x3ac880[_0x97c0d8(0x173)]&&console[_0x97c0d8(0x269)](_0x97c0d8(0x29c)+_0x30f428);let _0x7d2cbb;try{_0x7d2cbb=readFileSync(_0x30f428,'utf-8');}catch(_0x261251){const _0x50acf1=_0x261251 instanceof Error?_0x261251[_0x97c0d8(0x1c9)]:String(_0x261251);return console[_0x97c0d8(0x269)]('Error\x20reading\x20file:\x20'+_0x50acf1),0x1;}const _0x4f971f=await withSpinner(_0x97c0d8(0x260),()=>_0xfd705e[_0x97c0d8(0x1eb)][_0x97c0d8(0x187)](_0x7d2cbb),{'verbose':_0x3ac880[_0x97c0d8(0x173)]}),_0x495cd1=_0x4f971f[_0x97c0d8(0x1ea)],{isNew:_0x38498a,name:_0x2cc166,hasChanges:_0x58cec3,diffFormatted:_0x38e538}=_0x495cd1;if(_0x58cec3){_0x38498a?console[_0x97c0d8(0x269)](_0x97c0d8(0x1fa)+_0x2cc166+'\x27:'):console[_0x97c0d8(0x269)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x2cc166+'\x27:');console['error']('─'[_0x97c0d8(0x2e1)](0x3c)),console[_0x97c0d8(0x269)](_0x38e538),console[_0x97c0d8(0x269)]('─'[_0x97c0d8(0x2e1)](0x3c));const _0x2109a6=_0x38498a?_0x97c0d8(0x1b8)+_0x2cc166+_0x97c0d8(0x17d):_0x97c0d8(0x2e7)+_0x2cc166+_0x97c0d8(0x17d);if(!_0x3ac880['yes']){if(!isInteractive())return console[_0x97c0d8(0x269)](a26_0x4d135b[_0x97c0d8(0x237)](_0x97c0d8(0x2b2)),_0x97c0d8(0x2e8)),console[_0x97c0d8(0x269)](a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x17f))),0x1;const _0x590089=await confirmKey(_0x2109a6);if(!_0x590089)return console[_0x97c0d8(0x269)](a26_0x4d135b[_0x97c0d8(0x1f9)]('Aborted.')),0x1;}const _0x3e1185=_0x38498a?_0x97c0d8(0x1de):_0x97c0d8(0x198);await withSpinner(_0x3e1185+_0x97c0d8(0x1c4)+_0x2cc166+_0x97c0d8(0x1e0),()=>_0x495cd1['apply'](),{'verbose':_0x3ac880[_0x97c0d8(0x173)]});const _0xa1c854=_0x38498a?_0x97c0d8(0x215):_0x97c0d8(0x26b);console[_0x97c0d8(0x269)]('✔\x20'+_0xa1c854+_0x97c0d8(0x1c4)+_0x2cc166+'\x27');}else console[_0x97c0d8(0x269)]('✔\x20No\x20changes\x20-\x20\x27'+_0x2cc166+_0x97c0d8(0x22e));}const _0x389e76=await withSpinner(_0x97c0d8(0x2de)+_0x27190e+_0x97c0d8(0x1e0),()=>_0xfd705e[_0x97c0d8(0x1eb)][_0x97c0d8(0x205)](_0x27190e),{'verbose':_0x3ac880['verbose']}),_0x4c5594=_0x389e76[_0x97c0d8(0x1ea)],_0x120499=getConsoleUrl(_0x3ac880[_0x97c0d8(0x1c2)],_0x97c0d8(0x190)+_0x4c5594['workflowId']+_0x97c0d8(0x24c)+_0x4c5594[_0x97c0d8(0x281)]+_0x97c0d8(0x1db)+_0x4c5594[_0x97c0d8(0x2ce)]);return console['error'](_0x97c0d8(0x286)),console[_0x97c0d8(0x269)]('\x20\x20'+a26_0x4d135b[_0x97c0d8(0x1bd)]('Audience\x20ID:')+'\x20'+_0x4c5594[_0x97c0d8(0x1a7)]),console[_0x97c0d8(0x269)]('\x20\x20'+a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x2d2))+'\x20'+_0x4c5594[_0x97c0d8(0x2fd)]),console['error']('\x20\x20'+a26_0x4d135b['dim'](_0x97c0d8(0x240))+'\x20'+_0x4c5594[_0x97c0d8(0x281)]),console[_0x97c0d8(0x269)]('\x20\x20'+a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x302))+'\x20'+_0x4c5594[_0x97c0d8(0x2ce)]),console[_0x97c0d8(0x269)]('\x20\x20'+_0x120499),console['error']('\x0a'+a26_0x4d135b[_0x97c0d8(0x1bd)](_0x97c0d8(0x2ba))+_0x97c0d8(0x1cd)+_0x4c5594[_0x97c0d8(0x2ce)]+_0x97c0d8(0x2ae)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x2cb);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x22d);async[a26_0x3e1dba(0x280)](_0x2c54dc){const _0x193520=a26_0x3e1dba,{options:_0x1c2a45,args:_0x293fec,tdx:_0x524f3b}=_0x2c54dc,_0x1ec463=_0x293fec[0x0]||_0x1c2a45[_0x193520(0x268)];if(!_0x1ec463)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'+_0x193520(0x2f2)),0x1;_0x1c2a45['verbose']&&(console[_0x193520(0x269)](_0x193520(0x26a)+_0x1c2a45[_0x193520(0x1c2)]),console[_0x193520(0x269)](_0x193520(0x264)+_0x1ec463));const _0x1da029=await withSpinner(_0x193520(0x251)+_0x1ec463+_0x193520(0x1e0),()=>_0x524f3b['segment'][_0x193520(0x1e1)](_0x1ec463),{'verbose':_0x1c2a45[_0x193520(0x173)]}),_0x1fa44a=_0x1da029[_0x193520(0x1ea)];console[_0x193520(0x269)](_0x193520(0x2b9)+_0x1fa44a[_0x193520(0x1d7)]+_0x193520(0x26d)+(_0x1fa44a['length']!==0x1?'s':''));if(_0x1c2a45[_0x193520(0x2b5)]||_0x1c2a45[_0x193520(0x2aa)])return await handleSDKOutput(_0x1fa44a,_0x1c2a45),0x0;return displayFieldsHumanReadable(_0x1fa44a,_0x1ec463),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x186);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x241);async[a26_0x3e1dba(0x280)](_0x4b046a){const _0x4cecce=a26_0x3e1dba,{options:_0x6f3e22,args:_0xef4c70,tdx:_0x536cb5}=_0x4b046a,_0x4c4787=_0x6f3e22,_0xc66606=_0xef4c70[0x0]||_0x6f3e22['parentSegment'];if(!_0xc66606)return showParentSegmentNotSetError(_0x4cecce(0x2f3)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x4cecce(0x2b3)+_0x4cecce(0x23f)),0x1;_0x6f3e22[_0x4cecce(0x173)]&&(console[_0x4cecce(0x269)](_0x4cecce(0x26a)+_0x6f3e22['site']),console[_0x4cecce(0x269)](_0x4cecce(0x264)+_0xc66606));const _0x4d9178=await withSpinner(_0x4cecce(0x220)+_0xc66606+_0x4cecce(0x1e0),()=>_0x536cb5[_0x4cecce(0x1eb)]['getParentFull'](_0xc66606),{'verbose':_0x6f3e22[_0x4cecce(0x173)]}),_0x39d0bf=_0x4d9178[_0x4cecce(0x1ea)];if(_0x4c4787[_0x4cecce(0x266)]){const _0x1bba2a=getConsoleNextUrl(_0x4c4787[_0x4cecce(0x1c2)],'/app/dw/parentSegments/'+_0x39d0bf['id']);return console['error'](a26_0x4d135b[_0x4cecce(0x1b9)]('✔')+_0x4cecce(0x2b7)+a26_0x4d135b[_0x4cecce(0x2e6)](_0x1bba2a)),openBrowser(_0x1bba2a),0x0;}return await handleSingleObjectOutput(_0x39d0bf,_0x6f3e22),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x1e4);[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x1e3);async[a26_0x3e1dba(0x280)](_0x607ad5){const _0x766005=a26_0x3e1dba,{options:_0x4b6e57,args:_0x9f6a5e,tdx:_0x50f380}=_0x607ad5,_0x399d07=_0x4b6e57,_0x576f19=_0x9f6a5e[0x0]||_0x4b6e57[_0x766005(0x268)];if(!_0x576f19)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x766005(0x2e0)),0x1;_0x4b6e57[_0x766005(0x173)]&&(console[_0x766005(0x269)](_0x766005(0x26a)+_0x4b6e57['site']),console['error'](_0x766005(0x264)+_0x576f19));const _0x2538d2=await withSpinner(_0x766005(0x1df)+_0x576f19+_0x766005(0x1e0),()=>_0x50f380[_0x766005(0x1eb)]['resolveParentId'](_0x576f19),{'verbose':_0x4b6e57[_0x766005(0x173)]}),_0x446b5f=_0x2538d2[_0x766005(0x1ea)],_0x2a8b09=_0x50f380[_0x766005(0x1eb)][_0x766005(0x232)](_0x446b5f);if(_0x399d07[_0x766005(0x1e5)]){const _0x235a71=await this[_0x766005(0x197)](_0x607ad5,_0x576f19,_0x446b5f,_0x2a8b09),_0x80eeb=this[_0x766005(0x1da)](_0x235a71);writeFileSync(_0x399d07[_0x766005(0x1e5)],_0x80eeb);const _0xfd102f=_0x235a71[_0x766005(0x242)][_0x766005(0x201)][_0x766005(0x1d7)]+_0x235a71[_0x766005(0x1b4)][_0x766005(0x218)]((_0x1881c8,_0x12b5f3)=>_0x1881c8+_0x12b5f3[_0x766005(0x201)][_0x766005(0x1d7)],0x0),_0xce9af6=_0x235a71[_0x766005(0x1b4)]['filter'](_0xfce6b=>_0xfce6b[_0x766005(0x201)]['length']===0x0)['length'];return console[_0x766005(0x26e)](_0x766005(0x22c)+_0x399d07[_0x766005(0x1e5)]),console['log'](_0x766005(0x2c5)+_0x2a8b09),console[_0x766005(0x26e)](_0x766005(0x194)+_0x235a71[_0x766005(0x1b4)]['length']+_0x766005(0x179)),console[_0x766005(0x26e)](_0x766005(0x2dc)+_0xfd102f+_0x766005(0x21b)),_0xce9af6>0x0&&console[_0x766005(0x26e)](_0x766005(0x298)+_0xce9af6+_0x766005(0x210)),0x0;}console[_0x766005(0x269)]('\x0a'+a26_0x4d135b[_0x766005(0x270)](_0x766005(0x2fa))+'\x20'+a26_0x4d135b[_0x766005(0x2e6)](_0x2a8b09));const _0x2da719=await withSpinner(_0x766005(0x192),()=>_0x50f380[_0x766005(0x1eb)][_0x766005(0x2d0)](_0x446b5f),{'verbose':_0x4b6e57[_0x766005(0x173)]});console[_0x766005(0x269)]('\x0a'+a26_0x4d135b[_0x766005(0x270)](_0x766005(0x242))+'\x20'+a26_0x4d135b[_0x766005(0x1bd)]('('+_0x2a8b09+_0x766005(0x25a)));const _0x21035e=await executeSchemaQuery(_0x2da719[_0x766005(0x1ea)],_0x50f380,_0x4b6e57);await handleQueryOutput(_0x21035e,_0x4b6e57);const _0x1f7d06=await withSpinner(_0x766005(0x295),()=>_0x50f380[_0x766005(0x1eb)]['getBehaviorNames'](_0x446b5f),{'verbose':_0x4b6e57['verbose']});for(const _0x54f16e of _0x1f7d06[_0x766005(0x1ea)]){const _0x57c0aa=_0x766005(0x228)+_0x54f16e[_0x766005(0x20e)]()[_0x766005(0x27f)](/\s+/g,'_'),_0x2f57a5=_0x766005(0x1dd)+_0x2a8b09+'.'+_0x57c0aa;console[_0x766005(0x269)]('\x0a'+a26_0x4d135b['bold'](_0x54f16e)+'\x20'+a26_0x4d135b[_0x766005(0x1bd)]('('+_0x2a8b09+'.'+_0x57c0aa+')'));try{const _0x25a9f7=await executeSchemaQuery(_0x2f57a5,_0x50f380,_0x4b6e57);await handleQueryOutput(_0x25a9f7,_0x4b6e57);}catch{console['error'](a26_0x4d135b[_0x766005(0x1f9)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a26_0x3e1dba(0x197)](_0x5e93f6,_0x4e16df,_0x1836ec,_0x39b278){const _0x2d7588=a26_0x3e1dba,{options:_0x30b9ca,tdx:_0x4fd214}=_0x5e93f6,_0x4c2ea2=await withSpinner(_0x2d7588(0x192),()=>_0x4fd214['segment'][_0x2d7588(0x2d0)](_0x1836ec),{'verbose':_0x30b9ca['verbose']}),_0x575c83=await executeSchemaQuery(_0x4c2ea2[_0x2d7588(0x1ea)],_0x4fd214,_0x30b9ca),_0x263699=_0x575c83[_0x2d7588(0x1ea)][_0x2d7588(0x235)](_0x37028d=>({'name':_0x37028d[_0x2d7588(0x2d5)],'type':_0x37028d[_0x2d7588(0x226)]})),_0x2017b5=await withSpinner(_0x2d7588(0x295),()=>_0x4fd214[_0x2d7588(0x1eb)][_0x2d7588(0x24f)](_0x1836ec),{'verbose':_0x30b9ca['verbose']}),_0x13b72c=[];for(const _0x101773 of _0x2017b5[_0x2d7588(0x1ea)]){const _0x5a3ae9='behavior_'+_0x101773['toLowerCase']()['replace'](/\s+/g,'_'),_0x4a7edf=_0x2d7588(0x1dd)+_0x39b278+'.'+_0x5a3ae9;let _0x2a3ed9=[];try{const _0x3edd28=await executeSchemaQuery(_0x4a7edf,_0x4fd214,_0x30b9ca);_0x2a3ed9=_0x3edd28[_0x2d7588(0x1ea)][_0x2d7588(0x235)](_0xe3fbc6=>({'name':_0xe3fbc6[_0x2d7588(0x2d5)],'type':_0xe3fbc6[_0x2d7588(0x226)]}));}catch{}_0x13b72c[_0x2d7588(0x1b6)]({'table':_0x5a3ae9,'columns':_0x2a3ed9});}return{'database':_0x39b278,'parent_segment':_0x4e16df,'parent_id':_0x1836ec,'customers':{'table':_0x2d7588(0x242),'columns':_0x263699},'behaviors':_0x13b72c};}[a26_0x3e1dba(0x1da)](_0x480ca8){const _0x50fc64=a26_0x3e1dba,_0x3c8579=_0x1b2d9d=>{const _0x4bfd54=a26_0x241c;if(_0x1b2d9d[_0x4bfd54(0x1d7)]===0x0)return'[]';const _0x5d75d5=_0x1b2d9d[_0x4bfd54(0x235)](_0x3a518f=>_0x4bfd54(0x22a)+_0x3a518f[_0x4bfd54(0x1ae)]+_0x4bfd54(0x2f4)+_0x3a518f[_0x4bfd54(0x25e)]+_0x4bfd54(0x188));return'[\x0a'+_0x5d75d5[_0x4bfd54(0x189)](',\x0a')+_0x4bfd54(0x301);},_0x331f5e=_0x480ca8[_0x50fc64(0x1b4)][_0x50fc64(0x235)](_0x32fd6b=>{const _0x4c1619=_0x50fc64;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x32fd6b[_0x4c1619(0x2f1)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x3c8579(_0x32fd6b['columns'])[_0x4c1619(0x27f)](/^/gm,'\x20\x20')[_0x4c1619(0x245)]()+'\x0a\x20\x20\x20\x20}';})[_0x50fc64(0x189)](',\x0a');return _0x50fc64(0x277)+_0x480ca8[_0x50fc64(0x1f2)]+_0x50fc64(0x206)+_0x480ca8[_0x50fc64(0x249)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x480ca8[_0x50fc64(0x296)]+_0x50fc64(0x1a3)+_0x480ca8[_0x50fc64(0x242)][_0x50fc64(0x2f1)]+_0x50fc64(0x208)+_0x3c8579(_0x480ca8[_0x50fc64(0x242)][_0x50fc64(0x201)])[_0x50fc64(0x27f)](/^/gm,'\x20\x20')[_0x50fc64(0x245)]()+_0x50fc64(0x27a)+_0x331f5e+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]='segment:parent:sql';['description']=a26_0x3e1dba(0x20b);async['execute'](_0x383e20){const _0x4e4c5f=a26_0x3e1dba,{options:_0xe75af6,args:_0x2c1dc1,tdx:_0x40d3c5}=_0x383e20,_0x7d799a=_0x2c1dc1[0x0]||_0xe75af6[_0x4e4c5f(0x268)];if(!_0x7d799a)return showParentSegmentNotSetError(_0x4e4c5f(0x2bd)+_0x4e4c5f(0x253)),0x1;_0xe75af6[_0x4e4c5f(0x173)]&&(console[_0x4e4c5f(0x269)](_0x4e4c5f(0x26a)+_0xe75af6[_0x4e4c5f(0x1c2)]),console[_0x4e4c5f(0x269)]('Parent\x20segment:\x20'+_0x7d799a));const _0x539a30=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x7d799a+_0x4e4c5f(0x1e0),()=>_0x40d3c5['segment']['resolveParentId'](_0x7d799a),{'verbose':_0xe75af6[_0x4e4c5f(0x173)]}),_0x12a1e1=_0x539a30['data'],_0x3184a2=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x7d799a+_0x4e4c5f(0x1e0),()=>_0x40d3c5[_0x4e4c5f(0x1eb)]['getParentSQL'](_0x12a1e1),{'verbose':_0xe75af6[_0x4e4c5f(0x173)]}),_0x3fbbc1=_0x3184a2[_0x4e4c5f(0x1ea)];return _0xe75af6['format']===_0x4e4c5f(0x2b5)||_0xe75af6[_0x4e4c5f(0x1d3)]===_0x4e4c5f(0x2aa)?await handleSDKOutput([{'sql':_0x3fbbc1}],_0xe75af6):console['log'](_0x3fbbc1),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]=a26_0x3e1dba(0x1f7);['description']=a26_0x3e1dba(0x2d3);async[a26_0x3e1dba(0x280)](_0x3947bd){const _0x3ee091=a26_0x3e1dba,{options:_0x3f71c5,args:_0x3756f5,tdx:_0x5cc711}=_0x3947bd,_0x249f34=_0x3756f5[0x0]||_0x3f71c5[_0x3ee091(0x268)];if(!_0x249f34)return showParentSegmentNotSetError(_0x3ee091(0x19a)+'\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;_0x3f71c5[_0x3ee091(0x173)]&&(console['error'](_0x3ee091(0x26a)+_0x3f71c5[_0x3ee091(0x1c2)]),console[_0x3ee091(0x269)]('Parent\x20segment:\x20'+_0x249f34));const _0x5a2d85=await withSpinner(_0x3ee091(0x1df)+_0x249f34+_0x3ee091(0x1e0),()=>_0x5cc711[_0x3ee091(0x1eb)][_0x3ee091(0x276)](_0x249f34),{'verbose':_0x3f71c5[_0x3ee091(0x173)]}),_0x96c2fb=_0x5a2d85[_0x3ee091(0x1ea)],_0x1432a1=await withSpinner(_0x3ee091(0x1f1)+_0x249f34+_0x3ee091(0x1e0),()=>_0x5cc711[_0x3ee091(0x1eb)]['getParentSQL'](_0x96c2fb),{'verbose':_0x3f71c5[_0x3ee091(0x173)]});let _0x84cbfe=_0x1432a1[_0x3ee091(0x1ea)];const _0x1d98a4=resolveLimit(_0x3f71c5[_0x3ee091(0x27b)],DEFAULT_DISPLAY_LIMIT),_0x2becde=/\bLIMIT\s+\d+/i[_0x3ee091(0x257)](_0x84cbfe);!_0x2becde&&(_0x84cbfe=_0x84cbfe['trim']()['replace'](/;+$/,''),_0x84cbfe=_0x3ee091(0x272)+_0x84cbfe+_0x3ee091(0x29a)+_0x1d98a4);_0x3f71c5[_0x3ee091(0x173)]&&console[_0x3ee091(0x269)](_0x3ee091(0x216)+_0x84cbfe);const _0x59a3a4=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x3e6ab7=>{const _0x122457=_0x3ee091,_0x459a29=await _0x5cc711['query'][_0x122457(0x280)](_0x84cbfe,{'catalog':'td','schema':'information_schema','onJobId':_0x161032=>{const _0x3a49a9=_0x122457;_0x3e6ab7[_0x3a49a9(0x2c1)](_0x161032);}});return _0x459a29;},{'verbose':_0x3f71c5['verbose']}),_0x57ce4f=_0x59a3a4['data'],_0x1bc3a0=_0x57ce4f['jobId']?_0x3ee091(0x181)+_0x57ce4f[_0x3ee091(0x21a)]+']':'';return console[_0x3ee091(0x269)](_0x3ee091(0x17b)+_0x57ce4f[_0x3ee091(0x171)]['processedRows'][_0x3ee091(0x233)]()+_0x3ee091(0x305)+(_0x3ee091(0x212)+formatElapsed(_0x57ce4f[_0x3ee091(0x171)]['elapsedTimeMillis'])+_0x1bc3a0)),await handleQueryOutput(_0x57ce4f,_0x3f71c5),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]='ps:rt:list';[a26_0x3e1dba(0x2e2)]='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a26_0x3e1dba(0x280)](_0x472114){const _0x14eb78=a26_0x3e1dba,{options:_0x476f44,args:_0x4d9b30,tdx:_0x36d195}=_0x472114,_0xce9c84=_0x4d9b30[0x0],_0x4bd92c=await withSpinner(_0xce9c84?_0x14eb78(0x239)+_0xce9c84+_0x14eb78(0x1e0):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x36d195['realtime'][_0x14eb78(0x1fd)](),{'verbose':_0x476f44[_0x14eb78(0x173)]});let _0x5a81dd=_0x4bd92c[_0x14eb78(0x1ea)]['filter'](_0x39325c=>_0x39325c[_0x14eb78(0x243)]);if(_0xce9c84){const _0x3abe22=_0xce9c84[_0x14eb78(0x27f)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x14eb78(0x27f)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x1888a6=new RegExp('^'+_0x3abe22+'$','i');_0x5a81dd=_0x5a81dd[_0x14eb78(0x292)](_0x23d4f0=>_0x1888a6[_0x14eb78(0x257)](_0x23d4f0[_0x14eb78(0x1ae)]));}_0x5a81dd['sort']((_0x4cdd13,_0x220be9)=>_0x4cdd13['name']['localeCompare'](_0x220be9['name'])),console[_0x14eb78(0x269)](_0x14eb78(0x2b9)+_0x5a81dd[_0x14eb78(0x1d7)]+_0x14eb78(0x199)+(_0x5a81dd[_0x14eb78(0x1d7)]!==0x1?'s':''));const _0x2a5b8d=_0x52e448=>{const _0x54c1f1=_0x14eb78;return getConsoleNextUrl(_0x476f44['site'],_0x54c1f1(0x2ed)+_0x52e448);};if(_0x476f44[_0x14eb78(0x1d3)]==='json'||_0x476f44['format']===_0x14eb78(0x2aa)){const _0x18daa1=_0x5a81dd[_0x14eb78(0x235)](_0x2a159d=>({..._0x2a159d,'url':_0x2a5b8d(_0x2a159d['id'])}));await handleSDKOutput(_0x18daa1,_0x476f44);}else{if(_0x5a81dd[_0x14eb78(0x1d7)]===0x0)console[_0x14eb78(0x26e)](_0x14eb78(0x2eb));else for(const _0x6fc1d of _0x5a81dd){const _0x49218d=_0x6fc1d['population']?a26_0x4d135b[_0x14eb78(0x1bd)]('\x20('+formatRows(_0x6fc1d['population'])+')'):'',_0x161677=hyperlink(_0x6fc1d['name'],_0x2a5b8d(_0x6fc1d['id']));console[_0x14eb78(0x26e)]('⚡\x20'+_0x161677+_0x49218d);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]='ps:rt:validate';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x217);async[a26_0x3e1dba(0x280)](_0x24057f){const _0x1fb417=a26_0x3e1dba,{options:_0x533781,args:_0x2c5f8c,tdx:_0x4a02bb}=_0x24057f,_0x146fca=_0x2c5f8c[0x0]||_0x533781[_0x1fb417(0x268)];if(!_0x146fca)return showParentSegmentNotSetError(_0x1fb417(0x1a0)+_0x1fb417(0x288)),0x1;const _0x33a409=resolveYamlFile(_0x146fca);if(!existsSync(_0x33a409))return showFileNotFoundError(_0x33a409,_0x146fca),0x1;let _0x8bc976;try{_0x8bc976=readFileSync(_0x33a409,_0x1fb417(0x2ec));}catch(_0x3e6d5f){const _0x23f288=_0x3e6d5f instanceof Error?_0x3e6d5f[_0x1fb417(0x1c9)]:String(_0x3e6d5f);return console[_0x1fb417(0x269)]('Error\x20reading\x20file:\x20'+_0x23f288),0x1;}const _0x5a2e19=createCommandSpinner(a26_0x4d135b[_0x1fb417(0x1bd)]('Validating\x20RT\x20configuration...'),{'verbose':_0x533781['verbose']});_0x5a2e19[_0x1fb417(0x1e7)]();const _0x48ef13={'realtime':!![],'onProgress':_0x5eee3e=>{_0x5a2e19['text']=formatProgressMessage(_0x5eee3e);}};let _0x230ca7;try{_0x230ca7=await _0x4a02bb[_0x1fb417(0x1eb)][_0x1fb417(0x1cb)](_0x8bc976,_0x48ef13),_0x5a2e19[_0x1fb417(0x225)]();}catch(_0x17700f){_0x5a2e19[_0x1fb417(0x225)]();throw _0x17700f;}console[_0x1fb417(0x269)]('\x0a'+a26_0x4d135b[_0x1fb417(0x270)](_0x1fb417(0x207))+'\x20'+_0x230ca7[_0x1fb417(0x1ae)]),console[_0x1fb417(0x269)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x230ca7),console[_0x1fb417(0x269)]('─'['repeat'](0x3c));if(_0x230ca7[_0x1fb417(0x1cc)][_0x1fb417(0x1d7)]>0x0){console[_0x1fb417(0x269)]('\x0a'+a26_0x4d135b[_0x1fb417(0x237)](_0x1fb417(0x275)));for(const _0x4f5874 of _0x230ca7[_0x1fb417(0x1cc)]){console[_0x1fb417(0x269)]('\x20\x20'+a26_0x4d135b[_0x1fb417(0x237)]('•')+'\x20'+_0x4f5874);}}return _0x230ca7[_0x1fb417(0x2e9)]&&console[_0x1fb417(0x269)]('\x0a'+a26_0x4d135b['green']('✔')+_0x1fb417(0x209)),_0x230ca7[_0x1fb417(0x2e9)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x3e1dba(0x1ae)]='ps:pz:list';[a26_0x3e1dba(0x2e2)]=a26_0x3e1dba(0x26c);async[a26_0x3e1dba(0x280)](_0x470425){const _0x21ca28=a26_0x3e1dba,{options:_0xc0350c,args:_0x48b6d0,tdx:_0x585f67}=_0x470425,_0x24fa10=_0x48b6d0[0x0]||_0xc0350c[_0x21ca28(0x268)];if(!_0x24fa10)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x280ead=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x24fa10+_0x21ca28(0x1e0),()=>_0x585f67[_0x21ca28(0x1eb)]['resolveParentId'](_0x24fa10),{'verbose':_0xc0350c[_0x21ca28(0x173)]}),_0x4049ef=_0x280ead['data'],_0x358bf5=await withSpinner(_0x21ca28(0x204)+_0x24fa10+_0x21ca28(0x1e0),()=>_0x585f67[_0x21ca28(0x273)][_0x21ca28(0x1fd)](_0x4049ef),{'verbose':_0xc0350c[_0x21ca28(0x173)]}),_0x8ab2e7=_0x358bf5[_0x21ca28(0x1ea)];console['error']('✔\x20Found\x20'+_0x8ab2e7[_0x21ca28(0x1d7)]+_0x21ca28(0x291)+(_0x8ab2e7[_0x21ca28(0x1d7)]!==0x1?'s':''));if(_0xc0350c['format']===_0x21ca28(0x2b5)||_0xc0350c[_0x21ca28(0x1d3)]===_0x21ca28(0x2aa))await handleSDKOutput(_0x8ab2e7,_0xc0350c);else{if(_0x8ab2e7['length']===0x0)console[_0x21ca28(0x26e)]('No\x20personalization\x20services\x20configured'),console[_0x21ca28(0x269)](a26_0x4d135b['cyan'](_0x21ca28(0x29f)));else for(const _0x13e45b of _0x8ab2e7){const _0x400b5a=_0x13e45b[_0x21ca28(0x25b)]?.['length']||0x0,_0xda8591=_0x13e45b['trigger_event']?a26_0x4d135b[_0x21ca28(0x1bd)]('\x20trigger='+_0x13e45b['trigger_event']):'',_0x13f7a7=a26_0x4d135b['dim']('\x20('+_0x400b5a+_0x21ca28(0x2a9)+(_0x400b5a!==0x1?'s':'')+')');console[_0x21ca28(0x26e)]('\x20\x20'+_0x13e45b[_0x21ca28(0x1ae)]+_0xda8591+_0x13f7a7),_0x13e45b[_0x21ca28(0x2e2)]&&console['log'](_0x21ca28(0x223)+a26_0x4d135b[_0x21ca28(0x1bd)](_0x13e45b[_0x21ca28(0x2e2)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x3e1dba(0x1ae)]='ps:pz:init';['description']=a26_0x3e1dba(0x21c);async[a26_0x3e1dba(0x280)](_0x149ba5){const _0x23a2fd=a26_0x3e1dba,{options:_0xcc69d6,args:_0x3b003a}=_0x149ba5,_0x32a75e=_0x3b003a[0x0]||_0xcc69d6['parentSegment'];if(!_0x32a75e)return showParentSegmentNotSetError(_0x23a2fd(0x1c8)+_0x23a2fd(0x185)),0x1;const _0x2294d9=resolveYamlFile(_0x32a75e);if(!existsSync(_0x2294d9))return showFileNotFoundError(_0x2294d9,_0x32a75e),0x1;let _0x5e2e87;try{_0x5e2e87=readFileSync(_0x2294d9,'utf-8');}catch(_0x1060ef){const _0x2bac6d=_0x1060ef instanceof Error?_0x1060ef[_0x23a2fd(0x1c9)]:String(_0x1060ef);return console[_0x23a2fd(0x269)]('Error\x20reading\x20file:\x20'+_0x2bac6d),0x1;}let _0x4dbe97;try{_0x4dbe97=parseDef(_0x5e2e87);}catch(_0x172d1a){const _0x268309=_0x172d1a instanceof Error?_0x172d1a[_0x23a2fd(0x1c9)]:String(_0x172d1a);return console[_0x23a2fd(0x269)](a26_0x4d135b[_0x23a2fd(0x237)](_0x23a2fd(0x2d9)+_0x268309)),0x1;}if(_0x4dbe97[_0x23a2fd(0x172)]&&_0x4dbe97['personalization_services'][_0x23a2fd(0x1d7)]>0x0)return console[_0x23a2fd(0x269)](a26_0x4d135b['yellow'](_0x23a2fd(0x2ea)+_0x2294d9)),console[_0x23a2fd(0x269)](a26_0x4d135b[_0x23a2fd(0x1bd)](_0x23a2fd(0x2ac)+_0x4dbe97[_0x23a2fd(0x172)][_0x23a2fd(0x1d7)]+_0x23a2fd(0x1d1))),0x1;!_0x4dbe97[_0x23a2fd(0x18a)]&&(_0x4dbe97['realtime']={'events':[{'name':'page_view','source_table':_0x23a2fd(0x283)}],'attributes':[{'name':'last_page_viewed','type':_0x23a2fd(0x2f5)}],'id_stitching':{'primary_key':_0x4dbe97[_0x23a2fd(0x1ad)][_0x23a2fd(0x2f1)]===_0x23a2fd(0x242)?'td_client_id':_0x23a2fd(0x21f)}});_0x4dbe97['personalization_services']=[{'name':_0x23a2fd(0x1ff),'description':_0x23a2fd(0x2c4),'trigger_event':'page_view','sections':[{'name':_0x23a2fd(0x2a3),'criteria':_0x23a2fd(0x2da),'attributes':[_0x23a2fd(0x1c0)]}]}];const _0x375e9b=serializeDef(_0x4dbe97);return writeFileSync(_0x2294d9,_0x375e9b,_0x23a2fd(0x2ec)),console[_0x23a2fd(0x269)](a26_0x4d135b['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a26_0x4d135b['cyan'](_0x2294d9)),(!_0x4dbe97[_0x23a2fd(0x18a)]||_0x5e2e87['indexOf'](_0x23a2fd(0x191))===-0x1)&&console[_0x23a2fd(0x269)](a26_0x4d135b['green']('✔')+_0x23a2fd(0x1a5)),console[_0x23a2fd(0x269)]('\x0a'+a26_0x4d135b[_0x23a2fd(0x1bd)](_0x23a2fd(0x1ed))),console[_0x23a2fd(0x269)](_0x23a2fd(0x1af)+_0x2294d9+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x23a2fd(0x269)](_0x23a2fd(0x262)+a26_0x4d135b[_0x23a2fd(0x1bd)](_0x23a2fd(0x1fe)+_0x32a75e)+_0x23a2fd(0x17e)),0x0;}}
|
|
1
|
+
const a26_0x5e5c22=a26_0x147c;(function(_0x1ccd3e,_0x4439bd){const _0x5a0aaf=a26_0x147c,_0x3492c1=_0x1ccd3e();while(!![]){try{const _0x5c2fe8=-parseInt(_0x5a0aaf(0x1c0))/0x1+parseInt(_0x5a0aaf(0x250))/0x2+-parseInt(_0x5a0aaf(0x1c1))/0x3*(-parseInt(_0x5a0aaf(0x22c))/0x4)+parseInt(_0x5a0aaf(0x172))/0x5*(parseInt(_0x5a0aaf(0x298))/0x6)+-parseInt(_0x5a0aaf(0x17f))/0x7+-parseInt(_0x5a0aaf(0x1e3))/0x8+parseInt(_0x5a0aaf(0x24d))/0x9;if(_0x5c2fe8===_0x4439bd)break;else _0x3492c1['push'](_0x3492c1['shift']());}catch(_0x39c24a){_0x3492c1['push'](_0x3492c1['shift']());}}}(a26_0x7739,0x48b7f));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x128ffd 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 a26_0x49e31e 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=a26_0x5e5c22(0x17e),LEGACY_PARENT_SEGMENT_DIR=a26_0x5e5c22(0x28f);function openBrowser(_0x4a3333){const _0x33b1bf=a26_0x5e5c22,_0x19a6fb=process[_0x33b1bf(0x27a)],_0x47fb0e=_0x19a6fb==='darwin'?_0x33b1bf(0x21d):_0x19a6fb===_0x33b1bf(0x19f)?'start':'xdg-open';spawn(_0x47fb0e,[_0x4a3333],{'detached':!![],'stdio':_0x33b1bf(0x1c2)})['unref']();}function migrateLegacyDirectory(){const _0x42b07d=a26_0x5e5c22;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1b4c25=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1b4c25[_0x42b07d(0x143)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x42b07d(0x15c)](a26_0x49e31e['yellow'](_0x42b07d(0x27f)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x42b07d(0x1bf))),console['error'](a26_0x49e31e[_0x42b07d(0x25f)](_0x42b07d(0x14e)+LEGACY_PARENT_SEGMENT_DIR+_0x42b07d(0x1c9))),![];console[_0x42b07d(0x15c)](a26_0x49e31e['yellow'](_0x42b07d(0x1b9)+LEGACY_PARENT_SEGMENT_DIR+_0x42b07d(0x267)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x42b07d(0x15c)](a26_0x49e31e[_0x42b07d(0x256)](_0x42b07d(0x150)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4975c9){const _0x1e83f3=_0x4975c9 instanceof Error?_0x4975c9['message']:String(_0x4975c9);return console['error'](a26_0x49e31e['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x1e83f3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x5e5c22(0x1f8)](_0x498a27){return migrateLegacyDirectory(),super['run'](_0x498a27);}}function resolveYamlFile(_0x2209d3){const _0x51ae18=a26_0x5e5c22;if(_0x2209d3['endsWith'](_0x51ae18(0x14b))||_0x2209d3['endsWith']('.yaml'))return _0x2209d3;return a26_0x128ffd['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2209d3)+_0x51ae18(0x14b));}function formatProgressMessage(_0x451529){const _0x41901f=a26_0x5e5c22,_0x7c8917=_0x451529[_0x41901f(0x1e2)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x7c8917){const [,_0x51e238,_0x57f332,_0x176722='']=_0x7c8917;return a26_0x49e31e[_0x41901f(0x25f)](_0x51e238+':')+'\x20'+_0x57f332+a26_0x49e31e[_0x41901f(0x25f)](_0x176722);}return a26_0x49e31e['dim'](_0x451529);}function showFileNotFoundError(_0x63ee31,_0x5121c2){const _0x4ef40f=a26_0x5e5c22;console[_0x4ef40f(0x15c)](a26_0x49e31e[_0x4ef40f(0x1f7)](_0x4ef40f(0x1b7)+_0x63ee31+'\x0a')),console['error'](a26_0x49e31e[_0x4ef40f(0x29a)](_0x4ef40f(0x22e)+_0x5121c2+_0x4ef40f(0x284)));}function displayRealtimeValidation(_0x587582){const _0x98d671=a26_0x5e5c22;if(!_0x587582['realtime'])return;const _0x51a452=_0x587582[_0x98d671(0x169)],_0x4506a2=_0x51a452[_0x98d671(0x1ed)]?a26_0x49e31e[_0x98d671(0x256)](_0x98d671(0x240)):a26_0x49e31e['yellow'](_0x98d671(0x269));console['error']('\x0a'+a26_0x49e31e['dim'](_0x98d671(0x28c))+'\x20'+_0x4506a2);if(_0x51a452[_0x98d671(0x17c)]&&_0x51a452[_0x98d671(0x17c)][_0x98d671(0x25b)]>0x0){console[_0x98d671(0x15c)]('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)]('Events:')+'\x20'+_0x51a452[_0x98d671(0x17c)][_0x98d671(0x25b)]+_0x98d671(0x1da));for(const _0x437ec4 of _0x51a452[_0x98d671(0x17c)]){const _0x58e8c8=_0x437ec4[_0x98d671(0x272)]===![]?a26_0x49e31e[_0x98d671(0x1f7)]('✘'):a26_0x49e31e[_0x98d671(0x256)]('✔');console[_0x98d671(0x15c)]('\x20\x20\x20\x20'+_0x58e8c8+'\x20'+_0x437ec4['name']),_0x437ec4[_0x98d671(0x255)]&&console['error'](_0x98d671(0x18e)+a26_0x49e31e[_0x98d671(0x1f7)](_0x437ec4[_0x98d671(0x255)]));}}if(_0x51a452[_0x98d671(0x285)]&&_0x51a452['attributes']['length']>0x0){console[_0x98d671(0x15c)]('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)]('Attributes:')+'\x20'+_0x51a452['attributes']['length']+_0x98d671(0x1da));for(const _0x450e28 of _0x51a452['attributes']){const _0x479850=_0x450e28[_0x98d671(0x266)]?a26_0x49e31e[_0x98d671(0x256)]('✔'):a26_0x49e31e[_0x98d671(0x1f7)]('✘');console[_0x98d671(0x15c)]('\x20\x20\x20\x20'+_0x479850+'\x20'+_0x450e28['name']+'\x20'+a26_0x49e31e[_0x98d671(0x25f)]('('+_0x450e28[_0x98d671(0x186)]+')'));}}if(_0x51a452['idStitching']){const _0x251c58=_0x51a452['idStitching'][_0x98d671(0x219)]?.['length']?_0x98d671(0x1ec)+_0x51a452[_0x98d671(0x271)]['stitchingKeys'][_0x98d671(0x1e9)](',\x20')+']':'';console['error']('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)](_0x98d671(0x24e))+'\x20'+_0x51a452[_0x98d671(0x271)][_0x98d671(0x1ca)]+_0x251c58);}if(_0x51a452[_0x98d671(0x15b)]&&_0x51a452[_0x98d671(0x15b)][_0x98d671(0x25b)]>0x0){console[_0x98d671(0x15c)]('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)](_0x98d671(0x258))+'\x20'+_0x51a452[_0x98d671(0x15b)][_0x98d671(0x25b)]+_0x98d671(0x26d)+(_0x51a452[_0x98d671(0x15b)]['length']!==0x1?'s':''));for(const _0x4e7f9c of _0x51a452[_0x98d671(0x15b)]){console[_0x98d671(0x15c)](_0x98d671(0x26a)+_0x4e7f9c['name']);}}}function showParentSegmentNotSetError(_0xb32ddb){const _0x2c610a=a26_0x5e5c22;console[_0x2c610a(0x15c)](a26_0x49e31e[_0x2c610a(0x247)](_0x2c610a(0x1f4))),console['error'](_0xb32ddb);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]='segment:parent:list';[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x1bc);async[a26_0x5e5c22(0x1f2)](_0x453c5f){const _0x10d07a=a26_0x5e5c22,{options:_0x24b17d,args:_0x564680,tdx:_0x13e32a}=_0x453c5f,_0x3235fd=_0x564680[0x0];_0x24b17d[_0x10d07a(0x1cc)]&&(console['error'](_0x10d07a(0x25c)+_0x24b17d['site']),_0x3235fd&&console[_0x10d07a(0x15c)]('Pattern:\x20'+_0x3235fd));const _0x15a0d9=await withSpinner(_0x3235fd?_0x10d07a(0x124)+_0x3235fd+_0x10d07a(0x263):_0x10d07a(0x213),()=>_0x13e32a[_0x10d07a(0x21a)][_0x10d07a(0x23b)](),{'verbose':_0x24b17d[_0x10d07a(0x1cc)]});let _0x12ea62=_0x15a0d9['data'];if(_0x3235fd){const _0x753444=_0x3235fd[_0x10d07a(0x245)](/[.+^${}()|[\]\\]/g,_0x10d07a(0x123))[_0x10d07a(0x245)](/\*/g,'.*')[_0x10d07a(0x245)](/\?/g,'.'),_0x2b4588=new RegExp('^'+_0x753444+'$','i');_0x12ea62=_0x12ea62[_0x10d07a(0x145)](_0x77e073=>_0x2b4588['test'](_0x77e073[_0x10d07a(0x285)][_0x10d07a(0x1c4)]));}_0x12ea62[_0x10d07a(0x22a)]((_0x64ed94,_0x2f831d)=>_0x64ed94[_0x10d07a(0x285)][_0x10d07a(0x1c4)]['localeCompare'](_0x2f831d[_0x10d07a(0x285)]['name'])),console[_0x10d07a(0x15c)](_0x10d07a(0x208)+_0x12ea62['length']+_0x10d07a(0x11d)+(_0x12ea62[_0x10d07a(0x25b)]!==0x1?'s':''));const _0xcd631a=_0x55065c=>{const _0x4e06d6=_0x10d07a;return getConsoleNextUrl(_0x24b17d[_0x4e06d6(0x28b)],_0x4e06d6(0x122)+_0x55065c);};if(_0x24b17d[_0x10d07a(0x179)]===_0x10d07a(0x1ba)||_0x24b17d['format']===_0x10d07a(0x1f9)){const _0x5bd0ba=_0x12ea62[_0x10d07a(0x295)](_0x5363b6=>({..._0x5363b6,'url':_0xcd631a(_0x5363b6['id'])}));await handleSDKOutput(_0x5bd0ba,_0x24b17d);}else{if(_0x12ea62[_0x10d07a(0x25b)]===0x0)_0x3235fd?console[_0x10d07a(0x282)](_0x10d07a(0x1fa)+_0x3235fd):console[_0x10d07a(0x282)](_0x10d07a(0x1be));else for(const _0x5da570 of _0x12ea62){const _0x5b8980=_0x5da570[_0x10d07a(0x285)][_0x10d07a(0x264)]?a26_0x49e31e[_0x10d07a(0x25f)]('\x20('+formatRows(_0x5da570['attributes'][_0x10d07a(0x264)])+')'):'',_0x18d413=hyperlink(_0x5da570[_0x10d07a(0x285)][_0x10d07a(0x1c4)],_0xcd631a(_0x5da570['id']));console[_0x10d07a(0x282)](_0x10d07a(0x1c7)+_0x18d413+_0x5b8980);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x1ee);[a26_0x5e5c22(0x14f)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a26_0x5e5c22(0x1f2)](_0x2517d6){const _0x1825ca=a26_0x5e5c22,{options:_0x13cf84,args:_0x527745,tdx:_0x20c965}=_0x2517d6;console[_0x1825ca(0x15c)](_0x1825ca(0x1b8)+_0x1825ca(0x120)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x48db3c=_0x13cf84;if(_0x527745[_0x1825ca(0x25b)]===0x0)return console[_0x1825ca(0x15c)](a26_0x49e31e[_0x1825ca(0x1f7)](_0x1825ca(0x268))),console[_0x1825ca(0x15c)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x7806cd=_0x527745[0x0];if(!_0x48db3c[_0x1825ca(0x1b2)]||!_0x48db3c[_0x1825ca(0x292)])return console[_0x1825ca(0x15c)](_0x1825ca(0x11e)),console['error'](_0x1825ca(0x1ab)),0x1;_0x48db3c['verbose']&&(console[_0x1825ca(0x15c)](_0x1825ca(0x25c)+_0x48db3c['site']),console[_0x1825ca(0x15c)](_0x1825ca(0x1a8)+_0x7806cd),console[_0x1825ca(0x15c)]('Database:\x20'+_0x48db3c['database']),console[_0x1825ca(0x15c)](_0x1825ca(0x28e)+_0x48db3c[_0x1825ca(0x292)]));const _0x5e0627=await loadJSONFromOptions(_0x48db3c['attributes'],_0x48db3c[_0x1825ca(0x15d)]),_0x44ceae=await loadJSONFromOptions(_0x48db3c[_0x1825ca(0x196)],_0x48db3c[_0x1825ca(0x165)]),_0x9d358c=await loadJSONFromOptions(_0x48db3c[_0x1825ca(0x273)],_0x48db3c[_0x1825ca(0x16d)]),_0x164f97={'name':_0x7806cd,'description':_0x48db3c[_0x1825ca(0x14f)],'scheduleType':_0x48db3c['scheduleType'],'scheduleOption':_0x48db3c[_0x1825ca(0x297)],'timezone':_0x48db3c[_0x1825ca(0x231)],'master':{'parentDatabaseName':_0x48db3c[_0x1825ca(0x1b2)],'parentTableName':_0x48db3c['table']},'attributes':_0x5e0627,'behaviors':_0x44ceae,'customerGroup':_0x9d358c},_0x1e7084=await withSpinner(_0x1825ca(0x221)+_0x7806cd+_0x1825ca(0x263),()=>_0x20c965[_0x1825ca(0x21a)]['createParent'](_0x164f97),{'verbose':_0x13cf84[_0x1825ca(0x1cc)]}),_0x1aa434=_0x1e7084[_0x1825ca(0x27c)];return console[_0x1825ca(0x15c)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x1aa434[_0x1825ca(0x1c4)]+_0x1825ca(0x277)+_0x1aa434['id']),await handleSDKOutput([_0x1aa434],_0x13cf84),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x136);['description']='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a26_0x5e5c22(0x1f2)](_0x235850){const _0xc21e96=a26_0x5e5c22,{options:_0x1c6f2f,args:_0x529c1c,tdx:_0x321974}=_0x235850;console[_0xc21e96(0x15c)](_0xc21e96(0x18d)+_0xc21e96(0x120)+_0xc21e96(0x262));const _0x49377d=_0x1c6f2f;if(_0x529c1c[_0xc21e96(0x25b)]===0x0)return console[_0xc21e96(0x15c)](a26_0x49e31e['red'](_0xc21e96(0x268))),console[_0xc21e96(0x15c)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0xe52686=_0x529c1c[0x0];_0x49377d[_0xc21e96(0x1cc)]&&(console[_0xc21e96(0x15c)](_0xc21e96(0x25c)+_0x49377d['site']),console[_0xc21e96(0x15c)](_0xc21e96(0x1ff)+_0xe52686));const _0x1c620a=await withSpinner(_0xc21e96(0x189)+_0xe52686+_0xc21e96(0x263),()=>_0x321974[_0xc21e96(0x21a)][_0xc21e96(0x252)](_0xe52686),{'verbose':_0x49377d[_0xc21e96(0x1cc)]}),_0x4d0299=_0x1c620a[_0xc21e96(0x27c)],_0x26a713=await loadJSONFromOptions(_0x49377d[_0xc21e96(0x260)],_0x49377d[_0xc21e96(0x242)]),_0x10e34f=await loadJSONFromOptions(_0x49377d[_0xc21e96(0x178)],_0x49377d[_0xc21e96(0x26e)]),_0x2114f9={'name':_0x4d0299[_0xc21e96(0x1c4)],'description':_0x49377d['description']!==undefined?_0x49377d['description']:_0x4d0299[_0xc21e96(0x14f)],'scheduleType':_0x49377d[_0xc21e96(0x1c3)]!==undefined?_0x49377d[_0xc21e96(0x1c3)]:_0x4d0299['scheduleType'],'scheduleOption':_0x49377d['scheduleOption']!==undefined?_0x49377d[_0xc21e96(0x297)]:_0x4d0299[_0xc21e96(0x297)],'timezone':_0x49377d['timezone']!==undefined?_0x49377d['timezone']:_0x4d0299['timezone'],'master':_0x4d0299['master'],'attributes':_0x26a713?[..._0x4d0299['attributes']||[],..._0x26a713]:_0x4d0299[_0xc21e96(0x285)],'behaviors':_0x10e34f?[..._0x4d0299[_0xc21e96(0x196)]||[],..._0x10e34f]:_0x4d0299[_0xc21e96(0x196)],'customerGroup':_0x4d0299[_0xc21e96(0x273)]},_0x458c1f=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0xe52686+_0xc21e96(0x263),()=>_0x321974[_0xc21e96(0x21a)][_0xc21e96(0x261)](_0xe52686,_0x2114f9),{'verbose':_0x49377d[_0xc21e96(0x1cc)]}),_0x978c1c=_0x458c1f[_0xc21e96(0x27c)];return console['error'](_0xc21e96(0x193)+_0x978c1c[_0xc21e96(0x1c4)]+'\x27'),await handleSDKOutput([_0x978c1c],_0x49377d),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x170);[a26_0x5e5c22(0x14f)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a26_0x5e5c22(0x1f2)](_0x1dca20){const _0x21fcc5=a26_0x5e5c22,{options:_0x13edbd,args:_0x419f89,tdx:_0x330d44}=_0x1dca20,_0x204ab8=_0x13edbd,_0x38ff2c=_0x419f89[0x0]||_0x13edbd[_0x21fcc5(0x1c5)];if(!_0x38ff2c)return showParentSegmentNotSetError(_0x21fcc5(0x20c)+_0x21fcc5(0x1e5)),0x1;if(_0x204ab8[_0x21fcc5(0x27b)]&&_0x204ab8[_0x21fcc5(0x12c)])return console['error'](a26_0x49e31e[_0x21fcc5(0x1f7)](_0x21fcc5(0x16f))),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x289))),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x183)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x29a)](_0x21fcc5(0x141))),0x1;const _0x5092a3=_0x204ab8[_0x21fcc5(0x12c)]||a26_0x128ffd['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x38ff2c)+_0x21fcc5(0x14b));_0x204ab8[_0x21fcc5(0x1cc)]&&(console['error'](_0x21fcc5(0x25c)+_0x204ab8['site']),console['error']('Parent\x20segment:\x20'+_0x38ff2c),console[_0x21fcc5(0x15c)](_0x21fcc5(0x224)+_0x5092a3));const _0x2937ae=await withSpinner(_0x21fcc5(0x127)+_0x38ff2c+'\x27...',()=>_0x330d44[_0x21fcc5(0x21a)]['pullParentYaml'](_0x38ff2c),{'verbose':_0x204ab8[_0x21fcc5(0x1cc)]}),_0x313ba9=_0x2937ae[_0x21fcc5(0x27c)];if(existsSync(_0x5092a3)){const _0x1a9515=readFileSync(_0x5092a3,'utf-8'),_0x121f8b=generateDiff(_0x1a9515,_0x313ba9);if(!hasChanges(_0x121f8b))console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x256)]('✔')+_0x21fcc5(0x191)+a26_0x49e31e['cyan'](_0x5092a3)+_0x21fcc5(0x25e));else{console['error']('\x0aChanges\x20to\x20\x27'+_0x5092a3+'\x27:'),console[_0x21fcc5(0x15c)]('─'[_0x21fcc5(0x200)](0x3c)),console[_0x21fcc5(0x15c)](formatDiffWithColors(_0x121f8b)),console[_0x21fcc5(0x15c)]('─'[_0x21fcc5(0x200)](0x3c));if(!_0x204ab8[_0x21fcc5(0x294)]){if(!isInteractive())return console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x1f7)]('\x0aError:'),_0x21fcc5(0x148)),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x296))),0x1;const _0x548590=await confirmKey(_0x21fcc5(0x18a)+_0x5092a3+'\x27?');if(!_0x548590)return console['error'](a26_0x49e31e[_0x21fcc5(0x247)](_0x21fcc5(0x265))),0x1;}writeFileSync(_0x5092a3,_0x313ba9,'utf-8'),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x256)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x49e31e[_0x21fcc5(0x29a)](_0x5092a3));}}else{const _0x381fe2=a26_0x128ffd['dirname'](_0x5092a3);!existsSync(_0x381fe2)&&mkdirSync(_0x381fe2,{'recursive':!![]}),writeFileSync(_0x5092a3,_0x313ba9,_0x21fcc5(0x121)),console['error'](a26_0x49e31e['green']('✔')+_0x21fcc5(0x18f)+a26_0x49e31e[_0x21fcc5(0x29a)](_0x5092a3));}return saveSessionContext({'parent_segment':_0x38ff2c},_0x204ab8[_0x21fcc5(0x1ae)]),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x256)]('✔')+_0x21fcc5(0x1fb)+a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x28f))+_0x21fcc5(0x182)+a26_0x49e31e['cyan'](_0x38ff2c)),0x0;}}function a26_0x7739(){const _0xf29b91=['addBehaviorsFile','customersWithEvents','all','idStitching','sourceTableValid','customerGroup','List\x20available\x20fields\x20for\x20segmentation','elapsedTimeMillis','Validating\x20configuration...','\x27\x20with\x20ID:\x20','Master\x20+\x20Attributes','/attempt/','platform','use','data','Behaviors','SQL\x20query:\x0a','\x0a⚠️\x20\x20Both\x20','Apply\x20changes\x20to\x20\x27','\x20parent\x20segment\x20\x27','log','toFixed','`\x20to\x20download\x20the\x20configuration\x20first','attributes','errors','td_client_id','\x20behaviors','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','site','RT\x202.0:','foreignKey','Table:\x20','parent_segment','segment:parent:push','Personalization\x20service\x20description','table','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','yes','map','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','scheduleOption','42srltKf','displaySampleData','cyan','label','setJobId','jobId','\x20parent\x20segment','Error:\x20--database\x20and\x20--table\x20are\x20required','<database>.<table>','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','utf-8','/app/dw/parentSegments/','\x5c$&','Listing\x20parent\x20segments\x20matching\x20\x27','toLowerCase','\x0a✔\x20Workflow\x20started','Fetching\x20parent\x20segment\x20\x27','collectSchema','Error:','\x20\x202.\x20Run\x20','getParentSQL','output','displayBehaviorsStats','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','number','\x20RT-enabled\x20parent\x20segment','My\x20Service','Output\x20Database:','parent_id','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Error:\x20--attribute\x20requires\x20a\x20name\x0a','segment:parent:update','limit','ps:rt:validate','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','sampleData','Options:\x0a','Fetching\x20behavior\x20list...','Behavior:','page_view','customerPercent','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','interval','isDirectory','displayPreviewResults','filter','displayMasterInfo','✔\x20No\x20changes\x20-\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Enriched:','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','.yml','Executing\x20parent\x20segment\x20query...','Validate:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','description','✔\x20Renamed\x20directory\x20to\x20','\x0aError:','realtime_enabled','columns','\x20kill','displayColumns','\x20to\x20configure\x20your\x20personalization\x20service','\x20personalization\x20service','segment:parent:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20Opening\x20','personalizationServices','error','attributesFile','%)\x20','matchedCount','master','SELECT\x20*\x20FROM\x20','ps:pz:list','processedRows','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','behaviorsFile','schemaValid','Session:','customers','realtime','preview','displaySummary','allValid','customerGroupFile','\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','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:pull','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','417355WXFidr','Join:','list','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','-1d','addBehaviors','format','last_page_viewed','ps:pz:init','events','rowCount','parent_segments','1930565aSwyXx','formatSchemaJson','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20=\x20','using\x20the\x20default\x20path:\x20','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Created','type','\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','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Fetching\x20current\x20configuration\x20for\x20\x27','Overwrite\x20\x27','Preview:','indexOf','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','realtime:','\x20No\x20changes\x20-\x20','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','✔\x20Updated\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','Available\x20behaviors:','behaviors','Options:','\x20\x20\x20\x20','\x20\x20\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20customers\x20schema...','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20section','trigger_event','win32','\x0aNew\x20parent\x20segment\x20\x27','\x27\x20is\x20up\x20to\x20date','\x20--attribute\x20\x22<name>\x22','runParent','varchar','bold','Analyzing\x20changes...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Name:\x20','\x20trigger=','joinKey','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','resolveParentId','Error\x20parsing\x20YAML:\x20','session','audienceId','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','test','database','Status:','validateParentYaml','start','displayRealtimeInfo','Error:\x20File\x20not\x20found:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x0a⚠️\x20\x20Migrating:\x20','json','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','List\x20parent\x20segments','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','No\x20parent\x20segments\x20found','/\x20directories\x20exist.','278120uWCPNN','36xDmoRj','ignore','scheduleType','name','parentSegment','\x0a\x20\x20]\x0a}\x0a','👥\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','/\x20directory.\x0a','primaryKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','verbose','\x20\x20Database:\x20','totalEvents','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','ps:rt:list','segment:parent:view','user_id','text','Resolving\x20parent\x20segment\x20\x27','tdx\x20ps\x20preview\x20','displayAttributesStats','\x20rows)','Error\x20reading\x20file:\x20','column_type','\x20configured','column','\x20--enriched','To\x20cancel:','behavior','displayValidateResults','displayPreviewHints','personalization_services','match','2887368QYlRAm','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','information_schema','trim','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','join','\x20Added\x20personalization\x20template\x20to\x20','segment:parent:sql','\x20+\x20[','enabled','segment:parent:create','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','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','execute','Attributes','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','/sessions/','Source:','red','run','jsonl','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20Context\x20set:\x20','workflowAttemptId','Events:','\x20service(s)\x20configured','Parent\x20segment:\x20','repeat','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','stop','YAML\x20file:\x20','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','stats','✔\x20Found\x20','getBehaviorNames','message','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','segment:parent:preview','status','Schema\x20saved\x20to\x20','\x20--attribute\x20\x22','schemaError','behavior_','Listing\x20parent\x20segments...','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','/app/workflows/','Updated','FINISHED','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','stitchingKeys','segment','\x20Added\x20RT\x202.0\x20template\x20section','segment:parent:fields','open','attribute','\x20--interval\x20','web','Creating\x20parent\x20segment\x20\x27','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Coverage:','Output\x20file:\x20','keys','Listing\x20personalization\x20services\x20for\x20\x27','Attribute:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Columns:','sort','RT\x202.0\x20Validate:','15184xfEqWq','personalization','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Customers:','segment:parent:validate','timezone','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x20to\x20push\x20the\x20configuration','\x0a\x20\x20\x20\x20}','Fetching\x20SQL\x20for\x20\x27','Master:','\x20[Job\x20ID:\x20','apply','\x20field','\x20\x20No\x20sample\x20data\x20available','listParents','double','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','⚡\x20Enabled','Fetching\x20sample\x20data...','addAttributesFile','\x22\x20}','pushParentYaml','replace','coveragePercent','yellow','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Audience\x20ID:','workflowSessionId','Updating','Listing\x20fields\x20for\x20\x27','955800jzgvEw','ID\x20Stitching:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','953284IszcFD','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','getParentFull','segment:parent:desc','enriched','sourceTableError','green','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Personalization:','\x27\x20and\x20run\x20workflow?','string','length','Site:\x20','To\x20view\x20sample\x20data:','\x20is\x20already\x20up\x20to\x20date','dim','addAttributes','updateParent','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x27...','population','Aborted.','valid','/\x20→\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','⚡\x20Not\x20enabled','\x20\x20\x20\x20-\x20','\x22,\x20\x22type\x22:\x20\x22','single','\x20service'];a26_0x7739=function(){return _0xf29b91;};return a26_0x7739();}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x290);[a26_0x5e5c22(0x14f)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x5e5c22(0x1f2)](_0x23613b){const _0x430fc0=a26_0x5e5c22,{options:_0x2d364c,args:_0x39504c,tdx:_0x1629d1}=_0x23613b,_0x4a5db1=_0x2d364c,_0x1cb08a=_0x39504c[0x0]||_0x2d364c[_0x430fc0(0x1c5)];if(!_0x1cb08a)return showParentSegmentNotSetError(_0x430fc0(0x24f)+_0x430fc0(0x1a7)),0x1;const _0x493432=resolveYamlFile(_0x1cb08a);if(!existsSync(_0x493432))return showFileNotFoundError(_0x493432,_0x1cb08a),0x1;_0x4a5db1[_0x430fc0(0x1cc)]&&(console['error'](_0x430fc0(0x25c)+_0x4a5db1[_0x430fc0(0x28b)]),console[_0x430fc0(0x15c)](_0x430fc0(0x204)+_0x493432));let _0x5d5f71;try{_0x5d5f71=readFileSync(_0x493432,_0x430fc0(0x121));}catch(_0x411e3b){const _0x204b2e=_0x411e3b instanceof Error?_0x411e3b['message']:String(_0x411e3b);return console['error']('Error\x20reading\x20file:\x20'+_0x204b2e),0x1;}const _0x1f9da1=await withSpinner(_0x430fc0(0x1a6),()=>_0x1629d1[_0x430fc0(0x21a)][_0x430fc0(0x244)](_0x5d5f71),{'verbose':_0x4a5db1[_0x430fc0(0x1cc)]}),_0x4a8686=_0x1f9da1[_0x430fc0(0x27c)],{isNew:_0x2a449e,name:_0x46e2f7,hasChanges:_0x257852,diffFormatted:_0x190be6}=_0x4a8686;if(!_0x257852)return console['error'](_0x430fc0(0x147)+_0x46e2f7+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x2a449e?console[_0x430fc0(0x15c)](_0x430fc0(0x1a0)+_0x46e2f7+'\x27:'):console[_0x430fc0(0x15c)](_0x430fc0(0x23e)+_0x46e2f7+'\x27:');console[_0x430fc0(0x15c)]('─'[_0x430fc0(0x200)](0x3c)),console[_0x430fc0(0x15c)](_0x190be6),console[_0x430fc0(0x15c)]('─'['repeat'](0x3c));const _0x24f42b=_0x2a449e?_0x430fc0(0x194)+_0x46e2f7+'\x27?':_0x430fc0(0x280)+_0x46e2f7+'\x27?';if(!_0x4a5db1[_0x430fc0(0x294)]){if(!isInteractive())return console[_0x430fc0(0x15c)](a26_0x49e31e[_0x430fc0(0x1f7)](_0x430fc0(0x151)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a26_0x49e31e[_0x430fc0(0x25f)](_0x430fc0(0x296))),0x1;const _0x4d8d50=await confirmKey(_0x24f42b);if(!_0x4d8d50)return console[_0x430fc0(0x15c)](a26_0x49e31e['yellow'](_0x430fc0(0x265))),0x1;}const _0x44b8da=_0x2a449e?'Creating':_0x430fc0(0x24b),_0x425ac5=await withSpinner(_0x44b8da+'\x20parent\x20segment\x20\x27'+_0x46e2f7+'\x27...',()=>_0x4a8686[_0x430fc0(0x238)](),{'verbose':_0x4a5db1['verbose']}),_0x201253=_0x425ac5[_0x430fc0(0x27c)],_0x2834ff=getConsoleNextUrl(_0x4a5db1[_0x430fc0(0x28b)],_0x430fc0(0x122)+_0x201253['id']),_0x514a8d=_0x2a449e?'Created':_0x430fc0(0x216);return console[_0x430fc0(0x15c)]('✔\x20'+_0x514a8d+'\x20parent\x20segment\x20\x27'+_0x201253[_0x430fc0(0x1c4)]+'\x27'),console[_0x430fc0(0x15c)]('\x20\x20'+_0x2834ff),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a26_0x5e5c22(0x230);[a26_0x5e5c22(0x14f)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x58b265){const _0x9d1d6c=a26_0x5e5c22,{options:_0x1fdc7f,args:_0x173305,tdx:_0xb363f9}=_0x58b265,_0x4451e7=_0x1fdc7f,_0x3465af=_0x173305[0x0]||_0x1fdc7f[_0x9d1d6c(0x1c5)];if(!_0x3465af)return showParentSegmentNotSetError(_0x9d1d6c(0x214)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x9d1d6c(0x13c)+_0x9d1d6c(0x251)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x9d1d6c(0x19c)),0x1;const _0x14b0b1=resolveYamlFile(_0x3465af);if(!existsSync(_0x14b0b1))return showFileNotFoundError(_0x14b0b1,_0x3465af),0x1;_0x4451e7[_0x9d1d6c(0x1cc)]&&(console[_0x9d1d6c(0x15c)](_0x9d1d6c(0x25c)+_0x4451e7[_0x9d1d6c(0x28b)]),console[_0x9d1d6c(0x15c)]('YAML\x20file:\x20'+_0x14b0b1));let _0x373f28;try{_0x373f28=readFileSync(_0x14b0b1,_0x9d1d6c(0x121));}catch(_0x29db27){const _0x34ff18=_0x29db27 instanceof Error?_0x29db27[_0x9d1d6c(0x20a)]:String(_0x29db27);return console[_0x9d1d6c(0x15c)](_0x9d1d6c(0x1d8)+_0x34ff18),0x1;}const _0x4df3c3=createCommandSpinner(a26_0x49e31e['dim'](_0x9d1d6c(0x276)),{'verbose':_0x4451e7['verbose']});_0x4df3c3[_0x9d1d6c(0x1b5)]();const _0x1d3098={'onProgress':_0x1af223=>{const _0x4f1441=_0x9d1d6c;_0x4df3c3[_0x4f1441(0x1d3)]=formatProgressMessage(_0x1af223);}};if(_0x4451e7['master'])_0x1d3098[_0x9d1d6c(0x160)]=!![];if(_0x4451e7[_0x9d1d6c(0x254)])_0x1d3098[_0x9d1d6c(0x254)]=!![];_0x4451e7[_0x9d1d6c(0x21e)]&&(_0x1d3098[_0x9d1d6c(0x21e)]=_0x4451e7['attribute']);_0x4451e7[_0x9d1d6c(0x1de)]&&(_0x1d3098[_0x9d1d6c(0x1de)]=_0x4451e7[_0x9d1d6c(0x1de)]);if(_0x4451e7['interval'])_0x1d3098[_0x9d1d6c(0x142)]=_0x4451e7[_0x9d1d6c(0x142)];let _0x10e00e;try{_0x10e00e=await _0xb363f9[_0x9d1d6c(0x21a)][_0x9d1d6c(0x1b4)](_0x373f28,_0x1d3098),_0x4df3c3[_0x9d1d6c(0x203)]();}catch(_0x13ba74){_0x4df3c3[_0x9d1d6c(0x203)]();throw _0x13ba74;}const _0x161c86=_0x4451e7[_0x9d1d6c(0x142)]||'-1d';return this[_0x9d1d6c(0x1df)](_0x10e00e,_0x1d3098,_0x14b0b1,_0x161c86),_0x10e00e['allValid']?0x0:0x1;}['displayValidateResults'](_0x3d6046,_0x3fc707,_0x27cbe9,_0x1afa94){const _0x103706=a26_0x5e5c22;console[_0x103706(0x15c)]('\x0a'+a26_0x49e31e['bold'](_0x103706(0x14d))+'\x20'+_0x3d6046[_0x103706(0x1c4)]),console[_0x103706(0x15c)]('═'[_0x103706(0x200)](0x3c)),this[_0x103706(0x146)](_0x3d6046);if(typeof _0x3fc707['attribute']===_0x103706(0x25a)){this[_0x103706(0x1d6)](_0x3d6046),this[_0x103706(0x16b)](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,_0x103706(0x21e),_0x3fc707[_0x103706(0x21e)]);return;}if(_0x3fc707['attribute']===!![]){this[_0x103706(0x1d6)](_0x3d6046),this[_0x103706(0x16b)](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,_0x103706(0x285));return;}if(typeof _0x3fc707[_0x103706(0x1de)]===_0x103706(0x25a)){this[_0x103706(0x12d)](_0x3d6046,_0x1afa94),this[_0x103706(0x16b)](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,'behavior',_0x3fc707[_0x103706(0x1de)]);return;}if(_0x3fc707[_0x103706(0x1de)]===!![]){this[_0x103706(0x12d)](_0x3d6046,_0x1afa94),this[_0x103706(0x16b)](_0x3d6046),this['displayPreviewHints'](_0x27cbe9,_0x1afa94,_0x103706(0x196));return;}this[_0x103706(0x1d6)](_0x3d6046),this['displayBehaviorsStats'](_0x3d6046,_0x1afa94),this[_0x103706(0x1b6)](_0x3d6046),this['displaySummary'](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,'all');}[a26_0x5e5c22(0x1b6)](_0x29c9cd){displayRealtimeValidation(_0x29c9cd);}['displayPreviewHints'](_0x399d8b,_0x3873d5,_0x9d8b8,_0x127b7d){const _0x593aa2=a26_0x5e5c22;console[_0x593aa2(0x15c)]('\x0a'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x25d)));const _0x1e1f54=_0x3873d5!==_0x593aa2(0x177)?_0x593aa2(0x21f)+_0x3873d5:'';if(_0x9d8b8===_0x593aa2(0x21e)&&_0x127b7d)console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e['dim'](_0x593aa2(0x1d5)+_0x399d8b+_0x593aa2(0x210)+_0x127b7d+'\x22'+_0x1e1f54));else{if(_0x9d8b8===_0x593aa2(0x1de)&&_0x127b7d)console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e['dim'](_0x593aa2(0x1d5)+_0x399d8b+'\x20--behavior\x20\x22'+_0x127b7d+'\x22'+_0x1e1f54));else(_0x9d8b8===_0x593aa2(0x285)||_0x9d8b8===_0x593aa2(0x270))&&console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x1d5)+_0x399d8b+_0x593aa2(0x1a2)+_0x1e1f54));}(_0x9d8b8==='behaviors'||_0x9d8b8===_0x593aa2(0x270))&&console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x1d5)+_0x399d8b+'\x20--behavior\x20\x22<name>\x22'+_0x1e1f54)),_0x9d8b8===_0x593aa2(0x270)&&console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x1d5)+_0x399d8b+_0x593aa2(0x1dc)+_0x1e1f54));}[a26_0x5e5c22(0x146)](_0x59a4f8){const _0x35bbce=a26_0x5e5c22,{master:_0xf4e2d9}=_0x59a4f8,_0x1e6a80=_0xf4e2d9['schemaValid']?a26_0x49e31e[_0x35bbce(0x256)]('✔'):a26_0x49e31e[_0x35bbce(0x1f7)]('✘');console[_0x35bbce(0x15c)]('\x0a'+a26_0x49e31e[_0x35bbce(0x25f)]('Master\x20Table')),console[_0x35bbce(0x15c)](_0x1e6a80+'\x20'+a26_0x49e31e[_0x35bbce(0x1a5)](_0xf4e2d9['database']+'.'+_0xf4e2d9[_0x35bbce(0x292)])),_0xf4e2d9['schemaValid']?_0xf4e2d9[_0x35bbce(0x17d)]!==undefined&&console[_0x35bbce(0x15c)]('\x20\x20'+a26_0x49e31e[_0x35bbce(0x25f)](_0x35bbce(0x1ef))+'\x20'+a26_0x49e31e[_0x35bbce(0x29a)](formatRows(_0xf4e2d9['rowCount']))):console['error']('\x20\x20'+a26_0x49e31e[_0x35bbce(0x1f7)]('Error:')+'\x20'+_0xf4e2d9[_0x35bbce(0x211)]);}['displayAttributesStats'](_0x2ffff2){const _0x41a5fb=a26_0x5e5c22;if(_0x2ffff2[_0x41a5fb(0x285)][_0x41a5fb(0x25b)]===0x0)return;console[_0x41a5fb(0x15c)]('\x0a'+a26_0x49e31e[_0x41a5fb(0x25f)](_0x41a5fb(0x1f3)));for(const _0x27b8d1 of _0x2ffff2[_0x41a5fb(0x285)]){const _0x4c9c19=_0x27b8d1[_0x41a5fb(0x166)]?a26_0x49e31e[_0x41a5fb(0x256)]('✔'):a26_0x49e31e['red']('✘');let _0xca5213='';if(_0x27b8d1['schemaValid']&&_0x27b8d1['matchedCount']!==undefined&&_0x27b8d1[_0x41a5fb(0x246)]!==undefined){const _0x347170=_0x27b8d1['coveragePercent'][_0x41a5fb(0x283)](0x1),_0x3c2eba=_0x27b8d1['coveragePercent']>=0x50?a26_0x49e31e[_0x41a5fb(0x256)]:_0x27b8d1[_0x41a5fb(0x246)]>=0x32?a26_0x49e31e[_0x41a5fb(0x247)]:a26_0x49e31e[_0x41a5fb(0x1f7)];_0xca5213='\x20'+a26_0x49e31e[_0x41a5fb(0x25f)](_0x41a5fb(0x223))+'\x20'+_0x3c2eba(_0x347170+'%')+'\x20('+formatRows(_0x27b8d1[_0x41a5fb(0x15f)])+_0x41a5fb(0x1d7);}console[_0x41a5fb(0x15c)](_0x4c9c19+'\x20'+a26_0x49e31e['bold'](_0x27b8d1['name'])+_0xca5213),console[_0x41a5fb(0x15c)]('\x20\x20'+a26_0x49e31e[_0x41a5fb(0x25f)](_0x41a5fb(0x1f6))+'\x20'+a26_0x49e31e[_0x41a5fb(0x1a5)](_0x27b8d1[_0x41a5fb(0x1b2)]+'.'+_0x27b8d1[_0x41a5fb(0x292)]));const _0x2471ea=_0x27b8d1[_0x41a5fb(0x1aa)]===_0x27b8d1['foreignKey']?a26_0x49e31e[_0x41a5fb(0x25f)]('Join\x20on:')+'\x20'+_0x27b8d1[_0x41a5fb(0x1aa)]:a26_0x49e31e['dim']('Join:')+'\x20'+_0x27b8d1['joinKey']+'\x20=\x20'+_0x27b8d1[_0x41a5fb(0x28d)];console[_0x41a5fb(0x15c)]('\x20\x20'+_0x2471ea),console[_0x41a5fb(0x15c)]('\x20\x20'+a26_0x49e31e['dim'](_0x41a5fb(0x229))),this[_0x41a5fb(0x155)](_0x27b8d1[_0x41a5fb(0x153)]),!_0x27b8d1['schemaValid']&&console[_0x41a5fb(0x15c)]('\x20\x20'+a26_0x49e31e[_0x41a5fb(0x1f7)](_0x41a5fb(0x129))+'\x20'+_0x27b8d1[_0x41a5fb(0x211)]);}}[a26_0x5e5c22(0x12d)](_0xb47f27,_0x8efe1){const _0x6efd4a=a26_0x5e5c22;if(_0xb47f27[_0x6efd4a(0x196)][_0x6efd4a(0x25b)]===0x0)return;console[_0x6efd4a(0x15c)]('\x0a'+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x27d))+'\x20'+a26_0x49e31e['dim']('('+_0x8efe1+')'));for(const _0x3be4f3 of _0xb47f27[_0x6efd4a(0x196)]){const _0x37c0b4=_0x3be4f3[_0x6efd4a(0x166)]?a26_0x49e31e[_0x6efd4a(0x256)]('✔'):a26_0x49e31e[_0x6efd4a(0x1f7)]('✘');let _0x10d639='';if(_0x3be4f3[_0x6efd4a(0x166)]&&_0x3be4f3[_0x6efd4a(0x26f)]!==undefined&&_0x3be4f3['totalEvents']!==undefined){const _0x40cb0b=_0x3be4f3[_0x6efd4a(0x140)]?.[_0x6efd4a(0x283)](0x1)||'?',_0x2e456e=(_0x3be4f3[_0x6efd4a(0x140)]??0x0)>=0x32?a26_0x49e31e['green']:(_0x3be4f3['customerPercent']??0x0)>=0x14?a26_0x49e31e[_0x6efd4a(0x247)]:a26_0x49e31e[_0x6efd4a(0x1f7)];_0x10d639='\x20'+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x22f))+'\x20'+_0x2e456e(formatRows(_0x3be4f3[_0x6efd4a(0x26f)]))+'\x20('+_0x40cb0b+_0x6efd4a(0x15e)+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x1fd))+'\x20'+a26_0x49e31e[_0x6efd4a(0x29a)](formatRows(_0x3be4f3[_0x6efd4a(0x1ce)]));}console[_0x6efd4a(0x15c)](_0x37c0b4+'\x20'+a26_0x49e31e[_0x6efd4a(0x1a5)](_0x3be4f3[_0x6efd4a(0x1c4)])+_0x10d639),console[_0x6efd4a(0x15c)]('\x20\x20'+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x1f6))+'\x20'+a26_0x49e31e[_0x6efd4a(0x1a5)](_0x3be4f3[_0x6efd4a(0x1b2)]+'.'+_0x3be4f3[_0x6efd4a(0x292)]));const _0x4792bd=_0x3be4f3[_0x6efd4a(0x1aa)]===_0x3be4f3[_0x6efd4a(0x28d)]?a26_0x49e31e[_0x6efd4a(0x25f)]('Join\x20on:')+'\x20'+_0x3be4f3['joinKey']:a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x173))+'\x20'+_0x3be4f3[_0x6efd4a(0x1aa)]+_0x6efd4a(0x182)+_0x3be4f3['foreignKey'];console[_0x6efd4a(0x15c)]('\x20\x20'+_0x4792bd),console[_0x6efd4a(0x15c)]('\x20\x20'+a26_0x49e31e[_0x6efd4a(0x25f)]('Columns:')),this[_0x6efd4a(0x155)](_0x3be4f3[_0x6efd4a(0x153)]),!_0x3be4f3[_0x6efd4a(0x166)]&&console['error']('\x20\x20'+a26_0x49e31e['red'](_0x6efd4a(0x129))+'\x20'+_0x3be4f3[_0x6efd4a(0x211)]);}}[a26_0x5e5c22(0x155)](_0x379fa6){const _0x71bd7c=a26_0x5e5c22;for(const _0x25cfa3 of _0x379fa6){_0x25cfa3[_0x71bd7c(0x11a)]===_0x25cfa3[_0x71bd7c(0x1db)]||_0x25cfa3[_0x71bd7c(0x1db)]==='*'?console[_0x71bd7c(0x15c)](_0x71bd7c(0x26a)+_0x25cfa3[_0x71bd7c(0x11a)]):console[_0x71bd7c(0x15c)](_0x71bd7c(0x26a)+_0x25cfa3[_0x71bd7c(0x11a)]+'\x20'+a26_0x49e31e['dim']('('+_0x25cfa3[_0x71bd7c(0x1db)]+')'));}}[a26_0x5e5c22(0x16b)](_0x1a862b){const _0x3e330c=a26_0x5e5c22;console[_0x3e330c(0x15c)]('─'[_0x3e330c(0x200)](0x3c));if(_0x1a862b[_0x3e330c(0x286)][_0x3e330c(0x25b)]>0x0){console[_0x3e330c(0x15c)]('\x0a'+a26_0x49e31e[_0x3e330c(0x1f7)]('Errors:'));for(const _0x44bf8d of _0x1a862b[_0x3e330c(0x286)]){console[_0x3e330c(0x15c)]('\x20\x20'+a26_0x49e31e[_0x3e330c(0x1f7)]('•')+'\x20'+_0x44bf8d);}}_0x1a862b[_0x3e330c(0x16c)]&&console[_0x3e330c(0x15c)]('\x0a'+a26_0x49e31e['green']('✔')+'\x20Configuration\x20is\x20valid');}}function a26_0x147c(_0x51c086,_0x1338ff){_0x51c086=_0x51c086-0x11a;const _0x773967=a26_0x7739();let _0x147cb3=_0x773967[_0x51c086];return _0x147cb3;}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a26_0x5e5c22(0x20d);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x228);async['execute'](_0x2c9458){const _0x3d992c=a26_0x5e5c22,{options:_0xfd02b,args:_0x2b5191,tdx:_0x58324f}=_0x2c9458,_0xcbce4d=_0xfd02b,_0x49dc11=_0x2b5191[0x0]||_0xfd02b[_0x3d992c(0x1c5)];if(!_0x49dc11)return showParentSegmentNotSetError(_0x3d992c(0x201)+_0x3d992c(0x159)+'Options\x20(one\x20required):\x0a'+_0x3d992c(0x12e)+_0x3d992c(0x1c8)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x3d992c(0x19c)),0x1;if(!_0xcbce4d[_0x3d992c(0x160)]&&!_0xcbce4d[_0x3d992c(0x21e)]&&!_0xcbce4d[_0x3d992c(0x1de)]&&!_0xcbce4d[_0x3d992c(0x254)])return console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x293))),console['error']('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x3d992c(0x15c)](_0x3d992c(0x197)),console[_0x3d992c(0x15c)](_0x3d992c(0x248)),console[_0x3d992c(0x15c)](_0x3d992c(0x206)),console['error'](_0x3d992c(0x257)),console[_0x3d992c(0x15c)](_0x3d992c(0x139)),0x1;const _0x1968f8=resolveYamlFile(_0x49dc11);if(!existsSync(_0x1968f8))return showFileNotFoundError(_0x1968f8,_0x49dc11),0x1;_0xcbce4d[_0x3d992c(0x1cc)]&&(console[_0x3d992c(0x15c)](_0x3d992c(0x25c)+_0xcbce4d[_0x3d992c(0x28b)]),console['error'](_0x3d992c(0x204)+_0x1968f8));let _0x34ce8c;try{_0x34ce8c=readFileSync(_0x1968f8,_0x3d992c(0x121));}catch(_0x4ab1bc){const _0xd452d1=_0x4ab1bc instanceof Error?_0x4ab1bc[_0x3d992c(0x20a)]:String(_0x4ab1bc);return console[_0x3d992c(0x15c)](_0x3d992c(0x1d8)+_0xd452d1),0x1;}let _0x1744fb;try{_0x1744fb=parseDef(_0x34ce8c);}catch(_0x1d5616){const _0x36093d=_0x1d5616 instanceof Error?_0x1d5616[_0x3d992c(0x20a)]:String(_0x1d5616);return console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x1ad)+_0x36093d)),0x1;}if(_0xcbce4d[_0x3d992c(0x21e)]===!![]||_0xcbce4d['attribute']===''){const _0xa80e22=_0x1744fb[_0x3d992c(0x285)]?.[_0x3d992c(0x295)](_0xc5df52=>_0xc5df52['name'])||[];if(_0xa80e22['length']===0x0)console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x1bb)));else{console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x135))),console[_0x3d992c(0x15c)]('Available\x20attributes:');for(const _0x240ea5 of _0xa80e22){console[_0x3d992c(0x15c)]('\x20\x20'+a26_0x49e31e[_0x3d992c(0x29a)](_0x240ea5));}console[_0x3d992c(0x15c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x49dc11+_0x3d992c(0x210)+_0xa80e22[0x0]+'\x22');}return 0x1;}if(_0xcbce4d['behavior']===!![]||_0xcbce4d[_0x3d992c(0x1de)]===''){const _0x3e5686=_0x1744fb[_0x3d992c(0x196)]?.[_0x3d992c(0x295)](_0x32112c=>_0x32112c[_0x3d992c(0x1c4)])||[];if(_0x3e5686[_0x3d992c(0x25b)]===0x0)console['error'](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x222)));else{console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x3d992c(0x15c)](_0x3d992c(0x195));for(const _0x4a58c7 of _0x3e5686){console[_0x3d992c(0x15c)]('\x20\x20'+a26_0x49e31e[_0x3d992c(0x29a)](_0x4a58c7));}console[_0x3d992c(0x15c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x49dc11+'\x20--behavior\x20\x22'+_0x3e5686[0x0]+'\x22');}return 0x1;}const _0x5c5944=createCommandSpinner(a26_0x49e31e[_0x3d992c(0x25f)](_0x3d992c(0x241)),{'verbose':_0xcbce4d[_0x3d992c(0x1cc)]});_0x5c5944['start']();const _0x5e0400={'onProgress':_0x208552=>{_0x5c5944['text']=formatProgressMessage(_0x208552);}};if(_0xcbce4d['master'])_0x5e0400[_0x3d992c(0x160)]=!![];if(_0xcbce4d[_0x3d992c(0x21e)]&&typeof _0xcbce4d[_0x3d992c(0x21e)]==='string')_0x5e0400[_0x3d992c(0x21e)]=_0xcbce4d[_0x3d992c(0x21e)];if(_0xcbce4d['behavior']&&typeof _0xcbce4d[_0x3d992c(0x1de)]===_0x3d992c(0x25a))_0x5e0400['behavior']=_0xcbce4d[_0x3d992c(0x1de)];if(_0xcbce4d[_0x3d992c(0x254)])_0x5e0400[_0x3d992c(0x254)]=!![];if(_0xcbce4d[_0x3d992c(0x142)])_0x5e0400[_0x3d992c(0x142)]=_0xcbce4d[_0x3d992c(0x142)];let _0x3b4059;try{_0x3b4059=await _0x58324f[_0x3d992c(0x21a)]['previewParentYaml'](_0x34ce8c,_0x5e0400),_0x5c5944[_0x3d992c(0x203)]();}catch(_0x347623){_0x5c5944[_0x3d992c(0x203)]();throw _0x347623;}return await this[_0x3d992c(0x144)](_0x3b4059,{'master':_0xcbce4d[_0x3d992c(0x160)],'attribute':typeof _0xcbce4d[_0x3d992c(0x21e)]===_0x3d992c(0x25a)?_0xcbce4d[_0x3d992c(0x21e)]:undefined,'behavior':typeof _0xcbce4d[_0x3d992c(0x1de)]===_0x3d992c(0x25a)?_0xcbce4d[_0x3d992c(0x1de)]:undefined,'enriched':_0xcbce4d['enriched']}),_0x3b4059[_0x3d992c(0x16c)]?0x0:0x1;}async[a26_0x5e5c22(0x144)](_0xc3e4f,_0x1be758){const _0x7adf2d=a26_0x5e5c22;console[_0x7adf2d(0x15c)]('\x0a'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0x7adf2d(0x18b))+'\x20'+_0xc3e4f['name']),console[_0x7adf2d(0x15c)]('═'[_0x7adf2d(0x200)](0x3c));if(_0x1be758[_0x7adf2d(0x160)]&&_0xc3e4f[_0x7adf2d(0x13b)]){const _0x5a6940=a26_0x49e31e['dim'](_0x7adf2d(0x236))+'\x20'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0xc3e4f[_0x7adf2d(0x160)][_0x7adf2d(0x1b2)]+'.'+_0xc3e4f[_0x7adf2d(0x160)]['table']);await this[_0x7adf2d(0x299)](_0x5a6940,_0xc3e4f[_0x7adf2d(0x13b)]);}else{if(_0x1be758['attribute']&&_0xc3e4f['sampleData']){const _0x10fb76=a26_0x49e31e[_0x7adf2d(0x25f)](_0x7adf2d(0x227))+'\x20'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0x1be758[_0x7adf2d(0x21e)]);await this[_0x7adf2d(0x299)](_0x10fb76,_0xc3e4f[_0x7adf2d(0x13b)]);}else{if(_0x1be758['behavior']&&_0xc3e4f[_0x7adf2d(0x13b)]){const _0x408cc7=a26_0x49e31e['dim'](_0x7adf2d(0x13e))+'\x20'+a26_0x49e31e['bold'](_0x1be758[_0x7adf2d(0x1de)]);await this[_0x7adf2d(0x299)](_0x408cc7,_0xc3e4f['sampleData']);}else{if(_0x1be758[_0x7adf2d(0x254)]&&_0xc3e4f[_0x7adf2d(0x13b)]){const _0x1f9a4f=a26_0x49e31e['dim'](_0x7adf2d(0x149))+'\x20'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0x7adf2d(0x278));await this['displaySampleData'](_0x1f9a4f,_0xc3e4f[_0x7adf2d(0x13b)]);}else!_0xc3e4f[_0x7adf2d(0x13b)]&&console[_0x7adf2d(0x15c)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0xc3e4f['errors']['length']>0x0){console[_0x7adf2d(0x15c)]('─'[_0x7adf2d(0x200)](0x3c)),console[_0x7adf2d(0x15c)]('\x0a'+a26_0x49e31e[_0x7adf2d(0x1f7)]('Errors:'));for(const _0x87e025 of _0xc3e4f[_0x7adf2d(0x286)]){console[_0x7adf2d(0x15c)]('\x20\x20'+a26_0x49e31e[_0x7adf2d(0x1f7)]('•')+'\x20'+_0x87e025);}}}async[a26_0x5e5c22(0x299)](_0x422257,_0x41b67f){const _0x154120=a26_0x5e5c22;if(_0x41b67f[_0x154120(0x25b)]===0x0){console[_0x154120(0x15c)]('\x0a'+_0x422257),console[_0x154120(0x15c)](_0x154120(0x23a));return;}console[_0x154120(0x15c)]('\x0a'+_0x422257);const _0x5a7274=Object[_0x154120(0x225)](_0x41b67f[0x0])[_0x154120(0x295)](_0x3f4b90=>({'name':_0x3f4b90,'type':typeof _0x41b67f[0x0][_0x3f4b90]===_0x154120(0x12f)?_0x154120(0x23c):_0x154120(0x1a4)})),_0x39fd0b={'queryId':_0x154120(0x16a),'columns':_0x5a7274,'data':_0x41b67f,'stats':{'state':_0x154120(0x217),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x41b67f['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5143e=formatAsTable(_0x39fd0b,_0x41b67f[_0x154120(0x25b)],!![]);await writeOutput(_0x5143e,undefined,_0x154120(0x292));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]='segment:parent:run';[a26_0x5e5c22(0x14f)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a26_0x5e5c22(0x1f2)](_0x47ad2c){const _0x33d0a5=a26_0x5e5c22,{options:_0x1dda77,args:_0x5ef555,tdx:_0x32c6ca}=_0x47ad2c,_0x70e659=_0x1dda77,_0x3bb30e=_0x5ef555[0x0]||_0x1dda77[_0x33d0a5(0x1c5)];if(!_0x3bb30e)return showParentSegmentNotSetError(_0x33d0a5(0x1cf)+_0x33d0a5(0x181)),0x1;const _0x390acc=resolveYamlFile(_0x3bb30e);if(existsSync(_0x390acc)){_0x70e659['verbose']&&console[_0x33d0a5(0x15c)]('Found\x20YAML\x20file:\x20'+_0x390acc);let _0x586395;try{_0x586395=readFileSync(_0x390acc,'utf-8');}catch(_0x372409){const _0x5d937b=_0x372409 instanceof Error?_0x372409[_0x33d0a5(0x20a)]:String(_0x372409);return console[_0x33d0a5(0x15c)]('Error\x20reading\x20file:\x20'+_0x5d937b),0x1;}const _0x5d7b70=await withSpinner(_0x33d0a5(0x1a6),()=>_0x32c6ca[_0x33d0a5(0x21a)]['pushParentYaml'](_0x586395),{'verbose':_0x70e659[_0x33d0a5(0x1cc)]}),_0x24d5f0=_0x5d7b70[_0x33d0a5(0x27c)],{isNew:_0xac6679,name:_0x2acca9,hasChanges:_0x43602a,diffFormatted:_0x14d39a}=_0x24d5f0;if(_0x43602a){_0xac6679?console[_0x33d0a5(0x15c)](_0x33d0a5(0x1a0)+_0x2acca9+'\x27:'):console[_0x33d0a5(0x15c)](_0x33d0a5(0x23e)+_0x2acca9+'\x27:');console[_0x33d0a5(0x15c)]('─'[_0x33d0a5(0x200)](0x3c)),console['error'](_0x14d39a),console[_0x33d0a5(0x15c)]('─'['repeat'](0x3c));const _0x5dc412=_0xac6679?_0x33d0a5(0x194)+_0x2acca9+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x2acca9+_0x33d0a5(0x259);if(!_0x70e659[_0x33d0a5(0x294)]){if(!isInteractive())return console[_0x33d0a5(0x15c)](a26_0x49e31e[_0x33d0a5(0x1f7)](_0x33d0a5(0x151)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x33d0a5(0x15c)](a26_0x49e31e[_0x33d0a5(0x25f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1ece98=await confirmKey(_0x5dc412);if(!_0x1ece98)return console[_0x33d0a5(0x15c)](a26_0x49e31e['yellow'](_0x33d0a5(0x265))),0x1;}const _0x251fbf=_0xac6679?'Creating':_0x33d0a5(0x24b);await withSpinner(_0x251fbf+_0x33d0a5(0x281)+_0x2acca9+'\x27...',()=>_0x24d5f0[_0x33d0a5(0x238)](),{'verbose':_0x70e659[_0x33d0a5(0x1cc)]});const _0x1e8341=_0xac6679?_0x33d0a5(0x185):_0x33d0a5(0x216);console[_0x33d0a5(0x15c)]('✔\x20'+_0x1e8341+_0x33d0a5(0x281)+_0x2acca9+'\x27');}else console[_0x33d0a5(0x15c)](_0x33d0a5(0x147)+_0x2acca9+_0x33d0a5(0x1a1));}const _0x8a70a1=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x3bb30e+_0x33d0a5(0x263),()=>_0x32c6ca[_0x33d0a5(0x21a)][_0x33d0a5(0x1a3)](_0x3bb30e),{'verbose':_0x70e659[_0x33d0a5(0x1cc)]}),_0x4599fb=_0x8a70a1[_0x33d0a5(0x27c)],_0x8058d2=getConsoleUrl(_0x70e659['site'],_0x33d0a5(0x215)+_0x4599fb['workflowId']+_0x33d0a5(0x1f5)+_0x4599fb[_0x33d0a5(0x24a)]+_0x33d0a5(0x279)+_0x4599fb['workflowAttemptId']);return console['error'](_0x33d0a5(0x126)),console['error']('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x249))+'\x20'+_0x4599fb[_0x33d0a5(0x1af)]),console[_0x33d0a5(0x15c)]('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x1b3))+'\x20'+_0x4599fb[_0x33d0a5(0x20e)]),console[_0x33d0a5(0x15c)]('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x167))+'\x20'+_0x4599fb[_0x33d0a5(0x24a)]),console[_0x33d0a5(0x15c)]('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)]('Attempt:')+'\x20'+_0x4599fb['workflowAttemptId']),console[_0x33d0a5(0x15c)]('\x20\x20'+_0x8058d2),console['error']('\x0a'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x1dd))+'\x20tdx\x20wf\x20attempt\x20'+_0x4599fb[_0x33d0a5(0x1fc)]+_0x33d0a5(0x154)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x21c);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x274);async[a26_0x5e5c22(0x1f2)](_0x5c694a){const _0x585149=a26_0x5e5c22,{options:_0x122677,args:_0x3eaca7,tdx:_0x4810d5}=_0x5c694a,_0x4b507e=_0x3eaca7[0x0]||_0x122677[_0x585149(0x1c5)];if(!_0x4b507e)return showParentSegmentNotSetError(_0x585149(0x1e4)+_0x585149(0x1cb)),0x1;_0x122677[_0x585149(0x1cc)]&&(console[_0x585149(0x15c)]('Site:\x20'+_0x122677[_0x585149(0x28b)]),console[_0x585149(0x15c)]('Parent\x20segment:\x20'+_0x4b507e));const _0x5626b5=await withSpinner(_0x585149(0x24c)+_0x4b507e+'\x27...',()=>_0x4810d5['segment']['listFields'](_0x4b507e),{'verbose':_0x122677[_0x585149(0x1cc)]}),_0x25925c=_0x5626b5[_0x585149(0x27c)];console[_0x585149(0x15c)](_0x585149(0x208)+_0x25925c[_0x585149(0x25b)]+_0x585149(0x239)+(_0x25925c[_0x585149(0x25b)]!==0x1?'s':''));if(_0x122677[_0x585149(0x1ba)]||_0x122677['jsonl'])return await handleSDKOutput(_0x25925c,_0x122677),0x0;return displayFieldsHumanReadable(_0x25925c,_0x4b507e),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a26_0x5e5c22(0x1d1);[a26_0x5e5c22(0x14f)]='Show\x20parent\x20segment\x20details';async['execute'](_0x4234ae){const _0x1e5418=a26_0x5e5c22,{options:_0xea96ab,args:_0x3e5171,tdx:_0x5ceadb}=_0x4234ae,_0x98df10=_0xea96ab,_0x14b440=_0x3e5171[0x0]||_0xea96ab[_0x1e5418(0x1c5)];if(!_0x14b440)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'+_0x1e5418(0x164)+_0x1e5418(0x13c)+_0x1e5418(0x1bd)),0x1;_0xea96ab[_0x1e5418(0x1cc)]&&(console['error']('Site:\x20'+_0xea96ab[_0x1e5418(0x28b)]),console['error']('Parent\x20segment:\x20'+_0x14b440));const _0x20fe82=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x14b440+_0x1e5418(0x263),()=>_0x5ceadb[_0x1e5418(0x21a)][_0x1e5418(0x252)](_0x14b440),{'verbose':_0xea96ab[_0x1e5418(0x1cc)]}),_0x5de4f9=_0x20fe82[_0x1e5418(0x27c)];if(_0x98df10[_0x1e5418(0x220)]){const _0x1e907c=getConsoleNextUrl(_0x98df10[_0x1e5418(0x28b)],_0x1e5418(0x122)+_0x5de4f9['id']);return console[_0x1e5418(0x15c)](a26_0x49e31e[_0x1e5418(0x256)]('✔')+_0x1e5418(0x15a)+a26_0x49e31e[_0x1e5418(0x29a)](_0x1e907c)),openBrowser(_0x1e907c),0x0;}return await handleSingleObjectOutput(_0x5de4f9,_0xea96ab),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x253);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x20b);async['execute'](_0x1f5082){const _0x21bdeb=a26_0x5e5c22,{options:_0xcb4b0c,args:_0x18789f,tdx:_0x75cbe9}=_0x1f5082,_0x2d01fc=_0xcb4b0c,_0x134bba=_0x18789f[0x0]||_0xcb4b0c[_0x21bdeb(0x1c5)];if(!_0x134bba)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a'+_0x21bdeb(0x187)+_0x21bdeb(0x13c)+_0x21bdeb(0x134)),0x1;_0xcb4b0c[_0x21bdeb(0x1cc)]&&(console[_0x21bdeb(0x15c)](_0x21bdeb(0x25c)+_0xcb4b0c[_0x21bdeb(0x28b)]),console[_0x21bdeb(0x15c)](_0x21bdeb(0x1ff)+_0x134bba));const _0x45e07d=await withSpinner(_0x21bdeb(0x1d4)+_0x134bba+_0x21bdeb(0x263),()=>_0x75cbe9['segment'][_0x21bdeb(0x1ac)](_0x134bba),{'verbose':_0xcb4b0c[_0x21bdeb(0x1cc)]}),_0x30d424=_0x45e07d[_0x21bdeb(0x27c)],_0x2ab141=_0x75cbe9[_0x21bdeb(0x21a)]['getOutputDatabaseName'](_0x30d424);if(_0x2d01fc[_0x21bdeb(0x12c)]){const _0x4a5125=await this[_0x21bdeb(0x128)](_0x1f5082,_0x134bba,_0x30d424,_0x2ab141),_0x1c6c37=this[_0x21bdeb(0x180)](_0x4a5125);writeFileSync(_0x2d01fc[_0x21bdeb(0x12c)],_0x1c6c37);const _0x2b3800=_0x4a5125['customers']['columns'][_0x21bdeb(0x25b)]+_0x4a5125[_0x21bdeb(0x196)]['reduce']((_0x3143bd,_0x3ce0e9)=>_0x3143bd+_0x3ce0e9[_0x21bdeb(0x153)][_0x21bdeb(0x25b)],0x0),_0x1459ea=_0x4a5125[_0x21bdeb(0x196)]['filter'](_0x6f5cee=>_0x6f5cee[_0x21bdeb(0x153)][_0x21bdeb(0x25b)]===0x0)['length'];return console[_0x21bdeb(0x282)](_0x21bdeb(0x20f)+_0x2d01fc['output']),console[_0x21bdeb(0x282)](_0x21bdeb(0x1cd)+_0x2ab141),console[_0x21bdeb(0x282)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x4a5125[_0x21bdeb(0x196)]['length']+_0x21bdeb(0x288)),console[_0x21bdeb(0x282)]('\x20\x20Columns:\x20'+_0x2b3800+'\x20total'),_0x1459ea>0x0&&console[_0x21bdeb(0x282)]('\x20\x20Note:\x20'+_0x1459ea+_0x21bdeb(0x28a)),0x0;}console['error']('\x0a'+a26_0x49e31e[_0x21bdeb(0x1a5)](_0x21bdeb(0x132))+'\x20'+a26_0x49e31e[_0x21bdeb(0x29a)](_0x2ab141));const _0x51d3a1=await withSpinner(_0x21bdeb(0x19b),()=>_0x75cbe9[_0x21bdeb(0x21a)]['getParentSQL'](_0x30d424),{'verbose':_0xcb4b0c[_0x21bdeb(0x1cc)]});console[_0x21bdeb(0x15c)]('\x0a'+a26_0x49e31e[_0x21bdeb(0x1a5)](_0x21bdeb(0x168))+'\x20'+a26_0x49e31e['dim']('('+_0x2ab141+'.customers)'));const _0x15f5bb=await executeSchemaQuery(_0x51d3a1[_0x21bdeb(0x27c)],_0x75cbe9,_0xcb4b0c);await handleQueryOutput(_0x15f5bb,_0xcb4b0c);const _0x70ea23=await withSpinner(_0x21bdeb(0x13d),()=>_0x75cbe9[_0x21bdeb(0x21a)][_0x21bdeb(0x209)](_0x30d424),{'verbose':_0xcb4b0c[_0x21bdeb(0x1cc)]});for(const _0x5e04f3 of _0x70ea23['data']){const _0x498a0a=_0x21bdeb(0x212)+_0x5e04f3[_0x21bdeb(0x125)]()[_0x21bdeb(0x245)](/\s+/g,'_'),_0x324db5=_0x21bdeb(0x161)+_0x2ab141+'.'+_0x498a0a;console[_0x21bdeb(0x15c)]('\x0a'+a26_0x49e31e[_0x21bdeb(0x1a5)](_0x5e04f3)+'\x20'+a26_0x49e31e[_0x21bdeb(0x25f)]('('+_0x2ab141+'.'+_0x498a0a+')'));try{const _0x14aec2=await executeSchemaQuery(_0x324db5,_0x75cbe9,_0xcb4b0c);await handleQueryOutput(_0x14aec2,_0xcb4b0c);}catch{console['error'](a26_0x49e31e[_0x21bdeb(0x247)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a26_0x5e5c22(0x128)](_0x299354,_0x1dc700,_0x4249e8,_0xe3bc13){const _0x53d8ca=a26_0x5e5c22,{options:_0x5a4ac0,tdx:_0x309a0f}=_0x299354,_0xa987d7=await withSpinner(_0x53d8ca(0x19b),()=>_0x309a0f[_0x53d8ca(0x21a)]['getParentSQL'](_0x4249e8),{'verbose':_0x5a4ac0[_0x53d8ca(0x1cc)]}),_0x45ece3=await executeSchemaQuery(_0xa987d7['data'],_0x309a0f,_0x5a4ac0),_0x18f0fb=_0x45ece3[_0x53d8ca(0x27c)][_0x53d8ca(0x295)](_0x3bd368=>({'name':_0x3bd368['column_name'],'type':_0x3bd368[_0x53d8ca(0x1d9)]})),_0x23a499=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x309a0f[_0x53d8ca(0x21a)][_0x53d8ca(0x209)](_0x4249e8),{'verbose':_0x5a4ac0[_0x53d8ca(0x1cc)]}),_0x86b256=[];for(const _0x21e340 of _0x23a499[_0x53d8ca(0x27c)]){const _0x36f53e=_0x53d8ca(0x212)+_0x21e340[_0x53d8ca(0x125)]()['replace'](/\s+/g,'_'),_0x687154=_0x53d8ca(0x161)+_0xe3bc13+'.'+_0x36f53e;let _0x799212=[];try{const _0x2cf3b5=await executeSchemaQuery(_0x687154,_0x309a0f,_0x5a4ac0);_0x799212=_0x2cf3b5[_0x53d8ca(0x27c)]['map'](_0x2bf25a=>({'name':_0x2bf25a['column_name'],'type':_0x2bf25a['column_type']}));}catch{}_0x86b256['push']({'table':_0x36f53e,'columns':_0x799212});}return{'database':_0xe3bc13,'parent_segment':_0x1dc700,'parent_id':_0x4249e8,'customers':{'table':_0x53d8ca(0x168),'columns':_0x18f0fb},'behaviors':_0x86b256};}[a26_0x5e5c22(0x180)](_0x2d9a61){const _0x24d17b=a26_0x5e5c22,_0x5e4f25=_0xa8f53=>{const _0x1ac7f4=a26_0x147c;if(_0xa8f53[_0x1ac7f4(0x25b)]===0x0)return'[]';const _0x12245f=_0xa8f53['map'](_0x53813d=>_0x1ac7f4(0x171)+_0x53813d[_0x1ac7f4(0x1c4)]+_0x1ac7f4(0x26b)+_0x53813d['type']+_0x1ac7f4(0x243));return'[\x0a'+_0x12245f['join'](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0xe17010=_0x2d9a61[_0x24d17b(0x196)][_0x24d17b(0x295)](_0x27001b=>{const _0x4ce331=_0x24d17b;return _0x4ce331(0x13a)+_0x27001b['table']+_0x4ce331(0x218)+_0x5e4f25(_0x27001b[_0x4ce331(0x153)])[_0x4ce331(0x245)](/^/gm,'\x20\x20')['trim']()+_0x4ce331(0x234);})[_0x24d17b(0x1e9)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x2d9a61[_0x24d17b(0x1b2)]+_0x24d17b(0x176)+_0x2d9a61[_0x24d17b(0x28f)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x2d9a61[_0x24d17b(0x133)]+_0x24d17b(0x205)+_0x2d9a61[_0x24d17b(0x168)]['table']+_0x24d17b(0x202)+_0x5e4f25(_0x2d9a61['customers'][_0x24d17b(0x153)])[_0x24d17b(0x245)](/^/gm,'\x20\x20')[_0x24d17b(0x1e7)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0xe17010+_0x24d17b(0x1c6);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x1eb);['description']=a26_0x5e5c22(0x23d);async[a26_0x5e5c22(0x1f2)](_0x4e0393){const _0x11878f=a26_0x5e5c22,{options:_0x55ec7c,args:_0xbd6af8,tdx:_0x14eeac}=_0x4e0393,_0x5bdad0=_0xbd6af8[0x0]||_0x55ec7c[_0x11878f(0x1c5)];if(!_0x5bdad0)return showParentSegmentNotSetError(_0x11878f(0x23f)+_0x11878f(0x1f1)),0x1;_0x55ec7c[_0x11878f(0x1cc)]&&(console[_0x11878f(0x15c)](_0x11878f(0x25c)+_0x55ec7c[_0x11878f(0x28b)]),console[_0x11878f(0x15c)](_0x11878f(0x1ff)+_0x5bdad0));const _0x58b0a9=await withSpinner(_0x11878f(0x1d4)+_0x5bdad0+_0x11878f(0x263),()=>_0x14eeac[_0x11878f(0x21a)]['resolveParentId'](_0x5bdad0),{'verbose':_0x55ec7c[_0x11878f(0x1cc)]}),_0x4bad99=_0x58b0a9[_0x11878f(0x27c)],_0x213961=await withSpinner(_0x11878f(0x235)+_0x5bdad0+_0x11878f(0x263),()=>_0x14eeac['segment'][_0x11878f(0x12b)](_0x4bad99),{'verbose':_0x55ec7c[_0x11878f(0x1cc)]}),_0x192d94=_0x213961[_0x11878f(0x27c)];return _0x55ec7c[_0x11878f(0x179)]===_0x11878f(0x1ba)||_0x55ec7c['format']==='jsonl'?await handleSDKOutput([{'sql':_0x192d94}],_0x55ec7c):console['log'](_0x192d94),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a26_0x5e5c22(0x158);[a26_0x5e5c22(0x14f)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a26_0x5e5c22(0x1f2)](_0x443bb8){const _0x38e883=a26_0x5e5c22,{options:_0xc7fcf,args:_0x1c0546,tdx:_0x74af86}=_0x443bb8,_0x5d15a8=_0x1c0546[0x0]||_0xc7fcf[_0x38e883(0x1c5)];if(!_0x5d15a8)return showParentSegmentNotSetError(_0x38e883(0x1b0)+_0x38e883(0x1e8)),0x1;_0xc7fcf[_0x38e883(0x1cc)]&&(console['error'](_0x38e883(0x25c)+_0xc7fcf[_0x38e883(0x28b)]),console['error'](_0x38e883(0x1ff)+_0x5d15a8));const _0x1e73ca=await withSpinner(_0x38e883(0x1d4)+_0x5d15a8+_0x38e883(0x263),()=>_0x74af86['segment'][_0x38e883(0x1ac)](_0x5d15a8),{'verbose':_0xc7fcf[_0x38e883(0x1cc)]}),_0x27746b=_0x1e73ca[_0x38e883(0x27c)],_0x635776=await withSpinner(_0x38e883(0x235)+_0x5d15a8+_0x38e883(0x263),()=>_0x74af86[_0x38e883(0x21a)][_0x38e883(0x12b)](_0x27746b),{'verbose':_0xc7fcf[_0x38e883(0x1cc)]});let _0x2adae4=_0x635776[_0x38e883(0x27c)];const _0x27c8ce=resolveLimit(_0xc7fcf[_0x38e883(0x137)],DEFAULT_DISPLAY_LIMIT),_0x19f139=/\bLIMIT\s+\d+/i[_0x38e883(0x1b1)](_0x2adae4);!_0x19f139&&(_0x2adae4=_0x2adae4[_0x38e883(0x1e7)]()[_0x38e883(0x245)](/;+$/,''),_0x2adae4='SELECT\x20*\x20FROM\x20(\x0a'+_0x2adae4+_0x38e883(0x19a)+_0x27c8ce);_0xc7fcf[_0x38e883(0x1cc)]&&console[_0x38e883(0x15c)](_0x38e883(0x27e)+_0x2adae4);const _0x31f7e5=await withProgressSpinner(_0x38e883(0x14c),async _0x33a70a=>{const _0x352136=_0x38e883,_0x185cb5=await _0x74af86['query'][_0x352136(0x1f2)](_0x2adae4,{'catalog':'td','schema':_0x352136(0x1e6),'onJobId':_0x233217=>{const _0x3dbc92=_0x352136;_0x33a70a[_0x3dbc92(0x11b)](_0x233217);}});return _0x185cb5;},{'verbose':_0xc7fcf[_0x38e883(0x1cc)]}),_0x11fa8c=_0x31f7e5[_0x38e883(0x27c)],_0x354ce2=_0x11fa8c[_0x38e883(0x11c)]?_0x38e883(0x237)+_0x11fa8c[_0x38e883(0x11c)]+']':'';return console[_0x38e883(0x15c)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x11fa8c['stats'][_0x38e883(0x163)]['toLocaleString']()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x11fa8c[_0x38e883(0x207)][_0x38e883(0x275)])+_0x354ce2)),await handleQueryOutput(_0x11fa8c,_0xc7fcf),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x1d0);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x192);async[a26_0x5e5c22(0x1f2)](_0x4ff725){const _0x50dcaa=a26_0x5e5c22,{options:_0x51dfd3,args:_0x1b0965,tdx:_0x3b8b77}=_0x4ff725,_0x450fb8=_0x1b0965[0x0],_0x1baf84=await withSpinner(_0x450fb8?_0x50dcaa(0x14a)+_0x450fb8+_0x50dcaa(0x263):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x3b8b77['realtime'][_0x50dcaa(0x174)](),{'verbose':_0x51dfd3[_0x50dcaa(0x1cc)]});let _0xf74ac8=_0x1baf84[_0x50dcaa(0x27c)][_0x50dcaa(0x145)](_0x45ca71=>_0x45ca71[_0x50dcaa(0x152)]);if(_0x450fb8){const _0x3bf9ef=_0x450fb8[_0x50dcaa(0x245)](/[.+^${}()|[\]\\]/g,_0x50dcaa(0x123))[_0x50dcaa(0x245)](/\*/g,'.*')[_0x50dcaa(0x245)](/\?/g,'.'),_0xf6314e=new RegExp('^'+_0x3bf9ef+'$','i');_0xf74ac8=_0xf74ac8[_0x50dcaa(0x145)](_0x2305fb=>_0xf6314e[_0x50dcaa(0x1b1)](_0x2305fb[_0x50dcaa(0x1c4)]));}_0xf74ac8[_0x50dcaa(0x22a)]((_0x57a95c,_0x3dd451)=>_0x57a95c[_0x50dcaa(0x1c4)]['localeCompare'](_0x3dd451['name'])),console[_0x50dcaa(0x15c)](_0x50dcaa(0x208)+_0xf74ac8[_0x50dcaa(0x25b)]+_0x50dcaa(0x130)+(_0xf74ac8['length']!==0x1?'s':''));const _0x42246e=_0x1a614a=>{const _0x136512=_0x50dcaa;return getConsoleNextUrl(_0x51dfd3[_0x136512(0x28b)],_0x136512(0x122)+_0x1a614a);};if(_0x51dfd3[_0x50dcaa(0x179)]===_0x50dcaa(0x1ba)||_0x51dfd3[_0x50dcaa(0x179)]===_0x50dcaa(0x1f9)){const _0xfa5541=_0xf74ac8[_0x50dcaa(0x295)](_0x375a05=>({..._0x375a05,'url':_0x42246e(_0x375a05['id'])}));await handleSDKOutput(_0xfa5541,_0x51dfd3);}else{if(_0xf74ac8[_0x50dcaa(0x25b)]===0x0)console[_0x50dcaa(0x282)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0x35a18f of _0xf74ac8){const _0x500f4f=_0x35a18f[_0x50dcaa(0x264)]?a26_0x49e31e[_0x50dcaa(0x25f)]('\x20('+formatRows(_0x35a18f[_0x50dcaa(0x264)])+')'):'',_0x2fe474=hyperlink(_0x35a18f[_0x50dcaa(0x1c4)],_0x42246e(_0x35a18f['id']));console[_0x50dcaa(0x282)]('⚡\x20'+_0x2fe474+_0x500f4f);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x138);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x232);async[a26_0x5e5c22(0x1f2)](_0x1c04ec){const _0x864311=a26_0x5e5c22,{options:_0x4054e5,args:_0x21496e,tdx:_0xa57f57}=_0x1c04ec,_0x9cbf28=_0x21496e[0x0]||_0x4054e5[_0x864311(0x1c5)];if(!_0x9cbf28)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'+'\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'),0x1;const _0x1f4275=resolveYamlFile(_0x9cbf28);if(!existsSync(_0x1f4275))return showFileNotFoundError(_0x1f4275,_0x9cbf28),0x1;let _0x1ecfb9;try{_0x1ecfb9=readFileSync(_0x1f4275,_0x864311(0x121));}catch(_0x1832da){const _0x1b8b15=_0x1832da instanceof Error?_0x1832da['message']:String(_0x1832da);return console[_0x864311(0x15c)](_0x864311(0x1d8)+_0x1b8b15),0x1;}const _0x1197c5=createCommandSpinner(a26_0x49e31e[_0x864311(0x25f)]('Validating\x20RT\x20configuration...'),{'verbose':_0x4054e5['verbose']});_0x1197c5['start']();const _0x3fbbfb={'realtime':!![],'onProgress':_0x2bb806=>{const _0x3822f4=_0x864311;_0x1197c5[_0x3822f4(0x1d3)]=formatProgressMessage(_0x2bb806);}};let _0x3320d9;try{_0x3320d9=await _0xa57f57['segment']['validateParentYaml'](_0x1ecfb9,_0x3fbbfb),_0x1197c5['stop']();}catch(_0xe2f16e){_0x1197c5[_0x864311(0x203)]();throw _0xe2f16e;}console[_0x864311(0x15c)]('\x0a'+a26_0x49e31e[_0x864311(0x1a5)](_0x864311(0x22b))+'\x20'+_0x3320d9[_0x864311(0x1c4)]),console[_0x864311(0x15c)]('═'[_0x864311(0x200)](0x3c)),displayRealtimeValidation(_0x3320d9),console['error']('─'[_0x864311(0x200)](0x3c));if(_0x3320d9[_0x864311(0x286)][_0x864311(0x25b)]>0x0){console[_0x864311(0x15c)]('\x0a'+a26_0x49e31e[_0x864311(0x1f7)]('Errors:'));for(const _0x41a0ba of _0x3320d9[_0x864311(0x286)]){console[_0x864311(0x15c)]('\x20\x20'+a26_0x49e31e[_0x864311(0x1f7)]('•')+'\x20'+_0x41a0ba);}}return _0x3320d9[_0x864311(0x16c)]&&console[_0x864311(0x15c)]('\x0a'+a26_0x49e31e[_0x864311(0x256)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x3320d9[_0x864311(0x16c)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x162);[a26_0x5e5c22(0x14f)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a26_0x5e5c22(0x1f2)](_0x1d5c0d){const _0x19c36a=a26_0x5e5c22,{options:_0x492d68,args:_0x1bd1a6,tdx:_0x3e288f}=_0x1d5c0d,_0x535b7c=_0x1bd1a6[0x0]||_0x492d68['parentSegment'];if(!_0x535b7c)return showParentSegmentNotSetError(_0x19c36a(0x1f0)+_0x19c36a(0x16e)),0x1;const _0x11ec54=await withSpinner(_0x19c36a(0x1d4)+_0x535b7c+'\x27...',()=>_0x3e288f[_0x19c36a(0x21a)][_0x19c36a(0x1ac)](_0x535b7c),{'verbose':_0x492d68['verbose']}),_0x2f1091=_0x11ec54[_0x19c36a(0x27c)],_0xb7e556=await withSpinner(_0x19c36a(0x226)+_0x535b7c+_0x19c36a(0x263),()=>_0x3e288f[_0x19c36a(0x22d)]['list'](_0x2f1091),{'verbose':_0x492d68[_0x19c36a(0x1cc)]}),_0x3d6d75=_0xb7e556[_0x19c36a(0x27c)];console[_0x19c36a(0x15c)](_0x19c36a(0x208)+_0x3d6d75['length']+_0x19c36a(0x157)+(_0x3d6d75[_0x19c36a(0x25b)]!==0x1?'s':''));if(_0x492d68[_0x19c36a(0x179)]===_0x19c36a(0x1ba)||_0x492d68[_0x19c36a(0x179)]===_0x19c36a(0x1f9))await handleSDKOutput(_0x3d6d75,_0x492d68);else{if(_0x3d6d75[_0x19c36a(0x25b)]===0x0)console[_0x19c36a(0x282)]('No\x20personalization\x20services\x20configured'),console[_0x19c36a(0x15c)](a26_0x49e31e[_0x19c36a(0x29a)](_0x19c36a(0x188)));else for(const _0x4313e9 of _0x3d6d75){const _0xc67d00=_0x4313e9['sections']?.[_0x19c36a(0x25b)]||0x0,_0x5f3ee9=_0x4313e9['trigger_event']?a26_0x49e31e[_0x19c36a(0x25f)](_0x19c36a(0x1a9)+_0x4313e9[_0x19c36a(0x19e)]):'',_0x5d66c6=a26_0x49e31e[_0x19c36a(0x25f)]('\x20('+_0xc67d00+_0x19c36a(0x19d)+(_0xc67d00!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x4313e9['name']+_0x5f3ee9+_0x5d66c6),_0x4313e9[_0x19c36a(0x14f)]&&console[_0x19c36a(0x282)](_0x19c36a(0x198)+a26_0x49e31e[_0x19c36a(0x25f)](_0x4313e9[_0x19c36a(0x14f)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x17b);['description']=a26_0x5e5c22(0x175);async[a26_0x5e5c22(0x1f2)](_0x50b7db){const _0x52e30b=a26_0x5e5c22,{options:_0x251e01,args:_0x457745}=_0x50b7db,_0x11078c=_0x457745[0x0]||_0x251e01[_0x52e30b(0x1c5)];if(!_0x11078c)return showParentSegmentNotSetError(_0x52e30b(0x184)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x239591=resolveYamlFile(_0x11078c);if(!existsSync(_0x239591))return showFileNotFoundError(_0x239591,_0x11078c),0x1;let _0x201894;try{_0x201894=readFileSync(_0x239591,'utf-8');}catch(_0x449e72){const _0x592b04=_0x449e72 instanceof Error?_0x449e72[_0x52e30b(0x20a)]:String(_0x449e72);return console[_0x52e30b(0x15c)](_0x52e30b(0x1d8)+_0x592b04),0x1;}let _0x2ff0d9;try{_0x2ff0d9=parseDef(_0x201894);}catch(_0x5b4936){const _0x49364a=_0x5b4936 instanceof Error?_0x5b4936[_0x52e30b(0x20a)]:String(_0x5b4936);return console[_0x52e30b(0x15c)](a26_0x49e31e[_0x52e30b(0x1f7)](_0x52e30b(0x1ad)+_0x49364a)),0x1;}if(_0x2ff0d9[_0x52e30b(0x1e1)]&&_0x2ff0d9[_0x52e30b(0x1e1)]['length']>0x0)return console[_0x52e30b(0x15c)](a26_0x49e31e[_0x52e30b(0x247)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x239591)),console['error'](a26_0x49e31e['dim'](_0x52e30b(0x199)+_0x2ff0d9[_0x52e30b(0x1e1)]['length']+_0x52e30b(0x1fe))),0x1;!_0x2ff0d9['realtime']&&(_0x2ff0d9['realtime']={'events':[{'name':_0x52e30b(0x13f),'source_table':_0x52e30b(0x11f)}],'attributes':[{'name':_0x52e30b(0x17a),'type':_0x52e30b(0x26c)}],'id_stitching':{'primary_key':_0x2ff0d9[_0x52e30b(0x160)][_0x52e30b(0x292)]==='customers'?_0x52e30b(0x287):_0x52e30b(0x1d2)}});_0x2ff0d9[_0x52e30b(0x1e1)]=[{'name':_0x52e30b(0x131),'description':_0x52e30b(0x291),'trigger_event':'page_view','sections':[{'name':'Default','criteria':'true','attributes':[_0x52e30b(0x17a)]}]}];const _0x1f6595=serializeDef(_0x2ff0d9);return writeFileSync(_0x239591,_0x1f6595,'utf-8'),console[_0x52e30b(0x15c)](a26_0x49e31e['green']('✔')+_0x52e30b(0x1ea)+a26_0x49e31e[_0x52e30b(0x29a)](_0x239591)),(!_0x2ff0d9['realtime']||_0x201894[_0x52e30b(0x18c)](_0x52e30b(0x190))===-0x1)&&console[_0x52e30b(0x15c)](a26_0x49e31e[_0x52e30b(0x256)]('✔')+_0x52e30b(0x21b)),console[_0x52e30b(0x15c)]('\x0a'+a26_0x49e31e[_0x52e30b(0x25f)]('Next\x20steps:')),console[_0x52e30b(0x15c)]('\x20\x201.\x20Edit\x20'+_0x239591+_0x52e30b(0x156)),console[_0x52e30b(0x15c)](_0x52e30b(0x12a)+a26_0x49e31e[_0x52e30b(0x25f)]('tdx\x20ps\x20push\x20'+_0x11078c)+_0x52e30b(0x233)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a27_0x3d1276=a27_0x173a;(function(_0x1dfce8,_0x895c7e){const _0x449c1d=a27_0x173a,_0x3554af=_0x1dfce8();while(!![]){try{const _0x570a22=parseInt(_0x449c1d(0x16c))/0x1*(-parseInt(_0x449c1d(0x199))/0x2)+-parseInt(_0x449c1d(0x17a))/0x3*(parseInt(_0x449c1d(0x16b))/0x4)+-parseInt(_0x449c1d(0x170))/0x5+parseInt(_0x449c1d(0x1b1))/0x6*(-parseInt(_0x449c1d(0x1bc))/0x7)+parseInt(_0x449c1d(0x15d))/0x8+-parseInt(_0x449c1d(0x162))/0x9*(-parseInt(_0x449c1d(0x1b4))/0xa)+parseInt(_0x449c1d(0x18d))/0xb*(parseInt(_0x449c1d(0x1a5))/0xc);if(_0x570a22===_0x895c7e)break;else _0x3554af['push'](_0x3554af['shift']());}catch(_0x64c450){_0x3554af['push'](_0x3554af['shift']());}}}(a27_0x5c36,0x4711f));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a27_0x5c36(){const _0xce877a=['database','Enter\x20site\x20name:','site','Default\x20profile\x20set\x20to:\x20','\x27\x20requires\x20API\x20key\x20validation.','parent_segment','password','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Removal\x20cancelled','logLevel','Set\x20a\x20profile\x20configuration\x20value','tdx.json','confirm','Profile\x20name\x20cannot\x20be\x20empty','50039vUKnVE','log','profileName','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>','us01','Changing\x20site\x20to\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','default','\x20Profile\x20\x27','Site\x20was\x20not\x20changed.','llm_agent','other','88980wIqEcO','\x20API\x20key\x20is\x20valid\x20(User:\x20','jobs','\x0aAvailable\x20profiles:','join','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Enter\x20profile\x20name:','create','select','\x27\x20created','Remove\x20a\x20profile','warn','1548VayNsp','test','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','session','trim','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20\x20-\x20','name','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20description\x20(optional):','split','12cyqMTF','green','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','10IseWfp','ERROR','text','\x0aOperation\x20cancelled','llm_project','length','tdx:\x20profile\x20remove','\x20--default\x27\x20to\x20save\x20permanently','219604KuxSkE','yellow','VALID_KEYS','Profile\x20\x27','dim','bold','\x27\x20removed\x20from\x20configuration','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','validate','Set\x20session\x20profile','/app/mp/ak','\x20\x20tdx\x20--profile\x20','customSite','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Validating\x20API\x20key...','2016352NwhQQy','You\x20can\x20find\x20your\x20API\x20key\x20at:','✗\x20Validation\x20failed:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','API\x20key\x20cannot\x20be\x20empty','3678507pECQFE','red','\x20\x20(no\x20profiles\x20found)','\x0aSetup\x20cancelled','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x27\x20does\x20not\x20exist.','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Session\x20profile\x20set\x20to:\x20','apiKey','12dtIOOz','6klLZFq','status','description','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','525970CftWey','error','Enter\x20your\x20TD\x20API\x20key:','Create\x20a\x20new\x20profile','profile','profile:remove','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','message','execute','tdx:\x20profile\x20create','521607EbYoFA','getUserInfo','Site\x20name\x20cannot\x20be\x20empty','tdx:\x20profile\x20set','Failed\x20to\x20remove\x20profile:\x20'];a27_0x5c36=function(){return _0xce877a;};return a27_0x5c36();}import{getConfigDir}from'../core/config.js';import*as a27_0x3c8cfe from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';function a27_0x173a(_0x1c8bae,_0xdcb550){_0x1c8bae=_0x1c8bae-0x152;const _0x5c3677=a27_0x5c36();let _0x173aaf=_0x5c3677[_0x1c8bae];return _0x173aaf;}import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0x49a13a from'prompts';import a27_0xe88ae3 from'chalk';function validateProfileName(_0xae6ed){const _0x48c339=a27_0x173a;if(!_0xae6ed||!_0xae6ed[_0x48c339(0x1a9)]())return _0x48c339(0x18c);const _0x4e9a69=_0xae6ed[_0x48c339(0x1a9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x48c339(0x1a6)](_0x4e9a69))return _0x48c339(0x1b3);if(profileExists(_0x4e9a69))return _0x48c339(0x1bf)+_0x4e9a69+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x173);async[a27_0x3d1276(0x178)](_0x495a9a){const _0x35c64d=a27_0x3d1276,{options:_0x1cfea7,args:_0x2c8196}=_0x495a9a;console[_0x35c64d(0x18e)](a27_0xe88ae3['bold'](_0x35c64d(0x179)));let _0x370a62;if(_0x2c8196[_0x35c64d(0x1b9)]>0x0&&_0x2c8196[0x0]){const _0x702131=_0x2c8196[0x0]['trim'](),_0x575b09=validateProfileName(_0x702131);if(_0x575b09!==!![])return console[_0x35c64d(0x171)](a27_0xe88ae3['red'](_0x575b09)),0x1;_0x370a62=_0x702131;}else{const _0x4bf925=await a27_0x49a13a({'type':'text','name':'profileName','message':_0x35c64d(0x19f),'validate':validateProfileName});if(!_0x4bf925[_0x35c64d(0x18f)])return console[_0x35c64d(0x18e)](_0x35c64d(0x165)),0x1;_0x370a62=_0x4bf925[_0x35c64d(0x18f)]['trim']();}const _0x15bb44=await a27_0x49a13a({'type':_0x35c64d(0x1b6),'name':_0x35c64d(0x16e),'message':_0x35c64d(0x1af)}),_0x32add7=_0x15bb44[_0x35c64d(0x16e)]?.[_0x35c64d(0x1a9)]()||undefined,_0x1c9abd=_0x1cfea7[_0x35c64d(0x181)]||_0x35c64d(0x191),{choices:_0x4abfdf,initialIndex:_0x3a0b60}=buildSiteChoices(_0x1c9abd),_0x22952c=await a27_0x49a13a({'type':_0x35c64d(0x1a1),'name':_0x35c64d(0x181),'message':_0x35c64d(0x19e)+_0x370a62+'\x27:','choices':_0x4abfdf,'initial':_0x3a0b60});if(!_0x22952c['site'])return console['log']('\x0aSetup\x20cancelled'),0x1;let _0x579ded;if(_0x22952c[_0x35c64d(0x181)]===_0x35c64d(0x198)){const _0x5121e8=await a27_0x49a13a({'type':'text','name':'customSite','message':_0x35c64d(0x180),'initial':_0x35c64d(0x191),'validate':_0x1b0266=>{const _0x46a1d9=_0x35c64d;if(!_0x1b0266||!_0x1b0266[_0x46a1d9(0x1a9)]())return _0x46a1d9(0x17c);if(!/^[a-z0-9-]+$/[_0x46a1d9(0x1a6)](_0x1b0266['trim']()))return _0x46a1d9(0x166);return!![];}});if(!_0x5121e8['customSite'])return console[_0x35c64d(0x18e)](_0x35c64d(0x165)),0x1;_0x579ded=_0x5121e8[_0x35c64d(0x15a)];}else _0x579ded=_0x22952c[_0x35c64d(0x181)];const _0x31163f=resolveSite(_0x579ded);console[_0x35c64d(0x18e)](_0x35c64d(0x155)+_0x31163f),console[_0x35c64d(0x18e)](_0x35c64d(0x15e)),console[_0x35c64d(0x18e)]('\x20\x20'+getConsoleUrl(_0x31163f,_0x35c64d(0x158)));const _0x282b55=await a27_0x49a13a({'type':_0x35c64d(0x185),'name':_0x35c64d(0x16a),'message':_0x35c64d(0x172),'validate':_0x2b3853=>{if(!_0x2b3853||!_0x2b3853['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x282b55[_0x35c64d(0x16a)])return console[_0x35c64d(0x18e)](_0x35c64d(0x165)),0x1;const _0x4127cd=_0x282b55[_0x35c64d(0x16a)];console[_0x35c64d(0x18e)](_0x35c64d(0x15c));try{const _0x3e88b8=TDX['create']({'site':_0x31163f,'apiKey':_0x4127cd[_0x35c64d(0x1a9)](),'logLevel':_0x1cfea7[_0x35c64d(0x188)]??LogLevel[_0x35c64d(0x1b5)]}),_0x28319b=await _0x3e88b8[_0x35c64d(0x19b)][_0x35c64d(0x17b)]();console['log'](a27_0xe88ae3[_0x35c64d(0x1b2)]('✓')+_0x35c64d(0x19a)+_0x28319b['email']+')');const _0x342d56=await isKeychainAvailable();_0x342d56?(await saveAPIKeyAsync(_0x4127cd[_0x35c64d(0x1a9)](),_0x31163f,_0x370a62),console[_0x35c64d(0x18e)](a27_0xe88ae3['green']('✓')+_0x35c64d(0x1a7)+_0x370a62+')')):(console['warn'](a27_0xe88ae3[_0x35c64d(0x1bd)](_0x35c64d(0x168))),console['warn'](a27_0xe88ae3[_0x35c64d(0x1bd)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x2cc4ef={'site':_0x31163f,..._0x32add7&&{'description':_0x32add7}};return saveProfileToUserConfig(_0x370a62,_0x2cc4ef),console[_0x35c64d(0x18e)](a27_0xe88ae3['green']('✓')+'\x20Profile\x20\x27'+_0x370a62+_0x35c64d(0x1a2)),console['log'](),console[_0x35c64d(0x18e)](_0x35c64d(0x193)),console[_0x35c64d(0x18e)](_0x35c64d(0x159)+_0x370a62+_0x35c64d(0x1aa)),console[_0x35c64d(0x18e)](_0x35c64d(0x159)+_0x370a62+_0x35c64d(0x186)),0x0;}catch(_0x42303c){if(_0x42303c instanceof HTTPClientError&&_0x42303c['status']===0x191)return printAuthError(_0x42303c),0x1;return console[_0x35c64d(0x171)](a27_0xe88ae3['red'](_0x35c64d(0x15f)+(_0x42303c instanceof Error?_0x42303c[_0x35c64d(0x177)]:String(_0x42303c)))),console['error'](_0x35c64d(0x15b)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x3d1276(0x1ac)]=a27_0x3d1276(0x175);[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x1a3);[a27_0x3d1276(0x156)](_0x4eef08){const _0x35f674=a27_0x3d1276,{args:_0x2ea0b1}=_0x4eef08;if(_0x2ea0b1[_0x35f674(0x1b9)]===0x0)return _0x35f674(0x176);return undefined;}async['execute'](_0x30aed9){const _0x5008ab=a27_0x3d1276,{args:_0x32c1b9}=_0x30aed9,_0x521d49=_0x32c1b9[0x0];console['log'](a27_0xe88ae3[_0x5008ab(0x153)](_0x5008ab(0x1ba)));if(!profileExists(_0x521d49)){console[_0x5008ab(0x171)](a27_0xe88ae3[_0x5008ab(0x163)](_0x5008ab(0x1bf)+_0x521d49+_0x5008ab(0x167))),console[_0x5008ab(0x18e)](_0x5008ab(0x19c));const _0x1566b1=listProfiles();if(_0x1566b1['length']===0x0)console['log'](_0x5008ab(0x164));else for(const _0x559ba0 of _0x1566b1){console[_0x5008ab(0x18e)](_0x5008ab(0x1ab)+_0x559ba0[_0x5008ab(0x1ac)]);}return 0x1;}const _0x16eee5=await a27_0x49a13a({'type':_0x5008ab(0x18b),'name':_0x5008ab(0x18b),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0x521d49+'\x27?','initial':![]});if(!_0x16eee5[_0x5008ab(0x18b)])return console[_0x5008ab(0x18e)](_0x5008ab(0x187)),0x0;try{removeProfileFromUserConfig(_0x521d49),console[_0x5008ab(0x18e)](a27_0xe88ae3[_0x5008ab(0x1b2)]('✓')+_0x5008ab(0x195)+_0x521d49+_0x5008ab(0x154));}catch(_0x404921){return console[_0x5008ab(0x171)](a27_0xe88ae3['red'](_0x5008ab(0x17e)+(_0x404921 instanceof Error?_0x404921[_0x5008ab(0x177)]:String(_0x404921)))),0x1;}const _0x17196a=await isKeychainAvailable();if(_0x17196a){const _0x4c29cf=await deleteKeychainAPIKey(_0x521d49);_0x4c29cf&&console[_0x5008ab(0x18e)](a27_0xe88ae3[_0x5008ab(0x1b2)]('✓')+_0x5008ab(0x1ad));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x3d1276(0x1ac)]='profile:set';[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x189);static [a27_0x3d1276(0x1be)]=[a27_0x3d1276(0x181),a27_0x3d1276(0x17f),a27_0x3d1276(0x184),a27_0x3d1276(0x1b8),a27_0x3d1276(0x197),'description'];['validate'](_0x3f8888){const _0x4f29e9=a27_0x3d1276,{args:_0x282e09,options:_0x4f2b2c}=_0x3f8888,_0x1141f9=_0x4f2b2c['profile']||getActiveProfile();if(!_0x1141f9)return _0x4f29e9(0x190);if(_0x282e09[_0x4f29e9(0x1b9)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4f29e9(0x1be)][_0x4f29e9(0x19d)](',\x20');const _0x1731bc=_0x282e09[0x0];if(!_0x1731bc['includes']('='))return _0x4f29e9(0x160)+ProfileSetCommand[_0x4f29e9(0x1be)][_0x4f29e9(0x19d)](',\x20');const [_0x309df2]=_0x1731bc[_0x4f29e9(0x1b0)]('=',0x2);if(!ProfileSetCommand[_0x4f29e9(0x1be)]['includes'](_0x309df2))return'Unknown\x20key\x20\x27'+_0x309df2+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4f29e9(0x1be)][_0x4f29e9(0x19d)](',\x20');return undefined;}async[a27_0x3d1276(0x178)](_0x30f050){const _0x16c9c7=a27_0x3d1276,{args:_0x314559,options:_0x434e02}=_0x30f050,_0x526cd7=_0x434e02[_0x16c9c7(0x174)]||getActiveProfile(),[_0x149131,..._0x55d75c]=_0x314559[0x0]['split']('='),_0x1e298e=_0x55d75c['join']('=');console['log'](a27_0xe88ae3[_0x16c9c7(0x153)](_0x16c9c7(0x17d)));if(!profileExists(_0x526cd7)){const _0x24d83c=await a27_0x49a13a({'type':_0x16c9c7(0x18b),'name':'create','message':'Profile\x20\x27'+_0x526cd7+_0x16c9c7(0x1ae),'initial':!![]});if(!_0x24d83c[_0x16c9c7(0x1a0)])return console['log']('Operation\x20cancelled'),0x1;}const _0x5d33fd=loadProfile(_0x526cd7),_0x5a7129=_0x5d33fd?.['config']||{};if(_0x149131===_0x16c9c7(0x181)){const _0x5b6097=resolveSite(_0x1e298e);console[_0x16c9c7(0x18e)](_0x16c9c7(0x192)+_0x5b6097+_0x16c9c7(0x183)),console['log']('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x5b6097,_0x16c9c7(0x158)));const _0x53c92e=await a27_0x49a13a({'type':'password','name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x378ebf=>{const _0x30f136=_0x16c9c7;if(!_0x378ebf||!_0x378ebf['trim']())return _0x30f136(0x161);return!![];}});if(!_0x53c92e[_0x16c9c7(0x16a)])return console[_0x16c9c7(0x18e)](_0x16c9c7(0x1b7)),0x1;console[_0x16c9c7(0x18e)](_0x16c9c7(0x15c));try{const _0x18e3de=TDX[_0x16c9c7(0x1a0)]({'site':_0x5b6097,'apiKey':_0x53c92e['apiKey'][_0x16c9c7(0x1a9)](),'logLevel':_0x434e02[_0x16c9c7(0x188)]??LogLevel[_0x16c9c7(0x1b5)]}),_0x1f7f1a=await _0x18e3de[_0x16c9c7(0x19b)][_0x16c9c7(0x17b)]();console[_0x16c9c7(0x18e)](a27_0xe88ae3[_0x16c9c7(0x1b2)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x1f7f1a['email']+')');const _0x4138f2=await isKeychainAvailable();_0x4138f2?(await saveAPIKeyAsync(_0x53c92e[_0x16c9c7(0x16a)][_0x16c9c7(0x1a9)](),_0x5b6097,_0x526cd7),console['log'](a27_0xe88ae3[_0x16c9c7(0x1b2)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x16c9c7(0x1a4)](a27_0xe88ae3[_0x16c9c7(0x1bd)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5a7129[_0x16c9c7(0x181)]=_0x5b6097;}catch(_0xe2d599){if(_0xe2d599 instanceof HTTPClientError&&_0xe2d599[_0x16c9c7(0x16d)]===0x191)return printAuthError(_0xe2d599),0x1;return console[_0x16c9c7(0x171)](a27_0xe88ae3[_0x16c9c7(0x163)]('✗\x20Validation\x20failed:\x20'+(_0xe2d599 instanceof Error?_0xe2d599[_0x16c9c7(0x177)]:String(_0xe2d599)))),console['error'](_0x16c9c7(0x196)),0x1;}}else _0x5a7129[_0x149131]=_0x1e298e||undefined;return saveProfileToUserConfig(_0x526cd7,_0x5a7129),console[_0x16c9c7(0x18e)](a27_0xe88ae3['green']('✓')+'\x20Profile\x20\x27'+_0x526cd7+'\x27\x20updated:\x20'+_0x149131+'='+(_0x1e298e||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x3d1276(0x1ac)]='profile:use';[a27_0x3d1276(0x16e)]=a27_0x3d1276(0x157);['validate'](_0x216000){const _0x13fc18=a27_0x3d1276,{args:_0x307aeb}=_0x216000;if(_0x307aeb[_0x13fc18(0x1b9)]===0x0)return _0x13fc18(0x16f);return undefined;}async[a27_0x3d1276(0x178)](_0x5d18fc){const _0x3b7456=a27_0x3d1276,{args:_0x16581c,options:_0x35d9a3}=_0x5d18fc,_0x3d3698=_0x16581c[0x0],_0x6b39ef=_0x35d9a3[_0x3b7456(0x194)];cleanExpiredSessions();if(!profileExists(_0x3d3698)){console['error'](a27_0xe88ae3[_0x3b7456(0x163)]('Profile\x20\x27'+_0x3d3698+_0x3b7456(0x167))),console[_0x3b7456(0x18e)](_0x3b7456(0x19c));const _0x1d8ef6=listProfiles();if(_0x1d8ef6[_0x3b7456(0x1b9)]===0x0)console[_0x3b7456(0x18e)](_0x3b7456(0x164));else for(const _0x223643 of _0x1d8ef6){console[_0x3b7456(0x18e)]('\x20\x20-\x20'+_0x223643[_0x3b7456(0x1ac)]);}return 0x1;}if(_0x6b39ef){const _0x3bf4e6=a27_0x3c8cfe[_0x3b7456(0x19d)](getConfigDir(),_0x3b7456(0x18a));return saveActiveProfileToUserConfig(_0x3d3698),console[_0x3b7456(0x18e)](_0x3b7456(0x182)+a27_0xe88ae3['green'](_0x3d3698)),console[_0x3b7456(0x18e)](a27_0xe88ae3['dim']('\x0aSaved\x20to:\x20'+_0x3bf4e6)),0x0;}const _0x17940a=getSessionID(_0x35d9a3[_0x3b7456(0x1a8)]);return saveSessionContext({'profile':_0x3d3698},_0x35d9a3[_0x3b7456(0x1a8)]),console[_0x3b7456(0x18e)](_0x3b7456(0x169)+a27_0xe88ae3[_0x3b7456(0x1b2)](_0x3d3698)+'\x20'+a27_0xe88ae3[_0x3b7456(0x152)]('(session:\x20'+_0x17940a+')')),console[_0x3b7456(0x18e)](a27_0xe88ae3['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x3d3698+_0x3b7456(0x1bb))),0x0;}}
|
|
1
|
+
const a27_0x268624=a27_0x326c;(function(_0x4688a4,_0x4acda8){const _0x2a2689=a27_0x326c,_0x261a5f=_0x4688a4();while(!![]){try{const _0x1ffb9a=-parseInt(_0x2a2689(0x143))/0x1*(-parseInt(_0x2a2689(0xe9))/0x2)+-parseInt(_0x2a2689(0x11c))/0x3*(parseInt(_0x2a2689(0x127))/0x4)+-parseInt(_0x2a2689(0x14b))/0x5*(parseInt(_0x2a2689(0x11e))/0x6)+parseInt(_0x2a2689(0x147))/0x7+-parseInt(_0x2a2689(0x140))/0x8*(parseInt(_0x2a2689(0x103))/0x9)+-parseInt(_0x2a2689(0x137))/0xa+-parseInt(_0x2a2689(0x121))/0xb*(-parseInt(_0x2a2689(0x11d))/0xc);if(_0x1ffb9a===_0x4acda8)break;else _0x261a5f['push'](_0x261a5f['shift']());}catch(_0x580f76){_0x261a5f['push'](_0x261a5f['shift']());}}}(a27_0x3713,0xaf380));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 a27_0x5e3b23 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a27_0x326c(_0x45e042,_0x71febb){_0x45e042=_0x45e042-0xe4;const _0x3713df=a27_0x3713();let _0x326c46=_0x3713df[_0x45e042];return _0x326c46;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0xbccee0 from'prompts';import a27_0xbae110 from'chalk';function validateProfileName(_0x41885c){const _0x1a0573=a27_0x326c;if(!_0x41885c||!_0x41885c[_0x1a0573(0xfd)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x41b5fa=_0x41885c['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x1a0573(0x14f)](_0x41b5fa))return _0x1a0573(0x107);if(profileExists(_0x41b5fa))return _0x1a0573(0x13a)+_0x41b5fa+_0x1a0573(0x109);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a27_0x268624(0xfe)]=a27_0x268624(0x12c);async['execute'](_0x3c3e7e){const _0x229122=a27_0x268624,{options:_0x204974,args:_0x178030}=_0x3c3e7e;console[_0x229122(0x129)](a27_0xbae110['bold'](_0x229122(0x139)));let _0x13ade2;if(_0x178030[_0x229122(0xeb)]>0x0&&_0x178030[0x0]){const _0x48eb05=_0x178030[0x0][_0x229122(0xfd)](),_0x230154=validateProfileName(_0x48eb05);if(_0x230154!==!![])return console['error'](a27_0xbae110[_0x229122(0x10f)](_0x230154)),0x1;_0x13ade2=_0x48eb05;}else{const _0x172728=await a27_0xbccee0({'type':_0x229122(0x13e),'name':_0x229122(0x14a),'message':_0x229122(0xf6),'validate':validateProfileName});if(!_0x172728[_0x229122(0x14a)])return console[_0x229122(0x129)](_0x229122(0xe6)),0x1;_0x13ade2=_0x172728[_0x229122(0x14a)][_0x229122(0xfd)]();}const _0x20b16c=await a27_0xbccee0({'type':_0x229122(0x13e),'name':_0x229122(0xfe),'message':_0x229122(0xf0)}),_0x1f125e=_0x20b16c[_0x229122(0xfe)]?.[_0x229122(0xfd)]()||undefined,_0x2efc8e=_0x204974[_0x229122(0x120)]||_0x229122(0x124),{choices:_0x3d4373,initialIndex:_0x274852}=buildSiteChoices(_0x2efc8e),_0x33a8fc=await a27_0xbccee0({'type':_0x229122(0x130),'name':'site','message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x13ade2+'\x27:','choices':_0x3d4373,'initial':_0x274852});if(!_0x33a8fc['site'])return console[_0x229122(0x129)](_0x229122(0xe6)),0x1;let _0x51b10a;if(_0x33a8fc[_0x229122(0x120)]===_0x229122(0xef)){const _0x232d68=await a27_0xbccee0({'type':'text','name':'customSite','message':_0x229122(0x134),'initial':'us01','validate':_0x1d7519=>{const _0x375cfa=_0x229122;if(!_0x1d7519||!_0x1d7519[_0x375cfa(0xfd)]())return _0x375cfa(0x131);if(!/^[a-z0-9-]+$/['test'](_0x1d7519[_0x375cfa(0xfd)]()))return _0x375cfa(0x111);return!![];}});if(!_0x232d68[_0x229122(0xfa)])return console[_0x229122(0x129)](_0x229122(0xe6)),0x1;_0x51b10a=_0x232d68[_0x229122(0xfa)];}else _0x51b10a=_0x33a8fc['site'];const _0x3dd82e=resolveSite(_0x51b10a);console[_0x229122(0x129)](_0x229122(0x112)+_0x3dd82e),console[_0x229122(0x129)](_0x229122(0x114)),console['log']('\x20\x20'+getConsoleUrl(_0x3dd82e,_0x229122(0x10c)));const _0x44a6e1=await a27_0xbccee0({'type':_0x229122(0x105),'name':_0x229122(0xed),'message':_0x229122(0x149),'validate':_0x283e3d=>{const _0x1b1f1f=_0x229122;if(!_0x283e3d||!_0x283e3d[_0x1b1f1f(0xfd)]())return _0x1b1f1f(0xf8);return!![];}});if(!_0x44a6e1[_0x229122(0xed)])return console[_0x229122(0x129)]('\x0aSetup\x20cancelled'),0x1;const _0x58ab2d=_0x44a6e1[_0x229122(0xed)];console['log'](_0x229122(0xe4));try{const _0x3b19b5=TDX[_0x229122(0x142)]({'site':_0x3dd82e,'apiKey':_0x58ab2d[_0x229122(0xfd)](),'logLevel':_0x204974[_0x229122(0x10e)]??LogLevel[_0x229122(0x106)]}),_0x5d3417=await _0x3b19b5[_0x229122(0x12f)][_0x229122(0x132)]();console[_0x229122(0x129)](a27_0xbae110[_0x229122(0xfc)]('✓')+_0x229122(0x104)+_0x5d3417[_0x229122(0x13f)]+')');const _0x5d755f=await isKeychainAvailable();_0x5d755f?(await saveAPIKeyAsync(_0x58ab2d[_0x229122(0xfd)](),_0x3dd82e,_0x13ade2),console[_0x229122(0x129)](a27_0xbae110['green']('✓')+_0x229122(0x118)+_0x13ade2+')')):(console['warn'](a27_0xbae110[_0x229122(0xf3)](_0x229122(0x113))),console[_0x229122(0x12a)](a27_0xbae110['yellow'](_0x229122(0x136))));const _0x2b5092={'site':_0x3dd82e,..._0x1f125e&&{'description':_0x1f125e}};return saveProfileToUserConfig(_0x13ade2,_0x2b5092),console[_0x229122(0x129)](a27_0xbae110[_0x229122(0xfc)]('✓')+_0x229122(0x141)+_0x13ade2+_0x229122(0xf7)),console[_0x229122(0x129)](),console[_0x229122(0x129)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x229122(0x146)+_0x13ade2+_0x229122(0x115)),console[_0x229122(0x129)](_0x229122(0x146)+_0x13ade2+_0x229122(0x125)),0x0;}catch(_0xf438e9){if(_0xf438e9 instanceof HTTPClientError&&_0xf438e9[_0x229122(0xf2)]===0x191)return printAuthError(_0xf438e9),0x1;return console[_0x229122(0xe7)](a27_0xbae110[_0x229122(0x10f)](_0x229122(0x138)+(_0xf438e9 instanceof Error?_0xf438e9[_0x229122(0x128)]:String(_0xf438e9)))),console[_0x229122(0xe7)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a27_0x3713(){const _0x178300=['24wvOqQj','11706vmNXOx','split','site','10038050aqGMUs','\x27\x20updated:\x20','\x0aOperation\x20cancelled','us01','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','tdx:\x20profile\x20set','17548jdJsUZ','message','log','warn','Set\x20a\x20profile\x20configuration\x20value','Create\x20a\x20new\x20profile','bold','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','jobs','select','Site\x20name\x20cannot\x20be\x20empty','getUserInfo','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Enter\x20site\x20name:','Failed\x20to\x20remove\x20profile:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','946990WvhEZH','✗\x20Validation\x20failed:\x20','tdx:\x20profile\x20create','Profile\x20\x27','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','llm_agent','profile:remove','text','email','2728jiorHV','\x20Profile\x20\x27','create','32rapjCL','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20removed\x20from\x20configuration','\x20\x20tdx\x20--profile\x20','8074696KKnmOC','join','Enter\x20your\x20TD\x20API\x20key:','profileName','1295npdBWz','tdx:\x20profile\x20remove','Remove\x20a\x20profile','\x20--default\x27\x20to\x20save\x20permanently','test','validate','\x20\x20-\x20','Validating\x20API\x20key...','\x20\x20(no\x20profiles\x20found)','\x0aSetup\x20cancelled','error','profile:set','7702duBppv','\x0aAvailable\x20profiles:','length','dim','apiKey','\x27.\x0a\x0aValid\x20keys:\x20','other','Enter\x20description\x20(optional):','VALID_KEYS','status','yellow','(session:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Enter\x20profile\x20name:','\x27\x20created','API\x20key\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.','customSite','profile','green','trim','description','config','confirm','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Default\x20profile\x20set\x20to:\x20','36900EfrNwJ','\x20API\x20key\x20is\x20valid\x20(User:\x20','password','ERROR','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x27\x20does\x20not\x20exist.\x20Create\x20it?','name','/app/mp/ak','database','logLevel','red','llm_project','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','(cleared)','includes','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','session','execute','264aJsWVM'];a27_0x3713=function(){return _0x178300;};return a27_0x3713();}export class ProfileRemoveCommand extends BaseCommand{[a27_0x268624(0x10b)]=a27_0x268624(0x13d);[a27_0x268624(0xfe)]=a27_0x268624(0x14d);[a27_0x268624(0x150)](_0x26acf8){const _0x559f72=a27_0x268624,{args:_0x4ab24b}=_0x26acf8;if(_0x4ab24b[_0x559f72(0xeb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a27_0x268624(0x11b)](_0x1a250d){const _0x1785c6=a27_0x268624,{args:_0x35a09d}=_0x1a250d,_0x1b1d85=_0x35a09d[0x0];console[_0x1785c6(0x129)](a27_0xbae110[_0x1785c6(0x12d)](_0x1785c6(0x14c)));if(!profileExists(_0x1b1d85)){console[_0x1785c6(0xe7)](a27_0xbae110['red'](_0x1785c6(0x13a)+_0x1b1d85+_0x1785c6(0xf9))),console[_0x1785c6(0x129)](_0x1785c6(0xea));const _0x417dbc=listProfiles();if(_0x417dbc[_0x1785c6(0xeb)]===0x0)console[_0x1785c6(0x129)](_0x1785c6(0xe5));else for(const _0x447f05 of _0x417dbc){console[_0x1785c6(0x129)](_0x1785c6(0x151)+_0x447f05['name']);}return 0x1;}const _0x4d7fea=await a27_0xbccee0({'type':'confirm','name':'confirm','message':_0x1785c6(0x108)+_0x1b1d85+'\x27?','initial':![]});if(!_0x4d7fea[_0x1785c6(0x100)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x1b1d85),console[_0x1785c6(0x129)](a27_0xbae110[_0x1785c6(0xfc)]('✓')+_0x1785c6(0x141)+_0x1b1d85+_0x1785c6(0x145));}catch(_0x570ab5){return console[_0x1785c6(0xe7)](a27_0xbae110[_0x1785c6(0x10f)](_0x1785c6(0x135)+(_0x570ab5 instanceof Error?_0x570ab5[_0x1785c6(0x128)]:String(_0x570ab5)))),0x1;}const _0x364feb=await isKeychainAvailable();if(_0x364feb){const _0x5f3404=await deleteKeychainAPIKey(_0x1b1d85);_0x5f3404&&console['log'](a27_0xbae110[_0x1785c6(0xfc)]('✓')+_0x1785c6(0x101));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x268624(0x10b)]=a27_0x268624(0xe8);['description']=a27_0x268624(0x12b);static [a27_0x268624(0xf1)]=[a27_0x268624(0x120),a27_0x268624(0x10d),'parent_segment',a27_0x268624(0x110),a27_0x268624(0x13c),a27_0x268624(0xfe)];[a27_0x268624(0x150)](_0x5bf701){const _0x528acb=a27_0x268624,{args:_0x551e26,options:_0x2454ed}=_0x5bf701,_0x5f781e=_0x2454ed[_0x528acb(0xfb)]||getActiveProfile();if(!_0x5f781e)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(_0x551e26[_0x528acb(0xeb)]===0x0)return _0x528acb(0x12e)+ProfileSetCommand[_0x528acb(0xf1)][_0x528acb(0x148)](',\x20');const _0x24e0da=_0x551e26[0x0];if(!_0x24e0da[_0x528acb(0x117)]('='))return _0x528acb(0x133)+ProfileSetCommand['VALID_KEYS'][_0x528acb(0x148)](',\x20');const [_0x4e4a73]=_0x24e0da['split']('=',0x2);if(!ProfileSetCommand[_0x528acb(0xf1)][_0x528acb(0x117)](_0x4e4a73))return'Unknown\x20key\x20\x27'+_0x4e4a73+_0x528acb(0xee)+ProfileSetCommand[_0x528acb(0xf1)][_0x528acb(0x148)](',\x20');return undefined;}async[a27_0x268624(0x11b)](_0x30eb8b){const _0x402328=a27_0x268624,{args:_0x534470,options:_0x27599a}=_0x30eb8b,_0x493ada=_0x27599a[_0x402328(0xfb)]||getActiveProfile(),[_0x519fc2,..._0x3465e2]=_0x534470[0x0][_0x402328(0x11f)]('='),_0x5dcc56=_0x3465e2[_0x402328(0x148)]('=');console['log'](a27_0xbae110[_0x402328(0x12d)](_0x402328(0x126)));if(!profileExists(_0x493ada)){const _0x1931cd=await a27_0xbccee0({'type':_0x402328(0x100),'name':_0x402328(0x142),'message':_0x402328(0x13a)+_0x493ada+_0x402328(0x10a),'initial':!![]});if(!_0x1931cd['create'])return console[_0x402328(0x129)]('Operation\x20cancelled'),0x1;}const _0x35115b=loadProfile(_0x493ada),_0x125b1f=_0x35115b?.[_0x402328(0xff)]||{};if(_0x519fc2===_0x402328(0x120)){const _0x45bb60=resolveSite(_0x5dcc56);console[_0x402328(0x129)]('Changing\x20site\x20to\x20\x27'+_0x45bb60+_0x402328(0x144)),console['log'](_0x402328(0x13b)),console[_0x402328(0x129)]('\x20\x20'+getConsoleUrl(_0x45bb60,_0x402328(0x10c)));const _0x2ed799=await a27_0xbccee0({'type':'password','name':_0x402328(0xed),'message':_0x402328(0x119),'validate':_0x360c7d=>{const _0x56c299=_0x402328;if(!_0x360c7d||!_0x360c7d['trim']())return _0x56c299(0xf8);return!![];}});if(!_0x2ed799[_0x402328(0xed)])return console[_0x402328(0x129)](_0x402328(0x123)),0x1;console[_0x402328(0x129)](_0x402328(0xe4));try{const _0x5a03d7=TDX[_0x402328(0x142)]({'site':_0x45bb60,'apiKey':_0x2ed799['apiKey'][_0x402328(0xfd)](),'logLevel':_0x27599a[_0x402328(0x10e)]??LogLevel['ERROR']}),_0x4a04b9=await _0x5a03d7['jobs'][_0x402328(0x132)]();console[_0x402328(0x129)](a27_0xbae110[_0x402328(0xfc)]('✓')+_0x402328(0x104)+_0x4a04b9[_0x402328(0x13f)]+')');const _0x3d7024=await isKeychainAvailable();_0x3d7024?(await saveAPIKeyAsync(_0x2ed799[_0x402328(0xed)][_0x402328(0xfd)](),_0x45bb60,_0x493ada),console['log'](a27_0xbae110['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x402328(0x12a)](a27_0xbae110['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x125b1f['site']=_0x45bb60;}catch(_0x447523){if(_0x447523 instanceof HTTPClientError&&_0x447523[_0x402328(0xf2)]===0x191)return printAuthError(_0x447523),0x1;return console[_0x402328(0xe7)](a27_0xbae110[_0x402328(0x10f)]('✗\x20Validation\x20failed:\x20'+(_0x447523 instanceof Error?_0x447523[_0x402328(0x128)]:String(_0x447523)))),console[_0x402328(0xe7)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x125b1f[_0x519fc2]=_0x5dcc56||undefined;return saveProfileToUserConfig(_0x493ada,_0x125b1f),console[_0x402328(0x129)](a27_0xbae110[_0x402328(0xfc)]('✓')+_0x402328(0x141)+_0x493ada+_0x402328(0x122)+_0x519fc2+'='+(_0x5dcc56||_0x402328(0x116))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x268624(0x10b)]='profile:use';[a27_0x268624(0xfe)]='Set\x20session\x20profile';['validate'](_0x305a09){const _0x3fd5d6=a27_0x268624,{args:_0x4f31f9}=_0x305a09;if(_0x4f31f9[_0x3fd5d6(0xeb)]===0x0)return _0x3fd5d6(0xf5);return undefined;}async[a27_0x268624(0x11b)](_0x11ba34){const _0x43d6f0=a27_0x268624,{args:_0x1bc1e0,options:_0xff1ac4}=_0x11ba34,_0x54a1fb=_0x1bc1e0[0x0],_0xec969b=_0xff1ac4['default'];cleanExpiredSessions();if(!profileExists(_0x54a1fb)){console[_0x43d6f0(0xe7)](a27_0xbae110[_0x43d6f0(0x10f)]('Profile\x20\x27'+_0x54a1fb+_0x43d6f0(0xf9))),console[_0x43d6f0(0x129)](_0x43d6f0(0xea));const _0x1641b5=listProfiles();if(_0x1641b5[_0x43d6f0(0xeb)]===0x0)console['log'](_0x43d6f0(0xe5));else for(const _0x3f88ba of _0x1641b5){console['log'](_0x43d6f0(0x151)+_0x3f88ba[_0x43d6f0(0x10b)]);}return 0x1;}if(_0xec969b){const _0x46bfd2=a27_0x5e3b23[_0x43d6f0(0x148)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x54a1fb),console[_0x43d6f0(0x129)](_0x43d6f0(0x102)+a27_0xbae110['green'](_0x54a1fb)),console[_0x43d6f0(0x129)](a27_0xbae110[_0x43d6f0(0xec)]('\x0aSaved\x20to:\x20'+_0x46bfd2)),0x0;}const _0x30f294=getSessionID(_0xff1ac4['session']);return saveSessionContext({'profile':_0x54a1fb},_0xff1ac4[_0x43d6f0(0x11a)]),console[_0x43d6f0(0x129)]('Session\x20profile\x20set\x20to:\x20'+a27_0xbae110['green'](_0x54a1fb)+'\x20'+a27_0xbae110[_0x43d6f0(0xec)](_0x43d6f0(0xf4)+_0x30f294+')')),console[_0x43d6f0(0x129)](a27_0xbae110['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x54a1fb+_0x43d6f0(0x14e))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a28_0x4f43a6=a28_0x4132;(function(_0x55300c,_0x2f7cf4){const _0x2c223b=a28_0x4132,_0x51a8a8=_0x55300c();while(!![]){try{const _0x45b967=parseInt(_0x2c223b(0x1ce))/0x1+parseInt(_0x2c223b(0x1d9))/0x2+parseInt(_0x2c223b(0x1da))/0x3*(-parseInt(_0x2c223b(0x1de))/0x4)+-parseInt(_0x2c223b(0x1dc))/0x5+parseInt(_0x2c223b(0x1d5))/0x6+parseInt(_0x2c223b(0x1df))/0x7*(parseInt(_0x2c223b(0x1d3))/0x8)+-parseInt(_0x2c223b(0x1cc))/0x9*(parseInt(_0x2c223b(0x1d4))/0xa);if(_0x45b967===_0x2f7cf4)break;else _0x51a8a8['push'](_0x51a8a8['shift']());}catch(_0x389eae){_0x51a8a8['push'](_0x51a8a8['shift']());}}}(a28_0xad8f,0x8b9f5));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a28_0x4132(_0x3ce98a,_0x61c458){_0x3ce98a=_0x3ce98a-0x1cb;const _0xad8f4b=a28_0xad8f();let _0x413251=_0xad8f4b[_0x3ce98a];return _0x413251;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x4f43a6(0x1cf)]=a28_0x4f43a6(0x1d6);[a28_0x4f43a6(0x1db)]=a28_0x4f43a6(0x1d7);async['execute'](_0x3b969c){const _0xab5259=a28_0x4f43a6,{options:_0x540798}=_0x3b969c;try{const _0x19005d=listProfiles(),_0x2e8362=getActiveProfile();if(_0x19005d[_0xab5259(0x1dd)]===0x0)return console[_0xab5259(0x1cd)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0xab5259(0x1cd)](_0xab5259(0x1d1)),console[_0xab5259(0x1cd)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2aa2cc=_0x19005d[_0xab5259(0x1d2)](_0x14bacb=>{const _0x488594=_0xab5259,_0x5abb4c=_0x14bacb[_0x488594(0x1cf)]===_0x2e8362,_0x4ce6c9=getProfileParams(_0x14bacb[_0x488594(0x1cb)]);return{'name':_0x14bacb['name'],'active':_0x5abb4c,'scope':_0x14bacb[_0x488594(0x1d0)],'description':_0x14bacb[_0x488594(0x1cb)]['description']||'','params':_0x4ce6c9};});return await handleSDKOutput(_0x2aa2cc,_0x540798),0x0;}catch(_0xfb94d8){return _0xfb94d8 instanceof Error&&console[_0xab5259(0x1d8)]('Error:\x20'+_0xfb94d8['message']),0x1;}}}function a28_0xad8f(){const _0x1e9286=['name','scope','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','map','10424NhgzhB','6521170EsCeHa','490872BwzopU','profiles','List\x20all\x20available\x20profiles','error','2039812xGcvfF','2168772QHWJNr','description','2718375ZpeUYX','length','4BOFnTi','2338IgFJkq','config','9oqOItC','log','953689OoPPGC'];a28_0xad8f=function(){return _0x1e9286;};return a28_0xad8f();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a29_0x2278(){const _0x376c9e=['1779KZbnxa','totalSplits','data','\x20-\x20','setJobId','22CpJKzp','267790ccQWZe','Executing\x20statement\x20','\x20rows\x20','in\x20','Error:\x20','Statement\x20','args','validate','join','database','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','verbose','state','completedSplits','originalMessage','message','No\x20SQL\x20provided','jobId','215839Wqfbvg','Executing\x20query\x20[','1465674KecGxz','setExtra','Schema:\x20','execute','Run\x20Trino\x20queries\x20(streaming)','elapsedTimeMillis','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Catalog:\x20','Query\x20completed:\x20Processed\x20','push','497DiePxO','query','length','Executing\x20query...','\x20splits','2172ucOHgY','stats','processedRows','error','45974vVWafa','5DcUlcD','...','SQL:\x20','output','description','17236571xpuXXL','site','file','69656mFRPtM','9FvDShc','information_schema','5164nfyzGW'];a29_0x2278=function(){return _0x376c9e;};return a29_0x2278();}const a29_0x39d704=a29_0x4832;(function(_0x10e371,_0x2d9a53){const _0x393b6f=a29_0x4832,_0x161c4f=_0x10e371();while(!![]){try{const _0x3bc6fa=parseInt(_0x393b6f(0x1dd))/0x1*(-parseInt(_0x393b6f(0x1cb))/0x2)+parseInt(_0x393b6f(0x1d8))/0x3*(parseInt(_0x393b6f(0x1d7))/0x4)+-parseInt(_0x393b6f(0x1cc))/0x5*(parseInt(_0x393b6f(0x1f2))/0x6)+parseInt(_0x393b6f(0x1c2))/0x7*(-parseInt(_0x393b6f(0x1d4))/0x8)+-parseInt(_0x393b6f(0x1d5))/0x9*(parseInt(_0x393b6f(0x1de))/0xa)+-parseInt(_0x393b6f(0x1d1))/0xb+parseInt(_0x393b6f(0x1c7))/0xc*(parseInt(_0x393b6f(0x1f0))/0xd);if(_0x3bc6fa===_0x2d9a53)break;else _0x161c4f['push'](_0x161c4f['shift']());}catch(_0x2f32f2){_0x161c4f['push'](_0x161c4f['shift']());}}}(a29_0x2278,0xc5748));import{BaseCommand}from'./command.js';function a29_0x4832(_0x55a2ba,_0x4e725b){_0x55a2ba=_0x55a2ba-0x1c0;const _0x22783c=a29_0x2278();let _0x483250=_0x22783c[_0x55a2ba];return _0x483250;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a29_0x39d704(0x1c3);[a29_0x39d704(0x1d0)]=a29_0x39d704(0x1f6);async[a29_0x39d704(0x1f5)](_0x2069ca){const _0x1d3488=a29_0x39d704,{options:_0x4b20fa,args:_0x5f4f26,tdx:_0x43d264}=_0x2069ca,_0x5eb63d=_0x5f4f26[0x0],_0x51e2e6=_0x4b20fa[_0x1d3488(0x1d3)];let _0x224914;try{if(_0x51e2e6)_0x224914=readSqlStatementsFromFile(_0x51e2e6);else{if(_0x5eb63d==='-')_0x224914=await readSqlStatementsFromStdin();else{if(_0x5eb63d&&isSqlFilePath(_0x5eb63d))_0x224914=readSqlStatementsFromFile(_0x5eb63d);else{if(_0x5eb63d)_0x224914=splitSqlStatements(_0x5eb63d);else throw new Error(_0x1d3488(0x1ee));}}}}catch(_0x237e0f){return console['error'](_0x1d3488(0x1e2)+_0x237e0f[_0x1d3488(0x1ed)]),0x1;}const _0x2ea784=_0x4b20fa[_0x1d3488(0x1e7)]||_0x1d3488(0x1d6),_0x452a44=_0x4b20fa['catalog'];try{const _0xf81ad1=[],_0x4f1a0d=!!_0x4b20fa['output'];for(let _0x39a3eb=0x0;_0x39a3eb<_0x224914[_0x1d3488(0x1c4)];_0x39a3eb++){const _0x105567=_0x224914[_0x39a3eb],_0x115c09=_0x39a3eb+0x1,_0x224c5a=_0x224914['length'],_0xf12c0a=_0x224c5a>0x1;_0x4b20fa['verbose']&&(console[_0x1d3488(0x1ca)]('\x0a'+(_0xf12c0a?_0x1d3488(0x1e3)+_0x115c09+'/'+_0x224c5a+':':'')),console['error']('Site:\x20'+_0x4b20fa[_0x1d3488(0x1d2)]),console[_0x1d3488(0x1ca)](_0x1d3488(0x1f9)+(_0x452a44||'td')),console['error'](_0x1d3488(0x1f4)+_0x2ea784),console[_0x1d3488(0x1ca)](_0x1d3488(0x1ce)+_0x105567));const _0x54cceb=_0xf12c0a?_0x1d3488(0x1df)+_0x115c09+'/'+_0x224c5a+_0x1d3488(0x1cd):_0x1d3488(0x1c5);try{const _0x3bbe32=await withProgressSpinner(_0x54cceb,async _0x3a0786=>{const _0x10883e=_0x1d3488,_0x5a3925=await _0x43d264[_0x10883e(0x1c3)][_0x10883e(0x1f5)](_0x105567,{'catalog':_0x452a44,'schema':_0x2ea784,'onJobId':_0x6b0e1d=>{const _0x44d506=_0x10883e;_0x3a0786[_0x44d506(0x1dc)](_0x6b0e1d);},'onProgress':_0x221b44=>{const _0x25f7a5=_0x10883e;_0x3a0786['setPhase'](_0x25f7a5(0x1f1)+_0x221b44[_0x25f7a5(0x1ea)]+']'),_0x3a0786[_0x25f7a5(0x1f3)](formatRows(_0x221b44[_0x25f7a5(0x1c9)])+_0x25f7a5(0x1e0)+_0x221b44[_0x25f7a5(0x1eb)]+'/'+_0x221b44[_0x25f7a5(0x1d9)]+_0x25f7a5(0x1c6));}});return _0x5a3925;},{'verbose':_0x4b20fa[_0x1d3488(0x1e9)]}),_0x1d2523=_0x3bbe32[_0x1d3488(0x1da)],_0x3e22d3=_0x1d2523[_0x1d3488(0x1ef)]?'\x20[Job\x20ID:\x20'+_0x1d2523[_0x1d3488(0x1ef)]+']':'',_0x31b3b7=_0xf12c0a?_0x1d3488(0x1e3)+_0x115c09+'/'+_0x224c5a+_0x1d3488(0x1db):'';console[_0x1d3488(0x1ca)]('✔\x20'+_0x31b3b7+_0x1d3488(0x1c0)+formatRows(_0x1d2523[_0x1d3488(0x1c8)][_0x1d3488(0x1c9)])+_0x1d3488(0x1e0)+(_0x1d3488(0x1e1)+formatElapsed(_0x1d2523['stats'][_0x1d3488(0x1f7)])+_0x3e22d3));if(_0xf12c0a&&_0x4f1a0d){const _0x2ea0bb=resolveOutputOptions(_0x4b20fa),_0x42477c=await formatQueryOutput(_0x1d2523,_0x2ea0bb);_0xf81ad1[_0x1d3488(0x1c1)](_0x42477c);}else await handleQueryOutput(_0x1d2523,_0x4b20fa);}catch(_0x1a13a4){const _0x36aa13=_0xf12c0a?_0x1d3488(0x1e3)+_0x115c09+'/'+_0x224c5a+':\x0a':'',_0x10327e=_0x1a13a4 instanceof SDKError?_0x1a13a4[_0x1d3488(0x1ec)]:_0x1a13a4['message'];return console['error'](''+_0x36aa13+_0x10327e),0x1;}}if(_0x224914[_0x1d3488(0x1c4)]>0x1&&_0x4f1a0d&&_0xf81ad1[_0x1d3488(0x1c4)]>0x0){const _0x4eda10=_0xf81ad1[_0x1d3488(0x1e6)]('\x0a');writeFileSync(_0x4b20fa[_0x1d3488(0x1cf)],_0x4eda10),console[_0x1d3488(0x1ca)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x4b20fa[_0x1d3488(0x1cf)]);}return 0x0;}catch(_0x281c3e){throw _0x281c3e;}}[a29_0x39d704(0x1e5)](_0x122ba3){const _0x51d3bf=a29_0x39d704,_0x130471=_0x122ba3[_0x51d3bf(0x1e4)][0x0],_0x5c4dad=_0x122ba3['options'][_0x51d3bf(0x1d3)];if(!_0x130471&&!_0x5c4dad)return _0x51d3bf(0x1e8);if(_0x130471&&_0x5c4dad)return _0x51d3bf(0x1f8);return undefined;}}
|