@treasuredata/tdx 0.13.2 → 0.14.0

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 (143) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-command.js +1 -1
  20. package/dist/commands/job-command.js +1 -1
  21. package/dist/commands/journey-command.js +1 -1
  22. package/dist/commands/journey-validate-command.js +1 -1
  23. package/dist/commands/llm-command.js +1 -1
  24. package/dist/commands/llm-proxy.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/tables.js +1 -1
  40. package/dist/commands/use-command.js +1 -1
  41. package/dist/commands/user-command.js +1 -1
  42. package/dist/commands/workflow-command.d.ts +37 -0
  43. package/dist/commands/workflow-command.d.ts.map +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/commands/workflow-command.js.map +1 -1
  46. package/dist/core/auth.js +1 -1
  47. package/dist/core/command-output.js +1 -1
  48. package/dist/core/config.js +1 -1
  49. package/dist/core/connection-cache.js +1 -1
  50. package/dist/core/constants.js +1 -1
  51. package/dist/core/credential-cache.js +1 -1
  52. package/dist/core/global-context.js +1 -1
  53. package/dist/core/keychain.js +1 -1
  54. package/dist/core/profile.js +1 -1
  55. package/dist/core/project-config.js +1 -1
  56. package/dist/core/session.js +1 -1
  57. package/dist/core/user-cache.js +1 -1
  58. package/dist/core/version.js +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/proxy/anthropic-adapter.js +1 -1
  61. package/dist/proxy/claude-usage-tracker.js +1 -1
  62. package/dist/proxy/context-signature.js +1 -1
  63. package/dist/proxy/conversation-utils.js +1 -1
  64. package/dist/proxy/server.js +1 -1
  65. package/dist/proxy/session-cache.js +1 -1
  66. package/dist/sdk/agent/agent-config.js +1 -1
  67. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  68. package/dist/sdk/agent/agent-yaml.js +1 -1
  69. package/dist/sdk/api.js +1 -1
  70. package/dist/sdk/client/cdp-api-client.js +1 -1
  71. package/dist/sdk/client/endpoints.js +1 -1
  72. package/dist/sdk/client/engage-api-client.js +1 -1
  73. package/dist/sdk/client/http-client.js +1 -1
  74. package/dist/sdk/client/llm-api-client.js +1 -1
  75. package/dist/sdk/client/rate-limiter.js +1 -1
  76. package/dist/sdk/client/td-api-client.js +1 -1
  77. package/dist/sdk/client/trino-api-client.js +1 -1
  78. package/dist/sdk/client/workflow-client.js +1 -1
  79. package/dist/sdk/connection-validator.js +1 -1
  80. package/dist/sdk/connection.js +1 -1
  81. package/dist/sdk/engage.js +1 -1
  82. package/dist/sdk/errors.js +1 -1
  83. package/dist/sdk/index.js +1 -1
  84. package/dist/sdk/io/index.js +1 -1
  85. package/dist/sdk/io/node-filesystem.js +1 -1
  86. package/dist/sdk/job.js +1 -1
  87. package/dist/sdk/journey.js +1 -1
  88. package/dist/sdk/llm/chat-cache.js +1 -1
  89. package/dist/sdk/llm/index.js +1 -1
  90. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  91. package/dist/sdk/llm/model-aliases.js +1 -1
  92. package/dist/sdk/llm/model-factors.js +1 -1
  93. package/dist/sdk/query/index.js +1 -1
  94. package/dist/sdk/query/sql-parser.js +1 -1
  95. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  96. package/dist/sdk/segment/fields-display.js +1 -1
  97. package/dist/sdk/segment/file-discovery.js +1 -1
  98. package/dist/sdk/segment/journey-utils.js +1 -1
  99. package/dist/sdk/segment/journey-yaml.js +1 -1
  100. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  101. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  102. package/dist/sdk/segment/pull-workflow.js +1 -1
  103. package/dist/sdk/segment/push-workflow.js +1 -1
  104. package/dist/sdk/segment/resolution-context.js +1 -1
  105. package/dist/sdk/segment/segment-path-parser.js +1 -1
  106. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  107. package/dist/sdk/segment/target-resolution.js +1 -1
  108. package/dist/sdk/segment/tdx-config.js +1 -1
  109. package/dist/sdk/segment/validate-files.js +1 -1
  110. package/dist/sdk/segment/yaml-validator.js +1 -1
  111. package/dist/sdk/segment.js +1 -1
  112. package/dist/sdk/types/index.js +1 -1
  113. package/dist/sdk/types/progress.js +1 -1
  114. package/dist/sdk/user.js +1 -1
  115. package/dist/sdk/util/format-detector.js +1 -1
  116. package/dist/sdk/util/formatters.js +1 -1
  117. package/dist/sdk/util/index.js +1 -1
  118. package/dist/sdk/util/tree-formatter.js +1 -1
  119. package/dist/sdk/workflow/clone-workflow.js +1 -1
  120. package/dist/sdk/workflow/index.d.ts +1 -1
  121. package/dist/sdk/workflow/index.d.ts.map +1 -1
  122. package/dist/sdk/workflow/index.js +1 -1
  123. package/dist/sdk/workflow/index.js.map +1 -1
  124. package/dist/sdk/workflow/pull-workflow.js +1 -1
  125. package/dist/sdk/workflow/push-workflow.js +1 -1
  126. package/dist/sdk/workflow/tdx-config.js +1 -1
  127. package/dist/sdk/workflow/workflow-utils.js +1 -1
  128. package/dist/utils/async.js +1 -1
  129. package/dist/utils/colors.js +1 -1
  130. package/dist/utils/diff.js +1 -1
  131. package/dist/utils/file-permissions.js +1 -1
  132. package/dist/utils/json-loader.js +1 -1
  133. package/dist/utils/option-validation.js +1 -1
  134. package/dist/utils/port.js +1 -1
  135. package/dist/utils/process.js +1 -1
  136. package/dist/utils/prompt.js +1 -1
  137. package/dist/utils/spinner.js +1 -1
  138. package/dist/utils/sse-parser.js +1 -1
  139. package/dist/utils/string-utils.js +1 -1
  140. package/dist/utils/table-ref-parser.js +1 -1
  141. package/dist/utils/tdx-logger.js +1 -1
  142. package/dist/utils/version-check.js +1 -1
  143. package/package.json +1 -1
