@treasuredata/tdx 2026.3.4 → 2026.3.5

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 (197) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/delivery-command.js +1 -1
  18. package/dist/commands/describe.js +1 -1
  19. package/dist/commands/engage-campaign-pull-command.js +1 -1
  20. package/dist/commands/engage-campaign-push-command.js +1 -1
  21. package/dist/commands/engage-campaign-validate-command.js +1 -1
  22. package/dist/commands/engage-command.js +1 -1
  23. package/dist/commands/engage-template-pull-command.js +1 -1
  24. package/dist/commands/engage-template-push-command.js +1 -1
  25. package/dist/commands/engage-template-validate-command.js +1 -1
  26. package/dist/commands/job-command.js +1 -1
  27. package/dist/commands/journey-command.js +1 -1
  28. package/dist/commands/journey-validate-command.js +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/mcp-command.js +1 -1
  31. package/dist/commands/parent-segment-command.js +1 -1
  32. package/dist/commands/profile-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/schedule-command.js +1 -1
  36. package/dist/commands/segment-command.js +1 -1
  37. package/dist/commands/segment-create-command.js +1 -1
  38. package/dist/commands/segment-fields-command.js +1 -1
  39. package/dist/commands/segment-pull-command.js +1 -1
  40. package/dist/commands/segment-push-command.js +1 -1
  41. package/dist/commands/segment-update-command.js +1 -1
  42. package/dist/commands/segment-use-command.js +1 -1
  43. package/dist/commands/segment-validate-command.js +1 -1
  44. package/dist/commands/segments.js +1 -1
  45. package/dist/commands/show.js +1 -1
  46. package/dist/commands/status-command.js +1 -1
  47. package/dist/commands/tables.js +1 -1
  48. package/dist/commands/unset-command.js +1 -1
  49. package/dist/commands/upgrade-command.js +1 -1
  50. package/dist/commands/use-command.js +1 -1
  51. package/dist/commands/user-command.js +1 -1
  52. package/dist/commands/workflow-command.js +1 -1
  53. package/dist/core/auth.js +1 -1
  54. package/dist/core/command-output.js +1 -1
  55. package/dist/core/config.js +1 -1
  56. package/dist/core/connection-cache.js +1 -1
  57. package/dist/core/constants.js +1 -1
  58. package/dist/core/credential-cache.js +1 -1
  59. package/dist/core/global-context.js +1 -1
  60. package/dist/core/keychain.js +1 -1
  61. package/dist/core/profile.js +1 -1
  62. package/dist/core/project-config.js +1 -1
  63. package/dist/core/session.js +1 -1
  64. package/dist/core/user-cache.js +1 -1
  65. package/dist/core/version.js +1 -1
  66. package/dist/index.js +1 -1
  67. package/dist/mcp/server.js +1 -1
  68. package/dist/mcp/tools/index.js +1 -1
  69. package/dist/mcp/tools/tdx-run.js +1 -1
  70. package/dist/mcp/tools/tdx-search.js +1 -1
  71. package/dist/mcp/utils.js +1 -1
  72. package/dist/proxy/claude-usage-tracker.js +1 -1
  73. package/dist/proxy/passthrough-server.js +1 -1
  74. package/dist/proxy/sse-usage-parser.js +1 -1
  75. package/dist/sdk/agent/agent-config.js +1 -1
  76. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  77. package/dist/sdk/agent/agent-yaml.js +1 -1
  78. package/dist/sdk/agent/test/evaluator.js +1 -1
  79. package/dist/sdk/agent/test/executor.js +1 -1
  80. package/dist/sdk/agent/test/index.js +1 -1
  81. package/dist/sdk/agent/test/output.js +1 -1
  82. package/dist/sdk/agent/test/parser.js +1 -1
  83. package/dist/sdk/agent/tool-target-registry.js +1 -1
  84. package/dist/sdk/api.js +1 -1
  85. package/dist/sdk/client/cdp-api-client.js +1 -1
  86. package/dist/sdk/client/delivery-api-client.js +1 -1
  87. package/dist/sdk/client/endpoints.js +1 -1
  88. package/dist/sdk/client/engage-api-client.js +1 -1
  89. package/dist/sdk/client/http-client.js +1 -1
  90. package/dist/sdk/client/llm-api-client.js +1 -1
  91. package/dist/sdk/client/rate-limiter.js +1 -1
  92. package/dist/sdk/client/td-api-client.js +1 -1
  93. package/dist/sdk/client/trino-api-client.js +1 -1
  94. package/dist/sdk/client/workflow-client.js +1 -1
  95. package/dist/sdk/connection-validator.js +1 -1
  96. package/dist/sdk/connection.js +1 -1
  97. package/dist/sdk/delivery.js +1 -1
  98. package/dist/sdk/engage/campaign-pull.js +1 -1
  99. package/dist/sdk/engage/campaign-push.js +1 -1
  100. package/dist/sdk/engage/campaign-validator.js +1 -1
  101. package/dist/sdk/engage/campaign-yaml.js +1 -1
  102. package/dist/sdk/engage/template-pull.js +1 -1
  103. package/dist/sdk/engage/template-push.js +1 -1
  104. package/dist/sdk/engage/template-validator.js +1 -1
  105. package/dist/sdk/engage/template-yaml.js +1 -1
  106. package/dist/sdk/engage/types/campaign-def.js +1 -1
  107. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  108. package/dist/sdk/engage/types/template-schema.js +1 -1
  109. package/dist/sdk/engage.js +1 -1
  110. package/dist/sdk/errors.js +1 -1
  111. package/dist/sdk/index.js +1 -1
  112. package/dist/sdk/io/index.js +1 -1
  113. package/dist/sdk/io/node-filesystem.js +1 -1
  114. package/dist/sdk/job.js +1 -1
  115. package/dist/sdk/journey.js +1 -1
  116. package/dist/sdk/llm/chat-cache.js +1 -1
  117. package/dist/sdk/llm/index.js +1 -1
  118. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  119. package/dist/sdk/llm/model-factors.js +1 -1
  120. package/dist/sdk/personalization.js +1 -1
  121. package/dist/sdk/query/index.js +1 -1
  122. package/dist/sdk/query/sql-parser.js +1 -1
  123. package/dist/sdk/realtime.js +1 -1
  124. package/dist/sdk/schedule.js +1 -1
  125. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  126. package/dist/sdk/segment/fields-display.js +1 -1
  127. package/dist/sdk/segment/file-discovery.js +1 -1
  128. package/dist/sdk/segment/journey-utils.js +1 -1
  129. package/dist/sdk/segment/journey-validator.js +1 -1
  130. package/dist/sdk/segment/journey-yaml.js +1 -1
  131. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  132. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  133. package/dist/sdk/segment/pull-workflow.js +1 -1
  134. package/dist/sdk/segment/push-recovery.js +1 -1
  135. package/dist/sdk/segment/push-workflow.js +1 -1
  136. package/dist/sdk/segment/resolution-context.js +1 -1
  137. package/dist/sdk/segment/segment-path-parser.js +1 -1
  138. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  139. package/dist/sdk/segment/segment-validator.js +1 -1
  140. package/dist/sdk/segment/target-resolution.js +1 -1
  141. package/dist/sdk/segment/tdx-config.js +1 -1
  142. package/dist/sdk/segment/types/activation-schema.js +1 -1
  143. package/dist/sdk/segment/types/journey-def.js +1 -1
  144. package/dist/sdk/segment/types/journey-schema.js +1 -1
  145. package/dist/sdk/segment/types/segment-def.js +1 -1
  146. package/dist/sdk/segment/types/segment-schema.js +1 -1
  147. package/dist/sdk/segment/validate-files.js +1 -1
  148. package/dist/sdk/segment/yaml-validator.js +1 -1
  149. package/dist/sdk/segment.js +1 -1
  150. package/dist/sdk/types/index.js +1 -1
  151. package/dist/sdk/types/progress.js +1 -1
  152. package/dist/sdk/user.js +1 -1
  153. package/dist/sdk/util/format-detector.js +1 -1
  154. package/dist/sdk/util/formatters.js +1 -1
  155. package/dist/sdk/util/index.js +1 -1
  156. package/dist/sdk/util/paginate.js +1 -1
  157. package/dist/sdk/util/tree-formatter.js +1 -1
  158. package/dist/sdk/workflow/archive-validation.js +1 -1
  159. package/dist/sdk/workflow/clone-workflow.js +1 -1
  160. package/dist/sdk/workflow/index.js +1 -1
  161. package/dist/sdk/workflow/pull-workflow.js +1 -1
  162. package/dist/sdk/workflow/push-workflow.js +1 -1
  163. package/dist/sdk/workflow/tdx-config.js +1 -1
  164. package/dist/sdk/workflow/workflow-utils.js +1 -1
  165. package/dist/test-utils/command-runner.js +1 -1
  166. package/dist/test-utils/factories.js +1 -1
  167. package/dist/test-utils/fixtures.js +1 -1
  168. package/dist/test-utils/http-mock.js +1 -1
  169. package/dist/test-utils/index.js +1 -1
  170. package/dist/utils/async.js +1 -1
  171. package/dist/utils/colors.js +1 -1
  172. package/dist/utils/diff.js +1 -1
  173. package/dist/utils/file-permissions.js +1 -1
  174. package/dist/utils/file-reader.js +1 -1
  175. package/dist/utils/github-releases.js +1 -1
  176. package/dist/utils/global-cache.js +1 -1
  177. package/dist/utils/json-loader.js +1 -1
  178. package/dist/utils/local-cache.js +1 -1
  179. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  180. package/dist/utils/logger/formatters/index.js +1 -1
  181. package/dist/utils/logger/handlers/console-handler.js +1 -1
  182. package/dist/utils/logger/handlers/file-handler.js +1 -1
  183. package/dist/utils/logger/handlers/index.js +1 -1
  184. package/dist/utils/logger/handlers/null-handler.js +1 -1
  185. package/dist/utils/logger/index.js +1 -1
  186. package/dist/utils/logger/logger.js +1 -1
  187. package/dist/utils/logger/types.js +1 -1
  188. package/dist/utils/option-validation.js +1 -1
  189. package/dist/utils/process.js +1 -1
  190. package/dist/utils/prompt.js +1 -1
  191. package/dist/utils/spinner.js +1 -1
  192. package/dist/utils/sse-parser.js +1 -1
  193. package/dist/utils/string-utils.js +1 -1
  194. package/dist/utils/table-ref-parser.js +1 -1
  195. package/dist/utils/tdx-logger.js +1 -1
  196. package/dist/utils/version-check.js +1 -1
  197. package/package.json +1 -1
