@treasuredata/tdx 0.16.3 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.d.ts +3 -0
  25. package/dist/commands/mcp-command.d.ts.map +1 -1
  26. package/dist/commands/mcp-command.js +1 -1
  27. package/dist/commands/mcp-command.js.map +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/segment-command.js +1 -1
  33. package/dist/commands/segment-create-command.js +1 -1
  34. package/dist/commands/segment-fields-command.js +1 -1
  35. package/dist/commands/segment-pull-command.js +1 -1
  36. package/dist/commands/segment-push-command.js +1 -1
  37. package/dist/commands/segment-update-command.js +1 -1
  38. package/dist/commands/segment-use-command.js +1 -1
  39. package/dist/commands/segment-validate-command.js +1 -1
  40. package/dist/commands/segments.js +1 -1
  41. package/dist/commands/show.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/unset-command.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/command-output.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/constants.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/core/version.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/mcp/server.js +1 -1
  62. package/dist/mcp/tools/index.js +1 -1
  63. package/dist/mcp/tools/tdx-run.js +1 -1
  64. package/dist/mcp/tools/tdx-search.js +1 -1
  65. package/dist/mcp/utils.js +1 -1
  66. package/dist/proxy/anthropic-adapter.js +1 -1
  67. package/dist/proxy/claude-usage-tracker.js +1 -1
  68. package/dist/proxy/context-signature.js +1 -1
  69. package/dist/proxy/conversation-utils.js +1 -1
  70. package/dist/proxy/passthrough-server.js +1 -1
  71. package/dist/proxy/server.js +1 -1
  72. package/dist/proxy/session-cache.js +1 -1
  73. package/dist/proxy/sse-usage-parser.js +1 -1
  74. package/dist/sdk/agent/agent-config.js +1 -1
  75. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/api.js +1 -1
  83. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  84. package/dist/sdk/claude-agent/environment.js +1 -1
  85. package/dist/sdk/claude-agent/index.js +1 -1
  86. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  87. package/dist/sdk/client/cdp-api-client.js +1 -1
  88. package/dist/sdk/client/endpoints.js +1 -1
  89. package/dist/sdk/client/engage-api-client.js +1 -1
  90. package/dist/sdk/client/http-client.js +1 -1
  91. package/dist/sdk/client/llm-api-client.js +1 -1
  92. package/dist/sdk/client/rate-limiter.js +1 -1
  93. package/dist/sdk/client/td-api-client.js +1 -1
  94. package/dist/sdk/client/trino-api-client.js +1 -1
  95. package/dist/sdk/client/workflow-client.js +1 -1
  96. package/dist/sdk/connection-validator.js +1 -1
  97. package/dist/sdk/connection.js +1 -1
  98. package/dist/sdk/engage.js +1 -1
  99. package/dist/sdk/errors.js +1 -1
  100. package/dist/sdk/index.js +1 -1
  101. package/dist/sdk/io/index.js +1 -1
  102. package/dist/sdk/io/node-filesystem.js +1 -1
  103. package/dist/sdk/job.js +1 -1
  104. package/dist/sdk/journey.js +1 -1
  105. package/dist/sdk/llm/chat-cache.js +1 -1
  106. package/dist/sdk/llm/index.js +1 -1
  107. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  108. package/dist/sdk/llm/model-aliases.js +1 -1
  109. package/dist/sdk/llm/model-factors.js +1 -1
  110. package/dist/sdk/query/index.js +1 -1
  111. package/dist/sdk/query/sql-parser.js +1 -1
  112. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/fields-display.js +1 -1
  114. package/dist/sdk/segment/file-discovery.js +1 -1
  115. package/dist/sdk/segment/journey-utils.js +1 -1
  116. package/dist/sdk/segment/journey-yaml.js +1 -1
  117. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  118. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  119. package/dist/sdk/segment/pull-workflow.js +1 -1
  120. package/dist/sdk/segment/push-workflow.js +1 -1
  121. package/dist/sdk/segment/resolution-context.js +1 -1
  122. package/dist/sdk/segment/segment-path-parser.js +1 -1
  123. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  124. package/dist/sdk/segment/target-resolution.js +1 -1
  125. package/dist/sdk/segment/tdx-config.js +1 -1
  126. package/dist/sdk/segment/validate-files.js +1 -1
  127. package/dist/sdk/segment/yaml-validator.js +1 -1
  128. package/dist/sdk/segment.js +1 -1
  129. package/dist/sdk/types/index.js +1 -1
  130. package/dist/sdk/types/progress.js +1 -1
  131. package/dist/sdk/user.js +1 -1
  132. package/dist/sdk/util/format-detector.js +1 -1
  133. package/dist/sdk/util/formatters.js +1 -1
  134. package/dist/sdk/util/index.js +1 -1
  135. package/dist/sdk/util/tree-formatter.js +1 -1
  136. package/dist/sdk/workflow/clone-workflow.js +1 -1
  137. package/dist/sdk/workflow/index.js +1 -1
  138. package/dist/sdk/workflow/pull-workflow.js +1 -1
  139. package/dist/sdk/workflow/push-workflow.js +1 -1
  140. package/dist/sdk/workflow/tdx-config.js +1 -1
  141. package/dist/sdk/workflow/workflow-utils.js +1 -1
  142. package/dist/utils/async.js +1 -1
  143. package/dist/utils/colors.js +1 -1
  144. package/dist/utils/diff.js +1 -1
  145. package/dist/utils/file-permissions.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/option-validation.js +1 -1
  148. package/dist/utils/port.js +1 -1
  149. package/dist/utils/process.js +1 -1
  150. package/dist/utils/prompt.js +1 -1
  151. package/dist/utils/spinner.js +1 -1
  152. package/dist/utils/sse-parser.js +1 -1
  153. package/dist/utils/string-utils.js +1 -1
  154. package/dist/utils/table-ref-parser.js +1 -1
  155. package/dist/utils/tdx-logger.js +1 -1
  156. package/dist/utils/version-check.js +1 -1
  157. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x5f52b8=a23_0x4bc1;(function(_0x1616b8,_0x2b09c1){const _0x25d08a=a23_0x4bc1,_0x325fde=_0x1616b8();while(!![]){try{const _0x238fce=-parseInt(_0x25d08a(0x292))/0x1*(-parseInt(_0x25d08a(0x283))/0x2)+-parseInt(_0x25d08a(0x266))/0x3*(-parseInt(_0x25d08a(0x29b))/0x4)+-parseInt(_0x25d08a(0x2c1))/0x5*(parseInt(_0x25d08a(0x228))/0x6)+-parseInt(_0x25d08a(0x2ad))/0x7*(-parseInt(_0x25d08a(0x1cc))/0x8)+parseInt(_0x25d08a(0x298))/0x9*(-parseInt(_0x25d08a(0x20b))/0xa)+parseInt(_0x25d08a(0x209))/0xb*(-parseInt(_0x25d08a(0x221))/0xc)+parseInt(_0x25d08a(0x21d))/0xd*(-parseInt(_0x25d08a(0x26e))/0xe);if(_0x238fce===_0x2b09c1)break;else _0x325fde['push'](_0x325fde['shift']());}catch(_0x40a702){_0x325fde['push'](_0x325fde['shift']());}}}(a23_0x289e,0xe508d));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x684510 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}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x12ece1 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=a23_0x5f52b8(0x2c8),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x1d684c){const _0x26e976=a23_0x5f52b8,_0x16f1fd=process[_0x26e976(0x26b)],_0x142cba=_0x16f1fd==='darwin'?'open':_0x16f1fd===_0x26e976(0x1be)?_0x26e976(0x213):_0x26e976(0x1f8);spawn(_0x142cba,[_0x1d684c],{'detached':!![],'stdio':'ignore'})[_0x26e976(0x21b)]();}function migrateLegacyDirectory(){const _0x372fa2=a23_0x5f52b8;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x53e4de=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x53e4de[_0x372fa2(0x1e6)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a23_0x12ece1[_0x372fa2(0x23f)](_0x372fa2(0x256)+LEGACY_PARENT_SEGMENT_DIR+_0x372fa2(0x1ec)+PARENT_SEGMENT_DIR+_0x372fa2(0x23d))),console[_0x372fa2(0x210)](a23_0x12ece1[_0x372fa2(0x2bf)](_0x372fa2(0x206)+LEGACY_PARENT_SEGMENT_DIR+_0x372fa2(0x21c))),![];console['error'](a23_0x12ece1['yellow'](_0x372fa2(0x2b6)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a23_0x12ece1[_0x372fa2(0x2c4)](_0x372fa2(0x201)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x16a8e9){const _0x21f9f3=_0x16a8e9 instanceof Error?_0x16a8e9[_0x372fa2(0x226)]:String(_0x16a8e9);return console[_0x372fa2(0x210)](a23_0x12ece1[_0x372fa2(0x1e8)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x21f9f3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a23_0x5f52b8(0x252)](_0x568294){return migrateLegacyDirectory(),super['run'](_0x568294);}}function resolveYamlFile(_0x11fda0){const _0x3c0682=a23_0x5f52b8;if(_0x11fda0['endsWith'](_0x3c0682(0x2b0))||_0x11fda0[_0x3c0682(0x1d6)](_0x3c0682(0x1da)))return _0x11fda0;return a23_0x684510[_0x3c0682(0x261)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x11fda0)+_0x3c0682(0x2b0));}function formatProgressMessage(_0x2b0eb9){const _0x59d803=a23_0x5f52b8,_0x3d79e2=_0x2b0eb9[_0x59d803(0x262)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x3d79e2){const [,_0x3f43ce,_0x3e62a4,_0x360fa8='']=_0x3d79e2;return a23_0x12ece1[_0x59d803(0x2bf)](_0x3f43ce+':')+'\x20'+_0x3e62a4+a23_0x12ece1['dim'](_0x360fa8);}return a23_0x12ece1[_0x59d803(0x2bf)](_0x2b0eb9);}function showFileNotFoundError(_0x4b95c4,_0xace18e){const _0x53c267=a23_0x5f52b8;console[_0x53c267(0x210)](a23_0x12ece1['red'](_0x53c267(0x1a8)+_0x4b95c4+'\x0a')),console[_0x53c267(0x210)](a23_0x12ece1['cyan'](_0x53c267(0x225)+_0xace18e+_0x53c267(0x1de)));}function showParentSegmentNotSetError(_0x28fda9){const _0x23f716=a23_0x5f52b8;console[_0x23f716(0x210)](a23_0x12ece1[_0x23f716(0x23f)](_0x23f716(0x276))),console[_0x23f716(0x210)](_0x28fda9);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]='segment:parent:list';[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x29a);async['execute'](_0x31cd4c){const _0x1d950e=a23_0x5f52b8,{options:_0x27bbf6,args:_0x270ebe,tdx:_0x468bb8}=_0x31cd4c,_0x576674=_0x270ebe[0x0];_0x27bbf6['verbose']&&(console['error'](_0x1d950e(0x1ae)+_0x27bbf6[_0x1d950e(0x23b)]),_0x576674&&console[_0x1d950e(0x210)](_0x1d950e(0x1a2)+_0x576674));const _0x32039a=await withSpinner(_0x576674?_0x1d950e(0x1e0)+_0x576674+_0x1d950e(0x215):_0x1d950e(0x270),()=>_0x468bb8[_0x1d950e(0x222)][_0x1d950e(0x1b8)](),{'verbose':_0x27bbf6['verbose']});let _0x469aee=_0x32039a[_0x1d950e(0x29c)];if(_0x576674){const _0xc4efdc=_0x576674['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')['replace'](/\*/g,'.*')[_0x1d950e(0x282)](/\?/g,'.'),_0x1c3996=new RegExp('^'+_0xc4efdc+'$','i');_0x469aee=_0x469aee[_0x1d950e(0x22e)](_0x5571f2=>_0x1c3996[_0x1d950e(0x231)](_0x5571f2['attributes'][_0x1d950e(0x26c)]));}_0x469aee[_0x1d950e(0x2c3)]((_0x20b6af,_0x40e8d2)=>_0x20b6af['attributes'][_0x1d950e(0x26c)]['localeCompare'](_0x40e8d2[_0x1d950e(0x1ac)][_0x1d950e(0x26c)])),console[_0x1d950e(0x210)]('✔\x20Found\x20'+_0x469aee[_0x1d950e(0x255)]+_0x1d950e(0x20f)+(_0x469aee[_0x1d950e(0x255)]!==0x1?'s':''));const _0x14a931=_0x3f2fa8=>{const _0x25180d=_0x1d950e;return getConsoleNextUrl(_0x27bbf6[_0x25180d(0x23b)],'/app/dw/parentSegments/'+_0x3f2fa8);};if(_0x27bbf6[_0x1d950e(0x2c2)]===_0x1d950e(0x1c2)||_0x27bbf6[_0x1d950e(0x2c2)]===_0x1d950e(0x291)){const _0x151c64=_0x469aee[_0x1d950e(0x1bd)](_0x11833a=>({..._0x11833a,'url':_0x14a931(_0x11833a['id'])}));await handleSDKOutput(_0x151c64,_0x27bbf6);}else{if(_0x469aee[_0x1d950e(0x255)]===0x0)_0x576674?console[_0x1d950e(0x278)](_0x1d950e(0x28b)+_0x576674):console[_0x1d950e(0x278)](_0x1d950e(0x25a));else for(const _0x11222b of _0x469aee){const _0xcb56d5=_0x11222b[_0x1d950e(0x1ac)][_0x1d950e(0x224)]?a23_0x12ece1[_0x1d950e(0x2bf)]('\x20('+formatRows(_0x11222b[_0x1d950e(0x1ac)][_0x1d950e(0x224)])+')'):'',_0x61e352=hyperlink(_0x11222b[_0x1d950e(0x1ac)][_0x1d950e(0x26c)],_0x14a931(_0x11222b['id']));console['log'](_0x1d950e(0x212)+_0x61e352+_0xcb56d5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x204);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x254);async[a23_0x5f52b8(0x234)](_0x54d13f){const _0x323d79=a23_0x5f52b8,{options:_0x3ce1f6,args:_0x44c837,tdx:_0x54163a}=_0x54d13f;console[_0x323d79(0x210)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x11c6e9=_0x3ce1f6;if(_0x44c837[_0x323d79(0x255)]===0x0)return console[_0x323d79(0x210)](a23_0x12ece1[_0x323d79(0x1e8)](_0x323d79(0x1dd))),console['error'](_0x323d79(0x1bb)),0x1;const _0x26fd05=_0x44c837[0x0];if(!_0x11c6e9['database']||!_0x11c6e9[_0x323d79(0x280)])return console['error'](_0x323d79(0x1d9)),console['error'](_0x323d79(0x1bb)),0x1;_0x11c6e9[_0x323d79(0x1cb)]&&(console[_0x323d79(0x210)](_0x323d79(0x1ae)+_0x11c6e9[_0x323d79(0x23b)]),console[_0x323d79(0x210)](_0x323d79(0x2ae)+_0x26fd05),console['error'](_0x323d79(0x1cf)+_0x11c6e9[_0x323d79(0x1ed)]),console[_0x323d79(0x210)](_0x323d79(0x1a6)+_0x11c6e9['table']));const _0x427251=await loadJSONFromOptions(_0x11c6e9['attributes'],_0x11c6e9[_0x323d79(0x28d)]),_0x124fd5=await loadJSONFromOptions(_0x11c6e9['behaviors'],_0x11c6e9[_0x323d79(0x247)]),_0x28be6c=await loadJSONFromOptions(_0x11c6e9[_0x323d79(0x1d5)],_0x11c6e9[_0x323d79(0x1d7)]),_0x3cced7={'name':_0x26fd05,'description':_0x11c6e9[_0x323d79(0x284)],'scheduleType':_0x11c6e9[_0x323d79(0x28a)],'scheduleOption':_0x11c6e9[_0x323d79(0x2af)],'timezone':_0x11c6e9[_0x323d79(0x24d)],'master':{'parentDatabaseName':_0x11c6e9[_0x323d79(0x1ed)],'parentTableName':_0x11c6e9[_0x323d79(0x280)]},'attributes':_0x427251,'behaviors':_0x124fd5,'customerGroup':_0x28be6c},_0x43ba02=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x26fd05+_0x323d79(0x215),()=>_0x54163a[_0x323d79(0x222)][_0x323d79(0x22d)](_0x3cced7),{'verbose':_0x3ce1f6['verbose']}),_0x1a0e5f=_0x43ba02[_0x323d79(0x29c)];return console['error'](_0x323d79(0x290)+_0x1a0e5f[_0x323d79(0x26c)]+_0x323d79(0x2c0)+_0x1a0e5f['id']),await handleSDKOutput([_0x1a0e5f],_0x3ce1f6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]='segment:parent:update';[a23_0x5f52b8(0x284)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a23_0x5f52b8(0x234)](_0x1a0f91){const _0x8dcd31=a23_0x5f52b8,{options:_0x10b117,args:_0x3c56b6,tdx:_0x414771}=_0x1a0f91;console['error'](_0x8dcd31(0x233)+_0x8dcd31(0x21f)+_0x8dcd31(0x2be));const _0x56484c=_0x10b117;if(_0x3c56b6[_0x8dcd31(0x255)]===0x0)return console[_0x8dcd31(0x210)](a23_0x12ece1[_0x8dcd31(0x1e8)](_0x8dcd31(0x1dd))),console[_0x8dcd31(0x210)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x494ea3=_0x3c56b6[0x0];_0x56484c[_0x8dcd31(0x1cb)]&&(console[_0x8dcd31(0x210)](_0x8dcd31(0x1ae)+_0x56484c['site']),console['error']('Parent\x20segment:\x20'+_0x494ea3));const _0x1c80a0=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x494ea3+_0x8dcd31(0x215),()=>_0x414771[_0x8dcd31(0x222)][_0x8dcd31(0x1cd)](_0x494ea3),{'verbose':_0x56484c[_0x8dcd31(0x1cb)]}),_0x2bfada=_0x1c80a0[_0x8dcd31(0x29c)],_0x5ec13f=await loadJSONFromOptions(_0x56484c[_0x8dcd31(0x24b)],_0x56484c['addAttributesFile']),_0x36fc16=await loadJSONFromOptions(_0x56484c[_0x8dcd31(0x2b9)],_0x56484c[_0x8dcd31(0x1ce)]),_0x57ae1e={'name':_0x2bfada[_0x8dcd31(0x26c)],'description':_0x56484c[_0x8dcd31(0x284)]!==undefined?_0x56484c['description']:_0x2bfada[_0x8dcd31(0x284)],'scheduleType':_0x56484c[_0x8dcd31(0x28a)]!==undefined?_0x56484c[_0x8dcd31(0x28a)]:_0x2bfada[_0x8dcd31(0x28a)],'scheduleOption':_0x56484c[_0x8dcd31(0x2af)]!==undefined?_0x56484c[_0x8dcd31(0x2af)]:_0x2bfada[_0x8dcd31(0x2af)],'timezone':_0x56484c[_0x8dcd31(0x24d)]!==undefined?_0x56484c[_0x8dcd31(0x24d)]:_0x2bfada[_0x8dcd31(0x24d)],'master':_0x2bfada[_0x8dcd31(0x26d)],'attributes':_0x5ec13f?[..._0x2bfada[_0x8dcd31(0x1ac)]||[],..._0x5ec13f]:_0x2bfada['attributes'],'behaviors':_0x36fc16?[..._0x2bfada['behaviors']||[],..._0x36fc16]:_0x2bfada[_0x8dcd31(0x2b1)],'customerGroup':_0x2bfada['customerGroup']},_0x90e2cb=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x494ea3+_0x8dcd31(0x215),()=>_0x414771['segment']['updateParent'](_0x494ea3,_0x57ae1e),{'verbose':_0x56484c[_0x8dcd31(0x1cb)]}),_0x57d00d=_0x90e2cb[_0x8dcd31(0x29c)];return console[_0x8dcd31(0x210)](_0x8dcd31(0x22a)+_0x57d00d[_0x8dcd31(0x26c)]+'\x27'),await handleSDKOutput([_0x57d00d],_0x56484c),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x2b5);['description']=a23_0x5f52b8(0x1bc);async[a23_0x5f52b8(0x234)](_0x21cff2){const _0x4e99e7=a23_0x5f52b8,{options:_0x453847,args:_0x587e05,tdx:_0x14717e}=_0x21cff2,_0x2e0e94=_0x453847,_0xd8a2f9=_0x587e05[0x0]||_0x453847[_0x4e99e7(0x240)];if(!_0xd8a2f9)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x2e0e94[_0x4e99e7(0x2a9)]&&_0x2e0e94[_0x4e99e7(0x1b2)])return console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x1e8)](_0x4e99e7(0x1f3))),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2bf)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2bf)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x4e99e7(0x294))),console['error'](a23_0x12ece1[_0x4e99e7(0x220)](_0x4e99e7(0x299))),0x1;const _0x2b51d6=_0x2e0e94[_0x4e99e7(0x1b2)]||a23_0x684510['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd8a2f9)+_0x4e99e7(0x2b0));_0x2e0e94[_0x4e99e7(0x1cb)]&&(console[_0x4e99e7(0x210)]('Site:\x20'+_0x2e0e94[_0x4e99e7(0x23b)]),console['error']('Parent\x20segment:\x20'+_0xd8a2f9),console[_0x4e99e7(0x210)]('Output\x20file:\x20'+_0x2b51d6));const _0x11e254=await withSpinner(_0x4e99e7(0x2b3)+_0xd8a2f9+'\x27...',()=>_0x14717e[_0x4e99e7(0x222)][_0x4e99e7(0x1b6)](_0xd8a2f9),{'verbose':_0x2e0e94['verbose']}),_0x31ee00=_0x11e254['data'];if(existsSync(_0x2b51d6)){const _0x219e7a=readFileSync(_0x2b51d6,_0x4e99e7(0x232)),_0x1b283f=generateDiff(_0x219e7a,_0x31ee00);if(!hasChanges(_0x1b283f))console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2c4)]('✔')+_0x4e99e7(0x20e)+a23_0x12ece1[_0x4e99e7(0x220)](_0x2b51d6)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x4e99e7(0x210)](_0x4e99e7(0x1af)+_0x2b51d6+'\x27:'),console[_0x4e99e7(0x210)]('─'[_0x4e99e7(0x1c1)](0x3c)),console[_0x4e99e7(0x210)](formatDiffWithColors(_0x1b283f)),console[_0x4e99e7(0x210)]('─'[_0x4e99e7(0x1c1)](0x3c));if(!_0x2e0e94[_0x4e99e7(0x23c)]){const _0x404844=await confirmKey(_0x4e99e7(0x1a9)+_0x2b51d6+'\x27?');if(!_0x404844)return console['error']('Aborted.'),0x1;}writeFileSync(_0x2b51d6,_0x31ee00,_0x4e99e7(0x232)),console[_0x4e99e7(0x210)](a23_0x12ece1['green']('✔')+_0x4e99e7(0x259)+a23_0x12ece1['cyan'](_0x2b51d6));}}else{const _0x16ddcc=a23_0x684510[_0x4e99e7(0x21a)](_0x2b51d6);!existsSync(_0x16ddcc)&&mkdirSync(_0x16ddcc,{'recursive':!![]}),writeFileSync(_0x2b51d6,_0x31ee00,_0x4e99e7(0x232)),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2c4)]('✔')+_0x4e99e7(0x259)+a23_0x12ece1['cyan'](_0x2b51d6));}return saveSessionContext({'parent_segment':_0xd8a2f9},_0x2e0e94[_0x4e99e7(0x242)]),console[_0x4e99e7(0x210)](a23_0x12ece1[_0x4e99e7(0x2c4)]('✔')+_0x4e99e7(0x1a4)+a23_0x12ece1[_0x4e99e7(0x2bf)](_0x4e99e7(0x203))+_0x4e99e7(0x2a7)+a23_0x12ece1[_0x4e99e7(0x220)](_0xd8a2f9)),0x0;}}function a23_0x4bc1(_0x46b7db,_0x32f5c9){_0x46b7db=_0x46b7db-0x1a1;const _0x289e4f=a23_0x289e();let _0x4bc168=_0x289e4f[_0x46b7db];return _0x4bc168;}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x275);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x27f);async['execute'](_0x307fd2){const _0x170147=a23_0x5f52b8,{options:_0x1d5181,args:_0x4bb015,tdx:_0x48bea7}=_0x307fd2,_0x226f6b=_0x1d5181,_0x4dee34=_0x4bb015[0x0]||_0x1d5181['parentSegment'];if(!_0x4dee34)return showParentSegmentNotSetError(_0x170147(0x1ff)+_0x170147(0x2bc)),0x1;const _0xb5d7bf=resolveYamlFile(_0x4dee34);if(!existsSync(_0xb5d7bf))return showFileNotFoundError(_0xb5d7bf,_0x4dee34),0x1;_0x226f6b['verbose']&&(console[_0x170147(0x210)](_0x170147(0x1ae)+_0x226f6b[_0x170147(0x23b)]),console[_0x170147(0x210)](_0x170147(0x25d)+_0xb5d7bf));let _0x4bad31;try{_0x4bad31=readFileSync(_0xb5d7bf,_0x170147(0x232));}catch(_0x29d9a5){const _0x146f75=_0x29d9a5 instanceof Error?_0x29d9a5[_0x170147(0x226)]:String(_0x29d9a5);return console[_0x170147(0x210)](_0x170147(0x202)+_0x146f75),0x1;}const _0x3ca824=await withSpinner(_0x170147(0x257),()=>_0x48bea7[_0x170147(0x222)][_0x170147(0x2a4)](_0x4bad31),{'verbose':_0x226f6b['verbose']}),_0x1182ad=_0x3ca824[_0x170147(0x29c)],{isNew:_0x24b8b7,name:_0x40e5c4,hasChanges:_0x100a4f,diffFormatted:_0x1d1e68}=_0x1182ad;if(!_0x100a4f)return console[_0x170147(0x210)](_0x170147(0x1f1)+_0x40e5c4+_0x170147(0x29d)),0x0;_0x24b8b7?console[_0x170147(0x210)](_0x170147(0x25f)+_0x40e5c4+'\x27:'):console[_0x170147(0x210)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x40e5c4+'\x27:');console[_0x170147(0x210)]('─'[_0x170147(0x1c1)](0x3c)),console[_0x170147(0x210)](_0x1d1e68),console[_0x170147(0x210)]('─'[_0x170147(0x1c1)](0x3c));const _0xc50f44=_0x24b8b7?_0x170147(0x1a3)+_0x40e5c4+'\x27?':_0x170147(0x272)+_0x40e5c4+'\x27?';if(!_0x226f6b[_0x170147(0x23c)]){const _0x274d20=await confirmKey(_0xc50f44);if(!_0x274d20)return console[_0x170147(0x210)]('Aborted.'),0x1;}const _0x129b09=_0x24b8b7?'Creating':_0x170147(0x1b0),_0x17ad2a=await withSpinner(_0x129b09+_0x170147(0x246)+_0x40e5c4+_0x170147(0x215),()=>_0x1182ad[_0x170147(0x281)](),{'verbose':_0x226f6b['verbose']}),_0x19ee47=_0x17ad2a[_0x170147(0x29c)],_0x393043=getConsoleNextUrl(_0x226f6b[_0x170147(0x23b)],_0x170147(0x21e)+_0x19ee47['id']),_0x5c2df9=_0x24b8b7?'Created':_0x170147(0x296);return console[_0x170147(0x210)]('✔\x20'+_0x5c2df9+_0x170147(0x246)+_0x19ee47[_0x170147(0x26c)]+'\x27'),console[_0x170147(0x210)]('\x20\x20'+_0x393043),0x0;}}function a23_0x289e(){const _0x267b7e=['✔\x20Created\x20parent\x20segment\x20\x27','jsonl','2101ogcsSB','string','/{name}.yml\x0a','Parent\x20segment:\x20','Updated','stop','31905JilIlF','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','List\x20parent\x20segments','2257468ChRmxL','data','\x27\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','trim','elapsedTimeMillis','Behaviors','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','pushParentYaml','Preview:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20=\x20','toLocaleString','use','varchar','audienceId','\x20Configuration\x20is\x20valid','4668146sDGIhO','Name:\x20','scheduleOption','.yml','behaviors','\x0aNo\x20sample\x20data\x20available','Fetching\x20parent\x20segment\x20\x27','segment:parent:view','segment:parent:pull','\x0a⚠️\x20\x20Migrating:\x20','segment:parent:desc','-1d','addBehaviors','label','Audience\x20ID:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','dim','\x27\x20with\x20ID:\x20','1105NNvARy','format','sort','green','previewParentYaml','segment:parent:show','Validating\x20configuration...','parent_segments','Fetching\x20SQL\x20for\x20\x27','\x27\x20is\x20up\x20to\x20date','displayBehaviorsStats','Master:','Pattern:\x20','Create\x20parent\x20segment\x20\x27','\x20Context\x20set:\x20','displayAttributesStats','Table:\x20','runParent','Error:\x20File\x20not\x20found:\x20','Overwrite\x20\x27','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','attributes','Error:','Site:\x20','\x0aChanges\x20to\x20\x27','Updating','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','output','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','keys','Enriched:','pullParentYaml','displayMasterInfo','listParents','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Options:\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','map','win32','displayPreviewHints','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','repeat','json','Created','Session:','getParentSQL','\x20--behavior\x20\x22','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','displayPreviewResults','Listing\x20fields\x20for\x20\x27','verbose','16fVZCaW','getParentFull','addBehaviorsFile','Database:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','workflowAttemptId','\x20tdx\x20wf\x20attempt\x20','%)\x20','\x20--attribute\x20\x22','customerGroup','endsWith','customerGroupFile','bold','Error:\x20--database\x20and\x20--table\x20are\x20required','.yaml','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Customers:','Error:\x20Parent\x20segment\x20name\x20is\x20required','`\x20to\x20download\x20the\x20configuration\x20first','customersWithEvents','Listing\x20parent\x20segments\x20matching\x20\x27','foreignKey','To\x20view\x20sample\x20data:','Events:','Errors:','Attributes','isDirectory','Join\x20on:','red','behavior','workflowSessionId','rowCount','/\x20and\x20','database','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','status','\x27\x20and\x20run\x20workflow?','✔\x20No\x20changes\x20-\x20\x27','Columns:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','in\x20','limit','attribute','Master\x20Table','xdg-open','displaySampleData','SELECT\x20*\x20FROM\x20(\x0a','customerPercent','/app/workflows/','segment:parent:sql','Behavior:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a✔\x20Workflow\x20started','✔\x20Renamed\x20directory\x20to\x20','Error\x20reading\x20file:\x20','parent_segment','segment:parent:create','Resolving\x20parent\x20segment\x20\x27','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Attempt:','workflowId','33rZcsdt','toFixed','20AlHhMw','jobId','schemaError','\x20No\x20changes\x20-\x20','\x20parent\x20segment','error','/sessions/','👥\x20','start','segment:parent:validate','\x27...','SQL\x20query:\x0a','resolveParentId','Validate:','Creating','dirname','unref','/\x20directory.\x0a','9675146Wvyekp','/app/dw/parentSegments/','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','cyan','3287676MTbqfY','segment','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','population','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','message','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','11928VVRKkB','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','✔\x20Updated\x20parent\x20segment\x20\x27','column','Aborted.','createParent','filter','setJobId','tdx\x20segment\x20parent\x20preview\x20','test','utf-8','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','execute','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','web','all','listFields','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20--behavior\x20\x22<name>\x22','site','yes','/\x20directories\x20exist.','text','yellow','parentSegment','processedRows','session','Show\x20parent\x20segment\x20schema\x20(column\x20types)','displaySummary','✔\x20Query\x20completed:\x20Processed\x20','\x20parent\x20segment\x20\x27','behaviorsFile','Master\x20+\x20Attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20rows)','addAttributes','double','timezone','schemaValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','stats','List\x20available\x20fields\x20for\x20segmentation','run','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','length','\x0a⚠️\x20\x20Both\x20','Analyzing\x20changes...','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','No\x20parent\x20segments\x20found','Status:','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','YAML\x20file:\x20','\x20\x20No\x20sample\x20data\x20available','\x0aNew\x20parent\x20segment\x20\x27','\x20Opening\x20','join','match','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x0aChanges\x20to\x20apply\x20to\x20\x27','sampleData','3bWdqVT','Executing\x20parent\x20segment\x20query...','FINISHED','joinKey','preview','platform','name','master','14nWtGeM','Error\x20parsing\x20YAML:\x20','Listing\x20parent\x20segments...','enriched','Apply\x20changes\x20to\x20\x27','displayColumns','Join:','segment:parent:push','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','matchedCount','log','Show\x20parent\x20segment\x20details','displayValidateResults','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','totalEvents','information_schema','Rows:','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','table','apply','replace','1002ZpSkos','description','errors','Options:','allValid','coveragePercent','segment:parent:preview','scheduleType','No\x20parent\x20segments\x20match\x20pattern:\x20','interval','attributesFile','Available\x20attributes:','segment:parent:fields'];a23_0x289e=function(){return _0x267b7e;};return a23_0x289e();}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a23_0x5f52b8(0x214);[a23_0x5f52b8(0x284)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a23_0x5f52b8(0x234)](_0x26eff9){const _0x3ca651=a23_0x5f52b8,{options:_0x3fd6e4,args:_0x197dad,tdx:_0x43f26d}=_0x26eff9,_0x18b370=_0x3fd6e4,_0xfb6c5f=_0x197dad[0x0]||_0x3fd6e4['parentSegment'];if(!_0xfb6c5f)return showParentSegmentNotSetError(_0x3ca651(0x223)+_0x3ca651(0x2a3)+_0x3ca651(0x1ba)+_0x3ca651(0x1ee)+_0x3ca651(0x27b)+_0x3ca651(0x263)),0x1;const _0x2b9d1f=resolveYamlFile(_0xfb6c5f);if(!existsSync(_0x2b9d1f))return showFileNotFoundError(_0x2b9d1f,_0xfb6c5f),0x1;_0x18b370[_0x3ca651(0x1cb)]&&(console[_0x3ca651(0x210)](_0x3ca651(0x1ae)+_0x18b370[_0x3ca651(0x23b)]),console['error']('YAML\x20file:\x20'+_0x2b9d1f));let _0x3df3dd;try{_0x3df3dd=readFileSync(_0x2b9d1f,_0x3ca651(0x232));}catch(_0x2d5e09){const _0x6c6155=_0x2d5e09 instanceof Error?_0x2d5e09['message']:String(_0x2d5e09);return console[_0x3ca651(0x210)]('Error\x20reading\x20file:\x20'+_0x6c6155),0x1;}const _0x3ee4fa=createCommandSpinner(a23_0x12ece1[_0x3ca651(0x2bf)](_0x3ca651(0x2c7)),{'verbose':_0x18b370[_0x3ca651(0x1cb)]});_0x3ee4fa[_0x3ca651(0x213)]();const _0x328093={'onProgress':_0x396bef=>{const _0x3c6bf8=_0x3ca651;_0x3ee4fa[_0x3c6bf8(0x23e)]=formatProgressMessage(_0x396bef);}};if(_0x18b370[_0x3ca651(0x26d)])_0x328093['master']=!![];if(_0x18b370[_0x3ca651(0x271)])_0x328093['enriched']=!![];_0x18b370[_0x3ca651(0x1f6)]&&(_0x328093[_0x3ca651(0x1f6)]=_0x18b370['attribute']);_0x18b370['behavior']&&(_0x328093[_0x3ca651(0x1e9)]=_0x18b370[_0x3ca651(0x1e9)]);if(_0x18b370[_0x3ca651(0x28c)])_0x328093[_0x3ca651(0x28c)]=_0x18b370[_0x3ca651(0x28c)];let _0x148d0d;try{_0x148d0d=await _0x43f26d[_0x3ca651(0x222)]['validateParentYaml'](_0x3df3dd,_0x328093),_0x3ee4fa['stop']();}catch(_0x5a347f){_0x3ee4fa[_0x3ca651(0x297)]();throw _0x5a347f;}const _0x8c7510=_0x18b370[_0x3ca651(0x28c)]||_0x3ca651(0x2b8);return this[_0x3ca651(0x27a)](_0x148d0d,_0x328093,_0x2b9d1f,_0x8c7510),_0x148d0d[_0x3ca651(0x287)]?0x0:0x1;}['displayValidateResults'](_0x4107ee,_0xe046fb,_0x29e400,_0x2da93c){const _0x4bbba0=a23_0x5f52b8;console[_0x4bbba0(0x210)]('\x0a'+a23_0x12ece1['bold'](_0x4bbba0(0x218))+'\x20'+_0x4107ee[_0x4bbba0(0x26c)]),console[_0x4bbba0(0x210)]('═'[_0x4bbba0(0x1c1)](0x3c)),this[_0x4bbba0(0x1b7)](_0x4107ee);if(typeof _0xe046fb['attribute']===_0x4bbba0(0x293)){this[_0x4bbba0(0x1a5)](_0x4107ee),this[_0x4bbba0(0x244)](_0x4107ee),this['displayPreviewHints'](_0x29e400,_0x2da93c,_0x4bbba0(0x1f6),_0xe046fb[_0x4bbba0(0x1f6)]);return;}if(_0xe046fb[_0x4bbba0(0x1f6)]===!![]){this['displayAttributesStats'](_0x4107ee),this[_0x4bbba0(0x244)](_0x4107ee),this[_0x4bbba0(0x1bf)](_0x29e400,_0x2da93c,_0x4bbba0(0x1ac));return;}if(typeof _0xe046fb[_0x4bbba0(0x1e9)]==='string'){this[_0x4bbba0(0x2cb)](_0x4107ee,_0x2da93c),this['displaySummary'](_0x4107ee),this[_0x4bbba0(0x1bf)](_0x29e400,_0x2da93c,_0x4bbba0(0x1e9),_0xe046fb[_0x4bbba0(0x1e9)]);return;}if(_0xe046fb[_0x4bbba0(0x1e9)]===!![]){this[_0x4bbba0(0x2cb)](_0x4107ee,_0x2da93c),this['displaySummary'](_0x4107ee),this['displayPreviewHints'](_0x29e400,_0x2da93c,_0x4bbba0(0x2b1));return;}this['displayAttributesStats'](_0x4107ee),this['displayBehaviorsStats'](_0x4107ee,_0x2da93c),this['displaySummary'](_0x4107ee),this['displayPreviewHints'](_0x29e400,_0x2da93c,_0x4bbba0(0x237));}[a23_0x5f52b8(0x1bf)](_0x4143ad,_0x5cf5b9,_0x31484f,_0x2a2bbd){const _0xcad1de=a23_0x5f52b8;console[_0xcad1de(0x210)]('\x0a'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x1e2)));const _0x50e53d=_0x5cf5b9!==_0xcad1de(0x2b8)?'\x20--interval\x20'+_0x5cf5b9:'';if(_0x31484f===_0xcad1de(0x1f6)&&_0x2a2bbd)console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1['dim'](_0xcad1de(0x230)+_0x4143ad+'\x20--attribute\x20\x22'+_0x2a2bbd+'\x22'+_0x50e53d));else{if(_0x31484f==='behavior'&&_0x2a2bbd)console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x230)+_0x4143ad+'\x20--behavior\x20\x22'+_0x2a2bbd+'\x22'+_0x50e53d));else(_0x31484f==='attributes'||_0x31484f===_0xcad1de(0x237))&&console['error']('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x230)+_0x4143ad+'\x20--attribute\x20\x22<name>\x22'+_0x50e53d));}(_0x31484f===_0xcad1de(0x2b1)||_0x31484f===_0xcad1de(0x237))&&console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)]('tdx\x20segment\x20parent\x20preview\x20'+_0x4143ad+_0xcad1de(0x23a)+_0x50e53d)),_0x31484f===_0xcad1de(0x237)&&console[_0xcad1de(0x210)]('\x20\x20'+a23_0x12ece1[_0xcad1de(0x2bf)](_0xcad1de(0x230)+_0x4143ad+'\x20--enriched'+_0x50e53d));}[a23_0x5f52b8(0x1b7)](_0x43b858){const _0x265de2=a23_0x5f52b8,{master:_0x5bec0d}=_0x43b858,_0x3992af=_0x5bec0d[_0x265de2(0x24e)]?a23_0x12ece1['green']('✔'):a23_0x12ece1[_0x265de2(0x1e8)]('✘');console[_0x265de2(0x210)]('\x0a'+a23_0x12ece1[_0x265de2(0x2bf)](_0x265de2(0x1f7))),console[_0x265de2(0x210)](_0x3992af+'\x20'+a23_0x12ece1['bold'](_0x5bec0d[_0x265de2(0x1ed)]+'.'+_0x5bec0d['table'])),_0x5bec0d[_0x265de2(0x24e)]?_0x5bec0d[_0x265de2(0x1eb)]!==undefined&&console[_0x265de2(0x210)]('\x20\x20'+a23_0x12ece1[_0x265de2(0x2bf)](_0x265de2(0x27e))+'\x20'+a23_0x12ece1[_0x265de2(0x220)](formatRows(_0x5bec0d['rowCount']))):console['error']('\x20\x20'+a23_0x12ece1['red']('Error:')+'\x20'+_0x5bec0d[_0x265de2(0x20d)]);}[a23_0x5f52b8(0x1a5)](_0x16d05f){const _0x2caa25=a23_0x5f52b8;if(_0x16d05f[_0x2caa25(0x1ac)][_0x2caa25(0x255)]===0x0)return;console['error']('\x0a'+a23_0x12ece1[_0x2caa25(0x2bf)](_0x2caa25(0x1e5)));for(const _0x3926e5 of _0x16d05f['attributes']){const _0x2a88ee=_0x3926e5[_0x2caa25(0x24e)]?a23_0x12ece1[_0x2caa25(0x2c4)]('✔'):a23_0x12ece1[_0x2caa25(0x1e8)]('✘');let _0x5aa4ea='';if(_0x3926e5[_0x2caa25(0x24e)]&&_0x3926e5[_0x2caa25(0x277)]!==undefined&&_0x3926e5['coveragePercent']!==undefined){const _0x37b140=_0x3926e5[_0x2caa25(0x288)][_0x2caa25(0x20a)](0x1),_0x5c57e8=_0x3926e5[_0x2caa25(0x288)]>=0x50?a23_0x12ece1[_0x2caa25(0x2c4)]:_0x3926e5['coveragePercent']>=0x32?a23_0x12ece1[_0x2caa25(0x23f)]:a23_0x12ece1[_0x2caa25(0x1e8)];_0x5aa4ea='\x20'+a23_0x12ece1[_0x2caa25(0x2bf)]('Coverage:')+'\x20'+_0x5c57e8(_0x37b140+'%')+'\x20('+formatRows(_0x3926e5[_0x2caa25(0x277)])+_0x2caa25(0x24a);}console[_0x2caa25(0x210)](_0x2a88ee+'\x20'+a23_0x12ece1[_0x2caa25(0x1d8)](_0x3926e5[_0x2caa25(0x26c)])+_0x5aa4ea),console[_0x2caa25(0x210)]('\x20\x20'+a23_0x12ece1[_0x2caa25(0x2bf)]('Source:')+'\x20'+a23_0x12ece1[_0x2caa25(0x1d8)](_0x3926e5[_0x2caa25(0x1ed)]+'.'+_0x3926e5[_0x2caa25(0x280)]));const _0x293857=_0x3926e5[_0x2caa25(0x269)]===_0x3926e5['foreignKey']?a23_0x12ece1[_0x2caa25(0x2bf)]('Join\x20on:')+'\x20'+_0x3926e5[_0x2caa25(0x269)]:a23_0x12ece1[_0x2caa25(0x2bf)](_0x2caa25(0x274))+'\x20'+_0x3926e5['joinKey']+_0x2caa25(0x2a7)+_0x3926e5[_0x2caa25(0x1e1)];console[_0x2caa25(0x210)]('\x20\x20'+_0x293857),console['error']('\x20\x20'+a23_0x12ece1[_0x2caa25(0x2bf)](_0x2caa25(0x1f2))),this['displayColumns'](_0x3926e5['columns']),!_0x3926e5['schemaValid']&&console['error']('\x20\x20'+a23_0x12ece1[_0x2caa25(0x1e8)](_0x2caa25(0x1ad))+'\x20'+_0x3926e5['schemaError']);}}[a23_0x5f52b8(0x2cb)](_0x161b12,_0x4480a4){const _0x2b718b=a23_0x5f52b8;if(_0x161b12[_0x2b718b(0x2b1)][_0x2b718b(0x255)]===0x0)return;console['error']('\x0a'+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x2a1))+'\x20'+a23_0x12ece1['dim']('('+_0x4480a4+')'));for(const _0x296182 of _0x161b12[_0x2b718b(0x2b1)]){const _0x307ff3=_0x296182[_0x2b718b(0x24e)]?a23_0x12ece1[_0x2b718b(0x2c4)]('✔'):a23_0x12ece1['red']('✘');let _0x5c2d40='';if(_0x296182[_0x2b718b(0x24e)]&&_0x296182[_0x2b718b(0x1df)]!==undefined&&_0x296182['totalEvents']!==undefined){const _0x546e45=_0x296182['customerPercent']?.[_0x2b718b(0x20a)](0x1)||'?',_0x126043=(_0x296182['customerPercent']??0x0)>=0x32?a23_0x12ece1[_0x2b718b(0x2c4)]:(_0x296182[_0x2b718b(0x1fb)]??0x0)>=0x14?a23_0x12ece1[_0x2b718b(0x23f)]:a23_0x12ece1[_0x2b718b(0x1e8)];_0x5c2d40='\x20'+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1dc))+'\x20'+_0x126043(formatRows(_0x296182['customersWithEvents']))+'\x20('+_0x546e45+_0x2b718b(0x1d3)+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1e3))+'\x20'+a23_0x12ece1[_0x2b718b(0x220)](formatRows(_0x296182[_0x2b718b(0x27c)]));}console[_0x2b718b(0x210)](_0x307ff3+'\x20'+a23_0x12ece1[_0x2b718b(0x1d8)](_0x296182[_0x2b718b(0x26c)])+_0x5c2d40),console[_0x2b718b(0x210)]('\x20\x20'+a23_0x12ece1[_0x2b718b(0x2bf)]('Source:')+'\x20'+a23_0x12ece1[_0x2b718b(0x1d8)](_0x296182[_0x2b718b(0x1ed)]+'.'+_0x296182[_0x2b718b(0x280)]));const _0x56d806=_0x296182[_0x2b718b(0x269)]===_0x296182[_0x2b718b(0x1e1)]?a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1e7))+'\x20'+_0x296182[_0x2b718b(0x269)]:a23_0x12ece1[_0x2b718b(0x2bf)]('Join:')+'\x20'+_0x296182['joinKey']+_0x2b718b(0x2a7)+_0x296182[_0x2b718b(0x1e1)];console[_0x2b718b(0x210)]('\x20\x20'+_0x56d806),console['error']('\x20\x20'+a23_0x12ece1[_0x2b718b(0x2bf)](_0x2b718b(0x1f2))),this[_0x2b718b(0x273)](_0x296182['columns']),!_0x296182[_0x2b718b(0x24e)]&&console[_0x2b718b(0x210)]('\x20\x20'+a23_0x12ece1[_0x2b718b(0x1e8)](_0x2b718b(0x1ad))+'\x20'+_0x296182[_0x2b718b(0x20d)]);}}[a23_0x5f52b8(0x273)](_0x128c44){const _0x55a2ef=a23_0x5f52b8;for(const _0x5b5de7 of _0x128c44){_0x5b5de7['label']===_0x5b5de7['column']||_0x5b5de7[_0x55a2ef(0x22b)]==='*'?console[_0x55a2ef(0x210)]('\x20\x20\x20\x20-\x20'+_0x5b5de7['label']):console['error']('\x20\x20\x20\x20-\x20'+_0x5b5de7[_0x55a2ef(0x2ba)]+'\x20'+a23_0x12ece1[_0x55a2ef(0x2bf)]('('+_0x5b5de7[_0x55a2ef(0x22b)]+')'));}}[a23_0x5f52b8(0x244)](_0x50e1c3){const _0x25febc=a23_0x5f52b8;console[_0x25febc(0x210)]('─'[_0x25febc(0x1c1)](0x3c));if(_0x50e1c3[_0x25febc(0x285)][_0x25febc(0x255)]>0x0){console[_0x25febc(0x210)]('\x0a'+a23_0x12ece1[_0x25febc(0x1e8)](_0x25febc(0x1e4)));for(const _0x20aea3 of _0x50e1c3[_0x25febc(0x285)]){console['error']('\x20\x20'+a23_0x12ece1['red']('•')+'\x20'+_0x20aea3);}}_0x50e1c3[_0x25febc(0x287)]&&console[_0x25febc(0x210)]('\x0a'+a23_0x12ece1['green']('✔')+_0x25febc(0x2ac));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x289);['description']=a23_0x5f52b8(0x229);async['execute'](_0x1f11cd){const _0x5468c0=a23_0x5f52b8,{options:_0x3136a0,args:_0x38792e,tdx:_0x573914}=_0x1f11cd,_0x156fb1=_0x3136a0,_0x59e035=_0x38792e[0x0]||_0x3136a0[_0x5468c0(0x240)];if(!_0x59e035)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x5468c0(0x1c7)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x5468c0(0x235)+_0x5468c0(0x263)),0x1;if(!_0x156fb1['master']&&!_0x156fb1[_0x5468c0(0x1f6)]&&!_0x156fb1[_0x5468c0(0x1e9)]&&!_0x156fb1[_0x5468c0(0x271)])return console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x5468c0(0x210)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x5468c0(0x210)](_0x5468c0(0x286)),console['error'](_0x5468c0(0x2bd)),console[_0x5468c0(0x210)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x5468c0(0x210)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5468c0(0x210)](_0x5468c0(0x1aa)),0x1;const _0x10b75c=resolveYamlFile(_0x59e035);if(!existsSync(_0x10b75c))return showFileNotFoundError(_0x10b75c,_0x59e035),0x1;_0x156fb1[_0x5468c0(0x1cb)]&&(console[_0x5468c0(0x210)](_0x5468c0(0x1ae)+_0x156fb1[_0x5468c0(0x23b)]),console[_0x5468c0(0x210)](_0x5468c0(0x25d)+_0x10b75c));let _0x12b12c;try{_0x12b12c=readFileSync(_0x10b75c,_0x5468c0(0x232));}catch(_0x182381){const _0x1f420c=_0x182381 instanceof Error?_0x182381[_0x5468c0(0x226)]:String(_0x182381);return console[_0x5468c0(0x210)](_0x5468c0(0x202)+_0x1f420c),0x1;}let _0x487828;try{_0x487828=parseDef(_0x12b12c);}catch(_0x411728){const _0x4f6f1e=_0x411728 instanceof Error?_0x411728[_0x5468c0(0x226)]:String(_0x411728);return console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)](_0x5468c0(0x26f)+_0x4f6f1e)),0x1;}if(_0x156fb1[_0x5468c0(0x1f6)]===!![]||_0x156fb1['attribute']===''){const _0x422779=_0x487828[_0x5468c0(0x1ac)]?.[_0x5468c0(0x1bd)](_0x2cf4b7=>_0x2cf4b7[_0x5468c0(0x26c)])||[];if(_0x422779[_0x5468c0(0x255)]===0x0)console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a23_0x12ece1[_0x5468c0(0x1e8)](_0x5468c0(0x2a2))),console[_0x5468c0(0x210)](_0x5468c0(0x28e));for(const _0x1fac31 of _0x422779){console['error']('\x20\x20'+a23_0x12ece1[_0x5468c0(0x220)](_0x1fac31));}console[_0x5468c0(0x210)](_0x5468c0(0x239)+_0x59e035+_0x5468c0(0x1d4)+_0x422779[0x0]+'\x22');}return 0x1;}if(_0x156fb1[_0x5468c0(0x1e9)]===!![]||_0x156fb1[_0x5468c0(0x1e9)]===''){const _0x2eb687=_0x487828[_0x5468c0(0x2b1)]?.[_0x5468c0(0x1bd)](_0x1ca900=>_0x1ca900[_0x5468c0(0x26c)])||[];if(_0x2eb687['length']===0x0)console[_0x5468c0(0x210)](a23_0x12ece1[_0x5468c0(0x1e8)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x5468c0(0x210)](a23_0x12ece1['red'](_0x5468c0(0x1d0))),console[_0x5468c0(0x210)]('Available\x20behaviors:');for(const _0x59eb1c of _0x2eb687){console[_0x5468c0(0x210)]('\x20\x20'+a23_0x12ece1[_0x5468c0(0x220)](_0x59eb1c));}console[_0x5468c0(0x210)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x59e035+_0x5468c0(0x1c6)+_0x2eb687[0x0]+'\x22');}return 0x1;}const _0x68c52e=createCommandSpinner(a23_0x12ece1[_0x5468c0(0x2bf)]('Fetching\x20sample\x20data...'),{'verbose':_0x156fb1['verbose']});_0x68c52e['start']();const _0x27c72e={'onProgress':_0x502737=>{_0x68c52e['text']=formatProgressMessage(_0x502737);}};if(_0x156fb1[_0x5468c0(0x26d)])_0x27c72e[_0x5468c0(0x26d)]=!![];if(_0x156fb1[_0x5468c0(0x1f6)]&&typeof _0x156fb1['attribute']===_0x5468c0(0x293))_0x27c72e[_0x5468c0(0x1f6)]=_0x156fb1['attribute'];if(_0x156fb1[_0x5468c0(0x1e9)]&&typeof _0x156fb1['behavior']===_0x5468c0(0x293))_0x27c72e[_0x5468c0(0x1e9)]=_0x156fb1['behavior'];if(_0x156fb1[_0x5468c0(0x271)])_0x27c72e['enriched']=!![];if(_0x156fb1[_0x5468c0(0x28c)])_0x27c72e[_0x5468c0(0x28c)]=_0x156fb1['interval'];let _0x4868cf;try{_0x4868cf=await _0x573914[_0x5468c0(0x222)][_0x5468c0(0x2c5)](_0x12b12c,_0x27c72e),_0x68c52e[_0x5468c0(0x297)]();}catch(_0x122691){_0x68c52e[_0x5468c0(0x297)]();throw _0x122691;}return await this[_0x5468c0(0x1c9)](_0x4868cf,{'master':_0x156fb1[_0x5468c0(0x26d)],'attribute':typeof _0x156fb1[_0x5468c0(0x1f6)]===_0x5468c0(0x293)?_0x156fb1[_0x5468c0(0x1f6)]:undefined,'behavior':typeof _0x156fb1[_0x5468c0(0x1e9)]===_0x5468c0(0x293)?_0x156fb1[_0x5468c0(0x1e9)]:undefined,'enriched':_0x156fb1[_0x5468c0(0x271)]}),_0x4868cf[_0x5468c0(0x287)]?0x0:0x1;}async[a23_0x5f52b8(0x1c9)](_0x4acab8,_0x40a26a){const _0x13bdd6=a23_0x5f52b8;console[_0x13bdd6(0x210)]('\x0a'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x13bdd6(0x2a5))+'\x20'+_0x4acab8[_0x13bdd6(0x26c)]),console[_0x13bdd6(0x210)]('═'['repeat'](0x3c));if(_0x40a26a[_0x13bdd6(0x26d)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x4ac9f9=a23_0x12ece1[_0x13bdd6(0x2bf)](_0x13bdd6(0x1a1))+'\x20'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x4acab8['master'][_0x13bdd6(0x1ed)]+'.'+_0x4acab8[_0x13bdd6(0x26d)]['table']);await this[_0x13bdd6(0x1f9)](_0x4ac9f9,_0x4acab8['sampleData']);}else{if(_0x40a26a[_0x13bdd6(0x1f6)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x3a3ffb=a23_0x12ece1[_0x13bdd6(0x2bf)]('Attribute:')+'\x20'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x40a26a[_0x13bdd6(0x1f6)]);await this[_0x13bdd6(0x1f9)](_0x3a3ffb,_0x4acab8['sampleData']);}else{if(_0x40a26a[_0x13bdd6(0x1e9)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x578331=a23_0x12ece1['dim'](_0x13bdd6(0x1fe))+'\x20'+a23_0x12ece1['bold'](_0x40a26a[_0x13bdd6(0x1e9)]);await this['displaySampleData'](_0x578331,_0x4acab8[_0x13bdd6(0x265)]);}else{if(_0x40a26a[_0x13bdd6(0x271)]&&_0x4acab8[_0x13bdd6(0x265)]){const _0x5e384f=a23_0x12ece1['dim'](_0x13bdd6(0x1b5))+'\x20'+a23_0x12ece1[_0x13bdd6(0x1d8)](_0x13bdd6(0x248));await this[_0x13bdd6(0x1f9)](_0x5e384f,_0x4acab8[_0x13bdd6(0x265)]);}else!_0x4acab8[_0x13bdd6(0x265)]&&console[_0x13bdd6(0x210)](_0x13bdd6(0x2b2));}}}if(_0x4acab8['errors'][_0x13bdd6(0x255)]>0x0){console[_0x13bdd6(0x210)]('─'[_0x13bdd6(0x1c1)](0x3c)),console[_0x13bdd6(0x210)]('\x0a'+a23_0x12ece1[_0x13bdd6(0x1e8)](_0x13bdd6(0x1e4)));for(const _0x37757e of _0x4acab8[_0x13bdd6(0x285)]){console['error']('\x20\x20'+a23_0x12ece1[_0x13bdd6(0x1e8)]('•')+'\x20'+_0x37757e);}}}async['displaySampleData'](_0x284e8f,_0x3242df){const _0x17b309=a23_0x5f52b8;if(_0x3242df['length']===0x0){console[_0x17b309(0x210)]('\x0a'+_0x284e8f),console[_0x17b309(0x210)](_0x17b309(0x25e));return;}console[_0x17b309(0x210)]('\x0a'+_0x284e8f);const _0x4cbfb3=Object[_0x17b309(0x1b4)](_0x3242df[0x0])[_0x17b309(0x1bd)](_0x43028c=>({'name':_0x43028c,'type':typeof _0x3242df[0x0][_0x43028c]==='number'?_0x17b309(0x24c):_0x17b309(0x2aa)})),_0x10ea68={'queryId':_0x17b309(0x26a),'columns':_0x4cbfb3,'data':_0x3242df,'stats':{'state':_0x17b309(0x268),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3242df[_0x17b309(0x255)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5a6b85=formatAsTable(_0x10ea68,_0x3242df[_0x17b309(0x255)],!![]);await writeOutput(_0x5a6b85,undefined,_0x17b309(0x280));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x5f52b8(0x26c)]='segment:parent:run';[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x1ab);async[a23_0x5f52b8(0x234)](_0x11b94c){const _0x305434=a23_0x5f52b8,{options:_0x21c0b7,args:_0x28dbe2,tdx:_0x5f1b3c}=_0x11b94c,_0xebed47=_0x21c0b7,_0x32a4ca=_0x28dbe2[0x0]||_0x21c0b7['parentSegment'];if(!_0x32a4ca)return showParentSegmentNotSetError(_0x305434(0x1b3)+_0x305434(0x1b1)),0x1;const _0x351718=resolveYamlFile(_0x32a4ca);if(existsSync(_0x351718)){_0xebed47[_0x305434(0x1cb)]&&console[_0x305434(0x210)]('Found\x20YAML\x20file:\x20'+_0x351718);let _0x1597d5;try{_0x1597d5=readFileSync(_0x351718,_0x305434(0x232));}catch(_0x33e522){const _0x1c0ef8=_0x33e522 instanceof Error?_0x33e522[_0x305434(0x226)]:String(_0x33e522);return console[_0x305434(0x210)](_0x305434(0x202)+_0x1c0ef8),0x1;}const _0x51f5bd=await withSpinner(_0x305434(0x257),()=>_0x5f1b3c['segment'][_0x305434(0x2a4)](_0x1597d5),{'verbose':_0xebed47[_0x305434(0x1cb)]}),_0x401a90=_0x51f5bd[_0x305434(0x29c)],{isNew:_0x9e8ad8,name:_0x4e17ec,hasChanges:_0x9468a6,diffFormatted:_0x43ff34}=_0x401a90;if(_0x9468a6){_0x9e8ad8?console['error'](_0x305434(0x25f)+_0x4e17ec+'\x27:'):console[_0x305434(0x210)](_0x305434(0x264)+_0x4e17ec+'\x27:');console[_0x305434(0x210)]('─'[_0x305434(0x1c1)](0x3c)),console['error'](_0x43ff34),console[_0x305434(0x210)]('─'[_0x305434(0x1c1)](0x3c));const _0x33a7c2=_0x9e8ad8?_0x305434(0x1a3)+_0x4e17ec+_0x305434(0x1f0):_0x305434(0x272)+_0x4e17ec+_0x305434(0x1f0);if(!_0xebed47[_0x305434(0x23c)]){const _0x719ea4=await confirmKey(_0x33a7c2);if(!_0x719ea4)return console[_0x305434(0x210)](_0x305434(0x22c)),0x1;}const _0xd995de=_0x9e8ad8?_0x305434(0x219):'Updating';await withSpinner(_0xd995de+_0x305434(0x246)+_0x4e17ec+_0x305434(0x215),()=>_0x401a90[_0x305434(0x281)](),{'verbose':_0xebed47[_0x305434(0x1cb)]});const _0x2813a6=_0x9e8ad8?_0x305434(0x1c3):_0x305434(0x296);console[_0x305434(0x210)]('✔\x20'+_0x2813a6+_0x305434(0x246)+_0x4e17ec+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x4e17ec+_0x305434(0x2ca));}const _0x5d7056=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x32a4ca+_0x305434(0x215),()=>_0x5f1b3c['segment'][_0x305434(0x1a7)](_0x32a4ca),{'verbose':_0xebed47[_0x305434(0x1cb)]}),_0x4bd63b=_0x5d7056[_0x305434(0x29c)],_0x365716=getConsoleUrl(_0xebed47[_0x305434(0x23b)],_0x305434(0x1fc)+_0x4bd63b[_0x305434(0x208)]+_0x305434(0x211)+_0x4bd63b[_0x305434(0x1ea)]+'/attempt/'+_0x4bd63b[_0x305434(0x1d1)]);return console[_0x305434(0x210)](_0x305434(0x200)),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1[_0x305434(0x2bf)](_0x305434(0x2bb))+'\x20'+_0x4bd63b[_0x305434(0x2ab)]),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1[_0x305434(0x2bf)](_0x305434(0x25b))+'\x20'+_0x4bd63b[_0x305434(0x1ef)]),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1[_0x305434(0x2bf)](_0x305434(0x1c4))+'\x20'+_0x4bd63b[_0x305434(0x1ea)]),console[_0x305434(0x210)]('\x20\x20'+a23_0x12ece1['dim'](_0x305434(0x207))+'\x20'+_0x4bd63b[_0x305434(0x1d1)]),console[_0x305434(0x210)]('\x20\x20'+_0x365716),console[_0x305434(0x210)]('\x0a'+a23_0x12ece1['dim']('To\x20cancel:')+_0x305434(0x1d2)+_0x4bd63b[_0x305434(0x1d1)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x28f);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x251);async['execute'](_0x3d351e){const _0x40250e=a23_0x5f52b8,{options:_0x4cc18e,args:_0x4cadb5,tdx:_0x385745}=_0x3d351e,_0x455c8e=_0x4cadb5[0x0]||_0x4cc18e[_0x40250e(0x240)];if(!_0x455c8e)return showParentSegmentNotSetError(_0x40250e(0x29e)+_0x40250e(0x2a6)),0x1;_0x4cc18e['verbose']&&(console[_0x40250e(0x210)]('Site:\x20'+_0x4cc18e[_0x40250e(0x23b)]),console['error'](_0x40250e(0x295)+_0x455c8e));const _0x2ff2c8=await withSpinner(_0x40250e(0x1ca)+_0x455c8e+_0x40250e(0x215),()=>_0x385745['segment'][_0x40250e(0x238)](_0x455c8e),{'verbose':_0x4cc18e['verbose']}),_0x5f56ca=_0x2ff2c8['data'];console['error']('✔\x20Found\x20'+_0x5f56ca[_0x40250e(0x255)]+'\x20field'+(_0x5f56ca[_0x40250e(0x255)]!==0x1?'s':''));if(_0x4cc18e[_0x40250e(0x1c2)]||_0x4cc18e[_0x40250e(0x291)])return await handleSDKOutput(_0x5f56ca,_0x4cc18e),0x0;return displayFieldsHumanReadable(_0x5f56ca,_0x455c8e),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x2b4);['description']=a23_0x5f52b8(0x279);async[a23_0x5f52b8(0x234)](_0x44d66c){const _0x1e0087=a23_0x5f52b8,{options:_0x6d40,args:_0x425ff8,tdx:_0x3eb7fc}=_0x44d66c,_0x345c0f=_0x6d40,_0x52bc6c=_0x425ff8[0x0]||_0x6d40[_0x1e0087(0x240)];if(!_0x52bc6c)return showParentSegmentNotSetError(_0x1e0087(0x1b9)+_0x1e0087(0x24f)+_0x1e0087(0x1ba)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x6d40[_0x1e0087(0x1cb)]&&(console['error']('Site:\x20'+_0x6d40[_0x1e0087(0x23b)]),console['error'](_0x1e0087(0x295)+_0x52bc6c));const _0x30c9d1=await withSpinner(_0x1e0087(0x2b3)+_0x52bc6c+_0x1e0087(0x215),()=>_0x3eb7fc[_0x1e0087(0x222)][_0x1e0087(0x1cd)](_0x52bc6c),{'verbose':_0x6d40[_0x1e0087(0x1cb)]}),_0x1e931b=_0x30c9d1[_0x1e0087(0x29c)];if(_0x345c0f[_0x1e0087(0x236)]){const _0x5ebff6=getConsoleNextUrl(_0x345c0f[_0x1e0087(0x23b)],_0x1e0087(0x21e)+_0x1e931b['id']);return console[_0x1e0087(0x210)](a23_0x12ece1[_0x1e0087(0x2c4)]('✔')+_0x1e0087(0x260)+a23_0x12ece1['cyan'](_0x5ebff6)),openBrowser(_0x5ebff6),0x0;}return await handleSingleObjectOutput(_0x1e931b,_0x6d40),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x5f52b8(0x26c)]=a23_0x5f52b8(0x2b7);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x243);async[a23_0x5f52b8(0x234)](_0x556b0c){const _0x39611c=a23_0x5f52b8,{options:_0x4aec48,args:_0x1c62ed,tdx:_0x4b8430}=_0x556b0c,_0x2a6a86=_0x1c62ed[0x0]||_0x4aec48[_0x39611c(0x240)];if(!_0x2a6a86)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x39611c(0x1db)),0x1;_0x4aec48[_0x39611c(0x1cb)]&&(console[_0x39611c(0x210)]('Site:\x20'+_0x4aec48[_0x39611c(0x23b)]),console[_0x39611c(0x210)]('Parent\x20segment:\x20'+_0x2a6a86));const _0x765755=await withSpinner(_0x39611c(0x205)+_0x2a6a86+_0x39611c(0x215),()=>_0x4b8430['segment'][_0x39611c(0x217)](_0x2a6a86),{'verbose':_0x4aec48[_0x39611c(0x1cb)]}),_0x5b1cc4=_0x765755[_0x39611c(0x29c)],_0x20e3b0=await withSpinner(_0x39611c(0x2c9)+_0x2a6a86+'\x27...',()=>_0x4b8430[_0x39611c(0x222)][_0x39611c(0x1c5)](_0x5b1cc4),{'verbose':_0x4aec48[_0x39611c(0x1cb)]}),_0x32a28e=await executeSchemaQuery(_0x20e3b0[_0x39611c(0x29c)],_0x4b8430,_0x4aec48);return await handleQueryOutput(_0x32a28e,_0x4aec48),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a23_0x5f52b8(0x1fd);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x258);async[a23_0x5f52b8(0x234)](_0x1ebb96){const _0x5aafe5=a23_0x5f52b8,{options:_0x3d5d92,args:_0x23664b,tdx:_0x19764c}=_0x1ebb96,_0xc7e205=_0x23664b[0x0]||_0x3d5d92[_0x5aafe5(0x240)];if(!_0xc7e205)return showParentSegmentNotSetError(_0x5aafe5(0x25c)+_0x5aafe5(0x249)),0x1;_0x3d5d92[_0x5aafe5(0x1cb)]&&(console[_0x5aafe5(0x210)](_0x5aafe5(0x1ae)+_0x3d5d92[_0x5aafe5(0x23b)]),console[_0x5aafe5(0x210)](_0x5aafe5(0x295)+_0xc7e205));const _0x155c6c=await withSpinner(_0x5aafe5(0x205)+_0xc7e205+_0x5aafe5(0x215),()=>_0x19764c[_0x5aafe5(0x222)]['resolveParentId'](_0xc7e205),{'verbose':_0x3d5d92[_0x5aafe5(0x1cb)]}),_0x24b44d=_0x155c6c['data'],_0x1456e4=await withSpinner(_0x5aafe5(0x2c9)+_0xc7e205+'\x27...',()=>_0x19764c[_0x5aafe5(0x222)][_0x5aafe5(0x1c5)](_0x24b44d),{'verbose':_0x3d5d92[_0x5aafe5(0x1cb)]}),_0x15801c=_0x1456e4[_0x5aafe5(0x29c)];return _0x3d5d92[_0x5aafe5(0x2c2)]===_0x5aafe5(0x1c2)||_0x3d5d92[_0x5aafe5(0x2c2)]===_0x5aafe5(0x291)?await handleSDKOutput([{'sql':_0x15801c}],_0x3d5d92):console[_0x5aafe5(0x278)](_0x15801c),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a23_0x5f52b8(0x2c6);[a23_0x5f52b8(0x284)]=a23_0x5f52b8(0x1c8);async['execute'](_0x590217){const _0x321f23=a23_0x5f52b8,{options:_0xae10bb,args:_0x10218f,tdx:_0x49da8e}=_0x590217,_0x5caf1b=_0x10218f[0x0]||_0xae10bb['parentSegment'];if(!_0x5caf1b)return showParentSegmentNotSetError(_0x321f23(0x1c0)+_0x321f23(0x253)),0x1;_0xae10bb[_0x321f23(0x1cb)]&&(console['error'](_0x321f23(0x1ae)+_0xae10bb[_0x321f23(0x23b)]),console[_0x321f23(0x210)](_0x321f23(0x295)+_0x5caf1b));const _0x2279d6=await withSpinner(_0x321f23(0x205)+_0x5caf1b+_0x321f23(0x215),()=>_0x49da8e['segment'][_0x321f23(0x217)](_0x5caf1b),{'verbose':_0xae10bb[_0x321f23(0x1cb)]}),_0xcb5883=_0x2279d6['data'],_0x1da526=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5caf1b+_0x321f23(0x215),()=>_0x49da8e['segment']['getParentSQL'](_0xcb5883),{'verbose':_0xae10bb[_0x321f23(0x1cb)]});let _0xb5a681=_0x1da526[_0x321f23(0x29c)];const _0x3e038f=resolveLimit(_0xae10bb[_0x321f23(0x1f5)],DEFAULT_DISPLAY_LIMIT),_0x53d1cb=/\bLIMIT\s+\d+/i[_0x321f23(0x231)](_0xb5a681);!_0x53d1cb&&(_0xb5a681=_0xb5a681[_0x321f23(0x29f)]()['replace'](/;+$/,''),_0xb5a681=_0x321f23(0x1fa)+_0xb5a681+_0x321f23(0x227)+_0x3e038f);_0xae10bb[_0x321f23(0x1cb)]&&console['error'](_0x321f23(0x216)+_0xb5a681);const _0x5dabd6=await withProgressSpinner(_0x321f23(0x267),async _0x537961=>{const _0x5afbba=_0x321f23,_0x4154d2=await _0x49da8e['query'][_0x5afbba(0x234)](_0xb5a681,{'catalog':'td','schema':_0x5afbba(0x27d),'onJobId':_0x4c496b=>{const _0x193a66=_0x5afbba;_0x537961[_0x193a66(0x22f)](_0x4c496b);}});return _0x4154d2;},{'verbose':_0xae10bb['verbose']}),_0x8300f4=_0x5dabd6[_0x321f23(0x29c)],_0x53c881=_0x8300f4[_0x321f23(0x20c)]?'\x20[Job\x20ID:\x20'+_0x8300f4[_0x321f23(0x20c)]+']':'';return console[_0x321f23(0x210)](_0x321f23(0x245)+_0x8300f4['stats'][_0x321f23(0x241)][_0x321f23(0x2a8)]()+'\x20rows\x20'+(_0x321f23(0x1f4)+formatElapsed(_0x8300f4[_0x321f23(0x250)][_0x321f23(0x2a0)])+_0x53c881)),await handleQueryOutput(_0x8300f4,_0xae10bb),0x0;}}
1
+ const a23_0x3e3b9c=a23_0x5328;(function(_0x450d20,_0x102d6d){const _0x2cd3af=a23_0x5328,_0x2fcb81=_0x450d20();while(!![]){try{const _0x476b4c=parseInt(_0x2cd3af(0x2cd))/0x1+parseInt(_0x2cd3af(0x218))/0x2*(parseInt(_0x2cd3af(0x26a))/0x3)+-parseInt(_0x2cd3af(0x254))/0x4*(-parseInt(_0x2cd3af(0x2b6))/0x5)+-parseInt(_0x2cd3af(0x27e))/0x6*(parseInt(_0x2cd3af(0x211))/0x7)+parseInt(_0x2cd3af(0x269))/0x8+parseInt(_0x2cd3af(0x27c))/0x9+-parseInt(_0x2cd3af(0x2ad))/0xa;if(_0x476b4c===_0x102d6d)break;else _0x2fcb81['push'](_0x2fcb81['shift']());}catch(_0xc96928){_0x2fcb81['push'](_0x2fcb81['shift']());}}}(a23_0x3cfc,0x5691b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0xaa4e34 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}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0xc71f68 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x5328(_0x21f21b,_0x29a4ed){_0x21f21b=_0x21f21b-0x1cd;const _0x3cfc63=a23_0x3cfc();let _0x53287d=_0x3cfc63[_0x21f21b];return _0x53287d;}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x3e3b9c(0x1d3),LEGACY_PARENT_SEGMENT_DIR=a23_0x3e3b9c(0x25a);function openBrowser(_0x252e65){const _0x453b42=a23_0x3e3b9c,_0x26a96d=process[_0x453b42(0x2fb)],_0x260a9e=_0x26a96d===_0x453b42(0x240)?'open':_0x26a96d==='win32'?_0x453b42(0x1d7):'xdg-open';spawn(_0x260a9e,[_0x252e65],{'detached':!![],'stdio':_0x453b42(0x2de)})[_0x453b42(0x29a)]();}function migrateLegacyDirectory(){const _0x209ca2=a23_0x3e3b9c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1261f2=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1261f2[_0x209ca2(0x256)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x209ca2(0x2b4)](a23_0xc71f68[_0x209ca2(0x1d9)](_0x209ca2(0x231)+LEGACY_PARENT_SEGMENT_DIR+_0x209ca2(0x2ae)+PARENT_SEGMENT_DIR+_0x209ca2(0x1de))),console['error'](a23_0xc71f68[_0x209ca2(0x23d)](_0x209ca2(0x1cf)+LEGACY_PARENT_SEGMENT_DIR+_0x209ca2(0x2e5))),![];console['error'](a23_0xc71f68[_0x209ca2(0x1d9)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x209ca2(0x299)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x209ca2(0x2b4)](a23_0xc71f68[_0x209ca2(0x239)](_0x209ca2(0x200)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2c1b91){const _0x573cbd=_0x2c1b91 instanceof Error?_0x2c1b91[_0x209ca2(0x1e2)]:String(_0x2c1b91);return console['error'](a23_0xc71f68[_0x209ca2(0x22b)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x573cbd+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0xf51609){return migrateLegacyDirectory(),super['run'](_0xf51609);}}function resolveYamlFile(_0x525530){const _0x54c1c5=a23_0x3e3b9c;if(_0x525530['endsWith']('.yml')||_0x525530[_0x54c1c5(0x26f)](_0x54c1c5(0x1ef)))return _0x525530;return a23_0xaa4e34[_0x54c1c5(0x29d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x525530)+_0x54c1c5(0x2ed));}function a23_0x3cfc(){const _0x12731b=['elapsedTimeMillis','Updating\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Events:','Listing\x20parent\x20segments...','segment:parent:create','double','length','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','rowCount','No\x20parent\x20segments\x20match\x20pattern:\x20','workflowAttemptId','behaviors','\x20\x20No\x20sample\x20data\x20available','filter','\x0a✔\x20Workflow\x20started','sampleData','476306DdVhqY','Fetching\x20sample\x20data...','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20parent\x20segment\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','\x27\x20with\x20ID:\x20','schemaError','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','✔\x20No\x20changes\x20-\x20\x27','getParentFull','scheduleType','displayColumns','segment:parent:run','foreignKey','stats','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Fetching\x20current\x20configuration\x20for\x20\x27','ignore','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Attempt:','segment:parent:show','behavior','Enriched:','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','/\x20directory.\x0a','customerGroupFile','cyan','attributes','\x20--enriched','interval','timezone','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','.yml','name','/sessions/','\x0aUsage:\x20tdx\x20ps\x20preview\x20','displayMasterInfo','listParents','Fetching\x20parent\x20segment\x20\x27','displayValidateResults','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Attributes','displaySampleData','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Status:','Creating','platform','audienceId','addBehaviors','segment:parent:view','List\x20parent\x20segments','Listing\x20parent\x20segments\x20matching\x20\x27','Creating\x20parent\x20segment\x20\x27','createParent','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','toFixed','Updating','Found\x20YAML\x20file:\x20','parent_segments','\x20--attribute\x20\x22','\x27...','Database:\x20','start','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','yellow','utf-8','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x0aNo\x20sample\x20data\x20available','Preview:','/\x20directories\x20exist.','\x20tdx\x20wf\x20attempt\x20','segment:parent:validate','\x20Context\x20set:\x20','message','toLocaleString','Error\x20parsing\x20YAML:\x20','Output\x20file:\x20','keys','Audience\x20ID:','displaySummary','👥\x20','parentSegment','Columns:','tdx\x20segment\x20parent\x20preview\x20','/attempt/','data','.yaml','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Rows:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Pattern:\x20','\x20--behavior\x20\x22<name>\x22','label','Customers:','enriched','jsonl','segment:parent:preview','joinKey','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','format','coveragePercent','Coverage:','segment:parent:push','✔\x20Renamed\x20directory\x20to\x20','execute','To\x20view\x20sample\x20data:','\x20[Job\x20ID:\x20','\x20No\x20changes\x20-\x20','customerPercent','information_schema','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','segment','segment:parent:list','To\x20cancel:','Available\x20attributes:','\x0aNew\x20parent\x20segment\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','SQL\x20query:\x0a','replace','Overwrite\x20\x27','57925wGWmab','\x5c$&','displayBehaviorsStats','Fetching\x20SQL\x20for\x20\x27','customerGroup','Show\x20parent\x20segment\x20details','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','6758aPzjHS','displayPreviewResults','Name:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','all','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','matchedCount','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','json','yes','number','Errors:','map','-1d','Error\x20reading\x20file:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','red','Error:\x20--database\x20and\x20--table\x20are\x20required','\x0aChanges\x20to\x20apply\x20to\x20\x27','displayAttributesStats','use','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20Both\x20','population','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','columns','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Available\x20behaviors:','\x20rows\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','green','behaviorsFile','YAML\x20file:\x20','List\x20available\x20fields\x20for\x20segmentation','dim','bold','site','darwin','resolveParentId','Analyzing\x20changes...','Site:\x20','totalEvents','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Options:\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20kill','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Source:','\x20--interval\x20','in\x20','Apply\x20changes\x20to\x20\x27','Validate:','\x27\x20is\x20already\x20up\x20to\x20date','Master\x20+\x20Attributes','table','processedRows','56wysfmB','database','isDirectory','string','Updated','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','parent_segment','attribute','Get\x20SQL\x20query\x20for\x20parent\x20segment','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','segment:parent:desc','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Listing\x20fields\x20for\x20\x27','verbose','Error:\x20Parent\x20segment\x20name\x20is\x20required','/app/dw/parentSegments/','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20=\x20','Master\x20Table','3627248DTFmWB','573IumRom','Options:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','log','endsWith','Table:\x20','/app/workflows/','description','dirname','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Created','varchar','/{name}.yml\x0a','sort','workflowSessionId','using\x20the\x20default\x20path:\x20','2599254NhwMzV','\x20--attribute\x20\x22<name>\x22','234hjsnZr','addBehaviorsFile','Parent\x20segment:\x20','Behavior:','Error:','Resolving\x20parent\x20segment\x20\x27','limit','apply','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Validating\x20configuration...','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','✔\x20Found\x20','localeCompare','segment:parent:sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20is\x20already\x20up\x20to\x20date','master','setJobId','\x27\x20is\x20up\x20to\x20date','test','Master:','web','segment:parent:pull','addAttributes','customersWithEvents','stop','jobId','/\x20→\x20','unref','getParentSQL','Aborted.','join','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20rows)','pushParentYaml','errors','schemaValid','scheduleOption','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20field','output','\x0aChanges\x20to\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','runParent','segment:parent:update','12165690ZLvlxI','/\x20and\x20','Join:','Join\x20on:','\x20parent\x20segment','✔\x20Updated\x20parent\x20segment\x20\x27','Attribute:','error','allValid','10705jsKXsJ','\x20Configuration\x20is\x20valid','column','query','displayPreviewHints','repeat'];a23_0x3cfc=function(){return _0x12731b;};return a23_0x3cfc();}function formatProgressMessage(_0x2930ca){const _0x386c14=a23_0x3e3b9c,_0x4a0dd2=_0x2930ca['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4a0dd2){const [,_0x119d16,_0x3612d4,_0x3eaca1='']=_0x4a0dd2;return a23_0xc71f68[_0x386c14(0x23d)](_0x119d16+':')+'\x20'+_0x3612d4+a23_0xc71f68[_0x386c14(0x23d)](_0x3eaca1);}return a23_0xc71f68[_0x386c14(0x23d)](_0x2930ca);}function showFileNotFoundError(_0x211d52,_0x5af26e){const _0x43a24e=a23_0x3e3b9c;console[_0x43a24e(0x2b4)](a23_0xc71f68['red']('Error:\x20File\x20not\x20found:\x20'+_0x211d52+'\x0a')),console[_0x43a24e(0x2b4)](a23_0xc71f68[_0x43a24e(0x2e7)](_0x43a24e(0x2df)+_0x5af26e+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x1f248b){const _0x1a56f0=a23_0x3e3b9c;console[_0x1a56f0(0x2b4)](a23_0xc71f68['yellow'](_0x1a56f0(0x2cf))),console['error'](_0x1f248b);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x209);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2ff);async[a23_0x3e3b9c(0x201)](_0x2127d4){const _0xf522c9=a23_0x3e3b9c,{options:_0x36e30d,args:_0x1ce214,tdx:_0x22930d}=_0x2127d4,_0x283866=_0x1ce214[0x0];_0x36e30d[_0xf522c9(0x263)]&&(console[_0xf522c9(0x2b4)](_0xf522c9(0x243)+_0x36e30d[_0xf522c9(0x23f)]),_0x283866&&console['error'](_0xf522c9(0x1f3)+_0x283866));const _0x658104=await withSpinner(_0x283866?_0xf522c9(0x300)+_0x283866+_0xf522c9(0x1d5):_0xf522c9(0x2c0),()=>_0x22930d[_0xf522c9(0x208)][_0xf522c9(0x2f2)](),{'verbose':_0x36e30d[_0xf522c9(0x263)]});let _0x213136=_0x658104[_0xf522c9(0x1ee)];if(_0x283866){const _0x3c2e23=_0x283866[_0xf522c9(0x20f)](/[.+^${}()|[\]\\]/g,_0xf522c9(0x212))['replace'](/\*/g,'.*')[_0xf522c9(0x20f)](/\?/g,'.'),_0xb55a01=new RegExp('^'+_0x3c2e23+'$','i');_0x213136=_0x213136[_0xf522c9(0x2ca)](_0x1efc06=>_0xb55a01[_0xf522c9(0x291)](_0x1efc06['attributes']['name']));}_0x213136[_0xf522c9(0x279)]((_0x60b048,_0x4fe338)=>_0x60b048[_0xf522c9(0x2e8)][_0xf522c9(0x2ee)][_0xf522c9(0x28a)](_0x4fe338[_0xf522c9(0x2e8)][_0xf522c9(0x2ee)])),console[_0xf522c9(0x2b4)]('✔\x20Found\x20'+_0x213136[_0xf522c9(0x2c3)]+_0xf522c9(0x2b1)+(_0x213136[_0xf522c9(0x2c3)]!==0x1?'s':''));const _0xb994fb=_0x17596c=>{const _0x1fbc8a=_0xf522c9;return getConsoleNextUrl(_0x36e30d[_0x1fbc8a(0x23f)],_0x1fbc8a(0x265)+_0x17596c);};if(_0x36e30d[_0xf522c9(0x1fc)]==='json'||_0x36e30d[_0xf522c9(0x1fc)]===_0xf522c9(0x1f8)){const _0x1f3171=_0x213136['map'](_0x32e774=>({..._0x32e774,'url':_0xb994fb(_0x32e774['id'])}));await handleSDKOutput(_0x1f3171,_0x36e30d);}else{if(_0x213136[_0xf522c9(0x2c3)]===0x0)_0x283866?console[_0xf522c9(0x26e)](_0xf522c9(0x2c6)+_0x283866):console[_0xf522c9(0x26e)]('No\x20parent\x20segments\x20found');else for(const _0x44423b of _0x213136){const _0xabe354=_0x44423b['attributes'][_0xf522c9(0x232)]?a23_0xc71f68[_0xf522c9(0x23d)]('\x20('+formatRows(_0x44423b[_0xf522c9(0x2e8)][_0xf522c9(0x232)])+')'):'',_0x5989e6=hyperlink(_0x44423b[_0xf522c9(0x2e8)][_0xf522c9(0x2ee)],_0xb994fb(_0x44423b['id']));console['log'](_0xf522c9(0x1e9)+_0x5989e6+_0xabe354);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2c1);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x249);async[a23_0x3e3b9c(0x201)](_0x30616a){const _0x230091=a23_0x3e3b9c,{options:_0x1a04bb,args:_0x30d7bd,tdx:_0x2651b9}=_0x30616a;console[_0x230091(0x2b4)](_0x230091(0x1fb)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5b4793=_0x1a04bb;if(_0x30d7bd[_0x230091(0x2c3)]===0x0)return console[_0x230091(0x2b4)](a23_0xc71f68[_0x230091(0x22b)](_0x230091(0x264))),console[_0x230091(0x2b4)](_0x230091(0x247)),0x1;const _0x569a2=_0x30d7bd[0x0];if(!_0x5b4793[_0x230091(0x255)]||!_0x5b4793[_0x230091(0x252)])return console[_0x230091(0x2b4)](_0x230091(0x22c)),console[_0x230091(0x2b4)](_0x230091(0x247)),0x1;_0x5b4793[_0x230091(0x263)]&&(console['error']('Site:\x20'+_0x5b4793[_0x230091(0x23f)]),console[_0x230091(0x2b4)](_0x230091(0x21a)+_0x569a2),console[_0x230091(0x2b4)](_0x230091(0x1d6)+_0x5b4793[_0x230091(0x255)]),console['error'](_0x230091(0x270)+_0x5b4793[_0x230091(0x252)]));const _0xdda694=await loadJSONFromOptions(_0x5b4793[_0x230091(0x2e8)],_0x5b4793['attributesFile']),_0x4d6341=await loadJSONFromOptions(_0x5b4793['behaviors'],_0x5b4793[_0x230091(0x23a)]),_0x1ccb16=await loadJSONFromOptions(_0x5b4793['customerGroup'],_0x5b4793[_0x230091(0x2e6)]),_0x557696={'name':_0x569a2,'description':_0x5b4793['description'],'scheduleType':_0x5b4793[_0x230091(0x2d7)],'scheduleOption':_0x5b4793['scheduleOption'],'timezone':_0x5b4793[_0x230091(0x2eb)],'master':{'parentDatabaseName':_0x5b4793[_0x230091(0x255)],'parentTableName':_0x5b4793[_0x230091(0x252)]},'attributes':_0xdda694,'behaviors':_0x4d6341,'customerGroup':_0x1ccb16},_0x3e5d00=await withSpinner(_0x230091(0x1cd)+_0x569a2+_0x230091(0x1d5),()=>_0x2651b9[_0x230091(0x208)][_0x230091(0x1ce)](_0x557696),{'verbose':_0x1a04bb[_0x230091(0x263)]}),_0x4f63ad=_0x3e5d00[_0x230091(0x1ee)];return console[_0x230091(0x2b4)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x4f63ad[_0x230091(0x2ee)]+_0x230091(0x2d2)+_0x4f63ad['id']),await handleSDKOutput([_0x4f63ad],_0x1a04bb),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2ac);['description']=a23_0x3e3b9c(0x1f0);async[a23_0x3e3b9c(0x201)](_0x3ee88f){const _0x4fe67b=a23_0x3e3b9c,{options:_0x2871ec,args:_0x599afb,tdx:_0x7ebe7a}=_0x3ee88f;console[_0x4fe67b(0x2b4)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x4fe67b(0x21b)+_0x4fe67b(0x2a8));const _0x2491cb=_0x2871ec;if(_0x599afb[_0x4fe67b(0x2c3)]===0x0)return console[_0x4fe67b(0x2b4)](a23_0xc71f68['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x4fe67b(0x2b4)](_0x4fe67b(0x2f8)),0x1;const _0x32c689=_0x599afb[0x0];_0x2491cb[_0x4fe67b(0x263)]&&(console[_0x4fe67b(0x2b4)](_0x4fe67b(0x243)+_0x2491cb[_0x4fe67b(0x23f)]),console[_0x4fe67b(0x2b4)](_0x4fe67b(0x280)+_0x32c689));const _0x32ba2b=await withSpinner(_0x4fe67b(0x2dd)+_0x32c689+_0x4fe67b(0x1d5),()=>_0x7ebe7a[_0x4fe67b(0x208)][_0x4fe67b(0x2d6)](_0x32c689),{'verbose':_0x2491cb[_0x4fe67b(0x263)]}),_0x513120=_0x32ba2b[_0x4fe67b(0x1ee)],_0x43b886=await loadJSONFromOptions(_0x2491cb[_0x4fe67b(0x295)],_0x2491cb['addAttributesFile']),_0x466d85=await loadJSONFromOptions(_0x2491cb[_0x4fe67b(0x2fd)],_0x2491cb[_0x4fe67b(0x27f)]),_0x42fb79={'name':_0x513120['name'],'description':_0x2491cb[_0x4fe67b(0x272)]!==undefined?_0x2491cb[_0x4fe67b(0x272)]:_0x513120[_0x4fe67b(0x272)],'scheduleType':_0x2491cb[_0x4fe67b(0x2d7)]!==undefined?_0x2491cb[_0x4fe67b(0x2d7)]:_0x513120['scheduleType'],'scheduleOption':_0x2491cb[_0x4fe67b(0x2a3)]!==undefined?_0x2491cb[_0x4fe67b(0x2a3)]:_0x513120[_0x4fe67b(0x2a3)],'timezone':_0x2491cb[_0x4fe67b(0x2eb)]!==undefined?_0x2491cb[_0x4fe67b(0x2eb)]:_0x513120['timezone'],'master':_0x513120[_0x4fe67b(0x28e)],'attributes':_0x43b886?[..._0x513120['attributes']||[],..._0x43b886]:_0x513120[_0x4fe67b(0x2e8)],'behaviors':_0x466d85?[..._0x513120[_0x4fe67b(0x2c8)]||[],..._0x466d85]:_0x513120[_0x4fe67b(0x2c8)],'customerGroup':_0x513120[_0x4fe67b(0x215)]},_0x433868=await withSpinner(_0x4fe67b(0x2bd)+_0x32c689+_0x4fe67b(0x1d5),()=>_0x7ebe7a['segment']['updateParent'](_0x32c689,_0x42fb79),{'verbose':_0x2491cb[_0x4fe67b(0x263)]}),_0x412863=_0x433868['data'];return console[_0x4fe67b(0x2b4)](_0x4fe67b(0x2b2)+_0x412863['name']+'\x27'),await handleSDKOutput([_0x412863],_0x2491cb),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x294);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x1d8);async[a23_0x3e3b9c(0x201)](_0x5b6ab8){const _0x23d839=a23_0x3e3b9c,{options:_0x40578a,args:_0x54a7ac,tdx:_0x309ac1}=_0x5b6ab8,_0x4c6ee6=_0x40578a,_0x1339a5=_0x54a7ac[0x0]||_0x40578a[_0x23d839(0x1ea)];if(!_0x1339a5)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x23d839(0x1f2)),0x1;if(_0x4c6ee6[_0x23d839(0x22f)]&&_0x4c6ee6[_0x23d839(0x2a6)])return console['error'](a23_0xc71f68[_0x23d839(0x22b)](_0x23d839(0x20d))),console[_0x23d839(0x2b4)](a23_0xc71f68['dim'](_0x23d839(0x2e4))),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x23d)](_0x23d839(0x27b)+PARENT_SEGMENT_DIR+_0x23d839(0x278))),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x2e7)](_0x23d839(0x25e))),0x1;const _0x17505e=_0x4c6ee6['output']||a23_0xaa4e34['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1339a5)+_0x23d839(0x2ed));_0x4c6ee6[_0x23d839(0x263)]&&(console[_0x23d839(0x2b4)](_0x23d839(0x243)+_0x4c6ee6[_0x23d839(0x23f)]),console[_0x23d839(0x2b4)]('Parent\x20segment:\x20'+_0x1339a5),console[_0x23d839(0x2b4)](_0x23d839(0x1e5)+_0x17505e));const _0xbc626e=await withSpinner(_0x23d839(0x2f3)+_0x1339a5+_0x23d839(0x1d5),()=>_0x309ac1[_0x23d839(0x208)]['pullParentYaml'](_0x1339a5),{'verbose':_0x4c6ee6[_0x23d839(0x263)]}),_0x369066=_0xbc626e['data'];if(existsSync(_0x17505e)){const _0x123843=readFileSync(_0x17505e,_0x23d839(0x1da)),_0x17dffe=generateDiff(_0x123843,_0x369066);if(!hasChanges(_0x17dffe))console['error'](a23_0xc71f68[_0x23d839(0x239)]('✔')+_0x23d839(0x204)+a23_0xc71f68[_0x23d839(0x2e7)](_0x17505e)+_0x23d839(0x28d));else{console[_0x23d839(0x2b4)](_0x23d839(0x2a7)+_0x17505e+'\x27:'),console[_0x23d839(0x2b4)]('─'[_0x23d839(0x2bb)](0x3c)),console[_0x23d839(0x2b4)](formatDiffWithColors(_0x17dffe)),console[_0x23d839(0x2b4)]('─'[_0x23d839(0x2bb)](0x3c));if(!_0x4c6ee6[_0x23d839(0x221)]){const _0x34168b=await confirmKey(_0x23d839(0x210)+_0x17505e+'\x27?');if(!_0x34168b)return console[_0x23d839(0x2b4)](_0x23d839(0x29c)),0x1;}writeFileSync(_0x17505e,_0x369066,_0x23d839(0x1da)),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x239)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0xc71f68[_0x23d839(0x2e7)](_0x17505e));}}else{const _0x562e85=a23_0xaa4e34[_0x23d839(0x273)](_0x17505e);!existsSync(_0x562e85)&&mkdirSync(_0x562e85,{'recursive':!![]}),writeFileSync(_0x17505e,_0x369066,'utf-8'),console['error'](a23_0xc71f68['green']('✔')+_0x23d839(0x2d4)+a23_0xc71f68['cyan'](_0x17505e));}return saveSessionContext({'parent_segment':_0x1339a5},_0x4c6ee6['session']),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x239)]('✔')+_0x23d839(0x1e1)+a23_0xc71f68[_0x23d839(0x23d)](_0x23d839(0x25a))+'\x20=\x20'+a23_0xc71f68[_0x23d839(0x2e7)](_0x1339a5)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a23_0x3e3b9c(0x1ff);[a23_0x3e3b9c(0x272)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x18ad02){const _0x269f25=a23_0x3e3b9c,{options:_0x5ba816,args:_0x3b8d46,tdx:_0x1eeef7}=_0x18ad02,_0x3ace56=_0x5ba816,_0x1db2ca=_0x3b8d46[0x0]||_0x5ba816[_0x269f25(0x1ea)];if(!_0x1db2ca)return showParentSegmentNotSetError(_0x269f25(0x230)+_0x269f25(0x25f)),0x1;const _0x355894=resolveYamlFile(_0x1db2ca);if(!existsSync(_0x355894))return showFileNotFoundError(_0x355894,_0x1db2ca),0x1;_0x3ace56[_0x269f25(0x263)]&&(console[_0x269f25(0x2b4)](_0x269f25(0x243)+_0x3ace56[_0x269f25(0x23f)]),console[_0x269f25(0x2b4)]('YAML\x20file:\x20'+_0x355894));let _0x3790ac;try{_0x3790ac=readFileSync(_0x355894,'utf-8');}catch(_0x23aaba){const _0x52212f=_0x23aaba instanceof Error?_0x23aaba['message']:String(_0x23aaba);return console['error'](_0x269f25(0x226)+_0x52212f),0x1;}const _0x3c20e9=await withSpinner(_0x269f25(0x242),()=>_0x1eeef7['segment'][_0x269f25(0x2a0)](_0x3790ac),{'verbose':_0x3ace56[_0x269f25(0x263)]}),_0x42af9b=_0x3c20e9[_0x269f25(0x1ee)],{isNew:_0x34fbda,name:_0x56897f,hasChanges:_0x5ba756,diffFormatted:_0x4db5d4}=_0x42af9b;if(!_0x5ba756)return console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x56897f+_0x269f25(0x250)),0x0;_0x34fbda?console[_0x269f25(0x2b4)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x56897f+'\x27:'):console[_0x269f25(0x2b4)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x56897f+'\x27:');console[_0x269f25(0x2b4)]('─'[_0x269f25(0x2bb)](0x3c)),console['error'](_0x4db5d4),console[_0x269f25(0x2b4)]('─'['repeat'](0x3c));const _0x35ff1b=_0x34fbda?'Create\x20parent\x20segment\x20\x27'+_0x56897f+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x56897f+'\x27?';if(!_0x3ace56[_0x269f25(0x221)]){const _0x1bdc98=await confirmKey(_0x35ff1b);if(!_0x1bdc98)return console[_0x269f25(0x2b4)](_0x269f25(0x29c)),0x1;}const _0x23ea0e=_0x34fbda?_0x269f25(0x2fa):_0x269f25(0x1d1),_0x45c40a=await withSpinner(_0x23ea0e+_0x269f25(0x2d0)+_0x56897f+'\x27...',()=>_0x42af9b['apply'](),{'verbose':_0x3ace56[_0x269f25(0x263)]}),_0x148fdd=_0x45c40a[_0x269f25(0x1ee)],_0x1d12df=getConsoleNextUrl(_0x3ace56[_0x269f25(0x23f)],'/app/dw/parentSegments/'+_0x148fdd['id']),_0x16903b=_0x34fbda?_0x269f25(0x276):_0x269f25(0x258);return console[_0x269f25(0x2b4)]('✔\x20'+_0x16903b+_0x269f25(0x2d0)+_0x148fdd[_0x269f25(0x2ee)]+'\x27'),console['error']('\x20\x20'+_0x1d12df),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x1e0);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2be);async['execute'](_0x1cad42){const _0x4c9e0d=a23_0x3e3b9c,{options:_0x221639,args:_0x1da81a,tdx:_0x4cd6d8}=_0x1cad42,_0x1da40e=_0x221639,_0x4376ad=_0x1da81a[0x0]||_0x221639[_0x4c9e0d(0x1ea)];if(!_0x4376ad)return showParentSegmentNotSetError(_0x4c9e0d(0x21f)+_0x4c9e0d(0x26d)+'Options:\x0a'+_0x4c9e0d(0x29e)+_0x4c9e0d(0x238)+_0x4c9e0d(0x288)),0x1;const _0x28b415=resolveYamlFile(_0x4376ad);if(!existsSync(_0x28b415))return showFileNotFoundError(_0x28b415,_0x4376ad),0x1;_0x1da40e['verbose']&&(console[_0x4c9e0d(0x2b4)](_0x4c9e0d(0x243)+_0x1da40e['site']),console[_0x4c9e0d(0x2b4)]('YAML\x20file:\x20'+_0x28b415));let _0x4b604c;try{_0x4b604c=readFileSync(_0x28b415,'utf-8');}catch(_0x42be5f){const _0x4aa5ff=_0x42be5f instanceof Error?_0x42be5f[_0x4c9e0d(0x1e2)]:String(_0x42be5f);return console[_0x4c9e0d(0x2b4)](_0x4c9e0d(0x226)+_0x4aa5ff),0x1;}const _0x59115e=createCommandSpinner(a23_0xc71f68[_0x4c9e0d(0x23d)](_0x4c9e0d(0x287)),{'verbose':_0x1da40e[_0x4c9e0d(0x263)]});_0x59115e[_0x4c9e0d(0x1d7)]();const _0x5b3bb7={'onProgress':_0x58b1cf=>{_0x59115e['text']=formatProgressMessage(_0x58b1cf);}};if(_0x1da40e['master'])_0x5b3bb7['master']=!![];if(_0x1da40e[_0x4c9e0d(0x1f7)])_0x5b3bb7[_0x4c9e0d(0x1f7)]=!![];_0x1da40e[_0x4c9e0d(0x25b)]&&(_0x5b3bb7['attribute']=_0x1da40e[_0x4c9e0d(0x25b)]);_0x1da40e[_0x4c9e0d(0x2e2)]&&(_0x5b3bb7[_0x4c9e0d(0x2e2)]=_0x1da40e[_0x4c9e0d(0x2e2)]);if(_0x1da40e[_0x4c9e0d(0x2ea)])_0x5b3bb7[_0x4c9e0d(0x2ea)]=_0x1da40e[_0x4c9e0d(0x2ea)];let _0x416019;try{_0x416019=await _0x4cd6d8['segment']['validateParentYaml'](_0x4b604c,_0x5b3bb7),_0x59115e[_0x4c9e0d(0x297)]();}catch(_0x32aba9){_0x59115e[_0x4c9e0d(0x297)]();throw _0x32aba9;}const _0x378617=_0x1da40e[_0x4c9e0d(0x2ea)]||_0x4c9e0d(0x225);return this[_0x4c9e0d(0x2f4)](_0x416019,_0x5b3bb7,_0x28b415,_0x378617),_0x416019[_0x4c9e0d(0x2b5)]?0x0:0x1;}[a23_0x3e3b9c(0x2f4)](_0x581f3e,_0x21cd76,_0x4dc1e2,_0x5acfce){const _0x4085f7=a23_0x3e3b9c;console['error']('\x0a'+a23_0xc71f68[_0x4085f7(0x23e)](_0x4085f7(0x24f))+'\x20'+_0x581f3e[_0x4085f7(0x2ee)]),console[_0x4085f7(0x2b4)]('═'[_0x4085f7(0x2bb)](0x3c)),this[_0x4085f7(0x2f1)](_0x581f3e);if(typeof _0x21cd76[_0x4085f7(0x25b)]===_0x4085f7(0x257)){this['displayAttributesStats'](_0x581f3e),this[_0x4085f7(0x1e8)](_0x581f3e),this[_0x4085f7(0x2ba)](_0x4dc1e2,_0x5acfce,_0x4085f7(0x25b),_0x21cd76['attribute']);return;}if(_0x21cd76[_0x4085f7(0x25b)]===!![]){this['displayAttributesStats'](_0x581f3e),this[_0x4085f7(0x1e8)](_0x581f3e),this['displayPreviewHints'](_0x4dc1e2,_0x5acfce,_0x4085f7(0x2e8));return;}if(typeof _0x21cd76['behavior']===_0x4085f7(0x257)){this['displayBehaviorsStats'](_0x581f3e,_0x5acfce),this[_0x4085f7(0x1e8)](_0x581f3e),this[_0x4085f7(0x2ba)](_0x4dc1e2,_0x5acfce,'behavior',_0x21cd76['behavior']);return;}if(_0x21cd76[_0x4085f7(0x2e2)]===!![]){this[_0x4085f7(0x213)](_0x581f3e,_0x5acfce),this['displaySummary'](_0x581f3e),this['displayPreviewHints'](_0x4dc1e2,_0x5acfce,_0x4085f7(0x2c8));return;}this[_0x4085f7(0x22e)](_0x581f3e),this[_0x4085f7(0x213)](_0x581f3e,_0x5acfce),this[_0x4085f7(0x1e8)](_0x581f3e),this[_0x4085f7(0x2ba)](_0x4dc1e2,_0x5acfce,_0x4085f7(0x21c));}[a23_0x3e3b9c(0x2ba)](_0x141a67,_0x4b2078,_0xc7d755,_0x41f107){const _0x27f379=a23_0x3e3b9c;console['error']('\x0a'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x202)));const _0x285a30=_0x4b2078!==_0x27f379(0x225)?_0x27f379(0x24c)+_0x4b2078:'';if(_0xc7d755==='attribute'&&_0x41f107)console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68['dim'](_0x27f379(0x1ec)+_0x141a67+'\x20--attribute\x20\x22'+_0x41f107+'\x22'+_0x285a30));else{if(_0xc7d755===_0x27f379(0x2e2)&&_0x41f107)console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68['dim'](_0x27f379(0x1ec)+_0x141a67+'\x20--behavior\x20\x22'+_0x41f107+'\x22'+_0x285a30));else(_0xc7d755===_0x27f379(0x2e8)||_0xc7d755===_0x27f379(0x21c))&&console['error']('\x20\x20'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x1ec)+_0x141a67+_0x27f379(0x27d)+_0x285a30));}(_0xc7d755===_0x27f379(0x2c8)||_0xc7d755==='all')&&console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x1ec)+_0x141a67+_0x27f379(0x1f4)+_0x285a30)),_0xc7d755==='all'&&console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x1ec)+_0x141a67+_0x27f379(0x2e9)+_0x285a30));}[a23_0x3e3b9c(0x2f1)](_0x39640b){const _0x468d18=a23_0x3e3b9c,{master:_0x581ad2}=_0x39640b,_0x55ad69=_0x581ad2[_0x468d18(0x2a2)]?a23_0xc71f68['green']('✔'):a23_0xc71f68['red']('✘');console[_0x468d18(0x2b4)]('\x0a'+a23_0xc71f68[_0x468d18(0x23d)](_0x468d18(0x268))),console[_0x468d18(0x2b4)](_0x55ad69+'\x20'+a23_0xc71f68[_0x468d18(0x23e)](_0x581ad2[_0x468d18(0x255)]+'.'+_0x581ad2[_0x468d18(0x252)])),_0x581ad2[_0x468d18(0x2a2)]?_0x581ad2[_0x468d18(0x2c5)]!==undefined&&console[_0x468d18(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x468d18(0x23d)](_0x468d18(0x1f1))+'\x20'+a23_0xc71f68[_0x468d18(0x2e7)](formatRows(_0x581ad2['rowCount']))):console['error']('\x20\x20'+a23_0xc71f68[_0x468d18(0x22b)](_0x468d18(0x282))+'\x20'+_0x581ad2['schemaError']);}['displayAttributesStats'](_0x233ce6){const _0x16c47c=a23_0x3e3b9c;if(_0x233ce6[_0x16c47c(0x2e8)]['length']===0x0)return;console[_0x16c47c(0x2b4)]('\x0a'+a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x2f6)));for(const _0x141d04 of _0x233ce6['attributes']){const _0x4906dd=_0x141d04['schemaValid']?a23_0xc71f68[_0x16c47c(0x239)]('✔'):a23_0xc71f68[_0x16c47c(0x22b)]('✘');let _0x41f884='';if(_0x141d04['schemaValid']&&_0x141d04[_0x16c47c(0x21e)]!==undefined&&_0x141d04['coveragePercent']!==undefined){const _0x103648=_0x141d04[_0x16c47c(0x1fd)][_0x16c47c(0x1d0)](0x1),_0x4fc2bd=_0x141d04[_0x16c47c(0x1fd)]>=0x50?a23_0xc71f68['green']:_0x141d04[_0x16c47c(0x1fd)]>=0x32?a23_0xc71f68[_0x16c47c(0x1d9)]:a23_0xc71f68[_0x16c47c(0x22b)];_0x41f884='\x20'+a23_0xc71f68['dim'](_0x16c47c(0x1fe))+'\x20'+_0x4fc2bd(_0x103648+'%')+'\x20('+formatRows(_0x141d04[_0x16c47c(0x21e)])+_0x16c47c(0x29f);}console[_0x16c47c(0x2b4)](_0x4906dd+'\x20'+a23_0xc71f68[_0x16c47c(0x23e)](_0x141d04[_0x16c47c(0x2ee)])+_0x41f884),console[_0x16c47c(0x2b4)]('\x20\x20'+a23_0xc71f68['dim']('Source:')+'\x20'+a23_0xc71f68['bold'](_0x141d04[_0x16c47c(0x255)]+'.'+_0x141d04[_0x16c47c(0x252)]));const _0x2c679b=_0x141d04['joinKey']===_0x141d04[_0x16c47c(0x2da)]?a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x2b0))+'\x20'+_0x141d04[_0x16c47c(0x1fa)]:a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x2af))+'\x20'+_0x141d04[_0x16c47c(0x1fa)]+_0x16c47c(0x267)+_0x141d04[_0x16c47c(0x2da)];console[_0x16c47c(0x2b4)]('\x20\x20'+_0x2c679b),console[_0x16c47c(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x1eb))),this['displayColumns'](_0x141d04[_0x16c47c(0x234)]),!_0x141d04[_0x16c47c(0x2a2)]&&console['error']('\x20\x20'+a23_0xc71f68['red'](_0x16c47c(0x282))+'\x20'+_0x141d04[_0x16c47c(0x2d3)]);}}[a23_0x3e3b9c(0x213)](_0xd979b7,_0x1b4847){const _0x37fae5=a23_0x3e3b9c;if(_0xd979b7[_0x37fae5(0x2c8)][_0x37fae5(0x2c3)]===0x0)return;console[_0x37fae5(0x2b4)]('\x0a'+a23_0xc71f68[_0x37fae5(0x23d)]('Behaviors')+'\x20'+a23_0xc71f68[_0x37fae5(0x23d)]('('+_0x1b4847+')'));for(const _0x2ce40e of _0xd979b7[_0x37fae5(0x2c8)]){const _0x31fe6a=_0x2ce40e[_0x37fae5(0x2a2)]?a23_0xc71f68[_0x37fae5(0x239)]('✔'):a23_0xc71f68[_0x37fae5(0x22b)]('✘');let _0x10066c='';if(_0x2ce40e[_0x37fae5(0x2a2)]&&_0x2ce40e[_0x37fae5(0x296)]!==undefined&&_0x2ce40e[_0x37fae5(0x244)]!==undefined){const _0x2cef55=_0x2ce40e['customerPercent']?.[_0x37fae5(0x1d0)](0x1)||'?',_0x1ae851=(_0x2ce40e['customerPercent']??0x0)>=0x32?a23_0xc71f68[_0x37fae5(0x239)]:(_0x2ce40e[_0x37fae5(0x205)]??0x0)>=0x14?a23_0xc71f68[_0x37fae5(0x1d9)]:a23_0xc71f68[_0x37fae5(0x22b)];_0x10066c='\x20'+a23_0xc71f68[_0x37fae5(0x23d)](_0x37fae5(0x1f6))+'\x20'+_0x1ae851(formatRows(_0x2ce40e[_0x37fae5(0x296)]))+'\x20('+_0x2cef55+'%)\x20'+a23_0xc71f68[_0x37fae5(0x23d)](_0x37fae5(0x2bf))+'\x20'+a23_0xc71f68[_0x37fae5(0x2e7)](formatRows(_0x2ce40e[_0x37fae5(0x244)]));}console[_0x37fae5(0x2b4)](_0x31fe6a+'\x20'+a23_0xc71f68[_0x37fae5(0x23e)](_0x2ce40e[_0x37fae5(0x2ee)])+_0x10066c),console['error']('\x20\x20'+a23_0xc71f68[_0x37fae5(0x23d)](_0x37fae5(0x24b))+'\x20'+a23_0xc71f68[_0x37fae5(0x23e)](_0x2ce40e['database']+'.'+_0x2ce40e['table']));const _0x4af74c=_0x2ce40e[_0x37fae5(0x1fa)]===_0x2ce40e[_0x37fae5(0x2da)]?a23_0xc71f68['dim'](_0x37fae5(0x2b0))+'\x20'+_0x2ce40e[_0x37fae5(0x1fa)]:a23_0xc71f68[_0x37fae5(0x23d)]('Join:')+'\x20'+_0x2ce40e['joinKey']+_0x37fae5(0x267)+_0x2ce40e[_0x37fae5(0x2da)];console[_0x37fae5(0x2b4)]('\x20\x20'+_0x4af74c),console[_0x37fae5(0x2b4)]('\x20\x20'+a23_0xc71f68['dim']('Columns:')),this[_0x37fae5(0x2d8)](_0x2ce40e['columns']),!_0x2ce40e[_0x37fae5(0x2a2)]&&console[_0x37fae5(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x37fae5(0x22b)](_0x37fae5(0x282))+'\x20'+_0x2ce40e['schemaError']);}}['displayColumns'](_0x4171b0){const _0x19aa25=a23_0x3e3b9c;for(const _0x3cd9b6 of _0x4171b0){_0x3cd9b6[_0x19aa25(0x1f5)]===_0x3cd9b6['column']||_0x3cd9b6['column']==='*'?console[_0x19aa25(0x2b4)]('\x20\x20\x20\x20-\x20'+_0x3cd9b6['label']):console[_0x19aa25(0x2b4)]('\x20\x20\x20\x20-\x20'+_0x3cd9b6[_0x19aa25(0x1f5)]+'\x20'+a23_0xc71f68[_0x19aa25(0x23d)]('('+_0x3cd9b6[_0x19aa25(0x2b8)]+')'));}}['displaySummary'](_0x5f0879){const _0x530705=a23_0x3e3b9c;console[_0x530705(0x2b4)]('─'[_0x530705(0x2bb)](0x3c));if(_0x5f0879[_0x530705(0x2a1)][_0x530705(0x2c3)]>0x0){console[_0x530705(0x2b4)]('\x0a'+a23_0xc71f68[_0x530705(0x22b)](_0x530705(0x223)));for(const _0x42e111 of _0x5f0879[_0x530705(0x2a1)]){console[_0x530705(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x530705(0x22b)]('•')+'\x20'+_0x42e111);}}_0x5f0879[_0x530705(0x2b5)]&&console[_0x530705(0x2b4)]('\x0a'+a23_0xc71f68[_0x530705(0x239)]('✔')+_0x530705(0x2b7));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x1f9);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2c4);async[a23_0x3e3b9c(0x201)](_0xfbb4f0){const _0x3bf51c=a23_0x3e3b9c,{options:_0x8e067a,args:_0x493a3c,tdx:_0x5ced95}=_0xfbb4f0,_0x5bcdf4=_0x8e067a,_0x51b591=_0x493a3c[0x0]||_0x8e067a[_0x3bf51c(0x1ea)];if(!_0x51b591)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x3bf51c(0x24a)+_0x3bf51c(0x207)+_0x3bf51c(0x266)+_0x3bf51c(0x233)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x5bcdf4[_0x3bf51c(0x28e)]&&!_0x5bcdf4[_0x3bf51c(0x25b)]&&!_0x5bcdf4['behavior']&&!_0x5bcdf4[_0x3bf51c(0x1f7)])return console['error'](a23_0xc71f68['red'](_0x3bf51c(0x245))),console['error'](_0x3bf51c(0x2ec)),console['error'](_0x3bf51c(0x26b)),console['error'](_0x3bf51c(0x2a9)),console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2aa)),console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2a4)),console['error'](_0x3bf51c(0x286)),0x1;const _0x11f9e7=resolveYamlFile(_0x51b591);if(!existsSync(_0x11f9e7))return showFileNotFoundError(_0x11f9e7,_0x51b591),0x1;_0x5bcdf4[_0x3bf51c(0x263)]&&(console[_0x3bf51c(0x2b4)](_0x3bf51c(0x243)+_0x5bcdf4[_0x3bf51c(0x23f)]),console['error'](_0x3bf51c(0x23b)+_0x11f9e7));let _0x59ad84;try{_0x59ad84=readFileSync(_0x11f9e7,_0x3bf51c(0x1da));}catch(_0xab8d71){const _0x56a278=_0xab8d71 instanceof Error?_0xab8d71[_0x3bf51c(0x1e2)]:String(_0xab8d71);return console[_0x3bf51c(0x2b4)]('Error\x20reading\x20file:\x20'+_0x56a278),0x1;}let _0x4496d8;try{_0x4496d8=parseDef(_0x59ad84);}catch(_0x462e15){const _0x57b383=_0x462e15 instanceof Error?_0x462e15[_0x3bf51c(0x1e2)]:String(_0x462e15);return console[_0x3bf51c(0x2b4)](a23_0xc71f68[_0x3bf51c(0x22b)](_0x3bf51c(0x1e4)+_0x57b383)),0x1;}if(_0x5bcdf4[_0x3bf51c(0x25b)]===!![]||_0x5bcdf4[_0x3bf51c(0x25b)]===''){const _0x4f4c58=_0x4496d8['attributes']?.[_0x3bf51c(0x224)](_0x13e03b=>_0x13e03b[_0x3bf51c(0x2ee)])||[];if(_0x4f4c58[_0x3bf51c(0x2c3)]===0x0)console['error'](a23_0xc71f68[_0x3bf51c(0x22b)](_0x3bf51c(0x227)));else{console[_0x3bf51c(0x2b4)](a23_0xc71f68[_0x3bf51c(0x22b)](_0x3bf51c(0x275))),console[_0x3bf51c(0x2b4)](_0x3bf51c(0x20b));for(const _0x3281fa of _0x4f4c58){console[_0x3bf51c(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x3bf51c(0x2e7)](_0x3281fa));}console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2f0)+_0x51b591+_0x3bf51c(0x1d4)+_0x4f4c58[0x0]+'\x22');}return 0x1;}if(_0x5bcdf4[_0x3bf51c(0x2e2)]===!![]||_0x5bcdf4['behavior']===''){const _0x4f2f3d=_0x4496d8[_0x3bf51c(0x2c8)]?.[_0x3bf51c(0x224)](_0x16369e=>_0x16369e[_0x3bf51c(0x2ee)])||[];if(_0x4f2f3d[_0x3bf51c(0x2c3)]===0x0)console['error'](a23_0xc71f68[_0x3bf51c(0x22b)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x3bf51c(0x2b4)](a23_0xc71f68['red'](_0x3bf51c(0x25d))),console['error'](_0x3bf51c(0x236));for(const _0x74669b of _0x4f2f3d){console[_0x3bf51c(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x3bf51c(0x2e7)](_0x74669b));}console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2f0)+_0x51b591+'\x20--behavior\x20\x22'+_0x4f2f3d[0x0]+'\x22');}return 0x1;}const _0x4c3170=createCommandSpinner(a23_0xc71f68[_0x3bf51c(0x23d)](_0x3bf51c(0x2ce)),{'verbose':_0x5bcdf4['verbose']});_0x4c3170['start']();const _0x370e3a={'onProgress':_0x3d838f=>{_0x4c3170['text']=formatProgressMessage(_0x3d838f);}};if(_0x5bcdf4[_0x3bf51c(0x28e)])_0x370e3a[_0x3bf51c(0x28e)]=!![];if(_0x5bcdf4['attribute']&&typeof _0x5bcdf4['attribute']===_0x3bf51c(0x257))_0x370e3a['attribute']=_0x5bcdf4[_0x3bf51c(0x25b)];if(_0x5bcdf4[_0x3bf51c(0x2e2)]&&typeof _0x5bcdf4[_0x3bf51c(0x2e2)]==='string')_0x370e3a['behavior']=_0x5bcdf4[_0x3bf51c(0x2e2)];if(_0x5bcdf4[_0x3bf51c(0x1f7)])_0x370e3a[_0x3bf51c(0x1f7)]=!![];if(_0x5bcdf4[_0x3bf51c(0x2ea)])_0x370e3a[_0x3bf51c(0x2ea)]=_0x5bcdf4[_0x3bf51c(0x2ea)];let _0x54b793;try{_0x54b793=await _0x5ced95[_0x3bf51c(0x208)]['previewParentYaml'](_0x59ad84,_0x370e3a),_0x4c3170[_0x3bf51c(0x297)]();}catch(_0x45caa1){_0x4c3170[_0x3bf51c(0x297)]();throw _0x45caa1;}return await this['displayPreviewResults'](_0x54b793,{'master':_0x5bcdf4[_0x3bf51c(0x28e)],'attribute':typeof _0x5bcdf4['attribute']===_0x3bf51c(0x257)?_0x5bcdf4['attribute']:undefined,'behavior':typeof _0x5bcdf4[_0x3bf51c(0x2e2)]===_0x3bf51c(0x257)?_0x5bcdf4[_0x3bf51c(0x2e2)]:undefined,'enriched':_0x5bcdf4['enriched']}),_0x54b793[_0x3bf51c(0x2b5)]?0x0:0x1;}async[a23_0x3e3b9c(0x219)](_0x277c62,_0x544158){const _0x366b92=a23_0x3e3b9c;console['error']('\x0a'+a23_0xc71f68[_0x366b92(0x23e)](_0x366b92(0x1dd))+'\x20'+_0x277c62['name']),console[_0x366b92(0x2b4)]('═'['repeat'](0x3c));if(_0x544158[_0x366b92(0x28e)]&&_0x277c62[_0x366b92(0x2cc)]){const _0x47f6f5=a23_0xc71f68[_0x366b92(0x23d)](_0x366b92(0x292))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x277c62[_0x366b92(0x28e)][_0x366b92(0x255)]+'.'+_0x277c62[_0x366b92(0x28e)][_0x366b92(0x252)]);await this[_0x366b92(0x2f7)](_0x47f6f5,_0x277c62[_0x366b92(0x2cc)]);}else{if(_0x544158['attribute']&&_0x277c62[_0x366b92(0x2cc)]){const _0x59b6ca=a23_0xc71f68[_0x366b92(0x23d)](_0x366b92(0x2b3))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x544158[_0x366b92(0x25b)]);await this[_0x366b92(0x2f7)](_0x59b6ca,_0x277c62[_0x366b92(0x2cc)]);}else{if(_0x544158[_0x366b92(0x2e2)]&&_0x277c62[_0x366b92(0x2cc)]){const _0x23078d=a23_0xc71f68[_0x366b92(0x23d)](_0x366b92(0x281))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x544158[_0x366b92(0x2e2)]);await this[_0x366b92(0x2f7)](_0x23078d,_0x277c62[_0x366b92(0x2cc)]);}else{if(_0x544158['enriched']&&_0x277c62[_0x366b92(0x2cc)]){const _0x57d015=a23_0xc71f68['dim'](_0x366b92(0x2e3))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x366b92(0x251));await this[_0x366b92(0x2f7)](_0x57d015,_0x277c62[_0x366b92(0x2cc)]);}else!_0x277c62[_0x366b92(0x2cc)]&&console[_0x366b92(0x2b4)](_0x366b92(0x1dc));}}}if(_0x277c62[_0x366b92(0x2a1)][_0x366b92(0x2c3)]>0x0){console[_0x366b92(0x2b4)]('─'['repeat'](0x3c)),console[_0x366b92(0x2b4)]('\x0a'+a23_0xc71f68[_0x366b92(0x22b)](_0x366b92(0x223)));for(const _0x30bf7a of _0x277c62['errors']){console[_0x366b92(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x366b92(0x22b)]('•')+'\x20'+_0x30bf7a);}}}async[a23_0x3e3b9c(0x2f7)](_0x5c2dbb,_0x378661){const _0x2174cf=a23_0x3e3b9c;if(_0x378661[_0x2174cf(0x2c3)]===0x0){console['error']('\x0a'+_0x5c2dbb),console[_0x2174cf(0x2b4)](_0x2174cf(0x2c9));return;}console[_0x2174cf(0x2b4)]('\x0a'+_0x5c2dbb);const _0x4b5a67=Object[_0x2174cf(0x1e6)](_0x378661[0x0])['map'](_0x419ef9=>({'name':_0x419ef9,'type':typeof _0x378661[0x0][_0x419ef9]===_0x2174cf(0x222)?_0x2174cf(0x2c2):_0x2174cf(0x277)})),_0xd21c21={'queryId':'preview','columns':_0x4b5a67,'data':_0x378661,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x378661[_0x2174cf(0x2c3)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x389d40=formatAsTable(_0xd21c21,_0x378661['length'],!![]);await writeOutput(_0x389d40,undefined,_0x2174cf(0x252));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a23_0x3e3b9c(0x2d9);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2f5);async[a23_0x3e3b9c(0x201)](_0x4a4ea0){const _0x281af7=a23_0x3e3b9c,{options:_0x58d08f,args:_0x5d0044,tdx:_0x285ec3}=_0x4a4ea0,_0x2066d7=_0x58d08f,_0x54a1ba=_0x5d0044[0x0]||_0x58d08f[_0x281af7(0x1ea)];if(!_0x54a1ba)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x4af1b8=resolveYamlFile(_0x54a1ba);if(existsSync(_0x4af1b8)){_0x2066d7[_0x281af7(0x263)]&&console['error'](_0x281af7(0x1d2)+_0x4af1b8);let _0x23cbe5;try{_0x23cbe5=readFileSync(_0x4af1b8,'utf-8');}catch(_0xde2f63){const _0x2df3f9=_0xde2f63 instanceof Error?_0xde2f63[_0x281af7(0x1e2)]:String(_0xde2f63);return console[_0x281af7(0x2b4)]('Error\x20reading\x20file:\x20'+_0x2df3f9),0x1;}const _0x1d1ece=await withSpinner(_0x281af7(0x242),()=>_0x285ec3[_0x281af7(0x208)][_0x281af7(0x2a0)](_0x23cbe5),{'verbose':_0x2066d7[_0x281af7(0x263)]}),_0x1d7995=_0x1d1ece['data'],{isNew:_0x3e66c2,name:_0x158889,hasChanges:_0x1bd905,diffFormatted:_0x27b6dc}=_0x1d7995;if(_0x1bd905){_0x3e66c2?console[_0x281af7(0x2b4)](_0x281af7(0x20c)+_0x158889+'\x27:'):console[_0x281af7(0x2b4)](_0x281af7(0x22d)+_0x158889+'\x27:');console[_0x281af7(0x2b4)]('─'['repeat'](0x3c)),console[_0x281af7(0x2b4)](_0x27b6dc),console['error']('─'[_0x281af7(0x2bb)](0x3c));const _0x421ee4=_0x3e66c2?'Create\x20parent\x20segment\x20\x27'+_0x158889+'\x27\x20and\x20run\x20workflow?':_0x281af7(0x24e)+_0x158889+'\x27\x20and\x20run\x20workflow?';if(!_0x2066d7[_0x281af7(0x221)]){const _0x1a649a=await confirmKey(_0x421ee4);if(!_0x1a649a)return console[_0x281af7(0x2b4)](_0x281af7(0x29c)),0x1;}const _0x1e3182=_0x3e66c2?_0x281af7(0x2fa):'Updating';await withSpinner(_0x1e3182+_0x281af7(0x2d0)+_0x158889+_0x281af7(0x1d5),()=>_0x1d7995[_0x281af7(0x285)](),{'verbose':_0x2066d7[_0x281af7(0x263)]});const _0x3a8a71=_0x3e66c2?_0x281af7(0x276):'Updated';console[_0x281af7(0x2b4)]('✔\x20'+_0x3a8a71+_0x281af7(0x2d0)+_0x158889+'\x27');}else console['error'](_0x281af7(0x2d5)+_0x158889+_0x281af7(0x290));}const _0x59a004=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x54a1ba+_0x281af7(0x1d5),()=>_0x285ec3[_0x281af7(0x208)][_0x281af7(0x2ab)](_0x54a1ba),{'verbose':_0x2066d7[_0x281af7(0x263)]}),_0x4638a6=_0x59a004[_0x281af7(0x1ee)],_0xd2d863=getConsoleUrl(_0x2066d7[_0x281af7(0x23f)],_0x281af7(0x271)+_0x4638a6['workflowId']+_0x281af7(0x2ef)+_0x4638a6[_0x281af7(0x27a)]+_0x281af7(0x1ed)+_0x4638a6['workflowAttemptId']);return console[_0x281af7(0x2b4)](_0x281af7(0x2cb)),console[_0x281af7(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x281af7(0x23d)](_0x281af7(0x1e7))+'\x20'+_0x4638a6[_0x281af7(0x2fc)]),console['error']('\x20\x20'+a23_0xc71f68['dim'](_0x281af7(0x2f9))+'\x20'+_0x4638a6['status']),console[_0x281af7(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x281af7(0x23d)]('Session:')+'\x20'+_0x4638a6[_0x281af7(0x27a)]),console[_0x281af7(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x281af7(0x23d)](_0x281af7(0x2e0))+'\x20'+_0x4638a6['workflowAttemptId']),console[_0x281af7(0x2b4)]('\x20\x20'+_0xd2d863),console[_0x281af7(0x2b4)]('\x0a'+a23_0xc71f68[_0x281af7(0x23d)](_0x281af7(0x20a))+_0x281af7(0x1df)+_0x4638a6[_0x281af7(0x2c7)]+_0x281af7(0x248)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]='segment:parent:fields';['description']=a23_0x3e3b9c(0x23c);async[a23_0x3e3b9c(0x201)](_0x3649ef){const _0x818f48=a23_0x3e3b9c,{options:_0x2b98c6,args:_0x41df14,tdx:_0xa9ed08}=_0x3649ef,_0x2b7700=_0x41df14[0x0]||_0x2b98c6[_0x818f48(0x1ea)];if(!_0x2b7700)return showParentSegmentNotSetError(_0x818f48(0x235)+_0x818f48(0x21d)),0x1;_0x2b98c6[_0x818f48(0x263)]&&(console[_0x818f48(0x2b4)]('Site:\x20'+_0x2b98c6[_0x818f48(0x23f)]),console['error'](_0x818f48(0x280)+_0x2b7700));const _0x240107=await withSpinner(_0x818f48(0x262)+_0x2b7700+'\x27...',()=>_0xa9ed08[_0x818f48(0x208)]['listFields'](_0x2b7700),{'verbose':_0x2b98c6['verbose']}),_0xbc66f1=_0x240107[_0x818f48(0x1ee)];console[_0x818f48(0x2b4)](_0x818f48(0x289)+_0xbc66f1['length']+_0x818f48(0x2a5)+(_0xbc66f1[_0x818f48(0x2c3)]!==0x1?'s':''));if(_0x2b98c6[_0x818f48(0x220)]||_0x2b98c6['jsonl'])return await handleSDKOutput(_0xbc66f1,_0x2b98c6),0x0;return displayFieldsHumanReadable(_0xbc66f1,_0x2b7700),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2fe);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x216);async[a23_0x3e3b9c(0x201)](_0x1a60bc){const _0x5422a2=a23_0x3e3b9c,{options:_0x93d62d,args:_0x35830f,tdx:_0x22700c}=_0x1a60bc,_0x5f4a89=_0x93d62d,_0x5d7a2a=_0x35830f[0x0]||_0x93d62d[_0x5422a2(0x1ea)];if(!_0x5d7a2a)return showParentSegmentNotSetError(_0x5422a2(0x228)+_0x5422a2(0x261)+_0x5422a2(0x246)+_0x5422a2(0x217)),0x1;_0x93d62d['verbose']&&(console[_0x5422a2(0x2b4)](_0x5422a2(0x243)+_0x93d62d[_0x5422a2(0x23f)]),console[_0x5422a2(0x2b4)](_0x5422a2(0x280)+_0x5d7a2a));const _0x130736=await withSpinner(_0x5422a2(0x2f3)+_0x5d7a2a+'\x27...',()=>_0x22700c[_0x5422a2(0x208)][_0x5422a2(0x2d6)](_0x5d7a2a),{'verbose':_0x93d62d[_0x5422a2(0x263)]}),_0x409279=_0x130736[_0x5422a2(0x1ee)];if(_0x5f4a89[_0x5422a2(0x293)]){const _0xf3990e=getConsoleNextUrl(_0x5f4a89[_0x5422a2(0x23f)],'/app/dw/parentSegments/'+_0x409279['id']);return console[_0x5422a2(0x2b4)](a23_0xc71f68['green']('✔')+'\x20Opening\x20'+a23_0xc71f68['cyan'](_0xf3990e)),openBrowser(_0xf3990e),0x0;}return await handleSingleObjectOutput(_0x409279,_0x93d62d),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x260);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2dc);async['execute'](_0x4d86e1){const _0x311398=a23_0x3e3b9c,{options:_0x5ab689,args:_0x22a3cd,tdx:_0x263b4b}=_0x4d86e1,_0x3142ba=_0x22a3cd[0x0]||_0x5ab689[_0x311398(0x1ea)];if(!_0x3142ba)return showParentSegmentNotSetError(_0x311398(0x1db)+_0x311398(0x28c)),0x1;_0x5ab689['verbose']&&(console[_0x311398(0x2b4)](_0x311398(0x243)+_0x5ab689[_0x311398(0x23f)]),console[_0x311398(0x2b4)](_0x311398(0x280)+_0x3142ba));const _0x3871cf=await withSpinner(_0x311398(0x283)+_0x3142ba+'\x27...',()=>_0x263b4b[_0x311398(0x208)][_0x311398(0x241)](_0x3142ba),{'verbose':_0x5ab689['verbose']}),_0x1a9243=_0x3871cf[_0x311398(0x1ee)],_0x49cd05=await withSpinner(_0x311398(0x214)+_0x3142ba+_0x311398(0x1d5),()=>_0x263b4b[_0x311398(0x208)][_0x311398(0x29b)](_0x1a9243),{'verbose':_0x5ab689['verbose']}),_0x38bcc8=await executeSchemaQuery(_0x49cd05[_0x311398(0x1ee)],_0x263b4b,_0x5ab689);return await handleQueryOutput(_0x38bcc8,_0x5ab689),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x28b);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x25c);async[a23_0x3e3b9c(0x201)](_0x47275b){const _0x2ef1f7=a23_0x3e3b9c,{options:_0x50959f,args:_0x2641bf,tdx:_0x90f30e}=_0x47275b,_0x278e26=_0x2641bf[0x0]||_0x50959f['parentSegment'];if(!_0x278e26)return showParentSegmentNotSetError(_0x2ef1f7(0x259)+'\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;_0x50959f[_0x2ef1f7(0x263)]&&(console[_0x2ef1f7(0x2b4)](_0x2ef1f7(0x243)+_0x50959f[_0x2ef1f7(0x23f)]),console['error']('Parent\x20segment:\x20'+_0x278e26));const _0x2cb0cf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x278e26+_0x2ef1f7(0x1d5),()=>_0x90f30e[_0x2ef1f7(0x208)][_0x2ef1f7(0x241)](_0x278e26),{'verbose':_0x50959f['verbose']}),_0x59a9a8=_0x2cb0cf[_0x2ef1f7(0x1ee)],_0x44c1cf=await withSpinner(_0x2ef1f7(0x214)+_0x278e26+_0x2ef1f7(0x1d5),()=>_0x90f30e[_0x2ef1f7(0x208)]['getParentSQL'](_0x59a9a8),{'verbose':_0x50959f[_0x2ef1f7(0x263)]}),_0x33fd90=_0x44c1cf[_0x2ef1f7(0x1ee)];return _0x50959f[_0x2ef1f7(0x1fc)]==='json'||_0x50959f[_0x2ef1f7(0x1fc)]===_0x2ef1f7(0x1f8)?await handleSDKOutput([{'sql':_0x33fd90}],_0x50959f):console[_0x2ef1f7(0x26e)](_0x33fd90),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2e1);[a23_0x3e3b9c(0x272)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x5bc627){const _0x42891f=a23_0x3e3b9c,{options:_0x2d0294,args:_0x36d097,tdx:_0x10af00}=_0x5bc627,_0x4cdebb=_0x36d097[0x0]||_0x2d0294['parentSegment'];if(!_0x4cdebb)return showParentSegmentNotSetError(_0x42891f(0x26c)+_0x42891f(0x22a)),0x1;_0x2d0294[_0x42891f(0x263)]&&(console[_0x42891f(0x2b4)](_0x42891f(0x243)+_0x2d0294['site']),console['error'](_0x42891f(0x280)+_0x4cdebb));const _0x382b9d=await withSpinner(_0x42891f(0x283)+_0x4cdebb+_0x42891f(0x1d5),()=>_0x10af00[_0x42891f(0x208)][_0x42891f(0x241)](_0x4cdebb),{'verbose':_0x2d0294[_0x42891f(0x263)]}),_0x23b88a=_0x382b9d['data'],_0x578754=await withSpinner(_0x42891f(0x214)+_0x4cdebb+_0x42891f(0x1d5),()=>_0x10af00['segment'][_0x42891f(0x29b)](_0x23b88a),{'verbose':_0x2d0294[_0x42891f(0x263)]});let _0x354354=_0x578754[_0x42891f(0x1ee)];const _0x4a56a3=resolveLimit(_0x2d0294[_0x42891f(0x284)],DEFAULT_DISPLAY_LIMIT),_0x1ee408=/\bLIMIT\s+\d+/i[_0x42891f(0x291)](_0x354354);!_0x1ee408&&(_0x354354=_0x354354['trim']()['replace'](/;+$/,''),_0x354354=_0x42891f(0x229)+_0x354354+_0x42891f(0x274)+_0x4a56a3);_0x2d0294[_0x42891f(0x263)]&&console[_0x42891f(0x2b4)](_0x42891f(0x20e)+_0x354354);const _0x1dc520=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x13a40d=>{const _0x58dbf2=_0x42891f,_0x52e30e=await _0x10af00[_0x58dbf2(0x2b9)][_0x58dbf2(0x201)](_0x354354,{'catalog':'td','schema':_0x58dbf2(0x206),'onJobId':_0x3c3681=>{const _0x3ce488=_0x58dbf2;_0x13a40d[_0x3ce488(0x28f)](_0x3c3681);}});return _0x52e30e;},{'verbose':_0x2d0294['verbose']}),_0x5e17a3=_0x1dc520[_0x42891f(0x1ee)],_0x48c583=_0x5e17a3[_0x42891f(0x298)]?_0x42891f(0x203)+_0x5e17a3[_0x42891f(0x298)]+']':'';return console[_0x42891f(0x2b4)](_0x42891f(0x2d1)+_0x5e17a3['stats'][_0x42891f(0x253)][_0x42891f(0x1e3)]()+_0x42891f(0x237)+(_0x42891f(0x24d)+formatElapsed(_0x5e17a3[_0x42891f(0x2db)][_0x42891f(0x2bc)])+_0x48c583)),await handleQueryOutput(_0x5e17a3,_0x2d0294),0x0;}}
@@ -1 +1 @@
1
- const a24_0x4c767c=a24_0xaf30;(function(_0x13afbf,_0x24ede1){const _0x40be76=a24_0xaf30,_0x400794=_0x13afbf();while(!![]){try{const _0x13e3fd=parseInt(_0x40be76(0x16e))/0x1*(-parseInt(_0x40be76(0x1a7))/0x2)+-parseInt(_0x40be76(0x1ac))/0x3*(parseInt(_0x40be76(0x19d))/0x4)+-parseInt(_0x40be76(0x183))/0x5+-parseInt(_0x40be76(0x141))/0x6*(-parseInt(_0x40be76(0x18c))/0x7)+-parseInt(_0x40be76(0x1ae))/0x8*(-parseInt(_0x40be76(0x169))/0x9)+-parseInt(_0x40be76(0x152))/0xa+parseInt(_0x40be76(0x151))/0xb*(parseInt(_0x40be76(0x173))/0xc);if(_0x13e3fd===_0x24ede1)break;else _0x400794['push'](_0x400794['shift']());}catch(_0x33c2c8){_0x400794['push'](_0x400794['shift']());}}}(a24_0x2f72,0xc9273));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 a24_0x2f72(){const _0x4fd0a1=['jp\x20\x20\x20-\x20Japan','ap02','description','password','customSite','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Changing\x20site\x20to\x20\x27','530328rnyYyc','profile','tdx.json','other','\x0aOperation\x20cancelled','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','toString','us01','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Site\x20was\x20not\x20changed.','\x0aSetup\x20cancelled','green','text','Enter\x20site\x20name:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','profile:remove','430617AHEKHy','16259450USRnHJ','split','eu01','\x20\x20tdx\x20--profile\x20','\x27\x20does\x20not\x20exist.','You\x20can\x20find\x20your\x20API\x20key\x20at:','session','\x20\x20(no\x20profiles\x20found)','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Session\x20profile\x20set\x20to:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','✗\x20Validation\x20failed:\x20','Site\x20name\x20cannot\x20be\x20empty','log','Create\x20a\x20new\x20profile','default','\x20API\x20key\x20is\x20valid\x20(User:\x20','parent_segment','trim','Enter\x20your\x20TD\x20API\x20key:','create','/app/mp/ak','Validating\x20API\x20key...','63pEttXW','\x0aSaved\x20to:\x20','\x27.\x0a\x0aValid\x20keys:\x20','\x20Profile\x20\x27','red','72434ncQEXm','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','getUserInfo','email','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','828GaTXmf','message','validate','\x20\x20-\x20','includes','Profile\x20\x27','Default\x20profile\x20set\x20to:\x20','eu\x20\x20\x20-\x20Europe','findIndex','site','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','error','execute','llm_agent','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','apiKey','710820uunrMg','name','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','config','dim','select','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:create','push','91RcAXAe','length','Profile\x20name\x20cannot\x20be\x20empty','warn','(session:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','Enter\x20profile\x20name:','tdx:\x20profile\x20remove','confirm','llm_project','(cleared)','\x0aAvailable\x20profiles:','VALID_KEYS','profileName','bold','join','\x27\x20updated:\x20','20Wwndvu','jobs','Set\x20a\x20profile\x20configuration\x20value','tdx:\x20profile\x20create','yellow','profile:use','profile:set','Enter\x20custom\x20site','value','Operation\x20cancelled','22tdZbpV','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','status','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','753957izIRYQ','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','908816HSqqgJ','logLevel','ERROR'];a24_0x2f72=function(){return _0x4fd0a1;};return a24_0x2f72();}import*as a24_0x590ba5 from'node:path';import{saveSessionContext,getCurrentSessionPID,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 a24_0xaf30(_0x368c0d,_0x50275e){_0x368c0d=_0x368c0d-0x141;const _0x2f721f=a24_0x2f72();let _0xaf302f=_0x2f721f[_0x368c0d];return _0xaf302f;}import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x2237cf from'prompts';import a24_0x21870b from'chalk';function validateProfileName(_0x369096){const _0x396e88=a24_0xaf30;if(!_0x369096||!_0x369096[_0x396e88(0x164)]())return _0x396e88(0x18e);const _0x55784e=_0x369096['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x55784e))return _0x396e88(0x14f);if(profileExists(_0x55784e))return _0x396e88(0x178)+_0x55784e+_0x396e88(0x1b7);return!![];}export class ProfileCreateCommand extends BaseCommand{[a24_0x4c767c(0x184)]=a24_0x4c767c(0x18a);[a24_0x4c767c(0x1b3)]=a24_0x4c767c(0x160);async[a24_0x4c767c(0x17f)](_0x362722){const _0x4cfab7=a24_0x4c767c,{options:_0x117d59,args:_0x5e102a}=_0x362722;console[_0x4cfab7(0x15f)](a24_0x21870b[_0x4cfab7(0x19a)](_0x4cfab7(0x1a0)));let _0x51de26;if(_0x5e102a[_0x4cfab7(0x18d)]>0x0&&_0x5e102a[0x0]){const _0x49714e=_0x5e102a[0x0][_0x4cfab7(0x164)](),_0x17ea73=validateProfileName(_0x49714e);if(_0x17ea73!==!![])return console[_0x4cfab7(0x17e)](a24_0x21870b[_0x4cfab7(0x16d)](_0x17ea73)),0x1;_0x51de26=_0x49714e;}else{const _0x1c7df3=await a24_0x2237cf({'type':'text','name':_0x4cfab7(0x199),'message':_0x4cfab7(0x192),'validate':validateProfileName});if(!_0x1c7df3[_0x4cfab7(0x199)])return console['log'](_0x4cfab7(0x14b)),0x1;_0x51de26=_0x1c7df3[_0x4cfab7(0x199)][_0x4cfab7(0x164)]();}const _0xfddb90=await a24_0x2237cf({'type':_0x4cfab7(0x14d),'name':_0x4cfab7(0x1b3),'message':'Enter\x20description\x20(optional):'}),_0x1c74af=_0xfddb90[_0x4cfab7(0x1b3)]?.[_0x4cfab7(0x164)]()||undefined,_0x10b8bb=_0x117d59['site']||_0x4cfab7(0x148),_0x41ff8e=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x4cfab7(0x148)},{'title':_0x4cfab7(0x1b1),'value':'jp01'},{'title':_0x4cfab7(0x17a),'value':_0x4cfab7(0x154)},{'title':'ap02\x20-\x20Korea','value':_0x4cfab7(0x1b2)}];let _0x142b79=_0x41ff8e[_0x4cfab7(0x17b)](_0xc9c2e9=>_0xc9c2e9[_0x4cfab7(0x1a5)]===_0x10b8bb);_0x142b79===-0x1&&_0x10b8bb!=='us01'&&(_0x41ff8e[_0x4cfab7(0x18b)]({'title':_0x10b8bb,'value':_0x10b8bb}),_0x142b79=_0x41ff8e[_0x4cfab7(0x18d)]-0x1);_0x41ff8e[_0x4cfab7(0x18b)]({'title':_0x4cfab7(0x1a4),'value':_0x4cfab7(0x144)});const _0x5a099d=await a24_0x2237cf({'type':_0x4cfab7(0x188),'name':_0x4cfab7(0x17c),'message':_0x4cfab7(0x181)+_0x51de26+'\x27:','choices':_0x41ff8e,'initial':_0x142b79>=0x0?_0x142b79:0x0});if(!_0x5a099d[_0x4cfab7(0x17c)])return console[_0x4cfab7(0x15f)](_0x4cfab7(0x14b)),0x1;let _0x394d76;if(_0x5a099d['site']===_0x4cfab7(0x144)){const _0x3b611d=await a24_0x2237cf({'type':_0x4cfab7(0x14d),'name':_0x4cfab7(0x1b5),'message':_0x4cfab7(0x14e),'initial':_0x4cfab7(0x148),'validate':_0x1ed493=>{const _0xcfdaa3=_0x4cfab7;if(!_0x1ed493||!_0x1ed493['trim']())return _0xcfdaa3(0x15e);if(!/^[a-z0-9-]+$/['test'](_0x1ed493[_0xcfdaa3(0x164)]()))return _0xcfdaa3(0x1ad);return!![];}});if(!_0x3b611d['customSite'])return console[_0x4cfab7(0x15f)](_0x4cfab7(0x14b)),0x1;_0x394d76=_0x3b611d[_0x4cfab7(0x1b5)];}else _0x394d76=_0x5a099d[_0x4cfab7(0x17c)];const _0x18a6b7=resolveSite(_0x394d76);console[_0x4cfab7(0x15f)](_0x4cfab7(0x149)+_0x18a6b7),console[_0x4cfab7(0x15f)](_0x4cfab7(0x157)),console[_0x4cfab7(0x15f)]('\x20\x20'+getConsoleUrl(_0x18a6b7,'/app/mp/ak'));const _0x544d4b=await a24_0x2237cf({'type':'password','name':_0x4cfab7(0x182),'message':_0x4cfab7(0x165),'validate':_0x2ed00a=>{const _0x2bf9db=_0x4cfab7;if(!_0x2ed00a||!_0x2ed00a[_0x2bf9db(0x164)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x544d4b['apiKey'])return console[_0x4cfab7(0x15f)]('\x0aSetup\x20cancelled'),0x1;const _0x69a53=_0x544d4b[_0x4cfab7(0x182)];console[_0x4cfab7(0x15f)](_0x4cfab7(0x168));try{const _0x300b98=TDX[_0x4cfab7(0x166)]({'site':_0x18a6b7,'apiKey':_0x69a53[_0x4cfab7(0x164)](),'logLevel':_0x117d59[_0x4cfab7(0x1af)]??LogLevel[_0x4cfab7(0x1b0)]}),_0x50fc83=await _0x300b98[_0x4cfab7(0x19e)][_0x4cfab7(0x170)]();console[_0x4cfab7(0x15f)](a24_0x21870b[_0x4cfab7(0x14c)]('✓')+_0x4cfab7(0x162)+_0x50fc83[_0x4cfab7(0x171)]+')');const _0x1b3045=await isKeychainAvailable();_0x1b3045?(await saveAPIKeyAsync(_0x69a53['trim'](),_0x18a6b7,_0x51de26),console[_0x4cfab7(0x15f)](a24_0x21870b['green']('✓')+_0x4cfab7(0x16f)+_0x51de26+')')):(console[_0x4cfab7(0x18f)](a24_0x21870b['yellow'](_0x4cfab7(0x189))),console[_0x4cfab7(0x18f)](a24_0x21870b['yellow'](_0x4cfab7(0x172))));const _0x1dd622={'site':_0x18a6b7,..._0x1c74af&&{'description':_0x1c74af}};return saveProfileToUserConfig(_0x51de26,_0x1dd622),console[_0x4cfab7(0x15f)](a24_0x21870b[_0x4cfab7(0x14c)]('✓')+_0x4cfab7(0x16c)+_0x51de26+'\x27\x20created'),console[_0x4cfab7(0x15f)](),console[_0x4cfab7(0x15f)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x4cfab7(0x15f)]('\x20\x20tdx\x20--profile\x20'+_0x51de26+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console['log'](_0x4cfab7(0x155)+_0x51de26+_0x4cfab7(0x1a8)),0x0;}catch(_0x3d491a){if(_0x3d491a instanceof HTTPClientError&&_0x3d491a[_0x4cfab7(0x1a9)]===0x191)return printAuthError(_0x3d491a),0x1;return console[_0x4cfab7(0x17e)](a24_0x21870b[_0x4cfab7(0x16d)](_0x4cfab7(0x15d)+(_0x3d491a instanceof Error?_0x3d491a[_0x4cfab7(0x174)]:String(_0x3d491a)))),console[_0x4cfab7(0x17e)](_0x4cfab7(0x1aa)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x4c767c(0x184)]=a24_0x4c767c(0x150);[a24_0x4c767c(0x1b3)]='Remove\x20a\x20profile';[a24_0x4c767c(0x175)](_0x515e33){const _0x3de24e=a24_0x4c767c,{args:_0x4f3d83}=_0x515e33;if(_0x4f3d83[_0x3de24e(0x18d)]===0x0)return _0x3de24e(0x146);return undefined;}async[a24_0x4c767c(0x17f)](_0x47c7d4){const _0x224ee0=a24_0x4c767c,{args:_0x5ea7b2}=_0x47c7d4,_0xfcbfb1=_0x5ea7b2[0x0];console['log'](a24_0x21870b[_0x224ee0(0x19a)](_0x224ee0(0x193)));if(!profileExists(_0xfcbfb1)){console[_0x224ee0(0x17e)](a24_0x21870b[_0x224ee0(0x16d)](_0x224ee0(0x178)+_0xfcbfb1+_0x224ee0(0x156))),console[_0x224ee0(0x15f)](_0x224ee0(0x197));const _0x4a555f=listProfiles();if(_0x4a555f[_0x224ee0(0x18d)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x3877a8 of _0x4a555f){console[_0x224ee0(0x15f)](_0x224ee0(0x176)+_0x3877a8[_0x224ee0(0x184)]);}return 0x1;}const _0x323a00=await a24_0x2237cf({'type':_0x224ee0(0x194),'name':_0x224ee0(0x194),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xfcbfb1+'\x27?','initial':![]});if(!_0x323a00[_0x224ee0(0x194)])return console[_0x224ee0(0x15f)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0xfcbfb1),console[_0x224ee0(0x15f)](a24_0x21870b[_0x224ee0(0x14c)]('✓')+_0x224ee0(0x16c)+_0xfcbfb1+'\x27\x20removed\x20from\x20configuration');}catch(_0x5c1170){return console[_0x224ee0(0x17e)](a24_0x21870b[_0x224ee0(0x16d)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x5c1170 instanceof Error?_0x5c1170['message']:String(_0x5c1170)))),0x1;}const _0x3c63de=await isKeychainAvailable();if(_0x3c63de){const _0x505977=await deleteKeychainAPIKey(_0xfcbfb1);_0x505977&&console[_0x224ee0(0x15f)](a24_0x21870b[_0x224ee0(0x14c)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x4c767c(0x184)]=a24_0x4c767c(0x1a3);[a24_0x4c767c(0x1b3)]=a24_0x4c767c(0x19f);static [a24_0x4c767c(0x198)]=[a24_0x4c767c(0x17c),'database',a24_0x4c767c(0x163),a24_0x4c767c(0x195),a24_0x4c767c(0x180),'description'];[a24_0x4c767c(0x175)](_0x2232a0){const _0xf73d5c=a24_0x4c767c,{args:_0x2fe194,options:_0x433dc3}=_0x2232a0,_0x10f3a8=_0x433dc3[_0xf73d5c(0x142)]||getActiveProfile();if(!_0x10f3a8)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x2fe194[_0xf73d5c(0x18d)]===0x0)return _0xf73d5c(0x17d)+ProfileSetCommand[_0xf73d5c(0x198)]['join'](',\x20');const _0x5f3a29=_0x2fe194[0x0];if(!_0x5f3a29[_0xf73d5c(0x177)]('='))return _0xf73d5c(0x1ab)+ProfileSetCommand['VALID_KEYS'][_0xf73d5c(0x19b)](',\x20');const [_0x2789fc]=_0x5f3a29[_0xf73d5c(0x153)]('=',0x2);if(!ProfileSetCommand[_0xf73d5c(0x198)][_0xf73d5c(0x177)](_0x2789fc))return'Unknown\x20key\x20\x27'+_0x2789fc+_0xf73d5c(0x16b)+ProfileSetCommand[_0xf73d5c(0x198)]['join'](',\x20');return undefined;}async[a24_0x4c767c(0x17f)](_0x1ba08a){const _0x24a35f=a24_0x4c767c,{args:_0x26c884,options:_0x466b08}=_0x1ba08a,_0x15f87d=_0x466b08[_0x24a35f(0x142)]||getActiveProfile(),[_0x2d098e,..._0x20de9c]=_0x26c884[0x0]['split']('='),_0x464cbe=_0x20de9c[_0x24a35f(0x19b)]('=');console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x19a)]('tdx:\x20profile\x20set'));if(!profileExists(_0x15f87d)){const _0x12863e=await a24_0x2237cf({'type':_0x24a35f(0x194),'name':_0x24a35f(0x166),'message':_0x24a35f(0x178)+_0x15f87d+_0x24a35f(0x191),'initial':!![]});if(!_0x12863e[_0x24a35f(0x166)])return console[_0x24a35f(0x15f)](_0x24a35f(0x1a6)),0x1;}const _0x24faf6=loadProfile(_0x15f87d),_0x533a57=_0x24faf6?.[_0x24a35f(0x186)]||{};if(_0x2d098e===_0x24a35f(0x17c)){const _0x1beee3=resolveSite(_0x464cbe);console[_0x24a35f(0x15f)](_0x24a35f(0x1b8)+_0x1beee3+_0x24a35f(0x1b6)),console[_0x24a35f(0x15f)](_0x24a35f(0x185)),console[_0x24a35f(0x15f)]('\x20\x20'+getConsoleUrl(_0x1beee3,_0x24a35f(0x167)));const _0x293fd4=await a24_0x2237cf({'type':_0x24a35f(0x1b4),'name':_0x24a35f(0x182),'message':_0x24a35f(0x15a),'validate':_0xd1c756=>{const _0x571a8a=_0x24a35f;if(!_0xd1c756||!_0xd1c756[_0x571a8a(0x164)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x293fd4[_0x24a35f(0x182)])return console['log'](_0x24a35f(0x145)),0x1;console[_0x24a35f(0x15f)](_0x24a35f(0x168));try{const _0x128d22=TDX['create']({'site':_0x1beee3,'apiKey':_0x293fd4['apiKey']['trim'](),'logLevel':_0x466b08[_0x24a35f(0x1af)]??LogLevel[_0x24a35f(0x1b0)]}),_0x3ce0f6=await _0x128d22[_0x24a35f(0x19e)][_0x24a35f(0x170)]();console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x14c)]('✓')+_0x24a35f(0x162)+_0x3ce0f6[_0x24a35f(0x171)]+')');const _0x20cf62=await isKeychainAvailable();_0x20cf62?(await saveAPIKeyAsync(_0x293fd4['apiKey']['trim'](),_0x1beee3,_0x15f87d),console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x14c)]('✓')+_0x24a35f(0x15c))):console[_0x24a35f(0x18f)](a24_0x21870b[_0x24a35f(0x1a1)](_0x24a35f(0x189))),_0x533a57[_0x24a35f(0x17c)]=_0x1beee3;}catch(_0x42af78){if(_0x42af78 instanceof HTTPClientError&&_0x42af78[_0x24a35f(0x1a9)]===0x191)return printAuthError(_0x42af78),0x1;return console[_0x24a35f(0x17e)](a24_0x21870b['red']('✗\x20Validation\x20failed:\x20'+(_0x42af78 instanceof Error?_0x42af78[_0x24a35f(0x174)]:String(_0x42af78)))),console[_0x24a35f(0x17e)](_0x24a35f(0x14a)),0x1;}}else _0x533a57[_0x2d098e]=_0x464cbe||undefined;return saveProfileToUserConfig(_0x15f87d,_0x533a57),console[_0x24a35f(0x15f)](a24_0x21870b[_0x24a35f(0x14c)]('✓')+_0x24a35f(0x16c)+_0x15f87d+_0x24a35f(0x19c)+_0x2d098e+'='+(_0x464cbe||_0x24a35f(0x196))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a24_0x4c767c(0x1a2);['description']='Set\x20session\x20profile';['validate'](_0x4be18d){const _0x2d0e9b=a24_0x4c767c,{args:_0x25d715}=_0x4be18d;if(_0x25d715[_0x2d0e9b(0x18d)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x4c767c(0x17f)](_0xa88516){const _0x3b9763=a24_0x4c767c,{args:_0x57d158,options:_0x56ffc3}=_0xa88516,_0x1ea61f=_0x57d158[0x0],_0x54dc09=_0x56ffc3[_0x3b9763(0x161)];cleanExpiredSessions();if(!profileExists(_0x1ea61f)){console[_0x3b9763(0x17e)](a24_0x21870b[_0x3b9763(0x16d)](_0x3b9763(0x178)+_0x1ea61f+_0x3b9763(0x156))),console[_0x3b9763(0x15f)]('\x0aAvailable\x20profiles:');const _0x3dc716=listProfiles();if(_0x3dc716[_0x3b9763(0x18d)]===0x0)console[_0x3b9763(0x15f)](_0x3b9763(0x159));else for(const _0x566059 of _0x3dc716){console[_0x3b9763(0x15f)]('\x20\x20-\x20'+_0x566059[_0x3b9763(0x184)]);}return 0x1;}if(_0x54dc09){const _0x293e1c=a24_0x590ba5[_0x3b9763(0x19b)](getConfigDir(),_0x3b9763(0x143));return saveActiveProfileToUserConfig(_0x1ea61f),console[_0x3b9763(0x15f)](_0x3b9763(0x179)+a24_0x21870b[_0x3b9763(0x14c)](_0x1ea61f)),console[_0x3b9763(0x15f)](a24_0x21870b[_0x3b9763(0x187)](_0x3b9763(0x16a)+_0x293e1c)),0x0;}const _0x3f4bcd=_0x56ffc3[_0x3b9763(0x158)]||getCurrentSessionPID()[_0x3b9763(0x147)]();return saveSessionContext({'profile':_0x1ea61f},_0x56ffc3[_0x3b9763(0x158)]),console['log'](_0x3b9763(0x15b)+a24_0x21870b[_0x3b9763(0x14c)](_0x1ea61f)+'\x20'+a24_0x21870b[_0x3b9763(0x187)](_0x3b9763(0x190)+_0x3f4bcd+')')),console[_0x3b9763(0x15f)](a24_0x21870b[_0x3b9763(0x187)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x1ea61f+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a24_0x40cbdb=a24_0x5463;(function(_0x1b76d0,_0x3665f6){const _0xadee9e=a24_0x5463,_0x1e67fe=_0x1b76d0();while(!![]){try{const _0xcc9fd9=parseInt(_0xadee9e(0x24a))/0x1*(parseInt(_0xadee9e(0x239))/0x2)+-parseInt(_0xadee9e(0x203))/0x3+parseInt(_0xadee9e(0x211))/0x4*(-parseInt(_0xadee9e(0x253))/0x5)+-parseInt(_0xadee9e(0x1f8))/0x6*(parseInt(_0xadee9e(0x1f7))/0x7)+parseInt(_0xadee9e(0x1f2))/0x8*(parseInt(_0xadee9e(0x250))/0x9)+-parseInt(_0xadee9e(0x248))/0xa*(-parseInt(_0xadee9e(0x21d))/0xb)+-parseInt(_0xadee9e(0x21f))/0xc*(-parseInt(_0xadee9e(0x228))/0xd);if(_0xcc9fd9===_0x3665f6)break;else _0x1e67fe['push'](_0x1e67fe['shift']());}catch(_0x17e115){_0x1e67fe['push'](_0x1e67fe['shift']());}}}(a24_0x4170,0x77029));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 a24_0x779409 from'node:path';function a24_0x4170(){const _0x4f69d7=['profile','bold','507330KWGBzs','\x20\x20tdx\x20--profile\x20','join','599920cyFTzy','database','Profile\x20name\x20cannot\x20be\x20empty','validate','\x0aSetup\x20cancelled','includes','Validating\x20API\x20key...','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','status','customSite','site','tdx:\x20profile\x20set','\x0aOperation\x20cancelled','apiKey','✗\x20Validation\x20failed:\x20','eu\x20\x20\x20-\x20Europe','create','config','Site\x20was\x20not\x20changed.','Failed\x20to\x20remove\x20profile:\x20','eu01','execute','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','API\x20key\x20cannot\x20be\x20empty','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','jp\x20\x20\x20-\x20Japan','Default\x20profile\x20set\x20to:\x20','length','8KlKfTN','Enter\x20your\x20TD\x20API\x20key:','\x27\x20created','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20\x20-\x20','4039NuIXoU','516vnvYgJ','trim','us01','description','VALID_KEYS','You\x20can\x20find\x20your\x20API\x20key\x20at:','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_agent','\x0aAvailable\x20profiles:','\x27\x20does\x20not\x20exist.','llm_project','2377050runxgr','warn','message','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','test','profileName','yellow','error','\x20Profile\x20\x27','profile:set','Changing\x20site\x20to\x20\x27','dim','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','text','32CKkMdk','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','select','Enter\x20profile\x20name:','Create\x20a\x20new\x20profile','Set\x20session\x20profile','split','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','default','jp01','/app/mp/ak','5203BPDdlK','name','12sDRkci','jobs','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','getUserInfo','Profile\x20\x27','ERROR','ap02','Set\x20a\x20profile\x20configuration\x20value','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','9849359kaUDbv','other','profile:use','password','Enter\x20site\x20name:','\x27.\x0a\x0aValid\x20keys:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','red','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','email','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x27\x20requires\x20API\x20key\x20validation.','value','(session:\x20','Enter\x20custom\x20site','(cleared)','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>','6xROdKX','Remove\x20a\x20profile','\x20API\x20key\x20saved\x20to\x20system\x20keychain','push','\x27\x20updated:\x20','Site\x20name\x20cannot\x20be\x20empty','findIndex','session','\x20\x20(no\x20profiles\x20found)','ap02\x20-\x20Korea','logLevel','toString','profile:remove','\x20--default\x27\x20to\x20save\x20permanently','green','18470nBhOnv','confirm','200555CNBiXM','\x27\x20removed\x20from\x20configuration','log','\x20API\x20key\x20is\x20valid\x20(User:\x20'];a24_0x4170=function(){return _0x4f69d7;};return a24_0x4170();}import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a24_0x5463(_0x599899,_0x577942){_0x599899=_0x599899-0x1e5;const _0x4170d8=a24_0x4170();let _0x5463d8=_0x4170d8[_0x599899];return _0x5463d8;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x15f9ca from'prompts';import a24_0xc6a15a from'chalk';function validateProfileName(_0x212286){const _0x5780da=a24_0x5463;if(!_0x212286||!_0x212286['trim']())return _0x5780da(0x255);const _0x493b98=_0x212286[_0x5780da(0x1f9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5780da(0x207)](_0x493b98))return _0x5780da(0x221);if(profileExists(_0x493b98))return _0x5780da(0x223)+_0x493b98+_0x5780da(0x227);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x40cbdb(0x1fb)]=a24_0x40cbdb(0x216);async['execute'](_0x362699){const _0x114069=a24_0x40cbdb,{options:_0x1b1abd,args:_0x2b92f7}=_0x362699;console['log'](a24_0xc6a15a[_0x114069(0x24f)]('tdx:\x20profile\x20create'));let _0xf5682a;if(_0x2b92f7[_0x114069(0x1f1)]>0x0&&_0x2b92f7[0x0]){const _0x472cc1=_0x2b92f7[0x0][_0x114069(0x1f9)](),_0x2e9f86=validateProfileName(_0x472cc1);if(_0x2e9f86!==!![])return console[_0x114069(0x20a)](a24_0xc6a15a['red'](_0x2e9f86)),0x1;_0xf5682a=_0x472cc1;}else{const _0x39057c=await a24_0x15f9ca({'type':_0x114069(0x210),'name':_0x114069(0x208),'message':_0x114069(0x215),'validate':validateProfileName});if(!_0x39057c['profileName'])return console['log'](_0x114069(0x257)),0x1;_0xf5682a=_0x39057c[_0x114069(0x208)][_0x114069(0x1f9)]();}const _0x3608fd=await a24_0x15f9ca({'type':_0x114069(0x210),'name':'description','message':'Enter\x20description\x20(optional):'}),_0x44f7e6=_0x3608fd[_0x114069(0x1fb)]?.['trim']()||undefined,_0x4530f1=_0x1b1abd[_0x114069(0x25d)]||_0x114069(0x1fa),_0x1452bb=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x114069(0x1fa)},{'title':_0x114069(0x1ef),'value':_0x114069(0x21b)},{'title':_0x114069(0x1e5),'value':_0x114069(0x1ea)},{'title':_0x114069(0x242),'value':_0x114069(0x225)}];let _0xf9073a=_0x1452bb[_0x114069(0x23f)](_0xde7c8b=>_0xde7c8b[_0x114069(0x234)]===_0x4530f1);_0xf9073a===-0x1&&_0x4530f1!==_0x114069(0x1fa)&&(_0x1452bb[_0x114069(0x23c)]({'title':_0x4530f1,'value':_0x4530f1}),_0xf9073a=_0x1452bb[_0x114069(0x1f1)]-0x1);_0x1452bb['push']({'title':_0x114069(0x236),'value':_0x114069(0x229)});const _0x35f49c=await a24_0x15f9ca({'type':_0x114069(0x214),'name':_0x114069(0x25d),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0xf5682a+'\x27:','choices':_0x1452bb,'initial':_0xf9073a>=0x0?_0xf9073a:0x0});if(!_0x35f49c[_0x114069(0x25d)])return console[_0x114069(0x24c)](_0x114069(0x257)),0x1;let _0x32c07d;if(_0x35f49c[_0x114069(0x25d)]===_0x114069(0x229)){const _0x34fa7e=await a24_0x15f9ca({'type':_0x114069(0x210),'name':_0x114069(0x25c),'message':_0x114069(0x22c),'initial':'us01','validate':_0x272282=>{const _0x3af165=_0x114069;if(!_0x272282||!_0x272282[_0x3af165(0x1f9)]())return _0x3af165(0x23e);if(!/^[a-z0-9-]+$/['test'](_0x272282[_0x3af165(0x1f9)]()))return _0x3af165(0x230);return!![];}});if(!_0x34fa7e[_0x114069(0x25c)])return console[_0x114069(0x24c)]('\x0aSetup\x20cancelled'),0x1;_0x32c07d=_0x34fa7e[_0x114069(0x25c)];}else _0x32c07d=_0x35f49c['site'];const _0x430553=resolveSite(_0x32c07d);console[_0x114069(0x24c)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x430553),console[_0x114069(0x24c)](_0x114069(0x1fd)),console['log']('\x20\x20'+getConsoleUrl(_0x430553,_0x114069(0x21c)));const _0x1c5a6c=await a24_0x15f9ca({'type':_0x114069(0x22b),'name':_0x114069(0x260),'message':_0x114069(0x1f3),'validate':_0x194454=>{const _0x3652f9=_0x114069;if(!_0x194454||!_0x194454[_0x3652f9(0x1f9)]())return _0x3652f9(0x1ed);return!![];}});if(!_0x1c5a6c[_0x114069(0x260)])return console[_0x114069(0x24c)]('\x0aSetup\x20cancelled'),0x1;const _0x1bdc24=_0x1c5a6c['apiKey'];console['log'](_0x114069(0x259));try{const _0x13f469=TDX['create']({'site':_0x430553,'apiKey':_0x1bdc24[_0x114069(0x1f9)](),'logLevel':_0x1b1abd[_0x114069(0x243)]??LogLevel[_0x114069(0x224)]}),_0x43f5bb=await _0x13f469[_0x114069(0x220)][_0x114069(0x222)]();console[_0x114069(0x24c)](a24_0xc6a15a['green']('✓')+_0x114069(0x24d)+_0x43f5bb['email']+')');const _0xa13994=await isKeychainAvailable();_0xa13994?(await saveAPIKeyAsync(_0x1bdc24[_0x114069(0x1f9)](),_0x430553,_0xf5682a),console[_0x114069(0x24c)](a24_0xc6a15a['green']('✓')+_0x114069(0x1f5)+_0xf5682a+')')):(console[_0x114069(0x204)](a24_0xc6a15a[_0x114069(0x209)](_0x114069(0x25a))),console[_0x114069(0x204)](a24_0xc6a15a[_0x114069(0x209)](_0x114069(0x219))));const _0x68be90={'site':_0x430553,..._0x44f7e6&&{'description':_0x44f7e6}};return saveProfileToUserConfig(_0xf5682a,_0x68be90),console[_0x114069(0x24c)](a24_0xc6a15a[_0x114069(0x247)]('✓')+'\x20Profile\x20\x27'+_0xf5682a+_0x114069(0x1f4)),console[_0x114069(0x24c)](),console[_0x114069(0x24c)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log']('\x20\x20tdx\x20--profile\x20'+_0xf5682a+_0x114069(0x212)),console[_0x114069(0x24c)](_0x114069(0x251)+_0xf5682a+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2b93d4){if(_0x2b93d4 instanceof HTTPClientError&&_0x2b93d4[_0x114069(0x25b)]===0x191)return printAuthError(_0x2b93d4),0x1;return console['error'](a24_0xc6a15a[_0x114069(0x22f)](_0x114069(0x261)+(_0x2b93d4 instanceof Error?_0x2b93d4[_0x114069(0x205)]:String(_0x2b93d4)))),console[_0x114069(0x20a)](_0x114069(0x20f)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x40cbdb(0x245);['description']=a24_0x40cbdb(0x23a);[a24_0x40cbdb(0x256)](_0xd6653b){const _0x2815e5=a24_0x40cbdb,{args:_0x481fa6}=_0xd6653b;if(_0x481fa6[_0x2815e5(0x1f1)]===0x0)return _0x2815e5(0x213);return undefined;}async[a24_0x40cbdb(0x1eb)](_0x2ca29f){const _0x174698=a24_0x40cbdb,{args:_0x5acedb}=_0x2ca29f,_0x45ea93=_0x5acedb[0x0];console[_0x174698(0x24c)](a24_0xc6a15a[_0x174698(0x24f)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x45ea93)){console[_0x174698(0x20a)](a24_0xc6a15a['red'](_0x174698(0x223)+_0x45ea93+_0x174698(0x201))),console['log'](_0x174698(0x200));const _0x4cfa78=listProfiles();if(_0x4cfa78[_0x174698(0x1f1)]===0x0)console['log'](_0x174698(0x241));else for(const _0xb5f3d3 of _0x4cfa78){console[_0x174698(0x24c)](_0x174698(0x1f6)+_0xb5f3d3['name']);}return 0x1;}const _0x131228=await a24_0x15f9ca({'type':'confirm','name':_0x174698(0x249),'message':_0x174698(0x22e)+_0x45ea93+'\x27?','initial':![]});if(!_0x131228[_0x174698(0x249)])return console[_0x174698(0x24c)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x45ea93),console[_0x174698(0x24c)](a24_0xc6a15a[_0x174698(0x247)]('✓')+_0x174698(0x20b)+_0x45ea93+_0x174698(0x24b));}catch(_0x5412ef){return console[_0x174698(0x20a)](a24_0xc6a15a[_0x174698(0x22f)](_0x174698(0x1e9)+(_0x5412ef instanceof Error?_0x5412ef[_0x174698(0x205)]:String(_0x5412ef)))),0x1;}const _0x22733f=await isKeychainAvailable();if(_0x22733f){const _0x392467=await deleteKeychainAPIKey(_0x45ea93);_0x392467&&console[_0x174698(0x24c)](a24_0xc6a15a['green']('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x40cbdb(0x21e)]=a24_0x40cbdb(0x20c);['description']=a24_0x40cbdb(0x226);static [a24_0x40cbdb(0x1fc)]=[a24_0x40cbdb(0x25d),a24_0x40cbdb(0x254),'parent_segment',a24_0x40cbdb(0x202),a24_0x40cbdb(0x1ff),'description'];[a24_0x40cbdb(0x256)](_0x5bf499){const _0xc07b8a=a24_0x40cbdb,{args:_0x26b5a6,options:_0x2df9a9}=_0x5bf499,_0x18af58=_0x2df9a9[_0xc07b8a(0x24e)]||getActiveProfile();if(!_0x18af58)return _0xc07b8a(0x238);if(_0x26b5a6[_0xc07b8a(0x1f1)]===0x0)return _0xc07b8a(0x1fe)+ProfileSetCommand[_0xc07b8a(0x1fc)][_0xc07b8a(0x252)](',\x20');const _0x2a07b9=_0x26b5a6[0x0];if(!_0x2a07b9[_0xc07b8a(0x258)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xc07b8a(0x1fc)]['join'](',\x20');const [_0x2ca15a]=_0x2a07b9['split']('=',0x2);if(!ProfileSetCommand[_0xc07b8a(0x1fc)]['includes'](_0x2ca15a))return'Unknown\x20key\x20\x27'+_0x2ca15a+_0xc07b8a(0x22d)+ProfileSetCommand[_0xc07b8a(0x1fc)]['join'](',\x20');return undefined;}async['execute'](_0x1ae3a3){const _0x4e3414=a24_0x40cbdb,{args:_0x3a90f0,options:_0x572c96}=_0x1ae3a3,_0x5289d2=_0x572c96[_0x4e3414(0x24e)]||getActiveProfile(),[_0x111533,..._0x27cbf0]=_0x3a90f0[0x0][_0x4e3414(0x218)]('='),_0x86d1e1=_0x27cbf0[_0x4e3414(0x252)]('=');console[_0x4e3414(0x24c)](a24_0xc6a15a[_0x4e3414(0x24f)](_0x4e3414(0x25e)));if(!profileExists(_0x5289d2)){const _0x5930f5=await a24_0x15f9ca({'type':'confirm','name':_0x4e3414(0x1e6),'message':_0x4e3414(0x223)+_0x5289d2+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x5930f5[_0x4e3414(0x1e6)])return console[_0x4e3414(0x24c)]('Operation\x20cancelled'),0x1;}const _0x5c5a70=loadProfile(_0x5289d2),_0x26e759=_0x5c5a70?.[_0x4e3414(0x1e7)]||{};if(_0x111533===_0x4e3414(0x25d)){const _0x23dca1=resolveSite(_0x86d1e1);console['log'](_0x4e3414(0x20d)+_0x23dca1+_0x4e3414(0x233)),console['log'](_0x4e3414(0x1ee)),console[_0x4e3414(0x24c)]('\x20\x20'+getConsoleUrl(_0x23dca1,_0x4e3414(0x21c)));const _0x55fb07=await a24_0x15f9ca({'type':_0x4e3414(0x22b),'name':_0x4e3414(0x260),'message':_0x4e3414(0x232),'validate':_0x558341=>{const _0x3ffd00=_0x4e3414;if(!_0x558341||!_0x558341['trim']())return _0x3ffd00(0x1ed);return!![];}});if(!_0x55fb07[_0x4e3414(0x260)])return console[_0x4e3414(0x24c)](_0x4e3414(0x25f)),0x1;console[_0x4e3414(0x24c)]('Validating\x20API\x20key...');try{const _0x1a26a1=TDX[_0x4e3414(0x1e6)]({'site':_0x23dca1,'apiKey':_0x55fb07[_0x4e3414(0x260)][_0x4e3414(0x1f9)](),'logLevel':_0x572c96[_0x4e3414(0x243)]??LogLevel['ERROR']}),_0x5cc4fa=await _0x1a26a1[_0x4e3414(0x220)][_0x4e3414(0x222)]();console['log'](a24_0xc6a15a[_0x4e3414(0x247)]('✓')+_0x4e3414(0x24d)+_0x5cc4fa[_0x4e3414(0x231)]+')');const _0x22b7db=await isKeychainAvailable();_0x22b7db?(await saveAPIKeyAsync(_0x55fb07['apiKey'][_0x4e3414(0x1f9)](),_0x23dca1,_0x5289d2),console[_0x4e3414(0x24c)](a24_0xc6a15a[_0x4e3414(0x247)]('✓')+_0x4e3414(0x23b))):console[_0x4e3414(0x204)](a24_0xc6a15a[_0x4e3414(0x209)](_0x4e3414(0x25a))),_0x26e759[_0x4e3414(0x25d)]=_0x23dca1;}catch(_0x1b1822){if(_0x1b1822 instanceof HTTPClientError&&_0x1b1822[_0x4e3414(0x25b)]===0x191)return printAuthError(_0x1b1822),0x1;return console[_0x4e3414(0x20a)](a24_0xc6a15a[_0x4e3414(0x22f)](_0x4e3414(0x261)+(_0x1b1822 instanceof Error?_0x1b1822[_0x4e3414(0x205)]:String(_0x1b1822)))),console[_0x4e3414(0x20a)](_0x4e3414(0x1e8)),0x1;}}else _0x26e759[_0x111533]=_0x86d1e1||undefined;return saveProfileToUserConfig(_0x5289d2,_0x26e759),console[_0x4e3414(0x24c)](a24_0xc6a15a['green']('✓')+'\x20Profile\x20\x27'+_0x5289d2+_0x4e3414(0x23d)+_0x111533+'='+(_0x86d1e1||_0x4e3414(0x237))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x40cbdb(0x21e)]=a24_0x40cbdb(0x22a);[a24_0x40cbdb(0x1fb)]=a24_0x40cbdb(0x217);['validate'](_0x5c5876){const _0x1b71ed=a24_0x40cbdb,{args:_0xafdf42}=_0x5c5876;if(_0xafdf42[_0x1b71ed(0x1f1)]===0x0)return _0x1b71ed(0x206);return undefined;}async['execute'](_0x1c7b4e){const _0x41341d=a24_0x40cbdb,{args:_0x27f1f4,options:_0x150302}=_0x1c7b4e,_0x324f=_0x27f1f4[0x0],_0x1f8d58=_0x150302[_0x41341d(0x21a)];cleanExpiredSessions();if(!profileExists(_0x324f)){console['error'](a24_0xc6a15a[_0x41341d(0x22f)](_0x41341d(0x223)+_0x324f+_0x41341d(0x201))),console[_0x41341d(0x24c)](_0x41341d(0x200));const _0x2f94a8=listProfiles();if(_0x2f94a8['length']===0x0)console[_0x41341d(0x24c)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x9af435 of _0x2f94a8){console['log'](_0x41341d(0x1f6)+_0x9af435[_0x41341d(0x21e)]);}return 0x1;}if(_0x1f8d58){const _0x4f43b1=a24_0x779409['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x324f),console[_0x41341d(0x24c)](_0x41341d(0x1f0)+a24_0xc6a15a[_0x41341d(0x247)](_0x324f)),console['log'](a24_0xc6a15a[_0x41341d(0x20e)]('\x0aSaved\x20to:\x20'+_0x4f43b1)),0x0;}const _0x341523=_0x150302[_0x41341d(0x240)]||getCurrentSessionPID()[_0x41341d(0x244)]();return saveSessionContext({'profile':_0x324f},_0x150302[_0x41341d(0x240)]),console[_0x41341d(0x24c)]('Session\x20profile\x20set\x20to:\x20'+a24_0xc6a15a[_0x41341d(0x247)](_0x324f)+'\x20'+a24_0xc6a15a[_0x41341d(0x20e)](_0x41341d(0x235)+_0x341523+')')),console[_0x41341d(0x24c)](a24_0xc6a15a[_0x41341d(0x20e)](_0x41341d(0x1ec)+_0x324f+_0x41341d(0x246))),0x0;}}
@@ -1 +1 @@
1
- function a25_0x5ba9(_0x423c60,_0x2d9b06){_0x423c60=_0x423c60-0x1a8;const _0x138804=a25_0x1388();let _0x5ba99f=_0x138804[_0x423c60];return _0x5ba99f;}const a25_0x209855=a25_0x5ba9;(function(_0x5d390a,_0x1ec3bf){const _0x305bec=a25_0x5ba9,_0x51beec=_0x5d390a();while(!![]){try{const _0x4587df=parseInt(_0x305bec(0x1be))/0x1+-parseInt(_0x305bec(0x1b8))/0x2*(parseInt(_0x305bec(0x1ad))/0x3)+parseInt(_0x305bec(0x1bb))/0x4*(parseInt(_0x305bec(0x1b0))/0x5)+parseInt(_0x305bec(0x1a8))/0x6+-parseInt(_0x305bec(0x1b6))/0x7*(-parseInt(_0x305bec(0x1ae))/0x8)+-parseInt(_0x305bec(0x1b4))/0x9+-parseInt(_0x305bec(0x1b2))/0xa;if(_0x4587df===_0x1ec3bf)break;else _0x51beec['push'](_0x51beec['shift']());}catch(_0x2374d3){_0x51beec['push'](_0x51beec['shift']());}}}(a25_0x1388,0xb2a31));function a25_0x1388(){const _0x3ddfbe=['Error:\x20','8334558RTaeFU','profiles','284732eGVBDH','map','150518hnLSyH','List\x20all\x20available\x20profiles','name','2156cVhoew','\x20\x20Global:\x20~/.config/tdx/tdx.json','length','338900fFHjcf','config','error','3051588iWUDhJ','execute','log','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','message','57gwomcj','232vcGyMt','scope','10135WMDlNo','description','319750ndajbl'];a25_0x1388=function(){return _0x3ddfbe;};return a25_0x1388();}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{[a25_0x209855(0x1ba)]=a25_0x209855(0x1b5);['description']=a25_0x209855(0x1b9);async[a25_0x209855(0x1a9)](_0x343f99){const _0x455f87=a25_0x209855,{options:_0x106771}=_0x343f99;try{const _0x3323b0=listProfiles(),_0x10837f=getActiveProfile();if(_0x3323b0[_0x455f87(0x1bd)]===0x0)return console[_0x455f87(0x1aa)](_0x455f87(0x1ab)),console[_0x455f87(0x1aa)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x455f87(0x1aa)](_0x455f87(0x1bc)),0x0;const _0x123a2f=_0x3323b0[_0x455f87(0x1b7)](_0x82cc51=>{const _0x3b2001=_0x455f87,_0x25193c=_0x82cc51[_0x3b2001(0x1ba)]===_0x10837f,_0x280d74=getProfileParams(_0x82cc51[_0x3b2001(0x1bf)]);return{'name':_0x82cc51[_0x3b2001(0x1ba)],'active':_0x25193c,'scope':_0x82cc51[_0x3b2001(0x1af)],'description':_0x82cc51['config'][_0x3b2001(0x1b1)]||'','params':_0x280d74};});return await handleSDKOutput(_0x123a2f,_0x106771),0x0;}catch(_0x7ca700){return _0x7ca700 instanceof Error&&console[_0x455f87(0x1c0)](_0x455f87(0x1b3)+_0x7ca700[_0x455f87(0x1ac)]),0x1;}}}
1
+ const a25_0x19c7e1=a25_0x35ef;function a25_0x35ef(_0x29f4e7,_0x38eb2c){_0x29f4e7=_0x29f4e7-0x118;const _0x1d17a6=a25_0x1d17();let _0x35ef9f=_0x1d17a6[_0x29f4e7];return _0x35ef9f;}(function(_0x2dfb58,_0x436ea2){const _0x3c9bad=a25_0x35ef,_0x2b7fd0=_0x2dfb58();while(!![]){try{const _0x4e1d79=parseInt(_0x3c9bad(0x118))/0x1*(-parseInt(_0x3c9bad(0x126))/0x2)+-parseInt(_0x3c9bad(0x11e))/0x3*(-parseInt(_0x3c9bad(0x11b))/0x4)+parseInt(_0x3c9bad(0x120))/0x5*(-parseInt(_0x3c9bad(0x11c))/0x6)+parseInt(_0x3c9bad(0x121))/0x7+parseInt(_0x3c9bad(0x11d))/0x8*(parseInt(_0x3c9bad(0x12c))/0x9)+parseInt(_0x3c9bad(0x12a))/0xa+-parseInt(_0x3c9bad(0x125))/0xb;if(_0x4e1d79===_0x436ea2)break;else _0x2b7fd0['push'](_0x2b7fd0['shift']());}catch(_0x5a3f99){_0x2b7fd0['push'](_0x2b7fd0['shift']());}}}(a25_0x1d17,0x4a9b1));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0x1d17(){const _0x34442a=['description','1075YICZaI','3480785iutAzZ','error','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','1052139VDFPzh','2rGyRIK','profiles','name','map','800400ykoiSS','scope','453861tDkOJN','452836eZqgeN','config','\x20\x20Global:\x20~/.config/tdx/tdx.json','963772aPGtzx','3222uWLuZf','24rOoEgn','3sMYABi'];a25_0x1d17=function(){return _0x34442a;};return a25_0x1d17();}export class ProfilesCommand extends BaseCommand{[a25_0x19c7e1(0x128)]=a25_0x19c7e1(0x127);[a25_0x19c7e1(0x11f)]='List\x20all\x20available\x20profiles';async['execute'](_0x59c058){const _0xfa0ea9=a25_0x19c7e1,{options:_0x3b752d}=_0x59c058;try{const _0x578d6c=listProfiles(),_0x176927=getActiveProfile();if(_0x578d6c['length']===0x0)return console[_0xfa0ea9(0x124)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0xfa0ea9(0x123)),console['log'](_0xfa0ea9(0x11a)),0x0;const _0x464661=_0x578d6c[_0xfa0ea9(0x129)](_0x3e4ac9=>{const _0x3a5d1f=_0xfa0ea9,_0x522bd6=_0x3e4ac9[_0x3a5d1f(0x128)]===_0x176927,_0x1603e7=getProfileParams(_0x3e4ac9[_0x3a5d1f(0x119)]);return{'name':_0x3e4ac9[_0x3a5d1f(0x128)],'active':_0x522bd6,'scope':_0x3e4ac9[_0x3a5d1f(0x12b)],'description':_0x3e4ac9[_0x3a5d1f(0x119)][_0x3a5d1f(0x11f)]||'','params':_0x1603e7};});return await handleSDKOutput(_0x464661,_0x3b752d),0x0;}catch(_0x667dd3){return _0x667dd3 instanceof Error&&console[_0xfa0ea9(0x122)]('Error:\x20'+_0x667dd3['message']),0x1;}}}
@@ -1 +1 @@
1
- const a26_0x257d7b=a26_0x112f;(function(_0x5556b4,_0x4ba17d){const _0x139641=a26_0x112f,_0x2a08b6=_0x5556b4();while(!![]){try{const _0x11a41c=-parseInt(_0x139641(0x17c))/0x1*(-parseInt(_0x139641(0x16d))/0x2)+-parseInt(_0x139641(0x176))/0x3+-parseInt(_0x139641(0x167))/0x4+-parseInt(_0x139641(0x163))/0x5*(parseInt(_0x139641(0x185))/0x6)+parseInt(_0x139641(0x182))/0x7+parseInt(_0x139641(0x186))/0x8*(-parseInt(_0x139641(0x175))/0x9)+parseInt(_0x139641(0x180))/0xa*(parseInt(_0x139641(0x17f))/0xb);if(_0x11a41c===_0x4ba17d)break;else _0x2a08b6['push'](_0x2a08b6['shift']());}catch(_0x56cd22){_0x2a08b6['push'](_0x2a08b6['shift']());}}}(a26_0x1459,0x3b2cc));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x1459(){const _0x5e991a=['Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','44691yuHnxp','originalMessage','push','11WVgVYg','6021810sUOvxA','state','2125046SMxjcw','file','name','1050306QbKJsZ','16YRiUZk','in\x20','length','Catalog:\x20','stats','information_schema','error','description','join','message','Run\x20Trino\x20queries\x20(streaming)','processedRows','setExtra','Executing\x20query...','\x20rows\x20','10TICvFW','Statement\x20','completedSplits','query','916988jUutwB','validate','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','\x20splits','...','data','2PaOLRO','jobId','setPhase','SQL:\x20','output','options','execute','catalog','41706FJHIwM','358359iUXJdM','Schema:\x20','Site:\x20','verbose','totalSplits'];a26_0x1459=function(){return _0x5e991a;};return a26_0x1459();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a26_0x112f(_0x1aa5b5,_0x2e3de5){_0x1aa5b5=_0x1aa5b5-0x15a;const _0x1459f3=a26_0x1459();let _0x112f3a=_0x1459f3[_0x1aa5b5];return _0x112f3a;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a26_0x257d7b(0x184)]=a26_0x257d7b(0x166);[a26_0x257d7b(0x15b)]=a26_0x257d7b(0x15e);async[a26_0x257d7b(0x173)](_0xad7746){const _0x5e32a0=a26_0x257d7b,{options:_0x17c92f,args:_0x502a36,tdx:_0xf58713}=_0xad7746,_0x1eeb80=_0x502a36[0x0],_0x46e4f7=_0x17c92f[_0x5e32a0(0x183)];let _0x4626b6;try{if(_0x46e4f7)_0x4626b6=readSqlStatementsFromFile(_0x46e4f7);else{if(_0x1eeb80==='-')_0x4626b6=await readSqlStatementsFromStdin();else{if(_0x1eeb80&&isSqlFilePath(_0x1eeb80))_0x4626b6=readSqlStatementsFromFile(_0x1eeb80);else{if(_0x1eeb80)_0x4626b6=splitSqlStatements(_0x1eeb80);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0xf7f0f8){return console['error']('Error:\x20'+_0xf7f0f8[_0x5e32a0(0x15d)]),0x1;}const _0x152e73=_0x17c92f['database']||_0x5e32a0(0x18b),_0x2d59c5=_0x17c92f[_0x5e32a0(0x174)];try{const _0x14f30b=[],_0x22124b=!!_0x17c92f[_0x5e32a0(0x171)];for(let _0x3ad238=0x0;_0x3ad238<_0x4626b6[_0x5e32a0(0x188)];_0x3ad238++){const _0xddcd3e=_0x4626b6[_0x3ad238],_0x5760b3=_0x3ad238+0x1,_0x1d5797=_0x4626b6[_0x5e32a0(0x188)],_0x48cd4f=_0x1d5797>0x1;_0x17c92f[_0x5e32a0(0x179)]&&(console['error']('\x0a'+(_0x48cd4f?'Statement\x20'+_0x5760b3+'/'+_0x1d5797+':':'')),console[_0x5e32a0(0x15a)](_0x5e32a0(0x178)+_0x17c92f['site']),console[_0x5e32a0(0x15a)](_0x5e32a0(0x189)+(_0x2d59c5||'td')),console[_0x5e32a0(0x15a)](_0x5e32a0(0x177)+_0x152e73),console[_0x5e32a0(0x15a)](_0x5e32a0(0x170)+_0xddcd3e));const _0x1b8cb2=_0x48cd4f?'Executing\x20statement\x20'+_0x5760b3+'/'+_0x1d5797+_0x5e32a0(0x16b):_0x5e32a0(0x161);try{const _0x2a25c3=await withProgressSpinner(_0x1b8cb2,async _0x66884d=>{const _0x5ed848=_0x5e32a0,_0x1f829d=await _0xf58713[_0x5ed848(0x166)][_0x5ed848(0x173)](_0xddcd3e,{'catalog':_0x2d59c5,'schema':_0x152e73,'onJobId':_0x510755=>{_0x66884d['setJobId'](_0x510755);},'onProgress':_0x583391=>{const _0x364b3e=_0x5ed848;_0x66884d[_0x364b3e(0x16f)]('Executing\x20query\x20['+_0x583391[_0x364b3e(0x181)]+']'),_0x66884d[_0x364b3e(0x160)](formatRows(_0x583391['processedRows'])+_0x364b3e(0x162)+_0x583391[_0x364b3e(0x165)]+'/'+_0x583391[_0x364b3e(0x17a)]+_0x364b3e(0x16a));}});return _0x1f829d;},{'verbose':_0x17c92f[_0x5e32a0(0x179)]}),_0x14e0eb=_0x2a25c3[_0x5e32a0(0x16c)],_0x2100cf=_0x14e0eb[_0x5e32a0(0x16e)]?'\x20[Job\x20ID:\x20'+_0x14e0eb[_0x5e32a0(0x16e)]+']':'',_0x1a7328=_0x48cd4f?'Statement\x20'+_0x5760b3+'/'+_0x1d5797+'\x20-\x20':'';console[_0x5e32a0(0x15a)]('✔\x20'+_0x1a7328+'Query\x20completed:\x20Processed\x20'+formatRows(_0x14e0eb[_0x5e32a0(0x18a)][_0x5e32a0(0x15f)])+_0x5e32a0(0x162)+(_0x5e32a0(0x187)+formatElapsed(_0x14e0eb[_0x5e32a0(0x18a)]['elapsedTimeMillis'])+_0x2100cf));if(_0x48cd4f&&_0x22124b){const _0x568e16=resolveOutputOptions(_0x17c92f),_0x521ce9=await formatQueryOutput(_0x14e0eb,_0x568e16);_0x14f30b[_0x5e32a0(0x17e)](_0x521ce9);}else await handleQueryOutput(_0x14e0eb,_0x17c92f);}catch(_0x108f62){const _0x520153=_0x48cd4f?_0x5e32a0(0x164)+_0x5760b3+'/'+_0x1d5797+':\x0a':'',_0x15dd13=_0x108f62 instanceof SDKError?_0x108f62[_0x5e32a0(0x17d)]:_0x108f62[_0x5e32a0(0x15d)];return console[_0x5e32a0(0x15a)](''+_0x520153+_0x15dd13),0x1;}}if(_0x4626b6[_0x5e32a0(0x188)]>0x1&&_0x22124b&&_0x14f30b[_0x5e32a0(0x188)]>0x0){const _0x5f6949=_0x14f30b[_0x5e32a0(0x15c)]('\x0a');writeFileSync(_0x17c92f[_0x5e32a0(0x171)],_0x5f6949),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x17c92f['output']);}return 0x0;}catch(_0x37f910){throw _0x37f910;}}[a26_0x257d7b(0x168)](_0x197cbf){const _0x2a6e5f=a26_0x257d7b,_0x48829d=_0x197cbf['args'][0x0],_0x3618bb=_0x197cbf[_0x2a6e5f(0x172)][_0x2a6e5f(0x183)];if(!_0x48829d&&!_0x3618bb)return _0x2a6e5f(0x169);if(_0x48829d&&_0x3618bb)return _0x2a6e5f(0x17b);return undefined;}}
1
+ const a26_0x3cc7cb=a26_0x22ff;(function(_0x521e75,_0x1937f2){const _0x35f736=a26_0x22ff,_0x3aef30=_0x521e75();while(!![]){try{const _0x9f4551=-parseInt(_0x35f736(0xb1))/0x1*(-parseInt(_0x35f736(0xb4))/0x2)+-parseInt(_0x35f736(0x98))/0x3+-parseInt(_0x35f736(0xa9))/0x4*(parseInt(_0x35f736(0xa4))/0x5)+parseInt(_0x35f736(0xbe))/0x6*(-parseInt(_0x35f736(0x9d))/0x7)+-parseInt(_0x35f736(0xbb))/0x8*(-parseInt(_0x35f736(0x9e))/0x9)+parseInt(_0x35f736(0x99))/0xa*(parseInt(_0x35f736(0xae))/0xb)+-parseInt(_0x35f736(0xbd))/0xc*(parseInt(_0x35f736(0xb9))/0xd);if(_0x9f4551===_0x1937f2)break;else _0x3aef30['push'](_0x3aef30['shift']());}catch(_0x266269){_0x3aef30['push'](_0x3aef30['shift']());}}}(a26_0x443e,0xca017));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x22ff(_0x2aa844,_0x3a5866){_0x2aa844=_0x2aa844-0x94;const _0x443e6c=a26_0x443e();let _0x22ff42=_0x443e6c[_0x2aa844];return _0x22ff42;}function a26_0x443e(){const _0xdb85f2=['Statement\x20','catalog','query','44QJjXTg','Catalog:\x20','Site:\x20','138562YzeBkH','database','setPhase','16PTgyCZ','\x20-\x20','message','completedSplits','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','16466671FoXoXY','output','8RutkSz','Executing\x20query...','12IxtKTC','18tTloaA','No\x20SQL\x20provided','processedRows','Executing\x20statement\x20','join','\x20rows\x20','originalMessage','Query\x20completed:\x20Processed\x20','execute','Executing\x20query\x20[','1553670TjkkQq','1818370xzlEuR','length','verbose','file','1637167UoEsTK','14177655IavoTN','name','stats','setJobId','site','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','945ICZgjv','Run\x20Trino\x20queries\x20(streaming)','data','setExtra','validate','2064wRTqDf','error'];a26_0x443e=function(){return _0xdb85f2;};return a26_0x443e();}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{[a26_0x3cc7cb(0x9f)]=a26_0x3cc7cb(0xad);['description']=a26_0x3cc7cb(0xa5);async['execute'](_0x52fea8){const _0x53c5fd=a26_0x3cc7cb,{options:_0x1e1683,args:_0xa9e44b,tdx:_0x1f25f6}=_0x52fea8,_0x4af38a=_0xa9e44b[0x0],_0x14886b=_0x1e1683['file'];let _0x4d0bd8;try{if(_0x14886b)_0x4d0bd8=readSqlStatementsFromFile(_0x14886b);else{if(_0x4af38a==='-')_0x4d0bd8=await readSqlStatementsFromStdin();else{if(_0x4af38a&&isSqlFilePath(_0x4af38a))_0x4d0bd8=readSqlStatementsFromFile(_0x4af38a);else{if(_0x4af38a)_0x4d0bd8=splitSqlStatements(_0x4af38a);else throw new Error(_0x53c5fd(0xbf));}}}}catch(_0x5c93b6){return console[_0x53c5fd(0xaa)]('Error:\x20'+_0x5c93b6[_0x53c5fd(0xb6)]),0x1;}const _0x2ef55d=_0x1e1683[_0x53c5fd(0xb2)]||'information_schema',_0xedccd1=_0x1e1683[_0x53c5fd(0xac)];try{const _0x1f6736=[],_0x331531=!!_0x1e1683['output'];for(let _0x4a3332=0x0;_0x4a3332<_0x4d0bd8['length'];_0x4a3332++){const _0x343971=_0x4d0bd8[_0x4a3332],_0x588612=_0x4a3332+0x1,_0x7ffbc6=_0x4d0bd8[_0x53c5fd(0x9a)],_0x16dc06=_0x7ffbc6>0x1;_0x1e1683[_0x53c5fd(0x9b)]&&(console[_0x53c5fd(0xaa)]('\x0a'+(_0x16dc06?_0x53c5fd(0xab)+_0x588612+'/'+_0x7ffbc6+':':'')),console[_0x53c5fd(0xaa)](_0x53c5fd(0xb0)+_0x1e1683[_0x53c5fd(0xa2)]),console[_0x53c5fd(0xaa)](_0x53c5fd(0xaf)+(_0xedccd1||'td')),console[_0x53c5fd(0xaa)]('Schema:\x20'+_0x2ef55d),console[_0x53c5fd(0xaa)]('SQL:\x20'+_0x343971));const _0x11e17c=_0x16dc06?_0x53c5fd(0xc1)+_0x588612+'/'+_0x7ffbc6+'...':_0x53c5fd(0xbc);try{const _0x33769c=await withProgressSpinner(_0x11e17c,async _0x2de4d7=>{const _0x5a94dc=_0x53c5fd,_0x46a8fb=await _0x1f25f6[_0x5a94dc(0xad)][_0x5a94dc(0x96)](_0x343971,{'catalog':_0xedccd1,'schema':_0x2ef55d,'onJobId':_0x37ed7c=>{const _0x3bb4c5=_0x5a94dc;_0x2de4d7[_0x3bb4c5(0xa1)](_0x37ed7c);},'onProgress':_0x2b9f90=>{const _0x27f7a2=_0x5a94dc;_0x2de4d7[_0x27f7a2(0xb3)](_0x27f7a2(0x97)+_0x2b9f90['state']+']'),_0x2de4d7[_0x27f7a2(0xa7)](formatRows(_0x2b9f90[_0x27f7a2(0xc0)])+'\x20rows\x20'+_0x2b9f90[_0x27f7a2(0xb7)]+'/'+_0x2b9f90['totalSplits']+'\x20splits');}});return _0x46a8fb;},{'verbose':_0x1e1683['verbose']}),_0x572f9e=_0x33769c[_0x53c5fd(0xa6)],_0x302080=_0x572f9e['jobId']?'\x20[Job\x20ID:\x20'+_0x572f9e['jobId']+']':'',_0x1c32b6=_0x16dc06?'Statement\x20'+_0x588612+'/'+_0x7ffbc6+_0x53c5fd(0xb5):'';console[_0x53c5fd(0xaa)]('✔\x20'+_0x1c32b6+_0x53c5fd(0x95)+formatRows(_0x572f9e[_0x53c5fd(0xa0)][_0x53c5fd(0xc0)])+_0x53c5fd(0xc3)+('in\x20'+formatElapsed(_0x572f9e[_0x53c5fd(0xa0)]['elapsedTimeMillis'])+_0x302080));if(_0x16dc06&&_0x331531){const _0x598c85=resolveOutputOptions(_0x1e1683),_0x1d2926=await formatQueryOutput(_0x572f9e,_0x598c85);_0x1f6736['push'](_0x1d2926);}else await handleQueryOutput(_0x572f9e,_0x1e1683);}catch(_0x289846){const _0x4a5187=_0x16dc06?'Statement\x20'+_0x588612+'/'+_0x7ffbc6+':\x0a':'',_0x41ead1=_0x289846 instanceof SDKError?_0x289846[_0x53c5fd(0x94)]:_0x289846[_0x53c5fd(0xb6)];return console[_0x53c5fd(0xaa)](''+_0x4a5187+_0x41ead1),0x1;}}if(_0x4d0bd8[_0x53c5fd(0x9a)]>0x1&&_0x331531&&_0x1f6736[_0x53c5fd(0x9a)]>0x0){const _0x4ee5a2=_0x1f6736[_0x53c5fd(0xc2)]('\x0a');writeFileSync(_0x1e1683[_0x53c5fd(0xba)],_0x4ee5a2),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x1e1683[_0x53c5fd(0xba)]);}return 0x0;}catch(_0x4fa341){throw _0x4fa341;}}[a26_0x3cc7cb(0xa8)](_0x4d3c30){const _0xbf5224=a26_0x3cc7cb,_0x1d4cc0=_0x4d3c30['args'][0x0],_0x34cf46=_0x4d3c30['options'][_0xbf5224(0x9c)];if(!_0x1d4cc0&&!_0x34cf46)return _0xbf5224(0xb8);if(_0x1d4cc0&&_0x34cf46)return _0xbf5224(0xa3);return undefined;}}