@treasuredata/tdx 0.8.3 → 0.8.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 (141) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/engage-api-client.js +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/rate-limiter.js +1 -1
  12. package/dist/client/td-api-client.js +1 -1
  13. package/dist/client/trino-api-client.js +1 -1
  14. package/dist/client/workflow-client.js +1 -1
  15. package/dist/commands/activations.js +1 -1
  16. package/dist/commands/api-command.js +1 -1
  17. package/dist/commands/auth-command.js +1 -1
  18. package/dist/commands/chat-command.js +1 -1
  19. package/dist/commands/claude-command.js +1 -1
  20. package/dist/commands/claude-statusline-command.js +1 -1
  21. package/dist/commands/claude-usage-command.js +1 -1
  22. package/dist/commands/command.js +1 -1
  23. package/dist/commands/connection-command.js +1 -1
  24. package/dist/commands/context-command.js +1 -1
  25. package/dist/commands/databases.js +1 -1
  26. package/dist/commands/describe.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/llm-proxy.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profiles-command.js +1 -1
  33. package/dist/commands/query-command.d.ts.map +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/query-command.js.map +1 -1
  36. package/dist/commands/segment-command.d.ts.map +1 -1
  37. package/dist/commands/segment-command.js +1 -1
  38. package/dist/commands/segment-command.js.map +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.d.ts.map +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js.map +1 -1
  44. package/dist/commands/segment-push-command.d.ts.map +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-push-command.js.map +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segments.d.ts.map +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/segments.js.map +1 -1
  52. package/dist/commands/show.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/config.js +1 -1
  59. package/dist/core/connection-cache.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/profile.js +1 -1
  64. package/dist/core/project-config.js +1 -1
  65. package/dist/core/session.js +1 -1
  66. package/dist/core/user-cache.js +1 -1
  67. package/dist/index.js +1 -1
  68. package/dist/proxy/anthropic-adapter.d.ts +10 -2
  69. package/dist/proxy/anthropic-adapter.d.ts.map +1 -1
  70. package/dist/proxy/anthropic-adapter.js +1 -1
  71. package/dist/proxy/anthropic-adapter.js.map +1 -1
  72. package/dist/proxy/claude-usage-tracker.js +1 -1
  73. package/dist/proxy/context-signature.js +1 -1
  74. package/dist/proxy/conversation-utils.js +1 -1
  75. package/dist/proxy/server.js +1 -1
  76. package/dist/proxy/session-cache.js +1 -1
  77. package/dist/sdk/api.js +1 -1
  78. package/dist/sdk/connection.js +1 -1
  79. package/dist/sdk/engage.js +1 -1
  80. package/dist/sdk/errors.d.ts +18 -0
  81. package/dist/sdk/errors.d.ts.map +1 -1
  82. package/dist/sdk/errors.js +1 -1
  83. package/dist/sdk/errors.js.map +1 -1
  84. package/dist/sdk/index.js +1 -1
  85. package/dist/sdk/job.js +1 -1
  86. package/dist/sdk/llm.js +1 -1
  87. package/dist/sdk/query.js +1 -1
  88. package/dist/sdk/segment/child-segment-yaml.d.ts +24 -5
  89. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  90. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  91. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  92. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  93. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  94. package/dist/sdk/segment.js +1 -1
  95. package/dist/sdk/user.js +1 -1
  96. package/dist/sdk/workflow.js +1 -1
  97. package/dist/types/endpoints.js +1 -1
  98. package/dist/types/index.d.ts +1 -0
  99. package/dist/types/index.d.ts.map +1 -1
  100. package/dist/types/index.js +1 -1
  101. package/dist/utils/agent-ref-parser.js +1 -1
  102. package/dist/utils/async.js +1 -1
  103. package/dist/utils/chat-cache.js +1 -1
  104. package/dist/utils/colors.js +1 -1
  105. package/dist/utils/command-output.js +1 -1
  106. package/dist/utils/constants.js +1 -1
  107. package/dist/utils/diff.js +1 -1
  108. package/dist/utils/fields-display.js +1 -1
  109. package/dist/utils/file-permissions.js +1 -1
  110. package/dist/utils/format-detector.js +1 -1
  111. package/dist/utils/formatters.js +1 -1
  112. package/dist/utils/json-loader.js +1 -1
  113. package/dist/utils/llm-backup-utils.js +1 -1
  114. package/dist/utils/model-aliases.js +1 -1
  115. package/dist/utils/model-factors.js +1 -1
  116. package/dist/utils/option-validation.js +1 -1
  117. package/dist/utils/port.js +1 -1
  118. package/dist/utils/process.d.ts +6 -0
  119. package/dist/utils/process.d.ts.map +1 -1
  120. package/dist/utils/process.js +1 -1
  121. package/dist/utils/process.js.map +1 -1
  122. package/dist/utils/prompt.js +1 -1
  123. package/dist/utils/segment-path-parser.js +1 -1
  124. package/dist/utils/segment-ref-parser.js +1 -1
  125. package/dist/utils/spinner.js +1 -1
  126. package/dist/utils/sql-parser.d.ts +37 -1
  127. package/dist/utils/sql-parser.d.ts.map +1 -1
  128. package/dist/utils/sql-parser.js +1 -1
  129. package/dist/utils/sql-parser.js.map +1 -1
  130. package/dist/utils/sse-parser.js +1 -1
  131. package/dist/utils/string-utils.js +1 -1
  132. package/dist/utils/table-ref-parser.js +1 -1
  133. package/dist/utils/tdx-config.js +1 -1
  134. package/dist/utils/tdx-logger.js +1 -1
  135. package/dist/utils/tree-formatter.d.ts +4 -0
  136. package/dist/utils/tree-formatter.d.ts.map +1 -1
  137. package/dist/utils/tree-formatter.js +1 -1
  138. package/dist/utils/tree-formatter.js.map +1 -1
  139. package/dist/utils/version-check.js +1 -1
  140. package/dist/utils/workflow-utils.js +1 -1
  141. package/package.json +3 -3
