@treasuredata/tdx 0.28.3 → 0.28.5

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 (184) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/job-command.js +1 -1
  24. package/dist/commands/journey-command.js +1 -1
  25. package/dist/commands/journey-validate-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/mcp-command.js +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/schedule-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pull-command.js +1 -1
  37. package/dist/commands/segment-push-command.js +1 -1
  38. package/dist/commands/segment-update-command.js +1 -1
  39. package/dist/commands/segment-use-command.js +1 -1
  40. package/dist/commands/segment-validate-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/status-command.js +1 -1
  44. package/dist/commands/tables.js +1 -1
  45. package/dist/commands/unset-command.js +1 -1
  46. package/dist/commands/use-command.js +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.js +1 -1
  52. package/dist/core/connection-cache.js +1 -1
  53. package/dist/core/constants.js +1 -1
  54. package/dist/core/credential-cache.js +1 -1
  55. package/dist/core/global-context.js +1 -1
  56. package/dist/core/keychain.js +1 -1
  57. package/dist/core/profile.js +1 -1
  58. package/dist/core/project-config.js +1 -1
  59. package/dist/core/session.js +1 -1
  60. package/dist/core/user-cache.js +1 -1
  61. package/dist/core/version.js +1 -1
  62. package/dist/index.js +1 -1
  63. package/dist/mcp/server.js +1 -1
  64. package/dist/mcp/tools/index.js +1 -1
  65. package/dist/mcp/tools/tdx-run.js +1 -1
  66. package/dist/mcp/tools/tdx-search.js +1 -1
  67. package/dist/mcp/utils.js +1 -1
  68. package/dist/proxy/claude-usage-tracker.js +1 -1
  69. package/dist/proxy/passthrough-server.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/agent/tool-target-registry.js +1 -1
  80. package/dist/sdk/api.js +1 -1
  81. package/dist/sdk/client/cdp-api-client.js +1 -1
  82. package/dist/sdk/client/delivery-api-client.js +1 -1
  83. package/dist/sdk/client/endpoints.js +1 -1
  84. package/dist/sdk/client/engage-api-client.js +1 -1
  85. package/dist/sdk/client/http-client.js +1 -1
  86. package/dist/sdk/client/llm-api-client.js +1 -1
  87. package/dist/sdk/client/rate-limiter.js +1 -1
  88. package/dist/sdk/client/td-api-client.js +1 -1
  89. package/dist/sdk/client/trino-api-client.js +1 -1
  90. package/dist/sdk/client/workflow-client.js +1 -1
  91. package/dist/sdk/connection-validator.js +1 -1
  92. package/dist/sdk/connection.js +1 -1
  93. package/dist/sdk/delivery.js +1 -1
  94. package/dist/sdk/engage/campaign-pull.js +1 -1
  95. package/dist/sdk/engage/campaign-push.js +1 -1
  96. package/dist/sdk/engage/campaign-validator.js +1 -1
  97. package/dist/sdk/engage/campaign-yaml.js +1 -1
  98. package/dist/sdk/engage/types/campaign-def.js +1 -1
  99. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  100. package/dist/sdk/engage.js +1 -1
  101. package/dist/sdk/errors.js +1 -1
  102. package/dist/sdk/index.js +1 -1
  103. package/dist/sdk/io/index.js +1 -1
  104. package/dist/sdk/io/node-filesystem.js +1 -1
  105. package/dist/sdk/job.js +1 -1
  106. package/dist/sdk/journey.js +1 -1
  107. package/dist/sdk/llm/chat-cache.js +1 -1
  108. package/dist/sdk/llm/index.js +1 -1
  109. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  110. package/dist/sdk/llm/model-factors.js +1 -1
  111. package/dist/sdk/personalization.js +1 -1
  112. package/dist/sdk/query/index.js +1 -1
  113. package/dist/sdk/query/sql-parser.js +1 -1
  114. package/dist/sdk/realtime.js +1 -1
  115. package/dist/sdk/schedule.js +1 -1
  116. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  117. package/dist/sdk/segment/fields-display.js +1 -1
  118. package/dist/sdk/segment/file-discovery.js +1 -1
  119. package/dist/sdk/segment/journey-utils.d.ts.map +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-utils.js.map +1 -1
  122. package/dist/sdk/segment/journey-validator.js +1 -1
  123. package/dist/sdk/segment/journey-validator.js.map +1 -1
  124. package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
  125. package/dist/sdk/segment/journey-yaml.js +1 -1
  126. package/dist/sdk/segment/journey-yaml.js.map +1 -1
  127. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  128. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  129. package/dist/sdk/segment/pull-workflow.js +1 -1
  130. package/dist/sdk/segment/push-recovery.js +1 -1
  131. package/dist/sdk/segment/push-workflow.js +1 -1
  132. package/dist/sdk/segment/resolution-context.js +1 -1
  133. package/dist/sdk/segment/segment-path-parser.js +1 -1
  134. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  135. package/dist/sdk/segment/target-resolution.js +1 -1
  136. package/dist/sdk/segment/tdx-config.js +1 -1
  137. package/dist/sdk/segment/validate-files.js +1 -1
  138. package/dist/sdk/segment/yaml-validator.js +1 -1
  139. package/dist/sdk/segment.js +1 -1
  140. package/dist/sdk/types/index.js +1 -1
  141. package/dist/sdk/types/progress.js +1 -1
  142. package/dist/sdk/user.js +1 -1
  143. package/dist/sdk/util/format-detector.js +1 -1
  144. package/dist/sdk/util/formatters.js +1 -1
  145. package/dist/sdk/util/index.js +1 -1
  146. package/dist/sdk/util/tree-formatter.js +1 -1
  147. package/dist/sdk/workflow/archive-validation.js +1 -1
  148. package/dist/sdk/workflow/clone-workflow.js +1 -1
  149. package/dist/sdk/workflow/index.js +1 -1
  150. package/dist/sdk/workflow/pull-workflow.js +1 -1
  151. package/dist/sdk/workflow/push-workflow.js +1 -1
  152. package/dist/sdk/workflow/tdx-config.js +1 -1
  153. package/dist/sdk/workflow/workflow-utils.js +1 -1
  154. package/dist/test-utils/command-runner.js +1 -1
  155. package/dist/test-utils/factories.js +1 -1
  156. package/dist/test-utils/fixtures.js +1 -1
  157. package/dist/test-utils/http-mock.js +1 -1
  158. package/dist/test-utils/index.js +1 -1
  159. package/dist/utils/async.js +1 -1
  160. package/dist/utils/colors.js +1 -1
  161. package/dist/utils/diff.js +1 -1
  162. package/dist/utils/file-permissions.js +1 -1
  163. package/dist/utils/global-cache.js +1 -1
  164. package/dist/utils/json-loader.js +1 -1
  165. package/dist/utils/local-cache.js +1 -1
  166. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  167. package/dist/utils/logger/formatters/index.js +1 -1
  168. package/dist/utils/logger/handlers/console-handler.js +1 -1
  169. package/dist/utils/logger/handlers/file-handler.js +1 -1
  170. package/dist/utils/logger/handlers/index.js +1 -1
  171. package/dist/utils/logger/handlers/null-handler.js +1 -1
  172. package/dist/utils/logger/index.js +1 -1
  173. package/dist/utils/logger/logger.js +1 -1
  174. package/dist/utils/logger/types.js +1 -1
  175. package/dist/utils/option-validation.js +1 -1
  176. package/dist/utils/process.js +1 -1
  177. package/dist/utils/prompt.js +1 -1
  178. package/dist/utils/spinner.js +1 -1
  179. package/dist/utils/sse-parser.js +1 -1
  180. package/dist/utils/string-utils.js +1 -1
  181. package/dist/utils/table-ref-parser.js +1 -1
  182. package/dist/utils/tdx-logger.js +1 -1
  183. package/dist/utils/version-check.js +1 -1
  184. package/package.json +1 -1
