@treasuredata/tdx 2026.3.14 → 2026.3.16

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 (202) hide show
  1. package/README.md +9 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/agent-test-command.js +1 -1
  9. package/dist/commands/api-command.js +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/auth-login-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/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/query/index.js +1 -1
  127. package/dist/sdk/query/sql-parser.js +1 -1
  128. package/dist/sdk/realtime.js +1 -1
  129. package/dist/sdk/schedule.js +1 -1
  130. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  131. package/dist/sdk/segment/fields-display.js +1 -1
  132. package/dist/sdk/segment/file-discovery.js +1 -1
  133. package/dist/sdk/segment/journey-utils.js +1 -1
  134. package/dist/sdk/segment/journey-validator.js +1 -1
  135. package/dist/sdk/segment/journey-yaml.js +1 -1
  136. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  137. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  138. package/dist/sdk/segment/pull-workflow.js +1 -1
  139. package/dist/sdk/segment/push-recovery.js +1 -1
  140. package/dist/sdk/segment/push-workflow.js +1 -1
  141. package/dist/sdk/segment/resolution-context.js +1 -1
  142. package/dist/sdk/segment/segment-path-parser.js +1 -1
  143. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  144. package/dist/sdk/segment/segment-validator.js +1 -1
  145. package/dist/sdk/segment/target-resolution.js +1 -1
  146. package/dist/sdk/segment/tdx-config.js +1 -1
  147. package/dist/sdk/segment/types/activation-schema.js +1 -1
  148. package/dist/sdk/segment/types/journey-def.js +1 -1
  149. package/dist/sdk/segment/types/journey-schema.js +1 -1
  150. package/dist/sdk/segment/types/segment-def.js +1 -1
  151. package/dist/sdk/segment/types/segment-schema.js +1 -1
  152. package/dist/sdk/segment/validate-files.js +1 -1
  153. package/dist/sdk/segment/yaml-validator.js +1 -1
  154. package/dist/sdk/segment.js +1 -1
  155. package/dist/sdk/types/index.js +1 -1
  156. package/dist/sdk/types/progress.js +1 -1
  157. package/dist/sdk/user.js +1 -1
  158. package/dist/sdk/util/format-detector.js +1 -1
  159. package/dist/sdk/util/formatters.js +1 -1
  160. package/dist/sdk/util/index.js +1 -1
  161. package/dist/sdk/util/paginate.js +1 -1
  162. package/dist/sdk/util/tree-formatter.js +1 -1
  163. package/dist/sdk/workflow/archive-validation.js +1 -1
  164. package/dist/sdk/workflow/clone-workflow.js +1 -1
  165. package/dist/sdk/workflow/index.js +1 -1
  166. package/dist/sdk/workflow/pull-workflow.js +1 -1
  167. package/dist/sdk/workflow/push-workflow.js +1 -1
  168. package/dist/sdk/workflow/tdx-config.js +1 -1
  169. package/dist/sdk/workflow/workflow-utils.js +1 -1
  170. package/dist/test-utils/command-runner.js +1 -1
  171. package/dist/test-utils/factories.js +1 -1
  172. package/dist/test-utils/fixtures.js +1 -1
  173. package/dist/test-utils/http-mock.js +1 -1
  174. package/dist/test-utils/index.js +1 -1
  175. package/dist/utils/async.js +1 -1
  176. package/dist/utils/colors.js +1 -1
  177. package/dist/utils/diff.js +1 -1
  178. package/dist/utils/file-permissions.js +1 -1
  179. package/dist/utils/file-reader.js +1 -1
  180. package/dist/utils/github-releases.js +1 -1
  181. package/dist/utils/global-cache.js +1 -1
  182. package/dist/utils/json-loader.js +1 -1
  183. package/dist/utils/local-cache.js +1 -1
  184. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  185. package/dist/utils/logger/formatters/index.js +1 -1
  186. package/dist/utils/logger/handlers/console-handler.js +1 -1
  187. package/dist/utils/logger/handlers/file-handler.js +1 -1
  188. package/dist/utils/logger/handlers/index.js +1 -1
  189. package/dist/utils/logger/handlers/null-handler.js +1 -1
  190. package/dist/utils/logger/index.js +1 -1
  191. package/dist/utils/logger/logger.js +1 -1
  192. package/dist/utils/logger/types.js +1 -1
  193. package/dist/utils/option-validation.js +1 -1
  194. package/dist/utils/process.js +1 -1
  195. package/dist/utils/prompt.js +1 -1
  196. package/dist/utils/spinner.js +1 -1
  197. package/dist/utils/sse-parser.js +1 -1
  198. package/dist/utils/string-utils.js +1 -1
  199. package/dist/utils/table-ref-parser.js +1 -1
  200. package/dist/utils/tdx-logger.js +1 -1
  201. package/dist/utils/version-check.js +1 -1
  202. package/package.json +2 -2
