@treasuredata/tdx 0.25.2 → 0.25.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) 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/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/mcp-command.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profile-command.js +1 -1
  28. package/dist/commands/profiles-command.js +1 -1
  29. package/dist/commands/query-command.js +1 -1
  30. package/dist/commands/schedule-command.js +1 -1
  31. package/dist/commands/segment-command.js +1 -1
  32. package/dist/commands/segment-create-command.js +1 -1
  33. package/dist/commands/segment-fields-command.js +1 -1
  34. package/dist/commands/segment-pull-command.js +1 -1
  35. package/dist/commands/segment-push-command.js +1 -1
  36. package/dist/commands/segment-update-command.js +1 -1
  37. package/dist/commands/segment-use-command.js +1 -1
  38. package/dist/commands/segment-validate-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/status-command.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/unset-command.js +1 -1
  44. package/dist/commands/use-command.d.ts.map +1 -1
  45. package/dist/commands/use-command.js +1 -1
  46. package/dist/commands/use-command.js.map +1 -1
  47. package/dist/commands/user-command.js +1 -1
  48. package/dist/commands/workflow-command.js +1 -1
  49. package/dist/core/auth.js +1 -1
  50. package/dist/core/command-output.js +1 -1
  51. package/dist/core/config.d.ts +16 -0
  52. package/dist/core/config.d.ts.map +1 -1
  53. package/dist/core/config.js +1 -1
  54. package/dist/core/config.js.map +1 -1
  55. package/dist/core/connection-cache.js +1 -1
  56. package/dist/core/constants.js +1 -1
  57. package/dist/core/credential-cache.js +1 -1
  58. package/dist/core/global-context.js +1 -1
  59. package/dist/core/keychain.js +1 -1
  60. package/dist/core/profile.js +1 -1
  61. package/dist/core/project-config.js +1 -1
  62. package/dist/core/session.js +1 -1
  63. package/dist/core/user-cache.js +1 -1
  64. package/dist/core/version.js +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/mcp/server.js +1 -1
  67. package/dist/mcp/tools/index.js +1 -1
  68. package/dist/mcp/tools/tdx-run.js +1 -1
  69. package/dist/mcp/tools/tdx-search.js +1 -1
  70. package/dist/mcp/utils.js +1 -1
  71. package/dist/proxy/claude-usage-tracker.js +1 -1
  72. package/dist/proxy/passthrough-server.js +1 -1
  73. package/dist/proxy/sse-usage-parser.js +1 -1
  74. package/dist/sdk/agent/agent-config.js +1 -1
  75. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/api.js +1 -1
  83. package/dist/sdk/client/cdp-api-client.js +1 -1
  84. package/dist/sdk/client/endpoints.js +1 -1
  85. package/dist/sdk/client/engage-api-client.js +1 -1
  86. package/dist/sdk/client/http-client.js +1 -1
  87. package/dist/sdk/client/llm-api-client.js +1 -1
  88. package/dist/sdk/client/rate-limiter.js +1 -1
  89. package/dist/sdk/client/td-api-client.js +1 -1
  90. package/dist/sdk/client/trino-api-client.js +1 -1
  91. package/dist/sdk/client/workflow-client.js +1 -1
  92. package/dist/sdk/connection-validator.js +1 -1
  93. package/dist/sdk/connection.js +1 -1
  94. package/dist/sdk/engage.js +1 -1
  95. package/dist/sdk/errors.js +1 -1
  96. package/dist/sdk/index.js +1 -1
  97. package/dist/sdk/io/index.js +1 -1
  98. package/dist/sdk/io/node-filesystem.js +1 -1
  99. package/dist/sdk/job.js +1 -1
  100. package/dist/sdk/journey.js +1 -1
  101. package/dist/sdk/llm/chat-cache.js +1 -1
  102. package/dist/sdk/llm/index.js +1 -1
  103. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  104. package/dist/sdk/llm/model-factors.js +1 -1
  105. package/dist/sdk/query/index.js +1 -1
  106. package/dist/sdk/query/sql-parser.js +1 -1
  107. package/dist/sdk/schedule.js +1 -1
  108. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  109. package/dist/sdk/segment/fields-display.js +1 -1
  110. package/dist/sdk/segment/file-discovery.js +1 -1
  111. package/dist/sdk/segment/journey-utils.js +1 -1
  112. package/dist/sdk/segment/journey-yaml.js +1 -1
  113. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  114. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  115. package/dist/sdk/segment/pull-workflow.js +1 -1
  116. package/dist/sdk/segment/push-workflow.js +1 -1
  117. package/dist/sdk/segment/resolution-context.js +1 -1
  118. package/dist/sdk/segment/segment-path-parser.js +1 -1
  119. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  120. package/dist/sdk/segment/target-resolution.js +1 -1
  121. package/dist/sdk/segment/tdx-config.js +1 -1
  122. package/dist/sdk/segment/validate-files.js +1 -1
  123. package/dist/sdk/segment/yaml-validator.js +1 -1
  124. package/dist/sdk/segment.js +1 -1
  125. package/dist/sdk/types/index.js +1 -1
  126. package/dist/sdk/types/progress.js +1 -1
  127. package/dist/sdk/user.js +1 -1
  128. package/dist/sdk/util/format-detector.js +1 -1
  129. package/dist/sdk/util/formatters.js +1 -1
  130. package/dist/sdk/util/index.js +1 -1
  131. package/dist/sdk/util/tree-formatter.js +1 -1
  132. package/dist/sdk/workflow/archive-validation.js +1 -1
  133. package/dist/sdk/workflow/clone-workflow.js +1 -1
  134. package/dist/sdk/workflow/index.js +1 -1
  135. package/dist/sdk/workflow/pull-workflow.js +1 -1
  136. package/dist/sdk/workflow/push-workflow.js +1 -1
  137. package/dist/sdk/workflow/tdx-config.js +1 -1
  138. package/dist/sdk/workflow/workflow-utils.js +1 -1
  139. package/dist/test-utils/command-runner.js +1 -1
  140. package/dist/test-utils/factories.js +1 -1
  141. package/dist/test-utils/fixtures.js +1 -1
  142. package/dist/test-utils/http-mock.js +1 -1
  143. package/dist/test-utils/index.js +1 -1
  144. package/dist/utils/async.js +1 -1
  145. package/dist/utils/colors.js +1 -1
  146. package/dist/utils/diff.js +1 -1
  147. package/dist/utils/file-permissions.js +1 -1
  148. package/dist/utils/global-cache.js +1 -1
  149. package/dist/utils/json-loader.js +1 -1
  150. package/dist/utils/local-cache.js +1 -1
  151. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  152. package/dist/utils/logger/formatters/index.js +1 -1
  153. package/dist/utils/logger/handlers/console-handler.js +1 -1
  154. package/dist/utils/logger/handlers/file-handler.js +1 -1
  155. package/dist/utils/logger/handlers/index.js +1 -1
  156. package/dist/utils/logger/handlers/null-handler.js +1 -1
  157. package/dist/utils/logger/index.js +1 -1
  158. package/dist/utils/logger/logger.js +1 -1
  159. package/dist/utils/logger/types.js +1 -1
  160. package/dist/utils/option-validation.js +1 -1
  161. package/dist/utils/port.js +1 -1
  162. package/dist/utils/process.js +1 -1
  163. package/dist/utils/prompt.js +1 -1
  164. package/dist/utils/spinner.js +1 -1
  165. package/dist/utils/sse-parser.js +1 -1
  166. package/dist/utils/string-utils.js +1 -1
  167. package/dist/utils/table-ref-parser.js +1 -1
  168. package/dist/utils/tdx-logger.js +1 -1
  169. package/dist/utils/version-check.d.ts +4 -1
  170. package/dist/utils/version-check.d.ts.map +1 -1
  171. package/dist/utils/version-check.js +1 -1
  172. package/dist/utils/version-check.js.map +1 -1
  173. package/package.json +2 -1
