@treasuredata/tdx 0.9.0 → 0.9.1

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 (119) 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.js +1 -1
  76. package/dist/sdk/query.js +1 -1
  77. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  78. package/dist/sdk/segment/journey-yaml.js +1 -1
  79. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  80. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  81. package/dist/sdk/segment.js +1 -1
  82. package/dist/sdk/user.js +1 -1
  83. package/dist/sdk/workflow.js +1 -1
  84. package/dist/types/endpoints.js +1 -1
  85. package/dist/types/index.js +1 -1
  86. package/dist/utils/agent-config.js +1 -1
  87. package/dist/utils/agent-ref-parser.js +1 -1
  88. package/dist/utils/async.js +1 -1
  89. package/dist/utils/chat-cache.js +1 -1
  90. package/dist/utils/colors.js +1 -1
  91. package/dist/utils/command-output.js +1 -1
  92. package/dist/utils/constants.js +1 -1
  93. package/dist/utils/diff.js +1 -1
  94. package/dist/utils/fields-display.js +1 -1
  95. package/dist/utils/file-permissions.js +1 -1
  96. package/dist/utils/format-detector.js +1 -1
  97. package/dist/utils/formatters.js +1 -1
  98. package/dist/utils/journey-utils.js +1 -1
  99. package/dist/utils/json-loader.js +1 -1
  100. package/dist/utils/llm-backup-utils.js +1 -1
  101. package/dist/utils/model-aliases.js +1 -1
  102. package/dist/utils/model-factors.js +1 -1
  103. package/dist/utils/option-validation.js +1 -1
  104. package/dist/utils/port.js +1 -1
  105. package/dist/utils/process.js +1 -1
  106. package/dist/utils/prompt.js +1 -1
  107. package/dist/utils/segment-path-parser.js +1 -1
  108. package/dist/utils/segment-ref-parser.js +1 -1
  109. package/dist/utils/spinner.js +1 -1
  110. package/dist/utils/sql-parser.js +1 -1
  111. package/dist/utils/sse-parser.js +1 -1
  112. package/dist/utils/string-utils.js +1 -1
  113. package/dist/utils/table-ref-parser.js +1 -1
  114. package/dist/utils/tdx-config.js +1 -1
  115. package/dist/utils/tdx-logger.js +1 -1
  116. package/dist/utils/tree-formatter.js +1 -1
  117. package/dist/utils/version-check.js +1 -1
  118. package/dist/utils/workflow-utils.js +1 -1
  119. 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_0x312b8c=a27_0x3d16;(function(_0x2af077,_0x53948c){const _0x29a899=a27_0x3d16,_0x44a631=_0x2af077();while(!![]){try{const _0x5b7a09=parseInt(_0x29a899(0x1f7))/0x1+-parseInt(_0x29a899(0x1f0))/0x2*(-parseInt(_0x29a899(0x1c9))/0x3)+-parseInt(_0x29a899(0x1f5))/0x4+parseInt(_0x29a899(0x25f))/0x5*(-parseInt(_0x29a899(0x1ca))/0x6)+-parseInt(_0x29a899(0x1bd))/0x7*(parseInt(_0x29a899(0x240))/0x8)+parseInt(_0x29a899(0x1d0))/0x9+-parseInt(_0x29a899(0x1da))/0xa*(-parseInt(_0x29a899(0x1ee))/0xb);if(_0x5b7a09===_0x53948c)break;else _0x44a631['push'](_0x44a631['shift']());}catch(_0x3c401c){_0x44a631['push'](_0x44a631['shift']());}}}(a27_0x48b6,0xa659d));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';function a27_0x3d16(_0x299665,_0x34cc73){_0x299665=_0x299665-0x1b4;const _0x48b6c5=a27_0x48b6();let _0x3d1663=_0x48b6c5[_0x299665];return _0x3d1663;}import{confirm}from'../utils/prompt.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../types/endpoints.js';import*as a27_0x1ad4a7 from'node:fs';function handleSDKError(_0x376707,_0x2ff67d){const _0xcf1b51=a27_0x3d16;if(_0x376707 instanceof SDKError)console[_0xcf1b51(0x1b8)](_0xcf1b51(0x241)+_0x376707[_0xcf1b51(0x276)]),_0x2ff67d[_0xcf1b51(0x26c)]&&(_0x376707[_0xcf1b51(0x1bc)]&&console[_0xcf1b51(0x1b8)](_0xcf1b51(0x1e7)+_0x376707[_0xcf1b51(0x1bc)]),_0x376707[_0xcf1b51(0x238)]&&(console[_0xcf1b51(0x1b8)]('\x0aStack\x20trace:'),console[_0xcf1b51(0x1b8)](_0x376707[_0xcf1b51(0x238)])));else throw _0x376707;}function formatChatHistoryEntry(_0x5470cf,_0x55f830){const _0x5831e2=a27_0x3d16,_0xfde1f3=getChalk(_0x55f830),_0x3315d5=_0xfde1f3['dim'](_0x5470cf['at']);if('input'in _0x5470cf){const _0x638821=_0xfde1f3[_0x5831e2(0x253)]('[input]\x20\x20');return _0x3315d5+'\x20'+_0x638821+':\x20'+_0x5470cf[_0x5831e2(0x1ec)];}if(_0x5831e2(0x202)in _0x5470cf){const _0x580963=_0xfde1f3[_0x5831e2(0x1db)](_0x5831e2(0x1e1));return _0x3315d5+'\x20'+_0x580963+':\x20'+_0x5470cf[_0x5831e2(0x202)];}if(_0x5831e2(0x27c)in _0x5470cf){const _0x556cc5=_0xfde1f3[_0x5831e2(0x1fa)](_0x5831e2(0x260)),{functionName:_0x487d6b,functionArguments:_0x4fac2c,targetFunction:_0x306bbc}=_0x5470cf[_0x5831e2(0x27c)];let _0x1d0e27=_0x3315d5+'\x20'+_0x556cc5+':\x20'+_0xfde1f3[_0x5831e2(0x213)](_0x487d6b);if(_0x4fac2c&&Object['keys'](_0x4fac2c)[_0x5831e2(0x1cd)]>0x0){const _0x29a385=Object[_0x5831e2(0x1c0)](_0x4fac2c)[_0x5831e2(0x27e)](([_0x1388b6,_0x3b6ee1])=>_0x1388b6+'='+JSON[_0x5831e2(0x1de)](_0x3b6ee1))[_0x5831e2(0x1d5)](',\x20');_0x1d0e27+='('+_0x29a385+')';}_0x306bbc&&(_0x1d0e27+=_0xfde1f3[_0x5831e2(0x26b)]('\x20['+_0x306bbc+']'));let _0x1e3359='';if(_0x5470cf[_0x5831e2(0x27c)][_0x5831e2(0x258)])_0x1e3359=_0x5831e2(0x25d)+_0x5470cf[_0x5831e2(0x27c)]['targetKnowledgeBase'][_0x5831e2(0x219)];else{if(_0x5470cf[_0x5831e2(0x27c)][_0x5831e2(0x25b)])_0x1e3359=_0x5831e2(0x257)+_0x5470cf['tool_call'][_0x5831e2(0x25b)][_0x5831e2(0x219)];else{if(_0x5470cf[_0x5831e2(0x27c)][_0x5831e2(0x1c7)])_0x1e3359=_0x5831e2(0x275)+_0x5470cf[_0x5831e2(0x27c)][_0x5831e2(0x1c7)][_0x5831e2(0x219)];else _0x5470cf[_0x5831e2(0x27c)]['targetImageGenerator']&&(_0x1e3359=_0x5831e2(0x1f4)+_0x5470cf[_0x5831e2(0x27c)][_0x5831e2(0x1cb)][_0x5831e2(0x219)]);}}return _0x1d0e27+_0x1e3359;}if(_0x5831e2(0x27d)in _0x5470cf){const _0x822400=_0xfde1f3[_0x5831e2(0x279)](_0x5831e2(0x1f6)),{functionName:_0xbfc592,functionArguments:_0x3363ca,content:_0x31c43c,newChat:_0x5623d7}=_0x5470cf[_0x5831e2(0x27d)];let _0x4eeda1=_0x3315d5+'\x20'+_0x822400+':\x20'+_0xfde1f3[_0x5831e2(0x213)](_0xbfc592);if(_0x3363ca){const _0x55eadb=typeof _0x3363ca===_0x5831e2(0x21f)?_0x3363ca:JSON[_0x5831e2(0x1de)](_0x3363ca);_0x4eeda1+='('+_0x55eadb+')';}return _0x31c43c&&(_0x4eeda1+='\x0a'+_0xfde1f3['dim'](_0x31c43c)),_0x5623d7&&(_0x4eeda1+=_0xfde1f3[_0x5831e2(0x26b)](_0x5831e2(0x210)+_0x5623d7['id'])),_0x4eeda1;}if(_0x5831e2(0x239)in _0x5470cf){const _0x25f697=_0xfde1f3[_0x5831e2(0x26a)]('[output]\x20');return _0x3315d5+'\x20'+_0x25f697+':\x20'+_0x5470cf['output'][_0x5831e2(0x219)]+'\x20('+_0x5470cf[_0x5831e2(0x239)][_0x5831e2(0x202)][_0x5831e2(0x1cd)]+_0x5831e2(0x216);}if('image'in _0x5470cf){const _0x44cd9d=_0xfde1f3[_0x5831e2(0x26a)](_0x5831e2(0x226)),{width:_0x234a91,height:_0x29fc0c,headerText:_0x19aeca}=_0x5470cf[_0x5831e2(0x1c4)],_0xa81208=_0x19aeca?_0x5831e2(0x220)+_0x19aeca:'';return _0x3315d5+'\x20'+_0x44cd9d+':\x20'+_0x234a91+'x'+_0x29fc0c+_0xa81208;}if(_0x5831e2(0x1b8)in _0x5470cf){const _0x34e396=_0xfde1f3[_0x5831e2(0x1b5)]('[error]\x20\x20');return _0x3315d5+'\x20'+_0x34e396+':\x20'+_0x5470cf[_0x5831e2(0x1b8)];}return _0x3315d5+'\x20'+_0xfde1f3['dim'](_0x5831e2(0x23c))+':\x20'+JSON['stringify'](_0x5470cf);}async function executeChatHistoryCommand(_0x4c3b3b,_0x553ac2){const _0x413438=a27_0x3d16,{options:_0x5d4032,args:_0x3cc62a,tdx:_0x8ceb30}=_0x4c3b3b,_0x2af465=_0x3cc62a[0x0],_0x16d7d6=_0x5d4032,_0x45cfb8=_0x16d7d6['last'];try{if(_0x45cfb8&&_0x2af465)return console[_0x413438(0x1b8)](_0x413438(0x267)),console[_0x413438(0x1b8)]('Usage:\x20'+_0x553ac2+_0x413438(0x1d2)),0x1;if(!_0x2af465&&!_0x45cfb8&&_0x5d4032[_0x413438(0x26d)]!==undefined){const _0x46e23e=resolveLimit(_0x5d4032[_0x413438(0x1b6)],DEFAULT_LLM_LIMIT),_0x1d2b97=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x8ceb30[_0x413438(0x263)]['chats'](_0x46e23e),{'verbose':_0x5d4032[_0x413438(0x26c)]});return await handleSDKOutput(_0x1d2b97[_0x413438(0x1c1)],_0x5d4032),0x0;}const _0x5c6f65=await getChatIdOrSelect(_0x8ceb30,_0x5d4032,_0x45cfb8,_0x2af465);if(!_0x5c6f65)return 0x0;return await displayChatHistory(_0x5c6f65,_0x8ceb30,_0x5d4032),0x0;}catch(_0x1e7e2d){return handleSDKError(_0x1e7e2d,_0x5d4032),0x1;}}async function displayChatHistory(_0x79a38b,_0x5d4aa5,_0x160bda){const _0x2847a9=a27_0x3d16,_0x2220b9=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x79a38b+'\x27...',()=>_0x5d4aa5[_0x2847a9(0x263)]['history'](_0x79a38b),{'verbose':_0x160bda[_0x2847a9(0x26c)]}),_0x432cce=_0x2220b9[_0x2847a9(0x1c1)]['data']??[];if(_0x432cce['length']===0x0){console[_0x2847a9(0x245)](_0x2847a9(0x23b));return;}if(_0x160bda[_0x2847a9(0x26d)]!==undefined)await handleSDKOutput(_0x432cce,_0x160bda);else{const _0x3fb790=_0x432cce[_0x2847a9(0x27e)](_0x58ddb1=>formatChatHistoryEntry(_0x58ddb1,_0x160bda)),_0x15ff31=_0x3fb790[_0x2847a9(0x1d5)]('\x0a');await writeOutput(_0x15ff31,_0x160bda['output'],_0x2847a9(0x1e5));}}async function getChatIdOrSelect(_0x131696,_0x459f87,_0x32b16b,_0x12e903){const _0x29cd03=a27_0x3d16;if(_0x12e903)return _0x12e903;if(_0x32b16b){const _0x59bc9a=await withSpinner(_0x29cd03(0x1e3),()=>_0x131696[_0x29cd03(0x263)][_0x29cd03(0x24a)](0x1),{'verbose':_0x459f87[_0x29cd03(0x26c)]});if(_0x59bc9a[_0x29cd03(0x1c1)][_0x29cd03(0x1cd)]===0x0)return console[_0x29cd03(0x245)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x59bc9a[_0x29cd03(0x1c1)][0x0]['id'];}const _0x4c0ae0=await selectChatInteractively(_0x131696,_0x459f87);if(!_0x4c0ae0)return console[_0x29cd03(0x245)](_0x29cd03(0x22c)),undefined;return _0x4c0ae0;}async function getProjectIdOrDefault(_0x47ba59){const _0x2ee9d9=await getProjectWithName(_0x47ba59);return _0x2ee9d9['id'];}async function getProjectWithName(_0x5079f3){const _0x2ef609=a27_0x3d16,{tdx:_0x4e69c4,options:_0x54200e}=_0x5079f3,_0x41a86a=_0x54200e[_0x2ef609(0x20c)];if(_0x41a86a){const _0x40160f=await withSpinner(_0x2ef609(0x20f)+_0x41a86a+_0x2ef609(0x1d8),()=>_0x4e69c4[_0x2ef609(0x263)][_0x2ef609(0x201)](_0x41a86a),{'verbose':_0x54200e['verbose']});return{'id':_0x40160f[_0x2ef609(0x1c1)],'name':_0x41a86a};}const _0x148039=_0x4e69c4['llm'][_0x2ef609(0x261)]();if(_0x148039){const _0x2cb266=await _0x4e69c4[_0x2ef609(0x263)][_0x2ef609(0x274)](),_0x3eaa58=_0x2cb266[_0x2ef609(0x1d3)](_0x498382=>_0x498382['id']===_0x148039);return{'id':_0x148039,'name':_0x3eaa58?.[_0x2ef609(0x215)]['name']||'Unknown'};}const _0x17cffa=await withSpinner(_0x2ef609(0x25a),()=>_0x4e69c4[_0x2ef609(0x263)]['getOrCreateDefaultProject'](),{'verbose':_0x54200e[_0x2ef609(0x26c)]});return{'id':_0x17cffa[_0x2ef609(0x1c1)]['id'],'name':_0x17cffa[_0x2ef609(0x1c1)][_0x2ef609(0x215)][_0x2ef609(0x219)]};}function toLLMProjectInfo(_0x5d9110){const _0x24953c=a27_0x3d16;return{'name':_0x5d9110[_0x24953c(0x215)][_0x24953c(0x219)],'description':_0x5d9110[_0x24953c(0x215)][_0x24953c(0x236)],'createdAt':_0x5d9110[_0x24953c(0x215)][_0x24953c(0x22b)],'updatedAt':_0x5d9110['attributes'][_0x24953c(0x266)]};}function toAgentInfo(_0xe9a82f){const _0x2cb1c3=a27_0x3d16;return{'name':_0xe9a82f['attributes'][_0x2cb1c3(0x219)],'description':_0xe9a82f[_0x2cb1c3(0x215)]['description'],'prompt':truncatePrompt(_0xe9a82f[_0x2cb1c3(0x215)][_0x2cb1c3(0x218)]),'createdAt':_0xe9a82f['attributes'][_0x2cb1c3(0x22b)],'updatedAt':_0xe9a82f[_0x2cb1c3(0x215)]['updatedAt']};}function truncatePrompt(_0x27ab5c){const _0x1a5423=a27_0x3d16;if(!_0x27ab5c)return undefined;const _0x2fa9aa=0x64;if(_0x27ab5c[_0x1a5423(0x1cd)]<=_0x2fa9aa)return _0x27ab5c;return _0x27ab5c['slice'](0x0,_0x2fa9aa)+_0x1a5423(0x21c);}export class LLMModelsCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x27b);[a27_0x312b8c(0x236)]='List\x20available\x20LLM\x20models';async[a27_0x312b8c(0x204)](_0x4feec6){const _0x58f2f8=a27_0x312b8c,{options:_0x3022a5,tdx:_0x2c0bd1}=_0x4feec6;try{const _0x44584c=await withSpinner('Fetching\x20available\x20models...',()=>_0x2c0bd1[_0x58f2f8(0x263)][_0x58f2f8(0x1df)](),{'verbose':_0x3022a5['verbose']});return await handleSDKOutput(_0x44584c['data'],_0x3022a5),0x0;}catch(_0x2b6445){return handleSDKError(_0x2b6445,_0x3022a5),0x1;}}}export class LLMProjectsCommand extends BaseCommand{['name']=a27_0x312b8c(0x21e);[a27_0x312b8c(0x236)]=a27_0x312b8c(0x284);async[a27_0x312b8c(0x204)](_0x525495){const _0x21794b=a27_0x312b8c,{options:_0x29ca55,args:_0x306482,tdx:_0x4c22a8}=_0x525495,_0x3798ce=getChalk(_0x29ca55),_0x175eb7=_0x29ca55[_0x21794b(0x1bf)],_0x49ada6=_0x29ca55[_0x21794b(0x255)];try{const _0x1cbca1=_0x306482[0x0],_0xefd056=resolveLimit(_0x29ca55[_0x21794b(0x1b6)],DEFAULT_LLM_LIMIT),_0x524d3f=await withSpinner('Fetching\x20projects...',()=>_0x4c22a8[_0x21794b(0x263)][_0x21794b(0x274)](_0xefd056),{'verbose':_0x29ca55[_0x21794b(0x26c)]});let _0x22f279=_0x524d3f[_0x21794b(0x1c1)];_0x1cbca1&&(_0x22f279=_0x524d3f[_0x21794b(0x1c1)][_0x21794b(0x1f3)](_0x51b438=>matchGlobPattern(_0x51b438[_0x21794b(0x215)][_0x21794b(0x219)],_0x1cbca1)));const _0x22541e=_0x29ca55[_0x21794b(0x26d)]===_0x21794b(0x1f2)||_0x29ca55[_0x21794b(0x26d)]===_0x21794b(0x21a)||_0x29ca55[_0x21794b(0x26d)]===_0x21794b(0x1e5)||_0x29ca55[_0x21794b(0x26d)]===_0x21794b(0x282);if(_0x22541e){const _0x55415f=_0x22f279[_0x21794b(0x27e)](_0x185521=>({...toLLMProjectInfo(_0x185521),..._0x175eb7?{'url':getLLMProjectUrl(_0x49ada6,_0x185521['id'])}:{}}));await handleSDKOutput(_0x55415f,_0x29ca55);}else{const _0x3fc82d=[];if(_0x22f279[_0x21794b(0x1cd)]===0x0)_0x3fc82d[_0x21794b(0x206)](_0x3798ce[_0x21794b(0x26b)]('No\x20projects\x20found'));else{const _0x3abf6f=[..._0x22f279][_0x21794b(0x1b7)]((_0x5bf408,_0x5a8acb)=>_0x5bf408['attributes'][_0x21794b(0x219)]['localeCompare'](_0x5a8acb[_0x21794b(0x215)][_0x21794b(0x219)]));for(const _0x56f3fa of _0x3abf6f){if(_0x175eb7){const _0x3368dd=getLLMProjectUrl(_0x49ada6,_0x56f3fa['id']);_0x3fc82d[_0x21794b(0x206)]('⚒️\x20'+_0x56f3fa[_0x21794b(0x215)]['name']+'\x20\x20'+_0x3798ce[_0x21794b(0x26b)](_0x3368dd));}else _0x3fc82d[_0x21794b(0x206)](_0x21794b(0x1fd)+_0x56f3fa[_0x21794b(0x215)][_0x21794b(0x219)]);}_0x3fc82d[_0x21794b(0x206)](_0x3798ce[_0x21794b(0x26b)](_0x22f279[_0x21794b(0x1cd)]+_0x21794b(0x273)));}await writeOutput(_0x3fc82d['join']('\x0a'),_0x29ca55[_0x21794b(0x239)],_0x21794b(0x1e5));}return 0x0;}catch(_0x2239c2){return handleSDKError(_0x2239c2,_0x29ca55),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x1eb);['description']=a27_0x312b8c(0x25e);async[a27_0x312b8c(0x204)](_0x1a8f5e){const _0x1ea1b2=a27_0x312b8c,{options:_0x2e27bd,args:_0x4c4bc0,tdx:_0x3a9ca0}=_0x1a8f5e,_0x108e43=getChalk(_0x2e27bd),_0x376a48=_0x2e27bd['web'],_0x510ced=_0x2e27bd['site'];try{const _0x191dd3=_0x4c4bc0[0x0];let _0x2409bb=_0x191dd3,_0x154b8f,_0x5111a6;if(_0x191dd3&&_0x191dd3[_0x1ea1b2(0x1d9)]('/')){const _0x2a0fc8=_0x191dd3['split']('/');if(_0x2a0fc8[_0x1ea1b2(0x1cd)]===0x2){const [_0x565d6e,_0x1b7e70]=_0x2a0fc8,_0x7f4c2f=await _0x3a9ca0[_0x1ea1b2(0x263)][_0x1ea1b2(0x274)](),_0x394f47=_0x7f4c2f[_0x1ea1b2(0x1d3)](_0x11e09c=>_0x11e09c[_0x1ea1b2(0x215)]['name']['toLowerCase']()===_0x565d6e[_0x1ea1b2(0x251)]());if(!_0x394f47)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x565d6e,undefined,{'helpText':_0x1ea1b2(0x1c6)});_0x154b8f=_0x394f47['id'],_0x5111a6=_0x394f47[_0x1ea1b2(0x215)][_0x1ea1b2(0x219)],_0x2409bb=_0x1b7e70;}else throw new SDKError(ErrorCode[_0x1ea1b2(0x228)],_0x1ea1b2(0x24f)+_0x191dd3,undefined,{'helpText':_0x1ea1b2(0x256)});}else{const _0x4323dc=await getProjectWithName(_0x1a8f5e);_0x154b8f=_0x4323dc['id'],_0x5111a6=_0x4323dc[_0x1ea1b2(0x219)];}const _0x576070=await withSpinner('Fetching\x20agents...',()=>_0x3a9ca0['llm']['agents'](_0x154b8f),{'verbose':_0x2e27bd[_0x1ea1b2(0x26c)]});let _0x5e8c0c=_0x576070['data'];_0x2409bb&&(_0x5e8c0c=_0x576070[_0x1ea1b2(0x1c1)][_0x1ea1b2(0x1f3)](_0x8402d1=>matchGlobPattern(_0x8402d1[_0x1ea1b2(0x215)]['name'],_0x2409bb)));const _0x4a035a=_0x2e27bd[_0x1ea1b2(0x26d)]===_0x1ea1b2(0x1f2)||_0x2e27bd[_0x1ea1b2(0x26d)]==='jsonl'||_0x2e27bd[_0x1ea1b2(0x26d)]==='table'||_0x2e27bd[_0x1ea1b2(0x26d)]===_0x1ea1b2(0x282);if(_0x4a035a){const _0x576051=_0x5e8c0c[_0x1ea1b2(0x27e)](_0xdcc42c=>({...toAgentInfo(_0xdcc42c),..._0x376a48?{'chatUrl':getLLMAgentChatUrl(_0x510ced,_0x154b8f,_0xdcc42c['id'])}:{}}));await handleSDKOutput(_0x576051,_0x2e27bd);}else{const _0x1717de=[];_0x1717de[_0x1ea1b2(0x206)](_0x108e43['dim']('['+_0x5111a6+']'));if(_0x5e8c0c['length']===0x0)_0x1717de['push'](_0x108e43[_0x1ea1b2(0x26b)](_0x1ea1b2(0x1ff)));else{const _0x52414c=[..._0x5e8c0c][_0x1ea1b2(0x1b7)]((_0x560ae1,_0xd78e76)=>_0x560ae1['attributes'][_0x1ea1b2(0x219)][_0x1ea1b2(0x246)](_0xd78e76[_0x1ea1b2(0x215)][_0x1ea1b2(0x219)]));for(const _0x4de1f6 of _0x52414c){if(_0x376a48){const _0x5549c6=getLLMAgentChatUrl(_0x510ced,_0x154b8f,_0x4de1f6['id']);_0x1717de[_0x1ea1b2(0x206)](_0x1ea1b2(0x1d1)+_0x4de1f6[_0x1ea1b2(0x215)]['name']+'\x20\x20'+_0x108e43['dim'](_0x5549c6));}else _0x1717de[_0x1ea1b2(0x206)](_0x1ea1b2(0x1d1)+_0x4de1f6[_0x1ea1b2(0x215)][_0x1ea1b2(0x219)]);}_0x1717de[_0x1ea1b2(0x206)](_0x108e43[_0x1ea1b2(0x26b)](_0x5e8c0c[_0x1ea1b2(0x1cd)]+_0x1ea1b2(0x243)));}await writeOutput(_0x1717de['join']('\x0a'),_0x2e27bd[_0x1ea1b2(0x239)],_0x1ea1b2(0x1e5));}return 0x0;}catch(_0x5ed147){return handleSDKError(_0x5ed147,_0x2e27bd),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x24b);[a27_0x312b8c(0x236)]=a27_0x312b8c(0x259);async[a27_0x312b8c(0x204)](_0x1be5ac){const _0x4edc0f=a27_0x312b8c,{options:_0x56343e,args:_0x5d4c45,tdx:_0x2e8212}=_0x1be5ac;if(_0x5d4c45[_0x4edc0f(0x1cd)]===0x0)return console[_0x4edc0f(0x1b8)](_0x4edc0f(0x237)),console[_0x4edc0f(0x1b8)](_0x4edc0f(0x23d)),0x1;const _0x2c4bc9=_0x5d4c45[0x0];try{const _0x1df942=await getProjectIdOrDefault(_0x1be5ac),_0x1c1201=await withSpinner(_0x4edc0f(0x203)+_0x2c4bc9+_0x4edc0f(0x1d8),()=>_0x2e8212[_0x4edc0f(0x263)]['resolveAgentId'](_0x2c4bc9,_0x1df942),{'verbose':_0x56343e[_0x4edc0f(0x26c)]}),_0x35d561=await withSpinner(_0x4edc0f(0x23f),()=>_0x2e8212['llm']['agent'](_0x1c1201[_0x4edc0f(0x1c1)]),{'verbose':_0x56343e[_0x4edc0f(0x26c)]});return await handleSDKOutput([_0x35d561[_0x4edc0f(0x1c1)]],_0x56343e),0x0;}catch(_0xa8b788){return handleSDKError(_0xa8b788,_0x56343e),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a27_0x312b8c(0x219)]='llm:agent:create';['description']=a27_0x312b8c(0x1dc);async[a27_0x312b8c(0x204)](_0x52d951){const _0x5c16f4=a27_0x312b8c,{options:_0x48d197,args:_0x16c72d,tdx:_0x3f3ab2}=_0x52d951;if(_0x16c72d[_0x5c16f4(0x1cd)]===0x0)return console[_0x5c16f4(0x1b8)](_0x5c16f4(0x237)),console[_0x5c16f4(0x1b8)]('Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]'),console[_0x5c16f4(0x1b8)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]'),0x1;const _0x2a9388=_0x16c72d[0x0],_0x3f66a0=_0x48d197,_0x527c64=_0x3f66a0[_0x5c16f4(0x227)],_0x6ba547=_0x3f66a0[_0x5c16f4(0x1e0)]||_0x5c16f4(0x23a),_0x30641f=_0x3f66a0[_0x5c16f4(0x22f)],_0x266ea6=_0x3f66a0[_0x5c16f4(0x249)]?Number(_0x3f66a0[_0x5c16f4(0x249)]):undefined,_0x44a787=_0x3f66a0[_0x5c16f4(0x27a)]?Number(_0x3f66a0['temperature']):undefined;try{let _0x1d0484,_0x153255;if(_0x2a9388[_0x5c16f4(0x1d9)]('/')){const _0x22647b=_0x2a9388[_0x5c16f4(0x288)]('/');if(_0x22647b['length']===0x2){const [_0x1652d5,_0x4ea765]=_0x22647b,_0x4d98b1=await withSpinner(_0x5c16f4(0x20f)+_0x1652d5+'\x27...',()=>_0x3f3ab2[_0x5c16f4(0x263)][_0x5c16f4(0x201)](_0x1652d5),{'verbose':_0x48d197[_0x5c16f4(0x26c)]});_0x1d0484=_0x4d98b1['data'],_0x153255=_0x4ea765;}else throw new SDKError(ErrorCode[_0x5c16f4(0x228)],'Invalid\x20path\x20syntax:\x20'+_0x2a9388,undefined,{'helpText':_0x5c16f4(0x256)});}else _0x1d0484=await getProjectIdOrDefault(_0x52d951),_0x153255=_0x2a9388;const _0x4deafb=await withSpinner(_0x5c16f4(0x1d6)+_0x153255+_0x5c16f4(0x1d8),()=>_0x3f3ab2[_0x5c16f4(0x263)][_0x5c16f4(0x1e4)]({'name':_0x153255,'projectId':_0x1d0484,'modelType':_0x6ba547,'systemPrompt':_0x527c64,'starterMessage':_0x30641f,'maxToolIterations':_0x266ea6,'temperature':_0x44a787}),{'verbose':_0x48d197['verbose']});return console[_0x5c16f4(0x245)]('Agent\x20created:\x20'+_0x4deafb[_0x5c16f4(0x1c1)]['id']),await handleSDKOutput([_0x4deafb[_0x5c16f4(0x1c1)]],_0x48d197),0x0;}catch(_0x359584){return handleSDKError(_0x359584,_0x48d197),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x289);['description']=a27_0x312b8c(0x234);async['execute'](_0xb6ede2){const _0x50b94f=a27_0x312b8c,{options:_0x3a2bf7,args:_0x23eb26,tdx:_0x3d307c}=_0xb6ede2;if(_0x23eb26[_0x50b94f(0x1cd)]===0x0)return console[_0x50b94f(0x1b8)](_0x50b94f(0x237)),console[_0x50b94f(0x1b8)](_0x50b94f(0x250)),0x1;const _0x3c2291=_0x23eb26[0x0],_0x58b6c0=_0x3a2bf7,_0x110f85=_0x58b6c0[_0x50b94f(0x219)],_0x2742d5=_0x58b6c0[_0x50b94f(0x218)],_0xb779f3=_0x58b6c0[_0x50b94f(0x236)],_0x2f624b=_0x58b6c0[_0x50b94f(0x22f)];if(!_0x110f85&&!_0x2742d5&&!_0xb779f3&&!_0x2f624b)return console[_0x50b94f(0x1b8)](_0x50b94f(0x247)),console[_0x50b94f(0x1b8)](_0x50b94f(0x1b4)),0x1;try{const _0x4c3891=await getProjectIdOrDefault(_0xb6ede2),_0xe2f4eb=await withSpinner(_0x50b94f(0x203)+_0x3c2291+'\x27...',()=>_0x3d307c[_0x50b94f(0x263)][_0x50b94f(0x283)](_0x3c2291,_0x4c3891),{'verbose':_0x3a2bf7[_0x50b94f(0x26c)]}),_0x57858d=_0xe2f4eb[_0x50b94f(0x1c1)],_0x4ef1cf=await withSpinner(_0x50b94f(0x221),()=>_0x3d307c[_0x50b94f(0x263)][_0x50b94f(0x285)](_0x57858d,{'name':_0x110f85,'prompt':_0x2742d5,'description':_0xb779f3,'starterMessage':_0x2f624b}),{'verbose':_0x3a2bf7[_0x50b94f(0x26c)]});return console[_0x50b94f(0x245)](_0x50b94f(0x278)+_0x4ef1cf['data']['id']),await handleSDKOutput([_0x4ef1cf[_0x50b94f(0x1c1)]],_0x3a2bf7),0x0;}catch(_0x4e39d7){return handleSDKError(_0x4e39d7,_0x3a2bf7),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x1c8);['description']=a27_0x312b8c(0x21b);async[a27_0x312b8c(0x204)](_0x42705a){const _0x48e02=a27_0x312b8c,{options:_0x3cc035,args:_0x596032,tdx:_0x4684b6}=_0x42705a;if(_0x596032[_0x48e02(0x1cd)]===0x0)return console[_0x48e02(0x1b8)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x48e02(0x1b8)](_0x48e02(0x233)),0x1;const _0x903bfb=_0x596032[0x0];try{const _0x4038f1=await getProjectIdOrDefault(_0x42705a),_0x23e43b=await withSpinner('Resolving\x20agent\x20\x27'+_0x903bfb+_0x48e02(0x1d8),()=>_0x4684b6['llm'][_0x48e02(0x283)](_0x903bfb,_0x4038f1),{'verbose':_0x3cc035[_0x48e02(0x26c)]}),_0x50a879=_0x23e43b[_0x48e02(0x1c1)];return await withSpinner(_0x48e02(0x1dd),()=>_0x4684b6[_0x48e02(0x263)][_0x48e02(0x217)](_0x50a879),{'verbose':_0x3cc035[_0x48e02(0x26c)]}),console['log'](_0x48e02(0x20b)+_0x50a879),0x0;}catch(_0x5c6164){return handleSDKError(_0x5c6164,_0x3cc035),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x232);['description']=a27_0x312b8c(0x265);async[a27_0x312b8c(0x204)](_0x258581){return executeChatHistoryCommand(_0x258581,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x1e2);[a27_0x312b8c(0x236)]=a27_0x312b8c(0x1fe);async[a27_0x312b8c(0x204)](_0x426171){const _0x3a13ae=a27_0x312b8c,{options:_0x3f5803,args:_0x42e7c0,tdx:_0x67db3c}=_0x426171;if(_0x42e7c0[_0x3a13ae(0x1cd)]===0x0)return console[_0x3a13ae(0x1b8)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x3a13ae(0x1b8)](_0x3a13ae(0x1fb)),0x1;const _0x560d61=_0x42e7c0[0x0];try{return await withSpinner(_0x3a13ae(0x229)+_0x560d61+'\x27...',()=>_0x67db3c[_0x3a13ae(0x263)][_0x3a13ae(0x1e6)](_0x560d61),{'verbose':_0x3f5803[_0x3a13ae(0x26c)]}),console[_0x3a13ae(0x245)](_0x3a13ae(0x235)+_0x560d61),0x0;}catch(_0x234a50){return handleSDKError(_0x234a50,_0x3f5803),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x268);[a27_0x312b8c(0x236)]='Create\x20a\x20new\x20LLM\x20project';async[a27_0x312b8c(0x204)](_0x5829bf){const _0x3ddfae=a27_0x312b8c,{options:_0x27c3c3,args:_0x1ecbf2,tdx:_0x568ba7}=_0x5829bf;if(_0x1ecbf2[_0x3ddfae(0x1cd)]===0x0)return console[_0x3ddfae(0x1b8)](_0x3ddfae(0x248)),console['error'](_0x3ddfae(0x24d)),0x1;const _0x2cca97=_0x1ecbf2[0x0],_0x166f5c=_0x27c3c3,_0x25d2fa=_0x166f5c[_0x3ddfae(0x236)];try{const _0x509c3e=await withSpinner('Creating\x20project\x20\x27'+_0x2cca97+_0x3ddfae(0x1d8),()=>_0x568ba7['llm'][_0x3ddfae(0x1c5)]({'name':_0x2cca97,'description':_0x25d2fa}),{'verbose':_0x27c3c3[_0x3ddfae(0x26c)]});console[_0x3ddfae(0x245)]('Project\x20created:\x20'+_0x509c3e[_0x3ddfae(0x1c1)]['id']);const _0x106cdc=toLLMProjectInfo(_0x509c3e[_0x3ddfae(0x1c1)]);return await handleSDKOutput([_0x106cdc],_0x27c3c3),0x0;}catch(_0x10a023){return handleSDKError(_0x10a023,_0x27c3c3),0x1;}}}function a27_0x48b6(){const _0x12e5ad=['Setting\x20project\x20context\x20to\x20\x27','h\x20ago','createdAt','\x0aCancelled','prompts','(no\x20message)','starterMessage','toLocaleDateString','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','llm:history','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','Update\x20an\x20existing\x20agent','Project\x20context\x20set\x20to:\x20','description','Error:\x20Agent\x20name\x20is\x20required','stack','output','claude-4.5-haiku','No\x20messages\x20found\x20in\x20chat\x20history.','[unknown]','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Error:\x20Backup\x20folder\x20path\x20is\x20required','Fetching\x20agent...','47512OccWjn','Error:\x20','projectName','\x20agent(s)','knowledgeBases','log','localeCompare','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Error:\x20Project\x20name\x20is\x20required','maxToolIterations','chats','llm:agent:show','\x20\x20Integrations:\x20','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','select','Invalid\x20path\x20syntax:\x20','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','toLowerCase','Backing\x20up\x20project\x20\x27','cyan','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','site','Use\x20format:\x20project-name/agent-name','\x20->\x20Agent:','targetKnowledgeBase','Show\x20agent\x20details','Getting\x20default\x20project...','targetAgent','agentId','\x20->\x20KB:','List\x20agents\x20in\x20current\x20project','704940MqUvoI','[tool_call]','getCurrentProject','\x27\x20already\x20exists.\x20Overwrite?','llm','backupProject','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','updatedAt','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','llm:project:create','yes','blue','dim','verbose','format','existsSync','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','getTime','Backup\x20cancelled.','(no\x20agent)','\x20project(s)','projects','\x20->\x20WebSearch:','message','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Agent\x20updated:\x20','magenta','temperature','llm:models','tool_call','tool','map','\x20\x20\x20Examples:','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','getBackupMetadata','tsv','resolveAgentId','List\x20all\x20LLM\x20projects','updateAgent','agents','agent','split','llm:agent:update','.llm','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Load\x20more...','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','red','limit','sort','error','set','Analyzing\x20project\x20\x27','short','cause','77rDMRWC','Output\x20directory\x20\x27','web','entries','data','get','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','image','createProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','targetWebSearchTool','llm:agent:delete','19428CpiNfd','24kUMggJ','targetImageGenerator','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','length','Project\x20deleted:\x20','Validating\x20backup\x20from\x20\x27','8656398qrvmtS','🤖\x20','\x20--last','find','\x20\x20Agents:\x20','join','Creating\x20agent\x20\x27','llm:project:delete','\x27...','includes','1568330lhMSHv','green','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Deleting\x20agent...','stringify','models','model','[content]','llm:use','Fetching\x20most\x20recent\x20chat...','createAgent','table','setCurrentProject','\x20\x20Cause:\x20','sourceSite','chatId','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','llm:agents','input','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','11FSwulO','outputDir','186SMSLsi','counts','json','filter','\x20->\x20ImageGen:','4361236tfFoyl','[tool]\x20\x20\x20','680040GlXdRB','m\x20ago','llm:project:restore','yellow','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Fetching\x20chat\x20sessions...','⚒️\x20','Set\x20current\x20project\x20context','No\x20agents\x20found','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','resolveProjectId','content','Resolving\x20agent\x20\x27','execute','Deleting\x20project\x20\x27','push','en-US','Select\x20a\x20chat\x20session:','\x20\x20Knowledge\x20Bases:\x20','substring','Agent\x20deleted:\x20','llmProject','integrations','all','Resolving\x20project\x20\x27','\x20→\x20chat:\x20','exportedFrom','floor','bold','dryRun','attributes','\x20bytes)','deleteAgent','prompt','name','jsonl','Delete\x20an\x20agent','...','default','llm:projects','string','\x20-\x20','Updating\x20agent...','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','__load_more__','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','Project\x20backed\x20up\x20to:\x20','[image]\x20\x20','systemPrompt','INVALID_ARGUMENT'];a27_0x48b6=function(){return _0x12e5ad;};return a27_0x48b6();}export class LLMProjectDeleteCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x1d7);[a27_0x312b8c(0x236)]='Delete\x20an\x20LLM\x20project';async[a27_0x312b8c(0x204)](_0xc91785){const _0x5e4916=a27_0x312b8c,{options:_0x2c1065,args:_0x4071f7,tdx:_0x1f0637}=_0xc91785;if(_0x4071f7[_0x5e4916(0x1cd)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x5e4916(0x1b8)](_0x5e4916(0x1cc)),0x1;const _0x65380d=_0x4071f7[0x0];try{return await withSpinner(_0x5e4916(0x205)+_0x65380d+_0x5e4916(0x1d8),()=>_0x1f0637[_0x5e4916(0x263)]['deleteProject'](_0x65380d),{'verbose':_0x2c1065['verbose']}),console['log'](_0x5e4916(0x1ce)+_0x65380d),0x0;}catch(_0x48395c){return handleSDKError(_0x48395c,_0x2c1065),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a27_0x312b8c(0x219)]='llm:project:backup';[a27_0x312b8c(0x236)]=a27_0x312b8c(0x26f);async['execute'](_0x30df27){const _0x35f8b5=a27_0x312b8c,{options:_0x477c8e,args:_0x5caf93,tdx:_0x4f5e2c}=_0x30df27,_0x4d5226=getChalk(_0x477c8e);console[_0x35f8b5(0x245)](_0x4d5226[_0x35f8b5(0x1fa)](_0x35f8b5(0x1c3))),console['log'](_0x4d5226[_0x35f8b5(0x1fa)](_0x35f8b5(0x254))),console[_0x35f8b5(0x245)](_0x4d5226['dim'](_0x35f8b5(0x280))),console[_0x35f8b5(0x245)]();if(_0x5caf93[_0x35f8b5(0x1cd)]===0x0)return console[_0x35f8b5(0x1b8)](_0x35f8b5(0x248)),console['error'](_0x35f8b5(0x1ea)),0x1;const _0xc17519=_0x5caf93[0x0],_0x595403=_0x477c8e,_0x581e75=_0x595403['output'],_0x2ddb6a=_0x595403[_0x35f8b5(0x214)];try{const _0x2f578d=_0x581e75||_0xc17519+_0x35f8b5(0x28a);if(a27_0x1ad4a7[_0x35f8b5(0x26e)](_0x2f578d)&&!_0x2ddb6a){if(!_0x477c8e['yes']){const _0x2df9b0=await confirm(_0x35f8b5(0x1be)+_0x2f578d+_0x35f8b5(0x262));if(!_0x2df9b0)return console[_0x35f8b5(0x245)](_0x35f8b5(0x271)),0x0;}a27_0x1ad4a7['rmSync'](_0x2f578d,{'recursive':!![]});}const _0x5aae94=await withSpinner(_0x2ddb6a?_0x35f8b5(0x1ba)+_0xc17519+_0x35f8b5(0x1d8):_0x35f8b5(0x252)+_0xc17519+_0x35f8b5(0x1d8),()=>_0x4f5e2c[_0x35f8b5(0x263)][_0x35f8b5(0x264)](_0xc17519,_0x581e75,{'dryRun':_0x2ddb6a}),{'verbose':_0x477c8e['verbose']}),_0x374e14=_0x5aae94['data'];return _0x2ddb6a?console[_0x35f8b5(0x245)](_0x35f8b5(0x1ed)+_0x374e14[_0x35f8b5(0x1ef)]):console['log'](_0x35f8b5(0x225)+_0x374e14[_0x35f8b5(0x1ef)]),console[_0x35f8b5(0x245)](_0x35f8b5(0x1d4)+_0x374e14[_0x35f8b5(0x1f1)][_0x35f8b5(0x286)]),console[_0x35f8b5(0x245)](_0x35f8b5(0x209)+_0x374e14[_0x35f8b5(0x1f1)][_0x35f8b5(0x244)]),console['log']('\x20\x20Prompts:\x20'+_0x374e14['counts'][_0x35f8b5(0x22d)]),console[_0x35f8b5(0x245)]('\x20\x20Integrations:\x20'+_0x374e14['counts'][_0x35f8b5(0x20d)]),(_0x477c8e[_0x35f8b5(0x26d)]===_0x35f8b5(0x1f2)||_0x477c8e[_0x35f8b5(0x26d)]===_0x35f8b5(0x21a))&&await handleSDKOutput([_0x374e14],_0x477c8e),0x0;}catch(_0xe4a988){return handleSDKError(_0xe4a988,_0x477c8e),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']=a27_0x312b8c(0x1f9);[a27_0x312b8c(0x236)]=a27_0x312b8c(0x200);async[a27_0x312b8c(0x204)](_0x40d04c){const _0x3e647c=a27_0x312b8c,{options:_0x558f9d,args:_0x39895f,tdx:_0x233aaf}=_0x40d04c,_0x50b01c=getChalk(_0x558f9d);console[_0x3e647c(0x245)](_0x50b01c[_0x3e647c(0x1fa)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.')),console[_0x3e647c(0x245)](_0x50b01c[_0x3e647c(0x1fa)](_0x3e647c(0x231))),console[_0x3e647c(0x245)](_0x50b01c[_0x3e647c(0x26b)](_0x3e647c(0x27f))),console['log'](_0x50b01c[_0x3e647c(0x26b)]('\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/')),console[_0x3e647c(0x245)](_0x50b01c['dim'](_0x3e647c(0x224))),console['log']();if(_0x39895f[_0x3e647c(0x1cd)]===0x0)return console[_0x3e647c(0x1b8)](_0x3e647c(0x23e)),console[_0x3e647c(0x1b8)](_0x3e647c(0x277)),0x1;const _0x4cfdfe=_0x39895f[0x0],_0x2d5fe0=_0x558f9d,_0x210548=_0x2d5fe0[_0x3e647c(0x219)],_0x502aef=_0x2d5fe0['dryRun'];try{if(!_0x502aef){const _0x5e1754=_0x233aaf[_0x3e647c(0x263)][_0x3e647c(0x281)](_0x4cfdfe),_0x598462=_0x210548||_0x5e1754[_0x3e647c(0x211)][_0x3e647c(0x242)],_0x405bb3=await withSpinner('Checking\x20for\x20existing\x20projects...',()=>_0x233aaf['llm'][_0x3e647c(0x274)](),{'verbose':_0x558f9d['verbose']}),_0x52e0d4=_0x405bb3[_0x3e647c(0x1c1)][_0x3e647c(0x1d3)](_0x58a854=>_0x58a854[_0x3e647c(0x215)][_0x3e647c(0x219)]===_0x598462);if(_0x52e0d4&&!_0x558f9d[_0x3e647c(0x269)]){const _0x2dbdb9=await confirm('A\x20project\x20named\x20\x27'+_0x598462+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x2dbdb9)return console['log']('Restore\x20cancelled.'),0x0;}}const _0x5c41e6=await withSpinner(_0x502aef?_0x3e647c(0x1cf)+_0x4cfdfe+_0x3e647c(0x1d8):'Restoring\x20project\x20from\x20\x27'+_0x4cfdfe+'\x27...',()=>_0x233aaf['llm']['restoreProject'](_0x4cfdfe,{'name':_0x210548,'dryRun':_0x502aef}),{'verbose':_0x558f9d[_0x3e647c(0x26c)]}),_0x3e98c2=_0x5c41e6[_0x3e647c(0x1c1)];return _0x3e98c2[_0x3e647c(0x1e8)]&&console[_0x3e647c(0x245)](_0x3e647c(0x28b)+_0x3e98c2[_0x3e647c(0x1e8)]+'\x27'),_0x502aef?console[_0x3e647c(0x245)](_0x3e647c(0x222)+_0x3e98c2[_0x3e647c(0x242)]):console[_0x3e647c(0x245)]('Project\x20restored:\x20'+_0x3e98c2[_0x3e647c(0x242)]+'\x20('+_0x3e98c2['projectId']+')'),console['log'](_0x3e647c(0x1d4)+_0x3e98c2[_0x3e647c(0x1f1)]['agents']),console[_0x3e647c(0x245)]('\x20\x20Knowledge\x20Bases:\x20'+_0x3e98c2['counts']['knowledgeBases']),console[_0x3e647c(0x245)]('\x20\x20Prompts:\x20'+_0x3e98c2[_0x3e647c(0x1f1)][_0x3e647c(0x22d)]),console[_0x3e647c(0x245)](_0x3e647c(0x24c)+_0x3e98c2[_0x3e647c(0x1f1)][_0x3e647c(0x20d)]),(_0x558f9d[_0x3e647c(0x26d)]===_0x3e647c(0x1f2)||_0x558f9d[_0x3e647c(0x26d)]===_0x3e647c(0x21a))&&await handleSDKOutput([_0x3e98c2],_0x558f9d),0x0;}catch(_0x3c391a){return handleSDKError(_0x3c391a,_0x558f9d),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x466307,_0x2e6298){const _0x40615f=a27_0x312b8c,_0xb1a745=_0x2e6298[_0x40615f(0x1b6)]||CHAT_SELECTOR_PAGE_SIZE;let _0x49795b=0x0,_0x463383=[];const _0x2c272d=(await import(_0x40615f(0x22d)))[_0x40615f(0x21d)],_0x5e506c=getChalk(_0x2e6298);while(!![]){const _0x286d3e=await withSpinner(_0x40615f(0x1fc),()=>_0x466307['llm'][_0x40615f(0x24a)](_0xb1a745+_0x49795b),{'verbose':_0x2e6298['verbose']});_0x463383=_0x286d3e[_0x40615f(0x1c1)];const _0x181727=_0x463383['slice'](_0x49795b,_0x49795b+_0xb1a745),_0x24fe23=_0x463383['length']>_0x49795b+_0xb1a745,_0x4ce3fc=[...new Set(_0x181727[_0x40615f(0x27e)](_0x60b4e4=>_0x60b4e4['attributes'][_0x40615f(0x25c)])[_0x40615f(0x1f3)](_0x26d791=>_0x26d791!==undefined))],_0x234b66=new Map();await Promise[_0x40615f(0x20e)](_0x4ce3fc[_0x40615f(0x27e)](async _0x3a1c2d=>{const _0x39c2d4=_0x40615f;try{const _0x2d5d38=await _0x466307['llm'][_0x39c2d4(0x287)](_0x3a1c2d);_0x234b66['set'](_0x3a1c2d,_0x2d5d38['attributes'][_0x39c2d4(0x219)]);}catch{_0x234b66[_0x39c2d4(0x1b9)](_0x3a1c2d,_0x3a1c2d);}}));const _0x167c77=_0x181727[_0x40615f(0x27e)](_0x4f0ba7=>{const _0x3bb9b6=_0x40615f,_0x31e8b7=_0x4f0ba7[_0x3bb9b6(0x215)]['firstInputContent']||_0x3bb9b6(0x22e),_0x1f5516=_0x31e8b7[_0x3bb9b6(0x288)]('\x0a')[0x0],_0x190c90=_0x1f5516['length']>0x50?_0x1f5516[_0x3bb9b6(0x20a)](0x0,0x4d)+_0x3bb9b6(0x21c):_0x1f5516,_0x19ede3=_0x4f0ba7[_0x3bb9b6(0x215)][_0x3bb9b6(0x25c)]?_0x234b66[_0x3bb9b6(0x1c2)](_0x4f0ba7['attributes'][_0x3bb9b6(0x25c)])||_0x4f0ba7[_0x3bb9b6(0x215)][_0x3bb9b6(0x25c)]:_0x3bb9b6(0x272),_0x2e69c5=_0x4f0ba7[_0x3bb9b6(0x215)]['lastConversationAt']||_0x4f0ba7['attributes']['updatedAt'],_0x8f5560=new Date(_0x2e69c5),_0x191d66=new Date(),_0x31467d=_0x191d66['getTime']()-_0x8f5560[_0x3bb9b6(0x270)](),_0x3b7f86=Math['floor'](_0x31467d/0xea60),_0x11ce81=Math[_0x3bb9b6(0x212)](_0x31467d/0x36ee80),_0x5a6f75=Math[_0x3bb9b6(0x212)](_0x31467d/0x5265c00);let _0x19cba4;if(_0x3b7f86<0x1)_0x19cba4='just\x20now';else{if(_0x3b7f86<0x3c)_0x19cba4=_0x3b7f86+_0x3bb9b6(0x1f8);else{if(_0x11ce81<0x18)_0x19cba4=_0x11ce81+_0x3bb9b6(0x22a);else _0x5a6f75<0x7?_0x19cba4=_0x5a6f75+'d\x20ago':_0x19cba4=_0x8f5560[_0x3bb9b6(0x230)](_0x3bb9b6(0x207),{'month':_0x3bb9b6(0x1bb),'day':'numeric'});}}return{'title':_0x190c90+'\x20'+_0x5e506c[_0x3bb9b6(0x26b)]('['+_0x19ede3+']\x20'+_0x19cba4),'value':_0x4f0ba7['id']};});_0x24fe23&&_0x167c77['push']({'title':_0x5e506c[_0x40615f(0x253)](_0x40615f(0x28c)),'value':_0x40615f(0x223)});const _0x14d530=await _0x2c272d({'type':_0x40615f(0x24e),'name':_0x40615f(0x1e9),'message':_0x40615f(0x208),'choices':_0x167c77,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x14d530[_0x40615f(0x1e9)])return undefined;if(_0x14d530[_0x40615f(0x1e9)]===_0x40615f(0x223)){_0x49795b+=_0xb1a745;continue;}return _0x14d530[_0x40615f(0x1e9)];}}export class ChatsCommand extends BaseCommand{[a27_0x312b8c(0x219)]=a27_0x312b8c(0x24a);[a27_0x312b8c(0x236)]='Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history';async[a27_0x312b8c(0x204)](_0x37b5fe){return executeChatHistoryCommand(_0x37b5fe,'tdx\x20chats');}}
@@ -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_0x1588(){const _0x385464=['created\x20on-demand\x20per\x20model','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','8DhTEaY','625828kyvXGF','description','2997444ORVIKp','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','log','http://0.0.0.0:','projects','12UAMrZz','llmProject','\x20\x20Site:','8641791IykauK','find','stop','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','llm:proxy','start','exit','yellow','green','SIGINT','white','\x20\x20Agents:','Server\x20Configuration:','58782Lvuxxz','\x20is\x20unavailable,\x20using\x20port\x20','name','NOT_FOUND','server','\x0aClaude\x20Code\x20Configuration:','dim','4307670SFvBeY','logger','site','execute','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','Resolving\x20project...','Starting\x20proxy\x20server...','llm','3882oqECRP','cyan','bold','close','468000jHJQVO','project','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','logLevel','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','✓\x20Proxy\x20server\x20stopped','Project\x20\x27','\x20\x20\x20\x20}','\x20\x20Project:','\x20\x20}','3682mWUVYK','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','attributes','Port\x20','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','\x0a\x0aShutting\x20down\x20proxy\x20server...'];a28_0x1588=function(){return _0x385464;};return a28_0x1588();}const a28_0x4c5f0e=a28_0x509f;(function(_0x133bbc,_0x994bf6){const _0x428ffe=a28_0x509f,_0x25fee4=_0x133bbc();while(!![]){try{const _0x1d7a48=-parseInt(_0x428ffe(0xe2))/0x1+parseInt(_0x428ffe(0xf9))/0x2*(-parseInt(_0x428ffe(0xe9))/0x3)+parseInt(_0x428ffe(0xe4))/0x4+-parseInt(_0x428ffe(0x100))/0x5+-parseInt(_0x428ffe(0xcb))/0x6*(-parseInt(_0x428ffe(0xd9))/0x7)+parseInt(_0x428ffe(0xe1))/0x8*(parseInt(_0x428ffe(0xec))/0x9)+parseInt(_0x428ffe(0xcf))/0xa;if(_0x1d7a48===_0x994bf6)break;else _0x25fee4['push'](_0x25fee4['shift']());}catch(_0x3df871){_0x25fee4['push'](_0x25fee4['shift']());}}}(a28_0x1588,0x780ec));import a28_0x5e9362 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';function a28_0x509f(_0x4c2bd4,_0x27d686){_0x4c2bd4=_0x4c2bd4-0xca;const _0x1588cc=a28_0x1588();let _0x509f08=_0x1588cc[_0x4c2bd4];return _0x509f08;}import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x1c0abd,_0x50904f){const _0x56568a=a28_0x509f,{tdx:_0x495d82,options:_0x530f41}=_0x1c0abd,_0x3c163d=_0x50904f||_0x530f41[_0x56568a(0xea)];if(_0x3c163d){const _0x16b940=await _0x495d82[_0x56568a(0xca)][_0x56568a(0xe8)](),_0x1cfe49=_0x16b940['find'](_0x2aacc9=>_0x2aacc9[_0x56568a(0xdb)][_0x56568a(0xfb)]===_0x3c163d);if(!_0x1cfe49)throw new SDKError(ErrorCode[_0x56568a(0xfc)],_0x56568a(0xd5)+_0x3c163d+'\x27\x20not\x20found',undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0x1cfe49['id'];}const _0x8f0548=await _0x495d82[_0x56568a(0xca)]['getOrCreateDefaultProject']();return _0x8f0548['id'];}export class LLMProxyCommand extends BaseCommand{[a28_0x4c5f0e(0xfb)]=a28_0x4c5f0e(0xf0);[a28_0x4c5f0e(0xe3)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a28_0x4c5f0e(0xfd)];['logger'];async[a28_0x4c5f0e(0x103)](_0x2a4608){const _0x257d1e=a28_0x4c5f0e,{tdx:_0x496572,options:_0x3dd490}=_0x2a4608;try{const _0x3129b9=_0x3dd490,_0x38efd0=_0x3129b9['port']||0xfa0,_0x1ecc7a=_0x3129b9[_0x257d1e(0xd0)],_0xa1bb17=await findAvailablePort(_0x38efd0);console['log'](a28_0x5e9362['dim'](_0x257d1e(0x105)));const _0xcab8a7=await getProjectIdOrDefault(_0x2a4608,_0x1ecc7a),_0x257488=await _0x496572['llm'][_0x257d1e(0xe8)](),_0x17c654=_0x257488[_0x257d1e(0xed)](_0x1775cf=>_0x1775cf['id']===_0xcab8a7);this[_0x257d1e(0x101)]=new TDXLogger(_0x3dd490[_0x257d1e(0xd2)]),await this[_0x257d1e(0x101)]['init'](),console[_0x257d1e(0xe6)](a28_0x5e9362['dim'](_0x257d1e(0x106)));_0xa1bb17!==_0x38efd0&&console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf3)](_0x257d1e(0xdc)+_0x38efd0+_0x257d1e(0xfa)+_0xa1bb17));this['server']=new ProxyServer({'port':_0xa1bb17,'projectId':_0xcab8a7,'tdx':_0x496572,'logger':this[_0x257d1e(0x101)],'site':_0x3dd490[_0x257d1e(0x102)]}),await this[_0x257d1e(0xfd)][_0x257d1e(0xf1)](),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf3)][_0x257d1e(0xcd)](_0x257d1e(0xe0))),console['log'](a28_0x5e9362['yellow'](_0x257d1e(0xda))),console['log'](a28_0x5e9362['yellow']('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf4)]['bold'](_0x257d1e(0xd1))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xcc)](_0x257d1e(0xf8))),console[_0x257d1e(0xe6)](a28_0x5e9362['dim']('\x20\x20Address:'),a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xe7)+_0xa1bb17)),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)](_0x257d1e(0xd7)),a28_0x5e9362['white'](_0x17c654?.[_0x257d1e(0xdb)][_0x257d1e(0xfb)]||_0xcab8a7)),console['log'](a28_0x5e9362['dim'](_0x257d1e(0xf7)),a28_0x5e9362['white'](_0x257d1e(0xdf))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)](_0x257d1e(0xeb)),a28_0x5e9362[_0x257d1e(0xf6)](_0x3dd490['site'])),console['log'](a28_0x5e9362[_0x257d1e(0xcc)](_0x257d1e(0xfe))),console[_0x257d1e(0xe6)](a28_0x5e9362['dim'](_0x257d1e(0xd3))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)]('\x20\x20{')),console[_0x257d1e(0xe6)](a28_0x5e9362['white']('\x20\x20\x20\x20\x22env\x22:\x20{')),console['log'](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xe5)+_0xa1bb17+'\x22,')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xdd))),console[_0x257d1e(0xe6)](a28_0x5e9362['white'](_0x257d1e(0x104))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xd6))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf6)](_0x257d1e(0xd8))),console['log'](a28_0x5e9362['cyan']('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)](_0x257d1e(0xef))),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xff)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x257d1e(0xe6)](a28_0x5e9362['dim']('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x257d1e(0xe6)](a28_0x5e9362[_0x257d1e(0xf3)]('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x1af664=async()=>{const _0x29f965=_0x257d1e;console[_0x29f965(0xe6)](a28_0x5e9362[_0x29f965(0xff)](_0x29f965(0xde))),this[_0x29f965(0xfd)]&&await this[_0x29f965(0xfd)][_0x29f965(0xee)](),this[_0x29f965(0x101)]&&await this[_0x29f965(0x101)][_0x29f965(0xce)](),console['log'](a28_0x5e9362[_0x29f965(0xf4)](_0x29f965(0xd4))),process[_0x29f965(0xf2)](0x0);};return process['on'](_0x257d1e(0xf5),_0x1af664),process['on']('SIGTERM',_0x1af664),await new Promise(()=>{}),0x0;}catch(_0xd3ccc){this[_0x257d1e(0xfd)]&&await this[_0x257d1e(0xfd)][_0x257d1e(0xee)]();this['logger']&&await this[_0x257d1e(0x101)][_0x257d1e(0xce)]();throw _0xd3ccc;}}}
@@ -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_0x192174=a29_0x193b;(function(_0x443d3d,_0x47e923){const _0x40d020=a29_0x193b,_0x5441ad=_0x443d3d();while(!![]){try{const _0x3542bc=parseInt(_0x40d020(0x29e))/0x1+parseInt(_0x40d020(0x1cc))/0x2+parseInt(_0x40d020(0x2c6))/0x3+-parseInt(_0x40d020(0x1be))/0x4+-parseInt(_0x40d020(0x25f))/0x5+-parseInt(_0x40d020(0x215))/0x6*(-parseInt(_0x40d020(0x281))/0x7)+-parseInt(_0x40d020(0x1dd))/0x8;if(_0x3542bc===_0x47e923)break;else _0x5441ad['push'](_0x5441ad['shift']());}catch(_0x5674db){_0x5441ad['push'](_0x5441ad['shift']());}}}(a29_0x20ad,0x30e6b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';function a29_0x20ad(){const _0x1b377a=['displaySampleData','stats','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','displayColumns','all','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','resolveParentId','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','schemaValid','allValid','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20--behavior\x20\x22','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','customerPercent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','963660mrmxEt','Fetching\x20parent\x20segment\x20\x27','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','database','\x0aUsage:\x20tdx\x20ps\x20preview\x20','number','query','Session:','Analyzing\x20changes...','Master\x20Table','isDirectory','tdx\x20segment\x20parent\x20preview\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','550324wtFHuL','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','\x20field','\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22','getParentSQL','Created','yes','Resolving\x20parent\x20segment\x20\x27','open','sampleData','List\x20available\x20fields\x20for\x20segmentation','customersWithEvents','map','\x27\x20is\x20up\x20to\x20date','Rows:','toLocaleString','4320136rHJeNX','segment:parent:validate','joinKey','Listing\x20fields\x20for\x20\x27','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','name','match','Aborted.','.yml','behavior','YAML\x20file:\x20','parent_segment','\x20--enriched','red','elapsedTimeMillis','/{name}.yml\x0a','start','\x0aChanges\x20to\x20\x27','✔\x20No\x20changes\x20-\x20\x27','data','\x20=\x20','Attribute:','output','\x20--behavior\x20\x22<name>\x22','\x27...','✔\x20Query\x20completed:\x20Processed\x20','pushParentYaml','Status:','darwin','table','Source:','platform','jobId','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','format','dim','scheduleType','foreignKey','displayPreviewHints','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20--interval\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','listFields','attributes','yellow','Columns:','bold','\x27\x20is\x20already\x20up\x20to\x20date','\x20--attribute\x20\x22<name>\x22','Creating','Listing\x20parent\x20segments\x20matching\x20\x27','✔\x20Updated\x20parent\x20segment\x20\x27','displayBehaviorsStats','timezone','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','6Guutyr','\x5c$&','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','sort','addAttributes','Error:','displayValidateResults','Output\x20file:\x20','Database:\x20','\x20[Job\x20ID:\x20','segment:parent:fields','segment:parent:list','using\x20the\x20default\x20path:\x20','displayMasterInfo','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','To\x20view\x20sample\x20data:','List\x20parent\x20segments','customerGroup','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','workflowAttemptId','Fetching\x20current\x20configuration\x20for\x20\x27','segment:parent:show','Error:\x20File\x20not\x20found:\x20','log','totalEvents','scheduleOption','join','✔\x20Found\x20','Options\x20(one\x20required):\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Listing\x20parent\x20segments...','`\x20to\x20download\x20the\x20configuration\x20first','displayAttributesStats','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','segment:parent:pull','green','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','string','FINISHED','/\x20directories\x20exist.','Name:\x20','\x0aNew\x20parent\x20segment\x20\x27','apply','ignore','displaySummary','coveragePercent','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','master','/\x20directory.\x0a','Updating\x20parent\x20segment\x20\x27','Master\x20+\x20Attributes','/\x20→\x20','Master:','Options:\x0a','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','description','runParent','\x27\x20and\x20run\x20workflow?','schemaError','Preview:','Behaviors','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Behavior:','utf-8','✔\x20Created\x20parent\x20segment\x20\x27','.yaml','No\x20parent\x20segments\x20found','interval','parentSegment','segment:parent:desc','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','867455YmODfE','session','createParent','endsWith','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20kill','\x0aChanges\x20to\x20apply\x20to\x20\x27','run','addAttributesFile','column','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Available\x20behaviors:','test','workflowId','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Validating\x20configuration...','\x0a⚠️\x20\x20Migrating:\x20','/sessions/','Fetching\x20SQL\x20for\x20\x27','workflowSessionId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','jsonl','\x20\x20\x20\x20-\x20','previewParentYaml','Found\x20YAML\x20file:\x20','SQL\x20query:\x0a','/app/workflows/','Site:\x20','\x0a✔\x20Workflow\x20started','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','/attempt/','segment:parent:push','addBehaviors','2323454VIuMGC','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Apply\x20changes\x20to\x20\x27','\x27\x20with\x20ID:\x20','setJobId','\x20parent\x20segment','Errors:','cyan','👥\x20','segment','site','length','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','population','Error\x20reading\x20file:\x20','Error:\x20--database\x20and\x20--table\x20are\x20required','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Error:\x20Parent\x20segment\x20name\x20is\x20required','trim','toFixed','text','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','columns','Join\x20on:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','in\x20','Parent\x20segment:\x20','listParents','enriched','201153RKjfDm','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','json','varchar','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','attributesFile','/app/dw/parentSegments/','error','pullParentYaml','Coverage:','stop','\x20rows)','double','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','rowCount','customerGroupFile','displayPreviewResults','message','attribute','Customers:','matchedCount','Error\x20parsing\x20YAML:\x20','keys','execute','filter','replace','verbose','addBehaviorsFile','getParentFull','xdg-open','✔\x20Renamed\x20directory\x20to\x20','updateParent','Join:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20No\x20sample\x20data\x20available','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','errors','Pattern:\x20','repeat','1039455BqUfqJ','Validate:','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','label','behaviors','preview','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Create\x20parent\x20segment\x20\x27','segment:parent:run','Updating'];a29_0x20ad=function(){return _0x1b377a;};return a29_0x20ad();}import a29_0x46e08e 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';function a29_0x193b(_0x44c409,_0x43ebbf){_0x44c409=_0x44c409-0x1b4;const _0x20adc4=a29_0x20ad();let _0x193ba8=_0x20adc4[_0x44c409];return _0x193ba8;}import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x4cd30e 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='parent_segment';function openBrowser(_0xcd05af){const _0x18542e=a29_0x193b,_0x209be4=process[_0x18542e(0x1fc)],_0x87378e=_0x209be4===_0x18542e(0x1f9)?_0x18542e(0x1d5):_0x209be4==='win32'?_0x18542e(0x1ed):_0x18542e(0x2bc);spawn(_0x87378e,[_0xcd05af],{'detached':!![],'stdio':_0x18542e(0x242)})['unref']();}function migrateLegacyDirectory(){const _0x1242f7=a29_0x193b;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x48b660=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x48b660[_0x1242f7(0x1c8)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1242f7(0x2a6)](a29_0x4cd30e[_0x1242f7(0x20a)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x1242f7(0x23e))),console[_0x1242f7(0x2a6)](a29_0x4cd30e['dim'](_0x1242f7(0x25e)+LEGACY_PARENT_SEGMENT_DIR+_0x1242f7(0x247))),![];console[_0x1242f7(0x2a6)](a29_0x4cd30e[_0x1242f7(0x20a)](_0x1242f7(0x270)+LEGACY_PARENT_SEGMENT_DIR+_0x1242f7(0x24a)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a29_0x4cd30e[_0x1242f7(0x239)](_0x1242f7(0x2bd)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x22fd34){const _0x543522=_0x22fd34 instanceof Error?_0x22fd34[_0x1242f7(0x2b0)]:String(_0x22fd34);return console['error'](a29_0x4cd30e['red']('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x543522+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x192174(0x267)](_0x1f18a6){const _0x5ffa0d=a29_0x192174;return migrateLegacyDirectory(),super[_0x5ffa0d(0x267)](_0x1f18a6);}}function resolveYamlFile(_0x4ff979){const _0x51f9c8=a29_0x192174;if(_0x4ff979[_0x51f9c8(0x262)](_0x51f9c8(0x1e5))||_0x4ff979[_0x51f9c8(0x262)](_0x51f9c8(0x258)))return _0x4ff979;return a29_0x46e08e[_0x51f9c8(0x22f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4ff979)+_0x51f9c8(0x1e5));}function formatProgressMessage(_0x5302a0){const _0x8299de=a29_0x192174,_0x20aba1=_0x5302a0[_0x8299de(0x1e3)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x20aba1){const [,_0x8388c9,_0x1d34a5,_0x29d37e='']=_0x20aba1;return a29_0x4cd30e[_0x8299de(0x201)](_0x8388c9+':')+'\x20'+_0x1d34a5+a29_0x4cd30e[_0x8299de(0x201)](_0x29d37e);}return a29_0x4cd30e[_0x8299de(0x201)](_0x5302a0);}function showFileNotFoundError(_0x5c6c39,_0x10e0f8){const _0x220ef6=a29_0x192174;console[_0x220ef6(0x2a6)](a29_0x4cd30e[_0x220ef6(0x1ea)](_0x220ef6(0x22b)+_0x5c6c39+'\x0a')),console[_0x220ef6(0x2a6)](a29_0x4cd30e['cyan'](_0x220ef6(0x26a)+_0x10e0f8+_0x220ef6(0x234)));}function showParentSegmentNotSetError(_0x4edbcc){const _0x2a390a=a29_0x192174;console[_0x2a390a(0x2a6)](a29_0x4cd30e[_0x2a390a(0x20a)](_0x2a390a(0x207))),console[_0x2a390a(0x2a6)](_0x4edbcc);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x220);[a29_0x192174(0x24e)]=a29_0x192174(0x225);async[a29_0x192174(0x2b6)](_0x4e56bc){const _0x1a159f=a29_0x192174,{options:_0x12d0a3,args:_0x57819b,tdx:_0x1dad05}=_0x4e56bc,_0x161021=_0x57819b[0x0];_0x12d0a3[_0x1a159f(0x2b9)]&&(console[_0x1a159f(0x2a6)](_0x1a159f(0x27b)+_0x12d0a3[_0x1a159f(0x28b)]),_0x161021&&console[_0x1a159f(0x2a6)](_0x1a159f(0x2c4)+_0x161021));const _0x11c498=await withSpinner(_0x161021?_0x1a159f(0x210)+_0x161021+_0x1a159f(0x1f5):_0x1a159f(0x233),()=>_0x1dad05['segment'][_0x1a159f(0x29c)](),{'verbose':_0x12d0a3[_0x1a159f(0x2b9)]});let _0x209410=_0x11c498['data'];if(_0x161021){const _0x62884a=_0x161021[_0x1a159f(0x2b8)](/[.+^${}()|[\]\\]/g,_0x1a159f(0x216))[_0x1a159f(0x2b8)](/\*/g,'.*')[_0x1a159f(0x2b8)](/\?/g,'.'),_0x42b4b2=new RegExp('^'+_0x62884a+'$','i');_0x209410=_0x209410[_0x1a159f(0x2b7)](_0x20a669=>_0x42b4b2[_0x1a159f(0x26c)](_0x20a669['attributes'][_0x1a159f(0x1e2)]));}_0x209410[_0x1a159f(0x218)]((_0xc09054,_0x347ecd)=>_0xc09054[_0x1a159f(0x209)][_0x1a159f(0x1e2)]['localeCompare'](_0x347ecd[_0x1a159f(0x209)][_0x1a159f(0x1e2)])),console['error']('✔\x20Found\x20'+_0x209410[_0x1a159f(0x28c)]+_0x1a159f(0x286)+(_0x209410[_0x1a159f(0x28c)]!==0x1?'s':''));if(_0x12d0a3[_0x1a159f(0x200)]===_0x1a159f(0x2a0)||_0x12d0a3[_0x1a159f(0x200)]===_0x1a159f(0x275))await handleSDKOutput(_0x209410,_0x12d0a3);else{if(_0x209410[_0x1a159f(0x28c)]===0x0)_0x161021?console['log']('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x161021):console['log'](_0x1a159f(0x259));else for(const _0x2fb2f9 of _0x209410){const _0x55a714=_0x2fb2f9[_0x1a159f(0x209)][_0x1a159f(0x28e)]?a29_0x4cd30e[_0x1a159f(0x201)]('\x20('+formatRows(_0x2fb2f9['attributes']['population'])+')'):'';console[_0x1a159f(0x22c)](_0x1a159f(0x289)+_0x2fb2f9['attributes']['name']+_0x55a714);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']='segment:parent:create';[a29_0x192174(0x24e)]=a29_0x192174(0x23b);async[a29_0x192174(0x2b6)](_0x264ef2){const _0x37d869=a29_0x192174,{options:_0x20fd97,args:_0x3360a6,tdx:_0x518c2e}=_0x264ef2;console[_0x37d869(0x2a6)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+'\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 _0xd2f34f=_0x20fd97;if(_0x3360a6[_0x37d869(0x28c)]===0x0)return console['error'](a29_0x4cd30e['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x37d869(0x2a6)](_0x37d869(0x296)),0x1;const _0x1ca10e=_0x3360a6[0x0];if(!_0xd2f34f['database']||!_0xd2f34f[_0x37d869(0x1fa)])return console['error'](_0x37d869(0x290)),console[_0x37d869(0x2a6)](_0x37d869(0x296)),0x1;_0xd2f34f[_0x37d869(0x2b9)]&&(console[_0x37d869(0x2a6)](_0x37d869(0x27b)+_0xd2f34f[_0x37d869(0x28b)]),console[_0x37d869(0x2a6)](_0x37d869(0x23f)+_0x1ca10e),console[_0x37d869(0x2a6)](_0x37d869(0x21d)+_0xd2f34f['database']),console[_0x37d869(0x2a6)]('Table:\x20'+_0xd2f34f[_0x37d869(0x1fa)]));const _0x455d8d=await loadJSONFromOptions(_0xd2f34f[_0x37d869(0x209)],_0xd2f34f[_0x37d869(0x2a4)]),_0x36c080=await loadJSONFromOptions(_0xd2f34f[_0x37d869(0x2cb)],_0xd2f34f['behaviorsFile']),_0x55fcae=await loadJSONFromOptions(_0xd2f34f[_0x37d869(0x226)],_0xd2f34f[_0x37d869(0x2ae)]),_0xbc87f={'name':_0x1ca10e,'description':_0xd2f34f[_0x37d869(0x24e)],'scheduleType':_0xd2f34f['scheduleType'],'scheduleOption':_0xd2f34f[_0x37d869(0x22e)],'timezone':_0xd2f34f[_0x37d869(0x213)],'master':{'parentDatabaseName':_0xd2f34f[_0x37d869(0x1c1)],'parentTableName':_0xd2f34f['table']},'attributes':_0x455d8d,'behaviors':_0x36c080,'customerGroup':_0x55fcae},_0x4e98dc=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x1ca10e+_0x37d869(0x1f5),()=>_0x518c2e[_0x37d869(0x28a)][_0x37d869(0x261)](_0xbc87f),{'verbose':_0x20fd97[_0x37d869(0x2b9)]}),_0x23acde=_0x4e98dc[_0x37d869(0x1f0)];return console[_0x37d869(0x2a6)](_0x37d869(0x257)+_0x23acde[_0x37d869(0x1e2)]+_0x37d869(0x284)+_0x23acde['id']),await handleSDKOutput([_0x23acde],_0x20fd97),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x192174(0x1e2)]='segment:parent:update';[a29_0x192174(0x24e)]=a29_0x192174(0x291);async[a29_0x192174(0x2b6)](_0x1fbd45){const _0x573eb1=a29_0x192174,{options:_0x2f2c18,args:_0x281f06,tdx:_0x533bcf}=_0x1fbd45;console[_0x573eb1(0x2a6)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x573eb1(0x232));const _0x52812e=_0x2f2c18;if(_0x281f06[_0x573eb1(0x28c)]===0x0)return console[_0x573eb1(0x2a6)](a29_0x4cd30e['red'](_0x573eb1(0x292))),console['error'](_0x573eb1(0x254)),0x1;const _0x23bd34=_0x281f06[0x0];_0x52812e[_0x573eb1(0x2b9)]&&(console[_0x573eb1(0x2a6)](_0x573eb1(0x27b)+_0x52812e[_0x573eb1(0x28b)]),console[_0x573eb1(0x2a6)](_0x573eb1(0x29b)+_0x23bd34));const _0x4d75e8=await withSpinner(_0x573eb1(0x229)+_0x23bd34+'\x27...',()=>_0x533bcf[_0x573eb1(0x28a)][_0x573eb1(0x2bb)](_0x23bd34),{'verbose':_0x52812e[_0x573eb1(0x2b9)]}),_0x532aa3=_0x4d75e8[_0x573eb1(0x1f0)],_0x2f10e0=await loadJSONFromOptions(_0x52812e[_0x573eb1(0x219)],_0x52812e[_0x573eb1(0x268)]),_0x43c7f2=await loadJSONFromOptions(_0x52812e[_0x573eb1(0x280)],_0x52812e[_0x573eb1(0x2ba)]),_0x551a5d={'name':_0x532aa3[_0x573eb1(0x1e2)],'description':_0x52812e[_0x573eb1(0x24e)]!==undefined?_0x52812e[_0x573eb1(0x24e)]:_0x532aa3[_0x573eb1(0x24e)],'scheduleType':_0x52812e[_0x573eb1(0x202)]!==undefined?_0x52812e['scheduleType']:_0x532aa3[_0x573eb1(0x202)],'scheduleOption':_0x52812e[_0x573eb1(0x22e)]!==undefined?_0x52812e[_0x573eb1(0x22e)]:_0x532aa3[_0x573eb1(0x22e)],'timezone':_0x52812e['timezone']!==undefined?_0x52812e[_0x573eb1(0x213)]:_0x532aa3[_0x573eb1(0x213)],'master':_0x532aa3[_0x573eb1(0x246)],'attributes':_0x2f10e0?[..._0x532aa3[_0x573eb1(0x209)]||[],..._0x2f10e0]:_0x532aa3['attributes'],'behaviors':_0x43c7f2?[..._0x532aa3['behaviors']||[],..._0x43c7f2]:_0x532aa3[_0x573eb1(0x2cb)],'customerGroup':_0x532aa3[_0x573eb1(0x226)]},_0x485301=await withSpinner(_0x573eb1(0x248)+_0x23bd34+_0x573eb1(0x1f5),()=>_0x533bcf[_0x573eb1(0x28a)][_0x573eb1(0x2be)](_0x23bd34,_0x551a5d),{'verbose':_0x52812e[_0x573eb1(0x2b9)]}),_0x5e23e5=_0x485301[_0x573eb1(0x1f0)];return console[_0x573eb1(0x2a6)](_0x573eb1(0x211)+_0x5e23e5[_0x573eb1(0x1e2)]+'\x27'),await handleSDKOutput([_0x5e23e5],_0x52812e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x238);[a29_0x192174(0x24e)]=a29_0x192174(0x1cd);async[a29_0x192174(0x2b6)](_0x5b62b3){const _0x471990=a29_0x192174,{options:_0x24881b,args:_0x972473,tdx:_0x51f1cd}=_0x5b62b3,_0x42881c=_0x24881b,_0x4e5554=_0x972473[0x0]||_0x24881b[_0x471990(0x25b)];if(!_0x4e5554)return showParentSegmentNotSetError(_0x471990(0x1cb)+_0x471990(0x2a2)),0x1;if(_0x42881c['use']&&_0x42881c['output'])return console['error'](a29_0x4cd30e[_0x471990(0x1ea)](_0x471990(0x2d4))),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x201)](_0x471990(0x1ca))),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x201)](_0x471990(0x221)+PARENT_SEGMENT_DIR+_0x471990(0x1ec))),console['error'](a29_0x4cd30e[_0x471990(0x288)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x154816=_0x42881c[_0x471990(0x1f3)]||a29_0x46e08e[_0x471990(0x22f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4e5554)+_0x471990(0x1e5));_0x42881c[_0x471990(0x2b9)]&&(console['error'](_0x471990(0x27b)+_0x42881c[_0x471990(0x28b)]),console[_0x471990(0x2a6)]('Parent\x20segment:\x20'+_0x4e5554),console[_0x471990(0x2a6)](_0x471990(0x21c)+_0x154816));const _0x207896=await withSpinner(_0x471990(0x1bf)+_0x4e5554+_0x471990(0x1f5),()=>_0x51f1cd[_0x471990(0x28a)][_0x471990(0x2a7)](_0x4e5554),{'verbose':_0x42881c[_0x471990(0x2b9)]}),_0x2d289b=_0x207896['data'];if(existsSync(_0x154816)){const _0x46dd99=readFileSync(_0x154816,_0x471990(0x256)),_0xa13606=generateDiff(_0x46dd99,_0x2d289b);if(!hasChanges(_0xa13606))console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x239)]('✔')+'\x20No\x20changes\x20-\x20'+a29_0x4cd30e[_0x471990(0x288)](_0x154816)+'\x20is\x20already\x20up\x20to\x20date');else{console['error'](_0x471990(0x1ee)+_0x154816+'\x27:'),console[_0x471990(0x2a6)]('─'[_0x471990(0x2c5)](0x3c)),console[_0x471990(0x2a6)](formatDiffWithColors(_0xa13606)),console[_0x471990(0x2a6)]('─'[_0x471990(0x2c5)](0x3c));if(!_0x42881c['yes']){const _0x3b42e4=await confirmKey('Overwrite\x20\x27'+_0x154816+'\x27?');if(!_0x3b42e4)return console[_0x471990(0x2a6)]('Aborted.'),0x1;}writeFileSync(_0x154816,_0x2d289b,_0x471990(0x256)),console[_0x471990(0x2a6)](a29_0x4cd30e['green']('✔')+_0x471990(0x26e)+a29_0x4cd30e[_0x471990(0x288)](_0x154816));}}else{const _0x1f90fb=a29_0x46e08e['dirname'](_0x154816);!existsSync(_0x1f90fb)&&mkdirSync(_0x1f90fb,{'recursive':!![]}),writeFileSync(_0x154816,_0x2d289b,_0x471990(0x256)),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x239)]('✔')+_0x471990(0x26e)+a29_0x4cd30e[_0x471990(0x288)](_0x154816));}return saveSessionContext({'parent_segment':_0x4e5554},_0x42881c[_0x471990(0x260)]),console[_0x471990(0x2a6)](a29_0x4cd30e[_0x471990(0x239)]('✔')+'\x20Context\x20set:\x20'+a29_0x4cd30e[_0x471990(0x201)](_0x471990(0x1e8))+_0x471990(0x1f1)+a29_0x4cd30e[_0x471990(0x288)](_0x4e5554)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x27f);[a29_0x192174(0x24e)]=a29_0x192174(0x1ff);async[a29_0x192174(0x2b6)](_0x5b61a7){const _0x79d5d8=a29_0x192174,{options:_0x484730,args:_0x142f21,tdx:_0x1fd95}=_0x5b61a7,_0x52282d=_0x484730,_0x258d4b=_0x142f21[0x0]||_0x484730[_0x79d5d8(0x25b)];if(!_0x258d4b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x79d5d8(0x2d5)),0x1;const _0x44782d=resolveYamlFile(_0x258d4b);if(!existsSync(_0x44782d))return showFileNotFoundError(_0x44782d,_0x258d4b),0x1;_0x52282d[_0x79d5d8(0x2b9)]&&(console[_0x79d5d8(0x2a6)](_0x79d5d8(0x27b)+_0x52282d['site']),console[_0x79d5d8(0x2a6)](_0x79d5d8(0x1e7)+_0x44782d));let _0x13887f;try{_0x13887f=readFileSync(_0x44782d,'utf-8');}catch(_0x391209){const _0x58086d=_0x391209 instanceof Error?_0x391209[_0x79d5d8(0x2b0)]:String(_0x391209);return console[_0x79d5d8(0x2a6)]('Error\x20reading\x20file:\x20'+_0x58086d),0x1;}const _0x4cf654=await withSpinner(_0x79d5d8(0x1c6),()=>_0x1fd95[_0x79d5d8(0x28a)][_0x79d5d8(0x1f7)](_0x13887f),{'verbose':_0x52282d[_0x79d5d8(0x2b9)]}),_0x9689e6=_0x4cf654[_0x79d5d8(0x1f0)],{isNew:_0x358b2c,name:_0x18d017,hasChanges:_0x4be11a,diffFormatted:_0x1f5d5b}=_0x9689e6;if(!_0x4be11a)return console['error'](_0x79d5d8(0x1ef)+_0x18d017+_0x79d5d8(0x20d)),0x0;_0x358b2c?console[_0x79d5d8(0x2a6)](_0x79d5d8(0x240)+_0x18d017+'\x27:'):console[_0x79d5d8(0x2a6)](_0x79d5d8(0x266)+_0x18d017+'\x27:');console[_0x79d5d8(0x2a6)]('─'[_0x79d5d8(0x2c5)](0x3c)),console[_0x79d5d8(0x2a6)](_0x1f5d5b),console[_0x79d5d8(0x2a6)]('─'['repeat'](0x3c));const _0x3f797a=_0x358b2c?_0x79d5d8(0x2ce)+_0x18d017+'\x27?':_0x79d5d8(0x283)+_0x18d017+'\x27?';if(!_0x52282d[_0x79d5d8(0x1d3)]){const _0x3b185f=await confirmKey(_0x3f797a);if(!_0x3b185f)return console[_0x79d5d8(0x2a6)](_0x79d5d8(0x1e4)),0x1;}const _0x42bafd=_0x358b2c?_0x79d5d8(0x20f):_0x79d5d8(0x2d0),_0x58c31c=await withSpinner(_0x42bafd+_0x79d5d8(0x1cf)+_0x18d017+_0x79d5d8(0x1f5),()=>_0x9689e6[_0x79d5d8(0x241)](),{'verbose':_0x52282d[_0x79d5d8(0x2b9)]}),_0x36f2f1=_0x58c31c[_0x79d5d8(0x1f0)],_0x474117=getConsoleNextUrl(_0x52282d['site'],'/app/dw/parentSegments/'+_0x36f2f1['id']),_0x1b8e78=_0x358b2c?_0x79d5d8(0x1d2):'Updated';return console[_0x79d5d8(0x2a6)]('✔\x20'+_0x1b8e78+_0x79d5d8(0x1cf)+_0x36f2f1[_0x79d5d8(0x1e2)]+'\x27'),console[_0x79d5d8(0x2a6)]('\x20\x20'+_0x474117),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x1de);[a29_0x192174(0x24e)]=a29_0x192174(0x25d);async[a29_0x192174(0x2b6)](_0x39df52){const _0x50adf2=a29_0x192174,{options:_0x316094,args:_0x27222a,tdx:_0x5025ee}=_0x39df52,_0x4107fe=_0x316094,_0xb240b0=_0x27222a[0x0]||_0x316094[_0x50adf2(0x25b)];if(!_0xb240b0)return showParentSegmentNotSetError(_0x50adf2(0x2c2)+_0x50adf2(0x282)+_0x50adf2(0x24c)+_0x50adf2(0x2d3)+_0x50adf2(0x1fe)+_0x50adf2(0x1e1)),0x1;const _0x5428ae=resolveYamlFile(_0xb240b0);if(!existsSync(_0x5428ae))return showFileNotFoundError(_0x5428ae,_0xb240b0),0x1;_0x4107fe[_0x50adf2(0x2b9)]&&(console[_0x50adf2(0x2a6)](_0x50adf2(0x27b)+_0x4107fe[_0x50adf2(0x28b)]),console[_0x50adf2(0x2a6)]('YAML\x20file:\x20'+_0x5428ae));let _0x18ebac;try{_0x18ebac=readFileSync(_0x5428ae,_0x50adf2(0x256));}catch(_0x314c7f){const _0x3e198a=_0x314c7f instanceof Error?_0x314c7f['message']:String(_0x314c7f);return console[_0x50adf2(0x2a6)](_0x50adf2(0x28f)+_0x3e198a),0x1;}const _0x2ce437=createCommandSpinner(a29_0x4cd30e[_0x50adf2(0x201)](_0x50adf2(0x26f)),{'verbose':_0x4107fe[_0x50adf2(0x2b9)]});_0x2ce437[_0x50adf2(0x1ed)]();const _0x288c50={'onProgress':_0xfb62d8=>{const _0xedb851=_0x50adf2;_0x2ce437[_0xedb851(0x295)]=formatProgressMessage(_0xfb62d8);}};if(_0x4107fe[_0x50adf2(0x246)])_0x288c50[_0x50adf2(0x246)]=!![];if(_0x4107fe[_0x50adf2(0x29d)])_0x288c50[_0x50adf2(0x29d)]=!![];_0x4107fe[_0x50adf2(0x2b1)]&&(_0x288c50['attribute']=_0x4107fe['attribute']);_0x4107fe[_0x50adf2(0x1e6)]&&(_0x288c50['behavior']=_0x4107fe[_0x50adf2(0x1e6)]);if(_0x4107fe[_0x50adf2(0x25a)])_0x288c50[_0x50adf2(0x25a)]=_0x4107fe[_0x50adf2(0x25a)];let _0x123e62;try{_0x123e62=await _0x5025ee[_0x50adf2(0x28a)]['validateParentYaml'](_0x18ebac,_0x288c50),_0x2ce437[_0x50adf2(0x2a9)]();}catch(_0x47aee7){_0x2ce437[_0x50adf2(0x2a9)]();throw _0x47aee7;}const _0x92fdec=_0x4107fe[_0x50adf2(0x25a)]||'-1d';return this['displayValidateResults'](_0x123e62,_0x288c50,_0x5428ae,_0x92fdec),_0x123e62['allValid']?0x0:0x1;}[a29_0x192174(0x21b)](_0x4a10eb,_0x11dcca,_0x3e58b2,_0x2e32ec){const _0x423d9e=a29_0x192174;console['error']('\x0a'+a29_0x4cd30e[_0x423d9e(0x20c)](_0x423d9e(0x2c7))+'\x20'+_0x4a10eb[_0x423d9e(0x1e2)]),console[_0x423d9e(0x2a6)]('═'[_0x423d9e(0x2c5)](0x3c)),this[_0x423d9e(0x222)](_0x4a10eb);if(typeof _0x11dcca[_0x423d9e(0x2b1)]==='string'){this['displayAttributesStats'](_0x4a10eb),this[_0x423d9e(0x243)](_0x4a10eb),this[_0x423d9e(0x204)](_0x3e58b2,_0x2e32ec,_0x423d9e(0x2b1),_0x11dcca[_0x423d9e(0x2b1)]);return;}if(_0x11dcca[_0x423d9e(0x2b1)]===!![]){this[_0x423d9e(0x235)](_0x4a10eb),this[_0x423d9e(0x243)](_0x4a10eb),this[_0x423d9e(0x204)](_0x3e58b2,_0x2e32ec,_0x423d9e(0x209));return;}if(typeof _0x11dcca['behavior']===_0x423d9e(0x23c)){this[_0x423d9e(0x212)](_0x4a10eb,_0x2e32ec),this[_0x423d9e(0x243)](_0x4a10eb),this[_0x423d9e(0x204)](_0x3e58b2,_0x2e32ec,_0x423d9e(0x1e6),_0x11dcca[_0x423d9e(0x1e6)]);return;}if(_0x11dcca[_0x423d9e(0x1e6)]===!![]){this[_0x423d9e(0x212)](_0x4a10eb,_0x2e32ec),this[_0x423d9e(0x243)](_0x4a10eb),this['displayPreviewHints'](_0x3e58b2,_0x2e32ec,_0x423d9e(0x2cb));return;}this[_0x423d9e(0x235)](_0x4a10eb),this[_0x423d9e(0x212)](_0x4a10eb,_0x2e32ec),this[_0x423d9e(0x243)](_0x4a10eb),this['displayPreviewHints'](_0x3e58b2,_0x2e32ec,_0x423d9e(0x2d7));}[a29_0x192174(0x204)](_0x2e9287,_0x33e220,_0xe43cdb,_0x296cd2){const _0x44f6a8=a29_0x192174;console[_0x44f6a8(0x2a6)]('\x0a'+a29_0x4cd30e[_0x44f6a8(0x201)](_0x44f6a8(0x224)));const _0x501a75=_0x33e220!=='-1d'?_0x44f6a8(0x206)+_0x33e220:'';if(_0xe43cdb===_0x44f6a8(0x2b1)&&_0x296cd2)console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x44f6a8(0x201)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2e9287+_0x44f6a8(0x1d0)+_0x296cd2+'\x22'+_0x501a75));else{if(_0xe43cdb==='behavior'&&_0x296cd2)console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e['dim'](_0x44f6a8(0x1c9)+_0x2e9287+_0x44f6a8(0x1ba)+_0x296cd2+'\x22'+_0x501a75));else(_0xe43cdb===_0x44f6a8(0x209)||_0xe43cdb===_0x44f6a8(0x2d7))&&console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x44f6a8(0x201)](_0x44f6a8(0x1c9)+_0x2e9287+_0x44f6a8(0x20e)+_0x501a75));}(_0xe43cdb===_0x44f6a8(0x2cb)||_0xe43cdb===_0x44f6a8(0x2d7))&&console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e['dim'](_0x44f6a8(0x1c9)+_0x2e9287+_0x44f6a8(0x1f4)+_0x501a75)),_0xe43cdb===_0x44f6a8(0x2d7)&&console[_0x44f6a8(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x44f6a8(0x201)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2e9287+_0x44f6a8(0x1e9)+_0x501a75));}[a29_0x192174(0x222)](_0x56f01e){const _0x18cc72=a29_0x192174,{master:_0x449c63}=_0x56f01e,_0x27fa28=_0x449c63[_0x18cc72(0x1b7)]?a29_0x4cd30e[_0x18cc72(0x239)]('✔'):a29_0x4cd30e[_0x18cc72(0x1ea)]('✘');console[_0x18cc72(0x2a6)]('\x0a'+a29_0x4cd30e['dim'](_0x18cc72(0x1c7))),console['error'](_0x27fa28+'\x20'+a29_0x4cd30e[_0x18cc72(0x20c)](_0x449c63[_0x18cc72(0x1c1)]+'.'+_0x449c63['table'])),_0x449c63[_0x18cc72(0x1b7)]?_0x449c63[_0x18cc72(0x2ad)]!==undefined&&console[_0x18cc72(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x18cc72(0x201)](_0x18cc72(0x1db))+'\x20'+a29_0x4cd30e[_0x18cc72(0x288)](formatRows(_0x449c63['rowCount']))):console[_0x18cc72(0x2a6)]('\x20\x20'+a29_0x4cd30e['red'](_0x18cc72(0x21a))+'\x20'+_0x449c63['schemaError']);}[a29_0x192174(0x235)](_0x249ca8){const _0x1dad13=a29_0x192174;if(_0x249ca8[_0x1dad13(0x209)][_0x1dad13(0x28c)]===0x0)return;console['error']('\x0a'+a29_0x4cd30e[_0x1dad13(0x201)]('Attributes'));for(const _0x97efc0 of _0x249ca8[_0x1dad13(0x209)]){const _0x17867b=_0x97efc0[_0x1dad13(0x1b7)]?a29_0x4cd30e[_0x1dad13(0x239)]('✔'):a29_0x4cd30e['red']('✘');let _0x3328dd='';if(_0x97efc0[_0x1dad13(0x1b7)]&&_0x97efc0[_0x1dad13(0x2b3)]!==undefined&&_0x97efc0[_0x1dad13(0x244)]!==undefined){const _0x5f41c4=_0x97efc0[_0x1dad13(0x244)]['toFixed'](0x1),_0xc9d6f=_0x97efc0[_0x1dad13(0x244)]>=0x50?a29_0x4cd30e[_0x1dad13(0x239)]:_0x97efc0['coveragePercent']>=0x32?a29_0x4cd30e[_0x1dad13(0x20a)]:a29_0x4cd30e[_0x1dad13(0x1ea)];_0x3328dd='\x20'+a29_0x4cd30e[_0x1dad13(0x201)](_0x1dad13(0x2a8))+'\x20'+_0xc9d6f(_0x5f41c4+'%')+'\x20('+formatRows(_0x97efc0[_0x1dad13(0x2b3)])+_0x1dad13(0x2aa);}console[_0x1dad13(0x2a6)](_0x17867b+'\x20'+a29_0x4cd30e[_0x1dad13(0x20c)](_0x97efc0[_0x1dad13(0x1e2)])+_0x3328dd),console['error']('\x20\x20'+a29_0x4cd30e['dim']('Source:')+'\x20'+a29_0x4cd30e[_0x1dad13(0x20c)](_0x97efc0[_0x1dad13(0x1c1)]+'.'+_0x97efc0[_0x1dad13(0x1fa)]));const _0x187480=_0x97efc0[_0x1dad13(0x1df)]===_0x97efc0['foreignKey']?a29_0x4cd30e['dim'](_0x1dad13(0x298))+'\x20'+_0x97efc0[_0x1dad13(0x1df)]:a29_0x4cd30e[_0x1dad13(0x201)]('Join:')+'\x20'+_0x97efc0['joinKey']+_0x1dad13(0x1f1)+_0x97efc0[_0x1dad13(0x203)];console['error']('\x20\x20'+_0x187480),console[_0x1dad13(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x1dad13(0x201)](_0x1dad13(0x20b))),this[_0x1dad13(0x2d6)](_0x97efc0['columns']),!_0x97efc0[_0x1dad13(0x1b7)]&&console[_0x1dad13(0x2a6)]('\x20\x20'+a29_0x4cd30e['red'](_0x1dad13(0x21a))+'\x20'+_0x97efc0['schemaError']);}}[a29_0x192174(0x212)](_0x196f15,_0x26a7b0){const _0x5c3dc6=a29_0x192174;if(_0x196f15[_0x5c3dc6(0x2cb)][_0x5c3dc6(0x28c)]===0x0)return;console[_0x5c3dc6(0x2a6)]('\x0a'+a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x253))+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)]('('+_0x26a7b0+')'));for(const _0x2af336 of _0x196f15[_0x5c3dc6(0x2cb)]){const _0xc334ef=_0x2af336[_0x5c3dc6(0x1b7)]?a29_0x4cd30e[_0x5c3dc6(0x239)]('✔'):a29_0x4cd30e['red']('✘');let _0x3eb9cc='';if(_0x2af336[_0x5c3dc6(0x1b7)]&&_0x2af336['customersWithEvents']!==undefined&&_0x2af336[_0x5c3dc6(0x22d)]!==undefined){const _0x3222c2=_0x2af336['customerPercent']?.[_0x5c3dc6(0x294)](0x1)||'?',_0x5acfce=(_0x2af336[_0x5c3dc6(0x1bc)]??0x0)>=0x32?a29_0x4cd30e['green']:(_0x2af336[_0x5c3dc6(0x1bc)]??0x0)>=0x14?a29_0x4cd30e[_0x5c3dc6(0x20a)]:a29_0x4cd30e['red'];_0x3eb9cc='\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x2b2))+'\x20'+_0x5acfce(formatRows(_0x2af336[_0x5c3dc6(0x1d8)]))+'\x20('+_0x3222c2+'%)\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)]('Events:')+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x288)](formatRows(_0x2af336[_0x5c3dc6(0x22d)]));}console['error'](_0xc334ef+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x20c)](_0x2af336['name'])+_0x3eb9cc),console[_0x5c3dc6(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x1fb))+'\x20'+a29_0x4cd30e[_0x5c3dc6(0x20c)](_0x2af336[_0x5c3dc6(0x1c1)]+'.'+_0x2af336[_0x5c3dc6(0x1fa)]));const _0x4c2015=_0x2af336[_0x5c3dc6(0x1df)]===_0x2af336[_0x5c3dc6(0x203)]?a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x298))+'\x20'+_0x2af336[_0x5c3dc6(0x1df)]:a29_0x4cd30e[_0x5c3dc6(0x201)](_0x5c3dc6(0x2bf))+'\x20'+_0x2af336[_0x5c3dc6(0x1df)]+_0x5c3dc6(0x1f1)+_0x2af336[_0x5c3dc6(0x203)];console['error']('\x20\x20'+_0x4c2015),console[_0x5c3dc6(0x2a6)]('\x20\x20'+a29_0x4cd30e['dim'](_0x5c3dc6(0x20b))),this[_0x5c3dc6(0x2d6)](_0x2af336[_0x5c3dc6(0x297)]),!_0x2af336['schemaValid']&&console[_0x5c3dc6(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x5c3dc6(0x1ea)](_0x5c3dc6(0x21a))+'\x20'+_0x2af336[_0x5c3dc6(0x251)]);}}[a29_0x192174(0x2d6)](_0x4c00a3){const _0x3c0cf3=a29_0x192174;for(const _0x163add of _0x4c00a3){_0x163add[_0x3c0cf3(0x2ca)]===_0x163add[_0x3c0cf3(0x269)]||_0x163add[_0x3c0cf3(0x269)]==='*'?console['error'](_0x3c0cf3(0x276)+_0x163add[_0x3c0cf3(0x2ca)]):console[_0x3c0cf3(0x2a6)](_0x3c0cf3(0x276)+_0x163add[_0x3c0cf3(0x2ca)]+'\x20'+a29_0x4cd30e[_0x3c0cf3(0x201)]('('+_0x163add[_0x3c0cf3(0x269)]+')'));}}[a29_0x192174(0x243)](_0x3f8732){const _0x95da38=a29_0x192174;console[_0x95da38(0x2a6)]('─'[_0x95da38(0x2c5)](0x3c));if(_0x3f8732[_0x95da38(0x2c3)][_0x95da38(0x28c)]>0x0){console[_0x95da38(0x2a6)]('\x0a'+a29_0x4cd30e[_0x95da38(0x1ea)]('Errors:'));for(const _0x193845 of _0x3f8732[_0x95da38(0x2c3)]){console[_0x95da38(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x95da38(0x1ea)]('•')+'\x20'+_0x193845);}}_0x3f8732[_0x95da38(0x1b8)]&&console[_0x95da38(0x2a6)]('\x0a'+a29_0x4cd30e[_0x95da38(0x239)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]='segment:parent:preview';['description']=a29_0x192174(0x227);async['execute'](_0x4e19af){const _0x2709dc=a29_0x192174,{options:_0x4c33d3,args:_0x3d688e,tdx:_0x30f06e}=_0x4e19af,_0x550a40=_0x4c33d3,_0x266893=_0x3d688e[0x0]||_0x4c33d3[_0x2709dc(0x25b)];if(!_0x266893)return showParentSegmentNotSetError(_0x2709dc(0x214)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x2709dc(0x231)+_0x2709dc(0x1bd)+_0x2709dc(0x223)+'\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'+_0x2709dc(0x1e1)),0x1;if(!_0x550a40[_0x2709dc(0x246)]&&!_0x550a40[_0x2709dc(0x2b1)]&&!_0x550a40[_0x2709dc(0x1e6)]&&!_0x550a40[_0x2709dc(0x29d)])return console['error'](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x23a))),console[_0x2709dc(0x2a6)](_0x2709dc(0x1b5)),console[_0x2709dc(0x2a6)]('Options:'),console[_0x2709dc(0x2a6)](_0x2709dc(0x2d8)),console[_0x2709dc(0x2a6)](_0x2709dc(0x299)),console[_0x2709dc(0x2a6)](_0x2709dc(0x28d)),console['error'](_0x2709dc(0x1b9)),0x1;const _0x2b1167=resolveYamlFile(_0x266893);if(!existsSync(_0x2b1167))return showFileNotFoundError(_0x2b1167,_0x266893),0x1;_0x550a40['verbose']&&(console['error'](_0x2709dc(0x27b)+_0x550a40[_0x2709dc(0x28b)]),console[_0x2709dc(0x2a6)]('YAML\x20file:\x20'+_0x2b1167));let _0x3c9d0d;try{_0x3c9d0d=readFileSync(_0x2b1167,_0x2709dc(0x256));}catch(_0x5905ea){const _0x4b8fe6=_0x5905ea instanceof Error?_0x5905ea[_0x2709dc(0x2b0)]:String(_0x5905ea);return console[_0x2709dc(0x2a6)](_0x2709dc(0x28f)+_0x4b8fe6),0x1;}let _0x533c13;try{_0x533c13=parseYamlString(_0x3c9d0d);}catch(_0x15e719){const _0x2ae555=_0x15e719 instanceof Error?_0x15e719['message']:String(_0x15e719);return console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x2b4)+_0x2ae555)),0x1;}if(_0x550a40[_0x2709dc(0x2b1)]===!![]||_0x550a40['attribute']===''){const _0x392e6c=_0x533c13[_0x2709dc(0x209)]?.[_0x2709dc(0x1d9)](_0x55bd3d=>_0x55bd3d[_0x2709dc(0x1e2)])||[];if(_0x392e6c['length']===0x0)console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x1bb)));else{console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)](_0x2709dc(0x2c0))),console[_0x2709dc(0x2a6)]('Available\x20attributes:');for(const _0x22c28e of _0x392e6c){console[_0x2709dc(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x2709dc(0x288)](_0x22c28e));}console[_0x2709dc(0x2a6)](_0x2709dc(0x1c2)+_0x266893+_0x2709dc(0x1d0)+_0x392e6c[0x0]+'\x22');}return 0x1;}if(_0x550a40[_0x2709dc(0x1e6)]===!![]||_0x550a40['behavior']===''){const _0x646e0b=_0x533c13[_0x2709dc(0x2cb)]?.[_0x2709dc(0x1d9)](_0x406255=>_0x406255[_0x2709dc(0x1e2)])||[];if(_0x646e0b[_0x2709dc(0x28c)]===0x0)console[_0x2709dc(0x2a6)](a29_0x4cd30e[_0x2709dc(0x1ea)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console['error'](a29_0x4cd30e['red'](_0x2709dc(0x2c9))),console[_0x2709dc(0x2a6)](_0x2709dc(0x26b));for(const _0x2620c3 of _0x646e0b){console[_0x2709dc(0x2a6)]('\x20\x20'+a29_0x4cd30e['cyan'](_0x2620c3));}console[_0x2709dc(0x2a6)](_0x2709dc(0x1c2)+_0x266893+_0x2709dc(0x1ba)+_0x646e0b[0x0]+'\x22');}return 0x1;}const _0x27ee08=createCommandSpinner(a29_0x4cd30e['dim']('Fetching\x20sample\x20data...'),{'verbose':_0x550a40['verbose']});_0x27ee08[_0x2709dc(0x1ed)]();const _0x2c2318={'onProgress':_0x1aeee5=>{_0x27ee08['text']=formatProgressMessage(_0x1aeee5);}};if(_0x550a40[_0x2709dc(0x246)])_0x2c2318['master']=!![];if(_0x550a40['attribute']&&typeof _0x550a40[_0x2709dc(0x2b1)]===_0x2709dc(0x23c))_0x2c2318[_0x2709dc(0x2b1)]=_0x550a40[_0x2709dc(0x2b1)];if(_0x550a40['behavior']&&typeof _0x550a40[_0x2709dc(0x1e6)]===_0x2709dc(0x23c))_0x2c2318['behavior']=_0x550a40['behavior'];if(_0x550a40[_0x2709dc(0x29d)])_0x2c2318[_0x2709dc(0x29d)]=!![];if(_0x550a40['interval'])_0x2c2318[_0x2709dc(0x25a)]=_0x550a40['interval'];let _0x400a24;try{_0x400a24=await _0x30f06e[_0x2709dc(0x28a)][_0x2709dc(0x277)](_0x3c9d0d,_0x2c2318),_0x27ee08[_0x2709dc(0x2a9)]();}catch(_0x288e58){_0x27ee08['stop']();throw _0x288e58;}return await this['displayPreviewResults'](_0x400a24,{'master':_0x550a40[_0x2709dc(0x246)],'attribute':typeof _0x550a40[_0x2709dc(0x2b1)]===_0x2709dc(0x23c)?_0x550a40[_0x2709dc(0x2b1)]:undefined,'behavior':typeof _0x550a40[_0x2709dc(0x1e6)]===_0x2709dc(0x23c)?_0x550a40[_0x2709dc(0x1e6)]:undefined,'enriched':_0x550a40[_0x2709dc(0x29d)]}),_0x400a24['allValid']?0x0:0x1;}async[a29_0x192174(0x2af)](_0x17b0da,_0xbfc97b){const _0x4c9ca6=a29_0x192174;console['error']('\x0a'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0x4c9ca6(0x252))+'\x20'+_0x17b0da[_0x4c9ca6(0x1e2)]),console[_0x4c9ca6(0x2a6)]('═'['repeat'](0x3c));if(_0xbfc97b['master']&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0x43ed2f=a29_0x4cd30e[_0x4c9ca6(0x201)](_0x4c9ca6(0x24b))+'\x20'+a29_0x4cd30e['bold'](_0x17b0da['master'][_0x4c9ca6(0x1c1)]+'.'+_0x17b0da[_0x4c9ca6(0x246)][_0x4c9ca6(0x1fa)]);await this[_0x4c9ca6(0x2d1)](_0x43ed2f,_0x17b0da['sampleData']);}else{if(_0xbfc97b[_0x4c9ca6(0x2b1)]&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0xd660a1=a29_0x4cd30e[_0x4c9ca6(0x201)](_0x4c9ca6(0x1f2))+'\x20'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0xbfc97b['attribute']);await this['displaySampleData'](_0xd660a1,_0x17b0da[_0x4c9ca6(0x1d6)]);}else{if(_0xbfc97b[_0x4c9ca6(0x1e6)]&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0x13b003=a29_0x4cd30e[_0x4c9ca6(0x201)](_0x4c9ca6(0x255))+'\x20'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0xbfc97b[_0x4c9ca6(0x1e6)]);await this[_0x4c9ca6(0x2d1)](_0x13b003,_0x17b0da[_0x4c9ca6(0x1d6)]);}else{if(_0xbfc97b['enriched']&&_0x17b0da[_0x4c9ca6(0x1d6)]){const _0x1aa849=a29_0x4cd30e['dim']('Enriched:')+'\x20'+a29_0x4cd30e[_0x4c9ca6(0x20c)](_0x4c9ca6(0x249));await this['displaySampleData'](_0x1aa849,_0x17b0da[_0x4c9ca6(0x1d6)]);}else!_0x17b0da['sampleData']&&console[_0x4c9ca6(0x2a6)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x17b0da[_0x4c9ca6(0x2c3)][_0x4c9ca6(0x28c)]>0x0){console[_0x4c9ca6(0x2a6)]('─'['repeat'](0x3c)),console[_0x4c9ca6(0x2a6)]('\x0a'+a29_0x4cd30e[_0x4c9ca6(0x1ea)](_0x4c9ca6(0x287)));for(const _0x30f4ba of _0x17b0da[_0x4c9ca6(0x2c3)]){console[_0x4c9ca6(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x4c9ca6(0x1ea)]('•')+'\x20'+_0x30f4ba);}}}async[a29_0x192174(0x2d1)](_0x307152,_0x5f23e1){const _0x329fea=a29_0x192174;if(_0x5f23e1[_0x329fea(0x28c)]===0x0){console[_0x329fea(0x2a6)]('\x0a'+_0x307152),console[_0x329fea(0x2a6)](_0x329fea(0x2c1));return;}console['error']('\x0a'+_0x307152);const _0x2c80fb=Object[_0x329fea(0x2b5)](_0x5f23e1[0x0])['map'](_0x56c67c=>({'name':_0x56c67c,'type':typeof _0x5f23e1[0x0][_0x56c67c]===_0x329fea(0x1c3)?_0x329fea(0x2ab):_0x329fea(0x2a1)})),_0x1bf3a7={'queryId':_0x329fea(0x2cc),'columns':_0x2c80fb,'data':_0x5f23e1,'stats':{'state':_0x329fea(0x23d),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5f23e1[_0x329fea(0x28c)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x58d84a=formatAsTable(_0x1bf3a7,_0x5f23e1[_0x329fea(0x28c)],!![]);await writeOutput(_0x58d84a,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x2cf);[a29_0x192174(0x24e)]=a29_0x192174(0x29f);async['execute'](_0x2ab6fb){const _0x3cd705=a29_0x192174,{options:_0x36df98,args:_0x1fde6e,tdx:_0x1d4a41}=_0x2ab6fb,_0x1c58a5=_0x36df98,_0xaf3cc=_0x1fde6e[0x0]||_0x36df98[_0x3cd705(0x25b)];if(!_0xaf3cc)return showParentSegmentNotSetError(_0x3cd705(0x27d)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x2f8c7b=resolveYamlFile(_0xaf3cc);if(existsSync(_0x2f8c7b)){_0x1c58a5[_0x3cd705(0x2b9)]&&console[_0x3cd705(0x2a6)](_0x3cd705(0x278)+_0x2f8c7b);let _0x3b6644;try{_0x3b6644=readFileSync(_0x2f8c7b,_0x3cd705(0x256));}catch(_0x596ef8){const _0x5347f6=_0x596ef8 instanceof Error?_0x596ef8[_0x3cd705(0x2b0)]:String(_0x596ef8);return console[_0x3cd705(0x2a6)](_0x3cd705(0x28f)+_0x5347f6),0x1;}const _0x2ce902=await withSpinner(_0x3cd705(0x1c6),()=>_0x1d4a41['segment']['pushParentYaml'](_0x3b6644),{'verbose':_0x1c58a5[_0x3cd705(0x2b9)]}),_0x34247d=_0x2ce902[_0x3cd705(0x1f0)],{isNew:_0x3c3035,name:_0x29207b,hasChanges:_0x47534d,diffFormatted:_0x152cd9}=_0x34247d;if(_0x47534d){_0x3c3035?console['error'](_0x3cd705(0x240)+_0x29207b+'\x27:'):console[_0x3cd705(0x2a6)](_0x3cd705(0x266)+_0x29207b+'\x27:');console[_0x3cd705(0x2a6)]('─'[_0x3cd705(0x2c5)](0x3c)),console[_0x3cd705(0x2a6)](_0x152cd9),console[_0x3cd705(0x2a6)]('─'['repeat'](0x3c));const _0x27568d=_0x3c3035?_0x3cd705(0x2ce)+_0x29207b+_0x3cd705(0x250):_0x3cd705(0x283)+_0x29207b+'\x27\x20and\x20run\x20workflow?';if(!_0x1c58a5[_0x3cd705(0x1d3)]){const _0x2c743=await confirmKey(_0x27568d);if(!_0x2c743)return console[_0x3cd705(0x2a6)](_0x3cd705(0x1e4)),0x1;}const _0x4fdd32=_0x3c3035?_0x3cd705(0x20f):_0x3cd705(0x2d0);await withSpinner(_0x4fdd32+_0x3cd705(0x1cf)+_0x29207b+_0x3cd705(0x1f5),()=>_0x34247d[_0x3cd705(0x241)](),{'verbose':_0x1c58a5[_0x3cd705(0x2b9)]});const _0x4f9356=_0x3c3035?'Created':'Updated';console[_0x3cd705(0x2a6)]('✔\x20'+_0x4f9356+_0x3cd705(0x1cf)+_0x29207b+'\x27');}else console[_0x3cd705(0x2a6)](_0x3cd705(0x1ef)+_0x29207b+_0x3cd705(0x1da));}const _0x482e71=await withSpinner(_0x3cd705(0x1c0)+_0xaf3cc+_0x3cd705(0x1f5),()=>_0x1d4a41[_0x3cd705(0x28a)][_0x3cd705(0x24f)](_0xaf3cc),{'verbose':_0x1c58a5[_0x3cd705(0x2b9)]}),_0x2c8065=_0x482e71['data'],_0x3d9e2d=getConsoleUrl(_0x1c58a5[_0x3cd705(0x28b)],_0x3cd705(0x27a)+_0x2c8065[_0x3cd705(0x26d)]+_0x3cd705(0x271)+_0x2c8065[_0x3cd705(0x273)]+_0x3cd705(0x27e)+_0x2c8065['workflowAttemptId']);return console[_0x3cd705(0x2a6)](_0x3cd705(0x27c)),console['error']('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)]('Audience\x20ID:')+'\x20'+_0x2c8065['audienceId']),console[_0x3cd705(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)](_0x3cd705(0x1f8))+'\x20'+_0x2c8065['status']),console[_0x3cd705(0x2a6)]('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)](_0x3cd705(0x1c5))+'\x20'+_0x2c8065[_0x3cd705(0x273)]),console['error']('\x20\x20'+a29_0x4cd30e[_0x3cd705(0x201)]('Attempt:')+'\x20'+_0x2c8065['workflowAttemptId']),console['error']('\x20\x20'+_0x3d9e2d),console['error']('\x0a'+a29_0x4cd30e[_0x3cd705(0x201)]('To\x20cancel:')+'\x20tdx\x20wf\x20attempt\x20'+_0x2c8065[_0x3cd705(0x228)]+_0x3cd705(0x265)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x21f);['description']=a29_0x192174(0x1d7);async[a29_0x192174(0x2b6)](_0x439040){const _0x4f8ecd=a29_0x192174,{options:_0x52da37,args:_0x44754c,tdx:_0x16f2ab}=_0x439040,_0x45f9e3=_0x44754c[0x0]||_0x52da37[_0x4f8ecd(0x25b)];if(!_0x45f9e3)return showParentSegmentNotSetError(_0x4f8ecd(0x245)+_0x4f8ecd(0x2ac)),0x1;_0x52da37[_0x4f8ecd(0x2b9)]&&(console[_0x4f8ecd(0x2a6)](_0x4f8ecd(0x27b)+_0x52da37['site']),console[_0x4f8ecd(0x2a6)](_0x4f8ecd(0x29b)+_0x45f9e3));const _0x4ecf98=await withSpinner(_0x4f8ecd(0x1e0)+_0x45f9e3+_0x4f8ecd(0x1f5),()=>_0x16f2ab[_0x4f8ecd(0x28a)][_0x4f8ecd(0x208)](_0x45f9e3),{'verbose':_0x52da37[_0x4f8ecd(0x2b9)]}),_0x2775ed=_0x4ecf98[_0x4f8ecd(0x1f0)];console['error'](_0x4f8ecd(0x230)+_0x2775ed[_0x4f8ecd(0x28c)]+_0x4f8ecd(0x1ce)+(_0x2775ed[_0x4f8ecd(0x28c)]!==0x1?'s':''));if(_0x52da37[_0x4f8ecd(0x2a0)]||_0x52da37[_0x4f8ecd(0x275)])return await handleSDKOutput(_0x2775ed,_0x52da37),0x0;return displayFieldsHumanReadable(_0x2775ed,_0x45f9e3),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x192174(0x1e2)]='segment:parent:view';['description']='Show\x20parent\x20segment\x20details';async[a29_0x192174(0x2b6)](_0x1d4f1d){const _0x36b53f=a29_0x192174,{options:_0x39068e,args:_0x57d93d,tdx:_0xaf877e}=_0x1d4f1d,_0x445a00=_0x39068e,_0x4d006d=_0x57d93d[0x0]||_0x39068e['parentSegment'];if(!_0x4d006d)return showParentSegmentNotSetError(_0x36b53f(0x1b6)+_0x36b53f(0x274)+_0x36b53f(0x24c)+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x39068e['verbose']&&(console[_0x36b53f(0x2a6)](_0x36b53f(0x27b)+_0x39068e['site']),console[_0x36b53f(0x2a6)]('Parent\x20segment:\x20'+_0x4d006d));const _0x5e87b2=await withSpinner(_0x36b53f(0x1bf)+_0x4d006d+'\x27...',()=>_0xaf877e[_0x36b53f(0x28a)][_0x36b53f(0x2bb)](_0x4d006d),{'verbose':_0x39068e[_0x36b53f(0x2b9)]}),_0xd64bc7=_0x5e87b2[_0x36b53f(0x1f0)];if(_0x445a00['web']){const _0x12f04f=getConsoleNextUrl(_0x445a00[_0x36b53f(0x28b)],_0x36b53f(0x2a5)+_0xd64bc7['id']);return console[_0x36b53f(0x2a6)](a29_0x4cd30e[_0x36b53f(0x239)]('✔')+'\x20Opening\x20'+a29_0x4cd30e[_0x36b53f(0x288)](_0x12f04f)),openBrowser(_0x12f04f),0x0;}return await handleSingleObjectOutput(_0xd64bc7,_0x39068e),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x25c);['description']='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a29_0x192174(0x2b6)](_0x5db736){const _0xefd6d=a29_0x192174,{options:_0x439712,args:_0x4175af,tdx:_0x4d884c}=_0x5db736,_0x291ea5=_0x4175af[0x0]||_0x439712[_0xefd6d(0x25b)];if(!_0x291ea5)return showParentSegmentNotSetError(_0xefd6d(0x2c8)+_0xefd6d(0x264)),0x1;_0x439712[_0xefd6d(0x2b9)]&&(console[_0xefd6d(0x2a6)](_0xefd6d(0x27b)+_0x439712[_0xefd6d(0x28b)]),console[_0xefd6d(0x2a6)]('Parent\x20segment:\x20'+_0x291ea5));const _0x1039b9=await withSpinner(_0xefd6d(0x1d4)+_0x291ea5+_0xefd6d(0x1f5),()=>_0x4d884c[_0xefd6d(0x28a)]['resolveParentId'](_0x291ea5),{'verbose':_0x439712['verbose']}),_0x4f8e0c=_0x1039b9[_0xefd6d(0x1f0)],_0x5b31a2=await withSpinner(_0xefd6d(0x272)+_0x291ea5+_0xefd6d(0x1f5),()=>_0x4d884c['segment']['getParentSQL'](_0x4f8e0c),{'verbose':_0x439712[_0xefd6d(0x2b9)]}),_0x3749ea=await executeSchemaQuery(_0x5b31a2[_0xefd6d(0x1f0)],_0x4d884c,_0x439712);return await handleQueryOutput(_0x3749ea,_0x439712),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x192174(0x1e2)]='segment:parent:sql';[a29_0x192174(0x24e)]=a29_0x192174(0x205);async[a29_0x192174(0x2b6)](_0x65818a){const _0x2f9c8b=a29_0x192174,{options:_0x33216c,args:_0x78ae3,tdx:_0x72c597}=_0x65818a,_0x2f4e0d=_0x78ae3[0x0]||_0x33216c[_0x2f9c8b(0x25b)];if(!_0x2f4e0d)return showParentSegmentNotSetError(_0x2f9c8b(0x217)+_0x2f9c8b(0x237)),0x1;_0x33216c['verbose']&&(console[_0x2f9c8b(0x2a6)]('Site:\x20'+_0x33216c[_0x2f9c8b(0x28b)]),console[_0x2f9c8b(0x2a6)]('Parent\x20segment:\x20'+_0x2f4e0d));const _0x413f34=await withSpinner(_0x2f9c8b(0x1d4)+_0x2f4e0d+_0x2f9c8b(0x1f5),()=>_0x72c597[_0x2f9c8b(0x28a)][_0x2f9c8b(0x1b4)](_0x2f4e0d),{'verbose':_0x33216c['verbose']}),_0x11dca1=_0x413f34[_0x2f9c8b(0x1f0)],_0x7c118c=await withSpinner(_0x2f9c8b(0x272)+_0x2f4e0d+_0x2f9c8b(0x1f5),()=>_0x72c597[_0x2f9c8b(0x28a)][_0x2f9c8b(0x1d1)](_0x11dca1),{'verbose':_0x33216c[_0x2f9c8b(0x2b9)]}),_0x1d49b7=_0x7c118c[_0x2f9c8b(0x1f0)];return _0x33216c[_0x2f9c8b(0x200)]===_0x2f9c8b(0x2a0)||_0x33216c[_0x2f9c8b(0x200)]===_0x2f9c8b(0x275)?await handleSDKOutput([{'sql':_0x1d49b7}],_0x33216c):console[_0x2f9c8b(0x22c)](_0x1d49b7),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x192174(0x1e2)]=a29_0x192174(0x22a);[a29_0x192174(0x24e)]=a29_0x192174(0x2cd);async['execute'](_0x373da3){const _0xea21d3=a29_0x192174,{options:_0x110ae5,args:_0x39c004,tdx:_0xf90b32}=_0x373da3,_0x2969aa=_0x39c004[0x0]||_0x110ae5['parentSegment'];if(!_0x2969aa)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0xea21d3(0x2a3)),0x1;_0x110ae5[_0xea21d3(0x2b9)]&&(console[_0xea21d3(0x2a6)](_0xea21d3(0x27b)+_0x110ae5[_0xea21d3(0x28b)]),console[_0xea21d3(0x2a6)](_0xea21d3(0x29b)+_0x2969aa));const _0x56e72c=await withSpinner(_0xea21d3(0x1d4)+_0x2969aa+_0xea21d3(0x1f5),()=>_0xf90b32[_0xea21d3(0x28a)][_0xea21d3(0x1b4)](_0x2969aa),{'verbose':_0x110ae5['verbose']}),_0x5eb46c=_0x56e72c[_0xea21d3(0x1f0)],_0x413898=await withSpinner(_0xea21d3(0x272)+_0x2969aa+_0xea21d3(0x1f5),()=>_0xf90b32['segment'][_0xea21d3(0x1d1)](_0x5eb46c),{'verbose':_0x110ae5[_0xea21d3(0x2b9)]});let _0x3fea7d=_0x413898[_0xea21d3(0x1f0)];const _0x69f07a=resolveLimit(_0x110ae5['limit'],DEFAULT_DISPLAY_LIMIT),_0x16fdfd=/\bLIMIT\s+\d+/i[_0xea21d3(0x26c)](_0x3fea7d);!_0x16fdfd&&(_0x3fea7d=_0x3fea7d[_0xea21d3(0x293)]()[_0xea21d3(0x2b8)](/;+$/,''),_0x3fea7d=_0xea21d3(0x236)+_0x3fea7d+_0xea21d3(0x24d)+_0x69f07a);_0x110ae5['verbose']&&console[_0xea21d3(0x2a6)](_0xea21d3(0x279)+_0x3fea7d);const _0x2af38b=await withQuerySpinner(_0xea21d3(0x263),async _0x3aadd4=>{const _0x56ca7e=_0xea21d3,_0x22a8c4=await _0xf90b32[_0x56ca7e(0x1c4)][_0x56ca7e(0x2b6)](_0x3fea7d,{'catalog':'td','schema':'information_schema','onJobId':_0x442c55=>{const _0x2fb30c=_0x56ca7e;_0x3aadd4[_0x2fb30c(0x285)](_0x442c55);}});return _0x22a8c4;},{'verbose':_0x110ae5['verbose']}),_0x2ca5a9=_0x2af38b['data'],_0x489c48=_0x2ca5a9[_0xea21d3(0x1fd)]?_0xea21d3(0x21e)+_0x2ca5a9['jobId']+']':'';return console['error'](_0xea21d3(0x1f6)+_0x2ca5a9['stats']['processedRows'][_0xea21d3(0x1dc)]()+'\x20rows\x20'+(_0xea21d3(0x29a)+formatElapsed(_0x2ca5a9[_0xea21d3(0x2d2)][_0xea21d3(0x1eb)])+_0x489c48)),await handleQueryOutput(_0x2ca5a9,_0x110ae5),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_0x20ebe7=a30_0x1802;(function(_0x4ce1e9,_0x4e3daf){const _0x1290a6=a30_0x1802,_0x1d489e=_0x4ce1e9();while(!![]){try{const _0x2535e9=parseInt(_0x1290a6(0x1eb))/0x1+parseInt(_0x1290a6(0x1f1))/0x2*(parseInt(_0x1290a6(0x1f8))/0x3)+parseInt(_0x1290a6(0x1f9))/0x4+parseInt(_0x1290a6(0x1f4))/0x5*(-parseInt(_0x1290a6(0x1ed))/0x6)+-parseInt(_0x1290a6(0x200))/0x7*(-parseInt(_0x1290a6(0x1f6))/0x8)+-parseInt(_0x1290a6(0x1ec))/0x9+parseInt(_0x1290a6(0x1f3))/0xa;if(_0x2535e9===_0x4e3daf)break;else _0x1d489e['push'](_0x1d489e['shift']());}catch(_0x128286){_0x1d489e['push'](_0x1d489e['shift']());}}}(a30_0x7ecb,0x74d91));import{BaseCommand}from'./command.js';function a30_0x1802(_0x5778fb,_0x381c59){_0x5778fb=_0x5778fb-0x1ea;const _0x7ecbae=a30_0x7ecb();let _0x1802d2=_0x7ecbae[_0x5778fb];return _0x1802d2;}function a30_0x7ecb(){const _0x673c95=['log','description','config','7irQBUo','length','message','546793YUrNPf','5930073pdKEYB','1278JbaqfQ','Error:\x20','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','8734MrxNrQ','name','3809880lWjVdc','20905IqqQPT','\x20\x20Global:\x20~/.config/tdx/tdx.json','580664zGjhvU','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','627xECgof','459968seGiSM','map','scope','List\x20all\x20available\x20profiles'];a30_0x7ecb=function(){return _0x673c95;};return a30_0x7ecb();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x20ebe7(0x1f2)]=a30_0x20ebe7(0x1f0);[a30_0x20ebe7(0x1fe)]=a30_0x20ebe7(0x1fc);async['execute'](_0x5d3f9c){const _0x39caa5=a30_0x20ebe7,{options:_0x2b9ce1}=_0x5d3f9c;try{const _0x5aea8b=listProfiles(),_0xa56161=getActiveProfile();if(_0x5aea8b[_0x39caa5(0x201)]===0x0)return console[_0x39caa5(0x1fd)](_0x39caa5(0x1ef)),console[_0x39caa5(0x1fd)](_0x39caa5(0x1f7)),console[_0x39caa5(0x1fd)](_0x39caa5(0x1f5)),0x0;const _0x175861=_0x5aea8b[_0x39caa5(0x1fa)](_0x321412=>{const _0x440fa8=_0x39caa5,_0x1a648f=_0x321412[_0x440fa8(0x1f2)]===_0xa56161,_0x5ee529=getProfileParams(_0x321412[_0x440fa8(0x1ff)]);return{'name':_0x321412[_0x440fa8(0x1f2)],'active':_0x1a648f,'scope':_0x321412[_0x440fa8(0x1fb)],'description':_0x321412[_0x440fa8(0x1ff)]['description']||'','params':_0x5ee529};});return await handleSDKOutput(_0x175861,_0x2b9ce1),0x0;}catch(_0x355f25){return _0x355f25 instanceof Error&&console['error'](_0x39caa5(0x1ee)+_0x355f25[_0x39caa5(0x1ea)]),0x1;}}}