@@ -1 +1 @@
1
- const a29_0x4f72eb=a29_0x2465;(function(_0x3ea55b,_0x44639e){const _0x482863=a29_0x2465,_0x316b09=_0x3ea55b();while(!![]){try{const _0x4656c8=parseInt(_0x482863(0xfb))/0x1+parseInt(_0x482863(0xec))/0x2+-parseInt(_0x482863(0x14c))/0x3+parseInt(_0x482863(0x1e2))/0x4+-parseInt(_0x482863(0x1d7))/0x5+-parseInt(_0x482863(0x192))/0x6*(parseInt(_0x482863(0xdd))/0x7)+-parseInt(_0x482863(0x12a))/0x8;if(_0x4656c8===_0x44639e)break;else _0x316b09['push'](_0x316b09['shift']());}catch(_0x2ad854){_0x316b09['push'](_0x316b09['shift']());}}}(a29_0x53df,0x5da53));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x4a3195 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 a29_0x348113 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=a29_0x4f72eb(0xdb),LEGACY_PARENT_SEGMENT_DIR=a29_0x4f72eb(0x200);function openBrowser(_0x567438){const _0xabd27=a29_0x4f72eb,_0x5be12c=process[_0xabd27(0x181)],_0x42ece7=_0x5be12c==='darwin'?_0xabd27(0x139):_0x5be12c==='win32'?'start':'xdg-open';spawn(_0x42ece7,[_0x567438],{'detached':!![],'stdio':_0xabd27(0x202)})[_0xabd27(0x8d)]();}function migrateLegacyDirectory(){const _0x140d6e=a29_0x4f72eb;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x179511=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x179511['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x348113[_0x140d6e(0xb2)](_0x140d6e(0x179)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x140d6e(0x19b))),console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0xb0)](_0x140d6e(0xe1)+LEGACY_PARENT_SEGMENT_DIR+_0x140d6e(0x111))),![];console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0xb2)](_0x140d6e(0xcd)+LEGACY_PARENT_SEGMENT_DIR+_0x140d6e(0x106)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0x16f)]('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x5eef83){const _0x22a06a=_0x5eef83 instanceof Error?_0x5eef83[_0x140d6e(0xc8)]:String(_0x5eef83);return console[_0x140d6e(0xf5)](a29_0x348113[_0x140d6e(0x1d6)](_0x140d6e(0x152)+_0x22a06a+'\x0a')),![];}}function a29_0x53df(){const _0x17b1de=['Listing\x20parent\x20segments...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','SQL\x20query:\x0a','toLocaleString','\x0aUsage:\x20tdx\x20ps\x20preview\x20','true','\x20\x201.\x20Edit\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','/\x20→\x20','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','\x20--enriched','filter','log','\x20\x20\x20\x20\x20\x20','Updated','Validating\x20RT\x20configuration...','realtime:','\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','execute','/\x20directory.\x0a','/{name}.yml\x0a','\x20configured','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','resolveParentId','Listing\x20RT-enabled\x20parent\x20segments...','replace','No\x20personalization\x20services\x20configured','trim','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','.yaml','personalization_services','<database>.<table>','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','displayValidateResults','\x20Saved\x20parent\x20segment\x20configuration\x20to\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','displayRealtimeInfo','\x20parent\x20segment','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','using\x20the\x20default\x20path:\x20','Default','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','2019176CIgOKh','label','table','Site:\x20','Available\x20behaviors:','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','site','displayAttributesStats','varchar','\x20is\x20already\x20up\x20to\x20date','trigger_event','jsonl','getParentSQL','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','open','text','displaySummary','/attempt/','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','customers','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','previewParentYaml','\x0aNo\x20sample\x20data\x20available','segment:parent:create','single','stop','getOutputDatabaseName','runParent','Fetching\x20parent\x20segment\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','addAttributes','segment:parent:view','stats','277548HFQcnK','-1d','\x20--attribute\x20\x22<name>\x22','/app/workflows/','last_page_viewed','sampleData','✘\x20Failed\x20to\x20rename\x20directory:\x20','personalization','\x27\x20and\x20run\x20workflow?','Listing\x20fields\x20for\x20\x27','SELECT\x20*\x20FROM\x20(\x0a','dirname','repeat','bold','\x0a\x20\x20\x20\x20]','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Found\x20YAML\x20file:\x20','verbose','List\x20available\x20fields\x20for\x20segmentation','\x20\x20\x20\x20-\x20','\x20[Job\x20ID:\x20','customerGroupFile','customerPercent','pushParentYaml','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','listParents','segment','Fetching\x20behavior\x20list...','getBehaviorNames','foreignKey','\x20behaviors','\x20Opening\x20','SELECT\x20*\x20FROM\x20','events','createParent','green','Show\x20parent\x20segment\x20details','segment:parent:list','Behavior:','scheduleOption','type','\x20kill','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','page_view','ps:pz:init','\x0a⚠️\x20\x20Both\x20','displayPreviewHints','Error:','idStitching','user_id','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','.yml','To\x20cancel:','platform','ps:pz:list','No\x20RT-enabled\x20parent\x20segments\x20found','\x20to\x20push\x20the\x20configuration','\x20service','\x20parent\x20segment\x20\x27','\x20\x20Database:\x20','column_name','\x27\x20is\x20already\x20up\x20to\x20date','session','Behaviors','attributesFile','✔\x20Created\x20parent\x20segment\x20\x27','schemaValid','sections','\x20\x20Note:\x20','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','120YLTvta','map','Get\x20SQL\x20query\x20for\x20parent\x20segment','/app/dw/parentSegments/','description','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','json','/\x20directories\x20exist.','⚡\x20Enabled','Validating\x20configuration...','displayMasterInfo','\x0a✔\x20Workflow\x20started','RT\x202.0:','\x20tdx\x20wf\x20attempt\x20','totalEvents','errors','joinKey','Executing\x20parent\x20segment\x20query...','Updating\x20parent\x20segment\x20\x27','\x27\x20is\x20up\x20to\x20date','output','Fetching\x20current\x20configuration\x20for\x20\x27','Personalization\x20service\x20description','\x20service(s)\x20configured','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','RT\x202.0\x20Validate:','td_client_id','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20rows)','Options\x20(one\x20required):\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','status','\x20--behavior\x20\x22','parent_id','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displaySampleData','realtime','Customers:','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','setJobId','addAttributesFile','test','Master\x20Table','schemaError','segment:parent:desc','Options:\x0a','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','listFields','Error:\x20--behavior\x20requires\x20a\x20name\x0a','master','\x20=\x20','parentSegment','Schema\x20saved\x20to\x20','segment:parent:validate','format','\x20\x20Columns:\x20','enriched','join','jobId','list','toFixed','displayColumns','workflowAttemptId','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Create\x20parent\x20segment\x20\x27','\x0aNew\x20parent\x20segment\x20\x27','red','1792785CUvHXG','toLowerCase','attribute','personalizationServices','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','utf-8','formatSchemaJson','Table:\x20','\x0aChanges\x20to\x20\x27','Available\x20attributes:','endsWith','2278604ipcHXn','behavior','yes','audienceId','indexOf','Attempt:','\x20\x20\x20','Database:\x20','Created','YAML\x20file:\x20','Fetching\x20SQL\x20for\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','length','Source:','Analyzing\x20changes...','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','No\x20parent\x20segments\x20match\x20pattern:\x20','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','web','ps:rt:validate','string','\x0aError:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x20Added\x20personalization\x20template\x20to\x20','\x20RT-enabled\x20parent\x20segment','scheduleType','sourceTableValid','Apply\x20changes\x20to\x20\x27','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','parent_segment','workflowSessionId','ignore','ID\x20Stitching:','push','No\x20parent\x20segments\x20found','validateParentYaml','Session:','timezone','Updating','\x20\x20\x20\x20','valid','attributes','population','column','Error\x20reading\x20file:\x20','unref','stitchingKeys','columns','customersWithEvents','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','\x20--attribute\x20\x22','information_schema','✔\x20No\x20changes\x20-\x20\x27','preview','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Events:','sort','processedRows','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','limit','cyan','Name:\x20','elapsedTimeMillis','Resolving\x20parent\x20segment\x20\x27','behaviorsFile','\x27...','Pattern:\x20','reduce','\x20--behavior\x20\x22<name>\x22','displayBehaviorsStats','\x0a\x20\x20\x20\x20}','Parent\x20segment:\x20','name','rowCount','\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\x20personalization_services\x20section\x20already\x20exists\x20in\x20','displayPreviewResults','collectSchema','ps:rt:list','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','dim','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','yellow','interval','realtime_enabled','allValid','\x20\x20Tables:\x201\x20customers\x20+\x20','in\x20','workflowId','tdx\x20ps\x20preview\x20','\x20to\x20configure\x20your\x20personalization\x20service','behavior_','{\x0a\x20\x20\x22database\x22:\x20\x22','localeCompare','match','data','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Errors:','tdx\x20ps\x20push\x20','Attributes:','run','\x20\x202.\x20Run\x20','column_type','apply','message','\x20No\x20changes\x20-\x20','addBehaviorsFile','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20+\x20[','\x0a⚠️\x20\x20Migrating:\x20','\x20Context\x20set:\x20','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','database','all','coveragePercent','start','\x22,\x20\x22type\x22:\x20\x22','Join\x20on:','👥\x20','✔\x20Found\x20','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','⚡\x20Not\x20enabled','segment:parent:push','parent_segments','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','15841yGnIBq','Fetching\x20customers\x20schema...','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x5c$&','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','use','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Error:\x20--database\x20and\x20--table\x20are\x20required','behaviors','\x0a\x20\x20]\x0a}\x0a','.customers)','customerGroup','Listing\x20parent\x20segments\x20matching\x20\x27','\x20--interval\x20','531980geDuhb','sourceTableError','List\x20parent\x20segments','Coverage:','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','Creating','Status:','keys','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','error','segment:parent:preview','Options:','Personalization:','Error\x20parsing\x20YAML:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','296660MGKrSE','Output\x20Database:','getParentFull'];a29_0x53df=function(){return _0x17b1de;};return a29_0x53df();}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x4f72eb(0xc4)](_0x111b58){const _0x506941=a29_0x4f72eb;return migrateLegacyDirectory(),super[_0x506941(0xc4)](_0x111b58);}}function resolveYamlFile(_0x29ebeb){const _0x56303b=a29_0x4f72eb;if(_0x29ebeb[_0x56303b(0x1e1)](_0x56303b(0x17f))||_0x29ebeb[_0x56303b(0x1e1)](_0x56303b(0x11c)))return _0x29ebeb;return a29_0x4a3195['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x29ebeb)+'.yml');}function formatProgressMessage(_0x36e75f){const _0x3672aa=a29_0x4f72eb,_0xf482ad=_0x36e75f[_0x3672aa(0xbe)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xf482ad){const [,_0x23b527,_0x4f7288,_0x2f8f0e='']=_0xf482ad;return a29_0x348113[_0x3672aa(0xb0)](_0x23b527+':')+'\x20'+_0x4f7288+a29_0x348113[_0x3672aa(0xb0)](_0x2f8f0e);}return a29_0x348113[_0x3672aa(0xb0)](_0x36e75f);}function showFileNotFoundError(_0x3106e9,_0x1cb0be){const _0x6384c=a29_0x4f72eb;console[_0x6384c(0xf5)](a29_0x348113[_0x6384c(0x1d6)]('Error:\x20File\x20not\x20found:\x20'+_0x3106e9+'\x0a')),console['error'](a29_0x348113[_0x6384c(0x9c)](_0x6384c(0xe3)+_0x1cb0be+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x3f3d29){const _0x32e96f=a29_0x4f72eb;if(!_0x3f3d29[_0x32e96f(0x1b8)])return;const _0x4389cd=_0x3f3d29[_0x32e96f(0x1b8)],_0x2ea111=_0x4389cd['enabled']?a29_0x348113[_0x32e96f(0x16f)](_0x32e96f(0x19c)):a29_0x348113[_0x32e96f(0xb2)](_0x32e96f(0xd9));console[_0x32e96f(0xf5)]('\x0a'+a29_0x348113['dim'](_0x32e96f(0x1a0))+'\x20'+_0x2ea111);if(_0x4389cd[_0x32e96f(0x16d)]&&_0x4389cd[_0x32e96f(0x16d)][_0x32e96f(0x1ee)]>0x0){console[_0x32e96f(0xf5)]('\x20\x20'+a29_0x348113['dim'](_0x32e96f(0x97))+'\x20'+_0x4389cd[_0x32e96f(0x16d)]['length']+'\x20configured');for(const _0x4bbc65 of _0x4389cd['events']){const _0x22ba07=_0x4bbc65[_0x32e96f(0x1fd)]===![]?a29_0x348113[_0x32e96f(0x1d6)]('✘'):a29_0x348113[_0x32e96f(0x16f)]('✔');console[_0x32e96f(0xf5)](_0x32e96f(0x20a)+_0x22ba07+'\x20'+_0x4bbc65[_0x32e96f(0xa8)]),_0x4bbc65[_0x32e96f(0xed)]&&console[_0x32e96f(0xf5)](_0x32e96f(0x10b)+a29_0x348113[_0x32e96f(0x1d6)](_0x4bbc65[_0x32e96f(0xed)]));}}if(_0x4389cd['attributes']&&_0x4389cd['attributes']['length']>0x0){console['error']('\x20\x20'+a29_0x348113['dim'](_0x32e96f(0xc3))+'\x20'+_0x4389cd['attributes'][_0x32e96f(0x1ee)]+_0x32e96f(0x113));for(const _0x4afef8 of _0x4389cd[_0x32e96f(0x89)]){const _0x3ae42e=_0x4afef8[_0x32e96f(0x88)]?a29_0x348113[_0x32e96f(0x16f)]('✔'):a29_0x348113[_0x32e96f(0x1d6)]('✘');console[_0x32e96f(0xf5)](_0x32e96f(0x20a)+_0x3ae42e+'\x20'+_0x4afef8[_0x32e96f(0xa8)]+'\x20'+a29_0x348113['dim']('('+_0x4afef8[_0x32e96f(0x174)]+')'));}}if(_0x4389cd[_0x32e96f(0x17c)]){const _0x33cbf6=_0x4389cd[_0x32e96f(0x17c)][_0x32e96f(0x8e)]?.[_0x32e96f(0x1ee)]?_0x32e96f(0xcc)+_0x4389cd['idStitching'][_0x32e96f(0x8e)][_0x32e96f(0x1cd)](',\x20')+']':'';console['error']('\x20\x20'+a29_0x348113[_0x32e96f(0xb0)](_0x32e96f(0x203))+'\x20'+_0x4389cd['idStitching']['primaryKey']+_0x33cbf6);}if(_0x4389cd[_0x32e96f(0x1da)]&&_0x4389cd[_0x32e96f(0x1da)]['length']>0x0){console[_0x32e96f(0xf5)]('\x20\x20'+a29_0x348113['dim'](_0x32e96f(0xf8))+'\x20'+_0x4389cd[_0x32e96f(0x1da)][_0x32e96f(0x1ee)]+_0x32e96f(0x185)+(_0x4389cd[_0x32e96f(0x1da)][_0x32e96f(0x1ee)]!==0x1?'s':''));for(const _0x190183 of _0x4389cd['personalizationServices']){console[_0x32e96f(0xf5)]('\x20\x20\x20\x20-\x20'+_0x190183[_0x32e96f(0xa8)]);}}}function showParentSegmentNotSetError(_0x50650d){const _0x245ae8=a29_0x4f72eb;console[_0x245ae8(0xf5)](a29_0x348113[_0x245ae8(0xb2)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x245ae8(0xf5)](_0x50650d);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x171);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0xee);async[a29_0x4f72eb(0x110)](_0x36bdd6){const _0x3f504d=a29_0x4f72eb,{options:_0x35f5d1,args:_0x3d31,tdx:_0x16e6ac}=_0x36bdd6,_0x3038bd=_0x3d31[0x0];_0x35f5d1[_0x3f504d(0x15d)]&&(console[_0x3f504d(0xf5)](_0x3f504d(0x12d)+_0x35f5d1[_0x3f504d(0x130)]),_0x3038bd&&console['error'](_0x3f504d(0xa2)+_0x3038bd));const _0x184151=await withSpinner(_0x3038bd?_0x3f504d(0xea)+_0x3038bd+_0x3f504d(0xa1):_0x3f504d(0xfe),()=>_0x16e6ac[_0x3f504d(0x166)][_0x3f504d(0x165)](),{'verbose':_0x35f5d1[_0x3f504d(0x15d)]});let _0x356a0c=_0x184151[_0x3f504d(0xbf)];if(_0x3038bd){const _0x592cfc=_0x3038bd[_0x3f504d(0x117)](/[.+^${}()|[\]\\]/g,_0x3f504d(0xe0))[_0x3f504d(0x117)](/\*/g,'.*')[_0x3f504d(0x117)](/\?/g,'.'),_0x2eded5=new RegExp('^'+_0x592cfc+'$','i');_0x356a0c=_0x356a0c[_0x3f504d(0x109)](_0x5b844b=>_0x2eded5['test'](_0x5b844b[_0x3f504d(0x89)]['name']));}_0x356a0c[_0x3f504d(0x98)]((_0x51bbca,_0x1a2323)=>_0x51bbca['attributes'][_0x3f504d(0xa8)][_0x3f504d(0xbd)](_0x1a2323['attributes'][_0x3f504d(0xa8)])),console[_0x3f504d(0xf5)](_0x3f504d(0xd7)+_0x356a0c[_0x3f504d(0x1ee)]+_0x3f504d(0x125)+(_0x356a0c[_0x3f504d(0x1ee)]!==0x1?'s':''));const _0x5a26f4=_0x5f16ae=>{const _0x122412=_0x3f504d;return getConsoleNextUrl(_0x35f5d1[_0x122412(0x130)],_0x122412(0x195)+_0x5f16ae);};if(_0x35f5d1[_0x3f504d(0x1ca)]===_0x3f504d(0x19a)||_0x35f5d1[_0x3f504d(0x1ca)]==='jsonl'){const _0x352d7b=_0x356a0c['map'](_0x1b7141=>({..._0x1b7141,'url':_0x5a26f4(_0x1b7141['id'])}));await handleSDKOutput(_0x352d7b,_0x35f5d1);}else{if(_0x356a0c['length']===0x0)_0x3038bd?console[_0x3f504d(0x10a)](_0x3f504d(0x1f3)+_0x3038bd):console[_0x3f504d(0x10a)](_0x3f504d(0x205));else for(const _0x2c6d23 of _0x356a0c){const _0x53c8ec=_0x2c6d23[_0x3f504d(0x89)]['population']?a29_0x348113[_0x3f504d(0xb0)]('\x20('+formatRows(_0x2c6d23[_0x3f504d(0x89)]['population'])+')'):'',_0x53246a=hyperlink(_0x2c6d23[_0x3f504d(0x89)][_0x3f504d(0xa8)],_0x5a26f4(_0x2c6d23['id']));console[_0x3f504d(0x10a)](_0x3f504d(0xd6)+_0x53246a+_0x53c8ec);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x142);['description']=a29_0x4f72eb(0x1af);async[a29_0x4f72eb(0x110)](_0x4d47aa){const _0x3f6e61=a29_0x4f72eb,{options:_0x1cf11c,args:_0xa82768,tdx:_0x224b04}=_0x4d47aa;console['error'](_0x3f6e61(0x191)+_0x3f6e61(0xdf)+_0x3f6e61(0xb1));const _0x1d2ce0=_0x1cf11c;if(_0xa82768[_0x3f6e61(0x1ee)]===0x0)return console['error'](a29_0x348113['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x3f6e61(0x9a)),0x1;const _0x4d8935=_0xa82768[0x0];if(!_0x1d2ce0[_0x3f6e61(0xd0)]||!_0x1d2ce0['table'])return console[_0x3f6e61(0xf5)](_0x3f6e61(0xe5)),console[_0x3f6e61(0xf5)](_0x3f6e61(0x9a)),0x1;_0x1d2ce0[_0x3f6e61(0x15d)]&&(console[_0x3f6e61(0xf5)](_0x3f6e61(0x12d)+_0x1d2ce0[_0x3f6e61(0x130)]),console[_0x3f6e61(0xf5)](_0x3f6e61(0x9d)+_0x4d8935),console[_0x3f6e61(0xf5)](_0x3f6e61(0x1e9)+_0x1d2ce0['database']),console[_0x3f6e61(0xf5)](_0x3f6e61(0x1de)+_0x1d2ce0[_0x3f6e61(0x12c)]));const _0x3a229a=await loadJSONFromOptions(_0x1d2ce0[_0x3f6e61(0x89)],_0x1d2ce0[_0x3f6e61(0x18c)]),_0x34f5c2=await loadJSONFromOptions(_0x1d2ce0[_0x3f6e61(0xe6)],_0x1d2ce0[_0x3f6e61(0xa0)]),_0x77a472=await loadJSONFromOptions(_0x1d2ce0[_0x3f6e61(0xe9)],_0x1d2ce0[_0x3f6e61(0x161)]),_0x43583d={'name':_0x4d8935,'description':_0x1d2ce0['description'],'scheduleType':_0x1d2ce0[_0x3f6e61(0x1fc)],'scheduleOption':_0x1d2ce0['scheduleOption'],'timezone':_0x1d2ce0[_0x3f6e61(0x208)],'master':{'parentDatabaseName':_0x1d2ce0['database'],'parentTableName':_0x1d2ce0[_0x3f6e61(0x12c)]},'attributes':_0x3a229a,'behaviors':_0x34f5c2,'customerGroup':_0x77a472},_0x5ef407=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x4d8935+_0x3f6e61(0xa1),()=>_0x224b04[_0x3f6e61(0x166)][_0x3f6e61(0x16e)](_0x43583d),{'verbose':_0x1cf11c['verbose']}),_0x3dafaa=_0x5ef407['data'];return console['error'](_0x3f6e61(0x18d)+_0x3dafaa[_0x3f6e61(0xa8)]+'\x27\x20with\x20ID:\x20'+_0x3dafaa['id']),await handleSDKOutput([_0x3dafaa],_0x1cf11c),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:update';[a29_0x4f72eb(0x196)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x1db881){const _0xec3c74=a29_0x4f72eb,{options:_0x45389f,args:_0x3ffe3a,tdx:_0x2524ef}=_0x1db881;console['error'](_0xec3c74(0x198)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0xec3c74(0xb1));const _0x585753=_0x45389f;if(_0x3ffe3a[_0xec3c74(0x1ee)]===0x0)return console['error'](a29_0x348113[_0xec3c74(0x1d6)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0xec3c74(0xf5)](_0xec3c74(0x1f1)),0x1;const _0xf8c7eb=_0x3ffe3a[0x0];_0x585753[_0xec3c74(0x15d)]&&(console[_0xec3c74(0xf5)](_0xec3c74(0x12d)+_0x585753['site']),console['error'](_0xec3c74(0xa7)+_0xf8c7eb));const _0x4d4f20=await withSpinner(_0xec3c74(0x1a9)+_0xf8c7eb+'\x27...',()=>_0x2524ef['segment'][_0xec3c74(0xfd)](_0xf8c7eb),{'verbose':_0x585753[_0xec3c74(0x15d)]}),_0x173eb9=_0x4d4f20['data'],_0x566fb6=await loadJSONFromOptions(_0x585753[_0xec3c74(0x149)],_0x585753[_0xec3c74(0x1bc)]),_0x31afaa=await loadJSONFromOptions(_0x585753['addBehaviors'],_0x585753[_0xec3c74(0xca)]),_0xab3e5a={'name':_0x173eb9[_0xec3c74(0xa8)],'description':_0x585753[_0xec3c74(0x196)]!==undefined?_0x585753['description']:_0x173eb9[_0xec3c74(0x196)],'scheduleType':_0x585753['scheduleType']!==undefined?_0x585753['scheduleType']:_0x173eb9[_0xec3c74(0x1fc)],'scheduleOption':_0x585753[_0xec3c74(0x173)]!==undefined?_0x585753['scheduleOption']:_0x173eb9['scheduleOption'],'timezone':_0x585753[_0xec3c74(0x208)]!==undefined?_0x585753[_0xec3c74(0x208)]:_0x173eb9[_0xec3c74(0x208)],'master':_0x173eb9[_0xec3c74(0x1c5)],'attributes':_0x566fb6?[..._0x173eb9[_0xec3c74(0x89)]||[],..._0x566fb6]:_0x173eb9[_0xec3c74(0x89)],'behaviors':_0x31afaa?[..._0x173eb9['behaviors']||[],..._0x31afaa]:_0x173eb9['behaviors'],'customerGroup':_0x173eb9[_0xec3c74(0xe9)]},_0x4a7323=await withSpinner(_0xec3c74(0x1a6)+_0xf8c7eb+_0xec3c74(0xa1),()=>_0x2524ef[_0xec3c74(0x166)]['updateParent'](_0xf8c7eb,_0xab3e5a),{'verbose':_0x585753[_0xec3c74(0x15d)]}),_0x3e1548=_0x4a7323[_0xec3c74(0xbf)];return console[_0xec3c74(0xf5)]('✔\x20Updated\x20parent\x20segment\x20\x27'+_0x3e1548[_0xec3c74(0xa8)]+'\x27'),await handleSDKOutput([_0x3e1548],_0x585753),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']='segment:parent:pull';['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async['execute'](_0x4f1928){const _0x1d6c53=a29_0x4f72eb,{options:_0x421020,args:_0x5c398d,tdx:_0x396ddc}=_0x4f1928,_0x4165e4=_0x421020,_0x3826cf=_0x5c398d[0x0]||_0x421020['parentSegment'];if(!_0x3826cf)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x1d6c53(0x120)),0x1;if(_0x4165e4[_0x1d6c53(0xe2)]&&_0x4165e4[_0x1d6c53(0x1a8)])return console['error'](a29_0x348113[_0x1d6c53(0x1d6)](_0x1d6c53(0x148))),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0xb0)](_0x1d6c53(0x1b2))),console['error'](a29_0x348113[_0x1d6c53(0xb0)](_0x1d6c53(0x127)+PARENT_SEGMENT_DIR+_0x1d6c53(0x112))),console[_0x1d6c53(0xf5)](a29_0x348113['cyan'](_0x1d6c53(0xaf))),0x1;const _0x12ecbf=_0x4165e4[_0x1d6c53(0x1a8)]||a29_0x4a3195[_0x1d6c53(0x1cd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x3826cf)+'.yml');_0x4165e4[_0x1d6c53(0x15d)]&&(console[_0x1d6c53(0xf5)]('Site:\x20'+_0x4165e4[_0x1d6c53(0x130)]),console[_0x1d6c53(0xf5)]('Parent\x20segment:\x20'+_0x3826cf),console[_0x1d6c53(0xf5)]('Output\x20file:\x20'+_0x12ecbf));const _0x5549e9=await withSpinner(_0x1d6c53(0x147)+_0x3826cf+_0x1d6c53(0xa1),()=>_0x396ddc[_0x1d6c53(0x166)]['pullParentYaml'](_0x3826cf),{'verbose':_0x4165e4[_0x1d6c53(0x15d)]}),_0x54757a=_0x5549e9['data'];if(existsSync(_0x12ecbf)){const _0x50f5c4=readFileSync(_0x12ecbf,_0x1d6c53(0x1dc)),_0x50e836=generateDiff(_0x50f5c4,_0x54757a);if(!hasChanges(_0x50e836))console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x16f)]('✔')+_0x1d6c53(0xc9)+a29_0x348113[_0x1d6c53(0x9c)](_0x12ecbf)+_0x1d6c53(0x133));else{console[_0x1d6c53(0xf5)](_0x1d6c53(0x1df)+_0x12ecbf+'\x27:'),console[_0x1d6c53(0xf5)]('─'[_0x1d6c53(0x158)](0x3c)),console['error'](formatDiffWithColors(_0x50e836)),console[_0x1d6c53(0xf5)]('─'[_0x1d6c53(0x158)](0x3c));if(!_0x4165e4['yes']){if(!isInteractive())return console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x1d6)](_0x1d6c53(0x1f8)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0xb0)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2b4297=await confirmKey('Overwrite\x20\x27'+_0x12ecbf+'\x27?');if(!_0x2b4297)return console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0xb2)]('Aborted.')),0x1;}writeFileSync(_0x12ecbf,_0x54757a,_0x1d6c53(0x1dc)),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x16f)]('✔')+_0x1d6c53(0x122)+a29_0x348113[_0x1d6c53(0x9c)](_0x12ecbf));}}else{const _0x528631=a29_0x4a3195[_0x1d6c53(0x157)](_0x12ecbf);!existsSync(_0x528631)&&mkdirSync(_0x528631,{'recursive':!![]}),writeFileSync(_0x12ecbf,_0x54757a,_0x1d6c53(0x1dc)),console[_0x1d6c53(0xf5)](a29_0x348113[_0x1d6c53(0x16f)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a29_0x348113['cyan'](_0x12ecbf));}return saveSessionContext({'parent_segment':_0x3826cf},_0x4165e4[_0x1d6c53(0x18a)]),console[_0x1d6c53(0xf5)](a29_0x348113['green']('✔')+_0x1d6c53(0xce)+a29_0x348113[_0x1d6c53(0xb0)]('parent_segment')+'\x20=\x20'+a29_0x348113[_0x1d6c53(0x9c)](_0x3826cf)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0xda);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0xd8);async[a29_0x4f72eb(0x110)](_0x454711){const _0x2c1102=a29_0x4f72eb,{options:_0x18ad82,args:_0x2a67c0,tdx:_0x2feef6}=_0x454711,_0x3fd1fc=_0x18ad82,_0x1be776=_0x2a67c0[0x0]||_0x18ad82[_0x2c1102(0x1c7)];if(!_0x1be776)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x2c1102(0x96)),0x1;const _0x356746=resolveYamlFile(_0x1be776);if(!existsSync(_0x356746))return showFileNotFoundError(_0x356746,_0x1be776),0x1;_0x3fd1fc[_0x2c1102(0x15d)]&&(console['error']('Site:\x20'+_0x3fd1fc[_0x2c1102(0x130)]),console[_0x2c1102(0xf5)]('YAML\x20file:\x20'+_0x356746));let _0x79ca46;try{_0x79ca46=readFileSync(_0x356746,'utf-8');}catch(_0x52f16f){const _0x13cdc3=_0x52f16f instanceof Error?_0x52f16f['message']:String(_0x52f16f);return console[_0x2c1102(0xf5)](_0x2c1102(0x8c)+_0x13cdc3),0x1;}const _0x3d333f=await withSpinner(_0x2c1102(0x1f0),()=>_0x2feef6[_0x2c1102(0x166)][_0x2c1102(0x163)](_0x79ca46),{'verbose':_0x3fd1fc[_0x2c1102(0x15d)]}),_0x58f45c=_0x3d333f[_0x2c1102(0xbf)],{isNew:_0x41b898,name:_0xa9bb6c,hasChanges:_0x1dc2c8,diffFormatted:_0x498b70}=_0x58f45c;if(!_0x1dc2c8)return console[_0x2c1102(0xf5)](_0x2c1102(0x94)+_0xa9bb6c+_0x2c1102(0x189)),0x0;_0x41b898?console[_0x2c1102(0xf5)](_0x2c1102(0x1d5)+_0xa9bb6c+'\x27:'):console[_0x2c1102(0xf5)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0xa9bb6c+'\x27:');console['error']('─'['repeat'](0x3c)),console['error'](_0x498b70),console[_0x2c1102(0xf5)]('─'[_0x2c1102(0x158)](0x3c));const _0x366ec1=_0x41b898?_0x2c1102(0x1d4)+_0xa9bb6c+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xa9bb6c+'\x27?';if(!_0x3fd1fc[_0x2c1102(0x1e4)]){if(!isInteractive())return console[_0x2c1102(0xf5)](a29_0x348113[_0x2c1102(0x1d6)](_0x2c1102(0x1f8)),_0x2c1102(0x13f)),console[_0x2c1102(0xf5)](a29_0x348113[_0x2c1102(0xb0)](_0x2c1102(0x15b))),0x1;const _0x510989=await confirmKey(_0x366ec1);if(!_0x510989)return console['error'](a29_0x348113[_0x2c1102(0xb2)]('Aborted.')),0x1;}const _0x26b54e=_0x41b898?_0x2c1102(0xf1):_0x2c1102(0x209),_0x3bde5a=await withSpinner(_0x26b54e+'\x20parent\x20segment\x20\x27'+_0xa9bb6c+_0x2c1102(0xa1),()=>_0x58f45c[_0x2c1102(0xc7)](),{'verbose':_0x3fd1fc[_0x2c1102(0x15d)]}),_0x58c77c=_0x3bde5a[_0x2c1102(0xbf)],_0x3cf0c0=getConsoleNextUrl(_0x3fd1fc['site'],_0x2c1102(0x195)+_0x58c77c['id']),_0x19d5b0=_0x41b898?'Created':_0x2c1102(0x10c);return console[_0x2c1102(0xf5)]('✔\x20'+_0x19d5b0+_0x2c1102(0x186)+_0x58c77c[_0x2c1102(0xa8)]+'\x27'),console[_0x2c1102(0xf5)]('\x20\x20'+_0x3cf0c0),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x1c9);[a29_0x4f72eb(0x196)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async[a29_0x4f72eb(0x110)](_0x451aa6){const _0x1f656e=a29_0x4f72eb,{options:_0xc97cf,args:_0x1d3065,tdx:_0x3fab29}=_0x451aa6,_0x4e9963=_0xc97cf,_0x1f4500=_0x1d3065[0x0]||_0xc97cf[_0x1f656e(0x1c7)];if(!_0x1f4500)return showParentSegmentNotSetError(_0x1f656e(0x164)+_0x1f656e(0x138)+_0x1f656e(0x1c1)+_0x1f656e(0xe4)+_0x1f656e(0x1d3)+_0x1f656e(0x1f2)),0x1;const _0x527f2d=resolveYamlFile(_0x1f4500);if(!existsSync(_0x527f2d))return showFileNotFoundError(_0x527f2d,_0x1f4500),0x1;_0x4e9963[_0x1f656e(0x15d)]&&(console[_0x1f656e(0xf5)](_0x1f656e(0x12d)+_0x4e9963[_0x1f656e(0x130)]),console[_0x1f656e(0xf5)](_0x1f656e(0x1eb)+_0x527f2d));let _0x46cb90;try{_0x46cb90=readFileSync(_0x527f2d,_0x1f656e(0x1dc));}catch(_0x47759e){const _0x18eec7=_0x47759e instanceof Error?_0x47759e['message']:String(_0x47759e);return console[_0x1f656e(0xf5)](_0x1f656e(0x8c)+_0x18eec7),0x1;}const _0x330786=createCommandSpinner(a29_0x348113['dim'](_0x1f656e(0x19d)),{'verbose':_0x4e9963['verbose']});_0x330786['start']();const _0x402606={'onProgress':_0x1a21ba=>{const _0x44fdcf=_0x1f656e;_0x330786[_0x44fdcf(0x13a)]=formatProgressMessage(_0x1a21ba);}};if(_0x4e9963[_0x1f656e(0x1c5)])_0x402606[_0x1f656e(0x1c5)]=!![];if(_0x4e9963[_0x1f656e(0x1cc)])_0x402606['enriched']=!![];_0x4e9963[_0x1f656e(0x1d9)]&&(_0x402606[_0x1f656e(0x1d9)]=_0x4e9963[_0x1f656e(0x1d9)]);_0x4e9963[_0x1f656e(0x1e3)]&&(_0x402606[_0x1f656e(0x1e3)]=_0x4e9963[_0x1f656e(0x1e3)]);if(_0x4e9963[_0x1f656e(0xb3)])_0x402606[_0x1f656e(0xb3)]=_0x4e9963[_0x1f656e(0xb3)];let _0x1a8175;try{_0x1a8175=await _0x3fab29['segment'][_0x1f656e(0x206)](_0x46cb90,_0x402606),_0x330786[_0x1f656e(0x144)]();}catch(_0x154fbd){_0x330786[_0x1f656e(0x144)]();throw _0x154fbd;}const _0x533bb6=_0x4e9963[_0x1f656e(0xb3)]||_0x1f656e(0x14d);return this[_0x1f656e(0x121)](_0x1a8175,_0x402606,_0x527f2d,_0x533bb6),_0x1a8175[_0x1f656e(0xb5)]?0x0:0x1;}['displayValidateResults'](_0x585cfb,_0x3b2dd7,_0x388c5e,_0x263c11){const _0x1e93d3=a29_0x4f72eb;console['error']('\x0a'+a29_0x348113['bold']('Validate:')+'\x20'+_0x585cfb['name']),console[_0x1e93d3(0xf5)]('═'[_0x1e93d3(0x158)](0x3c)),this[_0x1e93d3(0x19e)](_0x585cfb);if(typeof _0x3b2dd7[_0x1e93d3(0x1d9)]===_0x1e93d3(0x1f7)){this['displayAttributesStats'](_0x585cfb),this[_0x1e93d3(0x13b)](_0x585cfb),this[_0x1e93d3(0x17a)](_0x388c5e,_0x263c11,'attribute',_0x3b2dd7[_0x1e93d3(0x1d9)]);return;}if(_0x3b2dd7[_0x1e93d3(0x1d9)]===!![]){this[_0x1e93d3(0x131)](_0x585cfb),this[_0x1e93d3(0x13b)](_0x585cfb),this[_0x1e93d3(0x17a)](_0x388c5e,_0x263c11,_0x1e93d3(0x89));return;}if(typeof _0x3b2dd7[_0x1e93d3(0x1e3)]===_0x1e93d3(0x1f7)){this[_0x1e93d3(0xa5)](_0x585cfb,_0x263c11),this['displaySummary'](_0x585cfb),this['displayPreviewHints'](_0x388c5e,_0x263c11,_0x1e93d3(0x1e3),_0x3b2dd7[_0x1e93d3(0x1e3)]);return;}if(_0x3b2dd7['behavior']===!![]){this[_0x1e93d3(0xa5)](_0x585cfb,_0x263c11),this['displaySummary'](_0x585cfb),this[_0x1e93d3(0x17a)](_0x388c5e,_0x263c11,_0x1e93d3(0xe6));return;}this[_0x1e93d3(0x131)](_0x585cfb),this[_0x1e93d3(0xa5)](_0x585cfb,_0x263c11),this['displayRealtimeInfo'](_0x585cfb),this[_0x1e93d3(0x13b)](_0x585cfb),this['displayPreviewHints'](_0x388c5e,_0x263c11,_0x1e93d3(0xd1));}[a29_0x4f72eb(0x124)](_0x44f813){displayRealtimeValidation(_0x44f813);}[a29_0x4f72eb(0x17a)](_0x3e2c84,_0x3882db,_0x62cff,_0x4b9dd4){const _0x12b9b2=a29_0x4f72eb;console['error']('\x0a'+a29_0x348113[_0x12b9b2(0xb0)]('To\x20view\x20sample\x20data:'));const _0x234f6d=_0x3882db!==_0x12b9b2(0x14d)?_0x12b9b2(0xeb)+_0x3882db:'';if(_0x62cff==='attribute'&&_0x4b9dd4)console['error']('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)]('tdx\x20ps\x20preview\x20'+_0x3e2c84+_0x12b9b2(0x92)+_0x4b9dd4+'\x22'+_0x234f6d));else{if(_0x62cff===_0x12b9b2(0x1e3)&&_0x4b9dd4)console['error']('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)]('tdx\x20ps\x20preview\x20'+_0x3e2c84+'\x20--behavior\x20\x22'+_0x4b9dd4+'\x22'+_0x234f6d));else(_0x62cff===_0x12b9b2(0x89)||_0x62cff===_0x12b9b2(0xd1))&&console[_0x12b9b2(0xf5)]('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)](_0x12b9b2(0xb9)+_0x3e2c84+_0x12b9b2(0x14e)+_0x234f6d));}(_0x62cff===_0x12b9b2(0xe6)||_0x62cff==='all')&&console[_0x12b9b2(0xf5)]('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)](_0x12b9b2(0xb9)+_0x3e2c84+_0x12b9b2(0xa4)+_0x234f6d)),_0x62cff===_0x12b9b2(0xd1)&&console[_0x12b9b2(0xf5)]('\x20\x20'+a29_0x348113[_0x12b9b2(0xb0)](_0x12b9b2(0xb9)+_0x3e2c84+_0x12b9b2(0x108)+_0x234f6d));}[a29_0x4f72eb(0x19e)](_0x3ca7b5){const _0x11be96=a29_0x4f72eb,{master:_0x814f72}=_0x3ca7b5,_0x40cfce=_0x814f72['schemaValid']?a29_0x348113['green']('✔'):a29_0x348113[_0x11be96(0x1d6)]('✘');console['error']('\x0a'+a29_0x348113[_0x11be96(0xb0)](_0x11be96(0x1be))),console[_0x11be96(0xf5)](_0x40cfce+'\x20'+a29_0x348113['bold'](_0x814f72[_0x11be96(0xd0)]+'.'+_0x814f72[_0x11be96(0x12c)])),_0x814f72[_0x11be96(0x18e)]?_0x814f72['rowCount']!==undefined&&console[_0x11be96(0xf5)]('\x20\x20'+a29_0x348113[_0x11be96(0xb0)]('Rows:')+'\x20'+a29_0x348113[_0x11be96(0x9c)](formatRows(_0x814f72[_0x11be96(0xa9)]))):console['error']('\x20\x20'+a29_0x348113[_0x11be96(0x1d6)](_0x11be96(0x17b))+'\x20'+_0x814f72[_0x11be96(0x1bf)]);}[a29_0x4f72eb(0x131)](_0x26e98d){const _0xc96bf7=a29_0x4f72eb;if(_0x26e98d[_0xc96bf7(0x89)]['length']===0x0)return;console[_0xc96bf7(0xf5)]('\x0a'+a29_0x348113[_0xc96bf7(0xb0)]('Attributes'));for(const _0x42ad91 of _0x26e98d[_0xc96bf7(0x89)]){const _0x228d9f=_0x42ad91[_0xc96bf7(0x18e)]?a29_0x348113['green']('✔'):a29_0x348113['red']('✘');let _0x708d60='';if(_0x42ad91[_0xc96bf7(0x18e)]&&_0x42ad91['matchedCount']!==undefined&&_0x42ad91['coveragePercent']!==undefined){const _0x27ae40=_0x42ad91[_0xc96bf7(0xd2)][_0xc96bf7(0x1d0)](0x1),_0x3fc4e6=_0x42ad91[_0xc96bf7(0xd2)]>=0x50?a29_0x348113[_0xc96bf7(0x16f)]:_0x42ad91[_0xc96bf7(0xd2)]>=0x32?a29_0x348113[_0xc96bf7(0xb2)]:a29_0x348113[_0xc96bf7(0x1d6)];_0x708d60='\x20'+a29_0x348113[_0xc96bf7(0xb0)](_0xc96bf7(0xef))+'\x20'+_0x3fc4e6(_0x27ae40+'%')+'\x20('+formatRows(_0x42ad91['matchedCount'])+_0xc96bf7(0x1b0);}console[_0xc96bf7(0xf5)](_0x228d9f+'\x20'+a29_0x348113[_0xc96bf7(0x159)](_0x42ad91[_0xc96bf7(0xa8)])+_0x708d60),console[_0xc96bf7(0xf5)]('\x20\x20'+a29_0x348113[_0xc96bf7(0xb0)](_0xc96bf7(0x1ef))+'\x20'+a29_0x348113[_0xc96bf7(0x159)](_0x42ad91[_0xc96bf7(0xd0)]+'.'+_0x42ad91[_0xc96bf7(0x12c)]));const _0x38ca13=_0x42ad91[_0xc96bf7(0x1a4)]===_0x42ad91['foreignKey']?a29_0x348113[_0xc96bf7(0xb0)](_0xc96bf7(0xd5))+'\x20'+_0x42ad91[_0xc96bf7(0x1a4)]:a29_0x348113[_0xc96bf7(0xb0)]('Join:')+'\x20'+_0x42ad91[_0xc96bf7(0x1a4)]+_0xc96bf7(0x1c6)+_0x42ad91[_0xc96bf7(0x169)];console[_0xc96bf7(0xf5)]('\x20\x20'+_0x38ca13),console['error']('\x20\x20'+a29_0x348113[_0xc96bf7(0xb0)]('Columns:')),this[_0xc96bf7(0x1d1)](_0x42ad91[_0xc96bf7(0x8f)]),!_0x42ad91[_0xc96bf7(0x18e)]&&console['error']('\x20\x20'+a29_0x348113[_0xc96bf7(0x1d6)]('Error:')+'\x20'+_0x42ad91[_0xc96bf7(0x1bf)]);}}[a29_0x4f72eb(0xa5)](_0x2e4caf,_0x259aeb){const _0x3fb35b=a29_0x4f72eb;if(_0x2e4caf[_0x3fb35b(0xe6)][_0x3fb35b(0x1ee)]===0x0)return;console[_0x3fb35b(0xf5)]('\x0a'+a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0x18b))+'\x20'+a29_0x348113[_0x3fb35b(0xb0)]('('+_0x259aeb+')'));for(const _0x44e980 of _0x2e4caf[_0x3fb35b(0xe6)]){const _0x46bc18=_0x44e980[_0x3fb35b(0x18e)]?a29_0x348113[_0x3fb35b(0x16f)]('✔'):a29_0x348113[_0x3fb35b(0x1d6)]('✘');let _0x49bb15='';if(_0x44e980[_0x3fb35b(0x18e)]&&_0x44e980[_0x3fb35b(0x90)]!==undefined&&_0x44e980[_0x3fb35b(0x1a2)]!==undefined){const _0x237c26=_0x44e980[_0x3fb35b(0x162)]?.[_0x3fb35b(0x1d0)](0x1)||'?',_0x3e3054=(_0x44e980[_0x3fb35b(0x162)]??0x0)>=0x32?a29_0x348113['green']:(_0x44e980[_0x3fb35b(0x162)]??0x0)>=0x14?a29_0x348113[_0x3fb35b(0xb2)]:a29_0x348113[_0x3fb35b(0x1d6)];_0x49bb15='\x20'+a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0x1b9))+'\x20'+_0x3e3054(formatRows(_0x44e980['customersWithEvents']))+'\x20('+_0x237c26+'%)\x20'+a29_0x348113['dim']('Events:')+'\x20'+a29_0x348113[_0x3fb35b(0x9c)](formatRows(_0x44e980[_0x3fb35b(0x1a2)]));}console['error'](_0x46bc18+'\x20'+a29_0x348113['bold'](_0x44e980[_0x3fb35b(0xa8)])+_0x49bb15),console[_0x3fb35b(0xf5)]('\x20\x20'+a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0x1ef))+'\x20'+a29_0x348113['bold'](_0x44e980[_0x3fb35b(0xd0)]+'.'+_0x44e980[_0x3fb35b(0x12c)]));const _0x115aed=_0x44e980[_0x3fb35b(0x1a4)]===_0x44e980[_0x3fb35b(0x169)]?a29_0x348113[_0x3fb35b(0xb0)](_0x3fb35b(0xd5))+'\x20'+_0x44e980[_0x3fb35b(0x1a4)]:a29_0x348113[_0x3fb35b(0xb0)]('Join:')+'\x20'+_0x44e980['joinKey']+_0x3fb35b(0x1c6)+_0x44e980[_0x3fb35b(0x169)];console['error']('\x20\x20'+_0x115aed),console['error']('\x20\x20'+a29_0x348113[_0x3fb35b(0xb0)]('Columns:')),this[_0x3fb35b(0x1d1)](_0x44e980['columns']),!_0x44e980['schemaValid']&&console[_0x3fb35b(0xf5)]('\x20\x20'+a29_0x348113[_0x3fb35b(0x1d6)](_0x3fb35b(0x17b))+'\x20'+_0x44e980['schemaError']);}}[a29_0x4f72eb(0x1d1)](_0x211fcc){const _0x16d9f6=a29_0x4f72eb;for(const _0x54db0e of _0x211fcc){_0x54db0e[_0x16d9f6(0x12b)]===_0x54db0e[_0x16d9f6(0x8b)]||_0x54db0e[_0x16d9f6(0x8b)]==='*'?console[_0x16d9f6(0xf5)](_0x16d9f6(0x15f)+_0x54db0e[_0x16d9f6(0x12b)]):console[_0x16d9f6(0xf5)](_0x16d9f6(0x15f)+_0x54db0e[_0x16d9f6(0x12b)]+'\x20'+a29_0x348113[_0x16d9f6(0xb0)]('('+_0x54db0e[_0x16d9f6(0x8b)]+')'));}}[a29_0x4f72eb(0x13b)](_0x73be99){const _0x427733=a29_0x4f72eb;console['error']('─'[_0x427733(0x158)](0x3c));if(_0x73be99[_0x427733(0x1a3)][_0x427733(0x1ee)]>0x0){console[_0x427733(0xf5)]('\x0a'+a29_0x348113['red'](_0x427733(0xc1)));for(const _0xac4553 of _0x73be99['errors']){console['error']('\x20\x20'+a29_0x348113[_0x427733(0x1d6)]('•')+'\x20'+_0xac4553);}}_0x73be99[_0x427733(0xb5)]&&console['error']('\x0a'+a29_0x348113['green']('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0xf6);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x1ba);async['execute'](_0x1a825e){const _0x456e42=a29_0x4f72eb,{options:_0x2d8347,args:_0x31ad9c,tdx:_0x623d77}=_0x1a825e,_0x27e707=_0x2d8347,_0xb1d9e8=_0x31ad9c[0x0]||_0x2d8347['parentSegment'];if(!_0xb1d9e8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x456e42(0x17e)+_0x456e42(0x1b1)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x456e42(0x1ac)+_0x456e42(0x199)+_0x456e42(0xcb)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x27e707[_0x456e42(0x1c5)]&&!_0x27e707['attribute']&&!_0x27e707[_0x456e42(0x1e3)]&&!_0x27e707[_0x456e42(0x1cc)])return console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console['error'](_0x456e42(0xc0)),console['error'](_0x456e42(0xf7)),console[_0x456e42(0xf5)]('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x456e42(0xf5)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console['error'](_0x456e42(0xdc)),console[_0x456e42(0xf5)](_0x456e42(0x114)),0x1;const _0x257fe6=resolveYamlFile(_0xb1d9e8);if(!existsSync(_0x257fe6))return showFileNotFoundError(_0x257fe6,_0xb1d9e8),0x1;_0x27e707[_0x456e42(0x15d)]&&(console[_0x456e42(0xf5)]('Site:\x20'+_0x27e707[_0x456e42(0x130)]),console[_0x456e42(0xf5)](_0x456e42(0x1eb)+_0x257fe6));let _0x459acb;try{_0x459acb=readFileSync(_0x257fe6,_0x456e42(0x1dc));}catch(_0x586922){const _0x570e84=_0x586922 instanceof Error?_0x586922[_0x456e42(0xc8)]:String(_0x586922);return console[_0x456e42(0xf5)](_0x456e42(0x8c)+_0x570e84),0x1;}let _0xf33758;try{_0xf33758=parseDef(_0x459acb);}catch(_0x1790e5){const _0x4b15c8=_0x1790e5 instanceof Error?_0x1790e5[_0x456e42(0xc8)]:String(_0x1790e5);return console['error'](a29_0x348113[_0x456e42(0x1d6)]('Error\x20parsing\x20YAML:\x20'+_0x4b15c8)),0x1;}if(_0x27e707[_0x456e42(0x1d9)]===!![]||_0x27e707[_0x456e42(0x1d9)]===''){const _0x21c084=_0xf33758[_0x456e42(0x89)]?.[_0x456e42(0x193)](_0x2b4b59=>_0x2b4b59[_0x456e42(0xa8)])||[];if(_0x21c084[_0x456e42(0x1ee)]===0x0)console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)](_0x456e42(0x1b6)));else{console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console[_0x456e42(0xf5)](_0x456e42(0x1e0));for(const _0x30d17a of _0x21c084){console[_0x456e42(0xf5)]('\x20\x20'+a29_0x348113[_0x456e42(0x9c)](_0x30d17a));}console[_0x456e42(0xf5)](_0x456e42(0x102)+_0xb1d9e8+'\x20--attribute\x20\x22'+_0x21c084[0x0]+'\x22');}return 0x1;}if(_0x27e707[_0x456e42(0x1e3)]===!![]||_0x27e707[_0x456e42(0x1e3)]===''){const _0x5be295=_0xf33758[_0x456e42(0xe6)]?.[_0x456e42(0x193)](_0x28db5c=>_0x28db5c[_0x456e42(0xa8)])||[];if(_0x5be295['length']===0x0)console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)](_0x456e42(0x126)));else{console[_0x456e42(0xf5)](a29_0x348113[_0x456e42(0x1d6)](_0x456e42(0x1c4))),console[_0x456e42(0xf5)](_0x456e42(0x12e));for(const _0x348048 of _0x5be295){console[_0x456e42(0xf5)]('\x20\x20'+a29_0x348113[_0x456e42(0x9c)](_0x348048));}console[_0x456e42(0xf5)](_0x456e42(0x102)+_0xb1d9e8+_0x456e42(0x1b4)+_0x5be295[0x0]+'\x22');}return 0x1;}const _0x8b7553=createCommandSpinner(a29_0x348113[_0x456e42(0xb0)]('Fetching\x20sample\x20data...'),{'verbose':_0x27e707[_0x456e42(0x15d)]});_0x8b7553[_0x456e42(0xd3)]();const _0xce5234={'onProgress':_0x69b6fc=>{const _0x3c2506=_0x456e42;_0x8b7553[_0x3c2506(0x13a)]=formatProgressMessage(_0x69b6fc);}};if(_0x27e707[_0x456e42(0x1c5)])_0xce5234[_0x456e42(0x1c5)]=!![];if(_0x27e707[_0x456e42(0x1d9)]&&typeof _0x27e707[_0x456e42(0x1d9)]===_0x456e42(0x1f7))_0xce5234['attribute']=_0x27e707['attribute'];if(_0x27e707[_0x456e42(0x1e3)]&&typeof _0x27e707[_0x456e42(0x1e3)]===_0x456e42(0x1f7))_0xce5234[_0x456e42(0x1e3)]=_0x27e707[_0x456e42(0x1e3)];if(_0x27e707[_0x456e42(0x1cc)])_0xce5234[_0x456e42(0x1cc)]=!![];if(_0x27e707[_0x456e42(0xb3)])_0xce5234[_0x456e42(0xb3)]=_0x27e707['interval'];let _0x36d57b;try{_0x36d57b=await _0x623d77['segment'][_0x456e42(0x140)](_0x459acb,_0xce5234),_0x8b7553[_0x456e42(0x144)]();}catch(_0x561aee){_0x8b7553[_0x456e42(0x144)]();throw _0x561aee;}return await this[_0x456e42(0xac)](_0x36d57b,{'master':_0x27e707[_0x456e42(0x1c5)],'attribute':typeof _0x27e707[_0x456e42(0x1d9)]==='string'?_0x27e707[_0x456e42(0x1d9)]:undefined,'behavior':typeof _0x27e707['behavior']==='string'?_0x27e707[_0x456e42(0x1e3)]:undefined,'enriched':_0x27e707[_0x456e42(0x1cc)]}),_0x36d57b[_0x456e42(0xb5)]?0x0:0x1;}async[a29_0x4f72eb(0xac)](_0x189a57,_0x1271f9){const _0x3b2e3c=a29_0x4f72eb;console[_0x3b2e3c(0xf5)]('\x0a'+a29_0x348113[_0x3b2e3c(0x159)]('Preview:')+'\x20'+_0x189a57[_0x3b2e3c(0xa8)]),console[_0x3b2e3c(0xf5)]('═'[_0x3b2e3c(0x158)](0x3c));if(_0x1271f9['master']&&_0x189a57[_0x3b2e3c(0x151)]){const _0x2b85b4=a29_0x348113[_0x3b2e3c(0xb0)]('Master:')+'\x20'+a29_0x348113[_0x3b2e3c(0x159)](_0x189a57[_0x3b2e3c(0x1c5)][_0x3b2e3c(0xd0)]+'.'+_0x189a57[_0x3b2e3c(0x1c5)][_0x3b2e3c(0x12c)]);await this[_0x3b2e3c(0x1b7)](_0x2b85b4,_0x189a57[_0x3b2e3c(0x151)]);}else{if(_0x1271f9[_0x3b2e3c(0x1d9)]&&_0x189a57[_0x3b2e3c(0x151)]){const _0xc0d799=a29_0x348113['dim']('Attribute:')+'\x20'+a29_0x348113[_0x3b2e3c(0x159)](_0x1271f9[_0x3b2e3c(0x1d9)]);await this[_0x3b2e3c(0x1b7)](_0xc0d799,_0x189a57[_0x3b2e3c(0x151)]);}else{if(_0x1271f9[_0x3b2e3c(0x1e3)]&&_0x189a57[_0x3b2e3c(0x151)]){const _0x59944a=a29_0x348113[_0x3b2e3c(0xb0)](_0x3b2e3c(0x172))+'\x20'+a29_0x348113[_0x3b2e3c(0x159)](_0x1271f9[_0x3b2e3c(0x1e3)]);await this[_0x3b2e3c(0x1b7)](_0x59944a,_0x189a57[_0x3b2e3c(0x151)]);}else{if(_0x1271f9[_0x3b2e3c(0x1cc)]&&_0x189a57[_0x3b2e3c(0x151)]){const _0x264873=a29_0x348113['dim']('Enriched:')+'\x20'+a29_0x348113['bold']('Master\x20+\x20Attributes');await this[_0x3b2e3c(0x1b7)](_0x264873,_0x189a57[_0x3b2e3c(0x151)]);}else!_0x189a57[_0x3b2e3c(0x151)]&&console[_0x3b2e3c(0xf5)](_0x3b2e3c(0x141));}}}if(_0x189a57[_0x3b2e3c(0x1a3)][_0x3b2e3c(0x1ee)]>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a29_0x348113['red'](_0x3b2e3c(0xc1)));for(const _0x408b84 of _0x189a57['errors']){console[_0x3b2e3c(0xf5)]('\x20\x20'+a29_0x348113[_0x3b2e3c(0x1d6)]('•')+'\x20'+_0x408b84);}}}async[a29_0x4f72eb(0x1b7)](_0x21d801,_0x4759ca){const _0x212a48=a29_0x4f72eb;if(_0x4759ca[_0x212a48(0x1ee)]===0x0){console[_0x212a48(0xf5)]('\x0a'+_0x21d801),console[_0x212a48(0xf5)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x212a48(0xf5)]('\x0a'+_0x21d801);const _0x37729a=Object[_0x212a48(0xf3)](_0x4759ca[0x0])[_0x212a48(0x193)](_0x2509eb=>({'name':_0x2509eb,'type':typeof _0x4759ca[0x0][_0x2509eb]==='number'?'double':_0x212a48(0x132)})),_0x3e9ba9={'queryId':_0x212a48(0x95),'columns':_0x37729a,'data':_0x4759ca,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4759ca[_0x212a48(0x1ee)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x1ec8da=formatAsTable(_0x3e9ba9,_0x4759ca[_0x212a48(0x1ee)],!![]);await writeOutput(_0x1ec8da,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]='segment:parent:run';[a29_0x4f72eb(0x196)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x4f72eb(0x110)](_0x11dd3f){const _0x280c77=a29_0x4f72eb,{options:_0x2eed26,args:_0x34f47b,tdx:_0x15a70b}=_0x11dd3f,_0x2a5a43=_0x2eed26,_0x547fba=_0x34f47b[0x0]||_0x2eed26[_0x280c77(0x1c7)];if(!_0x547fba)return showParentSegmentNotSetError(_0x280c77(0x1f4)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x1a82e4=resolveYamlFile(_0x547fba);if(existsSync(_0x1a82e4)){_0x2a5a43[_0x280c77(0x15d)]&&console[_0x280c77(0xf5)](_0x280c77(0x15c)+_0x1a82e4);let _0x3c83df;try{_0x3c83df=readFileSync(_0x1a82e4,_0x280c77(0x1dc));}catch(_0x8bc17){const _0x4a47ad=_0x8bc17 instanceof Error?_0x8bc17[_0x280c77(0xc8)]:String(_0x8bc17);return console[_0x280c77(0xf5)](_0x280c77(0x8c)+_0x4a47ad),0x1;}const _0x159c5b=await withSpinner('Analyzing\x20changes...',()=>_0x15a70b[_0x280c77(0x166)]['pushParentYaml'](_0x3c83df),{'verbose':_0x2a5a43[_0x280c77(0x15d)]}),_0x309682=_0x159c5b[_0x280c77(0xbf)],{isNew:_0x1025d9,name:_0x12b8fd,hasChanges:_0x4f0908,diffFormatted:_0x42f834}=_0x309682;if(_0x4f0908){_0x1025d9?console[_0x280c77(0xf5)](_0x280c77(0x1d5)+_0x12b8fd+'\x27:'):console[_0x280c77(0xf5)](_0x280c77(0x11f)+_0x12b8fd+'\x27:');console[_0x280c77(0xf5)]('─'[_0x280c77(0x158)](0x3c)),console[_0x280c77(0xf5)](_0x42f834),console[_0x280c77(0xf5)]('─'[_0x280c77(0x158)](0x3c));const _0x3e74e7=_0x1025d9?'Create\x20parent\x20segment\x20\x27'+_0x12b8fd+_0x280c77(0x154):_0x280c77(0x1fe)+_0x12b8fd+_0x280c77(0x154);if(!_0x2a5a43[_0x280c77(0x1e4)]){if(!isInteractive())return console[_0x280c77(0xf5)](a29_0x348113[_0x280c77(0x1d6)](_0x280c77(0x1f8)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x280c77(0xf5)](a29_0x348113[_0x280c77(0xb0)](_0x280c77(0x15b))),0x1;const _0x3b71a8=await confirmKey(_0x3e74e7);if(!_0x3b71a8)return console['error'](a29_0x348113[_0x280c77(0xb2)]('Aborted.')),0x1;}const _0x55e36f=_0x1025d9?'Creating':_0x280c77(0x209);await withSpinner(_0x55e36f+_0x280c77(0x186)+_0x12b8fd+_0x280c77(0xa1),()=>_0x309682[_0x280c77(0xc7)](),{'verbose':_0x2a5a43[_0x280c77(0x15d)]});const _0x34e3d2=_0x1025d9?_0x280c77(0x1ea):'Updated';console[_0x280c77(0xf5)]('✔\x20'+_0x34e3d2+'\x20parent\x20segment\x20\x27'+_0x12b8fd+'\x27');}else console[_0x280c77(0xf5)](_0x280c77(0x94)+_0x12b8fd+_0x280c77(0x1a7));}const _0x52199e=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x547fba+'\x27...',()=>_0x15a70b[_0x280c77(0x166)][_0x280c77(0x146)](_0x547fba),{'verbose':_0x2a5a43[_0x280c77(0x15d)]}),_0x5a5cca=_0x52199e['data'],_0x2d1d2c=getConsoleUrl(_0x2a5a43[_0x280c77(0x130)],_0x280c77(0x14f)+_0x5a5cca[_0x280c77(0xb8)]+'/sessions/'+_0x5a5cca[_0x280c77(0x201)]+_0x280c77(0x13c)+_0x5a5cca[_0x280c77(0x1d2)]);return console[_0x280c77(0xf5)](_0x280c77(0x19f)),console[_0x280c77(0xf5)]('\x20\x20'+a29_0x348113[_0x280c77(0xb0)]('Audience\x20ID:')+'\x20'+_0x5a5cca[_0x280c77(0x1e5)]),console[_0x280c77(0xf5)]('\x20\x20'+a29_0x348113[_0x280c77(0xb0)](_0x280c77(0xf2))+'\x20'+_0x5a5cca[_0x280c77(0x1b3)]),console['error']('\x20\x20'+a29_0x348113['dim'](_0x280c77(0x207))+'\x20'+_0x5a5cca[_0x280c77(0x201)]),console[_0x280c77(0xf5)]('\x20\x20'+a29_0x348113['dim'](_0x280c77(0x1e7))+'\x20'+_0x5a5cca[_0x280c77(0x1d2)]),console[_0x280c77(0xf5)]('\x20\x20'+_0x2d1d2c),console[_0x280c77(0xf5)]('\x0a'+a29_0x348113[_0x280c77(0xb0)](_0x280c77(0x180))+_0x280c77(0x1a1)+_0x5a5cca[_0x280c77(0x1d2)]+_0x280c77(0x175)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:fields';[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x15e);async[a29_0x4f72eb(0x110)](_0x1b3687){const _0x2f30af=a29_0x4f72eb,{options:_0x49d71d,args:_0x5668e5,tdx:_0x467df2}=_0x1b3687,_0xc4fa00=_0x5668e5[0x0]||_0x49d71d['parentSegment'];if(!_0xc4fa00)return showParentSegmentNotSetError(_0x2f30af(0x11a)+_0x2f30af(0x197)),0x1;_0x49d71d[_0x2f30af(0x15d)]&&(console['error']('Site:\x20'+_0x49d71d['site']),console['error'](_0x2f30af(0xa7)+_0xc4fa00));const _0x12e6bc=await withSpinner(_0x2f30af(0x155)+_0xc4fa00+_0x2f30af(0xa1),()=>_0x467df2[_0x2f30af(0x166)][_0x2f30af(0x1c3)](_0xc4fa00),{'verbose':_0x49d71d['verbose']}),_0x2daf14=_0x12e6bc['data'];console[_0x2f30af(0xf5)](_0x2f30af(0xd7)+_0x2daf14['length']+'\x20field'+(_0x2daf14[_0x2f30af(0x1ee)]!==0x1?'s':''));if(_0x49d71d[_0x2f30af(0x19a)]||_0x49d71d[_0x2f30af(0x135)])return await handleSDKOutput(_0x2daf14,_0x49d71d),0x0;return displayFieldsHumanReadable(_0x2daf14,_0xc4fa00),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x14a);['description']=a29_0x4f72eb(0x170);async[a29_0x4f72eb(0x110)](_0x2fbf60){const _0x1f2c72=a29_0x4f72eb,{options:_0x1b8eaa,args:_0x1e2f16,tdx:_0x6fc058}=_0x2fbf60,_0x53f960=_0x1b8eaa,_0x45f795=_0x1e2f16[0x0]||_0x1b8eaa[_0x1f2c72(0x1c7)];if(!_0x45f795)return showParentSegmentNotSetError(_0x1f2c72(0xfa)+_0x1f2c72(0xff)+_0x1f2c72(0x1c1)+_0x1f2c72(0x105)),0x1;_0x1b8eaa['verbose']&&(console[_0x1f2c72(0xf5)]('Site:\x20'+_0x1b8eaa['site']),console['error'](_0x1f2c72(0xa7)+_0x45f795));const _0x4bd259=await withSpinner(_0x1f2c72(0x147)+_0x45f795+_0x1f2c72(0xa1),()=>_0x6fc058['segment'][_0x1f2c72(0xfd)](_0x45f795),{'verbose':_0x1b8eaa[_0x1f2c72(0x15d)]}),_0x525312=_0x4bd259[_0x1f2c72(0xbf)];if(_0x53f960[_0x1f2c72(0x1f5)]){const _0x2599d4=getConsoleNextUrl(_0x53f960[_0x1f2c72(0x130)],_0x1f2c72(0x195)+_0x525312['id']);return console[_0x1f2c72(0xf5)](a29_0x348113[_0x1f2c72(0x16f)]('✔')+_0x1f2c72(0x16b)+a29_0x348113[_0x1f2c72(0x9c)](_0x2599d4)),openBrowser(_0x2599d4),0x0;}return await handleSingleObjectOutput(_0x525312,_0x1b8eaa),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x1c0);[a29_0x4f72eb(0x196)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a29_0x4f72eb(0x110)](_0x4c7f81){const _0x349393=a29_0x4f72eb,{options:_0x27c907,args:_0x41771f,tdx:_0x2748be}=_0x4c7f81,_0x227ceb=_0x27c907,_0x2c054a=_0x41771f[0x0]||_0x27c907['parentSegment'];if(!_0x2c054a)return showParentSegmentNotSetError('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'+'\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'+'Options:\x0a'+_0x349393(0x1c2)),0x1;_0x27c907[_0x349393(0x15d)]&&(console[_0x349393(0xf5)]('Site:\x20'+_0x27c907[_0x349393(0x130)]),console[_0x349393(0xf5)]('Parent\x20segment:\x20'+_0x2c054a));const _0x2c4564=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2c054a+_0x349393(0xa1),()=>_0x2748be[_0x349393(0x166)][_0x349393(0x115)](_0x2c054a),{'verbose':_0x27c907[_0x349393(0x15d)]}),_0x58fb97=_0x2c4564[_0x349393(0xbf)],_0x459264=_0x2748be[_0x349393(0x166)][_0x349393(0x145)](_0x58fb97);if(_0x227ceb[_0x349393(0x1a8)]){const _0x1e452b=await this[_0x349393(0xad)](_0x4c7f81,_0x2c054a,_0x58fb97,_0x459264),_0x50ada6=this[_0x349393(0x1dd)](_0x1e452b);writeFileSync(_0x227ceb[_0x349393(0x1a8)],_0x50ada6);const _0x16ff26=_0x1e452b[_0x349393(0x13e)][_0x349393(0x8f)][_0x349393(0x1ee)]+_0x1e452b[_0x349393(0xe6)][_0x349393(0xa3)]((_0x47a336,_0x1361df)=>_0x47a336+_0x1361df[_0x349393(0x8f)][_0x349393(0x1ee)],0x0),_0xe5594b=_0x1e452b['behaviors'][_0x349393(0x109)](_0x39f7d5=>_0x39f7d5[_0x349393(0x8f)]['length']===0x0)[_0x349393(0x1ee)];return console[_0x349393(0x10a)](_0x349393(0x1c8)+_0x227ceb[_0x349393(0x1a8)]),console[_0x349393(0x10a)](_0x349393(0x187)+_0x459264),console[_0x349393(0x10a)](_0x349393(0xb6)+_0x1e452b[_0x349393(0xe6)]['length']+_0x349393(0x16a)),console[_0x349393(0x10a)](_0x349393(0x1cb)+_0x16ff26+'\x20total'),_0xe5594b>0x0&&console[_0x349393(0x10a)](_0x349393(0x190)+_0xe5594b+_0x349393(0x137)),0x0;}console[_0x349393(0xf5)]('\x0a'+a29_0x348113[_0x349393(0x159)](_0x349393(0xfc))+'\x20'+a29_0x348113[_0x349393(0x9c)](_0x459264));const _0xee0550=await withSpinner(_0x349393(0xde),()=>_0x2748be[_0x349393(0x166)][_0x349393(0x136)](_0x58fb97),{'verbose':_0x27c907[_0x349393(0x15d)]});console[_0x349393(0xf5)]('\x0a'+a29_0x348113['bold'](_0x349393(0x13e))+'\x20'+a29_0x348113[_0x349393(0xb0)]('('+_0x459264+_0x349393(0xe8)));const _0x327c0f=await executeSchemaQuery(_0xee0550[_0x349393(0xbf)],_0x2748be,_0x27c907);await handleQueryOutput(_0x327c0f,_0x27c907);const _0xe283a1=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x2748be['segment'][_0x349393(0x168)](_0x58fb97),{'verbose':_0x27c907['verbose']});for(const _0x2191bd of _0xe283a1[_0x349393(0xbf)]){const _0x22fa9b=_0x349393(0xbb)+_0x2191bd[_0x349393(0x1d8)]()[_0x349393(0x117)](/\s+/g,'_'),_0x5b1c49=_0x349393(0x16c)+_0x459264+'.'+_0x22fa9b;console[_0x349393(0xf5)]('\x0a'+a29_0x348113[_0x349393(0x159)](_0x2191bd)+'\x20'+a29_0x348113['dim']('('+_0x459264+'.'+_0x22fa9b+')'));try{const _0x34e451=await executeSchemaQuery(_0x5b1c49,_0x2748be,_0x27c907);await handleQueryOutput(_0x34e451,_0x27c907);}catch{console['error'](a29_0x348113[_0x349393(0xb2)](_0x349393(0x107)));}}return 0x0;}async[a29_0x4f72eb(0xad)](_0x8a7484,_0x3cb225,_0x1028ee,_0x30b1e6){const _0x20f9b9=a29_0x4f72eb,{options:_0x5c5322,tdx:_0x281915}=_0x8a7484,_0x38c4d5=await withSpinner(_0x20f9b9(0xde),()=>_0x281915['segment']['getParentSQL'](_0x1028ee),{'verbose':_0x5c5322[_0x20f9b9(0x15d)]}),_0x53f72d=await executeSchemaQuery(_0x38c4d5[_0x20f9b9(0xbf)],_0x281915,_0x5c5322),_0x1a350e=_0x53f72d['data']['map'](_0x5393d0=>({'name':_0x5393d0[_0x20f9b9(0x188)],'type':_0x5393d0[_0x20f9b9(0xc6)]})),_0x14bd6d=await withSpinner(_0x20f9b9(0x167),()=>_0x281915[_0x20f9b9(0x166)]['getBehaviorNames'](_0x1028ee),{'verbose':_0x5c5322[_0x20f9b9(0x15d)]}),_0x19efbe=[];for(const _0x1b7d6d of _0x14bd6d[_0x20f9b9(0xbf)]){const _0x45001c=_0x20f9b9(0xbb)+_0x1b7d6d[_0x20f9b9(0x1d8)]()[_0x20f9b9(0x117)](/\s+/g,'_'),_0xc2ca58=_0x20f9b9(0x16c)+_0x30b1e6+'.'+_0x45001c;let _0xa7634=[];try{const _0x269345=await executeSchemaQuery(_0xc2ca58,_0x281915,_0x5c5322);_0xa7634=_0x269345[_0x20f9b9(0xbf)][_0x20f9b9(0x193)](_0x37a3b5=>({'name':_0x37a3b5[_0x20f9b9(0x188)],'type':_0x37a3b5['column_type']}));}catch{}_0x19efbe[_0x20f9b9(0x204)]({'table':_0x45001c,'columns':_0xa7634});}return{'database':_0x30b1e6,'parent_segment':_0x3cb225,'parent_id':_0x1028ee,'customers':{'table':'customers','columns':_0x1a350e},'behaviors':_0x19efbe};}[a29_0x4f72eb(0x1dd)](_0x425e55){const _0x264595=a29_0x4f72eb,_0x461d91=_0x511760=>{const _0x40da8b=a29_0x2465;if(_0x511760[_0x40da8b(0x1ee)]===0x0)return'[]';const _0x215100=_0x511760[_0x40da8b(0x193)](_0x332ed9=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x332ed9[_0x40da8b(0xa8)]+_0x40da8b(0xd4)+_0x332ed9[_0x40da8b(0x174)]+'\x22\x20}');return'[\x0a'+_0x215100[_0x40da8b(0x1cd)](',\x0a')+_0x40da8b(0x15a);},_0x33c985=_0x425e55[_0x264595(0xe6)][_0x264595(0x193)](_0x287f65=>{const _0x592a67=_0x264595;return'\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x287f65[_0x592a67(0x12c)]+_0x592a67(0xf4)+_0x461d91(_0x287f65['columns'])['replace'](/^/gm,'\x20\x20')[_0x592a67(0x119)]()+_0x592a67(0xa6);})['join'](',\x0a');return _0x264595(0xbc)+_0x425e55[_0x264595(0xd0)]+_0x264595(0x12f)+_0x425e55['parent_segment']+_0x264595(0x13d)+_0x425e55[_0x264595(0x1b5)]+'\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22'+_0x425e55[_0x264595(0x13e)][_0x264595(0x12c)]+_0x264595(0x1db)+_0x461d91(_0x425e55[_0x264595(0x13e)][_0x264595(0x8f)])[_0x264595(0x117)](/^/gm,'\x20\x20')['trim']()+_0x264595(0xcf)+_0x33c985+_0x264595(0xe7);}}function a29_0x2465(_0x24b1aa,_0x26bff4){_0x24b1aa=_0x24b1aa-0x88;const _0x53df5d=a29_0x53df();let _0x2465b5=_0x53df5d[_0x24b1aa];return _0x2465b5;}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:sql';[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x194);async[a29_0x4f72eb(0x110)](_0x15f69e){const _0x55f6cf=a29_0x4f72eb,{options:_0x1d3524,args:_0xe88f6f,tdx:_0x489e44}=_0x15f69e,_0x2a7631=_0xe88f6f[0x0]||_0x1d3524['parentSegment'];if(!_0x2a7631)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'+_0x55f6cf(0x1f9)),0x1;_0x1d3524[_0x55f6cf(0x15d)]&&(console[_0x55f6cf(0xf5)]('Site:\x20'+_0x1d3524[_0x55f6cf(0x130)]),console[_0x55f6cf(0xf5)](_0x55f6cf(0xa7)+_0x2a7631));const _0x3e5a8c=await withSpinner(_0x55f6cf(0x9f)+_0x2a7631+_0x55f6cf(0xa1),()=>_0x489e44[_0x55f6cf(0x166)]['resolveParentId'](_0x2a7631),{'verbose':_0x1d3524[_0x55f6cf(0x15d)]}),_0xebc14c=_0x3e5a8c[_0x55f6cf(0xbf)],_0x470bc7=await withSpinner(_0x55f6cf(0x1ec)+_0x2a7631+'\x27...',()=>_0x489e44[_0x55f6cf(0x166)]['getParentSQL'](_0xebc14c),{'verbose':_0x1d3524[_0x55f6cf(0x15d)]}),_0x29e9ce=_0x470bc7['data'];return _0x1d3524['format']===_0x55f6cf(0x19a)||_0x1d3524[_0x55f6cf(0x1ca)]===_0x55f6cf(0x135)?await handleSDKOutput([{'sql':_0x29e9ce}],_0x1d3524):console[_0x55f6cf(0x10a)](_0x29e9ce),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]='segment:parent:show';[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x11b);async['execute'](_0x21d78f){const _0x2028c8=a29_0x4f72eb,{options:_0x2114e2,args:_0x1a29e4,tdx:_0x5110b2}=_0x21d78f,_0x34bf18=_0x1a29e4[0x0]||_0x2114e2[_0x2028c8(0x1c7)];if(!_0x34bf18)return showParentSegmentNotSetError(_0x2028c8(0x123)+'\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;_0x2114e2[_0x2028c8(0x15d)]&&(console[_0x2028c8(0xf5)](_0x2028c8(0x12d)+_0x2114e2[_0x2028c8(0x130)]),console[_0x2028c8(0xf5)](_0x2028c8(0xa7)+_0x34bf18));const _0x551c3e=await withSpinner(_0x2028c8(0x9f)+_0x34bf18+'\x27...',()=>_0x5110b2['segment']['resolveParentId'](_0x34bf18),{'verbose':_0x2114e2[_0x2028c8(0x15d)]}),_0x55a0cc=_0x551c3e[_0x2028c8(0xbf)],_0x5efff4=await withSpinner(_0x2028c8(0x1ec)+_0x34bf18+_0x2028c8(0xa1),()=>_0x5110b2['segment'][_0x2028c8(0x136)](_0x55a0cc),{'verbose':_0x2114e2['verbose']});let _0x31c352=_0x5efff4[_0x2028c8(0xbf)];const _0x191e0c=resolveLimit(_0x2114e2[_0x2028c8(0x9b)],DEFAULT_DISPLAY_LIMIT),_0x326656=/\bLIMIT\s+\d+/i['test'](_0x31c352);!_0x326656&&(_0x31c352=_0x31c352[_0x2028c8(0x119)]()[_0x2028c8(0x117)](/;+$/,''),_0x31c352=_0x2028c8(0x156)+_0x31c352+_0x2028c8(0x1ed)+_0x191e0c);_0x2114e2['verbose']&&console[_0x2028c8(0xf5)](_0x2028c8(0x100)+_0x31c352);const _0x44540e=await withProgressSpinner(_0x2028c8(0x1a5),async _0x3c0958=>{const _0x47eb19=_0x2028c8,_0x521b88=await _0x5110b2['query'][_0x47eb19(0x110)](_0x31c352,{'catalog':'td','schema':_0x47eb19(0x93),'onJobId':_0x143417=>{const _0xf866fa=_0x47eb19;_0x3c0958[_0xf866fa(0x1bb)](_0x143417);}});return _0x521b88;},{'verbose':_0x2114e2[_0x2028c8(0x15d)]}),_0x405a79=_0x44540e['data'],_0x5d578b=_0x405a79[_0x2028c8(0x1ce)]?_0x2028c8(0x160)+_0x405a79[_0x2028c8(0x1ce)]+']':'';return console[_0x2028c8(0xf5)]('✔\x20Query\x20completed:\x20Processed\x20'+_0x405a79['stats'][_0x2028c8(0x99)][_0x2028c8(0x101)]()+'\x20rows\x20'+(_0x2028c8(0xb7)+formatElapsed(_0x405a79[_0x2028c8(0x14b)][_0x2028c8(0x9e)])+_0x5d578b)),await handleQueryOutput(_0x405a79,_0x2114e2),0x0;}}export class PSRtListCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0xae);['description']='List\x20parent\x20segments\x20with\x20RT\x202.0\x20status';async['execute'](_0x115c45){const _0x2dc098=a29_0x4f72eb,{options:_0x350dda,args:_0x11db4e,tdx:_0x2d7ab8}=_0x115c45,_0x49106f=_0x11db4e[0x0],_0x3c6fa=await withSpinner(_0x49106f?_0x2dc098(0x91)+_0x49106f+_0x2dc098(0xa1):_0x2dc098(0x116),()=>_0x2d7ab8[_0x2dc098(0x1b8)][_0x2dc098(0x1cf)](),{'verbose':_0x350dda[_0x2dc098(0x15d)]});let _0x400e00=_0x3c6fa['data']['filter'](_0x5ac736=>_0x5ac736[_0x2dc098(0xb4)]);if(_0x49106f){const _0x56d31f=_0x49106f['replace'](/[.+^${}()|[\]\\]/g,_0x2dc098(0xe0))['replace'](/\*/g,'.*')[_0x2dc098(0x117)](/\?/g,'.'),_0xf79a55=new RegExp('^'+_0x56d31f+'$','i');_0x400e00=_0x400e00[_0x2dc098(0x109)](_0xa7da5b=>_0xf79a55[_0x2dc098(0x1bd)](_0xa7da5b[_0x2dc098(0xa8)]));}_0x400e00[_0x2dc098(0x98)]((_0x547df4,_0x5107e2)=>_0x547df4['name'][_0x2dc098(0xbd)](_0x5107e2[_0x2dc098(0xa8)])),console[_0x2dc098(0xf5)](_0x2dc098(0xd7)+_0x400e00[_0x2dc098(0x1ee)]+_0x2dc098(0x1fb)+(_0x400e00[_0x2dc098(0x1ee)]!==0x1?'s':''));const _0x389fd9=_0x2e5eaf=>{const _0x100196=_0x2dc098;return getConsoleNextUrl(_0x350dda[_0x100196(0x130)],'/app/dw/parentSegments/'+_0x2e5eaf);};if(_0x350dda[_0x2dc098(0x1ca)]===_0x2dc098(0x19a)||_0x350dda[_0x2dc098(0x1ca)]===_0x2dc098(0x135)){const _0x14eb77=_0x400e00[_0x2dc098(0x193)](_0xe23f65=>({..._0xe23f65,'url':_0x389fd9(_0xe23f65['id'])}));await handleSDKOutput(_0x14eb77,_0x350dda);}else{if(_0x400e00[_0x2dc098(0x1ee)]===0x0)console['log'](_0x2dc098(0x183));else for(const _0x3dd3e8 of _0x400e00){const _0x1306fd=_0x3dd3e8['population']?a29_0x348113['dim']('\x20('+formatRows(_0x3dd3e8[_0x2dc098(0x8a)])+')'):'',_0x2a875c=hyperlink(_0x3dd3e8[_0x2dc098(0xa8)],_0x389fd9(_0x3dd3e8['id']));console['log']('⚡\x20'+_0x2a875c+_0x1306fd);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x1f6);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x176);async['execute'](_0x11ee64){const _0x295f57=a29_0x4f72eb,{options:_0x2d32ac,args:_0x1e9a68,tdx:_0x53deda}=_0x11ee64,_0x421c23=_0x1e9a68[0x0]||_0x2d32ac['parentSegment'];if(!_0x421c23)return showParentSegmentNotSetError(_0x295f57(0x129)+_0x295f57(0x10f)),0x1;const _0x5f09e9=resolveYamlFile(_0x421c23);if(!existsSync(_0x5f09e9))return showFileNotFoundError(_0x5f09e9,_0x421c23),0x1;let _0x540a23;try{_0x540a23=readFileSync(_0x5f09e9,_0x295f57(0x1dc));}catch(_0x34f2bf){const _0x535856=_0x34f2bf instanceof Error?_0x34f2bf[_0x295f57(0xc8)]:String(_0x34f2bf);return console[_0x295f57(0xf5)]('Error\x20reading\x20file:\x20'+_0x535856),0x1;}const _0x2dd6b7=createCommandSpinner(a29_0x348113['dim'](_0x295f57(0x10d)),{'verbose':_0x2d32ac[_0x295f57(0x15d)]});_0x2dd6b7[_0x295f57(0xd3)]();const _0x1bb0d9={'realtime':!![],'onProgress':_0x7d4e57=>{const _0x3cc54d=_0x295f57;_0x2dd6b7[_0x3cc54d(0x13a)]=formatProgressMessage(_0x7d4e57);}};let _0x9dcecb;try{_0x9dcecb=await _0x53deda[_0x295f57(0x166)][_0x295f57(0x206)](_0x540a23,_0x1bb0d9),_0x2dd6b7[_0x295f57(0x144)]();}catch(_0x23ac90){_0x2dd6b7['stop']();throw _0x23ac90;}console[_0x295f57(0xf5)]('\x0a'+a29_0x348113[_0x295f57(0x159)](_0x295f57(0x1ad))+'\x20'+_0x9dcecb[_0x295f57(0xa8)]),console[_0x295f57(0xf5)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x9dcecb),console[_0x295f57(0xf5)]('─'[_0x295f57(0x158)](0x3c));if(_0x9dcecb[_0x295f57(0x1a3)][_0x295f57(0x1ee)]>0x0){console[_0x295f57(0xf5)]('\x0a'+a29_0x348113[_0x295f57(0x1d6)](_0x295f57(0xc1)));for(const _0xd7ac89 of _0x9dcecb[_0x295f57(0x1a3)]){console[_0x295f57(0xf5)]('\x20\x20'+a29_0x348113[_0x295f57(0x1d6)]('•')+'\x20'+_0xd7ac89);}}return _0x9dcecb[_0x295f57(0xb5)]&&console['error']('\x0a'+a29_0x348113[_0x295f57(0x16f)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x9dcecb[_0x295f57(0xb5)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x182);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0xf0);async['execute'](_0x5ba1cc){const _0x439c1=a29_0x4f72eb,{options:_0x563ab2,args:_0x4176c2,tdx:_0x53b1e2}=_0x5ba1cc,_0x361f67=_0x4176c2[0x0]||_0x563ab2[_0x439c1(0x1c7)];if(!_0x361f67)return showParentSegmentNotSetError('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'+_0x439c1(0xaa)),0x1;const _0x3060b7=await withSpinner(_0x439c1(0x9f)+_0x361f67+_0x439c1(0xa1),()=>_0x53b1e2[_0x439c1(0x166)][_0x439c1(0x115)](_0x361f67),{'verbose':_0x563ab2[_0x439c1(0x15d)]}),_0x301287=_0x3060b7[_0x439c1(0xbf)],_0x1c5379=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x361f67+_0x439c1(0xa1),()=>_0x53b1e2[_0x439c1(0x153)][_0x439c1(0x1cf)](_0x301287),{'verbose':_0x563ab2['verbose']}),_0x4ebd2e=_0x1c5379['data'];console[_0x439c1(0xf5)](_0x439c1(0xd7)+_0x4ebd2e[_0x439c1(0x1ee)]+'\x20personalization\x20service'+(_0x4ebd2e['length']!==0x1?'s':''));if(_0x563ab2['format']===_0x439c1(0x19a)||_0x563ab2[_0x439c1(0x1ca)]===_0x439c1(0x135))await handleSDKOutput(_0x4ebd2e,_0x563ab2);else{if(_0x4ebd2e[_0x439c1(0x1ee)]===0x0)console['log'](_0x439c1(0x118)),console[_0x439c1(0xf5)](a29_0x348113[_0x439c1(0x9c)]('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0xb8e90 of _0x4ebd2e){const _0x3ecfcf=_0xb8e90[_0x439c1(0x18f)]?.[_0x439c1(0x1ee)]||0x0,_0x14e73e=_0xb8e90[_0x439c1(0x134)]?a29_0x348113[_0x439c1(0xb0)]('\x20trigger='+_0xb8e90[_0x439c1(0x134)]):'',_0x171cbb=a29_0x348113[_0x439c1(0xb0)]('\x20('+_0x3ecfcf+'\x20section'+(_0x3ecfcf!==0x1?'s':'')+')');console['log']('\x20\x20'+_0xb8e90[_0x439c1(0xa8)]+_0x14e73e+_0x171cbb),_0xb8e90[_0x439c1(0x196)]&&console['log']('\x20\x20\x20\x20'+a29_0x348113[_0x439c1(0xb0)](_0xb8e90[_0x439c1(0x196)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a29_0x4f72eb(0xa8)]=a29_0x4f72eb(0x178);[a29_0x4f72eb(0x196)]=a29_0x4f72eb(0x1ff);async[a29_0x4f72eb(0x110)](_0x121cce){const _0x57dc61=a29_0x4f72eb,{options:_0x57ad14,args:_0x2cc8c1}=_0x121cce,_0x492797=_0x2cc8c1[0x0]||_0x57ad14['parentSegment'];if(!_0x492797)return showParentSegmentNotSetError('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'+'\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 _0x30c001=resolveYamlFile(_0x492797);if(!existsSync(_0x30c001))return showFileNotFoundError(_0x30c001,_0x492797),0x1;let _0x5b7549;try{_0x5b7549=readFileSync(_0x30c001,_0x57dc61(0x1dc));}catch(_0x943d26){const _0x5991d6=_0x943d26 instanceof Error?_0x943d26[_0x57dc61(0xc8)]:String(_0x943d26);return console[_0x57dc61(0xf5)](_0x57dc61(0x8c)+_0x5991d6),0x1;}let _0x2235a7;try{_0x2235a7=parseDef(_0x5b7549);}catch(_0x2057f5){const _0x3e8b5a=_0x2057f5 instanceof Error?_0x2057f5[_0x57dc61(0xc8)]:String(_0x2057f5);return console[_0x57dc61(0xf5)](a29_0x348113[_0x57dc61(0x1d6)](_0x57dc61(0xf9)+_0x3e8b5a)),0x1;}if(_0x2235a7['personalization_services']&&_0x2235a7['personalization_services'][_0x57dc61(0x1ee)]>0x0)return console['error'](a29_0x348113[_0x57dc61(0xb2)](_0x57dc61(0xab)+_0x30c001)),console[_0x57dc61(0xf5)](a29_0x348113[_0x57dc61(0xb0)](_0x57dc61(0x1e8)+_0x2235a7[_0x57dc61(0x11d)]['length']+_0x57dc61(0x1ab))),0x1;!_0x2235a7[_0x57dc61(0x1b8)]&&(_0x2235a7[_0x57dc61(0x1b8)]={'events':[{'name':'page_view','source_table':_0x57dc61(0x11e)}],'attributes':[{'name':_0x57dc61(0x150),'type':_0x57dc61(0x143)}],'id_stitching':{'primary_key':_0x2235a7['master'][_0x57dc61(0x12c)]===_0x57dc61(0x13e)?_0x57dc61(0x1ae):_0x57dc61(0x17d)}});_0x2235a7[_0x57dc61(0x11d)]=[{'name':'My\x20Service','description':_0x57dc61(0x1aa),'trigger_event':_0x57dc61(0x177),'sections':[{'name':_0x57dc61(0x128),'criteria':_0x57dc61(0x103),'attributes':[_0x57dc61(0x150)]}]}];const _0x3dd4ad=serializeDef(_0x2235a7);return writeFileSync(_0x30c001,_0x3dd4ad,'utf-8'),console[_0x57dc61(0xf5)](a29_0x348113[_0x57dc61(0x16f)]('✔')+_0x57dc61(0x1fa)+a29_0x348113['cyan'](_0x30c001)),(!_0x2235a7['realtime']||_0x5b7549[_0x57dc61(0x1e6)](_0x57dc61(0x10e))===-0x1)&&console['error'](a29_0x348113['green']('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console['error']('\x0a'+a29_0x348113[_0x57dc61(0xb0)]('Next\x20steps:')),console['error'](_0x57dc61(0x104)+_0x30c001+_0x57dc61(0xba)),console[_0x57dc61(0xf5)](_0x57dc61(0xc5)+a29_0x348113[_0x57dc61(0xb0)](_0x57dc61(0xc2)+_0x492797)+_0x57dc61(0x184)),0x0;}}
1
+ const a29_0x4cec4b=a29_0x5785;(function(_0x8eeb4a,_0x4e7f65){const _0xade2a8=a29_0x5785,_0x5115be=_0x8eeb4a();while(!![]){try{const _0x269576=-parseInt(_0xade2a8(0x22b))/0x1+parseInt(_0xade2a8(0x1fd))/0x2*(parseInt(_0xade2a8(0x335))/0x3)+parseInt(_0xade2a8(0x29e))/0x4*(parseInt(_0xade2a8(0x294))/0x5)+parseInt(_0xade2a8(0x296))/0x6+-parseInt(_0xade2a8(0x21a))/0x7*(-parseInt(_0xade2a8(0x1f0))/0x8)+parseInt(_0xade2a8(0x308))/0x9*(parseInt(_0xade2a8(0x324))/0xa)+-parseInt(_0xade2a8(0x216))/0xb;if(_0x269576===_0x4e7f65)break;else _0x5115be['push'](_0x5115be['shift']());}catch(_0x2ad167){_0x5115be['push'](_0x5115be['shift']());}}}(a29_0x2649,0x20939));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x4e119f from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';function a29_0x2649(){const _0xd54934=['listFields','\x0aError:','limit','formatSchemaJson','jobId','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','interval','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','Error\x20reading\x20file:\x20','query','join','segment:parent:push','Name:\x20','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','open','\x20field','behaviors','Attempt:','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','table','1971IgblKH','.yml','yes','bold','errors','getBehaviorNames','\x20\x20Database:\x20','\x27\x20with\x20ID:\x20','Default','name','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','single','Show\x20parent\x20segment\x20details','platform','\x20\x20\x20\x20','site','\x20parent\x20segment\x20\x27','/app/dw/parentSegments/','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','\x20\x201.\x20Edit\x20','stitchingKeys','No\x20personalization\x20services\x20configured','Site:\x20','green','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','getParentFull','collectSchema','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','11150ZANvcW','✔\x20Renamed\x20directory\x20to\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x0a\x20\x20\x20\x20]','number','Listing\x20personalization\x20services\x20for\x20\x27','/sessions/','Listing\x20fields\x20for\x20\x27','\x20\x20\x20\x20-\x20','elapsedTimeMillis','ps:pz:init','length','xdg-open','\x20parent\x20segment','Options:\x0a','createParent','rowCount','24sBFHFP','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','segment:parent:desc','My\x20Service','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','Created','validateParentYaml','trigger_event','Creating\x20parent\x20segment\x20\x27','✘\x20Failed\x20to\x20rename\x20directory:\x20','population','behaviorsFile','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20personalization\x20service','sort','execute','previewParentYaml','audienceId','segment:parent:run','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','in\x20','getOutputDatabaseName','use','utf-8','Error:','foreignKey','Errors:','✔\x20Found\x20','trim','\x0a⚠️\x20\x20Both\x20','yellow','ps:rt:list','Table:\x20','parent_id','Parent\x20segment:\x20','label','sections','column_name','cyan','Updating','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','No\x20parent\x20segments\x20match\x20pattern:\x20','\x22,\x20\x22type\x22:\x20\x22','behavior','Fetching\x20behavior\x20list...','realtime','segment:parent:validate','\x20=\x20','status','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','type','328hDWaQI','displayValidateResults','\x20to\x20push\x20the\x20configuration','log','Get\x20SQL\x20query\x20for\x20parent\x20segment','personalizationServices','Found\x20YAML\x20file:\x20','allValid','\x20[Job\x20ID:\x20','/\x20→\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','\x0aChanges\x20to\x20\x27','Error:\x20Parent\x20segment\x20name\x20is\x20required','9496mtNimk','output','last_page_viewed','database','displayAttributesStats','valid','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Customers:','red','displayBehaviorsStats','runParent','toLocaleString','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','resolveParentId','parent_segments','List\x20parent\x20segments','List\x20available\x20fields\x20for\x20segmentation','endsWith','list','\x20\x20Columns:\x20','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','\x20service(s)\x20configured','\x20rows\x20','attributes','\x27\x20and\x20run\x20workflow?','4435607rMllFf','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','sourceTableError','\x20section','22820nrgUXS','tdx\x20ps\x20preview\x20','segment:parent:preview','session','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','Status:','YAML\x20file:\x20','Listing\x20parent\x20segments...','Resolving\x20parent\x20segment\x20\x27','Overwrite\x20\x27','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','To\x20view\x20sample\x20data:','%)\x20','Audience\x20ID:','RT\x202.0\x20Validate:','all','\x20kill','69461TAbvcf','No\x20parent\x20segments\x20found','\x27\x20is\x20up\x20to\x20date','\x0a⚠️\x20\x20Migrating:\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','workflowId','customerGroup','RT\x202.0:','\x20RT-enabled\x20parent\x20segment','displayMasterInfo','matchedCount','\x0aUsage:\x20tdx\x20ps\x20preview\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x0aNew\x20parent\x20segment\x20\x27','/\x20directories\x20exist.','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Apply\x20changes\x20to\x20\x27','column','segment','td_client_id','\x20\x20\x20\x20\x20\x20','events','Behavior:','web','pushParentYaml','customerPercent','parentSegment','SELECT\x20*\x20FROM\x20','Error\x20parsing\x20YAML:\x20','addBehaviors','\x0a\x20\x20\x20\x20}','behavior_','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','idStitching','verbose','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','segment:parent:pull','user_id','match','using\x20the\x20default\x20path:\x20','addAttributesFile','displayRealtimeInfo','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','Aborted.','customers','\x0a✔\x20Workflow\x20started','schemaValid','test','columns','scheduleOption','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','getParentSQL','No\x20RT-enabled\x20parent\x20segments\x20found','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','joinKey','.yaml','\x20Context\x20set:\x20','data','totalEvents','✔\x20No\x20changes\x20-\x20\x27','/attempt/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','\x27\x20is\x20already\x20up\x20to\x20date','map','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20tdx\x20wf\x20attempt\x20','darwin','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','jsonl','repeat','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20service','true','Attributes:','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','Available\x20behaviors:','coveragePercent','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Attributes','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x20Opening\x20','Creating','\x0aNo\x20sample\x20data\x20available','To\x20cancel:','addBehaviorsFile','\x20rows)','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','\x0aChanges\x20to\x20apply\x20to\x20\x27','Next\x20steps:','Source:','\x20behaviors','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','processedRows','segment:parent:create','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','dim','\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','SELECT\x20*\x20FROM\x20(\x0a','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','customersWithEvents','displayPreviewHints','toFixed','\x27...','Fetching\x20customers\x20schema...','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','91195amGtCU','✔\x20Query\x20completed:\x20Processed\x20','375774yeZXuR','Columns:','stats','apply','Enriched:','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','displaySummary','Options\x20(one\x20required):\x0a','28PfjHSL','parent_segment','scheduleType','Available\x20attributes:','✔\x20Updated\x20parent\x20segment\x20\x27','description','text','message','Executing\x20parent\x20segment\x20query...','format','string','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','timezone','\x20is\x20already\x20up\x20to\x20date','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','displayPreviewResults','Fetching\x20sample\x20data...','Fetching\x20SQL\x20for\x20\x27','master','localeCompare','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','ps:rt:validate','attribute','\x20\x202.\x20Run\x20','\x20--interval\x20','displaySampleData','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20\x20\x20','Preview:','sampleData','workflowAttemptId','Master\x20+\x20Attributes','FINISHED','\x20No\x20changes\x20-\x20','displayColumns','\x20configured','Create\x20parent\x20segment\x20\x27','pullParentYaml','/{name}.yml\x0a','.customers)','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Fetching\x20parent\x20segment\x20\x27','schemaError','\x20RT\x20configuration\x20is\x20valid','error','information_schema','\x20total','workflowSessionId','<database>.<table>','tdx\x20ps\x20push\x20','Database:\x20','page_view','segment:parent:list','Updating\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22','Validating\x20configuration...','varchar','Options:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','reduce','\x5c$&','Rows:','enriched','Validate:','toLowerCase','push','ps:pz:list','replace','\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','filter','Events:','Validating\x20RT\x20configuration...','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','personalization_services','/\x20directory.\x0a','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','start','indexOf','json','stop','\x20--behavior\x20\x22','segment:parent:view','segment:parent:sql'];a29_0x2649=function(){return _0xd54934;};return a29_0x2649();}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 a29_0x483110 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=a29_0x4cec4b(0x20b),LEGACY_PARENT_SEGMENT_DIR=a29_0x4cec4b(0x29f);function openBrowser(_0x5225c6){const _0x49992e=a29_0x4cec4b,_0x413338=process[_0x49992e(0x315)],_0x3e1263=_0x413338===_0x49992e(0x26d)?_0x49992e(0x302):_0x413338==='win32'?_0x49992e(0x2ec):_0x49992e(0x330);spawn(_0x3e1263,[_0x5225c6],{'detached':!![],'stdio':'ignore'})['unref']();}function migrateLegacyDirectory(){const _0x535b35=a29_0x4cec4b;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x27c456=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x27c456['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x483110[_0x535b35(0x1db)](_0x535b35(0x1da)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x535b35(0x239))),console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x28a)]('\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x535b35(0x2ea))),![];console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x1db)](_0x535b35(0x22e)+LEGACY_PARENT_SEGMENT_DIR+_0x535b35(0x1f9)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x31f)](_0x535b35(0x325)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x28b5c5){const _0x5adace=_0x28b5c5 instanceof Error?_0x28b5c5[_0x535b35(0x2a5)]:String(_0x28b5c5);return console[_0x535b35(0x2cb)](a29_0x483110[_0x535b35(0x205)](_0x535b35(0x33e)+_0x5adace+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0xaa439d){return migrateLegacyDirectory(),super['run'](_0xaa439d);}}function resolveYamlFile(_0x203b86){const _0x2429be=a29_0x4cec4b;if(_0x203b86[_0x2429be(0x20e)](_0x2429be(0x309))||_0x203b86[_0x2429be(0x20e)](_0x2429be(0x262)))return _0x203b86;return a29_0x4e119f[_0x2429be(0x2fd)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x203b86)+_0x2429be(0x309));}function formatProgressMessage(_0x50446b){const _0x36cad9=a29_0x4cec4b,_0x1fbc9c=_0x50446b[_0x36cad9(0x251)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x1fbc9c){const [,_0x1cd480,_0x272f62,_0x441415='']=_0x1fbc9c;return a29_0x483110[_0x36cad9(0x28a)](_0x1cd480+':')+'\x20'+_0x272f62+a29_0x483110[_0x36cad9(0x28a)](_0x441415);}return a29_0x483110[_0x36cad9(0x28a)](_0x50446b);}function showFileNotFoundError(_0x328d0f,_0x2c3cb4){const _0x2e632b=a29_0x4cec4b;console[_0x2e632b(0x2cb)](a29_0x483110[_0x2e632b(0x205)]('Error:\x20File\x20not\x20found:\x20'+_0x328d0f+'\x0a')),console[_0x2e632b(0x2cb)](a29_0x483110[_0x2e632b(0x1e3)]('Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20'+_0x2c3cb4+'`\x20to\x20download\x20the\x20configuration\x20first'));}function displayRealtimeValidation(_0x3e251d){const _0x3edb09=a29_0x4cec4b;if(!_0x3e251d['realtime'])return;const _0x586de0=_0x3e251d[_0x3edb09(0x1ea)],_0xbd7dc0=_0x586de0['enabled']?a29_0x483110[_0x3edb09(0x31f)]('⚡\x20Enabled'):a29_0x483110[_0x3edb09(0x1db)]('⚡\x20Not\x20enabled');console[_0x3edb09(0x2cb)]('\x0a'+a29_0x483110[_0x3edb09(0x28a)](_0x3edb09(0x232))+'\x20'+_0xbd7dc0);if(_0x586de0[_0x3edb09(0x240)]&&_0x586de0[_0x3edb09(0x240)][_0x3edb09(0x32f)]>0x0){console[_0x3edb09(0x2cb)]('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)](_0x3edb09(0x2e5))+'\x20'+_0x586de0['events'][_0x3edb09(0x32f)]+_0x3edb09(0x2c2));for(const _0xec9c82 of _0x586de0[_0x3edb09(0x240)]){const _0x7c7352=_0xec9c82['sourceTableValid']===![]?a29_0x483110[_0x3edb09(0x205)]('✘'):a29_0x483110[_0x3edb09(0x31f)]('✔');console[_0x3edb09(0x2cb)](_0x3edb09(0x316)+_0x7c7352+'\x20'+_0xec9c82[_0x3edb09(0x311)]),_0xec9c82[_0x3edb09(0x218)]&&console['error'](_0x3edb09(0x23f)+a29_0x483110[_0x3edb09(0x205)](_0xec9c82['sourceTableError']));}}if(_0x586de0[_0x3edb09(0x214)]&&_0x586de0['attributes']['length']>0x0){console['error']('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)](_0x3edb09(0x274))+'\x20'+_0x586de0[_0x3edb09(0x214)][_0x3edb09(0x32f)]+_0x3edb09(0x2c2));for(const _0x3b5792 of _0x586de0[_0x3edb09(0x214)]){const _0x2d5d48=_0x3b5792[_0x3edb09(0x202)]?a29_0x483110[_0x3edb09(0x31f)]('✔'):a29_0x483110[_0x3edb09(0x205)]('✘');console[_0x3edb09(0x2cb)]('\x20\x20\x20\x20'+_0x2d5d48+'\x20'+_0x3b5792[_0x3edb09(0x311)]+'\x20'+a29_0x483110[_0x3edb09(0x28a)]('('+_0x3b5792[_0x3edb09(0x1ef)]+')'));}}if(_0x586de0[_0x3edb09(0x24c)]){const _0x49d854=_0x586de0[_0x3edb09(0x24c)][_0x3edb09(0x31c)]?.[_0x3edb09(0x32f)]?'\x20+\x20['+_0x586de0[_0x3edb09(0x24c)][_0x3edb09(0x31c)][_0x3edb09(0x2fd)](',\x20')+']':'';console['error']('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)]('ID\x20Stitching:')+'\x20'+_0x586de0['idStitching']['primaryKey']+_0x49d854);}if(_0x586de0[_0x3edb09(0x1f5)]&&_0x586de0['personalizationServices'][_0x3edb09(0x32f)]>0x0){console[_0x3edb09(0x2cb)]('\x20\x20'+a29_0x483110[_0x3edb09(0x28a)]('Personalization:')+'\x20'+_0x586de0[_0x3edb09(0x1f5)][_0x3edb09(0x32f)]+_0x3edb09(0x272)+(_0x586de0[_0x3edb09(0x1f5)][_0x3edb09(0x32f)]!==0x1?'s':''));for(const _0x4bbb98 of _0x586de0[_0x3edb09(0x1f5)]){console[_0x3edb09(0x2cb)](_0x3edb09(0x32c)+_0x4bbb98[_0x3edb09(0x311)]);}}}function showParentSegmentNotSetError(_0x14a5d8){const _0x3dc52d=a29_0x4cec4b;console[_0x3dc52d(0x2cb)](a29_0x483110[_0x3dc52d(0x1db)](_0x3dc52d(0x2d9))),console[_0x3dc52d(0x2cb)](_0x14a5d8);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2d3);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x20c);async[a29_0x4cec4b(0x1cb)](_0x3036c9){const _0x36ab7a=a29_0x4cec4b,{options:_0xdbe509,args:_0x290c72,tdx:_0x2eb7b7}=_0x3036c9,_0x2e6b8d=_0x290c72[0x0];_0xdbe509['verbose']&&(console[_0x36ab7a(0x2cb)](_0x36ab7a(0x31e)+_0xdbe509[_0x36ab7a(0x317)]),_0x2e6b8d&&console[_0x36ab7a(0x2cb)]('Pattern:\x20'+_0x2e6b8d));const _0x2ac92b=await withSpinner(_0x2e6b8d?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x2e6b8d+_0x36ab7a(0x291):_0x36ab7a(0x221),()=>_0x2eb7b7[_0x36ab7a(0x23d)]['listParents'](),{'verbose':_0xdbe509['verbose']});let _0x139311=_0x2ac92b[_0x36ab7a(0x264)];if(_0x2e6b8d){const _0x927b2f=_0x2e6b8d['replace'](/[.+^${}()|[\]\\]/g,_0x36ab7a(0x2db))[_0x36ab7a(0x2e2)](/\*/g,'.*')[_0x36ab7a(0x2e2)](/\?/g,'.'),_0x14af5b=new RegExp('^'+_0x927b2f+'$','i');_0x139311=_0x139311[_0x36ab7a(0x2e4)](_0x58dd73=>_0x14af5b[_0x36ab7a(0x25a)](_0x58dd73[_0x36ab7a(0x214)][_0x36ab7a(0x311)]));}_0x139311['sort']((_0x5687cc,_0x96225c)=>_0x5687cc[_0x36ab7a(0x214)]['name'][_0x36ab7a(0x2b2)](_0x96225c['attributes'][_0x36ab7a(0x311)])),console['error'](_0x36ab7a(0x1d8)+_0x139311[_0x36ab7a(0x32f)]+_0x36ab7a(0x331)+(_0x139311[_0x36ab7a(0x32f)]!==0x1?'s':''));const _0x15c54b=_0x1f76bf=>{const _0x429099=_0x36ab7a;return getConsoleNextUrl(_0xdbe509['site'],_0x429099(0x319)+_0x1f76bf);};if(_0xdbe509[_0x36ab7a(0x2a7)]==='json'||_0xdbe509['format']===_0x36ab7a(0x26f)){const _0xaeb087=_0x139311[_0x36ab7a(0x26a)](_0x134bab=>({..._0x134bab,'url':_0x15c54b(_0x134bab['id'])}));await handleSDKOutput(_0xaeb087,_0xdbe509);}else{if(_0x139311[_0x36ab7a(0x32f)]===0x0)_0x2e6b8d?console[_0x36ab7a(0x1f3)](_0x36ab7a(0x1e6)+_0x2e6b8d):console[_0x36ab7a(0x1f3)](_0x36ab7a(0x22c));else for(const _0x21bb02 of _0x139311){const _0x580699=_0x21bb02[_0x36ab7a(0x214)][_0x36ab7a(0x1c6)]?a29_0x483110[_0x36ab7a(0x28a)]('\x20('+formatRows(_0x21bb02[_0x36ab7a(0x214)]['population'])+')'):'',_0x399cef=hyperlink(_0x21bb02[_0x36ab7a(0x214)][_0x36ab7a(0x311)],_0x15c54b(_0x21bb02['id']));console[_0x36ab7a(0x1f3)]('👥\x20'+_0x399cef+_0x580699);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x288);[a29_0x4cec4b(0x2a3)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a29_0x4cec4b(0x1cb)](_0x1bc8bc){const _0x13ccf8=a29_0x4cec4b,{options:_0x5167dc,args:_0xca9c4a,tdx:_0x2bc5fb}=_0x1bc8bc;console[_0x13ccf8(0x2cb)](_0x13ccf8(0x312)+_0x13ccf8(0x209)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5e0c8a=_0x5167dc;if(_0xca9c4a[_0x13ccf8(0x32f)]===0x0)return console['error'](a29_0x483110[_0x13ccf8(0x205)](_0x13ccf8(0x1fc))),console[_0x13ccf8(0x2cb)](_0x13ccf8(0x26e)),0x1;const _0x4ef240=_0xca9c4a[0x0];if(!_0x5e0c8a[_0x13ccf8(0x200)]||!_0x5e0c8a[_0x13ccf8(0x307)])return console[_0x13ccf8(0x2cb)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error']('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x5e0c8a[_0x13ccf8(0x24d)]&&(console[_0x13ccf8(0x2cb)]('Site:\x20'+_0x5e0c8a[_0x13ccf8(0x317)]),console[_0x13ccf8(0x2cb)](_0x13ccf8(0x2ff)+_0x4ef240),console['error'](_0x13ccf8(0x2d1)+_0x5e0c8a[_0x13ccf8(0x200)]),console[_0x13ccf8(0x2cb)](_0x13ccf8(0x1dd)+_0x5e0c8a[_0x13ccf8(0x307)]));const _0xa3306b=await loadJSONFromOptions(_0x5e0c8a[_0x13ccf8(0x214)],_0x5e0c8a['attributesFile']),_0x472cfc=await loadJSONFromOptions(_0x5e0c8a[_0x13ccf8(0x304)],_0x5e0c8a[_0x13ccf8(0x1c7)]),_0x1ccc02=await loadJSONFromOptions(_0x5e0c8a[_0x13ccf8(0x231)],_0x5e0c8a['customerGroupFile']),_0x19eee8={'name':_0x4ef240,'description':_0x5e0c8a[_0x13ccf8(0x2a3)],'scheduleType':_0x5e0c8a[_0x13ccf8(0x2a0)],'scheduleOption':_0x5e0c8a[_0x13ccf8(0x25c)],'timezone':_0x5e0c8a['timezone'],'master':{'parentDatabaseName':_0x5e0c8a[_0x13ccf8(0x200)],'parentTableName':_0x5e0c8a[_0x13ccf8(0x307)]},'attributes':_0xa3306b,'behaviors':_0x472cfc,'customerGroup':_0x1ccc02},_0x4e258c=await withSpinner(_0x13ccf8(0x33d)+_0x4ef240+_0x13ccf8(0x291),()=>_0x2bc5fb['segment'][_0x13ccf8(0x333)](_0x19eee8),{'verbose':_0x5167dc[_0x13ccf8(0x24d)]}),_0x23b852=_0x4e258c[_0x13ccf8(0x264)];return console[_0x13ccf8(0x2cb)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x23b852['name']+_0x13ccf8(0x30f)+_0x23b852['id']),await handleSDKOutput([_0x23b852],_0x5167dc),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x4cec4b(0x311)]='segment:parent:update';[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x2f8);async[a29_0x4cec4b(0x1cb)](_0x3f6d80){const _0x338b33=a29_0x4cec4b,{options:_0x345542,args:_0x13a510,tdx:_0x486e7d}=_0x3f6d80;console[_0x338b33(0x2cb)](_0x338b33(0x2e8)+_0x338b33(0x209)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0xca2f30=_0x345542;if(_0x13a510[_0x338b33(0x32f)]===0x0)return console[_0x338b33(0x2cb)](a29_0x483110[_0x338b33(0x205)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x338b33(0x2cb)]('Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]'),0x1;const _0x2ef51b=_0x13a510[0x0];_0xca2f30['verbose']&&(console[_0x338b33(0x2cb)](_0x338b33(0x31e)+_0xca2f30['site']),console[_0x338b33(0x2cb)](_0x338b33(0x1df)+_0x2ef51b));const _0x15b9ca=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x2ef51b+_0x338b33(0x291),()=>_0x486e7d[_0x338b33(0x23d)][_0x338b33(0x321)](_0x2ef51b),{'verbose':_0xca2f30[_0x338b33(0x24d)]}),_0x14dd5f=_0x15b9ca[_0x338b33(0x264)],_0x5e4202=await loadJSONFromOptions(_0xca2f30['addAttributes'],_0xca2f30[_0x338b33(0x253)]),_0x481ee3=await loadJSONFromOptions(_0xca2f30[_0x338b33(0x248)],_0xca2f30[_0x338b33(0x27f)]),_0x286676={'name':_0x14dd5f[_0x338b33(0x311)],'description':_0xca2f30[_0x338b33(0x2a3)]!==undefined?_0xca2f30[_0x338b33(0x2a3)]:_0x14dd5f[_0x338b33(0x2a3)],'scheduleType':_0xca2f30[_0x338b33(0x2a0)]!==undefined?_0xca2f30[_0x338b33(0x2a0)]:_0x14dd5f[_0x338b33(0x2a0)],'scheduleOption':_0xca2f30[_0x338b33(0x25c)]!==undefined?_0xca2f30[_0x338b33(0x25c)]:_0x14dd5f[_0x338b33(0x25c)],'timezone':_0xca2f30[_0x338b33(0x2aa)]!==undefined?_0xca2f30[_0x338b33(0x2aa)]:_0x14dd5f[_0x338b33(0x2aa)],'master':_0x14dd5f[_0x338b33(0x2b1)],'attributes':_0x5e4202?[..._0x14dd5f[_0x338b33(0x214)]||[],..._0x5e4202]:_0x14dd5f[_0x338b33(0x214)],'behaviors':_0x481ee3?[..._0x14dd5f[_0x338b33(0x304)]||[],..._0x481ee3]:_0x14dd5f[_0x338b33(0x304)],'customerGroup':_0x14dd5f[_0x338b33(0x231)]},_0x1b0adf=await withSpinner(_0x338b33(0x2d4)+_0x2ef51b+_0x338b33(0x291),()=>_0x486e7d[_0x338b33(0x23d)]['updateParent'](_0x2ef51b,_0x286676),{'verbose':_0xca2f30[_0x338b33(0x24d)]}),_0x1b3d3f=_0x1b0adf['data'];return console['error'](_0x338b33(0x2a2)+_0x1b3d3f[_0x338b33(0x311)]+'\x27'),await handleSDKOutput([_0x1b3d3f],_0xca2f30),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x24f);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x289);async['execute'](_0x4b60a9){const _0x194bf5=a29_0x4cec4b,{options:_0x297132,args:_0x408cb3,tdx:_0x3b5b3e}=_0x4b60a9,_0x1b6e57=_0x297132,_0x31f128=_0x408cb3[0x0]||_0x297132['parentSegment'];if(!_0x31f128)return showParentSegmentNotSetError(_0x194bf5(0x2c7)+_0x194bf5(0x1d0)),0x1;if(_0x1b6e57[_0x194bf5(0x1d3)]&&_0x1b6e57['output'])return console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x205)](_0x194bf5(0x281))),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x28a)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console['error'](a29_0x483110[_0x194bf5(0x28a)](_0x194bf5(0x252)+PARENT_SEGMENT_DIR+_0x194bf5(0x2c5))),console[_0x194bf5(0x2cb)](a29_0x483110['cyan'](_0x194bf5(0x306))),0x1;const _0x242c45=_0x1b6e57[_0x194bf5(0x1fe)]||a29_0x4e119f['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31f128)+_0x194bf5(0x309));_0x1b6e57[_0x194bf5(0x24d)]&&(console[_0x194bf5(0x2cb)](_0x194bf5(0x31e)+_0x1b6e57[_0x194bf5(0x317)]),console[_0x194bf5(0x2cb)](_0x194bf5(0x1df)+_0x31f128),console[_0x194bf5(0x2cb)]('Output\x20file:\x20'+_0x242c45));const _0x45533c=await withSpinner(_0x194bf5(0x2c8)+_0x31f128+_0x194bf5(0x291),()=>_0x3b5b3e[_0x194bf5(0x23d)][_0x194bf5(0x2c4)](_0x31f128),{'verbose':_0x1b6e57[_0x194bf5(0x24d)]}),_0x1466cd=_0x45533c[_0x194bf5(0x264)];if(existsSync(_0x242c45)){const _0x4a8ec6=readFileSync(_0x242c45,'utf-8'),_0x3cc97d=generateDiff(_0x4a8ec6,_0x1466cd);if(!hasChanges(_0x3cc97d))console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x2c0)+a29_0x483110[_0x194bf5(0x1e3)](_0x242c45)+_0x194bf5(0x2ab));else{console['error'](_0x194bf5(0x1fb)+_0x242c45+'\x27:'),console[_0x194bf5(0x2cb)]('─'[_0x194bf5(0x270)](0x3c)),console[_0x194bf5(0x2cb)](formatDiffWithColors(_0x3cc97d)),console[_0x194bf5(0x2cb)]('─'['repeat'](0x3c));if(!_0x1b6e57[_0x194bf5(0x30a)]){if(!isInteractive())return console['error'](a29_0x483110['red'](_0x194bf5(0x2f4)),_0x194bf5(0x1ee)),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x28a)](_0x194bf5(0x2b9))),0x1;const _0x264c57=await confirmKey(_0x194bf5(0x223)+_0x242c45+'\x27?');if(!_0x264c57)return console['error'](a29_0x483110[_0x194bf5(0x1db)](_0x194bf5(0x256))),0x1;}writeFileSync(_0x242c45,_0x1466cd,_0x194bf5(0x1d4)),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x203)+a29_0x483110[_0x194bf5(0x1e3)](_0x242c45));}}else{const _0x3146e7=a29_0x4e119f['dirname'](_0x242c45);!existsSync(_0x3146e7)&&mkdirSync(_0x3146e7,{'recursive':!![]}),writeFileSync(_0x242c45,_0x1466cd,_0x194bf5(0x1d4)),console[_0x194bf5(0x2cb)](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x203)+a29_0x483110[_0x194bf5(0x1e3)](_0x242c45));}return saveSessionContext({'parent_segment':_0x31f128},_0x1b6e57[_0x194bf5(0x21d)]),console['error'](a29_0x483110[_0x194bf5(0x31f)]('✔')+_0x194bf5(0x263)+a29_0x483110[_0x194bf5(0x28a)](_0x194bf5(0x29f))+_0x194bf5(0x1ec)+a29_0x483110[_0x194bf5(0x1e3)](_0x31f128)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a29_0x4cec4b(0x2fe);[a29_0x4cec4b(0x2a3)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x3af0f1){const _0xa51385=a29_0x4cec4b,{options:_0x4c4993,args:_0x413820,tdx:_0x46aa7c}=_0x3af0f1,_0x50c7e0=_0x4c4993,_0x39b596=_0x413820[0x0]||_0x4c4993['parentSegment'];if(!_0x39b596)return showParentSegmentNotSetError(_0xa51385(0x27a)+_0xa51385(0x2ac)),0x1;const _0x1a7739=resolveYamlFile(_0x39b596);if(!existsSync(_0x1a7739))return showFileNotFoundError(_0x1a7739,_0x39b596),0x1;_0x50c7e0[_0xa51385(0x24d)]&&(console[_0xa51385(0x2cb)]('Site:\x20'+_0x50c7e0[_0xa51385(0x317)]),console['error'](_0xa51385(0x220)+_0x1a7739));let _0xc1ce7;try{_0xc1ce7=readFileSync(_0x1a7739,_0xa51385(0x1d4));}catch(_0x32dc26){const _0x217dae=_0x32dc26 instanceof Error?_0x32dc26[_0xa51385(0x2a5)]:String(_0x32dc26);return console['error'](_0xa51385(0x2fb)+_0x217dae),0x1;}const _0x175d0f=await withSpinner('Analyzing\x20changes...',()=>_0x46aa7c[_0xa51385(0x23d)][_0xa51385(0x243)](_0xc1ce7),{'verbose':_0x50c7e0[_0xa51385(0x24d)]}),_0x2317a2=_0x175d0f[_0xa51385(0x264)],{isNew:_0x3ef747,name:_0x5b0403,hasChanges:_0x28082a,diffFormatted:_0xdcec6a}=_0x2317a2;if(!_0x28082a)return console[_0xa51385(0x2cb)](_0xa51385(0x266)+_0x5b0403+_0xa51385(0x269)),0x0;_0x3ef747?console[_0xa51385(0x2cb)](_0xa51385(0x238)+_0x5b0403+'\x27:'):console[_0xa51385(0x2cb)](_0xa51385(0x282)+_0x5b0403+'\x27:');console[_0xa51385(0x2cb)]('─'[_0xa51385(0x270)](0x3c)),console['error'](_0xdcec6a),console[_0xa51385(0x2cb)]('─'[_0xa51385(0x270)](0x3c));const _0x5302c2=_0x3ef747?_0xa51385(0x2c3)+_0x5b0403+'\x27?':_0xa51385(0x23b)+_0x5b0403+'\x27?';if(!_0x50c7e0[_0xa51385(0x30a)]){if(!isInteractive())return console[_0xa51385(0x2cb)](a29_0x483110[_0xa51385(0x205)](_0xa51385(0x2f4)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console['error'](a29_0x483110['dim'](_0xa51385(0x2b9))),0x1;const _0x1216bf=await confirmKey(_0x5302c2);if(!_0x1216bf)return console[_0xa51385(0x2cb)](a29_0x483110[_0xa51385(0x1db)](_0xa51385(0x256))),0x1;}const _0x15a5c2=_0x3ef747?_0xa51385(0x27c):_0xa51385(0x1e4),_0x1b42d7=await withSpinner(_0x15a5c2+_0xa51385(0x318)+_0x5b0403+_0xa51385(0x291),()=>_0x2317a2[_0xa51385(0x299)](),{'verbose':_0x50c7e0[_0xa51385(0x24d)]}),_0x1ad261=_0x1b42d7[_0xa51385(0x264)],_0x4d781e=getConsoleNextUrl(_0x50c7e0['site'],_0xa51385(0x319)+_0x1ad261['id']),_0x54b9cf=_0x3ef747?_0xa51385(0x33a):'Updated';return console[_0xa51385(0x2cb)]('✔\x20'+_0x54b9cf+_0xa51385(0x318)+_0x1ad261[_0xa51385(0x311)]+'\x27'),console[_0xa51385(0x2cb)]('\x20\x20'+_0x4d781e),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x1eb);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x31a);async['execute'](_0x1599bf){const _0x20cade=a29_0x4cec4b,{options:_0x42aff2,args:_0x51346a,tdx:_0x112cb3}=_0x1599bf,_0x464943=_0x42aff2,_0x3fdaf=_0x51346a[0x0]||_0x42aff2['parentSegment'];if(!_0x3fdaf)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x20cade(0x2ad)+_0x20cade(0x332)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x20cade(0x29b)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0xca26b0=resolveYamlFile(_0x3fdaf);if(!existsSync(_0xca26b0))return showFileNotFoundError(_0xca26b0,_0x3fdaf),0x1;_0x464943[_0x20cade(0x24d)]&&(console[_0x20cade(0x2cb)](_0x20cade(0x31e)+_0x464943[_0x20cade(0x317)]),console[_0x20cade(0x2cb)](_0x20cade(0x220)+_0xca26b0));let _0x271ae3;try{_0x271ae3=readFileSync(_0xca26b0,_0x20cade(0x1d4));}catch(_0x377be0){const _0x44c602=_0x377be0 instanceof Error?_0x377be0[_0x20cade(0x2a5)]:String(_0x377be0);return console['error']('Error\x20reading\x20file:\x20'+_0x44c602),0x1;}const _0x302a43=createCommandSpinner(a29_0x483110['dim'](_0x20cade(0x2d6)),{'verbose':_0x464943[_0x20cade(0x24d)]});_0x302a43[_0x20cade(0x2ec)]();const _0x12d8f3={'onProgress':_0x4f38b4=>{const _0x2632ca=_0x20cade;_0x302a43[_0x2632ca(0x2a4)]=formatProgressMessage(_0x4f38b4);}};if(_0x464943[_0x20cade(0x2b1)])_0x12d8f3[_0x20cade(0x2b1)]=!![];if(_0x464943[_0x20cade(0x2dd)])_0x12d8f3[_0x20cade(0x2dd)]=!![];_0x464943[_0x20cade(0x2b5)]&&(_0x12d8f3['attribute']=_0x464943['attribute']);_0x464943[_0x20cade(0x1e8)]&&(_0x12d8f3[_0x20cade(0x1e8)]=_0x464943[_0x20cade(0x1e8)]);if(_0x464943[_0x20cade(0x2f9)])_0x12d8f3['interval']=_0x464943[_0x20cade(0x2f9)];let _0x4794d7;try{_0x4794d7=await _0x112cb3[_0x20cade(0x23d)][_0x20cade(0x33b)](_0x271ae3,_0x12d8f3),_0x302a43[_0x20cade(0x2ef)]();}catch(_0x160853){_0x302a43[_0x20cade(0x2ef)]();throw _0x160853;}const _0x5b6d94=_0x464943[_0x20cade(0x2f9)]||'-1d';return this[_0x20cade(0x1f1)](_0x4794d7,_0x12d8f3,_0xca26b0,_0x5b6d94),_0x4794d7['allValid']?0x0:0x1;}[a29_0x4cec4b(0x1f1)](_0x1d3c92,_0x56eb93,_0x25ad75,_0x30b608){const _0x3ab4c2=a29_0x4cec4b;console[_0x3ab4c2(0x2cb)]('\x0a'+a29_0x483110[_0x3ab4c2(0x30b)](_0x3ab4c2(0x2de))+'\x20'+_0x1d3c92[_0x3ab4c2(0x311)]),console['error']('═'['repeat'](0x3c)),this[_0x3ab4c2(0x234)](_0x1d3c92);if(typeof _0x56eb93[_0x3ab4c2(0x2b5)]===_0x3ab4c2(0x2a8)){this[_0x3ab4c2(0x201)](_0x1d3c92),this[_0x3ab4c2(0x29c)](_0x1d3c92),this[_0x3ab4c2(0x28f)](_0x25ad75,_0x30b608,_0x3ab4c2(0x2b5),_0x56eb93['attribute']);return;}if(_0x56eb93[_0x3ab4c2(0x2b5)]===!![]){this[_0x3ab4c2(0x201)](_0x1d3c92),this[_0x3ab4c2(0x29c)](_0x1d3c92),this[_0x3ab4c2(0x28f)](_0x25ad75,_0x30b608,_0x3ab4c2(0x214));return;}if(typeof _0x56eb93[_0x3ab4c2(0x1e8)]===_0x3ab4c2(0x2a8)){this[_0x3ab4c2(0x206)](_0x1d3c92,_0x30b608),this['displaySummary'](_0x1d3c92),this['displayPreviewHints'](_0x25ad75,_0x30b608,_0x3ab4c2(0x1e8),_0x56eb93[_0x3ab4c2(0x1e8)]);return;}if(_0x56eb93['behavior']===!![]){this[_0x3ab4c2(0x206)](_0x1d3c92,_0x30b608),this[_0x3ab4c2(0x29c)](_0x1d3c92),this['displayPreviewHints'](_0x25ad75,_0x30b608,_0x3ab4c2(0x304));return;}this[_0x3ab4c2(0x201)](_0x1d3c92),this[_0x3ab4c2(0x206)](_0x1d3c92,_0x30b608),this[_0x3ab4c2(0x254)](_0x1d3c92),this[_0x3ab4c2(0x29c)](_0x1d3c92),this['displayPreviewHints'](_0x25ad75,_0x30b608,_0x3ab4c2(0x229));}[a29_0x4cec4b(0x254)](_0x4d361d){displayRealtimeValidation(_0x4d361d);}[a29_0x4cec4b(0x28f)](_0x2436ed,_0x1bf02f,_0x169c32,_0xea8211){const _0x4d8f33=a29_0x4cec4b;console[_0x4d8f33(0x2cb)]('\x0a'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x225)));const _0x71a7e3=_0x1bf02f!=='-1d'?_0x4d8f33(0x2b7)+_0x1bf02f:'';if(_0x169c32===_0x4d8f33(0x2b5)&&_0xea8211)console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x21b)+_0x2436ed+'\x20--attribute\x20\x22'+_0xea8211+'\x22'+_0x71a7e3));else{if(_0x169c32==='behavior'&&_0xea8211)console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)]('tdx\x20ps\x20preview\x20'+_0x2436ed+_0x4d8f33(0x2f0)+_0xea8211+'\x22'+_0x71a7e3));else(_0x169c32==='attributes'||_0x169c32==='all')&&console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x21b)+_0x2436ed+'\x20--attribute\x20\x22<name>\x22'+_0x71a7e3));}(_0x169c32===_0x4d8f33(0x304)||_0x169c32===_0x4d8f33(0x229))&&console[_0x4d8f33(0x2cb)]('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)]('tdx\x20ps\x20preview\x20'+_0x2436ed+'\x20--behavior\x20\x22<name>\x22'+_0x71a7e3)),_0x169c32===_0x4d8f33(0x229)&&console['error']('\x20\x20'+a29_0x483110[_0x4d8f33(0x28a)](_0x4d8f33(0x21b)+_0x2436ed+'\x20--enriched'+_0x71a7e3));}['displayMasterInfo'](_0x3b885b){const _0x2c0c58=a29_0x4cec4b,{master:_0x3bfd5d}=_0x3b885b,_0x19f567=_0x3bfd5d[_0x2c0c58(0x259)]?a29_0x483110['green']('✔'):a29_0x483110[_0x2c0c58(0x205)]('✘');console[_0x2c0c58(0x2cb)]('\x0a'+a29_0x483110[_0x2c0c58(0x28a)]('Master\x20Table')),console['error'](_0x19f567+'\x20'+a29_0x483110['bold'](_0x3bfd5d[_0x2c0c58(0x200)]+'.'+_0x3bfd5d[_0x2c0c58(0x307)])),_0x3bfd5d[_0x2c0c58(0x259)]?_0x3bfd5d[_0x2c0c58(0x334)]!==undefined&&console[_0x2c0c58(0x2cb)]('\x20\x20'+a29_0x483110[_0x2c0c58(0x28a)](_0x2c0c58(0x2dc))+'\x20'+a29_0x483110['cyan'](formatRows(_0x3bfd5d[_0x2c0c58(0x334)]))):console['error']('\x20\x20'+a29_0x483110[_0x2c0c58(0x205)](_0x2c0c58(0x1d5))+'\x20'+_0x3bfd5d[_0x2c0c58(0x2c9)]);}[a29_0x4cec4b(0x201)](_0x42ab5f){const _0x4e588a=a29_0x4cec4b;if(_0x42ab5f['attributes'][_0x4e588a(0x32f)]===0x0)return;console[_0x4e588a(0x2cb)]('\x0a'+a29_0x483110['dim'](_0x4e588a(0x279)));for(const _0x46673d of _0x42ab5f[_0x4e588a(0x214)]){const _0x59bf6b=_0x46673d[_0x4e588a(0x259)]?a29_0x483110[_0x4e588a(0x31f)]('✔'):a29_0x483110[_0x4e588a(0x205)]('✘');let _0x4afcbb='';if(_0x46673d[_0x4e588a(0x259)]&&_0x46673d[_0x4e588a(0x235)]!==undefined&&_0x46673d[_0x4e588a(0x277)]!==undefined){const _0x345c12=_0x46673d['coveragePercent'][_0x4e588a(0x290)](0x1),_0x42ee89=_0x46673d[_0x4e588a(0x277)]>=0x50?a29_0x483110[_0x4e588a(0x31f)]:_0x46673d[_0x4e588a(0x277)]>=0x32?a29_0x483110['yellow']:a29_0x483110[_0x4e588a(0x205)];_0x4afcbb='\x20'+a29_0x483110[_0x4e588a(0x28a)]('Coverage:')+'\x20'+_0x42ee89(_0x345c12+'%')+'\x20('+formatRows(_0x46673d[_0x4e588a(0x235)])+_0x4e588a(0x280);}console[_0x4e588a(0x2cb)](_0x59bf6b+'\x20'+a29_0x483110[_0x4e588a(0x30b)](_0x46673d['name'])+_0x4afcbb),console['error']('\x20\x20'+a29_0x483110[_0x4e588a(0x28a)](_0x4e588a(0x284))+'\x20'+a29_0x483110['bold'](_0x46673d['database']+'.'+_0x46673d[_0x4e588a(0x307)]));const _0x4823dc=_0x46673d[_0x4e588a(0x261)]===_0x46673d[_0x4e588a(0x1d6)]?a29_0x483110[_0x4e588a(0x28a)]('Join\x20on:')+'\x20'+_0x46673d[_0x4e588a(0x261)]:a29_0x483110[_0x4e588a(0x28a)]('Join:')+'\x20'+_0x46673d[_0x4e588a(0x261)]+_0x4e588a(0x1ec)+_0x46673d['foreignKey'];console['error']('\x20\x20'+_0x4823dc),console[_0x4e588a(0x2cb)]('\x20\x20'+a29_0x483110[_0x4e588a(0x28a)](_0x4e588a(0x297))),this[_0x4e588a(0x2c1)](_0x46673d[_0x4e588a(0x25b)]),!_0x46673d[_0x4e588a(0x259)]&&console['error']('\x20\x20'+a29_0x483110[_0x4e588a(0x205)]('Error:')+'\x20'+_0x46673d[_0x4e588a(0x2c9)]);}}[a29_0x4cec4b(0x206)](_0x335570,_0x557d73){const _0x26e2b7=a29_0x4cec4b;if(_0x335570['behaviors']['length']===0x0)return;console[_0x26e2b7(0x2cb)]('\x0a'+a29_0x483110[_0x26e2b7(0x28a)]('Behaviors')+'\x20'+a29_0x483110['dim']('('+_0x557d73+')'));for(const _0x2b4136 of _0x335570['behaviors']){const _0xa3f000=_0x2b4136['schemaValid']?a29_0x483110[_0x26e2b7(0x31f)]('✔'):a29_0x483110['red']('✘');let _0x414d4f='';if(_0x2b4136['schemaValid']&&_0x2b4136[_0x26e2b7(0x28e)]!==undefined&&_0x2b4136[_0x26e2b7(0x265)]!==undefined){const _0x28e5e5=_0x2b4136[_0x26e2b7(0x244)]?.['toFixed'](0x1)||'?',_0x27919d=(_0x2b4136[_0x26e2b7(0x244)]??0x0)>=0x32?a29_0x483110['green']:(_0x2b4136['customerPercent']??0x0)>=0x14?a29_0x483110[_0x26e2b7(0x1db)]:a29_0x483110[_0x26e2b7(0x205)];_0x414d4f='\x20'+a29_0x483110['dim'](_0x26e2b7(0x204))+'\x20'+_0x27919d(formatRows(_0x2b4136[_0x26e2b7(0x28e)]))+'\x20('+_0x28e5e5+_0x26e2b7(0x226)+a29_0x483110[_0x26e2b7(0x28a)](_0x26e2b7(0x2e5))+'\x20'+a29_0x483110[_0x26e2b7(0x1e3)](formatRows(_0x2b4136[_0x26e2b7(0x265)]));}console[_0x26e2b7(0x2cb)](_0xa3f000+'\x20'+a29_0x483110[_0x26e2b7(0x30b)](_0x2b4136[_0x26e2b7(0x311)])+_0x414d4f),console[_0x26e2b7(0x2cb)]('\x20\x20'+a29_0x483110[_0x26e2b7(0x28a)](_0x26e2b7(0x284))+'\x20'+a29_0x483110[_0x26e2b7(0x30b)](_0x2b4136[_0x26e2b7(0x200)]+'.'+_0x2b4136[_0x26e2b7(0x307)]));const _0x5512f9=_0x2b4136[_0x26e2b7(0x261)]===_0x2b4136[_0x26e2b7(0x1d6)]?a29_0x483110['dim']('Join\x20on:')+'\x20'+_0x2b4136['joinKey']:a29_0x483110[_0x26e2b7(0x28a)]('Join:')+'\x20'+_0x2b4136[_0x26e2b7(0x261)]+'\x20=\x20'+_0x2b4136[_0x26e2b7(0x1d6)];console[_0x26e2b7(0x2cb)]('\x20\x20'+_0x5512f9),console[_0x26e2b7(0x2cb)]('\x20\x20'+a29_0x483110['dim'](_0x26e2b7(0x297))),this['displayColumns'](_0x2b4136[_0x26e2b7(0x25b)]),!_0x2b4136[_0x26e2b7(0x259)]&&console['error']('\x20\x20'+a29_0x483110['red'](_0x26e2b7(0x1d5))+'\x20'+_0x2b4136[_0x26e2b7(0x2c9)]);}}[a29_0x4cec4b(0x2c1)](_0x42b825){const _0x44a0e0=a29_0x4cec4b;for(const _0x586ef9 of _0x42b825){_0x586ef9[_0x44a0e0(0x1e0)]===_0x586ef9['column']||_0x586ef9[_0x44a0e0(0x23c)]==='*'?console[_0x44a0e0(0x2cb)](_0x44a0e0(0x32c)+_0x586ef9[_0x44a0e0(0x1e0)]):console[_0x44a0e0(0x2cb)]('\x20\x20\x20\x20-\x20'+_0x586ef9[_0x44a0e0(0x1e0)]+'\x20'+a29_0x483110['dim']('('+_0x586ef9[_0x44a0e0(0x23c)]+')'));}}[a29_0x4cec4b(0x29c)](_0x97dc0a){const _0x2faeac=a29_0x4cec4b;console['error']('─'[_0x2faeac(0x270)](0x3c));if(_0x97dc0a[_0x2faeac(0x30c)][_0x2faeac(0x32f)]>0x0){console[_0x2faeac(0x2cb)]('\x0a'+a29_0x483110[_0x2faeac(0x205)](_0x2faeac(0x1d7)));for(const _0x1196fe of _0x97dc0a[_0x2faeac(0x30c)]){console[_0x2faeac(0x2cb)]('\x20\x20'+a29_0x483110[_0x2faeac(0x205)]('•')+'\x20'+_0x1196fe);}}_0x97dc0a['allValid']&&console[_0x2faeac(0x2cb)]('\x0a'+a29_0x483110[_0x2faeac(0x31f)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x21c);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x26b);async[a29_0x4cec4b(0x1cb)](_0x3f75cf){const _0x7e0b9=a29_0x4cec4b,{options:_0x32c6fd,args:_0x158df6,tdx:_0x3f653c}=_0x3f75cf,_0x2ae739=_0x32c6fd,_0x1c85a4=_0x158df6[0x0]||_0x32c6fd['parentSegment'];if(!_0x1c85a4)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+_0x7e0b9(0x1fa)+_0x7e0b9(0x29d)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x7e0b9(0x1c8)+_0x7e0b9(0x23a)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x2ae739['master']&&!_0x2ae739[_0x7e0b9(0x2b5)]&&!_0x2ae739[_0x7e0b9(0x1e8)]&&!_0x2ae739['enriched'])return console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x7e0b9(0x2cb)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x2d8)),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x278)),console['error']('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x7e0b9(0x2cb)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0xbad0f7=resolveYamlFile(_0x1c85a4);if(!existsSync(_0xbad0f7))return showFileNotFoundError(_0xbad0f7,_0x1c85a4),0x1;_0x2ae739['verbose']&&(console[_0x7e0b9(0x2cb)](_0x7e0b9(0x31e)+_0x2ae739[_0x7e0b9(0x317)]),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x220)+_0xbad0f7));let _0x24f617;try{_0x24f617=readFileSync(_0xbad0f7,_0x7e0b9(0x1d4));}catch(_0x2de6e0){const _0x53041d=_0x2de6e0 instanceof Error?_0x2de6e0[_0x7e0b9(0x2a5)]:String(_0x2de6e0);return console['error'](_0x7e0b9(0x2fb)+_0x53041d),0x1;}let _0x2ee91b;try{_0x2ee91b=parseDef(_0x24f617);}catch(_0x2c5a34){const _0x494c0c=_0x2c5a34 instanceof Error?_0x2c5a34[_0x7e0b9(0x2a5)]:String(_0x2c5a34);return console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x247)+_0x494c0c)),0x1;}if(_0x2ae739['attribute']===!![]||_0x2ae739[_0x7e0b9(0x2b5)]===''){const _0x43e25c=_0x2ee91b[_0x7e0b9(0x214)]?.[_0x7e0b9(0x26a)](_0x8d1aab=>_0x8d1aab['name'])||[];if(_0x43e25c[_0x7e0b9(0x32f)]===0x0)console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x28d)));else{console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x237))),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x2a1));for(const _0xe5de45 of _0x43e25c){console[_0x7e0b9(0x2cb)]('\x20\x20'+a29_0x483110[_0x7e0b9(0x1e3)](_0xe5de45));}console[_0x7e0b9(0x2cb)](_0x7e0b9(0x236)+_0x1c85a4+_0x7e0b9(0x2d5)+_0x43e25c[0x0]+'\x22');}return 0x1;}if(_0x2ae739[_0x7e0b9(0x1e8)]===!![]||_0x2ae739[_0x7e0b9(0x1e8)]===''){const _0xd6c9fd=_0x2ee91b['behaviors']?.['map'](_0x5e27aa=>_0x5e27aa[_0x7e0b9(0x311)])||[];if(_0xd6c9fd[_0x7e0b9(0x32f)]===0x0)console[_0x7e0b9(0x2cb)](a29_0x483110[_0x7e0b9(0x205)](_0x7e0b9(0x25d)));else{console[_0x7e0b9(0x2cb)](a29_0x483110['red']('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x7e0b9(0x2cb)](_0x7e0b9(0x276));for(const _0x2dddcb of _0xd6c9fd){console['error']('\x20\x20'+a29_0x483110[_0x7e0b9(0x1e3)](_0x2dddcb));}console[_0x7e0b9(0x2cb)](_0x7e0b9(0x236)+_0x1c85a4+_0x7e0b9(0x2f0)+_0xd6c9fd[0x0]+'\x22');}return 0x1;}const _0x22f8f5=createCommandSpinner(a29_0x483110[_0x7e0b9(0x28a)](_0x7e0b9(0x2af)),{'verbose':_0x2ae739['verbose']});_0x22f8f5['start']();const _0x5aed06={'onProgress':_0x3db448=>{const _0x39389c=_0x7e0b9;_0x22f8f5[_0x39389c(0x2a4)]=formatProgressMessage(_0x3db448);}};if(_0x2ae739['master'])_0x5aed06[_0x7e0b9(0x2b1)]=!![];if(_0x2ae739[_0x7e0b9(0x2b5)]&&typeof _0x2ae739[_0x7e0b9(0x2b5)]===_0x7e0b9(0x2a8))_0x5aed06[_0x7e0b9(0x2b5)]=_0x2ae739['attribute'];if(_0x2ae739['behavior']&&typeof _0x2ae739[_0x7e0b9(0x1e8)]===_0x7e0b9(0x2a8))_0x5aed06[_0x7e0b9(0x1e8)]=_0x2ae739[_0x7e0b9(0x1e8)];if(_0x2ae739[_0x7e0b9(0x2dd)])_0x5aed06[_0x7e0b9(0x2dd)]=!![];if(_0x2ae739[_0x7e0b9(0x2f9)])_0x5aed06[_0x7e0b9(0x2f9)]=_0x2ae739[_0x7e0b9(0x2f9)];let _0xd1e156;try{_0xd1e156=await _0x3f653c['segment'][_0x7e0b9(0x1cc)](_0x24f617,_0x5aed06),_0x22f8f5[_0x7e0b9(0x2ef)]();}catch(_0x410027){_0x22f8f5[_0x7e0b9(0x2ef)]();throw _0x410027;}return await this[_0x7e0b9(0x2ae)](_0xd1e156,{'master':_0x2ae739[_0x7e0b9(0x2b1)],'attribute':typeof _0x2ae739[_0x7e0b9(0x2b5)]===_0x7e0b9(0x2a8)?_0x2ae739[_0x7e0b9(0x2b5)]:undefined,'behavior':typeof _0x2ae739[_0x7e0b9(0x1e8)]===_0x7e0b9(0x2a8)?_0x2ae739[_0x7e0b9(0x1e8)]:undefined,'enriched':_0x2ae739[_0x7e0b9(0x2dd)]}),_0xd1e156[_0x7e0b9(0x1f7)]?0x0:0x1;}async['displayPreviewResults'](_0x3c376f,_0x1903f4){const _0x2fef8a=a29_0x4cec4b;console[_0x2fef8a(0x2cb)]('\x0a'+a29_0x483110[_0x2fef8a(0x30b)](_0x2fef8a(0x2bb))+'\x20'+_0x3c376f[_0x2fef8a(0x311)]),console[_0x2fef8a(0x2cb)]('═'['repeat'](0x3c));if(_0x1903f4[_0x2fef8a(0x2b1)]&&_0x3c376f['sampleData']){const _0x520da2=a29_0x483110[_0x2fef8a(0x28a)]('Master:')+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x3c376f[_0x2fef8a(0x2b1)][_0x2fef8a(0x200)]+'.'+_0x3c376f['master']['table']);await this[_0x2fef8a(0x2b8)](_0x520da2,_0x3c376f[_0x2fef8a(0x2bc)]);}else{if(_0x1903f4[_0x2fef8a(0x2b5)]&&_0x3c376f[_0x2fef8a(0x2bc)]){const _0x32770a=a29_0x483110['dim']('Attribute:')+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x1903f4[_0x2fef8a(0x2b5)]);await this[_0x2fef8a(0x2b8)](_0x32770a,_0x3c376f[_0x2fef8a(0x2bc)]);}else{if(_0x1903f4[_0x2fef8a(0x1e8)]&&_0x3c376f[_0x2fef8a(0x2bc)]){const _0x2521c4=a29_0x483110['dim'](_0x2fef8a(0x241))+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x1903f4['behavior']);await this[_0x2fef8a(0x2b8)](_0x2521c4,_0x3c376f['sampleData']);}else{if(_0x1903f4[_0x2fef8a(0x2dd)]&&_0x3c376f['sampleData']){const _0x457012=a29_0x483110[_0x2fef8a(0x28a)](_0x2fef8a(0x29a))+'\x20'+a29_0x483110[_0x2fef8a(0x30b)](_0x2fef8a(0x2be));await this[_0x2fef8a(0x2b8)](_0x457012,_0x3c376f['sampleData']);}else!_0x3c376f[_0x2fef8a(0x2bc)]&&console['error'](_0x2fef8a(0x27d));}}}if(_0x3c376f['errors'][_0x2fef8a(0x32f)]>0x0){console[_0x2fef8a(0x2cb)]('─'['repeat'](0x3c)),console['error']('\x0a'+a29_0x483110[_0x2fef8a(0x205)](_0x2fef8a(0x1d7)));for(const _0x5cc0e0 of _0x3c376f['errors']){console[_0x2fef8a(0x2cb)]('\x20\x20'+a29_0x483110['red']('•')+'\x20'+_0x5cc0e0);}}}async['displaySampleData'](_0x585bd3,_0x1e2dc6){const _0x54ac58=a29_0x4cec4b;if(_0x1e2dc6['length']===0x0){console[_0x54ac58(0x2cb)]('\x0a'+_0x585bd3),console[_0x54ac58(0x2cb)]('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x54ac58(0x2cb)]('\x0a'+_0x585bd3);const _0x1034d1=Object['keys'](_0x1e2dc6[0x0])[_0x54ac58(0x26a)](_0x5a3e6e=>({'name':_0x5a3e6e,'type':typeof _0x1e2dc6[0x0][_0x5a3e6e]===_0x54ac58(0x328)?'double':_0x54ac58(0x2d7)})),_0x2886ff={'queryId':'preview','columns':_0x1034d1,'data':_0x1e2dc6,'stats':{'state':_0x54ac58(0x2bf),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x1e2dc6['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x327074=formatAsTable(_0x2886ff,_0x1e2dc6[_0x54ac58(0x32f)],!![]);await writeOutput(_0x327074,undefined,_0x54ac58(0x307));}}function a29_0x5785(_0x5800f1,_0x44742b){_0x5800f1=_0x5800f1-0x1c6;const _0x264905=a29_0x2649();let _0x5785e1=_0x264905[_0x5800f1];return _0x5785e1;}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x1ce);['description']='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x4cec4b(0x1cb)](_0x12e040){const _0x1464fe=a29_0x4cec4b,{options:_0x112357,args:_0x932f0d,tdx:_0x24cd93}=_0x12e040,_0x2ee985=_0x112357,_0x3d6660=_0x932f0d[0x0]||_0x112357[_0x1464fe(0x245)];if(!_0x3d6660)return showParentSegmentNotSetError(_0x1464fe(0x224)+_0x1464fe(0x268)),0x1;const _0x4f4dbc=resolveYamlFile(_0x3d6660);if(existsSync(_0x4f4dbc)){_0x2ee985[_0x1464fe(0x24d)]&&console[_0x1464fe(0x2cb)](_0x1464fe(0x1f6)+_0x4f4dbc);let _0x247890;try{_0x247890=readFileSync(_0x4f4dbc,_0x1464fe(0x1d4));}catch(_0x208567){const _0x352c72=_0x208567 instanceof Error?_0x208567['message']:String(_0x208567);return console[_0x1464fe(0x2cb)](_0x1464fe(0x2fb)+_0x352c72),0x1;}const _0x23ba72=await withSpinner('Analyzing\x20changes...',()=>_0x24cd93[_0x1464fe(0x23d)][_0x1464fe(0x243)](_0x247890),{'verbose':_0x2ee985[_0x1464fe(0x24d)]}),_0x53cd7c=_0x23ba72[_0x1464fe(0x264)],{isNew:_0x3e46ff,name:_0x576719,hasChanges:_0x44fe36,diffFormatted:_0xa88be4}=_0x53cd7c;if(_0x44fe36){_0x3e46ff?console[_0x1464fe(0x2cb)](_0x1464fe(0x238)+_0x576719+'\x27:'):console[_0x1464fe(0x2cb)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x576719+'\x27:');console['error']('─'[_0x1464fe(0x270)](0x3c)),console['error'](_0xa88be4),console[_0x1464fe(0x2cb)]('─'[_0x1464fe(0x270)](0x3c));const _0x544aa4=_0x3e46ff?'Create\x20parent\x20segment\x20\x27'+_0x576719+_0x1464fe(0x215):'Apply\x20changes\x20to\x20\x27'+_0x576719+_0x1464fe(0x215);if(!_0x2ee985[_0x1464fe(0x30a)]){if(!isInteractive())return console[_0x1464fe(0x2cb)](a29_0x483110[_0x1464fe(0x205)]('\x0aError:'),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x1464fe(0x2cb)](a29_0x483110['dim'](_0x1464fe(0x2b9))),0x1;const _0x1cb165=await confirmKey(_0x544aa4);if(!_0x1cb165)return console[_0x1464fe(0x2cb)](a29_0x483110[_0x1464fe(0x1db)](_0x1464fe(0x256))),0x1;}const _0x1ac386=_0x3e46ff?_0x1464fe(0x27c):_0x1464fe(0x1e4);await withSpinner(_0x1ac386+'\x20parent\x20segment\x20\x27'+_0x576719+_0x1464fe(0x291),()=>_0x53cd7c[_0x1464fe(0x299)](),{'verbose':_0x2ee985[_0x1464fe(0x24d)]});const _0xb5beb9=_0x3e46ff?_0x1464fe(0x33a):'Updated';console[_0x1464fe(0x2cb)]('✔\x20'+_0xb5beb9+_0x1464fe(0x318)+_0x576719+'\x27');}else console[_0x1464fe(0x2cb)]('✔\x20No\x20changes\x20-\x20\x27'+_0x576719+_0x1464fe(0x22d));}const _0x121edc=await withSpinner(_0x1464fe(0x211)+_0x3d6660+_0x1464fe(0x291),()=>_0x24cd93[_0x1464fe(0x23d)][_0x1464fe(0x207)](_0x3d6660),{'verbose':_0x2ee985[_0x1464fe(0x24d)]}),_0x1978cf=_0x121edc['data'],_0x525d65=getConsoleUrl(_0x2ee985['site'],'/app/workflows/'+_0x1978cf[_0x1464fe(0x230)]+_0x1464fe(0x32a)+_0x1978cf[_0x1464fe(0x2ce)]+_0x1464fe(0x267)+_0x1978cf[_0x1464fe(0x2bd)]);return console[_0x1464fe(0x2cb)](_0x1464fe(0x258)),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x227))+'\x20'+_0x1978cf[_0x1464fe(0x1cd)]),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x21f))+'\x20'+_0x1978cf[_0x1464fe(0x1ed)]),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)]('Session:')+'\x20'+_0x1978cf[_0x1464fe(0x2ce)]),console[_0x1464fe(0x2cb)]('\x20\x20'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x305))+'\x20'+_0x1978cf[_0x1464fe(0x2bd)]),console[_0x1464fe(0x2cb)]('\x20\x20'+_0x525d65),console[_0x1464fe(0x2cb)]('\x0a'+a29_0x483110[_0x1464fe(0x28a)](_0x1464fe(0x27e))+_0x1464fe(0x26c)+_0x1978cf[_0x1464fe(0x2bd)]+_0x1464fe(0x22a)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x4cec4b(0x311)]='segment:parent:fields';[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x20d);async[a29_0x4cec4b(0x1cb)](_0x36a6f1){const _0x481a1c=a29_0x4cec4b,{options:_0x485b70,args:_0x549cec,tdx:_0x3150ca}=_0x36a6f1,_0x32af63=_0x549cec[0x0]||_0x485b70['parentSegment'];if(!_0x32af63)return showParentSegmentNotSetError(_0x481a1c(0x301)+_0x481a1c(0x2b3)),0x1;_0x485b70[_0x481a1c(0x24d)]&&(console['error'](_0x481a1c(0x31e)+_0x485b70[_0x481a1c(0x317)]),console[_0x481a1c(0x2cb)](_0x481a1c(0x1df)+_0x32af63));const _0x499767=await withSpinner(_0x481a1c(0x32b)+_0x32af63+'\x27...',()=>_0x3150ca[_0x481a1c(0x23d)][_0x481a1c(0x2f3)](_0x32af63),{'verbose':_0x485b70[_0x481a1c(0x24d)]}),_0x3bec29=_0x499767[_0x481a1c(0x264)];console[_0x481a1c(0x2cb)](_0x481a1c(0x1d8)+_0x3bec29[_0x481a1c(0x32f)]+_0x481a1c(0x303)+(_0x3bec29['length']!==0x1?'s':''));if(_0x485b70[_0x481a1c(0x2ee)]||_0x485b70[_0x481a1c(0x26f)])return await handleSDKOutput(_0x3bec29,_0x485b70),0x0;return displayFieldsHumanReadable(_0x3bec29,_0x32af63),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a29_0x4cec4b(0x2f1);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x314);async[a29_0x4cec4b(0x1cb)](_0x341fbe){const _0x510af3=a29_0x4cec4b,{options:_0x356449,args:_0x3916ef,tdx:_0x32494c}=_0x341fbe,_0x2341be=_0x356449,_0x5a4fd1=_0x3916ef[0x0]||_0x356449['parentSegment'];if(!_0x5a4fd1)return showParentSegmentNotSetError(_0x510af3(0x326)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0x510af3(0x332)+_0x510af3(0x260)),0x1;_0x356449[_0x510af3(0x24d)]&&(console[_0x510af3(0x2cb)](_0x510af3(0x31e)+_0x356449[_0x510af3(0x317)]),console[_0x510af3(0x2cb)](_0x510af3(0x1df)+_0x5a4fd1));const _0x5256e7=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x5a4fd1+_0x510af3(0x291),()=>_0x32494c[_0x510af3(0x23d)][_0x510af3(0x321)](_0x5a4fd1),{'verbose':_0x356449[_0x510af3(0x24d)]}),_0x50a554=_0x5256e7['data'];if(_0x2341be[_0x510af3(0x242)]){const _0x38c21f=getConsoleNextUrl(_0x2341be[_0x510af3(0x317)],_0x510af3(0x319)+_0x50a554['id']);return console['error'](a29_0x483110['green']('✔')+_0x510af3(0x27b)+a29_0x483110[_0x510af3(0x1e3)](_0x38c21f)),openBrowser(_0x38c21f),0x0;}return await handleSingleObjectOutput(_0x50a554,_0x356449),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x337);[a29_0x4cec4b(0x2a3)]='Show\x20parent\x20segment\x20schema\x20(column\x20types)';async[a29_0x4cec4b(0x1cb)](_0x10b45c){const _0x58d89d=a29_0x4cec4b,{options:_0x503c85,args:_0x5e0dbc,tdx:_0x54e4d2}=_0x10b45c,_0x18279f=_0x503c85,_0x32b7ba=_0x5e0dbc[0x0]||_0x503c85[_0x58d89d(0x245)];if(!_0x32b7ba)return showParentSegmentNotSetError(_0x58d89d(0x21e)+'\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'+_0x58d89d(0x332)+_0x58d89d(0x320)),0x1;_0x503c85[_0x58d89d(0x24d)]&&(console[_0x58d89d(0x2cb)]('Site:\x20'+_0x503c85[_0x58d89d(0x317)]),console['error'](_0x58d89d(0x1df)+_0x32b7ba));const _0x1d10fc=await withSpinner(_0x58d89d(0x222)+_0x32b7ba+_0x58d89d(0x291),()=>_0x54e4d2[_0x58d89d(0x23d)]['resolveParentId'](_0x32b7ba),{'verbose':_0x503c85[_0x58d89d(0x24d)]}),_0x5c7c56=_0x1d10fc[_0x58d89d(0x264)],_0x4c80ba=_0x54e4d2[_0x58d89d(0x23d)][_0x58d89d(0x1d2)](_0x5c7c56);if(_0x18279f[_0x58d89d(0x1fe)]){const _0x3ef810=await this[_0x58d89d(0x322)](_0x10b45c,_0x32b7ba,_0x5c7c56,_0x4c80ba),_0xe281c4=this[_0x58d89d(0x2f6)](_0x3ef810);writeFileSync(_0x18279f[_0x58d89d(0x1fe)],_0xe281c4);const _0x3a623b=_0x3ef810[_0x58d89d(0x257)]['columns'][_0x58d89d(0x32f)]+_0x3ef810[_0x58d89d(0x304)][_0x58d89d(0x2da)]((_0x4779d7,_0x2f8b3e)=>_0x4779d7+_0x2f8b3e[_0x58d89d(0x25b)]['length'],0x0),_0x167d58=_0x3ef810['behaviors'][_0x58d89d(0x2e4)](_0x481b3b=>_0x481b3b['columns'][_0x58d89d(0x32f)]===0x0)['length'];return console[_0x58d89d(0x1f3)]('Schema\x20saved\x20to\x20'+_0x18279f[_0x58d89d(0x1fe)]),console['log'](_0x58d89d(0x30e)+_0x4c80ba),console['log']('\x20\x20Tables:\x201\x20customers\x20+\x20'+_0x3ef810[_0x58d89d(0x304)]['length']+_0x58d89d(0x285)),console[_0x58d89d(0x1f3)](_0x58d89d(0x210)+_0x3a623b+_0x58d89d(0x2cd)),_0x167d58>0x0&&console[_0x58d89d(0x1f3)]('\x20\x20Note:\x20'+_0x167d58+_0x58d89d(0x217)),0x0;}console[_0x58d89d(0x2cb)]('\x0a'+a29_0x483110[_0x58d89d(0x30b)]('Output\x20Database:')+'\x20'+a29_0x483110[_0x58d89d(0x1e3)](_0x4c80ba));const _0x3b9a7a=await withSpinner(_0x58d89d(0x292),()=>_0x54e4d2[_0x58d89d(0x23d)][_0x58d89d(0x25e)](_0x5c7c56),{'verbose':_0x503c85[_0x58d89d(0x24d)]});console['error']('\x0a'+a29_0x483110[_0x58d89d(0x30b)](_0x58d89d(0x257))+'\x20'+a29_0x483110[_0x58d89d(0x28a)]('('+_0x4c80ba+_0x58d89d(0x2c6)));const _0x57563a=await executeSchemaQuery(_0x3b9a7a['data'],_0x54e4d2,_0x503c85);await handleQueryOutput(_0x57563a,_0x503c85);const _0x572465=await withSpinner(_0x58d89d(0x1e9),()=>_0x54e4d2[_0x58d89d(0x23d)][_0x58d89d(0x30d)](_0x5c7c56),{'verbose':_0x503c85['verbose']});for(const _0x172456 of _0x572465['data']){const _0x5e0617=_0x58d89d(0x24a)+_0x172456[_0x58d89d(0x2df)]()['replace'](/\s+/g,'_'),_0x21517e=_0x58d89d(0x246)+_0x4c80ba+'.'+_0x5e0617;console['error']('\x0a'+a29_0x483110[_0x58d89d(0x30b)](_0x172456)+'\x20'+a29_0x483110['dim']('('+_0x4c80ba+'.'+_0x5e0617+')'));try{const _0x27c6b8=await executeSchemaQuery(_0x21517e,_0x54e4d2,_0x503c85);await handleQueryOutput(_0x27c6b8,_0x503c85);}catch{console['error'](a29_0x483110[_0x58d89d(0x1db)](_0x58d89d(0x339)));}}return 0x0;}async[a29_0x4cec4b(0x322)](_0x263962,_0x486013,_0x88b4bd,_0x1ab189){const _0x35648a=a29_0x4cec4b,{options:_0x5b7cdd,tdx:_0x1bec39}=_0x263962,_0x157ab0=await withSpinner(_0x35648a(0x292),()=>_0x1bec39['segment'][_0x35648a(0x25e)](_0x88b4bd),{'verbose':_0x5b7cdd['verbose']}),_0x20958d=await executeSchemaQuery(_0x157ab0[_0x35648a(0x264)],_0x1bec39,_0x5b7cdd),_0x4cb89e=_0x20958d['data'][_0x35648a(0x26a)](_0x4f4863=>({'name':_0x4f4863[_0x35648a(0x1e2)],'type':_0x4f4863['column_type']})),_0xf0d066=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x1bec39[_0x35648a(0x23d)][_0x35648a(0x30d)](_0x88b4bd),{'verbose':_0x5b7cdd['verbose']}),_0x1ed76f=[];for(const _0xfb5d8b of _0xf0d066[_0x35648a(0x264)]){const _0x1042a7=_0x35648a(0x24a)+_0xfb5d8b[_0x35648a(0x2df)]()['replace'](/\s+/g,'_'),_0x41b51c=_0x35648a(0x246)+_0x1ab189+'.'+_0x1042a7;let _0xfe1f2f=[];try{const _0x26cf45=await executeSchemaQuery(_0x41b51c,_0x1bec39,_0x5b7cdd);_0xfe1f2f=_0x26cf45[_0x35648a(0x264)][_0x35648a(0x26a)](_0x7f18bf=>({'name':_0x7f18bf['column_name'],'type':_0x7f18bf['column_type']}));}catch{}_0x1ed76f[_0x35648a(0x2e0)]({'table':_0x1042a7,'columns':_0xfe1f2f});}return{'database':_0x1ab189,'parent_segment':_0x486013,'parent_id':_0x88b4bd,'customers':{'table':_0x35648a(0x257),'columns':_0x4cb89e},'behaviors':_0x1ed76f};}[a29_0x4cec4b(0x2f6)](_0x1fbfee){const _0x21faa9=a29_0x4cec4b,_0x1e0823=_0xea073d=>{const _0x33bc2a=a29_0x5785;if(_0xea073d[_0x33bc2a(0x32f)]===0x0)return'[]';const _0x1bf397=_0xea073d['map'](_0x237d84=>_0x33bc2a(0x2e7)+_0x237d84['name']+_0x33bc2a(0x1e7)+_0x237d84[_0x33bc2a(0x1ef)]+'\x22\x20}');return'[\x0a'+_0x1bf397[_0x33bc2a(0x2fd)](',\x0a')+_0x33bc2a(0x327);},_0x1a06ee=_0x1fbfee['behaviors'][_0x21faa9(0x26a)](_0x175db9=>{const _0x45ff7b=_0x21faa9;return _0x45ff7b(0x271)+_0x175db9['table']+_0x45ff7b(0x2a9)+_0x1e0823(_0x175db9[_0x45ff7b(0x25b)])['replace'](/^/gm,'\x20\x20')[_0x45ff7b(0x1d9)]()+_0x45ff7b(0x249);})[_0x21faa9(0x2fd)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x1fbfee[_0x21faa9(0x200)]+_0x21faa9(0x286)+_0x1fbfee[_0x21faa9(0x29f)]+_0x21faa9(0x2eb)+_0x1fbfee[_0x21faa9(0x1de)]+_0x21faa9(0x275)+_0x1fbfee[_0x21faa9(0x257)][_0x21faa9(0x307)]+_0x21faa9(0x300)+_0x1e0823(_0x1fbfee[_0x21faa9(0x257)][_0x21faa9(0x25b)])[_0x21faa9(0x2e2)](/^/gm,'\x20\x20')[_0x21faa9(0x1d9)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x1a06ee+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2f2);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x1f4);async[a29_0x4cec4b(0x1cb)](_0x20404e){const _0x5b095d=a29_0x4cec4b,{options:_0xbc7a70,args:_0x221db3,tdx:_0x25f45d}=_0x20404e,_0x22d78d=_0x221db3[0x0]||_0xbc7a70[_0x5b095d(0x245)];if(!_0x22d78d)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0xbc7a70[_0x5b095d(0x24d)]&&(console[_0x5b095d(0x2cb)](_0x5b095d(0x31e)+_0xbc7a70['site']),console[_0x5b095d(0x2cb)]('Parent\x20segment:\x20'+_0x22d78d));const _0x951a72=await withSpinner(_0x5b095d(0x222)+_0x22d78d+_0x5b095d(0x291),()=>_0x25f45d[_0x5b095d(0x23d)][_0x5b095d(0x20a)](_0x22d78d),{'verbose':_0xbc7a70[_0x5b095d(0x24d)]}),_0xb27a93=_0x951a72[_0x5b095d(0x264)],_0x14bf1f=await withSpinner(_0x5b095d(0x2b0)+_0x22d78d+'\x27...',()=>_0x25f45d['segment']['getParentSQL'](_0xb27a93),{'verbose':_0xbc7a70[_0x5b095d(0x24d)]}),_0x5cb6ad=_0x14bf1f[_0x5b095d(0x264)];return _0xbc7a70[_0x5b095d(0x2a7)]===_0x5b095d(0x2ee)||_0xbc7a70['format']===_0x5b095d(0x26f)?await handleSDKOutput([{'sql':_0x5cb6ad}],_0xbc7a70):console['log'](_0x5cb6ad),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x4cec4b(0x311)]='segment:parent:show';[a29_0x4cec4b(0x2a3)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async[a29_0x4cec4b(0x1cb)](_0xa58f2a){const _0xa4e3a4=a29_0x4cec4b,{options:_0xf7ab8,args:_0x18aa52,tdx:_0x4c3eee}=_0xa58f2a,_0x3cd425=_0x18aa52[0x0]||_0xf7ab8[_0xa4e3a4(0x245)];if(!_0x3cd425)return showParentSegmentNotSetError(_0xa4e3a4(0x24b)+'\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;_0xf7ab8['verbose']&&(console[_0xa4e3a4(0x2cb)](_0xa4e3a4(0x31e)+_0xf7ab8[_0xa4e3a4(0x317)]),console[_0xa4e3a4(0x2cb)]('Parent\x20segment:\x20'+_0x3cd425));const _0x5523a4=await withSpinner(_0xa4e3a4(0x222)+_0x3cd425+_0xa4e3a4(0x291),()=>_0x4c3eee[_0xa4e3a4(0x23d)][_0xa4e3a4(0x20a)](_0x3cd425),{'verbose':_0xf7ab8['verbose']}),_0x2bc8a9=_0x5523a4[_0xa4e3a4(0x264)],_0x353943=await withSpinner(_0xa4e3a4(0x2b0)+_0x3cd425+'\x27...',()=>_0x4c3eee[_0xa4e3a4(0x23d)][_0xa4e3a4(0x25e)](_0x2bc8a9),{'verbose':_0xf7ab8['verbose']});let _0x3f5bc1=_0x353943['data'];const _0x135c75=resolveLimit(_0xf7ab8[_0xa4e3a4(0x2f5)],DEFAULT_DISPLAY_LIMIT),_0x4c31ed=/\bLIMIT\s+\d+/i[_0xa4e3a4(0x25a)](_0x3f5bc1);!_0x4c31ed&&(_0x3f5bc1=_0x3f5bc1[_0xa4e3a4(0x1d9)]()[_0xa4e3a4(0x2e2)](/;+$/,''),_0x3f5bc1=_0xa4e3a4(0x28c)+_0x3f5bc1+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x135c75);_0xf7ab8['verbose']&&console[_0xa4e3a4(0x2cb)]('SQL\x20query:\x0a'+_0x3f5bc1);const _0x1b49f9=await withProgressSpinner(_0xa4e3a4(0x2a6),async _0x2a0dec=>{const _0x14e4da=_0xa4e3a4,_0x47107d=await _0x4c3eee[_0x14e4da(0x2fc)][_0x14e4da(0x1cb)](_0x3f5bc1,{'catalog':'td','schema':_0x14e4da(0x2cc),'onJobId':_0x365a6e=>{_0x2a0dec['setJobId'](_0x365a6e);}});return _0x47107d;},{'verbose':_0xf7ab8[_0xa4e3a4(0x24d)]}),_0x2f4292=_0x1b49f9[_0xa4e3a4(0x264)],_0x370dfb=_0x2f4292[_0xa4e3a4(0x2f7)]?_0xa4e3a4(0x1f8)+_0x2f4292['jobId']+']':'';return console[_0xa4e3a4(0x2cb)](_0xa4e3a4(0x295)+_0x2f4292[_0xa4e3a4(0x298)][_0xa4e3a4(0x287)][_0xa4e3a4(0x208)]()+_0xa4e3a4(0x213)+(_0xa4e3a4(0x1d1)+formatElapsed(_0x2f4292[_0xa4e3a4(0x298)][_0xa4e3a4(0x32d)])+_0x370dfb)),await handleQueryOutput(_0x2f4292,_0xf7ab8),0x0;}}export class PSRtListCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x1dc);['description']=a29_0x4cec4b(0x24e);async[a29_0x4cec4b(0x1cb)](_0x334085){const _0x3d7926=a29_0x4cec4b,{options:_0x196967,args:_0x86f97f,tdx:_0x58868d}=_0x334085,_0x37405c=_0x86f97f[0x0],_0x2d7335=await withSpinner(_0x37405c?_0x3d7926(0x336)+_0x37405c+_0x3d7926(0x291):'Listing\x20RT-enabled\x20parent\x20segments...',()=>_0x58868d[_0x3d7926(0x1ea)][_0x3d7926(0x20f)](),{'verbose':_0x196967['verbose']});let _0x22a231=_0x2d7335[_0x3d7926(0x264)][_0x3d7926(0x2e4)](_0x5a1bdc=>_0x5a1bdc['realtime_enabled']);if(_0x37405c){const _0x55b84b=_0x37405c[_0x3d7926(0x2e2)](/[.+^${}()|[\]\\]/g,_0x3d7926(0x2db))[_0x3d7926(0x2e2)](/\*/g,'.*')[_0x3d7926(0x2e2)](/\?/g,'.'),_0x2640b1=new RegExp('^'+_0x55b84b+'$','i');_0x22a231=_0x22a231[_0x3d7926(0x2e4)](_0x16dbc8=>_0x2640b1[_0x3d7926(0x25a)](_0x16dbc8['name']));}_0x22a231[_0x3d7926(0x1ca)]((_0x2c5a8e,_0x340fd2)=>_0x2c5a8e['name'][_0x3d7926(0x2b2)](_0x340fd2['name'])),console[_0x3d7926(0x2cb)](_0x3d7926(0x1d8)+_0x22a231[_0x3d7926(0x32f)]+_0x3d7926(0x233)+(_0x22a231[_0x3d7926(0x32f)]!==0x1?'s':''));const _0x101414=_0x5994d0=>{return getConsoleNextUrl(_0x196967['site'],'/app/dw/parentSegments/'+_0x5994d0);};if(_0x196967[_0x3d7926(0x2a7)]===_0x3d7926(0x2ee)||_0x196967[_0x3d7926(0x2a7)]==='jsonl'){const _0x20ce80=_0x22a231[_0x3d7926(0x26a)](_0x5d98ae=>({..._0x5d98ae,'url':_0x101414(_0x5d98ae['id'])}));await handleSDKOutput(_0x20ce80,_0x196967);}else{if(_0x22a231[_0x3d7926(0x32f)]===0x0)console[_0x3d7926(0x1f3)](_0x3d7926(0x25f));else for(const _0x1b9600 of _0x22a231){const _0xf35d14=_0x1b9600[_0x3d7926(0x1c6)]?a29_0x483110[_0x3d7926(0x28a)]('\x20('+formatRows(_0x1b9600[_0x3d7926(0x1c6)])+')'):'',_0x1a1c50=hyperlink(_0x1b9600[_0x3d7926(0x311)],_0x101414(_0x1b9600['id']));console[_0x3d7926(0x1f3)]('⚡\x20'+_0x1a1c50+_0xf35d14);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2b4);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x293);async[a29_0x4cec4b(0x1cb)](_0xbfa0b4){const _0x191f88=a29_0x4cec4b,{options:_0x28b450,args:_0x4a3247,tdx:_0x44e4d5}=_0xbfa0b4,_0x37a0d3=_0x4a3247[0x0]||_0x28b450['parentSegment'];if(!_0x37a0d3)return showParentSegmentNotSetError(_0x191f88(0x2fa)+_0x191f88(0x2e3)),0x1;const _0x56ce59=resolveYamlFile(_0x37a0d3);if(!existsSync(_0x56ce59))return showFileNotFoundError(_0x56ce59,_0x37a0d3),0x1;let _0x377711;try{_0x377711=readFileSync(_0x56ce59,_0x191f88(0x1d4));}catch(_0xc28c3b){const _0x53fcc7=_0xc28c3b instanceof Error?_0xc28c3b[_0x191f88(0x2a5)]:String(_0xc28c3b);return console[_0x191f88(0x2cb)](_0x191f88(0x2fb)+_0x53fcc7),0x1;}const _0x1d1ef0=createCommandSpinner(a29_0x483110[_0x191f88(0x28a)](_0x191f88(0x2e6)),{'verbose':_0x28b450[_0x191f88(0x24d)]});_0x1d1ef0[_0x191f88(0x2ec)]();const _0x4b6f4a={'realtime':!![],'onProgress':_0x221ab2=>{const _0x4f2d3f=_0x191f88;_0x1d1ef0[_0x4f2d3f(0x2a4)]=formatProgressMessage(_0x221ab2);}};let _0x5863b4;try{_0x5863b4=await _0x44e4d5[_0x191f88(0x23d)][_0x191f88(0x33b)](_0x377711,_0x4b6f4a),_0x1d1ef0[_0x191f88(0x2ef)]();}catch(_0x2c999b){_0x1d1ef0[_0x191f88(0x2ef)]();throw _0x2c999b;}console[_0x191f88(0x2cb)]('\x0a'+a29_0x483110['bold'](_0x191f88(0x228))+'\x20'+_0x5863b4[_0x191f88(0x311)]),console[_0x191f88(0x2cb)]('═'['repeat'](0x3c)),displayRealtimeValidation(_0x5863b4),console[_0x191f88(0x2cb)]('─'['repeat'](0x3c));if(_0x5863b4[_0x191f88(0x30c)][_0x191f88(0x32f)]>0x0){console[_0x191f88(0x2cb)]('\x0a'+a29_0x483110[_0x191f88(0x205)](_0x191f88(0x1d7)));for(const _0x326b67 of _0x5863b4['errors']){console[_0x191f88(0x2cb)]('\x20\x20'+a29_0x483110[_0x191f88(0x205)]('•')+'\x20'+_0x326b67);}}return _0x5863b4['allValid']&&console[_0x191f88(0x2cb)]('\x0a'+a29_0x483110[_0x191f88(0x31f)]('✔')+_0x191f88(0x2ca)),_0x5863b4['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x2e1);[a29_0x4cec4b(0x2a3)]=a29_0x4cec4b(0x1e5);async[a29_0x4cec4b(0x1cb)](_0x794e72){const _0x31d0ea=a29_0x4cec4b,{options:_0x542a2a,args:_0xbcd781,tdx:_0xb91fd0}=_0x794e72,_0x33cb7a=_0xbcd781[0x0]||_0x542a2a[_0x31d0ea(0x245)];if(!_0x33cb7a)return showParentSegmentNotSetError(_0x31d0ea(0x323)+_0x31d0ea(0x22f)),0x1;const _0x152e07=await withSpinner(_0x31d0ea(0x222)+_0x33cb7a+'\x27...',()=>_0xb91fd0[_0x31d0ea(0x23d)]['resolveParentId'](_0x33cb7a),{'verbose':_0x542a2a[_0x31d0ea(0x24d)]}),_0x582dd2=_0x152e07[_0x31d0ea(0x264)],_0x4e03d9=await withSpinner(_0x31d0ea(0x329)+_0x33cb7a+_0x31d0ea(0x291),()=>_0xb91fd0['personalization'][_0x31d0ea(0x20f)](_0x582dd2),{'verbose':_0x542a2a[_0x31d0ea(0x24d)]}),_0x1a7bec=_0x4e03d9[_0x31d0ea(0x264)];console['error'](_0x31d0ea(0x1d8)+_0x1a7bec[_0x31d0ea(0x32f)]+_0x31d0ea(0x1c9)+(_0x1a7bec[_0x31d0ea(0x32f)]!==0x1?'s':''));if(_0x542a2a[_0x31d0ea(0x2a7)]==='json'||_0x542a2a[_0x31d0ea(0x2a7)]===_0x31d0ea(0x26f))await handleSDKOutput(_0x1a7bec,_0x542a2a);else{if(_0x1a7bec[_0x31d0ea(0x32f)]===0x0)console[_0x31d0ea(0x1f3)](_0x31d0ea(0x31d)),console['error'](a29_0x483110[_0x31d0ea(0x1e3)](_0x31d0ea(0x1cf)));else for(const _0xd936a4 of _0x1a7bec){const _0x17f347=_0xd936a4[_0x31d0ea(0x1e1)]?.[_0x31d0ea(0x32f)]||0x0,_0x3dd40c=_0xd936a4[_0x31d0ea(0x33c)]?a29_0x483110[_0x31d0ea(0x28a)]('\x20trigger='+_0xd936a4['trigger_event']):'',_0x29685a=a29_0x483110['dim']('\x20('+_0x17f347+_0x31d0ea(0x219)+(_0x17f347!==0x1?'s':'')+')');console[_0x31d0ea(0x1f3)]('\x20\x20'+_0xd936a4[_0x31d0ea(0x311)]+_0x3dd40c+_0x29685a),_0xd936a4[_0x31d0ea(0x2a3)]&&console['log'](_0x31d0ea(0x316)+a29_0x483110[_0x31d0ea(0x28a)](_0xd936a4[_0x31d0ea(0x2a3)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a29_0x4cec4b(0x311)]=a29_0x4cec4b(0x32e);['description']=a29_0x4cec4b(0x255);async[a29_0x4cec4b(0x1cb)](_0x5bbf41){const _0x410045=a29_0x4cec4b,{options:_0x375b63,args:_0x3f6f38}=_0x5bbf41,_0x1f02b8=_0x3f6f38[0x0]||_0x375b63['parentSegment'];if(!_0x1f02b8)return showParentSegmentNotSetError('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'+_0x410045(0x28b)),0x1;const _0x5b298f=resolveYamlFile(_0x1f02b8);if(!existsSync(_0x5b298f))return showFileNotFoundError(_0x5b298f,_0x1f02b8),0x1;let _0x4cd76f;try{_0x4cd76f=readFileSync(_0x5b298f,'utf-8');}catch(_0xd30192){const _0x3d5e7c=_0xd30192 instanceof Error?_0xd30192[_0x410045(0x2a5)]:String(_0xd30192);return console[_0x410045(0x2cb)](_0x410045(0x2fb)+_0x3d5e7c),0x1;}let _0x2712d8;try{_0x2712d8=parseDef(_0x4cd76f);}catch(_0x125602){const _0x4612ba=_0x125602 instanceof Error?_0x125602[_0x410045(0x2a5)]:String(_0x125602);return console[_0x410045(0x2cb)](a29_0x483110[_0x410045(0x205)](_0x410045(0x247)+_0x4612ba)),0x1;}if(_0x2712d8['personalization_services']&&_0x2712d8[_0x410045(0x2e9)][_0x410045(0x32f)]>0x0)return console[_0x410045(0x2cb)](a29_0x483110['yellow']('⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20'+_0x5b298f)),console[_0x410045(0x2cb)](a29_0x483110[_0x410045(0x28a)](_0x410045(0x2ba)+_0x2712d8[_0x410045(0x2e9)][_0x410045(0x32f)]+_0x410045(0x212))),0x1;!_0x2712d8[_0x410045(0x1ea)]&&(_0x2712d8['realtime']={'events':[{'name':_0x410045(0x2d2),'source_table':_0x410045(0x2cf)}],'attributes':[{'name':_0x410045(0x1ff),'type':_0x410045(0x313)}],'id_stitching':{'primary_key':_0x2712d8[_0x410045(0x2b1)][_0x410045(0x307)]==='customers'?_0x410045(0x23e):_0x410045(0x250)}});_0x2712d8['personalization_services']=[{'name':_0x410045(0x338),'description':'Personalization\x20service\x20description','trigger_event':'page_view','sections':[{'name':_0x410045(0x310),'criteria':_0x410045(0x273),'attributes':[_0x410045(0x1ff)]}]}];const _0x3ed646=serializeDef(_0x2712d8);return writeFileSync(_0x5b298f,_0x3ed646,_0x410045(0x1d4)),console[_0x410045(0x2cb)](a29_0x483110['green']('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a29_0x483110['cyan'](_0x5b298f)),(!_0x2712d8[_0x410045(0x1ea)]||_0x4cd76f[_0x410045(0x2ed)]('realtime:')===-0x1)&&console[_0x410045(0x2cb)](a29_0x483110[_0x410045(0x31f)]('✔')+'\x20Added\x20RT\x202.0\x20template\x20section'),console[_0x410045(0x2cb)]('\x0a'+a29_0x483110[_0x410045(0x28a)](_0x410045(0x283))),console[_0x410045(0x2cb)](_0x410045(0x31b)+_0x5b298f+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x410045(0x2cb)](_0x410045(0x2b6)+a29_0x483110['dim'](_0x410045(0x2d0)+_0x1f02b8)+_0x410045(0x1f2)),0x0;}}
@@ -1 +1 @@
1
- const a30_0x1c9684=a30_0x513d;(function(_0x2534dd,_0x443c68){const _0x57871c=a30_0x513d,_0x47cc5a=_0x2534dd();while(!![]){try{const _0x3c05f3=-parseInt(_0x57871c(0x1c3))/0x1+-parseInt(_0x57871c(0x1e3))/0x2+-parseInt(_0x57871c(0x20e))/0x3+parseInt(_0x57871c(0x1fa))/0x4+-parseInt(_0x57871c(0x21e))/0x5*(parseInt(_0x57871c(0x1cd))/0x6)+parseInt(_0x57871c(0x1f9))/0x7+parseInt(_0x57871c(0x217))/0x8;if(_0x3c05f3===_0x443c68)break;else _0x47cc5a['push'](_0x47cc5a['shift']());}catch(_0x42e953){_0x47cc5a['push'](_0x47cc5a['shift']());}}}(a30_0x2db7,0x6620f));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a30_0x513d(_0x4fe25b,_0x11726e){_0x4fe25b=_0x4fe25b-0x1b9;const _0x2db767=a30_0x2db7();let _0x513d9b=_0x2db767[_0x4fe25b];return _0x513d9b;}import{getConfigDir}from'../core/config.js';import*as a30_0x22283e from'node:path';function a30_0x2db7(){const _0x2ea614=['VALID_KEYS','✗\x20Validation\x20failed:\x20','Enter\x20description\x20(optional):','Profile\x20name\x20cannot\x20be\x20empty','yellow','validate','message','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','getUserInfo','1512852FxYxRp','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x0aAvailable\x20profiles:','log','session','Removal\x20cancelled','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','9956328XcfyTy','split','logLevel','tdx:\x20profile\x20create','includes','Changing\x20site\x20to\x20\x27','description','4465lEqZSU','\x20\x20(no\x20profiles\x20found)','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','text','Profile\x20\x27','green','red','\x27\x20requires\x20API\x20key\x20validation.','\x27\x20created','Enter\x20profile\x20name:','\x0aSetup\x20cancelled','select','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','profile:use','\x20API\x20key\x20removed\x20from\x20system\x20keychain','jobs','other','115813XSDvRK','API\x20key\x20cannot\x20be\x20empty','Site\x20name\x20cannot\x20be\x20empty','name','error','profileName','llm_project','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','ERROR','dim','3894bXHRqT','Site\x20was\x20not\x20changed.','Enter\x20your\x20TD\x20API\x20key:','\x27\x20removed\x20from\x20configuration','\x20\x20tdx\x20--profile\x20','test','confirm','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','warn','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','/app/mp/ak','status','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','password','Validating\x20API\x20key...','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','bold','us01','email','\x27.\x0a\x0aValid\x20keys:\x20','Default\x20profile\x20set\x20to:\x20','734242itIOEQ','join','site','parent_segment','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','Remove\x20a\x20profile','Failed\x20to\x20remove\x20profile:\x20','create','config','profile:remove','\x20API\x20key\x20is\x20valid\x20(User:\x20','Create\x20a\x20new\x20profile','Operation\x20cancelled','tdx.json','profile','trim','(cleared)','customSite','\x20Profile\x20\x27','\x27\x20updated:\x20','\x27\x20does\x20not\x20exist.','tdx:\x20profile\x20remove','4408110guPSXn','443292TbkuNn','Session\x20profile\x20set\x20to:\x20','Unknown\x20key\x20\x27','length','\x0aOperation\x20cancelled','\x20--default\x27\x20to\x20save\x20permanently','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x20\x20-\x20','(session:\x20','apiKey','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.'];a30_0x2db7=function(){return _0x2ea614;};return a30_0x2db7();}import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a30_0x1bebe9 from'prompts';import a30_0x3b321a from'chalk';function validateProfileName(_0x532602){const _0x107566=a30_0x513d;if(!_0x532602||!_0x532602[_0x107566(0x1f2)]())return _0x107566(0x208);const _0x84f5ab=_0x532602[_0x107566(0x1f2)]();if(!/^[a-zA-Z0-9_-]+$/[_0x107566(0x1d2)](_0x84f5ab))return _0x107566(0x1dd);if(profileExists(_0x84f5ab))return _0x107566(0x222)+_0x84f5ab+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]='profile:create';[a30_0x1c9684(0x21d)]=a30_0x1c9684(0x1ee);async[a30_0x1c9684(0x215)](_0xb1057){const _0x1b3ab9=a30_0x1c9684,{options:_0x25dea6,args:_0x794f92}=_0xb1057;console[_0x1b3ab9(0x212)](a30_0x3b321a[_0x1b3ab9(0x1de)](_0x1b3ab9(0x21a)));let _0xd6e4b4;if(_0x794f92[_0x1b3ab9(0x1fd)]>0x0&&_0x794f92[0x0]){const _0x40634f=_0x794f92[0x0][_0x1b3ab9(0x1f2)](),_0x8eb4ac=validateProfileName(_0x40634f);if(_0x8eb4ac!==!![])return console[_0x1b3ab9(0x1c7)](a30_0x3b321a[_0x1b3ab9(0x224)](_0x8eb4ac)),0x1;_0xd6e4b4=_0x40634f;}else{const _0x56589c=await a30_0x1bebe9({'type':_0x1b3ab9(0x221),'name':_0x1b3ab9(0x1c8),'message':_0x1b3ab9(0x1ba),'validate':validateProfileName});if(!_0x56589c[_0x1b3ab9(0x1c8)])return console['log']('\x0aSetup\x20cancelled'),0x1;_0xd6e4b4=_0x56589c[_0x1b3ab9(0x1c8)]['trim']();}const _0xcaa4cb=await a30_0x1bebe9({'type':'text','name':_0x1b3ab9(0x21d),'message':_0x1b3ab9(0x207)}),_0x54bd79=_0xcaa4cb['description']?.[_0x1b3ab9(0x1f2)]()||undefined,_0x27f6a6=_0x25dea6[_0x1b3ab9(0x1e5)]||_0x1b3ab9(0x1df),{choices:_0x40bd5b,initialIndex:_0x476160}=buildSiteChoices(_0x27f6a6),_0x21cc1a=await a30_0x1bebe9({'type':_0x1b3ab9(0x1bc),'name':_0x1b3ab9(0x1e5),'message':_0x1b3ab9(0x20c)+_0xd6e4b4+'\x27:','choices':_0x40bd5b,'initial':_0x476160});if(!_0x21cc1a['site'])return console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1bb)),0x1;let _0x2975ea;if(_0x21cc1a['site']===_0x1b3ab9(0x1c2)){const _0x2b6525=await a30_0x1bebe9({'type':_0x1b3ab9(0x221),'name':_0x1b3ab9(0x1f4),'message':'Enter\x20site\x20name:','initial':_0x1b3ab9(0x1df),'validate':_0x1b186b=>{const _0x6b8e01=_0x1b3ab9;if(!_0x1b186b||!_0x1b186b[_0x6b8e01(0x1f2)]())return _0x6b8e01(0x1c5);if(!/^[a-z0-9-]+$/[_0x6b8e01(0x1d2)](_0x1b186b['trim']()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x2b6525[_0x1b3ab9(0x1f4)])return console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1bb)),0x1;_0x2975ea=_0x2b6525[_0x1b3ab9(0x1f4)];}else _0x2975ea=_0x21cc1a[_0x1b3ab9(0x1e5)];const _0x4bd64e=resolveSite(_0x2975ea);console[_0x1b3ab9(0x212)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x4bd64e),console[_0x1b3ab9(0x212)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1b3ab9(0x212)]('\x20\x20'+getConsoleUrl(_0x4bd64e,'/app/mp/ak'));const _0x5d8aa7=await a30_0x1bebe9({'type':_0x1b3ab9(0x1db),'name':_0x1b3ab9(0x203),'message':_0x1b3ab9(0x1cf),'validate':_0x5c42ed=>{const _0x56dd9c=_0x1b3ab9;if(!_0x5c42ed||!_0x5c42ed[_0x56dd9c(0x1f2)]())return _0x56dd9c(0x1c4);return!![];}});if(!_0x5d8aa7[_0x1b3ab9(0x203)])return console[_0x1b3ab9(0x212)]('\x0aSetup\x20cancelled'),0x1;const _0x20856f=_0x5d8aa7[_0x1b3ab9(0x203)];console['log'](_0x1b3ab9(0x1dc));try{const _0x4e32a3=TDX[_0x1b3ab9(0x1ea)]({'site':_0x4bd64e,'apiKey':_0x20856f[_0x1b3ab9(0x1f2)](),'logLevel':_0x25dea6[_0x1b3ab9(0x219)]??LogLevel['ERROR']}),_0x4ee7c6=await _0x4e32a3['jobs'][_0x1b3ab9(0x20d)]();console['log'](a30_0x3b321a[_0x1b3ab9(0x223)]('✓')+_0x1b3ab9(0x1ed)+_0x4ee7c6[_0x1b3ab9(0x1e0)]+')');const _0x430c58=await isKeychainAvailable();_0x430c58?(await saveAPIKeyAsync(_0x20856f['trim'](),_0x4bd64e,_0xd6e4b4),console[_0x1b3ab9(0x212)](a30_0x3b321a[_0x1b3ab9(0x223)]('✓')+_0x1b3ab9(0x220)+_0xd6e4b4+')')):(console[_0x1b3ab9(0x1d6)](a30_0x3b321a['yellow'](_0x1b3ab9(0x204))),console[_0x1b3ab9(0x1d6)](a30_0x3b321a[_0x1b3ab9(0x209)](_0x1b3ab9(0x20f))));const _0x303406={'site':_0x4bd64e,..._0x54bd79&&{'description':_0x54bd79}};return saveProfileToUserConfig(_0xd6e4b4,_0x303406),console['log'](a30_0x3b321a[_0x1b3ab9(0x223)]('✓')+_0x1b3ab9(0x1f5)+_0xd6e4b4+_0x1b3ab9(0x1b9)),console[_0x1b3ab9(0x212)](),console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1da)),console[_0x1b3ab9(0x212)]('\x20\x20tdx\x20--profile\x20'+_0xd6e4b4+_0x1b3ab9(0x1d5)),console[_0x1b3ab9(0x212)](_0x1b3ab9(0x1d1)+_0xd6e4b4+_0x1b3ab9(0x1d4)),0x0;}catch(_0x2ca401){if(_0x2ca401 instanceof HTTPClientError&&_0x2ca401[_0x1b3ab9(0x1d9)]===0x191)return printAuthError(_0x2ca401),0x1;return console['error'](a30_0x3b321a[_0x1b3ab9(0x224)](_0x1b3ab9(0x206)+(_0x2ca401 instanceof Error?_0x2ca401[_0x1b3ab9(0x20b)]:String(_0x2ca401)))),console[_0x1b3ab9(0x1c7)]('Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.'),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]=a30_0x1c9684(0x1ec);['description']=a30_0x1c9684(0x1e8);['validate'](_0xb8dc82){const _0xa5e6ed=a30_0x1c9684,{args:_0x238571}=_0xb8dc82;if(_0x238571['length']===0x0)return _0xa5e6ed(0x216);return undefined;}async['execute'](_0x3512b1){const _0x46ce45=a30_0x1c9684,{args:_0x458714}=_0x3512b1,_0xb502e5=_0x458714[0x0];console['log'](a30_0x3b321a['bold'](_0x46ce45(0x1f8)));if(!profileExists(_0xb502e5)){console[_0x46ce45(0x1c7)](a30_0x3b321a[_0x46ce45(0x224)]('Profile\x20\x27'+_0xb502e5+_0x46ce45(0x1f7))),console[_0x46ce45(0x212)](_0x46ce45(0x211));const _0x59407d=listProfiles();if(_0x59407d[_0x46ce45(0x1fd)]===0x0)console[_0x46ce45(0x212)]('\x20\x20(no\x20profiles\x20found)');else for(const _0xab2387 of _0x59407d){console[_0x46ce45(0x212)](_0x46ce45(0x201)+_0xab2387[_0x46ce45(0x1c6)]);}return 0x1;}const _0x5edfb6=await a30_0x1bebe9({'type':_0x46ce45(0x1d3),'name':'confirm','message':'Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27'+_0xb502e5+'\x27?','initial':![]});if(!_0x5edfb6[_0x46ce45(0x1d3)])return console[_0x46ce45(0x212)](_0x46ce45(0x214)),0x0;try{removeProfileFromUserConfig(_0xb502e5),console[_0x46ce45(0x212)](a30_0x3b321a['green']('✓')+_0x46ce45(0x1f5)+_0xb502e5+_0x46ce45(0x1d0));}catch(_0x589e29){return console[_0x46ce45(0x1c7)](a30_0x3b321a[_0x46ce45(0x224)](_0x46ce45(0x1e9)+(_0x589e29 instanceof Error?_0x589e29[_0x46ce45(0x20b)]:String(_0x589e29)))),0x1;}const _0xac2e55=await isKeychainAvailable();if(_0xac2e55){const _0x4cc826=await deleteKeychainAPIKey(_0xb502e5);_0x4cc826&&console['log'](a30_0x3b321a[_0x46ce45(0x223)]('✓')+_0x46ce45(0x1c0));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]='profile:set';[a30_0x1c9684(0x21d)]='Set\x20a\x20profile\x20configuration\x20value';static ['VALID_KEYS']=[a30_0x1c9684(0x1e5),'database',a30_0x1c9684(0x1e6),a30_0x1c9684(0x1c9),'llm_agent','description'];[a30_0x1c9684(0x20a)](_0x279490){const _0x5c955f=a30_0x1c9684,{args:_0x1eadd5,options:_0x3d47f5}=_0x279490,_0x178558=_0x3d47f5[_0x5c955f(0x1f1)]||getActiveProfile();if(!_0x178558)return _0x5c955f(0x1be);if(_0x1eadd5[_0x5c955f(0x1fd)]===0x0)return _0x5c955f(0x1bd)+ProfileSetCommand[_0x5c955f(0x205)][_0x5c955f(0x1e4)](',\x20');const _0x6a0569=_0x1eadd5[0x0];if(!_0x6a0569[_0x5c955f(0x21b)]('='))return _0x5c955f(0x1ca)+ProfileSetCommand['VALID_KEYS'][_0x5c955f(0x1e4)](',\x20');const [_0x1decf1]=_0x6a0569['split']('=',0x2);if(!ProfileSetCommand[_0x5c955f(0x205)][_0x5c955f(0x21b)](_0x1decf1))return _0x5c955f(0x1fc)+_0x1decf1+_0x5c955f(0x1e1)+ProfileSetCommand[_0x5c955f(0x205)][_0x5c955f(0x1e4)](',\x20');return undefined;}async[a30_0x1c9684(0x215)](_0x7dbefe){const _0x5605d9=a30_0x1c9684,{args:_0xcc3c60,options:_0x14342c}=_0x7dbefe,_0x3e10a1=_0x14342c['profile']||getActiveProfile(),[_0xf2a372,..._0x5121f3]=_0xcc3c60[0x0][_0x5605d9(0x218)]('='),_0x25e810=_0x5121f3['join']('=');console[_0x5605d9(0x212)](a30_0x3b321a[_0x5605d9(0x1de)]('tdx:\x20profile\x20set'));if(!profileExists(_0x3e10a1)){const _0xb99f51=await a30_0x1bebe9({'type':_0x5605d9(0x1d3),'name':_0x5605d9(0x1ea),'message':'Profile\x20\x27'+_0x3e10a1+_0x5605d9(0x200),'initial':!![]});if(!_0xb99f51[_0x5605d9(0x1ea)])return console[_0x5605d9(0x212)](_0x5605d9(0x1ef)),0x1;}const _0x3e5661=loadProfile(_0x3e10a1),_0x3cee4c=_0x3e5661?.[_0x5605d9(0x1eb)]||{};if(_0xf2a372===_0x5605d9(0x1e5)){const _0x15a3ed=resolveSite(_0x25e810);console['log'](_0x5605d9(0x21c)+_0x15a3ed+_0x5605d9(0x225)),console['log'](_0x5605d9(0x1e7)),console[_0x5605d9(0x212)]('\x20\x20'+getConsoleUrl(_0x15a3ed,_0x5605d9(0x1d8)));const _0x1f7b74=await a30_0x1bebe9({'type':_0x5605d9(0x1db),'name':_0x5605d9(0x203),'message':_0x5605d9(0x1d7),'validate':_0x24babb=>{const _0x23300a=_0x5605d9;if(!_0x24babb||!_0x24babb['trim']())return _0x23300a(0x1c4);return!![];}});if(!_0x1f7b74[_0x5605d9(0x203)])return console[_0x5605d9(0x212)](_0x5605d9(0x1fe)),0x1;console['log'](_0x5605d9(0x1dc));try{const _0x229473=TDX[_0x5605d9(0x1ea)]({'site':_0x15a3ed,'apiKey':_0x1f7b74[_0x5605d9(0x203)]['trim'](),'logLevel':_0x14342c[_0x5605d9(0x219)]??LogLevel[_0x5605d9(0x1cb)]}),_0x561d48=await _0x229473[_0x5605d9(0x1c1)][_0x5605d9(0x20d)]();console['log'](a30_0x3b321a[_0x5605d9(0x223)]('✓')+_0x5605d9(0x1ed)+_0x561d48[_0x5605d9(0x1e0)]+')');const _0x1ca7b4=await isKeychainAvailable();_0x1ca7b4?(await saveAPIKeyAsync(_0x1f7b74[_0x5605d9(0x203)][_0x5605d9(0x1f2)](),_0x15a3ed,_0x3e10a1),console[_0x5605d9(0x212)](a30_0x3b321a['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x5605d9(0x1d6)](a30_0x3b321a[_0x5605d9(0x209)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x3cee4c[_0x5605d9(0x1e5)]=_0x15a3ed;}catch(_0x129d55){if(_0x129d55 instanceof HTTPClientError&&_0x129d55['status']===0x191)return printAuthError(_0x129d55),0x1;return console[_0x5605d9(0x1c7)](a30_0x3b321a[_0x5605d9(0x224)]('✗\x20Validation\x20failed:\x20'+(_0x129d55 instanceof Error?_0x129d55[_0x5605d9(0x20b)]:String(_0x129d55)))),console[_0x5605d9(0x1c7)](_0x5605d9(0x1ce)),0x1;}}else _0x3cee4c[_0xf2a372]=_0x25e810||undefined;return saveProfileToUserConfig(_0x3e10a1,_0x3cee4c),console[_0x5605d9(0x212)](a30_0x3b321a[_0x5605d9(0x223)]('✓')+_0x5605d9(0x1f5)+_0x3e10a1+_0x5605d9(0x1f6)+_0xf2a372+'='+(_0x25e810||_0x5605d9(0x1f3))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a30_0x1c9684(0x1c6)]=a30_0x1c9684(0x1bf);[a30_0x1c9684(0x21d)]='Set\x20session\x20profile';[a30_0x1c9684(0x20a)](_0x1ddc3f){const _0x568cb4=a30_0x1c9684,{args:_0x233075}=_0x1ddc3f;if(_0x233075[_0x568cb4(0x1fd)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a30_0x1c9684(0x215)](_0x30b9fd){const _0x3a4ac6=a30_0x1c9684,{args:_0xfeb884,options:_0x53b46e}=_0x30b9fd,_0x359071=_0xfeb884[0x0],_0x541e45=_0x53b46e['default'];cleanExpiredSessions();if(!profileExists(_0x359071)){console[_0x3a4ac6(0x1c7)](a30_0x3b321a[_0x3a4ac6(0x224)](_0x3a4ac6(0x222)+_0x359071+_0x3a4ac6(0x1f7))),console['log'](_0x3a4ac6(0x211));const _0x53406b=listProfiles();if(_0x53406b[_0x3a4ac6(0x1fd)]===0x0)console['log'](_0x3a4ac6(0x21f));else for(const _0x158a01 of _0x53406b){console[_0x3a4ac6(0x212)](_0x3a4ac6(0x201)+_0x158a01[_0x3a4ac6(0x1c6)]);}return 0x1;}if(_0x541e45){const _0x3d47c1=a30_0x22283e[_0x3a4ac6(0x1e4)](getConfigDir(),_0x3a4ac6(0x1f0));return saveActiveProfileToUserConfig(_0x359071),console[_0x3a4ac6(0x212)](_0x3a4ac6(0x1e2)+a30_0x3b321a['green'](_0x359071)),console['log'](a30_0x3b321a[_0x3a4ac6(0x1cc)]('\x0aSaved\x20to:\x20'+_0x3d47c1)),0x0;}const _0x27472c=getSessionID(_0x53b46e[_0x3a4ac6(0x213)]);return saveSessionContext({'profile':_0x359071},_0x53b46e['session']),console[_0x3a4ac6(0x212)](_0x3a4ac6(0x1fb)+a30_0x3b321a['green'](_0x359071)+'\x20'+a30_0x3b321a[_0x3a4ac6(0x1cc)](_0x3a4ac6(0x202)+_0x27472c+')')),console[_0x3a4ac6(0x212)](a30_0x3b321a[_0x3a4ac6(0x1cc)](_0x3a4ac6(0x210)+_0x359071+_0x3a4ac6(0x1ff))),0x0;}}
1
+ const a30_0x2a7a94=a30_0xa3dd;(function(_0x4775c5,_0x155289){const _0x48dcfd=a30_0xa3dd,_0x1293d9=_0x4775c5();while(!![]){try{const _0x3329d3=parseInt(_0x48dcfd(0x189))/0x1+-parseInt(_0x48dcfd(0x17a))/0x2+-parseInt(_0x48dcfd(0x17f))/0x3*(parseInt(_0x48dcfd(0x175))/0x4)+parseInt(_0x48dcfd(0x188))/0x5*(-parseInt(_0x48dcfd(0x173))/0x6)+parseInt(_0x48dcfd(0x195))/0x7+-parseInt(_0x48dcfd(0x17d))/0x8*(parseInt(_0x48dcfd(0x176))/0x9)+parseInt(_0x48dcfd(0x171))/0xa;if(_0x3329d3===_0x155289)break;else _0x1293d9['push'](_0x1293d9['shift']());}catch(_0xe0659a){_0x1293d9['push'](_0x1293d9['shift']());}}}(a30_0x1c74,0xd61cd));function a30_0x1c74(){const _0xe7808d=['\x27.\x0a\x0aValid\x20keys:\x20','name','test','(session:\x20','Enter\x20description\x20(optional):','error','ERROR','parent_segment','Profile\x20name\x20cannot\x20be\x20empty','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','getUserInfo','profile:remove','status','Set\x20a\x20profile\x20configuration\x20value','yellow','API\x20key\x20cannot\x20be\x20empty','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','config','Validating\x20API\x20key...','profile:create','\x20API\x20key\x20is\x20valid\x20(User:\x20','tdx:\x20profile\x20remove','site','Operation\x20cancelled','✗\x20Validation\x20failed:\x20','\x20API\x20key\x20removed\x20from\x20system\x20keychain','Set\x20session\x20profile','tdx:\x20profile\x20create','/app/mp/ak','profile:set','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','llm_project','28892310gIWXJF','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','1579224YWegWi','other','4566644IZnzzJ','268542NIeJTO','Remove\x20a\x20profile','Site\x20was\x20not\x20changed.','warn','2215912cBhXbv','session','\x27\x20requires\x20API\x20key\x20validation.','272xGypAa','Enter\x20site\x20name:','3kOQOWh','\x0aSetup\x20cancelled','create','\x20\x20tdx\x20--profile\x20','\x27\x20does\x20not\x20exist.','description','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','10Qphnas','1114907rDrFoQ','\x0aAvailable\x20profiles:','text','apiKey','bold','Removal\x20cancelled','Enter\x20profile\x20name:','profile','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Default\x20profile\x20set\x20to:\x20','\x27\x20removed\x20from\x20configuration','log','4643688BFUiTu','message','red','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','database','llm_agent','us01','validate','Session\x20profile\x20set\x20to:\x20','\x0aSaved\x20to:\x20','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Enter\x20your\x20TD\x20API\x20key:','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','Unknown\x20key\x20\x27','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','profile:use','profileName','\x20Profile\x20\x27','customSite','\x20--default\x27\x20to\x20save\x20permanently','\x27\x20created','VALID_KEYS','green','Changing\x20site\x20to\x20\x27','Profile\x20\x27','Site\x20name\x20cannot\x20be\x20empty','confirm','dim','password','join','\x20\x20-\x20','logLevel','tdx.json','execute','trim','length','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','\x27\x20updated:\x20','split','includes','email'];a30_0x1c74=function(){return _0xe7808d;};return a30_0x1c74();}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 a30_0x102d88 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';function a30_0xa3dd(_0x520b04,_0x2c9463){_0x520b04=_0x520b04-0x13f;const _0x1c74c8=a30_0x1c74();let _0xa3ddd6=_0x1c74c8[_0x520b04];return _0xa3ddd6;}import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a30_0x5b575d from'prompts';import a30_0x562e1d from'chalk';function validateProfileName(_0x5a4773){const _0xa96745=a30_0xa3dd;if(!_0x5a4773||!_0x5a4773[_0xa96745(0x14a)]())return _0xa96745(0x159);const _0x1b9583=_0x5a4773[_0xa96745(0x14a)]();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x1b9583))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x1b9583))return _0xa96745(0x140)+_0x1b9583+_0xa96745(0x1a7);return!![];}export class ProfileCreateCommand extends BaseCommand{[a30_0x2a7a94(0x152)]=a30_0x2a7a94(0x164);[a30_0x2a7a94(0x184)]='Create\x20a\x20new\x20profile';async[a30_0x2a7a94(0x149)](_0x4b1dd0){const _0x2c1395=a30_0x2a7a94,{options:_0x4bdf8b,args:_0x35bbde}=_0x4b1dd0;console[_0x2c1395(0x194)](a30_0x562e1d[_0x2c1395(0x18d)](_0x2c1395(0x16c)));let _0x22d0e0;if(_0x35bbde[_0x2c1395(0x14b)]>0x0&&_0x35bbde[0x0]){const _0x441f44=_0x35bbde[0x0][_0x2c1395(0x14a)](),_0x7afe84=validateProfileName(_0x441f44);if(_0x7afe84!==!![])return console[_0x2c1395(0x156)](a30_0x562e1d[_0x2c1395(0x197)](_0x7afe84)),0x1;_0x22d0e0=_0x441f44;}else{const _0x1f92c0=await a30_0x5b575d({'type':_0x2c1395(0x18b),'name':_0x2c1395(0x1a9),'message':_0x2c1395(0x18f),'validate':validateProfileName});if(!_0x1f92c0[_0x2c1395(0x1a9)])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;_0x22d0e0=_0x1f92c0[_0x2c1395(0x1a9)][_0x2c1395(0x14a)]();}const _0x4a6526=await a30_0x5b575d({'type':'text','name':_0x2c1395(0x184),'message':_0x2c1395(0x155)}),_0x19db24=_0x4a6526[_0x2c1395(0x184)]?.[_0x2c1395(0x14a)]()||undefined,_0x182162=_0x4bdf8b['site']||_0x2c1395(0x19f),{choices:_0x12b7db,initialIndex:_0x57bb2c}=buildSiteChoices(_0x182162),_0xac80c7=await a30_0x5b575d({'type':'select','name':_0x2c1395(0x167),'message':_0x2c1395(0x19c)+_0x22d0e0+'\x27:','choices':_0x12b7db,'initial':_0x57bb2c});if(!_0xac80c7[_0x2c1395(0x167)])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;let _0x48a7ae;if(_0xac80c7[_0x2c1395(0x167)]===_0x2c1395(0x174)){const _0x2a778b=await a30_0x5b575d({'type':_0x2c1395(0x18b),'name':_0x2c1395(0x1ab),'message':_0x2c1395(0x17e),'initial':_0x2c1395(0x19f),'validate':_0x11e56a=>{const _0x1bd6f4=_0x2c1395;if(!_0x11e56a||!_0x11e56a[_0x1bd6f4(0x14a)]())return _0x1bd6f4(0x141);if(!/^[a-z0-9-]+$/[_0x1bd6f4(0x153)](_0x11e56a[_0x1bd6f4(0x14a)]()))return _0x1bd6f4(0x161);return!![];}});if(!_0x2a778b['customSite'])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;_0x48a7ae=_0x2a778b[_0x2c1395(0x1ab)];}else _0x48a7ae=_0xac80c7['site'];const _0x1b7fcf=resolveSite(_0x48a7ae);console[_0x2c1395(0x194)](_0x2c1395(0x191)+_0x1b7fcf),console[_0x2c1395(0x194)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x2c1395(0x194)]('\x20\x20'+getConsoleUrl(_0x1b7fcf,_0x2c1395(0x16d)));const _0x46825c=await a30_0x5b575d({'type':_0x2c1395(0x144),'name':_0x2c1395(0x18c),'message':_0x2c1395(0x1a4),'validate':_0x1ff4ad=>{const _0x86bc70=_0x2c1395;if(!_0x1ff4ad||!_0x1ff4ad[_0x86bc70(0x14a)]())return _0x86bc70(0x160);return!![];}});if(!_0x46825c[_0x2c1395(0x18c)])return console[_0x2c1395(0x194)](_0x2c1395(0x180)),0x1;const _0x2c7dba=_0x46825c[_0x2c1395(0x18c)];console['log'](_0x2c1395(0x163));try{const _0x42ed69=TDX[_0x2c1395(0x181)]({'site':_0x1b7fcf,'apiKey':_0x2c7dba[_0x2c1395(0x14a)](),'logLevel':_0x4bdf8b[_0x2c1395(0x147)]??LogLevel[_0x2c1395(0x157)]}),_0x3b772b=await _0x42ed69['jobs'][_0x2c1395(0x15b)]();console[_0x2c1395(0x194)](a30_0x562e1d['green']('✓')+_0x2c1395(0x165)+_0x3b772b[_0x2c1395(0x150)]+')');const _0x233ed7=await isKeychainAvailable();_0x233ed7?(await saveAPIKeyAsync(_0x2c7dba[_0x2c1395(0x14a)](),_0x1b7fcf,_0x22d0e0),console[_0x2c1395(0x194)](a30_0x562e1d[_0x2c1395(0x1af)]('✓')+_0x2c1395(0x199)+_0x22d0e0+')')):(console[_0x2c1395(0x179)](a30_0x562e1d[_0x2c1395(0x15f)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x2c1395(0x179)](a30_0x562e1d[_0x2c1395(0x15f)](_0x2c1395(0x186))));const _0x533d8b={'site':_0x1b7fcf,..._0x19db24&&{'description':_0x19db24}};return saveProfileToUserConfig(_0x22d0e0,_0x533d8b),console[_0x2c1395(0x194)](a30_0x562e1d[_0x2c1395(0x1af)]('✓')+_0x2c1395(0x1aa)+_0x22d0e0+_0x2c1395(0x1ad)),console['log'](),console[_0x2c1395(0x194)](_0x2c1395(0x15a)),console[_0x2c1395(0x194)](_0x2c1395(0x182)+_0x22d0e0+_0x2c1395(0x172)),console[_0x2c1395(0x194)](_0x2c1395(0x182)+_0x22d0e0+_0x2c1395(0x1a5)),0x0;}catch(_0x5b7057){if(_0x5b7057 instanceof HTTPClientError&&_0x5b7057[_0x2c1395(0x15d)]===0x191)return printAuthError(_0x5b7057),0x1;return console['error'](a30_0x562e1d[_0x2c1395(0x197)]('✗\x20Validation\x20failed:\x20'+(_0x5b7057 instanceof Error?_0x5b7057[_0x2c1395(0x196)]:String(_0x5b7057)))),console[_0x2c1395(0x156)](_0x2c1395(0x19a)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a30_0x2a7a94(0x15c);['description']=a30_0x2a7a94(0x177);['validate'](_0x1b4fee){const _0x329968=a30_0x2a7a94,{args:_0x13d185}=_0x1b4fee;if(_0x13d185[_0x329968(0x14b)]===0x0)return _0x329968(0x198);return undefined;}async['execute'](_0x149726){const _0x407ba3=a30_0x2a7a94,{args:_0x59134}=_0x149726,_0x3dbc6b=_0x59134[0x0];console[_0x407ba3(0x194)](a30_0x562e1d[_0x407ba3(0x18d)](_0x407ba3(0x166)));if(!profileExists(_0x3dbc6b)){console[_0x407ba3(0x156)](a30_0x562e1d[_0x407ba3(0x197)](_0x407ba3(0x140)+_0x3dbc6b+_0x407ba3(0x183))),console[_0x407ba3(0x194)](_0x407ba3(0x18a));const _0x510362=listProfiles();if(_0x510362[_0x407ba3(0x14b)]===0x0)console[_0x407ba3(0x194)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x4a4dab of _0x510362){console[_0x407ba3(0x194)](_0x407ba3(0x146)+_0x4a4dab[_0x407ba3(0x152)]);}return 0x1;}const _0x159bf1=await a30_0x5b575d({'type':_0x407ba3(0x142),'name':_0x407ba3(0x142),'message':_0x407ba3(0x19b)+_0x3dbc6b+'\x27?','initial':![]});if(!_0x159bf1[_0x407ba3(0x142)])return console[_0x407ba3(0x194)](_0x407ba3(0x18e)),0x0;try{removeProfileFromUserConfig(_0x3dbc6b),console[_0x407ba3(0x194)](a30_0x562e1d['green']('✓')+'\x20Profile\x20\x27'+_0x3dbc6b+_0x407ba3(0x193));}catch(_0x42a691){return console[_0x407ba3(0x156)](a30_0x562e1d[_0x407ba3(0x197)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x42a691 instanceof Error?_0x42a691['message']:String(_0x42a691)))),0x1;}const _0x32db91=await isKeychainAvailable();if(_0x32db91){const _0x4e66a1=await deleteKeychainAPIKey(_0x3dbc6b);_0x4e66a1&&console[_0x407ba3(0x194)](a30_0x562e1d[_0x407ba3(0x1af)]('✓')+_0x407ba3(0x16a));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a30_0x2a7a94(0x152)]=a30_0x2a7a94(0x16e);['description']=a30_0x2a7a94(0x15e);static [a30_0x2a7a94(0x1ae)]=[a30_0x2a7a94(0x167),a30_0x2a7a94(0x19d),a30_0x2a7a94(0x158),a30_0x2a7a94(0x170),a30_0x2a7a94(0x19e),'description'];[a30_0x2a7a94(0x1a0)](_0x21aaff){const _0x584602=a30_0x2a7a94,{args:_0x1b7ab4,options:_0x50b078}=_0x21aaff,_0xda7c19=_0x50b078[_0x584602(0x190)]||getActiveProfile();if(!_0xda7c19)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(_0x1b7ab4[_0x584602(0x14b)]===0x0)return _0x584602(0x185)+ProfileSetCommand['VALID_KEYS'][_0x584602(0x145)](',\x20');const _0x392e40=_0x1b7ab4[0x0];if(!_0x392e40[_0x584602(0x14f)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand['VALID_KEYS'][_0x584602(0x145)](',\x20');const [_0x3ae562]=_0x392e40[_0x584602(0x14e)]('=',0x2);if(!ProfileSetCommand[_0x584602(0x1ae)][_0x584602(0x14f)](_0x3ae562))return _0x584602(0x1a6)+_0x3ae562+_0x584602(0x151)+ProfileSetCommand[_0x584602(0x1ae)][_0x584602(0x145)](',\x20');return undefined;}async['execute'](_0x35125e){const _0x3eea01=a30_0x2a7a94,{args:_0x3ed9e0,options:_0x23c602}=_0x35125e,_0xc7c445=_0x23c602[_0x3eea01(0x190)]||getActiveProfile(),[_0x2d2800,..._0x3894b4]=_0x3ed9e0[0x0][_0x3eea01(0x14e)]('='),_0x3377cb=_0x3894b4[_0x3eea01(0x145)]('=');console[_0x3eea01(0x194)](a30_0x562e1d['bold']('tdx:\x20profile\x20set'));if(!profileExists(_0xc7c445)){const _0x2c47ec=await a30_0x5b575d({'type':_0x3eea01(0x142),'name':_0x3eea01(0x181),'message':_0x3eea01(0x140)+_0xc7c445+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x2c47ec['create'])return console['log'](_0x3eea01(0x168)),0x1;}const _0x1106ee=loadProfile(_0xc7c445),_0x5aaca9=_0x1106ee?.[_0x3eea01(0x162)]||{};if(_0x2d2800===_0x3eea01(0x167)){const _0x46f298=resolveSite(_0x3377cb);console[_0x3eea01(0x194)](_0x3eea01(0x13f)+_0x46f298+_0x3eea01(0x17c)),console[_0x3eea01(0x194)](_0x3eea01(0x187)),console['log']('\x20\x20'+getConsoleUrl(_0x46f298,_0x3eea01(0x16d)));const _0x203256=await a30_0x5b575d({'type':_0x3eea01(0x144),'name':_0x3eea01(0x18c),'message':'Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','validate':_0x1e69aa=>{const _0x11c90a=_0x3eea01;if(!_0x1e69aa||!_0x1e69aa[_0x11c90a(0x14a)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x203256[_0x3eea01(0x18c)])return console['log']('\x0aOperation\x20cancelled'),0x1;console[_0x3eea01(0x194)](_0x3eea01(0x163));try{const _0x5a86b3=TDX['create']({'site':_0x46f298,'apiKey':_0x203256[_0x3eea01(0x18c)][_0x3eea01(0x14a)](),'logLevel':_0x23c602['logLevel']??LogLevel[_0x3eea01(0x157)]}),_0x59c3c8=await _0x5a86b3['jobs'][_0x3eea01(0x15b)]();console[_0x3eea01(0x194)](a30_0x562e1d[_0x3eea01(0x1af)]('✓')+_0x3eea01(0x165)+_0x59c3c8['email']+')');const _0x3f1bba=await isKeychainAvailable();_0x3f1bba?(await saveAPIKeyAsync(_0x203256[_0x3eea01(0x18c)][_0x3eea01(0x14a)](),_0x46f298,_0xc7c445),console[_0x3eea01(0x194)](a30_0x562e1d[_0x3eea01(0x1af)]('✓')+_0x3eea01(0x1a3))):console[_0x3eea01(0x179)](a30_0x562e1d[_0x3eea01(0x15f)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x5aaca9[_0x3eea01(0x167)]=_0x46f298;}catch(_0x40f804){if(_0x40f804 instanceof HTTPClientError&&_0x40f804['status']===0x191)return printAuthError(_0x40f804),0x1;return console[_0x3eea01(0x156)](a30_0x562e1d[_0x3eea01(0x197)](_0x3eea01(0x169)+(_0x40f804 instanceof Error?_0x40f804[_0x3eea01(0x196)]:String(_0x40f804)))),console['error'](_0x3eea01(0x178)),0x1;}}else _0x5aaca9[_0x2d2800]=_0x3377cb||undefined;return saveProfileToUserConfig(_0xc7c445,_0x5aaca9),console[_0x3eea01(0x194)](a30_0x562e1d[_0x3eea01(0x1af)]('✓')+_0x3eea01(0x1aa)+_0xc7c445+_0x3eea01(0x14d)+_0x2d2800+'='+(_0x3377cb||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a30_0x2a7a94(0x1a8);['description']=a30_0x2a7a94(0x16b);[a30_0x2a7a94(0x1a0)](_0x55ee69){const _0x32ebea=a30_0x2a7a94,{args:_0x3a90fd}=_0x55ee69;if(_0x3a90fd[_0x32ebea(0x14b)]===0x0)return _0x32ebea(0x16f);return undefined;}async[a30_0x2a7a94(0x149)](_0x1c52f2){const _0x41a6fb=a30_0x2a7a94,{args:_0x6e4158,options:_0x269b2f}=_0x1c52f2,_0x4c3b8f=_0x6e4158[0x0],_0x34c1e7=_0x269b2f['default'];cleanExpiredSessions();if(!profileExists(_0x4c3b8f)){console[_0x41a6fb(0x156)](a30_0x562e1d['red'](_0x41a6fb(0x140)+_0x4c3b8f+'\x27\x20does\x20not\x20exist.')),console['log'](_0x41a6fb(0x18a));const _0x255cd6=listProfiles();if(_0x255cd6[_0x41a6fb(0x14b)]===0x0)console[_0x41a6fb(0x194)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x43e747 of _0x255cd6){console['log'](_0x41a6fb(0x146)+_0x43e747[_0x41a6fb(0x152)]);}return 0x1;}if(_0x34c1e7){const _0x30e318=a30_0x102d88['join'](getConfigDir(),_0x41a6fb(0x148));return saveActiveProfileToUserConfig(_0x4c3b8f),console[_0x41a6fb(0x194)](_0x41a6fb(0x192)+a30_0x562e1d[_0x41a6fb(0x1af)](_0x4c3b8f)),console[_0x41a6fb(0x194)](a30_0x562e1d[_0x41a6fb(0x143)](_0x41a6fb(0x1a2)+_0x30e318)),0x0;}const _0x526cc7=getSessionID(_0x269b2f['session']);return saveSessionContext({'profile':_0x4c3b8f},_0x269b2f[_0x41a6fb(0x17b)]),console[_0x41a6fb(0x194)](_0x41a6fb(0x1a1)+a30_0x562e1d[_0x41a6fb(0x1af)](_0x4c3b8f)+'\x20'+a30_0x562e1d['dim'](_0x41a6fb(0x154)+_0x526cc7+')')),console[_0x41a6fb(0x194)](a30_0x562e1d[_0x41a6fb(0x143)](_0x41a6fb(0x14c)+_0x4c3b8f+_0x41a6fb(0x1ac))),0x0;}}
@@ -1 +1 @@
1
- const a31_0xf3e456=a31_0x3392;function a31_0x3392(_0x102932,_0x561815){_0x102932=_0x102932-0x182;const _0x2920b4=a31_0x2920();let _0x33926b=_0x2920b4[_0x102932];return _0x33926b;}(function(_0x1f0b03,_0x6e807c){const _0x57f843=a31_0x3392,_0xf5856b=_0x1f0b03();while(!![]){try{const _0x591627=parseInt(_0x57f843(0x195))/0x1+parseInt(_0x57f843(0x182))/0x2*(parseInt(_0x57f843(0x194))/0x3)+parseInt(_0x57f843(0x189))/0x4*(parseInt(_0x57f843(0x18c))/0x5)+-parseInt(_0x57f843(0x191))/0x6+parseInt(_0x57f843(0x185))/0x7+parseInt(_0x57f843(0x196))/0x8*(parseInt(_0x57f843(0x190))/0x9)+-parseInt(_0x57f843(0x18e))/0xa;if(_0x591627===_0x6e807c)break;else _0xf5856b['push'](_0xf5856b['shift']());}catch(_0x926cc6){_0xf5856b['push'](_0xf5856b['shift']());}}}(a31_0x2920,0x3279f));function a31_0x2920(){const _0x55bd26=['message','2460330sOqgJl','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','7263FkFNYq','738366ZiXwys','Error:\x20','name','60774dtrDfX','58998TbSkxd','456DyEkBk','2pKUnmr','description','log','1853075tPfyam','map','config','length','148692oTnfsc','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','error','25nOrcwQ'];a31_0x2920=function(){return _0x55bd26;};return a31_0x2920();}import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{['name']='profiles';[a31_0xf3e456(0x183)]='List\x20all\x20available\x20profiles';async['execute'](_0x527db2){const _0x166dd3=a31_0xf3e456,{options:_0x4ab55e}=_0x527db2;try{const _0x457466=listProfiles(),_0x331a6f=getActiveProfile();if(_0x457466[_0x166dd3(0x188)]===0x0)return console['log'](_0x166dd3(0x18a)),console[_0x166dd3(0x184)](_0x166dd3(0x18f)),console[_0x166dd3(0x184)]('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x2ce455=_0x457466[_0x166dd3(0x186)](_0x393869=>{const _0x16d479=_0x166dd3,_0x4afd56=_0x393869[_0x16d479(0x193)]===_0x331a6f,_0x5ab246=getProfileParams(_0x393869[_0x16d479(0x187)]);return{'name':_0x393869[_0x16d479(0x193)],'active':_0x4afd56,'scope':_0x393869['scope'],'description':_0x393869[_0x16d479(0x187)][_0x16d479(0x183)]||'','params':_0x5ab246};});return await handleSDKOutput(_0x2ce455,_0x4ab55e),0x0;}catch(_0x1a71db){return _0x1a71db instanceof Error&&console[_0x166dd3(0x18b)](_0x166dd3(0x192)+_0x1a71db[_0x166dd3(0x18d)]),0x1;}}}
1
+ const a31_0xe04cb8=a31_0x6f00;(function(_0x3a7b8a,_0x485cdf){const _0x17a180=a31_0x6f00,_0x2b9878=_0x3a7b8a();while(!![]){try{const _0x1aa0d2=parseInt(_0x17a180(0x8d))/0x1+-parseInt(_0x17a180(0x96))/0x2+parseInt(_0x17a180(0x86))/0x3*(-parseInt(_0x17a180(0x83))/0x4)+-parseInt(_0x17a180(0x8b))/0x5+-parseInt(_0x17a180(0x84))/0x6+-parseInt(_0x17a180(0x99))/0x7+parseInt(_0x17a180(0x88))/0x8*(parseInt(_0x17a180(0x97))/0x9);if(_0x1aa0d2===_0x485cdf)break;else _0x2b9878['push'](_0x2b9878['shift']());}catch(_0x3ed32b){_0x2b9878['push'](_0x2b9878['shift']());}}}(a31_0x2d38,0x9426c));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a31_0x2d38(){const _0x4b3952=['log','List\x20all\x20available\x20profiles','2819890ZRLUGI','error','193812qtjala','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','length','config','scope','message','execute','name','488390jIPkNL','36kmiEJx','Error:\x20','3315382JsMFZU','8hryGsb','2933610pbrhVJ','\x20\x20Global:\x20~/.config/tdx/tdx.json','126741ECcHhY','profiles','4536488OhuLwT'];a31_0x2d38=function(){return _0x4b3952;};return a31_0x2d38();}function a31_0x6f00(_0x36e173,_0x17bfb0){_0x36e173=_0x36e173-0x83;const _0x2d38b3=a31_0x2d38();let _0x6f0076=_0x2d38b3[_0x36e173];return _0x6f0076;}export class ProfilesCommand extends BaseCommand{[a31_0xe04cb8(0x95)]=a31_0xe04cb8(0x87);['description']=a31_0xe04cb8(0x8a);async[a31_0xe04cb8(0x94)](_0x1f03fc){const _0x5afcd0=a31_0xe04cb8,{options:_0x38a269}=_0x1f03fc;try{const _0x42c8da=listProfiles(),_0x47446d=getActiveProfile();if(_0x42c8da[_0x5afcd0(0x90)]===0x0)return console[_0x5afcd0(0x89)](_0x5afcd0(0x8e)),console[_0x5afcd0(0x89)](_0x5afcd0(0x8f)),console[_0x5afcd0(0x89)](_0x5afcd0(0x85)),0x0;const _0x1a3f2b=_0x42c8da['map'](_0x366838=>{const _0x397cef=_0x5afcd0,_0x27a35f=_0x366838[_0x397cef(0x95)]===_0x47446d,_0x3c7662=getProfileParams(_0x366838[_0x397cef(0x91)]);return{'name':_0x366838[_0x397cef(0x95)],'active':_0x27a35f,'scope':_0x366838[_0x397cef(0x92)],'description':_0x366838[_0x397cef(0x91)]['description']||'','params':_0x3c7662};});return await handleSDKOutput(_0x1a3f2b,_0x38a269),0x0;}catch(_0x478667){return _0x478667 instanceof Error&&console[_0x5afcd0(0x8c)](_0x5afcd0(0x98)+_0x478667[_0x5afcd0(0x93)]),0x1;}}}
@@ -1 +1 @@
1
- const a32_0x465a96=a32_0x2c68;(function(_0xcc8ab2,_0x5e6e62){const _0x89a1a3=a32_0x2c68,_0x106528=_0xcc8ab2();while(!![]){try{const _0x6a3f4c=-parseInt(_0x89a1a3(0x191))/0x1+parseInt(_0x89a1a3(0x199))/0x2*(-parseInt(_0x89a1a3(0x186))/0x3)+parseInt(_0x89a1a3(0x19e))/0x4+parseInt(_0x89a1a3(0x19c))/0x5*(parseInt(_0x89a1a3(0x17e))/0x6)+parseInt(_0x89a1a3(0x18f))/0x7*(-parseInt(_0x89a1a3(0x1a1))/0x8)+parseInt(_0x89a1a3(0x195))/0x9*(parseInt(_0x89a1a3(0x180))/0xa)+parseInt(_0x89a1a3(0x171))/0xb*(parseInt(_0x89a1a3(0x194))/0xc);if(_0x6a3f4c===_0x5e6e62)break;else _0x106528['push'](_0x106528['shift']());}catch(_0x2b57f1){_0x106528['push'](_0x106528['shift']());}}}(a32_0x30ac,0xbd876));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a32_0x2c68(_0xdf7658,_0x424a45){_0xdf7658=_0xdf7658-0x16f;const _0x30ac0c=a32_0x30ac();let _0x2c68a9=_0x30ac0c[_0xdf7658];return _0x2c68a9;}import{formatRows}from'../sdk/util/formatters.js';function a32_0x30ac(){const _0x4c648f=['80EewvIj','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','length','setPhase','90937YzhsUK','catalog','Schema:\x20','message','description','\x0aAll\x20results\x20saved\x20to\x20','\x20rows\x20','processedRows','push','Executing\x20query...','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Catalog:\x20','args','1528806HHKOJF','information_schema','3075290VjKpsC','jobId','execute','elapsedTimeMillis','file','validate','69VSrNyv','totalSplits','output','stats','query','database','No\x20SQL\x20provided','verbose','...','929712VIlleP','site','620952BdWDmS','Statement\x20','data','264kbdYEi','18XNVxoW','error','Run\x20Trino\x20queries\x20(streaming)','setExtra','45446gxyVkp','Site:\x20','setJobId','25MfDhOH','\x20splits','4708456RcDswU','Executing\x20query\x20[','in\x20'];a32_0x30ac=function(){return _0x4c648f;};return a32_0x30ac();}export class QueryCommand extends BaseCommand{['name']=a32_0x465a96(0x18a);[a32_0x465a96(0x175)]=a32_0x465a96(0x197);async[a32_0x465a96(0x182)](_0x2e4587){const _0x4460e9=a32_0x465a96,{options:_0x247f70,args:_0x119064,tdx:_0x13f9f7}=_0x2e4587,_0x3c6ddb={..._0x247f70,'limitStructuredFormats':!![]},_0x317c5b=_0x119064[0x0],_0x53558a=_0x247f70[_0x4460e9(0x184)];let _0x1b6864;try{if(_0x53558a)_0x1b6864=readSqlStatementsFromFile(_0x53558a);else{if(_0x317c5b==='-')_0x1b6864=await readSqlStatementsFromStdin();else{if(_0x317c5b&&isSqlFilePath(_0x317c5b))_0x1b6864=readSqlStatementsFromFile(_0x317c5b);else{if(_0x317c5b)_0x1b6864=splitSqlStatements(_0x317c5b);else throw new Error(_0x4460e9(0x18c));}}}}catch(_0x454cb4){return console[_0x4460e9(0x196)]('Error:\x20'+_0x454cb4[_0x4460e9(0x174)]),0x1;}const _0x1a7ae0=_0x247f70[_0x4460e9(0x18b)]||_0x4460e9(0x17f),_0x5e6df0=_0x247f70[_0x4460e9(0x172)];try{const _0x195e5c=[],_0x10d12e=!!_0x247f70[_0x4460e9(0x188)];for(let _0x59485c=0x0;_0x59485c<_0x1b6864[_0x4460e9(0x16f)];_0x59485c++){const _0x21d59a=_0x1b6864[_0x59485c],_0x2268e2=_0x59485c+0x1,_0x10070b=_0x1b6864[_0x4460e9(0x16f)],_0x3d4c05=_0x10070b>0x1;_0x247f70[_0x4460e9(0x18d)]&&(console[_0x4460e9(0x196)]('\x0a'+(_0x3d4c05?_0x4460e9(0x192)+_0x2268e2+'/'+_0x10070b+':':'')),console['error'](_0x4460e9(0x19a)+_0x247f70[_0x4460e9(0x190)]),console[_0x4460e9(0x196)](_0x4460e9(0x17c)+(_0x5e6df0||'td')),console[_0x4460e9(0x196)](_0x4460e9(0x173)+_0x1a7ae0),console[_0x4460e9(0x196)]('SQL:\x20'+_0x21d59a));const _0x3174d9=_0x3d4c05?'Executing\x20statement\x20'+_0x2268e2+'/'+_0x10070b+_0x4460e9(0x18e):_0x4460e9(0x17a);try{const _0x29e2e1=await withProgressSpinner(_0x3174d9,async _0x56951b=>{const _0x595428=_0x4460e9,_0x489656=await _0x13f9f7[_0x595428(0x18a)][_0x595428(0x182)](_0x21d59a,{'catalog':_0x5e6df0,'schema':_0x1a7ae0,'onJobId':_0x40792a=>{const _0x5858dd=_0x595428;_0x56951b[_0x5858dd(0x19b)](_0x40792a);},'onProgress':_0x2c49c1=>{const _0x385edd=_0x595428;_0x56951b[_0x385edd(0x170)](_0x385edd(0x19f)+_0x2c49c1['state']+']'),_0x56951b[_0x385edd(0x198)](formatRows(_0x2c49c1[_0x385edd(0x178)])+_0x385edd(0x177)+_0x2c49c1['completedSplits']+'/'+_0x2c49c1[_0x385edd(0x187)]+_0x385edd(0x19d));}});return _0x489656;},{'verbose':_0x247f70[_0x4460e9(0x18d)]}),_0x1b6fd1=_0x29e2e1[_0x4460e9(0x193)],_0x68d2e2=_0x1b6fd1[_0x4460e9(0x181)]?'\x20[Job\x20ID:\x20'+_0x1b6fd1['jobId']+']':'',_0x41fefb=_0x3d4c05?'Statement\x20'+_0x2268e2+'/'+_0x10070b+'\x20-\x20':'';console[_0x4460e9(0x196)]('✔\x20'+_0x41fefb+'Query\x20completed:\x20Processed\x20'+formatRows(_0x1b6fd1[_0x4460e9(0x189)]['processedRows'])+'\x20rows\x20'+(_0x4460e9(0x1a0)+formatElapsed(_0x1b6fd1[_0x4460e9(0x189)][_0x4460e9(0x183)])+_0x68d2e2));if(_0x3d4c05&&_0x10d12e){const _0x5d2fee=resolveOutputOptions(_0x3c6ddb),_0x792e47=await formatQueryOutput(_0x1b6fd1,_0x5d2fee);_0x195e5c[_0x4460e9(0x179)](_0x792e47);}else await handleQueryOutput(_0x1b6fd1,_0x3c6ddb);}catch(_0xe3cc43){const _0x92754d=_0x3d4c05?'Statement\x20'+_0x2268e2+'/'+_0x10070b+':\x0a':'',_0x274640=_0xe3cc43 instanceof SDKError?_0xe3cc43['originalMessage']:_0xe3cc43[_0x4460e9(0x174)];return console[_0x4460e9(0x196)](''+_0x92754d+_0x274640),0x1;}}if(_0x1b6864[_0x4460e9(0x16f)]>0x1&&_0x10d12e&&_0x195e5c['length']>0x0){const _0x5b5507=_0x195e5c['join']('\x0a');writeFileSync(_0x247f70[_0x4460e9(0x188)],_0x5b5507),console[_0x4460e9(0x196)](_0x4460e9(0x176)+_0x247f70['output']);}return 0x0;}catch(_0xd78ac){throw _0xd78ac;}}[a32_0x465a96(0x185)](_0x279462){const _0x5826e5=a32_0x465a96,_0xe217c5=_0x279462[_0x5826e5(0x17d)][0x0],_0x47d059=_0x279462['options'][_0x5826e5(0x184)];if(!_0xe217c5&&!_0x47d059)return _0x5826e5(0x1a2);if(_0xe217c5&&_0x47d059)return _0x5826e5(0x17b);return undefined;}}
1
+ const a32_0x5dea78=a32_0x226e;function a32_0x226e(_0x346ba4,_0x1e7a99){_0x346ba4=_0x346ba4-0x171;const _0x222fa7=a32_0x222f();let _0x226e11=_0x222fa7[_0x346ba4];return _0x226e11;}(function(_0x27f3c3,_0x45bf3a){const _0x33686b=a32_0x226e,_0x1ba8e9=_0x27f3c3();while(!![]){try{const _0x511f55=-parseInt(_0x33686b(0x18d))/0x1*(parseInt(_0x33686b(0x174))/0x2)+parseInt(_0x33686b(0x196))/0x3*(-parseInt(_0x33686b(0x197))/0x4)+-parseInt(_0x33686b(0x18c))/0x5+parseInt(_0x33686b(0x191))/0x6+-parseInt(_0x33686b(0x178))/0x7*(parseInt(_0x33686b(0x184))/0x8)+parseInt(_0x33686b(0x19b))/0x9*(parseInt(_0x33686b(0x175))/0xa)+parseInt(_0x33686b(0x1a0))/0xb*(parseInt(_0x33686b(0x172))/0xc);if(_0x511f55===_0x45bf3a)break;else _0x1ba8e9['push'](_0x1ba8e9['shift']());}catch(_0xfb36a5){_0x1ba8e9['push'](_0x1ba8e9['shift']());}}}(a32_0x222f,0xa9df2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a32_0x222f(){const _0x20d595=['5978736RQXgYc','file','Executing\x20query...','No\x20SQL\x20provided','verbose','77685eMBGvn','60TIRxaX','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','query','completedSplits','28485Ibbwoo','jobId','Executing\x20query\x20[','Error:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','87197ZOMKPF','validate','Run\x20Trino\x20queries\x20(streaming)','length','error','state','600MbiUSr','setJobId','452uhKziw','3500BGxosT','Statement\x20','Catalog:\x20','266dRhNWF','site','\x20rows\x20','push','information_schema','processedRows','setExtra','Site:\x20','totalSplits','options','name','output','29752eOkIhi','args','data','message','...','database','stats','join','2057345IIfSSi','3821tATyVl','description','execute','setPhase'];a32_0x222f=function(){return _0x20d595;};return a32_0x222f();}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{[a32_0x5dea78(0x182)]=a32_0x5dea78(0x199);[a32_0x5dea78(0x18e)]=a32_0x5dea78(0x1a2);async[a32_0x5dea78(0x18f)](_0x4e40c2){const _0x350c61=a32_0x5dea78,{options:_0x3aa9ab,args:_0x371268,tdx:_0x11c604}=_0x4e40c2,_0x540e01={..._0x3aa9ab,'limitStructuredFormats':!![]},_0x4bd42e=_0x371268[0x0],_0x5d227d=_0x3aa9ab[_0x350c61(0x192)];let _0x2dd15c;try{if(_0x5d227d)_0x2dd15c=readSqlStatementsFromFile(_0x5d227d);else{if(_0x4bd42e==='-')_0x2dd15c=await readSqlStatementsFromStdin();else{if(_0x4bd42e&&isSqlFilePath(_0x4bd42e))_0x2dd15c=readSqlStatementsFromFile(_0x4bd42e);else{if(_0x4bd42e)_0x2dd15c=splitSqlStatements(_0x4bd42e);else throw new Error(_0x350c61(0x194));}}}}catch(_0x5cc8c5){return console[_0x350c61(0x1a4)](_0x350c61(0x19e)+_0x5cc8c5[_0x350c61(0x187)]),0x1;}const _0x469926=_0x3aa9ab[_0x350c61(0x189)]||_0x350c61(0x17c),_0x1b0e07=_0x3aa9ab['catalog'];try{const _0x111e73=[],_0x4c3d2e=!!_0x3aa9ab[_0x350c61(0x183)];for(let _0x15ed2c=0x0;_0x15ed2c<_0x2dd15c[_0x350c61(0x1a3)];_0x15ed2c++){const _0x1ff8e9=_0x2dd15c[_0x15ed2c],_0x5ddd74=_0x15ed2c+0x1,_0x2a9c72=_0x2dd15c['length'],_0x8e453a=_0x2a9c72>0x1;_0x3aa9ab[_0x350c61(0x195)]&&(console[_0x350c61(0x1a4)]('\x0a'+(_0x8e453a?'Statement\x20'+_0x5ddd74+'/'+_0x2a9c72+':':'')),console['error'](_0x350c61(0x17f)+_0x3aa9ab[_0x350c61(0x179)]),console['error'](_0x350c61(0x177)+(_0x1b0e07||'td')),console[_0x350c61(0x1a4)]('Schema:\x20'+_0x469926),console[_0x350c61(0x1a4)]('SQL:\x20'+_0x1ff8e9));const _0x45ef6b=_0x8e453a?'Executing\x20statement\x20'+_0x5ddd74+'/'+_0x2a9c72+_0x350c61(0x188):_0x350c61(0x193);try{const _0x4c4a38=await withProgressSpinner(_0x45ef6b,async _0x34a523=>{const _0x31b85b=_0x350c61,_0x3d2ee8=await _0x11c604[_0x31b85b(0x199)][_0x31b85b(0x18f)](_0x1ff8e9,{'catalog':_0x1b0e07,'schema':_0x469926,'onJobId':_0x52c09a=>{const _0x1f51af=_0x31b85b;_0x34a523[_0x1f51af(0x173)](_0x52c09a);},'onProgress':_0x205fca=>{const _0x557080=_0x31b85b;_0x34a523[_0x557080(0x190)](_0x557080(0x19d)+_0x205fca[_0x557080(0x171)]+']'),_0x34a523[_0x557080(0x17e)](formatRows(_0x205fca[_0x557080(0x17d)])+_0x557080(0x17a)+_0x205fca[_0x557080(0x19a)]+'/'+_0x205fca[_0x557080(0x180)]+'\x20splits');}});return _0x3d2ee8;},{'verbose':_0x3aa9ab['verbose']}),_0x4ed6f4=_0x4c4a38[_0x350c61(0x186)],_0x5650f2=_0x4ed6f4[_0x350c61(0x19c)]?'\x20[Job\x20ID:\x20'+_0x4ed6f4[_0x350c61(0x19c)]+']':'',_0x54dfe0=_0x8e453a?_0x350c61(0x176)+_0x5ddd74+'/'+_0x2a9c72+'\x20-\x20':'';console[_0x350c61(0x1a4)]('✔\x20'+_0x54dfe0+'Query\x20completed:\x20Processed\x20'+formatRows(_0x4ed6f4['stats'][_0x350c61(0x17d)])+_0x350c61(0x17a)+('in\x20'+formatElapsed(_0x4ed6f4[_0x350c61(0x18a)]['elapsedTimeMillis'])+_0x5650f2));if(_0x8e453a&&_0x4c3d2e){const _0x543fd1=resolveOutputOptions(_0x540e01),_0x334f4a=await formatQueryOutput(_0x4ed6f4,_0x543fd1);_0x111e73[_0x350c61(0x17b)](_0x334f4a);}else await handleQueryOutput(_0x4ed6f4,_0x540e01);}catch(_0x522fd3){const _0x58ca70=_0x8e453a?'Statement\x20'+_0x5ddd74+'/'+_0x2a9c72+':\x0a':'',_0x1fc97b=_0x522fd3 instanceof SDKError?_0x522fd3['originalMessage']:_0x522fd3[_0x350c61(0x187)];return console[_0x350c61(0x1a4)](''+_0x58ca70+_0x1fc97b),0x1;}}if(_0x2dd15c[_0x350c61(0x1a3)]>0x1&&_0x4c3d2e&&_0x111e73[_0x350c61(0x1a3)]>0x0){const _0x3963ab=_0x111e73[_0x350c61(0x18b)]('\x0a');writeFileSync(_0x3aa9ab[_0x350c61(0x183)],_0x3963ab),console[_0x350c61(0x1a4)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x3aa9ab['output']);}return 0x0;}catch(_0x4ebe05){throw _0x4ebe05;}}[a32_0x5dea78(0x1a1)](_0x1e9242){const _0x503475=a32_0x5dea78,_0x321f82=_0x1e9242[_0x503475(0x185)][0x0],_0x25817b=_0x1e9242[_0x503475(0x181)][_0x503475(0x192)];if(!_0x321f82&&!_0x25817b)return _0x503475(0x19f);if(_0x321f82&&_0x25817b)return _0x503475(0x198);return undefined;}}