@@ -1 +1 @@
1
- const a24_0x181ee4=a24_0xed7f;(function(_0x377cbf,_0xbeb5fc){const _0x405e00=a24_0xed7f,_0x2b5731=_0x377cbf();while(!![]){try{const _0x4ab7c4=-parseInt(_0x405e00(0x155))/0x1*(parseInt(_0x405e00(0x15a))/0x2)+parseInt(_0x405e00(0x135))/0x3+-parseInt(_0x405e00(0x142))/0x4+parseInt(_0x405e00(0x14d))/0x5*(-parseInt(_0x405e00(0x149))/0x6)+parseInt(_0x405e00(0x134))/0x7+parseInt(_0x405e00(0x12d))/0x8+parseInt(_0x405e00(0x12f))/0x9;if(_0x4ab7c4===_0xbeb5fc)break;else _0x2b5731['push'](_0x2b5731['shift']());}catch(_0x16c36a){_0x2b5731['push'](_0x2b5731['shift']());}}}(a24_0x1ebe,0x2a2b3));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a24_0x1ebe(){const _0x1953ab=['Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','hive','file','1753536VDfeeM','yes','2124792OzQvPa','Database:\x20','length','status','job:result','795690HwOuxv','561090znfHTY','Submitting\x20job...','priority','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','\x20\x20Job\x20ID:\x20','verbose','Limit:\x20','query','Usage:\x20job\x20kill\x20<job-id>','job:kill','Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file','job_id','Getting\x20job\x20results...','1309168RYRZlW','description','name','round','list','information_schema','✔\x20Retrieved\x20','6QkzoOI','✔\x20Found\x20','user_name','debug','534070NUiylV','database','type','\x20\x20Cause:\x20','Get\x20job\x20results','\x20job','end_at','job:show','149151immlnl','Kill\x20a\x20job','Status\x20filter:\x20','map','Submitting\x20kill\x20request...','2ASAsTf','substring','show','Listing\x20jobs...','\x27\x20to\x20verify\x20the\x20job\x20status','✔\x20Job\x20submitted','trino','jobType','Error:\x20Job\x20ID\x20is\x20required','execute','start_at','limit','kill','data','\x20row','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','message','submit','url','Error:\x20','Getting\x20job\x20details...','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','jobs','Error:\x20Query\x20is\x20required','created_at','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','cause','\x20jobs','error','getTime','Show\x20job\x20details','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20'];a24_0x1ebe=function(){return _0x1953ab;};return a24_0x1ebe();}function a24_0xed7f(_0x3baf61,_0x51b01a){_0x3baf61=_0x3baf61-0x11c;const _0x1ebeb1=a24_0x1ebe();let _0xed7fca=_0x1ebeb1[_0x3baf61];return _0xed7fca;}import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{[a24_0x181ee4(0x144)]=a24_0x181ee4(0x120);[a24_0x181ee4(0x143)]='List\x20jobs';async[a24_0x181ee4(0x163)](_0x18b516){const _0x34ee93=a24_0x181ee4,{options:_0x7f035b,tdx:_0x103eec}=_0x18b516;try{const _0x1949d3=resolveLimit(_0x7f035b[_0x34ee93(0x165)],DEFAULT_DISPLAY_LIMIT),_0x12e920=_0x7f035b[_0x34ee93(0x132)];_0x7f035b[_0x34ee93(0x13a)]&&(console[_0x34ee93(0x126)](_0x34ee93(0x13b)+_0x1949d3+_0x34ee93(0x125)),_0x12e920&&console['error'](_0x34ee93(0x157)+_0x12e920));const _0x18dd37=await withSpinner(_0x34ee93(0x15d),()=>_0x103eec['jobs'][_0x34ee93(0x146)]({'from':0x0,'to':_0x1949d3-0x1,'status':_0x12e920}),{'verbose':_0x7f035b['verbose']}),_0x48cbf6=_0x18dd37['data'];console[_0x34ee93(0x126)](_0x34ee93(0x14a)+_0x48cbf6['length']+_0x34ee93(0x152)+(_0x48cbf6[_0x34ee93(0x131)]!==0x1?'s':''));const _0x1ca9c5=_0x48cbf6[_0x34ee93(0x158)](_0x16088f=>{const _0x4f5ffb=_0x34ee93;let _0x9fd511;if(_0x16088f[_0x4f5ffb(0x164)]&&_0x16088f['end_at']){const _0x5c0689=new Date(_0x16088f[_0x4f5ffb(0x164)])[_0x4f5ffb(0x127)](),_0x5ee78c=new Date(_0x16088f['end_at'])[_0x4f5ffb(0x127)]();_0x9fd511=Math[_0x4f5ffb(0x145)]((_0x5ee78c-_0x5c0689)/0x3e8);}return{'job_id':_0x16088f[_0x4f5ffb(0x140)],'type':_0x16088f[_0x4f5ffb(0x14f)],'status':_0x16088f[_0x4f5ffb(0x132)],'user_name':_0x16088f['user_name'],'duration_sec':_0x9fd511,'created_at':_0x16088f['created_at'],'started_at':_0x16088f[_0x4f5ffb(0x164)],'end_at':_0x16088f[_0x4f5ffb(0x153)]};});return await handleSDKOutput(_0x1ca9c5,_0x7f035b),0x0;}catch(_0x6230d9){if(_0x6230d9 instanceof SDKError)return console[_0x34ee93(0x126)]('Error:\x20'+_0x6230d9[_0x34ee93(0x16a)]),_0x6230d9['cause']&&console[_0x34ee93(0x126)](_0x34ee93(0x150)+_0x6230d9[_0x34ee93(0x124)]),0x1;throw _0x6230d9;}}}export class JobShowCommand extends BaseCommand{[a24_0x181ee4(0x144)]=a24_0x181ee4(0x154);['description']=a24_0x181ee4(0x128);async[a24_0x181ee4(0x163)](_0x47eb57){const _0x3bb643=a24_0x181ee4,{options:_0x1ca863,args:_0x3b6f8f,tdx:_0x334c6d}=_0x47eb57,_0x4a68f7=_0x3b6f8f[0x0];if(!_0x4a68f7)return console['error'](_0x3bb643(0x162)),console[_0x3bb643(0x126)]('Usage:\x20job\x20show\x20<job-id>'),0x1;try{const _0x15a212=await withSpinner(_0x3bb643(0x11e),()=>_0x334c6d[_0x3bb643(0x120)][_0x3bb643(0x15c)](_0x4a68f7),{'verbose':_0x1ca863[_0x3bb643(0x13a)]}),_0x4f08b4=_0x15a212['data'];let _0x1aa796;if(_0x4f08b4['start_at']&&_0x4f08b4[_0x3bb643(0x153)]){const _0xc0fa1b=new Date(_0x4f08b4[_0x3bb643(0x164)])[_0x3bb643(0x127)](),_0x5dde3c=new Date(_0x4f08b4[_0x3bb643(0x153)])[_0x3bb643(0x127)]();_0x1aa796=Math[_0x3bb643(0x145)]((_0x5dde3c-_0xc0fa1b)/0x3e8);}const _0x3ec0a8={'job_id':_0x4f08b4[_0x3bb643(0x140)],'type':_0x4f08b4[_0x3bb643(0x14f)],'status':_0x4f08b4['status'],..._0x4f08b4[_0x3bb643(0x14b)]&&{'user_name':_0x4f08b4[_0x3bb643(0x14b)]},..._0x1aa796!==undefined&&{'duration_sec':_0x1aa796},..._0x4f08b4[_0x3bb643(0x122)]&&{'created_at':_0x4f08b4[_0x3bb643(0x122)]},..._0x4f08b4['start_at']&&{'started_at':_0x4f08b4['start_at']},..._0x4f08b4['end_at']&&{'end_at':_0x4f08b4[_0x3bb643(0x153)]},..._0x4f08b4[_0x3bb643(0x14e)]&&{'database':_0x4f08b4[_0x3bb643(0x14e)]},..._0x4f08b4[_0x3bb643(0x137)]!==undefined&&{'priority':_0x4f08b4['priority']},..._0x4f08b4[_0x3bb643(0x11c)]&&{'url':_0x4f08b4[_0x3bb643(0x11c)]},..._0x4f08b4[_0x3bb643(0x13c)]&&{'query':_0x4f08b4['query']},..._0x4f08b4[_0x3bb643(0x14c)]&&{'debug':_0x4f08b4[_0x3bb643(0x14c)]}};return await handleSingleObjectOutput(_0x3ec0a8,_0x1ca863),0x0;}catch(_0x524c09){if(_0x524c09 instanceof SDKError)return console[_0x3bb643(0x126)]('Error:\x20'+_0x524c09[_0x3bb643(0x16a)]),_0x524c09[_0x3bb643(0x124)]&&console[_0x3bb643(0x126)](_0x3bb643(0x150)+_0x524c09[_0x3bb643(0x124)]),0x1;throw _0x524c09;}}}export class JobKillCommand extends BaseCommand{[a24_0x181ee4(0x144)]=a24_0x181ee4(0x13e);['description']=a24_0x181ee4(0x156);async[a24_0x181ee4(0x163)](_0x171905){const _0x93eed0=a24_0x181ee4,{options:_0x2dc028,args:_0x462f63,tdx:_0x5b8327}=_0x171905,_0x4233a0=_0x462f63[0x0];if(!_0x4233a0)return console['error'](_0x93eed0(0x162)),console[_0x93eed0(0x126)](_0x93eed0(0x13d)),0x1;try{if(!_0x2dc028[_0x93eed0(0x12e)]){const _0x200a4c=await confirm(_0x93eed0(0x12a)+_0x4233a0+'?');if(!_0x200a4c)return console[_0x93eed0(0x126)]('Cancelled'),0x0;}return await withSpinner(_0x93eed0(0x159),()=>_0x5b8327[_0x93eed0(0x120)][_0x93eed0(0x166)](_0x4233a0),{'verbose':_0x2dc028['verbose']}),console['error'](_0x93eed0(0x138)+_0x4233a0),console[_0x93eed0(0x126)](_0x93eed0(0x129)+_0x4233a0+_0x93eed0(0x15e)),0x0;}catch(_0x4c6baf){if(_0x4c6baf instanceof SDKError)return console[_0x93eed0(0x126)](_0x93eed0(0x11d)+_0x4c6baf[_0x93eed0(0x16a)]),_0x4c6baf['cause']&&console[_0x93eed0(0x126)](_0x93eed0(0x150)+_0x4c6baf[_0x93eed0(0x124)]),0x1;throw _0x4c6baf;}}}export class JobSubmitCommand extends BaseCommand{['name']='job:submit';[a24_0x181ee4(0x143)]='Submit\x20a\x20job';async[a24_0x181ee4(0x163)](_0x4f89be){const _0x3d1a67=a24_0x181ee4,{options:_0x27a4c8,args:_0x1741a9,tdx:_0x4b8752}=_0x4f89be;try{const _0x421f9b=_0x27a4c8[_0x3d1a67(0x161)]||_0x3d1a67(0x160),_0x1c6586=_0x27a4c8[_0x3d1a67(0x12c)],_0x2abc26=_0x27a4c8[_0x3d1a67(0x14e)]||_0x3d1a67(0x147);if(_0x421f9b!=='trino'&&_0x421f9b!==_0x3d1a67(0x12b))return console[_0x3d1a67(0x126)](_0x3d1a67(0x11f)),0x1;let _0x1133b6;if(_0x1c6586){if(_0x1741a9[0x0])return console[_0x3d1a67(0x126)](_0x3d1a67(0x123)),0x1;const _0x1188a6=readSqlStatementsFromFile(_0x1c6586);if(_0x1188a6[_0x3d1a67(0x131)]===0x0)return console[_0x3d1a67(0x126)](_0x3d1a67(0x13f)),0x1;if(_0x1188a6[_0x3d1a67(0x131)]>0x1)return console[_0x3d1a67(0x126)](_0x3d1a67(0x169)),0x1;_0x1133b6=_0x1188a6[0x0];}else{if(!_0x1741a9[0x0])return console['error'](_0x3d1a67(0x121)),console[_0x3d1a67(0x126)]('Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>'),0x1;_0x1133b6=_0x1741a9[0x0];}_0x27a4c8[_0x3d1a67(0x13a)]&&(console['error']('Job\x20type:\x20'+_0x421f9b),console['error'](_0x3d1a67(0x130)+_0x2abc26),console['error']('Query:\x20'+_0x1133b6[_0x3d1a67(0x15b)](0x0,0x64)+(_0x1133b6['length']>0x64?'...':'')));const _0xf130ff=await withSpinner(_0x3d1a67(0x136),()=>_0x4b8752[_0x3d1a67(0x120)][_0x3d1a67(0x16b)](_0x2abc26,_0x1133b6,_0x421f9b),{'verbose':_0x27a4c8[_0x3d1a67(0x13a)]}),_0x1aa7ee=_0xf130ff['data'];return console[_0x3d1a67(0x126)](_0x3d1a67(0x15f)),console[_0x3d1a67(0x126)](_0x3d1a67(0x139)+_0x1aa7ee[_0x3d1a67(0x140)]),await handleSDKOutput([_0x1aa7ee],_0x27a4c8),0x0;}catch(_0x37f64e){if(_0x37f64e instanceof SDKError)return console[_0x3d1a67(0x126)]('Error:\x20'+_0x37f64e['message']),_0x37f64e[_0x3d1a67(0x124)]&&console[_0x3d1a67(0x126)](_0x3d1a67(0x150)+_0x37f64e[_0x3d1a67(0x124)]),0x1;throw _0x37f64e;}}}export class JobResultCommand extends BaseCommand{[a24_0x181ee4(0x144)]=a24_0x181ee4(0x133);[a24_0x181ee4(0x143)]=a24_0x181ee4(0x151);async[a24_0x181ee4(0x163)](_0x53d728){const _0x25eb02=a24_0x181ee4,{options:_0x21dea2,args:_0x515fbb,tdx:_0x548e2e}=_0x53d728,_0x2bc548=_0x515fbb[0x0];if(!_0x2bc548)return console[_0x25eb02(0x126)](_0x25eb02(0x162)),console[_0x25eb02(0x126)]('Usage:\x20job\x20result\x20<job-id>'),0x1;try{const _0x4cb212=await withSpinner(_0x25eb02(0x141),()=>_0x548e2e[_0x25eb02(0x120)]['result'](_0x2bc548),{'verbose':_0x21dea2[_0x25eb02(0x13a)]}),_0x594b31=_0x4cb212[_0x25eb02(0x167)];return console[_0x25eb02(0x126)](_0x25eb02(0x148)+_0x594b31[_0x25eb02(0x131)]+_0x25eb02(0x168)+(_0x594b31[_0x25eb02(0x131)]!==0x1?'s':'')),await handleSDKOutput(_0x594b31,_0x21dea2),0x0;}catch(_0x3f01b6){if(_0x3f01b6 instanceof SDKError)return console[_0x25eb02(0x126)](_0x25eb02(0x11d)+_0x3f01b6[_0x25eb02(0x16a)]),_0x3f01b6[_0x25eb02(0x124)]&&console['error']('\x20\x20Cause:\x20'+_0x3f01b6[_0x25eb02(0x124)]),0x1;throw _0x3f01b6;}}}
1
+ const a24_0x4bb1db=a24_0x1f0b;function a24_0x33c9(){const _0x13f2e7=['Usage:\x20job\x20submit\x20<query>\x20or\x20job\x20submit\x20--file\x20<path>','38478DyHONP','3LIjXiJ','end_at','Error:\x20Job\x20ID\x20is\x20required','execute','status','8592HpVQFK','job:kill','description','length','list','trino','file','Usage:\x20job\x20show\x20<job-id>','Error:\x20--job-type\x20must\x20be\x20either\x20\x22trino\x22\x20or\x20\x22hive\x22','priority','✔\x20Kill\x20request\x20submitted\x20for\x20job\x20','...','Submitting\x20job...','job_id','Usage:\x20job\x20kill\x20<job-id>','query','4673780lnlfJW','Submitting\x20kill\x20request...','verbose','168RuDzfm','Database:\x20','✔\x20Found\x20','round','Usage:\x20job\x20result\x20<job-id>','\x27\x20to\x20verify\x20the\x20job\x20status','getTime','List\x20jobs','Getting\x20job\x20details...','\x20\x20Note:\x20Use\x20\x27tdx\x20job\x20show\x20','✔\x20Retrieved\x20','hive','job:submit','jobs','\x20\x20Cause:\x20','128737zWNWBF','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20job\x20','start_at','url','database','Submit\x20a\x20job','job:show','kill','Listing\x20jobs...','2335020nPfPeL','name','Error:\x20','Status\x20filter:\x20','type','information_schema','jobType','✔\x20Job\x20submitted','Error:\x20Cannot\x20specify\x20both\x20query\x20argument\x20and\x20--file\x20option','811912hwXFQE','created_at','limit','error','user_name','Get\x20job\x20results','\x20job','\x20row','Getting\x20job\x20results...','debug','message','Kill\x20a\x20job','Error:\x20Multiple\x20SQL\x20statements\x20found\x20in\x20file.\x20Only\x20one\x20statement\x20is\x20allowed\x20for\x20job\x20submission.','36PnojKo','cause','\x20jobs','905841IfjQJE','data','result','Cancelled','Error:\x20Query\x20is\x20required'];a24_0x33c9=function(){return _0x13f2e7;};return a24_0x33c9();}(function(_0x4e8c61,_0x2ce112){const _0x260eef=a24_0x1f0b,_0x413d1a=_0x4e8c61();while(!![]){try{const _0x5ef095=-parseInt(_0x260eef(0xb5))/0x1*(-parseInt(_0x260eef(0xac))/0x2)+parseInt(_0x260eef(0xb6))/0x3*(parseInt(_0x260eef(0x9f))/0x4)+-parseInt(_0x260eef(0x96))/0x5+parseInt(_0x260eef(0xce))/0x6*(-parseInt(_0x260eef(0x8d))/0x7)+-parseInt(_0x260eef(0xbb))/0x8+parseInt(_0x260eef(0xaf))/0x9+parseInt(_0x260eef(0xcb))/0xa;if(_0x5ef095===_0x2ce112)break;else _0x413d1a['push'](_0x413d1a['shift']());}catch(_0x3ba37a){_0x413d1a['push'](_0x413d1a['shift']());}}}(a24_0x33c9,0x75547));import{BaseCommand}from'./command.js';function a24_0x1f0b(_0x19d24e,_0x4309ee){_0x19d24e=_0x19d24e-0x87;const _0x33c93c=a24_0x33c9();let _0x1f0b24=_0x33c93c[_0x19d24e];return _0x1f0b24;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{readSqlStatementsFromFile}from'../utils/sql-parser.js';import{confirm}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';export class JobListCommand extends BaseCommand{['name']='jobs';[a24_0x4bb1db(0xbd)]=a24_0x4bb1db(0xd5);async[a24_0x4bb1db(0xb9)](_0x5cc254){const _0x3edf4e=a24_0x4bb1db,{options:_0x25f6b4,tdx:_0x3d025a}=_0x5cc254;try{const _0x26cc3f=resolveLimit(_0x25f6b4[_0x3edf4e(0xa1)],DEFAULT_DISPLAY_LIMIT),_0x2269dc=_0x25f6b4[_0x3edf4e(0xba)];_0x25f6b4['verbose']&&(console[_0x3edf4e(0xa2)]('Limit:\x20'+_0x26cc3f+_0x3edf4e(0xae)),_0x2269dc&&console[_0x3edf4e(0xa2)](_0x3edf4e(0x99)+_0x2269dc));const _0x44673d=await withSpinner(_0x3edf4e(0x95),()=>_0x3d025a[_0x3edf4e(0x8b)][_0x3edf4e(0xbf)]({'from':0x0,'to':_0x26cc3f-0x1,'status':_0x2269dc}),{'verbose':_0x25f6b4['verbose']}),_0x581f9f=_0x44673d[_0x3edf4e(0xb0)];console[_0x3edf4e(0xa2)](_0x3edf4e(0xd0)+_0x581f9f[_0x3edf4e(0xbe)]+_0x3edf4e(0xa5)+(_0x581f9f[_0x3edf4e(0xbe)]!==0x1?'s':''));const _0xeff1dd=_0x581f9f['map'](_0x4fd1a5=>{const _0x494640=_0x3edf4e;let _0x1ecf4f;if(_0x4fd1a5['start_at']&&_0x4fd1a5[_0x494640(0xb7)]){const _0x3cfac5=new Date(_0x4fd1a5['start_at'])['getTime'](),_0x2a6937=new Date(_0x4fd1a5[_0x494640(0xb7)])['getTime']();_0x1ecf4f=Math['round']((_0x2a6937-_0x3cfac5)/0x3e8);}return{'job_id':_0x4fd1a5[_0x494640(0xc8)],'type':_0x4fd1a5[_0x494640(0x9a)],'status':_0x4fd1a5[_0x494640(0xba)],'user_name':_0x4fd1a5[_0x494640(0xa3)],'duration_sec':_0x1ecf4f,'created_at':_0x4fd1a5[_0x494640(0xa0)],'started_at':_0x4fd1a5[_0x494640(0x8f)],'end_at':_0x4fd1a5[_0x494640(0xb7)]};});return await handleSDKOutput(_0xeff1dd,_0x25f6b4),0x0;}catch(_0x54c406){if(_0x54c406 instanceof SDKError)return console[_0x3edf4e(0xa2)](_0x3edf4e(0x98)+_0x54c406['message']),_0x54c406[_0x3edf4e(0xad)]&&console[_0x3edf4e(0xa2)]('\x20\x20Cause:\x20'+_0x54c406[_0x3edf4e(0xad)]),0x1;throw _0x54c406;}}}export class JobShowCommand extends BaseCommand{[a24_0x4bb1db(0x97)]=a24_0x4bb1db(0x93);['description']='Show\x20job\x20details';async[a24_0x4bb1db(0xb9)](_0x59909f){const _0x256206=a24_0x4bb1db,{options:_0x3d2b85,args:_0x43ba7a,tdx:_0x5eb2d1}=_0x59909f,_0x44a6fc=_0x43ba7a[0x0];if(!_0x44a6fc)return console['error'](_0x256206(0xb8)),console[_0x256206(0xa2)](_0x256206(0xc2)),0x1;try{const _0x21694f=await withSpinner(_0x256206(0xd6),()=>_0x5eb2d1['jobs']['show'](_0x44a6fc),{'verbose':_0x3d2b85[_0x256206(0xcd)]}),_0x15ec9e=_0x21694f[_0x256206(0xb0)];let _0xc7de2;if(_0x15ec9e[_0x256206(0x8f)]&&_0x15ec9e[_0x256206(0xb7)]){const _0x51e244=new Date(_0x15ec9e[_0x256206(0x8f)])[_0x256206(0xd4)](),_0x58b546=new Date(_0x15ec9e[_0x256206(0xb7)])['getTime']();_0xc7de2=Math[_0x256206(0xd1)]((_0x58b546-_0x51e244)/0x3e8);}const _0x333ac3={'job_id':_0x15ec9e[_0x256206(0xc8)],'type':_0x15ec9e[_0x256206(0x9a)],'status':_0x15ec9e[_0x256206(0xba)],..._0x15ec9e[_0x256206(0xa3)]&&{'user_name':_0x15ec9e[_0x256206(0xa3)]},..._0xc7de2!==undefined&&{'duration_sec':_0xc7de2},..._0x15ec9e['created_at']&&{'created_at':_0x15ec9e[_0x256206(0xa0)]},..._0x15ec9e[_0x256206(0x8f)]&&{'started_at':_0x15ec9e[_0x256206(0x8f)]},..._0x15ec9e[_0x256206(0xb7)]&&{'end_at':_0x15ec9e[_0x256206(0xb7)]},..._0x15ec9e['database']&&{'database':_0x15ec9e[_0x256206(0x91)]},..._0x15ec9e[_0x256206(0xc4)]!==undefined&&{'priority':_0x15ec9e[_0x256206(0xc4)]},..._0x15ec9e['url']&&{'url':_0x15ec9e[_0x256206(0x90)]},..._0x15ec9e[_0x256206(0xca)]&&{'query':_0x15ec9e[_0x256206(0xca)]},..._0x15ec9e[_0x256206(0xa8)]&&{'debug':_0x15ec9e[_0x256206(0xa8)]}};return await handleSingleObjectOutput(_0x333ac3,_0x3d2b85),0x0;}catch(_0xeaa06e){if(_0xeaa06e instanceof SDKError)return console[_0x256206(0xa2)]('Error:\x20'+_0xeaa06e[_0x256206(0xa9)]),_0xeaa06e['cause']&&console[_0x256206(0xa2)](_0x256206(0x8c)+_0xeaa06e[_0x256206(0xad)]),0x1;throw _0xeaa06e;}}}export class JobKillCommand extends BaseCommand{[a24_0x4bb1db(0x97)]=a24_0x4bb1db(0xbc);[a24_0x4bb1db(0xbd)]=a24_0x4bb1db(0xaa);async[a24_0x4bb1db(0xb9)](_0x526a45){const _0x43c73c=a24_0x4bb1db,{options:_0x190d67,args:_0x1c611e,tdx:_0x3be961}=_0x526a45,_0x2870be=_0x1c611e[0x0];if(!_0x2870be)return console[_0x43c73c(0xa2)](_0x43c73c(0xb8)),console[_0x43c73c(0xa2)](_0x43c73c(0xc9)),0x1;try{if(!_0x190d67['yes']){const _0x2b1842=await confirm(_0x43c73c(0x8e)+_0x2870be+'?');if(!_0x2b1842)return console[_0x43c73c(0xa2)](_0x43c73c(0xb2)),0x0;}return await withSpinner(_0x43c73c(0xcc),()=>_0x3be961['jobs'][_0x43c73c(0x94)](_0x2870be),{'verbose':_0x190d67[_0x43c73c(0xcd)]}),console['error'](_0x43c73c(0xc5)+_0x2870be),console['error'](_0x43c73c(0x87)+_0x2870be+_0x43c73c(0xd3)),0x0;}catch(_0x4bccf3){if(_0x4bccf3 instanceof SDKError)return console[_0x43c73c(0xa2)](_0x43c73c(0x98)+_0x4bccf3[_0x43c73c(0xa9)]),_0x4bccf3['cause']&&console[_0x43c73c(0xa2)](_0x43c73c(0x8c)+_0x4bccf3[_0x43c73c(0xad)]),0x1;throw _0x4bccf3;}}}export class JobSubmitCommand extends BaseCommand{['name']=a24_0x4bb1db(0x8a);['description']=a24_0x4bb1db(0x92);async[a24_0x4bb1db(0xb9)](_0x57ba3c){const _0x117aa7=a24_0x4bb1db,{options:_0x405c58,args:_0xb8fc6e,tdx:_0x3c32ec}=_0x57ba3c;try{const _0x4fa390=_0x405c58[_0x117aa7(0x9c)]||_0x117aa7(0xc0),_0x106c22=_0x405c58[_0x117aa7(0xc1)],_0x2c5564=_0x405c58[_0x117aa7(0x91)]||_0x117aa7(0x9b);if(_0x4fa390!=='trino'&&_0x4fa390!==_0x117aa7(0x89))return console['error'](_0x117aa7(0xc3)),0x1;let _0xbdc4d9;if(_0x106c22){if(_0xb8fc6e[0x0])return console[_0x117aa7(0xa2)](_0x117aa7(0x9e)),0x1;const _0x39b789=readSqlStatementsFromFile(_0x106c22);if(_0x39b789[_0x117aa7(0xbe)]===0x0)return console[_0x117aa7(0xa2)]('Error:\x20No\x20SQL\x20statements\x20found\x20in\x20file'),0x1;if(_0x39b789[_0x117aa7(0xbe)]>0x1)return console[_0x117aa7(0xa2)](_0x117aa7(0xab)),0x1;_0xbdc4d9=_0x39b789[0x0];}else{if(!_0xb8fc6e[0x0])return console[_0x117aa7(0xa2)](_0x117aa7(0xb3)),console['error'](_0x117aa7(0xb4)),0x1;_0xbdc4d9=_0xb8fc6e[0x0];}_0x405c58['verbose']&&(console[_0x117aa7(0xa2)]('Job\x20type:\x20'+_0x4fa390),console[_0x117aa7(0xa2)](_0x117aa7(0xcf)+_0x2c5564),console[_0x117aa7(0xa2)]('Query:\x20'+_0xbdc4d9['substring'](0x0,0x64)+(_0xbdc4d9['length']>0x64?_0x117aa7(0xc6):'')));const _0x36dcc1=await withSpinner(_0x117aa7(0xc7),()=>_0x3c32ec[_0x117aa7(0x8b)]['submit'](_0x2c5564,_0xbdc4d9,_0x4fa390),{'verbose':_0x405c58['verbose']}),_0x5e824e=_0x36dcc1[_0x117aa7(0xb0)];return console['error'](_0x117aa7(0x9d)),console[_0x117aa7(0xa2)]('\x20\x20Job\x20ID:\x20'+_0x5e824e[_0x117aa7(0xc8)]),await handleSDKOutput([_0x5e824e],_0x405c58),0x0;}catch(_0x55c903){if(_0x55c903 instanceof SDKError)return console[_0x117aa7(0xa2)]('Error:\x20'+_0x55c903[_0x117aa7(0xa9)]),_0x55c903['cause']&&console['error'](_0x117aa7(0x8c)+_0x55c903[_0x117aa7(0xad)]),0x1;throw _0x55c903;}}}export class JobResultCommand extends BaseCommand{[a24_0x4bb1db(0x97)]='job:result';['description']=a24_0x4bb1db(0xa4);async[a24_0x4bb1db(0xb9)](_0x4e4142){const _0x36fee1=a24_0x4bb1db,{options:_0xceca33,args:_0x18e325,tdx:_0x27b4c6}=_0x4e4142,_0x16116f=_0x18e325[0x0];if(!_0x16116f)return console[_0x36fee1(0xa2)]('Error:\x20Job\x20ID\x20is\x20required'),console[_0x36fee1(0xa2)](_0x36fee1(0xd2)),0x1;try{const _0xbd6b8f=await withSpinner(_0x36fee1(0xa7),()=>_0x27b4c6[_0x36fee1(0x8b)][_0x36fee1(0xb1)](_0x16116f),{'verbose':_0xceca33[_0x36fee1(0xcd)]}),_0x4e7b31=_0xbd6b8f[_0x36fee1(0xb0)];return console[_0x36fee1(0xa2)](_0x36fee1(0x88)+_0x4e7b31[_0x36fee1(0xbe)]+_0x36fee1(0xa6)+(_0x4e7b31[_0x36fee1(0xbe)]!==0x1?'s':'')),await handleSDKOutput(_0x4e7b31,_0xceca33),0x0;}catch(_0x8cfd47){if(_0x8cfd47 instanceof SDKError)return console[_0x36fee1(0xa2)]('Error:\x20'+_0x8cfd47[_0x36fee1(0xa9)]),_0x8cfd47['cause']&&console['error'](_0x36fee1(0x8c)+_0x8cfd47[_0x36fee1(0xad)]),0x1;throw _0x8cfd47;}}}
@@ -1 +1 @@
1
- const a25_0x59ba4d=a25_0x12fd;(function(_0x29e7ed,_0x5ecab3){const _0x40c1ee=a25_0x12fd,_0x1fbfef=_0x29e7ed();while(!![]){try{const _0x25a58c=-parseInt(_0x40c1ee(0x28e))/0x1*(parseInt(_0x40c1ee(0x255))/0x2)+parseInt(_0x40c1ee(0x242))/0x3*(-parseInt(_0x40c1ee(0x21c))/0x4)+parseInt(_0x40c1ee(0x28a))/0x5*(parseInt(_0x40c1ee(0x251))/0x6)+parseInt(_0x40c1ee(0x228))/0x7+parseInt(_0x40c1ee(0x1ff))/0x8+-parseInt(_0x40c1ee(0x1f8))/0x9*(-parseInt(_0x40c1ee(0x27e))/0xa)+-parseInt(_0x40c1ee(0x26e))/0xb*(parseInt(_0x40c1ee(0x22c))/0xc);if(_0x25a58c===_0x5ecab3)break;else _0x1fbfef['push'](_0x1fbfef['shift']());}catch(_0x45fcd4){_0x1fbfef['push'](_0x1fbfef['shift']());}}}(a25_0x5cfd,0xa351e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a25_0x53556e from'node:fs';function handleSDKError(_0x428c19,_0x449255){const _0x116dea=a25_0x12fd;if(_0x428c19 instanceof SDKError)console[_0x116dea(0x222)](_0x116dea(0x1ed)+_0x428c19[_0x116dea(0x230)]),_0x449255[_0x116dea(0x27f)]&&(_0x428c19[_0x116dea(0x29c)]&&console[_0x116dea(0x222)]('\x20\x20Cause:\x20'+_0x428c19[_0x116dea(0x29c)]),_0x428c19['stack']&&(console[_0x116dea(0x222)](_0x116dea(0x25a)),console['error'](_0x428c19[_0x116dea(0x277)])));else throw _0x428c19;}function a25_0x12fd(_0x3f04a8,_0x5725a6){_0x3f04a8=_0x3f04a8-0x1e4;const _0x5cfd19=a25_0x5cfd();let _0x12fdc2=_0x5cfd19[_0x3f04a8];return _0x12fdc2;}function formatChatHistoryEntry(_0xde3e9f,_0x1ddc5f){const _0x415d8e=a25_0x12fd,_0x31b429=getChalk(_0x1ddc5f),_0x3ce457=_0x31b429[_0x415d8e(0x1f0)](_0xde3e9f['at']);if(_0x415d8e(0x27b)in _0xde3e9f){const _0x14e8db=_0x31b429[_0x415d8e(0x237)](_0x415d8e(0x248));return _0x3ce457+'\x20'+_0x14e8db+':\x20'+_0xde3e9f['input'];}if(_0x415d8e(0x243)in _0xde3e9f){const _0x545df=_0x31b429[_0x415d8e(0x1f3)](_0x415d8e(0x201));return _0x3ce457+'\x20'+_0x545df+':\x20'+_0xde3e9f['content'];}if(_0x415d8e(0x1ef)in _0xde3e9f){const _0x42322c=_0x31b429[_0x415d8e(0x2a2)]('[tool_call]'),{functionName:_0xecb80d,functionArguments:_0x53a195,targetFunction:_0xd2b425}=_0xde3e9f[_0x415d8e(0x1ef)];let _0x375a27=_0x3ce457+'\x20'+_0x42322c+':\x20'+_0x31b429[_0x415d8e(0x20b)](_0xecb80d);if(_0x53a195&&Object[_0x415d8e(0x1f1)](_0x53a195)[_0x415d8e(0x29e)]>0x0){const _0x441af7=Object[_0x415d8e(0x2aa)](_0x53a195)[_0x415d8e(0x23f)](([_0x2f9d3e,_0x32fb57])=>_0x2f9d3e+'='+JSON[_0x415d8e(0x2ad)](_0x32fb57))[_0x415d8e(0x227)](',\x20');_0x375a27+='('+_0x441af7+')';}_0xd2b425&&(_0x375a27+=_0x31b429[_0x415d8e(0x1f0)]('\x20['+_0xd2b425+']'));let _0x4aba67='';if(_0xde3e9f[_0x415d8e(0x1ef)]['targetKnowledgeBase'])_0x4aba67='\x20->\x20KB:'+_0xde3e9f[_0x415d8e(0x1ef)][_0x415d8e(0x29a)][_0x415d8e(0x212)];else{if(_0xde3e9f[_0x415d8e(0x1ef)][_0x415d8e(0x29b)])_0x4aba67=_0x415d8e(0x298)+_0xde3e9f['tool_call'][_0x415d8e(0x29b)]['name'];else{if(_0xde3e9f['tool_call'][_0x415d8e(0x288)])_0x4aba67=_0x415d8e(0x22a)+_0xde3e9f['tool_call'][_0x415d8e(0x288)][_0x415d8e(0x212)];else _0xde3e9f[_0x415d8e(0x1ef)][_0x415d8e(0x2a5)]&&(_0x4aba67=_0x415d8e(0x2a1)+_0xde3e9f[_0x415d8e(0x1ef)][_0x415d8e(0x2a5)]['name']);}}return _0x375a27+_0x4aba67;}if(_0x415d8e(0x232)in _0xde3e9f){const _0x523b17=_0x31b429[_0x415d8e(0x21a)](_0x415d8e(0x210)),{functionName:_0x50b43c,functionArguments:_0x576abb,content:_0x416500,newChat:_0x2cf0a6}=_0xde3e9f['tool'];let _0x5c24e4=_0x3ce457+'\x20'+_0x523b17+':\x20'+_0x31b429[_0x415d8e(0x20b)](_0x50b43c);if(_0x576abb){const _0x4e5edc=typeof _0x576abb===_0x415d8e(0x26a)?_0x576abb:JSON[_0x415d8e(0x2ad)](_0x576abb);_0x5c24e4+='('+_0x4e5edc+')';}return _0x416500&&(_0x5c24e4+='\x0a'+_0x31b429[_0x415d8e(0x1f0)](_0x416500)),_0x2cf0a6&&(_0x5c24e4+=_0x31b429[_0x415d8e(0x1f0)](_0x415d8e(0x246)+_0x2cf0a6['id'])),_0x5c24e4;}if(_0x415d8e(0x264)in _0xde3e9f){const _0x154f9a=_0x31b429[_0x415d8e(0x257)](_0x415d8e(0x24a));return _0x3ce457+'\x20'+_0x154f9a+':\x20'+_0xde3e9f[_0x415d8e(0x264)][_0x415d8e(0x212)]+'\x20('+_0xde3e9f[_0x415d8e(0x264)][_0x415d8e(0x243)][_0x415d8e(0x29e)]+_0x415d8e(0x25b);}if(_0x415d8e(0x240)in _0xde3e9f){const _0x10427b=_0x31b429[_0x415d8e(0x257)](_0x415d8e(0x2ac)),{width:_0x1819ed,height:_0x51ccfe,headerText:_0x4a6c01}=_0xde3e9f[_0x415d8e(0x240)],_0x2ddb72=_0x4a6c01?_0x415d8e(0x27d)+_0x4a6c01:'';return _0x3ce457+'\x20'+_0x10427b+':\x20'+_0x1819ed+'x'+_0x51ccfe+_0x2ddb72;}if(_0x415d8e(0x222)in _0xde3e9f){const _0x19bf6f=_0x31b429[_0x415d8e(0x24e)]('[error]\x20\x20');return _0x3ce457+'\x20'+_0x19bf6f+':\x20'+_0xde3e9f[_0x415d8e(0x222)];}return _0x3ce457+'\x20'+_0x31b429['dim']('[unknown]')+':\x20'+JSON[_0x415d8e(0x2ad)](_0xde3e9f);}async function executeChatHistoryCommand(_0x2ab11b,_0x2e7a94){const _0x235c7e=a25_0x12fd,{options:_0x20d01c,args:_0x2555d4,tdx:_0x37250b}=_0x2ab11b,_0x27e295=_0x2555d4[0x0],_0x5640a2=_0x20d01c,_0x4035ec=_0x5640a2[_0x235c7e(0x1f7)];try{if(_0x4035ec&&_0x27e295)return console['error'](_0x235c7e(0x2a4)),console[_0x235c7e(0x222)]('Usage:\x20'+_0x2e7a94+'\x20--last'),0x1;if(!_0x27e295&&!_0x4035ec&&_0x20d01c[_0x235c7e(0x2a8)]!==undefined){const _0x285a24=resolveLimit(_0x20d01c[_0x235c7e(0x216)],DEFAULT_LLM_LIMIT),_0x180957=await withSpinner(_0x235c7e(0x292),()=>_0x37250b[_0x235c7e(0x22d)]['chats'](_0x285a24),{'verbose':_0x20d01c[_0x235c7e(0x27f)]});return await handleSDKOutput(_0x180957[_0x235c7e(0x1fd)],_0x20d01c),0x0;}const _0x3a8548=await getChatIdOrSelect(_0x37250b,_0x20d01c,_0x4035ec,_0x27e295);if(!_0x3a8548)return 0x0;return await displayChatHistory(_0x3a8548,_0x37250b,_0x20d01c),0x0;}catch(_0x5b1f12){return handleSDKError(_0x5b1f12,_0x20d01c),0x1;}}async function displayChatHistory(_0x2803f3,_0x5d2ad6,_0x3164bb){const _0x3da393=a25_0x12fd,_0xfa8d1b=await withSpinner(_0x3da393(0x218)+_0x2803f3+_0x3da393(0x25c),()=>_0x5d2ad6[_0x3da393(0x22d)]['history'](_0x2803f3),{'verbose':_0x3164bb[_0x3da393(0x27f)]}),_0x5c8a61=_0xfa8d1b['data'][_0x3da393(0x1fd)]??[];if(_0x5c8a61[_0x3da393(0x29e)]===0x0){console[_0x3da393(0x224)]('No\x20messages\x20found\x20in\x20chat\x20history.');return;}if(_0x3164bb['format']!==undefined)await handleSDKOutput(_0x5c8a61,_0x3164bb);else{const _0x5e1fcb=_0x5c8a61['map'](_0x504dab=>formatChatHistoryEntry(_0x504dab,_0x3164bb)),_0x587aaf=_0x5e1fcb[_0x3da393(0x227)]('\x0a');await writeOutput(_0x587aaf,_0x3164bb[_0x3da393(0x264)],'table');}}async function getChatIdOrSelect(_0x5d4edb,_0x5a63ab,_0x393745,_0x4488d8){const _0x29fd60=a25_0x12fd;if(_0x4488d8)return _0x4488d8;if(_0x393745){const _0x4b2539=await withSpinner(_0x29fd60(0x280),()=>_0x5d4edb[_0x29fd60(0x22d)][_0x29fd60(0x1fc)](0x1),{'verbose':_0x5a63ab[_0x29fd60(0x27f)]});if(_0x4b2539['data']['length']===0x0)return console[_0x29fd60(0x224)](_0x29fd60(0x211)),undefined;return _0x4b2539[_0x29fd60(0x1fd)][0x0]['id'];}const _0x577b14=await selectChatInteractively(_0x5d4edb,_0x5a63ab);if(!_0x577b14)return console[_0x29fd60(0x224)](_0x29fd60(0x214)),undefined;return _0x577b14;}async function getProjectIdOrDefault(_0x5533f7){const _0x45b9d2=a25_0x12fd,{tdx:_0x48588c,options:_0x148824}=_0x5533f7,_0x4b7995=_0x148824['llmProject'];if(_0x4b7995){const _0x1d71af=await withSpinner(_0x45b9d2(0x24f)+_0x4b7995+_0x45b9d2(0x25c),()=>_0x48588c[_0x45b9d2(0x22d)][_0x45b9d2(0x1ee)](_0x4b7995),{'verbose':_0x148824[_0x45b9d2(0x27f)]});return _0x1d71af[_0x45b9d2(0x1fd)];}let _0x30dae6=_0x48588c[_0x45b9d2(0x22d)]['getCurrentProject']();if(_0x30dae6)return _0x30dae6;const _0x3ca50c=await withSpinner(_0x45b9d2(0x247),()=>_0x48588c[_0x45b9d2(0x22d)]['getOrCreateDefaultProject'](),{'verbose':_0x148824['verbose']});return _0x3ca50c[_0x45b9d2(0x1fd)]['id'];}function toLLMProjectInfo(_0x1912cf){const _0x15ed83=a25_0x12fd;return{'name':_0x1912cf[_0x15ed83(0x21f)][_0x15ed83(0x212)],'description':_0x1912cf['attributes']['description'],'createdAt':_0x1912cf[_0x15ed83(0x21f)]['createdAt'],'updatedAt':_0x1912cf[_0x15ed83(0x21f)][_0x15ed83(0x244)]};}function a25_0x5cfd(){const _0x856c5f=['408133rLFbAa','Agent\x20updated:\x20','(no\x20agent)','description','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','\x20\x20Knowledge\x20Bases:\x20','Restore\x20cancelled.','Load\x20more...','llm:models','stack','Deleting\x20project\x20\x27','filter','Error:\x20Project\x20name\x20is\x20required','input','models','\x20-\x20','69800ekqhid','verbose','Fetching\x20most\x20recent\x20chat...','List\x20agents\x20in\x20current\x20project','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','integrations','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Create\x20a\x20new\x20agent\x20in\x20current\x20project','toLowerCase','targetWebSearchTool','h\x20ago','15LJOfxz','default','Analyzing\x20project\x20\x27','Fetching\x20available\x20models...','5IyIDHs','Create\x20a\x20new\x20LLM\x20project','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','outputDir','Fetching\x20chat\x20sessions...','updateAgent','Usage:\x20tdx\x20llm\x20use\x20<project-name>','sourceSite','llm:use','Backing\x20up\x20project\x20\x27','\x20->\x20Agent:','backupProject','targetKnowledgeBase','targetAgent','cause','prompts','length','Agent\x20deleted:\x20','en-US','\x20->\x20ImageGen:','yellow','Project\x20context\x20set\x20to:\x20','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','targetImageGenerator','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','llm:project:create','format','llm:projects','entries','all','[image]\x20\x20','stringify','yes','Project\x20created:\x20','m\x20ago','\x20\x20Agents:\x20','llm:agent:delete','List\x20available\x20LLM\x20models','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','llm:project:backup','get','INVALID_ARGUMENT','counts','llm:agent:update','Error:\x20','resolveProjectId','tool_call','dim','keys','\x20\x20Integrations:\x20','green','Use\x20format:\x20project-name/agent-name','split','Resolving\x20agent\x20\x27','last','801FoJwKD','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','model','select','chats','data','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','410800EbcyjK','Checking\x20for\x20existing\x20projects...','[content]','d\x20ago','llm:agents','getTime','deleteAgent','exportedFrom','deleteProject','execute','Select\x20a\x20chat\x20session:','Project\x20restored:\x20','bold','Invalid\x20path\x20syntax:\x20','Output\x20directory\x20\x27','projectName','Validating\x20backup\x20from\x20\x27','[tool]\x20\x20\x20','No\x20chat\x20sessions\x20found.','name','chatId','\x0aCancelled','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','limit','Updating\x20agent...','Fetching\x20chat\x20history\x20for\x20\x27','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','magenta','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','154684YrDLJs','.llm','find','attributes','Creating\x20project\x20\x27','Delete\x20an\x20agent','error','llm:agent:create','log','LLM_PROJECT_NOT_FOUND','__load_more__','join','8032115UuBsKJ','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder','\x20->\x20WebSearch:','Creating\x20agent\x20\x27','288ARmnSz','llm','Agent\x20created:\x20','tdx\x20chats','message','Project\x20deleted:\x20','tool','prompt','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','tdx\x20llm\x20history','Error:\x20Agent\x20name\x20is\x20required','cyan','just\x20now','lastConversationAt','maxToolIterations','getBackupMetadata','systemPrompt','...','floor','map','image','agents','9UFBnGn','content','updatedAt','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','\x20→\x20chat:\x20','Getting\x20default\x20project...','[input]\x20\x20','A\x20project\x20named\x20\x27','[output]\x20','Update\x20an\x20existing\x20agent','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','dryRun','red','Resolving\x20project\x20\x27','agent','1295046IsMlMW','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','rmSync','Show\x20agent\x20details','316838JxCGjs','knowledgeBases','blue','(no\x20message)','createAgent','\x0aStack\x20trace:','\x20bytes)','\x27...','includes','slice','Project\x20backed\x20up\x20to:\x20','setCurrentProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Delete\x20an\x20LLM\x20project','temperature','output','llm:project:restore','resolveAgentId','Project\x20not\x20found:\x20','agentId','restoreProject','string','firstInputContent','set','llm:project:delete'];a25_0x5cfd=function(){return _0x856c5f;};return a25_0x5cfd();}function toAgentInfo(_0x234c91){const _0x40fb10=a25_0x12fd;return{'name':_0x234c91['attributes']['name'],'description':_0x234c91[_0x40fb10(0x21f)]['description'],'prompt':truncatePrompt(_0x234c91['attributes'][_0x40fb10(0x233)]),'createdAt':_0x234c91[_0x40fb10(0x21f)]['createdAt'],'updatedAt':_0x234c91[_0x40fb10(0x21f)][_0x40fb10(0x244)]};}function truncatePrompt(_0x343ce6){const _0x5a6da4=a25_0x12fd;if(!_0x343ce6)return undefined;const _0x2a2bb7=0x64;if(_0x343ce6['length']<=_0x2a2bb7)return _0x343ce6;return _0x343ce6[_0x5a6da4(0x25e)](0x0,_0x2a2bb7)+'...';}export class LLMModelsCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x276);['description']=a25_0x59ba4d(0x1e6);async[a25_0x59ba4d(0x208)](_0x3bbd77){const _0x3408ed=a25_0x59ba4d,{options:_0x503b2d,tdx:_0x55dd00}=_0x3bbd77;try{const _0x481842=await withSpinner(_0x3408ed(0x28d),()=>_0x55dd00[_0x3408ed(0x22d)][_0x3408ed(0x27c)](),{'verbose':_0x503b2d['verbose']});return await handleSDKOutput(_0x481842['data'],_0x503b2d),0x0;}catch(_0x1d8754){return handleSDKError(_0x1d8754,_0x503b2d),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x2a9);[a25_0x59ba4d(0x271)]='List\x20all\x20LLM\x20projects';async['execute'](_0x2d2cb6){const _0x54527d=a25_0x59ba4d,{options:_0x25653b,args:_0x59ae14,tdx:_0x5ebda8}=_0x2d2cb6;try{const _0x5cbb27=_0x59ae14[0x0],_0x5a2686=resolveLimit(_0x25653b['limit'],DEFAULT_LLM_LIMIT),_0x4bd4a8=await withSpinner('Fetching\x20projects...',()=>_0x5ebda8[_0x54527d(0x22d)]['projects'](_0x5a2686),{'verbose':_0x25653b[_0x54527d(0x27f)]});let _0x25c10b=_0x4bd4a8['data'];_0x5cbb27&&(_0x25c10b=_0x4bd4a8['data'][_0x54527d(0x279)](_0x117f95=>matchGlobPattern(_0x117f95['attributes']['name'],_0x5cbb27)));const _0x11faba=_0x25c10b[_0x54527d(0x23f)](toLLMProjectInfo);return await handleSDKOutput(_0x11faba,_0x25653b),0x0;}catch(_0x4d25f6){return handleSDKError(_0x4d25f6,_0x25653b),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a25_0x59ba4d(0x203);[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x281);async[a25_0x59ba4d(0x208)](_0x64aceb){const _0xaefce9=a25_0x59ba4d,{options:_0x6d9043,args:_0x3294d0,tdx:_0x1c6a18}=_0x64aceb;try{const _0x204a4b=_0x3294d0[0x0];let _0xf9e6a,_0x24b615=_0x204a4b;if(_0x204a4b&&_0x204a4b[_0xaefce9(0x25d)]('/')){const _0x7c45a3=_0x204a4b[_0xaefce9(0x1f5)]('/');if(_0x7c45a3[_0xaefce9(0x29e)]===0x2){const [_0x84dcdf,_0x424bdc]=_0x7c45a3,_0x2eed5d=await _0x1c6a18[_0xaefce9(0x22d)]['projects'](),_0x4de084=_0x2eed5d[_0xaefce9(0x21e)](_0x180541=>_0x180541['attributes'][_0xaefce9(0x212)][_0xaefce9(0x287)]()===_0x84dcdf[_0xaefce9(0x287)]());if(!_0x4de084)throw new SDKError(ErrorCode[_0xaefce9(0x225)],_0xaefce9(0x267)+_0x84dcdf,undefined,{'helpText':_0xaefce9(0x261)});_0xf9e6a=_0x4de084['id'],_0x24b615=_0x424bdc;}else throw new SDKError(ErrorCode[_0xaefce9(0x1ea)],_0xaefce9(0x20c)+_0x204a4b,undefined,{'helpText':_0xaefce9(0x1f4)});}else _0xf9e6a=await getProjectIdOrDefault(_0x64aceb);const _0x2b344c=await withSpinner('Fetching\x20agents...',()=>_0x1c6a18[_0xaefce9(0x22d)][_0xaefce9(0x241)](_0xf9e6a),{'verbose':_0x6d9043[_0xaefce9(0x27f)]});let _0xb1af02=_0x2b344c[_0xaefce9(0x1fd)];_0x24b615&&(_0xb1af02=_0x2b344c[_0xaefce9(0x1fd)][_0xaefce9(0x279)](_0x1fbcf9=>matchGlobPattern(_0x1fbcf9[_0xaefce9(0x21f)][_0xaefce9(0x212)],_0x24b615)));const _0x3f1045=_0xb1af02[_0xaefce9(0x23f)](toAgentInfo);return await handleSDKOutput(_0x3f1045,_0x6d9043),0x0;}catch(_0x32b61d){return handleSDKError(_0x32b61d,_0x6d9043),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a25_0x59ba4d(0x212)]='llm:agent:show';[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x254);async[a25_0x59ba4d(0x208)](_0x487074){const _0x56d70b=a25_0x59ba4d,{options:_0x47b026,args:_0x58fef2,tdx:_0x14897e}=_0x487074;if(_0x58fef2['length']===0x0)return console[_0x56d70b(0x222)](_0x56d70b(0x236)),console[_0x56d70b(0x222)](_0x56d70b(0x1f9)),0x1;const _0x315f63=_0x58fef2[0x0];try{const _0x28dfee=await getProjectIdOrDefault(_0x487074),_0x501049=await withSpinner('Resolving\x20agent\x20\x27'+_0x315f63+_0x56d70b(0x25c),()=>_0x14897e[_0x56d70b(0x22d)][_0x56d70b(0x266)](_0x315f63,_0x28dfee),{'verbose':_0x47b026[_0x56d70b(0x27f)]}),_0x75b5dc=await withSpinner('Fetching\x20agent...',()=>_0x14897e[_0x56d70b(0x22d)]['agent'](_0x501049['data']),{'verbose':_0x47b026[_0x56d70b(0x27f)]});return await handleSDKOutput([_0x75b5dc[_0x56d70b(0x1fd)]],_0x47b026),0x0;}catch(_0xbf0924){return handleSDKError(_0xbf0924,_0x47b026),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x223);[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x286);async[a25_0x59ba4d(0x208)](_0x40ed2d){const _0x55b87f=a25_0x59ba4d,{options:_0x2d5105,args:_0x22d760,tdx:_0x4c3582}=_0x40ed2d;if(_0x22d760[_0x55b87f(0x29e)]===0x0)return console[_0x55b87f(0x222)](_0x55b87f(0x236)),console[_0x55b87f(0x222)](_0x55b87f(0x1fe)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]'),0x1;const _0x138363=_0x22d760[0x0],_0x2c6f21=_0x2d5105,_0x5f1eb0=_0x2c6f21[_0x55b87f(0x23c)],_0x42fdce=_0x2c6f21[_0x55b87f(0x1fa)]||'claude-4.5-haiku',_0x1413dd=_0x2c6f21['starterMessage'],_0x599d1a=_0x2c6f21[_0x55b87f(0x23a)]?Number(_0x2c6f21[_0x55b87f(0x23a)]):undefined,_0x171804=_0x2c6f21['temperature']?Number(_0x2c6f21[_0x55b87f(0x263)]):undefined;try{let _0x23b67f,_0x2d2f83;if(_0x138363[_0x55b87f(0x25d)]('/')){const _0x480d94=_0x138363[_0x55b87f(0x1f5)]('/');if(_0x480d94[_0x55b87f(0x29e)]===0x2){const [_0x515d8e,_0x2c3680]=_0x480d94,_0x262e74=await withSpinner(_0x55b87f(0x24f)+_0x515d8e+'\x27...',()=>_0x4c3582[_0x55b87f(0x22d)][_0x55b87f(0x1ee)](_0x515d8e),{'verbose':_0x2d5105['verbose']});_0x23b67f=_0x262e74[_0x55b87f(0x1fd)],_0x2d2f83=_0x2c3680;}else throw new SDKError(ErrorCode[_0x55b87f(0x1ea)],_0x55b87f(0x20c)+_0x138363,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else _0x23b67f=await getProjectIdOrDefault(_0x40ed2d),_0x2d2f83=_0x138363;const _0x2bf860=await withSpinner(_0x55b87f(0x22b)+_0x2d2f83+_0x55b87f(0x25c),()=>_0x4c3582[_0x55b87f(0x22d)][_0x55b87f(0x259)]({'name':_0x2d2f83,'projectId':_0x23b67f,'modelType':_0x42fdce,'systemPrompt':_0x5f1eb0,'starterMessage':_0x1413dd,'maxToolIterations':_0x599d1a,'temperature':_0x171804}),{'verbose':_0x2d5105[_0x55b87f(0x27f)]});return console[_0x55b87f(0x224)](_0x55b87f(0x22e)+_0x2bf860[_0x55b87f(0x1fd)]['id']),await handleSDKOutput([_0x2bf860[_0x55b87f(0x1fd)]],_0x2d5105),0x0;}catch(_0x16da38){return handleSDKError(_0x16da38,_0x2d5105),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x1ec);[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x24b);async[a25_0x59ba4d(0x208)](_0x7f472){const _0x101ced=a25_0x59ba4d,{options:_0x54145f,args:_0xaf345f,tdx:_0xd76960}=_0x7f472;if(_0xaf345f[_0x101ced(0x29e)]===0x0)return console['error'](_0x101ced(0x236)),console[_0x101ced(0x222)](_0x101ced(0x245)),0x1;const _0x1509d1=_0xaf345f[0x0],_0x30d870=_0x54145f,_0x1d60c0=_0x30d870[_0x101ced(0x212)],_0x3aabae=_0x30d870[_0x101ced(0x233)],_0x193025=_0x30d870[_0x101ced(0x271)],_0x22d6eb=_0x30d870['starterMessage'];if(!_0x1d60c0&&!_0x3aabae&&!_0x193025&&!_0x22d6eb)return console[_0x101ced(0x222)](_0x101ced(0x283)),console[_0x101ced(0x222)](_0x101ced(0x290)),0x1;try{const _0x568d27=await getProjectIdOrDefault(_0x7f472),_0x2d486a=await withSpinner(_0x101ced(0x1f6)+_0x1509d1+'\x27...',()=>_0xd76960[_0x101ced(0x22d)]['resolveAgentId'](_0x1509d1,_0x568d27),{'verbose':_0x54145f[_0x101ced(0x27f)]}),_0x2cfce4=_0x2d486a[_0x101ced(0x1fd)],_0x27cef5=await withSpinner(_0x101ced(0x217),()=>_0xd76960[_0x101ced(0x22d)][_0x101ced(0x293)](_0x2cfce4,{'name':_0x1d60c0,'prompt':_0x3aabae,'description':_0x193025,'starterMessage':_0x22d6eb}),{'verbose':_0x54145f[_0x101ced(0x27f)]});return console['log'](_0x101ced(0x26f)+_0x27cef5[_0x101ced(0x1fd)]['id']),await handleSDKOutput([_0x27cef5[_0x101ced(0x1fd)]],_0x54145f),0x0;}catch(_0x39dcb0){return handleSDKError(_0x39dcb0,_0x54145f),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x1e5);['description']=a25_0x59ba4d(0x221);async[a25_0x59ba4d(0x208)](_0xae2a4c){const _0x416b89=a25_0x59ba4d,{options:_0x5d9694,args:_0x140c44,tdx:_0x58f940}=_0xae2a4c;if(_0x140c44[_0x416b89(0x29e)]===0x0)return console[_0x416b89(0x222)](_0x416b89(0x236)),console['error'](_0x416b89(0x215)),0x1;const _0x2edcb8=_0x140c44[0x0];try{const _0x3bba2c=await getProjectIdOrDefault(_0xae2a4c),_0x28676c=await withSpinner('Resolving\x20agent\x20\x27'+_0x2edcb8+_0x416b89(0x25c),()=>_0x58f940[_0x416b89(0x22d)][_0x416b89(0x266)](_0x2edcb8,_0x3bba2c),{'verbose':_0x5d9694[_0x416b89(0x27f)]}),_0x4f6a8d=_0x28676c['data'];return await withSpinner('Deleting\x20agent...',()=>_0x58f940[_0x416b89(0x22d)][_0x416b89(0x205)](_0x4f6a8d),{'verbose':_0x5d9694['verbose']}),console[_0x416b89(0x224)](_0x416b89(0x29f)+_0x4f6a8d),0x0;}catch(_0x430704){return handleSDKError(_0x430704,_0x5d9694),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']='llm:history';[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x272);async[a25_0x59ba4d(0x208)](_0x1b322e){const _0x2dbbe0=a25_0x59ba4d;return executeChatHistoryCommand(_0x1b322e,_0x2dbbe0(0x235));}}export class LLMUseCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x296);[a25_0x59ba4d(0x271)]='Set\x20current\x20project\x20context';async[a25_0x59ba4d(0x208)](_0x96f132){const _0x2b2702=a25_0x59ba4d,{options:_0xfdb6ed,args:_0x43970e,tdx:_0x403158}=_0x96f132;if(_0x43970e[_0x2b2702(0x29e)]===0x0)return console[_0x2b2702(0x222)](_0x2b2702(0x27a)),console[_0x2b2702(0x222)](_0x2b2702(0x294)),0x1;const _0x58f9d7=_0x43970e[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x58f9d7+_0x2b2702(0x25c),()=>_0x403158[_0x2b2702(0x22d)][_0x2b2702(0x260)](_0x58f9d7),{'verbose':_0xfdb6ed['verbose']}),console[_0x2b2702(0x224)](_0x2b2702(0x2a3)+_0x58f9d7),0x0;}catch(_0x1581d2){return handleSDKError(_0x1581d2,_0xfdb6ed),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x2a7);['description']=a25_0x59ba4d(0x28f);async[a25_0x59ba4d(0x208)](_0x278ee5){const _0x4ab840=a25_0x59ba4d,{options:_0x2c08e1,args:_0x1b8799,tdx:_0x29386e}=_0x278ee5;if(_0x1b8799[_0x4ab840(0x29e)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x4ab840(0x282)),0x1;const _0x4ead1d=_0x1b8799[0x0],_0x1a0e10=_0x2c08e1,_0x2562ce=_0x1a0e10[_0x4ab840(0x271)];try{const _0x1e2458=await withSpinner(_0x4ab840(0x220)+_0x4ead1d+_0x4ab840(0x25c),()=>_0x29386e[_0x4ab840(0x22d)]['createProject']({'name':_0x4ead1d,'description':_0x2562ce}),{'verbose':_0x2c08e1['verbose']});console[_0x4ab840(0x224)](_0x4ab840(0x2af)+_0x1e2458['data']['id']);const _0x4d4a2d=toLLMProjectInfo(_0x1e2458[_0x4ab840(0x1fd)]);return await handleSDKOutput([_0x4d4a2d],_0x2c08e1),0x0;}catch(_0x30cb86){return handleSDKError(_0x30cb86,_0x2c08e1),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a25_0x59ba4d(0x212)]=a25_0x59ba4d(0x26d);[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x262);async[a25_0x59ba4d(0x208)](_0xf38b97){const _0x13339e=a25_0x59ba4d,{options:_0x505e17,args:_0x43f68b,tdx:_0x1d8dc2}=_0xf38b97;if(_0x43f68b[_0x13339e(0x29e)]===0x0)return console[_0x13339e(0x222)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x13339e(0x222)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0xdbd1c1=_0x43f68b[0x0];try{return await withSpinner(_0x13339e(0x278)+_0xdbd1c1+_0x13339e(0x25c),()=>_0x1d8dc2[_0x13339e(0x22d)][_0x13339e(0x207)](_0xdbd1c1),{'verbose':_0x505e17[_0x13339e(0x27f)]}),console[_0x13339e(0x224)](_0x13339e(0x231)+_0xdbd1c1),0x0;}catch(_0x57cd4a){return handleSDKError(_0x57cd4a,_0x505e17),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a25_0x59ba4d(0x1e8);[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x229);async[a25_0x59ba4d(0x208)](_0x128415){const _0x3e2098=a25_0x59ba4d,{options:_0x701df9,args:_0x560be4,tdx:_0x3916fd}=_0x128415;if(_0x560be4[_0x3e2098(0x29e)]===0x0)return console[_0x3e2098(0x222)](_0x3e2098(0x27a)),console['error'](_0x3e2098(0x1e7)),0x1;const _0x30db56=_0x560be4[0x0],_0x369547=_0x701df9,_0x3ed8d1=_0x369547['output'],_0x26b5b8=_0x369547[_0x3e2098(0x24d)];try{const _0x1dbcec=_0x3ed8d1||_0x30db56+_0x3e2098(0x21d);if(a25_0x53556e['existsSync'](_0x1dbcec)&&!_0x26b5b8){if(!_0x701df9['yes']){const _0x2c86a5=await confirm(_0x3e2098(0x20d)+_0x1dbcec+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x2c86a5)return console[_0x3e2098(0x224)]('Backup\x20cancelled.'),0x0;}a25_0x53556e[_0x3e2098(0x253)](_0x1dbcec,{'recursive':!![]});}const _0x1e381a=await withSpinner(_0x26b5b8?_0x3e2098(0x28c)+_0x30db56+_0x3e2098(0x25c):_0x3e2098(0x297)+_0x30db56+_0x3e2098(0x25c),()=>_0x3916fd[_0x3e2098(0x22d)][_0x3e2098(0x299)](_0x30db56,_0x3ed8d1,{'dryRun':_0x26b5b8}),{'verbose':_0x701df9[_0x3e2098(0x27f)]}),_0x1fe03f=_0x1e381a['data'];return _0x26b5b8?console[_0x3e2098(0x224)](_0x3e2098(0x21b)+_0x1fe03f[_0x3e2098(0x291)]):console['log'](_0x3e2098(0x25f)+_0x1fe03f[_0x3e2098(0x291)]),console[_0x3e2098(0x224)](_0x3e2098(0x1e4)+_0x1fe03f[_0x3e2098(0x1eb)]['agents']),console[_0x3e2098(0x224)]('\x20\x20Knowledge\x20Bases:\x20'+_0x1fe03f[_0x3e2098(0x1eb)][_0x3e2098(0x256)]),console[_0x3e2098(0x224)]('\x20\x20Prompts:\x20'+_0x1fe03f['counts'][_0x3e2098(0x29d)]),console[_0x3e2098(0x224)](_0x3e2098(0x1f2)+_0x1fe03f[_0x3e2098(0x1eb)][_0x3e2098(0x284)]),(_0x701df9[_0x3e2098(0x2a8)]==='json'||_0x701df9[_0x3e2098(0x2a8)]==='jsonl')&&await handleSDKOutput([_0x1fe03f],_0x701df9),0x0;}catch(_0x47d02b){return handleSDKError(_0x47d02b,_0x701df9),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']=a25_0x59ba4d(0x265);[a25_0x59ba4d(0x271)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder';async[a25_0x59ba4d(0x208)](_0x2ab7a8){const _0x26faa5=a25_0x59ba4d,{options:_0x6ef9fc,args:_0x4defe4,tdx:_0x3669a3}=_0x2ab7a8;if(_0x4defe4['length']===0x0)return console['error']('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console['error'](_0x26faa5(0x219)),0x1;const _0x1ccf8a=_0x4defe4[0x0],_0x4614c7=_0x6ef9fc,_0x3a385c=_0x4614c7[_0x26faa5(0x212)],_0xe6d557=_0x4614c7[_0x26faa5(0x24d)];try{if(!_0xe6d557){const _0x397a29=_0x3669a3[_0x26faa5(0x22d)][_0x26faa5(0x23b)](_0x1ccf8a),_0x559877=_0x3a385c||_0x397a29[_0x26faa5(0x206)][_0x26faa5(0x20e)],_0x3fc05c=await withSpinner(_0x26faa5(0x200),()=>_0x3669a3[_0x26faa5(0x22d)]['projects'](),{'verbose':_0x6ef9fc[_0x26faa5(0x27f)]}),_0x12cb71=_0x3fc05c[_0x26faa5(0x1fd)][_0x26faa5(0x21e)](_0x40c13c=>_0x40c13c[_0x26faa5(0x21f)][_0x26faa5(0x212)]===_0x559877);if(_0x12cb71&&!_0x6ef9fc[_0x26faa5(0x2ae)]){const _0x22db2d=await confirm(_0x26faa5(0x249)+_0x559877+_0x26faa5(0x234));if(!_0x22db2d)return console['log'](_0x26faa5(0x274)),0x0;}}const _0x3b153a=await withSpinner(_0xe6d557?_0x26faa5(0x20f)+_0x1ccf8a+_0x26faa5(0x25c):'Restoring\x20project\x20from\x20\x27'+_0x1ccf8a+_0x26faa5(0x25c),()=>_0x3669a3[_0x26faa5(0x22d)][_0x26faa5(0x269)](_0x1ccf8a,{'name':_0x3a385c,'dryRun':_0xe6d557}),{'verbose':_0x6ef9fc[_0x26faa5(0x27f)]}),_0xba72bf=_0x3b153a[_0x26faa5(0x1fd)];return _0xba72bf[_0x26faa5(0x295)]&&console[_0x26faa5(0x224)](_0x26faa5(0x2a6)+_0xba72bf[_0x26faa5(0x295)]+'\x27'),_0xe6d557?console[_0x26faa5(0x224)](_0x26faa5(0x24c)+_0xba72bf['projectName']):console[_0x26faa5(0x224)](_0x26faa5(0x20a)+_0xba72bf['projectName']+'\x20('+_0xba72bf['projectId']+')'),console[_0x26faa5(0x224)](_0x26faa5(0x1e4)+_0xba72bf[_0x26faa5(0x1eb)][_0x26faa5(0x241)]),console[_0x26faa5(0x224)](_0x26faa5(0x273)+_0xba72bf[_0x26faa5(0x1eb)][_0x26faa5(0x256)]),console[_0x26faa5(0x224)]('\x20\x20Prompts:\x20'+_0xba72bf['counts'][_0x26faa5(0x29d)]),console[_0x26faa5(0x224)](_0x26faa5(0x1f2)+_0xba72bf[_0x26faa5(0x1eb)]['integrations']),(_0x6ef9fc[_0x26faa5(0x2a8)]==='json'||_0x6ef9fc[_0x26faa5(0x2a8)]==='jsonl')&&await handleSDKOutput([_0xba72bf],_0x6ef9fc),0x0;}catch(_0x567365){return handleSDKError(_0x567365,_0x6ef9fc),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x1a890b,_0x514e5f){const _0x3e52c2=a25_0x59ba4d,_0x165214=_0x514e5f[_0x3e52c2(0x216)]||CHAT_SELECTOR_PAGE_SIZE;let _0x26d77b=0x0,_0xa32a59=[];const _0x14ebca=(await import(_0x3e52c2(0x29d)))[_0x3e52c2(0x28b)],_0x5f23f1=getChalk(_0x514e5f);while(!![]){const _0x5e1722=await withSpinner(_0x3e52c2(0x292),()=>_0x1a890b[_0x3e52c2(0x22d)][_0x3e52c2(0x1fc)](_0x165214+_0x26d77b),{'verbose':_0x514e5f['verbose']});_0xa32a59=_0x5e1722[_0x3e52c2(0x1fd)];const _0x2df2c=_0xa32a59[_0x3e52c2(0x25e)](_0x26d77b,_0x26d77b+_0x165214),_0x5d3702=_0xa32a59[_0x3e52c2(0x29e)]>_0x26d77b+_0x165214,_0x449bfd=[...new Set(_0x2df2c[_0x3e52c2(0x23f)](_0x1fc22b=>_0x1fc22b[_0x3e52c2(0x21f)][_0x3e52c2(0x268)])[_0x3e52c2(0x279)](_0xcb605=>_0xcb605!==undefined))],_0x37e059=new Map();await Promise[_0x3e52c2(0x2ab)](_0x449bfd[_0x3e52c2(0x23f)](async _0x5ec409=>{const _0x73f078=_0x3e52c2;try{const _0x53a550=await _0x1a890b[_0x73f078(0x22d)][_0x73f078(0x250)](_0x5ec409);_0x37e059[_0x73f078(0x26c)](_0x5ec409,_0x53a550['attributes'][_0x73f078(0x212)]);}catch{_0x37e059[_0x73f078(0x26c)](_0x5ec409,_0x5ec409);}}));const _0x94f9d1=_0x2df2c['map'](_0x529303=>{const _0x568762=_0x3e52c2,_0x24b40e=_0x529303[_0x568762(0x21f)][_0x568762(0x26b)]||_0x568762(0x258),_0x163800=_0x24b40e[_0x568762(0x1f5)]('\x0a')[0x0],_0x1c46e1=_0x163800[_0x568762(0x29e)]>0x50?_0x163800['substring'](0x0,0x4d)+_0x568762(0x23d):_0x163800,_0x18b4e4=_0x529303[_0x568762(0x21f)][_0x568762(0x268)]?_0x37e059[_0x568762(0x1e9)](_0x529303['attributes'][_0x568762(0x268)])||_0x529303[_0x568762(0x21f)][_0x568762(0x268)]:_0x568762(0x270),_0x321b7=_0x529303['attributes'][_0x568762(0x239)]||_0x529303['attributes'][_0x568762(0x244)],_0x5ee26d=new Date(_0x321b7),_0x3a8f1a=new Date(),_0x2497b3=_0x3a8f1a['getTime']()-_0x5ee26d[_0x568762(0x204)](),_0xe7f37c=Math['floor'](_0x2497b3/0xea60),_0x1e45d2=Math[_0x568762(0x23e)](_0x2497b3/0x36ee80),_0x5369f9=Math['floor'](_0x2497b3/0x5265c00);let _0x21dcd2;if(_0xe7f37c<0x1)_0x21dcd2=_0x568762(0x238);else{if(_0xe7f37c<0x3c)_0x21dcd2=_0xe7f37c+_0x568762(0x2b0);else{if(_0x1e45d2<0x18)_0x21dcd2=_0x1e45d2+_0x568762(0x289);else _0x5369f9<0x7?_0x21dcd2=_0x5369f9+_0x568762(0x202):_0x21dcd2=_0x5ee26d['toLocaleDateString'](_0x568762(0x2a0),{'month':'short','day':'numeric'});}}return{'title':_0x1c46e1+'\x20'+_0x5f23f1[_0x568762(0x1f0)]('['+_0x18b4e4+']\x20'+_0x21dcd2),'value':_0x529303['id']};});_0x5d3702&&_0x94f9d1['push']({'title':_0x5f23f1['cyan'](_0x3e52c2(0x275)),'value':_0x3e52c2(0x226)});const _0x7a262c=await _0x14ebca({'type':_0x3e52c2(0x1fb),'name':'chatId','message':_0x3e52c2(0x209),'choices':_0x94f9d1,'hint':_0x3e52c2(0x285)});if(!_0x7a262c[_0x3e52c2(0x213)])return undefined;if(_0x7a262c[_0x3e52c2(0x213)]===_0x3e52c2(0x226)){_0x26d77b+=_0x165214;continue;}return _0x7a262c[_0x3e52c2(0x213)];}}export class ChatsCommand extends BaseCommand{[a25_0x59ba4d(0x212)]='chats';[a25_0x59ba4d(0x271)]=a25_0x59ba4d(0x252);async[a25_0x59ba4d(0x208)](_0xabe4bd){const _0x141cb5=a25_0x59ba4d;return executeChatHistoryCommand(_0xabe4bd,_0x141cb5(0x22f));}}
1
+ const a25_0xde397=a25_0x380a;(function(_0x344097,_0x5d4195){const _0x30ef8a=a25_0x380a,_0x579554=_0x344097();while(!![]){try{const _0x488549=-parseInt(_0x30ef8a(0x12e))/0x1+parseInt(_0x30ef8a(0x1c0))/0x2*(parseInt(_0x30ef8a(0x1c2))/0x3)+-parseInt(_0x30ef8a(0x159))/0x4*(parseInt(_0x30ef8a(0x1c1))/0x5)+parseInt(_0x30ef8a(0x14e))/0x6*(-parseInt(_0x30ef8a(0x15e))/0x7)+parseInt(_0x30ef8a(0x1e8))/0x8+parseInt(_0x30ef8a(0x175))/0x9*(-parseInt(_0x30ef8a(0x144))/0xa)+parseInt(_0x30ef8a(0x1e5))/0xb;if(_0x488549===_0x5d4195)break;else _0x579554['push'](_0x579554['shift']());}catch(_0x2f40b4){_0x579554['push'](_0x579554['shift']());}}}(a25_0x3962,0xa18f7));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../utils/constants.js';import{confirm}from'../utils/prompt.js';import*as a25_0x5f229e from'node:fs';function handleSDKError(_0x580c8e,_0x580ac8){const _0x248c4a=a25_0x380a;if(_0x580c8e instanceof SDKError)console[_0x248c4a(0x184)](_0x248c4a(0x1c7)+_0x580c8e['message']),_0x580ac8[_0x248c4a(0x152)]&&(_0x580c8e[_0x248c4a(0x1b1)]&&console['error'](_0x248c4a(0x138)+_0x580c8e[_0x248c4a(0x1b1)]),_0x580c8e[_0x248c4a(0x1ae)]&&(console['error'](_0x248c4a(0x162)),console[_0x248c4a(0x184)](_0x580c8e[_0x248c4a(0x1ae)])));else throw _0x580c8e;}function formatChatHistoryEntry(_0x1cbebf,_0x1699b1){const _0x31dec7=a25_0x380a,_0x5a20b1=getChalk(_0x1699b1),_0x32f801=_0x5a20b1[_0x31dec7(0x139)](_0x1cbebf['at']);if(_0x31dec7(0x191)in _0x1cbebf){const _0x2414ff=_0x5a20b1[_0x31dec7(0x1fb)](_0x31dec7(0x176));return _0x32f801+'\x20'+_0x2414ff+':\x20'+_0x1cbebf['input'];}if('content'in _0x1cbebf){const _0xcda632=_0x5a20b1['green'](_0x31dec7(0x1eb));return _0x32f801+'\x20'+_0xcda632+':\x20'+_0x1cbebf[_0x31dec7(0x170)];}if(_0x31dec7(0x183)in _0x1cbebf){const _0x20f36f=_0x5a20b1[_0x31dec7(0x173)](_0x31dec7(0x1ef)),{functionName:_0x595df0,functionArguments:_0xb52539,targetFunction:_0x51d61c}=_0x1cbebf[_0x31dec7(0x183)];let _0x510ee0=_0x32f801+'\x20'+_0x20f36f+':\x20'+_0x5a20b1[_0x31dec7(0x180)](_0x595df0);if(_0xb52539&&Object[_0x31dec7(0x165)](_0xb52539)['length']>0x0){const _0x40b702=Object[_0x31dec7(0x1f1)](_0xb52539)[_0x31dec7(0x1a9)](([_0x1f29e5,_0x5eb21e])=>_0x1f29e5+'='+JSON[_0x31dec7(0x181)](_0x5eb21e))[_0x31dec7(0x188)](',\x20');_0x510ee0+='('+_0x40b702+')';}_0x51d61c&&(_0x510ee0+=_0x5a20b1[_0x31dec7(0x139)]('\x20['+_0x51d61c+']'));let _0x19ded9='';if(_0x1cbebf[_0x31dec7(0x183)][_0x31dec7(0x1a0)])_0x19ded9='\x20->\x20KB:'+_0x1cbebf[_0x31dec7(0x183)][_0x31dec7(0x1a0)]['name'];else{if(_0x1cbebf[_0x31dec7(0x183)][_0x31dec7(0x1dc)])_0x19ded9=_0x31dec7(0x18b)+_0x1cbebf['tool_call'][_0x31dec7(0x1dc)][_0x31dec7(0x1af)];else{if(_0x1cbebf[_0x31dec7(0x183)][_0x31dec7(0x16c)])_0x19ded9=_0x31dec7(0x13f)+_0x1cbebf[_0x31dec7(0x183)][_0x31dec7(0x16c)][_0x31dec7(0x1af)];else _0x1cbebf[_0x31dec7(0x183)][_0x31dec7(0x1c4)]&&(_0x19ded9=_0x31dec7(0x1a3)+_0x1cbebf['tool_call'][_0x31dec7(0x1c4)][_0x31dec7(0x1af)]);}}return _0x510ee0+_0x19ded9;}if(_0x31dec7(0x15c)in _0x1cbebf){const _0x405dc3=_0x5a20b1['magenta'](_0x31dec7(0x174)),{functionName:_0x49a6a8,functionArguments:_0x3e6d66,content:_0x4bcfdd,newChat:_0x596888}=_0x1cbebf[_0x31dec7(0x15c)];let _0x2402f4=_0x32f801+'\x20'+_0x405dc3+':\x20'+_0x5a20b1[_0x31dec7(0x180)](_0x49a6a8);if(_0x3e6d66){const _0x277a47=typeof _0x3e6d66==='string'?_0x3e6d66:JSON[_0x31dec7(0x181)](_0x3e6d66);_0x2402f4+='('+_0x277a47+')';}return _0x4bcfdd&&(_0x2402f4+='\x0a'+_0x5a20b1['dim'](_0x4bcfdd)),_0x596888&&(_0x2402f4+=_0x5a20b1['dim'](_0x31dec7(0x1cb)+_0x596888['id'])),_0x2402f4;}if(_0x31dec7(0x17f)in _0x1cbebf){const _0x2fbda0=_0x5a20b1['blue'](_0x31dec7(0x150));return _0x32f801+'\x20'+_0x2fbda0+':\x20'+_0x1cbebf[_0x31dec7(0x17f)]['name']+'\x20('+_0x1cbebf[_0x31dec7(0x17f)][_0x31dec7(0x170)][_0x31dec7(0x129)]+_0x31dec7(0x16e);}if('image'in _0x1cbebf){const _0x27e5cd=_0x5a20b1['blue']('[image]\x20\x20'),{width:_0x50024b,height:_0x1f1b59,headerText:_0x527c9a}=_0x1cbebf['image'],_0x7b5248=_0x527c9a?_0x31dec7(0x193)+_0x527c9a:'';return _0x32f801+'\x20'+_0x27e5cd+':\x20'+_0x50024b+'x'+_0x1f1b59+_0x7b5248;}if(_0x31dec7(0x184)in _0x1cbebf){const _0x991f=_0x5a20b1[_0x31dec7(0x128)](_0x31dec7(0x1b2));return _0x32f801+'\x20'+_0x991f+':\x20'+_0x1cbebf['error'];}return _0x32f801+'\x20'+_0x5a20b1[_0x31dec7(0x139)]('[unknown]')+':\x20'+JSON[_0x31dec7(0x181)](_0x1cbebf);}function a25_0x3962(){const _0x478c58=['Load\x20more...','dryRun','getOrCreateDefaultProject','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Getting\x20default\x20project...','includes','\x20\x20Integrations:\x20','filter','cyan','en-US','llm:agent:delete','red','length','sourceSite','execute','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Deleting\x20agent...','453475lzQAyV','llm','llm:models','(no\x20agent)','deleteAgent','llm:project:backup','Project\x20deleted:\x20','format','attributes','Invalid\x20path\x20syntax:\x20','\x20\x20Cause:\x20','dim','Output\x20directory\x20\x27','Analyzing\x20project\x20\x27','Creating\x20agent\x20\x27','temperature','Validating\x20backup\x20from\x20\x27','\x20->\x20WebSearch:','llm:history','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','List\x20all\x20LLM\x20projects','last','90kDETxr','projectName','rmSync','model','createdAt','\x20--last','resolveAgentId','List\x20agents\x20in\x20current\x20project','Resolving\x20project\x20\x27','createAgent','768TlBKDM','updateAgent','[output]\x20','Delete\x20an\x20LLM\x20project','verbose','llm:project:restore','setCurrentProject','knowledgeBases','Restore\x20cancelled.','__load_more__','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','798752nNPZQq','select','toLowerCase','tool','history','7847lnEqSz','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','outputDir','No\x20messages\x20found\x20in\x20chat\x20history.','\x0aStack\x20trace:','projects','starterMessage','keys','h\x20ago','Select\x20a\x20chat\x20session:','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','updatedAt','Create\x20a\x20new\x20LLM\x20project','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','targetWebSearchTool','tdx\x20chats','\x20bytes)','description','content','\x27\x20already\x20exists.\x20Overwrite?','Agent\x20updated:\x20','yellow','[tool]\x20\x20\x20','553221Nkahlj','[input]\x20\x20','Restoring\x20project\x20from\x20\x27','chatId','split','Usage:\x20','llm:agents','List\x20available\x20LLM\x20models','table','Use\x20format:\x20project-name/agent-name','output','bold','stringify','chats','tool_call','error','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','numeric','getBackupMetadata','join','Project\x20backed\x20up\x20to:\x20','getTime','\x20->\x20Agent:','data','push','floor','Fetching\x20agent...','slice','input','m\x20ago','\x20-\x20','agent','lastConversationAt','integrations','\x20\x20Agents:\x20','Resolving\x20agent\x20\x27','Backup\x20cancelled.','llm:project:create','counts','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','A\x20project\x20named\x20\x27','json','targetKnowledgeBase','get','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','\x20->\x20ImageGen:','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','prompts','Checking\x20for\x20existing\x20projects...','substring','claude-4.5-haiku','map','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','\x20\x20Prompts:\x20','Agent\x20created:\x20','agentId','stack','name','default','cause','[error]\x20\x20','all','exportedFrom','just\x20now','systemPrompt','Updating\x20agent...','Project\x20created:\x20','Agent\x20deleted:\x20','llm:projects','Project\x20not\x20found:\x20','resolveProjectId','getCurrentProject','Fetching\x20chat\x20sessions...','...','1888058xrxIZu','20pYQVlo','3dInAuS','Show\x20agent\x20details','targetImageGenerator','Error:\x20Project\x20name\x20is\x20required','find','Error:\x20','Fetching\x20available\x20models...','Fetching\x20agents...','.llm','\x20→\x20chat:\x20','toLocaleDateString','createProject','existsSync','short','\x0aCancelled','d\x20ago','Fetching\x20projects...','Fetching\x20chat\x20history\x20for\x20\x27','Setting\x20project\x20context\x20to\x20\x27','limit','projectId','llm:project:delete','Create\x20a\x20new\x20agent\x20in\x20current\x20project','\x27...','backupProject','maxToolIterations','targetAgent','\x20\x20Knowledge\x20Bases:\x20','Fetching\x20most\x20recent\x20chat...','Error:\x20Agent\x20name\x20is\x20required','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Project\x20restored:\x20','(no\x20message)','set','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','6160374HrWWZr','INVALID_ARGUMENT','log','8852992QSPzoV','Project\x20context\x20set\x20to:\x20','Deleting\x20project\x20\x27','[content]','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','jsonl','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder','[tool_call]','deleteProject','entries','agents'];a25_0x3962=function(){return _0x478c58;};return a25_0x3962();}async function executeChatHistoryCommand(_0xa7a71c,_0x316381){const _0x500544=a25_0x380a,{options:_0x29c2f4,args:_0x20175b,tdx:_0x53c159}=_0xa7a71c,_0x50a733=_0x20175b[0x0],_0x3faecc=_0x29c2f4,_0x58dc6d=_0x3faecc[_0x500544(0x143)];try{if(_0x58dc6d&&_0x50a733)return console['error'](_0x500544(0x168)),console[_0x500544(0x184)](_0x500544(0x17a)+_0x316381+_0x500544(0x149)),0x1;if(!_0x50a733&&!_0x58dc6d&&_0x29c2f4[_0x500544(0x135)]!==undefined){const _0x8750cb=resolveLimit(_0x29c2f4[_0x500544(0x1d5)],DEFAULT_LLM_LIMIT),_0x1a8c03=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x53c159[_0x500544(0x12f)][_0x500544(0x182)](_0x8750cb),{'verbose':_0x29c2f4[_0x500544(0x152)]});return await handleSDKOutput(_0x1a8c03[_0x500544(0x18c)],_0x29c2f4),0x0;}const _0x28d549=await getChatIdOrSelect(_0x53c159,_0x29c2f4,_0x58dc6d,_0x50a733);if(!_0x28d549)return 0x0;return await displayChatHistory(_0x28d549,_0x53c159,_0x29c2f4),0x0;}catch(_0x36505f){return handleSDKError(_0x36505f,_0x29c2f4),0x1;}}async function displayChatHistory(_0x1ac612,_0x4ccb3c,_0x1d718c){const _0x4f38c8=a25_0x380a,_0x16906e=await withSpinner(_0x4f38c8(0x1d3)+_0x1ac612+'\x27...',()=>_0x4ccb3c[_0x4f38c8(0x12f)][_0x4f38c8(0x15d)](_0x1ac612),{'verbose':_0x1d718c['verbose']}),_0x67648e=_0x16906e[_0x4f38c8(0x18c)][_0x4f38c8(0x18c)]??[];if(_0x67648e[_0x4f38c8(0x129)]===0x0){console['log'](_0x4f38c8(0x161));return;}if(_0x1d718c['format']!==undefined)await handleSDKOutput(_0x67648e,_0x1d718c);else{const _0x4c00f6=_0x67648e[_0x4f38c8(0x1a9)](_0x35d628=>formatChatHistoryEntry(_0x35d628,_0x1d718c)),_0x25d83a=_0x4c00f6[_0x4f38c8(0x188)]('\x0a');await writeOutput(_0x25d83a,_0x1d718c[_0x4f38c8(0x17f)],_0x4f38c8(0x17d));}}async function getChatIdOrSelect(_0x5838ce,_0x568627,_0x2f0578,_0x3d00e5){const _0x15136a=a25_0x380a;if(_0x3d00e5)return _0x3d00e5;if(_0x2f0578){const _0x50cc6f=await withSpinner(_0x15136a(0x1de),()=>_0x5838ce['llm'][_0x15136a(0x182)](0x1),{'verbose':_0x568627[_0x15136a(0x152)]});if(_0x50cc6f[_0x15136a(0x18c)][_0x15136a(0x129)]===0x0)return console[_0x15136a(0x1e7)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x50cc6f[_0x15136a(0x18c)][0x0]['id'];}const _0x34e90f=await selectChatInteractively(_0x5838ce,_0x568627);if(!_0x34e90f)return console[_0x15136a(0x1e7)](_0x15136a(0x1d0)),undefined;return _0x34e90f;}async function getProjectIdOrDefault(_0x18134b){const _0x154791=a25_0x380a,{tdx:_0x2d99b0,options:_0x4040ee}=_0x18134b,_0x478df2=_0x4040ee['llmProject'];if(_0x478df2){const _0xf74109=await withSpinner(_0x154791(0x14c)+_0x478df2+_0x154791(0x1d9),()=>_0x2d99b0['llm'][_0x154791(0x1bc)](_0x478df2),{'verbose':_0x4040ee[_0x154791(0x152)]});return _0xf74109[_0x154791(0x18c)];}let _0x5f539f=_0x2d99b0['llm'][_0x154791(0x1bd)]();if(_0x5f539f)return _0x5f539f;const _0x5b24bd=await withSpinner(_0x154791(0x1f7),()=>_0x2d99b0[_0x154791(0x12f)][_0x154791(0x1f5)](),{'verbose':_0x4040ee[_0x154791(0x152)]});return _0x5b24bd[_0x154791(0x18c)]['id'];}function toLLMProjectInfo(_0x3519bf){const _0x213ed3=a25_0x380a;return{'name':_0x3519bf[_0x213ed3(0x136)]['name'],'description':_0x3519bf[_0x213ed3(0x136)]['description'],'createdAt':_0x3519bf[_0x213ed3(0x136)]['createdAt'],'updatedAt':_0x3519bf[_0x213ed3(0x136)][_0x213ed3(0x169)]};}function toAgentInfo(_0x14b3cc){const _0x44d904=a25_0x380a;return{'name':_0x14b3cc['attributes'][_0x44d904(0x1af)],'description':_0x14b3cc[_0x44d904(0x136)][_0x44d904(0x16f)],'prompt':truncatePrompt(_0x14b3cc[_0x44d904(0x136)]['prompt']),'createdAt':_0x14b3cc['attributes'][_0x44d904(0x148)],'updatedAt':_0x14b3cc[_0x44d904(0x136)]['updatedAt']};}function truncatePrompt(_0x42aaf8){const _0x8ecb01=a25_0x380a;if(!_0x42aaf8)return undefined;const _0x768039=0x64;if(_0x42aaf8['length']<=_0x768039)return _0x42aaf8;return _0x42aaf8['slice'](0x0,_0x768039)+_0x8ecb01(0x1bf);}export class LLMModelsCommand extends BaseCommand{['name']=a25_0xde397(0x130);[a25_0xde397(0x16f)]=a25_0xde397(0x17c);async[a25_0xde397(0x12b)](_0x42f379){const _0x379f33=a25_0xde397,{options:_0xc2c48e,tdx:_0x23888b}=_0x42f379;try{const _0x27c5f3=await withSpinner(_0x379f33(0x1c8),()=>_0x23888b[_0x379f33(0x12f)]['models'](),{'verbose':_0xc2c48e[_0x379f33(0x152)]});return await handleSDKOutput(_0x27c5f3['data'],_0xc2c48e),0x0;}catch(_0x416081){return handleSDKError(_0x416081,_0xc2c48e),0x1;}}}export class LLMProjectsCommand extends BaseCommand{['name']=a25_0xde397(0x1ba);[a25_0xde397(0x16f)]=a25_0xde397(0x142);async[a25_0xde397(0x12b)](_0xd0959f){const _0x1fb53c=a25_0xde397,{options:_0x1b1289,args:_0x368ced,tdx:_0x6d6309}=_0xd0959f;try{const _0xfbd7fc=_0x368ced[0x0],_0x1cc0e9=resolveLimit(_0x1b1289[_0x1fb53c(0x1d5)],DEFAULT_LLM_LIMIT),_0x106b45=await withSpinner(_0x1fb53c(0x1d2),()=>_0x6d6309[_0x1fb53c(0x12f)][_0x1fb53c(0x163)](_0x1cc0e9),{'verbose':_0x1b1289[_0x1fb53c(0x152)]});let _0x4b3ea1=_0x106b45[_0x1fb53c(0x18c)];_0xfbd7fc&&(_0x4b3ea1=_0x106b45[_0x1fb53c(0x18c)][_0x1fb53c(0x1fa)](_0x243aaf=>matchGlobPattern(_0x243aaf[_0x1fb53c(0x136)][_0x1fb53c(0x1af)],_0xfbd7fc)));const _0x298879=_0x4b3ea1[_0x1fb53c(0x1a9)](toLLMProjectInfo);return await handleSDKOutput(_0x298879,_0x1b1289),0x0;}catch(_0x1c7de1){return handleSDKError(_0x1c7de1,_0x1b1289),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a25_0xde397(0x1af)]=a25_0xde397(0x17b);[a25_0xde397(0x16f)]=a25_0xde397(0x14b);async[a25_0xde397(0x12b)](_0x50e009){const _0x18fb3e=a25_0xde397,{options:_0x3f0f9c,args:_0x5a5ce9,tdx:_0x543da4}=_0x50e009;try{const _0x3805f2=_0x5a5ce9[0x0];let _0x3bd768,_0xa4bc5d=_0x3805f2;if(_0x3805f2&&_0x3805f2['includes']('/')){const _0x3bc49c=_0x3805f2[_0x18fb3e(0x179)]('/');if(_0x3bc49c[_0x18fb3e(0x129)]===0x2){const [_0x356f01,_0x550e64]=_0x3bc49c,_0x245aa8=await _0x543da4[_0x18fb3e(0x12f)]['projects'](),_0x4ef279=_0x245aa8[_0x18fb3e(0x1c6)](_0x44690f=>_0x44690f['attributes'][_0x18fb3e(0x1af)][_0x18fb3e(0x15b)]()===_0x356f01[_0x18fb3e(0x15b)]());if(!_0x4ef279)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x18fb3e(0x1bb)+_0x356f01,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});_0x3bd768=_0x4ef279['id'],_0xa4bc5d=_0x550e64;}else throw new SDKError(ErrorCode[_0x18fb3e(0x1e6)],_0x18fb3e(0x137)+_0x3805f2,undefined,{'helpText':_0x18fb3e(0x17e)});}else _0x3bd768=await getProjectIdOrDefault(_0x50e009);const _0xe770c6=await withSpinner(_0x18fb3e(0x1c9),()=>_0x543da4[_0x18fb3e(0x12f)][_0x18fb3e(0x1f2)](_0x3bd768),{'verbose':_0x3f0f9c['verbose']});let _0x358577=_0xe770c6[_0x18fb3e(0x18c)];_0xa4bc5d&&(_0x358577=_0xe770c6['data']['filter'](_0x3be38b=>matchGlobPattern(_0x3be38b['attributes'][_0x18fb3e(0x1af)],_0xa4bc5d)));const _0x56a574=_0x358577[_0x18fb3e(0x1a9)](toAgentInfo);return await handleSDKOutput(_0x56a574,_0x3f0f9c),0x0;}catch(_0x9a588c){return handleSDKError(_0x9a588c,_0x3f0f9c),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']='llm:agent:show';[a25_0xde397(0x16f)]=a25_0xde397(0x1c3);async[a25_0xde397(0x12b)](_0x57373e){const _0x1441f6=a25_0xde397,{options:_0x18d26f,args:_0x41f70e,tdx:_0x309dae}=_0x57373e;if(_0x41f70e['length']===0x0)return console[_0x1441f6(0x184)](_0x1441f6(0x1df)),console['error'](_0x1441f6(0x12c)),0x1;const _0x46ea97=_0x41f70e[0x0];try{const _0x4e1038=await getProjectIdOrDefault(_0x57373e),_0x471d3e=await withSpinner(_0x1441f6(0x198)+_0x46ea97+_0x1441f6(0x1d9),()=>_0x309dae[_0x1441f6(0x12f)]['resolveAgentId'](_0x46ea97,_0x4e1038),{'verbose':_0x18d26f[_0x1441f6(0x152)]}),_0x51ec90=await withSpinner(_0x1441f6(0x18f),()=>_0x309dae[_0x1441f6(0x12f)][_0x1441f6(0x194)](_0x471d3e[_0x1441f6(0x18c)]),{'verbose':_0x18d26f['verbose']});return await handleSDKOutput([_0x51ec90[_0x1441f6(0x18c)]],_0x18d26f),0x0;}catch(_0xfc3d90){return handleSDKError(_0xfc3d90,_0x18d26f),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a25_0xde397(0x1af)]='llm:agent:create';['description']=a25_0xde397(0x1d8);async[a25_0xde397(0x12b)](_0x1b93c1){const _0x424a9a=a25_0xde397,{options:_0x45bc26,args:_0x495938,tdx:_0x542330}=_0x1b93c1;if(_0x495938[_0x424a9a(0x129)]===0x0)return console[_0x424a9a(0x184)](_0x424a9a(0x1df)),console['error'](_0x424a9a(0x19c)),console['error'](_0x424a9a(0x1e0)),0x1;const _0x2d1a1e=_0x495938[0x0],_0x45254d=_0x45bc26,_0x2d900d=_0x45254d[_0x424a9a(0x1b6)],_0xe4e162=_0x45254d[_0x424a9a(0x147)]||_0x424a9a(0x1a8),_0x4f0400=_0x45254d[_0x424a9a(0x164)],_0xc7f6a5=_0x45254d[_0x424a9a(0x1db)]?Number(_0x45254d[_0x424a9a(0x1db)]):undefined,_0x57a383=_0x45254d[_0x424a9a(0x13d)]?Number(_0x45254d[_0x424a9a(0x13d)]):undefined;try{let _0x12a445,_0x4511be;if(_0x2d1a1e[_0x424a9a(0x1f8)]('/')){const _0x20aa81=_0x2d1a1e[_0x424a9a(0x179)]('/');if(_0x20aa81[_0x424a9a(0x129)]===0x2){const [_0x5bd54c,_0x5c08e9]=_0x20aa81,_0x292bfa=await withSpinner(_0x424a9a(0x14c)+_0x5bd54c+_0x424a9a(0x1d9),()=>_0x542330[_0x424a9a(0x12f)]['resolveProjectId'](_0x5bd54c),{'verbose':_0x45bc26['verbose']});_0x12a445=_0x292bfa['data'],_0x4511be=_0x5c08e9;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20path\x20syntax:\x20'+_0x2d1a1e,undefined,{'helpText':_0x424a9a(0x17e)});}else _0x12a445=await getProjectIdOrDefault(_0x1b93c1),_0x4511be=_0x2d1a1e;const _0x45c642=await withSpinner(_0x424a9a(0x13c)+_0x4511be+'\x27...',()=>_0x542330[_0x424a9a(0x12f)][_0x424a9a(0x14d)]({'name':_0x4511be,'projectId':_0x12a445,'modelType':_0xe4e162,'systemPrompt':_0x2d900d,'starterMessage':_0x4f0400,'maxToolIterations':_0xc7f6a5,'temperature':_0x57a383}),{'verbose':_0x45bc26[_0x424a9a(0x152)]});return console[_0x424a9a(0x1e7)](_0x424a9a(0x1ac)+_0x45c642['data']['id']),await handleSDKOutput([_0x45c642[_0x424a9a(0x18c)]],_0x45bc26),0x0;}catch(_0x5a2aff){return handleSDKError(_0x5a2aff,_0x45bc26),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a25_0xde397(0x1af)]='llm:agent:update';['description']='Update\x20an\x20existing\x20agent';async[a25_0xde397(0x12b)](_0x237448){const _0x44805b=a25_0xde397,{options:_0x15c2f7,args:_0x32ee7a,tdx:_0x9909e4}=_0x237448;if(_0x32ee7a['length']===0x0)return console[_0x44805b(0x184)](_0x44805b(0x1df)),console[_0x44805b(0x184)](_0x44805b(0x16b)),0x1;const _0x1a87a0=_0x32ee7a[0x0],_0x401fce=_0x15c2f7,_0x4fcb2f=_0x401fce[_0x44805b(0x1af)],_0x1f78e7=_0x401fce['prompt'],_0x131faf=_0x401fce[_0x44805b(0x16f)],_0x3cf56c=_0x401fce[_0x44805b(0x164)];if(!_0x4fcb2f&&!_0x1f78e7&&!_0x131faf&&!_0x3cf56c)return console['error'](_0x44805b(0x1aa)),console[_0x44805b(0x184)](_0x44805b(0x141)),0x1;try{const _0x228b36=await getProjectIdOrDefault(_0x237448),_0x2dec66=await withSpinner('Resolving\x20agent\x20\x27'+_0x1a87a0+'\x27...',()=>_0x9909e4[_0x44805b(0x12f)][_0x44805b(0x14a)](_0x1a87a0,_0x228b36),{'verbose':_0x15c2f7[_0x44805b(0x152)]}),_0x23057c=_0x2dec66[_0x44805b(0x18c)],_0x4c9b72=await withSpinner(_0x44805b(0x1b7),()=>_0x9909e4[_0x44805b(0x12f)][_0x44805b(0x14f)](_0x23057c,{'name':_0x4fcb2f,'prompt':_0x1f78e7,'description':_0x131faf,'starterMessage':_0x3cf56c}),{'verbose':_0x15c2f7[_0x44805b(0x152)]});return console['log'](_0x44805b(0x172)+_0x4c9b72[_0x44805b(0x18c)]['id']),await handleSDKOutput([_0x4c9b72[_0x44805b(0x18c)]],_0x15c2f7),0x0;}catch(_0x26c66c){return handleSDKError(_0x26c66c,_0x15c2f7),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a25_0xde397(0x1af)]=a25_0xde397(0x127);[a25_0xde397(0x16f)]='Delete\x20an\x20agent';async['execute'](_0x2d1263){const _0x8832ae=a25_0xde397,{options:_0x3a4794,args:_0x24a2a3,tdx:_0x4167ed}=_0x2d1263;if(_0x24a2a3[_0x8832ae(0x129)]===0x0)return console[_0x8832ae(0x184)](_0x8832ae(0x1df)),console[_0x8832ae(0x184)]('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0xdef1e0=_0x24a2a3[0x0];try{const _0x1ecc5b=await getProjectIdOrDefault(_0x2d1263),_0x548d48=await withSpinner('Resolving\x20agent\x20\x27'+_0xdef1e0+_0x8832ae(0x1d9),()=>_0x4167ed[_0x8832ae(0x12f)][_0x8832ae(0x14a)](_0xdef1e0,_0x1ecc5b),{'verbose':_0x3a4794[_0x8832ae(0x152)]}),_0x4cdb33=_0x548d48[_0x8832ae(0x18c)];return await withSpinner(_0x8832ae(0x12d),()=>_0x4167ed[_0x8832ae(0x12f)][_0x8832ae(0x132)](_0x4cdb33),{'verbose':_0x3a4794[_0x8832ae(0x152)]}),console[_0x8832ae(0x1e7)](_0x8832ae(0x1b9)+_0x4cdb33),0x0;}catch(_0x359645){return handleSDKError(_0x359645,_0x3a4794),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']=a25_0xde397(0x140);['description']=a25_0xde397(0x15f);async[a25_0xde397(0x12b)](_0x4a8cb5){return executeChatHistoryCommand(_0x4a8cb5,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a25_0xde397(0x1af)]='llm:use';['description']='Set\x20current\x20project\x20context';async['execute'](_0x11e03d){const _0x473caf=a25_0xde397,{options:_0x537eb8,args:_0x49351e,tdx:_0x1f7d1d}=_0x11e03d;if(_0x49351e['length']===0x0)return console[_0x473caf(0x184)](_0x473caf(0x1c5)),console[_0x473caf(0x184)](_0x473caf(0x1f6)),0x1;const _0x499178=_0x49351e[0x0];try{return await withSpinner(_0x473caf(0x1d4)+_0x499178+_0x473caf(0x1d9),()=>_0x1f7d1d[_0x473caf(0x12f)][_0x473caf(0x154)](_0x499178),{'verbose':_0x537eb8[_0x473caf(0x152)]}),console[_0x473caf(0x1e7)](_0x473caf(0x1e9)+_0x499178),0x0;}catch(_0x861ff){return handleSDKError(_0x861ff,_0x537eb8),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{['name']=a25_0xde397(0x19a);[a25_0xde397(0x16f)]=a25_0xde397(0x16a);async['execute'](_0x47954a){const _0x139c53=a25_0xde397,{options:_0x1b68f4,args:_0x278317,tdx:_0x39dbaa}=_0x47954a;if(_0x278317['length']===0x0)return console[_0x139c53(0x184)](_0x139c53(0x1c5)),console[_0x139c53(0x184)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x56c47e=_0x278317[0x0],_0x58efc0=_0x1b68f4,_0x1f1bea=_0x58efc0[_0x139c53(0x16f)];try{const _0x4a46a8=await withSpinner('Creating\x20project\x20\x27'+_0x56c47e+_0x139c53(0x1d9),()=>_0x39dbaa['llm'][_0x139c53(0x1cd)]({'name':_0x56c47e,'description':_0x1f1bea}),{'verbose':_0x1b68f4[_0x139c53(0x152)]});console[_0x139c53(0x1e7)](_0x139c53(0x1b8)+_0x4a46a8['data']['id']);const _0x102f6a=toLLMProjectInfo(_0x4a46a8[_0x139c53(0x18c)]);return await handleSDKOutput([_0x102f6a],_0x1b68f4),0x0;}catch(_0x58e663){return handleSDKError(_0x58e663,_0x1b68f4),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{['name']=a25_0xde397(0x1d7);[a25_0xde397(0x16f)]=a25_0xde397(0x151);async['execute'](_0x27570b){const _0xc5f774=a25_0xde397,{options:_0x511c26,args:_0x165a60,tdx:_0x52031c}=_0x27570b;if(_0x165a60[_0xc5f774(0x129)]===0x0)return console['error'](_0xc5f774(0x1c5)),console[_0xc5f774(0x184)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x4953f4=_0x165a60[0x0];try{return await withSpinner(_0xc5f774(0x1ea)+_0x4953f4+_0xc5f774(0x1d9),()=>_0x52031c['llm'][_0xc5f774(0x1f0)](_0x4953f4),{'verbose':_0x511c26[_0xc5f774(0x152)]}),console[_0xc5f774(0x1e7)](_0xc5f774(0x134)+_0x4953f4),0x0;}catch(_0x408dfd){return handleSDKError(_0x408dfd,_0x511c26),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a25_0xde397(0x1af)]=a25_0xde397(0x133);[a25_0xde397(0x16f)]='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder';async['execute'](_0x4d8085){const _0xebe405=a25_0xde397,{options:_0x492ba3,args:_0x17946b,tdx:_0x3fdc50}=_0x4d8085;if(_0x17946b[_0xebe405(0x129)]===0x0)return console['error'](_0xebe405(0x1c5)),console[_0xebe405(0x184)](_0xebe405(0x1a2)),0x1;const _0x3331e5=_0x17946b[0x0],_0x5df353=_0x492ba3,_0x5bf903=_0x5df353[_0xebe405(0x17f)],_0x3d8eef=_0x5df353[_0xebe405(0x1f4)];try{const _0x16623f=_0x5bf903||_0x3331e5+_0xebe405(0x1ca);if(a25_0x5f229e[_0xebe405(0x1ce)](_0x16623f)&&!_0x3d8eef){if(!_0x492ba3['yes']){const _0x4d0bdc=await confirm(_0xebe405(0x13a)+_0x16623f+_0xebe405(0x171));if(!_0x4d0bdc)return console['log'](_0xebe405(0x199)),0x0;}a25_0x5f229e[_0xebe405(0x146)](_0x16623f,{'recursive':!![]});}const _0x270064=await withSpinner(_0x3d8eef?_0xebe405(0x13b)+_0x3331e5+_0xebe405(0x1d9):'Backing\x20up\x20project\x20\x27'+_0x3331e5+_0xebe405(0x1d9),()=>_0x3fdc50['llm'][_0xebe405(0x1da)](_0x3331e5,_0x5bf903,{'dryRun':_0x3d8eef}),{'verbose':_0x492ba3[_0xebe405(0x152)]}),_0x317699=_0x270064[_0xebe405(0x18c)];return _0x3d8eef?console[_0xebe405(0x1e7)](_0xebe405(0x158)+_0x317699[_0xebe405(0x160)]):console[_0xebe405(0x1e7)](_0xebe405(0x189)+_0x317699[_0xebe405(0x160)]),console[_0xebe405(0x1e7)](_0xebe405(0x197)+_0x317699[_0xebe405(0x19b)][_0xebe405(0x1f2)]),console[_0xebe405(0x1e7)](_0xebe405(0x1dd)+_0x317699[_0xebe405(0x19b)][_0xebe405(0x155)]),console['log'](_0xebe405(0x1ab)+_0x317699[_0xebe405(0x19b)][_0xebe405(0x1a5)]),console[_0xebe405(0x1e7)](_0xebe405(0x1f9)+_0x317699[_0xebe405(0x19b)][_0xebe405(0x196)]),(_0x492ba3[_0xebe405(0x135)]===_0xebe405(0x19f)||_0x492ba3[_0xebe405(0x135)]===_0xebe405(0x1ed))&&await handleSDKOutput([_0x317699],_0x492ba3),0x0;}catch(_0x2dbcc){return handleSDKError(_0x2dbcc,_0x492ba3),0x1;}}}function a25_0x380a(_0x3ac31b,_0x520695){_0x3ac31b=_0x3ac31b-0x126;const _0x39621d=a25_0x3962();let _0x380a34=_0x39621d[_0x3ac31b];return _0x380a34;}export class LLMProjectRestoreCommand extends BaseCommand{[a25_0xde397(0x1af)]=a25_0xde397(0x153);[a25_0xde397(0x16f)]=a25_0xde397(0x1ee);async['execute'](_0x4773a0){const _0x5da4f0=a25_0xde397,{options:_0x30e943,args:_0x150507,tdx:_0x23eba4}=_0x4773a0;if(_0x150507[_0x5da4f0(0x129)]===0x0)return console[_0x5da4f0(0x184)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x5da4f0(0x184)](_0x5da4f0(0x1ec)),0x1;const _0x3e02a1=_0x150507[0x0],_0x12a703=_0x30e943,_0x163a26=_0x12a703[_0x5da4f0(0x1af)],_0x3fddd6=_0x12a703[_0x5da4f0(0x1f4)];try{if(!_0x3fddd6){const _0x2b2068=_0x23eba4[_0x5da4f0(0x12f)][_0x5da4f0(0x187)](_0x3e02a1),_0x34d945=_0x163a26||_0x2b2068[_0x5da4f0(0x1b4)][_0x5da4f0(0x145)],_0x28d5ff=await withSpinner(_0x5da4f0(0x1a6),()=>_0x23eba4['llm'][_0x5da4f0(0x163)](),{'verbose':_0x30e943['verbose']}),_0x36e10b=_0x28d5ff[_0x5da4f0(0x18c)][_0x5da4f0(0x1c6)](_0x4bffe0=>_0x4bffe0[_0x5da4f0(0x136)]['name']===_0x34d945);if(_0x36e10b&&!_0x30e943['yes']){const _0x1f7736=await confirm(_0x5da4f0(0x19e)+_0x34d945+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x1f7736)return console[_0x5da4f0(0x1e7)](_0x5da4f0(0x156)),0x0;}}const _0x9f9cdb=await withSpinner(_0x3fddd6?_0x5da4f0(0x13e)+_0x3e02a1+_0x5da4f0(0x1d9):_0x5da4f0(0x177)+_0x3e02a1+_0x5da4f0(0x1d9),()=>_0x23eba4[_0x5da4f0(0x12f)]['restoreProject'](_0x3e02a1,{'name':_0x163a26,'dryRun':_0x3fddd6}),{'verbose':_0x30e943[_0x5da4f0(0x152)]}),_0x5cdad3=_0x9f9cdb[_0x5da4f0(0x18c)];return _0x5cdad3[_0x5da4f0(0x12a)]&&console[_0x5da4f0(0x1e7)](_0x5da4f0(0x19d)+_0x5cdad3[_0x5da4f0(0x12a)]+'\x27'),_0x3fddd6?console['log'](_0x5da4f0(0x185)+_0x5cdad3[_0x5da4f0(0x145)]):console['log'](_0x5da4f0(0x1e1)+_0x5cdad3[_0x5da4f0(0x145)]+'\x20('+_0x5cdad3[_0x5da4f0(0x1d6)]+')'),console[_0x5da4f0(0x1e7)]('\x20\x20Agents:\x20'+_0x5cdad3['counts']['agents']),console[_0x5da4f0(0x1e7)](_0x5da4f0(0x1dd)+_0x5cdad3['counts'][_0x5da4f0(0x155)]),console[_0x5da4f0(0x1e7)](_0x5da4f0(0x1ab)+_0x5cdad3['counts']['prompts']),console[_0x5da4f0(0x1e7)](_0x5da4f0(0x1f9)+_0x5cdad3[_0x5da4f0(0x19b)][_0x5da4f0(0x196)]),(_0x30e943[_0x5da4f0(0x135)]===_0x5da4f0(0x19f)||_0x30e943[_0x5da4f0(0x135)]===_0x5da4f0(0x1ed))&&await handleSDKOutput([_0x5cdad3],_0x30e943),0x0;}catch(_0x2432c9){return handleSDKError(_0x2432c9,_0x30e943),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x2d22cf,_0x2ae823){const _0x5f28da=a25_0xde397,_0x469a66=_0x2ae823['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0x35beb2=0x0,_0x3e4ef4=[];const _0x4b22cf=(await import(_0x5f28da(0x1a5)))[_0x5f28da(0x1b0)],_0x2bef31=getChalk(_0x2ae823);while(!![]){const _0x134aa7=await withSpinner(_0x5f28da(0x1be),()=>_0x2d22cf[_0x5f28da(0x12f)][_0x5f28da(0x182)](_0x469a66+_0x35beb2),{'verbose':_0x2ae823['verbose']});_0x3e4ef4=_0x134aa7[_0x5f28da(0x18c)];const _0xfdecc0=_0x3e4ef4[_0x5f28da(0x190)](_0x35beb2,_0x35beb2+_0x469a66),_0x17c92e=_0x3e4ef4['length']>_0x35beb2+_0x469a66,_0xed927f=[...new Set(_0xfdecc0[_0x5f28da(0x1a9)](_0xef95bb=>_0xef95bb[_0x5f28da(0x136)][_0x5f28da(0x1ad)])[_0x5f28da(0x1fa)](_0x475b72=>_0x475b72!==undefined))],_0x51e7e5=new Map();await Promise[_0x5f28da(0x1b3)](_0xed927f['map'](async _0x49145e=>{const _0x5d75be=_0x5f28da;try{const _0x176dde=await _0x2d22cf[_0x5d75be(0x12f)][_0x5d75be(0x194)](_0x49145e);_0x51e7e5['set'](_0x49145e,_0x176dde['attributes'][_0x5d75be(0x1af)]);}catch{_0x51e7e5[_0x5d75be(0x1e3)](_0x49145e,_0x49145e);}}));const _0x2ed920=_0xfdecc0[_0x5f28da(0x1a9)](_0xc165f3=>{const _0x16d7b6=_0x5f28da,_0x5228ac=_0xc165f3['attributes']['firstInputContent']||_0x16d7b6(0x1e2),_0x177733=_0x5228ac[_0x16d7b6(0x179)]('\x0a')[0x0],_0x3bede8=_0x177733[_0x16d7b6(0x129)]>0x50?_0x177733[_0x16d7b6(0x1a7)](0x0,0x4d)+'...':_0x177733,_0x232f42=_0xc165f3['attributes']['agentId']?_0x51e7e5[_0x16d7b6(0x1a1)](_0xc165f3[_0x16d7b6(0x136)][_0x16d7b6(0x1ad)])||_0xc165f3[_0x16d7b6(0x136)][_0x16d7b6(0x1ad)]:_0x16d7b6(0x131),_0x441c8e=_0xc165f3['attributes'][_0x16d7b6(0x195)]||_0xc165f3['attributes'][_0x16d7b6(0x169)],_0x450672=new Date(_0x441c8e),_0x1e0edd=new Date(),_0x25598d=_0x1e0edd[_0x16d7b6(0x18a)]()-_0x450672[_0x16d7b6(0x18a)](),_0x5c8a18=Math[_0x16d7b6(0x18e)](_0x25598d/0xea60),_0x4c086d=Math[_0x16d7b6(0x18e)](_0x25598d/0x36ee80),_0x13dda8=Math['floor'](_0x25598d/0x5265c00);let _0x372f05;if(_0x5c8a18<0x1)_0x372f05=_0x16d7b6(0x1b5);else{if(_0x5c8a18<0x3c)_0x372f05=_0x5c8a18+_0x16d7b6(0x192);else{if(_0x4c086d<0x18)_0x372f05=_0x4c086d+_0x16d7b6(0x166);else _0x13dda8<0x7?_0x372f05=_0x13dda8+_0x16d7b6(0x1d1):_0x372f05=_0x450672[_0x16d7b6(0x1cc)](_0x16d7b6(0x126),{'month':_0x16d7b6(0x1cf),'day':_0x16d7b6(0x186)});}}return{'title':_0x3bede8+'\x20'+_0x2bef31[_0x16d7b6(0x139)]('['+_0x232f42+']\x20'+_0x372f05),'value':_0xc165f3['id']};});_0x17c92e&&_0x2ed920[_0x5f28da(0x18d)]({'title':_0x2bef31[_0x5f28da(0x1fb)](_0x5f28da(0x1f3)),'value':_0x5f28da(0x157)});const _0x16cfc6=await _0x4b22cf({'type':_0x5f28da(0x15a),'name':_0x5f28da(0x178),'message':_0x5f28da(0x167),'choices':_0x2ed920,'hint':_0x5f28da(0x1e4)});if(!_0x16cfc6[_0x5f28da(0x178)])return undefined;if(_0x16cfc6[_0x5f28da(0x178)]==='__load_more__'){_0x35beb2+=_0x469a66;continue;}return _0x16cfc6[_0x5f28da(0x178)];}}export class ChatsCommand extends BaseCommand{[a25_0xde397(0x1af)]=a25_0xde397(0x182);[a25_0xde397(0x16f)]=a25_0xde397(0x1a4);async[a25_0xde397(0x12b)](_0x27e19e){const _0x160f20=a25_0xde397;return executeChatHistoryCommand(_0x27e19e,_0x160f20(0x16d));}}
@@ -1 +1 @@
1
- const a26_0x4305ea=a26_0x2cbb;(function(_0x1fbd70,_0xb74230){const _0x5080b0=a26_0x2cbb,_0x370cec=_0x1fbd70();while(!![]){try{const _0x5c3062=-parseInt(_0x5080b0(0xd4))/0x1*(parseInt(_0x5080b0(0xa8))/0x2)+parseInt(_0x5080b0(0xa0))/0x3+-parseInt(_0x5080b0(0xdc))/0x4+parseInt(_0x5080b0(0xc0))/0x5*(-parseInt(_0x5080b0(0xb7))/0x6)+-parseInt(_0x5080b0(0xb9))/0x7*(parseInt(_0x5080b0(0xb5))/0x8)+-parseInt(_0x5080b0(0xda))/0x9+-parseInt(_0x5080b0(0xaf))/0xa*(-parseInt(_0x5080b0(0xa4))/0xb);if(_0x5c3062===_0xb74230)break;else _0x370cec['push'](_0x370cec['shift']());}catch(_0x18129e){_0x370cec['push'](_0x370cec['shift']());}}}(a26_0x4631,0x28585));function a26_0x4631(){const _0x3cbd97=['Project\x20\x27','white','21TaXdtY','✓\x20Proxy\x20server\x20stopped','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','\x20\x20\x20\x20}','Resolving\x20project...','2621601xrqNhk','name','386760XSifol','cyan','llm','find','\x20is\x20unavailable,\x20using\x20port\x20','green','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x20\x20}','849378crXKEi','exit','port','llmProject','682110nuZpoo','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','yellow','9990pPMCdN','llm:proxy','SIGINT','created\x20on-demand\x20per\x20model','\x20\x20Site:','close','project','160UrAOrC','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','log','SIGTERM','Server\x20Configuration:','1880ZwkjCk','\x20\x20Agents:','7608auRqBf','\x20\x20\x20\x20\x22env\x22:\x20{','9583eTUQKm','getOrCreateDefaultProject','site','dim','logger','bold','init','1165pkHceD','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','description','stop','\x20\x20{','projects','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22','\x0aTesting\x20with\x20Agent\x20SDK:','\x0aClaude\x20Code\x20Configuration:','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','Port\x20','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','logLevel','\x27\x20not\x20found','\x20\x20Address:','attributes','server'];a26_0x4631=function(){return _0x3cbd97;};return a26_0x4631();}import a26_0x36240e from'chalk';function a26_0x2cbb(_0x175973,_0x3c2d8a){_0x175973=_0x175973-0x99;const _0x46313f=a26_0x4631();let _0x2cbb10=_0x46313f[_0x175973];return _0x2cbb10;}import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x4ef6a2,_0x13966a){const _0x73005f=a26_0x2cbb,{tdx:_0x2c2c46,options:_0x338510}=_0x4ef6a2,_0x37baf8=_0x13966a||_0x338510[_0x73005f(0xa3)];if(_0x37baf8){const _0x189edf=await _0x2c2c46['llm'][_0x73005f(0xc5)](),_0x28897b=_0x189edf[_0x73005f(0x9b)](_0x1dbc8b=>_0x1dbc8b[_0x73005f(0xd0)][_0x73005f(0xdb)]===_0x37baf8);if(!_0x28897b)throw new SDKError(ErrorCode['NOT_FOUND'],_0x73005f(0xd2)+_0x37baf8+_0x73005f(0xce),undefined,{'helpText':_0x73005f(0xc9)});return _0x28897b['id'];}const _0x3cb8af=await _0x2c2c46[_0x73005f(0x9a)][_0x73005f(0xba)]();return _0x3cb8af['id'];}export class LLMProxyCommand extends BaseCommand{[a26_0x4305ea(0xdb)]=a26_0x4305ea(0xa9);[a26_0x4305ea(0xc2)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a26_0x4305ea(0xd1)];['logger'];async['execute'](_0x171e01){const _0x4a6b14=a26_0x4305ea,{tdx:_0x2223ce,options:_0x4ecaf2}=_0x171e01;try{const _0x1e0fcd=_0x4ecaf2,_0x1e6359=_0x1e0fcd[_0x4a6b14(0xa2)]||0xfa0,_0x105dca=_0x1e0fcd[_0x4a6b14(0xae)],_0x37de82=await findAvailablePort(_0x1e6359);console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xbc)](_0x4a6b14(0xd9)));const _0x22264f=await getProjectIdOrDefault(_0x171e01,_0x105dca),_0x39b97c=await _0x2223ce[_0x4a6b14(0x9a)]['projects'](),_0x8d0a9a=_0x39b97c[_0x4a6b14(0x9b)](_0x5b4a26=>_0x5b4a26['id']===_0x22264f);this[_0x4a6b14(0xbd)]=new TDXLogger(_0x4ecaf2[_0x4a6b14(0xcd)]),await this[_0x4a6b14(0xbd)][_0x4a6b14(0xbf)](),console[_0x4a6b14(0xb2)](a26_0x36240e['dim']('Starting\x20proxy\x20server...'));_0x37de82!==_0x1e6359&&console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xa7)](_0x4a6b14(0xcb)+_0x1e6359+_0x4a6b14(0x9c)+_0x37de82));this['server']=new ProxyServer({'port':_0x37de82,'projectId':_0x22264f,'tdx':_0x2223ce,'logger':this[_0x4a6b14(0xbd)],'site':_0x4ecaf2[_0x4a6b14(0xbb)]}),await this['server']['start'](),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xa7)]['bold'](_0x4a6b14(0xa6))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xa7)](_0x4a6b14(0xa5))),console['log'](a26_0x36240e[_0x4a6b14(0xa7)](_0x4a6b14(0xcc))),console['log'](a26_0x36240e['green'][_0x4a6b14(0xbe)](_0x4a6b14(0xd7))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0x99)](_0x4a6b14(0xb4))),console['log'](a26_0x36240e[_0x4a6b14(0xbc)](_0x4a6b14(0xcf)),a26_0x36240e['white']('http://0.0.0.0:'+_0x37de82)),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xbc)]('\x20\x20Project:'),a26_0x36240e[_0x4a6b14(0xd3)](_0x8d0a9a?.['attributes'][_0x4a6b14(0xdb)]||_0x22264f)),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xbc)](_0x4a6b14(0xb6)),a26_0x36240e[_0x4a6b14(0xd3)](_0x4a6b14(0xab))),console['log'](a26_0x36240e[_0x4a6b14(0xbc)](_0x4a6b14(0xac)),a26_0x36240e[_0x4a6b14(0xd3)](_0x4ecaf2[_0x4a6b14(0xbb)])),console['log'](a26_0x36240e[_0x4a6b14(0x99)](_0x4a6b14(0xc8))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xbc)](_0x4a6b14(0xc1))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xd3)](_0x4a6b14(0xc4))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xd3)](_0x4a6b14(0xb8))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xd3)](_0x4a6b14(0xb1)+_0x37de82+'\x22,')),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xd3)](_0x4a6b14(0xc6))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xd3)](_0x4a6b14(0xd8))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xd3)](_0x4a6b14(0x9f))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0x99)](_0x4a6b14(0xc7))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xbc)](_0x4a6b14(0xca))),console[_0x4a6b14(0xb2)](a26_0x36240e[_0x4a6b14(0xbc)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console['log'](a26_0x36240e[_0x4a6b14(0xbc)](_0x4a6b14(0xd6))),console['log'](a26_0x36240e[_0x4a6b14(0xa7)](_0x4a6b14(0xb0)));const _0x4e6c31=async()=>{const _0x510e84=_0x4a6b14;console[_0x510e84(0xb2)](a26_0x36240e[_0x510e84(0xbc)](_0x510e84(0x9e))),this['server']&&await this[_0x510e84(0xd1)][_0x510e84(0xc3)](),this[_0x510e84(0xbd)]&&await this[_0x510e84(0xbd)][_0x510e84(0xad)](),console['log'](a26_0x36240e[_0x510e84(0x9d)](_0x510e84(0xd5))),process[_0x510e84(0xa1)](0x0);};return process['on'](_0x4a6b14(0xaa),_0x4e6c31),process['on'](_0x4a6b14(0xb3),_0x4e6c31),await new Promise(()=>{}),0x0;}catch(_0x1da363){this[_0x4a6b14(0xd1)]&&await this[_0x4a6b14(0xd1)]['stop']();this['logger']&&await this[_0x4a6b14(0xbd)][_0x4a6b14(0xad)]();throw _0x1da363;}}}
1
+ const a26_0x340c2d=a26_0x530c;(function(_0xc382f,_0x316bf4){const _0x54ccb3=a26_0x530c,_0x416246=_0xc382f();while(!![]){try{const _0x102855=parseInt(_0x54ccb3(0xb3))/0x1+-parseInt(_0x54ccb3(0xae))/0x2+parseInt(_0x54ccb3(0x82))/0x3*(parseInt(_0x54ccb3(0xa7))/0x4)+parseInt(_0x54ccb3(0x97))/0x5*(-parseInt(_0x54ccb3(0xa9))/0x6)+parseInt(_0x54ccb3(0xa8))/0x7+parseInt(_0x54ccb3(0x86))/0x8*(-parseInt(_0x54ccb3(0x94))/0x9)+-parseInt(_0x54ccb3(0xa2))/0xa*(-parseInt(_0x54ccb3(0xaf))/0xb);if(_0x102855===_0x316bf4)break;else _0x416246['push'](_0x416246['shift']());}catch(_0xcd987e){_0x416246['push'](_0x416246['shift']());}}}(a26_0x50eb,0x1a242));import a26_0x56b0aa from'chalk';function a26_0x50eb(){const _0x4ab9ba=['\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','\x0aClaude\x20Code\x20Configuration:','✓\x20Proxy\x20server\x20stopped','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','SIGTERM','9vOKWNK','SIGINT','Server\x20Configuration:','server','328088bClILG','site','close','Resolving\x20project...','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','execute','port','start','\x20\x20{','\x20\x20Site:','Port\x20','\x20\x20}','bold','log','9itqDUL','name','created\x20on-demand\x20per\x20model','5IWECTo','cyan','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x27\x20not\x20found','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','stop','white','\x20\x20Address:','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','\x0a\x0aShutting\x20down\x20proxy\x20server...','10ZQQmYA','http://0.0.0.0:','\x20is\x20unavailable,\x20using\x20port\x20','llm','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','5348ZYubAX','437234jugDXL','1193124AWePXJ','yellow','logLevel','description','projects','78868puNkmz','2198086RJwKIC','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22','NOT_FOUND','logger','120074HQuHPF','llmProject','\x20\x20\x20\x20}','\x20\x20Agents:','dim','llm:proxy','green','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','find'];a26_0x50eb=function(){return _0x4ab9ba;};return a26_0x50eb();}import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x49616d,_0x1763b1){const _0x25732f=a26_0x530c,{tdx:_0x4a78a7,options:_0x29c1bd}=_0x49616d,_0x39d090=_0x1763b1||_0x29c1bd[_0x25732f(0xb4)];if(_0x39d090){const _0xc632db=await _0x4a78a7[_0x25732f(0xa5)][_0x25732f(0xad)](),_0xde2096=_0xc632db[_0x25732f(0x7c)](_0x20e3fc=>_0x20e3fc['attributes'][_0x25732f(0x95)]===_0x39d090);if(!_0xde2096)throw new SDKError(ErrorCode[_0x25732f(0xb1)],'Project\x20\x27'+_0x39d090+_0x25732f(0x9a),undefined,{'helpText':_0x25732f(0x9b)});return _0xde2096['id'];}const _0x55bddb=await _0x4a78a7[_0x25732f(0xa5)]['getOrCreateDefaultProject']();return _0x55bddb['id'];}function a26_0x530c(_0x5d7ea9,_0x21ae62){_0x5d7ea9=_0x5d7ea9-0x77;const _0x50eb84=a26_0x50eb();let _0x530c58=_0x50eb84[_0x5d7ea9];return _0x530c58;}export class LLMProxyCommand extends BaseCommand{['name']=a26_0x340c2d(0x79);[a26_0x340c2d(0xac)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a26_0x340c2d(0x85)];[a26_0x340c2d(0xb2)];async[a26_0x340c2d(0x8b)](_0x25c60b){const _0xe8185c=a26_0x340c2d,{tdx:_0x18228f,options:_0x57aca0}=_0x25c60b;try{const _0x3c3cf0=_0x57aca0,_0x3a114f=_0x3c3cf0[_0xe8185c(0x8c)]||0xfa0,_0x5cdd7e=_0x3c3cf0['project'],_0x47d50b=await findAvailablePort(_0x3a114f);console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x78)](_0xe8185c(0x89)));const _0x5bd284=await getProjectIdOrDefault(_0x25c60b,_0x5cdd7e),_0x483f3c=await _0x18228f[_0xe8185c(0xa5)]['projects'](),_0x948624=_0x483f3c[_0xe8185c(0x7c)](_0x3500bf=>_0x3500bf['id']===_0x5bd284);this[_0xe8185c(0xb2)]=new TDXLogger(_0x57aca0[_0xe8185c(0xab)]),await this[_0xe8185c(0xb2)]['init'](),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x78)]('Starting\x20proxy\x20server...'));_0x47d50b!==_0x3a114f&&console[_0xe8185c(0x93)](a26_0x56b0aa['yellow'](_0xe8185c(0x90)+_0x3a114f+_0xe8185c(0xa4)+_0x47d50b));this[_0xe8185c(0x85)]=new ProxyServer({'port':_0x47d50b,'projectId':_0x5bd284,'tdx':_0x18228f,'logger':this['logger'],'site':_0x57aca0[_0xe8185c(0x87)]}),await this[_0xe8185c(0x85)][_0xe8185c(0x8d)](),console['log'](a26_0x56b0aa['yellow'][_0xe8185c(0x92)]('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0xaa)](_0xe8185c(0x7b))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0xaa)](_0xe8185c(0x9f))),console['log'](a26_0x56b0aa[_0xe8185c(0x7a)][_0xe8185c(0x92)](_0xe8185c(0xa0))),console['log'](a26_0x56b0aa[_0xe8185c(0x98)](_0xe8185c(0x84))),console['log'](a26_0x56b0aa[_0xe8185c(0x78)](_0xe8185c(0x9e)),a26_0x56b0aa['white'](_0xe8185c(0xa3)+_0x47d50b)),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x78)]('\x20\x20Project:'),a26_0x56b0aa['white'](_0x948624?.['attributes'][_0xe8185c(0x95)]||_0x5bd284)),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x78)](_0xe8185c(0x77)),a26_0x56b0aa['white'](_0xe8185c(0x96))),console['log'](a26_0x56b0aa[_0xe8185c(0x78)](_0xe8185c(0x8f)),a26_0x56b0aa[_0xe8185c(0x9d)](_0x57aca0[_0xe8185c(0x87)])),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x98)](_0xe8185c(0x7e))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x78)](_0xe8185c(0x99))),console['log'](a26_0x56b0aa[_0xe8185c(0x9d)](_0xe8185c(0x8e))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x9d)]('\x20\x20\x20\x20\x22env\x22:\x20{')),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x9d)](_0xe8185c(0x7d)+_0x47d50b+'\x22,')),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x9d)](_0xe8185c(0xb0))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x9d)](_0xe8185c(0xb5))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x9d)](_0xe8185c(0x91))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x98)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x78)](_0xe8185c(0xa6))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0x78)](_0xe8185c(0x8a))),console[_0xe8185c(0x93)](a26_0x56b0aa['dim'](_0xe8185c(0x80))),console[_0xe8185c(0x93)](a26_0x56b0aa[_0xe8185c(0xaa)]('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x23d6a0=async()=>{const _0x36190a=_0xe8185c;console[_0x36190a(0x93)](a26_0x56b0aa[_0x36190a(0x78)](_0x36190a(0xa1))),this[_0x36190a(0x85)]&&await this[_0x36190a(0x85)][_0x36190a(0x9c)](),this[_0x36190a(0xb2)]&&await this[_0x36190a(0xb2)]['close'](),console[_0x36190a(0x93)](a26_0x56b0aa[_0x36190a(0x7a)](_0x36190a(0x7f))),process['exit'](0x0);};return process['on'](_0xe8185c(0x83),_0x23d6a0),process['on'](_0xe8185c(0x81),_0x23d6a0),await new Promise(()=>{}),0x0;}catch(_0x18a506){this[_0xe8185c(0x85)]&&await this[_0xe8185c(0x85)][_0xe8185c(0x9c)]();this[_0xe8185c(0xb2)]&&await this[_0xe8185c(0xb2)][_0xe8185c(0x88)]();throw _0x18a506;}}}
@@ -1 +1 @@
1
- const a27_0x30a75a=a27_0x35ca;(function(_0x23f6e8,_0x4096c9){const _0x3fcca8=a27_0x35ca,_0x46043c=_0x23f6e8();while(!![]){try{const _0x4bbd72=parseInt(_0x3fcca8(0x230))/0x1+parseInt(_0x3fcca8(0x229))/0x2*(-parseInt(_0x3fcca8(0x2b3))/0x3)+parseInt(_0x3fcca8(0x215))/0x4*(parseInt(_0x3fcca8(0x2ec))/0x5)+parseInt(_0x3fcca8(0x2bb))/0x6*(-parseInt(_0x3fcca8(0x1f4))/0x7)+-parseInt(_0x3fcca8(0x24f))/0x8+parseInt(_0x3fcca8(0x2a7))/0x9+parseInt(_0x3fcca8(0x21c))/0xa;if(_0x4bbd72===_0x4096c9)break;else _0x46043c['push'](_0x46043c['shift']());}catch(_0x498c1c){_0x46043c['push'](_0x46043c['shift']());}}}(a27_0x36e2,0xc0d35));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a27_0xb285cd from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';function a27_0x36e2(){const _0x33b68e=['filter','preview','\x0a⚠️\x20\x20Both\x20','format','bold','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Resolving\x20parent\x20segment\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','sort','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','green','jobId','\x27\x20and\x20run\x20workflow?','Overwrite\x20\x27','ignore','\x20tdx\x20wf\x20attempt\x20','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','allValid','segment:parent:fields','Coverage:','keys','Usage:\x20tdx\x20ps\x20fields\x20[name]\x0a','Fetching\x20parent\x20segment\x20\x27','label','Error\x20parsing\x20YAML:\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20Configuration\x20is\x20valid','xdg-open','\x27...','join','rowCount','Events:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','population','\x0a✔\x20Workflow\x20started','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20use\x20`tdx\x20ps\x20pull`\x20to\x20get\x20a\x20YAML\x20file\x20first','tdx\x20segment\x20parent\x20preview\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20is\x20already\x20up\x20to\x20date','Created','win32','text','Site:\x20','Enriched:','parent_segments','joinKey','Usage:\x20tdx\x20ps\x20show\x20[name]\x0a','Usage:\x20tdx\x20ps\x20pull\x20[name]\x20[-o\x20output.yml]\x20[-y]\x0a','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','processedRows','Analyzing\x20changes...','displayValidateResults','Available\x20behaviors:','Errors:','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Pattern:\x20','Listing\x20fields\x20for\x20\x27','Join\x20on:','log','output','test','Show\x20parent\x20segment\x20schema\x20(column\x20types)','json','displaySummary','getParentSQL','Attributes','parentSegment','displayPreviewHints','\x20Opening\x20','/app/dw/parentSegments/','updateParent','customersWithEvents','schemaValid','YAML\x20file:\x20','varchar','Executing\x20parent\x20segment\x20query...','scheduleOption','displayPreviewResults','Creating','1993077NXFBVy','Join:','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','No\x20parent\x20segments\x20found','\x20=\x20','\x27\x20with\x20ID:\x20','columns','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','✘\x20Failed\x20to\x20rename\x20directory:\x20','pullParentYaml','coveragePercent','36609vXtcMS','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','length','runParent','Columns:','errors','✔\x20No\x20changes\x20-\x20\x27','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','6dIPvjE','Attempt:','\x20--behavior\x20\x22','apply','SQL\x20query:\x0a','listFields','matchedCount','Updating','foreignKey','Source:','segment:parent:validate','\x20No\x20changes\x20-\x20','/sessions/','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','toLowerCase','utf-8','Error:\x20--behavior\x20requires\x20a\x20name\x0a','message','Updating\x20parent\x20segment\x20\x27','👥\x20','scheduleType','workflowAttemptId','Error:\x20--attribute\x20requires\x20a\x20name\x0a','previewParentYaml','dim','double','Audience\x20ID:','Database:\x20','\x0aChanges\x20to\x20\x27','\x20--behavior\x20\x22<name>\x22','.yaml','totalEvents','Behavior:','FINISHED','toLocaleString','name','Options:','List\x20parent\x20segments','Show\x20parent\x20segment\x20details','attributes','Listing\x20parent\x20segments...','trim','table','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)','Master\x20Table','\x20[Job\x20ID:\x20','behavior','\x20Context\x20set:\x20','displayMasterInfo','3800675aFJYfM','resolveParentId','Fetching\x20sample\x20data...','\x20parent\x20segment','createParent','segment:parent:create','\x0a⚠️\x20\x20Migrating:\x20','stats','start','jsonl','customerGroupFile','Output\x20file:\x20','`\x20to\x20download\x20the\x20configuration\x20first','segment:parent:show','match','toFixed','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','.yml','platform','pushParentYaml','interval','Preview:','Parent\x20segment:\x20','stop','using\x20the\x20default\x20path:\x20','replace','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','yes','Create\x20parent\x20segment\x20\x27','attribute','data','Apply\x20changes\x20to\x20\x27','\x0aNo\x20sample\x20data\x20available','open','cyan','behaviorsFile','verbose','in\x20','\x20--enriched','yellow','Listing\x20parent\x20segments\x20matching\x20\x27','darwin','SELECT\x20*\x20FROM\x20(\x0a','audienceId','\x20--interval\x20','/\x20→\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','5236882EUiyZi','workflowId','Fetching\x20current\x20configuration\x20for\x20\x27','addAttributes','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','column','segment:parent:desc','displayBehaviorsStats','Customers:','setJobId','schemaError','Available\x20attributes:','enriched','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)','✔\x20Found\x20','-1d','error','✔\x20Renamed\x20directory\x20to\x20','\x20kill','\x20\x20\x20\x20-\x20','\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','unref','displaySampleData','Aborted.','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','red','\x20--attribute\x20\x22','\x20\x20No\x20sample\x20data\x20available','sampleData','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','addAttributesFile','isDirectory','4IiUzrp','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x0aChanges\x20to\x20apply\x20to\x20\x27','use','workflowSessionId','repeat','segment:parent:run','14147010QXNAxe','getParentFull','Error\x20reading\x20file:\x20','/{name}.yml\x0a','validateParentYaml','database','Updated','session','string','Usage:\x20tdx\x20parent-segment\x20validate\x20<name>\x20[options]\x0a','displayColumns','\x27\x20is\x20already\x20up\x20to\x20date','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','82cCfSao','timezone','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a','localeCompare','/\x20directory.\x0a','\x20rows)','1180151rEkWfh','behaviors','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','listParents','\x0aNew\x20parent\x20segment\x20\x27','execute','Error:\x20--database\x20and\x20--table\x20are\x20required','customerPercent','site','Usage:\x20tdx\x20ps\x20desc\x20[name]\x0a','run','description','Behaviors','Error:\x20Parent\x20segment\x20name\x20is\x20required','segment','all','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Fetching\x20SQL\x20for\x20\x27','\x20parent\x20segment\x20\x27','Options\x20(one\x20required):','\x0aUsage:\x20tdx\x20ps\x20preview\x20','✔\x20Query\x20completed:\x20Processed\x20','addBehaviorsFile','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','dirname','addBehaviors','displayAttributesStats','Error:','parent_segment','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:push','12305424qrOCpQ','endsWith','number','\x20rows\x20','query','Attribute:','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Status:','master'];a27_0x36e2=function(){return _0x33b68e;};return a27_0x36e2();}function a27_0x35ca(_0x439e34,_0x59b56f){_0x439e34=_0x439e34-0x1e5;const _0x36e288=a27_0x36e2();let _0x35ca1e=_0x36e288[_0x439e34];return _0x35ca1e;}import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a27_0x44fedf from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';const PARENT_SEGMENT_DIR=a27_0x30a75a(0x284),LEGACY_PARENT_SEGMENT_DIR=a27_0x30a75a(0x24c);function openBrowser(_0xb7f3cb){const _0x5c2927=a27_0x30a75a,_0x428ef7=process[_0x5c2927(0x2fe)],_0x5927c8=_0x428ef7===_0x5c2927(0x1ee)?_0x5c2927(0x1e6):_0x428ef7===_0x5c2927(0x280)?_0x5c2927(0x2f4):_0x5c2927(0x273);spawn(_0x5927c8,[_0xb7f3cb],{'detached':!![],'stdio':_0x5c2927(0x266)})[_0x5c2927(0x20a)]();}function sanitizeFileName(_0x188f75){const _0x34e308=a27_0x30a75a;return _0x188f75[_0x34e308(0x2c9)]()[_0x34e308(0x305)](/[/\\:*?"<>|]/g,'-')[_0x34e308(0x305)](/\s+/g,'-')['replace'](/-+/g,'-')[_0x34e308(0x305)](/^-|-$/g,'');}function migrateLegacyDirectory(){const _0x5a7608=a27_0x30a75a;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x568617=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x568617[_0x5a7608(0x214)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5a7608(0x205)](a27_0x44fedf['yellow'](_0x5a7608(0x25a)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x5a7608(0x205)](a27_0x44fedf[_0x5a7608(0x2d3)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x5a7608(0x22e))),![];console['error'](a27_0x44fedf['yellow'](_0x5a7608(0x2f2)+LEGACY_PARENT_SEGMENT_DIR+_0x5a7608(0x1f2)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5a7608(0x205)](a27_0x44fedf[_0x5a7608(0x262)](_0x5a7608(0x206)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x512dc7){const _0x368565=_0x512dc7 instanceof Error?_0x512dc7[_0x5a7608(0x2cc)]:String(_0x512dc7);return console['error'](a27_0x44fedf['red'](_0x5a7608(0x2b0)+_0x368565+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x3f789a){const _0x546d6c=a27_0x30a75a;return migrateLegacyDirectory(),super[_0x546d6c(0x23a)](_0x3f789a);}}function resolveYamlFile(_0x3be3f8){const _0x2984f1=a27_0x30a75a;if(_0x3be3f8['endsWith'](_0x2984f1(0x2fd))||_0x3be3f8[_0x2984f1(0x250)](_0x2984f1(0x2d9)))return _0x3be3f8;return a27_0xb285cd[_0x2984f1(0x275)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3be3f8)+'.yml');}function formatProgressMessage(_0x2cf8ff){const _0x4095b3=a27_0x30a75a,_0x809bf0=_0x2cf8ff[_0x4095b3(0x2fa)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x809bf0){const [,_0x3df69c,_0x1a5a3e,_0x1e367c='']=_0x809bf0;return a27_0x44fedf['dim'](_0x3df69c+':')+'\x20'+_0x1a5a3e+a27_0x44fedf[_0x4095b3(0x2d3)](_0x1e367c);}return a27_0x44fedf[_0x4095b3(0x2d3)](_0x2cf8ff);}function showFileNotFoundError(_0x19875f,_0x467aef){const _0x2604f7=a27_0x30a75a;console['error'](a27_0x44fedf[_0x2604f7(0x20e)]('Error:\x20File\x20not\x20found:\x20'+_0x19875f+'\x0a')),console[_0x2604f7(0x205)](a27_0x44fedf[_0x2604f7(0x1e7)](_0x2604f7(0x27d)+_0x467aef+_0x2604f7(0x2f8)));}export class ParentSegmentListCommand extends BaseCommand{[a27_0x30a75a(0x2de)]='segment:parent:list';['description']=a27_0x30a75a(0x2e0);async[a27_0x30a75a(0x235)](_0x301dec){const _0x196d99=a27_0x30a75a,{options:_0x335d33,args:_0x519a2f,tdx:_0x56ea1c}=_0x301dec,_0x2229e9=_0x519a2f[0x0];_0x335d33['verbose']&&(console['error'](_0x196d99(0x282)+_0x335d33[_0x196d99(0x238)]),_0x2229e9&&console[_0x196d99(0x205)](_0x196d99(0x28f)+_0x2229e9));const _0x1fe611=await withSpinner(_0x2229e9?_0x196d99(0x1ed)+_0x2229e9+_0x196d99(0x274):_0x196d99(0x2e3),()=>_0x56ea1c['segment'][_0x196d99(0x233)](),{'verbose':_0x335d33[_0x196d99(0x1e9)]});let _0x57a615=_0x1fe611[_0x196d99(0x30a)];if(_0x2229e9){const _0x4d6f37=_0x2229e9['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x196d99(0x305)](/\*/g,'.*')[_0x196d99(0x305)](/\?/g,'.'),_0x5e2c8e=new RegExp('^'+_0x4d6f37+'$','i');_0x57a615=_0x57a615[_0x196d99(0x258)](_0x3f76ac=>_0x5e2c8e[_0x196d99(0x294)](_0x3f76ac['attributes']['name']));}_0x57a615[_0x196d99(0x260)]((_0x38e090,_0x170b21)=>_0x38e090['attributes'][_0x196d99(0x2de)][_0x196d99(0x22d)](_0x170b21[_0x196d99(0x2e2)][_0x196d99(0x2de)])),console['error'](_0x196d99(0x203)+_0x57a615[_0x196d99(0x2b5)]+_0x196d99(0x2ef)+(_0x57a615[_0x196d99(0x2b5)]!==0x1?'s':''));if(_0x335d33['format']===_0x196d99(0x296)||_0x335d33['format']===_0x196d99(0x2f5))await handleSDKOutput(_0x57a615,_0x335d33);else{if(_0x57a615[_0x196d99(0x2b5)]===0x0)_0x2229e9?console[_0x196d99(0x292)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x2229e9):console[_0x196d99(0x292)](_0x196d99(0x2ab));else for(const _0x3ea2eb of _0x57a615){const _0xbb2b0c=_0x3ea2eb[_0x196d99(0x2e2)]['population']?a27_0x44fedf['dim']('\x20('+formatRows(_0x3ea2eb[_0x196d99(0x2e2)][_0x196d99(0x279)])+')'):'';console[_0x196d99(0x292)](_0x196d99(0x2ce)+_0x3ea2eb['attributes'][_0x196d99(0x2de)]+_0xbb2b0c);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a27_0x30a75a(0x2de)]=a27_0x30a75a(0x2f1);['description']=a27_0x30a75a(0x2af);async[a27_0x30a75a(0x235)](_0x219eba){const _0x10dbca=a27_0x30a75a,{options:_0x4b506a,args:_0x2ec14a,tdx:_0x544b11}=_0x219eba;console['error']('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x10dbca(0x28e)+_0x10dbca(0x228));const _0xfdd04c=_0x4b506a;if(_0x2ec14a['length']===0x0)return console[_0x10dbca(0x205)](_0x10dbca(0x23d)),console[_0x10dbca(0x205)](_0x10dbca(0x2aa)),0x1;const _0x224523=_0x2ec14a[0x0];if(!_0xfdd04c['database']||!_0xfdd04c['table'])return console[_0x10dbca(0x205)](_0x10dbca(0x236)),console[_0x10dbca(0x205)](_0x10dbca(0x2aa)),0x1;_0xfdd04c[_0x10dbca(0x1e9)]&&(console['error'](_0x10dbca(0x282)+_0xfdd04c[_0x10dbca(0x238)]),console[_0x10dbca(0x205)]('Name:\x20'+_0x224523),console[_0x10dbca(0x205)](_0x10dbca(0x2d6)+_0xfdd04c[_0x10dbca(0x221)]),console[_0x10dbca(0x205)]('Table:\x20'+_0xfdd04c['table']));const _0x233ab4=await loadJSONFromOptions(_0xfdd04c[_0x10dbca(0x2e2)],_0xfdd04c['attributesFile']),_0x5b0aa8=await loadJSONFromOptions(_0xfdd04c['behaviors'],_0xfdd04c[_0x10dbca(0x1e8)]),_0x3ecf4d=await loadJSONFromOptions(_0xfdd04c['customerGroup'],_0xfdd04c[_0x10dbca(0x2f6)]),_0x368fa9={'name':_0x224523,'description':_0xfdd04c[_0x10dbca(0x23b)],'scheduleType':_0xfdd04c[_0x10dbca(0x2cf)],'scheduleOption':_0xfdd04c[_0x10dbca(0x2a4)],'timezone':_0xfdd04c[_0x10dbca(0x22a)],'master':{'parentDatabaseName':_0xfdd04c[_0x10dbca(0x221)],'parentTableName':_0xfdd04c[_0x10dbca(0x2e5)]},'attributes':_0x233ab4,'behaviors':_0x5b0aa8,'customerGroup':_0x3ecf4d},_0x16fad2=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x224523+_0x10dbca(0x274),()=>_0x544b11[_0x10dbca(0x23e)][_0x10dbca(0x2f0)](_0x368fa9),{'verbose':_0x4b506a[_0x10dbca(0x1e9)]}),_0xe539f6=_0x16fad2['data'];return console['error']('✔\x20Created\x20parent\x20segment\x20\x27'+_0xe539f6['name']+_0x10dbca(0x2ad)+_0xe539f6['id']),await handleSDKOutput([_0xe539f6],_0x4b506a),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a27_0x30a75a(0x2de)]='segment:parent:update';[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x232);async[a27_0x30a75a(0x235)](_0xbe24e5){const _0x2425da=a27_0x30a75a,{options:_0x16b2c6,args:_0x209eda,tdx:_0x209392}=_0xbe24e5;console[_0x2425da(0x205)](_0x2425da(0x2c8)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x2425da(0x228));const _0x890642=_0x16b2c6;if(_0x209eda[_0x2425da(0x2b5)]===0x0)return console[_0x2425da(0x205)](_0x2425da(0x23d)),console[_0x2425da(0x205)](_0x2425da(0x212)),0x1;const _0x556617=_0x209eda[0x0];_0x890642[_0x2425da(0x1e9)]&&(console['error'](_0x2425da(0x282)+_0x890642[_0x2425da(0x238)]),console['error'](_0x2425da(0x302)+_0x556617));const _0x188af9=await withSpinner(_0x2425da(0x1f6)+_0x556617+_0x2425da(0x274),()=>_0x209392[_0x2425da(0x23e)][_0x2425da(0x21d)](_0x556617),{'verbose':_0x890642[_0x2425da(0x1e9)]}),_0x1f3f00=_0x188af9[_0x2425da(0x30a)],_0x2c6a51=await loadJSONFromOptions(_0x890642[_0x2425da(0x1f7)],_0x890642[_0x2425da(0x213)]),_0x3bb1ba=await loadJSONFromOptions(_0x890642[_0x2425da(0x249)],_0x890642[_0x2425da(0x246)]),_0x3e0207={'name':_0x1f3f00[_0x2425da(0x2de)],'description':_0x890642[_0x2425da(0x23b)]!==undefined?_0x890642[_0x2425da(0x23b)]:_0x1f3f00[_0x2425da(0x23b)],'scheduleType':_0x890642['scheduleType']!==undefined?_0x890642[_0x2425da(0x2cf)]:_0x1f3f00['scheduleType'],'scheduleOption':_0x890642[_0x2425da(0x2a4)]!==undefined?_0x890642[_0x2425da(0x2a4)]:_0x1f3f00[_0x2425da(0x2a4)],'timezone':_0x890642[_0x2425da(0x22a)]!==undefined?_0x890642['timezone']:_0x1f3f00[_0x2425da(0x22a)],'master':_0x1f3f00[_0x2425da(0x257)],'attributes':_0x2c6a51?[..._0x1f3f00[_0x2425da(0x2e2)]||[],..._0x2c6a51]:_0x1f3f00[_0x2425da(0x2e2)],'behaviors':_0x3bb1ba?[..._0x1f3f00[_0x2425da(0x231)]||[],..._0x3bb1ba]:_0x1f3f00[_0x2425da(0x231)],'customerGroup':_0x1f3f00['customerGroup']},_0x312e1d=await withSpinner(_0x2425da(0x2cd)+_0x556617+_0x2425da(0x274),()=>_0x209392[_0x2425da(0x23e)][_0x2425da(0x29e)](_0x556617,_0x3e0207),{'verbose':_0x890642[_0x2425da(0x1e9)]}),_0x15c430=_0x312e1d[_0x2425da(0x30a)];return console[_0x2425da(0x205)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x15c430['name']+'\x27'),await handleSDKOutput([_0x15c430],_0x890642),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a27_0x30a75a(0x2de)]='segment:parent:pull';[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x255);async[a27_0x30a75a(0x235)](_0x10b570){const _0x1b0bfb=a27_0x30a75a,{options:_0xb9253e,args:_0x2ff880,tdx:_0x27866d}=_0x10b570,_0x51f581=_0xb9253e,_0x31ce8f=_0x2ff880[0x0]||_0xb9253e['parentSegment'];if(!_0x31ce8f)return console[_0x1b0bfb(0x205)](a27_0x44fedf['red'](_0x1b0bfb(0x22c))),console[_0x1b0bfb(0x205)](_0x1b0bfb(0x287)),console['error'](a27_0x44fedf[_0x1b0bfb(0x1e7)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;if(_0x51f581[_0x1b0bfb(0x218)]&&_0x51f581[_0x1b0bfb(0x293)])return console[_0x1b0bfb(0x205)](a27_0x44fedf['red']('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x1b0bfb(0x205)](a27_0x44fedf[_0x1b0bfb(0x2d3)](_0x1b0bfb(0x216))),console[_0x1b0bfb(0x205)](a27_0x44fedf['dim'](_0x1b0bfb(0x304)+PARENT_SEGMENT_DIR+_0x1b0bfb(0x21f))),console[_0x1b0bfb(0x205)](a27_0x44fedf[_0x1b0bfb(0x1e7)](_0x1b0bfb(0x2b4))),0x1;const _0x6583c=_0x51f581[_0x1b0bfb(0x293)]||a27_0xb285cd[_0x1b0bfb(0x275)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31ce8f)+_0x1b0bfb(0x2fd));_0x51f581[_0x1b0bfb(0x1e9)]&&(console['error']('Site:\x20'+_0x51f581[_0x1b0bfb(0x238)]),console['error'](_0x1b0bfb(0x302)+_0x31ce8f),console[_0x1b0bfb(0x205)](_0x1b0bfb(0x2f7)+_0x6583c));const _0x16a614=await withSpinner(_0x1b0bfb(0x26e)+_0x31ce8f+_0x1b0bfb(0x274),()=>_0x27866d[_0x1b0bfb(0x23e)][_0x1b0bfb(0x2b1)](_0x31ce8f),{'verbose':_0x51f581[_0x1b0bfb(0x1e9)]}),_0x4faa91=_0x16a614[_0x1b0bfb(0x30a)];if(existsSync(_0x6583c)){const _0x586b5d=readFileSync(_0x6583c,'utf-8'),_0x2df525=generateDiff(_0x586b5d,_0x4faa91);if(!hasChanges(_0x2df525))console['error'](a27_0x44fedf['green']('✔')+_0x1b0bfb(0x2c6)+a27_0x44fedf[_0x1b0bfb(0x1e7)](_0x6583c)+_0x1b0bfb(0x27e));else{console[_0x1b0bfb(0x205)](_0x1b0bfb(0x2d7)+_0x6583c+'\x27:'),console[_0x1b0bfb(0x205)]('─'[_0x1b0bfb(0x21a)](0x3c)),console['error'](formatDiffWithColors(_0x2df525)),console[_0x1b0bfb(0x205)]('─'[_0x1b0bfb(0x21a)](0x3c));if(!_0x51f581[_0x1b0bfb(0x307)]){const _0x1468df=await confirmKey(_0x1b0bfb(0x265)+_0x6583c+'\x27?');if(!_0x1468df)return console['error'](_0x1b0bfb(0x20c)),0x1;}writeFileSync(_0x6583c,_0x4faa91,_0x1b0bfb(0x2ca)),console['error'](a27_0x44fedf[_0x1b0bfb(0x262)]('✔')+_0x1b0bfb(0x268)+a27_0x44fedf[_0x1b0bfb(0x1e7)](_0x6583c));}}else{const _0x9194a8=a27_0xb285cd[_0x1b0bfb(0x248)](_0x6583c);!existsSync(_0x9194a8)&&mkdirSync(_0x9194a8,{'recursive':!![]}),writeFileSync(_0x6583c,_0x4faa91,_0x1b0bfb(0x2ca)),console['error'](a27_0x44fedf[_0x1b0bfb(0x262)]('✔')+_0x1b0bfb(0x268)+a27_0x44fedf[_0x1b0bfb(0x1e7)](_0x6583c));}return saveSessionContext({'parent_segment':_0x31ce8f},_0x51f581[_0x1b0bfb(0x223)]),console[_0x1b0bfb(0x205)](a27_0x44fedf['green']('✔')+_0x1b0bfb(0x2ea)+a27_0x44fedf[_0x1b0bfb(0x2d3)](_0x1b0bfb(0x24c))+_0x1b0bfb(0x2ac)+a27_0x44fedf[_0x1b0bfb(0x1e7)](_0x31ce8f)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a27_0x30a75a(0x24e);[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x306);async[a27_0x30a75a(0x235)](_0x485597){const _0x182f14=a27_0x30a75a,{options:_0x21affd,args:_0x1f5540,tdx:_0x4c0f6e}=_0x485597,_0x4e7138=_0x21affd,_0x198d2f=_0x1f5540[0x0]||_0x21affd[_0x182f14(0x29a)];if(!_0x198d2f)return console['error'](a27_0x44fedf[_0x182f14(0x20e)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x182f14(0x205)]('Usage:\x20tdx\x20ps\x20push\x20[name]\x20[-y]\x0a'),console['error'](a27_0x44fedf[_0x182f14(0x1e7)](_0x182f14(0x27b))),0x1;const _0x45fe2c=resolveYamlFile(_0x198d2f);if(!existsSync(_0x45fe2c))return showFileNotFoundError(_0x45fe2c,_0x198d2f),0x1;_0x4e7138[_0x182f14(0x1e9)]&&(console['error'](_0x182f14(0x282)+_0x4e7138[_0x182f14(0x238)]),console['error'](_0x182f14(0x2a1)+_0x45fe2c));let _0x5220d0;try{_0x5220d0=readFileSync(_0x45fe2c,_0x182f14(0x2ca));}catch(_0x400434){const _0x340c86=_0x400434 instanceof Error?_0x400434[_0x182f14(0x2cc)]:String(_0x400434);return console['error'](_0x182f14(0x21e)+_0x340c86),0x1;}const _0x12283d=await withSpinner(_0x182f14(0x28a),()=>_0x4c0f6e[_0x182f14(0x23e)][_0x182f14(0x2ff)](_0x5220d0),{'verbose':_0x4e7138['verbose']}),_0x35f20b=_0x12283d[_0x182f14(0x30a)],{isNew:_0x32ddb0,name:_0x566c53,hasChanges:_0x28dead,diffFormatted:_0x235431}=_0x35f20b;if(!_0x28dead)return console[_0x182f14(0x205)]('✔\x20No\x20changes\x20-\x20\x27'+_0x566c53+_0x182f14(0x227)),0x0;_0x32ddb0?console[_0x182f14(0x205)](_0x182f14(0x234)+_0x566c53+'\x27:'):console['error'](_0x182f14(0x217)+_0x566c53+'\x27:');console['error']('─'[_0x182f14(0x21a)](0x3c)),console[_0x182f14(0x205)](_0x235431),console[_0x182f14(0x205)]('─'['repeat'](0x3c));const _0x210743=_0x32ddb0?_0x182f14(0x308)+_0x566c53+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x566c53+'\x27?';if(!_0x4e7138['yes']){const _0x5e1dea=await confirmKey(_0x210743);if(!_0x5e1dea)return console[_0x182f14(0x205)](_0x182f14(0x20c)),0x1;}const _0x37d0b1=_0x32ddb0?_0x182f14(0x2a6):_0x182f14(0x2c2),_0x953f71=await withSpinner(_0x37d0b1+_0x182f14(0x242)+_0x566c53+_0x182f14(0x274),()=>_0x35f20b[_0x182f14(0x2be)](),{'verbose':_0x4e7138[_0x182f14(0x1e9)]}),_0x3f0c74=_0x953f71[_0x182f14(0x30a)],_0x2ed640=getConsoleNextUrl(_0x4e7138['site'],_0x182f14(0x29d)+_0x3f0c74['id']),_0x1fc621=_0x32ddb0?_0x182f14(0x27f):_0x182f14(0x222);return console['error']('✔\x20'+_0x1fc621+'\x20parent\x20segment\x20\x27'+_0x3f0c74[_0x182f14(0x2de)]+'\x27'),console[_0x182f14(0x205)]('\x20\x20'+_0x2ed640),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a27_0x30a75a(0x2de)]=a27_0x30a75a(0x2c5);[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x1f3);async[a27_0x30a75a(0x235)](_0x5a48c1){const _0x49196e=a27_0x30a75a,{options:_0x194548,args:_0x471aa3,tdx:_0x470d67}=_0x5a48c1,_0x5660f4=_0x194548,_0x3b7536=_0x471aa3[0x0]||_0x194548[_0x49196e(0x29a)];if(!_0x3b7536)return console[_0x49196e(0x205)](a27_0x44fedf['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x49196e(0x205)](_0x49196e(0x225)),console[_0x49196e(0x205)]('Options:'),console[_0x49196e(0x205)](_0x49196e(0x202)),console[_0x49196e(0x205)](_0x49196e(0x2e6)),console[_0x49196e(0x205)](_0x49196e(0x240)),console[_0x49196e(0x205)](a27_0x44fedf[_0x49196e(0x1e7)]('\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;const _0x26d7db=resolveYamlFile(_0x3b7536);if(!existsSync(_0x26d7db))return showFileNotFoundError(_0x26d7db,_0x3b7536),0x1;_0x5660f4[_0x49196e(0x1e9)]&&(console[_0x49196e(0x205)](_0x49196e(0x282)+_0x5660f4[_0x49196e(0x238)]),console[_0x49196e(0x205)](_0x49196e(0x2a1)+_0x26d7db));let _0x547f44;try{_0x547f44=readFileSync(_0x26d7db,'utf-8');}catch(_0x483aa5){const _0x5efa6a=_0x483aa5 instanceof Error?_0x483aa5['message']:String(_0x483aa5);return console[_0x49196e(0x205)](_0x49196e(0x21e)+_0x5efa6a),0x1;}const _0x47db24=createCommandSpinner(a27_0x44fedf['dim']('Validating\x20configuration...'),{'verbose':_0x5660f4[_0x49196e(0x1e9)]});_0x47db24['start']();const _0x8b91bd={'onProgress':_0x907597=>{_0x47db24['text']=formatProgressMessage(_0x907597);}};if(_0x5660f4[_0x49196e(0x257)])_0x8b91bd[_0x49196e(0x257)]=!![];if(_0x5660f4[_0x49196e(0x201)])_0x8b91bd[_0x49196e(0x201)]=!![];_0x5660f4['attribute']&&(_0x8b91bd[_0x49196e(0x309)]=_0x5660f4[_0x49196e(0x309)]);_0x5660f4[_0x49196e(0x2e9)]&&(_0x8b91bd[_0x49196e(0x2e9)]=_0x5660f4[_0x49196e(0x2e9)]);if(_0x5660f4[_0x49196e(0x300)])_0x8b91bd['interval']=_0x5660f4[_0x49196e(0x300)];let _0x4c9760;try{_0x4c9760=await _0x470d67[_0x49196e(0x23e)][_0x49196e(0x220)](_0x547f44,_0x8b91bd),_0x47db24[_0x49196e(0x303)]();}catch(_0x19dbad){_0x47db24[_0x49196e(0x303)]();throw _0x19dbad;}const _0xb334b9=_0x5660f4[_0x49196e(0x300)]||_0x49196e(0x204);return this[_0x49196e(0x28b)](_0x4c9760,_0x8b91bd,_0x26d7db,_0xb334b9),_0x4c9760[_0x49196e(0x269)]?0x0:0x1;}['displayValidateResults'](_0x42e583,_0x23daa2,_0x1f7f73,_0xe5fd9c){const _0x59eb2a=a27_0x30a75a;console[_0x59eb2a(0x205)]('\x0a'+a27_0x44fedf[_0x59eb2a(0x25c)]('Validate:')+'\x20'+_0x42e583[_0x59eb2a(0x2de)]),console['error']('═'[_0x59eb2a(0x21a)](0x3c)),this[_0x59eb2a(0x2eb)](_0x42e583);if(typeof _0x23daa2[_0x59eb2a(0x309)]==='string'){this['displayAttributesStats'](_0x42e583),this[_0x59eb2a(0x297)](_0x42e583),this['displayPreviewHints'](_0x1f7f73,_0xe5fd9c,_0x59eb2a(0x309),_0x23daa2['attribute']);return;}if(_0x23daa2[_0x59eb2a(0x309)]===!![]){this[_0x59eb2a(0x24a)](_0x42e583),this[_0x59eb2a(0x297)](_0x42e583),this['displayPreviewHints'](_0x1f7f73,_0xe5fd9c,_0x59eb2a(0x2e2));return;}if(typeof _0x23daa2[_0x59eb2a(0x2e9)]===_0x59eb2a(0x224)){this[_0x59eb2a(0x1fc)](_0x42e583,_0xe5fd9c),this[_0x59eb2a(0x297)](_0x42e583),this[_0x59eb2a(0x29b)](_0x1f7f73,_0xe5fd9c,'behavior',_0x23daa2['behavior']);return;}if(_0x23daa2[_0x59eb2a(0x2e9)]===!![]){this[_0x59eb2a(0x1fc)](_0x42e583,_0xe5fd9c),this[_0x59eb2a(0x297)](_0x42e583),this['displayPreviewHints'](_0x1f7f73,_0xe5fd9c,'behaviors');return;}this[_0x59eb2a(0x24a)](_0x42e583),this[_0x59eb2a(0x1fc)](_0x42e583,_0xe5fd9c),this[_0x59eb2a(0x297)](_0x42e583),this[_0x59eb2a(0x29b)](_0x1f7f73,_0xe5fd9c,_0x59eb2a(0x23f));}[a27_0x30a75a(0x29b)](_0x131945,_0x17908b,_0x419fe1,_0x4b8d30){const _0x56197a=a27_0x30a75a;console[_0x56197a(0x205)]('\x0a'+a27_0x44fedf[_0x56197a(0x2d3)]('To\x20view\x20sample\x20data:'));const _0x51149a=_0x17908b!=='-1d'?_0x56197a(0x1f1)+_0x17908b:'';if(_0x419fe1==='attribute'&&_0x4b8d30)console[_0x56197a(0x205)]('\x20\x20'+a27_0x44fedf[_0x56197a(0x2d3)]('tdx\x20segment\x20parent\x20preview\x20'+_0x131945+_0x56197a(0x20f)+_0x4b8d30+'\x22'+_0x51149a));else{if(_0x419fe1===_0x56197a(0x2e9)&&_0x4b8d30)console[_0x56197a(0x205)]('\x20\x20'+a27_0x44fedf['dim'](_0x56197a(0x27c)+_0x131945+_0x56197a(0x2bd)+_0x4b8d30+'\x22'+_0x51149a));else(_0x419fe1===_0x56197a(0x2e2)||_0x419fe1===_0x56197a(0x23f))&&console[_0x56197a(0x205)]('\x20\x20'+a27_0x44fedf[_0x56197a(0x2d3)](_0x56197a(0x27c)+_0x131945+'\x20--attribute\x20\x22<name>\x22'+_0x51149a));}(_0x419fe1==='behaviors'||_0x419fe1===_0x56197a(0x23f))&&console[_0x56197a(0x205)]('\x20\x20'+a27_0x44fedf['dim'](_0x56197a(0x27c)+_0x131945+_0x56197a(0x2d8)+_0x51149a)),_0x419fe1==='all'&&console['error']('\x20\x20'+a27_0x44fedf[_0x56197a(0x2d3)](_0x56197a(0x27c)+_0x131945+_0x56197a(0x1eb)+_0x51149a));}['displayMasterInfo'](_0x1de8d9){const _0x3010f1=a27_0x30a75a,{master:_0x2a38ba}=_0x1de8d9,_0x4c88d0=_0x2a38ba[_0x3010f1(0x2a0)]?a27_0x44fedf[_0x3010f1(0x262)]('✔'):a27_0x44fedf[_0x3010f1(0x20e)]('✘');console[_0x3010f1(0x205)]('\x0a'+a27_0x44fedf[_0x3010f1(0x2d3)](_0x3010f1(0x2e7))),console['error'](_0x4c88d0+'\x20'+a27_0x44fedf['bold'](_0x2a38ba[_0x3010f1(0x221)]+'.'+_0x2a38ba['table'])),_0x2a38ba[_0x3010f1(0x2a0)]?_0x2a38ba[_0x3010f1(0x276)]!==undefined&&console[_0x3010f1(0x205)]('\x20\x20'+a27_0x44fedf[_0x3010f1(0x2d3)]('Rows:')+'\x20'+a27_0x44fedf[_0x3010f1(0x1e7)](formatRows(_0x2a38ba[_0x3010f1(0x276)]))):console[_0x3010f1(0x205)]('\x20\x20'+a27_0x44fedf[_0x3010f1(0x20e)](_0x3010f1(0x24b))+'\x20'+_0x2a38ba['schemaError']);}[a27_0x30a75a(0x24a)](_0xb1e83f){const _0x594535=a27_0x30a75a;if(_0xb1e83f[_0x594535(0x2e2)][_0x594535(0x2b5)]===0x0)return;console[_0x594535(0x205)]('\x0a'+a27_0x44fedf[_0x594535(0x2d3)](_0x594535(0x299)));for(const _0x534552 of _0xb1e83f['attributes']){const _0x2f7d4e=_0x534552[_0x594535(0x2a0)]?a27_0x44fedf[_0x594535(0x262)]('✔'):a27_0x44fedf[_0x594535(0x20e)]('✘');let _0x1d5e64='';if(_0x534552['schemaValid']&&_0x534552[_0x594535(0x2c1)]!==undefined&&_0x534552[_0x594535(0x2b2)]!==undefined){const _0x968d34=_0x534552['coveragePercent'][_0x594535(0x2fb)](0x1),_0x370d05=_0x534552[_0x594535(0x2b2)]>=0x50?a27_0x44fedf[_0x594535(0x262)]:_0x534552['coveragePercent']>=0x32?a27_0x44fedf[_0x594535(0x1ec)]:a27_0x44fedf['red'];_0x1d5e64='\x20'+a27_0x44fedf['dim'](_0x594535(0x26b))+'\x20'+_0x370d05(_0x968d34+'%')+'\x20('+formatRows(_0x534552['matchedCount'])+_0x594535(0x22f);}console['error'](_0x2f7d4e+'\x20'+a27_0x44fedf[_0x594535(0x25c)](_0x534552['name'])+_0x1d5e64),console[_0x594535(0x205)]('\x20\x20'+a27_0x44fedf[_0x594535(0x2d3)](_0x594535(0x2c4))+'\x20'+a27_0x44fedf['bold'](_0x534552[_0x594535(0x221)]+'.'+_0x534552[_0x594535(0x2e5)]));const _0x2016aa=_0x534552['joinKey']===_0x534552[_0x594535(0x2c3)]?a27_0x44fedf['dim'](_0x594535(0x291))+'\x20'+_0x534552[_0x594535(0x285)]:a27_0x44fedf[_0x594535(0x2d3)](_0x594535(0x2a8))+'\x20'+_0x534552[_0x594535(0x285)]+_0x594535(0x2ac)+_0x534552[_0x594535(0x2c3)];console[_0x594535(0x205)]('\x20\x20'+_0x2016aa),console[_0x594535(0x205)]('\x20\x20'+a27_0x44fedf['dim'](_0x594535(0x2b7))),this[_0x594535(0x226)](_0x534552[_0x594535(0x2ae)]),!_0x534552[_0x594535(0x2a0)]&&console['error']('\x20\x20'+a27_0x44fedf[_0x594535(0x20e)](_0x594535(0x24b))+'\x20'+_0x534552[_0x594535(0x1ff)]);}}[a27_0x30a75a(0x1fc)](_0x2edd66,_0x1e5b02){const _0x4838fc=a27_0x30a75a;if(_0x2edd66[_0x4838fc(0x231)][_0x4838fc(0x2b5)]===0x0)return;console[_0x4838fc(0x205)]('\x0a'+a27_0x44fedf[_0x4838fc(0x2d3)](_0x4838fc(0x23c))+'\x20'+a27_0x44fedf[_0x4838fc(0x2d3)]('('+_0x1e5b02+')'));for(const _0x4dbf15 of _0x2edd66[_0x4838fc(0x231)]){const _0xa53356=_0x4dbf15[_0x4838fc(0x2a0)]?a27_0x44fedf[_0x4838fc(0x262)]('✔'):a27_0x44fedf[_0x4838fc(0x20e)]('✘');let _0x3bae14='';if(_0x4dbf15['schemaValid']&&_0x4dbf15['customersWithEvents']!==undefined&&_0x4dbf15[_0x4838fc(0x2da)]!==undefined){const _0x29e1e3=_0x4dbf15['customerPercent']?.[_0x4838fc(0x2fb)](0x1)||'?',_0x1c5e8e=(_0x4dbf15[_0x4838fc(0x237)]??0x0)>=0x32?a27_0x44fedf[_0x4838fc(0x262)]:(_0x4dbf15['customerPercent']??0x0)>=0x14?a27_0x44fedf[_0x4838fc(0x1ec)]:a27_0x44fedf[_0x4838fc(0x20e)];_0x3bae14='\x20'+a27_0x44fedf[_0x4838fc(0x2d3)](_0x4838fc(0x1fd))+'\x20'+_0x1c5e8e(formatRows(_0x4dbf15[_0x4838fc(0x29f)]))+'\x20('+_0x29e1e3+'%)\x20'+a27_0x44fedf[_0x4838fc(0x2d3)](_0x4838fc(0x277))+'\x20'+a27_0x44fedf[_0x4838fc(0x1e7)](formatRows(_0x4dbf15['totalEvents']));}console[_0x4838fc(0x205)](_0xa53356+'\x20'+a27_0x44fedf[_0x4838fc(0x25c)](_0x4dbf15['name'])+_0x3bae14),console[_0x4838fc(0x205)]('\x20\x20'+a27_0x44fedf['dim'](_0x4838fc(0x2c4))+'\x20'+a27_0x44fedf[_0x4838fc(0x25c)](_0x4dbf15[_0x4838fc(0x221)]+'.'+_0x4dbf15[_0x4838fc(0x2e5)]));const _0x46aa22=_0x4dbf15['joinKey']===_0x4dbf15[_0x4838fc(0x2c3)]?a27_0x44fedf[_0x4838fc(0x2d3)](_0x4838fc(0x291))+'\x20'+_0x4dbf15[_0x4838fc(0x285)]:a27_0x44fedf[_0x4838fc(0x2d3)](_0x4838fc(0x2a8))+'\x20'+_0x4dbf15[_0x4838fc(0x285)]+'\x20=\x20'+_0x4dbf15[_0x4838fc(0x2c3)];console['error']('\x20\x20'+_0x46aa22),console[_0x4838fc(0x205)]('\x20\x20'+a27_0x44fedf[_0x4838fc(0x2d3)](_0x4838fc(0x2b7))),this['displayColumns'](_0x4dbf15['columns']),!_0x4dbf15[_0x4838fc(0x2a0)]&&console[_0x4838fc(0x205)]('\x20\x20'+a27_0x44fedf[_0x4838fc(0x20e)](_0x4838fc(0x24b))+'\x20'+_0x4dbf15[_0x4838fc(0x1ff)]);}}['displayColumns'](_0x19f3b5){const _0x326685=a27_0x30a75a;for(const _0x5570bd of _0x19f3b5){_0x5570bd[_0x326685(0x26f)]===_0x5570bd[_0x326685(0x1fa)]||_0x5570bd[_0x326685(0x1fa)]==='*'?console[_0x326685(0x205)](_0x326685(0x208)+_0x5570bd[_0x326685(0x26f)]):console[_0x326685(0x205)](_0x326685(0x208)+_0x5570bd[_0x326685(0x26f)]+'\x20'+a27_0x44fedf[_0x326685(0x2d3)]('('+_0x5570bd['column']+')'));}}[a27_0x30a75a(0x297)](_0x17bded){const _0x321be5=a27_0x30a75a;console[_0x321be5(0x205)]('─'[_0x321be5(0x21a)](0x3c));if(_0x17bded[_0x321be5(0x2b8)][_0x321be5(0x2b5)]>0x0){console['error']('\x0a'+a27_0x44fedf[_0x321be5(0x20e)]('Errors:'));for(const _0x2c500f of _0x17bded[_0x321be5(0x2b8)]){console[_0x321be5(0x205)]('\x20\x20'+a27_0x44fedf[_0x321be5(0x20e)]('•')+'\x20'+_0x2c500f);}}_0x17bded[_0x321be5(0x269)]&&console[_0x321be5(0x205)]('\x0a'+a27_0x44fedf[_0x321be5(0x262)]('✔')+_0x321be5(0x272));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a27_0x30a75a(0x2de)]='segment:parent:preview';[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x22b);async[a27_0x30a75a(0x235)](_0x47bda4){const _0x42389a=a27_0x30a75a,{options:_0x394aad,args:_0x51bebf,tdx:_0x5a6e85}=_0x47bda4,_0xcfb746=_0x394aad,_0xca4540=_0x51bebf[0x0]||_0x394aad[_0x42389a(0x29a)];if(!_0xca4540)return console[_0x42389a(0x205)](a27_0x44fedf[_0x42389a(0x20e)](_0x42389a(0x22c))),console[_0x42389a(0x205)](_0x42389a(0x271)),console[_0x42389a(0x205)](_0x42389a(0x243)),console[_0x42389a(0x205)](_0x42389a(0x1f8)),console[_0x42389a(0x205)](_0x42389a(0x278)),console['error'](_0x42389a(0x2fc)),console[_0x42389a(0x205)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),console[_0x42389a(0x205)]('\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),console[_0x42389a(0x205)](a27_0x44fedf[_0x42389a(0x1e7)](_0x42389a(0x209))),0x1;if(!_0xcfb746[_0x42389a(0x257)]&&!_0xcfb746['attribute']&&!_0xcfb746[_0x42389a(0x2e9)]&&!_0xcfb746['enriched'])return console[_0x42389a(0x205)](a27_0x44fedf[_0x42389a(0x20e)](_0x42389a(0x1f9))),console['error']('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x42389a(0x205)](_0x42389a(0x2df)),console[_0x42389a(0x205)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x42389a(0x205)](_0x42389a(0x278)),console[_0x42389a(0x205)](_0x42389a(0x2fc)),console[_0x42389a(0x205)](_0x42389a(0x2ba)),0x1;const _0x116d89=resolveYamlFile(_0xca4540);if(!existsSync(_0x116d89))return showFileNotFoundError(_0x116d89,_0xca4540),0x1;_0xcfb746['verbose']&&(console['error']('Site:\x20'+_0xcfb746['site']),console[_0x42389a(0x205)](_0x42389a(0x2a1)+_0x116d89));let _0x34af0a;try{_0x34af0a=readFileSync(_0x116d89,'utf-8');}catch(_0x2d1093){const _0x3ede24=_0x2d1093 instanceof Error?_0x2d1093[_0x42389a(0x2cc)]:String(_0x2d1093);return console[_0x42389a(0x205)](_0x42389a(0x21e)+_0x3ede24),0x1;}let _0x545212;try{_0x545212=parseYamlString(_0x34af0a);}catch(_0x32d8f8){const _0x351df8=_0x32d8f8 instanceof Error?_0x32d8f8['message']:String(_0x32d8f8);return console[_0x42389a(0x205)](a27_0x44fedf['red'](_0x42389a(0x270)+_0x351df8)),0x1;}if(_0xcfb746['attribute']===!![]||_0xcfb746[_0x42389a(0x309)]===''){const _0x1635da=_0x545212[_0x42389a(0x2e2)]?.['map'](_0x3b51ae=>_0x3b51ae[_0x42389a(0x2de)])||[];if(_0x1635da['length']===0x0)console[_0x42389a(0x205)](a27_0x44fedf['red'](_0x42389a(0x247)));else{console['error'](a27_0x44fedf[_0x42389a(0x20e)](_0x42389a(0x2d1))),console[_0x42389a(0x205)](_0x42389a(0x200));for(const _0x126cf7 of _0x1635da){console[_0x42389a(0x205)]('\x20\x20'+a27_0x44fedf[_0x42389a(0x1e7)](_0x126cf7));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0xca4540+'\x20--attribute\x20\x22'+_0x1635da[0x0]+'\x22');}return 0x1;}if(_0xcfb746[_0x42389a(0x2e9)]===!![]||_0xcfb746[_0x42389a(0x2e9)]===''){const _0x4ba45b=_0x545212['behaviors']?.['map'](_0x255442=>_0x255442['name'])||[];if(_0x4ba45b[_0x42389a(0x2b5)]===0x0)console['error'](a27_0x44fedf['red'](_0x42389a(0x24d)));else{console[_0x42389a(0x205)](a27_0x44fedf[_0x42389a(0x20e)](_0x42389a(0x2cb))),console[_0x42389a(0x205)](_0x42389a(0x28c));for(const _0x49f7bc of _0x4ba45b){console[_0x42389a(0x205)]('\x20\x20'+a27_0x44fedf['cyan'](_0x49f7bc));}console['error'](_0x42389a(0x244)+_0xca4540+_0x42389a(0x2bd)+_0x4ba45b[0x0]+'\x22');}return 0x1;}const _0x187f26=createCommandSpinner(a27_0x44fedf[_0x42389a(0x2d3)](_0x42389a(0x2ee)),{'verbose':_0xcfb746['verbose']});_0x187f26[_0x42389a(0x2f4)]();const _0x4a8a3b={'onProgress':_0x159ef2=>{const _0x5051c1=_0x42389a;_0x187f26[_0x5051c1(0x281)]=formatProgressMessage(_0x159ef2);}};if(_0xcfb746[_0x42389a(0x257)])_0x4a8a3b[_0x42389a(0x257)]=!![];if(_0xcfb746[_0x42389a(0x309)]&&typeof _0xcfb746['attribute']==='string')_0x4a8a3b[_0x42389a(0x309)]=_0xcfb746[_0x42389a(0x309)];if(_0xcfb746[_0x42389a(0x2e9)]&&typeof _0xcfb746[_0x42389a(0x2e9)]==='string')_0x4a8a3b['behavior']=_0xcfb746[_0x42389a(0x2e9)];if(_0xcfb746[_0x42389a(0x201)])_0x4a8a3b[_0x42389a(0x201)]=!![];if(_0xcfb746['interval'])_0x4a8a3b[_0x42389a(0x300)]=_0xcfb746[_0x42389a(0x300)];let _0x48535f;try{_0x48535f=await _0x5a6e85[_0x42389a(0x23e)][_0x42389a(0x2d2)](_0x34af0a,_0x4a8a3b),_0x187f26['stop']();}catch(_0x28e829){_0x187f26[_0x42389a(0x303)]();throw _0x28e829;}return await this[_0x42389a(0x2a5)](_0x48535f,{'master':_0xcfb746[_0x42389a(0x257)],'attribute':typeof _0xcfb746['attribute']==='string'?_0xcfb746[_0x42389a(0x309)]:undefined,'behavior':typeof _0xcfb746[_0x42389a(0x2e9)]===_0x42389a(0x224)?_0xcfb746[_0x42389a(0x2e9)]:undefined,'enriched':_0xcfb746['enriched']}),_0x48535f[_0x42389a(0x269)]?0x0:0x1;}async[a27_0x30a75a(0x2a5)](_0x122d28,_0x3e4aea){const _0x1c784a=a27_0x30a75a;console['error']('\x0a'+a27_0x44fedf['bold'](_0x1c784a(0x301))+'\x20'+_0x122d28[_0x1c784a(0x2de)]),console[_0x1c784a(0x205)]('═'[_0x1c784a(0x21a)](0x3c));if(_0x3e4aea['master']&&_0x122d28['sampleData']){const _0x1d6a3f=a27_0x44fedf[_0x1c784a(0x2d3)]('Master:')+'\x20'+a27_0x44fedf[_0x1c784a(0x25c)](_0x122d28[_0x1c784a(0x257)]['database']+'.'+_0x122d28['master'][_0x1c784a(0x2e5)]);await this[_0x1c784a(0x20b)](_0x1d6a3f,_0x122d28['sampleData']);}else{if(_0x3e4aea[_0x1c784a(0x309)]&&_0x122d28[_0x1c784a(0x211)]){const _0xf481d0=a27_0x44fedf[_0x1c784a(0x2d3)](_0x1c784a(0x254))+'\x20'+a27_0x44fedf[_0x1c784a(0x25c)](_0x3e4aea[_0x1c784a(0x309)]);await this[_0x1c784a(0x20b)](_0xf481d0,_0x122d28[_0x1c784a(0x211)]);}else{if(_0x3e4aea['behavior']&&_0x122d28[_0x1c784a(0x211)]){const _0x15f43c=a27_0x44fedf['dim'](_0x1c784a(0x2db))+'\x20'+a27_0x44fedf['bold'](_0x3e4aea[_0x1c784a(0x2e9)]);await this[_0x1c784a(0x20b)](_0x15f43c,_0x122d28[_0x1c784a(0x211)]);}else{if(_0x3e4aea[_0x1c784a(0x201)]&&_0x122d28['sampleData']){const _0x2892e1=a27_0x44fedf[_0x1c784a(0x2d3)](_0x1c784a(0x283))+'\x20'+a27_0x44fedf[_0x1c784a(0x25c)]('Master\x20+\x20Attributes');await this[_0x1c784a(0x20b)](_0x2892e1,_0x122d28[_0x1c784a(0x211)]);}else!_0x122d28['sampleData']&&console['error'](_0x1c784a(0x1e5));}}}if(_0x122d28['errors'][_0x1c784a(0x2b5)]>0x0){console[_0x1c784a(0x205)]('─'[_0x1c784a(0x21a)](0x3c)),console[_0x1c784a(0x205)]('\x0a'+a27_0x44fedf[_0x1c784a(0x20e)](_0x1c784a(0x28d)));for(const _0x1adaea of _0x122d28['errors']){console[_0x1c784a(0x205)]('\x20\x20'+a27_0x44fedf[_0x1c784a(0x20e)]('•')+'\x20'+_0x1adaea);}}}async['displaySampleData'](_0x8dceb3,_0x55f920){const _0x465127=a27_0x30a75a;if(_0x55f920[_0x465127(0x2b5)]===0x0){console['error']('\x0a'+_0x8dceb3),console[_0x465127(0x205)](_0x465127(0x210));return;}console[_0x465127(0x205)]('\x0a'+_0x8dceb3);const _0xb1f503=Object[_0x465127(0x26c)](_0x55f920[0x0])['map'](_0xff0499=>({'name':_0xff0499,'type':typeof _0x55f920[0x0][_0xff0499]===_0x465127(0x251)?_0x465127(0x2d4):_0x465127(0x2a2)})),_0x36337d={'queryId':_0x465127(0x259),'columns':_0xb1f503,'data':_0x55f920,'stats':{'state':_0x465127(0x2dc),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x55f920[_0x465127(0x2b5)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x21a893=formatAsTable(_0x36337d,_0x55f920[_0x465127(0x2b5)],!![]);await writeOutput(_0x21a893,undefined,_0x465127(0x2e5));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a27_0x30a75a(0x21b);[a27_0x30a75a(0x23b)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a27_0x30a75a(0x235)](_0x392c83){const _0x3a43ad=a27_0x30a75a,{options:_0x1d3756,args:_0x59d3d8,tdx:_0x271b9d}=_0x392c83,_0x977c04=_0x1d3756,_0x32d041=_0x59d3d8[0x0]||_0x1d3756[_0x3a43ad(0x29a)];if(!_0x32d041)return console[_0x3a43ad(0x205)](a27_0x44fedf[_0x3a43ad(0x20e)](_0x3a43ad(0x22c))),console[_0x3a43ad(0x205)]('Usage:\x20tdx\x20parent-segment\x20run\x20<name>\x20[-y]\x0a'),console[_0x3a43ad(0x205)](a27_0x44fedf[_0x3a43ad(0x1e7)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;const _0x26af5f=resolveYamlFile(_0x32d041);if(existsSync(_0x26af5f)){_0x977c04[_0x3a43ad(0x1e9)]&&console[_0x3a43ad(0x205)]('Found\x20YAML\x20file:\x20'+_0x26af5f);let _0x4a41ae;try{_0x4a41ae=readFileSync(_0x26af5f,_0x3a43ad(0x2ca));}catch(_0x4b5e88){const _0x111993=_0x4b5e88 instanceof Error?_0x4b5e88[_0x3a43ad(0x2cc)]:String(_0x4b5e88);return console[_0x3a43ad(0x205)](_0x3a43ad(0x21e)+_0x111993),0x1;}const _0x5b5eb9=await withSpinner(_0x3a43ad(0x28a),()=>_0x271b9d['segment']['pushParentYaml'](_0x4a41ae),{'verbose':_0x977c04[_0x3a43ad(0x1e9)]}),_0x98b980=_0x5b5eb9[_0x3a43ad(0x30a)],{isNew:_0x50862e,name:_0x2a4b8a,hasChanges:_0x160fef,diffFormatted:_0x4830ff}=_0x98b980;if(_0x160fef){_0x50862e?console[_0x3a43ad(0x205)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x2a4b8a+'\x27:'):console[_0x3a43ad(0x205)](_0x3a43ad(0x217)+_0x2a4b8a+'\x27:');console[_0x3a43ad(0x205)]('─'[_0x3a43ad(0x21a)](0x3c)),console[_0x3a43ad(0x205)](_0x4830ff),console[_0x3a43ad(0x205)]('─'[_0x3a43ad(0x21a)](0x3c));const _0x2287c1=_0x50862e?_0x3a43ad(0x308)+_0x2a4b8a+_0x3a43ad(0x264):_0x3a43ad(0x30b)+_0x2a4b8a+_0x3a43ad(0x264);if(!_0x977c04[_0x3a43ad(0x307)]){const _0x366986=await confirmKey(_0x2287c1);if(!_0x366986)return console[_0x3a43ad(0x205)](_0x3a43ad(0x20c)),0x1;}const _0x409840=_0x50862e?_0x3a43ad(0x2a6):_0x3a43ad(0x2c2);await withSpinner(_0x409840+_0x3a43ad(0x242)+_0x2a4b8a+_0x3a43ad(0x274),()=>_0x98b980[_0x3a43ad(0x2be)](),{'verbose':_0x977c04[_0x3a43ad(0x1e9)]});const _0xae1497=_0x50862e?_0x3a43ad(0x27f):'Updated';console['error']('✔\x20'+_0xae1497+_0x3a43ad(0x242)+_0x2a4b8a+'\x27');}else console[_0x3a43ad(0x205)](_0x3a43ad(0x2b9)+_0x2a4b8a+'\x27\x20is\x20up\x20to\x20date');}const _0x2786ab=await withSpinner(_0x3a43ad(0x25d)+_0x32d041+'\x27...',()=>_0x271b9d[_0x3a43ad(0x23e)][_0x3a43ad(0x2b6)](_0x32d041),{'verbose':_0x977c04[_0x3a43ad(0x1e9)]}),_0x2301b5=_0x2786ab[_0x3a43ad(0x30a)],_0x2f7c42=getConsoleUrl(_0x977c04[_0x3a43ad(0x238)],'/app/workflows/'+_0x2301b5[_0x3a43ad(0x1f5)]+_0x3a43ad(0x2c7)+_0x2301b5[_0x3a43ad(0x219)]+'/attempt/'+_0x2301b5['workflowAttemptId']);return console[_0x3a43ad(0x205)](_0x3a43ad(0x27a)),console[_0x3a43ad(0x205)]('\x20\x20'+a27_0x44fedf[_0x3a43ad(0x2d3)](_0x3a43ad(0x2d5))+'\x20'+_0x2301b5[_0x3a43ad(0x1f0)]),console[_0x3a43ad(0x205)]('\x20\x20'+a27_0x44fedf[_0x3a43ad(0x2d3)](_0x3a43ad(0x256))+'\x20'+_0x2301b5['status']),console['error']('\x20\x20'+a27_0x44fedf[_0x3a43ad(0x2d3)]('Session:')+'\x20'+_0x2301b5[_0x3a43ad(0x219)]),console[_0x3a43ad(0x205)]('\x20\x20'+a27_0x44fedf[_0x3a43ad(0x2d3)](_0x3a43ad(0x2bc))+'\x20'+_0x2301b5[_0x3a43ad(0x2d0)]),console['error']('\x20\x20'+_0x2f7c42),console[_0x3a43ad(0x205)]('\x0a'+a27_0x44fedf[_0x3a43ad(0x2d3)]('To\x20cancel:')+_0x3a43ad(0x267)+_0x2301b5[_0x3a43ad(0x2d0)]+_0x3a43ad(0x207)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a27_0x30a75a(0x2de)]=a27_0x30a75a(0x26a);['description']=a27_0x30a75a(0x2a9);async[a27_0x30a75a(0x235)](_0x8a1c10){const _0x43a4cd=a27_0x30a75a,{options:_0x545e4b,args:_0x2c6065,tdx:_0x1670c4}=_0x8a1c10,_0x24e3b2=_0x2c6065[0x0]||_0x545e4b['parentSegment'];if(!_0x24e3b2)return console[_0x43a4cd(0x205)](a27_0x44fedf[_0x43a4cd(0x20e)](_0x43a4cd(0x22c))),console[_0x43a4cd(0x205)](_0x43a4cd(0x26d)),console[_0x43a4cd(0x205)](a27_0x44fedf['cyan'](_0x43a4cd(0x288))),0x1;_0x545e4b[_0x43a4cd(0x1e9)]&&(console[_0x43a4cd(0x205)](_0x43a4cd(0x282)+_0x545e4b[_0x43a4cd(0x238)]),console[_0x43a4cd(0x205)](_0x43a4cd(0x302)+_0x24e3b2));const _0x294f3f=await withSpinner(_0x43a4cd(0x290)+_0x24e3b2+_0x43a4cd(0x274),()=>_0x1670c4[_0x43a4cd(0x23e)][_0x43a4cd(0x2c0)](_0x24e3b2),{'verbose':_0x545e4b[_0x43a4cd(0x1e9)]}),_0x53110d=_0x294f3f['data'];console[_0x43a4cd(0x205)](_0x43a4cd(0x203)+_0x53110d['length']+'\x20field'+(_0x53110d['length']!==0x1?'s':''));if(_0x545e4b[_0x43a4cd(0x296)]||_0x545e4b[_0x43a4cd(0x2f5)])return await handleSDKOutput(_0x53110d,_0x545e4b),0x0;return displayFieldsHumanReadable(_0x53110d,_0x24e3b2),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a27_0x30a75a(0x2de)]='segment:parent:view';[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x2e1);async[a27_0x30a75a(0x235)](_0x296d83){const _0x18d720=a27_0x30a75a,{options:_0x239273,args:_0x263fcf,tdx:_0x55d578}=_0x296d83,_0x5bb925=_0x239273,_0x529b6f=_0x263fcf[0x0]||_0x239273['parentSegment'];if(!_0x529b6f)return console[_0x18d720(0x205)](a27_0x44fedf[_0x18d720(0x20e)](_0x18d720(0x22c))),console[_0x18d720(0x205)]('Usage:\x20tdx\x20ps\x20view\x20[name]\x20[-w]\x0a'),console[_0x18d720(0x205)](_0x18d720(0x2df)),console['error'](_0x18d720(0x20d)),console['error'](a27_0x44fedf['cyan']('\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0x239273[_0x18d720(0x1e9)]&&(console[_0x18d720(0x205)](_0x18d720(0x282)+_0x239273[_0x18d720(0x238)]),console[_0x18d720(0x205)](_0x18d720(0x302)+_0x529b6f));const _0x2202ad=await withSpinner(_0x18d720(0x26e)+_0x529b6f+'\x27...',()=>_0x55d578['segment'][_0x18d720(0x21d)](_0x529b6f),{'verbose':_0x239273[_0x18d720(0x1e9)]}),_0x28f0bd=_0x2202ad[_0x18d720(0x30a)];if(_0x5bb925['web']){const _0xcb1cd=getConsoleNextUrl(_0x5bb925['site'],_0x18d720(0x29d)+_0x28f0bd['id']);return console['error'](a27_0x44fedf['green']('✔')+_0x18d720(0x29c)+a27_0x44fedf['cyan'](_0xcb1cd)),openBrowser(_0xcb1cd),0x0;}return await handleSingleObjectOutput(_0x28f0bd,_0x239273),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{['name']=a27_0x30a75a(0x1fb);[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x295);async[a27_0x30a75a(0x235)](_0x1eb9ef){const _0x4389e8=a27_0x30a75a,{options:_0x3353be,args:_0x1cead5,tdx:_0x2598c8}=_0x1eb9ef,_0x3f6bf2=_0x1cead5[0x0]||_0x3353be[_0x4389e8(0x29a)];if(!_0x3f6bf2)return console[_0x4389e8(0x205)](a27_0x44fedf['red'](_0x4389e8(0x22c))),console[_0x4389e8(0x205)](_0x4389e8(0x239)),console[_0x4389e8(0x205)](a27_0x44fedf[_0x4389e8(0x1e7)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0x3353be[_0x4389e8(0x1e9)]&&(console['error'](_0x4389e8(0x282)+_0x3353be[_0x4389e8(0x238)]),console[_0x4389e8(0x205)](_0x4389e8(0x302)+_0x3f6bf2));const _0x155404=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3f6bf2+_0x4389e8(0x274),()=>_0x2598c8['segment'][_0x4389e8(0x2ed)](_0x3f6bf2),{'verbose':_0x3353be[_0x4389e8(0x1e9)]}),_0x449c5a=_0x155404['data'],_0x17a50=await withSpinner(_0x4389e8(0x241)+_0x3f6bf2+_0x4389e8(0x274),()=>_0x2598c8['segment']['getParentSQL'](_0x449c5a),{'verbose':_0x3353be[_0x4389e8(0x1e9)]}),_0x19ee6e=await executeSchemaQuery(_0x17a50[_0x4389e8(0x30a)],_0x2598c8,_0x3353be);return await handleQueryOutput(_0x19ee6e,_0x3353be),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a27_0x30a75a(0x2de)]='segment:parent:sql';[a27_0x30a75a(0x23b)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a27_0x30a75a(0x235)](_0xcf8a97){const _0x33a08a=a27_0x30a75a,{options:_0x7537a2,args:_0x56eb83,tdx:_0x58640d}=_0xcf8a97,_0xdd0e2f=_0x56eb83[0x0]||_0x7537a2[_0x33a08a(0x29a)];if(!_0xdd0e2f)return console[_0x33a08a(0x205)](a27_0x44fedf[_0x33a08a(0x20e)](_0x33a08a(0x22c))),console['error']('Usage:\x20tdx\x20ps\x20sql\x20[name]\x0a'),console[_0x33a08a(0x205)](a27_0x44fedf[_0x33a08a(0x1e7)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0x7537a2[_0x33a08a(0x1e9)]&&(console[_0x33a08a(0x205)](_0x33a08a(0x282)+_0x7537a2['site']),console['error'](_0x33a08a(0x302)+_0xdd0e2f));const _0x3c5956=await withSpinner(_0x33a08a(0x25e)+_0xdd0e2f+'\x27...',()=>_0x58640d['segment'][_0x33a08a(0x2ed)](_0xdd0e2f),{'verbose':_0x7537a2['verbose']}),_0x81d5da=_0x3c5956['data'],_0x3f7794=await withSpinner(_0x33a08a(0x241)+_0xdd0e2f+_0x33a08a(0x274),()=>_0x58640d[_0x33a08a(0x23e)][_0x33a08a(0x298)](_0x81d5da),{'verbose':_0x7537a2[_0x33a08a(0x1e9)]}),_0x4fdb87=_0x3f7794[_0x33a08a(0x30a)];return _0x7537a2[_0x33a08a(0x25b)]==='json'||_0x7537a2[_0x33a08a(0x25b)]===_0x33a08a(0x2f5)?await handleSDKOutput([{'sql':_0x4fdb87}],_0x7537a2):console[_0x33a08a(0x292)](_0x4fdb87),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a27_0x30a75a(0x2de)]=a27_0x30a75a(0x2f9);[a27_0x30a75a(0x23b)]=a27_0x30a75a(0x261);async[a27_0x30a75a(0x235)](_0x6f19d0){const _0x2f6df9=a27_0x30a75a,{options:_0x2f2995,args:_0x27f45e,tdx:_0x5d70a1}=_0x6f19d0,_0x107506=_0x27f45e[0x0]||_0x2f2995[_0x2f6df9(0x29a)];if(!_0x107506)return console['error'](a27_0x44fedf[_0x2f6df9(0x20e)](_0x2f6df9(0x22c))),console[_0x2f6df9(0x205)](_0x2f6df9(0x286)),console[_0x2f6df9(0x205)](a27_0x44fedf['cyan'](_0x2f6df9(0x288))),0x1;_0x2f2995['verbose']&&(console[_0x2f6df9(0x205)](_0x2f6df9(0x282)+_0x2f2995['site']),console[_0x2f6df9(0x205)](_0x2f6df9(0x302)+_0x107506));const _0x166eda=await withSpinner(_0x2f6df9(0x25e)+_0x107506+_0x2f6df9(0x274),()=>_0x5d70a1[_0x2f6df9(0x23e)][_0x2f6df9(0x2ed)](_0x107506),{'verbose':_0x2f2995['verbose']}),_0x58bd44=_0x166eda['data'],_0x2a644b=await withSpinner(_0x2f6df9(0x241)+_0x107506+_0x2f6df9(0x274),()=>_0x5d70a1['segment'][_0x2f6df9(0x298)](_0x58bd44),{'verbose':_0x2f2995[_0x2f6df9(0x1e9)]});let _0x37b7a9=_0x2a644b[_0x2f6df9(0x30a)];const _0x26b952=resolveLimit(_0x2f2995['limit'],DEFAULT_DISPLAY_LIMIT),_0x4aedd0=/\bLIMIT\s+\d+/i['test'](_0x37b7a9);!_0x4aedd0&&(_0x37b7a9=_0x37b7a9[_0x2f6df9(0x2e4)]()[_0x2f6df9(0x305)](/;+$/,''),_0x37b7a9=_0x2f6df9(0x1ef)+_0x37b7a9+_0x2f6df9(0x25f)+_0x26b952);_0x2f2995[_0x2f6df9(0x1e9)]&&console[_0x2f6df9(0x205)](_0x2f6df9(0x2bf)+_0x37b7a9);const _0x3a2d80=await withQuerySpinner(_0x2f6df9(0x2a3),async _0x81e43f=>{const _0x405a27=_0x2f6df9,_0x434db4=await _0x5d70a1[_0x405a27(0x253)]['execute'](_0x37b7a9,{'catalog':'td','schema':'information_schema','onJobId':_0x5fd164=>{const _0x4622cb=_0x405a27;_0x81e43f[_0x4622cb(0x1fe)](_0x5fd164);}});return _0x434db4;},{'verbose':_0x2f2995[_0x2f6df9(0x1e9)]}),_0x4a17db=_0x3a2d80['data'],_0x2deced=_0x4a17db[_0x2f6df9(0x263)]?_0x2f6df9(0x2e8)+_0x4a17db[_0x2f6df9(0x263)]+']':'';return console['error'](_0x2f6df9(0x245)+_0x4a17db[_0x2f6df9(0x2f3)][_0x2f6df9(0x289)][_0x2f6df9(0x2dd)]()+_0x2f6df9(0x252)+(_0x2f6df9(0x1ea)+formatElapsed(_0x4a17db[_0x2f6df9(0x2f3)]['elapsedTimeMillis'])+_0x2deced)),await handleQueryOutput(_0x4a17db,_0x2f2995),0x0;}}
1
+ const a27_0x3dec44=a27_0x3f10;(function(_0x33747a,_0x3c6390){const _0x4df0b8=a27_0x3f10,_0x54bace=_0x33747a();while(!![]){try{const _0x5c08b2=-parseInt(_0x4df0b8(0x159))/0x1*(-parseInt(_0x4df0b8(0x1cf))/0x2)+-parseInt(_0x4df0b8(0x122))/0x3+parseInt(_0x4df0b8(0x1ca))/0x4*(-parseInt(_0x4df0b8(0x16f))/0x5)+-parseInt(_0x4df0b8(0xbb))/0x6+-parseInt(_0x4df0b8(0xff))/0x7*(parseInt(_0x4df0b8(0x1c6))/0x8)+-parseInt(_0x4df0b8(0xda))/0x9*(parseInt(_0x4df0b8(0x183))/0xa)+-parseInt(_0x4df0b8(0xfb))/0xb*(-parseInt(_0x4df0b8(0xd2))/0xc);if(_0x5c08b2===_0x3c6390)break;else _0x54bace['push'](_0x54bace['shift']());}catch(_0x5bc816){_0x54bace['push'](_0x54bace['shift']());}}}(a27_0x1cb4,0x47954));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';function a27_0x1cb4(){const _0x560d4e=['output','\x0aChanges\x20to\x20\x27','getParentFull','segment:parent:push','tdx\x20segment\x20parent\x20preview\x20','in\x20','description','ignore','Preview:','segment:parent:view','database','\x20--attribute\x20\x22<name>\x22','resolveParentId','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)','Executing\x20parent\x20segment\x20query...','8830iRvSYX','replace','Available\x20behaviors:','updateParent','dim','open','totalEvents','green','listFields','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Master:','Analyzing\x20changes...','population','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20[Job\x20ID:\x20','displayBehaviorsStats','yellow','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','displayColumns','text','elapsedTimeMillis','displayPreviewHints','xdg-open','.yml','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Updating\x20parent\x20segment\x20\x27','Coverage:','session','/\x20→\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','List\x20available\x20fields\x20for\x20segmentation','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Error:','SELECT\x20*\x20FROM\x20(\x0a','behaviorsFile','foreignKey','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Listing\x20fields\x20for\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a','Pattern:\x20','Attribute:','Fetching\x20current\x20configuration\x20for\x20\x27','customerPercent','Site:\x20','segment:parent:pull','site','Columns:','Error:\x20--database\x20and\x20--table\x20are\x20required','/\x20and\x20','Available\x20attributes:','\x20parent\x20segment','workflowId','displayPreviewResults','columns','Error:\x20File\x20not\x20found:\x20','Listing\x20parent\x20segments...','Usage:\x20tdx\x20ps\x20sql\x20[name]\x0a','localeCompare','status','segment:parent:list','Aborted.','number','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20Context\x20set:\x20','segment','5944TXCIuW','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20use\x20`tdx\x20ps\x20pull`\x20to\x20get\x20a\x20YAML\x20file\x20first','Source:','Enriched:','92656LywkZh','customerGroup','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','verbose','25394KAiHCH','unref','keys','attribute','Error\x20parsing\x20YAML:\x20','\x20No\x20changes\x20-\x20','addBehaviorsFile','Errors:','all','attributesFile','Fetching\x20SQL\x20for\x20\x27','Behaviors','Usage:\x20tdx\x20ps\x20show\x20[name]\x0a','-1d','double','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Name:\x20','To\x20cancel:','Updated','interval','parent_segments','\x0aChanges\x20to\x20apply\x20to\x20\x27','2915196rgxiVg','\x20tdx\x20wf\x20attempt\x20','Behavior:','displayValidateResults','workflowSessionId','✔\x20Renamed\x20directory\x20to\x20','error','allValid','validateParentYaml','\x20Configuration\x20is\x20valid','FINISHED','win32','trim','cyan','Usage:\x20tdx\x20parent-segment\x20validate\x20<name>\x20[options]\x0a','pushParentYaml','use','\x0a⚠️\x20\x20Migrating:\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','pullParentYaml','Master\x20+\x20Attributes','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','/\x20directory.\x0a','12ndAdRY','Usage:\x20tdx\x20ps\x20fields\x20[name]\x0a','Join\x20on:','Overwrite\x20\x27','setJobId','label','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Options\x20(one\x20required):','4842PzoNBq','name','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Creating\x20parent\x20segment\x20\x27','\x20--interval\x20','.yaml','Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x0aNo\x20sample\x20data\x20available','errors','getParentSQL','start','segment:parent:desc','Show\x20parent\x20segment\x20schema\x20(column\x20types)','No\x20parent\x20segments\x20match\x20pattern:\x20','red','\x20rows\x20','\x20--attribute\x20\x22','\x20Opening\x20','displaySummary','attributes','log','👥\x20','\x20parent\x20segment\x20\x27','platform','addBehaviors','\x20--enriched','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','timezone','YAML\x20file:\x20','apply','Fetching\x20parent\x20segment\x20\x27','Attributes','16718801PkTYzj','dirname','column','\x20kill','21IlFZwJ','segment:parent:sql','✔\x20Found\x20','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','parentSegment','/{name}.yml\x0a','darwin','segment:parent:create','test','\x27\x20is\x20already\x20up\x20to\x20date','addAttributesFile','/app/dw/parentSegments/','preview','message','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Error:\x20Parent\x20segment\x20name\x20is\x20required','\x20\x20No\x20sample\x20data\x20available','\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`','Listing\x20parent\x20segments\x20matching\x20\x27','join','Creating','coveragePercent','displayAttributesStats','segment:parent:run','%)\x20','Show\x20parent\x20segment\x20details','bold','\x20=\x20','jsonl','Output\x20file:\x20','sampleData','createParent','utf-8','toFixed','toLocaleString','308268Zhrjyp','Parent\x20segment:\x20','map','runParent','Created','matchedCount','Updating','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','run','data','List\x20parent\x20segments','json','Master\x20Table','length','Join:','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','segment:parent:update','isDirectory','customersWithEvents','string','table','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20\x20\x20-\x20','enriched','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Customers:','workflowAttemptId','SQL\x20query:\x0a','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','format','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','behaviors','\x27\x20with\x20ID:\x20','endsWith','Options:','\x20--behavior\x20\x22','✔\x20Created\x20parent\x20segment\x20\x27','✔\x20No\x20changes\x20-\x20\x27','sort','scheduleType','Error\x20reading\x20file:\x20','Get\x20SQL\x20query\x20for\x20parent\x20segment','schemaValid','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','/app/workflows/','No\x20parent\x20segments\x20found','Database:\x20','yes','parent_segment','master','/\x20directories\x20exist.','To\x20view\x20sample\x20data:','Create\x20parent\x20segment\x20\x27','\x27...','behavior','22JeFONQ','stats','Attempt:','repeat','scheduleOption','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','execute','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Rows:','\x20field','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','joinKey','displayMasterInfo','segment:parent:fields','\x27\x20is\x20up\x20to\x20date','\x27\x20and\x20run\x20workflow?','displaySampleData','Found\x20YAML\x20file:\x20','customerGroupFile','\x20is\x20already\x20up\x20to\x20date','Events:','/attempt/','95osAXwo','stop','jobId','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','match'];a27_0x1cb4=function(){return _0x560d4e;};return a27_0x1cb4();}import a27_0x8c2021 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';function a27_0x3f10(_0x5b4b09,_0x4d0752){_0x5b4b09=_0x5b4b09-0xac;const _0x1cb4ca=a27_0x1cb4();let _0x3f1069=_0x1cb4ca[_0x5b4b09];return _0x3f1069;}import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a27_0x479863 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';const PARENT_SEGMENT_DIR=a27_0x3dec44(0xb9),LEGACY_PARENT_SEGMENT_DIR=a27_0x3dec44(0x152);function openBrowser(_0x4bcb75){const _0x1f1f94=a27_0x3dec44,_0x30b74d=process[_0x1f1f94(0xf2)],_0x255177=_0x30b74d===_0x1f1f94(0x105)?_0x1f1f94(0x188):_0x30b74d===_0x1f1f94(0xc6)?_0x1f1f94(0xe5):_0x1f1f94(0x199);spawn(_0x255177,[_0x4bcb75],{'detached':!![],'stdio':_0x1f1f94(0x17b)})[_0x1f1f94(0x1d0)]();}function sanitizeFileName(_0x33ec04){const _0x49138a=a27_0x3dec44;return _0x33ec04['toLowerCase']()[_0x49138a(0x184)](/[/\\:*?"<>|]/g,'-')[_0x49138a(0x184)](/\s+/g,'-')['replace'](/-+/g,'-')[_0x49138a(0x184)](/^-|-$/g,'');}function migrateLegacyDirectory(){const _0x415d66=a27_0x3dec44;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2254a4=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2254a4[_0x415d66(0x133)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x415d66(0xc1)](a27_0x479863[_0x415d66(0x193)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x415d66(0x1b4)+PARENT_SEGMENT_DIR+_0x415d66(0x154))),console[_0x415d66(0xc1)](a27_0x479863[_0x415d66(0x187)](_0x415d66(0x13e)+LEGACY_PARENT_SEGMENT_DIR+_0x415d66(0xd1))),![];console[_0x415d66(0xc1)](a27_0x479863[_0x415d66(0x193)](_0x415d66(0xcc)+LEGACY_PARENT_SEGMENT_DIR+_0x415d66(0x1a0)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a27_0x479863['green'](_0x415d66(0xc0)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2c75a6){const _0x4142f3=_0x2c75a6 instanceof Error?_0x2c75a6[_0x415d66(0x10c)]:String(_0x2c75a6);return console[_0x415d66(0xc1)](a27_0x479863['red'](_0x415d66(0x1c3)+_0x4142f3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a27_0x3dec44(0x12a)](_0x2b3438){const _0x571986=a27_0x3dec44;return migrateLegacyDirectory(),super[_0x571986(0x12a)](_0x2b3438);}}function resolveYamlFile(_0x31a928){const _0x24cecd=a27_0x3dec44;if(_0x31a928[_0x24cecd(0x143)]('.yml')||_0x31a928['endsWith'](_0x24cecd(0xdf)))return _0x31a928;return a27_0x8c2021[_0x24cecd(0x112)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31a928)+_0x24cecd(0x19a));}function formatProgressMessage(_0x550b49){const _0x326f80=a27_0x3dec44,_0x343b99=_0x550b49[_0x326f80(0x173)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x343b99){const [,_0x1551b2,_0x3b2bca,_0x13c144='']=_0x343b99;return a27_0x479863[_0x326f80(0x187)](_0x1551b2+':')+'\x20'+_0x3b2bca+a27_0x479863[_0x326f80(0x187)](_0x13c144);}return a27_0x479863[_0x326f80(0x187)](_0x550b49);}function showFileNotFoundError(_0xfdb160,_0x40f6f8){const _0x4b4f4a=a27_0x3dec44;console[_0x4b4f4a(0xc1)](a27_0x479863['red'](_0x4b4f4a(0x1ba)+_0xfdb160+'\x0a')),console['error'](a27_0x479863[_0x4b4f4a(0xc8)](_0x4b4f4a(0xb4)+_0x40f6f8+'`\x20to\x20download\x20the\x20configuration\x20first'));}export class ParentSegmentListCommand extends BaseCommand{['name']=a27_0x3dec44(0x1bf);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x12c);async['execute'](_0x27e73e){const _0x1c5cb5=a27_0x3dec44,{options:_0x107256,args:_0x5c0eed,tdx:_0x1d1838}=_0x27e73e,_0x106e1c=_0x5c0eed[0x0];_0x107256[_0x1c5cb5(0x1ce)]&&(console['error'](_0x1c5cb5(0x1af)+_0x107256[_0x1c5cb5(0x1b1)]),_0x106e1c&&console[_0x1c5cb5(0xc1)](_0x1c5cb5(0x1ab)+_0x106e1c));const _0x55fb2d=await withSpinner(_0x106e1c?_0x1c5cb5(0x111)+_0x106e1c+'\x27...':_0x1c5cb5(0x1bb),()=>_0x1d1838[_0x1c5cb5(0x1c5)]['listParents'](),{'verbose':_0x107256['verbose']});let _0x303217=_0x55fb2d[_0x1c5cb5(0x12b)];if(_0x106e1c){const _0x351794=_0x106e1c[_0x1c5cb5(0x184)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x1c5cb5(0x184)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x2b0fd4=new RegExp('^'+_0x351794+'$','i');_0x303217=_0x303217['filter'](_0x2bd504=>_0x2b0fd4[_0x1c5cb5(0x107)](_0x2bd504[_0x1c5cb5(0xee)][_0x1c5cb5(0xdb)]));}_0x303217[_0x1c5cb5(0x148)]((_0x298ce9,_0x477225)=>_0x298ce9[_0x1c5cb5(0xee)][_0x1c5cb5(0xdb)][_0x1c5cb5(0x1bd)](_0x477225[_0x1c5cb5(0xee)][_0x1c5cb5(0xdb)])),console[_0x1c5cb5(0xc1)]('✔\x20Found\x20'+_0x303217['length']+_0x1c5cb5(0x1b6)+(_0x303217[_0x1c5cb5(0x12f)]!==0x1?'s':''));if(_0x107256[_0x1c5cb5(0x13f)]===_0x1c5cb5(0x12d)||_0x107256[_0x1c5cb5(0x13f)]===_0x1c5cb5(0x11b))await handleSDKOutput(_0x303217,_0x107256);else{if(_0x303217[_0x1c5cb5(0x12f)]===0x0)_0x106e1c?console['log'](_0x1c5cb5(0xe8)+_0x106e1c):console[_0x1c5cb5(0xef)](_0x1c5cb5(0x14f));else for(const _0xf78dca of _0x303217){const _0x35863e=_0xf78dca[_0x1c5cb5(0xee)][_0x1c5cb5(0x18f)]?a27_0x479863[_0x1c5cb5(0x187)]('\x20('+formatRows(_0xf78dca[_0x1c5cb5(0xee)][_0x1c5cb5(0x18f)])+')'):'';console[_0x1c5cb5(0xef)](_0x1c5cb5(0xf0)+_0xf78dca[_0x1c5cb5(0xee)][_0x1c5cb5(0xdb)]+_0x35863e);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a27_0x3dec44(0x106);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x129);async[a27_0x3dec44(0x15f)](_0x5e52a2){const _0x49787e=a27_0x3dec44,{options:_0x4844c2,args:_0x557130,tdx:_0xf6ae27}=_0x5e52a2;console[_0x49787e(0xc1)](_0x49787e(0x19b)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x49787e(0x140));const _0xcfd01d=_0x4844c2;if(_0x557130[_0x49787e(0x12f)]===0x0)return console[_0x49787e(0xc1)](_0x49787e(0x10e)),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x1d3f19=_0x557130[0x0];if(!_0xcfd01d[_0x49787e(0x17e)]||!_0xcfd01d[_0x49787e(0x136)])return console[_0x49787e(0xc1)](_0x49787e(0x1b3)),console[_0x49787e(0xc1)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0xcfd01d['verbose']&&(console[_0x49787e(0xc1)](_0x49787e(0x1af)+_0xcfd01d[_0x49787e(0x1b1)]),console['error'](_0x49787e(0xb5)+_0x1d3f19),console[_0x49787e(0xc1)](_0x49787e(0x150)+_0xcfd01d[_0x49787e(0x17e)]),console[_0x49787e(0xc1)]('Table:\x20'+_0xcfd01d['table']));const _0x488227=await loadJSONFromOptions(_0xcfd01d[_0x49787e(0xee)],_0xcfd01d[_0x49787e(0xae)]),_0x1044e8=await loadJSONFromOptions(_0xcfd01d[_0x49787e(0x141)],_0xcfd01d[_0x49787e(0x1a6)]),_0x432768=await loadJSONFromOptions(_0xcfd01d[_0x49787e(0x1cb)],_0xcfd01d[_0x49787e(0x16b)]),_0x3a3bfa={'name':_0x1d3f19,'description':_0xcfd01d['description'],'scheduleType':_0xcfd01d[_0x49787e(0x149)],'scheduleOption':_0xcfd01d[_0x49787e(0x15d)],'timezone':_0xcfd01d[_0x49787e(0xf6)],'master':{'parentDatabaseName':_0xcfd01d['database'],'parentTableName':_0xcfd01d[_0x49787e(0x136)]},'attributes':_0x488227,'behaviors':_0x1044e8,'customerGroup':_0x432768},_0xdfa8ae=await withSpinner(_0x49787e(0xdd)+_0x1d3f19+_0x49787e(0x157),()=>_0xf6ae27['segment'][_0x49787e(0x11e)](_0x3a3bfa),{'verbose':_0x4844c2['verbose']}),_0x1abec0=_0xdfa8ae[_0x49787e(0x12b)];return console[_0x49787e(0xc1)](_0x49787e(0x146)+_0x1abec0[_0x49787e(0xdb)]+_0x49787e(0x142)+_0x1abec0['id']),await handleSDKOutput([_0x1abec0],_0x4844c2),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a27_0x3dec44(0xdb)]=a27_0x3dec44(0x132);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x194);async['execute'](_0x3d586d){const _0x3756be=a27_0x3dec44,{options:_0x186d67,args:_0x439c66,tdx:_0x464090}=_0x3d586d;console[_0x3756be(0xc1)](_0x3756be(0xdc)+_0x3756be(0x137)+_0x3756be(0x140));const _0x39d776=_0x186d67;if(_0x439c66[_0x3756be(0x12f)]===0x0)return console[_0x3756be(0xc1)](_0x3756be(0x10e)),console[_0x3756be(0xc1)](_0x3756be(0x14d)),0x1;const _0x67556=_0x439c66[0x0];_0x39d776[_0x3756be(0x1ce)]&&(console[_0x3756be(0xc1)](_0x3756be(0x1af)+_0x39d776['site']),console[_0x3756be(0xc1)](_0x3756be(0x123)+_0x67556));const _0x51fb20=await withSpinner(_0x3756be(0x1ad)+_0x67556+_0x3756be(0x157),()=>_0x464090[_0x3756be(0x1c5)][_0x3756be(0x176)](_0x67556),{'verbose':_0x39d776[_0x3756be(0x1ce)]}),_0xde4104=_0x51fb20['data'],_0x5d2f2a=await loadJSONFromOptions(_0x39d776['addAttributes'],_0x39d776[_0x3756be(0x109)]),_0x312efb=await loadJSONFromOptions(_0x39d776[_0x3756be(0xf3)],_0x39d776[_0x3756be(0x1d5)]),_0x7ec622={'name':_0xde4104[_0x3756be(0xdb)],'description':_0x39d776[_0x3756be(0x17a)]!==undefined?_0x39d776[_0x3756be(0x17a)]:_0xde4104[_0x3756be(0x17a)],'scheduleType':_0x39d776[_0x3756be(0x149)]!==undefined?_0x39d776[_0x3756be(0x149)]:_0xde4104[_0x3756be(0x149)],'scheduleOption':_0x39d776[_0x3756be(0x15d)]!==undefined?_0x39d776['scheduleOption']:_0xde4104[_0x3756be(0x15d)],'timezone':_0x39d776[_0x3756be(0xf6)]!==undefined?_0x39d776[_0x3756be(0xf6)]:_0xde4104[_0x3756be(0xf6)],'master':_0xde4104[_0x3756be(0x153)],'attributes':_0x5d2f2a?[..._0xde4104[_0x3756be(0xee)]||[],..._0x5d2f2a]:_0xde4104[_0x3756be(0xee)],'behaviors':_0x312efb?[..._0xde4104[_0x3756be(0x141)]||[],..._0x312efb]:_0xde4104[_0x3756be(0x141)],'customerGroup':_0xde4104['customerGroup']},_0x5937ad=await withSpinner(_0x3756be(0x19d)+_0x67556+_0x3756be(0x157),()=>_0x464090[_0x3756be(0x1c5)][_0x3756be(0x186)](_0x67556,_0x7ec622),{'verbose':_0x39d776[_0x3756be(0x1ce)]}),_0x57d898=_0x5937ad[_0x3756be(0x12b)];return console[_0x3756be(0xc1)](_0x3756be(0x1cc)+_0x57d898[_0x3756be(0xdb)]+'\x27'),await handleSDKOutput([_0x57d898],_0x39d776),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a27_0x3dec44(0xdb)]=a27_0x3dec44(0x1b0);[a27_0x3dec44(0x17a)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a27_0x3dec44(0x15f)](_0x31342c){const _0x519253=a27_0x3dec44,{options:_0x443f48,args:_0x2c39d2,tdx:_0x16a97a}=_0x31342c,_0xb6c4cf=_0x443f48,_0xb95bfc=_0x2c39d2[0x0]||_0x443f48[_0x519253(0x103)];if(!_0xb95bfc)return console[_0x519253(0xc1)](a27_0x479863[_0x519253(0xe9)](_0x519253(0x1aa))),console[_0x519253(0xc1)]('Usage:\x20tdx\x20ps\x20pull\x20[name]\x20[-o\x20output.yml]\x20[-y]\x0a'),console[_0x519253(0xc1)](a27_0x479863[_0x519253(0xc8)](_0x519253(0xe0))),0x1;if(_0xb6c4cf[_0x519253(0xcb)]&&_0xb6c4cf[_0x519253(0x174)])return console[_0x519253(0xc1)](a27_0x479863[_0x519253(0xe9)](_0x519253(0x102))),console[_0x519253(0xc1)](a27_0x479863['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x519253(0xc1)](a27_0x479863['dim']('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x519253(0x104))),console[_0x519253(0xc1)](a27_0x479863[_0x519253(0xc8)](_0x519253(0x10d))),0x1;const _0x1ca2e8=_0xb6c4cf[_0x519253(0x174)]||a27_0x8c2021[_0x519253(0x112)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xb95bfc)+_0x519253(0x19a));_0xb6c4cf[_0x519253(0x1ce)]&&(console[_0x519253(0xc1)](_0x519253(0x1af)+_0xb6c4cf[_0x519253(0x1b1)]),console[_0x519253(0xc1)](_0x519253(0x123)+_0xb95bfc),console[_0x519253(0xc1)](_0x519253(0x11c)+_0x1ca2e8));const _0x4229ec=await withSpinner(_0x519253(0xf9)+_0xb95bfc+_0x519253(0x157),()=>_0x16a97a[_0x519253(0x1c5)][_0x519253(0xce)](_0xb95bfc),{'verbose':_0xb6c4cf[_0x519253(0x1ce)]}),_0x34bd50=_0x4229ec[_0x519253(0x12b)];if(existsSync(_0x1ca2e8)){const _0x274a5b=readFileSync(_0x1ca2e8,_0x519253(0x11f)),_0xd612f3=generateDiff(_0x274a5b,_0x34bd50);if(!hasChanges(_0xd612f3))console['error'](a27_0x479863[_0x519253(0x18a)]('✔')+_0x519253(0x1d4)+a27_0x479863['cyan'](_0x1ca2e8)+_0x519253(0x16c));else{console[_0x519253(0xc1)](_0x519253(0x175)+_0x1ca2e8+'\x27:'),console[_0x519253(0xc1)]('─'[_0x519253(0x15c)](0x3c)),console[_0x519253(0xc1)](formatDiffWithColors(_0xd612f3)),console[_0x519253(0xc1)]('─'[_0x519253(0x15c)](0x3c));if(!_0xb6c4cf['yes']){const _0xf37026=await confirmKey(_0x519253(0xd5)+_0x1ca2e8+'\x27?');if(!_0xf37026)return console['error'](_0x519253(0x1c0)),0x1;}writeFileSync(_0x1ca2e8,_0x34bd50,_0x519253(0x11f)),console[_0x519253(0xc1)](a27_0x479863[_0x519253(0x18a)]('✔')+_0x519253(0xe1)+a27_0x479863[_0x519253(0xc8)](_0x1ca2e8));}}else{const _0x156e7b=a27_0x8c2021[_0x519253(0xfc)](_0x1ca2e8);!existsSync(_0x156e7b)&&mkdirSync(_0x156e7b,{'recursive':!![]}),writeFileSync(_0x1ca2e8,_0x34bd50,_0x519253(0x11f)),console[_0x519253(0xc1)](a27_0x479863[_0x519253(0x18a)]('✔')+_0x519253(0xe1)+a27_0x479863[_0x519253(0xc8)](_0x1ca2e8));}return saveSessionContext({'parent_segment':_0xb95bfc},_0xb6c4cf[_0x519253(0x19f)]),console[_0x519253(0xc1)](a27_0x479863[_0x519253(0x18a)]('✔')+_0x519253(0x1c4)+a27_0x479863[_0x519253(0x187)](_0x519253(0x152))+_0x519253(0x11a)+a27_0x479863[_0x519253(0xc8)](_0xb95bfc)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a27_0x3dec44(0xdb)]=a27_0x3dec44(0x177);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x1a3);async['execute'](_0x1561a9){const _0x5d27c5=a27_0x3dec44,{options:_0x82ad8d,args:_0x2a56b9,tdx:_0x4f415e}=_0x1561a9,_0x5787a8=_0x82ad8d,_0x387817=_0x2a56b9[0x0]||_0x82ad8d[_0x5d27c5(0x103)];if(!_0x387817)return console[_0x5d27c5(0xc1)](a27_0x479863['red'](_0x5d27c5(0x1aa))),console[_0x5d27c5(0xc1)]('Usage:\x20tdx\x20ps\x20push\x20[name]\x20[-y]\x0a'),console[_0x5d27c5(0xc1)](a27_0x479863[_0x5d27c5(0xc8)](_0x5d27c5(0x1c7))),0x1;const _0x29cfe5=resolveYamlFile(_0x387817);if(!existsSync(_0x29cfe5))return showFileNotFoundError(_0x29cfe5,_0x387817),0x1;_0x5787a8['verbose']&&(console[_0x5d27c5(0xc1)](_0x5d27c5(0x1af)+_0x5787a8['site']),console[_0x5d27c5(0xc1)](_0x5d27c5(0xf7)+_0x29cfe5));let _0x5e8677;try{_0x5e8677=readFileSync(_0x29cfe5,_0x5d27c5(0x11f));}catch(_0xbda52c){const _0x6e8c58=_0xbda52c instanceof Error?_0xbda52c['message']:String(_0xbda52c);return console['error'](_0x5d27c5(0x14a)+_0x6e8c58),0x1;}const _0x4422d0=await withSpinner(_0x5d27c5(0x18e),()=>_0x4f415e[_0x5d27c5(0x1c5)][_0x5d27c5(0xca)](_0x5e8677),{'verbose':_0x5787a8[_0x5d27c5(0x1ce)]}),_0x15fad9=_0x4422d0[_0x5d27c5(0x12b)],{isNew:_0x51ce5c,name:_0x68d44,hasChanges:_0x300c54,diffFormatted:_0x549844}=_0x15fad9;if(!_0x300c54)return console[_0x5d27c5(0xc1)](_0x5d27c5(0x147)+_0x68d44+_0x5d27c5(0x108)),0x0;_0x51ce5c?console[_0x5d27c5(0xc1)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x68d44+'\x27:'):console[_0x5d27c5(0xc1)](_0x5d27c5(0xba)+_0x68d44+'\x27:');console[_0x5d27c5(0xc1)]('─'[_0x5d27c5(0x15c)](0x3c)),console[_0x5d27c5(0xc1)](_0x549844),console[_0x5d27c5(0xc1)]('─'[_0x5d27c5(0x15c)](0x3c));const _0x20c6c8=_0x51ce5c?_0x5d27c5(0x156)+_0x68d44+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x68d44+'\x27?';if(!_0x5787a8[_0x5d27c5(0x151)]){const _0x4545fa=await confirmKey(_0x20c6c8);if(!_0x4545fa)return console[_0x5d27c5(0xc1)](_0x5d27c5(0x1c0)),0x1;}const _0x4b884a=_0x51ce5c?_0x5d27c5(0x113):_0x5d27c5(0x128),_0x3c8675=await withSpinner(_0x4b884a+_0x5d27c5(0xf1)+_0x68d44+_0x5d27c5(0x157),()=>_0x15fad9[_0x5d27c5(0xf8)](),{'verbose':_0x5787a8[_0x5d27c5(0x1ce)]}),_0x28c2ce=_0x3c8675['data'],_0x46cd2e=getConsoleNextUrl(_0x5787a8[_0x5d27c5(0x1b1)],'/app/dw/parentSegments/'+_0x28c2ce['id']),_0x41026c=_0x51ce5c?_0x5d27c5(0x126):'Updated';return console[_0x5d27c5(0xc1)]('✔\x20'+_0x41026c+_0x5d27c5(0xf1)+_0x28c2ce[_0x5d27c5(0xdb)]+'\x27'),console['error']('\x20\x20'+_0x46cd2e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a27_0x3dec44(0xdb)]='segment:parent:validate';[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x1a8);async['execute'](_0x4d6d50){const _0x524265=a27_0x3dec44,{options:_0x23ccc0,args:_0x10ed48,tdx:_0x24819d}=_0x4d6d50,_0x1beb8f=_0x23ccc0,_0x330dde=_0x10ed48[0x0]||_0x23ccc0[_0x524265(0x103)];if(!_0x330dde)return console['error'](a27_0x479863[_0x524265(0xe9)](_0x524265(0x1aa))),console[_0x524265(0xc1)](_0x524265(0xc9)),console[_0x524265(0xc1)](_0x524265(0x144)),console[_0x524265(0xc1)](_0x524265(0x1c2)),console[_0x524265(0xc1)](_0x524265(0x181)),console[_0x524265(0xc1)]('\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),console[_0x524265(0xc1)](a27_0x479863[_0x524265(0xc8)](_0x524265(0x110))),0x1;const _0x599e30=resolveYamlFile(_0x330dde);if(!existsSync(_0x599e30))return showFileNotFoundError(_0x599e30,_0x330dde),0x1;_0x1beb8f['verbose']&&(console[_0x524265(0xc1)](_0x524265(0x1af)+_0x1beb8f[_0x524265(0x1b1)]),console[_0x524265(0xc1)]('YAML\x20file:\x20'+_0x599e30));let _0x55ab29;try{_0x55ab29=readFileSync(_0x599e30,_0x524265(0x11f));}catch(_0x2da308){const _0x1d2ff1=_0x2da308 instanceof Error?_0x2da308[_0x524265(0x10c)]:String(_0x2da308);return console['error']('Error\x20reading\x20file:\x20'+_0x1d2ff1),0x1;}const _0x335e5c=createCommandSpinner(a27_0x479863[_0x524265(0x187)]('Validating\x20configuration...'),{'verbose':_0x1beb8f[_0x524265(0x1ce)]});_0x335e5c[_0x524265(0xe5)]();const _0x1c3d80={'onProgress':_0x1629cb=>{_0x335e5c['text']=formatProgressMessage(_0x1629cb);}};if(_0x1beb8f[_0x524265(0x153)])_0x1c3d80[_0x524265(0x153)]=!![];if(_0x1beb8f[_0x524265(0x139)])_0x1c3d80['enriched']=!![];_0x1beb8f[_0x524265(0x1d2)]&&(_0x1c3d80[_0x524265(0x1d2)]=_0x1beb8f[_0x524265(0x1d2)]);_0x1beb8f[_0x524265(0x158)]&&(_0x1c3d80['behavior']=_0x1beb8f[_0x524265(0x158)]);if(_0x1beb8f[_0x524265(0xb8)])_0x1c3d80[_0x524265(0xb8)]=_0x1beb8f[_0x524265(0xb8)];let _0x5995ab;try{_0x5995ab=await _0x24819d[_0x524265(0x1c5)][_0x524265(0xc3)](_0x55ab29,_0x1c3d80),_0x335e5c[_0x524265(0x170)]();}catch(_0x3ed43e){_0x335e5c[_0x524265(0x170)]();throw _0x3ed43e;}const _0x1c3d13=_0x1beb8f[_0x524265(0xb8)]||_0x524265(0xb2);return this[_0x524265(0xbe)](_0x5995ab,_0x1c3d80,_0x599e30,_0x1c3d13),_0x5995ab[_0x524265(0xc2)]?0x0:0x1;}[a27_0x3dec44(0xbe)](_0x53f606,_0x29b6d6,_0x5c996c,_0xb0a291){const _0x1886a9=a27_0x3dec44;console[_0x1886a9(0xc1)]('\x0a'+a27_0x479863[_0x1886a9(0x119)]('Validate:')+'\x20'+_0x53f606[_0x1886a9(0xdb)]),console[_0x1886a9(0xc1)]('═'[_0x1886a9(0x15c)](0x3c)),this[_0x1886a9(0x165)](_0x53f606);if(typeof _0x29b6d6[_0x1886a9(0x1d2)]===_0x1886a9(0x135)){this[_0x1886a9(0x115)](_0x53f606),this[_0x1886a9(0xed)](_0x53f606),this[_0x1886a9(0x198)](_0x5c996c,_0xb0a291,_0x1886a9(0x1d2),_0x29b6d6[_0x1886a9(0x1d2)]);return;}if(_0x29b6d6['attribute']===!![]){this[_0x1886a9(0x115)](_0x53f606),this['displaySummary'](_0x53f606),this[_0x1886a9(0x198)](_0x5c996c,_0xb0a291,_0x1886a9(0xee));return;}if(typeof _0x29b6d6[_0x1886a9(0x158)]===_0x1886a9(0x135)){this['displayBehaviorsStats'](_0x53f606,_0xb0a291),this[_0x1886a9(0xed)](_0x53f606),this[_0x1886a9(0x198)](_0x5c996c,_0xb0a291,_0x1886a9(0x158),_0x29b6d6[_0x1886a9(0x158)]);return;}if(_0x29b6d6[_0x1886a9(0x158)]===!![]){this[_0x1886a9(0x192)](_0x53f606,_0xb0a291),this[_0x1886a9(0xed)](_0x53f606),this[_0x1886a9(0x198)](_0x5c996c,_0xb0a291,_0x1886a9(0x141));return;}this[_0x1886a9(0x115)](_0x53f606),this[_0x1886a9(0x192)](_0x53f606,_0xb0a291),this[_0x1886a9(0xed)](_0x53f606),this[_0x1886a9(0x198)](_0x5c996c,_0xb0a291,_0x1886a9(0xad));}[a27_0x3dec44(0x198)](_0xb64aaf,_0x350d06,_0x96c967,_0x1b4637){const _0x3b9285=a27_0x3dec44;console[_0x3b9285(0xc1)]('\x0a'+a27_0x479863['dim'](_0x3b9285(0x155)));const _0x43c762=_0x350d06!==_0x3b9285(0xb2)?_0x3b9285(0xde)+_0x350d06:'';if(_0x96c967===_0x3b9285(0x1d2)&&_0x1b4637)console[_0x3b9285(0xc1)]('\x20\x20'+a27_0x479863[_0x3b9285(0x187)](_0x3b9285(0x178)+_0xb64aaf+'\x20--attribute\x20\x22'+_0x1b4637+'\x22'+_0x43c762));else{if(_0x96c967===_0x3b9285(0x158)&&_0x1b4637)console[_0x3b9285(0xc1)]('\x20\x20'+a27_0x479863[_0x3b9285(0x187)](_0x3b9285(0x178)+_0xb64aaf+_0x3b9285(0x145)+_0x1b4637+'\x22'+_0x43c762));else(_0x96c967==='attributes'||_0x96c967===_0x3b9285(0xad))&&console[_0x3b9285(0xc1)]('\x20\x20'+a27_0x479863[_0x3b9285(0x187)](_0x3b9285(0x178)+_0xb64aaf+_0x3b9285(0x17f)+_0x43c762));}(_0x96c967==='behaviors'||_0x96c967===_0x3b9285(0xad))&&console['error']('\x20\x20'+a27_0x479863[_0x3b9285(0x187)](_0x3b9285(0x178)+_0xb64aaf+'\x20--behavior\x20\x22<name>\x22'+_0x43c762)),_0x96c967===_0x3b9285(0xad)&&console[_0x3b9285(0xc1)]('\x20\x20'+a27_0x479863[_0x3b9285(0x187)](_0x3b9285(0x178)+_0xb64aaf+_0x3b9285(0xf4)+_0x43c762));}['displayMasterInfo'](_0x159844){const _0x364b24=a27_0x3dec44,{master:_0x2717ec}=_0x159844,_0x3e0360=_0x2717ec['schemaValid']?a27_0x479863[_0x364b24(0x18a)]('✔'):a27_0x479863[_0x364b24(0xe9)]('✘');console[_0x364b24(0xc1)]('\x0a'+a27_0x479863[_0x364b24(0x187)](_0x364b24(0x12e))),console[_0x364b24(0xc1)](_0x3e0360+'\x20'+a27_0x479863[_0x364b24(0x119)](_0x2717ec[_0x364b24(0x17e)]+'.'+_0x2717ec[_0x364b24(0x136)])),_0x2717ec['schemaValid']?_0x2717ec['rowCount']!==undefined&&console[_0x364b24(0xc1)]('\x20\x20'+a27_0x479863[_0x364b24(0x187)](_0x364b24(0x161))+'\x20'+a27_0x479863['cyan'](formatRows(_0x2717ec['rowCount']))):console[_0x364b24(0xc1)]('\x20\x20'+a27_0x479863[_0x364b24(0xe9)](_0x364b24(0x1a4))+'\x20'+_0x2717ec['schemaError']);}[a27_0x3dec44(0x115)](_0x5c4be5){const _0x520743=a27_0x3dec44;if(_0x5c4be5[_0x520743(0xee)][_0x520743(0x12f)]===0x0)return;console[_0x520743(0xc1)]('\x0a'+a27_0x479863[_0x520743(0x187)](_0x520743(0xfa)));for(const _0x395b3d of _0x5c4be5[_0x520743(0xee)]){const _0x417dd3=_0x395b3d[_0x520743(0x14c)]?a27_0x479863[_0x520743(0x18a)]('✔'):a27_0x479863['red']('✘');let _0x2c5312='';if(_0x395b3d['schemaValid']&&_0x395b3d[_0x520743(0x127)]!==undefined&&_0x395b3d[_0x520743(0x114)]!==undefined){const _0x3e2cda=_0x395b3d[_0x520743(0x114)][_0x520743(0x120)](0x1),_0x5a577d=_0x395b3d[_0x520743(0x114)]>=0x50?a27_0x479863[_0x520743(0x18a)]:_0x395b3d[_0x520743(0x114)]>=0x32?a27_0x479863[_0x520743(0x193)]:a27_0x479863[_0x520743(0xe9)];_0x2c5312='\x20'+a27_0x479863['dim'](_0x520743(0x19e))+'\x20'+_0x5a577d(_0x3e2cda+'%')+'\x20('+formatRows(_0x395b3d[_0x520743(0x127)])+'\x20rows)';}console[_0x520743(0xc1)](_0x417dd3+'\x20'+a27_0x479863[_0x520743(0x119)](_0x395b3d[_0x520743(0xdb)])+_0x2c5312),console['error']('\x20\x20'+a27_0x479863[_0x520743(0x187)](_0x520743(0x1c8))+'\x20'+a27_0x479863['bold'](_0x395b3d[_0x520743(0x17e)]+'.'+_0x395b3d[_0x520743(0x136)]));const _0x33c318=_0x395b3d[_0x520743(0x164)]===_0x395b3d[_0x520743(0x1a7)]?a27_0x479863[_0x520743(0x187)](_0x520743(0xd4))+'\x20'+_0x395b3d[_0x520743(0x164)]:a27_0x479863['dim'](_0x520743(0x130))+'\x20'+_0x395b3d[_0x520743(0x164)]+_0x520743(0x11a)+_0x395b3d['foreignKey'];console[_0x520743(0xc1)]('\x20\x20'+_0x33c318),console[_0x520743(0xc1)]('\x20\x20'+a27_0x479863[_0x520743(0x187)]('Columns:')),this[_0x520743(0x195)](_0x395b3d[_0x520743(0x1b9)]),!_0x395b3d[_0x520743(0x14c)]&&console[_0x520743(0xc1)]('\x20\x20'+a27_0x479863[_0x520743(0xe9)](_0x520743(0x1a4))+'\x20'+_0x395b3d['schemaError']);}}['displayBehaviorsStats'](_0x3786aa,_0x5f2936){const _0x40f0b6=a27_0x3dec44;if(_0x3786aa[_0x40f0b6(0x141)][_0x40f0b6(0x12f)]===0x0)return;console['error']('\x0a'+a27_0x479863['dim'](_0x40f0b6(0xb0))+'\x20'+a27_0x479863['dim']('('+_0x5f2936+')'));for(const _0xf85a23 of _0x3786aa['behaviors']){const _0x395b7d=_0xf85a23[_0x40f0b6(0x14c)]?a27_0x479863['green']('✔'):a27_0x479863[_0x40f0b6(0xe9)]('✘');let _0x4178aa='';if(_0xf85a23[_0x40f0b6(0x14c)]&&_0xf85a23[_0x40f0b6(0x134)]!==undefined&&_0xf85a23['totalEvents']!==undefined){const _0x56e26a=_0xf85a23[_0x40f0b6(0x1ae)]?.[_0x40f0b6(0x120)](0x1)||'?',_0x5882e8=(_0xf85a23[_0x40f0b6(0x1ae)]??0x0)>=0x32?a27_0x479863[_0x40f0b6(0x18a)]:(_0xf85a23['customerPercent']??0x0)>=0x14?a27_0x479863['yellow']:a27_0x479863[_0x40f0b6(0xe9)];_0x4178aa='\x20'+a27_0x479863[_0x40f0b6(0x187)](_0x40f0b6(0x13b))+'\x20'+_0x5882e8(formatRows(_0xf85a23['customersWithEvents']))+'\x20('+_0x56e26a+_0x40f0b6(0x117)+a27_0x479863[_0x40f0b6(0x187)](_0x40f0b6(0x16d))+'\x20'+a27_0x479863[_0x40f0b6(0xc8)](formatRows(_0xf85a23[_0x40f0b6(0x189)]));}console[_0x40f0b6(0xc1)](_0x395b7d+'\x20'+a27_0x479863[_0x40f0b6(0x119)](_0xf85a23['name'])+_0x4178aa),console[_0x40f0b6(0xc1)]('\x20\x20'+a27_0x479863['dim'](_0x40f0b6(0x1c8))+'\x20'+a27_0x479863['bold'](_0xf85a23[_0x40f0b6(0x17e)]+'.'+_0xf85a23[_0x40f0b6(0x136)]));const _0x4c87cf=_0xf85a23[_0x40f0b6(0x164)]===_0xf85a23[_0x40f0b6(0x1a7)]?a27_0x479863['dim'](_0x40f0b6(0xd4))+'\x20'+_0xf85a23[_0x40f0b6(0x164)]:a27_0x479863['dim'](_0x40f0b6(0x130))+'\x20'+_0xf85a23[_0x40f0b6(0x164)]+_0x40f0b6(0x11a)+_0xf85a23['foreignKey'];console['error']('\x20\x20'+_0x4c87cf),console[_0x40f0b6(0xc1)]('\x20\x20'+a27_0x479863[_0x40f0b6(0x187)](_0x40f0b6(0x1b2))),this['displayColumns'](_0xf85a23[_0x40f0b6(0x1b9)]),!_0xf85a23[_0x40f0b6(0x14c)]&&console[_0x40f0b6(0xc1)]('\x20\x20'+a27_0x479863[_0x40f0b6(0xe9)](_0x40f0b6(0x1a4))+'\x20'+_0xf85a23['schemaError']);}}[a27_0x3dec44(0x195)](_0x152d7c){const _0x1aad68=a27_0x3dec44;for(const _0x3ee193 of _0x152d7c){_0x3ee193[_0x1aad68(0xd7)]===_0x3ee193[_0x1aad68(0xfd)]||_0x3ee193[_0x1aad68(0xfd)]==='*'?console[_0x1aad68(0xc1)](_0x1aad68(0x138)+_0x3ee193[_0x1aad68(0xd7)]):console['error'](_0x1aad68(0x138)+_0x3ee193[_0x1aad68(0xd7)]+'\x20'+a27_0x479863[_0x1aad68(0x187)]('('+_0x3ee193[_0x1aad68(0xfd)]+')'));}}[a27_0x3dec44(0xed)](_0x497b65){const _0x5827dd=a27_0x3dec44;console['error']('─'[_0x5827dd(0x15c)](0x3c));if(_0x497b65[_0x5827dd(0xe3)][_0x5827dd(0x12f)]>0x0){console['error']('\x0a'+a27_0x479863[_0x5827dd(0xe9)](_0x5827dd(0xac)));for(const _0x2974e0 of _0x497b65[_0x5827dd(0xe3)]){console[_0x5827dd(0xc1)]('\x20\x20'+a27_0x479863[_0x5827dd(0xe9)]('•')+'\x20'+_0x2974e0);}}_0x497b65[_0x5827dd(0xc2)]&&console['error']('\x0a'+a27_0x479863[_0x5827dd(0x18a)]('✔')+_0x5827dd(0xc4));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a27_0x3dec44(0xdb)]='segment:parent:preview';[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x13a);async['execute'](_0x2d154c){const _0x145871=a27_0x3dec44,{options:_0x83ba24,args:_0x5d2b11,tdx:_0x138ab7}=_0x2d154c,_0x149133=_0x83ba24,_0x4f9d60=_0x5d2b11[0x0]||_0x83ba24[_0x145871(0x103)];if(!_0x4f9d60)return console[_0x145871(0xc1)](a27_0x479863[_0x145871(0xe9)](_0x145871(0x1aa))),console[_0x145871(0xc1)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x145871(0xc1)](_0x145871(0xd9)),console[_0x145871(0xc1)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x145871(0xc1)](_0x145871(0x1cd)),console['error'](_0x145871(0x172)),console[_0x145871(0xc1)](_0x145871(0x15e)),console[_0x145871(0xc1)]('\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),console[_0x145871(0xc1)](a27_0x479863['cyan'](_0x145871(0x110))),0x1;if(!_0x149133[_0x145871(0x153)]&&!_0x149133[_0x145871(0x1d2)]&&!_0x149133[_0x145871(0x158)]&&!_0x149133[_0x145871(0x139)])return console[_0x145871(0xc1)](a27_0x479863[_0x145871(0xe9)](_0x145871(0xcd))),console[_0x145871(0xc1)](_0x145871(0x190)),console[_0x145871(0xc1)](_0x145871(0x144)),console[_0x145871(0xc1)](_0x145871(0x1a1)),console['error'](_0x145871(0x1cd)),console[_0x145871(0xc1)](_0x145871(0x172)),console[_0x145871(0xc1)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x4dc9c4=resolveYamlFile(_0x4f9d60);if(!existsSync(_0x4dc9c4))return showFileNotFoundError(_0x4dc9c4,_0x4f9d60),0x1;_0x149133['verbose']&&(console[_0x145871(0xc1)](_0x145871(0x1af)+_0x149133[_0x145871(0x1b1)]),console[_0x145871(0xc1)](_0x145871(0xf7)+_0x4dc9c4));let _0x1de1a9;try{_0x1de1a9=readFileSync(_0x4dc9c4,_0x145871(0x11f));}catch(_0x4079c2){const _0x3be910=_0x4079c2 instanceof Error?_0x4079c2[_0x145871(0x10c)]:String(_0x4079c2);return console[_0x145871(0xc1)](_0x145871(0x14a)+_0x3be910),0x1;}let _0x463c9d;try{_0x463c9d=parseYamlString(_0x1de1a9);}catch(_0x511729){const _0x1b1a95=_0x511729 instanceof Error?_0x511729[_0x145871(0x10c)]:String(_0x511729);return console[_0x145871(0xc1)](a27_0x479863[_0x145871(0xe9)](_0x145871(0x1d3)+_0x1b1a95)),0x1;}if(_0x149133[_0x145871(0x1d2)]===!![]||_0x149133[_0x145871(0x1d2)]===''){const _0x52a49a=_0x463c9d[_0x145871(0xee)]?.[_0x145871(0x124)](_0x1a6831=>_0x1a6831[_0x145871(0xdb)])||[];if(_0x52a49a[_0x145871(0x12f)]===0x0)console[_0x145871(0xc1)](a27_0x479863[_0x145871(0xe9)](_0x145871(0xd8)));else{console[_0x145871(0xc1)](a27_0x479863[_0x145871(0xe9)](_0x145871(0x19c))),console[_0x145871(0xc1)](_0x145871(0x1b5));for(const _0x1d305a of _0x52a49a){console['error']('\x20\x20'+a27_0x479863[_0x145871(0xc8)](_0x1d305a));}console[_0x145871(0xc1)](_0x145871(0x160)+_0x4f9d60+_0x145871(0xeb)+_0x52a49a[0x0]+'\x22');}return 0x1;}if(_0x149133[_0x145871(0x158)]===!![]||_0x149133[_0x145871(0x158)]===''){const _0x41df0b=_0x463c9d[_0x145871(0x141)]?.['map'](_0x5f193b=>_0x5f193b[_0x145871(0xdb)])||[];if(_0x41df0b[_0x145871(0x12f)]===0x0)console[_0x145871(0xc1)](a27_0x479863[_0x145871(0xe9)](_0x145871(0xd0)));else{console[_0x145871(0xc1)](a27_0x479863[_0x145871(0xe9)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x145871(0xc1)](_0x145871(0x185));for(const _0x3541e5 of _0x41df0b){console[_0x145871(0xc1)]('\x20\x20'+a27_0x479863[_0x145871(0xc8)](_0x3541e5));}console[_0x145871(0xc1)](_0x145871(0x160)+_0x4f9d60+_0x145871(0x145)+_0x41df0b[0x0]+'\x22');}return 0x1;}const _0x1ea4f1=createCommandSpinner(a27_0x479863[_0x145871(0x187)]('Fetching\x20sample\x20data...'),{'verbose':_0x149133[_0x145871(0x1ce)]});_0x1ea4f1[_0x145871(0xe5)]();const _0x4a3a59={'onProgress':_0x226120=>{const _0x5742bd=_0x145871;_0x1ea4f1[_0x5742bd(0x196)]=formatProgressMessage(_0x226120);}};if(_0x149133['master'])_0x4a3a59['master']=!![];if(_0x149133[_0x145871(0x1d2)]&&typeof _0x149133['attribute']===_0x145871(0x135))_0x4a3a59['attribute']=_0x149133[_0x145871(0x1d2)];if(_0x149133[_0x145871(0x158)]&&typeof _0x149133[_0x145871(0x158)]===_0x145871(0x135))_0x4a3a59['behavior']=_0x149133[_0x145871(0x158)];if(_0x149133[_0x145871(0x139)])_0x4a3a59[_0x145871(0x139)]=!![];if(_0x149133[_0x145871(0xb8)])_0x4a3a59[_0x145871(0xb8)]=_0x149133[_0x145871(0xb8)];let _0x1c0bd1;try{_0x1c0bd1=await _0x138ab7[_0x145871(0x1c5)]['previewParentYaml'](_0x1de1a9,_0x4a3a59),_0x1ea4f1[_0x145871(0x170)]();}catch(_0x49a004){_0x1ea4f1[_0x145871(0x170)]();throw _0x49a004;}return await this[_0x145871(0x1b8)](_0x1c0bd1,{'master':_0x149133[_0x145871(0x153)],'attribute':typeof _0x149133[_0x145871(0x1d2)]===_0x145871(0x135)?_0x149133[_0x145871(0x1d2)]:undefined,'behavior':typeof _0x149133['behavior']===_0x145871(0x135)?_0x149133[_0x145871(0x158)]:undefined,'enriched':_0x149133['enriched']}),_0x1c0bd1['allValid']?0x0:0x1;}async[a27_0x3dec44(0x1b8)](_0x12e2b7,_0xd98d69){const _0x319f35=a27_0x3dec44;console[_0x319f35(0xc1)]('\x0a'+a27_0x479863['bold'](_0x319f35(0x17c))+'\x20'+_0x12e2b7[_0x319f35(0xdb)]),console[_0x319f35(0xc1)]('═'[_0x319f35(0x15c)](0x3c));if(_0xd98d69['master']&&_0x12e2b7[_0x319f35(0x11d)]){const _0x45a30a=a27_0x479863[_0x319f35(0x187)](_0x319f35(0x18d))+'\x20'+a27_0x479863[_0x319f35(0x119)](_0x12e2b7[_0x319f35(0x153)][_0x319f35(0x17e)]+'.'+_0x12e2b7[_0x319f35(0x153)][_0x319f35(0x136)]);await this[_0x319f35(0x169)](_0x45a30a,_0x12e2b7[_0x319f35(0x11d)]);}else{if(_0xd98d69[_0x319f35(0x1d2)]&&_0x12e2b7[_0x319f35(0x11d)]){const _0x574f78=a27_0x479863[_0x319f35(0x187)](_0x319f35(0x1ac))+'\x20'+a27_0x479863['bold'](_0xd98d69[_0x319f35(0x1d2)]);await this[_0x319f35(0x169)](_0x574f78,_0x12e2b7[_0x319f35(0x11d)]);}else{if(_0xd98d69[_0x319f35(0x158)]&&_0x12e2b7[_0x319f35(0x11d)]){const _0x2bbb1c=a27_0x479863[_0x319f35(0x187)](_0x319f35(0xbd))+'\x20'+a27_0x479863['bold'](_0xd98d69[_0x319f35(0x158)]);await this[_0x319f35(0x169)](_0x2bbb1c,_0x12e2b7[_0x319f35(0x11d)]);}else{if(_0xd98d69[_0x319f35(0x139)]&&_0x12e2b7[_0x319f35(0x11d)]){const _0x2f5a1e=a27_0x479863['dim'](_0x319f35(0x1c9))+'\x20'+a27_0x479863[_0x319f35(0x119)](_0x319f35(0xcf));await this[_0x319f35(0x169)](_0x2f5a1e,_0x12e2b7[_0x319f35(0x11d)]);}else!_0x12e2b7[_0x319f35(0x11d)]&&console[_0x319f35(0xc1)](_0x319f35(0xe2));}}}if(_0x12e2b7[_0x319f35(0xe3)]['length']>0x0){console[_0x319f35(0xc1)]('─'['repeat'](0x3c)),console['error']('\x0a'+a27_0x479863['red'](_0x319f35(0xac)));for(const _0x5e8dc8 of _0x12e2b7[_0x319f35(0xe3)]){console['error']('\x20\x20'+a27_0x479863['red']('•')+'\x20'+_0x5e8dc8);}}}async[a27_0x3dec44(0x169)](_0xf15cdf,_0x3c6c50){const _0x414664=a27_0x3dec44;if(_0x3c6c50[_0x414664(0x12f)]===0x0){console['error']('\x0a'+_0xf15cdf),console[_0x414664(0xc1)](_0x414664(0x10f));return;}console[_0x414664(0xc1)]('\x0a'+_0xf15cdf);const _0x11c5c3=Object[_0x414664(0x1d1)](_0x3c6c50[0x0])['map'](_0x156e44=>({'name':_0x156e44,'type':typeof _0x3c6c50[0x0][_0x156e44]===_0x414664(0x1c1)?_0x414664(0xb3):'varchar'})),_0x2d0a0c={'queryId':_0x414664(0x10b),'columns':_0x11c5c3,'data':_0x3c6c50,'stats':{'state':_0x414664(0xc5),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3c6c50[_0x414664(0x12f)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x3419d4=formatAsTable(_0x2d0a0c,_0x3c6c50['length'],!![]);await writeOutput(_0x3419d4,undefined,_0x414664(0x136));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a27_0x3dec44(0x116);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x131);async[a27_0x3dec44(0x15f)](_0x3dabd2){const _0x1694d4=a27_0x3dec44,{options:_0x278ab2,args:_0x2b0373,tdx:_0x2562d3}=_0x3dabd2,_0x5de209=_0x278ab2,_0x1f81dd=_0x2b0373[0x0]||_0x278ab2['parentSegment'];if(!_0x1f81dd)return console[_0x1694d4(0xc1)](a27_0x479863['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x1694d4(0xc1)]('Usage:\x20tdx\x20parent-segment\x20run\x20<name>\x20[-y]\x0a'),console['error'](a27_0x479863[_0x1694d4(0xc8)](_0x1694d4(0xe0))),0x1;const _0x192da0=resolveYamlFile(_0x1f81dd);if(existsSync(_0x192da0)){_0x5de209[_0x1694d4(0x1ce)]&&console[_0x1694d4(0xc1)](_0x1694d4(0x16a)+_0x192da0);let _0x55badb;try{_0x55badb=readFileSync(_0x192da0,_0x1694d4(0x11f));}catch(_0x292d1e){const _0x106e44=_0x292d1e instanceof Error?_0x292d1e[_0x1694d4(0x10c)]:String(_0x292d1e);return console[_0x1694d4(0xc1)](_0x1694d4(0x14a)+_0x106e44),0x1;}const _0x4863b1=await withSpinner(_0x1694d4(0x18e),()=>_0x2562d3[_0x1694d4(0x1c5)]['pushParentYaml'](_0x55badb),{'verbose':_0x5de209[_0x1694d4(0x1ce)]}),_0x897d4a=_0x4863b1[_0x1694d4(0x12b)],{isNew:_0x2e1b36,name:_0x297ba2,hasChanges:_0x4fee71,diffFormatted:_0x34ba7d}=_0x897d4a;if(_0x4fee71){_0x2e1b36?console[_0x1694d4(0xc1)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x297ba2+'\x27:'):console['error'](_0x1694d4(0xba)+_0x297ba2+'\x27:');console[_0x1694d4(0xc1)]('─'[_0x1694d4(0x15c)](0x3c)),console['error'](_0x34ba7d),console[_0x1694d4(0xc1)]('─'['repeat'](0x3c));const _0x2123cb=_0x2e1b36?'Create\x20parent\x20segment\x20\x27'+_0x297ba2+_0x1694d4(0x168):'Apply\x20changes\x20to\x20\x27'+_0x297ba2+_0x1694d4(0x168);if(!_0x5de209[_0x1694d4(0x151)]){const _0x2d6d21=await confirmKey(_0x2123cb);if(!_0x2d6d21)return console[_0x1694d4(0xc1)](_0x1694d4(0x1c0)),0x1;}const _0x275444=_0x2e1b36?'Creating':'Updating';await withSpinner(_0x275444+_0x1694d4(0xf1)+_0x297ba2+_0x1694d4(0x157),()=>_0x897d4a['apply'](),{'verbose':_0x5de209[_0x1694d4(0x1ce)]});const _0x46ab33=_0x2e1b36?_0x1694d4(0x126):_0x1694d4(0xb7);console[_0x1694d4(0xc1)]('✔\x20'+_0x46ab33+_0x1694d4(0xf1)+_0x297ba2+'\x27');}else console[_0x1694d4(0xc1)](_0x1694d4(0x147)+_0x297ba2+_0x1694d4(0x167));}const _0x5b2f9f=await withSpinner(_0x1694d4(0xf5)+_0x1f81dd+_0x1694d4(0x157),()=>_0x2562d3['segment'][_0x1694d4(0x125)](_0x1f81dd),{'verbose':_0x5de209[_0x1694d4(0x1ce)]}),_0x45e71d=_0x5b2f9f[_0x1694d4(0x12b)],_0x7d847e=getConsoleUrl(_0x5de209['site'],_0x1694d4(0x14e)+_0x45e71d[_0x1694d4(0x1b7)]+'/sessions/'+_0x45e71d[_0x1694d4(0xbf)]+_0x1694d4(0x16e)+_0x45e71d[_0x1694d4(0x13c)]);return console['error']('\x0a✔\x20Workflow\x20started'),console[_0x1694d4(0xc1)]('\x20\x20'+a27_0x479863['dim']('Audience\x20ID:')+'\x20'+_0x45e71d['audienceId']),console[_0x1694d4(0xc1)]('\x20\x20'+a27_0x479863['dim']('Status:')+'\x20'+_0x45e71d[_0x1694d4(0x1be)]),console[_0x1694d4(0xc1)]('\x20\x20'+a27_0x479863['dim']('Session:')+'\x20'+_0x45e71d[_0x1694d4(0xbf)]),console[_0x1694d4(0xc1)]('\x20\x20'+a27_0x479863[_0x1694d4(0x187)](_0x1694d4(0x15b))+'\x20'+_0x45e71d[_0x1694d4(0x13c)]),console[_0x1694d4(0xc1)]('\x20\x20'+_0x7d847e),console[_0x1694d4(0xc1)]('\x0a'+a27_0x479863[_0x1694d4(0x187)](_0x1694d4(0xb6))+_0x1694d4(0xbc)+_0x45e71d[_0x1694d4(0x13c)]+_0x1694d4(0xfe)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a27_0x3dec44(0xdb)]=a27_0x3dec44(0x166);['description']=a27_0x3dec44(0x1a2);async[a27_0x3dec44(0x15f)](_0x5064bf){const _0xb179fc=a27_0x3dec44,{options:_0x54a686,args:_0x565ced,tdx:_0x5f49da}=_0x5064bf,_0x3332db=_0x565ced[0x0]||_0x54a686[_0xb179fc(0x103)];if(!_0x3332db)return console['error'](a27_0x479863[_0xb179fc(0xe9)](_0xb179fc(0x1aa))),console[_0xb179fc(0xc1)](_0xb179fc(0xd3)),console['error'](a27_0x479863[_0xb179fc(0xc8)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0x54a686[_0xb179fc(0x1ce)]&&(console[_0xb179fc(0xc1)](_0xb179fc(0x1af)+_0x54a686[_0xb179fc(0x1b1)]),console[_0xb179fc(0xc1)](_0xb179fc(0x123)+_0x3332db));const _0x57f3f8=await withSpinner(_0xb179fc(0x1a9)+_0x3332db+_0xb179fc(0x157),()=>_0x5f49da[_0xb179fc(0x1c5)][_0xb179fc(0x18b)](_0x3332db),{'verbose':_0x54a686[_0xb179fc(0x1ce)]}),_0x37f653=_0x57f3f8[_0xb179fc(0x12b)];console[_0xb179fc(0xc1)](_0xb179fc(0x101)+_0x37f653[_0xb179fc(0x12f)]+_0xb179fc(0x162)+(_0x37f653[_0xb179fc(0x12f)]!==0x1?'s':''));if(_0x54a686[_0xb179fc(0x12d)]||_0x54a686['jsonl'])return await handleSDKOutput(_0x37f653,_0x54a686),0x0;return displayFieldsHumanReadable(_0x37f653,_0x3332db),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a27_0x3dec44(0xdb)]=a27_0x3dec44(0x17d);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x118);async[a27_0x3dec44(0x15f)](_0x4cafa5){const _0x2972b6=a27_0x3dec44,{options:_0x4027d5,args:_0x18163d,tdx:_0x4b0c3b}=_0x4cafa5,_0x4e818a=_0x4027d5,_0x13843d=_0x18163d[0x0]||_0x4027d5[_0x2972b6(0x103)];if(!_0x13843d)return console['error'](a27_0x479863[_0x2972b6(0xe9)](_0x2972b6(0x1aa))),console[_0x2972b6(0xc1)]('Usage:\x20tdx\x20ps\x20view\x20[name]\x20[-w]\x0a'),console[_0x2972b6(0xc1)](_0x2972b6(0x144)),console[_0x2972b6(0xc1)](_0x2972b6(0x18c)),console[_0x2972b6(0xc1)](a27_0x479863[_0x2972b6(0xc8)]('\x0aTip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0x4027d5[_0x2972b6(0x1ce)]&&(console[_0x2972b6(0xc1)](_0x2972b6(0x1af)+_0x4027d5[_0x2972b6(0x1b1)]),console[_0x2972b6(0xc1)](_0x2972b6(0x123)+_0x13843d));const _0x1fa09e=await withSpinner(_0x2972b6(0xf9)+_0x13843d+_0x2972b6(0x157),()=>_0x4b0c3b[_0x2972b6(0x1c5)][_0x2972b6(0x176)](_0x13843d),{'verbose':_0x4027d5['verbose']}),_0x2fea98=_0x1fa09e[_0x2972b6(0x12b)];if(_0x4e818a['web']){const _0x6be715=getConsoleNextUrl(_0x4e818a[_0x2972b6(0x1b1)],_0x2972b6(0x10a)+_0x2fea98['id']);return console[_0x2972b6(0xc1)](a27_0x479863[_0x2972b6(0x18a)]('✔')+_0x2972b6(0xec)+a27_0x479863[_0x2972b6(0xc8)](_0x6be715)),openBrowser(_0x6be715),0x0;}return await handleSingleObjectOutput(_0x2fea98,_0x4027d5),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a27_0x3dec44(0xdb)]=a27_0x3dec44(0xe6);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0xe7);async[a27_0x3dec44(0x15f)](_0x33e581){const _0x18c6b1=a27_0x3dec44,{options:_0x4f8e88,args:_0x53969a,tdx:_0x5f5b12}=_0x33e581,_0x1de4f8=_0x53969a[0x0]||_0x4f8e88['parentSegment'];if(!_0x1de4f8)return console['error'](a27_0x479863[_0x18c6b1(0xe9)](_0x18c6b1(0x1aa))),console[_0x18c6b1(0xc1)]('Usage:\x20tdx\x20ps\x20desc\x20[name]\x0a'),console[_0x18c6b1(0xc1)](a27_0x479863[_0x18c6b1(0xc8)](_0x18c6b1(0xe0))),0x1;_0x4f8e88[_0x18c6b1(0x1ce)]&&(console[_0x18c6b1(0xc1)]('Site:\x20'+_0x4f8e88[_0x18c6b1(0x1b1)]),console[_0x18c6b1(0xc1)](_0x18c6b1(0x123)+_0x1de4f8));const _0x49e0fb=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x1de4f8+_0x18c6b1(0x157),()=>_0x5f5b12[_0x18c6b1(0x1c5)][_0x18c6b1(0x180)](_0x1de4f8),{'verbose':_0x4f8e88[_0x18c6b1(0x1ce)]}),_0x58ea61=_0x49e0fb[_0x18c6b1(0x12b)],_0x24cfca=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x1de4f8+_0x18c6b1(0x157),()=>_0x5f5b12[_0x18c6b1(0x1c5)]['getParentSQL'](_0x58ea61),{'verbose':_0x4f8e88['verbose']}),_0xc42667=await executeSchemaQuery(_0x24cfca[_0x18c6b1(0x12b)],_0x5f5b12,_0x4f8e88);return await handleQueryOutput(_0xc42667,_0x4f8e88),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a27_0x3dec44(0xdb)]=a27_0x3dec44(0x100);[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x14b);async[a27_0x3dec44(0x15f)](_0x4b572e){const _0x3a0756=a27_0x3dec44,{options:_0x395c04,args:_0x572b3a,tdx:_0x12fd48}=_0x4b572e,_0x2bb3ae=_0x572b3a[0x0]||_0x395c04[_0x3a0756(0x103)];if(!_0x2bb3ae)return console[_0x3a0756(0xc1)](a27_0x479863['red'](_0x3a0756(0x1aa))),console[_0x3a0756(0xc1)](_0x3a0756(0x1bc)),console['error'](a27_0x479863[_0x3a0756(0xc8)](_0x3a0756(0xe0))),0x1;_0x395c04[_0x3a0756(0x1ce)]&&(console[_0x3a0756(0xc1)](_0x3a0756(0x1af)+_0x395c04[_0x3a0756(0x1b1)]),console['error']('Parent\x20segment:\x20'+_0x2bb3ae));const _0x29e0f9=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2bb3ae+'\x27...',()=>_0x12fd48[_0x3a0756(0x1c5)][_0x3a0756(0x180)](_0x2bb3ae),{'verbose':_0x395c04[_0x3a0756(0x1ce)]}),_0x168daa=_0x29e0f9[_0x3a0756(0x12b)],_0x522d80=await withSpinner(_0x3a0756(0xaf)+_0x2bb3ae+_0x3a0756(0x157),()=>_0x12fd48['segment'][_0x3a0756(0xe4)](_0x168daa),{'verbose':_0x395c04[_0x3a0756(0x1ce)]}),_0x271025=_0x522d80[_0x3a0756(0x12b)];return _0x395c04[_0x3a0756(0x13f)]===_0x3a0756(0x12d)||_0x395c04['format']===_0x3a0756(0x11b)?await handleSDKOutput([{'sql':_0x271025}],_0x395c04):console[_0x3a0756(0xef)](_0x271025),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a27_0x3dec44(0xdb)]='segment:parent:show';[a27_0x3dec44(0x17a)]=a27_0x3dec44(0x163);async[a27_0x3dec44(0x15f)](_0x5dc5c8){const _0x5bf8eb=a27_0x3dec44,{options:_0xf46418,args:_0x26688e,tdx:_0x2c1f58}=_0x5dc5c8,_0xf202a=_0x26688e[0x0]||_0xf46418[_0x5bf8eb(0x103)];if(!_0xf202a)return console[_0x5bf8eb(0xc1)](a27_0x479863[_0x5bf8eb(0xe9)]('Error:\x20Parent\x20segment\x20name\x20is\x20required\x0a')),console[_0x5bf8eb(0xc1)](_0x5bf8eb(0xb1)),console[_0x5bf8eb(0xc1)](a27_0x479863[_0x5bf8eb(0xc8)]('Tip:\x20Set\x20context\x20with\x20`tdx\x20ps\x20use\x20<name>`\x20or\x20list\x20with\x20`tdx\x20ps\x20list`')),0x1;_0xf46418[_0x5bf8eb(0x1ce)]&&(console[_0x5bf8eb(0xc1)](_0x5bf8eb(0x1af)+_0xf46418[_0x5bf8eb(0x1b1)]),console[_0x5bf8eb(0xc1)]('Parent\x20segment:\x20'+_0xf202a));const _0x6cb025=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xf202a+'\x27...',()=>_0x2c1f58[_0x5bf8eb(0x1c5)]['resolveParentId'](_0xf202a),{'verbose':_0xf46418['verbose']}),_0x3933e5=_0x6cb025[_0x5bf8eb(0x12b)],_0x2d615=await withSpinner(_0x5bf8eb(0xaf)+_0xf202a+'\x27...',()=>_0x2c1f58['segment'][_0x5bf8eb(0xe4)](_0x3933e5),{'verbose':_0xf46418['verbose']});let _0x1be909=_0x2d615[_0x5bf8eb(0x12b)];const _0x51f89c=resolveLimit(_0xf46418['limit'],DEFAULT_DISPLAY_LIMIT),_0x28ec19=/\bLIMIT\s+\d+/i[_0x5bf8eb(0x107)](_0x1be909);!_0x28ec19&&(_0x1be909=_0x1be909[_0x5bf8eb(0xc7)]()[_0x5bf8eb(0x184)](/;+$/,''),_0x1be909=_0x5bf8eb(0x1a5)+_0x1be909+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x51f89c);_0xf46418[_0x5bf8eb(0x1ce)]&&console[_0x5bf8eb(0xc1)](_0x5bf8eb(0x13d)+_0x1be909);const _0xc17376=await withQuerySpinner(_0x5bf8eb(0x182),async _0x4cdcf9=>{const _0x1dc0f9=_0x5bf8eb,_0x450092=await _0x2c1f58['query'][_0x1dc0f9(0x15f)](_0x1be909,{'catalog':'td','schema':'information_schema','onJobId':_0x12d8c4=>{const _0x3c2a2d=_0x1dc0f9;_0x4cdcf9[_0x3c2a2d(0xd6)](_0x12d8c4);}});return _0x450092;},{'verbose':_0xf46418[_0x5bf8eb(0x1ce)]}),_0x52a151=_0xc17376[_0x5bf8eb(0x12b)],_0x14cd89=_0x52a151[_0x5bf8eb(0x171)]?_0x5bf8eb(0x191)+_0x52a151[_0x5bf8eb(0x171)]+']':'';return console[_0x5bf8eb(0xc1)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x52a151['stats']['processedRows'][_0x5bf8eb(0x121)]()+_0x5bf8eb(0xea)+(_0x5bf8eb(0x179)+formatElapsed(_0x52a151[_0x5bf8eb(0x15a)][_0x5bf8eb(0x197)])+_0x14cd89)),await handleQueryOutput(_0x52a151,_0xf46418),0x0;}}