@@ -1 +1 @@
1
- const a21_0x36ce6e=a21_0x5277;(function(_0x3cde37,_0x1b6007){const _0x5879db=a21_0x5277,_0x4999a6=_0x3cde37();while(!![]){try{const _0x52302=-parseInt(_0x5879db(0x1c3))/0x1+-parseInt(_0x5879db(0x170))/0x2+-parseInt(_0x5879db(0x1f3))/0x3+parseInt(_0x5879db(0x16f))/0x4+parseInt(_0x5879db(0x139))/0x5+parseInt(_0x5879db(0x176))/0x6+-parseInt(_0x5879db(0x1d5))/0x7*(-parseInt(_0x5879db(0x1e4))/0x8);if(_0x52302===_0x1b6007)break;else _0x4999a6['push'](_0x4999a6['shift']());}catch(_0x45fd80){_0x4999a6['push'](_0x4999a6['shift']());}}}(a21_0x5d1e,0xb27b5));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a21_0x3731ca from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x1bbe9b from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a21_0x36ce6e(0x13f),LEGACY_PARENT_SEGMENT_DIR=a21_0x36ce6e(0x228);function openBrowser(_0x1643f3){const _0x858283=a21_0x36ce6e,_0x1b9350=process[_0x858283(0x1e2)],_0x16f56d=_0x1b9350===_0x858283(0x189)?'open':_0x1b9350===_0x858283(0x1d9)?_0x858283(0x15b):'xdg-open';spawn(_0x16f56d,[_0x1643f3],{'detached':!![],'stdio':'ignore'})[_0x858283(0x1f8)]();}function a21_0x5277(_0x4f73c2,_0x4e3c4f){_0x4f73c2=_0x4f73c2-0x112;const _0x5d1e22=a21_0x5d1e();let _0x5277f3=_0x5d1e22[_0x4f73c2];return _0x5277f3;}function migrateLegacyDirectory(){const _0x1e8a6b=a21_0x36ce6e;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x2ca3d6=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x2ca3d6[_0x1e8a6b(0x158)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1e8a6b(0x21f)](a21_0x1bbe9b['yellow'](_0x1e8a6b(0x1a3)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+'/\x20directories\x20exist.')),console[_0x1e8a6b(0x21f)](a21_0x1bbe9b['dim']('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x1e8a6b(0x21f)](a21_0x1bbe9b[_0x1e8a6b(0x1d4)](_0x1e8a6b(0x1b6)+LEGACY_PARENT_SEGMENT_DIR+_0x1e8a6b(0x1dc)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x1e8a6b(0x21f)](a21_0x1bbe9b[_0x1e8a6b(0x1f1)](_0x1e8a6b(0x237)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x4947){const _0x48fe71=_0x4947 instanceof Error?_0x4947[_0x1e8a6b(0x11a)]:String(_0x4947);return console[_0x1e8a6b(0x21f)](a21_0x1bbe9b[_0x1e8a6b(0x1af)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x48fe71+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x36ce6e(0x172)](_0x5aaa4a){return migrateLegacyDirectory(),super['run'](_0x5aaa4a);}}function resolveYamlFile(_0x4dc111){const _0x32804b=a21_0x36ce6e;if(_0x4dc111[_0x32804b(0x121)](_0x32804b(0x1a2))||_0x4dc111['endsWith'](_0x32804b(0x141)))return _0x4dc111;return a21_0x3731ca['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4dc111)+_0x32804b(0x1a2));}function formatProgressMessage(_0x17734c){const _0x23c8b1=a21_0x36ce6e,_0x4e5db2=_0x17734c[_0x23c8b1(0x220)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4e5db2){const [,_0x565782,_0x350bca,_0x465ba6='']=_0x4e5db2;return a21_0x1bbe9b[_0x23c8b1(0x20f)](_0x565782+':')+'\x20'+_0x350bca+a21_0x1bbe9b[_0x23c8b1(0x20f)](_0x465ba6);}return a21_0x1bbe9b[_0x23c8b1(0x20f)](_0x17734c);}function showFileNotFoundError(_0xd53140,_0x395749){const _0x59897d=a21_0x36ce6e;console[_0x59897d(0x21f)](a21_0x1bbe9b[_0x59897d(0x1af)](_0x59897d(0x231)+_0xd53140+'\x0a')),console['error'](a21_0x1bbe9b[_0x59897d(0x223)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x395749+_0x59897d(0x147)));}function showParentSegmentNotSetError(_0x311aad){const _0x3b2e50=a21_0x36ce6e;console[_0x3b2e50(0x21f)](a21_0x1bbe9b['yellow']('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x3b2e50(0x21f)](_0x311aad);}export class ParentSegmentListCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x1e3);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x1e6);async[a21_0x36ce6e(0x14c)](_0x504615){const _0x52abf1=a21_0x36ce6e,{options:_0x5f0998,args:_0x5c43f6,tdx:_0x22275f}=_0x504615,_0x4e3946=_0x5c43f6[0x0];_0x5f0998[_0x52abf1(0x200)]&&(console[_0x52abf1(0x21f)](_0x52abf1(0x159)+_0x5f0998[_0x52abf1(0x142)]),_0x4e3946&&console[_0x52abf1(0x21f)](_0x52abf1(0x1ac)+_0x4e3946));const _0x31947f=await withSpinner(_0x4e3946?_0x52abf1(0x169)+_0x4e3946+_0x52abf1(0x192):_0x52abf1(0x20d),()=>_0x22275f[_0x52abf1(0x1b4)][_0x52abf1(0x1b9)](),{'verbose':_0x5f0998[_0x52abf1(0x200)]});let _0x2f884a=_0x31947f[_0x52abf1(0x133)];if(_0x4e3946){const _0x5d258f=_0x4e3946[_0x52abf1(0x21a)](/[.+^${}()|[\]\\]/g,_0x52abf1(0x179))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x3218c4=new RegExp('^'+_0x5d258f+'$','i');_0x2f884a=_0x2f884a[_0x52abf1(0x18b)](_0x222e9b=>_0x3218c4[_0x52abf1(0x129)](_0x222e9b[_0x52abf1(0x1ea)][_0x52abf1(0x11b)]));}_0x2f884a[_0x52abf1(0x1a0)]((_0x18d083,_0x1fe17c)=>_0x18d083[_0x52abf1(0x1ea)][_0x52abf1(0x11b)][_0x52abf1(0x166)](_0x1fe17c[_0x52abf1(0x1ea)][_0x52abf1(0x11b)])),console[_0x52abf1(0x21f)](_0x52abf1(0x1ce)+_0x2f884a[_0x52abf1(0x1df)]+_0x52abf1(0x235)+(_0x2f884a['length']!==0x1?'s':''));const _0x35c843=_0x2b134f=>{const _0x207523=_0x52abf1;return getConsoleNextUrl(_0x5f0998['site'],_0x207523(0x1c0)+_0x2b134f);};if(_0x5f0998[_0x52abf1(0x13a)]===_0x52abf1(0x218)||_0x5f0998[_0x52abf1(0x13a)]===_0x52abf1(0x17e)){const _0x3de469=_0x2f884a['map'](_0x52fd5b=>({..._0x52fd5b,'url':_0x35c843(_0x52fd5b['id'])}));await handleSDKOutput(_0x3de469,_0x5f0998);}else{if(_0x2f884a[_0x52abf1(0x1df)]===0x0)_0x4e3946?console[_0x52abf1(0x1ff)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x4e3946):console[_0x52abf1(0x1ff)](_0x52abf1(0x1b0));else for(const _0x32e83e of _0x2f884a){const _0x7d61d0=_0x32e83e[_0x52abf1(0x1ea)][_0x52abf1(0x16b)]?a21_0x1bbe9b['dim']('\x20('+formatRows(_0x32e83e['attributes'][_0x52abf1(0x16b)])+')'):'',_0x18bf24=hyperlink(_0x32e83e[_0x52abf1(0x1ea)][_0x52abf1(0x11b)],_0x35c843(_0x32e83e['id']));console[_0x52abf1(0x1ff)](_0x52abf1(0x1ee)+_0x18bf24+_0x7d61d0);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x19d);[a21_0x36ce6e(0x1f2)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a21_0x36ce6e(0x14c)](_0x4742b7){const _0x1519a6=a21_0x36ce6e,{options:_0x40b83c,args:_0x19bea4,tdx:_0x317038}=_0x4742b7;console['error'](_0x1519a6(0x230)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x1519a6(0x221));const _0x5d998d=_0x40b83c;if(_0x19bea4['length']===0x0)return console[_0x1519a6(0x21f)](a21_0x1bbe9b['red'](_0x1519a6(0x119))),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x3e7cd8=_0x19bea4[0x0];if(!_0x5d998d['database']||!_0x5d998d[_0x1519a6(0x219)])return console[_0x1519a6(0x21f)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x1519a6(0x21f)](_0x1519a6(0x12f)),0x1;_0x5d998d[_0x1519a6(0x200)]&&(console['error'](_0x1519a6(0x159)+_0x5d998d['site']),console['error'](_0x1519a6(0x21d)+_0x3e7cd8),console[_0x1519a6(0x21f)](_0x1519a6(0x22c)+_0x5d998d[_0x1519a6(0x1cb)]),console['error'](_0x1519a6(0x17f)+_0x5d998d[_0x1519a6(0x219)]));const _0x1d7e29=await loadJSONFromOptions(_0x5d998d[_0x1519a6(0x1ea)],_0x5d998d[_0x1519a6(0x19f)]),_0x27bcf2=await loadJSONFromOptions(_0x5d998d[_0x1519a6(0x165)],_0x5d998d[_0x1519a6(0x1d7)]),_0x226634=await loadJSONFromOptions(_0x5d998d[_0x1519a6(0x238)],_0x5d998d[_0x1519a6(0x1cf)]),_0x2d079e={'name':_0x3e7cd8,'description':_0x5d998d[_0x1519a6(0x1f2)],'scheduleType':_0x5d998d['scheduleType'],'scheduleOption':_0x5d998d['scheduleOption'],'timezone':_0x5d998d[_0x1519a6(0x1bd)],'master':{'parentDatabaseName':_0x5d998d['database'],'parentTableName':_0x5d998d['table']},'attributes':_0x1d7e29,'behaviors':_0x27bcf2,'customerGroup':_0x226634},_0x2bb17f=await withSpinner(_0x1519a6(0x138)+_0x3e7cd8+'\x27...',()=>_0x317038[_0x1519a6(0x1b4)]['createParent'](_0x2d079e),{'verbose':_0x40b83c[_0x1519a6(0x200)]}),_0x1abe27=_0x2bb17f['data'];return console['error'](_0x1519a6(0x1ba)+_0x1abe27[_0x1519a6(0x11b)]+'\x27\x20with\x20ID:\x20'+_0x1abe27['id']),await handleSDKOutput([_0x1abe27],_0x40b83c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]='segment:parent:update';[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x162);async[a21_0x36ce6e(0x14c)](_0x5d81fd){const _0x3ebbce=a21_0x36ce6e,{options:_0x5766c8,args:_0x3c6d81,tdx:_0x52d57a}=_0x5d81fd;console[_0x3ebbce(0x21f)](_0x3ebbce(0x1e7)+_0x3ebbce(0x1fb)+_0x3ebbce(0x221));const _0x4c83c4=_0x5766c8;if(_0x3c6d81[_0x3ebbce(0x1df)]===0x0)return console[_0x3ebbce(0x21f)](a21_0x1bbe9b[_0x3ebbce(0x1af)](_0x3ebbce(0x119))),console[_0x3ebbce(0x21f)](_0x3ebbce(0x1ed)),0x1;const _0x489fee=_0x3c6d81[0x0];_0x4c83c4[_0x3ebbce(0x200)]&&(console[_0x3ebbce(0x21f)](_0x3ebbce(0x159)+_0x4c83c4[_0x3ebbce(0x142)]),console[_0x3ebbce(0x21f)](_0x3ebbce(0x181)+_0x489fee));const _0x1738a9=await withSpinner(_0x3ebbce(0x157)+_0x489fee+_0x3ebbce(0x192),()=>_0x52d57a[_0x3ebbce(0x1b4)][_0x3ebbce(0x1bf)](_0x489fee),{'verbose':_0x4c83c4[_0x3ebbce(0x200)]}),_0x16ed14=_0x1738a9[_0x3ebbce(0x133)],_0x598aac=await loadJSONFromOptions(_0x4c83c4[_0x3ebbce(0x1a7)],_0x4c83c4[_0x3ebbce(0x18c)]),_0x2b5318=await loadJSONFromOptions(_0x4c83c4[_0x3ebbce(0x132)],_0x4c83c4[_0x3ebbce(0x178)]),_0x3bf1ef={'name':_0x16ed14[_0x3ebbce(0x11b)],'description':_0x4c83c4['description']!==undefined?_0x4c83c4['description']:_0x16ed14[_0x3ebbce(0x1f2)],'scheduleType':_0x4c83c4[_0x3ebbce(0x194)]!==undefined?_0x4c83c4['scheduleType']:_0x16ed14['scheduleType'],'scheduleOption':_0x4c83c4[_0x3ebbce(0x156)]!==undefined?_0x4c83c4[_0x3ebbce(0x156)]:_0x16ed14[_0x3ebbce(0x156)],'timezone':_0x4c83c4['timezone']!==undefined?_0x4c83c4['timezone']:_0x16ed14[_0x3ebbce(0x1bd)],'master':_0x16ed14['master'],'attributes':_0x598aac?[..._0x16ed14[_0x3ebbce(0x1ea)]||[],..._0x598aac]:_0x16ed14['attributes'],'behaviors':_0x2b5318?[..._0x16ed14[_0x3ebbce(0x165)]||[],..._0x2b5318]:_0x16ed14['behaviors'],'customerGroup':_0x16ed14[_0x3ebbce(0x238)]},_0xe4ed36=await withSpinner(_0x3ebbce(0x1e1)+_0x489fee+'\x27...',()=>_0x52d57a[_0x3ebbce(0x1b4)][_0x3ebbce(0x232)](_0x489fee,_0x3bf1ef),{'verbose':_0x4c83c4[_0x3ebbce(0x200)]}),_0x175808=_0xe4ed36['data'];return console[_0x3ebbce(0x21f)](_0x3ebbce(0x122)+_0x175808[_0x3ebbce(0x11b)]+'\x27'),await handleSDKOutput([_0x175808],_0x4c83c4),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x1b2);[a21_0x36ce6e(0x1f2)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a21_0x36ce6e(0x14c)](_0x21b464){const _0x2078c0=a21_0x36ce6e,{options:_0x3bc1b6,args:_0x5bb20b,tdx:_0x48c6ab}=_0x21b464,_0x148317=_0x3bc1b6,_0x408a03=_0x5bb20b[0x0]||_0x3bc1b6[_0x2078c0(0x131)];if(!_0x408a03)return showParentSegmentNotSetError(_0x2078c0(0x127)+_0x2078c0(0x15f)),0x1;if(_0x148317[_0x2078c0(0x15d)]&&_0x148317[_0x2078c0(0x152)])return console[_0x2078c0(0x21f)](a21_0x1bbe9b[_0x2078c0(0x1af)](_0x2078c0(0x1b8))),console[_0x2078c0(0x21f)](a21_0x1bbe9b[_0x2078c0(0x20f)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x2078c0(0x21f)](a21_0x1bbe9b['dim'](_0x2078c0(0x180)+PARENT_SEGMENT_DIR+_0x2078c0(0x175))),console[_0x2078c0(0x21f)](a21_0x1bbe9b['cyan'](_0x2078c0(0x1b7))),0x1;const _0x368464=_0x148317[_0x2078c0(0x152)]||a21_0x3731ca['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x408a03)+_0x2078c0(0x1a2));_0x148317[_0x2078c0(0x200)]&&(console[_0x2078c0(0x21f)](_0x2078c0(0x159)+_0x148317[_0x2078c0(0x142)]),console[_0x2078c0(0x21f)](_0x2078c0(0x181)+_0x408a03),console[_0x2078c0(0x21f)](_0x2078c0(0x1ab)+_0x368464));const _0x5e33f8=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x408a03+_0x2078c0(0x192),()=>_0x48c6ab[_0x2078c0(0x1b4)][_0x2078c0(0x20c)](_0x408a03),{'verbose':_0x148317[_0x2078c0(0x200)]}),_0x73aa92=_0x5e33f8['data'];if(existsSync(_0x368464)){const _0x215bb6=readFileSync(_0x368464,_0x2078c0(0x11d)),_0x43aafc=generateDiff(_0x215bb6,_0x73aa92);if(!hasChanges(_0x43aafc))console['error'](a21_0x1bbe9b[_0x2078c0(0x1f1)]('✔')+_0x2078c0(0x11f)+a21_0x1bbe9b[_0x2078c0(0x223)](_0x368464)+_0x2078c0(0x1e5));else{console[_0x2078c0(0x21f)](_0x2078c0(0x1fa)+_0x368464+'\x27:'),console[_0x2078c0(0x21f)]('─'[_0x2078c0(0x140)](0x3c)),console['error'](formatDiffWithColors(_0x43aafc)),console['error']('─'['repeat'](0x3c));if(!_0x148317[_0x2078c0(0x1de)]){const _0x2961c1=await confirmKey(_0x2078c0(0x21c)+_0x368464+'\x27?');if(!_0x2961c1)return console[_0x2078c0(0x21f)](_0x2078c0(0x208)),0x1;}writeFileSync(_0x368464,_0x73aa92,_0x2078c0(0x11d)),console[_0x2078c0(0x21f)](a21_0x1bbe9b['green']('✔')+_0x2078c0(0x124)+a21_0x1bbe9b['cyan'](_0x368464));}}else{const _0xe4eae8=a21_0x3731ca['dirname'](_0x368464);!existsSync(_0xe4eae8)&&mkdirSync(_0xe4eae8,{'recursive':!![]}),writeFileSync(_0x368464,_0x73aa92,_0x2078c0(0x11d)),console['error'](a21_0x1bbe9b[_0x2078c0(0x1f1)]('✔')+_0x2078c0(0x124)+a21_0x1bbe9b[_0x2078c0(0x223)](_0x368464));}return saveSessionContext({'parent_segment':_0x408a03},_0x148317[_0x2078c0(0x20b)]),console['error'](a21_0x1bbe9b[_0x2078c0(0x1f1)]('✔')+_0x2078c0(0x183)+a21_0x1bbe9b['dim'](_0x2078c0(0x228))+'\x20=\x20'+a21_0x1bbe9b[_0x2078c0(0x223)](_0x408a03)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]='segment:parent:push';[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x16c);async[a21_0x36ce6e(0x14c)](_0x591836){const _0x32c538=a21_0x36ce6e,{options:_0x22bd7b,args:_0x585b21,tdx:_0x2149ab}=_0x591836,_0x1e22fe=_0x22bd7b,_0x55491a=_0x585b21[0x0]||_0x22bd7b[_0x32c538(0x131)];if(!_0x55491a)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'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x6356b8=resolveYamlFile(_0x55491a);if(!existsSync(_0x6356b8))return showFileNotFoundError(_0x6356b8,_0x55491a),0x1;_0x1e22fe[_0x32c538(0x200)]&&(console[_0x32c538(0x21f)](_0x32c538(0x159)+_0x1e22fe[_0x32c538(0x142)]),console[_0x32c538(0x21f)](_0x32c538(0x14f)+_0x6356b8));let _0x3ad831;try{_0x3ad831=readFileSync(_0x6356b8,'utf-8');}catch(_0x224eea){const _0x177e2a=_0x224eea instanceof Error?_0x224eea['message']:String(_0x224eea);return console['error']('Error\x20reading\x20file:\x20'+_0x177e2a),0x1;}const _0x252f8f=await withSpinner(_0x32c538(0x20a),()=>_0x2149ab[_0x32c538(0x1b4)]['pushParentYaml'](_0x3ad831),{'verbose':_0x1e22fe[_0x32c538(0x200)]}),_0x447f6b=_0x252f8f[_0x32c538(0x133)],{isNew:_0x3b66d0,name:_0xb8b2fd,hasChanges:_0x20bfc0,diffFormatted:_0x1a133c}=_0x447f6b;if(!_0x20bfc0)return console['error'](_0x32c538(0x239)+_0xb8b2fd+_0x32c538(0x1bb)),0x0;_0x3b66d0?console[_0x32c538(0x21f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xb8b2fd+'\x27:'):console[_0x32c538(0x21f)](_0x32c538(0x209)+_0xb8b2fd+'\x27:');console[_0x32c538(0x21f)]('─'[_0x32c538(0x140)](0x3c)),console[_0x32c538(0x21f)](_0x1a133c),console[_0x32c538(0x21f)]('─'['repeat'](0x3c));const _0x423f1e=_0x3b66d0?'Create\x20parent\x20segment\x20\x27'+_0xb8b2fd+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xb8b2fd+'\x27?';if(!_0x1e22fe[_0x32c538(0x1de)]){const _0xe351ca=await confirmKey(_0x423f1e);if(!_0xe351ca)return console[_0x32c538(0x21f)](_0x32c538(0x208)),0x1;}const _0x4fcdd0=_0x3b66d0?_0x32c538(0x1d3):'Updating',_0x358466=await withSpinner(_0x4fcdd0+'\x20parent\x20segment\x20\x27'+_0xb8b2fd+_0x32c538(0x192),()=>_0x447f6b[_0x32c538(0x1c5)](),{'verbose':_0x1e22fe['verbose']}),_0x2716d5=_0x358466[_0x32c538(0x133)],_0x332f77=getConsoleNextUrl(_0x1e22fe['site'],_0x32c538(0x1c0)+_0x2716d5['id']),_0x213b30=_0x3b66d0?_0x32c538(0x128):'Updated';return console[_0x32c538(0x21f)]('✔\x20'+_0x213b30+_0x32c538(0x234)+_0x2716d5['name']+'\x27'),console[_0x32c538(0x21f)]('\x20\x20'+_0x332f77),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x211);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x1a6);async[a21_0x36ce6e(0x14c)](_0x75feae){const _0x12a6ba=a21_0x36ce6e,{options:_0xce233d,args:_0x1d5457,tdx:_0x198027}=_0x75feae,_0xc17ee3=_0xce233d,_0x45e967=_0x1d5457[0x0]||_0xce233d['parentSegment'];if(!_0x45e967)return showParentSegmentNotSetError(_0x12a6ba(0x1d6)+_0x12a6ba(0x1e9)+_0x12a6ba(0x1db)+_0x12a6ba(0x202)+_0x12a6ba(0x1b5)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x3094cd=resolveYamlFile(_0x45e967);if(!existsSync(_0x3094cd))return showFileNotFoundError(_0x3094cd,_0x45e967),0x1;_0xc17ee3[_0x12a6ba(0x200)]&&(console[_0x12a6ba(0x21f)](_0x12a6ba(0x159)+_0xc17ee3[_0x12a6ba(0x142)]),console[_0x12a6ba(0x21f)]('YAML\x20file:\x20'+_0x3094cd));let _0x41ec43;try{_0x41ec43=readFileSync(_0x3094cd,'utf-8');}catch(_0x4ad2bb){const _0x38271d=_0x4ad2bb instanceof Error?_0x4ad2bb[_0x12a6ba(0x11a)]:String(_0x4ad2bb);return console[_0x12a6ba(0x21f)](_0x12a6ba(0x1a8)+_0x38271d),0x1;}const _0x5797f1=createCommandSpinner(a21_0x1bbe9b[_0x12a6ba(0x20f)]('Validating\x20configuration...'),{'verbose':_0xc17ee3[_0x12a6ba(0x200)]});_0x5797f1[_0x12a6ba(0x15b)]();const _0x2b884f={'onProgress':_0x26c276=>{const _0x439919=_0x12a6ba;_0x5797f1[_0x439919(0x154)]=formatProgressMessage(_0x26c276);}};if(_0xc17ee3[_0x12a6ba(0x1a1)])_0x2b884f[_0x12a6ba(0x1a1)]=!![];if(_0xc17ee3[_0x12a6ba(0x203)])_0x2b884f['enriched']=!![];_0xc17ee3[_0x12a6ba(0x225)]&&(_0x2b884f[_0x12a6ba(0x225)]=_0xc17ee3[_0x12a6ba(0x225)]);_0xc17ee3[_0x12a6ba(0x1c2)]&&(_0x2b884f[_0x12a6ba(0x1c2)]=_0xc17ee3[_0x12a6ba(0x1c2)]);if(_0xc17ee3[_0x12a6ba(0x1e8)])_0x2b884f['interval']=_0xc17ee3[_0x12a6ba(0x1e8)];let _0x153823;try{_0x153823=await _0x198027[_0x12a6ba(0x1b4)][_0x12a6ba(0x1c8)](_0x41ec43,_0x2b884f),_0x5797f1[_0x12a6ba(0x1fe)]();}catch(_0x354082){_0x5797f1[_0x12a6ba(0x1fe)]();throw _0x354082;}const _0x30da6d=_0xc17ee3['interval']||_0x12a6ba(0x21e);return this['displayValidateResults'](_0x153823,_0x2b884f,_0x3094cd,_0x30da6d),_0x153823[_0x12a6ba(0x13e)]?0x0:0x1;}[a21_0x36ce6e(0x1ef)](_0x3a95ba,_0x41d5b2,_0x3592c3,_0x51e2ee){const _0xe5933b=a21_0x36ce6e;console[_0xe5933b(0x21f)]('\x0a'+a21_0x1bbe9b[_0xe5933b(0x227)](_0xe5933b(0x216))+'\x20'+_0x3a95ba['name']),console['error']('═'['repeat'](0x3c)),this[_0xe5933b(0x14a)](_0x3a95ba);if(typeof _0x41d5b2[_0xe5933b(0x225)]==='string'){this['displayAttributesStats'](_0x3a95ba),this['displaySummary'](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,'attribute',_0x41d5b2[_0xe5933b(0x225)]);return;}if(_0x41d5b2[_0xe5933b(0x225)]===!![]){this[_0xe5933b(0x199)](_0x3a95ba),this[_0xe5933b(0x120)](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,_0xe5933b(0x1ea));return;}if(typeof _0x41d5b2[_0xe5933b(0x1c2)]===_0xe5933b(0x1b3)){this[_0xe5933b(0x146)](_0x3a95ba,_0x51e2ee),this[_0xe5933b(0x120)](_0x3a95ba),this['displayPreviewHints'](_0x3592c3,_0x51e2ee,_0xe5933b(0x1c2),_0x41d5b2[_0xe5933b(0x1c2)]);return;}if(_0x41d5b2[_0xe5933b(0x1c2)]===!![]){this[_0xe5933b(0x146)](_0x3a95ba,_0x51e2ee),this[_0xe5933b(0x120)](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,_0xe5933b(0x165));return;}this[_0xe5933b(0x199)](_0x3a95ba),this[_0xe5933b(0x146)](_0x3a95ba,_0x51e2ee),this['displaySummary'](_0x3a95ba),this[_0xe5933b(0x12a)](_0x3592c3,_0x51e2ee,'all');}[a21_0x36ce6e(0x12a)](_0x163daf,_0x3ecb83,_0x3132bb,_0x227d6e){const _0x3f4826=a21_0x36ce6e;console[_0x3f4826(0x21f)]('\x0a'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x144)));const _0x2965d9=_0x3ecb83!==_0x3f4826(0x21e)?_0x3f4826(0x19a)+_0x3ecb83:'';if(_0x3132bb==='attribute'&&_0x227d6e)console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--attribute\x20\x22'+_0x227d6e+'\x22'+_0x2965d9));else{if(_0x3132bb===_0x3f4826(0x1c2)&&_0x227d6e)console['error']('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--behavior\x20\x22'+_0x227d6e+'\x22'+_0x2965d9));else(_0x3132bb===_0x3f4826(0x1ea)||_0x3132bb==='all')&&console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+_0x3f4826(0x191)+_0x2965d9));}(_0x3132bb===_0x3f4826(0x165)||_0x3132bb===_0x3f4826(0x1b1))&&console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--behavior\x20\x22<name>\x22'+_0x2965d9)),_0x3132bb===_0x3f4826(0x1b1)&&console[_0x3f4826(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x3f4826(0x20f)](_0x3f4826(0x177)+_0x163daf+'\x20--enriched'+_0x2965d9));}[a21_0x36ce6e(0x14a)](_0xf9a7fc){const _0x4c1772=a21_0x36ce6e,{master:_0x1eab8e}=_0xf9a7fc,_0x539ede=_0x1eab8e[_0x4c1772(0x13b)]?a21_0x1bbe9b['green']('✔'):a21_0x1bbe9b[_0x4c1772(0x1af)]('✘');console[_0x4c1772(0x21f)]('\x0a'+a21_0x1bbe9b['dim'](_0x4c1772(0x12e))),console['error'](_0x539ede+'\x20'+a21_0x1bbe9b[_0x4c1772(0x227)](_0x1eab8e[_0x4c1772(0x1cb)]+'.'+_0x1eab8e[_0x4c1772(0x219)])),_0x1eab8e[_0x4c1772(0x13b)]?_0x1eab8e['rowCount']!==undefined&&console[_0x4c1772(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x4c1772(0x20f)](_0x4c1772(0x207))+'\x20'+a21_0x1bbe9b[_0x4c1772(0x223)](formatRows(_0x1eab8e['rowCount']))):console[_0x4c1772(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x4c1772(0x1af)](_0x4c1772(0x151))+'\x20'+_0x1eab8e[_0x4c1772(0x1aa)]);}[a21_0x36ce6e(0x199)](_0x8dceb8){const _0x5a2fce=a21_0x36ce6e;if(_0x8dceb8[_0x5a2fce(0x1ea)][_0x5a2fce(0x1df)]===0x0)return;console['error']('\x0a'+a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x22a)));for(const _0xb99cbb of _0x8dceb8[_0x5a2fce(0x1ea)]){const _0x164c8d=_0xb99cbb[_0x5a2fce(0x13b)]?a21_0x1bbe9b[_0x5a2fce(0x1f1)]('✔'):a21_0x1bbe9b[_0x5a2fce(0x1af)]('✘');let _0x24a490='';if(_0xb99cbb[_0x5a2fce(0x13b)]&&_0xb99cbb[_0x5a2fce(0x204)]!==undefined&&_0xb99cbb[_0x5a2fce(0x112)]!==undefined){const _0x31c9b9=_0xb99cbb['coveragePercent'][_0x5a2fce(0x186)](0x1),_0x99e382=_0xb99cbb[_0x5a2fce(0x112)]>=0x50?a21_0x1bbe9b['green']:_0xb99cbb[_0x5a2fce(0x112)]>=0x32?a21_0x1bbe9b[_0x5a2fce(0x1d4)]:a21_0x1bbe9b[_0x5a2fce(0x1af)];_0x24a490='\x20'+a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x1fc))+'\x20'+_0x99e382(_0x31c9b9+'%')+'\x20('+formatRows(_0xb99cbb[_0x5a2fce(0x204)])+_0x5a2fce(0x222);}console[_0x5a2fce(0x21f)](_0x164c8d+'\x20'+a21_0x1bbe9b[_0x5a2fce(0x227)](_0xb99cbb[_0x5a2fce(0x11b)])+_0x24a490),console[_0x5a2fce(0x21f)]('\x20\x20'+a21_0x1bbe9b['dim']('Source:')+'\x20'+a21_0x1bbe9b[_0x5a2fce(0x227)](_0xb99cbb[_0x5a2fce(0x1cb)]+'.'+_0xb99cbb[_0x5a2fce(0x219)]));const _0x514a8a=_0xb99cbb[_0x5a2fce(0x217)]===_0xb99cbb[_0x5a2fce(0x17b)]?a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x161))+'\x20'+_0xb99cbb[_0x5a2fce(0x217)]:a21_0x1bbe9b[_0x5a2fce(0x20f)](_0x5a2fce(0x1d2))+'\x20'+_0xb99cbb[_0x5a2fce(0x217)]+_0x5a2fce(0x137)+_0xb99cbb[_0x5a2fce(0x17b)];console['error']('\x20\x20'+_0x514a8a),console['error']('\x20\x20'+a21_0x1bbe9b['dim'](_0x5a2fce(0x1c4))),this[_0x5a2fce(0x1ca)](_0xb99cbb[_0x5a2fce(0x215)]),!_0xb99cbb[_0x5a2fce(0x13b)]&&console['error']('\x20\x20'+a21_0x1bbe9b['red'](_0x5a2fce(0x151))+'\x20'+_0xb99cbb['schemaError']);}}['displayBehaviorsStats'](_0x1f79c3,_0x50dd75){const _0x335c15=a21_0x36ce6e;if(_0x1f79c3[_0x335c15(0x165)][_0x335c15(0x1df)]===0x0)return;console[_0x335c15(0x21f)]('\x0a'+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x1cd))+'\x20'+a21_0x1bbe9b[_0x335c15(0x20f)]('('+_0x50dd75+')'));for(const _0x4941f9 of _0x1f79c3[_0x335c15(0x165)]){const _0x517a84=_0x4941f9[_0x335c15(0x13b)]?a21_0x1bbe9b['green']('✔'):a21_0x1bbe9b['red']('✘');let _0x390d1f='';if(_0x4941f9[_0x335c15(0x13b)]&&_0x4941f9[_0x335c15(0x1a4)]!==undefined&&_0x4941f9[_0x335c15(0x1d1)]!==undefined){const _0x5a3249=_0x4941f9[_0x335c15(0x22e)]?.[_0x335c15(0x186)](0x1)||'?',_0x420fd8=(_0x4941f9[_0x335c15(0x22e)]??0x0)>=0x32?a21_0x1bbe9b[_0x335c15(0x1f1)]:(_0x4941f9[_0x335c15(0x22e)]??0x0)>=0x14?a21_0x1bbe9b[_0x335c15(0x1d4)]:a21_0x1bbe9b[_0x335c15(0x1af)];_0x390d1f='\x20'+a21_0x1bbe9b[_0x335c15(0x20f)]('Customers:')+'\x20'+_0x420fd8(formatRows(_0x4941f9['customersWithEvents']))+'\x20('+_0x5a3249+_0x335c15(0x113)+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x21b))+'\x20'+a21_0x1bbe9b[_0x335c15(0x223)](formatRows(_0x4941f9[_0x335c15(0x1d1)]));}console['error'](_0x517a84+'\x20'+a21_0x1bbe9b[_0x335c15(0x227)](_0x4941f9[_0x335c15(0x11b)])+_0x390d1f),console[_0x335c15(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x1be))+'\x20'+a21_0x1bbe9b['bold'](_0x4941f9[_0x335c15(0x1cb)]+'.'+_0x4941f9['table']));const _0x2f3cfb=_0x4941f9[_0x335c15(0x217)]===_0x4941f9[_0x335c15(0x17b)]?a21_0x1bbe9b[_0x335c15(0x20f)]('Join\x20on:')+'\x20'+_0x4941f9[_0x335c15(0x217)]:a21_0x1bbe9b[_0x335c15(0x20f)]('Join:')+'\x20'+_0x4941f9[_0x335c15(0x217)]+_0x335c15(0x137)+_0x4941f9[_0x335c15(0x17b)];console[_0x335c15(0x21f)]('\x20\x20'+_0x2f3cfb),console[_0x335c15(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x335c15(0x20f)](_0x335c15(0x1c4))),this[_0x335c15(0x1ca)](_0x4941f9['columns']),!_0x4941f9[_0x335c15(0x13b)]&&console['error']('\x20\x20'+a21_0x1bbe9b[_0x335c15(0x1af)]('Error:')+'\x20'+_0x4941f9[_0x335c15(0x1aa)]);}}[a21_0x36ce6e(0x1ca)](_0x4707e1){const _0x4c09d1=a21_0x36ce6e;for(const _0x162fb9 of _0x4707e1){_0x162fb9['label']===_0x162fb9[_0x4c09d1(0x188)]||_0x162fb9[_0x4c09d1(0x188)]==='*'?console[_0x4c09d1(0x21f)](_0x4c09d1(0x1c1)+_0x162fb9[_0x4c09d1(0x187)]):console[_0x4c09d1(0x21f)](_0x4c09d1(0x1c1)+_0x162fb9[_0x4c09d1(0x187)]+'\x20'+a21_0x1bbe9b[_0x4c09d1(0x20f)]('('+_0x162fb9[_0x4c09d1(0x188)]+')'));}}['displaySummary'](_0x39c1ad){const _0x1e8e23=a21_0x36ce6e;console[_0x1e8e23(0x21f)]('─'[_0x1e8e23(0x140)](0x3c));if(_0x39c1ad['errors'][_0x1e8e23(0x1df)]>0x0){console['error']('\x0a'+a21_0x1bbe9b['red'](_0x1e8e23(0x15c)));for(const _0x168619 of _0x39c1ad['errors']){console[_0x1e8e23(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x1e8e23(0x1af)]('•')+'\x20'+_0x168619);}}_0x39c1ad[_0x1e8e23(0x13e)]&&console[_0x1e8e23(0x21f)]('\x0a'+a21_0x1bbe9b[_0x1e8e23(0x1f1)]('✔')+_0x1e8e23(0x11c));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x1c7);[a21_0x36ce6e(0x1f2)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async['execute'](_0xbef555){const _0x2f9c3e=a21_0x36ce6e,{options:_0x2f2b58,args:_0x5adb2f,tdx:_0x5c23f5}=_0xbef555,_0x1f285e=_0x2f2b58,_0x1a738e=_0x5adb2f[0x0]||_0x2f2b58[_0x2f9c3e(0x131)];if(!_0x1a738e)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x2f9c3e(0x145)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x2f9c3e(0x123)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x2f9c3e(0x11e)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x1f285e[_0x2f9c3e(0x1a1)]&&!_0x1f285e['attribute']&&!_0x1f285e[_0x2f9c3e(0x1c2)]&&!_0x1f285e[_0x2f9c3e(0x203)])return console['error'](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x1f7))),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x167)),console[_0x2f9c3e(0x21f)]('Options:'),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x206)),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x1f4)),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x12c)),0x1;const _0x244419=resolveYamlFile(_0x1a738e);if(!existsSync(_0x244419))return showFileNotFoundError(_0x244419,_0x1a738e),0x1;_0x1f285e[_0x2f9c3e(0x200)]&&(console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x159)+_0x1f285e[_0x2f9c3e(0x142)]),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x14f)+_0x244419));let _0x44abc6;try{_0x44abc6=readFileSync(_0x244419,_0x2f9c3e(0x11d));}catch(_0x5a1199){const _0x222e45=_0x5a1199 instanceof Error?_0x5a1199[_0x2f9c3e(0x11a)]:String(_0x5a1199);return console[_0x2f9c3e(0x21f)]('Error\x20reading\x20file:\x20'+_0x222e45),0x1;}let _0x4209ee;try{_0x4209ee=parseDef(_0x44abc6);}catch(_0x33bdf1){const _0x4e49ae=_0x33bdf1 instanceof Error?_0x33bdf1[_0x2f9c3e(0x11a)]:String(_0x33bdf1);return console[_0x2f9c3e(0x21f)](a21_0x1bbe9b['red']('Error\x20parsing\x20YAML:\x20'+_0x4e49ae)),0x1;}if(_0x1f285e['attribute']===!![]||_0x1f285e['attribute']===''){const _0x4bb959=_0x4209ee['attributes']?.[_0x2f9c3e(0x1bc)](_0x1d051a=>_0x1d051a[_0x2f9c3e(0x11b)])||[];if(_0x4bb959['length']===0x0)console[_0x2f9c3e(0x21f)](a21_0x1bbe9b[_0x2f9c3e(0x1af)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x2f9c3e(0x21f)](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x126))),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x18a));for(const _0x519d31 of _0x4bb959){console[_0x2f9c3e(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x2f9c3e(0x223)](_0x519d31));}console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x1c6)+_0x1a738e+'\x20--attribute\x20\x22'+_0x4bb959[0x0]+'\x22');}return 0x1;}if(_0x1f285e['behavior']===!![]||_0x1f285e[_0x2f9c3e(0x1c2)]===''){const _0x203244=_0x4209ee['behaviors']?.[_0x2f9c3e(0x1bc)](_0x3552a4=>_0x3552a4[_0x2f9c3e(0x11b)])||[];if(_0x203244['length']===0x0)console['error'](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x143)));else{console[_0x2f9c3e(0x21f)](a21_0x1bbe9b[_0x2f9c3e(0x1af)](_0x2f9c3e(0x213))),console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x125));for(const _0x4dcf22 of _0x203244){console[_0x2f9c3e(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x2f9c3e(0x223)](_0x4dcf22));}console[_0x2f9c3e(0x21f)](_0x2f9c3e(0x1c6)+_0x1a738e+_0x2f9c3e(0x115)+_0x203244[0x0]+'\x22');}return 0x1;}const _0xee5628=createCommandSpinner(a21_0x1bbe9b[_0x2f9c3e(0x20f)]('Fetching\x20sample\x20data...'),{'verbose':_0x1f285e[_0x2f9c3e(0x200)]});_0xee5628[_0x2f9c3e(0x15b)]();const _0x4b67fa={'onProgress':_0x39f670=>{const _0x5733ae=_0x2f9c3e;_0xee5628[_0x5733ae(0x154)]=formatProgressMessage(_0x39f670);}};if(_0x1f285e[_0x2f9c3e(0x1a1)])_0x4b67fa[_0x2f9c3e(0x1a1)]=!![];if(_0x1f285e[_0x2f9c3e(0x225)]&&typeof _0x1f285e['attribute']===_0x2f9c3e(0x1b3))_0x4b67fa['attribute']=_0x1f285e['attribute'];if(_0x1f285e[_0x2f9c3e(0x1c2)]&&typeof _0x1f285e[_0x2f9c3e(0x1c2)]===_0x2f9c3e(0x1b3))_0x4b67fa[_0x2f9c3e(0x1c2)]=_0x1f285e['behavior'];if(_0x1f285e[_0x2f9c3e(0x203)])_0x4b67fa[_0x2f9c3e(0x203)]=!![];if(_0x1f285e[_0x2f9c3e(0x1e8)])_0x4b67fa[_0x2f9c3e(0x1e8)]=_0x1f285e[_0x2f9c3e(0x1e8)];let _0x13f7bf;try{_0x13f7bf=await _0x5c23f5['segment'][_0x2f9c3e(0x149)](_0x44abc6,_0x4b67fa),_0xee5628[_0x2f9c3e(0x1fe)]();}catch(_0x545147){_0xee5628[_0x2f9c3e(0x1fe)]();throw _0x545147;}return await this[_0x2f9c3e(0x14e)](_0x13f7bf,{'master':_0x1f285e[_0x2f9c3e(0x1a1)],'attribute':typeof _0x1f285e[_0x2f9c3e(0x225)]==='string'?_0x1f285e[_0x2f9c3e(0x225)]:undefined,'behavior':typeof _0x1f285e[_0x2f9c3e(0x1c2)]===_0x2f9c3e(0x1b3)?_0x1f285e['behavior']:undefined,'enriched':_0x1f285e[_0x2f9c3e(0x203)]}),_0x13f7bf[_0x2f9c3e(0x13e)]?0x0:0x1;}async[a21_0x36ce6e(0x14e)](_0x4fc200,_0x20bb8f){const _0x42e66f=a21_0x36ce6e;console[_0x42e66f(0x21f)]('\x0a'+a21_0x1bbe9b[_0x42e66f(0x227)](_0x42e66f(0x190))+'\x20'+_0x4fc200[_0x42e66f(0x11b)]),console[_0x42e66f(0x21f)]('═'[_0x42e66f(0x140)](0x3c));if(_0x20bb8f[_0x42e66f(0x1a1)]&&_0x4fc200['sampleData']){const _0x4ef669=a21_0x1bbe9b[_0x42e66f(0x20f)]('Master:')+'\x20'+a21_0x1bbe9b['bold'](_0x4fc200['master']['database']+'.'+_0x4fc200[_0x42e66f(0x1a1)][_0x42e66f(0x219)]);await this[_0x42e66f(0x16a)](_0x4ef669,_0x4fc200[_0x42e66f(0x17c)]);}else{if(_0x20bb8f[_0x42e66f(0x225)]&&_0x4fc200[_0x42e66f(0x17c)]){const _0x409393=a21_0x1bbe9b[_0x42e66f(0x20f)](_0x42e66f(0x116))+'\x20'+a21_0x1bbe9b['bold'](_0x20bb8f[_0x42e66f(0x225)]);await this[_0x42e66f(0x16a)](_0x409393,_0x4fc200[_0x42e66f(0x17c)]);}else{if(_0x20bb8f[_0x42e66f(0x1c2)]&&_0x4fc200[_0x42e66f(0x17c)]){const _0x4c0d6d=a21_0x1bbe9b[_0x42e66f(0x20f)](_0x42e66f(0x17d))+'\x20'+a21_0x1bbe9b[_0x42e66f(0x227)](_0x20bb8f['behavior']);await this[_0x42e66f(0x16a)](_0x4c0d6d,_0x4fc200[_0x42e66f(0x17c)]);}else{if(_0x20bb8f[_0x42e66f(0x203)]&&_0x4fc200[_0x42e66f(0x17c)]){const _0x22857d=a21_0x1bbe9b['dim']('Enriched:')+'\x20'+a21_0x1bbe9b['bold'](_0x42e66f(0x1f0));await this[_0x42e66f(0x16a)](_0x22857d,_0x4fc200[_0x42e66f(0x17c)]);}else!_0x4fc200[_0x42e66f(0x17c)]&&console[_0x42e66f(0x21f)](_0x42e66f(0x168));}}}if(_0x4fc200['errors'][_0x42e66f(0x1df)]>0x0){console[_0x42e66f(0x21f)]('─'['repeat'](0x3c)),console[_0x42e66f(0x21f)]('\x0a'+a21_0x1bbe9b[_0x42e66f(0x1af)]('Errors:'));for(const _0x29fe67 of _0x4fc200['errors']){console[_0x42e66f(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x42e66f(0x1af)]('•')+'\x20'+_0x29fe67);}}}async[a21_0x36ce6e(0x16a)](_0x5d326c,_0x5d5b2e){const _0xa0f933=a21_0x36ce6e;if(_0x5d5b2e[_0xa0f933(0x1df)]===0x0){console[_0xa0f933(0x21f)]('\x0a'+_0x5d326c),console[_0xa0f933(0x21f)](_0xa0f933(0x118));return;}console['error']('\x0a'+_0x5d326c);const _0x3ad42f=Object[_0xa0f933(0x18e)](_0x5d5b2e[0x0])[_0xa0f933(0x1bc)](_0x15698a=>({'name':_0x15698a,'type':typeof _0x5d5b2e[0x0][_0x15698a]===_0xa0f933(0x171)?_0xa0f933(0x173):_0xa0f933(0x197)})),_0x2091a9={'queryId':'preview','columns':_0x3ad42f,'data':_0x5d5b2e,'stats':{'state':_0xa0f933(0x201),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5d5b2e[_0xa0f933(0x1df)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x448dbf=formatAsTable(_0x2091a9,_0x5d5b2e[_0xa0f933(0x1df)],!![]);await writeOutput(_0x448dbf,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x36ce6e(0x11b)]='segment:parent:run';[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x12b);async['execute'](_0x4c0ca1){const _0x6be89c=a21_0x36ce6e,{options:_0x1cdee7,args:_0x476cb5,tdx:_0x1a499e}=_0x4c0ca1,_0x43317e=_0x1cdee7,_0x598abf=_0x476cb5[0x0]||_0x1cdee7[_0x6be89c(0x131)];if(!_0x598abf)return showParentSegmentNotSetError(_0x6be89c(0x160)+_0x6be89c(0x1a9)),0x1;const _0x146eea=resolveYamlFile(_0x598abf);if(existsSync(_0x146eea)){_0x43317e[_0x6be89c(0x200)]&&console['error'](_0x6be89c(0x22f)+_0x146eea);let _0x3a4402;try{_0x3a4402=readFileSync(_0x146eea,_0x6be89c(0x11d));}catch(_0x421375){const _0x2d4795=_0x421375 instanceof Error?_0x421375[_0x6be89c(0x11a)]:String(_0x421375);return console[_0x6be89c(0x21f)]('Error\x20reading\x20file:\x20'+_0x2d4795),0x1;}const _0x44db5e=await withSpinner('Analyzing\x20changes...',()=>_0x1a499e['segment'][_0x6be89c(0x196)](_0x3a4402),{'verbose':_0x43317e[_0x6be89c(0x200)]}),_0x47555c=_0x44db5e['data'],{isNew:_0x517a69,name:_0x3c3347,hasChanges:_0x216773,diffFormatted:_0x1e2eaa}=_0x47555c;if(_0x216773){_0x517a69?console[_0x6be89c(0x21f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x3c3347+'\x27:'):console[_0x6be89c(0x21f)](_0x6be89c(0x209)+_0x3c3347+'\x27:');console[_0x6be89c(0x21f)]('─'[_0x6be89c(0x140)](0x3c)),console[_0x6be89c(0x21f)](_0x1e2eaa),console[_0x6be89c(0x21f)]('─'[_0x6be89c(0x140)](0x3c));const _0x25a6e3=_0x517a69?_0x6be89c(0x163)+_0x3c3347+'\x27\x20and\x20run\x20workflow?':_0x6be89c(0x150)+_0x3c3347+_0x6be89c(0x1fd);if(!_0x43317e[_0x6be89c(0x1de)]){const _0x3f4e14=await confirmKey(_0x25a6e3);if(!_0x3f4e14)return console[_0x6be89c(0x21f)](_0x6be89c(0x208)),0x1;}const _0x435a41=_0x517a69?_0x6be89c(0x1d3):_0x6be89c(0x22b);await withSpinner(_0x435a41+_0x6be89c(0x234)+_0x3c3347+'\x27...',()=>_0x47555c[_0x6be89c(0x1c5)](),{'verbose':_0x43317e[_0x6be89c(0x200)]});const _0x2fd1c7=_0x517a69?'Created':_0x6be89c(0x1f9);console[_0x6be89c(0x21f)]('✔\x20'+_0x2fd1c7+_0x6be89c(0x234)+_0x3c3347+'\x27');}else console[_0x6be89c(0x21f)](_0x6be89c(0x239)+_0x3c3347+'\x27\x20is\x20up\x20to\x20date');}const _0x2ce620=await withSpinner(_0x6be89c(0x1dd)+_0x598abf+'\x27...',()=>_0x1a499e['segment'][_0x6be89c(0x1ec)](_0x598abf),{'verbose':_0x43317e['verbose']}),_0x397581=_0x2ce620[_0x6be89c(0x133)],_0x323468=getConsoleUrl(_0x43317e[_0x6be89c(0x142)],_0x6be89c(0x13d)+_0x397581['workflowId']+_0x6be89c(0x20e)+_0x397581['workflowSessionId']+_0x6be89c(0x15e)+_0x397581[_0x6be89c(0x1ae)]);return console[_0x6be89c(0x21f)](_0x6be89c(0x153)),console[_0x6be89c(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x233))+'\x20'+_0x397581[_0x6be89c(0x185)]),console['error']('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x136))+'\x20'+_0x397581[_0x6be89c(0x19c)]),console['error']('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x1c9))+'\x20'+_0x397581[_0x6be89c(0x184)]),console[_0x6be89c(0x21f)]('\x20\x20'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x13c))+'\x20'+_0x397581[_0x6be89c(0x1ae)]),console[_0x6be89c(0x21f)]('\x20\x20'+_0x323468),console['error']('\x0a'+a21_0x1bbe9b[_0x6be89c(0x20f)](_0x6be89c(0x14d))+_0x6be89c(0x1ad)+_0x397581[_0x6be89c(0x1ae)]+_0x6be89c(0x1da)),0x0;}}function a21_0x5d1e(){const _0x5bfdbd=['\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','✔\x20Renamed\x20directory\x20to\x20','customerGroup','✔\x20No\x20changes\x20-\x20\x27','coveragePercent','%)\x20','\x20Opening\x20','\x20--behavior\x20\x22','Attribute:','query','\x20\x20No\x20sample\x20data\x20available','Error:\x20Parent\x20segment\x20name\x20is\x20required','message','name','\x20Configuration\x20is\x20valid','utf-8','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20No\x20changes\x20-\x20','displaySummary','endsWith','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Available\x20behaviors:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Created','test','displayPreviewHints','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Master\x20Table','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Listing\x20fields\x20for\x20\x27','parentSegment','addBehaviors','data','segment:parent:fields','jobId','Status:','\x20=\x20','Creating\x20parent\x20segment\x20\x27','1476615ZkbLcA','format','schemaValid','Attempt:','/app/workflows/','allValid','parent_segments','repeat','.yaml','site','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','To\x20view\x20sample\x20data:','Options\x20(one\x20required):\x0a','displayBehaviorsStats','`\x20to\x20download\x20the\x20configuration\x20first','✔\x20Query\x20completed:\x20Processed\x20','previewParentYaml','displayMasterInfo','segment:parent:desc','execute','To\x20cancel:','displayPreviewResults','YAML\x20file:\x20','Apply\x20changes\x20to\x20\x27','Error:','output','\x0a✔\x20Workflow\x20started','text','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','scheduleOption','Fetching\x20current\x20configuration\x20for\x20\x27','isDirectory','Site:\x20','stats','start','Errors:','use','/attempt/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Join\x20on:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Create\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','behaviors','localeCompare','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x0aNo\x20sample\x20data\x20available','Listing\x20parent\x20segments\x20matching\x20\x27','displaySampleData','population','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Resolving\x20parent\x20segment\x20\x27','2188416tbMGpp','253486Kowcec','number','run','double','limit','/{name}.yml\x0a','4868316ltDevr','tdx\x20segment\x20parent\x20preview\x20','addBehaviorsFile','\x5c$&','web','foreignKey','sampleData','Behavior:','jsonl','Table:\x20','using\x20the\x20default\x20path:\x20','Parent\x20segment:\x20','getParentSQL','\x20Context\x20set:\x20','workflowSessionId','audienceId','toFixed','label','column','darwin','Available\x20attributes:','filter','addAttributesFile','processedRows','keys','SQL\x20query:\x0a','Preview:','\x20--attribute\x20\x22<name>\x22','\x27...','listFields','scheduleType','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','pushParentYaml','varchar','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','displayAttributesStats','\x20--interval\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','status','segment:parent:create','segment:parent:show','attributesFile','sort','master','.yml','\x0a⚠️\x20\x20Both\x20','customersWithEvents','information_schema','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','addAttributes','Error\x20reading\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','schemaError','Output\x20file:\x20','Pattern:\x20','\x20tdx\x20wf\x20attempt\x20','workflowAttemptId','red','No\x20parent\x20segments\x20found','all','segment:parent:pull','string','segment','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x0a⚠️\x20\x20Migrating:\x20','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','listParents','✔\x20Created\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','map','timezone','Source:','getParentFull','/app/dw/parentSegments/','\x20\x20\x20\x20-\x20','behavior','239270uVpPuZ','Columns:','apply','\x0aUsage:\x20tdx\x20ps\x20preview\x20','segment:parent:preview','validateParentYaml','Session:','displayColumns','database','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Behaviors','✔\x20Found\x20','customerGroupFile','setJobId','totalEvents','Join:','Creating','yellow','21tMPhRa','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','behaviorsFile','SELECT\x20*\x20FROM\x20(\x0a','win32','\x20kill','Options:\x0a','/\x20→\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','yes','length','\x20rows\x20','Updating\x20parent\x20segment\x20\x27','platform','segment:parent:list','532152VUHEsV','\x20is\x20already\x20up\x20to\x20date','List\x20parent\x20segments','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','interval','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','attributes','resolveParentId','runParent','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','👥\x20','displayValidateResults','Master\x20+\x20Attributes','green','description','2268888FVJbRE','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','Executing\x20parent\x20segment\x20query...','\x20[Job\x20ID:\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','unref','Updated','\x0aChanges\x20to\x20\x27','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','Coverage:','\x27\x20and\x20run\x20workflow?','stop','log','verbose','FINISHED','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','enriched','matchedCount','Fetching\x20SQL\x20for\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Rows:','Aborted.','\x0aChanges\x20to\x20apply\x20to\x20\x27','Analyzing\x20changes...','session','pullParentYaml','Listing\x20parent\x20segments...','/sessions/','dim','Show\x20parent\x20segment\x20schema\x20(column\x20types)','segment:parent:validate','List\x20available\x20fields\x20for\x20segmentation','Error:\x20--behavior\x20requires\x20a\x20name\x0a','trim','columns','Validate:','joinKey','json','table','replace','Events:','Overwrite\x20\x27','Name:\x20','-1d','error','match','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20rows)','cyan','\x20field','attribute','Get\x20SQL\x20query\x20for\x20parent\x20segment','bold','parent_segment','elapsedTimeMillis','Attributes','Updating','Database:\x20','segment:parent:sql','customerPercent','Found\x20YAML\x20file:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Error:\x20File\x20not\x20found:\x20','updateParent','Audience\x20ID:','\x20parent\x20segment\x20\x27','\x20parent\x20segment'];a21_0x5d1e=function(){return _0x5bfdbd;};return a21_0x5d1e();}export class ParentSegmentFieldsCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x134);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x212);async[a21_0x36ce6e(0x14c)](_0x53621c){const _0x5e72db=a21_0x36ce6e,{options:_0x5526d1,args:_0x3a1195,tdx:_0x204fcf}=_0x53621c,_0x10f958=_0x3a1195[0x0]||_0x5526d1[_0x5e72db(0x131)];if(!_0x10f958)return showParentSegmentNotSetError(_0x5e72db(0x164)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x5526d1[_0x5e72db(0x200)]&&(console['error'](_0x5e72db(0x159)+_0x5526d1['site']),console[_0x5e72db(0x21f)](_0x5e72db(0x181)+_0x10f958));const _0x1f39c3=await withSpinner(_0x5e72db(0x130)+_0x10f958+_0x5e72db(0x192),()=>_0x204fcf[_0x5e72db(0x1b4)][_0x5e72db(0x193)](_0x10f958),{'verbose':_0x5526d1[_0x5e72db(0x200)]}),_0x1099d6=_0x1f39c3['data'];console['error'](_0x5e72db(0x1ce)+_0x1099d6[_0x5e72db(0x1df)]+_0x5e72db(0x224)+(_0x1099d6[_0x5e72db(0x1df)]!==0x1?'s':''));if(_0x5526d1[_0x5e72db(0x218)]||_0x5526d1['jsonl'])return await handleSDKOutput(_0x1099d6,_0x5526d1),0x0;return displayFieldsHumanReadable(_0x1099d6,_0x10f958),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']='segment:parent:view';[a21_0x36ce6e(0x1f2)]='Show\x20parent\x20segment\x20details';async[a21_0x36ce6e(0x14c)](_0x569d0e){const _0x5e14e8=a21_0x36ce6e,{options:_0x22735d,args:_0x1edf6b,tdx:_0xbed9a2}=_0x569d0e,_0x51c8e3=_0x22735d,_0x53654c=_0x1edf6b[0x0]||_0x22735d['parentSegment'];if(!_0x53654c)return showParentSegmentNotSetError(_0x5e14e8(0x155)+_0x5e14e8(0x12d)+_0x5e14e8(0x1db)+_0x5e14e8(0x1cc)),0x1;_0x22735d[_0x5e14e8(0x200)]&&(console[_0x5e14e8(0x21f)](_0x5e14e8(0x159)+_0x22735d[_0x5e14e8(0x142)]),console[_0x5e14e8(0x21f)](_0x5e14e8(0x181)+_0x53654c));const _0x868689=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x53654c+_0x5e14e8(0x192),()=>_0xbed9a2['segment']['getParentFull'](_0x53654c),{'verbose':_0x22735d[_0x5e14e8(0x200)]}),_0xfa97b0=_0x868689[_0x5e14e8(0x133)];if(_0x51c8e3[_0x5e14e8(0x17a)]){const _0x472d92=getConsoleNextUrl(_0x51c8e3[_0x5e14e8(0x142)],_0x5e14e8(0x1c0)+_0xfa97b0['id']);return console[_0x5e14e8(0x21f)](a21_0x1bbe9b[_0x5e14e8(0x1f1)]('✔')+_0x5e14e8(0x114)+a21_0x1bbe9b[_0x5e14e8(0x223)](_0x472d92)),openBrowser(_0x472d92),0x0;}return await handleSingleObjectOutput(_0xfa97b0,_0x22735d),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x14b);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x210);async[a21_0x36ce6e(0x14c)](_0x19e4b5){const _0x58a979=a21_0x36ce6e,{options:_0x411f04,args:_0x3f4115,tdx:_0x23a18d}=_0x19e4b5,_0x38add8=_0x3f4115[0x0]||_0x411f04[_0x58a979(0x131)];if(!_0x38add8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x58a979(0x236)),0x1;_0x411f04[_0x58a979(0x200)]&&(console[_0x58a979(0x21f)](_0x58a979(0x159)+_0x411f04[_0x58a979(0x142)]),console[_0x58a979(0x21f)](_0x58a979(0x181)+_0x38add8));const _0x22f2e0=await withSpinner(_0x58a979(0x16e)+_0x38add8+_0x58a979(0x192),()=>_0x23a18d['segment'][_0x58a979(0x1eb)](_0x38add8),{'verbose':_0x411f04['verbose']}),_0x4fc03e=_0x22f2e0['data'],_0x113168=await withSpinner(_0x58a979(0x205)+_0x38add8+_0x58a979(0x192),()=>_0x23a18d[_0x58a979(0x1b4)][_0x58a979(0x182)](_0x4fc03e),{'verbose':_0x411f04[_0x58a979(0x200)]}),_0x470d02=await executeSchemaQuery(_0x113168[_0x58a979(0x133)],_0x23a18d,_0x411f04);return await handleQueryOutput(_0x470d02,_0x411f04),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x22d);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x226);async[a21_0x36ce6e(0x14c)](_0x3424d0){const _0x4665dc=a21_0x36ce6e,{options:_0x176432,args:_0xb3ca25,tdx:_0x54840e}=_0x3424d0,_0x114b8f=_0xb3ca25[0x0]||_0x176432[_0x4665dc(0x131)];if(!_0x114b8f)return showParentSegmentNotSetError(_0x4665dc(0x16d)+_0x4665dc(0x195)),0x1;_0x176432[_0x4665dc(0x200)]&&(console[_0x4665dc(0x21f)](_0x4665dc(0x159)+_0x176432[_0x4665dc(0x142)]),console['error'](_0x4665dc(0x181)+_0x114b8f));const _0xb01ee5=await withSpinner(_0x4665dc(0x16e)+_0x114b8f+'\x27...',()=>_0x54840e[_0x4665dc(0x1b4)]['resolveParentId'](_0x114b8f),{'verbose':_0x176432['verbose']}),_0x2a1903=_0xb01ee5[_0x4665dc(0x133)],_0x4668ae=await withSpinner(_0x4665dc(0x205)+_0x114b8f+_0x4665dc(0x192),()=>_0x54840e[_0x4665dc(0x1b4)][_0x4665dc(0x182)](_0x2a1903),{'verbose':_0x176432['verbose']}),_0x13a40f=_0x4668ae[_0x4665dc(0x133)];return _0x176432[_0x4665dc(0x13a)]===_0x4665dc(0x218)||_0x176432[_0x4665dc(0x13a)]===_0x4665dc(0x17e)?await handleSDKOutput([{'sql':_0x13a40f}],_0x176432):console['log'](_0x13a40f),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a21_0x36ce6e(0x11b)]=a21_0x36ce6e(0x19e);[a21_0x36ce6e(0x1f2)]=a21_0x36ce6e(0x198);async[a21_0x36ce6e(0x14c)](_0xe1f05d){const _0x5201e6=a21_0x36ce6e,{options:_0x509130,args:_0x4c6648,tdx:_0xcbb678}=_0xe1f05d,_0x5e5660=_0x4c6648[0x0]||_0x509130['parentSegment'];if(!_0x5e5660)return showParentSegmentNotSetError(_0x5201e6(0x19b)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x509130[_0x5201e6(0x200)]&&(console[_0x5201e6(0x21f)](_0x5201e6(0x159)+_0x509130[_0x5201e6(0x142)]),console[_0x5201e6(0x21f)]('Parent\x20segment:\x20'+_0x5e5660));const _0x55b538=await withSpinner(_0x5201e6(0x16e)+_0x5e5660+'\x27...',()=>_0xcbb678[_0x5201e6(0x1b4)][_0x5201e6(0x1eb)](_0x5e5660),{'verbose':_0x509130['verbose']}),_0x354162=_0x55b538[_0x5201e6(0x133)],_0x45a4da=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x5e5660+'\x27...',()=>_0xcbb678['segment'][_0x5201e6(0x182)](_0x354162),{'verbose':_0x509130[_0x5201e6(0x200)]});let _0x2a75a5=_0x45a4da[_0x5201e6(0x133)];const _0x5748ff=resolveLimit(_0x509130[_0x5201e6(0x174)],DEFAULT_DISPLAY_LIMIT),_0x13de24=/\bLIMIT\s+\d+/i[_0x5201e6(0x129)](_0x2a75a5);!_0x13de24&&(_0x2a75a5=_0x2a75a5[_0x5201e6(0x214)]()[_0x5201e6(0x21a)](/;+$/,''),_0x2a75a5=_0x5201e6(0x1d8)+_0x2a75a5+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x5748ff);_0x509130[_0x5201e6(0x200)]&&console[_0x5201e6(0x21f)](_0x5201e6(0x18f)+_0x2a75a5);const _0x4f0fee=await withProgressSpinner(_0x5201e6(0x1f5),async _0x179fb8=>{const _0x41d543=_0x5201e6,_0xd2a117=await _0xcbb678[_0x41d543(0x117)][_0x41d543(0x14c)](_0x2a75a5,{'catalog':'td','schema':_0x41d543(0x1a5),'onJobId':_0x5f020c=>{const _0x548b62=_0x41d543;_0x179fb8[_0x548b62(0x1d0)](_0x5f020c);}});return _0xd2a117;},{'verbose':_0x509130[_0x5201e6(0x200)]}),_0x424660=_0x4f0fee[_0x5201e6(0x133)],_0x4c449c=_0x424660[_0x5201e6(0x135)]?_0x5201e6(0x1f6)+_0x424660[_0x5201e6(0x135)]+']':'';return console[_0x5201e6(0x21f)](_0x5201e6(0x148)+_0x424660[_0x5201e6(0x15a)][_0x5201e6(0x18d)]['toLocaleString']()+_0x5201e6(0x1e0)+('in\x20'+formatElapsed(_0x424660[_0x5201e6(0x15a)][_0x5201e6(0x229)])+_0x4c449c)),await handleQueryOutput(_0x424660,_0x509130),0x0;}}
1
+ const a21_0x106a0d=a21_0x1807;(function(_0x24c54a,_0xc1c49c){const _0x5c2d02=a21_0x1807,_0x5f203f=_0x24c54a();while(!![]){try{const _0x55d9fb=parseInt(_0x5c2d02(0x242))/0x1+-parseInt(_0x5c2d02(0x214))/0x2*(parseInt(_0x5c2d02(0x2d2))/0x3)+parseInt(_0x5c2d02(0x2cf))/0x4+-parseInt(_0x5c2d02(0x202))/0x5+-parseInt(_0x5c2d02(0x2e2))/0x6*(parseInt(_0x5c2d02(0x2bf))/0x7)+parseInt(_0x5c2d02(0x227))/0x8+parseInt(_0x5c2d02(0x274))/0x9;if(_0x55d9fb===_0xc1c49c)break;else _0x5f203f['push'](_0x5f203f['shift']());}catch(_0x4f18f9){_0x5f203f['push'](_0x5f203f['shift']());}}}(a21_0x46e0,0x616cb));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a21_0xa509c0 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';function a21_0x46e0(){const _0x1766f6=['Listing\x20parent\x20segments\x20matching\x20\x27','parent_segments','Listing\x20fields\x20for\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','resolveParentId','✔\x20Updated\x20parent\x20segment\x20\x27','darwin','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Validating\x20configuration...','yellow','displaySummary','dirname','parent_segment','addAttributes','setJobId','replace','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20kill','Error:','updateParent','varchar','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','/sessions/','validateParentYaml','\x20parent\x20segment\x20\x27','\x20is\x20already\x20up\x20to\x20date','parentSegment','%)\x20','output','/\x20→\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','joinKey','Error\x20parsing\x20YAML:\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Show\x20parent\x20segment\x20schema\x20(column\x20types)','isDirectory','length','segment:parent:sql','/app/dw/parentSegments/','workflowSessionId','sampleData','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','customerGroupFile','Customers:','toFixed','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','segment:parent:show','trim','3573720IaLSpp','Error:\x20File\x20not\x20found:\x20','Creating','Errors:','✔\x20Renamed\x20directory\x20to\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Site:\x20','Validate:','string','match','columns','\x20Opening\x20','open','getParentSQL','\x5c$&','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20=\x20','1040186sssWvf','label','customerPercent','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Behaviors','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','elapsedTimeMillis','all','coveragePercent','stop','addAttributesFile','json','Fetching\x20sample\x20data...','jobId','Error:\x20--database\x20and\x20--table\x20are\x20required','/\x20directory.\x0a','errors','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','3802864Rjstro','✔\x20Found\x20','✔\x20No\x20changes\x20-\x20\x27','behaviors','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error\x20reading\x20file:\x20','matchedCount','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Fetching\x20parent\x20segment\x20\x27','audienceId','text','\x20field','scheduleType','information_schema','utf-8','in\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','attribute','To\x20cancel:','Updated','-1d','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Resolving\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','/attempt/','run','551957IhAgur','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','schemaValid','column','Found\x20YAML\x20file:\x20','.yaml','web','Available\x20attributes:','Show\x20parent\x20segment\x20details','site','map','population','error','listParents','displayColumns','jsonl','repeat','Join\x20on:','\x27\x20is\x20already\x20up\x20to\x20date','\x20rows)','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Join:','localeCompare','/app/workflows/','pushParentYaml','preview','Analyzing\x20changes...','Available\x20behaviors:','Master\x20+\x20Attributes','join','segment','yes','Attempt:','👥\x20','\x20No\x20changes\x20-\x20','Get\x20SQL\x20query\x20for\x20parent\x20segment','Behavior:','Session:','/\x20and\x20','previewParentYaml','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20--behavior\x20\x22<name>\x22','apply','displayMasterInfo','\x0aUsage:\x20tdx\x20ps\x20preview\x20','workflowId','List\x20parent\x20segments','segment:parent:validate','segment:parent:pull','endsWith','4202667JEtOcc','Enriched:','enriched','Rows:','processedRows','sort','getParentFull','\x0aNo\x20sample\x20data\x20available','To\x20view\x20sample\x20data:','master','customerGroup','bold','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','double','cyan','Fetching\x20SQL\x20for\x20\x27','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Preview:','data','toLocaleString','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','✔\x20Created\x20parent\x20segment\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Aborted.','segment:parent:create','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','using\x20the\x20default\x20path:\x20','\x27...','use','workflowAttemptId','Fetching\x20current\x20configuration\x20for\x20\x27','Updating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','behaviorsFile','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','log','rowCount','/{name}.yml\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','tdx\x20segment\x20parent\x20preview\x20','\x0a⚠️\x20\x20Migrating:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Coverage:','totalEvents','Apply\x20changes\x20to\x20\x27','number','`\x20to\x20download\x20the\x20configuration\x20first','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','schemaError','Create\x20parent\x20segment\x20\x27','\x20\x20\x20\x20-\x20','.yml','displayPreviewHints','segment:parent:update','test','verbose','green','\x20--attribute\x20\x22<name>\x22','✔\x20Query\x20completed:\x20Processed\x20','segment:parent:push','displaySampleData','createParent','platform','Parent\x20segment:\x20','Listing\x20parent\x20segments...','format','timezone','Error:\x20--behavior\x20requires\x20a\x20name\x0a','723506CwVAQb','/\x20directories\x20exist.','unref','displayAttributesStats','\x0aChanges\x20to\x20\x27','dim','\x20Context\x20set:\x20','Audience\x20ID:','segment:parent:list','interval','listFields','\x27\x20is\x20up\x20to\x20date','runParent','foreignKey','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','xdg-open','971872NqlOgu','keys','\x27\x20and\x20run\x20workflow?','3bXEWPS','red','table','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','execute','\x20Configuration\x20is\x20valid','attributesFile','SELECT\x20*\x20FROM\x20(\x0a','name','pullParentYaml','Source:','\x0a⚠️\x20\x20Both\x20','query','database','displayPreviewResults','6PWRGhw','Status:','displayBehaviorsStats','✘\x20Failed\x20to\x20rename\x20directory:\x20','description','message','start','behavior','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Executing\x20parent\x20segment\x20query...','addBehaviors','displayValidateResults','\x20tdx\x20wf\x20attempt\x20','scheduleOption','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Overwrite\x20\x27','YAML\x20file:\x20','attributes','segment:parent:view','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x20--attribute\x20\x22','\x20parent\x20segment','Events:','Options:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','filter','allValid','Updating','stats'];a21_0x46e0=function(){return _0x1766f6;};return a21_0x46e0();}import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x301366 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a21_0x106a0d(0x301),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x5ab562){const _0x5d4bdf=a21_0x106a0d,_0x224b29=process[_0x5d4bdf(0x2b9)],_0x16e2cd=_0x224b29===_0x5d4bdf(0x306)?_0x5d4bdf(0x20e):_0x224b29==='win32'?_0x5d4bdf(0x2e8):_0x5d4bdf(0x2ce);spawn(_0x16e2cd,[_0x5ab562],{'detached':!![],'stdio':'ignore'})[_0x5d4bdf(0x2c1)]();}function migrateLegacyDirectory(){const _0xc3b8e0=a21_0x106a0d;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x26ea83=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x26ea83[_0xc3b8e0(0x1f5)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a21_0x301366[_0xc3b8e0(0x309)](_0xc3b8e0(0x2de)+LEGACY_PARENT_SEGMENT_DIR+_0xc3b8e0(0x268)+PARENT_SEGMENT_DIR+_0xc3b8e0(0x2c0))),console[_0xc3b8e0(0x24e)](a21_0x301366[_0xc3b8e0(0x2c4)](_0xc3b8e0(0x207)+LEGACY_PARENT_SEGMENT_DIR+_0xc3b8e0(0x224))),![];console['error'](a21_0x301366[_0xc3b8e0(0x309)](_0xc3b8e0(0x2a0)+LEGACY_PARENT_SEGMENT_DIR+_0xc3b8e0(0x1ef)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0xc3b8e0(0x24e)](a21_0x301366[_0xc3b8e0(0x2b3)](_0xc3b8e0(0x206)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x785301){const _0x2f62b3=_0x785301 instanceof Error?_0x785301[_0xc3b8e0(0x2e7)]:String(_0x785301);return console[_0xc3b8e0(0x24e)](a21_0x301366[_0xc3b8e0(0x2d3)](_0xc3b8e0(0x2e5)+_0x2f62b3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x106a0d(0x241)](_0x391207){const _0x4b8f2a=a21_0x106a0d;return migrateLegacyDirectory(),super[_0x4b8f2a(0x241)](_0x391207);}}function resolveYamlFile(_0x4f7804){const _0x496f81=a21_0x106a0d;if(_0x4f7804[_0x496f81(0x273)](_0x496f81(0x2ae))||_0x4f7804[_0x496f81(0x273)](_0x496f81(0x247)))return _0x4f7804;return a21_0xa509c0[_0x496f81(0x25f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4f7804)+_0x496f81(0x2ae));}function formatProgressMessage(_0x3a7429){const _0x1c4ccd=a21_0x106a0d,_0x62a55a=_0x3a7429[_0x1c4ccd(0x20b)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x62a55a){const [,_0x113c6b,_0x4682cd,_0x15ee96='']=_0x62a55a;return a21_0x301366[_0x1c4ccd(0x2c4)](_0x113c6b+':')+'\x20'+_0x4682cd+a21_0x301366[_0x1c4ccd(0x2c4)](_0x15ee96);}return a21_0x301366[_0x1c4ccd(0x2c4)](_0x3a7429);}function showFileNotFoundError(_0x1c436e,_0x10db46){const _0x2e6709=a21_0x106a0d;console[_0x2e6709(0x24e)](a21_0x301366[_0x2e6709(0x2d3)](_0x2e6709(0x203)+_0x1c436e+'\x0a')),console[_0x2e6709(0x24e)](a21_0x301366[_0x2e6709(0x282)](_0x2e6709(0x1f0)+_0x10db46+_0x2e6709(0x2a9)));}function showParentSegmentNotSetError(_0x589214){const _0x6a4751=a21_0x106a0d;console['error'](a21_0x301366[_0x6a4751(0x309)](_0x6a4751(0x303))),console[_0x6a4751(0x24e)](_0x589214);}function a21_0x1807(_0x3fda62,_0x29be53){_0x3fda62=_0x3fda62-0x1de;const _0x46e0e5=a21_0x46e0();let _0x180771=_0x46e0e5[_0x3fda62];return _0x180771;}export class ParentSegmentListCommand extends BaseCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x2c7);[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x270);async[a21_0x106a0d(0x2d7)](_0x532968){const _0x21837d=a21_0x106a0d,{options:_0x1fdb06,args:_0x1a7cae,tdx:_0x536a6a}=_0x532968,_0x4f6aa8=_0x1a7cae[0x0];_0x1fdb06[_0x21837d(0x2b2)]&&(console[_0x21837d(0x24e)]('Site:\x20'+_0x1fdb06['site']),_0x4f6aa8&&console[_0x21837d(0x24e)]('Pattern:\x20'+_0x4f6aa8));const _0x4860d0=await withSpinner(_0x4f6aa8?_0x21837d(0x300)+_0x4f6aa8+_0x21837d(0x293):_0x21837d(0x2bb),()=>_0x536a6a[_0x21837d(0x260)][_0x21837d(0x24f)](),{'verbose':_0x1fdb06[_0x21837d(0x2b2)]});let _0x38ec47=_0x4860d0[_0x21837d(0x287)];if(_0x4f6aa8){const _0x282c7f=_0x4f6aa8[_0x21837d(0x1e1)](/[.+^${}()|[\]\\]/g,_0x21837d(0x210))[_0x21837d(0x1e1)](/\*/g,'.*')[_0x21837d(0x1e1)](/\?/g,'.'),_0x6e2ff=new RegExp('^'+_0x282c7f+'$','i');_0x38ec47=_0x38ec47[_0x21837d(0x2fc)](_0xe77ef0=>_0x6e2ff[_0x21837d(0x2b1)](_0xe77ef0[_0x21837d(0x2f3)]['name']));}_0x38ec47[_0x21837d(0x279)]((_0x46a078,_0x69a8c0)=>_0x46a078[_0x21837d(0x2f3)]['name'][_0x21837d(0x258)](_0x69a8c0['attributes'][_0x21837d(0x2db)])),console[_0x21837d(0x24e)]('✔\x20Found\x20'+_0x38ec47[_0x21837d(0x1f6)]+_0x21837d(0x2f7)+(_0x38ec47[_0x21837d(0x1f6)]!==0x1?'s':''));const _0x4eeb1e=_0x230f87=>{const _0x3507bc=_0x21837d;return getConsoleNextUrl(_0x1fdb06[_0x3507bc(0x24b)],_0x3507bc(0x1f8)+_0x230f87);};if(_0x1fdb06[_0x21837d(0x2bc)]==='json'||_0x1fdb06[_0x21837d(0x2bc)]===_0x21837d(0x251)){const _0x208eb=_0x38ec47['map'](_0x5c349c=>({..._0x5c349c,'url':_0x4eeb1e(_0x5c349c['id'])}));await handleSDKOutput(_0x208eb,_0x1fdb06);}else{if(_0x38ec47[_0x21837d(0x1f6)]===0x0)_0x4f6aa8?console[_0x21837d(0x29b)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x4f6aa8):console[_0x21837d(0x29b)]('No\x20parent\x20segments\x20found');else for(const _0x2dc71e of _0x38ec47){const _0x41b993=_0x2dc71e[_0x21837d(0x2f3)][_0x21837d(0x24d)]?a21_0x301366[_0x21837d(0x2c4)]('\x20('+formatRows(_0x2dc71e[_0x21837d(0x2f3)][_0x21837d(0x24d)])+')'):'',_0x2006a0=hyperlink(_0x2dc71e[_0x21837d(0x2f3)][_0x21837d(0x2db)],_0x4eeb1e(_0x2dc71e['id']));console[_0x21837d(0x29b)](_0x21837d(0x263)+_0x2006a0+_0x41b993);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x28f);[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x29a);async[a21_0x106a0d(0x2d7)](_0x35b00d){const _0x31634b=a21_0x106a0d,{options:_0x51f33a,args:_0x56b9a4,tdx:_0x16bf95}=_0x35b00d;console[_0x31634b(0x24e)](_0x31634b(0x307)+'\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 _0x5848ad=_0x51f33a;if(_0x56b9a4['length']===0x0)return console[_0x31634b(0x24e)](a21_0x301366[_0x31634b(0x2d3)](_0x31634b(0x29e))),console[_0x31634b(0x24e)](_0x31634b(0x285)),0x1;const _0x1922e0=_0x56b9a4[0x0];if(!_0x5848ad['database']||!_0x5848ad[_0x31634b(0x2d4)])return console[_0x31634b(0x24e)](_0x31634b(0x223)),console[_0x31634b(0x24e)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x5848ad[_0x31634b(0x2b2)]&&(console[_0x31634b(0x24e)](_0x31634b(0x208)+_0x5848ad['site']),console['error']('Name:\x20'+_0x1922e0),console['error']('Database:\x20'+_0x5848ad[_0x31634b(0x2e0)]),console[_0x31634b(0x24e)]('Table:\x20'+_0x5848ad[_0x31634b(0x2d4)]));const _0x3ebbdc=await loadJSONFromOptions(_0x5848ad[_0x31634b(0x2f3)],_0x5848ad[_0x31634b(0x2d9)]),_0x591b83=await loadJSONFromOptions(_0x5848ad[_0x31634b(0x22a)],_0x5848ad[_0x31634b(0x299)]),_0x5d1a02=await loadJSONFromOptions(_0x5848ad[_0x31634b(0x27e)],_0x5848ad[_0x31634b(0x1fc)]),_0x4f44bf={'name':_0x1922e0,'description':_0x5848ad['description'],'scheduleType':_0x5848ad[_0x31634b(0x233)],'scheduleOption':_0x5848ad[_0x31634b(0x2ef)],'timezone':_0x5848ad[_0x31634b(0x2bd)],'master':{'parentDatabaseName':_0x5848ad[_0x31634b(0x2e0)],'parentTableName':_0x5848ad[_0x31634b(0x2d4)]},'attributes':_0x3ebbdc,'behaviors':_0x591b83,'customerGroup':_0x5d1a02},_0xd31e36=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x1922e0+_0x31634b(0x293),()=>_0x16bf95[_0x31634b(0x260)][_0x31634b(0x2b8)](_0x4f44bf),{'verbose':_0x51f33a['verbose']}),_0x9a01fc=_0xd31e36[_0x31634b(0x287)];return console[_0x31634b(0x24e)](_0x31634b(0x28c)+_0x9a01fc[_0x31634b(0x2db)]+'\x27\x20with\x20ID:\x20'+_0x9a01fc['id']),await handleSDKOutput([_0x9a01fc],_0x51f33a),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x2b0);[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x1f3);async[a21_0x106a0d(0x2d7)](_0x4afa12){const _0x502ddb=a21_0x106a0d,{options:_0x380607,args:_0x34c06c,tdx:_0x4a07db}=_0x4afa12;console[_0x502ddb(0x24e)]('\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'+_0x502ddb(0x2cd));const _0x542581=_0x380607;if(_0x34c06c[_0x502ddb(0x1f6)]===0x0)return console['error'](a21_0x301366[_0x502ddb(0x2d3)](_0x502ddb(0x29e))),console[_0x502ddb(0x24e)](_0x502ddb(0x2fa)),0x1;const _0x4b9201=_0x34c06c[0x0];_0x542581[_0x502ddb(0x2b2)]&&(console['error'](_0x502ddb(0x208)+_0x542581[_0x502ddb(0x24b)]),console[_0x502ddb(0x24e)](_0x502ddb(0x2ba)+_0x4b9201));const _0x4c207b=await withSpinner(_0x502ddb(0x296)+_0x4b9201+'\x27...',()=>_0x4a07db[_0x502ddb(0x260)][_0x502ddb(0x27a)](_0x4b9201),{'verbose':_0x542581[_0x502ddb(0x2b2)]}),_0x262ee3=_0x4c207b['data'],_0xa1ea67=await loadJSONFromOptions(_0x542581[_0x502ddb(0x1df)],_0x542581[_0x502ddb(0x21f)]),_0x3ce206=await loadJSONFromOptions(_0x542581[_0x502ddb(0x2ec)],_0x542581['addBehaviorsFile']),_0x4f3d9f={'name':_0x262ee3[_0x502ddb(0x2db)],'description':_0x542581[_0x502ddb(0x2e6)]!==undefined?_0x542581[_0x502ddb(0x2e6)]:_0x262ee3[_0x502ddb(0x2e6)],'scheduleType':_0x542581[_0x502ddb(0x233)]!==undefined?_0x542581['scheduleType']:_0x262ee3[_0x502ddb(0x233)],'scheduleOption':_0x542581[_0x502ddb(0x2ef)]!==undefined?_0x542581[_0x502ddb(0x2ef)]:_0x262ee3[_0x502ddb(0x2ef)],'timezone':_0x542581['timezone']!==undefined?_0x542581[_0x502ddb(0x2bd)]:_0x262ee3['timezone'],'master':_0x262ee3['master'],'attributes':_0xa1ea67?[..._0x262ee3['attributes']||[],..._0xa1ea67]:_0x262ee3[_0x502ddb(0x2f3)],'behaviors':_0x3ce206?[..._0x262ee3[_0x502ddb(0x22a)]||[],..._0x3ce206]:_0x262ee3[_0x502ddb(0x22a)],'customerGroup':_0x262ee3[_0x502ddb(0x27e)]},_0x32d210=await withSpinner(_0x502ddb(0x297)+_0x4b9201+_0x502ddb(0x293),()=>_0x4a07db[_0x502ddb(0x260)][_0x502ddb(0x1e5)](_0x4b9201,_0x4f3d9f),{'verbose':_0x542581[_0x502ddb(0x2b2)]}),_0x3d238a=_0x32d210['data'];return console[_0x502ddb(0x24e)](_0x502ddb(0x305)+_0x3d238a['name']+'\x27'),await handleSDKOutput([_0x3d238a],_0x542581),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x272);[a21_0x106a0d(0x2e6)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a21_0x106a0d(0x2d7)](_0x5ae186){const _0x483360=a21_0x106a0d,{options:_0x567aac,args:_0x296cbd,tdx:_0x1dfaf6}=_0x5ae186,_0x57dba7=_0x567aac,_0x2656cf=_0x296cbd[0x0]||_0x567aac[_0x483360(0x1ec)];if(!_0x2656cf)return showParentSegmentNotSetError(_0x483360(0x23d)+_0x483360(0x2a2)),0x1;if(_0x57dba7[_0x483360(0x294)]&&_0x57dba7[_0x483360(0x1ee)])return console[_0x483360(0x24e)](a21_0x301366[_0x483360(0x2d3)](_0x483360(0x2ea))),console[_0x483360(0x24e)](a21_0x301366['dim'](_0x483360(0x290))),console[_0x483360(0x24e)](a21_0x301366[_0x483360(0x2c4)](_0x483360(0x292)+PARENT_SEGMENT_DIR+_0x483360(0x29d))),console[_0x483360(0x24e)](a21_0x301366[_0x483360(0x282)](_0x483360(0x238))),0x1;const _0x51e412=_0x57dba7[_0x483360(0x1ee)]||a21_0xa509c0[_0x483360(0x25f)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x2656cf)+'.yml');_0x57dba7[_0x483360(0x2b2)]&&(console[_0x483360(0x24e)]('Site:\x20'+_0x57dba7[_0x483360(0x24b)]),console[_0x483360(0x24e)]('Parent\x20segment:\x20'+_0x2656cf),console[_0x483360(0x24e)]('Output\x20file:\x20'+_0x51e412));const _0x803ab6=await withSpinner(_0x483360(0x22f)+_0x2656cf+'\x27...',()=>_0x1dfaf6[_0x483360(0x260)][_0x483360(0x2dc)](_0x2656cf),{'verbose':_0x57dba7['verbose']}),_0x3df178=_0x803ab6[_0x483360(0x287)];if(existsSync(_0x51e412)){const _0x47aac8=readFileSync(_0x51e412,_0x483360(0x235)),_0x4405e3=generateDiff(_0x47aac8,_0x3df178);if(!hasChanges(_0x4405e3))console[_0x483360(0x24e)](a21_0x301366[_0x483360(0x2b3)]('✔')+_0x483360(0x264)+a21_0x301366['cyan'](_0x51e412)+_0x483360(0x1eb));else{console[_0x483360(0x24e)](_0x483360(0x2c3)+_0x51e412+'\x27:'),console[_0x483360(0x24e)]('─'[_0x483360(0x252)](0x3c)),console[_0x483360(0x24e)](formatDiffWithColors(_0x4405e3)),console['error']('─'[_0x483360(0x252)](0x3c));if(!_0x57dba7[_0x483360(0x261)]){const _0x4a7a90=await confirmKey(_0x483360(0x2f1)+_0x51e412+'\x27?');if(!_0x4a7a90)return console['error'](_0x483360(0x28e)),0x1;}writeFileSync(_0x51e412,_0x3df178,_0x483360(0x235)),console[_0x483360(0x24e)](a21_0x301366[_0x483360(0x2b3)]('✔')+_0x483360(0x2d6)+a21_0x301366[_0x483360(0x282)](_0x51e412));}}else{const _0x1c3299=a21_0xa509c0[_0x483360(0x30b)](_0x51e412);!existsSync(_0x1c3299)&&mkdirSync(_0x1c3299,{'recursive':!![]}),writeFileSync(_0x51e412,_0x3df178,_0x483360(0x235)),console['error'](a21_0x301366[_0x483360(0x2b3)]('✔')+_0x483360(0x2d6)+a21_0x301366[_0x483360(0x282)](_0x51e412));}return saveSessionContext({'parent_segment':_0x2656cf},_0x57dba7['session']),console[_0x483360(0x24e)](a21_0x301366[_0x483360(0x2b3)]('✔')+_0x483360(0x2c5)+a21_0x301366[_0x483360(0x2c4)](_0x483360(0x1de))+_0x483360(0x213)+a21_0x301366[_0x483360(0x282)](_0x2656cf)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x2b6);[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x280);async[a21_0x106a0d(0x2d7)](_0x494f0a){const _0x1a4b30=a21_0x106a0d,{options:_0x4443ee,args:_0x3f6266,tdx:_0x2afbae}=_0x494f0a,_0x155e4e=_0x4443ee,_0x57fe7b=_0x3f6266[0x0]||_0x4443ee[_0x1a4b30(0x1ec)];if(!_0x57fe7b)return showParentSegmentNotSetError(_0x1a4b30(0x217)+_0x1a4b30(0x1fb)),0x1;const _0x312e2c=resolveYamlFile(_0x57fe7b);if(!existsSync(_0x312e2c))return showFileNotFoundError(_0x312e2c,_0x57fe7b),0x1;_0x155e4e['verbose']&&(console['error'](_0x1a4b30(0x208)+_0x155e4e[_0x1a4b30(0x24b)]),console[_0x1a4b30(0x24e)]('YAML\x20file:\x20'+_0x312e2c));let _0x53bd39;try{_0x53bd39=readFileSync(_0x312e2c,_0x1a4b30(0x235));}catch(_0x4c4112){const _0x41e2a3=_0x4c4112 instanceof Error?_0x4c4112[_0x1a4b30(0x2e7)]:String(_0x4c4112);return console[_0x1a4b30(0x24e)](_0x1a4b30(0x22c)+_0x41e2a3),0x1;}const _0x98f45c=await withSpinner(_0x1a4b30(0x25c),()=>_0x2afbae[_0x1a4b30(0x260)]['pushParentYaml'](_0x53bd39),{'verbose':_0x155e4e[_0x1a4b30(0x2b2)]}),_0x1a8739=_0x98f45c[_0x1a4b30(0x287)],{isNew:_0x34bee1,name:_0x7b966e,hasChanges:_0x2d4b1b,diffFormatted:_0x391470}=_0x1a8739;if(!_0x2d4b1b)return console['error'](_0x1a4b30(0x229)+_0x7b966e+_0x1a4b30(0x254)),0x0;_0x34bee1?console[_0x1a4b30(0x24e)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x7b966e+'\x27:'):console[_0x1a4b30(0x24e)](_0x1a4b30(0x289)+_0x7b966e+'\x27:');console['error']('─'[_0x1a4b30(0x252)](0x3c)),console['error'](_0x391470),console['error']('─'[_0x1a4b30(0x252)](0x3c));const _0x42a1ec=_0x34bee1?_0x1a4b30(0x2ac)+_0x7b966e+'\x27?':_0x1a4b30(0x2a7)+_0x7b966e+'\x27?';if(!_0x155e4e['yes']){const _0x3229af=await confirmKey(_0x42a1ec);if(!_0x3229af)return console['error'](_0x1a4b30(0x28e)),0x1;}const _0x461e6b=_0x34bee1?_0x1a4b30(0x204):'Updating',_0x545a3e=await withSpinner(_0x461e6b+_0x1a4b30(0x1ea)+_0x7b966e+'\x27...',()=>_0x1a8739['apply'](),{'verbose':_0x155e4e[_0x1a4b30(0x2b2)]}),_0x5492f4=_0x545a3e[_0x1a4b30(0x287)],_0x1e2e10=getConsoleNextUrl(_0x155e4e[_0x1a4b30(0x24b)],_0x1a4b30(0x1f8)+_0x5492f4['id']),_0x14ad1b=_0x34bee1?'Created':_0x1a4b30(0x23b);return console[_0x1a4b30(0x24e)]('✔\x20'+_0x14ad1b+'\x20parent\x20segment\x20\x27'+_0x5492f4['name']+'\x27'),console[_0x1a4b30(0x24e)]('\x20\x20'+_0x1e2e10),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x271);[a21_0x106a0d(0x2e6)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x279610){const _0x5b3de8=a21_0x106a0d,{options:_0x376d81,args:_0x529451,tdx:_0x1a9921}=_0x279610,_0x674d7e=_0x376d81,_0x1b1965=_0x529451[0x0]||_0x376d81['parentSegment'];if(!_0x1b1965)return showParentSegmentNotSetError(_0x5b3de8(0x28b)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x5b3de8(0x23f)+_0x5b3de8(0x212)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x353e51=resolveYamlFile(_0x1b1965);if(!existsSync(_0x353e51))return showFileNotFoundError(_0x353e51,_0x1b1965),0x1;_0x674d7e['verbose']&&(console[_0x5b3de8(0x24e)](_0x5b3de8(0x208)+_0x674d7e[_0x5b3de8(0x24b)]),console['error'](_0x5b3de8(0x2f2)+_0x353e51));let _0x3d8982;try{_0x3d8982=readFileSync(_0x353e51,'utf-8');}catch(_0x19e36d){const _0x50231c=_0x19e36d instanceof Error?_0x19e36d[_0x5b3de8(0x2e7)]:String(_0x19e36d);return console[_0x5b3de8(0x24e)]('Error\x20reading\x20file:\x20'+_0x50231c),0x1;}const _0x38cb4e=createCommandSpinner(a21_0x301366['dim'](_0x5b3de8(0x308)),{'verbose':_0x674d7e[_0x5b3de8(0x2b2)]});_0x38cb4e[_0x5b3de8(0x2e8)]();const _0x29e7b6={'onProgress':_0x39199b=>{const _0x3add7b=_0x5b3de8;_0x38cb4e[_0x3add7b(0x231)]=formatProgressMessage(_0x39199b);}};if(_0x674d7e[_0x5b3de8(0x27d)])_0x29e7b6['master']=!![];if(_0x674d7e['enriched'])_0x29e7b6[_0x5b3de8(0x276)]=!![];_0x674d7e[_0x5b3de8(0x239)]&&(_0x29e7b6[_0x5b3de8(0x239)]=_0x674d7e['attribute']);_0x674d7e[_0x5b3de8(0x2e9)]&&(_0x29e7b6['behavior']=_0x674d7e['behavior']);if(_0x674d7e[_0x5b3de8(0x2c8)])_0x29e7b6['interval']=_0x674d7e[_0x5b3de8(0x2c8)];let _0x1dc8da;try{_0x1dc8da=await _0x1a9921[_0x5b3de8(0x260)][_0x5b3de8(0x1e9)](_0x3d8982,_0x29e7b6),_0x38cb4e[_0x5b3de8(0x21e)]();}catch(_0x5bf744){_0x38cb4e['stop']();throw _0x5bf744;}const _0x1b6878=_0x674d7e[_0x5b3de8(0x2c8)]||_0x5b3de8(0x23c);return this[_0x5b3de8(0x2ed)](_0x1dc8da,_0x29e7b6,_0x353e51,_0x1b6878),_0x1dc8da[_0x5b3de8(0x2fd)]?0x0:0x1;}[a21_0x106a0d(0x2ed)](_0x3e066c,_0x4023e8,_0x491146,_0x2a9f1f){const _0x6380b9=a21_0x106a0d;console[_0x6380b9(0x24e)]('\x0a'+a21_0x301366['bold'](_0x6380b9(0x209))+'\x20'+_0x3e066c[_0x6380b9(0x2db)]),console[_0x6380b9(0x24e)]('═'['repeat'](0x3c)),this[_0x6380b9(0x26d)](_0x3e066c);if(typeof _0x4023e8[_0x6380b9(0x239)]===_0x6380b9(0x20a)){this['displayAttributesStats'](_0x3e066c),this[_0x6380b9(0x30a)](_0x3e066c),this[_0x6380b9(0x2af)](_0x491146,_0x2a9f1f,_0x6380b9(0x239),_0x4023e8[_0x6380b9(0x239)]);return;}if(_0x4023e8['attribute']===!![]){this[_0x6380b9(0x2c2)](_0x3e066c),this['displaySummary'](_0x3e066c),this[_0x6380b9(0x2af)](_0x491146,_0x2a9f1f,_0x6380b9(0x2f3));return;}if(typeof _0x4023e8['behavior']===_0x6380b9(0x20a)){this[_0x6380b9(0x2e4)](_0x3e066c,_0x2a9f1f),this[_0x6380b9(0x30a)](_0x3e066c),this[_0x6380b9(0x2af)](_0x491146,_0x2a9f1f,_0x6380b9(0x2e9),_0x4023e8['behavior']);return;}if(_0x4023e8[_0x6380b9(0x2e9)]===!![]){this[_0x6380b9(0x2e4)](_0x3e066c,_0x2a9f1f),this[_0x6380b9(0x30a)](_0x3e066c),this[_0x6380b9(0x2af)](_0x491146,_0x2a9f1f,'behaviors');return;}this[_0x6380b9(0x2c2)](_0x3e066c),this[_0x6380b9(0x2e4)](_0x3e066c,_0x2a9f1f),this[_0x6380b9(0x30a)](_0x3e066c),this['displayPreviewHints'](_0x491146,_0x2a9f1f,_0x6380b9(0x21c));}[a21_0x106a0d(0x2af)](_0x1b5079,_0x354d8b,_0x1db451,_0xcc30ef){const _0xbb0ae1=a21_0x106a0d;console[_0xbb0ae1(0x24e)]('\x0a'+a21_0x301366[_0xbb0ae1(0x2c4)](_0xbb0ae1(0x27c)));const _0x3f4c10=_0x354d8b!==_0xbb0ae1(0x23c)?'\x20--interval\x20'+_0x354d8b:'';if(_0x1db451===_0xbb0ae1(0x239)&&_0xcc30ef)console[_0xbb0ae1(0x24e)]('\x20\x20'+a21_0x301366[_0xbb0ae1(0x2c4)](_0xbb0ae1(0x29f)+_0x1b5079+_0xbb0ae1(0x2f6)+_0xcc30ef+'\x22'+_0x3f4c10));else{if(_0x1db451===_0xbb0ae1(0x2e9)&&_0xcc30ef)console[_0xbb0ae1(0x24e)]('\x20\x20'+a21_0x301366[_0xbb0ae1(0x2c4)](_0xbb0ae1(0x29f)+_0x1b5079+'\x20--behavior\x20\x22'+_0xcc30ef+'\x22'+_0x3f4c10));else(_0x1db451==='attributes'||_0x1db451===_0xbb0ae1(0x21c))&&console[_0xbb0ae1(0x24e)]('\x20\x20'+a21_0x301366['dim'](_0xbb0ae1(0x29f)+_0x1b5079+_0xbb0ae1(0x2b4)+_0x3f4c10));}(_0x1db451===_0xbb0ae1(0x22a)||_0x1db451===_0xbb0ae1(0x21c))&&console[_0xbb0ae1(0x24e)]('\x20\x20'+a21_0x301366[_0xbb0ae1(0x2c4)](_0xbb0ae1(0x29f)+_0x1b5079+_0xbb0ae1(0x26b)+_0x3f4c10)),_0x1db451===_0xbb0ae1(0x21c)&&console[_0xbb0ae1(0x24e)]('\x20\x20'+a21_0x301366[_0xbb0ae1(0x2c4)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1b5079+'\x20--enriched'+_0x3f4c10));}['displayMasterInfo'](_0x331c91){const _0x252fad=a21_0x106a0d,{master:_0x136c94}=_0x331c91,_0x4f2c2e=_0x136c94[_0x252fad(0x244)]?a21_0x301366[_0x252fad(0x2b3)]('✔'):a21_0x301366['red']('✘');console[_0x252fad(0x24e)]('\x0a'+a21_0x301366[_0x252fad(0x2c4)]('Master\x20Table')),console['error'](_0x4f2c2e+'\x20'+a21_0x301366['bold'](_0x136c94['database']+'.'+_0x136c94['table'])),_0x136c94[_0x252fad(0x244)]?_0x136c94[_0x252fad(0x29c)]!==undefined&&console['error']('\x20\x20'+a21_0x301366[_0x252fad(0x2c4)](_0x252fad(0x277))+'\x20'+a21_0x301366[_0x252fad(0x282)](formatRows(_0x136c94[_0x252fad(0x29c)]))):console[_0x252fad(0x24e)]('\x20\x20'+a21_0x301366[_0x252fad(0x2d3)]('Error:')+'\x20'+_0x136c94[_0x252fad(0x2ab)]);}[a21_0x106a0d(0x2c2)](_0x3e008b){const _0x17efc4=a21_0x106a0d;if(_0x3e008b[_0x17efc4(0x2f3)][_0x17efc4(0x1f6)]===0x0)return;console[_0x17efc4(0x24e)]('\x0a'+a21_0x301366[_0x17efc4(0x2c4)]('Attributes'));for(const _0x31cd0a of _0x3e008b['attributes']){const _0xffb3bf=_0x31cd0a['schemaValid']?a21_0x301366[_0x17efc4(0x2b3)]('✔'):a21_0x301366[_0x17efc4(0x2d3)]('✘');let _0x3ad7fa='';if(_0x31cd0a[_0x17efc4(0x244)]&&_0x31cd0a[_0x17efc4(0x22d)]!==undefined&&_0x31cd0a['coveragePercent']!==undefined){const _0xc2df83=_0x31cd0a[_0x17efc4(0x21d)][_0x17efc4(0x1fe)](0x1),_0xd49b95=_0x31cd0a['coveragePercent']>=0x50?a21_0x301366[_0x17efc4(0x2b3)]:_0x31cd0a['coveragePercent']>=0x32?a21_0x301366[_0x17efc4(0x309)]:a21_0x301366[_0x17efc4(0x2d3)];_0x3ad7fa='\x20'+a21_0x301366[_0x17efc4(0x2c4)](_0x17efc4(0x2a5))+'\x20'+_0xd49b95(_0xc2df83+'%')+'\x20('+formatRows(_0x31cd0a[_0x17efc4(0x22d)])+_0x17efc4(0x255);}console[_0x17efc4(0x24e)](_0xffb3bf+'\x20'+a21_0x301366[_0x17efc4(0x27f)](_0x31cd0a[_0x17efc4(0x2db)])+_0x3ad7fa),console[_0x17efc4(0x24e)]('\x20\x20'+a21_0x301366[_0x17efc4(0x2c4)](_0x17efc4(0x2dd))+'\x20'+a21_0x301366[_0x17efc4(0x27f)](_0x31cd0a[_0x17efc4(0x2e0)]+'.'+_0x31cd0a[_0x17efc4(0x2d4)]));const _0x557c0b=_0x31cd0a[_0x17efc4(0x1f1)]===_0x31cd0a['foreignKey']?a21_0x301366[_0x17efc4(0x2c4)](_0x17efc4(0x253))+'\x20'+_0x31cd0a[_0x17efc4(0x1f1)]:a21_0x301366['dim'](_0x17efc4(0x257))+'\x20'+_0x31cd0a['joinKey']+_0x17efc4(0x213)+_0x31cd0a[_0x17efc4(0x2cc)];console[_0x17efc4(0x24e)]('\x20\x20'+_0x557c0b),console['error']('\x20\x20'+a21_0x301366[_0x17efc4(0x2c4)]('Columns:')),this[_0x17efc4(0x250)](_0x31cd0a[_0x17efc4(0x20c)]),!_0x31cd0a[_0x17efc4(0x244)]&&console[_0x17efc4(0x24e)]('\x20\x20'+a21_0x301366[_0x17efc4(0x2d3)]('Error:')+'\x20'+_0x31cd0a[_0x17efc4(0x2ab)]);}}[a21_0x106a0d(0x2e4)](_0x51a81f,_0x2e85d9){const _0x1cda81=a21_0x106a0d;if(_0x51a81f[_0x1cda81(0x22a)][_0x1cda81(0x1f6)]===0x0)return;console[_0x1cda81(0x24e)]('\x0a'+a21_0x301366['dim'](_0x1cda81(0x219))+'\x20'+a21_0x301366['dim']('('+_0x2e85d9+')'));for(const _0x4ea462 of _0x51a81f[_0x1cda81(0x22a)]){const _0x42c7ad=_0x4ea462[_0x1cda81(0x244)]?a21_0x301366[_0x1cda81(0x2b3)]('✔'):a21_0x301366['red']('✘');let _0x22a213='';if(_0x4ea462[_0x1cda81(0x244)]&&_0x4ea462['customersWithEvents']!==undefined&&_0x4ea462[_0x1cda81(0x2a6)]!==undefined){const _0x9d328c=_0x4ea462['customerPercent']?.[_0x1cda81(0x1fe)](0x1)||'?',_0x2032e6=(_0x4ea462[_0x1cda81(0x216)]??0x0)>=0x32?a21_0x301366[_0x1cda81(0x2b3)]:(_0x4ea462[_0x1cda81(0x216)]??0x0)>=0x14?a21_0x301366[_0x1cda81(0x309)]:a21_0x301366[_0x1cda81(0x2d3)];_0x22a213='\x20'+a21_0x301366['dim'](_0x1cda81(0x1fd))+'\x20'+_0x2032e6(formatRows(_0x4ea462['customersWithEvents']))+'\x20('+_0x9d328c+_0x1cda81(0x1ed)+a21_0x301366[_0x1cda81(0x2c4)](_0x1cda81(0x2f8))+'\x20'+a21_0x301366['cyan'](formatRows(_0x4ea462[_0x1cda81(0x2a6)]));}console['error'](_0x42c7ad+'\x20'+a21_0x301366['bold'](_0x4ea462[_0x1cda81(0x2db)])+_0x22a213),console[_0x1cda81(0x24e)]('\x20\x20'+a21_0x301366[_0x1cda81(0x2c4)](_0x1cda81(0x2dd))+'\x20'+a21_0x301366[_0x1cda81(0x27f)](_0x4ea462[_0x1cda81(0x2e0)]+'.'+_0x4ea462['table']));const _0x1d92d9=_0x4ea462['joinKey']===_0x4ea462[_0x1cda81(0x2cc)]?a21_0x301366[_0x1cda81(0x2c4)]('Join\x20on:')+'\x20'+_0x4ea462[_0x1cda81(0x1f1)]:a21_0x301366[_0x1cda81(0x2c4)](_0x1cda81(0x257))+'\x20'+_0x4ea462[_0x1cda81(0x1f1)]+'\x20=\x20'+_0x4ea462[_0x1cda81(0x2cc)];console[_0x1cda81(0x24e)]('\x20\x20'+_0x1d92d9),console[_0x1cda81(0x24e)]('\x20\x20'+a21_0x301366[_0x1cda81(0x2c4)]('Columns:')),this['displayColumns'](_0x4ea462['columns']),!_0x4ea462[_0x1cda81(0x244)]&&console[_0x1cda81(0x24e)]('\x20\x20'+a21_0x301366[_0x1cda81(0x2d3)](_0x1cda81(0x1e4))+'\x20'+_0x4ea462[_0x1cda81(0x2ab)]);}}[a21_0x106a0d(0x250)](_0x27d941){const _0x435127=a21_0x106a0d;for(const _0x1777d5 of _0x27d941){_0x1777d5['label']===_0x1777d5[_0x435127(0x245)]||_0x1777d5[_0x435127(0x245)]==='*'?console['error'](_0x435127(0x2ad)+_0x1777d5['label']):console[_0x435127(0x24e)](_0x435127(0x2ad)+_0x1777d5[_0x435127(0x215)]+'\x20'+a21_0x301366[_0x435127(0x2c4)]('('+_0x1777d5[_0x435127(0x245)]+')'));}}[a21_0x106a0d(0x30a)](_0xaf5409){const _0x358e8b=a21_0x106a0d;console[_0x358e8b(0x24e)]('─'['repeat'](0x3c));if(_0xaf5409[_0x358e8b(0x225)]['length']>0x0){console[_0x358e8b(0x24e)]('\x0a'+a21_0x301366['red'](_0x358e8b(0x205)));for(const _0x5d3de5 of _0xaf5409[_0x358e8b(0x225)]){console[_0x358e8b(0x24e)]('\x20\x20'+a21_0x301366[_0x358e8b(0x2d3)]('•')+'\x20'+_0x5d3de5);}}_0xaf5409['allValid']&&console[_0x358e8b(0x24e)]('\x0a'+a21_0x301366[_0x358e8b(0x2b3)]('✔')+_0x358e8b(0x2d8));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']='segment:parent:preview';[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x22e);async['execute'](_0x5d4dea){const _0x4728e3=a21_0x106a0d,{options:_0x7753d3,args:_0x32e4d5,tdx:_0x496524}=_0x5d4dea,_0x3c0f2b=_0x7753d3,_0x595f29=_0x32e4d5[0x0]||_0x7753d3[_0x4728e3(0x1ec)];if(!_0x595f29)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x4728e3(0x2f0)+'Options\x20(one\x20required):\x0a'+_0x4728e3(0x2aa)+_0x4728e3(0x26a)+_0x4728e3(0x1e2)+_0x4728e3(0x256)+_0x4728e3(0x2a3)),0x1;if(!_0x3c0f2b[_0x4728e3(0x27d)]&&!_0x3c0f2b[_0x4728e3(0x239)]&&!_0x3c0f2b['behavior']&&!_0x3c0f2b[_0x4728e3(0x276)])return console[_0x4728e3(0x24e)](a21_0x301366[_0x4728e3(0x2d3)](_0x4728e3(0x1ff))),console[_0x4728e3(0x24e)](_0x4728e3(0x237)),console[_0x4728e3(0x24e)](_0x4728e3(0x2f9)),console[_0x4728e3(0x24e)](_0x4728e3(0x218)),console[_0x4728e3(0x24e)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x4728e3(0x24e)](_0x4728e3(0x243)),console['error'](_0x4728e3(0x1e7)),0x1;const _0x34ed5c=resolveYamlFile(_0x595f29);if(!existsSync(_0x34ed5c))return showFileNotFoundError(_0x34ed5c,_0x595f29),0x1;_0x3c0f2b[_0x4728e3(0x2b2)]&&(console[_0x4728e3(0x24e)](_0x4728e3(0x208)+_0x3c0f2b[_0x4728e3(0x24b)]),console[_0x4728e3(0x24e)](_0x4728e3(0x2f2)+_0x34ed5c));let _0x188cc3;try{_0x188cc3=readFileSync(_0x34ed5c,_0x4728e3(0x235));}catch(_0x347ebb){const _0x21b5fd=_0x347ebb instanceof Error?_0x347ebb[_0x4728e3(0x2e7)]:String(_0x347ebb);return console[_0x4728e3(0x24e)](_0x4728e3(0x22c)+_0x21b5fd),0x1;}let _0x5bf0f6;try{_0x5bf0f6=parseDef(_0x188cc3);}catch(_0x95b62b){const _0x14bc0c=_0x95b62b instanceof Error?_0x95b62b[_0x4728e3(0x2e7)]:String(_0x95b62b);return console[_0x4728e3(0x24e)](a21_0x301366[_0x4728e3(0x2d3)](_0x4728e3(0x1f2)+_0x14bc0c)),0x1;}if(_0x3c0f2b[_0x4728e3(0x239)]===!![]||_0x3c0f2b['attribute']===''){const _0x21f14c=_0x5bf0f6['attributes']?.['map'](_0x267d4f=>_0x267d4f[_0x4728e3(0x2db)])||[];if(_0x21f14c[_0x4728e3(0x1f6)]===0x0)console['error'](a21_0x301366[_0x4728e3(0x2d3)](_0x4728e3(0x21a)));else{console[_0x4728e3(0x24e)](a21_0x301366[_0x4728e3(0x2d3)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x4728e3(0x24e)](_0x4728e3(0x249));for(const _0x3cc9e7 of _0x21f14c){console[_0x4728e3(0x24e)]('\x20\x20'+a21_0x301366[_0x4728e3(0x282)](_0x3cc9e7));}console[_0x4728e3(0x24e)](_0x4728e3(0x26e)+_0x595f29+'\x20--attribute\x20\x22'+_0x21f14c[0x0]+'\x22');}return 0x1;}if(_0x3c0f2b[_0x4728e3(0x2e9)]===!![]||_0x3c0f2b[_0x4728e3(0x2e9)]===''){const _0x160263=_0x5bf0f6['behaviors']?.[_0x4728e3(0x24c)](_0x53ea13=>_0x53ea13[_0x4728e3(0x2db)])||[];if(_0x160263[_0x4728e3(0x1f6)]===0x0)console['error'](a21_0x301366['red'](_0x4728e3(0x2a4)));else{console[_0x4728e3(0x24e)](a21_0x301366[_0x4728e3(0x2d3)](_0x4728e3(0x2be))),console[_0x4728e3(0x24e)](_0x4728e3(0x25d));for(const _0x8ecb2c of _0x160263){console[_0x4728e3(0x24e)]('\x20\x20'+a21_0x301366['cyan'](_0x8ecb2c));}console[_0x4728e3(0x24e)](_0x4728e3(0x26e)+_0x595f29+'\x20--behavior\x20\x22'+_0x160263[0x0]+'\x22');}return 0x1;}const _0x4c569a=createCommandSpinner(a21_0x301366[_0x4728e3(0x2c4)](_0x4728e3(0x221)),{'verbose':_0x3c0f2b[_0x4728e3(0x2b2)]});_0x4c569a['start']();const _0x195cb0={'onProgress':_0x3cbb57=>{const _0x39dff1=_0x4728e3;_0x4c569a[_0x39dff1(0x231)]=formatProgressMessage(_0x3cbb57);}};if(_0x3c0f2b[_0x4728e3(0x27d)])_0x195cb0[_0x4728e3(0x27d)]=!![];if(_0x3c0f2b['attribute']&&typeof _0x3c0f2b[_0x4728e3(0x239)]==='string')_0x195cb0[_0x4728e3(0x239)]=_0x3c0f2b[_0x4728e3(0x239)];if(_0x3c0f2b[_0x4728e3(0x2e9)]&&typeof _0x3c0f2b[_0x4728e3(0x2e9)]===_0x4728e3(0x20a))_0x195cb0[_0x4728e3(0x2e9)]=_0x3c0f2b[_0x4728e3(0x2e9)];if(_0x3c0f2b['enriched'])_0x195cb0[_0x4728e3(0x276)]=!![];if(_0x3c0f2b[_0x4728e3(0x2c8)])_0x195cb0['interval']=_0x3c0f2b[_0x4728e3(0x2c8)];let _0x1646a4;try{_0x1646a4=await _0x496524[_0x4728e3(0x260)][_0x4728e3(0x269)](_0x188cc3,_0x195cb0),_0x4c569a['stop']();}catch(_0x3694ea){_0x4c569a['stop']();throw _0x3694ea;}return await this[_0x4728e3(0x2e1)](_0x1646a4,{'master':_0x3c0f2b[_0x4728e3(0x27d)],'attribute':typeof _0x3c0f2b[_0x4728e3(0x239)]===_0x4728e3(0x20a)?_0x3c0f2b['attribute']:undefined,'behavior':typeof _0x3c0f2b[_0x4728e3(0x2e9)]===_0x4728e3(0x20a)?_0x3c0f2b[_0x4728e3(0x2e9)]:undefined,'enriched':_0x3c0f2b[_0x4728e3(0x276)]}),_0x1646a4['allValid']?0x0:0x1;}async[a21_0x106a0d(0x2e1)](_0x4474e9,_0x55e9d3){const _0x1916b0=a21_0x106a0d;console['error']('\x0a'+a21_0x301366['bold'](_0x1916b0(0x286))+'\x20'+_0x4474e9[_0x1916b0(0x2db)]),console['error']('═'[_0x1916b0(0x252)](0x3c));if(_0x55e9d3['master']&&_0x4474e9[_0x1916b0(0x1fa)]){const _0x4d93a4=a21_0x301366[_0x1916b0(0x2c4)]('Master:')+'\x20'+a21_0x301366[_0x1916b0(0x27f)](_0x4474e9[_0x1916b0(0x27d)]['database']+'.'+_0x4474e9[_0x1916b0(0x27d)][_0x1916b0(0x2d4)]);await this['displaySampleData'](_0x4d93a4,_0x4474e9['sampleData']);}else{if(_0x55e9d3[_0x1916b0(0x239)]&&_0x4474e9['sampleData']){const _0x31bc9b=a21_0x301366[_0x1916b0(0x2c4)]('Attribute:')+'\x20'+a21_0x301366[_0x1916b0(0x27f)](_0x55e9d3[_0x1916b0(0x239)]);await this[_0x1916b0(0x2b7)](_0x31bc9b,_0x4474e9[_0x1916b0(0x1fa)]);}else{if(_0x55e9d3[_0x1916b0(0x2e9)]&&_0x4474e9[_0x1916b0(0x1fa)]){const _0x2cf569=a21_0x301366[_0x1916b0(0x2c4)](_0x1916b0(0x266))+'\x20'+a21_0x301366[_0x1916b0(0x27f)](_0x55e9d3[_0x1916b0(0x2e9)]);await this[_0x1916b0(0x2b7)](_0x2cf569,_0x4474e9[_0x1916b0(0x1fa)]);}else{if(_0x55e9d3[_0x1916b0(0x276)]&&_0x4474e9[_0x1916b0(0x1fa)]){const _0x1f126a=a21_0x301366[_0x1916b0(0x2c4)](_0x1916b0(0x275))+'\x20'+a21_0x301366[_0x1916b0(0x27f)](_0x1916b0(0x25e));await this[_0x1916b0(0x2b7)](_0x1f126a,_0x4474e9[_0x1916b0(0x1fa)]);}else!_0x4474e9[_0x1916b0(0x1fa)]&&console['error'](_0x1916b0(0x27b));}}}if(_0x4474e9['errors'][_0x1916b0(0x1f6)]>0x0){console['error']('─'[_0x1916b0(0x252)](0x3c)),console['error']('\x0a'+a21_0x301366[_0x1916b0(0x2d3)](_0x1916b0(0x205)));for(const _0x5d1cf1 of _0x4474e9[_0x1916b0(0x225)]){console[_0x1916b0(0x24e)]('\x20\x20'+a21_0x301366[_0x1916b0(0x2d3)]('•')+'\x20'+_0x5d1cf1);}}}async[a21_0x106a0d(0x2b7)](_0x49358f,_0x2e266f){const _0x225864=a21_0x106a0d;if(_0x2e266f[_0x225864(0x1f6)]===0x0){console[_0x225864(0x24e)]('\x0a'+_0x49358f),console[_0x225864(0x24e)]('\x20\x20No\x20sample\x20data\x20available');return;}console['error']('\x0a'+_0x49358f);const _0x35a23b=Object[_0x225864(0x2d0)](_0x2e266f[0x0])[_0x225864(0x24c)](_0x244eff=>({'name':_0x244eff,'type':typeof _0x2e266f[0x0][_0x244eff]===_0x225864(0x2a8)?_0x225864(0x281):_0x225864(0x1e6)})),_0x15aecc={'queryId':_0x225864(0x25b),'columns':_0x35a23b,'data':_0x2e266f,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2e266f[_0x225864(0x1f6)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x3344b0=formatAsTable(_0x15aecc,_0x2e266f[_0x225864(0x1f6)],!![]);await writeOutput(_0x3344b0,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']='segment:parent:run';[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x291);async[a21_0x106a0d(0x2d7)](_0x130a21){const _0x12f332=a21_0x106a0d,{options:_0x576825,args:_0x8bbabe,tdx:_0x40e662}=_0x130a21,_0x127faf=_0x576825,_0x26b08f=_0x8bbabe[0x0]||_0x576825[_0x12f332(0x1ec)];if(!_0x26b08f)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x4d49d0=resolveYamlFile(_0x26b08f);if(existsSync(_0x4d49d0)){_0x127faf[_0x12f332(0x2b2)]&&console[_0x12f332(0x24e)](_0x12f332(0x246)+_0x4d49d0);let _0xdca6cf;try{_0xdca6cf=readFileSync(_0x4d49d0,_0x12f332(0x235));}catch(_0x592aa6){const _0x325f3d=_0x592aa6 instanceof Error?_0x592aa6[_0x12f332(0x2e7)]:String(_0x592aa6);return console[_0x12f332(0x24e)](_0x12f332(0x22c)+_0x325f3d),0x1;}const _0x460e4e=await withSpinner('Analyzing\x20changes...',()=>_0x40e662[_0x12f332(0x260)][_0x12f332(0x25a)](_0xdca6cf),{'verbose':_0x127faf[_0x12f332(0x2b2)]}),_0x479cc9=_0x460e4e[_0x12f332(0x287)],{isNew:_0x4a44e2,name:_0xb760f7,hasChanges:_0x14f8f9,diffFormatted:_0x39b284}=_0x479cc9;if(_0x14f8f9){_0x4a44e2?console[_0x12f332(0x24e)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xb760f7+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0xb760f7+'\x27:');console['error']('─'[_0x12f332(0x252)](0x3c)),console['error'](_0x39b284),console[_0x12f332(0x24e)]('─'[_0x12f332(0x252)](0x3c));const _0x433e81=_0x4a44e2?'Create\x20parent\x20segment\x20\x27'+_0xb760f7+_0x12f332(0x2d1):'Apply\x20changes\x20to\x20\x27'+_0xb760f7+'\x27\x20and\x20run\x20workflow?';if(!_0x127faf['yes']){const _0xcf3ed7=await confirmKey(_0x433e81);if(!_0xcf3ed7)return console['error']('Aborted.'),0x1;}const _0x2607ea=_0x4a44e2?_0x12f332(0x204):_0x12f332(0x2fe);await withSpinner(_0x2607ea+_0x12f332(0x1ea)+_0xb760f7+_0x12f332(0x293),()=>_0x479cc9[_0x12f332(0x26c)](),{'verbose':_0x127faf['verbose']});const _0x3f36=_0x4a44e2?'Created':_0x12f332(0x23b);console['error']('✔\x20'+_0x3f36+_0x12f332(0x1ea)+_0xb760f7+'\x27');}else console[_0x12f332(0x24e)](_0x12f332(0x229)+_0xb760f7+_0x12f332(0x2ca));}const _0x1090fa=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x26b08f+_0x12f332(0x293),()=>_0x40e662[_0x12f332(0x260)][_0x12f332(0x2cb)](_0x26b08f),{'verbose':_0x127faf[_0x12f332(0x2b2)]}),_0x2d0d81=_0x1090fa['data'],_0x45343c=getConsoleUrl(_0x127faf[_0x12f332(0x24b)],_0x12f332(0x259)+_0x2d0d81[_0x12f332(0x26f)]+_0x12f332(0x1e8)+_0x2d0d81[_0x12f332(0x1f9)]+_0x12f332(0x240)+_0x2d0d81['workflowAttemptId']);return console[_0x12f332(0x24e)]('\x0a✔\x20Workflow\x20started'),console[_0x12f332(0x24e)]('\x20\x20'+a21_0x301366[_0x12f332(0x2c4)](_0x12f332(0x2c6))+'\x20'+_0x2d0d81[_0x12f332(0x230)]),console['error']('\x20\x20'+a21_0x301366['dim'](_0x12f332(0x2e3))+'\x20'+_0x2d0d81['status']),console[_0x12f332(0x24e)]('\x20\x20'+a21_0x301366['dim'](_0x12f332(0x267))+'\x20'+_0x2d0d81[_0x12f332(0x1f9)]),console[_0x12f332(0x24e)]('\x20\x20'+a21_0x301366[_0x12f332(0x2c4)](_0x12f332(0x262))+'\x20'+_0x2d0d81[_0x12f332(0x295)]),console['error']('\x20\x20'+_0x45343c),console[_0x12f332(0x24e)]('\x0a'+a21_0x301366[_0x12f332(0x2c4)](_0x12f332(0x23a))+_0x12f332(0x2ee)+_0x2d0d81[_0x12f332(0x295)]+_0x12f332(0x1e3)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x284);async['execute'](_0x2603b1){const _0x204bfc=a21_0x106a0d,{options:_0x1d3435,args:_0x271c84,tdx:_0x22787a}=_0x2603b1,_0x82a00a=_0x271c84[0x0]||_0x1d3435['parentSegment'];if(!_0x82a00a)return showParentSegmentNotSetError(_0x204bfc(0x298)+_0x204bfc(0x2f5)),0x1;_0x1d3435[_0x204bfc(0x2b2)]&&(console['error'](_0x204bfc(0x208)+_0x1d3435[_0x204bfc(0x24b)]),console[_0x204bfc(0x24e)](_0x204bfc(0x2ba)+_0x82a00a));const _0x57baad=await withSpinner(_0x204bfc(0x302)+_0x82a00a+_0x204bfc(0x293),()=>_0x22787a[_0x204bfc(0x260)][_0x204bfc(0x2c9)](_0x82a00a),{'verbose':_0x1d3435[_0x204bfc(0x2b2)]}),_0x1d4d9e=_0x57baad['data'];console['error'](_0x204bfc(0x228)+_0x1d4d9e[_0x204bfc(0x1f6)]+_0x204bfc(0x232)+(_0x1d4d9e[_0x204bfc(0x1f6)]!==0x1?'s':''));if(_0x1d3435['json']||_0x1d3435['jsonl'])return await handleSDKOutput(_0x1d4d9e,_0x1d3435),0x0;return displayFieldsHumanReadable(_0x1d4d9e,_0x82a00a),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x2f4);[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x24a);async[a21_0x106a0d(0x2d7)](_0xbb5eac){const _0x391a3f=a21_0x106a0d,{options:_0x262333,args:_0x27db31,tdx:_0x546287}=_0xbb5eac,_0x29688b=_0x262333,_0x18d9e7=_0x27db31[0x0]||_0x262333[_0x391a3f(0x1ec)];if(!_0x18d9e7)return showParentSegmentNotSetError(_0x391a3f(0x226)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+_0x391a3f(0x2d5)),0x1;_0x262333['verbose']&&(console['error'](_0x391a3f(0x208)+_0x262333[_0x391a3f(0x24b)]),console[_0x391a3f(0x24e)](_0x391a3f(0x2ba)+_0x18d9e7));const _0x1c910f=await withSpinner(_0x391a3f(0x22f)+_0x18d9e7+_0x391a3f(0x293),()=>_0x546287['segment'][_0x391a3f(0x27a)](_0x18d9e7),{'verbose':_0x262333[_0x391a3f(0x2b2)]}),_0x4c0c95=_0x1c910f['data'];if(_0x29688b[_0x391a3f(0x248)]){const _0x17e16=getConsoleNextUrl(_0x29688b[_0x391a3f(0x24b)],_0x391a3f(0x1f8)+_0x4c0c95['id']);return console[_0x391a3f(0x24e)](a21_0x301366[_0x391a3f(0x2b3)]('✔')+_0x391a3f(0x20d)+a21_0x301366['cyan'](_0x17e16)),openBrowser(_0x17e16),0x0;}return await handleSingleObjectOutput(_0x4c0c95,_0x262333),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x106a0d(0x2db)]='segment:parent:desc';[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x1f4);async[a21_0x106a0d(0x2d7)](_0x4cf585){const _0x13feb5=a21_0x106a0d,{options:_0x5bf1ea,args:_0xa9d68a,tdx:_0x3b327f}=_0x4cf585,_0xc24a54=_0xa9d68a[0x0]||_0x5bf1ea[_0x13feb5(0x1ec)];if(!_0xc24a54)return showParentSegmentNotSetError(_0x13feb5(0x2fb)+_0x13feb5(0x28a)),0x1;_0x5bf1ea['verbose']&&(console['error'](_0x13feb5(0x208)+_0x5bf1ea['site']),console[_0x13feb5(0x24e)](_0x13feb5(0x2ba)+_0xc24a54));const _0x26604e=await withSpinner(_0x13feb5(0x23e)+_0xc24a54+_0x13feb5(0x293),()=>_0x3b327f['segment'][_0x13feb5(0x304)](_0xc24a54),{'verbose':_0x5bf1ea[_0x13feb5(0x2b2)]}),_0xc9eb1d=_0x26604e[_0x13feb5(0x287)],_0x40a2fb=await withSpinner(_0x13feb5(0x283)+_0xc24a54+'\x27...',()=>_0x3b327f[_0x13feb5(0x260)][_0x13feb5(0x20f)](_0xc9eb1d),{'verbose':_0x5bf1ea[_0x13feb5(0x2b2)]}),_0x1dae19=await executeSchemaQuery(_0x40a2fb[_0x13feb5(0x287)],_0x3b327f,_0x5bf1ea);return await handleQueryOutput(_0x1dae19,_0x5bf1ea),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a21_0x106a0d(0x1f7);[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x265);async['execute'](_0x5ef070){const _0x59d871=a21_0x106a0d,{options:_0x3f2b99,args:_0x661b3a,tdx:_0x2a08fb}=_0x5ef070,_0x5513bb=_0x661b3a[0x0]||_0x3f2b99[_0x59d871(0x1ec)];if(!_0x5513bb)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x3f2b99[_0x59d871(0x2b2)]&&(console[_0x59d871(0x24e)]('Site:\x20'+_0x3f2b99[_0x59d871(0x24b)]),console['error'](_0x59d871(0x2ba)+_0x5513bb));const _0x19af36=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5513bb+_0x59d871(0x293),()=>_0x2a08fb['segment'][_0x59d871(0x304)](_0x5513bb),{'verbose':_0x3f2b99[_0x59d871(0x2b2)]}),_0x56d7df=_0x19af36[_0x59d871(0x287)],_0x276d0a=await withSpinner(_0x59d871(0x283)+_0x5513bb+'\x27...',()=>_0x2a08fb[_0x59d871(0x260)]['getParentSQL'](_0x56d7df),{'verbose':_0x3f2b99[_0x59d871(0x2b2)]}),_0xd7ee5c=_0x276d0a[_0x59d871(0x287)];return _0x3f2b99['format']===_0x59d871(0x220)||_0x3f2b99[_0x59d871(0x2bc)]==='jsonl'?await handleSDKOutput([{'sql':_0xd7ee5c}],_0x3f2b99):console[_0x59d871(0x29b)](_0xd7ee5c),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a21_0x106a0d(0x2db)]=a21_0x106a0d(0x200);[a21_0x106a0d(0x2e6)]=a21_0x106a0d(0x22b);async[a21_0x106a0d(0x2d7)](_0x49a2b7){const _0x379f32=a21_0x106a0d,{options:_0x6e7e5c,args:_0x230bca,tdx:_0x5e322e}=_0x49a2b7,_0xa1f8ac=_0x230bca[0x0]||_0x6e7e5c[_0x379f32(0x1ec)];if(!_0xa1f8ac)return showParentSegmentNotSetError(_0x379f32(0x211)+_0x379f32(0x2a1)),0x1;_0x6e7e5c[_0x379f32(0x2b2)]&&(console[_0x379f32(0x24e)](_0x379f32(0x208)+_0x6e7e5c[_0x379f32(0x24b)]),console[_0x379f32(0x24e)](_0x379f32(0x2ba)+_0xa1f8ac));const _0x4665f3=await withSpinner(_0x379f32(0x23e)+_0xa1f8ac+_0x379f32(0x293),()=>_0x5e322e[_0x379f32(0x260)][_0x379f32(0x304)](_0xa1f8ac),{'verbose':_0x6e7e5c[_0x379f32(0x2b2)]}),_0x50d871=_0x4665f3['data'],_0x467259=await withSpinner(_0x379f32(0x283)+_0xa1f8ac+_0x379f32(0x293),()=>_0x5e322e['segment'][_0x379f32(0x20f)](_0x50d871),{'verbose':_0x6e7e5c[_0x379f32(0x2b2)]});let _0x37f7b9=_0x467259[_0x379f32(0x287)];const _0x854f68=resolveLimit(_0x6e7e5c['limit'],DEFAULT_DISPLAY_LIMIT),_0x1673fc=/\bLIMIT\s+\d+/i[_0x379f32(0x2b1)](_0x37f7b9);!_0x1673fc&&(_0x37f7b9=_0x37f7b9[_0x379f32(0x201)]()[_0x379f32(0x1e1)](/;+$/,''),_0x37f7b9=_0x379f32(0x2da)+_0x37f7b9+_0x379f32(0x28d)+_0x854f68);_0x6e7e5c[_0x379f32(0x2b2)]&&console[_0x379f32(0x24e)]('SQL\x20query:\x0a'+_0x37f7b9);const _0x1c9fa7=await withProgressSpinner(_0x379f32(0x2eb),async _0x22c6f8=>{const _0x5d29af=_0x379f32,_0x3d590d=await _0x5e322e[_0x5d29af(0x2df)][_0x5d29af(0x2d7)](_0x37f7b9,{'catalog':'td','schema':_0x5d29af(0x234),'onJobId':_0x552033=>{const _0x542a02=_0x5d29af;_0x22c6f8[_0x542a02(0x1e0)](_0x552033);}});return _0x3d590d;},{'verbose':_0x6e7e5c['verbose']}),_0x42f040=_0x1c9fa7[_0x379f32(0x287)],_0x58bbaf=_0x42f040[_0x379f32(0x222)]?'\x20[Job\x20ID:\x20'+_0x42f040['jobId']+']':'';return console[_0x379f32(0x24e)](_0x379f32(0x2b5)+_0x42f040['stats'][_0x379f32(0x278)][_0x379f32(0x288)]()+'\x20rows\x20'+(_0x379f32(0x236)+formatElapsed(_0x42f040[_0x379f32(0x2ff)][_0x379f32(0x21b)])+_0x58bbaf)),await handleQueryOutput(_0x42f040,_0x6e7e5c),0x0;}}
@@ -1 +1 @@
1
- const a22_0xe4c799=a22_0x112b;(function(_0x2b506c,_0x2d0013){const _0x8d9c6f=a22_0x112b,_0xe24089=_0x2b506c();while(!![]){try{const _0xa1a614=-parseInt(_0x8d9c6f(0x241))/0x1*(-parseInt(_0x8d9c6f(0x21b))/0x2)+-parseInt(_0x8d9c6f(0x22f))/0x3*(-parseInt(_0x8d9c6f(0x21d))/0x4)+parseInt(_0x8d9c6f(0x203))/0x5*(parseInt(_0x8d9c6f(0x246))/0x6)+parseInt(_0x8d9c6f(0x1d1))/0x7+parseInt(_0x8d9c6f(0x20e))/0x8+-parseInt(_0x8d9c6f(0x229))/0x9*(parseInt(_0x8d9c6f(0x1d0))/0xa)+parseInt(_0x8d9c6f(0x23c))/0xb*(-parseInt(_0x8d9c6f(0x204))/0xc);if(_0xa1a614===_0x2d0013)break;else _0xe24089['push'](_0xe24089['shift']());}catch(_0x1c7c88){_0xe24089['push'](_0xe24089['shift']());}}}(a22_0x28a2,0x2363d));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile}from'../core/profile.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a22_0x28a2(){const _0x2ccc34=['(session:\x20','eu01','123730jxvCtD','1578563GtdEsJ','Site\x20was\x20not\x20changed.','bold','push','status','\x27\x20requires\x20API\x20key\x20validation.','ap02','Validating\x20API\x20key...','green','create','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','database','profile:set','execute','us01','Enter\x20your\x20TD\x20API\x20key:','API\x20key\x20cannot\x20be\x20empty','Remove\x20a\x20profile','\x20\x20tdx\x20--profile\x20','site','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','ERROR','length','test','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Changing\x20site\x20to\x20\x27','text','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','warn','profile','tdx:\x20profile\x20set','Session\x20profile\x20set\x20to:\x20','\x20\x20-\x20','Enter\x20profile\x20name:','red','\x27\x20removed\x20from\x20configuration','Set\x20a\x20profile\x20configuration\x20value','jobs','ap02\x20-\x20Korea','llm_agent','\x20\x20(no\x20profiles\x20found)','config','Removal\x20cancelled','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','log','VALID_KEYS','dim','apiKey','\x27\x20created','Operation\x20cancelled','515JdEXoZ','492zKkfGa','Failed\x20to\x20remove\x20profile:\x20','trim','\x0aAvailable\x20profiles:','yellow','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>','/app/mp/ak','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','other','698040ZrDRzf','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x27\x20updated:\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20does\x20not\x20exist.\x20Create\x20it?','split','getUserInfo','Enter\x20custom\x20site','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','name','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Enter\x20site\x20name:','4226qgiZws','toString','513652JUZjWk','(cleared)','\x27\x20does\x20not\x20exist.','password','Set\x20session\x20profile','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','profileName','session','Profile\x20\x27','jp01','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20cannot\x20be\x20empty','18zkAmgz','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','tdx:\x20profile\x20remove','Unknown\x20key\x20\x27','\x20Profile\x20\x27','email','3MxAtkh','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','value','\x27.\x0a\x0aValid\x20keys:\x20','message','confirm','\x20API\x20key\x20removed\x20from\x20system\x20keychain','✗\x20Validation\x20failed:\x20','Enter\x20description\x20(optional):','description','\x0aSetup\x20cancelled','profile:use','customSite','163361JsZhJh','error','profile:remove','join','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','27LKCpCP','llm_project','includes','eu\x20\x20\x20-\x20Europe','profile:create','16332OsrkrT','validate'];a22_0x28a2=function(){return _0x2ccc34;};return a22_0x28a2();}import{TDX}from'../sdk/index.js';function a22_0x112b(_0x368b28,_0x34cfbf){_0x368b28=_0x368b28-0x1ce;const _0x28a27d=a22_0x28a2();let _0x112b6f=_0x28a27d[_0x368b28];return _0x112b6f;}import{LogLevel}from'../utils/tdx-logger.js';import a22_0x42d5ce from'prompts';import a22_0x58cd07 from'chalk';export class ProfileCreateCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x245);['description']='Create\x20a\x20new\x20profile\x20interactively';async[a22_0xe4c799(0x1de)](_0x4c959e){const _0x544250=a22_0xe4c799,{options:_0x46fcb4}=_0x4c959e;console[_0x544250(0x1fd)](a22_0x58cd07['bold']('tdx:\x20profile\x20create'));const _0x117920=await a22_0x42d5ce({'type':_0x544250(0x1eb),'name':_0x544250(0x223),'message':_0x544250(0x1f2),'validate':_0x14bace=>{const _0x5d8d45=_0x544250;if(!_0x14bace||!_0x14bace[_0x5d8d45(0x206)]())return _0x5d8d45(0x228);if(!/^[a-zA-Z0-9_-]+$/[_0x5d8d45(0x1e8)](_0x14bace[_0x5d8d45(0x206)]()))return _0x5d8d45(0x20c);if(profileExists(_0x14bace[_0x5d8d45(0x206)]()))return _0x5d8d45(0x225)+_0x14bace[_0x5d8d45(0x206)]()+_0x5d8d45(0x1e9);return!![];}});if(!_0x117920['profileName'])return console[_0x544250(0x1fd)](_0x544250(0x239)),0x1;const _0x3916f0=_0x117920[_0x544250(0x223)][_0x544250(0x206)](),_0xa864b=await a22_0x42d5ce({'type':'text','name':'description','message':_0x544250(0x237)}),_0x372ff5=_0xa864b[_0x544250(0x238)]?.[_0x544250(0x206)]()||undefined,_0x33be68=_0x46fcb4['site']||_0x544250(0x1df),_0x8d3ef8=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x544250(0x1df)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x544250(0x226)},{'title':_0x544250(0x244),'value':_0x544250(0x1cf)},{'title':_0x544250(0x1f7),'value':_0x544250(0x1d7)}];let _0x2d1a8b=_0x8d3ef8['findIndex'](_0x22c436=>_0x22c436[_0x544250(0x231)]===_0x33be68);_0x2d1a8b===-0x1&&_0x33be68!==_0x544250(0x1df)&&(_0x8d3ef8[_0x544250(0x1d4)]({'title':_0x33be68,'value':_0x33be68}),_0x2d1a8b=_0x8d3ef8[_0x544250(0x1e7)]-0x1);_0x8d3ef8[_0x544250(0x1d4)]({'title':_0x544250(0x216),'value':'other'});const _0x534f34=await a22_0x42d5ce({'type':'select','name':_0x544250(0x1e4),'message':_0x544250(0x1ec)+_0x3916f0+'\x27:','choices':_0x8d3ef8,'initial':_0x2d1a8b>=0x0?_0x2d1a8b:0x0});if(!_0x534f34[_0x544250(0x1e4)])return console['log'](_0x544250(0x239)),0x1;let _0x55911f;if(_0x534f34[_0x544250(0x1e4)]===_0x544250(0x20d)){const _0x43f636=await a22_0x42d5ce({'type':_0x544250(0x1eb),'name':_0x544250(0x23b),'message':_0x544250(0x21a),'initial':_0x544250(0x1df),'validate':_0x52949f=>{const _0x47b222=_0x544250;if(!_0x52949f||!_0x52949f[_0x47b222(0x206)]())return'Site\x20name\x20cannot\x20be\x20empty';if(!/^[a-z0-9-]+$/[_0x47b222(0x1e8)](_0x52949f[_0x47b222(0x206)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x43f636[_0x544250(0x23b)])return console[_0x544250(0x1fd)]('\x0aSetup\x20cancelled'),0x1;_0x55911f=_0x43f636[_0x544250(0x23b)];}else _0x55911f=_0x534f34[_0x544250(0x1e4)];const _0x3dfde2=resolveSite(_0x55911f);console['log'](_0x544250(0x230)+_0x3dfde2),console[_0x544250(0x1fd)](_0x544250(0x212)),console['log']('\x20\x20'+getConsoleUrl(_0x3dfde2,_0x544250(0x20a)));const _0xdb03a9=await a22_0x42d5ce({'type':'password','name':_0x544250(0x200),'message':_0x544250(0x1e0),'validate':_0x22e5ea=>{const _0x2b5bfc=_0x544250;if(!_0x22e5ea||!_0x22e5ea[_0x2b5bfc(0x206)]())return _0x2b5bfc(0x1e1);return!![];}});if(!_0xdb03a9['apiKey'])return console[_0x544250(0x1fd)]('\x0aSetup\x20cancelled'),0x1;const _0x2c4fce=_0xdb03a9[_0x544250(0x200)];console['log'](_0x544250(0x1d8));try{const _0xad1dcd=TDX[_0x544250(0x1da)]({'site':_0x3dfde2,'apiKey':_0x2c4fce[_0x544250(0x206)](),'logLevel':_0x46fcb4['logLevel']??LogLevel['ERROR']}),_0x593c1b=await _0xad1dcd['jobs'][_0x544250(0x215)]();console[_0x544250(0x1fd)](a22_0x58cd07[_0x544250(0x1d9)]('✓')+_0x544250(0x227)+_0x593c1b[_0x544250(0x22e)]+')');const _0x58038f=await isKeychainAvailable();_0x58038f?(await saveAPIKeyAsync(_0x2c4fce[_0x544250(0x206)](),_0x3dfde2,_0x3916f0),console['log'](a22_0x58cd07['green']('✓')+_0x544250(0x1db)+_0x3916f0+')')):(console[_0x544250(0x1ed)](a22_0x58cd07['yellow'](_0x544250(0x20b))),console[_0x544250(0x1ed)](a22_0x58cd07[_0x544250(0x208)](_0x544250(0x1e5))));const _0x4e16c3={'site':_0x3dfde2,..._0x372ff5&&{'description':_0x372ff5}};return saveProfileToUserConfig(_0x3916f0,_0x4e16c3),console[_0x544250(0x1fd)](a22_0x58cd07[_0x544250(0x1d9)]('✓')+_0x544250(0x22d)+_0x3916f0+_0x544250(0x201)),console[_0x544250(0x1fd)](),console[_0x544250(0x1fd)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x544250(0x1fd)]('\x20\x20tdx\x20--profile\x20'+_0x3916f0+_0x544250(0x222)),console[_0x544250(0x1fd)](_0x544250(0x1e3)+_0x3916f0+_0x544250(0x240)),0x0;}catch(_0x2085a0){if(_0x2085a0 instanceof HTTPClientError&&_0x2085a0[_0x544250(0x1d5)]===0x191)return printAuthError(_0x2085a0),0x1;return console[_0x544250(0x23d)](a22_0x58cd07[_0x544250(0x1f3)](_0x544250(0x236)+(_0x2085a0 instanceof Error?_0x2085a0[_0x544250(0x233)]:String(_0x2085a0)))),console[_0x544250(0x23d)](_0x544250(0x1fc)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x23e);[a22_0xe4c799(0x238)]=a22_0xe4c799(0x1e2);[a22_0xe4c799(0x247)](_0x3ec3cf){const _0x2cd063=a22_0xe4c799,{args:_0x449bda}=_0x3ec3cf;if(_0x449bda['length']===0x0)return _0x2cd063(0x20f);return undefined;}async['execute'](_0x3c0afc){const _0xdfc0ca=a22_0xe4c799,{args:_0x4146bc}=_0x3c0afc,_0x45122a=_0x4146bc[0x0];console[_0xdfc0ca(0x1fd)](a22_0x58cd07[_0xdfc0ca(0x1d3)](_0xdfc0ca(0x22b)));if(!profileExists(_0x45122a)){console[_0xdfc0ca(0x23d)](a22_0x58cd07[_0xdfc0ca(0x1f3)](_0xdfc0ca(0x225)+_0x45122a+_0xdfc0ca(0x21f))),console[_0xdfc0ca(0x1fd)]('\x0aAvailable\x20profiles:');const _0x58d540=listProfiles();if(_0x58d540[_0xdfc0ca(0x1e7)]===0x0)console[_0xdfc0ca(0x1fd)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x2b6abb of _0x58d540){console[_0xdfc0ca(0x1fd)](_0xdfc0ca(0x1f1)+_0x2b6abb[_0xdfc0ca(0x218)]);}return 0x1;}const _0x215c2a=await a22_0x42d5ce({'type':'confirm','name':_0xdfc0ca(0x234),'message':_0xdfc0ca(0x217)+_0x45122a+'\x27?','initial':![]});if(!_0x215c2a['confirm'])return console[_0xdfc0ca(0x1fd)](_0xdfc0ca(0x1fb)),0x0;try{removeProfileFromUserConfig(_0x45122a),console[_0xdfc0ca(0x1fd)](a22_0x58cd07[_0xdfc0ca(0x1d9)]('✓')+'\x20Profile\x20\x27'+_0x45122a+_0xdfc0ca(0x1f4));}catch(_0x5cc178){return console[_0xdfc0ca(0x23d)](a22_0x58cd07[_0xdfc0ca(0x1f3)](_0xdfc0ca(0x205)+(_0x5cc178 instanceof Error?_0x5cc178['message']:String(_0x5cc178)))),0x1;}const _0x46048d=await isKeychainAvailable();if(_0x46048d){const _0x475778=await deleteKeychainAPIKey(_0x45122a);_0x475778&&console[_0xdfc0ca(0x1fd)](a22_0x58cd07[_0xdfc0ca(0x1d9)]('✓')+_0xdfc0ca(0x235));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x1dd);[a22_0xe4c799(0x238)]=a22_0xe4c799(0x1f5);static [a22_0xe4c799(0x1fe)]=[a22_0xe4c799(0x1e4),a22_0xe4c799(0x1dc),'parent_segment',a22_0xe4c799(0x242),a22_0xe4c799(0x1f8),a22_0xe4c799(0x238)];['validate'](_0x856e3d){const _0x2b8f21=a22_0xe4c799,{args:_0x415d2a,options:_0x3a0f45}=_0x856e3d,_0xeefa4=_0x3a0f45[_0x2b8f21(0x1ee)]||getActiveProfile();if(!_0xeefa4)return _0x2b8f21(0x22a);if(_0x415d2a['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x23f)](',\x20');const _0x3b608d=_0x415d2a[0x0];if(!_0x3b608d['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x23f)](',\x20');const [_0x5042fc]=_0x3b608d[_0x2b8f21(0x214)]('=',0x2);if(!ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x243)](_0x5042fc))return _0x2b8f21(0x22c)+_0x5042fc+_0x2b8f21(0x232)+ProfileSetCommand[_0x2b8f21(0x1fe)][_0x2b8f21(0x23f)](',\x20');return undefined;}async[a22_0xe4c799(0x1de)](_0x2a7152){const _0x3eca95=a22_0xe4c799,{args:_0x1a8a6c,options:_0x3381ab}=_0x2a7152,_0x3b6126=_0x3381ab[_0x3eca95(0x1ee)]||getActiveProfile(),[_0x22e329,..._0x1c359a]=_0x1a8a6c[0x0][_0x3eca95(0x214)]('='),_0x211829=_0x1c359a[_0x3eca95(0x23f)]('=');console['log'](a22_0x58cd07[_0x3eca95(0x1d3)](_0x3eca95(0x1ef)));if(!profileExists(_0x3b6126)){const _0x4e805b=await a22_0x42d5ce({'type':_0x3eca95(0x234),'name':'create','message':_0x3eca95(0x225)+_0x3b6126+_0x3eca95(0x213),'initial':!![]});if(!_0x4e805b[_0x3eca95(0x1da)])return console[_0x3eca95(0x1fd)](_0x3eca95(0x202)),0x1;}const _0x566930=loadProfile(_0x3b6126),_0x2f2ba4=_0x566930?.[_0x3eca95(0x1fa)]||{};if(_0x22e329===_0x3eca95(0x1e4)){const _0x52439d=resolveSite(_0x211829);console[_0x3eca95(0x1fd)](_0x3eca95(0x1ea)+_0x52439d+_0x3eca95(0x1d6)),console[_0x3eca95(0x1fd)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x52439d,_0x3eca95(0x20a)));const _0x36028c=await a22_0x42d5ce({'type':_0x3eca95(0x220),'name':'apiKey','message':_0x3eca95(0x210),'validate':_0x2af38d=>{const _0x455dcf=_0x3eca95;if(!_0x2af38d||!_0x2af38d['trim']())return _0x455dcf(0x1e1);return!![];}});if(!_0x36028c[_0x3eca95(0x200)])return console[_0x3eca95(0x1fd)]('\x0aOperation\x20cancelled'),0x1;console[_0x3eca95(0x1fd)](_0x3eca95(0x1d8));try{const _0x3f5811=TDX['create']({'site':_0x52439d,'apiKey':_0x36028c[_0x3eca95(0x200)]['trim'](),'logLevel':_0x3381ab['logLevel']??LogLevel[_0x3eca95(0x1e6)]}),_0x3d424c=await _0x3f5811[_0x3eca95(0x1f6)][_0x3eca95(0x215)]();console['log'](a22_0x58cd07[_0x3eca95(0x1d9)]('✓')+_0x3eca95(0x227)+_0x3d424c[_0x3eca95(0x22e)]+')');const _0x75d0f2=await isKeychainAvailable();_0x75d0f2?(await saveAPIKeyAsync(_0x36028c['apiKey']['trim'](),_0x52439d,_0x3b6126),console[_0x3eca95(0x1fd)](a22_0x58cd07[_0x3eca95(0x1d9)]('✓')+_0x3eca95(0x219))):console[_0x3eca95(0x1ed)](a22_0x58cd07[_0x3eca95(0x208)](_0x3eca95(0x20b))),_0x2f2ba4[_0x3eca95(0x1e4)]=_0x52439d;}catch(_0x230dea){if(_0x230dea instanceof HTTPClientError&&_0x230dea[_0x3eca95(0x1d5)]===0x191)return printAuthError(_0x230dea),0x1;return console[_0x3eca95(0x23d)](a22_0x58cd07[_0x3eca95(0x1f3)](_0x3eca95(0x236)+(_0x230dea instanceof Error?_0x230dea[_0x3eca95(0x233)]:String(_0x230dea)))),console[_0x3eca95(0x23d)](_0x3eca95(0x1d2)),0x1;}}else _0x2f2ba4[_0x22e329]=_0x211829||undefined;return saveProfileToUserConfig(_0x3b6126,_0x2f2ba4),console[_0x3eca95(0x1fd)](a22_0x58cd07[_0x3eca95(0x1d9)]('✓')+_0x3eca95(0x22d)+_0x3b6126+_0x3eca95(0x211)+_0x22e329+'='+(_0x211829||_0x3eca95(0x21e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0xe4c799(0x218)]=a22_0xe4c799(0x23a);['description']=a22_0xe4c799(0x221);[a22_0xe4c799(0x247)](_0x156fa7){const _0x56fca9=a22_0xe4c799,{args:_0x3154f4}=_0x156fa7;if(_0x3154f4[_0x56fca9(0x1e7)]===0x0)return _0x56fca9(0x209);return undefined;}async[a22_0xe4c799(0x1de)](_0x52b4f1){const _0x502f3c=a22_0xe4c799,{args:_0xc27ae7,options:_0x41a5ef}=_0x52b4f1,_0x4532f0=_0xc27ae7[0x0];cleanExpiredSessions();if(!profileExists(_0x4532f0)){console[_0x502f3c(0x23d)](a22_0x58cd07[_0x502f3c(0x1f3)](_0x502f3c(0x225)+_0x4532f0+_0x502f3c(0x21f))),console['log'](_0x502f3c(0x207));const _0x12adea=listProfiles();if(_0x12adea['length']===0x0)console['log'](_0x502f3c(0x1f9));else for(const _0x2a5ae8 of _0x12adea){console[_0x502f3c(0x1fd)]('\x20\x20-\x20'+_0x2a5ae8['name']);}return 0x1;}const _0x517755=_0x41a5ef['session']||getCurrentSessionPID()[_0x502f3c(0x21c)]();return saveSessionContext({'profile':_0x4532f0},_0x41a5ef[_0x502f3c(0x224)]),console[_0x502f3c(0x1fd)](_0x502f3c(0x1f0)+a22_0x58cd07[_0x502f3c(0x1d9)](_0x4532f0)+'\x20'+a22_0x58cd07[_0x502f3c(0x1ff)](_0x502f3c(0x1ce)+_0x517755+')')),console[_0x502f3c(0x1fd)](a22_0x58cd07[_0x502f3c(0x1ff)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}}
1
+ const a22_0x2cdd56=a22_0x53db;(function(_0x114d9e,_0x261f9b){const _0x4114e8=a22_0x53db,_0xe400a9=_0x114d9e();while(!![]){try{const _0xc27b1e=parseInt(_0x4114e8(0x140))/0x1*(-parseInt(_0x4114e8(0x130))/0x2)+parseInt(_0x4114e8(0x11b))/0x3*(parseInt(_0x4114e8(0x125))/0x4)+parseInt(_0x4114e8(0xf5))/0x5*(-parseInt(_0x4114e8(0x115))/0x6)+parseInt(_0x4114e8(0xf1))/0x7+-parseInt(_0x4114e8(0x13e))/0x8*(-parseInt(_0x4114e8(0x117))/0x9)+parseInt(_0x4114e8(0x14f))/0xa+-parseInt(_0x4114e8(0x121))/0xb;if(_0xc27b1e===_0x261f9b)break;else _0xe400a9['push'](_0xe400a9['shift']());}catch(_0x2cf97c){_0xe400a9['push'](_0xe400a9['shift']());}}}(a22_0x1a78,0x5925a));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile}from'../core/profile.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a22_0x1a78(){const _0x264256=['error','value','Changing\x20site\x20to\x20\x27','\x20Profile\x20\x27','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','API\x20key\x20cannot\x20be\x20empty','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Session\x20profile\x20set\x20to:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','create','us01','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','\x0aSetup\x20cancelled','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20\x27','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','\x20\x20tdx\x20--profile\x20','confirm','4832163iasVVZ','profile:create','push','eu\x20\x20\x20-\x20Europe','54445kDqnCK','✗\x20Validation\x20failed:\x20','jp\x20\x20\x20-\x20Japan','Site\x20name\x20cannot\x20be\x20empty','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','toString','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','description','session','Enter\x20site\x20name:','customSite','ap02','bold','validate','execute','profile','jobs','select','yellow','You\x20can\x20find\x20your\x20API\x20key\x20at:','red','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20removed\x20from\x20configuration','split','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Remove\x20a\x20profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','other','jp01','getUserInfo','text','log','108VEpJye','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','2477016nZLAQd','ERROR','(session:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','17058bucNce','llm_project','(cleared)','warn','test','site','9661707xvHNTA','status','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aAvailable\x20profiles:','188JfYGJJ','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','profile:remove','includes','\x27\x20does\x20not\x20exist.','\x20\x20(no\x20profiles\x20found)','apiKey','\x20API\x20key\x20is\x20valid\x20(User:\x20','name','length','Profile\x20name\x20cannot\x20be\x20empty','10IBTFTj','Failed\x20to\x20remove\x20profile:\x20','join','\x20API\x20key\x20removed\x20from\x20system\x20keychain','password','profile:use','Site\x20was\x20not\x20changed.','trim','VALID_KEYS','profile:set','\x20\x20-\x20','/app/mp/ak','\x27.\x0a\x0aValid\x20keys:\x20','email','8nXumHF','us\x20\x20\x20-\x20United\x20States','38342gZdaso','Removal\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','green','eu01','logLevel','message','config','tdx:\x20profile\x20set','dim','tdx:\x20profile\x20remove','Set\x20session\x20profile','Set\x20a\x20profile\x20configuration\x20value','Create\x20a\x20new\x20profile\x20interactively','profileName','3984200RKQnAu','Enter\x20description\x20(optional):','Validating\x20API\x20key...'];a22_0x1a78=function(){return _0x264256;};return a22_0x1a78();}import{HTTPClientError}from'../sdk/client/http-client.js';function a22_0x53db(_0x4d18bd,_0x102cab){_0x4d18bd=_0x4d18bd-0xee;const _0x1a78a2=a22_0x1a78();let _0x53dbc4=_0x1a78a2[_0x4d18bd];return _0x53dbc4;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a22_0x3b4c16 from'prompts';import a22_0x4528d7 from'chalk';export class ProfileCreateCommand extends BaseCommand{['name']=a22_0x2cdd56(0xf2);[a22_0x2cdd56(0xfc)]=a22_0x2cdd56(0x14d);async[a22_0x2cdd56(0x103)](_0x2254b8){const _0x1fc503=a22_0x2cdd56,{options:_0x30bee4}=_0x2254b8;console[_0x1fc503(0x114)](a22_0x4528d7['bold']('tdx:\x20profile\x20create'));const _0xb65455=await a22_0x3b4c16({'type':'text','name':_0x1fc503(0x14e),'message':'Enter\x20profile\x20name:','validate':_0x20c84c=>{const _0x1d9955=_0x1fc503;if(!_0x20c84c||!_0x20c84c[_0x1d9955(0x137)]())return _0x1d9955(0x12f);if(!/^[a-zA-Z0-9_-]+$/['test'](_0x20c84c[_0x1d9955(0x137)]()))return _0x1d9955(0x10d);if(profileExists(_0x20c84c[_0x1d9955(0x137)]()))return'Profile\x20\x27'+_0x20c84c[_0x1d9955(0x137)]()+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}});if(!_0xb65455[_0x1fc503(0x14e)])return console['log'](_0x1fc503(0x15e)),0x1;const _0x3aefcc=_0xb65455[_0x1fc503(0x14e)][_0x1fc503(0x137)](),_0x120e28=await a22_0x3b4c16({'type':_0x1fc503(0x113),'name':'description','message':_0x1fc503(0x150)}),_0x9b4573=_0x120e28[_0x1fc503(0xfc)]?.[_0x1fc503(0x137)]()||undefined,_0x306d83=_0x30bee4['site']||_0x1fc503(0x15c),_0x210713=[{'title':_0x1fc503(0x13f),'value':_0x1fc503(0x15c)},{'title':_0x1fc503(0xf7),'value':_0x1fc503(0x111)},{'title':_0x1fc503(0xf4),'value':_0x1fc503(0x144)},{'title':'ap02\x20-\x20Korea','value':_0x1fc503(0x100)}];let _0x1c701a=_0x210713['findIndex'](_0x115b6a=>_0x115b6a[_0x1fc503(0x153)]===_0x306d83);_0x1c701a===-0x1&&_0x306d83!==_0x1fc503(0x15c)&&(_0x210713['push']({'title':_0x306d83,'value':_0x306d83}),_0x1c701a=_0x210713[_0x1fc503(0x12e)]-0x1);_0x210713[_0x1fc503(0xf3)]({'title':'Enter\x20custom\x20site','value':_0x1fc503(0x110)});const _0x207a74=await a22_0x3b4c16({'type':_0x1fc503(0x106),'name':_0x1fc503(0x120),'message':_0x1fc503(0xf9)+_0x3aefcc+'\x27:','choices':_0x210713,'initial':_0x1c701a>=0x0?_0x1c701a:0x0});if(!_0x207a74[_0x1fc503(0x120)])return console[_0x1fc503(0x114)](_0x1fc503(0x15e)),0x1;let _0x3ee8f6;if(_0x207a74[_0x1fc503(0x120)]===_0x1fc503(0x110)){const _0x41406b=await a22_0x3b4c16({'type':_0x1fc503(0x113),'name':'customSite','message':_0x1fc503(0xfe),'initial':_0x1fc503(0x15c),'validate':_0x115028=>{const _0x43bd26=_0x1fc503;if(!_0x115028||!_0x115028[_0x43bd26(0x137)]())return _0x43bd26(0xf8);if(!/^[a-z0-9-]+$/[_0x43bd26(0x11f)](_0x115028['trim']()))return _0x43bd26(0x156);return!![];}});if(!_0x41406b['customSite'])return console[_0x1fc503(0x114)]('\x0aSetup\x20cancelled'),0x1;_0x3ee8f6=_0x41406b[_0x1fc503(0xff)];}else _0x3ee8f6=_0x207a74[_0x1fc503(0x120)];const _0x2d0d94=resolveSite(_0x3ee8f6);console[_0x1fc503(0x114)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x2d0d94),console[_0x1fc503(0x114)](_0x1fc503(0x108)),console[_0x1fc503(0x114)]('\x20\x20'+getConsoleUrl(_0x2d0d94,_0x1fc503(0x13b)));const _0x566f07=await a22_0x3b4c16({'type':_0x1fc503(0x134),'name':_0x1fc503(0x12b),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x58706f=>{const _0x17b7f5=_0x1fc503;if(!_0x58706f||!_0x58706f[_0x17b7f5(0x137)]())return _0x17b7f5(0x157);return!![];}});if(!_0x566f07['apiKey'])return console['log'](_0x1fc503(0x15e)),0x1;const _0x1931a8=_0x566f07[_0x1fc503(0x12b)];console['log'](_0x1fc503(0x151));try{const _0x6bb142=TDX['create']({'site':_0x2d0d94,'apiKey':_0x1931a8[_0x1fc503(0x137)](),'logLevel':_0x30bee4[_0x1fc503(0x145)]??LogLevel[_0x1fc503(0x118)]}),_0x5bf01a=await _0x6bb142[_0x1fc503(0x105)][_0x1fc503(0x112)]();console[_0x1fc503(0x114)](a22_0x4528d7[_0x1fc503(0x143)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x5bf01a[_0x1fc503(0x13d)]+')');const _0x3b32ca=await isKeychainAvailable();_0x3b32ca?(await saveAPIKeyAsync(_0x1931a8[_0x1fc503(0x137)](),_0x2d0d94,_0x3aefcc),console[_0x1fc503(0x114)](a22_0x4528d7[_0x1fc503(0x143)]('✓')+_0x1fc503(0x142)+_0x3aefcc+')')):(console[_0x1fc503(0x11e)](a22_0x4528d7['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x1fc503(0x11e)](a22_0x4528d7[_0x1fc503(0x107)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1531fe={'site':_0x2d0d94,..._0x9b4573&&{'description':_0x9b4573}};return saveProfileToUserConfig(_0x3aefcc,_0x1531fe),console['log'](a22_0x4528d7[_0x1fc503(0x143)]('✓')+_0x1fc503(0x155)+_0x3aefcc+'\x27\x20created'),console['log'](),console[_0x1fc503(0x114)](_0x1fc503(0xee)),console[_0x1fc503(0x114)](_0x1fc503(0xef)+_0x3aefcc+_0x1fc503(0x158)),console[_0x1fc503(0x114)](_0x1fc503(0xef)+_0x3aefcc+_0x1fc503(0x116)),0x0;}catch(_0x4287b9){if(_0x4287b9 instanceof HTTPClientError&&_0x4287b9[_0x1fc503(0x122)]===0x191)return printAuthError(_0x4287b9),0x1;return console[_0x1fc503(0x152)](a22_0x4528d7['red']('✗\x20Validation\x20failed:\x20'+(_0x4287b9 instanceof Error?_0x4287b9[_0x1fc503(0x146)]:String(_0x4287b9)))),console['error'](_0x1fc503(0x10a)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a22_0x2cdd56(0x127);[a22_0x2cdd56(0xfc)]=a22_0x2cdd56(0x10e);['validate'](_0x9ab473){const _0x1cffe4=a22_0x2cdd56,{args:_0x4bb6f1}=_0x9ab473;if(_0x4bb6f1[_0x1cffe4(0x12e)]===0x0)return _0x1cffe4(0x15a);return undefined;}async[a22_0x2cdd56(0x103)](_0x3184bc){const _0x2cef55=a22_0x2cdd56,{args:_0x1cb192}=_0x3184bc,_0x118ff3=_0x1cb192[0x0];console['log'](a22_0x4528d7[_0x2cef55(0x101)](_0x2cef55(0x14a)));if(!profileExists(_0x118ff3)){console['error'](a22_0x4528d7[_0x2cef55(0x109)](_0x2cef55(0x160)+_0x118ff3+_0x2cef55(0x129))),console[_0x2cef55(0x114)]('\x0aAvailable\x20profiles:');const _0x587bbb=listProfiles();if(_0x587bbb[_0x2cef55(0x12e)]===0x0)console[_0x2cef55(0x114)](_0x2cef55(0x12a));else for(const _0x203690 of _0x587bbb){console[_0x2cef55(0x114)]('\x20\x20-\x20'+_0x203690[_0x2cef55(0x12d)]);}return 0x1;}const _0x16912e=await a22_0x3b4c16({'type':_0x2cef55(0xf0),'name':_0x2cef55(0xf0),'message':_0x2cef55(0x123)+_0x118ff3+'\x27?','initial':![]});if(!_0x16912e[_0x2cef55(0xf0)])return console[_0x2cef55(0x114)](_0x2cef55(0x141)),0x0;try{removeProfileFromUserConfig(_0x118ff3),console['log'](a22_0x4528d7[_0x2cef55(0x143)]('✓')+'\x20Profile\x20\x27'+_0x118ff3+_0x2cef55(0x10b));}catch(_0x573108){return console[_0x2cef55(0x152)](a22_0x4528d7[_0x2cef55(0x109)](_0x2cef55(0x131)+(_0x573108 instanceof Error?_0x573108[_0x2cef55(0x146)]:String(_0x573108)))),0x1;}const _0x5618e9=await isKeychainAvailable();if(_0x5618e9){const _0x2ef248=await deleteKeychainAPIKey(_0x118ff3);_0x2ef248&&console['log'](a22_0x4528d7['green']('✓')+_0x2cef55(0x133));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0x2cdd56(0x12d)]=a22_0x2cdd56(0x139);['description']=a22_0x2cdd56(0x14c);static ['VALID_KEYS']=[a22_0x2cdd56(0x120),'database','parent_segment',a22_0x2cdd56(0x11c),'llm_agent','description'];[a22_0x2cdd56(0x102)](_0x43a935){const _0x37a325=a22_0x2cdd56,{args:_0x32cef8,options:_0x1fda4f}=_0x43a935,_0x1b6b77=_0x1fda4f[_0x37a325(0x104)]||getActiveProfile();if(!_0x1b6b77)return _0x37a325(0x126);if(_0x32cef8[_0x37a325(0x12e)]===0x0)return _0x37a325(0xfb)+ProfileSetCommand[_0x37a325(0x138)][_0x37a325(0x132)](',\x20');const _0x55abc7=_0x32cef8[0x0];if(!_0x55abc7['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x37a325(0x138)][_0x37a325(0x132)](',\x20');const [_0x15b7c6]=_0x55abc7[_0x37a325(0x10c)]('=',0x2);if(!ProfileSetCommand[_0x37a325(0x138)][_0x37a325(0x128)](_0x15b7c6))return'Unknown\x20key\x20\x27'+_0x15b7c6+_0x37a325(0x13c)+ProfileSetCommand[_0x37a325(0x138)]['join'](',\x20');return undefined;}async[a22_0x2cdd56(0x103)](_0x5416c4){const _0x2acd09=a22_0x2cdd56,{args:_0x1b8781,options:_0x4e0a78}=_0x5416c4,_0x1208d4=_0x4e0a78[_0x2acd09(0x104)]||getActiveProfile(),[_0x16bf21,..._0x48352e]=_0x1b8781[0x0][_0x2acd09(0x10c)]('='),_0x27206e=_0x48352e[_0x2acd09(0x132)]('=');console[_0x2acd09(0x114)](a22_0x4528d7[_0x2acd09(0x101)](_0x2acd09(0x148)));if(!profileExists(_0x1208d4)){const _0x51b879=await a22_0x3b4c16({'type':_0x2acd09(0xf0),'name':_0x2acd09(0x15b),'message':_0x2acd09(0x160)+_0x1208d4+_0x2acd09(0x10f),'initial':!![]});if(!_0x51b879[_0x2acd09(0x15b)])return console['log']('Operation\x20cancelled'),0x1;}const _0x43d522=loadProfile(_0x1208d4),_0x87b63c=_0x43d522?.[_0x2acd09(0x147)]||{};if(_0x16bf21===_0x2acd09(0x120)){const _0xa4e483=resolveSite(_0x27206e);console['log'](_0x2acd09(0x154)+_0xa4e483+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x2acd09(0x114)](_0x2acd09(0x15f)),console[_0x2acd09(0x114)]('\x20\x20'+getConsoleUrl(_0xa4e483,_0x2acd09(0x13b)));const _0x1cc594=await a22_0x3b4c16({'type':_0x2acd09(0x134),'name':_0x2acd09(0x12b),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x56751b=>{const _0x441f3a=_0x2acd09;if(!_0x56751b||!_0x56751b[_0x441f3a(0x137)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x1cc594['apiKey'])return console[_0x2acd09(0x114)]('\x0aOperation\x20cancelled'),0x1;console['log']('Validating\x20API\x20key...');try{const _0xb5e0fb=TDX[_0x2acd09(0x15b)]({'site':_0xa4e483,'apiKey':_0x1cc594[_0x2acd09(0x12b)][_0x2acd09(0x137)](),'logLevel':_0x4e0a78[_0x2acd09(0x145)]??LogLevel[_0x2acd09(0x118)]}),_0x96c118=await _0xb5e0fb[_0x2acd09(0x105)][_0x2acd09(0x112)]();console[_0x2acd09(0x114)](a22_0x4528d7['green']('✓')+_0x2acd09(0x12c)+_0x96c118[_0x2acd09(0x13d)]+')');const _0x29aa96=await isKeychainAvailable();_0x29aa96?(await saveAPIKeyAsync(_0x1cc594[_0x2acd09(0x12b)][_0x2acd09(0x137)](),_0xa4e483,_0x1208d4),console['log'](a22_0x4528d7[_0x2acd09(0x143)]('✓')+_0x2acd09(0x11a))):console[_0x2acd09(0x11e)](a22_0x4528d7[_0x2acd09(0x107)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x87b63c[_0x2acd09(0x120)]=_0xa4e483;}catch(_0x5e1ffe){if(_0x5e1ffe instanceof HTTPClientError&&_0x5e1ffe['status']===0x191)return printAuthError(_0x5e1ffe),0x1;return console[_0x2acd09(0x152)](a22_0x4528d7[_0x2acd09(0x109)](_0x2acd09(0xf6)+(_0x5e1ffe instanceof Error?_0x5e1ffe[_0x2acd09(0x146)]:String(_0x5e1ffe)))),console[_0x2acd09(0x152)](_0x2acd09(0x136)),0x1;}}else _0x87b63c[_0x16bf21]=_0x27206e||undefined;return saveProfileToUserConfig(_0x1208d4,_0x87b63c),console[_0x2acd09(0x114)](a22_0x4528d7[_0x2acd09(0x143)]('✓')+'\x20Profile\x20\x27'+_0x1208d4+'\x27\x20updated:\x20'+_0x16bf21+'='+(_0x27206e||_0x2acd09(0x11d))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0x2cdd56(0x12d)]=a22_0x2cdd56(0x135);['description']=a22_0x2cdd56(0x14b);[a22_0x2cdd56(0x102)](_0x32869f){const _0x4cee34=a22_0x2cdd56,{args:_0x54ac44}=_0x32869f;if(_0x54ac44[_0x4cee34(0x12e)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>';return undefined;}async[a22_0x2cdd56(0x103)](_0x401157){const _0x163ac6=a22_0x2cdd56,{args:_0x2b75a9,options:_0x5e1ed4}=_0x401157,_0x13e407=_0x2b75a9[0x0];cleanExpiredSessions();if(!profileExists(_0x13e407)){console['error'](a22_0x4528d7[_0x163ac6(0x109)](_0x163ac6(0x160)+_0x13e407+_0x163ac6(0x129))),console[_0x163ac6(0x114)](_0x163ac6(0x124));const _0x34ff7b=listProfiles();if(_0x34ff7b[_0x163ac6(0x12e)]===0x0)console[_0x163ac6(0x114)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xe0d53 of _0x34ff7b){console[_0x163ac6(0x114)](_0x163ac6(0x13a)+_0xe0d53[_0x163ac6(0x12d)]);}return 0x1;}const _0xb9fdbd=_0x5e1ed4[_0x163ac6(0xfd)]||getCurrentSessionPID()[_0x163ac6(0xfa)]();return saveSessionContext({'profile':_0x13e407},_0x5e1ed4[_0x163ac6(0xfd)]),console[_0x163ac6(0x114)](_0x163ac6(0x159)+a22_0x4528d7[_0x163ac6(0x143)](_0x13e407)+'\x20'+a22_0x4528d7[_0x163ac6(0x149)](_0x163ac6(0x119)+_0xb9fdbd+')')),console[_0x163ac6(0x114)](a22_0x4528d7['dim'](_0x163ac6(0x15d))),0x0;}}
@@ -1 +1 @@
1
- const a23_0x94739a=a23_0x5af3;function a23_0x5af3(_0x450d8a,_0x62edb2){_0x450d8a=_0x450d8a-0xe3;const _0x5482f3=a23_0x5482();let _0x5af3fd=_0x5482f3[_0x450d8a];return _0x5af3fd;}(function(_0x32d6f6,_0x4aad3c){const _0x14fa2f=a23_0x5af3,_0x70ee87=_0x32d6f6();while(!![]){try{const _0x843641=-parseInt(_0x14fa2f(0xec))/0x1+parseInt(_0x14fa2f(0xee))/0x2*(-parseInt(_0x14fa2f(0xfa))/0x3)+-parseInt(_0x14fa2f(0xf6))/0x4*(parseInt(_0x14fa2f(0xf0))/0x5)+-parseInt(_0x14fa2f(0xf2))/0x6*(parseInt(_0x14fa2f(0xe5))/0x7)+parseInt(_0x14fa2f(0xf3))/0x8*(-parseInt(_0x14fa2f(0xef))/0x9)+parseInt(_0x14fa2f(0xe6))/0xa*(-parseInt(_0x14fa2f(0xe8))/0xb)+parseInt(_0x14fa2f(0xed))/0xc*(parseInt(_0x14fa2f(0xe7))/0xd);if(_0x843641===_0x4aad3c)break;else _0x70ee87['push'](_0x70ee87['shift']());}catch(_0x4cc035){_0x70ee87['push'](_0x70ee87['shift']());}}}(a23_0x5482,0xefb97));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']=a23_0x94739a(0xf9);[a23_0x94739a(0xf5)]=a23_0x94739a(0xf8);async['execute'](_0x583364){const _0x2b82cb=a23_0x94739a,{options:_0x3ba3e2}=_0x583364;try{const _0x3a7328=listProfiles(),_0x3702dc=getActiveProfile();if(_0x3a7328[_0x2b82cb(0xe4)]===0x0)return console[_0x2b82cb(0xf4)](_0x2b82cb(0xeb)),console['log'](_0x2b82cb(0xea)),console[_0x2b82cb(0xf4)](_0x2b82cb(0xe3)),0x0;const _0x5417ca=_0x3a7328['map'](_0x5028b2=>{const _0x42a223=_0x2b82cb,_0x5dc08=_0x5028b2[_0x42a223(0xe9)]===_0x3702dc,_0x3658ab=getProfileParams(_0x5028b2[_0x42a223(0xfb)]);return{'name':_0x5028b2[_0x42a223(0xe9)],'active':_0x5dc08,'scope':_0x5028b2[_0x42a223(0xf7)],'description':_0x5028b2['config'][_0x42a223(0xf5)]||'','params':_0x3658ab};});return await handleSDKOutput(_0x5417ca,_0x3ba3e2),0x0;}catch(_0x485782){return _0x485782 instanceof Error&&console['error'](_0x2b82cb(0xf1)+_0x485782['message']),0x1;}}}function a23_0x5482(){const _0x294a11=['645SACDzt','Error:\x20','2676ZtODLC','17488DfogJn','log','description','60020ZyFOam','scope','List\x20all\x20available\x20profiles','profiles','89769EaLGRq','config','\x20\x20Global:\x20~/.config/tdx/tdx.json','length','11823LVbIMx','20UYiiqP','39pRuyww','9662180niXWdO','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','842677qPwcRV','32689572zrjknX','12pJuSPb','7092wzXuGW'];a23_0x5482=function(){return _0x294a11;};return a23_0x5482();}
1
+ const a23_0x5bb0b0=a23_0xfd71;function a23_0xfd71(_0x3995c9,_0x606d09){_0x3995c9=_0x3995c9-0x127;const _0x98e1d5=a23_0x98e1();let _0xfd715=_0x98e1d5[_0x3995c9];return _0xfd715;}function a23_0x98e1(){const _0x4d5d8e=['name','List\x20all\x20available\x20profiles','error','7DnymiN','scope','4824eUYdxI','3DxyiRF','log','19310CrcvXb','\x20\x20Global:\x20~/.config/tdx/tdx.json','2710790eBvLQJ','6586290WkmNbM','description','232477LsYsdV','execute','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','5133932RlDuJM','message','8997486RQVYya','11423720vYDHeC','Error:\x20','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','config'];a23_0x98e1=function(){return _0x4d5d8e;};return a23_0x98e1();}(function(_0x4f6fd8,_0x5dcb6e){const _0x2e2868=a23_0xfd71,_0x5ba9e6=_0x4f6fd8();while(!![]){try{const _0x556a16=parseInt(_0x2e2868(0x13b))/0x1+-parseInt(_0x2e2868(0x138))/0x2*(parseInt(_0x2e2868(0x134))/0x3)+-parseInt(_0x2e2868(0x127))/0x4+parseInt(_0x2e2868(0x139))/0x5+parseInt(_0x2e2868(0x129))/0x6*(parseInt(_0x2e2868(0x131))/0x7)+parseInt(_0x2e2868(0x12a))/0x8+-parseInt(_0x2e2868(0x133))/0x9*(parseInt(_0x2e2868(0x136))/0xa);if(_0x556a16===_0x5dcb6e)break;else _0x5ba9e6['push'](_0x5ba9e6['shift']());}catch(_0x451766){_0x5ba9e6['push'](_0x5ba9e6['shift']());}}}(a23_0x98e1,0xc423b));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a23_0x5bb0b0(0x12e)]='profiles';[a23_0x5bb0b0(0x13a)]=a23_0x5bb0b0(0x12f);async[a23_0x5bb0b0(0x13c)](_0xcdb24f){const _0x1e547e=a23_0x5bb0b0,{options:_0x586975}=_0xcdb24f;try{const _0x5c586c=listProfiles(),_0x48be45=getActiveProfile();if(_0x5c586c['length']===0x0)return console['log'](_0x1e547e(0x13d)),console['log'](_0x1e547e(0x12c)),console[_0x1e547e(0x135)](_0x1e547e(0x137)),0x0;const _0x340312=_0x5c586c['map'](_0x67deb3=>{const _0x3a26d4=_0x1e547e,_0x392b11=_0x67deb3[_0x3a26d4(0x12e)]===_0x48be45,_0x3f99b0=getProfileParams(_0x67deb3[_0x3a26d4(0x12d)]);return{'name':_0x67deb3[_0x3a26d4(0x12e)],'active':_0x392b11,'scope':_0x67deb3[_0x3a26d4(0x132)],'description':_0x67deb3[_0x3a26d4(0x12d)]['description']||'','params':_0x3f99b0};});return await handleSDKOutput(_0x340312,_0x586975),0x0;}catch(_0x3aedb5){return _0x3aedb5 instanceof Error&&console[_0x1e547e(0x130)](_0x1e547e(0x12b)+_0x3aedb5[_0x1e547e(0x128)]),0x1;}}}
@@ -1 +1 @@
1
- const a24_0x333601=a24_0x51fe;(function(_0x1816e9,_0x49e4ee){const _0x354038=a24_0x51fe,_0x559855=_0x1816e9();while(!![]){try{const _0x55d43d=parseInt(_0x354038(0xd9))/0x1*(parseInt(_0x354038(0xb0))/0x2)+-parseInt(_0x354038(0xbe))/0x3*(-parseInt(_0x354038(0xc5))/0x4)+parseInt(_0x354038(0xc7))/0x5+-parseInt(_0x354038(0xc6))/0x6+parseInt(_0x354038(0xcb))/0x7+parseInt(_0x354038(0xd3))/0x8*(parseInt(_0x354038(0xb1))/0x9)+-parseInt(_0x354038(0xce))/0xa*(parseInt(_0x354038(0xd7))/0xb);if(_0x55d43d===_0x49e4ee)break;else _0x559855['push'](_0x559855['shift']());}catch(_0x208062){_0x559855['push'](_0x559855['shift']());}}}(a24_0x3d9d,0x309c5));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';function a24_0x51fe(_0x15ac4d,_0x5325ed){_0x15ac4d=_0x15ac4d-0xa7;const _0x3d9d03=a24_0x3d9d();let _0x51fe4f=_0x3d9d03[_0x15ac4d];return _0x51fe4f;}import{writeFileSync}from'fs';function a24_0x3d9d(){const _0x23a56f=['Catalog:\x20','Executing\x20query...','elapsedTimeMillis','jobId','join','execute','Executing\x20query\x20[','...','Error:\x20','\x20rows\x20','information_schema','3iIXZog','file','Query\x20completed:\x20Processed\x20','verbose','query','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','setExtra','670684fekbRA','1513566qQsSGO','38480OqXAqD','name','length','processedRows','2644411lFLQxM','\x20-\x20','setJobId','713530AnkKZv','message','site','completedSplits','SQL:\x20','393312wsmsjs','error','setPhase','Run\x20Trino\x20queries\x20(streaming)','33xbCZWK','totalSplits','625OxdYwe','\x0aAll\x20results\x20saved\x20to\x20','validate','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','No\x20SQL\x20provided','stats','options','state','output','database','Schema:\x20','Statement\x20','202SqcBwi','9PcRmBT','\x20splits'];a24_0x3d9d=function(){return _0x23a56f;};return a24_0x3d9d();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a24_0x333601(0xc8)]=a24_0x333601(0xc2);['description']=a24_0x333601(0xd6);async[a24_0x333601(0xb8)](_0x454d95){const _0x13382d=a24_0x333601,{options:_0x3c7d42,args:_0x36a18e,tdx:_0xdbead8}=_0x454d95,_0x478532=_0x36a18e[0x0],_0x1e35e1=_0x3c7d42[_0x13382d(0xbf)];let _0x5305ac;try{if(_0x1e35e1)_0x5305ac=readSqlStatementsFromFile(_0x1e35e1);else{if(_0x478532==='-')_0x5305ac=await readSqlStatementsFromStdin();else{if(_0x478532&&isSqlFilePath(_0x478532))_0x5305ac=readSqlStatementsFromFile(_0x478532);else{if(_0x478532)_0x5305ac=splitSqlStatements(_0x478532);else throw new Error(_0x13382d(0xa8));}}}}catch(_0x40e643){return console[_0x13382d(0xd4)](_0x13382d(0xbb)+_0x40e643[_0x13382d(0xcf)]),0x1;}const _0x4a7350=_0x3c7d42[_0x13382d(0xad)]||_0x13382d(0xbd),_0x2170d8=_0x3c7d42['catalog'];try{const _0x4ca2de=[],_0x4282d6=!!_0x3c7d42[_0x13382d(0xac)];for(let _0x186e73=0x0;_0x186e73<_0x5305ac['length'];_0x186e73++){const _0x2078b3=_0x5305ac[_0x186e73],_0x4a3db5=_0x186e73+0x1,_0x232b12=_0x5305ac[_0x13382d(0xc9)],_0x52c971=_0x232b12>0x1;_0x3c7d42['verbose']&&(console[_0x13382d(0xd4)]('\x0a'+(_0x52c971?'Statement\x20'+_0x4a3db5+'/'+_0x232b12+':':'')),console[_0x13382d(0xd4)]('Site:\x20'+_0x3c7d42[_0x13382d(0xd0)]),console['error'](_0x13382d(0xb3)+(_0x2170d8||'td')),console[_0x13382d(0xd4)](_0x13382d(0xae)+_0x4a7350),console[_0x13382d(0xd4)](_0x13382d(0xd2)+_0x2078b3));const _0x25cf74=_0x52c971?'Executing\x20statement\x20'+_0x4a3db5+'/'+_0x232b12+_0x13382d(0xba):_0x13382d(0xb4);try{const _0x3b873e=await withProgressSpinner(_0x25cf74,async _0x20802f=>{const _0x268b2c=_0x13382d,_0x12c3a3=await _0xdbead8[_0x268b2c(0xc2)]['execute'](_0x2078b3,{'catalog':_0x2170d8,'schema':_0x4a7350,'onJobId':_0x1e9be2=>{const _0x1ab26b=_0x268b2c;_0x20802f[_0x1ab26b(0xcd)](_0x1e9be2);},'onProgress':_0x4d2a95=>{const _0x4f8a5e=_0x268b2c;_0x20802f[_0x4f8a5e(0xd5)](_0x4f8a5e(0xb9)+_0x4d2a95[_0x4f8a5e(0xab)]+']'),_0x20802f[_0x4f8a5e(0xc4)](formatRows(_0x4d2a95[_0x4f8a5e(0xca)])+_0x4f8a5e(0xbc)+_0x4d2a95[_0x4f8a5e(0xd1)]+'/'+_0x4d2a95[_0x4f8a5e(0xd8)]+_0x4f8a5e(0xb2));}});return _0x12c3a3;},{'verbose':_0x3c7d42[_0x13382d(0xc1)]}),_0x461e29=_0x3b873e['data'],_0x425228=_0x461e29[_0x13382d(0xb6)]?'\x20[Job\x20ID:\x20'+_0x461e29['jobId']+']':'',_0x3e9932=_0x52c971?'Statement\x20'+_0x4a3db5+'/'+_0x232b12+_0x13382d(0xcc):'';console[_0x13382d(0xd4)]('✔\x20'+_0x3e9932+_0x13382d(0xc0)+formatRows(_0x461e29[_0x13382d(0xa9)][_0x13382d(0xca)])+_0x13382d(0xbc)+('in\x20'+formatElapsed(_0x461e29[_0x13382d(0xa9)][_0x13382d(0xb5)])+_0x425228));if(_0x52c971&&_0x4282d6){const _0x2cbbc1=resolveOutputOptions(_0x3c7d42),_0x14c84a=await formatQueryOutput(_0x461e29,_0x2cbbc1);_0x4ca2de['push'](_0x14c84a);}else await handleQueryOutput(_0x461e29,_0x3c7d42);}catch(_0x33cd61){const _0x558b82=_0x52c971?_0x13382d(0xaf)+_0x4a3db5+'/'+_0x232b12+':\x0a':'',_0x4d9e02=_0x33cd61 instanceof SDKError?_0x33cd61['originalMessage']:_0x33cd61[_0x13382d(0xcf)];return console[_0x13382d(0xd4)](''+_0x558b82+_0x4d9e02),0x1;}}if(_0x5305ac['length']>0x1&&_0x4282d6&&_0x4ca2de[_0x13382d(0xc9)]>0x0){const _0x22cb50=_0x4ca2de[_0x13382d(0xb7)]('\x0a');writeFileSync(_0x3c7d42[_0x13382d(0xac)],_0x22cb50),console[_0x13382d(0xd4)](_0x13382d(0xda)+_0x3c7d42['output']);}return 0x0;}catch(_0x5293ae){throw _0x5293ae;}}[a24_0x333601(0xdb)](_0x236893){const _0x201578=a24_0x333601,_0x39c73f=_0x236893['args'][0x0],_0x3912a=_0x236893[_0x201578(0xaa)][_0x201578(0xbf)];if(!_0x39c73f&&!_0x3912a)return _0x201578(0xc3);if(_0x39c73f&&_0x3912a)return _0x201578(0xa7);return undefined;}}
1
+ const a24_0x585722=a24_0x25ea;function a24_0x25ea(_0x4e734f,_0x17cebc){_0x4e734f=_0x4e734f-0x18c;const _0x3fa6dd=a24_0x3fa6();let _0x25ea1a=_0x3fa6dd[_0x4e734f];return _0x25ea1a;}(function(_0x4fdcc7,_0x107958){const _0x48f0cd=a24_0x25ea,_0x24cba3=_0x4fdcc7();while(!![]){try{const _0x2ee585=-parseInt(_0x48f0cd(0x196))/0x1+parseInt(_0x48f0cd(0x1b3))/0x2+-parseInt(_0x48f0cd(0x198))/0x3+parseInt(_0x48f0cd(0x1a7))/0x4*(-parseInt(_0x48f0cd(0x193))/0x5)+-parseInt(_0x48f0cd(0x192))/0x6+-parseInt(_0x48f0cd(0x1b0))/0x7+parseInt(_0x48f0cd(0x1a5))/0x8;if(_0x2ee585===_0x107958)break;else _0x24cba3['push'](_0x24cba3['shift']());}catch(_0x302154){_0x24cba3['push'](_0x24cba3['shift']());}}}(a24_0x3fa6,0x5c5c6));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a24_0x3fa6(){const _0x303fbc=['Run\x20Trino\x20queries\x20(streaming)','originalMessage','setJobId','No\x20SQL\x20provided','\x20-\x20','validate','1072169sJiSYt','in\x20','Error:\x20','998324OqaKWw','\x20[Job\x20ID:\x20','file','Executing\x20query\x20[','output','Site:\x20','completedSplits','verbose','Executing\x20query...','processedRows','SQL:\x20','jobId','join','length','args','3394872tmrQZE','2805zFvgAt','catalog','\x20splits','34742iqAJOH','Statement\x20','1025016MGHJsi','\x0aAll\x20results\x20saved\x20to\x20','totalSplits','message','stats','...','description','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','error','execute','\x20rows\x20','elapsedTimeMillis','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','7809792TIUYxB','database','12TQiSGS','query','Schema:\x20'];a24_0x3fa6=function(){return _0x303fbc;};return a24_0x3fa6();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a24_0x585722(0x1a8);[a24_0x585722(0x19e)]=a24_0x585722(0x1aa);async[a24_0x585722(0x1a1)](_0x24da6c){const _0x580ac5=a24_0x585722,{options:_0x2a9607,args:_0x5c1572,tdx:_0x10f591}=_0x24da6c,_0x51adf5=_0x5c1572[0x0],_0x313970=_0x2a9607[_0x580ac5(0x1b5)];let _0x4e2e71;try{if(_0x313970)_0x4e2e71=readSqlStatementsFromFile(_0x313970);else{if(_0x51adf5==='-')_0x4e2e71=await readSqlStatementsFromStdin();else{if(_0x51adf5&&isSqlFilePath(_0x51adf5))_0x4e2e71=readSqlStatementsFromFile(_0x51adf5);else{if(_0x51adf5)_0x4e2e71=splitSqlStatements(_0x51adf5);else throw new Error(_0x580ac5(0x1ad));}}}}catch(_0x506d19){return console[_0x580ac5(0x1a0)](_0x580ac5(0x1b2)+_0x506d19['message']),0x1;}const _0x119a48=_0x2a9607[_0x580ac5(0x1a6)]||'information_schema',_0x33ac6e=_0x2a9607[_0x580ac5(0x194)];try{const _0x211690=[],_0x389333=!!_0x2a9607[_0x580ac5(0x1b7)];for(let _0x39972f=0x0;_0x39972f<_0x4e2e71['length'];_0x39972f++){const _0x4d1c1f=_0x4e2e71[_0x39972f],_0x36478d=_0x39972f+0x1,_0x172d65=_0x4e2e71[_0x580ac5(0x190)],_0x3c1b14=_0x172d65>0x1;_0x2a9607['verbose']&&(console['error']('\x0a'+(_0x3c1b14?_0x580ac5(0x197)+_0x36478d+'/'+_0x172d65+':':'')),console[_0x580ac5(0x1a0)](_0x580ac5(0x1b8)+_0x2a9607['site']),console[_0x580ac5(0x1a0)]('Catalog:\x20'+(_0x33ac6e||'td')),console[_0x580ac5(0x1a0)](_0x580ac5(0x1a9)+_0x119a48),console[_0x580ac5(0x1a0)](_0x580ac5(0x18d)+_0x4d1c1f));const _0x5d221f=_0x3c1b14?'Executing\x20statement\x20'+_0x36478d+'/'+_0x172d65+_0x580ac5(0x19d):_0x580ac5(0x1bb);try{const _0x49a91c=await withProgressSpinner(_0x5d221f,async _0x2aadc5=>{const _0xf7500b=_0x580ac5,_0x48c693=await _0x10f591['query'][_0xf7500b(0x1a1)](_0x4d1c1f,{'catalog':_0x33ac6e,'schema':_0x119a48,'onJobId':_0x3c237c=>{const _0x209bd1=_0xf7500b;_0x2aadc5[_0x209bd1(0x1ac)](_0x3c237c);},'onProgress':_0x2e2e6a=>{const _0xd51a3b=_0xf7500b;_0x2aadc5['setPhase'](_0xd51a3b(0x1b6)+_0x2e2e6a['state']+']'),_0x2aadc5['setExtra'](formatRows(_0x2e2e6a[_0xd51a3b(0x18c)])+_0xd51a3b(0x1a2)+_0x2e2e6a[_0xd51a3b(0x1b9)]+'/'+_0x2e2e6a[_0xd51a3b(0x19a)]+_0xd51a3b(0x195));}});return _0x48c693;},{'verbose':_0x2a9607[_0x580ac5(0x1ba)]}),_0xd2249d=_0x49a91c['data'],_0x2905bf=_0xd2249d[_0x580ac5(0x18e)]?_0x580ac5(0x1b4)+_0xd2249d[_0x580ac5(0x18e)]+']':'',_0x58ba19=_0x3c1b14?_0x580ac5(0x197)+_0x36478d+'/'+_0x172d65+_0x580ac5(0x1ae):'';console[_0x580ac5(0x1a0)]('✔\x20'+_0x58ba19+'Query\x20completed:\x20Processed\x20'+formatRows(_0xd2249d[_0x580ac5(0x19c)][_0x580ac5(0x18c)])+'\x20rows\x20'+(_0x580ac5(0x1b1)+formatElapsed(_0xd2249d[_0x580ac5(0x19c)][_0x580ac5(0x1a3)])+_0x2905bf));if(_0x3c1b14&&_0x389333){const _0x4039b9=resolveOutputOptions(_0x2a9607),_0x2d91f9=await formatQueryOutput(_0xd2249d,_0x4039b9);_0x211690['push'](_0x2d91f9);}else await handleQueryOutput(_0xd2249d,_0x2a9607);}catch(_0x3793c2){const _0x469e94=_0x3c1b14?_0x580ac5(0x197)+_0x36478d+'/'+_0x172d65+':\x0a':'',_0x41038e=_0x3793c2 instanceof SDKError?_0x3793c2[_0x580ac5(0x1ab)]:_0x3793c2[_0x580ac5(0x19b)];return console[_0x580ac5(0x1a0)](''+_0x469e94+_0x41038e),0x1;}}if(_0x4e2e71[_0x580ac5(0x190)]>0x1&&_0x389333&&_0x211690[_0x580ac5(0x190)]>0x0){const _0x5d4a1c=_0x211690[_0x580ac5(0x18f)]('\x0a');writeFileSync(_0x2a9607[_0x580ac5(0x1b7)],_0x5d4a1c),console[_0x580ac5(0x1a0)](_0x580ac5(0x199)+_0x2a9607[_0x580ac5(0x1b7)]);}return 0x0;}catch(_0x52ff6d){throw _0x52ff6d;}}[a24_0x585722(0x1af)](_0x57507e){const _0x14eb2e=a24_0x585722,_0x5069bb=_0x57507e[_0x14eb2e(0x191)][0x0],_0x594aef=_0x57507e['options']['file'];if(!_0x5069bb&&!_0x594aef)return _0x14eb2e(0x19f);if(_0x5069bb&&_0x594aef)return _0x14eb2e(0x1a4);return undefined;}}