@@ -1 +1 @@
1
- const a26_0x4cc703=a26_0x428a;(function(_0xf76de6,_0x28d9e9){const _0x181bf5=a26_0x428a,_0x1628f7=_0xf76de6();while(!![]){try{const _0x1bfdcf=-parseInt(_0x181bf5(0x1ae))/0x1*(parseInt(_0x181bf5(0xbf))/0x2)+parseInt(_0x181bf5(0xf7))/0x3*(-parseInt(_0x181bf5(0x15d))/0x4)+-parseInt(_0x181bf5(0x10b))/0x5+parseInt(_0x181bf5(0x19c))/0x6+-parseInt(_0x181bf5(0x20c))/0x7*(-parseInt(_0x181bf5(0x242))/0x8)+-parseInt(_0x181bf5(0x1c8))/0x9*(-parseInt(_0x181bf5(0x15c))/0xa)+parseInt(_0x181bf5(0xe4))/0xb*(parseInt(_0x181bf5(0x234))/0xc);if(_0x1bfdcf===_0x28d9e9)break;else _0x1628f7['push'](_0x1628f7['shift']());}catch(_0x547e29){_0x1628f7['push'](_0x1628f7['shift']());}}}(a26_0x7bf1,0xd3f98));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x40ee15 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a26_0xc5b354 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a26_0x4cc703(0x108),LEGACY_PARENT_SEGMENT_DIR=a26_0x4cc703(0xfa);function openBrowser(_0x11af2a){const _0x5383b7=a26_0x4cc703,_0xf57189=process['platform'],_0x308e41=_0xf57189===_0x5383b7(0x241)?'open':_0xf57189===_0x5383b7(0x12c)?_0x5383b7(0x128):_0x5383b7(0x1c2);spawn(_0x308e41,[_0x11af2a],{'detached':!![],'stdio':_0x5383b7(0x12b)})['unref']();}function migrateLegacyDirectory(){const _0x104742=a26_0x4cc703;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2415ce=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2415ce[_0x104742(0x21c)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x104742(0xd5)](a26_0xc5b354[_0x104742(0xc9)](_0x104742(0xce)+LEGACY_PARENT_SEGMENT_DIR+_0x104742(0x178)+PARENT_SEGMENT_DIR+_0x104742(0x177))),console[_0x104742(0xd5)](a26_0xc5b354['dim'](_0x104742(0x1f3)+LEGACY_PARENT_SEGMENT_DIR+_0x104742(0x23e))),![];console[_0x104742(0xd5)](a26_0xc5b354['yellow'](_0x104742(0x1ca)+LEGACY_PARENT_SEGMENT_DIR+_0x104742(0x134)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x104742(0xd5)](a26_0xc5b354[_0x104742(0x127)](_0x104742(0xc2)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x33d1db){const _0x529dc0=_0x33d1db instanceof Error?_0x33d1db['message']:String(_0x33d1db);return console[_0x104742(0xd5)](a26_0xc5b354['red'](_0x104742(0x110)+_0x529dc0+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x48dd48){return migrateLegacyDirectory(),super['run'](_0x48dd48);}}function resolveYamlFile(_0x5c0e7d){const _0x280efe=a26_0x4cc703;if(_0x5c0e7d[_0x280efe(0x117)]('.yml')||_0x5c0e7d[_0x280efe(0x117)]('.yaml'))return _0x5c0e7d;return a26_0x40ee15['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5c0e7d)+_0x280efe(0x118));}function a26_0x428a(_0x54c95f,_0xa70576){_0x54c95f=_0x54c95f-0xbf;const _0x7bf14a=a26_0x7bf1();let _0x428aa6=_0x7bf14a[_0x54c95f];return _0x428aa6;}function formatProgressMessage(_0x465d70){const _0x18eb64=a26_0x4cc703,_0x496c49=_0x465d70[_0x18eb64(0x1fd)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x496c49){const [,_0x49d811,_0x5280e1,_0x36b375='']=_0x496c49;return a26_0xc5b354[_0x18eb64(0x122)](_0x49d811+':')+'\x20'+_0x5280e1+a26_0xc5b354['dim'](_0x36b375);}return a26_0xc5b354[_0x18eb64(0x122)](_0x465d70);}function showFileNotFoundError(_0x30a7d5,_0x4312d7){const _0x19ff35=a26_0x4cc703;console[_0x19ff35(0xd5)](a26_0xc5b354[_0x19ff35(0x1b6)](_0x19ff35(0x1a1)+_0x30a7d5+'\x0a')),console[_0x19ff35(0xd5)](a26_0xc5b354[_0x19ff35(0x140)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x4312d7+_0x19ff35(0xc0)));}function displayRealtimeValidation(_0x13875d){const _0x474da6=a26_0x4cc703;if(!_0x13875d[_0x474da6(0x1e1)])return;const _0x1f607c=_0x13875d[_0x474da6(0x1e1)],_0x496776=_0x1f607c[_0x474da6(0x225)]?a26_0xc5b354[_0x474da6(0x127)]('⚡\x20Enabled'):a26_0xc5b354[_0x474da6(0xc9)]('⚡\x20Not\x20enabled');console['error']('\x0a'+a26_0xc5b354[_0x474da6(0x122)](_0x474da6(0x1d9))+'\x20'+_0x496776);if(_0x1f607c[_0x474da6(0x1de)]&&_0x1f607c[_0x474da6(0x1de)][_0x474da6(0x231)]>0x0){console[_0x474da6(0xd5)]('\x20\x20'+a26_0xc5b354[_0x474da6(0x122)](_0x474da6(0x1fb))+'\x20'+_0x1f607c[_0x474da6(0x1de)][_0x474da6(0x231)]+'\x20configured');for(const _0x17536a of _0x1f607c[_0x474da6(0x1de)]){const _0x266a4b=_0x17536a['sourceTableValid']===![]?a26_0xc5b354[_0x474da6(0x1b6)]('✘'):a26_0xc5b354['green']('✔');console[_0x474da6(0xd5)](_0x474da6(0xd0)+_0x266a4b+'\x20'+_0x17536a['name']),_0x17536a['sourceTableError']&&console['error'](_0x474da6(0x1c9)+a26_0xc5b354['red'](_0x17536a['sourceTableError']));}}if(_0x1f607c[_0x474da6(0x158)]&&_0x1f607c[_0x474da6(0x158)][_0x474da6(0x231)]>0x0){console[_0x474da6(0xd5)]('\x20\x20'+a26_0xc5b354[_0x474da6(0x122)](_0x474da6(0x1e7))+'\x20'+_0x1f607c['attributes'][_0x474da6(0x231)]+_0x474da6(0x20a));for(const _0x1d4181 of _0x1f607c[_0x474da6(0x158)]){const _0x1cf4e4=_0x1d4181[_0x474da6(0xf4)]?a26_0xc5b354[_0x474da6(0x127)]('✔'):a26_0xc5b354['red']('✘');console[_0x474da6(0xd5)](_0x474da6(0xd0)+_0x1cf4e4+'\x20'+_0x1d4181[_0x474da6(0x201)]+'\x20'+a26_0xc5b354['dim']('('+_0x1d4181['type']+')'));}}if(_0x1f607c[_0x474da6(0x135)]){const _0x266c99=_0x1f607c[_0x474da6(0x135)][_0x474da6(0x152)]?.[_0x474da6(0x231)]?_0x474da6(0xf5)+_0x1f607c['idStitching'][_0x474da6(0x152)][_0x474da6(0x185)](',\x20')+']':'';console['error']('\x20\x20'+a26_0xc5b354[_0x474da6(0x122)](_0x474da6(0x228))+'\x20'+_0x1f607c['idStitching'][_0x474da6(0x101)]+_0x266c99);}if(_0x1f607c['personalizationServices']&&_0x1f607c[_0x474da6(0x124)]['length']>0x0){console['error']('\x20\x20'+a26_0xc5b354['dim']('Personalization:')+'\x20'+_0x1f607c['personalizationServices'][_0x474da6(0x231)]+'\x20service'+(_0x1f607c['personalizationServices'][_0x474da6(0x231)]!==0x1?'s':''));for(const _0x365185 of _0x1f607c[_0x474da6(0x124)]){console[_0x474da6(0xd5)]('\x20\x20\x20\x20-\x20'+_0x365185[_0x474da6(0x201)]);}}}function showParentSegmentNotSetError(_0x25c42a){const _0x3a0668=a26_0x4cc703;console['error'](a26_0xc5b354['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x3a0668(0xd5)](_0x25c42a);}export class ParentSegmentListCommand extends BaseCommand{['name']=a26_0x4cc703(0x14b);[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x1b9);async[a26_0x4cc703(0x207)](_0x507f4b){const _0x1f80fc=a26_0x4cc703,{options:_0x419654,args:_0x940f95,tdx:_0x109ba4}=_0x507f4b,_0xa274ca=_0x940f95[0x0];_0x419654[_0x1f80fc(0x168)]&&(console[_0x1f80fc(0xd5)](_0x1f80fc(0x1f8)+_0x419654['site']),_0xa274ca&&console[_0x1f80fc(0xd5)](_0x1f80fc(0x1b1)+_0xa274ca));const _0x8c0cf9=await withSpinner(_0xa274ca?_0x1f80fc(0x22d)+_0xa274ca+_0x1f80fc(0x213):_0x1f80fc(0x189),()=>_0x109ba4[_0x1f80fc(0x1c6)]['listParents'](),{'verbose':_0x419654[_0x1f80fc(0x168)]});let _0x425dbe=_0x8c0cf9['data'];if(_0xa274ca){const _0x4ded0d=_0xa274ca[_0x1f80fc(0x219)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x1f80fc(0x219)](/\*/g,'.*')[_0x1f80fc(0x219)](/\?/g,'.'),_0x4eda85=new RegExp('^'+_0x4ded0d+'$','i');_0x425dbe=_0x425dbe[_0x1f80fc(0x107)](_0xdeef1a=>_0x4eda85['test'](_0xdeef1a[_0x1f80fc(0x158)][_0x1f80fc(0x201)]));}_0x425dbe['sort']((_0x1ccd19,_0x52a080)=>_0x1ccd19['attributes'][_0x1f80fc(0x201)][_0x1f80fc(0x216)](_0x52a080[_0x1f80fc(0x158)]['name'])),console[_0x1f80fc(0xd5)](_0x1f80fc(0x233)+_0x425dbe[_0x1f80fc(0x231)]+_0x1f80fc(0x143)+(_0x425dbe[_0x1f80fc(0x231)]!==0x1?'s':''));const _0xd84909=_0x4813ec=>{return getConsoleNextUrl(_0x419654['site'],'/app/dw/parentSegments/'+_0x4813ec);};if(_0x419654[_0x1f80fc(0x224)]===_0x1f80fc(0x155)||_0x419654[_0x1f80fc(0x224)]==='jsonl'){const _0x4cee42=_0x425dbe[_0x1f80fc(0x13b)](_0x10ee0f=>({..._0x10ee0f,'url':_0xd84909(_0x10ee0f['id'])}));await handleSDKOutput(_0x4cee42,_0x419654);}else{if(_0x425dbe[_0x1f80fc(0x231)]===0x0)_0xa274ca?console[_0x1f80fc(0x160)](_0x1f80fc(0x1b7)+_0xa274ca):console['log'](_0x1f80fc(0xd2));else for(const _0x1989ba of _0x425dbe){const _0x324c0d=_0x1989ba[_0x1f80fc(0x158)][_0x1f80fc(0x229)]?a26_0xc5b354[_0x1f80fc(0x122)]('\x20('+formatRows(_0x1989ba['attributes'][_0x1f80fc(0x229)])+')'):'',_0x362ccd=hyperlink(_0x1989ba[_0x1f80fc(0x158)][_0x1f80fc(0x201)],_0xd84909(_0x1989ba['id']));console[_0x1f80fc(0x160)](_0x1f80fc(0x13e)+_0x362ccd+_0x324c0d);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x240);[a26_0x4cc703(0x23b)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x282633){const _0x409638=a26_0x4cc703,{options:_0x672db8,args:_0x53a254,tdx:_0x4130f5}=_0x282633;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x409638(0xc5)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x415d15=_0x672db8;if(_0x53a254[_0x409638(0x231)]===0x0)return console['error'](a26_0xc5b354['red'](_0x409638(0xf6))),console[_0x409638(0xd5)](_0x409638(0x1ce)),0x1;const _0xeed01f=_0x53a254[0x0];if(!_0x415d15['database']||!_0x415d15[_0x409638(0x113)])return console[_0x409638(0xd5)](_0x409638(0x1b3)),console[_0x409638(0xd5)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x415d15[_0x409638(0x168)]&&(console['error'](_0x409638(0x1f8)+_0x415d15[_0x409638(0x161)]),console[_0x409638(0xd5)](_0x409638(0x245)+_0xeed01f),console[_0x409638(0xd5)]('Database:\x20'+_0x415d15['database']),console[_0x409638(0xd5)]('Table:\x20'+_0x415d15[_0x409638(0x113)]));const _0x2212a1=await loadJSONFromOptions(_0x415d15[_0x409638(0x158)],_0x415d15[_0x409638(0x1b8)]),_0x4656a7=await loadJSONFromOptions(_0x415d15['behaviors'],_0x415d15['behaviorsFile']),_0x4d96de=await loadJSONFromOptions(_0x415d15[_0x409638(0xda)],_0x415d15['customerGroupFile']),_0x2acfd3={'name':_0xeed01f,'description':_0x415d15[_0x409638(0x23b)],'scheduleType':_0x415d15[_0x409638(0x1fc)],'scheduleOption':_0x415d15[_0x409638(0xd3)],'timezone':_0x415d15[_0x409638(0x1fa)],'master':{'parentDatabaseName':_0x415d15[_0x409638(0xd4)],'parentTableName':_0x415d15[_0x409638(0x113)]},'attributes':_0x2212a1,'behaviors':_0x4656a7,'customerGroup':_0x4d96de},_0xff809e=await withSpinner(_0x409638(0x1d1)+_0xeed01f+_0x409638(0x213),()=>_0x4130f5[_0x409638(0x1c6)][_0x409638(0x18e)](_0x2acfd3),{'verbose':_0x672db8['verbose']}),_0x1abc49=_0xff809e[_0x409638(0x209)];return console['error']('✔\x20Created\x20parent\x20segment\x20\x27'+_0x1abc49[_0x409638(0x201)]+_0x409638(0x1c3)+_0x1abc49['id']),await handleSDKOutput([_0x1abc49],_0x672db8),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x145);['description']=a26_0x4cc703(0x193);async[a26_0x4cc703(0x207)](_0xf20781){const _0x1e4100=a26_0x4cc703,{options:_0x45c74e,args:_0x239302,tdx:_0x129803}=_0xf20781;console['error'](_0x1e4100(0x1f7)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x1e4100(0x1c0));const _0x15c474=_0x45c74e;if(_0x239302['length']===0x0)return console[_0x1e4100(0xd5)](a26_0xc5b354['red'](_0x1e4100(0xf6))),console['error'](_0x1e4100(0x146)),0x1;const _0x154b8c=_0x239302[0x0];_0x15c474[_0x1e4100(0x168)]&&(console[_0x1e4100(0xd5)](_0x1e4100(0x1f8)+_0x15c474[_0x1e4100(0x161)]),console[_0x1e4100(0xd5)](_0x1e4100(0xea)+_0x154b8c));const _0x371cb6=await withSpinner(_0x1e4100(0x12f)+_0x154b8c+_0x1e4100(0x213),()=>_0x129803['segment'][_0x1e4100(0x21f)](_0x154b8c),{'verbose':_0x15c474[_0x1e4100(0x168)]}),_0x9503f1=_0x371cb6[_0x1e4100(0x209)],_0x5a817a=await loadJSONFromOptions(_0x15c474[_0x1e4100(0xdc)],_0x15c474[_0x1e4100(0xcb)]),_0x50443e=await loadJSONFromOptions(_0x15c474[_0x1e4100(0x1b2)],_0x15c474['addBehaviorsFile']),_0x23e57b={'name':_0x9503f1[_0x1e4100(0x201)],'description':_0x15c474[_0x1e4100(0x23b)]!==undefined?_0x15c474[_0x1e4100(0x23b)]:_0x9503f1['description'],'scheduleType':_0x15c474[_0x1e4100(0x1fc)]!==undefined?_0x15c474['scheduleType']:_0x9503f1['scheduleType'],'scheduleOption':_0x15c474['scheduleOption']!==undefined?_0x15c474[_0x1e4100(0xd3)]:_0x9503f1[_0x1e4100(0xd3)],'timezone':_0x15c474[_0x1e4100(0x1fa)]!==undefined?_0x15c474['timezone']:_0x9503f1['timezone'],'master':_0x9503f1[_0x1e4100(0x1cf)],'attributes':_0x5a817a?[..._0x9503f1[_0x1e4100(0x158)]||[],..._0x5a817a]:_0x9503f1['attributes'],'behaviors':_0x50443e?[..._0x9503f1[_0x1e4100(0x16f)]||[],..._0x50443e]:_0x9503f1[_0x1e4100(0x16f)],'customerGroup':_0x9503f1['customerGroup']},_0x51d74b=await withSpinner(_0x1e4100(0x1a2)+_0x154b8c+_0x1e4100(0x213),()=>_0x129803[_0x1e4100(0x1c6)][_0x1e4100(0x1d0)](_0x154b8c,_0x23e57b),{'verbose':_0x15c474[_0x1e4100(0x168)]}),_0x46d5c2=_0x51d74b[_0x1e4100(0x209)];return console[_0x1e4100(0xd5)](_0x1e4100(0x114)+_0x46d5c2['name']+'\x27'),await handleSDKOutput([_0x46d5c2],_0x15c474),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x4cc703(0x201)]='segment:parent:pull';[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x23c);async['execute'](_0xb8a7b8){const _0x1d4c18=a26_0x4cc703,{options:_0x1142ed,args:_0x3e7753,tdx:_0x42a883}=_0xb8a7b8,_0x2f87f0=_0x1142ed,_0x882e07=_0x3e7753[0x0]||_0x1142ed[_0x1d4c18(0x1e6)];if(!_0x882e07)return showParentSegmentNotSetError(_0x1d4c18(0x121)+_0x1d4c18(0xc4)),0x1;if(_0x2f87f0['use']&&_0x2f87f0['output'])return console[_0x1d4c18(0xd5)](a26_0xc5b354[_0x1d4c18(0x1b6)](_0x1d4c18(0x112))),console[_0x1d4c18(0xd5)](a26_0xc5b354['dim'](_0x1d4c18(0x12e))),console[_0x1d4c18(0xd5)](a26_0xc5b354[_0x1d4c18(0x122)](_0x1d4c18(0x130)+PARENT_SEGMENT_DIR+_0x1d4c18(0x162))),console[_0x1d4c18(0xd5)](a26_0xc5b354[_0x1d4c18(0x140)](_0x1d4c18(0x1c5))),0x1;const _0x40de7f=_0x2f87f0['output']||a26_0x40ee15['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x882e07)+_0x1d4c18(0x118));_0x2f87f0[_0x1d4c18(0x168)]&&(console[_0x1d4c18(0xd5)](_0x1d4c18(0x1f8)+_0x2f87f0[_0x1d4c18(0x161)]),console[_0x1d4c18(0xd5)](_0x1d4c18(0xea)+_0x882e07),console[_0x1d4c18(0xd5)](_0x1d4c18(0x21e)+_0x40de7f));const _0x552106=await withSpinner(_0x1d4c18(0x19b)+_0x882e07+'\x27...',()=>_0x42a883[_0x1d4c18(0x1c6)][_0x1d4c18(0x119)](_0x882e07),{'verbose':_0x2f87f0['verbose']}),_0x94f75e=_0x552106[_0x1d4c18(0x209)];if(existsSync(_0x40de7f)){const _0x332c23=readFileSync(_0x40de7f,_0x1d4c18(0x14a)),_0x24ac47=generateDiff(_0x332c23,_0x94f75e);if(!hasChanges(_0x24ac47))console[_0x1d4c18(0xd5)](a26_0xc5b354['green']('✔')+_0x1d4c18(0x10f)+a26_0xc5b354[_0x1d4c18(0x140)](_0x40de7f)+'\x20is\x20already\x20up\x20to\x20date');else{console['error'](_0x1d4c18(0x243)+_0x40de7f+'\x27:'),console[_0x1d4c18(0xd5)]('─'[_0x1d4c18(0x212)](0x3c)),console[_0x1d4c18(0xd5)](formatDiffWithColors(_0x24ac47)),console['error']('─'['repeat'](0x3c));if(!_0x2f87f0['yes']){if(!isInteractive())return console[_0x1d4c18(0xd5)](a26_0xc5b354[_0x1d4c18(0x1b6)](_0x1d4c18(0x200)),_0x1d4c18(0x1d7)),console[_0x1d4c18(0xd5)](a26_0xc5b354[_0x1d4c18(0x122)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x4aafe2=await confirmKey(_0x1d4c18(0xd6)+_0x40de7f+'\x27?');if(!_0x4aafe2)return console[_0x1d4c18(0xd5)](a26_0xc5b354[_0x1d4c18(0xc9)](_0x1d4c18(0x123))),0x1;}writeFileSync(_0x40de7f,_0x94f75e,_0x1d4c18(0x14a)),console[_0x1d4c18(0xd5)](a26_0xc5b354['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0xc5b354['cyan'](_0x40de7f));}}else{const _0x2e65a2=a26_0x40ee15[_0x1d4c18(0x17f)](_0x40de7f);!existsSync(_0x2e65a2)&&mkdirSync(_0x2e65a2,{'recursive':!![]}),writeFileSync(_0x40de7f,_0x94f75e,'utf-8'),console[_0x1d4c18(0xd5)](a26_0xc5b354['green']('✔')+_0x1d4c18(0x166)+a26_0xc5b354['cyan'](_0x40de7f));}return saveSessionContext({'parent_segment':_0x882e07},_0x2f87f0[_0x1d4c18(0x15a)]),console[_0x1d4c18(0xd5)](a26_0xc5b354[_0x1d4c18(0x127)]('✔')+'\x20Context\x20set:\x20'+a26_0xc5b354[_0x1d4c18(0x122)](_0x1d4c18(0xfa))+_0x1d4c18(0x1dc)+a26_0xc5b354[_0x1d4c18(0x140)](_0x882e07)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x4cc703(0x201)]='segment:parent:push';['description']=a26_0x4cc703(0x12d);async['execute'](_0x5cdb6a){const _0x3d41da=a26_0x4cc703,{options:_0xeea499,args:_0x5e2174,tdx:_0x57edee}=_0x5cdb6a,_0x5b4b66=_0xeea499,_0x29f248=_0x5e2174[0x0]||_0xeea499['parentSegment'];if(!_0x29f248)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x3d41da(0x13c)),0x1;const _0x4b0f4f=resolveYamlFile(_0x29f248);if(!existsSync(_0x4b0f4f))return showFileNotFoundError(_0x4b0f4f,_0x29f248),0x1;_0x5b4b66[_0x3d41da(0x168)]&&(console[_0x3d41da(0xd5)]('Site:\x20'+_0x5b4b66[_0x3d41da(0x161)]),console['error'](_0x3d41da(0x11d)+_0x4b0f4f));let _0x4e65b6;try{_0x4e65b6=readFileSync(_0x4b0f4f,_0x3d41da(0x14a));}catch(_0x310f5f){const _0x1d8a60=_0x310f5f instanceof Error?_0x310f5f[_0x3d41da(0x14c)]:String(_0x310f5f);return console[_0x3d41da(0xd5)](_0x3d41da(0x10d)+_0x1d8a60),0x1;}const _0x48ce27=await withSpinner(_0x3d41da(0x16a),()=>_0x57edee['segment'][_0x3d41da(0x18a)](_0x4e65b6),{'verbose':_0x5b4b66[_0x3d41da(0x168)]}),_0x5c5bf8=_0x48ce27[_0x3d41da(0x209)],{isNew:_0xac13df,name:_0x31f603,hasChanges:_0x4a72fa,diffFormatted:_0x441052}=_0x5c5bf8;if(!_0x4a72fa)return console[_0x3d41da(0xd5)](_0x3d41da(0xfb)+_0x31f603+_0x3d41da(0xdb)),0x0;_0xac13df?console[_0x3d41da(0xd5)](_0x3d41da(0xe6)+_0x31f603+'\x27:'):console['error'](_0x3d41da(0x1ea)+_0x31f603+'\x27:');console[_0x3d41da(0xd5)]('─'[_0x3d41da(0x212)](0x3c)),console[_0x3d41da(0xd5)](_0x441052),console['error']('─'[_0x3d41da(0x212)](0x3c));const _0x13222e=_0xac13df?_0x3d41da(0x1ed)+_0x31f603+'\x27?':_0x3d41da(0x19e)+_0x31f603+'\x27?';if(!_0x5b4b66[_0x3d41da(0x205)]){if(!isInteractive())return console[_0x3d41da(0xd5)](a26_0xc5b354[_0x3d41da(0x1b6)](_0x3d41da(0x200)),_0x3d41da(0x1d7)),console[_0x3d41da(0xd5)](a26_0xc5b354[_0x3d41da(0x122)](_0x3d41da(0x106))),0x1;const _0x5d4d60=await confirmKey(_0x13222e);if(!_0x5d4d60)return console[_0x3d41da(0xd5)](a26_0xc5b354[_0x3d41da(0xc9)]('Aborted.')),0x1;}const _0x3bf173=_0xac13df?_0x3d41da(0x109):'Updating',_0x2cfe1e=await withSpinner(_0x3bf173+_0x3d41da(0x1ac)+_0x31f603+_0x3d41da(0x213),()=>_0x5c5bf8[_0x3d41da(0xeb)](),{'verbose':_0x5b4b66[_0x3d41da(0x168)]}),_0x584992=_0x2cfe1e['data'],_0x2bfa79=getConsoleNextUrl(_0x5b4b66[_0x3d41da(0x161)],_0x3d41da(0x1df)+_0x584992['id']),_0x30cdaa=_0xac13df?_0x3d41da(0x1ba):_0x3d41da(0x1be);return console['error']('✔\x20'+_0x30cdaa+'\x20parent\x20segment\x20\x27'+_0x584992['name']+'\x27'),console['error']('\x20\x20'+_0x2bfa79),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x10a);[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x227);async[a26_0x4cc703(0x207)](_0x2ef30a){const _0x2343da=a26_0x4cc703,{options:_0x4ee2f5,args:_0x288a52,tdx:_0x1dc694}=_0x2ef30a,_0x232f6a=_0x4ee2f5,_0xc3d4ae=_0x288a52[0x0]||_0x4ee2f5[_0x2343da(0x1e6)];if(!_0xc3d4ae)return showParentSegmentNotSetError(_0x2343da(0x203)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x2343da(0x10c)+_0x2343da(0x167)+_0x2343da(0x1a3)),0x1;const _0x55defe=resolveYamlFile(_0xc3d4ae);if(!existsSync(_0x55defe))return showFileNotFoundError(_0x55defe,_0xc3d4ae),0x1;_0x232f6a[_0x2343da(0x168)]&&(console[_0x2343da(0xd5)](_0x2343da(0x1f8)+_0x232f6a[_0x2343da(0x161)]),console[_0x2343da(0xd5)](_0x2343da(0x11d)+_0x55defe));let _0x27c3ba;try{_0x27c3ba=readFileSync(_0x55defe,'utf-8');}catch(_0x52c324){const _0x1d70a8=_0x52c324 instanceof Error?_0x52c324['message']:String(_0x52c324);return console[_0x2343da(0xd5)](_0x2343da(0x10d)+_0x1d70a8),0x1;}const _0x5a1501=createCommandSpinner(a26_0xc5b354['dim']('Validating\x20configuration...'),{'verbose':_0x232f6a[_0x2343da(0x168)]});_0x5a1501[_0x2343da(0x128)]();const _0x482b2d={'onProgress':_0x4f8264=>{_0x5a1501['text']=formatProgressMessage(_0x4f8264);}};if(_0x232f6a['master'])_0x482b2d['master']=!![];if(_0x232f6a[_0x2343da(0x163)])_0x482b2d[_0x2343da(0x163)]=!![];_0x232f6a[_0x2343da(0xcc)]&&(_0x482b2d['attribute']=_0x232f6a['attribute']);_0x232f6a[_0x2343da(0xf3)]&&(_0x482b2d['behavior']=_0x232f6a[_0x2343da(0xf3)]);if(_0x232f6a['interval'])_0x482b2d[_0x2343da(0x17c)]=_0x232f6a[_0x2343da(0x17c)];let _0x39585a;try{_0x39585a=await _0x1dc694[_0x2343da(0x1c6)][_0x2343da(0x136)](_0x27c3ba,_0x482b2d),_0x5a1501['stop']();}catch(_0x505606){_0x5a1501['stop']();throw _0x505606;}const _0x2c0099=_0x232f6a[_0x2343da(0x17c)]||_0x2343da(0x16d);return this[_0x2343da(0x100)](_0x39585a,_0x482b2d,_0x55defe,_0x2c0099),_0x39585a[_0x2343da(0x188)]?0x0:0x1;}[a26_0x4cc703(0x100)](_0x62b4c,_0x5748ef,_0x14365b,_0x5b3292){const _0x15c370=a26_0x4cc703;console[_0x15c370(0xd5)]('\x0a'+a26_0xc5b354[_0x15c370(0x102)](_0x15c370(0x1d6))+'\x20'+_0x62b4c[_0x15c370(0x201)]),console[_0x15c370(0xd5)]('═'['repeat'](0x3c)),this[_0x15c370(0x19d)](_0x62b4c);if(typeof _0x5748ef[_0x15c370(0xcc)]===_0x15c370(0x1f2)){this[_0x15c370(0xc3)](_0x62b4c),this[_0x15c370(0x1e8)](_0x62b4c),this[_0x15c370(0x169)](_0x14365b,_0x5b3292,_0x15c370(0xcc),_0x5748ef[_0x15c370(0xcc)]);return;}if(_0x5748ef['attribute']===!![]){this['displayAttributesStats'](_0x62b4c),this['displaySummary'](_0x62b4c),this['displayPreviewHints'](_0x14365b,_0x5b3292,_0x15c370(0x158));return;}if(typeof _0x5748ef[_0x15c370(0xf3)]==='string'){this[_0x15c370(0xf1)](_0x62b4c,_0x5b3292),this[_0x15c370(0x1e8)](_0x62b4c),this[_0x15c370(0x169)](_0x14365b,_0x5b3292,_0x15c370(0xf3),_0x5748ef[_0x15c370(0xf3)]);return;}if(_0x5748ef[_0x15c370(0xf3)]===!![]){this['displayBehaviorsStats'](_0x62b4c,_0x5b3292),this[_0x15c370(0x1e8)](_0x62b4c),this['displayPreviewHints'](_0x14365b,_0x5b3292,_0x15c370(0x16f));return;}this[_0x15c370(0xc3)](_0x62b4c),this[_0x15c370(0xf1)](_0x62b4c,_0x5b3292),this[_0x15c370(0x1ad)](_0x62b4c),this[_0x15c370(0x1e8)](_0x62b4c),this[_0x15c370(0x169)](_0x14365b,_0x5b3292,_0x15c370(0x22a));}[a26_0x4cc703(0x1ad)](_0xe2f043){displayRealtimeValidation(_0xe2f043);}[a26_0x4cc703(0x169)](_0x2cf937,_0x517ab9,_0x56590f,_0x1f75dc){const _0x1b8fa4=a26_0x4cc703;console[_0x1b8fa4(0xd5)]('\x0a'+a26_0xc5b354[_0x1b8fa4(0x122)](_0x1b8fa4(0xc7)));const _0x48d730=_0x517ab9!==_0x1b8fa4(0x16d)?_0x1b8fa4(0x141)+_0x517ab9:'';if(_0x56590f===_0x1b8fa4(0xcc)&&_0x1f75dc)console['error']('\x20\x20'+a26_0xc5b354[_0x1b8fa4(0x122)](_0x1b8fa4(0x21b)+_0x2cf937+_0x1b8fa4(0xd1)+_0x1f75dc+'\x22'+_0x48d730));else{if(_0x56590f===_0x1b8fa4(0xf3)&&_0x1f75dc)console[_0x1b8fa4(0xd5)]('\x20\x20'+a26_0xc5b354[_0x1b8fa4(0x122)](_0x1b8fa4(0x21b)+_0x2cf937+_0x1b8fa4(0x174)+_0x1f75dc+'\x22'+_0x48d730));else(_0x56590f==='attributes'||_0x56590f===_0x1b8fa4(0x22a))&&console[_0x1b8fa4(0xd5)]('\x20\x20'+a26_0xc5b354[_0x1b8fa4(0x122)](_0x1b8fa4(0x21b)+_0x2cf937+_0x1b8fa4(0x11c)+_0x48d730));}(_0x56590f===_0x1b8fa4(0x16f)||_0x56590f===_0x1b8fa4(0x22a))&&console[_0x1b8fa4(0xd5)]('\x20\x20'+a26_0xc5b354[_0x1b8fa4(0x122)](_0x1b8fa4(0x21b)+_0x2cf937+'\x20--behavior\x20\x22<name>\x22'+_0x48d730)),_0x56590f===_0x1b8fa4(0x22a)&&console[_0x1b8fa4(0xd5)]('\x20\x20'+a26_0xc5b354[_0x1b8fa4(0x122)](_0x1b8fa4(0x21b)+_0x2cf937+_0x1b8fa4(0x20b)+_0x48d730));}[a26_0x4cc703(0x19d)](_0x5490bc){const _0x6a43b3=a26_0x4cc703,{master:_0x4af903}=_0x5490bc,_0x3b9b7c=_0x4af903[_0x6a43b3(0x1d5)]?a26_0xc5b354['green']('✔'):a26_0xc5b354[_0x6a43b3(0x1b6)]('✘');console[_0x6a43b3(0xd5)]('\x0a'+a26_0xc5b354['dim']('Master\x20Table')),console[_0x6a43b3(0xd5)](_0x3b9b7c+'\x20'+a26_0xc5b354['bold'](_0x4af903[_0x6a43b3(0xd4)]+'.'+_0x4af903[_0x6a43b3(0x113)])),_0x4af903['schemaValid']?_0x4af903[_0x6a43b3(0x18d)]!==undefined&&console[_0x6a43b3(0xd5)]('\x20\x20'+a26_0xc5b354['dim']('Rows:')+'\x20'+a26_0xc5b354[_0x6a43b3(0x140)](formatRows(_0x4af903[_0x6a43b3(0x18d)]))):console[_0x6a43b3(0xd5)]('\x20\x20'+a26_0xc5b354[_0x6a43b3(0x1b6)](_0x6a43b3(0x1c7))+'\x20'+_0x4af903[_0x6a43b3(0x202)]);}[a26_0x4cc703(0xc3)](_0x58b6ae){const _0x3e94f7=a26_0x4cc703;if(_0x58b6ae['attributes'][_0x3e94f7(0x231)]===0x0)return;console[_0x3e94f7(0xd5)]('\x0a'+a26_0xc5b354[_0x3e94f7(0x122)](_0x3e94f7(0x17d)));for(const _0x57e422 of _0x58b6ae[_0x3e94f7(0x158)]){const _0x4e44fd=_0x57e422[_0x3e94f7(0x1d5)]?a26_0xc5b354[_0x3e94f7(0x127)]('✔'):a26_0xc5b354[_0x3e94f7(0x1b6)]('✘');let _0x475646='';if(_0x57e422['schemaValid']&&_0x57e422['matchedCount']!==undefined&&_0x57e422[_0x3e94f7(0xe5)]!==undefined){const _0x240ae2=_0x57e422[_0x3e94f7(0xe5)][_0x3e94f7(0x1f5)](0x1),_0x4e4f25=_0x57e422[_0x3e94f7(0xe5)]>=0x50?a26_0xc5b354[_0x3e94f7(0x127)]:_0x57e422[_0x3e94f7(0xe5)]>=0x32?a26_0xc5b354['yellow']:a26_0xc5b354[_0x3e94f7(0x1b6)];_0x475646='\x20'+a26_0xc5b354[_0x3e94f7(0x122)]('Coverage:')+'\x20'+_0x4e4f25(_0x240ae2+'%')+'\x20('+formatRows(_0x57e422[_0x3e94f7(0xc6)])+_0x3e94f7(0xdd);}console[_0x3e94f7(0xd5)](_0x4e44fd+'\x20'+a26_0xc5b354[_0x3e94f7(0x102)](_0x57e422[_0x3e94f7(0x201)])+_0x475646),console['error']('\x20\x20'+a26_0xc5b354[_0x3e94f7(0x122)](_0x3e94f7(0x1dd))+'\x20'+a26_0xc5b354[_0x3e94f7(0x102)](_0x57e422[_0x3e94f7(0xd4)]+'.'+_0x57e422[_0x3e94f7(0x113)]));const _0x3711fa=_0x57e422[_0x3e94f7(0x1ec)]===_0x57e422[_0x3e94f7(0x195)]?a26_0xc5b354[_0x3e94f7(0x122)](_0x3e94f7(0x192))+'\x20'+_0x57e422[_0x3e94f7(0x1ec)]:a26_0xc5b354['dim'](_0x3e94f7(0x111))+'\x20'+_0x57e422['joinKey']+_0x3e94f7(0x1dc)+_0x57e422[_0x3e94f7(0x195)];console['error']('\x20\x20'+_0x3711fa),console[_0x3e94f7(0xd5)]('\x20\x20'+a26_0xc5b354['dim'](_0x3e94f7(0x165))),this[_0x3e94f7(0x226)](_0x57e422[_0x3e94f7(0x208)]),!_0x57e422[_0x3e94f7(0x1d5)]&&console[_0x3e94f7(0xd5)]('\x20\x20'+a26_0xc5b354[_0x3e94f7(0x1b6)](_0x3e94f7(0x1c7))+'\x20'+_0x57e422[_0x3e94f7(0x202)]);}}[a26_0x4cc703(0xf1)](_0x181875,_0x4e29f2){const _0x125090=a26_0x4cc703;if(_0x181875[_0x125090(0x16f)]['length']===0x0)return;console[_0x125090(0xd5)]('\x0a'+a26_0xc5b354[_0x125090(0x122)]('Behaviors')+'\x20'+a26_0xc5b354[_0x125090(0x122)]('('+_0x4e29f2+')'));for(const _0x1cb215 of _0x181875[_0x125090(0x16f)]){const _0x17b0e6=_0x1cb215[_0x125090(0x1d5)]?a26_0xc5b354['green']('✔'):a26_0xc5b354[_0x125090(0x1b6)]('✘');let _0x39e4a2='';if(_0x1cb215[_0x125090(0x1d5)]&&_0x1cb215[_0x125090(0x116)]!==undefined&&_0x1cb215['totalEvents']!==undefined){const _0x404774=_0x1cb215['customerPercent']?.[_0x125090(0x1f5)](0x1)||'?',_0x738e6c=(_0x1cb215['customerPercent']??0x0)>=0x32?a26_0xc5b354[_0x125090(0x127)]:(_0x1cb215[_0x125090(0x13d)]??0x0)>=0x14?a26_0xc5b354[_0x125090(0xc9)]:a26_0xc5b354[_0x125090(0x1b6)];_0x39e4a2='\x20'+a26_0xc5b354['dim']('Customers:')+'\x20'+_0x738e6c(formatRows(_0x1cb215[_0x125090(0x116)]))+'\x20('+_0x404774+'%)\x20'+a26_0xc5b354[_0x125090(0x122)]('Events:')+'\x20'+a26_0xc5b354[_0x125090(0x140)](formatRows(_0x1cb215[_0x125090(0x1fe)]));}console[_0x125090(0xd5)](_0x17b0e6+'\x20'+a26_0xc5b354[_0x125090(0x102)](_0x1cb215['name'])+_0x39e4a2),console[_0x125090(0xd5)]('\x20\x20'+a26_0xc5b354[_0x125090(0x122)]('Source:')+'\x20'+a26_0xc5b354[_0x125090(0x102)](_0x1cb215[_0x125090(0xd4)]+'.'+_0x1cb215['table']));const _0x3a6f39=_0x1cb215[_0x125090(0x1ec)]===_0x1cb215['foreignKey']?a26_0xc5b354[_0x125090(0x122)](_0x125090(0x192))+'\x20'+_0x1cb215[_0x125090(0x1ec)]:a26_0xc5b354[_0x125090(0x122)](_0x125090(0x111))+'\x20'+_0x1cb215[_0x125090(0x1ec)]+_0x125090(0x1dc)+_0x1cb215[_0x125090(0x195)];console[_0x125090(0xd5)]('\x20\x20'+_0x3a6f39),console['error']('\x20\x20'+a26_0xc5b354[_0x125090(0x122)](_0x125090(0x165))),this['displayColumns'](_0x1cb215['columns']),!_0x1cb215['schemaValid']&&console[_0x125090(0xd5)]('\x20\x20'+a26_0xc5b354[_0x125090(0x1b6)](_0x125090(0x1c7))+'\x20'+_0x1cb215['schemaError']);}}[a26_0x4cc703(0x226)](_0x41fe69){const _0xafd3c=a26_0x4cc703;for(const _0x2fc30c of _0x41fe69){_0x2fc30c[_0xafd3c(0x1f1)]===_0x2fc30c['column']||_0x2fc30c['column']==='*'?console['error'](_0xafd3c(0x1bf)+_0x2fc30c[_0xafd3c(0x1f1)]):console[_0xafd3c(0xd5)]('\x20\x20\x20\x20-\x20'+_0x2fc30c[_0xafd3c(0x1f1)]+'\x20'+a26_0xc5b354[_0xafd3c(0x122)]('('+_0x2fc30c[_0xafd3c(0x13f)]+')'));}}[a26_0x4cc703(0x1e8)](_0x1a4b39){const _0x1e0923=a26_0x4cc703;console[_0x1e0923(0xd5)]('─'['repeat'](0x3c));if(_0x1a4b39[_0x1e0923(0x1a4)][_0x1e0923(0x231)]>0x0){console[_0x1e0923(0xd5)]('\x0a'+a26_0xc5b354[_0x1e0923(0x1b6)](_0x1e0923(0x181)));for(const _0x1d1fce of _0x1a4b39[_0x1e0923(0x1a4)]){console['error']('\x20\x20'+a26_0xc5b354[_0x1e0923(0x1b6)]('•')+'\x20'+_0x1d1fce);}}_0x1a4b39['allValid']&&console[_0x1e0923(0xd5)]('\x0a'+a26_0xc5b354[_0x1e0923(0x127)]('✔')+_0x1e0923(0x147));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x1a9);[a26_0x4cc703(0x23b)]=a26_0x4cc703(0xdf);async[a26_0x4cc703(0x207)](_0x49cfce){const _0x3500d8=a26_0x4cc703,{options:_0x5eb566,args:_0x57c197,tdx:_0x495288}=_0x49cfce,_0xebe09f=_0x5eb566,_0x4f0599=_0x57c197[0x0]||_0x5eb566['parentSegment'];if(!_0x4f0599)return showParentSegmentNotSetError(_0x3500d8(0x15f)+_0x3500d8(0x159)+_0x3500d8(0xe9)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x3500d8(0xec)+_0x3500d8(0x244)+_0x3500d8(0x1e0)+_0x3500d8(0x1a3)),0x1;if(!_0xebe09f[_0x3500d8(0x1cf)]&&!_0xebe09f['attribute']&&!_0xebe09f[_0x3500d8(0xf3)]&&!_0xebe09f[_0x3500d8(0x163)])return console[_0x3500d8(0xd5)](a26_0xc5b354[_0x3500d8(0x1b6)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x3500d8(0xd5)](_0x3500d8(0x22f)),console[_0x3500d8(0xd5)]('Options:'),console[_0x3500d8(0xd5)](_0x3500d8(0x237)),console[_0x3500d8(0xd5)](_0x3500d8(0x211)),console[_0x3500d8(0xd5)](_0x3500d8(0x11f)),console[_0x3500d8(0xd5)](_0x3500d8(0x1b5)),0x1;const _0x4b273e=resolveYamlFile(_0x4f0599);if(!existsSync(_0x4b273e))return showFileNotFoundError(_0x4b273e,_0x4f0599),0x1;_0xebe09f[_0x3500d8(0x168)]&&(console['error'](_0x3500d8(0x1f8)+_0xebe09f[_0x3500d8(0x161)]),console[_0x3500d8(0xd5)](_0x3500d8(0x11d)+_0x4b273e));let _0x185566;try{_0x185566=readFileSync(_0x4b273e,_0x3500d8(0x14a));}catch(_0x211e94){const _0xfb5754=_0x211e94 instanceof Error?_0x211e94[_0x3500d8(0x14c)]:String(_0x211e94);return console[_0x3500d8(0xd5)](_0x3500d8(0x10d)+_0xfb5754),0x1;}let _0x5200ec;try{_0x5200ec=parseDef(_0x185566);}catch(_0x52c61d){const _0x8efe3e=_0x52c61d instanceof Error?_0x52c61d[_0x3500d8(0x14c)]:String(_0x52c61d);return console[_0x3500d8(0xd5)](a26_0xc5b354[_0x3500d8(0x1b6)](_0x3500d8(0x11b)+_0x8efe3e)),0x1;}if(_0xebe09f[_0x3500d8(0xcc)]===!![]||_0xebe09f[_0x3500d8(0xcc)]===''){const _0x32be80=_0x5200ec['attributes']?.[_0x3500d8(0x13b)](_0x461182=>_0x461182[_0x3500d8(0x201)])||[];if(_0x32be80['length']===0x0)console['error'](a26_0xc5b354[_0x3500d8(0x1b6)](_0x3500d8(0x20e)));else{console[_0x3500d8(0xd5)](a26_0xc5b354[_0x3500d8(0x1b6)](_0x3500d8(0xe1))),console['error']('Available\x20attributes:');for(const _0x1b4aa4 of _0x32be80){console[_0x3500d8(0xd5)]('\x20\x20'+a26_0xc5b354[_0x3500d8(0x140)](_0x1b4aa4));}console[_0x3500d8(0xd5)](_0x3500d8(0x1e5)+_0x4f0599+_0x3500d8(0xd1)+_0x32be80[0x0]+'\x22');}return 0x1;}if(_0xebe09f[_0x3500d8(0xf3)]===!![]||_0xebe09f[_0x3500d8(0xf3)]===''){const _0x5ebff7=_0x5200ec['behaviors']?.[_0x3500d8(0x13b)](_0x4a183f=>_0x4a183f['name'])||[];if(_0x5ebff7[_0x3500d8(0x231)]===0x0)console[_0x3500d8(0xd5)](a26_0xc5b354[_0x3500d8(0x1b6)](_0x3500d8(0x22c)));else{console[_0x3500d8(0xd5)](a26_0xc5b354[_0x3500d8(0x1b6)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console['error'](_0x3500d8(0x194));for(const _0x47a03a of _0x5ebff7){console[_0x3500d8(0xd5)]('\x20\x20'+a26_0xc5b354[_0x3500d8(0x140)](_0x47a03a));}console[_0x3500d8(0xd5)](_0x3500d8(0x1e5)+_0x4f0599+_0x3500d8(0x174)+_0x5ebff7[0x0]+'\x22');}return 0x1;}const _0x33cf38=createCommandSpinner(a26_0xc5b354['dim'](_0x3500d8(0x236)),{'verbose':_0xebe09f[_0x3500d8(0x168)]});_0x33cf38[_0x3500d8(0x128)]();const _0x33cfc7={'onProgress':_0x5733f9=>{const _0x386f86=_0x3500d8;_0x33cf38[_0x386f86(0x1cd)]=formatProgressMessage(_0x5733f9);}};if(_0xebe09f[_0x3500d8(0x1cf)])_0x33cfc7[_0x3500d8(0x1cf)]=!![];if(_0xebe09f['attribute']&&typeof _0xebe09f[_0x3500d8(0xcc)]===_0x3500d8(0x1f2))_0x33cfc7[_0x3500d8(0xcc)]=_0xebe09f[_0x3500d8(0xcc)];if(_0xebe09f[_0x3500d8(0xf3)]&&typeof _0xebe09f[_0x3500d8(0xf3)]===_0x3500d8(0x1f2))_0x33cfc7['behavior']=_0xebe09f[_0x3500d8(0xf3)];if(_0xebe09f[_0x3500d8(0x163)])_0x33cfc7['enriched']=!![];if(_0xebe09f[_0x3500d8(0x17c)])_0x33cfc7[_0x3500d8(0x17c)]=_0xebe09f[_0x3500d8(0x17c)];let _0x1c2a95;try{_0x1c2a95=await _0x495288[_0x3500d8(0x1c6)]['previewParentYaml'](_0x185566,_0x33cfc7),_0x33cf38['stop']();}catch(_0x163078){_0x33cf38[_0x3500d8(0x199)]();throw _0x163078;}return await this[_0x3500d8(0x204)](_0x1c2a95,{'master':_0xebe09f['master'],'attribute':typeof _0xebe09f[_0x3500d8(0xcc)]===_0x3500d8(0x1f2)?_0xebe09f['attribute']:undefined,'behavior':typeof _0xebe09f['behavior']===_0x3500d8(0x1f2)?_0xebe09f['behavior']:undefined,'enriched':_0xebe09f[_0x3500d8(0x163)]}),_0x1c2a95[_0x3500d8(0x188)]?0x0:0x1;}async[a26_0x4cc703(0x204)](_0x5e1b05,_0x2e3f27){const _0x29a383=a26_0x4cc703;console[_0x29a383(0xd5)]('\x0a'+a26_0xc5b354['bold'](_0x29a383(0x1c4))+'\x20'+_0x5e1b05[_0x29a383(0x201)]),console['error']('═'['repeat'](0x3c));if(_0x2e3f27[_0x29a383(0x1cf)]&&_0x5e1b05[_0x29a383(0xef)]){const _0x5b2167=a26_0xc5b354[_0x29a383(0x122)](_0x29a383(0x21d))+'\x20'+a26_0xc5b354[_0x29a383(0x102)](_0x5e1b05[_0x29a383(0x1cf)][_0x29a383(0xd4)]+'.'+_0x5e1b05['master'][_0x29a383(0x113)]);await this[_0x29a383(0x1ab)](_0x5b2167,_0x5e1b05['sampleData']);}else{if(_0x2e3f27[_0x29a383(0xcc)]&&_0x5e1b05[_0x29a383(0xef)]){const _0xa76135=a26_0xc5b354[_0x29a383(0x122)](_0x29a383(0x20d))+'\x20'+a26_0xc5b354[_0x29a383(0x102)](_0x2e3f27[_0x29a383(0xcc)]);await this['displaySampleData'](_0xa76135,_0x5e1b05[_0x29a383(0xef)]);}else{if(_0x2e3f27[_0x29a383(0xf3)]&&_0x5e1b05['sampleData']){const _0x34389b=a26_0xc5b354['dim']('Behavior:')+'\x20'+a26_0xc5b354[_0x29a383(0x102)](_0x2e3f27[_0x29a383(0xf3)]);await this['displaySampleData'](_0x34389b,_0x5e1b05['sampleData']);}else{if(_0x2e3f27[_0x29a383(0x163)]&&_0x5e1b05['sampleData']){const _0xacff81=a26_0xc5b354[_0x29a383(0x122)](_0x29a383(0x1e2))+'\x20'+a26_0xc5b354[_0x29a383(0x102)](_0x29a383(0x164));await this[_0x29a383(0x1ab)](_0xacff81,_0x5e1b05[_0x29a383(0xef)]);}else!_0x5e1b05[_0x29a383(0xef)]&&console[_0x29a383(0xd5)](_0x29a383(0x1f6));}}}if(_0x5e1b05[_0x29a383(0x1a4)][_0x29a383(0x231)]>0x0){console[_0x29a383(0xd5)]('─'[_0x29a383(0x212)](0x3c)),console['error']('\x0a'+a26_0xc5b354['red']('Errors:'));for(const _0x288961 of _0x5e1b05['errors']){console[_0x29a383(0xd5)]('\x20\x20'+a26_0xc5b354['red']('•')+'\x20'+_0x288961);}}}async[a26_0x4cc703(0x1ab)](_0x5077f6,_0x350a51){const _0x64630b=a26_0x4cc703;if(_0x350a51[_0x64630b(0x231)]===0x0){console[_0x64630b(0xd5)]('\x0a'+_0x5077f6),console[_0x64630b(0xd5)](_0x64630b(0x125));return;}console[_0x64630b(0xd5)]('\x0a'+_0x5077f6);const _0x6b6628=Object[_0x64630b(0x218)](_0x350a51[0x0])[_0x64630b(0x13b)](_0x492c5d=>({'name':_0x492c5d,'type':typeof _0x350a51[0x0][_0x492c5d]===_0x64630b(0x223)?'double':'varchar'})),_0x2c5992={'queryId':'preview','columns':_0x6b6628,'data':_0x350a51,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x350a51['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x9b7c4=formatAsTable(_0x2c5992,_0x350a51[_0x64630b(0x231)],!![]);await writeOutput(_0x9b7c4,undefined,_0x64630b(0x113));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x196);[a26_0x4cc703(0x23b)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a26_0x4cc703(0x207)](_0x1f5647){const _0x31c589=a26_0x4cc703,{options:_0x19b013,args:_0x1630d8,tdx:_0x3c0aa0}=_0x1f5647,_0x3b7251=_0x19b013,_0x32b788=_0x1630d8[0x0]||_0x19b013[_0x31c589(0x1e6)];if(!_0x32b788)return showParentSegmentNotSetError(_0x31c589(0x210)+_0x31c589(0x186)),0x1;const _0x1e658f=resolveYamlFile(_0x32b788);if(existsSync(_0x1e658f)){_0x3b7251[_0x31c589(0x168)]&&console['error']('Found\x20YAML\x20file:\x20'+_0x1e658f);let _0x2aed07;try{_0x2aed07=readFileSync(_0x1e658f,'utf-8');}catch(_0x1008a9){const _0x1bdb23=_0x1008a9 instanceof Error?_0x1008a9[_0x31c589(0x14c)]:String(_0x1008a9);return console[_0x31c589(0xd5)]('Error\x20reading\x20file:\x20'+_0x1bdb23),0x1;}const _0x11675f=await withSpinner(_0x31c589(0x16a),()=>_0x3c0aa0[_0x31c589(0x1c6)][_0x31c589(0x18a)](_0x2aed07),{'verbose':_0x3b7251[_0x31c589(0x168)]}),_0x5ef037=_0x11675f[_0x31c589(0x209)],{isNew:_0x11e283,name:_0x38f448,hasChanges:_0x507a7d,diffFormatted:_0x2ddbd3}=_0x5ef037;if(_0x507a7d){_0x11e283?console[_0x31c589(0xd5)](_0x31c589(0xe6)+_0x38f448+'\x27:'):console[_0x31c589(0xd5)](_0x31c589(0x1ea)+_0x38f448+'\x27:');console['error']('─'[_0x31c589(0x212)](0x3c)),console['error'](_0x2ddbd3),console['error']('─'[_0x31c589(0x212)](0x3c));const _0x5c7da5=_0x11e283?'Create\x20parent\x20segment\x20\x27'+_0x38f448+_0x31c589(0x221):_0x31c589(0x19e)+_0x38f448+_0x31c589(0x221);if(!_0x3b7251[_0x31c589(0x205)]){if(!isInteractive())return console[_0x31c589(0xd5)](a26_0xc5b354[_0x31c589(0x1b6)](_0x31c589(0x200)),_0x31c589(0x1d7)),console['error'](a26_0xc5b354[_0x31c589(0x122)](_0x31c589(0x106))),0x1;const _0x2857a8=await confirmKey(_0x5c7da5);if(!_0x2857a8)return console[_0x31c589(0xd5)](a26_0xc5b354['yellow'](_0x31c589(0x123))),0x1;}const _0x2f9053=_0x11e283?_0x31c589(0x109):'Updating';await withSpinner(_0x2f9053+_0x31c589(0x1ac)+_0x38f448+'\x27...',()=>_0x5ef037[_0x31c589(0xeb)](),{'verbose':_0x3b7251['verbose']});const _0x5183de=_0x11e283?_0x31c589(0x1ba):_0x31c589(0x1be);console[_0x31c589(0xd5)]('✔\x20'+_0x5183de+'\x20parent\x20segment\x20\x27'+_0x38f448+'\x27');}else console['error'](_0x31c589(0xfb)+_0x38f448+_0x31c589(0xe7));}const _0x5853b3=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x32b788+'\x27...',()=>_0x3c0aa0[_0x31c589(0x1c6)]['runParent'](_0x32b788),{'verbose':_0x3b7251['verbose']}),_0x3b793c=_0x5853b3[_0x31c589(0x209)],_0x1e9c38=getConsoleUrl(_0x3b7251[_0x31c589(0x161)],_0x31c589(0x19a)+_0x3b793c[_0x31c589(0xfd)]+_0x31c589(0x18b)+_0x3b793c['workflowSessionId']+_0x31c589(0x14d)+_0x3b793c[_0x31c589(0x173)]);return console['error']('\x0a✔\x20Workflow\x20started'),console[_0x31c589(0xd5)]('\x20\x20'+a26_0xc5b354['dim'](_0x31c589(0x1bd))+'\x20'+_0x3b793c[_0x31c589(0x16e)]),console[_0x31c589(0xd5)]('\x20\x20'+a26_0xc5b354[_0x31c589(0x122)](_0x31c589(0x179))+'\x20'+_0x3b793c[_0x31c589(0x239)]),console[_0x31c589(0xd5)]('\x20\x20'+a26_0xc5b354['dim'](_0x31c589(0x129))+'\x20'+_0x3b793c['workflowSessionId']),console[_0x31c589(0xd5)]('\x20\x20'+a26_0xc5b354[_0x31c589(0x122)](_0x31c589(0x133))+'\x20'+_0x3b793c[_0x31c589(0x173)]),console[_0x31c589(0xd5)]('\x20\x20'+_0x1e9c38),console[_0x31c589(0xd5)]('\x0a'+a26_0xc5b354[_0x31c589(0x122)]('To\x20cancel:')+'\x20tdx\x20wf\x20attempt\x20'+_0x3b793c[_0x31c589(0x173)]+_0x31c589(0x105)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x4cc703(0x201)]='segment:parent:fields';['description']='List\x20available\x20fields\x20for\x20segmentation';async[a26_0x4cc703(0x207)](_0x4c42ac){const _0x155ba4=a26_0x4cc703,{options:_0xbdaeed,args:_0x36cd96,tdx:_0x1c4ebc}=_0x4c42ac,_0xd86399=_0x36cd96[0x0]||_0xbdaeed['parentSegment'];if(!_0xd86399)return showParentSegmentNotSetError(_0x155ba4(0x1bc)+_0x155ba4(0x156)),0x1;_0xbdaeed[_0x155ba4(0x168)]&&(console['error'](_0x155ba4(0x1f8)+_0xbdaeed[_0x155ba4(0x161)]),console[_0x155ba4(0xd5)](_0x155ba4(0xea)+_0xd86399));const _0x5f312b=await withSpinner(_0x155ba4(0x172)+_0xd86399+_0x155ba4(0x213),()=>_0x1c4ebc[_0x155ba4(0x1c6)][_0x155ba4(0xfe)](_0xd86399),{'verbose':_0xbdaeed[_0x155ba4(0x168)]}),_0x186cf8=_0x5f312b[_0x155ba4(0x209)];console['error']('✔\x20Found\x20'+_0x186cf8[_0x155ba4(0x231)]+_0x155ba4(0x215)+(_0x186cf8['length']!==0x1?'s':''));if(_0xbdaeed['json']||_0xbdaeed[_0x155ba4(0x191)])return await handleSDKOutput(_0x186cf8,_0xbdaeed),0x0;return displayFieldsHumanReadable(_0x186cf8,_0xd86399),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x197);[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x149);async['execute'](_0x2a4d27){const _0x432fed=a26_0x4cc703,{options:_0x53ae75,args:_0x1f0cec,tdx:_0x31bb44}=_0x2a4d27,_0x6ab41=_0x53ae75,_0x26bd6c=_0x1f0cec[0x0]||_0x53ae75[_0x432fed(0x1e6)];if(!_0x26bd6c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x432fed(0x151)+_0x432fed(0xd8)+_0x432fed(0x154)),0x1;_0x53ae75[_0x432fed(0x168)]&&(console[_0x432fed(0xd5)]('Site:\x20'+_0x53ae75[_0x432fed(0x161)]),console[_0x432fed(0xd5)](_0x432fed(0xea)+_0x26bd6c));const _0xc15d95=await withSpinner(_0x432fed(0x19b)+_0x26bd6c+'\x27...',()=>_0x31bb44[_0x432fed(0x1c6)][_0x432fed(0x21f)](_0x26bd6c),{'verbose':_0x53ae75[_0x432fed(0x168)]}),_0x46dc5d=_0xc15d95[_0x432fed(0x209)];if(_0x6ab41[_0x432fed(0x138)]){const _0x2477cc=getConsoleNextUrl(_0x6ab41[_0x432fed(0x161)],'/app/dw/parentSegments/'+_0x46dc5d['id']);return console['error'](a26_0xc5b354[_0x432fed(0x127)]('✔')+_0x432fed(0x238)+a26_0xc5b354['cyan'](_0x2477cc)),openBrowser(_0x2477cc),0x0;}return await handleSingleObjectOutput(_0x46dc5d,_0x53ae75),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x1d3);[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x15e);async[a26_0x4cc703(0x207)](_0x35b263){const _0x3971ea=a26_0x4cc703,{options:_0x3f1b4c,args:_0x35cf0,tdx:_0x176de7}=_0x35b263,_0x181c61=_0x3f1b4c,_0x13ab14=_0x35cf0[0x0]||_0x3f1b4c[_0x3971ea(0x1e6)];if(!_0x13ab14)return showParentSegmentNotSetError(_0x3971ea(0x1bb)+_0x3971ea(0x120)+_0x3971ea(0xd8)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x3f1b4c[_0x3971ea(0x168)]&&(console[_0x3971ea(0xd5)](_0x3971ea(0x1f8)+_0x3f1b4c['site']),console[_0x3971ea(0xd5)](_0x3971ea(0xea)+_0x13ab14));const _0xd516a1=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x13ab14+_0x3971ea(0x213),()=>_0x176de7[_0x3971ea(0x1c6)][_0x3971ea(0x1c1)](_0x13ab14),{'verbose':_0x3f1b4c[_0x3971ea(0x168)]}),_0x3e1fbc=_0xd516a1['data'],_0x16b162=_0x176de7['segment']['getOutputDatabaseName'](_0x3e1fbc);if(_0x181c61[_0x3971ea(0x1b0)]){const _0x6ee1f9=await this[_0x3971ea(0x103)](_0x35b263,_0x13ab14,_0x3e1fbc,_0x16b162),_0x2ab73b=this[_0x3971ea(0x176)](_0x6ee1f9);writeFileSync(_0x181c61[_0x3971ea(0x1b0)],_0x2ab73b);const _0x16c46b=_0x6ee1f9['customers']['columns']['length']+_0x6ee1f9['behaviors'][_0x3971ea(0x180)]((_0xf3823b,_0x2b4813)=>_0xf3823b+_0x2b4813[_0x3971ea(0x208)][_0x3971ea(0x231)],0x0),_0x53c7ed=_0x6ee1f9[_0x3971ea(0x16f)][_0x3971ea(0x107)](_0x4bbcae=>_0x4bbcae['columns']['length']===0x0)[_0x3971ea(0x231)];return console['log'](_0x3971ea(0x22e)+_0x181c61['output']),console[_0x3971ea(0x160)](_0x3971ea(0x144)+_0x16b162),console['log'](_0x3971ea(0x1a8)+_0x6ee1f9[_0x3971ea(0x16f)][_0x3971ea(0x231)]+_0x3971ea(0xf8)),console[_0x3971ea(0x160)](_0x3971ea(0x182)+_0x16c46b+_0x3971ea(0xc1)),_0x53c7ed>0x0&&console[_0x3971ea(0x160)](_0x3971ea(0x1f0)+_0x53c7ed+_0x3971ea(0x137)),0x0;}console['error']('\x0a'+a26_0xc5b354[_0x3971ea(0x102)]('Output\x20Database:')+'\x20'+a26_0xc5b354['cyan'](_0x16b162));const _0x301165=await withSpinner(_0x3971ea(0xe0),()=>_0x176de7[_0x3971ea(0x1c6)][_0x3971ea(0x1cc)](_0x3e1fbc),{'verbose':_0x3f1b4c[_0x3971ea(0x168)]});console[_0x3971ea(0xd5)]('\x0a'+a26_0xc5b354['bold'](_0x3971ea(0x115))+'\x20'+a26_0xc5b354[_0x3971ea(0x122)]('('+_0x16b162+_0x3971ea(0x222)));const _0x1e2ae2=await executeSchemaQuery(_0x301165[_0x3971ea(0x209)],_0x176de7,_0x3f1b4c);await handleQueryOutput(_0x1e2ae2,_0x3f1b4c);const _0xfaae90=await withSpinner(_0x3971ea(0x1eb),()=>_0x176de7['segment'][_0x3971ea(0xd9)](_0x3e1fbc),{'verbose':_0x3f1b4c[_0x3971ea(0x168)]});for(const _0x4a2def of _0xfaae90[_0x3971ea(0x209)]){const _0x58d349=_0x3971ea(0x1a7)+_0x4a2def[_0x3971ea(0xf9)]()[_0x3971ea(0x219)](/\s+/g,'_'),_0x2d4514='SELECT\x20*\x20FROM\x20'+_0x16b162+'.'+_0x58d349;console[_0x3971ea(0xd5)]('\x0a'+a26_0xc5b354[_0x3971ea(0x102)](_0x4a2def)+'\x20'+a26_0xc5b354[_0x3971ea(0x122)]('('+_0x16b162+'.'+_0x58d349+')'));try{const _0x48c018=await executeSchemaQuery(_0x2d4514,_0x176de7,_0x3f1b4c);await handleQueryOutput(_0x48c018,_0x3f1b4c);}catch{console[_0x3971ea(0xd5)](a26_0xc5b354['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a26_0x4cc703(0x103)](_0x1ce87b,_0x1c3c24,_0xa69b30,_0x443f7f){const _0x53cd32=a26_0x4cc703,{options:_0x36ace2,tdx:_0xd45a87}=_0x1ce87b,_0x5e4dc2=await withSpinner(_0x53cd32(0xe0),()=>_0xd45a87[_0x53cd32(0x1c6)]['getParentSQL'](_0xa69b30),{'verbose':_0x36ace2[_0x53cd32(0x168)]}),_0x396147=await executeSchemaQuery(_0x5e4dc2[_0x53cd32(0x209)],_0xd45a87,_0x36ace2),_0x252f7b=_0x396147[_0x53cd32(0x209)]['map'](_0xd682a0=>({'name':_0xd682a0[_0x53cd32(0x217)],'type':_0xd682a0[_0x53cd32(0x14f)]})),_0x3ce5a4=await withSpinner(_0x53cd32(0x1eb),()=>_0xd45a87[_0x53cd32(0x1c6)][_0x53cd32(0xd9)](_0xa69b30),{'verbose':_0x36ace2[_0x53cd32(0x168)]}),_0x19a15b=[];for(const _0x8cb910 of _0x3ce5a4[_0x53cd32(0x209)]){const _0x2e2fb5=_0x53cd32(0x1a7)+_0x8cb910['toLowerCase']()[_0x53cd32(0x219)](/\s+/g,'_'),_0x3736b0='SELECT\x20*\x20FROM\x20'+_0x443f7f+'.'+_0x2e2fb5;let _0x2d3c1e=[];try{const _0x53fd4a=await executeSchemaQuery(_0x3736b0,_0xd45a87,_0x36ace2);_0x2d3c1e=_0x53fd4a['data'][_0x53cd32(0x13b)](_0x465674=>({'name':_0x465674[_0x53cd32(0x217)],'type':_0x465674[_0x53cd32(0x14f)]}));}catch{}_0x19a15b['push']({'table':_0x2e2fb5,'columns':_0x2d3c1e});}return{'database':_0x443f7f,'parent_segment':_0x1c3c24,'parent_id':_0xa69b30,'customers':{'table':_0x53cd32(0x115),'columns':_0x252f7b},'behaviors':_0x19a15b};}[a26_0x4cc703(0x176)](_0x134dd3){const _0x2ec60c=a26_0x4cc703,_0x4618ec=_0x495874=>{const _0xf3305f=a26_0x428a;if(_0x495874[_0xf3305f(0x231)]===0x0)return'[]';const _0x4bdccd=_0x495874[_0xf3305f(0x13b)](_0xbf34ef=>_0xf3305f(0xcf)+_0xbf34ef['name']+'\x22,\x20\x22type\x22:\x20\x22'+_0xbf34ef[_0xf3305f(0x1ff)]+_0xf3305f(0x1a5));return'[\x0a'+_0x4bdccd[_0xf3305f(0x185)](',\x0a')+_0xf3305f(0x139);},_0x276641=_0x134dd3[_0x2ec60c(0x16f)][_0x2ec60c(0x13b)](_0x1b36ed=>{const _0x373243=_0x2ec60c;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1b36ed[_0x373243(0x113)]+_0x373243(0x230)+_0x4618ec(_0x1b36ed['columns'])[_0x373243(0x219)](/^/gm,'\x20\x20')['trim']()+_0x373243(0x17a);})[_0x2ec60c(0x185)](',\x0a');return _0x2ec60c(0x1b4)+_0x134dd3[_0x2ec60c(0xd4)]+_0x2ec60c(0x22b)+_0x134dd3['parent_segment']+_0x2ec60c(0xff)+_0x134dd3['parent_id']+_0x2ec60c(0x23a)+_0x134dd3[_0x2ec60c(0x115)]['table']+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x4618ec(_0x134dd3[_0x2ec60c(0x115)][_0x2ec60c(0x208)])[_0x2ec60c(0x219)](/^/gm,'\x20\x20')['trim']()+_0x2ec60c(0x131)+_0x276641+_0x2ec60c(0xe2);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x190);[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x11e);async[a26_0x4cc703(0x207)](_0x23e4a7){const _0x47dfa7=a26_0x4cc703,{options:_0xf77cd,args:_0x56c202,tdx:_0xd76d92}=_0x23e4a7,_0x8d3bca=_0x56c202[0x0]||_0xf77cd[_0x47dfa7(0x1e6)];if(!_0x8d3bca)return showParentSegmentNotSetError(_0x47dfa7(0x1a0)+_0x47dfa7(0xfc)),0x1;_0xf77cd[_0x47dfa7(0x168)]&&(console[_0x47dfa7(0xd5)](_0x47dfa7(0x1f8)+_0xf77cd['site']),console[_0x47dfa7(0xd5)](_0x47dfa7(0xea)+_0x8d3bca));const _0x1765d5=await withSpinner(_0x47dfa7(0x1e9)+_0x8d3bca+'\x27...',()=>_0xd76d92[_0x47dfa7(0x1c6)]['resolveParentId'](_0x8d3bca),{'verbose':_0xf77cd[_0x47dfa7(0x168)]}),_0x41e4b7=_0x1765d5[_0x47dfa7(0x209)],_0x2eb4c9=await withSpinner(_0x47dfa7(0x1ee)+_0x8d3bca+_0x47dfa7(0x213),()=>_0xd76d92[_0x47dfa7(0x1c6)]['getParentSQL'](_0x41e4b7),{'verbose':_0xf77cd[_0x47dfa7(0x168)]}),_0x556691=_0x2eb4c9[_0x47dfa7(0x209)];return _0xf77cd[_0x47dfa7(0x224)]===_0x47dfa7(0x155)||_0xf77cd[_0x47dfa7(0x224)]===_0x47dfa7(0x191)?await handleSDKOutput([{'sql':_0x556691}],_0xf77cd):console[_0x47dfa7(0x160)](_0x556691),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']='segment:parent:show';[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x1e3);async[a26_0x4cc703(0x207)](_0xec5d3){const _0x317817=a26_0x4cc703,{options:_0x20d909,args:_0x41fcae,tdx:_0x4d1899}=_0xec5d3,_0x61dc86=_0x41fcae[0x0]||_0x20d909[_0x317817(0x1e6)];if(!_0x61dc86)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x20d909[_0x317817(0x168)]&&(console[_0x317817(0xd5)]('Site:\x20'+_0x20d909['site']),console[_0x317817(0xd5)](_0x317817(0xea)+_0x61dc86));const _0x5adf8b=await withSpinner(_0x317817(0x1e9)+_0x61dc86+_0x317817(0x213),()=>_0x4d1899[_0x317817(0x1c6)][_0x317817(0x1c1)](_0x61dc86),{'verbose':_0x20d909[_0x317817(0x168)]}),_0x46c103=_0x5adf8b[_0x317817(0x209)],_0x538079=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x61dc86+_0x317817(0x213),()=>_0x4d1899[_0x317817(0x1c6)]['getParentSQL'](_0x46c103),{'verbose':_0x20d909[_0x317817(0x168)]});let _0x123fa3=_0x538079[_0x317817(0x209)];const _0x179a31=resolveLimit(_0x20d909[_0x317817(0x16c)],DEFAULT_DISPLAY_LIMIT),_0x508d3f=/\bLIMIT\s+\d+/i['test'](_0x123fa3);!_0x508d3f&&(_0x123fa3=_0x123fa3[_0x317817(0x206)]()[_0x317817(0x219)](/;+$/,''),_0x123fa3=_0x317817(0x132)+_0x123fa3+_0x317817(0xc8)+_0x179a31);_0x20d909[_0x317817(0x168)]&&console[_0x317817(0xd5)](_0x317817(0x170)+_0x123fa3);const _0x566088=await withProgressSpinner(_0x317817(0x175),async _0x4117c1=>{const _0x4d2eba=_0x317817,_0xaefa6b=await _0x4d1899[_0x4d2eba(0x14e)][_0x4d2eba(0x207)](_0x123fa3,{'catalog':'td','schema':_0x4d2eba(0x11a),'onJobId':_0x4a1057=>{const _0x3098f9=_0x4d2eba;_0x4117c1[_0x3098f9(0x16b)](_0x4a1057);}});return _0xaefa6b;},{'verbose':_0x20d909[_0x317817(0x168)]}),_0x370106=_0x566088[_0x317817(0x209)],_0x56a511=_0x370106['jobId']?_0x317817(0x235)+_0x370106[_0x317817(0x148)]+']':'';return console[_0x317817(0xd5)](_0x317817(0x18c)+_0x370106[_0x317817(0x1ef)]['processedRows']['toLocaleString']()+_0x317817(0x17b)+(_0x317817(0x153)+formatElapsed(_0x370106[_0x317817(0x1ef)][_0x317817(0xca)])+_0x56a511)),await handleQueryOutput(_0x370106,_0x20d909),0x0;}}export class PSRtListCommand extends BaseCommand{['name']='ps:rt:list';[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x20f);async[a26_0x4cc703(0x207)](_0xe934f4){const _0x3c845e=a26_0x4cc703,{options:_0x2eda7b,args:_0x33a480,tdx:_0x2d39ec}=_0xe934f4,_0x1a9b3e=_0x33a480[0x0],_0x6b899f=await withSpinner(_0x1a9b3e?_0x3c845e(0x1da)+_0x1a9b3e+_0x3c845e(0x213):_0x3c845e(0x142),()=>_0x2d39ec[_0x3c845e(0x1e1)][_0x3c845e(0x13a)](),{'verbose':_0x2eda7b[_0x3c845e(0x168)]});let _0x5df257=_0x6b899f[_0x3c845e(0x209)][_0x3c845e(0x107)](_0x353249=>_0x353249[_0x3c845e(0xf0)]);if(_0x1a9b3e){const _0xada4ef=_0x1a9b3e['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x3c845e(0x219)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4d434c=new RegExp('^'+_0xada4ef+'$','i');_0x5df257=_0x5df257[_0x3c845e(0x107)](_0xb4be55=>_0x4d434c[_0x3c845e(0x220)](_0xb4be55[_0x3c845e(0x201)]));}_0x5df257[_0x3c845e(0x21a)]((_0x198642,_0x3b9577)=>_0x198642['name']['localeCompare'](_0x3b9577[_0x3c845e(0x201)])),console[_0x3c845e(0xd5)]('✔\x20Found\x20'+_0x5df257[_0x3c845e(0x231)]+_0x3c845e(0xde)+(_0x5df257[_0x3c845e(0x231)]!==0x1?'s':''));const _0x104947=_0x1243b0=>{const _0x228143=_0x3c845e;return getConsoleNextUrl(_0x2eda7b['site'],_0x228143(0x1df)+_0x1243b0);};if(_0x2eda7b['format']==='json'||_0x2eda7b[_0x3c845e(0x224)]===_0x3c845e(0x191)){const _0x3dc182=_0x5df257['map'](_0x883376=>({..._0x883376,'url':_0x104947(_0x883376['id'])}));await handleSDKOutput(_0x3dc182,_0x2eda7b);}else{if(_0x5df257[_0x3c845e(0x231)]===0x0)console[_0x3c845e(0x160)](_0x3c845e(0xf2));else for(const _0x51a63d of _0x5df257){const _0x4faed0=_0x51a63d['population']?a26_0xc5b354[_0x3c845e(0x122)]('\x20('+formatRows(_0x51a63d['population'])+')'):'',_0x384f19=hyperlink(_0x51a63d['name'],_0x104947(_0x51a63d['id']));console[_0x3c845e(0x160)]('⚡\x20'+_0x384f19+_0x4faed0);}}return 0x0;}}function a26_0x7bf1(){const _0x5e9748=['72742RJhJXE','`\x20to\x20download\x20the\x20configuration\x20first','\x20total','✔\x20Renamed\x20directory\x20to\x20','displayAttributesStats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','matchedCount','To\x20view\x20sample\x20data:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','yellow','elapsedTimeMillis','addAttributesFile','attribute','\x20trigger=','\x0a⚠️\x20\x20Both\x20','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20\x20\x20\x20','\x20--attribute\x20\x22','No\x20parent\x20segments\x20found','scheduleOption','database','error','Overwrite\x20\x27','tdx\x20ps\x20push\x20','Options:\x0a','getBehaviorNames','customerGroup','\x27\x20is\x20already\x20up\x20to\x20date','addAttributes','\x20rows)','\x20RT-enabled\x20parent\x20segment','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Fetching\x20customers\x20schema...','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x0a\x20\x20]\x0a}\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','117843EEjdBD','coveragePercent','\x0aNew\x20parent\x20segment\x20\x27','\x27\x20is\x20up\x20to\x20date','\x20personalization\x20service','Options\x20(one\x20required):\x0a','Parent\x20segment:\x20','apply','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Validating\x20RT\x20configuration...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','sampleData','realtime_enabled','displayBehaviorsStats','No\x20RT-enabled\x20parent\x20segments\x20found','behavior','valid','\x20+\x20[','Error:\x20Parent\x20segment\x20name\x20is\x20required','72783siGhFx','\x20behaviors','toLowerCase','parent_segment','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','workflowId','listFields','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','displayValidateResults','primaryKey','bold','collectSchema','No\x20personalization\x20services\x20configured','\x20kill','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','filter','parent_segments','Creating','segment:parent:validate','7942535qinhSi','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error\x20reading\x20file:\x20','\x20\x201.\x20Edit\x20','\x20No\x20changes\x20-\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','Join:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','table','✔\x20Updated\x20parent\x20segment\x20\x27','customers','customersWithEvents','endsWith','.yml','pullParentYaml','information_schema','Error\x20parsing\x20YAML:\x20','\x20--attribute\x20\x22<name>\x22','YAML\x20file:\x20','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\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','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','dim','Aborted.','personalizationServices','\x20\x20No\x20sample\x20data\x20available','\x20section','green','start','Session:','ps:pz:list','ignore','win32','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Fetching\x20current\x20configuration\x20for\x20\x27','using\x20the\x20default\x20path:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','SELECT\x20*\x20FROM\x20(\x0a','Attempt:','/\x20→\x20','idStitching','validateParentYaml','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','web','\x0a\x20\x20\x20\x20]','list','map','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','customerPercent','👥\x20','column','cyan','\x20--interval\x20','Listing\x20RT-enabled\x20parent\x20segments...','\x20parent\x20segment','\x20\x20Database:\x20','segment:parent:update','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20Configuration\x20is\x20valid','jobId','Show\x20parent\x20segment\x20details','utf-8','segment:parent:list','message','/attempt/','query','column_type','page_view','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','stitchingKeys','in\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','json','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','indexOf','attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','session','realtime:','2214530iULTKH','4lyfMaX','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','log','site','/{name}.yml\x0a','enriched','Master\x20+\x20Attributes','Columns:','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','verbose','displayPreviewHints','Analyzing\x20changes...','setJobId','limit','-1d','audienceId','behaviors','SQL\x20query:\x0a','My\x20Service','Listing\x20fields\x20for\x20\x27','workflowAttemptId','\x20--behavior\x20\x22','Executing\x20parent\x20segment\x20query...','formatSchemaJson','/\x20directories\x20exist.','/\x20and\x20','Status:','\x0a\x20\x20\x20\x20}','\x20rows\x20','interval','Attributes','Listing\x20personalization\x20services\x20for\x20\x27','dirname','reduce','Errors:','\x20\x20Columns:\x20','sections','\x20Added\x20personalization\x20template\x20to\x20','join','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','allValid','Listing\x20parent\x20segments...','pushParentYaml','/sessions/','✔\x20Query\x20completed:\x20Processed\x20','rowCount','createParent','<database>.<table>','segment:parent:sql','jsonl','Join\x20on:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Available\x20behaviors:','foreignKey','segment:parent:run','segment:parent:view','ps:pz:init','stop','/app/workflows/','Fetching\x20parent\x20segment\x20\x27','3525024xgtygP','displayMasterInfo','Apply\x20changes\x20to\x20\x27','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Error:\x20File\x20not\x20found:\x20','Updating\x20parent\x20segment\x20\x27','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','errors','\x22\x20}','last_page_viewed','behavior_','\x20\x20Tables:\x201\x20customers\x20+\x20','segment:parent:preview','ps:rt:validate','displaySampleData','\x20parent\x20segment\x20\x27','displayRealtimeInfo','45LPbuqn','\x20\x202.\x20Run\x20','output','Pattern:\x20','addBehaviors','Error:\x20--database\x20and\x20--table\x20are\x20required','{\x0a\x20\x20\x22database\x22:\x20\x22','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','red','No\x20parent\x20segments\x20match\x20pattern:\x20','attributesFile','List\x20parent\x20segments','Created','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Audience\x20ID:','Updated','\x20\x20\x20\x20-\x20','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','resolveParentId','xdg-open','\x27\x20with\x20ID:\x20','Preview:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','segment','Error:','9rWhaUd','\x20\x20\x20\x20\x20\x20','\x0a⚠️\x20\x20Migrating:\x20','Personalization\x20service\x20description','getParentSQL','text','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','master','updateParent','Creating\x20parent\x20segment\x20\x27','personalization_services','segment:parent:desc','RT\x202.0\x20Validate:','schemaValid','Validate:','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20to\x20configure\x20your\x20personalization\x20service','RT\x202.0:','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20service(s)\x20configured','\x20=\x20','Source:','events','/app/dw/parentSegments/','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','realtime','Enriched:','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','\x0aUsage:\x20tdx\x20ps\x20preview\x20','parentSegment','Attributes:','displaySummary','Resolving\x20parent\x20segment\x20\x27','\x0aChanges\x20to\x20apply\x20to\x20\x27','Fetching\x20behavior\x20list...','joinKey','Create\x20parent\x20segment\x20\x27','Fetching\x20SQL\x20for\x20\x27','stats','\x20\x20Note:\x20','label','string','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','trigger_event','toFixed','\x0aNo\x20sample\x20data\x20available','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Site:\x20','Default','timezone','Events:','scheduleType','match','totalEvents','type','\x0aError:','name','schemaError','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','displayPreviewResults','yes','trim','execute','columns','data','\x20configured','\x20--enriched','579201PnnCUD','Attribute:','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','repeat','\x27...','single','\x20field','localeCompare','column_name','keys','replace','sort','tdx\x20ps\x20preview\x20','isDirectory','Master:','Output\x20file:\x20','getParentFull','test','\x27\x20and\x20run\x20workflow?','.customers)','number','format','enabled','displayColumns','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','ID\x20Stitching:','population','all','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Listing\x20parent\x20segments\x20matching\x20\x27','Schema\x20saved\x20to\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','length','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','✔\x20Found\x20','2316OiOlJt','\x20[Job\x20ID:\x20','Fetching\x20sample\x20data...','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20Opening\x20','status','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','description','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','/\x20directory.\x0a','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','segment:parent:create','darwin','120JXQzKS','\x0aChanges\x20to\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Name:\x20'];a26_0x7bf1=function(){return _0x5e9748;};return a26_0x7bf1();}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']=a26_0x4cc703(0x1aa);[a26_0x4cc703(0x23b)]=a26_0x4cc703(0x187);async[a26_0x4cc703(0x207)](_0x4a42a1){const _0x513d81=a26_0x4cc703,{options:_0xe1ae11,args:_0x5d559d,tdx:_0x56becf}=_0x4a42a1,_0x227cd0=_0x5d559d[0x0]||_0xe1ae11[_0x513d81(0x1e6)];if(!_0x227cd0)return showParentSegmentNotSetError(_0x513d81(0x23f)+_0x513d81(0xee)),0x1;const _0x3f2143=resolveYamlFile(_0x227cd0);if(!existsSync(_0x3f2143))return showFileNotFoundError(_0x3f2143,_0x227cd0),0x1;let _0x5b3e83;try{_0x5b3e83=readFileSync(_0x3f2143,_0x513d81(0x14a));}catch(_0x3c1365){const _0x58e693=_0x3c1365 instanceof Error?_0x3c1365['message']:String(_0x3c1365);return console['error']('Error\x20reading\x20file:\x20'+_0x58e693),0x1;}const _0x2dc178=createCommandSpinner(a26_0xc5b354[_0x513d81(0x122)](_0x513d81(0xed)),{'verbose':_0xe1ae11['verbose']});_0x2dc178[_0x513d81(0x128)]();const _0x2275c1={'realtime':!![],'onProgress':_0x18704e=>{const _0x53cb83=_0x513d81;_0x2dc178[_0x53cb83(0x1cd)]=formatProgressMessage(_0x18704e);}};let _0x5772a5;try{_0x5772a5=await _0x56becf['segment'][_0x513d81(0x136)](_0x5b3e83,_0x2275c1),_0x2dc178[_0x513d81(0x199)]();}catch(_0x292bf7){_0x2dc178[_0x513d81(0x199)]();throw _0x292bf7;}console[_0x513d81(0xd5)]('\x0a'+a26_0xc5b354[_0x513d81(0x102)](_0x513d81(0x1d4))+'\x20'+_0x5772a5[_0x513d81(0x201)]),console[_0x513d81(0xd5)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x5772a5),console[_0x513d81(0xd5)]('─'['repeat'](0x3c));if(_0x5772a5[_0x513d81(0x1a4)][_0x513d81(0x231)]>0x0){console[_0x513d81(0xd5)]('\x0a'+a26_0xc5b354[_0x513d81(0x1b6)]('Errors:'));for(const _0xd49ab of _0x5772a5[_0x513d81(0x1a4)]){console[_0x513d81(0xd5)]('\x20\x20'+a26_0xc5b354[_0x513d81(0x1b6)]('•')+'\x20'+_0xd49ab);}}return _0x5772a5[_0x513d81(0x188)]&&console['error']('\x0a'+a26_0xc5b354[_0x513d81(0x127)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x5772a5['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x12a);['description']=a26_0x4cc703(0x1e4);async[a26_0x4cc703(0x207)](_0x213a0d){const _0x13d75a=a26_0x4cc703,{options:_0x56a19b,args:_0x44ab85,tdx:_0x530fc9}=_0x213a0d,_0x3844d0=_0x44ab85[0x0]||_0x56a19b[_0x13d75a(0x1e6)];if(!_0x3844d0)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'+_0x13d75a(0xe3)),0x1;const _0x2307c5=await withSpinner(_0x13d75a(0x1e9)+_0x3844d0+_0x13d75a(0x213),()=>_0x530fc9['segment']['resolveParentId'](_0x3844d0),{'verbose':_0x56a19b['verbose']}),_0x21fea1=_0x2307c5['data'],_0x148486=await withSpinner(_0x13d75a(0x17e)+_0x3844d0+'\x27...',()=>_0x530fc9['personalization'][_0x13d75a(0x13a)](_0x21fea1),{'verbose':_0x56a19b[_0x13d75a(0x168)]}),_0x56a609=_0x148486[_0x13d75a(0x209)];console[_0x13d75a(0xd5)](_0x13d75a(0x233)+_0x56a609[_0x13d75a(0x231)]+_0x13d75a(0xe8)+(_0x56a609[_0x13d75a(0x231)]!==0x1?'s':''));if(_0x56a19b[_0x13d75a(0x224)]===_0x13d75a(0x155)||_0x56a19b[_0x13d75a(0x224)]===_0x13d75a(0x191))await handleSDKOutput(_0x56a609,_0x56a19b);else{if(_0x56a609[_0x13d75a(0x231)]===0x0)console[_0x13d75a(0x160)](_0x13d75a(0x104)),console['error'](a26_0xc5b354['cyan'](_0x13d75a(0x19f)));else for(const _0x1e92a8 of _0x56a609){const _0x408849=_0x1e92a8[_0x13d75a(0x183)]?.[_0x13d75a(0x231)]||0x0,_0x199500=_0x1e92a8[_0x13d75a(0x1f4)]?a26_0xc5b354[_0x13d75a(0x122)](_0x13d75a(0xcd)+_0x1e92a8[_0x13d75a(0x1f4)]):'',_0x3f15b2=a26_0xc5b354[_0x13d75a(0x122)]('\x20('+_0x408849+_0x13d75a(0x126)+(_0x408849!==0x1?'s':'')+')');console[_0x13d75a(0x160)]('\x20\x20'+_0x1e92a8[_0x13d75a(0x201)]+_0x199500+_0x3f15b2),_0x1e92a8[_0x13d75a(0x23b)]&&console['log'](_0x13d75a(0xd0)+a26_0xc5b354[_0x13d75a(0x122)](_0x1e92a8[_0x13d75a(0x23b)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x4cc703(0x201)]=a26_0x4cc703(0x198);[a26_0x4cc703(0x23b)]='Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML';async['execute'](_0x24ebaa){const _0x4af99f=a26_0x4cc703,{options:_0x458b47,args:_0x459d30}=_0x24ebaa,_0x35e7e1=_0x459d30[0x0]||_0x458b47['parentSegment'];if(!_0x35e7e1)return showParentSegmentNotSetError(_0x4af99f(0x232)+'\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 _0x596a89=resolveYamlFile(_0x35e7e1);if(!existsSync(_0x596a89))return showFileNotFoundError(_0x596a89,_0x35e7e1),0x1;let _0x3fda37;try{_0x3fda37=readFileSync(_0x596a89,'utf-8');}catch(_0x386a82){const _0x5bbe40=_0x386a82 instanceof Error?_0x386a82[_0x4af99f(0x14c)]:String(_0x386a82);return console[_0x4af99f(0xd5)](_0x4af99f(0x10d)+_0x5bbe40),0x1;}let _0x523077;try{_0x523077=parseDef(_0x3fda37);}catch(_0x50adb6){const _0x30a280=_0x50adb6 instanceof Error?_0x50adb6[_0x4af99f(0x14c)]:String(_0x50adb6);return console[_0x4af99f(0xd5)](a26_0xc5b354[_0x4af99f(0x1b6)](_0x4af99f(0x11b)+_0x30a280)),0x1;}if(_0x523077[_0x4af99f(0x1d2)]&&_0x523077['personalization_services']['length']>0x0)return console['error'](a26_0xc5b354[_0x4af99f(0xc9)](_0x4af99f(0x23d)+_0x596a89)),console[_0x4af99f(0xd5)](a26_0xc5b354[_0x4af99f(0x122)]('\x20\x20\x20'+_0x523077['personalization_services']['length']+_0x4af99f(0x1db))),0x1;!_0x523077['realtime']&&(_0x523077[_0x4af99f(0x1e1)]={'events':[{'name':_0x4af99f(0x150),'source_table':_0x4af99f(0x18f)}],'attributes':[{'name':_0x4af99f(0x1a6),'type':_0x4af99f(0x214)}],'id_stitching':{'primary_key':_0x523077[_0x4af99f(0x1cf)][_0x4af99f(0x113)]==='customers'?'td_client_id':'user_id'}});_0x523077[_0x4af99f(0x1d2)]=[{'name':_0x4af99f(0x171),'description':_0x4af99f(0x1cb),'trigger_event':'page_view','sections':[{'name':_0x4af99f(0x1f9),'criteria':'true','attributes':[_0x4af99f(0x1a6)]}]}];const _0x325b4a=serializeDef(_0x523077);return writeFileSync(_0x596a89,_0x325b4a,_0x4af99f(0x14a)),console[_0x4af99f(0xd5)](a26_0xc5b354[_0x4af99f(0x127)]('✔')+_0x4af99f(0x184)+a26_0xc5b354[_0x4af99f(0x140)](_0x596a89)),(!_0x523077[_0x4af99f(0x1e1)]||_0x3fda37[_0x4af99f(0x157)](_0x4af99f(0x15b))===-0x1)&&console[_0x4af99f(0xd5)](a26_0xc5b354['green']('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console[_0x4af99f(0xd5)]('\x0a'+a26_0xc5b354[_0x4af99f(0x122)]('Next\x20steps:')),console['error'](_0x4af99f(0x10e)+_0x596a89+_0x4af99f(0x1d8)),console['error'](_0x4af99f(0x1af)+a26_0xc5b354['dim'](_0x4af99f(0xd7)+_0x35e7e1)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
1
+ const a26_0x374bef=a26_0x27d8;(function(_0x564f94,_0x15b1ad){const _0x541e43=a26_0x27d8,_0x263609=_0x564f94();while(!![]){try{const _0xee6f6f=-parseInt(_0x541e43(0x349))/0x1*(-parseInt(_0x541e43(0x2c9))/0x2)+parseInt(_0x541e43(0x352))/0x3*(parseInt(_0x541e43(0x316))/0x4)+-parseInt(_0x541e43(0x295))/0x5*(-parseInt(_0x541e43(0x2ec))/0x6)+parseInt(_0x541e43(0x22b))/0x7*(parseInt(_0x541e43(0x279))/0x8)+parseInt(_0x541e43(0x2e7))/0x9*(parseInt(_0x541e43(0x36e))/0xa)+-parseInt(_0x541e43(0x35c))/0xb*(-parseInt(_0x541e43(0x277))/0xc)+-parseInt(_0x541e43(0x26e))/0xd*(parseInt(_0x541e43(0x2d4))/0xe);if(_0xee6f6f===_0x15b1ad)break;else _0x263609['push'](_0x263609['shift']());}catch(_0x417391){_0x263609['push'](_0x263609['shift']());}}}(a26_0x4cf5,0xa75c1));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x204546 from'path';import{BaseCommand}from'./command.js';function a26_0x4cf5(){const _0x23a2d5=['personalizationServices','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','listParents','segment:parent:list','Error:\x20Parent\x20segment\x20name\x20is\x20required','updateParent','.customers)','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','yes','\x20tdx\x20wf\x20attempt\x20','string','\x20configured','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','3369550WDxJZB','\x20\x201.\x20Edit\x20','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20\x20\x20','dirname','yellow','No\x20parent\x20segments\x20found','column_type','\x20\x20No\x20sample\x20data\x20available','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Available\x20attributes:','\x20--behavior\x20\x22<name>\x22','single','SQL\x20query:\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20+\x20[','No\x20RT-enabled\x20parent\x20segments\x20found','trim','Behaviors','\x22\x20}','\x0aChanges\x20to\x20\x27','platform','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','workflowAttemptId','stop','✔\x20Updated\x20parent\x20segment\x20\x27','open','\x20\x20Note:\x20','runParent','Attributes:','Output\x20file:\x20','\x20\x20\x20\x20\x20\x20','Join:','behavior','createParent','displaySummary','\x20Added\x20RT\x202.0\x20template\x20section','stitchingKeys','workflowId','varchar','scheduleType','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Error:\x20File\x20not\x20found:\x20','Updating\x20parent\x20segment\x20\x27','text','/\x20directories\x20exist.','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','realtime','ID\x20Stitching:','bold','RT\x202.0\x20Validate:','Error:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','👥\x20','red','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','segment:parent:desc','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','behaviorsFile','Rows:','sections','parent_segments','column_name','repeat','Master\x20Table','allValid','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','\x20section','\x20Configuration\x20is\x20valid','%)\x20','sampleData','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20service(s)\x20configured','error','\x20parent\x20segment\x20\x27','.yaml','Fetching\x20sample\x20data...','Error\x20parsing\x20YAML:\x20','double','\x20service','✔\x20No\x20changes\x20-\x20\x27','459403YlCSso','jobId','label','\x0aNo\x20sample\x20data\x20available','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','isDirectory','customerGroup','addBehaviorsFile','use','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','/\x20→\x20','join','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','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20--interval\x20','displayBehaviorsStats','displayPreviewHints','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','segment:parent:sql','.yml','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x0aNew\x20parent\x20segment\x20\x27','verbose','interval','name','map','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','localeCompare','Listing\x20fields\x20for\x20\x27','Listing\x20parent\x20segments...','run','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20RT-enabled\x20parent\x20segment','getParentFull','No\x20personalization\x20services\x20configured','displayColumns','getBehaviorNames','td_client_id','attributes','To\x20cancel:','attributesFile','parentSegment','rowCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','in\x20','keys','database','Validating\x20configuration...','foreignKey','\x20=\x20','`\x20to\x20download\x20the\x20configuration\x20first','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\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','utf-8','filter','parent_segment','setJobId','segment:parent:push','Session:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20Added\x20personalization\x20template\x20to\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','tdx\x20ps\x20push\x20','Show\x20parent\x20segment\x20schema\x20(column\x20types)','unref','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','\x27\x20and\x20run\x20workflow?','64617891LgGeti','⚡\x20Enabled','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Analyzing\x20changes...','\x0a⚠️\x20\x20Both\x20','\x27\x20with\x20ID:\x20','segment:parent:fields','data','Updating','5887284uztJAP','SELECT\x20*\x20FROM\x20','104GUiAHd','customerPercent','segment:parent:show','\x27\x20is\x20up\x20to\x20date','\x22,\x20\x22type\x22:\x20\x22','personalization_services','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','page_view','\x0aChanges\x20to\x20apply\x20to\x20\x27','last_page_viewed','using\x20the\x20default\x20path:\x20','listFields','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','Fetching\x20customers\x20schema...','indexOf','{\x0a\x20\x20\x22database\x22:\x20\x22','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:view','segment:parent:pull','/\x20and\x20','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Listing\x20personalization\x20services\x20for\x20\x27','status','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','column','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','205fahzhc','List\x20available\x20fields\x20for\x20segmentation','Created','\x0aError:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','reduce','\x20field','\x20parent\x20segment','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','ps:pz:list','✔\x20Renamed\x20directory\x20to\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','totalEvents','test','collectSchema','SELECT\x20*\x20FROM\x20(\x0a','Attributes','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','output','\x20\x20Tables:\x201\x20customers\x20+\x20','user_id','information_schema','My\x20Service','schemaError','FINISHED','displayMasterInfo','segment:parent:validate','dim','toLocaleString','ignore','Listing\x20parent\x20segments\x20matching\x20\x27','message','\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','replace','execute','length','\x20\x20\x20','columns','site','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','segment','timezone','win32','\x20--attribute\x20\x22<name>\x22','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Audience\x20ID:','apply','sourceTableValid','Status:','trigger_event','Error\x20reading\x20file:\x20','2etmLtJ','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Personalization\x20service\x20description','Executing\x20parent\x20segment\x20query...','push','customers','parent_id','<database>.<table>','pullParentYaml','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','14pIhxkq','Fetching\x20parent\x20segment\x20\x27','To\x20view\x20sample\x20data:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Aborted.','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','pushParentYaml','json','Fetching\x20behavior\x20list...','\x20to\x20configure\x20your\x20personalization\x20service','Pattern:\x20','behaviors','log','sourceTableError','\x20\x202.\x20Run\x20','table','27ELhqHf','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Fetching\x20SQL\x20for\x20\x27','enriched','127506VqEouC','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Default','/app/dw/parentSegments/','YAML\x20file:\x20','scheduleOption','getOutputDatabaseName','\x20--behavior\x20\x22','start','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','/sessions/','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Listing\x20RT-enabled\x20parent\x20segments...','Name:\x20','\x20trigger=','Enriched:','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','idStitching','\x20\x20Database:\x20','Show\x20parent\x20segment\x20details','ps:rt:validate','Events:','enabled','\x0a\x20\x20\x20\x20}','Coverage:','jsonl','workflowSessionId','number','events','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','coveragePercent','valid','formatSchemaJson','ps:rt:list','Apply\x20changes\x20to\x20\x27','\x20--attribute\x20\x22','validateParentYaml','\x20kill','previewParentYaml','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','displayPreviewResults','Create\x20parent\x20segment\x20\x27','52pHQEEn','toLowerCase','Validate:','primaryKey','population','Schema\x20saved\x20to\x20','\x27...','all','Preview:','addBehaviors','getParentSQL','Behavior:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Creating\x20parent\x20segment\x20\x27','✔\x20Found\x20','tdx\x20ps\x20preview\x20','elapsedTimeMillis','Attribute:','segment:parent:preview','errors','displaySampleData','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','displayValidateResults','Master\x20+\x20Attributes','\x20total','master','Creating','schemaValid','\x20rows)','format','\x27\x20is\x20already\x20up\x20to\x20date','Personalization:','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','attribute','Join\x20on:','type','list','Site:\x20','ps:pz:init','✔\x20Created\x20parent\x20segment\x20\x27','description','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20\x20\x20\x20-\x20','joinKey','resolveParentId','Parent\x20segment:\x20','Errors:','Attempt:','endsWith','\x0a⚠️\x20\x20Migrating:\x20','1153247SxqWhA','\x20personalization\x20service','sort','Found\x20YAML\x20file:\x20','\x0a\x20\x20\x20\x20]','segment:parent:create','✘\x20Failed\x20to\x20rename\x20directory:\x20','displayAttributesStats','customersWithEvents','294675eWAJoU','behavior_','Options:\x0a','query','Updated','limit','Resolving\x20parent\x20segment\x20\x27','matchedCount','\x5c$&','green','11HQOQfm'];a26_0x4cf5=function(){return _0x23a2d5;};return a26_0x4cf5();}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';function a26_0x27d8(_0x547c44,_0x25dc1c){_0x547c44=_0x547c44-0x1e2;const _0x4cf52d=a26_0x4cf5();let _0x27d8e0=_0x4cf52d[_0x547c44];return _0x27d8e0;}import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a26_0x563d8d from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a26_0x374bef(0x217),LEGACY_PARENT_SEGMENT_DIR=a26_0x374bef(0x262);function openBrowser(_0x3eba5c){const _0x4173a4=a26_0x374bef,_0x3e850b=process[_0x4173a4(0x1ef)],_0x25b911=_0x3e850b==='darwin'?_0x4173a4(0x1f4):_0x3e850b===_0x4173a4(0x2c0)?_0x4173a4(0x2f4):'xdg-open';spawn(_0x25b911,[_0x3eba5c],{'detached':!![],'stdio':_0x4173a4(0x2b3)})[_0x4173a4(0x26b)]();}function migrateLegacyDirectory(){const _0x1d0972=a26_0x374bef;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x58cf1f=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x58cf1f[_0x1d0972(0x230)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1d0972(0x223)](a26_0x563d8d[_0x1d0972(0x373)](_0x1d0972(0x272)+LEGACY_PARENT_SEGMENT_DIR+_0x1d0972(0x28d)+PARENT_SEGMENT_DIR+_0x1d0972(0x207))),console[_0x1d0972(0x223)](a26_0x563d8d[_0x1d0972(0x2b1)](_0x1d0972(0x33f)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x1d0972(0x223)](a26_0x563d8d['yellow'](_0x1d0972(0x348)+LEGACY_PARENT_SEGMENT_DIR+_0x1d0972(0x235)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x1d0972(0x223)](a26_0x563d8d[_0x1d0972(0x35b)](_0x1d0972(0x2a0)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x399963){const _0x27f5b1=_0x399963 instanceof Error?_0x399963[_0x1d0972(0x2b5)]:String(_0x399963);return console['error'](a26_0x563d8d[_0x1d0972(0x210)](_0x1d0972(0x34f)+_0x27f5b1+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x374bef(0x249)](_0x3ab044){return migrateLegacyDirectory(),super['run'](_0x3ab044);}}function resolveYamlFile(_0x406a9e){const _0x146c18=a26_0x374bef;if(_0x406a9e[_0x146c18(0x347)]('.yml')||_0x406a9e[_0x146c18(0x347)](_0x146c18(0x225)))return _0x406a9e;return a26_0x204546[_0x146c18(0x236)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x406a9e)+_0x146c18(0x23e));}function formatProgressMessage(_0x1e70d3){const _0x17a196=a26_0x374bef,_0x38d772=_0x1e70d3['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x38d772){const [,_0x5e2411,_0x26d8ec,_0x4f679d='']=_0x38d772;return a26_0x563d8d['dim'](_0x5e2411+':')+'\x20'+_0x26d8ec+a26_0x563d8d[_0x17a196(0x2b1)](_0x4f679d);}return a26_0x563d8d['dim'](_0x1e70d3);}function showFileNotFoundError(_0x168487,_0x3ab0d4){const _0x4fc948=a26_0x374bef;console['error'](a26_0x563d8d[_0x4fc948(0x210)](_0x4fc948(0x204)+_0x168487+'\x0a')),console[_0x4fc948(0x223)](a26_0x563d8d[_0x4fc948(0x36b)](_0x4fc948(0x1e3)+_0x3ab0d4+_0x4fc948(0x25d)));}function displayRealtimeValidation(_0x9b9693){const _0x31a0b0=a26_0x374bef;if(!_0x9b9693[_0x31a0b0(0x209)])return;const _0x4319b8=_0x9b9693['realtime'],_0x248952=_0x4319b8[_0x31a0b0(0x302)]?a26_0x563d8d[_0x31a0b0(0x35b)](_0x31a0b0(0x26f)):a26_0x563d8d['yellow']('⚡\x20Not\x20enabled');console[_0x31a0b0(0x223)]('\x0a'+a26_0x563d8d[_0x31a0b0(0x2b1)]('RT\x202.0:')+'\x20'+_0x248952);if(_0x4319b8[_0x31a0b0(0x308)]&&_0x4319b8[_0x31a0b0(0x308)][_0x31a0b0(0x2b9)]>0x0){console[_0x31a0b0(0x223)]('\x20\x20'+a26_0x563d8d[_0x31a0b0(0x2b1)](_0x31a0b0(0x301))+'\x20'+_0x4319b8[_0x31a0b0(0x308)][_0x31a0b0(0x2b9)]+_0x31a0b0(0x369));for(const _0xba29a4 of _0x4319b8[_0x31a0b0(0x308)]){const _0x59c688=_0xba29a4[_0x31a0b0(0x2c5)]===![]?a26_0x563d8d[_0x31a0b0(0x210)]('✘'):a26_0x563d8d[_0x31a0b0(0x35b)]('✔');console[_0x31a0b0(0x223)](_0x31a0b0(0x371)+_0x59c688+'\x20'+_0xba29a4[_0x31a0b0(0x243)]),_0xba29a4['sourceTableError']&&console['error'](_0x31a0b0(0x1f9)+a26_0x563d8d[_0x31a0b0(0x210)](_0xba29a4[_0x31a0b0(0x2e4)]));}}if(_0x4319b8[_0x31a0b0(0x251)]&&_0x4319b8[_0x31a0b0(0x251)][_0x31a0b0(0x2b9)]>0x0){console['error']('\x20\x20'+a26_0x563d8d[_0x31a0b0(0x2b1)](_0x31a0b0(0x1f7))+'\x20'+_0x4319b8['attributes']['length']+_0x31a0b0(0x369));for(const _0x3ee433 of _0x4319b8['attributes']){const _0x2324af=_0x3ee433[_0x31a0b0(0x30b)]?a26_0x563d8d[_0x31a0b0(0x35b)]('✔'):a26_0x563d8d[_0x31a0b0(0x210)]('✘');console[_0x31a0b0(0x223)]('\x20\x20\x20\x20'+_0x2324af+'\x20'+_0x3ee433[_0x31a0b0(0x243)]+'\x20'+a26_0x563d8d[_0x31a0b0(0x2b1)]('('+_0x3ee433['type']+')'));}}if(_0x4319b8[_0x31a0b0(0x2fd)]){const _0x58385c=_0x4319b8[_0x31a0b0(0x2fd)][_0x31a0b0(0x1ff)]?.[_0x31a0b0(0x2b9)]?_0x31a0b0(0x1e9)+_0x4319b8[_0x31a0b0(0x2fd)][_0x31a0b0(0x1ff)][_0x31a0b0(0x236)](',\x20')+']':'';console['error']('\x20\x20'+a26_0x563d8d['dim'](_0x31a0b0(0x20a))+'\x20'+_0x4319b8[_0x31a0b0(0x2fd)][_0x31a0b0(0x319)]+_0x58385c);}if(_0x4319b8['personalizationServices']&&_0x4319b8[_0x31a0b0(0x35d)][_0x31a0b0(0x2b9)]>0x0){console[_0x31a0b0(0x223)]('\x20\x20'+a26_0x563d8d[_0x31a0b0(0x2b1)](_0x31a0b0(0x335))+'\x20'+_0x4319b8[_0x31a0b0(0x35d)][_0x31a0b0(0x2b9)]+_0x31a0b0(0x229)+(_0x4319b8[_0x31a0b0(0x35d)][_0x31a0b0(0x2b9)]!==0x1?'s':''));for(const _0x23c84e of _0x4319b8['personalizationServices']){console[_0x31a0b0(0x223)](_0x31a0b0(0x341)+_0x23c84e[_0x31a0b0(0x243)]);}}}function showParentSegmentNotSetError(_0x28a246){const _0x45066a=a26_0x374bef;console[_0x45066a(0x223)](a26_0x563d8d[_0x45066a(0x373)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x45066a(0x223)](_0x28a246);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x360);['description']='List\x20parent\x20segments';async['execute'](_0x5805d5){const _0x547aa1=a26_0x374bef,{options:_0x1a3016,args:_0x56750f,tdx:_0x17bc40}=_0x5805d5,_0x271f13=_0x56750f[0x0];_0x1a3016[_0x547aa1(0x241)]&&(console[_0x547aa1(0x223)](_0x547aa1(0x33b)+_0x1a3016['site']),_0x271f13&&console['error'](_0x547aa1(0x2e1)+_0x271f13));const _0x5523e5=await withSpinner(_0x271f13?_0x547aa1(0x2b4)+_0x271f13+'\x27...':_0x547aa1(0x248),()=>_0x17bc40['segment'][_0x547aa1(0x35f)](),{'verbose':_0x1a3016[_0x547aa1(0x241)]});let _0x54984c=_0x5523e5[_0x547aa1(0x275)];if(_0x271f13){const _0x8f313b=_0x271f13[_0x547aa1(0x2b7)](/[.+^${}()|[\]\\]/g,_0x547aa1(0x35a))[_0x547aa1(0x2b7)](/\*/g,'.*')[_0x547aa1(0x2b7)](/\?/g,'.'),_0x4d71f6=new RegExp('^'+_0x8f313b+'$','i');_0x54984c=_0x54984c[_0x547aa1(0x261)](_0x5eefc6=>_0x4d71f6[_0x547aa1(0x2a3)](_0x5eefc6[_0x547aa1(0x251)][_0x547aa1(0x243)]));}_0x54984c[_0x547aa1(0x34b)]((_0x1b164d,_0x2b2875)=>_0x1b164d[_0x547aa1(0x251)][_0x547aa1(0x243)]['localeCompare'](_0x2b2875[_0x547aa1(0x251)][_0x547aa1(0x243)])),console[_0x547aa1(0x223)](_0x547aa1(0x324)+_0x54984c[_0x547aa1(0x2b9)]+_0x547aa1(0x29c)+(_0x54984c['length']!==0x1?'s':''));const _0x438c62=_0x48551a=>{const _0x2a0fd1=_0x547aa1;return getConsoleNextUrl(_0x1a3016[_0x2a0fd1(0x2bc)],'/app/dw/parentSegments/'+_0x48551a);};if(_0x1a3016[_0x547aa1(0x333)]===_0x547aa1(0x2de)||_0x1a3016['format']===_0x547aa1(0x305)){const _0x1ae88=_0x54984c['map'](_0x593234=>({..._0x593234,'url':_0x438c62(_0x593234['id'])}));await handleSDKOutput(_0x1ae88,_0x1a3016);}else{if(_0x54984c[_0x547aa1(0x2b9)]===0x0)_0x271f13?console[_0x547aa1(0x2e3)](_0x547aa1(0x2a1)+_0x271f13):console[_0x547aa1(0x2e3)](_0x547aa1(0x374));else for(const _0x5682b7 of _0x54984c){const _0x4580e7=_0x5682b7[_0x547aa1(0x251)]['population']?a26_0x563d8d[_0x547aa1(0x2b1)]('\x20('+formatRows(_0x5682b7[_0x547aa1(0x251)][_0x547aa1(0x31a)])+')'):'',_0x300ed7=hyperlink(_0x5682b7[_0x547aa1(0x251)][_0x547aa1(0x243)],_0x438c62(_0x5682b7['id']));console[_0x547aa1(0x2e3)](_0x547aa1(0x20f)+_0x300ed7+_0x4580e7);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a26_0x374bef(0x34e);[a26_0x374bef(0x33e)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a26_0x374bef(0x2b8)](_0x5e1387){const _0xe36cba=a26_0x374bef,{options:_0x57a068,args:_0x424dfe,tdx:_0x1a3aad}=_0x5e1387;console[_0xe36cba(0x223)](_0xe36cba(0x266)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0xe36cba(0x29e));const _0x2d98d5=_0x57a068;if(_0x424dfe[_0xe36cba(0x2b9)]===0x0)return console[_0xe36cba(0x223)](a26_0x563d8d[_0xe36cba(0x210)](_0xe36cba(0x361))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x43f07f=_0x424dfe[0x0];if(!_0x2d98d5[_0xe36cba(0x259)]||!_0x2d98d5[_0xe36cba(0x2e6)])return console[_0xe36cba(0x223)](_0xe36cba(0x2db)),console[_0xe36cba(0x223)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x2d98d5['verbose']&&(console[_0xe36cba(0x223)](_0xe36cba(0x33b)+_0x2d98d5['site']),console['error'](_0xe36cba(0x2f9)+_0x43f07f),console['error']('Database:\x20'+_0x2d98d5[_0xe36cba(0x259)]),console[_0xe36cba(0x223)]('Table:\x20'+_0x2d98d5[_0xe36cba(0x2e6)]));const _0x13b9dc=await loadJSONFromOptions(_0x2d98d5['attributes'],_0x2d98d5[_0xe36cba(0x253)]),_0x5d9ba4=await loadJSONFromOptions(_0x2d98d5[_0xe36cba(0x2e2)],_0x2d98d5[_0xe36cba(0x214)]),_0x5d155a=await loadJSONFromOptions(_0x2d98d5['customerGroup'],_0x2d98d5['customerGroupFile']),_0x84e5c0={'name':_0x43f07f,'description':_0x2d98d5[_0xe36cba(0x33e)],'scheduleType':_0x2d98d5['scheduleType'],'scheduleOption':_0x2d98d5[_0xe36cba(0x2f1)],'timezone':_0x2d98d5[_0xe36cba(0x2bf)],'master':{'parentDatabaseName':_0x2d98d5[_0xe36cba(0x259)],'parentTableName':_0x2d98d5[_0xe36cba(0x2e6)]},'attributes':_0x13b9dc,'behaviors':_0x5d9ba4,'customerGroup':_0x5d155a},_0x1ea374=await withSpinner(_0xe36cba(0x323)+_0x43f07f+_0xe36cba(0x31c),()=>_0x1a3aad['segment'][_0xe36cba(0x1fc)](_0x84e5c0),{'verbose':_0x57a068[_0xe36cba(0x241)]}),_0x1f16b7=_0x1ea374[_0xe36cba(0x275)];return console[_0xe36cba(0x223)](_0xe36cba(0x33d)+_0x1f16b7[_0xe36cba(0x243)]+_0xe36cba(0x273)+_0x1f16b7['id']),await handleSDKOutput([_0x1f16b7],_0x57a068),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x374bef(0x243)]='segment:parent:update';[a26_0x374bef(0x33e)]=a26_0x374bef(0x322);async[a26_0x374bef(0x2b8)](_0x35b8ac){const _0x2e2ea0=a26_0x374bef,{options:_0x578de1,args:_0xa0954a,tdx:_0x3bbab3}=_0x35b8ac;console[_0x2e2ea0(0x223)](_0x2e2ea0(0x2c2)+_0x2e2ea0(0x221)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x3a8d58=_0x578de1;if(_0xa0954a['length']===0x0)return console[_0x2e2ea0(0x223)](a26_0x563d8d[_0x2e2ea0(0x210)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x2e2ea0(0x223)](_0x2e2ea0(0x208)),0x1;const _0x5019ff=_0xa0954a[0x0];_0x3a8d58[_0x2e2ea0(0x241)]&&(console[_0x2e2ea0(0x223)]('Site:\x20'+_0x3a8d58[_0x2e2ea0(0x2bc)]),console['error'](_0x2e2ea0(0x344)+_0x5019ff));const _0x55cfbb=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x5019ff+_0x2e2ea0(0x31c),()=>_0x3bbab3['segment'][_0x2e2ea0(0x24c)](_0x5019ff),{'verbose':_0x3a8d58['verbose']}),_0x1d54d6=_0x55cfbb['data'],_0x4d06f8=await loadJSONFromOptions(_0x3a8d58['addAttributes'],_0x3a8d58['addAttributesFile']),_0x4b4496=await loadJSONFromOptions(_0x3a8d58[_0x2e2ea0(0x31f)],_0x3a8d58[_0x2e2ea0(0x232)]),_0xe31ee3={'name':_0x1d54d6[_0x2e2ea0(0x243)],'description':_0x3a8d58[_0x2e2ea0(0x33e)]!==undefined?_0x3a8d58[_0x2e2ea0(0x33e)]:_0x1d54d6[_0x2e2ea0(0x33e)],'scheduleType':_0x3a8d58[_0x2e2ea0(0x202)]!==undefined?_0x3a8d58[_0x2e2ea0(0x202)]:_0x1d54d6[_0x2e2ea0(0x202)],'scheduleOption':_0x3a8d58[_0x2e2ea0(0x2f1)]!==undefined?_0x3a8d58['scheduleOption']:_0x1d54d6['scheduleOption'],'timezone':_0x3a8d58[_0x2e2ea0(0x2bf)]!==undefined?_0x3a8d58['timezone']:_0x1d54d6[_0x2e2ea0(0x2bf)],'master':_0x1d54d6[_0x2e2ea0(0x32f)],'attributes':_0x4d06f8?[..._0x1d54d6[_0x2e2ea0(0x251)]||[],..._0x4d06f8]:_0x1d54d6[_0x2e2ea0(0x251)],'behaviors':_0x4b4496?[..._0x1d54d6[_0x2e2ea0(0x2e2)]||[],..._0x4b4496]:_0x1d54d6[_0x2e2ea0(0x2e2)],'customerGroup':_0x1d54d6[_0x2e2ea0(0x231)]},_0x5a21e0=await withSpinner(_0x2e2ea0(0x205)+_0x5019ff+_0x2e2ea0(0x31c),()=>_0x3bbab3[_0x2e2ea0(0x2be)][_0x2e2ea0(0x362)](_0x5019ff,_0xe31ee3),{'verbose':_0x3a8d58[_0x2e2ea0(0x241)]}),_0xb57fb2=_0x5a21e0[_0x2e2ea0(0x275)];return console[_0x2e2ea0(0x223)](_0x2e2ea0(0x1f3)+_0xb57fb2[_0x2e2ea0(0x243)]+'\x27'),await handleSDKOutput([_0xb57fb2],_0x3a8d58),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x28c);[a26_0x374bef(0x33e)]=a26_0x374bef(0x285);async['execute'](_0xfca8bd){const _0x19b5c3=a26_0x374bef,{options:_0x16f34c,args:_0x46122e,tdx:_0x2bba51}=_0xfca8bd,_0x43fa2d=_0x16f34c,_0x390b3b=_0x46122e[0x0]||_0x16f34c[_0x19b5c3(0x254)];if(!_0x390b3b)return showParentSegmentNotSetError(_0x19b5c3(0x245)+_0x19b5c3(0x299)),0x1;if(_0x43fa2d[_0x19b5c3(0x233)]&&_0x43fa2d[_0x19b5c3(0x2a8)])return console[_0x19b5c3(0x223)](a26_0x563d8d[_0x19b5c3(0x210)](_0x19b5c3(0x28a))),console[_0x19b5c3(0x223)](a26_0x563d8d['dim'](_0x19b5c3(0x2e8))),console[_0x19b5c3(0x223)](a26_0x563d8d['dim'](_0x19b5c3(0x283)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x19b5c3(0x223)](a26_0x563d8d[_0x19b5c3(0x36b)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x477948=_0x43fa2d[_0x19b5c3(0x2a8)]||a26_0x204546[_0x19b5c3(0x236)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x390b3b)+'.yml');_0x43fa2d[_0x19b5c3(0x241)]&&(console[_0x19b5c3(0x223)](_0x19b5c3(0x33b)+_0x43fa2d['site']),console['error'](_0x19b5c3(0x344)+_0x390b3b),console[_0x19b5c3(0x223)](_0x19b5c3(0x1f8)+_0x477948));const _0xd37583=await withSpinner(_0x19b5c3(0x2d5)+_0x390b3b+'\x27...',()=>_0x2bba51[_0x19b5c3(0x2be)][_0x19b5c3(0x2d1)](_0x390b3b),{'verbose':_0x43fa2d[_0x19b5c3(0x241)]}),_0x58654a=_0xd37583[_0x19b5c3(0x275)];if(existsSync(_0x477948)){const _0x5c6190=readFileSync(_0x477948,_0x19b5c3(0x260)),_0x50601e=generateDiff(_0x5c6190,_0x58654a);if(!hasChanges(_0x50601e))console['error'](a26_0x563d8d[_0x19b5c3(0x35b)]('✔')+'\x20No\x20changes\x20-\x20'+a26_0x563d8d['cyan'](_0x477948)+'\x20is\x20already\x20up\x20to\x20date');else{console[_0x19b5c3(0x223)](_0x19b5c3(0x1ee)+_0x477948+'\x27:'),console[_0x19b5c3(0x223)]('─'[_0x19b5c3(0x219)](0x3c)),console['error'](formatDiffWithColors(_0x50601e)),console[_0x19b5c3(0x223)]('─'[_0x19b5c3(0x219)](0x3c));if(!_0x43fa2d['yes']){if(!isInteractive())return console[_0x19b5c3(0x223)](a26_0x563d8d[_0x19b5c3(0x210)](_0x19b5c3(0x298)),_0x19b5c3(0x23f)),console[_0x19b5c3(0x223)](a26_0x563d8d[_0x19b5c3(0x2b1)](_0x19b5c3(0x268))),0x1;const _0x31924a=await confirmKey('Overwrite\x20\x27'+_0x477948+'\x27?');if(!_0x31924a)return console[_0x19b5c3(0x223)](a26_0x563d8d[_0x19b5c3(0x373)](_0x19b5c3(0x2d9))),0x1;}writeFileSync(_0x477948,_0x58654a,_0x19b5c3(0x260)),console[_0x19b5c3(0x223)](a26_0x563d8d[_0x19b5c3(0x35b)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x563d8d[_0x19b5c3(0x36b)](_0x477948));}}else{const _0x5c5c5e=a26_0x204546[_0x19b5c3(0x372)](_0x477948);!existsSync(_0x5c5c5e)&&mkdirSync(_0x5c5c5e,{'recursive':!![]}),writeFileSync(_0x477948,_0x58654a,_0x19b5c3(0x260)),console[_0x19b5c3(0x223)](a26_0x563d8d[_0x19b5c3(0x35b)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x563d8d[_0x19b5c3(0x36b)](_0x477948));}return saveSessionContext({'parent_segment':_0x390b3b},_0x43fa2d['session']),console[_0x19b5c3(0x223)](a26_0x563d8d['green']('✔')+'\x20Context\x20set:\x20'+a26_0x563d8d[_0x19b5c3(0x2b1)](_0x19b5c3(0x262))+_0x19b5c3(0x25c)+a26_0x563d8d['cyan'](_0x390b3b)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x264);[a26_0x374bef(0x33e)]=a26_0x374bef(0x203);async[a26_0x374bef(0x2b8)](_0x441fce){const _0x5f17a0=a26_0x374bef,{options:_0xb0bff1,args:_0x56b61b,tdx:_0x20d827}=_0x441fce,_0x99f3cf=_0xb0bff1,_0x27173f=_0x56b61b[0x0]||_0xb0bff1[_0x5f17a0(0x254)];if(!_0x27173f)return showParentSegmentNotSetError(_0x5f17a0(0x370)+_0x5f17a0(0x1f0)),0x1;const _0x360a16=resolveYamlFile(_0x27173f);if(!existsSync(_0x360a16))return showFileNotFoundError(_0x360a16,_0x27173f),0x1;_0x99f3cf[_0x5f17a0(0x241)]&&(console['error'](_0x5f17a0(0x33b)+_0x99f3cf[_0x5f17a0(0x2bc)]),console[_0x5f17a0(0x223)]('YAML\x20file:\x20'+_0x360a16));let _0x4edadf;try{_0x4edadf=readFileSync(_0x360a16,_0x5f17a0(0x260));}catch(_0x5f300f){const _0x447f4b=_0x5f300f instanceof Error?_0x5f300f[_0x5f17a0(0x2b5)]:String(_0x5f300f);return console['error'](_0x5f17a0(0x2c8)+_0x447f4b),0x1;}const _0xc0d382=await withSpinner(_0x5f17a0(0x271),()=>_0x20d827[_0x5f17a0(0x2be)][_0x5f17a0(0x2dd)](_0x4edadf),{'verbose':_0x99f3cf['verbose']}),_0x5d0ae9=_0xc0d382[_0x5f17a0(0x275)],{isNew:_0x2c9c8f,name:_0x312ab1,hasChanges:_0x499779,diffFormatted:_0x42b9bf}=_0x5d0ae9;if(!_0x499779)return console[_0x5f17a0(0x223)](_0x5f17a0(0x22a)+_0x312ab1+_0x5f17a0(0x334)),0x0;_0x2c9c8f?console[_0x5f17a0(0x223)](_0x5f17a0(0x240)+_0x312ab1+'\x27:'):console[_0x5f17a0(0x223)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x312ab1+'\x27:');console['error']('─'[_0x5f17a0(0x219)](0x3c)),console[_0x5f17a0(0x223)](_0x42b9bf),console['error']('─'['repeat'](0x3c));const _0x38aba8=_0x2c9c8f?_0x5f17a0(0x315)+_0x312ab1+'\x27?':_0x5f17a0(0x30e)+_0x312ab1+'\x27?';if(!_0x99f3cf[_0x5f17a0(0x366)]){if(!isInteractive())return console['error'](a26_0x563d8d[_0x5f17a0(0x210)]('\x0aError:'),_0x5f17a0(0x23f)),console[_0x5f17a0(0x223)](a26_0x563d8d['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x56f2c2=await confirmKey(_0x38aba8);if(!_0x56f2c2)return console[_0x5f17a0(0x223)](a26_0x563d8d[_0x5f17a0(0x373)]('Aborted.')),0x1;}const _0x5ee884=_0x2c9c8f?_0x5f17a0(0x330):_0x5f17a0(0x276),_0x4b8567=await withSpinner(_0x5ee884+_0x5f17a0(0x224)+_0x312ab1+'\x27...',()=>_0x5d0ae9['apply'](),{'verbose':_0x99f3cf[_0x5f17a0(0x241)]}),_0x210678=_0x4b8567[_0x5f17a0(0x275)],_0x28523d=getConsoleNextUrl(_0x99f3cf[_0x5f17a0(0x2bc)],_0x5f17a0(0x2ef)+_0x210678['id']),_0x5f455a=_0x2c9c8f?_0x5f17a0(0x297):_0x5f17a0(0x356);return console['error']('✔\x20'+_0x5f455a+'\x20parent\x20segment\x20\x27'+_0x210678[_0x5f17a0(0x243)]+'\x27'),console['error']('\x20\x20'+_0x28523d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a26_0x374bef(0x2b0);[a26_0x374bef(0x33e)]=a26_0x374bef(0x270);async[a26_0x374bef(0x2b8)](_0x21e152){const _0x39d493=a26_0x374bef,{options:_0x4ac0ae,args:_0xbbda99,tdx:_0x28af13}=_0x21e152,_0x11bf9d=_0x4ac0ae,_0x5c157c=_0xbbda99[0x0]||_0x4ac0ae['parentSegment'];if(!_0x5c157c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x39d493(0x2ed)+'Options:\x0a'+_0x39d493(0x32b)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x39d493(0x22f)),0x1;const _0x560fdb=resolveYamlFile(_0x5c157c);if(!existsSync(_0x560fdb))return showFileNotFoundError(_0x560fdb,_0x5c157c),0x1;_0x11bf9d[_0x39d493(0x241)]&&(console['error'](_0x39d493(0x33b)+_0x11bf9d['site']),console[_0x39d493(0x223)](_0x39d493(0x2f0)+_0x560fdb));let _0x58b9bc;try{_0x58b9bc=readFileSync(_0x560fdb,_0x39d493(0x260));}catch(_0x172e7d){const _0x5c6443=_0x172e7d instanceof Error?_0x172e7d[_0x39d493(0x2b5)]:String(_0x172e7d);return console[_0x39d493(0x223)]('Error\x20reading\x20file:\x20'+_0x5c6443),0x1;}const _0x5a6782=createCommandSpinner(a26_0x563d8d[_0x39d493(0x2b1)](_0x39d493(0x25a)),{'verbose':_0x11bf9d['verbose']});_0x5a6782[_0x39d493(0x2f4)]();const _0xb0890d={'onProgress':_0x19808b=>{const _0x134f9a=_0x39d493;_0x5a6782[_0x134f9a(0x206)]=formatProgressMessage(_0x19808b);}};if(_0x11bf9d[_0x39d493(0x32f)])_0xb0890d[_0x39d493(0x32f)]=!![];if(_0x11bf9d[_0x39d493(0x2eb)])_0xb0890d[_0x39d493(0x2eb)]=!![];_0x11bf9d[_0x39d493(0x337)]&&(_0xb0890d[_0x39d493(0x337)]=_0x11bf9d[_0x39d493(0x337)]);_0x11bf9d[_0x39d493(0x1fb)]&&(_0xb0890d[_0x39d493(0x1fb)]=_0x11bf9d[_0x39d493(0x1fb)]);if(_0x11bf9d[_0x39d493(0x242)])_0xb0890d['interval']=_0x11bf9d[_0x39d493(0x242)];let _0x453f17;try{_0x453f17=await _0x28af13[_0x39d493(0x2be)][_0x39d493(0x310)](_0x58b9bc,_0xb0890d),_0x5a6782[_0x39d493(0x1f2)]();}catch(_0x3c1872){_0x5a6782[_0x39d493(0x1f2)]();throw _0x3c1872;}const _0x2cfbfb=_0x11bf9d[_0x39d493(0x242)]||'-1d';return this[_0x39d493(0x32c)](_0x453f17,_0xb0890d,_0x560fdb,_0x2cfbfb),_0x453f17[_0x39d493(0x21b)]?0x0:0x1;}['displayValidateResults'](_0x333122,_0x8d1f03,_0x1a8470,_0x39ea82){const _0x15a816=a26_0x374bef;console[_0x15a816(0x223)]('\x0a'+a26_0x563d8d['bold'](_0x15a816(0x318))+'\x20'+_0x333122['name']),console[_0x15a816(0x223)]('═'[_0x15a816(0x219)](0x3c)),this[_0x15a816(0x2af)](_0x333122);if(typeof _0x8d1f03[_0x15a816(0x337)]==='string'){this[_0x15a816(0x350)](_0x333122),this[_0x15a816(0x1fd)](_0x333122),this[_0x15a816(0x23b)](_0x1a8470,_0x39ea82,_0x15a816(0x337),_0x8d1f03[_0x15a816(0x337)]);return;}if(_0x8d1f03['attribute']===!![]){this[_0x15a816(0x350)](_0x333122),this[_0x15a816(0x1fd)](_0x333122),this[_0x15a816(0x23b)](_0x1a8470,_0x39ea82,_0x15a816(0x251));return;}if(typeof _0x8d1f03[_0x15a816(0x1fb)]===_0x15a816(0x368)){this[_0x15a816(0x23a)](_0x333122,_0x39ea82),this[_0x15a816(0x1fd)](_0x333122),this[_0x15a816(0x23b)](_0x1a8470,_0x39ea82,'behavior',_0x8d1f03[_0x15a816(0x1fb)]);return;}if(_0x8d1f03[_0x15a816(0x1fb)]===!![]){this['displayBehaviorsStats'](_0x333122,_0x39ea82),this[_0x15a816(0x1fd)](_0x333122),this[_0x15a816(0x23b)](_0x1a8470,_0x39ea82,_0x15a816(0x2e2));return;}this['displayAttributesStats'](_0x333122),this[_0x15a816(0x23a)](_0x333122,_0x39ea82),this['displayRealtimeInfo'](_0x333122),this[_0x15a816(0x1fd)](_0x333122),this[_0x15a816(0x23b)](_0x1a8470,_0x39ea82,'all');}['displayRealtimeInfo'](_0x23f160){displayRealtimeValidation(_0x23f160);}[a26_0x374bef(0x23b)](_0x3a087f,_0x49cfee,_0x2b1d66,_0x56a6e7){const _0x582798=a26_0x374bef;console[_0x582798(0x223)]('\x0a'+a26_0x563d8d['dim'](_0x582798(0x2d6)));const _0x5145c1=_0x49cfee!=='-1d'?_0x582798(0x239)+_0x49cfee:'';if(_0x2b1d66===_0x582798(0x337)&&_0x56a6e7)console[_0x582798(0x223)]('\x20\x20'+a26_0x563d8d['dim'](_0x582798(0x325)+_0x3a087f+_0x582798(0x30f)+_0x56a6e7+'\x22'+_0x5145c1));else{if(_0x2b1d66===_0x582798(0x1fb)&&_0x56a6e7)console[_0x582798(0x223)]('\x20\x20'+a26_0x563d8d[_0x582798(0x2b1)](_0x582798(0x325)+_0x3a087f+_0x582798(0x2f3)+_0x56a6e7+'\x22'+_0x5145c1));else(_0x2b1d66===_0x582798(0x251)||_0x2b1d66===_0x582798(0x31d))&&console[_0x582798(0x223)]('\x20\x20'+a26_0x563d8d[_0x582798(0x2b1)](_0x582798(0x325)+_0x3a087f+_0x582798(0x2c1)+_0x5145c1));}(_0x2b1d66==='behaviors'||_0x2b1d66==='all')&&console['error']('\x20\x20'+a26_0x563d8d[_0x582798(0x2b1)]('tdx\x20ps\x20preview\x20'+_0x3a087f+_0x582798(0x1e5)+_0x5145c1)),_0x2b1d66===_0x582798(0x31d)&&console['error']('\x20\x20'+a26_0x563d8d[_0x582798(0x2b1)](_0x582798(0x325)+_0x3a087f+'\x20--enriched'+_0x5145c1));}[a26_0x374bef(0x2af)](_0x308b06){const _0x3b8a2c=a26_0x374bef,{master:_0x46914f}=_0x308b06,_0x27637d=_0x46914f[_0x3b8a2c(0x331)]?a26_0x563d8d[_0x3b8a2c(0x35b)]('✔'):a26_0x563d8d[_0x3b8a2c(0x210)]('✘');console[_0x3b8a2c(0x223)]('\x0a'+a26_0x563d8d['dim'](_0x3b8a2c(0x21a))),console[_0x3b8a2c(0x223)](_0x27637d+'\x20'+a26_0x563d8d[_0x3b8a2c(0x20b)](_0x46914f[_0x3b8a2c(0x259)]+'.'+_0x46914f['table'])),_0x46914f[_0x3b8a2c(0x331)]?_0x46914f[_0x3b8a2c(0x255)]!==undefined&&console[_0x3b8a2c(0x223)]('\x20\x20'+a26_0x563d8d[_0x3b8a2c(0x2b1)](_0x3b8a2c(0x215))+'\x20'+a26_0x563d8d['cyan'](formatRows(_0x46914f[_0x3b8a2c(0x255)]))):console[_0x3b8a2c(0x223)]('\x20\x20'+a26_0x563d8d['red'](_0x3b8a2c(0x20d))+'\x20'+_0x46914f[_0x3b8a2c(0x2ad)]);}[a26_0x374bef(0x350)](_0x49975a){const _0x211a94=a26_0x374bef;if(_0x49975a[_0x211a94(0x251)][_0x211a94(0x2b9)]===0x0)return;console[_0x211a94(0x223)]('\x0a'+a26_0x563d8d[_0x211a94(0x2b1)](_0x211a94(0x2a6)));for(const _0x2f9f30 of _0x49975a[_0x211a94(0x251)]){const _0x4f1605=_0x2f9f30['schemaValid']?a26_0x563d8d[_0x211a94(0x35b)]('✔'):a26_0x563d8d[_0x211a94(0x210)]('✘');let _0x407928='';if(_0x2f9f30[_0x211a94(0x331)]&&_0x2f9f30[_0x211a94(0x359)]!==undefined&&_0x2f9f30[_0x211a94(0x30a)]!==undefined){const _0x145794=_0x2f9f30[_0x211a94(0x30a)]['toFixed'](0x1),_0x459f8b=_0x2f9f30[_0x211a94(0x30a)]>=0x50?a26_0x563d8d[_0x211a94(0x35b)]:_0x2f9f30['coveragePercent']>=0x32?a26_0x563d8d[_0x211a94(0x373)]:a26_0x563d8d[_0x211a94(0x210)];_0x407928='\x20'+a26_0x563d8d['dim'](_0x211a94(0x304))+'\x20'+_0x459f8b(_0x145794+'%')+'\x20('+formatRows(_0x2f9f30[_0x211a94(0x359)])+_0x211a94(0x332);}console[_0x211a94(0x223)](_0x4f1605+'\x20'+a26_0x563d8d['bold'](_0x2f9f30[_0x211a94(0x243)])+_0x407928),console[_0x211a94(0x223)]('\x20\x20'+a26_0x563d8d['dim']('Source:')+'\x20'+a26_0x563d8d['bold'](_0x2f9f30[_0x211a94(0x259)]+'.'+_0x2f9f30[_0x211a94(0x2e6)]));const _0xff03a6=_0x2f9f30['joinKey']===_0x2f9f30[_0x211a94(0x25b)]?a26_0x563d8d[_0x211a94(0x2b1)](_0x211a94(0x338))+'\x20'+_0x2f9f30[_0x211a94(0x342)]:a26_0x563d8d[_0x211a94(0x2b1)](_0x211a94(0x1fa))+'\x20'+_0x2f9f30[_0x211a94(0x342)]+_0x211a94(0x25c)+_0x2f9f30[_0x211a94(0x25b)];console[_0x211a94(0x223)]('\x20\x20'+_0xff03a6),console['error']('\x20\x20'+a26_0x563d8d[_0x211a94(0x2b1)]('Columns:')),this['displayColumns'](_0x2f9f30[_0x211a94(0x2bb)]),!_0x2f9f30['schemaValid']&&console[_0x211a94(0x223)]('\x20\x20'+a26_0x563d8d[_0x211a94(0x210)](_0x211a94(0x20d))+'\x20'+_0x2f9f30[_0x211a94(0x2ad)]);}}[a26_0x374bef(0x23a)](_0x12f283,_0x1ba042){const _0x88f399=a26_0x374bef;if(_0x12f283[_0x88f399(0x2e2)][_0x88f399(0x2b9)]===0x0)return;console[_0x88f399(0x223)]('\x0a'+a26_0x563d8d[_0x88f399(0x2b1)](_0x88f399(0x1ec))+'\x20'+a26_0x563d8d[_0x88f399(0x2b1)]('('+_0x1ba042+')'));for(const _0x898ffd of _0x12f283['behaviors']){const _0x137396=_0x898ffd['schemaValid']?a26_0x563d8d[_0x88f399(0x35b)]('✔'):a26_0x563d8d['red']('✘');let _0x3d5710='';if(_0x898ffd['schemaValid']&&_0x898ffd[_0x88f399(0x351)]!==undefined&&_0x898ffd[_0x88f399(0x2a2)]!==undefined){const _0x4404ea=_0x898ffd['customerPercent']?.['toFixed'](0x1)||'?',_0x5c8624=(_0x898ffd[_0x88f399(0x27a)]??0x0)>=0x32?a26_0x563d8d[_0x88f399(0x35b)]:(_0x898ffd[_0x88f399(0x27a)]??0x0)>=0x14?a26_0x563d8d[_0x88f399(0x373)]:a26_0x563d8d['red'];_0x3d5710='\x20'+a26_0x563d8d[_0x88f399(0x2b1)]('Customers:')+'\x20'+_0x5c8624(formatRows(_0x898ffd['customersWithEvents']))+'\x20('+_0x4404ea+_0x88f399(0x21f)+a26_0x563d8d[_0x88f399(0x2b1)]('Events:')+'\x20'+a26_0x563d8d[_0x88f399(0x36b)](formatRows(_0x898ffd[_0x88f399(0x2a2)]));}console[_0x88f399(0x223)](_0x137396+'\x20'+a26_0x563d8d[_0x88f399(0x20b)](_0x898ffd[_0x88f399(0x243)])+_0x3d5710),console[_0x88f399(0x223)]('\x20\x20'+a26_0x563d8d['dim']('Source:')+'\x20'+a26_0x563d8d[_0x88f399(0x20b)](_0x898ffd[_0x88f399(0x259)]+'.'+_0x898ffd[_0x88f399(0x2e6)]));const _0x13e48a=_0x898ffd['joinKey']===_0x898ffd[_0x88f399(0x25b)]?a26_0x563d8d[_0x88f399(0x2b1)](_0x88f399(0x338))+'\x20'+_0x898ffd[_0x88f399(0x342)]:a26_0x563d8d[_0x88f399(0x2b1)](_0x88f399(0x1fa))+'\x20'+_0x898ffd[_0x88f399(0x342)]+_0x88f399(0x25c)+_0x898ffd[_0x88f399(0x25b)];console[_0x88f399(0x223)]('\x20\x20'+_0x13e48a),console[_0x88f399(0x223)]('\x20\x20'+a26_0x563d8d['dim']('Columns:')),this[_0x88f399(0x24e)](_0x898ffd[_0x88f399(0x2bb)]),!_0x898ffd[_0x88f399(0x331)]&&console[_0x88f399(0x223)]('\x20\x20'+a26_0x563d8d['red'](_0x88f399(0x20d))+'\x20'+_0x898ffd[_0x88f399(0x2ad)]);}}[a26_0x374bef(0x24e)](_0x547238){const _0x3a1a94=a26_0x374bef;for(const _0x5e4c62 of _0x547238){_0x5e4c62[_0x3a1a94(0x22d)]===_0x5e4c62['column']||_0x5e4c62[_0x3a1a94(0x292)]==='*'?console[_0x3a1a94(0x223)]('\x20\x20\x20\x20-\x20'+_0x5e4c62[_0x3a1a94(0x22d)]):console[_0x3a1a94(0x223)](_0x3a1a94(0x341)+_0x5e4c62[_0x3a1a94(0x22d)]+'\x20'+a26_0x563d8d['dim']('('+_0x5e4c62[_0x3a1a94(0x292)]+')'));}}[a26_0x374bef(0x1fd)](_0x28f542){const _0x2a7ec7=a26_0x374bef;console[_0x2a7ec7(0x223)]('─'[_0x2a7ec7(0x219)](0x3c));if(_0x28f542[_0x2a7ec7(0x329)][_0x2a7ec7(0x2b9)]>0x0){console['error']('\x0a'+a26_0x563d8d[_0x2a7ec7(0x210)](_0x2a7ec7(0x345)));for(const _0x39743a of _0x28f542[_0x2a7ec7(0x329)]){console['error']('\x20\x20'+a26_0x563d8d['red']('•')+'\x20'+_0x39743a);}}_0x28f542[_0x2a7ec7(0x21b)]&&console[_0x2a7ec7(0x223)]('\x0a'+a26_0x563d8d['green']('✔')+_0x2a7ec7(0x21e));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a26_0x374bef(0x328);['description']=a26_0x374bef(0x2d2);async['execute'](_0x11385d){const _0x5b832e=a26_0x374bef,{options:_0x2c5ff4,args:_0x5d0b03,tdx:_0x4bfea7}=_0x11385d,_0x452786=_0x2c5ff4,_0xbf6110=_0x5d0b03[0x0]||_0x2c5ff4[_0x5b832e(0x254)];if(!_0xbf6110)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x5b832e(0x2d8)+'Options\x20(one\x20required):\x0a'+_0x5b832e(0x2e9)+_0x5b832e(0x340)+_0x5b832e(0x2d3)+_0x5b832e(0x23c)+_0x5b832e(0x22f)),0x1;if(!_0x452786['master']&&!_0x452786[_0x5b832e(0x337)]&&!_0x452786['behavior']&&!_0x452786[_0x5b832e(0x2eb)])return console[_0x5b832e(0x223)](a26_0x563d8d[_0x5b832e(0x210)](_0x5b832e(0x2da))),console[_0x5b832e(0x223)](_0x5b832e(0x2dc)),console[_0x5b832e(0x223)]('Options:'),console[_0x5b832e(0x223)](_0x5b832e(0x1e8)),console[_0x5b832e(0x223)](_0x5b832e(0x294)),console[_0x5b832e(0x223)](_0x5b832e(0x2d7)),console['error'](_0x5b832e(0x20e)),0x1;const _0x4d9827=resolveYamlFile(_0xbf6110);if(!existsSync(_0x4d9827))return showFileNotFoundError(_0x4d9827,_0xbf6110),0x1;_0x452786[_0x5b832e(0x241)]&&(console[_0x5b832e(0x223)](_0x5b832e(0x33b)+_0x452786[_0x5b832e(0x2bc)]),console[_0x5b832e(0x223)](_0x5b832e(0x2f0)+_0x4d9827));let _0x13a834;try{_0x13a834=readFileSync(_0x4d9827,_0x5b832e(0x260));}catch(_0x4d05cc){const _0x59274c=_0x4d05cc instanceof Error?_0x4d05cc[_0x5b832e(0x2b5)]:String(_0x4d05cc);return console['error']('Error\x20reading\x20file:\x20'+_0x59274c),0x1;}let _0x235656;try{_0x235656=parseDef(_0x13a834);}catch(_0x3a873c){const _0x42beed=_0x3a873c instanceof Error?_0x3a873c[_0x5b832e(0x2b5)]:String(_0x3a873c);return console['error'](a26_0x563d8d['red'](_0x5b832e(0x227)+_0x42beed)),0x1;}if(_0x452786[_0x5b832e(0x337)]===!![]||_0x452786[_0x5b832e(0x337)]===''){const _0x21205a=_0x235656[_0x5b832e(0x251)]?.[_0x5b832e(0x244)](_0x6295c5=>_0x6295c5['name'])||[];if(_0x21205a[_0x5b832e(0x2b9)]===0x0)console[_0x5b832e(0x223)](a26_0x563d8d[_0x5b832e(0x210)](_0x5b832e(0x2fc)));else{console[_0x5b832e(0x223)](a26_0x563d8d['red']('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x5b832e(0x223)](_0x5b832e(0x1e4));for(const _0xa1bd19 of _0x21205a){console[_0x5b832e(0x223)]('\x20\x20'+a26_0x563d8d[_0x5b832e(0x36b)](_0xa1bd19));}console['error'](_0x5b832e(0x2f7)+_0xbf6110+'\x20--attribute\x20\x22'+_0x21205a[0x0]+'\x22');}return 0x1;}if(_0x452786[_0x5b832e(0x1fb)]===!![]||_0x452786[_0x5b832e(0x1fb)]===''){const _0x2a586=_0x235656['behaviors']?.[_0x5b832e(0x244)](_0x28e968=>_0x28e968[_0x5b832e(0x243)])||[];if(_0x2a586[_0x5b832e(0x2b9)]===0x0)console['error'](a26_0x563d8d['red'](_0x5b832e(0x28e)));else{console[_0x5b832e(0x223)](a26_0x563d8d[_0x5b832e(0x210)](_0x5b832e(0x238))),console['error']('Available\x20behaviors:');for(const _0x5421cf of _0x2a586){console['error']('\x20\x20'+a26_0x563d8d[_0x5b832e(0x36b)](_0x5421cf));}console[_0x5b832e(0x223)](_0x5b832e(0x2f7)+_0xbf6110+_0x5b832e(0x2f3)+_0x2a586[0x0]+'\x22');}return 0x1;}const _0xe5458=createCommandSpinner(a26_0x563d8d[_0x5b832e(0x2b1)](_0x5b832e(0x226)),{'verbose':_0x452786[_0x5b832e(0x241)]});_0xe5458['start']();const _0x164847={'onProgress':_0x4a6337=>{const _0xfc88d8=_0x5b832e;_0xe5458[_0xfc88d8(0x206)]=formatProgressMessage(_0x4a6337);}};if(_0x452786[_0x5b832e(0x32f)])_0x164847[_0x5b832e(0x32f)]=!![];if(_0x452786['attribute']&&typeof _0x452786[_0x5b832e(0x337)]===_0x5b832e(0x368))_0x164847[_0x5b832e(0x337)]=_0x452786[_0x5b832e(0x337)];if(_0x452786[_0x5b832e(0x1fb)]&&typeof _0x452786[_0x5b832e(0x1fb)]==='string')_0x164847[_0x5b832e(0x1fb)]=_0x452786[_0x5b832e(0x1fb)];if(_0x452786['enriched'])_0x164847['enriched']=!![];if(_0x452786[_0x5b832e(0x242)])_0x164847['interval']=_0x452786[_0x5b832e(0x242)];let _0x4ff8fa;try{_0x4ff8fa=await _0x4bfea7[_0x5b832e(0x2be)][_0x5b832e(0x312)](_0x13a834,_0x164847),_0xe5458[_0x5b832e(0x1f2)]();}catch(_0x3e116b){_0xe5458[_0x5b832e(0x1f2)]();throw _0x3e116b;}return await this[_0x5b832e(0x314)](_0x4ff8fa,{'master':_0x452786['master'],'attribute':typeof _0x452786[_0x5b832e(0x337)]===_0x5b832e(0x368)?_0x452786[_0x5b832e(0x337)]:undefined,'behavior':typeof _0x452786['behavior']==='string'?_0x452786[_0x5b832e(0x1fb)]:undefined,'enriched':_0x452786[_0x5b832e(0x2eb)]}),_0x4ff8fa[_0x5b832e(0x21b)]?0x0:0x1;}async[a26_0x374bef(0x314)](_0x2fa23f,_0x466294){const _0x30e9ee=a26_0x374bef;console[_0x30e9ee(0x223)]('\x0a'+a26_0x563d8d['bold'](_0x30e9ee(0x31e))+'\x20'+_0x2fa23f[_0x30e9ee(0x243)]),console['error']('═'[_0x30e9ee(0x219)](0x3c));if(_0x466294[_0x30e9ee(0x32f)]&&_0x2fa23f[_0x30e9ee(0x220)]){const _0x53a958=a26_0x563d8d[_0x30e9ee(0x2b1)]('Master:')+'\x20'+a26_0x563d8d['bold'](_0x2fa23f[_0x30e9ee(0x32f)][_0x30e9ee(0x259)]+'.'+_0x2fa23f['master'][_0x30e9ee(0x2e6)]);await this[_0x30e9ee(0x32a)](_0x53a958,_0x2fa23f['sampleData']);}else{if(_0x466294[_0x30e9ee(0x337)]&&_0x2fa23f[_0x30e9ee(0x220)]){const _0x84beeb=a26_0x563d8d['dim'](_0x30e9ee(0x327))+'\x20'+a26_0x563d8d[_0x30e9ee(0x20b)](_0x466294[_0x30e9ee(0x337)]);await this['displaySampleData'](_0x84beeb,_0x2fa23f['sampleData']);}else{if(_0x466294[_0x30e9ee(0x1fb)]&&_0x2fa23f[_0x30e9ee(0x220)]){const _0x26b92f=a26_0x563d8d[_0x30e9ee(0x2b1)](_0x30e9ee(0x321))+'\x20'+a26_0x563d8d[_0x30e9ee(0x20b)](_0x466294['behavior']);await this[_0x30e9ee(0x32a)](_0x26b92f,_0x2fa23f[_0x30e9ee(0x220)]);}else{if(_0x466294[_0x30e9ee(0x2eb)]&&_0x2fa23f[_0x30e9ee(0x220)]){const _0xe28e07=a26_0x563d8d[_0x30e9ee(0x2b1)](_0x30e9ee(0x2fb))+'\x20'+a26_0x563d8d[_0x30e9ee(0x20b)](_0x30e9ee(0x32d));await this[_0x30e9ee(0x32a)](_0xe28e07,_0x2fa23f['sampleData']);}else!_0x2fa23f[_0x30e9ee(0x220)]&&console[_0x30e9ee(0x223)](_0x30e9ee(0x22e));}}}if(_0x2fa23f[_0x30e9ee(0x329)][_0x30e9ee(0x2b9)]>0x0){console['error']('─'[_0x30e9ee(0x219)](0x3c)),console['error']('\x0a'+a26_0x563d8d[_0x30e9ee(0x210)](_0x30e9ee(0x345)));for(const _0x207365 of _0x2fa23f['errors']){console[_0x30e9ee(0x223)]('\x20\x20'+a26_0x563d8d[_0x30e9ee(0x210)]('•')+'\x20'+_0x207365);}}}async[a26_0x374bef(0x32a)](_0x2265bf,_0x30fbbb){const _0x230a8c=a26_0x374bef;if(_0x30fbbb[_0x230a8c(0x2b9)]===0x0){console[_0x230a8c(0x223)]('\x0a'+_0x2265bf),console['error'](_0x230a8c(0x1e2));return;}console[_0x230a8c(0x223)]('\x0a'+_0x2265bf);const _0x5dbd0b=Object[_0x230a8c(0x258)](_0x30fbbb[0x0])[_0x230a8c(0x244)](_0xb99a0b=>({'name':_0xb99a0b,'type':typeof _0x30fbbb[0x0][_0xb99a0b]===_0x230a8c(0x307)?_0x230a8c(0x228):_0x230a8c(0x201)})),_0x60d2e2={'queryId':'preview','columns':_0x5dbd0b,'data':_0x30fbbb,'stats':{'state':_0x230a8c(0x2ae),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x30fbbb[_0x230a8c(0x2b9)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x126c1e=formatAsTable(_0x60d2e2,_0x30fbbb['length'],!![]);await writeOutput(_0x126c1e,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x374bef(0x243)]='segment:parent:run';[a26_0x374bef(0x33e)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a26_0x374bef(0x2b8)](_0xb9ae87){const _0x283dae=a26_0x374bef,{options:_0x2cce78,args:_0x416f56,tdx:_0x5a3236}=_0xb9ae87,_0x430126=_0x2cce78,_0x508846=_0x416f56[0x0]||_0x2cce78[_0x283dae(0x254)];if(!_0x508846)return showParentSegmentNotSetError(_0x283dae(0x35e)+_0x283dae(0x36c)),0x1;const _0x4a6ec7=resolveYamlFile(_0x508846);if(existsSync(_0x4a6ec7)){_0x430126[_0x283dae(0x241)]&&console['error'](_0x283dae(0x34c)+_0x4a6ec7);let _0x53ac71;try{_0x53ac71=readFileSync(_0x4a6ec7,_0x283dae(0x260));}catch(_0x6803e0){const _0x4e8643=_0x6803e0 instanceof Error?_0x6803e0['message']:String(_0x6803e0);return console[_0x283dae(0x223)](_0x283dae(0x2c8)+_0x4e8643),0x1;}const _0x3b1683=await withSpinner('Analyzing\x20changes...',()=>_0x5a3236[_0x283dae(0x2be)][_0x283dae(0x2dd)](_0x53ac71),{'verbose':_0x430126[_0x283dae(0x241)]}),_0x525e86=_0x3b1683[_0x283dae(0x275)],{isNew:_0x2a5af1,name:_0x683b3d,hasChanges:_0x3a6ba8,diffFormatted:_0x374287}=_0x525e86;if(_0x3a6ba8){_0x2a5af1?console[_0x283dae(0x223)](_0x283dae(0x240)+_0x683b3d+'\x27:'):console['error'](_0x283dae(0x281)+_0x683b3d+'\x27:');console[_0x283dae(0x223)]('─'[_0x283dae(0x219)](0x3c)),console[_0x283dae(0x223)](_0x374287),console[_0x283dae(0x223)]('─'[_0x283dae(0x219)](0x3c));const _0xd9300d=_0x2a5af1?_0x283dae(0x315)+_0x683b3d+_0x283dae(0x26d):_0x283dae(0x30e)+_0x683b3d+_0x283dae(0x26d);if(!_0x430126[_0x283dae(0x366)]){if(!isInteractive())return console[_0x283dae(0x223)](a26_0x563d8d['red'](_0x283dae(0x298)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x283dae(0x223)](a26_0x563d8d[_0x283dae(0x2b1)](_0x283dae(0x268))),0x1;const _0xb01581=await confirmKey(_0xd9300d);if(!_0xb01581)return console['error'](a26_0x563d8d[_0x283dae(0x373)](_0x283dae(0x2d9))),0x1;}const _0x59c40f=_0x2a5af1?_0x283dae(0x330):'Updating';await withSpinner(_0x59c40f+'\x20parent\x20segment\x20\x27'+_0x683b3d+_0x283dae(0x31c),()=>_0x525e86[_0x283dae(0x2c4)](),{'verbose':_0x430126[_0x283dae(0x241)]});const _0x249a9d=_0x2a5af1?'Created':_0x283dae(0x356);console[_0x283dae(0x223)]('✔\x20'+_0x249a9d+_0x283dae(0x224)+_0x683b3d+'\x27');}else console[_0x283dae(0x223)](_0x283dae(0x22a)+_0x683b3d+_0x283dae(0x27c));}const _0x53e9e0=await withSpinner(_0x283dae(0x234)+_0x508846+_0x283dae(0x31c),()=>_0x5a3236[_0x283dae(0x2be)][_0x283dae(0x1f6)](_0x508846),{'verbose':_0x430126[_0x283dae(0x241)]}),_0x162794=_0x53e9e0[_0x283dae(0x275)],_0x105bc4=getConsoleUrl(_0x430126[_0x283dae(0x2bc)],'/app/workflows/'+_0x162794[_0x283dae(0x200)]+_0x283dae(0x2f6)+_0x162794[_0x283dae(0x306)]+'/attempt/'+_0x162794['workflowAttemptId']);return console[_0x283dae(0x223)]('\x0a✔\x20Workflow\x20started'),console[_0x283dae(0x223)]('\x20\x20'+a26_0x563d8d['dim'](_0x283dae(0x2c3))+'\x20'+_0x162794['audienceId']),console[_0x283dae(0x223)]('\x20\x20'+a26_0x563d8d[_0x283dae(0x2b1)](_0x283dae(0x2c6))+'\x20'+_0x162794[_0x283dae(0x290)]),console[_0x283dae(0x223)]('\x20\x20'+a26_0x563d8d[_0x283dae(0x2b1)](_0x283dae(0x265))+'\x20'+_0x162794['workflowSessionId']),console[_0x283dae(0x223)]('\x20\x20'+a26_0x563d8d[_0x283dae(0x2b1)](_0x283dae(0x346))+'\x20'+_0x162794[_0x283dae(0x1f1)]),console[_0x283dae(0x223)]('\x20\x20'+_0x105bc4),console[_0x283dae(0x223)]('\x0a'+a26_0x563d8d[_0x283dae(0x2b1)](_0x283dae(0x252))+_0x283dae(0x367)+_0x162794['workflowAttemptId']+_0x283dae(0x311)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x274);[a26_0x374bef(0x33e)]=a26_0x374bef(0x296);async[a26_0x374bef(0x2b8)](_0x4ec6d7){const _0x455dd3=a26_0x374bef,{options:_0x5b8e64,args:_0x5dbf20,tdx:_0x1b5568}=_0x4ec6d7,_0x34d929=_0x5dbf20[0x0]||_0x5b8e64[_0x455dd3(0x254)];if(!_0x34d929)return showParentSegmentNotSetError(_0x455dd3(0x27f)+_0x455dd3(0x36d)),0x1;_0x5b8e64[_0x455dd3(0x241)]&&(console[_0x455dd3(0x223)](_0x455dd3(0x33b)+_0x5b8e64[_0x455dd3(0x2bc)]),console['error'](_0x455dd3(0x344)+_0x34d929));const _0x35f9ab=await withSpinner(_0x455dd3(0x247)+_0x34d929+_0x455dd3(0x31c),()=>_0x1b5568['segment'][_0x455dd3(0x284)](_0x34d929),{'verbose':_0x5b8e64['verbose']}),_0x5def8f=_0x35f9ab[_0x455dd3(0x275)];console[_0x455dd3(0x223)](_0x455dd3(0x324)+_0x5def8f[_0x455dd3(0x2b9)]+_0x455dd3(0x29b)+(_0x5def8f['length']!==0x1?'s':''));if(_0x5b8e64[_0x455dd3(0x2de)]||_0x5b8e64[_0x455dd3(0x305)])return await handleSDKOutput(_0x5def8f,_0x5b8e64),0x0;return displayFieldsHumanReadable(_0x5def8f,_0x34d929),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x28b);[a26_0x374bef(0x33e)]=a26_0x374bef(0x2ff);async['execute'](_0x1f7975){const _0x12025f=a26_0x374bef,{options:_0x376420,args:_0x2762e0,tdx:_0x50ca37}=_0x1f7975,_0x254508=_0x376420,_0xc2264f=_0x2762e0[0x0]||_0x376420[_0x12025f(0x254)];if(!_0xc2264f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x12025f(0x354)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x376420[_0x12025f(0x241)]&&(console['error'](_0x12025f(0x33b)+_0x376420[_0x12025f(0x2bc)]),console[_0x12025f(0x223)](_0x12025f(0x344)+_0xc2264f));const _0x4450ef=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0xc2264f+'\x27...',()=>_0x50ca37[_0x12025f(0x2be)][_0x12025f(0x24c)](_0xc2264f),{'verbose':_0x376420[_0x12025f(0x241)]}),_0x18a812=_0x4450ef[_0x12025f(0x275)];if(_0x254508['web']){const _0x36b323=getConsoleNextUrl(_0x254508[_0x12025f(0x2bc)],_0x12025f(0x2ef)+_0x18a812['id']);return console[_0x12025f(0x223)](a26_0x563d8d[_0x12025f(0x35b)]('✔')+'\x20Opening\x20'+a26_0x563d8d[_0x12025f(0x36b)](_0x36b323)),openBrowser(_0x36b323),0x0;}return await handleSingleObjectOutput(_0x18a812,_0x376420),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a26_0x374bef(0x212);['description']=a26_0x374bef(0x26a);async[a26_0x374bef(0x2b8)](_0x525617){const _0x18f39d=a26_0x374bef,{options:_0x222fbf,args:_0xf7e09f,tdx:_0x3e5894}=_0x525617,_0x2ea3ce=_0x222fbf,_0x5d7d03=_0xf7e09f[0x0]||_0x222fbf[_0x18f39d(0x254)];if(!_0x5d7d03)return showParentSegmentNotSetError(_0x18f39d(0x237)+_0x18f39d(0x25f)+_0x18f39d(0x354)+_0x18f39d(0x21c)),0x1;_0x222fbf[_0x18f39d(0x241)]&&(console[_0x18f39d(0x223)](_0x18f39d(0x33b)+_0x222fbf[_0x18f39d(0x2bc)]),console[_0x18f39d(0x223)](_0x18f39d(0x344)+_0x5d7d03));const _0x24b626=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5d7d03+_0x18f39d(0x31c),()=>_0x3e5894['segment'][_0x18f39d(0x343)](_0x5d7d03),{'verbose':_0x222fbf[_0x18f39d(0x241)]}),_0x255b63=_0x24b626[_0x18f39d(0x275)],_0x588de6=_0x3e5894[_0x18f39d(0x2be)][_0x18f39d(0x2f2)](_0x255b63);if(_0x2ea3ce[_0x18f39d(0x2a8)]){const _0x40d98a=await this[_0x18f39d(0x2a4)](_0x525617,_0x5d7d03,_0x255b63,_0x588de6),_0x77f25=this[_0x18f39d(0x30c)](_0x40d98a);writeFileSync(_0x2ea3ce[_0x18f39d(0x2a8)],_0x77f25);const _0x5721c8=_0x40d98a[_0x18f39d(0x2ce)][_0x18f39d(0x2bb)][_0x18f39d(0x2b9)]+_0x40d98a['behaviors'][_0x18f39d(0x29a)]((_0xf51ff1,_0x33d0f0)=>_0xf51ff1+_0x33d0f0[_0x18f39d(0x2bb)][_0x18f39d(0x2b9)],0x0),_0x471309=_0x40d98a[_0x18f39d(0x2e2)][_0x18f39d(0x261)](_0x159744=>_0x159744['columns']['length']===0x0)['length'];return console[_0x18f39d(0x2e3)](_0x18f39d(0x31b)+_0x2ea3ce['output']),console[_0x18f39d(0x2e3)](_0x18f39d(0x2fe)+_0x588de6),console[_0x18f39d(0x2e3)](_0x18f39d(0x2a9)+_0x40d98a[_0x18f39d(0x2e2)]['length']+'\x20behaviors'),console[_0x18f39d(0x2e3)]('\x20\x20Columns:\x20'+_0x5721c8+_0x18f39d(0x32e)),_0x471309>0x0&&console['log'](_0x18f39d(0x1f5)+_0x471309+_0x18f39d(0x293)),0x0;}console[_0x18f39d(0x223)]('\x0a'+a26_0x563d8d[_0x18f39d(0x20b)]('Output\x20Database:')+'\x20'+a26_0x563d8d['cyan'](_0x588de6));const _0x289a0f=await withSpinner(_0x18f39d(0x287),()=>_0x3e5894['segment'][_0x18f39d(0x320)](_0x255b63),{'verbose':_0x222fbf[_0x18f39d(0x241)]});console[_0x18f39d(0x223)]('\x0a'+a26_0x563d8d['bold'](_0x18f39d(0x2ce))+'\x20'+a26_0x563d8d[_0x18f39d(0x2b1)]('('+_0x588de6+_0x18f39d(0x363)));const _0x1dbee1=await executeSchemaQuery(_0x289a0f[_0x18f39d(0x275)],_0x3e5894,_0x222fbf);await handleQueryOutput(_0x1dbee1,_0x222fbf);const _0x15a958=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x3e5894[_0x18f39d(0x2be)][_0x18f39d(0x24f)](_0x255b63),{'verbose':_0x222fbf[_0x18f39d(0x241)]});for(const _0xe4822 of _0x15a958[_0x18f39d(0x275)]){const _0x42dd2b=_0x18f39d(0x353)+_0xe4822[_0x18f39d(0x317)]()['replace'](/\s+/g,'_'),_0x47723c=_0x18f39d(0x278)+_0x588de6+'.'+_0x42dd2b;console[_0x18f39d(0x223)]('\x0a'+a26_0x563d8d[_0x18f39d(0x20b)](_0xe4822)+'\x20'+a26_0x563d8d['dim']('('+_0x588de6+'.'+_0x42dd2b+')'));try{const _0x302464=await executeSchemaQuery(_0x47723c,_0x3e5894,_0x222fbf);await handleQueryOutput(_0x302464,_0x222fbf);}catch{console['error'](a26_0x563d8d[_0x18f39d(0x373)](_0x18f39d(0x313)));}}return 0x0;}async[a26_0x374bef(0x2a4)](_0x6c5390,_0x157155,_0x1b54f2,_0x21f0d8){const _0x42bce9=a26_0x374bef,{options:_0x44dd6f,tdx:_0x4af607}=_0x6c5390,_0x3041b7=await withSpinner(_0x42bce9(0x287),()=>_0x4af607[_0x42bce9(0x2be)][_0x42bce9(0x320)](_0x1b54f2),{'verbose':_0x44dd6f[_0x42bce9(0x241)]}),_0x241e46=await executeSchemaQuery(_0x3041b7[_0x42bce9(0x275)],_0x4af607,_0x44dd6f),_0x1c83f1=_0x241e46[_0x42bce9(0x275)][_0x42bce9(0x244)](_0x1edfa7=>({'name':_0x1edfa7[_0x42bce9(0x218)],'type':_0x1edfa7[_0x42bce9(0x375)]})),_0x5e1190=await withSpinner(_0x42bce9(0x2df),()=>_0x4af607[_0x42bce9(0x2be)][_0x42bce9(0x24f)](_0x1b54f2),{'verbose':_0x44dd6f[_0x42bce9(0x241)]}),_0x4c300e=[];for(const _0x4b776c of _0x5e1190[_0x42bce9(0x275)]){const _0x2e43c3=_0x42bce9(0x353)+_0x4b776c['toLowerCase']()['replace'](/\s+/g,'_'),_0x5ef321='SELECT\x20*\x20FROM\x20'+_0x21f0d8+'.'+_0x2e43c3;let _0x1d4fa4=[];try{const _0xd97453=await executeSchemaQuery(_0x5ef321,_0x4af607,_0x44dd6f);_0x1d4fa4=_0xd97453['data'][_0x42bce9(0x244)](_0x37b390=>({'name':_0x37b390[_0x42bce9(0x218)],'type':_0x37b390[_0x42bce9(0x375)]}));}catch{}_0x4c300e[_0x42bce9(0x2cd)]({'table':_0x2e43c3,'columns':_0x1d4fa4});}return{'database':_0x21f0d8,'parent_segment':_0x157155,'parent_id':_0x1b54f2,'customers':{'table':'customers','columns':_0x1c83f1},'behaviors':_0x4c300e};}['formatSchemaJson'](_0x1ff89d){const _0x25688b=a26_0x374bef,_0x9747cf=_0x587570=>{const _0x49d22e=a26_0x27d8;if(_0x587570[_0x49d22e(0x2b9)]===0x0)return'[]';const _0x1293ea=_0x587570[_0x49d22e(0x244)](_0x492da5=>_0x49d22e(0x336)+_0x492da5[_0x49d22e(0x243)]+_0x49d22e(0x27d)+_0x492da5[_0x49d22e(0x339)]+_0x49d22e(0x1ed));return'[\x0a'+_0x1293ea[_0x49d22e(0x236)](',\x0a')+_0x49d22e(0x34d);},_0x3d63bc=_0x1ff89d[_0x25688b(0x2e2)][_0x25688b(0x244)](_0x2a5c60=>{const _0x47b6ef=_0x25688b;return _0x47b6ef(0x24a)+_0x2a5c60[_0x47b6ef(0x2e6)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x9747cf(_0x2a5c60['columns'])[_0x47b6ef(0x2b7)](/^/gm,'\x20\x20')['trim']()+_0x47b6ef(0x303);})[_0x25688b(0x236)](',\x0a');return _0x25688b(0x289)+_0x1ff89d[_0x25688b(0x259)]+'\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22'+_0x1ff89d[_0x25688b(0x262)]+_0x25688b(0x286)+_0x1ff89d[_0x25688b(0x2cf)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1ff89d[_0x25688b(0x2ce)][_0x25688b(0x2e6)]+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x9747cf(_0x1ff89d[_0x25688b(0x2ce)][_0x25688b(0x2bb)])[_0x25688b(0x2b7)](/^/gm,'\x20\x20')[_0x25688b(0x1eb)]()+_0x25688b(0x2bd)+_0x3d63bc+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a26_0x374bef(0x23d);[a26_0x374bef(0x33e)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a26_0x374bef(0x2b8)](_0x172c7a){const _0x25de77=a26_0x374bef,{options:_0x3b8f89,args:_0x3c604b,tdx:_0x66508c}=_0x172c7a,_0x5168a2=_0x3c604b[0x0]||_0x3b8f89[_0x25de77(0x254)];if(!_0x5168a2)return showParentSegmentNotSetError(_0x25de77(0x26c)+'\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;_0x3b8f89['verbose']&&(console[_0x25de77(0x223)](_0x25de77(0x33b)+_0x3b8f89[_0x25de77(0x2bc)]),console['error'](_0x25de77(0x344)+_0x5168a2));const _0x394bbc=await withSpinner(_0x25de77(0x358)+_0x5168a2+_0x25de77(0x31c),()=>_0x66508c[_0x25de77(0x2be)][_0x25de77(0x343)](_0x5168a2),{'verbose':_0x3b8f89[_0x25de77(0x241)]}),_0x317f96=_0x394bbc[_0x25de77(0x275)],_0x44ca20=await withSpinner(_0x25de77(0x2ea)+_0x5168a2+_0x25de77(0x31c),()=>_0x66508c[_0x25de77(0x2be)][_0x25de77(0x320)](_0x317f96),{'verbose':_0x3b8f89[_0x25de77(0x241)]}),_0x108305=_0x44ca20[_0x25de77(0x275)];return _0x3b8f89['format']==='json'||_0x3b8f89['format']===_0x25de77(0x305)?await handleSDKOutput([{'sql':_0x108305}],_0x3b8f89):console[_0x25de77(0x2e3)](_0x108305),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a26_0x374bef(0x27b);[a26_0x374bef(0x33e)]=a26_0x374bef(0x2f5);async[a26_0x374bef(0x2b8)](_0x5bdb36){const _0x5716e9=a26_0x374bef,{options:_0x3c219a,args:_0x2e6449,tdx:_0x148ac0}=_0x5bdb36,_0x431500=_0x2e6449[0x0]||_0x3c219a[_0x5716e9(0x254)];if(!_0x431500)return showParentSegmentNotSetError(_0x5716e9(0x365)+_0x5716e9(0x256)),0x1;_0x3c219a[_0x5716e9(0x241)]&&(console[_0x5716e9(0x223)]('Site:\x20'+_0x3c219a[_0x5716e9(0x2bc)]),console['error'](_0x5716e9(0x344)+_0x431500));const _0x30756a=await withSpinner(_0x5716e9(0x358)+_0x431500+_0x5716e9(0x31c),()=>_0x148ac0[_0x5716e9(0x2be)][_0x5716e9(0x343)](_0x431500),{'verbose':_0x3c219a[_0x5716e9(0x241)]}),_0x530fff=_0x30756a[_0x5716e9(0x275)],_0x19d501=await withSpinner(_0x5716e9(0x2ea)+_0x431500+'\x27...',()=>_0x148ac0[_0x5716e9(0x2be)][_0x5716e9(0x320)](_0x530fff),{'verbose':_0x3c219a['verbose']});let _0x390580=_0x19d501['data'];const _0x36aeb5=resolveLimit(_0x3c219a[_0x5716e9(0x357)],DEFAULT_DISPLAY_LIMIT),_0x3330f5=/\bLIMIT\s+\d+/i[_0x5716e9(0x2a3)](_0x390580);!_0x3330f5&&(_0x390580=_0x390580[_0x5716e9(0x1eb)]()[_0x5716e9(0x2b7)](/;+$/,''),_0x390580=_0x5716e9(0x2a5)+_0x390580+_0x5716e9(0x2a7)+_0x36aeb5);_0x3c219a['verbose']&&console['error'](_0x5716e9(0x1e7)+_0x390580);const _0x5d5cde=await withProgressSpinner(_0x5716e9(0x2cc),async _0xb89040=>{const _0x46bdb9=_0x5716e9,_0x2a9a00=await _0x148ac0[_0x46bdb9(0x355)][_0x46bdb9(0x2b8)](_0x390580,{'catalog':'td','schema':_0x46bdb9(0x2ab),'onJobId':_0x364083=>{const _0x33e3ef=_0x46bdb9;_0xb89040[_0x33e3ef(0x263)](_0x364083);}});return _0x2a9a00;},{'verbose':_0x3c219a[_0x5716e9(0x241)]}),_0x9f5c99=_0x5d5cde[_0x5716e9(0x275)],_0xf5d77e=_0x9f5c99[_0x5716e9(0x22c)]?_0x5716e9(0x364)+_0x9f5c99[_0x5716e9(0x22c)]+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x9f5c99['stats']['processedRows'][_0x5716e9(0x2b2)]()+'\x20rows\x20'+(_0x5716e9(0x257)+formatElapsed(_0x9f5c99['stats'][_0x5716e9(0x326)])+_0xf5d77e)),await handleQueryOutput(_0x9f5c99,_0x3c219a),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x30d);[a26_0x374bef(0x33e)]=a26_0x374bef(0x213);async[a26_0x374bef(0x2b8)](_0x1e2cf0){const _0x291a26=a26_0x374bef,{options:_0x2b1197,args:_0x26377e,tdx:_0x7d7b86}=_0x1e2cf0,_0x3ea00f=_0x26377e[0x0],_0x4bc91c=await withSpinner(_0x3ea00f?_0x291a26(0x25e)+_0x3ea00f+_0x291a26(0x31c):_0x291a26(0x2f8),()=>_0x7d7b86['realtime'][_0x291a26(0x33a)](),{'verbose':_0x2b1197[_0x291a26(0x241)]});let _0x2baf48=_0x4bc91c[_0x291a26(0x275)][_0x291a26(0x261)](_0xe0f5fd=>_0xe0f5fd['realtime_enabled']);if(_0x3ea00f){const _0x1acb4a=_0x3ea00f['replace'](/[.+^${}()|[\]\\]/g,_0x291a26(0x35a))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x5a869a=new RegExp('^'+_0x1acb4a+'$','i');_0x2baf48=_0x2baf48[_0x291a26(0x261)](_0x3a43ca=>_0x5a869a[_0x291a26(0x2a3)](_0x3a43ca[_0x291a26(0x243)]));}_0x2baf48[_0x291a26(0x34b)]((_0xec8195,_0xd1951e)=>_0xec8195[_0x291a26(0x243)][_0x291a26(0x246)](_0xd1951e[_0x291a26(0x243)])),console[_0x291a26(0x223)](_0x291a26(0x324)+_0x2baf48['length']+_0x291a26(0x24b)+(_0x2baf48[_0x291a26(0x2b9)]!==0x1?'s':''));const _0x417fe8=_0x3972ce=>{const _0x251548=_0x291a26;return getConsoleNextUrl(_0x2b1197['site'],_0x251548(0x2ef)+_0x3972ce);};if(_0x2b1197['format']===_0x291a26(0x2de)||_0x2b1197[_0x291a26(0x333)]===_0x291a26(0x305)){const _0xad6a51=_0x2baf48[_0x291a26(0x244)](_0x17c0e6=>({..._0x17c0e6,'url':_0x417fe8(_0x17c0e6['id'])}));await handleSDKOutput(_0xad6a51,_0x2b1197);}else{if(_0x2baf48[_0x291a26(0x2b9)]===0x0)console[_0x291a26(0x2e3)](_0x291a26(0x1ea));else for(const _0x4be3ba of _0x2baf48){const _0xc94555=_0x4be3ba[_0x291a26(0x31a)]?a26_0x563d8d[_0x291a26(0x2b1)]('\x20('+formatRows(_0x4be3ba[_0x291a26(0x31a)])+')'):'',_0x5a7ad2=hyperlink(_0x4be3ba['name'],_0x417fe8(_0x4be3ba['id']));console[_0x291a26(0x2e3)]('⚡\x20'+_0x5a7ad2+_0xc94555);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x300);[a26_0x374bef(0x33e)]='Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML';async[a26_0x374bef(0x2b8)](_0x46b9e5){const _0x2613e9=a26_0x374bef,{options:_0x450dff,args:_0x4f7414,tdx:_0x1fd297}=_0x46b9e5,_0x3a3d23=_0x4f7414[0x0]||_0x450dff['parentSegment'];if(!_0x3a3d23)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 _0x5ad6c2=resolveYamlFile(_0x3a3d23);if(!existsSync(_0x5ad6c2))return showFileNotFoundError(_0x5ad6c2,_0x3a3d23),0x1;let _0x1e306a;try{_0x1e306a=readFileSync(_0x5ad6c2,'utf-8');}catch(_0x493609){const _0xe8fbd4=_0x493609 instanceof Error?_0x493609['message']:String(_0x493609);return console['error'](_0x2613e9(0x2c8)+_0xe8fbd4),0x1;}const _0x226f8a=createCommandSpinner(a26_0x563d8d[_0x2613e9(0x2b1)]('Validating\x20RT\x20configuration...'),{'verbose':_0x450dff[_0x2613e9(0x241)]});_0x226f8a[_0x2613e9(0x2f4)]();const _0x4f1a2b={'realtime':!![],'onProgress':_0x59fcf3=>{_0x226f8a['text']=formatProgressMessage(_0x59fcf3);}};let _0x1accac;try{_0x1accac=await _0x1fd297[_0x2613e9(0x2be)][_0x2613e9(0x310)](_0x1e306a,_0x4f1a2b),_0x226f8a[_0x2613e9(0x1f2)]();}catch(_0x14d383){_0x226f8a[_0x2613e9(0x1f2)]();throw _0x14d383;}console['error']('\x0a'+a26_0x563d8d['bold'](_0x2613e9(0x20c))+'\x20'+_0x1accac['name']),console[_0x2613e9(0x223)]('═'[_0x2613e9(0x219)](0x3c)),displayRealtimeValidation(_0x1accac),console['error']('─'[_0x2613e9(0x219)](0x3c));if(_0x1accac[_0x2613e9(0x329)][_0x2613e9(0x2b9)]>0x0){console[_0x2613e9(0x223)]('\x0a'+a26_0x563d8d['red'](_0x2613e9(0x345)));for(const _0x3f5f91 of _0x1accac[_0x2613e9(0x329)]){console[_0x2613e9(0x223)]('\x20\x20'+a26_0x563d8d['red']('•')+'\x20'+_0x3f5f91);}}return _0x1accac[_0x2613e9(0x21b)]&&console[_0x2613e9(0x223)]('\x0a'+a26_0x563d8d['green']('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x1accac[_0x2613e9(0x21b)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x29f);[a26_0x374bef(0x33e)]=a26_0x374bef(0x36a);async[a26_0x374bef(0x2b8)](_0x2b98c0){const _0x47e27d=a26_0x374bef,{options:_0x310489,args:_0x3e5164,tdx:_0x1fc6e3}=_0x2b98c0,_0x1bd461=_0x3e5164[0x0]||_0x310489['parentSegment'];if(!_0x1bd461)return showParentSegmentNotSetError(_0x47e27d(0x291)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment'),0x1;const _0x17fd81=await withSpinner(_0x47e27d(0x358)+_0x1bd461+_0x47e27d(0x31c),()=>_0x1fc6e3[_0x47e27d(0x2be)][_0x47e27d(0x343)](_0x1bd461),{'verbose':_0x310489[_0x47e27d(0x241)]}),_0x389f23=_0x17fd81[_0x47e27d(0x275)],_0x57f3da=await withSpinner(_0x47e27d(0x28f)+_0x1bd461+_0x47e27d(0x31c),()=>_0x1fc6e3['personalization'][_0x47e27d(0x33a)](_0x389f23),{'verbose':_0x310489[_0x47e27d(0x241)]}),_0x16506f=_0x57f3da['data'];console[_0x47e27d(0x223)](_0x47e27d(0x324)+_0x16506f[_0x47e27d(0x2b9)]+_0x47e27d(0x34a)+(_0x16506f[_0x47e27d(0x2b9)]!==0x1?'s':''));if(_0x310489[_0x47e27d(0x333)]==='json'||_0x310489['format']===_0x47e27d(0x305))await handleSDKOutput(_0x16506f,_0x310489);else{if(_0x16506f[_0x47e27d(0x2b9)]===0x0)console[_0x47e27d(0x2e3)](_0x47e27d(0x24d)),console[_0x47e27d(0x223)](a26_0x563d8d[_0x47e27d(0x36b)](_0x47e27d(0x29d)));else for(const _0x4acd15 of _0x16506f){const _0x2102ce=_0x4acd15[_0x47e27d(0x216)]?.[_0x47e27d(0x2b9)]||0x0,_0x3c1409=_0x4acd15['trigger_event']?a26_0x563d8d[_0x47e27d(0x2b1)](_0x47e27d(0x2fa)+_0x4acd15[_0x47e27d(0x2c7)]):'',_0x27703b=a26_0x563d8d[_0x47e27d(0x2b1)]('\x20('+_0x2102ce+_0x47e27d(0x21d)+(_0x2102ce!==0x1?'s':'')+')');console[_0x47e27d(0x2e3)]('\x20\x20'+_0x4acd15['name']+_0x3c1409+_0x27703b),_0x4acd15[_0x47e27d(0x33e)]&&console[_0x47e27d(0x2e3)]('\x20\x20\x20\x20'+a26_0x563d8d[_0x47e27d(0x2b1)](_0x4acd15[_0x47e27d(0x33e)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x374bef(0x243)]=a26_0x374bef(0x33c);[a26_0x374bef(0x33e)]=a26_0x374bef(0x2ca);async['execute'](_0x5c1c41){const _0x488f26=a26_0x374bef,{options:_0xd4a11,args:_0x49a714}=_0x5c1c41,_0x16f311=_0x49a714[0x0]||_0xd4a11[_0x488f26(0x254)];if(!_0x16f311)return showParentSegmentNotSetError(_0x488f26(0x211)+_0x488f26(0x2b6)),0x1;const _0x41384f=resolveYamlFile(_0x16f311);if(!existsSync(_0x41384f))return showFileNotFoundError(_0x41384f,_0x16f311),0x1;let _0xdd8742;try{_0xdd8742=readFileSync(_0x41384f,'utf-8');}catch(_0x2451cc){const _0x56f12f=_0x2451cc instanceof Error?_0x2451cc['message']:String(_0x2451cc);return console[_0x488f26(0x223)](_0x488f26(0x2c8)+_0x56f12f),0x1;}let _0x1d2c64;try{_0x1d2c64=parseDef(_0xdd8742);}catch(_0x3a22e3){const _0x745c18=_0x3a22e3 instanceof Error?_0x3a22e3['message']:String(_0x3a22e3);return console[_0x488f26(0x223)](a26_0x563d8d['red']('Error\x20parsing\x20YAML:\x20'+_0x745c18)),0x1;}if(_0x1d2c64[_0x488f26(0x27e)]&&_0x1d2c64[_0x488f26(0x27e)][_0x488f26(0x2b9)]>0x0)return console[_0x488f26(0x223)](a26_0x563d8d[_0x488f26(0x373)](_0x488f26(0x309)+_0x41384f)),console[_0x488f26(0x223)](a26_0x563d8d[_0x488f26(0x2b1)](_0x488f26(0x2ba)+_0x1d2c64[_0x488f26(0x27e)][_0x488f26(0x2b9)]+_0x488f26(0x222))),0x1;!_0x1d2c64[_0x488f26(0x209)]&&(_0x1d2c64[_0x488f26(0x209)]={'events':[{'name':_0x488f26(0x280),'source_table':_0x488f26(0x2d0)}],'attributes':[{'name':_0x488f26(0x282),'type':_0x488f26(0x1e6)}],'id_stitching':{'primary_key':_0x1d2c64[_0x488f26(0x32f)][_0x488f26(0x2e6)]===_0x488f26(0x2ce)?_0x488f26(0x250):_0x488f26(0x2aa)}});_0x1d2c64[_0x488f26(0x27e)]=[{'name':_0x488f26(0x2ac),'description':_0x488f26(0x2cb),'trigger_event':_0x488f26(0x280),'sections':[{'name':_0x488f26(0x2ee),'criteria':'true','attributes':[_0x488f26(0x282)]}]}];const _0x2be3b1=serializeDef(_0x1d2c64);return writeFileSync(_0x41384f,_0x2be3b1,_0x488f26(0x260)),console[_0x488f26(0x223)](a26_0x563d8d[_0x488f26(0x35b)]('✔')+_0x488f26(0x267)+a26_0x563d8d['cyan'](_0x41384f)),(!_0x1d2c64[_0x488f26(0x209)]||_0xdd8742[_0x488f26(0x288)]('realtime:')===-0x1)&&console[_0x488f26(0x223)](a26_0x563d8d[_0x488f26(0x35b)]('✔')+_0x488f26(0x1fe)),console[_0x488f26(0x223)]('\x0a'+a26_0x563d8d['dim']('Next\x20steps:')),console[_0x488f26(0x223)](_0x488f26(0x36f)+_0x41384f+_0x488f26(0x2e0)),console[_0x488f26(0x223)](_0x488f26(0x2e5)+a26_0x563d8d[_0x488f26(0x2b1)](_0x488f26(0x269)+_0x16f311)+'\x20to\x20push\x20the\x20configuration'),0x0;}}
@@ -1 +1 @@
1
- const a27_0x1a9fc=a27_0x42d4;(function(_0x42d5e5,_0xf8e9a3){const _0x2b6c97=a27_0x42d4,_0x2c35d0=_0x42d5e5();while(!![]){try{const _0x4c77da=-parseInt(_0x2b6c97(0x178))/0x1*(-parseInt(_0x2b6c97(0x138))/0x2)+-parseInt(_0x2b6c97(0x13b))/0x3*(-parseInt(_0x2b6c97(0x154))/0x4)+parseInt(_0x2b6c97(0x15a))/0x5*(-parseInt(_0x2b6c97(0x153))/0x6)+-parseInt(_0x2b6c97(0x16e))/0x7*(-parseInt(_0x2b6c97(0x17d))/0x8)+parseInt(_0x2b6c97(0x12e))/0x9+parseInt(_0x2b6c97(0x17c))/0xa*(parseInt(_0x2b6c97(0x16d))/0xb)+-parseInt(_0x2b6c97(0x16b))/0xc;if(_0x4c77da===_0xf8e9a3)break;else _0x2c35d0['push'](_0x2c35d0['shift']());}catch(_0x523011){_0x2c35d0['push'](_0x2c35d0['shift']());}}}(a27_0x538f,0x39004));function a27_0x538f(){const _0xe12426=['Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','/app/mp/ak','create','6EOlZuQ','138788rfpONN','\x27\x20updated:\x20','API\x20key\x20cannot\x20be\x20empty','tdx:\x20profile\x20remove','\x20\x20(no\x20profiles\x20found)','parent_segment','1162955MTofme','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Site\x20name\x20cannot\x20be\x20empty','database','Unknown\x20key\x20\x27','customSite','\x27\x20does\x20not\x20exist.\x20Create\x20it?','includes','password','\x0aSaved\x20to:\x20','red','\x20API\x20key\x20removed\x20from\x20system\x20keychain','log','Operation\x20cancelled','tdx.json','\x20Profile\x20\x27','jobs','12343752thGbSk','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','3668467JriiTB','7OwRyVE','description','us01','yellow','profile:set','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','execute','Remove\x20a\x20profile','email','confirm','13574kEOcMK','select','Changing\x20site\x20to\x20\x27','\x27.\x0a\x0aValid\x20keys:\x20','10ZhMMQa','2298136EpsfXr','bold','profileName','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','join','green','site','session','\x20\x20tdx\x20--profile\x20','Removal\x20cancelled','message','other','config','logLevel','validate','Validating\x20API\x20key...','Enter\x20site\x20name:','Create\x20a\x20new\x20profile','ERROR','\x0aAvailable\x20profiles:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:remove','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x27\x20created','Profile\x20name\x20cannot\x20be\x20empty','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','split','profile:create','profile','dim','profile:use','\x0aSetup\x20cancelled','warn','3779199dAxqai','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','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>','name','(cleared)','llm_agent','default','Site\x20was\x20not\x20changed.','VALID_KEYS','Session\x20profile\x20set\x20to:\x20','26IddJxo','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20\x20-\x20','24eHGSuH','trim','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Failed\x20to\x20remove\x20profile:\x20','text','✗\x20Validation\x20failed:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','length','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x27\x20does\x20not\x20exist.','Profile\x20\x27','test','Enter\x20profile\x20name:','apiKey','Set\x20session\x20profile','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','getUserInfo','\x20API\x20key\x20is\x20valid\x20(User:\x20','error'];a27_0x538f=function(){return _0xe12426;};return a27_0x538f();}import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a27_0x143765 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a27_0x42d4(_0x3339af,_0xdd8d2d){_0x3339af=_0x3339af-0x12d;const _0x538f31=a27_0x538f();let _0x42d45b=_0x538f31[_0x3339af];return _0x42d45b;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0x234cb9 from'prompts';import a27_0x1adff7 from'chalk';function validateProfileName(_0x29d1ab){const _0x5be6c3=a27_0x42d4;if(!_0x29d1ab||!_0x29d1ab[_0x5be6c3(0x13c)]())return _0x5be6c3(0x197);const _0x1729b4=_0x29d1ab[_0x5be6c3(0x13c)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5be6c3(0x146)](_0x1729b4))return _0x5be6c3(0x14b);if(profileExists(_0x1729b4))return _0x5be6c3(0x145)+_0x1729b4+_0x5be6c3(0x16c);return!![];}export class ProfileCreateCommand extends BaseCommand{[a27_0x1a9fc(0x131)]=a27_0x1a9fc(0x19a);['description']=a27_0x1a9fc(0x190);async[a27_0x1a9fc(0x174)](_0x5d4e90){const _0x429347=a27_0x1a9fc,{options:_0x5a607d,args:_0x313ff4}=_0x5d4e90;console[_0x429347(0x166)](a27_0x1adff7[_0x429347(0x17e)]('tdx:\x20profile\x20create'));let _0x4c353d;if(_0x313ff4[_0x429347(0x142)]>0x0&&_0x313ff4[0x0]){const _0xb97a3=_0x313ff4[0x0][_0x429347(0x13c)](),_0x5381f3=validateProfileName(_0xb97a3);if(_0x5381f3!==!![])return console[_0x429347(0x14f)](a27_0x1adff7[_0x429347(0x164)](_0x5381f3)),0x1;_0x4c353d=_0xb97a3;}else{const _0x8dcd9d=await a27_0x234cb9({'type':_0x429347(0x13f),'name':_0x429347(0x17f),'message':_0x429347(0x147),'validate':validateProfileName});if(!_0x8dcd9d['profileName'])return console['log'](_0x429347(0x19e)),0x1;_0x4c353d=_0x8dcd9d['profileName'][_0x429347(0x13c)]();}const _0x3fc097=await a27_0x234cb9({'type':_0x429347(0x13f),'name':_0x429347(0x16f),'message':'Enter\x20description\x20(optional):'}),_0x5f4f1c=_0x3fc097[_0x429347(0x16f)]?.[_0x429347(0x13c)]()||undefined,_0x54dbde=_0x5a607d[_0x429347(0x185)]||_0x429347(0x170),{choices:_0x3f755a,initialIndex:_0x428414}=buildSiteChoices(_0x54dbde),_0x253094=await a27_0x234cb9({'type':_0x429347(0x179),'name':'site','message':_0x429347(0x180)+_0x4c353d+'\x27:','choices':_0x3f755a,'initial':_0x428414});if(!_0x253094[_0x429347(0x185)])return console[_0x429347(0x166)]('\x0aSetup\x20cancelled'),0x1;let _0x4226da;if(_0x253094[_0x429347(0x185)]===_0x429347(0x18a)){const _0x139d08=await a27_0x234cb9({'type':_0x429347(0x13f),'name':'customSite','message':_0x429347(0x18f),'initial':_0x429347(0x170),'validate':_0x3d58fc=>{const _0x4d50e7=_0x429347;if(!_0x3d58fc||!_0x3d58fc[_0x4d50e7(0x13c)]())return _0x4d50e7(0x15c);if(!/^[a-z0-9-]+$/['test'](_0x3d58fc[_0x4d50e7(0x13c)]()))return _0x4d50e7(0x181);return!![];}});if(!_0x139d08['customSite'])return console['log'](_0x429347(0x19e)),0x1;_0x4226da=_0x139d08[_0x429347(0x15f)];}else _0x4226da=_0x253094['site'];const _0x246596=resolveSite(_0x4226da);console[_0x429347(0x166)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x246596),console['log'](_0x429347(0x141)),console[_0x429347(0x166)]('\x20\x20'+getConsoleUrl(_0x246596,'/app/mp/ak'));const _0x4c9a39=await a27_0x234cb9({'type':_0x429347(0x162),'name':_0x429347(0x148),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x1544f5=>{const _0x11f4f7=_0x429347;if(!_0x1544f5||!_0x1544f5[_0x11f4f7(0x13c)]())return _0x11f4f7(0x156);return!![];}});if(!_0x4c9a39[_0x429347(0x148)])return console[_0x429347(0x166)](_0x429347(0x19e)),0x1;const _0x3e08da=_0x4c9a39['apiKey'];console['log'](_0x429347(0x18e));try{const _0x5a0c21=TDX['create']({'site':_0x246596,'apiKey':_0x3e08da[_0x429347(0x13c)](),'logLevel':_0x5a607d['logLevel']??LogLevel[_0x429347(0x191)]}),_0x58018b=await _0x5a0c21['jobs'][_0x429347(0x14d)]();console[_0x429347(0x166)](a27_0x1adff7['green']('✓')+_0x429347(0x14e)+_0x58018b[_0x429347(0x176)]+')');const _0x563939=await isKeychainAvailable();_0x563939?(await saveAPIKeyAsync(_0x3e08da['trim'](),_0x246596,_0x4c353d),console[_0x429347(0x166)](a27_0x1adff7[_0x429347(0x184)]('✓')+_0x429347(0x182)+_0x4c353d+')')):(console['warn'](a27_0x1adff7[_0x429347(0x171)](_0x429347(0x193))),console[_0x429347(0x12d)](a27_0x1adff7[_0x429347(0x171)](_0x429347(0x12f))));const _0x5d58c3={'site':_0x246596,..._0x5f4f1c&&{'description':_0x5f4f1c}};return saveProfileToUserConfig(_0x4c353d,_0x5d58c3),console[_0x429347(0x166)](a27_0x1adff7[_0x429347(0x184)]('✓')+_0x429347(0x169)+_0x4c353d+_0x429347(0x196)),console['log'](),console[_0x429347(0x166)](_0x429347(0x139)),console[_0x429347(0x166)](_0x429347(0x187)+_0x4c353d+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x429347(0x166)](_0x429347(0x187)+_0x4c353d+_0x429347(0x195)),0x0;}catch(_0x34c294){if(_0x34c294 instanceof HTTPClientError&&_0x34c294['status']===0x191)return printAuthError(_0x34c294),0x1;return console[_0x429347(0x14f)](a27_0x1adff7[_0x429347(0x164)](_0x429347(0x140)+(_0x34c294 instanceof Error?_0x34c294[_0x429347(0x189)]:String(_0x34c294)))),console[_0x429347(0x14f)](_0x429347(0x198)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x1a9fc(0x131)]=a27_0x1a9fc(0x194);[a27_0x1a9fc(0x16f)]=a27_0x1a9fc(0x175);[a27_0x1a9fc(0x18d)](_0x525c4b){const _0x46747e=a27_0x1a9fc,{args:_0xa11981}=_0x525c4b;if(_0xa11981[_0x46747e(0x142)]===0x0)return _0x46747e(0x15b);return undefined;}async[a27_0x1a9fc(0x174)](_0x10c79b){const _0x57482d=a27_0x1a9fc,{args:_0x5068b0}=_0x10c79b,_0x3b3c0b=_0x5068b0[0x0];console[_0x57482d(0x166)](a27_0x1adff7[_0x57482d(0x17e)](_0x57482d(0x157)));if(!profileExists(_0x3b3c0b)){console[_0x57482d(0x14f)](a27_0x1adff7[_0x57482d(0x164)](_0x57482d(0x145)+_0x3b3c0b+_0x57482d(0x144))),console[_0x57482d(0x166)](_0x57482d(0x192));const _0x5564ce=listProfiles();if(_0x5564ce['length']===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x14c784 of _0x5564ce){console[_0x57482d(0x166)](_0x57482d(0x13a)+_0x14c784[_0x57482d(0x131)]);}return 0x1;}const _0x449e77=await a27_0x234cb9({'type':'confirm','name':_0x57482d(0x177),'message':_0x57482d(0x143)+_0x3b3c0b+'\x27?','initial':![]});if(!_0x449e77['confirm'])return console[_0x57482d(0x166)](_0x57482d(0x188)),0x0;try{removeProfileFromUserConfig(_0x3b3c0b),console[_0x57482d(0x166)](a27_0x1adff7['green']('✓')+_0x57482d(0x169)+_0x3b3c0b+'\x27\x20removed\x20from\x20configuration');}catch(_0x31efe1){return console[_0x57482d(0x14f)](a27_0x1adff7['red'](_0x57482d(0x13e)+(_0x31efe1 instanceof Error?_0x31efe1[_0x57482d(0x189)]:String(_0x31efe1)))),0x1;}const _0x290682=await isKeychainAvailable();if(_0x290682){const _0x2c85fd=await deleteKeychainAPIKey(_0x3b3c0b);_0x2c85fd&&console[_0x57482d(0x166)](a27_0x1adff7[_0x57482d(0x184)]('✓')+_0x57482d(0x165));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x1a9fc(0x131)]=a27_0x1a9fc(0x172);['description']='Set\x20a\x20profile\x20configuration\x20value';static [a27_0x1a9fc(0x136)]=['site',a27_0x1a9fc(0x15d),a27_0x1a9fc(0x159),'llm_project',a27_0x1a9fc(0x133),a27_0x1a9fc(0x16f)];['validate'](_0x2a6f77){const _0x3453c5=a27_0x1a9fc,{args:_0x2cc7b3,options:_0x57db0a}=_0x2a6f77,_0xb30328=_0x57db0a['profile']||getActiveProfile();if(!_0xb30328)return _0x3453c5(0x130);if(_0x2cc7b3[_0x3453c5(0x142)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x3453c5(0x183)](',\x20');const _0x26e126=_0x2cc7b3[0x0];if(!_0x26e126[_0x3453c5(0x161)]('='))return _0x3453c5(0x13d)+ProfileSetCommand[_0x3453c5(0x136)][_0x3453c5(0x183)](',\x20');const [_0x24010e]=_0x26e126[_0x3453c5(0x199)]('=',0x2);if(!ProfileSetCommand[_0x3453c5(0x136)][_0x3453c5(0x161)](_0x24010e))return _0x3453c5(0x15e)+_0x24010e+_0x3453c5(0x17b)+ProfileSetCommand[_0x3453c5(0x136)]['join'](',\x20');return undefined;}async[a27_0x1a9fc(0x174)](_0x269bae){const _0x55d984=a27_0x1a9fc,{args:_0x5a2d25,options:_0x5cab5e}=_0x269bae,_0x551394=_0x5cab5e[_0x55d984(0x19b)]||getActiveProfile(),[_0x34ed82,..._0x51a786]=_0x5a2d25[0x0][_0x55d984(0x199)]('='),_0x1b2801=_0x51a786[_0x55d984(0x183)]('=');console[_0x55d984(0x166)](a27_0x1adff7[_0x55d984(0x17e)]('tdx:\x20profile\x20set'));if(!profileExists(_0x551394)){const _0x3c732b=await a27_0x234cb9({'type':_0x55d984(0x177),'name':_0x55d984(0x152),'message':_0x55d984(0x145)+_0x551394+_0x55d984(0x160),'initial':!![]});if(!_0x3c732b[_0x55d984(0x152)])return console[_0x55d984(0x166)](_0x55d984(0x167)),0x1;}const _0x408a6f=loadProfile(_0x551394),_0x7bec7f=_0x408a6f?.[_0x55d984(0x18b)]||{};if(_0x34ed82===_0x55d984(0x185)){const _0x269d13=resolveSite(_0x1b2801);console[_0x55d984(0x166)](_0x55d984(0x17a)+_0x269d13+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x55d984(0x166)](_0x55d984(0x14a)),console[_0x55d984(0x166)]('\x20\x20'+getConsoleUrl(_0x269d13,_0x55d984(0x151)));const _0x54e8f5=await a27_0x234cb9({'type':_0x55d984(0x162),'name':_0x55d984(0x148),'message':_0x55d984(0x173),'validate':_0x513398=>{const _0x3f9d67=_0x55d984;if(!_0x513398||!_0x513398[_0x3f9d67(0x13c)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x54e8f5[_0x55d984(0x148)])return console[_0x55d984(0x166)]('\x0aOperation\x20cancelled'),0x1;console[_0x55d984(0x166)](_0x55d984(0x18e));try{const _0x3cb111=TDX[_0x55d984(0x152)]({'site':_0x269d13,'apiKey':_0x54e8f5['apiKey'][_0x55d984(0x13c)](),'logLevel':_0x5cab5e[_0x55d984(0x18c)]??LogLevel[_0x55d984(0x191)]}),_0x218df9=await _0x3cb111[_0x55d984(0x16a)][_0x55d984(0x14d)]();console[_0x55d984(0x166)](a27_0x1adff7['green']('✓')+_0x55d984(0x14e)+_0x218df9['email']+')');const _0x4f8157=await isKeychainAvailable();_0x4f8157?(await saveAPIKeyAsync(_0x54e8f5[_0x55d984(0x148)][_0x55d984(0x13c)](),_0x269d13,_0x551394),console['log'](a27_0x1adff7[_0x55d984(0x184)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console['warn'](a27_0x1adff7['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x7bec7f[_0x55d984(0x185)]=_0x269d13;}catch(_0x4f6913){if(_0x4f6913 instanceof HTTPClientError&&_0x4f6913['status']===0x191)return printAuthError(_0x4f6913),0x1;return console['error'](a27_0x1adff7[_0x55d984(0x164)](_0x55d984(0x140)+(_0x4f6913 instanceof Error?_0x4f6913['message']:String(_0x4f6913)))),console[_0x55d984(0x14f)](_0x55d984(0x135)),0x1;}}else _0x7bec7f[_0x34ed82]=_0x1b2801||undefined;return saveProfileToUserConfig(_0x551394,_0x7bec7f),console['log'](a27_0x1adff7[_0x55d984(0x184)]('✓')+_0x55d984(0x169)+_0x551394+_0x55d984(0x155)+_0x34ed82+'='+(_0x1b2801||_0x55d984(0x132))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x1a9fc(0x131)]=a27_0x1a9fc(0x19d);[a27_0x1a9fc(0x16f)]=a27_0x1a9fc(0x149);[a27_0x1a9fc(0x18d)](_0x470631){const _0x36b81a=a27_0x1a9fc,{args:_0x101887}=_0x470631;if(_0x101887[_0x36b81a(0x142)]===0x0)return _0x36b81a(0x150);return undefined;}async['execute'](_0x576bba){const _0x42e012=a27_0x1a9fc,{args:_0x5bc209,options:_0x1a1013}=_0x576bba,_0x1db5a1=_0x5bc209[0x0],_0x59643f=_0x1a1013[_0x42e012(0x134)];cleanExpiredSessions();if(!profileExists(_0x1db5a1)){console[_0x42e012(0x14f)](a27_0x1adff7[_0x42e012(0x164)](_0x42e012(0x145)+_0x1db5a1+_0x42e012(0x144))),console[_0x42e012(0x166)](_0x42e012(0x192));const _0x27f12b=listProfiles();if(_0x27f12b[_0x42e012(0x142)]===0x0)console[_0x42e012(0x166)](_0x42e012(0x158));else for(const _0x3d23f0 of _0x27f12b){console[_0x42e012(0x166)]('\x20\x20-\x20'+_0x3d23f0[_0x42e012(0x131)]);}return 0x1;}if(_0x59643f){const _0x4d2969=a27_0x143765[_0x42e012(0x183)](getConfigDir(),_0x42e012(0x168));return saveActiveProfileToUserConfig(_0x1db5a1),console[_0x42e012(0x166)]('Default\x20profile\x20set\x20to:\x20'+a27_0x1adff7[_0x42e012(0x184)](_0x1db5a1)),console['log'](a27_0x1adff7[_0x42e012(0x19c)](_0x42e012(0x163)+_0x4d2969)),0x0;}const _0x408d72=getSessionID(_0x1a1013[_0x42e012(0x186)]);return saveSessionContext({'profile':_0x1db5a1},_0x1a1013[_0x42e012(0x186)]),console['log'](_0x42e012(0x137)+a27_0x1adff7[_0x42e012(0x184)](_0x1db5a1)+'\x20'+a27_0x1adff7[_0x42e012(0x19c)]('(session:\x20'+_0x408d72+')')),console[_0x42e012(0x166)](a27_0x1adff7[_0x42e012(0x19c)](_0x42e012(0x14c)+_0x1db5a1+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a27_0x58c041=a27_0x14a6;(function(_0x18741f,_0x2767b5){const _0xd478e=a27_0x14a6,_0x2253a3=_0x18741f();while(!![]){try{const _0x1f8003=-parseInt(_0xd478e(0xe7))/0x1+parseInt(_0xd478e(0x97))/0x2+parseInt(_0xd478e(0x93))/0x3+-parseInt(_0xd478e(0x96))/0x4*(-parseInt(_0xd478e(0xd7))/0x5)+-parseInt(_0xd478e(0xbb))/0x6*(-parseInt(_0xd478e(0xe9))/0x7)+parseInt(_0xd478e(0xdd))/0x8+-parseInt(_0xd478e(0xbc))/0x9*(parseInt(_0xd478e(0xb2))/0xa);if(_0x1f8003===_0x2767b5)break;else _0x2253a3['push'](_0x2253a3['shift']());}catch(_0x5345b8){_0x2253a3['push'](_0x2253a3['shift']());}}}(a27_0x3b19,0x50de3));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';function a27_0x3b19(){const _0x595a5c=['ERROR','tdx.json','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','profile:remove','dim','profileName','tdx:\x20profile\x20remove','execute','1814274mYbIKE','create','apiKey','64tsCigi','1042196HzMDHm','Enter\x20description\x20(optional):','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','test','Profile\x20\x27','description','profile:create','\x20\x20(no\x20profiles\x20found)','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Unknown\x20key\x20\x27','confirm','status','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Site\x20was\x20not\x20changed.','\x27\x20requires\x20API\x20key\x20validation.','name','session','profile','config','Set\x20a\x20profile\x20configuration\x20value','\x0aOperation\x20cancelled','email','Set\x20session\x20profile','error','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x27\x20created','13030knevEC','profile:set','\x27\x20updated:\x20','getUserInfo','bold','Operation\x20cancelled','text','length','log','6dflsiY','13347HsRlNx','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','tdx:\x20profile\x20set','Changing\x20site\x20to\x20\x27','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x0aSetup\x20cancelled','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20Profile\x20\x27','\x20--default\x27\x20to\x20save\x20permanently','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x0aAvailable\x20profiles:','warn','/app/mp/ak','Remove\x20a\x20profile','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','(cleared)','Default\x20profile\x20set\x20to:\x20','\x20\x20tdx\x20--profile\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','includes','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','other','green','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>','Profile\x20name\x20cannot\x20be\x20empty','89630Lmwdtt','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x20\x20-\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','split','parent_segment','4716960SUSshr','trim','VALID_KEYS','yellow','us01','\x27\x20removed\x20from\x20configuration','logLevel','tdx:\x20profile\x20create','API\x20key\x20cannot\x20be\x20empty','site','180025deShNn','\x27\x20does\x20not\x20exist.','3089219VgQPXf','llm_project','llm_agent','join','default','Removal\x20cancelled','\x27.\x0a\x0aValid\x20keys:\x20','password','jobs','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','red','customSite','message','Validating\x20API\x20key...'];a27_0x3b19=function(){return _0x595a5c;};return a27_0x3b19();}import*as a27_0x3e9271 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a27_0x5c21eb from'prompts';function a27_0x14a6(_0xd3e26b,_0x4db0dd){_0xd3e26b=_0xd3e26b-0x91;const _0x3b19bd=a27_0x3b19();let _0x14a672=_0x3b19bd[_0xd3e26b];return _0x14a672;}import a27_0x474615 from'chalk';function validateProfileName(_0x18bbc0){const _0x418317=a27_0x14a6;if(!_0x18bbc0||!_0x18bbc0[_0x418317(0xde)]())return _0x418317(0xd6);const _0x3d843f=_0x18bbc0[_0x418317(0xde)]();if(!/^[a-zA-Z0-9_-]+$/[_0x418317(0x9a)](_0x3d843f))return _0x418317(0xd0);if(profileExists(_0x3d843f))return _0x418317(0x9b)+_0x3d843f+_0x418317(0xcc);return!![];}export class ProfileCreateCommand extends BaseCommand{[a27_0x58c041(0xa6)]=a27_0x58c041(0x9d);[a27_0x58c041(0x9c)]='Create\x20a\x20new\x20profile';async[a27_0x58c041(0x92)](_0x2cbb6e){const _0x5b4754=a27_0x58c041,{options:_0x30f276,args:_0x8de903}=_0x2cbb6e;console[_0x5b4754(0xba)](a27_0x474615['bold'](_0x5b4754(0xe4)));let _0x4d76fb;if(_0x8de903[_0x5b4754(0xb9)]>0x0&&_0x8de903[0x0]){const _0x394bf0=_0x8de903[0x0][_0x5b4754(0xde)](),_0x4ac810=validateProfileName(_0x394bf0);if(_0x4ac810!==!![])return console[_0x5b4754(0xae)](a27_0x474615[_0x5b4754(0xf3)](_0x4ac810)),0x1;_0x4d76fb=_0x394bf0;}else{const _0x3d49b6=await a27_0x5c21eb({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x3d49b6[_0x5b4754(0xfc)])return console[_0x5b4754(0xba)](_0x5b4754(0xc2)),0x1;_0x4d76fb=_0x3d49b6[_0x5b4754(0xfc)]['trim']();}const _0x5c337b=await a27_0x5c21eb({'type':_0x5b4754(0xb8),'name':'description','message':_0x5b4754(0x98)}),_0x12ae2d=_0x5c337b['description']?.[_0x5b4754(0xde)]()||undefined,_0x5bb557=_0x30f276['site']||_0x5b4754(0xe1),{choices:_0x221a19,initialIndex:_0x162e4a}=buildSiteChoices(_0x5bb557),_0x308b5e=await a27_0x5c21eb({'type':'select','name':_0x5b4754(0xe6),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x4d76fb+'\x27:','choices':_0x221a19,'initial':_0x162e4a});if(!_0x308b5e[_0x5b4754(0xe6)])return console[_0x5b4754(0xba)]('\x0aSetup\x20cancelled'),0x1;let _0x5eca20;if(_0x308b5e[_0x5b4754(0xe6)]===_0x5b4754(0xd3)){const _0x334783=await a27_0x5c21eb({'type':_0x5b4754(0xb8),'name':_0x5b4754(0xf4),'message':'Enter\x20site\x20name:','initial':'us01','validate':_0x3c8fc7=>{const _0x12c7eb=_0x5b4754;if(!_0x3c8fc7||!_0x3c8fc7[_0x12c7eb(0xde)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x12c7eb(0x9a)](_0x3c8fc7[_0x12c7eb(0xde)]()))return _0x12c7eb(0xc1);return!![];}});if(!_0x334783['customSite'])return console[_0x5b4754(0xba)](_0x5b4754(0xc2)),0x1;_0x5eca20=_0x334783['customSite'];}else _0x5eca20=_0x308b5e[_0x5b4754(0xe6)];const _0x5c8915=resolveSite(_0x5eca20);console[_0x5b4754(0xba)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x5c8915),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x5b4754(0xba)]('\x20\x20'+getConsoleUrl(_0x5c8915,_0x5b4754(0xca)));const _0x4b65ec=await a27_0x5c21eb({'type':_0x5b4754(0xf0),'name':'apiKey','message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x19c2b2=>{const _0x1407ec=_0x5b4754;if(!_0x19c2b2||!_0x19c2b2[_0x1407ec(0xde)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x4b65ec[_0x5b4754(0x95)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x39843e=_0x4b65ec[_0x5b4754(0x95)];console[_0x5b4754(0xba)](_0x5b4754(0xf6));try{const _0x4442b8=TDX['create']({'site':_0x5c8915,'apiKey':_0x39843e[_0x5b4754(0xde)](),'logLevel':_0x30f276['logLevel']??LogLevel[_0x5b4754(0xf7)]}),_0x853f41=await _0x4442b8[_0x5b4754(0xf1)][_0x5b4754(0xb5)]();console[_0x5b4754(0xba)](a27_0x474615[_0x5b4754(0xd4)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x853f41[_0x5b4754(0xac)]+')');const _0x5059aa=await isKeychainAvailable();_0x5059aa?(await saveAPIKeyAsync(_0x39843e[_0x5b4754(0xde)](),_0x5c8915,_0x4d76fb),console[_0x5b4754(0xba)](a27_0x474615[_0x5b4754(0xd4)]('✓')+_0x5b4754(0xf2)+_0x4d76fb+')')):(console[_0x5b4754(0xc9)](a27_0x474615[_0x5b4754(0xe0)](_0x5b4754(0xbe))),console[_0x5b4754(0xc9)](a27_0x474615[_0x5b4754(0xe0)](_0x5b4754(0x99))));const _0x42ff95={'site':_0x5c8915,..._0x12ae2d&&{'description':_0x12ae2d}};return saveProfileToUserConfig(_0x4d76fb,_0x42ff95),console[_0x5b4754(0xba)](a27_0x474615[_0x5b4754(0xd4)]('✓')+'\x20Profile\x20\x27'+_0x4d76fb+_0x5b4754(0xb1)),console[_0x5b4754(0xba)](),console[_0x5b4754(0xba)](_0x5b4754(0xa3)),console[_0x5b4754(0xba)]('\x20\x20tdx\x20--profile\x20'+_0x4d76fb+_0x5b4754(0xd8)),console[_0x5b4754(0xba)](_0x5b4754(0xcf)+_0x4d76fb+_0x5b4754(0xc3)),0x0;}catch(_0x44eb63){if(_0x44eb63 instanceof HTTPClientError&&_0x44eb63[_0x5b4754(0xa2)]===0x191)return printAuthError(_0x44eb63),0x1;return console[_0x5b4754(0xae)](a27_0x474615[_0x5b4754(0xf3)]('✗\x20Validation\x20failed:\x20'+(_0x44eb63 instanceof Error?_0x44eb63['message']:String(_0x44eb63)))),console[_0x5b4754(0xae)](_0x5b4754(0xf9)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a27_0x58c041(0xa6)]=a27_0x58c041(0xfa);[a27_0x58c041(0x9c)]=a27_0x58c041(0xcb);['validate'](_0x2fab4d){const _0x5cdb72=a27_0x58c041,{args:_0x14e6ea}=_0x2fab4d;if(_0x14e6ea[_0x5cdb72(0xb9)]===0x0)return _0x5cdb72(0xaf);return undefined;}async['execute'](_0x5a6f9e){const _0x1558e9=a27_0x58c041,{args:_0x51c40d}=_0x5a6f9e,_0x27e805=_0x51c40d[0x0];console['log'](a27_0x474615[_0x1558e9(0xb6)](_0x1558e9(0x91)));if(!profileExists(_0x27e805)){console['error'](a27_0x474615[_0x1558e9(0xf3)](_0x1558e9(0x9b)+_0x27e805+_0x1558e9(0xe8))),console[_0x1558e9(0xba)](_0x1558e9(0xc8));const _0x1e2ba0=listProfiles();if(_0x1e2ba0[_0x1558e9(0xb9)]===0x0)console[_0x1558e9(0xba)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xb7a584 of _0x1e2ba0){console['log'](_0x1558e9(0xd9)+_0xb7a584[_0x1558e9(0xa6)]);}return 0x1;}const _0x22bda3=await a27_0x5c21eb({'type':_0x1558e9(0xa1),'name':_0x1558e9(0xa1),'message':_0x1558e9(0xb0)+_0x27e805+'\x27?','initial':![]});if(!_0x22bda3[_0x1558e9(0xa1)])return console[_0x1558e9(0xba)](_0x1558e9(0xee)),0x0;try{removeProfileFromUserConfig(_0x27e805),console[_0x1558e9(0xba)](a27_0x474615[_0x1558e9(0xd4)]('✓')+_0x1558e9(0xc4)+_0x27e805+_0x1558e9(0xe2));}catch(_0x4741eb){return console['error'](a27_0x474615[_0x1558e9(0xf3)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x4741eb instanceof Error?_0x4741eb[_0x1558e9(0xf5)]:String(_0x4741eb)))),0x1;}const _0x321c54=await isKeychainAvailable();if(_0x321c54){const _0x43eff1=await deleteKeychainAPIKey(_0x27e805);_0x43eff1&&console['log'](a27_0x474615[_0x1558e9(0xd4)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a27_0x58c041(0xb3);['description']=a27_0x58c041(0xaa);static [a27_0x58c041(0xdf)]=[a27_0x58c041(0xe6),'database',a27_0x58c041(0xdc),a27_0x58c041(0xea),a27_0x58c041(0xeb),a27_0x58c041(0x9c)];['validate'](_0x2d62a4){const _0x12cf61=a27_0x58c041,{args:_0x17ba10,options:_0x5dc2dc}=_0x2d62a4,_0x43cc15=_0x5dc2dc[_0x12cf61(0xa8)]||getActiveProfile();if(!_0x43cc15)return _0x12cf61(0xd5);if(_0x17ba10['length']===0x0)return _0x12cf61(0xbd)+ProfileSetCommand[_0x12cf61(0xdf)][_0x12cf61(0xec)](',\x20');const _0x299c87=_0x17ba10[0x0];if(!_0x299c87[_0x12cf61(0xd1)]('='))return _0x12cf61(0xc7)+ProfileSetCommand[_0x12cf61(0xdf)][_0x12cf61(0xec)](',\x20');const [_0x3d1d5d]=_0x299c87['split']('=',0x2);if(!ProfileSetCommand[_0x12cf61(0xdf)][_0x12cf61(0xd1)](_0x3d1d5d))return _0x12cf61(0xa0)+_0x3d1d5d+_0x12cf61(0xef)+ProfileSetCommand[_0x12cf61(0xdf)][_0x12cf61(0xec)](',\x20');return undefined;}async[a27_0x58c041(0x92)](_0x37ba1e){const _0x327516=a27_0x58c041,{args:_0x218f86,options:_0x3839a2}=_0x37ba1e,_0x1d486e=_0x3839a2['profile']||getActiveProfile(),[_0x2cfe20,..._0x1213ab]=_0x218f86[0x0][_0x327516(0xdb)]('='),_0x4dea2f=_0x1213ab['join']('=');console['log'](a27_0x474615[_0x327516(0xb6)](_0x327516(0xbf)));if(!profileExists(_0x1d486e)){const _0x52a200=await a27_0x5c21eb({'type':'confirm','name':_0x327516(0x94),'message':_0x327516(0x9b)+_0x1d486e+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x52a200[_0x327516(0x94)])return console['log'](_0x327516(0xb7)),0x1;}const _0x5572bf=loadProfile(_0x1d486e),_0x14467d=_0x5572bf?.[_0x327516(0xa9)]||{};if(_0x2cfe20===_0x327516(0xe6)){const _0x245a15=resolveSite(_0x4dea2f);console[_0x327516(0xba)](_0x327516(0xc0)+_0x245a15+_0x327516(0xa5)),console[_0x327516(0xba)](_0x327516(0xd2)),console['log']('\x20\x20'+getConsoleUrl(_0x245a15,_0x327516(0xca)));const _0x34dc72=await a27_0x5c21eb({'type':_0x327516(0xf0),'name':_0x327516(0x95),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x7f873=>{const _0x3d90d7=_0x327516;if(!_0x7f873||!_0x7f873[_0x3d90d7(0xde)]())return _0x3d90d7(0xe5);return!![];}});if(!_0x34dc72[_0x327516(0x95)])return console[_0x327516(0xba)](_0x327516(0xab)),0x1;console['log'](_0x327516(0xf6));try{const _0x24cda1=TDX[_0x327516(0x94)]({'site':_0x245a15,'apiKey':_0x34dc72[_0x327516(0x95)][_0x327516(0xde)](),'logLevel':_0x3839a2[_0x327516(0xe3)]??LogLevel[_0x327516(0xf7)]}),_0x452dfe=await _0x24cda1['jobs'][_0x327516(0xb5)]();console['log'](a27_0x474615[_0x327516(0xd4)]('✓')+_0x327516(0xda)+_0x452dfe['email']+')');const _0x57b890=await isKeychainAvailable();_0x57b890?(await saveAPIKeyAsync(_0x34dc72['apiKey'][_0x327516(0xde)](),_0x245a15,_0x1d486e),console['log'](a27_0x474615[_0x327516(0xd4)]('✓')+_0x327516(0x9f))):console['warn'](a27_0x474615[_0x327516(0xe0)](_0x327516(0xbe))),_0x14467d[_0x327516(0xe6)]=_0x245a15;}catch(_0x57f646){if(_0x57f646 instanceof HTTPClientError&&_0x57f646[_0x327516(0xa2)]===0x191)return printAuthError(_0x57f646),0x1;return console[_0x327516(0xae)](a27_0x474615[_0x327516(0xf3)]('✗\x20Validation\x20failed:\x20'+(_0x57f646 instanceof Error?_0x57f646[_0x327516(0xf5)]:String(_0x57f646)))),console[_0x327516(0xae)](_0x327516(0xa4)),0x1;}}else _0x14467d[_0x2cfe20]=_0x4dea2f||undefined;return saveProfileToUserConfig(_0x1d486e,_0x14467d),console[_0x327516(0xba)](a27_0x474615[_0x327516(0xd4)]('✓')+_0x327516(0xc4)+_0x1d486e+_0x327516(0xb4)+_0x2cfe20+'='+(_0x4dea2f||_0x327516(0xcd))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x58c041(0xa6)]='profile:use';['description']=a27_0x58c041(0xad);['validate'](_0x51ebc8){const {args:_0x5f323f}=_0x51ebc8;if(_0x5f323f['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a27_0x58c041(0x92)](_0xee1e28){const _0xe39e21=a27_0x58c041,{args:_0x35ae26,options:_0x170e7c}=_0xee1e28,_0x39079e=_0x35ae26[0x0],_0x4234cb=_0x170e7c[_0xe39e21(0xed)];cleanExpiredSessions();if(!profileExists(_0x39079e)){console['error'](a27_0x474615[_0xe39e21(0xf3)](_0xe39e21(0x9b)+_0x39079e+'\x27\x20does\x20not\x20exist.')),console[_0xe39e21(0xba)](_0xe39e21(0xc8));const _0x180bf1=listProfiles();if(_0x180bf1[_0xe39e21(0xb9)]===0x0)console[_0xe39e21(0xba)](_0xe39e21(0x9e));else for(const _0x36b88c of _0x180bf1){console[_0xe39e21(0xba)]('\x20\x20-\x20'+_0x36b88c['name']);}return 0x1;}if(_0x4234cb){const _0x577a69=a27_0x3e9271[_0xe39e21(0xec)](getConfigDir(),_0xe39e21(0xf8));return saveActiveProfileToUserConfig(_0x39079e),console[_0xe39e21(0xba)](_0xe39e21(0xce)+a27_0x474615['green'](_0x39079e)),console[_0xe39e21(0xba)](a27_0x474615[_0xe39e21(0xfb)]('\x0aSaved\x20to:\x20'+_0x577a69)),0x0;}const _0x4bab80=getSessionID(_0x170e7c[_0xe39e21(0xa7)]);return saveSessionContext({'profile':_0x39079e},_0x170e7c['session']),console[_0xe39e21(0xba)]('Session\x20profile\x20set\x20to:\x20'+a27_0x474615[_0xe39e21(0xd4)](_0x39079e)+'\x20'+a27_0x474615[_0xe39e21(0xfb)]('(session:\x20'+_0x4bab80+')')),console['log'](a27_0x474615[_0xe39e21(0xfb)](_0xe39e21(0xc6)+_0x39079e+_0xe39e21(0xc5))),0x0;}}
@@ -1 +1 @@
1
- const a28_0x3cd73a=a28_0x5073;(function(_0x5baf24,_0x511f06){const _0x4bec50=a28_0x5073,_0x5470e2=_0x5baf24();while(!![]){try{const _0xb7f881=-parseInt(_0x4bec50(0x1f6))/0x1+-parseInt(_0x4bec50(0x1fc))/0x2+-parseInt(_0x4bec50(0x1f3))/0x3*(-parseInt(_0x4bec50(0x1f4))/0x4)+-parseInt(_0x4bec50(0x1f5))/0x5+parseInt(_0x4bec50(0x1fa))/0x6+-parseInt(_0x4bec50(0x1fd))/0x7*(parseInt(_0x4bec50(0x200))/0x8)+parseInt(_0x4bec50(0x1f9))/0x9;if(_0xb7f881===_0x511f06)break;else _0x5470e2['push'](_0x5470e2['shift']());}catch(_0x2382c8){_0x5470e2['push'](_0x5470e2['shift']());}}}(a28_0x2fa0,0x923cc));function a28_0x2fa0(){const _0x1e5310=['config','2386772pwBSqM','2114bpKUSY','profiles','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','28664TpBJMd','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','List\x20all\x20available\x20profiles','scope','map','log','execute','255666vribNH','16gazyPv','2612170WpLwro','943847IFluTc','Error:\x20','name','30927204IMyHan','3380862JhjakH'];a28_0x2fa0=function(){return _0x1e5310;};return a28_0x2fa0();}function a28_0x5073(_0x3f40de,_0x549027){_0x3f40de=_0x3f40de-0x1ee;const _0x2fa071=a28_0x2fa0();let _0x5073e4=_0x2fa071[_0x3f40de];return _0x5073e4;}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{[a28_0x3cd73a(0x1f8)]=a28_0x3cd73a(0x1fe);[a28_0x3cd73a(0x202)]=a28_0x3cd73a(0x1ee);async[a28_0x3cd73a(0x1f2)](_0x47e020){const _0xb0fb60=a28_0x3cd73a,{options:_0x4f66ae}=_0x47e020;try{const _0x438f1b=listProfiles(),_0x456721=getActiveProfile();if(_0x438f1b['length']===0x0)return console[_0xb0fb60(0x1f1)](_0xb0fb60(0x201)),console['log'](_0xb0fb60(0x1ff)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x47b3ea=_0x438f1b[_0xb0fb60(0x1f0)](_0x877be4=>{const _0x5e3e7e=_0xb0fb60,_0x61184f=_0x877be4[_0x5e3e7e(0x1f8)]===_0x456721,_0x200e7b=getProfileParams(_0x877be4[_0x5e3e7e(0x1fb)]);return{'name':_0x877be4[_0x5e3e7e(0x1f8)],'active':_0x61184f,'scope':_0x877be4[_0x5e3e7e(0x1ef)],'description':_0x877be4['config'][_0x5e3e7e(0x202)]||'','params':_0x200e7b};});return await handleSDKOutput(_0x47b3ea,_0x4f66ae),0x0;}catch(_0x10c1b8){return _0x10c1b8 instanceof Error&&console['error'](_0xb0fb60(0x1f7)+_0x10c1b8['message']),0x1;}}}
1
+ function a28_0xf861(_0x3331a2,_0x2506e1){_0x3331a2=_0x3331a2-0xa9;const _0x35ae5a=a28_0x35ae();let _0xf861b7=_0x35ae5a[_0x3331a2];return _0xf861b7;}const a28_0x3ce1f3=a28_0xf861;(function(_0x92b508,_0x52d301){const _0x47d9dc=a28_0xf861,_0x54d00c=_0x92b508();while(!![]){try{const _0x52e33e=parseInt(_0x47d9dc(0xb4))/0x1*(parseInt(_0x47d9dc(0xa9))/0x2)+-parseInt(_0x47d9dc(0xb7))/0x3+parseInt(_0x47d9dc(0xaf))/0x4+parseInt(_0x47d9dc(0xb0))/0x5+-parseInt(_0x47d9dc(0xab))/0x6*(-parseInt(_0x47d9dc(0xb8))/0x7)+-parseInt(_0x47d9dc(0xb2))/0x8*(parseInt(_0x47d9dc(0xaa))/0x9)+-parseInt(_0x47d9dc(0xac))/0xa*(parseInt(_0x47d9dc(0xba))/0xb);if(_0x52e33e===_0x52d301)break;else _0x54d00c['push'](_0x54d00c['shift']());}catch(_0x5ba092){_0x54d00c['push'](_0x54d00c['shift']());}}}(a28_0x35ae,0xad9de));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a28_0x35ae(){const _0x5b5b81=['20CkoRWc','\x20\x20Global:\x20~/.config/tdx/tdx.json','log','2695532hKfJHp','2252360figDfs','description','104TQKdss','name','1168332CrjtRg','map','profiles','1722591qTTczS','9486337ixHAPN','config','6775582YvsgXS','length','scope','2fvDIfM','782739sdQwKw','6kXWsPK'];a28_0x35ae=function(){return _0x5b5b81;};return a28_0x35ae();}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x3ce1f3(0xb3)]=a28_0x3ce1f3(0xb6);[a28_0x3ce1f3(0xb1)]='List\x20all\x20available\x20profiles';async['execute'](_0xcb0960){const _0x5545d0=a28_0x3ce1f3,{options:_0x545261}=_0xcb0960;try{const _0x2d4de8=listProfiles(),_0x5b5813=getActiveProfile();if(_0x2d4de8[_0x5545d0(0xbb)]===0x0)return console[_0x5545d0(0xae)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x5545d0(0xae)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console['log'](_0x5545d0(0xad)),0x0;const _0x2f2919=_0x2d4de8[_0x5545d0(0xb5)](_0x4cd460=>{const _0x49b372=_0x5545d0,_0x3a8a51=_0x4cd460[_0x49b372(0xb3)]===_0x5b5813,_0x426f61=getProfileParams(_0x4cd460[_0x49b372(0xb9)]);return{'name':_0x4cd460['name'],'active':_0x3a8a51,'scope':_0x4cd460[_0x49b372(0xbc)],'description':_0x4cd460[_0x49b372(0xb9)]['description']||'','params':_0x426f61};});return await handleSDKOutput(_0x2f2919,_0x545261),0x0;}catch(_0x7b683d){return _0x7b683d instanceof Error&&console['error']('Error:\x20'+_0x7b683d['message']),0x1;}}}
@@ -1 +1 @@
1
- const a29_0x1b2b6a=a29_0x2907;(function(_0x11d419,_0x4a9dd1){const _0x560532=a29_0x2907,_0x2ec3fd=_0x11d419();while(!![]){try{const _0x37492c=parseInt(_0x560532(0x1cf))/0x1+parseInt(_0x560532(0x1a2))/0x2+parseInt(_0x560532(0x1a1))/0x3*(parseInt(_0x560532(0x1aa))/0x4)+parseInt(_0x560532(0x1cb))/0x5*(-parseInt(_0x560532(0x1b3))/0x6)+parseInt(_0x560532(0x1ce))/0x7+parseInt(_0x560532(0x1b1))/0x8*(-parseInt(_0x560532(0x1a0))/0x9)+-parseInt(_0x560532(0x1c6))/0xa*(parseInt(_0x560532(0x1c5))/0xb);if(_0x37492c===_0x4a9dd1)break;else _0x2ec3fd['push'](_0x2ec3fd['shift']());}catch(_0x1d6923){_0x2ec3fd['push'](_0x2ec3fd['shift']());}}}(a29_0xd2c0,0xc1499));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a29_0xd2c0(){const _0xda2a72=['setJobId','originalMessage','57816TJKERT','jobId','18LyxsNr','No\x20SQL\x20provided','output','SQL:\x20','message','Site:\x20','Catalog:\x20','\x20rows\x20','\x20[Job\x20ID:\x20','in\x20','elapsedTimeMillis','Query\x20completed:\x20Processed\x20','Error:\x20','args','Statement\x20','query','verbose','setPhase','549626uXNWeQ','30dfHxqQ','site','execute','...','information_schema','1234015DJhoeS','state','Executing\x20query\x20[','5168163qcZkKi','1367830qwBauE','data','Executing\x20statement\x20','stats','1818egKVFG','1611222uZVUyL','997306nsEiEF','setExtra','join','options','length','error','totalSplits','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','4QpCdxS','Schema:\x20','file','\x20splits','name'];a29_0xd2c0=function(){return _0xda2a72;};return a29_0xd2c0();}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a29_0x2907(_0x5d8321,_0x26764e){_0x5d8321=_0x5d8321-0x1a0;const _0xd2c060=a29_0xd2c0();let _0x290781=_0xd2c060[_0x5d8321];return _0x290781;}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a29_0x1b2b6a(0x1ae)]=a29_0x1b2b6a(0x1c2);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a29_0x1b2b6a(0x1c8)](_0x3c5d56){const _0x5ce625=a29_0x1b2b6a,{options:_0x5413eb,args:_0x647bc2,tdx:_0x4a057f}=_0x3c5d56,_0x2ff915=_0x647bc2[0x0],_0x14b852=_0x5413eb[_0x5ce625(0x1ac)];let _0x864ef1;try{if(_0x14b852)_0x864ef1=readSqlStatementsFromFile(_0x14b852);else{if(_0x2ff915==='-')_0x864ef1=await readSqlStatementsFromStdin();else{if(_0x2ff915&&isSqlFilePath(_0x2ff915))_0x864ef1=readSqlStatementsFromFile(_0x2ff915);else{if(_0x2ff915)_0x864ef1=splitSqlStatements(_0x2ff915);else throw new Error(_0x5ce625(0x1b4));}}}}catch(_0x1da554){return console[_0x5ce625(0x1a7)](_0x5ce625(0x1bf)+_0x1da554[_0x5ce625(0x1b7)]),0x1;}const _0x182775=_0x5413eb['database']||_0x5ce625(0x1ca),_0x537439=_0x5413eb['catalog'];try{const _0xe62960=[],_0x329516=!!_0x5413eb[_0x5ce625(0x1b5)];for(let _0x21c727=0x0;_0x21c727<_0x864ef1[_0x5ce625(0x1a6)];_0x21c727++){const _0x1246ae=_0x864ef1[_0x21c727],_0x1e530e=_0x21c727+0x1,_0x1bbf0b=_0x864ef1[_0x5ce625(0x1a6)],_0x45be67=_0x1bbf0b>0x1;_0x5413eb[_0x5ce625(0x1c3)]&&(console[_0x5ce625(0x1a7)]('\x0a'+(_0x45be67?_0x5ce625(0x1c1)+_0x1e530e+'/'+_0x1bbf0b+':':'')),console[_0x5ce625(0x1a7)](_0x5ce625(0x1b8)+_0x5413eb[_0x5ce625(0x1c7)]),console[_0x5ce625(0x1a7)](_0x5ce625(0x1b9)+(_0x537439||'td')),console['error'](_0x5ce625(0x1ab)+_0x182775),console[_0x5ce625(0x1a7)](_0x5ce625(0x1b6)+_0x1246ae));const _0x173852=_0x45be67?_0x5ce625(0x1d1)+_0x1e530e+'/'+_0x1bbf0b+_0x5ce625(0x1c9):'Executing\x20query...';try{const _0x4cfb44=await withProgressSpinner(_0x173852,async _0x3f06ef=>{const _0x268d11=_0x5ce625,_0x137940=await _0x4a057f[_0x268d11(0x1c2)][_0x268d11(0x1c8)](_0x1246ae,{'catalog':_0x537439,'schema':_0x182775,'onJobId':_0x5abaca=>{const _0x592d17=_0x268d11;_0x3f06ef[_0x592d17(0x1af)](_0x5abaca);},'onProgress':_0x588b73=>{const _0x4e66ce=_0x268d11;_0x3f06ef[_0x4e66ce(0x1c4)](_0x4e66ce(0x1cd)+_0x588b73[_0x4e66ce(0x1cc)]+']'),_0x3f06ef[_0x4e66ce(0x1a3)](formatRows(_0x588b73['processedRows'])+'\x20rows\x20'+_0x588b73['completedSplits']+'/'+_0x588b73[_0x4e66ce(0x1a8)]+_0x4e66ce(0x1ad));}});return _0x137940;},{'verbose':_0x5413eb['verbose']}),_0x58ee05=_0x4cfb44[_0x5ce625(0x1d0)],_0x2ff845=_0x58ee05[_0x5ce625(0x1b2)]?_0x5ce625(0x1bb)+_0x58ee05[_0x5ce625(0x1b2)]+']':'',_0x675db=_0x45be67?_0x5ce625(0x1c1)+_0x1e530e+'/'+_0x1bbf0b+'\x20-\x20':'';console[_0x5ce625(0x1a7)]('✔\x20'+_0x675db+_0x5ce625(0x1be)+formatRows(_0x58ee05[_0x5ce625(0x1d2)]['processedRows'])+_0x5ce625(0x1ba)+(_0x5ce625(0x1bc)+formatElapsed(_0x58ee05[_0x5ce625(0x1d2)][_0x5ce625(0x1bd)])+_0x2ff845));if(_0x45be67&&_0x329516){const _0x397833=resolveOutputOptions(_0x5413eb),_0x231c81=await formatQueryOutput(_0x58ee05,_0x397833);_0xe62960['push'](_0x231c81);}else await handleQueryOutput(_0x58ee05,_0x5413eb);}catch(_0x30d736){const _0x50bb94=_0x45be67?_0x5ce625(0x1c1)+_0x1e530e+'/'+_0x1bbf0b+':\x0a':'',_0x259474=_0x30d736 instanceof SDKError?_0x30d736[_0x5ce625(0x1b0)]:_0x30d736[_0x5ce625(0x1b7)];return console[_0x5ce625(0x1a7)](''+_0x50bb94+_0x259474),0x1;}}if(_0x864ef1[_0x5ce625(0x1a6)]>0x1&&_0x329516&&_0xe62960['length']>0x0){const _0x5a6a34=_0xe62960[_0x5ce625(0x1a4)]('\x0a');writeFileSync(_0x5413eb[_0x5ce625(0x1b5)],_0x5a6a34),console[_0x5ce625(0x1a7)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x5413eb[_0x5ce625(0x1b5)]);}return 0x0;}catch(_0x2f3da1){throw _0x2f3da1;}}['validate'](_0x5988cb){const _0x557c50=a29_0x1b2b6a,_0x1869c7=_0x5988cb[_0x557c50(0x1c0)][0x0],_0x27dc18=_0x5988cb[_0x557c50(0x1a5)]['file'];if(!_0x1869c7&&!_0x27dc18)return _0x557c50(0x1a9);if(_0x1869c7&&_0x27dc18)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a29_0x469e99=a29_0x2777;(function(_0x101de2,_0x5c53c0){const _0x32fbb0=a29_0x2777,_0x40cd0f=_0x101de2();while(!![]){try{const _0x21b979=parseInt(_0x32fbb0(0x1d4))/0x1+parseInt(_0x32fbb0(0x1db))/0x2*(parseInt(_0x32fbb0(0x1c6))/0x3)+parseInt(_0x32fbb0(0x1ed))/0x4+-parseInt(_0x32fbb0(0x1d3))/0x5*(parseInt(_0x32fbb0(0x1ca))/0x6)+-parseInt(_0x32fbb0(0x1be))/0x7+-parseInt(_0x32fbb0(0x1d6))/0x8*(-parseInt(_0x32fbb0(0x1d2))/0x9)+-parseInt(_0x32fbb0(0x1d0))/0xa*(parseInt(_0x32fbb0(0x1e7))/0xb);if(_0x21b979===_0x5c53c0)break;else _0x40cd0f['push'](_0x40cd0f['shift']());}catch(_0x3910b4){_0x40cd0f['push'](_0x40cd0f['shift']());}}}(a29_0x2d5b,0xac27d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a29_0x2d5b(){const _0x217e6f=['catalog','Executing\x20query...','\x20[Job\x20ID:\x20','output','verbose','Executing\x20query\x20[','302665ahkTmo','Schema:\x20','setPhase','query','file','Error:\x20','5042296BhSkGS','in\x20','database','name','\x0aAll\x20results\x20saved\x20to\x20','807968PwUryZ','data','validate','\x20rows\x20','Query\x20completed:\x20Processed\x20','state','elapsedTimeMillis','execute','3WXiDzk','join','message','processedRows','2238WxWYqH','setExtra','length','error','site','stats','380dBNsZe','totalSplits','1134FOguGs','10135dxaSqX','646706WUyXnn','Statement\x20','12440xlKECf','Run\x20Trino\x20queries\x20(streaming)','\x20-\x20','Site:\x20','args','1038008ObMfnP','jobId','information_schema','push','...','setJobId'];a29_0x2d5b=function(){return _0x217e6f;};return a29_0x2d5b();}function a29_0x2777(_0x4c9157,_0x37ffe9){_0x4c9157=_0x4c9157-0x1be;const _0x2d5b53=a29_0x2d5b();let _0x2777a5=_0x2d5b53[_0x4c9157];return _0x2777a5;}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{[a29_0x469e99(0x1f0)]=a29_0x469e99(0x1ea);['description']=a29_0x469e99(0x1d7);async['execute'](_0x4cf841){const _0x2e222=a29_0x469e99,{options:_0x4d96f1,args:_0x1165fd,tdx:_0x4f3269}=_0x4cf841,_0x3997b3=_0x1165fd[0x0],_0x59eebd=_0x4d96f1[_0x2e222(0x1eb)];let _0x4e0a16;try{if(_0x59eebd)_0x4e0a16=readSqlStatementsFromFile(_0x59eebd);else{if(_0x3997b3==='-')_0x4e0a16=await readSqlStatementsFromStdin();else{if(_0x3997b3&&isSqlFilePath(_0x3997b3))_0x4e0a16=readSqlStatementsFromFile(_0x3997b3);else{if(_0x3997b3)_0x4e0a16=splitSqlStatements(_0x3997b3);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x5f24bc){return console['error'](_0x2e222(0x1ec)+_0x5f24bc[_0x2e222(0x1c8)]),0x1;}const _0x5df41f=_0x4d96f1[_0x2e222(0x1ef)]||_0x2e222(0x1dd),_0x3783fe=_0x4d96f1[_0x2e222(0x1e1)];try{const _0x23d964=[],_0x4de19c=!!_0x4d96f1[_0x2e222(0x1e4)];for(let _0x38a900=0x0;_0x38a900<_0x4e0a16[_0x2e222(0x1cc)];_0x38a900++){const _0x207bee=_0x4e0a16[_0x38a900],_0xd5cc03=_0x38a900+0x1,_0x310fc5=_0x4e0a16[_0x2e222(0x1cc)],_0x321dd2=_0x310fc5>0x1;_0x4d96f1['verbose']&&(console[_0x2e222(0x1cd)]('\x0a'+(_0x321dd2?'Statement\x20'+_0xd5cc03+'/'+_0x310fc5+':':'')),console[_0x2e222(0x1cd)](_0x2e222(0x1d9)+_0x4d96f1[_0x2e222(0x1ce)]),console[_0x2e222(0x1cd)]('Catalog:\x20'+(_0x3783fe||'td')),console[_0x2e222(0x1cd)](_0x2e222(0x1e8)+_0x5df41f),console[_0x2e222(0x1cd)]('SQL:\x20'+_0x207bee));const _0x5b5e8d=_0x321dd2?'Executing\x20statement\x20'+_0xd5cc03+'/'+_0x310fc5+_0x2e222(0x1df):_0x2e222(0x1e2);try{const _0x27d520=await withProgressSpinner(_0x5b5e8d,async _0x8b0d92=>{const _0x7ecf3d=_0x2e222,_0x1ac931=await _0x4f3269[_0x7ecf3d(0x1ea)][_0x7ecf3d(0x1c5)](_0x207bee,{'catalog':_0x3783fe,'schema':_0x5df41f,'onJobId':_0x3d8f83=>{const _0x45bb11=_0x7ecf3d;_0x8b0d92[_0x45bb11(0x1e0)](_0x3d8f83);},'onProgress':_0x5da9d7=>{const _0x17110a=_0x7ecf3d;_0x8b0d92[_0x17110a(0x1e9)](_0x17110a(0x1e6)+_0x5da9d7[_0x17110a(0x1c3)]+']'),_0x8b0d92[_0x17110a(0x1cb)](formatRows(_0x5da9d7[_0x17110a(0x1c9)])+_0x17110a(0x1c1)+_0x5da9d7['completedSplits']+'/'+_0x5da9d7[_0x17110a(0x1d1)]+'\x20splits');}});return _0x1ac931;},{'verbose':_0x4d96f1[_0x2e222(0x1e5)]}),_0x4d8e81=_0x27d520[_0x2e222(0x1bf)],_0x61fcd1=_0x4d8e81[_0x2e222(0x1dc)]?_0x2e222(0x1e3)+_0x4d8e81[_0x2e222(0x1dc)]+']':'',_0x1d4992=_0x321dd2?_0x2e222(0x1d5)+_0xd5cc03+'/'+_0x310fc5+_0x2e222(0x1d8):'';console['error']('✔\x20'+_0x1d4992+_0x2e222(0x1c2)+formatRows(_0x4d8e81[_0x2e222(0x1cf)]['processedRows'])+_0x2e222(0x1c1)+(_0x2e222(0x1ee)+formatElapsed(_0x4d8e81['stats'][_0x2e222(0x1c4)])+_0x61fcd1));if(_0x321dd2&&_0x4de19c){const _0x477051=resolveOutputOptions(_0x4d96f1),_0xa4a036=await formatQueryOutput(_0x4d8e81,_0x477051);_0x23d964[_0x2e222(0x1de)](_0xa4a036);}else await handleQueryOutput(_0x4d8e81,_0x4d96f1);}catch(_0x3ba94f){const _0x375f3f=_0x321dd2?_0x2e222(0x1d5)+_0xd5cc03+'/'+_0x310fc5+':\x0a':'',_0xce12bf=_0x3ba94f instanceof SDKError?_0x3ba94f['originalMessage']:_0x3ba94f[_0x2e222(0x1c8)];return console[_0x2e222(0x1cd)](''+_0x375f3f+_0xce12bf),0x1;}}if(_0x4e0a16['length']>0x1&&_0x4de19c&&_0x23d964[_0x2e222(0x1cc)]>0x0){const _0x3d92fa=_0x23d964[_0x2e222(0x1c7)]('\x0a');writeFileSync(_0x4d96f1[_0x2e222(0x1e4)],_0x3d92fa),console['error'](_0x2e222(0x1f1)+_0x4d96f1[_0x2e222(0x1e4)]);}return 0x0;}catch(_0x4a9ec3){throw _0x4a9ec3;}}[a29_0x469e99(0x1c0)](_0x5ede4a){const _0xea35f9=a29_0x469e99,_0x2fbeaf=_0x5ede4a[_0xea35f9(0x1da)][0x0],_0x39b210=_0x5ede4a['options'][_0xea35f9(0x1eb)];if(!_0x2fbeaf&&!_0x39b210)return'Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options';if(_0x2fbeaf&&_0x39b210)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}