@treasuredata/tdx 0.9.0 → 0.9.2

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 (122) 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.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/agent-command.js +1 -1
  15. package/dist/commands/api-command.js +1 -1
  16. package/dist/commands/auth-command.js +1 -1
  17. package/dist/commands/chat-command.js +1 -1
  18. package/dist/commands/claude-command.js +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/connection-command.js +1 -1
  23. package/dist/commands/context-command.js +1 -1
  24. package/dist/commands/databases.js +1 -1
  25. package/dist/commands/describe.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/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.js +1 -1
  34. package/dist/commands/segment-command.js +1 -1
  35. package/dist/commands/segment-create-command.js +1 -1
  36. package/dist/commands/segment-fields-command.js +1 -1
  37. package/dist/commands/segment-pull-command.js +1 -1
  38. package/dist/commands/segment-push-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/tables.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/config.js +1 -1
  49. package/dist/core/connection-cache.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/proxy/anthropic-adapter.js +1 -1
  59. package/dist/proxy/claude-usage-tracker.js +1 -1
  60. package/dist/proxy/context-signature.js +1 -1
  61. package/dist/proxy/conversation-utils.js +1 -1
  62. package/dist/proxy/server.js +1 -1
  63. package/dist/proxy/session-cache.js +1 -1
  64. package/dist/sdk/agent/agent-yaml.d.ts +1 -1
  65. package/dist/sdk/agent/agent-yaml.d.ts.map +1 -1
  66. package/dist/sdk/agent/agent-yaml.js +1 -1
  67. package/dist/sdk/agent/agent-yaml.js.map +1 -1
  68. package/dist/sdk/api.js +1 -1
  69. package/dist/sdk/connection.js +1 -1
  70. package/dist/sdk/engage.js +1 -1
  71. package/dist/sdk/errors.js +1 -1
  72. package/dist/sdk/index.js +1 -1
  73. package/dist/sdk/job.js +1 -1
  74. package/dist/sdk/journey.js +1 -1
  75. package/dist/sdk/llm.d.ts +27 -20
  76. package/dist/sdk/llm.d.ts.map +1 -1
  77. package/dist/sdk/llm.js +1 -1
  78. package/dist/sdk/llm.js.map +1 -1
  79. package/dist/sdk/query.js +1 -1
  80. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  81. package/dist/sdk/segment/journey-yaml.js +1 -1
  82. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  83. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  84. package/dist/sdk/segment.js +1 -1
  85. package/dist/sdk/user.js +1 -1
  86. package/dist/sdk/workflow.js +1 -1
  87. package/dist/types/endpoints.js +1 -1
  88. package/dist/types/index.js +1 -1
  89. package/dist/utils/agent-config.js +1 -1
  90. package/dist/utils/agent-ref-parser.js +1 -1
  91. package/dist/utils/async.js +1 -1
  92. package/dist/utils/chat-cache.js +1 -1
  93. package/dist/utils/colors.js +1 -1
  94. package/dist/utils/command-output.js +1 -1
  95. package/dist/utils/constants.js +1 -1
  96. package/dist/utils/diff.js +1 -1
  97. package/dist/utils/fields-display.js +1 -1
  98. package/dist/utils/file-permissions.js +1 -1
  99. package/dist/utils/format-detector.js +1 -1
  100. package/dist/utils/formatters.js +1 -1
  101. package/dist/utils/journey-utils.js +1 -1
  102. package/dist/utils/json-loader.js +1 -1
  103. package/dist/utils/llm-backup-utils.js +1 -1
  104. package/dist/utils/model-aliases.js +1 -1
  105. package/dist/utils/model-factors.js +1 -1
  106. package/dist/utils/option-validation.js +1 -1
  107. package/dist/utils/port.js +1 -1
  108. package/dist/utils/process.js +1 -1
  109. package/dist/utils/prompt.js +1 -1
  110. package/dist/utils/segment-path-parser.js +1 -1
  111. package/dist/utils/segment-ref-parser.js +1 -1
  112. package/dist/utils/spinner.js +1 -1
  113. package/dist/utils/sql-parser.js +1 -1
  114. package/dist/utils/sse-parser.js +1 -1
  115. package/dist/utils/string-utils.js +1 -1
  116. package/dist/utils/table-ref-parser.js +1 -1
  117. package/dist/utils/tdx-config.js +1 -1
  118. package/dist/utils/tdx-logger.js +1 -1
  119. package/dist/utils/tree-formatter.js +1 -1
  120. package/dist/utils/version-check.js +1 -1
  121. package/dist/utils/workflow-utils.js +1 -1
  122. package/package.json +1 -1