@@ -1 +1 @@
1
- const a30_0x388647=a30_0x4611;function a30_0x4611(_0x4a425f,_0x15d02a){_0x4a425f=_0x4a425f-0x6a;const _0x2f4d3b=a30_0x2f4d();let _0x4611c8=_0x2f4d3b[_0x4a425f];return _0x4611c8;}(function(_0x35e9cc,_0xd24413){const _0x5ed3e0=a30_0x4611,_0x504fca=_0x35e9cc();while(!![]){try{const _0x22a969=parseInt(_0x5ed3e0(0x155))/0x1*(parseInt(_0x5ed3e0(0xc0))/0x2)+-parseInt(_0x5ed3e0(0x1f6))/0x3+-parseInt(_0x5ed3e0(0xf2))/0x4+parseInt(_0x5ed3e0(0x177))/0x5*(parseInt(_0x5ed3e0(0x1cb))/0x6)+-parseInt(_0x5ed3e0(0x10a))/0x7+-parseInt(_0x5ed3e0(0x125))/0x8+-parseInt(_0x5ed3e0(0xa7))/0x9*(-parseInt(_0x5ed3e0(0x17d))/0xa);if(_0x22a969===_0xd24413)break;else _0x504fca['push'](_0x504fca['shift']());}catch(_0x303565){_0x504fca['push'](_0x504fca['shift']());}}}(a30_0x2f4d,0x58499));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x2158a2 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,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x530600 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=a30_0x388647(0x1d9),LEGACY_PARENT_SEGMENT_DIR=a30_0x388647(0x174);function openBrowser(_0x1f8c14){const _0x4d35ed=a30_0x388647,_0x58e0f2=process[_0x4d35ed(0xa9)],_0x435cf3=_0x58e0f2===_0x4d35ed(0xbc)?_0x4d35ed(0x1ab):_0x58e0f2===_0x4d35ed(0x1e1)?_0x4d35ed(0xa2):_0x4d35ed(0x11a);spawn(_0x435cf3,[_0x1f8c14],{'detached':!![],'stdio':_0x4d35ed(0xfc)})['unref']();}function migrateLegacyDirectory(){const _0x45a77b=a30_0x388647;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x7aaf7=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x7aaf7['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x45a77b(0x1a3)](a30_0x530600[_0x45a77b(0xeb)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x45a77b(0x1ba)+PARENT_SEGMENT_DIR+_0x45a77b(0x88))),console['error'](a30_0x530600['dim'](_0x45a77b(0x1f7)+LEGACY_PARENT_SEGMENT_DIR+_0x45a77b(0xff))),![];console['error'](a30_0x530600['yellow'](_0x45a77b(0x14f)+LEGACY_PARENT_SEGMENT_DIR+_0x45a77b(0x8b)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a30_0x530600[_0x45a77b(0x1f1)](_0x45a77b(0x171)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x592473){const _0x5adf5a=_0x592473 instanceof Error?_0x592473[_0x45a77b(0x1c9)]:String(_0x592473);return console['error'](a30_0x530600[_0x45a77b(0xd1)](_0x45a77b(0x163)+_0x5adf5a+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a30_0x388647(0x159)](_0x53bf80){return migrateLegacyDirectory(),super['run'](_0x53bf80);}}function resolveYamlFile(_0x1706c0){const _0x4a2fc1=a30_0x388647;if(_0x1706c0[_0x4a2fc1(0x195)]('.yml')||_0x1706c0['endsWith'](_0x4a2fc1(0xc2)))return _0x1706c0;return a30_0x2158a2[_0x4a2fc1(0x8e)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1706c0)+_0x4a2fc1(0x1a7));}function formatProgressMessage(_0x28dc5b){const _0x24c6a0=a30_0x388647,_0x2e771d=_0x28dc5b[_0x24c6a0(0x179)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2e771d){const [,_0x335f64,_0x16cc06,_0x13cfa6='']=_0x2e771d;return a30_0x530600[_0x24c6a0(0xb2)](_0x335f64+':')+'\x20'+_0x16cc06+a30_0x530600['dim'](_0x13cfa6);}return a30_0x530600['dim'](_0x28dc5b);}function showFileNotFoundError(_0x195fd0,_0x345dc2){const _0x354b6d=a30_0x388647;console[_0x354b6d(0x1a3)](a30_0x530600[_0x354b6d(0xd1)](_0x354b6d(0x80)+_0x195fd0+'\x0a')),console['error'](a30_0x530600['cyan']('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x345dc2+_0x354b6d(0x1da)));}function displayRealtimeValidation(_0x569f54){const _0x4306ed=a30_0x388647;if(!_0x569f54[_0x4306ed(0x6e)])return;const _0x3e8619=_0x569f54[_0x4306ed(0x6e)],_0x5a3e05=_0x3e8619[_0x4306ed(0xbf)]?a30_0x530600[_0x4306ed(0x1f1)](_0x4306ed(0xcc)):a30_0x530600[_0x4306ed(0xeb)](_0x4306ed(0x18d));console[_0x4306ed(0x1a3)]('\x0a'+a30_0x530600[_0x4306ed(0xb2)](_0x4306ed(0xed))+'\x20'+_0x5a3e05);if(_0x3e8619['events']&&_0x3e8619[_0x4306ed(0x1fe)][_0x4306ed(0x10c)]>0x0){console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)](_0x4306ed(0xe6))+'\x20'+_0x3e8619['events'][_0x4306ed(0x10c)]+_0x4306ed(0xd8));for(const _0x1b44e2 of _0x3e8619[_0x4306ed(0x1fe)]){const _0x1dc35d=_0x1b44e2[_0x4306ed(0x105)]===![]?a30_0x530600['red']('✘'):a30_0x530600[_0x4306ed(0x1f1)]('✔');console[_0x4306ed(0x1a3)]('\x20\x20\x20\x20'+_0x1dc35d+'\x20'+_0x1b44e2['name']),_0x1b44e2[_0x4306ed(0x13b)]&&console[_0x4306ed(0x1a3)](_0x4306ed(0xd6)+a30_0x530600[_0x4306ed(0xd1)](_0x1b44e2[_0x4306ed(0x13b)]));}}if(_0x3e8619[_0x4306ed(0x15c)]&&_0x3e8619[_0x4306ed(0x15c)][_0x4306ed(0x10c)]>0x0){console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)]('Attributes:')+'\x20'+_0x3e8619['attributes']['length']+_0x4306ed(0xd8));for(const _0x33ffbe of _0x3e8619['attributes']){const _0x1c068b=_0x33ffbe[_0x4306ed(0x1aa)]?a30_0x530600[_0x4306ed(0x1f1)]('✔'):a30_0x530600[_0x4306ed(0xd1)]('✘');console[_0x4306ed(0x1a3)]('\x20\x20\x20\x20'+_0x1c068b+'\x20'+_0x33ffbe[_0x4306ed(0x154)]+'\x20'+a30_0x530600[_0x4306ed(0xb2)]('('+_0x33ffbe[_0x4306ed(0x182)]+')'));}}if(_0x3e8619[_0x4306ed(0x199)]){const _0xb53ab3=_0x3e8619[_0x4306ed(0x199)][_0x4306ed(0x1ee)]?.[_0x4306ed(0x10c)]?'\x20+\x20['+_0x3e8619[_0x4306ed(0x199)][_0x4306ed(0x1ee)][_0x4306ed(0x8e)](',\x20')+']':'';console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)](_0x4306ed(0x129))+'\x20'+_0x3e8619['idStitching'][_0x4306ed(0xd2)]+_0xb53ab3);}if(_0x3e8619[_0x4306ed(0x1b6)]&&_0x3e8619[_0x4306ed(0x1b6)][_0x4306ed(0x10c)]>0x0){console[_0x4306ed(0x1a3)]('\x20\x20'+a30_0x530600[_0x4306ed(0xb2)]('Personalization:')+'\x20'+_0x3e8619['personalizationServices'][_0x4306ed(0x10c)]+_0x4306ed(0xa1)+(_0x3e8619[_0x4306ed(0x1b6)]['length']!==0x1?'s':''));for(const _0x25ecf0 of _0x3e8619[_0x4306ed(0x1b6)]){console[_0x4306ed(0x1a3)](_0x4306ed(0x7c)+_0x25ecf0['name']);}}}function showParentSegmentNotSetError(_0x1624be){const _0x3444b7=a30_0x388647;console[_0x3444b7(0x1a3)](a30_0x530600['yellow'](_0x3444b7(0x1ae))),console[_0x3444b7(0x1a3)](_0x1624be);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x388647(0x154)]='segment:parent:list';[a30_0x388647(0xec)]='List\x20parent\x20segments';async[a30_0x388647(0x77)](_0x56469c){const _0x1c01a0=a30_0x388647,{options:_0x39fc96,args:_0xa47434,tdx:_0x181cfe}=_0x56469c,_0x40dc1e=_0xa47434[0x0];_0x39fc96[_0x1c01a0(0x1cf)]&&(console[_0x1c01a0(0x1a3)](_0x1c01a0(0xcf)+_0x39fc96[_0x1c01a0(0x18f)]),_0x40dc1e&&console[_0x1c01a0(0x1a3)](_0x1c01a0(0x152)+_0x40dc1e));const _0x31a1af=await withSpinner(_0x40dc1e?_0x1c01a0(0x158)+_0x40dc1e+_0x1c01a0(0x120):_0x1c01a0(0xa4),()=>_0x181cfe[_0x1c01a0(0x176)][_0x1c01a0(0x1e2)](),{'verbose':_0x39fc96['verbose']});let _0x3d293b=_0x31a1af['data'];if(_0x40dc1e){const _0x5eb9fd=_0x40dc1e['replace'](/[.+^${}()|[\]\\]/g,_0x1c01a0(0x102))[_0x1c01a0(0x173)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x677c8a=new RegExp('^'+_0x5eb9fd+'$','i');_0x3d293b=_0x3d293b[_0x1c01a0(0x1d2)](_0x197d96=>_0x677c8a['test'](_0x197d96[_0x1c01a0(0x15c)][_0x1c01a0(0x154)]));}_0x3d293b['sort']((_0x2b58ff,_0x1bded4)=>_0x2b58ff[_0x1c01a0(0x15c)]['name'][_0x1c01a0(0x71)](_0x1bded4[_0x1c01a0(0x15c)][_0x1c01a0(0x154)])),console['error'](_0x1c01a0(0x167)+_0x3d293b[_0x1c01a0(0x10c)]+_0x1c01a0(0x113)+(_0x3d293b['length']!==0x1?'s':''));const _0x2dd26a=_0x26cf93=>{return getConsoleNextUrl(_0x39fc96['site'],'/app/dw/parentSegments/'+_0x26cf93);};if(_0x39fc96['format']===_0x1c01a0(0xf9)||_0x39fc96[_0x1c01a0(0x1e3)]==='jsonl'){const _0x186a02=_0x3d293b[_0x1c01a0(0x16d)](_0x4ea0b5=>({..._0x4ea0b5,'url':_0x2dd26a(_0x4ea0b5['id'])}));await handleSDKOutput(_0x186a02,_0x39fc96);}else{if(_0x3d293b[_0x1c01a0(0x10c)]===0x0)_0x40dc1e?console['log'](_0x1c01a0(0x1d7)+_0x40dc1e):console[_0x1c01a0(0x93)](_0x1c01a0(0x1ff));else for(const _0x15a381 of _0x3d293b){const _0x1cc4f3=_0x15a381[_0x1c01a0(0x15c)]['population']?a30_0x530600[_0x1c01a0(0xb2)]('\x20('+formatRows(_0x15a381[_0x1c01a0(0x15c)]['population'])+')'):'',_0x267225=hyperlink(_0x15a381['attributes']['name'],_0x2dd26a(_0x15a381['id']));console[_0x1c01a0(0x93)](_0x1c01a0(0x9b)+_0x267225+_0x1cc4f3);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x388647(0x154)]='segment:parent:create';[a30_0x388647(0xec)]=a30_0x388647(0x1d6);async[a30_0x388647(0x77)](_0x3ac399){const _0x34216f=a30_0x388647,{options:_0x29ede6,args:_0x20cc61,tdx:_0x2f89fc}=_0x3ac399;console[_0x34216f(0x1a3)](_0x34216f(0x1f3)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x34216f(0xca));const _0x172e2a=_0x29ede6;if(_0x20cc61['length']===0x0)return console[_0x34216f(0x1a3)](a30_0x530600['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x34216f(0x78)),0x1;const _0x116095=_0x20cc61[0x0];if(!_0x172e2a[_0x34216f(0x110)]||!_0x172e2a[_0x34216f(0x1fd)])return console[_0x34216f(0x1a3)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x34216f(0x1a3)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x172e2a[_0x34216f(0x1cf)]&&(console['error'](_0x34216f(0xcf)+_0x172e2a[_0x34216f(0x18f)]),console[_0x34216f(0x1a3)]('Name:\x20'+_0x116095),console[_0x34216f(0x1a3)]('Database:\x20'+_0x172e2a[_0x34216f(0x110)]),console[_0x34216f(0x1a3)]('Table:\x20'+_0x172e2a['table']));const _0x1b869f=await loadJSONFromOptions(_0x172e2a[_0x34216f(0x15c)],_0x172e2a[_0x34216f(0x183)]),_0x52ad05=await loadJSONFromOptions(_0x172e2a[_0x34216f(0x1b3)],_0x172e2a[_0x34216f(0x1d1)]),_0x4d272c=await loadJSONFromOptions(_0x172e2a[_0x34216f(0x112)],_0x172e2a[_0x34216f(0x1c5)]),_0x1ea0c6={'name':_0x116095,'description':_0x172e2a[_0x34216f(0xec)],'scheduleType':_0x172e2a['scheduleType'],'scheduleOption':_0x172e2a[_0x34216f(0x124)],'timezone':_0x172e2a[_0x34216f(0x9a)],'master':{'parentDatabaseName':_0x172e2a['database'],'parentTableName':_0x172e2a[_0x34216f(0x1fd)]},'attributes':_0x1b869f,'behaviors':_0x52ad05,'customerGroup':_0x4d272c},_0x2b232c=await withSpinner(_0x34216f(0x142)+_0x116095+_0x34216f(0x120),()=>_0x2f89fc['segment'][_0x34216f(0x1a8)](_0x1ea0c6),{'verbose':_0x29ede6[_0x34216f(0x1cf)]}),_0x5cb36d=_0x2b232c[_0x34216f(0x7b)];return console[_0x34216f(0x1a3)](_0x34216f(0xf0)+_0x5cb36d[_0x34216f(0x154)]+_0x34216f(0x160)+_0x5cb36d['id']),await handleSDKOutput([_0x5cb36d],_0x29ede6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a30_0x388647(0x1e4);['description']=a30_0x388647(0x11c);async[a30_0x388647(0x77)](_0xcf1142){const _0x14fbff=a30_0x388647,{options:_0x4a5297,args:_0x1b64e5,tdx:_0xfb3eb5}=_0xcf1142;console[_0x14fbff(0x1a3)](_0x14fbff(0x19b)+_0x14fbff(0x1ea)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x464eed=_0x4a5297;if(_0x1b64e5[_0x14fbff(0x10c)]===0x0)return console[_0x14fbff(0x1a3)](a30_0x530600[_0x14fbff(0xd1)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x14fbff(0x1a3)](_0x14fbff(0x11e)),0x1;const _0x1173bd=_0x1b64e5[0x0];_0x464eed[_0x14fbff(0x1cf)]&&(console['error']('Site:\x20'+_0x464eed['site']),console[_0x14fbff(0x1a3)](_0x14fbff(0x7e)+_0x1173bd));const _0x599c34=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x1173bd+_0x14fbff(0x120),()=>_0xfb3eb5[_0x14fbff(0x176)][_0x14fbff(0x82)](_0x1173bd),{'verbose':_0x464eed['verbose']}),_0x5037f5=_0x599c34[_0x14fbff(0x7b)],_0x4e105a=await loadJSONFromOptions(_0x464eed[_0x14fbff(0x79)],_0x464eed['addAttributesFile']),_0x5f3f11=await loadJSONFromOptions(_0x464eed[_0x14fbff(0x17a)],_0x464eed[_0x14fbff(0xe9)]),_0x4c94c4={'name':_0x5037f5['name'],'description':_0x464eed[_0x14fbff(0xec)]!==undefined?_0x464eed['description']:_0x5037f5['description'],'scheduleType':_0x464eed[_0x14fbff(0xb7)]!==undefined?_0x464eed['scheduleType']:_0x5037f5[_0x14fbff(0xb7)],'scheduleOption':_0x464eed['scheduleOption']!==undefined?_0x464eed[_0x14fbff(0x124)]:_0x5037f5['scheduleOption'],'timezone':_0x464eed[_0x14fbff(0x9a)]!==undefined?_0x464eed['timezone']:_0x5037f5[_0x14fbff(0x9a)],'master':_0x5037f5[_0x14fbff(0x1fa)],'attributes':_0x4e105a?[..._0x5037f5[_0x14fbff(0x15c)]||[],..._0x4e105a]:_0x5037f5[_0x14fbff(0x15c)],'behaviors':_0x5f3f11?[..._0x5037f5[_0x14fbff(0x1b3)]||[],..._0x5f3f11]:_0x5037f5[_0x14fbff(0x1b3)],'customerGroup':_0x5037f5['customerGroup']},_0x3171df=await withSpinner('Updating\x20parent\x20segment\x20\x27'+_0x1173bd+_0x14fbff(0x120),()=>_0xfb3eb5[_0x14fbff(0x176)][_0x14fbff(0xfb)](_0x1173bd,_0x4c94c4),{'verbose':_0x464eed[_0x14fbff(0x1cf)]}),_0x518a7b=_0x3171df[_0x14fbff(0x7b)];return console[_0x14fbff(0x1a3)](_0x14fbff(0xcd)+_0x518a7b[_0x14fbff(0x154)]+'\x27'),await handleSDKOutput([_0x518a7b],_0x464eed),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a30_0x388647(0x86);[a30_0x388647(0xec)]=a30_0x388647(0x12c);async[a30_0x388647(0x77)](_0x52c858){const _0x441967=a30_0x388647,{options:_0x2b0b42,args:_0x25cb68,tdx:_0x13497c}=_0x52c858,_0x39ecde=_0x2b0b42,_0x127e08=_0x25cb68[0x0]||_0x2b0b42['parentSegment'];if(!_0x127e08)return showParentSegmentNotSetError(_0x441967(0x131)+_0x441967(0x1b1)),0x1;if(_0x39ecde[_0x441967(0xfa)]&&_0x39ecde['output'])return console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0xd1)](_0x441967(0xe0))),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0xb2)](_0x441967(0xea))),console[_0x441967(0x1a3)](a30_0x530600['dim'](_0x441967(0x128)+PARENT_SEGMENT_DIR+_0x441967(0x1d4))),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1e7)](_0x441967(0x1bd))),0x1;const _0x3604ad=_0x39ecde['output']||a30_0x2158a2[_0x441967(0x8e)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x127e08)+'.yml');_0x39ecde[_0x441967(0x1cf)]&&(console['error'](_0x441967(0xcf)+_0x39ecde[_0x441967(0x18f)]),console['error'](_0x441967(0x7e)+_0x127e08),console[_0x441967(0x1a3)](_0x441967(0x1df)+_0x3604ad));const _0x36e2f3=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x127e08+_0x441967(0x120),()=>_0x13497c['segment']['pullParentYaml'](_0x127e08),{'verbose':_0x39ecde[_0x441967(0x1cf)]}),_0x1710f3=_0x36e2f3[_0x441967(0x7b)];if(existsSync(_0x3604ad)){const _0x44ce9a=readFileSync(_0x3604ad,_0x441967(0x1f4)),_0x257f8c=generateDiff(_0x44ce9a,_0x1710f3);if(!hasChanges(_0x257f8c))console[_0x441967(0x1a3)](a30_0x530600['green']('✔')+_0x441967(0x135)+a30_0x530600[_0x441967(0x1e7)](_0x3604ad)+_0x441967(0xf4));else{console[_0x441967(0x1a3)]('\x0aChanges\x20to\x20\x27'+_0x3604ad+'\x27:'),console[_0x441967(0x1a3)]('─'['repeat'](0x3c)),console[_0x441967(0x1a3)](formatDiffWithColors(_0x257f8c)),console[_0x441967(0x1a3)]('─'[_0x441967(0x140)](0x3c));if(!_0x39ecde[_0x441967(0x96)]){if(!isInteractive())return console['error'](a30_0x530600['red'](_0x441967(0x1b7)),_0x441967(0xde)),console[_0x441967(0x1a3)](a30_0x530600['dim'](_0x441967(0x127))),0x1;const _0x44e254=await confirmKey(_0x441967(0x16e)+_0x3604ad+'\x27?');if(!_0x44e254)return console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0xeb)](_0x441967(0x175))),0x1;}writeFileSync(_0x3604ad,_0x1710f3,_0x441967(0x1f4)),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1f1)]('✔')+_0x441967(0x157)+a30_0x530600[_0x441967(0x1e7)](_0x3604ad));}}else{const _0x4cefa6=a30_0x2158a2[_0x441967(0x6b)](_0x3604ad);!existsSync(_0x4cefa6)&&mkdirSync(_0x4cefa6,{'recursive':!![]}),writeFileSync(_0x3604ad,_0x1710f3,_0x441967(0x1f4)),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1f1)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x530600[_0x441967(0x1e7)](_0x3604ad));}return saveSessionContext({'parent_segment':_0x127e08},_0x39ecde[_0x441967(0x170)]),console[_0x441967(0x1a3)](a30_0x530600[_0x441967(0x1f1)]('✔')+'\x20Context\x20set:\x20'+a30_0x530600[_0x441967(0xb2)](_0x441967(0x174))+_0x441967(0xf8)+a30_0x530600[_0x441967(0x1e7)](_0x127e08)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x8d);[a30_0x388647(0xec)]=a30_0x388647(0x130);async[a30_0x388647(0x77)](_0x100d75){const _0x3648ea=a30_0x388647,{options:_0x3b053c,args:_0x5b22ea,tdx:_0x2b846b}=_0x100d75,_0xc558cb=_0x3b053c,_0x7a60b6=_0x5b22ea[0x0]||_0x3b053c[_0x3648ea(0x201)];if(!_0x7a60b6)return showParentSegmentNotSetError(_0x3648ea(0xad)+_0x3648ea(0x1ef)),0x1;const _0x386773=resolveYamlFile(_0x7a60b6);if(!existsSync(_0x386773))return showFileNotFoundError(_0x386773,_0x7a60b6),0x1;_0xc558cb[_0x3648ea(0x1cf)]&&(console['error']('Site:\x20'+_0xc558cb[_0x3648ea(0x18f)]),console[_0x3648ea(0x1a3)](_0x3648ea(0x17f)+_0x386773));let _0x37e9cc;try{_0x37e9cc=readFileSync(_0x386773,_0x3648ea(0x1f4));}catch(_0x45ef3a){const _0x534d3c=_0x45ef3a instanceof Error?_0x45ef3a[_0x3648ea(0x1c9)]:String(_0x45ef3a);return console[_0x3648ea(0x1a3)](_0x3648ea(0x1c7)+_0x534d3c),0x1;}const _0x1b1fbf=await withSpinner(_0x3648ea(0x18a),()=>_0x2b846b[_0x3648ea(0x176)][_0x3648ea(0xf6)](_0x37e9cc),{'verbose':_0xc558cb[_0x3648ea(0x1cf)]}),_0x3323cc=_0x1b1fbf[_0x3648ea(0x7b)],{isNew:_0x5c30d4,name:_0x503a73,hasChanges:_0x9fe35a,diffFormatted:_0x3229f6}=_0x3323cc;if(!_0x9fe35a)return console[_0x3648ea(0x1a3)](_0x3648ea(0x10f)+_0x503a73+_0x3648ea(0x198)),0x0;_0x5c30d4?console[_0x3648ea(0x1a3)](_0x3648ea(0x132)+_0x503a73+'\x27:'):console[_0x3648ea(0x1a3)](_0x3648ea(0x1af)+_0x503a73+'\x27:');console['error']('─'[_0x3648ea(0x140)](0x3c)),console[_0x3648ea(0x1a3)](_0x3229f6),console[_0x3648ea(0x1a3)]('─'['repeat'](0x3c));const _0x1f0ad6=_0x5c30d4?'Create\x20parent\x20segment\x20\x27'+_0x503a73+'\x27?':_0x3648ea(0x107)+_0x503a73+'\x27?';if(!_0xc558cb[_0x3648ea(0x96)]){if(!isInteractive())return console[_0x3648ea(0x1a3)](a30_0x530600['red'](_0x3648ea(0x1b7)),_0x3648ea(0xde)),console['error'](a30_0x530600[_0x3648ea(0xb2)](_0x3648ea(0x127))),0x1;const _0x1677f3=await confirmKey(_0x1f0ad6);if(!_0x1677f3)return console['error'](a30_0x530600['yellow'](_0x3648ea(0x175))),0x1;}const _0x1789bd=_0x5c30d4?_0x3648ea(0x104):'Updating',_0x4c7b2e=await withSpinner(_0x1789bd+'\x20parent\x20segment\x20\x27'+_0x503a73+_0x3648ea(0x120),()=>_0x3323cc[_0x3648ea(0x1db)](),{'verbose':_0xc558cb[_0x3648ea(0x1cf)]}),_0x558865=_0x4c7b2e[_0x3648ea(0x7b)],_0x32070d=getConsoleNextUrl(_0xc558cb[_0x3648ea(0x18f)],_0x3648ea(0x90)+_0x558865['id']),_0x1096dc=_0x5c30d4?_0x3648ea(0x1bc):_0x3648ea(0xae);return console[_0x3648ea(0x1a3)]('✔\x20'+_0x1096dc+_0x3648ea(0xaa)+_0x558865[_0x3648ea(0x154)]+'\x27'),console[_0x3648ea(0x1a3)]('\x20\x20'+_0x32070d),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x15a);[a30_0x388647(0xec)]=a30_0x388647(0xce);async['execute'](_0x313757){const _0x242f82=a30_0x388647,{options:_0x7b9cb2,args:_0x496b79,tdx:_0x5f0ddf}=_0x313757,_0xf545eb=_0x7b9cb2,_0x417583=_0x496b79[0x0]||_0x7b9cb2[_0x242f82(0x201)];if(!_0x417583)return showParentSegmentNotSetError(_0x242f82(0x193)+_0x242f82(0x85)+_0x242f82(0x6a)+_0x242f82(0x18c)+_0x242f82(0x7d)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x49fbbd=resolveYamlFile(_0x417583);if(!existsSync(_0x49fbbd))return showFileNotFoundError(_0x49fbbd,_0x417583),0x1;_0xf545eb['verbose']&&(console['error'](_0x242f82(0xcf)+_0xf545eb['site']),console[_0x242f82(0x1a3)]('YAML\x20file:\x20'+_0x49fbbd));let _0x561c7e;try{_0x561c7e=readFileSync(_0x49fbbd,'utf-8');}catch(_0x333b1f){const _0x41d2ff=_0x333b1f instanceof Error?_0x333b1f[_0x242f82(0x1c9)]:String(_0x333b1f);return console[_0x242f82(0x1a3)](_0x242f82(0x1c7)+_0x41d2ff),0x1;}const _0x2e80d1=createCommandSpinner(a30_0x530600['dim'](_0x242f82(0x13e)),{'verbose':_0xf545eb[_0x242f82(0x1cf)]});_0x2e80d1[_0x242f82(0xa2)]();const _0x28be94={'onProgress':_0x165569=>{const _0x41b90e=_0x242f82;_0x2e80d1[_0x41b90e(0x6c)]=formatProgressMessage(_0x165569);}};if(_0xf545eb[_0x242f82(0x1fa)])_0x28be94[_0x242f82(0x1fa)]=!![];if(_0xf545eb[_0x242f82(0x1bb)])_0x28be94[_0x242f82(0x1bb)]=!![];_0xf545eb['attribute']&&(_0x28be94[_0x242f82(0x117)]=_0xf545eb[_0x242f82(0x117)]);_0xf545eb['behavior']&&(_0x28be94[_0x242f82(0x196)]=_0xf545eb['behavior']);if(_0xf545eb[_0x242f82(0x147)])_0x28be94[_0x242f82(0x147)]=_0xf545eb[_0x242f82(0x147)];let _0x5072ce;try{_0x5072ce=await _0x5f0ddf['segment'][_0x242f82(0xc1)](_0x561c7e,_0x28be94),_0x2e80d1[_0x242f82(0x1d0)]();}catch(_0x529fc4){_0x2e80d1[_0x242f82(0x1d0)]();throw _0x529fc4;}const _0x542bc7=_0xf545eb[_0x242f82(0x147)]||'-1d';return this['displayValidateResults'](_0x5072ce,_0x28be94,_0x49fbbd,_0x542bc7),_0x5072ce[_0x242f82(0xd4)]?0x0:0x1;}[a30_0x388647(0xc7)](_0x475188,_0x3e6f86,_0xbd17b8,_0x35eb37){const _0x2d95a9=a30_0x388647;console[_0x2d95a9(0x1a3)]('\x0a'+a30_0x530600[_0x2d95a9(0x6d)](_0x2d95a9(0xee))+'\x20'+_0x475188[_0x2d95a9(0x154)]),console[_0x2d95a9(0x1a3)]('═'[_0x2d95a9(0x140)](0x3c)),this[_0x2d95a9(0x10d)](_0x475188);if(typeof _0x3e6f86[_0x2d95a9(0x117)]===_0x2d95a9(0xef)){this[_0x2d95a9(0xbe)](_0x475188),this['displaySummary'](_0x475188),this['displayPreviewHints'](_0xbd17b8,_0x35eb37,_0x2d95a9(0x117),_0x3e6f86[_0x2d95a9(0x117)]);return;}if(_0x3e6f86[_0x2d95a9(0x117)]===!![]){this[_0x2d95a9(0xbe)](_0x475188),this[_0x2d95a9(0xe5)](_0x475188),this[_0x2d95a9(0xa6)](_0xbd17b8,_0x35eb37,_0x2d95a9(0x15c));return;}if(typeof _0x3e6f86[_0x2d95a9(0x196)]==='string'){this[_0x2d95a9(0x1ac)](_0x475188,_0x35eb37),this[_0x2d95a9(0xe5)](_0x475188),this['displayPreviewHints'](_0xbd17b8,_0x35eb37,_0x2d95a9(0x196),_0x3e6f86[_0x2d95a9(0x196)]);return;}if(_0x3e6f86[_0x2d95a9(0x196)]===!![]){this[_0x2d95a9(0x1ac)](_0x475188,_0x35eb37),this['displaySummary'](_0x475188),this[_0x2d95a9(0xa6)](_0xbd17b8,_0x35eb37,_0x2d95a9(0x1b3));return;}this[_0x2d95a9(0xbe)](_0x475188),this[_0x2d95a9(0x1ac)](_0x475188,_0x35eb37),this['displayRealtimeInfo'](_0x475188),this[_0x2d95a9(0xe5)](_0x475188),this['displayPreviewHints'](_0xbd17b8,_0x35eb37,_0x2d95a9(0x165));}[a30_0x388647(0x1a6)](_0x2faa6e){displayRealtimeValidation(_0x2faa6e);}[a30_0x388647(0xa6)](_0x1a9157,_0x3ef056,_0x2afca8,_0x13cc2e){const _0x27e75c=a30_0x388647;console[_0x27e75c(0x1a3)]('\x0a'+a30_0x530600[_0x27e75c(0xb2)]('To\x20view\x20sample\x20data:'));const _0x2f5319=_0x3ef056!==_0x27e75c(0xd5)?_0x27e75c(0x10b)+_0x3ef056:'';if(_0x2afca8==='attribute'&&_0x13cc2e)console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)]('tdx\x20ps\x20preview\x20'+_0x1a9157+_0x27e75c(0x87)+_0x13cc2e+'\x22'+_0x2f5319));else{if(_0x2afca8===_0x27e75c(0x196)&&_0x13cc2e)console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)](_0x27e75c(0x1c4)+_0x1a9157+_0x27e75c(0x1f9)+_0x13cc2e+'\x22'+_0x2f5319));else(_0x2afca8===_0x27e75c(0x15c)||_0x2afca8===_0x27e75c(0x165))&&console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)](_0x27e75c(0x1c4)+_0x1a9157+'\x20--attribute\x20\x22<name>\x22'+_0x2f5319));}(_0x2afca8==='behaviors'||_0x2afca8===_0x27e75c(0x165))&&console[_0x27e75c(0x1a3)]('\x20\x20'+a30_0x530600[_0x27e75c(0xb2)](_0x27e75c(0x1c4)+_0x1a9157+_0x27e75c(0x108)+_0x2f5319)),_0x2afca8===_0x27e75c(0x165)&&console['error']('\x20\x20'+a30_0x530600['dim'](_0x27e75c(0x1c4)+_0x1a9157+'\x20--enriched'+_0x2f5319));}['displayMasterInfo'](_0x102dbc){const _0x318d61=a30_0x388647,{master:_0x5a5ae1}=_0x102dbc,_0x2def7d=_0x5a5ae1[_0x318d61(0x1e6)]?a30_0x530600['green']('✔'):a30_0x530600[_0x318d61(0xd1)]('✘');console[_0x318d61(0x1a3)]('\x0a'+a30_0x530600[_0x318d61(0xb2)]('Master\x20Table')),console[_0x318d61(0x1a3)](_0x2def7d+'\x20'+a30_0x530600[_0x318d61(0x6d)](_0x5a5ae1[_0x318d61(0x110)]+'.'+_0x5a5ae1['table'])),_0x5a5ae1['schemaValid']?_0x5a5ae1['rowCount']!==undefined&&console['error']('\x20\x20'+a30_0x530600[_0x318d61(0xb2)](_0x318d61(0x109))+'\x20'+a30_0x530600['cyan'](formatRows(_0x5a5ae1[_0x318d61(0x114)]))):console[_0x318d61(0x1a3)]('\x20\x20'+a30_0x530600[_0x318d61(0xd1)](_0x318d61(0x94))+'\x20'+_0x5a5ae1[_0x318d61(0x178)]);}[a30_0x388647(0xbe)](_0x1277af){const _0x560676=a30_0x388647;if(_0x1277af[_0x560676(0x15c)]['length']===0x0)return;console[_0x560676(0x1a3)]('\x0a'+a30_0x530600['dim'](_0x560676(0x14b)));for(const _0x48f608 of _0x1277af[_0x560676(0x15c)]){const _0x53c9bd=_0x48f608[_0x560676(0x1e6)]?a30_0x530600[_0x560676(0x1f1)]('✔'):a30_0x530600[_0x560676(0xd1)]('✘');let _0x10eaf1='';if(_0x48f608[_0x560676(0x1e6)]&&_0x48f608[_0x560676(0xfd)]!==undefined&&_0x48f608['coveragePercent']!==undefined){const _0x2f1acc=_0x48f608[_0x560676(0x153)][_0x560676(0xab)](0x1),_0x16d0a4=_0x48f608[_0x560676(0x153)]>=0x50?a30_0x530600[_0x560676(0x1f1)]:_0x48f608[_0x560676(0x153)]>=0x32?a30_0x530600[_0x560676(0xeb)]:a30_0x530600[_0x560676(0xd1)];_0x10eaf1='\x20'+a30_0x530600['dim'](_0x560676(0x9f))+'\x20'+_0x16d0a4(_0x2f1acc+'%')+'\x20('+formatRows(_0x48f608[_0x560676(0xfd)])+'\x20rows)';}console[_0x560676(0x1a3)](_0x53c9bd+'\x20'+a30_0x530600['bold'](_0x48f608[_0x560676(0x154)])+_0x10eaf1),console[_0x560676(0x1a3)]('\x20\x20'+a30_0x530600[_0x560676(0xb2)](_0x560676(0x18e))+'\x20'+a30_0x530600['bold'](_0x48f608['database']+'.'+_0x48f608[_0x560676(0x1fd)]));const _0x54653d=_0x48f608[_0x560676(0x1a0)]===_0x48f608['foreignKey']?a30_0x530600[_0x560676(0xb2)](_0x560676(0x16a))+'\x20'+_0x48f608['joinKey']:a30_0x530600['dim'](_0x560676(0x15b))+'\x20'+_0x48f608[_0x560676(0x1a0)]+'\x20=\x20'+_0x48f608['foreignKey'];console[_0x560676(0x1a3)]('\x20\x20'+_0x54653d),console[_0x560676(0x1a3)]('\x20\x20'+a30_0x530600[_0x560676(0xb2)]('Columns:')),this[_0x560676(0x1be)](_0x48f608['columns']),!_0x48f608[_0x560676(0x1e6)]&&console['error']('\x20\x20'+a30_0x530600[_0x560676(0xd1)](_0x560676(0x94))+'\x20'+_0x48f608[_0x560676(0x178)]);}}[a30_0x388647(0x1ac)](_0x265421,_0x45036d){const _0x36b48e=a30_0x388647;if(_0x265421['behaviors'][_0x36b48e(0x10c)]===0x0)return;console[_0x36b48e(0x1a3)]('\x0a'+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0x148))+'\x20'+a30_0x530600[_0x36b48e(0xb2)]('('+_0x45036d+')'));for(const _0x8203e6 of _0x265421[_0x36b48e(0x1b3)]){const _0x433bbf=_0x8203e6[_0x36b48e(0x1e6)]?a30_0x530600[_0x36b48e(0x1f1)]('✔'):a30_0x530600[_0x36b48e(0xd1)]('✘');let _0x35fabf='';if(_0x8203e6[_0x36b48e(0x1e6)]&&_0x8203e6[_0x36b48e(0xb1)]!==undefined&&_0x8203e6[_0x36b48e(0xe7)]!==undefined){const _0x28cdc9=_0x8203e6[_0x36b48e(0x1c2)]?.['toFixed'](0x1)||'?',_0x23182a=(_0x8203e6[_0x36b48e(0x1c2)]??0x0)>=0x32?a30_0x530600[_0x36b48e(0x1f1)]:(_0x8203e6[_0x36b48e(0x1c2)]??0x0)>=0x14?a30_0x530600[_0x36b48e(0xeb)]:a30_0x530600[_0x36b48e(0xd1)];_0x35fabf='\x20'+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0xbd))+'\x20'+_0x23182a(formatRows(_0x8203e6[_0x36b48e(0xb1)]))+'\x20('+_0x28cdc9+_0x36b48e(0x89)+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0xe6))+'\x20'+a30_0x530600[_0x36b48e(0x1e7)](formatRows(_0x8203e6[_0x36b48e(0xe7)]));}console[_0x36b48e(0x1a3)](_0x433bbf+'\x20'+a30_0x530600[_0x36b48e(0x6d)](_0x8203e6[_0x36b48e(0x154)])+_0x35fabf),console[_0x36b48e(0x1a3)]('\x20\x20'+a30_0x530600['dim']('Source:')+'\x20'+a30_0x530600[_0x36b48e(0x6d)](_0x8203e6[_0x36b48e(0x110)]+'.'+_0x8203e6[_0x36b48e(0x1fd)]));const _0xf0aa7a=_0x8203e6['joinKey']===_0x8203e6['foreignKey']?a30_0x530600['dim'](_0x36b48e(0x16a))+'\x20'+_0x8203e6[_0x36b48e(0x1a0)]:a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0x15b))+'\x20'+_0x8203e6[_0x36b48e(0x1a0)]+_0x36b48e(0xf8)+_0x8203e6['foreignKey'];console[_0x36b48e(0x1a3)]('\x20\x20'+_0xf0aa7a),console['error']('\x20\x20'+a30_0x530600[_0x36b48e(0xb2)](_0x36b48e(0xc5))),this[_0x36b48e(0x1be)](_0x8203e6[_0x36b48e(0x118)]),!_0x8203e6[_0x36b48e(0x1e6)]&&console[_0x36b48e(0x1a3)]('\x20\x20'+a30_0x530600[_0x36b48e(0xd1)](_0x36b48e(0x94))+'\x20'+_0x8203e6[_0x36b48e(0x178)]);}}[a30_0x388647(0x1be)](_0x1bf070){const _0x207a75=a30_0x388647;for(const _0x89e6c5 of _0x1bf070){_0x89e6c5[_0x207a75(0x1ed)]===_0x89e6c5[_0x207a75(0x13f)]||_0x89e6c5[_0x207a75(0x13f)]==='*'?console[_0x207a75(0x1a3)](_0x207a75(0x7c)+_0x89e6c5[_0x207a75(0x1ed)]):console[_0x207a75(0x1a3)]('\x20\x20\x20\x20-\x20'+_0x89e6c5[_0x207a75(0x1ed)]+'\x20'+a30_0x530600['dim']('('+_0x89e6c5[_0x207a75(0x13f)]+')'));}}[a30_0x388647(0xe5)](_0x234328){const _0x5b3d0b=a30_0x388647;console[_0x5b3d0b(0x1a3)]('─'[_0x5b3d0b(0x140)](0x3c));if(_0x234328[_0x5b3d0b(0x14c)][_0x5b3d0b(0x10c)]>0x0){console[_0x5b3d0b(0x1a3)]('\x0a'+a30_0x530600['red'](_0x5b3d0b(0x1f0)));for(const _0x582d2b of _0x234328[_0x5b3d0b(0x14c)]){console[_0x5b3d0b(0x1a3)]('\x20\x20'+a30_0x530600[_0x5b3d0b(0xd1)]('•')+'\x20'+_0x582d2b);}}_0x234328[_0x5b3d0b(0xd4)]&&console['error']('\x0a'+a30_0x530600[_0x5b3d0b(0x1f1)]('✔')+_0x5b3d0b(0xc6));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a30_0x388647(0x1de);[a30_0x388647(0xec)]=a30_0x388647(0x14a);async[a30_0x388647(0x77)](_0x4843d4){const _0x57388a=a30_0x388647,{options:_0x22dc0d,args:_0x4a6b28,tdx:_0x7fee3f}=_0x4843d4,_0x48f3b0=_0x22dc0d,_0x246c52=_0x4a6b28[0x0]||_0x22dc0d[_0x57388a(0x201)];if(!_0x246c52)return showParentSegmentNotSetError(_0x57388a(0x197)+_0x57388a(0x19c)+_0x57388a(0x14d)+_0x57388a(0x95)+_0x57388a(0x12a)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x57388a(0xdd)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x48f3b0[_0x57388a(0x1fa)]&&!_0x48f3b0['attribute']&&!_0x48f3b0[_0x57388a(0x196)]&&!_0x48f3b0[_0x57388a(0x1bb)])return console['error'](a30_0x530600[_0x57388a(0xd1)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error']('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console['error']('Options:'),console[_0x57388a(0x1a3)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x57388a(0x1a3)](_0x57388a(0xe1)),console['error'](_0x57388a(0x164)),console[_0x57388a(0x1a3)]('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x15d6f2=resolveYamlFile(_0x246c52);if(!existsSync(_0x15d6f2))return showFileNotFoundError(_0x15d6f2,_0x246c52),0x1;_0x48f3b0[_0x57388a(0x1cf)]&&(console['error'](_0x57388a(0xcf)+_0x48f3b0[_0x57388a(0x18f)]),console['error']('YAML\x20file:\x20'+_0x15d6f2));let _0x58aeec;try{_0x58aeec=readFileSync(_0x15d6f2,'utf-8');}catch(_0x251e19){const _0x59af01=_0x251e19 instanceof Error?_0x251e19[_0x57388a(0x1c9)]:String(_0x251e19);return console[_0x57388a(0x1a3)](_0x57388a(0x1c7)+_0x59af01),0x1;}let _0x11950b;try{_0x11950b=parseDef(_0x58aeec);}catch(_0x259c12){const _0xe58d88=_0x259c12 instanceof Error?_0x259c12[_0x57388a(0x1c9)]:String(_0x259c12);return console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0x111)+_0xe58d88)),0x1;}if(_0x48f3b0[_0x57388a(0x117)]===!![]||_0x48f3b0[_0x57388a(0x117)]===''){const _0x23a76f=_0x11950b[_0x57388a(0x15c)]?.[_0x57388a(0x16d)](_0x1620aa=>_0x1620aa[_0x57388a(0x154)])||[];if(_0x23a76f['length']===0x0)console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0x8f)));else{console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0x19f))),console[_0x57388a(0x1a3)](_0x57388a(0x119));for(const _0x4a07e4 of _0x23a76f){console[_0x57388a(0x1a3)]('\x20\x20'+a30_0x530600[_0x57388a(0x1e7)](_0x4a07e4));}console[_0x57388a(0x1a3)](_0x57388a(0xd0)+_0x246c52+_0x57388a(0x87)+_0x23a76f[0x0]+'\x22');}return 0x1;}if(_0x48f3b0[_0x57388a(0x196)]===!![]||_0x48f3b0[_0x57388a(0x196)]===''){const _0x1666ae=_0x11950b[_0x57388a(0x1b3)]?.['map'](_0x5a59c4=>_0x5a59c4['name'])||[];if(_0x1666ae[_0x57388a(0x10c)]===0x0)console['error'](a30_0x530600[_0x57388a(0xd1)](_0x57388a(0xdb)));else{console[_0x57388a(0x1a3)](a30_0x530600[_0x57388a(0xd1)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x57388a(0x1a3)](_0x57388a(0x8c));for(const _0x174acf of _0x1666ae){console[_0x57388a(0x1a3)]('\x20\x20'+a30_0x530600['cyan'](_0x174acf));}console[_0x57388a(0x1a3)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x246c52+_0x57388a(0x1f9)+_0x1666ae[0x0]+'\x22');}return 0x1;}const _0x2d1b29=createCommandSpinner(a30_0x530600[_0x57388a(0xb2)]('Fetching\x20sample\x20data...'),{'verbose':_0x48f3b0[_0x57388a(0x1cf)]});_0x2d1b29[_0x57388a(0xa2)]();const _0x3e5c36={'onProgress':_0xa3cc94=>{const _0x487d42=_0x57388a;_0x2d1b29[_0x487d42(0x6c)]=formatProgressMessage(_0xa3cc94);}};if(_0x48f3b0[_0x57388a(0x1fa)])_0x3e5c36[_0x57388a(0x1fa)]=!![];if(_0x48f3b0[_0x57388a(0x117)]&&typeof _0x48f3b0[_0x57388a(0x117)]==='string')_0x3e5c36[_0x57388a(0x117)]=_0x48f3b0[_0x57388a(0x117)];if(_0x48f3b0[_0x57388a(0x196)]&&typeof _0x48f3b0[_0x57388a(0x196)]===_0x57388a(0xef))_0x3e5c36[_0x57388a(0x196)]=_0x48f3b0[_0x57388a(0x196)];if(_0x48f3b0[_0x57388a(0x1bb)])_0x3e5c36[_0x57388a(0x1bb)]=!![];if(_0x48f3b0[_0x57388a(0x147)])_0x3e5c36[_0x57388a(0x147)]=_0x48f3b0[_0x57388a(0x147)];let _0x4926e3;try{_0x4926e3=await _0x7fee3f['segment']['previewParentYaml'](_0x58aeec,_0x3e5c36),_0x2d1b29[_0x57388a(0x1d0)]();}catch(_0xe6ec42){_0x2d1b29[_0x57388a(0x1d0)]();throw _0xe6ec42;}return await this[_0x57388a(0x116)](_0x4926e3,{'master':_0x48f3b0[_0x57388a(0x1fa)],'attribute':typeof _0x48f3b0[_0x57388a(0x117)]===_0x57388a(0xef)?_0x48f3b0[_0x57388a(0x117)]:undefined,'behavior':typeof _0x48f3b0[_0x57388a(0x196)]===_0x57388a(0xef)?_0x48f3b0['behavior']:undefined,'enriched':_0x48f3b0[_0x57388a(0x1bb)]}),_0x4926e3[_0x57388a(0xd4)]?0x0:0x1;}async[a30_0x388647(0x116)](_0x26eec1,_0xfb34fd){const _0x4a4999=a30_0x388647;console['error']('\x0a'+a30_0x530600[_0x4a4999(0x6d)](_0x4a4999(0xb5))+'\x20'+_0x26eec1['name']),console[_0x4a4999(0x1a3)]('═'[_0x4a4999(0x140)](0x3c));if(_0xfb34fd[_0x4a4999(0x1fa)]&&_0x26eec1[_0x4a4999(0x15d)]){const _0x8b944e=a30_0x530600[_0x4a4999(0xb2)](_0x4a4999(0xd7))+'\x20'+a30_0x530600[_0x4a4999(0x6d)](_0x26eec1['master'][_0x4a4999(0x110)]+'.'+_0x26eec1['master'][_0x4a4999(0x1fd)]);await this[_0x4a4999(0xb9)](_0x8b944e,_0x26eec1[_0x4a4999(0x15d)]);}else{if(_0xfb34fd[_0x4a4999(0x117)]&&_0x26eec1['sampleData']){const _0x1c5215=a30_0x530600[_0x4a4999(0xb2)](_0x4a4999(0x150))+'\x20'+a30_0x530600['bold'](_0xfb34fd[_0x4a4999(0x117)]);await this[_0x4a4999(0xb9)](_0x1c5215,_0x26eec1[_0x4a4999(0x15d)]);}else{if(_0xfb34fd['behavior']&&_0x26eec1[_0x4a4999(0x15d)]){const _0x34759a=a30_0x530600['dim'](_0x4a4999(0x9d))+'\x20'+a30_0x530600[_0x4a4999(0x6d)](_0xfb34fd[_0x4a4999(0x196)]);await this['displaySampleData'](_0x34759a,_0x26eec1[_0x4a4999(0x15d)]);}else{if(_0xfb34fd[_0x4a4999(0x1bb)]&&_0x26eec1['sampleData']){const _0x604822=a30_0x530600[_0x4a4999(0xb2)](_0x4a4999(0x162))+'\x20'+a30_0x530600['bold'](_0x4a4999(0xc8));await this['displaySampleData'](_0x604822,_0x26eec1['sampleData']);}else!_0x26eec1[_0x4a4999(0x15d)]&&console[_0x4a4999(0x1a3)](_0x4a4999(0x1e0));}}}if(_0x26eec1[_0x4a4999(0x14c)]['length']>0x0){console[_0x4a4999(0x1a3)]('─'[_0x4a4999(0x140)](0x3c)),console[_0x4a4999(0x1a3)]('\x0a'+a30_0x530600[_0x4a4999(0xd1)](_0x4a4999(0x1f0)));for(const _0x1e0a37 of _0x26eec1[_0x4a4999(0x14c)]){console[_0x4a4999(0x1a3)]('\x20\x20'+a30_0x530600[_0x4a4999(0xd1)]('•')+'\x20'+_0x1e0a37);}}}async[a30_0x388647(0xb9)](_0x160107,_0x61498a){const _0x12f0e3=a30_0x388647;if(_0x61498a[_0x12f0e3(0x10c)]===0x0){console['error']('\x0a'+_0x160107),console['error'](_0x12f0e3(0x17b));return;}console['error']('\x0a'+_0x160107);const _0x1859f6=Object[_0x12f0e3(0x84)](_0x61498a[0x0])[_0x12f0e3(0x16d)](_0x394150=>({'name':_0x394150,'type':typeof _0x61498a[0x0][_0x394150]===_0x12f0e3(0xa3)?'double':'varchar'})),_0x424f75={'queryId':_0x12f0e3(0xcb),'columns':_0x1859f6,'data':_0x61498a,'stats':{'state':_0x12f0e3(0xe8),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x61498a[_0x12f0e3(0x10c)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x21714a=formatAsTable(_0x424f75,_0x61498a[_0x12f0e3(0x10c)],!![]);await writeOutput(_0x21714a,undefined,_0x12f0e3(0x1fd));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x83);[a30_0x388647(0xec)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a30_0x388647(0x77)](_0x10fd6a){const _0x2fc2e7=a30_0x388647,{options:_0x5af3fd,args:_0x25ac80,tdx:_0x16f22b}=_0x10fd6a,_0x1a7e0f=_0x5af3fd,_0x101a90=_0x25ac80[0x0]||_0x5af3fd[_0x2fc2e7(0x201)];if(!_0x101a90)return showParentSegmentNotSetError(_0x2fc2e7(0x103)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x2cfd8b=resolveYamlFile(_0x101a90);if(existsSync(_0x2cfd8b)){_0x1a7e0f[_0x2fc2e7(0x1cf)]&&console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x134)+_0x2cfd8b);let _0x27d8a2;try{_0x27d8a2=readFileSync(_0x2cfd8b,_0x2fc2e7(0x1f4));}catch(_0x13e112){const _0x58beb=_0x13e112 instanceof Error?_0x13e112[_0x2fc2e7(0x1c9)]:String(_0x13e112);return console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x1c7)+_0x58beb),0x1;}const _0x5594c8=await withSpinner(_0x2fc2e7(0x18a),()=>_0x16f22b[_0x2fc2e7(0x176)]['pushParentYaml'](_0x27d8a2),{'verbose':_0x1a7e0f[_0x2fc2e7(0x1cf)]}),_0x11b4a8=_0x5594c8[_0x2fc2e7(0x7b)],{isNew:_0x21a592,name:_0x11ade5,hasChanges:_0x4acd74,diffFormatted:_0xd20635}=_0x11b4a8;if(_0x4acd74){_0x21a592?console['error'](_0x2fc2e7(0x132)+_0x11ade5+'\x27:'):console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x1af)+_0x11ade5+'\x27:');console[_0x2fc2e7(0x1a3)]('─'[_0x2fc2e7(0x140)](0x3c)),console[_0x2fc2e7(0x1a3)](_0xd20635),console[_0x2fc2e7(0x1a3)]('─'[_0x2fc2e7(0x140)](0x3c));const _0x563f6e=_0x21a592?_0x2fc2e7(0x126)+_0x11ade5+_0x2fc2e7(0x1b9):_0x2fc2e7(0x107)+_0x11ade5+_0x2fc2e7(0x1b9);if(!_0x1a7e0f['yes']){if(!isInteractive())return console[_0x2fc2e7(0x1a3)](a30_0x530600[_0x2fc2e7(0xd1)]('\x0aError:'),_0x2fc2e7(0xde)),console[_0x2fc2e7(0x1a3)](a30_0x530600['dim'](_0x2fc2e7(0x127))),0x1;const _0x198cad=await confirmKey(_0x563f6e);if(!_0x198cad)return console['error'](a30_0x530600[_0x2fc2e7(0xeb)]('Aborted.')),0x1;}const _0x3bdcd9=_0x21a592?_0x2fc2e7(0x104):_0x2fc2e7(0x1a4);await withSpinner(_0x3bdcd9+_0x2fc2e7(0xaa)+_0x11ade5+_0x2fc2e7(0x120),()=>_0x11b4a8['apply'](),{'verbose':_0x1a7e0f[_0x2fc2e7(0x1cf)]});const _0x203fb8=_0x21a592?_0x2fc2e7(0x1bc):_0x2fc2e7(0xae);console['error']('✔\x20'+_0x203fb8+'\x20parent\x20segment\x20\x27'+_0x11ade5+'\x27');}else console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x10f)+_0x11ade5+_0x2fc2e7(0xac));}const _0x4fd9e4=await withSpinner(_0x2fc2e7(0x1a1)+_0x101a90+_0x2fc2e7(0x120),()=>_0x16f22b[_0x2fc2e7(0x176)][_0x2fc2e7(0x1a5)](_0x101a90),{'verbose':_0x1a7e0f[_0x2fc2e7(0x1cf)]}),_0x368a8e=_0x4fd9e4[_0x2fc2e7(0x7b)],_0x521cd1=getConsoleUrl(_0x1a7e0f[_0x2fc2e7(0x18f)],_0x2fc2e7(0x121)+_0x368a8e[_0x2fc2e7(0x194)]+_0x2fc2e7(0x100)+_0x368a8e[_0x2fc2e7(0x1d3)]+_0x2fc2e7(0x11b)+_0x368a8e[_0x2fc2e7(0x141)]);return console[_0x2fc2e7(0x1a3)](_0x2fc2e7(0x172)),console[_0x2fc2e7(0x1a3)]('\x20\x20'+a30_0x530600[_0x2fc2e7(0xb2)](_0x2fc2e7(0xb8))+'\x20'+_0x368a8e[_0x2fc2e7(0x101)]),console['error']('\x20\x20'+a30_0x530600[_0x2fc2e7(0xb2)](_0x2fc2e7(0x161))+'\x20'+_0x368a8e['status']),console[_0x2fc2e7(0x1a3)]('\x20\x20'+a30_0x530600[_0x2fc2e7(0xb2)]('Session:')+'\x20'+_0x368a8e['workflowSessionId']),console['error']('\x20\x20'+a30_0x530600['dim'](_0x2fc2e7(0x186))+'\x20'+_0x368a8e['workflowAttemptId']),console[_0x2fc2e7(0x1a3)]('\x20\x20'+_0x521cd1),console['error']('\x0a'+a30_0x530600[_0x2fc2e7(0xb2)](_0x2fc2e7(0xc9))+_0x2fc2e7(0xf5)+_0x368a8e[_0x2fc2e7(0x141)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a30_0x388647(0xda);['description']=a30_0x388647(0x16c);async[a30_0x388647(0x77)](_0x5e7714){const _0x2be644=a30_0x388647,{options:_0xe12dd3,args:_0x44fbc6,tdx:_0x602705}=_0x5e7714,_0x12ff68=_0x44fbc6[0x0]||_0xe12dd3[_0x2be644(0x201)];if(!_0x12ff68)return showParentSegmentNotSetError(_0x2be644(0x1ec)+_0x2be644(0x15f)),0x1;_0xe12dd3[_0x2be644(0x1cf)]&&(console[_0x2be644(0x1a3)]('Site:\x20'+_0xe12dd3[_0x2be644(0x18f)]),console['error']('Parent\x20segment:\x20'+_0x12ff68));const _0x15cc1d=await withSpinner('Listing\x20fields\x20for\x20\x27'+_0x12ff68+_0x2be644(0x120),()=>_0x602705[_0x2be644(0x176)][_0x2be644(0x14e)](_0x12ff68),{'verbose':_0xe12dd3[_0x2be644(0x1cf)]}),_0x39dd45=_0x15cc1d[_0x2be644(0x7b)];console[_0x2be644(0x1a3)](_0x2be644(0x167)+_0x39dd45[_0x2be644(0x10c)]+'\x20field'+(_0x39dd45[_0x2be644(0x10c)]!==0x1?'s':''));if(_0xe12dd3[_0x2be644(0xf9)]||_0xe12dd3[_0x2be644(0x1b0)])return await handleSDKOutput(_0x39dd45,_0xe12dd3),0x0;return displayFieldsHumanReadable(_0x39dd45,_0x12ff68),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x388647(0x154)]=a30_0x388647(0xc3);[a30_0x388647(0xec)]=a30_0x388647(0x123);async['execute'](_0xc2ee88){const _0x23ac09=a30_0x388647,{options:_0x4d4463,args:_0x39f383,tdx:_0x4542bc}=_0xc2ee88,_0x2b9ba1=_0x4d4463,_0x2e7873=_0x39f383[0x0]||_0x4d4463[_0x23ac09(0x201)];if(!_0x2e7873)return showParentSegmentNotSetError(_0x23ac09(0x13d)+_0x23ac09(0x19a)+'Options:\x0a'+_0x23ac09(0x190)),0x1;_0x4d4463[_0x23ac09(0x1cf)]&&(console['error'](_0x23ac09(0xcf)+_0x4d4463[_0x23ac09(0x18f)]),console[_0x23ac09(0x1a3)]('Parent\x20segment:\x20'+_0x2e7873));const _0x2b70b7=await withSpinner(_0x23ac09(0x1bf)+_0x2e7873+_0x23ac09(0x120),()=>_0x4542bc[_0x23ac09(0x176)][_0x23ac09(0x82)](_0x2e7873),{'verbose':_0x4d4463[_0x23ac09(0x1cf)]}),_0x418342=_0x2b70b7['data'];if(_0x2b9ba1[_0x23ac09(0x1b2)]){const _0x4726bd=getConsoleNextUrl(_0x2b9ba1[_0x23ac09(0x18f)],_0x23ac09(0x90)+_0x418342['id']);return console['error'](a30_0x530600['green']('✔')+_0x23ac09(0x7f)+a30_0x530600[_0x23ac09(0x1e7)](_0x4726bd)),openBrowser(_0x4726bd),0x0;}return await handleSingleObjectOutput(_0x418342,_0x4d4463),0x0;}}function a30_0x2f4d(){const _0x26a309=['\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20personalization\x20service','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','column_name','list','execute','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','addAttributes','\x20\x20Columns:\x20','data','\x20\x20\x20\x20-\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Parent\x20segment:\x20','\x20Opening\x20','Error:\x20File\x20not\x20found:\x20','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','getParentFull','segment:parent:run','keys','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','segment:parent:pull','\x20--attribute\x20\x22','/\x20directories\x20exist.','%)\x20','\x20\x20Tables:\x201\x20customers\x20+\x20','/\x20→\x20','Available\x20behaviors:','segment:parent:push','join','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','/app/dw/parentSegments/','elapsedTimeMillis','parent_id','log','Error:','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','yes','Executing\x20parent\x20segment\x20query...','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','getBehaviorNames','timezone','👥\x20','trigger_event','Behavior:','\x22,\x20\x22type\x22:\x20\x22','Coverage:','Schema\x20saved\x20to\x20','\x20service','start','number','Listing\x20parent\x20segments...','Fetching\x20behavior\x20list...','displayPreviewHints','18obtvgn','{\x0a\x20\x20\x22database\x22:\x20\x22','platform','\x20parent\x20segment\x20\x27','toFixed','\x27\x20is\x20up\x20to\x20date','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','Updated','resolveParentId','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','customersWithEvents','dim','\x20section','\x20service(s)\x20configured','Preview:','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','scheduleType','Audience\x20ID:','displaySampleData','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','darwin','Customers:','displayAttributesStats','enabled','8XOapgm','validateParentYaml','.yaml','segment:parent:view','reduce','Columns:','\x20Configuration\x20is\x20valid','displayValidateResults','Master\x20+\x20Attributes','To\x20cancel:','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','preview','⚡\x20Enabled','✔\x20Updated\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Site:\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','red','primaryKey','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','allValid','-1d','\x20\x20\x20\x20\x20\x20','Master:','\x20configured','\x20\x20Database:\x20','segment:parent:fields','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','<database>.<table>','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x20RT-enabled\x20parent\x20segment','getOutputDatabaseName','\x20\x20\x20','displaySummary','Events:','totalEvents','FINISHED','addBehaviorsFile','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','yellow','description','RT\x202.0:','Validate:','string','✔\x20Created\x20parent\x20segment\x20\x27','segment:parent:desc','2432780haVJmr','realtime:','\x20is\x20already\x20up\x20to\x20date','\x20tdx\x20wf\x20attempt\x20','pushParentYaml','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','\x20=\x20','json','use','updateParent','ignore','matchedCount','Show\x20parent\x20segment\x20schema\x20(column\x20types)','/\x20directory.\x0a','/sessions/','audienceId','\x5c$&','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Creating','sourceTableValid','sections','Apply\x20changes\x20to\x20\x27','\x20--behavior\x20\x22<name>\x22','Rows:','2348465rCoden','\x20--interval\x20','length','displayMasterInfo','\x20Added\x20personalization\x20template\x20to\x20','✔\x20No\x20changes\x20-\x20\x27','database','Error\x20parsing\x20YAML:\x20','customerGroup','\x20parent\x20segment','rowCount','toLocaleString','displayPreviewResults','attribute','columns','Available\x20attributes:','xdg-open','/attempt/','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','personalization','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','No\x20RT-enabled\x20parent\x20segments\x20found','\x27...','/app/workflows/','processedRows','Show\x20parent\x20segment\x20details','scheduleOption','1473352JDjuFo','Create\x20parent\x20segment\x20\x27','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','using\x20the\x20default\x20path:\x20','ID\x20Stitching:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','ps:pz:init','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Fetching\x20customers\x20schema...','page_view','trim','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','\x0aNew\x20parent\x20segment\x20\x27','Personalization\x20service\x20description','Found\x20YAML\x20file:\x20','\x20No\x20changes\x20-\x20','toLowerCase','true','\x20to\x20push\x20the\x20configuration','RT\x202.0\x20Validate:','\x0a\x20\x20\x20\x20}','sourceTableError','.customers)','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','Validating\x20configuration...','column','repeat','workflowAttemptId','Creating\x20parent\x20segment\x20\x27','Validating\x20RT\x20configuration...','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','query','Output\x20Database:','interval','Behaviors','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','Attributes','errors','Options\x20(one\x20required):\x0a','listFields','\x0a⚠️\x20\x20Migrating:\x20','Attribute:','Listing\x20personalization\x20services\x20for\x20\x27','Pattern:\x20','coveragePercent','name','92409OJUWEI','column_type','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Listing\x20parent\x20segments\x20matching\x20\x27','run','segment:parent:validate','Join:','attributes','sampleData','\x20\x202.\x20Run\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x27\x20with\x20ID:\x20','Status:','Enriched:','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','all','realtime_enabled','✔\x20Found\x20','ps:rt:list','\x0a\x20\x20\x20\x20]','Join\x20on:','segment:parent:sql','List\x20available\x20fields\x20for\x20segmentation','map','Overwrite\x20\x27','limit','session','✔\x20Renamed\x20directory\x20to\x20','\x0a✔\x20Workflow\x20started','replace','parent_segment','Aborted.','segment','5JZVYBU','schemaError','match','addBehaviors','\x20\x20No\x20sample\x20data\x20available','getParentSQL','3343930IlFDqh','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20','type','attributesFile','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','SQL\x20query:\x0a','Attempt:','Listing\x20RT-enabled\x20parent\x20segments...','collectSchema','Default','Analyzing\x20changes...','user_id','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','⚡\x20Not\x20enabled','Source:','site','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20Added\x20RT\x202.0\x20template\x20section','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','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','workflowId','endsWith','behavior','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','\x27\x20is\x20already\x20up\x20to\x20date','idStitching','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\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','output','push','Error:\x20--attribute\x20requires\x20a\x20name\x0a','joinKey','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20behaviors','error','Updating','runParent','displayRealtimeInfo','.yml','createParent','Next\x20steps:','valid','open','displayBehaviorsStats','Resolving\x20parent\x20segment\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','jsonl','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','web','behaviors','indexOf','\x20\x201.\x20Edit\x20','personalizationServices','\x0aError:','ps:rt:validate','\x27\x20and\x20run\x20workflow?','/\x20and\x20','enriched','Created','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displayColumns','Fetching\x20parent\x20segment\x20\x27','My\x20Service','sort','customerPercent','customers','tdx\x20ps\x20preview\x20','customerGroupFile','in\x20','Error\x20reading\x20file:\x20','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','message','behavior_','3378660siKLQt','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','last_page_viewed','verbose','stop','behaviorsFile','filter','workflowSessionId','/{name}.yml\x0a','\x20rows\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','No\x20parent\x20segments\x20match\x20pattern:\x20','personalization_services','parent_segments','`\x20to\x20download\x20the\x20configuration\x20first','apply','\x20\x20Note:\x20','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','segment:parent:preview','Output\x20file:\x20','\x0aNo\x20sample\x20data\x20available','win32','listParents','format','segment:parent:update','✔\x20Query\x20completed:\x20Processed\x20','schemaValid','cyan','Fetching\x20SQL\x20for\x20\x27','formatSchemaJson','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','jobId','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','label','stitchingKeys','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Errors:','green','td_client_id','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','utf-8','tdx\x20ps\x20push\x20','336144MbRcpT','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','population','\x20--behavior\x20\x22','master','\x22\x20}','No\x20personalization\x20services\x20configured','table','events','No\x20parent\x20segments\x20found','\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','parentSegment','Options:\x0a','dirname','text','bold','realtime','SELECT\x20*\x20FROM\x20','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','localeCompare'];a30_0x2f4d=function(){return _0x26a309;};return a30_0x2f4d();}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x388647(0x154)]=a30_0x388647(0xf1);['description']=a30_0x388647(0xfe);async[a30_0x388647(0x77)](_0x2dd58a){const _0x5cf178=a30_0x388647,{options:_0xa66b3a,args:_0x3f167e,tdx:_0x4dd822}=_0x2dd58a,_0x25d5c8=_0xa66b3a,_0x11bec8=_0x3f167e[0x0]||_0xa66b3a[_0x5cf178(0x201)];if(!_0x11bec8)return showParentSegmentNotSetError(_0x5cf178(0x192)+_0x5cf178(0x200)+_0x5cf178(0x6a)+_0x5cf178(0x1c8)),0x1;_0xa66b3a['verbose']&&(console['error'](_0x5cf178(0xcf)+_0xa66b3a[_0x5cf178(0x18f)]),console[_0x5cf178(0x1a3)](_0x5cf178(0x7e)+_0x11bec8));const _0x154c5d=await withSpinner(_0x5cf178(0x1ad)+_0x11bec8+'\x27...',()=>_0x4dd822[_0x5cf178(0x176)]['resolveParentId'](_0x11bec8),{'verbose':_0xa66b3a[_0x5cf178(0x1cf)]}),_0x4b18fe=_0x154c5d['data'],_0x34187f=_0x4dd822[_0x5cf178(0x176)][_0x5cf178(0xe3)](_0x4b18fe);if(_0x25d5c8[_0x5cf178(0x19d)]){const _0x192d3b=await this[_0x5cf178(0x188)](_0x2dd58a,_0x11bec8,_0x4b18fe,_0x34187f),_0x9acc8b=this[_0x5cf178(0x1e9)](_0x192d3b);writeFileSync(_0x25d5c8[_0x5cf178(0x19d)],_0x9acc8b);const _0x5c46ae=_0x192d3b[_0x5cf178(0x1c3)][_0x5cf178(0x118)][_0x5cf178(0x10c)]+_0x192d3b[_0x5cf178(0x1b3)][_0x5cf178(0xc4)]((_0x59825a,_0x19a4fd)=>_0x59825a+_0x19a4fd['columns'][_0x5cf178(0x10c)],0x0),_0x34c3cf=_0x192d3b[_0x5cf178(0x1b3)][_0x5cf178(0x1d2)](_0x5a5054=>_0x5a5054[_0x5cf178(0x118)][_0x5cf178(0x10c)]===0x0)[_0x5cf178(0x10c)];return console[_0x5cf178(0x93)](_0x5cf178(0xa0)+_0x25d5c8[_0x5cf178(0x19d)]),console['log'](_0x5cf178(0xd9)+_0x34187f),console['log'](_0x5cf178(0x8a)+_0x192d3b[_0x5cf178(0x1b3)][_0x5cf178(0x10c)]+_0x5cf178(0x1a2)),console[_0x5cf178(0x93)](_0x5cf178(0x7a)+_0x5c46ae+'\x20total'),_0x34c3cf>0x0&&console[_0x5cf178(0x93)](_0x5cf178(0x1dc)+_0x34c3cf+_0x5cf178(0x72)),0x0;}console['error']('\x0a'+a30_0x530600['bold'](_0x5cf178(0x146))+'\x20'+a30_0x530600[_0x5cf178(0x1e7)](_0x34187f));const _0x45f193=await withSpinner(_0x5cf178(0x12d),()=>_0x4dd822[_0x5cf178(0x176)][_0x5cf178(0x17c)](_0x4b18fe),{'verbose':_0xa66b3a[_0x5cf178(0x1cf)]});console['error']('\x0a'+a30_0x530600[_0x5cf178(0x6d)](_0x5cf178(0x1c3))+'\x20'+a30_0x530600[_0x5cf178(0xb2)]('('+_0x34187f+_0x5cf178(0x13c)));const _0x3627fe=await executeSchemaQuery(_0x45f193[_0x5cf178(0x7b)],_0x4dd822,_0xa66b3a);await handleQueryOutput(_0x3627fe,_0xa66b3a);const _0x481f7f=await withSpinner(_0x5cf178(0xa5),()=>_0x4dd822[_0x5cf178(0x176)][_0x5cf178(0x99)](_0x4b18fe),{'verbose':_0xa66b3a[_0x5cf178(0x1cf)]});for(const _0x147282 of _0x481f7f[_0x5cf178(0x7b)]){const _0x1d33c5=_0x5cf178(0x1ca)+_0x147282[_0x5cf178(0x136)]()['replace'](/\s+/g,'_'),_0x57bee7=_0x5cf178(0x6f)+_0x34187f+'.'+_0x1d33c5;console[_0x5cf178(0x1a3)]('\x0a'+a30_0x530600['bold'](_0x147282)+'\x20'+a30_0x530600[_0x5cf178(0xb2)]('('+_0x34187f+'.'+_0x1d33c5+')'));try{const _0x124500=await executeSchemaQuery(_0x57bee7,_0x4dd822,_0xa66b3a);await handleQueryOutput(_0x124500,_0xa66b3a);}catch{console[_0x5cf178(0x1a3)](a30_0x530600[_0x5cf178(0xeb)](_0x5cf178(0xba)));}}return 0x0;}async['collectSchema'](_0x2a9a47,_0x5a7e8d,_0xb55571,_0x608724){const _0x59e752=a30_0x388647,{options:_0x211ffa,tdx:_0x177099}=_0x2a9a47,_0x363ca4=await withSpinner(_0x59e752(0x12d),()=>_0x177099[_0x59e752(0x176)][_0x59e752(0x17c)](_0xb55571),{'verbose':_0x211ffa[_0x59e752(0x1cf)]}),_0x3977a0=await executeSchemaQuery(_0x363ca4[_0x59e752(0x7b)],_0x177099,_0x211ffa),_0x2ab55d=_0x3977a0[_0x59e752(0x7b)]['map'](_0x5ded86=>({'name':_0x5ded86[_0x59e752(0x75)],'type':_0x5ded86[_0x59e752(0x156)]})),_0x5e5edb=await withSpinner(_0x59e752(0xa5),()=>_0x177099[_0x59e752(0x176)][_0x59e752(0x99)](_0xb55571),{'verbose':_0x211ffa[_0x59e752(0x1cf)]}),_0x2a7a2c=[];for(const _0x450feb of _0x5e5edb[_0x59e752(0x7b)]){const _0x426856='behavior_'+_0x450feb[_0x59e752(0x136)]()[_0x59e752(0x173)](/\s+/g,'_'),_0x5aaf8d='SELECT\x20*\x20FROM\x20'+_0x608724+'.'+_0x426856;let _0x3e4e98=[];try{const _0x18118f=await executeSchemaQuery(_0x5aaf8d,_0x177099,_0x211ffa);_0x3e4e98=_0x18118f[_0x59e752(0x7b)]['map'](_0x3f5032=>({'name':_0x3f5032[_0x59e752(0x75)],'type':_0x3f5032['column_type']}));}catch{}_0x2a7a2c[_0x59e752(0x19e)]({'table':_0x426856,'columns':_0x3e4e98});}return{'database':_0x608724,'parent_segment':_0x5a7e8d,'parent_id':_0xb55571,'customers':{'table':_0x59e752(0x1c3),'columns':_0x2ab55d},'behaviors':_0x2a7a2c};}[a30_0x388647(0x1e9)](_0x1a03ce){const _0x55ad87=a30_0x388647,_0x6c6859=_0x50b767=>{const _0x3e0b53=a30_0x4611;if(_0x50b767['length']===0x0)return'[]';const _0x5666d1=_0x50b767['map'](_0x48f8f3=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x48f8f3['name']+_0x3e0b53(0x9e)+_0x48f8f3[_0x3e0b53(0x182)]+_0x3e0b53(0x1fb));return'[\x0a'+_0x5666d1['join'](',\x0a')+_0x3e0b53(0x169);},_0x586754=_0x1a03ce[_0x55ad87(0x1b3)][_0x55ad87(0x16d)](_0x3190cd=>{const _0x230ce6=_0x55ad87;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x3190cd['table']+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x6c6859(_0x3190cd['columns'])[_0x230ce6(0x173)](/^/gm,'\x20\x20')[_0x230ce6(0x12f)]()+_0x230ce6(0x13a);})[_0x55ad87(0x8e)](',\x0a');return _0x55ad87(0xa8)+_0x1a03ce[_0x55ad87(0x110)]+_0x55ad87(0x74)+_0x1a03ce[_0x55ad87(0x174)]+_0x55ad87(0xb6)+_0x1a03ce[_0x55ad87(0x92)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x1a03ce[_0x55ad87(0x1c3)][_0x55ad87(0x1fd)]+_0x55ad87(0xf7)+_0x6c6859(_0x1a03ce[_0x55ad87(0x1c3)][_0x55ad87(0x118)])[_0x55ad87(0x173)](/^/gm,'\x20\x20')[_0x55ad87(0x12f)]()+_0x55ad87(0x98)+_0x586754+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x388647(0x154)]=a30_0x388647(0x16b);[a30_0x388647(0xec)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x509bcc){const _0x82bee=a30_0x388647,{options:_0x33dcf2,args:_0xccd6e1,tdx:_0x347ac3}=_0x509bcc,_0x2a4bb7=_0xccd6e1[0x0]||_0x33dcf2[_0x82bee(0x201)];if(!_0x2a4bb7)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'+_0x82bee(0x1cc)),0x1;_0x33dcf2[_0x82bee(0x1cf)]&&(console[_0x82bee(0x1a3)](_0x82bee(0xcf)+_0x33dcf2[_0x82bee(0x18f)]),console[_0x82bee(0x1a3)](_0x82bee(0x7e)+_0x2a4bb7));const _0x5c925a=await withSpinner(_0x82bee(0x1ad)+_0x2a4bb7+'\x27...',()=>_0x347ac3[_0x82bee(0x176)][_0x82bee(0xaf)](_0x2a4bb7),{'verbose':_0x33dcf2[_0x82bee(0x1cf)]}),_0x219d6c=_0x5c925a['data'],_0x1d80c8=await withSpinner(_0x82bee(0x1e8)+_0x2a4bb7+_0x82bee(0x120),()=>_0x347ac3['segment'][_0x82bee(0x17c)](_0x219d6c),{'verbose':_0x33dcf2[_0x82bee(0x1cf)]}),_0x1f4009=_0x1d80c8[_0x82bee(0x7b)];return _0x33dcf2['format']===_0x82bee(0xf9)||_0x33dcf2[_0x82bee(0x1e3)]===_0x82bee(0x1b0)?await handleSDKOutput([{'sql':_0x1f4009}],_0x33dcf2):console[_0x82bee(0x93)](_0x1f4009),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x388647(0x154)]='segment:parent:show';[a30_0x388647(0xec)]=a30_0x388647(0xb0);async[a30_0x388647(0x77)](_0x3f489c){const _0x3bc0fa=a30_0x388647,{options:_0x49008e,args:_0x300d40,tdx:_0x193127}=_0x3f489c,_0x47a092=_0x300d40[0x0]||_0x49008e[_0x3bc0fa(0x201)];if(!_0x47a092)return showParentSegmentNotSetError(_0x3bc0fa(0x70)+_0x3bc0fa(0x1cd)),0x1;_0x49008e[_0x3bc0fa(0x1cf)]&&(console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0xcf)+_0x49008e[_0x3bc0fa(0x18f)]),console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0x7e)+_0x47a092));const _0x21c369=await withSpinner(_0x3bc0fa(0x1ad)+_0x47a092+_0x3bc0fa(0x120),()=>_0x193127[_0x3bc0fa(0x176)][_0x3bc0fa(0xaf)](_0x47a092),{'verbose':_0x49008e[_0x3bc0fa(0x1cf)]}),_0x2f6d6c=_0x21c369[_0x3bc0fa(0x7b)],_0x217d34=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x47a092+_0x3bc0fa(0x120),()=>_0x193127['segment'][_0x3bc0fa(0x17c)](_0x2f6d6c),{'verbose':_0x49008e[_0x3bc0fa(0x1cf)]});let _0x4c3cf8=_0x217d34[_0x3bc0fa(0x7b)];const _0x175fe1=resolveLimit(_0x49008e[_0x3bc0fa(0x16f)],DEFAULT_DISPLAY_LIMIT),_0x992b26=/\bLIMIT\s+\d+/i['test'](_0x4c3cf8);!_0x992b26&&(_0x4c3cf8=_0x4c3cf8[_0x3bc0fa(0x12f)]()[_0x3bc0fa(0x173)](/;+$/,''),_0x4c3cf8='SELECT\x20*\x20FROM\x20(\x0a'+_0x4c3cf8+_0x3bc0fa(0xd3)+_0x175fe1);_0x49008e['verbose']&&console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0x185)+_0x4c3cf8);const _0x93a4ce=await withProgressSpinner(_0x3bc0fa(0x97),async _0xc3987=>{const _0x53e985=_0x3bc0fa,_0x44dce2=await _0x193127[_0x53e985(0x145)][_0x53e985(0x77)](_0x4c3cf8,{'catalog':'td','schema':'information_schema','onJobId':_0x3953b9=>{_0xc3987['setJobId'](_0x3953b9);}});return _0x44dce2;},{'verbose':_0x49008e[_0x3bc0fa(0x1cf)]}),_0x3f6830=_0x93a4ce[_0x3bc0fa(0x7b)],_0x486e60=_0x3f6830[_0x3bc0fa(0x1eb)]?'\x20[Job\x20ID:\x20'+_0x3f6830[_0x3bc0fa(0x1eb)]+']':'';return console[_0x3bc0fa(0x1a3)](_0x3bc0fa(0x1e5)+_0x3f6830['stats'][_0x3bc0fa(0x122)][_0x3bc0fa(0x115)]()+_0x3bc0fa(0x1d5)+(_0x3bc0fa(0x1c6)+formatElapsed(_0x3f6830['stats'][_0x3bc0fa(0x91)])+_0x486e60)),await handleQueryOutput(_0x3f6830,_0x49008e),0x0;}}export class PSRtListCommand extends BaseCommand{['name']=a30_0x388647(0x168);[a30_0x388647(0xec)]=a30_0x388647(0x149);async[a30_0x388647(0x77)](_0xb5c659){const _0x55fc51=a30_0x388647,{options:_0x3df367,args:_0x6d6a6c,tdx:_0x2d08a2}=_0xb5c659,_0x9dec75=_0x6d6a6c[0x0],_0x59a8b2=await withSpinner(_0x9dec75?_0x55fc51(0x1dd)+_0x9dec75+_0x55fc51(0x120):_0x55fc51(0x187),()=>_0x2d08a2[_0x55fc51(0x6e)][_0x55fc51(0x76)](),{'verbose':_0x3df367[_0x55fc51(0x1cf)]});let _0x20ae3a=_0x59a8b2[_0x55fc51(0x7b)][_0x55fc51(0x1d2)](_0x359c1c=>_0x359c1c[_0x55fc51(0x166)]);if(_0x9dec75){const _0x12eb88=_0x9dec75['replace'](/[.+^${}()|[\]\\]/g,_0x55fc51(0x102))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x27d89a=new RegExp('^'+_0x12eb88+'$','i');_0x20ae3a=_0x20ae3a[_0x55fc51(0x1d2)](_0x1707d1=>_0x27d89a['test'](_0x1707d1[_0x55fc51(0x154)]));}_0x20ae3a[_0x55fc51(0x1c1)]((_0x36bb89,_0x38118d)=>_0x36bb89['name'][_0x55fc51(0x71)](_0x38118d[_0x55fc51(0x154)])),console[_0x55fc51(0x1a3)]('✔\x20Found\x20'+_0x20ae3a[_0x55fc51(0x10c)]+_0x55fc51(0xe2)+(_0x20ae3a['length']!==0x1?'s':''));const _0xc53703=_0x46e92a=>{const _0x18bdb4=_0x55fc51;return getConsoleNextUrl(_0x3df367[_0x18bdb4(0x18f)],_0x18bdb4(0x90)+_0x46e92a);};if(_0x3df367[_0x55fc51(0x1e3)]===_0x55fc51(0xf9)||_0x3df367[_0x55fc51(0x1e3)]===_0x55fc51(0x1b0)){const _0x222541=_0x20ae3a[_0x55fc51(0x16d)](_0x3fe9db=>({..._0x3fe9db,'url':_0xc53703(_0x3fe9db['id'])}));await handleSDKOutput(_0x222541,_0x3df367);}else{if(_0x20ae3a['length']===0x0)console[_0x55fc51(0x93)](_0x55fc51(0x11f));else for(const _0x5e5217 of _0x20ae3a){const _0x27438a=_0x5e5217[_0x55fc51(0x1f8)]?a30_0x530600['dim']('\x20('+formatRows(_0x5e5217[_0x55fc51(0x1f8)])+')'):'',_0x143dab=hyperlink(_0x5e5217['name'],_0xc53703(_0x5e5217['id']));console[_0x55fc51(0x93)]('⚡\x20'+_0x143dab+_0x27438a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x388647(0x154)]=a30_0x388647(0x1b8);[a30_0x388647(0xec)]=a30_0x388647(0x184);async[a30_0x388647(0x77)](_0x4575e1){const _0x24114a=a30_0x388647,{options:_0x33277f,args:_0x35667d,tdx:_0x399fcd}=_0x4575e1,_0x71128=_0x35667d[0x0]||_0x33277f[_0x24114a(0x201)];if(!_0x71128)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a'+_0x24114a(0xdc)),0x1;const _0x35da57=resolveYamlFile(_0x71128);if(!existsSync(_0x35da57))return showFileNotFoundError(_0x35da57,_0x71128),0x1;let _0x18b385;try{_0x18b385=readFileSync(_0x35da57,'utf-8');}catch(_0x2a2fee){const _0x1077ca=_0x2a2fee instanceof Error?_0x2a2fee[_0x24114a(0x1c9)]:String(_0x2a2fee);return console[_0x24114a(0x1a3)](_0x24114a(0x1c7)+_0x1077ca),0x1;}const _0x49c73=createCommandSpinner(a30_0x530600[_0x24114a(0xb2)](_0x24114a(0x143)),{'verbose':_0x33277f['verbose']});_0x49c73[_0x24114a(0xa2)]();const _0x36e8aa={'realtime':!![],'onProgress':_0x4c60cc=>{_0x49c73['text']=formatProgressMessage(_0x4c60cc);}};let _0x268e4f;try{_0x268e4f=await _0x399fcd[_0x24114a(0x176)]['validateParentYaml'](_0x18b385,_0x36e8aa),_0x49c73['stop']();}catch(_0x59c1ba){_0x49c73[_0x24114a(0x1d0)]();throw _0x59c1ba;}console['error']('\x0a'+a30_0x530600[_0x24114a(0x6d)](_0x24114a(0x139))+'\x20'+_0x268e4f[_0x24114a(0x154)]),console[_0x24114a(0x1a3)]('═'[_0x24114a(0x140)](0x3c)),displayRealtimeValidation(_0x268e4f),console[_0x24114a(0x1a3)]('─'['repeat'](0x3c));if(_0x268e4f[_0x24114a(0x14c)][_0x24114a(0x10c)]>0x0){console[_0x24114a(0x1a3)]('\x0a'+a30_0x530600['red'](_0x24114a(0x1f0)));for(const _0x587730 of _0x268e4f[_0x24114a(0x14c)]){console[_0x24114a(0x1a3)]('\x20\x20'+a30_0x530600['red']('•')+'\x20'+_0x587730);}}return _0x268e4f[_0x24114a(0xd4)]&&console['error']('\x0a'+a30_0x530600[_0x24114a(0x1f1)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x268e4f[_0x24114a(0xd4)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']='ps:pz:list';['description']='List\x20personalization\x20services\x20for\x20a\x20parent\x20segment';async['execute'](_0x3191b7){const _0x4c4594=a30_0x388647,{options:_0x3e291d,args:_0x977a8d,tdx:_0xb7eae1}=_0x3191b7,_0x285fea=_0x977a8d[0x0]||_0x3e291d['parentSegment'];if(!_0x285fea)return showParentSegmentNotSetError(_0x4c4594(0x17e)+_0x4c4594(0x180)),0x1;const _0x4bb02b=await withSpinner(_0x4c4594(0x1ad)+_0x285fea+_0x4c4594(0x120),()=>_0xb7eae1[_0x4c4594(0x176)][_0x4c4594(0xaf)](_0x285fea),{'verbose':_0x3e291d[_0x4c4594(0x1cf)]}),_0x36d27d=_0x4bb02b[_0x4c4594(0x7b)],_0x30ef87=await withSpinner(_0x4c4594(0x151)+_0x285fea+_0x4c4594(0x120),()=>_0xb7eae1[_0x4c4594(0x11d)][_0x4c4594(0x76)](_0x36d27d),{'verbose':_0x3e291d['verbose']}),_0x4a63a4=_0x30ef87[_0x4c4594(0x7b)];console[_0x4c4594(0x1a3)]('✔\x20Found\x20'+_0x4a63a4[_0x4c4594(0x10c)]+_0x4c4594(0x73)+(_0x4a63a4[_0x4c4594(0x10c)]!==0x1?'s':''));if(_0x3e291d['format']==='json'||_0x3e291d[_0x4c4594(0x1e3)]===_0x4c4594(0x1b0))await handleSDKOutput(_0x4a63a4,_0x3e291d);else{if(_0x4a63a4[_0x4c4594(0x10c)]===0x0)console[_0x4c4594(0x93)](_0x4c4594(0x1fc)),console[_0x4c4594(0x1a3)](a30_0x530600['cyan'](_0x4c4594(0xbb)));else for(const _0x6c959f of _0x4a63a4){const _0x1d7ac8=_0x6c959f[_0x4c4594(0x106)]?.[_0x4c4594(0x10c)]||0x0,_0x2cecc8=_0x6c959f[_0x4c4594(0x9c)]?a30_0x530600[_0x4c4594(0xb2)]('\x20trigger='+_0x6c959f[_0x4c4594(0x9c)]):'',_0x333c6b=a30_0x530600[_0x4c4594(0xb2)]('\x20('+_0x1d7ac8+_0x4c4594(0xb3)+(_0x1d7ac8!==0x1?'s':'')+')');console[_0x4c4594(0x93)]('\x20\x20'+_0x6c959f[_0x4c4594(0x154)]+_0x2cecc8+_0x333c6b),_0x6c959f['description']&&console[_0x4c4594(0x93)](_0x4c4594(0x181)+a30_0x530600[_0x4c4594(0xb2)](_0x6c959f[_0x4c4594(0xec)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x388647(0x12b);[a30_0x388647(0xec)]=a30_0x388647(0x144);async[a30_0x388647(0x77)](_0x396355){const _0x1f766e=a30_0x388647,{options:_0x2255dd,args:_0xa5a2d}=_0x396355,_0x4a3177=_0xa5a2d[0x0]||_0x2255dd[_0x1f766e(0x201)];if(!_0x4a3177)return showParentSegmentNotSetError(_0x1f766e(0x81)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x266d7d=resolveYamlFile(_0x4a3177);if(!existsSync(_0x266d7d))return showFileNotFoundError(_0x266d7d,_0x4a3177),0x1;let _0xfa92b7;try{_0xfa92b7=readFileSync(_0x266d7d,_0x1f766e(0x1f4));}catch(_0x5b186f){const _0x419a29=_0x5b186f instanceof Error?_0x5b186f['message']:String(_0x5b186f);return console['error'](_0x1f766e(0x1c7)+_0x419a29),0x1;}let _0x253a9c;try{_0x253a9c=parseDef(_0xfa92b7);}catch(_0xccdb14){const _0x19d924=_0xccdb14 instanceof Error?_0xccdb14[_0x1f766e(0x1c9)]:String(_0xccdb14);return console[_0x1f766e(0x1a3)](a30_0x530600[_0x1f766e(0xd1)](_0x1f766e(0x111)+_0x19d924)),0x1;}if(_0x253a9c[_0x1f766e(0x1d8)]&&_0x253a9c['personalization_services'][_0x1f766e(0x10c)]>0x0)return console['error'](a30_0x530600[_0x1f766e(0xeb)]('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x266d7d)),console[_0x1f766e(0x1a3)](a30_0x530600[_0x1f766e(0xb2)](_0x1f766e(0xe4)+_0x253a9c[_0x1f766e(0x1d8)][_0x1f766e(0x10c)]+_0x1f766e(0xb4))),0x1;!_0x253a9c[_0x1f766e(0x6e)]&&(_0x253a9c[_0x1f766e(0x6e)]={'events':[{'name':'page_view','source_table':_0x1f766e(0xdf)}],'attributes':[{'name':_0x1f766e(0x1ce),'type':'single'}],'id_stitching':{'primary_key':_0x253a9c[_0x1f766e(0x1fa)][_0x1f766e(0x1fd)]===_0x1f766e(0x1c3)?_0x1f766e(0x1f2):_0x1f766e(0x18b)}});_0x253a9c['personalization_services']=[{'name':_0x1f766e(0x1c0),'description':_0x1f766e(0x133),'trigger_event':_0x1f766e(0x12e),'sections':[{'name':_0x1f766e(0x189),'criteria':_0x1f766e(0x137),'attributes':[_0x1f766e(0x1ce)]}]}];const _0x495a0a=serializeDef(_0x253a9c);return writeFileSync(_0x266d7d,_0x495a0a,_0x1f766e(0x1f4)),console[_0x1f766e(0x1a3)](a30_0x530600[_0x1f766e(0x1f1)]('✔')+_0x1f766e(0x10e)+a30_0x530600[_0x1f766e(0x1e7)](_0x266d7d)),(!_0x253a9c['realtime']||_0xfa92b7[_0x1f766e(0x1b4)](_0x1f766e(0xf3))===-0x1)&&console['error'](a30_0x530600[_0x1f766e(0x1f1)]('✔')+_0x1f766e(0x191)),console[_0x1f766e(0x1a3)]('\x0a'+a30_0x530600[_0x1f766e(0xb2)](_0x1f766e(0x1a9))),console[_0x1f766e(0x1a3)](_0x1f766e(0x1b5)+_0x266d7d+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x1f766e(0x1a3)](_0x1f766e(0x15e)+a30_0x530600[_0x1f766e(0xb2)](_0x1f766e(0x1f5)+_0x4a3177)+_0x1f766e(0x138)),0x0;}}
1
+ const a30_0x18fecb=a30_0xee43;(function(_0x32c534,_0x21151c){const _0x23584b=a30_0xee43,_0x53a52d=_0x32c534();while(!![]){try{const _0x399fc2=-parseInt(_0x23584b(0x288))/0x1*(-parseInt(_0x23584b(0x1ed))/0x2)+parseInt(_0x23584b(0x1b0))/0x3+parseInt(_0x23584b(0x17a))/0x4*(-parseInt(_0x23584b(0x23e))/0x5)+parseInt(_0x23584b(0x1bc))/0x6+-parseInt(_0x23584b(0x2a5))/0x7+parseInt(_0x23584b(0x1ff))/0x8*(parseInt(_0x23584b(0x235))/0x9)+parseInt(_0x23584b(0x240))/0xa*(parseInt(_0x23584b(0x256))/0xb);if(_0x399fc2===_0x21151c)break;else _0x53a52d['push'](_0x53a52d['shift']());}catch(_0x5728af){_0x53a52d['push'](_0x53a52d['shift']());}}}(a30_0x1ec4,0x618f9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a30_0x16185b 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,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a30_0x2ae559 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=a30_0x18fecb(0x26e),LEGACY_PARENT_SEGMENT_DIR=a30_0x18fecb(0x13b);function openBrowser(_0x171e6e){const _0x5b8b8d=a30_0x18fecb,_0x4dcac4=process[_0x5b8b8d(0x21c)],_0x59a900=_0x4dcac4===_0x5b8b8d(0x239)?_0x5b8b8d(0x246):_0x4dcac4===_0x5b8b8d(0x1a8)?_0x5b8b8d(0x17c):_0x5b8b8d(0x27c);spawn(_0x59a900,[_0x171e6e],{'detached':!![],'stdio':'ignore'})[_0x5b8b8d(0x14e)]();}function migrateLegacyDirectory(){const _0x1f8f6a=a30_0x18fecb;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x585fe1=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x585fe1[_0x1f8f6a(0x1c4)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x1bd)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x1f8f6a(0x1d0)+PARENT_SEGMENT_DIR+_0x1f8f6a(0x1f9))),console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x2c4)](_0x1f8f6a(0x165)+LEGACY_PARENT_SEGMENT_DIR+_0x1f8f6a(0x150))),![];console['error'](a30_0x2ae559['yellow'](_0x1f8f6a(0x286)+LEGACY_PARENT_SEGMENT_DIR+_0x1f8f6a(0x29e)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x297)](_0x1f8f6a(0x1e9)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x506f71){const _0x577b3c=_0x506f71 instanceof Error?_0x506f71[_0x1f8f6a(0x1c5)]:String(_0x506f71);return console[_0x1f8f6a(0x1f6)](a30_0x2ae559[_0x1f8f6a(0x20d)](_0x1f8f6a(0x151)+_0x577b3c+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x48e114){const _0x29aa05=a30_0x18fecb;return migrateLegacyDirectory(),super[_0x29aa05(0x28e)](_0x48e114);}}function a30_0x1ec4(){const _0x174987=['To\x20cancel:','td_client_id','ps:pz:list','\x20--behavior\x20\x22','\x0a\x20\x20]\x0a}\x0a','open','displayPreviewHints','behavior_','\x20Configuration\x20is\x20valid','segment:parent:desc','\x0a\x20\x20\x20\x20}','segment:parent:pull','Analyzing\x20changes...','Available\x20behaviors:','getParentSQL','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','timezone','No\x20RT-enabled\x20parent\x20segments\x20found','number','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x27\x20is\x20already\x20up\x20to\x20date','3278zDyJrr','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','filter','Enriched:','data','displayValidateResults','customers','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','\x20kill','workflowAttemptId','RT\x202.0\x20Validate:','Found\x20YAML\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','✔\x20Created\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','`\x20to\x20download\x20the\x20configuration\x20first','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','Fetching\x20behavior\x20list...','/{name}.yml\x0a','reduce','attributes','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','setJobId','\x0a✔\x20Workflow\x20started','parent_segments','\x27\x20and\x20run\x20workflow?','query','My\x20Service','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Listing\x20parent\x20segments...','column_name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','Output\x20file:\x20','limit','keys','Validating\x20configuration...','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','execute','xdg-open','log','list','interval','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','name','Events:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','Apply\x20changes\x20to\x20\x27','{\x0a\x20\x20\x22database\x22:\x20\x22','\x0a⚠️\x20\x20Migrating:\x20','/app/dw/parentSegments/','151078MShNyO','workflowSessionId','Error\x20parsing\x20YAML:\x20','preview','match','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','run','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','\x20--behavior\x20\x22<name>\x22','\x20to\x20configure\x20your\x20personalization\x20service','Name:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','To\x20view\x20sample\x20data:','\x20behaviors','\x0a\x20\x20\x20\x20]','green','stitchingKeys','/sessions/','Error:\x20File\x20not\x20found:\x20','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','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\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/\x20→\x20','format','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','map','displayPreviewResults','\x27...','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','4223632ZCIvXG','information_schema','segment:parent:validate','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','json','Validate:','SELECT\x20*\x20FROM\x20','single','.yaml','\x20Added\x20RT\x202.0\x20template\x20section','join','description','table','👥\x20','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','workflowId','customerPercent','Options\x20(one\x20required):\x0a','push','use','Creating\x20parent\x20segment\x20\x27','stats','using\x20the\x20default\x20path:\x20','Attempt:','Executing\x20parent\x20segment\x20query...','\x0aChanges\x20to\x20\x27','stop','previewParentYaml','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','type','dim','SQL\x20query:\x0a','Options:\x0a','-1d','\x20\x201.\x20Edit\x20','column','segment:parent:push','getParentFull','output','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','pullParentYaml','No\x20parent\x20segments\x20match\x20pattern:\x20','parent_segment','Attributes','\x20to\x20push\x20the\x20configuration','Behaviors','\x20\x20Tables:\x201\x20customers\x20+\x20','attribute','events','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x20No\x20changes\x20-\x20','customerGroup','ps:pz:init','utf-8','getOutputDatabaseName','column_type','master','replace','behavior','errors','\x0aNew\x20parent\x20segment\x20\x27','unref','user_id','/\x20directory.\x0a','✘\x20Failed\x20to\x20rename\x20directory:\x20','label','Updated','Errors:','addAttributes','\x20tdx\x20wf\x20attempt\x20','getBehaviorNames','formatSchemaJson','repeat','YAML\x20file:\x20','Schema\x20saved\x20to\x20','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','displayBehaviorsStats','validateParentYaml','\x20trigger=','endsWith','segment:parent:run','displaySampleData','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','addBehaviorsFile','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Create\x20parent\x20segment\x20\x27','foreignKey','customerGroupFile','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','matchedCount','\x20\x20\x20\x20','localeCompare','Status:','enriched','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','sort','collectSchema','trim','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x20is\x20already\x20up\x20to\x20date','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','apply','site','realtime_enabled','Attributes:','556IBaDLN','behaviors','start','Master\x20Table','Fetching\x20customers\x20schema...','FINISHED','displayColumns','true','segment:parent:update','No\x20parent\x20segments\x20found','toLowerCase','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','\x20parent\x20segment','✔\x20Found\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','<database>.<table>','attributesFile','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','realtime','\x20rows)','\x20\x20\x20\x20-\x20','Updating','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','rowCount','database','Database:\x20','text','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x0aNo\x20sample\x20data\x20available','length','yes','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','string','\x20\x202.\x20Run\x20','segment','Source:','displayAttributesStats','\x20total','trigger_event','\x5c$&','listParents','jsonl','Available\x20attributes:','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','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','elapsedTimeMillis','win32','Columns:','Fetching\x20parent\x20segment\x20\x27','varchar','audienceId','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','scheduleOption','487617OMvBVi','Creating','coveragePercent','\x20personalization\x20service','Error:\x20--attribute\x20requires\x20a\x20name\x0a','personalization_services','tdx\x20ps\x20preview\x20','Fetching\x20sample\x20data...','Options:','Show\x20parent\x20segment\x20details','jobId','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','1238580PAyfKb','yellow','Rows:','Created','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','behaviorsFile','Listing\x20parent\x20segments\x20matching\x20\x27','addAttributesFile','isDirectory','message','\x20--enriched','dirname','Listing\x20RT-enabled\x20parent\x20segments...','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Session:','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Next\x20steps:','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','/\x20and\x20','customersWithEvents','sourceTableError','Master:','\x20--attribute\x20\x22<name>\x22','verbose','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Site:\x20','cyan','web','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','displaySummary','all','session','displayRealtimeInfo','sourceTableValid','\x27\x20with\x20ID:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','ps:rt:list','createParent','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','pushParentYaml','%)\x20','✔\x20Renamed\x20directory\x20to\x20','allValid','scheduleType','schemaError','2lGAbru','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','addBehaviors','/attempt/','✔\x20No\x20changes\x20-\x20\x27','\x0aChanges\x20to\x20apply\x20to\x20\x27','sampleData','Aborted.','\x20=\x20','error','\x20rows\x20','Parent\x20segment:\x20','/\x20directories\x20exist.','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','/app/workflows/','\x20Added\x20personalization\x20template\x20to\x20','Updating\x20parent\x20segment\x20\x27','columns','459880HJszeB','idStitching','Overwrite\x20\x27','Attribute:','Error\x20reading\x20file:\x20','\x20--attribute\x20\x22','\x20\x20No\x20sample\x20data\x20available','segment:parent:create','Join\x20on:','joinKey','displayMasterInfo','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x0aError:','Fetching\x20SQL\x20for\x20\x27','red','Default','Customers:','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','personalizationServices','segment:parent:show','\x20\x20Note:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','\x20\x20\x20\x20\x20\x20','parentSegment','test','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','last_page_viewed','resolveParentId','\x20RT-enabled\x20parent\x20segment','platform','\x20RT\x20configuration\x20is\x20valid','segment:parent:view','Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a','page_view','schemaValid','Resolving\x20parent\x20segment\x20\x27','Listing\x20fields\x20for\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','Preview:','\x20\x20Database:\x20','realtime:','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','\x20parent\x20segment\x20\x27','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','toLocaleString','⚡\x20Enabled','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','totalEvents','processedRows','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','toFixed','\x20configured','\x20--interval\x20','27erDgJk','.yml','Error:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','darwin','\x20Context\x20set:\x20','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','bold','Master\x20+\x20Attributes','21365GDpEZb','Join:','30350twluFN'];a30_0x1ec4=function(){return _0x174987;};return a30_0x1ec4();}function resolveYamlFile(_0x6fd40d){const _0x1e2e54=a30_0x18fecb;if(_0x6fd40d[_0x1e2e54(0x160)](_0x1e2e54(0x236))||_0x6fd40d[_0x1e2e54(0x160)](_0x1e2e54(0x2ae)))return _0x6fd40d;return a30_0x16185b[_0x1e2e54(0x2b0)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x6fd40d)+_0x1e2e54(0x236));}function formatProgressMessage(_0x120668){const _0x2f05bc=a30_0x18fecb,_0x514aa8=_0x120668[_0x2f05bc(0x28c)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x514aa8){const [,_0x23ebad,_0x40fc20,_0x1789c6='']=_0x514aa8;return a30_0x2ae559[_0x2f05bc(0x2c4)](_0x23ebad+':')+'\x20'+_0x40fc20+a30_0x2ae559[_0x2f05bc(0x2c4)](_0x1789c6);}return a30_0x2ae559[_0x2f05bc(0x2c4)](_0x120668);}function showFileNotFoundError(_0x236ffb,_0x58a3dd){const _0x40891a=a30_0x18fecb;console[_0x40891a(0x1f6)](a30_0x2ae559[_0x40891a(0x20d)](_0x40891a(0x29a)+_0x236ffb+'\x0a')),console['error'](a30_0x2ae559[_0x40891a(0x1da)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x58a3dd+_0x40891a(0x265)));}function displayRealtimeValidation(_0x43674e){const _0x4b6d59=a30_0x18fecb;if(!_0x43674e[_0x4b6d59(0x18c)])return;const _0x41755d=_0x43674e['realtime'],_0x22a55b=_0x41755d['enabled']?a30_0x2ae559[_0x4b6d59(0x297)](_0x4b6d59(0x22d)):a30_0x2ae559[_0x4b6d59(0x1bd)]('⚡\x20Not\x20enabled');console[_0x4b6d59(0x1f6)]('\x0a'+a30_0x2ae559[_0x4b6d59(0x2c4)]('RT\x202.0:')+'\x20'+_0x22a55b);if(_0x41755d['events']&&_0x41755d['events'][_0x4b6d59(0x197)]>0x0){console[_0x4b6d59(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4b6d59(0x2c4)](_0x4b6d59(0x282))+'\x20'+_0x41755d[_0x4b6d59(0x141)][_0x4b6d59(0x197)]+_0x4b6d59(0x233));for(const _0x551051 of _0x41755d[_0x4b6d59(0x141)]){const _0x34fccd=_0x551051[_0x4b6d59(0x1e1)]===![]?a30_0x2ae559[_0x4b6d59(0x20d)]('✘'):a30_0x2ae559[_0x4b6d59(0x297)]('✔');console[_0x4b6d59(0x1f6)](_0x4b6d59(0x16b)+_0x34fccd+'\x20'+_0x551051[_0x4b6d59(0x281)]),_0x551051['sourceTableError']&&console[_0x4b6d59(0x1f6)](_0x4b6d59(0x215)+a30_0x2ae559[_0x4b6d59(0x20d)](_0x551051[_0x4b6d59(0x1d2)]));}}if(_0x41755d[_0x4b6d59(0x26a)]&&_0x41755d[_0x4b6d59(0x26a)][_0x4b6d59(0x197)]>0x0){console[_0x4b6d59(0x1f6)]('\x20\x20'+a30_0x2ae559['dim'](_0x4b6d59(0x179))+'\x20'+_0x41755d['attributes'][_0x4b6d59(0x197)]+_0x4b6d59(0x233));for(const _0x20e5d7 of _0x41755d[_0x4b6d59(0x26a)]){const _0x5d6df2=_0x20e5d7['valid']?a30_0x2ae559[_0x4b6d59(0x297)]('✔'):a30_0x2ae559['red']('✘');console[_0x4b6d59(0x1f6)](_0x4b6d59(0x16b)+_0x5d6df2+'\x20'+_0x20e5d7['name']+'\x20'+a30_0x2ae559['dim']('('+_0x20e5d7[_0x4b6d59(0x2c3)]+')'));}}if(_0x41755d['idStitching']){const _0x529143=_0x41755d[_0x4b6d59(0x200)][_0x4b6d59(0x298)]?.[_0x4b6d59(0x197)]?'\x20+\x20['+_0x41755d['idStitching'][_0x4b6d59(0x298)]['join'](',\x20')+']':'';console['error']('\x20\x20'+a30_0x2ae559[_0x4b6d59(0x2c4)]('ID\x20Stitching:')+'\x20'+_0x41755d[_0x4b6d59(0x200)]['primaryKey']+_0x529143);}if(_0x41755d[_0x4b6d59(0x211)]&&_0x41755d['personalizationServices'][_0x4b6d59(0x197)]>0x0){console[_0x4b6d59(0x1f6)]('\x20\x20'+a30_0x2ae559['dim']('Personalization:')+'\x20'+_0x41755d[_0x4b6d59(0x211)]['length']+'\x20service'+(_0x41755d[_0x4b6d59(0x211)][_0x4b6d59(0x197)]!==0x1?'s':''));for(const _0x2bf66b of _0x41755d[_0x4b6d59(0x211)]){console[_0x4b6d59(0x1f6)](_0x4b6d59(0x18e)+_0x2bf66b['name']);}}}function showParentSegmentNotSetError(_0x3b09e2){const _0x557032=a30_0x18fecb;console[_0x557032(0x1f6)](a30_0x2ae559[_0x557032(0x1bd)](_0x557032(0x238))),console['error'](_0x3b09e2);}export class ParentSegmentListCommand extends BaseCommand{[a30_0x18fecb(0x281)]='segment:parent:list';[a30_0x18fecb(0x2b1)]='List\x20parent\x20segments';async[a30_0x18fecb(0x27b)](_0x37c802){const _0x2f6edf=a30_0x18fecb,{options:_0x5124c7,args:_0x362acf,tdx:_0x4be21a}=_0x37c802,_0x66e38d=_0x362acf[0x0];_0x5124c7[_0x2f6edf(0x1d5)]&&(console[_0x2f6edf(0x1f6)]('Site:\x20'+_0x5124c7[_0x2f6edf(0x177)]),_0x66e38d&&console[_0x2f6edf(0x1f6)]('Pattern:\x20'+_0x66e38d));const _0x298cf3=await withSpinner(_0x66e38d?_0x2f6edf(0x1c2)+_0x66e38d+'\x27...':_0x2f6edf(0x273),()=>_0x4be21a['segment'][_0x2f6edf(0x1a2)](),{'verbose':_0x5124c7[_0x2f6edf(0x1d5)]});let _0x307a6f=_0x298cf3[_0x2f6edf(0x25a)];if(_0x66e38d){const _0x293c88=_0x66e38d['replace'](/[.+^${}()|[\]\\]/g,_0x2f6edf(0x1a1))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x58a862=new RegExp('^'+_0x293c88+'$','i');_0x307a6f=_0x307a6f['filter'](_0x40d59f=>_0x58a862[_0x2f6edf(0x217)](_0x40d59f[_0x2f6edf(0x26a)][_0x2f6edf(0x281)]));}_0x307a6f[_0x2f6edf(0x170)]((_0x4ed63b,_0x3acfbf)=>_0x4ed63b['attributes'][_0x2f6edf(0x281)][_0x2f6edf(0x16c)](_0x3acfbf[_0x2f6edf(0x26a)][_0x2f6edf(0x281)])),console['error'](_0x2f6edf(0x187)+_0x307a6f[_0x2f6edf(0x197)]+_0x2f6edf(0x186)+(_0x307a6f[_0x2f6edf(0x197)]!==0x1?'s':''));const _0x71453c=_0x5dbb4d=>{const _0x5ec683=_0x2f6edf;return getConsoleNextUrl(_0x5124c7[_0x5ec683(0x177)],_0x5ec683(0x287)+_0x5dbb4d);};if(_0x5124c7['format']===_0x2f6edf(0x2aa)||_0x5124c7[_0x2f6edf(0x29f)]===_0x2f6edf(0x1a3)){const _0x3d1876=_0x307a6f[_0x2f6edf(0x2a1)](_0x354278=>({..._0x354278,'url':_0x71453c(_0x354278['id'])}));await handleSDKOutput(_0x3d1876,_0x5124c7);}else{if(_0x307a6f[_0x2f6edf(0x197)]===0x0)_0x66e38d?console[_0x2f6edf(0x27d)](_0x2f6edf(0x13a)+_0x66e38d):console['log'](_0x2f6edf(0x183));else for(const _0x4ff840 of _0x307a6f){const _0x4ecf8d=_0x4ff840[_0x2f6edf(0x26a)]['population']?a30_0x2ae559[_0x2f6edf(0x2c4)]('\x20('+formatRows(_0x4ff840[_0x2f6edf(0x26a)]['population'])+')'):'',_0x2b761a=hyperlink(_0x4ff840[_0x2f6edf(0x26a)][_0x2f6edf(0x281)],_0x71453c(_0x4ff840['id']));console[_0x2f6edf(0x27d)](_0x2f6edf(0x2b3)+_0x2b761a+_0x4ecf8d);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x206);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1cd);async['execute'](_0x53d4ba){const _0x38fcf2=a30_0x18fecb,{options:_0x1438b6,args:_0x5a165f,tdx:_0x336531}=_0x53d4ba;console[_0x38fcf2(0x1f6)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a'+_0x38fcf2(0x138)+_0x38fcf2(0x29d));const _0x593ca4=_0x1438b6;if(_0x5a165f[_0x38fcf2(0x197)]===0x0)return console[_0x38fcf2(0x1f6)](a30_0x2ae559[_0x38fcf2(0x20d)](_0x38fcf2(0x225))),console['error'](_0x38fcf2(0x190)),0x1;const _0x1b2030=_0x5a165f[0x0];if(!_0x593ca4[_0x38fcf2(0x192)]||!_0x593ca4[_0x38fcf2(0x2b2)])return console[_0x38fcf2(0x1f6)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x38fcf2(0x1f6)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x593ca4['verbose']&&(console['error'](_0x38fcf2(0x1d9)+_0x593ca4[_0x38fcf2(0x177)]),console[_0x38fcf2(0x1f6)](_0x38fcf2(0x292)+_0x1b2030),console[_0x38fcf2(0x1f6)](_0x38fcf2(0x193)+_0x593ca4[_0x38fcf2(0x192)]),console['error']('Table:\x20'+_0x593ca4[_0x38fcf2(0x2b2)]));const _0x446a98=await loadJSONFromOptions(_0x593ca4[_0x38fcf2(0x26a)],_0x593ca4[_0x38fcf2(0x18a)]),_0x488eef=await loadJSONFromOptions(_0x593ca4[_0x38fcf2(0x17b)],_0x593ca4[_0x38fcf2(0x1c1)]),_0x1f7e02=await loadJSONFromOptions(_0x593ca4[_0x38fcf2(0x144)],_0x593ca4[_0x38fcf2(0x168)]),_0x229cb3={'name':_0x1b2030,'description':_0x593ca4['description'],'scheduleType':_0x593ca4['scheduleType'],'scheduleOption':_0x593ca4[_0x38fcf2(0x1af)],'timezone':_0x593ca4['timezone'],'master':{'parentDatabaseName':_0x593ca4[_0x38fcf2(0x192)],'parentTableName':_0x593ca4[_0x38fcf2(0x2b2)]},'attributes':_0x446a98,'behaviors':_0x488eef,'customerGroup':_0x1f7e02},_0x45d167=await withSpinner(_0x38fcf2(0x2ba)+_0x1b2030+_0x38fcf2(0x2a3),()=>_0x336531[_0x38fcf2(0x19c)][_0x38fcf2(0x1e5)](_0x229cb3),{'verbose':_0x1438b6[_0x38fcf2(0x1d5)]}),_0x47a43c=_0x45d167[_0x38fcf2(0x25a)];return console['error'](_0x38fcf2(0x263)+_0x47a43c['name']+_0x38fcf2(0x1e2)+_0x47a43c['id']),await handleSDKOutput([_0x47a43c],_0x1438b6),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x182);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x210);async['execute'](_0x2a9c85){const _0x14636e=a30_0x18fecb,{options:_0x28acbf,args:_0x484688,tdx:_0x4a645b}=_0x2a9c85;console[_0x14636e(0x1f6)](_0x14636e(0x1a5)+_0x14636e(0x138)+_0x14636e(0x29d));const _0x24d3b6=_0x28acbf;if(_0x484688[_0x14636e(0x197)]===0x0)return console[_0x14636e(0x1f6)](a30_0x2ae559[_0x14636e(0x20d)](_0x14636e(0x225))),console['error'](_0x14636e(0x2a4)),0x1;const _0x3b71cd=_0x484688[0x0];_0x24d3b6[_0x14636e(0x1d5)]&&(console[_0x14636e(0x1f6)](_0x14636e(0x1d9)+_0x24d3b6[_0x14636e(0x177)]),console[_0x14636e(0x1f6)]('Parent\x20segment:\x20'+_0x3b71cd));const _0x878f5e=await withSpinner(_0x14636e(0x214)+_0x3b71cd+_0x14636e(0x2a3),()=>_0x4a645b[_0x14636e(0x19c)][_0x14636e(0x136)](_0x3b71cd),{'verbose':_0x24d3b6[_0x14636e(0x1d5)]}),_0x387f12=_0x878f5e['data'],_0x33f73c=await loadJSONFromOptions(_0x24d3b6[_0x14636e(0x155)],_0x24d3b6[_0x14636e(0x1c3)]),_0x38b27e=await loadJSONFromOptions(_0x24d3b6[_0x14636e(0x1ef)],_0x24d3b6[_0x14636e(0x164)]),_0x12f237={'name':_0x387f12[_0x14636e(0x281)],'description':_0x24d3b6[_0x14636e(0x2b1)]!==undefined?_0x24d3b6[_0x14636e(0x2b1)]:_0x387f12[_0x14636e(0x2b1)],'scheduleType':_0x24d3b6[_0x14636e(0x1eb)]!==undefined?_0x24d3b6[_0x14636e(0x1eb)]:_0x387f12[_0x14636e(0x1eb)],'scheduleOption':_0x24d3b6['scheduleOption']!==undefined?_0x24d3b6['scheduleOption']:_0x387f12[_0x14636e(0x1af)],'timezone':_0x24d3b6['timezone']!==undefined?_0x24d3b6[_0x14636e(0x251)]:_0x387f12[_0x14636e(0x251)],'master':_0x387f12[_0x14636e(0x149)],'attributes':_0x33f73c?[..._0x387f12['attributes']||[],..._0x33f73c]:_0x387f12[_0x14636e(0x26a)],'behaviors':_0x38b27e?[..._0x387f12[_0x14636e(0x17b)]||[],..._0x38b27e]:_0x387f12['behaviors'],'customerGroup':_0x387f12[_0x14636e(0x144)]},_0xfda497=await withSpinner(_0x14636e(0x1fd)+_0x3b71cd+_0x14636e(0x2a3),()=>_0x4a645b['segment']['updateParent'](_0x3b71cd,_0x12f237),{'verbose':_0x24d3b6[_0x14636e(0x1d5)]}),_0x40e045=_0xfda497[_0x14636e(0x25a)];return console[_0x14636e(0x1f6)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x40e045[_0x14636e(0x281)]+'\x27'),await handleSDKOutput([_0x40e045],_0x24d3b6),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x24c);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1d7);async[a30_0x18fecb(0x27b)](_0x44a916){const _0x6cca1c=a30_0x18fecb,{options:_0x541583,args:_0x20f07f,tdx:_0x7bd658}=_0x44a916,_0x415013=_0x541583,_0x4598c3=_0x20f07f[0x0]||_0x541583[_0x6cca1c(0x216)];if(!_0x4598c3)return showParentSegmentNotSetError(_0x6cca1c(0x1c9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment'),0x1;if(_0x415013[_0x6cca1c(0x2b9)]&&_0x415013[_0x6cca1c(0x137)])return console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x20d)](_0x6cca1c(0x254))),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x2c4)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console['error'](a30_0x2ae559[_0x6cca1c(0x2c4)](_0x6cca1c(0x2bc)+PARENT_SEGMENT_DIR+_0x6cca1c(0x268))),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x1da)](_0x6cca1c(0x283))),0x1;const _0x3b700b=_0x415013[_0x6cca1c(0x137)]||a30_0x16185b[_0x6cca1c(0x2b0)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4598c3)+_0x6cca1c(0x236));_0x415013[_0x6cca1c(0x1d5)]&&(console['error'](_0x6cca1c(0x1d9)+_0x415013[_0x6cca1c(0x177)]),console['error'](_0x6cca1c(0x1f8)+_0x4598c3),console[_0x6cca1c(0x1f6)](_0x6cca1c(0x276)+_0x3b700b));const _0x502c51=await withSpinner(_0x6cca1c(0x1aa)+_0x4598c3+'\x27...',()=>_0x7bd658[_0x6cca1c(0x19c)][_0x6cca1c(0x139)](_0x4598c3),{'verbose':_0x415013['verbose']}),_0x5bc8c5=_0x502c51[_0x6cca1c(0x25a)];if(existsSync(_0x3b700b)){const _0x15c709=readFileSync(_0x3b700b,_0x6cca1c(0x146)),_0x4d2c74=generateDiff(_0x15c709,_0x5bc8c5);if(!hasChanges(_0x4d2c74))console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x297)]('✔')+_0x6cca1c(0x143)+a30_0x2ae559[_0x6cca1c(0x1da)](_0x3b700b)+_0x6cca1c(0x174));else{console['error'](_0x6cca1c(0x2bf)+_0x3b700b+'\x27:'),console[_0x6cca1c(0x1f6)]('─'[_0x6cca1c(0x159)](0x3c)),console[_0x6cca1c(0x1f6)](formatDiffWithColors(_0x4d2c74)),console[_0x6cca1c(0x1f6)]('─'[_0x6cca1c(0x159)](0x3c));if(!_0x415013[_0x6cca1c(0x198)]){if(!isInteractive())return console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x20d)](_0x6cca1c(0x20b)),_0x6cca1c(0x1ee)),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x2c4)](_0x6cca1c(0x188))),0x1;const _0x410ee2=await confirmKey(_0x6cca1c(0x201)+_0x3b700b+'\x27?');if(!_0x410ee2)return console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x1bd)]('Aborted.')),0x1;}writeFileSync(_0x3b700b,_0x5bc8c5,_0x6cca1c(0x146)),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x297)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a30_0x2ae559['cyan'](_0x3b700b));}}else{const _0x3b71d2=a30_0x16185b[_0x6cca1c(0x1c7)](_0x3b700b);!existsSync(_0x3b71d2)&&mkdirSync(_0x3b71d2,{'recursive':!![]}),writeFileSync(_0x3b700b,_0x5bc8c5,'utf-8'),console[_0x6cca1c(0x1f6)](a30_0x2ae559['green']('✔')+_0x6cca1c(0x250)+a30_0x2ae559[_0x6cca1c(0x1da)](_0x3b700b));}return saveSessionContext({'parent_segment':_0x4598c3},_0x415013[_0x6cca1c(0x1df)]),console[_0x6cca1c(0x1f6)](a30_0x2ae559[_0x6cca1c(0x297)]('✔')+_0x6cca1c(0x23a)+a30_0x2ae559[_0x6cca1c(0x2c4)]('parent_segment')+'\x20=\x20'+a30_0x2ae559[_0x6cca1c(0x1da)](_0x4598c3)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x135);[a30_0x18fecb(0x2b1)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x2fe29a){const _0x429781=a30_0x18fecb,{options:_0x96cdad,args:_0x3781a4,tdx:_0x4eca75}=_0x2fe29a,_0x25535e=_0x96cdad,_0x3e7a4a=_0x3781a4[0x0]||_0x96cdad[_0x429781(0x216)];if(!_0x3e7a4a)return showParentSegmentNotSetError(_0x429781(0x264)+_0x429781(0x195)),0x1;const _0xbf1328=resolveYamlFile(_0x3e7a4a);if(!existsSync(_0xbf1328))return showFileNotFoundError(_0xbf1328,_0x3e7a4a),0x1;_0x25535e[_0x429781(0x1d5)]&&(console[_0x429781(0x1f6)]('Site:\x20'+_0x25535e[_0x429781(0x177)]),console[_0x429781(0x1f6)](_0x429781(0x15a)+_0xbf1328));let _0x6be563;try{_0x6be563=readFileSync(_0xbf1328,_0x429781(0x146));}catch(_0x256213){const _0x2a8d72=_0x256213 instanceof Error?_0x256213[_0x429781(0x1c5)]:String(_0x256213);return console['error'](_0x429781(0x203)+_0x2a8d72),0x1;}const _0xcc9980=await withSpinner('Analyzing\x20changes...',()=>_0x4eca75[_0x429781(0x19c)][_0x429781(0x1e7)](_0x6be563),{'verbose':_0x25535e[_0x429781(0x1d5)]}),_0x2c714d=_0xcc9980[_0x429781(0x25a)],{isNew:_0x378699,name:_0x9374b4,hasChanges:_0x26ace7,diffFormatted:_0x334b7c}=_0x2c714d;if(!_0x26ace7)return console[_0x429781(0x1f6)](_0x429781(0x1f1)+_0x9374b4+_0x429781(0x255)),0x0;_0x378699?console['error'](_0x429781(0x14d)+_0x9374b4+'\x27:'):console['error'](_0x429781(0x1f2)+_0x9374b4+'\x27:');console['error']('─'[_0x429781(0x159)](0x3c)),console[_0x429781(0x1f6)](_0x334b7c),console[_0x429781(0x1f6)]('─'[_0x429781(0x159)](0x3c));const _0x2e4ad1=_0x378699?_0x429781(0x166)+_0x9374b4+'\x27?':_0x429781(0x284)+_0x9374b4+'\x27?';if(!_0x25535e['yes']){if(!isInteractive())return console[_0x429781(0x1f6)](a30_0x2ae559[_0x429781(0x20d)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x429781(0x1f6)](a30_0x2ae559[_0x429781(0x2c4)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x129cfc=await confirmKey(_0x2e4ad1);if(!_0x129cfc)return console[_0x429781(0x1f6)](a30_0x2ae559[_0x429781(0x1bd)](_0x429781(0x1f4))),0x1;}const _0x15f603=_0x378699?_0x429781(0x1b1):_0x429781(0x18f),_0x4ad61a=await withSpinner(_0x15f603+_0x429781(0x22a)+_0x9374b4+_0x429781(0x2a3),()=>_0x2c714d[_0x429781(0x176)](),{'verbose':_0x25535e[_0x429781(0x1d5)]}),_0x23186d=_0x4ad61a['data'],_0x39d0f9=getConsoleNextUrl(_0x25535e[_0x429781(0x177)],_0x429781(0x287)+_0x23186d['id']),_0x33bab7=_0x378699?_0x429781(0x1bf):'Updated';return console[_0x429781(0x1f6)]('✔\x20'+_0x33bab7+_0x429781(0x22a)+_0x23186d[_0x429781(0x281)]+'\x27'),console[_0x429781(0x1f6)]('\x20\x20'+_0x39d0f9),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a30_0x18fecb(0x2a7);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1c0);async[a30_0x18fecb(0x27b)](_0x48c2a1){const _0x221d23=a30_0x18fecb,{options:_0x244112,args:_0x174ed6,tdx:_0x318b52}=_0x48c2a1,_0x4c02ab=_0x244112,_0x57ff33=_0x174ed6[0x0]||_0x244112[_0x221d23(0x216)];if(!_0x57ff33)return showParentSegmentNotSetError(_0x221d23(0x15c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x221d23(0x2c6)+_0x221d23(0x1d6)+_0x221d23(0x175)+_0x221d23(0x18b)),0x1;const _0x4d846b=resolveYamlFile(_0x57ff33);if(!existsSync(_0x4d846b))return showFileNotFoundError(_0x4d846b,_0x57ff33),0x1;_0x4c02ab[_0x221d23(0x1d5)]&&(console[_0x221d23(0x1f6)](_0x221d23(0x1d9)+_0x4c02ab[_0x221d23(0x177)]),console[_0x221d23(0x1f6)]('YAML\x20file:\x20'+_0x4d846b));let _0x2e20b8;try{_0x2e20b8=readFileSync(_0x4d846b,'utf-8');}catch(_0xbaae2f){const _0x10c051=_0xbaae2f instanceof Error?_0xbaae2f[_0x221d23(0x1c5)]:String(_0xbaae2f);return console['error'](_0x221d23(0x203)+_0x10c051),0x1;}const _0x574a18=createCommandSpinner(a30_0x2ae559[_0x221d23(0x2c4)](_0x221d23(0x279)),{'verbose':_0x4c02ab[_0x221d23(0x1d5)]});_0x574a18[_0x221d23(0x17c)]();const _0x525b33={'onProgress':_0x330a41=>{_0x574a18['text']=formatProgressMessage(_0x330a41);}};if(_0x4c02ab['master'])_0x525b33[_0x221d23(0x149)]=!![];if(_0x4c02ab['enriched'])_0x525b33[_0x221d23(0x16e)]=!![];_0x4c02ab[_0x221d23(0x140)]&&(_0x525b33[_0x221d23(0x140)]=_0x4c02ab[_0x221d23(0x140)]);_0x4c02ab[_0x221d23(0x14b)]&&(_0x525b33[_0x221d23(0x14b)]=_0x4c02ab[_0x221d23(0x14b)]);if(_0x4c02ab['interval'])_0x525b33[_0x221d23(0x27f)]=_0x4c02ab[_0x221d23(0x27f)];let _0x4b24e9;try{_0x4b24e9=await _0x318b52[_0x221d23(0x19c)][_0x221d23(0x15e)](_0x2e20b8,_0x525b33),_0x574a18['stop']();}catch(_0x159b67){_0x574a18[_0x221d23(0x2c0)]();throw _0x159b67;}const _0x5192e9=_0x4c02ab['interval']||_0x221d23(0x2c7);return this[_0x221d23(0x25b)](_0x4b24e9,_0x525b33,_0x4d846b,_0x5192e9),_0x4b24e9[_0x221d23(0x1ea)]?0x0:0x1;}[a30_0x18fecb(0x25b)](_0x16c38f,_0x1fe9ac,_0x5bc87f,_0x4725cb){const _0x55d97a=a30_0x18fecb;console[_0x55d97a(0x1f6)]('\x0a'+a30_0x2ae559['bold'](_0x55d97a(0x2ab))+'\x20'+_0x16c38f[_0x55d97a(0x281)]),console[_0x55d97a(0x1f6)]('═'[_0x55d97a(0x159)](0x3c)),this['displayMasterInfo'](_0x16c38f);if(typeof _0x1fe9ac[_0x55d97a(0x140)]==='string'){this[_0x55d97a(0x19e)](_0x16c38f),this[_0x55d97a(0x1dd)](_0x16c38f),this[_0x55d97a(0x247)](_0x5bc87f,_0x4725cb,_0x55d97a(0x140),_0x1fe9ac[_0x55d97a(0x140)]);return;}if(_0x1fe9ac[_0x55d97a(0x140)]===!![]){this[_0x55d97a(0x19e)](_0x16c38f),this['displaySummary'](_0x16c38f),this[_0x55d97a(0x247)](_0x5bc87f,_0x4725cb,_0x55d97a(0x26a));return;}if(typeof _0x1fe9ac[_0x55d97a(0x14b)]==='string'){this['displayBehaviorsStats'](_0x16c38f,_0x4725cb),this[_0x55d97a(0x1dd)](_0x16c38f),this['displayPreviewHints'](_0x5bc87f,_0x4725cb,_0x55d97a(0x14b),_0x1fe9ac[_0x55d97a(0x14b)]);return;}if(_0x1fe9ac[_0x55d97a(0x14b)]===!![]){this[_0x55d97a(0x15d)](_0x16c38f,_0x4725cb),this[_0x55d97a(0x1dd)](_0x16c38f),this['displayPreviewHints'](_0x5bc87f,_0x4725cb,'behaviors');return;}this[_0x55d97a(0x19e)](_0x16c38f),this['displayBehaviorsStats'](_0x16c38f,_0x4725cb),this[_0x55d97a(0x1e0)](_0x16c38f),this['displaySummary'](_0x16c38f),this[_0x55d97a(0x247)](_0x5bc87f,_0x4725cb,_0x55d97a(0x1de));}[a30_0x18fecb(0x1e0)](_0x141571){displayRealtimeValidation(_0x141571);}[a30_0x18fecb(0x247)](_0x45d8ee,_0x1d56d2,_0x524005,_0xcd0713){const _0x4d3f2e=a30_0x18fecb;console[_0x4d3f2e(0x1f6)]('\x0a'+a30_0x2ae559[_0x4d3f2e(0x2c4)](_0x4d3f2e(0x294)));const _0x2f6f01=_0x1d56d2!==_0x4d3f2e(0x2c7)?_0x4d3f2e(0x234)+_0x1d56d2:'';if(_0x524005===_0x4d3f2e(0x140)&&_0xcd0713)console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559['dim']('tdx\x20ps\x20preview\x20'+_0x45d8ee+_0x4d3f2e(0x204)+_0xcd0713+'\x22'+_0x2f6f01));else{if(_0x524005===_0x4d3f2e(0x14b)&&_0xcd0713)console['error']('\x20\x20'+a30_0x2ae559['dim'](_0x4d3f2e(0x1b6)+_0x45d8ee+_0x4d3f2e(0x244)+_0xcd0713+'\x22'+_0x2f6f01));else(_0x524005===_0x4d3f2e(0x26a)||_0x524005==='all')&&console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559['dim'](_0x4d3f2e(0x1b6)+_0x45d8ee+_0x4d3f2e(0x1d4)+_0x2f6f01));}(_0x524005===_0x4d3f2e(0x17b)||_0x524005===_0x4d3f2e(0x1de))&&console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4d3f2e(0x2c4)](_0x4d3f2e(0x1b6)+_0x45d8ee+_0x4d3f2e(0x290)+_0x2f6f01)),_0x524005===_0x4d3f2e(0x1de)&&console[_0x4d3f2e(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4d3f2e(0x2c4)]('tdx\x20ps\x20preview\x20'+_0x45d8ee+_0x4d3f2e(0x1c6)+_0x2f6f01));}[a30_0x18fecb(0x209)](_0x262ef5){const _0xdeccdc=a30_0x18fecb,{master:_0x147e57}=_0x262ef5,_0x3befb3=_0x147e57['schemaValid']?a30_0x2ae559['green']('✔'):a30_0x2ae559['red']('✘');console[_0xdeccdc(0x1f6)]('\x0a'+a30_0x2ae559[_0xdeccdc(0x2c4)](_0xdeccdc(0x17d))),console[_0xdeccdc(0x1f6)](_0x3befb3+'\x20'+a30_0x2ae559[_0xdeccdc(0x23c)](_0x147e57[_0xdeccdc(0x192)]+'.'+_0x147e57[_0xdeccdc(0x2b2)])),_0x147e57[_0xdeccdc(0x221)]?_0x147e57[_0xdeccdc(0x191)]!==undefined&&console[_0xdeccdc(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xdeccdc(0x2c4)](_0xdeccdc(0x1be))+'\x20'+a30_0x2ae559['cyan'](formatRows(_0x147e57['rowCount']))):console['error']('\x20\x20'+a30_0x2ae559['red'](_0xdeccdc(0x237))+'\x20'+_0x147e57[_0xdeccdc(0x1ec)]);}[a30_0x18fecb(0x19e)](_0x23de95){const _0x4f3917=a30_0x18fecb;if(_0x23de95[_0x4f3917(0x26a)][_0x4f3917(0x197)]===0x0)return;console[_0x4f3917(0x1f6)]('\x0a'+a30_0x2ae559['dim'](_0x4f3917(0x13c)));for(const _0x3abeb0 of _0x23de95[_0x4f3917(0x26a)]){const _0x1050fa=_0x3abeb0[_0x4f3917(0x221)]?a30_0x2ae559[_0x4f3917(0x297)]('✔'):a30_0x2ae559[_0x4f3917(0x20d)]('✘');let _0x22d6c6='';if(_0x3abeb0['schemaValid']&&_0x3abeb0[_0x4f3917(0x16a)]!==undefined&&_0x3abeb0[_0x4f3917(0x1b2)]!==undefined){const _0x155946=_0x3abeb0[_0x4f3917(0x1b2)][_0x4f3917(0x232)](0x1),_0x1dffe0=_0x3abeb0[_0x4f3917(0x1b2)]>=0x50?a30_0x2ae559[_0x4f3917(0x297)]:_0x3abeb0[_0x4f3917(0x1b2)]>=0x32?a30_0x2ae559[_0x4f3917(0x1bd)]:a30_0x2ae559[_0x4f3917(0x20d)];_0x22d6c6='\x20'+a30_0x2ae559[_0x4f3917(0x2c4)]('Coverage:')+'\x20'+_0x1dffe0(_0x155946+'%')+'\x20('+formatRows(_0x3abeb0[_0x4f3917(0x16a)])+_0x4f3917(0x18d);}console[_0x4f3917(0x1f6)](_0x1050fa+'\x20'+a30_0x2ae559['bold'](_0x3abeb0[_0x4f3917(0x281)])+_0x22d6c6),console['error']('\x20\x20'+a30_0x2ae559[_0x4f3917(0x2c4)]('Source:')+'\x20'+a30_0x2ae559[_0x4f3917(0x23c)](_0x3abeb0['database']+'.'+_0x3abeb0['table']));const _0x418a93=_0x3abeb0['joinKey']===_0x3abeb0[_0x4f3917(0x167)]?a30_0x2ae559[_0x4f3917(0x2c4)](_0x4f3917(0x207))+'\x20'+_0x3abeb0['joinKey']:a30_0x2ae559[_0x4f3917(0x2c4)](_0x4f3917(0x23f))+'\x20'+_0x3abeb0[_0x4f3917(0x208)]+_0x4f3917(0x1f5)+_0x3abeb0[_0x4f3917(0x167)];console['error']('\x20\x20'+_0x418a93),console['error']('\x20\x20'+a30_0x2ae559['dim'](_0x4f3917(0x1a9))),this[_0x4f3917(0x180)](_0x3abeb0[_0x4f3917(0x1fe)]),!_0x3abeb0[_0x4f3917(0x221)]&&console[_0x4f3917(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x4f3917(0x20d)]('Error:')+'\x20'+_0x3abeb0['schemaError']);}}[a30_0x18fecb(0x15d)](_0x4bf585,_0x454625){const _0x343bc2=a30_0x18fecb;if(_0x4bf585['behaviors']['length']===0x0)return;console[_0x343bc2(0x1f6)]('\x0a'+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x13e))+'\x20'+a30_0x2ae559[_0x343bc2(0x2c4)]('('+_0x454625+')'));for(const _0x1d7833 of _0x4bf585[_0x343bc2(0x17b)]){const _0x3bf25a=_0x1d7833['schemaValid']?a30_0x2ae559[_0x343bc2(0x297)]('✔'):a30_0x2ae559[_0x343bc2(0x20d)]('✘');let _0x178362='';if(_0x1d7833[_0x343bc2(0x221)]&&_0x1d7833[_0x343bc2(0x1d1)]!==undefined&&_0x1d7833[_0x343bc2(0x22f)]!==undefined){const _0x225d89=_0x1d7833[_0x343bc2(0x2b6)]?.[_0x343bc2(0x232)](0x1)||'?',_0x1eb547=(_0x1d7833[_0x343bc2(0x2b6)]??0x0)>=0x32?a30_0x2ae559['green']:(_0x1d7833[_0x343bc2(0x2b6)]??0x0)>=0x14?a30_0x2ae559['yellow']:a30_0x2ae559[_0x343bc2(0x20d)];_0x178362='\x20'+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x20f))+'\x20'+_0x1eb547(formatRows(_0x1d7833[_0x343bc2(0x1d1)]))+'\x20('+_0x225d89+_0x343bc2(0x1e8)+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x282))+'\x20'+a30_0x2ae559['cyan'](formatRows(_0x1d7833[_0x343bc2(0x22f)]));}console[_0x343bc2(0x1f6)](_0x3bf25a+'\x20'+a30_0x2ae559[_0x343bc2(0x23c)](_0x1d7833[_0x343bc2(0x281)])+_0x178362),console['error']('\x20\x20'+a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x19d))+'\x20'+a30_0x2ae559[_0x343bc2(0x23c)](_0x1d7833[_0x343bc2(0x192)]+'.'+_0x1d7833[_0x343bc2(0x2b2)]));const _0x57d990=_0x1d7833[_0x343bc2(0x208)]===_0x1d7833[_0x343bc2(0x167)]?a30_0x2ae559[_0x343bc2(0x2c4)](_0x343bc2(0x207))+'\x20'+_0x1d7833['joinKey']:a30_0x2ae559[_0x343bc2(0x2c4)]('Join:')+'\x20'+_0x1d7833[_0x343bc2(0x208)]+_0x343bc2(0x1f5)+_0x1d7833[_0x343bc2(0x167)];console[_0x343bc2(0x1f6)]('\x20\x20'+_0x57d990),console[_0x343bc2(0x1f6)]('\x20\x20'+a30_0x2ae559['dim']('Columns:')),this[_0x343bc2(0x180)](_0x1d7833['columns']),!_0x1d7833[_0x343bc2(0x221)]&&console[_0x343bc2(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x343bc2(0x20d)](_0x343bc2(0x237))+'\x20'+_0x1d7833[_0x343bc2(0x1ec)]);}}[a30_0x18fecb(0x180)](_0x420832){const _0x50a785=a30_0x18fecb;for(const _0x5e702f of _0x420832){_0x5e702f[_0x50a785(0x152)]===_0x5e702f[_0x50a785(0x2c9)]||_0x5e702f[_0x50a785(0x2c9)]==='*'?console[_0x50a785(0x1f6)](_0x50a785(0x18e)+_0x5e702f['label']):console[_0x50a785(0x1f6)](_0x50a785(0x18e)+_0x5e702f[_0x50a785(0x152)]+'\x20'+a30_0x2ae559['dim']('('+_0x5e702f['column']+')'));}}[a30_0x18fecb(0x1dd)](_0x5cceb3){const _0x637f80=a30_0x18fecb;console['error']('─'[_0x637f80(0x159)](0x3c));if(_0x5cceb3['errors'][_0x637f80(0x197)]>0x0){console[_0x637f80(0x1f6)]('\x0a'+a30_0x2ae559[_0x637f80(0x20d)](_0x637f80(0x154)));for(const _0x5c66aa of _0x5cceb3[_0x637f80(0x14c)]){console[_0x637f80(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x637f80(0x20d)]('•')+'\x20'+_0x5c66aa);}}_0x5cceb3[_0x637f80(0x1ea)]&&console[_0x637f80(0x1f6)]('\x0a'+a30_0x2ae559[_0x637f80(0x297)]('✔')+_0x637f80(0x249));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]='segment:parent:preview';['description']='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a30_0x18fecb(0x27b)](_0xd854e){const _0x192ba4=a30_0x18fecb,{options:_0x1ae7f8,args:_0xd6eb0,tdx:_0x381bf3}=_0xd854e,_0x483b8a=_0x1ae7f8,_0x32ef82=_0xd6eb0[0x0]||_0x1ae7f8[_0x192ba4(0x216)];if(!_0x32ef82)return showParentSegmentNotSetError(_0x192ba4(0x29c)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x192ba4(0x2b7)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x192ba4(0x224)+_0x192ba4(0x1e3)+_0x192ba4(0x231)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x483b8a['master']&&!_0x483b8a['attribute']&&!_0x483b8a[_0x192ba4(0x14b)]&&!_0x483b8a['enriched'])return console['error'](a30_0x2ae559['red'](_0x192ba4(0x173))),console[_0x192ba4(0x1f6)](_0x192ba4(0x199)),console[_0x192ba4(0x1f6)](_0x192ba4(0x1b8)),console[_0x192ba4(0x1f6)](_0x192ba4(0x22b)),console[_0x192ba4(0x1f6)](_0x192ba4(0x257)),console[_0x192ba4(0x1f6)](_0x192ba4(0x293)),console['error'](_0x192ba4(0x27a)),0x1;const _0x3905c7=resolveYamlFile(_0x32ef82);if(!existsSync(_0x3905c7))return showFileNotFoundError(_0x3905c7,_0x32ef82),0x1;_0x483b8a['verbose']&&(console[_0x192ba4(0x1f6)](_0x192ba4(0x1d9)+_0x483b8a[_0x192ba4(0x177)]),console['error'](_0x192ba4(0x15a)+_0x3905c7));let _0x2d1bf7;try{_0x2d1bf7=readFileSync(_0x3905c7,_0x192ba4(0x146));}catch(_0x27e4aa){const _0x12f911=_0x27e4aa instanceof Error?_0x27e4aa[_0x192ba4(0x1c5)]:String(_0x27e4aa);return console[_0x192ba4(0x1f6)](_0x192ba4(0x203)+_0x12f911),0x1;}let _0x42587c;try{_0x42587c=parseDef(_0x2d1bf7);}catch(_0x1bd3f0){const _0x80ba59=_0x1bd3f0 instanceof Error?_0x1bd3f0[_0x192ba4(0x1c5)]:String(_0x1bd3f0);return console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)](_0x192ba4(0x28a)+_0x80ba59)),0x1;}if(_0x483b8a[_0x192ba4(0x140)]===!![]||_0x483b8a[_0x192ba4(0x140)]===''){const _0x1e6940=_0x42587c['attributes']?.['map'](_0x8432f4=>_0x8432f4[_0x192ba4(0x281)])||[];if(_0x1e6940[_0x192ba4(0x197)]===0x0)console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)](_0x192ba4(0x28f)));else{console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)](_0x192ba4(0x1b4))),console[_0x192ba4(0x1f6)](_0x192ba4(0x1a4));for(const _0x4859f6 of _0x1e6940){console[_0x192ba4(0x1f6)]('\x20\x20'+a30_0x2ae559['cyan'](_0x4859f6));}console[_0x192ba4(0x1f6)](_0x192ba4(0x272)+_0x32ef82+'\x20--attribute\x20\x22'+_0x1e6940[0x0]+'\x22');}return 0x1;}if(_0x483b8a[_0x192ba4(0x14b)]===!![]||_0x483b8a[_0x192ba4(0x14b)]===''){const _0x2248e5=_0x42587c[_0x192ba4(0x17b)]?.[_0x192ba4(0x2a1)](_0x5dfaa5=>_0x5dfaa5[_0x192ba4(0x281)])||[];if(_0x2248e5[_0x192ba4(0x197)]===0x0)console['error'](a30_0x2ae559['red'](_0x192ba4(0x20a)));else{console[_0x192ba4(0x1f6)](a30_0x2ae559[_0x192ba4(0x20d)]('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x192ba4(0x1f6)](_0x192ba4(0x24e));for(const _0x2b4587 of _0x2248e5){console[_0x192ba4(0x1f6)]('\x20\x20'+a30_0x2ae559['cyan'](_0x2b4587));}console[_0x192ba4(0x1f6)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x32ef82+_0x192ba4(0x244)+_0x2248e5[0x0]+'\x22');}return 0x1;}const _0x31ce10=createCommandSpinner(a30_0x2ae559[_0x192ba4(0x2c4)](_0x192ba4(0x1b7)),{'verbose':_0x483b8a[_0x192ba4(0x1d5)]});_0x31ce10['start']();const _0x29aa2e={'onProgress':_0x588bb9=>{const _0x305756=_0x192ba4;_0x31ce10[_0x305756(0x194)]=formatProgressMessage(_0x588bb9);}};if(_0x483b8a[_0x192ba4(0x149)])_0x29aa2e[_0x192ba4(0x149)]=!![];if(_0x483b8a['attribute']&&typeof _0x483b8a[_0x192ba4(0x140)]===_0x192ba4(0x19a))_0x29aa2e[_0x192ba4(0x140)]=_0x483b8a[_0x192ba4(0x140)];if(_0x483b8a['behavior']&&typeof _0x483b8a[_0x192ba4(0x14b)]===_0x192ba4(0x19a))_0x29aa2e[_0x192ba4(0x14b)]=_0x483b8a['behavior'];if(_0x483b8a['enriched'])_0x29aa2e[_0x192ba4(0x16e)]=!![];if(_0x483b8a['interval'])_0x29aa2e[_0x192ba4(0x27f)]=_0x483b8a[_0x192ba4(0x27f)];let _0x4ee702;try{_0x4ee702=await _0x381bf3[_0x192ba4(0x19c)][_0x192ba4(0x2c1)](_0x2d1bf7,_0x29aa2e),_0x31ce10[_0x192ba4(0x2c0)]();}catch(_0x22516d){_0x31ce10[_0x192ba4(0x2c0)]();throw _0x22516d;}return await this[_0x192ba4(0x2a2)](_0x4ee702,{'master':_0x483b8a['master'],'attribute':typeof _0x483b8a[_0x192ba4(0x140)]==='string'?_0x483b8a[_0x192ba4(0x140)]:undefined,'behavior':typeof _0x483b8a[_0x192ba4(0x14b)]===_0x192ba4(0x19a)?_0x483b8a[_0x192ba4(0x14b)]:undefined,'enriched':_0x483b8a[_0x192ba4(0x16e)]}),_0x4ee702[_0x192ba4(0x1ea)]?0x0:0x1;}async[a30_0x18fecb(0x2a2)](_0x3e6771,_0x2ad988){const _0x5ee8b5=a30_0x18fecb;console[_0x5ee8b5(0x1f6)]('\x0a'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x5ee8b5(0x226))+'\x20'+_0x3e6771['name']),console[_0x5ee8b5(0x1f6)]('═'[_0x5ee8b5(0x159)](0x3c));if(_0x2ad988[_0x5ee8b5(0x149)]&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x15a685=a30_0x2ae559[_0x5ee8b5(0x2c4)](_0x5ee8b5(0x1d3))+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x3e6771[_0x5ee8b5(0x149)][_0x5ee8b5(0x192)]+'.'+_0x3e6771[_0x5ee8b5(0x149)][_0x5ee8b5(0x2b2)]);await this[_0x5ee8b5(0x162)](_0x15a685,_0x3e6771['sampleData']);}else{if(_0x2ad988[_0x5ee8b5(0x140)]&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x197552=a30_0x2ae559[_0x5ee8b5(0x2c4)](_0x5ee8b5(0x202))+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x2ad988[_0x5ee8b5(0x140)]);await this[_0x5ee8b5(0x162)](_0x197552,_0x3e6771[_0x5ee8b5(0x1f3)]);}else{if(_0x2ad988['behavior']&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x2d96b8=a30_0x2ae559[_0x5ee8b5(0x2c4)]('Behavior:')+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x2ad988['behavior']);await this['displaySampleData'](_0x2d96b8,_0x3e6771[_0x5ee8b5(0x1f3)]);}else{if(_0x2ad988[_0x5ee8b5(0x16e)]&&_0x3e6771[_0x5ee8b5(0x1f3)]){const _0x1ced36=a30_0x2ae559[_0x5ee8b5(0x2c4)](_0x5ee8b5(0x259))+'\x20'+a30_0x2ae559[_0x5ee8b5(0x23c)](_0x5ee8b5(0x23d));await this[_0x5ee8b5(0x162)](_0x1ced36,_0x3e6771[_0x5ee8b5(0x1f3)]);}else!_0x3e6771['sampleData']&&console['error'](_0x5ee8b5(0x196));}}}if(_0x3e6771[_0x5ee8b5(0x14c)]['length']>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a30_0x2ae559[_0x5ee8b5(0x20d)]('Errors:'));for(const _0x4561f2 of _0x3e6771[_0x5ee8b5(0x14c)]){console[_0x5ee8b5(0x1f6)]('\x20\x20'+a30_0x2ae559[_0x5ee8b5(0x20d)]('•')+'\x20'+_0x4561f2);}}}async[a30_0x18fecb(0x162)](_0x3691d0,_0x257493){const _0x5e5f94=a30_0x18fecb;if(_0x257493[_0x5e5f94(0x197)]===0x0){console[_0x5e5f94(0x1f6)]('\x0a'+_0x3691d0),console[_0x5e5f94(0x1f6)](_0x5e5f94(0x205));return;}console[_0x5e5f94(0x1f6)]('\x0a'+_0x3691d0);const _0x1aa42d=Object[_0x5e5f94(0x278)](_0x257493[0x0])[_0x5e5f94(0x2a1)](_0x540e5f=>({'name':_0x540e5f,'type':typeof _0x257493[0x0][_0x540e5f]===_0x5e5f94(0x253)?'double':_0x5e5f94(0x1ab)})),_0x37f6f3={'queryId':_0x5e5f94(0x28b),'columns':_0x1aa42d,'data':_0x257493,'stats':{'state':_0x5e5f94(0x17f),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x257493[_0x5e5f94(0x197)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x523479=formatAsTable(_0x37f6f3,_0x257493[_0x5e5f94(0x197)],!![]);await writeOutput(_0x523479,undefined,_0x5e5f94(0x2b2));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x161);['description']=a30_0x18fecb(0x1d8);async[a30_0x18fecb(0x27b)](_0x2f6c65){const _0xfb389b=a30_0x18fecb,{options:_0x48b330,args:_0xc9eeb,tdx:_0x5832fe}=_0x2f6c65,_0x8fecf6=_0x48b330,_0x597066=_0xc9eeb[0x0]||_0x48b330[_0xfb389b(0x216)];if(!_0x597066)return showParentSegmentNotSetError(_0xfb389b(0x218)+_0xfb389b(0x262)),0x1;const _0x177a24=resolveYamlFile(_0x597066);if(existsSync(_0x177a24)){_0x8fecf6[_0xfb389b(0x1d5)]&&console[_0xfb389b(0x1f6)](_0xfb389b(0x261)+_0x177a24);let _0x52a3ec;try{_0x52a3ec=readFileSync(_0x177a24,_0xfb389b(0x146));}catch(_0x21c695){const _0xc481e1=_0x21c695 instanceof Error?_0x21c695[_0xfb389b(0x1c5)]:String(_0x21c695);return console[_0xfb389b(0x1f6)]('Error\x20reading\x20file:\x20'+_0xc481e1),0x1;}const _0x54c564=await withSpinner(_0xfb389b(0x24d),()=>_0x5832fe[_0xfb389b(0x19c)][_0xfb389b(0x1e7)](_0x52a3ec),{'verbose':_0x8fecf6[_0xfb389b(0x1d5)]}),_0xc064b5=_0x54c564[_0xfb389b(0x25a)],{isNew:_0x5e6cfe,name:_0x446da9,hasChanges:_0x242f46,diffFormatted:_0x34add6}=_0xc064b5;if(_0x242f46){_0x5e6cfe?console[_0xfb389b(0x1f6)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x446da9+'\x27:'):console['error'](_0xfb389b(0x1f2)+_0x446da9+'\x27:');console[_0xfb389b(0x1f6)]('─'[_0xfb389b(0x159)](0x3c)),console[_0xfb389b(0x1f6)](_0x34add6),console[_0xfb389b(0x1f6)]('─'['repeat'](0x3c));const _0x2f4b7c=_0x5e6cfe?_0xfb389b(0x166)+_0x446da9+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x446da9+_0xfb389b(0x26f);if(!_0x8fecf6['yes']){if(!isInteractive())return console[_0xfb389b(0x1f6)](a30_0x2ae559[_0xfb389b(0x20d)](_0xfb389b(0x20b)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0xfb389b(0x1f6)](a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x188))),0x1;const _0x2185be=await confirmKey(_0x2f4b7c);if(!_0x2185be)return console[_0xfb389b(0x1f6)](a30_0x2ae559[_0xfb389b(0x1bd)]('Aborted.')),0x1;}const _0x40b1ba=_0x5e6cfe?'Creating':'Updating';await withSpinner(_0x40b1ba+_0xfb389b(0x22a)+_0x446da9+'\x27...',()=>_0xc064b5[_0xfb389b(0x176)](),{'verbose':_0x8fecf6['verbose']});const _0x5156a9=_0x5e6cfe?_0xfb389b(0x1bf):_0xfb389b(0x153);console['error']('✔\x20'+_0x5156a9+_0xfb389b(0x22a)+_0x446da9+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x446da9+'\x27\x20is\x20up\x20to\x20date');}const _0x1c8a0e=await withSpinner(_0xfb389b(0x169)+_0x597066+_0xfb389b(0x2a3),()=>_0x5832fe[_0xfb389b(0x19c)]['runParent'](_0x597066),{'verbose':_0x8fecf6[_0xfb389b(0x1d5)]}),_0x3f3ce3=_0x1c8a0e[_0xfb389b(0x25a)],_0x284329=getConsoleUrl(_0x8fecf6['site'],_0xfb389b(0x1fb)+_0x3f3ce3[_0xfb389b(0x2b5)]+_0xfb389b(0x299)+_0x3f3ce3[_0xfb389b(0x289)]+_0xfb389b(0x1f0)+_0x3f3ce3['workflowAttemptId']);return console[_0xfb389b(0x1f6)](_0xfb389b(0x26d)),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)]('Audience\x20ID:')+'\x20'+_0x3f3ce3[_0xfb389b(0x1ac)]),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x16d))+'\x20'+_0x3f3ce3['status']),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x1ca))+'\x20'+_0x3f3ce3[_0xfb389b(0x289)]),console[_0xfb389b(0x1f6)]('\x20\x20'+a30_0x2ae559[_0xfb389b(0x2c4)](_0xfb389b(0x2bd))+'\x20'+_0x3f3ce3[_0xfb389b(0x25f)]),console[_0xfb389b(0x1f6)]('\x20\x20'+_0x284329),console['error']('\x0a'+a30_0x2ae559['dim'](_0xfb389b(0x241))+_0xfb389b(0x156)+_0x3f3ce3['workflowAttemptId']+_0xfb389b(0x25e)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']='segment:parent:fields';[a30_0x18fecb(0x2b1)]='List\x20available\x20fields\x20for\x20segmentation';async[a30_0x18fecb(0x27b)](_0x28d20c){const _0x12cd1e=a30_0x18fecb,{options:_0x183af2,args:_0x171961,tdx:_0x43931b}=_0x28d20c,_0x1fabdc=_0x171961[0x0]||_0x183af2[_0x12cd1e(0x216)];if(!_0x1fabdc)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+_0x12cd1e(0x275)),0x1;_0x183af2[_0x12cd1e(0x1d5)]&&(console[_0x12cd1e(0x1f6)]('Site:\x20'+_0x183af2[_0x12cd1e(0x177)]),console[_0x12cd1e(0x1f6)](_0x12cd1e(0x1f8)+_0x1fabdc));const _0x4c3e19=await withSpinner(_0x12cd1e(0x223)+_0x1fabdc+_0x12cd1e(0x2a3),()=>_0x43931b[_0x12cd1e(0x19c)]['listFields'](_0x1fabdc),{'verbose':_0x183af2[_0x12cd1e(0x1d5)]}),_0x425967=_0x4c3e19[_0x12cd1e(0x25a)];console[_0x12cd1e(0x1f6)](_0x12cd1e(0x187)+_0x425967[_0x12cd1e(0x197)]+'\x20field'+(_0x425967[_0x12cd1e(0x197)]!==0x1?'s':''));if(_0x183af2[_0x12cd1e(0x2aa)]||_0x183af2[_0x12cd1e(0x1a3)])return await handleSDKOutput(_0x425967,_0x183af2),0x0;return displayFieldsHumanReadable(_0x425967,_0x1fabdc),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x21e);['description']=a30_0x18fecb(0x1b9);async[a30_0x18fecb(0x27b)](_0x8da6f0){const _0x208f7c=a30_0x18fecb,{options:_0x1e36cf,args:_0x4527a0,tdx:_0xad0205}=_0x8da6f0,_0x18887a=_0x1e36cf,_0x25f594=_0x4527a0[0x0]||_0x1e36cf[_0x208f7c(0x216)];if(!_0x25f594)return showParentSegmentNotSetError(_0x208f7c(0x280)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x208f7c(0x2c6)+_0x208f7c(0x1e6)),0x1;_0x1e36cf['verbose']&&(console[_0x208f7c(0x1f6)](_0x208f7c(0x1d9)+_0x1e36cf[_0x208f7c(0x177)]),console['error']('Parent\x20segment:\x20'+_0x25f594));const _0x29b8e4=await withSpinner(_0x208f7c(0x1aa)+_0x25f594+'\x27...',()=>_0xad0205[_0x208f7c(0x19c)][_0x208f7c(0x136)](_0x25f594),{'verbose':_0x1e36cf[_0x208f7c(0x1d5)]}),_0x28f8e8=_0x29b8e4[_0x208f7c(0x25a)];if(_0x18887a[_0x208f7c(0x1db)]){const _0x56245f=getConsoleNextUrl(_0x18887a[_0x208f7c(0x177)],_0x208f7c(0x287)+_0x28f8e8['id']);return console['error'](a30_0x2ae559[_0x208f7c(0x297)]('✔')+'\x20Opening\x20'+a30_0x2ae559[_0x208f7c(0x1da)](_0x56245f)),openBrowser(_0x56245f),0x0;}return await handleSingleObjectOutput(_0x28f8e8,_0x1e36cf),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x24a);[a30_0x18fecb(0x2b1)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a30_0x18fecb(0x27b)](_0x1fe01b){const _0x5b38cd=a30_0x18fecb,{options:_0x3043a3,args:_0x32d463,tdx:_0x37f107}=_0x1fe01b,_0x300d25=_0x3043a3,_0x2895b6=_0x32d463[0x0]||_0x3043a3[_0x5b38cd(0x216)];if(!_0x2895b6)return showParentSegmentNotSetError(_0x5b38cd(0x1a6)+'\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'+_0x5b38cd(0x2c6)+_0x5b38cd(0x29b)),0x1;_0x3043a3[_0x5b38cd(0x1d5)]&&(console[_0x5b38cd(0x1f6)](_0x5b38cd(0x1d9)+_0x3043a3[_0x5b38cd(0x177)]),console[_0x5b38cd(0x1f6)](_0x5b38cd(0x1f8)+_0x2895b6));const _0x4f92a0=await withSpinner(_0x5b38cd(0x222)+_0x2895b6+'\x27...',()=>_0x37f107[_0x5b38cd(0x19c)][_0x5b38cd(0x21a)](_0x2895b6),{'verbose':_0x3043a3[_0x5b38cd(0x1d5)]}),_0x3f82c4=_0x4f92a0[_0x5b38cd(0x25a)],_0x532c69=_0x37f107[_0x5b38cd(0x19c)][_0x5b38cd(0x147)](_0x3f82c4);if(_0x300d25[_0x5b38cd(0x137)]){const _0x46ea80=await this['collectSchema'](_0x1fe01b,_0x2895b6,_0x3f82c4,_0x532c69),_0x79dd62=this[_0x5b38cd(0x158)](_0x46ea80);writeFileSync(_0x300d25[_0x5b38cd(0x137)],_0x79dd62);const _0x4dfcbb=_0x46ea80[_0x5b38cd(0x25c)]['columns'][_0x5b38cd(0x197)]+_0x46ea80[_0x5b38cd(0x17b)][_0x5b38cd(0x269)]((_0x5dc1e0,_0x4d5a7c)=>_0x5dc1e0+_0x4d5a7c[_0x5b38cd(0x1fe)][_0x5b38cd(0x197)],0x0),_0x1abf2a=_0x46ea80[_0x5b38cd(0x17b)][_0x5b38cd(0x258)](_0x55a8d2=>_0x55a8d2['columns'][_0x5b38cd(0x197)]===0x0)[_0x5b38cd(0x197)];return console[_0x5b38cd(0x27d)](_0x5b38cd(0x15b)+_0x300d25[_0x5b38cd(0x137)]),console[_0x5b38cd(0x27d)](_0x5b38cd(0x227)+_0x532c69),console['log'](_0x5b38cd(0x13f)+_0x46ea80[_0x5b38cd(0x17b)][_0x5b38cd(0x197)]+_0x5b38cd(0x295)),console['log']('\x20\x20Columns:\x20'+_0x4dfcbb+_0x5b38cd(0x19f)),_0x1abf2a>0x0&&console[_0x5b38cd(0x27d)](_0x5b38cd(0x213)+_0x1abf2a+'\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)'),0x0;}console[_0x5b38cd(0x1f6)]('\x0a'+a30_0x2ae559['bold']('Output\x20Database:')+'\x20'+a30_0x2ae559['cyan'](_0x532c69));const _0x27f995=await withSpinner(_0x5b38cd(0x17e),()=>_0x37f107['segment']['getParentSQL'](_0x3f82c4),{'verbose':_0x3043a3[_0x5b38cd(0x1d5)]});console[_0x5b38cd(0x1f6)]('\x0a'+a30_0x2ae559['bold']('customers')+'\x20'+a30_0x2ae559[_0x5b38cd(0x2c4)]('('+_0x532c69+'.customers)'));const _0x6a3552=await executeSchemaQuery(_0x27f995[_0x5b38cd(0x25a)],_0x37f107,_0x3043a3);await handleQueryOutput(_0x6a3552,_0x3043a3);const _0x25eb71=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x37f107[_0x5b38cd(0x19c)][_0x5b38cd(0x157)](_0x3f82c4),{'verbose':_0x3043a3['verbose']});for(const _0x10b54a of _0x25eb71['data']){const _0x3f19f0=_0x5b38cd(0x248)+_0x10b54a[_0x5b38cd(0x184)]()[_0x5b38cd(0x14a)](/\s+/g,'_'),_0x26e3a0=_0x5b38cd(0x2ac)+_0x532c69+'.'+_0x3f19f0;console['error']('\x0a'+a30_0x2ae559['bold'](_0x10b54a)+'\x20'+a30_0x2ae559[_0x5b38cd(0x2c4)]('('+_0x532c69+'.'+_0x3f19f0+')'));try{const _0x203492=await executeSchemaQuery(_0x26e3a0,_0x37f107,_0x3043a3);await handleQueryOutput(_0x203492,_0x3043a3);}catch{console[_0x5b38cd(0x1f6)](a30_0x2ae559[_0x5b38cd(0x1bd)](_0x5b38cd(0x266)));}}return 0x0;}async[a30_0x18fecb(0x171)](_0x46f562,_0x25fbcc,_0x3a89dc,_0x3597e0){const _0x3cfc04=a30_0x18fecb,{options:_0x2b85fd,tdx:_0x2ecd5e}=_0x46f562,_0x944fd5=await withSpinner(_0x3cfc04(0x17e),()=>_0x2ecd5e[_0x3cfc04(0x19c)]['getParentSQL'](_0x3a89dc),{'verbose':_0x2b85fd[_0x3cfc04(0x1d5)]}),_0x23d832=await executeSchemaQuery(_0x944fd5[_0x3cfc04(0x25a)],_0x2ecd5e,_0x2b85fd),_0x580875=_0x23d832[_0x3cfc04(0x25a)][_0x3cfc04(0x2a1)](_0x4182e6=>({'name':_0x4182e6['column_name'],'type':_0x4182e6[_0x3cfc04(0x148)]})),_0x4f5ddb=await withSpinner(_0x3cfc04(0x267),()=>_0x2ecd5e[_0x3cfc04(0x19c)][_0x3cfc04(0x157)](_0x3a89dc),{'verbose':_0x2b85fd[_0x3cfc04(0x1d5)]}),_0x14d323=[];for(const _0x55bc62 of _0x4f5ddb['data']){const _0x3a797d=_0x3cfc04(0x248)+_0x55bc62[_0x3cfc04(0x184)]()['replace'](/\s+/g,'_'),_0x4a4694='SELECT\x20*\x20FROM\x20'+_0x3597e0+'.'+_0x3a797d;let _0x4434d2=[];try{const _0xe55c9c=await executeSchemaQuery(_0x4a4694,_0x2ecd5e,_0x2b85fd);_0x4434d2=_0xe55c9c[_0x3cfc04(0x25a)][_0x3cfc04(0x2a1)](_0xbf8eef=>({'name':_0xbf8eef[_0x3cfc04(0x274)],'type':_0xbf8eef[_0x3cfc04(0x148)]}));}catch{}_0x14d323[_0x3cfc04(0x2b8)]({'table':_0x3a797d,'columns':_0x4434d2});}return{'database':_0x3597e0,'parent_segment':_0x25fbcc,'parent_id':_0x3a89dc,'customers':{'table':_0x3cfc04(0x25c),'columns':_0x580875},'behaviors':_0x14d323};}['formatSchemaJson'](_0x263334){const _0x3f8b77=a30_0x18fecb,_0x34811a=_0x23a733=>{const _0x337e9b=a30_0xee43;if(_0x23a733[_0x337e9b(0x197)]===0x0)return'[]';const _0x328e00=_0x23a733[_0x337e9b(0x2a1)](_0x2f5655=>_0x337e9b(0x142)+_0x2f5655['name']+'\x22,\x20\x22type\x22:\x20\x22'+_0x2f5655[_0x337e9b(0x2c3)]+'\x22\x20}');return'[\x0a'+_0x328e00['join'](',\x0a')+_0x337e9b(0x296);},_0x5e7614=_0x263334['behaviors'][_0x3f8b77(0x2a1)](_0x4ae5fd=>{const _0x10aa75=_0x3f8b77;return _0x10aa75(0x2a8)+_0x4ae5fd[_0x10aa75(0x2b2)]+_0x10aa75(0x185)+_0x34811a(_0x4ae5fd['columns'])[_0x10aa75(0x14a)](/^/gm,'\x20\x20')[_0x10aa75(0x172)]()+_0x10aa75(0x24b);})['join'](',\x0a');return _0x3f8b77(0x285)+_0x263334[_0x3f8b77(0x192)]+_0x3f8b77(0x1bb)+_0x263334[_0x3f8b77(0x13b)]+_0x3f8b77(0x1dc)+_0x263334['parent_id']+_0x3f8b77(0x2c2)+_0x263334['customers'][_0x3f8b77(0x2b2)]+_0x3f8b77(0x16f)+_0x34811a(_0x263334[_0x3f8b77(0x25c)][_0x3f8b77(0x1fe)])[_0x3f8b77(0x14a)](/^/gm,'\x20\x20')[_0x3f8b77(0x172)]()+_0x3f8b77(0x1cf)+_0x5e7614+_0x3f8b77(0x245);}}export class ParentSegmentSQLCommand extends BaseCommand{[a30_0x18fecb(0x281)]='segment:parent:sql';[a30_0x18fecb(0x2b1)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a30_0x18fecb(0x27b)](_0x90660b){const _0x4cd805=a30_0x18fecb,{options:_0x215c42,args:_0x2bcf49,tdx:_0x371b3b}=_0x90660b,_0x22c659=_0x2bcf49[0x0]||_0x215c42[_0x4cd805(0x216)];if(!_0x22c659)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'+_0x4cd805(0x28d)),0x1;_0x215c42[_0x4cd805(0x1d5)]&&(console[_0x4cd805(0x1f6)](_0x4cd805(0x1d9)+_0x215c42[_0x4cd805(0x177)]),console[_0x4cd805(0x1f6)]('Parent\x20segment:\x20'+_0x22c659));const _0x26f54f=await withSpinner(_0x4cd805(0x222)+_0x22c659+_0x4cd805(0x2a3),()=>_0x371b3b[_0x4cd805(0x19c)][_0x4cd805(0x21a)](_0x22c659),{'verbose':_0x215c42[_0x4cd805(0x1d5)]}),_0x58a673=_0x26f54f[_0x4cd805(0x25a)],_0x182c58=await withSpinner(_0x4cd805(0x20c)+_0x22c659+_0x4cd805(0x2a3),()=>_0x371b3b[_0x4cd805(0x19c)][_0x4cd805(0x24f)](_0x58a673),{'verbose':_0x215c42[_0x4cd805(0x1d5)]}),_0x18a65d=_0x182c58['data'];return _0x215c42[_0x4cd805(0x29f)]===_0x4cd805(0x2aa)||_0x215c42[_0x4cd805(0x29f)]==='jsonl'?await handleSDKOutput([{'sql':_0x18a65d}],_0x215c42):console[_0x4cd805(0x27d)](_0x18a65d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x212);['description']='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x3cde15){const _0x491b28=a30_0x18fecb,{options:_0xb1a24f,args:_0x554cfe,tdx:_0x5f45eb}=_0x3cde15,_0x497f68=_0x554cfe[0x0]||_0xb1a24f[_0x491b28(0x216)];if(!_0x497f68)return showParentSegmentNotSetError(_0x491b28(0x2a0)+'\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;_0xb1a24f['verbose']&&(console[_0x491b28(0x1f6)](_0x491b28(0x1d9)+_0xb1a24f[_0x491b28(0x177)]),console[_0x491b28(0x1f6)](_0x491b28(0x1f8)+_0x497f68));const _0x4a2dc2=await withSpinner(_0x491b28(0x222)+_0x497f68+_0x491b28(0x2a3),()=>_0x5f45eb[_0x491b28(0x19c)]['resolveParentId'](_0x497f68),{'verbose':_0xb1a24f[_0x491b28(0x1d5)]}),_0x31c761=_0x4a2dc2[_0x491b28(0x25a)],_0x156308=await withSpinner(_0x491b28(0x20c)+_0x497f68+_0x491b28(0x2a3),()=>_0x5f45eb[_0x491b28(0x19c)][_0x491b28(0x24f)](_0x31c761),{'verbose':_0xb1a24f[_0x491b28(0x1d5)]});let _0x12b93f=_0x156308[_0x491b28(0x25a)];const _0x31e590=resolveLimit(_0xb1a24f[_0x491b28(0x277)],DEFAULT_DISPLAY_LIMIT),_0xe1fd78=/\bLIMIT\s+\d+/i['test'](_0x12b93f);!_0xe1fd78&&(_0x12b93f=_0x12b93f[_0x491b28(0x172)]()['replace'](/;+$/,''),_0x12b93f='SELECT\x20*\x20FROM\x20(\x0a'+_0x12b93f+_0x491b28(0x25d)+_0x31e590);_0xb1a24f[_0x491b28(0x1d5)]&&console[_0x491b28(0x1f6)](_0x491b28(0x2c5)+_0x12b93f);const _0x4315b2=await withProgressSpinner(_0x491b28(0x2be),async _0x562e9a=>{const _0x39c2d6=_0x491b28,_0x4867bb=await _0x5f45eb[_0x39c2d6(0x270)]['execute'](_0x12b93f,{'catalog':'td','schema':_0x39c2d6(0x2a6),'onJobId':_0x288501=>{const _0x2607f9=_0x39c2d6;_0x562e9a[_0x2607f9(0x26c)](_0x288501);}});return _0x4867bb;},{'verbose':_0xb1a24f[_0x491b28(0x1d5)]}),_0x5f270e=_0x4315b2['data'],_0xdd3f01=_0x5f270e[_0x491b28(0x1ba)]?'\x20[Job\x20ID:\x20'+_0x5f270e[_0x491b28(0x1ba)]+']':'';return console[_0x491b28(0x1f6)](_0x491b28(0x1ae)+_0x5f270e[_0x491b28(0x2bb)][_0x491b28(0x230)][_0x491b28(0x22c)]()+_0x491b28(0x1f7)+('in\x20'+formatElapsed(_0x5f270e[_0x491b28(0x2bb)][_0x491b28(0x1a7)])+_0xdd3f01)),await handleQueryOutput(_0x5f270e,_0xb1a24f),0x0;}}export class PSRtListCommand extends BaseCommand{[a30_0x18fecb(0x281)]=a30_0x18fecb(0x1e4);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x1cb);async[a30_0x18fecb(0x27b)](_0x56713c){const _0x16f8d4=a30_0x18fecb,{options:_0x5bf95b,args:_0x318f2d,tdx:_0x5a8f2e}=_0x56713c,_0x2df4aa=_0x318f2d[0x0],_0x27b824=await withSpinner(_0x2df4aa?_0x16f8d4(0x1ad)+_0x2df4aa+_0x16f8d4(0x2a3):_0x16f8d4(0x1c8),()=>_0x5a8f2e[_0x16f8d4(0x18c)]['list'](),{'verbose':_0x5bf95b[_0x16f8d4(0x1d5)]});let _0x4e9820=_0x27b824[_0x16f8d4(0x25a)][_0x16f8d4(0x258)](_0x2660fe=>_0x2660fe[_0x16f8d4(0x178)]);if(_0x2df4aa){const _0x340e5f=_0x2df4aa[_0x16f8d4(0x14a)](/[.+^${}()|[\]\\]/g,_0x16f8d4(0x1a1))['replace'](/\*/g,'.*')[_0x16f8d4(0x14a)](/\?/g,'.'),_0x9811d7=new RegExp('^'+_0x340e5f+'$','i');_0x4e9820=_0x4e9820[_0x16f8d4(0x258)](_0x694c6=>_0x9811d7['test'](_0x694c6[_0x16f8d4(0x281)]));}_0x4e9820[_0x16f8d4(0x170)]((_0x2351b6,_0x26e8a2)=>_0x2351b6[_0x16f8d4(0x281)]['localeCompare'](_0x26e8a2['name'])),console[_0x16f8d4(0x1f6)]('✔\x20Found\x20'+_0x4e9820[_0x16f8d4(0x197)]+_0x16f8d4(0x21b)+(_0x4e9820[_0x16f8d4(0x197)]!==0x1?'s':''));const _0xfadf0=_0x2f4ec8=>{const _0x4fff66=_0x16f8d4;return getConsoleNextUrl(_0x5bf95b[_0x4fff66(0x177)],'/app/dw/parentSegments/'+_0x2f4ec8);};if(_0x5bf95b[_0x16f8d4(0x29f)]===_0x16f8d4(0x2aa)||_0x5bf95b[_0x16f8d4(0x29f)]===_0x16f8d4(0x1a3)){const _0x206739=_0x4e9820['map'](_0x37fbc3=>({..._0x37fbc3,'url':_0xfadf0(_0x37fbc3['id'])}));await handleSDKOutput(_0x206739,_0x5bf95b);}else{if(_0x4e9820[_0x16f8d4(0x197)]===0x0)console[_0x16f8d4(0x27d)](_0x16f8d4(0x252));else for(const _0x209dd8 of _0x4e9820){const _0x1ebddd=_0x209dd8['population']?a30_0x2ae559[_0x16f8d4(0x2c4)]('\x20('+formatRows(_0x209dd8['population'])+')'):'',_0x125ff3=hyperlink(_0x209dd8['name'],_0xfadf0(_0x209dd8['id']));console['log']('⚡\x20'+_0x125ff3+_0x1ebddd);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a30_0x18fecb(0x281)]='ps:rt:validate';['description']=a30_0x18fecb(0x2b4);async[a30_0x18fecb(0x27b)](_0x3c2dfc){const _0x4a22d5=a30_0x18fecb,{options:_0x2486bd,args:_0x4c0e06,tdx:_0x25b196}=_0x3c2dfc,_0x2eebac=_0x4c0e06[0x0]||_0x2486bd[_0x4a22d5(0x216)];if(!_0x2eebac)return showParentSegmentNotSetError(_0x4a22d5(0x21f)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment'),0x1;const _0x3856b5=resolveYamlFile(_0x2eebac);if(!existsSync(_0x3856b5))return showFileNotFoundError(_0x3856b5,_0x2eebac),0x1;let _0x3c0773;try{_0x3c0773=readFileSync(_0x3856b5,_0x4a22d5(0x146));}catch(_0x2c299a){const _0x44083f=_0x2c299a instanceof Error?_0x2c299a[_0x4a22d5(0x1c5)]:String(_0x2c299a);return console[_0x4a22d5(0x1f6)](_0x4a22d5(0x203)+_0x44083f),0x1;}const _0x5286d9=createCommandSpinner(a30_0x2ae559[_0x4a22d5(0x2c4)]('Validating\x20RT\x20configuration...'),{'verbose':_0x2486bd['verbose']});_0x5286d9[_0x4a22d5(0x17c)]();const _0x46115b={'realtime':!![],'onProgress':_0x3a87b9=>{const _0x2b5027=_0x4a22d5;_0x5286d9[_0x2b5027(0x194)]=formatProgressMessage(_0x3a87b9);}};let _0x1a338f;try{_0x1a338f=await _0x25b196[_0x4a22d5(0x19c)][_0x4a22d5(0x15e)](_0x3c0773,_0x46115b),_0x5286d9['stop']();}catch(_0x51c232){_0x5286d9[_0x4a22d5(0x2c0)]();throw _0x51c232;}console[_0x4a22d5(0x1f6)]('\x0a'+a30_0x2ae559[_0x4a22d5(0x23c)](_0x4a22d5(0x260))+'\x20'+_0x1a338f['name']),console[_0x4a22d5(0x1f6)]('═'[_0x4a22d5(0x159)](0x3c)),displayRealtimeValidation(_0x1a338f),console['error']('─'['repeat'](0x3c));if(_0x1a338f[_0x4a22d5(0x14c)]['length']>0x0){console[_0x4a22d5(0x1f6)]('\x0a'+a30_0x2ae559[_0x4a22d5(0x20d)](_0x4a22d5(0x154)));for(const _0x2916a0 of _0x1a338f[_0x4a22d5(0x14c)]){console[_0x4a22d5(0x1f6)]('\x20\x20'+a30_0x2ae559['red']('•')+'\x20'+_0x2916a0);}}return _0x1a338f['allValid']&&console[_0x4a22d5(0x1f6)]('\x0a'+a30_0x2ae559[_0x4a22d5(0x297)]('✔')+_0x4a22d5(0x21d)),_0x1a338f['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a30_0x18fecb(0x243);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x2a9);async['execute'](_0x55eac1){const _0x230447=a30_0x18fecb,{options:_0x200139,args:_0x3cf9d7,tdx:_0x263505}=_0x55eac1,_0x3b08d6=_0x3cf9d7[0x0]||_0x200139['parentSegment'];if(!_0x3b08d6)return showParentSegmentNotSetError(_0x230447(0x1cc)+_0x230447(0x1fa)),0x1;const _0x52b1da=await withSpinner(_0x230447(0x222)+_0x3b08d6+_0x230447(0x2a3),()=>_0x263505[_0x230447(0x19c)][_0x230447(0x21a)](_0x3b08d6),{'verbose':_0x200139['verbose']}),_0x34c919=_0x52b1da[_0x230447(0x25a)],_0x4a18d8=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x3b08d6+'\x27...',()=>_0x263505['personalization'][_0x230447(0x27e)](_0x34c919),{'verbose':_0x200139[_0x230447(0x1d5)]}),_0x6823fa=_0x4a18d8['data'];console[_0x230447(0x1f6)](_0x230447(0x187)+_0x6823fa[_0x230447(0x197)]+_0x230447(0x1b3)+(_0x6823fa['length']!==0x1?'s':''));if(_0x200139[_0x230447(0x29f)]===_0x230447(0x2aa)||_0x200139['format']===_0x230447(0x1a3))await handleSDKOutput(_0x6823fa,_0x200139);else{if(_0x6823fa[_0x230447(0x197)]===0x0)console[_0x230447(0x27d)]('No\x20personalization\x20services\x20configured'),console[_0x230447(0x1f6)](a30_0x2ae559[_0x230447(0x1da)](_0x230447(0x26b)));else for(const _0x542227 of _0x6823fa){const _0x457c78=_0x542227['sections']?.[_0x230447(0x197)]||0x0,_0x11578b=_0x542227[_0x230447(0x1a0)]?a30_0x2ae559['dim'](_0x230447(0x15f)+_0x542227[_0x230447(0x1a0)]):'',_0x55332f=a30_0x2ae559[_0x230447(0x2c4)]('\x20('+_0x457c78+'\x20section'+(_0x457c78!==0x1?'s':'')+')');console['log']('\x20\x20'+_0x542227[_0x230447(0x281)]+_0x11578b+_0x55332f),_0x542227[_0x230447(0x2b1)]&&console[_0x230447(0x27d)](_0x230447(0x16b)+a30_0x2ae559[_0x230447(0x2c4)](_0x542227[_0x230447(0x2b1)]));}}return 0x0;}}function a30_0xee43(_0x189a70,_0x2ab08c){_0x189a70=_0x189a70-0x135;const _0x1ec491=a30_0x1ec4();let _0xee4334=_0x1ec491[_0x189a70];return _0xee4334;}export class PSPzInitCommand extends BaseParentSegmentCommand{['name']=a30_0x18fecb(0x145);[a30_0x18fecb(0x2b1)]=a30_0x18fecb(0x23b);async['execute'](_0x15d466){const _0x33d1e0=a30_0x18fecb,{options:_0x5a9322,args:_0x4549c9}=_0x15d466,_0x4cc330=_0x4549c9[0x0]||_0x5a9322[_0x33d1e0(0x216)];if(!_0x4cc330)return showParentSegmentNotSetError(_0x33d1e0(0x229)+_0x33d1e0(0x22e)),0x1;const _0x4b7414=resolveYamlFile(_0x4cc330);if(!existsSync(_0x4b7414))return showFileNotFoundError(_0x4b7414,_0x4cc330),0x1;let _0x2d2cf8;try{_0x2d2cf8=readFileSync(_0x4b7414,_0x33d1e0(0x146));}catch(_0x56bc0d){const _0x352244=_0x56bc0d instanceof Error?_0x56bc0d[_0x33d1e0(0x1c5)]:String(_0x56bc0d);return console[_0x33d1e0(0x1f6)](_0x33d1e0(0x203)+_0x352244),0x1;}let _0x1fdaef;try{_0x1fdaef=parseDef(_0x2d2cf8);}catch(_0x563f97){const _0x709017=_0x563f97 instanceof Error?_0x563f97[_0x33d1e0(0x1c5)]:String(_0x563f97);return console[_0x33d1e0(0x1f6)](a30_0x2ae559[_0x33d1e0(0x20d)](_0x33d1e0(0x28a)+_0x709017)),0x1;}if(_0x1fdaef[_0x33d1e0(0x1b5)]&&_0x1fdaef[_0x33d1e0(0x1b5)]['length']>0x0)return console[_0x33d1e0(0x1f6)](a30_0x2ae559[_0x33d1e0(0x1bd)](_0x33d1e0(0x163)+_0x4b7414)),console['error'](a30_0x2ae559[_0x33d1e0(0x2c4)]('\x20\x20\x20'+_0x1fdaef[_0x33d1e0(0x1b5)][_0x33d1e0(0x197)]+'\x20service(s)\x20configured')),0x1;!_0x1fdaef['realtime']&&(_0x1fdaef[_0x33d1e0(0x18c)]={'events':[{'name':_0x33d1e0(0x220),'source_table':_0x33d1e0(0x189)}],'attributes':[{'name':'last_page_viewed','type':_0x33d1e0(0x2ad)}],'id_stitching':{'primary_key':_0x1fdaef[_0x33d1e0(0x149)][_0x33d1e0(0x2b2)]===_0x33d1e0(0x25c)?_0x33d1e0(0x242):_0x33d1e0(0x14f)}});_0x1fdaef['personalization_services']=[{'name':_0x33d1e0(0x271),'description':'Personalization\x20service\x20description','trigger_event':_0x33d1e0(0x220),'sections':[{'name':_0x33d1e0(0x20e),'criteria':_0x33d1e0(0x181),'attributes':[_0x33d1e0(0x219)]}]}];const _0x534ef7=serializeDef(_0x1fdaef);return writeFileSync(_0x4b7414,_0x534ef7,_0x33d1e0(0x146)),console[_0x33d1e0(0x1f6)](a30_0x2ae559['green']('✔')+_0x33d1e0(0x1fc)+a30_0x2ae559[_0x33d1e0(0x1da)](_0x4b7414)),(!_0x1fdaef['realtime']||_0x2d2cf8['indexOf'](_0x33d1e0(0x228))===-0x1)&&console['error'](a30_0x2ae559[_0x33d1e0(0x297)]('✔')+_0x33d1e0(0x2af)),console[_0x33d1e0(0x1f6)]('\x0a'+a30_0x2ae559[_0x33d1e0(0x2c4)](_0x33d1e0(0x1ce))),console['error'](_0x33d1e0(0x2c8)+_0x4b7414+_0x33d1e0(0x291)),console[_0x33d1e0(0x1f6)](_0x33d1e0(0x19b)+a30_0x2ae559[_0x33d1e0(0x2c4)]('tdx\x20ps\x20push\x20'+_0x4cc330)+_0x33d1e0(0x13d)),0x0;}}
@@ -1 +1 @@
1
- const a31_0xf5a616=a31_0x460a;(function(_0x3f836e,_0xc10ed8){const _0x2c7558=a31_0x460a,_0x4cfac2=_0x3f836e();while(!![]){try{const _0x5d398e=parseInt(_0x2c7558(0x193))/0x1+parseInt(_0x2c7558(0x1b4))/0x2+parseInt(_0x2c7558(0x184))/0x3+-parseInt(_0x2c7558(0x1c4))/0x4*(-parseInt(_0x2c7558(0x176))/0x5)+parseInt(_0x2c7558(0x1a4))/0x6+parseInt(_0x2c7558(0x1c6))/0x7+parseInt(_0x2c7558(0x1d7))/0x8*(-parseInt(_0x2c7558(0x1c2))/0x9);if(_0x5d398e===_0xc10ed8)break;else _0x4cfac2['push'](_0x4cfac2['shift']());}catch(_0x1dea0e){_0x4cfac2['push'](_0x4cfac2['shift']());}}}(a31_0x3b3d,0xb3d4d));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 a31_0x1f91b8 from'node:path';function a31_0x460a(_0x3576c0,_0x407d89){_0x3576c0=_0x3576c0-0x174;const _0x3b3d86=a31_0x3b3d();let _0x460a45=_0x3b3d86[_0x3576c0];return _0x460a45;}function a31_0x3b3d(){const _0x2f717b=['Setup\x20cancelled','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','profile:use','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','test','(cleared)','2373660TxCSCN','red','48zxlRtj','apikey','5330948zdWXXP','\x20--default\x27\x20to\x20save\x20permanently','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Validating\x20API\x20key...','text','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x27\x20does\x20not\x20exist.','join','\x0aSetup\x20cancelled','logLevel','trim','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','apiKey','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','password','168msRswT','profile:remove','llm_project','Set\x20session\x20profile','540325UVIUOM','execute','\x27\x20removed\x20from\x20configuration','method','(session:\x20','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','profile','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Unknown\x20key\x20\x27','select','getUserInfo','profileName','Profile\x20name\x20cannot\x20be\x20empty','\x20\x20tdx\x20--profile\x20','4294650dytags','\x0aAvailable\x20profiles:','Profile\x20\x27','length','jobs','bold','validate','\x27\x20updated:\x20','Changing\x20site\x20to\x20\x27','description','\x20Profile\x20\x27','includes','create','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','log','1101003uQIUze','site','warn','Choose\x20authentication\x20method:','\x0aOperation\x20cancelled','yellow','split','tdx:\x20profile\x20set','status','oauth','dim','Set\x20a\x20profile\x20configuration\x20value','OAuth\x20(browser\x20login)','profile:set','us01','Create\x20a\x20new\x20profile','message','3553320YGzKZL','/app/mp/ak','ERROR','VALID_KEYS','\x20\x20-\x20','Enter\x20your\x20TD\x20API\x20key:','tdx:\x20profile\x20remove','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','session','green','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','name','\x0aSaved\x20to:\x20','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x27\x20does\x20not\x20exist.\x20Create\x20it?','API\x20key\x20cannot\x20be\x20empty','2184024DHLShT','error','✗\x20Validation\x20failed:\x20','confirm','\x20\x20(no\x20profiles\x20found)','email','config','Site\x20was\x20not\x20changed.'];a31_0x3b3d=function(){return _0x2f717b;};return a31_0x3b3d();}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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}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 a31_0x51f12d from'prompts';import a31_0x272002 from'chalk';function validateProfileName(_0x28b556){const _0x37126d=a31_0x460a;if(!_0x28b556||!_0x28b556[_0x37126d(0x1d0)]())return _0x37126d(0x182);const _0x3ec50f=_0x28b556['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x37126d(0x1c0)](_0x3ec50f))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x3ec50f))return _0x37126d(0x186)+_0x3ec50f+_0x37126d(0x1ab);return!![];}export class ProfileCreateCommand extends BaseCommand{[a31_0xf5a616(0x1af)]='profile:create';[a31_0xf5a616(0x18d)]=a31_0xf5a616(0x1a2);async[a31_0xf5a616(0x177)](_0xda597c){const _0x467df7=a31_0xf5a616,{options:_0x18a518,args:_0x263883}=_0xda597c;console[_0x467df7(0x192)](a31_0x272002[_0x467df7(0x189)]('tdx:\x20profile\x20create'));let _0x9080b;if(_0x263883[_0x467df7(0x187)]>0x0&&_0x263883[0x0]){const _0x19a982=_0x263883[0x0][_0x467df7(0x1d0)](),_0x200c4=validateProfileName(_0x19a982);if(_0x200c4!==!![])return console['error'](a31_0x272002[_0x467df7(0x1c3)](_0x200c4)),0x1;_0x9080b=_0x19a982;}else{const _0x250895=await a31_0x51f12d({'type':'text','name':'profileName','message':'Enter\x20profile\x20name:','validate':validateProfileName});if(!_0x250895[_0x467df7(0x181)])return console[_0x467df7(0x192)](_0x467df7(0x1ce)),0x1;_0x9080b=_0x250895[_0x467df7(0x181)][_0x467df7(0x1d0)]();}const _0x1aafb3=await a31_0x51f12d({'type':_0x467df7(0x1ca),'name':_0x467df7(0x18d),'message':'Enter\x20description\x20(optional):'}),_0x5b7749=_0x1aafb3['description']?.[_0x467df7(0x1d0)]()||undefined,_0x50ea54=_0x18a518['site']||_0x467df7(0x1a1),_0x43f174=await promptSiteSelection(_0x50ea54,_0x9080b,_0x467df7(0x1bc));if(!_0x43f174)return 0x1;const _0x5645dc=resolveSite(_0x43f174);if(isOAuthSupported(_0x5645dc)){const _0x4a3fa3=await a31_0x51f12d({'type':_0x467df7(0x17f),'name':_0x467df7(0x179),'message':_0x467df7(0x196),'choices':[{'title':_0x467df7(0x19f),'value':_0x467df7(0x19c)},{'title':'API\x20Key','value':_0x467df7(0x1c5)}]});if(!_0x4a3fa3[_0x467df7(0x179)])return console[_0x467df7(0x192)]('\x0aSetup\x20cancelled'),0x1;if(_0x4a3fa3[_0x467df7(0x179)]==='oauth'){if(_0x5b7749){const _0xb72499={'site':_0x5645dc,'description':_0x5b7749};saveProfileToUserConfig(_0x9080b,_0xb72499);}return await runOAuthLoginFlow(_0x5645dc,_0x9080b,_0x18a518['logLevel']??LogLevel['ERROR']),0x0;}}console[_0x467df7(0x192)](_0x467df7(0x1d5)+_0x5645dc),console[_0x467df7(0x192)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x5645dc,_0x467df7(0x1a5)));const _0x19e003=await a31_0x51f12d({'type':'password','name':_0x467df7(0x1d2),'message':_0x467df7(0x1a9),'validate':_0x47f95c=>{const _0x21ea84=_0x467df7;if(!_0x47f95c||!_0x47f95c[_0x21ea84(0x1d0)]())return _0x21ea84(0x1b3);return!![];}});if(!_0x19e003[_0x467df7(0x1d2)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x535c70=_0x19e003[_0x467df7(0x1d2)];console[_0x467df7(0x192)](_0x467df7(0x1c9));try{const _0x48bdcb=TDX[_0x467df7(0x190)]({'site':_0x5645dc,'apiKey':_0x535c70[_0x467df7(0x1d0)](),'logLevel':_0x18a518[_0x467df7(0x1cf)]??LogLevel[_0x467df7(0x1a6)]}),_0x4dcf49=await _0x48bdcb[_0x467df7(0x188)][_0x467df7(0x180)]();console['log'](a31_0x272002['green']('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x4dcf49['email']+')');const _0x126a7c=await isKeychainAvailable();_0x126a7c?(await saveAPIKeyAsync(_0x535c70['trim'](),_0x5645dc,_0x9080b),console[_0x467df7(0x192)](a31_0x272002[_0x467df7(0x1ad)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x9080b+')')):(console[_0x467df7(0x195)](a31_0x272002[_0x467df7(0x198)](_0x467df7(0x1bd))),console[_0x467df7(0x195)](a31_0x272002[_0x467df7(0x198)](_0x467df7(0x1d1))));const _0x57271d={'site':_0x5645dc,..._0x5b7749&&{'description':_0x5b7749}};return saveProfileToUserConfig(_0x9080b,_0x57271d),console[_0x467df7(0x192)](a31_0x272002['green']('✓')+_0x467df7(0x18e)+_0x9080b+'\x27\x20created'),console[_0x467df7(0x192)](),console[_0x467df7(0x192)](_0x467df7(0x1c8)),console[_0x467df7(0x192)](_0x467df7(0x183)+_0x9080b+_0x467df7(0x191)),console[_0x467df7(0x192)](_0x467df7(0x183)+_0x9080b+_0x467df7(0x17b)),0x0;}catch(_0x203370){if(_0x203370 instanceof HTTPClientError&&_0x203370[_0x467df7(0x19b)]===0x191)return printAuthError(_0x203370),0x1;return console[_0x467df7(0x1b5)](a31_0x272002['red'](_0x467df7(0x1b6)+(_0x203370 instanceof Error?_0x203370['message']:String(_0x203370)))),console[_0x467df7(0x1b5)](_0x467df7(0x1cb)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0xf5a616(0x1af)]=a31_0xf5a616(0x1d8);[a31_0xf5a616(0x18d)]='Remove\x20a\x20profile';[a31_0xf5a616(0x18a)](_0x218154){const _0x426595=a31_0xf5a616,{args:_0x884e4c}=_0x218154;if(_0x884e4c[_0x426595(0x187)]===0x0)return _0x426595(0x17d);return undefined;}async[a31_0xf5a616(0x177)](_0x44942e){const _0x5eef73=a31_0xf5a616,{args:_0x5ea681}=_0x44942e,_0x430bce=_0x5ea681[0x0];console[_0x5eef73(0x192)](a31_0x272002[_0x5eef73(0x189)](_0x5eef73(0x1aa)));if(!profileExists(_0x430bce)){console[_0x5eef73(0x1b5)](a31_0x272002[_0x5eef73(0x1c3)](_0x5eef73(0x186)+_0x430bce+'\x27\x20does\x20not\x20exist.')),console[_0x5eef73(0x192)](_0x5eef73(0x185));const _0x207483=listProfiles();if(_0x207483[_0x5eef73(0x187)]===0x0)console[_0x5eef73(0x192)](_0x5eef73(0x1b8));else for(const _0x14793e of _0x207483){console[_0x5eef73(0x192)](_0x5eef73(0x1a8)+_0x14793e[_0x5eef73(0x1af)]);}return 0x1;}const _0x14a6c2=await a31_0x51f12d({'type':_0x5eef73(0x1b7),'name':_0x5eef73(0x1b7),'message':_0x5eef73(0x1ae)+_0x430bce+'\x27?','initial':![]});if(!_0x14a6c2[_0x5eef73(0x1b7)])return console[_0x5eef73(0x192)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x430bce),console[_0x5eef73(0x192)](a31_0x272002['green']('✓')+_0x5eef73(0x18e)+_0x430bce+_0x5eef73(0x178));}catch(_0x2bed01){return console[_0x5eef73(0x1b5)](a31_0x272002['red']('Failed\x20to\x20remove\x20profile:\x20'+(_0x2bed01 instanceof Error?_0x2bed01[_0x5eef73(0x1a3)]:String(_0x2bed01)))),0x1;}const _0x25f6db=await isKeychainAvailable();if(_0x25f6db){const _0x4097cc=await deleteKeychainAPIKey(_0x430bce);_0x4097cc&&console['log'](a31_0x272002[_0x5eef73(0x1ad)]('✓')+_0x5eef73(0x1d4));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a31_0xf5a616(0x1af)]=a31_0xf5a616(0x1a0);[a31_0xf5a616(0x18d)]=a31_0xf5a616(0x19e);static ['VALID_KEYS']=[a31_0xf5a616(0x194),'database','parent_segment',a31_0xf5a616(0x174),'llm_agent',a31_0xf5a616(0x18d)];['validate'](_0x531437){const _0x3bb666=a31_0xf5a616,{args:_0x15e23d,options:_0x307cc9}=_0x531437,_0x337c79=_0x307cc9[_0x3bb666(0x17c)]||getActiveProfile();if(!_0x337c79)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(_0x15e23d['length']===0x0)return'Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0x480de4=_0x15e23d[0x0];if(!_0x480de4[_0x3bb666(0x18f)]('='))return _0x3bb666(0x1b1)+ProfileSetCommand['VALID_KEYS'][_0x3bb666(0x1cd)](',\x20');const [_0x5ec6ab]=_0x480de4[_0x3bb666(0x199)]('=',0x2);if(!ProfileSetCommand[_0x3bb666(0x1a7)][_0x3bb666(0x18f)](_0x5ec6ab))return _0x3bb666(0x17e)+_0x5ec6ab+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x3bb666(0x1a7)][_0x3bb666(0x1cd)](',\x20');return undefined;}async[a31_0xf5a616(0x177)](_0x1c95c3){const _0x4d24c7=a31_0xf5a616,{args:_0x303352,options:_0x1ad94f}=_0x1c95c3,_0x416dc4=_0x1ad94f['profile']||getActiveProfile(),[_0x341405,..._0x293056]=_0x303352[0x0][_0x4d24c7(0x199)]('='),_0x3bb4cd=_0x293056[_0x4d24c7(0x1cd)]('=');console[_0x4d24c7(0x192)](a31_0x272002[_0x4d24c7(0x189)](_0x4d24c7(0x19a)));if(!profileExists(_0x416dc4)){const _0x17d019=await a31_0x51f12d({'type':_0x4d24c7(0x1b7),'name':'create','message':'Profile\x20\x27'+_0x416dc4+_0x4d24c7(0x1b2),'initial':!![]});if(!_0x17d019[_0x4d24c7(0x190)])return console[_0x4d24c7(0x192)]('Operation\x20cancelled'),0x1;}const _0x30195=loadProfile(_0x416dc4),_0x1ab601=_0x30195?.[_0x4d24c7(0x1ba)]||{};if(_0x341405===_0x4d24c7(0x194)){const _0x301f6e=resolveSite(_0x3bb4cd);console[_0x4d24c7(0x192)](_0x4d24c7(0x18c)+_0x301f6e+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x4d24c7(0x192)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x4d24c7(0x192)]('\x20\x20'+getConsoleUrl(_0x301f6e,'/app/mp/ak'));const _0x287502=await a31_0x51f12d({'type':_0x4d24c7(0x1d6),'name':'apiKey','message':_0x4d24c7(0x1bf),'validate':_0x55f369=>{const _0x2d1328=_0x4d24c7;if(!_0x55f369||!_0x55f369[_0x2d1328(0x1d0)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x287502[_0x4d24c7(0x1d2)])return console[_0x4d24c7(0x192)](_0x4d24c7(0x197)),0x1;console[_0x4d24c7(0x192)](_0x4d24c7(0x1c9));try{const _0x54d60b=TDX[_0x4d24c7(0x190)]({'site':_0x301f6e,'apiKey':_0x287502[_0x4d24c7(0x1d2)]['trim'](),'logLevel':_0x1ad94f[_0x4d24c7(0x1cf)]??LogLevel[_0x4d24c7(0x1a6)]}),_0x48bf9c=await _0x54d60b[_0x4d24c7(0x188)]['getUserInfo']();console[_0x4d24c7(0x192)](a31_0x272002[_0x4d24c7(0x1ad)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x48bf9c[_0x4d24c7(0x1b9)]+')');const _0x36fb5d=await isKeychainAvailable();_0x36fb5d?(await saveAPIKeyAsync(_0x287502[_0x4d24c7(0x1d2)][_0x4d24c7(0x1d0)](),_0x301f6e,_0x416dc4),console[_0x4d24c7(0x192)](a31_0x272002['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x4d24c7(0x195)](a31_0x272002[_0x4d24c7(0x198)](_0x4d24c7(0x1bd))),_0x1ab601[_0x4d24c7(0x194)]=_0x301f6e;}catch(_0x48b25d){if(_0x48b25d instanceof HTTPClientError&&_0x48b25d[_0x4d24c7(0x19b)]===0x191)return printAuthError(_0x48b25d),0x1;return console[_0x4d24c7(0x1b5)](a31_0x272002['red'](_0x4d24c7(0x1b6)+(_0x48b25d instanceof Error?_0x48b25d[_0x4d24c7(0x1a3)]:String(_0x48b25d)))),console[_0x4d24c7(0x1b5)](_0x4d24c7(0x1bb)),0x1;}}else _0x1ab601[_0x341405]=_0x3bb4cd||undefined;return saveProfileToUserConfig(_0x416dc4,_0x1ab601),console[_0x4d24c7(0x192)](a31_0x272002[_0x4d24c7(0x1ad)]('✓')+'\x20Profile\x20\x27'+_0x416dc4+_0x4d24c7(0x18b)+_0x341405+'='+(_0x3bb4cd||_0x4d24c7(0x1c1))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0xf5a616(0x1af)]=a31_0xf5a616(0x1be);['description']=a31_0xf5a616(0x175);[a31_0xf5a616(0x18a)](_0x2547e2){const _0x3df4c6=a31_0xf5a616,{args:_0x3929a0}=_0x2547e2;if(_0x3929a0[_0x3df4c6(0x187)]===0x0)return _0x3df4c6(0x1d3);return undefined;}async['execute'](_0x26294a){const _0xc96e44=a31_0xf5a616,{args:_0x526039,options:_0x279f04}=_0x26294a,_0x4dd2dd=_0x526039[0x0],_0x25f23e=_0x279f04['default'];cleanExpiredSessions();if(!profileExists(_0x4dd2dd)){console[_0xc96e44(0x1b5)](a31_0x272002[_0xc96e44(0x1c3)](_0xc96e44(0x186)+_0x4dd2dd+_0xc96e44(0x1cc))),console['log'](_0xc96e44(0x185));const _0x5e22dc=listProfiles();if(_0x5e22dc[_0xc96e44(0x187)]===0x0)console['log'](_0xc96e44(0x1b8));else for(const _0x4cf81c of _0x5e22dc){console[_0xc96e44(0x192)]('\x20\x20-\x20'+_0x4cf81c['name']);}return 0x1;}if(_0x25f23e){const _0x2be89c=a31_0x1f91b8[_0xc96e44(0x1cd)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x4dd2dd),console['log']('Default\x20profile\x20set\x20to:\x20'+a31_0x272002[_0xc96e44(0x1ad)](_0x4dd2dd)),console['log'](a31_0x272002['dim'](_0xc96e44(0x1b0)+_0x2be89c)),0x0;}const _0x2d5632=getSessionID(_0x279f04[_0xc96e44(0x1ac)]);return saveSessionContext({'profile':_0x4dd2dd},_0x279f04[_0xc96e44(0x1ac)]),console[_0xc96e44(0x192)]('Session\x20profile\x20set\x20to:\x20'+a31_0x272002[_0xc96e44(0x1ad)](_0x4dd2dd)+'\x20'+a31_0x272002[_0xc96e44(0x19d)](_0xc96e44(0x17a)+_0x2d5632+')')),console['log'](a31_0x272002['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4dd2dd+_0xc96e44(0x1c7))),0x0;}}
1
+ function a31_0x4e7d(_0xbdbed6,_0x361a1b){_0xbdbed6=_0xbdbed6-0x80;const _0x3371f9=a31_0x3371();let _0x4e7dd1=_0x3371f9[_0xbdbed6];return _0x4e7dd1;}const a31_0x254f57=a31_0x4e7d;(function(_0x4b79cc,_0x1187dd){const _0x39bf46=a31_0x4e7d,_0x509d64=_0x4b79cc();while(!![]){try{const _0x55b7c6=-parseInt(_0x39bf46(0xc9))/0x1*(parseInt(_0x39bf46(0xa0))/0x2)+parseInt(_0x39bf46(0xc2))/0x3*(parseInt(_0x39bf46(0xa8))/0x4)+parseInt(_0x39bf46(0xb3))/0x5*(parseInt(_0x39bf46(0xbb))/0x6)+parseInt(_0x39bf46(0xbc))/0x7*(-parseInt(_0x39bf46(0xc3))/0x8)+-parseInt(_0x39bf46(0xe7))/0x9*(-parseInt(_0x39bf46(0xef))/0xa)+-parseInt(_0x39bf46(0xcc))/0xb+-parseInt(_0x39bf46(0xde))/0xc;if(_0x55b7c6===_0x1187dd)break;else _0x509d64['push'](_0x509d64['shift']());}catch(_0x949bdd){_0x509d64['push'](_0x509d64['shift']());}}}(a31_0x3371,0x1cb2d));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 a31_0xcd274e from'node:path';function a31_0x3371(){const _0x30cc0b=['name','warn','Unknown\x20key\x20\x27','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Enter\x20description\x20(optional):','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','length','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x27\x20does\x20not\x20exist.\x20Create\x20it?','profile:use','oauth','\x20API\x20key\x20removed\x20from\x20system\x20keychain','\x27\x20created','log','OAuth\x20(browser\x20login)','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','error','\x20API\x20key\x20is\x20valid\x20(User:\x20','split','VALID_KEYS','✗\x20Validation\x20failed:\x20','\x20--default\x27\x20to\x20save\x20permanently','Failed\x20to\x20remove\x20profile:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','description','Enter\x20profile\x20name:','\x20Profile\x20\x27','tdx:\x20profile\x20set','Profile\x20\x27','84962jKFFvE','\x0aAvailable\x20profiles:','You\x20can\x20find\x20your\x20API\x20key\x20at:','status','Default\x20profile\x20set\x20to:\x20','Validating\x20API\x20key...','message','Site\x20was\x20not\x20changed.','788692HOvMUG','Set\x20session\x20profile','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','red','profile:remove','parent_segment','yellow','apiKey','default','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','65iPlwgs','method','text','profile:set','\x0aOperation\x20cancelled','llm_agent','session','getUserInfo','87852mjUEIF','1000867oNVAgj','database','jobs','Operation\x20cancelled','\x27.\x0a\x0aValid\x20keys:\x20','(session:\x20','3pPMvBH','8AlLiVq','select','Choose\x20authentication\x20method:','logLevel','config','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','2PzDAsR','Session\x20profile\x20set\x20to:\x20','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','1196096hAyxmI','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','site','\x0aSaved\x20to:\x20','\x27\x20updated:\x20','tdx.json','Removal\x20cancelled','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>','validate','confirm','create','\x20\x20(no\x20profiles\x20found)','ERROR','dim','\x0aSetup\x20cancelled','includes','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20does\x20not\x20exist.','384036siSLJh','\x20API\x20key\x20saved\x20to\x20system\x20keychain','\x20\x20-\x20','/app/mp/ak','\x20\x20tdx\x20--profile\x20','profile','Create\x20a\x20new\x20profile','execute','profileName','1944EoJptS','Changing\x20site\x20to\x20\x27','trim','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20remove','password','llm_project','green','4570nOIuYJ','Profile\x20name\x20cannot\x20be\x20empty','join','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'];a31_0x3371=function(){return _0x30cc0b;};return a31_0x3371();}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{runOAuthLoginFlow}from'./auth-login-command.js';import{isOAuthSupported}from'../core/oauth.js';import{promptSiteSelection}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 a31_0x4d8956 from'prompts';import a31_0x11c719 from'chalk';function validateProfileName(_0x12e665){const _0x25f469=a31_0x4e7d;if(!_0x12e665||!_0x12e665['trim']())return _0x25f469(0x80);const _0x3f4c13=_0x12e665[_0x25f469(0xe9)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x3f4c13))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x3f4c13))return'Profile\x20\x27'+_0x3f4c13+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';['description']=a31_0x254f57(0xe4);async[a31_0x254f57(0xe5)](_0x22bb5a){const _0x459dc7=a31_0x254f57,{options:_0x569ec1,args:_0x38884b}=_0x22bb5a;console['log'](a31_0x11c719['bold']('tdx:\x20profile\x20create'));let _0x4bdfbc;if(_0x38884b['length']>0x0&&_0x38884b[0x0]){const _0x3c2a0d=_0x38884b[0x0][_0x459dc7(0xe9)](),_0x89eaf1=validateProfileName(_0x3c2a0d);if(_0x89eaf1!==!![])return console[_0x459dc7(0x93)](a31_0x11c719[_0x459dc7(0xac)](_0x89eaf1)),0x1;_0x4bdfbc=_0x3c2a0d;}else{const _0x6da4aa=await a31_0x4d8956({'type':_0x459dc7(0xb5),'name':_0x459dc7(0xe6),'message':_0x459dc7(0x9c),'validate':validateProfileName});if(!_0x6da4aa[_0x459dc7(0xe6)])return console['log'](_0x459dc7(0xda)),0x1;_0x4bdfbc=_0x6da4aa['profileName'][_0x459dc7(0xe9)]();}const _0x52259a=await a31_0x4d8956({'type':_0x459dc7(0xb5),'name':_0x459dc7(0x9b),'message':_0x459dc7(0x87)}),_0x41bada=_0x52259a['description']?.[_0x459dc7(0xe9)]()||undefined,_0x332d9d=_0x569ec1[_0x459dc7(0xce)]||'us01',_0x13b6cf=await promptSiteSelection(_0x332d9d,_0x4bdfbc,'Setup\x20cancelled');if(!_0x13b6cf)return 0x1;const _0x23e392=resolveSite(_0x13b6cf);if(isOAuthSupported(_0x23e392)){const _0x5e5901=await a31_0x4d8956({'type':_0x459dc7(0xc4),'name':_0x459dc7(0xb4),'message':_0x459dc7(0xc5),'choices':[{'title':_0x459dc7(0x91),'value':_0x459dc7(0x8d)},{'title':'API\x20Key','value':'apikey'}]});if(!_0x5e5901[_0x459dc7(0xb4)])return console[_0x459dc7(0x90)](_0x459dc7(0xda)),0x1;if(_0x5e5901[_0x459dc7(0xb4)]===_0x459dc7(0x8d)){if(_0x41bada){const _0x4d9aff={'site':_0x23e392,'description':_0x41bada};saveProfileToUserConfig(_0x4bdfbc,_0x4d9aff);}return await runOAuthLoginFlow(_0x23e392,_0x4bdfbc,_0x569ec1['logLevel']??LogLevel[_0x459dc7(0xd8)]),0x0;}}console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x23e392),console['log'](_0x459dc7(0xa2)),console[_0x459dc7(0x90)]('\x20\x20'+getConsoleUrl(_0x23e392,_0x459dc7(0xe1)));const _0x512f70=await a31_0x4d8956({'type':_0x459dc7(0xec),'name':_0x459dc7(0xb0),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x22447e=>{const _0xd780f=_0x459dc7;if(!_0x22447e||!_0x22447e[_0xd780f(0xe9)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x512f70[_0x459dc7(0xb0)])return console['log']('\x0aSetup\x20cancelled'),0x1;const _0x49f7a6=_0x512f70[_0x459dc7(0xb0)];console[_0x459dc7(0x90)](_0x459dc7(0xa5));try{const _0x13db85=TDX[_0x459dc7(0xd6)]({'site':_0x23e392,'apiKey':_0x49f7a6[_0x459dc7(0xe9)](),'logLevel':_0x569ec1['logLevel']??LogLevel[_0x459dc7(0xd8)]}),_0x373c21=await _0x13db85['jobs'][_0x459dc7(0xba)]();console[_0x459dc7(0x90)](a31_0x11c719[_0x459dc7(0xee)]('✓')+_0x459dc7(0x94)+_0x373c21['email']+')');const _0x3385d8=await isKeychainAvailable();_0x3385d8?(await saveAPIKeyAsync(_0x49f7a6[_0x459dc7(0xe9)](),_0x23e392,_0x4bdfbc),console[_0x459dc7(0x90)](a31_0x11c719[_0x459dc7(0xee)]('✓')+_0x459dc7(0xcd)+_0x4bdfbc+')')):(console[_0x459dc7(0x84)](a31_0x11c719[_0x459dc7(0xaf)](_0x459dc7(0xcb))),console[_0x459dc7(0x84)](a31_0x11c719[_0x459dc7(0xaf)](_0x459dc7(0x9a))));const _0x2c6840={'site':_0x23e392,..._0x41bada&&{'description':_0x41bada}};return saveProfileToUserConfig(_0x4bdfbc,_0x2c6840),console[_0x459dc7(0x90)](a31_0x11c719[_0x459dc7(0xee)]('✓')+'\x20Profile\x20\x27'+_0x4bdfbc+_0x459dc7(0x8f)),console[_0x459dc7(0x90)](),console[_0x459dc7(0x90)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x459dc7(0x90)](_0x459dc7(0xe2)+_0x4bdfbc+_0x459dc7(0xb2)),console['log'](_0x459dc7(0xe2)+_0x4bdfbc+_0x459dc7(0x82)),0x0;}catch(_0x407b92){if(_0x407b92 instanceof HTTPClientError&&_0x407b92[_0x459dc7(0xa3)]===0x191)return printAuthError(_0x407b92),0x1;return console[_0x459dc7(0x93)](a31_0x11c719[_0x459dc7(0xac)](_0x459dc7(0x97)+(_0x407b92 instanceof Error?_0x407b92[_0x459dc7(0xa6)]:String(_0x407b92)))),console['error']('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a31_0x254f57(0x83)]=a31_0x254f57(0xad);[a31_0x254f57(0x9b)]='Remove\x20a\x20profile';[a31_0x254f57(0xd4)](_0x2245e9){const _0x3f5329=a31_0x254f57,{args:_0x3e0b42}=_0x2245e9;if(_0x3e0b42[_0x3f5329(0x89)]===0x0)return _0x3f5329(0x8a);return undefined;}async['execute'](_0x33cfa0){const _0x2a8863=a31_0x254f57,{args:_0x572f41}=_0x33cfa0,_0x597899=_0x572f41[0x0];console[_0x2a8863(0x90)](a31_0x11c719[_0x2a8863(0xaa)](_0x2a8863(0xeb)));if(!profileExists(_0x597899)){console[_0x2a8863(0x93)](a31_0x11c719[_0x2a8863(0xac)]('Profile\x20\x27'+_0x597899+_0x2a8863(0xdd))),console[_0x2a8863(0x90)](_0x2a8863(0xa1));const _0x1248cd=listProfiles();if(_0x1248cd[_0x2a8863(0x89)]===0x0)console[_0x2a8863(0x90)](_0x2a8863(0xd7));else for(const _0x4a0406 of _0x1248cd){console['log']('\x20\x20-\x20'+_0x4a0406['name']);}return 0x1;}const _0x552fa2=await a31_0x4d8956({'type':_0x2a8863(0xd5),'name':'confirm','message':_0x2a8863(0x92)+_0x597899+'\x27?','initial':![]});if(!_0x552fa2[_0x2a8863(0xd5)])return console[_0x2a8863(0x90)](_0x2a8863(0xd2)),0x0;try{removeProfileFromUserConfig(_0x597899),console[_0x2a8863(0x90)](a31_0x11c719['green']('✓')+_0x2a8863(0x9d)+_0x597899+_0x2a8863(0xea));}catch(_0x2eddf9){return console[_0x2a8863(0x93)](a31_0x11c719[_0x2a8863(0xac)](_0x2a8863(0x99)+(_0x2eddf9 instanceof Error?_0x2eddf9['message']:String(_0x2eddf9)))),0x1;}const _0x33cc5c=await isKeychainAvailable();if(_0x33cc5c){const _0x2b40f6=await deleteKeychainAPIKey(_0x597899);_0x2b40f6&&console[_0x2a8863(0x90)](a31_0x11c719['green']('✓')+_0x2a8863(0x8e));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a31_0x254f57(0xb6);[a31_0x254f57(0x9b)]='Set\x20a\x20profile\x20configuration\x20value';static [a31_0x254f57(0x96)]=['site',a31_0x254f57(0xbd),a31_0x254f57(0xae),a31_0x254f57(0xed),a31_0x254f57(0xb8),'description'];[a31_0x254f57(0xd4)](_0x224fad){const _0x142111=a31_0x254f57,{args:_0xed508e,options:_0x4a0f86}=_0x224fad,_0xb3800a=_0x4a0f86[_0x142111(0xe3)]||getActiveProfile();if(!_0xb3800a)return _0x142111(0xd3);if(_0xed508e[_0x142111(0x89)]===0x0)return _0x142111(0x88)+ProfileSetCommand[_0x142111(0x96)]['join'](',\x20');const _0xd1b49a=_0xed508e[0x0];if(!_0xd1b49a[_0x142111(0xdb)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x142111(0x96)][_0x142111(0x81)](',\x20');const [_0x49105a]=_0xd1b49a[_0x142111(0x95)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS'][_0x142111(0xdb)](_0x49105a))return _0x142111(0x85)+_0x49105a+_0x142111(0xc0)+ProfileSetCommand['VALID_KEYS'][_0x142111(0x81)](',\x20');return undefined;}async[a31_0x254f57(0xe5)](_0x34a972){const _0x5a03a=a31_0x254f57,{args:_0x455848,options:_0x1c7fa7}=_0x34a972,_0x4b06ad=_0x1c7fa7[_0x5a03a(0xe3)]||getActiveProfile(),[_0x312d72,..._0xb28201]=_0x455848[0x0][_0x5a03a(0x95)]('='),_0x31bbcb=_0xb28201['join']('=');console['log'](a31_0x11c719[_0x5a03a(0xaa)](_0x5a03a(0x9e)));if(!profileExists(_0x4b06ad)){const _0x371f7d=await a31_0x4d8956({'type':_0x5a03a(0xd5),'name':_0x5a03a(0xd6),'message':'Profile\x20\x27'+_0x4b06ad+_0x5a03a(0x8b),'initial':!![]});if(!_0x371f7d[_0x5a03a(0xd6)])return console[_0x5a03a(0x90)](_0x5a03a(0xbf)),0x1;}const _0x40b9a2=loadProfile(_0x4b06ad),_0x198e42=_0x40b9a2?.[_0x5a03a(0xc7)]||{};if(_0x312d72==='site'){const _0x18fa13=resolveSite(_0x31bbcb);console[_0x5a03a(0x90)](_0x5a03a(0xe8)+_0x18fa13+_0x5a03a(0xdc)),console[_0x5a03a(0x90)](_0x5a03a(0x86)),console[_0x5a03a(0x90)]('\x20\x20'+getConsoleUrl(_0x18fa13,_0x5a03a(0xe1)));const _0x2f150a=await a31_0x4d8956({'type':_0x5a03a(0xec),'name':_0x5a03a(0xb0),'message':_0x5a03a(0xc8),'validate':_0x300436=>{const _0x5995ad=_0x5a03a;if(!_0x300436||!_0x300436[_0x5995ad(0xe9)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2f150a[_0x5a03a(0xb0)])return console[_0x5a03a(0x90)](_0x5a03a(0xb7)),0x1;console['log'](_0x5a03a(0xa5));try{const _0x9403a2=TDX[_0x5a03a(0xd6)]({'site':_0x18fa13,'apiKey':_0x2f150a[_0x5a03a(0xb0)][_0x5a03a(0xe9)](),'logLevel':_0x1c7fa7[_0x5a03a(0xc6)]??LogLevel['ERROR']}),_0x32301d=await _0x9403a2[_0x5a03a(0xbe)][_0x5a03a(0xba)]();console['log'](a31_0x11c719[_0x5a03a(0xee)]('✓')+_0x5a03a(0x94)+_0x32301d['email']+')');const _0x20eeea=await isKeychainAvailable();_0x20eeea?(await saveAPIKeyAsync(_0x2f150a[_0x5a03a(0xb0)][_0x5a03a(0xe9)](),_0x18fa13,_0x4b06ad),console[_0x5a03a(0x90)](a31_0x11c719[_0x5a03a(0xee)]('✓')+_0x5a03a(0xdf))):console[_0x5a03a(0x84)](a31_0x11c719[_0x5a03a(0xaf)](_0x5a03a(0xcb))),_0x198e42[_0x5a03a(0xce)]=_0x18fa13;}catch(_0x2a996f){if(_0x2a996f instanceof HTTPClientError&&_0x2a996f[_0x5a03a(0xa3)]===0x191)return printAuthError(_0x2a996f),0x1;return console[_0x5a03a(0x93)](a31_0x11c719[_0x5a03a(0xac)](_0x5a03a(0x97)+(_0x2a996f instanceof Error?_0x2a996f[_0x5a03a(0xa6)]:String(_0x2a996f)))),console[_0x5a03a(0x93)](_0x5a03a(0xa7)),0x1;}}else _0x198e42[_0x312d72]=_0x31bbcb||undefined;return saveProfileToUserConfig(_0x4b06ad,_0x198e42),console['log'](a31_0x11c719[_0x5a03a(0xee)]('✓')+'\x20Profile\x20\x27'+_0x4b06ad+_0x5a03a(0xd0)+_0x312d72+'='+(_0x31bbcb||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{[a31_0x254f57(0x83)]=a31_0x254f57(0x8c);[a31_0x254f57(0x9b)]=a31_0x254f57(0xa9);[a31_0x254f57(0xd4)](_0x45edfd){const _0x4f5174=a31_0x254f57,{args:_0x5b3eff}=_0x45edfd;if(_0x5b3eff['length']===0x0)return _0x4f5174(0xab);return undefined;}async['execute'](_0x300664){const _0x13212e=a31_0x254f57,{args:_0x49f368,options:_0x56e288}=_0x300664,_0xeeea29=_0x49f368[0x0],_0x293768=_0x56e288[_0x13212e(0xb1)];cleanExpiredSessions();if(!profileExists(_0xeeea29)){console[_0x13212e(0x93)](a31_0x11c719[_0x13212e(0xac)](_0x13212e(0x9f)+_0xeeea29+_0x13212e(0xdd))),console['log'](_0x13212e(0xa1));const _0x3bc142=listProfiles();if(_0x3bc142[_0x13212e(0x89)]===0x0)console['log'](_0x13212e(0xd7));else for(const _0x271cef of _0x3bc142){console[_0x13212e(0x90)](_0x13212e(0xe0)+_0x271cef[_0x13212e(0x83)]);}return 0x1;}if(_0x293768){const _0x1d95a5=a31_0xcd274e[_0x13212e(0x81)](getConfigDir(),_0x13212e(0xd1));return saveActiveProfileToUserConfig(_0xeeea29),console[_0x13212e(0x90)](_0x13212e(0xa4)+a31_0x11c719['green'](_0xeeea29)),console['log'](a31_0x11c719[_0x13212e(0xd9)](_0x13212e(0xcf)+_0x1d95a5)),0x0;}const _0x24831c=getSessionID(_0x56e288[_0x13212e(0xb9)]);return saveSessionContext({'profile':_0xeeea29},_0x56e288[_0x13212e(0xb9)]),console[_0x13212e(0x90)](_0x13212e(0xca)+a31_0x11c719[_0x13212e(0xee)](_0xeeea29)+'\x20'+a31_0x11c719[_0x13212e(0xd9)](_0x13212e(0xc1)+_0x24831c+')')),console[_0x13212e(0x90)](a31_0x11c719['dim']('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0xeeea29+_0x13212e(0x98))),0x0;}}
@@ -1 +1 @@
1
- const a32_0x56e861=a32_0x5403;(function(_0x5cc17b,_0x188758){const _0x13345c=a32_0x5403,_0x505a58=_0x5cc17b();while(!![]){try{const _0x9a6d47=-parseInt(_0x13345c(0x86))/0x1+-parseInt(_0x13345c(0x8e))/0x2*(-parseInt(_0x13345c(0x8f))/0x3)+-parseInt(_0x13345c(0x89))/0x4*(-parseInt(_0x13345c(0x8b))/0x5)+parseInt(_0x13345c(0x9d))/0x6+-parseInt(_0x13345c(0x99))/0x7+-parseInt(_0x13345c(0x8d))/0x8+-parseInt(_0x13345c(0x8c))/0x9;if(_0x9a6d47===_0x188758)break;else _0x505a58['push'](_0x505a58['shift']());}catch(_0x37e8fd){_0x505a58['push'](_0x505a58['shift']());}}}(a32_0x4d1b,0x5ea16));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a32_0x5403(_0x104ecb,_0x3fdb8f){_0x104ecb=_0x104ecb-0x86;const _0x4d1bc1=a32_0x4d1b();let _0x540316=_0x4d1bc1[_0x104ecb];return _0x540316;}import a32_0x1ac844 from'chalk';function a32_0x4d1b(){const _0x1bfd97=['log','site','2088744kFTpXj','config','map','green','213530gaQyOW','message','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','4NNmqxa','dim','3396245ryRAHu','2912904qbfoLb','1958152jTRtIF','120298aaeEJX','9fLZaTG','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','name','description','\x20\x20Global:\x20~/.config/tdx/tdx.json','execute','scope','Error:\x20','👤\x20','error','267813YBekYP','List\x20all\x20available\x20profiles'];a32_0x4d1b=function(){return _0x1bfd97;};return a32_0x4d1b();}export class ProfilesCommand extends BaseCommand{[a32_0x56e861(0x91)]='profiles';['description']=a32_0x56e861(0x9a);async[a32_0x56e861(0x94)](_0x316389){const _0x16c7ae=a32_0x56e861,{options:_0x183c06}=_0x316389;try{const _0x76f5d4=listProfiles(),_0x34d954=getActiveProfile();if(_0x76f5d4['length']===0x0)return console[_0x16c7ae(0x9b)](_0x16c7ae(0x90)),console['log'](_0x16c7ae(0x88)),console[_0x16c7ae(0x9b)](_0x16c7ae(0x93)),0x0;const _0x2ea492=_0x76f5d4[_0x16c7ae(0x9f)](_0x4c9817=>{const _0x31491b=_0x16c7ae,_0x4dd934=_0x4c9817[_0x31491b(0x91)]===_0x34d954,_0x6ed1a7=getProfileParams(_0x4c9817['config']);return{'name':_0x4c9817[_0x31491b(0x91)],'active':_0x4dd934,'scope':_0x4c9817[_0x31491b(0x95)],'description':_0x4c9817[_0x31491b(0x9e)]['description']||'','params':_0x6ed1a7};});if(isStructuredFormat(_0x183c06))await handleSDKOutput(_0x2ea492,_0x183c06);else for(const _0x53b44e of _0x76f5d4){const _0x534ccb=_0x53b44e['name']===_0x34d954?a32_0x1ac844[_0x16c7ae(0xa0)]('\x20✓'):'',_0x3504e3=_0x53b44e[_0x16c7ae(0x9e)][_0x16c7ae(0x9c)]?a32_0x1ac844['dim']('\x20'+_0x53b44e[_0x16c7ae(0x9e)][_0x16c7ae(0x9c)]):'',_0x5130b6=_0x53b44e[_0x16c7ae(0x9e)][_0x16c7ae(0x92)]?a32_0x1ac844[_0x16c7ae(0x8a)]('\x20\x20'+_0x53b44e[_0x16c7ae(0x9e)][_0x16c7ae(0x92)]):'';console[_0x16c7ae(0x9b)](_0x16c7ae(0x97)+_0x53b44e[_0x16c7ae(0x91)]+_0x534ccb+_0x3504e3+_0x5130b6);}return 0x0;}catch(_0x485237){return _0x485237 instanceof Error&&console[_0x16c7ae(0x98)](_0x16c7ae(0x96)+_0x485237[_0x16c7ae(0x87)]),0x1;}}}
1
+ const a32_0x5dbf1e=a32_0x17c1;(function(_0x406443,_0x158deb){const _0x1ff7c5=a32_0x17c1,_0x25e7ba=_0x406443();while(!![]){try{const _0x22fe9b=parseInt(_0x1ff7c5(0x146))/0x1+parseInt(_0x1ff7c5(0x144))/0x2+-parseInt(_0x1ff7c5(0x152))/0x3*(-parseInt(_0x1ff7c5(0x13a))/0x4)+-parseInt(_0x1ff7c5(0x139))/0x5*(-parseInt(_0x1ff7c5(0x145))/0x6)+-parseInt(_0x1ff7c5(0x14d))/0x7*(parseInt(_0x1ff7c5(0x13f))/0x8)+-parseInt(_0x1ff7c5(0x147))/0x9+parseInt(_0x1ff7c5(0x148))/0xa*(-parseInt(_0x1ff7c5(0x151))/0xb);if(_0x22fe9b===_0x158deb)break;else _0x25e7ba['push'](_0x25e7ba['shift']());}catch(_0x8cbdcd){_0x25e7ba['push'](_0x25e7ba['shift']());}}}(a32_0x409e,0x1f79f));function a32_0x17c1(_0xcc50ce,_0x10a3e){_0xcc50ce=_0xcc50ce-0x138;const _0x409ec7=a32_0x409e();let _0x17c128=_0x409ec7[_0xcc50ce];return _0x17c128;}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import a32_0x41b0f6 from'chalk';function a32_0x409e(){const _0x4442bc=['\x20\x20Global:\x20~/.config/tdx/tdx.json','length','11AUklFU','42wVsSaP','profiles','log','290395lKTJwv','72764hcJUrf','map','execute','name','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','216616dwUdRm','Error:\x20','dim','👤\x20','config','140808mGRAkv','18YqulXj','211668xPhpKN','419724YZBauD','2917270nkLoeP','scope','description','error','green','63pztVSy','List\x20all\x20available\x20profiles'];a32_0x409e=function(){return _0x4442bc;};return a32_0x409e();}export class ProfilesCommand extends BaseCommand{[a32_0x5dbf1e(0x13d)]=a32_0x5dbf1e(0x153);[a32_0x5dbf1e(0x14a)]=a32_0x5dbf1e(0x14e);async[a32_0x5dbf1e(0x13c)](_0x4f2a9f){const _0x178d13=a32_0x5dbf1e,{options:_0xb1a65b}=_0x4f2a9f;try{const _0x4e3c49=listProfiles(),_0x5a695f=getActiveProfile();if(_0x4e3c49[_0x178d13(0x150)]===0x0)return console[_0x178d13(0x138)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console[_0x178d13(0x138)](_0x178d13(0x13e)),console[_0x178d13(0x138)](_0x178d13(0x14f)),0x0;const _0x2a6502=_0x4e3c49[_0x178d13(0x13b)](_0x29cdfc=>{const _0x41299b=_0x178d13,_0x24aab1=_0x29cdfc[_0x41299b(0x13d)]===_0x5a695f,_0x370dc1=getProfileParams(_0x29cdfc[_0x41299b(0x143)]);return{'name':_0x29cdfc['name'],'active':_0x24aab1,'scope':_0x29cdfc[_0x41299b(0x149)],'description':_0x29cdfc[_0x41299b(0x143)]['description']||'','params':_0x370dc1};});if(isStructuredFormat(_0xb1a65b))await handleSDKOutput(_0x2a6502,_0xb1a65b);else for(const _0x174aa2 of _0x4e3c49){const _0x22248b=_0x174aa2[_0x178d13(0x13d)]===_0x5a695f?a32_0x41b0f6[_0x178d13(0x14c)]('\x20✓'):'',_0x165090=_0x174aa2[_0x178d13(0x143)]['site']?a32_0x41b0f6[_0x178d13(0x141)]('\x20'+_0x174aa2[_0x178d13(0x143)]['site']):'',_0x26d8c9=_0x174aa2[_0x178d13(0x143)][_0x178d13(0x14a)]?a32_0x41b0f6[_0x178d13(0x141)]('\x20\x20'+_0x174aa2[_0x178d13(0x143)]['description']):'';console[_0x178d13(0x138)](_0x178d13(0x142)+_0x174aa2[_0x178d13(0x13d)]+_0x22248b+_0x165090+_0x26d8c9);}return 0x0;}catch(_0x5f242c){return _0x5f242c instanceof Error&&console[_0x178d13(0x14b)](_0x178d13(0x140)+_0x5f242c['message']),0x1;}}}
@@ -1 +1 @@
1
- const a33_0x6bebf6=a33_0x4882;(function(_0x31128a,_0x14b8f7){const _0xe82fd7=a33_0x4882,_0x4b2f73=_0x31128a();while(!![]){try{const _0x37dd0d=parseInt(_0xe82fd7(0x1fe))/0x1*(-parseInt(_0xe82fd7(0x1fb))/0x2)+-parseInt(_0xe82fd7(0x202))/0x3+-parseInt(_0xe82fd7(0x20f))/0x4+-parseInt(_0xe82fd7(0x207))/0x5+parseInt(_0xe82fd7(0x1e6))/0x6*(parseInt(_0xe82fd7(0x210))/0x7)+parseInt(_0xe82fd7(0x208))/0x8*(-parseInt(_0xe82fd7(0x1f6))/0x9)+parseInt(_0xe82fd7(0x1e8))/0xa;if(_0x37dd0d===_0x14b8f7)break;else _0x4b2f73['push'](_0x4b2f73['shift']());}catch(_0x740c13){_0x4b2f73['push'](_0x4b2f73['shift']());}}}(a33_0x338b,0xa47f1));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a33_0x338b(){const _0x36ffcd=['52632180nActun','\x0aAll\x20results\x20saved\x20to\x20','No\x20SQL\x20provided','state','SQL:\x20','Query\x20completed:\x20Processed\x20','Executing\x20query...','Executing\x20statement\x20','setPhase','\x20-\x20','Executing\x20query\x20[','in\x20','validate','information_schema','63WYdyND','file','processedRows','message','\x20rows\x20','14054dfZyqw','Error:\x20','completedSplits','71LtRIcM','totalSplits','stats','Site:\x20','3801804UvrhIb','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','verbose','name','setExtra','5628170vnMwVe','1203376vRVmfC','elapsedTimeMillis','Statement\x20','\x20[Job\x20ID:\x20','options','data','originalMessage','2707044RsBMkK','469EpgdRu','output','args','query','length','jobId','Catalog:\x20','execute','site','error','2874KEMVsw','\x20splits'];a33_0x338b=function(){return _0x36ffcd;};return a33_0x338b();}function a33_0x4882(_0x43b61b,_0x54d7af){_0x43b61b=_0x43b61b-0x1e0;const _0x338bc1=a33_0x338b();let _0x4882f6=_0x338bc1[_0x43b61b];return _0x4882f6;}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';export class QueryCommand extends BaseCommand{[a33_0x6bebf6(0x205)]=a33_0x6bebf6(0x213);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a33_0x6bebf6(0x1e3)](_0x36608b){const _0x1bfd40=a33_0x6bebf6,{options:_0x5131f0,args:_0xa39e45,tdx:_0x228e90}=_0x36608b,_0x20fff3={..._0x5131f0,'limitStructuredFormats':!![]},_0x5bebf0=_0xa39e45[0x0],_0x2cd752=_0x5131f0[_0x1bfd40(0x1f7)];let _0x29ed8f;try{if(_0x2cd752)_0x29ed8f=readSqlStatementsFromFile(_0x2cd752);else{if(_0x5bebf0==='-')_0x29ed8f=await readSqlStatementsFromStdin();else{if(_0x5bebf0&&isSqlFilePath(_0x5bebf0))_0x29ed8f=readSqlStatementsFromFile(_0x5bebf0);else{if(_0x5bebf0)_0x29ed8f=splitSqlStatements(_0x5bebf0);else throw new Error(_0x1bfd40(0x1ea));}}}}catch(_0x5e911b){return console[_0x1bfd40(0x1e5)](_0x1bfd40(0x1fc)+_0x5e911b[_0x1bfd40(0x1f9)]),0x1;}const _0x5a142a=_0x5131f0['database']||_0x1bfd40(0x1f5),_0x2e24dd=_0x5131f0['catalog'];try{const _0x46a53d=[],_0x1bf5d8=!!_0x5131f0['output'];for(let _0x4b3358=0x0;_0x4b3358<_0x29ed8f[_0x1bfd40(0x1e0)];_0x4b3358++){const _0x3da074=_0x29ed8f[_0x4b3358],_0x1cc714=_0x4b3358+0x1,_0x1f4724=_0x29ed8f['length'],_0x59f58d=_0x1f4724>0x1;_0x5131f0[_0x1bfd40(0x204)]&&(console[_0x1bfd40(0x1e5)]('\x0a'+(_0x59f58d?_0x1bfd40(0x20a)+_0x1cc714+'/'+_0x1f4724+':':'')),console[_0x1bfd40(0x1e5)](_0x1bfd40(0x201)+_0x5131f0[_0x1bfd40(0x1e4)]),console[_0x1bfd40(0x1e5)](_0x1bfd40(0x1e2)+(_0x2e24dd||'td')),console[_0x1bfd40(0x1e5)]('Schema:\x20'+_0x5a142a),console[_0x1bfd40(0x1e5)](_0x1bfd40(0x1ec)+_0x3da074));const _0xe9cf3c=_0x59f58d?_0x1bfd40(0x1ef)+_0x1cc714+'/'+_0x1f4724+'...':_0x1bfd40(0x1ee);try{const _0x3833e2=await withProgressSpinner(_0xe9cf3c,async _0x1c4b0c=>{const _0x461434=_0x1bfd40,_0x5b0be0=await _0x228e90['query'][_0x461434(0x1e3)](_0x3da074,{'catalog':_0x2e24dd,'schema':_0x5a142a,'onJobId':_0x4d08ff=>{_0x1c4b0c['setJobId'](_0x4d08ff);},'onProgress':_0x4e3529=>{const _0x4cf778=_0x461434;_0x1c4b0c[_0x4cf778(0x1f0)](_0x4cf778(0x1f2)+_0x4e3529[_0x4cf778(0x1eb)]+']'),_0x1c4b0c[_0x4cf778(0x206)](formatRows(_0x4e3529[_0x4cf778(0x1f8)])+_0x4cf778(0x1fa)+_0x4e3529[_0x4cf778(0x1fd)]+'/'+_0x4e3529[_0x4cf778(0x1ff)]+_0x4cf778(0x1e7));}});return _0x5b0be0;},{'verbose':_0x5131f0['verbose']}),_0x1ab415=_0x3833e2[_0x1bfd40(0x20d)],_0x4f4a64=_0x1ab415[_0x1bfd40(0x1e1)]?_0x1bfd40(0x20b)+_0x1ab415['jobId']+']':'',_0xa2ee86=_0x59f58d?_0x1bfd40(0x20a)+_0x1cc714+'/'+_0x1f4724+_0x1bfd40(0x1f1):'';console['error']('✔\x20'+_0xa2ee86+_0x1bfd40(0x1ed)+formatRows(_0x1ab415[_0x1bfd40(0x200)]['processedRows'])+_0x1bfd40(0x1fa)+(_0x1bfd40(0x1f3)+formatElapsed(_0x1ab415['stats'][_0x1bfd40(0x209)])+_0x4f4a64));if(_0x59f58d&&_0x1bf5d8){const _0x323991=resolveOutputOptions(_0x20fff3),_0x3bbfdd=await formatQueryOutput(_0x1ab415,_0x323991);_0x46a53d['push'](_0x3bbfdd);}else await handleQueryOutput(_0x1ab415,_0x20fff3);}catch(_0x324855){const _0x426c89=_0x59f58d?_0x1bfd40(0x20a)+_0x1cc714+'/'+_0x1f4724+':\x0a':'',_0x449143=_0x324855 instanceof SDKError?_0x324855[_0x1bfd40(0x20e)]:_0x324855[_0x1bfd40(0x1f9)];return console[_0x1bfd40(0x1e5)](''+_0x426c89+_0x449143),0x1;}}if(_0x29ed8f['length']>0x1&&_0x1bf5d8&&_0x46a53d[_0x1bfd40(0x1e0)]>0x0){const _0x345834=_0x46a53d['join']('\x0a');writeFileSync(_0x5131f0['output'],_0x345834),console['error'](_0x1bfd40(0x1e9)+_0x5131f0[_0x1bfd40(0x211)]);}return 0x0;}catch(_0x284275){throw _0x284275;}}[a33_0x6bebf6(0x1f4)](_0x831723){const _0x38ab71=a33_0x6bebf6,_0x335bec=_0x831723[_0x38ab71(0x212)][0x0],_0x121e1b=_0x831723[_0x38ab71(0x20c)]['file'];if(!_0x335bec&&!_0x121e1b)return'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';if(_0x335bec&&_0x121e1b)return _0x38ab71(0x203);return undefined;}}
1
+ const a33_0x5c5a97=a33_0x58a1;(function(_0xe36632,_0x232995){const _0x5bf1a7=a33_0x58a1,_0x3845bf=_0xe36632();while(!![]){try{const _0x2fb82a=-parseInt(_0x5bf1a7(0x1b3))/0x1+parseInt(_0x5bf1a7(0x1c2))/0x2+parseInt(_0x5bf1a7(0x1bb))/0x3*(parseInt(_0x5bf1a7(0x1a0))/0x4)+-parseInt(_0x5bf1a7(0x1ba))/0x5*(parseInt(_0x5bf1a7(0x1b0))/0x6)+parseInt(_0x5bf1a7(0x1b4))/0x7+-parseInt(_0x5bf1a7(0x1c6))/0x8+-parseInt(_0x5bf1a7(0x1b7))/0x9*(-parseInt(_0x5bf1a7(0x19a))/0xa);if(_0x2fb82a===_0x232995)break;else _0x3845bf['push'](_0x3845bf['shift']());}catch(_0x1ff25e){_0x3845bf['push'](_0x3845bf['shift']());}}}(a33_0x32ea,0x61ad7));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';function a33_0x32ea(){const _0x1790f5=['error','setJobId','505376IxkBBE','Schema:\x20','stats','elapsedTimeMillis','5188792DSPkaL','\x20[Job\x20ID:\x20','join','verbose','file','10GgLHik','execute','Executing\x20query\x20[','state','Error:\x20','args','659996Tbtayo','name','message','...','site','Catalog:\x20','data','Run\x20Trino\x20queries\x20(streaming)','\x20rows\x20','jobId','No\x20SQL\x20provided','setPhase','Site:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','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','output','1144182QilTAT','setExtra','information_schema','134111wrEzLb','4196339QalcdT','push','\x0aAll\x20results\x20saved\x20to\x20','236988TXTJnJ','length','in\x20','5lkIDxH','9kVETNZ','validate','processedRows','Statement\x20','options'];a33_0x32ea=function(){return _0x1790f5;};return a33_0x32ea();}function a33_0x58a1(_0x21494a,_0x3ca3b1){_0x21494a=_0x21494a-0x19a;const _0x32ea53=a33_0x32ea();let _0x58a1a3=_0x32ea53[_0x21494a];return _0x58a1a3;}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';export class QueryCommand extends BaseCommand{[a33_0x5c5a97(0x1a1)]='query';['description']=a33_0x5c5a97(0x1a7);async['execute'](_0x3b9eb2){const _0x1aa047=a33_0x5c5a97,{options:_0x362f57,args:_0xbfa757,tdx:_0x50d1f9}=_0x3b9eb2,_0x2f4192={..._0x362f57,'limitStructuredFormats':!![]},_0x2e7d8e=_0xbfa757[0x0],_0xc8c570=_0x362f57['file'];let _0x2a8b8f;try{if(_0xc8c570)_0x2a8b8f=readSqlStatementsFromFile(_0xc8c570);else{if(_0x2e7d8e==='-')_0x2a8b8f=await readSqlStatementsFromStdin();else{if(_0x2e7d8e&&isSqlFilePath(_0x2e7d8e))_0x2a8b8f=readSqlStatementsFromFile(_0x2e7d8e);else{if(_0x2e7d8e)_0x2a8b8f=splitSqlStatements(_0x2e7d8e);else throw new Error(_0x1aa047(0x1aa));}}}}catch(_0x21a862){return console['error'](_0x1aa047(0x19e)+_0x21a862[_0x1aa047(0x1a2)]),0x1;}const _0x24e96c=_0x362f57['database']||_0x1aa047(0x1b2),_0x16938d=_0x362f57['catalog'];try{const _0x54a6c2=[],_0x120891=!!_0x362f57[_0x1aa047(0x1af)];for(let _0x303af3=0x0;_0x303af3<_0x2a8b8f['length'];_0x303af3++){const _0x58336e=_0x2a8b8f[_0x303af3],_0xc66a8e=_0x303af3+0x1,_0x54ce8f=_0x2a8b8f[_0x1aa047(0x1b8)],_0x518470=_0x54ce8f>0x1;_0x362f57[_0x1aa047(0x1c9)]&&(console[_0x1aa047(0x1c0)]('\x0a'+(_0x518470?_0x1aa047(0x1be)+_0xc66a8e+'/'+_0x54ce8f+':':'')),console[_0x1aa047(0x1c0)](_0x1aa047(0x1ac)+_0x362f57[_0x1aa047(0x1a4)]),console[_0x1aa047(0x1c0)](_0x1aa047(0x1a5)+(_0x16938d||'td')),console[_0x1aa047(0x1c0)](_0x1aa047(0x1c3)+_0x24e96c),console[_0x1aa047(0x1c0)]('SQL:\x20'+_0x58336e));const _0x2729e2=_0x518470?'Executing\x20statement\x20'+_0xc66a8e+'/'+_0x54ce8f+_0x1aa047(0x1a3):'Executing\x20query...';try{const _0x2497b4=await withProgressSpinner(_0x2729e2,async _0x550075=>{const _0x42d62d=_0x1aa047,_0x2de12a=await _0x50d1f9['query'][_0x42d62d(0x19b)](_0x58336e,{'catalog':_0x16938d,'schema':_0x24e96c,'onJobId':_0x37cb90=>{const _0x3a5931=_0x42d62d;_0x550075[_0x3a5931(0x1c1)](_0x37cb90);},'onProgress':_0x52ad90=>{const _0x538c38=_0x42d62d;_0x550075[_0x538c38(0x1ab)](_0x538c38(0x19c)+_0x52ad90[_0x538c38(0x19d)]+']'),_0x550075[_0x538c38(0x1b1)](formatRows(_0x52ad90[_0x538c38(0x1bd)])+'\x20rows\x20'+_0x52ad90['completedSplits']+'/'+_0x52ad90['totalSplits']+'\x20splits');}});return _0x2de12a;},{'verbose':_0x362f57['verbose']}),_0x4687d8=_0x2497b4[_0x1aa047(0x1a6)],_0x42d4f6=_0x4687d8[_0x1aa047(0x1a9)]?_0x1aa047(0x1c7)+_0x4687d8[_0x1aa047(0x1a9)]+']':'',_0x27ed3f=_0x518470?_0x1aa047(0x1be)+_0xc66a8e+'/'+_0x54ce8f+'\x20-\x20':'';console[_0x1aa047(0x1c0)]('✔\x20'+_0x27ed3f+'Query\x20completed:\x20Processed\x20'+formatRows(_0x4687d8[_0x1aa047(0x1c4)][_0x1aa047(0x1bd)])+_0x1aa047(0x1a8)+(_0x1aa047(0x1b9)+formatElapsed(_0x4687d8[_0x1aa047(0x1c4)][_0x1aa047(0x1c5)])+_0x42d4f6));if(_0x518470&&_0x120891){const _0x2c25ae=resolveOutputOptions(_0x2f4192),_0x5ddaed=await formatQueryOutput(_0x4687d8,_0x2c25ae);_0x54a6c2[_0x1aa047(0x1b5)](_0x5ddaed);}else await handleQueryOutput(_0x4687d8,_0x2f4192);}catch(_0x169323){const _0x2b0720=_0x518470?_0x1aa047(0x1be)+_0xc66a8e+'/'+_0x54ce8f+':\x0a':'',_0x1ea6b5=_0x169323 instanceof SDKError?_0x169323['originalMessage']:_0x169323[_0x1aa047(0x1a2)];return console[_0x1aa047(0x1c0)](''+_0x2b0720+_0x1ea6b5),0x1;}}if(_0x2a8b8f['length']>0x1&&_0x120891&&_0x54a6c2[_0x1aa047(0x1b8)]>0x0){const _0x4bb2df=_0x54a6c2[_0x1aa047(0x1c8)]('\x0a');writeFileSync(_0x362f57[_0x1aa047(0x1af)],_0x4bb2df),console[_0x1aa047(0x1c0)](_0x1aa047(0x1b6)+_0x362f57[_0x1aa047(0x1af)]);}return 0x0;}catch(_0x3ddb46){throw _0x3ddb46;}}[a33_0x5c5a97(0x1bc)](_0x33e0bb){const _0x99c8a=a33_0x5c5a97,_0x5a67be=_0x33e0bb[_0x99c8a(0x19f)][0x0],_0x5e3ddb=_0x33e0bb[_0x99c8a(0x1bf)][_0x99c8a(0x1ca)];if(!_0x5a67be&&!_0x5e3ddb)return _0x99c8a(0x1ae);if(_0x5a67be&&_0x5e3ddb)return _0x99c8a(0x1ad);return undefined;}}