@treasuredata/tdx 2026.3.0 → 2026.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/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.d.ts +4 -4
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/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 a29_0x406eed=a29_0x4dab;(function(_0x5b4b30,_0x6d6abb){const _0x4f0cf2=a29_0x4dab,_0xc75114=_0x5b4b30();while(!![]){try{const _0x2d9b43=parseInt(_0x4f0cf2(0x1a7))/0x1+parseInt(_0x4f0cf2(0x1c9))/0x2+parseInt(_0x4f0cf2(0x15c))/0x3*(parseInt(_0x4f0cf2(0x1a8))/0x4)+parseInt(_0x4f0cf2(0x224))/0x5+parseInt(_0x4f0cf2(0x1a5))/0x6+-parseInt(_0x4f0cf2(0x1e5))/0x7+-parseInt(_0x4f0cf2(0x1fd))/0x8;if(_0x2d9b43===_0x6d6abb)break;else _0xc75114['push'](_0xc75114['shift']());}catch(_0x2c65ab){_0xc75114['push'](_0xc75114['shift']());}}}(a29_0x480a,0x4d0dc));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x6593f4 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 a29_0x4372dd 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=a29_0x406eed(0x186),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x2383dc){const _0x2e72be=a29_0x406eed,_0x22d1c4=process['platform'],_0x562d20=_0x22d1c4===_0x2e72be(0xd4)?_0x2e72be(0x218):_0x22d1c4===_0x2e72be(0x114)?_0x2e72be(0x14f):'xdg-open';spawn(_0x562d20,[_0x2383dc],{'detached':!![],'stdio':'ignore'})[_0x2e72be(0xfe)]();}function migrateLegacyDirectory(){const _0x18852b=a29_0x406eed;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x409660=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x409660[_0x18852b(0x161)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x4372dd[_0x18852b(0x1a2)](_0x18852b(0x16e)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x18852b(0x125))),console['error'](a29_0x4372dd[_0x18852b(0x181)](_0x18852b(0x1c5)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a29_0x4372dd['yellow'](_0x18852b(0x130)+LEGACY_PARENT_SEGMENT_DIR+_0x18852b(0x1f2)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x18852b(0x13c)](a29_0x4372dd[_0x18852b(0x15d)](_0x18852b(0x139)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x232ef4){const _0x53c848=_0x232ef4 instanceof Error?_0x232ef4[_0x18852b(0x1eb)]:String(_0x232ef4);return console[_0x18852b(0x13c)](a29_0x4372dd['red'](_0x18852b(0xd5)+_0x53c848+'\x0a')),![];}}function a29_0x4dab(_0x18cb41,_0x8f303a){_0x18cb41=_0x18cb41-0xbc;const _0x480a68=a29_0x480a();let _0x4dabd3=_0x480a68[_0x18cb41];return _0x4dabd3;}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x406eed(0x19a)](_0x174c49){const _0x58c7e9=a29_0x406eed;return migrateLegacyDirectory(),super[_0x58c7e9(0x19a)](_0x174c49);}}function resolveYamlFile(_0x2ce3f1){const _0x431f92=a29_0x406eed;if(_0x2ce3f1[_0x431f92(0x1ea)]('.yml')||_0x2ce3f1[_0x431f92(0x1ea)](_0x431f92(0x175)))return _0x2ce3f1;return a29_0x6593f4['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2ce3f1)+_0x431f92(0x1da));}function formatProgressMessage(_0x4091af){const _0xc4becf=a29_0x406eed,_0x155091=_0x4091af[_0xc4becf(0x1d4)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x155091){const [,_0x3c7942,_0x229dd2,_0x1be29a='']=_0x155091;return a29_0x4372dd[_0xc4becf(0x181)](_0x3c7942+':')+'\x20'+_0x229dd2+a29_0x4372dd['dim'](_0x1be29a);}return a29_0x4372dd['dim'](_0x4091af);}function showFileNotFoundError(_0x4c5832,_0xa55b01){const _0x2af89d=a29_0x406eed;console['error'](a29_0x4372dd['red'](_0x2af89d(0x243)+_0x4c5832+'\x0a')),console[_0x2af89d(0x13c)](a29_0x4372dd[_0x2af89d(0x1d5)](_0x2af89d(0x1ef)+_0xa55b01+_0x2af89d(0x188)));}function displayRealtimeValidation(_0x3f9687){const _0x5aa4ac=a29_0x406eed;if(!_0x3f9687[_0x5aa4ac(0x123)])return;const _0x23c46d=_0x3f9687['realtime'],_0x3bc20b=_0x23c46d[_0x5aa4ac(0x1b1)]?a29_0x4372dd[_0x5aa4ac(0x15d)](_0x5aa4ac(0x1be)):a29_0x4372dd[_0x5aa4ac(0x1a2)](_0x5aa4ac(0xea));console[_0x5aa4ac(0x13c)]('\x0a'+a29_0x4372dd[_0x5aa4ac(0x181)](_0x5aa4ac(0x142))+'\x20'+_0x3bc20b);if(_0x23c46d['events']&&_0x23c46d[_0x5aa4ac(0x225)][_0x5aa4ac(0x1e6)]>0x0){console['error']('\x20\x20'+a29_0x4372dd[_0x5aa4ac(0x181)](_0x5aa4ac(0xd3))+'\x20'+_0x23c46d['events'][_0x5aa4ac(0x1e6)]+_0x5aa4ac(0x1fe));for(const _0x4e3428 of _0x23c46d[_0x5aa4ac(0x225)]){const _0x4df660=_0x4e3428['sourceTableValid']===![]?a29_0x4372dd['red']('✘'):a29_0x4372dd['green']('✔');console[_0x5aa4ac(0x13c)](_0x5aa4ac(0x11d)+_0x4df660+'\x20'+_0x4e3428[_0x5aa4ac(0x1f3)]),_0x4e3428[_0x5aa4ac(0x1d1)]&&console[_0x5aa4ac(0x13c)]('\x20\x20\x20\x20\x20\x20'+a29_0x4372dd[_0x5aa4ac(0x1f8)](_0x4e3428[_0x5aa4ac(0x1d1)]));}}if(_0x23c46d[_0x5aa4ac(0x1f4)]&&_0x23c46d[_0x5aa4ac(0x1f4)][_0x5aa4ac(0x1e6)]>0x0){console[_0x5aa4ac(0x13c)]('\x20\x20'+a29_0x4372dd['dim'](_0x5aa4ac(0x1ce))+'\x20'+_0x23c46d[_0x5aa4ac(0x1f4)]['length']+_0x5aa4ac(0x1fe));for(const _0x4d765a of _0x23c46d[_0x5aa4ac(0x1f4)]){const _0x592055=_0x4d765a[_0x5aa4ac(0xee)]?a29_0x4372dd['green']('✔'):a29_0x4372dd[_0x5aa4ac(0x1f8)]('✘');console[_0x5aa4ac(0x13c)](_0x5aa4ac(0x11d)+_0x592055+'\x20'+_0x4d765a[_0x5aa4ac(0x1f3)]+'\x20'+a29_0x4372dd['dim']('('+_0x4d765a[_0x5aa4ac(0xda)]+')'));}}if(_0x23c46d[_0x5aa4ac(0x107)]){const _0x5891b6=_0x23c46d[_0x5aa4ac(0x107)]['stitchingKeys']?.[_0x5aa4ac(0x1e6)]?_0x5aa4ac(0x14b)+_0x23c46d[_0x5aa4ac(0x107)]['stitchingKeys'][_0x5aa4ac(0x184)](',\x20')+']':'';console['error']('\x20\x20'+a29_0x4372dd[_0x5aa4ac(0x181)](_0x5aa4ac(0x193))+'\x20'+_0x23c46d['idStitching'][_0x5aa4ac(0xe7)]+_0x5891b6);}if(_0x23c46d['personalizationServices']&&_0x23c46d['personalizationServices'][_0x5aa4ac(0x1e6)]>0x0){console['error']('\x20\x20'+a29_0x4372dd[_0x5aa4ac(0x181)](_0x5aa4ac(0xdd))+'\x20'+_0x23c46d[_0x5aa4ac(0x159)][_0x5aa4ac(0x1e6)]+_0x5aa4ac(0x1f6)+(_0x23c46d[_0x5aa4ac(0x159)][_0x5aa4ac(0x1e6)]!==0x1?'s':''));for(const _0x143fb5 of _0x23c46d['personalizationServices']){console[_0x5aa4ac(0x13c)](_0x5aa4ac(0x1e3)+_0x143fb5['name']);}}}function showParentSegmentNotSetError(_0x48c909){const _0x9dea4a=a29_0x406eed;console[_0x9dea4a(0x13c)](a29_0x4372dd[_0x9dea4a(0x1a2)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x9dea4a(0x13c)](_0x48c909);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x406eed(0x1b5);[a29_0x406eed(0x144)]=a29_0x406eed(0x16f);async[a29_0x406eed(0x191)](_0xb52a5a){const _0x40f52d=a29_0x406eed,{options:_0x341675,args:_0x29911e,tdx:_0x1ab5c7}=_0xb52a5a,_0x2743b0=_0x29911e[0x0];_0x341675['verbose']&&(console[_0x40f52d(0x13c)](_0x40f52d(0x143)+_0x341675['site']),_0x2743b0&&console[_0x40f52d(0x13c)]('Pattern:\x20'+_0x2743b0));const _0x11f74b=await withSpinner(_0x2743b0?_0x40f52d(0x131)+_0x2743b0+'\x27...':_0x40f52d(0x18f),()=>_0x1ab5c7[_0x40f52d(0xcc)]['listParents'](),{'verbose':_0x341675[_0x40f52d(0x105)]});let _0x13ef62=_0x11f74b['data'];if(_0x2743b0){const _0xcdcc7=_0x2743b0[_0x40f52d(0x16a)](/[.+^${}()|[\]\\]/g,_0x40f52d(0x1d6))[_0x40f52d(0x16a)](/\*/g,'.*')[_0x40f52d(0x16a)](/\?/g,'.'),_0x27075d=new RegExp('^'+_0xcdcc7+'$','i');_0x13ef62=_0x13ef62[_0x40f52d(0x153)](_0x1edd70=>_0x27075d[_0x40f52d(0x1ba)](_0x1edd70[_0x40f52d(0x1f4)][_0x40f52d(0x1f3)]));}_0x13ef62[_0x40f52d(0x1e9)]((_0x24924b,_0x49343a)=>_0x24924b[_0x40f52d(0x1f4)][_0x40f52d(0x1f3)][_0x40f52d(0xed)](_0x49343a[_0x40f52d(0x1f4)][_0x40f52d(0x1f3)])),console[_0x40f52d(0x13c)]('✔\x20Found\x20'+_0x13ef62[_0x40f52d(0x1e6)]+_0x40f52d(0x1fb)+(_0x13ef62[_0x40f52d(0x1e6)]!==0x1?'s':''));const _0x1da0ae=_0x4be32c=>{const _0x4d1bee=_0x40f52d;return getConsoleNextUrl(_0x341675[_0x4d1bee(0xbf)],_0x4d1bee(0x1e2)+_0x4be32c);};if(_0x341675[_0x40f52d(0xf4)]===_0x40f52d(0x1ad)||_0x341675[_0x40f52d(0xf4)]===_0x40f52d(0x17e)){const _0x48b722=_0x13ef62[_0x40f52d(0x122)](_0x4767c1=>({..._0x4767c1,'url':_0x1da0ae(_0x4767c1['id'])}));await handleSDKOutput(_0x48b722,_0x341675);}else{if(_0x13ef62[_0x40f52d(0x1e6)]===0x0)_0x2743b0?console[_0x40f52d(0x135)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x2743b0):console[_0x40f52d(0x135)](_0x40f52d(0x21c));else for(const _0x27231d of _0x13ef62){const _0x59af28=_0x27231d[_0x40f52d(0x1f4)][_0x40f52d(0x1e8)]?a29_0x4372dd[_0x40f52d(0x181)]('\x20('+formatRows(_0x27231d['attributes'][_0x40f52d(0x1e8)])+')'):'',_0x5f4698=hyperlink(_0x27231d[_0x40f52d(0x1f4)][_0x40f52d(0x1f3)],_0x1da0ae(_0x27231d['id']));console['log'](_0x40f52d(0xf2)+_0x5f4698+_0x59af28);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a29_0x406eed(0x1d2);[a29_0x406eed(0x144)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a29_0x406eed(0x191)](_0x141967){const _0x1aa415=a29_0x406eed,{options:_0x4305c7,args:_0x12b9ba,tdx:_0x412510}=_0x141967;console[_0x1aa415(0x13c)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x1aa415(0x141)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x2ad9ce=_0x4305c7;if(_0x12b9ba['length']===0x0)return console[_0x1aa415(0x13c)](a29_0x4372dd[_0x1aa415(0x1f8)](_0x1aa415(0x23e))),console[_0x1aa415(0x13c)](_0x1aa415(0x197)),0x1;const _0xa6275f=_0x12b9ba[0x0];if(!_0x2ad9ce['database']||!_0x2ad9ce['table'])return console[_0x1aa415(0x13c)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x1aa415(0x13c)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x2ad9ce[_0x1aa415(0x105)]&&(console[_0x1aa415(0x13c)]('Site:\x20'+_0x2ad9ce[_0x1aa415(0xbf)]),console['error']('Name:\x20'+_0xa6275f),console[_0x1aa415(0x13c)](_0x1aa415(0x20c)+_0x2ad9ce[_0x1aa415(0x203)]),console[_0x1aa415(0x13c)](_0x1aa415(0xef)+_0x2ad9ce[_0x1aa415(0x1ac)]));const _0x5edbc1=await loadJSONFromOptions(_0x2ad9ce[_0x1aa415(0x1f4)],_0x2ad9ce[_0x1aa415(0x147)]),_0x373546=await loadJSONFromOptions(_0x2ad9ce[_0x1aa415(0x226)],_0x2ad9ce['behaviorsFile']),_0x467334=await loadJSONFromOptions(_0x2ad9ce['customerGroup'],_0x2ad9ce[_0x1aa415(0x1aa)]),_0x12ab35={'name':_0xa6275f,'description':_0x2ad9ce[_0x1aa415(0x144)],'scheduleType':_0x2ad9ce[_0x1aa415(0x17b)],'scheduleOption':_0x2ad9ce['scheduleOption'],'timezone':_0x2ad9ce[_0x1aa415(0x192)],'master':{'parentDatabaseName':_0x2ad9ce[_0x1aa415(0x203)],'parentTableName':_0x2ad9ce['table']},'attributes':_0x5edbc1,'behaviors':_0x373546,'customerGroup':_0x467334},_0x810033=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0xa6275f+_0x1aa415(0x165),()=>_0x412510[_0x1aa415(0xcc)][_0x1aa415(0x1fc)](_0x12ab35),{'verbose':_0x4305c7[_0x1aa415(0x105)]}),_0xb12d9=_0x810033['data'];return console['error'](_0x1aa415(0x15e)+_0xb12d9[_0x1aa415(0x1f3)]+'\x27\x20with\x20ID:\x20'+_0xb12d9['id']),await handleSDKOutput([_0xb12d9],_0x4305c7),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x406eed(0x1f3)]='segment:parent:update';[a29_0x406eed(0x144)]=a29_0x406eed(0x132);async[a29_0x406eed(0x191)](_0x163383){const _0x2b5fdc=a29_0x406eed,{options:_0xdec74d,args:_0x3bd0d7,tdx:_0x383953}=_0x163383;console[_0x2b5fdc(0x13c)](_0x2b5fdc(0xf7)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x2b5fdc(0x124));const _0x333109=_0xdec74d;if(_0x3bd0d7[_0x2b5fdc(0x1e6)]===0x0)return console[_0x2b5fdc(0x13c)](a29_0x4372dd[_0x2b5fdc(0x1f8)](_0x2b5fdc(0x23e))),console['error'](_0x2b5fdc(0x223)),0x1;const _0x261ac5=_0x3bd0d7[0x0];_0x333109[_0x2b5fdc(0x105)]&&(console['error']('Site:\x20'+_0x333109[_0x2b5fdc(0xbf)]),console['error']('Parent\x20segment:\x20'+_0x261ac5));const _0x2d9174=await withSpinner(_0x2b5fdc(0x1df)+_0x261ac5+'\x27...',()=>_0x383953[_0x2b5fdc(0xcc)][_0x2b5fdc(0x220)](_0x261ac5),{'verbose':_0x333109[_0x2b5fdc(0x105)]}),_0x487e7e=_0x2d9174[_0x2b5fdc(0x152)],_0xdbb85a=await loadJSONFromOptions(_0x333109[_0x2b5fdc(0x1a6)],_0x333109[_0x2b5fdc(0x15f)]),_0x3bc049=await loadJSONFromOptions(_0x333109[_0x2b5fdc(0x1db)],_0x333109[_0x2b5fdc(0x1dc)]),_0x26e280={'name':_0x487e7e['name'],'description':_0x333109[_0x2b5fdc(0x144)]!==undefined?_0x333109[_0x2b5fdc(0x144)]:_0x487e7e[_0x2b5fdc(0x144)],'scheduleType':_0x333109['scheduleType']!==undefined?_0x333109['scheduleType']:_0x487e7e['scheduleType'],'scheduleOption':_0x333109[_0x2b5fdc(0x10d)]!==undefined?_0x333109[_0x2b5fdc(0x10d)]:_0x487e7e[_0x2b5fdc(0x10d)],'timezone':_0x333109[_0x2b5fdc(0x192)]!==undefined?_0x333109[_0x2b5fdc(0x192)]:_0x487e7e[_0x2b5fdc(0x192)],'master':_0x487e7e[_0x2b5fdc(0x1e7)],'attributes':_0xdbb85a?[..._0x487e7e['attributes']||[],..._0xdbb85a]:_0x487e7e['attributes'],'behaviors':_0x3bc049?[..._0x487e7e[_0x2b5fdc(0x226)]||[],..._0x3bc049]:_0x487e7e[_0x2b5fdc(0x226)],'customerGroup':_0x487e7e[_0x2b5fdc(0x102)]},_0x234078=await withSpinner(_0x2b5fdc(0x17f)+_0x261ac5+'\x27...',()=>_0x383953[_0x2b5fdc(0xcc)][_0x2b5fdc(0xe9)](_0x261ac5,_0x26e280),{'verbose':_0x333109[_0x2b5fdc(0x105)]}),_0x881406=_0x234078[_0x2b5fdc(0x152)];return console[_0x2b5fdc(0x13c)](_0x2b5fdc(0x15b)+_0x881406[_0x2b5fdc(0x1f3)]+'\x27'),await handleSDKOutput([_0x881406],_0x333109),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x406eed(0x1f3)]='segment:parent:pull';[a29_0x406eed(0x144)]=a29_0x406eed(0x190);async[a29_0x406eed(0x191)](_0x1fc1bd){const _0x1dfc5c=a29_0x406eed,{options:_0x2bee61,args:_0x5a0250,tdx:_0x2d279a}=_0x1fc1bd,_0x534a81=_0x2bee61,_0x5bca9c=_0x5a0250[0x0]||_0x2bee61[_0x1dfc5c(0x1bd)];if(!_0x5bca9c)return showParentSegmentNotSetError(_0x1dfc5c(0x1c4)+_0x1dfc5c(0x1b9)),0x1;if(_0x534a81[_0x1dfc5c(0x118)]&&_0x534a81[_0x1dfc5c(0x19c)])return console['error'](a29_0x4372dd[_0x1dfc5c(0x1f8)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x1dfc5c(0x13c)](a29_0x4372dd[_0x1dfc5c(0x181)](_0x1dfc5c(0x172))),console[_0x1dfc5c(0x13c)](a29_0x4372dd[_0x1dfc5c(0x181)](_0x1dfc5c(0x1bf)+PARENT_SEGMENT_DIR+_0x1dfc5c(0x1cf))),console['error'](a29_0x4372dd[_0x1dfc5c(0x1d5)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x3319d4=_0x534a81[_0x1dfc5c(0x19c)]||a29_0x6593f4[_0x1dfc5c(0x184)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5bca9c)+_0x1dfc5c(0x1da));_0x534a81[_0x1dfc5c(0x105)]&&(console['error'](_0x1dfc5c(0x143)+_0x534a81[_0x1dfc5c(0xbf)]),console['error'](_0x1dfc5c(0x164)+_0x5bca9c),console[_0x1dfc5c(0x13c)](_0x1dfc5c(0x221)+_0x3319d4));const _0x29b3e3=await withSpinner(_0x1dfc5c(0x19e)+_0x5bca9c+_0x1dfc5c(0x165),()=>_0x2d279a[_0x1dfc5c(0xcc)][_0x1dfc5c(0x23d)](_0x5bca9c),{'verbose':_0x534a81['verbose']}),_0x23e2fe=_0x29b3e3[_0x1dfc5c(0x152)];if(existsSync(_0x3319d4)){const _0x10bfe2=readFileSync(_0x3319d4,'utf-8'),_0x15c0b3=generateDiff(_0x10bfe2,_0x23e2fe);if(!hasChanges(_0x15c0b3))console[_0x1dfc5c(0x13c)](a29_0x4372dd['green']('✔')+_0x1dfc5c(0x1e1)+a29_0x4372dd[_0x1dfc5c(0x1d5)](_0x3319d4)+_0x1dfc5c(0x166));else{console['error'](_0x1dfc5c(0xd2)+_0x3319d4+'\x27:'),console[_0x1dfc5c(0x13c)]('─'[_0x1dfc5c(0x20b)](0x3c)),console[_0x1dfc5c(0x13c)](formatDiffWithColors(_0x15c0b3)),console[_0x1dfc5c(0x13c)]('─'['repeat'](0x3c));if(!_0x534a81[_0x1dfc5c(0x156)]){if(!isInteractive())return console['error'](a29_0x4372dd['red'](_0x1dfc5c(0x210)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x1dfc5c(0x13c)](a29_0x4372dd[_0x1dfc5c(0x181)](_0x1dfc5c(0x13b))),0x1;const _0x4134ce=await confirmKey(_0x1dfc5c(0x20e)+_0x3319d4+'\x27?');if(!_0x4134ce)return console[_0x1dfc5c(0x13c)](a29_0x4372dd[_0x1dfc5c(0x1a2)]('Aborted.')),0x1;}writeFileSync(_0x3319d4,_0x23e2fe,_0x1dfc5c(0x1c1)),console[_0x1dfc5c(0x13c)](a29_0x4372dd['green']('✔')+_0x1dfc5c(0x10f)+a29_0x4372dd['cyan'](_0x3319d4));}}else{const _0x2c53ed=a29_0x6593f4[_0x1dfc5c(0x22e)](_0x3319d4);!existsSync(_0x2c53ed)&&mkdirSync(_0x2c53ed,{'recursive':!![]}),writeFileSync(_0x3319d4,_0x23e2fe,_0x1dfc5c(0x1c1)),console[_0x1dfc5c(0x13c)](a29_0x4372dd['green']('✔')+_0x1dfc5c(0x10f)+a29_0x4372dd['cyan'](_0x3319d4));}return saveSessionContext({'parent_segment':_0x5bca9c},_0x534a81[_0x1dfc5c(0x145)]),console['error'](a29_0x4372dd[_0x1dfc5c(0x15d)]('✔')+_0x1dfc5c(0xe3)+a29_0x4372dd[_0x1dfc5c(0x181)]('parent_segment')+_0x1dfc5c(0x15a)+a29_0x4372dd['cyan'](_0x5bca9c)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x215);[a29_0x406eed(0x144)]=a29_0x406eed(0x110);async[a29_0x406eed(0x191)](_0x142af5){const _0x7e706d=a29_0x406eed,{options:_0x220796,args:_0x5a6e6c,tdx:_0x557098}=_0x142af5,_0x4ad297=_0x220796,_0x49bc83=_0x5a6e6c[0x0]||_0x220796[_0x7e706d(0x1bd)];if(!_0x49bc83)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x555419=resolveYamlFile(_0x49bc83);if(!existsSync(_0x555419))return showFileNotFoundError(_0x555419,_0x49bc83),0x1;_0x4ad297[_0x7e706d(0x105)]&&(console[_0x7e706d(0x13c)](_0x7e706d(0x143)+_0x4ad297['site']),console[_0x7e706d(0x13c)](_0x7e706d(0x127)+_0x555419));let _0x3fbf78;try{_0x3fbf78=readFileSync(_0x555419,_0x7e706d(0x1c1));}catch(_0x1b2b35){const _0x3c9ea7=_0x1b2b35 instanceof Error?_0x1b2b35['message']:String(_0x1b2b35);return console[_0x7e706d(0x13c)](_0x7e706d(0x194)+_0x3c9ea7),0x1;}const _0x503d0d=await withSpinner(_0x7e706d(0x146),()=>_0x557098[_0x7e706d(0xcc)][_0x7e706d(0xd9)](_0x3fbf78),{'verbose':_0x4ad297[_0x7e706d(0x105)]}),_0x5b6a29=_0x503d0d['data'],{isNew:_0x562098,name:_0x1c3251,hasChanges:_0x19c7c9,diffFormatted:_0x4617ff}=_0x5b6a29;if(!_0x19c7c9)return console[_0x7e706d(0x13c)](_0x7e706d(0x222)+_0x1c3251+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x562098?console['error'](_0x7e706d(0xe2)+_0x1c3251+'\x27:'):console[_0x7e706d(0x13c)](_0x7e706d(0x12d)+_0x1c3251+'\x27:');console['error']('─'[_0x7e706d(0x20b)](0x3c)),console[_0x7e706d(0x13c)](_0x4617ff),console['error']('─'[_0x7e706d(0x20b)](0x3c));const _0x58ccf9=_0x562098?_0x7e706d(0x207)+_0x1c3251+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x1c3251+'\x27?';if(!_0x4ad297[_0x7e706d(0x156)]){if(!isInteractive())return console[_0x7e706d(0x13c)](a29_0x4372dd[_0x7e706d(0x1f8)](_0x7e706d(0x210)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x7e706d(0x13c)](a29_0x4372dd[_0x7e706d(0x181)](_0x7e706d(0x13b))),0x1;const _0xe85a1c=await confirmKey(_0x58ccf9);if(!_0xe85a1c)return console['error'](a29_0x4372dd[_0x7e706d(0x1a2)](_0x7e706d(0x238))),0x1;}const _0x3aa1cd=_0x562098?'Creating':_0x7e706d(0xe4),_0x445ed9=await withSpinner(_0x3aa1cd+_0x7e706d(0xbd)+_0x1c3251+'\x27...',()=>_0x5b6a29[_0x7e706d(0x1cd)](),{'verbose':_0x4ad297[_0x7e706d(0x105)]}),_0x1fb3a9=_0x445ed9[_0x7e706d(0x152)],_0xbfab37=getConsoleNextUrl(_0x4ad297['site'],_0x7e706d(0x1e2)+_0x1fb3a9['id']),_0x3faa1d=_0x562098?_0x7e706d(0xc2):_0x7e706d(0xfb);return console[_0x7e706d(0x13c)]('✔\x20'+_0x3faa1d+_0x7e706d(0xbd)+_0x1fb3a9['name']+'\x27'),console[_0x7e706d(0x13c)]('\x20\x20'+_0xbfab37),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x20a);[a29_0x406eed(0x144)]=a29_0x406eed(0x11c);async[a29_0x406eed(0x191)](_0x4b2e2b){const _0x230ffa=a29_0x406eed,{options:_0x263441,args:_0x5ceb2f,tdx:_0x49cfbe}=_0x4b2e2b,_0x4e61af=_0x263441,_0x2156ff=_0x5ceb2f[0x0]||_0x263441['parentSegment'];if(!_0x2156ff)return showParentSegmentNotSetError(_0x230ffa(0x201)+_0x230ffa(0x176)+_0x230ffa(0x1cb)+_0x230ffa(0x1fa)+_0x230ffa(0x1b8)+_0x230ffa(0x235)),0x1;const _0x48b08c=resolveYamlFile(_0x2156ff);if(!existsSync(_0x48b08c))return showFileNotFoundError(_0x48b08c,_0x2156ff),0x1;_0x4e61af[_0x230ffa(0x105)]&&(console[_0x230ffa(0x13c)]('Site:\x20'+_0x4e61af['site']),console[_0x230ffa(0x13c)](_0x230ffa(0x127)+_0x48b08c));let _0x22f3f8;try{_0x22f3f8=readFileSync(_0x48b08c,'utf-8');}catch(_0x2dc6b5){const _0x4ede38=_0x2dc6b5 instanceof Error?_0x2dc6b5[_0x230ffa(0x1eb)]:String(_0x2dc6b5);return console[_0x230ffa(0x13c)](_0x230ffa(0x194)+_0x4ede38),0x1;}const _0xf64302=createCommandSpinner(a29_0x4372dd[_0x230ffa(0x181)](_0x230ffa(0x13d)),{'verbose':_0x4e61af['verbose']});_0xf64302[_0x230ffa(0x14f)]();const _0x328dc4={'onProgress':_0x302650=>{const _0x1fcd1d=_0x230ffa;_0xf64302[_0x1fcd1d(0x19b)]=formatProgressMessage(_0x302650);}};if(_0x4e61af[_0x230ffa(0x1e7)])_0x328dc4[_0x230ffa(0x1e7)]=!![];if(_0x4e61af[_0x230ffa(0x1a3)])_0x328dc4[_0x230ffa(0x1a3)]=!![];_0x4e61af[_0x230ffa(0xfd)]&&(_0x328dc4[_0x230ffa(0xfd)]=_0x4e61af[_0x230ffa(0xfd)]);_0x4e61af['behavior']&&(_0x328dc4[_0x230ffa(0x171)]=_0x4e61af[_0x230ffa(0x171)]);if(_0x4e61af['interval'])_0x328dc4[_0x230ffa(0x219)]=_0x4e61af[_0x230ffa(0x219)];let _0x3f8d40;try{_0x3f8d40=await _0x49cfbe['segment'][_0x230ffa(0x151)](_0x22f3f8,_0x328dc4),_0xf64302[_0x230ffa(0x13a)]();}catch(_0x4023f2){_0xf64302[_0x230ffa(0x13a)]();throw _0x4023f2;}const _0x24ba84=_0x4e61af[_0x230ffa(0x219)]||_0x230ffa(0xc1);return this[_0x230ffa(0x200)](_0x3f8d40,_0x328dc4,_0x48b08c,_0x24ba84),_0x3f8d40['allValid']?0x0:0x1;}[a29_0x406eed(0x200)](_0x3febac,_0x26c72e,_0x65aa54,_0x2752d9){const _0x58b09b=a29_0x406eed;console[_0x58b09b(0x13c)]('\x0a'+a29_0x4372dd[_0x58b09b(0x150)](_0x58b09b(0xde))+'\x20'+_0x3febac[_0x58b09b(0x1f3)]),console[_0x58b09b(0x13c)]('═'[_0x58b09b(0x20b)](0x3c)),this[_0x58b09b(0x133)](_0x3febac);if(typeof _0x26c72e['attribute']===_0x58b09b(0x103)){this['displayAttributesStats'](_0x3febac),this[_0x58b09b(0x1f9)](_0x3febac),this[_0x58b09b(0x205)](_0x65aa54,_0x2752d9,_0x58b09b(0xfd),_0x26c72e[_0x58b09b(0xfd)]);return;}if(_0x26c72e[_0x58b09b(0xfd)]===!![]){this[_0x58b09b(0x113)](_0x3febac),this[_0x58b09b(0x1f9)](_0x3febac),this['displayPreviewHints'](_0x65aa54,_0x2752d9,'attributes');return;}if(typeof _0x26c72e[_0x58b09b(0x171)]===_0x58b09b(0x103)){this['displayBehaviorsStats'](_0x3febac,_0x2752d9),this['displaySummary'](_0x3febac),this['displayPreviewHints'](_0x65aa54,_0x2752d9,_0x58b09b(0x171),_0x26c72e[_0x58b09b(0x171)]);return;}if(_0x26c72e[_0x58b09b(0x171)]===!![]){this['displayBehaviorsStats'](_0x3febac,_0x2752d9),this['displaySummary'](_0x3febac),this[_0x58b09b(0x205)](_0x65aa54,_0x2752d9,_0x58b09b(0x226));return;}this[_0x58b09b(0x113)](_0x3febac),this[_0x58b09b(0x18d)](_0x3febac,_0x2752d9),this[_0x58b09b(0xcd)](_0x3febac),this['displaySummary'](_0x3febac),this[_0x58b09b(0x205)](_0x65aa54,_0x2752d9,_0x58b09b(0x19f));}[a29_0x406eed(0xcd)](_0x1497b6){displayRealtimeValidation(_0x1497b6);}['displayPreviewHints'](_0x119339,_0x4658af,_0x433b87,_0x53b8d3){const _0x56c21=a29_0x406eed;console[_0x56c21(0x13c)]('\x0a'+a29_0x4372dd[_0x56c21(0x181)]('To\x20view\x20sample\x20data:'));const _0x3f07a2=_0x4658af!=='-1d'?_0x56c21(0xcb)+_0x4658af:'';if(_0x433b87===_0x56c21(0xfd)&&_0x53b8d3)console['error']('\x20\x20'+a29_0x4372dd['dim'](_0x56c21(0x1c0)+_0x119339+_0x56c21(0xf1)+_0x53b8d3+'\x22'+_0x3f07a2));else{if(_0x433b87===_0x56c21(0x171)&&_0x53b8d3)console[_0x56c21(0x13c)]('\x20\x20'+a29_0x4372dd[_0x56c21(0x181)]('tdx\x20ps\x20preview\x20'+_0x119339+_0x56c21(0x185)+_0x53b8d3+'\x22'+_0x3f07a2));else(_0x433b87==='attributes'||_0x433b87===_0x56c21(0x19f))&&console[_0x56c21(0x13c)]('\x20\x20'+a29_0x4372dd[_0x56c21(0x181)](_0x56c21(0x1c0)+_0x119339+_0x56c21(0x12c)+_0x3f07a2));}(_0x433b87==='behaviors'||_0x433b87===_0x56c21(0x19f))&&console[_0x56c21(0x13c)]('\x20\x20'+a29_0x4372dd['dim'](_0x56c21(0x1c0)+_0x119339+_0x56c21(0x168)+_0x3f07a2)),_0x433b87===_0x56c21(0x19f)&&console[_0x56c21(0x13c)]('\x20\x20'+a29_0x4372dd[_0x56c21(0x181)](_0x56c21(0x1c0)+_0x119339+_0x56c21(0x12f)+_0x3f07a2));}['displayMasterInfo'](_0x411d6c){const _0x436ce6=a29_0x406eed,{master:_0x276193}=_0x411d6c,_0x50046d=_0x276193['schemaValid']?a29_0x4372dd[_0x436ce6(0x15d)]('✔'):a29_0x4372dd[_0x436ce6(0x1f8)]('✘');console['error']('\x0a'+a29_0x4372dd['dim'](_0x436ce6(0x11f))),console[_0x436ce6(0x13c)](_0x50046d+'\x20'+a29_0x4372dd[_0x436ce6(0x150)](_0x276193[_0x436ce6(0x203)]+'.'+_0x276193[_0x436ce6(0x1ac)])),_0x276193['schemaValid']?_0x276193[_0x436ce6(0x119)]!==undefined&&console[_0x436ce6(0x13c)]('\x20\x20'+a29_0x4372dd['dim'](_0x436ce6(0xf6))+'\x20'+a29_0x4372dd[_0x436ce6(0x1d5)](formatRows(_0x276193['rowCount']))):console[_0x436ce6(0x13c)]('\x20\x20'+a29_0x4372dd[_0x436ce6(0x1f8)]('Error:')+'\x20'+_0x276193[_0x436ce6(0xbe)]);}[a29_0x406eed(0x113)](_0x234577){const _0x564dc1=a29_0x406eed;if(_0x234577['attributes'][_0x564dc1(0x1e6)]===0x0)return;console[_0x564dc1(0x13c)]('\x0a'+a29_0x4372dd[_0x564dc1(0x181)](_0x564dc1(0x10b)));for(const _0x205347 of _0x234577[_0x564dc1(0x1f4)]){const _0x132be9=_0x205347[_0x564dc1(0x177)]?a29_0x4372dd[_0x564dc1(0x15d)]('✔'):a29_0x4372dd[_0x564dc1(0x1f8)]('✘');let _0x3558d7='';if(_0x205347[_0x564dc1(0x177)]&&_0x205347['matchedCount']!==undefined&&_0x205347[_0x564dc1(0x14a)]!==undefined){const _0x258025=_0x205347[_0x564dc1(0x14a)]['toFixed'](0x1),_0x233715=_0x205347[_0x564dc1(0x14a)]>=0x50?a29_0x4372dd[_0x564dc1(0x15d)]:_0x205347[_0x564dc1(0x14a)]>=0x32?a29_0x4372dd[_0x564dc1(0x1a2)]:a29_0x4372dd[_0x564dc1(0x1f8)];_0x3558d7='\x20'+a29_0x4372dd[_0x564dc1(0x181)]('Coverage:')+'\x20'+_0x233715(_0x258025+'%')+'\x20('+formatRows(_0x205347[_0x564dc1(0xd6)])+_0x564dc1(0x1ee);}console['error'](_0x132be9+'\x20'+a29_0x4372dd[_0x564dc1(0x150)](_0x205347[_0x564dc1(0x1f3)])+_0x3558d7),console[_0x564dc1(0x13c)]('\x20\x20'+a29_0x4372dd[_0x564dc1(0x181)]('Source:')+'\x20'+a29_0x4372dd['bold'](_0x205347[_0x564dc1(0x203)]+'.'+_0x205347['table']));const _0x4e0e79=_0x205347[_0x564dc1(0x174)]===_0x205347[_0x564dc1(0x157)]?a29_0x4372dd[_0x564dc1(0x181)]('Join\x20on:')+'\x20'+_0x205347[_0x564dc1(0x174)]:a29_0x4372dd[_0x564dc1(0x181)](_0x564dc1(0x163))+'\x20'+_0x205347[_0x564dc1(0x174)]+_0x564dc1(0x15a)+_0x205347[_0x564dc1(0x157)];console[_0x564dc1(0x13c)]('\x20\x20'+_0x4e0e79),console[_0x564dc1(0x13c)]('\x20\x20'+a29_0x4372dd[_0x564dc1(0x181)](_0x564dc1(0x1ec))),this[_0x564dc1(0x189)](_0x205347[_0x564dc1(0x138)]),!_0x205347[_0x564dc1(0x177)]&&console[_0x564dc1(0x13c)]('\x20\x20'+a29_0x4372dd[_0x564dc1(0x1f8)](_0x564dc1(0x195))+'\x20'+_0x205347[_0x564dc1(0xbe)]);}}[a29_0x406eed(0x18d)](_0x40d526,_0x12acf6){const _0x3c7880=a29_0x406eed;if(_0x40d526[_0x3c7880(0x226)][_0x3c7880(0x1e6)]===0x0)return;console[_0x3c7880(0x13c)]('\x0a'+a29_0x4372dd[_0x3c7880(0x181)]('Behaviors')+'\x20'+a29_0x4372dd[_0x3c7880(0x181)]('('+_0x12acf6+')'));for(const _0x47d936 of _0x40d526['behaviors']){const _0x4e3d3e=_0x47d936['schemaValid']?a29_0x4372dd[_0x3c7880(0x15d)]('✔'):a29_0x4372dd[_0x3c7880(0x1f8)]('✘');let _0x59c9e5='';if(_0x47d936[_0x3c7880(0x177)]&&_0x47d936[_0x3c7880(0x108)]!==undefined&&_0x47d936[_0x3c7880(0xeb)]!==undefined){const _0x4a0b41=_0x47d936[_0x3c7880(0x137)]?.[_0x3c7880(0x1f0)](0x1)||'?',_0x150cc4=(_0x47d936[_0x3c7880(0x137)]??0x0)>=0x32?a29_0x4372dd[_0x3c7880(0x15d)]:(_0x47d936[_0x3c7880(0x137)]??0x0)>=0x14?a29_0x4372dd['yellow']:a29_0x4372dd['red'];_0x59c9e5='\x20'+a29_0x4372dd[_0x3c7880(0x181)]('Customers:')+'\x20'+_0x150cc4(formatRows(_0x47d936[_0x3c7880(0x108)]))+'\x20('+_0x4a0b41+'%)\x20'+a29_0x4372dd[_0x3c7880(0x181)](_0x3c7880(0xd3))+'\x20'+a29_0x4372dd[_0x3c7880(0x1d5)](formatRows(_0x47d936[_0x3c7880(0xeb)]));}console['error'](_0x4e3d3e+'\x20'+a29_0x4372dd[_0x3c7880(0x150)](_0x47d936[_0x3c7880(0x1f3)])+_0x59c9e5),console[_0x3c7880(0x13c)]('\x20\x20'+a29_0x4372dd[_0x3c7880(0x181)]('Source:')+'\x20'+a29_0x4372dd[_0x3c7880(0x150)](_0x47d936[_0x3c7880(0x203)]+'.'+_0x47d936[_0x3c7880(0x1ac)]));const _0x203266=_0x47d936[_0x3c7880(0x174)]===_0x47d936[_0x3c7880(0x157)]?a29_0x4372dd['dim'](_0x3c7880(0x112))+'\x20'+_0x47d936[_0x3c7880(0x174)]:a29_0x4372dd[_0x3c7880(0x181)](_0x3c7880(0x163))+'\x20'+_0x47d936[_0x3c7880(0x174)]+_0x3c7880(0x15a)+_0x47d936[_0x3c7880(0x157)];console['error']('\x20\x20'+_0x203266),console[_0x3c7880(0x13c)]('\x20\x20'+a29_0x4372dd[_0x3c7880(0x181)](_0x3c7880(0x1ec))),this['displayColumns'](_0x47d936[_0x3c7880(0x138)]),!_0x47d936[_0x3c7880(0x177)]&&console['error']('\x20\x20'+a29_0x4372dd[_0x3c7880(0x1f8)](_0x3c7880(0x195))+'\x20'+_0x47d936[_0x3c7880(0xbe)]);}}[a29_0x406eed(0x189)](_0x34ee58){const _0x2b72eb=a29_0x406eed;for(const _0x2a543b of _0x34ee58){_0x2a543b[_0x2b72eb(0x1bb)]===_0x2a543b[_0x2b72eb(0xc0)]||_0x2a543b[_0x2b72eb(0xc0)]==='*'?console['error'](_0x2b72eb(0x1e3)+_0x2a543b[_0x2b72eb(0x1bb)]):console[_0x2b72eb(0x13c)]('\x20\x20\x20\x20-\x20'+_0x2a543b[_0x2b72eb(0x1bb)]+'\x20'+a29_0x4372dd[_0x2b72eb(0x181)]('('+_0x2a543b[_0x2b72eb(0xc0)]+')'));}}[a29_0x406eed(0x1f9)](_0x22bf5e){const _0x235ad3=a29_0x406eed;console[_0x235ad3(0x13c)]('─'[_0x235ad3(0x20b)](0x3c));if(_0x22bf5e[_0x235ad3(0x1ca)][_0x235ad3(0x1e6)]>0x0){console[_0x235ad3(0x13c)]('\x0a'+a29_0x4372dd[_0x235ad3(0x1f8)](_0x235ad3(0x1d3)));for(const _0x2a0ba3 of _0x22bf5e[_0x235ad3(0x1ca)]){console['error']('\x20\x20'+a29_0x4372dd['red']('•')+'\x20'+_0x2a0ba3);}}_0x22bf5e['allValid']&&console[_0x235ad3(0x13c)]('\x0a'+a29_0x4372dd[_0x235ad3(0x15d)]('✔')+'\x20Configuration\x20is\x20valid');}}function a29_0x480a(){const _0x2f1d88=['Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Fetching\x20SQL\x20for\x20\x27','primaryKey','audienceId','updateParent','⚡\x20Not\x20enabled','totalEvents','Preview:','localeCompare','valid','Table:\x20','Fetching\x20sample\x20data...','\x20--attribute\x20\x22','👥\x20','Validating\x20RT\x20configuration...','format','Resolving\x20parent\x20segment\x20\x27','Rows:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Master:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','Updated','\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','attribute','unref','Available\x20attributes:','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','customerGroup','string','displaySampleData','verbose','.customers)','idStitching','customersWithEvents','Get\x20SQL\x20query\x20for\x20parent\x20segment','number','Attributes','workflowSessionId','scheduleOption','\x20behaviors','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','\x20\x20Columns:\x20','Join\x20on:','displayAttributesStats','win32','elapsedTimeMillis','\x20\x20Database:\x20','Options:','use','rowCount','previewParentYaml','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x20\x20\x20','allValid','Master\x20Table','\x20\x20\x20','No\x20RT-enabled\x20parent\x20segments\x20found','map','realtime','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/\x20directories\x20exist.','\x20personalization\x20service','YAML\x20file:\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','\x20RT-enabled\x20parent\x20segment','Executing\x20parent\x20segment\x20query...','\x20total','\x20--attribute\x20\x22<name>\x22','\x0aChanges\x20to\x20apply\x20to\x20\x27','Behavior:','\x20--enriched','\x0a⚠️\x20\x20Migrating:\x20','Listing\x20parent\x20segments\x20matching\x20\x27','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','displayMasterInfo','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','log','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','customerPercent','columns','✔\x20Renamed\x20directory\x20to\x20','stop','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','error','Validating\x20configuration...','\x22\x20}','/app/workflows/','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','RT\x202.0:','Site:\x20','description','session','Analyzing\x20changes...','attributesFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','✔\x20Found\x20','coveragePercent','\x20+\x20[','page_view','stats','indexOf','start','bold','validateParentYaml','data','filter','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Options\x20(one\x20required):\x0a','yes','foreignKey','getBehaviorNames','personalizationServices','\x20=\x20','✔\x20Updated\x20parent\x20segment\x20\x27','88017rxEYJH','green','✔\x20Created\x20parent\x20segment\x20\x27','addAttributesFile','realtime:','isDirectory','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Join:','Parent\x20segment:\x20','\x27...','\x20is\x20already\x20up\x20to\x20date','\x20to\x20push\x20the\x20configuration','\x20--behavior\x20\x22<name>\x22','\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','replace','personalization_services','column_type','\x20RT\x20configuration\x20is\x20valid','\x0a⚠️\x20\x20Both\x20','List\x20parent\x20segments','Listing\x20RT-enabled\x20parent\x20segments...','behavior','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','joinKey','.yaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','schemaValid','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','To\x20cancel:','\x20service(s)\x20configured','scheduleType','Output\x20Database:','getParentSQL','jsonl','Updating\x20parent\x20segment\x20\x27','Next\x20steps:','dim','information_schema','Session:','join','\x20--behavior\x20\x22','parent_segments','Listing\x20fields\x20for\x20\x27','`\x20to\x20download\x20the\x20configuration\x20first','displayColumns','Fetching\x20customers\x20schema...','status','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','displayBehaviorsStats','toLowerCase','Listing\x20parent\x20segments...','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','execute','timezone','ID\x20Stitching:','Error\x20reading\x20file:\x20','Error:','segment:parent:show','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20\x202.\x20Run\x20','resolveParentId','run','text','output','\x20Added\x20RT\x202.0\x20template\x20section','Fetching\x20parent\x20segment\x20\x27','all','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','yellow','enriched','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','2346426eeQaRt','addAttributes','22384DhaDSX','84KVoPPZ','varchar','customerGroupFile','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','table','json','Attribute:','ps:pz:list','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','enabled','displayPreviewResults','\x20\x201.\x20Edit\x20','RT\x202.0\x20Validate:','segment:parent:list','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','personalization','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','test','label','segment:parent:fields','parentSegment','⚡\x20Enabled','using\x20the\x20default\x20path:\x20','tdx\x20ps\x20preview\x20','utf-8','segment:parent:preview','parent_id','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\x20Please\x20manually\x20merge\x20or\x20remove\x20','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','645680WUQaBG','errors','Options:\x0a','\x27\x20is\x20up\x20to\x20date','apply','Attributes:','/{name}.yml\x0a','ps:pz:init','sourceTableError','segment:parent:create','Errors:','match','cyan','\x5c$&','Fetching\x20behavior\x20list...','{\x0a\x20\x20\x22database\x22:\x20\x22','\x0aNo\x20sample\x20data\x20available','.yml','addBehaviors','addBehaviorsFile','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20Note:\x20','\x20No\x20changes\x20-\x20','/app/dw/parentSegments/','\x20\x20\x20\x20-\x20','\x0a\x20\x20\x20\x20}','4217136LskQeD','length','master','population','sort','endsWith','message','Columns:','double','\x20rows)','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','toFixed','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','/\x20→\x20','name','attributes','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','\x20service','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','red','displaySummary','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20parent\x20segment','createParent','7239768MUDKiz','\x20configured','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','displayValidateResults','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','database','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','displayPreviewHints','push','Create\x20parent\x20segment\x20\x27','\x20\x20No\x20sample\x20data\x20available','ps:rt:validate','segment:parent:validate','repeat','Database:\x20','processedRows','Overwrite\x20\x27','trim','\x0aError:','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','workflowId','trigger_event','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:push','\x22,\x20\x22type\x22:\x20\x22','\x20[Job\x20ID:\x20','open','interval','\x20to\x20configure\x20your\x20personalization\x20service','customers','No\x20parent\x20segments\x20found','<database>.<table>','List\x20available\x20fields\x20for\x20segmentation','Show\x20parent\x20segment\x20schema\x20(column\x20types)','getParentFull','Output\x20file:\x20','✔\x20No\x20changes\x20-\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','2353085aGUaOO','events','behaviors','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20tdx\x20wf\x20attempt\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','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','web','dirname','ps:rt:list','workflowAttemptId','listFields','Master\x20+\x20Attributes','setJobId','behavior_','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','sampleData','✔\x20Query\x20completed:\x20Processed\x20','Aborted.','Apply\x20changes\x20to\x20\x27','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','formatSchemaJson','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','pullParentYaml','Error:\x20Parent\x20segment\x20name\x20is\x20required','parent_segment','My\x20Service','sections','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Error:\x20File\x20not\x20found:\x20','keys','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','limit','\x20parent\x20segment\x20\x27','schemaError','site','column','-1d','Created','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Available\x20behaviors:','collectSchema','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','/sessions/','true','single','td_client_id','\x20--interval\x20','segment','displayRealtimeInfo','Status:','SELECT\x20*\x20FROM\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','SQL\x20query:\x0a','\x0aChanges\x20to\x20\x27','Events:','darwin','✘\x20Failed\x20to\x20rename\x20directory:\x20','matchedCount','Error\x20parsing\x20YAML:\x20','Attempt:','pushParentYaml','type','tdx\x20ps\x20push\x20','last_page_viewed','Personalization:','Validate:','reduce','list','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x0aNew\x20parent\x20segment\x20\x27','\x20Context\x20set:\x20','Updating'];a29_0x480a=function(){return _0x2f1d88;};return a29_0x480a();}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x1c2);[a29_0x406eed(0x144)]=a29_0x406eed(0x136);async[a29_0x406eed(0x191)](_0x1ffd41){const _0xae06e2=a29_0x406eed,{options:_0x3a86ee,args:_0x3e71d2,tdx:_0xe395c0}=_0x1ffd41,_0x49beb4=_0x3a86ee,_0x3bf0e2=_0x3e71d2[0x0]||_0x3a86ee[_0xae06e2(0x1bd)];if(!_0x3bf0e2)return showParentSegmentNotSetError(_0xae06e2(0xe5)+_0xae06e2(0x148)+_0xae06e2(0x155)+_0xae06e2(0x1a0)+_0xae06e2(0x173)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0xae06e2(0x235)),0x1;if(!_0x49beb4[_0xae06e2(0x1e7)]&&!_0x49beb4[_0xae06e2(0xfd)]&&!_0x49beb4[_0xae06e2(0x171)]&&!_0x49beb4['enriched'])return console['error'](a29_0x4372dd[_0xae06e2(0x1f8)](_0xae06e2(0x134))),console[_0xae06e2(0x13c)](_0xae06e2(0x1de)),console[_0xae06e2(0x13c)](_0xae06e2(0x117)),console['error'](_0xae06e2(0x1c8)),console['error'](_0xae06e2(0x1a4)),console[_0xae06e2(0x13c)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0xae06e2(0x13c)](_0xae06e2(0x1b6)),0x1;const _0x5b1609=resolveYamlFile(_0x3bf0e2);if(!existsSync(_0x5b1609))return showFileNotFoundError(_0x5b1609,_0x3bf0e2),0x1;_0x49beb4[_0xae06e2(0x105)]&&(console[_0xae06e2(0x13c)](_0xae06e2(0x143)+_0x49beb4['site']),console[_0xae06e2(0x13c)](_0xae06e2(0x127)+_0x5b1609));let _0x28d253;try{_0x28d253=readFileSync(_0x5b1609,'utf-8');}catch(_0x4bf3c4){const _0x19e488=_0x4bf3c4 instanceof Error?_0x4bf3c4['message']:String(_0x4bf3c4);return console[_0xae06e2(0x13c)](_0xae06e2(0x194)+_0x19e488),0x1;}let _0x4994db;try{_0x4994db=parseDef(_0x28d253);}catch(_0x13bfed){const _0x25ba1c=_0x13bfed instanceof Error?_0x13bfed[_0xae06e2(0x1eb)]:String(_0x13bfed);return console[_0xae06e2(0x13c)](a29_0x4372dd[_0xae06e2(0x1f8)](_0xae06e2(0xd7)+_0x25ba1c)),0x1;}if(_0x49beb4[_0xae06e2(0xfd)]===!![]||_0x49beb4[_0xae06e2(0xfd)]===''){const _0x794834=_0x4994db[_0xae06e2(0x1f4)]?.[_0xae06e2(0x122)](_0x2d3a44=>_0x2d3a44[_0xae06e2(0x1f3)])||[];if(_0x794834[_0xae06e2(0x1e6)]===0x0)console[_0xae06e2(0x13c)](a29_0x4372dd[_0xae06e2(0x1f8)](_0xae06e2(0x1a1)));else{console['error'](a29_0x4372dd[_0xae06e2(0x1f8)](_0xae06e2(0x162))),console['error'](_0xae06e2(0xff));for(const _0x34daab of _0x794834){console['error']('\x20\x20'+a29_0x4372dd[_0xae06e2(0x1d5)](_0x34daab));}console[_0xae06e2(0x13c)](_0xae06e2(0x1c7)+_0x3bf0e2+_0xae06e2(0xf1)+_0x794834[0x0]+'\x22');}return 0x1;}if(_0x49beb4['behavior']===!![]||_0x49beb4[_0xae06e2(0x171)]===''){const _0x5183c6=_0x4994db[_0xae06e2(0x226)]?.[_0xae06e2(0x122)](_0x78148c=>_0x78148c[_0xae06e2(0x1f3)])||[];if(_0x5183c6[_0xae06e2(0x1e6)]===0x0)console[_0xae06e2(0x13c)](a29_0x4372dd['red'](_0xae06e2(0x1c6)));else{console[_0xae06e2(0x13c)](a29_0x4372dd['red'](_0xae06e2(0x1dd))),console[_0xae06e2(0x13c)](_0xae06e2(0xc4));for(const _0x1313ab of _0x5183c6){console[_0xae06e2(0x13c)]('\x20\x20'+a29_0x4372dd[_0xae06e2(0x1d5)](_0x1313ab));}console[_0xae06e2(0x13c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x3bf0e2+_0xae06e2(0x185)+_0x5183c6[0x0]+'\x22');}return 0x1;}const _0x2280ce=createCommandSpinner(a29_0x4372dd[_0xae06e2(0x181)](_0xae06e2(0xf0)),{'verbose':_0x49beb4[_0xae06e2(0x105)]});_0x2280ce[_0xae06e2(0x14f)]();const _0x4e8d38={'onProgress':_0x45e447=>{const _0x4dfcd8=_0xae06e2;_0x2280ce[_0x4dfcd8(0x19b)]=formatProgressMessage(_0x45e447);}};if(_0x49beb4[_0xae06e2(0x1e7)])_0x4e8d38[_0xae06e2(0x1e7)]=!![];if(_0x49beb4[_0xae06e2(0xfd)]&&typeof _0x49beb4[_0xae06e2(0xfd)]===_0xae06e2(0x103))_0x4e8d38[_0xae06e2(0xfd)]=_0x49beb4[_0xae06e2(0xfd)];if(_0x49beb4[_0xae06e2(0x171)]&&typeof _0x49beb4[_0xae06e2(0x171)]==='string')_0x4e8d38[_0xae06e2(0x171)]=_0x49beb4['behavior'];if(_0x49beb4[_0xae06e2(0x1a3)])_0x4e8d38[_0xae06e2(0x1a3)]=!![];if(_0x49beb4[_0xae06e2(0x219)])_0x4e8d38[_0xae06e2(0x219)]=_0x49beb4[_0xae06e2(0x219)];let _0x25acf4;try{_0x25acf4=await _0xe395c0[_0xae06e2(0xcc)][_0xae06e2(0x11a)](_0x28d253,_0x4e8d38),_0x2280ce[_0xae06e2(0x13a)]();}catch(_0x3297ed){_0x2280ce[_0xae06e2(0x13a)]();throw _0x3297ed;}return await this[_0xae06e2(0x1b2)](_0x25acf4,{'master':_0x49beb4[_0xae06e2(0x1e7)],'attribute':typeof _0x49beb4['attribute']===_0xae06e2(0x103)?_0x49beb4[_0xae06e2(0xfd)]:undefined,'behavior':typeof _0x49beb4[_0xae06e2(0x171)]===_0xae06e2(0x103)?_0x49beb4[_0xae06e2(0x171)]:undefined,'enriched':_0x49beb4['enriched']}),_0x25acf4[_0xae06e2(0x11e)]?0x0:0x1;}async['displayPreviewResults'](_0x4fa352,_0x3cbf6a){const _0x3bf222=a29_0x406eed;console[_0x3bf222(0x13c)]('\x0a'+a29_0x4372dd[_0x3bf222(0x150)](_0x3bf222(0xec))+'\x20'+_0x4fa352[_0x3bf222(0x1f3)]),console[_0x3bf222(0x13c)]('═'[_0x3bf222(0x20b)](0x3c));if(_0x3cbf6a[_0x3bf222(0x1e7)]&&_0x4fa352[_0x3bf222(0x236)]){const _0x3f9883=a29_0x4372dd[_0x3bf222(0x181)](_0x3bf222(0xf8))+'\x20'+a29_0x4372dd[_0x3bf222(0x150)](_0x4fa352[_0x3bf222(0x1e7)]['database']+'.'+_0x4fa352[_0x3bf222(0x1e7)][_0x3bf222(0x1ac)]);await this[_0x3bf222(0x104)](_0x3f9883,_0x4fa352['sampleData']);}else{if(_0x3cbf6a[_0x3bf222(0xfd)]&&_0x4fa352[_0x3bf222(0x236)]){const _0x109701=a29_0x4372dd[_0x3bf222(0x181)](_0x3bf222(0x1ae))+'\x20'+a29_0x4372dd[_0x3bf222(0x150)](_0x3cbf6a[_0x3bf222(0xfd)]);await this['displaySampleData'](_0x109701,_0x4fa352[_0x3bf222(0x236)]);}else{if(_0x3cbf6a[_0x3bf222(0x171)]&&_0x4fa352['sampleData']){const _0x4ec543=a29_0x4372dd[_0x3bf222(0x181)](_0x3bf222(0x12e))+'\x20'+a29_0x4372dd[_0x3bf222(0x150)](_0x3cbf6a[_0x3bf222(0x171)]);await this[_0x3bf222(0x104)](_0x4ec543,_0x4fa352[_0x3bf222(0x236)]);}else{if(_0x3cbf6a['enriched']&&_0x4fa352[_0x3bf222(0x236)]){const _0x325a08=a29_0x4372dd[_0x3bf222(0x181)]('Enriched:')+'\x20'+a29_0x4372dd[_0x3bf222(0x150)](_0x3bf222(0x232));await this['displaySampleData'](_0x325a08,_0x4fa352[_0x3bf222(0x236)]);}else!_0x4fa352[_0x3bf222(0x236)]&&console[_0x3bf222(0x13c)](_0x3bf222(0x1d9));}}}if(_0x4fa352[_0x3bf222(0x1ca)][_0x3bf222(0x1e6)]>0x0){console[_0x3bf222(0x13c)]('─'[_0x3bf222(0x20b)](0x3c)),console['error']('\x0a'+a29_0x4372dd[_0x3bf222(0x1f8)]('Errors:'));for(const _0x4a2c8e of _0x4fa352[_0x3bf222(0x1ca)]){console[_0x3bf222(0x13c)]('\x20\x20'+a29_0x4372dd['red']('•')+'\x20'+_0x4a2c8e);}}}async['displaySampleData'](_0x1a482c,_0x4c863f){const _0x200c7d=a29_0x406eed;if(_0x4c863f['length']===0x0){console['error']('\x0a'+_0x1a482c),console[_0x200c7d(0x13c)](_0x200c7d(0x208));return;}console[_0x200c7d(0x13c)]('\x0a'+_0x1a482c);const _0x4c7c48=Object[_0x200c7d(0x244)](_0x4c863f[0x0])[_0x200c7d(0x122)](_0x42cb5a=>({'name':_0x42cb5a,'type':typeof _0x4c863f[0x0][_0x42cb5a]===_0x200c7d(0x10a)?_0x200c7d(0x1ed):_0x200c7d(0x1a9)})),_0x2bd809={'queryId':'preview','columns':_0x4c7c48,'data':_0x4c863f,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4c863f['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x13dbe1=formatAsTable(_0x2bd809,_0x4c863f['length'],!![]);await writeOutput(_0x13dbe1,undefined,_0x200c7d(0x1ac));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x406eed(0x1f3)]='segment:parent:run';[a29_0x406eed(0x144)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x406eed(0x191)](_0x3039e2){const _0x333c1c=a29_0x406eed,{options:_0x3fbcd6,args:_0x1c8213,tdx:_0x21fb7e}=_0x3039e2,_0xbc0de5=_0x3fbcd6,_0x1775db=_0x1c8213[0x0]||_0x3fbcd6[_0x333c1c(0x1bd)];if(!_0x1775db)return showParentSegmentNotSetError(_0x333c1c(0x100)+_0x333c1c(0xc3)),0x1;const _0x4b45c6=resolveYamlFile(_0x1775db);if(existsSync(_0x4b45c6)){_0xbc0de5[_0x333c1c(0x105)]&&console[_0x333c1c(0x13c)]('Found\x20YAML\x20file:\x20'+_0x4b45c6);let _0x577d19;try{_0x577d19=readFileSync(_0x4b45c6,'utf-8');}catch(_0x494bbb){const _0xa12616=_0x494bbb instanceof Error?_0x494bbb[_0x333c1c(0x1eb)]:String(_0x494bbb);return console[_0x333c1c(0x13c)](_0x333c1c(0x194)+_0xa12616),0x1;}const _0x3dc609=await withSpinner(_0x333c1c(0x146),()=>_0x21fb7e['segment'][_0x333c1c(0xd9)](_0x577d19),{'verbose':_0xbc0de5['verbose']}),_0x12a770=_0x3dc609[_0x333c1c(0x152)],{isNew:_0x54c904,name:_0x5d7ba8,hasChanges:_0x144427,diffFormatted:_0x6b2c6}=_0x12a770;if(_0x144427){_0x54c904?console[_0x333c1c(0x13c)](_0x333c1c(0xe2)+_0x5d7ba8+'\x27:'):console[_0x333c1c(0x13c)](_0x333c1c(0x12d)+_0x5d7ba8+'\x27:');console['error']('─'[_0x333c1c(0x20b)](0x3c)),console['error'](_0x6b2c6),console[_0x333c1c(0x13c)]('─'['repeat'](0x3c));const _0x1546a9=_0x54c904?_0x333c1c(0x207)+_0x5d7ba8+'\x27\x20and\x20run\x20workflow?':_0x333c1c(0x239)+_0x5d7ba8+'\x27\x20and\x20run\x20workflow?';if(!_0xbc0de5[_0x333c1c(0x156)]){if(!isInteractive())return console[_0x333c1c(0x13c)](a29_0x4372dd['red'](_0x333c1c(0x210)),_0x333c1c(0x178)),console[_0x333c1c(0x13c)](a29_0x4372dd[_0x333c1c(0x181)](_0x333c1c(0x13b))),0x1;const _0x53fdf9=await confirmKey(_0x1546a9);if(!_0x53fdf9)return console[_0x333c1c(0x13c)](a29_0x4372dd[_0x333c1c(0x1a2)](_0x333c1c(0x238))),0x1;}const _0x44d725=_0x54c904?'Creating':_0x333c1c(0xe4);await withSpinner(_0x44d725+'\x20parent\x20segment\x20\x27'+_0x5d7ba8+_0x333c1c(0x165),()=>_0x12a770[_0x333c1c(0x1cd)](),{'verbose':_0xbc0de5[_0x333c1c(0x105)]});const _0xad5ffd=_0x54c904?_0x333c1c(0xc2):'Updated';console[_0x333c1c(0x13c)]('✔\x20'+_0xad5ffd+_0x333c1c(0xbd)+_0x5d7ba8+'\x27');}else console[_0x333c1c(0x13c)](_0x333c1c(0x222)+_0x5d7ba8+_0x333c1c(0x1cc));}const _0x5eeda8=await withSpinner(_0x333c1c(0x101)+_0x1775db+_0x333c1c(0x165),()=>_0x21fb7e['segment']['runParent'](_0x1775db),{'verbose':_0xbc0de5['verbose']}),_0x3e34ba=_0x5eeda8[_0x333c1c(0x152)],_0x4abe38=getConsoleUrl(_0xbc0de5[_0x333c1c(0xbf)],_0x333c1c(0x13f)+_0x3e34ba[_0x333c1c(0x212)]+_0x333c1c(0xc7)+_0x3e34ba[_0x333c1c(0x10c)]+'/attempt/'+_0x3e34ba[_0x333c1c(0x230)]);return console['error']('\x0a✔\x20Workflow\x20started'),console[_0x333c1c(0x13c)]('\x20\x20'+a29_0x4372dd[_0x333c1c(0x181)]('Audience\x20ID:')+'\x20'+_0x3e34ba[_0x333c1c(0xe8)]),console[_0x333c1c(0x13c)]('\x20\x20'+a29_0x4372dd[_0x333c1c(0x181)](_0x333c1c(0xce))+'\x20'+_0x3e34ba[_0x333c1c(0x18b)]),console[_0x333c1c(0x13c)]('\x20\x20'+a29_0x4372dd[_0x333c1c(0x181)](_0x333c1c(0x183))+'\x20'+_0x3e34ba[_0x333c1c(0x10c)]),console[_0x333c1c(0x13c)]('\x20\x20'+a29_0x4372dd[_0x333c1c(0x181)](_0x333c1c(0xd8))+'\x20'+_0x3e34ba['workflowAttemptId']),console[_0x333c1c(0x13c)]('\x20\x20'+_0x4abe38),console[_0x333c1c(0x13c)]('\x0a'+a29_0x4372dd[_0x333c1c(0x181)](_0x333c1c(0x179))+_0x333c1c(0x228)+_0x3e34ba['workflowAttemptId']+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x1bc);[a29_0x406eed(0x144)]=a29_0x406eed(0x21e);async[a29_0x406eed(0x191)](_0x37482d){const _0x4f4683=a29_0x406eed,{options:_0xdcceb1,args:_0x4fade2,tdx:_0x3da101}=_0x37482d,_0x52a4ec=_0x4fade2[0x0]||_0xdcceb1[_0x4f4683(0x1bd)];if(!_0x52a4ec)return showParentSegmentNotSetError(_0x4f4683(0x204)+_0x4f4683(0x23c)),0x1;_0xdcceb1[_0x4f4683(0x105)]&&(console[_0x4f4683(0x13c)](_0x4f4683(0x143)+_0xdcceb1['site']),console[_0x4f4683(0x13c)](_0x4f4683(0x164)+_0x52a4ec));const _0x424a65=await withSpinner(_0x4f4683(0x187)+_0x52a4ec+_0x4f4683(0x165),()=>_0x3da101['segment'][_0x4f4683(0x231)](_0x52a4ec),{'verbose':_0xdcceb1['verbose']}),_0x2475ac=_0x424a65[_0x4f4683(0x152)];console[_0x4f4683(0x13c)](_0x4f4683(0x149)+_0x2475ac[_0x4f4683(0x1e6)]+'\x20field'+(_0x2475ac[_0x4f4683(0x1e6)]!==0x1?'s':''));if(_0xdcceb1[_0x4f4683(0x1ad)]||_0xdcceb1[_0x4f4683(0x17e)])return await handleSDKOutput(_0x2475ac,_0xdcceb1),0x0;return displayFieldsHumanReadable(_0x2475ac,_0x52a4ec),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']='segment:parent:view';[a29_0x406eed(0x144)]='Show\x20parent\x20segment\x20details';async['execute'](_0x5322b7){const _0x20cf4c=a29_0x406eed,{options:_0xd221fd,args:_0x29910e,tdx:_0x457756}=_0x5322b7,_0x3bed5e=_0xd221fd,_0x5e0f79=_0x29910e[0x0]||_0xd221fd[_0x20cf4c(0x1bd)];if(!_0x5e0f79)return showParentSegmentNotSetError(_0x20cf4c(0xc6)+_0x20cf4c(0x22a)+'Options:\x0a'+_0x20cf4c(0x242)),0x1;_0xd221fd[_0x20cf4c(0x105)]&&(console[_0x20cf4c(0x13c)](_0x20cf4c(0x143)+_0xd221fd[_0x20cf4c(0xbf)]),console['error'](_0x20cf4c(0x164)+_0x5e0f79));const _0x4fd750=await withSpinner(_0x20cf4c(0x19e)+_0x5e0f79+'\x27...',()=>_0x457756[_0x20cf4c(0xcc)][_0x20cf4c(0x220)](_0x5e0f79),{'verbose':_0xd221fd[_0x20cf4c(0x105)]}),_0x11dae2=_0x4fd750[_0x20cf4c(0x152)];if(_0x3bed5e[_0x20cf4c(0x22d)]){const _0x269969=getConsoleNextUrl(_0x3bed5e[_0x20cf4c(0xbf)],'/app/dw/parentSegments/'+_0x11dae2['id']);return console['error'](a29_0x4372dd[_0x20cf4c(0x15d)]('✔')+'\x20Opening\x20'+a29_0x4372dd['cyan'](_0x269969)),openBrowser(_0x269969),0x0;}return await handleSingleObjectOutput(_0x11dae2,_0xd221fd),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x406eed(0x1f3)]='segment:parent:desc';[a29_0x406eed(0x144)]=a29_0x406eed(0x21f);async[a29_0x406eed(0x191)](_0x1cd390){const _0xa2dbc0=a29_0x406eed,{options:_0x5c4cf8,args:_0x4ed24c,tdx:_0x46fe03}=_0x1cd390,_0x494f15=_0x5c4cf8,_0x3c7098=_0x4ed24c[0x0]||_0x5c4cf8[_0xa2dbc0(0x1bd)];if(!_0x3c7098)return showParentSegmentNotSetError(_0xa2dbc0(0xd0)+_0xa2dbc0(0xfc)+'Options:\x0a'+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x5c4cf8[_0xa2dbc0(0x105)]&&(console[_0xa2dbc0(0x13c)](_0xa2dbc0(0x143)+_0x5c4cf8[_0xa2dbc0(0xbf)]),console['error'](_0xa2dbc0(0x164)+_0x3c7098));const _0x2c7705=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3c7098+'\x27...',()=>_0x46fe03[_0xa2dbc0(0xcc)][_0xa2dbc0(0x199)](_0x3c7098),{'verbose':_0x5c4cf8[_0xa2dbc0(0x105)]}),_0x53a810=_0x2c7705[_0xa2dbc0(0x152)],_0x3f2886=_0x46fe03['segment']['getOutputDatabaseName'](_0x53a810);if(_0x494f15[_0xa2dbc0(0x19c)]){const _0xfd87f4=await this[_0xa2dbc0(0xc5)](_0x1cd390,_0x3c7098,_0x53a810,_0x3f2886),_0x35b644=this[_0xa2dbc0(0x23b)](_0xfd87f4);writeFileSync(_0x494f15[_0xa2dbc0(0x19c)],_0x35b644);const _0x169524=_0xfd87f4[_0xa2dbc0(0x21b)][_0xa2dbc0(0x138)]['length']+_0xfd87f4[_0xa2dbc0(0x226)][_0xa2dbc0(0xdf)]((_0x559211,_0xce97cd)=>_0x559211+_0xce97cd[_0xa2dbc0(0x138)][_0xa2dbc0(0x1e6)],0x0),_0x4a5886=_0xfd87f4['behaviors'][_0xa2dbc0(0x153)](_0x28d0d7=>_0x28d0d7[_0xa2dbc0(0x138)][_0xa2dbc0(0x1e6)]===0x0)[_0xa2dbc0(0x1e6)];return console['log']('Schema\x20saved\x20to\x20'+_0x494f15['output']),console[_0xa2dbc0(0x135)](_0xa2dbc0(0x116)+_0x3f2886),console[_0xa2dbc0(0x135)](_0xa2dbc0(0x128)+_0xfd87f4[_0xa2dbc0(0x226)][_0xa2dbc0(0x1e6)]+_0xa2dbc0(0x10e)),console[_0xa2dbc0(0x135)](_0xa2dbc0(0x111)+_0x169524+_0xa2dbc0(0x12b)),_0x4a5886>0x0&&console[_0xa2dbc0(0x135)](_0xa2dbc0(0x1e0)+_0x4a5886+_0xa2dbc0(0x22b)),0x0;}console[_0xa2dbc0(0x13c)]('\x0a'+a29_0x4372dd[_0xa2dbc0(0x150)](_0xa2dbc0(0x17c))+'\x20'+a29_0x4372dd[_0xa2dbc0(0x1d5)](_0x3f2886));const _0x44028f=await withSpinner(_0xa2dbc0(0x18a),()=>_0x46fe03[_0xa2dbc0(0xcc)]['getParentSQL'](_0x53a810),{'verbose':_0x5c4cf8[_0xa2dbc0(0x105)]});console['error']('\x0a'+a29_0x4372dd[_0xa2dbc0(0x150)](_0xa2dbc0(0x21b))+'\x20'+a29_0x4372dd[_0xa2dbc0(0x181)]('('+_0x3f2886+_0xa2dbc0(0x106)));const _0x44fd58=await executeSchemaQuery(_0x44028f[_0xa2dbc0(0x152)],_0x46fe03,_0x5c4cf8);await handleQueryOutput(_0x44fd58,_0x5c4cf8);const _0x5889a6=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x46fe03[_0xa2dbc0(0xcc)]['getBehaviorNames'](_0x53a810),{'verbose':_0x5c4cf8[_0xa2dbc0(0x105)]});for(const _0x296aa4 of _0x5889a6[_0xa2dbc0(0x152)]){const _0x519263=_0xa2dbc0(0x234)+_0x296aa4[_0xa2dbc0(0x18e)]()[_0xa2dbc0(0x16a)](/\s+/g,'_'),_0x385232=_0xa2dbc0(0xcf)+_0x3f2886+'.'+_0x519263;console[_0xa2dbc0(0x13c)]('\x0a'+a29_0x4372dd[_0xa2dbc0(0x150)](_0x296aa4)+'\x20'+a29_0x4372dd[_0xa2dbc0(0x181)]('('+_0x3f2886+'.'+_0x519263+')'));try{const _0x255ca5=await executeSchemaQuery(_0x385232,_0x46fe03,_0x5c4cf8);await handleQueryOutput(_0x255ca5,_0x5c4cf8);}catch{console[_0xa2dbc0(0x13c)](a29_0x4372dd[_0xa2dbc0(0x1a2)](_0xa2dbc0(0x245)));}}return 0x0;}async[a29_0x406eed(0xc5)](_0x31ef1b,_0x479c82,_0x259118,_0xf2f8fd){const _0x1a46ae=a29_0x406eed,{options:_0x5a703d,tdx:_0x269a83}=_0x31ef1b,_0x4aecf1=await withSpinner(_0x1a46ae(0x18a),()=>_0x269a83[_0x1a46ae(0xcc)][_0x1a46ae(0x17d)](_0x259118),{'verbose':_0x5a703d[_0x1a46ae(0x105)]}),_0x2abb9a=await executeSchemaQuery(_0x4aecf1['data'],_0x269a83,_0x5a703d),_0x30acd9=_0x2abb9a[_0x1a46ae(0x152)][_0x1a46ae(0x122)](_0x284e83=>({'name':_0x284e83['column_name'],'type':_0x284e83[_0x1a46ae(0x16c)]})),_0x1a8705=await withSpinner(_0x1a46ae(0x1d7),()=>_0x269a83['segment'][_0x1a46ae(0x158)](_0x259118),{'verbose':_0x5a703d[_0x1a46ae(0x105)]}),_0x1026cb=[];for(const _0x7782ba of _0x1a8705['data']){const _0x31d3b9='behavior_'+_0x7782ba[_0x1a46ae(0x18e)]()['replace'](/\s+/g,'_'),_0x2104a5=_0x1a46ae(0xcf)+_0xf2f8fd+'.'+_0x31d3b9;let _0x258e4a=[];try{const _0x21ab5c=await executeSchemaQuery(_0x2104a5,_0x269a83,_0x5a703d);_0x258e4a=_0x21ab5c[_0x1a46ae(0x152)][_0x1a46ae(0x122)](_0x3a080a=>({'name':_0x3a080a['column_name'],'type':_0x3a080a[_0x1a46ae(0x16c)]}));}catch{}_0x1026cb[_0x1a46ae(0x206)]({'table':_0x31d3b9,'columns':_0x258e4a});}return{'database':_0xf2f8fd,'parent_segment':_0x479c82,'parent_id':_0x259118,'customers':{'table':_0x1a46ae(0x21b),'columns':_0x30acd9},'behaviors':_0x1026cb};}['formatSchemaJson'](_0x1abc05){const _0xc9985d=a29_0x406eed,_0xe54d5a=_0x3fc3c7=>{const _0xa7cb97=a29_0x4dab;if(_0x3fc3c7['length']===0x0)return'[]';const _0xc0fd80=_0x3fc3c7['map'](_0x306e36=>_0xa7cb97(0xe1)+_0x306e36[_0xa7cb97(0x1f3)]+_0xa7cb97(0x216)+_0x306e36[_0xa7cb97(0xda)]+_0xa7cb97(0x13e));return'[\x0a'+_0xc0fd80[_0xa7cb97(0x184)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x3c0ef2=_0x1abc05[_0xc9985d(0x226)][_0xc9985d(0x122)](_0x3b6561=>{const _0x293665=_0xc9985d;return _0x293665(0x11b)+_0x3b6561[_0x293665(0x1ac)]+_0x293665(0x1f1)+_0xe54d5a(_0x3b6561[_0x293665(0x138)])[_0x293665(0x16a)](/^/gm,'\x20\x20')[_0x293665(0x20f)]()+_0x293665(0x1e4);})[_0xc9985d(0x184)](',\x0a');return _0xc9985d(0x1d8)+_0x1abc05[_0xc9985d(0x203)]+_0xc9985d(0x1b0)+_0x1abc05[_0xc9985d(0x23f)]+_0xc9985d(0x1f5)+_0x1abc05[_0xc9985d(0x1c3)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1abc05[_0xc9985d(0x21b)][_0xc9985d(0x1ac)]+_0xc9985d(0x227)+_0xe54d5a(_0x1abc05[_0xc9985d(0x21b)][_0xc9985d(0x138)])[_0xc9985d(0x16a)](/^/gm,'\x20\x20')[_0xc9985d(0x20f)]()+_0xc9985d(0xfa)+_0x3c0ef2+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{['name']='segment:parent:sql';['description']=a29_0x406eed(0x109);async['execute'](_0x52bb56){const _0x327c14=a29_0x406eed,{options:_0x4f3079,args:_0x511664,tdx:_0x5693a6}=_0x52bb56,_0x2936ef=_0x511664[0x0]||_0x4f3079[_0x327c14(0x1bd)];if(!_0x2936ef)return showParentSegmentNotSetError(_0x327c14(0x211)+_0x327c14(0x1f7)),0x1;_0x4f3079['verbose']&&(console[_0x327c14(0x13c)](_0x327c14(0x143)+_0x4f3079['site']),console['error']('Parent\x20segment:\x20'+_0x2936ef));const _0x21168c=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2936ef+_0x327c14(0x165),()=>_0x5693a6['segment']['resolveParentId'](_0x2936ef),{'verbose':_0x4f3079[_0x327c14(0x105)]}),_0x156586=_0x21168c[_0x327c14(0x152)],_0x6a014e=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2936ef+_0x327c14(0x165),()=>_0x5693a6['segment']['getParentSQL'](_0x156586),{'verbose':_0x4f3079[_0x327c14(0x105)]}),_0x7d3cd3=_0x6a014e[_0x327c14(0x152)];return _0x4f3079[_0x327c14(0xf4)]===_0x327c14(0x1ad)||_0x4f3079[_0x327c14(0xf4)]===_0x327c14(0x17e)?await handleSDKOutput([{'sql':_0x7d3cd3}],_0x4f3079):console[_0x327c14(0x135)](_0x7d3cd3),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x196);[a29_0x406eed(0x144)]=a29_0x406eed(0xf9);async[a29_0x406eed(0x191)](_0x1529a6){const _0x2ec823=a29_0x406eed,{options:_0x4591d4,args:_0x279896,tdx:_0x1e0688}=_0x1529a6,_0x58d672=_0x279896[0x0]||_0x4591d4['parentSegment'];if(!_0x58d672)return showParentSegmentNotSetError(_0x2ec823(0x154)+_0x2ec823(0x229)),0x1;_0x4591d4[_0x2ec823(0x105)]&&(console[_0x2ec823(0x13c)](_0x2ec823(0x143)+_0x4591d4[_0x2ec823(0xbf)]),console['error'](_0x2ec823(0x164)+_0x58d672));const _0x311171=await withSpinner(_0x2ec823(0xf5)+_0x58d672+_0x2ec823(0x165),()=>_0x1e0688[_0x2ec823(0xcc)][_0x2ec823(0x199)](_0x58d672),{'verbose':_0x4591d4[_0x2ec823(0x105)]}),_0x5afcaa=_0x311171[_0x2ec823(0x152)],_0x1d7cd8=await withSpinner(_0x2ec823(0xe6)+_0x58d672+'\x27...',()=>_0x1e0688['segment']['getParentSQL'](_0x5afcaa),{'verbose':_0x4591d4[_0x2ec823(0x105)]});let _0x49f851=_0x1d7cd8[_0x2ec823(0x152)];const _0x35196b=resolveLimit(_0x4591d4[_0x2ec823(0xbc)],DEFAULT_DISPLAY_LIMIT),_0x591503=/\bLIMIT\s+\d+/i[_0x2ec823(0x1ba)](_0x49f851);!_0x591503&&(_0x49f851=_0x49f851[_0x2ec823(0x20f)]()['replace'](/;+$/,''),_0x49f851=_0x2ec823(0x214)+_0x49f851+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x35196b);_0x4591d4[_0x2ec823(0x105)]&&console[_0x2ec823(0x13c)](_0x2ec823(0xd1)+_0x49f851);const _0xd15e15=await withProgressSpinner(_0x2ec823(0x12a),async _0x171223=>{const _0x27c3bb=_0x2ec823,_0x591c23=await _0x1e0688['query'][_0x27c3bb(0x191)](_0x49f851,{'catalog':'td','schema':_0x27c3bb(0x182),'onJobId':_0x245eec=>{const _0x3ee34f=_0x27c3bb;_0x171223[_0x3ee34f(0x233)](_0x245eec);}});return _0x591c23;},{'verbose':_0x4591d4[_0x2ec823(0x105)]}),_0x54ed42=_0xd15e15['data'],_0x3eeb49=_0x54ed42['jobId']?_0x2ec823(0x217)+_0x54ed42['jobId']+']':'';return console[_0x2ec823(0x13c)](_0x2ec823(0x237)+_0x54ed42[_0x2ec823(0x14d)][_0x2ec823(0x20d)]['toLocaleString']()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x54ed42[_0x2ec823(0x14d)][_0x2ec823(0x115)])+_0x3eeb49)),await handleQueryOutput(_0x54ed42,_0x4591d4),0x0;}}export class PSRtListCommand extends BaseCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x22f);['description']='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async[a29_0x406eed(0x191)](_0x5ca340){const _0x210281=a29_0x406eed,{options:_0x1b215e,args:_0x4f24c3,tdx:_0x419512}=_0x5ca340,_0x1ec84c=_0x4f24c3[0x0],_0x5691c9=await withSpinner(_0x1ec84c?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x1ec84c+_0x210281(0x165):_0x210281(0x170),()=>_0x419512[_0x210281(0x123)][_0x210281(0xe0)](),{'verbose':_0x1b215e[_0x210281(0x105)]});let _0xa44759=_0x5691c9['data'][_0x210281(0x153)](_0x537056=>_0x537056['realtime_enabled']);if(_0x1ec84c){const _0x5ed7b0=_0x1ec84c[_0x210281(0x16a)](/[.+^${}()|[\]\\]/g,_0x210281(0x1d6))[_0x210281(0x16a)](/\*/g,'.*')[_0x210281(0x16a)](/\?/g,'.'),_0x10e887=new RegExp('^'+_0x5ed7b0+'$','i');_0xa44759=_0xa44759[_0x210281(0x153)](_0x4e1168=>_0x10e887[_0x210281(0x1ba)](_0x4e1168['name']));}_0xa44759[_0x210281(0x1e9)]((_0x5a2eb1,_0x22e8f9)=>_0x5a2eb1['name'][_0x210281(0xed)](_0x22e8f9[_0x210281(0x1f3)])),console['error'](_0x210281(0x149)+_0xa44759['length']+_0x210281(0x129)+(_0xa44759[_0x210281(0x1e6)]!==0x1?'s':''));const _0x586e73=_0x522cc6=>{const _0x3b155b=_0x210281;return getConsoleNextUrl(_0x1b215e[_0x3b155b(0xbf)],_0x3b155b(0x1e2)+_0x522cc6);};if(_0x1b215e[_0x210281(0xf4)]===_0x210281(0x1ad)||_0x1b215e[_0x210281(0xf4)]===_0x210281(0x17e)){const _0x11ab24=_0xa44759[_0x210281(0x122)](_0x5e06b5=>({..._0x5e06b5,'url':_0x586e73(_0x5e06b5['id'])}));await handleSDKOutput(_0x11ab24,_0x1b215e);}else{if(_0xa44759['length']===0x0)console[_0x210281(0x135)](_0x210281(0x121));else for(const _0x3847bb of _0xa44759){const _0x26185a=_0x3847bb['population']?a29_0x4372dd[_0x210281(0x181)]('\x20('+formatRows(_0x3847bb[_0x210281(0x1e8)])+')'):'',_0x165f27=hyperlink(_0x3847bb['name'],_0x586e73(_0x3847bb['id']));console[_0x210281(0x135)]('⚡\x20'+_0x165f27+_0x26185a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x209);['description']=a29_0x406eed(0x1ff);async[a29_0x406eed(0x191)](_0x37e0b8){const _0x2acaa4=a29_0x406eed,{options:_0x18226b,args:_0x5c216a,tdx:_0x4b2b0b}=_0x37e0b8,_0x3b2ac6=_0x5c216a[0x0]||_0x18226b[_0x2acaa4(0x1bd)];if(!_0x3b2ac6)return showParentSegmentNotSetError(_0x2acaa4(0x1ab)+_0x2acaa4(0x169)),0x1;const _0x2c08a4=resolveYamlFile(_0x3b2ac6);if(!existsSync(_0x2c08a4))return showFileNotFoundError(_0x2c08a4,_0x3b2ac6),0x1;let _0x18658b;try{_0x18658b=readFileSync(_0x2c08a4,_0x2acaa4(0x1c1));}catch(_0x2cc8cc){const _0x3b1107=_0x2cc8cc instanceof Error?_0x2cc8cc[_0x2acaa4(0x1eb)]:String(_0x2cc8cc);return console['error'](_0x2acaa4(0x194)+_0x3b1107),0x1;}const _0x8f9762=createCommandSpinner(a29_0x4372dd['dim'](_0x2acaa4(0xf3)),{'verbose':_0x18226b[_0x2acaa4(0x105)]});_0x8f9762['start']();const _0x161f86={'realtime':!![],'onProgress':_0x5d5f38=>{const _0x3615be=_0x2acaa4;_0x8f9762[_0x3615be(0x19b)]=formatProgressMessage(_0x5d5f38);}};let _0x42ca3d;try{_0x42ca3d=await _0x4b2b0b[_0x2acaa4(0xcc)][_0x2acaa4(0x151)](_0x18658b,_0x161f86),_0x8f9762[_0x2acaa4(0x13a)]();}catch(_0x158d26){_0x8f9762[_0x2acaa4(0x13a)]();throw _0x158d26;}console[_0x2acaa4(0x13c)]('\x0a'+a29_0x4372dd['bold'](_0x2acaa4(0x1b4))+'\x20'+_0x42ca3d[_0x2acaa4(0x1f3)]),console[_0x2acaa4(0x13c)]('═'[_0x2acaa4(0x20b)](0x3c)),displayRealtimeValidation(_0x42ca3d),console[_0x2acaa4(0x13c)]('─'[_0x2acaa4(0x20b)](0x3c));if(_0x42ca3d[_0x2acaa4(0x1ca)][_0x2acaa4(0x1e6)]>0x0){console['error']('\x0a'+a29_0x4372dd[_0x2acaa4(0x1f8)](_0x2acaa4(0x1d3)));for(const _0xb77aed of _0x42ca3d[_0x2acaa4(0x1ca)]){console[_0x2acaa4(0x13c)]('\x20\x20'+a29_0x4372dd[_0x2acaa4(0x1f8)]('•')+'\x20'+_0xb77aed);}}return _0x42ca3d['allValid']&&console[_0x2acaa4(0x13c)]('\x0a'+a29_0x4372dd[_0x2acaa4(0x15d)]('✔')+_0x2acaa4(0x16d)),_0x42ca3d['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x1af);[a29_0x406eed(0x144)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a29_0x406eed(0x191)](_0x274c60){const _0x1c2703=a29_0x406eed,{options:_0x3d1c99,args:_0x4307e3,tdx:_0x514118}=_0x274c60,_0x191690=_0x4307e3[0x0]||_0x3d1c99[_0x1c2703(0x1bd)];if(!_0x191690)return showParentSegmentNotSetError(_0x1c2703(0x23a)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x2b7988=await withSpinner(_0x1c2703(0xf5)+_0x191690+_0x1c2703(0x165),()=>_0x514118[_0x1c2703(0xcc)][_0x1c2703(0x199)](_0x191690),{'verbose':_0x3d1c99[_0x1c2703(0x105)]}),_0x506f86=_0x2b7988[_0x1c2703(0x152)],_0x9d266d=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x191690+'\x27...',()=>_0x514118[_0x1c2703(0x1b7)][_0x1c2703(0xe0)](_0x506f86),{'verbose':_0x3d1c99[_0x1c2703(0x105)]}),_0x464544=_0x9d266d['data'];console[_0x1c2703(0x13c)](_0x1c2703(0x149)+_0x464544['length']+_0x1c2703(0x126)+(_0x464544['length']!==0x1?'s':''));if(_0x3d1c99[_0x1c2703(0xf4)]===_0x1c2703(0x1ad)||_0x3d1c99[_0x1c2703(0xf4)]===_0x1c2703(0x17e))await handleSDKOutput(_0x464544,_0x3d1c99);else{if(_0x464544[_0x1c2703(0x1e6)]===0x0)console['log']('No\x20personalization\x20services\x20configured'),console[_0x1c2703(0x13c)](a29_0x4372dd[_0x1c2703(0x1d5)](_0x1c2703(0x140)));else for(const _0x40f8b6 of _0x464544){const _0x57c3b7=_0x40f8b6[_0x1c2703(0x241)]?.[_0x1c2703(0x1e6)]||0x0,_0x6fe5b2=_0x40f8b6[_0x1c2703(0x213)]?a29_0x4372dd[_0x1c2703(0x181)]('\x20trigger='+_0x40f8b6[_0x1c2703(0x213)]):'',_0x931a40=a29_0x4372dd['dim']('\x20('+_0x57c3b7+'\x20section'+(_0x57c3b7!==0x1?'s':'')+')');console[_0x1c2703(0x135)]('\x20\x20'+_0x40f8b6['name']+_0x6fe5b2+_0x931a40),_0x40f8b6[_0x1c2703(0x144)]&&console[_0x1c2703(0x135)](_0x1c2703(0x11d)+a29_0x4372dd['dim'](_0x40f8b6[_0x1c2703(0x144)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a29_0x406eed(0x1f3)]=a29_0x406eed(0x1d0);[a29_0x406eed(0x144)]=a29_0x406eed(0x22c);async['execute'](_0x10159e){const _0x36de4f=a29_0x406eed,{options:_0x426891,args:_0x4ac0ea}=_0x10159e,_0x4522fd=_0x4ac0ea[0x0]||_0x426891['parentSegment'];if(!_0x4522fd)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'+_0x36de4f(0x202)),0x1;const _0x138413=resolveYamlFile(_0x4522fd);if(!existsSync(_0x138413))return showFileNotFoundError(_0x138413,_0x4522fd),0x1;let _0x3ad88f;try{_0x3ad88f=readFileSync(_0x138413,_0x36de4f(0x1c1));}catch(_0x23e123){const _0x1b194b=_0x23e123 instanceof Error?_0x23e123[_0x36de4f(0x1eb)]:String(_0x23e123);return console[_0x36de4f(0x13c)]('Error\x20reading\x20file:\x20'+_0x1b194b),0x1;}let _0x587bf4;try{_0x587bf4=parseDef(_0x3ad88f);}catch(_0x49d2c5){const _0x1b153d=_0x49d2c5 instanceof Error?_0x49d2c5['message']:String(_0x49d2c5);return console[_0x36de4f(0x13c)](a29_0x4372dd[_0x36de4f(0x1f8)](_0x36de4f(0xd7)+_0x1b153d)),0x1;}if(_0x587bf4[_0x36de4f(0x16b)]&&_0x587bf4['personalization_services'][_0x36de4f(0x1e6)]>0x0)return console[_0x36de4f(0x13c)](a29_0x4372dd[_0x36de4f(0x1a2)](_0x36de4f(0x18c)+_0x138413)),console[_0x36de4f(0x13c)](a29_0x4372dd[_0x36de4f(0x181)](_0x36de4f(0x120)+_0x587bf4['personalization_services'][_0x36de4f(0x1e6)]+_0x36de4f(0x17a))),0x1;!_0x587bf4[_0x36de4f(0x123)]&&(_0x587bf4[_0x36de4f(0x123)]={'events':[{'name':'page_view','source_table':_0x36de4f(0x21d)}],'attributes':[{'name':'last_page_viewed','type':_0x36de4f(0xc9)}],'id_stitching':{'primary_key':_0x587bf4[_0x36de4f(0x1e7)][_0x36de4f(0x1ac)]===_0x36de4f(0x21b)?_0x36de4f(0xca):'user_id'}});_0x587bf4[_0x36de4f(0x16b)]=[{'name':_0x36de4f(0x240),'description':'Personalization\x20service\x20description','trigger_event':_0x36de4f(0x14c),'sections':[{'name':'Default','criteria':_0x36de4f(0xc8),'attributes':[_0x36de4f(0xdc)]}]}];const _0x53cf02=serializeDef(_0x587bf4);return writeFileSync(_0x138413,_0x53cf02,'utf-8'),console['error'](a29_0x4372dd[_0x36de4f(0x15d)]('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a29_0x4372dd[_0x36de4f(0x1d5)](_0x138413)),(!_0x587bf4[_0x36de4f(0x123)]||_0x3ad88f[_0x36de4f(0x14e)](_0x36de4f(0x160))===-0x1)&&console[_0x36de4f(0x13c)](a29_0x4372dd[_0x36de4f(0x15d)]('✔')+_0x36de4f(0x19d)),console['error']('\x0a'+a29_0x4372dd[_0x36de4f(0x181)](_0x36de4f(0x180))),console[_0x36de4f(0x13c)](_0x36de4f(0x1b3)+_0x138413+_0x36de4f(0x21a)),console[_0x36de4f(0x13c)](_0x36de4f(0x198)+a29_0x4372dd['dim'](_0x36de4f(0xdb)+_0x4522fd)+_0x36de4f(0x167)),0x0;}}
|
|
1
|
+
const a29_0x5da2a6=a29_0x1dd0;(function(_0x3246ac,_0xe99b9){const _0x1a2bdd=a29_0x1dd0,_0x33d359=_0x3246ac();while(!![]){try{const _0x3e1f0e=-parseInt(_0x1a2bdd(0x1f9))/0x1+parseInt(_0x1a2bdd(0x118))/0x2+-parseInt(_0x1a2bdd(0x111))/0x3*(parseInt(_0x1a2bdd(0x217))/0x4)+-parseInt(_0x1a2bdd(0x1ef))/0x5*(-parseInt(_0x1a2bdd(0x1c7))/0x6)+parseInt(_0x1a2bdd(0x183))/0x7+-parseInt(_0x1a2bdd(0x117))/0x8+parseInt(_0x1a2bdd(0x213))/0x9;if(_0x3e1f0e===_0xe99b9)break;else _0x33d359['push'](_0x33d359['shift']());}catch(_0x6c36fe){_0x33d359['push'](_0x33d359['shift']());}}}(a29_0x3e11,0x421ee));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x1b987c 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';function a29_0x1dd0(_0x94b7b8,_0x1055fb){_0x94b7b8=_0x94b7b8-0x90;const _0x3e11f6=a29_0x3e11();let _0x1dd07b=_0x3e11f6[_0x94b7b8];return _0x1dd07b;}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 a29_0xaf6826 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=a29_0x5da2a6(0x167),LEGACY_PARENT_SEGMENT_DIR=a29_0x5da2a6(0x1aa);function openBrowser(_0xc9c9f1){const _0x59fb25=a29_0x5da2a6,_0xe67ea9=process[_0x59fb25(0xa0)],_0x2eae55=_0xe67ea9===_0x59fb25(0x160)?_0x59fb25(0xa7):_0xe67ea9==='win32'?_0x59fb25(0x1d7):'xdg-open';spawn(_0x2eae55,[_0xc9c9f1],{'detached':!![],'stdio':'ignore'})[_0x59fb25(0xa9)]();}function migrateLegacyDirectory(){const _0x3ad300=a29_0x5da2a6;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0xa536a6=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0xa536a6[_0x3ad300(0x1a5)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3ad300(0x1fe)](a29_0xaf6826[_0x3ad300(0x12b)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3ad300(0x1c4)+PARENT_SEGMENT_DIR+_0x3ad300(0xa3))),console[_0x3ad300(0x1fe)](a29_0xaf6826[_0x3ad300(0x142)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3ad300(0xcf))),![];console[_0x3ad300(0x1fe)](a29_0xaf6826[_0x3ad300(0x12b)](_0x3ad300(0x195)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3ad300(0x1fe)](a29_0xaf6826['green'](_0x3ad300(0x91)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2a58ea){const _0x5a5079=_0x2a58ea instanceof Error?_0x2a58ea[_0x3ad300(0x1bd)]:String(_0x2a58ea);return console[_0x3ad300(0x1fe)](a29_0xaf6826[_0x3ad300(0x215)](_0x3ad300(0xf1)+_0x5a5079+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x5da2a6(0x143)](_0x52c8bc){return migrateLegacyDirectory(),super['run'](_0x52c8bc);}}function resolveYamlFile(_0x425e0b){const _0x35cc20=a29_0x5da2a6;if(_0x425e0b[_0x35cc20(0x1ca)](_0x35cc20(0xaa))||_0x425e0b['endsWith'](_0x35cc20(0x15e)))return _0x425e0b;return a29_0x1b987c[_0x35cc20(0x19b)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x425e0b)+_0x35cc20(0xaa));}function formatProgressMessage(_0x1501d7){const _0x31d0c0=a29_0x5da2a6,_0x19cdf8=_0x1501d7['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x19cdf8){const [,_0x4cc786,_0x4310f9,_0x2da4a8='']=_0x19cdf8;return a29_0xaf6826[_0x31d0c0(0x142)](_0x4cc786+':')+'\x20'+_0x4310f9+a29_0xaf6826[_0x31d0c0(0x142)](_0x2da4a8);}return a29_0xaf6826['dim'](_0x1501d7);}function showFileNotFoundError(_0x25aef2,_0x316e5c){const _0x2d6740=a29_0x5da2a6;console[_0x2d6740(0x1fe)](a29_0xaf6826[_0x2d6740(0x215)](_0x2d6740(0x1e5)+_0x25aef2+'\x0a')),console[_0x2d6740(0x1fe)](a29_0xaf6826[_0x2d6740(0x202)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x316e5c+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x16826a){const _0x3b8bb6=a29_0x5da2a6;if(!_0x16826a[_0x3b8bb6(0x162)])return;const _0x3e423f=_0x16826a['realtime'],_0x4cc11e=_0x3e423f[_0x3b8bb6(0x9b)]?a29_0xaf6826[_0x3b8bb6(0x1d0)](_0x3b8bb6(0x1a6)):a29_0xaf6826[_0x3b8bb6(0x12b)](_0x3b8bb6(0x13d));console[_0x3b8bb6(0x1fe)]('\x0a'+a29_0xaf6826[_0x3b8bb6(0x142)](_0x3b8bb6(0x163))+'\x20'+_0x4cc11e);if(_0x3e423f[_0x3b8bb6(0x11a)]&&_0x3e423f[_0x3b8bb6(0x11a)][_0x3b8bb6(0xf7)]>0x0){console[_0x3b8bb6(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x3b8bb6(0x142)]('Events:')+'\x20'+_0x3e423f[_0x3b8bb6(0x11a)][_0x3b8bb6(0xf7)]+_0x3b8bb6(0xcb));for(const _0x20ec10 of _0x3e423f[_0x3b8bb6(0x11a)]){const _0x148351=_0x20ec10[_0x3b8bb6(0x196)]===![]?a29_0xaf6826[_0x3b8bb6(0x215)]('✘'):a29_0xaf6826[_0x3b8bb6(0x1d0)]('✔');console[_0x3b8bb6(0x1fe)](_0x3b8bb6(0x164)+_0x148351+'\x20'+_0x20ec10['name']),_0x20ec10[_0x3b8bb6(0xb8)]&&console[_0x3b8bb6(0x1fe)]('\x20\x20\x20\x20\x20\x20'+a29_0xaf6826[_0x3b8bb6(0x215)](_0x20ec10[_0x3b8bb6(0xb8)]));}}if(_0x3e423f[_0x3b8bb6(0x10e)]&&_0x3e423f[_0x3b8bb6(0x10e)]['length']>0x0){console['error']('\x20\x20'+a29_0xaf6826[_0x3b8bb6(0x142)](_0x3b8bb6(0xea))+'\x20'+_0x3e423f[_0x3b8bb6(0x10e)][_0x3b8bb6(0xf7)]+_0x3b8bb6(0xcb));for(const _0xffacf0 of _0x3e423f[_0x3b8bb6(0x10e)]){const _0xe13137=_0xffacf0['valid']?a29_0xaf6826['green']('✔'):a29_0xaf6826[_0x3b8bb6(0x215)]('✘');console[_0x3b8bb6(0x1fe)]('\x20\x20\x20\x20'+_0xe13137+'\x20'+_0xffacf0[_0x3b8bb6(0xa5)]+'\x20'+a29_0xaf6826[_0x3b8bb6(0x142)]('('+_0xffacf0[_0x3b8bb6(0xc5)]+')'));}}if(_0x3e423f[_0x3b8bb6(0x130)]){const _0x27c255=_0x3e423f[_0x3b8bb6(0x130)][_0x3b8bb6(0x19a)]?.[_0x3b8bb6(0xf7)]?_0x3b8bb6(0xf3)+_0x3e423f[_0x3b8bb6(0x130)][_0x3b8bb6(0x19a)][_0x3b8bb6(0x19b)](',\x20')+']':'';console['error']('\x20\x20'+a29_0xaf6826[_0x3b8bb6(0x142)](_0x3b8bb6(0x13e))+'\x20'+_0x3e423f[_0x3b8bb6(0x130)]['primaryKey']+_0x27c255);}if(_0x3e423f[_0x3b8bb6(0x150)]&&_0x3e423f[_0x3b8bb6(0x150)][_0x3b8bb6(0xf7)]>0x0){console[_0x3b8bb6(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x3b8bb6(0x142)](_0x3b8bb6(0x1fb))+'\x20'+_0x3e423f[_0x3b8bb6(0x150)][_0x3b8bb6(0xf7)]+_0x3b8bb6(0xff)+(_0x3e423f[_0x3b8bb6(0x150)][_0x3b8bb6(0xf7)]!==0x1?'s':''));for(const _0x333982 of _0x3e423f[_0x3b8bb6(0x150)]){console[_0x3b8bb6(0x1fe)](_0x3b8bb6(0xa4)+_0x333982[_0x3b8bb6(0xa5)]);}}}function showParentSegmentNotSetError(_0x14b4f8){const _0x1cfc07=a29_0x5da2a6;console[_0x1cfc07(0x1fe)](a29_0xaf6826['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console['error'](_0x14b4f8);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]='segment:parent:list';[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x16c);async['execute'](_0x125a74){const _0x58eef6=a29_0x5da2a6,{options:_0xfccb93,args:_0x44a37b,tdx:_0x269ce7}=_0x125a74,_0x44164e=_0x44a37b[0x0];_0xfccb93['verbose']&&(console['error'](_0x58eef6(0x157)+_0xfccb93['site']),_0x44164e&&console[_0x58eef6(0x1fe)]('Pattern:\x20'+_0x44164e));const _0x46976c=await withSpinner(_0x44164e?_0x58eef6(0xbc)+_0x44164e+'\x27...':_0x58eef6(0xc3),()=>_0x269ce7[_0x58eef6(0xc8)][_0x58eef6(0x1b2)](),{'verbose':_0xfccb93[_0x58eef6(0x1d3)]});let _0x50e700=_0x46976c[_0x58eef6(0x112)];if(_0x44164e){const _0x2567fb=_0x44164e[_0x58eef6(0x18b)](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x913ed5=new RegExp('^'+_0x2567fb+'$','i');_0x50e700=_0x50e700['filter'](_0x38b9f7=>_0x913ed5['test'](_0x38b9f7[_0x58eef6(0x10e)][_0x58eef6(0xa5)]));}_0x50e700['sort']((_0x3d5bdb,_0x4e9b08)=>_0x3d5bdb[_0x58eef6(0x10e)]['name'][_0x58eef6(0x109)](_0x4e9b08['attributes']['name'])),console[_0x58eef6(0x1fe)](_0x58eef6(0x1d6)+_0x50e700['length']+'\x20parent\x20segment'+(_0x50e700['length']!==0x1?'s':''));const _0x3153c2=_0x45bc7f=>{const _0x3a1ddb=_0x58eef6;return getConsoleNextUrl(_0xfccb93[_0x3a1ddb(0x19c)],'/app/dw/parentSegments/'+_0x45bc7f);};if(_0xfccb93[_0x58eef6(0x106)]==='json'||_0xfccb93[_0x58eef6(0x106)]===_0x58eef6(0x216)){const _0x7daaaa=_0x50e700['map'](_0x1ab808=>({..._0x1ab808,'url':_0x3153c2(_0x1ab808['id'])}));await handleSDKOutput(_0x7daaaa,_0xfccb93);}else{if(_0x50e700[_0x58eef6(0xf7)]===0x0)_0x44164e?console['log']('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x44164e):console[_0x58eef6(0x151)]('No\x20parent\x20segments\x20found');else for(const _0x3007c1 of _0x50e700){const _0x415383=_0x3007c1[_0x58eef6(0x10e)][_0x58eef6(0x95)]?a29_0xaf6826[_0x58eef6(0x142)]('\x20('+formatRows(_0x3007c1[_0x58eef6(0x10e)][_0x58eef6(0x95)])+')'):'',_0x9f5174=hyperlink(_0x3007c1[_0x58eef6(0x10e)][_0x58eef6(0xa5)],_0x3153c2(_0x3007c1['id']));console[_0x58eef6(0x151)](_0x58eef6(0x1ab)+_0x9f5174+_0x415383);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']='segment:parent:create';[a29_0x5da2a6(0x120)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a29_0x5da2a6(0xfc)](_0x32420c){const _0xeb33a7=a29_0x5da2a6,{options:_0x1ab519,args:_0x3ba47a,tdx:_0x558b69}=_0x32420c;console[_0xeb33a7(0x1fe)](_0xeb33a7(0x9d)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0xeb33a7(0xf2));const _0x298ddf=_0x1ab519;if(_0x3ba47a[_0xeb33a7(0xf7)]===0x0)return console[_0xeb33a7(0x1fe)](a29_0xaf6826[_0xeb33a7(0x215)](_0xeb33a7(0x199))),console['error'](_0xeb33a7(0xeb)),0x1;const _0x5135fe=_0x3ba47a[0x0];if(!_0x298ddf['database']||!_0x298ddf['table'])return console[_0xeb33a7(0x1fe)](_0xeb33a7(0x10a)),console[_0xeb33a7(0x1fe)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x298ddf[_0xeb33a7(0x1d3)]&&(console[_0xeb33a7(0x1fe)](_0xeb33a7(0x157)+_0x298ddf['site']),console[_0xeb33a7(0x1fe)](_0xeb33a7(0x1b1)+_0x5135fe),console[_0xeb33a7(0x1fe)](_0xeb33a7(0x94)+_0x298ddf[_0xeb33a7(0x1cc)]),console['error'](_0xeb33a7(0x17b)+_0x298ddf[_0xeb33a7(0x219)]));const _0x2728a9=await loadJSONFromOptions(_0x298ddf['attributes'],_0x298ddf[_0xeb33a7(0x1a3)]),_0x2ff11c=await loadJSONFromOptions(_0x298ddf[_0xeb33a7(0xe5)],_0x298ddf[_0xeb33a7(0x185)]),_0x7dace9=await loadJSONFromOptions(_0x298ddf['customerGroup'],_0x298ddf[_0xeb33a7(0x1e1)]),_0x2c2351={'name':_0x5135fe,'description':_0x298ddf['description'],'scheduleType':_0x298ddf[_0xeb33a7(0x1b5)],'scheduleOption':_0x298ddf[_0xeb33a7(0x186)],'timezone':_0x298ddf[_0xeb33a7(0x211)],'master':{'parentDatabaseName':_0x298ddf[_0xeb33a7(0x1cc)],'parentTableName':_0x298ddf['table']},'attributes':_0x2728a9,'behaviors':_0x2ff11c,'customerGroup':_0x7dace9},_0x1a476e=await withSpinner(_0xeb33a7(0xdb)+_0x5135fe+_0xeb33a7(0x93),()=>_0x558b69[_0xeb33a7(0xc8)][_0xeb33a7(0x132)](_0x2c2351),{'verbose':_0x1ab519[_0xeb33a7(0x1d3)]}),_0x273751=_0x1a476e[_0xeb33a7(0x112)];return console['error'](_0xeb33a7(0x182)+_0x273751[_0xeb33a7(0xa5)]+_0xeb33a7(0x13a)+_0x273751['id']),await handleSDKOutput([_0x273751],_0x1ab519),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]='segment:parent:update';[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x188);async[a29_0x5da2a6(0xfc)](_0x2df83a){const _0x3c815a=a29_0x5da2a6,{options:_0x5242af,args:_0x6c1131,tdx:_0x331f7d}=_0x2df83a;console[_0x3c815a(0x1fe)](_0x3c815a(0x1b6)+_0x3c815a(0xe3)+_0x3c815a(0xf2));const _0xde0fc2=_0x5242af;if(_0x6c1131['length']===0x0)return console[_0x3c815a(0x1fe)](a29_0xaf6826['red'](_0x3c815a(0x199))),console['error'](_0x3c815a(0x17e)),0x1;const _0x253a00=_0x6c1131[0x0];_0xde0fc2[_0x3c815a(0x1d3)]&&(console[_0x3c815a(0x1fe)]('Site:\x20'+_0xde0fc2[_0x3c815a(0x19c)]),console[_0x3c815a(0x1fe)](_0x3c815a(0xc1)+_0x253a00));const _0x284a02=await withSpinner(_0x3c815a(0x1ad)+_0x253a00+'\x27...',()=>_0x331f7d[_0x3c815a(0xc8)][_0x3c815a(0xc0)](_0x253a00),{'verbose':_0xde0fc2['verbose']}),_0x683fe3=_0x284a02[_0x3c815a(0x112)],_0x388d9e=await loadJSONFromOptions(_0xde0fc2[_0x3c815a(0x212)],_0xde0fc2[_0x3c815a(0x12d)]),_0x21469e=await loadJSONFromOptions(_0xde0fc2['addBehaviors'],_0xde0fc2[_0x3c815a(0x187)]),_0x5bdc33={'name':_0x683fe3[_0x3c815a(0xa5)],'description':_0xde0fc2[_0x3c815a(0x120)]!==undefined?_0xde0fc2[_0x3c815a(0x120)]:_0x683fe3[_0x3c815a(0x120)],'scheduleType':_0xde0fc2[_0x3c815a(0x1b5)]!==undefined?_0xde0fc2[_0x3c815a(0x1b5)]:_0x683fe3['scheduleType'],'scheduleOption':_0xde0fc2[_0x3c815a(0x186)]!==undefined?_0xde0fc2[_0x3c815a(0x186)]:_0x683fe3[_0x3c815a(0x186)],'timezone':_0xde0fc2[_0x3c815a(0x211)]!==undefined?_0xde0fc2[_0x3c815a(0x211)]:_0x683fe3[_0x3c815a(0x211)],'master':_0x683fe3['master'],'attributes':_0x388d9e?[..._0x683fe3[_0x3c815a(0x10e)]||[],..._0x388d9e]:_0x683fe3['attributes'],'behaviors':_0x21469e?[..._0x683fe3['behaviors']||[],..._0x21469e]:_0x683fe3['behaviors'],'customerGroup':_0x683fe3[_0x3c815a(0x116)]},_0x40bb39=await withSpinner(_0x3c815a(0x103)+_0x253a00+_0x3c815a(0x93),()=>_0x331f7d[_0x3c815a(0xc8)][_0x3c815a(0x1ce)](_0x253a00,_0x5bdc33),{'verbose':_0xde0fc2[_0x3c815a(0x1d3)]}),_0x450aed=_0x40bb39[_0x3c815a(0x112)];return console[_0x3c815a(0x1fe)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x450aed['name']+'\x27'),await handleSDKOutput([_0x450aed],_0xde0fc2),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0x156);[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x16e);async['execute'](_0xfbfbf6){const _0x449ab9=a29_0x5da2a6,{options:_0x2fec56,args:_0x3d8fc8,tdx:_0x35318b}=_0xfbfbf6,_0x3d1d7c=_0x2fec56,_0xd3dbe3=_0x3d8fc8[0x0]||_0x2fec56['parentSegment'];if(!_0xd3dbe3)return showParentSegmentNotSetError(_0x449ab9(0x1f7)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x3d1d7c[_0x449ab9(0x172)]&&_0x3d1d7c[_0x449ab9(0x1bf)])return console[_0x449ab9(0x1fe)](a29_0xaf6826[_0x449ab9(0x215)](_0x449ab9(0xab))),console[_0x449ab9(0x1fe)](a29_0xaf6826[_0x449ab9(0x142)](_0x449ab9(0xdd))),console['error'](a29_0xaf6826[_0x449ab9(0x142)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x449ab9(0x1ec))),console[_0x449ab9(0x1fe)](a29_0xaf6826[_0x449ab9(0x202)](_0x449ab9(0xc2))),0x1;const _0x148513=_0x3d1d7c[_0x449ab9(0x1bf)]||a29_0x1b987c[_0x449ab9(0x19b)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd3dbe3)+_0x449ab9(0xaa));_0x3d1d7c[_0x449ab9(0x1d3)]&&(console[_0x449ab9(0x1fe)](_0x449ab9(0x157)+_0x3d1d7c[_0x449ab9(0x19c)]),console[_0x449ab9(0x1fe)](_0x449ab9(0xc1)+_0xd3dbe3),console['error'](_0x449ab9(0x1e0)+_0x148513));const _0x26b0d3=await withSpinner(_0x449ab9(0x107)+_0xd3dbe3+_0x449ab9(0x93),()=>_0x35318b[_0x449ab9(0xc8)]['pullParentYaml'](_0xd3dbe3),{'verbose':_0x3d1d7c[_0x449ab9(0x1d3)]}),_0xdfbefb=_0x26b0d3['data'];if(existsSync(_0x148513)){const _0x3cb05e=readFileSync(_0x148513,_0x449ab9(0x1d5)),_0x169087=generateDiff(_0x3cb05e,_0xdfbefb);if(!hasChanges(_0x169087))console[_0x449ab9(0x1fe)](a29_0xaf6826[_0x449ab9(0x1d0)]('✔')+_0x449ab9(0x133)+a29_0xaf6826['cyan'](_0x148513)+_0x449ab9(0xe8));else{console['error'](_0x449ab9(0xc9)+_0x148513+'\x27:'),console[_0x449ab9(0x1fe)]('─'[_0x449ab9(0x90)](0x3c)),console[_0x449ab9(0x1fe)](formatDiffWithColors(_0x169087)),console['error']('─'[_0x449ab9(0x90)](0x3c));if(!_0x3d1d7c[_0x449ab9(0x124)]){if(!isInteractive())return console[_0x449ab9(0x1fe)](a29_0xaf6826['red'](_0x449ab9(0x165)),_0x449ab9(0x11e)),console[_0x449ab9(0x1fe)](a29_0xaf6826[_0x449ab9(0x142)](_0x449ab9(0xd5))),0x1;const _0x4bcd58=await confirmKey(_0x449ab9(0xec)+_0x148513+'\x27?');if(!_0x4bcd58)return console['error'](a29_0xaf6826['yellow']('Aborted.')),0x1;}writeFileSync(_0x148513,_0xdfbefb,'utf-8'),console['error'](a29_0xaf6826[_0x449ab9(0x1d0)]('✔')+_0x449ab9(0x173)+a29_0xaf6826['cyan'](_0x148513));}}else{const _0x109405=a29_0x1b987c['dirname'](_0x148513);!existsSync(_0x109405)&&mkdirSync(_0x109405,{'recursive':!![]}),writeFileSync(_0x148513,_0xdfbefb,'utf-8'),console['error'](a29_0xaf6826[_0x449ab9(0x1d0)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a29_0xaf6826[_0x449ab9(0x202)](_0x148513));}return saveSessionContext({'parent_segment':_0xd3dbe3},_0x3d1d7c['session']),console[_0x449ab9(0x1fe)](a29_0xaf6826[_0x449ab9(0x1d0)]('✔')+_0x449ab9(0x131)+a29_0xaf6826[_0x449ab9(0x142)](_0x449ab9(0x1aa))+_0x449ab9(0x171)+a29_0xaf6826[_0x449ab9(0x202)](_0xd3dbe3)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0xa6);[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x137);async['execute'](_0x5b8bce){const _0x2bef22=a29_0x5da2a6,{options:_0x1fc8d5,args:_0x4d01d1,tdx:_0x4e4bf0}=_0x5b8bce,_0x1280b0=_0x1fc8d5,_0x5b5139=_0x4d01d1[0x0]||_0x1fc8d5[_0x2bef22(0x169)];if(!_0x5b5139)return showParentSegmentNotSetError(_0x2bef22(0x203)+_0x2bef22(0x206)),0x1;const _0x36cc3a=resolveYamlFile(_0x5b5139);if(!existsSync(_0x36cc3a))return showFileNotFoundError(_0x36cc3a,_0x5b5139),0x1;_0x1280b0[_0x2bef22(0x1d3)]&&(console[_0x2bef22(0x1fe)](_0x2bef22(0x157)+_0x1280b0[_0x2bef22(0x19c)]),console[_0x2bef22(0x1fe)](_0x2bef22(0xad)+_0x36cc3a));let _0x322fad;try{_0x322fad=readFileSync(_0x36cc3a,_0x2bef22(0x1d5));}catch(_0x49fc20){const _0x3fa540=_0x49fc20 instanceof Error?_0x49fc20[_0x2bef22(0x1bd)]:String(_0x49fc20);return console['error'](_0x2bef22(0x11d)+_0x3fa540),0x1;}const _0xe51068=await withSpinner(_0x2bef22(0xd6),()=>_0x4e4bf0[_0x2bef22(0xc8)][_0x2bef22(0x119)](_0x322fad),{'verbose':_0x1280b0[_0x2bef22(0x1d3)]}),_0x10561e=_0xe51068['data'],{isNew:_0x46cb01,name:_0x5d6e08,hasChanges:_0x57e100,diffFormatted:_0x1cb160}=_0x10561e;if(!_0x57e100)return console['error'](_0x2bef22(0x1c8)+_0x5d6e08+_0x2bef22(0x12c)),0x0;_0x46cb01?console[_0x2bef22(0x1fe)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x5d6e08+'\x27:'):console[_0x2bef22(0x1fe)](_0x2bef22(0xd9)+_0x5d6e08+'\x27:');console[_0x2bef22(0x1fe)]('─'['repeat'](0x3c)),console['error'](_0x1cb160),console[_0x2bef22(0x1fe)]('─'[_0x2bef22(0x90)](0x3c));const _0x51389d=_0x46cb01?_0x2bef22(0x1dd)+_0x5d6e08+'\x27?':_0x2bef22(0x20a)+_0x5d6e08+'\x27?';if(!_0x1280b0[_0x2bef22(0x124)]){if(!isInteractive())return console[_0x2bef22(0x1fe)](a29_0xaf6826['red'](_0x2bef22(0x165)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x2bef22(0x1fe)](a29_0xaf6826[_0x2bef22(0x142)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x11a9d3=await confirmKey(_0x51389d);if(!_0x11a9d3)return console[_0x2bef22(0x1fe)](a29_0xaf6826['yellow']('Aborted.')),0x1;}const _0x5486d0=_0x46cb01?'Creating':'Updating',_0x18bc6e=await withSpinner(_0x5486d0+_0x2bef22(0x1f8)+_0x5d6e08+_0x2bef22(0x93),()=>_0x10561e[_0x2bef22(0x218)](),{'verbose':_0x1280b0[_0x2bef22(0x1d3)]}),_0x41f926=_0x18bc6e[_0x2bef22(0x112)],_0x2c59a7=getConsoleNextUrl(_0x1280b0[_0x2bef22(0x19c)],_0x2bef22(0xf6)+_0x41f926['id']),_0x2ca429=_0x46cb01?'Created':_0x2bef22(0x1fa);return console[_0x2bef22(0x1fe)]('✔\x20'+_0x2ca429+_0x2bef22(0x1f8)+_0x41f926[_0x2bef22(0xa5)]+'\x27'),console[_0x2bef22(0x1fe)]('\x20\x20'+_0x2c59a7),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0xa8);['description']=a29_0x5da2a6(0x19f);async[a29_0x5da2a6(0xfc)](_0x1a52b3){const _0x3de24b=a29_0x5da2a6,{options:_0x3fe7cf,args:_0x11e546,tdx:_0x1c7afc}=_0x1a52b3,_0xd1f49f=_0x3fe7cf,_0x24cc56=_0x11e546[0x0]||_0x3fe7cf[_0x3de24b(0x169)];if(!_0x24cc56)return showParentSegmentNotSetError(_0x3de24b(0x159)+_0x3de24b(0x166)+_0x3de24b(0x153)+_0x3de24b(0x1e6)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x3170e1=resolveYamlFile(_0x24cc56);if(!existsSync(_0x3170e1))return showFileNotFoundError(_0x3170e1,_0x24cc56),0x1;_0xd1f49f[_0x3de24b(0x1d3)]&&(console['error'](_0x3de24b(0x157)+_0xd1f49f['site']),console[_0x3de24b(0x1fe)](_0x3de24b(0xad)+_0x3170e1));let _0x19eaea;try{_0x19eaea=readFileSync(_0x3170e1,_0x3de24b(0x1d5));}catch(_0x350777){const _0x117173=_0x350777 instanceof Error?_0x350777[_0x3de24b(0x1bd)]:String(_0x350777);return console[_0x3de24b(0x1fe)](_0x3de24b(0x11d)+_0x117173),0x1;}const _0x46afd9=createCommandSpinner(a29_0xaf6826['dim'](_0x3de24b(0x1c1)),{'verbose':_0xd1f49f[_0x3de24b(0x1d3)]});_0x46afd9[_0x3de24b(0x1d7)]();const _0x2347a7={'onProgress':_0x46564e=>{const _0x385774=_0x3de24b;_0x46afd9[_0x385774(0x214)]=formatProgressMessage(_0x46564e);}};if(_0xd1f49f[_0x3de24b(0x1e8)])_0x2347a7['master']=!![];if(_0xd1f49f[_0x3de24b(0x127)])_0x2347a7[_0x3de24b(0x127)]=!![];_0xd1f49f['attribute']&&(_0x2347a7[_0x3de24b(0x9e)]=_0xd1f49f[_0x3de24b(0x9e)]);_0xd1f49f[_0x3de24b(0x105)]&&(_0x2347a7['behavior']=_0xd1f49f['behavior']);if(_0xd1f49f[_0x3de24b(0x180)])_0x2347a7[_0x3de24b(0x180)]=_0xd1f49f[_0x3de24b(0x180)];let _0x50fbd9;try{_0x50fbd9=await _0x1c7afc[_0x3de24b(0xc8)][_0x3de24b(0x176)](_0x19eaea,_0x2347a7),_0x46afd9[_0x3de24b(0x207)]();}catch(_0x4cd84b){_0x46afd9[_0x3de24b(0x207)]();throw _0x4cd84b;}const _0x4c72e7=_0xd1f49f[_0x3de24b(0x180)]||'-1d';return this[_0x3de24b(0x154)](_0x50fbd9,_0x2347a7,_0x3170e1,_0x4c72e7),_0x50fbd9['allValid']?0x0:0x1;}[a29_0x5da2a6(0x154)](_0x169801,_0x3b8422,_0x413b2a,_0x354b90){const _0x1a3a35=a29_0x5da2a6;console[_0x1a3a35(0x1fe)]('\x0a'+a29_0xaf6826[_0x1a3a35(0x1c0)]('Validate:')+'\x20'+_0x169801[_0x1a3a35(0xa5)]),console['error']('═'['repeat'](0x3c)),this['displayMasterInfo'](_0x169801);if(typeof _0x3b8422[_0x1a3a35(0x9e)]===_0x1a3a35(0x1c9)){this[_0x1a3a35(0x1d4)](_0x169801),this[_0x1a3a35(0x20c)](_0x169801),this[_0x1a3a35(0xc6)](_0x413b2a,_0x354b90,_0x1a3a35(0x9e),_0x3b8422[_0x1a3a35(0x9e)]);return;}if(_0x3b8422[_0x1a3a35(0x9e)]===!![]){this['displayAttributesStats'](_0x169801),this[_0x1a3a35(0x20c)](_0x169801),this[_0x1a3a35(0xc6)](_0x413b2a,_0x354b90,'attributes');return;}if(typeof _0x3b8422['behavior']==='string'){this['displayBehaviorsStats'](_0x169801,_0x354b90),this[_0x1a3a35(0x20c)](_0x169801),this[_0x1a3a35(0xc6)](_0x413b2a,_0x354b90,_0x1a3a35(0x105),_0x3b8422[_0x1a3a35(0x105)]);return;}if(_0x3b8422[_0x1a3a35(0x105)]===!![]){this[_0x1a3a35(0x1d2)](_0x169801,_0x354b90),this[_0x1a3a35(0x20c)](_0x169801),this['displayPreviewHints'](_0x413b2a,_0x354b90,'behaviors');return;}this[_0x1a3a35(0x1d4)](_0x169801),this['displayBehaviorsStats'](_0x169801,_0x354b90),this[_0x1a3a35(0x16f)](_0x169801),this[_0x1a3a35(0x20c)](_0x169801),this['displayPreviewHints'](_0x413b2a,_0x354b90,_0x1a3a35(0x125));}[a29_0x5da2a6(0x16f)](_0x162a10){displayRealtimeValidation(_0x162a10);}[a29_0x5da2a6(0xc6)](_0x416751,_0x11aa55,_0x428087,_0xdaac4){const _0x212601=a29_0x5da2a6;console['error']('\x0a'+a29_0xaf6826[_0x212601(0x142)](_0x212601(0xf9)));const _0x303078=_0x11aa55!==_0x212601(0x1b3)?_0x212601(0x97)+_0x11aa55:'';if(_0x428087==='attribute'&&_0xdaac4)console[_0x212601(0x1fe)]('\x20\x20'+a29_0xaf6826['dim'](_0x212601(0xbf)+_0x416751+_0x212601(0x11c)+_0xdaac4+'\x22'+_0x303078));else{if(_0x428087===_0x212601(0x105)&&_0xdaac4)console['error']('\x20\x20'+a29_0xaf6826[_0x212601(0x142)]('tdx\x20ps\x20preview\x20'+_0x416751+_0x212601(0xde)+_0xdaac4+'\x22'+_0x303078));else(_0x428087===_0x212601(0x10e)||_0x428087===_0x212601(0x125))&&console['error']('\x20\x20'+a29_0xaf6826[_0x212601(0x142)](_0x212601(0xbf)+_0x416751+_0x212601(0x14a)+_0x303078));}(_0x428087===_0x212601(0xe5)||_0x428087===_0x212601(0x125))&&console['error']('\x20\x20'+a29_0xaf6826['dim'](_0x212601(0xbf)+_0x416751+_0x212601(0x1f2)+_0x303078)),_0x428087===_0x212601(0x125)&&console[_0x212601(0x1fe)]('\x20\x20'+a29_0xaf6826['dim'](_0x212601(0xbf)+_0x416751+'\x20--enriched'+_0x303078));}[a29_0x5da2a6(0x1cd)](_0x56d20e){const _0xd298d3=a29_0x5da2a6,{master:_0x19c0ad}=_0x56d20e,_0x3f303c=_0x19c0ad[_0xd298d3(0xee)]?a29_0xaf6826['green']('✔'):a29_0xaf6826[_0xd298d3(0x215)]('✘');console[_0xd298d3(0x1fe)]('\x0a'+a29_0xaf6826[_0xd298d3(0x142)](_0xd298d3(0xd4))),console[_0xd298d3(0x1fe)](_0x3f303c+'\x20'+a29_0xaf6826['bold'](_0x19c0ad['database']+'.'+_0x19c0ad[_0xd298d3(0x219)])),_0x19c0ad['schemaValid']?_0x19c0ad['rowCount']!==undefined&&console[_0xd298d3(0x1fe)]('\x20\x20'+a29_0xaf6826[_0xd298d3(0x142)](_0xd298d3(0x205))+'\x20'+a29_0xaf6826[_0xd298d3(0x202)](formatRows(_0x19c0ad[_0xd298d3(0x155)]))):console[_0xd298d3(0x1fe)]('\x20\x20'+a29_0xaf6826[_0xd298d3(0x215)](_0xd298d3(0x141))+'\x20'+_0x19c0ad['schemaError']);}[a29_0x5da2a6(0x1d4)](_0x1289e8){const _0x348364=a29_0x5da2a6;if(_0x1289e8[_0x348364(0x10e)][_0x348364(0xf7)]===0x0)return;console['error']('\x0a'+a29_0xaf6826[_0x348364(0x142)](_0x348364(0x197)));for(const _0x88f512 of _0x1289e8[_0x348364(0x10e)]){const _0x5c3f10=_0x88f512[_0x348364(0xee)]?a29_0xaf6826['green']('✔'):a29_0xaf6826['red']('✘');let _0x463760='';if(_0x88f512[_0x348364(0xee)]&&_0x88f512[_0x348364(0x101)]!==undefined&&_0x88f512['coveragePercent']!==undefined){const _0x454b4e=_0x88f512[_0x348364(0x1d8)][_0x348364(0x1db)](0x1),_0x266664=_0x88f512[_0x348364(0x1d8)]>=0x50?a29_0xaf6826[_0x348364(0x1d0)]:_0x88f512[_0x348364(0x1d8)]>=0x32?a29_0xaf6826['yellow']:a29_0xaf6826[_0x348364(0x215)];_0x463760='\x20'+a29_0xaf6826[_0x348364(0x142)](_0x348364(0x15d))+'\x20'+_0x266664(_0x454b4e+'%')+'\x20('+formatRows(_0x88f512['matchedCount'])+'\x20rows)';}console[_0x348364(0x1fe)](_0x5c3f10+'\x20'+a29_0xaf6826['bold'](_0x88f512[_0x348364(0xa5)])+_0x463760),console[_0x348364(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x348364(0x142)](_0x348364(0x17f))+'\x20'+a29_0xaf6826[_0x348364(0x1c0)](_0x88f512[_0x348364(0x1cc)]+'.'+_0x88f512[_0x348364(0x219)]));const _0xbc6f27=_0x88f512[_0x348364(0x123)]===_0x88f512[_0x348364(0x13c)]?a29_0xaf6826[_0x348364(0x142)]('Join\x20on:')+'\x20'+_0x88f512[_0x348364(0x123)]:a29_0xaf6826['dim']('Join:')+'\x20'+_0x88f512['joinKey']+'\x20=\x20'+_0x88f512[_0x348364(0x13c)];console[_0x348364(0x1fe)]('\x20\x20'+_0xbc6f27),console[_0x348364(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x348364(0x142)]('Columns:')),this[_0x348364(0xe1)](_0x88f512[_0x348364(0x194)]),!_0x88f512['schemaValid']&&console[_0x348364(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x348364(0x215)]('Error:')+'\x20'+_0x88f512[_0x348364(0x1f3)]);}}[a29_0x5da2a6(0x1d2)](_0x3f025b,_0x1d2822){const _0x2223a7=a29_0x5da2a6;if(_0x3f025b[_0x2223a7(0xe5)][_0x2223a7(0xf7)]===0x0)return;console[_0x2223a7(0x1fe)]('\x0a'+a29_0xaf6826[_0x2223a7(0x142)]('Behaviors')+'\x20'+a29_0xaf6826[_0x2223a7(0x142)]('('+_0x1d2822+')'));for(const _0x156f71 of _0x3f025b[_0x2223a7(0xe5)]){const _0x5c71b8=_0x156f71[_0x2223a7(0xee)]?a29_0xaf6826[_0x2223a7(0x1d0)]('✔'):a29_0xaf6826[_0x2223a7(0x215)]('✘');let _0x91112d='';if(_0x156f71[_0x2223a7(0xee)]&&_0x156f71[_0x2223a7(0x13b)]!==undefined&&_0x156f71['totalEvents']!==undefined){const _0xe72e5d=_0x156f71['customerPercent']?.[_0x2223a7(0x1db)](0x1)||'?',_0x1adea4=(_0x156f71['customerPercent']??0x0)>=0x32?a29_0xaf6826[_0x2223a7(0x1d0)]:(_0x156f71[_0x2223a7(0xbd)]??0x0)>=0x14?a29_0xaf6826['yellow']:a29_0xaf6826[_0x2223a7(0x215)];_0x91112d='\x20'+a29_0xaf6826[_0x2223a7(0x142)](_0x2223a7(0x138))+'\x20'+_0x1adea4(formatRows(_0x156f71[_0x2223a7(0x13b)]))+'\x20('+_0xe72e5d+_0x2223a7(0x98)+a29_0xaf6826['dim'](_0x2223a7(0xb2))+'\x20'+a29_0xaf6826[_0x2223a7(0x202)](formatRows(_0x156f71[_0x2223a7(0xe9)]));}console[_0x2223a7(0x1fe)](_0x5c71b8+'\x20'+a29_0xaf6826[_0x2223a7(0x1c0)](_0x156f71['name'])+_0x91112d),console[_0x2223a7(0x1fe)]('\x20\x20'+a29_0xaf6826['dim'](_0x2223a7(0x17f))+'\x20'+a29_0xaf6826[_0x2223a7(0x1c0)](_0x156f71['database']+'.'+_0x156f71[_0x2223a7(0x219)]));const _0x31c17a=_0x156f71[_0x2223a7(0x123)]===_0x156f71[_0x2223a7(0x13c)]?a29_0xaf6826[_0x2223a7(0x142)]('Join\x20on:')+'\x20'+_0x156f71['joinKey']:a29_0xaf6826[_0x2223a7(0x142)](_0x2223a7(0xa1))+'\x20'+_0x156f71[_0x2223a7(0x123)]+_0x2223a7(0x171)+_0x156f71['foreignKey'];console[_0x2223a7(0x1fe)]('\x20\x20'+_0x31c17a),console['error']('\x20\x20'+a29_0xaf6826['dim'](_0x2223a7(0x108))),this[_0x2223a7(0xe1)](_0x156f71[_0x2223a7(0x194)]),!_0x156f71[_0x2223a7(0xee)]&&console[_0x2223a7(0x1fe)]('\x20\x20'+a29_0xaf6826['red'](_0x2223a7(0x141))+'\x20'+_0x156f71['schemaError']);}}[a29_0x5da2a6(0xe1)](_0x3f3d02){const _0xb32c20=a29_0x5da2a6;for(const _0x1e70bd of _0x3f3d02){_0x1e70bd[_0xb32c20(0x1ff)]===_0x1e70bd[_0xb32c20(0x148)]||_0x1e70bd['column']==='*'?console[_0xb32c20(0x1fe)](_0xb32c20(0xa4)+_0x1e70bd[_0xb32c20(0x1ff)]):console[_0xb32c20(0x1fe)](_0xb32c20(0xa4)+_0x1e70bd['label']+'\x20'+a29_0xaf6826[_0xb32c20(0x142)]('('+_0x1e70bd[_0xb32c20(0x148)]+')'));}}[a29_0x5da2a6(0x20c)](_0x53ff64){const _0x38bd82=a29_0x5da2a6;console['error']('─'[_0x38bd82(0x90)](0x3c));if(_0x53ff64[_0x38bd82(0x102)][_0x38bd82(0xf7)]>0x0){console[_0x38bd82(0x1fe)]('\x0a'+a29_0xaf6826[_0x38bd82(0x215)](_0x38bd82(0x126)));for(const _0x110012 of _0x53ff64[_0x38bd82(0x102)]){console[_0x38bd82(0x1fe)]('\x20\x20'+a29_0xaf6826['red']('•')+'\x20'+_0x110012);}}_0x53ff64[_0x38bd82(0x1f4)]&&console[_0x38bd82(0x1fe)]('\x0a'+a29_0xaf6826[_0x38bd82(0x1d0)]('✔')+_0x38bd82(0x1a9));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0xd0);[a29_0x5da2a6(0x120)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a29_0x5da2a6(0xfc)](_0xfa695e){const _0x4751f8=a29_0x5da2a6,{options:_0x3e026f,args:_0x2a708c,tdx:_0x558cb0}=_0xfa695e,_0x4395c0=_0x3e026f,_0x2b760d=_0x2a708c[0x0]||_0x3e026f[_0x4751f8(0x169)];if(!_0x2b760d)return showParentSegmentNotSetError(_0x4751f8(0x10f)+_0x4751f8(0x168)+_0x4751f8(0x19d)+_0x4751f8(0x18c)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x4751f8(0x10b)+_0x4751f8(0x113)+_0x4751f8(0x1eb)),0x1;if(!_0x4395c0['master']&&!_0x4395c0[_0x4751f8(0x9e)]&&!_0x4395c0[_0x4751f8(0x105)]&&!_0x4395c0[_0x4751f8(0x127)])return console[_0x4751f8(0x1fe)](a29_0xaf6826['red'](_0x4751f8(0x152))),console[_0x4751f8(0x1fe)](_0x4751f8(0xb6)),console['error']('Options:'),console[_0x4751f8(0x1fe)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x4751f8(0x1fe)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x4751f8(0x1fe)](_0x4751f8(0xb7)),console[_0x4751f8(0x1fe)](_0x4751f8(0xd8)),0x1;const _0x1d44c9=resolveYamlFile(_0x2b760d);if(!existsSync(_0x1d44c9))return showFileNotFoundError(_0x1d44c9,_0x2b760d),0x1;_0x4395c0[_0x4751f8(0x1d3)]&&(console[_0x4751f8(0x1fe)](_0x4751f8(0x157)+_0x4395c0[_0x4751f8(0x19c)]),console['error'](_0x4751f8(0xad)+_0x1d44c9));let _0x1e188d;try{_0x1e188d=readFileSync(_0x1d44c9,_0x4751f8(0x1d5));}catch(_0x401d81){const _0x50895a=_0x401d81 instanceof Error?_0x401d81[_0x4751f8(0x1bd)]:String(_0x401d81);return console[_0x4751f8(0x1fe)](_0x4751f8(0x11d)+_0x50895a),0x1;}let _0x2377ff;try{_0x2377ff=parseDef(_0x1e188d);}catch(_0x30ccb0){const _0x52cb24=_0x30ccb0 instanceof Error?_0x30ccb0[_0x4751f8(0x1bd)]:String(_0x30ccb0);return console[_0x4751f8(0x1fe)](a29_0xaf6826['red'](_0x4751f8(0x21a)+_0x52cb24)),0x1;}if(_0x4395c0[_0x4751f8(0x9e)]===!![]||_0x4395c0['attribute']===''){const _0x31c3bf=_0x2377ff[_0x4751f8(0x10e)]?.[_0x4751f8(0x14e)](_0x7cd0b8=>_0x7cd0b8[_0x4751f8(0xa5)])||[];if(_0x31c3bf['length']===0x0)console[_0x4751f8(0x1fe)](a29_0xaf6826[_0x4751f8(0x215)](_0x4751f8(0x1ac)));else{console['error'](a29_0xaf6826[_0x4751f8(0x215)](_0x4751f8(0x1b8))),console[_0x4751f8(0x1fe)](_0x4751f8(0x170));for(const _0x5d9dca of _0x31c3bf){console[_0x4751f8(0x1fe)]('\x20\x20'+a29_0xaf6826['cyan'](_0x5d9dca));}console['error'](_0x4751f8(0xf8)+_0x2b760d+_0x4751f8(0x11c)+_0x31c3bf[0x0]+'\x22');}return 0x1;}if(_0x4395c0[_0x4751f8(0x105)]===!![]||_0x4395c0['behavior']===''){const _0x315cc3=_0x2377ff[_0x4751f8(0xe5)]?.['map'](_0x364140=>_0x364140[_0x4751f8(0xa5)])||[];if(_0x315cc3[_0x4751f8(0xf7)]===0x0)console[_0x4751f8(0x1fe)](a29_0xaf6826[_0x4751f8(0x215)](_0x4751f8(0xfe)));else{console[_0x4751f8(0x1fe)](a29_0xaf6826[_0x4751f8(0x215)](_0x4751f8(0x11b))),console[_0x4751f8(0x1fe)](_0x4751f8(0x1b4));for(const _0x54de of _0x315cc3){console['error']('\x20\x20'+a29_0xaf6826[_0x4751f8(0x202)](_0x54de));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x2b760d+'\x20--behavior\x20\x22'+_0x315cc3[0x0]+'\x22');}return 0x1;}const _0x5b3b5b=createCommandSpinner(a29_0xaf6826[_0x4751f8(0x142)]('Fetching\x20sample\x20data...'),{'verbose':_0x4395c0[_0x4751f8(0x1d3)]});_0x5b3b5b['start']();const _0x407298={'onProgress':_0x1ed8f3=>{const _0xe6223e=_0x4751f8;_0x5b3b5b[_0xe6223e(0x214)]=formatProgressMessage(_0x1ed8f3);}};if(_0x4395c0[_0x4751f8(0x1e8)])_0x407298[_0x4751f8(0x1e8)]=!![];if(_0x4395c0[_0x4751f8(0x9e)]&&typeof _0x4395c0[_0x4751f8(0x9e)]===_0x4751f8(0x1c9))_0x407298[_0x4751f8(0x9e)]=_0x4395c0['attribute'];if(_0x4395c0[_0x4751f8(0x105)]&&typeof _0x4395c0[_0x4751f8(0x105)]===_0x4751f8(0x1c9))_0x407298['behavior']=_0x4395c0['behavior'];if(_0x4395c0['enriched'])_0x407298['enriched']=!![];if(_0x4395c0[_0x4751f8(0x180)])_0x407298[_0x4751f8(0x180)]=_0x4395c0[_0x4751f8(0x180)];let _0x304b85;try{_0x304b85=await _0x558cb0[_0x4751f8(0xc8)]['previewParentYaml'](_0x1e188d,_0x407298),_0x5b3b5b[_0x4751f8(0x207)]();}catch(_0x540f9f){_0x5b3b5b['stop']();throw _0x540f9f;}return await this[_0x4751f8(0x200)](_0x304b85,{'master':_0x4395c0['master'],'attribute':typeof _0x4395c0['attribute']==='string'?_0x4395c0[_0x4751f8(0x9e)]:undefined,'behavior':typeof _0x4395c0[_0x4751f8(0x105)]===_0x4751f8(0x1c9)?_0x4395c0[_0x4751f8(0x105)]:undefined,'enriched':_0x4395c0[_0x4751f8(0x127)]}),_0x304b85['allValid']?0x0:0x1;}async[a29_0x5da2a6(0x200)](_0x2e7b82,_0x34e508){const _0x2bbd7d=a29_0x5da2a6;console[_0x2bbd7d(0x1fe)]('\x0a'+a29_0xaf6826[_0x2bbd7d(0x1c0)]('Preview:')+'\x20'+_0x2e7b82[_0x2bbd7d(0xa5)]),console[_0x2bbd7d(0x1fe)]('═'['repeat'](0x3c));if(_0x34e508['master']&&_0x2e7b82['sampleData']){const _0x820308=a29_0xaf6826[_0x2bbd7d(0x142)](_0x2bbd7d(0x1cf))+'\x20'+a29_0xaf6826['bold'](_0x2e7b82[_0x2bbd7d(0x1e8)][_0x2bbd7d(0x1cc)]+'.'+_0x2e7b82[_0x2bbd7d(0x1e8)][_0x2bbd7d(0x219)]);await this['displaySampleData'](_0x820308,_0x2e7b82['sampleData']);}else{if(_0x34e508['attribute']&&_0x2e7b82['sampleData']){const _0x3805f6=a29_0xaf6826['dim']('Attribute:')+'\x20'+a29_0xaf6826['bold'](_0x34e508['attribute']);await this[_0x2bbd7d(0x175)](_0x3805f6,_0x2e7b82[_0x2bbd7d(0xf5)]);}else{if(_0x34e508[_0x2bbd7d(0x105)]&&_0x2e7b82['sampleData']){const _0x5cdf26=a29_0xaf6826[_0x2bbd7d(0x142)]('Behavior:')+'\x20'+a29_0xaf6826[_0x2bbd7d(0x1c0)](_0x34e508[_0x2bbd7d(0x105)]);await this[_0x2bbd7d(0x175)](_0x5cdf26,_0x2e7b82[_0x2bbd7d(0xf5)]);}else{if(_0x34e508['enriched']&&_0x2e7b82[_0x2bbd7d(0xf5)]){const _0x2fcf50=a29_0xaf6826['dim']('Enriched:')+'\x20'+a29_0xaf6826['bold']('Master\x20+\x20Attributes');await this[_0x2bbd7d(0x175)](_0x2fcf50,_0x2e7b82[_0x2bbd7d(0xf5)]);}else!_0x2e7b82[_0x2bbd7d(0xf5)]&&console['error'](_0x2bbd7d(0xe4));}}}if(_0x2e7b82[_0x2bbd7d(0x102)][_0x2bbd7d(0xf7)]>0x0){console[_0x2bbd7d(0x1fe)]('─'['repeat'](0x3c)),console[_0x2bbd7d(0x1fe)]('\x0a'+a29_0xaf6826['red'](_0x2bbd7d(0x126)));for(const _0x44241b of _0x2e7b82['errors']){console[_0x2bbd7d(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x2bbd7d(0x215)]('•')+'\x20'+_0x44241b);}}}async[a29_0x5da2a6(0x175)](_0x5d4219,_0x4620dd){const _0x2502c9=a29_0x5da2a6;if(_0x4620dd[_0x2502c9(0xf7)]===0x0){console[_0x2502c9(0x1fe)]('\x0a'+_0x5d4219),console[_0x2502c9(0x1fe)](_0x2502c9(0xd1));return;}console[_0x2502c9(0x1fe)]('\x0a'+_0x5d4219);const _0x8ea126=Object[_0x2502c9(0x9a)](_0x4620dd[0x0])[_0x2502c9(0x14e)](_0x1c6db8=>({'name':_0x1c6db8,'type':typeof _0x4620dd[0x0][_0x1c6db8]===_0x2502c9(0x144)?_0x2502c9(0x1dc):_0x2502c9(0x1a2)})),_0x512ef1={'queryId':'preview','columns':_0x8ea126,'data':_0x4620dd,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4620dd[_0x2502c9(0xf7)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x10d88b=formatAsTable(_0x512ef1,_0x4620dd['length'],!![]);await writeOutput(_0x10d88b,undefined,_0x2502c9(0x219));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x5da2a6(0xa5)]='segment:parent:run';['description']=a29_0x5da2a6(0xce);async[a29_0x5da2a6(0xfc)](_0x477441){const _0x176628=a29_0x5da2a6,{options:_0x205592,args:_0x5a89c8,tdx:_0x4b99ef}=_0x477441,_0x221c68=_0x205592,_0x2dd894=_0x5a89c8[0x0]||_0x205592[_0x176628(0x169)];if(!_0x2dd894)return showParentSegmentNotSetError(_0x176628(0x104)+_0x176628(0x208)),0x1;const _0x358947=resolveYamlFile(_0x2dd894);if(existsSync(_0x358947)){_0x221c68[_0x176628(0x1d3)]&&console['error'](_0x176628(0xf4)+_0x358947);let _0x3179a6;try{_0x3179a6=readFileSync(_0x358947,_0x176628(0x1d5));}catch(_0x59f812){const _0x3c73e0=_0x59f812 instanceof Error?_0x59f812[_0x176628(0x1bd)]:String(_0x59f812);return console[_0x176628(0x1fe)](_0x176628(0x11d)+_0x3c73e0),0x1;}const _0x539a9e=await withSpinner('Analyzing\x20changes...',()=>_0x4b99ef['segment'][_0x176628(0x119)](_0x3179a6),{'verbose':_0x221c68[_0x176628(0x1d3)]}),_0x13453b=_0x539a9e[_0x176628(0x112)],{isNew:_0x25d06d,name:_0x4b39fc,hasChanges:_0x5df1c9,diffFormatted:_0x40c774}=_0x13453b;if(_0x5df1c9){_0x25d06d?console[_0x176628(0x1fe)](_0x176628(0x114)+_0x4b39fc+'\x27:'):console[_0x176628(0x1fe)](_0x176628(0xd9)+_0x4b39fc+'\x27:');console[_0x176628(0x1fe)]('─'['repeat'](0x3c)),console['error'](_0x40c774),console[_0x176628(0x1fe)]('─'['repeat'](0x3c));const _0xfc6c26=_0x25d06d?_0x176628(0x1dd)+_0x4b39fc+_0x176628(0x1b7):_0x176628(0x20a)+_0x4b39fc+'\x27\x20and\x20run\x20workflow?';if(!_0x221c68[_0x176628(0x124)]){if(!isInteractive())return console[_0x176628(0x1fe)](a29_0xaf6826[_0x176628(0x215)](_0x176628(0x165)),_0x176628(0x11e)),console[_0x176628(0x1fe)](a29_0xaf6826['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0xcc829=await confirmKey(_0xfc6c26);if(!_0xcc829)return console[_0x176628(0x1fe)](a29_0xaf6826['yellow'](_0x176628(0x1c6))),0x1;}const _0xc06274=_0x25d06d?_0x176628(0x10c):_0x176628(0x177);await withSpinner(_0xc06274+'\x20parent\x20segment\x20\x27'+_0x4b39fc+_0x176628(0x93),()=>_0x13453b[_0x176628(0x218)](),{'verbose':_0x221c68['verbose']});const _0x1f39df=_0x25d06d?_0x176628(0xbb):_0x176628(0x1fa);console[_0x176628(0x1fe)]('✔\x20'+_0x1f39df+'\x20parent\x20segment\x20\x27'+_0x4b39fc+'\x27');}else console['error'](_0x176628(0x1c8)+_0x4b39fc+_0x176628(0x1fd));}const _0x3e91a8=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x2dd894+_0x176628(0x93),()=>_0x4b99ef[_0x176628(0xc8)][_0x176628(0x1a4)](_0x2dd894),{'verbose':_0x221c68[_0x176628(0x1d3)]}),_0x42d705=_0x3e91a8[_0x176628(0x112)],_0xf7da51=getConsoleUrl(_0x221c68[_0x176628(0x19c)],'/app/workflows/'+_0x42d705[_0x176628(0x139)]+'/sessions/'+_0x42d705[_0x176628(0x1cb)]+'/attempt/'+_0x42d705[_0x176628(0x1a8)]);return console[_0x176628(0x1fe)](_0x176628(0xb9)),console[_0x176628(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x176628(0x142)](_0x176628(0xc4))+'\x20'+_0x42d705[_0x176628(0x161)]),console['error']('\x20\x20'+a29_0xaf6826['dim'](_0x176628(0x1b9))+'\x20'+_0x42d705[_0x176628(0x1bb)]),console[_0x176628(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x176628(0x142)](_0x176628(0xd2))+'\x20'+_0x42d705[_0x176628(0x1cb)]),console[_0x176628(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x176628(0x142)](_0x176628(0xd3))+'\x20'+_0x42d705[_0x176628(0x1a8)]),console[_0x176628(0x1fe)]('\x20\x20'+_0xf7da51),console[_0x176628(0x1fe)]('\x0a'+a29_0xaf6826[_0x176628(0x142)]('To\x20cancel:')+'\x20tdx\x20wf\x20attempt\x20'+_0x42d705['workflowAttemptId']+_0x176628(0xe6)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0x134);[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x1b0);async[a29_0x5da2a6(0xfc)](_0x23cf70){const _0x2456f4=a29_0x5da2a6,{options:_0x519f23,args:_0x32d1ef,tdx:_0x3690f3}=_0x23cf70,_0x83a62d=_0x32d1ef[0x0]||_0x519f23[_0x2456f4(0x169)];if(!_0x83a62d)return showParentSegmentNotSetError(_0x2456f4(0xc7)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x519f23[_0x2456f4(0x1d3)]&&(console[_0x2456f4(0x1fe)]('Site:\x20'+_0x519f23['site']),console[_0x2456f4(0x1fe)](_0x2456f4(0xc1)+_0x83a62d));const _0x5c3b3b=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x83a62d+_0x2456f4(0x93),()=>_0x3690f3[_0x2456f4(0xc8)][_0x2456f4(0x198)](_0x83a62d),{'verbose':_0x519f23['verbose']}),_0x48c152=_0x5c3b3b[_0x2456f4(0x112)];console[_0x2456f4(0x1fe)](_0x2456f4(0x1d6)+_0x48c152[_0x2456f4(0xf7)]+_0x2456f4(0xd7)+(_0x48c152[_0x2456f4(0xf7)]!==0x1?'s':''));if(_0x519f23['json']||_0x519f23[_0x2456f4(0x216)])return await handleSDKOutput(_0x48c152,_0x519f23),0x0;return displayFieldsHumanReadable(_0x48c152,_0x83a62d),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0x17a);[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x13f);async[a29_0x5da2a6(0xfc)](_0x3d3389){const _0xd3f554=a29_0x5da2a6,{options:_0x43df6a,args:_0x201d8e,tdx:_0x1736e5}=_0x3d3389,_0x1edf0b=_0x43df6a,_0x3629e3=_0x201d8e[0x0]||_0x43df6a[_0xd3f554(0x169)];if(!_0x3629e3)return showParentSegmentNotSetError(_0xd3f554(0xae)+_0xd3f554(0xda)+_0xd3f554(0x153)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x43df6a[_0xd3f554(0x1d3)]&&(console['error'](_0xd3f554(0x157)+_0x43df6a['site']),console[_0xd3f554(0x1fe)]('Parent\x20segment:\x20'+_0x3629e3));const _0x7d1a11=await withSpinner(_0xd3f554(0x107)+_0x3629e3+_0xd3f554(0x93),()=>_0x1736e5[_0xd3f554(0xc8)][_0xd3f554(0xc0)](_0x3629e3),{'verbose':_0x43df6a[_0xd3f554(0x1d3)]}),_0x199087=_0x7d1a11[_0xd3f554(0x112)];if(_0x1edf0b[_0xd3f554(0x19e)]){const _0x262768=getConsoleNextUrl(_0x1edf0b[_0xd3f554(0x19c)],_0xd3f554(0xf6)+_0x199087['id']);return console[_0xd3f554(0x1fe)](a29_0xaf6826[_0xd3f554(0x1d0)]('✔')+_0xd3f554(0x121)+a29_0xaf6826['cyan'](_0x262768)),openBrowser(_0x262768),0x0;}return await handleSingleObjectOutput(_0x199087,_0x43df6a),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]='segment:parent:desc';[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x1ea);async['execute'](_0x1d4582){const _0x3ac559=a29_0x5da2a6,{options:_0x465797,args:_0x4e4086,tdx:_0x4f52b3}=_0x1d4582,_0x48981b=_0x465797,_0x404936=_0x4e4086[0x0]||_0x465797[_0x3ac559(0x169)];if(!_0x404936)return showParentSegmentNotSetError(_0x3ac559(0x9c)+_0x3ac559(0xe0)+_0x3ac559(0x153)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x465797['verbose']&&(console[_0x3ac559(0x1fe)](_0x3ac559(0x157)+_0x465797[_0x3ac559(0x19c)]),console[_0x3ac559(0x1fe)](_0x3ac559(0xc1)+_0x404936));const _0x3e170e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x404936+_0x3ac559(0x93),()=>_0x4f52b3[_0x3ac559(0xc8)][_0x3ac559(0x10d)](_0x404936),{'verbose':_0x465797[_0x3ac559(0x1d3)]}),_0x1cebd9=_0x3e170e[_0x3ac559(0x112)],_0x265c5f=_0x4f52b3[_0x3ac559(0xc8)][_0x3ac559(0x20b)](_0x1cebd9);if(_0x48981b[_0x3ac559(0x1bf)]){const _0x426aab=await this[_0x3ac559(0x1c2)](_0x1d4582,_0x404936,_0x1cebd9,_0x265c5f),_0x2e876e=this[_0x3ac559(0x100)](_0x426aab);writeFileSync(_0x48981b['output'],_0x2e876e);const _0x4770e6=_0x426aab['customers']['columns'][_0x3ac559(0xf7)]+_0x426aab[_0x3ac559(0xe5)]['reduce']((_0x18668b,_0x49ca46)=>_0x18668b+_0x49ca46[_0x3ac559(0x194)][_0x3ac559(0xf7)],0x0),_0x5b7ee7=_0x426aab[_0x3ac559(0xe5)][_0x3ac559(0x12a)](_0x317b50=>_0x317b50[_0x3ac559(0x194)][_0x3ac559(0xf7)]===0x0)[_0x3ac559(0xf7)];return console[_0x3ac559(0x151)](_0x3ac559(0x99)+_0x48981b[_0x3ac559(0x1bf)]),console[_0x3ac559(0x151)](_0x3ac559(0x129)+_0x265c5f),console[_0x3ac559(0x151)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x426aab['behaviors'][_0x3ac559(0xf7)]+_0x3ac559(0x17d)),console[_0x3ac559(0x151)](_0x3ac559(0x158)+_0x4770e6+'\x20total'),_0x5b7ee7>0x0&&console[_0x3ac559(0x151)]('\x20\x20Note:\x20'+_0x5b7ee7+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x3ac559(0x1fe)]('\x0a'+a29_0xaf6826['bold'](_0x3ac559(0x15c))+'\x20'+a29_0xaf6826[_0x3ac559(0x202)](_0x265c5f));const _0x1560cf=await withSpinner(_0x3ac559(0x1f1),()=>_0x4f52b3[_0x3ac559(0xc8)][_0x3ac559(0x18d)](_0x1cebd9),{'verbose':_0x465797[_0x3ac559(0x1d3)]});console[_0x3ac559(0x1fe)]('\x0a'+a29_0xaf6826[_0x3ac559(0x1c0)](_0x3ac559(0x193))+'\x20'+a29_0xaf6826[_0x3ac559(0x142)]('('+_0x265c5f+_0x3ac559(0x15b)));const _0xf07904=await executeSchemaQuery(_0x1560cf[_0x3ac559(0x112)],_0x4f52b3,_0x465797);await handleQueryOutput(_0xf07904,_0x465797);const _0x381995=await withSpinner(_0x3ac559(0x181),()=>_0x4f52b3['segment'][_0x3ac559(0xb3)](_0x1cebd9),{'verbose':_0x465797[_0x3ac559(0x1d3)]});for(const _0x2c8ca0 of _0x381995[_0x3ac559(0x112)]){const _0x10ca2d=_0x3ac559(0x1e3)+_0x2c8ca0[_0x3ac559(0x1a0)]()[_0x3ac559(0x18b)](/\s+/g,'_'),_0x43426a=_0x3ac559(0x14b)+_0x265c5f+'.'+_0x10ca2d;console[_0x3ac559(0x1fe)]('\x0a'+a29_0xaf6826[_0x3ac559(0x1c0)](_0x2c8ca0)+'\x20'+a29_0xaf6826[_0x3ac559(0x142)]('('+_0x265c5f+'.'+_0x10ca2d+')'));try{const _0x8cc99c=await executeSchemaQuery(_0x43426a,_0x4f52b3,_0x465797);await handleQueryOutput(_0x8cc99c,_0x465797);}catch{console[_0x3ac559(0x1fe)](a29_0xaf6826[_0x3ac559(0x12b)](_0x3ac559(0xfa)));}}return 0x0;}async[a29_0x5da2a6(0x1c2)](_0x9ef315,_0x4a7263,_0x1715ef,_0x157eb8){const _0x480ed1=a29_0x5da2a6,{options:_0x335b11,tdx:_0x391afa}=_0x9ef315,_0x51c97c=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x391afa[_0x480ed1(0xc8)]['getParentSQL'](_0x1715ef),{'verbose':_0x335b11[_0x480ed1(0x1d3)]}),_0x4ba127=await executeSchemaQuery(_0x51c97c[_0x480ed1(0x112)],_0x391afa,_0x335b11),_0x7d15f0=_0x4ba127[_0x480ed1(0x112)][_0x480ed1(0x14e)](_0x11cdd5=>({'name':_0x11cdd5['column_name'],'type':_0x11cdd5[_0x480ed1(0xbe)]})),_0x199484=await withSpinner(_0x480ed1(0x181),()=>_0x391afa['segment'][_0x480ed1(0xb3)](_0x1715ef),{'verbose':_0x335b11[_0x480ed1(0x1d3)]}),_0x1975e9=[];for(const _0x4d654e of _0x199484[_0x480ed1(0x112)]){const _0x115990=_0x480ed1(0x1e3)+_0x4d654e[_0x480ed1(0x1a0)]()[_0x480ed1(0x18b)](/\s+/g,'_'),_0x427159=_0x480ed1(0x14b)+_0x157eb8+'.'+_0x115990;let _0x2a50c6=[];try{const _0x56e547=await executeSchemaQuery(_0x427159,_0x391afa,_0x335b11);_0x2a50c6=_0x56e547['data'][_0x480ed1(0x14e)](_0x502afe=>({'name':_0x502afe[_0x480ed1(0xcd)],'type':_0x502afe[_0x480ed1(0xbe)]}));}catch{}_0x1975e9[_0x480ed1(0x209)]({'table':_0x115990,'columns':_0x2a50c6});}return{'database':_0x157eb8,'parent_segment':_0x4a7263,'parent_id':_0x1715ef,'customers':{'table':'customers','columns':_0x7d15f0},'behaviors':_0x1975e9};}[a29_0x5da2a6(0x100)](_0x42c9a2){const _0x4ec95b=a29_0x5da2a6,_0x410b3d=_0x2c32b0=>{const _0x27af2e=a29_0x1dd0;if(_0x2c32b0[_0x27af2e(0xf7)]===0x0)return'[]';const _0x34291b=_0x2c32b0[_0x27af2e(0x14e)](_0x28d61b=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x28d61b[_0x27af2e(0xa5)]+_0x27af2e(0x184)+_0x28d61b['type']+_0x27af2e(0x14f));return'[\x0a'+_0x34291b['join'](',\x0a')+_0x27af2e(0xca);},_0x1f2fd9=_0x42c9a2['behaviors'][_0x4ec95b(0x14e)](_0x257dd1=>{const _0x3d662b=_0x4ec95b;return _0x3d662b(0xb4)+_0x257dd1[_0x3d662b(0x219)]+_0x3d662b(0x17c)+_0x410b3d(_0x257dd1[_0x3d662b(0x194)])['replace'](/^/gm,'\x20\x20')[_0x3d662b(0x1de)]()+'\x0a\x20\x20\x20\x20}';})[_0x4ec95b(0x19b)](',\x0a');return _0x4ec95b(0x145)+_0x42c9a2['database']+_0x4ec95b(0x1ee)+_0x42c9a2[_0x4ec95b(0x1aa)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x42c9a2[_0x4ec95b(0xa2)]+_0x4ec95b(0xe7)+_0x42c9a2['customers']['table']+_0x4ec95b(0x15a)+_0x410b3d(_0x42c9a2['customers'][_0x4ec95b(0x194)])[_0x4ec95b(0x18b)](/^/gm,'\x20\x20')[_0x4ec95b(0x1de)]()+_0x4ec95b(0x21b)+_0x1f2fd9+_0x4ec95b(0x122);}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0x210);[a29_0x5da2a6(0x120)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a29_0x5da2a6(0xfc)](_0x639812){const _0x1cfe44=a29_0x5da2a6,{options:_0x59a219,args:_0x3180c2,tdx:_0x5d8cd8}=_0x639812,_0x493e47=_0x3180c2[0x0]||_0x59a219[_0x1cfe44(0x169)];if(!_0x493e47)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x59a219[_0x1cfe44(0x1d3)]&&(console[_0x1cfe44(0x1fe)]('Site:\x20'+_0x59a219[_0x1cfe44(0x19c)]),console[_0x1cfe44(0x1fe)]('Parent\x20segment:\x20'+_0x493e47));const _0x1119e7=await withSpinner(_0x1cfe44(0x110)+_0x493e47+_0x1cfe44(0x93),()=>_0x5d8cd8[_0x1cfe44(0xc8)][_0x1cfe44(0x10d)](_0x493e47),{'verbose':_0x59a219[_0x1cfe44(0x1d3)]}),_0x46a5d7=_0x1119e7[_0x1cfe44(0x112)],_0x4cc7bc=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x493e47+_0x1cfe44(0x93),()=>_0x5d8cd8['segment'][_0x1cfe44(0x18d)](_0x46a5d7),{'verbose':_0x59a219[_0x1cfe44(0x1d3)]}),_0x9ca7ba=_0x4cc7bc['data'];return _0x59a219[_0x1cfe44(0x106)]===_0x1cfe44(0x1f5)||_0x59a219[_0x1cfe44(0x106)]===_0x1cfe44(0x216)?await handleSDKOutput([{'sql':_0x9ca7ba}],_0x59a219):console['log'](_0x9ca7ba),0x0;}}function a29_0x3e11(){const _0x2b7813=['segment','\x0aChanges\x20to\x20\x27','\x0a\x20\x20\x20\x20]','\x20configured','information_schema','column_name','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','/\x20directory.\x0a','segment:parent:preview','\x20\x20No\x20sample\x20data\x20available','Session:','Attempt:','Master\x20Table','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Analyzing\x20changes...','\x20field','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Creating\x20parent\x20segment\x20\x27','\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','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20--behavior\x20\x22','in\x20','\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','displayColumns','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x0aNo\x20sample\x20data\x20available','behaviors','\x20kill','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20is\x20already\x20up\x20to\x20date','totalEvents','Attributes:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Overwrite\x20\x27','user_id','schemaValid','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','segment:parent:show','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20+\x20[','Found\x20YAML\x20file:\x20','sampleData','/app/dw/parentSegments/','length','\x0aUsage:\x20tdx\x20ps\x20preview\x20','To\x20view\x20sample\x20data:','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','test','execute','\x20personalization\x20service','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20service','formatSchemaJson','matchedCount','errors','Updating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','behavior','format','Fetching\x20parent\x20segment\x20\x27','Columns:','localeCompare','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Creating','resolveParentId','attributes','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Resolving\x20parent\x20segment\x20\x27','6WxPgDE','data','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x0aNew\x20parent\x20segment\x20\x27','Listing\x20personalization\x20services\x20for\x20\x27','customerGroup','1698280fzbPTu','146788vSocki','pushParentYaml','events','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20--attribute\x20\x22','Error\x20reading\x20file:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','trigger_event','description','\x20Opening\x20','\x0a\x20\x20]\x0a}\x0a','joinKey','yes','all','Errors:','enriched','toLocaleString','\x20\x20Database:\x20','filter','yellow','\x27\x20is\x20already\x20up\x20to\x20date','addAttributesFile','jobId','\x20\x201.\x20Edit\x20','idStitching','\x20Context\x20set:\x20','createParent','\x20No\x20changes\x20-\x20','segment:parent:fields','\x20section','true','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Customers:','workflowId','\x27\x20with\x20ID:\x20','customersWithEvents','foreignKey','⚡\x20Not\x20enabled','ID\x20Stitching:','Show\x20parent\x20segment\x20details','Listing\x20RT-enabled\x20parent\x20segments...','Error:','dim','run','number','{\x0a\x20\x20\x22database\x22:\x20\x22','stats','ps:pz:init','column','list','\x20--attribute\x20\x22<name>\x22','SELECT\x20*\x20FROM\x20','limit','elapsedTimeMillis','map','\x22\x20}','personalizationServices','log','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Options:\x0a','displayValidateResults','rowCount','segment:parent:pull','Site:\x20','\x20\x20Columns:\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','.customers)','Output\x20Database:','Coverage:','.yaml','personalization_services','darwin','audienceId','realtime','RT\x202.0:','\x20\x20\x20\x20','\x0aError:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','parent_segments','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','parentSegment','query','\x20Added\x20personalization\x20template\x20to\x20','List\x20parent\x20segments','No\x20RT-enabled\x20parent\x20segments\x20found','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','displayRealtimeInfo','Available\x20attributes:','\x20=\x20','use','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20[Job\x20ID:\x20','displaySampleData','validateParentYaml','Updating','Personalization\x20service\x20description','\x20RT-enabled\x20parent\x20segment','segment:parent:view','Table:\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20behaviors','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Source:','interval','Fetching\x20behavior\x20list...','✔\x20Created\x20parent\x20segment\x20\x27','2603034qsRgfj','\x22,\x20\x22type\x22:\x20\x22','behaviorsFile','scheduleOption','addBehaviorsFile','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x5c$&','processedRows','replace','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','getParentSQL','\x20\x20\x20','\x20service(s)\x20configured','\x20to\x20push\x20the\x20configuration','Executing\x20parent\x20segment\x20query...','\x20rows\x20','customers','columns','\x0a⚠️\x20\x20Migrating:\x20','sourceTableValid','Attributes','listFields','Error:\x20Parent\x20segment\x20name\x20is\x20required','stitchingKeys','join','site','Options\x20(one\x20required):\x0a','web','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','toLowerCase','RT\x202.0\x20Validate:','varchar','attributesFile','runParent','isDirectory','⚡\x20Enabled','✔\x20Query\x20completed:\x20Processed\x20','workflowAttemptId','\x20Configuration\x20is\x20valid','parent_segment','👥\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Fetching\x20current\x20configuration\x20for\x20\x27','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Validating\x20RT\x20configuration...','List\x20available\x20fields\x20for\x20segmentation','Name:\x20','listParents','-1d','Available\x20behaviors:','scheduleType','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x27\x20and\x20run\x20workflow?','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Status:','\x20Added\x20RT\x202.0\x20template\x20section','status','personalization','message','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','output','bold','Validating\x20configuration...','collectSchema','last_page_viewed','/\x20and\x20','indexOf','Aborted.','6wxJfqp','✔\x20No\x20changes\x20-\x20\x27','string','endsWith','workflowSessionId','database','displayMasterInfo','updateParent','Master:','green','Default','displayBehaviorsStats','verbose','displayAttributesStats','utf-8','✔\x20Found\x20','start','coveragePercent','Next\x20steps:','single','toFixed','double','Create\x20parent\x20segment\x20\x27','trim','realtime_enabled','Output\x20file:\x20','customerGroupFile','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','behavior_','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','Error:\x20File\x20not\x20found:\x20','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','SQL\x20query:\x0a','master','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','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','/{name}.yml\x0a','sections','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','1163620mOnklc','\x20\x202.\x20Run\x20','Fetching\x20customers\x20schema...','\x20--behavior\x20\x22<name>\x22','schemaError','allValid','json','\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','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x20parent\x20segment\x20\x27','242248VzdbtG','Updated','Personalization:','td_client_id','\x27\x20is\x20up\x20to\x20date','error','label','displayPreviewResults','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','cyan','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','Rows:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','stop','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','push','Apply\x20changes\x20to\x20\x27','getOutputDatabaseName','displaySummary','SELECT\x20*\x20FROM\x20(\x0a','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','sort','segment:parent:sql','timezone','addAttributes','2138193yjWBvK','text','red','jsonl','380388BUunqu','apply','table','Error\x20parsing\x20YAML:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','repeat','✔\x20Renamed\x20directory\x20to\x20','\x20trigger=','\x27...','Database:\x20','population','page_view','\x20--interval\x20','%)\x20','Schema\x20saved\x20to\x20','keys','enabled','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','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','attribute','<database>.<table>','platform','Join:','parent_id','/\x20directories\x20exist.','\x20\x20\x20\x20-\x20','name','segment:parent:push','open','segment:parent:validate','unref','.yml','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','My\x20Service','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20SQL\x20for\x20\x27','Events:','getBehaviorNames','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','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','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','sourceTableError','\x0a✔\x20Workflow\x20started','tdx\x20ps\x20push\x20','Created','Listing\x20parent\x20segments\x20matching\x20\x27','customerPercent','column_type','tdx\x20ps\x20preview\x20','getParentFull','Parent\x20segment:\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Listing\x20parent\x20segments...','Audience\x20ID:','type','displayPreviewHints','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'];a29_0x3e11=function(){return _0x2b7813;};return a29_0x3e11();}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]=a29_0x5da2a6(0xf0);['description']=a29_0x5da2a6(0x1ae);async[a29_0x5da2a6(0xfc)](_0xbcd43a){const _0x310bb3=a29_0x5da2a6,{options:_0xd5dfa6,args:_0x255c9e,tdx:_0x311882}=_0xbcd43a,_0x1d494d=_0x255c9e[0x0]||_0xd5dfa6['parentSegment'];if(!_0x1d494d)return showParentSegmentNotSetError(_0x310bb3(0x201)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0xd5dfa6[_0x310bb3(0x1d3)]&&(console[_0x310bb3(0x1fe)](_0x310bb3(0x157)+_0xd5dfa6[_0x310bb3(0x19c)]),console['error'](_0x310bb3(0xc1)+_0x1d494d));const _0x3d2b4a=await withSpinner(_0x310bb3(0x110)+_0x1d494d+_0x310bb3(0x93),()=>_0x311882['segment']['resolveParentId'](_0x1d494d),{'verbose':_0xd5dfa6[_0x310bb3(0x1d3)]}),_0x1647ef=_0x3d2b4a['data'],_0x320136=await withSpinner(_0x310bb3(0xb1)+_0x1d494d+'\x27...',()=>_0x311882[_0x310bb3(0xc8)][_0x310bb3(0x18d)](_0x1647ef),{'verbose':_0xd5dfa6[_0x310bb3(0x1d3)]});let _0xa52c63=_0x320136[_0x310bb3(0x112)];const _0xe1f1fd=resolveLimit(_0xd5dfa6[_0x310bb3(0x14c)],DEFAULT_DISPLAY_LIMIT),_0x2b2176=/\bLIMIT\s+\d+/i[_0x310bb3(0xfb)](_0xa52c63);!_0x2b2176&&(_0xa52c63=_0xa52c63[_0x310bb3(0x1de)]()[_0x310bb3(0x18b)](/;+$/,''),_0xa52c63=_0x310bb3(0x20d)+_0xa52c63+_0x310bb3(0xb0)+_0xe1f1fd);_0xd5dfa6[_0x310bb3(0x1d3)]&&console[_0x310bb3(0x1fe)](_0x310bb3(0x1e7)+_0xa52c63);const _0x2fc959=await withProgressSpinner(_0x310bb3(0x191),async _0x316f02=>{const _0x24a5f8=_0x310bb3,_0x208fae=await _0x311882[_0x24a5f8(0x16a)][_0x24a5f8(0xfc)](_0xa52c63,{'catalog':'td','schema':_0x24a5f8(0xcc),'onJobId':_0x3171bb=>{_0x316f02['setJobId'](_0x3171bb);}});return _0x208fae;},{'verbose':_0xd5dfa6[_0x310bb3(0x1d3)]}),_0x5e3ea6=_0x2fc959['data'],_0x407e33=_0x5e3ea6[_0x310bb3(0x12e)]?_0x310bb3(0x174)+_0x5e3ea6[_0x310bb3(0x12e)]+']':'';return console[_0x310bb3(0x1fe)](_0x310bb3(0x1a7)+_0x5e3ea6[_0x310bb3(0x146)][_0x310bb3(0x18a)][_0x310bb3(0x128)]()+_0x310bb3(0x192)+(_0x310bb3(0xdf)+formatElapsed(_0x5e3ea6[_0x310bb3(0x146)][_0x310bb3(0x14d)])+_0x407e33)),await handleQueryOutput(_0x5e3ea6,_0xd5dfa6),0x0;}}export class PSRtListCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]='ps:rt:list';['description']=a29_0x5da2a6(0x1e2);async['execute'](_0x3944bf){const _0xf9faa3=a29_0x5da2a6,{options:_0x3003f5,args:_0x5b0a05,tdx:_0x581e7b}=_0x3944bf,_0x430701=_0x5b0a05[0x0],_0x1a8794=await withSpinner(_0x430701?_0xf9faa3(0x1be)+_0x430701+_0xf9faa3(0x93):_0xf9faa3(0x140),()=>_0x581e7b[_0xf9faa3(0x162)][_0xf9faa3(0x149)](),{'verbose':_0x3003f5[_0xf9faa3(0x1d3)]});let _0x42cd95=_0x1a8794[_0xf9faa3(0x112)][_0xf9faa3(0x12a)](_0x306d2f=>_0x306d2f[_0xf9faa3(0x1df)]);if(_0x430701){const _0x8c620=_0x430701[_0xf9faa3(0x18b)](/[.+^${}()|[\]\\]/g,_0xf9faa3(0x189))[_0xf9faa3(0x18b)](/\*/g,'.*')[_0xf9faa3(0x18b)](/\?/g,'.'),_0x2b9c4a=new RegExp('^'+_0x8c620+'$','i');_0x42cd95=_0x42cd95[_0xf9faa3(0x12a)](_0x55e16e=>_0x2b9c4a[_0xf9faa3(0xfb)](_0x55e16e[_0xf9faa3(0xa5)]));}_0x42cd95[_0xf9faa3(0x20f)]((_0x55a1df,_0x384069)=>_0x55a1df[_0xf9faa3(0xa5)][_0xf9faa3(0x109)](_0x384069['name'])),console[_0xf9faa3(0x1fe)](_0xf9faa3(0x1d6)+_0x42cd95[_0xf9faa3(0xf7)]+_0xf9faa3(0x179)+(_0x42cd95[_0xf9faa3(0xf7)]!==0x1?'s':''));const _0x27859d=_0x2c69da=>{const _0x12a10e=_0xf9faa3;return getConsoleNextUrl(_0x3003f5['site'],_0x12a10e(0xf6)+_0x2c69da);};if(_0x3003f5[_0xf9faa3(0x106)]===_0xf9faa3(0x1f5)||_0x3003f5[_0xf9faa3(0x106)]===_0xf9faa3(0x216)){const _0x14cbb5=_0x42cd95[_0xf9faa3(0x14e)](_0x5d9278=>({..._0x5d9278,'url':_0x27859d(_0x5d9278['id'])}));await handleSDKOutput(_0x14cbb5,_0x3003f5);}else{if(_0x42cd95[_0xf9faa3(0xf7)]===0x0)console[_0xf9faa3(0x151)](_0xf9faa3(0x16d));else for(const _0x32e6a4 of _0x42cd95){const _0x12cf5b=_0x32e6a4[_0xf9faa3(0x95)]?a29_0xaf6826[_0xf9faa3(0x142)]('\x20('+formatRows(_0x32e6a4[_0xf9faa3(0x95)])+')'):'',_0x32a73f=hyperlink(_0x32e6a4[_0xf9faa3(0xa5)],_0x27859d(_0x32e6a4['id']));console[_0xf9faa3(0x151)]('⚡\x20'+_0x32a73f+_0x12cf5b);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x5da2a6(0xa5)]='ps:rt:validate';[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x1e4);async[a29_0x5da2a6(0xfc)](_0x1d05ff){const _0x238d8e=a29_0x5da2a6,{options:_0x2c1ab8,args:_0x3befe9,tdx:_0xc220d7}=_0x1d05ff,_0x487fef=_0x3befe9[0x0]||_0x2c1ab8['parentSegment'];if(!_0x487fef)return showParentSegmentNotSetError(_0x238d8e(0xe2)+_0x238d8e(0x1f6)),0x1;const _0x1d7f88=resolveYamlFile(_0x487fef);if(!existsSync(_0x1d7f88))return showFileNotFoundError(_0x1d7f88,_0x487fef),0x1;let _0x50cad0;try{_0x50cad0=readFileSync(_0x1d7f88,_0x238d8e(0x1d5));}catch(_0x1f0536){const _0x58fa18=_0x1f0536 instanceof Error?_0x1f0536['message']:String(_0x1f0536);return console[_0x238d8e(0x1fe)](_0x238d8e(0x11d)+_0x58fa18),0x1;}const _0x53caef=createCommandSpinner(a29_0xaf6826[_0x238d8e(0x142)](_0x238d8e(0x1af)),{'verbose':_0x2c1ab8[_0x238d8e(0x1d3)]});_0x53caef[_0x238d8e(0x1d7)]();const _0x38b714={'realtime':!![],'onProgress':_0x5e08bc=>{const _0x190486=_0x238d8e;_0x53caef[_0x190486(0x214)]=formatProgressMessage(_0x5e08bc);}};let _0x453bbe;try{_0x453bbe=await _0xc220d7[_0x238d8e(0xc8)][_0x238d8e(0x176)](_0x50cad0,_0x38b714),_0x53caef[_0x238d8e(0x207)]();}catch(_0x5aa924){_0x53caef[_0x238d8e(0x207)]();throw _0x5aa924;}console['error']('\x0a'+a29_0xaf6826[_0x238d8e(0x1c0)](_0x238d8e(0x1a1))+'\x20'+_0x453bbe[_0x238d8e(0xa5)]),console[_0x238d8e(0x1fe)]('═'[_0x238d8e(0x90)](0x3c)),displayRealtimeValidation(_0x453bbe),console[_0x238d8e(0x1fe)]('─'[_0x238d8e(0x90)](0x3c));if(_0x453bbe['errors'][_0x238d8e(0xf7)]>0x0){console[_0x238d8e(0x1fe)]('\x0a'+a29_0xaf6826['red'](_0x238d8e(0x126)));for(const _0x1cf018 of _0x453bbe[_0x238d8e(0x102)]){console[_0x238d8e(0x1fe)]('\x20\x20'+a29_0xaf6826[_0x238d8e(0x215)]('•')+'\x20'+_0x1cf018);}}return _0x453bbe[_0x238d8e(0x1f4)]&&console[_0x238d8e(0x1fe)]('\x0a'+a29_0xaf6826['green']('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x453bbe[_0x238d8e(0x1f4)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x5da2a6(0xa5)]='ps:pz:list';[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0x20e);async[a29_0x5da2a6(0xfc)](_0x322722){const _0x51d1c1=a29_0x5da2a6,{options:_0x32eb70,args:_0x23baa3,tdx:_0x396868}=_0x322722,_0xfe9fc2=_0x23baa3[0x0]||_0x32eb70[_0x51d1c1(0x169)];if(!_0xfe9fc2)return showParentSegmentNotSetError(_0x51d1c1(0xb5)+_0x51d1c1(0x204)),0x1;const _0x29b70b=await withSpinner(_0x51d1c1(0x110)+_0xfe9fc2+'\x27...',()=>_0x396868[_0x51d1c1(0xc8)][_0x51d1c1(0x10d)](_0xfe9fc2),{'verbose':_0x32eb70[_0x51d1c1(0x1d3)]}),_0x3f3285=_0x29b70b['data'],_0x247659=await withSpinner(_0x51d1c1(0x115)+_0xfe9fc2+_0x51d1c1(0x93),()=>_0x396868[_0x51d1c1(0x1bc)][_0x51d1c1(0x149)](_0x3f3285),{'verbose':_0x32eb70[_0x51d1c1(0x1d3)]}),_0x31c6e3=_0x247659[_0x51d1c1(0x112)];console['error'](_0x51d1c1(0x1d6)+_0x31c6e3['length']+_0x51d1c1(0xfd)+(_0x31c6e3[_0x51d1c1(0xf7)]!==0x1?'s':''));if(_0x32eb70['format']===_0x51d1c1(0x1f5)||_0x32eb70[_0x51d1c1(0x106)]===_0x51d1c1(0x216))await handleSDKOutput(_0x31c6e3,_0x32eb70);else{if(_0x31c6e3['length']===0x0)console[_0x51d1c1(0x151)]('No\x20personalization\x20services\x20configured'),console[_0x51d1c1(0x1fe)](a29_0xaf6826['cyan'](_0x51d1c1(0xef)));else for(const _0x5dca25 of _0x31c6e3){const _0x51f72b=_0x5dca25[_0x51d1c1(0x1ed)]?.[_0x51d1c1(0xf7)]||0x0,_0x429747=_0x5dca25[_0x51d1c1(0x11f)]?a29_0xaf6826[_0x51d1c1(0x142)](_0x51d1c1(0x92)+_0x5dca25[_0x51d1c1(0x11f)]):'',_0x481583=a29_0xaf6826[_0x51d1c1(0x142)]('\x20('+_0x51f72b+_0x51d1c1(0x135)+(_0x51f72b!==0x1?'s':'')+')');console[_0x51d1c1(0x151)]('\x20\x20'+_0x5dca25[_0x51d1c1(0xa5)]+_0x429747+_0x481583),_0x5dca25[_0x51d1c1(0x120)]&&console['log'](_0x51d1c1(0x164)+a29_0xaf6826[_0x51d1c1(0x142)](_0x5dca25[_0x51d1c1(0x120)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a29_0x5da2a6(0x147);[a29_0x5da2a6(0x120)]=a29_0x5da2a6(0xac);async[a29_0x5da2a6(0xfc)](_0x4b17fa){const _0x2a6805=a29_0x5da2a6,{options:_0x1edc00,args:_0x2f8a16}=_0x4b17fa,_0x1e102b=_0x2f8a16[0x0]||_0x1edc00[_0x2a6805(0x169)];if(!_0x1e102b)return showParentSegmentNotSetError(_0x2a6805(0x1e9)+_0x2a6805(0xdc)),0x1;const _0x1e4b8c=resolveYamlFile(_0x1e102b);if(!existsSync(_0x1e4b8c))return showFileNotFoundError(_0x1e4b8c,_0x1e102b),0x1;let _0x2fffcb;try{_0x2fffcb=readFileSync(_0x1e4b8c,_0x2a6805(0x1d5));}catch(_0x110690){const _0x479d2c=_0x110690 instanceof Error?_0x110690[_0x2a6805(0x1bd)]:String(_0x110690);return console[_0x2a6805(0x1fe)](_0x2a6805(0x11d)+_0x479d2c),0x1;}let _0x4fd2ce;try{_0x4fd2ce=parseDef(_0x2fffcb);}catch(_0x25654f){const _0x4556f1=_0x25654f instanceof Error?_0x25654f['message']:String(_0x25654f);return console[_0x2a6805(0x1fe)](a29_0xaf6826['red']('Error\x20parsing\x20YAML:\x20'+_0x4556f1)),0x1;}if(_0x4fd2ce[_0x2a6805(0x15f)]&&_0x4fd2ce[_0x2a6805(0x15f)][_0x2a6805(0xf7)]>0x0)return console[_0x2a6805(0x1fe)](a29_0xaf6826[_0x2a6805(0x12b)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x1e4b8c)),console[_0x2a6805(0x1fe)](a29_0xaf6826[_0x2a6805(0x142)](_0x2a6805(0x18e)+_0x4fd2ce[_0x2a6805(0x15f)][_0x2a6805(0xf7)]+_0x2a6805(0x18f))),0x1;!_0x4fd2ce[_0x2a6805(0x162)]&&(_0x4fd2ce[_0x2a6805(0x162)]={'events':[{'name':'page_view','source_table':_0x2a6805(0x9f)}],'attributes':[{'name':_0x2a6805(0x1c3),'type':_0x2a6805(0x1da)}],'id_stitching':{'primary_key':_0x4fd2ce[_0x2a6805(0x1e8)][_0x2a6805(0x219)]===_0x2a6805(0x193)?_0x2a6805(0x1fc):_0x2a6805(0xed)}});_0x4fd2ce[_0x2a6805(0x15f)]=[{'name':_0x2a6805(0xaf),'description':_0x2a6805(0x178),'trigger_event':_0x2a6805(0x96),'sections':[{'name':_0x2a6805(0x1d1),'criteria':_0x2a6805(0x136),'attributes':[_0x2a6805(0x1c3)]}]}];const _0x46e241=serializeDef(_0x4fd2ce);return writeFileSync(_0x1e4b8c,_0x46e241,_0x2a6805(0x1d5)),console[_0x2a6805(0x1fe)](a29_0xaf6826['green']('✔')+_0x2a6805(0x16b)+a29_0xaf6826[_0x2a6805(0x202)](_0x1e4b8c)),(!_0x4fd2ce['realtime']||_0x2fffcb[_0x2a6805(0x1c5)]('realtime:')===-0x1)&&console[_0x2a6805(0x1fe)](a29_0xaf6826[_0x2a6805(0x1d0)]('✔')+_0x2a6805(0x1ba)),console[_0x2a6805(0x1fe)]('\x0a'+a29_0xaf6826[_0x2a6805(0x142)](_0x2a6805(0x1d9))),console[_0x2a6805(0x1fe)](_0x2a6805(0x12f)+_0x1e4b8c+'\x20to\x20configure\x20your\x20personalization\x20service'),console['error'](_0x2a6805(0x1f0)+a29_0xaf6826[_0x2a6805(0x142)](_0x2a6805(0xba)+_0x1e102b)+_0x2a6805(0x190)),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a30_0x5f575d=a30_0x2ef1;(function(_0x457ac8,_0x4a0ab7){const _0x189c1c=a30_0x2ef1,_0x481b14=_0x457ac8();while(!![]){try{const _0x30293e=parseInt(_0x189c1c(0x116))/0x1+-parseInt(_0x189c1c(0x108))/0x2+-parseInt(_0x189c1c(0xfb))/0x3+parseInt(_0x189c1c(0x107))/0x4*(-parseInt(_0x189c1c(0xed))/0x5)+-parseInt(_0x189c1c(0x124))/0x6*(parseInt(_0x189c1c(0x12c))/0x7)+parseInt(_0x189c1c(0x157))/0x8+parseInt(_0x189c1c(0x14e))/0x9*(parseInt(_0x189c1c(0x129))/0xa);if(_0x30293e===_0x4a0ab7)break;else _0x481b14['push'](_0x481b14['shift']());}catch(_0x50dfff){_0x481b14['push'](_0x481b14['shift']());}}}(a30_0x5945,0x8775c));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 a30_0x16320e from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a30_0x2ef1(_0x3dd65e,_0x5a67e8){_0x3dd65e=_0x3dd65e-0xea;const _0x59459f=a30_0x5945();let _0x2ef1e6=_0x59459f[_0x3dd65e];return _0x2ef1e6;}import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a30_0x220d5a from'prompts';import a30_0x4ed2e4 from'chalk';function validateProfileName(_0x3b7717){const _0x1ca95b=a30_0x2ef1;if(!_0x3b7717||!_0x3b7717['trim']())return _0x1ca95b(0x126);const _0x2d373a=_0x3b7717[_0x1ca95b(0xf8)]();if(!/^[a-zA-Z0-9_-]+$/[_0x1ca95b(0x140)](_0x2d373a))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x2d373a))return _0x1ca95b(0xfe)+_0x2d373a+_0x1ca95b(0x14b);return!![];}export class ProfileCreateCommand extends BaseCommand{[a30_0x5f575d(0x122)]=a30_0x5f575d(0x12f);[a30_0x5f575d(0x12b)]=a30_0x5f575d(0xf2);async[a30_0x5f575d(0x152)](_0x531ea8){const _0x2e6e84=a30_0x5f575d,{options:_0x28efb9,args:_0x472636}=_0x531ea8;console[_0x2e6e84(0x118)](a30_0x4ed2e4[_0x2e6e84(0xf1)]('tdx:\x20profile\x20create'));let _0x41d401;if(_0x472636[_0x2e6e84(0x13b)]>0x0&&_0x472636[0x0]){const _0x290a1d=_0x472636[0x0]['trim'](),_0x22082c=validateProfileName(_0x290a1d);if(_0x22082c!==!![])return console[_0x2e6e84(0x13d)](a30_0x4ed2e4[_0x2e6e84(0xf9)](_0x22082c)),0x1;_0x41d401=_0x290a1d;}else{const _0x241445=await a30_0x220d5a({'type':_0x2e6e84(0x151),'name':_0x2e6e84(0xec),'message':_0x2e6e84(0x13c),'validate':validateProfileName});if(!_0x241445[_0x2e6e84(0xec)])return console[_0x2e6e84(0x118)]('\x0aSetup\x20cancelled'),0x1;_0x41d401=_0x241445[_0x2e6e84(0xec)]['trim']();}const _0x97e244=await a30_0x220d5a({'type':'text','name':_0x2e6e84(0x12b),'message':_0x2e6e84(0x121)}),_0x3ba93b=_0x97e244[_0x2e6e84(0x12b)]?.['trim']()||undefined,_0x3200b0=_0x28efb9[_0x2e6e84(0x147)]||'us01',{choices:_0x487762,initialIndex:_0x5cc379}=buildSiteChoices(_0x3200b0),_0x515477=await a30_0x220d5a({'type':'select','name':_0x2e6e84(0x147),'message':_0x2e6e84(0xea)+_0x41d401+'\x27:','choices':_0x487762,'initial':_0x5cc379});if(!_0x515477['site'])return console[_0x2e6e84(0x118)](_0x2e6e84(0x149)),0x1;let _0x1c6ad8;if(_0x515477[_0x2e6e84(0x147)]===_0x2e6e84(0x155)){const _0x9e9505=await a30_0x220d5a({'type':'text','name':_0x2e6e84(0x134),'message':_0x2e6e84(0x12e),'initial':_0x2e6e84(0x145),'validate':_0x20889d=>{const _0x5db0e5=_0x2e6e84;if(!_0x20889d||!_0x20889d['trim']())return _0x5db0e5(0x106);if(!/^[a-z0-9-]+$/['test'](_0x20889d[_0x5db0e5(0xf8)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x9e9505['customSite'])return console[_0x2e6e84(0x118)](_0x2e6e84(0x149)),0x1;_0x1c6ad8=_0x9e9505[_0x2e6e84(0x134)];}else _0x1c6ad8=_0x515477[_0x2e6e84(0x147)];const _0x2f14af=resolveSite(_0x1c6ad8);console[_0x2e6e84(0x118)](_0x2e6e84(0xf4)+_0x2f14af),console[_0x2e6e84(0x118)](_0x2e6e84(0x130)),console[_0x2e6e84(0x118)]('\x20\x20'+getConsoleUrl(_0x2f14af,_0x2e6e84(0x111)));const _0x61bb2=await a30_0x220d5a({'type':'password','name':_0x2e6e84(0x11e),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5e9734=>{const _0x3cdb5f=_0x2e6e84;if(!_0x5e9734||!_0x5e9734[_0x3cdb5f(0xf8)]())return _0x3cdb5f(0x10b);return!![];}});if(!_0x61bb2[_0x2e6e84(0x11e)])return console[_0x2e6e84(0x118)](_0x2e6e84(0x149)),0x1;const _0x4b1056=_0x61bb2[_0x2e6e84(0x11e)];console['log'](_0x2e6e84(0x10d));try{const _0x3c4605=TDX[_0x2e6e84(0x13f)]({'site':_0x2f14af,'apiKey':_0x4b1056[_0x2e6e84(0xf8)](),'logLevel':_0x28efb9['logLevel']??LogLevel['ERROR']}),_0x5a5f14=await _0x3c4605[_0x2e6e84(0x10e)][_0x2e6e84(0x128)]();console['log'](a30_0x4ed2e4[_0x2e6e84(0x114)]('✓')+_0x2e6e84(0x132)+_0x5a5f14['email']+')');const _0x4e46af=await isKeychainAvailable();_0x4e46af?(await saveAPIKeyAsync(_0x4b1056[_0x2e6e84(0xf8)](),_0x2f14af,_0x41d401),console[_0x2e6e84(0x118)](a30_0x4ed2e4[_0x2e6e84(0x114)]('✓')+_0x2e6e84(0x103)+_0x41d401+')')):(console['warn'](a30_0x4ed2e4['yellow'](_0x2e6e84(0xfc))),console[_0x2e6e84(0xf0)](a30_0x4ed2e4[_0x2e6e84(0xef)](_0x2e6e84(0x109))));const _0x1ea97b={'site':_0x2f14af,..._0x3ba93b&&{'description':_0x3ba93b}};return saveProfileToUserConfig(_0x41d401,_0x1ea97b),console[_0x2e6e84(0x118)](a30_0x4ed2e4[_0x2e6e84(0x114)]('✓')+_0x2e6e84(0x156)+_0x41d401+_0x2e6e84(0x104)),console[_0x2e6e84(0x118)](),console['log'](_0x2e6e84(0x153)),console[_0x2e6e84(0x118)](_0x2e6e84(0x13e)+_0x41d401+_0x2e6e84(0xeb)),console[_0x2e6e84(0x118)](_0x2e6e84(0x13e)+_0x41d401+_0x2e6e84(0xf5)),0x0;}catch(_0x124029){if(_0x124029 instanceof HTTPClientError&&_0x124029['status']===0x191)return printAuthError(_0x124029),0x1;return console[_0x2e6e84(0x13d)](a30_0x4ed2e4[_0x2e6e84(0xf9)](_0x2e6e84(0xfa)+(_0x124029 instanceof Error?_0x124029[_0x2e6e84(0x10f)]:String(_0x124029)))),console[_0x2e6e84(0x13d)](_0x2e6e84(0x14c)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a30_0x5f575d(0x122)]='profile:remove';[a30_0x5f575d(0x12b)]=a30_0x5f575d(0x12a);[a30_0x5f575d(0x10a)](_0x36c2bd){const _0xb6a817=a30_0x5f575d,{args:_0x11640f}=_0x36c2bd;if(_0x11640f[_0xb6a817(0x13b)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a30_0x5f575d(0x152)](_0x466bfb){const _0xcbb352=a30_0x5f575d,{args:_0x1b63ef}=_0x466bfb,_0x2e2c72=_0x1b63ef[0x0];console[_0xcbb352(0x118)](a30_0x4ed2e4[_0xcbb352(0xf1)](_0xcbb352(0x110)));if(!profileExists(_0x2e2c72)){console[_0xcbb352(0x13d)](a30_0x4ed2e4['red'](_0xcbb352(0xfe)+_0x2e2c72+_0xcbb352(0x11d))),console[_0xcbb352(0x118)]('\x0aAvailable\x20profiles:');const _0xccb475=listProfiles();if(_0xccb475['length']===0x0)console[_0xcbb352(0x118)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x197fb0 of _0xccb475){console[_0xcbb352(0x118)](_0xcbb352(0x113)+_0x197fb0[_0xcbb352(0x122)]);}return 0x1;}const _0x3641e1=await a30_0x220d5a({'type':_0xcbb352(0x14d),'name':_0xcbb352(0x14d),'message':_0xcbb352(0x127)+_0x2e2c72+'\x27?','initial':![]});if(!_0x3641e1[_0xcbb352(0x14d)])return console[_0xcbb352(0x118)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x2e2c72),console[_0xcbb352(0x118)](a30_0x4ed2e4[_0xcbb352(0x114)]('✓')+_0xcbb352(0x156)+_0x2e2c72+'\x27\x20removed\x20from\x20configuration');}catch(_0x4e6d62){return console[_0xcbb352(0x13d)](a30_0x4ed2e4[_0xcbb352(0xf9)](_0xcbb352(0x139)+(_0x4e6d62 instanceof Error?_0x4e6d62[_0xcbb352(0x10f)]:String(_0x4e6d62)))),0x1;}const _0x3b7a9a=await isKeychainAvailable();if(_0x3b7a9a){const _0x262abf=await deleteKeychainAPIKey(_0x2e2c72);_0x262abf&&console['log'](a30_0x4ed2e4[_0xcbb352(0x114)]('✓')+_0xcbb352(0x120));}return 0x0;}}function a30_0x5945(){const _0x4702df=['validate','API\x20key\x20cannot\x20be\x20empty','Session\x20profile\x20set\x20to:\x20','Validating\x20API\x20key...','jobs','message','tdx:\x20profile\x20remove','/app/mp/ak','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>','\x20\x20-\x20','green','Operation\x20cancelled','766724Jahryl','Default\x20profile\x20set\x20to:\x20','log','(cleared)','Unknown\x20key\x20\x27','profile:set','logLevel','\x27\x20does\x20not\x20exist.','apiKey','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Enter\x20description\x20(optional):','name','status','30ItKxbu','\x0aOperation\x20cancelled','Profile\x20name\x20cannot\x20be\x20empty','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','getUserInfo','1013620Zkommf','Remove\x20a\x20profile','description','1287692fJWGmG','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Enter\x20site\x20name:','profile:create','You\x20can\x20find\x20your\x20API\x20key\x20at:','profile','\x20API\x20key\x20is\x20valid\x20(User:\x20','join','customSite','session','llm_agent','VALID_KEYS','default','Failed\x20to\x20remove\x20profile:\x20','\x20--default\x27\x20to\x20save\x20permanently','length','Enter\x20profile\x20name:','error','\x20\x20tdx\x20--profile\x20','create','test','\x27.\x0a\x0aValid\x20keys:\x20','includes','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','parent_segment','us01','profile:use','site','\x0aAvailable\x20profiles:','\x0aSetup\x20cancelled','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','confirm','261dGzRah','password','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','text','execute','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','ERROR','other','\x20Profile\x20\x27','571712IsUdgU','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profileName','35QffMeU','\x20API\x20key\x20saved\x20to\x20system\x20keychain','yellow','warn','bold','Create\x20a\x20new\x20profile','dim','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','llm_project','database','trim','red','✗\x20Validation\x20failed:\x20','2145105xqBDEm','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Profile\x20\x27','Changing\x20site\x20to\x20\x27','split','config','\x27\x20requires\x20API\x20key\x20validation.','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x27\x20created','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Site\x20name\x20cannot\x20be\x20empty','340520AwJRMp','1984234pBlpLr','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.'];a30_0x5945=function(){return _0x4702df;};return a30_0x5945();}export class ProfileSetCommand extends BaseCommand{[a30_0x5f575d(0x122)]=a30_0x5f575d(0x11b);[a30_0x5f575d(0x12b)]='Set\x20a\x20profile\x20configuration\x20value';static [a30_0x5f575d(0x137)]=[a30_0x5f575d(0x147),a30_0x5f575d(0xf7),a30_0x5f575d(0x144),a30_0x5f575d(0xf6),a30_0x5f575d(0x136),a30_0x5f575d(0x12b)];[a30_0x5f575d(0x10a)](_0x51580b){const _0x1cbc49=a30_0x5f575d,{args:_0x345567,options:_0x130f77}=_0x51580b,_0x41d556=_0x130f77['profile']||getActiveProfile();if(!_0x41d556)return _0x1cbc49(0x112);if(_0x345567[_0x1cbc49(0x13b)]===0x0)return _0x1cbc49(0xfd)+ProfileSetCommand[_0x1cbc49(0x137)][_0x1cbc49(0x133)](',\x20');const _0x173bce=_0x345567[0x0];if(!_0x173bce[_0x1cbc49(0x142)]('='))return _0x1cbc49(0x11f)+ProfileSetCommand[_0x1cbc49(0x137)][_0x1cbc49(0x133)](',\x20');const [_0x2e191e]=_0x173bce[_0x1cbc49(0x100)]('=',0x2);if(!ProfileSetCommand[_0x1cbc49(0x137)][_0x1cbc49(0x142)](_0x2e191e))return _0x1cbc49(0x11a)+_0x2e191e+_0x1cbc49(0x141)+ProfileSetCommand[_0x1cbc49(0x137)]['join'](',\x20');return undefined;}async[a30_0x5f575d(0x152)](_0x29004a){const _0x14ac5d=a30_0x5f575d,{args:_0x36ccb2,options:_0x5719cd}=_0x29004a,_0x1bbf14=_0x5719cd[_0x14ac5d(0x131)]||getActiveProfile(),[_0x1f90e4,..._0x300c90]=_0x36ccb2[0x0]['split']('='),_0x3edb5b=_0x300c90['join']('=');console[_0x14ac5d(0x118)](a30_0x4ed2e4[_0x14ac5d(0xf1)]('tdx:\x20profile\x20set'));if(!profileExists(_0x1bbf14)){const _0x5acec7=await a30_0x220d5a({'type':_0x14ac5d(0x14d),'name':'create','message':'Profile\x20\x27'+_0x1bbf14+_0x14ac5d(0x105),'initial':!![]});if(!_0x5acec7[_0x14ac5d(0x13f)])return console[_0x14ac5d(0x118)](_0x14ac5d(0x115)),0x1;}const _0x4d4702=loadProfile(_0x1bbf14),_0x381dd1=_0x4d4702?.[_0x14ac5d(0x101)]||{};if(_0x1f90e4===_0x14ac5d(0x147)){const _0x7852f8=resolveSite(_0x3edb5b);console['log'](_0x14ac5d(0xff)+_0x7852f8+_0x14ac5d(0x102)),console[_0x14ac5d(0x118)](_0x14ac5d(0x150)),console[_0x14ac5d(0x118)]('\x20\x20'+getConsoleUrl(_0x7852f8,_0x14ac5d(0x111)));const _0x3d1c1c=await a30_0x220d5a({'type':_0x14ac5d(0x14f),'name':_0x14ac5d(0x11e),'message':_0x14ac5d(0x14a),'validate':_0x272a8e=>{const _0xb7dfff=_0x14ac5d;if(!_0x272a8e||!_0x272a8e[_0xb7dfff(0xf8)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x3d1c1c['apiKey'])return console[_0x14ac5d(0x118)](_0x14ac5d(0x125)),0x1;console[_0x14ac5d(0x118)](_0x14ac5d(0x10d));try{const _0x3f5842=TDX[_0x14ac5d(0x13f)]({'site':_0x7852f8,'apiKey':_0x3d1c1c[_0x14ac5d(0x11e)][_0x14ac5d(0xf8)](),'logLevel':_0x5719cd[_0x14ac5d(0x11c)]??LogLevel[_0x14ac5d(0x154)]}),_0x40730f=await _0x3f5842[_0x14ac5d(0x10e)]['getUserInfo']();console[_0x14ac5d(0x118)](a30_0x4ed2e4[_0x14ac5d(0x114)]('✓')+_0x14ac5d(0x132)+_0x40730f['email']+')');const _0x3b5910=await isKeychainAvailable();_0x3b5910?(await saveAPIKeyAsync(_0x3d1c1c[_0x14ac5d(0x11e)][_0x14ac5d(0xf8)](),_0x7852f8,_0x1bbf14),console[_0x14ac5d(0x118)](a30_0x4ed2e4['green']('✓')+_0x14ac5d(0xee))):console[_0x14ac5d(0xf0)](a30_0x4ed2e4['yellow'](_0x14ac5d(0xfc))),_0x381dd1['site']=_0x7852f8;}catch(_0x3210cd){if(_0x3210cd instanceof HTTPClientError&&_0x3210cd[_0x14ac5d(0x123)]===0x191)return printAuthError(_0x3210cd),0x1;return console['error'](a30_0x4ed2e4['red'](_0x14ac5d(0xfa)+(_0x3210cd instanceof Error?_0x3210cd[_0x14ac5d(0x10f)]:String(_0x3210cd)))),console['error']('Site\x20was\x20not\x20changed.'),0x1;}}else _0x381dd1[_0x1f90e4]=_0x3edb5b||undefined;return saveProfileToUserConfig(_0x1bbf14,_0x381dd1),console[_0x14ac5d(0x118)](a30_0x4ed2e4['green']('✓')+'\x20Profile\x20\x27'+_0x1bbf14+'\x27\x20updated:\x20'+_0x1f90e4+'='+(_0x3edb5b||_0x14ac5d(0x119))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a30_0x5f575d(0x122)]=a30_0x5f575d(0x146);[a30_0x5f575d(0x12b)]='Set\x20session\x20profile';['validate'](_0xeaafc2){const _0x4ef20e=a30_0x5f575d,{args:_0x427cbe}=_0xeaafc2;if(_0x427cbe['length']===0x0)return _0x4ef20e(0x12d);return undefined;}async[a30_0x5f575d(0x152)](_0x176e3f){const _0x458e61=a30_0x5f575d,{args:_0x8d9aa6,options:_0x197cea}=_0x176e3f,_0x17c1e4=_0x8d9aa6[0x0],_0xbdf41d=_0x197cea[_0x458e61(0x138)];cleanExpiredSessions();if(!profileExists(_0x17c1e4)){console[_0x458e61(0x13d)](a30_0x4ed2e4[_0x458e61(0xf9)](_0x458e61(0xfe)+_0x17c1e4+_0x458e61(0x11d))),console['log'](_0x458e61(0x148));const _0x435ec1=listProfiles();if(_0x435ec1[_0x458e61(0x13b)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x21ec7a of _0x435ec1){console['log'](_0x458e61(0x113)+_0x21ec7a[_0x458e61(0x122)]);}return 0x1;}if(_0xbdf41d){const _0x21565d=a30_0x16320e[_0x458e61(0x133)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x17c1e4),console[_0x458e61(0x118)](_0x458e61(0x117)+a30_0x4ed2e4[_0x458e61(0x114)](_0x17c1e4)),console['log'](a30_0x4ed2e4[_0x458e61(0xf3)]('\x0aSaved\x20to:\x20'+_0x21565d)),0x0;}const _0x4c85b3=getSessionID(_0x197cea[_0x458e61(0x135)]);return saveSessionContext({'profile':_0x17c1e4},_0x197cea[_0x458e61(0x135)]),console[_0x458e61(0x118)](_0x458e61(0x10c)+a30_0x4ed2e4[_0x458e61(0x114)](_0x17c1e4)+'\x20'+a30_0x4ed2e4[_0x458e61(0xf3)]('(session:\x20'+_0x4c85b3+')')),console['log'](a30_0x4ed2e4[_0x458e61(0xf3)](_0x458e61(0x143)+_0x17c1e4+_0x458e61(0x13a))),0x0;}}
|
|
1
|
+
const a30_0x5dd6ba=a30_0x17fc;(function(_0x5d711a,_0x1a3fb4){const _0x1d2369=a30_0x17fc,_0x36f100=_0x5d711a();while(!![]){try{const _0x5cee9b=parseInt(_0x1d2369(0x15a))/0x1*(parseInt(_0x1d2369(0x103))/0x2)+-parseInt(_0x1d2369(0x163))/0x3+-parseInt(_0x1d2369(0x137))/0x4*(parseInt(_0x1d2369(0x108))/0x5)+-parseInt(_0x1d2369(0x16c))/0x6+parseInt(_0x1d2369(0x162))/0x7*(parseInt(_0x1d2369(0x12c))/0x8)+-parseInt(_0x1d2369(0x16b))/0x9*(parseInt(_0x1d2369(0x14d))/0xa)+-parseInt(_0x1d2369(0x166))/0xb*(-parseInt(_0x1d2369(0x14b))/0xc);if(_0x5cee9b===_0x1a3fb4)break;else _0x36f100['push'](_0x36f100['shift']());}catch(_0x415119){_0x36f100['push'](_0x36f100['shift']());}}}(a30_0x504a,0x80eba));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a30_0x504a(){const _0xcb6ae8=['Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','database','\x27\x20created','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20API\x20key\x20is\x20valid\x20(User:\x20','✗\x20Validation\x20failed:\x20','Removal\x20cancelled','ERROR','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','text','execute','join','description','tdx:\x20profile\x20create','108WOyrne','Operation\x20cancelled','20KXOdVD','Enter\x20profile\x20name:','confirm','bold','tdx:\x20profile\x20remove','tdx:\x20profile\x20set','Remove\x20a\x20profile','\x27\x20does\x20not\x20exist.','\x27.\x0a\x0aValid\x20keys:\x20','email','getUserInfo','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x20\x20-\x20','22FIwKQY','\x27\x20updated:\x20','red','Session\x20profile\x20set\x20to:\x20','includes','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20Profile\x20\x27','889ZRSfFv','2297760fFKySu','jobs','VALID_KEYS','2753795Ibtqjx','validate','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','apiKey','3929418pSerFo','649920jfFMVB','Set\x20session\x20profile','yellow','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','config','trim','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20description\x20(optional):','42970YRGQSu','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','length','Enter\x20site\x20name:','\x0aSaved\x20to:\x20','10PFHVsE','status','warn','profile:use','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x27\x20requires\x20API\x20key\x20validation.','\x0aAvailable\x20profiles:','\x20\x20(no\x20profiles\x20found)','site','split','Unknown\x20key\x20\x27','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>','log','Profile\x20\x27','other','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Site\x20was\x20not\x20changed.','parent_segment','create','Profile\x20name\x20cannot\x20be\x20empty','message','logLevel','us01','Failed\x20to\x20remove\x20profile:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20tdx\x20--profile\x20','(session:\x20','Default\x20profile\x20set\x20to:\x20','\x0aOperation\x20cancelled','default','dim','profileName','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile:create','Validating\x20API\x20key...','error','16792MVsafs','profile:set','\x20--default\x27\x20to\x20save\x20permanently','green','\x27\x20removed\x20from\x20configuration','customSite','(cleared)','\x0aSetup\x20cancelled','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','/app/mp/ak','name','1433692EJRcXO','password','API\x20key\x20cannot\x20be\x20empty','profile:remove','profile','Changing\x20site\x20to\x20\x27'];a30_0x504a=function(){return _0xcb6ae8;};return a30_0x504a();}function a30_0x17fc(_0x38e0b7,_0x5b6727){_0x38e0b7=_0x38e0b7-0x100;const _0x504a0b=a30_0x504a();let _0x17fce7=_0x504a0b[_0x38e0b7];return _0x17fce7;}import*as a30_0x3cc25f 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{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a30_0x116ed9 from'prompts';import a30_0x3de7d4 from'chalk';function validateProfileName(_0x1c3cc3){const _0x22386a=a30_0x17fc;if(!_0x1c3cc3||!_0x1c3cc3[_0x22386a(0x100)]())return _0x22386a(0x11b);const _0xcc4bfc=_0x1c3cc3['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0xcc4bfc))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0xcc4bfc))return _0x22386a(0x115)+_0xcc4bfc+_0x22386a(0x158);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a30_0x5dd6ba(0x129);[a30_0x5dd6ba(0x149)]='Create\x20a\x20new\x20profile';async[a30_0x5dd6ba(0x147)](_0x173b2c){const _0x3bf3a7=a30_0x5dd6ba,{options:_0x3896a8,args:_0x454447}=_0x173b2c;console[_0x3bf3a7(0x114)](a30_0x3de7d4[_0x3bf3a7(0x150)](_0x3bf3a7(0x14a)));let _0x5d5bb4;if(_0x454447[_0x3bf3a7(0x105)]>0x0&&_0x454447[0x0]){const _0x4e548a=_0x454447[0x0][_0x3bf3a7(0x100)](),_0x355b67=validateProfileName(_0x4e548a);if(_0x355b67!==!![])return console[_0x3bf3a7(0x12b)](a30_0x3de7d4[_0x3bf3a7(0x15c)](_0x355b67)),0x1;_0x5d5bb4=_0x4e548a;}else{const _0x12c81f=await a30_0x116ed9({'type':'text','name':_0x3bf3a7(0x127),'message':_0x3bf3a7(0x14e),'validate':validateProfileName});if(!_0x12c81f[_0x3bf3a7(0x127)])return console[_0x3bf3a7(0x114)](_0x3bf3a7(0x133)),0x1;_0x5d5bb4=_0x12c81f['profileName']['trim']();}const _0x2e94b2=await a30_0x116ed9({'type':_0x3bf3a7(0x146),'name':_0x3bf3a7(0x149),'message':_0x3bf3a7(0x102)}),_0x56a1cb=_0x2e94b2['description']?.[_0x3bf3a7(0x100)]()||undefined,_0x2419f9=_0x3896a8[_0x3bf3a7(0x110)]||_0x3bf3a7(0x11e),{choices:_0xdc365c,initialIndex:_0x237da4}=buildSiteChoices(_0x2419f9),_0x4502f2=await a30_0x116ed9({'type':'select','name':_0x3bf3a7(0x110),'message':_0x3bf3a7(0x134)+_0x5d5bb4+'\x27:','choices':_0xdc365c,'initial':_0x237da4});if(!_0x4502f2[_0x3bf3a7(0x110)])return console[_0x3bf3a7(0x114)]('\x0aSetup\x20cancelled'),0x1;let _0x2aaa8a;if(_0x4502f2[_0x3bf3a7(0x110)]===_0x3bf3a7(0x116)){const _0x399f36=await a30_0x116ed9({'type':_0x3bf3a7(0x146),'name':_0x3bf3a7(0x131),'message':_0x3bf3a7(0x106),'initial':_0x3bf3a7(0x11e),'validate':_0x398646=>{const _0x205dd8=_0x3bf3a7;if(!_0x398646||!_0x398646[_0x205dd8(0x100)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/['test'](_0x398646[_0x205dd8(0x100)]()))return _0x205dd8(0x169);return!![];}});if(!_0x399f36[_0x3bf3a7(0x131)])return console[_0x3bf3a7(0x114)](_0x3bf3a7(0x133)),0x1;_0x2aaa8a=_0x399f36[_0x3bf3a7(0x131)];}else _0x2aaa8a=_0x4502f2[_0x3bf3a7(0x110)];const _0x315783=resolveSite(_0x2aaa8a);console[_0x3bf3a7(0x114)](_0x3bf3a7(0x16f)+_0x315783),console[_0x3bf3a7(0x114)](_0x3bf3a7(0x160)),console['log']('\x20\x20'+getConsoleUrl(_0x315783,_0x3bf3a7(0x135)));const _0x11369e=await a30_0x116ed9({'type':_0x3bf3a7(0x138),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x27414b=>{const _0x108d00=_0x3bf3a7;if(!_0x27414b||!_0x27414b[_0x108d00(0x100)]())return _0x108d00(0x139);return!![];}});if(!_0x11369e[_0x3bf3a7(0x16a)])return console['log'](_0x3bf3a7(0x133)),0x1;const _0x8d51de=_0x11369e['apiKey'];console[_0x3bf3a7(0x114)]('Validating\x20API\x20key...');try{const _0x44e4c6=TDX[_0x3bf3a7(0x11a)]({'site':_0x315783,'apiKey':_0x8d51de['trim'](),'logLevel':_0x3896a8[_0x3bf3a7(0x11d)]??LogLevel[_0x3bf3a7(0x144)]}),_0x4ab324=await _0x44e4c6[_0x3bf3a7(0x164)]['getUserInfo']();console['log'](a30_0x3de7d4['green']('✓')+_0x3bf3a7(0x141)+_0x4ab324[_0x3bf3a7(0x156)]+')');const _0x1f91f3=await isKeychainAvailable();_0x1f91f3?(await saveAPIKeyAsync(_0x8d51de['trim'](),_0x315783,_0x5d5bb4),console[_0x3bf3a7(0x114)](a30_0x3de7d4[_0x3bf3a7(0x12f)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x5d5bb4+')')):(console[_0x3bf3a7(0x10a)](a30_0x3de7d4[_0x3bf3a7(0x16e)](_0x3bf3a7(0x104))),console[_0x3bf3a7(0x10a)](a30_0x3de7d4['yellow']('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x5dc3ab={'site':_0x315783,..._0x56a1cb&&{'description':_0x56a1cb}};return saveProfileToUserConfig(_0x5d5bb4,_0x5dc3ab),console[_0x3bf3a7(0x114)](a30_0x3de7d4[_0x3bf3a7(0x12f)]('✓')+_0x3bf3a7(0x161)+_0x5d5bb4+_0x3bf3a7(0x13f)),console[_0x3bf3a7(0x114)](),console[_0x3bf3a7(0x114)](_0x3bf3a7(0x117)),console[_0x3bf3a7(0x114)]('\x20\x20tdx\x20--profile\x20'+_0x5d5bb4+_0x3bf3a7(0x170)),console[_0x3bf3a7(0x114)](_0x3bf3a7(0x121)+_0x5d5bb4+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2c35fa){if(_0x2c35fa instanceof HTTPClientError&&_0x2c35fa[_0x3bf3a7(0x109)]===0x191)return printAuthError(_0x2c35fa),0x1;return console[_0x3bf3a7(0x12b)](a30_0x3de7d4[_0x3bf3a7(0x15c)](_0x3bf3a7(0x142)+(_0x2c35fa instanceof Error?_0x2c35fa[_0x3bf3a7(0x11c)]:String(_0x2c35fa)))),console['error'](_0x3bf3a7(0x140)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a30_0x5dd6ba(0x136)]=a30_0x5dd6ba(0x13a);[a30_0x5dd6ba(0x149)]=a30_0x5dd6ba(0x153);[a30_0x5dd6ba(0x167)](_0x30ca33){const _0x5aabe7=a30_0x5dd6ba,{args:_0x4d8392}=_0x30ca33;if(_0x4d8392[_0x5aabe7(0x105)]===0x0)return _0x5aabe7(0x15f);return undefined;}async['execute'](_0x2309db){const _0x2d905b=a30_0x5dd6ba,{args:_0x1a7024}=_0x2309db,_0x22a555=_0x1a7024[0x0];console[_0x2d905b(0x114)](a30_0x3de7d4['bold'](_0x2d905b(0x151)));if(!profileExists(_0x22a555)){console[_0x2d905b(0x12b)](a30_0x3de7d4[_0x2d905b(0x15c)](_0x2d905b(0x115)+_0x22a555+_0x2d905b(0x154))),console[_0x2d905b(0x114)](_0x2d905b(0x10e));const _0x3656b5=listProfiles();if(_0x3656b5[_0x2d905b(0x105)]===0x0)console[_0x2d905b(0x114)](_0x2d905b(0x10f));else for(const _0x339676 of _0x3656b5){console[_0x2d905b(0x114)](_0x2d905b(0x159)+_0x339676[_0x2d905b(0x136)]);}return 0x1;}const _0x287e0e=await a30_0x116ed9({'type':_0x2d905b(0x14f),'name':_0x2d905b(0x14f),'message':_0x2d905b(0x145)+_0x22a555+'\x27?','initial':![]});if(!_0x287e0e[_0x2d905b(0x14f)])return console[_0x2d905b(0x114)](_0x2d905b(0x143)),0x0;try{removeProfileFromUserConfig(_0x22a555),console[_0x2d905b(0x114)](a30_0x3de7d4[_0x2d905b(0x12f)]('✓')+_0x2d905b(0x161)+_0x22a555+_0x2d905b(0x130));}catch(_0x3799fc){return console[_0x2d905b(0x12b)](a30_0x3de7d4[_0x2d905b(0x15c)](_0x2d905b(0x11f)+(_0x3799fc instanceof Error?_0x3799fc[_0x2d905b(0x11c)]:String(_0x3799fc)))),0x1;}const _0x3bcac0=await isKeychainAvailable();if(_0x3bcac0){const _0xd5aec3=await deleteKeychainAPIKey(_0x22a555);_0xd5aec3&&console[_0x2d905b(0x114)](a30_0x3de7d4[_0x2d905b(0x12f)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a30_0x5dd6ba(0x12d);[a30_0x5dd6ba(0x149)]='Set\x20a\x20profile\x20configuration\x20value';static [a30_0x5dd6ba(0x165)]=['site',a30_0x5dd6ba(0x13e),a30_0x5dd6ba(0x119),'llm_project','llm_agent',a30_0x5dd6ba(0x149)];[a30_0x5dd6ba(0x167)](_0x575d9f){const _0x1b5fef=a30_0x5dd6ba,{args:_0x350843,options:_0x12c0d7}=_0x575d9f,_0xf2df9f=_0x12c0d7[_0x1b5fef(0x13b)]||getActiveProfile();if(!_0xf2df9f)return _0x1b5fef(0x113);if(_0x350843['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[_0x1b5fef(0x165)][_0x1b5fef(0x148)](',\x20');const _0x1933d6=_0x350843[0x0];if(!_0x1933d6[_0x1b5fef(0x15e)]('='))return _0x1b5fef(0x120)+ProfileSetCommand[_0x1b5fef(0x165)][_0x1b5fef(0x148)](',\x20');const [_0x4af5d1]=_0x1933d6['split']('=',0x2);if(!ProfileSetCommand[_0x1b5fef(0x165)][_0x1b5fef(0x15e)](_0x4af5d1))return _0x1b5fef(0x112)+_0x4af5d1+_0x1b5fef(0x155)+ProfileSetCommand[_0x1b5fef(0x165)][_0x1b5fef(0x148)](',\x20');return undefined;}async[a30_0x5dd6ba(0x147)](_0x30db6a){const _0x8c6c93=a30_0x5dd6ba,{args:_0x37f8c2,options:_0x1b73c1}=_0x30db6a,_0x11640b=_0x1b73c1[_0x8c6c93(0x13b)]||getActiveProfile(),[_0x55dab4,..._0x5c6e3a]=_0x37f8c2[0x0][_0x8c6c93(0x111)]('='),_0x6bd097=_0x5c6e3a[_0x8c6c93(0x148)]('=');console[_0x8c6c93(0x114)](a30_0x3de7d4['bold'](_0x8c6c93(0x152)));if(!profileExists(_0x11640b)){const _0x2c7619=await a30_0x116ed9({'type':_0x8c6c93(0x14f),'name':_0x8c6c93(0x11a),'message':_0x8c6c93(0x115)+_0x11640b+_0x8c6c93(0x101),'initial':!![]});if(!_0x2c7619[_0x8c6c93(0x11a)])return console[_0x8c6c93(0x114)](_0x8c6c93(0x14c)),0x1;}const _0x228cfe=loadProfile(_0x11640b),_0x47856a=_0x228cfe?.[_0x8c6c93(0x171)]||{};if(_0x55dab4===_0x8c6c93(0x110)){const _0x489302=resolveSite(_0x6bd097);console[_0x8c6c93(0x114)](_0x8c6c93(0x13c)+_0x489302+_0x8c6c93(0x10d)),console[_0x8c6c93(0x114)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x8c6c93(0x114)]('\x20\x20'+getConsoleUrl(_0x489302,_0x8c6c93(0x135)));const _0x2110fb=await a30_0x116ed9({'type':'password','name':_0x8c6c93(0x16a),'message':_0x8c6c93(0x128),'validate':_0x3c9893=>{const _0xa1aecf=_0x8c6c93;if(!_0x3c9893||!_0x3c9893[_0xa1aecf(0x100)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2110fb[_0x8c6c93(0x16a)])return console[_0x8c6c93(0x114)](_0x8c6c93(0x124)),0x1;console[_0x8c6c93(0x114)](_0x8c6c93(0x12a));try{const _0x4005de=TDX[_0x8c6c93(0x11a)]({'site':_0x489302,'apiKey':_0x2110fb[_0x8c6c93(0x16a)]['trim'](),'logLevel':_0x1b73c1[_0x8c6c93(0x11d)]??LogLevel[_0x8c6c93(0x144)]}),_0x17e5ad=await _0x4005de['jobs'][_0x8c6c93(0x157)]();console[_0x8c6c93(0x114)](a30_0x3de7d4[_0x8c6c93(0x12f)]('✓')+_0x8c6c93(0x141)+_0x17e5ad[_0x8c6c93(0x156)]+')');const _0x32596c=await isKeychainAvailable();_0x32596c?(await saveAPIKeyAsync(_0x2110fb[_0x8c6c93(0x16a)][_0x8c6c93(0x100)](),_0x489302,_0x11640b),console[_0x8c6c93(0x114)](a30_0x3de7d4[_0x8c6c93(0x12f)]('✓')+_0x8c6c93(0x10c))):console['warn'](a30_0x3de7d4['yellow'](_0x8c6c93(0x104))),_0x47856a['site']=_0x489302;}catch(_0x54c417){if(_0x54c417 instanceof HTTPClientError&&_0x54c417['status']===0x191)return printAuthError(_0x54c417),0x1;return console[_0x8c6c93(0x12b)](a30_0x3de7d4[_0x8c6c93(0x15c)]('✗\x20Validation\x20failed:\x20'+(_0x54c417 instanceof Error?_0x54c417[_0x8c6c93(0x11c)]:String(_0x54c417)))),console[_0x8c6c93(0x12b)](_0x8c6c93(0x118)),0x1;}}else _0x47856a[_0x55dab4]=_0x6bd097||undefined;return saveProfileToUserConfig(_0x11640b,_0x47856a),console[_0x8c6c93(0x114)](a30_0x3de7d4[_0x8c6c93(0x12f)]('✓')+_0x8c6c93(0x161)+_0x11640b+_0x8c6c93(0x15b)+_0x55dab4+'='+(_0x6bd097||_0x8c6c93(0x132))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a30_0x5dd6ba(0x136)]=a30_0x5dd6ba(0x10b);['description']=a30_0x5dd6ba(0x16d);['validate'](_0x2ecc6a){const _0x168efc=a30_0x5dd6ba,{args:_0x434196}=_0x2ecc6a;if(_0x434196[_0x168efc(0x105)]===0x0)return _0x168efc(0x13d);return undefined;}async['execute'](_0x3a8420){const _0x460005=a30_0x5dd6ba,{args:_0x122352,options:_0x321b93}=_0x3a8420,_0x823bfe=_0x122352[0x0],_0x341189=_0x321b93[_0x460005(0x125)];cleanExpiredSessions();if(!profileExists(_0x823bfe)){console[_0x460005(0x12b)](a30_0x3de7d4[_0x460005(0x15c)](_0x460005(0x115)+_0x823bfe+'\x27\x20does\x20not\x20exist.')),console[_0x460005(0x114)](_0x460005(0x10e));const _0x1d582e=listProfiles();if(_0x1d582e[_0x460005(0x105)]===0x0)console[_0x460005(0x114)](_0x460005(0x10f));else for(const _0x18b701 of _0x1d582e){console[_0x460005(0x114)]('\x20\x20-\x20'+_0x18b701[_0x460005(0x136)]);}return 0x1;}if(_0x341189){const _0x5bc7f7=a30_0x3cc25f[_0x460005(0x148)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x823bfe),console[_0x460005(0x114)](_0x460005(0x123)+a30_0x3de7d4[_0x460005(0x12f)](_0x823bfe)),console[_0x460005(0x114)](a30_0x3de7d4['dim'](_0x460005(0x107)+_0x5bc7f7)),0x0;}const _0xb2ec94=getSessionID(_0x321b93['session']);return saveSessionContext({'profile':_0x823bfe},_0x321b93['session']),console[_0x460005(0x114)](_0x460005(0x15d)+a30_0x3de7d4['green'](_0x823bfe)+'\x20'+a30_0x3de7d4[_0x460005(0x126)](_0x460005(0x122)+_0xb2ec94+')')),console[_0x460005(0x114)](a30_0x3de7d4[_0x460005(0x126)](_0x460005(0x168)+_0x823bfe+_0x460005(0x12e))),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a31_0x5ed16b=a31_0x13e6;function a31_0x13e6(_0x5b6103,_0xeed352){_0x5b6103=_0x5b6103-0x1e6;const _0xb8b655=a31_0xb8b6();let _0x13e677=_0xb8b655[_0x5b6103];return _0x13e677;}(function(_0x109b76,_0x398e0d){const _0x3613b4=a31_0x13e6,_0x484540=_0x109b76();while(!![]){try{const _0x3a0a10=parseInt(_0x3613b4(0x1f9))/0x1+-parseInt(_0x3613b4(0x1ec))/0x2*(-parseInt(_0x3613b4(0x1f0))/0x3)+parseInt(_0x3613b4(0x1ef))/0x4*(parseInt(_0x3613b4(0x1ed))/0x5)+-parseInt(_0x3613b4(0x1f3))/0x6+-parseInt(_0x3613b4(0x1f8))/0x7+parseInt(_0x3613b4(0x1f1))/0x8*(-parseInt(_0x3613b4(0x1e7))/0x9)+parseInt(_0x3613b4(0x1ea))/0xa;if(_0x3a0a10===_0x398e0d)break;else _0x484540['push'](_0x484540['shift']());}catch(_0x40c2bb){_0x484540['push'](_0x484540['shift']());}}}(a31_0xb8b6,0x202af));function a31_0xb8b6(){const _0x2079e6=['50968LaMaok','18cnOCvu','45648Xkrlkb','List\x20all\x20available\x20profiles','1001070vTYVqN','execute','scope','name','message','1435868NrcaPy','166513xxUdCD','description','log','config','map','162uSnSFx','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','1539790DjMBbs','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','74078ceOlhU','25BHboIV','Error:\x20'];a31_0xb8b6=function(){return _0x2079e6;};return a31_0xb8b6();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']=a31_0x5ed16b(0x1e9);[a31_0x5ed16b(0x1fa)]=a31_0x5ed16b(0x1f2);async[a31_0x5ed16b(0x1f4)](_0x537f3f){const _0x4c7b98=a31_0x5ed16b,{options:_0x532a2e}=_0x537f3f;try{const _0x10deca=listProfiles(),_0x5131cf=getActiveProfile();if(_0x10deca['length']===0x0)return console[_0x4c7b98(0x1fb)](_0x4c7b98(0x1e8)),console['log'](_0x4c7b98(0x1eb)),console[_0x4c7b98(0x1fb)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x74bf7c=_0x10deca[_0x4c7b98(0x1e6)](_0x301edc=>{const _0x2b3579=_0x4c7b98,_0x1500e0=_0x301edc[_0x2b3579(0x1f6)]===_0x5131cf,_0x1ea2aa=getProfileParams(_0x301edc[_0x2b3579(0x1fc)]);return{'name':_0x301edc[_0x2b3579(0x1f6)],'active':_0x1500e0,'scope':_0x301edc[_0x2b3579(0x1f5)],'description':_0x301edc[_0x2b3579(0x1fc)]['description']||'','params':_0x1ea2aa};});return await handleSDKOutput(_0x74bf7c,_0x532a2e),0x0;}catch(_0x33f622){return _0x33f622 instanceof Error&&console['error'](_0x4c7b98(0x1ee)+_0x33f622[_0x4c7b98(0x1f7)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a32_0x49f4(_0x464ffb,_0x3ef521){_0x464ffb=_0x464ffb-0x175;const _0x6a6e95=a32_0x6a6e();let _0x49f45b=_0x6a6e95[_0x464ffb];return _0x49f45b;}const a32_0x18ae6c=a32_0x49f4;(function(_0x3e5d3f,_0xdeb35c){const _0x1cf38e=a32_0x49f4,_0x33d6b7=_0x3e5d3f();while(!![]){try{const _0x183cd9=parseInt(_0x1cf38e(0x1a1))/0x1+parseInt(_0x1cf38e(0x178))/0x2+-parseInt(_0x1cf38e(0x19f))/0x3+parseInt(_0x1cf38e(0x19e))/0x4+parseInt(_0x1cf38e(0x18a))/0x5+-parseInt(_0x1cf38e(0x17d))/0x6+parseInt(_0x1cf38e(0x1a3))/0x7*(-parseInt(_0x1cf38e(0x180))/0x8);if(_0x183cd9===_0xdeb35c)break;else _0x33d6b7['push'](_0x33d6b7['shift']());}catch(_0x32c407){_0x33d6b7['push'](_0x33d6b7['shift']());}}}(a32_0x6a6e,0xb2b7a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a32_0x6a6e(){const _0x38bbbd=['4121368unZKnA','1019355TeKQie','setExtra','527279ROjpQY','Executing\x20statement\x20','9713305JxyFnj','validate','processedRows','Executing\x20query\x20[','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','1888798cmlJHN','catalog','in\x20','stats','\x20[Job\x20ID:\x20','881124cuzAYS','Error:\x20','output','8VsFMuS','Site:\x20','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','No\x20SQL\x20provided','Statement\x20','...','error','execute','file','length','521300QQkUNZ','setPhase','\x20splits','Run\x20Trino\x20queries\x20(streaming)','database','totalSplits','data','elapsedTimeMillis','name','originalMessage','\x20rows\x20','completedSplits','options','Executing\x20query...','site','join','\x20-\x20','jobId','SQL:\x20','state'];a32_0x6a6e=function(){return _0x38bbbd;};return a32_0x6a6e();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a32_0x18ae6c(0x192)]='query';['description']=a32_0x18ae6c(0x18d);async[a32_0x18ae6c(0x187)](_0x4f87fe){const _0x9128ed=a32_0x18ae6c,{options:_0x463787,args:_0x52b10c,tdx:_0x310287}=_0x4f87fe,_0x543a39={..._0x463787,'limitStructuredFormats':!![]},_0x4d6871=_0x52b10c[0x0],_0x4ededd=_0x463787['file'];let _0xa5b456;try{if(_0x4ededd)_0xa5b456=readSqlStatementsFromFile(_0x4ededd);else{if(_0x4d6871==='-')_0xa5b456=await readSqlStatementsFromStdin();else{if(_0x4d6871&&isSqlFilePath(_0x4d6871))_0xa5b456=readSqlStatementsFromFile(_0x4d6871);else{if(_0x4d6871)_0xa5b456=splitSqlStatements(_0x4d6871);else throw new Error(_0x9128ed(0x183));}}}}catch(_0x22429b){return console['error'](_0x9128ed(0x17e)+_0x22429b['message']),0x1;}const _0x99ee1e=_0x463787[_0x9128ed(0x18e)]||'information_schema',_0x3fb290=_0x463787[_0x9128ed(0x179)];try{const _0x201e7a=[],_0x1bf7d4=!!_0x463787[_0x9128ed(0x17f)];for(let _0x18edb0=0x0;_0x18edb0<_0xa5b456[_0x9128ed(0x189)];_0x18edb0++){const _0x18e681=_0xa5b456[_0x18edb0],_0x867af1=_0x18edb0+0x1,_0x4c5a11=_0xa5b456['length'],_0x12f42f=_0x4c5a11>0x1;_0x463787['verbose']&&(console[_0x9128ed(0x186)]('\x0a'+(_0x12f42f?_0x9128ed(0x184)+_0x867af1+'/'+_0x4c5a11+':':'')),console['error'](_0x9128ed(0x181)+_0x463787[_0x9128ed(0x198)]),console['error']('Catalog:\x20'+(_0x3fb290||'td')),console[_0x9128ed(0x186)]('Schema:\x20'+_0x99ee1e),console[_0x9128ed(0x186)](_0x9128ed(0x19c)+_0x18e681));const _0xd872f3=_0x12f42f?_0x9128ed(0x1a2)+_0x867af1+'/'+_0x4c5a11+_0x9128ed(0x185):_0x9128ed(0x197);try{const _0x3a1995=await withProgressSpinner(_0xd872f3,async _0x3f4d36=>{const _0x2fd785=_0x9128ed,_0x109f6b=await _0x310287['query'][_0x2fd785(0x187)](_0x18e681,{'catalog':_0x3fb290,'schema':_0x99ee1e,'onJobId':_0x2b56cf=>{_0x3f4d36['setJobId'](_0x2b56cf);},'onProgress':_0x39670a=>{const _0x3dfba6=_0x2fd785;_0x3f4d36[_0x3dfba6(0x18b)](_0x3dfba6(0x176)+_0x39670a[_0x3dfba6(0x19d)]+']'),_0x3f4d36[_0x3dfba6(0x1a0)](formatRows(_0x39670a[_0x3dfba6(0x175)])+_0x3dfba6(0x194)+_0x39670a[_0x3dfba6(0x195)]+'/'+_0x39670a[_0x3dfba6(0x18f)]+_0x3dfba6(0x18c));}});return _0x109f6b;},{'verbose':_0x463787['verbose']}),_0x37bc53=_0x3a1995[_0x9128ed(0x190)],_0x27bf2b=_0x37bc53[_0x9128ed(0x19b)]?_0x9128ed(0x17c)+_0x37bc53[_0x9128ed(0x19b)]+']':'',_0x4bd366=_0x12f42f?_0x9128ed(0x184)+_0x867af1+'/'+_0x4c5a11+_0x9128ed(0x19a):'';console[_0x9128ed(0x186)]('✔\x20'+_0x4bd366+'Query\x20completed:\x20Processed\x20'+formatRows(_0x37bc53[_0x9128ed(0x17b)][_0x9128ed(0x175)])+_0x9128ed(0x194)+(_0x9128ed(0x17a)+formatElapsed(_0x37bc53[_0x9128ed(0x17b)][_0x9128ed(0x191)])+_0x27bf2b));if(_0x12f42f&&_0x1bf7d4){const _0x59160c=resolveOutputOptions(_0x543a39),_0x4e1168=await formatQueryOutput(_0x37bc53,_0x59160c);_0x201e7a['push'](_0x4e1168);}else await handleQueryOutput(_0x37bc53,_0x543a39);}catch(_0x3a3e1f){const _0x3cbdb0=_0x12f42f?_0x9128ed(0x184)+_0x867af1+'/'+_0x4c5a11+':\x0a':'',_0x3767db=_0x3a3e1f instanceof SDKError?_0x3a3e1f[_0x9128ed(0x193)]:_0x3a3e1f['message'];return console['error'](''+_0x3cbdb0+_0x3767db),0x1;}}if(_0xa5b456[_0x9128ed(0x189)]>0x1&&_0x1bf7d4&&_0x201e7a[_0x9128ed(0x189)]>0x0){const _0x5d3f7c=_0x201e7a[_0x9128ed(0x199)]('\x0a');writeFileSync(_0x463787[_0x9128ed(0x17f)],_0x5d3f7c),console[_0x9128ed(0x186)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x463787['output']);}return 0x0;}catch(_0x48d1a4){throw _0x48d1a4;}}[a32_0x18ae6c(0x1a4)](_0x2393a1){const _0x41c5ad=a32_0x18ae6c,_0x526c23=_0x2393a1['args'][0x0],_0x1bedff=_0x2393a1[_0x41c5ad(0x196)][_0x41c5ad(0x188)];if(!_0x526c23&&!_0x1bedff)return _0x41c5ad(0x182);if(_0x526c23&&_0x1bedff)return _0x41c5ad(0x177);return undefined;}}
|