@@ -1 +1 @@
1
- const a27_0xeb535d=a27_0x2906;(function(_0x1eb7a6,_0x48ead9){const _0x575cde=a27_0x2906,_0x268f8d=_0x1eb7a6();while(!![]){try{const _0x2f757b=parseInt(_0x575cde(0x275))/0x1*(-parseInt(_0x575cde(0x20c))/0x2)+parseInt(_0x575cde(0x1ab))/0x3*(-parseInt(_0x575cde(0x1e5))/0x4)+-parseInt(_0x575cde(0x1c0))/0x5+parseInt(_0x575cde(0x1e4))/0x6+-parseInt(_0x575cde(0x25a))/0x7*(-parseInt(_0x575cde(0x1f8))/0x8)+-parseInt(_0x575cde(0x1b4))/0x9*(parseInt(_0x575cde(0x25b))/0xa)+-parseInt(_0x575cde(0x247))/0xb;if(_0x2f757b===_0x48ead9)break;else _0x268f8d['push'](_0x268f8d['shift']());}catch(_0x3672b7){_0x268f8d['push'](_0x268f8d['shift']());}}}(a27_0x512c,0xcf703));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{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';import*as a27_0x38bd5a from'node:fs';function handleSDKError(_0xb01f7c,_0x30385e){const _0x310152=a27_0x2906;if(_0xb01f7c instanceof SDKError)console['error'](_0x310152(0x256)+_0xb01f7c[_0x310152(0x229)]),_0x30385e[_0x310152(0x1d0)]&&(_0xb01f7c[_0x310152(0x1ca)]&&console[_0x310152(0x1d4)]('\x20\x20Cause:\x20'+_0xb01f7c[_0x310152(0x1ca)]),_0xb01f7c['stack']&&(console['error'](_0x310152(0x248)),console['error'](_0xb01f7c[_0x310152(0x276)])));else throw _0xb01f7c;}function formatChatHistoryEntry(_0x3034c9,_0x105506){const _0x1bec64=a27_0x2906,_0x3b8d9f=getChalk(_0x105506),_0x35ef88=_0x3b8d9f[_0x1bec64(0x218)](_0x3034c9['at']);if(_0x1bec64(0x250)in _0x3034c9){const _0x490938=_0x3b8d9f[_0x1bec64(0x26b)]('[input]\x20\x20');return _0x35ef88+'\x20'+_0x490938+':\x20'+_0x3034c9[_0x1bec64(0x250)];}if(_0x1bec64(0x21c)in _0x3034c9){const _0x2700ce=_0x3b8d9f[_0x1bec64(0x1cd)](_0x1bec64(0x242));return _0x35ef88+'\x20'+_0x2700ce+':\x20'+_0x3034c9[_0x1bec64(0x21c)];}if(_0x1bec64(0x1ba)in _0x3034c9){const _0x17b166=_0x3b8d9f[_0x1bec64(0x274)](_0x1bec64(0x267)),{functionName:_0x291b09,functionArguments:_0x49d472,targetFunction:_0x16333b}=_0x3034c9['tool_call'];let _0x5b53ba=_0x35ef88+'\x20'+_0x17b166+':\x20'+_0x3b8d9f[_0x1bec64(0x26f)](_0x291b09);if(_0x49d472&&Object[_0x1bec64(0x1f4)](_0x49d472)[_0x1bec64(0x200)]>0x0){const _0x5af7bc=Object[_0x1bec64(0x1fe)](_0x49d472)[_0x1bec64(0x1fa)](([_0x3aa635,_0x461534])=>_0x3aa635+'='+JSON[_0x1bec64(0x1ad)](_0x461534))['join'](',\x20');_0x5b53ba+='('+_0x5af7bc+')';}_0x16333b&&(_0x5b53ba+=_0x3b8d9f[_0x1bec64(0x218)]('\x20['+_0x16333b+']'));let _0x4b1c6f='';if(_0x3034c9[_0x1bec64(0x1ba)]['targetKnowledgeBase'])_0x4b1c6f=_0x1bec64(0x269)+_0x3034c9[_0x1bec64(0x1ba)][_0x1bec64(0x245)][_0x1bec64(0x20a)];else{if(_0x3034c9['tool_call'][_0x1bec64(0x241)])_0x4b1c6f='\x20->\x20Agent:'+_0x3034c9['tool_call'][_0x1bec64(0x241)][_0x1bec64(0x20a)];else{if(_0x3034c9[_0x1bec64(0x1ba)][_0x1bec64(0x1d2)])_0x4b1c6f=_0x1bec64(0x26a)+_0x3034c9[_0x1bec64(0x1ba)][_0x1bec64(0x1d2)][_0x1bec64(0x20a)];else _0x3034c9[_0x1bec64(0x1ba)]['targetImageGenerator']&&(_0x4b1c6f='\x20->\x20ImageGen:'+_0x3034c9[_0x1bec64(0x1ba)][_0x1bec64(0x204)][_0x1bec64(0x20a)]);}}return _0x5b53ba+_0x4b1c6f;}if(_0x1bec64(0x1b5)in _0x3034c9){const _0x10f891=_0x3b8d9f[_0x1bec64(0x1e1)](_0x1bec64(0x24e)),{functionName:_0x32fb73,functionArguments:_0x588934,content:_0x255691,newChat:_0x4d4492}=_0x3034c9[_0x1bec64(0x1b5)];let _0xb66218=_0x35ef88+'\x20'+_0x10f891+':\x20'+_0x3b8d9f[_0x1bec64(0x26f)](_0x32fb73);if(_0x588934){const _0x2eb5a0=typeof _0x588934==='string'?_0x588934:JSON[_0x1bec64(0x1ad)](_0x588934);_0xb66218+='('+_0x2eb5a0+')';}return _0x255691&&(_0xb66218+='\x0a'+_0x3b8d9f[_0x1bec64(0x218)](_0x255691)),_0x4d4492&&(_0xb66218+=_0x3b8d9f[_0x1bec64(0x218)](_0x1bec64(0x231)+_0x4d4492['id'])),_0xb66218;}if(_0x1bec64(0x25e)in _0x3034c9){const _0x22718f=_0x3b8d9f[_0x1bec64(0x1f9)](_0x1bec64(0x217));return _0x35ef88+'\x20'+_0x22718f+':\x20'+_0x3034c9[_0x1bec64(0x25e)][_0x1bec64(0x20a)]+'\x20('+_0x3034c9[_0x1bec64(0x25e)][_0x1bec64(0x21c)][_0x1bec64(0x200)]+_0x1bec64(0x26d);}if('image'in _0x3034c9){const _0x1c7736=_0x3b8d9f[_0x1bec64(0x1f9)](_0x1bec64(0x202)),{width:_0xa4edb3,height:_0x2372f0,headerText:_0x4dca5d}=_0x3034c9[_0x1bec64(0x23e)],_0x576802=_0x4dca5d?_0x1bec64(0x1fd)+_0x4dca5d:'';return _0x35ef88+'\x20'+_0x1c7736+':\x20'+_0xa4edb3+'x'+_0x2372f0+_0x576802;}if(_0x1bec64(0x1d4)in _0x3034c9){const _0x27a377=_0x3b8d9f[_0x1bec64(0x263)](_0x1bec64(0x25d));return _0x35ef88+'\x20'+_0x27a377+':\x20'+_0x3034c9[_0x1bec64(0x1d4)];}return _0x35ef88+'\x20'+_0x3b8d9f[_0x1bec64(0x218)](_0x1bec64(0x1af))+':\x20'+JSON[_0x1bec64(0x1ad)](_0x3034c9);}async function executeChatHistoryCommand(_0x5d10d2,_0x343d92){const _0xa0c906=a27_0x2906,{options:_0x1ac5b2,args:_0x129f26,tdx:_0x40717c}=_0x5d10d2,_0x3ba2e9=_0x129f26[0x0],_0xd02368=_0x1ac5b2,_0x36877c=_0xd02368[_0xa0c906(0x279)];try{if(_0x36877c&&_0x3ba2e9)return console['error']('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0xa0c906(0x1d4)](_0xa0c906(0x226)+_0x343d92+'\x20--last'),0x1;if(!_0x3ba2e9&&!_0x36877c&&_0x1ac5b2['format']!==undefined){const _0x2757ff=resolveLimit(_0x1ac5b2[_0xa0c906(0x1e7)],DEFAULT_LLM_LIMIT),_0x5b639c=await withSpinner(_0xa0c906(0x1b1),()=>_0x40717c[_0xa0c906(0x21b)][_0xa0c906(0x23f)](_0x2757ff),{'verbose':_0x1ac5b2['verbose']});return await handleSDKOutput(_0x5b639c[_0xa0c906(0x23b)],_0x1ac5b2),0x0;}const _0x2bad41=await getChatIdOrSelect(_0x40717c,_0x1ac5b2,_0x36877c,_0x3ba2e9);if(!_0x2bad41)return 0x0;return await displayChatHistory(_0x2bad41,_0x40717c,_0x1ac5b2),0x0;}catch(_0x141e6b){return handleSDKError(_0x141e6b,_0x1ac5b2),0x1;}}async function displayChatHistory(_0x4984ae,_0x363c94,_0x2a4abd){const _0x2d97f7=a27_0x2906,_0x836cbb=await withSpinner(_0x2d97f7(0x1f1)+_0x4984ae+_0x2d97f7(0x21f),()=>_0x363c94[_0x2d97f7(0x21b)][_0x2d97f7(0x22f)](_0x4984ae),{'verbose':_0x2a4abd['verbose']}),_0x5ba6a1=_0x836cbb[_0x2d97f7(0x23b)][_0x2d97f7(0x23b)]??[];if(_0x5ba6a1[_0x2d97f7(0x200)]===0x0){console[_0x2d97f7(0x240)](_0x2d97f7(0x222));return;}if(_0x2a4abd[_0x2d97f7(0x1d5)]!==undefined)await handleSDKOutput(_0x5ba6a1,_0x2a4abd);else{const _0x53ad5d=_0x5ba6a1[_0x2d97f7(0x1fa)](_0x1bef9f=>formatChatHistoryEntry(_0x1bef9f,_0x2a4abd)),_0x29ed06=_0x53ad5d[_0x2d97f7(0x259)]('\x0a');await writeOutput(_0x29ed06,_0x2a4abd['output'],'table');}}async function getChatIdOrSelect(_0x238eac,_0x2a4511,_0x2416f1,_0x17cd31){const _0x4aee28=a27_0x2906;if(_0x17cd31)return _0x17cd31;if(_0x2416f1){const _0x4416a0=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x238eac[_0x4aee28(0x21b)][_0x4aee28(0x23f)](0x1),{'verbose':_0x2a4511['verbose']});if(_0x4416a0[_0x4aee28(0x23b)][_0x4aee28(0x200)]===0x0)return console[_0x4aee28(0x240)](_0x4aee28(0x1a1)),undefined;return _0x4416a0[_0x4aee28(0x23b)][0x0]['id'];}const _0x449e90=await selectChatInteractively(_0x238eac,_0x2a4511);if(!_0x449e90)return console[_0x4aee28(0x240)]('\x0aCancelled'),undefined;return _0x449e90;}async function getProjectIdOrDefault(_0x195b20){const _0xb243da=await getProjectWithName(_0x195b20);return _0xb243da['id'];}async function getProjectWithName(_0x719468){const _0x4d1579=a27_0x2906,{tdx:_0x11eb7a,options:_0x4dc901}=_0x719468,_0x2dfcae=_0x4dc901[_0x4d1579(0x20b)];if(_0x2dfcae){const _0x117ad3=await withSpinner(_0x4d1579(0x224)+_0x2dfcae+_0x4d1579(0x21f),()=>_0x11eb7a[_0x4d1579(0x21b)][_0x4d1579(0x1c9)](_0x2dfcae),{'verbose':_0x4dc901[_0x4d1579(0x1d0)]});return{'id':_0x117ad3[_0x4d1579(0x23b)],'name':_0x2dfcae};}const _0x276e32=_0x11eb7a[_0x4d1579(0x21b)]['getCurrentProject']();if(_0x276e32){const _0x847e12=await _0x11eb7a[_0x4d1579(0x21b)][_0x4d1579(0x1ea)](),_0x2af127=_0x847e12['find'](_0xc2291f=>_0xc2291f['id']===_0x276e32);return{'id':_0x276e32,'name':_0x2af127?.[_0x4d1579(0x1eb)]['name']||'Unknown'};}const _0x3bc10a=await withSpinner(_0x4d1579(0x1bb),()=>_0x11eb7a[_0x4d1579(0x21b)][_0x4d1579(0x253)](),{'verbose':_0x4dc901[_0x4d1579(0x1d0)]});return{'id':_0x3bc10a[_0x4d1579(0x23b)]['id'],'name':_0x3bc10a[_0x4d1579(0x23b)][_0x4d1579(0x1eb)]['name']};}function toLLMProjectInfo(_0xee1799){const _0x5b7fee=a27_0x2906;return{'name':_0xee1799[_0x5b7fee(0x1eb)][_0x5b7fee(0x20a)],'description':_0xee1799['attributes'][_0x5b7fee(0x22d)],'createdAt':_0xee1799[_0x5b7fee(0x1eb)]['createdAt'],'updatedAt':_0xee1799[_0x5b7fee(0x1eb)][_0x5b7fee(0x273)]};}function toAgentInfo(_0x557455){const _0x5188a2=a27_0x2906;return{'name':_0x557455[_0x5188a2(0x1eb)][_0x5188a2(0x20a)],'description':_0x557455[_0x5188a2(0x1eb)][_0x5188a2(0x22d)],'prompt':truncatePrompt(_0x557455[_0x5188a2(0x1eb)][_0x5188a2(0x230)]),'createdAt':_0x557455[_0x5188a2(0x1eb)]['createdAt'],'updatedAt':_0x557455[_0x5188a2(0x1eb)][_0x5188a2(0x273)]};}function truncatePrompt(_0x4b2df1){const _0x23dc1b=a27_0x2906;if(!_0x4b2df1)return undefined;const _0x129fd2=0x64;if(_0x4b2df1[_0x23dc1b(0x200)]<=_0x129fd2)return _0x4b2df1;return _0x4b2df1[_0x23dc1b(0x1ee)](0x0,_0x129fd2)+_0x23dc1b(0x236);}export class LLMModelsCommand extends BaseCommand{[a27_0xeb535d(0x20a)]=a27_0xeb535d(0x1df);[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x1b6);async[a27_0xeb535d(0x1e6)](_0x2c3f4b){const _0x173d36=a27_0xeb535d,{options:_0x463207,tdx:_0x35ee4}=_0x2c3f4b;try{const _0x923364=await withSpinner(_0x173d36(0x1ff),()=>_0x35ee4[_0x173d36(0x21b)][_0x173d36(0x268)](),{'verbose':_0x463207[_0x173d36(0x1d0)]});return await handleSDKOutput(_0x923364[_0x173d36(0x23b)],_0x463207),0x0;}catch(_0x401d3b){return handleSDKError(_0x401d3b,_0x463207),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a27_0xeb535d(0x20a)]=a27_0xeb535d(0x272);[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x1c4);async[a27_0xeb535d(0x1e6)](_0x135747){const _0x50388d=a27_0xeb535d,{options:_0x17b425,args:_0x254654,tdx:_0x421774}=_0x135747,_0xe78500=getChalk(_0x17b425),_0x2052d8=_0x17b425['web'],_0x3a8313=_0x17b425[_0x50388d(0x238)];try{const _0x22c9db=_0x254654[0x0],_0xdf028b=resolveLimit(_0x17b425[_0x50388d(0x1e7)],DEFAULT_LLM_LIMIT),_0x173683=await withSpinner(_0x50388d(0x214),()=>_0x421774[_0x50388d(0x21b)][_0x50388d(0x1ea)](_0xdf028b),{'verbose':_0x17b425[_0x50388d(0x1d0)]});let _0x588344=_0x173683[_0x50388d(0x23b)];_0x22c9db&&(_0x588344=_0x173683[_0x50388d(0x23b)][_0x50388d(0x1db)](_0x3531dd=>matchGlobPattern(_0x3531dd[_0x50388d(0x1eb)][_0x50388d(0x20a)],_0x22c9db)));const _0x354ff0=_0x17b425[_0x50388d(0x1d5)]==='json'||_0x17b425[_0x50388d(0x1d5)]===_0x50388d(0x1ef)||_0x17b425['format']===_0x50388d(0x225)||_0x17b425[_0x50388d(0x1d5)]===_0x50388d(0x201);if(_0x354ff0){const _0x4026a9=_0x588344[_0x50388d(0x1fa)](_0x1d3532=>({...toLLMProjectInfo(_0x1d3532),..._0x2052d8?{'url':getLLMProjectUrl(_0x3a8313,_0x1d3532['id'])}:{}}));await handleSDKOutput(_0x4026a9,_0x17b425);}else{const _0x68e2=[];if(_0x588344['length']===0x0)_0x68e2[_0x50388d(0x1f3)](_0xe78500['dim']('No\x20projects\x20found'));else{const _0x3d291e=[..._0x588344][_0x50388d(0x1b8)]((_0x1292ea,_0x391762)=>_0x1292ea[_0x50388d(0x1eb)][_0x50388d(0x20a)][_0x50388d(0x244)](_0x391762[_0x50388d(0x1eb)]['name']));for(const _0xb00cb4 of _0x3d291e){if(_0x2052d8){const _0x30e371=getLLMProjectUrl(_0x3a8313,_0xb00cb4['id']);_0x68e2[_0x50388d(0x1f3)](_0x50388d(0x23d)+_0xb00cb4['attributes']['name']+'\x20\x20'+_0xe78500['dim'](_0x30e371));}else _0x68e2['push'](_0x50388d(0x23d)+_0xb00cb4['attributes']['name']);}_0x68e2[_0x50388d(0x1f3)](_0xe78500[_0x50388d(0x218)](_0x588344[_0x50388d(0x200)]+'\x20project(s)'));}await writeOutput(_0x68e2[_0x50388d(0x259)]('\x0a'),_0x17b425['output'],_0x50388d(0x225));}return 0x0;}catch(_0x52e733){return handleSDKError(_0x52e733,_0x17b425),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a27_0xeb535d(0x20a)]=a27_0xeb535d(0x21e);['description']=a27_0xeb535d(0x1a2);async[a27_0xeb535d(0x1e6)](_0x260560){const _0x600330=a27_0xeb535d,{options:_0x194cda,args:_0x3c6195,tdx:_0x4c1310}=_0x260560,_0x4e447a=getChalk(_0x194cda),_0x182b80=_0x194cda[_0x600330(0x1c7)],_0x1367f2=_0x194cda['site'];try{const _0x4faeda=_0x3c6195[0x0];let _0x480213=_0x4faeda,_0x12a712,_0x5b8fb9;if(_0x4faeda&&_0x4faeda[_0x600330(0x1e9)]('/')){const _0x777323=_0x4faeda[_0x600330(0x1aa)]('/');if(_0x777323[_0x600330(0x200)]===0x2){const [_0x3d8286,_0x541f83]=_0x777323,_0x1a8d11=await _0x4c1310[_0x600330(0x21b)]['projects'](),_0x38e453=_0x1a8d11['find'](_0x36313f=>_0x36313f['attributes'][_0x600330(0x20a)][_0x600330(0x1b0)]()===_0x3d8286[_0x600330(0x1b0)]());if(!_0x38e453)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x600330(0x24c)+_0x3d8286,undefined,{'helpText':_0x600330(0x1c5)});_0x12a712=_0x38e453['id'],_0x5b8fb9=_0x38e453[_0x600330(0x1eb)][_0x600330(0x20a)],_0x480213=_0x541f83;}else throw new SDKError(ErrorCode[_0x600330(0x1a4)],_0x600330(0x1e8)+_0x4faeda,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else{const _0x52419a=await getProjectWithName(_0x260560);_0x12a712=_0x52419a['id'],_0x5b8fb9=_0x52419a['name'];}const _0x49d116=await withSpinner(_0x600330(0x266),()=>_0x4c1310[_0x600330(0x21b)][_0x600330(0x1d8)](_0x12a712),{'verbose':_0x194cda['verbose']});let _0x4cb767=_0x49d116[_0x600330(0x23b)];_0x480213&&(_0x4cb767=_0x49d116['data']['filter'](_0x592123=>matchGlobPattern(_0x592123[_0x600330(0x1eb)][_0x600330(0x20a)],_0x480213)));const _0x1d6509=_0x194cda['format']===_0x600330(0x249)||_0x194cda[_0x600330(0x1d5)]===_0x600330(0x1ef)||_0x194cda[_0x600330(0x1d5)]==='table'||_0x194cda[_0x600330(0x1d5)]===_0x600330(0x201);if(_0x1d6509){const _0xc2bb2d=_0x4cb767[_0x600330(0x1fa)](_0x59b819=>({...toAgentInfo(_0x59b819),..._0x182b80?{'chatUrl':getLLMAgentChatUrl(_0x1367f2,_0x12a712,_0x59b819['id'])}:{}}));await handleSDKOutput(_0xc2bb2d,_0x194cda);}else{const _0x194983=[];_0x194983[_0x600330(0x1f3)](_0x4e447a[_0x600330(0x218)]('['+_0x5b8fb9+']'));if(_0x4cb767['length']===0x0)_0x194983[_0x600330(0x1f3)](_0x4e447a[_0x600330(0x218)]('No\x20agents\x20found'));else{const _0x3d41fd=[..._0x4cb767][_0x600330(0x1b8)]((_0x237dde,_0x2e3ba6)=>_0x237dde[_0x600330(0x1eb)]['name'][_0x600330(0x244)](_0x2e3ba6[_0x600330(0x1eb)]['name']));for(const _0x5a862b of _0x3d41fd){if(_0x182b80){const _0x459e80=getLLMAgentChatUrl(_0x1367f2,_0x12a712,_0x5a862b['id']);_0x194983[_0x600330(0x1f3)](_0x600330(0x24f)+_0x5a862b['attributes'][_0x600330(0x20a)]+'\x20\x20'+_0x4e447a[_0x600330(0x218)](_0x459e80));}else _0x194983[_0x600330(0x1f3)](_0x600330(0x24f)+_0x5a862b[_0x600330(0x1eb)][_0x600330(0x20a)]);}_0x194983[_0x600330(0x1f3)](_0x4e447a[_0x600330(0x218)](_0x4cb767[_0x600330(0x200)]+_0x600330(0x1c1)));}await writeOutput(_0x194983['join']('\x0a'),_0x194cda['output'],'table');}return 0x0;}catch(_0x561a11){return handleSDKError(_0x561a11,_0x194cda),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a27_0xeb535d(0x20a)]=a27_0xeb535d(0x264);[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x1ae);async[a27_0xeb535d(0x1e6)](_0x46ad0c){const _0x55b652=a27_0xeb535d,{options:_0x101c7b,args:_0x26be6a,tdx:_0x7b8551}=_0x46ad0c;if(_0x26be6a['length']===0x0)return console[_0x55b652(0x1d4)](_0x55b652(0x1d7)),console[_0x55b652(0x1d4)](_0x55b652(0x203)),0x1;const _0x432c0e=_0x26be6a[0x0];try{const _0x3414a9=await getProjectIdOrDefault(_0x46ad0c),_0x49b140=await withSpinner(_0x55b652(0x1d6)+_0x432c0e+_0x55b652(0x21f),()=>_0x7b8551[_0x55b652(0x21b)][_0x55b652(0x27a)](_0x432c0e,_0x3414a9),{'verbose':_0x101c7b[_0x55b652(0x1d0)]}),_0xa7422e=await withSpinner('Fetching\x20agent...',()=>_0x7b8551[_0x55b652(0x21b)][_0x55b652(0x228)](_0x49b140[_0x55b652(0x23b)]),{'verbose':_0x101c7b[_0x55b652(0x1d0)]});return await handleSDKOutput([_0xa7422e[_0x55b652(0x23b)]],_0x101c7b),0x0;}catch(_0x47d444){return handleSDKError(_0x47d444,_0x101c7b),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']='llm:agent:create';[a27_0xeb535d(0x22d)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async['execute'](_0x1899a6){const _0x5ca472=a27_0xeb535d,{options:_0x6de52a,args:_0x4584d4,tdx:_0x2a5d7f}=_0x1899a6;if(_0x4584d4[_0x5ca472(0x200)]===0x0)return console['error'](_0x5ca472(0x1d7)),console[_0x5ca472(0x1d4)](_0x5ca472(0x24b)),console[_0x5ca472(0x1d4)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]'),0x1;const _0x37f283=_0x4584d4[0x0],_0x291efd=_0x6de52a,_0x5a1657=_0x291efd['systemPrompt'],_0x6fee0a=_0x291efd['model']||_0x5ca472(0x234),_0x24cf9b=_0x291efd['starterMessage'],_0x10189b=_0x291efd[_0x5ca472(0x220)]?Number(_0x291efd[_0x5ca472(0x220)]):undefined,_0x5a5cb2=_0x291efd['temperature']?Number(_0x291efd[_0x5ca472(0x1e2)]):undefined;try{let _0x130220,_0x5c4b38;if(_0x37f283[_0x5ca472(0x1e9)]('/')){const _0x5b0314=_0x37f283[_0x5ca472(0x1aa)]('/');if(_0x5b0314[_0x5ca472(0x200)]===0x2){const [_0x39443b,_0x116fed]=_0x5b0314,_0x44f4d1=await withSpinner(_0x5ca472(0x224)+_0x39443b+_0x5ca472(0x21f),()=>_0x2a5d7f[_0x5ca472(0x21b)][_0x5ca472(0x1c9)](_0x39443b),{'verbose':_0x6de52a[_0x5ca472(0x1d0)]});_0x130220=_0x44f4d1['data'],_0x5c4b38=_0x116fed;}else throw new SDKError(ErrorCode[_0x5ca472(0x1a4)],_0x5ca472(0x1e8)+_0x37f283,undefined,{'helpText':_0x5ca472(0x1d1)});}else _0x130220=await getProjectIdOrDefault(_0x1899a6),_0x5c4b38=_0x37f283;const _0x2d368a=await withSpinner(_0x5ca472(0x25c)+_0x5c4b38+'\x27...',()=>_0x2a5d7f['llm'][_0x5ca472(0x270)]({'name':_0x5c4b38,'projectId':_0x130220,'modelType':_0x6fee0a,'systemPrompt':_0x5a1657,'starterMessage':_0x24cf9b,'maxToolIterations':_0x10189b,'temperature':_0x5a5cb2}),{'verbose':_0x6de52a[_0x5ca472(0x1d0)]});return console[_0x5ca472(0x240)](_0x5ca472(0x26c)+_0x2d368a[_0x5ca472(0x23b)]['id']),await handleSDKOutput([_0x2d368a[_0x5ca472(0x23b)]],_0x6de52a),0x0;}catch(_0x81d54d){return handleSDKError(_0x81d54d,_0x6de52a),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a27_0xeb535d(0x20a)]='llm:agent:update';[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x1a8);async[a27_0xeb535d(0x1e6)](_0x1ab1ee){const _0x1214cd=a27_0xeb535d,{options:_0x5bac80,args:_0x3def5f,tdx:_0x1e89e0}=_0x1ab1ee;if(_0x3def5f['length']===0x0)return console[_0x1214cd(0x1d4)](_0x1214cd(0x1d7)),console['error'](_0x1214cd(0x206)),0x1;const _0x1b78ed=_0x3def5f[0x0],_0x1b2869=_0x5bac80,_0x3d4c9a=_0x1b2869['name'],_0x255ccc=_0x1b2869[_0x1214cd(0x230)],_0x1d407d=_0x1b2869['description'],_0xd34eb=_0x1b2869[_0x1214cd(0x265)];if(!_0x3d4c9a&&!_0x255ccc&&!_0x1d407d&&!_0xd34eb)return console[_0x1214cd(0x1d4)](_0x1214cd(0x23c)),console['error'](_0x1214cd(0x223)),0x1;try{const _0x27d7a4=await getProjectIdOrDefault(_0x1ab1ee),_0x66d6e9=await withSpinner(_0x1214cd(0x1d6)+_0x1b78ed+_0x1214cd(0x21f),()=>_0x1e89e0['llm'][_0x1214cd(0x27a)](_0x1b78ed,_0x27d7a4),{'verbose':_0x5bac80['verbose']}),_0x3b69b3=_0x66d6e9[_0x1214cd(0x23b)],_0x156ac8=await withSpinner(_0x1214cd(0x1b2),()=>_0x1e89e0[_0x1214cd(0x21b)][_0x1214cd(0x212)](_0x3b69b3,{'name':_0x3d4c9a,'prompt':_0x255ccc,'description':_0x1d407d,'starterMessage':_0xd34eb}),{'verbose':_0x5bac80[_0x1214cd(0x1d0)]});return console[_0x1214cd(0x240)](_0x1214cd(0x262)+_0x156ac8[_0x1214cd(0x23b)]['id']),await handleSDKOutput([_0x156ac8['data']],_0x5bac80),0x0;}catch(_0x5c642f){return handleSDKError(_0x5c642f,_0x5bac80),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a27_0xeb535d(0x20a)]='llm:agent:delete';['description']=a27_0xeb535d(0x261);async['execute'](_0xb05f42){const _0x46d22f=a27_0xeb535d,{options:_0x53415c,args:_0xf4de0c,tdx:_0x46b6d0}=_0xb05f42;if(_0xf4de0c['length']===0x0)return console[_0x46d22f(0x1d4)](_0x46d22f(0x1d7)),console[_0x46d22f(0x1d4)](_0x46d22f(0x1cf)),0x1;const _0x36cdd1=_0xf4de0c[0x0];try{const _0x3adac0=await getProjectIdOrDefault(_0xb05f42),_0x5f1223=await withSpinner(_0x46d22f(0x1d6)+_0x36cdd1+_0x46d22f(0x21f),()=>_0x46b6d0[_0x46d22f(0x21b)][_0x46d22f(0x27a)](_0x36cdd1,_0x3adac0),{'verbose':_0x53415c['verbose']}),_0xfc8356=_0x5f1223[_0x46d22f(0x23b)];return await withSpinner(_0x46d22f(0x1a6),()=>_0x46b6d0[_0x46d22f(0x21b)][_0x46d22f(0x215)](_0xfc8356),{'verbose':_0x53415c['verbose']}),console[_0x46d22f(0x240)](_0x46d22f(0x221)+_0xfc8356),0x0;}catch(_0x28376b){return handleSDKError(_0x28376b,_0x53415c),0x1;}}}function a27_0x2906(_0xd401da,_0x2cd88f){_0xd401da=_0xd401da-0x1a1;const _0x512cbf=a27_0x512c();let _0x290646=_0x512cbf[_0xd401da];return _0x290646;}export class LLMHistoryCommand extends BaseCommand{['name']=a27_0xeb535d(0x210);[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x257);async[a27_0xeb535d(0x1e6)](_0x1acc05){const _0x4c41b4=a27_0xeb535d;return executeChatHistoryCommand(_0x1acc05,_0x4c41b4(0x24a));}}export class LLMUseCommand extends BaseCommand{['name']=a27_0xeb535d(0x205);[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x1ac);async['execute'](_0x5ed102){const _0x525343=a27_0xeb535d,{options:_0x5e0e27,args:_0x19fb79,tdx:_0x269975}=_0x5ed102;if(_0x19fb79['length']===0x0)return console[_0x525343(0x1d4)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x525343(0x1d4)](_0x525343(0x1b7)),0x1;const _0x1559c3=_0x19fb79[0x0];try{return await withSpinner(_0x525343(0x1f2)+_0x1559c3+_0x525343(0x21f),()=>_0x269975['llm'][_0x525343(0x1ec)](_0x1559c3),{'verbose':_0x5e0e27[_0x525343(0x1d0)]}),console[_0x525343(0x240)](_0x525343(0x213)+_0x1559c3),0x0;}catch(_0x436535){return handleSDKError(_0x436535,_0x5e0e27),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a27_0xeb535d(0x20a)]='llm:project:create';[a27_0xeb535d(0x22d)]='Create\x20a\x20new\x20LLM\x20project';async['execute'](_0x28299d){const _0x677452=a27_0xeb535d,{options:_0x4de03c,args:_0x4f6c80,tdx:_0x324f1a}=_0x28299d;if(_0x4f6c80[_0x677452(0x200)]===0x0)return console[_0x677452(0x1d4)](_0x677452(0x237)),console['error'](_0x677452(0x252)),0x1;const _0x2ed964=_0x4f6c80[0x0],_0x4ddeaa=_0x4de03c,_0x484e7a=_0x4ddeaa['description'];try{const _0x158395=await withSpinner(_0x677452(0x1c8)+_0x2ed964+_0x677452(0x21f),()=>_0x324f1a['llm'][_0x677452(0x255)]({'name':_0x2ed964,'description':_0x484e7a}),{'verbose':_0x4de03c[_0x677452(0x1d0)]});console[_0x677452(0x240)]('Project\x20created:\x20'+_0x158395[_0x677452(0x23b)]['id']);const _0x17405b=toLLMProjectInfo(_0x158395[_0x677452(0x23b)]);return await handleSDKOutput([_0x17405b],_0x4de03c),0x0;}catch(_0xee056c){return handleSDKError(_0xee056c,_0x4de03c),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a27_0xeb535d(0x20a)]='llm:project:delete';[a27_0xeb535d(0x22d)]='Delete\x20an\x20LLM\x20project';async[a27_0xeb535d(0x1e6)](_0xef3ba9){const _0x224c14=a27_0xeb535d,{options:_0x3557dc,args:_0x541d98,tdx:_0x3e6405}=_0xef3ba9;if(_0x541d98[_0x224c14(0x200)]===0x0)return console[_0x224c14(0x1d4)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x224c14(0x1d4)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x165d84=_0x541d98[0x0];try{return await withSpinner(_0x224c14(0x1f5)+_0x165d84+_0x224c14(0x21f),()=>_0x3e6405[_0x224c14(0x21b)][_0x224c14(0x243)](_0x165d84),{'verbose':_0x3557dc[_0x224c14(0x1d0)]}),console['log']('Project\x20deleted:\x20'+_0x165d84),0x0;}catch(_0x4517e7){return handleSDKError(_0x4517e7,_0x3557dc),0x1;}}}function a27_0x512c(){const _0x58e3d4=['output','(no\x20agent)','Project\x20backed\x20up\x20to:\x20','Delete\x20an\x20agent','Agent\x20updated:\x20','red','llm:agent:show','starterMessage','Fetching\x20agents...','[tool_call]','models','\x20->\x20KB:','\x20->\x20WebSearch:','cyan','Agent\x20created:\x20','\x20bytes)','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','bold','createAgent','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','llm:projects','updatedAt','yellow','1iPNXqF','stack','restoreProject','\x27\x20already\x20exists.\x20Overwrite?','last','resolveAgentId','floor','outputDir','No\x20chat\x20sessions\x20found.','List\x20agents\x20in\x20current\x20project','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','INVALID_ARGUMENT','Checking\x20for\x20existing\x20projects...','Deleting\x20agent...','h\x20ago','Update\x20an\x20existing\x20agent','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','split','3scmGDT','Set\x20current\x20project\x20context','stringify','Show\x20agent\x20details','[unknown]','toLowerCase','Fetching\x20chat\x20sessions...','Updating\x20agent...','dryRun','14211TofHNJ','tool','List\x20available\x20LLM\x20models','Usage:\x20tdx\x20llm\x20use\x20<project-name>','sort','short','tool_call','Getting\x20default\x20project...','agentId','toLocaleDateString','Restore\x20cancelled.','Analyzing\x20project\x20\x27','3827410qDTjVr','\x20agent(s)','Error:\x20Backup\x20folder\x20path\x20is\x20required','\x20\x20\x20Examples:','List\x20all\x20LLM\x20projects','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','rmSync','web','Creating\x20project\x20\x27','resolveProjectId','cause','getTime','find','green','projectName','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','verbose','Use\x20format:\x20project-name/agent-name','targetWebSearchTool','Select\x20a\x20chat\x20session:','error','format','Resolving\x20agent\x20\x27','Error:\x20Agent\x20name\x20is\x20required','agents','exportedFrom','tdx\x20chats','filter','\x20\x20Prompts:\x20','counts','en-US','llm:models','Project\x20restored:\x20','magenta','temperature','\x20\x20Agents:\x20','9494472iCtPCg','1445132qOhNBT','execute','limit','Invalid\x20path\x20syntax:\x20','includes','projects','attributes','setCurrentProject','getBackupMetadata','slice','jsonl','integrations','Fetching\x20chat\x20history\x20for\x20\x27','Setting\x20project\x20context\x20to\x20\x27','push','keys','Deleting\x20project\x20\x27','.llm','existsSync','48JRptYk','blue','map','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','set','\x20-\x20','entries','Fetching\x20available\x20models...','length','tsv','[image]\x20\x20','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','targetImageGenerator','llm:use','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','substring','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','\x20\x20Knowledge\x20Bases:\x20','name','llmProject','1579712aiGjer','Backup\x20cancelled.','Backing\x20up\x20project\x20\x27','(no\x20message)','llm:history','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','updateAgent','Project\x20context\x20set\x20to:\x20','Fetching\x20projects...','deleteAgent','chatId','[output]\x20','dim','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','llm','content','\x20\x20Integrations:\x20','llm:agents','\x27...','maxToolIterations','Agent\x20deleted:\x20','No\x20messages\x20found\x20in\x20chat\x20history.','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Resolving\x20project\x20\x27','table','Usage:\x20','all','agent','message','firstInputContent','backupProject','select','description','llm:project:backup','history','prompt','\x20→\x20chat:\x20','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','yes','claude-4.5-haiku','__load_more__','...','Error:\x20Project\x20name\x20is\x20required','site','Restoring\x20project\x20from\x20\x27','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','data','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','⚒️\x20','image','chats','log','targetAgent','[content]','deleteProject','localeCompare','targetKnowledgeBase','knowledgeBases','2746601cfZBBB','\x0aStack\x20trace:','json','tdx\x20llm\x20history','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Project\x20not\x20found:\x20','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','[tool]\x20\x20\x20','🤖\x20','input','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','getOrCreateDefaultProject','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','createProject','Error:\x20','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','prompts','join','1685390GPQVLg','70cloQct','Creating\x20agent\x20\x27','[error]\x20\x20'];a27_0x512c=function(){return _0x58e3d4;};return a27_0x512c();}export class LLMProjectBackupCommand extends BaseCommand{['name']=a27_0xeb535d(0x22e);[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x232);async[a27_0xeb535d(0x1e6)](_0x28b6f2){const _0x219624=a27_0xeb535d,{options:_0x2ad5ee,args:_0x3eb16e,tdx:_0x249e1f}=_0x28b6f2,_0x5a6ff0=getChalk(_0x2ad5ee);console['log'](_0x5a6ff0[_0x219624(0x274)](_0x219624(0x208))),console[_0x219624(0x240)](_0x5a6ff0[_0x219624(0x274)](_0x219624(0x271))),console[_0x219624(0x240)](_0x5a6ff0['dim'](_0x219624(0x1a3))),console[_0x219624(0x240)]();if(_0x3eb16e[_0x219624(0x200)]===0x0)return console[_0x219624(0x1d4)](_0x219624(0x237)),console[_0x219624(0x1d4)](_0x219624(0x211)),0x1;const _0x264cc7=_0x3eb16e[0x0],_0x3f76cc=_0x2ad5ee,_0x46dd6a=_0x3f76cc[_0x219624(0x25e)],_0x2e4207=_0x3f76cc[_0x219624(0x1b3)];try{const _0xf49c81=_0x46dd6a||_0x264cc7+_0x219624(0x1f6);if(a27_0x38bd5a[_0x219624(0x1f7)](_0xf49c81)&&!_0x2e4207){if(!_0x2ad5ee[_0x219624(0x233)]){const _0x1b6f0b=await confirm('Output\x20directory\x20\x27'+_0xf49c81+_0x219624(0x278));if(!_0x1b6f0b)return console['log'](_0x219624(0x20d)),0x0;}a27_0x38bd5a[_0x219624(0x1c6)](_0xf49c81,{'recursive':!![]});}const _0x1ef59f=await withSpinner(_0x2e4207?_0x219624(0x1bf)+_0x264cc7+'\x27...':_0x219624(0x20e)+_0x264cc7+_0x219624(0x21f),()=>_0x249e1f['llm'][_0x219624(0x22b)](_0x264cc7,_0x46dd6a,{'dryRun':_0x2e4207}),{'verbose':_0x2ad5ee[_0x219624(0x1d0)]}),_0x585a22=_0x1ef59f[_0x219624(0x23b)];return _0x2e4207?console[_0x219624(0x240)](_0x219624(0x26e)+_0x585a22[_0x219624(0x27c)]):console['log'](_0x219624(0x260)+_0x585a22[_0x219624(0x27c)]),console[_0x219624(0x240)](_0x219624(0x1e3)+_0x585a22[_0x219624(0x1dd)]['agents']),console['log'](_0x219624(0x209)+_0x585a22[_0x219624(0x1dd)][_0x219624(0x246)]),console['log'](_0x219624(0x1dc)+_0x585a22[_0x219624(0x1dd)][_0x219624(0x258)]),console['log'](_0x219624(0x21d)+_0x585a22['counts'][_0x219624(0x1f0)]),(_0x2ad5ee[_0x219624(0x1d5)]===_0x219624(0x249)||_0x2ad5ee[_0x219624(0x1d5)]==='jsonl')&&await handleSDKOutput([_0x585a22],_0x2ad5ee),0x0;}catch(_0x568fca){return handleSDKError(_0x568fca,_0x2ad5ee),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a27_0xeb535d(0x20a)]='llm:project:restore';[a27_0xeb535d(0x22d)]=a27_0xeb535d(0x254);async[a27_0xeb535d(0x1e6)](_0x52d2ef){const _0x2eba84=a27_0xeb535d,{options:_0x57b53a,args:_0x4ceb38,tdx:_0x27cbb8}=_0x52d2ef,_0x7b9d44=getChalk(_0x57b53a);console['log'](_0x7b9d44[_0x2eba84(0x274)](_0x2eba84(0x21a))),console[_0x2eba84(0x240)](_0x7b9d44['yellow']('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console[_0x2eba84(0x240)](_0x7b9d44['dim'](_0x2eba84(0x1c3))),console[_0x2eba84(0x240)](_0x7b9d44[_0x2eba84(0x218)](_0x2eba84(0x251))),console['log'](_0x7b9d44['dim'](_0x2eba84(0x219))),console['log']();if(_0x4ceb38[_0x2eba84(0x200)]===0x0)return console['error'](_0x2eba84(0x1c2)),console[_0x2eba84(0x1d4)](_0x2eba84(0x1fb)),0x1;const _0x406784=_0x4ceb38[0x0],_0x2ca3bd=_0x57b53a,_0x4a8798=_0x2ca3bd[_0x2eba84(0x20a)],_0x3d1aae=_0x2ca3bd[_0x2eba84(0x1b3)];try{if(!_0x3d1aae){const _0x1515f1=_0x27cbb8[_0x2eba84(0x21b)][_0x2eba84(0x1ed)](_0x406784),_0x38c614=_0x4a8798||_0x1515f1[_0x2eba84(0x1d9)][_0x2eba84(0x1ce)],_0x2ee72d=await withSpinner(_0x2eba84(0x1a5),()=>_0x27cbb8[_0x2eba84(0x21b)][_0x2eba84(0x1ea)](),{'verbose':_0x57b53a[_0x2eba84(0x1d0)]}),_0x9ab88e=_0x2ee72d[_0x2eba84(0x23b)][_0x2eba84(0x1cc)](_0xf6b35c=>_0xf6b35c[_0x2eba84(0x1eb)][_0x2eba84(0x20a)]===_0x38c614);if(_0x9ab88e&&!_0x57b53a[_0x2eba84(0x233)]){const _0x271ec2=await confirm('A\x20project\x20named\x20\x27'+_0x38c614+_0x2eba84(0x1a9));if(!_0x271ec2)return console[_0x2eba84(0x240)](_0x2eba84(0x1be)),0x0;}}const _0x493708=await withSpinner(_0x3d1aae?'Validating\x20backup\x20from\x20\x27'+_0x406784+_0x2eba84(0x21f):_0x2eba84(0x239)+_0x406784+_0x2eba84(0x21f),()=>_0x27cbb8[_0x2eba84(0x21b)][_0x2eba84(0x277)](_0x406784,{'name':_0x4a8798,'dryRun':_0x3d1aae}),{'verbose':_0x57b53a[_0x2eba84(0x1d0)]}),_0x185304=_0x493708[_0x2eba84(0x23b)];return _0x185304['sourceSite']&&console[_0x2eba84(0x240)]('[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27'+_0x185304['sourceSite']+'\x27'),_0x3d1aae?console[_0x2eba84(0x240)](_0x2eba84(0x23a)+_0x185304[_0x2eba84(0x1ce)]):console[_0x2eba84(0x240)](_0x2eba84(0x1e0)+_0x185304[_0x2eba84(0x1ce)]+'\x20('+_0x185304['projectId']+')'),console[_0x2eba84(0x240)]('\x20\x20Agents:\x20'+_0x185304['counts'][_0x2eba84(0x1d8)]),console[_0x2eba84(0x240)]('\x20\x20Knowledge\x20Bases:\x20'+_0x185304['counts'][_0x2eba84(0x246)]),console['log'](_0x2eba84(0x1dc)+_0x185304[_0x2eba84(0x1dd)][_0x2eba84(0x258)]),console['log'](_0x2eba84(0x21d)+_0x185304[_0x2eba84(0x1dd)]['integrations']),(_0x57b53a['format']===_0x2eba84(0x249)||_0x57b53a['format']===_0x2eba84(0x1ef))&&await handleSDKOutput([_0x185304],_0x57b53a),0x0;}catch(_0x5623a0){return handleSDKError(_0x5623a0,_0x57b53a),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x4679a2,_0x3d0244){const _0x1cdcbc=a27_0xeb535d,_0x4995f3=_0x3d0244[_0x1cdcbc(0x1e7)]||CHAT_SELECTOR_PAGE_SIZE;let _0x3b8517=0x0,_0x4a77c2=[];const _0x2496af=(await import('prompts'))['default'],_0x11eae8=getChalk(_0x3d0244);while(!![]){const _0x2389ac=await withSpinner(_0x1cdcbc(0x1b1),()=>_0x4679a2[_0x1cdcbc(0x21b)][_0x1cdcbc(0x23f)](_0x4995f3+_0x3b8517),{'verbose':_0x3d0244[_0x1cdcbc(0x1d0)]});_0x4a77c2=_0x2389ac['data'];const _0x9cd852=_0x4a77c2['slice'](_0x3b8517,_0x3b8517+_0x4995f3),_0x22e234=_0x4a77c2[_0x1cdcbc(0x200)]>_0x3b8517+_0x4995f3,_0x2d2847=[...new Set(_0x9cd852[_0x1cdcbc(0x1fa)](_0x18db5d=>_0x18db5d['attributes'][_0x1cdcbc(0x1bc)])['filter'](_0x4e2b95=>_0x4e2b95!==undefined))],_0x5a8780=new Map();await Promise[_0x1cdcbc(0x227)](_0x2d2847[_0x1cdcbc(0x1fa)](async _0x169963=>{const _0x18a83e=_0x1cdcbc;try{const _0x3091ce=await _0x4679a2[_0x18a83e(0x21b)]['agent'](_0x169963);_0x5a8780[_0x18a83e(0x1fc)](_0x169963,_0x3091ce[_0x18a83e(0x1eb)][_0x18a83e(0x20a)]);}catch{_0x5a8780[_0x18a83e(0x1fc)](_0x169963,_0x169963);}}));const _0x544cc8=_0x9cd852[_0x1cdcbc(0x1fa)](_0x435c88=>{const _0xee2040=_0x1cdcbc,_0x5234f7=_0x435c88[_0xee2040(0x1eb)][_0xee2040(0x22a)]||_0xee2040(0x20f),_0x56f54b=_0x5234f7[_0xee2040(0x1aa)]('\x0a')[0x0],_0xf8074a=_0x56f54b[_0xee2040(0x200)]>0x50?_0x56f54b[_0xee2040(0x207)](0x0,0x4d)+_0xee2040(0x236):_0x56f54b,_0x5ad8da=_0x435c88['attributes'][_0xee2040(0x1bc)]?_0x5a8780['get'](_0x435c88[_0xee2040(0x1eb)][_0xee2040(0x1bc)])||_0x435c88['attributes'][_0xee2040(0x1bc)]:_0xee2040(0x25f),_0x12f6ce=_0x435c88[_0xee2040(0x1eb)]['lastConversationAt']||_0x435c88[_0xee2040(0x1eb)]['updatedAt'],_0x1f7d85=new Date(_0x12f6ce),_0x5190f0=new Date(),_0x122e34=_0x5190f0[_0xee2040(0x1cb)]()-_0x1f7d85[_0xee2040(0x1cb)](),_0x4e62b3=Math['floor'](_0x122e34/0xea60),_0x6e9743=Math['floor'](_0x122e34/0x36ee80),_0x4c8c06=Math[_0xee2040(0x27b)](_0x122e34/0x5265c00);let _0x3fbc7f;if(_0x4e62b3<0x1)_0x3fbc7f='just\x20now';else{if(_0x4e62b3<0x3c)_0x3fbc7f=_0x4e62b3+'m\x20ago';else{if(_0x6e9743<0x18)_0x3fbc7f=_0x6e9743+_0xee2040(0x1a7);else _0x4c8c06<0x7?_0x3fbc7f=_0x4c8c06+'d\x20ago':_0x3fbc7f=_0x1f7d85[_0xee2040(0x1bd)](_0xee2040(0x1de),{'month':_0xee2040(0x1b9),'day':'numeric'});}}return{'title':_0xf8074a+'\x20'+_0x11eae8[_0xee2040(0x218)]('['+_0x5ad8da+']\x20'+_0x3fbc7f),'value':_0x435c88['id']};});_0x22e234&&_0x544cc8[_0x1cdcbc(0x1f3)]({'title':_0x11eae8[_0x1cdcbc(0x26b)]('Load\x20more...'),'value':_0x1cdcbc(0x235)});const _0x4fec42=await _0x2496af({'type':_0x1cdcbc(0x22c),'name':_0x1cdcbc(0x216),'message':_0x1cdcbc(0x1d3),'choices':_0x544cc8,'hint':_0x1cdcbc(0x24d)});if(!_0x4fec42['chatId'])return undefined;if(_0x4fec42[_0x1cdcbc(0x216)]==='__load_more__'){_0x3b8517+=_0x4995f3;continue;}return _0x4fec42[_0x1cdcbc(0x216)];}}export class ChatsCommand extends BaseCommand{[a27_0xeb535d(0x20a)]='chats';[a27_0xeb535d(0x22d)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a27_0xeb535d(0x1e6)](_0x5b373c){const _0x4afb3d=a27_0xeb535d;return executeChatHistoryCommand(_0x5b373c,_0x4afb3d(0x1da));}}
1
+ const a27_0x10790b=a27_0x1cb5;(function(_0xfd4bd9,_0x405f33){const _0x49edf8=a27_0x1cb5,_0x27abb3=_0xfd4bd9();while(!![]){try{const _0x1349ba=-parseInt(_0x49edf8(0x18a))/0x1+-parseInt(_0x49edf8(0x139))/0x2*(-parseInt(_0x49edf8(0x201))/0x3)+-parseInt(_0x49edf8(0x133))/0x4+parseInt(_0x49edf8(0x1ba))/0x5+parseInt(_0x49edf8(0x1bf))/0x6*(parseInt(_0x49edf8(0x1dc))/0x7)+parseInt(_0x49edf8(0x1ec))/0x8+parseInt(_0x49edf8(0x188))/0x9*(parseInt(_0x49edf8(0x1e1))/0xa);if(_0x1349ba===_0x405f33)break;else _0x27abb3['push'](_0x27abb3['shift']());}catch(_0x39e74e){_0x27abb3['push'](_0x27abb3['shift']());}}}(a27_0x3c05,0x537b5));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{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';import*as a27_0x181393 from'node:fs';function handleSDKError(_0x55cd2d,_0x21f59a){const _0x50caff=a27_0x1cb5;if(_0x55cd2d instanceof SDKError)console[_0x50caff(0x1d0)](_0x50caff(0x1e8)+_0x55cd2d[_0x50caff(0x157)]),_0x21f59a[_0x50caff(0x190)]&&(_0x55cd2d[_0x50caff(0x194)]&&console['error']('\x20\x20Cause:\x20'+_0x55cd2d[_0x50caff(0x194)]),_0x55cd2d[_0x50caff(0x1fb)]&&(console[_0x50caff(0x1d0)]('\x0aStack\x20trace:'),console['error'](_0x55cd2d[_0x50caff(0x1fb)])));else throw _0x55cd2d;}function formatChatHistoryEntry(_0x163894,_0x374c3c){const _0x3a2b7d=a27_0x1cb5,_0x2d8909=getChalk(_0x374c3c),_0x1e8eb9=_0x2d8909[_0x3a2b7d(0x1af)](_0x163894['at']);if(_0x3a2b7d(0x1dd)in _0x163894){const _0x18afb2=_0x2d8909[_0x3a2b7d(0x15c)](_0x3a2b7d(0x1ac));return _0x1e8eb9+'\x20'+_0x18afb2+':\x20'+_0x163894[_0x3a2b7d(0x1dd)];}if(_0x3a2b7d(0x1e6)in _0x163894){const _0x280edd=_0x2d8909[_0x3a2b7d(0x1da)]('[content]');return _0x1e8eb9+'\x20'+_0x280edd+':\x20'+_0x163894['content'];}if(_0x3a2b7d(0x18b)in _0x163894){const _0x232fd5=_0x2d8909[_0x3a2b7d(0x1d5)](_0x3a2b7d(0x13a)),{functionName:_0x1c7ec0,functionArguments:_0x5b6e4c,targetFunction:_0x2a095e}=_0x163894[_0x3a2b7d(0x18b)];let _0x150e3d=_0x1e8eb9+'\x20'+_0x232fd5+':\x20'+_0x2d8909[_0x3a2b7d(0x1b9)](_0x1c7ec0);if(_0x5b6e4c&&Object[_0x3a2b7d(0x132)](_0x5b6e4c)[_0x3a2b7d(0x1e9)]>0x0){const _0xeceee7=Object[_0x3a2b7d(0x130)](_0x5b6e4c)[_0x3a2b7d(0x1b1)](([_0x5cdc63,_0x1a9708])=>_0x5cdc63+'='+JSON[_0x3a2b7d(0x1fa)](_0x1a9708))[_0x3a2b7d(0x1b2)](',\x20');_0x150e3d+='('+_0xeceee7+')';}_0x2a095e&&(_0x150e3d+=_0x2d8909[_0x3a2b7d(0x1af)]('\x20['+_0x2a095e+']'));let _0x4885de='';if(_0x163894['tool_call'][_0x3a2b7d(0x1c5)])_0x4885de='\x20->\x20KB:'+_0x163894[_0x3a2b7d(0x18b)][_0x3a2b7d(0x1c5)][_0x3a2b7d(0x20a)];else{if(_0x163894['tool_call'][_0x3a2b7d(0x15b)])_0x4885de=_0x3a2b7d(0x1f0)+_0x163894[_0x3a2b7d(0x18b)][_0x3a2b7d(0x15b)][_0x3a2b7d(0x20a)];else{if(_0x163894[_0x3a2b7d(0x18b)][_0x3a2b7d(0x12c)])_0x4885de=_0x3a2b7d(0x15f)+_0x163894[_0x3a2b7d(0x18b)]['targetWebSearchTool']['name'];else _0x163894[_0x3a2b7d(0x18b)]['targetImageGenerator']&&(_0x4885de=_0x3a2b7d(0x13f)+_0x163894[_0x3a2b7d(0x18b)][_0x3a2b7d(0x155)][_0x3a2b7d(0x20a)]);}}return _0x150e3d+_0x4885de;}if(_0x3a2b7d(0x205)in _0x163894){const _0x5d3d57=_0x2d8909[_0x3a2b7d(0x14f)]('[tool]\x20\x20\x20'),{functionName:_0x325448,functionArguments:_0x5bbf7c,content:_0x141c3c,newChat:_0x16f2a9}=_0x163894[_0x3a2b7d(0x205)];let _0x3a4c03=_0x1e8eb9+'\x20'+_0x5d3d57+':\x20'+_0x2d8909[_0x3a2b7d(0x1b9)](_0x325448);if(_0x5bbf7c){const _0x46e63b=typeof _0x5bbf7c===_0x3a2b7d(0x16e)?_0x5bbf7c:JSON[_0x3a2b7d(0x1fa)](_0x5bbf7c);_0x3a4c03+='('+_0x46e63b+')';}return _0x141c3c&&(_0x3a4c03+='\x0a'+_0x2d8909[_0x3a2b7d(0x1af)](_0x141c3c)),_0x16f2a9&&(_0x3a4c03+=_0x2d8909['dim'](_0x3a2b7d(0x13d)+_0x16f2a9['id'])),_0x3a4c03;}if(_0x3a2b7d(0x197)in _0x163894){const _0x249c23=_0x2d8909['blue'](_0x3a2b7d(0x1e5));return _0x1e8eb9+'\x20'+_0x249c23+':\x20'+_0x163894['output']['name']+'\x20('+_0x163894[_0x3a2b7d(0x197)][_0x3a2b7d(0x1e6)][_0x3a2b7d(0x1e9)]+_0x3a2b7d(0x1db);}if(_0x3a2b7d(0x1e0)in _0x163894){const _0x4bf8b3=_0x2d8909[_0x3a2b7d(0x15a)](_0x3a2b7d(0x19c)),{width:_0x3051cc,height:_0xfe9344,headerText:_0x56c746}=_0x163894[_0x3a2b7d(0x1e0)],_0x72dd9f=_0x56c746?_0x3a2b7d(0x1a0)+_0x56c746:'';return _0x1e8eb9+'\x20'+_0x4bf8b3+':\x20'+_0x3051cc+'x'+_0xfe9344+_0x72dd9f;}if('error'in _0x163894){const _0x5b33a6=_0x2d8909[_0x3a2b7d(0x1c7)]('[error]\x20\x20');return _0x1e8eb9+'\x20'+_0x5b33a6+':\x20'+_0x163894[_0x3a2b7d(0x1d0)];}return _0x1e8eb9+'\x20'+_0x2d8909[_0x3a2b7d(0x1af)](_0x3a2b7d(0x176))+':\x20'+JSON['stringify'](_0x163894);}async function executeChatHistoryCommand(_0x5d2408,_0x36b6d7){const _0x308e5f=a27_0x1cb5,{options:_0x23eb8a,args:_0x58353b,tdx:_0x7dbf36}=_0x5d2408,_0x4934ca=_0x58353b[0x0],_0x19d172=_0x23eb8a,_0x175b8e=_0x19d172['last'];try{if(_0x175b8e&&_0x4934ca)return console[_0x308e5f(0x1d0)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x308e5f(0x1d0)](_0x308e5f(0x1f7)+_0x36b6d7+'\x20--last'),0x1;if(!_0x4934ca&&!_0x175b8e&&_0x23eb8a[_0x308e5f(0x144)]!==undefined){const _0x45c30d=resolveLimit(_0x23eb8a[_0x308e5f(0x1b6)],DEFAULT_LLM_LIMIT),_0x1f751c=await withSpinner(_0x308e5f(0x14a),()=>_0x7dbf36[_0x308e5f(0x17e)][_0x308e5f(0x1eb)](_0x45c30d),{'verbose':_0x23eb8a[_0x308e5f(0x190)]});return await handleSDKOutput(_0x1f751c['data'],_0x23eb8a),0x0;}const _0x118168=await getChatIdOrSelect(_0x7dbf36,_0x23eb8a,_0x175b8e,_0x4934ca);if(!_0x118168)return 0x0;return await displayChatHistory(_0x118168,_0x7dbf36,_0x23eb8a),0x0;}catch(_0x1c1628){return handleSDKError(_0x1c1628,_0x23eb8a),0x1;}}async function displayChatHistory(_0x394ea8,_0x5536a6,_0x26b202){const _0x4ef1d9=a27_0x1cb5,_0x267de9=await withSpinner(_0x4ef1d9(0x1a7)+_0x394ea8+_0x4ef1d9(0x1d8),()=>_0x5536a6[_0x4ef1d9(0x17e)][_0x4ef1d9(0x163)](_0x394ea8),{'verbose':_0x26b202[_0x4ef1d9(0x190)]}),_0x4fe5cf=_0x267de9['data']['data']??[];if(_0x4fe5cf[_0x4ef1d9(0x1e9)]===0x0){console[_0x4ef1d9(0x203)](_0x4ef1d9(0x1d1));return;}if(_0x26b202[_0x4ef1d9(0x144)]!==undefined)await handleSDKOutput(_0x4fe5cf,_0x26b202);else{const _0x1651ac=_0x4fe5cf[_0x4ef1d9(0x1b1)](_0x4c04de=>formatChatHistoryEntry(_0x4c04de,_0x26b202)),_0x5bd3ae=_0x1651ac['join']('\x0a');await writeOutput(_0x5bd3ae,_0x26b202[_0x4ef1d9(0x197)],_0x4ef1d9(0x152));}}async function getChatIdOrSelect(_0x3a1900,_0x25d4fd,_0x4ab076,_0x35f85c){const _0x58a283=a27_0x1cb5;if(_0x35f85c)return _0x35f85c;if(_0x4ab076){const _0x51eb30=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x3a1900[_0x58a283(0x17e)][_0x58a283(0x1eb)](0x1),{'verbose':_0x25d4fd[_0x58a283(0x190)]});if(_0x51eb30['data'][_0x58a283(0x1e9)]===0x0)return console[_0x58a283(0x203)](_0x58a283(0x135)),undefined;return _0x51eb30[_0x58a283(0x196)][0x0]['id'];}const _0x45de8b=await selectChatInteractively(_0x3a1900,_0x25d4fd);if(!_0x45de8b)return console[_0x58a283(0x203)](_0x58a283(0x1b7)),undefined;return _0x45de8b;}async function getProjectIdOrDefault(_0x39cfe4){const _0x1c4e2a=await getProjectWithName(_0x39cfe4);return _0x1c4e2a['id'];}async function getProjectWithName(_0x3e3773){const _0x276dcc=a27_0x1cb5,{tdx:_0x5db82a,options:_0x3af89d}=_0x3e3773,_0x9cd979=_0x3af89d['llmProject'];if(_0x9cd979){const _0x1e6868=await withSpinner(_0x276dcc(0x18d)+_0x9cd979+_0x276dcc(0x1d8),()=>_0x5db82a[_0x276dcc(0x17e)]['resolveProjectId'](_0x9cd979),{'verbose':_0x3af89d[_0x276dcc(0x190)]});return{'id':_0x1e6868[_0x276dcc(0x196)],'name':_0x9cd979};}const _0x5ee187=_0x5db82a[_0x276dcc(0x17e)][_0x276dcc(0x170)]();if(_0x5ee187){const _0x2a21bf=await _0x5db82a[_0x276dcc(0x17e)][_0x276dcc(0x1d9)](),_0x3f3177=_0x2a21bf[_0x276dcc(0x1be)](_0x1ef1d1=>_0x1ef1d1['id']===_0x5ee187);return{'id':_0x5ee187,'name':_0x3f3177?.[_0x276dcc(0x186)][_0x276dcc(0x20a)]||_0x276dcc(0x145)};}const _0x53a4fc=await withSpinner('Getting\x20default\x20project...',()=>_0x5db82a[_0x276dcc(0x17e)]['getOrCreateDefaultProject'](),{'verbose':_0x3af89d[_0x276dcc(0x190)]});return{'id':_0x53a4fc['data']['id'],'name':_0x53a4fc[_0x276dcc(0x196)]['attributes'][_0x276dcc(0x20a)]};}function toLLMProjectInfo(_0x4f2080){const _0x5a7fba=a27_0x1cb5;return{'name':_0x4f2080[_0x5a7fba(0x186)][_0x5a7fba(0x20a)],'description':_0x4f2080['attributes'][_0x5a7fba(0x1cb)],'createdAt':_0x4f2080['attributes'][_0x5a7fba(0x1d7)],'updatedAt':_0x4f2080[_0x5a7fba(0x186)][_0x5a7fba(0x1a9)]};}function toAgentInfo(_0x10d131){const _0x80a17=a27_0x1cb5;return{'name':_0x10d131['attributes'][_0x80a17(0x20a)],'description':_0x10d131[_0x80a17(0x186)][_0x80a17(0x1cb)],'prompt':truncatePrompt(_0x10d131[_0x80a17(0x186)][_0x80a17(0x12d)]),'createdAt':_0x10d131[_0x80a17(0x186)][_0x80a17(0x1d7)],'updatedAt':_0x10d131[_0x80a17(0x186)][_0x80a17(0x1a9)]};}function truncatePrompt(_0x360527){const _0x2cba32=a27_0x1cb5;if(!_0x360527)return undefined;const _0x2453eb=0x64;if(_0x360527['length']<=_0x2453eb)return _0x360527;return _0x360527[_0x2cba32(0x1c4)](0x0,_0x2453eb)+'...';}export class LLMModelsCommand extends BaseCommand{[a27_0x10790b(0x20a)]=a27_0x10790b(0x158);[a27_0x10790b(0x1cb)]=a27_0x10790b(0x177);async[a27_0x10790b(0x1e4)](_0x22e752){const _0x5eb3aa=a27_0x10790b,{options:_0x2ee08f,tdx:_0x684893}=_0x22e752;try{const _0x2af5b9=await withSpinner(_0x5eb3aa(0x1b4),()=>_0x684893[_0x5eb3aa(0x17e)][_0x5eb3aa(0x151)](),{'verbose':_0x2ee08f[_0x5eb3aa(0x190)]});return await handleSDKOutput(_0x2af5b9[_0x5eb3aa(0x196)],_0x2ee08f),0x0;}catch(_0x1175d0){return handleSDKError(_0x1175d0,_0x2ee08f),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a27_0x10790b(0x20a)]=a27_0x10790b(0x178);[a27_0x10790b(0x1cb)]='List\x20all\x20LLM\x20projects';async[a27_0x10790b(0x1e4)](_0x23692d){const _0x53c7f4=a27_0x10790b,{options:_0x5b0241,args:_0x3f574d,tdx:_0xa514eb}=_0x23692d,_0x2228c2=getChalk(_0x5b0241),_0x4766b8=_0x5b0241[_0x53c7f4(0x143)],_0x199f41=_0x5b0241[_0x53c7f4(0x164)];try{const _0x46c5ac=_0x3f574d[0x0],_0x272450=resolveLimit(_0x5b0241[_0x53c7f4(0x1b6)],DEFAULT_LLM_LIMIT),_0x4e4692=await withSpinner(_0x53c7f4(0x1ad),()=>_0xa514eb[_0x53c7f4(0x17e)][_0x53c7f4(0x1d9)](_0x272450),{'verbose':_0x5b0241['verbose']});let _0x196ecb=_0x4e4692[_0x53c7f4(0x196)];_0x46c5ac&&(_0x196ecb=_0x4e4692[_0x53c7f4(0x196)][_0x53c7f4(0x191)](_0x36a256=>matchGlobPattern(_0x36a256[_0x53c7f4(0x186)][_0x53c7f4(0x20a)],_0x46c5ac)));const _0x212c38=_0x5b0241[_0x53c7f4(0x144)]===_0x53c7f4(0x180)||_0x5b0241[_0x53c7f4(0x144)]==='jsonl'||_0x5b0241[_0x53c7f4(0x144)]===_0x53c7f4(0x152)||_0x5b0241[_0x53c7f4(0x144)]===_0x53c7f4(0x207);if(_0x212c38){const _0x1b90cb=_0x196ecb[_0x53c7f4(0x1b1)](_0x3a80f8=>({...toLLMProjectInfo(_0x3a80f8),..._0x4766b8?{'url':getLLMProjectUrl(_0x199f41,_0x3a80f8['id'])}:{}}));await handleSDKOutput(_0x1b90cb,_0x5b0241);}else{const _0xa23c2b=[];if(_0x196ecb[_0x53c7f4(0x1e9)]===0x0)_0xa23c2b['push'](_0x2228c2['dim'](_0x53c7f4(0x183)));else{const _0x185653=[..._0x196ecb][_0x53c7f4(0x1a1)]((_0x48de57,_0x36198c)=>_0x48de57[_0x53c7f4(0x186)][_0x53c7f4(0x20a)]['localeCompare'](_0x36198c[_0x53c7f4(0x186)][_0x53c7f4(0x20a)]));for(const _0x2ed2a8 of _0x185653){if(_0x4766b8){const _0x1ce095=getLLMProjectUrl(_0x199f41,_0x2ed2a8['id']);_0xa23c2b[_0x53c7f4(0x18c)](_0x53c7f4(0x19b)+_0x2ed2a8['attributes']['name']+'\x20\x20'+_0x2228c2[_0x53c7f4(0x1af)](_0x1ce095));}else _0xa23c2b[_0x53c7f4(0x18c)]('⚒️\x20'+_0x2ed2a8[_0x53c7f4(0x186)][_0x53c7f4(0x20a)]);}_0xa23c2b[_0x53c7f4(0x18c)](_0x2228c2['dim'](_0x196ecb['length']+_0x53c7f4(0x208)));}await writeOutput(_0xa23c2b[_0x53c7f4(0x1b2)]('\x0a'),_0x5b0241[_0x53c7f4(0x197)],_0x53c7f4(0x152));}return 0x0;}catch(_0x1b4ee8){return handleSDKError(_0x1b4ee8,_0x5b0241),0x1;}}}function a27_0x1cb5(_0x661cf5,_0x38550f){_0x661cf5=_0x661cf5-0x12b;const _0x3c05d0=a27_0x3c05();let _0x1cb516=_0x3c05d0[_0x661cf5];return _0x1cb516;}export class LLMAgentsCommand extends BaseCommand{[a27_0x10790b(0x20a)]='llm:agents';[a27_0x10790b(0x1cb)]=a27_0x10790b(0x1ee);async[a27_0x10790b(0x1e4)](_0x288f36){const _0x10687d=a27_0x10790b,{options:_0x54f4c4,args:_0x3baeac,tdx:_0x276e46}=_0x288f36,_0x7e2182=getChalk(_0x54f4c4),_0x268929=_0x54f4c4['web'],_0x546965=_0x54f4c4[_0x10687d(0x164)];try{const _0x25c9b0=_0x3baeac[0x0];let _0x5f5690=_0x25c9b0,_0xf413f4,_0x16db8f;if(_0x25c9b0&&_0x25c9b0[_0x10687d(0x179)]('/')){const _0x144213=_0x25c9b0[_0x10687d(0x19f)]('/');if(_0x144213['length']===0x2){const [_0x2678d9,_0x40fdc4]=_0x144213,_0x33dcbc=await _0x276e46[_0x10687d(0x17e)][_0x10687d(0x1d9)](),_0x5a808c=_0x33dcbc[_0x10687d(0x1be)](_0x3f30fa=>_0x3f30fa['attributes'][_0x10687d(0x20a)][_0x10687d(0x198)]()===_0x2678d9[_0x10687d(0x198)]());if(!_0x5a808c)throw new SDKError(ErrorCode[_0x10687d(0x1bc)],_0x10687d(0x1d2)+_0x2678d9,undefined,{'helpText':_0x10687d(0x147)});_0xf413f4=_0x5a808c['id'],_0x16db8f=_0x5a808c[_0x10687d(0x186)][_0x10687d(0x20a)],_0x5f5690=_0x40fdc4;}else throw new SDKError(ErrorCode[_0x10687d(0x1a6)],_0x10687d(0x171)+_0x25c9b0,undefined,{'helpText':_0x10687d(0x149)});}else{const _0x7f7eed=await getProjectWithName(_0x288f36);_0xf413f4=_0x7f7eed['id'],_0x16db8f=_0x7f7eed[_0x10687d(0x20a)];}const _0x51447e=await withSpinner(_0x10687d(0x175),()=>_0x276e46[_0x10687d(0x17e)][_0x10687d(0x1b5)](_0xf413f4),{'verbose':_0x54f4c4['verbose']});let _0x5b4948=_0x51447e[_0x10687d(0x196)];_0x5f5690&&(_0x5b4948=_0x51447e[_0x10687d(0x196)][_0x10687d(0x191)](_0x249470=>matchGlobPattern(_0x249470['attributes'][_0x10687d(0x20a)],_0x5f5690)));const _0x506c14=_0x54f4c4[_0x10687d(0x144)]==='json'||_0x54f4c4[_0x10687d(0x144)]==='jsonl'||_0x54f4c4[_0x10687d(0x144)]===_0x10687d(0x152)||_0x54f4c4[_0x10687d(0x144)]===_0x10687d(0x207);if(_0x506c14){const _0x7c3eb9=_0x5b4948[_0x10687d(0x1b1)](_0x473bcd=>({...toAgentInfo(_0x473bcd),..._0x268929?{'chatUrl':getLLMAgentChatUrl(_0x546965,_0xf413f4,_0x473bcd['id'])}:{}}));await handleSDKOutput(_0x7c3eb9,_0x54f4c4);}else{const _0x529be0=[];_0x529be0[_0x10687d(0x18c)](_0x7e2182['dim']('['+_0x16db8f+']'));if(_0x5b4948[_0x10687d(0x1e9)]===0x0)_0x529be0[_0x10687d(0x18c)](_0x7e2182[_0x10687d(0x1af)]('No\x20agents\x20found'));else{const _0x1e4671=[..._0x5b4948][_0x10687d(0x1a1)]((_0x44b37f,_0x33394e)=>_0x44b37f[_0x10687d(0x186)][_0x10687d(0x20a)][_0x10687d(0x14e)](_0x33394e['attributes'][_0x10687d(0x20a)]));for(const _0x4de824 of _0x1e4671){if(_0x268929){const _0x1ced12=getLLMAgentChatUrl(_0x546965,_0xf413f4,_0x4de824['id']);_0x529be0[_0x10687d(0x18c)](_0x10687d(0x1ae)+_0x4de824[_0x10687d(0x186)][_0x10687d(0x20a)]+'\x20\x20'+_0x7e2182['dim'](_0x1ced12));}else _0x529be0[_0x10687d(0x18c)](_0x10687d(0x1ae)+_0x4de824['attributes'][_0x10687d(0x20a)]);}_0x529be0[_0x10687d(0x18c)](_0x7e2182[_0x10687d(0x1af)](_0x5b4948[_0x10687d(0x1e9)]+'\x20agent(s)'));}await writeOutput(_0x529be0['join']('\x0a'),_0x54f4c4[_0x10687d(0x197)],'table');}return 0x0;}catch(_0x2b9d68){return handleSDKError(_0x2b9d68,_0x54f4c4),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a27_0x10790b(0x20a)]='llm:agent:show';[a27_0x10790b(0x1cb)]=a27_0x10790b(0x200);async[a27_0x10790b(0x1e4)](_0x58ad57){const _0x53e779=a27_0x10790b,{options:_0x4d48be,args:_0x18adbb,tdx:_0x16241a}=_0x58ad57;if(_0x18adbb[_0x53e779(0x1e9)]===0x0)return console[_0x53e779(0x1d0)](_0x53e779(0x209)),console[_0x53e779(0x1d0)](_0x53e779(0x1a4)),0x1;const _0x11187c=_0x18adbb[0x0];try{const _0x19363=await getProjectIdOrDefault(_0x58ad57),_0xaae282=await withSpinner(_0x53e779(0x206)+_0x11187c+_0x53e779(0x1d8),()=>_0x16241a['llm'][_0x53e779(0x1ab)](_0x11187c,_0x19363),{'verbose':_0x4d48be['verbose']}),_0x117f2c=await withSpinner(_0x53e779(0x20d),()=>_0x16241a['llm'][_0x53e779(0x14b)](_0xaae282[_0x53e779(0x196)]),{'verbose':_0x4d48be[_0x53e779(0x190)]});return await handleSDKOutput([_0x117f2c[_0x53e779(0x196)]],_0x4d48be),0x0;}catch(_0x2e6209){return handleSDKError(_0x2e6209,_0x4d48be),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a27_0x10790b(0x20a)]='llm:agent:create';['description']=a27_0x10790b(0x13c);async[a27_0x10790b(0x1e4)](_0x3cdbe5){const _0x560f60=a27_0x10790b,{options:_0x3c613a,args:_0x4ab8f3,tdx:_0x275945}=_0x3cdbe5;if(_0x4ab8f3[_0x560f60(0x1e9)]===0x0)return console[_0x560f60(0x1d0)](_0x560f60(0x209)),console['error'](_0x560f60(0x181)),console[_0x560f60(0x1d0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]'),0x1;const _0x1c6121=_0x4ab8f3[0x0],_0x48c7e1=_0x3c613a,_0x4151f6=_0x48c7e1[_0x560f60(0x202)],_0xbf2661=_0x48c7e1['model']||_0x560f60(0x154),_0x564bd8=_0x48c7e1[_0x560f60(0x193)],_0x3a0542=_0x48c7e1['maxToolIterations']?Number(_0x48c7e1['maxToolIterations']):undefined,_0x50524f=_0x48c7e1['temperature']?Number(_0x48c7e1[_0x560f60(0x165)]):undefined;try{let _0x1399ad,_0x144f76;if(_0x1c6121['includes']('/')){const _0x575126=_0x1c6121['split']('/');if(_0x575126[_0x560f60(0x1e9)]===0x2){const [_0x5a2aa6,_0x3a03e4]=_0x575126,_0x2c2633=await withSpinner('Resolving\x20project\x20\x27'+_0x5a2aa6+_0x560f60(0x1d8),()=>_0x275945['llm'][_0x560f60(0x17a)](_0x5a2aa6),{'verbose':_0x3c613a[_0x560f60(0x190)]});_0x1399ad=_0x2c2633[_0x560f60(0x196)],_0x144f76=_0x3a03e4;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x560f60(0x171)+_0x1c6121,undefined,{'helpText':_0x560f60(0x149)});}else _0x1399ad=await getProjectIdOrDefault(_0x3cdbe5),_0x144f76=_0x1c6121;const _0x2de267=await withSpinner(_0x560f60(0x1f1)+_0x144f76+_0x560f60(0x1d8),()=>_0x275945['llm'][_0x560f60(0x148)]({'name':_0x144f76,'projectId':_0x1399ad,'modelType':_0xbf2661,'systemPrompt':_0x4151f6,'starterMessage':_0x564bd8,'maxToolIterations':_0x3a0542,'temperature':_0x50524f}),{'verbose':_0x3c613a['verbose']});return console[_0x560f60(0x203)](_0x560f60(0x15e)+_0x2de267['data']['id']),await handleSDKOutput([_0x2de267[_0x560f60(0x196)]],_0x3c613a),0x0;}catch(_0x49bc74){return handleSDKError(_0x49bc74,_0x3c613a),0x1;}}}function a27_0x3c05(){const _0x4e785b=['\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','select','Usage:\x20','Error:\x20Project\x20name\x20is\x20required','\x20\x20\x20Examples:','stringify','stack','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','knowledgeBases','tdx\x20chats','Setting\x20project\x20context\x20to\x20\x27','Show\x20agent\x20details','57IjvNxv','systemPrompt','log','llm:project:restore','tool','Resolving\x20agent\x20\x27','tsv','\x20project(s)','Error:\x20Agent\x20name\x20is\x20required','name','en-US','sourceSite','Fetching\x20agent...','deleteProject','m\x20ago','targetWebSearchTool','prompt','projectName','tdx\x20llm\x20history','entries','Restoring\x20project\x20from\x20\x27','keys','851672QMLeno','\x20\x20Agents:\x20','No\x20chat\x20sessions\x20found.','Analyzing\x20project\x20\x27','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','.llm','7670xXqQcf','[tool_call]','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','Create\x20a\x20new\x20agent\x20in\x20current\x20project','\x20→\x20chat:\x20','Output\x20directory\x20\x27','\x20->\x20ImageGen:','chatId','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','agentId','web','format','Unknown','Checking\x20for\x20existing\x20projects...','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','createAgent','Use\x20format:\x20project-name/agent-name','Fetching\x20chat\x20sessions...','agent','\x20\x20Knowledge\x20Bases:\x20','numeric','localeCompare','magenta','deleteAgent','models','table','substring','claude-4.5-haiku','targetImageGenerator','Set\x20current\x20project\x20context','message','llm:models','Project\x20backed\x20up\x20to:\x20','blue','targetAgent','cyan','Project\x20context\x20set\x20to:\x20','Agent\x20created:\x20','\x20->\x20WebSearch:','Validating\x20backup\x20from\x20\x27','integrations','(no\x20agent)','history','site','temperature','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','firstInputContent','get','Deleting\x20project\x20\x27','Deleting\x20agent...','set','A\x20project\x20named\x20\x27','\x27\x20already\x20exists.\x20Overwrite?','string','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','getCurrentProject','Invalid\x20path\x20syntax:\x20','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','\x20\x20Integrations:\x20','projectId','Fetching\x20agents...','[unknown]','List\x20available\x20LLM\x20models','llm:projects','includes','resolveProjectId','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','llm:use','(no\x20message)','llm','updateAgent','json','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','prompts','No\x20projects\x20found','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','just\x20now','attributes','Restore\x20cancelled.','114885YbjYSr','Project\x20deleted:\x20','475065ftzskg','tool_call','push','Resolving\x20project\x20\x27','llm:agent:delete','h\x20ago','verbose','filter','exportedFrom','starterMessage','cause','getBackupMetadata','data','output','toLowerCase','Project\x20restored:\x20','\x20\x20Prompts:\x20','⚒️\x20','[image]\x20\x20','Load\x20more...','default','split','\x20-\x20','sort','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Creating\x20project\x20\x27','INVALID_ARGUMENT','Fetching\x20chat\x20history\x20for\x20\x27','Error:\x20Backup\x20folder\x20path\x20is\x20required','updatedAt','llm:project:create','resolveAgentId','[input]\x20\x20','Fetching\x20projects...','🤖\x20','dim','Delete\x20an\x20LLM\x20project','map','join','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','Fetching\x20available\x20models...','agents','limit','\x0aCancelled','lastConversationAt','bold','992615uEmzpK','Delete\x20an\x20agent','LLM_PROJECT_NOT_FOUND','createProject','find','831372rKJfjs','Backing\x20up\x20project\x20\x27','Create\x20a\x20new\x20LLM\x20project','jsonl','llm:history','slice','targetKnowledgeBase','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','red','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','counts','Backup\x20cancelled.','description','llm:project:backup','Select\x20a\x20chat\x20session:','d\x20ago','__load_more__','error','No\x20messages\x20found\x20in\x20chat\x20history.','Project\x20not\x20found:\x20','toLocaleDateString','floor','yellow','backupProject','createdAt','\x27...','projects','green','\x20bytes)','7Usxzdp','input','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','image','410FMPDGN','getTime','yes','execute','[output]\x20','content','...','Error:\x20','length','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','chats','772872cmAjSe','outputDir','List\x20agents\x20in\x20current\x20project','short','\x20->\x20Agent:','Creating\x20agent\x20\x27'];a27_0x3c05=function(){return _0x4e785b;};return a27_0x3c05();}export class LLMAgentUpdateCommand extends BaseCommand{[a27_0x10790b(0x20a)]='llm:agent:update';[a27_0x10790b(0x1cb)]='Update\x20an\x20existing\x20agent';async[a27_0x10790b(0x1e4)](_0x1ec111){const _0x2fd026=a27_0x10790b,{options:_0x3ab037,args:_0x4df3fe,tdx:_0x2415f2}=_0x1ec111;if(_0x4df3fe['length']===0x0)return console[_0x2fd026(0x1d0)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x2fd026(0x1d0)](_0x2fd026(0x1f3)),0x1;const _0x27320c=_0x4df3fe[0x0],_0x338062=_0x3ab037,_0x2f08f7=_0x338062[_0x2fd026(0x20a)],_0x312887=_0x338062[_0x2fd026(0x12d)],_0x3bb2ba=_0x338062[_0x2fd026(0x1cb)],_0x52b2b2=_0x338062[_0x2fd026(0x193)];if(!_0x2f08f7&&!_0x312887&&!_0x3bb2ba&&!_0x52b2b2)return console[_0x2fd026(0x1d0)](_0x2fd026(0x1a2)),console[_0x2fd026(0x1d0)](_0x2fd026(0x1a3)),0x1;try{const _0x2b25cd=await getProjectIdOrDefault(_0x1ec111),_0x715f7c=await withSpinner(_0x2fd026(0x206)+_0x27320c+_0x2fd026(0x1d8),()=>_0x2415f2[_0x2fd026(0x17e)]['resolveAgentId'](_0x27320c,_0x2b25cd),{'verbose':_0x3ab037['verbose']}),_0x4f29ac=_0x715f7c['data'],_0x4b27b5=await withSpinner('Updating\x20agent...',()=>_0x2415f2[_0x2fd026(0x17e)][_0x2fd026(0x17f)](_0x4f29ac,{'name':_0x2f08f7,'prompt':_0x312887,'description':_0x3bb2ba,'starterMessage':_0x52b2b2}),{'verbose':_0x3ab037[_0x2fd026(0x190)]});return console[_0x2fd026(0x203)]('Agent\x20updated:\x20'+_0x4b27b5[_0x2fd026(0x196)]['id']),await handleSDKOutput([_0x4b27b5['data']],_0x3ab037),0x0;}catch(_0x14d2c3){return handleSDKError(_0x14d2c3,_0x3ab037),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a27_0x10790b(0x18e);['description']=a27_0x10790b(0x1bb);async[a27_0x10790b(0x1e4)](_0x38c3cc){const _0x305385=a27_0x10790b,{options:_0x5632ba,args:_0x468ed0,tdx:_0x26ba64}=_0x38c3cc;if(_0x468ed0['length']===0x0)return console[_0x305385(0x1d0)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x305385(0x1d0)]('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x3b763a=_0x468ed0[0x0];try{const _0x41d326=await getProjectIdOrDefault(_0x38c3cc),_0x4a42c8=await withSpinner(_0x305385(0x206)+_0x3b763a+'\x27...',()=>_0x26ba64[_0x305385(0x17e)][_0x305385(0x1ab)](_0x3b763a,_0x41d326),{'verbose':_0x5632ba[_0x305385(0x190)]}),_0x451cf0=_0x4a42c8['data'];return await withSpinner(_0x305385(0x16a),()=>_0x26ba64[_0x305385(0x17e)][_0x305385(0x150)](_0x451cf0),{'verbose':_0x5632ba[_0x305385(0x190)]}),console[_0x305385(0x203)]('Agent\x20deleted:\x20'+_0x451cf0),0x0;}catch(_0x19cfef){return handleSDKError(_0x19cfef,_0x5632ba),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a27_0x10790b(0x20a)]=a27_0x10790b(0x1c3);['description']=a27_0x10790b(0x17b);async['execute'](_0x173f4e){const _0xb75615=a27_0x10790b;return executeChatHistoryCommand(_0x173f4e,_0xb75615(0x12f));}}export class LLMUseCommand extends BaseCommand{[a27_0x10790b(0x20a)]=a27_0x10790b(0x17c);[a27_0x10790b(0x1cb)]=a27_0x10790b(0x156);async[a27_0x10790b(0x1e4)](_0x50c418){const _0x600f1b=a27_0x10790b,{options:_0x29b7d7,args:_0x1a88a7,tdx:_0x309d34}=_0x50c418;if(_0x1a88a7[_0x600f1b(0x1e9)]===0x0)return console['error'](_0x600f1b(0x1f8)),console[_0x600f1b(0x1d0)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x50d97e=_0x1a88a7[0x0];try{return await withSpinner(_0x600f1b(0x1ff)+_0x50d97e+_0x600f1b(0x1d8),()=>_0x309d34['llm']['setCurrentProject'](_0x50d97e),{'verbose':_0x29b7d7[_0x600f1b(0x190)]}),console[_0x600f1b(0x203)](_0x600f1b(0x15d)+_0x50d97e),0x0;}catch(_0x502173){return handleSDKError(_0x502173,_0x29b7d7),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{['name']=a27_0x10790b(0x1aa);[a27_0x10790b(0x1cb)]=a27_0x10790b(0x1c1);async[a27_0x10790b(0x1e4)](_0x267086){const _0x21c2c2=a27_0x10790b,{options:_0x4652e6,args:_0x17435d,tdx:_0x20848c}=_0x267086;if(_0x17435d[_0x21c2c2(0x1e9)]===0x0)return console[_0x21c2c2(0x1d0)](_0x21c2c2(0x1f8)),console[_0x21c2c2(0x1d0)](_0x21c2c2(0x137)),0x1;const _0x11ba02=_0x17435d[0x0],_0xcecb5f=_0x4652e6,_0x5deca8=_0xcecb5f[_0x21c2c2(0x1cb)];try{const _0x511ecc=await withSpinner(_0x21c2c2(0x1a5)+_0x11ba02+_0x21c2c2(0x1d8),()=>_0x20848c[_0x21c2c2(0x17e)][_0x21c2c2(0x1bd)]({'name':_0x11ba02,'description':_0x5deca8}),{'verbose':_0x4652e6[_0x21c2c2(0x190)]});console[_0x21c2c2(0x203)]('Project\x20created:\x20'+_0x511ecc[_0x21c2c2(0x196)]['id']);const _0x5de622=toLLMProjectInfo(_0x511ecc['data']);return await handleSDKOutput([_0x5de622],_0x4652e6),0x0;}catch(_0x2255da){return handleSDKError(_0x2255da,_0x4652e6),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a27_0x10790b(0x20a)]='llm:project:delete';[a27_0x10790b(0x1cb)]=a27_0x10790b(0x1b0);async[a27_0x10790b(0x1e4)](_0x1d42c1){const _0x297594=a27_0x10790b,{options:_0x4912fe,args:_0x54c574,tdx:_0x508a29}=_0x1d42c1;if(_0x54c574[_0x297594(0x1e9)]===0x0)return console[_0x297594(0x1d0)](_0x297594(0x1f8)),console[_0x297594(0x1d0)](_0x297594(0x1c8)),0x1;const _0x18cc1f=_0x54c574[0x0];try{return await withSpinner(_0x297594(0x169)+_0x18cc1f+'\x27...',()=>_0x508a29[_0x297594(0x17e)][_0x297594(0x20e)](_0x18cc1f),{'verbose':_0x4912fe[_0x297594(0x190)]}),console[_0x297594(0x203)](_0x297594(0x189)+_0x18cc1f),0x0;}catch(_0x5bdf5f){return handleSDKError(_0x5bdf5f,_0x4912fe),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a27_0x10790b(0x20a)]=a27_0x10790b(0x1cc);[a27_0x10790b(0x1cb)]=a27_0x10790b(0x1b3);async[a27_0x10790b(0x1e4)](_0x2c2c37){const _0x2a81da=a27_0x10790b,{options:_0x23e372,args:_0x3f77cd,tdx:_0x2f5780}=_0x2c2c37,_0x4c05db=getChalk(_0x23e372);console[_0x2a81da(0x203)](_0x4c05db[_0x2a81da(0x1d5)](_0x2a81da(0x172))),console[_0x2a81da(0x203)](_0x4c05db[_0x2a81da(0x1d5)](_0x2a81da(0x1f5))),console[_0x2a81da(0x203)](_0x4c05db[_0x2a81da(0x1af)]('\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents')),console[_0x2a81da(0x203)]();if(_0x3f77cd[_0x2a81da(0x1e9)]===0x0)return console[_0x2a81da(0x1d0)](_0x2a81da(0x1f8)),console[_0x2a81da(0x1d0)](_0x2a81da(0x141)),0x1;const _0x4b4c1b=_0x3f77cd[0x0],_0x31482f=_0x23e372,_0x368885=_0x31482f[_0x2a81da(0x197)],_0x48be78=_0x31482f['dryRun'];try{const _0x28267a=_0x368885||_0x4b4c1b+_0x2a81da(0x138);if(a27_0x181393['existsSync'](_0x28267a)&&!_0x48be78){if(!_0x23e372[_0x2a81da(0x1e3)]){const _0x5d966b=await confirm(_0x2a81da(0x13e)+_0x28267a+_0x2a81da(0x16d));if(!_0x5d966b)return console[_0x2a81da(0x203)](_0x2a81da(0x1ca)),0x0;}a27_0x181393['rmSync'](_0x28267a,{'recursive':!![]});}const _0x22c3e4=await withSpinner(_0x48be78?_0x2a81da(0x136)+_0x4b4c1b+_0x2a81da(0x1d8):_0x2a81da(0x1c0)+_0x4b4c1b+'\x27...',()=>_0x2f5780[_0x2a81da(0x17e)][_0x2a81da(0x1d6)](_0x4b4c1b,_0x368885,{'dryRun':_0x48be78}),{'verbose':_0x23e372[_0x2a81da(0x190)]}),_0x3d8b33=_0x22c3e4[_0x2a81da(0x196)];return _0x48be78?console['log'](_0x2a81da(0x1fc)+_0x3d8b33[_0x2a81da(0x1ed)]):console['log'](_0x2a81da(0x159)+_0x3d8b33[_0x2a81da(0x1ed)]),console['log'](_0x2a81da(0x134)+_0x3d8b33[_0x2a81da(0x1c9)][_0x2a81da(0x1b5)]),console[_0x2a81da(0x203)](_0x2a81da(0x14c)+_0x3d8b33['counts'][_0x2a81da(0x1fd)]),console[_0x2a81da(0x203)]('\x20\x20Prompts:\x20'+_0x3d8b33[_0x2a81da(0x1c9)]['prompts']),console[_0x2a81da(0x203)](_0x2a81da(0x173)+_0x3d8b33['counts'][_0x2a81da(0x161)]),(_0x23e372[_0x2a81da(0x144)]===_0x2a81da(0x180)||_0x23e372[_0x2a81da(0x144)]===_0x2a81da(0x1c2))&&await handleSDKOutput([_0x3d8b33],_0x23e372),0x0;}catch(_0x33946a){return handleSDKError(_0x33946a,_0x23e372),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a27_0x10790b(0x20a)]=a27_0x10790b(0x204);[a27_0x10790b(0x1cb)]=a27_0x10790b(0x166);async[a27_0x10790b(0x1e4)](_0x5a27e0){const _0xa02623=a27_0x10790b,{options:_0x13de80,args:_0x46dc5c,tdx:_0x227cd7}=_0x5a27e0,_0x5ae15f=getChalk(_0x13de80);console[_0xa02623(0x203)](_0x5ae15f[_0xa02623(0x1d5)](_0xa02623(0x1ea))),console['log'](_0x5ae15f[_0xa02623(0x1d5)](_0xa02623(0x1f4))),console[_0xa02623(0x203)](_0x5ae15f[_0xa02623(0x1af)](_0xa02623(0x1f9))),console['log'](_0x5ae15f[_0xa02623(0x1af)](_0xa02623(0x13b))),console[_0xa02623(0x203)](_0x5ae15f['dim'](_0xa02623(0x16f))),console[_0xa02623(0x203)]();if(_0x46dc5c[_0xa02623(0x1e9)]===0x0)return console[_0xa02623(0x1d0)](_0xa02623(0x1a8)),console[_0xa02623(0x1d0)](_0xa02623(0x1c6)),0x1;const _0xd30c9b=_0x46dc5c[0x0],_0x4f6b87=_0x13de80,_0x4c6805=_0x4f6b87['name'],_0x51eed7=_0x4f6b87['dryRun'];try{if(!_0x51eed7){const _0x28c732=_0x227cd7[_0xa02623(0x17e)][_0xa02623(0x195)](_0xd30c9b),_0x1baf04=_0x4c6805||_0x28c732[_0xa02623(0x192)][_0xa02623(0x12e)],_0x30450a=await withSpinner(_0xa02623(0x146),()=>_0x227cd7[_0xa02623(0x17e)][_0xa02623(0x1d9)](),{'verbose':_0x13de80[_0xa02623(0x190)]}),_0x4efa77=_0x30450a[_0xa02623(0x196)][_0xa02623(0x1be)](_0x3fe860=>_0x3fe860[_0xa02623(0x186)][_0xa02623(0x20a)]===_0x1baf04);if(_0x4efa77&&!_0x13de80['yes']){const _0x2ea47a=await confirm(_0xa02623(0x16c)+_0x1baf04+_0xa02623(0x1f2));if(!_0x2ea47a)return console[_0xa02623(0x203)](_0xa02623(0x187)),0x0;}}const _0x58e2ce=await withSpinner(_0x51eed7?_0xa02623(0x160)+_0xd30c9b+_0xa02623(0x1d8):_0xa02623(0x131)+_0xd30c9b+_0xa02623(0x1d8),()=>_0x227cd7[_0xa02623(0x17e)]['restoreProject'](_0xd30c9b,{'name':_0x4c6805,'dryRun':_0x51eed7}),{'verbose':_0x13de80[_0xa02623(0x190)]}),_0x11f5d0=_0x58e2ce[_0xa02623(0x196)];return _0x11f5d0[_0xa02623(0x20c)]&&console[_0xa02623(0x203)](_0xa02623(0x184)+_0x11f5d0[_0xa02623(0x20c)]+'\x27'),_0x51eed7?console[_0xa02623(0x203)](_0xa02623(0x1de)+_0x11f5d0[_0xa02623(0x12e)]):console['log'](_0xa02623(0x199)+_0x11f5d0[_0xa02623(0x12e)]+'\x20('+_0x11f5d0[_0xa02623(0x174)]+')'),console[_0xa02623(0x203)]('\x20\x20Agents:\x20'+_0x11f5d0[_0xa02623(0x1c9)]['agents']),console[_0xa02623(0x203)](_0xa02623(0x14c)+_0x11f5d0[_0xa02623(0x1c9)][_0xa02623(0x1fd)]),console['log'](_0xa02623(0x19a)+_0x11f5d0[_0xa02623(0x1c9)][_0xa02623(0x182)]),console['log'](_0xa02623(0x173)+_0x11f5d0['counts'][_0xa02623(0x161)]),(_0x13de80['format']===_0xa02623(0x180)||_0x13de80[_0xa02623(0x144)]===_0xa02623(0x1c2))&&await handleSDKOutput([_0x11f5d0],_0x13de80),0x0;}catch(_0x28a799){return handleSDKError(_0x28a799,_0x13de80),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x507e4c,_0x5f06f3){const _0x95e39c=a27_0x10790b,_0xbe736a=_0x5f06f3[_0x95e39c(0x1b6)]||CHAT_SELECTOR_PAGE_SIZE;let _0x3e46ac=0x0,_0x3188de=[];const _0x29c2f2=(await import(_0x95e39c(0x182)))[_0x95e39c(0x19e)],_0x412556=getChalk(_0x5f06f3);while(!![]){const _0x41824b=await withSpinner(_0x95e39c(0x14a),()=>_0x507e4c[_0x95e39c(0x17e)][_0x95e39c(0x1eb)](_0xbe736a+_0x3e46ac),{'verbose':_0x5f06f3[_0x95e39c(0x190)]});_0x3188de=_0x41824b[_0x95e39c(0x196)];const _0x1302fc=_0x3188de['slice'](_0x3e46ac,_0x3e46ac+_0xbe736a),_0x1b43f4=_0x3188de[_0x95e39c(0x1e9)]>_0x3e46ac+_0xbe736a,_0x2f9ee4=[...new Set(_0x1302fc['map'](_0x257dff=>_0x257dff[_0x95e39c(0x186)][_0x95e39c(0x142)])[_0x95e39c(0x191)](_0x294204=>_0x294204!==undefined))],_0x217747=new Map();await Promise['all'](_0x2f9ee4[_0x95e39c(0x1b1)](async _0x2f646f=>{const _0x4c7f9f=_0x95e39c;try{const _0x1c8dcd=await _0x507e4c[_0x4c7f9f(0x17e)][_0x4c7f9f(0x14b)](_0x2f646f);_0x217747[_0x4c7f9f(0x16b)](_0x2f646f,_0x1c8dcd[_0x4c7f9f(0x186)]['name']);}catch{_0x217747[_0x4c7f9f(0x16b)](_0x2f646f,_0x2f646f);}}));const _0x65935d=_0x1302fc[_0x95e39c(0x1b1)](_0x3630d2=>{const _0x4f56f6=_0x95e39c,_0x19e3a5=_0x3630d2[_0x4f56f6(0x186)][_0x4f56f6(0x167)]||_0x4f56f6(0x17d),_0x17111f=_0x19e3a5[_0x4f56f6(0x19f)]('\x0a')[0x0],_0x1a5ded=_0x17111f[_0x4f56f6(0x1e9)]>0x50?_0x17111f[_0x4f56f6(0x153)](0x0,0x4d)+_0x4f56f6(0x1e7):_0x17111f,_0xea151d=_0x3630d2[_0x4f56f6(0x186)][_0x4f56f6(0x142)]?_0x217747[_0x4f56f6(0x168)](_0x3630d2['attributes'][_0x4f56f6(0x142)])||_0x3630d2[_0x4f56f6(0x186)][_0x4f56f6(0x142)]:_0x4f56f6(0x162),_0x31c4fe=_0x3630d2['attributes'][_0x4f56f6(0x1b8)]||_0x3630d2[_0x4f56f6(0x186)][_0x4f56f6(0x1a9)],_0x378d63=new Date(_0x31c4fe),_0xa00dc5=new Date(),_0x251193=_0xa00dc5[_0x4f56f6(0x1e2)]()-_0x378d63['getTime'](),_0x24de00=Math[_0x4f56f6(0x1d4)](_0x251193/0xea60),_0x46e915=Math[_0x4f56f6(0x1d4)](_0x251193/0x36ee80),_0x1749fd=Math[_0x4f56f6(0x1d4)](_0x251193/0x5265c00);let _0x580b5c;if(_0x24de00<0x1)_0x580b5c=_0x4f56f6(0x185);else{if(_0x24de00<0x3c)_0x580b5c=_0x24de00+_0x4f56f6(0x12b);else{if(_0x46e915<0x18)_0x580b5c=_0x46e915+_0x4f56f6(0x18f);else _0x1749fd<0x7?_0x580b5c=_0x1749fd+_0x4f56f6(0x1ce):_0x580b5c=_0x378d63[_0x4f56f6(0x1d3)](_0x4f56f6(0x20b),{'month':_0x4f56f6(0x1ef),'day':_0x4f56f6(0x14d)});}}return{'title':_0x1a5ded+'\x20'+_0x412556['dim']('['+_0xea151d+']\x20'+_0x580b5c),'value':_0x3630d2['id']};});_0x1b43f4&&_0x65935d['push']({'title':_0x412556[_0x95e39c(0x15c)](_0x95e39c(0x19d)),'value':_0x95e39c(0x1cf)});const _0x370bf5=await _0x29c2f2({'type':_0x95e39c(0x1f6),'name':_0x95e39c(0x140),'message':_0x95e39c(0x1cd),'choices':_0x65935d,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x370bf5['chatId'])return undefined;if(_0x370bf5[_0x95e39c(0x140)]==='__load_more__'){_0x3e46ac+=_0xbe736a;continue;}return _0x370bf5[_0x95e39c(0x140)];}}export class ChatsCommand extends BaseCommand{[a27_0x10790b(0x20a)]=a27_0x10790b(0x1eb);[a27_0x10790b(0x1cb)]=a27_0x10790b(0x1df);async[a27_0x10790b(0x1e4)](_0x52d87d){const _0x5e11c7=a27_0x10790b;return executeChatHistoryCommand(_0x52d87d,_0x5e11c7(0x1fe));}}
@@ -1 +1 @@
1
- const a28_0x256e25=a28_0x4434;function a28_0x191f(){const _0xc2cdf3=['stop','logger','SIGTERM','execute','529683OuBWCE','\x20\x20}','http://0.0.0.0:','init','5729640taJJrM','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','green','bold','close','project','white','description','34549191QdQjWy','cyan','llm:proxy','Project\x20\x27','log','\x0aTesting\x20with\x20Agent\x20SDK:','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','1290ioXghi','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','server','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','start','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','logLevel','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','exit','\x20\x20Address:','Server\x20Configuration:','\x20\x20Site:','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20\x20\x20}','Port\x20','Starting\x20proxy\x20server...','yellow','\x20\x20Agents:','11377289qTmIKI','4AABRPV','find','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','name','llm','2838232swKsSx','\x20is\x20unavailable,\x20using\x20port\x20','\x20\x20Project:','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','getOrCreateDefaultProject','dim','195955WlNcJV','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x0aClaude\x20Code\x20Configuration:','\x20\x20{','projects','\x27\x20not\x20found','attributes','17928qkjnvO'];a28_0x191f=function(){return _0xc2cdf3;};return a28_0x191f();}(function(_0x37e63a,_0x4c19e1){const _0x4a33bf=a28_0x4434,_0x39983c=_0x37e63a();while(!![]){try{const _0x14ee60=parseInt(_0x4a33bf(0x191))/0x1+-parseInt(_0x4a33bf(0x18b))/0x2+-parseInt(_0x4a33bf(0x19e))/0x3*(parseInt(_0x4a33bf(0x186))/0x4)+-parseInt(_0x4a33bf(0x172))/0x5*(-parseInt(_0x4a33bf(0x199))/0x6)+-parseInt(_0x4a33bf(0x185))/0x7+-parseInt(_0x4a33bf(0x1a2))/0x8+parseInt(_0x4a33bf(0x1aa))/0x9;if(_0x14ee60===_0x4c19e1)break;else _0x39983c['push'](_0x39983c['shift']());}catch(_0x5301c8){_0x39983c['push'](_0x39983c['shift']());}}}(a28_0x191f,0xd4061));function a28_0x4434(_0x54853c,_0x25ef79){_0x54853c=_0x54853c-0x171;const _0x191ffb=a28_0x191f();let _0x4434c0=_0x191ffb[_0x54853c];return _0x4434c0;}import a28_0x4d7189 from'chalk';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(_0x225455,_0x3ddefb){const _0x8a6dd7=a28_0x4434,{tdx:_0x101ba8,options:_0xa16f1e}=_0x225455,_0x2b7bcc=_0x3ddefb||_0xa16f1e['llmProject'];if(_0x2b7bcc){const _0xd79c3=await _0x101ba8[_0x8a6dd7(0x18a)][_0x8a6dd7(0x196)](),_0x4e831f=_0xd79c3[_0x8a6dd7(0x187)](_0x479095=>_0x479095[_0x8a6dd7(0x198)][_0x8a6dd7(0x189)]===_0x2b7bcc);if(!_0x4e831f)throw new SDKError(ErrorCode['NOT_FOUND'],_0x8a6dd7(0x1ad)+_0x2b7bcc+_0x8a6dd7(0x197),undefined,{'helpText':_0x8a6dd7(0x173)});return _0x4e831f['id'];}const _0x1e55d0=await _0x101ba8[_0x8a6dd7(0x18a)][_0x8a6dd7(0x18f)]();return _0x1e55d0['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x256e25(0x189)]=a28_0x256e25(0x1ac);[a28_0x256e25(0x1a9)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';['server'];[a28_0x256e25(0x19b)];async[a28_0x256e25(0x19d)](_0xaa63f4){const _0x5014b3=a28_0x256e25,{tdx:_0x151fec,options:_0x4ce806}=_0xaa63f4;try{const _0x7fb253=_0x4ce806,_0x41341d=_0x7fb253['port']||0xfa0,_0x320802=_0x7fb253[_0x5014b3(0x1a7)],_0x347ec3=await findAvailablePort(_0x41341d);console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)]('Resolving\x20project...'));const _0xdbe0a=await getProjectIdOrDefault(_0xaa63f4,_0x320802),_0x2f5d09=await _0x151fec[_0x5014b3(0x18a)][_0x5014b3(0x196)](),_0x19d0eb=_0x2f5d09['find'](_0x517251=>_0x517251['id']===_0xdbe0a);this[_0x5014b3(0x19b)]=new TDXLogger(_0x4ce806[_0x5014b3(0x179)]),await this[_0x5014b3(0x19b)][_0x5014b3(0x1a1)](),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x182)));_0x347ec3!==_0x41341d&&console['log'](a28_0x4d7189[_0x5014b3(0x183)](_0x5014b3(0x181)+_0x41341d+_0x5014b3(0x18c)+_0x347ec3));this[_0x5014b3(0x174)]=new ProxyServer({'port':_0x347ec3,'projectId':_0xdbe0a,'tdx':_0x151fec,'logger':this[_0x5014b3(0x19b)],'site':_0x4ce806['site']}),await this['server'][_0x5014b3(0x176)](),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x183)][_0x5014b3(0x1a5)]('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console['log'](a28_0x4d7189['yellow'](_0x5014b3(0x178))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x183)](_0x5014b3(0x17a))),console[_0x5014b3(0x1ae)](a28_0x4d7189['green'][_0x5014b3(0x1a5)](_0x5014b3(0x175))),console['log'](a28_0x4d7189['cyan'](_0x5014b3(0x17d))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x17c)),a28_0x4d7189['white'](_0x5014b3(0x1a0)+_0x347ec3)),console['log'](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x18d)),a28_0x4d7189['white'](_0x19d0eb?.[_0x5014b3(0x198)][_0x5014b3(0x189)]||_0xdbe0a)),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x184)),a28_0x4d7189[_0x5014b3(0x1a8)]('created\x20on-demand\x20per\x20model')),console['log'](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x17e)),a28_0x4d7189[_0x5014b3(0x1a8)](_0x4ce806['site'])),console['log'](a28_0x4d7189['cyan'](_0x5014b3(0x194))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)](_0x5014b3(0x18e))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x195))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x17f))),console['log'](a28_0x4d7189['white'](_0x5014b3(0x192)+_0x347ec3+'\x22,')),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x188))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x177))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x180))),console['log'](a28_0x4d7189[_0x5014b3(0x1a8)](_0x5014b3(0x19f))),console['log'](a28_0x4d7189[_0x5014b3(0x1ab)](_0x5014b3(0x1af))),console[_0x5014b3(0x1ae)](a28_0x4d7189['dim'](_0x5014b3(0x1a3))),console[_0x5014b3(0x1ae)](a28_0x4d7189[_0x5014b3(0x190)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x5014b3(0x1ae)](a28_0x4d7189['dim']('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console['log'](a28_0x4d7189[_0x5014b3(0x183)](_0x5014b3(0x171)));const _0x1b8439=async()=>{const _0x2f62ed=_0x5014b3;console[_0x2f62ed(0x1ae)](a28_0x4d7189[_0x2f62ed(0x190)](_0x2f62ed(0x193))),this[_0x2f62ed(0x174)]&&await this['server'][_0x2f62ed(0x19a)](),this['logger']&&await this[_0x2f62ed(0x19b)]['close'](),console['log'](a28_0x4d7189[_0x2f62ed(0x1a4)]('✓\x20Proxy\x20server\x20stopped')),process[_0x2f62ed(0x17b)](0x0);};return process['on']('SIGINT',_0x1b8439),process['on'](_0x5014b3(0x19c),_0x1b8439),await new Promise(()=>{}),0x0;}catch(_0xb5713d){this['server']&&await this[_0x5014b3(0x174)][_0x5014b3(0x19a)]();this['logger']&&await this[_0x5014b3(0x19b)][_0x5014b3(0x1a6)]();throw _0xb5713d;}}}
1
+ function a28_0x1bc9(_0x3c1e60,_0x1237a1){_0x3c1e60=_0x3c1e60-0x103;const _0x862602=a28_0x8626();let _0x1bc9d5=_0x862602[_0x3c1e60];return _0x1bc9d5;}const a28_0x134254=a28_0x1bc9;(function(_0x129e45,_0x15ef98){const _0x3fdf0e=a28_0x1bc9,_0x3f6a8b=_0x129e45();while(!![]){try{const _0x5d5d42=-parseInt(_0x3fdf0e(0x106))/0x1+-parseInt(_0x3fdf0e(0x13e))/0x2+-parseInt(_0x3fdf0e(0x129))/0x3*(parseInt(_0x3fdf0e(0x113))/0x4)+-parseInt(_0x3fdf0e(0x13d))/0x5*(-parseInt(_0x3fdf0e(0x121))/0x6)+parseInt(_0x3fdf0e(0x10c))/0x7+parseInt(_0x3fdf0e(0x11f))/0x8+parseInt(_0x3fdf0e(0x105))/0x9;if(_0x5d5d42===_0x15ef98)break;else _0x3f6a8b['push'](_0x3f6a8b['shift']());}catch(_0x399899){_0x3f6a8b['push'](_0x3f6a8b['shift']());}}}(a28_0x8626,0xbdf44));function a28_0x8626(){const _0x1bc159=['Port\x20','site','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','5iIiodS','2873906axTRnK','attributes','start','Server\x20Configuration:','logger','projects','cyan','\x0aTesting\x20with\x20Agent\x20SDK:','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','Starting\x20proxy\x20server...','15018183nZcmke','133903pbECeq','created\x20on-demand\x20per\x20model','dim','SIGTERM','\x20is\x20unavailable,\x20using\x20port\x20','SIGINT','2682204OQHfQO','find','white','\x20\x20\x20\x20\x22env\x22:\x20{','log','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','1948gZWdAU','llm','name','http://0.0.0.0:','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','stop','description','Project\x20\x27','\x20\x20Project:','logLevel','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','server','8363288dIbyJD','exit','2543082cKTeDQ','\x20\x20Address:','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x0a\x0aShutting\x20down\x20proxy\x20server...','execute','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','\x20\x20Site:','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','7221qgPYHE','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','yellow','\x0aClaude\x20Code\x20Configuration:','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','llm:proxy','\x20\x20\x20\x20}','close','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','bold','✓\x20Proxy\x20server\x20stopped','init','\x20\x20Agents:','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','Resolving\x20project...','\x27\x20not\x20found','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.'];a28_0x8626=function(){return _0x1bc159;};return a28_0x8626();}import a28_0x5734ed from'chalk';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(_0x33d3f6,_0x4e02ad){const _0xceff50=a28_0x1bc9,{tdx:_0x474bc5,options:_0x23ba11}=_0x33d3f6,_0x44f9ba=_0x4e02ad||_0x23ba11['llmProject'];if(_0x44f9ba){const _0x5db379=await _0x474bc5[_0xceff50(0x114)][_0xceff50(0x143)](),_0x251381=_0x5db379[_0xceff50(0x10d)](_0x4558a9=>_0x4558a9[_0xceff50(0x13f)]['name']===_0x44f9ba);if(!_0x251381)throw new SDKError(ErrorCode['NOT_FOUND'],_0xceff50(0x11a)+_0x44f9ba+_0xceff50(0x138),undefined,{'helpText':_0xceff50(0x11d)});return _0x251381['id'];}const _0x5452bc=await _0x474bc5[_0xceff50(0x114)]['getOrCreateDefaultProject']();return _0x5452bc['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x134254(0x115)]=a28_0x134254(0x12e);[a28_0x134254(0x119)]=a28_0x134254(0x126);[a28_0x134254(0x11e)];['logger'];async[a28_0x134254(0x125)](_0x46e0a3){const _0x5b4f35=a28_0x134254,{tdx:_0x1d2249,options:_0x36ad05}=_0x46e0a3;try{const _0x1f312e=_0x36ad05,_0x1451d2=_0x1f312e['port']||0xfa0,_0x47ab8f=_0x1f312e['project'],_0x36973d=await findAvailablePort(_0x1451d2);console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x137)));const _0x350db5=await getProjectIdOrDefault(_0x46e0a3,_0x47ab8f),_0xa99073=await _0x1d2249[_0x5b4f35(0x114)][_0x5b4f35(0x143)](),_0x22cf0b=_0xa99073[_0x5b4f35(0x10d)](_0x1aa752=>_0x1aa752['id']===_0x350db5);this[_0x5b4f35(0x142)]=new TDXLogger(_0x36ad05[_0x5b4f35(0x11c)]),await this[_0x5b4f35(0x142)][_0x5b4f35(0x134)](),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x104)));_0x36973d!==_0x1451d2&&console[_0x5b4f35(0x110)](a28_0x5734ed['yellow'](_0x5b4f35(0x13a)+_0x1451d2+_0x5b4f35(0x10a)+_0x36973d));this['server']=new ProxyServer({'port':_0x36973d,'projectId':_0x350db5,'tdx':_0x1d2249,'logger':this[_0x5b4f35(0x142)],'site':_0x36ad05['site']}),await this[_0x5b4f35(0x11e)][_0x5b4f35(0x140)](),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x12b)][_0x5b4f35(0x132)](_0x5b4f35(0x117))),console['log'](a28_0x5734ed[_0x5b4f35(0x12b)](_0x5b4f35(0x139))),console['log'](a28_0x5734ed['yellow'](_0x5b4f35(0x128))),console[_0x5b4f35(0x110)](a28_0x5734ed['green'][_0x5b4f35(0x132)](_0x5b4f35(0x12d))),console['log'](a28_0x5734ed['cyan'](_0x5b4f35(0x141))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x122)),a28_0x5734ed['white'](_0x5b4f35(0x116)+_0x36973d)),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x11b)),a28_0x5734ed[_0x5b4f35(0x10e)](_0x22cf0b?.[_0x5b4f35(0x13f)][_0x5b4f35(0x115)]||_0x350db5)),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x135)),a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x107))),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x127)),a28_0x5734ed[_0x5b4f35(0x10e)](_0x36ad05[_0x5b4f35(0x13b)])),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x144)](_0x5b4f35(0x12c))),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x123))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)]('\x20\x20{')),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x10f))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x13c)+_0x36973d+'\x22,')),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x103))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x131))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x10e)](_0x5b4f35(0x12f))),console['log'](a28_0x5734ed[_0x5b4f35(0x10e)]('\x20\x20}')),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x144)](_0x5b4f35(0x145))),console[_0x5b4f35(0x110)](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x111))),console['log'](a28_0x5734ed[_0x5b4f35(0x108)](_0x5b4f35(0x136))),console[_0x5b4f35(0x110)](a28_0x5734ed['dim'](_0x5b4f35(0x12a))),console[_0x5b4f35(0x110)](a28_0x5734ed['yellow'](_0x5b4f35(0x112)));const _0x1f28db=async()=>{const _0xc4e4b3=_0x5b4f35;console[_0xc4e4b3(0x110)](a28_0x5734ed['dim'](_0xc4e4b3(0x124))),this[_0xc4e4b3(0x11e)]&&await this[_0xc4e4b3(0x11e)][_0xc4e4b3(0x118)](),this[_0xc4e4b3(0x142)]&&await this[_0xc4e4b3(0x142)]['close'](),console[_0xc4e4b3(0x110)](a28_0x5734ed['green'](_0xc4e4b3(0x133))),process[_0xc4e4b3(0x120)](0x0);};return process['on'](_0x5b4f35(0x10b),_0x1f28db),process['on'](_0x5b4f35(0x109),_0x1f28db),await new Promise(()=>{}),0x0;}catch(_0x45c225){this[_0x5b4f35(0x11e)]&&await this[_0x5b4f35(0x11e)]['stop']();this[_0x5b4f35(0x142)]&&await this[_0x5b4f35(0x142)][_0x5b4f35(0x130)]();throw _0x45c225;}}}
@@ -1 +1 @@
1
- const a29_0x3f507c=a29_0x3897;(function(_0x59c5a3,_0x378e39){const _0x3eb1bc=a29_0x3897,_0x2f14c3=_0x59c5a3();while(!![]){try{const _0x36ee62=-parseInt(_0x3eb1bc(0x1d8))/0x1*(parseInt(_0x3eb1bc(0x1fe))/0x2)+-parseInt(_0x3eb1bc(0x21d))/0x3+-parseInt(_0x3eb1bc(0x1e5))/0x4*(parseInt(_0x3eb1bc(0x183))/0x5)+parseInt(_0x3eb1bc(0x1ac))/0x6+parseInt(_0x3eb1bc(0x1aa))/0x7*(parseInt(_0x3eb1bc(0x229))/0x8)+parseInt(_0x3eb1bc(0x1d1))/0x9*(-parseInt(_0x3eb1bc(0x17e))/0xa)+-parseInt(_0x3eb1bc(0x20b))/0xb*(-parseInt(_0x3eb1bc(0x1bb))/0xc);if(_0x36ee62===_0x378e39)break;else _0x2f14c3['push'](_0x2f14c3['shift']());}catch(_0x161064){_0x2f14c3['push'](_0x2f14c3['shift']());}}}(a29_0x1555,0xe96a6));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x367ebb from'path';import{BaseCommand}from'./command.js';function a29_0x1555(){const _0x4432dc=['parentSegment','.yaml','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','/{name}.yml\x0a','run','displayPreviewHints','SQL\x20query:\x0a','✔\x20No\x20changes\x20-\x20\x27','getParentFull','Get\x20SQL\x20query\x20for\x20parent\x20segment','displaySampleData','rowCount','31404dmzncP','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Events:','\x20--behavior\x20\x22<name>\x22','darwin','green','segment:parent:view','\x20=\x20','database','Apply\x20changes\x20to\x20\x27','pullParentYaml','toLocaleString','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','double','Listing\x20fields\x20for\x20\x27','Session:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','addBehaviors','\x5c$&','scheduleOption','Options:','1244331mCWJsZ','dim','attributesFile','Preview:','customersWithEvents','Join\x20on:','json','2680EBvaRE','matchedCount','format','yes','/\x20and\x20','column','web','%)\x20','segment:parent:sql','Resolving\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','site','-1d','49372gqhpmx','jobId','\x0a⚠️\x20\x20Both\x20','behaviors','Errors:','sampleData','Validate:','error','Options:\x0a','segment:parent:validate','Validating\x20configuration...','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x0aNo\x20sample\x20data\x20available','Updated','Available\x20attributes:','Updating\x20parent\x20segment\x20\x27','match','red','schemaError','start','resolveParentId','List\x20available\x20fields\x20for\x20segmentation','dirname','\x20is\x20already\x20up\x20to\x20date','\x20parent\x20segment','644ppFonO','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Source:','createParent','replace','\x0a✔\x20Workflow\x20started','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Enriched:','master','Attribute:','✔\x20Query\x20completed:\x20Processed\x20','Create\x20parent\x20segment\x20\x27','stop','11561rxfNBZ','foreignKey','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','message','Show\x20parent\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Attempt:','listParents','✘\x20Failed\x20to\x20rename\x20directory:\x20','test','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Updating','xdg-open','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20--behavior\x20\x22','validateParentYaml','elapsedTimeMillis','verbose','4036176vFvqka','data','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Created','\x20Context\x20set:\x20','segment:parent:list','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','To\x20view\x20sample\x20data:','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','displayMasterInfo','\x20kill','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','61192OrAldU','Columns:','runParent','stats','\x20--attribute\x20\x22','all','/app/dw/parentSegments/','Output\x20file:\x20','addBehaviorsFile','Behavior:','string','apply','Executing\x20parent\x20segment\x20query...','Table:\x20','log','Creating','number','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','YAML\x20file:\x20','FINISHED','processedRows','segment:parent:create','getParentSQL','\x20\x20\x20\x20-\x20','✔\x20Renamed\x20directory\x20to\x20','isDirectory','displayColumns','utf-8','segment','localeCompare','cyan','workflowId','bold','\x20Opening\x20','addAttributesFile','\x27\x20and\x20run\x20workflow?','segment:parent:preview','segment:parent:desc','yellow','join','attribute','customerGroupFile','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','totalEvents','Fetching\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','/attempt/','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','customerPercent','\x20--interval\x20','addAttributes','No\x20parent\x20segments\x20found','coveragePercent','\x20rows)','Error\x20parsing\x20YAML:\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','in\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','enriched','name','displaySummary','behavior','label','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','session','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','schemaValid','.yml','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','parent_segment','\x27...','Error:\x20File\x20not\x20found:\x20','/sessions/','To\x20cancel:','map','workflowAttemptId','scheduleType','varchar','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x0aChanges\x20to\x20apply\x20to\x20\x27','Found\x20YAML\x20file:\x20','Attributes','tdx\x20segment\x20parent\x20preview\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','columns','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','trim','query','description','Fetching\x20current\x20configuration\x20for\x20\x27','execute','listFields','use','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','behaviorsFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','errors','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x0aNew\x20parent\x20segment\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','/\x20→\x20','Database:\x20','Fetching\x20sample\x20data...','segment:parent:update','interval','status','/\x20directory.\x0a','`\x20to\x20download\x20the\x20configuration\x20first','Rows:','timezone','repeat','displayBehaviorsStats','endsWith','table','Master:','allValid','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','pushParentYaml','Audience\x20ID:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','110ShlOoD','text','Aborted.','List\x20parent\x20segments','unref','230JbzlCc','length','sort','platform','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20No\x20sample\x20data\x20available','👥\x20','Master\x20+\x20Attributes','Pattern:\x20','Customers:','\x20Configuration\x20is\x20valid','Fetching\x20SQL\x20for\x20\x27','toFixed','Error\x20reading\x20file:\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','keys','output','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:fields','Creating\x20parent\x20segment\x20\x27','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Listing\x20parent\x20segments\x20matching\x20\x27','Master\x20Table','preview','Parent\x20segment:\x20','✔\x20Created\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','population','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Error:\x20Parent\x20segment\x20name\x20is\x20required','attributes','Error:','displayAttributesStats','\x20parent\x20segment\x20\x27','jsonl','\x20No\x20changes\x20-\x20','Site:\x20','win32','1673FtIKds','customerGroup','4046826xAVSGK','joinKey','\x20field'];a29_0x1555=function(){return _0x4432dc;};return a29_0x1555();}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';import{confirmKey}from'../utils/prompt.js';function a29_0x3897(_0x4adeba,_0x300fe8){_0x4adeba=_0x4adeba-0x14d;const _0x155532=a29_0x1555();let _0x3897be=_0x155532[_0x4adeba];return _0x3897be;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x3b8643 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a29_0x3f507c(0x272);function openBrowser(_0x4897f0){const _0x27e8ca=a29_0x3f507c,_0x4544e7=process[_0x27e8ca(0x186)],_0x177faf=_0x4544e7===_0x27e8ca(0x1c0)?'open':_0x4544e7===_0x27e8ca(0x1a9)?_0x27e8ca(0x1f8):_0x27e8ca(0x217);spawn(_0x177faf,[_0x4897f0],{'detached':!![],'stdio':'ignore'})[_0x27e8ca(0x182)]();}function migrateLegacyDirectory(){const _0x2a5072=a29_0x3f507c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x38b25a=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x38b25a[_0x2a5072(0x242)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2a5072(0x1ec)](a29_0x3b8643['yellow'](_0x2a5072(0x1e7)+LEGACY_PARENT_SEGMENT_DIR+_0x2a5072(0x1dc)+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x2a5072(0x1ec)](a29_0x3b8643['dim'](_0x2a5072(0x1bd)+LEGACY_PARENT_SEGMENT_DIR+_0x2a5072(0x170))),![];console['error'](a29_0x3b8643[_0x2a5072(0x24f)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x2a5072(0x16a)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2a5072(0x1ec)](a29_0x3b8643[_0x2a5072(0x1c1)](_0x2a5072(0x241)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x289887){const _0x45ccfb=_0x289887 instanceof Error?_0x289887['message']:String(_0x289887);return console['error'](a29_0x3b8643[_0x2a5072(0x1f6)](_0x2a5072(0x213)+_0x45ccfb+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x3f507c(0x1b3)](_0x32f831){const _0x5f53d2=a29_0x3f507c;return migrateLegacyDirectory(),super[_0x5f53d2(0x1b3)](_0x32f831);}}function resolveYamlFile(_0x3bfd57){const _0x5f56a5=a29_0x3f507c;if(_0x3bfd57['endsWith'](_0x5f56a5(0x270))||_0x3bfd57[_0x5f56a5(0x176)](_0x5f56a5(0x1b0)))return _0x3bfd57;return a29_0x367ebb[_0x5f56a5(0x250)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3bfd57)+_0x5f56a5(0x270));}function formatProgressMessage(_0x1727b7){const _0x4b3600=a29_0x3f507c,_0x47fd7c=_0x1727b7[_0x4b3600(0x1f5)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x47fd7c){const [,_0x1edc0c,_0x3d5534,_0x1d683c='']=_0x47fd7c;return a29_0x3b8643['dim'](_0x1edc0c+':')+'\x20'+_0x3d5534+a29_0x3b8643[_0x4b3600(0x1d2)](_0x1d683c);}return a29_0x3b8643['dim'](_0x1727b7);}function showFileNotFoundError(_0x5e3aff,_0xbf0e92){const _0x222008=a29_0x3f507c;console[_0x222008(0x1ec)](a29_0x3b8643['red'](_0x222008(0x274)+_0x5e3aff+'\x0a')),console[_0x222008(0x1ec)](a29_0x3b8643['cyan'](_0x222008(0x26b)+_0xbf0e92+_0x222008(0x171)));}function showParentSegmentNotSetError(_0x1ae883){const _0x390093=a29_0x3f507c;console[_0x390093(0x1ec)](a29_0x3b8643['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x390093(0x1ec)](_0x1ae883);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x3f507c(0x222);['description']=a29_0x3f507c(0x181);async[a29_0x3f507c(0x15f)](_0x56cca3){const _0x4110cb=a29_0x3f507c,{options:_0x4ab75b,args:_0x362c29,tdx:_0x18ff29}=_0x56cca3,_0x2dcb40=_0x362c29[0x0];_0x4ab75b[_0x4110cb(0x21c)]&&(console[_0x4110cb(0x1ec)](_0x4110cb(0x1a8)+_0x4ab75b[_0x4110cb(0x1e3)]),_0x2dcb40&&console[_0x4110cb(0x1ec)](_0x4110cb(0x18c)+_0x2dcb40));const _0x3a6149=await withSpinner(_0x2dcb40?_0x4110cb(0x199)+_0x2dcb40+_0x4110cb(0x273):'Listing\x20parent\x20segments...',()=>_0x18ff29[_0x4110cb(0x245)][_0x4110cb(0x212)](),{'verbose':_0x4ab75b[_0x4110cb(0x21c)]});let _0x15b403=_0x3a6149[_0x4110cb(0x21e)];if(_0x2dcb40){const _0x49bc03=_0x2dcb40[_0x4110cb(0x202)](/[.+^${}()|[\]\\]/g,_0x4110cb(0x1ce))[_0x4110cb(0x202)](/\*/g,'.*')[_0x4110cb(0x202)](/\?/g,'.'),_0x1b7570=new RegExp('^'+_0x49bc03+'$','i');_0x15b403=_0x15b403['filter'](_0x5158d4=>_0x1b7570[_0x4110cb(0x214)](_0x5158d4[_0x4110cb(0x1a2)][_0x4110cb(0x267)]));}_0x15b403[_0x4110cb(0x185)]((_0x19e37a,_0x1ddd38)=>_0x19e37a['attributes'][_0x4110cb(0x267)][_0x4110cb(0x246)](_0x1ddd38['attributes'][_0x4110cb(0x267)])),console['error']('✔\x20Found\x20'+_0x15b403[_0x4110cb(0x184)]+_0x4110cb(0x1fd)+(_0x15b403[_0x4110cb(0x184)]!==0x1?'s':''));if(_0x4ab75b[_0x4110cb(0x1da)]===_0x4110cb(0x1d7)||_0x4ab75b[_0x4110cb(0x1da)]==='jsonl')await handleSDKOutput(_0x15b403,_0x4ab75b);else{if(_0x15b403['length']===0x0)_0x2dcb40?console[_0x4110cb(0x237)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x2dcb40):console[_0x4110cb(0x237)](_0x4110cb(0x25d));else for(const _0x44b46d of _0x15b403){const _0x1d29a2=_0x44b46d[_0x4110cb(0x1a2)][_0x4110cb(0x19f)]?a29_0x3b8643[_0x4110cb(0x1d2)]('\x20('+formatRows(_0x44b46d[_0x4110cb(0x1a2)][_0x4110cb(0x19f)])+')'):'';console[_0x4110cb(0x237)](_0x4110cb(0x18a)+_0x44b46d[_0x4110cb(0x1a2)][_0x4110cb(0x267)]+_0x1d29a2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x23e);[a29_0x3f507c(0x15d)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x3fdcad){const _0x2c71ca=a29_0x3f507c,{options:_0x585da6,args:_0x1537d2,tdx:_0x561542}=_0x3fdcad;console[_0x2c71ca(0x1ec)](_0x2c71ca(0x169)+_0x2c71ca(0x253)+_0x2c71ca(0x254));const _0x4e71c7=_0x585da6;if(_0x1537d2['length']===0x0)return console[_0x2c71ca(0x1ec)](a29_0x3b8643[_0x2c71ca(0x1f6)](_0x2c71ca(0x1a1))),console[_0x2c71ca(0x1ec)](_0x2c71ca(0x257)),0x1;const _0x326057=_0x1537d2[0x0];if(!_0x4e71c7[_0x2c71ca(0x1c4)]||!_0x4e71c7['table'])return console[_0x2c71ca(0x1ec)](_0x2c71ca(0x1bc)),console[_0x2c71ca(0x1ec)](_0x2c71ca(0x257)),0x1;_0x4e71c7[_0x2c71ca(0x21c)]&&(console['error']('Site:\x20'+_0x4e71c7['site']),console[_0x2c71ca(0x1ec)]('Name:\x20'+_0x326057),console['error'](_0x2c71ca(0x16b)+_0x4e71c7[_0x2c71ca(0x1c4)]),console[_0x2c71ca(0x1ec)](_0x2c71ca(0x236)+_0x4e71c7[_0x2c71ca(0x177)]));const _0x56651b=await loadJSONFromOptions(_0x4e71c7['attributes'],_0x4e71c7[_0x2c71ca(0x1d3)]),_0x3cff11=await loadJSONFromOptions(_0x4e71c7[_0x2c71ca(0x1e8)],_0x4e71c7[_0x2c71ca(0x163)]),_0x1e01da=await loadJSONFromOptions(_0x4e71c7['customerGroup'],_0x4e71c7[_0x2c71ca(0x252)]),_0x5803f5={'name':_0x326057,'description':_0x4e71c7[_0x2c71ca(0x15d)],'scheduleType':_0x4e71c7[_0x2c71ca(0x14f)],'scheduleOption':_0x4e71c7['scheduleOption'],'timezone':_0x4e71c7[_0x2c71ca(0x173)],'master':{'parentDatabaseName':_0x4e71c7[_0x2c71ca(0x1c4)],'parentTableName':_0x4e71c7[_0x2c71ca(0x177)]},'attributes':_0x56651b,'behaviors':_0x3cff11,'customerGroup':_0x1e01da},_0x39c60c=await withSpinner(_0x2c71ca(0x197)+_0x326057+_0x2c71ca(0x273),()=>_0x561542[_0x2c71ca(0x245)][_0x2c71ca(0x201)](_0x5803f5),{'verbose':_0x585da6['verbose']}),_0x22973e=_0x39c60c['data'];return console[_0x2c71ca(0x1ec)](_0x2c71ca(0x19d)+_0x22973e[_0x2c71ca(0x267)]+'\x27\x20with\x20ID:\x20'+_0x22973e['id']),await handleSDKOutput([_0x22973e],_0x585da6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x16d);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x156);async[a29_0x3f507c(0x15f)](_0x3c788e){const _0x22cfa4=a29_0x3f507c,{options:_0x475d3b,args:_0x33652d,tdx:_0x20f032}=_0x3c788e;console['error'](_0x22cfa4(0x26d)+_0x22cfa4(0x253)+_0x22cfa4(0x254));const _0x4324c0=_0x475d3b;if(_0x33652d[_0x22cfa4(0x184)]===0x0)return console[_0x22cfa4(0x1ec)](a29_0x3b8643['red'](_0x22cfa4(0x1a1))),console[_0x22cfa4(0x1ec)](_0x22cfa4(0x215)),0x1;const _0x49730a=_0x33652d[0x0];_0x4324c0[_0x22cfa4(0x21c)]&&(console['error']('Site:\x20'+_0x4324c0[_0x22cfa4(0x1e3)]),console[_0x22cfa4(0x1ec)](_0x22cfa4(0x19c)+_0x49730a));const _0x298792=await withSpinner(_0x22cfa4(0x15e)+_0x49730a+_0x22cfa4(0x273),()=>_0x20f032['segment'][_0x22cfa4(0x1b7)](_0x49730a),{'verbose':_0x4324c0[_0x22cfa4(0x21c)]}),_0x230150=_0x298792[_0x22cfa4(0x21e)],_0x41c457=await loadJSONFromOptions(_0x4324c0[_0x22cfa4(0x25c)],_0x4324c0[_0x22cfa4(0x24b)]),_0x1cb62c=await loadJSONFromOptions(_0x4324c0[_0x22cfa4(0x1cd)],_0x4324c0[_0x22cfa4(0x231)]),_0x19997d={'name':_0x230150['name'],'description':_0x4324c0[_0x22cfa4(0x15d)]!==undefined?_0x4324c0[_0x22cfa4(0x15d)]:_0x230150[_0x22cfa4(0x15d)],'scheduleType':_0x4324c0[_0x22cfa4(0x14f)]!==undefined?_0x4324c0[_0x22cfa4(0x14f)]:_0x230150[_0x22cfa4(0x14f)],'scheduleOption':_0x4324c0['scheduleOption']!==undefined?_0x4324c0[_0x22cfa4(0x1cf)]:_0x230150['scheduleOption'],'timezone':_0x4324c0[_0x22cfa4(0x173)]!==undefined?_0x4324c0[_0x22cfa4(0x173)]:_0x230150[_0x22cfa4(0x173)],'master':_0x230150[_0x22cfa4(0x206)],'attributes':_0x41c457?[..._0x230150['attributes']||[],..._0x41c457]:_0x230150['attributes'],'behaviors':_0x1cb62c?[..._0x230150[_0x22cfa4(0x1e8)]||[],..._0x1cb62c]:_0x230150[_0x22cfa4(0x1e8)],'customerGroup':_0x230150[_0x22cfa4(0x1ab)]},_0x4c2367=await withSpinner(_0x22cfa4(0x1f4)+_0x49730a+_0x22cfa4(0x273),()=>_0x20f032[_0x22cfa4(0x245)]['updateParent'](_0x49730a,_0x19997d),{'verbose':_0x4324c0['verbose']}),_0x545bf3=_0x4c2367[_0x22cfa4(0x21e)];return console[_0x22cfa4(0x1ec)](_0x22cfa4(0x188)+_0x545bf3[_0x22cfa4(0x267)]+'\x27'),await handleSDKOutput([_0x545bf3],_0x4324c0),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x3f507c(0x267)]='segment:parent:pull';['description']=a29_0x3f507c(0x1ff);async[a29_0x3f507c(0x15f)](_0x25bc8a){const _0x38369c=a29_0x3f507c,{options:_0x55ce1a,args:_0x5df63b,tdx:_0x4870ac}=_0x25bc8a,_0x134889=_0x55ce1a,_0x3b08b8=_0x5df63b[0x0]||_0x55ce1a['parentSegment'];if(!_0x3b08b8)return showParentSegmentNotSetError(_0x38369c(0x187)+_0x38369c(0x1a0)),0x1;if(_0x134889[_0x38369c(0x161)]&&_0x134889[_0x38369c(0x194)])return console[_0x38369c(0x1ec)](a29_0x3b8643['red']('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x38369c(0x1ec)](a29_0x3b8643['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x38369c(0x1ec)](a29_0x3b8643[_0x38369c(0x1d2)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x38369c(0x1b2))),console[_0x38369c(0x1ec)](a29_0x3b8643[_0x38369c(0x247)](_0x38369c(0x151))),0x1;const _0x1b6249=_0x134889['output']||a29_0x367ebb['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3b08b8)+'.yml');_0x134889[_0x38369c(0x21c)]&&(console[_0x38369c(0x1ec)]('Site:\x20'+_0x134889[_0x38369c(0x1e3)]),console['error'](_0x38369c(0x19c)+_0x3b08b8),console[_0x38369c(0x1ec)](_0x38369c(0x230)+_0x1b6249));const _0x43eca8=await withSpinner(_0x38369c(0x256)+_0x3b08b8+_0x38369c(0x273),()=>_0x4870ac[_0x38369c(0x245)][_0x38369c(0x1c6)](_0x3b08b8),{'verbose':_0x134889[_0x38369c(0x21c)]}),_0x5c369f=_0x43eca8[_0x38369c(0x21e)];if(existsSync(_0x1b6249)){const _0x3924dd=readFileSync(_0x1b6249,_0x38369c(0x244)),_0x39ef2c=generateDiff(_0x3924dd,_0x5c369f);if(!hasChanges(_0x39ef2c))console[_0x38369c(0x1ec)](a29_0x3b8643['green']('✔')+_0x38369c(0x1a7)+a29_0x3b8643[_0x38369c(0x247)](_0x1b6249)+_0x38369c(0x1fc));else{console['error']('\x0aChanges\x20to\x20\x27'+_0x1b6249+'\x27:'),console[_0x38369c(0x1ec)]('─'[_0x38369c(0x174)](0x3c)),console['error'](formatDiffWithColors(_0x39ef2c)),console[_0x38369c(0x1ec)]('─'['repeat'](0x3c));if(!_0x134889[_0x38369c(0x1db)]){const _0x47f70b=await confirmKey('Overwrite\x20\x27'+_0x1b6249+'\x27?');if(!_0x47f70b)return console[_0x38369c(0x1ec)](_0x38369c(0x180)),0x1;}writeFileSync(_0x1b6249,_0x5c369f,_0x38369c(0x244)),console[_0x38369c(0x1ec)](a29_0x3b8643['green']('✔')+_0x38369c(0x1f0)+a29_0x3b8643[_0x38369c(0x247)](_0x1b6249));}}else{const _0x1794ee=a29_0x367ebb[_0x38369c(0x1fb)](_0x1b6249);!existsSync(_0x1794ee)&&mkdirSync(_0x1794ee,{'recursive':!![]}),writeFileSync(_0x1b6249,_0x5c369f,_0x38369c(0x244)),console['error'](a29_0x3b8643[_0x38369c(0x1c1)]('✔')+_0x38369c(0x1f0)+a29_0x3b8643[_0x38369c(0x247)](_0x1b6249));}return saveSessionContext({'parent_segment':_0x3b08b8},_0x134889[_0x38369c(0x26c)]),console[_0x38369c(0x1ec)](a29_0x3b8643[_0x38369c(0x1c1)]('✔')+_0x38369c(0x221)+a29_0x3b8643[_0x38369c(0x1d2)](_0x38369c(0x272))+_0x38369c(0x1c3)+a29_0x3b8643[_0x38369c(0x247)](_0x3b08b8)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']='segment:parent:push';[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1b1);async[a29_0x3f507c(0x15f)](_0xdb9768){const _0x3e3709=a29_0x3f507c,{options:_0x22f0d9,args:_0x43cf59,tdx:_0x3c602a}=_0xdb9768,_0x335862=_0x22f0d9,_0x327ba2=_0x43cf59[0x0]||_0x22f0d9[_0x3e3709(0x1af)];if(!_0x327ba2)return showParentSegmentNotSetError(_0x3e3709(0x264)+_0x3e3709(0x223)),0x1;const _0x3c26e1=resolveYamlFile(_0x327ba2);if(!existsSync(_0x3c26e1))return showFileNotFoundError(_0x3c26e1,_0x327ba2),0x1;_0x335862[_0x3e3709(0x21c)]&&(console[_0x3e3709(0x1ec)](_0x3e3709(0x1a8)+_0x335862[_0x3e3709(0x1e3)]),console[_0x3e3709(0x1ec)](_0x3e3709(0x23b)+_0x3c26e1));let _0x4bb8f0;try{_0x4bb8f0=readFileSync(_0x3c26e1,_0x3e3709(0x244));}catch(_0x210ddb){const _0x5159ed=_0x210ddb instanceof Error?_0x210ddb[_0x3e3709(0x20e)]:String(_0x210ddb);return console[_0x3e3709(0x1ec)]('Error\x20reading\x20file:\x20'+_0x5159ed),0x1;}const _0x4e38df=await withSpinner('Analyzing\x20changes...',()=>_0x3c602a[_0x3e3709(0x245)]['pushParentYaml'](_0x4bb8f0),{'verbose':_0x335862['verbose']}),_0x1439a8=_0x4e38df[_0x3e3709(0x21e)],{isNew:_0x197dfe,name:_0x20958a,hasChanges:_0x5d3587,diffFormatted:_0x3147ee}=_0x1439a8;if(!_0x5d3587)return console[_0x3e3709(0x1ec)]('✔\x20No\x20changes\x20-\x20\x27'+_0x20958a+_0x3e3709(0x19e)),0x0;_0x197dfe?console[_0x3e3709(0x1ec)](_0x3e3709(0x168)+_0x20958a+'\x27:'):console[_0x3e3709(0x1ec)](_0x3e3709(0x152)+_0x20958a+'\x27:');console[_0x3e3709(0x1ec)]('─'[_0x3e3709(0x174)](0x3c)),console[_0x3e3709(0x1ec)](_0x3147ee),console[_0x3e3709(0x1ec)]('─'['repeat'](0x3c));const _0x44fbe5=_0x197dfe?'Create\x20parent\x20segment\x20\x27'+_0x20958a+'\x27?':_0x3e3709(0x1c5)+_0x20958a+'\x27?';if(!_0x335862[_0x3e3709(0x1db)]){const _0x2d3f22=await confirmKey(_0x44fbe5);if(!_0x2d3f22)return console[_0x3e3709(0x1ec)](_0x3e3709(0x180)),0x1;}const _0xceb8bd=_0x197dfe?_0x3e3709(0x238):_0x3e3709(0x216),_0x2b34fc=await withSpinner(_0xceb8bd+_0x3e3709(0x1a5)+_0x20958a+_0x3e3709(0x273),()=>_0x1439a8[_0x3e3709(0x234)](),{'verbose':_0x335862[_0x3e3709(0x21c)]}),_0x4c5617=_0x2b34fc[_0x3e3709(0x21e)],_0x25facf=getConsoleNextUrl(_0x335862[_0x3e3709(0x1e3)],_0x3e3709(0x22f)+_0x4c5617['id']),_0x267159=_0x197dfe?_0x3e3709(0x220):_0x3e3709(0x1f2);return console[_0x3e3709(0x1ec)]('✔\x20'+_0x267159+_0x3e3709(0x1a5)+_0x4c5617['name']+'\x27'),console['error']('\x20\x20'+_0x25facf),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a29_0x3f507c(0x1ee);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x17a);async[a29_0x3f507c(0x15f)](_0x557cdc){const _0x1bd1ed=a29_0x3f507c,{options:_0x1ba551,args:_0x117ec0,tdx:_0x3d6996}=_0x557cdc,_0x2764c9=_0x1ba551,_0x1a6177=_0x117ec0[0x0]||_0x1ba551[_0x1bd1ed(0x1af)];if(!_0x1a6177)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x1bd1ed(0x228)+_0x1bd1ed(0x1ed)+_0x1bd1ed(0x157)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x24deb6=resolveYamlFile(_0x1a6177);if(!existsSync(_0x24deb6))return showFileNotFoundError(_0x24deb6,_0x1a6177),0x1;_0x2764c9[_0x1bd1ed(0x21c)]&&(console['error'](_0x1bd1ed(0x1a8)+_0x2764c9[_0x1bd1ed(0x1e3)]),console[_0x1bd1ed(0x1ec)](_0x1bd1ed(0x23b)+_0x24deb6));let _0x134c29;try{_0x134c29=readFileSync(_0x24deb6,_0x1bd1ed(0x244));}catch(_0x2e9b29){const _0x196e0e=_0x2e9b29 instanceof Error?_0x2e9b29[_0x1bd1ed(0x20e)]:String(_0x2e9b29);return console[_0x1bd1ed(0x1ec)](_0x1bd1ed(0x191)+_0x196e0e),0x1;}const _0x280dd4=createCommandSpinner(a29_0x3b8643[_0x1bd1ed(0x1d2)](_0x1bd1ed(0x1ef)),{'verbose':_0x2764c9[_0x1bd1ed(0x21c)]});_0x280dd4[_0x1bd1ed(0x1f8)]();const _0x31b447={'onProgress':_0x43898e=>{_0x280dd4['text']=formatProgressMessage(_0x43898e);}};if(_0x2764c9[_0x1bd1ed(0x206)])_0x31b447[_0x1bd1ed(0x206)]=!![];if(_0x2764c9[_0x1bd1ed(0x266)])_0x31b447['enriched']=!![];_0x2764c9[_0x1bd1ed(0x251)]&&(_0x31b447[_0x1bd1ed(0x251)]=_0x2764c9['attribute']);_0x2764c9[_0x1bd1ed(0x269)]&&(_0x31b447[_0x1bd1ed(0x269)]=_0x2764c9[_0x1bd1ed(0x269)]);if(_0x2764c9[_0x1bd1ed(0x16e)])_0x31b447['interval']=_0x2764c9[_0x1bd1ed(0x16e)];let _0x502e80;try{_0x502e80=await _0x3d6996[_0x1bd1ed(0x245)][_0x1bd1ed(0x21a)](_0x134c29,_0x31b447),_0x280dd4['stop']();}catch(_0x3bd757){_0x280dd4[_0x1bd1ed(0x20a)]();throw _0x3bd757;}const _0x34c197=_0x2764c9[_0x1bd1ed(0x16e)]||_0x1bd1ed(0x1e4);return this['displayValidateResults'](_0x502e80,_0x31b447,_0x24deb6,_0x34c197),_0x502e80[_0x1bd1ed(0x179)]?0x0:0x1;}['displayValidateResults'](_0x1e66c6,_0x9f8f06,_0x20a58b,_0x2141c7){const _0x24dd6a=a29_0x3f507c;console[_0x24dd6a(0x1ec)]('\x0a'+a29_0x3b8643[_0x24dd6a(0x249)](_0x24dd6a(0x1eb))+'\x20'+_0x1e66c6['name']),console['error']('═'[_0x24dd6a(0x174)](0x3c)),this['displayMasterInfo'](_0x1e66c6);if(typeof _0x9f8f06['attribute']===_0x24dd6a(0x233)){this[_0x24dd6a(0x1a4)](_0x1e66c6),this['displaySummary'](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x251),_0x9f8f06['attribute']);return;}if(_0x9f8f06[_0x24dd6a(0x251)]===!![]){this[_0x24dd6a(0x1a4)](_0x1e66c6),this[_0x24dd6a(0x268)](_0x1e66c6),this['displayPreviewHints'](_0x20a58b,_0x2141c7,_0x24dd6a(0x1a2));return;}if(typeof _0x9f8f06[_0x24dd6a(0x269)]===_0x24dd6a(0x233)){this[_0x24dd6a(0x175)](_0x1e66c6,_0x2141c7),this[_0x24dd6a(0x268)](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x269),_0x9f8f06[_0x24dd6a(0x269)]);return;}if(_0x9f8f06[_0x24dd6a(0x269)]===!![]){this['displayBehaviorsStats'](_0x1e66c6,_0x2141c7),this[_0x24dd6a(0x268)](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x1e8));return;}this[_0x24dd6a(0x1a4)](_0x1e66c6),this['displayBehaviorsStats'](_0x1e66c6,_0x2141c7),this[_0x24dd6a(0x268)](_0x1e66c6),this[_0x24dd6a(0x1b4)](_0x20a58b,_0x2141c7,_0x24dd6a(0x22e));}['displayPreviewHints'](_0x29a27c,_0x333916,_0x3cadfa,_0x569773){const _0x1bb374=a29_0x3f507c;console[_0x1bb374(0x1ec)]('\x0a'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x224)));const _0x5ae5af=_0x333916!=='-1d'?_0x1bb374(0x25b)+_0x333916:'';if(_0x3cadfa===_0x1bb374(0x251)&&_0x569773)console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+_0x1bb374(0x22d)+_0x569773+'\x22'+_0x5ae5af));else{if(_0x3cadfa===_0x1bb374(0x269)&&_0x569773)console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+'\x20--behavior\x20\x22'+_0x569773+'\x22'+_0x5ae5af));else(_0x3cadfa===_0x1bb374(0x1a2)||_0x3cadfa===_0x1bb374(0x22e))&&console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)]('tdx\x20segment\x20parent\x20preview\x20'+_0x29a27c+'\x20--attribute\x20\x22<name>\x22'+_0x5ae5af));}(_0x3cadfa===_0x1bb374(0x1e8)||_0x3cadfa===_0x1bb374(0x22e))&&console[_0x1bb374(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+_0x1bb374(0x1bf)+_0x5ae5af)),_0x3cadfa==='all'&&console['error']('\x20\x20'+a29_0x3b8643[_0x1bb374(0x1d2)](_0x1bb374(0x155)+_0x29a27c+'\x20--enriched'+_0x5ae5af));}[a29_0x3f507c(0x226)](_0xd20de9){const _0x20f621=a29_0x3f507c,{master:_0x2e0096}=_0xd20de9,_0x265173=_0x2e0096[_0x20f621(0x26f)]?a29_0x3b8643['green']('✔'):a29_0x3b8643['red']('✘');console[_0x20f621(0x1ec)]('\x0a'+a29_0x3b8643[_0x20f621(0x1d2)](_0x20f621(0x19a))),console['error'](_0x265173+'\x20'+a29_0x3b8643[_0x20f621(0x249)](_0x2e0096[_0x20f621(0x1c4)]+'.'+_0x2e0096[_0x20f621(0x177)])),_0x2e0096['schemaValid']?_0x2e0096[_0x20f621(0x1ba)]!==undefined&&console[_0x20f621(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x20f621(0x1d2)](_0x20f621(0x172))+'\x20'+a29_0x3b8643[_0x20f621(0x247)](formatRows(_0x2e0096['rowCount']))):console[_0x20f621(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x20f621(0x1f6)]('Error:')+'\x20'+_0x2e0096[_0x20f621(0x1f7)]);}[a29_0x3f507c(0x1a4)](_0x5bb34f){const _0x1e9f02=a29_0x3f507c;if(_0x5bb34f['attributes']['length']===0x0)return;console[_0x1e9f02(0x1ec)]('\x0a'+a29_0x3b8643['dim'](_0x1e9f02(0x154)));for(const _0x3a4971 of _0x5bb34f[_0x1e9f02(0x1a2)]){const _0x6b869f=_0x3a4971['schemaValid']?a29_0x3b8643[_0x1e9f02(0x1c1)]('✔'):a29_0x3b8643[_0x1e9f02(0x1f6)]('✘');let _0x11eb80='';if(_0x3a4971[_0x1e9f02(0x26f)]&&_0x3a4971['matchedCount']!==undefined&&_0x3a4971[_0x1e9f02(0x25e)]!==undefined){const _0x2f988f=_0x3a4971[_0x1e9f02(0x25e)]['toFixed'](0x1),_0x5c35f2=_0x3a4971[_0x1e9f02(0x25e)]>=0x50?a29_0x3b8643['green']:_0x3a4971[_0x1e9f02(0x25e)]>=0x32?a29_0x3b8643[_0x1e9f02(0x24f)]:a29_0x3b8643[_0x1e9f02(0x1f6)];_0x11eb80='\x20'+a29_0x3b8643[_0x1e9f02(0x1d2)]('Coverage:')+'\x20'+_0x5c35f2(_0x2f988f+'%')+'\x20('+formatRows(_0x3a4971[_0x1e9f02(0x1d9)])+_0x1e9f02(0x25f);}console[_0x1e9f02(0x1ec)](_0x6b869f+'\x20'+a29_0x3b8643['bold'](_0x3a4971[_0x1e9f02(0x267)])+_0x11eb80),console[_0x1e9f02(0x1ec)]('\x20\x20'+a29_0x3b8643['dim'](_0x1e9f02(0x200))+'\x20'+a29_0x3b8643[_0x1e9f02(0x249)](_0x3a4971[_0x1e9f02(0x1c4)]+'.'+_0x3a4971[_0x1e9f02(0x177)]));const _0x7217c8=_0x3a4971[_0x1e9f02(0x1ad)]===_0x3a4971[_0x1e9f02(0x20c)]?a29_0x3b8643[_0x1e9f02(0x1d2)](_0x1e9f02(0x1d6))+'\x20'+_0x3a4971[_0x1e9f02(0x1ad)]:a29_0x3b8643[_0x1e9f02(0x1d2)]('Join:')+'\x20'+_0x3a4971[_0x1e9f02(0x1ad)]+'\x20=\x20'+_0x3a4971[_0x1e9f02(0x20c)];console[_0x1e9f02(0x1ec)]('\x20\x20'+_0x7217c8),console[_0x1e9f02(0x1ec)]('\x20\x20'+a29_0x3b8643['dim'](_0x1e9f02(0x22a))),this['displayColumns'](_0x3a4971[_0x1e9f02(0x159)]),!_0x3a4971[_0x1e9f02(0x26f)]&&console[_0x1e9f02(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x1e9f02(0x1f6)](_0x1e9f02(0x1a3))+'\x20'+_0x3a4971[_0x1e9f02(0x1f7)]);}}['displayBehaviorsStats'](_0x5234d9,_0x1c8b6b){const _0x57611=a29_0x3f507c;if(_0x5234d9[_0x57611(0x1e8)][_0x57611(0x184)]===0x0)return;console['error']('\x0a'+a29_0x3b8643[_0x57611(0x1d2)]('Behaviors')+'\x20'+a29_0x3b8643[_0x57611(0x1d2)]('('+_0x1c8b6b+')'));for(const _0x4cdc9c of _0x5234d9['behaviors']){const _0x16eb19=_0x4cdc9c[_0x57611(0x26f)]?a29_0x3b8643[_0x57611(0x1c1)]('✔'):a29_0x3b8643['red']('✘');let _0x5320bc='';if(_0x4cdc9c['schemaValid']&&_0x4cdc9c[_0x57611(0x1d5)]!==undefined&&_0x4cdc9c['totalEvents']!==undefined){const _0x11a26d=_0x4cdc9c[_0x57611(0x25a)]?.[_0x57611(0x190)](0x1)||'?',_0x3afeaa=(_0x4cdc9c['customerPercent']??0x0)>=0x32?a29_0x3b8643[_0x57611(0x1c1)]:(_0x4cdc9c[_0x57611(0x25a)]??0x0)>=0x14?a29_0x3b8643[_0x57611(0x24f)]:a29_0x3b8643[_0x57611(0x1f6)];_0x5320bc='\x20'+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x18d))+'\x20'+_0x3afeaa(formatRows(_0x4cdc9c[_0x57611(0x1d5)]))+'\x20('+_0x11a26d+_0x57611(0x1df)+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x1be))+'\x20'+a29_0x3b8643[_0x57611(0x247)](formatRows(_0x4cdc9c[_0x57611(0x255)]));}console['error'](_0x16eb19+'\x20'+a29_0x3b8643[_0x57611(0x249)](_0x4cdc9c[_0x57611(0x267)])+_0x5320bc),console[_0x57611(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x200))+'\x20'+a29_0x3b8643[_0x57611(0x249)](_0x4cdc9c[_0x57611(0x1c4)]+'.'+_0x4cdc9c[_0x57611(0x177)]));const _0x40a83f=_0x4cdc9c[_0x57611(0x1ad)]===_0x4cdc9c['foreignKey']?a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x1d6))+'\x20'+_0x4cdc9c[_0x57611(0x1ad)]:a29_0x3b8643[_0x57611(0x1d2)]('Join:')+'\x20'+_0x4cdc9c[_0x57611(0x1ad)]+_0x57611(0x1c3)+_0x4cdc9c[_0x57611(0x20c)];console[_0x57611(0x1ec)]('\x20\x20'+_0x40a83f),console[_0x57611(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x57611(0x1d2)](_0x57611(0x22a))),this[_0x57611(0x243)](_0x4cdc9c[_0x57611(0x159)]),!_0x4cdc9c['schemaValid']&&console['error']('\x20\x20'+a29_0x3b8643['red'](_0x57611(0x1a3))+'\x20'+_0x4cdc9c['schemaError']);}}[a29_0x3f507c(0x243)](_0x164afc){const _0x590880=a29_0x3f507c;for(const _0x16425d of _0x164afc){_0x16425d[_0x590880(0x26a)]===_0x16425d[_0x590880(0x1dd)]||_0x16425d[_0x590880(0x1dd)]==='*'?console['error'](_0x590880(0x240)+_0x16425d[_0x590880(0x26a)]):console[_0x590880(0x1ec)]('\x20\x20\x20\x20-\x20'+_0x16425d['label']+'\x20'+a29_0x3b8643['dim']('('+_0x16425d[_0x590880(0x1dd)]+')'));}}[a29_0x3f507c(0x268)](_0x41b1e5){const _0x3e9e89=a29_0x3f507c;console[_0x3e9e89(0x1ec)]('─'[_0x3e9e89(0x174)](0x3c));if(_0x41b1e5[_0x3e9e89(0x165)][_0x3e9e89(0x184)]>0x0){console[_0x3e9e89(0x1ec)]('\x0a'+a29_0x3b8643['red'](_0x3e9e89(0x1e9)));for(const _0x423457 of _0x41b1e5['errors']){console[_0x3e9e89(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x3e9e89(0x1f6)]('•')+'\x20'+_0x423457);}}_0x41b1e5[_0x3e9e89(0x179)]&&console[_0x3e9e89(0x1ec)]('\x0a'+a29_0x3b8643[_0x3e9e89(0x1c1)]('✔')+_0x3e9e89(0x18e));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x24d);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x26e);async[a29_0x3f507c(0x15f)](_0xa0bb46){const _0x974768=a29_0x3f507c,{options:_0x5ad6b4,args:_0x5fbb1b,tdx:_0x11b927}=_0xa0bb46,_0x5e2d81=_0x5ad6b4,_0x3f4855=_0x5fbb1b[0x0]||_0x5ad6b4['parentSegment'];if(!_0x3f4855)return showParentSegmentNotSetError(_0x974768(0x204)+_0x974768(0x164)+'Options\x20(one\x20required):\x0a'+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x974768(0x158)),0x1;if(!_0x5e2d81[_0x974768(0x206)]&&!_0x5e2d81['attribute']&&!_0x5e2d81[_0x974768(0x269)]&&!_0x5e2d81[_0x974768(0x266)])return console[_0x974768(0x1ec)](a29_0x3b8643['red']('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error'](_0x974768(0x21f)),console[_0x974768(0x1ec)](_0x974768(0x1d0)),console[_0x974768(0x1ec)](_0x974768(0x263)),console[_0x974768(0x1ec)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x974768(0x1ec)](_0x974768(0x271)),console[_0x974768(0x1ec)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x3af7bc=resolveYamlFile(_0x3f4855);if(!existsSync(_0x3af7bc))return showFileNotFoundError(_0x3af7bc,_0x3f4855),0x1;_0x5e2d81['verbose']&&(console['error'](_0x974768(0x1a8)+_0x5e2d81[_0x974768(0x1e3)]),console[_0x974768(0x1ec)](_0x974768(0x23b)+_0x3af7bc));let _0x277a7b;try{_0x277a7b=readFileSync(_0x3af7bc,_0x974768(0x244));}catch(_0x339f14){const _0x4272bd=_0x339f14 instanceof Error?_0x339f14[_0x974768(0x20e)]:String(_0x339f14);return console[_0x974768(0x1ec)](_0x974768(0x191)+_0x4272bd),0x1;}let _0x25831d;try{_0x25831d=parseYamlString(_0x277a7b);}catch(_0x15d328){const _0x4f63cd=_0x15d328 instanceof Error?_0x15d328[_0x974768(0x20e)]:String(_0x15d328);return console[_0x974768(0x1ec)](a29_0x3b8643[_0x974768(0x1f6)](_0x974768(0x260)+_0x4f63cd)),0x1;}if(_0x5e2d81['attribute']===!![]||_0x5e2d81['attribute']===''){const _0x43381d=_0x25831d[_0x974768(0x1a2)]?.[_0x974768(0x14d)](_0x23ef6d=>_0x23ef6d['name'])||[];if(_0x43381d[_0x974768(0x184)]===0x0)console['error'](a29_0x3b8643['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x974768(0x1ec)](a29_0x3b8643[_0x974768(0x1f6)](_0x974768(0x198))),console['error'](_0x974768(0x1f3));for(const _0x494cc5 of _0x43381d){console[_0x974768(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x974768(0x247)](_0x494cc5));}console[_0x974768(0x1ec)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x3f4855+_0x974768(0x22d)+_0x43381d[0x0]+'\x22');}return 0x1;}if(_0x5e2d81[_0x974768(0x269)]===!![]||_0x5e2d81[_0x974768(0x269)]===''){const _0x44bd58=_0x25831d[_0x974768(0x1e8)]?.['map'](_0x45313b=>_0x45313b[_0x974768(0x267)])||[];if(_0x44bd58[_0x974768(0x184)]===0x0)console[_0x974768(0x1ec)](a29_0x3b8643[_0x974768(0x1f6)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x974768(0x1ec)](a29_0x3b8643['red'](_0x974768(0x167))),console[_0x974768(0x1ec)]('Available\x20behaviors:');for(const _0x358d8b of _0x44bd58){console[_0x974768(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x974768(0x247)](_0x358d8b));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x3f4855+_0x974768(0x219)+_0x44bd58[0x0]+'\x22');}return 0x1;}const _0x27ffec=createCommandSpinner(a29_0x3b8643['dim'](_0x974768(0x16c)),{'verbose':_0x5e2d81['verbose']});_0x27ffec[_0x974768(0x1f8)]();const _0x2d00d2={'onProgress':_0x50d12a=>{const _0x4ff55b=_0x974768;_0x27ffec[_0x4ff55b(0x17f)]=formatProgressMessage(_0x50d12a);}};if(_0x5e2d81[_0x974768(0x206)])_0x2d00d2[_0x974768(0x206)]=!![];if(_0x5e2d81[_0x974768(0x251)]&&typeof _0x5e2d81[_0x974768(0x251)]===_0x974768(0x233))_0x2d00d2[_0x974768(0x251)]=_0x5e2d81[_0x974768(0x251)];if(_0x5e2d81['behavior']&&typeof _0x5e2d81[_0x974768(0x269)]==='string')_0x2d00d2[_0x974768(0x269)]=_0x5e2d81['behavior'];if(_0x5e2d81[_0x974768(0x266)])_0x2d00d2[_0x974768(0x266)]=!![];if(_0x5e2d81['interval'])_0x2d00d2[_0x974768(0x16e)]=_0x5e2d81['interval'];let _0x306e49;try{_0x306e49=await _0x11b927[_0x974768(0x245)]['previewParentYaml'](_0x277a7b,_0x2d00d2),_0x27ffec[_0x974768(0x20a)]();}catch(_0x2f077b){_0x27ffec[_0x974768(0x20a)]();throw _0x2f077b;}return await this['displayPreviewResults'](_0x306e49,{'master':_0x5e2d81[_0x974768(0x206)],'attribute':typeof _0x5e2d81[_0x974768(0x251)]===_0x974768(0x233)?_0x5e2d81[_0x974768(0x251)]:undefined,'behavior':typeof _0x5e2d81[_0x974768(0x269)]==='string'?_0x5e2d81[_0x974768(0x269)]:undefined,'enriched':_0x5e2d81['enriched']}),_0x306e49['allValid']?0x0:0x1;}async['displayPreviewResults'](_0x53ddda,_0x2ce83c){const _0x293b4f=a29_0x3f507c;console[_0x293b4f(0x1ec)]('\x0a'+a29_0x3b8643[_0x293b4f(0x249)](_0x293b4f(0x1d4))+'\x20'+_0x53ddda[_0x293b4f(0x267)]),console[_0x293b4f(0x1ec)]('═'[_0x293b4f(0x174)](0x3c));if(_0x2ce83c[_0x293b4f(0x206)]&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x3f1a0b=a29_0x3b8643[_0x293b4f(0x1d2)](_0x293b4f(0x178))+'\x20'+a29_0x3b8643[_0x293b4f(0x249)](_0x53ddda[_0x293b4f(0x206)]['database']+'.'+_0x53ddda[_0x293b4f(0x206)][_0x293b4f(0x177)]);await this[_0x293b4f(0x1b9)](_0x3f1a0b,_0x53ddda[_0x293b4f(0x1ea)]);}else{if(_0x2ce83c[_0x293b4f(0x251)]&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x18d30=a29_0x3b8643[_0x293b4f(0x1d2)](_0x293b4f(0x207))+'\x20'+a29_0x3b8643['bold'](_0x2ce83c['attribute']);await this['displaySampleData'](_0x18d30,_0x53ddda['sampleData']);}else{if(_0x2ce83c['behavior']&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x3888f8=a29_0x3b8643['dim'](_0x293b4f(0x232))+'\x20'+a29_0x3b8643['bold'](_0x2ce83c[_0x293b4f(0x269)]);await this[_0x293b4f(0x1b9)](_0x3888f8,_0x53ddda[_0x293b4f(0x1ea)]);}else{if(_0x2ce83c[_0x293b4f(0x266)]&&_0x53ddda[_0x293b4f(0x1ea)]){const _0x422936=a29_0x3b8643[_0x293b4f(0x1d2)](_0x293b4f(0x205))+'\x20'+a29_0x3b8643['bold'](_0x293b4f(0x18b));await this[_0x293b4f(0x1b9)](_0x422936,_0x53ddda[_0x293b4f(0x1ea)]);}else!_0x53ddda[_0x293b4f(0x1ea)]&&console[_0x293b4f(0x1ec)](_0x293b4f(0x1f1));}}}if(_0x53ddda[_0x293b4f(0x165)]['length']>0x0){console[_0x293b4f(0x1ec)]('─'[_0x293b4f(0x174)](0x3c)),console[_0x293b4f(0x1ec)]('\x0a'+a29_0x3b8643[_0x293b4f(0x1f6)](_0x293b4f(0x1e9)));for(const _0x1c4864 of _0x53ddda[_0x293b4f(0x165)]){console[_0x293b4f(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x293b4f(0x1f6)]('•')+'\x20'+_0x1c4864);}}}async[a29_0x3f507c(0x1b9)](_0x403954,_0x2a1966){const _0x2b3317=a29_0x3f507c;if(_0x2a1966[_0x2b3317(0x184)]===0x0){console['error']('\x0a'+_0x403954),console[_0x2b3317(0x1ec)](_0x2b3317(0x189));return;}console['error']('\x0a'+_0x403954);const _0x3eb5e0=Object[_0x2b3317(0x193)](_0x2a1966[0x0])[_0x2b3317(0x14d)](_0x55d157=>({'name':_0x55d157,'type':typeof _0x2a1966[0x0][_0x55d157]===_0x2b3317(0x239)?_0x2b3317(0x1c9):_0x2b3317(0x150)})),_0x24ab2b={'queryId':_0x2b3317(0x19b),'columns':_0x3eb5e0,'data':_0x2a1966,'stats':{'state':_0x2b3317(0x23c),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2a1966['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x12ab2d=formatAsTable(_0x24ab2b,_0x2a1966[_0x2b3317(0x184)],!![]);await writeOutput(_0x12ab2d,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']='segment:parent:run';[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x192);async['execute'](_0x353853){const _0x104a57=a29_0x3f507c,{options:_0x544bdf,args:_0x27fa23,tdx:_0x18f93c}=_0x353853,_0xcaaed3=_0x544bdf,_0x222813=_0x27fa23[0x0]||_0x544bdf[_0x104a57(0x1af)];if(!_0x222813)return showParentSegmentNotSetError(_0x104a57(0x162)+_0x104a57(0x23a)),0x1;const _0x5c5ebc=resolveYamlFile(_0x222813);if(existsSync(_0x5c5ebc)){_0xcaaed3[_0x104a57(0x21c)]&&console[_0x104a57(0x1ec)](_0x104a57(0x153)+_0x5c5ebc);let _0x1f86f2;try{_0x1f86f2=readFileSync(_0x5c5ebc,'utf-8');}catch(_0x143b02){const _0x2434de=_0x143b02 instanceof Error?_0x143b02[_0x104a57(0x20e)]:String(_0x143b02);return console[_0x104a57(0x1ec)](_0x104a57(0x191)+_0x2434de),0x1;}const _0x4c83f6=await withSpinner('Analyzing\x20changes...',()=>_0x18f93c[_0x104a57(0x245)][_0x104a57(0x17b)](_0x1f86f2),{'verbose':_0xcaaed3[_0x104a57(0x21c)]}),_0x35e9dc=_0x4c83f6[_0x104a57(0x21e)],{isNew:_0x1fdece,name:_0x3ab03c,hasChanges:_0x166487,diffFormatted:_0x1a07e4}=_0x35e9dc;if(_0x166487){_0x1fdece?console[_0x104a57(0x1ec)](_0x104a57(0x168)+_0x3ab03c+'\x27:'):console[_0x104a57(0x1ec)](_0x104a57(0x152)+_0x3ab03c+'\x27:');console[_0x104a57(0x1ec)]('─'[_0x104a57(0x174)](0x3c)),console[_0x104a57(0x1ec)](_0x1a07e4),console['error']('─'[_0x104a57(0x174)](0x3c));const _0xf0b73c=_0x1fdece?_0x104a57(0x209)+_0x3ab03c+_0x104a57(0x24c):_0x104a57(0x1c5)+_0x3ab03c+'\x27\x20and\x20run\x20workflow?';if(!_0xcaaed3[_0x104a57(0x1db)]){const _0x51ba21=await confirmKey(_0xf0b73c);if(!_0x51ba21)return console[_0x104a57(0x1ec)]('Aborted.'),0x1;}const _0x483413=_0x1fdece?_0x104a57(0x238):_0x104a57(0x216);await withSpinner(_0x483413+_0x104a57(0x1a5)+_0x3ab03c+_0x104a57(0x273),()=>_0x35e9dc['apply'](),{'verbose':_0xcaaed3['verbose']});const _0x54a341=_0x1fdece?_0x104a57(0x220):_0x104a57(0x1f2);console[_0x104a57(0x1ec)]('✔\x20'+_0x54a341+_0x104a57(0x1a5)+_0x3ab03c+'\x27');}else console['error'](_0x104a57(0x1b6)+_0x3ab03c+_0x104a57(0x265));}const _0x4af8ca=await withSpinner(_0x104a57(0x15a)+_0x222813+_0x104a57(0x273),()=>_0x18f93c['segment'][_0x104a57(0x22b)](_0x222813),{'verbose':_0xcaaed3['verbose']}),_0x3cb2c1=_0x4af8ca['data'],_0x47f961=getConsoleUrl(_0xcaaed3[_0x104a57(0x1e3)],'/app/workflows/'+_0x3cb2c1[_0x104a57(0x248)]+_0x104a57(0x275)+_0x3cb2c1['workflowSessionId']+_0x104a57(0x258)+_0x3cb2c1['workflowAttemptId']);return console[_0x104a57(0x1ec)](_0x104a57(0x203)),console[_0x104a57(0x1ec)]('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)](_0x104a57(0x17c))+'\x20'+_0x3cb2c1['audienceId']),console['error']('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)]('Status:')+'\x20'+_0x3cb2c1[_0x104a57(0x16f)]),console['error']('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)](_0x104a57(0x1cb))+'\x20'+_0x3cb2c1['workflowSessionId']),console['error']('\x20\x20'+a29_0x3b8643[_0x104a57(0x1d2)](_0x104a57(0x211))+'\x20'+_0x3cb2c1[_0x104a57(0x14e)]),console[_0x104a57(0x1ec)]('\x20\x20'+_0x47f961),console[_0x104a57(0x1ec)]('\x0a'+a29_0x3b8643['dim'](_0x104a57(0x276))+'\x20tdx\x20wf\x20attempt\x20'+_0x3cb2c1[_0x104a57(0x14e)]+_0x104a57(0x227)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a29_0x3f507c(0x196);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1fa);async[a29_0x3f507c(0x15f)](_0xb3751b){const _0x5da9a6=a29_0x3f507c,{options:_0x2f1ec3,args:_0x14240f,tdx:_0x3788ba}=_0xb3751b,_0x5c7d97=_0x14240f[0x0]||_0x2f1ec3[_0x5da9a6(0x1af)];if(!_0x5c7d97)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x5da9a6(0x1c8)),0x1;_0x2f1ec3['verbose']&&(console[_0x5da9a6(0x1ec)](_0x5da9a6(0x1a8)+_0x2f1ec3['site']),console[_0x5da9a6(0x1ec)](_0x5da9a6(0x19c)+_0x5c7d97));const _0x5bc697=await withSpinner(_0x5da9a6(0x1ca)+_0x5c7d97+'\x27...',()=>_0x3788ba[_0x5da9a6(0x245)][_0x5da9a6(0x160)](_0x5c7d97),{'verbose':_0x2f1ec3[_0x5da9a6(0x21c)]}),_0x57eb63=_0x5bc697[_0x5da9a6(0x21e)];console[_0x5da9a6(0x1ec)]('✔\x20Found\x20'+_0x57eb63['length']+_0x5da9a6(0x1ae)+(_0x57eb63[_0x5da9a6(0x184)]!==0x1?'s':''));if(_0x2f1ec3[_0x5da9a6(0x1d7)]||_0x2f1ec3[_0x5da9a6(0x1a6)])return await handleSDKOutput(_0x57eb63,_0x2f1ec3),0x0;return displayFieldsHumanReadable(_0x57eb63,_0x5c7d97),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a29_0x3f507c(0x1c2);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x20f);async[a29_0x3f507c(0x15f)](_0x1aeb0a){const _0x434f15=a29_0x3f507c,{options:_0x35ad05,args:_0x2aa193,tdx:_0x2dadbc}=_0x1aeb0a,_0x3e31ee=_0x35ad05,_0x2e1601=_0x2aa193[0x0]||_0x35ad05['parentSegment'];if(!_0x2e1601)return showParentSegmentNotSetError(_0x434f15(0x225)+_0x434f15(0x17d)+_0x434f15(0x1ed)+_0x434f15(0x195)),0x1;_0x35ad05['verbose']&&(console[_0x434f15(0x1ec)](_0x434f15(0x1a8)+_0x35ad05[_0x434f15(0x1e3)]),console['error']('Parent\x20segment:\x20'+_0x2e1601));const _0x335c5=await withSpinner(_0x434f15(0x256)+_0x2e1601+'\x27...',()=>_0x2dadbc[_0x434f15(0x245)]['getParentFull'](_0x2e1601),{'verbose':_0x35ad05[_0x434f15(0x21c)]}),_0x1e51b6=_0x335c5[_0x434f15(0x21e)];if(_0x3e31ee[_0x434f15(0x1de)]){const _0x432c18=getConsoleNextUrl(_0x3e31ee[_0x434f15(0x1e3)],_0x434f15(0x22f)+_0x1e51b6['id']);return console['error'](a29_0x3b8643['green']('✔')+_0x434f15(0x24a)+a29_0x3b8643['cyan'](_0x432c18)),openBrowser(_0x432c18),0x0;}return await handleSingleObjectOutput(_0x1e51b6,_0x35ad05),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x3f507c(0x267)]=a29_0x3f507c(0x24e);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1e2);async[a29_0x3f507c(0x15f)](_0x55edfd){const _0x27269a=a29_0x3f507c,{options:_0x11bf89,args:_0x24de5e,tdx:_0xc8365c}=_0x55edfd,_0x4f2f26=_0x24de5e[0x0]||_0x11bf89[_0x27269a(0x1af)];if(!_0x4f2f26)return showParentSegmentNotSetError(_0x27269a(0x218)+_0x27269a(0x166)),0x1;_0x11bf89[_0x27269a(0x21c)]&&(console[_0x27269a(0x1ec)](_0x27269a(0x1a8)+_0x11bf89['site']),console[_0x27269a(0x1ec)](_0x27269a(0x19c)+_0x4f2f26));const _0x42e474=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x4f2f26+_0x27269a(0x273),()=>_0xc8365c[_0x27269a(0x245)][_0x27269a(0x1f9)](_0x4f2f26),{'verbose':_0x11bf89[_0x27269a(0x21c)]}),_0x1a99ed=_0x42e474['data'],_0x5b337e=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x4f2f26+_0x27269a(0x273),()=>_0xc8365c[_0x27269a(0x245)]['getParentSQL'](_0x1a99ed),{'verbose':_0x11bf89['verbose']}),_0x57673a=await executeSchemaQuery(_0x5b337e[_0x27269a(0x21e)],_0xc8365c,_0x11bf89);return await handleQueryOutput(_0x57673a,_0x11bf89),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a29_0x3f507c(0x1e0);[a29_0x3f507c(0x15d)]=a29_0x3f507c(0x1b8);async[a29_0x3f507c(0x15f)](_0x1eb2f9){const _0x3b3b78=a29_0x3f507c,{options:_0x3cafed,args:_0x4bf3cd,tdx:_0x46e019}=_0x1eb2f9,_0x9c9f2c=_0x4bf3cd[0x0]||_0x3cafed[_0x3b3b78(0x1af)];if(!_0x9c9f2c)return showParentSegmentNotSetError(_0x3b3b78(0x259)+_0x3b3b78(0x210)),0x1;_0x3cafed[_0x3b3b78(0x21c)]&&(console['error'](_0x3b3b78(0x1a8)+_0x3cafed[_0x3b3b78(0x1e3)]),console[_0x3b3b78(0x1ec)](_0x3b3b78(0x19c)+_0x9c9f2c));const _0xa5dd9b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x9c9f2c+_0x3b3b78(0x273),()=>_0x46e019[_0x3b3b78(0x245)][_0x3b3b78(0x1f9)](_0x9c9f2c),{'verbose':_0x3cafed[_0x3b3b78(0x21c)]}),_0xc3e843=_0xa5dd9b['data'],_0x1ed49d=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x9c9f2c+_0x3b3b78(0x273),()=>_0x46e019[_0x3b3b78(0x245)][_0x3b3b78(0x23f)](_0xc3e843),{'verbose':_0x3cafed[_0x3b3b78(0x21c)]}),_0x5f3fbb=_0x1ed49d[_0x3b3b78(0x21e)];return _0x3cafed[_0x3b3b78(0x1da)]===_0x3b3b78(0x1d7)||_0x3cafed['format']==='jsonl'?await handleSDKOutput([{'sql':_0x5f3fbb}],_0x3cafed):console[_0x3b3b78(0x237)](_0x5f3fbb),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{['name']='segment:parent:show';['description']=a29_0x3f507c(0x20d);async['execute'](_0xd488b1){const _0x37f422=a29_0x3f507c,{options:_0x5cd969,args:_0x97f371,tdx:_0xd7ed0b}=_0xd488b1,_0x3d8abd=_0x97f371[0x0]||_0x5cd969['parentSegment'];if(!_0x3d8abd)return showParentSegmentNotSetError(_0x37f422(0x261)+_0x37f422(0x1cc)),0x1;_0x5cd969['verbose']&&(console[_0x37f422(0x1ec)]('Site:\x20'+_0x5cd969[_0x37f422(0x1e3)]),console['error']('Parent\x20segment:\x20'+_0x3d8abd));const _0x515ee3=await withSpinner(_0x37f422(0x1e1)+_0x3d8abd+_0x37f422(0x273),()=>_0xd7ed0b[_0x37f422(0x245)][_0x37f422(0x1f9)](_0x3d8abd),{'verbose':_0x5cd969[_0x37f422(0x21c)]}),_0x13e435=_0x515ee3[_0x37f422(0x21e)],_0x3c40d4=await withSpinner(_0x37f422(0x18f)+_0x3d8abd+_0x37f422(0x273),()=>_0xd7ed0b[_0x37f422(0x245)][_0x37f422(0x23f)](_0x13e435),{'verbose':_0x5cd969[_0x37f422(0x21c)]});let _0x5ddce5=_0x3c40d4[_0x37f422(0x21e)];const _0x147a92=resolveLimit(_0x5cd969['limit'],DEFAULT_DISPLAY_LIMIT),_0x54dd9a=/\bLIMIT\s+\d+/i['test'](_0x5ddce5);!_0x54dd9a&&(_0x5ddce5=_0x5ddce5[_0x37f422(0x15b)]()['replace'](/;+$/,''),_0x5ddce5='SELECT\x20*\x20FROM\x20(\x0a'+_0x5ddce5+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x147a92);_0x5cd969[_0x37f422(0x21c)]&&console[_0x37f422(0x1ec)](_0x37f422(0x1b5)+_0x5ddce5);const _0x53ec54=await withQuerySpinner(_0x37f422(0x235),async _0xa1c70a=>{const _0x3a7d0c=_0x37f422,_0x1f8795=await _0xd7ed0b[_0x3a7d0c(0x15c)][_0x3a7d0c(0x15f)](_0x5ddce5,{'catalog':'td','schema':'information_schema','onJobId':_0x421652=>{_0xa1c70a['setJobId'](_0x421652);}});return _0x1f8795;},{'verbose':_0x5cd969['verbose']}),_0x42b13e=_0x53ec54[_0x37f422(0x21e)],_0x3c9756=_0x42b13e[_0x37f422(0x1e6)]?'\x20[Job\x20ID:\x20'+_0x42b13e[_0x37f422(0x1e6)]+']':'';return console[_0x37f422(0x1ec)](_0x37f422(0x208)+_0x42b13e[_0x37f422(0x22c)][_0x37f422(0x23d)][_0x37f422(0x1c7)]()+'\x20rows\x20'+(_0x37f422(0x262)+formatElapsed(_0x42b13e[_0x37f422(0x22c)][_0x37f422(0x21b)])+_0x3c9756)),await handleQueryOutput(_0x42b13e,_0x5cd969),0x0;}}
1
+ const a29_0x354af5=a29_0x28e4;(function(_0x40209a,_0x41d556){const _0x559e20=a29_0x28e4,_0x54cd2f=_0x40209a();while(!![]){try{const _0xcee8da=-parseInt(_0x559e20(0x23f))/0x1+parseInt(_0x559e20(0x280))/0x2+-parseInt(_0x559e20(0x1d4))/0x3+-parseInt(_0x559e20(0x1a0))/0x4+parseInt(_0x559e20(0x1db))/0x5*(-parseInt(_0x559e20(0x1e9))/0x6)+parseInt(_0x559e20(0x1f9))/0x7*(-parseInt(_0x559e20(0x258))/0x8)+parseInt(_0x559e20(0x251))/0x9*(parseInt(_0x559e20(0x17b))/0xa);if(_0xcee8da===_0x41d556)break;else _0x54cd2f['push'](_0x54cd2f['shift']());}catch(_0x305180){_0x54cd2f['push'](_0x54cd2f['shift']());}}}(a29_0x1024,0x6c6a2));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x45cb35 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';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x265ace from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';function a29_0x28e4(_0x1d4f42,_0x12dae2){_0x1d4f42=_0x1d4f42-0x16b;const _0x102450=a29_0x1024();let _0x28e42f=_0x102450[_0x1d4f42];return _0x28e42f;}const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a29_0x354af5(0x1d2);function openBrowser(_0x11513c){const _0xffd2aa=a29_0x354af5,_0x3f94e2=process['platform'],_0x263306=_0x3f94e2===_0xffd2aa(0x187)?_0xffd2aa(0x184):_0x3f94e2===_0xffd2aa(0x192)?'start':'xdg-open';spawn(_0x263306,[_0x11513c],{'detached':!![],'stdio':'ignore'})[_0xffd2aa(0x242)]();}function migrateLegacyDirectory(){const _0x5af697=a29_0x354af5;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x271364=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x271364[_0x5af697(0x193)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x5af697(0x233)](a29_0x265ace['yellow'](_0x5af697(0x1fc)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x5af697(0x233)](a29_0x265ace[_0x5af697(0x1e1)](_0x5af697(0x290)+LEGACY_PARENT_SEGMENT_DIR+_0x5af697(0x225))),![];console[_0x5af697(0x233)](a29_0x265ace[_0x5af697(0x190)](_0x5af697(0x1ac)+LEGACY_PARENT_SEGMENT_DIR+_0x5af697(0x1ec)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x5af697(0x233)](a29_0x265ace['green'](_0x5af697(0x212)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x15960c){const _0x62d10e=_0x15960c instanceof Error?_0x15960c[_0x5af697(0x185)]:String(_0x15960c);return console[_0x5af697(0x233)](a29_0x265ace[_0x5af697(0x1a2)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x62d10e+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x354af5(0x18e)](_0x50c78e){return migrateLegacyDirectory(),super['run'](_0x50c78e);}}function resolveYamlFile(_0x2e4024){const _0x5c47b0=a29_0x354af5;if(_0x2e4024[_0x5c47b0(0x1eb)](_0x5c47b0(0x1bf))||_0x2e4024[_0x5c47b0(0x1eb)]('.yaml'))return _0x2e4024;return a29_0x45cb35[_0x5c47b0(0x1e4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2e4024)+_0x5c47b0(0x1bf));}function formatProgressMessage(_0x44c12d){const _0x5ea6f5=a29_0x354af5,_0x4b56e0=_0x44c12d[_0x5ea6f5(0x248)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4b56e0){const [,_0x23897d,_0xff70d1,_0x5348c5='']=_0x4b56e0;return a29_0x265ace[_0x5ea6f5(0x1e1)](_0x23897d+':')+'\x20'+_0xff70d1+a29_0x265ace[_0x5ea6f5(0x1e1)](_0x5348c5);}return a29_0x265ace['dim'](_0x44c12d);}function showFileNotFoundError(_0x195ea9,_0x26ba4e){const _0x1c11b2=a29_0x354af5;console['error'](a29_0x265ace[_0x1c11b2(0x1a2)](_0x1c11b2(0x298)+_0x195ea9+'\x0a')),console[_0x1c11b2(0x233)](a29_0x265ace[_0x1c11b2(0x25b)](_0x1c11b2(0x19f)+_0x26ba4e+_0x1c11b2(0x18d)));}function showParentSegmentNotSetError(_0x217bad){const _0x7553d1=a29_0x354af5;console[_0x7553d1(0x233)](a29_0x265ace[_0x7553d1(0x190)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x7553d1(0x233)](_0x217bad);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x354af5(0x1a6);[a29_0x354af5(0x24c)]=a29_0x354af5(0x223);async['execute'](_0x12507c){const _0x300474=a29_0x354af5,{options:_0x1d4d65,args:_0x578fd2,tdx:_0x3d168d}=_0x12507c,_0x1958dc=_0x578fd2[0x0];_0x1d4d65[_0x300474(0x200)]&&(console[_0x300474(0x233)](_0x300474(0x1a8)+_0x1d4d65[_0x300474(0x282)]),_0x1958dc&&console['error'](_0x300474(0x170)+_0x1958dc));const _0x1fd2fb=await withSpinner(_0x1958dc?_0x300474(0x186)+_0x1958dc+'\x27...':_0x300474(0x181),()=>_0x3d168d[_0x300474(0x25e)][_0x300474(0x19b)](),{'verbose':_0x1d4d65[_0x300474(0x200)]});let _0x27c57f=_0x1fd2fb[_0x300474(0x20e)];if(_0x1958dc){const _0xa26915=_0x1958dc['replace'](/[.+^${}()|[\]\\]/g,_0x300474(0x1d1))[_0x300474(0x24b)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x3aea85=new RegExp('^'+_0xa26915+'$','i');_0x27c57f=_0x27c57f[_0x300474(0x238)](_0x38e3b4=>_0x3aea85[_0x300474(0x27f)](_0x38e3b4['attributes'][_0x300474(0x272)]));}_0x27c57f['sort']((_0x5b9010,_0x438a0d)=>_0x5b9010[_0x300474(0x24d)]['name'][_0x300474(0x198)](_0x438a0d[_0x300474(0x24d)]['name'])),console['error'](_0x300474(0x245)+_0x27c57f['length']+_0x300474(0x1e2)+(_0x27c57f[_0x300474(0x24a)]!==0x1?'s':''));if(_0x1d4d65[_0x300474(0x17f)]===_0x300474(0x295)||_0x1d4d65[_0x300474(0x17f)]===_0x300474(0x18a))await handleSDKOutput(_0x27c57f,_0x1d4d65);else{if(_0x27c57f[_0x300474(0x24a)]===0x0)_0x1958dc?console['log'](_0x300474(0x1f7)+_0x1958dc):console[_0x300474(0x208)](_0x300474(0x209));else for(const _0xeeb2ac of _0x27c57f){const _0x242ec2=_0xeeb2ac[_0x300474(0x24d)][_0x300474(0x1be)]?a29_0x265ace['dim']('\x20('+formatRows(_0xeeb2ac[_0x300474(0x24d)]['population'])+')'):'';console['log'](_0x300474(0x218)+_0xeeb2ac[_0x300474(0x24d)][_0x300474(0x272)]+_0x242ec2);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x257);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1cf);async['execute'](_0x3a5feb){const _0x5d58ae=a29_0x354af5,{options:_0x16ab59,args:_0x15cb5f,tdx:_0x4fdcc0}=_0x3a5feb;console[_0x5d58ae(0x233)](_0x5d58ae(0x255)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x532e7e=_0x16ab59;if(_0x15cb5f[_0x5d58ae(0x24a)]===0x0)return console[_0x5d58ae(0x233)](a29_0x265ace[_0x5d58ae(0x1a2)](_0x5d58ae(0x1c2))),console[_0x5d58ae(0x233)](_0x5d58ae(0x1a4)),0x1;const _0x2cc029=_0x15cb5f[0x0];if(!_0x532e7e[_0x5d58ae(0x20a)]||!_0x532e7e[_0x5d58ae(0x268)])return console[_0x5d58ae(0x233)](_0x5d58ae(0x17c)),console[_0x5d58ae(0x233)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x532e7e[_0x5d58ae(0x200)]&&(console[_0x5d58ae(0x233)](_0x5d58ae(0x1a8)+_0x532e7e['site']),console[_0x5d58ae(0x233)](_0x5d58ae(0x217)+_0x2cc029),console['error'](_0x5d58ae(0x1dc)+_0x532e7e[_0x5d58ae(0x20a)]),console[_0x5d58ae(0x233)](_0x5d58ae(0x25d)+_0x532e7e[_0x5d58ae(0x268)]));const _0x58ad47=await loadJSONFromOptions(_0x532e7e['attributes'],_0x532e7e['attributesFile']),_0x40ce25=await loadJSONFromOptions(_0x532e7e[_0x5d58ae(0x194)],_0x532e7e[_0x5d58ae(0x1ee)]),_0x285f2d=await loadJSONFromOptions(_0x532e7e[_0x5d58ae(0x1df)],_0x532e7e[_0x5d58ae(0x224)]),_0x2e0ff6={'name':_0x2cc029,'description':_0x532e7e['description'],'scheduleType':_0x532e7e[_0x5d58ae(0x1bc)],'scheduleOption':_0x532e7e[_0x5d58ae(0x16c)],'timezone':_0x532e7e[_0x5d58ae(0x172)],'master':{'parentDatabaseName':_0x532e7e[_0x5d58ae(0x20a)],'parentTableName':_0x532e7e['table']},'attributes':_0x58ad47,'behaviors':_0x40ce25,'customerGroup':_0x285f2d},_0x58cb13=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x2cc029+_0x5d58ae(0x1a5),()=>_0x4fdcc0[_0x5d58ae(0x25e)][_0x5d58ae(0x250)](_0x2e0ff6),{'verbose':_0x16ab59[_0x5d58ae(0x200)]}),_0x165927=_0x58cb13[_0x5d58ae(0x20e)];return console[_0x5d58ae(0x233)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x165927[_0x5d58ae(0x272)]+'\x27\x20with\x20ID:\x20'+_0x165927['id']),await handleSDKOutput([_0x165927],_0x16ab59),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x354af5(0x272)]='segment:parent:update';['description']=a29_0x354af5(0x1ab);async[a29_0x354af5(0x20d)](_0x19cf2){const _0xf9564=a29_0x354af5,{options:_0x452685,args:_0x20ba05,tdx:_0x64fa26}=_0x19cf2;console[_0xf9564(0x233)](_0xf9564(0x292)+_0xf9564(0x288)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1d0005=_0x452685;if(_0x20ba05[_0xf9564(0x24a)]===0x0)return console[_0xf9564(0x233)](a29_0x265ace[_0xf9564(0x1a2)](_0xf9564(0x1c2))),console[_0xf9564(0x233)](_0xf9564(0x29a)),0x1;const _0x5b21cc=_0x20ba05[0x0];_0x1d0005[_0xf9564(0x200)]&&(console[_0xf9564(0x233)](_0xf9564(0x1a8)+_0x1d0005[_0xf9564(0x282)]),console['error'](_0xf9564(0x1de)+_0x5b21cc));const _0x3872ad=await withSpinner(_0xf9564(0x1c9)+_0x5b21cc+'\x27...',()=>_0x64fa26[_0xf9564(0x25e)][_0xf9564(0x264)](_0x5b21cc),{'verbose':_0x1d0005[_0xf9564(0x200)]}),_0x4ec605=_0x3872ad[_0xf9564(0x20e)],_0x48ca73=await loadJSONFromOptions(_0x1d0005[_0xf9564(0x1b1)],_0x1d0005[_0xf9564(0x21f)]),_0x284ca7=await loadJSONFromOptions(_0x1d0005[_0xf9564(0x1d8)],_0x1d0005[_0xf9564(0x171)]),_0x563599={'name':_0x4ec605[_0xf9564(0x272)],'description':_0x1d0005[_0xf9564(0x24c)]!==undefined?_0x1d0005['description']:_0x4ec605[_0xf9564(0x24c)],'scheduleType':_0x1d0005['scheduleType']!==undefined?_0x1d0005[_0xf9564(0x1bc)]:_0x4ec605[_0xf9564(0x1bc)],'scheduleOption':_0x1d0005['scheduleOption']!==undefined?_0x1d0005[_0xf9564(0x16c)]:_0x4ec605['scheduleOption'],'timezone':_0x1d0005[_0xf9564(0x172)]!==undefined?_0x1d0005[_0xf9564(0x172)]:_0x4ec605[_0xf9564(0x172)],'master':_0x4ec605[_0xf9564(0x1d7)],'attributes':_0x48ca73?[..._0x4ec605[_0xf9564(0x24d)]||[],..._0x48ca73]:_0x4ec605[_0xf9564(0x24d)],'behaviors':_0x284ca7?[..._0x4ec605['behaviors']||[],..._0x284ca7]:_0x4ec605[_0xf9564(0x194)],'customerGroup':_0x4ec605[_0xf9564(0x1df)]},_0xe49147=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x5b21cc+_0xf9564(0x1a5),()=>_0x64fa26[_0xf9564(0x25e)]['updateParent'](_0x5b21cc,_0x563599),{'verbose':_0x1d0005[_0xf9564(0x200)]}),_0x4cf63b=_0xe49147[_0xf9564(0x20e)];return console[_0xf9564(0x233)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x4cf63b[_0xf9564(0x272)]+'\x27'),await handleSDKOutput([_0x4cf63b],_0x1d0005),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a29_0x354af5(0x230);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1f4);async[a29_0x354af5(0x20d)](_0x4ec206){const _0x276e4f=a29_0x354af5,{options:_0x5af38f,args:_0xf2c79d,tdx:_0x2a71a2}=_0x4ec206,_0x29e5f9=_0x5af38f,_0x3cf812=_0xf2c79d[0x0]||_0x5af38f[_0x276e4f(0x20b)];if(!_0x3cf812)return showParentSegmentNotSetError(_0x276e4f(0x270)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x29e5f9[_0x276e4f(0x1f3)]&&_0x29e5f9[_0x276e4f(0x22f)])return console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1a2)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1e1)](_0x276e4f(0x17d))),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1e1)](_0x276e4f(0x22b)+PARENT_SEGMENT_DIR+_0x276e4f(0x249))),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x25b)](_0x276e4f(0x1fa))),0x1;const _0xbbc7e6=_0x29e5f9[_0x276e4f(0x22f)]||a29_0x45cb35[_0x276e4f(0x1e4)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3cf812)+_0x276e4f(0x1bf));_0x29e5f9['verbose']&&(console[_0x276e4f(0x233)](_0x276e4f(0x1a8)+_0x29e5f9['site']),console[_0x276e4f(0x233)](_0x276e4f(0x1de)+_0x3cf812),console[_0x276e4f(0x233)](_0x276e4f(0x283)+_0xbbc7e6));const _0xa15c7a=await withSpinner(_0x276e4f(0x189)+_0x3cf812+_0x276e4f(0x1a5),()=>_0x2a71a2[_0x276e4f(0x25e)]['pullParentYaml'](_0x3cf812),{'verbose':_0x29e5f9[_0x276e4f(0x200)]}),_0x5c4789=_0xa15c7a[_0x276e4f(0x20e)];if(existsSync(_0xbbc7e6)){const _0x2bbb66=readFileSync(_0xbbc7e6,_0x276e4f(0x1ae)),_0x64e7dc=generateDiff(_0x2bbb66,_0x5c4789);if(!hasChanges(_0x64e7dc))console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1c7)]('✔')+_0x276e4f(0x179)+a29_0x265ace[_0x276e4f(0x25b)](_0xbbc7e6)+_0x276e4f(0x1ea));else{console[_0x276e4f(0x233)]('\x0aChanges\x20to\x20\x27'+_0xbbc7e6+'\x27:'),console[_0x276e4f(0x233)]('─'[_0x276e4f(0x28c)](0x3c)),console[_0x276e4f(0x233)](formatDiffWithColors(_0x64e7dc)),console[_0x276e4f(0x233)]('─'[_0x276e4f(0x28c)](0x3c));if(!_0x29e5f9['yes']){const _0x9760f1=await confirmKey(_0x276e4f(0x1f2)+_0xbbc7e6+'\x27?');if(!_0x9760f1)return console[_0x276e4f(0x233)](_0x276e4f(0x199)),0x1;}writeFileSync(_0xbbc7e6,_0x5c4789,_0x276e4f(0x1ae)),console[_0x276e4f(0x233)](a29_0x265ace[_0x276e4f(0x1c7)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a29_0x265ace[_0x276e4f(0x25b)](_0xbbc7e6));}}else{const _0x29d484=a29_0x45cb35[_0x276e4f(0x219)](_0xbbc7e6);!existsSync(_0x29d484)&&mkdirSync(_0x29d484,{'recursive':!![]}),writeFileSync(_0xbbc7e6,_0x5c4789,_0x276e4f(0x1ae)),console['error'](a29_0x265ace[_0x276e4f(0x1c7)]('✔')+_0x276e4f(0x195)+a29_0x265ace['cyan'](_0xbbc7e6));}return saveSessionContext({'parent_segment':_0x3cf812},_0x29e5f9[_0x276e4f(0x285)]),console[_0x276e4f(0x233)](a29_0x265ace['green']('✔')+_0x276e4f(0x1f6)+a29_0x265ace[_0x276e4f(0x1e1)]('parent_segment')+'\x20=\x20'+a29_0x265ace['cyan'](_0x3cf812)),0x0;}}function a29_0x1024(){const _0xcf2c40=['green','\x20Opening\x20','Fetching\x20current\x20configuration\x20for\x20\x27','Listing\x20fields\x20for\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x20rows\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','customersWithEvents','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x5c$&','parent_segment','\x20--attribute\x20\x22','2398077NgiNHg','\x20parent\x20segment\x20\x27','coveragePercent','master','addBehaviors','workflowSessionId','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','1434635SKkWXq','Database:\x20','SQL\x20query:\x0a','Parent\x20segment:\x20','customerGroup','Show\x20parent\x20segment\x20details','dim','\x20parent\x20segment','segment:parent:fields','join','Updating','Enriched:','workflowId','Creating','6QgnIVj','\x20is\x20already\x20up\x20to\x20date','endsWith','/\x20→\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','behaviorsFile','toFixed','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','displayValidateResults','Overwrite\x20\x27','use','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','segment:parent:push','\x20Context\x20set:\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','22211PGiGXD','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Updated','\x0a⚠️\x20\x20Both\x20','\x20field','number','\x0a✔\x20Workflow\x20started','verbose','Options:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','keys','preview','%)\x20','displayAttributesStats','segment:parent:validate','log','No\x20parent\x20segments\x20found','database','parentSegment','displayColumns','execute','data','sampleData','Join:','Error\x20reading\x20file:\x20','✔\x20Renamed\x20directory\x20to\x20','segment:parent:desc','joinKey','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x20kill','Name:\x20','👥\x20','dirname','Customers:','string','in\x20','runParent','Executing\x20parent\x20segment\x20query...','addAttributesFile','validateParentYaml','\x27\x20is\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','List\x20parent\x20segments','customerGroupFile','/\x20directory.\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','✔\x20Query\x20completed:\x20Processed\x20','jobId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','using\x20the\x20default\x20path:\x20','text','behavior','Analyzing\x20changes...','output','segment:parent:pull','Fetching\x20sample\x20data...','\x0aUsage:\x20tdx\x20ps\x20preview\x20','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','apply','\x20\x20\x20\x20-\x20','filter','allValid','varchar','Error\x20parsing\x20YAML:\x20','/attempt/','enriched','Master\x20Table','828228CwxlUC','start','/app/dw/parentSegments/','unref','tdx\x20segment\x20parent\x20preview\x20','foreignKey','✔\x20Found\x20','bold','Coverage:','match','/{name}.yml\x0a','length','replace','description','attributes','Columns:','\x20--behavior\x20\x22<name>\x22','createParent','30657699KziZBM','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20rows)','segment:parent:create','2168pRFKId','Get\x20SQL\x20query\x20for\x20parent\x20segment','Created','cyan','\x20--enriched','Table:\x20','segment','Options:\x0a','customerPercent','displayPreviewResults','displayPreviewHints','query','getParentFull','List\x20available\x20fields\x20for\x20segmentation','segment:parent:preview','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','table','To\x20cancel:','Apply\x20changes\x20to\x20\x27','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Rows:','Join\x20on:','Events:','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','displayMasterInfo','name','audienceId','segment:parent:run','displaySampleData','previewParentYaml','\x27\x20is\x20already\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','trim','map','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','test','461544NtwaRx','column','site','Output\x20file:\x20','Validate:','session','Master:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20--attribute\x20\x22<name>\x22','Source:','columns','repeat','Attempt:','elapsedTimeMillis','Found\x20YAML\x20file:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','stats','json','\x0aNew\x20parent\x20segment\x20\x27','To\x20view\x20sample\x20data:','Error:\x20File\x20not\x20found:\x20','schemaError','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','segment:parent:sql','scheduleOption','Available\x20behaviors:','✔\x20No\x20changes\x20-\x20\x27','displayBehaviorsStats','Pattern:\x20','addBehaviorsFile','timezone','totalEvents','web','all','errors','double','status','\x20No\x20changes\x20-\x20','Master\x20+\x20Attributes','10wxzMnC','Error:\x20--database\x20and\x20--table\x20are\x20required','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','information_schema','format','displaySummary','Listing\x20parent\x20segments...','\x20\x20No\x20sample\x20data\x20available','interval','open','message','Listing\x20parent\x20segments\x20matching\x20\x27','darwin','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Fetching\x20parent\x20segment\x20\x27','jsonl','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','\x27\x20and\x20run\x20workflow?','`\x20to\x20download\x20the\x20configuration\x20first','run','Status:','yellow','Fetching\x20SQL\x20for\x20\x27','win32','isDirectory','behaviors','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20Configuration\x20is\x20valid','yes','localeCompare','Aborted.','segment:parent:show','listParents','Error:\x20--attribute\x20requires\x20a\x20name\x0a','FINISHED','Attribute:','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','1674880aIGRkg','toLocaleString','red','label','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x27...','segment:parent:list','getParentSQL','Site:\x20','/app/workflows/','attribute','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0a⚠️\x20\x20Migrating:\x20','Options\x20(one\x20required):\x0a','utf-8','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','rowCount','addAttributes','Resolving\x20parent\x20segment\x20\x27','Error:','matchedCount','workflowAttemptId','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','-1d','Create\x20parent\x20segment\x20\x27','\x20--behavior\x20\x22','resolveParentId','scheduleType','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','population','.yml','schemaValid','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','Errors:','stop','listFields','\x20=\x20'];a29_0x1024=function(){return _0xcf2c40;};return a29_0x1024();}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x1f5);[a29_0x354af5(0x24c)]=a29_0x354af5(0x252);async[a29_0x354af5(0x20d)](_0x5b86af){const _0xbe9049=a29_0x354af5,{options:_0x542528,args:_0x9f4ced,tdx:_0x3c9a34}=_0x5b86af,_0x3de9c1=_0x542528,_0x211fcb=_0x9f4ced[0x0]||_0x542528[_0xbe9049(0x20b)];if(!_0x211fcb)return showParentSegmentNotSetError(_0xbe9049(0x222)+_0xbe9049(0x27e)),0x1;const _0x5e5085=resolveYamlFile(_0x211fcb);if(!existsSync(_0x5e5085))return showFileNotFoundError(_0x5e5085,_0x211fcb),0x1;_0x3de9c1['verbose']&&(console['error'](_0xbe9049(0x1a8)+_0x3de9c1[_0xbe9049(0x282)]),console[_0xbe9049(0x233)](_0xbe9049(0x26b)+_0x5e5085));let _0x3f557a;try{_0x3f557a=readFileSync(_0x5e5085,_0xbe9049(0x1ae));}catch(_0x4e7f11){const _0x2ea1c2=_0x4e7f11 instanceof Error?_0x4e7f11[_0xbe9049(0x185)]:String(_0x4e7f11);return console[_0xbe9049(0x233)](_0xbe9049(0x211)+_0x2ea1c2),0x1;}const _0x1d6b08=await withSpinner(_0xbe9049(0x22e),()=>_0x3c9a34[_0xbe9049(0x25e)]['pushParentYaml'](_0x3f557a),{'verbose':_0x3de9c1[_0xbe9049(0x200)]}),_0x572366=_0x1d6b08[_0xbe9049(0x20e)],{isNew:_0x19cd51,name:_0x56b503,hasChanges:_0x32a44c,diffFormatted:_0x46be03}=_0x572366;if(!_0x32a44c)return console[_0xbe9049(0x233)](_0xbe9049(0x16e)+_0x56b503+_0xbe9049(0x277)),0x0;_0x19cd51?console[_0xbe9049(0x233)](_0xbe9049(0x296)+_0x56b503+'\x27:'):console[_0xbe9049(0x233)](_0xbe9049(0x1b6)+_0x56b503+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0xbe9049(0x233)](_0x46be03),console[_0xbe9049(0x233)]('─'['repeat'](0x3c));const _0x53356f=_0x19cd51?'Create\x20parent\x20segment\x20\x27'+_0x56b503+'\x27?':_0xbe9049(0x26a)+_0x56b503+'\x27?';if(!_0x3de9c1[_0xbe9049(0x197)]){const _0x385e38=await confirmKey(_0x53356f);if(!_0x385e38)return console['error'](_0xbe9049(0x199)),0x1;}const _0x42f63c=_0x19cd51?'Creating':_0xbe9049(0x1e5),_0x3696c7=await withSpinner(_0x42f63c+'\x20parent\x20segment\x20\x27'+_0x56b503+_0xbe9049(0x1a5),()=>_0x572366['apply'](),{'verbose':_0x3de9c1['verbose']}),_0x28e03f=_0x3696c7[_0xbe9049(0x20e)],_0x2e852e=getConsoleNextUrl(_0x3de9c1[_0xbe9049(0x282)],'/app/dw/parentSegments/'+_0x28e03f['id']),_0x488b2e=_0x19cd51?_0xbe9049(0x25a):_0xbe9049(0x1fb);return console[_0xbe9049(0x233)]('✔\x20'+_0x488b2e+_0xbe9049(0x1d5)+_0x28e03f[_0xbe9049(0x272)]+'\x27'),console[_0xbe9049(0x233)]('\x20\x20'+_0x2e852e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x207);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1f0);async['execute'](_0x2eda68){const _0x3486e5=a29_0x354af5,{options:_0x4d54bd,args:_0x3edbd9,tdx:_0x39d44e}=_0x2eda68,_0x4d1fc8=_0x4d54bd,_0x401146=_0x3edbd9[0x0]||_0x4d54bd[_0x3486e5(0x20b)];if(!_0x401146)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x3486e5(0x229)+_0x3486e5(0x25f)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x3486e5(0x291)+_0x3486e5(0x1da)),0x1;const _0xf990fd=resolveYamlFile(_0x401146);if(!existsSync(_0xf990fd))return showFileNotFoundError(_0xf990fd,_0x401146),0x1;_0x4d1fc8[_0x3486e5(0x200)]&&(console[_0x3486e5(0x233)](_0x3486e5(0x1a8)+_0x4d1fc8['site']),console['error'](_0x3486e5(0x26b)+_0xf990fd));let _0x2f5f08;try{_0x2f5f08=readFileSync(_0xf990fd,_0x3486e5(0x1ae));}catch(_0x2a6d5c){const _0x208c65=_0x2a6d5c instanceof Error?_0x2a6d5c['message']:String(_0x2a6d5c);return console[_0x3486e5(0x233)](_0x3486e5(0x211)+_0x208c65),0x1;}const _0x38e50f=createCommandSpinner(a29_0x265ace[_0x3486e5(0x1e1)]('Validating\x20configuration...'),{'verbose':_0x4d1fc8[_0x3486e5(0x200)]});_0x38e50f['start']();const _0x5811e7={'onProgress':_0x550d27=>{const _0x5bb2ed=_0x3486e5;_0x38e50f[_0x5bb2ed(0x22c)]=formatProgressMessage(_0x550d27);}};if(_0x4d1fc8[_0x3486e5(0x1d7)])_0x5811e7['master']=!![];if(_0x4d1fc8[_0x3486e5(0x23d)])_0x5811e7[_0x3486e5(0x23d)]=!![];_0x4d1fc8[_0x3486e5(0x1aa)]&&(_0x5811e7[_0x3486e5(0x1aa)]=_0x4d1fc8[_0x3486e5(0x1aa)]);_0x4d1fc8[_0x3486e5(0x22d)]&&(_0x5811e7['behavior']=_0x4d1fc8[_0x3486e5(0x22d)]);if(_0x4d1fc8['interval'])_0x5811e7[_0x3486e5(0x183)]=_0x4d1fc8['interval'];let _0x3438bf;try{_0x3438bf=await _0x39d44e['segment'][_0x3486e5(0x220)](_0x2f5f08,_0x5811e7),_0x38e50f[_0x3486e5(0x1c4)]();}catch(_0x17d8c5){_0x38e50f[_0x3486e5(0x1c4)]();throw _0x17d8c5;}const _0x3f6ff4=_0x4d1fc8['interval']||_0x3486e5(0x1b8);return this[_0x3486e5(0x1f1)](_0x3438bf,_0x5811e7,_0xf990fd,_0x3f6ff4),_0x3438bf['allValid']?0x0:0x1;}[a29_0x354af5(0x1f1)](_0x3105db,_0x10e569,_0xa17ab7,_0x13eb89){const _0x5b2430=a29_0x354af5;console[_0x5b2430(0x233)]('\x0a'+a29_0x265ace[_0x5b2430(0x246)](_0x5b2430(0x284))+'\x20'+_0x3105db[_0x5b2430(0x272)]),console[_0x5b2430(0x233)]('═'['repeat'](0x3c)),this['displayMasterInfo'](_0x3105db);if(typeof _0x10e569[_0x5b2430(0x1aa)]===_0x5b2430(0x21b)){this['displayAttributesStats'](_0x3105db),this[_0x5b2430(0x180)](_0x3105db),this['displayPreviewHints'](_0xa17ab7,_0x13eb89,'attribute',_0x10e569['attribute']);return;}if(_0x10e569[_0x5b2430(0x1aa)]===!![]){this[_0x5b2430(0x206)](_0x3105db),this[_0x5b2430(0x180)](_0x3105db),this['displayPreviewHints'](_0xa17ab7,_0x13eb89,_0x5b2430(0x24d));return;}if(typeof _0x10e569[_0x5b2430(0x22d)]===_0x5b2430(0x21b)){this[_0x5b2430(0x16f)](_0x3105db,_0x13eb89),this[_0x5b2430(0x180)](_0x3105db),this[_0x5b2430(0x262)](_0xa17ab7,_0x13eb89,_0x5b2430(0x22d),_0x10e569[_0x5b2430(0x22d)]);return;}if(_0x10e569[_0x5b2430(0x22d)]===!![]){this['displayBehaviorsStats'](_0x3105db,_0x13eb89),this[_0x5b2430(0x180)](_0x3105db),this[_0x5b2430(0x262)](_0xa17ab7,_0x13eb89,_0x5b2430(0x194));return;}this['displayAttributesStats'](_0x3105db),this[_0x5b2430(0x16f)](_0x3105db,_0x13eb89),this[_0x5b2430(0x180)](_0x3105db),this['displayPreviewHints'](_0xa17ab7,_0x13eb89,_0x5b2430(0x175));}[a29_0x354af5(0x262)](_0x3cd4c5,_0x5224aa,_0x1b935b,_0x296958){const _0x37180f=a29_0x354af5;console[_0x37180f(0x233)]('\x0a'+a29_0x265ace[_0x37180f(0x1e1)](_0x37180f(0x297)));const _0x4f3716=_0x5224aa!==_0x37180f(0x1b8)?'\x20--interval\x20'+_0x5224aa:'';if(_0x1b935b===_0x37180f(0x1aa)&&_0x296958)console['error']('\x20\x20'+a29_0x265ace['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x3cd4c5+_0x37180f(0x1d3)+_0x296958+'\x22'+_0x4f3716));else{if(_0x1b935b===_0x37180f(0x22d)&&_0x296958)console[_0x37180f(0x233)]('\x20\x20'+a29_0x265ace[_0x37180f(0x1e1)]('tdx\x20segment\x20parent\x20preview\x20'+_0x3cd4c5+_0x37180f(0x1ba)+_0x296958+'\x22'+_0x4f3716));else(_0x1b935b===_0x37180f(0x24d)||_0x1b935b===_0x37180f(0x175))&&console['error']('\x20\x20'+a29_0x265ace['dim'](_0x37180f(0x243)+_0x3cd4c5+_0x37180f(0x289)+_0x4f3716));}(_0x1b935b===_0x37180f(0x194)||_0x1b935b===_0x37180f(0x175))&&console['error']('\x20\x20'+a29_0x265ace['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x3cd4c5+_0x37180f(0x24f)+_0x4f3716)),_0x1b935b===_0x37180f(0x175)&&console[_0x37180f(0x233)]('\x20\x20'+a29_0x265ace['dim'](_0x37180f(0x243)+_0x3cd4c5+_0x37180f(0x25c)+_0x4f3716));}[a29_0x354af5(0x271)](_0x1e3dba){const _0x1eb793=a29_0x354af5,{master:_0x32c5c2}=_0x1e3dba,_0x536377=_0x32c5c2[_0x1eb793(0x1c0)]?a29_0x265ace[_0x1eb793(0x1c7)]('✔'):a29_0x265ace[_0x1eb793(0x1a2)]('✘');console['error']('\x0a'+a29_0x265ace[_0x1eb793(0x1e1)](_0x1eb793(0x23e))),console[_0x1eb793(0x233)](_0x536377+'\x20'+a29_0x265ace[_0x1eb793(0x246)](_0x32c5c2[_0x1eb793(0x20a)]+'.'+_0x32c5c2[_0x1eb793(0x268)])),_0x32c5c2[_0x1eb793(0x1c0)]?_0x32c5c2[_0x1eb793(0x1b0)]!==undefined&&console['error']('\x20\x20'+a29_0x265ace[_0x1eb793(0x1e1)](_0x1eb793(0x26d))+'\x20'+a29_0x265ace[_0x1eb793(0x25b)](formatRows(_0x32c5c2['rowCount']))):console[_0x1eb793(0x233)]('\x20\x20'+a29_0x265ace[_0x1eb793(0x1a2)](_0x1eb793(0x1b3))+'\x20'+_0x32c5c2[_0x1eb793(0x299)]);}['displayAttributesStats'](_0x42d3ac){const _0x48dc87=a29_0x354af5;if(_0x42d3ac[_0x48dc87(0x24d)][_0x48dc87(0x24a)]===0x0)return;console[_0x48dc87(0x233)]('\x0a'+a29_0x265ace[_0x48dc87(0x1e1)]('Attributes'));for(const _0x1826e of _0x42d3ac['attributes']){const _0x41fa02=_0x1826e[_0x48dc87(0x1c0)]?a29_0x265ace[_0x48dc87(0x1c7)]('✔'):a29_0x265ace[_0x48dc87(0x1a2)]('✘');let _0x53e057='';if(_0x1826e[_0x48dc87(0x1c0)]&&_0x1826e[_0x48dc87(0x1b4)]!==undefined&&_0x1826e[_0x48dc87(0x1d6)]!==undefined){const _0x385f70=_0x1826e[_0x48dc87(0x1d6)]['toFixed'](0x1),_0x234540=_0x1826e['coveragePercent']>=0x50?a29_0x265ace[_0x48dc87(0x1c7)]:_0x1826e[_0x48dc87(0x1d6)]>=0x32?a29_0x265ace[_0x48dc87(0x190)]:a29_0x265ace[_0x48dc87(0x1a2)];_0x53e057='\x20'+a29_0x265ace[_0x48dc87(0x1e1)](_0x48dc87(0x247))+'\x20'+_0x234540(_0x385f70+'%')+'\x20('+formatRows(_0x1826e[_0x48dc87(0x1b4)])+_0x48dc87(0x256);}console[_0x48dc87(0x233)](_0x41fa02+'\x20'+a29_0x265ace[_0x48dc87(0x246)](_0x1826e[_0x48dc87(0x272)])+_0x53e057),console['error']('\x20\x20'+a29_0x265ace[_0x48dc87(0x1e1)](_0x48dc87(0x28a))+'\x20'+a29_0x265ace['bold'](_0x1826e[_0x48dc87(0x20a)]+'.'+_0x1826e[_0x48dc87(0x268)]));const _0x5243b9=_0x1826e[_0x48dc87(0x214)]===_0x1826e[_0x48dc87(0x244)]?a29_0x265ace[_0x48dc87(0x1e1)]('Join\x20on:')+'\x20'+_0x1826e[_0x48dc87(0x214)]:a29_0x265ace['dim'](_0x48dc87(0x210))+'\x20'+_0x1826e[_0x48dc87(0x214)]+_0x48dc87(0x1c6)+_0x1826e['foreignKey'];console[_0x48dc87(0x233)]('\x20\x20'+_0x5243b9),console[_0x48dc87(0x233)]('\x20\x20'+a29_0x265ace[_0x48dc87(0x1e1)](_0x48dc87(0x24e))),this[_0x48dc87(0x20c)](_0x1826e[_0x48dc87(0x28b)]),!_0x1826e['schemaValid']&&console['error']('\x20\x20'+a29_0x265ace[_0x48dc87(0x1a2)](_0x48dc87(0x1b3))+'\x20'+_0x1826e[_0x48dc87(0x299)]);}}[a29_0x354af5(0x16f)](_0x422977,_0xb0d0c8){const _0x518203=a29_0x354af5;if(_0x422977[_0x518203(0x194)][_0x518203(0x24a)]===0x0)return;console[_0x518203(0x233)]('\x0a'+a29_0x265ace[_0x518203(0x1e1)]('Behaviors')+'\x20'+a29_0x265ace[_0x518203(0x1e1)]('('+_0xb0d0c8+')'));for(const _0x537d11 of _0x422977['behaviors']){const _0x339a40=_0x537d11[_0x518203(0x1c0)]?a29_0x265ace['green']('✔'):a29_0x265ace[_0x518203(0x1a2)]('✘');let _0x3986eb='';if(_0x537d11[_0x518203(0x1c0)]&&_0x537d11[_0x518203(0x1ce)]!==undefined&&_0x537d11[_0x518203(0x173)]!==undefined){const _0x39675c=_0x537d11[_0x518203(0x260)]?.[_0x518203(0x1ef)](0x1)||'?',_0x20b8be=(_0x537d11[_0x518203(0x260)]??0x0)>=0x32?a29_0x265ace[_0x518203(0x1c7)]:(_0x537d11[_0x518203(0x260)]??0x0)>=0x14?a29_0x265ace['yellow']:a29_0x265ace[_0x518203(0x1a2)];_0x3986eb='\x20'+a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x21a))+'\x20'+_0x20b8be(formatRows(_0x537d11[_0x518203(0x1ce)]))+'\x20('+_0x39675c+_0x518203(0x205)+a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x26f))+'\x20'+a29_0x265ace['cyan'](formatRows(_0x537d11[_0x518203(0x173)]));}console[_0x518203(0x233)](_0x339a40+'\x20'+a29_0x265ace[_0x518203(0x246)](_0x537d11[_0x518203(0x272)])+_0x3986eb),console[_0x518203(0x233)]('\x20\x20'+a29_0x265ace[_0x518203(0x1e1)]('Source:')+'\x20'+a29_0x265ace[_0x518203(0x246)](_0x537d11[_0x518203(0x20a)]+'.'+_0x537d11[_0x518203(0x268)]));const _0x54c376=_0x537d11[_0x518203(0x214)]===_0x537d11[_0x518203(0x244)]?a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x26e))+'\x20'+_0x537d11[_0x518203(0x214)]:a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x210))+'\x20'+_0x537d11['joinKey']+_0x518203(0x1c6)+_0x537d11[_0x518203(0x244)];console[_0x518203(0x233)]('\x20\x20'+_0x54c376),console[_0x518203(0x233)]('\x20\x20'+a29_0x265ace[_0x518203(0x1e1)](_0x518203(0x24e))),this[_0x518203(0x20c)](_0x537d11['columns']),!_0x537d11['schemaValid']&&console[_0x518203(0x233)]('\x20\x20'+a29_0x265ace[_0x518203(0x1a2)](_0x518203(0x1b3))+'\x20'+_0x537d11['schemaError']);}}[a29_0x354af5(0x20c)](_0x18319b){const _0x4666e2=a29_0x354af5;for(const _0x142d25 of _0x18319b){_0x142d25[_0x4666e2(0x1a3)]===_0x142d25[_0x4666e2(0x281)]||_0x142d25[_0x4666e2(0x281)]==='*'?console[_0x4666e2(0x233)](_0x4666e2(0x237)+_0x142d25['label']):console[_0x4666e2(0x233)]('\x20\x20\x20\x20-\x20'+_0x142d25[_0x4666e2(0x1a3)]+'\x20'+a29_0x265ace['dim']('('+_0x142d25[_0x4666e2(0x281)]+')'));}}[a29_0x354af5(0x180)](_0x1872f9){const _0x2ff344=a29_0x354af5;console[_0x2ff344(0x233)]('─'[_0x2ff344(0x28c)](0x3c));if(_0x1872f9['errors'][_0x2ff344(0x24a)]>0x0){console['error']('\x0a'+a29_0x265ace[_0x2ff344(0x1a2)](_0x2ff344(0x1c3)));for(const _0x1ba519 of _0x1872f9['errors']){console[_0x2ff344(0x233)]('\x20\x20'+a29_0x265ace[_0x2ff344(0x1a2)]('•')+'\x20'+_0x1ba519);}}_0x1872f9[_0x2ff344(0x239)]&&console[_0x2ff344(0x233)]('\x0a'+a29_0x265ace[_0x2ff344(0x1c7)]('✔')+_0x2ff344(0x196));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a29_0x354af5(0x266);[a29_0x354af5(0x24c)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0xfeb788){const _0x5253ed=a29_0x354af5,{options:_0x3a5ad5,args:_0x12e01e,tdx:_0x5b2dc6}=_0xfeb788,_0x4c285e=_0x3a5ad5,_0x5d7065=_0x12e01e[0x0]||_0x3a5ad5[_0x5253ed(0x20b)];if(!_0x5d7065)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x5253ed(0x27c)+_0x5253ed(0x1ad)+_0x5253ed(0x18b)+_0x5253ed(0x188)+_0x5253ed(0x27b)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x5253ed(0x1da)),0x1;if(!_0x4c285e[_0x5253ed(0x1d7)]&&!_0x4c285e['attribute']&&!_0x4c285e[_0x5253ed(0x22d)]&&!_0x4c285e['enriched'])return console['error'](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x253))),console['error'](_0x5253ed(0x1f8)),console[_0x5253ed(0x233)](_0x5253ed(0x201)),console[_0x5253ed(0x233)](_0x5253ed(0x1af)),console[_0x5253ed(0x233)](_0x5253ed(0x254)),console[_0x5253ed(0x233)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5253ed(0x233)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x254710=resolveYamlFile(_0x5d7065);if(!existsSync(_0x254710))return showFileNotFoundError(_0x254710,_0x5d7065),0x1;_0x4c285e[_0x5253ed(0x200)]&&(console[_0x5253ed(0x233)]('Site:\x20'+_0x4c285e[_0x5253ed(0x282)]),console[_0x5253ed(0x233)](_0x5253ed(0x26b)+_0x254710));let _0x4ae82e;try{_0x4ae82e=readFileSync(_0x254710,_0x5253ed(0x1ae));}catch(_0x541701){const _0x320a3b=_0x541701 instanceof Error?_0x541701[_0x5253ed(0x185)]:String(_0x541701);return console[_0x5253ed(0x233)](_0x5253ed(0x211)+_0x320a3b),0x1;}let _0x30e842;try{_0x30e842=parseYamlString(_0x4ae82e);}catch(_0x330728){const _0x1d07cb=_0x330728 instanceof Error?_0x330728['message']:String(_0x330728);return console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x23b)+_0x1d07cb)),0x1;}if(_0x4c285e[_0x5253ed(0x1aa)]===!![]||_0x4c285e['attribute']===''){const _0xd854a7=_0x30e842[_0x5253ed(0x24d)]?.[_0x5253ed(0x27a)](_0x44aa56=>_0x44aa56[_0x5253ed(0x272)])||[];if(_0xd854a7[_0x5253ed(0x24a)]===0x0)console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x1bd)));else{console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x19c))),console['error']('Available\x20attributes:');for(const _0x29465f of _0xd854a7){console[_0x5253ed(0x233)]('\x20\x20'+a29_0x265ace[_0x5253ed(0x25b)](_0x29465f));}console[_0x5253ed(0x233)](_0x5253ed(0x232)+_0x5d7065+_0x5253ed(0x1d3)+_0xd854a7[0x0]+'\x22');}return 0x1;}if(_0x4c285e['behavior']===!![]||_0x4c285e['behavior']===''){const _0x5a17a2=_0x30e842['behaviors']?.[_0x5253ed(0x27a)](_0x2e02f5=>_0x2e02f5[_0x5253ed(0x272)])||[];if(_0x5a17a2['length']===0x0)console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x267)));else{console[_0x5253ed(0x233)](a29_0x265ace[_0x5253ed(0x1a2)](_0x5253ed(0x22a))),console[_0x5253ed(0x233)](_0x5253ed(0x16d));for(const _0x572dd5 of _0x5a17a2){console[_0x5253ed(0x233)]('\x20\x20'+a29_0x265ace['cyan'](_0x572dd5));}console[_0x5253ed(0x233)](_0x5253ed(0x232)+_0x5d7065+_0x5253ed(0x1ba)+_0x5a17a2[0x0]+'\x22');}return 0x1;}const _0x5603ed=createCommandSpinner(a29_0x265ace[_0x5253ed(0x1e1)](_0x5253ed(0x231)),{'verbose':_0x4c285e[_0x5253ed(0x200)]});_0x5603ed[_0x5253ed(0x240)]();const _0x3b7735={'onProgress':_0x1c0745=>{const _0x518f72=_0x5253ed;_0x5603ed[_0x518f72(0x22c)]=formatProgressMessage(_0x1c0745);}};if(_0x4c285e[_0x5253ed(0x1d7)])_0x3b7735[_0x5253ed(0x1d7)]=!![];if(_0x4c285e[_0x5253ed(0x1aa)]&&typeof _0x4c285e[_0x5253ed(0x1aa)]==='string')_0x3b7735['attribute']=_0x4c285e[_0x5253ed(0x1aa)];if(_0x4c285e[_0x5253ed(0x22d)]&&typeof _0x4c285e[_0x5253ed(0x22d)]===_0x5253ed(0x21b))_0x3b7735['behavior']=_0x4c285e[_0x5253ed(0x22d)];if(_0x4c285e['enriched'])_0x3b7735[_0x5253ed(0x23d)]=!![];if(_0x4c285e[_0x5253ed(0x183)])_0x3b7735[_0x5253ed(0x183)]=_0x4c285e['interval'];let _0x3573f5;try{_0x3573f5=await _0x5b2dc6[_0x5253ed(0x25e)][_0x5253ed(0x276)](_0x4ae82e,_0x3b7735),_0x5603ed[_0x5253ed(0x1c4)]();}catch(_0x341ee6){_0x5603ed[_0x5253ed(0x1c4)]();throw _0x341ee6;}return await this['displayPreviewResults'](_0x3573f5,{'master':_0x4c285e[_0x5253ed(0x1d7)],'attribute':typeof _0x4c285e[_0x5253ed(0x1aa)]==='string'?_0x4c285e['attribute']:undefined,'behavior':typeof _0x4c285e[_0x5253ed(0x22d)]===_0x5253ed(0x21b)?_0x4c285e[_0x5253ed(0x22d)]:undefined,'enriched':_0x4c285e[_0x5253ed(0x23d)]}),_0x3573f5[_0x5253ed(0x239)]?0x0:0x1;}async[a29_0x354af5(0x261)](_0x469259,_0x19f20a){const _0xa74ba=a29_0x354af5;console['error']('\x0a'+a29_0x265ace[_0xa74ba(0x246)]('Preview:')+'\x20'+_0x469259[_0xa74ba(0x272)]),console[_0xa74ba(0x233)]('═'[_0xa74ba(0x28c)](0x3c));if(_0x19f20a[_0xa74ba(0x1d7)]&&_0x469259[_0xa74ba(0x20f)]){const _0x167a03=a29_0x265ace[_0xa74ba(0x1e1)](_0xa74ba(0x286))+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0x469259['master'][_0xa74ba(0x20a)]+'.'+_0x469259[_0xa74ba(0x1d7)][_0xa74ba(0x268)]);await this[_0xa74ba(0x275)](_0x167a03,_0x469259[_0xa74ba(0x20f)]);}else{if(_0x19f20a[_0xa74ba(0x1aa)]&&_0x469259[_0xa74ba(0x20f)]){const _0x757649=a29_0x265ace[_0xa74ba(0x1e1)](_0xa74ba(0x19e))+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0x19f20a[_0xa74ba(0x1aa)]);await this[_0xa74ba(0x275)](_0x757649,_0x469259[_0xa74ba(0x20f)]);}else{if(_0x19f20a[_0xa74ba(0x22d)]&&_0x469259[_0xa74ba(0x20f)]){const _0x51283f=a29_0x265ace[_0xa74ba(0x1e1)]('Behavior:')+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0x19f20a[_0xa74ba(0x22d)]);await this[_0xa74ba(0x275)](_0x51283f,_0x469259[_0xa74ba(0x20f)]);}else{if(_0x19f20a[_0xa74ba(0x23d)]&&_0x469259[_0xa74ba(0x20f)]){const _0x126cbd=a29_0x265ace['dim'](_0xa74ba(0x1e6))+'\x20'+a29_0x265ace[_0xa74ba(0x246)](_0xa74ba(0x17a));await this['displaySampleData'](_0x126cbd,_0x469259['sampleData']);}else!_0x469259['sampleData']&&console['error']('\x0aNo\x20sample\x20data\x20available');}}}if(_0x469259[_0xa74ba(0x176)][_0xa74ba(0x24a)]>0x0){console[_0xa74ba(0x233)]('─'[_0xa74ba(0x28c)](0x3c)),console[_0xa74ba(0x233)]('\x0a'+a29_0x265ace[_0xa74ba(0x1a2)](_0xa74ba(0x1c3)));for(const _0x2fc2c8 of _0x469259[_0xa74ba(0x176)]){console[_0xa74ba(0x233)]('\x20\x20'+a29_0x265ace[_0xa74ba(0x1a2)]('•')+'\x20'+_0x2fc2c8);}}}async[a29_0x354af5(0x275)](_0x54b0c7,_0x553600){const _0x4342ae=a29_0x354af5;if(_0x553600[_0x4342ae(0x24a)]===0x0){console[_0x4342ae(0x233)]('\x0a'+_0x54b0c7),console[_0x4342ae(0x233)](_0x4342ae(0x182));return;}console[_0x4342ae(0x233)]('\x0a'+_0x54b0c7);const _0x6c4d21=Object[_0x4342ae(0x203)](_0x553600[0x0])[_0x4342ae(0x27a)](_0x296a82=>({'name':_0x296a82,'type':typeof _0x553600[0x0][_0x296a82]===_0x4342ae(0x1fe)?_0x4342ae(0x177):_0x4342ae(0x23a)})),_0x1f101c={'queryId':_0x4342ae(0x204),'columns':_0x6c4d21,'data':_0x553600,'stats':{'state':_0x4342ae(0x19d),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x553600[_0x4342ae(0x24a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2759e6=formatAsTable(_0x1f101c,_0x553600[_0x4342ae(0x24a)],!![]);await writeOutput(_0x2759e6,undefined,_0x4342ae(0x268));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x274);[a29_0x354af5(0x24c)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x354af5(0x20d)](_0x13fe25){const _0x31a5c7=a29_0x354af5,{options:_0x554c2d,args:_0x4b0c98,tdx:_0x254d41}=_0x13fe25,_0x394a73=_0x554c2d,_0x46aad0=_0x4b0c98[0x0]||_0x554c2d[_0x31a5c7(0x20b)];if(!_0x46aad0)return showParentSegmentNotSetError(_0x31a5c7(0x278)+_0x31a5c7(0x215)),0x1;const _0x20edba=resolveYamlFile(_0x46aad0);if(existsSync(_0x20edba)){_0x394a73[_0x31a5c7(0x200)]&&console[_0x31a5c7(0x233)](_0x31a5c7(0x28f)+_0x20edba);let _0x158de5;try{_0x158de5=readFileSync(_0x20edba,_0x31a5c7(0x1ae));}catch(_0x4a7011){const _0x481427=_0x4a7011 instanceof Error?_0x4a7011[_0x31a5c7(0x185)]:String(_0x4a7011);return console[_0x31a5c7(0x233)]('Error\x20reading\x20file:\x20'+_0x481427),0x1;}const _0x42d4e2=await withSpinner(_0x31a5c7(0x22e),()=>_0x254d41[_0x31a5c7(0x25e)]['pushParentYaml'](_0x158de5),{'verbose':_0x394a73[_0x31a5c7(0x200)]}),_0x11b144=_0x42d4e2[_0x31a5c7(0x20e)],{isNew:_0x259dec,name:_0x4d09d5,hasChanges:_0x3cd5e5,diffFormatted:_0x73bd93}=_0x11b144;if(_0x3cd5e5){_0x259dec?console[_0x31a5c7(0x233)](_0x31a5c7(0x296)+_0x4d09d5+'\x27:'):console[_0x31a5c7(0x233)](_0x31a5c7(0x1b6)+_0x4d09d5+'\x27:');console[_0x31a5c7(0x233)]('─'[_0x31a5c7(0x28c)](0x3c)),console[_0x31a5c7(0x233)](_0x73bd93),console[_0x31a5c7(0x233)]('─'[_0x31a5c7(0x28c)](0x3c));const _0x2e9c30=_0x259dec?_0x31a5c7(0x1b9)+_0x4d09d5+_0x31a5c7(0x18c):'Apply\x20changes\x20to\x20\x27'+_0x4d09d5+_0x31a5c7(0x18c);if(!_0x394a73[_0x31a5c7(0x197)]){const _0x8926f=await confirmKey(_0x2e9c30);if(!_0x8926f)return console['error'](_0x31a5c7(0x199)),0x1;}const _0xd123c6=_0x259dec?_0x31a5c7(0x1e8):'Updating';await withSpinner(_0xd123c6+_0x31a5c7(0x1d5)+_0x4d09d5+_0x31a5c7(0x1a5),()=>_0x11b144[_0x31a5c7(0x236)](),{'verbose':_0x394a73[_0x31a5c7(0x200)]});const _0x4cf0fc=_0x259dec?_0x31a5c7(0x25a):_0x31a5c7(0x1fb);console[_0x31a5c7(0x233)]('✔\x20'+_0x4cf0fc+_0x31a5c7(0x1d5)+_0x4d09d5+'\x27');}else console[_0x31a5c7(0x233)](_0x31a5c7(0x16e)+_0x4d09d5+_0x31a5c7(0x221));}const _0x354384=await withSpinner(_0x31a5c7(0x293)+_0x46aad0+_0x31a5c7(0x1a5),()=>_0x254d41[_0x31a5c7(0x25e)][_0x31a5c7(0x21d)](_0x46aad0),{'verbose':_0x394a73[_0x31a5c7(0x200)]}),_0x2350f6=_0x354384['data'],_0x45da10=getConsoleUrl(_0x394a73[_0x31a5c7(0x282)],_0x31a5c7(0x1a9)+_0x2350f6[_0x31a5c7(0x1e7)]+'/sessions/'+_0x2350f6[_0x31a5c7(0x1d9)]+_0x31a5c7(0x23c)+_0x2350f6['workflowAttemptId']);return console['error'](_0x31a5c7(0x1ff)),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace[_0x31a5c7(0x1e1)]('Audience\x20ID:')+'\x20'+_0x2350f6[_0x31a5c7(0x273)]),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace[_0x31a5c7(0x1e1)](_0x31a5c7(0x18f))+'\x20'+_0x2350f6[_0x31a5c7(0x178)]),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace[_0x31a5c7(0x1e1)]('Session:')+'\x20'+_0x2350f6[_0x31a5c7(0x1d9)]),console[_0x31a5c7(0x233)]('\x20\x20'+a29_0x265ace['dim'](_0x31a5c7(0x28d))+'\x20'+_0x2350f6[_0x31a5c7(0x1b5)]),console[_0x31a5c7(0x233)]('\x20\x20'+_0x45da10),console['error']('\x0a'+a29_0x265ace['dim'](_0x31a5c7(0x269))+'\x20tdx\x20wf\x20attempt\x20'+_0x2350f6['workflowAttemptId']+_0x31a5c7(0x216)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x1e3);[a29_0x354af5(0x24c)]=a29_0x354af5(0x265);async['execute'](_0x57eb03){const _0x216f86=a29_0x354af5,{options:_0x2f14c8,args:_0x19856b,tdx:_0x15cf83}=_0x57eb03,_0x54a00d=_0x19856b[0x0]||_0x2f14c8[_0x216f86(0x20b)];if(!_0x54a00d)return showParentSegmentNotSetError(_0x216f86(0x1cd)+_0x216f86(0x1d0)),0x1;_0x2f14c8[_0x216f86(0x200)]&&(console[_0x216f86(0x233)](_0x216f86(0x1a8)+_0x2f14c8[_0x216f86(0x282)]),console[_0x216f86(0x233)](_0x216f86(0x1de)+_0x54a00d));const _0x2b9320=await withSpinner(_0x216f86(0x1ca)+_0x54a00d+'\x27...',()=>_0x15cf83[_0x216f86(0x25e)][_0x216f86(0x1c5)](_0x54a00d),{'verbose':_0x2f14c8[_0x216f86(0x200)]}),_0x4df3b8=_0x2b9320[_0x216f86(0x20e)];console['error']('✔\x20Found\x20'+_0x4df3b8['length']+_0x216f86(0x1fd)+(_0x4df3b8[_0x216f86(0x24a)]!==0x1?'s':''));if(_0x2f14c8['json']||_0x2f14c8[_0x216f86(0x18a)])return await handleSDKOutput(_0x4df3b8,_0x2f14c8),0x0;return displayFieldsHumanReadable(_0x4df3b8,_0x54a00d),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x354af5(0x272)]='segment:parent:view';[a29_0x354af5(0x24c)]=a29_0x354af5(0x1e0);async[a29_0x354af5(0x20d)](_0x307020){const _0x2cf9cf=a29_0x354af5,{options:_0x4f9d84,args:_0x464ae4,tdx:_0x18a631}=_0x307020,_0x6279cb=_0x4f9d84,_0x2baf25=_0x464ae4[0x0]||_0x4f9d84[_0x2cf9cf(0x20b)];if(!_0x2baf25)return showParentSegmentNotSetError(_0x2cf9cf(0x1c1)+_0x2cf9cf(0x27d)+_0x2cf9cf(0x25f)+_0x2cf9cf(0x226)),0x1;_0x4f9d84[_0x2cf9cf(0x200)]&&(console[_0x2cf9cf(0x233)](_0x2cf9cf(0x1a8)+_0x4f9d84[_0x2cf9cf(0x282)]),console[_0x2cf9cf(0x233)](_0x2cf9cf(0x1de)+_0x2baf25));const _0xb5bb0=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x2baf25+_0x2cf9cf(0x1a5),()=>_0x18a631[_0x2cf9cf(0x25e)][_0x2cf9cf(0x264)](_0x2baf25),{'verbose':_0x4f9d84['verbose']}),_0x1fa55d=_0xb5bb0[_0x2cf9cf(0x20e)];if(_0x6279cb[_0x2cf9cf(0x174)]){const _0xab9f78=getConsoleNextUrl(_0x6279cb[_0x2cf9cf(0x282)],_0x2cf9cf(0x241)+_0x1fa55d['id']);return console[_0x2cf9cf(0x233)](a29_0x265ace[_0x2cf9cf(0x1c7)]('✔')+_0x2cf9cf(0x1c8)+a29_0x265ace[_0x2cf9cf(0x25b)](_0xab9f78)),openBrowser(_0xab9f78),0x0;}return await handleSingleObjectOutput(_0x1fa55d,_0x4f9d84),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x213);[a29_0x354af5(0x24c)]=a29_0x354af5(0x1cb);async[a29_0x354af5(0x20d)](_0xf0a29b){const _0x124bcd=a29_0x354af5,{options:_0x51b488,args:_0x30210d,tdx:_0x4b5b8f}=_0xf0a29b,_0x2de8ad=_0x30210d[0x0]||_0x51b488[_0x124bcd(0x20b)];if(!_0x2de8ad)return showParentSegmentNotSetError(_0x124bcd(0x26c)+_0x124bcd(0x235)),0x1;_0x51b488[_0x124bcd(0x200)]&&(console[_0x124bcd(0x233)](_0x124bcd(0x1a8)+_0x51b488[_0x124bcd(0x282)]),console[_0x124bcd(0x233)](_0x124bcd(0x1de)+_0x2de8ad));const _0x47566a=await withSpinner(_0x124bcd(0x1b2)+_0x2de8ad+_0x124bcd(0x1a5),()=>_0x4b5b8f['segment'][_0x124bcd(0x1bb)](_0x2de8ad),{'verbose':_0x51b488[_0x124bcd(0x200)]}),_0x2ca2b6=_0x47566a[_0x124bcd(0x20e)],_0x1de741=await withSpinner(_0x124bcd(0x191)+_0x2de8ad+_0x124bcd(0x1a5),()=>_0x4b5b8f[_0x124bcd(0x25e)][_0x124bcd(0x1a7)](_0x2ca2b6),{'verbose':_0x51b488[_0x124bcd(0x200)]}),_0xdd6302=await executeSchemaQuery(_0x1de741[_0x124bcd(0x20e)],_0x4b5b8f,_0x51b488);return await handleQueryOutput(_0xdd6302,_0x51b488),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x16b);[a29_0x354af5(0x24c)]=a29_0x354af5(0x259);async[a29_0x354af5(0x20d)](_0x45787f){const _0x4dff77=a29_0x354af5,{options:_0x42b319,args:_0x339770,tdx:_0x2523da}=_0x45787f,_0x23e1ae=_0x339770[0x0]||_0x42b319['parentSegment'];if(!_0x23e1ae)return showParentSegmentNotSetError(_0x4dff77(0x1b7)+_0x4dff77(0x287)),0x1;_0x42b319['verbose']&&(console['error'](_0x4dff77(0x1a8)+_0x42b319[_0x4dff77(0x282)]),console[_0x4dff77(0x233)]('Parent\x20segment:\x20'+_0x23e1ae));const _0xd97dc8=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x23e1ae+'\x27...',()=>_0x2523da[_0x4dff77(0x25e)]['resolveParentId'](_0x23e1ae),{'verbose':_0x42b319[_0x4dff77(0x200)]}),_0x4d010f=_0xd97dc8['data'],_0x37124d=await withSpinner(_0x4dff77(0x191)+_0x23e1ae+_0x4dff77(0x1a5),()=>_0x2523da[_0x4dff77(0x25e)][_0x4dff77(0x1a7)](_0x4d010f),{'verbose':_0x42b319['verbose']}),_0x5e8491=_0x37124d[_0x4dff77(0x20e)];return _0x42b319[_0x4dff77(0x17f)]===_0x4dff77(0x295)||_0x42b319[_0x4dff77(0x17f)]===_0x4dff77(0x18a)?await handleSDKOutput([{'sql':_0x5e8491}],_0x42b319):console[_0x4dff77(0x208)](_0x5e8491),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x354af5(0x272)]=a29_0x354af5(0x19a);[a29_0x354af5(0x24c)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x3f4967){const _0x546cab=a29_0x354af5,{options:_0x50af43,args:_0x20a1e3,tdx:_0x34c5b2}=_0x3f4967,_0x2bc00e=_0x20a1e3[0x0]||_0x50af43[_0x546cab(0x20b)];if(!_0x2bc00e)return showParentSegmentNotSetError(_0x546cab(0x202)+_0x546cab(0x234)),0x1;_0x50af43['verbose']&&(console[_0x546cab(0x233)](_0x546cab(0x1a8)+_0x50af43[_0x546cab(0x282)]),console[_0x546cab(0x233)](_0x546cab(0x1de)+_0x2bc00e));const _0x5903b4=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2bc00e+_0x546cab(0x1a5),()=>_0x34c5b2[_0x546cab(0x25e)][_0x546cab(0x1bb)](_0x2bc00e),{'verbose':_0x50af43[_0x546cab(0x200)]}),_0x51dd26=_0x5903b4[_0x546cab(0x20e)],_0x190e42=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x2bc00e+'\x27...',()=>_0x34c5b2[_0x546cab(0x25e)]['getParentSQL'](_0x51dd26),{'verbose':_0x50af43[_0x546cab(0x200)]});let _0x4c4446=_0x190e42[_0x546cab(0x20e)];const _0x320e31=resolveLimit(_0x50af43['limit'],DEFAULT_DISPLAY_LIMIT),_0x33bc55=/\bLIMIT\s+\d+/i['test'](_0x4c4446);!_0x33bc55&&(_0x4c4446=_0x4c4446[_0x546cab(0x279)]()[_0x546cab(0x24b)](/;+$/,''),_0x4c4446='SELECT\x20*\x20FROM\x20(\x0a'+_0x4c4446+_0x546cab(0x1ed)+_0x320e31);_0x50af43['verbose']&&console['error'](_0x546cab(0x1dd)+_0x4c4446);const _0x471573=await withQuerySpinner(_0x546cab(0x21e),async _0x22f026=>{const _0x1609e3=_0x546cab,_0x44d84a=await _0x34c5b2[_0x1609e3(0x263)]['execute'](_0x4c4446,{'catalog':'td','schema':_0x1609e3(0x17e),'onJobId':_0x30aea6=>{_0x22f026['setJobId'](_0x30aea6);}});return _0x44d84a;},{'verbose':_0x50af43['verbose']}),_0xc0d1db=_0x471573['data'],_0x2cf372=_0xc0d1db[_0x546cab(0x228)]?'\x20[Job\x20ID:\x20'+_0xc0d1db['jobId']+']':'';return console[_0x546cab(0x233)](_0x546cab(0x227)+_0xc0d1db[_0x546cab(0x294)]['processedRows'][_0x546cab(0x1a1)]()+_0x546cab(0x1cc)+(_0x546cab(0x21c)+formatElapsed(_0xc0d1db[_0x546cab(0x294)][_0x546cab(0x28e)])+_0x2cf372)),await handleQueryOutput(_0xc0d1db,_0x50af43),0x0;}}
@@ -1 +1 @@
1
- const a30_0x58f054=a30_0x5b58;(function(_0x3e4b6a,_0x30ea6d){const _0x23efa8=a30_0x5b58,_0x28fbb0=_0x3e4b6a();while(!![]){try{const _0x4b1d3e=-parseInt(_0x23efa8(0x188))/0x1+parseInt(_0x23efa8(0x193))/0x2*(-parseInt(_0x23efa8(0x19b))/0x3)+parseInt(_0x23efa8(0x189))/0x4+parseInt(_0x23efa8(0x18b))/0x5*(-parseInt(_0x23efa8(0x186))/0x6)+-parseInt(_0x23efa8(0x199))/0x7+parseInt(_0x23efa8(0x18f))/0x8+-parseInt(_0x23efa8(0x18c))/0x9*(-parseInt(_0x23efa8(0x18a))/0xa);if(_0x4b1d3e===_0x30ea6d)break;else _0x28fbb0['push'](_0x28fbb0['shift']());}catch(_0x5dee30){_0x28fbb0['push'](_0x28fbb0['shift']());}}}(a30_0x2012,0x6449b));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';function a30_0x5b58(_0x57375d,_0x16536a){_0x57375d=_0x57375d-0x185;const _0x2012ca=a30_0x2012();let _0x5b585a=_0x2012ca[_0x57375d];return _0x5b585a;}export class ProfilesCommand extends BaseCommand{['name']=a30_0x58f054(0x194);['description']=a30_0x58f054(0x18e);async[a30_0x58f054(0x185)](_0x2cdb99){const _0x5ec2b7=a30_0x58f054,{options:_0x5d03ae}=_0x2cdb99;try{const _0x432973=listProfiles(),_0x136924=getActiveProfile();if(_0x432973['length']===0x0)return console[_0x5ec2b7(0x190)](_0x5ec2b7(0x187)),console[_0x5ec2b7(0x190)](_0x5ec2b7(0x19a)),console['log'](_0x5ec2b7(0x191)),0x0;const _0x5085c7=_0x432973['map'](_0x28b300=>{const _0x44d433=_0x5ec2b7,_0x4cac16=_0x28b300['name']===_0x136924,_0x2278a=getProfileParams(_0x28b300[_0x44d433(0x196)]);return{'name':_0x28b300[_0x44d433(0x18d)],'active':_0x4cac16,'scope':_0x28b300[_0x44d433(0x195)],'description':_0x28b300[_0x44d433(0x196)][_0x44d433(0x19c)]||'','params':_0x2278a};});return await handleSDKOutput(_0x5085c7,_0x5d03ae),0x0;}catch(_0x46b530){return _0x46b530 instanceof Error&&console[_0x5ec2b7(0x198)](_0x5ec2b7(0x197)+_0x46b530[_0x5ec2b7(0x192)]),0x1;}}}function a30_0x2012(){const _0x2281c7=['6mHZvxi','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','231364mAgldT','1790884Ziqvwz','10FzcsKq','1924355MIFVhK','7652259mKlELl','name','List\x20all\x20available\x20profiles','5434104KdhkLA','log','\x20\x20Global:\x20~/.config/tdx/tdx.json','message','1876JOVLcM','profiles','scope','config','Error:\x20','error','4333749DdqJSm','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','1059RPBLSU','description','execute'];a30_0x2012=function(){return _0x2281c7;};return a30_0x2012();}
1
+ const a30_0x3e5728=a30_0x5665;function a30_0x4f05(){const _0x41015b=['log','4725798IYDozG','message','47424OvtYYy','2pyEfxx','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','execute','5540730FbVmJO','553BhtSGB','6390VKbFaP','24Hxekef','Error:\x20','length','17990863MUXSfm','config','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','map','error','name','53112HhBXCh','21040Txrqoq','246242uFECsL','\x20\x20Global:\x20~/.config/tdx/tdx.json','16hVNKvZ'];a30_0x4f05=function(){return _0x41015b;};return a30_0x4f05();}(function(_0x20360f,_0x3c5963){const _0x43051f=a30_0x5665,_0x2466f9=_0x20360f();while(!![]){try{const _0x59a883=parseInt(_0x43051f(0x82))/0x1*(parseInt(_0x43051f(0x94))/0x2)+-parseInt(_0x43051f(0x81))/0x3*(-parseInt(_0x43051f(0x7d))/0x4)+parseInt(_0x43051f(0x86))/0x5+parseInt(_0x43051f(0x7f))/0x6+parseInt(_0x43051f(0x87))/0x7*(parseInt(_0x43051f(0x92))/0x8)+parseInt(_0x43051f(0x88))/0x9*(parseInt(_0x43051f(0x93))/0xa)+-parseInt(_0x43051f(0x8c))/0xb*(parseInt(_0x43051f(0x89))/0xc);if(_0x59a883===_0x3c5963)break;else _0x2466f9['push'](_0x2466f9['shift']());}catch(_0x52be9b){_0x2466f9['push'](_0x2466f9['shift']());}}}(a30_0x4f05,0xe88bc));function a30_0x5665(_0x5d0918,_0x4cf80e){_0x5d0918=_0x5d0918-0x7d;const _0x4f059a=a30_0x4f05();let _0x566515=_0x4f059a[_0x5d0918];return _0x566515;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x3e5728(0x91)]='profiles';[a30_0x3e5728(0x83)]='List\x20all\x20available\x20profiles';async[a30_0x3e5728(0x85)](_0x3da2fd){const _0x55aed6=a30_0x3e5728,{options:_0x597a20}=_0x3da2fd;try{const _0x12b0fa=listProfiles(),_0x47a01f=getActiveProfile();if(_0x12b0fa[_0x55aed6(0x8b)]===0x0)return console[_0x55aed6(0x7e)](_0x55aed6(0x8e)),console['log'](_0x55aed6(0x84)),console[_0x55aed6(0x7e)](_0x55aed6(0x95)),0x0;const _0x4b94c9=_0x12b0fa[_0x55aed6(0x8f)](_0xbf78c2=>{const _0x5a8266=_0x55aed6,_0x25ab0d=_0xbf78c2[_0x5a8266(0x91)]===_0x47a01f,_0x164fab=getProfileParams(_0xbf78c2[_0x5a8266(0x8d)]);return{'name':_0xbf78c2[_0x5a8266(0x91)],'active':_0x25ab0d,'scope':_0xbf78c2['scope'],'description':_0xbf78c2[_0x5a8266(0x8d)][_0x5a8266(0x83)]||'','params':_0x164fab};});return await handleSDKOutput(_0x4b94c9,_0x597a20),0x0;}catch(_0x457dea){return _0x457dea instanceof Error&&console[_0x55aed6(0x90)](_0x55aed6(0x8a)+_0x457dea[_0x55aed6(0x80)]),0x1;}}}