@treasuredata/tdx 2026.3.6 → 2026.3.7

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 (201) 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/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profile-command.js +1 -1
  34. package/dist/commands/profiles-command.js +1 -1
  35. package/dist/commands/query-command.js +1 -1
  36. package/dist/commands/schedule-command.js +1 -1
  37. package/dist/commands/segment-command.js +1 -1
  38. package/dist/commands/segment-create-command.js +1 -1
  39. package/dist/commands/segment-fields-command.js +1 -1
  40. package/dist/commands/segment-pull-command.js +1 -1
  41. package/dist/commands/segment-push-command.js +1 -1
  42. package/dist/commands/segment-update-command.js +1 -1
  43. package/dist/commands/segment-use-command.js +1 -1
  44. package/dist/commands/segment-validate-command.js +1 -1
  45. package/dist/commands/segments.js +1 -1
  46. package/dist/commands/show.js +1 -1
  47. package/dist/commands/status-command.js +1 -1
  48. package/dist/commands/tables.js +1 -1
  49. package/dist/commands/unset-command.js +1 -1
  50. package/dist/commands/upgrade-command.js +1 -1
  51. package/dist/commands/use-command.js +1 -1
  52. package/dist/commands/user-command.js +1 -1
  53. package/dist/commands/workflow-command.js +1 -1
  54. package/dist/core/auth.js +1 -1
  55. package/dist/core/command-output.js +1 -1
  56. package/dist/core/config.js +1 -1
  57. package/dist/core/connection-cache.js +1 -1
  58. package/dist/core/constants.js +1 -1
  59. package/dist/core/credential-cache.js +1 -1
  60. package/dist/core/global-context.js +1 -1
  61. package/dist/core/keychain.js +1 -1
  62. package/dist/core/oauth-keychain.js +1 -1
  63. package/dist/core/oauth.js +1 -1
  64. package/dist/core/profile.js +1 -1
  65. package/dist/core/project-config.js +1 -1
  66. package/dist/core/session.js +1 -1
  67. package/dist/core/user-cache.js +1 -1
  68. package/dist/core/version.js +1 -1
  69. package/dist/index.js +1 -1
  70. package/dist/mcp/server.js +1 -1
  71. package/dist/mcp/tools/index.js +1 -1
  72. package/dist/mcp/tools/tdx-run.js +1 -1
  73. package/dist/mcp/tools/tdx-search.js +1 -1
  74. package/dist/mcp/utils.js +1 -1
  75. package/dist/proxy/claude-usage-tracker.js +1 -1
  76. package/dist/proxy/passthrough-server.js +1 -1
  77. package/dist/proxy/sse-usage-parser.js +1 -1
  78. package/dist/sdk/agent/agent-config.js +1 -1
  79. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  80. package/dist/sdk/agent/agent-yaml.js +1 -1
  81. package/dist/sdk/agent/test/evaluator.js +1 -1
  82. package/dist/sdk/agent/test/executor.js +1 -1
  83. package/dist/sdk/agent/test/index.js +1 -1
  84. package/dist/sdk/agent/test/output.js +1 -1
  85. package/dist/sdk/agent/test/parser.js +1 -1
  86. package/dist/sdk/agent/tool-target-registry.js +1 -1
  87. package/dist/sdk/api.js +1 -1
  88. package/dist/sdk/client/cdp-api-client.js +1 -1
  89. package/dist/sdk/client/delivery-api-client.js +1 -1
  90. package/dist/sdk/client/endpoints.js +1 -1
  91. package/dist/sdk/client/engage-api-client.js +1 -1
  92. package/dist/sdk/client/http-client.js +1 -1
  93. package/dist/sdk/client/llm-api-client.js +1 -1
  94. package/dist/sdk/client/oauth-refresh.js +1 -1
  95. package/dist/sdk/client/rate-limiter.js +1 -1
  96. package/dist/sdk/client/td-api-client.js +1 -1
  97. package/dist/sdk/client/trino-api-client.js +1 -1
  98. package/dist/sdk/client/workflow-client.js +1 -1
  99. package/dist/sdk/connection-validator.js +1 -1
  100. package/dist/sdk/connection.js +1 -1
  101. package/dist/sdk/delivery.js +1 -1
  102. package/dist/sdk/engage/campaign-pull.js +1 -1
  103. package/dist/sdk/engage/campaign-push.js +1 -1
  104. package/dist/sdk/engage/campaign-validator.js +1 -1
  105. package/dist/sdk/engage/campaign-yaml.js +1 -1
  106. package/dist/sdk/engage/template-pull.js +1 -1
  107. package/dist/sdk/engage/template-push.js +1 -1
  108. package/dist/sdk/engage/template-validator.js +1 -1
  109. package/dist/sdk/engage/template-yaml.js +1 -1
  110. package/dist/sdk/engage/types/campaign-def.js +1 -1
  111. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  112. package/dist/sdk/engage/types/template-schema.js +1 -1
  113. package/dist/sdk/engage.js +1 -1
  114. package/dist/sdk/errors.js +1 -1
  115. package/dist/sdk/index.js +1 -1
  116. package/dist/sdk/io/index.js +1 -1
  117. package/dist/sdk/io/node-filesystem.js +1 -1
  118. package/dist/sdk/job.js +1 -1
  119. package/dist/sdk/journey.js +1 -1
  120. package/dist/sdk/llm/chat-cache.js +1 -1
  121. package/dist/sdk/llm/index.js +1 -1
  122. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  123. package/dist/sdk/llm/model-factors.js +1 -1
  124. package/dist/sdk/personalization.js +1 -1
  125. package/dist/sdk/query/index.js +1 -1
  126. package/dist/sdk/query/sql-parser.js +1 -1
  127. package/dist/sdk/realtime.js +1 -1
  128. package/dist/sdk/schedule.js +1 -1
  129. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  130. package/dist/sdk/segment/fields-display.js +1 -1
  131. package/dist/sdk/segment/file-discovery.js +1 -1
  132. package/dist/sdk/segment/journey-utils.js +1 -1
  133. package/dist/sdk/segment/journey-validator.js +1 -1
  134. package/dist/sdk/segment/journey-yaml.js +1 -1
  135. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  136. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  137. package/dist/sdk/segment/pull-workflow.js +1 -1
  138. package/dist/sdk/segment/push-recovery.js +1 -1
  139. package/dist/sdk/segment/push-workflow.js +1 -1
  140. package/dist/sdk/segment/resolution-context.js +1 -1
  141. package/dist/sdk/segment/segment-path-parser.js +1 -1
  142. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  143. package/dist/sdk/segment/segment-validator.js +1 -1
  144. package/dist/sdk/segment/target-resolution.js +1 -1
  145. package/dist/sdk/segment/tdx-config.js +1 -1
  146. package/dist/sdk/segment/types/activation-schema.js +1 -1
  147. package/dist/sdk/segment/types/journey-def.js +1 -1
  148. package/dist/sdk/segment/types/journey-schema.js +1 -1
  149. package/dist/sdk/segment/types/segment-def.js +1 -1
  150. package/dist/sdk/segment/types/segment-schema.js +1 -1
  151. package/dist/sdk/segment/validate-files.js +1 -1
  152. package/dist/sdk/segment/yaml-validator.js +1 -1
  153. package/dist/sdk/segment.js +1 -1
  154. package/dist/sdk/types/index.js +1 -1
  155. package/dist/sdk/types/progress.js +1 -1
  156. package/dist/sdk/user.js +1 -1
  157. package/dist/sdk/util/format-detector.js +1 -1
  158. package/dist/sdk/util/formatters.js +1 -1
  159. package/dist/sdk/util/index.js +1 -1
  160. package/dist/sdk/util/paginate.js +1 -1
  161. package/dist/sdk/util/tree-formatter.js +1 -1
  162. package/dist/sdk/workflow/archive-validation.js +1 -1
  163. package/dist/sdk/workflow/clone-workflow.js +1 -1
  164. package/dist/sdk/workflow/index.js +1 -1
  165. package/dist/sdk/workflow/pull-workflow.js +1 -1
  166. package/dist/sdk/workflow/push-workflow.js +1 -1
  167. package/dist/sdk/workflow/tdx-config.js +1 -1
  168. package/dist/sdk/workflow/workflow-utils.js +1 -1
  169. package/dist/test-utils/command-runner.js +1 -1
  170. package/dist/test-utils/factories.js +1 -1
  171. package/dist/test-utils/fixtures.js +1 -1
  172. package/dist/test-utils/http-mock.js +1 -1
  173. package/dist/test-utils/index.js +1 -1
  174. package/dist/utils/async.js +1 -1
  175. package/dist/utils/colors.js +1 -1
  176. package/dist/utils/diff.js +1 -1
  177. package/dist/utils/file-permissions.js +1 -1
  178. package/dist/utils/file-reader.js +1 -1
  179. package/dist/utils/github-releases.js +1 -1
  180. package/dist/utils/global-cache.js +1 -1
  181. package/dist/utils/json-loader.js +1 -1
  182. package/dist/utils/local-cache.js +1 -1
  183. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  184. package/dist/utils/logger/formatters/index.js +1 -1
  185. package/dist/utils/logger/handlers/console-handler.js +1 -1
  186. package/dist/utils/logger/handlers/file-handler.js +1 -1
  187. package/dist/utils/logger/handlers/index.js +1 -1
  188. package/dist/utils/logger/handlers/null-handler.js +1 -1
  189. package/dist/utils/logger/index.js +1 -1
  190. package/dist/utils/logger/logger.js +1 -1
  191. package/dist/utils/logger/types.js +1 -1
  192. package/dist/utils/option-validation.js +1 -1
  193. package/dist/utils/process.js +1 -1
  194. package/dist/utils/prompt.js +1 -1
  195. package/dist/utils/spinner.js +1 -1
  196. package/dist/utils/sse-parser.js +1 -1
  197. package/dist/utils/string-utils.js +1 -1
  198. package/dist/utils/table-ref-parser.js +1 -1
  199. package/dist/utils/tdx-logger.js +1 -1
  200. package/dist/utils/version-check.js +1 -1
  201. package/package.json +1 -1