@@ -1 +1 @@
1
- const a22_0x14fbc1=a22_0x4d49;(function(_0x5db621,_0xe2bce9){const _0x307904=a22_0x4d49,_0x63a476=_0x5db621();while(!![]){try{const _0x446659=parseInt(_0x307904(0xe5))/0x1*(-parseInt(_0x307904(0xbc))/0x2)+parseInt(_0x307904(0x1da))/0x3*(parseInt(_0x307904(0xe0))/0x4)+parseInt(_0x307904(0x15d))/0x5*(parseInt(_0x307904(0xa4))/0x6)+parseInt(_0x307904(0x101))/0x7+parseInt(_0x307904(0xfa))/0x8+parseInt(_0x307904(0xa3))/0x9+parseInt(_0x307904(0x15f))/0xa*(-parseInt(_0x307904(0x1c3))/0xb);if(_0x446659===_0xe2bce9)break;else _0x63a476['push'](_0x63a476['shift']());}catch(_0x5befc0){_0x63a476['push'](_0x63a476['shift']());}}}(a22_0xca5d,0xa1fc6));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x316a68 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';function a22_0x4d49(_0xc1d108,_0x43ad8e){_0xc1d108=_0xc1d108-0x85;const _0xca5d82=a22_0xca5d();let _0x4d49ea=_0xca5d82[_0xc1d108];return _0x4d49ea;}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,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x36914f 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=a22_0x14fbc1(0x1b5),LEGACY_PARENT_SEGMENT_DIR=a22_0x14fbc1(0xe7);function openBrowser(_0x43a943){const _0x4220ff=a22_0x14fbc1,_0x106a0b=process['platform'],_0x53113e=_0x106a0b===_0x4220ff(0x125)?'open':_0x106a0b===_0x4220ff(0x1b1)?_0x4220ff(0x1bd):'xdg-open';spawn(_0x53113e,[_0x43a943],{'detached':!![],'stdio':_0x4220ff(0xde)})[_0x4220ff(0x1b4)]();}function migrateLegacyDirectory(){const _0x3fa273=a22_0x14fbc1;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x4ffe79=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x4ffe79[_0x3fa273(0x15c)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3fa273(0x11d)](a22_0x36914f['yellow'](_0x3fa273(0xa8)+LEGACY_PARENT_SEGMENT_DIR+_0x3fa273(0xd0)+PARENT_SEGMENT_DIR+_0x3fa273(0x17c))),console[_0x3fa273(0x11d)](a22_0x36914f[_0x3fa273(0x198)](_0x3fa273(0x1b7)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a22_0x36914f[_0x3fa273(0xdf)](_0x3fa273(0x1cf)+LEGACY_PARENT_SEGMENT_DIR+_0x3fa273(0x1a7)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3fa273(0x11d)](a22_0x36914f[_0x3fa273(0x1d2)](_0x3fa273(0xce)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x5ad24a){const _0x554603=_0x5ad24a instanceof Error?_0x5ad24a[_0x3fa273(0x149)]:String(_0x5ad24a);return console[_0x3fa273(0x11d)](a22_0x36914f[_0x3fa273(0xb9)](_0x3fa273(0x1d0)+_0x554603+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x14fbc1(0x96)](_0xcd6b7){const _0x56868f=a22_0x14fbc1;return migrateLegacyDirectory(),super[_0x56868f(0x96)](_0xcd6b7);}}function resolveYamlFile(_0x1a6ee5){const _0x4f2c31=a22_0x14fbc1;if(_0x1a6ee5[_0x4f2c31(0x97)](_0x4f2c31(0x13a))||_0x1a6ee5[_0x4f2c31(0x97)](_0x4f2c31(0x188)))return _0x1a6ee5;return a22_0x316a68['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1a6ee5)+_0x4f2c31(0x13a));}function formatProgressMessage(_0x18b0a1){const _0x366bc0=a22_0x14fbc1,_0x2a908d=_0x18b0a1['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2a908d){const [,_0x1bce59,_0x3b6ee6,_0x2680aa='']=_0x2a908d;return a22_0x36914f[_0x366bc0(0x198)](_0x1bce59+':')+'\x20'+_0x3b6ee6+a22_0x36914f['dim'](_0x2680aa);}return a22_0x36914f['dim'](_0x18b0a1);}function showFileNotFoundError(_0x3fa922,_0x44cfc6){const _0x10e84a=a22_0x14fbc1;console['error'](a22_0x36914f[_0x10e84a(0xb9)](_0x10e84a(0x90)+_0x3fa922+'\x0a')),console[_0x10e84a(0x11d)](a22_0x36914f['cyan'](_0x10e84a(0xa9)+_0x44cfc6+_0x10e84a(0x10a)));}function showParentSegmentNotSetError(_0x22f8b9){const _0x520041=a22_0x14fbc1;console['error'](a22_0x36914f[_0x520041(0xdf)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x520041(0x11d)](_0x22f8b9);}export class ParentSegmentListCommand extends BaseCommand{['name']=a22_0x14fbc1(0x15e);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0xa7);async['execute'](_0x473637){const _0x2f0805=a22_0x14fbc1,{options:_0xe315eb,args:_0x125e09,tdx:_0x32b959}=_0x473637,_0x25dd30=_0x125e09[0x0];_0xe315eb[_0x2f0805(0xed)]&&(console[_0x2f0805(0x11d)](_0x2f0805(0xb1)+_0xe315eb[_0x2f0805(0x18f)]),_0x25dd30&&console[_0x2f0805(0x11d)]('Pattern:\x20'+_0x25dd30));const _0x5682e4=await withSpinner(_0x25dd30?_0x2f0805(0x123)+_0x25dd30+_0x2f0805(0x13b):_0x2f0805(0x190),()=>_0x32b959[_0x2f0805(0x8e)]['listParents'](),{'verbose':_0xe315eb[_0x2f0805(0xed)]});let _0x181d8c=_0x5682e4['data'];if(_0x25dd30){const _0x16af92=_0x25dd30[_0x2f0805(0x189)](/[.+^${}()|[\]\\]/g,_0x2f0805(0x108))[_0x2f0805(0x189)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4b70fc=new RegExp('^'+_0x16af92+'$','i');_0x181d8c=_0x181d8c[_0x2f0805(0xfe)](_0x259645=>_0x4b70fc[_0x2f0805(0x170)](_0x259645[_0x2f0805(0x187)][_0x2f0805(0xb6)]));}_0x181d8c[_0x2f0805(0x8a)]((_0x2b60dd,_0x1bd3fc)=>_0x2b60dd[_0x2f0805(0x187)][_0x2f0805(0xb6)][_0x2f0805(0xc6)](_0x1bd3fc[_0x2f0805(0x187)][_0x2f0805(0xb6)])),console['error'](_0x2f0805(0x1c5)+_0x181d8c[_0x2f0805(0x155)]+_0x2f0805(0x17e)+(_0x181d8c[_0x2f0805(0x155)]!==0x1?'s':''));const _0x1f6669=_0x1fd332=>{const _0x55f329=_0x2f0805;return getConsoleNextUrl(_0xe315eb[_0x55f329(0x18f)],_0x55f329(0x199)+_0x1fd332);};if(_0xe315eb[_0x2f0805(0x147)]==='json'||_0xe315eb[_0x2f0805(0x147)]==='jsonl'){const _0x126e85=_0x181d8c[_0x2f0805(0x106)](_0x1e0d41=>({..._0x1e0d41,'url':_0x1f6669(_0x1e0d41['id'])}));await handleSDKOutput(_0x126e85,_0xe315eb);}else{if(_0x181d8c[_0x2f0805(0x155)]===0x0)_0x25dd30?console['log'](_0x2f0805(0x138)+_0x25dd30):console[_0x2f0805(0xc3)](_0x2f0805(0x169));else for(const _0x4b4e6a of _0x181d8c){const _0x1b3cf5=_0x4b4e6a[_0x2f0805(0x187)][_0x2f0805(0x1e3)]?a22_0x36914f['dim']('\x20('+formatRows(_0x4b4e6a[_0x2f0805(0x187)]['population'])+')'):'',_0x516506=hyperlink(_0x4b4e6a['attributes'][_0x2f0805(0xb6)],_0x1f6669(_0x4b4e6a['id']));console['log'](_0x2f0805(0x111)+_0x516506+_0x1b3cf5);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x11b);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x182);async[a22_0x14fbc1(0x142)](_0x367c66){const _0x202517=a22_0x14fbc1,{options:_0x5b0fbf,args:_0x347698,tdx:_0x4f3bab}=_0x367c66;console[_0x202517(0x11d)](_0x202517(0x129)+_0x202517(0x1d6)+_0x202517(0xb3));const _0x5ed480=_0x5b0fbf;if(_0x347698[_0x202517(0x155)]===0x0)return console['error'](a22_0x36914f[_0x202517(0xb9)](_0x202517(0xac))),console[_0x202517(0x11d)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x2f94a3=_0x347698[0x0];if(!_0x5ed480[_0x202517(0xb8)]||!_0x5ed480[_0x202517(0xc1)])return console[_0x202517(0x11d)](_0x202517(0x10b)),console[_0x202517(0x11d)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x5ed480[_0x202517(0xed)]&&(console[_0x202517(0x11d)](_0x202517(0xb1)+_0x5ed480[_0x202517(0x18f)]),console[_0x202517(0x11d)](_0x202517(0x1be)+_0x2f94a3),console[_0x202517(0x11d)](_0x202517(0x116)+_0x5ed480['database']),console[_0x202517(0x11d)](_0x202517(0xee)+_0x5ed480[_0x202517(0xc1)]));const _0xabe5ad=await loadJSONFromOptions(_0x5ed480[_0x202517(0x187)],_0x5ed480[_0x202517(0xf8)]),_0x52b251=await loadJSONFromOptions(_0x5ed480[_0x202517(0x1cd)],_0x5ed480[_0x202517(0x112)]),_0x1eb9e6=await loadJSONFromOptions(_0x5ed480[_0x202517(0x19f)],_0x5ed480[_0x202517(0x17b)]),_0x10a8a3={'name':_0x2f94a3,'description':_0x5ed480[_0x202517(0xe1)],'scheduleType':_0x5ed480[_0x202517(0xef)],'scheduleOption':_0x5ed480[_0x202517(0x191)],'timezone':_0x5ed480[_0x202517(0xdb)],'master':{'parentDatabaseName':_0x5ed480['database'],'parentTableName':_0x5ed480[_0x202517(0xc1)]},'attributes':_0xabe5ad,'behaviors':_0x52b251,'customerGroup':_0x1eb9e6},_0xb6f58e=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x2f94a3+_0x202517(0x13b),()=>_0x4f3bab[_0x202517(0x8e)][_0x202517(0xd9)](_0x10a8a3),{'verbose':_0x5b0fbf['verbose']}),_0x4f51f9=_0xb6f58e['data'];return console[_0x202517(0x11d)](_0x202517(0x1ad)+_0x4f51f9[_0x202517(0xb6)]+_0x202517(0x1a5)+_0x4f51f9['id']),await handleSDKOutput([_0x4f51f9],_0x5b0fbf),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0xd6);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x1dc);async[a22_0x14fbc1(0x142)](_0x1e51f7){const _0x7048ae=a22_0x14fbc1,{options:_0x4812af,args:_0x47d8df,tdx:_0x5238a0}=_0x1e51f7;console[_0x7048ae(0x11d)](_0x7048ae(0xa5)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x7048ae(0xb3));const _0x4b8d25=_0x4812af;if(_0x47d8df['length']===0x0)return console['error'](a22_0x36914f[_0x7048ae(0xb9)](_0x7048ae(0xac))),console['error'](_0x7048ae(0x107)),0x1;const _0x53fb16=_0x47d8df[0x0];_0x4b8d25[_0x7048ae(0xed)]&&(console['error'](_0x7048ae(0xb1)+_0x4b8d25[_0x7048ae(0x18f)]),console[_0x7048ae(0x11d)]('Parent\x20segment:\x20'+_0x53fb16));const _0x564eaf=await withSpinner(_0x7048ae(0x1aa)+_0x53fb16+_0x7048ae(0x13b),()=>_0x5238a0['segment'][_0x7048ae(0xaf)](_0x53fb16),{'verbose':_0x4b8d25[_0x7048ae(0xed)]}),_0x5f3402=_0x564eaf[_0x7048ae(0x194)],_0x29cb12=await loadJSONFromOptions(_0x4b8d25['addAttributes'],_0x4b8d25[_0x7048ae(0xdd)]),_0x4eaf24=await loadJSONFromOptions(_0x4b8d25[_0x7048ae(0x1de)],_0x4b8d25[_0x7048ae(0x1d3)]),_0x27901e={'name':_0x5f3402[_0x7048ae(0xb6)],'description':_0x4b8d25['description']!==undefined?_0x4b8d25[_0x7048ae(0xe1)]:_0x5f3402[_0x7048ae(0xe1)],'scheduleType':_0x4b8d25[_0x7048ae(0xef)]!==undefined?_0x4b8d25['scheduleType']:_0x5f3402[_0x7048ae(0xef)],'scheduleOption':_0x4b8d25['scheduleOption']!==undefined?_0x4b8d25[_0x7048ae(0x191)]:_0x5f3402['scheduleOption'],'timezone':_0x4b8d25['timezone']!==undefined?_0x4b8d25['timezone']:_0x5f3402['timezone'],'master':_0x5f3402['master'],'attributes':_0x29cb12?[..._0x5f3402[_0x7048ae(0x187)]||[],..._0x29cb12]:_0x5f3402[_0x7048ae(0x187)],'behaviors':_0x4eaf24?[..._0x5f3402[_0x7048ae(0x1cd)]||[],..._0x4eaf24]:_0x5f3402[_0x7048ae(0x1cd)],'customerGroup':_0x5f3402[_0x7048ae(0x19f)]},_0x329ae8=await withSpinner(_0x7048ae(0x1e0)+_0x53fb16+'\x27...',()=>_0x5238a0[_0x7048ae(0x8e)][_0x7048ae(0xba)](_0x53fb16,_0x27901e),{'verbose':_0x4b8d25[_0x7048ae(0xed)]}),_0x472044=_0x329ae8[_0x7048ae(0x194)];return console[_0x7048ae(0x11d)](_0x7048ae(0xda)+_0x472044[_0x7048ae(0xb6)]+'\x27'),await handleSDKOutput([_0x472044],_0x4b8d25),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x16f);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x14fbc1(0x142)](_0x149ced){const _0x3017e9=a22_0x14fbc1,{options:_0x5addd8,args:_0x25191c,tdx:_0x3e0912}=_0x149ced,_0x4bfd82=_0x5addd8,_0x175801=_0x25191c[0x0]||_0x5addd8[_0x3017e9(0xcc)];if(!_0x175801)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x3017e9(0x176)),0x1;if(_0x4bfd82[_0x3017e9(0x1bc)]&&_0x4bfd82['output'])return console[_0x3017e9(0x11d)](a22_0x36914f['red'](_0x3017e9(0xbe))),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x198)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x198)](_0x3017e9(0x19c)+PARENT_SEGMENT_DIR+_0x3017e9(0xc8))),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0xa2)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0x3bd229=_0x4bfd82[_0x3017e9(0xcf)]||a22_0x316a68[_0x3017e9(0xc5)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x175801)+_0x3017e9(0x13a));_0x4bfd82[_0x3017e9(0xed)]&&(console['error'](_0x3017e9(0xb1)+_0x4bfd82['site']),console[_0x3017e9(0x11d)]('Parent\x20segment:\x20'+_0x175801),console[_0x3017e9(0x11d)](_0x3017e9(0x18b)+_0x3bd229));const _0x1bea03=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x175801+_0x3017e9(0x13b),()=>_0x3e0912['segment'][_0x3017e9(0x150)](_0x175801),{'verbose':_0x4bfd82[_0x3017e9(0xed)]}),_0x260705=_0x1bea03[_0x3017e9(0x194)];if(existsSync(_0x3bd229)){const _0x3cc543=readFileSync(_0x3bd229,_0x3017e9(0x104)),_0x3f5ccf=generateDiff(_0x3cc543,_0x260705);if(!hasChanges(_0x3f5ccf))console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x1d2)]('✔')+'\x20No\x20changes\x20-\x20'+a22_0x36914f['cyan'](_0x3bd229)+_0x3017e9(0x109));else{console[_0x3017e9(0x11d)](_0x3017e9(0x115)+_0x3bd229+'\x27:'),console[_0x3017e9(0x11d)]('─'[_0x3017e9(0x86)](0x3c)),console[_0x3017e9(0x11d)](formatDiffWithColors(_0x3f5ccf)),console[_0x3017e9(0x11d)]('─'[_0x3017e9(0x86)](0x3c));if(!_0x4bfd82[_0x3017e9(0x12b)]){if(!isInteractive())return console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0xb9)](_0x3017e9(0x173)),_0x3017e9(0xf6)),console[_0x3017e9(0x11d)](a22_0x36914f['dim'](_0x3017e9(0x93))),0x1;const _0x224b42=await confirmKey('Overwrite\x20\x27'+_0x3bd229+'\x27?');if(!_0x224b42)return console['error'](a22_0x36914f[_0x3017e9(0xdf)](_0x3017e9(0xea))),0x1;}writeFileSync(_0x3bd229,_0x260705,_0x3017e9(0x104)),console['error'](a22_0x36914f[_0x3017e9(0x1d2)]('✔')+_0x3017e9(0x160)+a22_0x36914f['cyan'](_0x3bd229));}}else{const _0x3c018f=a22_0x316a68[_0x3017e9(0x113)](_0x3bd229);!existsSync(_0x3c018f)&&mkdirSync(_0x3c018f,{'recursive':!![]}),writeFileSync(_0x3bd229,_0x260705,_0x3017e9(0x104)),console[_0x3017e9(0x11d)](a22_0x36914f['green']('✔')+_0x3017e9(0x160)+a22_0x36914f[_0x3017e9(0xa2)](_0x3bd229));}return saveSessionContext({'parent_segment':_0x175801},_0x4bfd82[_0x3017e9(0x134)]),console[_0x3017e9(0x11d)](a22_0x36914f[_0x3017e9(0x1d2)]('✔')+_0x3017e9(0xff)+a22_0x36914f[_0x3017e9(0x198)](_0x3017e9(0xe7))+_0x3017e9(0x177)+a22_0x36914f[_0x3017e9(0xa2)](_0x175801)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0xf3);[a22_0x14fbc1(0xe1)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a22_0x14fbc1(0x142)](_0x264399){const _0x2802f4=a22_0x14fbc1,{options:_0x27125e,args:_0x58c436,tdx:_0x5d7945}=_0x264399,_0x1048ac=_0x27125e,_0x40fb8f=_0x58c436[0x0]||_0x27125e['parentSegment'];if(!_0x40fb8f)return showParentSegmentNotSetError(_0x2802f4(0xf2)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment'),0x1;const _0x58265d=resolveYamlFile(_0x40fb8f);if(!existsSync(_0x58265d))return showFileNotFoundError(_0x58265d,_0x40fb8f),0x1;_0x1048ac[_0x2802f4(0xed)]&&(console['error'](_0x2802f4(0xb1)+_0x1048ac['site']),console[_0x2802f4(0x11d)](_0x2802f4(0x9a)+_0x58265d));let _0x28987b;try{_0x28987b=readFileSync(_0x58265d,_0x2802f4(0x104));}catch(_0xf10d2){const _0x1adfda=_0xf10d2 instanceof Error?_0xf10d2['message']:String(_0xf10d2);return console['error'](_0x2802f4(0x94)+_0x1adfda),0x1;}const _0x458d76=await withSpinner('Analyzing\x20changes...',()=>_0x5d7945[_0x2802f4(0x8e)][_0x2802f4(0x171)](_0x28987b),{'verbose':_0x1048ac[_0x2802f4(0xed)]}),_0x2ccf51=_0x458d76[_0x2802f4(0x194)],{isNew:_0x5246e0,name:_0x531f35,hasChanges:_0x3698ba,diffFormatted:_0x3cf46f}=_0x2ccf51;if(!_0x3698ba)return console[_0x2802f4(0x11d)](_0x2802f4(0xb7)+_0x531f35+_0x2802f4(0x121)),0x0;_0x5246e0?console[_0x2802f4(0x11d)](_0x2802f4(0xe8)+_0x531f35+'\x27:'):console[_0x2802f4(0x11d)](_0x2802f4(0x1a8)+_0x531f35+'\x27:');console[_0x2802f4(0x11d)]('─'[_0x2802f4(0x86)](0x3c)),console['error'](_0x3cf46f),console['error']('─'['repeat'](0x3c));const _0x5c01c9=_0x5246e0?'Create\x20parent\x20segment\x20\x27'+_0x531f35+'\x27?':_0x2802f4(0xa1)+_0x531f35+'\x27?';if(!_0x1048ac[_0x2802f4(0x12b)]){if(!isInteractive())return console[_0x2802f4(0x11d)](a22_0x36914f[_0x2802f4(0xb9)](_0x2802f4(0x173)),_0x2802f4(0xf6)),console[_0x2802f4(0x11d)](a22_0x36914f[_0x2802f4(0x198)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x65199=await confirmKey(_0x5c01c9);if(!_0x65199)return console[_0x2802f4(0x11d)](a22_0x36914f[_0x2802f4(0xdf)](_0x2802f4(0xea))),0x1;}const _0x3687b6=_0x5246e0?_0x2802f4(0x139):'Updating',_0x1a33c2=await withSpinner(_0x3687b6+_0x2802f4(0x1af)+_0x531f35+_0x2802f4(0x13b),()=>_0x2ccf51[_0x2802f4(0x17d)](),{'verbose':_0x1048ac[_0x2802f4(0xed)]}),_0x5df2a7=_0x1a33c2['data'],_0x2d028e=getConsoleNextUrl(_0x1048ac['site'],_0x2802f4(0x199)+_0x5df2a7['id']),_0x4f6a29=_0x5246e0?_0x2802f4(0x1b0):'Updated';return console[_0x2802f4(0x11d)]('✔\x20'+_0x4f6a29+_0x2802f4(0x1af)+_0x5df2a7[_0x2802f4(0xb6)]+'\x27'),console[_0x2802f4(0x11d)]('\x20\x20'+_0x2d028e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x14fbc1(0x1a2);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x16b);async[a22_0x14fbc1(0x142)](_0x4f66b2){const _0x21e5bc=a22_0x14fbc1,{options:_0x5b4617,args:_0x1a1ca3,tdx:_0x450845}=_0x4f66b2,_0x238d65=_0x5b4617,_0x6d4f48=_0x1a1ca3[0x0]||_0x5b4617[_0x21e5bc(0xcc)];if(!_0x6d4f48)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x21e5bc(0x9b)+_0x21e5bc(0xca)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+_0x21e5bc(0x128)),0x1;const _0x1a7d60=resolveYamlFile(_0x6d4f48);if(!existsSync(_0x1a7d60))return showFileNotFoundError(_0x1a7d60,_0x6d4f48),0x1;_0x238d65[_0x21e5bc(0xed)]&&(console[_0x21e5bc(0x11d)](_0x21e5bc(0xb1)+_0x238d65['site']),console['error'](_0x21e5bc(0x9a)+_0x1a7d60));let _0x5eee3b;try{_0x5eee3b=readFileSync(_0x1a7d60,_0x21e5bc(0x104));}catch(_0x561c75){const _0x4958e9=_0x561c75 instanceof Error?_0x561c75[_0x21e5bc(0x149)]:String(_0x561c75);return console[_0x21e5bc(0x11d)](_0x21e5bc(0x94)+_0x4958e9),0x1;}const _0x1d946d=createCommandSpinner(a22_0x36914f[_0x21e5bc(0x198)](_0x21e5bc(0x16a)),{'verbose':_0x238d65[_0x21e5bc(0xed)]});_0x1d946d[_0x21e5bc(0x1bd)]();const _0x580b17={'onProgress':_0xf995b0=>{const _0x3cd4e4=_0x21e5bc;_0x1d946d[_0x3cd4e4(0x17a)]=formatProgressMessage(_0xf995b0);}};if(_0x238d65[_0x21e5bc(0xd1)])_0x580b17[_0x21e5bc(0xd1)]=!![];if(_0x238d65[_0x21e5bc(0x1bf)])_0x580b17['enriched']=!![];_0x238d65[_0x21e5bc(0x1ca)]&&(_0x580b17[_0x21e5bc(0x1ca)]=_0x238d65['attribute']);_0x238d65['behavior']&&(_0x580b17[_0x21e5bc(0x157)]=_0x238d65[_0x21e5bc(0x157)]);if(_0x238d65[_0x21e5bc(0x1a3)])_0x580b17['interval']=_0x238d65[_0x21e5bc(0x1a3)];let _0x423584;try{_0x423584=await _0x450845[_0x21e5bc(0x8e)][_0x21e5bc(0x137)](_0x5eee3b,_0x580b17),_0x1d946d[_0x21e5bc(0x13f)]();}catch(_0x5e59af){_0x1d946d['stop']();throw _0x5e59af;}const _0x3dc36e=_0x238d65[_0x21e5bc(0x1a3)]||_0x21e5bc(0x178);return this[_0x21e5bc(0x146)](_0x423584,_0x580b17,_0x1a7d60,_0x3dc36e),_0x423584[_0x21e5bc(0x159)]?0x0:0x1;}['displayValidateResults'](_0x4c06bc,_0x25070f,_0x39d362,_0x46a2ae){const _0x591db1=a22_0x14fbc1;console['error']('\x0a'+a22_0x36914f[_0x591db1(0x1c2)](_0x591db1(0xe2))+'\x20'+_0x4c06bc[_0x591db1(0xb6)]),console[_0x591db1(0x11d)]('═'[_0x591db1(0x86)](0x3c)),this[_0x591db1(0x148)](_0x4c06bc);if(typeof _0x25070f['attribute']===_0x591db1(0x120)){this[_0x591db1(0xa6)](_0x4c06bc),this[_0x591db1(0x9d)](_0x4c06bc),this['displayPreviewHints'](_0x39d362,_0x46a2ae,'attribute',_0x25070f[_0x591db1(0x1ca)]);return;}if(_0x25070f[_0x591db1(0x1ca)]===!![]){this[_0x591db1(0xa6)](_0x4c06bc),this[_0x591db1(0x9d)](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,'attributes');return;}if(typeof _0x25070f['behavior']===_0x591db1(0x120)){this[_0x591db1(0xfc)](_0x4c06bc,_0x46a2ae),this[_0x591db1(0x9d)](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,'behavior',_0x25070f[_0x591db1(0x157)]);return;}if(_0x25070f[_0x591db1(0x157)]===!![]){this['displayBehaviorsStats'](_0x4c06bc,_0x46a2ae),this['displaySummary'](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,_0x591db1(0x1cd));return;}this[_0x591db1(0xa6)](_0x4c06bc),this[_0x591db1(0xfc)](_0x4c06bc,_0x46a2ae),this[_0x591db1(0x9d)](_0x4c06bc),this[_0x591db1(0x195)](_0x39d362,_0x46a2ae,'all');}[a22_0x14fbc1(0x195)](_0x200bdd,_0x54669d,_0x51a32c,_0x21f682){const _0x463072=a22_0x14fbc1;console[_0x463072(0x11d)]('\x0a'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x87)));const _0xa81ebe=_0x54669d!==_0x463072(0x178)?'\x20--interval\x20'+_0x54669d:'';if(_0x51a32c===_0x463072(0x1ca)&&_0x21f682)console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x9f)+_0x21f682+'\x22'+_0xa81ebe));else{if(_0x51a32c==='behavior'&&_0x21f682)console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x8d)+_0x21f682+'\x22'+_0xa81ebe));else(_0x51a32c===_0x463072(0x187)||_0x51a32c===_0x463072(0x131))&&console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x1e4)+_0xa81ebe));}(_0x51a32c==='behaviors'||_0x51a32c==='all')&&console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x463072(0x16d)+_0x200bdd+_0x463072(0xe9)+_0xa81ebe)),_0x51a32c===_0x463072(0x131)&&console[_0x463072(0x11d)]('\x20\x20'+a22_0x36914f[_0x463072(0x198)](_0x463072(0x16d)+_0x200bdd+_0x463072(0x141)+_0xa81ebe));}['displayMasterInfo'](_0x10f18f){const _0xa9134f=a22_0x14fbc1,{master:_0x278b40}=_0x10f18f,_0x2e46dc=_0x278b40['schemaValid']?a22_0x36914f['green']('✔'):a22_0x36914f['red']('✘');console[_0xa9134f(0x11d)]('\x0a'+a22_0x36914f[_0xa9134f(0x198)](_0xa9134f(0xa0))),console[_0xa9134f(0x11d)](_0x2e46dc+'\x20'+a22_0x36914f[_0xa9134f(0x1c2)](_0x278b40[_0xa9134f(0xb8)]+'.'+_0x278b40[_0xa9134f(0xc1)])),_0x278b40[_0xa9134f(0x88)]?_0x278b40[_0xa9134f(0x103)]!==undefined&&console['error']('\x20\x20'+a22_0x36914f[_0xa9134f(0x198)](_0xa9134f(0x144))+'\x20'+a22_0x36914f[_0xa9134f(0xa2)](formatRows(_0x278b40[_0xa9134f(0x103)]))):console[_0xa9134f(0x11d)]('\x20\x20'+a22_0x36914f[_0xa9134f(0xb9)](_0xa9134f(0xc7))+'\x20'+_0x278b40[_0xa9134f(0x9c)]);}['displayAttributesStats'](_0x52d413){const _0x532c3b=a22_0x14fbc1;if(_0x52d413[_0x532c3b(0x187)][_0x532c3b(0x155)]===0x0)return;console[_0x532c3b(0x11d)]('\x0a'+a22_0x36914f[_0x532c3b(0x198)](_0x532c3b(0x85)));for(const _0x5c3534 of _0x52d413[_0x532c3b(0x187)]){const _0x3fbda1=_0x5c3534['schemaValid']?a22_0x36914f[_0x532c3b(0x1d2)]('✔'):a22_0x36914f[_0x532c3b(0xb9)]('✘');let _0x1357b9='';if(_0x5c3534['schemaValid']&&_0x5c3534[_0x532c3b(0x18a)]!==undefined&&_0x5c3534[_0x532c3b(0x95)]!==undefined){const _0x2d052b=_0x5c3534[_0x532c3b(0x95)]['toFixed'](0x1),_0x3d90ad=_0x5c3534[_0x532c3b(0x95)]>=0x50?a22_0x36914f['green']:_0x5c3534[_0x532c3b(0x95)]>=0x32?a22_0x36914f['yellow']:a22_0x36914f[_0x532c3b(0xb9)];_0x1357b9='\x20'+a22_0x36914f[_0x532c3b(0x198)]('Coverage:')+'\x20'+_0x3d90ad(_0x2d052b+'%')+'\x20('+formatRows(_0x5c3534[_0x532c3b(0x18a)])+_0x532c3b(0x166);}console[_0x532c3b(0x11d)](_0x3fbda1+'\x20'+a22_0x36914f['bold'](_0x5c3534[_0x532c3b(0xb6)])+_0x1357b9),console[_0x532c3b(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x532c3b(0x11f))+'\x20'+a22_0x36914f['bold'](_0x5c3534['database']+'.'+_0x5c3534['table']));const _0x3df20c=_0x5c3534[_0x532c3b(0xf1)]===_0x5c3534[_0x532c3b(0x1d7)]?a22_0x36914f[_0x532c3b(0x198)]('Join\x20on:')+'\x20'+_0x5c3534[_0x532c3b(0xf1)]:a22_0x36914f[_0x532c3b(0x198)](_0x532c3b(0xbd))+'\x20'+_0x5c3534[_0x532c3b(0xf1)]+_0x532c3b(0x177)+_0x5c3534['foreignKey'];console[_0x532c3b(0x11d)]('\x20\x20'+_0x3df20c),console[_0x532c3b(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x532c3b(0x126))),this['displayColumns'](_0x5c3534[_0x532c3b(0x175)]),!_0x5c3534[_0x532c3b(0x88)]&&console[_0x532c3b(0x11d)]('\x20\x20'+a22_0x36914f[_0x532c3b(0xb9)]('Error:')+'\x20'+_0x5c3534[_0x532c3b(0x9c)]);}}[a22_0x14fbc1(0xfc)](_0x358ac0,_0x5716d8){const _0x5a4ebd=a22_0x14fbc1;if(_0x358ac0[_0x5a4ebd(0x1cd)][_0x5a4ebd(0x155)]===0x0)return;console['error']('\x0a'+a22_0x36914f[_0x5a4ebd(0x198)](_0x5a4ebd(0x1d9))+'\x20'+a22_0x36914f[_0x5a4ebd(0x198)]('('+_0x5716d8+')'));for(const _0x2496fe of _0x358ac0[_0x5a4ebd(0x1cd)]){const _0x2ec9d5=_0x2496fe['schemaValid']?a22_0x36914f[_0x5a4ebd(0x1d2)]('✔'):a22_0x36914f[_0x5a4ebd(0xb9)]('✘');let _0x5e81b2='';if(_0x2496fe['schemaValid']&&_0x2496fe['customersWithEvents']!==undefined&&_0x2496fe[_0x5a4ebd(0x151)]!==undefined){const _0x2a5303=_0x2496fe['customerPercent']?.[_0x5a4ebd(0x122)](0x1)||'?',_0x13c77a=(_0x2496fe['customerPercent']??0x0)>=0x32?a22_0x36914f[_0x5a4ebd(0x1d2)]:(_0x2496fe[_0x5a4ebd(0xdc)]??0x0)>=0x14?a22_0x36914f[_0x5a4ebd(0xdf)]:a22_0x36914f[_0x5a4ebd(0xb9)];_0x5e81b2='\x20'+a22_0x36914f['dim'](_0x5a4ebd(0xb5))+'\x20'+_0x13c77a(formatRows(_0x2496fe[_0x5a4ebd(0x1c7)]))+'\x20('+_0x2a5303+'%)\x20'+a22_0x36914f[_0x5a4ebd(0x198)]('Events:')+'\x20'+a22_0x36914f[_0x5a4ebd(0xa2)](formatRows(_0x2496fe['totalEvents']));}console['error'](_0x2ec9d5+'\x20'+a22_0x36914f[_0x5a4ebd(0x1c2)](_0x2496fe[_0x5a4ebd(0xb6)])+_0x5e81b2),console[_0x5a4ebd(0x11d)]('\x20\x20'+a22_0x36914f[_0x5a4ebd(0x198)](_0x5a4ebd(0x11f))+'\x20'+a22_0x36914f[_0x5a4ebd(0x1c2)](_0x2496fe[_0x5a4ebd(0xb8)]+'.'+_0x2496fe[_0x5a4ebd(0xc1)]));const _0x29aa00=_0x2496fe['joinKey']===_0x2496fe['foreignKey']?a22_0x36914f[_0x5a4ebd(0x198)](_0x5a4ebd(0x154))+'\x20'+_0x2496fe[_0x5a4ebd(0xf1)]:a22_0x36914f['dim']('Join:')+'\x20'+_0x2496fe[_0x5a4ebd(0xf1)]+_0x5a4ebd(0x177)+_0x2496fe['foreignKey'];console[_0x5a4ebd(0x11d)]('\x20\x20'+_0x29aa00),console[_0x5a4ebd(0x11d)]('\x20\x20'+a22_0x36914f['dim'](_0x5a4ebd(0x126))),this[_0x5a4ebd(0x165)](_0x2496fe[_0x5a4ebd(0x175)]),!_0x2496fe[_0x5a4ebd(0x88)]&&console['error']('\x20\x20'+a22_0x36914f[_0x5a4ebd(0xb9)](_0x5a4ebd(0xc7))+'\x20'+_0x2496fe['schemaError']);}}[a22_0x14fbc1(0x165)](_0x4f352c){const _0x5d57af=a22_0x14fbc1;for(const _0x401654 of _0x4f352c){_0x401654['label']===_0x401654[_0x5d57af(0x102)]||_0x401654['column']==='*'?console[_0x5d57af(0x11d)](_0x5d57af(0x183)+_0x401654['label']):console['error'](_0x5d57af(0x183)+_0x401654[_0x5d57af(0x1ac)]+'\x20'+a22_0x36914f[_0x5d57af(0x198)]('('+_0x401654[_0x5d57af(0x102)]+')'));}}['displaySummary'](_0x55e4cd){const _0x49e168=a22_0x14fbc1;console['error']('─'[_0x49e168(0x86)](0x3c));if(_0x55e4cd['errors'][_0x49e168(0x155)]>0x0){console[_0x49e168(0x11d)]('\x0a'+a22_0x36914f['red']('Errors:'));for(const _0x1817a6 of _0x55e4cd[_0x49e168(0x13e)]){console[_0x49e168(0x11d)]('\x20\x20'+a22_0x36914f[_0x49e168(0xb9)]('•')+'\x20'+_0x1817a6);}}_0x55e4cd[_0x49e168(0x159)]&&console['error']('\x0a'+a22_0x36914f[_0x49e168(0x1d2)]('✔')+_0x49e168(0xd4));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x168);['description']=a22_0x14fbc1(0x180);async[a22_0x14fbc1(0x142)](_0xec639c){const _0x543011=a22_0x14fbc1,{options:_0x2041f0,args:_0x4e26b6,tdx:_0x1062b3}=_0xec639c,_0x406de7=_0x2041f0,_0x4fb472=_0x4e26b6[0x0]||_0x2041f0['parentSegment'];if(!_0x4fb472)return showParentSegmentNotSetError(_0x543011(0x161)+_0x543011(0x1ab)+_0x543011(0xeb)+_0x543011(0x124)+_0x543011(0x15b)+_0x543011(0x1a9)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x543011(0x128)),0x1;if(!_0x406de7[_0x543011(0xd1)]&&!_0x406de7[_0x543011(0x1ca)]&&!_0x406de7['behavior']&&!_0x406de7[_0x543011(0x1bf)])return console[_0x543011(0x11d)](a22_0x36914f['red'](_0x543011(0x11a))),console[_0x543011(0x11d)](_0x543011(0x16e)),console[_0x543011(0x11d)](_0x543011(0xe3)),console[_0x543011(0x11d)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x543011(0x1ae)),console['error'](_0x543011(0xd7)),console[_0x543011(0x11d)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0xd9d266=resolveYamlFile(_0x4fb472);if(!existsSync(_0xd9d266))return showFileNotFoundError(_0xd9d266,_0x4fb472),0x1;_0x406de7['verbose']&&(console[_0x543011(0x11d)](_0x543011(0xb1)+_0x406de7[_0x543011(0x18f)]),console[_0x543011(0x11d)](_0x543011(0x9a)+_0xd9d266));let _0x8ba420;try{_0x8ba420=readFileSync(_0xd9d266,_0x543011(0x104));}catch(_0x39b507){const _0x203426=_0x39b507 instanceof Error?_0x39b507[_0x543011(0x149)]:String(_0x39b507);return console[_0x543011(0x11d)](_0x543011(0x94)+_0x203426),0x1;}let _0x34cd5e;try{_0x34cd5e=parseDef(_0x8ba420);}catch(_0x239bcd){const _0x29002e=_0x239bcd instanceof Error?_0x239bcd[_0x543011(0x149)]:String(_0x239bcd);return console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0xcb)+_0x29002e)),0x1;}if(_0x406de7[_0x543011(0x1ca)]===!![]||_0x406de7[_0x543011(0x1ca)]===''){const _0x4905da=_0x34cd5e[_0x543011(0x187)]?.['map'](_0x4037e2=>_0x4037e2['name'])||[];if(_0x4905da['length']===0x0)console['error'](a22_0x36914f[_0x543011(0xb9)](_0x543011(0x1df)));else{console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0x1b3))),console[_0x543011(0x11d)]('Available\x20attributes:');for(const _0x2e3361 of _0x4905da){console[_0x543011(0x11d)]('\x20\x20'+a22_0x36914f[_0x543011(0xa2)](_0x2e3361));}console['error'](_0x543011(0x1bb)+_0x4fb472+'\x20--attribute\x20\x22'+_0x4905da[0x0]+'\x22');}return 0x1;}if(_0x406de7[_0x543011(0x157)]===!![]||_0x406de7[_0x543011(0x157)]===''){const _0x2ed189=_0x34cd5e[_0x543011(0x1cd)]?.['map'](_0x56f5ef=>_0x56f5ef[_0x543011(0xb6)])||[];if(_0x2ed189['length']===0x0)console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0xd5)));else{console[_0x543011(0x11d)](a22_0x36914f[_0x543011(0xb9)](_0x543011(0xb2))),console[_0x543011(0x11d)](_0x543011(0xf9));for(const _0x5545c6 of _0x2ed189){console[_0x543011(0x11d)]('\x20\x20'+a22_0x36914f['cyan'](_0x5545c6));}console[_0x543011(0x11d)](_0x543011(0x1bb)+_0x4fb472+_0x543011(0x8d)+_0x2ed189[0x0]+'\x22');}return 0x1;}const _0x2ea74f=createCommandSpinner(a22_0x36914f[_0x543011(0x198)](_0x543011(0x179)),{'verbose':_0x406de7[_0x543011(0xed)]});_0x2ea74f[_0x543011(0x1bd)]();const _0x3cf098={'onProgress':_0x1bfff6=>{const _0x561bbe=_0x543011;_0x2ea74f[_0x561bbe(0x17a)]=formatProgressMessage(_0x1bfff6);}};if(_0x406de7[_0x543011(0xd1)])_0x3cf098[_0x543011(0xd1)]=!![];if(_0x406de7[_0x543011(0x1ca)]&&typeof _0x406de7[_0x543011(0x1ca)]==='string')_0x3cf098[_0x543011(0x1ca)]=_0x406de7['attribute'];if(_0x406de7[_0x543011(0x157)]&&typeof _0x406de7[_0x543011(0x157)]==='string')_0x3cf098['behavior']=_0x406de7[_0x543011(0x157)];if(_0x406de7[_0x543011(0x1bf)])_0x3cf098[_0x543011(0x1bf)]=!![];if(_0x406de7['interval'])_0x3cf098[_0x543011(0x1a3)]=_0x406de7[_0x543011(0x1a3)];let _0x742b04;try{_0x742b04=await _0x1062b3[_0x543011(0x8e)][_0x543011(0x127)](_0x8ba420,_0x3cf098),_0x2ea74f[_0x543011(0x13f)]();}catch(_0x1798f6){_0x2ea74f['stop']();throw _0x1798f6;}return await this['displayPreviewResults'](_0x742b04,{'master':_0x406de7[_0x543011(0xd1)],'attribute':typeof _0x406de7[_0x543011(0x1ca)]===_0x543011(0x120)?_0x406de7[_0x543011(0x1ca)]:undefined,'behavior':typeof _0x406de7[_0x543011(0x157)]===_0x543011(0x120)?_0x406de7['behavior']:undefined,'enriched':_0x406de7['enriched']}),_0x742b04[_0x543011(0x159)]?0x0:0x1;}async[a22_0x14fbc1(0x186)](_0x19d3f3,_0x46d0eb){const _0x18d1c9=a22_0x14fbc1;console['error']('\x0a'+a22_0x36914f['bold'](_0x18d1c9(0x15a))+'\x20'+_0x19d3f3[_0x18d1c9(0xb6)]),console[_0x18d1c9(0x11d)]('═'[_0x18d1c9(0x86)](0x3c));if(_0x46d0eb[_0x18d1c9(0xd1)]&&_0x19d3f3[_0x18d1c9(0x16c)]){const _0x26e307=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x145))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)](_0x19d3f3['master'][_0x18d1c9(0xb8)]+'.'+_0x19d3f3[_0x18d1c9(0xd1)][_0x18d1c9(0xc1)]);await this[_0x18d1c9(0x1e2)](_0x26e307,_0x19d3f3[_0x18d1c9(0x16c)]);}else{if(_0x46d0eb[_0x18d1c9(0x1ca)]&&_0x19d3f3[_0x18d1c9(0x16c)]){const _0xad0cd3=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x10d))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)](_0x46d0eb[_0x18d1c9(0x1ca)]);await this['displaySampleData'](_0xad0cd3,_0x19d3f3[_0x18d1c9(0x16c)]);}else{if(_0x46d0eb[_0x18d1c9(0x157)]&&_0x19d3f3['sampleData']){const _0x54cfc8=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x14d))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)](_0x46d0eb[_0x18d1c9(0x157)]);await this[_0x18d1c9(0x1e2)](_0x54cfc8,_0x19d3f3[_0x18d1c9(0x16c)]);}else{if(_0x46d0eb['enriched']&&_0x19d3f3['sampleData']){const _0x7ed79c=a22_0x36914f[_0x18d1c9(0x198)](_0x18d1c9(0x1b9))+'\x20'+a22_0x36914f[_0x18d1c9(0x1c2)]('Master\x20+\x20Attributes');await this[_0x18d1c9(0x1e2)](_0x7ed79c,_0x19d3f3[_0x18d1c9(0x16c)]);}else!_0x19d3f3[_0x18d1c9(0x16c)]&&console[_0x18d1c9(0x11d)](_0x18d1c9(0x193));}}}if(_0x19d3f3['errors'][_0x18d1c9(0x155)]>0x0){console[_0x18d1c9(0x11d)]('─'[_0x18d1c9(0x86)](0x3c)),console[_0x18d1c9(0x11d)]('\x0a'+a22_0x36914f[_0x18d1c9(0xb9)](_0x18d1c9(0x174)));for(const _0x17eba6 of _0x19d3f3[_0x18d1c9(0x13e)]){console['error']('\x20\x20'+a22_0x36914f['red']('•')+'\x20'+_0x17eba6);}}}async[a22_0x14fbc1(0x1e2)](_0x3dbe85,_0x3d5234){const _0x3a3f1c=a22_0x14fbc1;if(_0x3d5234[_0x3a3f1c(0x155)]===0x0){console[_0x3a3f1c(0x11d)]('\x0a'+_0x3dbe85),console[_0x3a3f1c(0x11d)](_0x3a3f1c(0x14e));return;}console[_0x3a3f1c(0x11d)]('\x0a'+_0x3dbe85);const _0x3a8628=Object[_0x3a3f1c(0xd3)](_0x3d5234[0x0])[_0x3a3f1c(0x106)](_0x509842=>({'name':_0x509842,'type':typeof _0x3d5234[0x0][_0x509842]===_0x3a3f1c(0x1c4)?_0x3a3f1c(0xd8):_0x3a3f1c(0x12f)})),_0x4cf0dc={'queryId':_0x3a3f1c(0x1d1),'columns':_0x3a8628,'data':_0x3d5234,'stats':{'state':_0x3a3f1c(0x1d8),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x3d5234[_0x3a3f1c(0x155)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x53bfc2=formatAsTable(_0x4cf0dc,_0x3d5234[_0x3a3f1c(0x155)],!![]);await writeOutput(_0x53bfc2,undefined,_0x3a3f1c(0xc1));}}function a22_0xca5d(){const _0x4d37a2=['allValid','Preview:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','isDirectory','5sqVNfU','segment:parent:list','10CeBRAU','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x20field','\x20\x20Tables:\x201\x20customers\x20+\x20','/app/workflows/','displayColumns','\x20rows)','collectSchema','segment:parent:preview','No\x20parent\x20segments\x20found','Validating\x20configuration...','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','sampleData','tdx\x20segment\x20parent\x20preview\x20','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','segment:parent:pull','test','pushParentYaml','\x20behaviors','\x0aError:','Errors:','columns','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20=\x20','-1d','Fetching\x20sample\x20data...','text','customerGroupFile','/\x20directories\x20exist.','apply','\x20parent\x20segment','Show\x20parent\x20segment\x20details','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x22\x20}','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20-\x20','/sessions/','processedRows','displayPreviewResults','attributes','.yaml','replace','matchedCount','Output\x20file:\x20','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','runParent','site','Listing\x20parent\x20segments...','scheduleOption','Fetching\x20parent\x20segment\x20\x27','\x0aNo\x20sample\x20data\x20available','data','displayPreviewHints','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Parent\x20segment:\x20','dim','/app/dw/parentSegments/','push','segment:parent:fields','using\x20the\x20default\x20path:\x20','Session:','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','customerGroup','Fetching\x20behavior\x20list...','segment:parent:desc','segment:parent:validate','interval','audienceId','\x27\x20with\x20ID:\x20','\x27\x20is\x20up\x20to\x20date','/\x20→\x20','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','label','✔\x20Created\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20parent\x20segment\x20\x27','Created','win32','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Error:\x20--attribute\x20requires\x20a\x20name\x0a','unref','parent_segments','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','✔\x20Query\x20completed:\x20Processed\x20','Enriched:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','\x0aUsage:\x20tdx\x20ps\x20preview\x20','use','start','Name:\x20','enriched','\x0a\x20\x20\x20\x20}','getBehaviorNames','bold','28967521jXOmtD','number','✔\x20Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','customersWithEvents','workflowAttemptId','Schema\x20saved\x20to\x20','attribute','elapsedTimeMillis','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','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20Migrating:\x20','✘\x20Failed\x20to\x20rename\x20directory:\x20','preview','green','addBehaviorsFile','\x0a✔\x20Workflow\x20started','getParentSQL','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','foreignKey','FINISHED','Behaviors','676047YmavRQ','segment:parent:sql','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','addBehaviors','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Updating\x20parent\x20segment\x20\x27','Status:','displaySampleData','population','\x20--attribute\x20\x22<name>\x22','Attributes','repeat','To\x20view\x20sample\x20data:','schemaValid','SELECT\x20*\x20FROM\x20','sort','query','getOutputDatabaseName','\x20--behavior\x20\x22','segment','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Error:\x20File\x20not\x20found:\x20','Listing\x20fields\x20for\x20\x27','\x20[Job\x20ID:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Error\x20reading\x20file:\x20','coveragePercent','run','endsWith','Analyzing\x20changes...','\x27\x20and\x20run\x20workflow?','YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','schemaError','displaySummary','Resolving\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22','Master\x20Table','Apply\x20changes\x20to\x20\x27','cyan','11833371oDbWOj','5306118ZajFzD','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','displayAttributesStats','List\x20parent\x20segments','\x0a⚠️\x20\x20Both\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20Opening\x20','Updating','Error:\x20Parent\x20segment\x20name\x20is\x20required','in\x20','formatSchemaJson','getParentFull','jsonl','Site:\x20','Error:\x20--behavior\x20requires\x20a\x20name\x0a','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','limit','Customers:','name','✔\x20No\x20changes\x20-\x20\x27','database','red','updateParent','\x20\x20Columns:\x20','82yzlYHS','Join:','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Updated','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','table','information_schema','log','segment:parent:view','join','localeCompare','Error:','/{name}.yml\x0a','type','Options:\x0a','Error\x20parsing\x20YAML:\x20','parentSegment','workflowSessionId','✔\x20Renamed\x20directory\x20to\x20','output','/\x20and\x20','master','Attempt:','keys','\x20Configuration\x20is\x20valid','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','segment:parent:update','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','double','createParent','✔\x20Updated\x20parent\x20segment\x20\x27','timezone','customerPercent','addAttributesFile','ignore','yellow','8PzmEzQ','description','Validate:','Options:','Found\x20YAML\x20file:\x20','20819QLjkUJ','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','parent_segment','\x0aNew\x20parent\x20segment\x20\x27','\x20--behavior\x20\x22<name>\x22','Aborted.','Options\x20(one\x20required):\x0a','resolveParentId','verbose','Table:\x20','scheduleType','Executing\x20parent\x20segment\x20query...','joinKey','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','segment:parent:push','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','toLocaleString','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','attributesFile','Available\x20behaviors:','6179800rMfRkT','customers','displayBehaviorsStats','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','filter','\x20Context\x20set:\x20','jobId','5096973xshbCy','column','rowCount','utf-8','Fetching\x20SQL\x20for\x20\x27','map','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x5c$&','\x20is\x20already\x20up\x20to\x20date','`\x20to\x20download\x20the\x20configuration\x20first','Error:\x20--database\x20and\x20--table\x20are\x20required','listFields','Attribute:','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Output\x20Database:','.customers)','👥\x20','behaviorsFile','dirname','parent_id','\x0aChanges\x20to\x20\x27','Database:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x20kill','column_type','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','segment:parent:create','column_name','error','{\x0a\x20\x20\x22database\x22:\x20\x22','Source:','string','\x27\x20is\x20already\x20up\x20to\x20date','toFixed','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','darwin','Columns:','previewParentYaml','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','yes','setJobId','\x20\x20Database:\x20','Fetching\x20customers\x20schema...','varchar','\x20total','all','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','To\x20cancel:','session','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','toLowerCase','validateParentYaml','No\x20parent\x20segments\x20match\x20pattern:\x20','Creating','.yml','\x27...','trim','status','errors','stop','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20--enriched','execute','reduce','Rows:','Master:','displayValidateResults','format','displayMasterInfo','message','behavior_','workflowId','stats','Behavior:','\x20\x20No\x20sample\x20data\x20available','json','pullParentYaml','totalEvents','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','List\x20available\x20fields\x20for\x20segmentation','Join\x20on:','length','\x0a\x20\x20]\x0a}\x0a','behavior','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'];a22_0xca5d=function(){return _0x4d37a2;};return a22_0xca5d();}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x14fbc1(0xb6)]='segment:parent:run';[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x152);async[a22_0x14fbc1(0x142)](_0xe3fc1b){const _0x9bb9b6=a22_0x14fbc1,{options:_0x3670f2,args:_0x2f2fe9,tdx:_0x14ae0f}=_0xe3fc1b,_0x11162c=_0x3670f2,_0x37e6da=_0x2f2fe9[0x0]||_0x3670f2[_0x9bb9b6(0xcc)];if(!_0x37e6da)return showParentSegmentNotSetError(_0x9bb9b6(0x10e)+_0x9bb9b6(0x1c6)),0x1;const _0x46f3d8=resolveYamlFile(_0x37e6da);if(existsSync(_0x46f3d8)){_0x11162c[_0x9bb9b6(0xed)]&&console[_0x9bb9b6(0x11d)](_0x9bb9b6(0xe4)+_0x46f3d8);let _0x2110e4;try{_0x2110e4=readFileSync(_0x46f3d8,_0x9bb9b6(0x104));}catch(_0x627ebf){const _0x17547f=_0x627ebf instanceof Error?_0x627ebf[_0x9bb9b6(0x149)]:String(_0x627ebf);return console[_0x9bb9b6(0x11d)](_0x9bb9b6(0x94)+_0x17547f),0x1;}const _0x307d59=await withSpinner(_0x9bb9b6(0x98),()=>_0x14ae0f['segment'][_0x9bb9b6(0x171)](_0x2110e4),{'verbose':_0x11162c[_0x9bb9b6(0xed)]}),_0x31fd5b=_0x307d59[_0x9bb9b6(0x194)],{isNew:_0x2b4131,name:_0x2dcf48,hasChanges:_0x2ccbea,diffFormatted:_0x3fbec5}=_0x31fd5b;if(_0x2ccbea){_0x2b4131?console[_0x9bb9b6(0x11d)](_0x9bb9b6(0xe8)+_0x2dcf48+'\x27:'):console[_0x9bb9b6(0x11d)](_0x9bb9b6(0x1a8)+_0x2dcf48+'\x27:');console['error']('─'[_0x9bb9b6(0x86)](0x3c)),console['error'](_0x3fbec5),console[_0x9bb9b6(0x11d)]('─'[_0x9bb9b6(0x86)](0x3c));const _0x21f35e=_0x2b4131?'Create\x20parent\x20segment\x20\x27'+_0x2dcf48+_0x9bb9b6(0x99):_0x9bb9b6(0xa1)+_0x2dcf48+_0x9bb9b6(0x99);if(!_0x11162c[_0x9bb9b6(0x12b)]){if(!isInteractive())return console[_0x9bb9b6(0x11d)](a22_0x36914f['red'](_0x9bb9b6(0x173)),_0x9bb9b6(0xf6)),console[_0x9bb9b6(0x11d)](a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x93))),0x1;const _0x51a63b=await confirmKey(_0x21f35e);if(!_0x51a63b)return console['error'](a22_0x36914f['yellow'](_0x9bb9b6(0xea))),0x1;}const _0x382a71=_0x2b4131?_0x9bb9b6(0x139):_0x9bb9b6(0xab);await withSpinner(_0x382a71+_0x9bb9b6(0x1af)+_0x2dcf48+'\x27...',()=>_0x31fd5b[_0x9bb9b6(0x17d)](),{'verbose':_0x11162c[_0x9bb9b6(0xed)]});const _0x1f3da5=_0x2b4131?_0x9bb9b6(0x1b0):_0x9bb9b6(0xbf);console[_0x9bb9b6(0x11d)]('✔\x20'+_0x1f3da5+_0x9bb9b6(0x1af)+_0x2dcf48+'\x27');}else console[_0x9bb9b6(0x11d)](_0x9bb9b6(0xb7)+_0x2dcf48+_0x9bb9b6(0x1a6));}const _0x11edff=await withSpinner(_0x9bb9b6(0x132)+_0x37e6da+_0x9bb9b6(0x13b),()=>_0x14ae0f[_0x9bb9b6(0x8e)][_0x9bb9b6(0x18e)](_0x37e6da),{'verbose':_0x11162c['verbose']}),_0x50e3a4=_0x11edff['data'],_0x42e4d3=getConsoleUrl(_0x11162c[_0x9bb9b6(0x18f)],_0x9bb9b6(0x164)+_0x50e3a4[_0x9bb9b6(0x14b)]+_0x9bb9b6(0x184)+_0x50e3a4[_0x9bb9b6(0xcd)]+'/attempt/'+_0x50e3a4['workflowAttemptId']);return console[_0x9bb9b6(0x11d)](_0x9bb9b6(0x1d4)),console[_0x9bb9b6(0x11d)]('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)]('Audience\x20ID:')+'\x20'+_0x50e3a4[_0x9bb9b6(0x1a4)]),console[_0x9bb9b6(0x11d)]('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x1e1))+'\x20'+_0x50e3a4[_0x9bb9b6(0x13d)]),console[_0x9bb9b6(0x11d)]('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x19d))+'\x20'+_0x50e3a4[_0x9bb9b6(0xcd)]),console['error']('\x20\x20'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0xd2))+'\x20'+_0x50e3a4[_0x9bb9b6(0x1c8)]),console[_0x9bb9b6(0x11d)]('\x20\x20'+_0x42e4d3),console[_0x9bb9b6(0x11d)]('\x0a'+a22_0x36914f[_0x9bb9b6(0x198)](_0x9bb9b6(0x133))+'\x20tdx\x20wf\x20attempt\x20'+_0x50e3a4[_0x9bb9b6(0x1c8)]+_0x9bb9b6(0x118)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x19b);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x153);async[a22_0x14fbc1(0x142)](_0x13d8fc){const _0x1a05f5=a22_0x14fbc1,{options:_0x14bc1e,args:_0x414510,tdx:_0xc08519}=_0x13d8fc,_0x42de89=_0x414510[0x0]||_0x14bc1e[_0x1a05f5(0xcc)];if(!_0x42de89)return showParentSegmentNotSetError(_0x1a05f5(0x1cc)+_0x1a05f5(0x135)),0x1;_0x14bc1e[_0x1a05f5(0xed)]&&(console[_0x1a05f5(0x11d)]('Site:\x20'+_0x14bc1e[_0x1a05f5(0x18f)]),console[_0x1a05f5(0x11d)](_0x1a05f5(0x197)+_0x42de89));const _0x1315ef=await withSpinner(_0x1a05f5(0x91)+_0x42de89+_0x1a05f5(0x13b),()=>_0xc08519[_0x1a05f5(0x8e)][_0x1a05f5(0x10c)](_0x42de89),{'verbose':_0x14bc1e[_0x1a05f5(0xed)]}),_0x845970=_0x1315ef[_0x1a05f5(0x194)];console[_0x1a05f5(0x11d)]('✔\x20Found\x20'+_0x845970[_0x1a05f5(0x155)]+_0x1a05f5(0x162)+(_0x845970[_0x1a05f5(0x155)]!==0x1?'s':''));if(_0x14bc1e['json']||_0x14bc1e[_0x1a05f5(0xb0)])return await handleSDKOutput(_0x845970,_0x14bc1e),0x0;return displayFieldsHumanReadable(_0x845970,_0x42de89),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a22_0x14fbc1(0xc4);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x17f);async[a22_0x14fbc1(0x142)](_0x10a431){const _0x544678=a22_0x14fbc1,{options:_0x585313,args:_0x13c28a,tdx:_0x30bf29}=_0x10a431,_0x55666e=_0x585313,_0x15d44c=_0x13c28a[0x0]||_0x585313[_0x544678(0xcc)];if(!_0x15d44c)return showParentSegmentNotSetError(_0x544678(0x196)+_0x544678(0x117)+_0x544678(0xca)+_0x544678(0x12a)),0x1;_0x585313['verbose']&&(console[_0x544678(0x11d)](_0x544678(0xb1)+_0x585313[_0x544678(0x18f)]),console[_0x544678(0x11d)](_0x544678(0x197)+_0x15d44c));const _0x44f295=await withSpinner(_0x544678(0x192)+_0x15d44c+_0x544678(0x13b),()=>_0x30bf29['segment'][_0x544678(0xaf)](_0x15d44c),{'verbose':_0x585313[_0x544678(0xed)]}),_0x5866ce=_0x44f295['data'];if(_0x55666e['web']){const _0x47737f=getConsoleNextUrl(_0x55666e[_0x544678(0x18f)],_0x544678(0x199)+_0x5866ce['id']);return console[_0x544678(0x11d)](a22_0x36914f[_0x544678(0x1d2)]('✔')+_0x544678(0xaa)+a22_0x36914f[_0x544678(0xa2)](_0x47737f)),openBrowser(_0x47737f),0x0;}return await handleSingleObjectOutput(_0x5866ce,_0x585313),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x1a1);[a22_0x14fbc1(0xe1)]=a22_0x14fbc1(0x1ba);async[a22_0x14fbc1(0x142)](_0x359355){const _0x4dab03=a22_0x14fbc1,{options:_0x9530ee,args:_0x3b860,tdx:_0x159bca}=_0x359355,_0x87a66a=_0x9530ee,_0x2ee8b1=_0x3b860[0x0]||_0x9530ee[_0x4dab03(0xcc)];if(!_0x2ee8b1)return showParentSegmentNotSetError(_0x4dab03(0x8f)+_0x4dab03(0x158)+_0x4dab03(0xca)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0x9530ee[_0x4dab03(0xed)]&&(console[_0x4dab03(0x11d)](_0x4dab03(0xb1)+_0x9530ee[_0x4dab03(0x18f)]),console[_0x4dab03(0x11d)](_0x4dab03(0x197)+_0x2ee8b1));const _0x2ad716=await withSpinner(_0x4dab03(0x9e)+_0x2ee8b1+_0x4dab03(0x13b),()=>_0x159bca[_0x4dab03(0x8e)][_0x4dab03(0xec)](_0x2ee8b1),{'verbose':_0x9530ee[_0x4dab03(0xed)]}),_0x53e1ab=_0x2ad716[_0x4dab03(0x194)],_0x52a96c=_0x159bca['segment'][_0x4dab03(0x8c)](_0x53e1ab);if(_0x87a66a[_0x4dab03(0xcf)]){const _0x20639b=await this[_0x4dab03(0x167)](_0x359355,_0x2ee8b1,_0x53e1ab,_0x52a96c),_0x4d0b6c=this[_0x4dab03(0xae)](_0x20639b);writeFileSync(_0x87a66a['output'],_0x4d0b6c);const _0x162e5c=_0x20639b[_0x4dab03(0xfb)][_0x4dab03(0x175)][_0x4dab03(0x155)]+_0x20639b[_0x4dab03(0x1cd)][_0x4dab03(0x143)]((_0x6666ab,_0x2d7bda)=>_0x6666ab+_0x2d7bda['columns'][_0x4dab03(0x155)],0x0),_0xf01a0e=_0x20639b[_0x4dab03(0x1cd)][_0x4dab03(0xfe)](_0x46b0fb=>_0x46b0fb['columns']['length']===0x0)[_0x4dab03(0x155)];return console[_0x4dab03(0xc3)](_0x4dab03(0x1c9)+_0x87a66a['output']),console[_0x4dab03(0xc3)](_0x4dab03(0x12d)+_0x52a96c),console[_0x4dab03(0xc3)](_0x4dab03(0x163)+_0x20639b[_0x4dab03(0x1cd)][_0x4dab03(0x155)]+_0x4dab03(0x172)),console[_0x4dab03(0xc3)](_0x4dab03(0xbb)+_0x162e5c+_0x4dab03(0x130)),_0xf01a0e>0x0&&console[_0x4dab03(0xc3)]('\x20\x20Note:\x20'+_0xf01a0e+_0x4dab03(0x1b2)),0x0;}console['error']('\x0a'+a22_0x36914f[_0x4dab03(0x1c2)](_0x4dab03(0x10f))+'\x20'+a22_0x36914f[_0x4dab03(0xa2)](_0x52a96c));const _0x1468bc=await withSpinner(_0x4dab03(0x12e),()=>_0x159bca[_0x4dab03(0x8e)][_0x4dab03(0x1d5)](_0x53e1ab),{'verbose':_0x9530ee[_0x4dab03(0xed)]});console['error']('\x0a'+a22_0x36914f[_0x4dab03(0x1c2)](_0x4dab03(0xfb))+'\x20'+a22_0x36914f['dim']('('+_0x52a96c+_0x4dab03(0x110)));const _0x287d1d=await executeSchemaQuery(_0x1468bc['data'],_0x159bca,_0x9530ee);await handleQueryOutput(_0x287d1d,_0x9530ee);const _0x1222d9=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x159bca[_0x4dab03(0x8e)]['getBehaviorNames'](_0x53e1ab),{'verbose':_0x9530ee['verbose']});for(const _0x25d1d0 of _0x1222d9[_0x4dab03(0x194)]){const _0x50c5a9='behavior_'+_0x25d1d0[_0x4dab03(0x136)]()[_0x4dab03(0x189)](/\s+/g,'_'),_0x180f11=_0x4dab03(0x89)+_0x52a96c+'.'+_0x50c5a9;console[_0x4dab03(0x11d)]('\x0a'+a22_0x36914f[_0x4dab03(0x1c2)](_0x25d1d0)+'\x20'+a22_0x36914f[_0x4dab03(0x198)]('('+_0x52a96c+'.'+_0x50c5a9+')'));try{const _0x4ce595=await executeSchemaQuery(_0x180f11,_0x159bca,_0x9530ee);await handleQueryOutput(_0x4ce595,_0x9530ee);}catch{console[_0x4dab03(0x11d)](a22_0x36914f[_0x4dab03(0xdf)](_0x4dab03(0xf7)));}}return 0x0;}async[a22_0x14fbc1(0x167)](_0x2fa086,_0x3d1fd3,_0x4caaf6,_0x46062d){const _0x2e3243=a22_0x14fbc1,{options:_0x2038f7,tdx:_0xb253e7}=_0x2fa086,_0x5564bc=await withSpinner(_0x2e3243(0x12e),()=>_0xb253e7[_0x2e3243(0x8e)][_0x2e3243(0x1d5)](_0x4caaf6),{'verbose':_0x2038f7['verbose']}),_0x3b5806=await executeSchemaQuery(_0x5564bc[_0x2e3243(0x194)],_0xb253e7,_0x2038f7),_0x417a0c=_0x3b5806[_0x2e3243(0x194)][_0x2e3243(0x106)](_0x46e9ea=>({'name':_0x46e9ea[_0x2e3243(0x11c)],'type':_0x46e9ea[_0x2e3243(0x119)]})),_0x3b5bc8=await withSpinner(_0x2e3243(0x1a0),()=>_0xb253e7[_0x2e3243(0x8e)][_0x2e3243(0x1c1)](_0x4caaf6),{'verbose':_0x2038f7[_0x2e3243(0xed)]}),_0x57e32b=[];for(const _0x576792 of _0x3b5bc8[_0x2e3243(0x194)]){const _0x2a7d73=_0x2e3243(0x14a)+_0x576792[_0x2e3243(0x136)]()[_0x2e3243(0x189)](/\s+/g,'_'),_0x4f9df3='SELECT\x20*\x20FROM\x20'+_0x46062d+'.'+_0x2a7d73;let _0x1c8117=[];try{const _0x1be2d5=await executeSchemaQuery(_0x4f9df3,_0xb253e7,_0x2038f7);_0x1c8117=_0x1be2d5[_0x2e3243(0x194)]['map'](_0x8c28ea=>({'name':_0x8c28ea['column_name'],'type':_0x8c28ea[_0x2e3243(0x119)]}));}catch{}_0x57e32b[_0x2e3243(0x19a)]({'table':_0x2a7d73,'columns':_0x1c8117});}return{'database':_0x46062d,'parent_segment':_0x3d1fd3,'parent_id':_0x4caaf6,'customers':{'table':_0x2e3243(0xfb),'columns':_0x417a0c},'behaviors':_0x57e32b};}['formatSchemaJson'](_0x2baaf0){const _0x396db7=a22_0x14fbc1,_0x1fb82b=_0x486496=>{const _0x44229b=a22_0x4d49;if(_0x486496[_0x44229b(0x155)]===0x0)return'[]';const _0x3f5b0b=_0x486496[_0x44229b(0x106)](_0x38d3db=>_0x44229b(0x140)+_0x38d3db[_0x44229b(0xb6)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x38d3db[_0x44229b(0xc9)]+_0x44229b(0x181));return'[\x0a'+_0x3f5b0b['join'](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x1de53a=_0x2baaf0[_0x396db7(0x1cd)][_0x396db7(0x106)](_0x411ecc=>{const _0x142f4d=_0x396db7;return _0x142f4d(0x1dd)+_0x411ecc[_0x142f4d(0xc1)]+_0x142f4d(0x18c)+_0x1fb82b(_0x411ecc['columns'])[_0x142f4d(0x189)](/^/gm,'\x20\x20')[_0x142f4d(0x13c)]()+_0x142f4d(0x1c0);})[_0x396db7(0xc5)](',\x0a');return _0x396db7(0x11e)+_0x2baaf0['database']+_0x396db7(0x1b6)+_0x2baaf0[_0x396db7(0xe7)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x2baaf0[_0x396db7(0x114)]+_0x396db7(0xfd)+_0x2baaf0[_0x396db7(0xfb)][_0x396db7(0xc1)]+_0x396db7(0x19e)+_0x1fb82b(_0x2baaf0[_0x396db7(0xfb)][_0x396db7(0x175)])[_0x396db7(0x189)](/^/gm,'\x20\x20')[_0x396db7(0x13c)]()+_0x396db7(0xe6)+_0x1de53a+_0x396db7(0x156);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]=a22_0x14fbc1(0x1db);['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x2f43ff){const _0x42494b=a22_0x14fbc1,{options:_0x37aac6,args:_0x384c2c,tdx:_0x428791}=_0x2f43ff,_0x2e2fee=_0x384c2c[0x0]||_0x37aac6[_0x42494b(0xcc)];if(!_0x2e2fee)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'+_0x42494b(0x1ce)),0x1;_0x37aac6[_0x42494b(0xed)]&&(console['error'](_0x42494b(0xb1)+_0x37aac6[_0x42494b(0x18f)]),console['error']('Parent\x20segment:\x20'+_0x2e2fee));const _0x50ead3=await withSpinner(_0x42494b(0x9e)+_0x2e2fee+'\x27...',()=>_0x428791[_0x42494b(0x8e)][_0x42494b(0xec)](_0x2e2fee),{'verbose':_0x37aac6[_0x42494b(0xed)]}),_0x2f2a6c=_0x50ead3[_0x42494b(0x194)],_0xce9c23=await withSpinner(_0x42494b(0x105)+_0x2e2fee+'\x27...',()=>_0x428791[_0x42494b(0x8e)]['getParentSQL'](_0x2f2a6c),{'verbose':_0x37aac6['verbose']}),_0x86c849=_0xce9c23[_0x42494b(0x194)];return _0x37aac6[_0x42494b(0x147)]===_0x42494b(0x14f)||_0x37aac6[_0x42494b(0x147)]==='jsonl'?await handleSDKOutput([{'sql':_0x86c849}],_0x37aac6):console[_0x42494b(0xc3)](_0x86c849),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x14fbc1(0xb6)]='segment:parent:show';['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a22_0x14fbc1(0x142)](_0x3fa83e){const _0x4de150=a22_0x14fbc1,{options:_0x584f32,args:_0x33301a,tdx:_0x45f7a9}=_0x3fa83e,_0x5e5547=_0x33301a[0x0]||_0x584f32[_0x4de150(0xcc)];if(!_0x5e5547)return showParentSegmentNotSetError(_0x4de150(0xc0)+_0x4de150(0xf4)),0x1;_0x584f32[_0x4de150(0xed)]&&(console[_0x4de150(0x11d)](_0x4de150(0xb1)+_0x584f32['site']),console[_0x4de150(0x11d)]('Parent\x20segment:\x20'+_0x5e5547));const _0x4d25ab=await withSpinner(_0x4de150(0x9e)+_0x5e5547+_0x4de150(0x13b),()=>_0x45f7a9['segment'][_0x4de150(0xec)](_0x5e5547),{'verbose':_0x584f32['verbose']}),_0x5a5336=_0x4d25ab[_0x4de150(0x194)],_0x5c081b=await withSpinner(_0x4de150(0x105)+_0x5e5547+_0x4de150(0x13b),()=>_0x45f7a9[_0x4de150(0x8e)]['getParentSQL'](_0x5a5336),{'verbose':_0x584f32['verbose']});let _0x27d9b3=_0x5c081b['data'];const _0x352d93=resolveLimit(_0x584f32[_0x4de150(0xb4)],DEFAULT_DISPLAY_LIMIT),_0x1c5fb1=/\bLIMIT\s+\d+/i[_0x4de150(0x170)](_0x27d9b3);!_0x1c5fb1&&(_0x27d9b3=_0x27d9b3[_0x4de150(0x13c)]()['replace'](/;+$/,''),_0x27d9b3='SELECT\x20*\x20FROM\x20(\x0a'+_0x27d9b3+_0x4de150(0x18d)+_0x352d93);_0x584f32[_0x4de150(0xed)]&&console[_0x4de150(0x11d)]('SQL\x20query:\x0a'+_0x27d9b3);const _0x49b7f0=await withProgressSpinner(_0x4de150(0xf0),async _0x2d9f01=>{const _0x10dd38=_0x4de150,_0x56b1ad=await _0x45f7a9[_0x10dd38(0x8b)][_0x10dd38(0x142)](_0x27d9b3,{'catalog':'td','schema':_0x10dd38(0xc2),'onJobId':_0x170378=>{const _0x546012=_0x10dd38;_0x2d9f01[_0x546012(0x12c)](_0x170378);}});return _0x56b1ad;},{'verbose':_0x584f32[_0x4de150(0xed)]}),_0x18f96a=_0x49b7f0[_0x4de150(0x194)],_0x39bead=_0x18f96a[_0x4de150(0x100)]?_0x4de150(0x92)+_0x18f96a[_0x4de150(0x100)]+']':'';return console['error'](_0x4de150(0x1b8)+_0x18f96a[_0x4de150(0x14c)][_0x4de150(0x185)][_0x4de150(0xf5)]()+'\x20rows\x20'+(_0x4de150(0xad)+formatElapsed(_0x18f96a[_0x4de150(0x14c)][_0x4de150(0x1cb)])+_0x39bead)),await handleQueryOutput(_0x18f96a,_0x584f32),0x0;}}
1
+ const a22_0x39bd62=a22_0x107b;(function(_0x2fff1a,_0x517891){const _0x4cef45=a22_0x107b,_0x248f5d=_0x2fff1a();while(!![]){try{const _0x3df1aa=-parseInt(_0x4cef45(0xb9))/0x1+parseInt(_0x4cef45(0x13d))/0x2*(-parseInt(_0x4cef45(0x1ab))/0x3)+parseInt(_0x4cef45(0xb8))/0x4+-parseInt(_0x4cef45(0x8c))/0x5+-parseInt(_0x4cef45(0x164))/0x6+-parseInt(_0x4cef45(0xe9))/0x7*(-parseInt(_0x4cef45(0x150))/0x8)+-parseInt(_0x4cef45(0x176))/0x9*(-parseInt(_0x4cef45(0xca))/0xa);if(_0x3df1aa===_0x517891)break;else _0x248f5d['push'](_0x248f5d['shift']());}catch(_0x67242a){_0x248f5d['push'](_0x248f5d['shift']());}}}(a22_0x36d3,0x377cf));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x2f9c49 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,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x22a4da 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=a22_0x39bd62(0xe1),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x16f282){const _0x319af2=a22_0x39bd62,_0x8597ec=process[_0x319af2(0x114)],_0x225b93=_0x8597ec===_0x319af2(0x132)?_0x319af2(0x1af):_0x8597ec===_0x319af2(0x182)?_0x319af2(0x160):'xdg-open';spawn(_0x225b93,[_0x16f282],{'detached':!![],'stdio':_0x319af2(0x131)})[_0x319af2(0x172)]();}function migrateLegacyDirectory(){const _0x3764ca=a22_0x39bd62;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x5d0fda=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x5d0fda[_0x3764ca(0xd2)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x3764ca(0x98)](a22_0x22a4da[_0x3764ca(0xfc)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3764ca(0x9c)+PARENT_SEGMENT_DIR+_0x3764ca(0x188))),console['error'](a22_0x22a4da[_0x3764ca(0x8e)](_0x3764ca(0x1aa)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console['error'](a22_0x22a4da[_0x3764ca(0xfc)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x3764ca(0x7e)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x3764ca(0x98)](a22_0x22a4da[_0x3764ca(0x153)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x40bb6f){const _0x114cd3=_0x40bb6f instanceof Error?_0x40bb6f[_0x3764ca(0x96)]:String(_0x40bb6f);return console[_0x3764ca(0x98)](a22_0x22a4da['red'](_0x3764ca(0x11f)+_0x114cd3+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x544f21){const _0x284449=a22_0x39bd62;return migrateLegacyDirectory(),super[_0x284449(0x168)](_0x544f21);}}function resolveYamlFile(_0x501a9a){const _0x1558e9=a22_0x39bd62;if(_0x501a9a[_0x1558e9(0xc6)]('.yml')||_0x501a9a['endsWith'](_0x1558e9(0x151)))return _0x501a9a;return a22_0x2f9c49[_0x1558e9(0x183)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x501a9a)+_0x1558e9(0x1b1));}function formatProgressMessage(_0x2d9e94){const _0x18be6a=a22_0x39bd62,_0x22a28e=_0x2d9e94[_0x18be6a(0xac)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x22a28e){const [,_0x8756e4,_0x480284,_0xff565f='']=_0x22a28e;return a22_0x22a4da[_0x18be6a(0x8e)](_0x8756e4+':')+'\x20'+_0x480284+a22_0x22a4da[_0x18be6a(0x8e)](_0xff565f);}return a22_0x22a4da[_0x18be6a(0x8e)](_0x2d9e94);}function showFileNotFoundError(_0x2b5faa,_0x46770a){const _0x12c3e2=a22_0x39bd62;console[_0x12c3e2(0x98)](a22_0x22a4da[_0x12c3e2(0x10a)](_0x12c3e2(0xcc)+_0x2b5faa+'\x0a')),console[_0x12c3e2(0x98)](a22_0x22a4da[_0x12c3e2(0x17a)](_0x12c3e2(0x178)+_0x46770a+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x50aa7a){const _0x54732b=a22_0x39bd62;console[_0x54732b(0x98)](a22_0x22a4da[_0x54732b(0xfc)](_0x54732b(0xf4))),console[_0x54732b(0x98)](_0x50aa7a);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xff);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xe3);async[a22_0x39bd62(0xf6)](_0x447a6b){const _0x26a1fc=a22_0x39bd62,{options:_0x4c0c0f,args:_0x5b5ac1,tdx:_0x2a1b8a}=_0x447a6b,_0x196b70=_0x5b5ac1[0x0];_0x4c0c0f[_0x26a1fc(0x144)]&&(console[_0x26a1fc(0x98)](_0x26a1fc(0xf9)+_0x4c0c0f['site']),_0x196b70&&console[_0x26a1fc(0x98)]('Pattern:\x20'+_0x196b70));const _0x545e3b=await withSpinner(_0x196b70?_0x26a1fc(0x106)+_0x196b70+_0x26a1fc(0x1bd):_0x26a1fc(0xfa),()=>_0x2a1b8a[_0x26a1fc(0x136)][_0x26a1fc(0x1a2)](),{'verbose':_0x4c0c0f['verbose']});let _0x5223c7=_0x545e3b[_0x26a1fc(0x193)];if(_0x196b70){const _0x34d006=_0x196b70[_0x26a1fc(0x155)](/[.+^${}()|[\]\\]/g,_0x26a1fc(0xbe))[_0x26a1fc(0x155)](/\*/g,'.*')[_0x26a1fc(0x155)](/\?/g,'.'),_0x4a3a78=new RegExp('^'+_0x34d006+'$','i');_0x5223c7=_0x5223c7[_0x26a1fc(0xef)](_0x4f9d11=>_0x4a3a78[_0x26a1fc(0x108)](_0x4f9d11[_0x26a1fc(0x1a4)][_0x26a1fc(0x116)]));}_0x5223c7[_0x26a1fc(0x13f)]((_0xc0a619,_0x1b06e1)=>_0xc0a619['attributes']['name']['localeCompare'](_0x1b06e1[_0x26a1fc(0x1a4)][_0x26a1fc(0x116)])),console['error'](_0x26a1fc(0x194)+_0x5223c7[_0x26a1fc(0x117)]+_0x26a1fc(0xd1)+(_0x5223c7['length']!==0x1?'s':''));const _0x4ac94d=_0x5ed6d2=>{const _0x154b6f=_0x26a1fc;return getConsoleNextUrl(_0x4c0c0f[_0x154b6f(0xf3)],_0x154b6f(0x15f)+_0x5ed6d2);};if(_0x4c0c0f[_0x26a1fc(0xc7)]===_0x26a1fc(0x161)||_0x4c0c0f[_0x26a1fc(0xc7)]==='jsonl'){const _0x20732b=_0x5223c7[_0x26a1fc(0x1a0)](_0x5182c7=>({..._0x5182c7,'url':_0x4ac94d(_0x5182c7['id'])}));await handleSDKOutput(_0x20732b,_0x4c0c0f);}else{if(_0x5223c7[_0x26a1fc(0x117)]===0x0)_0x196b70?console[_0x26a1fc(0xae)](_0x26a1fc(0xb3)+_0x196b70):console[_0x26a1fc(0xae)](_0x26a1fc(0x165));else for(const _0x3cbf7f of _0x5223c7){const _0x53f059=_0x3cbf7f['attributes'][_0x26a1fc(0x14a)]?a22_0x22a4da[_0x26a1fc(0x8e)]('\x20('+formatRows(_0x3cbf7f[_0x26a1fc(0x1a4)][_0x26a1fc(0x14a)])+')'):'',_0x2cc9eb=hyperlink(_0x3cbf7f['attributes'][_0x26a1fc(0x116)],_0x4ac94d(_0x3cbf7f['id']));console['log']('👥\x20'+_0x2cc9eb+_0x53f059);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x125);['description']='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x39bd62(0xf6)](_0xe1a0c9){const _0x3f6924=a22_0x39bd62,{options:_0x439606,args:_0x241fa7,tdx:_0x47e0e9}=_0xe1a0c9;console[_0x3f6924(0x98)](_0x3f6924(0x92)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x3f6924(0x107));const _0x3d844d=_0x439606;if(_0x241fa7[_0x3f6924(0x117)]===0x0)return console['error'](a22_0x22a4da[_0x3f6924(0x10a)](_0x3f6924(0x10f))),console[_0x3f6924(0x98)](_0x3f6924(0x142)),0x1;const _0x7375e2=_0x241fa7[0x0];if(!_0x3d844d[_0x3f6924(0x100)]||!_0x3d844d[_0x3f6924(0xc9)])return console[_0x3f6924(0x98)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x3f6924(0x98)](_0x3f6924(0x142)),0x1;_0x3d844d[_0x3f6924(0x144)]&&(console[_0x3f6924(0x98)]('Site:\x20'+_0x3d844d[_0x3f6924(0xf3)]),console[_0x3f6924(0x98)](_0x3f6924(0xdf)+_0x7375e2),console[_0x3f6924(0x98)]('Database:\x20'+_0x3d844d['database']),console['error']('Table:\x20'+_0x3d844d[_0x3f6924(0xc9)]));const _0x5088b5=await loadJSONFromOptions(_0x3d844d[_0x3f6924(0x1a4)],_0x3d844d[_0x3f6924(0x19c)]),_0x4d0c7c=await loadJSONFromOptions(_0x3d844d[_0x3f6924(0xc5)],_0x3d844d['behaviorsFile']),_0x55df76=await loadJSONFromOptions(_0x3d844d[_0x3f6924(0x10d)],_0x3d844d[_0x3f6924(0x81)]),_0x3f661b={'name':_0x7375e2,'description':_0x3d844d[_0x3f6924(0x14e)],'scheduleType':_0x3d844d['scheduleType'],'scheduleOption':_0x3d844d[_0x3f6924(0x171)],'timezone':_0x3d844d[_0x3f6924(0x181)],'master':{'parentDatabaseName':_0x3d844d[_0x3f6924(0x100)],'parentTableName':_0x3d844d[_0x3f6924(0xc9)]},'attributes':_0x5088b5,'behaviors':_0x4d0c7c,'customerGroup':_0x55df76},_0x1f398e=await withSpinner(_0x3f6924(0xb5)+_0x7375e2+_0x3f6924(0x1bd),()=>_0x47e0e9['segment'][_0x3f6924(0x198)](_0x3f661b),{'verbose':_0x439606[_0x3f6924(0x144)]}),_0x3c8dcf=_0x1f398e['data'];return console[_0x3f6924(0x98)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x3c8dcf[_0x3f6924(0x116)]+_0x3f6924(0x1b3)+_0x3c8dcf['id']),await handleSDKOutput([_0x3c8dcf],_0x439606),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a22_0x39bd62(0xd6);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xb2);async[a22_0x39bd62(0xf6)](_0x54c449){const _0x5e66cc=a22_0x39bd62,{options:_0x2e10f3,args:_0x558d92,tdx:_0x4616b2}=_0x54c449;console[_0x5e66cc(0x98)](_0x5e66cc(0x179)+_0x5e66cc(0x140)+_0x5e66cc(0x107));const _0x127093=_0x2e10f3;if(_0x558d92[_0x5e66cc(0x117)]===0x0)return console[_0x5e66cc(0x98)](a22_0x22a4da[_0x5e66cc(0x10a)](_0x5e66cc(0x10f))),console[_0x5e66cc(0x98)](_0x5e66cc(0x1c0)),0x1;const _0xa8e042=_0x558d92[0x0];_0x127093[_0x5e66cc(0x144)]&&(console[_0x5e66cc(0x98)](_0x5e66cc(0xf9)+_0x127093['site']),console[_0x5e66cc(0x98)](_0x5e66cc(0xc1)+_0xa8e042));const _0x130784=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0xa8e042+_0x5e66cc(0x1bd),()=>_0x4616b2[_0x5e66cc(0x136)][_0x5e66cc(0x18e)](_0xa8e042),{'verbose':_0x127093[_0x5e66cc(0x144)]}),_0x55e64d=_0x130784[_0x5e66cc(0x193)],_0x245d8e=await loadJSONFromOptions(_0x127093[_0x5e66cc(0x146)],_0x127093[_0x5e66cc(0x154)]),_0x5ddcf0=await loadJSONFromOptions(_0x127093[_0x5e66cc(0x177)],_0x127093[_0x5e66cc(0x13b)]),_0x7179a4={'name':_0x55e64d['name'],'description':_0x127093[_0x5e66cc(0x14e)]!==undefined?_0x127093[_0x5e66cc(0x14e)]:_0x55e64d['description'],'scheduleType':_0x127093['scheduleType']!==undefined?_0x127093['scheduleType']:_0x55e64d[_0x5e66cc(0xe8)],'scheduleOption':_0x127093[_0x5e66cc(0x171)]!==undefined?_0x127093['scheduleOption']:_0x55e64d[_0x5e66cc(0x171)],'timezone':_0x127093[_0x5e66cc(0x181)]!==undefined?_0x127093['timezone']:_0x55e64d[_0x5e66cc(0x181)],'master':_0x55e64d['master'],'attributes':_0x245d8e?[..._0x55e64d[_0x5e66cc(0x1a4)]||[],..._0x245d8e]:_0x55e64d[_0x5e66cc(0x1a4)],'behaviors':_0x5ddcf0?[..._0x55e64d[_0x5e66cc(0xc5)]||[],..._0x5ddcf0]:_0x55e64d[_0x5e66cc(0xc5)],'customerGroup':_0x55e64d[_0x5e66cc(0x10d)]},_0x3ce050=await withSpinner(_0x5e66cc(0xab)+_0xa8e042+'\x27...',()=>_0x4616b2[_0x5e66cc(0x136)][_0x5e66cc(0x18c)](_0xa8e042,_0x7179a4),{'verbose':_0x127093[_0x5e66cc(0x144)]}),_0x33168f=_0x3ce050[_0x5e66cc(0x193)];return console[_0x5e66cc(0x98)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x33168f[_0x5e66cc(0x116)]+'\x27'),await handleSDKOutput([_0x33168f],_0x127093),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x19a);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x1b6);async['execute'](_0x3ac9db){const _0x2889c2=a22_0x39bd62,{options:_0x1b54d1,args:_0x1e734c,tdx:_0x232305}=_0x3ac9db,_0xdf3e59=_0x1b54d1,_0x43b38c=_0x1e734c[0x0]||_0x1b54d1[_0x2889c2(0xcd)];if(!_0x43b38c)return showParentSegmentNotSetError(_0x2889c2(0xa7)+_0x2889c2(0x103)),0x1;if(_0xdf3e59['use']&&_0xdf3e59[_0x2889c2(0x1a5)])return console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x10a)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x8e)](_0x2889c2(0xdc))),console[_0x2889c2(0x98)](a22_0x22a4da['dim'](_0x2889c2(0x141)+PARENT_SEGMENT_DIR+_0x2889c2(0x9e))),console['error'](a22_0x22a4da[_0x2889c2(0x17a)](_0x2889c2(0x163))),0x1;const _0x831a1b=_0xdf3e59[_0x2889c2(0x1a5)]||a22_0x2f9c49[_0x2889c2(0x183)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x43b38c)+_0x2889c2(0x1b1));_0xdf3e59[_0x2889c2(0x144)]&&(console[_0x2889c2(0x98)](_0x2889c2(0xf9)+_0xdf3e59['site']),console[_0x2889c2(0x98)]('Parent\x20segment:\x20'+_0x43b38c),console[_0x2889c2(0x98)]('Output\x20file:\x20'+_0x831a1b));const _0x4125e9=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x43b38c+_0x2889c2(0x1bd),()=>_0x232305['segment'][_0x2889c2(0x112)](_0x43b38c),{'verbose':_0xdf3e59['verbose']}),_0x516b3e=_0x4125e9['data'];if(existsSync(_0x831a1b)){const _0x35e168=readFileSync(_0x831a1b,_0x2889c2(0xad)),_0x49f5cc=generateDiff(_0x35e168,_0x516b3e);if(!hasChanges(_0x49f5cc))console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x153)]('✔')+_0x2889c2(0xb1)+a22_0x22a4da[_0x2889c2(0x17a)](_0x831a1b)+_0x2889c2(0x19e));else{console[_0x2889c2(0x98)](_0x2889c2(0xe4)+_0x831a1b+'\x27:'),console['error']('─'['repeat'](0x3c)),console[_0x2889c2(0x98)](formatDiffWithColors(_0x49f5cc)),console[_0x2889c2(0x98)]('─'[_0x2889c2(0x17e)](0x3c));if(!_0xdf3e59[_0x2889c2(0xa3)]){if(!isInteractive())return console['error'](a22_0x22a4da[_0x2889c2(0x10a)](_0x2889c2(0xda)),_0x2889c2(0xea)),console['error'](a22_0x22a4da['dim'](_0x2889c2(0x1c2))),0x1;const _0x3494e3=await confirmKey(_0x2889c2(0x91)+_0x831a1b+'\x27?');if(!_0x3494e3)return console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0xfc)](_0x2889c2(0x12f))),0x1;}writeFileSync(_0x831a1b,_0x516b3e,_0x2889c2(0xad)),console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x153)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x22a4da[_0x2889c2(0x17a)](_0x831a1b));}}else{const _0x1718b8=a22_0x2f9c49[_0x2889c2(0x16d)](_0x831a1b);!existsSync(_0x1718b8)&&mkdirSync(_0x1718b8,{'recursive':!![]}),writeFileSync(_0x831a1b,_0x516b3e,_0x2889c2(0xad)),console[_0x2889c2(0x98)](a22_0x22a4da['green']('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x22a4da[_0x2889c2(0x17a)](_0x831a1b));}return saveSessionContext({'parent_segment':_0x43b38c},_0xdf3e59[_0x2889c2(0xe5)]),console[_0x2889c2(0x98)](a22_0x22a4da[_0x2889c2(0x153)]('✔')+_0x2889c2(0xf8)+a22_0x22a4da['dim'](_0x2889c2(0xf5))+_0x2889c2(0x180)+a22_0x22a4da[_0x2889c2(0x17a)](_0x43b38c)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xb7);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xeb);async[a22_0x39bd62(0xf6)](_0x5b5c78){const _0x1da8f3=a22_0x39bd62,{options:_0x117531,args:_0x29bbe3,tdx:_0x52587a}=_0x5b5c78,_0x527a42=_0x117531,_0x2d7d0d=_0x29bbe3[0x0]||_0x117531['parentSegment'];if(!_0x2d7d0d)return showParentSegmentNotSetError(_0x1da8f3(0xa6)+_0x1da8f3(0xdd)),0x1;const _0x3517db=resolveYamlFile(_0x2d7d0d);if(!existsSync(_0x3517db))return showFileNotFoundError(_0x3517db,_0x2d7d0d),0x1;_0x527a42[_0x1da8f3(0x144)]&&(console[_0x1da8f3(0x98)](_0x1da8f3(0xf9)+_0x527a42[_0x1da8f3(0xf3)]),console[_0x1da8f3(0x98)]('YAML\x20file:\x20'+_0x3517db));let _0x1a5d8f;try{_0x1a5d8f=readFileSync(_0x3517db,_0x1da8f3(0xad));}catch(_0x141a43){const _0x436911=_0x141a43 instanceof Error?_0x141a43[_0x1da8f3(0x96)]:String(_0x141a43);return console[_0x1da8f3(0x98)]('Error\x20reading\x20file:\x20'+_0x436911),0x1;}const _0x3cb723=await withSpinner('Analyzing\x20changes...',()=>_0x52587a[_0x1da8f3(0x136)]['pushParentYaml'](_0x1a5d8f),{'verbose':_0x527a42[_0x1da8f3(0x144)]}),_0x31d9cd=_0x3cb723[_0x1da8f3(0x193)],{isNew:_0x28a707,name:_0x107255,hasChanges:_0x51fb4d,diffFormatted:_0x5ed6dd}=_0x31d9cd;if(!_0x51fb4d)return console[_0x1da8f3(0x98)](_0x1da8f3(0xf7)+_0x107255+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x28a707?console[_0x1da8f3(0x98)](_0x1da8f3(0x15a)+_0x107255+'\x27:'):console['error']('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x107255+'\x27:');console[_0x1da8f3(0x98)]('─'[_0x1da8f3(0x17e)](0x3c)),console[_0x1da8f3(0x98)](_0x5ed6dd),console[_0x1da8f3(0x98)]('─'[_0x1da8f3(0x17e)](0x3c));const _0x48c1e4=_0x28a707?_0x1da8f3(0x85)+_0x107255+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x107255+'\x27?';if(!_0x527a42[_0x1da8f3(0xa3)]){if(!isInteractive())return console['error'](a22_0x22a4da[_0x1da8f3(0x10a)]('\x0aError:'),_0x1da8f3(0xea)),console['error'](a22_0x22a4da[_0x1da8f3(0x8e)](_0x1da8f3(0x1c2))),0x1;const _0x538999=await confirmKey(_0x48c1e4);if(!_0x538999)return console[_0x1da8f3(0x98)](a22_0x22a4da[_0x1da8f3(0xfc)](_0x1da8f3(0x12f))),0x1;}const _0xd8c7ce=_0x28a707?'Creating':_0x1da8f3(0x166),_0xc05b9=await withSpinner(_0xd8c7ce+_0x1da8f3(0x1b0)+_0x107255+_0x1da8f3(0x1bd),()=>_0x31d9cd[_0x1da8f3(0xbd)](),{'verbose':_0x527a42[_0x1da8f3(0x144)]}),_0x62b8b9=_0xc05b9[_0x1da8f3(0x193)],_0x5a5a4d=getConsoleNextUrl(_0x527a42[_0x1da8f3(0xf3)],_0x1da8f3(0x15f)+_0x62b8b9['id']),_0x2afcb0=_0x28a707?_0x1da8f3(0x8b):_0x1da8f3(0x189);return console[_0x1da8f3(0x98)]('✔\x20'+_0x2afcb0+_0x1da8f3(0x1b0)+_0x62b8b9[_0x1da8f3(0x116)]+'\x27'),console[_0x1da8f3(0x98)]('\x20\x20'+_0x5a5a4d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x39bd62(0x12a);[a22_0x39bd62(0x14e)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a22_0x39bd62(0xf6)](_0x15000e){const _0x268802=a22_0x39bd62,{options:_0x16ae90,args:_0x5f4b29,tdx:_0x274a7d}=_0x15000e,_0x155dea=_0x16ae90,_0x1e6b27=_0x5f4b29[0x0]||_0x16ae90[_0x268802(0xcd)];if(!_0x1e6b27)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x268802(0xa5)+'Options:\x0a'+_0x268802(0xa1)+_0x268802(0x1a6)+_0x268802(0x14d)),0x1;const _0x2feb78=resolveYamlFile(_0x1e6b27);if(!existsSync(_0x2feb78))return showFileNotFoundError(_0x2feb78,_0x1e6b27),0x1;_0x155dea[_0x268802(0x144)]&&(console[_0x268802(0x98)]('Site:\x20'+_0x155dea[_0x268802(0xf3)]),console[_0x268802(0x98)](_0x268802(0x7f)+_0x2feb78));let _0x5b524d;try{_0x5b524d=readFileSync(_0x2feb78,_0x268802(0xad));}catch(_0x9ba2a9){const _0x3cadfc=_0x9ba2a9 instanceof Error?_0x9ba2a9['message']:String(_0x9ba2a9);return console[_0x268802(0x98)](_0x268802(0x111)+_0x3cadfc),0x1;}const _0x13ba05=createCommandSpinner(a22_0x22a4da[_0x268802(0x8e)]('Validating\x20configuration...'),{'verbose':_0x155dea[_0x268802(0x144)]});_0x13ba05['start']();const _0x32eb7e={'onProgress':_0x2f5a87=>{_0x13ba05['text']=formatProgressMessage(_0x2f5a87);}};if(_0x155dea['master'])_0x32eb7e['master']=!![];if(_0x155dea[_0x268802(0x12b)])_0x32eb7e[_0x268802(0x12b)]=!![];_0x155dea[_0x268802(0x1a9)]&&(_0x32eb7e[_0x268802(0x1a9)]=_0x155dea['attribute']);_0x155dea[_0x268802(0x123)]&&(_0x32eb7e[_0x268802(0x123)]=_0x155dea[_0x268802(0x123)]);if(_0x155dea['interval'])_0x32eb7e[_0x268802(0xec)]=_0x155dea[_0x268802(0xec)];let _0x4987ad;try{_0x4987ad=await _0x274a7d[_0x268802(0x136)]['validateParentYaml'](_0x5b524d,_0x32eb7e),_0x13ba05['stop']();}catch(_0x153ff1){_0x13ba05['stop']();throw _0x153ff1;}const _0x32345d=_0x155dea[_0x268802(0xec)]||_0x268802(0xc0);return this[_0x268802(0x11e)](_0x4987ad,_0x32eb7e,_0x2feb78,_0x32345d),_0x4987ad[_0x268802(0x185)]?0x0:0x1;}[a22_0x39bd62(0x11e)](_0x288cca,_0x1bfff0,_0x3173fb,_0x9ce697){const _0x4054f4=a22_0x39bd62;console['error']('\x0a'+a22_0x22a4da[_0x4054f4(0xe0)](_0x4054f4(0x158))+'\x20'+_0x288cca['name']),console[_0x4054f4(0x98)]('═'[_0x4054f4(0x17e)](0x3c)),this[_0x4054f4(0x1bc)](_0x288cca);if(typeof _0x1bfff0[_0x4054f4(0x1a9)]==='string'){this[_0x4054f4(0x9a)](_0x288cca),this[_0x4054f4(0xfd)](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,'attribute',_0x1bfff0[_0x4054f4(0x1a9)]);return;}if(_0x1bfff0[_0x4054f4(0x1a9)]===!![]){this[_0x4054f4(0x9a)](_0x288cca),this[_0x4054f4(0xfd)](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,_0x4054f4(0x1a4));return;}if(typeof _0x1bfff0['behavior']===_0x4054f4(0x9b)){this[_0x4054f4(0x88)](_0x288cca,_0x9ce697),this['displaySummary'](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,_0x4054f4(0x123),_0x1bfff0[_0x4054f4(0x123)]);return;}if(_0x1bfff0[_0x4054f4(0x123)]===!![]){this[_0x4054f4(0x88)](_0x288cca,_0x9ce697),this[_0x4054f4(0xfd)](_0x288cca),this[_0x4054f4(0xf2)](_0x3173fb,_0x9ce697,_0x4054f4(0xc5));return;}this['displayAttributesStats'](_0x288cca),this[_0x4054f4(0x88)](_0x288cca,_0x9ce697),this[_0x4054f4(0xfd)](_0x288cca),this['displayPreviewHints'](_0x3173fb,_0x9ce697,'all');}[a22_0x39bd62(0xf2)](_0x48d787,_0x52618d,_0x2f8ead,_0x5b889d){const _0x2c4e31=a22_0x39bd62;console[_0x2c4e31(0x98)]('\x0a'+a22_0x22a4da[_0x2c4e31(0x8e)]('To\x20view\x20sample\x20data:'));const _0x1bc761=_0x52618d!==_0x2c4e31(0xc0)?_0x2c4e31(0xbf)+_0x52618d:'';if(_0x2f8ead===_0x2c4e31(0x1a9)&&_0x5b889d)console[_0x2c4e31(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x2c4e31(0xcb)+_0x48d787+'\x20--attribute\x20\x22'+_0x5b889d+'\x22'+_0x1bc761));else{if(_0x2f8ead===_0x2c4e31(0x123)&&_0x5b889d)console['error']('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)]('tdx\x20segment\x20parent\x20preview\x20'+_0x48d787+_0x2c4e31(0x199)+_0x5b889d+'\x22'+_0x1bc761));else(_0x2f8ead===_0x2c4e31(0x1a4)||_0x2f8ead===_0x2c4e31(0x19f))&&console[_0x2c4e31(0x98)]('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)]('tdx\x20segment\x20parent\x20preview\x20'+_0x48d787+'\x20--attribute\x20\x22<name>\x22'+_0x1bc761));}(_0x2f8ead==='behaviors'||_0x2f8ead===_0x2c4e31(0x19f))&&console['error']('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)](_0x2c4e31(0xcb)+_0x48d787+'\x20--behavior\x20\x22<name>\x22'+_0x1bc761)),_0x2f8ead===_0x2c4e31(0x19f)&&console[_0x2c4e31(0x98)]('\x20\x20'+a22_0x22a4da[_0x2c4e31(0x8e)](_0x2c4e31(0xcb)+_0x48d787+_0x2c4e31(0x8f)+_0x1bc761));}[a22_0x39bd62(0x1bc)](_0x203aab){const _0x156897=a22_0x39bd62,{master:_0x30484c}=_0x203aab,_0x54836e=_0x30484c['schemaValid']?a22_0x22a4da[_0x156897(0x153)]('✔'):a22_0x22a4da[_0x156897(0x10a)]('✘');console[_0x156897(0x98)]('\x0a'+a22_0x22a4da['dim'](_0x156897(0xb0))),console[_0x156897(0x98)](_0x54836e+'\x20'+a22_0x22a4da['bold'](_0x30484c[_0x156897(0x100)]+'.'+_0x30484c[_0x156897(0xc9)])),_0x30484c[_0x156897(0x16a)]?_0x30484c[_0x156897(0x135)]!==undefined&&console[_0x156897(0x98)]('\x20\x20'+a22_0x22a4da[_0x156897(0x8e)](_0x156897(0x101))+'\x20'+a22_0x22a4da[_0x156897(0x17a)](formatRows(_0x30484c[_0x156897(0x135)]))):console[_0x156897(0x98)]('\x20\x20'+a22_0x22a4da[_0x156897(0x10a)]('Error:')+'\x20'+_0x30484c[_0x156897(0xf0)]);}['displayAttributesStats'](_0x23b1fa){const _0x22739b=a22_0x39bd62;if(_0x23b1fa[_0x22739b(0x1a4)]['length']===0x0)return;console[_0x22739b(0x98)]('\x0a'+a22_0x22a4da[_0x22739b(0x8e)](_0x22739b(0x120)));for(const _0x4d857f of _0x23b1fa['attributes']){const _0x5c83f3=_0x4d857f[_0x22739b(0x16a)]?a22_0x22a4da[_0x22739b(0x153)]('✔'):a22_0x22a4da[_0x22739b(0x10a)]('✘');let _0x3bd74='';if(_0x4d857f[_0x22739b(0x16a)]&&_0x4d857f[_0x22739b(0x12c)]!==undefined&&_0x4d857f[_0x22739b(0xfe)]!==undefined){const _0x4f6a7e=_0x4d857f[_0x22739b(0xfe)][_0x22739b(0x11c)](0x1),_0x2cbf51=_0x4d857f[_0x22739b(0xfe)]>=0x50?a22_0x22a4da[_0x22739b(0x153)]:_0x4d857f['coveragePercent']>=0x32?a22_0x22a4da['yellow']:a22_0x22a4da['red'];_0x3bd74='\x20'+a22_0x22a4da[_0x22739b(0x8e)]('Coverage:')+'\x20'+_0x2cbf51(_0x4f6a7e+'%')+'\x20('+formatRows(_0x4d857f[_0x22739b(0x12c)])+'\x20rows)';}console[_0x22739b(0x98)](_0x5c83f3+'\x20'+a22_0x22a4da[_0x22739b(0xe0)](_0x4d857f[_0x22739b(0x116)])+_0x3bd74),console[_0x22739b(0x98)]('\x20\x20'+a22_0x22a4da['dim']('Source:')+'\x20'+a22_0x22a4da[_0x22739b(0xe0)](_0x4d857f[_0x22739b(0x100)]+'.'+_0x4d857f[_0x22739b(0xc9)]));const _0x5edbae=_0x4d857f[_0x22739b(0x195)]===_0x4d857f[_0x22739b(0x82)]?a22_0x22a4da[_0x22739b(0x8e)]('Join\x20on:')+'\x20'+_0x4d857f[_0x22739b(0x195)]:a22_0x22a4da['dim'](_0x22739b(0x139))+'\x20'+_0x4d857f['joinKey']+_0x22739b(0x180)+_0x4d857f[_0x22739b(0x82)];console[_0x22739b(0x98)]('\x20\x20'+_0x5edbae),console[_0x22739b(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x22739b(0xde))),this[_0x22739b(0x89)](_0x4d857f[_0x22739b(0x13a)]),!_0x4d857f['schemaValid']&&console['error']('\x20\x20'+a22_0x22a4da['red'](_0x22739b(0xa8))+'\x20'+_0x4d857f['schemaError']);}}[a22_0x39bd62(0x88)](_0x52c2c4,_0x1c525f){const _0x30778f=a22_0x39bd62;if(_0x52c2c4[_0x30778f(0xc5)][_0x30778f(0x117)]===0x0)return;console['error']('\x0a'+a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0xc8))+'\x20'+a22_0x22a4da[_0x30778f(0x8e)]('('+_0x1c525f+')'));for(const _0x335f5a of _0x52c2c4['behaviors']){const _0x277cee=_0x335f5a[_0x30778f(0x16a)]?a22_0x22a4da[_0x30778f(0x153)]('✔'):a22_0x22a4da[_0x30778f(0x10a)]('✘');let _0xd57846='';if(_0x335f5a[_0x30778f(0x16a)]&&_0x335f5a['customersWithEvents']!==undefined&&_0x335f5a[_0x30778f(0x169)]!==undefined){const _0x4b09db=_0x335f5a[_0x30778f(0x1ba)]?.[_0x30778f(0x11c)](0x1)||'?',_0x1458ad=(_0x335f5a[_0x30778f(0x1ba)]??0x0)>=0x32?a22_0x22a4da['green']:(_0x335f5a[_0x30778f(0x1ba)]??0x0)>=0x14?a22_0x22a4da[_0x30778f(0xfc)]:a22_0x22a4da[_0x30778f(0x10a)];_0xd57846='\x20'+a22_0x22a4da['dim'](_0x30778f(0xb6))+'\x20'+_0x1458ad(formatRows(_0x335f5a[_0x30778f(0x1a3)]))+'\x20('+_0x4b09db+_0x30778f(0x122)+a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0xf1))+'\x20'+a22_0x22a4da[_0x30778f(0x17a)](formatRows(_0x335f5a[_0x30778f(0x169)]));}console[_0x30778f(0x98)](_0x277cee+'\x20'+a22_0x22a4da['bold'](_0x335f5a[_0x30778f(0x116)])+_0xd57846),console[_0x30778f(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x30778f(0x157))+'\x20'+a22_0x22a4da[_0x30778f(0xe0)](_0x335f5a[_0x30778f(0x100)]+'.'+_0x335f5a[_0x30778f(0xc9)]));const _0x165b8b=_0x335f5a['joinKey']===_0x335f5a['foreignKey']?a22_0x22a4da['dim'](_0x30778f(0x152))+'\x20'+_0x335f5a[_0x30778f(0x195)]:a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0x139))+'\x20'+_0x335f5a[_0x30778f(0x195)]+_0x30778f(0x180)+_0x335f5a[_0x30778f(0x82)];console[_0x30778f(0x98)]('\x20\x20'+_0x165b8b),console['error']('\x20\x20'+a22_0x22a4da[_0x30778f(0x8e)](_0x30778f(0xde))),this[_0x30778f(0x89)](_0x335f5a[_0x30778f(0x13a)]),!_0x335f5a['schemaValid']&&console[_0x30778f(0x98)]('\x20\x20'+a22_0x22a4da[_0x30778f(0x10a)](_0x30778f(0xa8))+'\x20'+_0x335f5a['schemaError']);}}[a22_0x39bd62(0x89)](_0x51f53c){const _0x20c5b9=a22_0x39bd62;for(const _0x1dce89 of _0x51f53c){_0x1dce89[_0x20c5b9(0x1b2)]===_0x1dce89[_0x20c5b9(0x147)]||_0x1dce89[_0x20c5b9(0x147)]==='*'?console[_0x20c5b9(0x98)](_0x20c5b9(0xba)+_0x1dce89[_0x20c5b9(0x1b2)]):console[_0x20c5b9(0x98)](_0x20c5b9(0xba)+_0x1dce89[_0x20c5b9(0x1b2)]+'\x20'+a22_0x22a4da[_0x20c5b9(0x8e)]('('+_0x1dce89[_0x20c5b9(0x147)]+')'));}}['displaySummary'](_0x52e998){const _0x5d1aa8=a22_0x39bd62;console['error']('─'[_0x5d1aa8(0x17e)](0x3c));if(_0x52e998['errors'][_0x5d1aa8(0x117)]>0x0){console[_0x5d1aa8(0x98)]('\x0a'+a22_0x22a4da[_0x5d1aa8(0x10a)](_0x5d1aa8(0x10c)));for(const _0x2890f3 of _0x52e998[_0x5d1aa8(0x12e)]){console[_0x5d1aa8(0x98)]('\x20\x20'+a22_0x22a4da[_0x5d1aa8(0x10a)]('•')+'\x20'+_0x2890f3);}}_0x52e998[_0x5d1aa8(0x185)]&&console[_0x5d1aa8(0x98)]('\x0a'+a22_0x22a4da[_0x5d1aa8(0x153)]('✔')+_0x5d1aa8(0xd8));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]='segment:parent:preview';[a22_0x39bd62(0x14e)]=a22_0x39bd62(0xd9);async[a22_0x39bd62(0xf6)](_0x4a12ca){const _0x9d6b26=a22_0x39bd62,{options:_0x1d7048,args:_0x2787a9,tdx:_0x15f147}=_0x4a12ca,_0x1e013d=_0x1d7048,_0x43b483=_0x2787a9[0x0]||_0x1d7048[_0x9d6b26(0xcd)];if(!_0x43b483)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'+'Options\x20(one\x20required):\x0a'+_0x9d6b26(0x1b4)+_0x9d6b26(0x126)+_0x9d6b26(0x162)+_0x9d6b26(0xe7)+_0x9d6b26(0x14d)),0x1;if(!_0x1e013d[_0x9d6b26(0x197)]&&!_0x1e013d['attribute']&&!_0x1e013d['behavior']&&!_0x1e013d['enriched'])return console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0xe2))),console[_0x9d6b26(0x98)](_0x9d6b26(0xd7)),console['error'](_0x9d6b26(0xd4)),console[_0x9d6b26(0x98)](_0x9d6b26(0x134)),console[_0x9d6b26(0x98)](_0x9d6b26(0x1bf)),console[_0x9d6b26(0x98)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x9d6b26(0x98)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x237970=resolveYamlFile(_0x43b483);if(!existsSync(_0x237970))return showFileNotFoundError(_0x237970,_0x43b483),0x1;_0x1e013d[_0x9d6b26(0x144)]&&(console[_0x9d6b26(0x98)]('Site:\x20'+_0x1e013d[_0x9d6b26(0xf3)]),console[_0x9d6b26(0x98)](_0x9d6b26(0x7f)+_0x237970));let _0x185132;try{_0x185132=readFileSync(_0x237970,_0x9d6b26(0xad));}catch(_0x1234a2){const _0x11372f=_0x1234a2 instanceof Error?_0x1234a2['message']:String(_0x1234a2);return console[_0x9d6b26(0x98)](_0x9d6b26(0x111)+_0x11372f),0x1;}let _0x315d3e;try{_0x315d3e=parseDef(_0x185132);}catch(_0x1e9171){const _0x5ec8ef=_0x1e9171 instanceof Error?_0x1e9171[_0x9d6b26(0x96)]:String(_0x1e9171);return console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0xdb)+_0x5ec8ef)),0x1;}if(_0x1e013d[_0x9d6b26(0x1a9)]===!![]||_0x1e013d['attribute']===''){const _0x11243e=_0x315d3e['attributes']?.['map'](_0x427221=>_0x427221[_0x9d6b26(0x116)])||[];if(_0x11243e[_0x9d6b26(0x117)]===0x0)console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0x159)));else{console[_0x9d6b26(0x98)](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0x173))),console[_0x9d6b26(0x98)](_0x9d6b26(0x15e));for(const _0x129953 of _0x11243e){console[_0x9d6b26(0x98)]('\x20\x20'+a22_0x22a4da[_0x9d6b26(0x17a)](_0x129953));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x43b483+_0x9d6b26(0xcf)+_0x11243e[0x0]+'\x22');}return 0x1;}if(_0x1e013d['behavior']===!![]||_0x1e013d[_0x9d6b26(0x123)]===''){const _0x3a9bcd=_0x315d3e[_0x9d6b26(0xc5)]?.['map'](_0x92233=>_0x92233['name'])||[];if(_0x3a9bcd[_0x9d6b26(0x117)]===0x0)console[_0x9d6b26(0x98)](a22_0x22a4da['red']('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console['error'](a22_0x22a4da[_0x9d6b26(0x10a)](_0x9d6b26(0xa2))),console['error']('Available\x20behaviors:');for(const _0x7375fc of _0x3a9bcd){console[_0x9d6b26(0x98)]('\x20\x20'+a22_0x22a4da[_0x9d6b26(0x17a)](_0x7375fc));}console[_0x9d6b26(0x98)](_0x9d6b26(0x17f)+_0x43b483+_0x9d6b26(0x199)+_0x3a9bcd[0x0]+'\x22');}return 0x1;}const _0x2f244d=createCommandSpinner(a22_0x22a4da[_0x9d6b26(0x8e)](_0x9d6b26(0x87)),{'verbose':_0x1e013d[_0x9d6b26(0x144)]});_0x2f244d[_0x9d6b26(0x160)]();const _0x85e07d={'onProgress':_0x36c8c2=>{const _0x5a9881=_0x9d6b26;_0x2f244d[_0x5a9881(0x187)]=formatProgressMessage(_0x36c8c2);}};if(_0x1e013d[_0x9d6b26(0x197)])_0x85e07d['master']=!![];if(_0x1e013d[_0x9d6b26(0x1a9)]&&typeof _0x1e013d[_0x9d6b26(0x1a9)]==='string')_0x85e07d[_0x9d6b26(0x1a9)]=_0x1e013d['attribute'];if(_0x1e013d['behavior']&&typeof _0x1e013d[_0x9d6b26(0x123)]==='string')_0x85e07d[_0x9d6b26(0x123)]=_0x1e013d[_0x9d6b26(0x123)];if(_0x1e013d['enriched'])_0x85e07d[_0x9d6b26(0x12b)]=!![];if(_0x1e013d['interval'])_0x85e07d['interval']=_0x1e013d['interval'];let _0x2b61fa;try{_0x2b61fa=await _0x15f147[_0x9d6b26(0x136)][_0x9d6b26(0x19d)](_0x185132,_0x85e07d),_0x2f244d[_0x9d6b26(0x18a)]();}catch(_0x1218f2){_0x2f244d['stop']();throw _0x1218f2;}return await this[_0x9d6b26(0x119)](_0x2b61fa,{'master':_0x1e013d[_0x9d6b26(0x197)],'attribute':typeof _0x1e013d[_0x9d6b26(0x1a9)]===_0x9d6b26(0x9b)?_0x1e013d['attribute']:undefined,'behavior':typeof _0x1e013d[_0x9d6b26(0x123)]===_0x9d6b26(0x9b)?_0x1e013d[_0x9d6b26(0x123)]:undefined,'enriched':_0x1e013d[_0x9d6b26(0x12b)]}),_0x2b61fa[_0x9d6b26(0x185)]?0x0:0x1;}async['displayPreviewResults'](_0x322548,_0xca50fb){const _0x166098=a22_0x39bd62;console[_0x166098(0x98)]('\x0a'+a22_0x22a4da[_0x166098(0xe0)](_0x166098(0x15c))+'\x20'+_0x322548['name']),console[_0x166098(0x98)]('═'[_0x166098(0x17e)](0x3c));if(_0xca50fb[_0x166098(0x197)]&&_0x322548[_0x166098(0x130)]){const _0x3447af=a22_0x22a4da['dim'](_0x166098(0x18f))+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0x322548[_0x166098(0x197)][_0x166098(0x100)]+'.'+_0x322548[_0x166098(0x197)][_0x166098(0xc9)]);await this[_0x166098(0x170)](_0x3447af,_0x322548[_0x166098(0x130)]);}else{if(_0xca50fb[_0x166098(0x1a9)]&&_0x322548['sampleData']){const _0x5c0f9a=a22_0x22a4da[_0x166098(0x8e)]('Attribute:')+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0xca50fb['attribute']);await this[_0x166098(0x170)](_0x5c0f9a,_0x322548[_0x166098(0x130)]);}else{if(_0xca50fb[_0x166098(0x123)]&&_0x322548[_0x166098(0x130)]){const _0x201cac=a22_0x22a4da[_0x166098(0x8e)]('Behavior:')+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0xca50fb[_0x166098(0x123)]);await this[_0x166098(0x170)](_0x201cac,_0x322548['sampleData']);}else{if(_0xca50fb[_0x166098(0x12b)]&&_0x322548[_0x166098(0x130)]){const _0x3e1f67=a22_0x22a4da[_0x166098(0x8e)](_0x166098(0x94))+'\x20'+a22_0x22a4da[_0x166098(0xe0)](_0x166098(0x102));await this['displaySampleData'](_0x3e1f67,_0x322548['sampleData']);}else!_0x322548[_0x166098(0x130)]&&console[_0x166098(0x98)](_0x166098(0x196));}}}if(_0x322548[_0x166098(0x12e)][_0x166098(0x117)]>0x0){console[_0x166098(0x98)]('─'[_0x166098(0x17e)](0x3c)),console[_0x166098(0x98)]('\x0a'+a22_0x22a4da['red'](_0x166098(0x10c)));for(const _0x32fc57 of _0x322548['errors']){console[_0x166098(0x98)]('\x20\x20'+a22_0x22a4da[_0x166098(0x10a)]('•')+'\x20'+_0x32fc57);}}}async[a22_0x39bd62(0x170)](_0x159661,_0xac5d6){const _0x4e4122=a22_0x39bd62;if(_0xac5d6[_0x4e4122(0x117)]===0x0){console[_0x4e4122(0x98)]('\x0a'+_0x159661),console[_0x4e4122(0x98)](_0x4e4122(0x18b));return;}console[_0x4e4122(0x98)]('\x0a'+_0x159661);const _0x385d68=Object[_0x4e4122(0xce)](_0xac5d6[0x0])['map'](_0x4a3a3d=>({'name':_0x4a3a3d,'type':typeof _0xac5d6[0x0][_0x4a3a3d]===_0x4e4122(0xb4)?_0x4e4122(0x115):_0x4e4122(0xfb)})),_0x4aae73={'queryId':_0x4e4122(0x14c),'columns':_0x385d68,'data':_0xac5d6,'stats':{'state':_0x4e4122(0x8a),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0xac5d6[_0x4e4122(0x117)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5a8923=formatAsTable(_0x4aae73,_0xac5d6[_0x4e4122(0x117)],!![]);await writeOutput(_0x5a8923,undefined,_0x4e4122(0xc9));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x113);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x1a7);async[a22_0x39bd62(0xf6)](_0x559b0f){const _0x5d6221=a22_0x39bd62,{options:_0x5d7db8,args:_0xffdbf1,tdx:_0x4648ef}=_0x559b0f,_0x331c9a=_0x5d7db8,_0x29a339=_0xffdbf1[0x0]||_0x5d7db8['parentSegment'];if(!_0x29a339)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'+_0x5d6221(0x149)),0x1;const _0x50ba2c=resolveYamlFile(_0x29a339);if(existsSync(_0x50ba2c)){_0x331c9a[_0x5d6221(0x144)]&&console['error'](_0x5d6221(0x93)+_0x50ba2c);let _0x23adbf;try{_0x23adbf=readFileSync(_0x50ba2c,_0x5d6221(0xad));}catch(_0x37430e){const _0x259a66=_0x37430e instanceof Error?_0x37430e[_0x5d6221(0x96)]:String(_0x37430e);return console[_0x5d6221(0x98)]('Error\x20reading\x20file:\x20'+_0x259a66),0x1;}const _0x4221b2=await withSpinner(_0x5d6221(0x137),()=>_0x4648ef[_0x5d6221(0x136)][_0x5d6221(0x16e)](_0x23adbf),{'verbose':_0x331c9a['verbose']}),_0x55381e=_0x4221b2[_0x5d6221(0x193)],{isNew:_0x5c9695,name:_0x219a92,hasChanges:_0x2eb111,diffFormatted:_0x3f7610}=_0x55381e;if(_0x2eb111){_0x5c9695?console[_0x5d6221(0x98)](_0x5d6221(0x15a)+_0x219a92+'\x27:'):console[_0x5d6221(0x98)](_0x5d6221(0x124)+_0x219a92+'\x27:');console[_0x5d6221(0x98)]('─'[_0x5d6221(0x17e)](0x3c)),console[_0x5d6221(0x98)](_0x3f7610),console[_0x5d6221(0x98)]('─'[_0x5d6221(0x17e)](0x3c));const _0x5254b5=_0x5c9695?'Create\x20parent\x20segment\x20\x27'+_0x219a92+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x219a92+_0x5d6221(0x156);if(!_0x331c9a[_0x5d6221(0xa3)]){if(!isInteractive())return console[_0x5d6221(0x98)](a22_0x22a4da[_0x5d6221(0x10a)](_0x5d6221(0xda)),_0x5d6221(0xea)),console['error'](a22_0x22a4da['dim'](_0x5d6221(0x1c2))),0x1;const _0x254917=await confirmKey(_0x5254b5);if(!_0x254917)return console['error'](a22_0x22a4da[_0x5d6221(0xfc)]('Aborted.')),0x1;}const _0x13cb53=_0x5c9695?_0x5d6221(0x133):_0x5d6221(0x166);await withSpinner(_0x13cb53+_0x5d6221(0x1b0)+_0x219a92+_0x5d6221(0x1bd),()=>_0x55381e['apply'](),{'verbose':_0x331c9a[_0x5d6221(0x144)]});const _0x334d2d=_0x5c9695?_0x5d6221(0x8b):_0x5d6221(0x189);console[_0x5d6221(0x98)]('✔\x20'+_0x334d2d+_0x5d6221(0x1b0)+_0x219a92+'\x27');}else console[_0x5d6221(0x98)]('✔\x20No\x20changes\x20-\x20\x27'+_0x219a92+_0x5d6221(0x1bb));}const _0x5da4a2=await withSpinner(_0x5d6221(0x16c)+_0x29a339+_0x5d6221(0x1bd),()=>_0x4648ef[_0x5d6221(0x136)][_0x5d6221(0x174)](_0x29a339),{'verbose':_0x331c9a[_0x5d6221(0x144)]}),_0x3b9a3e=_0x5da4a2[_0x5d6221(0x193)],_0xd8950e=getConsoleUrl(_0x331c9a[_0x5d6221(0xf3)],_0x5d6221(0xa9)+_0x3b9a3e[_0x5d6221(0x1b9)]+'/sessions/'+_0x3b9a3e['workflowSessionId']+'/attempt/'+_0x3b9a3e['workflowAttemptId']);return console[_0x5d6221(0x98)](_0x5d6221(0x17d)),console['error']('\x20\x20'+a22_0x22a4da[_0x5d6221(0x8e)](_0x5d6221(0xc3))+'\x20'+_0x3b9a3e[_0x5d6221(0xa4)]),console[_0x5d6221(0x98)]('\x20\x20'+a22_0x22a4da[_0x5d6221(0x8e)](_0x5d6221(0x192))+'\x20'+_0x3b9a3e[_0x5d6221(0x104)]),console['error']('\x20\x20'+a22_0x22a4da[_0x5d6221(0x8e)](_0x5d6221(0x15d))+'\x20'+_0x3b9a3e['workflowSessionId']),console[_0x5d6221(0x98)]('\x20\x20'+a22_0x22a4da['dim'](_0x5d6221(0x16f))+'\x20'+_0x3b9a3e[_0x5d6221(0x143)]),console[_0x5d6221(0x98)]('\x20\x20'+_0xd8950e),console[_0x5d6221(0x98)]('\x0a'+a22_0x22a4da[_0x5d6221(0x8e)]('To\x20cancel:')+_0x5d6221(0x128)+_0x3b9a3e[_0x5d6221(0x143)]+_0x5d6221(0x109)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x39bd62(0x116)]='segment:parent:fields';[a22_0x39bd62(0x14e)]='List\x20available\x20fields\x20for\x20segmentation';async['execute'](_0x27faf1){const _0x14c8e3=a22_0x39bd62,{options:_0x87b85d,args:_0x4b1a39,tdx:_0xf74eb1}=_0x27faf1,_0x186d54=_0x4b1a39[0x0]||_0x87b85d[_0x14c8e3(0xcd)];if(!_0x186d54)return showParentSegmentNotSetError(_0x14c8e3(0x110)+_0x14c8e3(0x14f)),0x1;_0x87b85d[_0x14c8e3(0x144)]&&(console[_0x14c8e3(0x98)]('Site:\x20'+_0x87b85d[_0x14c8e3(0xf3)]),console[_0x14c8e3(0x98)]('Parent\x20segment:\x20'+_0x186d54));const _0x572bcb=await withSpinner(_0x14c8e3(0x1b8)+_0x186d54+_0x14c8e3(0x1bd),()=>_0xf74eb1[_0x14c8e3(0x136)]['listFields'](_0x186d54),{'verbose':_0x87b85d[_0x14c8e3(0x144)]}),_0x10227e=_0x572bcb[_0x14c8e3(0x193)];console[_0x14c8e3(0x98)]('✔\x20Found\x20'+_0x10227e[_0x14c8e3(0x117)]+_0x14c8e3(0x16b)+(_0x10227e[_0x14c8e3(0x117)]!==0x1?'s':''));if(_0x87b85d['json']||_0x87b85d[_0x14c8e3(0x167)])return await handleSDKOutput(_0x10227e,_0x87b85d),0x0;return displayFieldsHumanReadable(_0x10227e,_0x186d54),0x0;}}function a22_0x36d3(){const _0x11a5f3=['filter','schemaError','Events:','displayPreviewHints','site','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','parent_segment','execute','✔\x20No\x20changes\x20-\x20\x27','\x20Context\x20set:\x20','Site:\x20','Listing\x20parent\x20segments...','varchar','yellow','displaySummary','coveragePercent','segment:parent:list','database','Rows:','Master\x20+\x20Attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','status','column_type','Listing\x20parent\x20segments\x20matching\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','test','\x20kill','red','push','Errors:','customerGroup','\x22,\x20\x22type\x22:\x20\x22','Error:\x20Parent\x20segment\x20name\x20is\x20required','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Error\x20reading\x20file:\x20','pullParentYaml','segment:parent:run','platform','double','name','length','\x20[Job\x20ID:\x20','displayPreviewResults','\x22\x20}','resolveParentId','toFixed','toLowerCase','displayValidateResults','✘\x20Failed\x20to\x20rename\x20directory:\x20','Attributes','web','%)\x20','behavior','\x0aChanges\x20to\x20apply\x20to\x20\x27','segment:parent:create','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','customers','\x20tdx\x20wf\x20attempt\x20','parent_id','segment:parent:validate','enriched','matchedCount','information_schema','errors','Aborted.','sampleData','ignore','darwin','Creating','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','rowCount','segment','Analyzing\x20changes...','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Join:','columns','addBehaviorsFile','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','3822XkfEBg','SQL\x20query:\x0a','sort','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','using\x20the\x20default\x20path:\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','workflowAttemptId','verbose','\x20behaviors','addAttributes','column','Show\x20parent\x20segment\x20details','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','population','\x0a\x20\x20\x20\x20}','preview','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','8SGAaHj','.yaml','Join\x20on:','green','addAttributesFile','replace','\x27\x20and\x20run\x20workflow?','Source:','Validate:','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x0aNew\x20parent\x20segment\x20\x27','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Preview:','Session:','Available\x20attributes:','/app/dw/parentSegments/','start','json','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','1181346fGKzVd','No\x20parent\x20segments\x20found','Updating','jsonl','run','totalEvents','schemaValid','\x20field','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','dirname','pushParentYaml','Attempt:','displaySampleData','scheduleOption','unref','Error:\x20--attribute\x20requires\x20a\x20name\x0a','runParent','{\x0a\x20\x20\x22database\x22:\x20\x22','5774787ZpuOhT','addBehaviors','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','cyan','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','processedRows','\x0a✔\x20Workflow\x20started','repeat','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20=\x20','timezone','win32','join','Options:\x0a','allValid','Schema\x20saved\x20to\x20','text','/\x20directories\x20exist.','Updated','stop','\x20\x20No\x20sample\x20data\x20available','updateParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','getParentFull','Master:','\x0a\x20\x20]\x0a}\x0a','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Status:','data','✔\x20Found\x20','joinKey','\x0aNo\x20sample\x20data\x20available','master','createParent','\x20--behavior\x20\x22','segment:parent:pull','Fetching\x20SQL\x20for\x20\x27','attributesFile','previewParentYaml','\x20is\x20already\x20up\x20to\x20date','all','map','column_name','listParents','customersWithEvents','attributes','output','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','.customers)','attribute','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','282KkAuQQ','formatSchemaJson','\x0a\x20\x20\x20\x20]','setJobId','open','\x20parent\x20segment\x20\x27','.yml','label','\x27\x20with\x20ID:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','reduce','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','toLocaleString','Listing\x20fields\x20for\x20\x27','workflowId','customerPercent','\x27\x20is\x20up\x20to\x20date','displayMasterInfo','\x27...','\x20Opening\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','trim','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','/\x20→\x20','YAML\x20file:\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','customerGroupFile','foreignKey','SELECT\x20*\x20FROM\x20(\x0a','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','Create\x20parent\x20segment\x20\x27','segment:parent:view','Fetching\x20sample\x20data...','displayBehaviorsStats','displayColumns','FINISHED','Created','800670AKpHnE','Fetching\x20behavior\x20list...','dim','\x20--enriched','Fetching\x20parent\x20segment\x20\x27','Overwrite\x20\x27','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Found\x20YAML\x20file:\x20','Enriched:','Resolving\x20parent\x20segment\x20\x27','message','Show\x20parent\x20segment\x20schema\x20(column\x20types)','error','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','displayAttributesStats','string','/\x20and\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','/{name}.yml\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','collectSchema','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','yes','audienceId','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Error:','/app/workflows/','jobId','Updating\x20parent\x20segment\x20\x27','match','utf-8','log','stats','Master\x20Table','\x20No\x20changes\x20-\x20','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','No\x20parent\x20segments\x20match\x20pattern:\x20','number','Creating\x20parent\x20segment\x20\x27','Customers:','segment:parent:push','1262612OZFIyS','446616KGpoTN','\x20\x20\x20\x20-\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','getParentSQL','apply','\x5c$&','\x20--interval\x20','-1d','Parent\x20segment:\x20','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','Audience\x20ID:','segment:parent:sql','behaviors','endsWith','format','Behaviors','table','10LMJASt','tdx\x20segment\x20parent\x20preview\x20','Error:\x20File\x20not\x20found:\x20','parentSegment','keys','\x20--attribute\x20\x22','\x20\x20Columns:\x20','\x20parent\x20segment','isDirectory','SELECT\x20*\x20FROM\x20','Options:','segment:parent:show','segment:parent:update','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20Configuration\x20is\x20valid','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x0aError:','Error\x20parsing\x20YAML:\x20','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Columns:','Name:\x20','bold','parent_segments','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','List\x20parent\x20segments','\x0aChanges\x20to\x20\x27','session','behavior_','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','scheduleType','1772806kZYmNn','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','interval','getBehaviorNames','\x20\x20Tables:\x201\x20customers\x20+\x20'];a22_0x36d3=function(){return _0x11a5f3;};return a22_0x36d3();}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0x86);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x148);async[a22_0x39bd62(0xf6)](_0x59ddc3){const _0x343a0d=a22_0x39bd62,{options:_0x1ec973,args:_0x5c7d1d,tdx:_0x552845}=_0x59ddc3,_0x59c6f2=_0x1ec973,_0x50080b=_0x5c7d1d[0x0]||_0x1ec973[_0x343a0d(0xcd)];if(!_0x50080b)return showParentSegmentNotSetError(_0x343a0d(0x9d)+_0x343a0d(0x9f)+_0x343a0d(0x184)+_0x343a0d(0x17b)),0x1;_0x1ec973[_0x343a0d(0x144)]&&(console[_0x343a0d(0x98)](_0x343a0d(0xf9)+_0x1ec973['site']),console[_0x343a0d(0x98)](_0x343a0d(0xc1)+_0x50080b));const _0x3520bd=await withSpinner(_0x343a0d(0x90)+_0x50080b+_0x343a0d(0x1bd),()=>_0x552845[_0x343a0d(0x136)]['getParentFull'](_0x50080b),{'verbose':_0x1ec973[_0x343a0d(0x144)]}),_0x36c436=_0x3520bd[_0x343a0d(0x193)];if(_0x59c6f2[_0x343a0d(0x121)]){const _0x4b3027=getConsoleNextUrl(_0x59c6f2[_0x343a0d(0xf3)],_0x343a0d(0x15f)+_0x36c436['id']);return console['error'](a22_0x22a4da[_0x343a0d(0x153)]('✔')+_0x343a0d(0x1be)+a22_0x22a4da['cyan'](_0x4b3027)),openBrowser(_0x4b3027),0x0;}return await handleSingleObjectOutput(_0x36c436,_0x1ec973),0x0;}}function a22_0x107b(_0x1d6bb4,_0x1654d9){_0x1d6bb4=_0x1d6bb4-0x7e;const _0x36d3ba=a22_0x36d3();let _0x107bf5=_0x36d3ba[_0x1d6bb4];return _0x107bf5;}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x39bd62(0x116)]='segment:parent:desc';[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x97);async[a22_0x39bd62(0xf6)](_0x5ed639){const _0x4c9ed8=a22_0x39bd62,{options:_0xecbb2b,args:_0x483e61,tdx:_0x5c6b6f}=_0x5ed639,_0x4c5acc=_0xecbb2b,_0x3a4914=_0x483e61[0x0]||_0xecbb2b[_0x4c9ed8(0xcd)];if(!_0x3a4914)return showParentSegmentNotSetError(_0x4c9ed8(0x80)+_0x4c9ed8(0x13c)+_0x4c9ed8(0x184)+'\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path'),0x1;_0xecbb2b['verbose']&&(console[_0x4c9ed8(0x98)](_0x4c9ed8(0xf9)+_0xecbb2b['site']),console[_0x4c9ed8(0x98)](_0x4c9ed8(0xc1)+_0x3a4914));const _0x3ca501=await withSpinner(_0x4c9ed8(0x95)+_0x3a4914+_0x4c9ed8(0x1bd),()=>_0x5c6b6f[_0x4c9ed8(0x136)][_0x4c9ed8(0x11b)](_0x3a4914),{'verbose':_0xecbb2b[_0x4c9ed8(0x144)]}),_0x23795b=_0x3ca501[_0x4c9ed8(0x193)],_0x22a990=_0x5c6b6f['segment']['getOutputDatabaseName'](_0x23795b);if(_0x4c5acc[_0x4c9ed8(0x1a5)]){const _0x31bc25=await this[_0x4c9ed8(0xa0)](_0x5ed639,_0x3a4914,_0x23795b,_0x22a990),_0xf08301=this[_0x4c9ed8(0x1ac)](_0x31bc25);writeFileSync(_0x4c5acc[_0x4c9ed8(0x1a5)],_0xf08301);const _0x255994=_0x31bc25[_0x4c9ed8(0x127)][_0x4c9ed8(0x13a)][_0x4c9ed8(0x117)]+_0x31bc25[_0x4c9ed8(0xc5)][_0x4c9ed8(0x1b5)]((_0x4b392c,_0x33bcc4)=>_0x4b392c+_0x33bcc4[_0x4c9ed8(0x13a)]['length'],0x0),_0x6506f2=_0x31bc25[_0x4c9ed8(0xc5)][_0x4c9ed8(0xef)](_0xde5806=>_0xde5806[_0x4c9ed8(0x13a)][_0x4c9ed8(0x117)]===0x0)['length'];return console[_0x4c9ed8(0xae)](_0x4c9ed8(0x186)+_0x4c5acc['output']),console[_0x4c9ed8(0xae)]('\x20\x20Database:\x20'+_0x22a990),console[_0x4c9ed8(0xae)](_0x4c9ed8(0xee)+_0x31bc25[_0x4c9ed8(0xc5)]['length']+_0x4c9ed8(0x145)),console[_0x4c9ed8(0xae)](_0x4c9ed8(0xd0)+_0x255994+'\x20total'),_0x6506f2>0x0&&console[_0x4c9ed8(0xae)]('\x20\x20Note:\x20'+_0x6506f2+_0x4c9ed8(0x84)),0x0;}console[_0x4c9ed8(0x98)]('\x0a'+a22_0x22a4da['bold']('Output\x20Database:')+'\x20'+a22_0x22a4da[_0x4c9ed8(0x17a)](_0x22a990));const _0x2c34c9=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x5c6b6f[_0x4c9ed8(0x136)][_0x4c9ed8(0xbc)](_0x23795b),{'verbose':_0xecbb2b['verbose']});console['error']('\x0a'+a22_0x22a4da[_0x4c9ed8(0xe0)]('customers')+'\x20'+a22_0x22a4da[_0x4c9ed8(0x8e)]('('+_0x22a990+_0x4c9ed8(0x1a8)));const _0x37521d=await executeSchemaQuery(_0x2c34c9['data'],_0x5c6b6f,_0xecbb2b);await handleQueryOutput(_0x37521d,_0xecbb2b);const _0x21aa43=await withSpinner(_0x4c9ed8(0x8d),()=>_0x5c6b6f[_0x4c9ed8(0x136)][_0x4c9ed8(0xed)](_0x23795b),{'verbose':_0xecbb2b[_0x4c9ed8(0x144)]});for(const _0x5d47c2 of _0x21aa43[_0x4c9ed8(0x193)]){const _0x5e7f30='behavior_'+_0x5d47c2[_0x4c9ed8(0x11d)]()['replace'](/\s+/g,'_'),_0x396f53=_0x4c9ed8(0xd3)+_0x22a990+'.'+_0x5e7f30;console['error']('\x0a'+a22_0x22a4da[_0x4c9ed8(0xe0)](_0x5d47c2)+'\x20'+a22_0x22a4da['dim']('('+_0x22a990+'.'+_0x5e7f30+')'));try{const _0x4ef127=await executeSchemaQuery(_0x396f53,_0x5c6b6f,_0xecbb2b);await handleQueryOutput(_0x4ef127,_0xecbb2b);}catch{console[_0x4c9ed8(0x98)](a22_0x22a4da['yellow']('\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)'));}}return 0x0;}async[a22_0x39bd62(0xa0)](_0x206c66,_0xf1510f,_0x507a72,_0x261a29){const _0x413c38=a22_0x39bd62,{options:_0x29f28d,tdx:_0x1b9e9f}=_0x206c66,_0x21599e=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x1b9e9f['segment'][_0x413c38(0xbc)](_0x507a72),{'verbose':_0x29f28d['verbose']}),_0x46d291=await executeSchemaQuery(_0x21599e[_0x413c38(0x193)],_0x1b9e9f,_0x29f28d),_0x58b4e4=_0x46d291[_0x413c38(0x193)][_0x413c38(0x1a0)](_0x36ca73=>({'name':_0x36ca73[_0x413c38(0x1a1)],'type':_0x36ca73[_0x413c38(0x105)]})),_0x1e2d73=await withSpinner(_0x413c38(0x8d),()=>_0x1b9e9f[_0x413c38(0x136)]['getBehaviorNames'](_0x507a72),{'verbose':_0x29f28d[_0x413c38(0x144)]}),_0x45b236=[];for(const _0x1e7d6c of _0x1e2d73['data']){const _0x5594e3=_0x413c38(0xe6)+_0x1e7d6c[_0x413c38(0x11d)]()[_0x413c38(0x155)](/\s+/g,'_'),_0x6a069f='SELECT\x20*\x20FROM\x20'+_0x261a29+'.'+_0x5594e3;let _0x4aaa28=[];try{const _0x1f90a4=await executeSchemaQuery(_0x6a069f,_0x1b9e9f,_0x29f28d);_0x4aaa28=_0x1f90a4[_0x413c38(0x193)][_0x413c38(0x1a0)](_0x40d0c7=>({'name':_0x40d0c7['column_name'],'type':_0x40d0c7[_0x413c38(0x105)]}));}catch{}_0x45b236[_0x413c38(0x10b)]({'table':_0x5594e3,'columns':_0x4aaa28});}return{'database':_0x261a29,'parent_segment':_0xf1510f,'parent_id':_0x507a72,'customers':{'table':_0x413c38(0x127),'columns':_0x58b4e4},'behaviors':_0x45b236};}['formatSchemaJson'](_0x1711b7){const _0x16ac88=a22_0x39bd62,_0x5a7544=_0x5624b5=>{const _0x29e77b=a22_0x107b;if(_0x5624b5[_0x29e77b(0x117)]===0x0)return'[]';const _0x341c16=_0x5624b5[_0x29e77b(0x1a0)](_0x825e54=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x825e54['name']+_0x29e77b(0x10e)+_0x825e54['type']+_0x29e77b(0x11a));return'[\x0a'+_0x341c16[_0x29e77b(0x183)](',\x0a')+_0x29e77b(0x1ad);},_0x1c1592=_0x1711b7[_0x16ac88(0xc5)][_0x16ac88(0x1a0)](_0x312139=>{const _0x39304f=_0x16ac88;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x312139[_0x39304f(0xc9)]+_0x39304f(0x138)+_0x5a7544(_0x312139[_0x39304f(0x13a)])[_0x39304f(0x155)](/^/gm,'\x20\x20')[_0x39304f(0x1c1)]()+_0x39304f(0x14b);})[_0x16ac88(0x183)](',\x0a');return _0x16ac88(0x175)+_0x1711b7[_0x16ac88(0x100)]+_0x16ac88(0xc2)+_0x1711b7[_0x16ac88(0xf5)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x1711b7[_0x16ac88(0x129)]+_0x16ac88(0x191)+_0x1711b7[_0x16ac88(0x127)]['table']+'\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20'+_0x5a7544(_0x1711b7['customers']['columns'])['replace'](/^/gm,'\x20\x20')[_0x16ac88(0x1c1)]()+_0x16ac88(0xbb)+_0x1c1592+_0x16ac88(0x190);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xc4);['description']='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x5939f2){const _0x31e10b=a22_0x39bd62,{options:_0x5679c6,args:_0xaa25b1,tdx:_0xa685df}=_0x5939f2,_0x5d5df8=_0xaa25b1[0x0]||_0x5679c6[_0x31e10b(0xcd)];if(!_0x5d5df8)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'+_0x31e10b(0x18d)),0x1;_0x5679c6['verbose']&&(console['error'](_0x31e10b(0xf9)+_0x5679c6[_0x31e10b(0xf3)]),console['error'](_0x31e10b(0xc1)+_0x5d5df8));const _0x23dff4=await withSpinner(_0x31e10b(0x95)+_0x5d5df8+_0x31e10b(0x1bd),()=>_0xa685df[_0x31e10b(0x136)][_0x31e10b(0x11b)](_0x5d5df8),{'verbose':_0x5679c6[_0x31e10b(0x144)]}),_0x2777d1=_0x23dff4['data'],_0x8dfc9f=await withSpinner(_0x31e10b(0x19b)+_0x5d5df8+'\x27...',()=>_0xa685df[_0x31e10b(0x136)]['getParentSQL'](_0x2777d1),{'verbose':_0x5679c6[_0x31e10b(0x144)]}),_0x472dc5=_0x8dfc9f[_0x31e10b(0x193)];return _0x5679c6[_0x31e10b(0xc7)]==='json'||_0x5679c6['format']===_0x31e10b(0x167)?await handleSDKOutput([{'sql':_0x472dc5}],_0x5679c6):console[_0x31e10b(0xae)](_0x472dc5),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x39bd62(0x116)]=a22_0x39bd62(0xd5);[a22_0x39bd62(0x14e)]=a22_0x39bd62(0x15b);async[a22_0x39bd62(0xf6)](_0xaa53f5){const _0x254198=a22_0x39bd62,{options:_0x10a8a3,args:_0x27eca2,tdx:_0x30371c}=_0xaa53f5,_0x47c30b=_0x27eca2[0x0]||_0x10a8a3[_0x254198(0xcd)];if(!_0x47c30b)return showParentSegmentNotSetError(_0x254198(0x99)+'\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;_0x10a8a3[_0x254198(0x144)]&&(console[_0x254198(0x98)](_0x254198(0xf9)+_0x10a8a3[_0x254198(0xf3)]),console[_0x254198(0x98)](_0x254198(0xc1)+_0x47c30b));const _0x5cc18b=await withSpinner(_0x254198(0x95)+_0x47c30b+'\x27...',()=>_0x30371c[_0x254198(0x136)]['resolveParentId'](_0x47c30b),{'verbose':_0x10a8a3[_0x254198(0x144)]}),_0x229980=_0x5cc18b[_0x254198(0x193)],_0xa3480d=await withSpinner(_0x254198(0x19b)+_0x47c30b+_0x254198(0x1bd),()=>_0x30371c['segment'][_0x254198(0xbc)](_0x229980),{'verbose':_0x10a8a3['verbose']});let _0x1698c5=_0xa3480d[_0x254198(0x193)];const _0x331dda=resolveLimit(_0x10a8a3['limit'],DEFAULT_DISPLAY_LIMIT),_0x5060bf=/\bLIMIT\s+\d+/i[_0x254198(0x108)](_0x1698c5);!_0x5060bf&&(_0x1698c5=_0x1698c5[_0x254198(0x1c1)]()[_0x254198(0x155)](/;+$/,''),_0x1698c5=_0x254198(0x83)+_0x1698c5+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x331dda);_0x10a8a3[_0x254198(0x144)]&&console[_0x254198(0x98)](_0x254198(0x13e)+_0x1698c5);const _0x159226=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x25b4ec=>{const _0x41cd94=_0x254198,_0xc187bf=await _0x30371c['query'][_0x41cd94(0xf6)](_0x1698c5,{'catalog':'td','schema':_0x41cd94(0x12d),'onJobId':_0x4f3383=>{const _0x3a1141=_0x41cd94;_0x25b4ec[_0x3a1141(0x1ae)](_0x4f3383);}});return _0xc187bf;},{'verbose':_0x10a8a3[_0x254198(0x144)]}),_0x4973c9=_0x159226[_0x254198(0x193)],_0x128cd3=_0x4973c9['jobId']?_0x254198(0x118)+_0x4973c9[_0x254198(0xaa)]+']':'';return console[_0x254198(0x98)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x4973c9['stats'][_0x254198(0x17c)][_0x254198(0x1b7)]()+'\x20rows\x20'+('in\x20'+formatElapsed(_0x4973c9[_0x254198(0xaf)]['elapsedTimeMillis'])+_0x128cd3)),await handleQueryOutput(_0x4973c9,_0x10a8a3),0x0;}}
@@ -1 +1 @@
1
- const a23_0x8dce31=a23_0x2943;(function(_0x34e3ec,_0x2d584f){const _0x55439e=a23_0x2943,_0x28c99d=_0x34e3ec();while(!![]){try{const _0x58c82b=parseInt(_0x55439e(0x17f))/0x1*(-parseInt(_0x55439e(0x182))/0x2)+parseInt(_0x55439e(0x19b))/0x3*(parseInt(_0x55439e(0x13e))/0x4)+parseInt(_0x55439e(0x16c))/0x5*(-parseInt(_0x55439e(0x14f))/0x6)+-parseInt(_0x55439e(0x161))/0x7*(-parseInt(_0x55439e(0x17b))/0x8)+parseInt(_0x55439e(0x189))/0x9*(-parseInt(_0x55439e(0x1a4))/0xa)+-parseInt(_0x55439e(0x171))/0xb*(-parseInt(_0x55439e(0x17a))/0xc)+parseInt(_0x55439e(0x197))/0xd;if(_0x58c82b===_0x2d584f)break;else _0x28c99d['push'](_0x28c99d['shift']());}catch(_0x344e47){_0x28c99d['push'](_0x28c99d['shift']());}}}(a23_0x2599,0x1fb98));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x445a7e from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x2fff0b from'prompts';import a23_0x4c3044 from'chalk';function a23_0x2599(){const _0x1b23f8=['\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Operation\x20cancelled','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Default\x20profile\x20set\x20to:\x20','other','email','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','green','Set\x20a\x20profile\x20configuration\x20value','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','5780CJfFtx','bold','profile:use','site','test','warn','Failed\x20to\x20remove\x20profile:\x20','Changing\x20site\x20to\x20\x27','profile:remove','tdx:\x20profile\x20remove','status','customSite','trim','tdx.json','password','Validating\x20API\x20key...','us01','35274wxXbAi','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Site\x20name\x20cannot\x20be\x20empty','confirm','Enter\x20your\x20TD\x20API\x20key:','\x20Profile\x20\x27','select','dim','profile:create','\x27\x20removed\x20from\x20configuration','jobs','\x27\x20created','yellow','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aSaved\x20to:\x20','includes','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','602FssuQt','execute','name','\x20\x20-\x20','\x0aSetup\x20cancelled','llm_agent','validate','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','\x27\x20updated:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','5ukJNSg','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','apiKey','red','2191442fHiVdE','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','text','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Profile\x20\x27','config','/app/mp/ak','split','join','12BkJnTK','16472hZWwjq','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','getUserInfo','Enter\x20site\x20name:','641IQXqHs','default','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','778QnKzJZ','parent_segment','Create\x20a\x20new\x20profile','\x0aOperation\x20cancelled','\x0aAvailable\x20profiles:','Removal\x20cancelled','description','20187OtVPPG','\x27\x20does\x20not\x20exist.','profile','tdx:\x20profile\x20create','log','(cleared)','Unknown\x20key\x20\x27','\x20\x20(no\x20profiles\x20found)','Set\x20session\x20profile','create','\x20API\x20key\x20is\x20valid\x20(User:\x20','profile:set','error','session','1113814KFCRrX','message','\x20--default\x27\x20to\x20save\x20permanently','✗\x20Validation\x20failed:\x20','255rupTxs','\x20\x20tdx\x20--profile\x20','Site\x20was\x20not\x20changed.','API\x20key\x20cannot\x20be\x20empty','(session:\x20','ERROR','profileName','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','VALID_KEYS','890IUnEwl','logLevel','length','Session\x20profile\x20set\x20to:\x20','Enter\x20profile\x20name:'];a23_0x2599=function(){return _0x1b23f8;};return a23_0x2599();}function validateProfileName(_0x251a1c){const _0x448d59=a23_0x2943;if(!_0x251a1c||!_0x251a1c[_0x448d59(0x14a)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x265e90=_0x251a1c['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x265e90))return _0x448d59(0x17c);if(profileExists(_0x265e90))return'Profile\x20\x27'+_0x265e90+_0x448d59(0x1af);return!![];}function a23_0x2943(_0x35ba2b,_0x273b43){_0x35ba2b=_0x35ba2b-0x13a;const _0x259944=a23_0x2599();let _0x29436c=_0x259944[_0x35ba2b];return _0x29436c;}export class ProfileCreateCommand extends BaseCommand{[a23_0x8dce31(0x163)]=a23_0x8dce31(0x157);[a23_0x8dce31(0x188)]=a23_0x8dce31(0x184);async[a23_0x8dce31(0x162)](_0x59090c){const _0x57c3b9=a23_0x8dce31,{options:_0x34e9be,args:_0x284290}=_0x59090c;console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x13f)](_0x57c3b9(0x18c)));let _0x13d3f6;if(_0x284290[_0x57c3b9(0x1a6)]>0x0&&_0x284290[0x0]){const _0x4cd9ac=_0x284290[0x0][_0x57c3b9(0x14a)](),_0x31be40=validateProfileName(_0x4cd9ac);if(_0x31be40!==!![])return console[_0x57c3b9(0x195)](a23_0x4c3044[_0x57c3b9(0x170)](_0x31be40)),0x1;_0x13d3f6=_0x4cd9ac;}else{const _0x680f28=await a23_0x2fff0b({'type':_0x57c3b9(0x173),'name':_0x57c3b9(0x1a1),'message':_0x57c3b9(0x1a8),'validate':validateProfileName});if(!_0x680f28[_0x57c3b9(0x1a1)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x13d3f6=_0x680f28['profileName'][_0x57c3b9(0x14a)]();}const _0x44828d=await a23_0x2fff0b({'type':_0x57c3b9(0x173),'name':_0x57c3b9(0x188),'message':'Enter\x20description\x20(optional):'}),_0x38b8a7=_0x44828d[_0x57c3b9(0x188)]?.['trim']()||undefined,_0x4b92b6=_0x34e9be[_0x57c3b9(0x141)]||_0x57c3b9(0x14e),{choices:_0x5ef065,initialIndex:_0x4d14e0}=buildSiteChoices(_0x4b92b6),_0x389e98=await a23_0x2fff0b({'type':_0x57c3b9(0x155),'name':'site','message':_0x57c3b9(0x1a2)+_0x13d3f6+'\x27:','choices':_0x5ef065,'initial':_0x4d14e0});if(!_0x389e98[_0x57c3b9(0x141)])return console[_0x57c3b9(0x18d)]('\x0aSetup\x20cancelled'),0x1;let _0x418ceb;if(_0x389e98[_0x57c3b9(0x141)]===_0x57c3b9(0x1ad)){const _0x429524=await a23_0x2fff0b({'type':'text','name':_0x57c3b9(0x149),'message':_0x57c3b9(0x17e),'initial':_0x57c3b9(0x14e),'validate':_0x4b57d2=>{const _0x34e3d1=_0x57c3b9;if(!_0x4b57d2||!_0x4b57d2[_0x34e3d1(0x14a)]())return _0x34e3d1(0x151);if(!/^[a-z0-9-]+$/[_0x34e3d1(0x142)](_0x4b57d2[_0x34e3d1(0x14a)]()))return _0x34e3d1(0x1ab);return!![];}});if(!_0x429524[_0x57c3b9(0x149)])return console['log'](_0x57c3b9(0x165)),0x1;_0x418ceb=_0x429524[_0x57c3b9(0x149)];}else _0x418ceb=_0x389e98[_0x57c3b9(0x141)];const _0x1641ff=resolveSite(_0x418ceb);console[_0x57c3b9(0x18d)](_0x57c3b9(0x181)+_0x1641ff),console[_0x57c3b9(0x18d)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x57c3b9(0x18d)]('\x20\x20'+getConsoleUrl(_0x1641ff,_0x57c3b9(0x177)));const _0xc24ad0=await a23_0x2fff0b({'type':_0x57c3b9(0x14c),'name':'apiKey','message':_0x57c3b9(0x153),'validate':_0x7cb96d=>{const _0x365576=_0x57c3b9;if(!_0x7cb96d||!_0x7cb96d['trim']())return _0x365576(0x19e);return!![];}});if(!_0xc24ad0[_0x57c3b9(0x16f)])return console[_0x57c3b9(0x18d)](_0x57c3b9(0x165)),0x1;const _0x152abe=_0xc24ad0['apiKey'];console[_0x57c3b9(0x18d)](_0x57c3b9(0x14d));try{const _0x3ddcc6=TDX[_0x57c3b9(0x192)]({'site':_0x1641ff,'apiKey':_0x152abe[_0x57c3b9(0x14a)](),'logLevel':_0x34e9be[_0x57c3b9(0x1a5)]??LogLevel[_0x57c3b9(0x1a0)]}),_0x52edad=await _0x3ddcc6[_0x57c3b9(0x159)][_0x57c3b9(0x17d)]();console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x1b0)]('✓')+_0x57c3b9(0x193)+_0x52edad[_0x57c3b9(0x1ae)]+')');const _0x3fe967=await isKeychainAvailable();_0x3fe967?(await saveAPIKeyAsync(_0x152abe[_0x57c3b9(0x14a)](),_0x1641ff,_0x13d3f6),console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x1b0)]('✓')+_0x57c3b9(0x1a9)+_0x13d3f6+')')):(console[_0x57c3b9(0x143)](a23_0x4c3044[_0x57c3b9(0x15b)](_0x57c3b9(0x16e))),console[_0x57c3b9(0x143)](a23_0x4c3044[_0x57c3b9(0x15b)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x103885={'site':_0x1641ff,..._0x38b8a7&&{'description':_0x38b8a7}};return saveProfileToUserConfig(_0x13d3f6,_0x103885),console[_0x57c3b9(0x18d)](a23_0x4c3044[_0x57c3b9(0x1b0)]('✓')+_0x57c3b9(0x154)+_0x13d3f6+_0x57c3b9(0x15a)),console['log'](),console[_0x57c3b9(0x18d)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x57c3b9(0x18d)]('\x20\x20tdx\x20--profile\x20'+_0x13d3f6+_0x57c3b9(0x16d)),console[_0x57c3b9(0x18d)](_0x57c3b9(0x19c)+_0x13d3f6+_0x57c3b9(0x16b)),0x0;}catch(_0x2dda72){if(_0x2dda72 instanceof HTTPClientError&&_0x2dda72['status']===0x191)return printAuthError(_0x2dda72),0x1;return console['error'](a23_0x4c3044[_0x57c3b9(0x170)]('✗\x20Validation\x20failed:\x20'+(_0x2dda72 instanceof Error?_0x2dda72[_0x57c3b9(0x198)]:String(_0x2dda72)))),console[_0x57c3b9(0x195)](_0x57c3b9(0x13b)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a23_0x8dce31(0x146);[a23_0x8dce31(0x188)]='Remove\x20a\x20profile';[a23_0x8dce31(0x167)](_0x42cb33){const _0x267b2a=a23_0x8dce31,{args:_0x502f5d}=_0x42cb33;if(_0x502f5d[_0x267b2a(0x1a6)]===0x0)return _0x267b2a(0x174);return undefined;}async['execute'](_0x41f3e3){const _0xd801ce=a23_0x8dce31,{args:_0x458971}=_0x41f3e3,_0x250eb0=_0x458971[0x0];console[_0xd801ce(0x18d)](a23_0x4c3044[_0xd801ce(0x13f)](_0xd801ce(0x147)));if(!profileExists(_0x250eb0)){console[_0xd801ce(0x195)](a23_0x4c3044['red'](_0xd801ce(0x175)+_0x250eb0+'\x27\x20does\x20not\x20exist.')),console[_0xd801ce(0x18d)]('\x0aAvailable\x20profiles:');const _0x31f13b=listProfiles();if(_0x31f13b[_0xd801ce(0x1a6)]===0x0)console[_0xd801ce(0x18d)](_0xd801ce(0x190));else for(const _0x69be22 of _0x31f13b){console[_0xd801ce(0x18d)]('\x20\x20-\x20'+_0x69be22[_0xd801ce(0x163)]);}return 0x1;}const _0x19e0df=await a23_0x2fff0b({'type':'confirm','name':'confirm','message':_0xd801ce(0x15d)+_0x250eb0+'\x27?','initial':![]});if(!_0x19e0df['confirm'])return console[_0xd801ce(0x18d)](_0xd801ce(0x187)),0x0;try{removeProfileFromUserConfig(_0x250eb0),console['log'](a23_0x4c3044[_0xd801ce(0x1b0)]('✓')+'\x20Profile\x20\x27'+_0x250eb0+_0xd801ce(0x158));}catch(_0x27b65a){return console[_0xd801ce(0x195)](a23_0x4c3044['red'](_0xd801ce(0x144)+(_0x27b65a instanceof Error?_0x27b65a[_0xd801ce(0x198)]:String(_0x27b65a)))),0x1;}const _0x3b959b=await isKeychainAvailable();if(_0x3b959b){const _0x30898e=await deleteKeychainAPIKey(_0x250eb0);_0x30898e&&console['log'](a23_0x4c3044[_0xd801ce(0x1b0)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x8dce31(0x163)]=a23_0x8dce31(0x194);[a23_0x8dce31(0x188)]=a23_0x8dce31(0x13a);static [a23_0x8dce31(0x1a3)]=['site','database',a23_0x8dce31(0x183),'llm_project',a23_0x8dce31(0x166),'description'];[a23_0x8dce31(0x167)](_0x46c863){const _0x18984f=a23_0x8dce31,{args:_0x380760,options:_0x9b83e7}=_0x46c863,_0x446bbf=_0x9b83e7['profile']||getActiveProfile();if(!_0x446bbf)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x380760[_0x18984f(0x1a6)]===0x0)return _0x18984f(0x160)+ProfileSetCommand[_0x18984f(0x1a3)][_0x18984f(0x179)](',\x20');const _0x30db5b=_0x380760[0x0];if(!_0x30db5b[_0x18984f(0x15f)]('='))return _0x18984f(0x13d)+ProfileSetCommand[_0x18984f(0x1a3)]['join'](',\x20');const [_0x53b43a]=_0x30db5b[_0x18984f(0x178)]('=',0x2);if(!ProfileSetCommand[_0x18984f(0x1a3)][_0x18984f(0x15f)](_0x53b43a))return _0x18984f(0x18f)+_0x53b43a+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x18984f(0x1a3)]['join'](',\x20');return undefined;}async[a23_0x8dce31(0x162)](_0x261aac){const _0x3fad35=a23_0x8dce31,{args:_0x447f0c,options:_0x5a2ac9}=_0x261aac,_0xb8093a=_0x5a2ac9[_0x3fad35(0x18b)]||getActiveProfile(),[_0x47e690,..._0x51b3a0]=_0x447f0c[0x0][_0x3fad35(0x178)]('='),_0x4196b2=_0x51b3a0[_0x3fad35(0x179)]('=');console[_0x3fad35(0x18d)](a23_0x4c3044[_0x3fad35(0x13f)]('tdx:\x20profile\x20set'));if(!profileExists(_0xb8093a)){const _0x4c900d=await a23_0x2fff0b({'type':_0x3fad35(0x152),'name':_0x3fad35(0x192),'message':_0x3fad35(0x175)+_0xb8093a+_0x3fad35(0x168),'initial':!![]});if(!_0x4c900d[_0x3fad35(0x192)])return console[_0x3fad35(0x18d)](_0x3fad35(0x1aa)),0x1;}const _0x331782=loadProfile(_0xb8093a),_0x4a9121=_0x331782?.[_0x3fad35(0x176)]||{};if(_0x47e690===_0x3fad35(0x141)){const _0x13345d=resolveSite(_0x4196b2);console['log'](_0x3fad35(0x145)+_0x13345d+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x3fad35(0x18d)](_0x3fad35(0x169)),console[_0x3fad35(0x18d)]('\x20\x20'+getConsoleUrl(_0x13345d,'/app/mp/ak'));const _0xae7892=await a23_0x2fff0b({'type':'password','name':'apiKey','message':_0x3fad35(0x13c),'validate':_0xebae47=>{if(!_0xebae47||!_0xebae47['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0xae7892[_0x3fad35(0x16f)])return console[_0x3fad35(0x18d)](_0x3fad35(0x185)),0x1;console['log'](_0x3fad35(0x14d));try{const _0x2636f2=TDX[_0x3fad35(0x192)]({'site':_0x13345d,'apiKey':_0xae7892[_0x3fad35(0x16f)][_0x3fad35(0x14a)](),'logLevel':_0x5a2ac9[_0x3fad35(0x1a5)]??LogLevel[_0x3fad35(0x1a0)]}),_0x4aad2b=await _0x2636f2[_0x3fad35(0x159)][_0x3fad35(0x17d)]();console[_0x3fad35(0x18d)](a23_0x4c3044[_0x3fad35(0x1b0)]('✓')+_0x3fad35(0x193)+_0x4aad2b['email']+')');const _0x484084=await isKeychainAvailable();_0x484084?(await saveAPIKeyAsync(_0xae7892[_0x3fad35(0x16f)][_0x3fad35(0x14a)](),_0x13345d,_0xb8093a),console[_0x3fad35(0x18d)](a23_0x4c3044[_0x3fad35(0x1b0)]('✓')+_0x3fad35(0x150))):console[_0x3fad35(0x143)](a23_0x4c3044[_0x3fad35(0x15b)](_0x3fad35(0x16e))),_0x4a9121[_0x3fad35(0x141)]=_0x13345d;}catch(_0x539106){if(_0x539106 instanceof HTTPClientError&&_0x539106[_0x3fad35(0x148)]===0x191)return printAuthError(_0x539106),0x1;return console[_0x3fad35(0x195)](a23_0x4c3044['red'](_0x3fad35(0x19a)+(_0x539106 instanceof Error?_0x539106['message']:String(_0x539106)))),console['error'](_0x3fad35(0x19d)),0x1;}}else _0x4a9121[_0x47e690]=_0x4196b2||undefined;return saveProfileToUserConfig(_0xb8093a,_0x4a9121),console['log'](a23_0x4c3044['green']('✓')+_0x3fad35(0x154)+_0xb8093a+_0x3fad35(0x16a)+_0x47e690+'='+(_0x4196b2||_0x3fad35(0x18e))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a23_0x8dce31(0x163)]=a23_0x8dce31(0x140);['description']=a23_0x8dce31(0x191);[a23_0x8dce31(0x167)](_0x22cb1f){const _0x146897=a23_0x8dce31,{args:_0x254b64}=_0x22cb1f;if(_0x254b64['length']===0x0)return _0x146897(0x15c);return undefined;}async[a23_0x8dce31(0x162)](_0x18f772){const _0x350d7f=a23_0x8dce31,{args:_0x3f4eb2,options:_0x1f76cb}=_0x18f772,_0x599979=_0x3f4eb2[0x0],_0x4f4643=_0x1f76cb[_0x350d7f(0x180)];cleanExpiredSessions();if(!profileExists(_0x599979)){console[_0x350d7f(0x195)](a23_0x4c3044['red'](_0x350d7f(0x175)+_0x599979+_0x350d7f(0x18a))),console['log'](_0x350d7f(0x186));const _0x5bec1f=listProfiles();if(_0x5bec1f[_0x350d7f(0x1a6)]===0x0)console[_0x350d7f(0x18d)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x5da9eb of _0x5bec1f){console[_0x350d7f(0x18d)](_0x350d7f(0x164)+_0x5da9eb[_0x350d7f(0x163)]);}return 0x1;}if(_0x4f4643){const _0xe991b2=a23_0x445a7e[_0x350d7f(0x179)](getConfigDir(),_0x350d7f(0x14b));return saveActiveProfileToUserConfig(_0x599979),console['log'](_0x350d7f(0x1ac)+a23_0x4c3044[_0x350d7f(0x1b0)](_0x599979)),console[_0x350d7f(0x18d)](a23_0x4c3044[_0x350d7f(0x156)](_0x350d7f(0x15e)+_0xe991b2)),0x0;}const _0xe286a2=getSessionID(_0x1f76cb[_0x350d7f(0x196)]);return saveSessionContext({'profile':_0x599979},_0x1f76cb[_0x350d7f(0x196)]),console[_0x350d7f(0x18d)](_0x350d7f(0x1a7)+a23_0x4c3044[_0x350d7f(0x1b0)](_0x599979)+'\x20'+a23_0x4c3044['dim'](_0x350d7f(0x19f)+_0xe286a2+')')),console[_0x350d7f(0x18d)](a23_0x4c3044['dim'](_0x350d7f(0x172)+_0x599979+_0x350d7f(0x199))),0x0;}}
1
+ function a23_0x1702(){const _0x239320=['warn','name','create','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','apiKey','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','customSite','✗\x20Validation\x20failed:\x20','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','profile:use','database','Enter\x20description\x20(optional):','status','\x0aSaved\x20to:\x20','confirm','config','default','tdx:\x20profile\x20create','Enter\x20your\x20TD\x20API\x20key:','230866LrtDux','tdx.json','\x27\x20created','join','other','profile','\x20API\x20key\x20is\x20valid\x20(User:\x20','green','You\x20can\x20find\x20your\x20API\x20key\x20at:','Remove\x20a\x20profile','API\x20key\x20cannot\x20be\x20empty','\x27\x20requires\x20API\x20key\x20validation.','length','tdx:\x20profile\x20remove','VALID_KEYS','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20\x20tdx\x20--profile\x20','\x20--default\x27\x20to\x20save\x20permanently','76vJLMVQ','\x0aOperation\x20cancelled','text','logLevel','\x20API\x20key\x20removed\x20from\x20system\x20keychain','includes','Site\x20was\x20not\x20changed.','email','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Create\x20a\x20new\x20profile','password','(cleared)','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profileName','Default\x20profile\x20set\x20to:\x20','site','8owcosS','jobs','2367477CotAWG','Profile\x20name\x20cannot\x20be\x20empty','\x27.\x0a\x0aValid\x20keys:\x20','\x0aSetup\x20cancelled','log','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','884219vgcglq','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','split','6KYZgyL','\x20\x20-\x20','validate','/app/mp/ak','execute','description','tdx:\x20profile\x20set','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Enter\x20profile\x20name:','34266iRJeJc','Set\x20a\x20profile\x20configuration\x20value','\x0aAvailable\x20profiles:','(session:\x20','red','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Profile\x20\x27','dim','\x20API\x20key\x20saved\x20to\x20system\x20keychain','test','message','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20\x20(no\x20profiles\x20found)','Validating\x20API\x20key...','\x27\x20removed\x20from\x20configuration','Failed\x20to\x20remove\x20profile:\x20','\x20Profile\x20\x27','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','session','bold','Operation\x20cancelled','llm_agent','1188InCEcQ','217180GUyZzW','Site\x20name\x20cannot\x20be\x20empty','yellow','trim','Changing\x20site\x20to\x20\x27','95780SUXjEZ','\x27\x20does\x20not\x20exist.','getUserInfo','us01','profile:create','error','17960xCjXco','\x27\x20updated:\x20','Removal\x20cancelled','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'];a23_0x1702=function(){return _0x239320;};return a23_0x1702();}const a23_0x1ae9b2=a23_0x8a9c;(function(_0x42ba05,_0x1e0af1){const _0x44022f=a23_0x8a9c,_0x1c43f7=_0x42ba05();while(!![]){try{const _0x3f2ad0=-parseInt(_0x44022f(0x15f))/0x1+parseInt(_0x44022f(0x1b2))/0x2+-parseInt(_0x44022f(0x195))/0x3*(-parseInt(_0x44022f(0x171))/0x4)+parseInt(_0x44022f(0x1ad))/0x5*(-parseInt(_0x44022f(0x18c))/0x6)+parseInt(_0x44022f(0x189))/0x7+parseInt(_0x44022f(0x181))/0x8*(parseInt(_0x44022f(0x183))/0x9)+-parseInt(_0x44022f(0x145))/0xa*(parseInt(_0x44022f(0x1ac))/0xb);if(_0x3f2ad0===_0x1e0af1)break;else _0x1c43f7['push'](_0x1c43f7['shift']());}catch(_0x17f584){_0x1c43f7['push'](_0x1c43f7['shift']());}}}(a23_0x1702,0x2d698));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x429941 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';function a23_0x8a9c(_0xaf09ff,_0x460e27){_0xaf09ff=_0xaf09ff-0x145;const _0x170289=a23_0x1702();let _0x8a9cbe=_0x170289[_0xaf09ff];return _0x8a9cbe;}import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x281952 from'prompts';import a23_0x55073e from'chalk';function validateProfileName(_0x1c714e){const _0x5ee105=a23_0x8a9c;if(!_0x1c714e||!_0x1c714e[_0x5ee105(0x1b0)]())return _0x5ee105(0x184);const _0x24e214=_0x1c714e[_0x5ee105(0x1b0)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5ee105(0x19e)](_0x24e214))return _0x5ee105(0x179);if(profileExists(_0x24e214))return _0x5ee105(0x19b)+_0x24e214+_0x5ee105(0x188);return!![];}export class ProfileCreateCommand extends BaseCommand{[a23_0x1ae9b2(0x14a)]=a23_0x1ae9b2(0x1b6);[a23_0x1ae9b2(0x191)]=a23_0x1ae9b2(0x17a);async[a23_0x1ae9b2(0x190)](_0xb433e6){const _0x20f5ce=a23_0x1ae9b2,{options:_0x30a280,args:_0x220470}=_0xb433e6;console[_0x20f5ce(0x187)](a23_0x55073e[_0x20f5ce(0x1a9)](_0x20f5ce(0x15d)));let _0x11db46;if(_0x220470[_0x20f5ce(0x16b)]>0x0&&_0x220470[0x0]){const _0x3d9fd4=_0x220470[0x0]['trim'](),_0x5359a4=validateProfileName(_0x3d9fd4);if(_0x5359a4!==!![])return console[_0x20f5ce(0x1b7)](a23_0x55073e['red'](_0x5359a4)),0x1;_0x11db46=_0x3d9fd4;}else{const _0x41d0ca=await a23_0x281952({'type':_0x20f5ce(0x173),'name':_0x20f5ce(0x17e),'message':_0x20f5ce(0x194),'validate':validateProfileName});if(!_0x41d0ca[_0x20f5ce(0x17e)])return console[_0x20f5ce(0x187)](_0x20f5ce(0x186)),0x1;_0x11db46=_0x41d0ca[_0x20f5ce(0x17e)][_0x20f5ce(0x1b0)]();}const _0x52666d=await a23_0x281952({'type':_0x20f5ce(0x173),'name':'description','message':_0x20f5ce(0x157)}),_0x1c6d94=_0x52666d[_0x20f5ce(0x191)]?.[_0x20f5ce(0x1b0)]()||undefined,_0x1eaf2e=_0x30a280[_0x20f5ce(0x180)]||_0x20f5ce(0x1b5),{choices:_0xc17a45,initialIndex:_0x38936c}=buildSiteChoices(_0x1eaf2e),_0x561931=await a23_0x281952({'type':'select','name':_0x20f5ce(0x180),'message':_0x20f5ce(0x1a7)+_0x11db46+'\x27:','choices':_0xc17a45,'initial':_0x38936c});if(!_0x561931[_0x20f5ce(0x180)])return console[_0x20f5ce(0x187)](_0x20f5ce(0x186)),0x1;let _0x51aec2;if(_0x561931[_0x20f5ce(0x180)]===_0x20f5ce(0x163)){const _0x2b4d67=await a23_0x281952({'type':'text','name':_0x20f5ce(0x150),'message':'Enter\x20site\x20name:','initial':_0x20f5ce(0x1b5),'validate':_0x122611=>{const _0x5de063=_0x20f5ce;if(!_0x122611||!_0x122611[_0x5de063(0x1b0)]())return _0x5de063(0x1ae);if(!/^[a-z0-9-]+$/[_0x5de063(0x19e)](_0x122611[_0x5de063(0x1b0)]()))return _0x5de063(0x14f);return!![];}});if(!_0x2b4d67[_0x20f5ce(0x150)])return console[_0x20f5ce(0x187)](_0x20f5ce(0x186)),0x1;_0x51aec2=_0x2b4d67['customSite'];}else _0x51aec2=_0x561931[_0x20f5ce(0x180)];const _0x330cc9=resolveSite(_0x51aec2);console[_0x20f5ce(0x187)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x330cc9),console[_0x20f5ce(0x187)](_0x20f5ce(0x167)),console[_0x20f5ce(0x187)]('\x20\x20'+getConsoleUrl(_0x330cc9,_0x20f5ce(0x18f)));const _0x3a5d99=await a23_0x281952({'type':_0x20f5ce(0x17b),'name':_0x20f5ce(0x14e),'message':_0x20f5ce(0x15e),'validate':_0x3e7dd3=>{const _0x36ea7b=_0x20f5ce;if(!_0x3e7dd3||!_0x3e7dd3[_0x36ea7b(0x1b0)]())return _0x36ea7b(0x169);return!![];}});if(!_0x3a5d99[_0x20f5ce(0x14e)])return console['log'](_0x20f5ce(0x186)),0x1;const _0x3352ff=_0x3a5d99['apiKey'];console['log'](_0x20f5ce(0x1a3));try{const _0x2ec4f3=TDX[_0x20f5ce(0x14b)]({'site':_0x330cc9,'apiKey':_0x3352ff[_0x20f5ce(0x1b0)](),'logLevel':_0x30a280['logLevel']??LogLevel['ERROR']}),_0x50660f=await _0x2ec4f3[_0x20f5ce(0x182)][_0x20f5ce(0x1b4)]();console['log'](a23_0x55073e[_0x20f5ce(0x166)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x50660f[_0x20f5ce(0x178)]+')');const _0xb2605e=await isKeychainAvailable();_0xb2605e?(await saveAPIKeyAsync(_0x3352ff[_0x20f5ce(0x1b0)](),_0x330cc9,_0x11db46),console['log'](a23_0x55073e[_0x20f5ce(0x166)]('✓')+_0x20f5ce(0x148)+_0x11db46+')')):(console['warn'](a23_0x55073e[_0x20f5ce(0x1af)](_0x20f5ce(0x16e))),console[_0x20f5ce(0x149)](a23_0x55073e[_0x20f5ce(0x1af)](_0x20f5ce(0x18a))));const _0x33daf4={'site':_0x330cc9,..._0x1c6d94&&{'description':_0x1c6d94}};return saveProfileToUserConfig(_0x11db46,_0x33daf4),console['log'](a23_0x55073e[_0x20f5ce(0x166)]('✓')+'\x20Profile\x20\x27'+_0x11db46+_0x20f5ce(0x161)),console[_0x20f5ce(0x187)](),console[_0x20f5ce(0x187)](_0x20f5ce(0x154)),console[_0x20f5ce(0x187)](_0x20f5ce(0x16f)+_0x11db46+_0x20f5ce(0x19a)),console[_0x20f5ce(0x187)](_0x20f5ce(0x16f)+_0x11db46+_0x20f5ce(0x1a0)),0x0;}catch(_0x4c1c6b){if(_0x4c1c6b instanceof HTTPClientError&&_0x4c1c6b[_0x20f5ce(0x158)]===0x191)return printAuthError(_0x4c1c6b),0x1;return console[_0x20f5ce(0x1b7)](a23_0x55073e[_0x20f5ce(0x199)](_0x20f5ce(0x151)+(_0x4c1c6b instanceof Error?_0x4c1c6b[_0x20f5ce(0x19f)]:String(_0x4c1c6b)))),console[_0x20f5ce(0x1b7)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x1ae9b2(0x14a)]='profile:remove';['description']=a23_0x1ae9b2(0x168);['validate'](_0x337249){const _0x4fae73=a23_0x1ae9b2,{args:_0x531763}=_0x337249;if(_0x531763[_0x4fae73(0x16b)]===0x0)return _0x4fae73(0x1a1);return undefined;}async[a23_0x1ae9b2(0x190)](_0x320876){const _0x89a5f6=a23_0x1ae9b2,{args:_0x2bf664}=_0x320876,_0x226c1f=_0x2bf664[0x0];console[_0x89a5f6(0x187)](a23_0x55073e['bold'](_0x89a5f6(0x16c)));if(!profileExists(_0x226c1f)){console[_0x89a5f6(0x1b7)](a23_0x55073e[_0x89a5f6(0x199)](_0x89a5f6(0x19b)+_0x226c1f+_0x89a5f6(0x1b3))),console['log'](_0x89a5f6(0x197));const _0x41b5ae=listProfiles();if(_0x41b5ae[_0x89a5f6(0x16b)]===0x0)console[_0x89a5f6(0x187)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xf5e95f of _0x41b5ae){console[_0x89a5f6(0x187)](_0x89a5f6(0x18d)+_0xf5e95f[_0x89a5f6(0x14a)]);}return 0x1;}const _0x1c34cc=await a23_0x281952({'type':_0x89a5f6(0x15a),'name':'confirm','message':_0x89a5f6(0x14d)+_0x226c1f+'\x27?','initial':![]});if(!_0x1c34cc['confirm'])return console[_0x89a5f6(0x187)](_0x89a5f6(0x147)),0x0;try{removeProfileFromUserConfig(_0x226c1f),console['log'](a23_0x55073e[_0x89a5f6(0x166)]('✓')+_0x89a5f6(0x1a6)+_0x226c1f+_0x89a5f6(0x1a4));}catch(_0x2cd75b){return console[_0x89a5f6(0x1b7)](a23_0x55073e[_0x89a5f6(0x199)](_0x89a5f6(0x1a5)+(_0x2cd75b instanceof Error?_0x2cd75b[_0x89a5f6(0x19f)]:String(_0x2cd75b)))),0x1;}const _0xd81106=await isKeychainAvailable();if(_0xd81106){const _0x5207ea=await deleteKeychainAPIKey(_0x226c1f);_0x5207ea&&console['log'](a23_0x55073e[_0x89a5f6(0x166)]('✓')+_0x89a5f6(0x175));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x1ae9b2(0x14a)]='profile:set';[a23_0x1ae9b2(0x191)]=a23_0x1ae9b2(0x196);static [a23_0x1ae9b2(0x16d)]=[a23_0x1ae9b2(0x180),a23_0x1ae9b2(0x156),'parent_segment','llm_project',a23_0x1ae9b2(0x1ab),a23_0x1ae9b2(0x191)];[a23_0x1ae9b2(0x18e)](_0x19e02c){const _0x1008fb=a23_0x1ae9b2,{args:_0x319770,options:_0x29bbe8}=_0x19e02c,_0x41cea7=_0x29bbe8[_0x1008fb(0x164)]||getActiveProfile();if(!_0x41cea7)return'No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>';if(_0x319770[_0x1008fb(0x16b)]===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x1008fb(0x16d)]['join'](',\x20');const _0x19a03d=_0x319770[0x0];if(!_0x19a03d[_0x1008fb(0x176)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x1008fb(0x162)](',\x20');const [_0x5b981c]=_0x19a03d[_0x1008fb(0x18b)]('=',0x2);if(!ProfileSetCommand[_0x1008fb(0x16d)]['includes'](_0x5b981c))return'Unknown\x20key\x20\x27'+_0x5b981c+_0x1008fb(0x185)+ProfileSetCommand[_0x1008fb(0x16d)][_0x1008fb(0x162)](',\x20');return undefined;}async[a23_0x1ae9b2(0x190)](_0x3d0c4c){const _0xa10240=a23_0x1ae9b2,{args:_0x2588e1,options:_0x32cbe1}=_0x3d0c4c,_0xa2a08d=_0x32cbe1[_0xa10240(0x164)]||getActiveProfile(),[_0x11da57,..._0x203358]=_0x2588e1[0x0]['split']('='),_0x289aea=_0x203358[_0xa10240(0x162)]('=');console[_0xa10240(0x187)](a23_0x55073e[_0xa10240(0x1a9)](_0xa10240(0x192)));if(!profileExists(_0xa2a08d)){const _0x1bfffd=await a23_0x281952({'type':_0xa10240(0x15a),'name':'create','message':_0xa10240(0x19b)+_0xa2a08d+_0xa10240(0x17d),'initial':!![]});if(!_0x1bfffd[_0xa10240(0x14b)])return console[_0xa10240(0x187)](_0xa10240(0x1aa)),0x1;}const _0x525bf8=loadProfile(_0xa2a08d),_0x2231a2=_0x525bf8?.[_0xa10240(0x15b)]||{};if(_0x11da57===_0xa10240(0x180)){const _0x46a73c=resolveSite(_0x289aea);console[_0xa10240(0x187)](_0xa10240(0x1b1)+_0x46a73c+_0xa10240(0x16a)),console['log'](_0xa10240(0x152)),console[_0xa10240(0x187)]('\x20\x20'+getConsoleUrl(_0x46a73c,_0xa10240(0x18f)));const _0x14fb87=await a23_0x281952({'type':'password','name':'apiKey','message':_0xa10240(0x193),'validate':_0xf3173=>{const _0x145b50=_0xa10240;if(!_0xf3173||!_0xf3173[_0x145b50(0x1b0)]())return _0x145b50(0x169);return!![];}});if(!_0x14fb87['apiKey'])return console['log'](_0xa10240(0x172)),0x1;console[_0xa10240(0x187)](_0xa10240(0x1a3));try{const _0xa9354f=TDX['create']({'site':_0x46a73c,'apiKey':_0x14fb87['apiKey'][_0xa10240(0x1b0)](),'logLevel':_0x32cbe1[_0xa10240(0x174)]??LogLevel['ERROR']}),_0x3802f9=await _0xa9354f['jobs'][_0xa10240(0x1b4)]();console[_0xa10240(0x187)](a23_0x55073e[_0xa10240(0x166)]('✓')+_0xa10240(0x165)+_0x3802f9[_0xa10240(0x178)]+')');const _0x29835f=await isKeychainAvailable();_0x29835f?(await saveAPIKeyAsync(_0x14fb87[_0xa10240(0x14e)][_0xa10240(0x1b0)](),_0x46a73c,_0xa2a08d),console[_0xa10240(0x187)](a23_0x55073e['green']('✓')+_0xa10240(0x19d))):console[_0xa10240(0x149)](a23_0x55073e[_0xa10240(0x1af)](_0xa10240(0x16e))),_0x2231a2[_0xa10240(0x180)]=_0x46a73c;}catch(_0x336f45){if(_0x336f45 instanceof HTTPClientError&&_0x336f45[_0xa10240(0x158)]===0x191)return printAuthError(_0x336f45),0x1;return console[_0xa10240(0x1b7)](a23_0x55073e['red']('✗\x20Validation\x20failed:\x20'+(_0x336f45 instanceof Error?_0x336f45[_0xa10240(0x19f)]:String(_0x336f45)))),console[_0xa10240(0x1b7)](_0xa10240(0x177)),0x1;}}else _0x2231a2[_0x11da57]=_0x289aea||undefined;return saveProfileToUserConfig(_0xa2a08d,_0x2231a2),console[_0xa10240(0x187)](a23_0x55073e[_0xa10240(0x166)]('✓')+_0xa10240(0x1a6)+_0xa2a08d+_0xa10240(0x146)+_0x11da57+'='+(_0x289aea||_0xa10240(0x17c))),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x1ae9b2(0x155);[a23_0x1ae9b2(0x191)]='Set\x20session\x20profile';['validate'](_0x212489){const _0x429df5=a23_0x1ae9b2,{args:_0xd79c30}=_0x212489;if(_0xd79c30[_0x429df5(0x16b)]===0x0)return _0x429df5(0x153);return undefined;}async[a23_0x1ae9b2(0x190)](_0x4fee9a){const _0x1e7847=a23_0x1ae9b2,{args:_0x326e52,options:_0x4ea541}=_0x4fee9a,_0x22edfb=_0x326e52[0x0],_0x3a002c=_0x4ea541[_0x1e7847(0x15c)];cleanExpiredSessions();if(!profileExists(_0x22edfb)){console['error'](a23_0x55073e[_0x1e7847(0x199)](_0x1e7847(0x19b)+_0x22edfb+_0x1e7847(0x1b3))),console[_0x1e7847(0x187)](_0x1e7847(0x197));const _0xb51d3a=listProfiles();if(_0xb51d3a[_0x1e7847(0x16b)]===0x0)console[_0x1e7847(0x187)](_0x1e7847(0x1a2));else for(const _0x52e9f2 of _0xb51d3a){console[_0x1e7847(0x187)]('\x20\x20-\x20'+_0x52e9f2['name']);}return 0x1;}if(_0x3a002c){const _0x43d6e6=a23_0x429941['join'](getConfigDir(),_0x1e7847(0x160));return saveActiveProfileToUserConfig(_0x22edfb),console[_0x1e7847(0x187)](_0x1e7847(0x17f)+a23_0x55073e['green'](_0x22edfb)),console[_0x1e7847(0x187)](a23_0x55073e[_0x1e7847(0x19c)](_0x1e7847(0x159)+_0x43d6e6)),0x0;}const _0x48bd75=getSessionID(_0x4ea541[_0x1e7847(0x1a8)]);return saveSessionContext({'profile':_0x22edfb},_0x4ea541[_0x1e7847(0x1a8)]),console[_0x1e7847(0x187)]('Session\x20profile\x20set\x20to:\x20'+a23_0x55073e['green'](_0x22edfb)+'\x20'+a23_0x55073e['dim'](_0x1e7847(0x198)+_0x48bd75+')')),console[_0x1e7847(0x187)](a23_0x55073e[_0x1e7847(0x19c)](_0x1e7847(0x14c)+_0x22edfb+_0x1e7847(0x170))),0x0;}}
@@ -1 +1 @@
1
- const a24_0x22774e=a24_0x271d;function a24_0x4b85(){const _0x1905f2=['121112nqZADW','260OiLiAy','log','execute','11942270uvtspY','description','List\x20all\x20available\x20profiles','3mffKyy','scope','map','3318240dfLwhq','\x20\x20Global:\x20~/.config/tdx/tdx.json','config','message','779724aJKFwa','168PmVxlg','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','1643944WwoVEf','name','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','profiles','length','4898214WakzQL','142LkoGcI','error'];a24_0x4b85=function(){return _0x1905f2;};return a24_0x4b85();}function a24_0x271d(_0x5ee039,_0x432f13){_0x5ee039=_0x5ee039-0xec;const _0x4b85de=a24_0x4b85();let _0x271d3f=_0x4b85de[_0x5ee039];return _0x271d3f;}(function(_0x26e012,_0x5c4f61){const _0x30c917=a24_0x271d,_0x4bb2c5=_0x26e012();while(!![]){try{const _0x30f16e=parseInt(_0x30c917(0xed))/0x1*(-parseInt(_0x30c917(0x103))/0x2)+-parseInt(_0x30c917(0xf3))/0x3*(parseInt(_0x30c917(0xfd))/0x4)+-parseInt(_0x30c917(0xf6))/0x5+parseInt(_0x30c917(0xfa))/0x6+-parseInt(_0x30c917(0xfb))/0x7*(parseInt(_0x30c917(0xec))/0x8)+parseInt(_0x30c917(0x102))/0x9+parseInt(_0x30c917(0xf0))/0xa;if(_0x30f16e===_0x5c4f61)break;else _0x4bb2c5['push'](_0x4bb2c5['shift']());}catch(_0x29652d){_0x4bb2c5['push'](_0x4bb2c5['shift']());}}}(a24_0x4b85,0x6495d));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{[a24_0x22774e(0xfe)]=a24_0x22774e(0x100);[a24_0x22774e(0xf1)]=a24_0x22774e(0xf2);async[a24_0x22774e(0xef)](_0x5bc474){const _0x4dc7b9=a24_0x22774e,{options:_0x44a742}=_0x5bc474;try{const _0x4eda06=listProfiles(),_0x5c3aab=getActiveProfile();if(_0x4eda06[_0x4dc7b9(0x101)]===0x0)return console[_0x4dc7b9(0xee)](_0x4dc7b9(0xff)),console[_0x4dc7b9(0xee)](_0x4dc7b9(0xfc)),console[_0x4dc7b9(0xee)](_0x4dc7b9(0xf7)),0x0;const _0x337b93=_0x4eda06[_0x4dc7b9(0xf5)](_0xb091b5=>{const _0x4c87a7=_0x4dc7b9,_0x28455b=_0xb091b5[_0x4c87a7(0xfe)]===_0x5c3aab,_0x3cc3e6=getProfileParams(_0xb091b5[_0x4c87a7(0xf8)]);return{'name':_0xb091b5[_0x4c87a7(0xfe)],'active':_0x28455b,'scope':_0xb091b5[_0x4c87a7(0xf4)],'description':_0xb091b5['config'][_0x4c87a7(0xf1)]||'','params':_0x3cc3e6};});return await handleSDKOutput(_0x337b93,_0x44a742),0x0;}catch(_0x22c593){return _0x22c593 instanceof Error&&console[_0x4dc7b9(0x104)]('Error:\x20'+_0x22c593[_0x4dc7b9(0xf9)]),0x1;}}}
1
+ const a24_0x2948a1=a24_0x5213;function a24_0x5213(_0x2388a0,_0x423ec8){_0x2388a0=_0x2388a0-0xe9;const _0x110e77=a24_0x110e();let _0x521354=_0x110e77[_0x2388a0];return _0x521354;}(function(_0xc9dd57,_0x4d8994){const _0x4f124f=a24_0x5213,_0x2d426a=_0xc9dd57();while(!![]){try{const _0x4a4a63=parseInt(_0x4f124f(0xfa))/0x1*(parseInt(_0x4f124f(0xfe))/0x2)+-parseInt(_0x4f124f(0xf0))/0x3+-parseInt(_0x4f124f(0xf5))/0x4+parseInt(_0x4f124f(0xf7))/0x5*(-parseInt(_0x4f124f(0xfc))/0x6)+parseInt(_0x4f124f(0xed))/0x7+parseInt(_0x4f124f(0xef))/0x8*(-parseInt(_0x4f124f(0xee))/0x9)+parseInt(_0x4f124f(0xea))/0xa;if(_0x4a4a63===_0x4d8994)break;else _0x2d426a['push'](_0x2d426a['shift']());}catch(_0x3c4b5d){_0x2d426a['push'](_0x2d426a['shift']());}}}(a24_0x110e,0xcd04d));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a24_0x110e(){const _0x48b6cb=['127200iWAiDn','config','map','\x20\x20Global:\x20~/.config/tdx/tdx.json','Error:\x20','4042580xLcdrZ','description','80JbAich','List\x20all\x20available\x20profiles','length','131vFpnfE','execute','493182fIBxHJ','name','6952WTPfbC','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','36895470byzJeA','error','log','3468129BPxuVR','460413CEcYzn','224Eiexib'];a24_0x110e=function(){return _0x48b6cb;};return a24_0x110e();}export class ProfilesCommand extends BaseCommand{[a24_0x2948a1(0xfd)]='profiles';['description']=a24_0x2948a1(0xf8);async[a24_0x2948a1(0xfb)](_0x46c3d2){const _0x519b82=a24_0x2948a1,{options:_0x1c7127}=_0x46c3d2;try{const _0x5ecce7=listProfiles(),_0x25fdd6=getActiveProfile();if(_0x5ecce7[_0x519b82(0xf9)]===0x0)return console[_0x519b82(0xec)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x519b82(0xec)](_0x519b82(0xe9)),console[_0x519b82(0xec)](_0x519b82(0xf3)),0x0;const _0xcffe14=_0x5ecce7[_0x519b82(0xf2)](_0x4f6c9f=>{const _0x36b603=_0x519b82,_0x1c7e6b=_0x4f6c9f[_0x36b603(0xfd)]===_0x25fdd6,_0x4e880d=getProfileParams(_0x4f6c9f['config']);return{'name':_0x4f6c9f[_0x36b603(0xfd)],'active':_0x1c7e6b,'scope':_0x4f6c9f['scope'],'description':_0x4f6c9f[_0x36b603(0xf1)][_0x36b603(0xf6)]||'','params':_0x4e880d};});return await handleSDKOutput(_0xcffe14,_0x1c7127),0x0;}catch(_0x3e5ed4){return _0x3e5ed4 instanceof Error&&console[_0x519b82(0xeb)](_0x519b82(0xf4)+_0x3e5ed4['message']),0x1;}}}
@@ -1 +1 @@
1
- const a25_0x4be603=a25_0x40b7;(function(_0x59595f,_0x4e158b){const _0x2e98e8=a25_0x40b7,_0x178452=_0x59595f();while(!![]){try{const _0x433bef=-parseInt(_0x2e98e8(0x1d7))/0x1*(-parseInt(_0x2e98e8(0x1e0))/0x2)+parseInt(_0x2e98e8(0x1d9))/0x3+-parseInt(_0x2e98e8(0x1c6))/0x4*(parseInt(_0x2e98e8(0x1ce))/0x5)+-parseInt(_0x2e98e8(0x1c1))/0x6*(parseInt(_0x2e98e8(0x1d3))/0x7)+-parseInt(_0x2e98e8(0x1cd))/0x8+-parseInt(_0x2e98e8(0x1d8))/0x9+-parseInt(_0x2e98e8(0x1dc))/0xa*(-parseInt(_0x2e98e8(0x1e8))/0xb);if(_0x433bef===_0x4e158b)break;else _0x178452['push'](_0x178452['shift']());}catch(_0x3a47c2){_0x178452['push'](_0x178452['shift']());}}}(a25_0x403e,0x1b92b));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x403e(){const _0xa4bf22=['site','Catalog:\x20','information_schema','message','119092PHsrhw','originalMessage','Statement\x20','No\x20SQL\x20provided','validate','\x20rows\x20','file','846416uWJgYE','5VpGeVu','length','verbose','Error:\x20','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','343WVEdEa','totalSplits','options','state','2119WMmobl','1649610ljiUBq','400971uizPjh','Executing\x20query\x20[','processedRows','1846030kbIgrt','name','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','execute','206silWmj','data','error','query','stats','description','output','Site:\x20','11lbRqus','push','in\x20','\x0aAll\x20results\x20saved\x20to\x20','database','Executing\x20statement\x20','setPhase','setJobId','completedSplits','\x20-\x20','jobId','elapsedTimeMillis','join','catalog','setExtra','\x20splits','12822eMrpTN'];a25_0x403e=function(){return _0xa4bf22;};return a25_0x403e();}import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a25_0x40b7(_0x3ac9bd,_0x5226ca){_0x3ac9bd=_0x3ac9bd-0x1b2;const _0x403ed6=a25_0x403e();let _0x40b7d7=_0x403ed6[_0x3ac9bd];return _0x40b7d7;}export class QueryCommand extends BaseCommand{[a25_0x4be603(0x1dd)]=a25_0x4be603(0x1e3);[a25_0x4be603(0x1e5)]='Run\x20Trino\x20queries\x20(streaming)';async[a25_0x4be603(0x1df)](_0x3817c7){const _0x3d3875=a25_0x4be603,{options:_0x1c6507,args:_0x45f8f6,tdx:_0xd68fbd}=_0x3817c7,_0x2ec9d9=_0x45f8f6[0x0],_0x4c8f01=_0x1c6507[_0x3d3875(0x1cc)];let _0x1828d5;try{if(_0x4c8f01)_0x1828d5=readSqlStatementsFromFile(_0x4c8f01);else{if(_0x2ec9d9==='-')_0x1828d5=await readSqlStatementsFromStdin();else{if(_0x2ec9d9&&isSqlFilePath(_0x2ec9d9))_0x1828d5=readSqlStatementsFromFile(_0x2ec9d9);else{if(_0x2ec9d9)_0x1828d5=splitSqlStatements(_0x2ec9d9);else throw new Error(_0x3d3875(0x1c9));}}}}catch(_0x2cb0df){return console[_0x3d3875(0x1e2)](_0x3d3875(0x1d1)+_0x2cb0df[_0x3d3875(0x1c5)]),0x1;}const _0x115dfe=_0x1c6507[_0x3d3875(0x1b5)]||_0x3d3875(0x1c4),_0x5355da=_0x1c6507[_0x3d3875(0x1be)];try{const _0x1119f4=[],_0x202801=!!_0x1c6507['output'];for(let _0x363bd8=0x0;_0x363bd8<_0x1828d5[_0x3d3875(0x1cf)];_0x363bd8++){const _0x4a10ad=_0x1828d5[_0x363bd8],_0x3418cf=_0x363bd8+0x1,_0x509782=_0x1828d5[_0x3d3875(0x1cf)],_0x52afba=_0x509782>0x1;_0x1c6507[_0x3d3875(0x1d0)]&&(console['error']('\x0a'+(_0x52afba?_0x3d3875(0x1c8)+_0x3418cf+'/'+_0x509782+':':'')),console['error'](_0x3d3875(0x1e7)+_0x1c6507[_0x3d3875(0x1c2)]),console[_0x3d3875(0x1e2)](_0x3d3875(0x1c3)+(_0x5355da||'td')),console[_0x3d3875(0x1e2)]('Schema:\x20'+_0x115dfe),console[_0x3d3875(0x1e2)]('SQL:\x20'+_0x4a10ad));const _0x23c9f2=_0x52afba?_0x3d3875(0x1b6)+_0x3418cf+'/'+_0x509782+'...':'Executing\x20query...';try{const _0x9ebbb4=await withProgressSpinner(_0x23c9f2,async _0x53ab80=>{const _0x42a045=_0x3d3875,_0x11d4bc=await _0xd68fbd[_0x42a045(0x1e3)][_0x42a045(0x1df)](_0x4a10ad,{'catalog':_0x5355da,'schema':_0x115dfe,'onJobId':_0xad1888=>{const _0x1fdffe=_0x42a045;_0x53ab80[_0x1fdffe(0x1b8)](_0xad1888);},'onProgress':_0x1791bb=>{const _0x59450b=_0x42a045;_0x53ab80[_0x59450b(0x1b7)](_0x59450b(0x1da)+_0x1791bb[_0x59450b(0x1d6)]+']'),_0x53ab80[_0x59450b(0x1bf)](formatRows(_0x1791bb[_0x59450b(0x1db)])+'\x20rows\x20'+_0x1791bb[_0x59450b(0x1b9)]+'/'+_0x1791bb[_0x59450b(0x1d4)]+_0x59450b(0x1c0));}});return _0x11d4bc;},{'verbose':_0x1c6507[_0x3d3875(0x1d0)]}),_0x2ae358=_0x9ebbb4[_0x3d3875(0x1e1)],_0x99b002=_0x2ae358[_0x3d3875(0x1bb)]?'\x20[Job\x20ID:\x20'+_0x2ae358[_0x3d3875(0x1bb)]+']':'',_0x5dc3fb=_0x52afba?'Statement\x20'+_0x3418cf+'/'+_0x509782+_0x3d3875(0x1ba):'';console['error']('✔\x20'+_0x5dc3fb+'Query\x20completed:\x20Processed\x20'+formatRows(_0x2ae358['stats'][_0x3d3875(0x1db)])+_0x3d3875(0x1cb)+(_0x3d3875(0x1b3)+formatElapsed(_0x2ae358[_0x3d3875(0x1e4)][_0x3d3875(0x1bc)])+_0x99b002));if(_0x52afba&&_0x202801){const _0x842581=resolveOutputOptions(_0x1c6507),_0x33f96e=await formatQueryOutput(_0x2ae358,_0x842581);_0x1119f4[_0x3d3875(0x1b2)](_0x33f96e);}else await handleQueryOutput(_0x2ae358,_0x1c6507);}catch(_0x9210eb){const _0x1e6d7d=_0x52afba?_0x3d3875(0x1c8)+_0x3418cf+'/'+_0x509782+':\x0a':'',_0x508b7a=_0x9210eb instanceof SDKError?_0x9210eb[_0x3d3875(0x1c7)]:_0x9210eb[_0x3d3875(0x1c5)];return console[_0x3d3875(0x1e2)](''+_0x1e6d7d+_0x508b7a),0x1;}}if(_0x1828d5[_0x3d3875(0x1cf)]>0x1&&_0x202801&&_0x1119f4[_0x3d3875(0x1cf)]>0x0){const _0x184b48=_0x1119f4[_0x3d3875(0x1bd)]('\x0a');writeFileSync(_0x1c6507[_0x3d3875(0x1e6)],_0x184b48),console[_0x3d3875(0x1e2)](_0x3d3875(0x1b4)+_0x1c6507[_0x3d3875(0x1e6)]);}return 0x0;}catch(_0x59e8e2){throw _0x59e8e2;}}[a25_0x4be603(0x1ca)](_0x9e239f){const _0x1795a9=a25_0x4be603,_0x256b1a=_0x9e239f['args'][0x0],_0x4b5ff1=_0x9e239f[_0x1795a9(0x1d5)][_0x1795a9(0x1cc)];if(!_0x256b1a&&!_0x4b5ff1)return _0x1795a9(0x1d2);if(_0x256b1a&&_0x4b5ff1)return _0x1795a9(0x1de);return undefined;}}
1
+ const a25_0x5edaac=a25_0x1f61;(function(_0x245008,_0x510b8f){const _0x3e6bd1=a25_0x1f61,_0x283485=_0x245008();while(!![]){try{const _0x1a3c08=-parseInt(_0x3e6bd1(0x1fe))/0x1+parseInt(_0x3e6bd1(0x1e3))/0x2+parseInt(_0x3e6bd1(0x1de))/0x3*(parseInt(_0x3e6bd1(0x1e8))/0x4)+-parseInt(_0x3e6bd1(0x1d9))/0x5+-parseInt(_0x3e6bd1(0x1e9))/0x6+parseInt(_0x3e6bd1(0x1f7))/0x7*(parseInt(_0x3e6bd1(0x1fc))/0x8)+parseInt(_0x3e6bd1(0x1f9))/0x9*(parseInt(_0x3e6bd1(0x1d6))/0xa);if(_0x1a3c08===_0x510b8f)break;else _0x283485['push'](_0x283485['shift']());}catch(_0x155c0c){_0x283485['push'](_0x283485['shift']());}}}(a25_0x5594,0xa79f9));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x5594(){const _0x2a3e1c=['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','4227350XzeoGu','processedRows','file','1394020FFrFbo','Executing\x20query...','SQL:\x20','execute','error','814659nIurCg','length','totalSplits','Statement\x20','verbose','1665130gpzhJt','join','query','\x20rows\x20','\x20-\x20','20aiIyya','7365504mWPiGa','information_schema','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Run\x20Trino\x20queries\x20(streaming)','No\x20SQL\x20provided','\x20splits','name','site','data','state','message','Site:\x20','push','...','14WOFwNf','jobId','9PVXtuk','completedSplits','catalog','2393824OqOdJm','output','1018548tIVnCJ','Query\x20completed:\x20Processed\x20','Schema:\x20','elapsedTimeMillis','Executing\x20query\x20['];a25_0x5594=function(){return _0x2a3e1c;};return a25_0x5594();}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 a25_0x1f61(_0x1ad920,_0x3232d7){_0x1ad920=_0x1ad920-0x1d0;const _0x5594d4=a25_0x5594();let _0x1f616a=_0x5594d4[_0x1ad920];return _0x1f616a;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a25_0x5edaac(0x1ef)]=a25_0x5edaac(0x1e5);[a25_0x5edaac(0x1d4)]=a25_0x5edaac(0x1ec);async[a25_0x5edaac(0x1dc)](_0x20f06d){const _0x1a2f21=a25_0x5edaac,{options:_0x217a5f,args:_0x326043,tdx:_0x52b770}=_0x20f06d,_0x4882db=_0x326043[0x0],_0x3d0845=_0x217a5f[_0x1a2f21(0x1d8)];let _0x33d8bd;try{if(_0x3d0845)_0x33d8bd=readSqlStatementsFromFile(_0x3d0845);else{if(_0x4882db==='-')_0x33d8bd=await readSqlStatementsFromStdin();else{if(_0x4882db&&isSqlFilePath(_0x4882db))_0x33d8bd=readSqlStatementsFromFile(_0x4882db);else{if(_0x4882db)_0x33d8bd=splitSqlStatements(_0x4882db);else throw new Error(_0x1a2f21(0x1ed));}}}}catch(_0x5a8e53){return console[_0x1a2f21(0x1dd)]('Error:\x20'+_0x5a8e53[_0x1a2f21(0x1f3)]),0x1;}const _0x35c405=_0x217a5f['database']||_0x1a2f21(0x1ea),_0x20a8c0=_0x217a5f[_0x1a2f21(0x1fb)];try{const _0x983bc4=[],_0x528a61=!!_0x217a5f[_0x1a2f21(0x1fd)];for(let _0x5ba02e=0x0;_0x5ba02e<_0x33d8bd[_0x1a2f21(0x1df)];_0x5ba02e++){const _0x38ed5c=_0x33d8bd[_0x5ba02e],_0x53a37e=_0x5ba02e+0x1,_0xb407e3=_0x33d8bd[_0x1a2f21(0x1df)],_0x29c3a5=_0xb407e3>0x1;_0x217a5f[_0x1a2f21(0x1e2)]&&(console[_0x1a2f21(0x1dd)]('\x0a'+(_0x29c3a5?_0x1a2f21(0x1e1)+_0x53a37e+'/'+_0xb407e3+':':'')),console[_0x1a2f21(0x1dd)](_0x1a2f21(0x1f4)+_0x217a5f[_0x1a2f21(0x1f0)]),console['error']('Catalog:\x20'+(_0x20a8c0||'td')),console[_0x1a2f21(0x1dd)](_0x1a2f21(0x1d1)+_0x35c405),console[_0x1a2f21(0x1dd)](_0x1a2f21(0x1db)+_0x38ed5c));const _0x459503=_0x29c3a5?'Executing\x20statement\x20'+_0x53a37e+'/'+_0xb407e3+_0x1a2f21(0x1f6):_0x1a2f21(0x1da);try{const _0x16b88e=await withProgressSpinner(_0x459503,async _0x133057=>{const _0x44fb8a=_0x1a2f21,_0x33a45b=await _0x52b770[_0x44fb8a(0x1e5)][_0x44fb8a(0x1dc)](_0x38ed5c,{'catalog':_0x20a8c0,'schema':_0x35c405,'onJobId':_0x17fbe0=>{_0x133057['setJobId'](_0x17fbe0);},'onProgress':_0x6aab54=>{const _0x29d8c8=_0x44fb8a;_0x133057['setPhase'](_0x29d8c8(0x1d3)+_0x6aab54[_0x29d8c8(0x1f2)]+']'),_0x133057['setExtra'](formatRows(_0x6aab54[_0x29d8c8(0x1d7)])+_0x29d8c8(0x1e6)+_0x6aab54[_0x29d8c8(0x1fa)]+'/'+_0x6aab54[_0x29d8c8(0x1e0)]+_0x29d8c8(0x1ee));}});return _0x33a45b;},{'verbose':_0x217a5f[_0x1a2f21(0x1e2)]}),_0x996d5=_0x16b88e[_0x1a2f21(0x1f1)],_0x39b165=_0x996d5[_0x1a2f21(0x1f8)]?'\x20[Job\x20ID:\x20'+_0x996d5['jobId']+']':'',_0x17ad64=_0x29c3a5?_0x1a2f21(0x1e1)+_0x53a37e+'/'+_0xb407e3+_0x1a2f21(0x1e7):'';console[_0x1a2f21(0x1dd)]('✔\x20'+_0x17ad64+_0x1a2f21(0x1d0)+formatRows(_0x996d5['stats'][_0x1a2f21(0x1d7)])+_0x1a2f21(0x1e6)+('in\x20'+formatElapsed(_0x996d5['stats'][_0x1a2f21(0x1d2)])+_0x39b165));if(_0x29c3a5&&_0x528a61){const _0x4c677f=resolveOutputOptions(_0x217a5f),_0x56e05c=await formatQueryOutput(_0x996d5,_0x4c677f);_0x983bc4[_0x1a2f21(0x1f5)](_0x56e05c);}else await handleQueryOutput(_0x996d5,_0x217a5f);}catch(_0x48696e){const _0x28c251=_0x29c3a5?_0x1a2f21(0x1e1)+_0x53a37e+'/'+_0xb407e3+':\x0a':'',_0x107e67=_0x48696e instanceof SDKError?_0x48696e['originalMessage']:_0x48696e[_0x1a2f21(0x1f3)];return console[_0x1a2f21(0x1dd)](''+_0x28c251+_0x107e67),0x1;}}if(_0x33d8bd['length']>0x1&&_0x528a61&&_0x983bc4[_0x1a2f21(0x1df)]>0x0){const _0x22d9e7=_0x983bc4[_0x1a2f21(0x1e4)]('\x0a');writeFileSync(_0x217a5f[_0x1a2f21(0x1fd)],_0x22d9e7),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x217a5f['output']);}return 0x0;}catch(_0x5c4428){throw _0x5c4428;}}['validate'](_0x3405a3){const _0x375ec0=a25_0x5edaac,_0x3f167c=_0x3405a3['args'][0x0],_0x38bd72=_0x3405a3['options'][_0x375ec0(0x1d8)];if(!_0x3f167c&&!_0x38bd72)return _0x375ec0(0x1d5);if(_0x3f167c&&_0x38bd72)return _0x375ec0(0x1eb);return undefined;}}