@treasuredata/tdx 0.28.3 → 0.28.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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_0x5e5c22=a26_0x147c;(function(_0x1ccd3e,_0x4439bd){const _0x5a0aaf=a26_0x147c,_0x3492c1=_0x1ccd3e();while(!![]){try{const _0x5c2fe8=-parseInt(_0x5a0aaf(0x1c0))/0x1+parseInt(_0x5a0aaf(0x250))/0x2+-parseInt(_0x5a0aaf(0x1c1))/0x3*(-parseInt(_0x5a0aaf(0x22c))/0x4)+parseInt(_0x5a0aaf(0x172))/0x5*(parseInt(_0x5a0aaf(0x298))/0x6)+-parseInt(_0x5a0aaf(0x17f))/0x7+-parseInt(_0x5a0aaf(0x1e3))/0x8+parseInt(_0x5a0aaf(0x24d))/0x9;if(_0x5c2fe8===_0x4439bd)break;else _0x3492c1['push'](_0x3492c1['shift']());}catch(_0x39c24a){_0x3492c1['push'](_0x3492c1['shift']());}}}(a26_0x7739,0x48b7f));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a26_0x128ffd 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_0x49e31e 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_0x5e5c22(0x17e),LEGACY_PARENT_SEGMENT_DIR=a26_0x5e5c22(0x28f);function openBrowser(_0x4a3333){const _0x33b1bf=a26_0x5e5c22,_0x19a6fb=process[_0x33b1bf(0x27a)],_0x47fb0e=_0x19a6fb==='darwin'?_0x33b1bf(0x21d):_0x19a6fb===_0x33b1bf(0x19f)?'start':'xdg-open';spawn(_0x47fb0e,[_0x4a3333],{'detached':!![],'stdio':_0x33b1bf(0x1c2)})['unref']();}function migrateLegacyDirectory(){const _0x42b07d=a26_0x5e5c22;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1b4c25=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1b4c25[_0x42b07d(0x143)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x42b07d(0x15c)](a26_0x49e31e['yellow'](_0x42b07d(0x27f)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x42b07d(0x1bf))),console['error'](a26_0x49e31e[_0x42b07d(0x25f)](_0x42b07d(0x14e)+LEGACY_PARENT_SEGMENT_DIR+_0x42b07d(0x1c9))),![];console[_0x42b07d(0x15c)](a26_0x49e31e['yellow'](_0x42b07d(0x1b9)+LEGACY_PARENT_SEGMENT_DIR+_0x42b07d(0x267)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x42b07d(0x15c)](a26_0x49e31e[_0x42b07d(0x256)](_0x42b07d(0x150)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4975c9){const _0x1e83f3=_0x4975c9 instanceof Error?_0x4975c9['message']:String(_0x4975c9);return console['error'](a26_0x49e31e['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x1e83f3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a26_0x5e5c22(0x1f8)](_0x498a27){return migrateLegacyDirectory(),super['run'](_0x498a27);}}function resolveYamlFile(_0x2209d3){const _0x51ae18=a26_0x5e5c22;if(_0x2209d3['endsWith'](_0x51ae18(0x14b))||_0x2209d3['endsWith']('.yaml'))return _0x2209d3;return a26_0x128ffd['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2209d3)+_0x51ae18(0x14b));}function formatProgressMessage(_0x451529){const _0x41901f=a26_0x5e5c22,_0x7c8917=_0x451529[_0x41901f(0x1e2)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x7c8917){const [,_0x51e238,_0x57f332,_0x176722='']=_0x7c8917;return a26_0x49e31e[_0x41901f(0x25f)](_0x51e238+':')+'\x20'+_0x57f332+a26_0x49e31e[_0x41901f(0x25f)](_0x176722);}return a26_0x49e31e['dim'](_0x451529);}function showFileNotFoundError(_0x63ee31,_0x5121c2){const _0x4ef40f=a26_0x5e5c22;console[_0x4ef40f(0x15c)](a26_0x49e31e[_0x4ef40f(0x1f7)](_0x4ef40f(0x1b7)+_0x63ee31+'\x0a')),console['error'](a26_0x49e31e[_0x4ef40f(0x29a)](_0x4ef40f(0x22e)+_0x5121c2+_0x4ef40f(0x284)));}function displayRealtimeValidation(_0x587582){const _0x98d671=a26_0x5e5c22;if(!_0x587582['realtime'])return;const _0x51a452=_0x587582[_0x98d671(0x169)],_0x4506a2=_0x51a452[_0x98d671(0x1ed)]?a26_0x49e31e[_0x98d671(0x256)](_0x98d671(0x240)):a26_0x49e31e['yellow'](_0x98d671(0x269));console['error']('\x0a'+a26_0x49e31e['dim'](_0x98d671(0x28c))+'\x20'+_0x4506a2);if(_0x51a452[_0x98d671(0x17c)]&&_0x51a452[_0x98d671(0x17c)][_0x98d671(0x25b)]>0x0){console[_0x98d671(0x15c)]('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)]('Events:')+'\x20'+_0x51a452[_0x98d671(0x17c)][_0x98d671(0x25b)]+_0x98d671(0x1da));for(const _0x437ec4 of _0x51a452[_0x98d671(0x17c)]){const _0x58e8c8=_0x437ec4[_0x98d671(0x272)]===![]?a26_0x49e31e[_0x98d671(0x1f7)]('✘'):a26_0x49e31e[_0x98d671(0x256)]('✔');console[_0x98d671(0x15c)]('\x20\x20\x20\x20'+_0x58e8c8+'\x20'+_0x437ec4['name']),_0x437ec4[_0x98d671(0x255)]&&console['error'](_0x98d671(0x18e)+a26_0x49e31e[_0x98d671(0x1f7)](_0x437ec4[_0x98d671(0x255)]));}}if(_0x51a452[_0x98d671(0x285)]&&_0x51a452['attributes']['length']>0x0){console[_0x98d671(0x15c)]('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)]('Attributes:')+'\x20'+_0x51a452['attributes']['length']+_0x98d671(0x1da));for(const _0x450e28 of _0x51a452['attributes']){const _0x479850=_0x450e28[_0x98d671(0x266)]?a26_0x49e31e[_0x98d671(0x256)]('✔'):a26_0x49e31e[_0x98d671(0x1f7)]('✘');console[_0x98d671(0x15c)]('\x20\x20\x20\x20'+_0x479850+'\x20'+_0x450e28['name']+'\x20'+a26_0x49e31e[_0x98d671(0x25f)]('('+_0x450e28[_0x98d671(0x186)]+')'));}}if(_0x51a452['idStitching']){const _0x251c58=_0x51a452['idStitching'][_0x98d671(0x219)]?.['length']?_0x98d671(0x1ec)+_0x51a452[_0x98d671(0x271)]['stitchingKeys'][_0x98d671(0x1e9)](',\x20')+']':'';console['error']('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)](_0x98d671(0x24e))+'\x20'+_0x51a452[_0x98d671(0x271)][_0x98d671(0x1ca)]+_0x251c58);}if(_0x51a452[_0x98d671(0x15b)]&&_0x51a452[_0x98d671(0x15b)][_0x98d671(0x25b)]>0x0){console[_0x98d671(0x15c)]('\x20\x20'+a26_0x49e31e[_0x98d671(0x25f)](_0x98d671(0x258))+'\x20'+_0x51a452[_0x98d671(0x15b)][_0x98d671(0x25b)]+_0x98d671(0x26d)+(_0x51a452[_0x98d671(0x15b)]['length']!==0x1?'s':''));for(const _0x4e7f9c of _0x51a452[_0x98d671(0x15b)]){console[_0x98d671(0x15c)](_0x98d671(0x26a)+_0x4e7f9c['name']);}}}function showParentSegmentNotSetError(_0xb32ddb){const _0x2c610a=a26_0x5e5c22;console[_0x2c610a(0x15c)](a26_0x49e31e[_0x2c610a(0x247)](_0x2c610a(0x1f4))),console['error'](_0xb32ddb);}export class ParentSegmentListCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]='segment:parent:list';[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x1bc);async[a26_0x5e5c22(0x1f2)](_0x453c5f){const _0x10d07a=a26_0x5e5c22,{options:_0x24b17d,args:_0x564680,tdx:_0x13e32a}=_0x453c5f,_0x3235fd=_0x564680[0x0];_0x24b17d[_0x10d07a(0x1cc)]&&(console['error'](_0x10d07a(0x25c)+_0x24b17d['site']),_0x3235fd&&console[_0x10d07a(0x15c)]('Pattern:\x20'+_0x3235fd));const _0x15a0d9=await withSpinner(_0x3235fd?_0x10d07a(0x124)+_0x3235fd+_0x10d07a(0x263):_0x10d07a(0x213),()=>_0x13e32a[_0x10d07a(0x21a)][_0x10d07a(0x23b)](),{'verbose':_0x24b17d[_0x10d07a(0x1cc)]});let _0x12ea62=_0x15a0d9['data'];if(_0x3235fd){const _0x753444=_0x3235fd[_0x10d07a(0x245)](/[.+^${}()|[\]\\]/g,_0x10d07a(0x123))[_0x10d07a(0x245)](/\*/g,'.*')[_0x10d07a(0x245)](/\?/g,'.'),_0x2b4588=new RegExp('^'+_0x753444+'$','i');_0x12ea62=_0x12ea62[_0x10d07a(0x145)](_0x77e073=>_0x2b4588['test'](_0x77e073[_0x10d07a(0x285)][_0x10d07a(0x1c4)]));}_0x12ea62[_0x10d07a(0x22a)]((_0x64ed94,_0x2f831d)=>_0x64ed94[_0x10d07a(0x285)][_0x10d07a(0x1c4)]['localeCompare'](_0x2f831d[_0x10d07a(0x285)]['name'])),console[_0x10d07a(0x15c)](_0x10d07a(0x208)+_0x12ea62['length']+_0x10d07a(0x11d)+(_0x12ea62[_0x10d07a(0x25b)]!==0x1?'s':''));const _0xcd631a=_0x55065c=>{const _0x4e06d6=_0x10d07a;return getConsoleNextUrl(_0x24b17d[_0x4e06d6(0x28b)],_0x4e06d6(0x122)+_0x55065c);};if(_0x24b17d[_0x10d07a(0x179)]===_0x10d07a(0x1ba)||_0x24b17d['format']===_0x10d07a(0x1f9)){const _0x5bd0ba=_0x12ea62[_0x10d07a(0x295)](_0x5363b6=>({..._0x5363b6,'url':_0xcd631a(_0x5363b6['id'])}));await handleSDKOutput(_0x5bd0ba,_0x24b17d);}else{if(_0x12ea62[_0x10d07a(0x25b)]===0x0)_0x3235fd?console[_0x10d07a(0x282)](_0x10d07a(0x1fa)+_0x3235fd):console[_0x10d07a(0x282)](_0x10d07a(0x1be));else for(const _0x5da570 of _0x12ea62){const _0x5b8980=_0x5da570[_0x10d07a(0x285)][_0x10d07a(0x264)]?a26_0x49e31e[_0x10d07a(0x25f)]('\x20('+formatRows(_0x5da570['attributes'][_0x10d07a(0x264)])+')'):'',_0x18d413=hyperlink(_0x5da570[_0x10d07a(0x285)][_0x10d07a(0x1c4)],_0xcd631a(_0x5da570['id']));console[_0x10d07a(0x282)](_0x10d07a(0x1c7)+_0x18d413+_0x5b8980);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x1ee);[a26_0x5e5c22(0x14f)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a26_0x5e5c22(0x1f2)](_0x2517d6){const _0x1825ca=a26_0x5e5c22,{options:_0x13cf84,args:_0x527745,tdx:_0x20c965}=_0x2517d6;console[_0x1825ca(0x15c)](_0x1825ca(0x1b8)+_0x1825ca(0x120)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x48db3c=_0x13cf84;if(_0x527745[_0x1825ca(0x25b)]===0x0)return console[_0x1825ca(0x15c)](a26_0x49e31e[_0x1825ca(0x1f7)](_0x1825ca(0x268))),console[_0x1825ca(0x15c)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x7806cd=_0x527745[0x0];if(!_0x48db3c[_0x1825ca(0x1b2)]||!_0x48db3c[_0x1825ca(0x292)])return console[_0x1825ca(0x15c)](_0x1825ca(0x11e)),console['error'](_0x1825ca(0x1ab)),0x1;_0x48db3c['verbose']&&(console[_0x1825ca(0x15c)](_0x1825ca(0x25c)+_0x48db3c['site']),console[_0x1825ca(0x15c)](_0x1825ca(0x1a8)+_0x7806cd),console[_0x1825ca(0x15c)]('Database:\x20'+_0x48db3c['database']),console[_0x1825ca(0x15c)](_0x1825ca(0x28e)+_0x48db3c[_0x1825ca(0x292)]));const _0x5e0627=await loadJSONFromOptions(_0x48db3c['attributes'],_0x48db3c[_0x1825ca(0x15d)]),_0x44ceae=await loadJSONFromOptions(_0x48db3c[_0x1825ca(0x196)],_0x48db3c[_0x1825ca(0x165)]),_0x9d358c=await loadJSONFromOptions(_0x48db3c[_0x1825ca(0x273)],_0x48db3c[_0x1825ca(0x16d)]),_0x164f97={'name':_0x7806cd,'description':_0x48db3c[_0x1825ca(0x14f)],'scheduleType':_0x48db3c['scheduleType'],'scheduleOption':_0x48db3c[_0x1825ca(0x297)],'timezone':_0x48db3c[_0x1825ca(0x231)],'master':{'parentDatabaseName':_0x48db3c[_0x1825ca(0x1b2)],'parentTableName':_0x48db3c['table']},'attributes':_0x5e0627,'behaviors':_0x44ceae,'customerGroup':_0x9d358c},_0x1e7084=await withSpinner(_0x1825ca(0x221)+_0x7806cd+_0x1825ca(0x263),()=>_0x20c965[_0x1825ca(0x21a)]['createParent'](_0x164f97),{'verbose':_0x13cf84[_0x1825ca(0x1cc)]}),_0x1aa434=_0x1e7084[_0x1825ca(0x27c)];return console[_0x1825ca(0x15c)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x1aa434[_0x1825ca(0x1c4)]+_0x1825ca(0x277)+_0x1aa434['id']),await handleSDKOutput([_0x1aa434],_0x13cf84),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x136);['description']='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a26_0x5e5c22(0x1f2)](_0x235850){const _0xc21e96=a26_0x5e5c22,{options:_0x1c6f2f,args:_0x529c1c,tdx:_0x321974}=_0x235850;console[_0xc21e96(0x15c)](_0xc21e96(0x18d)+_0xc21e96(0x120)+_0xc21e96(0x262));const _0x49377d=_0x1c6f2f;if(_0x529c1c[_0xc21e96(0x25b)]===0x0)return console[_0xc21e96(0x15c)](a26_0x49e31e['red'](_0xc21e96(0x268))),console[_0xc21e96(0x15c)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0xe52686=_0x529c1c[0x0];_0x49377d[_0xc21e96(0x1cc)]&&(console[_0xc21e96(0x15c)](_0xc21e96(0x25c)+_0x49377d['site']),console[_0xc21e96(0x15c)](_0xc21e96(0x1ff)+_0xe52686));const _0x1c620a=await withSpinner(_0xc21e96(0x189)+_0xe52686+_0xc21e96(0x263),()=>_0x321974[_0xc21e96(0x21a)][_0xc21e96(0x252)](_0xe52686),{'verbose':_0x49377d[_0xc21e96(0x1cc)]}),_0x4d0299=_0x1c620a[_0xc21e96(0x27c)],_0x26a713=await loadJSONFromOptions(_0x49377d[_0xc21e96(0x260)],_0x49377d[_0xc21e96(0x242)]),_0x10e34f=await loadJSONFromOptions(_0x49377d[_0xc21e96(0x178)],_0x49377d[_0xc21e96(0x26e)]),_0x2114f9={'name':_0x4d0299[_0xc21e96(0x1c4)],'description':_0x49377d['description']!==undefined?_0x49377d['description']:_0x4d0299[_0xc21e96(0x14f)],'scheduleType':_0x49377d[_0xc21e96(0x1c3)]!==undefined?_0x49377d[_0xc21e96(0x1c3)]:_0x4d0299['scheduleType'],'scheduleOption':_0x49377d['scheduleOption']!==undefined?_0x49377d[_0xc21e96(0x297)]:_0x4d0299[_0xc21e96(0x297)],'timezone':_0x49377d['timezone']!==undefined?_0x49377d['timezone']:_0x4d0299['timezone'],'master':_0x4d0299['master'],'attributes':_0x26a713?[..._0x4d0299['attributes']||[],..._0x26a713]:_0x4d0299[_0xc21e96(0x285)],'behaviors':_0x10e34f?[..._0x4d0299[_0xc21e96(0x196)]||[],..._0x10e34f]:_0x4d0299[_0xc21e96(0x196)],'customerGroup':_0x4d0299[_0xc21e96(0x273)]},_0x458c1f=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0xe52686+_0xc21e96(0x263),()=>_0x321974[_0xc21e96(0x21a)][_0xc21e96(0x261)](_0xe52686,_0x2114f9),{'verbose':_0x49377d[_0xc21e96(0x1cc)]}),_0x978c1c=_0x458c1f[_0xc21e96(0x27c)];return console['error'](_0xc21e96(0x193)+_0x978c1c[_0xc21e96(0x1c4)]+'\x27'),await handleSDKOutput([_0x978c1c],_0x49377d),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x170);[a26_0x5e5c22(0x14f)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a26_0x5e5c22(0x1f2)](_0x1dca20){const _0x21fcc5=a26_0x5e5c22,{options:_0x13edbd,args:_0x419f89,tdx:_0x330d44}=_0x1dca20,_0x204ab8=_0x13edbd,_0x38ff2c=_0x419f89[0x0]||_0x13edbd[_0x21fcc5(0x1c5)];if(!_0x38ff2c)return showParentSegmentNotSetError(_0x21fcc5(0x20c)+_0x21fcc5(0x1e5)),0x1;if(_0x204ab8[_0x21fcc5(0x27b)]&&_0x204ab8[_0x21fcc5(0x12c)])return console['error'](a26_0x49e31e[_0x21fcc5(0x1f7)](_0x21fcc5(0x16f))),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x289))),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x183)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x29a)](_0x21fcc5(0x141))),0x1;const _0x5092a3=_0x204ab8[_0x21fcc5(0x12c)]||a26_0x128ffd['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x38ff2c)+_0x21fcc5(0x14b));_0x204ab8[_0x21fcc5(0x1cc)]&&(console['error'](_0x21fcc5(0x25c)+_0x204ab8['site']),console['error']('Parent\x20segment:\x20'+_0x38ff2c),console[_0x21fcc5(0x15c)](_0x21fcc5(0x224)+_0x5092a3));const _0x2937ae=await withSpinner(_0x21fcc5(0x127)+_0x38ff2c+'\x27...',()=>_0x330d44[_0x21fcc5(0x21a)]['pullParentYaml'](_0x38ff2c),{'verbose':_0x204ab8[_0x21fcc5(0x1cc)]}),_0x313ba9=_0x2937ae[_0x21fcc5(0x27c)];if(existsSync(_0x5092a3)){const _0x1a9515=readFileSync(_0x5092a3,'utf-8'),_0x121f8b=generateDiff(_0x1a9515,_0x313ba9);if(!hasChanges(_0x121f8b))console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x256)]('✔')+_0x21fcc5(0x191)+a26_0x49e31e['cyan'](_0x5092a3)+_0x21fcc5(0x25e));else{console['error']('\x0aChanges\x20to\x20\x27'+_0x5092a3+'\x27:'),console[_0x21fcc5(0x15c)]('─'[_0x21fcc5(0x200)](0x3c)),console[_0x21fcc5(0x15c)](formatDiffWithColors(_0x121f8b)),console[_0x21fcc5(0x15c)]('─'[_0x21fcc5(0x200)](0x3c));if(!_0x204ab8[_0x21fcc5(0x294)]){if(!isInteractive())return console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x1f7)]('\x0aError:'),_0x21fcc5(0x148)),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x296))),0x1;const _0x548590=await confirmKey(_0x21fcc5(0x18a)+_0x5092a3+'\x27?');if(!_0x548590)return console['error'](a26_0x49e31e[_0x21fcc5(0x247)](_0x21fcc5(0x265))),0x1;}writeFileSync(_0x5092a3,_0x313ba9,'utf-8'),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x256)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a26_0x49e31e[_0x21fcc5(0x29a)](_0x5092a3));}}else{const _0x381fe2=a26_0x128ffd['dirname'](_0x5092a3);!existsSync(_0x381fe2)&&mkdirSync(_0x381fe2,{'recursive':!![]}),writeFileSync(_0x5092a3,_0x313ba9,_0x21fcc5(0x121)),console['error'](a26_0x49e31e['green']('✔')+_0x21fcc5(0x18f)+a26_0x49e31e[_0x21fcc5(0x29a)](_0x5092a3));}return saveSessionContext({'parent_segment':_0x38ff2c},_0x204ab8[_0x21fcc5(0x1ae)]),console[_0x21fcc5(0x15c)](a26_0x49e31e[_0x21fcc5(0x256)]('✔')+_0x21fcc5(0x1fb)+a26_0x49e31e[_0x21fcc5(0x25f)](_0x21fcc5(0x28f))+_0x21fcc5(0x182)+a26_0x49e31e['cyan'](_0x38ff2c)),0x0;}}function a26_0x7739(){const _0xf29b91=['addBehaviorsFile','customersWithEvents','all','idStitching','sourceTableValid','customerGroup','List\x20available\x20fields\x20for\x20segmentation','elapsedTimeMillis','Validating\x20configuration...','\x27\x20with\x20ID:\x20','Master\x20+\x20Attributes','/attempt/','platform','use','data','Behaviors','SQL\x20query:\x0a','\x0a⚠️\x20\x20Both\x20','Apply\x20changes\x20to\x20\x27','\x20parent\x20segment\x20\x27','log','toFixed','`\x20to\x20download\x20the\x20configuration\x20first','attributes','errors','td_client_id','\x20behaviors','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','site','RT\x202.0:','foreignKey','Table:\x20','parent_segment','segment:parent:push','Personalization\x20service\x20description','table','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','yes','map','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','scheduleOption','42srltKf','displaySampleData','cyan','label','setJobId','jobId','\x20parent\x20segment','Error:\x20--database\x20and\x20--table\x20are\x20required','<database>.<table>','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','utf-8','/app/dw/parentSegments/','\x5c$&','Listing\x20parent\x20segments\x20matching\x20\x27','toLowerCase','\x0a✔\x20Workflow\x20started','Fetching\x20parent\x20segment\x20\x27','collectSchema','Error:','\x20\x202.\x20Run\x20','getParentSQL','output','displayBehaviorsStats','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','number','\x20RT-enabled\x20parent\x20segment','My\x20Service','Output\x20Database:','parent_id','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Error:\x20--attribute\x20requires\x20a\x20name\x0a','segment:parent:update','limit','ps:rt:validate','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','sampleData','Options:\x0a','Fetching\x20behavior\x20list...','Behavior:','page_view','customerPercent','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','interval','isDirectory','displayPreviewResults','filter','displayMasterInfo','✔\x20No\x20changes\x20-\x20\x27','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Enriched:','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','.yml','Executing\x20parent\x20segment\x20query...','Validate:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','description','✔\x20Renamed\x20directory\x20to\x20','\x0aError:','realtime_enabled','columns','\x20kill','displayColumns','\x20to\x20configure\x20your\x20personalization\x20service','\x20personalization\x20service','segment:parent:show','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20Opening\x20','personalizationServices','error','attributesFile','%)\x20','matchedCount','master','SELECT\x20*\x20FROM\x20','ps:pz:list','processedRows','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','behaviorsFile','schemaValid','Session:','customers','realtime','preview','displaySummary','allValid','customerGroupFile','\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','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','segment:parent:pull','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','417355WXFidr','Join:','list','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','-1d','addBehaviors','format','last_page_viewed','ps:pz:init','events','rowCount','parent_segments','1930565aSwyXx','formatSchemaJson','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20=\x20','using\x20the\x20default\x20path:\x20','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','Created','type','\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','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','Fetching\x20current\x20configuration\x20for\x20\x27','Overwrite\x20\x27','Preview:','indexOf','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20\x20\x20\x20\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','realtime:','\x20No\x20changes\x20-\x20','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','✔\x20Updated\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','Available\x20behaviors:','behaviors','Options:','\x20\x20\x20\x20','\x20\x20\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Fetching\x20customers\x20schema...','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x20section','trigger_event','win32','\x0aNew\x20parent\x20segment\x20\x27','\x27\x20is\x20up\x20to\x20date','\x20--attribute\x20\x22<name>\x22','runParent','varchar','bold','Analyzing\x20changes...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Name:\x20','\x20trigger=','joinKey','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','resolveParentId','Error\x20parsing\x20YAML:\x20','session','audienceId','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','test','database','Status:','validateParentYaml','start','displayRealtimeInfo','Error:\x20File\x20not\x20found:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x0a⚠️\x20\x20Migrating:\x20','json','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','List\x20parent\x20segments','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','No\x20parent\x20segments\x20found','/\x20directories\x20exist.','278120uWCPNN','36xDmoRj','ignore','scheduleType','name','parentSegment','\x0a\x20\x20]\x0a}\x0a','👥\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','/\x20directory.\x0a','primaryKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','verbose','\x20\x20Database:\x20','totalEvents','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','ps:rt:list','segment:parent:view','user_id','text','Resolving\x20parent\x20segment\x20\x27','tdx\x20ps\x20preview\x20','displayAttributesStats','\x20rows)','Error\x20reading\x20file:\x20','column_type','\x20configured','column','\x20--enriched','To\x20cancel:','behavior','displayValidateResults','displayPreviewHints','personalization_services','match','2887368QYlRAm','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','information_schema','trim','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','join','\x20Added\x20personalization\x20template\x20to\x20','segment:parent:sql','\x20+\x20[','enabled','segment:parent:create','Rows:','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','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','execute','Attributes','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','/sessions/','Source:','red','run','jsonl','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20Context\x20set:\x20','workflowAttemptId','Events:','\x20service(s)\x20configured','Parent\x20segment:\x20','repeat','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','stop','YAML\x20file:\x20','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','stats','✔\x20Found\x20','getBehaviorNames','message','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','segment:parent:preview','status','Schema\x20saved\x20to\x20','\x20--attribute\x20\x22','schemaError','behavior_','Listing\x20parent\x20segments...','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','/app/workflows/','Updated','FINISHED','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','stitchingKeys','segment','\x20Added\x20RT\x202.0\x20template\x20section','segment:parent:fields','open','attribute','\x20--interval\x20','web','Creating\x20parent\x20segment\x20\x27','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Coverage:','Output\x20file:\x20','keys','Listing\x20personalization\x20services\x20for\x20\x27','Attribute:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Columns:','sort','RT\x202.0\x20Validate:','15184xfEqWq','personalization','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Customers:','segment:parent:validate','timezone','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','\x20to\x20push\x20the\x20configuration','\x0a\x20\x20\x20\x20}','Fetching\x20SQL\x20for\x20\x27','Master:','\x20[Job\x20ID:\x20','apply','\x20field','\x20\x20No\x20sample\x20data\x20available','listParents','double','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','⚡\x20Enabled','Fetching\x20sample\x20data...','addAttributesFile','\x22\x20}','pushParentYaml','replace','coveragePercent','yellow','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Audience\x20ID:','workflowSessionId','Updating','Listing\x20fields\x20for\x20\x27','955800jzgvEw','ID\x20Stitching:','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','953284IszcFD','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','getParentFull','segment:parent:desc','enriched','sourceTableError','green','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Personalization:','\x27\x20and\x20run\x20workflow?','string','length','Site:\x20','To\x20view\x20sample\x20data:','\x20is\x20already\x20up\x20to\x20date','dim','addAttributes','updateParent','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x27...','population','Aborted.','valid','/\x20→\x20','Error:\x20Parent\x20segment\x20name\x20is\x20required','⚡\x20Not\x20enabled','\x20\x20\x20\x20-\x20','\x22,\x20\x22type\x22:\x20\x22','single','\x20service'];a26_0x7739=function(){return _0xf29b91;};return a26_0x7739();}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x290);[a26_0x5e5c22(0x14f)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a26_0x5e5c22(0x1f2)](_0x23613b){const _0x430fc0=a26_0x5e5c22,{options:_0x2d364c,args:_0x39504c,tdx:_0x1629d1}=_0x23613b,_0x4a5db1=_0x2d364c,_0x1cb08a=_0x39504c[0x0]||_0x2d364c[_0x430fc0(0x1c5)];if(!_0x1cb08a)return showParentSegmentNotSetError(_0x430fc0(0x24f)+_0x430fc0(0x1a7)),0x1;const _0x493432=resolveYamlFile(_0x1cb08a);if(!existsSync(_0x493432))return showFileNotFoundError(_0x493432,_0x1cb08a),0x1;_0x4a5db1[_0x430fc0(0x1cc)]&&(console['error'](_0x430fc0(0x25c)+_0x4a5db1[_0x430fc0(0x28b)]),console[_0x430fc0(0x15c)](_0x430fc0(0x204)+_0x493432));let _0x5d5f71;try{_0x5d5f71=readFileSync(_0x493432,_0x430fc0(0x121));}catch(_0x411e3b){const _0x204b2e=_0x411e3b instanceof Error?_0x411e3b['message']:String(_0x411e3b);return console['error']('Error\x20reading\x20file:\x20'+_0x204b2e),0x1;}const _0x1f9da1=await withSpinner(_0x430fc0(0x1a6),()=>_0x1629d1[_0x430fc0(0x21a)][_0x430fc0(0x244)](_0x5d5f71),{'verbose':_0x4a5db1[_0x430fc0(0x1cc)]}),_0x4a8686=_0x1f9da1[_0x430fc0(0x27c)],{isNew:_0x2a449e,name:_0x46e2f7,hasChanges:_0x257852,diffFormatted:_0x190be6}=_0x4a8686;if(!_0x257852)return console['error'](_0x430fc0(0x147)+_0x46e2f7+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x2a449e?console[_0x430fc0(0x15c)](_0x430fc0(0x1a0)+_0x46e2f7+'\x27:'):console[_0x430fc0(0x15c)](_0x430fc0(0x23e)+_0x46e2f7+'\x27:');console[_0x430fc0(0x15c)]('─'[_0x430fc0(0x200)](0x3c)),console[_0x430fc0(0x15c)](_0x190be6),console[_0x430fc0(0x15c)]('─'['repeat'](0x3c));const _0x24f42b=_0x2a449e?_0x430fc0(0x194)+_0x46e2f7+'\x27?':_0x430fc0(0x280)+_0x46e2f7+'\x27?';if(!_0x4a5db1[_0x430fc0(0x294)]){if(!isInteractive())return console[_0x430fc0(0x15c)](a26_0x49e31e[_0x430fc0(0x1f7)](_0x430fc0(0x151)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a26_0x49e31e[_0x430fc0(0x25f)](_0x430fc0(0x296))),0x1;const _0x4d8d50=await confirmKey(_0x24f42b);if(!_0x4d8d50)return console[_0x430fc0(0x15c)](a26_0x49e31e['yellow'](_0x430fc0(0x265))),0x1;}const _0x44b8da=_0x2a449e?'Creating':_0x430fc0(0x24b),_0x425ac5=await withSpinner(_0x44b8da+'\x20parent\x20segment\x20\x27'+_0x46e2f7+'\x27...',()=>_0x4a8686[_0x430fc0(0x238)](),{'verbose':_0x4a5db1['verbose']}),_0x201253=_0x425ac5[_0x430fc0(0x27c)],_0x2834ff=getConsoleNextUrl(_0x4a5db1[_0x430fc0(0x28b)],_0x430fc0(0x122)+_0x201253['id']),_0x514a8d=_0x2a449e?'Created':_0x430fc0(0x216);return console[_0x430fc0(0x15c)]('✔\x20'+_0x514a8d+'\x20parent\x20segment\x20\x27'+_0x201253[_0x430fc0(0x1c4)]+'\x27'),console[_0x430fc0(0x15c)]('\x20\x20'+_0x2834ff),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a26_0x5e5c22(0x230);[a26_0x5e5c22(0x14f)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x58b265){const _0x9d1d6c=a26_0x5e5c22,{options:_0x1fdc7f,args:_0x173305,tdx:_0xb363f9}=_0x58b265,_0x4451e7=_0x1fdc7f,_0x3465af=_0x173305[0x0]||_0x1fdc7f[_0x9d1d6c(0x1c5)];if(!_0x3465af)return showParentSegmentNotSetError(_0x9d1d6c(0x214)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x9d1d6c(0x13c)+_0x9d1d6c(0x251)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x9d1d6c(0x19c)),0x1;const _0x14b0b1=resolveYamlFile(_0x3465af);if(!existsSync(_0x14b0b1))return showFileNotFoundError(_0x14b0b1,_0x3465af),0x1;_0x4451e7[_0x9d1d6c(0x1cc)]&&(console[_0x9d1d6c(0x15c)](_0x9d1d6c(0x25c)+_0x4451e7[_0x9d1d6c(0x28b)]),console[_0x9d1d6c(0x15c)]('YAML\x20file:\x20'+_0x14b0b1));let _0x373f28;try{_0x373f28=readFileSync(_0x14b0b1,_0x9d1d6c(0x121));}catch(_0x29db27){const _0x34ff18=_0x29db27 instanceof Error?_0x29db27[_0x9d1d6c(0x20a)]:String(_0x29db27);return console[_0x9d1d6c(0x15c)](_0x9d1d6c(0x1d8)+_0x34ff18),0x1;}const _0x4df3c3=createCommandSpinner(a26_0x49e31e['dim'](_0x9d1d6c(0x276)),{'verbose':_0x4451e7['verbose']});_0x4df3c3[_0x9d1d6c(0x1b5)]();const _0x1d3098={'onProgress':_0x1af223=>{const _0x4f1441=_0x9d1d6c;_0x4df3c3[_0x4f1441(0x1d3)]=formatProgressMessage(_0x1af223);}};if(_0x4451e7['master'])_0x1d3098[_0x9d1d6c(0x160)]=!![];if(_0x4451e7[_0x9d1d6c(0x254)])_0x1d3098[_0x9d1d6c(0x254)]=!![];_0x4451e7[_0x9d1d6c(0x21e)]&&(_0x1d3098[_0x9d1d6c(0x21e)]=_0x4451e7['attribute']);_0x4451e7[_0x9d1d6c(0x1de)]&&(_0x1d3098[_0x9d1d6c(0x1de)]=_0x4451e7[_0x9d1d6c(0x1de)]);if(_0x4451e7['interval'])_0x1d3098[_0x9d1d6c(0x142)]=_0x4451e7[_0x9d1d6c(0x142)];let _0x10e00e;try{_0x10e00e=await _0xb363f9[_0x9d1d6c(0x21a)][_0x9d1d6c(0x1b4)](_0x373f28,_0x1d3098),_0x4df3c3[_0x9d1d6c(0x203)]();}catch(_0x13ba74){_0x4df3c3[_0x9d1d6c(0x203)]();throw _0x13ba74;}const _0x161c86=_0x4451e7[_0x9d1d6c(0x142)]||'-1d';return this[_0x9d1d6c(0x1df)](_0x10e00e,_0x1d3098,_0x14b0b1,_0x161c86),_0x10e00e['allValid']?0x0:0x1;}['displayValidateResults'](_0x3d6046,_0x3fc707,_0x27cbe9,_0x1afa94){const _0x103706=a26_0x5e5c22;console[_0x103706(0x15c)]('\x0a'+a26_0x49e31e['bold'](_0x103706(0x14d))+'\x20'+_0x3d6046[_0x103706(0x1c4)]),console[_0x103706(0x15c)]('═'[_0x103706(0x200)](0x3c)),this[_0x103706(0x146)](_0x3d6046);if(typeof _0x3fc707['attribute']===_0x103706(0x25a)){this[_0x103706(0x1d6)](_0x3d6046),this[_0x103706(0x16b)](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,_0x103706(0x21e),_0x3fc707[_0x103706(0x21e)]);return;}if(_0x3fc707['attribute']===!![]){this[_0x103706(0x1d6)](_0x3d6046),this[_0x103706(0x16b)](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,_0x103706(0x285));return;}if(typeof _0x3fc707[_0x103706(0x1de)]===_0x103706(0x25a)){this[_0x103706(0x12d)](_0x3d6046,_0x1afa94),this[_0x103706(0x16b)](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,'behavior',_0x3fc707[_0x103706(0x1de)]);return;}if(_0x3fc707[_0x103706(0x1de)]===!![]){this[_0x103706(0x12d)](_0x3d6046,_0x1afa94),this[_0x103706(0x16b)](_0x3d6046),this['displayPreviewHints'](_0x27cbe9,_0x1afa94,_0x103706(0x196));return;}this[_0x103706(0x1d6)](_0x3d6046),this['displayBehaviorsStats'](_0x3d6046,_0x1afa94),this[_0x103706(0x1b6)](_0x3d6046),this['displaySummary'](_0x3d6046),this[_0x103706(0x1e0)](_0x27cbe9,_0x1afa94,'all');}[a26_0x5e5c22(0x1b6)](_0x29c9cd){displayRealtimeValidation(_0x29c9cd);}['displayPreviewHints'](_0x399d8b,_0x3873d5,_0x9d8b8,_0x127b7d){const _0x593aa2=a26_0x5e5c22;console[_0x593aa2(0x15c)]('\x0a'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x25d)));const _0x1e1f54=_0x3873d5!==_0x593aa2(0x177)?_0x593aa2(0x21f)+_0x3873d5:'';if(_0x9d8b8===_0x593aa2(0x21e)&&_0x127b7d)console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e['dim'](_0x593aa2(0x1d5)+_0x399d8b+_0x593aa2(0x210)+_0x127b7d+'\x22'+_0x1e1f54));else{if(_0x9d8b8===_0x593aa2(0x1de)&&_0x127b7d)console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e['dim'](_0x593aa2(0x1d5)+_0x399d8b+'\x20--behavior\x20\x22'+_0x127b7d+'\x22'+_0x1e1f54));else(_0x9d8b8===_0x593aa2(0x285)||_0x9d8b8===_0x593aa2(0x270))&&console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x1d5)+_0x399d8b+_0x593aa2(0x1a2)+_0x1e1f54));}(_0x9d8b8==='behaviors'||_0x9d8b8===_0x593aa2(0x270))&&console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x1d5)+_0x399d8b+'\x20--behavior\x20\x22<name>\x22'+_0x1e1f54)),_0x9d8b8===_0x593aa2(0x270)&&console[_0x593aa2(0x15c)]('\x20\x20'+a26_0x49e31e[_0x593aa2(0x25f)](_0x593aa2(0x1d5)+_0x399d8b+_0x593aa2(0x1dc)+_0x1e1f54));}[a26_0x5e5c22(0x146)](_0x59a4f8){const _0x35bbce=a26_0x5e5c22,{master:_0xf4e2d9}=_0x59a4f8,_0x1e6a80=_0xf4e2d9['schemaValid']?a26_0x49e31e[_0x35bbce(0x256)]('✔'):a26_0x49e31e[_0x35bbce(0x1f7)]('✘');console[_0x35bbce(0x15c)]('\x0a'+a26_0x49e31e[_0x35bbce(0x25f)]('Master\x20Table')),console[_0x35bbce(0x15c)](_0x1e6a80+'\x20'+a26_0x49e31e[_0x35bbce(0x1a5)](_0xf4e2d9['database']+'.'+_0xf4e2d9[_0x35bbce(0x292)])),_0xf4e2d9['schemaValid']?_0xf4e2d9[_0x35bbce(0x17d)]!==undefined&&console[_0x35bbce(0x15c)]('\x20\x20'+a26_0x49e31e[_0x35bbce(0x25f)](_0x35bbce(0x1ef))+'\x20'+a26_0x49e31e[_0x35bbce(0x29a)](formatRows(_0xf4e2d9['rowCount']))):console['error']('\x20\x20'+a26_0x49e31e[_0x35bbce(0x1f7)]('Error:')+'\x20'+_0xf4e2d9[_0x35bbce(0x211)]);}['displayAttributesStats'](_0x2ffff2){const _0x41a5fb=a26_0x5e5c22;if(_0x2ffff2[_0x41a5fb(0x285)][_0x41a5fb(0x25b)]===0x0)return;console[_0x41a5fb(0x15c)]('\x0a'+a26_0x49e31e[_0x41a5fb(0x25f)](_0x41a5fb(0x1f3)));for(const _0x27b8d1 of _0x2ffff2[_0x41a5fb(0x285)]){const _0x4c9c19=_0x27b8d1[_0x41a5fb(0x166)]?a26_0x49e31e[_0x41a5fb(0x256)]('✔'):a26_0x49e31e['red']('✘');let _0xca5213='';if(_0x27b8d1['schemaValid']&&_0x27b8d1['matchedCount']!==undefined&&_0x27b8d1[_0x41a5fb(0x246)]!==undefined){const _0x347170=_0x27b8d1['coveragePercent'][_0x41a5fb(0x283)](0x1),_0x3c2eba=_0x27b8d1['coveragePercent']>=0x50?a26_0x49e31e[_0x41a5fb(0x256)]:_0x27b8d1[_0x41a5fb(0x246)]>=0x32?a26_0x49e31e[_0x41a5fb(0x247)]:a26_0x49e31e[_0x41a5fb(0x1f7)];_0xca5213='\x20'+a26_0x49e31e[_0x41a5fb(0x25f)](_0x41a5fb(0x223))+'\x20'+_0x3c2eba(_0x347170+'%')+'\x20('+formatRows(_0x27b8d1[_0x41a5fb(0x15f)])+_0x41a5fb(0x1d7);}console[_0x41a5fb(0x15c)](_0x4c9c19+'\x20'+a26_0x49e31e['bold'](_0x27b8d1['name'])+_0xca5213),console[_0x41a5fb(0x15c)]('\x20\x20'+a26_0x49e31e[_0x41a5fb(0x25f)](_0x41a5fb(0x1f6))+'\x20'+a26_0x49e31e[_0x41a5fb(0x1a5)](_0x27b8d1[_0x41a5fb(0x1b2)]+'.'+_0x27b8d1[_0x41a5fb(0x292)]));const _0x2471ea=_0x27b8d1[_0x41a5fb(0x1aa)]===_0x27b8d1['foreignKey']?a26_0x49e31e[_0x41a5fb(0x25f)]('Join\x20on:')+'\x20'+_0x27b8d1[_0x41a5fb(0x1aa)]:a26_0x49e31e['dim']('Join:')+'\x20'+_0x27b8d1['joinKey']+'\x20=\x20'+_0x27b8d1[_0x41a5fb(0x28d)];console[_0x41a5fb(0x15c)]('\x20\x20'+_0x2471ea),console[_0x41a5fb(0x15c)]('\x20\x20'+a26_0x49e31e['dim'](_0x41a5fb(0x229))),this[_0x41a5fb(0x155)](_0x27b8d1[_0x41a5fb(0x153)]),!_0x27b8d1['schemaValid']&&console[_0x41a5fb(0x15c)]('\x20\x20'+a26_0x49e31e[_0x41a5fb(0x1f7)](_0x41a5fb(0x129))+'\x20'+_0x27b8d1[_0x41a5fb(0x211)]);}}[a26_0x5e5c22(0x12d)](_0xb47f27,_0x8efe1){const _0x6efd4a=a26_0x5e5c22;if(_0xb47f27[_0x6efd4a(0x196)][_0x6efd4a(0x25b)]===0x0)return;console[_0x6efd4a(0x15c)]('\x0a'+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x27d))+'\x20'+a26_0x49e31e['dim']('('+_0x8efe1+')'));for(const _0x3be4f3 of _0xb47f27[_0x6efd4a(0x196)]){const _0x37c0b4=_0x3be4f3[_0x6efd4a(0x166)]?a26_0x49e31e[_0x6efd4a(0x256)]('✔'):a26_0x49e31e[_0x6efd4a(0x1f7)]('✘');let _0x10d639='';if(_0x3be4f3[_0x6efd4a(0x166)]&&_0x3be4f3[_0x6efd4a(0x26f)]!==undefined&&_0x3be4f3['totalEvents']!==undefined){const _0x40cb0b=_0x3be4f3[_0x6efd4a(0x140)]?.[_0x6efd4a(0x283)](0x1)||'?',_0x2e456e=(_0x3be4f3[_0x6efd4a(0x140)]??0x0)>=0x32?a26_0x49e31e['green']:(_0x3be4f3['customerPercent']??0x0)>=0x14?a26_0x49e31e[_0x6efd4a(0x247)]:a26_0x49e31e[_0x6efd4a(0x1f7)];_0x10d639='\x20'+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x22f))+'\x20'+_0x2e456e(formatRows(_0x3be4f3[_0x6efd4a(0x26f)]))+'\x20('+_0x40cb0b+_0x6efd4a(0x15e)+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x1fd))+'\x20'+a26_0x49e31e[_0x6efd4a(0x29a)](formatRows(_0x3be4f3[_0x6efd4a(0x1ce)]));}console[_0x6efd4a(0x15c)](_0x37c0b4+'\x20'+a26_0x49e31e[_0x6efd4a(0x1a5)](_0x3be4f3[_0x6efd4a(0x1c4)])+_0x10d639),console[_0x6efd4a(0x15c)]('\x20\x20'+a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x1f6))+'\x20'+a26_0x49e31e[_0x6efd4a(0x1a5)](_0x3be4f3[_0x6efd4a(0x1b2)]+'.'+_0x3be4f3[_0x6efd4a(0x292)]));const _0x4792bd=_0x3be4f3[_0x6efd4a(0x1aa)]===_0x3be4f3[_0x6efd4a(0x28d)]?a26_0x49e31e[_0x6efd4a(0x25f)]('Join\x20on:')+'\x20'+_0x3be4f3['joinKey']:a26_0x49e31e[_0x6efd4a(0x25f)](_0x6efd4a(0x173))+'\x20'+_0x3be4f3[_0x6efd4a(0x1aa)]+_0x6efd4a(0x182)+_0x3be4f3['foreignKey'];console[_0x6efd4a(0x15c)]('\x20\x20'+_0x4792bd),console[_0x6efd4a(0x15c)]('\x20\x20'+a26_0x49e31e[_0x6efd4a(0x25f)]('Columns:')),this[_0x6efd4a(0x155)](_0x3be4f3[_0x6efd4a(0x153)]),!_0x3be4f3[_0x6efd4a(0x166)]&&console['error']('\x20\x20'+a26_0x49e31e['red'](_0x6efd4a(0x129))+'\x20'+_0x3be4f3[_0x6efd4a(0x211)]);}}[a26_0x5e5c22(0x155)](_0x379fa6){const _0x71bd7c=a26_0x5e5c22;for(const _0x25cfa3 of _0x379fa6){_0x25cfa3[_0x71bd7c(0x11a)]===_0x25cfa3[_0x71bd7c(0x1db)]||_0x25cfa3[_0x71bd7c(0x1db)]==='*'?console[_0x71bd7c(0x15c)](_0x71bd7c(0x26a)+_0x25cfa3[_0x71bd7c(0x11a)]):console[_0x71bd7c(0x15c)](_0x71bd7c(0x26a)+_0x25cfa3[_0x71bd7c(0x11a)]+'\x20'+a26_0x49e31e['dim']('('+_0x25cfa3[_0x71bd7c(0x1db)]+')'));}}[a26_0x5e5c22(0x16b)](_0x1a862b){const _0x3e330c=a26_0x5e5c22;console[_0x3e330c(0x15c)]('─'[_0x3e330c(0x200)](0x3c));if(_0x1a862b[_0x3e330c(0x286)][_0x3e330c(0x25b)]>0x0){console[_0x3e330c(0x15c)]('\x0a'+a26_0x49e31e[_0x3e330c(0x1f7)]('Errors:'));for(const _0x44bf8d of _0x1a862b[_0x3e330c(0x286)]){console[_0x3e330c(0x15c)]('\x20\x20'+a26_0x49e31e[_0x3e330c(0x1f7)]('•')+'\x20'+_0x44bf8d);}}_0x1a862b[_0x3e330c(0x16c)]&&console[_0x3e330c(0x15c)]('\x0a'+a26_0x49e31e['green']('✔')+'\x20Configuration\x20is\x20valid');}}function a26_0x147c(_0x51c086,_0x1338ff){_0x51c086=_0x51c086-0x11a;const _0x773967=a26_0x7739();let _0x147cb3=_0x773967[_0x51c086];return _0x147cb3;}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a26_0x5e5c22(0x20d);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x228);async['execute'](_0x2c9458){const _0x3d992c=a26_0x5e5c22,{options:_0xfd02b,args:_0x2b5191,tdx:_0x58324f}=_0x2c9458,_0xcbce4d=_0xfd02b,_0x49dc11=_0x2b5191[0x0]||_0xfd02b[_0x3d992c(0x1c5)];if(!_0x49dc11)return showParentSegmentNotSetError(_0x3d992c(0x201)+_0x3d992c(0x159)+'Options\x20(one\x20required):\x0a'+_0x3d992c(0x12e)+_0x3d992c(0x1c8)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x3d992c(0x19c)),0x1;if(!_0xcbce4d[_0x3d992c(0x160)]&&!_0xcbce4d[_0x3d992c(0x21e)]&&!_0xcbce4d[_0x3d992c(0x1de)]&&!_0xcbce4d[_0x3d992c(0x254)])return console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x293))),console['error']('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x3d992c(0x15c)](_0x3d992c(0x197)),console[_0x3d992c(0x15c)](_0x3d992c(0x248)),console[_0x3d992c(0x15c)](_0x3d992c(0x206)),console['error'](_0x3d992c(0x257)),console[_0x3d992c(0x15c)](_0x3d992c(0x139)),0x1;const _0x1968f8=resolveYamlFile(_0x49dc11);if(!existsSync(_0x1968f8))return showFileNotFoundError(_0x1968f8,_0x49dc11),0x1;_0xcbce4d[_0x3d992c(0x1cc)]&&(console[_0x3d992c(0x15c)](_0x3d992c(0x25c)+_0xcbce4d[_0x3d992c(0x28b)]),console['error'](_0x3d992c(0x204)+_0x1968f8));let _0x34ce8c;try{_0x34ce8c=readFileSync(_0x1968f8,_0x3d992c(0x121));}catch(_0x4ab1bc){const _0xd452d1=_0x4ab1bc instanceof Error?_0x4ab1bc[_0x3d992c(0x20a)]:String(_0x4ab1bc);return console[_0x3d992c(0x15c)](_0x3d992c(0x1d8)+_0xd452d1),0x1;}let _0x1744fb;try{_0x1744fb=parseDef(_0x34ce8c);}catch(_0x1d5616){const _0x36093d=_0x1d5616 instanceof Error?_0x1d5616[_0x3d992c(0x20a)]:String(_0x1d5616);return console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x1ad)+_0x36093d)),0x1;}if(_0xcbce4d[_0x3d992c(0x21e)]===!![]||_0xcbce4d['attribute']===''){const _0xa80e22=_0x1744fb[_0x3d992c(0x285)]?.[_0x3d992c(0x295)](_0xc5df52=>_0xc5df52['name'])||[];if(_0xa80e22['length']===0x0)console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x1bb)));else{console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x135))),console[_0x3d992c(0x15c)]('Available\x20attributes:');for(const _0x240ea5 of _0xa80e22){console[_0x3d992c(0x15c)]('\x20\x20'+a26_0x49e31e[_0x3d992c(0x29a)](_0x240ea5));}console[_0x3d992c(0x15c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x49dc11+_0x3d992c(0x210)+_0xa80e22[0x0]+'\x22');}return 0x1;}if(_0xcbce4d['behavior']===!![]||_0xcbce4d[_0x3d992c(0x1de)]===''){const _0x3e5686=_0x1744fb[_0x3d992c(0x196)]?.[_0x3d992c(0x295)](_0x32112c=>_0x32112c[_0x3d992c(0x1c4)])||[];if(_0x3e5686[_0x3d992c(0x25b)]===0x0)console['error'](a26_0x49e31e[_0x3d992c(0x1f7)](_0x3d992c(0x222)));else{console[_0x3d992c(0x15c)](a26_0x49e31e[_0x3d992c(0x1f7)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x3d992c(0x15c)](_0x3d992c(0x195));for(const _0x4a58c7 of _0x3e5686){console[_0x3d992c(0x15c)]('\x20\x20'+a26_0x49e31e[_0x3d992c(0x29a)](_0x4a58c7));}console[_0x3d992c(0x15c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x49dc11+'\x20--behavior\x20\x22'+_0x3e5686[0x0]+'\x22');}return 0x1;}const _0x5c5944=createCommandSpinner(a26_0x49e31e[_0x3d992c(0x25f)](_0x3d992c(0x241)),{'verbose':_0xcbce4d[_0x3d992c(0x1cc)]});_0x5c5944['start']();const _0x5e0400={'onProgress':_0x208552=>{_0x5c5944['text']=formatProgressMessage(_0x208552);}};if(_0xcbce4d['master'])_0x5e0400[_0x3d992c(0x160)]=!![];if(_0xcbce4d[_0x3d992c(0x21e)]&&typeof _0xcbce4d[_0x3d992c(0x21e)]==='string')_0x5e0400[_0x3d992c(0x21e)]=_0xcbce4d[_0x3d992c(0x21e)];if(_0xcbce4d['behavior']&&typeof _0xcbce4d[_0x3d992c(0x1de)]===_0x3d992c(0x25a))_0x5e0400['behavior']=_0xcbce4d[_0x3d992c(0x1de)];if(_0xcbce4d[_0x3d992c(0x254)])_0x5e0400[_0x3d992c(0x254)]=!![];if(_0xcbce4d[_0x3d992c(0x142)])_0x5e0400[_0x3d992c(0x142)]=_0xcbce4d[_0x3d992c(0x142)];let _0x3b4059;try{_0x3b4059=await _0x58324f[_0x3d992c(0x21a)]['previewParentYaml'](_0x34ce8c,_0x5e0400),_0x5c5944[_0x3d992c(0x203)]();}catch(_0x347623){_0x5c5944[_0x3d992c(0x203)]();throw _0x347623;}return await this[_0x3d992c(0x144)](_0x3b4059,{'master':_0xcbce4d[_0x3d992c(0x160)],'attribute':typeof _0xcbce4d[_0x3d992c(0x21e)]===_0x3d992c(0x25a)?_0xcbce4d[_0x3d992c(0x21e)]:undefined,'behavior':typeof _0xcbce4d[_0x3d992c(0x1de)]===_0x3d992c(0x25a)?_0xcbce4d[_0x3d992c(0x1de)]:undefined,'enriched':_0xcbce4d['enriched']}),_0x3b4059[_0x3d992c(0x16c)]?0x0:0x1;}async[a26_0x5e5c22(0x144)](_0xc3e4f,_0x1be758){const _0x7adf2d=a26_0x5e5c22;console[_0x7adf2d(0x15c)]('\x0a'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0x7adf2d(0x18b))+'\x20'+_0xc3e4f['name']),console[_0x7adf2d(0x15c)]('═'[_0x7adf2d(0x200)](0x3c));if(_0x1be758[_0x7adf2d(0x160)]&&_0xc3e4f[_0x7adf2d(0x13b)]){const _0x5a6940=a26_0x49e31e['dim'](_0x7adf2d(0x236))+'\x20'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0xc3e4f[_0x7adf2d(0x160)][_0x7adf2d(0x1b2)]+'.'+_0xc3e4f[_0x7adf2d(0x160)]['table']);await this[_0x7adf2d(0x299)](_0x5a6940,_0xc3e4f[_0x7adf2d(0x13b)]);}else{if(_0x1be758['attribute']&&_0xc3e4f['sampleData']){const _0x10fb76=a26_0x49e31e[_0x7adf2d(0x25f)](_0x7adf2d(0x227))+'\x20'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0x1be758[_0x7adf2d(0x21e)]);await this[_0x7adf2d(0x299)](_0x10fb76,_0xc3e4f[_0x7adf2d(0x13b)]);}else{if(_0x1be758['behavior']&&_0xc3e4f[_0x7adf2d(0x13b)]){const _0x408cc7=a26_0x49e31e['dim'](_0x7adf2d(0x13e))+'\x20'+a26_0x49e31e['bold'](_0x1be758[_0x7adf2d(0x1de)]);await this[_0x7adf2d(0x299)](_0x408cc7,_0xc3e4f['sampleData']);}else{if(_0x1be758[_0x7adf2d(0x254)]&&_0xc3e4f[_0x7adf2d(0x13b)]){const _0x1f9a4f=a26_0x49e31e['dim'](_0x7adf2d(0x149))+'\x20'+a26_0x49e31e[_0x7adf2d(0x1a5)](_0x7adf2d(0x278));await this['displaySampleData'](_0x1f9a4f,_0xc3e4f[_0x7adf2d(0x13b)]);}else!_0xc3e4f[_0x7adf2d(0x13b)]&&console[_0x7adf2d(0x15c)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0xc3e4f['errors']['length']>0x0){console[_0x7adf2d(0x15c)]('─'[_0x7adf2d(0x200)](0x3c)),console[_0x7adf2d(0x15c)]('\x0a'+a26_0x49e31e[_0x7adf2d(0x1f7)]('Errors:'));for(const _0x87e025 of _0xc3e4f[_0x7adf2d(0x286)]){console[_0x7adf2d(0x15c)]('\x20\x20'+a26_0x49e31e[_0x7adf2d(0x1f7)]('•')+'\x20'+_0x87e025);}}}async[a26_0x5e5c22(0x299)](_0x422257,_0x41b67f){const _0x154120=a26_0x5e5c22;if(_0x41b67f[_0x154120(0x25b)]===0x0){console[_0x154120(0x15c)]('\x0a'+_0x422257),console[_0x154120(0x15c)](_0x154120(0x23a));return;}console[_0x154120(0x15c)]('\x0a'+_0x422257);const _0x5a7274=Object[_0x154120(0x225)](_0x41b67f[0x0])[_0x154120(0x295)](_0x3f4b90=>({'name':_0x3f4b90,'type':typeof _0x41b67f[0x0][_0x3f4b90]===_0x154120(0x12f)?_0x154120(0x23c):_0x154120(0x1a4)})),_0x39fd0b={'queryId':_0x154120(0x16a),'columns':_0x5a7274,'data':_0x41b67f,'stats':{'state':_0x154120(0x217),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x41b67f['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5143e=formatAsTable(_0x39fd0b,_0x41b67f[_0x154120(0x25b)],!![]);await writeOutput(_0x5143e,undefined,_0x154120(0x292));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]='segment:parent:run';[a26_0x5e5c22(0x14f)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a26_0x5e5c22(0x1f2)](_0x47ad2c){const _0x33d0a5=a26_0x5e5c22,{options:_0x1dda77,args:_0x5ef555,tdx:_0x32c6ca}=_0x47ad2c,_0x70e659=_0x1dda77,_0x3bb30e=_0x5ef555[0x0]||_0x1dda77[_0x33d0a5(0x1c5)];if(!_0x3bb30e)return showParentSegmentNotSetError(_0x33d0a5(0x1cf)+_0x33d0a5(0x181)),0x1;const _0x390acc=resolveYamlFile(_0x3bb30e);if(existsSync(_0x390acc)){_0x70e659['verbose']&&console[_0x33d0a5(0x15c)]('Found\x20YAML\x20file:\x20'+_0x390acc);let _0x586395;try{_0x586395=readFileSync(_0x390acc,'utf-8');}catch(_0x372409){const _0x5d937b=_0x372409 instanceof Error?_0x372409[_0x33d0a5(0x20a)]:String(_0x372409);return console[_0x33d0a5(0x15c)]('Error\x20reading\x20file:\x20'+_0x5d937b),0x1;}const _0x5d7b70=await withSpinner(_0x33d0a5(0x1a6),()=>_0x32c6ca[_0x33d0a5(0x21a)]['pushParentYaml'](_0x586395),{'verbose':_0x70e659[_0x33d0a5(0x1cc)]}),_0x24d5f0=_0x5d7b70[_0x33d0a5(0x27c)],{isNew:_0xac6679,name:_0x2acca9,hasChanges:_0x43602a,diffFormatted:_0x14d39a}=_0x24d5f0;if(_0x43602a){_0xac6679?console[_0x33d0a5(0x15c)](_0x33d0a5(0x1a0)+_0x2acca9+'\x27:'):console[_0x33d0a5(0x15c)](_0x33d0a5(0x23e)+_0x2acca9+'\x27:');console[_0x33d0a5(0x15c)]('─'[_0x33d0a5(0x200)](0x3c)),console['error'](_0x14d39a),console[_0x33d0a5(0x15c)]('─'['repeat'](0x3c));const _0x5dc412=_0xac6679?_0x33d0a5(0x194)+_0x2acca9+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x2acca9+_0x33d0a5(0x259);if(!_0x70e659[_0x33d0a5(0x294)]){if(!isInteractive())return console[_0x33d0a5(0x15c)](a26_0x49e31e[_0x33d0a5(0x1f7)](_0x33d0a5(0x151)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x33d0a5(0x15c)](a26_0x49e31e[_0x33d0a5(0x25f)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x1ece98=await confirmKey(_0x5dc412);if(!_0x1ece98)return console[_0x33d0a5(0x15c)](a26_0x49e31e['yellow'](_0x33d0a5(0x265))),0x1;}const _0x251fbf=_0xac6679?'Creating':_0x33d0a5(0x24b);await withSpinner(_0x251fbf+_0x33d0a5(0x281)+_0x2acca9+'\x27...',()=>_0x24d5f0[_0x33d0a5(0x238)](),{'verbose':_0x70e659[_0x33d0a5(0x1cc)]});const _0x1e8341=_0xac6679?_0x33d0a5(0x185):_0x33d0a5(0x216);console[_0x33d0a5(0x15c)]('✔\x20'+_0x1e8341+_0x33d0a5(0x281)+_0x2acca9+'\x27');}else console[_0x33d0a5(0x15c)](_0x33d0a5(0x147)+_0x2acca9+_0x33d0a5(0x1a1));}const _0x8a70a1=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x3bb30e+_0x33d0a5(0x263),()=>_0x32c6ca[_0x33d0a5(0x21a)][_0x33d0a5(0x1a3)](_0x3bb30e),{'verbose':_0x70e659[_0x33d0a5(0x1cc)]}),_0x4599fb=_0x8a70a1[_0x33d0a5(0x27c)],_0x8058d2=getConsoleUrl(_0x70e659['site'],_0x33d0a5(0x215)+_0x4599fb['workflowId']+_0x33d0a5(0x1f5)+_0x4599fb[_0x33d0a5(0x24a)]+_0x33d0a5(0x279)+_0x4599fb['workflowAttemptId']);return console['error'](_0x33d0a5(0x126)),console['error']('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x249))+'\x20'+_0x4599fb[_0x33d0a5(0x1af)]),console[_0x33d0a5(0x15c)]('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x1b3))+'\x20'+_0x4599fb[_0x33d0a5(0x20e)]),console[_0x33d0a5(0x15c)]('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x167))+'\x20'+_0x4599fb[_0x33d0a5(0x24a)]),console[_0x33d0a5(0x15c)]('\x20\x20'+a26_0x49e31e[_0x33d0a5(0x25f)]('Attempt:')+'\x20'+_0x4599fb['workflowAttemptId']),console[_0x33d0a5(0x15c)]('\x20\x20'+_0x8058d2),console['error']('\x0a'+a26_0x49e31e[_0x33d0a5(0x25f)](_0x33d0a5(0x1dd))+'\x20tdx\x20wf\x20attempt\x20'+_0x4599fb[_0x33d0a5(0x1fc)]+_0x33d0a5(0x154)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x21c);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x274);async[a26_0x5e5c22(0x1f2)](_0x5c694a){const _0x585149=a26_0x5e5c22,{options:_0x122677,args:_0x3eaca7,tdx:_0x4810d5}=_0x5c694a,_0x4b507e=_0x3eaca7[0x0]||_0x122677[_0x585149(0x1c5)];if(!_0x4b507e)return showParentSegmentNotSetError(_0x585149(0x1e4)+_0x585149(0x1cb)),0x1;_0x122677[_0x585149(0x1cc)]&&(console[_0x585149(0x15c)]('Site:\x20'+_0x122677[_0x585149(0x28b)]),console[_0x585149(0x15c)]('Parent\x20segment:\x20'+_0x4b507e));const _0x5626b5=await withSpinner(_0x585149(0x24c)+_0x4b507e+'\x27...',()=>_0x4810d5['segment']['listFields'](_0x4b507e),{'verbose':_0x122677[_0x585149(0x1cc)]}),_0x25925c=_0x5626b5[_0x585149(0x27c)];console[_0x585149(0x15c)](_0x585149(0x208)+_0x25925c[_0x585149(0x25b)]+_0x585149(0x239)+(_0x25925c[_0x585149(0x25b)]!==0x1?'s':''));if(_0x122677[_0x585149(0x1ba)]||_0x122677['jsonl'])return await handleSDKOutput(_0x25925c,_0x122677),0x0;return displayFieldsHumanReadable(_0x25925c,_0x4b507e),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a26_0x5e5c22(0x1d1);[a26_0x5e5c22(0x14f)]='Show\x20parent\x20segment\x20details';async['execute'](_0x4234ae){const _0x1e5418=a26_0x5e5c22,{options:_0xea96ab,args:_0x3e5171,tdx:_0x5ceadb}=_0x4234ae,_0x98df10=_0xea96ab,_0x14b440=_0x3e5171[0x0]||_0xea96ab[_0x1e5418(0x1c5)];if(!_0x14b440)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'+_0x1e5418(0x164)+_0x1e5418(0x13c)+_0x1e5418(0x1bd)),0x1;_0xea96ab[_0x1e5418(0x1cc)]&&(console['error']('Site:\x20'+_0xea96ab[_0x1e5418(0x28b)]),console['error']('Parent\x20segment:\x20'+_0x14b440));const _0x20fe82=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x14b440+_0x1e5418(0x263),()=>_0x5ceadb[_0x1e5418(0x21a)][_0x1e5418(0x252)](_0x14b440),{'verbose':_0xea96ab[_0x1e5418(0x1cc)]}),_0x5de4f9=_0x20fe82[_0x1e5418(0x27c)];if(_0x98df10[_0x1e5418(0x220)]){const _0x1e907c=getConsoleNextUrl(_0x98df10[_0x1e5418(0x28b)],_0x1e5418(0x122)+_0x5de4f9['id']);return console[_0x1e5418(0x15c)](a26_0x49e31e[_0x1e5418(0x256)]('✔')+_0x1e5418(0x15a)+a26_0x49e31e[_0x1e5418(0x29a)](_0x1e907c)),openBrowser(_0x1e907c),0x0;}return await handleSingleObjectOutput(_0x5de4f9,_0xea96ab),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x253);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x20b);async['execute'](_0x1f5082){const _0x21bdeb=a26_0x5e5c22,{options:_0xcb4b0c,args:_0x18789f,tdx:_0x75cbe9}=_0x1f5082,_0x2d01fc=_0xcb4b0c,_0x134bba=_0x18789f[0x0]||_0xcb4b0c[_0x21bdeb(0x1c5)];if(!_0x134bba)return showParentSegmentNotSetError('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'+_0x21bdeb(0x187)+_0x21bdeb(0x13c)+_0x21bdeb(0x134)),0x1;_0xcb4b0c[_0x21bdeb(0x1cc)]&&(console[_0x21bdeb(0x15c)](_0x21bdeb(0x25c)+_0xcb4b0c[_0x21bdeb(0x28b)]),console[_0x21bdeb(0x15c)](_0x21bdeb(0x1ff)+_0x134bba));const _0x45e07d=await withSpinner(_0x21bdeb(0x1d4)+_0x134bba+_0x21bdeb(0x263),()=>_0x75cbe9['segment'][_0x21bdeb(0x1ac)](_0x134bba),{'verbose':_0xcb4b0c[_0x21bdeb(0x1cc)]}),_0x30d424=_0x45e07d[_0x21bdeb(0x27c)],_0x2ab141=_0x75cbe9[_0x21bdeb(0x21a)]['getOutputDatabaseName'](_0x30d424);if(_0x2d01fc[_0x21bdeb(0x12c)]){const _0x4a5125=await this[_0x21bdeb(0x128)](_0x1f5082,_0x134bba,_0x30d424,_0x2ab141),_0x1c6c37=this[_0x21bdeb(0x180)](_0x4a5125);writeFileSync(_0x2d01fc[_0x21bdeb(0x12c)],_0x1c6c37);const _0x2b3800=_0x4a5125['customers']['columns'][_0x21bdeb(0x25b)]+_0x4a5125[_0x21bdeb(0x196)]['reduce']((_0x3143bd,_0x3ce0e9)=>_0x3143bd+_0x3ce0e9[_0x21bdeb(0x153)][_0x21bdeb(0x25b)],0x0),_0x1459ea=_0x4a5125[_0x21bdeb(0x196)]['filter'](_0x6f5cee=>_0x6f5cee[_0x21bdeb(0x153)][_0x21bdeb(0x25b)]===0x0)['length'];return console[_0x21bdeb(0x282)](_0x21bdeb(0x20f)+_0x2d01fc['output']),console[_0x21bdeb(0x282)](_0x21bdeb(0x1cd)+_0x2ab141),console[_0x21bdeb(0x282)]('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x4a5125[_0x21bdeb(0x196)]['length']+_0x21bdeb(0x288)),console[_0x21bdeb(0x282)]('\x20\x20Columns:\x20'+_0x2b3800+'\x20total'),_0x1459ea>0x0&&console[_0x21bdeb(0x282)]('\x20\x20Note:\x20'+_0x1459ea+_0x21bdeb(0x28a)),0x0;}console['error']('\x0a'+a26_0x49e31e[_0x21bdeb(0x1a5)](_0x21bdeb(0x132))+'\x20'+a26_0x49e31e[_0x21bdeb(0x29a)](_0x2ab141));const _0x51d3a1=await withSpinner(_0x21bdeb(0x19b),()=>_0x75cbe9[_0x21bdeb(0x21a)]['getParentSQL'](_0x30d424),{'verbose':_0xcb4b0c[_0x21bdeb(0x1cc)]});console[_0x21bdeb(0x15c)]('\x0a'+a26_0x49e31e[_0x21bdeb(0x1a5)](_0x21bdeb(0x168))+'\x20'+a26_0x49e31e['dim']('('+_0x2ab141+'.customers)'));const _0x15f5bb=await executeSchemaQuery(_0x51d3a1[_0x21bdeb(0x27c)],_0x75cbe9,_0xcb4b0c);await handleQueryOutput(_0x15f5bb,_0xcb4b0c);const _0x70ea23=await withSpinner(_0x21bdeb(0x13d),()=>_0x75cbe9[_0x21bdeb(0x21a)][_0x21bdeb(0x209)](_0x30d424),{'verbose':_0xcb4b0c[_0x21bdeb(0x1cc)]});for(const _0x5e04f3 of _0x70ea23['data']){const _0x498a0a=_0x21bdeb(0x212)+_0x5e04f3[_0x21bdeb(0x125)]()[_0x21bdeb(0x245)](/\s+/g,'_'),_0x324db5=_0x21bdeb(0x161)+_0x2ab141+'.'+_0x498a0a;console[_0x21bdeb(0x15c)]('\x0a'+a26_0x49e31e[_0x21bdeb(0x1a5)](_0x5e04f3)+'\x20'+a26_0x49e31e[_0x21bdeb(0x25f)]('('+_0x2ab141+'.'+_0x498a0a+')'));try{const _0x14aec2=await executeSchemaQuery(_0x324db5,_0x75cbe9,_0xcb4b0c);await handleQueryOutput(_0x14aec2,_0xcb4b0c);}catch{console['error'](a26_0x49e31e[_0x21bdeb(0x247)]('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a26_0x5e5c22(0x128)](_0x299354,_0x1dc700,_0x4249e8,_0xe3bc13){const _0x53d8ca=a26_0x5e5c22,{options:_0x5a4ac0,tdx:_0x309a0f}=_0x299354,_0xa987d7=await withSpinner(_0x53d8ca(0x19b),()=>_0x309a0f[_0x53d8ca(0x21a)]['getParentSQL'](_0x4249e8),{'verbose':_0x5a4ac0[_0x53d8ca(0x1cc)]}),_0x45ece3=await executeSchemaQuery(_0xa987d7['data'],_0x309a0f,_0x5a4ac0),_0x18f0fb=_0x45ece3[_0x53d8ca(0x27c)][_0x53d8ca(0x295)](_0x3bd368=>({'name':_0x3bd368['column_name'],'type':_0x3bd368[_0x53d8ca(0x1d9)]})),_0x23a499=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x309a0f[_0x53d8ca(0x21a)][_0x53d8ca(0x209)](_0x4249e8),{'verbose':_0x5a4ac0[_0x53d8ca(0x1cc)]}),_0x86b256=[];for(const _0x21e340 of _0x23a499[_0x53d8ca(0x27c)]){const _0x36f53e=_0x53d8ca(0x212)+_0x21e340[_0x53d8ca(0x125)]()['replace'](/\s+/g,'_'),_0x687154=_0x53d8ca(0x161)+_0xe3bc13+'.'+_0x36f53e;let _0x799212=[];try{const _0x2cf3b5=await executeSchemaQuery(_0x687154,_0x309a0f,_0x5a4ac0);_0x799212=_0x2cf3b5[_0x53d8ca(0x27c)]['map'](_0x2bf25a=>({'name':_0x2bf25a['column_name'],'type':_0x2bf25a['column_type']}));}catch{}_0x86b256['push']({'table':_0x36f53e,'columns':_0x799212});}return{'database':_0xe3bc13,'parent_segment':_0x1dc700,'parent_id':_0x4249e8,'customers':{'table':_0x53d8ca(0x168),'columns':_0x18f0fb},'behaviors':_0x86b256};}[a26_0x5e5c22(0x180)](_0x2d9a61){const _0x24d17b=a26_0x5e5c22,_0x5e4f25=_0xa8f53=>{const _0x1ac7f4=a26_0x147c;if(_0xa8f53[_0x1ac7f4(0x25b)]===0x0)return'[]';const _0x12245f=_0xa8f53['map'](_0x53813d=>_0x1ac7f4(0x171)+_0x53813d[_0x1ac7f4(0x1c4)]+_0x1ac7f4(0x26b)+_0x53813d['type']+_0x1ac7f4(0x243));return'[\x0a'+_0x12245f['join'](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0xe17010=_0x2d9a61[_0x24d17b(0x196)][_0x24d17b(0x295)](_0x27001b=>{const _0x4ce331=_0x24d17b;return _0x4ce331(0x13a)+_0x27001b['table']+_0x4ce331(0x218)+_0x5e4f25(_0x27001b[_0x4ce331(0x153)])[_0x4ce331(0x245)](/^/gm,'\x20\x20')['trim']()+_0x4ce331(0x234);})[_0x24d17b(0x1e9)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x2d9a61[_0x24d17b(0x1b2)]+_0x24d17b(0x176)+_0x2d9a61[_0x24d17b(0x28f)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x2d9a61[_0x24d17b(0x133)]+_0x24d17b(0x205)+_0x2d9a61[_0x24d17b(0x168)]['table']+_0x24d17b(0x202)+_0x5e4f25(_0x2d9a61['customers'][_0x24d17b(0x153)])[_0x24d17b(0x245)](/^/gm,'\x20\x20')[_0x24d17b(0x1e7)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0xe17010+_0x24d17b(0x1c6);}}export class ParentSegmentSQLCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x1eb);['description']=a26_0x5e5c22(0x23d);async[a26_0x5e5c22(0x1f2)](_0x4e0393){const _0x11878f=a26_0x5e5c22,{options:_0x55ec7c,args:_0xbd6af8,tdx:_0x14eeac}=_0x4e0393,_0x5bdad0=_0xbd6af8[0x0]||_0x55ec7c[_0x11878f(0x1c5)];if(!_0x5bdad0)return showParentSegmentNotSetError(_0x11878f(0x23f)+_0x11878f(0x1f1)),0x1;_0x55ec7c[_0x11878f(0x1cc)]&&(console[_0x11878f(0x15c)](_0x11878f(0x25c)+_0x55ec7c[_0x11878f(0x28b)]),console[_0x11878f(0x15c)](_0x11878f(0x1ff)+_0x5bdad0));const _0x58b0a9=await withSpinner(_0x11878f(0x1d4)+_0x5bdad0+_0x11878f(0x263),()=>_0x14eeac[_0x11878f(0x21a)]['resolveParentId'](_0x5bdad0),{'verbose':_0x55ec7c[_0x11878f(0x1cc)]}),_0x4bad99=_0x58b0a9[_0x11878f(0x27c)],_0x213961=await withSpinner(_0x11878f(0x235)+_0x5bdad0+_0x11878f(0x263),()=>_0x14eeac['segment'][_0x11878f(0x12b)](_0x4bad99),{'verbose':_0x55ec7c[_0x11878f(0x1cc)]}),_0x192d94=_0x213961[_0x11878f(0x27c)];return _0x55ec7c[_0x11878f(0x179)]===_0x11878f(0x1ba)||_0x55ec7c['format']==='jsonl'?await handleSDKOutput([{'sql':_0x192d94}],_0x55ec7c):console['log'](_0x192d94),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']=a26_0x5e5c22(0x158);[a26_0x5e5c22(0x14f)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a26_0x5e5c22(0x1f2)](_0x443bb8){const _0x38e883=a26_0x5e5c22,{options:_0xc7fcf,args:_0x1c0546,tdx:_0x74af86}=_0x443bb8,_0x5d15a8=_0x1c0546[0x0]||_0xc7fcf[_0x38e883(0x1c5)];if(!_0x5d15a8)return showParentSegmentNotSetError(_0x38e883(0x1b0)+_0x38e883(0x1e8)),0x1;_0xc7fcf[_0x38e883(0x1cc)]&&(console['error'](_0x38e883(0x25c)+_0xc7fcf[_0x38e883(0x28b)]),console['error'](_0x38e883(0x1ff)+_0x5d15a8));const _0x1e73ca=await withSpinner(_0x38e883(0x1d4)+_0x5d15a8+_0x38e883(0x263),()=>_0x74af86['segment'][_0x38e883(0x1ac)](_0x5d15a8),{'verbose':_0xc7fcf[_0x38e883(0x1cc)]}),_0x27746b=_0x1e73ca[_0x38e883(0x27c)],_0x635776=await withSpinner(_0x38e883(0x235)+_0x5d15a8+_0x38e883(0x263),()=>_0x74af86[_0x38e883(0x21a)][_0x38e883(0x12b)](_0x27746b),{'verbose':_0xc7fcf[_0x38e883(0x1cc)]});let _0x2adae4=_0x635776[_0x38e883(0x27c)];const _0x27c8ce=resolveLimit(_0xc7fcf[_0x38e883(0x137)],DEFAULT_DISPLAY_LIMIT),_0x19f139=/\bLIMIT\s+\d+/i[_0x38e883(0x1b1)](_0x2adae4);!_0x19f139&&(_0x2adae4=_0x2adae4[_0x38e883(0x1e7)]()[_0x38e883(0x245)](/;+$/,''),_0x2adae4='SELECT\x20*\x20FROM\x20(\x0a'+_0x2adae4+_0x38e883(0x19a)+_0x27c8ce);_0xc7fcf[_0x38e883(0x1cc)]&&console[_0x38e883(0x15c)](_0x38e883(0x27e)+_0x2adae4);const _0x31f7e5=await withProgressSpinner(_0x38e883(0x14c),async _0x33a70a=>{const _0x352136=_0x38e883,_0x185cb5=await _0x74af86['query'][_0x352136(0x1f2)](_0x2adae4,{'catalog':'td','schema':_0x352136(0x1e6),'onJobId':_0x233217=>{const _0x3dbc92=_0x352136;_0x33a70a[_0x3dbc92(0x11b)](_0x233217);}});return _0x185cb5;},{'verbose':_0xc7fcf[_0x38e883(0x1cc)]}),_0x11fa8c=_0x31f7e5[_0x38e883(0x27c)],_0x354ce2=_0x11fa8c[_0x38e883(0x11c)]?_0x38e883(0x237)+_0x11fa8c[_0x38e883(0x11c)]+']':'';return console[_0x38e883(0x15c)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x11fa8c['stats'][_0x38e883(0x163)]['toLocaleString']()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x11fa8c[_0x38e883(0x207)][_0x38e883(0x275)])+_0x354ce2)),await handleQueryOutput(_0x11fa8c,_0xc7fcf),0x0;}}export class PSRtListCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x1d0);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x192);async[a26_0x5e5c22(0x1f2)](_0x4ff725){const _0x50dcaa=a26_0x5e5c22,{options:_0x51dfd3,args:_0x1b0965,tdx:_0x3b8b77}=_0x4ff725,_0x450fb8=_0x1b0965[0x0],_0x1baf84=await withSpinner(_0x450fb8?_0x50dcaa(0x14a)+_0x450fb8+_0x50dcaa(0x263):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x3b8b77['realtime'][_0x50dcaa(0x174)](),{'verbose':_0x51dfd3[_0x50dcaa(0x1cc)]});let _0xf74ac8=_0x1baf84[_0x50dcaa(0x27c)][_0x50dcaa(0x145)](_0x45ca71=>_0x45ca71[_0x50dcaa(0x152)]);if(_0x450fb8){const _0x3bf9ef=_0x450fb8[_0x50dcaa(0x245)](/[.+^${}()|[\]\\]/g,_0x50dcaa(0x123))[_0x50dcaa(0x245)](/\*/g,'.*')[_0x50dcaa(0x245)](/\?/g,'.'),_0xf6314e=new RegExp('^'+_0x3bf9ef+'$','i');_0xf74ac8=_0xf74ac8[_0x50dcaa(0x145)](_0x2305fb=>_0xf6314e[_0x50dcaa(0x1b1)](_0x2305fb[_0x50dcaa(0x1c4)]));}_0xf74ac8[_0x50dcaa(0x22a)]((_0x57a95c,_0x3dd451)=>_0x57a95c[_0x50dcaa(0x1c4)]['localeCompare'](_0x3dd451['name'])),console[_0x50dcaa(0x15c)](_0x50dcaa(0x208)+_0xf74ac8[_0x50dcaa(0x25b)]+_0x50dcaa(0x130)+(_0xf74ac8['length']!==0x1?'s':''));const _0x42246e=_0x1a614a=>{const _0x136512=_0x50dcaa;return getConsoleNextUrl(_0x51dfd3[_0x136512(0x28b)],_0x136512(0x122)+_0x1a614a);};if(_0x51dfd3[_0x50dcaa(0x179)]===_0x50dcaa(0x1ba)||_0x51dfd3[_0x50dcaa(0x179)]===_0x50dcaa(0x1f9)){const _0xfa5541=_0xf74ac8[_0x50dcaa(0x295)](_0x375a05=>({..._0x375a05,'url':_0x42246e(_0x375a05['id'])}));await handleSDKOutput(_0xfa5541,_0x51dfd3);}else{if(_0xf74ac8[_0x50dcaa(0x25b)]===0x0)console[_0x50dcaa(0x282)]('No\x20RT-enabled\x20parent\x20segments\x20found');else for(const _0x35a18f of _0xf74ac8){const _0x500f4f=_0x35a18f[_0x50dcaa(0x264)]?a26_0x49e31e[_0x50dcaa(0x25f)]('\x20('+formatRows(_0x35a18f[_0x50dcaa(0x264)])+')'):'',_0x2fe474=hyperlink(_0x35a18f[_0x50dcaa(0x1c4)],_0x42246e(_0x35a18f['id']));console[_0x50dcaa(0x282)]('⚡\x20'+_0x2fe474+_0x500f4f);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x138);[a26_0x5e5c22(0x14f)]=a26_0x5e5c22(0x232);async[a26_0x5e5c22(0x1f2)](_0x1c04ec){const _0x864311=a26_0x5e5c22,{options:_0x4054e5,args:_0x21496e,tdx:_0xa57f57}=_0x1c04ec,_0x9cbf28=_0x21496e[0x0]||_0x4054e5[_0x864311(0x1c5)];if(!_0x9cbf28)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 _0x1f4275=resolveYamlFile(_0x9cbf28);if(!existsSync(_0x1f4275))return showFileNotFoundError(_0x1f4275,_0x9cbf28),0x1;let _0x1ecfb9;try{_0x1ecfb9=readFileSync(_0x1f4275,_0x864311(0x121));}catch(_0x1832da){const _0x1b8b15=_0x1832da instanceof Error?_0x1832da['message']:String(_0x1832da);return console[_0x864311(0x15c)](_0x864311(0x1d8)+_0x1b8b15),0x1;}const _0x1197c5=createCommandSpinner(a26_0x49e31e[_0x864311(0x25f)]('Validating\x20RT\x20configuration...'),{'verbose':_0x4054e5['verbose']});_0x1197c5['start']();const _0x3fbbfb={'realtime':!![],'onProgress':_0x2bb806=>{const _0x3822f4=_0x864311;_0x1197c5[_0x3822f4(0x1d3)]=formatProgressMessage(_0x2bb806);}};let _0x3320d9;try{_0x3320d9=await _0xa57f57['segment']['validateParentYaml'](_0x1ecfb9,_0x3fbbfb),_0x1197c5['stop']();}catch(_0xe2f16e){_0x1197c5[_0x864311(0x203)]();throw _0xe2f16e;}console[_0x864311(0x15c)]('\x0a'+a26_0x49e31e[_0x864311(0x1a5)](_0x864311(0x22b))+'\x20'+_0x3320d9[_0x864311(0x1c4)]),console[_0x864311(0x15c)]('═'[_0x864311(0x200)](0x3c)),displayRealtimeValidation(_0x3320d9),console['error']('─'[_0x864311(0x200)](0x3c));if(_0x3320d9[_0x864311(0x286)][_0x864311(0x25b)]>0x0){console[_0x864311(0x15c)]('\x0a'+a26_0x49e31e[_0x864311(0x1f7)]('Errors:'));for(const _0x41a0ba of _0x3320d9[_0x864311(0x286)]){console[_0x864311(0x15c)]('\x20\x20'+a26_0x49e31e[_0x864311(0x1f7)]('•')+'\x20'+_0x41a0ba);}}return _0x3320d9[_0x864311(0x16c)]&&console[_0x864311(0x15c)]('\x0a'+a26_0x49e31e[_0x864311(0x256)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x3320d9[_0x864311(0x16c)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x162);[a26_0x5e5c22(0x14f)]='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async[a26_0x5e5c22(0x1f2)](_0x1d5c0d){const _0x19c36a=a26_0x5e5c22,{options:_0x492d68,args:_0x1bd1a6,tdx:_0x3e288f}=_0x1d5c0d,_0x535b7c=_0x1bd1a6[0x0]||_0x492d68['parentSegment'];if(!_0x535b7c)return showParentSegmentNotSetError(_0x19c36a(0x1f0)+_0x19c36a(0x16e)),0x1;const _0x11ec54=await withSpinner(_0x19c36a(0x1d4)+_0x535b7c+'\x27...',()=>_0x3e288f[_0x19c36a(0x21a)][_0x19c36a(0x1ac)](_0x535b7c),{'verbose':_0x492d68['verbose']}),_0x2f1091=_0x11ec54[_0x19c36a(0x27c)],_0xb7e556=await withSpinner(_0x19c36a(0x226)+_0x535b7c+_0x19c36a(0x263),()=>_0x3e288f[_0x19c36a(0x22d)]['list'](_0x2f1091),{'verbose':_0x492d68[_0x19c36a(0x1cc)]}),_0x3d6d75=_0xb7e556[_0x19c36a(0x27c)];console[_0x19c36a(0x15c)](_0x19c36a(0x208)+_0x3d6d75['length']+_0x19c36a(0x157)+(_0x3d6d75[_0x19c36a(0x25b)]!==0x1?'s':''));if(_0x492d68[_0x19c36a(0x179)]===_0x19c36a(0x1ba)||_0x492d68[_0x19c36a(0x179)]===_0x19c36a(0x1f9))await handleSDKOutput(_0x3d6d75,_0x492d68);else{if(_0x3d6d75[_0x19c36a(0x25b)]===0x0)console[_0x19c36a(0x282)]('No\x20personalization\x20services\x20configured'),console[_0x19c36a(0x15c)](a26_0x49e31e[_0x19c36a(0x29a)](_0x19c36a(0x188)));else for(const _0x4313e9 of _0x3d6d75){const _0xc67d00=_0x4313e9['sections']?.[_0x19c36a(0x25b)]||0x0,_0x5f3ee9=_0x4313e9['trigger_event']?a26_0x49e31e[_0x19c36a(0x25f)](_0x19c36a(0x1a9)+_0x4313e9[_0x19c36a(0x19e)]):'',_0x5d66c6=a26_0x49e31e[_0x19c36a(0x25f)]('\x20('+_0xc67d00+_0x19c36a(0x19d)+(_0xc67d00!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x4313e9['name']+_0x5f3ee9+_0x5d66c6),_0x4313e9[_0x19c36a(0x14f)]&&console[_0x19c36a(0x282)](_0x19c36a(0x198)+a26_0x49e31e[_0x19c36a(0x25f)](_0x4313e9[_0x19c36a(0x14f)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a26_0x5e5c22(0x1c4)]=a26_0x5e5c22(0x17b);['description']=a26_0x5e5c22(0x175);async[a26_0x5e5c22(0x1f2)](_0x50b7db){const _0x52e30b=a26_0x5e5c22,{options:_0x251e01,args:_0x457745}=_0x50b7db,_0x11078c=_0x457745[0x0]||_0x251e01[_0x52e30b(0x1c5)];if(!_0x11078c)return showParentSegmentNotSetError(_0x52e30b(0x184)+'\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 _0x239591=resolveYamlFile(_0x11078c);if(!existsSync(_0x239591))return showFileNotFoundError(_0x239591,_0x11078c),0x1;let _0x201894;try{_0x201894=readFileSync(_0x239591,'utf-8');}catch(_0x449e72){const _0x592b04=_0x449e72 instanceof Error?_0x449e72[_0x52e30b(0x20a)]:String(_0x449e72);return console[_0x52e30b(0x15c)](_0x52e30b(0x1d8)+_0x592b04),0x1;}let _0x2ff0d9;try{_0x2ff0d9=parseDef(_0x201894);}catch(_0x5b4936){const _0x49364a=_0x5b4936 instanceof Error?_0x5b4936[_0x52e30b(0x20a)]:String(_0x5b4936);return console[_0x52e30b(0x15c)](a26_0x49e31e[_0x52e30b(0x1f7)](_0x52e30b(0x1ad)+_0x49364a)),0x1;}if(_0x2ff0d9[_0x52e30b(0x1e1)]&&_0x2ff0d9[_0x52e30b(0x1e1)]['length']>0x0)return console[_0x52e30b(0x15c)](a26_0x49e31e[_0x52e30b(0x247)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x239591)),console['error'](a26_0x49e31e['dim'](_0x52e30b(0x199)+_0x2ff0d9[_0x52e30b(0x1e1)]['length']+_0x52e30b(0x1fe))),0x1;!_0x2ff0d9['realtime']&&(_0x2ff0d9['realtime']={'events':[{'name':_0x52e30b(0x13f),'source_table':_0x52e30b(0x11f)}],'attributes':[{'name':_0x52e30b(0x17a),'type':_0x52e30b(0x26c)}],'id_stitching':{'primary_key':_0x2ff0d9[_0x52e30b(0x160)][_0x52e30b(0x292)]==='customers'?_0x52e30b(0x287):_0x52e30b(0x1d2)}});_0x2ff0d9[_0x52e30b(0x1e1)]=[{'name':_0x52e30b(0x131),'description':_0x52e30b(0x291),'trigger_event':'page_view','sections':[{'name':'Default','criteria':'true','attributes':[_0x52e30b(0x17a)]}]}];const _0x1f6595=serializeDef(_0x2ff0d9);return writeFileSync(_0x239591,_0x1f6595,'utf-8'),console[_0x52e30b(0x15c)](a26_0x49e31e['green']('✔')+_0x52e30b(0x1ea)+a26_0x49e31e[_0x52e30b(0x29a)](_0x239591)),(!_0x2ff0d9['realtime']||_0x201894[_0x52e30b(0x18c)](_0x52e30b(0x190))===-0x1)&&console[_0x52e30b(0x15c)](a26_0x49e31e[_0x52e30b(0x256)]('✔')+_0x52e30b(0x21b)),console[_0x52e30b(0x15c)]('\x0a'+a26_0x49e31e[_0x52e30b(0x25f)]('Next\x20steps:')),console[_0x52e30b(0x15c)]('\x20\x201.\x20Edit\x20'+_0x239591+_0x52e30b(0x156)),console[_0x52e30b(0x15c)](_0x52e30b(0x12a)+a26_0x49e31e[_0x52e30b(0x25f)]('tdx\x20ps\x20push\x20'+_0x11078c)+_0x52e30b(0x233)),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_0x268624=a27_0x326c;(function(_0x4688a4,_0x4acda8){const _0x2a2689=a27_0x326c,_0x261a5f=_0x4688a4();while(!![]){try{const _0x1ffb9a=-parseInt(_0x2a2689(0x143))/0x1*(-parseInt(_0x2a2689(0xe9))/0x2)+-parseInt(_0x2a2689(0x11c))/0x3*(parseInt(_0x2a2689(0x127))/0x4)+-parseInt(_0x2a2689(0x14b))/0x5*(parseInt(_0x2a2689(0x11e))/0x6)+parseInt(_0x2a2689(0x147))/0x7+-parseInt(_0x2a2689(0x140))/0x8*(parseInt(_0x2a2689(0x103))/0x9)+-parseInt(_0x2a2689(0x137))/0xa+-parseInt(_0x2a2689(0x121))/0xb*(-parseInt(_0x2a2689(0x11d))/0xc);if(_0x1ffb9a===_0x4acda8)break;else _0x261a5f['push'](_0x261a5f['shift']());}catch(_0x580f76){_0x261a5f['push'](_0x261a5f['shift']());}}}(a27_0x3713,0xaf380));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_0x5e3b23 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a27_0x326c(_0x45e042,_0x71febb){_0x45e042=_0x45e042-0xe4;const _0x3713df=a27_0x3713();let _0x326c46=_0x3713df[_0x45e042];return _0x326c46;}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_0xbccee0 from'prompts';import a27_0xbae110 from'chalk';function validateProfileName(_0x41885c){const _0x1a0573=a27_0x326c;if(!_0x41885c||!_0x41885c[_0x1a0573(0xfd)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x41b5fa=_0x41885c['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x1a0573(0x14f)](_0x41b5fa))return _0x1a0573(0x107);if(profileExists(_0x41b5fa))return _0x1a0573(0x13a)+_0x41b5fa+_0x1a0573(0x109);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a27_0x268624(0xfe)]=a27_0x268624(0x12c);async['execute'](_0x3c3e7e){const _0x229122=a27_0x268624,{options:_0x204974,args:_0x178030}=_0x3c3e7e;console[_0x229122(0x129)](a27_0xbae110['bold'](_0x229122(0x139)));let _0x13ade2;if(_0x178030[_0x229122(0xeb)]>0x0&&_0x178030[0x0]){const _0x48eb05=_0x178030[0x0][_0x229122(0xfd)](),_0x230154=validateProfileName(_0x48eb05);if(_0x230154!==!![])return console['error'](a27_0xbae110[_0x229122(0x10f)](_0x230154)),0x1;_0x13ade2=_0x48eb05;}else{const _0x172728=await a27_0xbccee0({'type':_0x229122(0x13e),'name':_0x229122(0x14a),'message':_0x229122(0xf6),'validate':validateProfileName});if(!_0x172728[_0x229122(0x14a)])return console[_0x229122(0x129)](_0x229122(0xe6)),0x1;_0x13ade2=_0x172728[_0x229122(0x14a)][_0x229122(0xfd)]();}const _0x20b16c=await a27_0xbccee0({'type':_0x229122(0x13e),'name':_0x229122(0xfe),'message':_0x229122(0xf0)}),_0x1f125e=_0x20b16c[_0x229122(0xfe)]?.[_0x229122(0xfd)]()||undefined,_0x2efc8e=_0x204974[_0x229122(0x120)]||_0x229122(0x124),{choices:_0x3d4373,initialIndex:_0x274852}=buildSiteChoices(_0x2efc8e),_0x33a8fc=await a27_0xbccee0({'type':_0x229122(0x130),'name':'site','message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x13ade2+'\x27:','choices':_0x3d4373,'initial':_0x274852});if(!_0x33a8fc['site'])return console[_0x229122(0x129)](_0x229122(0xe6)),0x1;let _0x51b10a;if(_0x33a8fc[_0x229122(0x120)]===_0x229122(0xef)){const _0x232d68=await a27_0xbccee0({'type':'text','name':'customSite','message':_0x229122(0x134),'initial':'us01','validate':_0x1d7519=>{const _0x375cfa=_0x229122;if(!_0x1d7519||!_0x1d7519[_0x375cfa(0xfd)]())return _0x375cfa(0x131);if(!/^[a-z0-9-]+$/['test'](_0x1d7519[_0x375cfa(0xfd)]()))return _0x375cfa(0x111);return!![];}});if(!_0x232d68[_0x229122(0xfa)])return console[_0x229122(0x129)](_0x229122(0xe6)),0x1;_0x51b10a=_0x232d68[_0x229122(0xfa)];}else _0x51b10a=_0x33a8fc['site'];const _0x3dd82e=resolveSite(_0x51b10a);console[_0x229122(0x129)](_0x229122(0x112)+_0x3dd82e),console[_0x229122(0x129)](_0x229122(0x114)),console['log']('\x20\x20'+getConsoleUrl(_0x3dd82e,_0x229122(0x10c)));const _0x44a6e1=await a27_0xbccee0({'type':_0x229122(0x105),'name':_0x229122(0xed),'message':_0x229122(0x149),'validate':_0x283e3d=>{const _0x1b1f1f=_0x229122;if(!_0x283e3d||!_0x283e3d[_0x1b1f1f(0xfd)]())return _0x1b1f1f(0xf8);return!![];}});if(!_0x44a6e1[_0x229122(0xed)])return console[_0x229122(0x129)]('\x0aSetup\x20cancelled'),0x1;const _0x58ab2d=_0x44a6e1[_0x229122(0xed)];console['log'](_0x229122(0xe4));try{const _0x3b19b5=TDX[_0x229122(0x142)]({'site':_0x3dd82e,'apiKey':_0x58ab2d[_0x229122(0xfd)](),'logLevel':_0x204974[_0x229122(0x10e)]??LogLevel[_0x229122(0x106)]}),_0x5d3417=await _0x3b19b5[_0x229122(0x12f)][_0x229122(0x132)]();console[_0x229122(0x129)](a27_0xbae110[_0x229122(0xfc)]('✓')+_0x229122(0x104)+_0x5d3417[_0x229122(0x13f)]+')');const _0x5d755f=await isKeychainAvailable();_0x5d755f?(await saveAPIKeyAsync(_0x58ab2d[_0x229122(0xfd)](),_0x3dd82e,_0x13ade2),console[_0x229122(0x129)](a27_0xbae110['green']('✓')+_0x229122(0x118)+_0x13ade2+')')):(console['warn'](a27_0xbae110[_0x229122(0xf3)](_0x229122(0x113))),console[_0x229122(0x12a)](a27_0xbae110['yellow'](_0x229122(0x136))));const _0x2b5092={'site':_0x3dd82e,..._0x1f125e&&{'description':_0x1f125e}};return saveProfileToUserConfig(_0x13ade2,_0x2b5092),console[_0x229122(0x129)](a27_0xbae110[_0x229122(0xfc)]('✓')+_0x229122(0x141)+_0x13ade2+_0x229122(0xf7)),console[_0x229122(0x129)](),console[_0x229122(0x129)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log'](_0x229122(0x146)+_0x13ade2+_0x229122(0x115)),console[_0x229122(0x129)](_0x229122(0x146)+_0x13ade2+_0x229122(0x125)),0x0;}catch(_0xf438e9){if(_0xf438e9 instanceof HTTPClientError&&_0xf438e9[_0x229122(0xf2)]===0x191)return printAuthError(_0xf438e9),0x1;return console[_0x229122(0xe7)](a27_0xbae110[_0x229122(0x10f)](_0x229122(0x138)+(_0xf438e9 instanceof Error?_0xf438e9[_0x229122(0x128)]:String(_0xf438e9)))),console[_0x229122(0xe7)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}function a27_0x3713(){const _0x178300=['24wvOqQj','11706vmNXOx','split','site','10038050aqGMUs','\x27\x20updated:\x20','\x0aOperation\x20cancelled','us01','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','tdx:\x20profile\x20set','17548jdJsUZ','message','log','warn','Set\x20a\x20profile\x20configuration\x20value','Create\x20a\x20new\x20profile','bold','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','jobs','select','Site\x20name\x20cannot\x20be\x20empty','getUserInfo','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Enter\x20site\x20name:','Failed\x20to\x20remove\x20profile:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','946990WvhEZH','✗\x20Validation\x20failed:\x20','tdx:\x20profile\x20create','Profile\x20\x27','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','llm_agent','profile:remove','text','email','2728jiorHV','\x20Profile\x20\x27','create','32rapjCL','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20removed\x20from\x20configuration','\x20\x20tdx\x20--profile\x20','8074696KKnmOC','join','Enter\x20your\x20TD\x20API\x20key:','profileName','1295npdBWz','tdx:\x20profile\x20remove','Remove\x20a\x20profile','\x20--default\x27\x20to\x20save\x20permanently','test','validate','\x20\x20-\x20','Validating\x20API\x20key...','\x20\x20(no\x20profiles\x20found)','\x0aSetup\x20cancelled','error','profile:set','7702duBppv','\x0aAvailable\x20profiles:','length','dim','apiKey','\x27.\x0a\x0aValid\x20keys:\x20','other','Enter\x20description\x20(optional):','VALID_KEYS','status','yellow','(session:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Enter\x20profile\x20name:','\x27\x20created','API\x20key\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.','customSite','profile','green','trim','description','config','confirm','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Default\x20profile\x20set\x20to:\x20','36900EfrNwJ','\x20API\x20key\x20is\x20valid\x20(User:\x20','password','ERROR','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','\x27\x20does\x20not\x20exist.\x20Create\x20it?','name','/app/mp/ak','database','logLevel','red','llm_project','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','(cleared)','includes','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','session','execute','264aJsWVM'];a27_0x3713=function(){return _0x178300;};return a27_0x3713();}export class ProfileRemoveCommand extends BaseCommand{[a27_0x268624(0x10b)]=a27_0x268624(0x13d);[a27_0x268624(0xfe)]=a27_0x268624(0x14d);[a27_0x268624(0x150)](_0x26acf8){const _0x559f72=a27_0x268624,{args:_0x4ab24b}=_0x26acf8;if(_0x4ab24b[_0x559f72(0xeb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a27_0x268624(0x11b)](_0x1a250d){const _0x1785c6=a27_0x268624,{args:_0x35a09d}=_0x1a250d,_0x1b1d85=_0x35a09d[0x0];console[_0x1785c6(0x129)](a27_0xbae110[_0x1785c6(0x12d)](_0x1785c6(0x14c)));if(!profileExists(_0x1b1d85)){console[_0x1785c6(0xe7)](a27_0xbae110['red'](_0x1785c6(0x13a)+_0x1b1d85+_0x1785c6(0xf9))),console[_0x1785c6(0x129)](_0x1785c6(0xea));const _0x417dbc=listProfiles();if(_0x417dbc[_0x1785c6(0xeb)]===0x0)console[_0x1785c6(0x129)](_0x1785c6(0xe5));else for(const _0x447f05 of _0x417dbc){console[_0x1785c6(0x129)](_0x1785c6(0x151)+_0x447f05['name']);}return 0x1;}const _0x4d7fea=await a27_0xbccee0({'type':'confirm','name':'confirm','message':_0x1785c6(0x108)+_0x1b1d85+'\x27?','initial':![]});if(!_0x4d7fea[_0x1785c6(0x100)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x1b1d85),console[_0x1785c6(0x129)](a27_0xbae110[_0x1785c6(0xfc)]('✓')+_0x1785c6(0x141)+_0x1b1d85+_0x1785c6(0x145));}catch(_0x570ab5){return console[_0x1785c6(0xe7)](a27_0xbae110[_0x1785c6(0x10f)](_0x1785c6(0x135)+(_0x570ab5 instanceof Error?_0x570ab5[_0x1785c6(0x128)]:String(_0x570ab5)))),0x1;}const _0x364feb=await isKeychainAvailable();if(_0x364feb){const _0x5f3404=await deleteKeychainAPIKey(_0x1b1d85);_0x5f3404&&console['log'](a27_0xbae110[_0x1785c6(0xfc)]('✓')+_0x1785c6(0x101));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a27_0x268624(0x10b)]=a27_0x268624(0xe8);['description']=a27_0x268624(0x12b);static [a27_0x268624(0xf1)]=[a27_0x268624(0x120),a27_0x268624(0x10d),'parent_segment',a27_0x268624(0x110),a27_0x268624(0x13c),a27_0x268624(0xfe)];[a27_0x268624(0x150)](_0x5bf701){const _0x528acb=a27_0x268624,{args:_0x551e26,options:_0x2454ed}=_0x5bf701,_0x5f781e=_0x2454ed[_0x528acb(0xfb)]||getActiveProfile();if(!_0x5f781e)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x551e26[_0x528acb(0xeb)]===0x0)return _0x528acb(0x12e)+ProfileSetCommand[_0x528acb(0xf1)][_0x528acb(0x148)](',\x20');const _0x24e0da=_0x551e26[0x0];if(!_0x24e0da[_0x528acb(0x117)]('='))return _0x528acb(0x133)+ProfileSetCommand['VALID_KEYS'][_0x528acb(0x148)](',\x20');const [_0x4e4a73]=_0x24e0da['split']('=',0x2);if(!ProfileSetCommand[_0x528acb(0xf1)][_0x528acb(0x117)](_0x4e4a73))return'Unknown\x20key\x20\x27'+_0x4e4a73+_0x528acb(0xee)+ProfileSetCommand[_0x528acb(0xf1)][_0x528acb(0x148)](',\x20');return undefined;}async[a27_0x268624(0x11b)](_0x30eb8b){const _0x402328=a27_0x268624,{args:_0x534470,options:_0x27599a}=_0x30eb8b,_0x493ada=_0x27599a[_0x402328(0xfb)]||getActiveProfile(),[_0x519fc2,..._0x3465e2]=_0x534470[0x0][_0x402328(0x11f)]('='),_0x5dcc56=_0x3465e2[_0x402328(0x148)]('=');console['log'](a27_0xbae110[_0x402328(0x12d)](_0x402328(0x126)));if(!profileExists(_0x493ada)){const _0x1931cd=await a27_0xbccee0({'type':_0x402328(0x100),'name':_0x402328(0x142),'message':_0x402328(0x13a)+_0x493ada+_0x402328(0x10a),'initial':!![]});if(!_0x1931cd['create'])return console[_0x402328(0x129)]('Operation\x20cancelled'),0x1;}const _0x35115b=loadProfile(_0x493ada),_0x125b1f=_0x35115b?.[_0x402328(0xff)]||{};if(_0x519fc2===_0x402328(0x120)){const _0x45bb60=resolveSite(_0x5dcc56);console[_0x402328(0x129)]('Changing\x20site\x20to\x20\x27'+_0x45bb60+_0x402328(0x144)),console['log'](_0x402328(0x13b)),console[_0x402328(0x129)]('\x20\x20'+getConsoleUrl(_0x45bb60,_0x402328(0x10c)));const _0x2ed799=await a27_0xbccee0({'type':'password','name':_0x402328(0xed),'message':_0x402328(0x119),'validate':_0x360c7d=>{const _0x56c299=_0x402328;if(!_0x360c7d||!_0x360c7d['trim']())return _0x56c299(0xf8);return!![];}});if(!_0x2ed799[_0x402328(0xed)])return console[_0x402328(0x129)](_0x402328(0x123)),0x1;console[_0x402328(0x129)](_0x402328(0xe4));try{const _0x5a03d7=TDX[_0x402328(0x142)]({'site':_0x45bb60,'apiKey':_0x2ed799['apiKey'][_0x402328(0xfd)](),'logLevel':_0x27599a[_0x402328(0x10e)]??LogLevel['ERROR']}),_0x4a04b9=await _0x5a03d7['jobs'][_0x402328(0x132)]();console[_0x402328(0x129)](a27_0xbae110[_0x402328(0xfc)]('✓')+_0x402328(0x104)+_0x4a04b9[_0x402328(0x13f)]+')');const _0x3d7024=await isKeychainAvailable();_0x3d7024?(await saveAPIKeyAsync(_0x2ed799[_0x402328(0xed)][_0x402328(0xfd)](),_0x45bb60,_0x493ada),console['log'](a27_0xbae110['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x402328(0x12a)](a27_0xbae110['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x125b1f['site']=_0x45bb60;}catch(_0x447523){if(_0x447523 instanceof HTTPClientError&&_0x447523[_0x402328(0xf2)]===0x191)return printAuthError(_0x447523),0x1;return console[_0x402328(0xe7)](a27_0xbae110[_0x402328(0x10f)]('✗\x20Validation\x20failed:\x20'+(_0x447523 instanceof Error?_0x447523[_0x402328(0x128)]:String(_0x447523)))),console[_0x402328(0xe7)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x125b1f[_0x519fc2]=_0x5dcc56||undefined;return saveProfileToUserConfig(_0x493ada,_0x125b1f),console[_0x402328(0x129)](a27_0xbae110[_0x402328(0xfc)]('✓')+_0x402328(0x141)+_0x493ada+_0x402328(0x122)+_0x519fc2+'='+(_0x5dcc56||_0x402328(0x116))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a27_0x268624(0x10b)]='profile:use';[a27_0x268624(0xfe)]='Set\x20session\x20profile';['validate'](_0x305a09){const _0x3fd5d6=a27_0x268624,{args:_0x4f31f9}=_0x305a09;if(_0x4f31f9[_0x3fd5d6(0xeb)]===0x0)return _0x3fd5d6(0xf5);return undefined;}async[a27_0x268624(0x11b)](_0x11ba34){const _0x43d6f0=a27_0x268624,{args:_0x1bc1e0,options:_0xff1ac4}=_0x11ba34,_0x54a1fb=_0x1bc1e0[0x0],_0xec969b=_0xff1ac4['default'];cleanExpiredSessions();if(!profileExists(_0x54a1fb)){console[_0x43d6f0(0xe7)](a27_0xbae110[_0x43d6f0(0x10f)]('Profile\x20\x27'+_0x54a1fb+_0x43d6f0(0xf9))),console[_0x43d6f0(0x129)](_0x43d6f0(0xea));const _0x1641b5=listProfiles();if(_0x1641b5[_0x43d6f0(0xeb)]===0x0)console['log'](_0x43d6f0(0xe5));else for(const _0x3f88ba of _0x1641b5){console['log'](_0x43d6f0(0x151)+_0x3f88ba[_0x43d6f0(0x10b)]);}return 0x1;}if(_0xec969b){const _0x46bfd2=a27_0x5e3b23[_0x43d6f0(0x148)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x54a1fb),console[_0x43d6f0(0x129)](_0x43d6f0(0x102)+a27_0xbae110['green'](_0x54a1fb)),console[_0x43d6f0(0x129)](a27_0xbae110[_0x43d6f0(0xec)]('\x0aSaved\x20to:\x20'+_0x46bfd2)),0x0;}const _0x30f294=getSessionID(_0xff1ac4['session']);return saveSessionContext({'profile':_0x54a1fb},_0xff1ac4[_0x43d6f0(0x11a)]),console[_0x43d6f0(0x129)]('Session\x20profile\x20set\x20to:\x20'+a27_0xbae110['green'](_0x54a1fb)+'\x20'+a27_0xbae110[_0x43d6f0(0xec)](_0x43d6f0(0xf4)+_0x30f294+')')),console[_0x43d6f0(0x129)](a27_0xbae110['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x54a1fb+_0x43d6f0(0x14e))),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
+ const a28_0x4f43a6=a28_0x4132;(function(_0x55300c,_0x2f7cf4){const _0x2c223b=a28_0x4132,_0x51a8a8=_0x55300c();while(!![]){try{const _0x45b967=parseInt(_0x2c223b(0x1ce))/0x1+parseInt(_0x2c223b(0x1d9))/0x2+parseInt(_0x2c223b(0x1da))/0x3*(-parseInt(_0x2c223b(0x1de))/0x4)+-parseInt(_0x2c223b(0x1dc))/0x5+parseInt(_0x2c223b(0x1d5))/0x6+parseInt(_0x2c223b(0x1df))/0x7*(parseInt(_0x2c223b(0x1d3))/0x8)+-parseInt(_0x2c223b(0x1cc))/0x9*(parseInt(_0x2c223b(0x1d4))/0xa);if(_0x45b967===_0x2f7cf4)break;else _0x51a8a8['push'](_0x51a8a8['shift']());}catch(_0x389eae){_0x51a8a8['push'](_0x51a8a8['shift']());}}}(a28_0xad8f,0x8b9f5));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a28_0x4132(_0x3ce98a,_0x61c458){_0x3ce98a=_0x3ce98a-0x1cb;const _0xad8f4b=a28_0xad8f();let _0x413251=_0xad8f4b[_0x3ce98a];return _0x413251;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a28_0x4f43a6(0x1cf)]=a28_0x4f43a6(0x1d6);[a28_0x4f43a6(0x1db)]=a28_0x4f43a6(0x1d7);async['execute'](_0x3b969c){const _0xab5259=a28_0x4f43a6,{options:_0x540798}=_0x3b969c;try{const _0x19005d=listProfiles(),_0x2e8362=getActiveProfile();if(_0x19005d[_0xab5259(0x1dd)]===0x0)return console[_0xab5259(0x1cd)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0xab5259(0x1cd)](_0xab5259(0x1d1)),console[_0xab5259(0x1cd)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2aa2cc=_0x19005d[_0xab5259(0x1d2)](_0x14bacb=>{const _0x488594=_0xab5259,_0x5abb4c=_0x14bacb[_0x488594(0x1cf)]===_0x2e8362,_0x4ce6c9=getProfileParams(_0x14bacb[_0x488594(0x1cb)]);return{'name':_0x14bacb['name'],'active':_0x5abb4c,'scope':_0x14bacb[_0x488594(0x1d0)],'description':_0x14bacb[_0x488594(0x1cb)]['description']||'','params':_0x4ce6c9};});return await handleSDKOutput(_0x2aa2cc,_0x540798),0x0;}catch(_0xfb94d8){return _0xfb94d8 instanceof Error&&console[_0xab5259(0x1d8)]('Error:\x20'+_0xfb94d8['message']),0x1;}}}function a28_0xad8f(){const _0x1e9286=['name','scope','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','map','10424NhgzhB','6521170EsCeHa','490872BwzopU','profiles','List\x20all\x20available\x20profiles','error','2039812xGcvfF','2168772QHWJNr','description','2718375ZpeUYX','length','4BOFnTi','2338IgFJkq','config','9oqOItC','log','953689OoPPGC'];a28_0xad8f=function(){return _0x1e9286;};return a28_0xad8f();}
@@ -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
+ function a29_0x2278(){const _0x376c9e=['1779KZbnxa','totalSplits','data','\x20-\x20','setJobId','22CpJKzp','267790ccQWZe','Executing\x20statement\x20','\x20rows\x20','in\x20','Error:\x20','Statement\x20','args','validate','join','database','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','verbose','state','completedSplits','originalMessage','message','No\x20SQL\x20provided','jobId','215839Wqfbvg','Executing\x20query\x20[','1465674KecGxz','setExtra','Schema:\x20','execute','Run\x20Trino\x20queries\x20(streaming)','elapsedTimeMillis','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Catalog:\x20','Query\x20completed:\x20Processed\x20','push','497DiePxO','query','length','Executing\x20query...','\x20splits','2172ucOHgY','stats','processedRows','error','45974vVWafa','5DcUlcD','...','SQL:\x20','output','description','17236571xpuXXL','site','file','69656mFRPtM','9FvDShc','information_schema','5164nfyzGW'];a29_0x2278=function(){return _0x376c9e;};return a29_0x2278();}const a29_0x39d704=a29_0x4832;(function(_0x10e371,_0x2d9a53){const _0x393b6f=a29_0x4832,_0x161c4f=_0x10e371();while(!![]){try{const _0x3bc6fa=parseInt(_0x393b6f(0x1dd))/0x1*(-parseInt(_0x393b6f(0x1cb))/0x2)+parseInt(_0x393b6f(0x1d8))/0x3*(parseInt(_0x393b6f(0x1d7))/0x4)+-parseInt(_0x393b6f(0x1cc))/0x5*(parseInt(_0x393b6f(0x1f2))/0x6)+parseInt(_0x393b6f(0x1c2))/0x7*(-parseInt(_0x393b6f(0x1d4))/0x8)+-parseInt(_0x393b6f(0x1d5))/0x9*(parseInt(_0x393b6f(0x1de))/0xa)+-parseInt(_0x393b6f(0x1d1))/0xb+parseInt(_0x393b6f(0x1c7))/0xc*(parseInt(_0x393b6f(0x1f0))/0xd);if(_0x3bc6fa===_0x2d9a53)break;else _0x161c4f['push'](_0x161c4f['shift']());}catch(_0x2f32f2){_0x161c4f['push'](_0x161c4f['shift']());}}}(a29_0x2278,0xc5748));import{BaseCommand}from'./command.js';function a29_0x4832(_0x55a2ba,_0x4e725b){_0x55a2ba=_0x55a2ba-0x1c0;const _0x22783c=a29_0x2278();let _0x483250=_0x22783c[_0x55a2ba];return _0x483250;}import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a29_0x39d704(0x1c3);[a29_0x39d704(0x1d0)]=a29_0x39d704(0x1f6);async[a29_0x39d704(0x1f5)](_0x2069ca){const _0x1d3488=a29_0x39d704,{options:_0x4b20fa,args:_0x5f4f26,tdx:_0x43d264}=_0x2069ca,_0x5eb63d=_0x5f4f26[0x0],_0x51e2e6=_0x4b20fa[_0x1d3488(0x1d3)];let _0x224914;try{if(_0x51e2e6)_0x224914=readSqlStatementsFromFile(_0x51e2e6);else{if(_0x5eb63d==='-')_0x224914=await readSqlStatementsFromStdin();else{if(_0x5eb63d&&isSqlFilePath(_0x5eb63d))_0x224914=readSqlStatementsFromFile(_0x5eb63d);else{if(_0x5eb63d)_0x224914=splitSqlStatements(_0x5eb63d);else throw new Error(_0x1d3488(0x1ee));}}}}catch(_0x237e0f){return console['error'](_0x1d3488(0x1e2)+_0x237e0f[_0x1d3488(0x1ed)]),0x1;}const _0x2ea784=_0x4b20fa[_0x1d3488(0x1e7)]||_0x1d3488(0x1d6),_0x452a44=_0x4b20fa['catalog'];try{const _0xf81ad1=[],_0x4f1a0d=!!_0x4b20fa['output'];for(let _0x39a3eb=0x0;_0x39a3eb<_0x224914[_0x1d3488(0x1c4)];_0x39a3eb++){const _0x105567=_0x224914[_0x39a3eb],_0x115c09=_0x39a3eb+0x1,_0x224c5a=_0x224914['length'],_0xf12c0a=_0x224c5a>0x1;_0x4b20fa['verbose']&&(console[_0x1d3488(0x1ca)]('\x0a'+(_0xf12c0a?_0x1d3488(0x1e3)+_0x115c09+'/'+_0x224c5a+':':'')),console['error']('Site:\x20'+_0x4b20fa[_0x1d3488(0x1d2)]),console[_0x1d3488(0x1ca)](_0x1d3488(0x1f9)+(_0x452a44||'td')),console['error'](_0x1d3488(0x1f4)+_0x2ea784),console[_0x1d3488(0x1ca)](_0x1d3488(0x1ce)+_0x105567));const _0x54cceb=_0xf12c0a?_0x1d3488(0x1df)+_0x115c09+'/'+_0x224c5a+_0x1d3488(0x1cd):_0x1d3488(0x1c5);try{const _0x3bbe32=await withProgressSpinner(_0x54cceb,async _0x3a0786=>{const _0x10883e=_0x1d3488,_0x5a3925=await _0x43d264[_0x10883e(0x1c3)][_0x10883e(0x1f5)](_0x105567,{'catalog':_0x452a44,'schema':_0x2ea784,'onJobId':_0x6b0e1d=>{const _0x44d506=_0x10883e;_0x3a0786[_0x44d506(0x1dc)](_0x6b0e1d);},'onProgress':_0x221b44=>{const _0x25f7a5=_0x10883e;_0x3a0786['setPhase'](_0x25f7a5(0x1f1)+_0x221b44[_0x25f7a5(0x1ea)]+']'),_0x3a0786[_0x25f7a5(0x1f3)](formatRows(_0x221b44[_0x25f7a5(0x1c9)])+_0x25f7a5(0x1e0)+_0x221b44[_0x25f7a5(0x1eb)]+'/'+_0x221b44[_0x25f7a5(0x1d9)]+_0x25f7a5(0x1c6));}});return _0x5a3925;},{'verbose':_0x4b20fa[_0x1d3488(0x1e9)]}),_0x1d2523=_0x3bbe32[_0x1d3488(0x1da)],_0x3e22d3=_0x1d2523[_0x1d3488(0x1ef)]?'\x20[Job\x20ID:\x20'+_0x1d2523[_0x1d3488(0x1ef)]+']':'',_0x31b3b7=_0xf12c0a?_0x1d3488(0x1e3)+_0x115c09+'/'+_0x224c5a+_0x1d3488(0x1db):'';console[_0x1d3488(0x1ca)]('✔\x20'+_0x31b3b7+_0x1d3488(0x1c0)+formatRows(_0x1d2523[_0x1d3488(0x1c8)][_0x1d3488(0x1c9)])+_0x1d3488(0x1e0)+(_0x1d3488(0x1e1)+formatElapsed(_0x1d2523['stats'][_0x1d3488(0x1f7)])+_0x3e22d3));if(_0xf12c0a&&_0x4f1a0d){const _0x2ea0bb=resolveOutputOptions(_0x4b20fa),_0x42477c=await formatQueryOutput(_0x1d2523,_0x2ea0bb);_0xf81ad1[_0x1d3488(0x1c1)](_0x42477c);}else await handleQueryOutput(_0x1d2523,_0x4b20fa);}catch(_0x1a13a4){const _0x36aa13=_0xf12c0a?_0x1d3488(0x1e3)+_0x115c09+'/'+_0x224c5a+':\x0a':'',_0x10327e=_0x1a13a4 instanceof SDKError?_0x1a13a4[_0x1d3488(0x1ec)]:_0x1a13a4['message'];return console['error'](''+_0x36aa13+_0x10327e),0x1;}}if(_0x224914[_0x1d3488(0x1c4)]>0x1&&_0x4f1a0d&&_0xf81ad1[_0x1d3488(0x1c4)]>0x0){const _0x4eda10=_0xf81ad1[_0x1d3488(0x1e6)]('\x0a');writeFileSync(_0x4b20fa[_0x1d3488(0x1cf)],_0x4eda10),console[_0x1d3488(0x1ca)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x4b20fa[_0x1d3488(0x1cf)]);}return 0x0;}catch(_0x281c3e){throw _0x281c3e;}}[a29_0x39d704(0x1e5)](_0x122ba3){const _0x51d3bf=a29_0x39d704,_0x130471=_0x122ba3[_0x51d3bf(0x1e4)][0x0],_0x5c4dad=_0x122ba3['options'][_0x51d3bf(0x1d3)];if(!_0x130471&&!_0x5c4dad)return _0x51d3bf(0x1e8);if(_0x130471&&_0x5c4dad)return _0x51d3bf(0x1f8);return undefined;}}