@@ -1 +1 @@
1
- const a30_0x445dab=a30_0xecef;(function(_0x23ea9c,_0x45b993){const _0x4876a0=a30_0xecef,_0x3584de=_0x23ea9c();while(!![]){try{const _0x4d2f94=parseInt(_0x4876a0(0x2b6))/0x1*(parseInt(_0x4876a0(0x22a))/0x2)+parseInt(_0x4876a0(0x333))/0x3*(-parseInt(_0x4876a0(0x1c6))/0x4)+-parseInt(_0x4876a0(0x2fc))/0x5*(-parseInt(_0x4876a0(0x28c))/0x6)+-parseInt(_0x4876a0(0x2bc))/0x7+parseInt(_0x4876a0(0x20f))/0x8*(parseInt(_0x4876a0(0x1de))/0x9)+parseInt(_0x4876a0(0x230))/0xa*(parseInt(_0x4876a0(0x209))/0xb)+parseInt(_0x4876a0(0x1da))/0xc*(-parseInt(_0x4876a0(0x1bf))/0xd);if(_0x4d2f94===_0x45b993)break;else _0x3584de['push'](_0x3584de['shift']());}catch(_0x51fd87){_0x3584de['push'](_0x3584de['shift']());}}}(a30_0x26e3,0x3883b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0xf68ad0 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x367bf6 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='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a30_0x445dab(0x220);function openBrowser(_0x1dd742){const _0x33196d=a30_0x445dab,_0x377471=process[_0x33196d(0x26f)],_0x5c5a80=_0x377471===_0x33196d(0x2a0)?_0x33196d(0x27e):_0x377471===_0x33196d(0x233)?_0x33196d(0x2b9):_0x33196d(0x2d9);spawn(_0x5c5a80,[_0x1dd742],{'detached':!![],'stdio':_0x33196d(0x211)})['unref']();}function migrateLegacyDirectory(){const _0xc154e9=a30_0x445dab;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2a2b09=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2a2b09[_0xc154e9(0x2ae)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0xc154e9(0x31a)](a30_0x367bf6['yellow'](_0xc154e9(0x1cf)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0xc154e9(0x242))),console[_0xc154e9(0x31a)](a30_0x367bf6[_0xc154e9(0x27c)](_0xc154e9(0x2cc)+LEGACY_PARENT_SEGMENT_DIR+_0xc154e9(0x20e))),![];console[_0xc154e9(0x31a)](a30_0x367bf6[_0xc154e9(0x2a1)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x367bf6[_0xc154e9(0x335)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4d08c7){const _0x10f2c0=_0x4d08c7 instanceof Error?_0x4d08c7['message']:String(_0x4d08c7);return console[_0xc154e9(0x31a)](a30_0x367bf6[_0xc154e9(0x251)](_0xc154e9(0x25f)+_0x10f2c0+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x445dab(0x30c)](_0xdc4fa0){return migrateLegacyDirectory(),super['run'](_0xdc4fa0);}}function resolveYamlFile(_0xdbcdd2){const _0x1e71a6=a30_0x445dab;if(_0xdbcdd2[_0x1e71a6(0x241)]('.yml')||_0xdbcdd2[_0x1e71a6(0x241)]('.yaml'))return _0xdbcdd2;return a30_0xf68ad0[_0x1e71a6(0x1f4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xdbcdd2)+_0x1e71a6(0x1eb));}function formatProgressMessage(_0x302f10){const _0x348395=a30_0x445dab,_0x497df0=_0x302f10[_0x348395(0x213)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x497df0){const [,_0x4f6c55,_0x200d47,_0x2f8905='']=_0x497df0;return a30_0x367bf6[_0x348395(0x27c)](_0x4f6c55+':')+'\x20'+_0x200d47+a30_0x367bf6[_0x348395(0x27c)](_0x2f8905);}return a30_0x367bf6[_0x348395(0x27c)](_0x302f10);}function showFileNotFoundError(_0x29b4ef,_0x1e5015){const _0x3b2a3a=a30_0x445dab;console[_0x3b2a3a(0x31a)](a30_0x367bf6[_0x3b2a3a(0x251)](_0x3b2a3a(0x1e0)+_0x29b4ef+'\x0a')),console[_0x3b2a3a(0x31a)](a30_0x367bf6[_0x3b2a3a(0x28b)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x1e5015+_0x3b2a3a(0x205)));}function displayRealtimeValidation(_0x4744f0){const _0x53aef6=a30_0x445dab;if(!_0x4744f0[_0x53aef6(0x2fa)])return;const _0x29971a=_0x4744f0[_0x53aef6(0x2fa)],_0x59cc70=_0x29971a[_0x53aef6(0x2d8)]?a30_0x367bf6['green']('⚡\x20Enabled'):a30_0x367bf6[_0x53aef6(0x2a1)](_0x53aef6(0x32b));console[_0x53aef6(0x31a)]('\x0a'+a30_0x367bf6[_0x53aef6(0x27c)](_0x53aef6(0x256))+'\x20'+_0x59cc70);if(_0x29971a['events']&&_0x29971a['events']['length']>0x0){console[_0x53aef6(0x31a)]('\x20\x20'+a30_0x367bf6[_0x53aef6(0x27c)](_0x53aef6(0x30b))+'\x20'+_0x29971a[_0x53aef6(0x31b)]['length']+'\x20configured');for(const _0x11bfaa of _0x29971a[_0x53aef6(0x31b)]){const _0x236336=_0x11bfaa[_0x53aef6(0x1ec)]===![]?a30_0x367bf6['red']('✘'):a30_0x367bf6[_0x53aef6(0x335)]('✔');console[_0x53aef6(0x31a)](_0x53aef6(0x262)+_0x236336+'\x20'+_0x11bfaa['name']),_0x11bfaa[_0x53aef6(0x210)]&&console[_0x53aef6(0x31a)]('\x20\x20\x20\x20\x20\x20'+a30_0x367bf6['red'](_0x11bfaa[_0x53aef6(0x210)]));}}if(_0x29971a[_0x53aef6(0x1c4)]&&_0x29971a['attributes']['length']>0x0){console[_0x53aef6(0x31a)]('\x20\x20'+a30_0x367bf6[_0x53aef6(0x27c)](_0x53aef6(0x1e9))+'\x20'+_0x29971a[_0x53aef6(0x1c4)][_0x53aef6(0x24b)]+_0x53aef6(0x319));for(const _0x223f8c of _0x29971a[_0x53aef6(0x1c4)]){const _0xef79dd=_0x223f8c[_0x53aef6(0x1ba)]?a30_0x367bf6[_0x53aef6(0x335)]('✔'):a30_0x367bf6[_0x53aef6(0x251)]('✘');console['error']('\x20\x20\x20\x20'+_0xef79dd+'\x20'+_0x223f8c[_0x53aef6(0x2e5)]+'\x20'+a30_0x367bf6[_0x53aef6(0x27c)]('('+_0x223f8c[_0x53aef6(0x283)]+')'));}}if(_0x29971a[_0x53aef6(0x313)]){const _0x1e3a2c=_0x29971a['idStitching'][_0x53aef6(0x26d)]?.[_0x53aef6(0x24b)]?_0x53aef6(0x1c9)+_0x29971a['idStitching'][_0x53aef6(0x26d)][_0x53aef6(0x1f4)](',\x20')+']':'';console[_0x53aef6(0x31a)]('\x20\x20'+a30_0x367bf6[_0x53aef6(0x27c)]('ID\x20Stitching:')+'\x20'+_0x29971a['idStitching'][_0x53aef6(0x24d)]+_0x1e3a2c);}if(_0x29971a[_0x53aef6(0x232)]&&_0x29971a[_0x53aef6(0x232)]['length']>0x0){console[_0x53aef6(0x31a)]('\x20\x20'+a30_0x367bf6['dim'](_0x53aef6(0x28e))+'\x20'+_0x29971a['personalizationServices'][_0x53aef6(0x24b)]+_0x53aef6(0x282)+(_0x29971a[_0x53aef6(0x232)][_0x53aef6(0x24b)]!==0x1?'s':''));for(const _0x4ba7fb of _0x29971a['personalizationServices']){console[_0x53aef6(0x31a)](_0x53aef6(0x238)+_0x4ba7fb[_0x53aef6(0x2e5)]);}}}function showParentSegmentNotSetError(_0xabe5db){const _0x3ae387=a30_0x445dab;console[_0x3ae387(0x31a)](a30_0x367bf6[_0x3ae387(0x2a1)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x3ae387(0x31a)](_0xabe5db);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x2df);['description']=a30_0x445dab(0x261);async[a30_0x445dab(0x305)](_0x1fbd02){const _0x22d674=a30_0x445dab,{options:_0xe515a3,args:_0x3e85ae,tdx:_0x1b7c66}=_0x1fbd02,_0x1452c8=_0x3e85ae[0x0];_0xe515a3[_0x22d674(0x2eb)]&&(console[_0x22d674(0x31a)](_0x22d674(0x1f7)+_0xe515a3[_0x22d674(0x243)]),_0x1452c8&&console['error'](_0x22d674(0x21c)+_0x1452c8));const _0x30e5a1=await withSpinner(_0x1452c8?_0x22d674(0x322)+_0x1452c8+_0x22d674(0x2c6):'Listing\x20parent\x20segments...',()=>_0x1b7c66[_0x22d674(0x2b3)][_0x22d674(0x21a)](),{'verbose':_0xe515a3[_0x22d674(0x2eb)]});let _0x24b6de=_0x30e5a1['data'];if(_0x1452c8){const _0x23777f=_0x1452c8['replace'](/[.+^${}()|[\]\\]/g,_0x22d674(0x254))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4fe0b8=new RegExp('^'+_0x23777f+'$','i');_0x24b6de=_0x24b6de[_0x22d674(0x263)](_0x8b2fa0=>_0x4fe0b8[_0x22d674(0x269)](_0x8b2fa0['attributes']['name']));}_0x24b6de[_0x22d674(0x2f4)]((_0x632d1e,_0x14fe04)=>_0x632d1e[_0x22d674(0x1c4)][_0x22d674(0x2e5)][_0x22d674(0x325)](_0x14fe04[_0x22d674(0x1c4)][_0x22d674(0x2e5)])),console[_0x22d674(0x31a)](_0x22d674(0x1fd)+_0x24b6de[_0x22d674(0x24b)]+'\x20parent\x20segment'+(_0x24b6de[_0x22d674(0x24b)]!==0x1?'s':''));const _0x40a6a0=_0x42a353=>{const _0x40e2cb=_0x22d674;return getConsoleNextUrl(_0xe515a3['site'],_0x40e2cb(0x2bb)+_0x42a353);};if(_0xe515a3[_0x22d674(0x1df)]===_0x22d674(0x303)||_0xe515a3[_0x22d674(0x1df)]===_0x22d674(0x1bb)){const _0x543993=_0x24b6de['map'](_0x471405=>({..._0x471405,'url':_0x40a6a0(_0x471405['id'])}));await handleSDKOutput(_0x543993,_0xe515a3);}else{if(_0x24b6de[_0x22d674(0x24b)]===0x0)_0x1452c8?console[_0x22d674(0x2a2)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x1452c8):console[_0x22d674(0x2a2)](_0x22d674(0x212));else for(const _0x4dbcc0 of _0x24b6de){const _0x2e58a2=_0x4dbcc0['attributes'][_0x22d674(0x30a)]?a30_0x367bf6[_0x22d674(0x27c)]('\x20('+formatRows(_0x4dbcc0[_0x22d674(0x1c4)]['population'])+')'):'',_0x1c7179=hyperlink(_0x4dbcc0[_0x22d674(0x1c4)][_0x22d674(0x2e5)],_0x40a6a0(_0x4dbcc0['id']));console['log'](_0x22d674(0x26b)+_0x1c7179+_0x2e58a2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x2b5);[a30_0x445dab(0x2c9)]=a30_0x445dab(0x26a);async[a30_0x445dab(0x305)](_0x2d35de){const _0x1c5fa2=a30_0x445dab,{options:_0x29bb7e,args:_0x2a9e34,tdx:_0x511b72}=_0x2d35de;console['error'](_0x1c5fa2(0x332)+_0x1c5fa2(0x320)+_0x1c5fa2(0x1f0));const _0x3d71a9=_0x29bb7e;if(_0x2a9e34[_0x1c5fa2(0x24b)]===0x0)return console[_0x1c5fa2(0x31a)](a30_0x367bf6['red'](_0x1c5fa2(0x1c5))),console[_0x1c5fa2(0x31a)](_0x1c5fa2(0x2e4)),0x1;const _0x3d8a86=_0x2a9e34[0x0];if(!_0x3d71a9['database']||!_0x3d71a9[_0x1c5fa2(0x1be)])return console[_0x1c5fa2(0x31a)](_0x1c5fa2(0x311)),console[_0x1c5fa2(0x31a)](_0x1c5fa2(0x2e4)),0x1;_0x3d71a9[_0x1c5fa2(0x2eb)]&&(console[_0x1c5fa2(0x31a)](_0x1c5fa2(0x1f7)+_0x3d71a9[_0x1c5fa2(0x243)]),console[_0x1c5fa2(0x31a)](_0x1c5fa2(0x275)+_0x3d8a86),console['error'](_0x1c5fa2(0x2ce)+_0x3d71a9['database']),console['error'](_0x1c5fa2(0x30d)+_0x3d71a9[_0x1c5fa2(0x1be)]));const _0x378f22=await loadJSONFromOptions(_0x3d71a9[_0x1c5fa2(0x1c4)],_0x3d71a9[_0x1c5fa2(0x1f3)]),_0x25c0eb=await loadJSONFromOptions(_0x3d71a9['behaviors'],_0x3d71a9[_0x1c5fa2(0x27b)]),_0x273dc2=await loadJSONFromOptions(_0x3d71a9['customerGroup'],_0x3d71a9[_0x1c5fa2(0x2ca)]),_0x2b1696={'name':_0x3d8a86,'description':_0x3d71a9['description'],'scheduleType':_0x3d71a9[_0x1c5fa2(0x277)],'scheduleOption':_0x3d71a9[_0x1c5fa2(0x246)],'timezone':_0x3d71a9['timezone'],'master':{'parentDatabaseName':_0x3d71a9[_0x1c5fa2(0x1f2)],'parentTableName':_0x3d71a9[_0x1c5fa2(0x1be)]},'attributes':_0x378f22,'behaviors':_0x25c0eb,'customerGroup':_0x273dc2},_0x1635b5=await withSpinner(_0x1c5fa2(0x21e)+_0x3d8a86+_0x1c5fa2(0x2c6),()=>_0x511b72[_0x1c5fa2(0x2b3)][_0x1c5fa2(0x27d)](_0x2b1696),{'verbose':_0x29bb7e['verbose']}),_0x239914=_0x1635b5['data'];return console[_0x1c5fa2(0x31a)](_0x1c5fa2(0x20a)+_0x239914[_0x1c5fa2(0x2e5)]+_0x1c5fa2(0x1c1)+_0x239914['id']),await handleSDKOutput([_0x239914],_0x29bb7e),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a30_0x445dab(0x1f1);['description']=a30_0x445dab(0x310);async[a30_0x445dab(0x305)](_0x1062ea){const _0x112d49=a30_0x445dab,{options:_0x17b3da,args:_0x55c9c2,tdx:_0x48310b}=_0x1062ea;console['error'](_0x112d49(0x2f6)+_0x112d49(0x320)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x2fcd3b=_0x17b3da;if(_0x55c9c2[_0x112d49(0x24b)]===0x0)return console[_0x112d49(0x31a)](a30_0x367bf6[_0x112d49(0x251)](_0x112d49(0x1c5))),console[_0x112d49(0x31a)](_0x112d49(0x258)),0x1;const _0x1a1486=_0x55c9c2[0x0];_0x2fcd3b['verbose']&&(console[_0x112d49(0x31a)](_0x112d49(0x1f7)+_0x2fcd3b[_0x112d49(0x243)]),console[_0x112d49(0x31a)]('Parent\x20segment:\x20'+_0x1a1486));const _0x4959e2=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x1a1486+'\x27...',()=>_0x48310b[_0x112d49(0x2b3)][_0x112d49(0x2cf)](_0x1a1486),{'verbose':_0x2fcd3b[_0x112d49(0x2eb)]}),_0x3d784f=_0x4959e2[_0x112d49(0x2a7)],_0x51cf86=await loadJSONFromOptions(_0x2fcd3b[_0x112d49(0x31e)],_0x2fcd3b[_0x112d49(0x1c7)]),_0x412855=await loadJSONFromOptions(_0x2fcd3b[_0x112d49(0x2c0)],_0x2fcd3b[_0x112d49(0x22d)]),_0x544f84={'name':_0x3d784f[_0x112d49(0x2e5)],'description':_0x2fcd3b[_0x112d49(0x2c9)]!==undefined?_0x2fcd3b[_0x112d49(0x2c9)]:_0x3d784f[_0x112d49(0x2c9)],'scheduleType':_0x2fcd3b[_0x112d49(0x277)]!==undefined?_0x2fcd3b[_0x112d49(0x277)]:_0x3d784f['scheduleType'],'scheduleOption':_0x2fcd3b[_0x112d49(0x246)]!==undefined?_0x2fcd3b[_0x112d49(0x246)]:_0x3d784f[_0x112d49(0x246)],'timezone':_0x2fcd3b[_0x112d49(0x1af)]!==undefined?_0x2fcd3b['timezone']:_0x3d784f[_0x112d49(0x1af)],'master':_0x3d784f[_0x112d49(0x1db)],'attributes':_0x51cf86?[..._0x3d784f['attributes']||[],..._0x51cf86]:_0x3d784f['attributes'],'behaviors':_0x412855?[..._0x3d784f['behaviors']||[],..._0x412855]:_0x3d784f[_0x112d49(0x304)],'customerGroup':_0x3d784f[_0x112d49(0x28d)]},_0x31def0=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x1a1486+_0x112d49(0x2c6),()=>_0x48310b[_0x112d49(0x2b3)][_0x112d49(0x290)](_0x1a1486,_0x544f84),{'verbose':_0x2fcd3b[_0x112d49(0x2eb)]}),_0x49b559=_0x31def0[_0x112d49(0x2a7)];return console[_0x112d49(0x31a)](_0x112d49(0x22c)+_0x49b559[_0x112d49(0x2e5)]+'\x27'),await handleSDKOutput([_0x49b559],_0x2fcd3b),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x250);['description']=a30_0x445dab(0x29a);async['execute'](_0x555a8d){const _0xfa819f=a30_0x445dab,{options:_0x5a285b,args:_0x1dcfc8,tdx:_0x56555c}=_0x555a8d,_0x9e8b4d=_0x5a285b,_0xd06390=_0x1dcfc8[0x0]||_0x5a285b[_0xfa819f(0x1c2)];if(!_0xd06390)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'+_0xfa819f(0x2c4)),0x1;if(_0x9e8b4d['use']&&_0x9e8b4d[_0xfa819f(0x23a)])return console[_0xfa819f(0x31a)](a30_0x367bf6['red'](_0xfa819f(0x2dd))),console[_0xfa819f(0x31a)](a30_0x367bf6['dim'](_0xfa819f(0x2fe))),console[_0xfa819f(0x31a)](a30_0x367bf6[_0xfa819f(0x27c)](_0xfa819f(0x32f)+PARENT_SEGMENT_DIR+_0xfa819f(0x2db))),console[_0xfa819f(0x31a)](a30_0x367bf6[_0xfa819f(0x28b)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x163fad=_0x9e8b4d['output']||a30_0xf68ad0[_0xfa819f(0x1f4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd06390)+_0xfa819f(0x1eb));_0x9e8b4d[_0xfa819f(0x2eb)]&&(console['error'](_0xfa819f(0x1f7)+_0x9e8b4d[_0xfa819f(0x243)]),console[_0xfa819f(0x31a)](_0xfa819f(0x265)+_0xd06390),console[_0xfa819f(0x31a)]('Output\x20file:\x20'+_0x163fad));const _0x74b1b9=await withSpinner(_0xfa819f(0x1e7)+_0xd06390+_0xfa819f(0x2c6),()=>_0x56555c[_0xfa819f(0x2b3)][_0xfa819f(0x1d2)](_0xd06390),{'verbose':_0x9e8b4d['verbose']}),_0x557663=_0x74b1b9[_0xfa819f(0x2a7)];if(existsSync(_0x163fad)){const _0x2c958c=readFileSync(_0x163fad,_0xfa819f(0x22b)),_0x935b81=generateDiff(_0x2c958c,_0x557663);if(!hasChanges(_0x935b81))console['error'](a30_0x367bf6[_0xfa819f(0x335)]('✔')+_0xfa819f(0x308)+a30_0x367bf6[_0xfa819f(0x28b)](_0x163fad)+_0xfa819f(0x280));else{console[_0xfa819f(0x31a)](_0xfa819f(0x2b0)+_0x163fad+'\x27:'),console[_0xfa819f(0x31a)]('─'['repeat'](0x3c)),console[_0xfa819f(0x31a)](formatDiffWithColors(_0x935b81)),console[_0xfa819f(0x31a)]('─'['repeat'](0x3c));if(!_0x9e8b4d[_0xfa819f(0x2ee)]){if(!isInteractive())return console['error'](a30_0x367bf6[_0xfa819f(0x251)](_0xfa819f(0x21f)),_0xfa819f(0x2b4)),console[_0xfa819f(0x31a)](a30_0x367bf6['dim'](_0xfa819f(0x2a8))),0x1;const _0x54cf32=await confirmKey(_0xfa819f(0x1e3)+_0x163fad+'\x27?');if(!_0x54cf32)return console[_0xfa819f(0x31a)](a30_0x367bf6[_0xfa819f(0x2a1)]('Aborted.')),0x1;}writeFileSync(_0x163fad,_0x557663,'utf-8'),console[_0xfa819f(0x31a)](a30_0x367bf6['green']('✔')+_0xfa819f(0x259)+a30_0x367bf6[_0xfa819f(0x28b)](_0x163fad));}}else{const _0x2b3f6e=a30_0xf68ad0[_0xfa819f(0x202)](_0x163fad);!existsSync(_0x2b3f6e)&&mkdirSync(_0x2b3f6e,{'recursive':!![]}),writeFileSync(_0x163fad,_0x557663,_0xfa819f(0x22b)),console[_0xfa819f(0x31a)](a30_0x367bf6[_0xfa819f(0x335)]('✔')+_0xfa819f(0x259)+a30_0x367bf6[_0xfa819f(0x28b)](_0x163fad));}return saveSessionContext({'parent_segment':_0xd06390},_0x9e8b4d[_0xfa819f(0x1b6)]),console['error'](a30_0x367bf6['green']('✔')+_0xfa819f(0x299)+a30_0x367bf6[_0xfa819f(0x27c)](_0xfa819f(0x220))+_0xfa819f(0x281)+a30_0x367bf6['cyan'](_0xd06390)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a30_0x445dab(0x1b7);['description']=a30_0x445dab(0x1fb);async[a30_0x445dab(0x305)](_0x448f70){const _0x243a9e=a30_0x445dab,{options:_0x49d3d8,args:_0x37ca40,tdx:_0x5e6ecb}=_0x448f70,_0x407e8a=_0x49d3d8,_0x551c92=_0x37ca40[0x0]||_0x49d3d8[_0x243a9e(0x1c2)];if(!_0x551c92)return showParentSegmentNotSetError(_0x243a9e(0x1d0)+_0x243a9e(0x248)),0x1;const _0x67369=resolveYamlFile(_0x551c92);if(!existsSync(_0x67369))return showFileNotFoundError(_0x67369,_0x551c92),0x1;_0x407e8a[_0x243a9e(0x2eb)]&&(console[_0x243a9e(0x31a)](_0x243a9e(0x1f7)+_0x407e8a[_0x243a9e(0x243)]),console[_0x243a9e(0x31a)]('YAML\x20file:\x20'+_0x67369));let _0xc53923;try{_0xc53923=readFileSync(_0x67369,'utf-8');}catch(_0x18639f){const _0x432c59=_0x18639f instanceof Error?_0x18639f[_0x243a9e(0x24a)]:String(_0x18639f);return console[_0x243a9e(0x31a)]('Error\x20reading\x20file:\x20'+_0x432c59),0x1;}const _0x36723d=await withSpinner(_0x243a9e(0x24e),()=>_0x5e6ecb['segment'][_0x243a9e(0x312)](_0xc53923),{'verbose':_0x407e8a[_0x243a9e(0x2eb)]}),_0x2163fb=_0x36723d[_0x243a9e(0x2a7)],{isNew:_0x54c9b1,name:_0x297fcf,hasChanges:_0x4b6dad,diffFormatted:_0x5a7401}=_0x2163fb;if(!_0x4b6dad)return console[_0x243a9e(0x31a)](_0x243a9e(0x1ed)+_0x297fcf+_0x243a9e(0x228)),0x0;_0x54c9b1?console[_0x243a9e(0x31a)](_0x243a9e(0x20d)+_0x297fcf+'\x27:'):console['error'](_0x243a9e(0x1e6)+_0x297fcf+'\x27:');console[_0x243a9e(0x31a)]('─'[_0x243a9e(0x2a6)](0x3c)),console[_0x243a9e(0x31a)](_0x5a7401),console[_0x243a9e(0x31a)]('─'[_0x243a9e(0x2a6)](0x3c));const _0x47887f=_0x54c9b1?_0x243a9e(0x2c5)+_0x297fcf+'\x27?':_0x243a9e(0x2b7)+_0x297fcf+'\x27?';if(!_0x407e8a['yes']){if(!isInteractive())return console[_0x243a9e(0x31a)](a30_0x367bf6[_0x243a9e(0x251)]('\x0aError:'),_0x243a9e(0x2b4)),console['error'](a30_0x367bf6['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x4f7e52=await confirmKey(_0x47887f);if(!_0x4f7e52)return console[_0x243a9e(0x31a)](a30_0x367bf6[_0x243a9e(0x2a1)]('Aborted.')),0x1;}const _0x5ca61e=_0x54c9b1?_0x243a9e(0x289):_0x243a9e(0x1ff),_0x18500c=await withSpinner(_0x5ca61e+_0x243a9e(0x31d)+_0x297fcf+'\x27...',()=>_0x2163fb[_0x243a9e(0x2be)](),{'verbose':_0x407e8a['verbose']}),_0x4b0988=_0x18500c[_0x243a9e(0x2a7)],_0x56e388=getConsoleNextUrl(_0x407e8a[_0x243a9e(0x243)],'/app/dw/parentSegments/'+_0x4b0988['id']),_0x1483e1=_0x54c9b1?'Created':_0x243a9e(0x1b5);return console[_0x243a9e(0x31a)]('✔\x20'+_0x1483e1+_0x243a9e(0x31d)+_0x4b0988[_0x243a9e(0x2e5)]+'\x27'),console[_0x243a9e(0x31a)]('\x20\x20'+_0x56e388),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a30_0x445dab(0x207);['description']=a30_0x445dab(0x234);async[a30_0x445dab(0x305)](_0x118670){const _0x1afe83=a30_0x445dab,{options:_0x12659a,args:_0x143d4b,tdx:_0x511cbc}=_0x118670,_0x4b5c7f=_0x12659a,_0x52ea73=_0x143d4b[0x0]||_0x12659a['parentSegment'];if(!_0x52ea73)return showParentSegmentNotSetError(_0x1afe83(0x239)+_0x1afe83(0x1ce)+'Options:\x0a'+_0x1afe83(0x2a4)+_0x1afe83(0x2ff)+_0x1afe83(0x274)),0x1;const _0x5ccfad=resolveYamlFile(_0x52ea73);if(!existsSync(_0x5ccfad))return showFileNotFoundError(_0x5ccfad,_0x52ea73),0x1;_0x4b5c7f['verbose']&&(console[_0x1afe83(0x31a)]('Site:\x20'+_0x4b5c7f[_0x1afe83(0x243)]),console[_0x1afe83(0x31a)]('YAML\x20file:\x20'+_0x5ccfad));let _0x461131;try{_0x461131=readFileSync(_0x5ccfad,_0x1afe83(0x22b));}catch(_0x27f206){const _0x1cba24=_0x27f206 instanceof Error?_0x27f206[_0x1afe83(0x24a)]:String(_0x27f206);return console[_0x1afe83(0x31a)](_0x1afe83(0x32e)+_0x1cba24),0x1;}const _0x2d34f0=createCommandSpinner(a30_0x367bf6[_0x1afe83(0x27c)](_0x1afe83(0x2e9)),{'verbose':_0x4b5c7f['verbose']});_0x2d34f0['start']();const _0x4249eb={'onProgress':_0x149187=>{const _0xcbc386=_0x1afe83;_0x2d34f0[_0xcbc386(0x2ac)]=formatProgressMessage(_0x149187);}};if(_0x4b5c7f[_0x1afe83(0x1db)])_0x4249eb[_0x1afe83(0x1db)]=!![];if(_0x4b5c7f[_0x1afe83(0x21d)])_0x4249eb[_0x1afe83(0x21d)]=!![];_0x4b5c7f[_0x1afe83(0x22e)]&&(_0x4249eb[_0x1afe83(0x22e)]=_0x4b5c7f['attribute']);_0x4b5c7f[_0x1afe83(0x25b)]&&(_0x4249eb[_0x1afe83(0x25b)]=_0x4b5c7f[_0x1afe83(0x25b)]);if(_0x4b5c7f[_0x1afe83(0x1ea)])_0x4249eb[_0x1afe83(0x1ea)]=_0x4b5c7f['interval'];let _0x37a22d;try{_0x37a22d=await _0x511cbc[_0x1afe83(0x2b3)][_0x1afe83(0x26c)](_0x461131,_0x4249eb),_0x2d34f0[_0x1afe83(0x268)]();}catch(_0x2e5468){_0x2d34f0[_0x1afe83(0x268)]();throw _0x2e5468;}const _0x5256aa=_0x4b5c7f[_0x1afe83(0x1ea)]||'-1d';return this[_0x1afe83(0x2cd)](_0x37a22d,_0x4249eb,_0x5ccfad,_0x5256aa),_0x37a22d['allValid']?0x0:0x1;}[a30_0x445dab(0x2cd)](_0x3086da,_0x1fc05f,_0x2f6eda,_0x12f86d){const _0x3679b1=a30_0x445dab;console['error']('\x0a'+a30_0x367bf6[_0x3679b1(0x31f)]('Validate:')+'\x20'+_0x3086da['name']),console[_0x3679b1(0x31a)]('═'[_0x3679b1(0x2a6)](0x3c)),this[_0x3679b1(0x297)](_0x3086da);if(typeof _0x1fc05f[_0x3679b1(0x22e)]===_0x3679b1(0x1cb)){this[_0x3679b1(0x25e)](_0x3086da),this[_0x3679b1(0x23d)](_0x3086da),this[_0x3679b1(0x1b8)](_0x2f6eda,_0x12f86d,'attribute',_0x1fc05f[_0x3679b1(0x22e)]);return;}if(_0x1fc05f[_0x3679b1(0x22e)]===!![]){this[_0x3679b1(0x25e)](_0x3086da),this['displaySummary'](_0x3086da),this[_0x3679b1(0x1b8)](_0x2f6eda,_0x12f86d,'attributes');return;}if(typeof _0x1fc05f[_0x3679b1(0x25b)]==='string'){this[_0x3679b1(0x2af)](_0x3086da,_0x12f86d),this[_0x3679b1(0x23d)](_0x3086da),this[_0x3679b1(0x1b8)](_0x2f6eda,_0x12f86d,'behavior',_0x1fc05f[_0x3679b1(0x25b)]);return;}if(_0x1fc05f[_0x3679b1(0x25b)]===!![]){this[_0x3679b1(0x2af)](_0x3086da,_0x12f86d),this[_0x3679b1(0x23d)](_0x3086da),this[_0x3679b1(0x1b8)](_0x2f6eda,_0x12f86d,_0x3679b1(0x304));return;}this[_0x3679b1(0x25e)](_0x3086da),this[_0x3679b1(0x2af)](_0x3086da,_0x12f86d),this[_0x3679b1(0x1ac)](_0x3086da),this[_0x3679b1(0x23d)](_0x3086da),this[_0x3679b1(0x1b8)](_0x2f6eda,_0x12f86d,_0x3679b1(0x273));}[a30_0x445dab(0x1ac)](_0x544f88){displayRealtimeValidation(_0x544f88);}[a30_0x445dab(0x1b8)](_0x19223d,_0x430164,_0x2f9bc7,_0x2fa1d1){const _0x3a416e=a30_0x445dab;console[_0x3a416e(0x31a)]('\x0a'+a30_0x367bf6[_0x3a416e(0x27c)]('To\x20view\x20sample\x20data:'));const _0x56040f=_0x430164!=='-1d'?_0x3a416e(0x2f8)+_0x430164:'';if(_0x2f9bc7==='attribute'&&_0x2fa1d1)console['error']('\x20\x20'+a30_0x367bf6[_0x3a416e(0x27c)](_0x3a416e(0x2d1)+_0x19223d+'\x20--attribute\x20\x22'+_0x2fa1d1+'\x22'+_0x56040f));else{if(_0x2f9bc7===_0x3a416e(0x25b)&&_0x2fa1d1)console[_0x3a416e(0x31a)]('\x20\x20'+a30_0x367bf6[_0x3a416e(0x27c)](_0x3a416e(0x2d1)+_0x19223d+_0x3a416e(0x1ca)+_0x2fa1d1+'\x22'+_0x56040f));else(_0x2f9bc7===_0x3a416e(0x1c4)||_0x2f9bc7===_0x3a416e(0x273))&&console[_0x3a416e(0x31a)]('\x20\x20'+a30_0x367bf6[_0x3a416e(0x27c)](_0x3a416e(0x2d1)+_0x19223d+_0x3a416e(0x2e1)+_0x56040f));}(_0x2f9bc7===_0x3a416e(0x304)||_0x2f9bc7===_0x3a416e(0x273))&&console[_0x3a416e(0x31a)]('\x20\x20'+a30_0x367bf6['dim']('tdx\x20ps\x20preview\x20'+_0x19223d+_0x3a416e(0x223)+_0x56040f)),_0x2f9bc7==='all'&&console[_0x3a416e(0x31a)]('\x20\x20'+a30_0x367bf6[_0x3a416e(0x27c)](_0x3a416e(0x2d1)+_0x19223d+_0x3a416e(0x29b)+_0x56040f));}['displayMasterInfo'](_0x6e8990){const _0x556cce=a30_0x445dab,{master:_0x35e485}=_0x6e8990,_0x2b03aa=_0x35e485['schemaValid']?a30_0x367bf6[_0x556cce(0x335)]('✔'):a30_0x367bf6[_0x556cce(0x251)]('✘');console[_0x556cce(0x31a)]('\x0a'+a30_0x367bf6[_0x556cce(0x27c)](_0x556cce(0x309))),console[_0x556cce(0x31a)](_0x2b03aa+'\x20'+a30_0x367bf6[_0x556cce(0x31f)](_0x35e485[_0x556cce(0x1f2)]+'.'+_0x35e485[_0x556cce(0x1be)])),_0x35e485['schemaValid']?_0x35e485['rowCount']!==undefined&&console['error']('\x20\x20'+a30_0x367bf6[_0x556cce(0x27c)](_0x556cce(0x2b1))+'\x20'+a30_0x367bf6['cyan'](formatRows(_0x35e485[_0x556cce(0x219)]))):console[_0x556cce(0x31a)]('\x20\x20'+a30_0x367bf6[_0x556cce(0x251)](_0x556cce(0x1dd))+'\x20'+_0x35e485[_0x556cce(0x1e4)]);}[a30_0x445dab(0x25e)](_0x5e8cf8){const _0x1cabd4=a30_0x445dab;if(_0x5e8cf8[_0x1cabd4(0x1c4)][_0x1cabd4(0x24b)]===0x0)return;console['error']('\x0a'+a30_0x367bf6[_0x1cabd4(0x27c)](_0x1cabd4(0x225)));for(const _0x4f8e72 of _0x5e8cf8[_0x1cabd4(0x1c4)]){const _0x581292=_0x4f8e72[_0x1cabd4(0x25d)]?a30_0x367bf6['green']('✔'):a30_0x367bf6[_0x1cabd4(0x251)]('✘');let _0x8cea38='';if(_0x4f8e72[_0x1cabd4(0x25d)]&&_0x4f8e72['matchedCount']!==undefined&&_0x4f8e72[_0x1cabd4(0x1d5)]!==undefined){const _0x4becf4=_0x4f8e72['coveragePercent']['toFixed'](0x1),_0xb6ec2a=_0x4f8e72[_0x1cabd4(0x1d5)]>=0x50?a30_0x367bf6[_0x1cabd4(0x335)]:_0x4f8e72[_0x1cabd4(0x1d5)]>=0x32?a30_0x367bf6['yellow']:a30_0x367bf6[_0x1cabd4(0x251)];_0x8cea38='\x20'+a30_0x367bf6['dim'](_0x1cabd4(0x330))+'\x20'+_0xb6ec2a(_0x4becf4+'%')+'\x20('+formatRows(_0x4f8e72[_0x1cabd4(0x315)])+'\x20rows)';}console['error'](_0x581292+'\x20'+a30_0x367bf6[_0x1cabd4(0x31f)](_0x4f8e72[_0x1cabd4(0x2e5)])+_0x8cea38),console[_0x1cabd4(0x31a)]('\x20\x20'+a30_0x367bf6[_0x1cabd4(0x27c)](_0x1cabd4(0x293))+'\x20'+a30_0x367bf6[_0x1cabd4(0x31f)](_0x4f8e72[_0x1cabd4(0x1f2)]+'.'+_0x4f8e72[_0x1cabd4(0x1be)]));const _0x39c46e=_0x4f8e72['joinKey']===_0x4f8e72['foreignKey']?a30_0x367bf6[_0x1cabd4(0x27c)](_0x1cabd4(0x2ec))+'\x20'+_0x4f8e72['joinKey']:a30_0x367bf6[_0x1cabd4(0x27c)](_0x1cabd4(0x276))+'\x20'+_0x4f8e72['joinKey']+'\x20=\x20'+_0x4f8e72[_0x1cabd4(0x285)];console['error']('\x20\x20'+_0x39c46e),console['error']('\x20\x20'+a30_0x367bf6[_0x1cabd4(0x27c)]('Columns:')),this[_0x1cabd4(0x1ae)](_0x4f8e72[_0x1cabd4(0x2e8)]),!_0x4f8e72[_0x1cabd4(0x25d)]&&console[_0x1cabd4(0x31a)]('\x20\x20'+a30_0x367bf6[_0x1cabd4(0x251)](_0x1cabd4(0x1dd))+'\x20'+_0x4f8e72['schemaError']);}}['displayBehaviorsStats'](_0x34b991,_0x5a6c31){const _0x1f539d=a30_0x445dab;if(_0x34b991[_0x1f539d(0x304)]['length']===0x0)return;console[_0x1f539d(0x31a)]('\x0a'+a30_0x367bf6[_0x1f539d(0x27c)]('Behaviors')+'\x20'+a30_0x367bf6[_0x1f539d(0x27c)]('('+_0x5a6c31+')'));for(const _0x319495 of _0x34b991[_0x1f539d(0x304)]){const _0x36ae3d=_0x319495[_0x1f539d(0x25d)]?a30_0x367bf6[_0x1f539d(0x335)]('✔'):a30_0x367bf6[_0x1f539d(0x251)]('✘');let _0x4a8066='';if(_0x319495['schemaValid']&&_0x319495[_0x1f539d(0x1dc)]!==undefined&&_0x319495[_0x1f539d(0x2d6)]!==undefined){const _0x127e5b=_0x319495['customerPercent']?.[_0x1f539d(0x278)](0x1)||'?',_0x416810=(_0x319495[_0x1f539d(0x2f5)]??0x0)>=0x32?a30_0x367bf6[_0x1f539d(0x335)]:(_0x319495[_0x1f539d(0x2f5)]??0x0)>=0x14?a30_0x367bf6['yellow']:a30_0x367bf6[_0x1f539d(0x251)];_0x4a8066='\x20'+a30_0x367bf6[_0x1f539d(0x27c)](_0x1f539d(0x25c))+'\x20'+_0x416810(formatRows(_0x319495[_0x1f539d(0x1dc)]))+'\x20('+_0x127e5b+'%)\x20'+a30_0x367bf6[_0x1f539d(0x27c)]('Events:')+'\x20'+a30_0x367bf6[_0x1f539d(0x28b)](formatRows(_0x319495[_0x1f539d(0x2d6)]));}console['error'](_0x36ae3d+'\x20'+a30_0x367bf6[_0x1f539d(0x31f)](_0x319495[_0x1f539d(0x2e5)])+_0x4a8066),console[_0x1f539d(0x31a)]('\x20\x20'+a30_0x367bf6[_0x1f539d(0x27c)](_0x1f539d(0x293))+'\x20'+a30_0x367bf6[_0x1f539d(0x31f)](_0x319495['database']+'.'+_0x319495[_0x1f539d(0x1be)]));const _0xb45b7=_0x319495['joinKey']===_0x319495[_0x1f539d(0x285)]?a30_0x367bf6[_0x1f539d(0x27c)]('Join\x20on:')+'\x20'+_0x319495[_0x1f539d(0x1d4)]:a30_0x367bf6[_0x1f539d(0x27c)](_0x1f539d(0x276))+'\x20'+_0x319495[_0x1f539d(0x1d4)]+_0x1f539d(0x281)+_0x319495[_0x1f539d(0x285)];console[_0x1f539d(0x31a)]('\x20\x20'+_0xb45b7),console[_0x1f539d(0x31a)]('\x20\x20'+a30_0x367bf6[_0x1f539d(0x27c)](_0x1f539d(0x25a))),this[_0x1f539d(0x1ae)](_0x319495[_0x1f539d(0x2e8)]),!_0x319495[_0x1f539d(0x25d)]&&console[_0x1f539d(0x31a)]('\x20\x20'+a30_0x367bf6[_0x1f539d(0x251)](_0x1f539d(0x1dd))+'\x20'+_0x319495[_0x1f539d(0x1e4)]);}}[a30_0x445dab(0x1ae)](_0x1c4319){const _0x3d038c=a30_0x445dab;for(const _0x274092 of _0x1c4319){_0x274092[_0x3d038c(0x318)]===_0x274092['column']||_0x274092[_0x3d038c(0x329)]==='*'?console[_0x3d038c(0x31a)]('\x20\x20\x20\x20-\x20'+_0x274092[_0x3d038c(0x318)]):console['error'](_0x3d038c(0x238)+_0x274092[_0x3d038c(0x318)]+'\x20'+a30_0x367bf6[_0x3d038c(0x27c)]('('+_0x274092['column']+')'));}}[a30_0x445dab(0x23d)](_0x415439){const _0x47dac0=a30_0x445dab;console[_0x47dac0(0x31a)]('─'[_0x47dac0(0x2a6)](0x3c));if(_0x415439[_0x47dac0(0x1a9)]['length']>0x0){console[_0x47dac0(0x31a)]('\x0a'+a30_0x367bf6['red'](_0x47dac0(0x2f9)));for(const _0x576ffb of _0x415439[_0x47dac0(0x1a9)]){console[_0x47dac0(0x31a)]('\x20\x20'+a30_0x367bf6[_0x47dac0(0x251)]('•')+'\x20'+_0x576ffb);}}_0x415439[_0x47dac0(0x323)]&&console['error']('\x0a'+a30_0x367bf6[_0x47dac0(0x335)]('✔')+_0x47dac0(0x2aa));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x2e7);[a30_0x445dab(0x2c9)]=a30_0x445dab(0x336);async[a30_0x445dab(0x305)](_0x55397d){const _0x45abbb=a30_0x445dab,{options:_0x40fef3,args:_0x3c0d7d,tdx:_0x4a8811}=_0x55397d,_0x301b9c=_0x40fef3,_0x47337b=_0x3c0d7d[0x0]||_0x40fef3[_0x45abbb(0x1c2)];if(!_0x47337b)return showParentSegmentNotSetError(_0x45abbb(0x20c)+_0x45abbb(0x1b2)+_0x45abbb(0x337)+_0x45abbb(0x247)+_0x45abbb(0x1ee)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x45abbb(0x274)),0x1;if(!_0x301b9c[_0x45abbb(0x1db)]&&!_0x301b9c[_0x45abbb(0x22e)]&&!_0x301b9c[_0x45abbb(0x25b)]&&!_0x301b9c[_0x45abbb(0x21d)])return console[_0x45abbb(0x31a)](a30_0x367bf6[_0x45abbb(0x251)](_0x45abbb(0x2d5))),console['error']('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x45abbb(0x334)),console[_0x45abbb(0x31a)](_0x45abbb(0x316)),console[_0x45abbb(0x31a)](_0x45abbb(0x307)),console[_0x45abbb(0x31a)](_0x45abbb(0x214)),console[_0x45abbb(0x31a)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x5c2c28=resolveYamlFile(_0x47337b);if(!existsSync(_0x5c2c28))return showFileNotFoundError(_0x5c2c28,_0x47337b),0x1;_0x301b9c[_0x45abbb(0x2eb)]&&(console['error'](_0x45abbb(0x1f7)+_0x301b9c[_0x45abbb(0x243)]),console[_0x45abbb(0x31a)]('YAML\x20file:\x20'+_0x5c2c28));let _0x3e0cb3;try{_0x3e0cb3=readFileSync(_0x5c2c28,_0x45abbb(0x22b));}catch(_0x188bc6){const _0x319de3=_0x188bc6 instanceof Error?_0x188bc6['message']:String(_0x188bc6);return console[_0x45abbb(0x31a)](_0x45abbb(0x32e)+_0x319de3),0x1;}let _0x47e40b;try{_0x47e40b=parseDef(_0x3e0cb3);}catch(_0x56492e){const _0xdbee4f=_0x56492e instanceof Error?_0x56492e[_0x45abbb(0x24a)]:String(_0x56492e);return console[_0x45abbb(0x31a)](a30_0x367bf6['red'](_0x45abbb(0x1d9)+_0xdbee4f)),0x1;}if(_0x301b9c[_0x45abbb(0x22e)]===!![]||_0x301b9c['attribute']===''){const _0x4a62a3=_0x47e40b[_0x45abbb(0x1c4)]?.[_0x45abbb(0x2b8)](_0x152d2f=>_0x152d2f['name'])||[];if(_0x4a62a3[_0x45abbb(0x24b)]===0x0)console[_0x45abbb(0x31a)](a30_0x367bf6[_0x45abbb(0x251)](_0x45abbb(0x2a5)));else{console[_0x45abbb(0x31a)](a30_0x367bf6[_0x45abbb(0x251)](_0x45abbb(0x338))),console['error']('Available\x20attributes:');for(const _0xcd7f08 of _0x4a62a3){console[_0x45abbb(0x31a)]('\x20\x20'+a30_0x367bf6[_0x45abbb(0x28b)](_0xcd7f08));}console[_0x45abbb(0x31a)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x47337b+_0x45abbb(0x257)+_0x4a62a3[0x0]+'\x22');}return 0x1;}if(_0x301b9c[_0x45abbb(0x25b)]===!![]||_0x301b9c['behavior']===''){const _0x54c987=_0x47e40b[_0x45abbb(0x304)]?.[_0x45abbb(0x2b8)](_0x4b1a59=>_0x4b1a59[_0x45abbb(0x2e5)])||[];if(_0x54c987[_0x45abbb(0x24b)]===0x0)console[_0x45abbb(0x31a)](a30_0x367bf6[_0x45abbb(0x251)](_0x45abbb(0x1d1)));else{console[_0x45abbb(0x31a)](a30_0x367bf6[_0x45abbb(0x251)](_0x45abbb(0x2f1))),console[_0x45abbb(0x31a)]('Available\x20behaviors:');for(const _0x25a88d of _0x54c987){console['error']('\x20\x20'+a30_0x367bf6[_0x45abbb(0x28b)](_0x25a88d));}console[_0x45abbb(0x31a)](_0x45abbb(0x2bf)+_0x47337b+_0x45abbb(0x1ca)+_0x54c987[0x0]+'\x22');}return 0x1;}const _0x4148c7=createCommandSpinner(a30_0x367bf6[_0x45abbb(0x27c)]('Fetching\x20sample\x20data...'),{'verbose':_0x301b9c[_0x45abbb(0x2eb)]});_0x4148c7[_0x45abbb(0x2b9)]();const _0x2e01cc={'onProgress':_0x16197d=>{const _0x45d6d2=_0x45abbb;_0x4148c7[_0x45d6d2(0x2ac)]=formatProgressMessage(_0x16197d);}};if(_0x301b9c[_0x45abbb(0x1db)])_0x2e01cc[_0x45abbb(0x1db)]=!![];if(_0x301b9c[_0x45abbb(0x22e)]&&typeof _0x301b9c[_0x45abbb(0x22e)]===_0x45abbb(0x1cb))_0x2e01cc[_0x45abbb(0x22e)]=_0x301b9c[_0x45abbb(0x22e)];if(_0x301b9c[_0x45abbb(0x25b)]&&typeof _0x301b9c[_0x45abbb(0x25b)]===_0x45abbb(0x1cb))_0x2e01cc[_0x45abbb(0x25b)]=_0x301b9c[_0x45abbb(0x25b)];if(_0x301b9c['enriched'])_0x2e01cc[_0x45abbb(0x21d)]=!![];if(_0x301b9c['interval'])_0x2e01cc['interval']=_0x301b9c['interval'];let _0x5978c7;try{_0x5978c7=await _0x4a8811[_0x45abbb(0x2b3)][_0x45abbb(0x2cb)](_0x3e0cb3,_0x2e01cc),_0x4148c7[_0x45abbb(0x268)]();}catch(_0x341125){_0x4148c7[_0x45abbb(0x268)]();throw _0x341125;}return await this[_0x45abbb(0x2d4)](_0x5978c7,{'master':_0x301b9c[_0x45abbb(0x1db)],'attribute':typeof _0x301b9c['attribute']===_0x45abbb(0x1cb)?_0x301b9c['attribute']:undefined,'behavior':typeof _0x301b9c[_0x45abbb(0x25b)]===_0x45abbb(0x1cb)?_0x301b9c[_0x45abbb(0x25b)]:undefined,'enriched':_0x301b9c[_0x45abbb(0x21d)]}),_0x5978c7[_0x45abbb(0x323)]?0x0:0x1;}async[a30_0x445dab(0x2d4)](_0x1bf4a0,_0x2d66c8){const _0x321a90=a30_0x445dab;console[_0x321a90(0x31a)]('\x0a'+a30_0x367bf6[_0x321a90(0x31f)](_0x321a90(0x30f))+'\x20'+_0x1bf4a0[_0x321a90(0x2e5)]),console[_0x321a90(0x31a)]('═'[_0x321a90(0x2a6)](0x3c));if(_0x2d66c8[_0x321a90(0x1db)]&&_0x1bf4a0[_0x321a90(0x206)]){const _0x3d39cc=a30_0x367bf6[_0x321a90(0x27c)](_0x321a90(0x1e1))+'\x20'+a30_0x367bf6[_0x321a90(0x31f)](_0x1bf4a0[_0x321a90(0x1db)][_0x321a90(0x1f2)]+'.'+_0x1bf4a0[_0x321a90(0x1db)][_0x321a90(0x1be)]);await this[_0x321a90(0x32c)](_0x3d39cc,_0x1bf4a0[_0x321a90(0x206)]);}else{if(_0x2d66c8['attribute']&&_0x1bf4a0['sampleData']){const _0x17d989=a30_0x367bf6[_0x321a90(0x27c)](_0x321a90(0x306))+'\x20'+a30_0x367bf6[_0x321a90(0x31f)](_0x2d66c8[_0x321a90(0x22e)]);await this[_0x321a90(0x32c)](_0x17d989,_0x1bf4a0['sampleData']);}else{if(_0x2d66c8[_0x321a90(0x25b)]&&_0x1bf4a0[_0x321a90(0x206)]){const _0x2ba815=a30_0x367bf6['dim'](_0x321a90(0x1b1))+'\x20'+a30_0x367bf6['bold'](_0x2d66c8[_0x321a90(0x25b)]);await this[_0x321a90(0x32c)](_0x2ba815,_0x1bf4a0[_0x321a90(0x206)]);}else{if(_0x2d66c8[_0x321a90(0x21d)]&&_0x1bf4a0[_0x321a90(0x206)]){const _0x59207a=a30_0x367bf6[_0x321a90(0x27c)]('Enriched:')+'\x20'+a30_0x367bf6['bold'](_0x321a90(0x2ea));await this[_0x321a90(0x32c)](_0x59207a,_0x1bf4a0[_0x321a90(0x206)]);}else!_0x1bf4a0[_0x321a90(0x206)]&&console[_0x321a90(0x31a)](_0x321a90(0x240));}}}if(_0x1bf4a0[_0x321a90(0x1a9)]['length']>0x0){console[_0x321a90(0x31a)]('─'[_0x321a90(0x2a6)](0x3c)),console[_0x321a90(0x31a)]('\x0a'+a30_0x367bf6['red'](_0x321a90(0x2f9)));for(const _0x23352a of _0x1bf4a0[_0x321a90(0x1a9)]){console[_0x321a90(0x31a)]('\x20\x20'+a30_0x367bf6[_0x321a90(0x251)]('•')+'\x20'+_0x23352a);}}}async['displaySampleData'](_0xf98862,_0x546098){const _0x5d3b35=a30_0x445dab;if(_0x546098['length']===0x0){console['error']('\x0a'+_0xf98862),console[_0x5d3b35(0x31a)](_0x5d3b35(0x295));return;}console['error']('\x0a'+_0xf98862);const _0x4c223e=Object[_0x5d3b35(0x218)](_0x546098[0x0])['map'](_0x2457a2=>({'name':_0x2457a2,'type':typeof _0x546098[0x0][_0x2457a2]===_0x5d3b35(0x224)?_0x5d3b35(0x222):_0x5d3b35(0x300)})),_0x449f3f={'queryId':_0x5d3b35(0x26e),'columns':_0x4c223e,'data':_0x546098,'stats':{'state':_0x5d3b35(0x2c7),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x546098['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0xdbbc99=formatAsTable(_0x449f3f,_0x546098[_0x5d3b35(0x24b)],!![]);await writeOutput(_0xdbbc99,undefined,_0x5d3b35(0x1be));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x23b);[a30_0x445dab(0x2c9)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a30_0x445dab(0x305)](_0x532bcc){const _0x6b4709=a30_0x445dab,{options:_0x260d69,args:_0x2c1535,tdx:_0x238acc}=_0x532bcc,_0xdaa931=_0x260d69,_0x58b405=_0x2c1535[0x0]||_0x260d69[_0x6b4709(0x1c2)];if(!_0x58b405)return showParentSegmentNotSetError(_0x6b4709(0x1cc)+_0x6b4709(0x24c)),0x1;const _0x329fba=resolveYamlFile(_0x58b405);if(existsSync(_0x329fba)){_0xdaa931[_0x6b4709(0x2eb)]&&console[_0x6b4709(0x31a)](_0x6b4709(0x2ed)+_0x329fba);let _0x35a906;try{_0x35a906=readFileSync(_0x329fba,'utf-8');}catch(_0x91422a){const _0x51e877=_0x91422a instanceof Error?_0x91422a[_0x6b4709(0x24a)]:String(_0x91422a);return console[_0x6b4709(0x31a)]('Error\x20reading\x20file:\x20'+_0x51e877),0x1;}const _0xcc9eeb=await withSpinner(_0x6b4709(0x24e),()=>_0x238acc[_0x6b4709(0x2b3)][_0x6b4709(0x312)](_0x35a906),{'verbose':_0xdaa931[_0x6b4709(0x2eb)]}),_0x2df992=_0xcc9eeb[_0x6b4709(0x2a7)],{isNew:_0x370686,name:_0x362f33,hasChanges:_0x5e19e5,diffFormatted:_0x4f579f}=_0x2df992;if(_0x5e19e5){_0x370686?console['error'](_0x6b4709(0x20d)+_0x362f33+'\x27:'):console[_0x6b4709(0x31a)](_0x6b4709(0x1e6)+_0x362f33+'\x27:');console['error']('─'[_0x6b4709(0x2a6)](0x3c)),console[_0x6b4709(0x31a)](_0x4f579f),console['error']('─'[_0x6b4709(0x2a6)](0x3c));const _0x27ff61=_0x370686?'Create\x20parent\x20segment\x20\x27'+_0x362f33+_0x6b4709(0x244):_0x6b4709(0x2b7)+_0x362f33+'\x27\x20and\x20run\x20workflow?';if(!_0xdaa931[_0x6b4709(0x2ee)]){if(!isInteractive())return console[_0x6b4709(0x31a)](a30_0x367bf6[_0x6b4709(0x251)](_0x6b4709(0x21f)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x6b4709(0x31a)](a30_0x367bf6[_0x6b4709(0x27c)](_0x6b4709(0x2a8))),0x1;const _0x4cb891=await confirmKey(_0x27ff61);if(!_0x4cb891)return console[_0x6b4709(0x31a)](a30_0x367bf6[_0x6b4709(0x2a1)](_0x6b4709(0x1d8))),0x1;}const _0x42d3c4=_0x370686?_0x6b4709(0x289):_0x6b4709(0x1ff);await withSpinner(_0x42d3c4+_0x6b4709(0x31d)+_0x362f33+_0x6b4709(0x2c6),()=>_0x2df992[_0x6b4709(0x2be)](),{'verbose':_0xdaa931['verbose']});const _0x485663=_0x370686?'Created':_0x6b4709(0x1b5);console[_0x6b4709(0x31a)]('✔\x20'+_0x485663+'\x20parent\x20segment\x20\x27'+_0x362f33+'\x27');}else console[_0x6b4709(0x31a)]('✔\x20No\x20changes\x20-\x20\x27'+_0x362f33+_0x6b4709(0x208));}const _0x310b8e=await withSpinner(_0x6b4709(0x32a)+_0x58b405+_0x6b4709(0x2c6),()=>_0x238acc['segment'][_0x6b4709(0x331)](_0x58b405),{'verbose':_0xdaa931[_0x6b4709(0x2eb)]}),_0x32ba94=_0x310b8e[_0x6b4709(0x2a7)],_0x50e082=getConsoleUrl(_0xdaa931[_0x6b4709(0x243)],'/app/workflows/'+_0x32ba94[_0x6b4709(0x1fa)]+_0x6b4709(0x1b4)+_0x32ba94[_0x6b4709(0x1b9)]+_0x6b4709(0x1c0)+_0x32ba94[_0x6b4709(0x236)]);return console[_0x6b4709(0x31a)]('\x0a✔\x20Workflow\x20started'),console[_0x6b4709(0x31a)]('\x20\x20'+a30_0x367bf6['dim'](_0x6b4709(0x339))+'\x20'+_0x32ba94['audienceId']),console[_0x6b4709(0x31a)]('\x20\x20'+a30_0x367bf6[_0x6b4709(0x27c)](_0x6b4709(0x28f))+'\x20'+_0x32ba94[_0x6b4709(0x235)]),console[_0x6b4709(0x31a)]('\x20\x20'+a30_0x367bf6[_0x6b4709(0x27c)](_0x6b4709(0x1fc))+'\x20'+_0x32ba94[_0x6b4709(0x1b9)]),console[_0x6b4709(0x31a)]('\x20\x20'+a30_0x367bf6[_0x6b4709(0x27c)]('Attempt:')+'\x20'+_0x32ba94[_0x6b4709(0x236)]),console[_0x6b4709(0x31a)]('\x20\x20'+_0x50e082),console[_0x6b4709(0x31a)]('\x0a'+a30_0x367bf6['dim'](_0x6b4709(0x2c3))+_0x6b4709(0x2ef)+_0x32ba94['workflowAttemptId']+_0x6b4709(0x301)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x2bd);[a30_0x445dab(0x2c9)]=a30_0x445dab(0x2a3);async[a30_0x445dab(0x305)](_0x4f01b2){const _0x35a47f=a30_0x445dab,{options:_0x5f48dd,args:_0xf8de50,tdx:_0x4a0ea0}=_0x4f01b2,_0x488b2c=_0xf8de50[0x0]||_0x5f48dd['parentSegment'];if(!_0x488b2c)return showParentSegmentNotSetError(_0x35a47f(0x284)+_0x35a47f(0x2e6)),0x1;_0x5f48dd['verbose']&&(console['error'](_0x35a47f(0x1f7)+_0x5f48dd[_0x35a47f(0x243)]),console[_0x35a47f(0x31a)]('Parent\x20segment:\x20'+_0x488b2c));const _0xe16c1a=await withSpinner(_0x35a47f(0x1aa)+_0x488b2c+_0x35a47f(0x2c6),()=>_0x4a0ea0[_0x35a47f(0x2b3)]['listFields'](_0x488b2c),{'verbose':_0x5f48dd[_0x35a47f(0x2eb)]}),_0x277217=_0xe16c1a[_0x35a47f(0x2a7)];console[_0x35a47f(0x31a)](_0x35a47f(0x1fd)+_0x277217[_0x35a47f(0x24b)]+_0x35a47f(0x1b3)+(_0x277217['length']!==0x1?'s':''));if(_0x5f48dd[_0x35a47f(0x303)]||_0x5f48dd[_0x35a47f(0x1bb)])return await handleSDKOutput(_0x277217,_0x5f48dd),0x0;return displayFieldsHumanReadable(_0x277217,_0x488b2c),0x0;}}function a30_0x26e3(){const _0x5880c5=['\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Name:\x20','Join:','scheduleType','toFixed','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','\x20total','behaviorsFile','dim','createParent','open','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20is\x20already\x20up\x20to\x20date','\x20=\x20','\x20service','type','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','foreignKey','getBehaviorNames','Default','processedRows','Creating','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','cyan','42fdagWy','customerGroup','Personalization:','Status:','updateParent','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','parent_id','Source:','\x20behaviors','\x20\x20No\x20sample\x20data\x20available','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','displayMasterInfo','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20Context\x20set:\x20','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20--enriched','Listing\x20RT-enabled\x20parent\x20segments...','\x20\x201.\x20Edit\x20','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','✔\x20Query\x20completed:\x20Processed\x20','darwin','yellow','log','List\x20available\x20fields\x20for\x20segmentation','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','repeat','data','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20Configuration\x20is\x20valid','Options:\x0a','text','\x20\x20Note:\x20','isDirectory','displayBehaviorsStats','\x0aChanges\x20to\x20\x27','Rows:','Output\x20Database:','segment','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','segment:parent:create','3897tlIUHT','Apply\x20changes\x20to\x20\x27','map','start','\x22,\x20\x22type\x22:\x20\x22','/app/dw/parentSegments/','1639806pmmfDh','segment:parent:fields','apply','\x0aUsage:\x20tdx\x20ps\x20preview\x20','addBehaviors','collectSchema','information_schema','To\x20cancel:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Create\x20parent\x20segment\x20\x27','\x27...','FINISHED','\x20personalization\x20service','description','customerGroupFile','previewParentYaml','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','displayValidateResults','Database:\x20','getParentFull','resolveParentId','tdx\x20ps\x20preview\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','jobId','displayPreviewResults','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','totalEvents','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','enabled','xdg-open','replace','/{name}.yml\x0a','toLowerCase','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Get\x20SQL\x20query\x20for\x20parent\x20segment','segment:parent:list','\x20\x20Columns:\x20','\x20--attribute\x20\x22<name>\x22','Show\x20parent\x20segment\x20schema\x20(column\x20types)','SQL\x20query:\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','segment:parent:preview','columns','Validating\x20configuration...','Master\x20+\x20Attributes','verbose','Join\x20on:','Found\x20YAML\x20file:\x20','yes','\x20tdx\x20wf\x20attempt\x20','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','customers','\x20rows\x20','sort','customerPercent','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','getParentSQL','\x20--interval\x20','Errors:','realtime','personalization_services','302870KbSoAW','SELECT\x20*\x20FROM\x20(\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','varchar','\x20kill','segment:parent:view','json','behaviors','execute','Attribute:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20No\x20changes\x20-\x20','Master\x20Table','population','Events:','run','Table:\x20','push','Preview:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Error:\x20--database\x20and\x20--table\x20are\x20required','pushParentYaml','idStitching','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','matchedCount','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','My\x20Service','label','\x20configured','error','events','sections','\x20parent\x20segment\x20\x27','addAttributes','bold','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','column_name','Listing\x20parent\x20segments\x20matching\x20\x27','allValid','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','localeCompare','No\x20personalization\x20services\x20configured','trigger_event','\x20trigger=','column','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','⚡\x20Not\x20enabled','displaySampleData','\x20\x20Tables:\x201\x20customers\x20+\x20','Error\x20reading\x20file:\x20','using\x20the\x20default\x20path:\x20','Coverage:','runParent','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','874827qzKQQJ','Options:','green','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Options\x20(one\x20required):\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Audience\x20ID:','RT\x202.0\x20Validate:','errors','Listing\x20fields\x20for\x20\x27','column_type','displayRealtimeInfo','list','displayColumns','timezone','Validating\x20RT\x20configuration...','Behavior:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20field','/sessions/','Updated','session','segment:parent:push','displayPreviewHints','workflowSessionId','valid','jsonl','\x20\x20Database:\x20','segment:parent:desc','table','6513xYAQSZ','/attempt/','\x27\x20with\x20ID:\x20','parentSegment','behavior_','attributes','Error:\x20Parent\x20segment\x20name\x20is\x20required','4KEgAfL','addAttributesFile','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20+\x20[','\x20--behavior\x20\x22','string','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','getOutputDatabaseName','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x0a⚠️\x20\x20Both\x20','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','pullParentYaml','Fetching\x20customers\x20schema...','joinKey','coveragePercent','Personalization\x20service\x20description','Show\x20parent\x20segment\x20details','Aborted.','Error\x20parsing\x20YAML:\x20','4908NQOHDS','master','customersWithEvents','Error:','6867kWGEGG','format','Error:\x20File\x20not\x20found:\x20','Master:','Fetching\x20behavior\x20list...','Overwrite\x20\x27','schemaError','Executing\x20parent\x20segment\x20query...','\x0aChanges\x20to\x20apply\x20to\x20\x27','Fetching\x20parent\x20segment\x20\x27','formatSchemaJson','Attributes:','interval','.yml','sourceTableValid','✔\x20No\x20changes\x20-\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','segment:parent:update','database','attributesFile','join','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Site:\x20','last_page_viewed','personalization','workflowId','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Session:','✔\x20Found\x20','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Updating','\x0a\x20\x20\x20\x20}','query','dirname','indexOf','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','`\x20to\x20download\x20the\x20configuration\x20first','sampleData','segment:parent:validate','\x27\x20is\x20up\x20to\x20date','706915dijOIi','✔\x20Created\x20parent\x20segment\x20\x27','\x20RT\x20configuration\x20is\x20valid','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x0aNew\x20parent\x20segment\x20\x27','/\x20directory.\x0a','2232VTBCyU','sourceTableError','ignore','No\x20parent\x20segments\x20found','match','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','tdx\x20ps\x20push\x20','Listing\x20personalization\x20services\x20for\x20\x27','keys','rowCount','listParents','Fetching\x20SQL\x20for\x20\x27','Pattern:\x20','enriched','Creating\x20parent\x20segment\x20\x27','\x0aError:','parent_segment','limit','double','\x20--behavior\x20\x22<name>\x22','number','Attributes','Schema\x20saved\x20to\x20','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x27\x20is\x20already\x20up\x20to\x20date','\x20Opening\x20','134xrUHms','utf-8','✔\x20Updated\x20parent\x20segment\x20\x27','addBehaviorsFile','attribute','\x20[Job\x20ID:\x20','10OKWwrb','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','personalizationServices','win32','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','status','workflowAttemptId','\x20section','\x20\x20\x20\x20-\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','output','segment:parent:run','\x20service(s)\x20configured','displaySummary','page_view','\x0a\x20\x20]\x0a}\x0a','\x0aNo\x20sample\x20data\x20available','endsWith','/\x20directories\x20exist.','site','\x27\x20and\x20run\x20workflow?','\x20to\x20push\x20the\x20configuration','scheduleOption','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','ps:rt:validate','message','length','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','primaryKey','Analyzing\x20changes...','trim','segment:parent:pull','red','reduce','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x5c$&','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','RT\x202.0:','\x20--attribute\x20\x22','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Columns:','behavior','Customers:','schemaValid','displayAttributesStats','✘\x20Failed\x20to\x20rename\x20directory:\x20','Resolving\x20parent\x20segment\x20\x27','List\x20parent\x20segments','\x20\x20\x20\x20','filter','\x22\x20}','Parent\x20segment:\x20','in\x20','\x20\x20\x20','stop','test','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','👥\x20','validateParentYaml','stitchingKeys','preview','platform','realtime:','\x20Added\x20personalization\x20template\x20to\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','all'];a30_0x26e3=function(){return _0x5880c5;};return a30_0x26e3();}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x302);[a30_0x445dab(0x2c9)]=a30_0x445dab(0x1d7);async['execute'](_0x481917){const _0x5769a3=a30_0x445dab,{options:_0x290ff1,args:_0x2bc8fc,tdx:_0x3371f8}=_0x481917,_0xaad5d0=_0x290ff1,_0x36261f=_0x2bc8fc[0x0]||_0x290ff1[_0x5769a3(0x1c2)];if(!_0x36261f)return showParentSegmentNotSetError(_0x5769a3(0x1ef)+_0x5769a3(0x296)+'Options:\x0a'+_0x5769a3(0x27f)),0x1;_0x290ff1[_0x5769a3(0x2eb)]&&(console[_0x5769a3(0x31a)](_0x5769a3(0x1f7)+_0x290ff1[_0x5769a3(0x243)]),console['error'](_0x5769a3(0x265)+_0x36261f));const _0x973117=await withSpinner(_0x5769a3(0x1e7)+_0x36261f+_0x5769a3(0x2c6),()=>_0x3371f8['segment'][_0x5769a3(0x2cf)](_0x36261f),{'verbose':_0x290ff1[_0x5769a3(0x2eb)]}),_0x198413=_0x973117[_0x5769a3(0x2a7)];if(_0xaad5d0['web']){const _0x149444=getConsoleNextUrl(_0xaad5d0[_0x5769a3(0x243)],'/app/dw/parentSegments/'+_0x198413['id']);return console[_0x5769a3(0x31a)](a30_0x367bf6[_0x5769a3(0x335)]('✔')+_0x5769a3(0x229)+a30_0x367bf6['cyan'](_0x149444)),openBrowser(_0x149444),0x0;}return await handleSingleObjectOutput(_0x198413,_0x290ff1),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a30_0x445dab(0x1bd);[a30_0x445dab(0x2c9)]=a30_0x445dab(0x2e2);async['execute'](_0xd1a676){const _0x21c85b=a30_0x445dab,{options:_0x173664,args:_0x276358,tdx:_0x4c3a6f}=_0xd1a676,_0x2c0747=_0x173664,_0x542c4a=_0x276358[0x0]||_0x173664[_0x21c85b(0x1c2)];if(!_0x542c4a)return showParentSegmentNotSetError(_0x21c85b(0x204)+_0x21c85b(0x272)+_0x21c85b(0x2ab)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x173664[_0x21c85b(0x2eb)]&&(console['error'](_0x21c85b(0x1f7)+_0x173664[_0x21c85b(0x243)]),console['error'](_0x21c85b(0x265)+_0x542c4a));const _0x367a57=await withSpinner(_0x21c85b(0x260)+_0x542c4a+_0x21c85b(0x2c6),()=>_0x4c3a6f[_0x21c85b(0x2b3)][_0x21c85b(0x2d0)](_0x542c4a),{'verbose':_0x173664[_0x21c85b(0x2eb)]}),_0x426465=_0x367a57[_0x21c85b(0x2a7)],_0xc74bc1=_0x4c3a6f['segment'][_0x21c85b(0x1cd)](_0x426465);if(_0x2c0747[_0x21c85b(0x23a)]){const _0x5b9ce8=await this[_0x21c85b(0x2c1)](_0xd1a676,_0x542c4a,_0x426465,_0xc74bc1),_0x409424=this['formatSchemaJson'](_0x5b9ce8);writeFileSync(_0x2c0747[_0x21c85b(0x23a)],_0x409424);const _0x7998c3=_0x5b9ce8[_0x21c85b(0x2f2)][_0x21c85b(0x2e8)]['length']+_0x5b9ce8[_0x21c85b(0x304)][_0x21c85b(0x252)]((_0x174953,_0x50efc3)=>_0x174953+_0x50efc3[_0x21c85b(0x2e8)][_0x21c85b(0x24b)],0x0),_0x549f86=_0x5b9ce8[_0x21c85b(0x304)][_0x21c85b(0x263)](_0x2ec141=>_0x2ec141[_0x21c85b(0x2e8)][_0x21c85b(0x24b)]===0x0)[_0x21c85b(0x24b)];return console[_0x21c85b(0x2a2)](_0x21c85b(0x226)+_0x2c0747[_0x21c85b(0x23a)]),console[_0x21c85b(0x2a2)](_0x21c85b(0x1bc)+_0xc74bc1),console[_0x21c85b(0x2a2)](_0x21c85b(0x32d)+_0x5b9ce8[_0x21c85b(0x304)][_0x21c85b(0x24b)]+_0x21c85b(0x294)),console[_0x21c85b(0x2a2)](_0x21c85b(0x2e0)+_0x7998c3+_0x21c85b(0x27a)),_0x549f86>0x0&&console[_0x21c85b(0x2a2)](_0x21c85b(0x2ad)+_0x549f86+_0x21c85b(0x1fe)),0x0;}console[_0x21c85b(0x31a)]('\x0a'+a30_0x367bf6[_0x21c85b(0x31f)](_0x21c85b(0x2b2))+'\x20'+a30_0x367bf6[_0x21c85b(0x28b)](_0xc74bc1));const _0x578726=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x4c3a6f[_0x21c85b(0x2b3)][_0x21c85b(0x2f7)](_0x426465),{'verbose':_0x173664[_0x21c85b(0x2eb)]});console[_0x21c85b(0x31a)]('\x0a'+a30_0x367bf6[_0x21c85b(0x31f)](_0x21c85b(0x2f2))+'\x20'+a30_0x367bf6[_0x21c85b(0x27c)]('('+_0xc74bc1+'.customers)'));const _0x50e97d=await executeSchemaQuery(_0x578726['data'],_0x4c3a6f,_0x173664);await handleQueryOutput(_0x50e97d,_0x173664);const _0x2bbc96=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x4c3a6f[_0x21c85b(0x2b3)][_0x21c85b(0x286)](_0x426465),{'verbose':_0x173664[_0x21c85b(0x2eb)]});for(const _0x6d456f of _0x2bbc96['data']){const _0x51e434=_0x21c85b(0x1c3)+_0x6d456f['toLowerCase']()[_0x21c85b(0x2da)](/\s+/g,'_'),_0x3abb9c='SELECT\x20*\x20FROM\x20'+_0xc74bc1+'.'+_0x51e434;console['error']('\x0a'+a30_0x367bf6[_0x21c85b(0x31f)](_0x6d456f)+'\x20'+a30_0x367bf6[_0x21c85b(0x27c)]('('+_0xc74bc1+'.'+_0x51e434+')'));try{const _0x439236=await executeSchemaQuery(_0x3abb9c,_0x4c3a6f,_0x173664);await handleQueryOutput(_0x439236,_0x173664);}catch{console[_0x21c85b(0x31a)](a30_0x367bf6[_0x21c85b(0x2a1)](_0x21c85b(0x2d7)));}}return 0x0;}async['collectSchema'](_0x149913,_0x385036,_0x3fa63f,_0x5359bd){const _0x3732f3=a30_0x445dab,{options:_0x274aac,tdx:_0x388e03}=_0x149913,_0x3377ff=await withSpinner(_0x3732f3(0x1d3),()=>_0x388e03[_0x3732f3(0x2b3)]['getParentSQL'](_0x3fa63f),{'verbose':_0x274aac[_0x3732f3(0x2eb)]}),_0x1dbdac=await executeSchemaQuery(_0x3377ff[_0x3732f3(0x2a7)],_0x388e03,_0x274aac),_0x5d43ef=_0x1dbdac[_0x3732f3(0x2a7)]['map'](_0x2a27d6=>({'name':_0x2a27d6['column_name'],'type':_0x2a27d6[_0x3732f3(0x1ab)]})),_0x61838c=await withSpinner(_0x3732f3(0x1e2),()=>_0x388e03[_0x3732f3(0x2b3)]['getBehaviorNames'](_0x3fa63f),{'verbose':_0x274aac[_0x3732f3(0x2eb)]}),_0x114e48=[];for(const _0x30fd56 of _0x61838c['data']){const _0x2c7716=_0x3732f3(0x1c3)+_0x30fd56[_0x3732f3(0x2dc)]()['replace'](/\s+/g,'_'),_0x349344='SELECT\x20*\x20FROM\x20'+_0x5359bd+'.'+_0x2c7716;let _0x2cffe9=[];try{const _0x852818=await executeSchemaQuery(_0x349344,_0x388e03,_0x274aac);_0x2cffe9=_0x852818['data'][_0x3732f3(0x2b8)](_0x314a8b=>({'name':_0x314a8b[_0x3732f3(0x321)],'type':_0x314a8b[_0x3732f3(0x1ab)]}));}catch{}_0x114e48[_0x3732f3(0x30e)]({'table':_0x2c7716,'columns':_0x2cffe9});}return{'database':_0x5359bd,'parent_segment':_0x385036,'parent_id':_0x3fa63f,'customers':{'table':_0x3732f3(0x2f2),'columns':_0x5d43ef},'behaviors':_0x114e48};}[a30_0x445dab(0x1e8)](_0x172172){const _0x4faf9a=a30_0x445dab,_0x717fb1=_0x171c9b=>{const _0x26004b=a30_0xecef;if(_0x171c9b[_0x26004b(0x24b)]===0x0)return'[]';const _0x14cfbb=_0x171c9b[_0x26004b(0x2b8)](_0x205382=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x205382[_0x26004b(0x2e5)]+_0x26004b(0x2ba)+_0x205382[_0x26004b(0x283)]+_0x26004b(0x264));return'[\x0a'+_0x14cfbb[_0x26004b(0x1f4)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x3be928=_0x172172[_0x4faf9a(0x304)][_0x4faf9a(0x2b8)](_0x3c4a6f=>{const _0x140e94=_0x4faf9a;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x3c4a6f['table']+_0x140e94(0x314)+_0x717fb1(_0x3c4a6f[_0x140e94(0x2e8)])['replace'](/^/gm,'\x20\x20')['trim']()+_0x140e94(0x200);})[_0x4faf9a(0x1f4)](',\x0a');return _0x4faf9a(0x298)+_0x172172[_0x4faf9a(0x1f2)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x172172['parent_segment']+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x172172[_0x4faf9a(0x292)]+_0x4faf9a(0x2a9)+_0x172172['customers']['table']+_0x4faf9a(0x2d2)+_0x717fb1(_0x172172['customers']['columns'])[_0x4faf9a(0x2da)](/^/gm,'\x20\x20')[_0x4faf9a(0x24f)]()+_0x4faf9a(0x291)+_0x3be928+_0x4faf9a(0x23f);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x445dab(0x2e5)]='segment:parent:sql';[a30_0x445dab(0x2c9)]=a30_0x445dab(0x2de);async[a30_0x445dab(0x305)](_0x22dc96){const _0x517b76=a30_0x445dab,{options:_0x1c63e1,args:_0x51a93c,tdx:_0xbca798}=_0x22dc96,_0x81fcba=_0x51a93c[0x0]||_0x1c63e1[_0x517b76(0x1c2)];if(!_0x81fcba)return showParentSegmentNotSetError(_0x517b76(0x1c8)+_0x517b76(0x253)),0x1;_0x1c63e1['verbose']&&(console[_0x517b76(0x31a)](_0x517b76(0x1f7)+_0x1c63e1['site']),console[_0x517b76(0x31a)](_0x517b76(0x265)+_0x81fcba));const _0x3d144f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x81fcba+_0x517b76(0x2c6),()=>_0xbca798[_0x517b76(0x2b3)][_0x517b76(0x2d0)](_0x81fcba),{'verbose':_0x1c63e1[_0x517b76(0x2eb)]}),_0x1f4e1c=_0x3d144f[_0x517b76(0x2a7)],_0x7d6dee=await withSpinner(_0x517b76(0x21b)+_0x81fcba+'\x27...',()=>_0xbca798['segment'][_0x517b76(0x2f7)](_0x1f4e1c),{'verbose':_0x1c63e1[_0x517b76(0x2eb)]}),_0x764b93=_0x7d6dee[_0x517b76(0x2a7)];return _0x1c63e1['format']==='json'||_0x1c63e1[_0x517b76(0x1df)]===_0x517b76(0x1bb)?await handleSDKOutput([{'sql':_0x764b93}],_0x1c63e1):console['log'](_0x764b93),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x445dab(0x2e5)]='segment:parent:show';[a30_0x445dab(0x2c9)]=a30_0x445dab(0x1f5);async[a30_0x445dab(0x305)](_0x574785){const _0x410500=a30_0x445dab,{options:_0x5d2846,args:_0x15ba44,tdx:_0x5141cc}=_0x574785,_0x1f2a7=_0x15ba44[0x0]||_0x5d2846[_0x410500(0x1c2)];if(!_0x1f2a7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x410500(0x324)),0x1;_0x5d2846[_0x410500(0x2eb)]&&(console['error'](_0x410500(0x1f7)+_0x5d2846[_0x410500(0x243)]),console[_0x410500(0x31a)](_0x410500(0x265)+_0x1f2a7));const _0x4b453a=await withSpinner(_0x410500(0x260)+_0x1f2a7+_0x410500(0x2c6),()=>_0x5141cc[_0x410500(0x2b3)][_0x410500(0x2d0)](_0x1f2a7),{'verbose':_0x5d2846[_0x410500(0x2eb)]}),_0x46c5b3=_0x4b453a[_0x410500(0x2a7)],_0x49917b=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x1f2a7+'\x27...',()=>_0x5141cc['segment'][_0x410500(0x2f7)](_0x46c5b3),{'verbose':_0x5d2846[_0x410500(0x2eb)]});let _0x94dddd=_0x49917b[_0x410500(0x2a7)];const _0x512d63=resolveLimit(_0x5d2846[_0x410500(0x221)],DEFAULT_DISPLAY_LIMIT),_0x49b555=/\bLIMIT\s+\d+/i['test'](_0x94dddd);!_0x49b555&&(_0x94dddd=_0x94dddd['trim']()[_0x410500(0x2da)](/;+$/,''),_0x94dddd=_0x410500(0x2fd)+_0x94dddd+_0x410500(0x1f6)+_0x512d63);_0x5d2846[_0x410500(0x2eb)]&&console[_0x410500(0x31a)](_0x410500(0x2e3)+_0x94dddd);const _0x40f2c7=await withProgressSpinner(_0x410500(0x1e5),async _0x47e1e3=>{const _0x2c13aa=_0x410500,_0x6c2a6c=await _0x5141cc[_0x2c13aa(0x201)][_0x2c13aa(0x305)](_0x94dddd,{'catalog':'td','schema':_0x2c13aa(0x2c2),'onJobId':_0x110103=>{_0x47e1e3['setJobId'](_0x110103);}});return _0x6c2a6c;},{'verbose':_0x5d2846[_0x410500(0x2eb)]}),_0x20ca01=_0x40f2c7[_0x410500(0x2a7)],_0x2293af=_0x20ca01[_0x410500(0x2d3)]?_0x410500(0x22f)+_0x20ca01[_0x410500(0x2d3)]+']':'';return console[_0x410500(0x31a)](_0x410500(0x29f)+_0x20ca01['stats'][_0x410500(0x288)]['toLocaleString']()+_0x410500(0x2f3)+(_0x410500(0x266)+formatElapsed(_0x20ca01['stats']['elapsedTimeMillis'])+_0x2293af)),await handleQueryOutput(_0x20ca01,_0x5d2846),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x445dab(0x2e5)]='ps:rt:list';[a30_0x445dab(0x2c9)]=a30_0x445dab(0x227);async[a30_0x445dab(0x305)](_0x3f89ba){const _0x396438=a30_0x445dab,{options:_0x10ebb1,args:_0x2d2290,tdx:_0x125f89}=_0x3f89ba,_0x59ae1b=_0x2d2290[0x0],_0x24127c=await withSpinner(_0x59ae1b?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x59ae1b+_0x396438(0x2c6):_0x396438(0x29c),()=>_0x125f89['realtime'][_0x396438(0x1ad)](),{'verbose':_0x10ebb1[_0x396438(0x2eb)]});let _0x574141=_0x24127c[_0x396438(0x2a7)]['filter'](_0x3c5871=>_0x3c5871['realtime_enabled']);if(_0x59ae1b){const _0x57b280=_0x59ae1b['replace'](/[.+^${}()|[\]\\]/g,_0x396438(0x254))[_0x396438(0x2da)](/\*/g,'.*')['replace'](/\?/g,'.'),_0xa67d78=new RegExp('^'+_0x57b280+'$','i');_0x574141=_0x574141['filter'](_0x390813=>_0xa67d78[_0x396438(0x269)](_0x390813[_0x396438(0x2e5)]));}_0x574141[_0x396438(0x2f4)]((_0x2bf0b7,_0xc06b91)=>_0x2bf0b7[_0x396438(0x2e5)][_0x396438(0x325)](_0xc06b91['name'])),console[_0x396438(0x31a)]('✔\x20Found\x20'+_0x574141[_0x396438(0x24b)]+'\x20RT-enabled\x20parent\x20segment'+(_0x574141[_0x396438(0x24b)]!==0x1?'s':''));const _0x1af876=_0x1c905b=>{const _0x44b467=_0x396438;return getConsoleNextUrl(_0x10ebb1[_0x44b467(0x243)],_0x44b467(0x2bb)+_0x1c905b);};if(_0x10ebb1['format']==='json'||_0x10ebb1['format']==='jsonl'){const _0x293319=_0x574141[_0x396438(0x2b8)](_0x3b9905=>({..._0x3b9905,'url':_0x1af876(_0x3b9905['id'])}));await handleSDKOutput(_0x293319,_0x10ebb1);}else{if(_0x574141[_0x396438(0x24b)]===0x0)console['log']('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0xcd9949 of _0x574141){const _0x39219b=_0xcd9949[_0x396438(0x30a)]?a30_0x367bf6[_0x396438(0x27c)]('\x20('+formatRows(_0xcd9949[_0x396438(0x30a)])+')'):'',_0x2096c8=hyperlink(_0xcd9949[_0x396438(0x2e5)],_0x1af876(_0xcd9949['id']));console['log']('⚡\x20'+_0x2096c8+_0x39219b);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x445dab(0x2e5)]=a30_0x445dab(0x249);['description']='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async['execute'](_0x263bda){const _0x46f484=a30_0x445dab,{options:_0x2fbd74,args:_0x3eb523,tdx:_0xbb7bdb}=_0x263bda,_0x3a7ae5=_0x3eb523[0x0]||_0x2fbd74[_0x46f484(0x1c2)];if(!_0x3a7ae5)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x2f43b9=resolveYamlFile(_0x3a7ae5);if(!existsSync(_0x2f43b9))return showFileNotFoundError(_0x2f43b9,_0x3a7ae5),0x1;let _0x51ee38;try{_0x51ee38=readFileSync(_0x2f43b9,_0x46f484(0x22b));}catch(_0x3962e4){const _0x783623=_0x3962e4 instanceof Error?_0x3962e4[_0x46f484(0x24a)]:String(_0x3962e4);return console[_0x46f484(0x31a)](_0x46f484(0x32e)+_0x783623),0x1;}const _0x2b8881=createCommandSpinner(a30_0x367bf6[_0x46f484(0x27c)](_0x46f484(0x1b0)),{'verbose':_0x2fbd74[_0x46f484(0x2eb)]});_0x2b8881['start']();const _0x1532d5={'realtime':!![],'onProgress':_0x4048ec=>{const _0x42c25c=_0x46f484;_0x2b8881[_0x42c25c(0x2ac)]=formatProgressMessage(_0x4048ec);}};let _0x2254ce;try{_0x2254ce=await _0xbb7bdb[_0x46f484(0x2b3)][_0x46f484(0x26c)](_0x51ee38,_0x1532d5),_0x2b8881[_0x46f484(0x268)]();}catch(_0x435e79){_0x2b8881[_0x46f484(0x268)]();throw _0x435e79;}console[_0x46f484(0x31a)]('\x0a'+a30_0x367bf6[_0x46f484(0x31f)](_0x46f484(0x33a))+'\x20'+_0x2254ce['name']),console['error']('═'[_0x46f484(0x2a6)](0x3c)),displayRealtimeValidation(_0x2254ce),console[_0x46f484(0x31a)]('─'[_0x46f484(0x2a6)](0x3c));if(_0x2254ce[_0x46f484(0x1a9)][_0x46f484(0x24b)]>0x0){console['error']('\x0a'+a30_0x367bf6[_0x46f484(0x251)]('Errors:'));for(const _0x4fe853 of _0x2254ce[_0x46f484(0x1a9)]){console[_0x46f484(0x31a)]('\x20\x20'+a30_0x367bf6[_0x46f484(0x251)]('•')+'\x20'+_0x4fe853);}}return _0x2254ce['allValid']&&console[_0x46f484(0x31a)]('\x0a'+a30_0x367bf6[_0x46f484(0x335)]('✔')+_0x46f484(0x20b)),_0x2254ce[_0x46f484(0x323)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a30_0x445dab(0x2e5)]='ps:pz:list';[a30_0x445dab(0x2c9)]=a30_0x445dab(0x231);async['execute'](_0x552b22){const _0x1fb833=a30_0x445dab,{options:_0xdefe,args:_0x57916a,tdx:_0x2ed135}=_0x552b22,_0x24401f=_0x57916a[0x0]||_0xdefe[_0x1fb833(0x1c2)];if(!_0x24401f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a'+_0x1fb833(0x279)),0x1;const _0x2b58b5=await withSpinner(_0x1fb833(0x260)+_0x24401f+_0x1fb833(0x2c6),()=>_0x2ed135[_0x1fb833(0x2b3)][_0x1fb833(0x2d0)](_0x24401f),{'verbose':_0xdefe[_0x1fb833(0x2eb)]}),_0x2c33f5=_0x2b58b5['data'],_0x23243b=await withSpinner(_0x1fb833(0x217)+_0x24401f+_0x1fb833(0x2c6),()=>_0x2ed135[_0x1fb833(0x1f9)][_0x1fb833(0x1ad)](_0x2c33f5),{'verbose':_0xdefe[_0x1fb833(0x2eb)]}),_0xf8d028=_0x23243b[_0x1fb833(0x2a7)];console[_0x1fb833(0x31a)]('✔\x20Found\x20'+_0xf8d028[_0x1fb833(0x24b)]+_0x1fb833(0x2c8)+(_0xf8d028[_0x1fb833(0x24b)]!==0x1?'s':''));if(_0xdefe[_0x1fb833(0x1df)]===_0x1fb833(0x303)||_0xdefe[_0x1fb833(0x1df)]===_0x1fb833(0x1bb))await handleSDKOutput(_0xf8d028,_0xdefe);else{if(_0xf8d028[_0x1fb833(0x24b)]===0x0)console[_0x1fb833(0x2a2)](_0x1fb833(0x326)),console['error'](a30_0x367bf6[_0x1fb833(0x28b)](_0x1fb833(0x29e)));else for(const _0x589c26 of _0xf8d028){const _0x3d5e79=_0x589c26[_0x1fb833(0x31c)]?.[_0x1fb833(0x24b)]||0x0,_0x2a131a=_0x589c26[_0x1fb833(0x327)]?a30_0x367bf6[_0x1fb833(0x27c)](_0x1fb833(0x328)+_0x589c26[_0x1fb833(0x327)]):'',_0x46a71f=a30_0x367bf6[_0x1fb833(0x27c)]('\x20('+_0x3d5e79+_0x1fb833(0x237)+(_0x3d5e79!==0x1?'s':'')+')');console[_0x1fb833(0x2a2)]('\x20\x20'+_0x589c26[_0x1fb833(0x2e5)]+_0x2a131a+_0x46a71f),_0x589c26[_0x1fb833(0x2c9)]&&console['log'](_0x1fb833(0x262)+a30_0x367bf6[_0x1fb833(0x27c)](_0x589c26[_0x1fb833(0x2c9)]));}}return 0x0;}}function a30_0xecef(_0x39bdd1,_0x3c5de4){_0x39bdd1=_0x39bdd1-0x1a9;const _0x26e3fb=a30_0x26e3();let _0xecefd4=_0x26e3fb[_0x39bdd1];return _0xecefd4;}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x445dab(0x2e5)]='ps:pz:init';[a30_0x445dab(0x2c9)]=a30_0x445dab(0x28a);async[a30_0x445dab(0x305)](_0xc4587d){const _0x28000c=a30_0x445dab,{options:_0x51234c,args:_0x104b90}=_0xc4587d,_0x43d04e=_0x104b90[0x0]||_0x51234c[_0x28000c(0x1c2)];if(!_0x43d04e)return showParentSegmentNotSetError(_0x28000c(0x2f0)+_0x28000c(0x255)),0x1;const _0x2d8b5f=resolveYamlFile(_0x43d04e);if(!existsSync(_0x2d8b5f))return showFileNotFoundError(_0x2d8b5f,_0x43d04e),0x1;let _0x3138fc;try{_0x3138fc=readFileSync(_0x2d8b5f,_0x28000c(0x22b));}catch(_0x4e7c13){const _0x4dea16=_0x4e7c13 instanceof Error?_0x4e7c13[_0x28000c(0x24a)]:String(_0x4e7c13);return console['error'](_0x28000c(0x32e)+_0x4dea16),0x1;}let _0x1d3014;try{_0x1d3014=parseDef(_0x3138fc);}catch(_0x470b41){const _0xabca22=_0x470b41 instanceof Error?_0x470b41[_0x28000c(0x24a)]:String(_0x470b41);return console[_0x28000c(0x31a)](a30_0x367bf6[_0x28000c(0x251)]('Error\x20parsing\x20YAML:\x20'+_0xabca22)),0x1;}if(_0x1d3014[_0x28000c(0x2fb)]&&_0x1d3014['personalization_services']['length']>0x0)return console['error'](a30_0x367bf6['yellow'](_0x28000c(0x215)+_0x2d8b5f)),console[_0x28000c(0x31a)](a30_0x367bf6[_0x28000c(0x27c)](_0x28000c(0x267)+_0x1d3014[_0x28000c(0x2fb)][_0x28000c(0x24b)]+_0x28000c(0x23c))),0x1;!_0x1d3014['realtime']&&(_0x1d3014[_0x28000c(0x2fa)]={'events':[{'name':_0x28000c(0x23e),'source_table':'<database>.<table>'}],'attributes':[{'name':_0x28000c(0x1f8),'type':'single'}],'id_stitching':{'primary_key':_0x1d3014['master']['table']==='customers'?'td_client_id':'user_id'}});_0x1d3014[_0x28000c(0x2fb)]=[{'name':_0x28000c(0x317),'description':_0x28000c(0x1d6),'trigger_event':_0x28000c(0x23e),'sections':[{'name':_0x28000c(0x287),'criteria':'true','attributes':[_0x28000c(0x1f8)]}]}];const _0x22561b=serializeDef(_0x1d3014);return writeFileSync(_0x2d8b5f,_0x22561b,_0x28000c(0x22b)),console[_0x28000c(0x31a)](a30_0x367bf6[_0x28000c(0x335)]('✔')+_0x28000c(0x271)+a30_0x367bf6[_0x28000c(0x28b)](_0x2d8b5f)),(!_0x1d3014[_0x28000c(0x2fa)]||_0x3138fc[_0x28000c(0x203)](_0x28000c(0x270))===-0x1)&&console[_0x28000c(0x31a)](a30_0x367bf6['green']('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console[_0x28000c(0x31a)]('\x0a'+a30_0x367bf6[_0x28000c(0x27c)]('Next\x20steps:')),console[_0x28000c(0x31a)](_0x28000c(0x29d)+_0x2d8b5f+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x28000c(0x31a)]('\x20\x202.\x20Run\x20'+a30_0x367bf6[_0x28000c(0x27c)](_0x28000c(0x216)+_0x43d04e)+_0x28000c(0x245)),0x0;}}
1
+ const a30_0x1625b0=a30_0x1797;function a30_0x2904(){const _0xe4e221=['information_schema','Error:\x20Parent\x20segment\x20name\x20is\x20required','⚡\x20Enabled','displayPreviewHints','Updating\x20parent\x20segment\x20\x27','\x0a\x20\x20\x20\x20]','segment:parent:show','\x20+\x20[','Master\x20+\x20Attributes','YAML\x20file:\x20','all','Executing\x20parent\x20segment\x20query...','Error\x20reading\x20file:\x20','sourceTableError','yes','\x20=\x20','<database>.<table>','Schema\x20saved\x20to\x20','\x20to\x20configure\x20your\x20personalization\x20service','segment:parent:create','setJobId','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','Aborted.','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20[Job\x20ID:\x20','displayPreviewResults','displayValidateResults','ID\x20Stitching:','✔\x20No\x20changes\x20-\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','\x20RT\x20configuration\x20is\x20valid','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','data','errors','Listing\x20parent\x20segments\x20matching\x20\x27','execute','output','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x20kill','Listing\x20personalization\x20services\x20for\x20\x27','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','events','idStitching','column','\x5c$&','Site:\x20','Error:\x20File\x20not\x20found:\x20','jsonl','sampleData','Validating\x20RT\x20configuration...','\x0a✔\x20Workflow\x20started','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Overwrite\x20\x27','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','replace','workflowAttemptId','message','keys','\x20\x20\x20\x20\x20\x20','description','apply','trim','Personalization:','text','Preview:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','green','indexOf','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Apply\x20changes\x20to\x20\x27','name','\x20\x20\x20\x20','columns','Available\x20behaviors:','\x20No\x20changes\x20-\x20','totalEvents','join','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','listFields','\x20total','scheduleOption','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','red','Options:\x0a','/\x20directory.\x0a','\x27\x20and\x20run\x20workflow?','runParent','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','type','segment:parent:pull','parent_id','valid','ignore','yellow','\x20--behavior\x20\x22<name>\x22','\x20rows\x20','✔\x20Renamed\x20directory\x20to\x20','ps:rt:list','attributes','28APWnki','workflowId','Listing\x20fields\x20for\x20\x27','td_client_id','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','stats','addAttributesFile','schemaError','Database:\x20','in\x20','Fetching\x20sample\x20data...','verbose','Creating','workflowSessionId','\x27\x20with\x20ID:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','interval','\x0a\x20\x20]\x0a}\x0a','Next\x20steps:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20\x20Columns:\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','site','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','utf-8','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','displayMasterInfo','darwin','\x20\x20Database:\x20','database','joinKey','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','RT\x202.0\x20Validate:','Columns:','session','updateParent','Create\x20parent\x20segment\x20\x27','query','\x20behaviors','table','page_view','displaySampleData','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','parent_segments','Errors:','parent_segment','toLowerCase','\x20field','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','/\x20and\x20','segment','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','list','filter','personalizationServices','repeat','2081850nLKYtn','localeCompare','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Analyzing\x20changes...','run','pullParentYaml','getParentFull','label','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','population','Status:','trigger_event','segment:parent:run','Master\x20Table','No\x20RT-enabled\x20parent\x20segments\x20found','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Get\x20SQL\x20query\x20for\x20parent\x20segment','parentSegment','last_page_viewed','List\x20available\x20fields\x20for\x20segmentation','attribute','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','ps:rt:validate','Error:\x20--database\x20and\x20--table\x20are\x20required','Customers:','{\x0a\x20\x20\x22database\x22:\x20\x22','Fetching\x20behavior\x20list...','allValid','realtime','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Created','.yaml','\x0a\x20\x20\x20\x20}','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','toFixed','No\x20parent\x20segments\x20match\x20pattern:\x20','attributesFile','✔\x20Created\x20parent\x20segment\x20\x27','customers','Events:','\x0aNew\x20parent\x20segment\x20\x27','\x20\x20Tables:\x201\x20customers\x20+\x20','bold','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','addBehaviorsFile','Updated','3841569MtvqPN','dim','631470FLqGez','Creating\x20parent\x20segment\x20\x27','Error:','.yml','getOutputDatabaseName','\x27...','status','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','customerGroup','Error\x20parsing\x20YAML:\x20','column_type','Join\x20on:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','getParentSQL','json','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20--attribute\x20\x22','enriched','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','enabled','\x20Added\x20RT\x202.0\x20template\x20section','personalization_services','\x20service(s)\x20configured','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','3252SOxGCn','ps:pz:list','behavior_','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','sort','matchedCount','audienceId','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','displayBehaviorsStats','Behavior:','/attempt/','4627707HrdgBv','\x20section','RT\x202.0:','format','stop','tdx\x20ps\x20preview\x20','/app/workflows/','number','Available\x20attributes:','ps:pz:init','Show\x20parent\x20segment\x20schema\x20(column\x20types)','rowCount','customerPercent','isDirectory','/app/dw/parentSegments/','length','web','validateParentYaml','timezone','\x20RT-enabled\x20parent\x20segment','endsWith','\x20rows)','test','true','displayColumns','Resolving\x20parent\x20segment\x20\x27','primaryKey','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','SELECT\x20*\x20FROM\x20(\x0a','Options:','foreignKey','formatSchemaJson','sourceTableValid','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','👥\x20','\x0aChanges\x20to\x20\x27','/\x20→\x20','738570mRWreN','Listing\x20parent\x20segments...','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','1630qCmowR','customersWithEvents','toLocaleString','Fetching\x20SQL\x20for\x20\x27','Coverage:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Default','Validate:','Session:','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','push','\x0a⚠️\x20\x20Migrating:\x20','\x0aError:','\x20parent\x20segment\x20\x27','limit','Parent\x20segment:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','✔\x20Found\x20','\x20--behavior\x20\x22','/\x20directories\x20exist.','SQL\x20query:\x0a','coveragePercent','Personalization\x20service\x20description','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x22,\x20\x22type\x22:\x20\x22','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','getBehaviorNames','Source:','⚡\x20Not\x20enabled','use','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','map','unref','scheduleType','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20trigger=','segment:parent:update','No\x20personalization\x20services\x20configured','Fetching\x20parent\x20segment\x20\x27','Pattern:\x20','Join:','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','segment:parent:validate','displaySummary','List\x20parent\x20segments','\x20Context\x20set:\x20','displayAttributesStats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','Found\x20YAML\x20file:\x20','FINISHED','\x20\x20No\x20sample\x20data\x20available','realtime:','Audience\x20ID:','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20Configuration\x20is\x20valid','Error:\x20--attribute\x20requires\x20a\x20name\x0a','cyan','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','using\x20the\x20default\x20path:\x20','/sessions/','reduce','sections','\x20parent\x20segment','SELECT\x20*\x20FROM\x20','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','segment:parent:push','user_id','\x20\x20\x20\x20-\x20','My\x20Service','string','To\x20view\x20sample\x20data:','log','\x20configured','behaviors','Fetching\x20customers\x20schema...','Output\x20file:\x20','Updating','column_name','153159dquIWe','start','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','segment:parent:view','resolveParentId','`\x20to\x20download\x20the\x20configuration\x20first','previewParentYaml','\x20tdx\x20wf\x20attempt\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','platform','pushParentYaml','segment:parent:sql','behavior','To\x20cancel:','addBehaviors','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','master','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','tdx\x20ps\x20push\x20','error','8mWyImU','Attributes','collectSchema','schemaValid','Attribute:','\x0aChanges\x20to\x20apply\x20to\x20\x27','match','-1d'];a30_0x2904=function(){return _0xe4e221;};return a30_0x2904();}(function(_0x615dd4,_0x1eb28b){const _0x36c7a5=a30_0x1797,_0x35ee0f=_0x615dd4();while(!![]){try{const _0x3d1b93=parseInt(_0x36c7a5(0x343))/0x1+parseInt(_0x36c7a5(0x28d))/0x2*(-parseInt(_0x36c7a5(0x209))/0x3)+parseInt(_0x36c7a5(0x313))/0x4*(parseInt(_0x36c7a5(0x346))/0x5)+parseInt(_0x36c7a5(0x2f9))/0x6+parseInt(_0x36c7a5(0x31e))/0x7+parseInt(_0x36c7a5(0x21e))/0x8*(-parseInt(_0x36c7a5(0x2f7))/0x9)+parseInt(_0x36c7a5(0x2c7))/0xa;if(_0x3d1b93===_0x1eb28b)break;else _0x35ee0f['push'](_0x35ee0f['shift']());}catch(_0x6f3049){_0x35ee0f['push'](_0x35ee0f['shift']());}}}(a30_0x2904,0xcc3cc));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x1a4f96 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x45752c from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';function a30_0x1797(_0x43a705,_0x59d10e){_0x43a705=_0x43a705-0x1ec;const _0x2904f7=a30_0x2904();let _0x1797cf=_0x2904f7[_0x43a705];return _0x1797cf;}import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a30_0x1625b0(0x2b9),LEGACY_PARENT_SEGMENT_DIR=a30_0x1625b0(0x2bb);function openBrowser(_0x2e8042){const _0x2ef870=a30_0x1625b0,_0x532ee2=process[_0x2ef870(0x213)],_0x7b5a92=_0x532ee2===_0x2ef870(0x2a9)?'open':_0x532ee2==='win32'?'start':'xdg-open';spawn(_0x7b5a92,[_0x2e8042],{'detached':!![],'stdio':_0x2ef870(0x286)})[_0x2ef870(0x369)]();}function migrateLegacyDirectory(){const _0x1e623e=a30_0x1625b0;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1f4b1a=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1f4b1a[_0x1e623e(0x32b)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1e623e(0x21d)](a30_0x45752c[_0x1e623e(0x287)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x1e623e(0x2bf)+PARENT_SEGMENT_DIR+_0x1e623e(0x35a))),console[_0x1e623e(0x21d)](a30_0x45752c[_0x1e623e(0x2f8)](_0x1e623e(0x2a1)+LEGACY_PARENT_SEGMENT_DIR+_0x1e623e(0x27e))),![];console[_0x1e623e(0x21d)](a30_0x45752c[_0x1e623e(0x287)](_0x1e623e(0x352)+LEGACY_PARENT_SEGMENT_DIR+_0x1e623e(0x342)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x1e623e(0x21d)](a30_0x45752c[_0x1e623e(0x26b)](_0x1e623e(0x28a)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2188c2){const _0x33a923=_0x2188c2 instanceof Error?_0x2188c2[_0x1e623e(0x261)]:String(_0x2188c2);return console[_0x1e623e(0x21d)](a30_0x45752c[_0x1e623e(0x27c)](_0x1e623e(0x1ef)+_0x33a923+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x1625b0(0x2cb)](_0x1ffaa1){const _0xc7daec=a30_0x1625b0;return migrateLegacyDirectory(),super[_0xc7daec(0x2cb)](_0x1ffaa1);}}function resolveYamlFile(_0x3ba022){const _0x57a4aa=a30_0x1625b0;if(_0x3ba022[_0x57a4aa(0x332)]('.yml')||_0x3ba022[_0x57a4aa(0x332)](_0x57a4aa(0x2e7)))return _0x3ba022;return a30_0x1a4f96[_0x57a4aa(0x276)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3ba022)+_0x57a4aa(0x2fc));}function formatProgressMessage(_0x1a1a8a){const _0x17c6ce=a30_0x1625b0,_0x5eda43=_0x1a1a8a[_0x17c6ce(0x224)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5eda43){const [,_0x55105b,_0x4c95a4,_0x551a0b='']=_0x5eda43;return a30_0x45752c[_0x17c6ce(0x2f8)](_0x55105b+':')+'\x20'+_0x4c95a4+a30_0x45752c[_0x17c6ce(0x2f8)](_0x551a0b);}return a30_0x45752c[_0x17c6ce(0x2f8)](_0x1a1a8a);}function showFileNotFoundError(_0x13d08e,_0x32a70e){const _0x168206=a30_0x1625b0;console[_0x168206(0x21d)](a30_0x45752c[_0x168206(0x27c)](_0x168206(0x255)+_0x13d08e+'\x0a')),console[_0x168206(0x21d)](a30_0x45752c[_0x168206(0x1f2)](_0x168206(0x2a3)+_0x32a70e+_0x168206(0x20e)));}function displayRealtimeValidation(_0x3bbc3c){const _0x484924=a30_0x1625b0;if(!_0x3bbc3c['realtime'])return;const _0x3b2dc3=_0x3bbc3c['realtime'],_0x13283f=_0x3b2dc3[_0x484924(0x30d)]?a30_0x45752c[_0x484924(0x26b)](_0x484924(0x228)):a30_0x45752c[_0x484924(0x287)](_0x484924(0x365));console['error']('\x0a'+a30_0x45752c[_0x484924(0x2f8)](_0x484924(0x320))+'\x20'+_0x13283f);if(_0x3b2dc3[_0x484924(0x250)]&&_0x3b2dc3[_0x484924(0x250)]['length']>0x0){console[_0x484924(0x21d)]('\x20\x20'+a30_0x45752c[_0x484924(0x2f8)](_0x484924(0x2ef))+'\x20'+_0x3b2dc3[_0x484924(0x250)][_0x484924(0x32d)]+'\x20configured');for(const _0x4b0b15 of _0x3b2dc3[_0x484924(0x250)]){const _0x108be6=_0x4b0b15[_0x484924(0x33e)]===![]?a30_0x45752c['red']('✘'):a30_0x45752c[_0x484924(0x26b)]('✔');console['error']('\x20\x20\x20\x20'+_0x108be6+'\x20'+_0x4b0b15[_0x484924(0x270)]),_0x4b0b15['sourceTableError']&&console[_0x484924(0x21d)](_0x484924(0x263)+a30_0x45752c[_0x484924(0x27c)](_0x4b0b15[_0x484924(0x233)]));}}if(_0x3b2dc3[_0x484924(0x28c)]&&_0x3b2dc3[_0x484924(0x28c)][_0x484924(0x32d)]>0x0){console[_0x484924(0x21d)]('\x20\x20'+a30_0x45752c[_0x484924(0x2f8)]('Attributes:')+'\x20'+_0x3b2dc3[_0x484924(0x28c)][_0x484924(0x32d)]+_0x484924(0x203));for(const _0x5ed7bb of _0x3b2dc3[_0x484924(0x28c)]){const _0x42eea6=_0x5ed7bb[_0x484924(0x285)]?a30_0x45752c[_0x484924(0x26b)]('✔'):a30_0x45752c[_0x484924(0x27c)]('✘');console['error'](_0x484924(0x271)+_0x42eea6+'\x20'+_0x5ed7bb[_0x484924(0x270)]+'\x20'+a30_0x45752c[_0x484924(0x2f8)]('('+_0x5ed7bb[_0x484924(0x282)]+')'));}}if(_0x3b2dc3[_0x484924(0x251)]){const _0x17be62=_0x3b2dc3['idStitching']['stitchingKeys']?.[_0x484924(0x32d)]?_0x484924(0x22d)+_0x3b2dc3['idStitching']['stitchingKeys']['join'](',\x20')+']':'';console['error']('\x20\x20'+a30_0x45752c[_0x484924(0x2f8)](_0x484924(0x241))+'\x20'+_0x3b2dc3['idStitching'][_0x484924(0x338)]+_0x17be62);}if(_0x3b2dc3[_0x484924(0x2c5)]&&_0x3b2dc3[_0x484924(0x2c5)][_0x484924(0x32d)]>0x0){console['error']('\x20\x20'+a30_0x45752c['dim'](_0x484924(0x267))+'\x20'+_0x3b2dc3[_0x484924(0x2c5)][_0x484924(0x32d)]+'\x20service'+(_0x3b2dc3[_0x484924(0x2c5)][_0x484924(0x32d)]!==0x1?'s':''));for(const _0x13f69d of _0x3b2dc3[_0x484924(0x2c5)]){console[_0x484924(0x21d)](_0x484924(0x1fe)+_0x13f69d['name']);}}}function showParentSegmentNotSetError(_0x3cd136){const _0x52fa60=a30_0x1625b0;console[_0x52fa60(0x21d)](a30_0x45752c['yellow'](_0x52fa60(0x246))),console[_0x52fa60(0x21d)](_0x3cd136);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x1625b0(0x270)]='segment:parent:list';[a30_0x1625b0(0x264)]=a30_0x1625b0(0x377);async[a30_0x1625b0(0x24a)](_0x2673dd){const _0x17dc34=a30_0x1625b0,{options:_0x94ebaa,args:_0x4d9bc8,tdx:_0x1402e3}=_0x2673dd,_0x368799=_0x4d9bc8[0x0];_0x94ebaa[_0x17dc34(0x299)]&&(console[_0x17dc34(0x21d)](_0x17dc34(0x254)+_0x94ebaa[_0x17dc34(0x2a4)]),_0x368799&&console[_0x17dc34(0x21d)](_0x17dc34(0x372)+_0x368799));const _0x1dd18a=await withSpinner(_0x368799?_0x17dc34(0x249)+_0x368799+_0x17dc34(0x2fe):_0x17dc34(0x344),()=>_0x1402e3[_0x17dc34(0x2c0)]['listParents'](),{'verbose':_0x94ebaa[_0x17dc34(0x299)]});let _0x80ad4=_0x1dd18a[_0x17dc34(0x247)];if(_0x368799){const _0x1e36ca=_0x368799[_0x17dc34(0x25f)](/[.+^${}()|[\]\\]/g,_0x17dc34(0x253))[_0x17dc34(0x25f)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x48c064=new RegExp('^'+_0x1e36ca+'$','i');_0x80ad4=_0x80ad4['filter'](_0x1b2d06=>_0x48c064[_0x17dc34(0x334)](_0x1b2d06[_0x17dc34(0x28c)][_0x17dc34(0x270)]));}_0x80ad4[_0x17dc34(0x317)]((_0x40fee3,_0x264c9c)=>_0x40fee3[_0x17dc34(0x28c)]['name'][_0x17dc34(0x2c8)](_0x264c9c[_0x17dc34(0x28c)]['name'])),console[_0x17dc34(0x21d)](_0x17dc34(0x358)+_0x80ad4[_0x17dc34(0x32d)]+_0x17dc34(0x1f8)+(_0x80ad4[_0x17dc34(0x32d)]!==0x1?'s':''));const _0x584530=_0x302820=>{const _0x5ea471=_0x17dc34;return getConsoleNextUrl(_0x94ebaa[_0x5ea471(0x2a4)],_0x5ea471(0x32c)+_0x302820);};if(_0x94ebaa[_0x17dc34(0x321)]==='json'||_0x94ebaa[_0x17dc34(0x321)]==='jsonl'){const _0x508302=_0x80ad4['map'](_0x329978=>({..._0x329978,'url':_0x584530(_0x329978['id'])}));await handleSDKOutput(_0x508302,_0x94ebaa);}else{if(_0x80ad4[_0x17dc34(0x32d)]===0x0)_0x368799?console[_0x17dc34(0x202)](_0x17dc34(0x2eb)+_0x368799):console[_0x17dc34(0x202)]('No\x20parent\x20segments\x20found');else for(const _0x552ebd of _0x80ad4){const _0x1fe1c5=_0x552ebd[_0x17dc34(0x28c)][_0x17dc34(0x2d0)]?a30_0x45752c['dim']('\x20('+formatRows(_0x552ebd[_0x17dc34(0x28c)][_0x17dc34(0x2d0)])+')'):'',_0x57900d=hyperlink(_0x552ebd[_0x17dc34(0x28c)][_0x17dc34(0x270)],_0x584530(_0x552ebd['id']));console['log'](_0x17dc34(0x340)+_0x57900d+_0x1fe1c5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x239);[a30_0x1625b0(0x264)]=a30_0x1625b0(0x1f3);async['execute'](_0x49dcaf){const _0x23f69b=a30_0x1625b0,{options:_0x418894,args:_0x34908b,tdx:_0x36d781}=_0x49dcaf;console[_0x23f69b(0x21d)](_0x23f69b(0x1fb)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x23f69b(0x27b));const _0x452d18=_0x418894;if(_0x34908b[_0x23f69b(0x32d)]===0x0)return console[_0x23f69b(0x21d)](a30_0x45752c['red'](_0x23f69b(0x227))),console[_0x23f69b(0x21d)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x1fd415=_0x34908b[0x0];if(!_0x452d18[_0x23f69b(0x2ab)]||!_0x452d18[_0x23f69b(0x2b5)])return console[_0x23f69b(0x21d)](_0x23f69b(0x2df)),console[_0x23f69b(0x21d)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x452d18[_0x23f69b(0x299)]&&(console[_0x23f69b(0x21d)]('Site:\x20'+_0x452d18[_0x23f69b(0x2a4)]),console[_0x23f69b(0x21d)]('Name:\x20'+_0x1fd415),console[_0x23f69b(0x21d)](_0x23f69b(0x296)+_0x452d18['database']),console[_0x23f69b(0x21d)]('Table:\x20'+_0x452d18[_0x23f69b(0x2b5)]));const _0x55e9cd=await loadJSONFromOptions(_0x452d18['attributes'],_0x452d18[_0x23f69b(0x2ec)]),_0x2b1bd5=await loadJSONFromOptions(_0x452d18['behaviors'],_0x452d18['behaviorsFile']),_0x14b810=await loadJSONFromOptions(_0x452d18[_0x23f69b(0x301)],_0x452d18['customerGroupFile']),_0x1ad597={'name':_0x1fd415,'description':_0x452d18[_0x23f69b(0x264)],'scheduleType':_0x452d18[_0x23f69b(0x36a)],'scheduleOption':_0x452d18[_0x23f69b(0x27a)],'timezone':_0x452d18['timezone'],'master':{'parentDatabaseName':_0x452d18[_0x23f69b(0x2ab)],'parentTableName':_0x452d18[_0x23f69b(0x2b5)]},'attributes':_0x55e9cd,'behaviors':_0x2b1bd5,'customerGroup':_0x14b810},_0x4899cb=await withSpinner(_0x23f69b(0x2fa)+_0x1fd415+_0x23f69b(0x2fe),()=>_0x36d781['segment']['createParent'](_0x1ad597),{'verbose':_0x418894[_0x23f69b(0x299)]}),_0x17ba9f=_0x4899cb['data'];return console['error'](_0x23f69b(0x2ed)+_0x17ba9f['name']+_0x23f69b(0x29c)+_0x17ba9f['id']),await handleSDKOutput([_0x17ba9f],_0x418894),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x36f);[a30_0x1625b0(0x264)]=a30_0x1625b0(0x26a);async['execute'](_0x2ab95c){const _0x414f0c=a30_0x1625b0,{options:_0x43bdfb,args:_0x1c4b48,tdx:_0x35dbd7}=_0x2ab95c;console['error'](_0x414f0c(0x23d)+_0x414f0c(0x211)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5ae77b=_0x43bdfb;if(_0x1c4b48[_0x414f0c(0x32d)]===0x0)return console['error'](a30_0x45752c[_0x414f0c(0x27c)](_0x414f0c(0x227))),console[_0x414f0c(0x21d)](_0x414f0c(0x305)),0x1;const _0x147a73=_0x1c4b48[0x0];_0x5ae77b[_0x414f0c(0x299)]&&(console[_0x414f0c(0x21d)](_0x414f0c(0x254)+_0x5ae77b['site']),console[_0x414f0c(0x21d)]('Parent\x20segment:\x20'+_0x147a73));const _0x15e894=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x147a73+'\x27...',()=>_0x35dbd7[_0x414f0c(0x2c0)][_0x414f0c(0x2cd)](_0x147a73),{'verbose':_0x5ae77b[_0x414f0c(0x299)]}),_0x30e8dd=_0x15e894[_0x414f0c(0x247)],_0x56563c=await loadJSONFromOptions(_0x5ae77b['addAttributes'],_0x5ae77b[_0x414f0c(0x294)]),_0x5db3fb=await loadJSONFromOptions(_0x5ae77b[_0x414f0c(0x218)],_0x5ae77b[_0x414f0c(0x2f5)]),_0x4f7f1d={'name':_0x30e8dd['name'],'description':_0x5ae77b[_0x414f0c(0x264)]!==undefined?_0x5ae77b[_0x414f0c(0x264)]:_0x30e8dd[_0x414f0c(0x264)],'scheduleType':_0x5ae77b[_0x414f0c(0x36a)]!==undefined?_0x5ae77b['scheduleType']:_0x30e8dd['scheduleType'],'scheduleOption':_0x5ae77b[_0x414f0c(0x27a)]!==undefined?_0x5ae77b[_0x414f0c(0x27a)]:_0x30e8dd['scheduleOption'],'timezone':_0x5ae77b['timezone']!==undefined?_0x5ae77b['timezone']:_0x30e8dd[_0x414f0c(0x330)],'master':_0x30e8dd[_0x414f0c(0x21a)],'attributes':_0x56563c?[..._0x30e8dd[_0x414f0c(0x28c)]||[],..._0x56563c]:_0x30e8dd['attributes'],'behaviors':_0x5db3fb?[..._0x30e8dd[_0x414f0c(0x204)]||[],..._0x5db3fb]:_0x30e8dd[_0x414f0c(0x204)],'customerGroup':_0x30e8dd[_0x414f0c(0x301)]},_0x5b3e0f=await withSpinner(_0x414f0c(0x22a)+_0x147a73+_0x414f0c(0x2fe),()=>_0x35dbd7['segment'][_0x414f0c(0x2b1)](_0x147a73,_0x4f7f1d),{'verbose':_0x5ae77b[_0x414f0c(0x299)]}),_0x15f5b7=_0x5b3e0f[_0x414f0c(0x247)];return console[_0x414f0c(0x21d)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x15f5b7[_0x414f0c(0x270)]+'\x27'),await handleSDKOutput([_0x15f5b7],_0x5ae77b),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x283);['description']=a30_0x1625b0(0x2f3);async[a30_0x1625b0(0x24a)](_0x2c8f54){const _0x3c739b=a30_0x1625b0,{options:_0x211d1c,args:_0x49bfc3,tdx:_0xf87be6}=_0x2c8f54,_0x15a3af=_0x211d1c,_0x430048=_0x49bfc3[0x0]||_0x211d1c[_0x3c739b(0x2d9)];if(!_0x430048)return showParentSegmentNotSetError(_0x3c739b(0x2e9)+_0x3c739b(0x308)),0x1;if(_0x15a3af[_0x3c739b(0x366)]&&_0x15a3af[_0x3c739b(0x24b)])return console['error'](a30_0x45752c[_0x3c739b(0x27c)](_0x3c739b(0x2cf))),console[_0x3c739b(0x21d)](a30_0x45752c[_0x3c739b(0x2f8)](_0x3c739b(0x300))),console[_0x3c739b(0x21d)](a30_0x45752c[_0x3c739b(0x2f8)](_0x3c739b(0x1f4)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x3c739b(0x21d)](a30_0x45752c[_0x3c739b(0x1f2)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x3d3773=_0x15a3af['output']||a30_0x1a4f96[_0x3c739b(0x276)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x430048)+_0x3c739b(0x2fc));_0x15a3af[_0x3c739b(0x299)]&&(console[_0x3c739b(0x21d)]('Site:\x20'+_0x15a3af[_0x3c739b(0x2a4)]),console['error']('Parent\x20segment:\x20'+_0x430048),console[_0x3c739b(0x21d)](_0x3c739b(0x206)+_0x3d3773));const _0x349a7f=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x430048+'\x27...',()=>_0xf87be6[_0x3c739b(0x2c0)][_0x3c739b(0x2cc)](_0x430048),{'verbose':_0x15a3af[_0x3c739b(0x299)]}),_0x32a7ea=_0x349a7f[_0x3c739b(0x247)];if(existsSync(_0x3d3773)){const _0x18e5f3=readFileSync(_0x3d3773,_0x3c739b(0x2a6)),_0x222db7=generateDiff(_0x18e5f3,_0x32a7ea);if(!hasChanges(_0x222db7))console[_0x3c739b(0x21d)](a30_0x45752c['green']('✔')+_0x3c739b(0x274)+a30_0x45752c['cyan'](_0x3d3773)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x3c739b(0x21d)](_0x3c739b(0x341)+_0x3d3773+'\x27:'),console[_0x3c739b(0x21d)]('─'[_0x3c739b(0x2c6)](0x3c)),console[_0x3c739b(0x21d)](formatDiffWithColors(_0x222db7)),console[_0x3c739b(0x21d)]('─'['repeat'](0x3c));if(!_0x15a3af[_0x3c739b(0x234)]){if(!isInteractive())return console[_0x3c739b(0x21d)](a30_0x45752c[_0x3c739b(0x27c)](_0x3c739b(0x353)),_0x3c739b(0x2c9)),console[_0x3c739b(0x21d)](a30_0x45752c[_0x3c739b(0x2f8)](_0x3c739b(0x21b))),0x1;const _0x2cb013=await confirmKey(_0x3c739b(0x25b)+_0x3d3773+'\x27?');if(!_0x2cb013)return console[_0x3c739b(0x21d)](a30_0x45752c[_0x3c739b(0x287)](_0x3c739b(0x23c))),0x1;}writeFileSync(_0x3d3773,_0x32a7ea,_0x3c739b(0x2a6)),console['error'](a30_0x45752c[_0x3c739b(0x26b)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x45752c[_0x3c739b(0x1f2)](_0x3d3773));}}else{const _0x53074a=a30_0x1a4f96['dirname'](_0x3d3773);!existsSync(_0x53074a)&&mkdirSync(_0x53074a,{'recursive':!![]}),writeFileSync(_0x3d3773,_0x32a7ea,'utf-8'),console[_0x3c739b(0x21d)](a30_0x45752c['green']('✔')+_0x3c739b(0x33f)+a30_0x45752c[_0x3c739b(0x1f2)](_0x3d3773));}return saveSessionContext({'parent_segment':_0x430048},_0x15a3af[_0x3c739b(0x2b0)]),console[_0x3c739b(0x21d)](a30_0x45752c[_0x3c739b(0x26b)]('✔')+_0x3c739b(0x378)+a30_0x45752c['dim'](_0x3c739b(0x2bb))+_0x3c739b(0x235)+a30_0x45752c['cyan'](_0x430048)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a30_0x1625b0(0x1fc);[a30_0x1625b0(0x264)]=a30_0x1625b0(0x2e5);async['execute'](_0x165e53){const _0x5460b6=a30_0x1625b0,{options:_0x5116d7,args:_0x5d922d,tdx:_0x4ffd2c}=_0x165e53,_0x1c8dfd=_0x5116d7,_0x55c35b=_0x5d922d[0x0]||_0x5116d7[_0x5460b6(0x2d9)];if(!_0x55c35b)return showParentSegmentNotSetError(_0x5460b6(0x36b)+_0x5460b6(0x34b)),0x1;const _0x2557b4=resolveYamlFile(_0x55c35b);if(!existsSync(_0x2557b4))return showFileNotFoundError(_0x2557b4,_0x55c35b),0x1;_0x1c8dfd[_0x5460b6(0x299)]&&(console[_0x5460b6(0x21d)](_0x5460b6(0x254)+_0x1c8dfd[_0x5460b6(0x2a4)]),console[_0x5460b6(0x21d)](_0x5460b6(0x22f)+_0x2557b4));let _0x332931;try{_0x332931=readFileSync(_0x2557b4,_0x5460b6(0x2a6));}catch(_0x3069b2){const _0x354e87=_0x3069b2 instanceof Error?_0x3069b2[_0x5460b6(0x261)]:String(_0x3069b2);return console[_0x5460b6(0x21d)]('Error\x20reading\x20file:\x20'+_0x354e87),0x1;}const _0x2a19b5=await withSpinner(_0x5460b6(0x2ca),()=>_0x4ffd2c[_0x5460b6(0x2c0)][_0x5460b6(0x214)](_0x332931),{'verbose':_0x1c8dfd[_0x5460b6(0x299)]}),_0x2236dd=_0x2a19b5[_0x5460b6(0x247)],{isNew:_0x202c18,name:_0x341a9e,hasChanges:_0x38449b,diffFormatted:_0x66f83b}=_0x2236dd;if(!_0x38449b)return console[_0x5460b6(0x21d)](_0x5460b6(0x242)+_0x341a9e+_0x5460b6(0x243)),0x0;_0x202c18?console[_0x5460b6(0x21d)](_0x5460b6(0x2f0)+_0x341a9e+'\x27:'):console['error'](_0x5460b6(0x223)+_0x341a9e+'\x27:');console[_0x5460b6(0x21d)]('─'[_0x5460b6(0x2c6)](0x3c)),console[_0x5460b6(0x21d)](_0x66f83b),console[_0x5460b6(0x21d)]('─'[_0x5460b6(0x2c6)](0x3c));const _0x11a306=_0x202c18?_0x5460b6(0x2b2)+_0x341a9e+'\x27?':_0x5460b6(0x26f)+_0x341a9e+'\x27?';if(!_0x1c8dfd[_0x5460b6(0x234)]){if(!isInteractive())return console[_0x5460b6(0x21d)](a30_0x45752c[_0x5460b6(0x27c)](_0x5460b6(0x353)),_0x5460b6(0x2c9)),console[_0x5460b6(0x21d)](a30_0x45752c[_0x5460b6(0x2f8)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x291519=await confirmKey(_0x11a306);if(!_0x291519)return console[_0x5460b6(0x21d)](a30_0x45752c[_0x5460b6(0x287)](_0x5460b6(0x23c))),0x1;}const _0x3e0e51=_0x202c18?_0x5460b6(0x29a):_0x5460b6(0x207),_0x3a11e4=await withSpinner(_0x3e0e51+_0x5460b6(0x354)+_0x341a9e+_0x5460b6(0x2fe),()=>_0x2236dd[_0x5460b6(0x265)](),{'verbose':_0x1c8dfd[_0x5460b6(0x299)]}),_0x174038=_0x3a11e4[_0x5460b6(0x247)],_0x5e28f0=getConsoleNextUrl(_0x1c8dfd[_0x5460b6(0x2a4)],_0x5460b6(0x32c)+_0x174038['id']),_0x114f4c=_0x202c18?_0x5460b6(0x2e6):_0x5460b6(0x2f6);return console[_0x5460b6(0x21d)]('✔\x20'+_0x114f4c+_0x5460b6(0x354)+_0x174038[_0x5460b6(0x270)]+'\x27'),console['error']('\x20\x20'+_0x5e28f0),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x375);[a30_0x1625b0(0x264)]=a30_0x1625b0(0x2c1);async[a30_0x1625b0(0x24a)](_0x2aa8e8){const _0x429e72=a30_0x1625b0,{options:_0x72ff52,args:_0x44b311,tdx:_0x103ee8}=_0x2aa8e8,_0x4d0f25=_0x72ff52,_0x35121f=_0x44b311[0x0]||_0x72ff52[_0x429e72(0x2d9)];if(!_0x35121f)return showParentSegmentNotSetError(_0x429e72(0x23b)+_0x429e72(0x2be)+'Options:\x0a'+_0x429e72(0x339)+_0x429e72(0x2ad)+_0x429e72(0x29d)),0x1;const _0x2de2b2=resolveYamlFile(_0x35121f);if(!existsSync(_0x2de2b2))return showFileNotFoundError(_0x2de2b2,_0x35121f),0x1;_0x4d0f25[_0x429e72(0x299)]&&(console[_0x429e72(0x21d)]('Site:\x20'+_0x4d0f25['site']),console[_0x429e72(0x21d)](_0x429e72(0x22f)+_0x2de2b2));let _0x5747e9;try{_0x5747e9=readFileSync(_0x2de2b2,_0x429e72(0x2a6));}catch(_0x50c313){const _0x95cff3=_0x50c313 instanceof Error?_0x50c313['message']:String(_0x50c313);return console[_0x429e72(0x21d)](_0x429e72(0x232)+_0x95cff3),0x1;}const _0x55a232=createCommandSpinner(a30_0x45752c[_0x429e72(0x2f8)]('Validating\x20configuration...'),{'verbose':_0x4d0f25[_0x429e72(0x299)]});_0x55a232[_0x429e72(0x20a)]();const _0x54e7ef={'onProgress':_0x46f0d0=>{const _0x1929f1=_0x429e72;_0x55a232[_0x1929f1(0x268)]=formatProgressMessage(_0x46f0d0);}};if(_0x4d0f25[_0x429e72(0x21a)])_0x54e7ef[_0x429e72(0x21a)]=!![];if(_0x4d0f25[_0x429e72(0x30a)])_0x54e7ef[_0x429e72(0x30a)]=!![];_0x4d0f25[_0x429e72(0x2dc)]&&(_0x54e7ef['attribute']=_0x4d0f25[_0x429e72(0x2dc)]);_0x4d0f25[_0x429e72(0x216)]&&(_0x54e7ef[_0x429e72(0x216)]=_0x4d0f25[_0x429e72(0x216)]);if(_0x4d0f25[_0x429e72(0x29e)])_0x54e7ef['interval']=_0x4d0f25[_0x429e72(0x29e)];let _0x45dc84;try{_0x45dc84=await _0x103ee8[_0x429e72(0x2c0)][_0x429e72(0x32f)](_0x5747e9,_0x54e7ef),_0x55a232[_0x429e72(0x322)]();}catch(_0x6b12a2){_0x55a232[_0x429e72(0x322)]();throw _0x6b12a2;}const _0x3b6f06=_0x4d0f25['interval']||_0x429e72(0x225);return this['displayValidateResults'](_0x45dc84,_0x54e7ef,_0x2de2b2,_0x3b6f06),_0x45dc84[_0x429e72(0x2e3)]?0x0:0x1;}[a30_0x1625b0(0x240)](_0x319d42,_0x2c0bcf,_0x3221e0,_0x5a9e29){const _0xef8470=a30_0x1625b0;console[_0xef8470(0x21d)]('\x0a'+a30_0x45752c[_0xef8470(0x2f2)](_0xef8470(0x34e))+'\x20'+_0x319d42['name']),console[_0xef8470(0x21d)]('═'[_0xef8470(0x2c6)](0x3c)),this[_0xef8470(0x2a8)](_0x319d42);if(typeof _0x2c0bcf[_0xef8470(0x2dc)]===_0xef8470(0x200)){this[_0xef8470(0x379)](_0x319d42),this[_0xef8470(0x376)](_0x319d42),this['displayPreviewHints'](_0x3221e0,_0x5a9e29,'attribute',_0x2c0bcf[_0xef8470(0x2dc)]);return;}if(_0x2c0bcf[_0xef8470(0x2dc)]===!![]){this[_0xef8470(0x379)](_0x319d42),this[_0xef8470(0x376)](_0x319d42),this[_0xef8470(0x229)](_0x3221e0,_0x5a9e29,_0xef8470(0x28c));return;}if(typeof _0x2c0bcf[_0xef8470(0x216)]===_0xef8470(0x200)){this[_0xef8470(0x31b)](_0x319d42,_0x5a9e29),this[_0xef8470(0x376)](_0x319d42),this['displayPreviewHints'](_0x3221e0,_0x5a9e29,'behavior',_0x2c0bcf['behavior']);return;}if(_0x2c0bcf[_0xef8470(0x216)]===!![]){this[_0xef8470(0x31b)](_0x319d42,_0x5a9e29),this[_0xef8470(0x376)](_0x319d42),this['displayPreviewHints'](_0x3221e0,_0x5a9e29,'behaviors');return;}this['displayAttributesStats'](_0x319d42),this[_0xef8470(0x31b)](_0x319d42,_0x5a9e29),this['displayRealtimeInfo'](_0x319d42),this['displaySummary'](_0x319d42),this['displayPreviewHints'](_0x3221e0,_0x5a9e29,_0xef8470(0x230));}['displayRealtimeInfo'](_0x19f37c){displayRealtimeValidation(_0x19f37c);}[a30_0x1625b0(0x229)](_0x42f557,_0xef317f,_0x5c49c6,_0x4cdc73){const _0x5f59e0=a30_0x1625b0;console[_0x5f59e0(0x21d)]('\x0a'+a30_0x45752c[_0x5f59e0(0x2f8)](_0x5f59e0(0x201)));const _0x1a93b4=_0xef317f!=='-1d'?'\x20--interval\x20'+_0xef317f:'';if(_0x5c49c6===_0x5f59e0(0x2dc)&&_0x4cdc73)console['error']('\x20\x20'+a30_0x45752c['dim'](_0x5f59e0(0x323)+_0x42f557+_0x5f59e0(0x309)+_0x4cdc73+'\x22'+_0x1a93b4));else{if(_0x5c49c6===_0x5f59e0(0x216)&&_0x4cdc73)console[_0x5f59e0(0x21d)]('\x20\x20'+a30_0x45752c[_0x5f59e0(0x2f8)]('tdx\x20ps\x20preview\x20'+_0x42f557+_0x5f59e0(0x359)+_0x4cdc73+'\x22'+_0x1a93b4));else(_0x5c49c6==='attributes'||_0x5c49c6===_0x5f59e0(0x230))&&console[_0x5f59e0(0x21d)]('\x20\x20'+a30_0x45752c[_0x5f59e0(0x2f8)](_0x5f59e0(0x323)+_0x42f557+'\x20--attribute\x20\x22<name>\x22'+_0x1a93b4));}(_0x5c49c6===_0x5f59e0(0x204)||_0x5c49c6===_0x5f59e0(0x230))&&console[_0x5f59e0(0x21d)]('\x20\x20'+a30_0x45752c[_0x5f59e0(0x2f8)]('tdx\x20ps\x20preview\x20'+_0x42f557+_0x5f59e0(0x288)+_0x1a93b4)),_0x5c49c6===_0x5f59e0(0x230)&&console[_0x5f59e0(0x21d)]('\x20\x20'+a30_0x45752c['dim'](_0x5f59e0(0x323)+_0x42f557+'\x20--enriched'+_0x1a93b4));}[a30_0x1625b0(0x2a8)](_0x190751){const _0x2801af=a30_0x1625b0,{master:_0x1ec464}=_0x190751,_0x2f282a=_0x1ec464[_0x2801af(0x221)]?a30_0x45752c['green']('✔'):a30_0x45752c[_0x2801af(0x27c)]('✘');console[_0x2801af(0x21d)]('\x0a'+a30_0x45752c['dim'](_0x2801af(0x2d4))),console[_0x2801af(0x21d)](_0x2f282a+'\x20'+a30_0x45752c[_0x2801af(0x2f2)](_0x1ec464[_0x2801af(0x2ab)]+'.'+_0x1ec464[_0x2801af(0x2b5)])),_0x1ec464['schemaValid']?_0x1ec464[_0x2801af(0x329)]!==undefined&&console[_0x2801af(0x21d)]('\x20\x20'+a30_0x45752c[_0x2801af(0x2f8)]('Rows:')+'\x20'+a30_0x45752c[_0x2801af(0x1f2)](formatRows(_0x1ec464['rowCount']))):console[_0x2801af(0x21d)]('\x20\x20'+a30_0x45752c['red'](_0x2801af(0x2fb))+'\x20'+_0x1ec464[_0x2801af(0x295)]);}[a30_0x1625b0(0x379)](_0x2ab679){const _0x583ba2=a30_0x1625b0;if(_0x2ab679[_0x583ba2(0x28c)][_0x583ba2(0x32d)]===0x0)return;console['error']('\x0a'+a30_0x45752c['dim'](_0x583ba2(0x21f)));for(const _0xdc110e of _0x2ab679['attributes']){const _0x4752af=_0xdc110e[_0x583ba2(0x221)]?a30_0x45752c['green']('✔'):a30_0x45752c[_0x583ba2(0x27c)]('✘');let _0x24e6a6='';if(_0xdc110e['schemaValid']&&_0xdc110e[_0x583ba2(0x318)]!==undefined&&_0xdc110e[_0x583ba2(0x35c)]!==undefined){const _0x1630d9=_0xdc110e['coveragePercent'][_0x583ba2(0x2ea)](0x1),_0x3dc8f1=_0xdc110e[_0x583ba2(0x35c)]>=0x50?a30_0x45752c[_0x583ba2(0x26b)]:_0xdc110e[_0x583ba2(0x35c)]>=0x32?a30_0x45752c['yellow']:a30_0x45752c[_0x583ba2(0x27c)];_0x24e6a6='\x20'+a30_0x45752c[_0x583ba2(0x2f8)](_0x583ba2(0x34a))+'\x20'+_0x3dc8f1(_0x1630d9+'%')+'\x20('+formatRows(_0xdc110e[_0x583ba2(0x318)])+_0x583ba2(0x333);}console[_0x583ba2(0x21d)](_0x4752af+'\x20'+a30_0x45752c['bold'](_0xdc110e[_0x583ba2(0x270)])+_0x24e6a6),console[_0x583ba2(0x21d)]('\x20\x20'+a30_0x45752c[_0x583ba2(0x2f8)](_0x583ba2(0x364))+'\x20'+a30_0x45752c[_0x583ba2(0x2f2)](_0xdc110e[_0x583ba2(0x2ab)]+'.'+_0xdc110e['table']));const _0x449f83=_0xdc110e[_0x583ba2(0x2ac)]===_0xdc110e[_0x583ba2(0x33c)]?a30_0x45752c[_0x583ba2(0x2f8)]('Join\x20on:')+'\x20'+_0xdc110e['joinKey']:a30_0x45752c[_0x583ba2(0x2f8)](_0x583ba2(0x373))+'\x20'+_0xdc110e[_0x583ba2(0x2ac)]+_0x583ba2(0x235)+_0xdc110e['foreignKey'];console['error']('\x20\x20'+_0x449f83),console['error']('\x20\x20'+a30_0x45752c[_0x583ba2(0x2f8)]('Columns:')),this[_0x583ba2(0x336)](_0xdc110e[_0x583ba2(0x272)]),!_0xdc110e[_0x583ba2(0x221)]&&console[_0x583ba2(0x21d)]('\x20\x20'+a30_0x45752c[_0x583ba2(0x27c)]('Error:')+'\x20'+_0xdc110e['schemaError']);}}[a30_0x1625b0(0x31b)](_0x4ec7db,_0x572edf){const _0x27adc8=a30_0x1625b0;if(_0x4ec7db[_0x27adc8(0x204)][_0x27adc8(0x32d)]===0x0)return;console['error']('\x0a'+a30_0x45752c['dim']('Behaviors')+'\x20'+a30_0x45752c[_0x27adc8(0x2f8)]('('+_0x572edf+')'));for(const _0x5d0613 of _0x4ec7db[_0x27adc8(0x204)]){const _0x52ce86=_0x5d0613[_0x27adc8(0x221)]?a30_0x45752c['green']('✔'):a30_0x45752c['red']('✘');let _0xfc39da='';if(_0x5d0613[_0x27adc8(0x221)]&&_0x5d0613[_0x27adc8(0x347)]!==undefined&&_0x5d0613['totalEvents']!==undefined){const _0xcbcaf7=_0x5d0613[_0x27adc8(0x32a)]?.[_0x27adc8(0x2ea)](0x1)||'?',_0x42c62b=(_0x5d0613[_0x27adc8(0x32a)]??0x0)>=0x32?a30_0x45752c['green']:(_0x5d0613[_0x27adc8(0x32a)]??0x0)>=0x14?a30_0x45752c['yellow']:a30_0x45752c['red'];_0xfc39da='\x20'+a30_0x45752c['dim'](_0x27adc8(0x2e0))+'\x20'+_0x42c62b(formatRows(_0x5d0613[_0x27adc8(0x347)]))+'\x20('+_0xcbcaf7+'%)\x20'+a30_0x45752c['dim']('Events:')+'\x20'+a30_0x45752c[_0x27adc8(0x1f2)](formatRows(_0x5d0613[_0x27adc8(0x275)]));}console['error'](_0x52ce86+'\x20'+a30_0x45752c[_0x27adc8(0x2f2)](_0x5d0613[_0x27adc8(0x270)])+_0xfc39da),console[_0x27adc8(0x21d)]('\x20\x20'+a30_0x45752c[_0x27adc8(0x2f8)](_0x27adc8(0x364))+'\x20'+a30_0x45752c['bold'](_0x5d0613[_0x27adc8(0x2ab)]+'.'+_0x5d0613['table']));const _0x4c8c92=_0x5d0613[_0x27adc8(0x2ac)]===_0x5d0613[_0x27adc8(0x33c)]?a30_0x45752c['dim'](_0x27adc8(0x304))+'\x20'+_0x5d0613[_0x27adc8(0x2ac)]:a30_0x45752c[_0x27adc8(0x2f8)](_0x27adc8(0x373))+'\x20'+_0x5d0613[_0x27adc8(0x2ac)]+_0x27adc8(0x235)+_0x5d0613[_0x27adc8(0x33c)];console[_0x27adc8(0x21d)]('\x20\x20'+_0x4c8c92),console['error']('\x20\x20'+a30_0x45752c[_0x27adc8(0x2f8)](_0x27adc8(0x2af))),this[_0x27adc8(0x336)](_0x5d0613['columns']),!_0x5d0613[_0x27adc8(0x221)]&&console[_0x27adc8(0x21d)]('\x20\x20'+a30_0x45752c[_0x27adc8(0x27c)](_0x27adc8(0x2fb))+'\x20'+_0x5d0613[_0x27adc8(0x295)]);}}[a30_0x1625b0(0x336)](_0x3cf112){const _0x2d6327=a30_0x1625b0;for(const _0xcce6c of _0x3cf112){_0xcce6c[_0x2d6327(0x2ce)]===_0xcce6c[_0x2d6327(0x252)]||_0xcce6c[_0x2d6327(0x252)]==='*'?console[_0x2d6327(0x21d)](_0x2d6327(0x1fe)+_0xcce6c[_0x2d6327(0x2ce)]):console[_0x2d6327(0x21d)](_0x2d6327(0x1fe)+_0xcce6c[_0x2d6327(0x2ce)]+'\x20'+a30_0x45752c[_0x2d6327(0x2f8)]('('+_0xcce6c[_0x2d6327(0x252)]+')'));}}[a30_0x1625b0(0x376)](_0x5a3935){const _0x57254d=a30_0x1625b0;console['error']('─'[_0x57254d(0x2c6)](0x3c));if(_0x5a3935[_0x57254d(0x248)]['length']>0x0){console[_0x57254d(0x21d)]('\x0a'+a30_0x45752c[_0x57254d(0x27c)](_0x57254d(0x2ba)));for(const _0x32cc32 of _0x5a3935['errors']){console[_0x57254d(0x21d)]('\x20\x20'+a30_0x45752c['red']('•')+'\x20'+_0x32cc32);}}_0x5a3935[_0x57254d(0x2e3)]&&console[_0x57254d(0x21d)]('\x0a'+a30_0x45752c[_0x57254d(0x26b)]('✔')+_0x57254d(0x1f0));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x1625b0(0x270)]='segment:parent:preview';[a30_0x1625b0(0x264)]=a30_0x1625b0(0x291);async['execute'](_0x25c0e8){const _0x5eee36=a30_0x1625b0,{options:_0x507c6d,args:_0x1eb604,tdx:_0x5f3a48}=_0x25c0e8,_0x4859ce=_0x507c6d,_0x5e49ea=_0x1eb604[0x0]||_0x507c6d['parentSegment'];if(!_0x5e49ea)return showParentSegmentNotSetError(_0x5eee36(0x245)+_0x5eee36(0x36d)+'Options\x20(one\x20required):\x0a'+_0x5eee36(0x2b8)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x5eee36(0x34c)+_0x5eee36(0x2c2)+_0x5eee36(0x29d)),0x1;if(!_0x4859ce[_0x5eee36(0x21a)]&&!_0x4859ce[_0x5eee36(0x2dc)]&&!_0x4859ce[_0x5eee36(0x216)]&&!_0x4859ce[_0x5eee36(0x30a)])return console[_0x5eee36(0x21d)](a30_0x45752c[_0x5eee36(0x27c)](_0x5eee36(0x316))),console[_0x5eee36(0x21d)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error'](_0x5eee36(0x33b)),console[_0x5eee36(0x21d)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x5eee36(0x292)),console['error'](_0x5eee36(0x360)),console[_0x5eee36(0x21d)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x432448=resolveYamlFile(_0x5e49ea);if(!existsSync(_0x432448))return showFileNotFoundError(_0x432448,_0x5e49ea),0x1;_0x4859ce[_0x5eee36(0x299)]&&(console['error'](_0x5eee36(0x254)+_0x4859ce['site']),console[_0x5eee36(0x21d)](_0x5eee36(0x22f)+_0x432448));let _0x8e4675;try{_0x8e4675=readFileSync(_0x432448,_0x5eee36(0x2a6));}catch(_0x5ac0c2){const _0x1e8632=_0x5ac0c2 instanceof Error?_0x5ac0c2[_0x5eee36(0x261)]:String(_0x5ac0c2);return console[_0x5eee36(0x21d)](_0x5eee36(0x232)+_0x1e8632),0x1;}let _0x574cb3;try{_0x574cb3=parseDef(_0x8e4675);}catch(_0x81ff9e){const _0x25211b=_0x81ff9e instanceof Error?_0x81ff9e[_0x5eee36(0x261)]:String(_0x81ff9e);return console[_0x5eee36(0x21d)](a30_0x45752c[_0x5eee36(0x27c)](_0x5eee36(0x302)+_0x25211b)),0x1;}if(_0x4859ce[_0x5eee36(0x2dc)]===!![]||_0x4859ce[_0x5eee36(0x2dc)]===''){const _0x2fcc9a=_0x574cb3[_0x5eee36(0x28c)]?.['map'](_0x5fb33b=>_0x5fb33b[_0x5eee36(0x270)])||[];if(_0x2fcc9a[_0x5eee36(0x32d)]===0x0)console['error'](a30_0x45752c['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console['error'](a30_0x45752c[_0x5eee36(0x27c)](_0x5eee36(0x1f1))),console[_0x5eee36(0x21d)](_0x5eee36(0x326));for(const _0x57e6b4 of _0x2fcc9a){console[_0x5eee36(0x21d)]('\x20\x20'+a30_0x45752c[_0x5eee36(0x1f2)](_0x57e6b4));}console[_0x5eee36(0x21d)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5e49ea+_0x5eee36(0x309)+_0x2fcc9a[0x0]+'\x22');}return 0x1;}if(_0x4859ce[_0x5eee36(0x216)]===!![]||_0x4859ce[_0x5eee36(0x216)]===''){const _0x77808=_0x574cb3[_0x5eee36(0x204)]?.[_0x5eee36(0x368)](_0x418440=>_0x418440[_0x5eee36(0x270)])||[];if(_0x77808[_0x5eee36(0x32d)]===0x0)console[_0x5eee36(0x21d)](a30_0x45752c[_0x5eee36(0x27c)](_0x5eee36(0x219)));else{console['error'](a30_0x45752c[_0x5eee36(0x27c)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console['error'](_0x5eee36(0x273));for(const _0x529136 of _0x77808){console['error']('\x20\x20'+a30_0x45752c[_0x5eee36(0x1f2)](_0x529136));}console[_0x5eee36(0x21d)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5e49ea+_0x5eee36(0x359)+_0x77808[0x0]+'\x22');}return 0x1;}const _0xcd2502=createCommandSpinner(a30_0x45752c['dim'](_0x5eee36(0x298)),{'verbose':_0x4859ce[_0x5eee36(0x299)]});_0xcd2502[_0x5eee36(0x20a)]();const _0x56c17a={'onProgress':_0x4d9531=>{const _0x2084e3=_0x5eee36;_0xcd2502[_0x2084e3(0x268)]=formatProgressMessage(_0x4d9531);}};if(_0x4859ce['master'])_0x56c17a[_0x5eee36(0x21a)]=!![];if(_0x4859ce[_0x5eee36(0x2dc)]&&typeof _0x4859ce[_0x5eee36(0x2dc)]==='string')_0x56c17a[_0x5eee36(0x2dc)]=_0x4859ce[_0x5eee36(0x2dc)];if(_0x4859ce[_0x5eee36(0x216)]&&typeof _0x4859ce['behavior']===_0x5eee36(0x200))_0x56c17a[_0x5eee36(0x216)]=_0x4859ce[_0x5eee36(0x216)];if(_0x4859ce['enriched'])_0x56c17a[_0x5eee36(0x30a)]=!![];if(_0x4859ce[_0x5eee36(0x29e)])_0x56c17a[_0x5eee36(0x29e)]=_0x4859ce[_0x5eee36(0x29e)];let _0xcca38;try{_0xcca38=await _0x5f3a48[_0x5eee36(0x2c0)][_0x5eee36(0x20f)](_0x8e4675,_0x56c17a),_0xcd2502['stop']();}catch(_0x4960d6){_0xcd2502[_0x5eee36(0x322)]();throw _0x4960d6;}return await this[_0x5eee36(0x23f)](_0xcca38,{'master':_0x4859ce['master'],'attribute':typeof _0x4859ce['attribute']===_0x5eee36(0x200)?_0x4859ce[_0x5eee36(0x2dc)]:undefined,'behavior':typeof _0x4859ce[_0x5eee36(0x216)]===_0x5eee36(0x200)?_0x4859ce[_0x5eee36(0x216)]:undefined,'enriched':_0x4859ce[_0x5eee36(0x30a)]}),_0xcca38['allValid']?0x0:0x1;}async[a30_0x1625b0(0x23f)](_0x1d2420,_0x1d32be){const _0x4ca930=a30_0x1625b0;console['error']('\x0a'+a30_0x45752c['bold'](_0x4ca930(0x269))+'\x20'+_0x1d2420[_0x4ca930(0x270)]),console['error']('═'[_0x4ca930(0x2c6)](0x3c));if(_0x1d32be['master']&&_0x1d2420[_0x4ca930(0x257)]){const _0x3ac907=a30_0x45752c['dim']('Master:')+'\x20'+a30_0x45752c[_0x4ca930(0x2f2)](_0x1d2420['master']['database']+'.'+_0x1d2420[_0x4ca930(0x21a)]['table']);await this[_0x4ca930(0x2b7)](_0x3ac907,_0x1d2420['sampleData']);}else{if(_0x1d32be[_0x4ca930(0x2dc)]&&_0x1d2420['sampleData']){const _0x398824=a30_0x45752c['dim'](_0x4ca930(0x222))+'\x20'+a30_0x45752c['bold'](_0x1d32be['attribute']);await this[_0x4ca930(0x2b7)](_0x398824,_0x1d2420[_0x4ca930(0x257)]);}else{if(_0x1d32be[_0x4ca930(0x216)]&&_0x1d2420[_0x4ca930(0x257)]){const _0x30b2bc=a30_0x45752c[_0x4ca930(0x2f8)](_0x4ca930(0x31c))+'\x20'+a30_0x45752c[_0x4ca930(0x2f2)](_0x1d32be['behavior']);await this[_0x4ca930(0x2b7)](_0x30b2bc,_0x1d2420[_0x4ca930(0x257)]);}else{if(_0x1d32be[_0x4ca930(0x30a)]&&_0x1d2420[_0x4ca930(0x257)]){const _0x234830=a30_0x45752c[_0x4ca930(0x2f8)]('Enriched:')+'\x20'+a30_0x45752c['bold'](_0x4ca930(0x22e));await this[_0x4ca930(0x2b7)](_0x234830,_0x1d2420[_0x4ca930(0x257)]);}else!_0x1d2420['sampleData']&&console[_0x4ca930(0x21d)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x1d2420[_0x4ca930(0x248)][_0x4ca930(0x32d)]>0x0){console[_0x4ca930(0x21d)]('─'[_0x4ca930(0x2c6)](0x3c)),console[_0x4ca930(0x21d)]('\x0a'+a30_0x45752c['red'](_0x4ca930(0x2ba)));for(const _0x5f53ac of _0x1d2420[_0x4ca930(0x248)]){console[_0x4ca930(0x21d)]('\x20\x20'+a30_0x45752c['red']('•')+'\x20'+_0x5f53ac);}}}async[a30_0x1625b0(0x2b7)](_0x50f3ff,_0x46f541){const _0x4da35b=a30_0x1625b0;if(_0x46f541['length']===0x0){console[_0x4da35b(0x21d)]('\x0a'+_0x50f3ff),console['error'](_0x4da35b(0x1ec));return;}console[_0x4da35b(0x21d)]('\x0a'+_0x50f3ff);const _0x5ea965=Object[_0x4da35b(0x262)](_0x46f541[0x0])[_0x4da35b(0x368)](_0x381706=>({'name':_0x381706,'type':typeof _0x46f541[0x0][_0x381706]===_0x4da35b(0x325)?'double':'varchar'})),_0x507516={'queryId':'preview','columns':_0x5ea965,'data':_0x46f541,'stats':{'state':_0x4da35b(0x37c),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x46f541[_0x4da35b(0x32d)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x767e75=formatAsTable(_0x507516,_0x46f541[_0x4da35b(0x32d)],!![]);await writeOutput(_0x767e75,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x2d3);['description']=a30_0x1625b0(0x26e);async['execute'](_0x402b39){const _0x257dcc=a30_0x1625b0,{options:_0x5234b9,args:_0x13154a,tdx:_0x236acd}=_0x402b39,_0x18c184=_0x5234b9,_0x2f2527=_0x13154a[0x0]||_0x5234b9[_0x257dcc(0x2d9)];if(!_0x2f2527)return showParentSegmentNotSetError(_0x257dcc(0x2a5)+_0x257dcc(0x312)),0x1;const _0x598386=resolveYamlFile(_0x2f2527);if(existsSync(_0x598386)){_0x18c184[_0x257dcc(0x299)]&&console['error'](_0x257dcc(0x37b)+_0x598386);let _0x1d8f62;try{_0x1d8f62=readFileSync(_0x598386,_0x257dcc(0x2a6));}catch(_0x3a0b0b){const _0x3d70b0=_0x3a0b0b instanceof Error?_0x3a0b0b['message']:String(_0x3a0b0b);return console[_0x257dcc(0x21d)](_0x257dcc(0x232)+_0x3d70b0),0x1;}const _0x5a7994=await withSpinner(_0x257dcc(0x2ca),()=>_0x236acd['segment']['pushParentYaml'](_0x1d8f62),{'verbose':_0x18c184[_0x257dcc(0x299)]}),_0x4a3405=_0x5a7994['data'],{isNew:_0x1b390e,name:_0x1770f9,hasChanges:_0x48ae7f,diffFormatted:_0x512f5a}=_0x4a3405;if(_0x48ae7f){_0x1b390e?console['error']('\x0aNew\x20parent\x20segment\x20\x27'+_0x1770f9+'\x27:'):console[_0x257dcc(0x21d)](_0x257dcc(0x223)+_0x1770f9+'\x27:');console[_0x257dcc(0x21d)]('─'[_0x257dcc(0x2c6)](0x3c)),console[_0x257dcc(0x21d)](_0x512f5a),console[_0x257dcc(0x21d)]('─'[_0x257dcc(0x2c6)](0x3c));const _0xb1856e=_0x1b390e?'Create\x20parent\x20segment\x20\x27'+_0x1770f9+_0x257dcc(0x27f):_0x257dcc(0x26f)+_0x1770f9+'\x27\x20and\x20run\x20workflow?';if(!_0x18c184[_0x257dcc(0x234)]){if(!isInteractive())return console[_0x257dcc(0x21d)](a30_0x45752c[_0x257dcc(0x27c)](_0x257dcc(0x353)),_0x257dcc(0x2c9)),console[_0x257dcc(0x21d)](a30_0x45752c[_0x257dcc(0x2f8)](_0x257dcc(0x21b))),0x1;const _0x52a554=await confirmKey(_0xb1856e);if(!_0x52a554)return console[_0x257dcc(0x21d)](a30_0x45752c['yellow'](_0x257dcc(0x23c))),0x1;}const _0x10445d=_0x1b390e?_0x257dcc(0x29a):_0x257dcc(0x207);await withSpinner(_0x10445d+'\x20parent\x20segment\x20\x27'+_0x1770f9+_0x257dcc(0x2fe),()=>_0x4a3405['apply'](),{'verbose':_0x18c184[_0x257dcc(0x299)]});const _0x5c6a73=_0x1b390e?_0x257dcc(0x2e6):'Updated';console[_0x257dcc(0x21d)]('✔\x20'+_0x5c6a73+_0x257dcc(0x354)+_0x1770f9+'\x27');}else console[_0x257dcc(0x21d)]('✔\x20No\x20changes\x20-\x20\x27'+_0x1770f9+'\x27\x20is\x20up\x20to\x20date');}const _0x1907c4=await withSpinner(_0x257dcc(0x350)+_0x2f2527+_0x257dcc(0x2fe),()=>_0x236acd[_0x257dcc(0x2c0)][_0x257dcc(0x280)](_0x2f2527),{'verbose':_0x18c184[_0x257dcc(0x299)]}),_0x59e207=_0x1907c4[_0x257dcc(0x247)],_0x1527f7=getConsoleUrl(_0x18c184['site'],_0x257dcc(0x324)+_0x59e207[_0x257dcc(0x28e)]+_0x257dcc(0x1f5)+_0x59e207[_0x257dcc(0x29b)]+_0x257dcc(0x31d)+_0x59e207[_0x257dcc(0x260)]);return console[_0x257dcc(0x21d)](_0x257dcc(0x259)),console[_0x257dcc(0x21d)]('\x20\x20'+a30_0x45752c[_0x257dcc(0x2f8)](_0x257dcc(0x1ee))+'\x20'+_0x59e207[_0x257dcc(0x319)]),console[_0x257dcc(0x21d)]('\x20\x20'+a30_0x45752c[_0x257dcc(0x2f8)](_0x257dcc(0x2d1))+'\x20'+_0x59e207[_0x257dcc(0x2ff)]),console[_0x257dcc(0x21d)]('\x20\x20'+a30_0x45752c[_0x257dcc(0x2f8)](_0x257dcc(0x34f))+'\x20'+_0x59e207['workflowSessionId']),console[_0x257dcc(0x21d)]('\x20\x20'+a30_0x45752c[_0x257dcc(0x2f8)]('Attempt:')+'\x20'+_0x59e207['workflowAttemptId']),console[_0x257dcc(0x21d)]('\x20\x20'+_0x1527f7),console[_0x257dcc(0x21d)]('\x0a'+a30_0x45752c[_0x257dcc(0x2f8)](_0x257dcc(0x217))+_0x257dcc(0x210)+_0x59e207[_0x257dcc(0x260)]+_0x257dcc(0x24d)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a30_0x1625b0(0x264)]=a30_0x1625b0(0x2db);async[a30_0x1625b0(0x24a)](_0x5b5b47){const _0x5f1072=a30_0x1625b0,{options:_0x58a637,args:_0x4a0403,tdx:_0x34020a}=_0x5b5b47,_0x45f43f=_0x4a0403[0x0]||_0x58a637[_0x5f1072(0x2d9)];if(!_0x45f43f)return showParentSegmentNotSetError(_0x5f1072(0x212)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x58a637[_0x5f1072(0x299)]&&(console[_0x5f1072(0x21d)](_0x5f1072(0x254)+_0x58a637[_0x5f1072(0x2a4)]),console[_0x5f1072(0x21d)](_0x5f1072(0x356)+_0x45f43f));const _0xab16db=await withSpinner(_0x5f1072(0x28f)+_0x45f43f+'\x27...',()=>_0x34020a[_0x5f1072(0x2c0)][_0x5f1072(0x278)](_0x45f43f),{'verbose':_0x58a637[_0x5f1072(0x299)]}),_0x403d46=_0xab16db[_0x5f1072(0x247)];console[_0x5f1072(0x21d)](_0x5f1072(0x358)+_0x403d46['length']+_0x5f1072(0x2bd)+(_0x403d46[_0x5f1072(0x32d)]!==0x1?'s':''));if(_0x58a637[_0x5f1072(0x307)]||_0x58a637[_0x5f1072(0x256)])return await handleSDKOutput(_0x403d46,_0x58a637),0x0;return displayFieldsHumanReadable(_0x403d46,_0x45f43f),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x20c);[a30_0x1625b0(0x264)]='Show\x20parent\x20segment\x20details';async[a30_0x1625b0(0x24a)](_0x44cbeb){const _0x5dbce8=a30_0x1625b0,{options:_0x1defa4,args:_0x3d7797,tdx:_0x2955fd}=_0x44cbeb,_0x279fab=_0x1defa4,_0x4b3dd0=_0x3d7797[0x0]||_0x1defa4[_0x5dbce8(0x2d9)];if(!_0x4b3dd0)return showParentSegmentNotSetError(_0x5dbce8(0x345)+_0x5dbce8(0x2f4)+_0x5dbce8(0x27d)+_0x5dbce8(0x2d7)),0x1;_0x1defa4['verbose']&&(console[_0x5dbce8(0x21d)](_0x5dbce8(0x254)+_0x1defa4[_0x5dbce8(0x2a4)]),console[_0x5dbce8(0x21d)](_0x5dbce8(0x356)+_0x4b3dd0));const _0x3d2fff=await withSpinner(_0x5dbce8(0x371)+_0x4b3dd0+_0x5dbce8(0x2fe),()=>_0x2955fd[_0x5dbce8(0x2c0)][_0x5dbce8(0x2cd)](_0x4b3dd0),{'verbose':_0x1defa4[_0x5dbce8(0x299)]}),_0x11053a=_0x3d2fff[_0x5dbce8(0x247)];if(_0x279fab[_0x5dbce8(0x32e)]){const _0x432937=getConsoleNextUrl(_0x279fab[_0x5dbce8(0x2a4)],'/app/dw/parentSegments/'+_0x11053a['id']);return console[_0x5dbce8(0x21d)](a30_0x45752c[_0x5dbce8(0x26b)]('✔')+'\x20Opening\x20'+a30_0x45752c['cyan'](_0x432937)),openBrowser(_0x432937),0x0;}return await handleSingleObjectOutput(_0x11053a,_0x1defa4),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x1625b0(0x270)]='segment:parent:desc';['description']=a30_0x1625b0(0x328);async[a30_0x1625b0(0x24a)](_0x4893c0){const _0x4a9f3f=a30_0x1625b0,{options:_0x52770,args:_0x274dfe,tdx:_0x164adb}=_0x4893c0,_0x507044=_0x52770,_0x389cb3=_0x274dfe[0x0]||_0x52770[_0x4a9f3f(0x2d9)];if(!_0x389cb3)return showParentSegmentNotSetError(_0x4a9f3f(0x25e)+_0x4a9f3f(0x37a)+'Options:\x0a'+_0x4a9f3f(0x2d6)),0x1;_0x52770[_0x4a9f3f(0x299)]&&(console['error']('Site:\x20'+_0x52770[_0x4a9f3f(0x2a4)]),console[_0x4a9f3f(0x21d)]('Parent\x20segment:\x20'+_0x389cb3));const _0x43acdf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x389cb3+_0x4a9f3f(0x2fe),()=>_0x164adb[_0x4a9f3f(0x2c0)]['resolveParentId'](_0x389cb3),{'verbose':_0x52770[_0x4a9f3f(0x299)]}),_0x1fcc1b=_0x43acdf[_0x4a9f3f(0x247)],_0x18ab87=_0x164adb[_0x4a9f3f(0x2c0)][_0x4a9f3f(0x2fd)](_0x1fcc1b);if(_0x507044[_0x4a9f3f(0x24b)]){const _0x163ce4=await this[_0x4a9f3f(0x220)](_0x4893c0,_0x389cb3,_0x1fcc1b,_0x18ab87),_0x38f7d4=this[_0x4a9f3f(0x33d)](_0x163ce4);writeFileSync(_0x507044['output'],_0x38f7d4);const _0x4411c9=_0x163ce4[_0x4a9f3f(0x2ee)][_0x4a9f3f(0x272)][_0x4a9f3f(0x32d)]+_0x163ce4[_0x4a9f3f(0x204)][_0x4a9f3f(0x1f6)]((_0x267b88,_0x1d8358)=>_0x267b88+_0x1d8358[_0x4a9f3f(0x272)]['length'],0x0),_0xd218ec=_0x163ce4[_0x4a9f3f(0x204)][_0x4a9f3f(0x2c4)](_0x5973b6=>_0x5973b6['columns'][_0x4a9f3f(0x32d)]===0x0)[_0x4a9f3f(0x32d)];return console[_0x4a9f3f(0x202)](_0x4a9f3f(0x237)+_0x507044[_0x4a9f3f(0x24b)]),console[_0x4a9f3f(0x202)](_0x4a9f3f(0x2aa)+_0x18ab87),console['log'](_0x4a9f3f(0x2f1)+_0x163ce4['behaviors'][_0x4a9f3f(0x32d)]+_0x4a9f3f(0x2b4)),console[_0x4a9f3f(0x202)](_0x4a9f3f(0x2a2)+_0x4411c9+_0x4a9f3f(0x279)),_0xd218ec>0x0&&console['log']('\x20\x20Note:\x20'+_0xd218ec+_0x4a9f3f(0x30c)),0x0;}console['error']('\x0a'+a30_0x45752c[_0x4a9f3f(0x2f2)]('Output\x20Database:')+'\x20'+a30_0x45752c[_0x4a9f3f(0x1f2)](_0x18ab87));const _0x1a24ed=await withSpinner(_0x4a9f3f(0x205),()=>_0x164adb['segment'][_0x4a9f3f(0x306)](_0x1fcc1b),{'verbose':_0x52770[_0x4a9f3f(0x299)]});console[_0x4a9f3f(0x21d)]('\x0a'+a30_0x45752c[_0x4a9f3f(0x2f2)](_0x4a9f3f(0x2ee))+'\x20'+a30_0x45752c['dim']('('+_0x18ab87+'.customers)'));const _0x26e863=await executeSchemaQuery(_0x1a24ed['data'],_0x164adb,_0x52770);await handleQueryOutput(_0x26e863,_0x52770);const _0x3410c6=await withSpinner(_0x4a9f3f(0x2e2),()=>_0x164adb['segment'][_0x4a9f3f(0x363)](_0x1fcc1b),{'verbose':_0x52770[_0x4a9f3f(0x299)]});for(const _0xa9d67c of _0x3410c6[_0x4a9f3f(0x247)]){const _0x4b2459='behavior_'+_0xa9d67c[_0x4a9f3f(0x2bc)]()['replace'](/\s+/g,'_'),_0x358e59=_0x4a9f3f(0x1f9)+_0x18ab87+'.'+_0x4b2459;console[_0x4a9f3f(0x21d)]('\x0a'+a30_0x45752c[_0x4a9f3f(0x2f2)](_0xa9d67c)+'\x20'+a30_0x45752c[_0x4a9f3f(0x2f8)]('('+_0x18ab87+'.'+_0x4b2459+')'));try{const _0x5a6f1c=await executeSchemaQuery(_0x358e59,_0x164adb,_0x52770);await handleQueryOutput(_0x5a6f1c,_0x52770);}catch{console[_0x4a9f3f(0x21d)](a30_0x45752c[_0x4a9f3f(0x287)](_0x4a9f3f(0x30b)));}}return 0x0;}async[a30_0x1625b0(0x220)](_0x280ea5,_0x5e9bdd,_0x2de05f,_0x5bb646){const _0x229e47=a30_0x1625b0,{options:_0x1113cc,tdx:_0x175982}=_0x280ea5,_0x18c765=await withSpinner(_0x229e47(0x205),()=>_0x175982[_0x229e47(0x2c0)][_0x229e47(0x306)](_0x2de05f),{'verbose':_0x1113cc[_0x229e47(0x299)]}),_0x1a648b=await executeSchemaQuery(_0x18c765[_0x229e47(0x247)],_0x175982,_0x1113cc),_0x27941e=_0x1a648b['data'][_0x229e47(0x368)](_0x2228ea=>({'name':_0x2228ea[_0x229e47(0x208)],'type':_0x2228ea[_0x229e47(0x303)]})),_0x2c232a=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x175982['segment'][_0x229e47(0x363)](_0x2de05f),{'verbose':_0x1113cc[_0x229e47(0x299)]}),_0x610bb2=[];for(const _0x5cba9e of _0x2c232a[_0x229e47(0x247)]){const _0x46e807=_0x229e47(0x315)+_0x5cba9e[_0x229e47(0x2bc)]()[_0x229e47(0x25f)](/\s+/g,'_'),_0x45a56c=_0x229e47(0x1f9)+_0x5bb646+'.'+_0x46e807;let _0x3245a7=[];try{const _0x145b8a=await executeSchemaQuery(_0x45a56c,_0x175982,_0x1113cc);_0x3245a7=_0x145b8a[_0x229e47(0x247)]['map'](_0x3d6b41=>({'name':_0x3d6b41[_0x229e47(0x208)],'type':_0x3d6b41['column_type']}));}catch{}_0x610bb2[_0x229e47(0x351)]({'table':_0x46e807,'columns':_0x3245a7});}return{'database':_0x5bb646,'parent_segment':_0x5e9bdd,'parent_id':_0x2de05f,'customers':{'table':_0x229e47(0x2ee),'columns':_0x27941e},'behaviors':_0x610bb2};}[a30_0x1625b0(0x33d)](_0x13971a){const _0x1d39df=a30_0x1625b0,_0x3a6fda=_0x4bdf9a=>{const _0x5a7e3d=a30_0x1797;if(_0x4bdf9a[_0x5a7e3d(0x32d)]===0x0)return'[]';const _0x50c99d=_0x4bdf9a[_0x5a7e3d(0x368)](_0x5c30a8=>_0x5a7e3d(0x281)+_0x5c30a8['name']+_0x5a7e3d(0x35f)+_0x5c30a8['type']+'\x22\x20}');return'[\x0a'+_0x50c99d[_0x5a7e3d(0x276)](',\x0a')+_0x5a7e3d(0x22b);},_0x181e97=_0x13971a['behaviors'][_0x1d39df(0x368)](_0x12c2a1=>{const _0x88a1b8=_0x1d39df;return _0x88a1b8(0x2dd)+_0x12c2a1[_0x88a1b8(0x2b5)]+_0x88a1b8(0x20b)+_0x3a6fda(_0x12c2a1[_0x88a1b8(0x272)])['replace'](/^/gm,'\x20\x20')[_0x88a1b8(0x266)]()+_0x88a1b8(0x2e8);})[_0x1d39df(0x276)](',\x0a');return _0x1d39df(0x2e1)+_0x13971a[_0x1d39df(0x2ab)]+_0x1d39df(0x362)+_0x13971a[_0x1d39df(0x2bb)]+_0x1d39df(0x26d)+_0x13971a[_0x1d39df(0x284)]+_0x1d39df(0x24f)+_0x13971a[_0x1d39df(0x2ee)][_0x1d39df(0x2b5)]+_0x1d39df(0x2a7)+_0x3a6fda(_0x13971a['customers'][_0x1d39df(0x272)])[_0x1d39df(0x25f)](/^/gm,'\x20\x20')[_0x1d39df(0x266)]()+_0x1d39df(0x374)+_0x181e97+_0x1d39df(0x29f);}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a30_0x1625b0(0x215);[a30_0x1625b0(0x264)]=a30_0x1625b0(0x2d8);async[a30_0x1625b0(0x24a)](_0x11ac2e){const _0xe686e2=a30_0x1625b0,{options:_0x4016a7,args:_0x183006,tdx:_0x5a004c}=_0x11ac2e,_0xe3463d=_0x183006[0x0]||_0x4016a7['parentSegment'];if(!_0xe3463d)return showParentSegmentNotSetError(_0xe686e2(0x24c)+'\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;_0x4016a7['verbose']&&(console['error'](_0xe686e2(0x254)+_0x4016a7['site']),console[_0xe686e2(0x21d)](_0xe686e2(0x356)+_0xe3463d));const _0x1e0a4c=await withSpinner(_0xe686e2(0x337)+_0xe3463d+'\x27...',()=>_0x5a004c[_0xe686e2(0x2c0)][_0xe686e2(0x20d)](_0xe3463d),{'verbose':_0x4016a7[_0xe686e2(0x299)]}),_0x5e8696=_0x1e0a4c['data'],_0x227a3d=await withSpinner(_0xe686e2(0x349)+_0xe3463d+'\x27...',()=>_0x5a004c[_0xe686e2(0x2c0)][_0xe686e2(0x306)](_0x5e8696),{'verbose':_0x4016a7[_0xe686e2(0x299)]}),_0xe60117=_0x227a3d[_0xe686e2(0x247)];return _0x4016a7[_0xe686e2(0x321)]===_0xe686e2(0x307)||_0x4016a7[_0xe686e2(0x321)]==='jsonl'?await handleSDKOutput([{'sql':_0xe60117}],_0x4016a7):console[_0xe686e2(0x202)](_0xe60117),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x22c);[a30_0x1625b0(0x264)]=a30_0x1625b0(0x1fa);async[a30_0x1625b0(0x24a)](_0x2ab8b7){const _0x1e3a99=a30_0x1625b0,{options:_0x3fb2c2,args:_0x50e9a9,tdx:_0x1bc180}=_0x2ab8b7,_0x29279e=_0x50e9a9[0x0]||_0x3fb2c2[_0x1e3a99(0x2d9)];if(!_0x29279e)return showParentSegmentNotSetError(_0x1e3a99(0x25a)+_0x1e3a99(0x311)),0x1;_0x3fb2c2[_0x1e3a99(0x299)]&&(console['error']('Site:\x20'+_0x3fb2c2[_0x1e3a99(0x2a4)]),console[_0x1e3a99(0x21d)](_0x1e3a99(0x356)+_0x29279e));const _0xcf83a6=await withSpinner(_0x1e3a99(0x337)+_0x29279e+_0x1e3a99(0x2fe),()=>_0x1bc180['segment']['resolveParentId'](_0x29279e),{'verbose':_0x3fb2c2[_0x1e3a99(0x299)]}),_0x2e54e0=_0xcf83a6[_0x1e3a99(0x247)],_0x6e912c=await withSpinner(_0x1e3a99(0x349)+_0x29279e+_0x1e3a99(0x2fe),()=>_0x1bc180[_0x1e3a99(0x2c0)][_0x1e3a99(0x306)](_0x2e54e0),{'verbose':_0x3fb2c2[_0x1e3a99(0x299)]});let _0x144b5=_0x6e912c['data'];const _0x270e36=resolveLimit(_0x3fb2c2[_0x1e3a99(0x355)],DEFAULT_DISPLAY_LIMIT),_0x1de9a1=/\bLIMIT\s+\d+/i[_0x1e3a99(0x334)](_0x144b5);!_0x1de9a1&&(_0x144b5=_0x144b5[_0x1e3a99(0x266)]()[_0x1e3a99(0x25f)](/;+$/,''),_0x144b5=_0x1e3a99(0x33a)+_0x144b5+_0x1e3a99(0x31a)+_0x270e36);_0x3fb2c2[_0x1e3a99(0x299)]&&console['error'](_0x1e3a99(0x35b)+_0x144b5);const _0x407ebc=await withProgressSpinner(_0x1e3a99(0x231),async _0x4e34b1=>{const _0x20e27f=_0x1e3a99,_0x386d6d=await _0x1bc180[_0x20e27f(0x2b3)][_0x20e27f(0x24a)](_0x144b5,{'catalog':'td','schema':_0x20e27f(0x226),'onJobId':_0x31c971=>{const _0x3c92a9=_0x20e27f;_0x4e34b1[_0x3c92a9(0x23a)](_0x31c971);}});return _0x386d6d;},{'verbose':_0x3fb2c2[_0x1e3a99(0x299)]}),_0xb5450c=_0x407ebc[_0x1e3a99(0x247)],_0x334d7b=_0xb5450c['jobId']?_0x1e3a99(0x23e)+_0xb5450c['jobId']+']':'';return console[_0x1e3a99(0x21d)]('✔\x20Query\x20completed:\x20Processed\x20'+_0xb5450c[_0x1e3a99(0x293)]['processedRows'][_0x1e3a99(0x348)]()+_0x1e3a99(0x289)+(_0x1e3a99(0x297)+formatElapsed(_0xb5450c[_0x1e3a99(0x293)]['elapsedTimeMillis'])+_0x334d7b)),await handleQueryOutput(_0xb5450c,_0x3fb2c2),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x28b);[a30_0x1625b0(0x264)]=a30_0x1625b0(0x35e);async[a30_0x1625b0(0x24a)](_0x21bfad){const _0x1fa5ec=a30_0x1625b0,{options:_0x17a57f,args:_0x529a6a,tdx:_0x186d08}=_0x21bfad,_0x22d4fd=_0x529a6a[0x0],_0x399c69=await withSpinner(_0x22d4fd?_0x1fa5ec(0x367)+_0x22d4fd+_0x1fa5ec(0x2fe):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x186d08[_0x1fa5ec(0x2e4)][_0x1fa5ec(0x2c3)](),{'verbose':_0x17a57f[_0x1fa5ec(0x299)]});let _0x1f19e9=_0x399c69['data'][_0x1fa5ec(0x2c4)](_0x3aa472=>_0x3aa472['realtime_enabled']);if(_0x22d4fd){const _0x1a9a97=_0x22d4fd[_0x1fa5ec(0x25f)](/[.+^${}()|[\]\\]/g,_0x1fa5ec(0x253))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x18a589=new RegExp('^'+_0x1a9a97+'$','i');_0x1f19e9=_0x1f19e9[_0x1fa5ec(0x2c4)](_0x496b19=>_0x18a589[_0x1fa5ec(0x334)](_0x496b19[_0x1fa5ec(0x270)]));}_0x1f19e9[_0x1fa5ec(0x317)]((_0x130e96,_0x31ab29)=>_0x130e96[_0x1fa5ec(0x270)][_0x1fa5ec(0x2c8)](_0x31ab29[_0x1fa5ec(0x270)])),console['error'](_0x1fa5ec(0x358)+_0x1f19e9[_0x1fa5ec(0x32d)]+_0x1fa5ec(0x331)+(_0x1f19e9[_0x1fa5ec(0x32d)]!==0x1?'s':''));const _0x4de11a=_0x116b56=>{const _0x5ea5ee=_0x1fa5ec;return getConsoleNextUrl(_0x17a57f[_0x5ea5ee(0x2a4)],'/app/dw/parentSegments/'+_0x116b56);};if(_0x17a57f['format']===_0x1fa5ec(0x307)||_0x17a57f[_0x1fa5ec(0x321)]===_0x1fa5ec(0x256)){const _0x3a2d20=_0x1f19e9[_0x1fa5ec(0x368)](_0x5658ea=>({..._0x5658ea,'url':_0x4de11a(_0x5658ea['id'])}));await handleSDKOutput(_0x3a2d20,_0x17a57f);}else{if(_0x1f19e9[_0x1fa5ec(0x32d)]===0x0)console[_0x1fa5ec(0x202)](_0x1fa5ec(0x2d5));else for(const _0x695dec of _0x1f19e9){const _0x373924=_0x695dec['population']?a30_0x45752c[_0x1fa5ec(0x2f8)]('\x20('+formatRows(_0x695dec[_0x1fa5ec(0x2d0)])+')'):'',_0x2d76d1=hyperlink(_0x695dec[_0x1fa5ec(0x270)],_0x4de11a(_0x695dec['id']));console[_0x1fa5ec(0x202)]('⚡\x20'+_0x2d76d1+_0x373924);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x2de);[a30_0x1625b0(0x264)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a30_0x1625b0(0x24a)](_0x3b4b22){const _0x225fc5=a30_0x1625b0,{options:_0x55463e,args:_0x1db716,tdx:_0x1a6174}=_0x3b4b22,_0x297478=_0x1db716[0x0]||_0x55463e[_0x225fc5(0x2d9)];if(!_0x297478)return showParentSegmentNotSetError(_0x225fc5(0x361)+_0x225fc5(0x357)),0x1;const _0x4734a5=resolveYamlFile(_0x297478);if(!existsSync(_0x4734a5))return showFileNotFoundError(_0x4734a5,_0x297478),0x1;let _0x14ca6c;try{_0x14ca6c=readFileSync(_0x4734a5,_0x225fc5(0x2a6));}catch(_0x11907f){const _0x36721a=_0x11907f instanceof Error?_0x11907f[_0x225fc5(0x261)]:String(_0x11907f);return console['error']('Error\x20reading\x20file:\x20'+_0x36721a),0x1;}const _0x28823a=createCommandSpinner(a30_0x45752c['dim'](_0x225fc5(0x258)),{'verbose':_0x55463e['verbose']});_0x28823a[_0x225fc5(0x20a)]();const _0x3d6d21={'realtime':!![],'onProgress':_0x4d776f=>{_0x28823a['text']=formatProgressMessage(_0x4d776f);}};let _0x625f8b;try{_0x625f8b=await _0x1a6174[_0x225fc5(0x2c0)][_0x225fc5(0x32f)](_0x14ca6c,_0x3d6d21),_0x28823a['stop']();}catch(_0x27cd6e){_0x28823a[_0x225fc5(0x322)]();throw _0x27cd6e;}console[_0x225fc5(0x21d)]('\x0a'+a30_0x45752c[_0x225fc5(0x2f2)](_0x225fc5(0x2ae))+'\x20'+_0x625f8b[_0x225fc5(0x270)]),console[_0x225fc5(0x21d)]('═'[_0x225fc5(0x2c6)](0x3c)),displayRealtimeValidation(_0x625f8b),console[_0x225fc5(0x21d)]('─'['repeat'](0x3c));if(_0x625f8b[_0x225fc5(0x248)]['length']>0x0){console[_0x225fc5(0x21d)]('\x0a'+a30_0x45752c[_0x225fc5(0x27c)](_0x225fc5(0x2ba)));for(const _0x30fedf of _0x625f8b[_0x225fc5(0x248)]){console[_0x225fc5(0x21d)]('\x20\x20'+a30_0x45752c['red']('•')+'\x20'+_0x30fedf);}}return _0x625f8b['allValid']&&console[_0x225fc5(0x21d)]('\x0a'+a30_0x45752c[_0x225fc5(0x26b)]('✔')+_0x225fc5(0x244)),_0x625f8b[_0x225fc5(0x2e3)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a30_0x1625b0(0x314);[a30_0x1625b0(0x264)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a30_0x1625b0(0x24a)](_0x3a1d02){const _0x296340=a30_0x1625b0,{options:_0x21b92e,args:_0x42cdde,tdx:_0x1c63de}=_0x3a1d02,_0x318b3c=_0x42cdde[0x0]||_0x21b92e['parentSegment'];if(!_0x318b3c)return showParentSegmentNotSetError(_0x296340(0x277)+_0x296340(0x25d)),0x1;const _0x252ed8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x318b3c+_0x296340(0x2fe),()=>_0x1c63de[_0x296340(0x2c0)]['resolveParentId'](_0x318b3c),{'verbose':_0x21b92e[_0x296340(0x299)]}),_0xcef61a=_0x252ed8[_0x296340(0x247)],_0x3ec703=await withSpinner(_0x296340(0x24e)+_0x318b3c+_0x296340(0x2fe),()=>_0x1c63de['personalization'][_0x296340(0x2c3)](_0xcef61a),{'verbose':_0x21b92e[_0x296340(0x299)]}),_0x16515a=_0x3ec703['data'];console[_0x296340(0x21d)](_0x296340(0x358)+_0x16515a[_0x296340(0x32d)]+'\x20personalization\x20service'+(_0x16515a['length']!==0x1?'s':''));if(_0x21b92e[_0x296340(0x321)]==='json'||_0x21b92e[_0x296340(0x321)]==='jsonl')await handleSDKOutput(_0x16515a,_0x21b92e);else{if(_0x16515a[_0x296340(0x32d)]===0x0)console[_0x296340(0x202)](_0x296340(0x370)),console['error'](a30_0x45752c[_0x296340(0x1f2)](_0x296340(0x25c)));else for(const _0x427b62 of _0x16515a){const _0x33984f=_0x427b62[_0x296340(0x1f7)]?.[_0x296340(0x32d)]||0x0,_0x308007=_0x427b62[_0x296340(0x2d2)]?a30_0x45752c[_0x296340(0x2f8)](_0x296340(0x36e)+_0x427b62[_0x296340(0x2d2)]):'',_0xbc284d=a30_0x45752c[_0x296340(0x2f8)]('\x20('+_0x33984f+_0x296340(0x31f)+(_0x33984f!==0x1?'s':'')+')');console[_0x296340(0x202)]('\x20\x20'+_0x427b62[_0x296340(0x270)]+_0x308007+_0xbc284d),_0x427b62['description']&&console[_0x296340(0x202)]('\x20\x20\x20\x20'+a30_0x45752c['dim'](_0x427b62['description']));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a30_0x1625b0(0x270)]=a30_0x1625b0(0x327);[a30_0x1625b0(0x264)]='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async[a30_0x1625b0(0x24a)](_0x4bc418){const _0xdd8610=a30_0x1625b0,{options:_0x485009,args:_0x3c6352}=_0x4bc418,_0x52fb17=_0x3c6352[0x0]||_0x485009[_0xdd8610(0x2d9)];if(!_0x52fb17)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x3ec67b=resolveYamlFile(_0x52fb17);if(!existsSync(_0x3ec67b))return showFileNotFoundError(_0x3ec67b,_0x52fb17),0x1;let _0x3602f0;try{_0x3602f0=readFileSync(_0x3ec67b,_0xdd8610(0x2a6));}catch(_0xc39b73){const _0x2500ca=_0xc39b73 instanceof Error?_0xc39b73[_0xdd8610(0x261)]:String(_0xc39b73);return console['error'](_0xdd8610(0x232)+_0x2500ca),0x1;}let _0x3bd4d5;try{_0x3bd4d5=parseDef(_0x3602f0);}catch(_0x44eb1c){const _0x1c00f3=_0x44eb1c instanceof Error?_0x44eb1c[_0xdd8610(0x261)]:String(_0x44eb1c);return console[_0xdd8610(0x21d)](a30_0x45752c[_0xdd8610(0x27c)](_0xdd8610(0x302)+_0x1c00f3)),0x1;}if(_0x3bd4d5[_0xdd8610(0x30f)]&&_0x3bd4d5['personalization_services']['length']>0x0)return console['error'](a30_0x45752c[_0xdd8610(0x287)](_0xdd8610(0x36c)+_0x3ec67b)),console[_0xdd8610(0x21d)](a30_0x45752c[_0xdd8610(0x2f8)]('\x20\x20\x20'+_0x3bd4d5[_0xdd8610(0x30f)][_0xdd8610(0x32d)]+_0xdd8610(0x310))),0x1;!_0x3bd4d5[_0xdd8610(0x2e4)]&&(_0x3bd4d5['realtime']={'events':[{'name':_0xdd8610(0x2b6),'source_table':_0xdd8610(0x236)}],'attributes':[{'name':_0xdd8610(0x2da),'type':'single'}],'id_stitching':{'primary_key':_0x3bd4d5['master'][_0xdd8610(0x2b5)]===_0xdd8610(0x2ee)?_0xdd8610(0x290):_0xdd8610(0x1fd)}});_0x3bd4d5['personalization_services']=[{'name':_0xdd8610(0x1ff),'description':_0xdd8610(0x35d),'trigger_event':_0xdd8610(0x2b6),'sections':[{'name':_0xdd8610(0x34d),'criteria':_0xdd8610(0x335),'attributes':[_0xdd8610(0x2da)]}]}];const _0xa10769=serializeDef(_0x3bd4d5);return writeFileSync(_0x3ec67b,_0xa10769,_0xdd8610(0x2a6)),console[_0xdd8610(0x21d)](a30_0x45752c['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a30_0x45752c[_0xdd8610(0x1f2)](_0x3ec67b)),(!_0x3bd4d5[_0xdd8610(0x2e4)]||_0x3602f0[_0xdd8610(0x26c)](_0xdd8610(0x1ed))===-0x1)&&console['error'](a30_0x45752c['green']('✔')+_0xdd8610(0x30e)),console[_0xdd8610(0x21d)]('\x0a'+a30_0x45752c[_0xdd8610(0x2f8)](_0xdd8610(0x2a0))),console['error']('\x20\x201.\x20Edit\x20'+_0x3ec67b+_0xdd8610(0x238)),console[_0xdd8610(0x21d)]('\x20\x202.\x20Run\x20'+a30_0x45752c[_0xdd8610(0x2f8)](_0xdd8610(0x21c)+_0x52fb17)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
@@ -1 +1 @@
1
- const a31_0x350639=a31_0x3fca;(function(_0x3816c0,_0x265a34){const _0x448813=a31_0x3fca,_0x19729c=_0x3816c0();while(!![]){try{const _0x490f14=parseInt(_0x448813(0x1cf))/0x1+-parseInt(_0x448813(0x1e6))/0x2+-parseInt(_0x448813(0x219))/0x3*(-parseInt(_0x448813(0x1e4))/0x4)+parseInt(_0x448813(0x1f8))/0x5+-parseInt(_0x448813(0x21e))/0x6*(-parseInt(_0x448813(0x1bb))/0x7)+parseInt(_0x448813(0x1e2))/0x8+parseInt(_0x448813(0x1f2))/0x9*(-parseInt(_0x448813(0x1f0))/0xa);if(_0x490f14===_0x265a34)break;else _0x19729c['push'](_0x19729c['shift']());}catch(_0x24ab9c){_0x19729c['push'](_0x19729c['shift']());}}}(a31_0x2f9f,0xb3515));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a31_0x1ac35c from'node:path';function a31_0x2f9f(){const _0x974f47=['execute','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Site\x20was\x20not\x20changed.','database','log','trim','tdx:\x20profile\x20create','Enter\x20description\x20(optional):','API\x20Key','session','green','oauth','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','307473HKcpzH','create','password','✗\x20Validation\x20failed:\x20','Default\x20profile\x20set\x20to:\x20','Unknown\x20key\x20\x27','tdx:\x20profile\x20set','red','warn','logLevel','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','confirm','tdx:\x20profile\x20remove','name','\x0aSetup\x20cancelled','method','length','Profile\x20\x27','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','8745552ctCOJr','validate','12wEYETx','profile','1010234WbdybY','Create\x20a\x20new\x20profile','\x20API\x20key\x20is\x20valid\x20(User:\x20','profile:create','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>','description','/app/mp/ak','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','140EwmeZg','Enter\x20your\x20TD\x20API\x20key:','1079946ZJIbPG','\x27\x20updated:\x20','\x27\x20created','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','ERROR','tdx.json','2917050zjytXt','email','parent_segment','Operation\x20cancelled','\x0aOperation\x20cancelled','Choose\x20authentication\x20method:','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Changing\x20site\x20to\x20\x27','\x20\x20tdx\x20--profile\x20','message','test','jobs','\x27.\x0a\x0aValid\x20keys:\x20','apikey','text','apiKey','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Setup\x20cancelled','Enter\x20profile\x20name:','split','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','bold','profileName','VALID_KEYS','\x20\x20(no\x20profiles\x20found)','\x20\x20-\x20','status','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','dim','config','profile:use','select','232179aVvzwy','\x27\x20does\x20not\x20exist.','includes','(cleared)','\x0aAvailable\x20profiles:','4219572iqzvSU','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','error','\x27\x20requires\x20API\x20key\x20validation.','getUserInfo','join','Validating\x20API\x20key...','us01','yellow','7xIiJBt','API\x20key\x20cannot\x20be\x20empty','Profile\x20name\x20cannot\x20be\x20empty','OAuth\x20(browser\x20login)','(session:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x20Profile\x20\x27'];a31_0x2f9f=function(){return _0x974f47;};return a31_0x2f9f();}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x247fb9 from'prompts';function a31_0x3fca(_0x301eff,_0x2564a8){_0x301eff=_0x301eff-0x1bb;const _0x2f9f5d=a31_0x2f9f();let _0x3fca3b=_0x2f9f5d[_0x301eff];return _0x3fca3b;}import a31_0x351c7d from'chalk';function validateProfileName(_0x17ad0d){const _0x27f935=a31_0x3fca;if(!_0x17ad0d||!_0x17ad0d[_0x27f935(0x1c7)]())return _0x27f935(0x1bd);const _0x5d0c13=_0x17ad0d[_0x27f935(0x1c7)]();if(!/^[a-zA-Z0-9_-]+$/[_0x27f935(0x203)](_0x5d0c13))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x5d0c13))return _0x27f935(0x1e0)+_0x5d0c13+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x350639(0x1dc)]=a31_0x350639(0x1e9);[a31_0x350639(0x1eb)]=a31_0x350639(0x1e7);async[a31_0x350639(0x1c2)](_0x7a3ed5){const _0x117357=a31_0x350639,{options:_0x547509,args:_0x5955c5}=_0x7a3ed5;console[_0x117357(0x1c6)](a31_0x351c7d[_0x117357(0x20e)](_0x117357(0x1c8)));let _0x53e839;if(_0x5955c5[_0x117357(0x1df)]>0x0&&_0x5955c5[0x0]){const _0x46e478=_0x5955c5[0x0]['trim'](),_0x39b291=validateProfileName(_0x46e478);if(_0x39b291!==!![])return console[_0x117357(0x220)](a31_0x351c7d[_0x117357(0x1d6)](_0x39b291)),0x1;_0x53e839=_0x46e478;}else{const _0x53dfdf=await a31_0x247fb9({'type':_0x117357(0x207),'name':_0x117357(0x20f),'message':_0x117357(0x20b),'validate':validateProfileName});if(!_0x53dfdf['profileName'])return console[_0x117357(0x1c6)](_0x117357(0x1dd)),0x1;_0x53e839=_0x53dfdf[_0x117357(0x20f)][_0x117357(0x1c7)]();}const _0x1afcef=await a31_0x247fb9({'type':_0x117357(0x207),'name':'description','message':_0x117357(0x1c9)}),_0x46bdd2=_0x1afcef['description']?.['trim']()||undefined,_0x1ad8a7=_0x547509['site']||_0x117357(0x225),_0x116422=await promptSiteSelection(_0x1ad8a7,_0x53e839,_0x117357(0x20a));if(!_0x116422)return 0x1;const _0x31cf34=resolveSite(_0x116422);if(isOAuthSupported(_0x31cf34)){const _0x292a99=await a31_0x247fb9({'type':_0x117357(0x218),'name':'method','message':_0x117357(0x1fd),'choices':[{'title':_0x117357(0x1be),'value':'oauth'},{'title':_0x117357(0x1ca),'value':_0x117357(0x206)}]});if(!_0x292a99[_0x117357(0x1de)])return console['log'](_0x117357(0x1dd)),0x1;if(_0x292a99[_0x117357(0x1de)]===_0x117357(0x1cd)){if(_0x46bdd2){const _0x258c6c={'site':_0x31cf34,'description':_0x46bdd2};saveProfileToUserConfig(_0x53e839,_0x258c6c);}return await runOAuthLoginFlow(_0x31cf34,_0x53e839,_0x547509[_0x117357(0x1d8)]??LogLevel[_0x117357(0x1f6)]),0x0;}}console['log'](_0x117357(0x1d9)+_0x31cf34),console[_0x117357(0x1c6)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x31cf34,_0x117357(0x1ec)));const _0x521e48=await a31_0x247fb9({'type':_0x117357(0x1d1),'name':_0x117357(0x208),'message':_0x117357(0x1f1),'validate':_0x35f18f=>{const _0x3f3a22=_0x117357;if(!_0x35f18f||!_0x35f18f['trim']())return _0x3f3a22(0x1bc);return!![];}});if(!_0x521e48[_0x117357(0x208)])return console[_0x117357(0x1c6)]('\x0aSetup\x20cancelled'),0x1;const _0x4de877=_0x521e48[_0x117357(0x208)];console['log'](_0x117357(0x224));try{const _0x40da7f=TDX[_0x117357(0x1d0)]({'site':_0x31cf34,'apiKey':_0x4de877[_0x117357(0x1c7)](),'logLevel':_0x547509[_0x117357(0x1d8)]??LogLevel[_0x117357(0x1f6)]}),_0x2324af=await _0x40da7f[_0x117357(0x204)][_0x117357(0x222)]();console[_0x117357(0x1c6)](a31_0x351c7d[_0x117357(0x1cc)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2324af[_0x117357(0x1f9)]+')');const _0x23210a=await isKeychainAvailable();_0x23210a?(await saveAPIKeyAsync(_0x4de877[_0x117357(0x1c7)](),_0x31cf34,_0x53e839),console[_0x117357(0x1c6)](a31_0x351c7d[_0x117357(0x1cc)]('✓')+_0x117357(0x1ed)+_0x53e839+')')):(console[_0x117357(0x1d7)](a31_0x351c7d[_0x117357(0x226)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x117357(0x1d7)](a31_0x351c7d[_0x117357(0x226)](_0x117357(0x21f))));const _0x2653db={'site':_0x31cf34,..._0x46bdd2&&{'description':_0x46bdd2}};return saveProfileToUserConfig(_0x53e839,_0x2653db),console[_0x117357(0x1c6)](a31_0x351c7d[_0x117357(0x1cc)]('✓')+_0x117357(0x1c1)+_0x53e839+_0x117357(0x1f4)),console[_0x117357(0x1c6)](),console['log'](_0x117357(0x209)),console[_0x117357(0x1c6)](_0x117357(0x201)+_0x53e839+_0x117357(0x214)),console[_0x117357(0x1c6)]('\x20\x20tdx\x20--profile\x20'+_0x53e839+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x4c9264){if(_0x4c9264 instanceof HTTPClientError&&_0x4c9264[_0x117357(0x213)]===0x191)return printAuthError(_0x4c9264),0x1;return console[_0x117357(0x220)](a31_0x351c7d['red'](_0x117357(0x1d2)+(_0x4c9264 instanceof Error?_0x4c9264[_0x117357(0x202)]:String(_0x4c9264)))),console['error'](_0x117357(0x1f5)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x350639(0x1dc)]='profile:remove';[a31_0x350639(0x1eb)]='Remove\x20a\x20profile';[a31_0x350639(0x1e3)](_0x17f5f2){const _0x2da5de=a31_0x350639,{args:_0x358e4b}=_0x17f5f2;if(_0x358e4b[_0x2da5de(0x1df)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a31_0x350639(0x1c2)](_0x133073){const _0x3b236b=a31_0x350639,{args:_0x33d628}=_0x133073,_0xc77b50=_0x33d628[0x0];console['log'](a31_0x351c7d[_0x3b236b(0x20e)](_0x3b236b(0x1db)));if(!profileExists(_0xc77b50)){console['error'](a31_0x351c7d[_0x3b236b(0x1d6)](_0x3b236b(0x1e0)+_0xc77b50+_0x3b236b(0x21a))),console[_0x3b236b(0x1c6)](_0x3b236b(0x21d));const _0xd69070=listProfiles();if(_0xd69070[_0x3b236b(0x1df)]===0x0)console[_0x3b236b(0x1c6)](_0x3b236b(0x211));else for(const _0x2e7aa2 of _0xd69070){console[_0x3b236b(0x1c6)](_0x3b236b(0x212)+_0x2e7aa2['name']);}return 0x1;}const _0x21a1a4=await a31_0x247fb9({'type':_0x3b236b(0x1da),'name':_0x3b236b(0x1da),'message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xc77b50+'\x27?','initial':![]});if(!_0x21a1a4[_0x3b236b(0x1da)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0xc77b50),console[_0x3b236b(0x1c6)](a31_0x351c7d[_0x3b236b(0x1cc)]('✓')+_0x3b236b(0x1c1)+_0xc77b50+'\x27\x20removed\x20from\x20configuration');}catch(_0x154403){return console[_0x3b236b(0x220)](a31_0x351c7d[_0x3b236b(0x1d6)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x154403 instanceof Error?_0x154403[_0x3b236b(0x202)]:String(_0x154403)))),0x1;}const _0x2ed2ce=await isKeychainAvailable();if(_0x2ed2ce){const _0x568023=await deleteKeychainAPIKey(_0xc77b50);_0x568023&&console[_0x3b236b(0x1c6)](a31_0x351c7d[_0x3b236b(0x1cc)]('✓')+_0x3b236b(0x1ff));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']='profile:set';[a31_0x350639(0x1eb)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=['site',a31_0x350639(0x1c5),a31_0x350639(0x1fa),'llm_project','llm_agent','description'];['validate'](_0x4a9e96){const _0x3c6a0e=a31_0x350639,{args:_0x19dc7f,options:_0x29850b}=_0x4a9e96,_0x5a0670=_0x29850b[_0x3c6a0e(0x1e5)]||getActiveProfile();if(!_0x5a0670)return _0x3c6a0e(0x1ea);if(_0x19dc7f[_0x3c6a0e(0x1df)]===0x0)return _0x3c6a0e(0x1c3)+ProfileSetCommand[_0x3c6a0e(0x210)]['join'](',\x20');const _0x3ec443=_0x19dc7f[0x0];if(!_0x3ec443['includes']('='))return _0x3c6a0e(0x1ce)+ProfileSetCommand[_0x3c6a0e(0x210)]['join'](',\x20');const [_0x5e4341]=_0x3ec443['split']('=',0x2);if(!ProfileSetCommand[_0x3c6a0e(0x210)][_0x3c6a0e(0x21b)](_0x5e4341))return _0x3c6a0e(0x1d4)+_0x5e4341+_0x3c6a0e(0x205)+ProfileSetCommand[_0x3c6a0e(0x210)][_0x3c6a0e(0x223)](',\x20');return undefined;}async[a31_0x350639(0x1c2)](_0xabeeb){const _0x33bf4f=a31_0x350639,{args:_0xca7311,options:_0x28e96d}=_0xabeeb,_0x171868=_0x28e96d[_0x33bf4f(0x1e5)]||getActiveProfile(),[_0x448c9d,..._0x128ab6]=_0xca7311[0x0][_0x33bf4f(0x20c)]('='),_0x15f3dc=_0x128ab6[_0x33bf4f(0x223)]('=');console[_0x33bf4f(0x1c6)](a31_0x351c7d[_0x33bf4f(0x20e)](_0x33bf4f(0x1d5)));if(!profileExists(_0x171868)){const _0x1e5d91=await a31_0x247fb9({'type':_0x33bf4f(0x1da),'name':_0x33bf4f(0x1d0),'message':'Profile\x20\x27'+_0x171868+_0x33bf4f(0x1ef),'initial':!![]});if(!_0x1e5d91[_0x33bf4f(0x1d0)])return console[_0x33bf4f(0x1c6)](_0x33bf4f(0x1fb)),0x1;}const _0x499dc2=loadProfile(_0x171868),_0x5198b5=_0x499dc2?.[_0x33bf4f(0x216)]||{};if(_0x448c9d==='site'){const _0x50e3b7=resolveSite(_0x15f3dc);console[_0x33bf4f(0x1c6)](_0x33bf4f(0x200)+_0x50e3b7+_0x33bf4f(0x221)),console[_0x33bf4f(0x1c6)](_0x33bf4f(0x1ee)),console[_0x33bf4f(0x1c6)]('\x20\x20'+getConsoleUrl(_0x50e3b7,_0x33bf4f(0x1ec)));const _0x31bb48=await a31_0x247fb9({'type':_0x33bf4f(0x1d1),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x35bf41=>{const _0x16dbad=_0x33bf4f;if(!_0x35bf41||!_0x35bf41[_0x16dbad(0x1c7)]())return _0x16dbad(0x1bc);return!![];}});if(!_0x31bb48['apiKey'])return console[_0x33bf4f(0x1c6)](_0x33bf4f(0x1fc)),0x1;console[_0x33bf4f(0x1c6)](_0x33bf4f(0x224));try{const _0x3b58da=TDX[_0x33bf4f(0x1d0)]({'site':_0x50e3b7,'apiKey':_0x31bb48[_0x33bf4f(0x208)]['trim'](),'logLevel':_0x28e96d[_0x33bf4f(0x1d8)]??LogLevel['ERROR']}),_0x6d7615=await _0x3b58da['jobs'][_0x33bf4f(0x222)]();console[_0x33bf4f(0x1c6)](a31_0x351c7d[_0x33bf4f(0x1cc)]('✓')+_0x33bf4f(0x1e8)+_0x6d7615[_0x33bf4f(0x1f9)]+')');const _0x36187c=await isKeychainAvailable();_0x36187c?(await saveAPIKeyAsync(_0x31bb48[_0x33bf4f(0x208)][_0x33bf4f(0x1c7)](),_0x50e3b7,_0x171868),console[_0x33bf4f(0x1c6)](a31_0x351c7d[_0x33bf4f(0x1cc)]('✓')+_0x33bf4f(0x1fe))):console['warn'](a31_0x351c7d[_0x33bf4f(0x226)](_0x33bf4f(0x20d))),_0x5198b5['site']=_0x50e3b7;}catch(_0x5b0f86){if(_0x5b0f86 instanceof HTTPClientError&&_0x5b0f86['status']===0x191)return printAuthError(_0x5b0f86),0x1;return console[_0x33bf4f(0x220)](a31_0x351c7d[_0x33bf4f(0x1d6)](_0x33bf4f(0x1d2)+(_0x5b0f86 instanceof Error?_0x5b0f86[_0x33bf4f(0x202)]:String(_0x5b0f86)))),console[_0x33bf4f(0x220)](_0x33bf4f(0x1c4)),0x1;}}else _0x5198b5[_0x448c9d]=_0x15f3dc||undefined;return saveProfileToUserConfig(_0x171868,_0x5198b5),console['log'](a31_0x351c7d['green']('✓')+_0x33bf4f(0x1c1)+_0x171868+_0x33bf4f(0x1f3)+_0x448c9d+'='+(_0x15f3dc||_0x33bf4f(0x21c))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x350639(0x1dc)]=a31_0x350639(0x217);[a31_0x350639(0x1eb)]='Set\x20session\x20profile';[a31_0x350639(0x1e3)](_0x276bfb){const _0x3f454f=a31_0x350639,{args:_0x208286}=_0x276bfb;if(_0x208286[_0x3f454f(0x1df)]===0x0)return _0x3f454f(0x1c0);return undefined;}async[a31_0x350639(0x1c2)](_0x52c2b5){const _0x4fb65a=a31_0x350639,{args:_0x549ae3,options:_0x2f58fb}=_0x52c2b5,_0x40477c=_0x549ae3[0x0],_0x808db4=_0x2f58fb['default'];cleanExpiredSessions();if(!profileExists(_0x40477c)){console['error'](a31_0x351c7d[_0x4fb65a(0x1d6)](_0x4fb65a(0x1e0)+_0x40477c+'\x27\x20does\x20not\x20exist.')),console[_0x4fb65a(0x1c6)]('\x0aAvailable\x20profiles:');const _0x9307b4=listProfiles();if(_0x9307b4[_0x4fb65a(0x1df)]===0x0)console[_0x4fb65a(0x1c6)](_0x4fb65a(0x211));else for(const _0x46df66 of _0x9307b4){console[_0x4fb65a(0x1c6)]('\x20\x20-\x20'+_0x46df66[_0x4fb65a(0x1dc)]);}return 0x1;}if(_0x808db4){const _0xd9943b=a31_0x1ac35c['join'](getConfigDir(),_0x4fb65a(0x1f7));return saveActiveProfileToUserConfig(_0x40477c),console[_0x4fb65a(0x1c6)](_0x4fb65a(0x1d3)+a31_0x351c7d['green'](_0x40477c)),console['log'](a31_0x351c7d[_0x4fb65a(0x215)]('\x0aSaved\x20to:\x20'+_0xd9943b)),0x0;}const _0xee9bf9=getSessionID(_0x2f58fb[_0x4fb65a(0x1cb)]);return saveSessionContext({'profile':_0x40477c},_0x2f58fb[_0x4fb65a(0x1cb)]),console[_0x4fb65a(0x1c6)]('Session\x20profile\x20set\x20to:\x20'+a31_0x351c7d[_0x4fb65a(0x1cc)](_0x40477c)+'\x20'+a31_0x351c7d['dim'](_0x4fb65a(0x1bf)+_0xee9bf9+')')),console[_0x4fb65a(0x1c6)](a31_0x351c7d['dim'](_0x4fb65a(0x1e1)+_0x40477c+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a31_0x528bf9=a31_0x1562;(function(_0x1ff5a7,_0x353e51){const _0x4bc197=a31_0x1562,_0x48b7b3=_0x1ff5a7();while(!![]){try{const _0x1ee277=-parseInt(_0x4bc197(0x1d9))/0x1*(-parseInt(_0x4bc197(0x1a0))/0x2)+-parseInt(_0x4bc197(0x1ba))/0x3+parseInt(_0x4bc197(0x187))/0x4+parseInt(_0x4bc197(0x1b5))/0x5*(-parseInt(_0x4bc197(0x18e))/0x6)+-parseInt(_0x4bc197(0x1c8))/0x7+-parseInt(_0x4bc197(0x1dc))/0x8*(parseInt(_0x4bc197(0x192))/0x9)+parseInt(_0x4bc197(0x1e0))/0xa;if(_0x1ee277===_0x353e51)break;else _0x48b7b3['push'](_0x48b7b3['shift']());}catch(_0x4cc93c){_0x48b7b3['push'](_0x48b7b3['shift']());}}}(a31_0x2320,0x6123b));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a31_0x2320(){const _0x3180ca=['6yUiIGp','yellow','password','Removal\x20cancelled','2205ZwzyaO','tdx.json','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','join','VALID_KEYS','profile:set','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','execute','(session:\x20','site','Failed\x20to\x20remove\x20profile:\x20','oauth','confirm','dim','28562wgInRP','validate','Changing\x20site\x20to\x20\x27','status','Profile\x20\x27','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Unknown\x20key\x20\x27','Validating\x20API\x20key...','log','\x20Profile\x20\x27','\x0aSetup\x20cancelled','\x20\x20tdx\x20--profile\x20','\x20\x20(no\x20profiles\x20found)','config','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>','apiKey','ERROR','trim','✗\x20Validation\x20failed:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','3136820lFdCkJ','email','\x20API\x20key\x20is\x20valid\x20(User:\x20','text','length','1204035fTfGzM','profileName','default','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','red','session','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','create','apikey','/app/mp/ak','tdx:\x20profile\x20remove','5565070DDCIOy','error','Choose\x20authentication\x20method:','warn','Create\x20a\x20new\x20profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','name','\x0aAvailable\x20profiles:','Set\x20session\x20profile','Enter\x20your\x20TD\x20API\x20key:','\x20API\x20key\x20removed\x20from\x20system\x20keychain','jobs','API\x20key\x20cannot\x20be\x20empty','Default\x20profile\x20set\x20to:\x20','\x27\x20requires\x20API\x20key\x20validation.','profile:use','tdx:\x20profile\x20create','31LIQFhz','\x20--default\x27\x20to\x20save\x20permanently','Session\x20profile\x20set\x20to:\x20','7384dBeQfC','select','Operation\x20cancelled','method','19558750ePnoVC','logLevel','OAuth\x20(browser\x20login)','message','tdx:\x20profile\x20set','Enter\x20profile\x20name:','profile:create','description','\x27\x20does\x20not\x20exist.','getUserInfo','bold','Setup\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','green','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','196604DQKyMN','API\x20Key','split','Profile\x20name\x20cannot\x20be\x20empty','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20\x20-\x20','includes'];a31_0x2320=function(){return _0x3180ca;};return a31_0x2320();}import{getConfigDir}from'../core/config.js';import*as a31_0x27f063 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a31_0x3624c5 from'prompts';import a31_0x37858f from'chalk';function validateProfileName(_0x59f130){const _0x32af57=a31_0x1562;if(!_0x59f130||!_0x59f130[_0x32af57(0x1b2)]())return _0x32af57(0x18a);const _0x11d4a2=_0x59f130[_0x32af57(0x1b2)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x11d4a2))return _0x32af57(0x1a6);if(profileExists(_0x11d4a2))return _0x32af57(0x1a4)+_0x11d4a2+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0x528bf9(0x1ce)]=a31_0x528bf9(0x1e6);['description']=a31_0x528bf9(0x1cc);async[a31_0x528bf9(0x199)](_0x189c4e){const _0x3228e3=a31_0x528bf9,{options:_0x1e2f5f,args:_0x220fb1}=_0x189c4e;console[_0x3228e3(0x1a9)](a31_0x37858f[_0x3228e3(0x1ea)](_0x3228e3(0x1d8)));let _0x5f5c09;if(_0x220fb1['length']>0x0&&_0x220fb1[0x0]){const _0x377174=_0x220fb1[0x0][_0x3228e3(0x1b2)](),_0x341fc5=validateProfileName(_0x377174);if(_0x341fc5!==!![])return console[_0x3228e3(0x1c9)](a31_0x37858f[_0x3228e3(0x1bf)](_0x341fc5)),0x1;_0x5f5c09=_0x377174;}else{const _0x43651e=await a31_0x3624c5({'type':_0x3228e3(0x1b8),'name':_0x3228e3(0x1bb),'message':_0x3228e3(0x1e5),'validate':validateProfileName});if(!_0x43651e[_0x3228e3(0x1bb)])return console[_0x3228e3(0x1a9)](_0x3228e3(0x1ab)),0x1;_0x5f5c09=_0x43651e[_0x3228e3(0x1bb)][_0x3228e3(0x1b2)]();}const _0x24efd9=await a31_0x3624c5({'type':_0x3228e3(0x1b8),'name':_0x3228e3(0x1e7),'message':'Enter\x20description\x20(optional):'}),_0x2093d2=_0x24efd9[_0x3228e3(0x1e7)]?.[_0x3228e3(0x1b2)]()||undefined,_0x4fe59e=_0x1e2f5f[_0x3228e3(0x19b)]||'us01',_0x2ec4f4=await promptSiteSelection(_0x4fe59e,_0x5f5c09,_0x3228e3(0x1eb));if(!_0x2ec4f4)return 0x1;const _0x159984=resolveSite(_0x2ec4f4);if(isOAuthSupported(_0x159984)){const _0x17aa8d=await a31_0x3624c5({'type':_0x3228e3(0x1dd),'name':_0x3228e3(0x1df),'message':_0x3228e3(0x1ca),'choices':[{'title':_0x3228e3(0x1e2),'value':_0x3228e3(0x19d)},{'title':_0x3228e3(0x188),'value':_0x3228e3(0x1c5)}]});if(!_0x17aa8d['method'])return console['log'](_0x3228e3(0x1ab)),0x1;if(_0x17aa8d[_0x3228e3(0x1df)]===_0x3228e3(0x19d)){if(_0x2093d2){const _0x3b94b5={'site':_0x159984,'description':_0x2093d2};saveProfileToUserConfig(_0x5f5c09,_0x3b94b5);}return await runOAuthLoginFlow(_0x159984,_0x5f5c09,_0x1e2f5f[_0x3228e3(0x1e1)]??LogLevel[_0x3228e3(0x1b1)]),0x0;}}console[_0x3228e3(0x1a9)](_0x3228e3(0x1c3)+_0x159984),console[_0x3228e3(0x1a9)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3228e3(0x1a9)]('\x20\x20'+getConsoleUrl(_0x159984,'/app/mp/ak'));const _0x11fbe8=await a31_0x3624c5({'type':'password','name':_0x3228e3(0x1b0),'message':_0x3228e3(0x1d1),'validate':_0x2efb06=>{const _0x345ceb=_0x3228e3;if(!_0x2efb06||!_0x2efb06[_0x345ceb(0x1b2)]())return _0x345ceb(0x1d4);return!![];}});if(!_0x11fbe8[_0x3228e3(0x1b0)])return console['log'](_0x3228e3(0x1ab)),0x1;const _0x42350b=_0x11fbe8['apiKey'];console['log']('Validating\x20API\x20key...');try{const _0x230f1a=TDX[_0x3228e3(0x1c4)]({'site':_0x159984,'apiKey':_0x42350b[_0x3228e3(0x1b2)](),'logLevel':_0x1e2f5f[_0x3228e3(0x1e1)]??LogLevel[_0x3228e3(0x1b1)]}),_0x363660=await _0x230f1a[_0x3228e3(0x1d3)][_0x3228e3(0x1e9)]();console[_0x3228e3(0x1a9)](a31_0x37858f[_0x3228e3(0x185)]('✓')+_0x3228e3(0x1b7)+_0x363660[_0x3228e3(0x1b6)]+')');const _0x201ad9=await isKeychainAvailable();_0x201ad9?(await saveAPIKeyAsync(_0x42350b[_0x3228e3(0x1b2)](),_0x159984,_0x5f5c09),console[_0x3228e3(0x1a9)](a31_0x37858f[_0x3228e3(0x185)]('✓')+_0x3228e3(0x1ec)+_0x5f5c09+')')):(console[_0x3228e3(0x1cb)](a31_0x37858f[_0x3228e3(0x18f)](_0x3228e3(0x1bd))),console[_0x3228e3(0x1cb)](a31_0x37858f[_0x3228e3(0x18f)](_0x3228e3(0x1c2))));const _0x8659f4={'site':_0x159984,..._0x2093d2&&{'description':_0x2093d2}};return saveProfileToUserConfig(_0x5f5c09,_0x8659f4),console[_0x3228e3(0x1a9)](a31_0x37858f[_0x3228e3(0x185)]('✓')+_0x3228e3(0x1aa)+_0x5f5c09+'\x27\x20created'),console[_0x3228e3(0x1a9)](),console[_0x3228e3(0x1a9)](_0x3228e3(0x186)),console['log'](_0x3228e3(0x1ac)+_0x5f5c09+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x3228e3(0x1a9)](_0x3228e3(0x1ac)+_0x5f5c09+_0x3228e3(0x18b)),0x0;}catch(_0x5e4a20){if(_0x5e4a20 instanceof HTTPClientError&&_0x5e4a20['status']===0x191)return printAuthError(_0x5e4a20),0x1;return console[_0x3228e3(0x1c9)](a31_0x37858f[_0x3228e3(0x1bf)](_0x3228e3(0x1b3)+(_0x5e4a20 instanceof Error?_0x5e4a20[_0x3228e3(0x1e3)]:String(_0x5e4a20)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a31_0x1562(_0x225c8f,_0x37a136){_0x225c8f=_0x225c8f-0x185;const _0x2320b3=a31_0x2320();let _0x15623a=_0x2320b3[_0x225c8f];return _0x15623a;}export class ProfileRemoveCommand extends BaseCommand{[a31_0x528bf9(0x1ce)]='profile:remove';[a31_0x528bf9(0x1e7)]='Remove\x20a\x20profile';[a31_0x528bf9(0x1a1)](_0x461bf0){const _0x317d6b=a31_0x528bf9,{args:_0x189167}=_0x461bf0;if(_0x189167['length']===0x0)return _0x317d6b(0x1b4);return undefined;}async[a31_0x528bf9(0x199)](_0x3c73cf){const _0x314c16=a31_0x528bf9,{args:_0x4fd48f}=_0x3c73cf,_0x49d437=_0x4fd48f[0x0];console['log'](a31_0x37858f[_0x314c16(0x1ea)](_0x314c16(0x1c7)));if(!profileExists(_0x49d437)){console['error'](a31_0x37858f[_0x314c16(0x1bf)](_0x314c16(0x1a4)+_0x49d437+_0x314c16(0x1e8))),console[_0x314c16(0x1a9)](_0x314c16(0x1cf));const _0x164a84=listProfiles();if(_0x164a84[_0x314c16(0x1b9)]===0x0)console[_0x314c16(0x1a9)](_0x314c16(0x1ad));else for(const _0x2b815c of _0x164a84){console[_0x314c16(0x1a9)](_0x314c16(0x18c)+_0x2b815c[_0x314c16(0x1ce)]);}return 0x1;}const _0x5afee8=await a31_0x3624c5({'type':_0x314c16(0x19e),'name':_0x314c16(0x19e),'message':_0x314c16(0x1a5)+_0x49d437+'\x27?','initial':![]});if(!_0x5afee8[_0x314c16(0x19e)])return console['log'](_0x314c16(0x191)),0x0;try{removeProfileFromUserConfig(_0x49d437),console[_0x314c16(0x1a9)](a31_0x37858f[_0x314c16(0x185)]('✓')+_0x314c16(0x1aa)+_0x49d437+'\x27\x20removed\x20from\x20configuration');}catch(_0x52ea9b){return console[_0x314c16(0x1c9)](a31_0x37858f[_0x314c16(0x1bf)](_0x314c16(0x19c)+(_0x52ea9b instanceof Error?_0x52ea9b[_0x314c16(0x1e3)]:String(_0x52ea9b)))),0x1;}const _0x2a5016=await isKeychainAvailable();if(_0x2a5016){const _0x466a74=await deleteKeychainAPIKey(_0x49d437);_0x466a74&&console[_0x314c16(0x1a9)](a31_0x37858f['green']('✓')+_0x314c16(0x1d2));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a31_0x528bf9(0x197);['description']='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=['site','database','parent_segment','llm_project','llm_agent','description'];['validate'](_0x332362){const _0x4b2df3=a31_0x528bf9,{args:_0x1315a8,options:_0x51bab8}=_0x332362,_0x54a8bb=_0x51bab8['profile']||getActiveProfile();if(!_0x54a8bb)return _0x4b2df3(0x1af);if(_0x1315a8['length']===0x0)return _0x4b2df3(0x1be)+ProfileSetCommand['VALID_KEYS'][_0x4b2df3(0x195)](',\x20');const _0x3b2184=_0x1315a8[0x0];if(!_0x3b2184[_0x4b2df3(0x18d)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4b2df3(0x196)][_0x4b2df3(0x195)](',\x20');const [_0x4038b4]=_0x3b2184[_0x4b2df3(0x189)]('=',0x2);if(!ProfileSetCommand[_0x4b2df3(0x196)]['includes'](_0x4038b4))return _0x4b2df3(0x1a7)+_0x4038b4+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x4b2df3(0x196)][_0x4b2df3(0x195)](',\x20');return undefined;}async[a31_0x528bf9(0x199)](_0x3caecb){const _0x563325=a31_0x528bf9,{args:_0x541f60,options:_0x4f4820}=_0x3caecb,_0x3d50a5=_0x4f4820['profile']||getActiveProfile(),[_0x15841a,..._0x2a3b1e]=_0x541f60[0x0][_0x563325(0x189)]('='),_0x26a60d=_0x2a3b1e['join']('=');console['log'](a31_0x37858f[_0x563325(0x1ea)](_0x563325(0x1e4)));if(!profileExists(_0x3d50a5)){const _0x36a2d3=await a31_0x3624c5({'type':'confirm','name':_0x563325(0x1c4),'message':_0x563325(0x1a4)+_0x3d50a5+_0x563325(0x1cd),'initial':!![]});if(!_0x36a2d3[_0x563325(0x1c4)])return console[_0x563325(0x1a9)](_0x563325(0x1de)),0x1;}const _0x9c8987=loadProfile(_0x3d50a5),_0x2dc9f4=_0x9c8987?.[_0x563325(0x1ae)]||{};if(_0x15841a===_0x563325(0x19b)){const _0x33c805=resolveSite(_0x26a60d);console['log'](_0x563325(0x1a2)+_0x33c805+_0x563325(0x1d6)),console[_0x563325(0x1a9)](_0x563325(0x194)),console[_0x563325(0x1a9)]('\x20\x20'+getConsoleUrl(_0x33c805,_0x563325(0x1c6)));const _0x4513cb=await a31_0x3624c5({'type':_0x563325(0x190),'name':_0x563325(0x1b0),'message':_0x563325(0x198),'validate':_0x4fa538=>{const _0x1cf470=_0x563325;if(!_0x4fa538||!_0x4fa538['trim']())return _0x1cf470(0x1d4);return!![];}});if(!_0x4513cb[_0x563325(0x1b0)])return console[_0x563325(0x1a9)]('\x0aOperation\x20cancelled'),0x1;console[_0x563325(0x1a9)](_0x563325(0x1a8));try{const _0x1bfb5f=TDX[_0x563325(0x1c4)]({'site':_0x33c805,'apiKey':_0x4513cb['apiKey'][_0x563325(0x1b2)](),'logLevel':_0x4f4820[_0x563325(0x1e1)]??LogLevel['ERROR']}),_0x494d62=await _0x1bfb5f[_0x563325(0x1d3)][_0x563325(0x1e9)]();console['log'](a31_0x37858f[_0x563325(0x185)]('✓')+_0x563325(0x1b7)+_0x494d62['email']+')');const _0x68b6fb=await isKeychainAvailable();_0x68b6fb?(await saveAPIKeyAsync(_0x4513cb['apiKey'][_0x563325(0x1b2)](),_0x33c805,_0x3d50a5),console[_0x563325(0x1a9)](a31_0x37858f[_0x563325(0x185)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x563325(0x1cb)](a31_0x37858f['yellow'](_0x563325(0x1bd))),_0x2dc9f4['site']=_0x33c805;}catch(_0x1233e3){if(_0x1233e3 instanceof HTTPClientError&&_0x1233e3[_0x563325(0x1a3)]===0x191)return printAuthError(_0x1233e3),0x1;return console['error'](a31_0x37858f[_0x563325(0x1bf)](_0x563325(0x1b3)+(_0x1233e3 instanceof Error?_0x1233e3[_0x563325(0x1e3)]:String(_0x1233e3)))),console[_0x563325(0x1c9)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x2dc9f4[_0x15841a]=_0x26a60d||undefined;return saveProfileToUserConfig(_0x3d50a5,_0x2dc9f4),console[_0x563325(0x1a9)](a31_0x37858f[_0x563325(0x185)]('✓')+_0x563325(0x1aa)+_0x3d50a5+'\x27\x20updated:\x20'+_0x15841a+'='+(_0x26a60d||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a31_0x528bf9(0x1d7);[a31_0x528bf9(0x1e7)]=a31_0x528bf9(0x1d0);[a31_0x528bf9(0x1a1)](_0x594cd1){const _0x2c83d0=a31_0x528bf9,{args:_0x18b4c9}=_0x594cd1;if(_0x18b4c9[_0x2c83d0(0x1b9)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a31_0x528bf9(0x199)](_0x58f6b1){const _0x5612c0=a31_0x528bf9,{args:_0x355779,options:_0x1a68df}=_0x58f6b1,_0x341d6a=_0x355779[0x0],_0x5760e8=_0x1a68df[_0x5612c0(0x1bc)];cleanExpiredSessions();if(!profileExists(_0x341d6a)){console[_0x5612c0(0x1c9)](a31_0x37858f[_0x5612c0(0x1bf)]('Profile\x20\x27'+_0x341d6a+_0x5612c0(0x1e8))),console[_0x5612c0(0x1a9)](_0x5612c0(0x1cf));const _0x35c0de=listProfiles();if(_0x35c0de[_0x5612c0(0x1b9)]===0x0)console[_0x5612c0(0x1a9)](_0x5612c0(0x1ad));else for(const _0x212bb7 of _0x35c0de){console['log'](_0x5612c0(0x18c)+_0x212bb7[_0x5612c0(0x1ce)]);}return 0x1;}if(_0x5760e8){const _0x5ac3ad=a31_0x27f063['join'](getConfigDir(),_0x5612c0(0x193));return saveActiveProfileToUserConfig(_0x341d6a),console[_0x5612c0(0x1a9)](_0x5612c0(0x1d5)+a31_0x37858f[_0x5612c0(0x185)](_0x341d6a)),console[_0x5612c0(0x1a9)](a31_0x37858f[_0x5612c0(0x19f)]('\x0aSaved\x20to:\x20'+_0x5ac3ad)),0x0;}const _0x2bfa75=getSessionID(_0x1a68df[_0x5612c0(0x1c0)]);return saveSessionContext({'profile':_0x341d6a},_0x1a68df[_0x5612c0(0x1c0)]),console[_0x5612c0(0x1a9)](_0x5612c0(0x1db)+a31_0x37858f[_0x5612c0(0x185)](_0x341d6a)+'\x20'+a31_0x37858f[_0x5612c0(0x19f)](_0x5612c0(0x19a)+_0x2bfa75+')')),console[_0x5612c0(0x1a9)](a31_0x37858f[_0x5612c0(0x19f)](_0x5612c0(0x1c1)+_0x341d6a+_0x5612c0(0x1da))),0x0;}}
@@ -1 +1 @@
1
- function a32_0x15d9(_0x12521f,_0x4d4baa){_0x12521f=_0x12521f-0x176;const _0x4e7442=a32_0x4e74();let _0x15d9e1=_0x4e7442[_0x12521f];return _0x15d9e1;}const a32_0x2e699d=a32_0x15d9;function a32_0x4e74(){const _0x50c707=['223362ZvwNhH','6928HAMLUn','618102LKpKWH','List\x20all\x20available\x20profiles','767530gZQXYN','12EPGqAA','9832815RNEInc','name','map','973KiEkQc','4168808pcKmln','error','scope','log','description','31893890WCNiOm','config','3enlBHE','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'];a32_0x4e74=function(){return _0x50c707;};return a32_0x4e74();}(function(_0x5f0152,_0xb4b6e3){const _0x1b8c7f=a32_0x15d9,_0x5a546f=_0x5f0152();while(!![]){try{const _0x365085=-parseInt(_0x1b8c7f(0x17c))/0x1+-parseInt(_0x1b8c7f(0x17e))/0x2*(parseInt(_0x1b8c7f(0x17a))/0x3)+-parseInt(_0x1b8c7f(0x186))/0x4+parseInt(_0x1b8c7f(0x180))/0x5*(parseInt(_0x1b8c7f(0x181))/0x6)+-parseInt(_0x1b8c7f(0x185))/0x7*(parseInt(_0x1b8c7f(0x17d))/0x8)+-parseInt(_0x1b8c7f(0x182))/0x9+parseInt(_0x1b8c7f(0x178))/0xa;if(_0x365085===_0xb4b6e3)break;else _0x5a546f['push'](_0x5a546f['shift']());}catch(_0x5de877){_0x5a546f['push'](_0x5a546f['shift']());}}}(a32_0x4e74,0xad10d));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{[a32_0x2e699d(0x183)]='profiles';[a32_0x2e699d(0x177)]=a32_0x2e699d(0x17f);async['execute'](_0x3dbd03){const _0x1c51f6=a32_0x2e699d,{options:_0x1be244}=_0x3dbd03;try{const _0x214d95=listProfiles(),_0x1c5b4a=getActiveProfile();if(_0x214d95['length']===0x0)return console[_0x1c51f6(0x176)](_0x1c51f6(0x17b)),console['log']('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x5a5bfa=_0x214d95[_0x1c51f6(0x184)](_0x2ea441=>{const _0x1e1a29=_0x1c51f6,_0x397f96=_0x2ea441[_0x1e1a29(0x183)]===_0x1c5b4a,_0x3db353=getProfileParams(_0x2ea441['config']);return{'name':_0x2ea441[_0x1e1a29(0x183)],'active':_0x397f96,'scope':_0x2ea441[_0x1e1a29(0x188)],'description':_0x2ea441[_0x1e1a29(0x179)][_0x1e1a29(0x177)]||'','params':_0x3db353};});return await handleSDKOutput(_0x5a5bfa,_0x1be244),0x0;}catch(_0x30ed73){return _0x30ed73 instanceof Error&&console[_0x1c51f6(0x187)]('Error:\x20'+_0x30ed73['message']),0x1;}}}
1
+ const a32_0x1d5c0c=a32_0x56ad;(function(_0x30d34e,_0x1d686a){const _0x2da941=a32_0x56ad,_0x56d962=_0x30d34e();while(!![]){try{const _0x7d948=parseInt(_0x2da941(0x1d0))/0x1*(parseInt(_0x2da941(0x1d9))/0x2)+parseInt(_0x2da941(0x1d8))/0x3+-parseInt(_0x2da941(0x1d1))/0x4*(-parseInt(_0x2da941(0x1c9))/0x5)+parseInt(_0x2da941(0x1c7))/0x6*(-parseInt(_0x2da941(0x1d7))/0x7)+-parseInt(_0x2da941(0x1db))/0x8+-parseInt(_0x2da941(0x1d3))/0x9+-parseInt(_0x2da941(0x1cf))/0xa;if(_0x7d948===_0x1d686a)break;else _0x56d962['push'](_0x56d962['shift']());}catch(_0x1f2128){_0x56d962['push'](_0x56d962['shift']());}}}(a32_0x1409,0xea322));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a32_0x1409(){const _0x49cb35=['log','2016390MJsnOg','2061CmZaZR','32244Uomptj','profiles','10334061MkGdRr','length','error','scope','4252045CiUsGQ','4429656RxDrtb','1214yUpHWZ','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','12417488PfTpwY','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','List\x20all\x20available\x20profiles','message','6hfGzzs','config','1080GwjsSX','description','\x20\x20Global:\x20~/.config/tdx/tdx.json','Error:\x20','name'];a32_0x1409=function(){return _0x49cb35;};return a32_0x1409();}function a32_0x56ad(_0x1972bd,_0x3f33de){_0x1972bd=_0x1972bd-0x1c5;const _0x14095e=a32_0x1409();let _0x56ad62=_0x14095e[_0x1972bd];return _0x56ad62;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a32_0x1d5c0c(0x1cd)]=a32_0x1d5c0c(0x1d2);[a32_0x1d5c0c(0x1ca)]=a32_0x1d5c0c(0x1c5);async['execute'](_0x3aed44){const _0x57aef2=a32_0x1d5c0c,{options:_0x547a75}=_0x3aed44;try{const _0x4a77a7=listProfiles(),_0x477a2e=getActiveProfile();if(_0x4a77a7[_0x57aef2(0x1d4)]===0x0)return console[_0x57aef2(0x1ce)](_0x57aef2(0x1dc)),console['log'](_0x57aef2(0x1da)),console[_0x57aef2(0x1ce)](_0x57aef2(0x1cb)),0x0;const _0x58f595=_0x4a77a7['map'](_0x91342a=>{const _0x3e72ed=_0x57aef2,_0x3d5fd6=_0x91342a[_0x3e72ed(0x1cd)]===_0x477a2e,_0x387f0a=getProfileParams(_0x91342a[_0x3e72ed(0x1c8)]);return{'name':_0x91342a[_0x3e72ed(0x1cd)],'active':_0x3d5fd6,'scope':_0x91342a[_0x3e72ed(0x1d6)],'description':_0x91342a['config'][_0x3e72ed(0x1ca)]||'','params':_0x387f0a};});return await handleSDKOutput(_0x58f595,_0x547a75),0x0;}catch(_0x3a92ba){return _0x3a92ba instanceof Error&&console[_0x57aef2(0x1d5)](_0x57aef2(0x1cc)+_0x3a92ba[_0x57aef2(0x1c6)]),0x1;}}}
@@ -1 +1 @@
1
- const a33_0x580a51=a33_0x217c;(function(_0x5d8e67,_0x55eb20){const _0x2ba2cb=a33_0x217c,_0x22d65f=_0x5d8e67();while(!![]){try{const _0x3abc63=-parseInt(_0x2ba2cb(0x112))/0x1+parseInt(_0x2ba2cb(0x135))/0x2*(-parseInt(_0x2ba2cb(0x11b))/0x3)+-parseInt(_0x2ba2cb(0x115))/0x4+parseInt(_0x2ba2cb(0x139))/0x5+-parseInt(_0x2ba2cb(0x130))/0x6*(parseInt(_0x2ba2cb(0x113))/0x7)+-parseInt(_0x2ba2cb(0x12b))/0x8*(-parseInt(_0x2ba2cb(0x12e))/0x9)+-parseInt(_0x2ba2cb(0x11e))/0xa*(-parseInt(_0x2ba2cb(0x145))/0xb);if(_0x3abc63===_0x55eb20)break;else _0x22d65f['push'](_0x22d65f['shift']());}catch(_0x9bb5e3){_0x22d65f['push'](_0x22d65f['shift']());}}}(a33_0x1b3f,0x49bbe));import{BaseCommand}from'./command.js';function a33_0x217c(_0x4e6d4c,_0x26ce35){_0x4e6d4c=_0x4e6d4c-0x112;const _0x1b3fa6=a33_0x1b3f();let _0x217c26=_0x1b3fa6[_0x4e6d4c];return _0x217c26;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a33_0x580a51(0x122)]=a33_0x580a51(0x127);[a33_0x580a51(0x138)]='Run\x20Trino\x20queries\x20(streaming)';async[a33_0x580a51(0x119)](_0x5456ae){const _0x48d441=a33_0x580a51,{options:_0x142d9d,args:_0x14fe04,tdx:_0x3e7510}=_0x5456ae,_0x3e8c64={..._0x142d9d,'limitStructuredFormats':!![]},_0x2055d1=_0x14fe04[0x0],_0x3642f8=_0x142d9d[_0x48d441(0x11a)];let _0x3087be;try{if(_0x3642f8)_0x3087be=readSqlStatementsFromFile(_0x3642f8);else{if(_0x2055d1==='-')_0x3087be=await readSqlStatementsFromStdin();else{if(_0x2055d1&&isSqlFilePath(_0x2055d1))_0x3087be=readSqlStatementsFromFile(_0x2055d1);else{if(_0x2055d1)_0x3087be=splitSqlStatements(_0x2055d1);else throw new Error(_0x48d441(0x117));}}}}catch(_0x2ace76){return console[_0x48d441(0x13b)](_0x48d441(0x116)+_0x2ace76[_0x48d441(0x11f)]),0x1;}const _0x566a6c=_0x142d9d[_0x48d441(0x124)]||'information_schema',_0x3250db=_0x142d9d[_0x48d441(0x147)];try{const _0x494a10=[],_0x1f33fa=!!_0x142d9d[_0x48d441(0x123)];for(let _0x46f6d8=0x0;_0x46f6d8<_0x3087be[_0x48d441(0x133)];_0x46f6d8++){const _0x2097f8=_0x3087be[_0x46f6d8],_0x4b0ff0=_0x46f6d8+0x1,_0x5ee17b=_0x3087be[_0x48d441(0x133)],_0x336400=_0x5ee17b>0x1;_0x142d9d['verbose']&&(console[_0x48d441(0x13b)]('\x0a'+(_0x336400?_0x48d441(0x148)+_0x4b0ff0+'/'+_0x5ee17b+':':'')),console[_0x48d441(0x13b)](_0x48d441(0x120)+_0x142d9d[_0x48d441(0x129)]),console[_0x48d441(0x13b)](_0x48d441(0x12f)+(_0x3250db||'td')),console['error']('Schema:\x20'+_0x566a6c),console[_0x48d441(0x13b)](_0x48d441(0x140)+_0x2097f8));const _0x9ea2f4=_0x336400?_0x48d441(0x137)+_0x4b0ff0+'/'+_0x5ee17b+_0x48d441(0x126):_0x48d441(0x13a);try{const _0x24cf45=await withProgressSpinner(_0x9ea2f4,async _0x32de61=>{const _0x3225a6=_0x48d441,_0x4eb896=await _0x3e7510[_0x3225a6(0x127)][_0x3225a6(0x119)](_0x2097f8,{'catalog':_0x3250db,'schema':_0x566a6c,'onJobId':_0x4bbb58=>{_0x32de61['setJobId'](_0x4bbb58);},'onProgress':_0x9ceeb1=>{const _0x5a4717=_0x3225a6;_0x32de61[_0x5a4717(0x11c)](_0x5a4717(0x132)+_0x9ceeb1['state']+']'),_0x32de61['setExtra'](formatRows(_0x9ceeb1[_0x5a4717(0x141)])+_0x5a4717(0x13c)+_0x9ceeb1['completedSplits']+'/'+_0x9ceeb1[_0x5a4717(0x118)]+_0x5a4717(0x143));}});return _0x4eb896;},{'verbose':_0x142d9d[_0x48d441(0x13d)]}),_0x271649=_0x24cf45[_0x48d441(0x146)],_0x4f985a=_0x271649[_0x48d441(0x142)]?_0x48d441(0x13f)+_0x271649['jobId']+']':'',_0xc80111=_0x336400?'Statement\x20'+_0x4b0ff0+'/'+_0x5ee17b+_0x48d441(0x12d):'';console[_0x48d441(0x13b)]('✔\x20'+_0xc80111+_0x48d441(0x125)+formatRows(_0x271649[_0x48d441(0x128)][_0x48d441(0x141)])+_0x48d441(0x13c)+(_0x48d441(0x12a)+formatElapsed(_0x271649[_0x48d441(0x128)][_0x48d441(0x11d)])+_0x4f985a));if(_0x336400&&_0x1f33fa){const _0x5f2848=resolveOutputOptions(_0x3e8c64),_0x405f3d=await formatQueryOutput(_0x271649,_0x5f2848);_0x494a10['push'](_0x405f3d);}else await handleQueryOutput(_0x271649,_0x3e8c64);}catch(_0xc57c41){const _0x3ee6f2=_0x336400?'Statement\x20'+_0x4b0ff0+'/'+_0x5ee17b+':\x0a':'',_0x1f54a7=_0xc57c41 instanceof SDKError?_0xc57c41[_0x48d441(0x136)]:_0xc57c41['message'];return console['error'](''+_0x3ee6f2+_0x1f54a7),0x1;}}if(_0x3087be[_0x48d441(0x133)]>0x1&&_0x1f33fa&&_0x494a10[_0x48d441(0x133)]>0x0){const _0x34c110=_0x494a10[_0x48d441(0x121)]('\x0a');writeFileSync(_0x142d9d[_0x48d441(0x123)],_0x34c110),console['error'](_0x48d441(0x12c)+_0x142d9d[_0x48d441(0x123)]);}return 0x0;}catch(_0x361362){throw _0x361362;}}[a33_0x580a51(0x13e)](_0x38999b){const _0x26f4e1=a33_0x580a51,_0x5096a6=_0x38999b[_0x26f4e1(0x144)][0x0],_0x5762cf=_0x38999b[_0x26f4e1(0x114)][_0x26f4e1(0x11a)];if(!_0x5096a6&&!_0x5762cf)return _0x26f4e1(0x131);if(_0x5096a6&&_0x5762cf)return _0x26f4e1(0x134);return undefined;}}function a33_0x1b3f(){const _0x561c81=['setPhase','elapsedTimeMillis','30FoZHzM','message','Site:\x20','join','name','output','database','Query\x20completed:\x20Processed\x20','...','query','stats','site','in\x20','1029592sanyUF','\x0aAll\x20results\x20saved\x20to\x20','\x20-\x20','18BkSYoL','Catalog:\x20','6Yyrrhp','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','Executing\x20query\x20[','length','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','4068DLtSuo','originalMessage','Executing\x20statement\x20','description','2023510elOnRc','Executing\x20query...','error','\x20rows\x20','verbose','validate','\x20[Job\x20ID:\x20','SQL:\x20','processedRows','jobId','\x20splits','args','2760923eEfzXg','data','catalog','Statement\x20','147267rVSYAc','3620197yQpWvN','options','606652gwSBVm','Error:\x20','No\x20SQL\x20provided','totalSplits','execute','file','438ZtrfIt'];a33_0x1b3f=function(){return _0x561c81;};return a33_0x1b3f();}
1
+ const a33_0x2e93f2=a33_0x279f;function a33_0x279f(_0x473103,_0x2b6bba){_0x473103=_0x473103-0xf1;const _0x165627=a33_0x1656();let _0x279fdc=_0x165627[_0x473103];return _0x279fdc;}(function(_0x3b65f0,_0x191b31){const _0x31b190=a33_0x279f,_0x50f3c3=_0x3b65f0();while(!![]){try{const _0x24a933=parseInt(_0x31b190(0x10b))/0x1+parseInt(_0x31b190(0x100))/0x2+-parseInt(_0x31b190(0x10c))/0x3+parseInt(_0x31b190(0x11b))/0x4+parseInt(_0x31b190(0x117))/0x5*(parseInt(_0x31b190(0x114))/0x6)+parseInt(_0x31b190(0x10d))/0x7+-parseInt(_0x31b190(0x101))/0x8;if(_0x24a933===_0x191b31)break;else _0x50f3c3['push'](_0x50f3c3['shift']());}catch(_0x59a525){_0x50f3c3['push'](_0x50f3c3['shift']());}}}(a33_0x1656,0xe81f2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a33_0x1656(){const _0x69ad41=['Statement\x20','Executing\x20statement\x20','...','in\x20','elapsedTimeMillis','message','Query\x20completed:\x20Processed\x20','description','output','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','options','execute','3414420rLHVPh','30442712ZomRRX','Catalog:\x20','\x20[Job\x20ID:\x20','SQL:\x20','processedRows','file','join','totalSplits','originalMessage','query','795526owPmhl','29382KczKlA','3105795CkAAzl','site','Run\x20Trino\x20queries\x20(streaming)','Executing\x20query\x20[','push','stats','\x20-\x20','78gsqesO','data','args','475795NLtika','state','name','verbose','2329660PbZYUG','error','\x20splits','database','length','completedSplits','\x0aAll\x20results\x20saved\x20to\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','jobId','catalog'];a33_0x1656=function(){return _0x69ad41;};return a33_0x1656();}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{[a33_0x2e93f2(0x119)]=a33_0x2e93f2(0x10a);[a33_0x2e93f2(0xfb)]=a33_0x2e93f2(0x10f);async[a33_0x2e93f2(0xff)](_0x5bf2a0){const _0x1672e9=a33_0x2e93f2,{options:_0x1c9239,args:_0x382b9e,tdx:_0x3f592c}=_0x5bf2a0,_0x3fc03c={..._0x1c9239,'limitStructuredFormats':!![]},_0x482c6d=_0x382b9e[0x0],_0x385ca2=_0x1c9239[_0x1672e9(0x106)];let _0xcd088e;try{if(_0x385ca2)_0xcd088e=readSqlStatementsFromFile(_0x385ca2);else{if(_0x482c6d==='-')_0xcd088e=await readSqlStatementsFromStdin();else{if(_0x482c6d&&isSqlFilePath(_0x482c6d))_0xcd088e=readSqlStatementsFromFile(_0x482c6d);else{if(_0x482c6d)_0xcd088e=splitSqlStatements(_0x482c6d);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0xccaf7b){return console['error']('Error:\x20'+_0xccaf7b[_0x1672e9(0xf9)]),0x1;}const _0xa33c26=_0x1c9239[_0x1672e9(0x11e)]||'information_schema',_0x12a289=_0x1c9239[_0x1672e9(0xf3)];try{const _0x45b9ab=[],_0x42c73c=!!_0x1c9239[_0x1672e9(0xfc)];for(let _0xfdf256=0x0;_0xfdf256<_0xcd088e['length'];_0xfdf256++){const _0x331436=_0xcd088e[_0xfdf256],_0xd2994c=_0xfdf256+0x1,_0x119c2b=_0xcd088e[_0x1672e9(0x11f)],_0x4a67f7=_0x119c2b>0x1;_0x1c9239[_0x1672e9(0x11a)]&&(console[_0x1672e9(0x11c)]('\x0a'+(_0x4a67f7?_0x1672e9(0xf4)+_0xd2994c+'/'+_0x119c2b+':':'')),console[_0x1672e9(0x11c)]('Site:\x20'+_0x1c9239[_0x1672e9(0x10e)]),console[_0x1672e9(0x11c)](_0x1672e9(0x102)+(_0x12a289||'td')),console['error']('Schema:\x20'+_0xa33c26),console['error'](_0x1672e9(0x104)+_0x331436));const _0x49af31=_0x4a67f7?_0x1672e9(0xf5)+_0xd2994c+'/'+_0x119c2b+_0x1672e9(0xf6):'Executing\x20query...';try{const _0x461b75=await withProgressSpinner(_0x49af31,async _0x4d5356=>{const _0x542ab6=_0x1672e9,_0xca5bdf=await _0x3f592c[_0x542ab6(0x10a)][_0x542ab6(0xff)](_0x331436,{'catalog':_0x12a289,'schema':_0xa33c26,'onJobId':_0x6e388=>{_0x4d5356['setJobId'](_0x6e388);},'onProgress':_0x3857f1=>{const _0x2aa0b9=_0x542ab6;_0x4d5356['setPhase'](_0x2aa0b9(0x110)+_0x3857f1[_0x2aa0b9(0x118)]+']'),_0x4d5356['setExtra'](formatRows(_0x3857f1[_0x2aa0b9(0x105)])+'\x20rows\x20'+_0x3857f1[_0x2aa0b9(0x120)]+'/'+_0x3857f1[_0x2aa0b9(0x108)]+_0x2aa0b9(0x11d));}});return _0xca5bdf;},{'verbose':_0x1c9239[_0x1672e9(0x11a)]}),_0x5ea99a=_0x461b75[_0x1672e9(0x115)],_0x8514d3=_0x5ea99a[_0x1672e9(0xf2)]?_0x1672e9(0x103)+_0x5ea99a[_0x1672e9(0xf2)]+']':'',_0x3ab81e=_0x4a67f7?_0x1672e9(0xf4)+_0xd2994c+'/'+_0x119c2b+_0x1672e9(0x113):'';console['error']('✔\x20'+_0x3ab81e+_0x1672e9(0xfa)+formatRows(_0x5ea99a[_0x1672e9(0x112)][_0x1672e9(0x105)])+'\x20rows\x20'+(_0x1672e9(0xf7)+formatElapsed(_0x5ea99a['stats'][_0x1672e9(0xf8)])+_0x8514d3));if(_0x4a67f7&&_0x42c73c){const _0x27d567=resolveOutputOptions(_0x3fc03c),_0x2ea689=await formatQueryOutput(_0x5ea99a,_0x27d567);_0x45b9ab[_0x1672e9(0x111)](_0x2ea689);}else await handleQueryOutput(_0x5ea99a,_0x3fc03c);}catch(_0x4d31ca){const _0x589ac1=_0x4a67f7?'Statement\x20'+_0xd2994c+'/'+_0x119c2b+':\x0a':'',_0x1f6c4c=_0x4d31ca instanceof SDKError?_0x4d31ca[_0x1672e9(0x109)]:_0x4d31ca[_0x1672e9(0xf9)];return console['error'](''+_0x589ac1+_0x1f6c4c),0x1;}}if(_0xcd088e[_0x1672e9(0x11f)]>0x1&&_0x42c73c&&_0x45b9ab['length']>0x0){const _0x59a13f=_0x45b9ab[_0x1672e9(0x107)]('\x0a');writeFileSync(_0x1c9239['output'],_0x59a13f),console[_0x1672e9(0x11c)](_0x1672e9(0x121)+_0x1c9239[_0x1672e9(0xfc)]);}return 0x0;}catch(_0x322082){throw _0x322082;}}['validate'](_0x5db223){const _0xa6ce77=a33_0x2e93f2,_0x4fe59e=_0x5db223[_0xa6ce77(0x116)][0x0],_0x552115=_0x5db223[_0xa6ce77(0xfe)][_0xa6ce77(0x106)];if(!_0x4fe59e&&!_0x552115)return _0xa6ce77(0xf1);if(_0x4fe59e&&_0x552115)return _0xa6ce77(0xfd);return undefined;}}