@treasuredata/tdx 2026.3.14 → 2026.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-login-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a30_0x388647=a30_0x4611;function a30_0x4611(_0x4a425f,_0x15d02a){_0x4a425f=_0x4a425f-0x6a;const _0x2f4d3b=a30_0x2f4d();let _0x4611c8=_0x2f4d3b[_0x4a425f];return _0x4611c8;}(function(_0x35e9cc,_0xd24413){const _0x5ed3e0=a30_0x4611,_0x504fca=_0x35e9cc();while(!![]){try{const _0x22a969=parseInt(_0x5ed3e0(0x155))/0x1*(parseInt(_0x5ed3e0(0xc0))/0x2)+-parseInt(_0x5ed3e0(0x1f6))/0x3+-parseInt(_0x5ed3e0(0xf2))/0x4+parseInt(_0x5ed3e0(0x177))/0x5*(parseInt(_0x5ed3e0(0x1cb))/0x6)+-parseInt(_0x5ed3e0(0x10a))/0x7+-parseInt(_0x5ed3e0(0x125))/0x8+-parseInt(_0x5ed3e0(0xa7))/0x9*(-parseInt(_0x5ed3e0(0x17d))/0xa);if(_0x22a969===_0xd24413)break;else _0x504fca['push'](_0x504fca['shift']());}catch(_0x303565){_0x504fca['push'](_0x504fca['shift']());}}}(a30_0x2f4d,0x58499));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x2158a2 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x530600 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x388647(0x1d9),LEGACY_PARENT_SEGMENT_DIR=a30_0x388647(0x174);function openBrowser(_0x1f8c14){const _0x4d35ed=a30_0x388647,_0x58e0f2=process[_0x4d35ed(0xa9)],_0x435cf3=_0x58e0f2===_0x4d35ed(0xbc)?_0x4d35ed(0x1ab):_0x58e0f2===_0x4d35ed(0x1e1)?_0x4d35ed(0xa2):_0x4d35ed(0x11a);spawn(_0x435cf3,[_0x1f8c14],{'detached':!![],'stdio':_0x4d35ed(0xfc)})['unref']();}function migrateLegacyDirectory(){const _0x45a77b=a30_0x388647;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x7aaf7=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x7aaf7['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x45a77b(0x1a3)](a30_0x530600[_0x45a77b(0xeb)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x45a77b(0x1ba)+PARENT_SEGMENT_DIR+_0x45a77b(0x88))),console['error'](a30_0x530600['dim'](_0x45a77b(0x1f7)+LEGACY_PARENT_SEGMENT_DIR+_0x45a77b(0xff))),![];console['error'](a30_0x530600['yellow'](_0x45a77b(0x14f)+LEGACY_PARENT_SEGMENT_DIR+_0x45a77b(0x8b)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x530600[_0x45a77b(0x1f1)](_0x45a77b(0x171)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x592473){const _0x5adf5a=_0x592473 instanceof Error?_0x592473[_0x45a77b(0x1c9)]:String(_0x592473);return console['error'](a30_0x530600[_0x45a77b(0xd1)](_0x45a77b(0x163)+_0x5adf5a+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x388647(0x159)](_0x53bf80){return migrateLegacyDirectory(),super['run'](_0x53bf80);}}function resolveYamlFile(_0x1706c0){const _0x4a2fc1=a30_0x388647;if(_0x1706c0[_0x4a2fc1(0x195)]('.yml')||_0x1706c0['endsWith'](_0x4a2fc1(0xc2)))return _0x1706c0;return a30_0x2158a2[_0x4a2fc1(0x8e)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1706c0)+_0x4a2fc1(0x1a7));}function formatProgressMessage(_0x28dc5b){const _0x24c6a0=a30_0x388647,_0x2e771d=_0x28dc5b[_0x24c6a0(0x179)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2e771d){const [,_0x335f64,_0x16cc06,_0x13cfa6='']=_0x2e771d;return a30_0x530600[_0x24c6a0(0xb2)](_0x335f64+':')+'\x20'+_0x16cc06+a30_0x530600['dim'](_0x13cfa6);}return a30_0x530600['dim'](_0x28dc5b);}function showFileNotFoundError(_0x195fd0,_0x345dc2){const _0x354b6d=a30_0x388647;console[_0x354b6d(0x1a3)](a30_0x530600[_0x354b6d(0xd1)](_0x354b6d(0x80)+_0x195fd0+'\x0a')),console['error'](a30_0x530600['cyan']('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x345dc2+_0x354b6d(0x1da)));}function displayRealtimeValidation(_0x569f54){const _0x4306ed=a30_0x388647;if(!_0x569f54[_0x4306ed(0x6e)])return;const _0x3e8619=_0x569f54[_0x4306ed(0x6e)],_0x5a3e05=_0x3e8619[_0x4306ed(0xbf)]?a30_0x530600[_0x4306ed(0x1f1)](_0x4306ed(0xcc)):a30_0x530600[_0x4306ed(0xeb)](_0x4306ed(0x18d));console[_0x4306ed(0x1a3)]('\x0a'+a30_0x530600[_0x4306ed(0xb2)](_0x4306ed(0xed))+'\x20'+_0x5a3e05);if(_0x3e8619['events']&&_0x3e8619[_0x4306ed(0x1fe)][_0x4306ed(0x10c)]>0x0){console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)](_0x4306ed(0xe6))+'\x20'+_0x3e8619['events'][_0x4306ed(0x10c)]+_0x4306ed(0xd8));for(const _0x1b44e2 of _0x3e8619[_0x4306ed(0x1fe)]){const _0x1dc35d=_0x1b44e2[_0x4306ed(0x105)]===![]?a30_0x530600['red']('✘'):a30_0x530600[_0x4306ed(0x1f1)]('✔');console[_0x4306ed(0x1a3)]('\x20\x20\x20\x20'+_0x1dc35d+'\x20'+_0x1b44e2['name']),_0x1b44e2[_0x4306ed(0x13b)]&&console[_0x4306ed(0x1a3)](_0x4306ed(0xd6)+a30_0x530600[_0x4306ed(0xd1)](_0x1b44e2[_0x4306ed(0x13b)]));}}if(_0x3e8619[_0x4306ed(0x15c)]&&_0x3e8619[_0x4306ed(0x15c)][_0x4306ed(0x10c)]>0x0){console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)]('Attributes:')+'\x20'+_0x3e8619['attributes']['length']+_0x4306ed(0xd8));for(const _0x33ffbe of _0x3e8619['attributes']){const _0x1c068b=_0x33ffbe[_0x4306ed(0x1aa)]?a30_0x530600[_0x4306ed(0x1f1)]('✔'):a30_0x530600[_0x4306ed(0xd1)]('✘');console[_0x4306ed(0x1a3)]('\x20\x20\x20\x20'+_0x1c068b+'\x20'+_0x33ffbe[_0x4306ed(0x154)]+'\x20'+a30_0x530600[_0x4306ed(0xb2)]('('+_0x33ffbe[_0x4306ed(0x182)]+')'));}}if(_0x3e8619[_0x4306ed(0x199)]){const _0xb53ab3=_0x3e8619[_0x4306ed(0x199)][_0x4306ed(0x1ee)]?.[_0x4306ed(0x10c)]?'\x20+\x20['+_0x3e8619[_0x4306ed(0x199)][_0x4306ed(0x1ee)][_0x4306ed(0x8e)](',\x20')+']':'';console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)](_0x4306ed(0x129))+'\x20'+_0x3e8619['idStitching'][_0x4306ed(0xd2)]+_0xb53ab3);}if(_0x3e8619[_0x4306ed(0x1b6)]&&_0x3e8619[_0x4306ed(0x1b6)][_0x4306ed(0x10c)]>0x0){console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)]('Personalization:')+'\x20'+_0x3e8619['personalizationServices'][_0x4306ed(0x10c)]+_0x4306ed(0xa1)+(_0x3e8619[_0x4306ed(0x1b6)]['length']!==0x1?'s':''));for(const _0x25ecf0 of _0x3e8619[_0x4306ed(0x1b6)]){console[_0x4306ed(0x1a3)](_0x4306ed(0x7c)+_0x25ecf0['name']);}}}function showParentSegmentNotSetError(_0x1624be){const _0x3444b7=a30_0x388647;console[_0x3444b7(0x1a3)](a30_0x530600['yellow'](_0x3444b7(0x1ae))),console[_0x3444b7(0x1a3)](_0x1624be);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x388647(0x154)]='segment:parent:list';[a30_0x388647(0xec)]='List\x20parent\x20segments';async[a30_0x388647(0x77)](_0x56469c){const _0x1c01a0=a30_0x388647,{options:_0x39fc96,args:_0xa47434,tdx:_0x181cfe}=_0x56469c,_0x40dc1e=_0xa47434[0x0];_0x39fc96[_0x1c01a0(0x1cf)]&&(console[_0x1c01a0(0x1a3)](_0x1c01a0(0xcf)+_0x39fc96[_0x1c01a0(0x18f)]),_0x40dc1e&&console[_0x1c01a0(0x1a3)](_0x1c01a0(0x152)+_0x40dc1e));const _0x31a1af=await withSpinner(_0x40dc1e?_0x1c01a0(0x158)+_0x40dc1e+_0x1c01a0(0x120):_0x1c01a0(0xa4),()=>_0x181cfe[_0x1c01a0(0x176)][_0x1c01a0(0x1e2)](),{'verbose':_0x39fc96['verbose']});let _0x3d293b=_0x31a1af['data'];if(_0x40dc1e){const _0x5eb9fd=_0x40dc1e['replace'](/[.+^${}()|[\]\\]/g,_0x1c01a0(0x102))[_0x1c01a0(0x173)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x677c8a=new RegExp('^'+_0x5eb9fd+'$','i');_0x3d293b=_0x3d293b[_0x1c01a0(0x1d2)](_0x197d96=>_0x677c8a['test'](_0x197d96[_0x1c01a0(0x15c)][_0x1c01a0(0x154)]));}_0x3d293b['sort']((_0x2b58ff,_0x1bded4)=>_0x2b58ff[_0x1c01a0(0x15c)]['name'][_0x1c01a0(0x71)](_0x1bded4[_0x1c01a0(0x15c)][_0x1c01a0(0x154)])),console['error'](_0x1c01a0(0x167)+_0x3d293b[_0x1c01a0(0x10c)]+_0x1c01a0(0x113)+(_0x3d293b['length']!==0x1?'s':''));const _0x2dd26a=_0x26cf93=>{return getConsoleNextUrl(_0x39fc96['site'],'/app/dw/parentSegments/'+_0x26cf93);};if(_0x39fc96['format']===_0x1c01a0(0xf9)||_0x39fc96[_0x1c01a0(0x1e3)]==='jsonl'){const _0x186a02=_0x3d293b[_0x1c01a0(0x16d)](_0x4ea0b5=>({..._0x4ea0b5,'url':_0x2dd26a(_0x4ea0b5['id'])}));await handleSDKOutput(_0x186a02,_0x39fc96);}else{if(_0x3d293b[_0x1c01a0(0x10c)]===0x0)_0x40dc1e?console['log'](_0x1c01a0(0x1d7)+_0x40dc1e):console[_0x1c01a0(0x93)](_0x1c01a0(0x1ff));else for(const _0x15a381 of _0x3d293b){const _0x1cc4f3=_0x15a381[_0x1c01a0(0x15c)]['population']?a30_0x530600[_0x1c01a0(0xb2)]('\x20('+formatRows(_0x15a381[_0x1c01a0(0x15c)]['population'])+')'):'',_0x267225=hyperlink(_0x15a381['attributes']['name'],_0x2dd26a(_0x15a381['id']));console[_0x1c01a0(0x93)](_0x1c01a0(0x9b)+_0x267225+_0x1cc4f3);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x388647(0x154)]='segment:parent:create';[a30_0x388647(0xec)]=a30_0x388647(0x1d6);async[a30_0x388647(0x77)](_0x3ac399){const _0x34216f=a30_0x388647,{options:_0x29ede6,args:_0x20cc61,tdx:_0x2f89fc}=_0x3ac399;console[_0x34216f(0x1a3)](_0x34216f(0x1f3)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x34216f(0xca));const _0x172e2a=_0x29ede6;if(_0x20cc61['length']===0x0)return console[_0x34216f(0x1a3)](a30_0x530600['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x34216f(0x78)),0x1;const _0x116095=_0x20cc61[0x0];if(!_0x172e2a[_0x34216f(0x110)]||!_0x172e2a[_0x34216f(0x1fd)])return console[_0x34216f(0x1a3)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x34216f(0x1a3)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x172e2a[_0x34216f(0x1cf)]&&(console['error'](_0x34216f(0xcf)+_0x172e2a[_0x34216f(0x18f)]),console[_0x34216f(0x1a3)]('Name:\x20'+_0x116095),console[_0x34216f(0x1a3)]('Database:\x20'+_0x172e2a[_0x34216f(0x110)]),console[_0x34216f(0x1a3)]('Table:\x20'+_0x172e2a['table']));const _0x1b869f=await loadJSONFromOptions(_0x172e2a[_0x34216f(0x15c)],_0x172e2a[_0x34216f(0x183)]),_0x52ad05=await loadJSONFromOptions(_0x172e2a[_0x34216f(0x1b3)],_0x172e2a[_0x34216f(0x1d1)]),_0x4d272c=await loadJSONFromOptions(_0x172e2a[_0x34216f(0x112)],_0x172e2a[_0x34216f(0x1c5)]),_0x1ea0c6={'name':_0x116095,'description':_0x172e2a[_0x34216f(0xec)],'scheduleType':_0x172e2a['scheduleType'],'scheduleOption':_0x172e2a[_0x34216f(0x124)],'timezone':_0x172e2a[_0x34216f(0x9a)],'master':{'parentDatabaseName':_0x172e2a['database'],'parentTableName':_0x172e2a[_0x34216f(0x1fd)]},'attributes':_0x1b869f,'behaviors':_0x52ad05,'customerGroup':_0x4d272c},_0x2b232c=await withSpinner(_0x34216f(0x142)+_0x116095+_0x34216f(0x120),()=>_0x2f89fc['segment'][_0x34216f(0x1a8)](_0x1ea0c6),{'verbose':_0x29ede6[_0x34216f(0x1cf)]}),_0x5cb36d=_0x2b232c[_0x34216f(0x7b)];return console[_0x34216f(0x1a3)](_0x34216f(0xf0)+_0x5cb36d[_0x34216f(0x154)]+_0x34216f(0x160)+_0x5cb36d['id']),await handleSDKOutput([_0x5cb36d],_0x29ede6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a30_0x388647(0x1e4);['description']=a30_0x388647(0x11c);async[a30_0x388647(0x77)](_0xcf1142){const _0x14fbff=a30_0x388647,{options:_0x4a5297,args:_0x1b64e5,tdx:_0xfb3eb5}=_0xcf1142;console[_0x14fbff(0x1a3)](_0x14fbff(0x19b)+_0x14fbff(0x1ea)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x464eed=_0x4a5297;if(_0x1b64e5[_0x14fbff(0x10c)]===0x0)return console[_0x14fbff(0x1a3)](a30_0x530600[_0x14fbff(0xd1)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x14fbff(0x1a3)](_0x14fbff(0x11e)),0x1;const _0x1173bd=_0x1b64e5[0x0];_0x464eed[_0x14fbff(0x1cf)]&&(console['error']('Site:\x20'+_0x464eed['site']),console[_0x14fbff(0x1a3)](_0x14fbff(0x7e)+_0x1173bd));const _0x599c34=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x1173bd+_0x14fbff(0x120),()=>_0xfb3eb5[_0x14fbff(0x176)][_0x14fbff(0x82)](_0x1173bd),{'verbose':_0x464eed['verbose']}),_0x5037f5=_0x599c34[_0x14fbff(0x7b)],_0x4e105a=await loadJSONFromOptions(_0x464eed[_0x14fbff(0x79)],_0x464eed['addAttributesFile']),_0x5f3f11=await loadJSONFromOptions(_0x464eed[_0x14fbff(0x17a)],_0x464eed[_0x14fbff(0xe9)]),_0x4c94c4={'name':_0x5037f5['name'],'description':_0x464eed[_0x14fbff(0xec)]!==undefined?_0x464eed['description']:_0x5037f5['description'],'scheduleType':_0x464eed[_0x14fbff(0xb7)]!==undefined?_0x464eed['scheduleType']:_0x5037f5[_0x14fbff(0xb7)],'scheduleOption':_0x464eed['scheduleOption']!==undefined?_0x464eed[_0x14fbff(0x124)]:_0x5037f5['scheduleOption'],'timezone':_0x464eed[_0x14fbff(0x9a)]!==undefined?_0x464eed['timezone']:_0x5037f5[_0x14fbff(0x9a)],'master':_0x5037f5[_0x14fbff(0x1fa)],'attributes':_0x4e105a?[..._0x5037f5[_0x14fbff(0x15c)]||[],..._0x4e105a]:_0x5037f5[_0x14fbff(0x15c)],'behaviors':_0x5f3f11?[..._0x5037f5[_0x14fbff(0x1b3)]||[],..._0x5f3f11]:_0x5037f5[_0x14fbff(0x1b3)],'customerGroup':_0x5037f5['customerGroup']},_0x3171df=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x1173bd+_0x14fbff(0x120),()=>_0xfb3eb5[_0x14fbff(0x176)][_0x14fbff(0xfb)](_0x1173bd,_0x4c94c4),{'verbose':_0x464eed[_0x14fbff(0x1cf)]}),_0x518a7b=_0x3171df[_0x14fbff(0x7b)];return console[_0x14fbff(0x1a3)](_0x14fbff(0xcd)+_0x518a7b[_0x14fbff(0x154)]+'\x27'),await handleSDKOutput([_0x518a7b],_0x464eed),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a30_0x388647(0x86);[a30_0x388647(0xec)]=a30_0x388647(0x12c);async[a30_0x388647(0x77)](_0x52c858){const _0x441967=a30_0x388647,{options:_0x2b0b42,args:_0x25cb68,tdx:_0x13497c}=_0x52c858,_0x39ecde=_0x2b0b42,_0x127e08=_0x25cb68[0x0]||_0x2b0b42['parentSegment'];if(!_0x127e08)return showParentSegmentNotSetError(_0x441967(0x131)+_0x441967(0x1b1)),0x1;if(_0x39ecde[_0x441967(0xfa)]&&_0x39ecde['output'])return console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0xd1)](_0x441967(0xe0))),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0xb2)](_0x441967(0xea))),console[_0x441967(0x1a3)](a30_0x530600['dim'](_0x441967(0x128)+PARENT_SEGMENT_DIR+_0x441967(0x1d4))),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1e7)](_0x441967(0x1bd))),0x1;const _0x3604ad=_0x39ecde['output']||a30_0x2158a2[_0x441967(0x8e)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x127e08)+'.yml');_0x39ecde[_0x441967(0x1cf)]&&(console['error'](_0x441967(0xcf)+_0x39ecde[_0x441967(0x18f)]),console['error'](_0x441967(0x7e)+_0x127e08),console[_0x441967(0x1a3)](_0x441967(0x1df)+_0x3604ad));const _0x36e2f3=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x127e08+_0x441967(0x120),()=>_0x13497c['segment']['pullParentYaml'](_0x127e08),{'verbose':_0x39ecde[_0x441967(0x1cf)]}),_0x1710f3=_0x36e2f3[_0x441967(0x7b)];if(existsSync(_0x3604ad)){const _0x44ce9a=readFileSync(_0x3604ad,_0x441967(0x1f4)),_0x257f8c=generateDiff(_0x44ce9a,_0x1710f3);if(!hasChanges(_0x257f8c))console[_0x441967(0x1a3)](a30_0x530600['green']('✔')+_0x441967(0x135)+a30_0x530600[_0x441967(0x1e7)](_0x3604ad)+_0x441967(0xf4));else{console[_0x441967(0x1a3)]('\x0aChanges\x20to\x20\x27'+_0x3604ad+'\x27:'),console[_0x441967(0x1a3)]('─'['repeat'](0x3c)),console[_0x441967(0x1a3)](formatDiffWithColors(_0x257f8c)),console[_0x441967(0x1a3)]('─'[_0x441967(0x140)](0x3c));if(!_0x39ecde[_0x441967(0x96)]){if(!isInteractive())return console['error'](a30_0x530600['red'](_0x441967(0x1b7)),_0x441967(0xde)),console[_0x441967(0x1a3)](a30_0x530600['dim'](_0x441967(0x127))),0x1;const _0x44e254=await confirmKey(_0x441967(0x16e)+_0x3604ad+'\x27?');if(!_0x44e254)return console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0xeb)](_0x441967(0x175))),0x1;}writeFileSync(_0x3604ad,_0x1710f3,_0x441967(0x1f4)),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1f1)]('✔')+_0x441967(0x157)+a30_0x530600[_0x441967(0x1e7)](_0x3604ad));}}else{const _0x4cefa6=a30_0x2158a2[_0x441967(0x6b)](_0x3604ad);!existsSync(_0x4cefa6)&&mkdirSync(_0x4cefa6,{'recursive':!![]}),writeFileSync(_0x3604ad,_0x1710f3,_0x441967(0x1f4)),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1f1)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x530600[_0x441967(0x1e7)](_0x3604ad));}return saveSessionContext({'parent_segment':_0x127e08},_0x39ecde[_0x441967(0x170)]),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1f1)]('✔')+'\x20Context\x20set:\x20'+a30_0x530600[_0x441967(0xb2)](_0x441967(0x174))+_0x441967(0xf8)+a30_0x530600[_0x441967(0x1e7)](_0x127e08)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x8d);[a30_0x388647(0xec)]=a30_0x388647(0x130);async[a30_0x388647(0x77)](_0x100d75){const _0x3648ea=a30_0x388647,{options:_0x3b053c,args:_0x5b22ea,tdx:_0x2b846b}=_0x100d75,_0xc558cb=_0x3b053c,_0x7a60b6=_0x5b22ea[0x0]||_0x3b053c[_0x3648ea(0x201)];if(!_0x7a60b6)return showParentSegmentNotSetError(_0x3648ea(0xad)+_0x3648ea(0x1ef)),0x1;const _0x386773=resolveYamlFile(_0x7a60b6);if(!existsSync(_0x386773))return showFileNotFoundError(_0x386773,_0x7a60b6),0x1;_0xc558cb[_0x3648ea(0x1cf)]&&(console['error']('Site:\x20'+_0xc558cb[_0x3648ea(0x18f)]),console[_0x3648ea(0x1a3)](_0x3648ea(0x17f)+_0x386773));let _0x37e9cc;try{_0x37e9cc=readFileSync(_0x386773,_0x3648ea(0x1f4));}catch(_0x45ef3a){const _0x534d3c=_0x45ef3a instanceof Error?_0x45ef3a[_0x3648ea(0x1c9)]:String(_0x45ef3a);return console[_0x3648ea(0x1a3)](_0x3648ea(0x1c7)+_0x534d3c),0x1;}const _0x1b1fbf=await withSpinner(_0x3648ea(0x18a),()=>_0x2b846b[_0x3648ea(0x176)][_0x3648ea(0xf6)](_0x37e9cc),{'verbose':_0xc558cb[_0x3648ea(0x1cf)]}),_0x3323cc=_0x1b1fbf[_0x3648ea(0x7b)],{isNew:_0x5c30d4,name:_0x503a73,hasChanges:_0x9fe35a,diffFormatted:_0x3229f6}=_0x3323cc;if(!_0x9fe35a)return console[_0x3648ea(0x1a3)](_0x3648ea(0x10f)+_0x503a73+_0x3648ea(0x198)),0x0;_0x5c30d4?console[_0x3648ea(0x1a3)](_0x3648ea(0x132)+_0x503a73+'\x27:'):console[_0x3648ea(0x1a3)](_0x3648ea(0x1af)+_0x503a73+'\x27:');console['error']('─'[_0x3648ea(0x140)](0x3c)),console[_0x3648ea(0x1a3)](_0x3229f6),console[_0x3648ea(0x1a3)]('─'['repeat'](0x3c));const _0x1f0ad6=_0x5c30d4?'Create\x20parent\x20segment\x20\x27'+_0x503a73+'\x27?':_0x3648ea(0x107)+_0x503a73+'\x27?';if(!_0xc558cb[_0x3648ea(0x96)]){if(!isInteractive())return console[_0x3648ea(0x1a3)](a30_0x530600['red'](_0x3648ea(0x1b7)),_0x3648ea(0xde)),console['error'](a30_0x530600[_0x3648ea(0xb2)](_0x3648ea(0x127))),0x1;const _0x1677f3=await confirmKey(_0x1f0ad6);if(!_0x1677f3)return console['error'](a30_0x530600['yellow'](_0x3648ea(0x175))),0x1;}const _0x1789bd=_0x5c30d4?_0x3648ea(0x104):'Updating',_0x4c7b2e=await withSpinner(_0x1789bd+'\x20parent\x20segment\x20\x27'+_0x503a73+_0x3648ea(0x120),()=>_0x3323cc[_0x3648ea(0x1db)](),{'verbose':_0xc558cb[_0x3648ea(0x1cf)]}),_0x558865=_0x4c7b2e[_0x3648ea(0x7b)],_0x32070d=getConsoleNextUrl(_0xc558cb[_0x3648ea(0x18f)],_0x3648ea(0x90)+_0x558865['id']),_0x1096dc=_0x5c30d4?_0x3648ea(0x1bc):_0x3648ea(0xae);return console[_0x3648ea(0x1a3)]('✔\x20'+_0x1096dc+_0x3648ea(0xaa)+_0x558865[_0x3648ea(0x154)]+'\x27'),console[_0x3648ea(0x1a3)]('\x20\x20'+_0x32070d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x15a);[a30_0x388647(0xec)]=a30_0x388647(0xce);async['execute'](_0x313757){const _0x242f82=a30_0x388647,{options:_0x7b9cb2,args:_0x496b79,tdx:_0x5f0ddf}=_0x313757,_0xf545eb=_0x7b9cb2,_0x417583=_0x496b79[0x0]||_0x7b9cb2[_0x242f82(0x201)];if(!_0x417583)return showParentSegmentNotSetError(_0x242f82(0x193)+_0x242f82(0x85)+_0x242f82(0x6a)+_0x242f82(0x18c)+_0x242f82(0x7d)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x49fbbd=resolveYamlFile(_0x417583);if(!existsSync(_0x49fbbd))return showFileNotFoundError(_0x49fbbd,_0x417583),0x1;_0xf545eb['verbose']&&(console['error'](_0x242f82(0xcf)+_0xf545eb['site']),console[_0x242f82(0x1a3)]('YAML\x20file:\x20'+_0x49fbbd));let _0x561c7e;try{_0x561c7e=readFileSync(_0x49fbbd,'utf-8');}catch(_0x333b1f){const _0x41d2ff=_0x333b1f instanceof Error?_0x333b1f[_0x242f82(0x1c9)]:String(_0x333b1f);return console[_0x242f82(0x1a3)](_0x242f82(0x1c7)+_0x41d2ff),0x1;}const _0x2e80d1=createCommandSpinner(a30_0x530600['dim'](_0x242f82(0x13e)),{'verbose':_0xf545eb[_0x242f82(0x1cf)]});_0x2e80d1[_0x242f82(0xa2)]();const _0x28be94={'onProgress':_0x165569=>{const _0x41b90e=_0x242f82;_0x2e80d1[_0x41b90e(0x6c)]=formatProgressMessage(_0x165569);}};if(_0xf545eb[_0x242f82(0x1fa)])_0x28be94[_0x242f82(0x1fa)]=!![];if(_0xf545eb[_0x242f82(0x1bb)])_0x28be94[_0x242f82(0x1bb)]=!![];_0xf545eb['attribute']&&(_0x28be94[_0x242f82(0x117)]=_0xf545eb[_0x242f82(0x117)]);_0xf545eb['behavior']&&(_0x28be94[_0x242f82(0x196)]=_0xf545eb['behavior']);if(_0xf545eb[_0x242f82(0x147)])_0x28be94[_0x242f82(0x147)]=_0xf545eb[_0x242f82(0x147)];let _0x5072ce;try{_0x5072ce=await _0x5f0ddf['segment'][_0x242f82(0xc1)](_0x561c7e,_0x28be94),_0x2e80d1[_0x242f82(0x1d0)]();}catch(_0x529fc4){_0x2e80d1[_0x242f82(0x1d0)]();throw _0x529fc4;}const _0x542bc7=_0xf545eb[_0x242f82(0x147)]||'-1d';return this['displayValidateResults'](_0x5072ce,_0x28be94,_0x49fbbd,_0x542bc7),_0x5072ce[_0x242f82(0xd4)]?0x0:0x1;}[a30_0x388647(0xc7)](_0x475188,_0x3e6f86,_0xbd17b8,_0x35eb37){const _0x2d95a9=a30_0x388647;console[_0x2d95a9(0x1a3)]('\x0a'+a30_0x530600[_0x2d95a9(0x6d)](_0x2d95a9(0xee))+'\x20'+_0x475188[_0x2d95a9(0x154)]),console[_0x2d95a9(0x1a3)]('═'[_0x2d95a9(0x140)](0x3c)),this[_0x2d95a9(0x10d)](_0x475188);if(typeof _0x3e6f86[_0x2d95a9(0x117)]===_0x2d95a9(0xef)){this[_0x2d95a9(0xbe)](_0x475188),this['displaySummary'](_0x475188),this['displayPreviewHints'](_0xbd17b8,_0x35eb37,_0x2d95a9(0x117),_0x3e6f86[_0x2d95a9(0x117)]);return;}if(_0x3e6f86[_0x2d95a9(0x117)]===!![]){this[_0x2d95a9(0xbe)](_0x475188),this[_0x2d95a9(0xe5)](_0x475188),this[_0x2d95a9(0xa6)](_0xbd17b8,_0x35eb37,_0x2d95a9(0x15c));return;}if(typeof _0x3e6f86[_0x2d95a9(0x196)]==='string'){this[_0x2d95a9(0x1ac)](_0x475188,_0x35eb37),this[_0x2d95a9(0xe5)](_0x475188),this['displayPreviewHints'](_0xbd17b8,_0x35eb37,_0x2d95a9(0x196),_0x3e6f86[_0x2d95a9(0x196)]);return;}if(_0x3e6f86[_0x2d95a9(0x196)]===!![]){this[_0x2d95a9(0x1ac)](_0x475188,_0x35eb37),this['displaySummary'](_0x475188),this[_0x2d95a9(0xa6)](_0xbd17b8,_0x35eb37,_0x2d95a9(0x1b3));return;}this[_0x2d95a9(0xbe)](_0x475188),this[_0x2d95a9(0x1ac)](_0x475188,_0x35eb37),this['displayRealtimeInfo'](_0x475188),this[_0x2d95a9(0xe5)](_0x475188),this['displayPreviewHints'](_0xbd17b8,_0x35eb37,_0x2d95a9(0x165));}[a30_0x388647(0x1a6)](_0x2faa6e){displayRealtimeValidation(_0x2faa6e);}[a30_0x388647(0xa6)](_0x1a9157,_0x3ef056,_0x2afca8,_0x13cc2e){const _0x27e75c=a30_0x388647;console[_0x27e75c(0x1a3)]('\x0a'+a30_0x530600[_0x27e75c(0xb2)]('To\x20view\x20sample\x20data:'));const _0x2f5319=_0x3ef056!==_0x27e75c(0xd5)?_0x27e75c(0x10b)+_0x3ef056:'';if(_0x2afca8==='attribute'&&_0x13cc2e)console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)]('tdx\x20ps\x20preview\x20'+_0x1a9157+_0x27e75c(0x87)+_0x13cc2e+'\x22'+_0x2f5319));else{if(_0x2afca8===_0x27e75c(0x196)&&_0x13cc2e)console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)](_0x27e75c(0x1c4)+_0x1a9157+_0x27e75c(0x1f9)+_0x13cc2e+'\x22'+_0x2f5319));else(_0x2afca8===_0x27e75c(0x15c)||_0x2afca8===_0x27e75c(0x165))&&console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)](_0x27e75c(0x1c4)+_0x1a9157+'\x20--attribute\x20\x22<name>\x22'+_0x2f5319));}(_0x2afca8==='behaviors'||_0x2afca8===_0x27e75c(0x165))&&console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)](_0x27e75c(0x1c4)+_0x1a9157+_0x27e75c(0x108)+_0x2f5319)),_0x2afca8===_0x27e75c(0x165)&&console['error']('\x20\x20'+a30_0x530600['dim'](_0x27e75c(0x1c4)+_0x1a9157+'\x20--enriched'+_0x2f5319));}['displayMasterInfo'](_0x102dbc){const _0x318d61=a30_0x388647,{master:_0x5a5ae1}=_0x102dbc,_0x2def7d=_0x5a5ae1[_0x318d61(0x1e6)]?a30_0x530600['green']('✔'):a30_0x530600[_0x318d61(0xd1)]('✘');console[_0x318d61(0x1a3)]('\x0a'+a30_0x530600[_0x318d61(0xb2)]('Master\x20Table')),console[_0x318d61(0x1a3)](_0x2def7d+'\x20'+a30_0x530600[_0x318d61(0x6d)](_0x5a5ae1[_0x318d61(0x110)]+'.'+_0x5a5ae1['table'])),_0x5a5ae1['schemaValid']?_0x5a5ae1['rowCount']!==undefined&&console['error']('\x20\x20'+a30_0x530600[_0x318d61(0xb2)](_0x318d61(0x109))+'\x20'+a30_0x530600['cyan'](formatRows(_0x5a5ae1[_0x318d61(0x114)]))):console[_0x318d61(0x1a3)]('\x20\x20'+a30_0x530600[_0x318d61(0xd1)](_0x318d61(0x94))+'\x20'+_0x5a5ae1[_0x318d61(0x178)]);}[a30_0x388647(0xbe)](_0x1277af){const _0x560676=a30_0x388647;if(_0x1277af[_0x560676(0x15c)]['length']===0x0)return;console[_0x560676(0x1a3)]('\x0a'+a30_0x530600['dim'](_0x560676(0x14b)));for(const _0x48f608 of _0x1277af[_0x560676(0x15c)]){const _0x53c9bd=_0x48f608[_0x560676(0x1e6)]?a30_0x530600[_0x560676(0x1f1)]('✔'):a30_0x530600[_0x560676(0xd1)]('✘');let _0x10eaf1='';if(_0x48f608[_0x560676(0x1e6)]&&_0x48f608[_0x560676(0xfd)]!==undefined&&_0x48f608['coveragePercent']!==undefined){const _0x2f1acc=_0x48f608[_0x560676(0x153)][_0x560676(0xab)](0x1),_0x16d0a4=_0x48f608[_0x560676(0x153)]>=0x50?a30_0x530600[_0x560676(0x1f1)]:_0x48f608[_0x560676(0x153)]>=0x32?a30_0x530600[_0x560676(0xeb)]:a30_0x530600[_0x560676(0xd1)];_0x10eaf1='\x20'+a30_0x530600['dim'](_0x560676(0x9f))+'\x20'+_0x16d0a4(_0x2f1acc+'%')+'\x20('+formatRows(_0x48f608[_0x560676(0xfd)])+'\x20rows)';}console[_0x560676(0x1a3)](_0x53c9bd+'\x20'+a30_0x530600['bold'](_0x48f608[_0x560676(0x154)])+_0x10eaf1),console[_0x560676(0x1a3)]('\x20\x20'+a30_0x530600[_0x560676(0xb2)](_0x560676(0x18e))+'\x20'+a30_0x530600['bold'](_0x48f608['database']+'.'+_0x48f608[_0x560676(0x1fd)]));const _0x54653d=_0x48f608[_0x560676(0x1a0)]===_0x48f608['foreignKey']?a30_0x530600[_0x560676(0xb2)](_0x560676(0x16a))+'\x20'+_0x48f608['joinKey']:a30_0x530600['dim'](_0x560676(0x15b))+'\x20'+_0x48f608[_0x560676(0x1a0)]+'\x20=\x20'+_0x48f608['foreignKey'];console[_0x560676(0x1a3)]('\x20\x20'+_0x54653d),console[_0x560676(0x1a3)]('\x20\x20'+a30_0x530600[_0x560676(0xb2)]('Columns:')),this[_0x560676(0x1be)](_0x48f608['columns']),!_0x48f608[_0x560676(0x1e6)]&&console['error']('\x20\x20'+a30_0x530600[_0x560676(0xd1)](_0x560676(0x94))+'\x20'+_0x48f608[_0x560676(0x178)]);}}[a30_0x388647(0x1ac)](_0x265421,_0x45036d){const _0x36b48e=a30_0x388647;if(_0x265421['behaviors'][_0x36b48e(0x10c)]===0x0)return;console[_0x36b48e(0x1a3)]('\x0a'+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0x148))+'\x20'+a30_0x530600[_0x36b48e(0xb2)]('('+_0x45036d+')'));for(const _0x8203e6 of _0x265421[_0x36b48e(0x1b3)]){const _0x433bbf=_0x8203e6[_0x36b48e(0x1e6)]?a30_0x530600[_0x36b48e(0x1f1)]('✔'):a30_0x530600[_0x36b48e(0xd1)]('✘');let _0x35fabf='';if(_0x8203e6[_0x36b48e(0x1e6)]&&_0x8203e6[_0x36b48e(0xb1)]!==undefined&&_0x8203e6[_0x36b48e(0xe7)]!==undefined){const _0x28cdc9=_0x8203e6[_0x36b48e(0x1c2)]?.['toFixed'](0x1)||'?',_0x23182a=(_0x8203e6[_0x36b48e(0x1c2)]??0x0)>=0x32?a30_0x530600[_0x36b48e(0x1f1)]:(_0x8203e6[_0x36b48e(0x1c2)]??0x0)>=0x14?a30_0x530600[_0x36b48e(0xeb)]:a30_0x530600[_0x36b48e(0xd1)];_0x35fabf='\x20'+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0xbd))+'\x20'+_0x23182a(formatRows(_0x8203e6[_0x36b48e(0xb1)]))+'\x20('+_0x28cdc9+_0x36b48e(0x89)+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0xe6))+'\x20'+a30_0x530600[_0x36b48e(0x1e7)](formatRows(_0x8203e6[_0x36b48e(0xe7)]));}console[_0x36b48e(0x1a3)](_0x433bbf+'\x20'+a30_0x530600[_0x36b48e(0x6d)](_0x8203e6[_0x36b48e(0x154)])+_0x35fabf),console[_0x36b48e(0x1a3)]('\x20\x20'+a30_0x530600['dim']('Source:')+'\x20'+a30_0x530600[_0x36b48e(0x6d)](_0x8203e6[_0x36b48e(0x110)]+'.'+_0x8203e6[_0x36b48e(0x1fd)]));const _0xf0aa7a=_0x8203e6['joinKey']===_0x8203e6['foreignKey']?a30_0x530600['dim'](_0x36b48e(0x16a))+'\x20'+_0x8203e6[_0x36b48e(0x1a0)]:a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0x15b))+'\x20'+_0x8203e6[_0x36b48e(0x1a0)]+_0x36b48e(0xf8)+_0x8203e6['foreignKey'];console[_0x36b48e(0x1a3)]('\x20\x20'+_0xf0aa7a),console['error']('\x20\x20'+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0xc5))),this[_0x36b48e(0x1be)](_0x8203e6[_0x36b48e(0x118)]),!_0x8203e6[_0x36b48e(0x1e6)]&&console[_0x36b48e(0x1a3)]('\x20\x20'+a30_0x530600[_0x36b48e(0xd1)](_0x36b48e(0x94))+'\x20'+_0x8203e6[_0x36b48e(0x178)]);}}[a30_0x388647(0x1be)](_0x1bf070){const _0x207a75=a30_0x388647;for(const _0x89e6c5 of _0x1bf070){_0x89e6c5[_0x207a75(0x1ed)]===_0x89e6c5[_0x207a75(0x13f)]||_0x89e6c5[_0x207a75(0x13f)]==='*'?console[_0x207a75(0x1a3)](_0x207a75(0x7c)+_0x89e6c5[_0x207a75(0x1ed)]):console[_0x207a75(0x1a3)]('\x20\x20\x20\x20-\x20'+_0x89e6c5[_0x207a75(0x1ed)]+'\x20'+a30_0x530600['dim']('('+_0x89e6c5[_0x207a75(0x13f)]+')'));}}[a30_0x388647(0xe5)](_0x234328){const _0x5b3d0b=a30_0x388647;console[_0x5b3d0b(0x1a3)]('─'[_0x5b3d0b(0x140)](0x3c));if(_0x234328[_0x5b3d0b(0x14c)][_0x5b3d0b(0x10c)]>0x0){console[_0x5b3d0b(0x1a3)]('\x0a'+a30_0x530600['red'](_0x5b3d0b(0x1f0)));for(const _0x582d2b of _0x234328[_0x5b3d0b(0x14c)]){console[_0x5b3d0b(0x1a3)]('\x20\x20'+a30_0x530600[_0x5b3d0b(0xd1)]('•')+'\x20'+_0x582d2b);}}_0x234328[_0x5b3d0b(0xd4)]&&console['error']('\x0a'+a30_0x530600[_0x5b3d0b(0x1f1)]('✔')+_0x5b3d0b(0xc6));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a30_0x388647(0x1de);[a30_0x388647(0xec)]=a30_0x388647(0x14a);async[a30_0x388647(0x77)](_0x4843d4){const _0x57388a=a30_0x388647,{options:_0x22dc0d,args:_0x4a6b28,tdx:_0x7fee3f}=_0x4843d4,_0x48f3b0=_0x22dc0d,_0x246c52=_0x4a6b28[0x0]||_0x22dc0d[_0x57388a(0x201)];if(!_0x246c52)return showParentSegmentNotSetError(_0x57388a(0x197)+_0x57388a(0x19c)+_0x57388a(0x14d)+_0x57388a(0x95)+_0x57388a(0x12a)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x57388a(0xdd)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x48f3b0[_0x57388a(0x1fa)]&&!_0x48f3b0['attribute']&&!_0x48f3b0[_0x57388a(0x196)]&&!_0x48f3b0[_0x57388a(0x1bb)])return console['error'](a30_0x530600[_0x57388a(0xd1)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error']('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error']('Options:'),console[_0x57388a(0x1a3)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x57388a(0x1a3)](_0x57388a(0xe1)),console['error'](_0x57388a(0x164)),console[_0x57388a(0x1a3)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x15d6f2=resolveYamlFile(_0x246c52);if(!existsSync(_0x15d6f2))return showFileNotFoundError(_0x15d6f2,_0x246c52),0x1;_0x48f3b0[_0x57388a(0x1cf)]&&(console['error'](_0x57388a(0xcf)+_0x48f3b0[_0x57388a(0x18f)]),console['error']('YAML\x20file:\x20'+_0x15d6f2));let _0x58aeec;try{_0x58aeec=readFileSync(_0x15d6f2,'utf-8');}catch(_0x251e19){const _0x59af01=_0x251e19 instanceof Error?_0x251e19[_0x57388a(0x1c9)]:String(_0x251e19);return console[_0x57388a(0x1a3)](_0x57388a(0x1c7)+_0x59af01),0x1;}let _0x11950b;try{_0x11950b=parseDef(_0x58aeec);}catch(_0x259c12){const _0xe58d88=_0x259c12 instanceof Error?_0x259c12[_0x57388a(0x1c9)]:String(_0x259c12);return console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0x111)+_0xe58d88)),0x1;}if(_0x48f3b0[_0x57388a(0x117)]===!![]||_0x48f3b0[_0x57388a(0x117)]===''){const _0x23a76f=_0x11950b[_0x57388a(0x15c)]?.[_0x57388a(0x16d)](_0x1620aa=>_0x1620aa[_0x57388a(0x154)])||[];if(_0x23a76f['length']===0x0)console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0x8f)));else{console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0x19f))),console[_0x57388a(0x1a3)](_0x57388a(0x119));for(const _0x4a07e4 of _0x23a76f){console[_0x57388a(0x1a3)]('\x20\x20'+a30_0x530600[_0x57388a(0x1e7)](_0x4a07e4));}console[_0x57388a(0x1a3)](_0x57388a(0xd0)+_0x246c52+_0x57388a(0x87)+_0x23a76f[0x0]+'\x22');}return 0x1;}if(_0x48f3b0[_0x57388a(0x196)]===!![]||_0x48f3b0[_0x57388a(0x196)]===''){const _0x1666ae=_0x11950b[_0x57388a(0x1b3)]?.['map'](_0x5a59c4=>_0x5a59c4['name'])||[];if(_0x1666ae[_0x57388a(0x10c)]===0x0)console['error'](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0xdb)));else{console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x57388a(0x1a3)](_0x57388a(0x8c));for(const _0x174acf of _0x1666ae){console[_0x57388a(0x1a3)]('\x20\x20'+a30_0x530600['cyan'](_0x174acf));}console[_0x57388a(0x1a3)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x246c52+_0x57388a(0x1f9)+_0x1666ae[0x0]+'\x22');}return 0x1;}const _0x2d1b29=createCommandSpinner(a30_0x530600[_0x57388a(0xb2)]('Fetching\x20sample\x20data...'),{'verbose':_0x48f3b0[_0x57388a(0x1cf)]});_0x2d1b29[_0x57388a(0xa2)]();const _0x3e5c36={'onProgress':_0xa3cc94=>{const _0x487d42=_0x57388a;_0x2d1b29[_0x487d42(0x6c)]=formatProgressMessage(_0xa3cc94);}};if(_0x48f3b0[_0x57388a(0x1fa)])_0x3e5c36[_0x57388a(0x1fa)]=!![];if(_0x48f3b0[_0x57388a(0x117)]&&typeof _0x48f3b0[_0x57388a(0x117)]==='string')_0x3e5c36[_0x57388a(0x117)]=_0x48f3b0[_0x57388a(0x117)];if(_0x48f3b0[_0x57388a(0x196)]&&typeof _0x48f3b0[_0x57388a(0x196)]===_0x57388a(0xef))_0x3e5c36[_0x57388a(0x196)]=_0x48f3b0[_0x57388a(0x196)];if(_0x48f3b0[_0x57388a(0x1bb)])_0x3e5c36[_0x57388a(0x1bb)]=!![];if(_0x48f3b0[_0x57388a(0x147)])_0x3e5c36[_0x57388a(0x147)]=_0x48f3b0[_0x57388a(0x147)];let _0x4926e3;try{_0x4926e3=await _0x7fee3f['segment']['previewParentYaml'](_0x58aeec,_0x3e5c36),_0x2d1b29[_0x57388a(0x1d0)]();}catch(_0xe6ec42){_0x2d1b29[_0x57388a(0x1d0)]();throw _0xe6ec42;}return await this[_0x57388a(0x116)](_0x4926e3,{'master':_0x48f3b0[_0x57388a(0x1fa)],'attribute':typeof _0x48f3b0[_0x57388a(0x117)]===_0x57388a(0xef)?_0x48f3b0[_0x57388a(0x117)]:undefined,'behavior':typeof _0x48f3b0[_0x57388a(0x196)]===_0x57388a(0xef)?_0x48f3b0['behavior']:undefined,'enriched':_0x48f3b0[_0x57388a(0x1bb)]}),_0x4926e3[_0x57388a(0xd4)]?0x0:0x1;}async[a30_0x388647(0x116)](_0x26eec1,_0xfb34fd){const _0x4a4999=a30_0x388647;console['error']('\x0a'+a30_0x530600[_0x4a4999(0x6d)](_0x4a4999(0xb5))+'\x20'+_0x26eec1['name']),console[_0x4a4999(0x1a3)]('═'[_0x4a4999(0x140)](0x3c));if(_0xfb34fd[_0x4a4999(0x1fa)]&&_0x26eec1[_0x4a4999(0x15d)]){const _0x8b944e=a30_0x530600[_0x4a4999(0xb2)](_0x4a4999(0xd7))+'\x20'+a30_0x530600[_0x4a4999(0x6d)](_0x26eec1['master'][_0x4a4999(0x110)]+'.'+_0x26eec1['master'][_0x4a4999(0x1fd)]);await this[_0x4a4999(0xb9)](_0x8b944e,_0x26eec1[_0x4a4999(0x15d)]);}else{if(_0xfb34fd[_0x4a4999(0x117)]&&_0x26eec1['sampleData']){const _0x1c5215=a30_0x530600[_0x4a4999(0xb2)](_0x4a4999(0x150))+'\x20'+a30_0x530600['bold'](_0xfb34fd[_0x4a4999(0x117)]);await this[_0x4a4999(0xb9)](_0x1c5215,_0x26eec1[_0x4a4999(0x15d)]);}else{if(_0xfb34fd['behavior']&&_0x26eec1[_0x4a4999(0x15d)]){const _0x34759a=a30_0x530600['dim'](_0x4a4999(0x9d))+'\x20'+a30_0x530600[_0x4a4999(0x6d)](_0xfb34fd[_0x4a4999(0x196)]);await this['displaySampleData'](_0x34759a,_0x26eec1[_0x4a4999(0x15d)]);}else{if(_0xfb34fd[_0x4a4999(0x1bb)]&&_0x26eec1['sampleData']){const _0x604822=a30_0x530600[_0x4a4999(0xb2)](_0x4a4999(0x162))+'\x20'+a30_0x530600['bold'](_0x4a4999(0xc8));await this['displaySampleData'](_0x604822,_0x26eec1['sampleData']);}else!_0x26eec1[_0x4a4999(0x15d)]&&console[_0x4a4999(0x1a3)](_0x4a4999(0x1e0));}}}if(_0x26eec1[_0x4a4999(0x14c)]['length']>0x0){console[_0x4a4999(0x1a3)]('─'[_0x4a4999(0x140)](0x3c)),console[_0x4a4999(0x1a3)]('\x0a'+a30_0x530600[_0x4a4999(0xd1)](_0x4a4999(0x1f0)));for(const _0x1e0a37 of _0x26eec1[_0x4a4999(0x14c)]){console[_0x4a4999(0x1a3)]('\x20\x20'+a30_0x530600[_0x4a4999(0xd1)]('•')+'\x20'+_0x1e0a37);}}}async[a30_0x388647(0xb9)](_0x160107,_0x61498a){const _0x12f0e3=a30_0x388647;if(_0x61498a[_0x12f0e3(0x10c)]===0x0){console['error']('\x0a'+_0x160107),console['error'](_0x12f0e3(0x17b));return;}console['error']('\x0a'+_0x160107);const _0x1859f6=Object[_0x12f0e3(0x84)](_0x61498a[0x0])[_0x12f0e3(0x16d)](_0x394150=>({'name':_0x394150,'type':typeof _0x61498a[0x0][_0x394150]===_0x12f0e3(0xa3)?'double':'varchar'})),_0x424f75={'queryId':_0x12f0e3(0xcb),'columns':_0x1859f6,'data':_0x61498a,'stats':{'state':_0x12f0e3(0xe8),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x61498a[_0x12f0e3(0x10c)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x21714a=formatAsTable(_0x424f75,_0x61498a[_0x12f0e3(0x10c)],!![]);await writeOutput(_0x21714a,undefined,_0x12f0e3(0x1fd));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x83);[a30_0x388647(0xec)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a30_0x388647(0x77)](_0x10fd6a){const _0x2fc2e7=a30_0x388647,{options:_0x5af3fd,args:_0x25ac80,tdx:_0x16f22b}=_0x10fd6a,_0x1a7e0f=_0x5af3fd,_0x101a90=_0x25ac80[0x0]||_0x5af3fd[_0x2fc2e7(0x201)];if(!_0x101a90)return showParentSegmentNotSetError(_0x2fc2e7(0x103)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x2cfd8b=resolveYamlFile(_0x101a90);if(existsSync(_0x2cfd8b)){_0x1a7e0f[_0x2fc2e7(0x1cf)]&&console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x134)+_0x2cfd8b);let _0x27d8a2;try{_0x27d8a2=readFileSync(_0x2cfd8b,_0x2fc2e7(0x1f4));}catch(_0x13e112){const _0x58beb=_0x13e112 instanceof Error?_0x13e112[_0x2fc2e7(0x1c9)]:String(_0x13e112);return console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x1c7)+_0x58beb),0x1;}const _0x5594c8=await withSpinner(_0x2fc2e7(0x18a),()=>_0x16f22b[_0x2fc2e7(0x176)]['pushParentYaml'](_0x27d8a2),{'verbose':_0x1a7e0f[_0x2fc2e7(0x1cf)]}),_0x11b4a8=_0x5594c8[_0x2fc2e7(0x7b)],{isNew:_0x21a592,name:_0x11ade5,hasChanges:_0x4acd74,diffFormatted:_0xd20635}=_0x11b4a8;if(_0x4acd74){_0x21a592?console['error'](_0x2fc2e7(0x132)+_0x11ade5+'\x27:'):console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x1af)+_0x11ade5+'\x27:');console[_0x2fc2e7(0x1a3)]('─'[_0x2fc2e7(0x140)](0x3c)),console[_0x2fc2e7(0x1a3)](_0xd20635),console[_0x2fc2e7(0x1a3)]('─'[_0x2fc2e7(0x140)](0x3c));const _0x563f6e=_0x21a592?_0x2fc2e7(0x126)+_0x11ade5+_0x2fc2e7(0x1b9):_0x2fc2e7(0x107)+_0x11ade5+_0x2fc2e7(0x1b9);if(!_0x1a7e0f['yes']){if(!isInteractive())return console[_0x2fc2e7(0x1a3)](a30_0x530600[_0x2fc2e7(0xd1)]('\x0aError:'),_0x2fc2e7(0xde)),console[_0x2fc2e7(0x1a3)](a30_0x530600['dim'](_0x2fc2e7(0x127))),0x1;const _0x198cad=await confirmKey(_0x563f6e);if(!_0x198cad)return console['error'](a30_0x530600[_0x2fc2e7(0xeb)]('Aborted.')),0x1;}const _0x3bdcd9=_0x21a592?_0x2fc2e7(0x104):_0x2fc2e7(0x1a4);await withSpinner(_0x3bdcd9+_0x2fc2e7(0xaa)+_0x11ade5+_0x2fc2e7(0x120),()=>_0x11b4a8['apply'](),{'verbose':_0x1a7e0f[_0x2fc2e7(0x1cf)]});const _0x203fb8=_0x21a592?_0x2fc2e7(0x1bc):_0x2fc2e7(0xae);console['error']('✔\x20'+_0x203fb8+'\x20parent\x20segment\x20\x27'+_0x11ade5+'\x27');}else console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x10f)+_0x11ade5+_0x2fc2e7(0xac));}const _0x4fd9e4=await withSpinner(_0x2fc2e7(0x1a1)+_0x101a90+_0x2fc2e7(0x120),()=>_0x16f22b[_0x2fc2e7(0x176)][_0x2fc2e7(0x1a5)](_0x101a90),{'verbose':_0x1a7e0f[_0x2fc2e7(0x1cf)]}),_0x368a8e=_0x4fd9e4[_0x2fc2e7(0x7b)],_0x521cd1=getConsoleUrl(_0x1a7e0f[_0x2fc2e7(0x18f)],_0x2fc2e7(0x121)+_0x368a8e[_0x2fc2e7(0x194)]+_0x2fc2e7(0x100)+_0x368a8e[_0x2fc2e7(0x1d3)]+_0x2fc2e7(0x11b)+_0x368a8e[_0x2fc2e7(0x141)]);return console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x172)),console[_0x2fc2e7(0x1a3)]('\x20\x20'+a30_0x530600[_0x2fc2e7(0xb2)](_0x2fc2e7(0xb8))+'\x20'+_0x368a8e[_0x2fc2e7(0x101)]),console['error']('\x20\x20'+a30_0x530600[_0x2fc2e7(0xb2)](_0x2fc2e7(0x161))+'\x20'+_0x368a8e['status']),console[_0x2fc2e7(0x1a3)]('\x20\x20'+a30_0x530600[_0x2fc2e7(0xb2)]('Session:')+'\x20'+_0x368a8e['workflowSessionId']),console['error']('\x20\x20'+a30_0x530600['dim'](_0x2fc2e7(0x186))+'\x20'+_0x368a8e['workflowAttemptId']),console[_0x2fc2e7(0x1a3)]('\x20\x20'+_0x521cd1),console['error']('\x0a'+a30_0x530600[_0x2fc2e7(0xb2)](_0x2fc2e7(0xc9))+_0x2fc2e7(0xf5)+_0x368a8e[_0x2fc2e7(0x141)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a30_0x388647(0xda);['description']=a30_0x388647(0x16c);async[a30_0x388647(0x77)](_0x5e7714){const _0x2be644=a30_0x388647,{options:_0xe12dd3,args:_0x44fbc6,tdx:_0x602705}=_0x5e7714,_0x12ff68=_0x44fbc6[0x0]||_0xe12dd3[_0x2be644(0x201)];if(!_0x12ff68)return showParentSegmentNotSetError(_0x2be644(0x1ec)+_0x2be644(0x15f)),0x1;_0xe12dd3[_0x2be644(0x1cf)]&&(console[_0x2be644(0x1a3)]('Site:\x20'+_0xe12dd3[_0x2be644(0x18f)]),console['error']('Parent\x20segment:\x20'+_0x12ff68));const _0x15cc1d=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x12ff68+_0x2be644(0x120),()=>_0x602705[_0x2be644(0x176)][_0x2be644(0x14e)](_0x12ff68),{'verbose':_0xe12dd3[_0x2be644(0x1cf)]}),_0x39dd45=_0x15cc1d[_0x2be644(0x7b)];console[_0x2be644(0x1a3)](_0x2be644(0x167)+_0x39dd45[_0x2be644(0x10c)]+'\x20field'+(_0x39dd45[_0x2be644(0x10c)]!==0x1?'s':''));if(_0xe12dd3[_0x2be644(0xf9)]||_0xe12dd3[_0x2be644(0x1b0)])return await handleSDKOutput(_0x39dd45,_0xe12dd3),0x0;return displayFieldsHumanReadable(_0x39dd45,_0x12ff68),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x388647(0x154)]=a30_0x388647(0xc3);[a30_0x388647(0xec)]=a30_0x388647(0x123);async['execute'](_0xc2ee88){const _0x23ac09=a30_0x388647,{options:_0x4d4463,args:_0x39f383,tdx:_0x4542bc}=_0xc2ee88,_0x2b9ba1=_0x4d4463,_0x2e7873=_0x39f383[0x0]||_0x4d4463[_0x23ac09(0x201)];if(!_0x2e7873)return showParentSegmentNotSetError(_0x23ac09(0x13d)+_0x23ac09(0x19a)+'Options:\x0a'+_0x23ac09(0x190)),0x1;_0x4d4463[_0x23ac09(0x1cf)]&&(console['error'](_0x23ac09(0xcf)+_0x4d4463[_0x23ac09(0x18f)]),console[_0x23ac09(0x1a3)]('Parent\x20segment:\x20'+_0x2e7873));const _0x2b70b7=await withSpinner(_0x23ac09(0x1bf)+_0x2e7873+_0x23ac09(0x120),()=>_0x4542bc[_0x23ac09(0x176)][_0x23ac09(0x82)](_0x2e7873),{'verbose':_0x4d4463[_0x23ac09(0x1cf)]}),_0x418342=_0x2b70b7['data'];if(_0x2b9ba1[_0x23ac09(0x1b2)]){const _0x4726bd=getConsoleNextUrl(_0x2b9ba1[_0x23ac09(0x18f)],_0x23ac09(0x90)+_0x418342['id']);return console['error'](a30_0x530600['green']('✔')+_0x23ac09(0x7f)+a30_0x530600[_0x23ac09(0x1e7)](_0x4726bd)),openBrowser(_0x4726bd),0x0;}return await handleSingleObjectOutput(_0x418342,_0x4d4463),0x0;}}function a30_0x2f4d(){const _0x26a309=['\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20personalization\x20service','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','column_name','list','execute','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','addAttributes','\x20\x20Columns:\x20','data','\x20\x20\x20\x20-\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Parent\x20segment:\x20','\x20Opening\x20','Error:\x20File\x20not\x20found:\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','getParentFull','segment:parent:run','keys','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','segment:parent:pull','\x20--attribute\x20\x22','/\x20directories\x20exist.','%)\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','/\x20→\x20','Available\x20behaviors:','segment:parent:push','join','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','/app/dw/parentSegments/','elapsedTimeMillis','parent_id','log','Error:','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','yes','Executing\x20parent\x20segment\x20query...','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','getBehaviorNames','timezone','👥\x20','trigger_event','Behavior:','\x22,\x20\x22type\x22:\x20\x22','Coverage:','Schema\x20saved\x20to\x20','\x20service','start','number','Listing\x20parent\x20segments...','Fetching\x20behavior\x20list...','displayPreviewHints','18obtvgn','{\x0a\x20\x20\x22database\x22:\x20\x22','platform','\x20parent\x20segment\x20\x27','toFixed','\x27\x20is\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Updated','resolveParentId','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','customersWithEvents','dim','\x20section','\x20service(s)\x20configured','Preview:','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','scheduleType','Audience\x20ID:','displaySampleData','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','darwin','Customers:','displayAttributesStats','enabled','8XOapgm','validateParentYaml','.yaml','segment:parent:view','reduce','Columns:','\x20Configuration\x20is\x20valid','displayValidateResults','Master\x20+\x20Attributes','To\x20cancel:','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','preview','⚡\x20Enabled','✔\x20Updated\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Site:\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','red','primaryKey','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','allValid','-1d','\x20\x20\x20\x20\x20\x20','Master:','\x20configured','\x20\x20Database:\x20','segment:parent:fields','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\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','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','<database>.<table>','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20RT-enabled\x20parent\x20segment','getOutputDatabaseName','\x20\x20\x20','displaySummary','Events:','totalEvents','FINISHED','addBehaviorsFile','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','yellow','description','RT\x202.0:','Validate:','string','✔\x20Created\x20parent\x20segment\x20\x27','segment:parent:desc','2432780haVJmr','realtime:','\x20is\x20already\x20up\x20to\x20date','\x20tdx\x20wf\x20attempt\x20','pushParentYaml','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20=\x20','json','use','updateParent','ignore','matchedCount','Show\x20parent\x20segment\x20schema\x20(column\x20types)','/\x20directory.\x0a','/sessions/','audienceId','\x5c$&','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Creating','sourceTableValid','sections','Apply\x20changes\x20to\x20\x27','\x20--behavior\x20\x22<name>\x22','Rows:','2348465rCoden','\x20--interval\x20','length','displayMasterInfo','\x20Added\x20personalization\x20template\x20to\x20','✔\x20No\x20changes\x20-\x20\x27','database','Error\x20parsing\x20YAML:\x20','customerGroup','\x20parent\x20segment','rowCount','toLocaleString','displayPreviewResults','attribute','columns','Available\x20attributes:','xdg-open','/attempt/','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','personalization','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','No\x20RT-enabled\x20parent\x20segments\x20found','\x27...','/app/workflows/','processedRows','Show\x20parent\x20segment\x20details','scheduleOption','1473352JDjuFo','Create\x20parent\x20segment\x20\x27','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','using\x20the\x20default\x20path:\x20','ID\x20Stitching:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','ps:pz:init','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Fetching\x20customers\x20schema...','page_view','trim','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x0aNew\x20parent\x20segment\x20\x27','Personalization\x20service\x20description','Found\x20YAML\x20file:\x20','\x20No\x20changes\x20-\x20','toLowerCase','true','\x20to\x20push\x20the\x20configuration','RT\x202.0\x20Validate:','\x0a\x20\x20\x20\x20}','sourceTableError','.customers)','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Validating\x20configuration...','column','repeat','workflowAttemptId','Creating\x20parent\x20segment\x20\x27','Validating\x20RT\x20configuration...','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','query','Output\x20Database:','interval','Behaviors','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Attributes','errors','Options\x20(one\x20required):\x0a','listFields','\x0a⚠️\x20\x20Migrating:\x20','Attribute:','Listing\x20personalization\x20services\x20for\x20\x27','Pattern:\x20','coveragePercent','name','92409OJUWEI','column_type','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Listing\x20parent\x20segments\x20matching\x20\x27','run','segment:parent:validate','Join:','attributes','sampleData','\x20\x202.\x20Run\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x27\x20with\x20ID:\x20','Status:','Enriched:','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','all','realtime_enabled','✔\x20Found\x20','ps:rt:list','\x0a\x20\x20\x20\x20]','Join\x20on:','segment:parent:sql','List\x20available\x20fields\x20for\x20segmentation','map','Overwrite\x20\x27','limit','session','✔\x20Renamed\x20directory\x20to\x20','\x0a✔\x20Workflow\x20started','replace','parent_segment','Aborted.','segment','5JZVYBU','schemaError','match','addBehaviors','\x20\x20No\x20sample\x20data\x20available','getParentSQL','3343930IlFDqh','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','YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20','type','attributesFile','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','SQL\x20query:\x0a','Attempt:','Listing\x20RT-enabled\x20parent\x20segments...','collectSchema','Default','Analyzing\x20changes...','user_id','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','⚡\x20Not\x20enabled','Source:','site','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20Added\x20RT\x202.0\x20template\x20section','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','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','workflowId','endsWith','behavior','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x27\x20is\x20already\x20up\x20to\x20date','idStitching','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','output','push','Error:\x20--attribute\x20requires\x20a\x20name\x0a','joinKey','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20behaviors','error','Updating','runParent','displayRealtimeInfo','.yml','createParent','Next\x20steps:','valid','open','displayBehaviorsStats','Resolving\x20parent\x20segment\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','jsonl','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','web','behaviors','indexOf','\x20\x201.\x20Edit\x20','personalizationServices','\x0aError:','ps:rt:validate','\x27\x20and\x20run\x20workflow?','/\x20and\x20','enriched','Created','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displayColumns','Fetching\x20parent\x20segment\x20\x27','My\x20Service','sort','customerPercent','customers','tdx\x20ps\x20preview\x20','customerGroupFile','in\x20','Error\x20reading\x20file:\x20','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','message','behavior_','3378660siKLQt','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','last_page_viewed','verbose','stop','behaviorsFile','filter','workflowSessionId','/{name}.yml\x0a','\x20rows\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','No\x20parent\x20segments\x20match\x20pattern:\x20','personalization_services','parent_segments','`\x20to\x20download\x20the\x20configuration\x20first','apply','\x20\x20Note:\x20','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','segment:parent:preview','Output\x20file:\x20','\x0aNo\x20sample\x20data\x20available','win32','listParents','format','segment:parent:update','✔\x20Query\x20completed:\x20Processed\x20','schemaValid','cyan','Fetching\x20SQL\x20for\x20\x27','formatSchemaJson','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','jobId','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','label','stitchingKeys','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Errors:','green','td_client_id','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','utf-8','tdx\x20ps\x20push\x20','336144MbRcpT','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','population','\x20--behavior\x20\x22','master','\x22\x20}','No\x20personalization\x20services\x20configured','table','events','No\x20parent\x20segments\x20found','\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','parentSegment','Options:\x0a','dirname','text','bold','realtime','SELECT\x20*\x20FROM\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','localeCompare'];a30_0x2f4d=function(){return _0x26a309;};return a30_0x2f4d();}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x388647(0x154)]=a30_0x388647(0xf1);['description']=a30_0x388647(0xfe);async[a30_0x388647(0x77)](_0x2dd58a){const _0x5cf178=a30_0x388647,{options:_0xa66b3a,args:_0x3f167e,tdx:_0x4dd822}=_0x2dd58a,_0x25d5c8=_0xa66b3a,_0x11bec8=_0x3f167e[0x0]||_0xa66b3a[_0x5cf178(0x201)];if(!_0x11bec8)return showParentSegmentNotSetError(_0x5cf178(0x192)+_0x5cf178(0x200)+_0x5cf178(0x6a)+_0x5cf178(0x1c8)),0x1;_0xa66b3a['verbose']&&(console['error'](_0x5cf178(0xcf)+_0xa66b3a[_0x5cf178(0x18f)]),console[_0x5cf178(0x1a3)](_0x5cf178(0x7e)+_0x11bec8));const _0x154c5d=await withSpinner(_0x5cf178(0x1ad)+_0x11bec8+'\x27...',()=>_0x4dd822[_0x5cf178(0x176)]['resolveParentId'](_0x11bec8),{'verbose':_0xa66b3a[_0x5cf178(0x1cf)]}),_0x4b18fe=_0x154c5d['data'],_0x34187f=_0x4dd822[_0x5cf178(0x176)][_0x5cf178(0xe3)](_0x4b18fe);if(_0x25d5c8[_0x5cf178(0x19d)]){const _0x192d3b=await this[_0x5cf178(0x188)](_0x2dd58a,_0x11bec8,_0x4b18fe,_0x34187f),_0x9acc8b=this[_0x5cf178(0x1e9)](_0x192d3b);writeFileSync(_0x25d5c8[_0x5cf178(0x19d)],_0x9acc8b);const _0x5c46ae=_0x192d3b[_0x5cf178(0x1c3)][_0x5cf178(0x118)][_0x5cf178(0x10c)]+_0x192d3b[_0x5cf178(0x1b3)][_0x5cf178(0xc4)]((_0x59825a,_0x19a4fd)=>_0x59825a+_0x19a4fd['columns'][_0x5cf178(0x10c)],0x0),_0x34c3cf=_0x192d3b[_0x5cf178(0x1b3)][_0x5cf178(0x1d2)](_0x5a5054=>_0x5a5054[_0x5cf178(0x118)][_0x5cf178(0x10c)]===0x0)[_0x5cf178(0x10c)];return console[_0x5cf178(0x93)](_0x5cf178(0xa0)+_0x25d5c8[_0x5cf178(0x19d)]),console['log'](_0x5cf178(0xd9)+_0x34187f),console['log'](_0x5cf178(0x8a)+_0x192d3b[_0x5cf178(0x1b3)][_0x5cf178(0x10c)]+_0x5cf178(0x1a2)),console[_0x5cf178(0x93)](_0x5cf178(0x7a)+_0x5c46ae+'\x20total'),_0x34c3cf>0x0&&console[_0x5cf178(0x93)](_0x5cf178(0x1dc)+_0x34c3cf+_0x5cf178(0x72)),0x0;}console['error']('\x0a'+a30_0x530600['bold'](_0x5cf178(0x146))+'\x20'+a30_0x530600[_0x5cf178(0x1e7)](_0x34187f));const _0x45f193=await withSpinner(_0x5cf178(0x12d),()=>_0x4dd822[_0x5cf178(0x176)][_0x5cf178(0x17c)](_0x4b18fe),{'verbose':_0xa66b3a[_0x5cf178(0x1cf)]});console['error']('\x0a'+a30_0x530600[_0x5cf178(0x6d)](_0x5cf178(0x1c3))+'\x20'+a30_0x530600[_0x5cf178(0xb2)]('('+_0x34187f+_0x5cf178(0x13c)));const _0x3627fe=await executeSchemaQuery(_0x45f193[_0x5cf178(0x7b)],_0x4dd822,_0xa66b3a);await handleQueryOutput(_0x3627fe,_0xa66b3a);const _0x481f7f=await withSpinner(_0x5cf178(0xa5),()=>_0x4dd822[_0x5cf178(0x176)][_0x5cf178(0x99)](_0x4b18fe),{'verbose':_0xa66b3a[_0x5cf178(0x1cf)]});for(const _0x147282 of _0x481f7f[_0x5cf178(0x7b)]){const _0x1d33c5=_0x5cf178(0x1ca)+_0x147282[_0x5cf178(0x136)]()['replace'](/\s+/g,'_'),_0x57bee7=_0x5cf178(0x6f)+_0x34187f+'.'+_0x1d33c5;console[_0x5cf178(0x1a3)]('\x0a'+a30_0x530600['bold'](_0x147282)+'\x20'+a30_0x530600[_0x5cf178(0xb2)]('('+_0x34187f+'.'+_0x1d33c5+')'));try{const _0x124500=await executeSchemaQuery(_0x57bee7,_0x4dd822,_0xa66b3a);await handleQueryOutput(_0x124500,_0xa66b3a);}catch{console[_0x5cf178(0x1a3)](a30_0x530600[_0x5cf178(0xeb)](_0x5cf178(0xba)));}}return 0x0;}async['collectSchema'](_0x2a9a47,_0x5a7e8d,_0xb55571,_0x608724){const _0x59e752=a30_0x388647,{options:_0x211ffa,tdx:_0x177099}=_0x2a9a47,_0x363ca4=await withSpinner(_0x59e752(0x12d),()=>_0x177099[_0x59e752(0x176)][_0x59e752(0x17c)](_0xb55571),{'verbose':_0x211ffa[_0x59e752(0x1cf)]}),_0x3977a0=await executeSchemaQuery(_0x363ca4[_0x59e752(0x7b)],_0x177099,_0x211ffa),_0x2ab55d=_0x3977a0[_0x59e752(0x7b)]['map'](_0x5ded86=>({'name':_0x5ded86[_0x59e752(0x75)],'type':_0x5ded86[_0x59e752(0x156)]})),_0x5e5edb=await withSpinner(_0x59e752(0xa5),()=>_0x177099[_0x59e752(0x176)][_0x59e752(0x99)](_0xb55571),{'verbose':_0x211ffa[_0x59e752(0x1cf)]}),_0x2a7a2c=[];for(const _0x450feb of _0x5e5edb[_0x59e752(0x7b)]){const _0x426856='behavior_'+_0x450feb[_0x59e752(0x136)]()[_0x59e752(0x173)](/\s+/g,'_'),_0x5aaf8d='SELECT\x20*\x20FROM\x20'+_0x608724+'.'+_0x426856;let _0x3e4e98=[];try{const _0x18118f=await executeSchemaQuery(_0x5aaf8d,_0x177099,_0x211ffa);_0x3e4e98=_0x18118f[_0x59e752(0x7b)]['map'](_0x3f5032=>({'name':_0x3f5032[_0x59e752(0x75)],'type':_0x3f5032['column_type']}));}catch{}_0x2a7a2c[_0x59e752(0x19e)]({'table':_0x426856,'columns':_0x3e4e98});}return{'database':_0x608724,'parent_segment':_0x5a7e8d,'parent_id':_0xb55571,'customers':{'table':_0x59e752(0x1c3),'columns':_0x2ab55d},'behaviors':_0x2a7a2c};}[a30_0x388647(0x1e9)](_0x1a03ce){const _0x55ad87=a30_0x388647,_0x6c6859=_0x50b767=>{const _0x3e0b53=a30_0x4611;if(_0x50b767['length']===0x0)return'[]';const _0x5666d1=_0x50b767['map'](_0x48f8f3=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x48f8f3['name']+_0x3e0b53(0x9e)+_0x48f8f3[_0x3e0b53(0x182)]+_0x3e0b53(0x1fb));return'[\x0a'+_0x5666d1['join'](',\x0a')+_0x3e0b53(0x169);},_0x586754=_0x1a03ce[_0x55ad87(0x1b3)][_0x55ad87(0x16d)](_0x3190cd=>{const _0x230ce6=_0x55ad87;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x3190cd['table']+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x6c6859(_0x3190cd['columns'])[_0x230ce6(0x173)](/^/gm,'\x20\x20')[_0x230ce6(0x12f)]()+_0x230ce6(0x13a);})[_0x55ad87(0x8e)](',\x0a');return _0x55ad87(0xa8)+_0x1a03ce[_0x55ad87(0x110)]+_0x55ad87(0x74)+_0x1a03ce[_0x55ad87(0x174)]+_0x55ad87(0xb6)+_0x1a03ce[_0x55ad87(0x92)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1a03ce[_0x55ad87(0x1c3)][_0x55ad87(0x1fd)]+_0x55ad87(0xf7)+_0x6c6859(_0x1a03ce[_0x55ad87(0x1c3)][_0x55ad87(0x118)])[_0x55ad87(0x173)](/^/gm,'\x20\x20')[_0x55ad87(0x12f)]()+_0x55ad87(0x98)+_0x586754+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x388647(0x154)]=a30_0x388647(0x16b);[a30_0x388647(0xec)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x509bcc){const _0x82bee=a30_0x388647,{options:_0x33dcf2,args:_0xccd6e1,tdx:_0x347ac3}=_0x509bcc,_0x2a4bb7=_0xccd6e1[0x0]||_0x33dcf2[_0x82bee(0x201)];if(!_0x2a4bb7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x82bee(0x1cc)),0x1;_0x33dcf2[_0x82bee(0x1cf)]&&(console[_0x82bee(0x1a3)](_0x82bee(0xcf)+_0x33dcf2[_0x82bee(0x18f)]),console[_0x82bee(0x1a3)](_0x82bee(0x7e)+_0x2a4bb7));const _0x5c925a=await withSpinner(_0x82bee(0x1ad)+_0x2a4bb7+'\x27...',()=>_0x347ac3[_0x82bee(0x176)][_0x82bee(0xaf)](_0x2a4bb7),{'verbose':_0x33dcf2[_0x82bee(0x1cf)]}),_0x219d6c=_0x5c925a['data'],_0x1d80c8=await withSpinner(_0x82bee(0x1e8)+_0x2a4bb7+_0x82bee(0x120),()=>_0x347ac3['segment'][_0x82bee(0x17c)](_0x219d6c),{'verbose':_0x33dcf2[_0x82bee(0x1cf)]}),_0x1f4009=_0x1d80c8[_0x82bee(0x7b)];return _0x33dcf2['format']===_0x82bee(0xf9)||_0x33dcf2[_0x82bee(0x1e3)]===_0x82bee(0x1b0)?await handleSDKOutput([{'sql':_0x1f4009}],_0x33dcf2):console[_0x82bee(0x93)](_0x1f4009),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x388647(0x154)]='segment:parent:show';[a30_0x388647(0xec)]=a30_0x388647(0xb0);async[a30_0x388647(0x77)](_0x3f489c){const _0x3bc0fa=a30_0x388647,{options:_0x49008e,args:_0x300d40,tdx:_0x193127}=_0x3f489c,_0x47a092=_0x300d40[0x0]||_0x49008e[_0x3bc0fa(0x201)];if(!_0x47a092)return showParentSegmentNotSetError(_0x3bc0fa(0x70)+_0x3bc0fa(0x1cd)),0x1;_0x49008e[_0x3bc0fa(0x1cf)]&&(console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0xcf)+_0x49008e[_0x3bc0fa(0x18f)]),console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0x7e)+_0x47a092));const _0x21c369=await withSpinner(_0x3bc0fa(0x1ad)+_0x47a092+_0x3bc0fa(0x120),()=>_0x193127[_0x3bc0fa(0x176)][_0x3bc0fa(0xaf)](_0x47a092),{'verbose':_0x49008e[_0x3bc0fa(0x1cf)]}),_0x2f6d6c=_0x21c369[_0x3bc0fa(0x7b)],_0x217d34=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x47a092+_0x3bc0fa(0x120),()=>_0x193127['segment'][_0x3bc0fa(0x17c)](_0x2f6d6c),{'verbose':_0x49008e[_0x3bc0fa(0x1cf)]});let _0x4c3cf8=_0x217d34[_0x3bc0fa(0x7b)];const _0x175fe1=resolveLimit(_0x49008e[_0x3bc0fa(0x16f)],DEFAULT_DISPLAY_LIMIT),_0x992b26=/\bLIMIT\s+\d+/i['test'](_0x4c3cf8);!_0x992b26&&(_0x4c3cf8=_0x4c3cf8[_0x3bc0fa(0x12f)]()[_0x3bc0fa(0x173)](/;+$/,''),_0x4c3cf8='SELECT\x20*\x20FROM\x20(\x0a'+_0x4c3cf8+_0x3bc0fa(0xd3)+_0x175fe1);_0x49008e['verbose']&&console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0x185)+_0x4c3cf8);const _0x93a4ce=await withProgressSpinner(_0x3bc0fa(0x97),async _0xc3987=>{const _0x53e985=_0x3bc0fa,_0x44dce2=await _0x193127[_0x53e985(0x145)][_0x53e985(0x77)](_0x4c3cf8,{'catalog':'td','schema':'information_schema','onJobId':_0x3953b9=>{_0xc3987['setJobId'](_0x3953b9);}});return _0x44dce2;},{'verbose':_0x49008e[_0x3bc0fa(0x1cf)]}),_0x3f6830=_0x93a4ce[_0x3bc0fa(0x7b)],_0x486e60=_0x3f6830[_0x3bc0fa(0x1eb)]?'\x20[Job\x20ID:\x20'+_0x3f6830[_0x3bc0fa(0x1eb)]+']':'';return console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0x1e5)+_0x3f6830['stats'][_0x3bc0fa(0x122)][_0x3bc0fa(0x115)]()+_0x3bc0fa(0x1d5)+(_0x3bc0fa(0x1c6)+formatElapsed(_0x3f6830['stats'][_0x3bc0fa(0x91)])+_0x486e60)),await handleQueryOutput(_0x3f6830,_0x49008e),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x388647(0x168);[a30_0x388647(0xec)]=a30_0x388647(0x149);async[a30_0x388647(0x77)](_0xb5c659){const _0x55fc51=a30_0x388647,{options:_0x3df367,args:_0x6d6a6c,tdx:_0x2d08a2}=_0xb5c659,_0x9dec75=_0x6d6a6c[0x0],_0x59a8b2=await withSpinner(_0x9dec75?_0x55fc51(0x1dd)+_0x9dec75+_0x55fc51(0x120):_0x55fc51(0x187),()=>_0x2d08a2[_0x55fc51(0x6e)][_0x55fc51(0x76)](),{'verbose':_0x3df367[_0x55fc51(0x1cf)]});let _0x20ae3a=_0x59a8b2[_0x55fc51(0x7b)][_0x55fc51(0x1d2)](_0x359c1c=>_0x359c1c[_0x55fc51(0x166)]);if(_0x9dec75){const _0x12eb88=_0x9dec75['replace'](/[.+^${}()|[\]\\]/g,_0x55fc51(0x102))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x27d89a=new RegExp('^'+_0x12eb88+'$','i');_0x20ae3a=_0x20ae3a[_0x55fc51(0x1d2)](_0x1707d1=>_0x27d89a['test'](_0x1707d1[_0x55fc51(0x154)]));}_0x20ae3a[_0x55fc51(0x1c1)]((_0x36bb89,_0x38118d)=>_0x36bb89['name'][_0x55fc51(0x71)](_0x38118d[_0x55fc51(0x154)])),console[_0x55fc51(0x1a3)]('✔\x20Found\x20'+_0x20ae3a[_0x55fc51(0x10c)]+_0x55fc51(0xe2)+(_0x20ae3a['length']!==0x1?'s':''));const _0xc53703=_0x46e92a=>{const _0x18bdb4=_0x55fc51;return getConsoleNextUrl(_0x3df367[_0x18bdb4(0x18f)],_0x18bdb4(0x90)+_0x46e92a);};if(_0x3df367[_0x55fc51(0x1e3)]===_0x55fc51(0xf9)||_0x3df367[_0x55fc51(0x1e3)]===_0x55fc51(0x1b0)){const _0x222541=_0x20ae3a[_0x55fc51(0x16d)](_0x3fe9db=>({..._0x3fe9db,'url':_0xc53703(_0x3fe9db['id'])}));await handleSDKOutput(_0x222541,_0x3df367);}else{if(_0x20ae3a['length']===0x0)console[_0x55fc51(0x93)](_0x55fc51(0x11f));else for(const _0x5e5217 of _0x20ae3a){const _0x27438a=_0x5e5217[_0x55fc51(0x1f8)]?a30_0x530600['dim']('\x20('+formatRows(_0x5e5217[_0x55fc51(0x1f8)])+')'):'',_0x143dab=hyperlink(_0x5e5217['name'],_0xc53703(_0x5e5217['id']));console[_0x55fc51(0x93)]('⚡\x20'+_0x143dab+_0x27438a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x1b8);[a30_0x388647(0xec)]=a30_0x388647(0x184);async[a30_0x388647(0x77)](_0x4575e1){const _0x24114a=a30_0x388647,{options:_0x33277f,args:_0x35667d,tdx:_0x399fcd}=_0x4575e1,_0x71128=_0x35667d[0x0]||_0x33277f[_0x24114a(0x201)];if(!_0x71128)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'+_0x24114a(0xdc)),0x1;const _0x35da57=resolveYamlFile(_0x71128);if(!existsSync(_0x35da57))return showFileNotFoundError(_0x35da57,_0x71128),0x1;let _0x18b385;try{_0x18b385=readFileSync(_0x35da57,'utf-8');}catch(_0x2a2fee){const _0x1077ca=_0x2a2fee instanceof Error?_0x2a2fee[_0x24114a(0x1c9)]:String(_0x2a2fee);return console[_0x24114a(0x1a3)](_0x24114a(0x1c7)+_0x1077ca),0x1;}const _0x49c73=createCommandSpinner(a30_0x530600[_0x24114a(0xb2)](_0x24114a(0x143)),{'verbose':_0x33277f['verbose']});_0x49c73[_0x24114a(0xa2)]();const _0x36e8aa={'realtime':!![],'onProgress':_0x4c60cc=>{_0x49c73['text']=formatProgressMessage(_0x4c60cc);}};let _0x268e4f;try{_0x268e4f=await _0x399fcd[_0x24114a(0x176)]['validateParentYaml'](_0x18b385,_0x36e8aa),_0x49c73['stop']();}catch(_0x59c1ba){_0x49c73[_0x24114a(0x1d0)]();throw _0x59c1ba;}console['error']('\x0a'+a30_0x530600[_0x24114a(0x6d)](_0x24114a(0x139))+'\x20'+_0x268e4f[_0x24114a(0x154)]),console[_0x24114a(0x1a3)]('═'[_0x24114a(0x140)](0x3c)),displayRealtimeValidation(_0x268e4f),console[_0x24114a(0x1a3)]('─'['repeat'](0x3c));if(_0x268e4f[_0x24114a(0x14c)][_0x24114a(0x10c)]>0x0){console[_0x24114a(0x1a3)]('\x0a'+a30_0x530600['red'](_0x24114a(0x1f0)));for(const _0x587730 of _0x268e4f[_0x24114a(0x14c)]){console[_0x24114a(0x1a3)]('\x20\x20'+a30_0x530600['red']('•')+'\x20'+_0x587730);}}return _0x268e4f[_0x24114a(0xd4)]&&console['error']('\x0a'+a30_0x530600[_0x24114a(0x1f1)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x268e4f[_0x24114a(0xd4)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']='ps:pz:list';['description']='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async['execute'](_0x3191b7){const _0x4c4594=a30_0x388647,{options:_0x3e291d,args:_0x977a8d,tdx:_0xb7eae1}=_0x3191b7,_0x285fea=_0x977a8d[0x0]||_0x3e291d['parentSegment'];if(!_0x285fea)return showParentSegmentNotSetError(_0x4c4594(0x17e)+_0x4c4594(0x180)),0x1;const _0x4bb02b=await withSpinner(_0x4c4594(0x1ad)+_0x285fea+_0x4c4594(0x120),()=>_0xb7eae1[_0x4c4594(0x176)][_0x4c4594(0xaf)](_0x285fea),{'verbose':_0x3e291d[_0x4c4594(0x1cf)]}),_0x36d27d=_0x4bb02b[_0x4c4594(0x7b)],_0x30ef87=await withSpinner(_0x4c4594(0x151)+_0x285fea+_0x4c4594(0x120),()=>_0xb7eae1[_0x4c4594(0x11d)][_0x4c4594(0x76)](_0x36d27d),{'verbose':_0x3e291d['verbose']}),_0x4a63a4=_0x30ef87[_0x4c4594(0x7b)];console[_0x4c4594(0x1a3)]('✔\x20Found\x20'+_0x4a63a4[_0x4c4594(0x10c)]+_0x4c4594(0x73)+(_0x4a63a4[_0x4c4594(0x10c)]!==0x1?'s':''));if(_0x3e291d['format']==='json'||_0x3e291d[_0x4c4594(0x1e3)]===_0x4c4594(0x1b0))await handleSDKOutput(_0x4a63a4,_0x3e291d);else{if(_0x4a63a4[_0x4c4594(0x10c)]===0x0)console[_0x4c4594(0x93)](_0x4c4594(0x1fc)),console[_0x4c4594(0x1a3)](a30_0x530600['cyan'](_0x4c4594(0xbb)));else for(const _0x6c959f of _0x4a63a4){const _0x1d7ac8=_0x6c959f[_0x4c4594(0x106)]?.[_0x4c4594(0x10c)]||0x0,_0x2cecc8=_0x6c959f[_0x4c4594(0x9c)]?a30_0x530600[_0x4c4594(0xb2)]('\x20trigger='+_0x6c959f[_0x4c4594(0x9c)]):'',_0x333c6b=a30_0x530600[_0x4c4594(0xb2)]('\x20('+_0x1d7ac8+_0x4c4594(0xb3)+(_0x1d7ac8!==0x1?'s':'')+')');console[_0x4c4594(0x93)]('\x20\x20'+_0x6c959f[_0x4c4594(0x154)]+_0x2cecc8+_0x333c6b),_0x6c959f['description']&&console[_0x4c4594(0x93)](_0x4c4594(0x181)+a30_0x530600[_0x4c4594(0xb2)](_0x6c959f[_0x4c4594(0xec)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x388647(0x12b);[a30_0x388647(0xec)]=a30_0x388647(0x144);async[a30_0x388647(0x77)](_0x396355){const _0x1f766e=a30_0x388647,{options:_0x2255dd,args:_0xa5a2d}=_0x396355,_0x4a3177=_0xa5a2d[0x0]||_0x2255dd[_0x1f766e(0x201)];if(!_0x4a3177)return showParentSegmentNotSetError(_0x1f766e(0x81)+'\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 _0x266d7d=resolveYamlFile(_0x4a3177);if(!existsSync(_0x266d7d))return showFileNotFoundError(_0x266d7d,_0x4a3177),0x1;let _0xfa92b7;try{_0xfa92b7=readFileSync(_0x266d7d,_0x1f766e(0x1f4));}catch(_0x5b186f){const _0x419a29=_0x5b186f instanceof Error?_0x5b186f['message']:String(_0x5b186f);return console['error'](_0x1f766e(0x1c7)+_0x419a29),0x1;}let _0x253a9c;try{_0x253a9c=parseDef(_0xfa92b7);}catch(_0xccdb14){const _0x19d924=_0xccdb14 instanceof Error?_0xccdb14[_0x1f766e(0x1c9)]:String(_0xccdb14);return console[_0x1f766e(0x1a3)](a30_0x530600[_0x1f766e(0xd1)](_0x1f766e(0x111)+_0x19d924)),0x1;}if(_0x253a9c[_0x1f766e(0x1d8)]&&_0x253a9c['personalization_services'][_0x1f766e(0x10c)]>0x0)return console['error'](a30_0x530600[_0x1f766e(0xeb)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x266d7d)),console[_0x1f766e(0x1a3)](a30_0x530600[_0x1f766e(0xb2)](_0x1f766e(0xe4)+_0x253a9c[_0x1f766e(0x1d8)][_0x1f766e(0x10c)]+_0x1f766e(0xb4))),0x1;!_0x253a9c[_0x1f766e(0x6e)]&&(_0x253a9c[_0x1f766e(0x6e)]={'events':[{'name':'page_view','source_table':_0x1f766e(0xdf)}],'attributes':[{'name':_0x1f766e(0x1ce),'type':'single'}],'id_stitching':{'primary_key':_0x253a9c[_0x1f766e(0x1fa)][_0x1f766e(0x1fd)]===_0x1f766e(0x1c3)?_0x1f766e(0x1f2):_0x1f766e(0x18b)}});_0x253a9c['personalization_services']=[{'name':_0x1f766e(0x1c0),'description':_0x1f766e(0x133),'trigger_event':_0x1f766e(0x12e),'sections':[{'name':_0x1f766e(0x189),'criteria':_0x1f766e(0x137),'attributes':[_0x1f766e(0x1ce)]}]}];const _0x495a0a=serializeDef(_0x253a9c);return writeFileSync(_0x266d7d,_0x495a0a,_0x1f766e(0x1f4)),console[_0x1f766e(0x1a3)](a30_0x530600[_0x1f766e(0x1f1)]('✔')+_0x1f766e(0x10e)+a30_0x530600[_0x1f766e(0x1e7)](_0x266d7d)),(!_0x253a9c['realtime']||_0xfa92b7[_0x1f766e(0x1b4)](_0x1f766e(0xf3))===-0x1)&&console['error'](a30_0x530600[_0x1f766e(0x1f1)]('✔')+_0x1f766e(0x191)),console[_0x1f766e(0x1a3)]('\x0a'+a30_0x530600[_0x1f766e(0xb2)](_0x1f766e(0x1a9))),console[_0x1f766e(0x1a3)](_0x1f766e(0x1b5)+_0x266d7d+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x1f766e(0x1a3)](_0x1f766e(0x15e)+a30_0x530600[_0x1f766e(0xb2)](_0x1f766e(0x1f5)+_0x4a3177)+_0x1f766e(0x138)),0x0;}}
|
|
1
|
+
const a30_0x4fc0d8=a30_0x1520;(function(_0x28b4d2,_0x4c0e1b){const _0xec60e1=a30_0x1520,_0x2a4e9d=_0x28b4d2();while(!![]){try{const _0x2881e6=-parseInt(_0xec60e1(0x22a))/0x1*(parseInt(_0xec60e1(0x111))/0x2)+-parseInt(_0xec60e1(0x16c))/0x3*(-parseInt(_0xec60e1(0x1af))/0x4)+parseInt(_0xec60e1(0x13a))/0x5*(-parseInt(_0xec60e1(0x1f6))/0x6)+parseInt(_0xec60e1(0x1a7))/0x7*(parseInt(_0xec60e1(0x164))/0x8)+-parseInt(_0xec60e1(0xcc))/0x9+-parseInt(_0xec60e1(0x1fa))/0xa*(-parseInt(_0xec60e1(0x127))/0xb)+parseInt(_0xec60e1(0xe6))/0xc;if(_0x2881e6===_0x4c0e1b)break;else _0x2a4e9d['push'](_0x2a4e9d['shift']());}catch(_0x34c3d6){_0x2a4e9d['push'](_0x2a4e9d['shift']());}}}(a30_0x2f93,0x54cb3));function a30_0x2f93(){const _0x58c46f=['last_page_viewed','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','segment','td_client_id','Columns:','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','workflowId','test','\x20parent\x20segment\x20\x27','\x0a\x20\x20\x20\x20}','Validating\x20configuration...','behavior','schemaError','trim','cyan','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20Context\x20set:\x20','\x20tdx\x20wf\x20attempt\x20','tdx\x20ps\x20push\x20','To\x20view\x20sample\x20data:','toLowerCase','Show\x20parent\x20segment\x20schema\x20(column\x20types)','stitchingKeys','\x20\x20Database:\x20','true','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','displayRealtimeInfo','Attributes:','getParentFull','foreignKey','joinKey','\x20--interval\x20','Updating\x20parent\x20segment\x20\x27','Available\x20attributes:','match','ps:rt:list','Listing\x20parent\x20segments\x20matching\x20\x27','behaviors','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20Added\x20RT\x202.0\x20template\x20section','Error:\x20--attribute\x20requires\x20a\x20name\x0a','xdg-open','\x0a⚠️\x20\x20Both\x20','Validating\x20RT\x20configuration...','push','\x27\x20with\x20ID:\x20','sourceTableError','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','stop','user_id','/app/dw/parentSegments/','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','sampleData','status','Database:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','limit','⚡\x20Not\x20enabled','Apply\x20changes\x20to\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','database','setJobId','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x20\x20Tables:\x201\x20customers\x20+\x20','displayPreviewHints','✔\x20Found\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','number','6bYbWnY','\x20configured','\x20section','\x0aNo\x20sample\x20data\x20available','375420FkNxkC','customerPercent','listParents','Error\x20reading\x20file:\x20','session','data','Table:\x20','rowCount','List\x20available\x20fields\x20for\x20segmentation','Create\x20parent\x20segment\x20\x27','open','use','\x20=\x20','/\x20→\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Updating','customers','timezone','allValid','\x0a✔\x20Workflow\x20started','Error:\x20File\x20not\x20found:\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20No\x20changes\x20-\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','realtime','list','workflowAttemptId','Error:','Preview:','behavior_','Join\x20on:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','toLocaleString','sort','scheduleType','Error:\x20--database\x20and\x20--table\x20are\x20required','Master\x20+\x20Attributes','personalization','customersWithEvents','\x20parent\x20segment','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','dirname','attributes','Fetching\x20sample\x20data...','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Pattern:\x20','attributesFile','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','1wxjbzf','workflowSessionId','\x0aError:','RT\x202.0:','site','column_type','toFixed','sections','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','.yaml','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20field','Validate:','displaySummary','text','jobId','formatSchemaJson','Errors:','\x0aChanges\x20to\x20apply\x20to\x20\x27','segment:parent:show','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','segment:parent:push','/\x20directory.\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','Master\x20Table','validateParentYaml','/attempt/','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','displayMasterInfo','Status:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','isDirectory','Fetching\x20parent\x20segment\x20\x27','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','string','enabled','yellow','ps:pz:init','description','web','segment:parent:pull','/sessions/','getParentSQL','Source:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Resolving\x20parent\x20segment\x20\x27','Join:','Next\x20steps:','Options:','✔\x20Query\x20completed:\x20Processed\x20','bold','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','unref','\x20is\x20already\x20up\x20to\x20date','varchar','Session:','Listing\x20personalization\x20services\x20for\x20\x27','1311570WXvOZq','getOutputDatabaseName','\x20rows\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Error\x20parsing\x20YAML:\x20','addBehaviorsFile','length','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\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','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Options:\x0a','.customers)','Enriched:','%)\x20','idStitching','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','in\x20','stats','✔\x20Renamed\x20directory\x20to\x20','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','output','\x0a\x20\x20\x20\x20]','Show\x20parent\x20segment\x20details','\x20\x20No\x20sample\x20data\x20available','SQL\x20query:\x0a','7301400tCrfuI','FINISHED','attribute','log','Personalization\x20service\x20description','\x22,\x20\x22type\x22:\x20\x22','displayColumns','\x0aNew\x20parent\x20segment\x20\x27','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','-1d','trigger_event','primaryKey','all','\x27...','format','/\x20and\x20','Behavior:','Aborted.','segment:parent:preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','execute','errors','valid','Attributes','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20--behavior\x20\x22<name>\x22','label','start','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Events:','interval','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x5c$&','repeat','\x0a\x20\x20]\x0a}\x0a','\x20personalization\x20service','red','List\x20parent\x20segments','\x20\x20\x20\x20','customerGroup','\x27\x20is\x20already\x20up\x20to\x20date','1354946PuABFb','\x22\x20}','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','schemaValid','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20--behavior\x20\x22','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','segment:parent:create','\x20to\x20configure\x20your\x20personalization\x20service','message','\x20behaviors','getBehaviorNames','run','createParent','segment:parent:validate','Analyzing\x20changes...','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','win32','55oGkCHv','Creating\x20parent\x20segment\x20\x27','Overwrite\x20\x27','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','single','addAttributesFile','ID\x20Stitching:','✔\x20No\x20changes\x20-\x20\x27','apply','replace','json','population','To\x20cancel:','localeCompare','verbose','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Coverage:','columns','773960cjEEhl','Behaviors','column_name','\x20+\x20[','map','Rows:','Executing\x20parent\x20segment\x20query...','Fetching\x20SQL\x20for\x20\x27','My\x20Service','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\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','parentSegment','\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','events','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','✔\x20Created\x20parent\x20segment\x20\x27','segment:parent:run','realtime:','endsWith','scheduleOption','Master:','\x20--attribute\x20\x22<name>\x22','\x20\x20\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','collectSchema','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','pushParentYaml','type','Personalization:','parent_segments','\x0a⚠️\x20\x20Migrating:\x20','`\x20to\x20download\x20the\x20configuration\x20first','column','resolveParentId','No\x20personalization\x20services\x20configured','\x20\x202.\x20Run\x20','ps:pz:list','dim','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x27\x20is\x20up\x20to\x20date','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','tdx\x20ps\x20preview\x20','8khPdow','behaviorsFile','personalizationServices','utf-8','page_view','displaySampleData','Fetching\x20customers\x20schema...','green','1527753cUWehM','elapsedTimeMillis','\x20rows)','SELECT\x20*\x20FROM\x20','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Fetching\x20behavior\x20list...','displayAttributesStats','listFields','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','totalEvents','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','displayBehaviorsStats','pullParentYaml','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','runParent','<database>.<table>','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20[Job\x20ID:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Site:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','using\x20the\x20default\x20path:\x20','personalization_services','parent_segment','segment:parent:sql','double','segment:parent:list','error','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{\x20\x22name\x22:\x20\x22','Name:\x20','Created','Updated','\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','jsonl','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:view','Creating','updateParent','\x20\x20\x20\x20-\x20','master','\x20service(s)\x20configured','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Parent\x20segment:\x20','\x20\x20Columns:\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','processedRows','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','matchedCount','\x20--attribute\x20\x22','Output\x20file:\x20','displayPreviewResults','table','Attribute:','name','join','\x20service','coveragePercent','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','139293bexPAm','query','yes','enriched','\x20to\x20push\x20the\x20configuration','\x20--enriched','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','.yml','4qkhYGm','filter','\x20RT-enabled\x20parent\x20segment'];a30_0x2f93=function(){return _0x58c46f;};return a30_0x2f93();}import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x33c29c from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x51421d from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x4fc0d8(0x157),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x505fe9){const _0x2eb484=a30_0x4fc0d8,_0x413c8b=process['platform'],_0x44152d=_0x413c8b==='darwin'?_0x2eb484(0x204):_0x413c8b===_0x2eb484(0x126)?_0x2eb484(0x101):_0x2eb484(0x1db);spawn(_0x44152d,[_0x505fe9],{'detached':!![],'stdio':'ignore'})[_0x2eb484(0xc7)]();}function migrateLegacyDirectory(){const _0x5d63af=a30_0x4fc0d8;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x10d0c0=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x10d0c0[_0x5d63af(0x249)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5d63af(0x187)](a30_0x51421d[_0x5d63af(0x24f)](_0x5d63af(0x1dc)+LEGACY_PARENT_SEGMENT_DIR+_0x5d63af(0xf5)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console['error'](a30_0x51421d[_0x5d63af(0x15f)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5d63af(0x240))),![];console['error'](a30_0x51421d[_0x5d63af(0x24f)](_0x5d63af(0x158)+LEGACY_PARENT_SEGMENT_DIR+_0x5d63af(0x207)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5d63af(0x187)](a30_0x51421d['green'](_0x5d63af(0xde)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3b2673){const _0x477e11=_0x3b2673 instanceof Error?_0x3b2673[_0x5d63af(0x11d)]:String(_0x3b2673);return console[_0x5d63af(0x187)](a30_0x51421d[_0x5d63af(0x10c)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x477e11+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x4fc0d8(0x120)](_0x9f8ba1){const _0x144208=a30_0x4fc0d8;return migrateLegacyDirectory(),super[_0x144208(0x120)](_0x9f8ba1);}}function resolveYamlFile(_0x2102a2){const _0x3f3298=a30_0x4fc0d8;if(_0x2102a2[_0x3f3298(0x14c)](_0x3f3298(0x1ae))||_0x2102a2[_0x3f3298(0x14c)](_0x3f3298(0x233)))return _0x2102a2;return a30_0x33c29c[_0x3f3298(0x1a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2102a2)+'.yml');}function formatProgressMessage(_0x46a108){const _0x25b690=a30_0x4fc0d8,_0x2822cd=_0x46a108[_0x25b690(0x1d4)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2822cd){const [,_0x1df558,_0x1b75c0,_0x24b2e0='']=_0x2822cd;return a30_0x51421d[_0x25b690(0x15f)](_0x1df558+':')+'\x20'+_0x1b75c0+a30_0x51421d[_0x25b690(0x15f)](_0x24b2e0);}return a30_0x51421d['dim'](_0x46a108);}function showFileNotFoundError(_0x30f059,_0x503029){const _0x2b490c=a30_0x4fc0d8;console[_0x2b490c(0x187)](a30_0x51421d['red'](_0x2b490c(0x20e)+_0x30f059+'\x0a')),console[_0x2b490c(0x187)](a30_0x51421d['cyan'](_0x2b490c(0x148)+_0x503029+_0x2b490c(0x159)));}function displayRealtimeValidation(_0x2da837){const _0x10ca55=a30_0x4fc0d8;if(!_0x2da837[_0x10ca55(0x212)])return;const _0x2dc92c=_0x2da837[_0x10ca55(0x212)],_0x62e86d=_0x2dc92c[_0x10ca55(0x24e)]?a30_0x51421d[_0x10ca55(0x16b)]('⚡\x20Enabled'):a30_0x51421d[_0x10ca55(0x24f)](_0x10ca55(0x1eb));console[_0x10ca55(0x187)]('\x0a'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x22d))+'\x20'+_0x62e86d);if(_0x2dc92c[_0x10ca55(0x147)]&&_0x2dc92c[_0x10ca55(0x147)]['length']>0x0){console['error']('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x105))+'\x20'+_0x2dc92c[_0x10ca55(0x147)][_0x10ca55(0xd2)]+_0x10ca55(0x1f7));for(const _0x154a59 of _0x2dc92c[_0x10ca55(0x147)]){const _0x41dcb3=_0x154a59['sourceTableValid']===![]?a30_0x51421d[_0x10ca55(0x10c)]('✘'):a30_0x51421d['green']('✔');console[_0x10ca55(0x187)](_0x10ca55(0x10e)+_0x41dcb3+'\x20'+_0x154a59[_0x10ca55(0x1a2)]),_0x154a59['sourceTableError']&&console['error']('\x20\x20\x20\x20\x20\x20'+a30_0x51421d['red'](_0x154a59[_0x10ca55(0x1e0)]));}}if(_0x2dc92c['attributes']&&_0x2dc92c[_0x10ca55(0x224)]['length']>0x0){console[_0x10ca55(0x187)]('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x1cd))+'\x20'+_0x2dc92c['attributes'][_0x10ca55(0xd2)]+_0x10ca55(0x1f7));for(const _0x414833 of _0x2dc92c[_0x10ca55(0x224)]){const _0x489286=_0x414833[_0x10ca55(0xfc)]?a30_0x51421d['green']('✔'):a30_0x51421d[_0x10ca55(0x10c)]('✘');console[_0x10ca55(0x187)](_0x10ca55(0x10e)+_0x489286+'\x20'+_0x414833[_0x10ca55(0x1a2)]+'\x20'+a30_0x51421d[_0x10ca55(0x15f)]('('+_0x414833[_0x10ca55(0x155)]+')'));}}if(_0x2dc92c[_0x10ca55(0xda)]){const _0x513e70=_0x2dc92c[_0x10ca55(0xda)]['stitchingKeys']?.['length']?_0x10ca55(0x13d)+_0x2dc92c[_0x10ca55(0xda)][_0x10ca55(0x1c8)][_0x10ca55(0x1a3)](',\x20')+']':'';console[_0x10ca55(0x187)]('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x12e))+'\x20'+_0x2dc92c[_0x10ca55(0xda)][_0x10ca55(0xf1)]+_0x513e70);}if(_0x2dc92c[_0x10ca55(0x166)]&&_0x2dc92c[_0x10ca55(0x166)][_0x10ca55(0xd2)]>0x0){console[_0x10ca55(0x187)]('\x20\x20'+a30_0x51421d[_0x10ca55(0x15f)](_0x10ca55(0x156))+'\x20'+_0x2dc92c[_0x10ca55(0x166)][_0x10ca55(0xd2)]+_0x10ca55(0x1a4)+(_0x2dc92c['personalizationServices'][_0x10ca55(0xd2)]!==0x1?'s':''));for(const _0x1f749f of _0x2dc92c[_0x10ca55(0x166)]){console[_0x10ca55(0x187)](_0x10ca55(0x193)+_0x1f749f['name']);}}}function showParentSegmentNotSetError(_0x3fbf3e){const _0x2ac8e6=a30_0x4fc0d8;console[_0x2ac8e6(0x187)](a30_0x51421d[_0x2ac8e6(0x24f)](_0x2ac8e6(0x17c))),console[_0x2ac8e6(0x187)](_0x3fbf3e);}export class ParentSegmentListCommand extends BaseCommand{['name']=a30_0x4fc0d8(0x186);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x10d);async[a30_0x4fc0d8(0xfa)](_0x2f84a5){const _0x38cfde=a30_0x4fc0d8,{options:_0x409c76,args:_0x5170bc,tdx:_0x562aff}=_0x2f84a5,_0xdbe10a=_0x5170bc[0x0];_0x409c76[_0x38cfde(0x136)]&&(console[_0x38cfde(0x187)]('Site:\x20'+_0x409c76[_0x38cfde(0x22e)]),_0xdbe10a&&console[_0x38cfde(0x187)](_0x38cfde(0x227)+_0xdbe10a));const _0x4c95f3=await withSpinner(_0xdbe10a?_0x38cfde(0x1d6)+_0xdbe10a+_0x38cfde(0xf3):'Listing\x20parent\x20segments...',()=>_0x562aff[_0x38cfde(0x1b4)][_0x38cfde(0x1fc)](),{'verbose':_0x409c76[_0x38cfde(0x136)]});let _0x569d00=_0x4c95f3[_0x38cfde(0x1ff)];if(_0xdbe10a){const _0x57d688=_0xdbe10a[_0x38cfde(0x131)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x38cfde(0x131)](/\*/g,'.*')[_0x38cfde(0x131)](/\?/g,'.'),_0x55c140=new RegExp('^'+_0x57d688+'$','i');_0x569d00=_0x569d00['filter'](_0x3b65a3=>_0x55c140[_0x38cfde(0x1b9)](_0x3b65a3['attributes'][_0x38cfde(0x1a2)]));}_0x569d00[_0x38cfde(0x21b)]((_0x5efc60,_0x5e1a0e)=>_0x5efc60[_0x38cfde(0x224)][_0x38cfde(0x1a2)][_0x38cfde(0x135)](_0x5e1a0e[_0x38cfde(0x224)]['name'])),console[_0x38cfde(0x187)](_0x38cfde(0x1f3)+_0x569d00['length']+_0x38cfde(0x221)+(_0x569d00[_0x38cfde(0xd2)]!==0x1?'s':''));const _0x43f2fe=_0x2f6773=>{const _0x1eaa57=_0x38cfde;return getConsoleNextUrl(_0x409c76['site'],_0x1eaa57(0x1e4)+_0x2f6773);};if(_0x409c76[_0x38cfde(0xf4)]===_0x38cfde(0x132)||_0x409c76[_0x38cfde(0xf4)]==='jsonl'){const _0x36f9c1=_0x569d00[_0x38cfde(0x13e)](_0x199d6f=>({..._0x199d6f,'url':_0x43f2fe(_0x199d6f['id'])}));await handleSDKOutput(_0x36f9c1,_0x409c76);}else{if(_0x569d00[_0x38cfde(0xd2)]===0x0)_0xdbe10a?console['log'](_0x38cfde(0x114)+_0xdbe10a):console[_0x38cfde(0xe9)]('No\x20parent\x20segments\x20found');else for(const _0x18ce3d of _0x569d00){const _0x3e687f=_0x18ce3d[_0x38cfde(0x224)]['population']?a30_0x51421d[_0x38cfde(0x15f)]('\x20('+formatRows(_0x18ce3d[_0x38cfde(0x224)][_0x38cfde(0x133)])+')'):'',_0x309f6d=hyperlink(_0x18ce3d[_0x38cfde(0x224)]['name'],_0x43f2fe(_0x18ce3d['id']));console['log']('👥\x20'+_0x309f6d+_0x3e687f);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x11b);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x20f);async[a30_0x4fc0d8(0xfa)](_0x1b672b){const _0x3fbd01=a30_0x4fc0d8,{options:_0x16e98e,args:_0x1b5d79,tdx:_0x331b72}=_0x1b672b;console['error'](_0x3fbd01(0x1f4)+_0x3fbd01(0x1cb)+_0x3fbd01(0x174));const _0xcd166b=_0x16e98e;if(_0x1b5d79[_0x3fbd01(0xd2)]===0x0)return console[_0x3fbd01(0x187)](a30_0x51421d[_0x3fbd01(0x10c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x3fbd01(0x187)](_0x3fbd01(0x118)),0x1;const _0x15b5b5=_0x1b5d79[0x0];if(!_0xcd166b[_0x3fbd01(0x1ee)]||!_0xcd166b[_0x3fbd01(0x1a0)])return console[_0x3fbd01(0x187)](_0x3fbd01(0x21d)),console[_0x3fbd01(0x187)](_0x3fbd01(0x118)),0x1;_0xcd166b[_0x3fbd01(0x136)]&&(console[_0x3fbd01(0x187)]('Site:\x20'+_0xcd166b['site']),console[_0x3fbd01(0x187)](_0x3fbd01(0x18a)+_0x15b5b5),console[_0x3fbd01(0x187)](_0x3fbd01(0x1e8)+_0xcd166b[_0x3fbd01(0x1ee)]),console[_0x3fbd01(0x187)](_0x3fbd01(0x200)+_0xcd166b[_0x3fbd01(0x1a0)]));const _0x52f0fb=await loadJSONFromOptions(_0xcd166b['attributes'],_0xcd166b[_0x3fbd01(0x228)]),_0x411aa7=await loadJSONFromOptions(_0xcd166b[_0x3fbd01(0x1d7)],_0xcd166b[_0x3fbd01(0x165)]),_0xf5efa8=await loadJSONFromOptions(_0xcd166b[_0x3fbd01(0x10f)],_0xcd166b['customerGroupFile']),_0x2e2e5e={'name':_0x15b5b5,'description':_0xcd166b['description'],'scheduleType':_0xcd166b[_0x3fbd01(0x21c)],'scheduleOption':_0xcd166b[_0x3fbd01(0x14d)],'timezone':_0xcd166b['timezone'],'master':{'parentDatabaseName':_0xcd166b[_0x3fbd01(0x1ee)],'parentTableName':_0xcd166b['table']},'attributes':_0x52f0fb,'behaviors':_0x411aa7,'customerGroup':_0xf5efa8},_0x120e37=await withSpinner(_0x3fbd01(0x128)+_0x15b5b5+_0x3fbd01(0xf3),()=>_0x331b72[_0x3fbd01(0x1b4)][_0x3fbd01(0x121)](_0x2e2e5e),{'verbose':_0x16e98e[_0x3fbd01(0x136)]}),_0x338117=_0x120e37[_0x3fbd01(0x1ff)];return console[_0x3fbd01(0x187)](_0x3fbd01(0x149)+_0x338117[_0x3fbd01(0x1a2)]+_0x3fbd01(0x1df)+_0x338117['id']),await handleSDKOutput([_0x338117],_0x16e98e),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]='segment:parent:update';[a30_0x4fc0d8(0x251)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a30_0x4fc0d8(0xfa)](_0xa98306){const _0x68fa62=a30_0x4fc0d8,{options:_0xda60e3,args:_0x4ce5ea,tdx:_0x4fcb54}=_0xa98306;console[_0x68fa62(0x187)](_0x68fa62(0x219)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x68fa62(0x174));const _0x514e17=_0xda60e3;if(_0x4ce5ea['length']===0x0)return console['error'](a30_0x51421d[_0x68fa62(0x10c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x68fa62(0x19b)),0x1;const _0x396346=_0x4ce5ea[0x0];_0x514e17[_0x68fa62(0x136)]&&(console[_0x68fa62(0x187)](_0x68fa62(0x17f)+_0x514e17['site']),console[_0x68fa62(0x187)](_0x68fa62(0x197)+_0x396346));const _0x1eadbd=await withSpinner(_0x68fa62(0x17e)+_0x396346+'\x27...',()=>_0x4fcb54[_0x68fa62(0x1b4)]['getParentFull'](_0x396346),{'verbose':_0x514e17[_0x68fa62(0x136)]}),_0x428b71=_0x1eadbd[_0x68fa62(0x1ff)],_0x27d538=await loadJSONFromOptions(_0x514e17['addAttributes'],_0x514e17[_0x68fa62(0x12d)]),_0x3d27f7=await loadJSONFromOptions(_0x514e17['addBehaviors'],_0x514e17[_0x68fa62(0xd1)]),_0x5130ff={'name':_0x428b71[_0x68fa62(0x1a2)],'description':_0x514e17[_0x68fa62(0x251)]!==undefined?_0x514e17[_0x68fa62(0x251)]:_0x428b71[_0x68fa62(0x251)],'scheduleType':_0x514e17[_0x68fa62(0x21c)]!==undefined?_0x514e17[_0x68fa62(0x21c)]:_0x428b71['scheduleType'],'scheduleOption':_0x514e17['scheduleOption']!==undefined?_0x514e17[_0x68fa62(0x14d)]:_0x428b71['scheduleOption'],'timezone':_0x514e17['timezone']!==undefined?_0x514e17[_0x68fa62(0x20b)]:_0x428b71[_0x68fa62(0x20b)],'master':_0x428b71['master'],'attributes':_0x27d538?[..._0x428b71[_0x68fa62(0x224)]||[],..._0x27d538]:_0x428b71[_0x68fa62(0x224)],'behaviors':_0x3d27f7?[..._0x428b71[_0x68fa62(0x1d7)]||[],..._0x3d27f7]:_0x428b71['behaviors'],'customerGroup':_0x428b71[_0x68fa62(0x10f)]},_0x39510f=await withSpinner(_0x68fa62(0x1d2)+_0x396346+'\x27...',()=>_0x4fcb54['segment'][_0x68fa62(0x192)](_0x396346,_0x5130ff),{'verbose':_0x514e17['verbose']}),_0x5f08ee=_0x39510f[_0x68fa62(0x1ff)];return console['error'](_0x68fa62(0x241)+_0x5f08ee[_0x68fa62(0x1a2)]+'\x27'),await handleSDKOutput([_0x5f08ee],_0x514e17),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x253);['description']=a30_0x4fc0d8(0x196);async[a30_0x4fc0d8(0xfa)](_0x44f144){const _0x27ccb8=a30_0x4fc0d8,{options:_0x2b9f6f,args:_0x13e630,tdx:_0x327e16}=_0x44f144,_0x585c13=_0x2b9f6f,_0x2f70b3=_0x13e630[0x0]||_0x2b9f6f[_0x27ccb8(0x145)];if(!_0x2f70b3)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\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'),0x1;if(_0x585c13[_0x27ccb8(0x205)]&&_0x585c13[_0x27ccb8(0xe1)])return console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x10c)](_0x27ccb8(0x1ad))),console[_0x27ccb8(0x187)](a30_0x51421d['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x15f)](_0x27ccb8(0x181)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console['error'](a30_0x51421d[_0x27ccb8(0x1c0)](_0x27ccb8(0x107))),0x1;const _0x4c88b1=_0x585c13[_0x27ccb8(0xe1)]||a30_0x33c29c[_0x27ccb8(0x1a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2f70b3)+'.yml');_0x585c13[_0x27ccb8(0x136)]&&(console[_0x27ccb8(0x187)](_0x27ccb8(0x17f)+_0x585c13['site']),console[_0x27ccb8(0x187)](_0x27ccb8(0x197)+_0x2f70b3),console['error'](_0x27ccb8(0x19e)+_0x4c88b1));const _0x43ebfa=await withSpinner(_0x27ccb8(0x24a)+_0x2f70b3+_0x27ccb8(0xf3),()=>_0x327e16[_0x27ccb8(0x1b4)][_0x27ccb8(0x178)](_0x2f70b3),{'verbose':_0x585c13[_0x27ccb8(0x136)]}),_0x3e0239=_0x43ebfa[_0x27ccb8(0x1ff)];if(existsSync(_0x4c88b1)){const _0x5d760f=readFileSync(_0x4c88b1,_0x27ccb8(0x167)),_0x3900bc=generateDiff(_0x5d760f,_0x3e0239);if(!hasChanges(_0x3900bc))console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x16b)]('✔')+_0x27ccb8(0x210)+a30_0x51421d['cyan'](_0x4c88b1)+_0x27ccb8(0xc8));else{console[_0x27ccb8(0x187)]('\x0aChanges\x20to\x20\x27'+_0x4c88b1+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x27ccb8(0x187)](formatDiffWithColors(_0x3900bc)),console['error']('─'['repeat'](0x3c));if(!_0x585c13[_0x27ccb8(0x1a9)]){if(!isInteractive())return console['error'](a30_0x51421d['red'](_0x27ccb8(0x22c)),_0x27ccb8(0x248)),console[_0x27ccb8(0x187)](a30_0x51421d[_0x27ccb8(0x15f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x526b6b=await confirmKey(_0x27ccb8(0x129)+_0x4c88b1+'\x27?');if(!_0x526b6b)return console['error'](a30_0x51421d[_0x27ccb8(0x24f)](_0x27ccb8(0xf7))),0x1;}writeFileSync(_0x4c88b1,_0x3e0239,_0x27ccb8(0x167)),console[_0x27ccb8(0x187)](a30_0x51421d['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x51421d[_0x27ccb8(0x1c0)](_0x4c88b1));}}else{const _0x486e79=a30_0x33c29c[_0x27ccb8(0x223)](_0x4c88b1);!existsSync(_0x486e79)&&mkdirSync(_0x486e79,{'recursive':!![]}),writeFileSync(_0x4c88b1,_0x3e0239,_0x27ccb8(0x167)),console['error'](a30_0x51421d['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x51421d[_0x27ccb8(0x1c0)](_0x4c88b1));}return saveSessionContext({'parent_segment':_0x2f70b3},_0x585c13[_0x27ccb8(0x1fe)]),console[_0x27ccb8(0x187)](a30_0x51421d['green']('✔')+_0x27ccb8(0x1c2)+a30_0x51421d['dim'](_0x27ccb8(0x183))+_0x27ccb8(0x206)+a30_0x51421d[_0x27ccb8(0x1c0)](_0x2f70b3)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x23f);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x24b);async['execute'](_0x15cb59){const _0x1f4743=a30_0x4fc0d8,{options:_0x13d427,args:_0x582e59,tdx:_0x66d8a4}=_0x15cb59,_0x50a3c2=_0x13d427,_0x4b9a6f=_0x582e59[0x0]||_0x13d427[_0x1f4743(0x145)];if(!_0x4b9a6f)return showParentSegmentNotSetError(_0x1f4743(0x153)+_0x1f4743(0x162)),0x1;const _0x360134=resolveYamlFile(_0x4b9a6f);if(!existsSync(_0x360134))return showFileNotFoundError(_0x360134,_0x4b9a6f),0x1;_0x50a3c2[_0x1f4743(0x136)]&&(console[_0x1f4743(0x187)](_0x1f4743(0x17f)+_0x50a3c2[_0x1f4743(0x22e)]),console[_0x1f4743(0x187)]('YAML\x20file:\x20'+_0x360134));let _0x50670d;try{_0x50670d=readFileSync(_0x360134,_0x1f4743(0x167));}catch(_0x41cda4){const _0x3a42a2=_0x41cda4 instanceof Error?_0x41cda4[_0x1f4743(0x11d)]:String(_0x41cda4);return console[_0x1f4743(0x187)](_0x1f4743(0x1fd)+_0x3a42a2),0x1;}const _0x26ed44=await withSpinner(_0x1f4743(0x123),()=>_0x66d8a4['segment']['pushParentYaml'](_0x50670d),{'verbose':_0x50a3c2[_0x1f4743(0x136)]}),_0x40d8ce=_0x26ed44[_0x1f4743(0x1ff)],{isNew:_0x5afbb0,name:_0x5dc429,hasChanges:_0x2ba3fc,diffFormatted:_0x125d7c}=_0x40d8ce;if(!_0x2ba3fc)return console[_0x1f4743(0x187)]('✔\x20No\x20changes\x20-\x20\x27'+_0x5dc429+_0x1f4743(0x110)),0x0;_0x5afbb0?console[_0x1f4743(0x187)](_0x1f4743(0xed)+_0x5dc429+'\x27:'):console[_0x1f4743(0x187)](_0x1f4743(0x23c)+_0x5dc429+'\x27:');console[_0x1f4743(0x187)]('─'[_0x1f4743(0x109)](0x3c)),console['error'](_0x125d7c),console['error']('─'['repeat'](0x3c));const _0x19917a=_0x5afbb0?_0x1f4743(0x203)+_0x5dc429+'\x27?':_0x1f4743(0x1ec)+_0x5dc429+'\x27?';if(!_0x50a3c2[_0x1f4743(0x1a9)]){if(!isInteractive())return console[_0x1f4743(0x187)](a30_0x51421d[_0x1f4743(0x10c)](_0x1f4743(0x22c)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a30_0x51421d[_0x1f4743(0x15f)](_0x1f4743(0x1d8))),0x1;const _0x2aaa3a=await confirmKey(_0x19917a);if(!_0x2aaa3a)return console['error'](a30_0x51421d[_0x1f4743(0x24f)](_0x1f4743(0xf7))),0x1;}const _0x61ad61=_0x5afbb0?_0x1f4743(0x191):'Updating',_0x3915ce=await withSpinner(_0x61ad61+'\x20parent\x20segment\x20\x27'+_0x5dc429+_0x1f4743(0xf3),()=>_0x40d8ce[_0x1f4743(0x130)](),{'verbose':_0x50a3c2[_0x1f4743(0x136)]}),_0x1e90ec=_0x3915ce[_0x1f4743(0x1ff)],_0x2fa9cc=getConsoleNextUrl(_0x50a3c2[_0x1f4743(0x22e)],'/app/dw/parentSegments/'+_0x1e90ec['id']),_0x2ca43c=_0x5afbb0?_0x1f4743(0x18b):_0x1f4743(0x18c);return console['error']('✔\x20'+_0x2ca43c+_0x1f4743(0x1ba)+_0x1e90ec[_0x1f4743(0x1a2)]+'\x27'),console['error']('\x20\x20'+_0x2fa9cc),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x122);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x11a);async['execute'](_0x12e0bc){const _0x4a5d9a=a30_0x4fc0d8,{options:_0x131389,args:_0x3b562d,tdx:_0x1a735a}=_0x12e0bc,_0x4e7d8a=_0x131389,_0x510301=_0x3b562d[0x0]||_0x131389[_0x4a5d9a(0x145)];if(!_0x510301)return showParentSegmentNotSetError(_0x4a5d9a(0x188)+_0x4a5d9a(0x1e9)+_0x4a5d9a(0xd6)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x4a5d9a(0x179)),0x1;const _0x5826f0=resolveYamlFile(_0x510301);if(!existsSync(_0x5826f0))return showFileNotFoundError(_0x5826f0,_0x510301),0x1;_0x4e7d8a[_0x4a5d9a(0x136)]&&(console[_0x4a5d9a(0x187)]('Site:\x20'+_0x4e7d8a[_0x4a5d9a(0x22e)]),console[_0x4a5d9a(0x187)](_0x4a5d9a(0xdf)+_0x5826f0));let _0x4b752c;try{_0x4b752c=readFileSync(_0x5826f0,_0x4a5d9a(0x167));}catch(_0x16bdd2){const _0x4dd7be=_0x16bdd2 instanceof Error?_0x16bdd2[_0x4a5d9a(0x11d)]:String(_0x16bdd2);return console[_0x4a5d9a(0x187)]('Error\x20reading\x20file:\x20'+_0x4dd7be),0x1;}const _0x491c23=createCommandSpinner(a30_0x51421d[_0x4a5d9a(0x15f)](_0x4a5d9a(0x1bc)),{'verbose':_0x4e7d8a[_0x4a5d9a(0x136)]});_0x491c23[_0x4a5d9a(0x101)]();const _0x2a2b81={'onProgress':_0x230ecd=>{_0x491c23['text']=formatProgressMessage(_0x230ecd);}};if(_0x4e7d8a[_0x4a5d9a(0x194)])_0x2a2b81[_0x4a5d9a(0x194)]=!![];if(_0x4e7d8a[_0x4a5d9a(0x1aa)])_0x2a2b81['enriched']=!![];_0x4e7d8a[_0x4a5d9a(0xe8)]&&(_0x2a2b81[_0x4a5d9a(0xe8)]=_0x4e7d8a[_0x4a5d9a(0xe8)]);_0x4e7d8a[_0x4a5d9a(0x1bd)]&&(_0x2a2b81[_0x4a5d9a(0x1bd)]=_0x4e7d8a[_0x4a5d9a(0x1bd)]);if(_0x4e7d8a[_0x4a5d9a(0x106)])_0x2a2b81['interval']=_0x4e7d8a[_0x4a5d9a(0x106)];let _0x690886;try{_0x690886=await _0x1a735a[_0x4a5d9a(0x1b4)][_0x4a5d9a(0x243)](_0x4b752c,_0x2a2b81),_0x491c23['stop']();}catch(_0xa40c20){_0x491c23[_0x4a5d9a(0x1e2)]();throw _0xa40c20;}const _0x1b6890=_0x4e7d8a[_0x4a5d9a(0x106)]||_0x4a5d9a(0xef);return this['displayValidateResults'](_0x690886,_0x2a2b81,_0x5826f0,_0x1b6890),_0x690886[_0x4a5d9a(0x20c)]?0x0:0x1;}['displayValidateResults'](_0x28c8fa,_0x23584f,_0x1dbfc6,_0x526f6b){const _0x7d70a3=a30_0x4fc0d8;console[_0x7d70a3(0x187)]('\x0a'+a30_0x51421d[_0x7d70a3(0xc5)](_0x7d70a3(0x236))+'\x20'+_0x28c8fa[_0x7d70a3(0x1a2)]),console[_0x7d70a3(0x187)]('═'[_0x7d70a3(0x109)](0x3c)),this[_0x7d70a3(0x246)](_0x28c8fa);if(typeof _0x23584f[_0x7d70a3(0xe8)]==='string'){this[_0x7d70a3(0x172)](_0x28c8fa),this[_0x7d70a3(0x237)](_0x28c8fa),this['displayPreviewHints'](_0x1dbfc6,_0x526f6b,_0x7d70a3(0xe8),_0x23584f['attribute']);return;}if(_0x23584f['attribute']===!![]){this[_0x7d70a3(0x172)](_0x28c8fa),this[_0x7d70a3(0x237)](_0x28c8fa),this[_0x7d70a3(0x1f2)](_0x1dbfc6,_0x526f6b,_0x7d70a3(0x224));return;}if(typeof _0x23584f['behavior']===_0x7d70a3(0x24d)){this[_0x7d70a3(0x177)](_0x28c8fa,_0x526f6b),this[_0x7d70a3(0x237)](_0x28c8fa),this['displayPreviewHints'](_0x1dbfc6,_0x526f6b,_0x7d70a3(0x1bd),_0x23584f[_0x7d70a3(0x1bd)]);return;}if(_0x23584f[_0x7d70a3(0x1bd)]===!![]){this[_0x7d70a3(0x177)](_0x28c8fa,_0x526f6b),this['displaySummary'](_0x28c8fa),this[_0x7d70a3(0x1f2)](_0x1dbfc6,_0x526f6b,_0x7d70a3(0x1d7));return;}this[_0x7d70a3(0x172)](_0x28c8fa),this[_0x7d70a3(0x177)](_0x28c8fa,_0x526f6b),this[_0x7d70a3(0x1cc)](_0x28c8fa),this['displaySummary'](_0x28c8fa),this[_0x7d70a3(0x1f2)](_0x1dbfc6,_0x526f6b,_0x7d70a3(0xf2));}[a30_0x4fc0d8(0x1cc)](_0x2d6bff){displayRealtimeValidation(_0x2d6bff);}[a30_0x4fc0d8(0x1f2)](_0x5c8201,_0x335a3a,_0x2192da,_0x1f9ff5){const _0x72649=a30_0x4fc0d8;console[_0x72649(0x187)]('\x0a'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x1c5)));const _0x31e67e=_0x335a3a!==_0x72649(0xef)?_0x72649(0x1d1)+_0x335a3a:'';if(_0x2192da===_0x72649(0xe8)&&_0x1f9ff5)console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x163)+_0x5c8201+_0x72649(0x19d)+_0x1f9ff5+'\x22'+_0x31e67e));else{if(_0x2192da===_0x72649(0x1bd)&&_0x1f9ff5)console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)]('tdx\x20ps\x20preview\x20'+_0x5c8201+_0x72649(0x119)+_0x1f9ff5+'\x22'+_0x31e67e));else(_0x2192da===_0x72649(0x224)||_0x2192da===_0x72649(0xf2))&&console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x163)+_0x5c8201+_0x72649(0x14f)+_0x31e67e));}(_0x2192da===_0x72649(0x1d7)||_0x2192da===_0x72649(0xf2))&&console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d[_0x72649(0x15f)](_0x72649(0x163)+_0x5c8201+_0x72649(0xff)+_0x31e67e)),_0x2192da===_0x72649(0xf2)&&console[_0x72649(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x72649(0x163)+_0x5c8201+_0x72649(0x1ac)+_0x31e67e));}[a30_0x4fc0d8(0x246)](_0x2cd935){const _0x2ea60f=a30_0x4fc0d8,{master:_0x102a10}=_0x2cd935,_0x29dc6c=_0x102a10['schemaValid']?a30_0x51421d[_0x2ea60f(0x16b)]('✔'):a30_0x51421d[_0x2ea60f(0x10c)]('✘');console[_0x2ea60f(0x187)]('\x0a'+a30_0x51421d[_0x2ea60f(0x15f)](_0x2ea60f(0x242))),console[_0x2ea60f(0x187)](_0x29dc6c+'\x20'+a30_0x51421d[_0x2ea60f(0xc5)](_0x102a10[_0x2ea60f(0x1ee)]+'.'+_0x102a10[_0x2ea60f(0x1a0)])),_0x102a10[_0x2ea60f(0x117)]?_0x102a10[_0x2ea60f(0x201)]!==undefined&&console[_0x2ea60f(0x187)]('\x20\x20'+a30_0x51421d[_0x2ea60f(0x15f)](_0x2ea60f(0x13f))+'\x20'+a30_0x51421d[_0x2ea60f(0x1c0)](formatRows(_0x102a10[_0x2ea60f(0x201)]))):console[_0x2ea60f(0x187)]('\x20\x20'+a30_0x51421d[_0x2ea60f(0x10c)](_0x2ea60f(0x215))+'\x20'+_0x102a10[_0x2ea60f(0x1be)]);}[a30_0x4fc0d8(0x172)](_0x57b6f0){const _0x4649ee=a30_0x4fc0d8;if(_0x57b6f0[_0x4649ee(0x224)]['length']===0x0)return;console[_0x4649ee(0x187)]('\x0a'+a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0xfd)));for(const _0x30ed8e of _0x57b6f0['attributes']){const _0xc6de81=_0x30ed8e['schemaValid']?a30_0x51421d[_0x4649ee(0x16b)]('✔'):a30_0x51421d[_0x4649ee(0x10c)]('✘');let _0x9cb8ab='';if(_0x30ed8e['schemaValid']&&_0x30ed8e[_0x4649ee(0x19c)]!==undefined&&_0x30ed8e[_0x4649ee(0x1a5)]!==undefined){const _0x23b4a3=_0x30ed8e[_0x4649ee(0x1a5)]['toFixed'](0x1),_0x2bf2cc=_0x30ed8e[_0x4649ee(0x1a5)]>=0x50?a30_0x51421d[_0x4649ee(0x16b)]:_0x30ed8e[_0x4649ee(0x1a5)]>=0x32?a30_0x51421d['yellow']:a30_0x51421d['red'];_0x9cb8ab='\x20'+a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0x138))+'\x20'+_0x2bf2cc(_0x23b4a3+'%')+'\x20('+formatRows(_0x30ed8e[_0x4649ee(0x19c)])+_0x4649ee(0x16e);}console[_0x4649ee(0x187)](_0xc6de81+'\x20'+a30_0x51421d[_0x4649ee(0xc5)](_0x30ed8e[_0x4649ee(0x1a2)])+_0x9cb8ab),console['error']('\x20\x20'+a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0xbe))+'\x20'+a30_0x51421d[_0x4649ee(0xc5)](_0x30ed8e['database']+'.'+_0x30ed8e[_0x4649ee(0x1a0)]));const _0x58bbef=_0x30ed8e[_0x4649ee(0x1d0)]===_0x30ed8e[_0x4649ee(0x1cf)]?a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0x218))+'\x20'+_0x30ed8e[_0x4649ee(0x1d0)]:a30_0x51421d[_0x4649ee(0x15f)](_0x4649ee(0xc1))+'\x20'+_0x30ed8e[_0x4649ee(0x1d0)]+_0x4649ee(0x206)+_0x30ed8e[_0x4649ee(0x1cf)];console[_0x4649ee(0x187)]('\x20\x20'+_0x58bbef),console['error']('\x20\x20'+a30_0x51421d['dim']('Columns:')),this[_0x4649ee(0xec)](_0x30ed8e[_0x4649ee(0x139)]),!_0x30ed8e['schemaValid']&&console[_0x4649ee(0x187)]('\x20\x20'+a30_0x51421d['red']('Error:')+'\x20'+_0x30ed8e[_0x4649ee(0x1be)]);}}[a30_0x4fc0d8(0x177)](_0x574d05,_0x29d6ae){const _0x4cdefd=a30_0x4fc0d8;if(_0x574d05['behaviors']['length']===0x0)return;console[_0x4cdefd(0x187)]('\x0a'+a30_0x51421d[_0x4cdefd(0x15f)](_0x4cdefd(0x13b))+'\x20'+a30_0x51421d['dim']('('+_0x29d6ae+')'));for(const _0x2272a6 of _0x574d05[_0x4cdefd(0x1d7)]){const _0x3d3844=_0x2272a6[_0x4cdefd(0x117)]?a30_0x51421d['green']('✔'):a30_0x51421d[_0x4cdefd(0x10c)]('✘');let _0x3cac0e='';if(_0x2272a6[_0x4cdefd(0x117)]&&_0x2272a6['customersWithEvents']!==undefined&&_0x2272a6[_0x4cdefd(0x175)]!==undefined){const _0x1ac2bd=_0x2272a6['customerPercent']?.[_0x4cdefd(0x230)](0x1)||'?',_0x249780=(_0x2272a6[_0x4cdefd(0x1fb)]??0x0)>=0x32?a30_0x51421d['green']:(_0x2272a6['customerPercent']??0x0)>=0x14?a30_0x51421d[_0x4cdefd(0x24f)]:a30_0x51421d[_0x4cdefd(0x10c)];_0x3cac0e='\x20'+a30_0x51421d['dim']('Customers:')+'\x20'+_0x249780(formatRows(_0x2272a6[_0x4cdefd(0x220)]))+'\x20('+_0x1ac2bd+_0x4cdefd(0xd9)+a30_0x51421d[_0x4cdefd(0x15f)](_0x4cdefd(0x105))+'\x20'+a30_0x51421d[_0x4cdefd(0x1c0)](formatRows(_0x2272a6[_0x4cdefd(0x175)]));}console[_0x4cdefd(0x187)](_0x3d3844+'\x20'+a30_0x51421d[_0x4cdefd(0xc5)](_0x2272a6[_0x4cdefd(0x1a2)])+_0x3cac0e),console[_0x4cdefd(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x4cdefd(0xbe))+'\x20'+a30_0x51421d['bold'](_0x2272a6[_0x4cdefd(0x1ee)]+'.'+_0x2272a6[_0x4cdefd(0x1a0)]));const _0x5ced6c=_0x2272a6[_0x4cdefd(0x1d0)]===_0x2272a6[_0x4cdefd(0x1cf)]?a30_0x51421d[_0x4cdefd(0x15f)](_0x4cdefd(0x218))+'\x20'+_0x2272a6[_0x4cdefd(0x1d0)]:a30_0x51421d[_0x4cdefd(0x15f)]('Join:')+'\x20'+_0x2272a6['joinKey']+_0x4cdefd(0x206)+_0x2272a6[_0x4cdefd(0x1cf)];console[_0x4cdefd(0x187)]('\x20\x20'+_0x5ced6c),console[_0x4cdefd(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x4cdefd(0x1b6))),this[_0x4cdefd(0xec)](_0x2272a6[_0x4cdefd(0x139)]),!_0x2272a6['schemaValid']&&console['error']('\x20\x20'+a30_0x51421d[_0x4cdefd(0x10c)](_0x4cdefd(0x215))+'\x20'+_0x2272a6[_0x4cdefd(0x1be)]);}}[a30_0x4fc0d8(0xec)](_0x56b375){const _0x2f58f7=a30_0x4fc0d8;for(const _0x18765a of _0x56b375){_0x18765a[_0x2f58f7(0x100)]===_0x18765a[_0x2f58f7(0x15a)]||_0x18765a[_0x2f58f7(0x15a)]==='*'?console[_0x2f58f7(0x187)](_0x2f58f7(0x193)+_0x18765a[_0x2f58f7(0x100)]):console[_0x2f58f7(0x187)](_0x2f58f7(0x193)+_0x18765a[_0x2f58f7(0x100)]+'\x20'+a30_0x51421d[_0x2f58f7(0x15f)]('('+_0x18765a['column']+')'));}}['displaySummary'](_0x345d8e){const _0x39ccfb=a30_0x4fc0d8;console[_0x39ccfb(0x187)]('─'[_0x39ccfb(0x109)](0x3c));if(_0x345d8e[_0x39ccfb(0xfb)][_0x39ccfb(0xd2)]>0x0){console[_0x39ccfb(0x187)]('\x0a'+a30_0x51421d['red'](_0x39ccfb(0x23b)));for(const _0x475b72 of _0x345d8e[_0x39ccfb(0xfb)]){console[_0x39ccfb(0x187)]('\x20\x20'+a30_0x51421d[_0x39ccfb(0x10c)]('•')+'\x20'+_0x475b72);}}_0x345d8e[_0x39ccfb(0x20c)]&&console['error']('\x0a'+a30_0x51421d[_0x39ccfb(0x16b)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0xf8);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0xfe);async[a30_0x4fc0d8(0xfa)](_0x349a45){const _0x1c54f4=a30_0x4fc0d8,{options:_0x1a595b,args:_0x5d7bb6,tdx:_0x35fa83}=_0x349a45,_0x271605=_0x1a595b,_0x1c066e=_0x5d7bb6[0x0]||_0x1a595b['parentSegment'];if(!_0x1c066e)return showParentSegmentNotSetError(_0x1c54f4(0x137)+_0x1c54f4(0xf9)+'Options\x20(one\x20required):\x0a'+_0x1c54f4(0x176)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x1c54f4(0x1ed)+_0x1c54f4(0x1e1)+_0x1c54f4(0x179)),0x1;if(!_0x271605['master']&&!_0x271605[_0x1c54f4(0xe8)]&&!_0x271605[_0x1c54f4(0x1bd)]&&!_0x271605[_0x1c54f4(0x1aa)])return console[_0x1c54f4(0x187)](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x1a6))),console['error'](_0x1c54f4(0x211)),console[_0x1c54f4(0x187)](_0x1c54f4(0xc3)),console['error'](_0x1c54f4(0xcf)),console[_0x1c54f4(0x187)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x1c54f4(0x187)](_0x1c54f4(0x143)),console[_0x1c54f4(0x187)](_0x1c54f4(0xd3)),0x1;const _0x403b77=resolveYamlFile(_0x1c066e);if(!existsSync(_0x403b77))return showFileNotFoundError(_0x403b77,_0x1c066e),0x1;_0x271605[_0x1c54f4(0x136)]&&(console[_0x1c54f4(0x187)](_0x1c54f4(0x17f)+_0x271605['site']),console[_0x1c54f4(0x187)](_0x1c54f4(0xdf)+_0x403b77));let _0xb68c34;try{_0xb68c34=readFileSync(_0x403b77,_0x1c54f4(0x167));}catch(_0x3f9e11){const _0x556aaa=_0x3f9e11 instanceof Error?_0x3f9e11[_0x1c54f4(0x11d)]:String(_0x3f9e11);return console[_0x1c54f4(0x187)]('Error\x20reading\x20file:\x20'+_0x556aaa),0x1;}let _0x8c422d;try{_0x8c422d=parseDef(_0xb68c34);}catch(_0x5604a6){const _0x4e573f=_0x5604a6 instanceof Error?_0x5604a6['message']:String(_0x5604a6);return console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0xd0)+_0x4e573f)),0x1;}if(_0x271605['attribute']===!![]||_0x271605[_0x1c54f4(0xe8)]===''){const _0x182792=_0x8c422d['attributes']?.[_0x1c54f4(0x13e)](_0x108a97=>_0x108a97[_0x1c54f4(0x1a2)])||[];if(_0x182792[_0x1c54f4(0xd2)]===0x0)console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x24c)));else{console[_0x1c54f4(0x187)](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x1da))),console[_0x1c54f4(0x187)](_0x1c54f4(0x1d3));for(const _0x33c58c of _0x182792){console[_0x1c54f4(0x187)]('\x20\x20'+a30_0x51421d['cyan'](_0x33c58c));}console[_0x1c54f4(0x187)](_0x1c54f4(0x160)+_0x1c066e+_0x1c54f4(0x19d)+_0x182792[0x0]+'\x22');}return 0x1;}if(_0x271605[_0x1c54f4(0x1bd)]===!![]||_0x271605[_0x1c54f4(0x1bd)]===''){const _0x23e6d6=_0x8c422d['behaviors']?.[_0x1c54f4(0x13e)](_0x2dcb79=>_0x2dcb79[_0x1c54f4(0x1a2)])||[];if(_0x23e6d6[_0x1c54f4(0xd2)]===0x0)console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0xc6)));else{console['error'](a30_0x51421d[_0x1c54f4(0x10c)](_0x1c54f4(0x12b))),console[_0x1c54f4(0x187)]('Available\x20behaviors:');for(const _0x4d89b0 of _0x23e6d6){console['error']('\x20\x20'+a30_0x51421d['cyan'](_0x4d89b0));}console[_0x1c54f4(0x187)](_0x1c54f4(0x160)+_0x1c066e+'\x20--behavior\x20\x22'+_0x23e6d6[0x0]+'\x22');}return 0x1;}const _0x709fb0=createCommandSpinner(a30_0x51421d[_0x1c54f4(0x15f)](_0x1c54f4(0x225)),{'verbose':_0x271605[_0x1c54f4(0x136)]});_0x709fb0[_0x1c54f4(0x101)]();const _0x538b85={'onProgress':_0x26d260=>{const _0x2fe783=_0x1c54f4;_0x709fb0[_0x2fe783(0x238)]=formatProgressMessage(_0x26d260);}};if(_0x271605[_0x1c54f4(0x194)])_0x538b85[_0x1c54f4(0x194)]=!![];if(_0x271605[_0x1c54f4(0xe8)]&&typeof _0x271605[_0x1c54f4(0xe8)]===_0x1c54f4(0x24d))_0x538b85[_0x1c54f4(0xe8)]=_0x271605[_0x1c54f4(0xe8)];if(_0x271605[_0x1c54f4(0x1bd)]&&typeof _0x271605[_0x1c54f4(0x1bd)]==='string')_0x538b85[_0x1c54f4(0x1bd)]=_0x271605[_0x1c54f4(0x1bd)];if(_0x271605['enriched'])_0x538b85[_0x1c54f4(0x1aa)]=!![];if(_0x271605['interval'])_0x538b85[_0x1c54f4(0x106)]=_0x271605[_0x1c54f4(0x106)];let _0x133ed8;try{_0x133ed8=await _0x35fa83[_0x1c54f4(0x1b4)]['previewParentYaml'](_0xb68c34,_0x538b85),_0x709fb0[_0x1c54f4(0x1e2)]();}catch(_0x346ff7){_0x709fb0[_0x1c54f4(0x1e2)]();throw _0x346ff7;}return await this[_0x1c54f4(0x19f)](_0x133ed8,{'master':_0x271605['master'],'attribute':typeof _0x271605[_0x1c54f4(0xe8)]===_0x1c54f4(0x24d)?_0x271605[_0x1c54f4(0xe8)]:undefined,'behavior':typeof _0x271605[_0x1c54f4(0x1bd)]===_0x1c54f4(0x24d)?_0x271605[_0x1c54f4(0x1bd)]:undefined,'enriched':_0x271605['enriched']}),_0x133ed8[_0x1c54f4(0x20c)]?0x0:0x1;}async[a30_0x4fc0d8(0x19f)](_0x122558,_0x2d310b){const _0x1be168=a30_0x4fc0d8;console[_0x1be168(0x187)]('\x0a'+a30_0x51421d[_0x1be168(0xc5)](_0x1be168(0x216))+'\x20'+_0x122558[_0x1be168(0x1a2)]),console[_0x1be168(0x187)]('═'[_0x1be168(0x109)](0x3c));if(_0x2d310b[_0x1be168(0x194)]&&_0x122558[_0x1be168(0x1e6)]){const _0x5f2a5e=a30_0x51421d['dim'](_0x1be168(0x14e))+'\x20'+a30_0x51421d['bold'](_0x122558[_0x1be168(0x194)][_0x1be168(0x1ee)]+'.'+_0x122558[_0x1be168(0x194)][_0x1be168(0x1a0)]);await this[_0x1be168(0x169)](_0x5f2a5e,_0x122558[_0x1be168(0x1e6)]);}else{if(_0x2d310b[_0x1be168(0xe8)]&&_0x122558[_0x1be168(0x1e6)]){const _0x14ebd6=a30_0x51421d[_0x1be168(0x15f)](_0x1be168(0x1a1))+'\x20'+a30_0x51421d['bold'](_0x2d310b[_0x1be168(0xe8)]);await this[_0x1be168(0x169)](_0x14ebd6,_0x122558[_0x1be168(0x1e6)]);}else{if(_0x2d310b[_0x1be168(0x1bd)]&&_0x122558['sampleData']){const _0x3114fb=a30_0x51421d[_0x1be168(0x15f)](_0x1be168(0xf6))+'\x20'+a30_0x51421d['bold'](_0x2d310b[_0x1be168(0x1bd)]);await this[_0x1be168(0x169)](_0x3114fb,_0x122558['sampleData']);}else{if(_0x2d310b[_0x1be168(0x1aa)]&&_0x122558[_0x1be168(0x1e6)]){const _0x5b221a=a30_0x51421d[_0x1be168(0x15f)](_0x1be168(0xd8))+'\x20'+a30_0x51421d[_0x1be168(0xc5)](_0x1be168(0x21e));await this[_0x1be168(0x169)](_0x5b221a,_0x122558[_0x1be168(0x1e6)]);}else!_0x122558[_0x1be168(0x1e6)]&&console[_0x1be168(0x187)](_0x1be168(0x1f9));}}}if(_0x122558[_0x1be168(0xfb)][_0x1be168(0xd2)]>0x0){console['error']('─'[_0x1be168(0x109)](0x3c)),console['error']('\x0a'+a30_0x51421d[_0x1be168(0x10c)](_0x1be168(0x23b)));for(const _0x1896bb of _0x122558[_0x1be168(0xfb)]){console[_0x1be168(0x187)]('\x20\x20'+a30_0x51421d[_0x1be168(0x10c)]('•')+'\x20'+_0x1896bb);}}}async[a30_0x4fc0d8(0x169)](_0x3a62b7,_0x42051d){const _0x6fc4ec=a30_0x4fc0d8;if(_0x42051d[_0x6fc4ec(0xd2)]===0x0){console[_0x6fc4ec(0x187)]('\x0a'+_0x3a62b7),console[_0x6fc4ec(0x187)](_0x6fc4ec(0xe4));return;}console[_0x6fc4ec(0x187)]('\x0a'+_0x3a62b7);const _0x5cefcf=Object['keys'](_0x42051d[0x0])['map'](_0x232bfa=>({'name':_0x232bfa,'type':typeof _0x42051d[0x0][_0x232bfa]===_0x6fc4ec(0x1f5)?_0x6fc4ec(0x185):_0x6fc4ec(0xc9)})),_0x2c426b={'queryId':_0x6fc4ec(0x103),'columns':_0x5cefcf,'data':_0x42051d,'stats':{'state':_0x6fc4ec(0xe7),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x42051d[_0x6fc4ec(0xd2)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4c1b42=formatAsTable(_0x2c426b,_0x42051d['length'],!![]);await writeOutput(_0x4c1b42,undefined,_0x6fc4ec(0x1a0));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a30_0x4fc0d8(0x14a);[a30_0x4fc0d8(0x251)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a30_0x4fc0d8(0xfa)](_0x6067a8){const _0x2b55b5=a30_0x4fc0d8,{options:_0x16e7f2,args:_0x1e1265,tdx:_0x3d2d22}=_0x6067a8,_0x120e76=_0x16e7f2,_0x4dd2b3=_0x1e1265[0x0]||_0x16e7f2[_0x2b55b5(0x145)];if(!_0x4dd2b3)return showParentSegmentNotSetError(_0x2b55b5(0xe0)+_0x2b55b5(0x104)),0x1;const _0x976902=resolveYamlFile(_0x4dd2b3);if(existsSync(_0x976902)){_0x120e76[_0x2b55b5(0x136)]&&console[_0x2b55b5(0x187)]('Found\x20YAML\x20file:\x20'+_0x976902);let _0x4392f1;try{_0x4392f1=readFileSync(_0x976902,'utf-8');}catch(_0x394373){const _0x5ebb7c=_0x394373 instanceof Error?_0x394373[_0x2b55b5(0x11d)]:String(_0x394373);return console['error']('Error\x20reading\x20file:\x20'+_0x5ebb7c),0x1;}const _0x37e2b3=await withSpinner(_0x2b55b5(0x123),()=>_0x3d2d22[_0x2b55b5(0x1b4)][_0x2b55b5(0x154)](_0x4392f1),{'verbose':_0x120e76['verbose']}),_0x3cab1d=_0x37e2b3['data'],{isNew:_0x52f36e,name:_0x25a204,hasChanges:_0x4f9a38,diffFormatted:_0x58531f}=_0x3cab1d;if(_0x4f9a38){_0x52f36e?console['error'](_0x2b55b5(0xed)+_0x25a204+'\x27:'):console[_0x2b55b5(0x187)](_0x2b55b5(0x23c)+_0x25a204+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x58531f),console['error']('─'[_0x2b55b5(0x109)](0x3c));const _0x17462c=_0x52f36e?'Create\x20parent\x20segment\x20\x27'+_0x25a204+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x25a204+'\x27\x20and\x20run\x20workflow?';if(!_0x120e76[_0x2b55b5(0x1a9)]){if(!isInteractive())return console[_0x2b55b5(0x187)](a30_0x51421d[_0x2b55b5(0x10c)](_0x2b55b5(0x22c)),_0x2b55b5(0x248)),console[_0x2b55b5(0x187)](a30_0x51421d[_0x2b55b5(0x15f)](_0x2b55b5(0x1d8))),0x1;const _0x32ec2b=await confirmKey(_0x17462c);if(!_0x32ec2b)return console[_0x2b55b5(0x187)](a30_0x51421d[_0x2b55b5(0x24f)]('Aborted.')),0x1;}const _0x2ba014=_0x52f36e?_0x2b55b5(0x191):_0x2b55b5(0x209);await withSpinner(_0x2ba014+_0x2b55b5(0x1ba)+_0x25a204+'\x27...',()=>_0x3cab1d[_0x2b55b5(0x130)](),{'verbose':_0x120e76[_0x2b55b5(0x136)]});const _0x35a584=_0x52f36e?'Created':_0x2b55b5(0x18c);console[_0x2b55b5(0x187)]('✔\x20'+_0x35a584+_0x2b55b5(0x1ba)+_0x25a204+'\x27');}else console['error'](_0x2b55b5(0x12f)+_0x25a204+_0x2b55b5(0x161));}const _0x16fc85=await withSpinner(_0x2b55b5(0x232)+_0x4dd2b3+_0x2b55b5(0xf3),()=>_0x3d2d22['segment'][_0x2b55b5(0x17a)](_0x4dd2b3),{'verbose':_0x120e76[_0x2b55b5(0x136)]}),_0x31f932=_0x16fc85[_0x2b55b5(0x1ff)],_0x2ffd17=getConsoleUrl(_0x120e76[_0x2b55b5(0x22e)],'/app/workflows/'+_0x31f932[_0x2b55b5(0x1b8)]+_0x2b55b5(0x254)+_0x31f932[_0x2b55b5(0x22b)]+_0x2b55b5(0x244)+_0x31f932['workflowAttemptId']);return console[_0x2b55b5(0x187)](_0x2b55b5(0x20d)),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d[_0x2b55b5(0x15f)]('Audience\x20ID:')+'\x20'+_0x31f932['audienceId']),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d['dim'](_0x2b55b5(0x247))+'\x20'+_0x31f932[_0x2b55b5(0x1e7)]),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d[_0x2b55b5(0x15f)](_0x2b55b5(0xca))+'\x20'+_0x31f932[_0x2b55b5(0x22b)]),console[_0x2b55b5(0x187)]('\x20\x20'+a30_0x51421d[_0x2b55b5(0x15f)]('Attempt:')+'\x20'+_0x31f932[_0x2b55b5(0x214)]),console[_0x2b55b5(0x187)]('\x20\x20'+_0x2ffd17),console[_0x2b55b5(0x187)]('\x0a'+a30_0x51421d['dim'](_0x2b55b5(0x134))+_0x2b55b5(0x1c3)+_0x31f932[_0x2b55b5(0x214)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x202);async['execute'](_0x8586ad){const _0x3c3c6e=a30_0x4fc0d8,{options:_0x3419bc,args:_0x4e6bab,tdx:_0x14188f}=_0x8586ad,_0x583d81=_0x4e6bab[0x0]||_0x3419bc[_0x3c3c6e(0x145)];if(!_0x583d81)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'+_0x3c3c6e(0x1b3)),0x1;_0x3419bc['verbose']&&(console[_0x3c3c6e(0x187)]('Site:\x20'+_0x3419bc[_0x3c3c6e(0x22e)]),console[_0x3c3c6e(0x187)]('Parent\x20segment:\x20'+_0x583d81));const _0x92b89f=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x583d81+_0x3c3c6e(0xf3),()=>_0x14188f[_0x3c3c6e(0x1b4)][_0x3c3c6e(0x173)](_0x583d81),{'verbose':_0x3419bc['verbose']}),_0x51124f=_0x92b89f[_0x3c3c6e(0x1ff)];console['error']('✔\x20Found\x20'+_0x51124f[_0x3c3c6e(0xd2)]+_0x3c3c6e(0x235)+(_0x51124f[_0x3c3c6e(0xd2)]!==0x1?'s':''));if(_0x3419bc[_0x3c3c6e(0x132)]||_0x3419bc[_0x3c3c6e(0x18e)])return await handleSDKOutput(_0x51124f,_0x3419bc),0x0;return displayFieldsHumanReadable(_0x51124f,_0x583d81),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a30_0x4fc0d8(0x190);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0xe3);async[a30_0x4fc0d8(0xfa)](_0x7dd894){const _0x5ec448=a30_0x4fc0d8,{options:_0x41dbd8,args:_0x1332d1,tdx:_0x36b973}=_0x7dd894,_0x4dcbbc=_0x41dbd8,_0x49be1e=_0x1332d1[0x0]||_0x41dbd8[_0x5ec448(0x145)];if(!_0x49be1e)return showParentSegmentNotSetError(_0x5ec448(0x1f0)+_0x5ec448(0x113)+_0x5ec448(0xd6)+_0x5ec448(0x151)),0x1;_0x41dbd8['verbose']&&(console[_0x5ec448(0x187)](_0x5ec448(0x17f)+_0x41dbd8[_0x5ec448(0x22e)]),console[_0x5ec448(0x187)]('Parent\x20segment:\x20'+_0x49be1e));const _0x37d393=await withSpinner(_0x5ec448(0x24a)+_0x49be1e+_0x5ec448(0xf3),()=>_0x36b973[_0x5ec448(0x1b4)][_0x5ec448(0x1ce)](_0x49be1e),{'verbose':_0x41dbd8[_0x5ec448(0x136)]}),_0x3f4edb=_0x37d393[_0x5ec448(0x1ff)];if(_0x4dcbbc[_0x5ec448(0x252)]){const _0x228909=getConsoleNextUrl(_0x4dcbbc[_0x5ec448(0x22e)],'/app/dw/parentSegments/'+_0x3f4edb['id']);return console[_0x5ec448(0x187)](a30_0x51421d[_0x5ec448(0x16b)]('✔')+'\x20Opening\x20'+a30_0x51421d[_0x5ec448(0x1c0)](_0x228909)),openBrowser(_0x228909),0x0;}return await handleSingleObjectOutput(_0x3f4edb,_0x41dbd8),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']='segment:parent:desc';[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x1c7);async[a30_0x4fc0d8(0xfa)](_0x361fc2){const _0x4a195b=a30_0x4fc0d8,{options:_0x853b0d,args:_0x1d0f9c,tdx:_0x1d2b17}=_0x361fc2,_0x252d3f=_0x853b0d,_0x4cb376=_0x1d0f9c[0x0]||_0x853b0d[_0x4a195b(0x145)];if(!_0x4cb376)return showParentSegmentNotSetError(_0x4a195b(0x199)+_0x4a195b(0x146)+_0x4a195b(0xd6)+_0x4a195b(0x23e)),0x1;_0x853b0d[_0x4a195b(0x136)]&&(console['error'](_0x4a195b(0x17f)+_0x853b0d[_0x4a195b(0x22e)]),console[_0x4a195b(0x187)](_0x4a195b(0x197)+_0x4cb376));const _0x500699=await withSpinner(_0x4a195b(0xc0)+_0x4cb376+_0x4a195b(0xf3),()=>_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0x15b)](_0x4cb376),{'verbose':_0x853b0d[_0x4a195b(0x136)]}),_0x284248=_0x500699[_0x4a195b(0x1ff)],_0x6ee39c=_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0xcd)](_0x284248);if(_0x252d3f[_0x4a195b(0xe1)]){const _0x5684eb=await this['collectSchema'](_0x361fc2,_0x4cb376,_0x284248,_0x6ee39c),_0x30bd73=this[_0x4a195b(0x23a)](_0x5684eb);writeFileSync(_0x252d3f['output'],_0x30bd73);const _0x1d946b=_0x5684eb['customers'][_0x4a195b(0x139)]['length']+_0x5684eb[_0x4a195b(0x1d7)]['reduce']((_0x21046d,_0x1a5cb8)=>_0x21046d+_0x1a5cb8[_0x4a195b(0x139)]['length'],0x0),_0x4f7bb9=_0x5684eb[_0x4a195b(0x1d7)][_0x4a195b(0x1b0)](_0x4f5eb8=>_0x4f5eb8[_0x4a195b(0x139)][_0x4a195b(0xd2)]===0x0)[_0x4a195b(0xd2)];return console['log']('Schema\x20saved\x20to\x20'+_0x252d3f[_0x4a195b(0xe1)]),console[_0x4a195b(0xe9)](_0x4a195b(0x1c9)+_0x6ee39c),console[_0x4a195b(0xe9)](_0x4a195b(0x1f1)+_0x5684eb[_0x4a195b(0x1d7)]['length']+_0x4a195b(0x11e)),console['log'](_0x4a195b(0x198)+_0x1d946b+'\x20total'),_0x4f7bb9>0x0&&console['log']('\x20\x20Note:\x20'+_0x4f7bb9+_0x4a195b(0xd5)),0x0;}console[_0x4a195b(0x187)]('\x0a'+a30_0x51421d[_0x4a195b(0xc5)]('Output\x20Database:')+'\x20'+a30_0x51421d[_0x4a195b(0x1c0)](_0x6ee39c));const _0x424496=await withSpinner(_0x4a195b(0x16a),()=>_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0xbd)](_0x284248),{'verbose':_0x853b0d[_0x4a195b(0x136)]});console[_0x4a195b(0x187)]('\x0a'+a30_0x51421d['bold'](_0x4a195b(0x20a))+'\x20'+a30_0x51421d[_0x4a195b(0x15f)]('('+_0x6ee39c+_0x4a195b(0xd7)));const _0x2f7a74=await executeSchemaQuery(_0x424496['data'],_0x1d2b17,_0x853b0d);await handleQueryOutput(_0x2f7a74,_0x853b0d);const _0x1661f7=await withSpinner(_0x4a195b(0x171),()=>_0x1d2b17[_0x4a195b(0x1b4)][_0x4a195b(0x11f)](_0x284248),{'verbose':_0x853b0d[_0x4a195b(0x136)]});for(const _0x499b8a of _0x1661f7[_0x4a195b(0x1ff)]){const _0x5cabb2=_0x4a195b(0x217)+_0x499b8a[_0x4a195b(0x1c6)]()['replace'](/\s+/g,'_'),_0x53d6b0=_0x4a195b(0x16f)+_0x6ee39c+'.'+_0x5cabb2;console[_0x4a195b(0x187)]('\x0a'+a30_0x51421d['bold'](_0x499b8a)+'\x20'+a30_0x51421d[_0x4a195b(0x15f)]('('+_0x6ee39c+'.'+_0x5cabb2+')'));try{const _0xcd81b9=await executeSchemaQuery(_0x53d6b0,_0x1d2b17,_0x853b0d);await handleQueryOutput(_0xcd81b9,_0x853b0d);}catch{console['error'](a30_0x51421d[_0x4a195b(0x24f)](_0x4a195b(0xee)));}}return 0x0;}async[a30_0x4fc0d8(0x152)](_0x255044,_0x185e5d,_0x14745a,_0x267d7b){const _0x4bad91=a30_0x4fc0d8,{options:_0x310321,tdx:_0xf41c6e}=_0x255044,_0x382146=await withSpinner('Fetching\x20customers\x20schema...',()=>_0xf41c6e[_0x4bad91(0x1b4)]['getParentSQL'](_0x14745a),{'verbose':_0x310321[_0x4bad91(0x136)]}),_0x435afb=await executeSchemaQuery(_0x382146[_0x4bad91(0x1ff)],_0xf41c6e,_0x310321),_0xf68124=_0x435afb[_0x4bad91(0x1ff)][_0x4bad91(0x13e)](_0x580f95=>({'name':_0x580f95[_0x4bad91(0x13c)],'type':_0x580f95[_0x4bad91(0x22f)]})),_0x3ac7f9=await withSpinner(_0x4bad91(0x171),()=>_0xf41c6e['segment']['getBehaviorNames'](_0x14745a),{'verbose':_0x310321[_0x4bad91(0x136)]}),_0x25d921=[];for(const _0x1b9afa of _0x3ac7f9[_0x4bad91(0x1ff)]){const _0x29cf16=_0x4bad91(0x217)+_0x1b9afa[_0x4bad91(0x1c6)]()[_0x4bad91(0x131)](/\s+/g,'_'),_0x129a5a=_0x4bad91(0x16f)+_0x267d7b+'.'+_0x29cf16;let _0x5501dc=[];try{const _0x2daec7=await executeSchemaQuery(_0x129a5a,_0xf41c6e,_0x310321);_0x5501dc=_0x2daec7[_0x4bad91(0x1ff)][_0x4bad91(0x13e)](_0x936bdc=>({'name':_0x936bdc[_0x4bad91(0x13c)],'type':_0x936bdc['column_type']}));}catch{}_0x25d921[_0x4bad91(0x1de)]({'table':_0x29cf16,'columns':_0x5501dc});}return{'database':_0x267d7b,'parent_segment':_0x185e5d,'parent_id':_0x14745a,'customers':{'table':_0x4bad91(0x20a),'columns':_0xf68124},'behaviors':_0x25d921};}[a30_0x4fc0d8(0x23a)](_0x25e9fc){const _0x4cad6f=a30_0x4fc0d8,_0x38e308=_0x31411c=>{const _0x6b3dae=a30_0x1520;if(_0x31411c[_0x6b3dae(0xd2)]===0x0)return'[]';const _0x7edcdf=_0x31411c['map'](_0xcc5942=>_0x6b3dae(0x189)+_0xcc5942['name']+_0x6b3dae(0xeb)+_0xcc5942['type']+_0x6b3dae(0x112));return'[\x0a'+_0x7edcdf[_0x6b3dae(0x1a3)](',\x0a')+_0x6b3dae(0xe2);},_0xc952d2=_0x25e9fc[_0x4cad6f(0x1d7)][_0x4cad6f(0x13e)](_0x13f6e6=>{const _0x55117b=_0x4cad6f;return _0x55117b(0x226)+_0x13f6e6[_0x55117b(0x1a0)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x38e308(_0x13f6e6[_0x55117b(0x139)])[_0x55117b(0x131)](/^/gm,'\x20\x20')[_0x55117b(0x1bf)]()+_0x55117b(0x1bb);})[_0x4cad6f(0x1a3)](',\x0a');return _0x4cad6f(0x234)+_0x25e9fc[_0x4cad6f(0x1ee)]+_0x4cad6f(0x1c1)+_0x25e9fc[_0x4cad6f(0x183)]+_0x4cad6f(0x245)+_0x25e9fc['parent_id']+_0x4cad6f(0x124)+_0x25e9fc[_0x4cad6f(0x20a)][_0x4cad6f(0x1a0)]+_0x4cad6f(0x12a)+_0x38e308(_0x25e9fc[_0x4cad6f(0x20a)][_0x4cad6f(0x139)])['replace'](/^/gm,'\x20\x20')[_0x4cad6f(0x1bf)]()+_0x4cad6f(0x115)+_0xc952d2+_0x4cad6f(0x10a);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x184);[a30_0x4fc0d8(0x251)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x4fc0d8(0xfa)](_0xe1fb08){const _0x4948e6=a30_0x4fc0d8,{options:_0x5e4093,args:_0x25a3db,tdx:_0x9e38}=_0xe1fb08,_0x5639e2=_0x25a3db[0x0]||_0x5e4093[_0x4948e6(0x145)];if(!_0x5639e2)return showParentSegmentNotSetError(_0x4948e6(0x116)+_0x4948e6(0xbf)),0x1;_0x5e4093['verbose']&&(console['error']('Site:\x20'+_0x5e4093[_0x4948e6(0x22e)]),console[_0x4948e6(0x187)]('Parent\x20segment:\x20'+_0x5639e2));const _0x29294c=await withSpinner(_0x4948e6(0xc0)+_0x5639e2+_0x4948e6(0xf3),()=>_0x9e38[_0x4948e6(0x1b4)]['resolveParentId'](_0x5639e2),{'verbose':_0x5e4093[_0x4948e6(0x136)]}),_0x1640a6=_0x29294c[_0x4948e6(0x1ff)],_0x5e328f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5639e2+_0x4948e6(0xf3),()=>_0x9e38['segment'][_0x4948e6(0xbd)](_0x1640a6),{'verbose':_0x5e4093[_0x4948e6(0x136)]}),_0x5b6120=_0x5e328f[_0x4948e6(0x1ff)];return _0x5e4093[_0x4948e6(0xf4)]===_0x4948e6(0x132)||_0x5e4093[_0x4948e6(0xf4)]===_0x4948e6(0x18e)?await handleSDKOutput([{'sql':_0x5b6120}],_0x5e4093):console[_0x4948e6(0xe9)](_0x5b6120),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x23d);[a30_0x4fc0d8(0x251)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a30_0x4fc0d8(0xfa)](_0x6a13dc){const _0x2fe63b=a30_0x4fc0d8,{options:_0x49207a,args:_0x512d0b,tdx:_0x148f12}=_0x6a13dc,_0x4b009e=_0x512d0b[0x0]||_0x49207a[_0x2fe63b(0x145)];if(!_0x4b009e)return showParentSegmentNotSetError(_0x2fe63b(0x208)+_0x2fe63b(0x180)),0x1;_0x49207a['verbose']&&(console['error']('Site:\x20'+_0x49207a[_0x2fe63b(0x22e)]),console[_0x2fe63b(0x187)]('Parent\x20segment:\x20'+_0x4b009e));const _0x4abc81=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4b009e+_0x2fe63b(0xf3),()=>_0x148f12['segment'][_0x2fe63b(0x15b)](_0x4b009e),{'verbose':_0x49207a[_0x2fe63b(0x136)]}),_0x5a7624=_0x4abc81[_0x2fe63b(0x1ff)],_0x4fc9c5=await withSpinner(_0x2fe63b(0x141)+_0x4b009e+_0x2fe63b(0xf3),()=>_0x148f12[_0x2fe63b(0x1b4)][_0x2fe63b(0xbd)](_0x5a7624),{'verbose':_0x49207a[_0x2fe63b(0x136)]});let _0x3640c4=_0x4fc9c5[_0x2fe63b(0x1ff)];const _0x54d2e9=resolveLimit(_0x49207a[_0x2fe63b(0x1ea)],DEFAULT_DISPLAY_LIMIT),_0x170ac7=/\bLIMIT\s+\d+/i[_0x2fe63b(0x1b9)](_0x3640c4);!_0x170ac7&&(_0x3640c4=_0x3640c4['trim']()[_0x2fe63b(0x131)](/;+$/,''),_0x3640c4=_0x2fe63b(0x18f)+_0x3640c4+_0x2fe63b(0x102)+_0x54d2e9);_0x49207a[_0x2fe63b(0x136)]&&console[_0x2fe63b(0x187)](_0x2fe63b(0xe5)+_0x3640c4);const _0x4a844e=await withProgressSpinner(_0x2fe63b(0x140),async _0x24e167=>{const _0x537c94=_0x2fe63b,_0x31549f=await _0x148f12[_0x537c94(0x1a8)][_0x537c94(0xfa)](_0x3640c4,{'catalog':'td','schema':'information_schema','onJobId':_0x4e0512=>{const _0x14b1cf=_0x537c94;_0x24e167[_0x14b1cf(0x1ef)](_0x4e0512);}});return _0x31549f;},{'verbose':_0x49207a[_0x2fe63b(0x136)]}),_0x4b93b6=_0x4a844e['data'],_0x26d1cf=_0x4b93b6[_0x2fe63b(0x239)]?_0x2fe63b(0x17d)+_0x4b93b6[_0x2fe63b(0x239)]+']':'';return console['error'](_0x2fe63b(0xc4)+_0x4b93b6[_0x2fe63b(0xdd)][_0x2fe63b(0x19a)][_0x2fe63b(0x21a)]()+_0x2fe63b(0xce)+(_0x2fe63b(0xdc)+formatElapsed(_0x4b93b6[_0x2fe63b(0xdd)][_0x2fe63b(0x16d)])+_0x26d1cf)),await handleQueryOutput(_0x4b93b6,_0x49207a),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x4fc0d8(0x1d5);['description']=a30_0x4fc0d8(0x1b7);async[a30_0x4fc0d8(0xfa)](_0x3607ef){const _0x1f5b6a=a30_0x4fc0d8,{options:_0x29d804,args:_0x1147a3,tdx:_0x37f316}=_0x3607ef,_0x5066c9=_0x1147a3[0x0],_0x4b995e=await withSpinner(_0x5066c9?_0x1f5b6a(0x229)+_0x5066c9+_0x1f5b6a(0xf3):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x37f316[_0x1f5b6a(0x212)][_0x1f5b6a(0x213)](),{'verbose':_0x29d804['verbose']});let _0x3174a4=_0x4b995e[_0x1f5b6a(0x1ff)][_0x1f5b6a(0x1b0)](_0x56e02e=>_0x56e02e['realtime_enabled']);if(_0x5066c9){const _0x35cee5=_0x5066c9['replace'](/[.+^${}()|[\]\\]/g,_0x1f5b6a(0x108))[_0x1f5b6a(0x131)](/\*/g,'.*')[_0x1f5b6a(0x131)](/\?/g,'.'),_0x3735b7=new RegExp('^'+_0x35cee5+'$','i');_0x3174a4=_0x3174a4[_0x1f5b6a(0x1b0)](_0x2a9c2c=>_0x3735b7[_0x1f5b6a(0x1b9)](_0x2a9c2c['name']));}_0x3174a4[_0x1f5b6a(0x21b)]((_0x374ed7,_0x518c24)=>_0x374ed7['name'][_0x1f5b6a(0x135)](_0x518c24[_0x1f5b6a(0x1a2)])),console['error']('✔\x20Found\x20'+_0x3174a4[_0x1f5b6a(0xd2)]+_0x1f5b6a(0x1b1)+(_0x3174a4[_0x1f5b6a(0xd2)]!==0x1?'s':''));const _0x52f13d=_0xba1ba9=>{const _0x1e850d=_0x1f5b6a;return getConsoleNextUrl(_0x29d804[_0x1e850d(0x22e)],_0x1e850d(0x1e4)+_0xba1ba9);};if(_0x29d804[_0x1f5b6a(0xf4)]===_0x1f5b6a(0x132)||_0x29d804['format']===_0x1f5b6a(0x18e)){const _0x27e860=_0x3174a4['map'](_0x160276=>({..._0x160276,'url':_0x52f13d(_0x160276['id'])}));await handleSDKOutput(_0x27e860,_0x29d804);}else{if(_0x3174a4[_0x1f5b6a(0xd2)]===0x0)console[_0x1f5b6a(0xe9)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0x214071 of _0x3174a4){const _0x2389fd=_0x214071['population']?a30_0x51421d[_0x1f5b6a(0x15f)]('\x20('+formatRows(_0x214071[_0x1f5b6a(0x133)])+')'):'',_0x2fc0fd=hyperlink(_0x214071[_0x1f5b6a(0x1a2)],_0x52f13d(_0x214071['id']));console['log']('⚡\x20'+_0x2fc0fd+_0x2389fd);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]='ps:rt:validate';[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x1e5);async['execute'](_0x5973ba){const _0x37a13f=a30_0x4fc0d8,{options:_0x581d62,args:_0x5109b5,tdx:_0x276282}=_0x5973ba,_0x25c3cd=_0x5109b5[0x0]||_0x581d62[_0x37a13f(0x145)];if(!_0x25c3cd)return showParentSegmentNotSetError(_0x37a13f(0xdb)+_0x37a13f(0xd4)),0x1;const _0x2bb773=resolveYamlFile(_0x25c3cd);if(!existsSync(_0x2bb773))return showFileNotFoundError(_0x2bb773,_0x25c3cd),0x1;let _0x2f0f00;try{_0x2f0f00=readFileSync(_0x2bb773,_0x37a13f(0x167));}catch(_0x3d97e7){const _0x6a841a=_0x3d97e7 instanceof Error?_0x3d97e7[_0x37a13f(0x11d)]:String(_0x3d97e7);return console[_0x37a13f(0x187)]('Error\x20reading\x20file:\x20'+_0x6a841a),0x1;}const _0x1e1fb1=createCommandSpinner(a30_0x51421d[_0x37a13f(0x15f)](_0x37a13f(0x1dd)),{'verbose':_0x581d62[_0x37a13f(0x136)]});_0x1e1fb1['start']();const _0x2e2e99={'realtime':!![],'onProgress':_0x14c616=>{const _0x394a08=_0x37a13f;_0x1e1fb1[_0x394a08(0x238)]=formatProgressMessage(_0x14c616);}};let _0x381e0b;try{_0x381e0b=await _0x276282[_0x37a13f(0x1b4)][_0x37a13f(0x243)](_0x2f0f00,_0x2e2e99),_0x1e1fb1[_0x37a13f(0x1e2)]();}catch(_0x35c799){_0x1e1fb1[_0x37a13f(0x1e2)]();throw _0x35c799;}console['error']('\x0a'+a30_0x51421d[_0x37a13f(0xc5)]('RT\x202.0\x20Validate:')+'\x20'+_0x381e0b[_0x37a13f(0x1a2)]),console[_0x37a13f(0x187)]('═'[_0x37a13f(0x109)](0x3c)),displayRealtimeValidation(_0x381e0b),console[_0x37a13f(0x187)]('─'[_0x37a13f(0x109)](0x3c));if(_0x381e0b[_0x37a13f(0xfb)][_0x37a13f(0xd2)]>0x0){console[_0x37a13f(0x187)]('\x0a'+a30_0x51421d[_0x37a13f(0x10c)](_0x37a13f(0x23b)));for(const _0x3ffccf of _0x381e0b[_0x37a13f(0xfb)]){console['error']('\x20\x20'+a30_0x51421d[_0x37a13f(0x10c)]('•')+'\x20'+_0x3ffccf);}}return _0x381e0b[_0x37a13f(0x20c)]&&console[_0x37a13f(0x187)]('\x0a'+a30_0x51421d[_0x37a13f(0x16b)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x381e0b['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x15e);[a30_0x4fc0d8(0x251)]=a30_0x4fc0d8(0x125);async['execute'](_0x21f46a){const _0x160e2b=a30_0x4fc0d8,{options:_0x39be5c,args:_0x501381,tdx:_0x54af35}=_0x21f46a,_0x53d325=_0x501381[0x0]||_0x39be5c[_0x160e2b(0x145)];if(!_0x53d325)return showParentSegmentNotSetError(_0x160e2b(0x222)+_0x160e2b(0x144)),0x1;const _0x3d4ca8=await withSpinner(_0x160e2b(0xc0)+_0x53d325+_0x160e2b(0xf3),()=>_0x54af35[_0x160e2b(0x1b4)]['resolveParentId'](_0x53d325),{'verbose':_0x39be5c['verbose']}),_0x55ff4d=_0x3d4ca8['data'],_0x42fdf8=await withSpinner(_0x160e2b(0xcb)+_0x53d325+_0x160e2b(0xf3),()=>_0x54af35[_0x160e2b(0x21f)][_0x160e2b(0x213)](_0x55ff4d),{'verbose':_0x39be5c[_0x160e2b(0x136)]}),_0x56f9b4=_0x42fdf8[_0x160e2b(0x1ff)];console[_0x160e2b(0x187)](_0x160e2b(0x1f3)+_0x56f9b4['length']+_0x160e2b(0x10b)+(_0x56f9b4[_0x160e2b(0xd2)]!==0x1?'s':''));if(_0x39be5c[_0x160e2b(0xf4)]==='json'||_0x39be5c['format']===_0x160e2b(0x18e))await handleSDKOutput(_0x56f9b4,_0x39be5c);else{if(_0x56f9b4[_0x160e2b(0xd2)]===0x0)console[_0x160e2b(0xe9)](_0x160e2b(0x15c)),console[_0x160e2b(0x187)](a30_0x51421d['cyan'](_0x160e2b(0x170)));else for(const _0x1ba343 of _0x56f9b4){const _0xcc06b1=_0x1ba343[_0x160e2b(0x231)]?.[_0x160e2b(0xd2)]||0x0,_0x5b4372=_0x1ba343[_0x160e2b(0xf0)]?a30_0x51421d[_0x160e2b(0x15f)]('\x20trigger='+_0x1ba343[_0x160e2b(0xf0)]):'',_0x1ddc8c=a30_0x51421d[_0x160e2b(0x15f)]('\x20('+_0xcc06b1+_0x160e2b(0x1f8)+(_0xcc06b1!==0x1?'s':'')+')');console[_0x160e2b(0xe9)]('\x20\x20'+_0x1ba343['name']+_0x5b4372+_0x1ddc8c),_0x1ba343['description']&&console['log']('\x20\x20\x20\x20'+a30_0x51421d[_0x160e2b(0x15f)](_0x1ba343[_0x160e2b(0x251)]));}}return 0x0;}}function a30_0x1520(_0x10785c,_0x181015){_0x10785c=_0x10785c-0xbd;const _0x2f93d6=a30_0x2f93();let _0x152011=_0x2f93d6[_0x10785c];return _0x152011;}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x4fc0d8(0x1a2)]=a30_0x4fc0d8(0x250);[a30_0x4fc0d8(0x251)]='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async['execute'](_0x1125a9){const _0x3efdaf=a30_0x4fc0d8,{options:_0x4ac40b,args:_0x311e59}=_0x1125a9,_0x4e5b35=_0x311e59[0x0]||_0x4ac40b['parentSegment'];if(!_0x4e5b35)return showParentSegmentNotSetError('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'+_0x3efdaf(0x18d)),0x1;const _0x6e2b18=resolveYamlFile(_0x4e5b35);if(!existsSync(_0x6e2b18))return showFileNotFoundError(_0x6e2b18,_0x4e5b35),0x1;let _0x365425;try{_0x365425=readFileSync(_0x6e2b18,'utf-8');}catch(_0x230bf4){const _0x267c9e=_0x230bf4 instanceof Error?_0x230bf4['message']:String(_0x230bf4);return console[_0x3efdaf(0x187)]('Error\x20reading\x20file:\x20'+_0x267c9e),0x1;}let _0x252c6d;try{_0x252c6d=parseDef(_0x365425);}catch(_0xd10ea3){const _0x2f4053=_0xd10ea3 instanceof Error?_0xd10ea3[_0x3efdaf(0x11d)]:String(_0xd10ea3);return console[_0x3efdaf(0x187)](a30_0x51421d[_0x3efdaf(0x10c)](_0x3efdaf(0xd0)+_0x2f4053)),0x1;}if(_0x252c6d[_0x3efdaf(0x182)]&&_0x252c6d[_0x3efdaf(0x182)]['length']>0x0)return console['error'](a30_0x51421d[_0x3efdaf(0x24f)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x6e2b18)),console[_0x3efdaf(0x187)](a30_0x51421d[_0x3efdaf(0x15f)](_0x3efdaf(0x150)+_0x252c6d[_0x3efdaf(0x182)][_0x3efdaf(0xd2)]+_0x3efdaf(0x195))),0x1;!_0x252c6d['realtime']&&(_0x252c6d[_0x3efdaf(0x212)]={'events':[{'name':_0x3efdaf(0x168),'source_table':_0x3efdaf(0x17b)}],'attributes':[{'name':_0x3efdaf(0x1b2),'type':_0x3efdaf(0x12c)}],'id_stitching':{'primary_key':_0x252c6d['master']['table']===_0x3efdaf(0x20a)?_0x3efdaf(0x1b5):_0x3efdaf(0x1e3)}});_0x252c6d['personalization_services']=[{'name':_0x3efdaf(0x142),'description':_0x3efdaf(0xea),'trigger_event':'page_view','sections':[{'name':'Default','criteria':_0x3efdaf(0x1ca),'attributes':['last_page_viewed']}]}];const _0x28f22c=serializeDef(_0x252c6d);return writeFileSync(_0x6e2b18,_0x28f22c,'utf-8'),console['error'](a30_0x51421d['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a30_0x51421d['cyan'](_0x6e2b18)),(!_0x252c6d[_0x3efdaf(0x212)]||_0x365425['indexOf'](_0x3efdaf(0x14b))===-0x1)&&console['error'](a30_0x51421d[_0x3efdaf(0x16b)]('✔')+_0x3efdaf(0x1d9)),console['error']('\x0a'+a30_0x51421d[_0x3efdaf(0x15f)](_0x3efdaf(0xc2))),console[_0x3efdaf(0x187)]('\x20\x201.\x20Edit\x20'+_0x6e2b18+_0x3efdaf(0x11c)),console[_0x3efdaf(0x187)](_0x3efdaf(0x15d)+a30_0x51421d[_0x3efdaf(0x15f)](_0x3efdaf(0x1c4)+_0x4e5b35)+_0x3efdaf(0x1ab)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a31_0xf5a616=a31_0x460a;(function(_0x3f836e,_0xc10ed8){const _0x2c7558=a31_0x460a,_0x4cfac2=_0x3f836e();while(!![]){try{const _0x5d398e=parseInt(_0x2c7558(0x193))/0x1+parseInt(_0x2c7558(0x1b4))/0x2+parseInt(_0x2c7558(0x184))/0x3+-parseInt(_0x2c7558(0x1c4))/0x4*(-parseInt(_0x2c7558(0x176))/0x5)+parseInt(_0x2c7558(0x1a4))/0x6+parseInt(_0x2c7558(0x1c6))/0x7+parseInt(_0x2c7558(0x1d7))/0x8*(-parseInt(_0x2c7558(0x1c2))/0x9);if(_0x5d398e===_0xc10ed8)break;else _0x4cfac2['push'](_0x4cfac2['shift']());}catch(_0x1dea0e){_0x4cfac2['push'](_0x4cfac2['shift']());}}}(a31_0x3b3d,0xb3d4d));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x1f91b8 from'node:path';function a31_0x460a(_0x3576c0,_0x407d89){_0x3576c0=_0x3576c0-0x174;const _0x3b3d86=a31_0x3b3d();let _0x460a45=_0x3b3d86[_0x3576c0];return _0x460a45;}function a31_0x3b3d(){const _0x2f717b=['Setup\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:use','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','test','(cleared)','2373660TxCSCN','red','48zxlRtj','apikey','5330948zdWXXP','\x20--default\x27\x20to\x20save\x20permanently','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Validating\x20API\x20key...','text','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20does\x20not\x20exist.','join','\x0aSetup\x20cancelled','logLevel','trim','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','apiKey','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','password','168msRswT','profile:remove','llm_project','Set\x20session\x20profile','540325UVIUOM','execute','\x27\x20removed\x20from\x20configuration','method','(session:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profile','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Unknown\x20key\x20\x27','select','getUserInfo','profileName','Profile\x20name\x20cannot\x20be\x20empty','\x20\x20tdx\x20--profile\x20','4294650dytags','\x0aAvailable\x20profiles:','Profile\x20\x27','length','jobs','bold','validate','\x27\x20updated:\x20','Changing\x20site\x20to\x20\x27','description','\x20Profile\x20\x27','includes','create','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','log','1101003uQIUze','site','warn','Choose\x20authentication\x20method:','\x0aOperation\x20cancelled','yellow','split','tdx:\x20profile\x20set','status','oauth','dim','Set\x20a\x20profile\x20configuration\x20value','OAuth\x20(browser\x20login)','profile:set','us01','Create\x20a\x20new\x20profile','message','3553320YGzKZL','/app/mp/ak','ERROR','VALID_KEYS','\x20\x20-\x20','Enter\x20your\x20TD\x20API\x20key:','tdx:\x20profile\x20remove','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','session','green','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','name','\x0aSaved\x20to:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','API\x20key\x20cannot\x20be\x20empty','2184024DHLShT','error','✗\x20Validation\x20failed:\x20','confirm','\x20\x20(no\x20profiles\x20found)','email','config','Site\x20was\x20not\x20changed.'];a31_0x3b3d=function(){return _0x2f717b;};return a31_0x3b3d();}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x51f12d from'prompts';import a31_0x272002 from'chalk';function validateProfileName(_0x28b556){const _0x37126d=a31_0x460a;if(!_0x28b556||!_0x28b556[_0x37126d(0x1d0)]())return _0x37126d(0x182);const _0x3ec50f=_0x28b556['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x37126d(0x1c0)](_0x3ec50f))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x3ec50f))return _0x37126d(0x186)+_0x3ec50f+_0x37126d(0x1ab);return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0xf5a616(0x1af)]='profile:create';[a31_0xf5a616(0x18d)]=a31_0xf5a616(0x1a2);async[a31_0xf5a616(0x177)](_0xda597c){const _0x467df7=a31_0xf5a616,{options:_0x18a518,args:_0x263883}=_0xda597c;console[_0x467df7(0x192)](a31_0x272002[_0x467df7(0x189)]('tdx:\x20profile\x20create'));let _0x9080b;if(_0x263883[_0x467df7(0x187)]>0x0&&_0x263883[0x0]){const _0x19a982=_0x263883[0x0][_0x467df7(0x1d0)](),_0x200c4=validateProfileName(_0x19a982);if(_0x200c4!==!![])return console['error'](a31_0x272002[_0x467df7(0x1c3)](_0x200c4)),0x1;_0x9080b=_0x19a982;}else{const _0x250895=await a31_0x51f12d({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x250895[_0x467df7(0x181)])return console[_0x467df7(0x192)](_0x467df7(0x1ce)),0x1;_0x9080b=_0x250895[_0x467df7(0x181)][_0x467df7(0x1d0)]();}const _0x1aafb3=await a31_0x51f12d({'type':_0x467df7(0x1ca),'name':_0x467df7(0x18d),'message':'Enter\x20description\x20(optional):'}),_0x5b7749=_0x1aafb3['description']?.[_0x467df7(0x1d0)]()||undefined,_0x50ea54=_0x18a518['site']||_0x467df7(0x1a1),_0x43f174=await promptSiteSelection(_0x50ea54,_0x9080b,_0x467df7(0x1bc));if(!_0x43f174)return 0x1;const _0x5645dc=resolveSite(_0x43f174);if(isOAuthSupported(_0x5645dc)){const _0x4a3fa3=await a31_0x51f12d({'type':_0x467df7(0x17f),'name':_0x467df7(0x179),'message':_0x467df7(0x196),'choices':[{'title':_0x467df7(0x19f),'value':_0x467df7(0x19c)},{'title':'API\x20Key','value':_0x467df7(0x1c5)}]});if(!_0x4a3fa3[_0x467df7(0x179)])return console[_0x467df7(0x192)]('\x0aSetup\x20cancelled'),0x1;if(_0x4a3fa3[_0x467df7(0x179)]==='oauth'){if(_0x5b7749){const _0xb72499={'site':_0x5645dc,'description':_0x5b7749};saveProfileToUserConfig(_0x9080b,_0xb72499);}return await runOAuthLoginFlow(_0x5645dc,_0x9080b,_0x18a518['logLevel']??LogLevel['ERROR']),0x0;}}console[_0x467df7(0x192)](_0x467df7(0x1d5)+_0x5645dc),console[_0x467df7(0x192)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x5645dc,_0x467df7(0x1a5)));const _0x19e003=await a31_0x51f12d({'type':'password','name':_0x467df7(0x1d2),'message':_0x467df7(0x1a9),'validate':_0x47f95c=>{const _0x21ea84=_0x467df7;if(!_0x47f95c||!_0x47f95c[_0x21ea84(0x1d0)]())return _0x21ea84(0x1b3);return!![];}});if(!_0x19e003[_0x467df7(0x1d2)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x535c70=_0x19e003[_0x467df7(0x1d2)];console[_0x467df7(0x192)](_0x467df7(0x1c9));try{const _0x48bdcb=TDX[_0x467df7(0x190)]({'site':_0x5645dc,'apiKey':_0x535c70[_0x467df7(0x1d0)](),'logLevel':_0x18a518[_0x467df7(0x1cf)]??LogLevel[_0x467df7(0x1a6)]}),_0x4dcf49=await _0x48bdcb[_0x467df7(0x188)][_0x467df7(0x180)]();console['log'](a31_0x272002['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4dcf49['email']+')');const _0x126a7c=await isKeychainAvailable();_0x126a7c?(await saveAPIKeyAsync(_0x535c70['trim'](),_0x5645dc,_0x9080b),console[_0x467df7(0x192)](a31_0x272002[_0x467df7(0x1ad)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x9080b+')')):(console[_0x467df7(0x195)](a31_0x272002[_0x467df7(0x198)](_0x467df7(0x1bd))),console[_0x467df7(0x195)](a31_0x272002[_0x467df7(0x198)](_0x467df7(0x1d1))));const _0x57271d={'site':_0x5645dc,..._0x5b7749&&{'description':_0x5b7749}};return saveProfileToUserConfig(_0x9080b,_0x57271d),console[_0x467df7(0x192)](a31_0x272002['green']('✓')+_0x467df7(0x18e)+_0x9080b+'\x27\x20created'),console[_0x467df7(0x192)](),console[_0x467df7(0x192)](_0x467df7(0x1c8)),console[_0x467df7(0x192)](_0x467df7(0x183)+_0x9080b+_0x467df7(0x191)),console[_0x467df7(0x192)](_0x467df7(0x183)+_0x9080b+_0x467df7(0x17b)),0x0;}catch(_0x203370){if(_0x203370 instanceof HTTPClientError&&_0x203370[_0x467df7(0x19b)]===0x191)return printAuthError(_0x203370),0x1;return console[_0x467df7(0x1b5)](a31_0x272002['red'](_0x467df7(0x1b6)+(_0x203370 instanceof Error?_0x203370['message']:String(_0x203370)))),console[_0x467df7(0x1b5)](_0x467df7(0x1cb)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0xf5a616(0x1af)]=a31_0xf5a616(0x1d8);[a31_0xf5a616(0x18d)]='Remove\x20a\x20profile';[a31_0xf5a616(0x18a)](_0x218154){const _0x426595=a31_0xf5a616,{args:_0x884e4c}=_0x218154;if(_0x884e4c[_0x426595(0x187)]===0x0)return _0x426595(0x17d);return undefined;}async[a31_0xf5a616(0x177)](_0x44942e){const _0x5eef73=a31_0xf5a616,{args:_0x5ea681}=_0x44942e,_0x430bce=_0x5ea681[0x0];console[_0x5eef73(0x192)](a31_0x272002[_0x5eef73(0x189)](_0x5eef73(0x1aa)));if(!profileExists(_0x430bce)){console[_0x5eef73(0x1b5)](a31_0x272002[_0x5eef73(0x1c3)](_0x5eef73(0x186)+_0x430bce+'\x27\x20does\x20not\x20exist.')),console[_0x5eef73(0x192)](_0x5eef73(0x185));const _0x207483=listProfiles();if(_0x207483[_0x5eef73(0x187)]===0x0)console[_0x5eef73(0x192)](_0x5eef73(0x1b8));else for(const _0x14793e of _0x207483){console[_0x5eef73(0x192)](_0x5eef73(0x1a8)+_0x14793e[_0x5eef73(0x1af)]);}return 0x1;}const _0x14a6c2=await a31_0x51f12d({'type':_0x5eef73(0x1b7),'name':_0x5eef73(0x1b7),'message':_0x5eef73(0x1ae)+_0x430bce+'\x27?','initial':![]});if(!_0x14a6c2[_0x5eef73(0x1b7)])return console[_0x5eef73(0x192)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x430bce),console[_0x5eef73(0x192)](a31_0x272002['green']('✓')+_0x5eef73(0x18e)+_0x430bce+_0x5eef73(0x178));}catch(_0x2bed01){return console[_0x5eef73(0x1b5)](a31_0x272002['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x2bed01 instanceof Error?_0x2bed01[_0x5eef73(0x1a3)]:String(_0x2bed01)))),0x1;}const _0x25f6db=await isKeychainAvailable();if(_0x25f6db){const _0x4097cc=await deleteKeychainAPIKey(_0x430bce);_0x4097cc&&console['log'](a31_0x272002[_0x5eef73(0x1ad)]('✓')+_0x5eef73(0x1d4));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0xf5a616(0x1af)]=a31_0xf5a616(0x1a0);[a31_0xf5a616(0x18d)]=a31_0xf5a616(0x19e);static ['VALID_KEYS']=[a31_0xf5a616(0x194),'database','parent_segment',a31_0xf5a616(0x174),'llm_agent',a31_0xf5a616(0x18d)];['validate'](_0x531437){const _0x3bb666=a31_0xf5a616,{args:_0x15e23d,options:_0x307cc9}=_0x531437,_0x337c79=_0x307cc9[_0x3bb666(0x17c)]||getActiveProfile();if(!_0x337c79)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(_0x15e23d['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0x480de4=_0x15e23d[0x0];if(!_0x480de4[_0x3bb666(0x18f)]('='))return _0x3bb666(0x1b1)+ProfileSetCommand['VALID_KEYS'][_0x3bb666(0x1cd)](',\x20');const [_0x5ec6ab]=_0x480de4[_0x3bb666(0x199)]('=',0x2);if(!ProfileSetCommand[_0x3bb666(0x1a7)][_0x3bb666(0x18f)](_0x5ec6ab))return _0x3bb666(0x17e)+_0x5ec6ab+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3bb666(0x1a7)][_0x3bb666(0x1cd)](',\x20');return undefined;}async[a31_0xf5a616(0x177)](_0x1c95c3){const _0x4d24c7=a31_0xf5a616,{args:_0x303352,options:_0x1ad94f}=_0x1c95c3,_0x416dc4=_0x1ad94f['profile']||getActiveProfile(),[_0x341405,..._0x293056]=_0x303352[0x0][_0x4d24c7(0x199)]('='),_0x3bb4cd=_0x293056[_0x4d24c7(0x1cd)]('=');console[_0x4d24c7(0x192)](a31_0x272002[_0x4d24c7(0x189)](_0x4d24c7(0x19a)));if(!profileExists(_0x416dc4)){const _0x17d019=await a31_0x51f12d({'type':_0x4d24c7(0x1b7),'name':'create','message':'Profile\x20\x27'+_0x416dc4+_0x4d24c7(0x1b2),'initial':!![]});if(!_0x17d019[_0x4d24c7(0x190)])return console[_0x4d24c7(0x192)]('Operation\x20cancelled'),0x1;}const _0x30195=loadProfile(_0x416dc4),_0x1ab601=_0x30195?.[_0x4d24c7(0x1ba)]||{};if(_0x341405===_0x4d24c7(0x194)){const _0x301f6e=resolveSite(_0x3bb4cd);console[_0x4d24c7(0x192)](_0x4d24c7(0x18c)+_0x301f6e+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x4d24c7(0x192)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4d24c7(0x192)]('\x20\x20'+getConsoleUrl(_0x301f6e,'/app/mp/ak'));const _0x287502=await a31_0x51f12d({'type':_0x4d24c7(0x1d6),'name':'apiKey','message':_0x4d24c7(0x1bf),'validate':_0x55f369=>{const _0x2d1328=_0x4d24c7;if(!_0x55f369||!_0x55f369[_0x2d1328(0x1d0)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x287502[_0x4d24c7(0x1d2)])return console[_0x4d24c7(0x192)](_0x4d24c7(0x197)),0x1;console[_0x4d24c7(0x192)](_0x4d24c7(0x1c9));try{const _0x54d60b=TDX[_0x4d24c7(0x190)]({'site':_0x301f6e,'apiKey':_0x287502[_0x4d24c7(0x1d2)]['trim'](),'logLevel':_0x1ad94f[_0x4d24c7(0x1cf)]??LogLevel[_0x4d24c7(0x1a6)]}),_0x48bf9c=await _0x54d60b[_0x4d24c7(0x188)]['getUserInfo']();console[_0x4d24c7(0x192)](a31_0x272002[_0x4d24c7(0x1ad)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x48bf9c[_0x4d24c7(0x1b9)]+')');const _0x36fb5d=await isKeychainAvailable();_0x36fb5d?(await saveAPIKeyAsync(_0x287502[_0x4d24c7(0x1d2)][_0x4d24c7(0x1d0)](),_0x301f6e,_0x416dc4),console[_0x4d24c7(0x192)](a31_0x272002['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x4d24c7(0x195)](a31_0x272002[_0x4d24c7(0x198)](_0x4d24c7(0x1bd))),_0x1ab601[_0x4d24c7(0x194)]=_0x301f6e;}catch(_0x48b25d){if(_0x48b25d instanceof HTTPClientError&&_0x48b25d[_0x4d24c7(0x19b)]===0x191)return printAuthError(_0x48b25d),0x1;return console[_0x4d24c7(0x1b5)](a31_0x272002['red'](_0x4d24c7(0x1b6)+(_0x48b25d instanceof Error?_0x48b25d[_0x4d24c7(0x1a3)]:String(_0x48b25d)))),console[_0x4d24c7(0x1b5)](_0x4d24c7(0x1bb)),0x1;}}else _0x1ab601[_0x341405]=_0x3bb4cd||undefined;return saveProfileToUserConfig(_0x416dc4,_0x1ab601),console[_0x4d24c7(0x192)](a31_0x272002[_0x4d24c7(0x1ad)]('✓')+'\x20Profile\x20\x27'+_0x416dc4+_0x4d24c7(0x18b)+_0x341405+'='+(_0x3bb4cd||_0x4d24c7(0x1c1))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0xf5a616(0x1af)]=a31_0xf5a616(0x1be);['description']=a31_0xf5a616(0x175);[a31_0xf5a616(0x18a)](_0x2547e2){const _0x3df4c6=a31_0xf5a616,{args:_0x3929a0}=_0x2547e2;if(_0x3929a0[_0x3df4c6(0x187)]===0x0)return _0x3df4c6(0x1d3);return undefined;}async['execute'](_0x26294a){const _0xc96e44=a31_0xf5a616,{args:_0x526039,options:_0x279f04}=_0x26294a,_0x4dd2dd=_0x526039[0x0],_0x25f23e=_0x279f04['default'];cleanExpiredSessions();if(!profileExists(_0x4dd2dd)){console[_0xc96e44(0x1b5)](a31_0x272002[_0xc96e44(0x1c3)](_0xc96e44(0x186)+_0x4dd2dd+_0xc96e44(0x1cc))),console['log'](_0xc96e44(0x185));const _0x5e22dc=listProfiles();if(_0x5e22dc[_0xc96e44(0x187)]===0x0)console['log'](_0xc96e44(0x1b8));else for(const _0x4cf81c of _0x5e22dc){console[_0xc96e44(0x192)]('\x20\x20-\x20'+_0x4cf81c['name']);}return 0x1;}if(_0x25f23e){const _0x2be89c=a31_0x1f91b8[_0xc96e44(0x1cd)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x4dd2dd),console['log']('Default\x20profile\x20set\x20to:\x20'+a31_0x272002[_0xc96e44(0x1ad)](_0x4dd2dd)),console['log'](a31_0x272002['dim'](_0xc96e44(0x1b0)+_0x2be89c)),0x0;}const _0x2d5632=getSessionID(_0x279f04[_0xc96e44(0x1ac)]);return saveSessionContext({'profile':_0x4dd2dd},_0x279f04[_0xc96e44(0x1ac)]),console[_0xc96e44(0x192)]('Session\x20profile\x20set\x20to:\x20'+a31_0x272002[_0xc96e44(0x1ad)](_0x4dd2dd)+'\x20'+a31_0x272002[_0xc96e44(0x19d)](_0xc96e44(0x17a)+_0x2d5632+')')),console['log'](a31_0x272002['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4dd2dd+_0xc96e44(0x1c7))),0x0;}}
|
|
1
|
+
const a31_0x1f65e9=a31_0x7f09;(function(_0x3a15d3,_0x4996ba){const _0x123d43=a31_0x7f09,_0xb031fa=_0x3a15d3();while(!![]){try{const _0x158b43=-parseInt(_0x123d43(0x159))/0x1*(parseInt(_0x123d43(0x154))/0x2)+-parseInt(_0x123d43(0x135))/0x3*(-parseInt(_0x123d43(0x148))/0x4)+-parseInt(_0x123d43(0x138))/0x5*(parseInt(_0x123d43(0x165))/0x6)+-parseInt(_0x123d43(0x15b))/0x7+-parseInt(_0x123d43(0x16d))/0x8+parseInt(_0x123d43(0x156))/0x9*(-parseInt(_0x123d43(0x17e))/0xa)+parseInt(_0x123d43(0x140))/0xb;if(_0x158b43===_0x4996ba)break;else _0xb031fa['push'](_0xb031fa['shift']());}catch(_0x42868f){_0xb031fa['push'](_0xb031fa['shift']());}}}(a31_0xc83d,0xd6961));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a31_0xc83d(){const _0x35ef4d=['\x20\x20(no\x20profiles\x20found)','Enter\x20profile\x20name:','yellow','3492582pKBqQF','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','✗\x20Validation\x20failed:\x20','19295cBumRl','\x20API\x20key\x20removed\x20from\x20system\x20keychain','getUserInfo','session','ERROR','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','profile','\x20\x20tdx\x20--profile\x20','54246104sljqVr','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','warn','(session:\x20','trim','confirm','\x0aSetup\x20cancelled','\x27\x20does\x20not\x20exist.','4cGUWnx','profile:create','password','\x20\x20-\x20','method','Validating\x20API\x20key...','Create\x20a\x20new\x20profile','create','tdx:\x20profile\x20create','parent_segment','red','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','2429646VBCVRe','Failed\x20to\x20remove\x20profile:\x20','9NWsDhn','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x0aSaved\x20to:\x20','1XLAlXy','\x27\x20removed\x20from\x20configuration','5276810XTnFfu','\x20Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Changing\x20site\x20to\x20\x27','\x27\x20requires\x20API\x20key\x20validation.','Default\x20profile\x20set\x20to:\x20','test','\x20--default\x27\x20to\x20save\x20permanently','profile:remove','llm_project','1698IqEMPZ','\x27\x20does\x20not\x20exist.\x20Create\x20it?','config','llm_agent','length','logLevel','us01','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','10641616eNkRev','log','\x27\x20created','default','VALID_KEYS','/app/mp/ak','jobs','email','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile:use','Unknown\x20key\x20\x27','You\x20can\x20find\x20your\x20API\x20key\x20at:','includes','API\x20Key','(cleared)','dim','tdx.json','8257610uIzeIx','Profile\x20name\x20cannot\x20be\x20empty','Enter\x20your\x20TD\x20API\x20key:','apikey','Setup\x20cancelled','description','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','profileName','green','select','profile:set','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20API\x20key\x20is\x20valid\x20(User:\x20','database','Set\x20a\x20profile\x20configuration\x20value','oauth','message','split','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','tdx:\x20profile\x20remove','apiKey','bold','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aAvailable\x20profiles:','\x0aOperation\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','status','validate','Profile\x20\x27','Choose\x20authentication\x20method:','name','error','join','\x27\x20updated:\x20','site','OAuth\x20(browser\x20login)','text','Session\x20profile\x20set\x20to:\x20'];a31_0xc83d=function(){return _0x35ef4d;};return a31_0xc83d();}import{getConfigDir}from'../core/config.js';import*as a31_0x4070e7 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a31_0x7f09(_0x341c4e,_0xa3cd0f){_0x341c4e=_0x341c4e-0x10e;const _0xc83d41=a31_0xc83d();let _0x7f090f=_0xc83d41[_0x341c4e];return _0x7f090f;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x45d6f6 from'prompts';import a31_0x1e8b91 from'chalk';function validateProfileName(_0xa744eb){const _0x39d49a=a31_0x7f09;if(!_0xa744eb||!_0xa744eb['trim']())return _0x39d49a(0x17f);const _0x4509c9=_0xa744eb['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x39d49a(0x161)](_0x4509c9))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x4509c9))return _0x39d49a(0x128)+_0x4509c9+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x1f65e9(0x12a)]=a31_0x1f65e9(0x149);[a31_0x1f65e9(0x110)]=a31_0x1f65e9(0x14e);async['execute'](_0x5ce4bd){const _0x3a2ce6=a31_0x1f65e9,{options:_0x36930b,args:_0x4ecc16}=_0x5ce4bd;console[_0x3a2ce6(0x16e)](a31_0x1e8b91[_0x3a2ce6(0x121)](_0x3a2ce6(0x150)));let _0xe6364e;if(_0x4ecc16[_0x3a2ce6(0x169)]>0x0&&_0x4ecc16[0x0]){const _0xbb3dd4=_0x4ecc16[0x0]['trim'](),_0x144a2e=validateProfileName(_0xbb3dd4);if(_0x144a2e!==!![])return console[_0x3a2ce6(0x12b)](a31_0x1e8b91['red'](_0x144a2e)),0x1;_0xe6364e=_0xbb3dd4;}else{const _0x11d49b=await a31_0x45d6f6({'type':_0x3a2ce6(0x130),'name':_0x3a2ce6(0x112),'message':_0x3a2ce6(0x133),'validate':validateProfileName});if(!_0x11d49b[_0x3a2ce6(0x112)])return console['log'](_0x3a2ce6(0x146)),0x1;_0xe6364e=_0x11d49b[_0x3a2ce6(0x112)][_0x3a2ce6(0x144)]();}const _0x123a56=await a31_0x45d6f6({'type':_0x3a2ce6(0x130),'name':_0x3a2ce6(0x110),'message':'Enter\x20description\x20(optional):'}),_0x1b4a4e=_0x123a56['description']?.['trim']()||undefined,_0x345f7e=_0x36930b['site']||_0x3a2ce6(0x16b),_0x38a131=await promptSiteSelection(_0x345f7e,_0xe6364e,_0x3a2ce6(0x10f));if(!_0x38a131)return 0x1;const _0x22397c=resolveSite(_0x38a131);if(isOAuthSupported(_0x22397c)){const _0xb01541=await a31_0x45d6f6({'type':_0x3a2ce6(0x114),'name':_0x3a2ce6(0x14c),'message':_0x3a2ce6(0x129),'choices':[{'title':_0x3a2ce6(0x12f),'value':_0x3a2ce6(0x11a)},{'title':_0x3a2ce6(0x17a),'value':_0x3a2ce6(0x10e)}]});if(!_0xb01541['method'])return console[_0x3a2ce6(0x16e)]('\x0aSetup\x20cancelled'),0x1;if(_0xb01541[_0x3a2ce6(0x14c)]==='oauth'){if(_0x1b4a4e){const _0x510ad0={'site':_0x22397c,'description':_0x1b4a4e};saveProfileToUserConfig(_0xe6364e,_0x510ad0);}return await runOAuthLoginFlow(_0x22397c,_0xe6364e,_0x36930b[_0x3a2ce6(0x16a)]??LogLevel[_0x3a2ce6(0x13c)]),0x0;}}console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x153)+_0x22397c),console['log'](_0x3a2ce6(0x178)),console['log']('\x20\x20'+getConsoleUrl(_0x22397c,'/app/mp/ak'));const _0x5cd6f2=await a31_0x45d6f6({'type':_0x3a2ce6(0x14a),'name':_0x3a2ce6(0x120),'message':_0x3a2ce6(0x180),'validate':_0x38cbf1=>{const _0xd202ca=_0x3a2ce6;if(!_0x38cbf1||!_0x38cbf1[_0xd202ca(0x144)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5cd6f2[_0x3a2ce6(0x120)])return console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x146)),0x1;const _0x228d97=_0x5cd6f2[_0x3a2ce6(0x120)];console['log']('Validating\x20API\x20key...');try{const _0xd634d8=TDX[_0x3a2ce6(0x14f)]({'site':_0x22397c,'apiKey':_0x228d97[_0x3a2ce6(0x144)](),'logLevel':_0x36930b[_0x3a2ce6(0x16a)]??LogLevel[_0x3a2ce6(0x13c)]}),_0x252058=await _0xd634d8[_0x3a2ce6(0x173)][_0x3a2ce6(0x13a)]();console[_0x3a2ce6(0x16e)](a31_0x1e8b91['green']('✓')+_0x3a2ce6(0x117)+_0x252058[_0x3a2ce6(0x174)]+')');const _0x3ce82e=await isKeychainAvailable();_0x3ce82e?(await saveAPIKeyAsync(_0x228d97[_0x3a2ce6(0x144)](),_0x22397c,_0xe6364e),console[_0x3a2ce6(0x16e)](a31_0x1e8b91[_0x3a2ce6(0x113)]('✓')+_0x3a2ce6(0x13d)+_0xe6364e+')')):(console[_0x3a2ce6(0x142)](a31_0x1e8b91[_0x3a2ce6(0x134)](_0x3a2ce6(0x125))),console[_0x3a2ce6(0x142)](a31_0x1e8b91[_0x3a2ce6(0x134)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x48a869={'site':_0x22397c,..._0x1b4a4e&&{'description':_0x1b4a4e}};return saveProfileToUserConfig(_0xe6364e,_0x48a869),console[_0x3a2ce6(0x16e)](a31_0x1e8b91[_0x3a2ce6(0x113)]('✓')+'\x20Profile\x20\x27'+_0xe6364e+_0x3a2ce6(0x16f)),console[_0x3a2ce6(0x16e)](),console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x15d)),console['log']('\x20\x20tdx\x20--profile\x20'+_0xe6364e+_0x3a2ce6(0x157)),console[_0x3a2ce6(0x16e)](_0x3a2ce6(0x13f)+_0xe6364e+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x5a765a){if(_0x5a765a instanceof HTTPClientError&&_0x5a765a['status']===0x191)return printAuthError(_0x5a765a),0x1;return console[_0x3a2ce6(0x12b)](a31_0x1e8b91[_0x3a2ce6(0x152)](_0x3a2ce6(0x137)+(_0x5a765a instanceof Error?_0x5a765a[_0x3a2ce6(0x11b)]:String(_0x5a765a)))),console[_0x3a2ce6(0x12b)](_0x3a2ce6(0x111)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a31_0x1f65e9(0x163);[a31_0x1f65e9(0x110)]='Remove\x20a\x20profile';[a31_0x1f65e9(0x127)](_0x962bc1){const _0x508e6f=a31_0x1f65e9,{args:_0x96fca4}=_0x962bc1;if(_0x96fca4[_0x508e6f(0x169)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a31_0x1f65e9(0x11d)](_0x1f7575){const _0x2a43b7=a31_0x1f65e9,{args:_0x5e1e6d}=_0x1f7575,_0x315b0d=_0x5e1e6d[0x0];console['log'](a31_0x1e8b91[_0x2a43b7(0x121)](_0x2a43b7(0x11f)));if(!profileExists(_0x315b0d)){console[_0x2a43b7(0x12b)](a31_0x1e8b91[_0x2a43b7(0x152)](_0x2a43b7(0x128)+_0x315b0d+_0x2a43b7(0x147))),console[_0x2a43b7(0x16e)](_0x2a43b7(0x123));const _0x1ff239=listProfiles();if(_0x1ff239[_0x2a43b7(0x169)]===0x0)console[_0x2a43b7(0x16e)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x162608 of _0x1ff239){console[_0x2a43b7(0x16e)](_0x2a43b7(0x14b)+_0x162608[_0x2a43b7(0x12a)]);}return 0x1;}const _0x2494e1=await a31_0x45d6f6({'type':'confirm','name':_0x2a43b7(0x145),'message':_0x2a43b7(0x136)+_0x315b0d+'\x27?','initial':![]});if(!_0x2494e1[_0x2a43b7(0x145)])return console[_0x2a43b7(0x16e)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x315b0d),console['log'](a31_0x1e8b91['green']('✓')+_0x2a43b7(0x15c)+_0x315b0d+_0x2a43b7(0x15a));}catch(_0x573813){return console[_0x2a43b7(0x12b)](a31_0x1e8b91['red'](_0x2a43b7(0x155)+(_0x573813 instanceof Error?_0x573813[_0x2a43b7(0x11b)]:String(_0x573813)))),0x1;}const _0x1e70c1=await isKeychainAvailable();if(_0x1e70c1){const _0x1cda1c=await deleteKeychainAPIKey(_0x315b0d);_0x1cda1c&&console[_0x2a43b7(0x16e)](a31_0x1e8b91[_0x2a43b7(0x113)]('✓')+_0x2a43b7(0x139));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0x1f65e9(0x12a)]=a31_0x1f65e9(0x115);[a31_0x1f65e9(0x110)]=a31_0x1f65e9(0x119);static [a31_0x1f65e9(0x171)]=[a31_0x1f65e9(0x12e),a31_0x1f65e9(0x118),a31_0x1f65e9(0x151),a31_0x1f65e9(0x164),a31_0x1f65e9(0x168),a31_0x1f65e9(0x110)];[a31_0x1f65e9(0x127)](_0x2b2165){const _0x3d104e=a31_0x1f65e9,{args:_0x376513,options:_0x181114}=_0x2b2165,_0x1580d2=_0x181114[_0x3d104e(0x13e)]||getActiveProfile();if(!_0x1580d2)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(_0x376513['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3d104e(0x171)][_0x3d104e(0x12c)](',\x20');const _0x15f1ea=_0x376513[0x0];if(!_0x15f1ea[_0x3d104e(0x179)]('='))return _0x3d104e(0x122)+ProfileSetCommand[_0x3d104e(0x171)][_0x3d104e(0x12c)](',\x20');const [_0x29a0b3]=_0x15f1ea['split']('=',0x2);if(!ProfileSetCommand[_0x3d104e(0x171)][_0x3d104e(0x179)](_0x29a0b3))return _0x3d104e(0x177)+_0x29a0b3+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3d104e(0x171)]['join'](',\x20');return undefined;}async[a31_0x1f65e9(0x11d)](_0x2c5a2c){const _0x2373eb=a31_0x1f65e9,{args:_0x491ff7,options:_0x2ccb36}=_0x2c5a2c,_0x2494bc=_0x2ccb36[_0x2373eb(0x13e)]||getActiveProfile(),[_0x54ccef,..._0xa59d55]=_0x491ff7[0x0][_0x2373eb(0x11c)]('='),_0xba41b7=_0xa59d55[_0x2373eb(0x12c)]('=');console[_0x2373eb(0x16e)](a31_0x1e8b91[_0x2373eb(0x121)]('tdx:\x20profile\x20set'));if(!profileExists(_0x2494bc)){const _0x4207b5=await a31_0x45d6f6({'type':_0x2373eb(0x145),'name':_0x2373eb(0x14f),'message':_0x2373eb(0x128)+_0x2494bc+_0x2373eb(0x166),'initial':!![]});if(!_0x4207b5[_0x2373eb(0x14f)])return console[_0x2373eb(0x16e)]('Operation\x20cancelled'),0x1;}const _0x3f1e44=loadProfile(_0x2494bc),_0x449c7c=_0x3f1e44?.[_0x2373eb(0x167)]||{};if(_0x54ccef===_0x2373eb(0x12e)){const _0x5a24e9=resolveSite(_0xba41b7);console[_0x2373eb(0x16e)](_0x2373eb(0x15e)+_0x5a24e9+_0x2373eb(0x15f)),console[_0x2373eb(0x16e)](_0x2373eb(0x16c)),console[_0x2373eb(0x16e)]('\x20\x20'+getConsoleUrl(_0x5a24e9,_0x2373eb(0x172)));const _0x848a73=await a31_0x45d6f6({'type':_0x2373eb(0x14a),'name':'apiKey','message':_0x2373eb(0x175),'validate':_0x4a3db7=>{const _0x5e66ee=_0x2373eb;if(!_0x4a3db7||!_0x4a3db7[_0x5e66ee(0x144)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x848a73[_0x2373eb(0x120)])return console[_0x2373eb(0x16e)](_0x2373eb(0x124)),0x1;console[_0x2373eb(0x16e)](_0x2373eb(0x14d));try{const _0x2e8c14=TDX['create']({'site':_0x5a24e9,'apiKey':_0x848a73['apiKey'][_0x2373eb(0x144)](),'logLevel':_0x2ccb36[_0x2373eb(0x16a)]??LogLevel['ERROR']}),_0x43bb64=await _0x2e8c14[_0x2373eb(0x173)][_0x2373eb(0x13a)]();console[_0x2373eb(0x16e)](a31_0x1e8b91[_0x2373eb(0x113)]('✓')+_0x2373eb(0x117)+_0x43bb64[_0x2373eb(0x174)]+')');const _0x298d35=await isKeychainAvailable();_0x298d35?(await saveAPIKeyAsync(_0x848a73[_0x2373eb(0x120)]['trim'](),_0x5a24e9,_0x2494bc),console[_0x2373eb(0x16e)](a31_0x1e8b91['green']('✓')+_0x2373eb(0x116))):console[_0x2373eb(0x142)](a31_0x1e8b91['yellow'](_0x2373eb(0x125))),_0x449c7c[_0x2373eb(0x12e)]=_0x5a24e9;}catch(_0x23e720){if(_0x23e720 instanceof HTTPClientError&&_0x23e720[_0x2373eb(0x126)]===0x191)return printAuthError(_0x23e720),0x1;return console['error'](a31_0x1e8b91[_0x2373eb(0x152)](_0x2373eb(0x137)+(_0x23e720 instanceof Error?_0x23e720[_0x2373eb(0x11b)]:String(_0x23e720)))),console[_0x2373eb(0x12b)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x449c7c[_0x54ccef]=_0xba41b7||undefined;return saveProfileToUserConfig(_0x2494bc,_0x449c7c),console[_0x2373eb(0x16e)](a31_0x1e8b91[_0x2373eb(0x113)]('✓')+'\x20Profile\x20\x27'+_0x2494bc+_0x2373eb(0x12d)+_0x54ccef+'='+(_0xba41b7||_0x2373eb(0x17b))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a31_0x1f65e9(0x176);[a31_0x1f65e9(0x110)]='Set\x20session\x20profile';[a31_0x1f65e9(0x127)](_0x51f5ed){const _0x55ce44=a31_0x1f65e9,{args:_0x10b617}=_0x51f5ed;if(_0x10b617[_0x55ce44(0x169)]===0x0)return _0x55ce44(0x11e);return undefined;}async['execute'](_0x2abc42){const _0x387d2f=a31_0x1f65e9,{args:_0x355e00,options:_0x216e2b}=_0x2abc42,_0x571895=_0x355e00[0x0],_0x2b62f1=_0x216e2b[_0x387d2f(0x170)];cleanExpiredSessions();if(!profileExists(_0x571895)){console['error'](a31_0x1e8b91[_0x387d2f(0x152)]('Profile\x20\x27'+_0x571895+_0x387d2f(0x147))),console['log'](_0x387d2f(0x123));const _0x118fb6=listProfiles();if(_0x118fb6['length']===0x0)console[_0x387d2f(0x16e)](_0x387d2f(0x132));else for(const _0x50f202 of _0x118fb6){console[_0x387d2f(0x16e)](_0x387d2f(0x14b)+_0x50f202[_0x387d2f(0x12a)]);}return 0x1;}if(_0x2b62f1){const _0xadf436=a31_0x4070e7[_0x387d2f(0x12c)](getConfigDir(),_0x387d2f(0x17d));return saveActiveProfileToUserConfig(_0x571895),console[_0x387d2f(0x16e)](_0x387d2f(0x160)+a31_0x1e8b91['green'](_0x571895)),console[_0x387d2f(0x16e)](a31_0x1e8b91[_0x387d2f(0x17c)](_0x387d2f(0x158)+_0xadf436)),0x0;}const _0x3cedab=getSessionID(_0x216e2b[_0x387d2f(0x13b)]);return saveSessionContext({'profile':_0x571895},_0x216e2b[_0x387d2f(0x13b)]),console['log'](_0x387d2f(0x131)+a31_0x1e8b91[_0x387d2f(0x113)](_0x571895)+'\x20'+a31_0x1e8b91[_0x387d2f(0x17c)](_0x387d2f(0x143)+_0x3cedab+')')),console['log'](a31_0x1e8b91[_0x387d2f(0x17c)](_0x387d2f(0x141)+_0x571895+_0x387d2f(0x162))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a32_0x3eaa12=a32_0x130b;(function(_0xddc0be,_0x28fd42){const _0x261498=a32_0x130b,_0x6f6628=_0xddc0be();while(!![]){try{const _0x33fc5f=-parseInt(_0x261498(0x1f1))/0x1+parseInt(_0x261498(0x1e3))/0x2+parseInt(_0x261498(0x1dd))/0x3*(parseInt(_0x261498(0x1f7))/0x4)+parseInt(_0x261498(0x1ef))/0x5*(-parseInt(_0x261498(0x1f4))/0x6)+-parseInt(_0x261498(0x1ea))/0x7*(parseInt(_0x261498(0x1e1))/0x8)+-parseInt(_0x261498(0x1e8))/0x9+-parseInt(_0x261498(0x1ec))/0xa*(-parseInt(_0x261498(0x1e2))/0xb);if(_0x33fc5f===_0x28fd42)break;else _0x6f6628['push'](_0x6f6628['shift']());}catch(_0x3fd081){_0x6f6628['push'](_0x6f6628['shift']());}}}(a32_0x222f,0x8ec25));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x130b(_0x543e2f,_0x4ee742){_0x543e2f=_0x543e2f-0x1db;const _0x222f63=a32_0x222f();let _0x130b0d=_0x222f63[_0x543e2f];return _0x130b0d;}function a32_0x222f(){const _0x163bfd=['message','10243161wrAcnF','👤\x20','14lXbhSR','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','58270rUnLxY','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','error','30iVGxKG','length','556738CYJtYx','Error:\x20','name','430374kzYCLW','log','config','3983212HFcvdG','site','execute','profiles','3ISJxvC','description','List\x20all\x20available\x20profiles','scope','936512kujadK','3487XPbqCL','202296LJbqAk','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','dim'];a32_0x222f=function(){return _0x163bfd;};return a32_0x222f();}import a32_0x407043 from'chalk';export class ProfilesCommand extends BaseCommand{['name']=a32_0x3eaa12(0x1dc);['description']=a32_0x3eaa12(0x1df);async[a32_0x3eaa12(0x1db)](_0x14396e){const _0x28086b=a32_0x3eaa12,{options:_0x43a13b}=_0x14396e;try{const _0x4d5b70=listProfiles(),_0x4f8490=getActiveProfile();if(_0x4d5b70[_0x28086b(0x1f0)]===0x0)return console['log'](_0x28086b(0x1ed)),console[_0x28086b(0x1f5)](_0x28086b(0x1eb)),console['log'](_0x28086b(0x1e5)),0x0;const _0x19523a=_0x4d5b70[_0x28086b(0x1e4)](_0x521958=>{const _0xd0aec7=_0x28086b,_0x2f3413=_0x521958[_0xd0aec7(0x1f3)]===_0x4f8490,_0x4ba5e1=getProfileParams(_0x521958[_0xd0aec7(0x1f6)]);return{'name':_0x521958[_0xd0aec7(0x1f3)],'active':_0x2f3413,'scope':_0x521958[_0xd0aec7(0x1e0)],'description':_0x521958[_0xd0aec7(0x1f6)][_0xd0aec7(0x1de)]||'','params':_0x4ba5e1};});if(isStructuredFormat(_0x43a13b))await handleSDKOutput(_0x19523a,_0x43a13b);else for(const _0x1038cb of _0x4d5b70){const _0x5ed756=_0x1038cb[_0x28086b(0x1f3)]===_0x4f8490?a32_0x407043['green']('\x20✓'):'',_0x43e055=_0x1038cb[_0x28086b(0x1f6)][_0x28086b(0x1f8)]?a32_0x407043[_0x28086b(0x1e6)]('\x20'+_0x1038cb[_0x28086b(0x1f6)][_0x28086b(0x1f8)]):'',_0x17a6a8=_0x1038cb[_0x28086b(0x1f6)][_0x28086b(0x1de)]?a32_0x407043[_0x28086b(0x1e6)]('\x20\x20'+_0x1038cb[_0x28086b(0x1f6)][_0x28086b(0x1de)]):'';console[_0x28086b(0x1f5)](_0x28086b(0x1e9)+_0x1038cb['name']+_0x5ed756+_0x43e055+_0x17a6a8);}return 0x0;}catch(_0x144e68){return _0x144e68 instanceof Error&&console[_0x28086b(0x1ee)](_0x28086b(0x1f2)+_0x144e68[_0x28086b(0x1e7)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x5e1f0b=a33_0x3b87;(function(_0xca016a,_0x42bf36){const _0x508a6d=a33_0x3b87,_0x4b28d6=_0xca016a();while(!![]){try{const _0x5a506d=parseInt(_0x508a6d(0x204))/0x1+parseInt(_0x508a6d(0x1fc))/0x2+-parseInt(_0x508a6d(0x1fb))/0x3*(parseInt(_0x508a6d(0x206))/0x4)+-parseInt(_0x508a6d(0x200))/0x5*(-parseInt(_0x508a6d(0x1f0))/0x6)+-parseInt(_0x508a6d(0x202))/0x7*(parseInt(_0x508a6d(0x201))/0x8)+-parseInt(_0x508a6d(0x1f2))/0x9+parseInt(_0x508a6d(0x20f))/0xa;if(_0x5a506d===_0x42bf36)break;else _0x4b28d6['push'](_0x4b28d6['shift']());}catch(_0x1ea009){_0x4b28d6['push'](_0x4b28d6['shift']());}}}(a33_0x2030,0x6b8fc));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a33_0x3b87(_0x541a02,_0x570bd0){_0x541a02=_0x541a02-0x1e6;const _0x2030a6=a33_0x2030();let _0x3b875a=_0x2030a6[_0x541a02];return _0x3b875a;}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';function a33_0x2030(){const _0x3c0565=['No\x20SQL\x20provided','error','1374FvtJTs','site','1025307JprCZL','completedSplits','in\x20','\x20-\x20','elapsedTimeMillis','length','output','setPhase','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','3vrQIjU','1054162eqgBbj','execute','totalSplits','setJobId','2665gpUdCO','28216BeHLji','427uzPZvF','args','864602CPIJFt','verbose','3248864kZuSaR','database','options','Statement\x20','validate','Schema:\x20','Executing\x20statement\x20','message','...','681180qZOjZd','processedRows','\x20splits','stats','file','name','description','\x20[Job\x20ID:\x20','\x20rows\x20','Catalog:\x20','Error:\x20','query','jobId','state','Query\x20completed:\x20Processed\x20'];a33_0x2030=function(){return _0x3c0565;};return a33_0x2030();}export class QueryCommand extends BaseCommand{[a33_0x5e1f0b(0x214)]=a33_0x5e1f0b(0x1ea);[a33_0x5e1f0b(0x215)]='Run\x20Trino\x20queries\x20(streaming)';async[a33_0x5e1f0b(0x1fd)](_0x1029cb){const _0x56db60=a33_0x5e1f0b,{options:_0x9213be,args:_0xc33c71,tdx:_0x1d9c48}=_0x1029cb,_0x17a2b9={..._0x9213be,'limitStructuredFormats':!![]},_0x51406d=_0xc33c71[0x0],_0xb76e30=_0x9213be['file'];let _0x55f48b;try{if(_0xb76e30)_0x55f48b=readSqlStatementsFromFile(_0xb76e30);else{if(_0x51406d==='-')_0x55f48b=await readSqlStatementsFromStdin();else{if(_0x51406d&&isSqlFilePath(_0x51406d))_0x55f48b=readSqlStatementsFromFile(_0x51406d);else{if(_0x51406d)_0x55f48b=splitSqlStatements(_0x51406d);else throw new Error(_0x56db60(0x1ee));}}}}catch(_0x213d5f){return console[_0x56db60(0x1ef)](_0x56db60(0x1e9)+_0x213d5f[_0x56db60(0x20d)]),0x1;}const _0x19292f=_0x9213be[_0x56db60(0x207)]||'information_schema',_0x1486d0=_0x9213be['catalog'];try{const _0x26e9e4=[],_0xee72db=!!_0x9213be[_0x56db60(0x1f8)];for(let _0x1a40a7=0x0;_0x1a40a7<_0x55f48b['length'];_0x1a40a7++){const _0x444b34=_0x55f48b[_0x1a40a7],_0x19f4f8=_0x1a40a7+0x1,_0x4fdcdc=_0x55f48b[_0x56db60(0x1f7)],_0x2df500=_0x4fdcdc>0x1;_0x9213be[_0x56db60(0x205)]&&(console[_0x56db60(0x1ef)]('\x0a'+(_0x2df500?'Statement\x20'+_0x19f4f8+'/'+_0x4fdcdc+':':'')),console[_0x56db60(0x1ef)]('Site:\x20'+_0x9213be[_0x56db60(0x1f1)]),console['error'](_0x56db60(0x1e8)+(_0x1486d0||'td')),console[_0x56db60(0x1ef)](_0x56db60(0x20b)+_0x19292f),console[_0x56db60(0x1ef)]('SQL:\x20'+_0x444b34));const _0x39f1cd=_0x2df500?_0x56db60(0x20c)+_0x19f4f8+'/'+_0x4fdcdc+_0x56db60(0x20e):'Executing\x20query...';try{const _0x502df1=await withProgressSpinner(_0x39f1cd,async _0x3b68b7=>{const _0x152ffa=_0x56db60,_0x5ae857=await _0x1d9c48[_0x152ffa(0x1ea)][_0x152ffa(0x1fd)](_0x444b34,{'catalog':_0x1486d0,'schema':_0x19292f,'onJobId':_0x589c89=>{const _0xc61bed=_0x152ffa;_0x3b68b7[_0xc61bed(0x1ff)](_0x589c89);},'onProgress':_0x1ab995=>{const _0x16fef7=_0x152ffa;_0x3b68b7[_0x16fef7(0x1f9)]('Executing\x20query\x20['+_0x1ab995[_0x16fef7(0x1ec)]+']'),_0x3b68b7['setExtra'](formatRows(_0x1ab995[_0x16fef7(0x210)])+_0x16fef7(0x1e7)+_0x1ab995[_0x16fef7(0x1f3)]+'/'+_0x1ab995[_0x16fef7(0x1fe)]+_0x16fef7(0x211));}});return _0x5ae857;},{'verbose':_0x9213be[_0x56db60(0x205)]}),_0x200b91=_0x502df1['data'],_0xa6976b=_0x200b91[_0x56db60(0x1eb)]?_0x56db60(0x1e6)+_0x200b91[_0x56db60(0x1eb)]+']':'',_0x35e1c1=_0x2df500?_0x56db60(0x209)+_0x19f4f8+'/'+_0x4fdcdc+_0x56db60(0x1f5):'';console[_0x56db60(0x1ef)]('✔\x20'+_0x35e1c1+_0x56db60(0x1ed)+formatRows(_0x200b91['stats'][_0x56db60(0x210)])+'\x20rows\x20'+(_0x56db60(0x1f4)+formatElapsed(_0x200b91[_0x56db60(0x212)][_0x56db60(0x1f6)])+_0xa6976b));if(_0x2df500&&_0xee72db){const _0x3c0722=resolveOutputOptions(_0x17a2b9),_0x25ac59=await formatQueryOutput(_0x200b91,_0x3c0722);_0x26e9e4['push'](_0x25ac59);}else await handleQueryOutput(_0x200b91,_0x17a2b9);}catch(_0x22409a){const _0x114aaa=_0x2df500?'Statement\x20'+_0x19f4f8+'/'+_0x4fdcdc+':\x0a':'',_0x28cf48=_0x22409a instanceof SDKError?_0x22409a['originalMessage']:_0x22409a[_0x56db60(0x20d)];return console[_0x56db60(0x1ef)](''+_0x114aaa+_0x28cf48),0x1;}}if(_0x55f48b['length']>0x1&&_0xee72db&&_0x26e9e4[_0x56db60(0x1f7)]>0x0){const _0x496169=_0x26e9e4['join']('\x0a');writeFileSync(_0x9213be['output'],_0x496169),console[_0x56db60(0x1ef)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x9213be['output']);}return 0x0;}catch(_0x1052fb){throw _0x1052fb;}}[a33_0x5e1f0b(0x20a)](_0x58d438){const _0x6324b0=a33_0x5e1f0b,_0x158683=_0x58d438[_0x6324b0(0x203)][0x0],_0x2c1171=_0x58d438[_0x6324b0(0x208)][_0x6324b0(0x213)];if(!_0x158683&&!_0x2c1171)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x158683&&_0x2c1171)return _0x6324b0(0x1fa);return undefined;}}
|