@treasuredata/tdx 0.16.2 → 0.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) 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/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.d.ts +3 -0
  25. package/dist/commands/mcp-command.d.ts.map +1 -1
  26. package/dist/commands/mcp-command.js +1 -1
  27. package/dist/commands/mcp-command.js.map +1 -1
  28. package/dist/commands/parent-segment-command.js +1 -1
  29. package/dist/commands/profile-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/segment-command.js +1 -1
  33. package/dist/commands/segment-create-command.js +1 -1
  34. package/dist/commands/segment-fields-command.js +1 -1
  35. package/dist/commands/segment-pull-command.js +1 -1
  36. package/dist/commands/segment-push-command.js +1 -1
  37. package/dist/commands/segment-update-command.js +1 -1
  38. package/dist/commands/segment-use-command.js +1 -1
  39. package/dist/commands/segment-validate-command.js +1 -1
  40. package/dist/commands/segments.js +1 -1
  41. package/dist/commands/show.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/unset-command.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/command-output.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/constants.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/core/version.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/mcp/server.js +1 -1
  62. package/dist/mcp/tools/index.js +1 -1
  63. package/dist/mcp/tools/tdx-run.js +1 -1
  64. package/dist/mcp/tools/tdx-search.js +1 -1
  65. package/dist/mcp/utils.js +1 -1
  66. package/dist/proxy/anthropic-adapter.js +1 -1
  67. package/dist/proxy/claude-usage-tracker.js +1 -1
  68. package/dist/proxy/context-signature.js +1 -1
  69. package/dist/proxy/conversation-utils.js +1 -1
  70. package/dist/proxy/passthrough-server.js +1 -1
  71. package/dist/proxy/server.js +1 -1
  72. package/dist/proxy/session-cache.js +1 -1
  73. package/dist/proxy/sse-usage-parser.js +1 -1
  74. package/dist/sdk/agent/agent-config.js +1 -1
  75. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  76. package/dist/sdk/agent/agent-yaml.js +1 -1
  77. package/dist/sdk/agent/test/evaluator.js +1 -1
  78. package/dist/sdk/agent/test/executor.js +1 -1
  79. package/dist/sdk/agent/test/index.js +1 -1
  80. package/dist/sdk/agent/test/output.js +1 -1
  81. package/dist/sdk/agent/test/parser.js +1 -1
  82. package/dist/sdk/api.js +1 -1
  83. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
  84. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  85. package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
  86. package/dist/sdk/claude-agent/environment.d.ts +9 -0
  87. package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
  88. package/dist/sdk/claude-agent/environment.js +1 -1
  89. package/dist/sdk/claude-agent/environment.js.map +1 -1
  90. package/dist/sdk/claude-agent/index.js +1 -1
  91. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  92. package/dist/sdk/client/cdp-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/rate-limiter.js +1 -1
  98. package/dist/sdk/client/td-api-client.js +1 -1
  99. package/dist/sdk/client/trino-api-client.js +1 -1
  100. package/dist/sdk/client/workflow-client.js +1 -1
  101. package/dist/sdk/connection-validator.js +1 -1
  102. package/dist/sdk/connection.js +1 -1
  103. package/dist/sdk/engage.js +1 -1
  104. package/dist/sdk/errors.js +1 -1
  105. package/dist/sdk/index.js +1 -1
  106. package/dist/sdk/io/index.js +1 -1
  107. package/dist/sdk/io/node-filesystem.js +1 -1
  108. package/dist/sdk/job.js +1 -1
  109. package/dist/sdk/journey.js +1 -1
  110. package/dist/sdk/llm/chat-cache.js +1 -1
  111. package/dist/sdk/llm/index.js +1 -1
  112. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  113. package/dist/sdk/llm/model-aliases.js +1 -1
  114. package/dist/sdk/llm/model-factors.js +1 -1
  115. package/dist/sdk/query/index.js +1 -1
  116. package/dist/sdk/query/sql-parser.js +1 -1
  117. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/fields-display.js +1 -1
  119. package/dist/sdk/segment/file-discovery.js +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-yaml.js +1 -1
  122. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  123. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  124. package/dist/sdk/segment/pull-workflow.js +1 -1
  125. package/dist/sdk/segment/push-workflow.js +1 -1
  126. package/dist/sdk/segment/resolution-context.js +1 -1
  127. package/dist/sdk/segment/segment-path-parser.js +1 -1
  128. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  129. package/dist/sdk/segment/target-resolution.js +1 -1
  130. package/dist/sdk/segment/tdx-config.js +1 -1
  131. package/dist/sdk/segment/validate-files.js +1 -1
  132. package/dist/sdk/segment/yaml-validator.js +1 -1
  133. package/dist/sdk/segment.js +1 -1
  134. package/dist/sdk/types/index.js +1 -1
  135. package/dist/sdk/types/progress.js +1 -1
  136. package/dist/sdk/user.js +1 -1
  137. package/dist/sdk/util/format-detector.js +1 -1
  138. package/dist/sdk/util/formatters.js +1 -1
  139. package/dist/sdk/util/index.js +1 -1
  140. package/dist/sdk/util/tree-formatter.js +1 -1
  141. package/dist/sdk/workflow/clone-workflow.js +1 -1
  142. package/dist/sdk/workflow/index.js +1 -1
  143. package/dist/sdk/workflow/pull-workflow.js +1 -1
  144. package/dist/sdk/workflow/push-workflow.js +1 -1
  145. package/dist/sdk/workflow/tdx-config.js +1 -1
  146. package/dist/sdk/workflow/workflow-utils.js +1 -1
  147. package/dist/utils/async.js +1 -1
  148. package/dist/utils/colors.js +1 -1
  149. package/dist/utils/diff.js +1 -1
  150. package/dist/utils/file-permissions.js +1 -1
  151. package/dist/utils/json-loader.js +1 -1
  152. package/dist/utils/option-validation.js +1 -1
  153. package/dist/utils/port.js +1 -1
  154. package/dist/utils/process.js +1 -1
  155. package/dist/utils/prompt.js +1 -1
  156. package/dist/utils/spinner.js +1 -1
  157. package/dist/utils/sse-parser.js +1 -1
  158. package/dist/utils/string-utils.js +1 -1
  159. package/dist/utils/table-ref-parser.js +1 -1
  160. package/dist/utils/tdx-logger.js +1 -1
  161. package/dist/utils/version-check.js +1 -1
  162. package/package.json +1 -1
@@ -1 +1 @@
1
- const a23_0x277f3c=a23_0x31ab;(function(_0x4fe195,_0x496ce4){const _0x101050=a23_0x31ab,_0x17277e=_0x4fe195();while(!![]){try{const _0x566d80=-parseInt(_0x101050(0x1fe))/0x1+parseInt(_0x101050(0x1ec))/0x2*(-parseInt(_0x101050(0x259))/0x3)+parseInt(_0x101050(0x24e))/0x4*(-parseInt(_0x101050(0x1d1))/0x5)+parseInt(_0x101050(0x2c5))/0x6+-parseInt(_0x101050(0x2e1))/0x7*(parseInt(_0x101050(0x201))/0x8)+parseInt(_0x101050(0x2b5))/0x9*(-parseInt(_0x101050(0x29e))/0xa)+parseInt(_0x101050(0x2f5))/0xb;if(_0x566d80===_0x496ce4)break;else _0x17277e['push'](_0x17277e['shift']());}catch(_0x125bad){_0x17277e['push'](_0x17277e['shift']());}}}(a23_0x1c37,0x4c7c8));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0x52e31e from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0x3b54b8 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x1c37(){const _0x11c654=['parent_segment','\x20\x20\x20\x20-\x20','Updating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','message','✔\x20No\x20changes\x20-\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','web','displaySampleData','database','yes','scheduleType','18qGoCIp','darwin','\x20Opening\x20','data','localeCompare','resolveParentId','\x20\x20No\x20sample\x20data\x20available','varchar','getParentFull','stop','\x0aNo\x20sample\x20data\x20available','Enriched:','/\x20directories\x20exist.','red','parentSegment','schemaValid','3243426NLkJju','runParent','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','displayAttributesStats','unref','enriched','createParent','\x20parent\x20segment\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Available\x20attributes:','Source:','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','apply','tdx\x20segment\x20parent\x20preview\x20','segment:parent:push','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','output','run','customerGroupFile','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','ignore','\x0aChanges\x20to\x20apply\x20to\x20\x27','customerGroup','segment:parent:validate','description','joinKey','119JFwqfy','name','\x0a⚠️\x20\x20Migrating:\x20','Fetching\x20current\x20configuration\x20for\x20\x27','preview','Customers:','To\x20view\x20sample\x20data:','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','List\x20available\x20fields\x20for\x20segmentation','Parent\x20segment:\x20','addBehaviorsFile','text','table','/\x20directory.\x0a','Preview:','string','errors','all','pushParentYaml','10556139sLdBYG','segment:parent:show','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','repeat','displayPreviewResults','totalEvents','\x20parent\x20segment','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','toFixed','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x0a✔\x20Workflow\x20started','workflowSessionId','\x0aUsage:\x20tdx\x20ps\x20preview\x20','sampleData','attribute','👥\x20','allValid','behavior','\x27\x20is\x20already\x20up\x20to\x20date','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','✔\x20Query\x20completed:\x20Processed\x20','map','2255vRiDHT','Listing\x20parent\x20segments\x20matching\x20\x27','\x27...','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','dim','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','segment','\x5c$&','log','verbose','`\x20to\x20download\x20the\x20configuration\x20first','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Join:','match','listFields','displayValidateResults','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20Configuration\x20is\x20valid','Executing\x20parent\x20segment\x20query...','Updating','cyan','Database:\x20','segment:parent:fields','customerPercent','start','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','29938SzLZQQ','Creating\x20parent\x20segment\x20\x27','\x20kill','displaySummary','FINISHED','session','Master\x20Table','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x20--behavior\x20\x22<name>\x22','✔\x20Created\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22<name>\x22','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','use','length','bold','\x0aNew\x20parent\x20segment\x20\x27','utf-8','\x20No\x20changes\x20-\x20','279201wtiPJN','Site:\x20','/app/workflows/','142744YSqDyj','Errors:','dirname','attributes','query','\x20rows\x20','displayMasterInfo','Error:','validateParentYaml','\x27\x20and\x20run\x20workflow?','Error:\x20--attribute\x20requires\x20a\x20name\x0a','displayBehaviorsStats','\x20tdx\x20wf\x20attempt\x20','columns','addAttributes','label','jobId','✔\x20Updated\x20parent\x20segment\x20\x27','Resolving\x20parent\x20segment\x20\x27','Table:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','\x20=\x20','Coverage:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20--interval\x20','Attributes','-1d','setJobId','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','execute','Updated','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','SQL\x20query:\x0a','Aborted.','\x20rows)','customersWithEvents','using\x20the\x20default\x20path:\x20','processedRows','win32','Analyzing\x20changes...','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Apply\x20changes\x20to\x20\x27','stats','json','sort','error','scheduleOption','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','Fetching\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Fetching\x20SQL\x20for\x20\x27','\x20--enriched','schemaError','\x20--attribute\x20\x22','No\x20parent\x20segments\x20found','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Audience\x20ID:','coveragePercent','/\x20→\x20','displayPreviewHints','\x0a⚠️\x20\x20Both\x20','segment:parent:desc','Creating','Master\x20+\x20Attributes','✔\x20Renamed\x20directory\x20to\x20','\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\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','behaviorsFile','listParents','behaviors','Columns:','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Error\x20reading\x20file:\x20','pullParentYaml','Listing\x20parent\x20segments...','1732CsSbjA','%)\x20','Validating\x20configuration...','Error:\x20Parent\x20segment\x20name\x20is\x20required','Events:','\x27\x20with\x20ID:\x20','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','.yml','To\x20cancel:','xdg-open','audienceId','45mzCsvS','\x20--behavior\x20\x22','\x20[Job\x20ID:\x20','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','isDirectory','yellow','Found\x20YAML\x20file:\x20','status','Show\x20parent\x20segment\x20details','platform','foreignKey','green','attributesFile','segment:parent:sql','keys','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x27\x20is\x20up\x20to\x20date','jsonl','test','/app/dw/parentSegments/','Master:','workflowAttemptId','Fetching\x20sample\x20data...','segment:parent:preview','Get\x20SQL\x20query\x20for\x20parent\x20segment','List\x20parent\x20segments','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','timezone','\x0aChanges\x20to\x20\x27','updateParent','segment:parent:list','site','number','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','SELECT\x20*\x20FROM\x20(\x0a','segment:parent:view','/sessions/','format','Error\x20parsing\x20YAML:\x20','elapsedTimeMillis','YAML\x20file:\x20','Listing\x20fields\x20for\x20\x27','in\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Options:\x0a','Error:\x20File\x20not\x20found:\x20','matchedCount','Attribute:','Pattern:\x20','displayColumns','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','/attempt/','segment:parent:pull','\x20field','addBehaviors','Error:\x20--database\x20and\x20--table\x20are\x20required','\x20is\x20already\x20up\x20to\x20date','rowCount','Status:','endsWith','Behaviors','filter','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Rows:','Validate:','Join\x20on:','population','replace','column','922910hGnNxR','getParentSQL','segment:parent:create','Show\x20parent\x20segment\x20schema\x20(column\x20types)','interval','join','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','master','segment:parent:update','Error:\x20--behavior\x20requires\x20a\x20name\x0a','open'];a23_0x1c37=function(){return _0x11c654;};return a23_0x1c37();}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a23_0x277f3c(0x2a9);function openBrowser(_0x414ff3){const _0x1309d9=a23_0x277f3c,_0xba7e14=process[_0x1309d9(0x262)],_0x43da76=_0xba7e14===_0x1309d9(0x2b6)?_0x1309d9(0x2a8):_0xba7e14===_0x1309d9(0x228)?_0x1309d9(0x1ea):_0x1309d9(0x257);spawn(_0x43da76,[_0x414ff3],{'detached':!![],'stdio':_0x1309d9(0x2db)})[_0x1309d9(0x2ca)]();}function migrateLegacyDirectory(){const _0x478c58=a23_0x277f3c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x58b68e=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x58b68e[_0x478c58(0x25d)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x25e)](_0x478c58(0x23e)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x478c58(0x2c1))),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x1d6)](_0x478c58(0x254)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x2ef))),![];console['error'](a23_0x3b54b8['yellow'](_0x478c58(0x2e3)+LEGACY_PARENT_SEGMENT_DIR+_0x478c58(0x23c)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x264)](_0x478c58(0x242)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x640844){const _0x2dcb85=_0x640844 instanceof Error?_0x640844[_0x478c58(0x2ad)]:String(_0x640844);return console[_0x478c58(0x22f)](a23_0x3b54b8[_0x478c58(0x2c2)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x2dcb85+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0x5981f8){const _0x4a63d4=a23_0x277f3c;return migrateLegacyDirectory(),super[_0x4a63d4(0x2d8)](_0x5981f8);}}function resolveYamlFile(_0x289d82){const _0x3334d7=a23_0x277f3c;if(_0x289d82[_0x3334d7(0x294)](_0x3334d7(0x255))||_0x289d82[_0x3334d7(0x294)]('.yaml'))return _0x289d82;return a23_0x52e31e[_0x3334d7(0x2a3)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x289d82)+_0x3334d7(0x255));}function formatProgressMessage(_0x27f356){const _0x132f8d=a23_0x277f3c,_0x37488c=_0x27f356[_0x132f8d(0x1df)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x37488c){const [,_0x4b7772,_0x577082,_0x36bb16='']=_0x37488c;return a23_0x3b54b8['dim'](_0x4b7772+':')+'\x20'+_0x577082+a23_0x3b54b8['dim'](_0x36bb16);}return a23_0x3b54b8[_0x132f8d(0x1d6)](_0x27f356);}function showFileNotFoundError(_0x2481e9,_0x1c908b){const _0x59aeea=a23_0x277f3c;console[_0x59aeea(0x22f)](a23_0x3b54b8['red'](_0x59aeea(0x286)+_0x2481e9+'\x0a')),console[_0x59aeea(0x22f)](a23_0x3b54b8[_0x59aeea(0x1e6)](_0x59aeea(0x221)+_0x1c908b+_0x59aeea(0x1dc)));}function showParentSegmentNotSetError(_0x10ac32){const _0x2a0080=a23_0x277f3c;console[_0x2a0080(0x22f)](a23_0x3b54b8['yellow'](_0x2a0080(0x219))),console[_0x2a0080(0x22f)](_0x10ac32);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x277);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x272);async[a23_0x277f3c(0x21f)](_0x1d4640){const _0xd62cf6=a23_0x277f3c,{options:_0x224229,args:_0x322358,tdx:_0xa65b7c}=_0x1d4640,_0x22d475=_0x322358[0x0];_0x224229[_0xd62cf6(0x1db)]&&(console[_0xd62cf6(0x22f)](_0xd62cf6(0x1ff)+_0x224229[_0xd62cf6(0x278)]),_0x22d475&&console[_0xd62cf6(0x22f)](_0xd62cf6(0x289)+_0x22d475));const _0x3e226f=await withSpinner(_0x22d475?_0xd62cf6(0x1d2)+_0x22d475+_0xd62cf6(0x1d3):_0xd62cf6(0x24d),()=>_0xa65b7c[_0xd62cf6(0x1d8)][_0xd62cf6(0x246)](),{'verbose':_0x224229[_0xd62cf6(0x1db)]});let _0x368362=_0x3e226f['data'];if(_0x22d475){const _0x4f31f5=_0x22d475[_0xd62cf6(0x29c)](/[.+^${}()|[\]\\]/g,_0xd62cf6(0x1d9))['replace'](/\*/g,'.*')[_0xd62cf6(0x29c)](/\?/g,'.'),_0x825b39=new RegExp('^'+_0x4f31f5+'$','i');_0x368362=_0x368362[_0xd62cf6(0x296)](_0x332084=>_0x825b39[_0xd62cf6(0x26b)](_0x332084['attributes'][_0xd62cf6(0x2e2)]));}_0x368362[_0xd62cf6(0x22e)]((_0x4938f2,_0x2bf406)=>_0x4938f2[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)][_0xd62cf6(0x2b9)](_0x2bf406[_0xd62cf6(0x204)][_0xd62cf6(0x2e2)])),console[_0xd62cf6(0x22f)]('✔\x20Found\x20'+_0x368362[_0xd62cf6(0x1f9)]+_0xd62cf6(0x2fc)+(_0x368362['length']!==0x1?'s':''));const _0x57927d=_0x203f16=>{const _0x3f0a95=_0xd62cf6;return getConsoleNextUrl(_0x224229[_0x3f0a95(0x278)],'/app/dw/parentSegments/'+_0x203f16);};if(_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x22d)||_0x224229[_0xd62cf6(0x27e)]===_0xd62cf6(0x26a)){const _0x335c45=_0x368362[_0xd62cf6(0x1d0)](_0x37fd9c=>({..._0x37fd9c,'url':_0x57927d(_0x37fd9c['id'])}));await handleSDKOutput(_0x335c45,_0x224229);}else{if(_0x368362[_0xd62cf6(0x1f9)]===0x0)_0x22d475?console[_0xd62cf6(0x1da)](_0xd62cf6(0x284)+_0x22d475):console[_0xd62cf6(0x1da)](_0xd62cf6(0x238));else for(const _0x5a13ed of _0x368362){const _0x282f37=_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)]?a23_0x3b54b8[_0xd62cf6(0x1d6)]('\x20('+formatRows(_0x5a13ed[_0xd62cf6(0x204)][_0xd62cf6(0x29b)])+')'):'',_0x42a743=hyperlink(_0x5a13ed['attributes']['name'],_0x57927d(_0x5a13ed['id']));console[_0xd62cf6(0x1da)](_0xd62cf6(0x305)+_0x42a743+_0x282f37);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a23_0x277f3c(0x2a0);['description']=a23_0x277f3c(0x27a);async[a23_0x277f3c(0x21f)](_0x27f2b0){const _0x1e9f26=a23_0x277f3c,{options:_0x1e77bb,args:_0x42c79d,tdx:_0x37ac33}=_0x27f2b0;console[_0x1e9f26(0x22f)](_0x1e9f26(0x2f8)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x18b4c7=_0x1e77bb;if(_0x42c79d[_0x1e9f26(0x1f9)]===0x0)return console['error'](a23_0x3b54b8[_0x1e9f26(0x2c2)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x1e9f26(0x22f)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0x2825c1=_0x42c79d[0x0];if(!_0x18b4c7['database']||!_0x18b4c7[_0x1e9f26(0x2ee)])return console[_0x1e9f26(0x22f)](_0x1e9f26(0x290)),console[_0x1e9f26(0x22f)](_0x1e9f26(0x2e9)),0x1;_0x18b4c7['verbose']&&(console[_0x1e9f26(0x22f)]('Site:\x20'+_0x18b4c7[_0x1e9f26(0x278)]),console['error']('Name:\x20'+_0x2825c1),console['error'](_0x1e9f26(0x1e7)+_0x18b4c7[_0x1e9f26(0x2b2)]),console[_0x1e9f26(0x22f)](_0x1e9f26(0x214)+_0x18b4c7[_0x1e9f26(0x2ee)]));const _0x34a25a=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x204)],_0x18b4c7[_0x1e9f26(0x265)]),_0x15ecdf=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x247)],_0x18b4c7[_0x1e9f26(0x245)]),_0x3f39ae=await loadJSONFromOptions(_0x18b4c7[_0x1e9f26(0x2dd)],_0x18b4c7[_0x1e9f26(0x2d9)]),_0xd70850={'name':_0x2825c1,'description':_0x18b4c7[_0x1e9f26(0x2df)],'scheduleType':_0x18b4c7[_0x1e9f26(0x2b4)],'scheduleOption':_0x18b4c7[_0x1e9f26(0x230)],'timezone':_0x18b4c7[_0x1e9f26(0x274)],'master':{'parentDatabaseName':_0x18b4c7[_0x1e9f26(0x2b2)],'parentTableName':_0x18b4c7[_0x1e9f26(0x2ee)]},'attributes':_0x34a25a,'behaviors':_0x15ecdf,'customerGroup':_0x3f39ae},_0x3b69eb=await withSpinner(_0x1e9f26(0x1ed)+_0x2825c1+_0x1e9f26(0x1d3),()=>_0x37ac33['segment'][_0x1e9f26(0x2cc)](_0xd70850),{'verbose':_0x1e77bb[_0x1e9f26(0x1db)]}),_0x1615c8=_0x3b69eb[_0x1e9f26(0x2b8)];return console[_0x1e9f26(0x22f)](_0x1e9f26(0x1f5)+_0x1615c8[_0x1e9f26(0x2e2)]+_0x1e9f26(0x253)+_0x1615c8['id']),await handleSDKOutput([_0x1615c8],_0x1e77bb),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2a6);[a23_0x277f3c(0x2df)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x2a0716){const _0x21546e=a23_0x277f3c,{options:_0x3e9548,args:_0x14c809,tdx:_0x10d13c}=_0x2a0716;console[_0x21546e(0x22f)](_0x21546e(0x22a)+_0x21546e(0x1d7)+_0x21546e(0x28b));const _0x325916=_0x3e9548;if(_0x14c809[_0x21546e(0x1f9)]===0x0)return console[_0x21546e(0x22f)](a23_0x3b54b8[_0x21546e(0x2c2)](_0x21546e(0x251))),console['error'](_0x21546e(0x2fd)),0x1;const _0x39b2fc=_0x14c809[0x0];_0x325916['verbose']&&(console[_0x21546e(0x22f)](_0x21546e(0x1ff)+_0x325916[_0x21546e(0x278)]),console[_0x21546e(0x22f)](_0x21546e(0x2eb)+_0x39b2fc));const _0x52ddea=await withSpinner(_0x21546e(0x2e4)+_0x39b2fc+'\x27...',()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x2bd)](_0x39b2fc),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x5bbc25=_0x52ddea['data'],_0x313f86=await loadJSONFromOptions(_0x325916[_0x21546e(0x20f)],_0x325916['addAttributesFile']),_0x59d36c=await loadJSONFromOptions(_0x325916[_0x21546e(0x28f)],_0x325916[_0x21546e(0x2ec)]),_0x129343={'name':_0x5bbc25['name'],'description':_0x325916[_0x21546e(0x2df)]!==undefined?_0x325916[_0x21546e(0x2df)]:_0x5bbc25[_0x21546e(0x2df)],'scheduleType':_0x325916['scheduleType']!==undefined?_0x325916[_0x21546e(0x2b4)]:_0x5bbc25[_0x21546e(0x2b4)],'scheduleOption':_0x325916['scheduleOption']!==undefined?_0x325916[_0x21546e(0x230)]:_0x5bbc25[_0x21546e(0x230)],'timezone':_0x325916['timezone']!==undefined?_0x325916['timezone']:_0x5bbc25[_0x21546e(0x274)],'master':_0x5bbc25['master'],'attributes':_0x313f86?[..._0x5bbc25[_0x21546e(0x204)]||[],..._0x313f86]:_0x5bbc25[_0x21546e(0x204)],'behaviors':_0x59d36c?[..._0x5bbc25[_0x21546e(0x247)]||[],..._0x59d36c]:_0x5bbc25[_0x21546e(0x247)],'customerGroup':_0x5bbc25['customerGroup']},_0x89bdf6=await withSpinner(_0x21546e(0x2ab)+_0x39b2fc+_0x21546e(0x1d3),()=>_0x10d13c[_0x21546e(0x1d8)][_0x21546e(0x276)](_0x39b2fc,_0x129343),{'verbose':_0x325916[_0x21546e(0x1db)]}),_0x26effa=_0x89bdf6[_0x21546e(0x2b8)];return console[_0x21546e(0x22f)](_0x21546e(0x212)+_0x26effa['name']+'\x27'),await handleSDKOutput([_0x26effa],_0x325916),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x28d);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a23_0x277f3c(0x21f)](_0x50d7ce){const _0x3fd43c=a23_0x277f3c,{options:_0x18bdaa,args:_0x358510,tdx:_0x5bcacf}=_0x50d7ce,_0x1a9d38=_0x18bdaa,_0x12ae17=_0x358510[0x0]||_0x18bdaa['parentSegment'];if(!_0x12ae17)return showParentSegmentNotSetError(_0x3fd43c(0x297)+_0x3fd43c(0x2ce)),0x1;if(_0x1a9d38[_0x3fd43c(0x1f8)]&&_0x1a9d38[_0x3fd43c(0x2d7)])return console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x2c2)](_0x3fd43c(0x2d5))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x1d4))),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x226)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x3fd43c(0x21e))),0x1;const _0x2fd56b=_0x1a9d38['output']||a23_0x52e31e['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x12ae17)+_0x3fd43c(0x255));_0x1a9d38[_0x3fd43c(0x1db)]&&(console['error'](_0x3fd43c(0x1ff)+_0x1a9d38[_0x3fd43c(0x278)]),console['error'](_0x3fd43c(0x2eb)+_0x12ae17),console[_0x3fd43c(0x22f)]('Output\x20file:\x20'+_0x2fd56b));const _0x284b66=await withSpinner(_0x3fd43c(0x232)+_0x12ae17+'\x27...',()=>_0x5bcacf['segment'][_0x3fd43c(0x24c)](_0x12ae17),{'verbose':_0x1a9d38[_0x3fd43c(0x1db)]}),_0x13fc2d=_0x284b66['data'];if(existsSync(_0x2fd56b)){const _0x5606a0=readFileSync(_0x2fd56b,_0x3fd43c(0x1fc)),_0x586a63=generateDiff(_0x5606a0,_0x13fc2d);if(!hasChanges(_0x586a63))console[_0x3fd43c(0x22f)](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x1fd)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b)+_0x3fd43c(0x291));else{console[_0x3fd43c(0x22f)](_0x3fd43c(0x275)+_0x2fd56b+'\x27:'),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c)),console[_0x3fd43c(0x22f)](formatDiffWithColors(_0x586a63)),console[_0x3fd43c(0x22f)]('─'[_0x3fd43c(0x2f9)](0x3c));if(!_0x1a9d38['yes']){const _0x49f496=await confirmKey('Overwrite\x20\x27'+_0x2fd56b+'\x27?');if(!_0x49f496)return console['error'](_0x3fd43c(0x223)),0x1;}writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8['green']('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}}else{const _0x4d528e=a23_0x52e31e[_0x3fd43c(0x203)](_0x2fd56b);!existsSync(_0x4d528e)&&mkdirSync(_0x4d528e,{'recursive':!![]}),writeFileSync(_0x2fd56b,_0x13fc2d,_0x3fd43c(0x1fc)),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+_0x3fd43c(0x2a4)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x2fd56b));}return saveSessionContext({'parent_segment':_0x12ae17},_0x1a9d38[_0x3fd43c(0x1f1)]),console['error'](a23_0x3b54b8[_0x3fd43c(0x264)]('✔')+'\x20Context\x20set:\x20'+a23_0x3b54b8[_0x3fd43c(0x1d6)](_0x3fd43c(0x2a9))+_0x3fd43c(0x217)+a23_0x3b54b8[_0x3fd43c(0x1e6)](_0x12ae17)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x2d4);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1d5);async[a23_0x277f3c(0x21f)](_0x4a9cff){const _0x200437=a23_0x277f3c,{options:_0x4e4636,args:_0x366f24,tdx:_0x4a2ac2}=_0x4a9cff,_0x2b1fdd=_0x4e4636,_0x25a964=_0x366f24[0x0]||_0x4e4636[_0x200437(0x2c3)];if(!_0x25a964)return showParentSegmentNotSetError(_0x200437(0x2f7)+_0x200437(0x243)),0x1;const _0x4cc23c=resolveYamlFile(_0x25a964);if(!existsSync(_0x4cc23c))return showFileNotFoundError(_0x4cc23c,_0x25a964),0x1;_0x2b1fdd[_0x200437(0x1db)]&&(console[_0x200437(0x22f)]('Site:\x20'+_0x2b1fdd['site']),console[_0x200437(0x22f)](_0x200437(0x281)+_0x4cc23c));let _0x230e43;try{_0x230e43=readFileSync(_0x4cc23c,'utf-8');}catch(_0x19667c){const _0x3c6840=_0x19667c instanceof Error?_0x19667c[_0x200437(0x2ad)]:String(_0x19667c);return console[_0x200437(0x22f)]('Error\x20reading\x20file:\x20'+_0x3c6840),0x1;}const _0x4b9080=await withSpinner(_0x200437(0x229),()=>_0x4a2ac2[_0x200437(0x1d8)]['pushParentYaml'](_0x230e43),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0xddb794=_0x4b9080['data'],{isNew:_0x23a8eb,name:_0x5b5818,hasChanges:_0x579c74,diffFormatted:_0x4a2261}=_0xddb794;if(!_0x579c74)return console[_0x200437(0x22f)]('✔\x20No\x20changes\x20-\x20\x27'+_0x5b5818+_0x200437(0x308)),0x0;_0x23a8eb?console[_0x200437(0x22f)](_0x200437(0x1fb)+_0x5b5818+'\x27:'):console[_0x200437(0x22f)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x5b5818+'\x27:');console[_0x200437(0x22f)]('─'[_0x200437(0x2f9)](0x3c)),console[_0x200437(0x22f)](_0x4a2261),console['error']('─'[_0x200437(0x2f9)](0x3c));const _0x37c4c9=_0x23a8eb?'Create\x20parent\x20segment\x20\x27'+_0x5b5818+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x5b5818+'\x27?';if(!_0x2b1fdd[_0x200437(0x2b3)]){const _0x1ff5f6=await confirmKey(_0x37c4c9);if(!_0x1ff5f6)return console['error'](_0x200437(0x223)),0x1;}const _0x27d873=_0x23a8eb?'Creating':_0x200437(0x1e5),_0x5dd550=await withSpinner(_0x27d873+_0x200437(0x2cd)+_0x5b5818+_0x200437(0x1d3),()=>_0xddb794[_0x200437(0x2d2)](),{'verbose':_0x2b1fdd[_0x200437(0x1db)]}),_0x4283a6=_0x5dd550['data'],_0x349836=getConsoleNextUrl(_0x2b1fdd[_0x200437(0x278)],_0x200437(0x26c)+_0x4283a6['id']),_0x36fbd0=_0x23a8eb?'Created':_0x200437(0x220);return console[_0x200437(0x22f)]('✔\x20'+_0x36fbd0+'\x20parent\x20segment\x20\x27'+_0x4283a6[_0x200437(0x2e2)]+'\x27'),console[_0x200437(0x22f)]('\x20\x20'+_0x349836),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2de);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x233);async[a23_0x277f3c(0x21f)](_0x2ebe0a){const _0x1c402e=a23_0x277f3c,{options:_0x187c28,args:_0x21ad54,tdx:_0xc96090}=_0x2ebe0a,_0x1f3687=_0x187c28,_0xe076f9=_0x21ad54[0x0]||_0x187c28['parentSegment'];if(!_0xe076f9)return showParentSegmentNotSetError(_0x1c402e(0x2af)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x1c402e(0x2da)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1fbef2=resolveYamlFile(_0xe076f9);if(!existsSync(_0x1fbef2))return showFileNotFoundError(_0x1fbef2,_0xe076f9),0x1;_0x1f3687[_0x1c402e(0x1db)]&&(console[_0x1c402e(0x22f)](_0x1c402e(0x1ff)+_0x1f3687[_0x1c402e(0x278)]),console[_0x1c402e(0x22f)](_0x1c402e(0x281)+_0x1fbef2));let _0xf13f0b;try{_0xf13f0b=readFileSync(_0x1fbef2,'utf-8');}catch(_0x4cbc49){const _0x26816b=_0x4cbc49 instanceof Error?_0x4cbc49[_0x1c402e(0x2ad)]:String(_0x4cbc49);return console[_0x1c402e(0x22f)]('Error\x20reading\x20file:\x20'+_0x26816b),0x1;}const _0xc3651c=createCommandSpinner(a23_0x3b54b8[_0x1c402e(0x1d6)](_0x1c402e(0x250)),{'verbose':_0x1f3687[_0x1c402e(0x1db)]});_0xc3651c[_0x1c402e(0x1ea)]();const _0x33dcf8={'onProgress':_0x2f5369=>{const _0x5e09e9=_0x1c402e;_0xc3651c[_0x5e09e9(0x2ed)]=formatProgressMessage(_0x2f5369);}};if(_0x1f3687[_0x1c402e(0x2a5)])_0x33dcf8[_0x1c402e(0x2a5)]=!![];if(_0x1f3687['enriched'])_0x33dcf8[_0x1c402e(0x2cb)]=!![];_0x1f3687[_0x1c402e(0x304)]&&(_0x33dcf8[_0x1c402e(0x304)]=_0x1f3687[_0x1c402e(0x304)]);_0x1f3687['behavior']&&(_0x33dcf8[_0x1c402e(0x307)]=_0x1f3687[_0x1c402e(0x307)]);if(_0x1f3687[_0x1c402e(0x2a2)])_0x33dcf8[_0x1c402e(0x2a2)]=_0x1f3687[_0x1c402e(0x2a2)];let _0x28dc86;try{_0x28dc86=await _0xc96090['segment'][_0x1c402e(0x209)](_0xf13f0b,_0x33dcf8),_0xc3651c['stop']();}catch(_0x5f01e0){_0xc3651c['stop']();throw _0x5f01e0;}const _0x47c733=_0x1f3687[_0x1c402e(0x2a2)]||_0x1c402e(0x21c);return this[_0x1c402e(0x1e1)](_0x28dc86,_0x33dcf8,_0x1fbef2,_0x47c733),_0x28dc86[_0x1c402e(0x306)]?0x0:0x1;}[a23_0x277f3c(0x1e1)](_0x264efe,_0x3fc4d1,_0x37e1d4,_0x702b80){const _0x2e7c13=a23_0x277f3c;console[_0x2e7c13(0x22f)]('\x0a'+a23_0x3b54b8[_0x2e7c13(0x1fa)](_0x2e7c13(0x299))+'\x20'+_0x264efe[_0x2e7c13(0x2e2)]),console['error']('═'[_0x2e7c13(0x2f9)](0x3c)),this[_0x2e7c13(0x207)](_0x264efe);if(typeof _0x3fc4d1[_0x2e7c13(0x304)]==='string'){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this['displayPreviewHints'](_0x37e1d4,_0x702b80,'attribute',_0x3fc4d1[_0x2e7c13(0x304)]);return;}if(_0x3fc4d1[_0x2e7c13(0x304)]===!![]){this[_0x2e7c13(0x2c9)](_0x264efe),this['displaySummary'](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'attributes');return;}if(typeof _0x3fc4d1[_0x2e7c13(0x307)]===_0x2e7c13(0x2f1)){this['displayBehaviorsStats'](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,'behavior',_0x3fc4d1[_0x2e7c13(0x307)]);return;}if(_0x3fc4d1['behavior']===!![]){this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x247));return;}this[_0x2e7c13(0x2c9)](_0x264efe),this[_0x2e7c13(0x20c)](_0x264efe,_0x702b80),this[_0x2e7c13(0x1ef)](_0x264efe),this[_0x2e7c13(0x23d)](_0x37e1d4,_0x702b80,_0x2e7c13(0x2f3));}[a23_0x277f3c(0x23d)](_0x43bdb8,_0x3934c4,_0x15ea74,_0x475367){const _0x285412=a23_0x277f3c;console[_0x285412(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x285412(0x2e7)));const _0x28bc99=_0x3934c4!==_0x285412(0x21c)?_0x285412(0x21a)+_0x3934c4:'';if(_0x15ea74===_0x285412(0x304)&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x237)+_0x475367+'\x22'+_0x28bc99));else{if(_0x15ea74==='behavior'&&_0x475367)console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x25a)+_0x475367+'\x22'+_0x28bc99));else(_0x15ea74===_0x285412(0x204)||_0x15ea74===_0x285412(0x2f3))&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x1f6)+_0x28bc99));}(_0x15ea74==='behaviors'||_0x15ea74==='all')&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)]('tdx\x20segment\x20parent\x20preview\x20'+_0x43bdb8+_0x285412(0x1f4)+_0x28bc99)),_0x15ea74===_0x285412(0x2f3)&&console[_0x285412(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x285412(0x1d6)](_0x285412(0x2d3)+_0x43bdb8+_0x285412(0x235)+_0x28bc99));}[a23_0x277f3c(0x207)](_0x38a838){const _0xeca59c=a23_0x277f3c,{master:_0x371a11}=_0x38a838,_0x3ee99b=_0x371a11[_0xeca59c(0x2c4)]?a23_0x3b54b8[_0xeca59c(0x264)]('✔'):a23_0x3b54b8[_0xeca59c(0x2c2)]('✘');console[_0xeca59c(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0xeca59c(0x1f2))),console[_0xeca59c(0x22f)](_0x3ee99b+'\x20'+a23_0x3b54b8['bold'](_0x371a11['database']+'.'+_0x371a11[_0xeca59c(0x2ee)])),_0x371a11[_0xeca59c(0x2c4)]?_0x371a11['rowCount']!==undefined&&console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8[_0xeca59c(0x1d6)](_0xeca59c(0x298))+'\x20'+a23_0x3b54b8['cyan'](formatRows(_0x371a11[_0xeca59c(0x292)]))):console[_0xeca59c(0x22f)]('\x20\x20'+a23_0x3b54b8['red']('Error:')+'\x20'+_0x371a11['schemaError']);}[a23_0x277f3c(0x2c9)](_0x48e6c1){const _0x1e5927=a23_0x277f3c;if(_0x48e6c1[_0x1e5927(0x204)][_0x1e5927(0x1f9)]===0x0)return;console[_0x1e5927(0x22f)]('\x0a'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x21b)));for(const _0x1bed6e of _0x48e6c1['attributes']){const _0x3ef676=_0x1bed6e['schemaValid']?a23_0x3b54b8[_0x1e5927(0x264)]('✔'):a23_0x3b54b8[_0x1e5927(0x2c2)]('✘');let _0x575b1a='';if(_0x1bed6e[_0x1e5927(0x2c4)]&&_0x1bed6e[_0x1e5927(0x287)]!==undefined&&_0x1bed6e[_0x1e5927(0x23b)]!==undefined){const _0x200ab9=_0x1bed6e[_0x1e5927(0x23b)]['toFixed'](0x1),_0x9a359b=_0x1bed6e['coveragePercent']>=0x50?a23_0x3b54b8[_0x1e5927(0x264)]:_0x1bed6e[_0x1e5927(0x23b)]>=0x32?a23_0x3b54b8[_0x1e5927(0x25e)]:a23_0x3b54b8[_0x1e5927(0x2c2)];_0x575b1a='\x20'+a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x218))+'\x20'+_0x9a359b(_0x200ab9+'%')+'\x20('+formatRows(_0x1bed6e['matchedCount'])+_0x1e5927(0x224);}console[_0x1e5927(0x22f)](_0x3ef676+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e['name'])+_0x575b1a),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x2d0))+'\x20'+a23_0x3b54b8[_0x1e5927(0x1fa)](_0x1bed6e[_0x1e5927(0x2b2)]+'.'+_0x1bed6e[_0x1e5927(0x2ee)]));const _0x2ed294=_0x1bed6e[_0x1e5927(0x2e0)]===_0x1bed6e[_0x1e5927(0x263)]?a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x29a))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]:a23_0x3b54b8[_0x1e5927(0x1d6)](_0x1e5927(0x1de))+'\x20'+_0x1bed6e[_0x1e5927(0x2e0)]+_0x1e5927(0x217)+_0x1bed6e[_0x1e5927(0x263)];console['error']('\x20\x20'+_0x2ed294),console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x1e5927(0x248))),this[_0x1e5927(0x28a)](_0x1bed6e['columns']),!_0x1bed6e[_0x1e5927(0x2c4)]&&console[_0x1e5927(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x1e5927(0x2c2)]('Error:')+'\x20'+_0x1bed6e[_0x1e5927(0x236)]);}}[a23_0x277f3c(0x20c)](_0x425190,_0x1c0406){const _0x5d38e8=a23_0x277f3c;if(_0x425190[_0x5d38e8(0x247)][_0x5d38e8(0x1f9)]===0x0)return;console[_0x5d38e8(0x22f)]('\x0a'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x295))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)]('('+_0x1c0406+')'));for(const _0x2d9791 of _0x425190[_0x5d38e8(0x247)]){const _0xb3007b=_0x2d9791[_0x5d38e8(0x2c4)]?a23_0x3b54b8[_0x5d38e8(0x264)]('✔'):a23_0x3b54b8[_0x5d38e8(0x2c2)]('✘');let _0x5b3ad7='';if(_0x2d9791[_0x5d38e8(0x2c4)]&&_0x2d9791[_0x5d38e8(0x225)]!==undefined&&_0x2d9791[_0x5d38e8(0x2fb)]!==undefined){const _0x2c2071=_0x2d9791['customerPercent']?.[_0x5d38e8(0x2fe)](0x1)||'?',_0x181639=(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x32?a23_0x3b54b8['green']:(_0x2d9791[_0x5d38e8(0x1e9)]??0x0)>=0x14?a23_0x3b54b8[_0x5d38e8(0x25e)]:a23_0x3b54b8['red'];_0x5b3ad7='\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2e6))+'\x20'+_0x181639(formatRows(_0x2d9791[_0x5d38e8(0x225)]))+'\x20('+_0x2c2071+_0x5d38e8(0x24f)+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x252))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1e6)](formatRows(_0x2d9791[_0x5d38e8(0x2fb)]));}console[_0x5d38e8(0x22f)](_0xb3007b+'\x20'+a23_0x3b54b8['bold'](_0x2d9791[_0x5d38e8(0x2e2)])+_0x5b3ad7),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x2d0))+'\x20'+a23_0x3b54b8[_0x5d38e8(0x1fa)](_0x2d9791['database']+'.'+_0x2d9791[_0x5d38e8(0x2ee)]));const _0x522c66=_0x2d9791[_0x5d38e8(0x2e0)]===_0x2d9791['foreignKey']?a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x29a))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]:a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x1de))+'\x20'+_0x2d9791[_0x5d38e8(0x2e0)]+_0x5d38e8(0x217)+_0x2d9791[_0x5d38e8(0x263)];console[_0x5d38e8(0x22f)]('\x20\x20'+_0x522c66),console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x5d38e8(0x1d6)](_0x5d38e8(0x248))),this[_0x5d38e8(0x28a)](_0x2d9791[_0x5d38e8(0x20e)]),!_0x2d9791[_0x5d38e8(0x2c4)]&&console[_0x5d38e8(0x22f)]('\x20\x20'+a23_0x3b54b8['red'](_0x5d38e8(0x208))+'\x20'+_0x2d9791[_0x5d38e8(0x236)]);}}[a23_0x277f3c(0x28a)](_0x4c8728){const _0xe8889a=a23_0x277f3c;for(const _0x4971be of _0x4c8728){_0x4971be[_0xe8889a(0x210)]===_0x4971be[_0xe8889a(0x29d)]||_0x4971be['column']==='*'?console[_0xe8889a(0x22f)]('\x20\x20\x20\x20-\x20'+_0x4971be[_0xe8889a(0x210)]):console[_0xe8889a(0x22f)](_0xe8889a(0x2aa)+_0x4971be[_0xe8889a(0x210)]+'\x20'+a23_0x3b54b8[_0xe8889a(0x1d6)]('('+_0x4971be[_0xe8889a(0x29d)]+')'));}}[a23_0x277f3c(0x1ef)](_0x1905c7){const _0x3742f4=a23_0x277f3c;console[_0x3742f4(0x22f)]('─'[_0x3742f4(0x2f9)](0x3c));if(_0x1905c7[_0x3742f4(0x2f2)]['length']>0x0){console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x2c2)](_0x3742f4(0x202)));for(const _0x334761 of _0x1905c7[_0x3742f4(0x2f2)]){console[_0x3742f4(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x3742f4(0x2c2)]('•')+'\x20'+_0x334761);}}_0x1905c7['allValid']&&console[_0x3742f4(0x22f)]('\x0a'+a23_0x3b54b8[_0x3742f4(0x264)]('✔')+_0x3742f4(0x1e3));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{['name']=a23_0x277f3c(0x270);['description']=a23_0x277f3c(0x2c7);async['execute'](_0xbeabdf){const _0x4b6d18=a23_0x277f3c,{options:_0x3d9887,args:_0xe6830c,tdx:_0x3835dc}=_0xbeabdf,_0x398804=_0x3d9887,_0x590d04=_0xe6830c[0x0]||_0x3d9887[_0x4b6d18(0x2c3)];if(!_0x590d04)return showParentSegmentNotSetError(_0x4b6d18(0x2d6)+_0x4b6d18(0x244)+'Options\x20(one\x20required):\x0a'+_0x4b6d18(0x1ce)+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x4b6d18(0x2ff)+_0x4b6d18(0x231)+_0x4b6d18(0x2e8)),0x1;if(!_0x398804[_0x4b6d18(0x2a5)]&&!_0x398804[_0x4b6d18(0x304)]&&!_0x398804[_0x4b6d18(0x307)]&&!_0x398804[_0x4b6d18(0x2cb)])return console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2d1))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x216)),console['error']('Options:'),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2c8)),console['error'](_0x4b6d18(0x24a)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1e2)),console[_0x4b6d18(0x22f)](_0x4b6d18(0x1f7)),0x1;const _0x291d19=resolveYamlFile(_0x590d04);if(!existsSync(_0x291d19))return showFileNotFoundError(_0x291d19,_0x590d04),0x1;_0x398804['verbose']&&(console[_0x4b6d18(0x22f)](_0x4b6d18(0x1ff)+_0x398804[_0x4b6d18(0x278)]),console[_0x4b6d18(0x22f)]('YAML\x20file:\x20'+_0x291d19));let _0x24d62e;try{_0x24d62e=readFileSync(_0x291d19,'utf-8');}catch(_0x3f7e17){const _0x4679de=_0x3f7e17 instanceof Error?_0x3f7e17[_0x4b6d18(0x2ad)]:String(_0x3f7e17);return console['error'](_0x4b6d18(0x24b)+_0x4679de),0x1;}let _0x2b1820;try{_0x2b1820=parseDef(_0x24d62e);}catch(_0x4ac699){const _0x3868fb=_0x4ac699 instanceof Error?_0x4ac699[_0x4b6d18(0x2ad)]:String(_0x4ac699);return console[_0x4b6d18(0x22f)](a23_0x3b54b8['red'](_0x4b6d18(0x27f)+_0x3868fb)),0x1;}if(_0x398804[_0x4b6d18(0x304)]===!![]||_0x398804['attribute']===''){const _0x557b15=_0x2b1820[_0x4b6d18(0x204)]?.[_0x4b6d18(0x1d0)](_0x71f6f8=>_0x71f6f8[_0x4b6d18(0x2e2)])||[];if(_0x557b15['length']===0x0)console[_0x4b6d18(0x22f)](a23_0x3b54b8['red']('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x20b))),console[_0x4b6d18(0x22f)](_0x4b6d18(0x2cf));for(const _0x5e7366 of _0x557b15){console['error']('\x20\x20'+a23_0x3b54b8['cyan'](_0x5e7366));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+_0x4b6d18(0x237)+_0x557b15[0x0]+'\x22');}return 0x1;}if(_0x398804['behavior']===!![]||_0x398804[_0x4b6d18(0x307)]===''){const _0x4476b1=_0x2b1820[_0x4b6d18(0x247)]?.[_0x4b6d18(0x1d0)](_0x4b3f68=>_0x4b3f68[_0x4b6d18(0x2e2)])||[];if(_0x4476b1['length']===0x0)console['error'](a23_0x3b54b8[_0x4b6d18(0x2c2)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x4b6d18(0x22f)](a23_0x3b54b8[_0x4b6d18(0x2c2)](_0x4b6d18(0x2a7))),console[_0x4b6d18(0x22f)]('Available\x20behaviors:');for(const _0x534227 of _0x4476b1){console[_0x4b6d18(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x4b6d18(0x1e6)](_0x534227));}console[_0x4b6d18(0x22f)](_0x4b6d18(0x302)+_0x590d04+'\x20--behavior\x20\x22'+_0x4476b1[0x0]+'\x22');}return 0x1;}const _0x47c4c4=createCommandSpinner(a23_0x3b54b8['dim'](_0x4b6d18(0x26f)),{'verbose':_0x398804['verbose']});_0x47c4c4[_0x4b6d18(0x1ea)]();const _0x1f1afc={'onProgress':_0x5e02bd=>{const _0x2e73f8=_0x4b6d18;_0x47c4c4[_0x2e73f8(0x2ed)]=formatProgressMessage(_0x5e02bd);}};if(_0x398804[_0x4b6d18(0x2a5)])_0x1f1afc['master']=!![];if(_0x398804['attribute']&&typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x304)]=_0x398804[_0x4b6d18(0x304)];if(_0x398804['behavior']&&typeof _0x398804[_0x4b6d18(0x307)]===_0x4b6d18(0x2f1))_0x1f1afc[_0x4b6d18(0x307)]=_0x398804['behavior'];if(_0x398804['enriched'])_0x1f1afc[_0x4b6d18(0x2cb)]=!![];if(_0x398804[_0x4b6d18(0x2a2)])_0x1f1afc[_0x4b6d18(0x2a2)]=_0x398804[_0x4b6d18(0x2a2)];let _0x501333;try{_0x501333=await _0x3835dc[_0x4b6d18(0x1d8)]['previewParentYaml'](_0x24d62e,_0x1f1afc),_0x47c4c4[_0x4b6d18(0x2be)]();}catch(_0x432416){_0x47c4c4['stop']();throw _0x432416;}return await this[_0x4b6d18(0x2fa)](_0x501333,{'master':_0x398804[_0x4b6d18(0x2a5)],'attribute':typeof _0x398804[_0x4b6d18(0x304)]===_0x4b6d18(0x2f1)?_0x398804['attribute']:undefined,'behavior':typeof _0x398804['behavior']===_0x4b6d18(0x2f1)?_0x398804['behavior']:undefined,'enriched':_0x398804['enriched']}),_0x501333['allValid']?0x0:0x1;}async[a23_0x277f3c(0x2fa)](_0x8515c0,_0x3805dd){const _0x124290=a23_0x277f3c;console['error']('\x0a'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x2f0))+'\x20'+_0x8515c0[_0x124290(0x2e2)]),console[_0x124290(0x22f)]('═'[_0x124290(0x2f9)](0x3c));if(_0x3805dd[_0x124290(0x2a5)]&&_0x8515c0[_0x124290(0x303)]){const _0x5e6337=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x26d))+'\x20'+a23_0x3b54b8['bold'](_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2b2)]+'.'+_0x8515c0[_0x124290(0x2a5)][_0x124290(0x2ee)]);await this[_0x124290(0x2b1)](_0x5e6337,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x304)]&&_0x8515c0[_0x124290(0x303)]){const _0x862f70=a23_0x3b54b8['dim'](_0x124290(0x288))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd['attribute']);await this['displaySampleData'](_0x862f70,_0x8515c0[_0x124290(0x303)]);}else{if(_0x3805dd[_0x124290(0x307)]&&_0x8515c0[_0x124290(0x303)]){const _0x131dd5=a23_0x3b54b8['dim']('Behavior:')+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x3805dd[_0x124290(0x307)]);await this[_0x124290(0x2b1)](_0x131dd5,_0x8515c0['sampleData']);}else{if(_0x3805dd[_0x124290(0x2cb)]&&_0x8515c0[_0x124290(0x303)]){const _0x27c49c=a23_0x3b54b8[_0x124290(0x1d6)](_0x124290(0x2c0))+'\x20'+a23_0x3b54b8[_0x124290(0x1fa)](_0x124290(0x241));await this['displaySampleData'](_0x27c49c,_0x8515c0[_0x124290(0x303)]);}else!_0x8515c0[_0x124290(0x303)]&&console[_0x124290(0x22f)](_0x124290(0x2bf));}}}if(_0x8515c0[_0x124290(0x2f2)][_0x124290(0x1f9)]>0x0){console['error']('─'['repeat'](0x3c)),console['error']('\x0a'+a23_0x3b54b8['red'](_0x124290(0x202)));for(const _0x1eb15f of _0x8515c0[_0x124290(0x2f2)]){console[_0x124290(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x124290(0x2c2)]('•')+'\x20'+_0x1eb15f);}}}async[a23_0x277f3c(0x2b1)](_0x533a2c,_0x419571){const _0x52d459=a23_0x277f3c;if(_0x419571[_0x52d459(0x1f9)]===0x0){console[_0x52d459(0x22f)]('\x0a'+_0x533a2c),console[_0x52d459(0x22f)](_0x52d459(0x2bb));return;}console[_0x52d459(0x22f)]('\x0a'+_0x533a2c);const _0x3e2b17=Object[_0x52d459(0x267)](_0x419571[0x0])['map'](_0x4f34f0=>({'name':_0x4f34f0,'type':typeof _0x419571[0x0][_0x4f34f0]===_0x52d459(0x279)?'double':_0x52d459(0x2bc)})),_0x7583fc={'queryId':_0x52d459(0x2e5),'columns':_0x3e2b17,'data':_0x419571,'stats':{'state':_0x52d459(0x1f0),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x419571['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x2d677c=formatAsTable(_0x7583fc,_0x419571[_0x52d459(0x1f9)],!![]);await writeOutput(_0x2d677c,undefined,_0x52d459(0x2ee));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a23_0x277f3c(0x2e2)]='segment:parent:run';[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x1dd);async[a23_0x277f3c(0x21f)](_0xea5fcf){const _0x52ad0b=a23_0x277f3c,{options:_0x39e032,args:_0x4d92ed,tdx:_0x431850}=_0xea5fcf,_0x51f29e=_0x39e032,_0x5ab105=_0x4d92ed[0x0]||_0x39e032[_0x52ad0b(0x2c3)];if(!_0x5ab105)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x52ad0b(0x215)),0x1;const _0x2a1ea3=resolveYamlFile(_0x5ab105);if(existsSync(_0x2a1ea3)){_0x51f29e[_0x52ad0b(0x1db)]&&console[_0x52ad0b(0x22f)](_0x52ad0b(0x25f)+_0x2a1ea3);let _0x155efc;try{_0x155efc=readFileSync(_0x2a1ea3,_0x52ad0b(0x1fc));}catch(_0x5a4842){const _0x3aac89=_0x5a4842 instanceof Error?_0x5a4842[_0x52ad0b(0x2ad)]:String(_0x5a4842);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x24b)+_0x3aac89),0x1;}const _0x342bf0=await withSpinner(_0x52ad0b(0x229),()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2f4)](_0x155efc),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x25bd73=_0x342bf0['data'],{isNew:_0x19e178,name:_0x1758dc,hasChanges:_0x125ca3,diffFormatted:_0x57dc0b}=_0x25bd73;if(_0x125ca3){_0x19e178?console[_0x52ad0b(0x22f)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x1758dc+'\x27:'):console[_0x52ad0b(0x22f)](_0x52ad0b(0x2dc)+_0x1758dc+'\x27:');console['error']('─'[_0x52ad0b(0x2f9)](0x3c)),console[_0x52ad0b(0x22f)](_0x57dc0b),console['error']('─'[_0x52ad0b(0x2f9)](0x3c));const _0x2406e9=_0x19e178?'Create\x20parent\x20segment\x20\x27'+_0x1758dc+_0x52ad0b(0x20a):_0x52ad0b(0x22b)+_0x1758dc+'\x27\x20and\x20run\x20workflow?';if(!_0x51f29e[_0x52ad0b(0x2b3)]){const _0x13de14=await confirmKey(_0x2406e9);if(!_0x13de14)return console['error'](_0x52ad0b(0x223)),0x1;}const _0x52c765=_0x19e178?_0x52ad0b(0x240):_0x52ad0b(0x1e5);await withSpinner(_0x52c765+_0x52ad0b(0x2cd)+_0x1758dc+'\x27...',()=>_0x25bd73[_0x52ad0b(0x2d2)](),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]});const _0x34ba22=_0x19e178?'Created':_0x52ad0b(0x220);console[_0x52ad0b(0x22f)]('✔\x20'+_0x34ba22+_0x52ad0b(0x2cd)+_0x1758dc+'\x27');}else console['error'](_0x52ad0b(0x2ae)+_0x1758dc+_0x52ad0b(0x269));}const _0xf8e14d=await withSpinner(_0x52ad0b(0x273)+_0x5ab105+'\x27...',()=>_0x431850[_0x52ad0b(0x1d8)][_0x52ad0b(0x2c6)](_0x5ab105),{'verbose':_0x51f29e[_0x52ad0b(0x1db)]}),_0x1b7fb1=_0xf8e14d['data'],_0x122ed8=getConsoleUrl(_0x51f29e[_0x52ad0b(0x278)],_0x52ad0b(0x200)+_0x1b7fb1['workflowId']+_0x52ad0b(0x27d)+_0x1b7fb1[_0x52ad0b(0x301)]+_0x52ad0b(0x28c)+_0x1b7fb1[_0x52ad0b(0x26e)]);return console[_0x52ad0b(0x22f)](_0x52ad0b(0x300)),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)](_0x52ad0b(0x23a))+'\x20'+_0x1b7fb1[_0x52ad0b(0x258)]),console[_0x52ad0b(0x22f)]('\x20\x20'+a23_0x3b54b8['dim'](_0x52ad0b(0x293))+'\x20'+_0x1b7fb1[_0x52ad0b(0x260)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Session:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x301)]),console['error']('\x20\x20'+a23_0x3b54b8[_0x52ad0b(0x1d6)]('Attempt:')+'\x20'+_0x1b7fb1[_0x52ad0b(0x26e)]),console[_0x52ad0b(0x22f)]('\x20\x20'+_0x122ed8),console[_0x52ad0b(0x22f)]('\x0a'+a23_0x3b54b8['dim'](_0x52ad0b(0x256))+_0x52ad0b(0x20d)+_0x1b7fb1[_0x52ad0b(0x26e)]+_0x52ad0b(0x1ee)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a23_0x277f3c(0x1e8);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2ea);async[a23_0x277f3c(0x21f)](_0x3daa06){const _0x54d191=a23_0x277f3c,{options:_0x278015,args:_0x1152b2,tdx:_0x1c5bd7}=_0x3daa06,_0x4e1bf4=_0x1152b2[0x0]||_0x278015[_0x54d191(0x2c3)];if(!_0x4e1bf4)return showParentSegmentNotSetError(_0x54d191(0x2ac)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x278015[_0x54d191(0x1db)]&&(console[_0x54d191(0x22f)](_0x54d191(0x1ff)+_0x278015['site']),console[_0x54d191(0x22f)]('Parent\x20segment:\x20'+_0x4e1bf4));const _0x41d0d2=await withSpinner(_0x54d191(0x282)+_0x4e1bf4+_0x54d191(0x1d3),()=>_0x1c5bd7['segment'][_0x54d191(0x1e0)](_0x4e1bf4),{'verbose':_0x278015[_0x54d191(0x1db)]}),_0x3247d4=_0x41d0d2[_0x54d191(0x2b8)];console[_0x54d191(0x22f)]('✔\x20Found\x20'+_0x3247d4[_0x54d191(0x1f9)]+_0x54d191(0x28e)+(_0x3247d4[_0x54d191(0x1f9)]!==0x1?'s':''));if(_0x278015['json']||_0x278015['jsonl'])return await handleSDKOutput(_0x3247d4,_0x278015),0x0;return displayFieldsHumanReadable(_0x3247d4,_0x4e1bf4),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x27c);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x261);async[a23_0x277f3c(0x21f)](_0x341dd3){const _0xa70fde=a23_0x277f3c,{options:_0x39f364,args:_0x52f6ff,tdx:_0x4a335c}=_0x341dd3,_0x4eefc9=_0x39f364,_0x4bbf8f=_0x52f6ff[0x0]||_0x39f364[_0xa70fde(0x2c3)];if(!_0x4bbf8f)return showParentSegmentNotSetError(_0xa70fde(0x1eb)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+_0xa70fde(0x285)+_0xa70fde(0x249)),0x1;_0x39f364['verbose']&&(console[_0xa70fde(0x22f)](_0xa70fde(0x1ff)+_0x39f364[_0xa70fde(0x278)]),console['error'](_0xa70fde(0x2eb)+_0x4bbf8f));const _0x2bbc05=await withSpinner(_0xa70fde(0x232)+_0x4bbf8f+'\x27...',()=>_0x4a335c[_0xa70fde(0x1d8)][_0xa70fde(0x2bd)](_0x4bbf8f),{'verbose':_0x39f364[_0xa70fde(0x1db)]}),_0x497869=_0x2bbc05[_0xa70fde(0x2b8)];if(_0x4eefc9[_0xa70fde(0x2b0)]){const _0x400641=getConsoleNextUrl(_0x4eefc9[_0xa70fde(0x278)],_0xa70fde(0x26c)+_0x497869['id']);return console[_0xa70fde(0x22f)](a23_0x3b54b8[_0xa70fde(0x264)]('✔')+_0xa70fde(0x2b7)+a23_0x3b54b8[_0xa70fde(0x1e6)](_0x400641)),openBrowser(_0x400641),0x0;}return await handleSingleObjectOutput(_0x497869,_0x39f364),0x0;}}function a23_0x31ab(_0x241fd4,_0x5cf95b){_0x241fd4=_0x241fd4-0x1ce;const _0x1c3770=a23_0x1c37();let _0x31ab54=_0x1c3770[_0x241fd4];return _0x31ab54;}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x23f);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x2a1);async[a23_0x277f3c(0x21f)](_0x49e697){const _0x3a5ac9=a23_0x277f3c,{options:_0xbce695,args:_0x1833ac,tdx:_0x177ab6}=_0x49e697,_0x5c8981=_0x1833ac[0x0]||_0xbce695[_0x3a5ac9(0x2c3)];if(!_0x5c8981)return showParentSegmentNotSetError(_0x3a5ac9(0x1f3)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0xbce695['verbose']&&(console[_0x3a5ac9(0x22f)](_0x3a5ac9(0x1ff)+_0xbce695[_0x3a5ac9(0x278)]),console[_0x3a5ac9(0x22f)]('Parent\x20segment:\x20'+_0x5c8981));const _0x8d97f5=await withSpinner(_0x3a5ac9(0x213)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6['segment'][_0x3a5ac9(0x2ba)](_0x5c8981),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0xff61bd=_0x8d97f5['data'],_0x495d4c=await withSpinner(_0x3a5ac9(0x234)+_0x5c8981+_0x3a5ac9(0x1d3),()=>_0x177ab6[_0x3a5ac9(0x1d8)]['getParentSQL'](_0xff61bd),{'verbose':_0xbce695[_0x3a5ac9(0x1db)]}),_0x1e31f2=await executeSchemaQuery(_0x495d4c['data'],_0x177ab6,_0xbce695);return await handleQueryOutput(_0x1e31f2,_0xbce695),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x266);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x271);async['execute'](_0x5cd95c){const _0x1e9126=a23_0x277f3c,{options:_0x10bc91,args:_0x527a9f,tdx:_0xa18cbe}=_0x5cd95c,_0x2bf3c3=_0x527a9f[0x0]||_0x10bc91[_0x1e9126(0x2c3)];if(!_0x2bf3c3)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;_0x10bc91['verbose']&&(console[_0x1e9126(0x22f)](_0x1e9126(0x1ff)+_0x10bc91[_0x1e9126(0x278)]),console['error'](_0x1e9126(0x2eb)+_0x2bf3c3));const _0x35212f=await withSpinner(_0x1e9126(0x213)+_0x2bf3c3+_0x1e9126(0x1d3),()=>_0xa18cbe['segment'][_0x1e9126(0x2ba)](_0x2bf3c3),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x23ec4a=_0x35212f[_0x1e9126(0x2b8)],_0xa868b4=await withSpinner(_0x1e9126(0x234)+_0x2bf3c3+'\x27...',()=>_0xa18cbe[_0x1e9126(0x1d8)][_0x1e9126(0x29f)](_0x23ec4a),{'verbose':_0x10bc91[_0x1e9126(0x1db)]}),_0x46cdf2=_0xa868b4[_0x1e9126(0x2b8)];return _0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x22d)||_0x10bc91[_0x1e9126(0x27e)]===_0x1e9126(0x26a)?await handleSDKOutput([{'sql':_0x46cdf2}],_0x10bc91):console[_0x1e9126(0x1da)](_0x46cdf2),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x277f3c(0x2e2)]=a23_0x277f3c(0x2f6);[a23_0x277f3c(0x2df)]=a23_0x277f3c(0x239);async[a23_0x277f3c(0x21f)](_0xa6d296){const _0x27885f=a23_0x277f3c,{options:_0x1ca982,args:_0x376c8e,tdx:_0x42c33a}=_0xa6d296,_0x5c30be=_0x376c8e[0x0]||_0x1ca982['parentSegment'];if(!_0x5c30be)return showParentSegmentNotSetError(_0x27885f(0x268)+'\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;_0x1ca982[_0x27885f(0x1db)]&&(console['error'](_0x27885f(0x1ff)+_0x1ca982[_0x27885f(0x278)]),console[_0x27885f(0x22f)](_0x27885f(0x2eb)+_0x5c30be));const _0x47c22e=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c30be+_0x27885f(0x1d3),()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x2ba)](_0x5c30be),{'verbose':_0x1ca982[_0x27885f(0x1db)]}),_0x52dca3=_0x47c22e['data'],_0x530267=await withSpinner(_0x27885f(0x234)+_0x5c30be+'\x27...',()=>_0x42c33a[_0x27885f(0x1d8)][_0x27885f(0x29f)](_0x52dca3),{'verbose':_0x1ca982[_0x27885f(0x1db)]});let _0x3459d9=_0x530267['data'];const _0xe9946c=resolveLimit(_0x1ca982['limit'],DEFAULT_DISPLAY_LIMIT),_0x896dc1=/\bLIMIT\s+\d+/i[_0x27885f(0x26b)](_0x3459d9);!_0x896dc1&&(_0x3459d9=_0x3459d9['trim']()[_0x27885f(0x29c)](/;+$/,''),_0x3459d9=_0x27885f(0x27b)+_0x3459d9+_0x27885f(0x25c)+_0xe9946c);_0x1ca982[_0x27885f(0x1db)]&&console[_0x27885f(0x22f)](_0x27885f(0x222)+_0x3459d9);const _0x51bb1e=await withProgressSpinner(_0x27885f(0x1e4),async _0x321a57=>{const _0x5d5586=_0x27885f,_0x487dff=await _0x42c33a[_0x5d5586(0x205)][_0x5d5586(0x21f)](_0x3459d9,{'catalog':'td','schema':'information_schema','onJobId':_0x347d53=>{const _0x836db6=_0x5d5586;_0x321a57[_0x836db6(0x21d)](_0x347d53);}});return _0x487dff;},{'verbose':_0x1ca982['verbose']}),_0x4c7b1d=_0x51bb1e[_0x27885f(0x2b8)],_0x20c28c=_0x4c7b1d[_0x27885f(0x211)]?_0x27885f(0x25b)+_0x4c7b1d[_0x27885f(0x211)]+']':'';return console[_0x27885f(0x22f)](_0x27885f(0x1cf)+_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x227)]['toLocaleString']()+_0x27885f(0x206)+(_0x27885f(0x283)+formatElapsed(_0x4c7b1d[_0x27885f(0x22c)][_0x27885f(0x280)])+_0x20c28c)),await handleQueryOutput(_0x4c7b1d,_0x1ca982),0x0;}}
1
+ const a23_0x3e3b9c=a23_0x5328;(function(_0x450d20,_0x102d6d){const _0x2cd3af=a23_0x5328,_0x2fcb81=_0x450d20();while(!![]){try{const _0x476b4c=parseInt(_0x2cd3af(0x2cd))/0x1+parseInt(_0x2cd3af(0x218))/0x2*(parseInt(_0x2cd3af(0x26a))/0x3)+-parseInt(_0x2cd3af(0x254))/0x4*(-parseInt(_0x2cd3af(0x2b6))/0x5)+-parseInt(_0x2cd3af(0x27e))/0x6*(parseInt(_0x2cd3af(0x211))/0x7)+parseInt(_0x2cd3af(0x269))/0x8+parseInt(_0x2cd3af(0x27c))/0x9+-parseInt(_0x2cd3af(0x2ad))/0xa;if(_0x476b4c===_0x102d6d)break;else _0x2fcb81['push'](_0x2fcb81['shift']());}catch(_0xc96928){_0x2fcb81['push'](_0x2fcb81['shift']());}}}(a23_0x3cfc,0x5691b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a23_0xaa4e34 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a23_0xc71f68 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';function a23_0x5328(_0x21f21b,_0x29a4ed){_0x21f21b=_0x21f21b-0x1cd;const _0x3cfc63=a23_0x3cfc();let _0x53287d=_0x3cfc63[_0x21f21b];return _0x53287d;}import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a23_0x3e3b9c(0x1d3),LEGACY_PARENT_SEGMENT_DIR=a23_0x3e3b9c(0x25a);function openBrowser(_0x252e65){const _0x453b42=a23_0x3e3b9c,_0x26a96d=process[_0x453b42(0x2fb)],_0x260a9e=_0x26a96d===_0x453b42(0x240)?'open':_0x26a96d==='win32'?_0x453b42(0x1d7):'xdg-open';spawn(_0x260a9e,[_0x252e65],{'detached':!![],'stdio':_0x453b42(0x2de)})[_0x453b42(0x29a)]();}function migrateLegacyDirectory(){const _0x209ca2=a23_0x3e3b9c;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x1261f2=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x1261f2[_0x209ca2(0x256)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x209ca2(0x2b4)](a23_0xc71f68[_0x209ca2(0x1d9)](_0x209ca2(0x231)+LEGACY_PARENT_SEGMENT_DIR+_0x209ca2(0x2ae)+PARENT_SEGMENT_DIR+_0x209ca2(0x1de))),console['error'](a23_0xc71f68[_0x209ca2(0x23d)](_0x209ca2(0x1cf)+LEGACY_PARENT_SEGMENT_DIR+_0x209ca2(0x2e5))),![];console['error'](a23_0xc71f68[_0x209ca2(0x1d9)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x209ca2(0x299)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x209ca2(0x2b4)](a23_0xc71f68[_0x209ca2(0x239)](_0x209ca2(0x200)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2c1b91){const _0x573cbd=_0x2c1b91 instanceof Error?_0x2c1b91[_0x209ca2(0x1e2)]:String(_0x2c1b91);return console['error'](a23_0xc71f68[_0x209ca2(0x22b)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x573cbd+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async['run'](_0xf51609){return migrateLegacyDirectory(),super['run'](_0xf51609);}}function resolveYamlFile(_0x525530){const _0x54c1c5=a23_0x3e3b9c;if(_0x525530['endsWith']('.yml')||_0x525530[_0x54c1c5(0x26f)](_0x54c1c5(0x1ef)))return _0x525530;return a23_0xaa4e34[_0x54c1c5(0x29d)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x525530)+_0x54c1c5(0x2ed));}function a23_0x3cfc(){const _0x12731b=['elapsedTimeMillis','Updating\x20parent\x20segment\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Events:','Listing\x20parent\x20segments...','segment:parent:create','double','length','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','rowCount','No\x20parent\x20segments\x20match\x20pattern:\x20','workflowAttemptId','behaviors','\x20\x20No\x20sample\x20data\x20available','filter','\x0a✔\x20Workflow\x20started','sampleData','476306DdVhqY','Fetching\x20sample\x20data...','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20parent\x20segment\x20\x27','✔\x20Query\x20completed:\x20Processed\x20','\x27\x20with\x20ID:\x20','schemaError','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','✔\x20No\x20changes\x20-\x20\x27','getParentFull','scheduleType','displayColumns','segment:parent:run','foreignKey','stats','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Fetching\x20current\x20configuration\x20for\x20\x27','ignore','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Attempt:','segment:parent:show','behavior','Enriched:','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','/\x20directory.\x0a','customerGroupFile','cyan','attributes','\x20--enriched','interval','timezone','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','.yml','name','/sessions/','\x0aUsage:\x20tdx\x20ps\x20preview\x20','displayMasterInfo','listParents','Fetching\x20parent\x20segment\x20\x27','displayValidateResults','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Attributes','displaySampleData','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Status:','Creating','platform','audienceId','addBehaviors','segment:parent:view','List\x20parent\x20segments','Listing\x20parent\x20segments\x20matching\x20\x27','Creating\x20parent\x20segment\x20\x27','createParent','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','toFixed','Updating','Found\x20YAML\x20file:\x20','parent_segments','\x20--attribute\x20\x22','\x27...','Database:\x20','start','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','yellow','utf-8','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','\x0aNo\x20sample\x20data\x20available','Preview:','/\x20directories\x20exist.','\x20tdx\x20wf\x20attempt\x20','segment:parent:validate','\x20Context\x20set:\x20','message','toLocaleString','Error\x20parsing\x20YAML:\x20','Output\x20file:\x20','keys','Audience\x20ID:','displaySummary','👥\x20','parentSegment','Columns:','tdx\x20segment\x20parent\x20preview\x20','/attempt/','data','.yaml','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Rows:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Pattern:\x20','\x20--behavior\x20\x22<name>\x22','label','Customers:','enriched','jsonl','segment:parent:preview','joinKey','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','format','coveragePercent','Coverage:','segment:parent:push','✔\x20Renamed\x20directory\x20to\x20','execute','To\x20view\x20sample\x20data:','\x20[Job\x20ID:\x20','\x20No\x20changes\x20-\x20','customerPercent','information_schema','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','segment','segment:parent:list','To\x20cancel:','Available\x20attributes:','\x0aNew\x20parent\x20segment\x20\x27','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','SQL\x20query:\x0a','replace','Overwrite\x20\x27','57925wGWmab','\x5c$&','displayBehaviorsStats','Fetching\x20SQL\x20for\x20\x27','customerGroup','Show\x20parent\x20segment\x20details','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','6758aPzjHS','displayPreviewResults','Name:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','all','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','matchedCount','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','json','yes','number','Errors:','map','-1d','Error\x20reading\x20file:\x20','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','SELECT\x20*\x20FROM\x20(\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','red','Error:\x20--database\x20and\x20--table\x20are\x20required','\x0aChanges\x20to\x20apply\x20to\x20\x27','displayAttributesStats','use','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','\x0a⚠️\x20\x20Both\x20','population','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','columns','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Available\x20behaviors:','\x20rows\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','green','behaviorsFile','YAML\x20file:\x20','List\x20available\x20fields\x20for\x20segmentation','dim','bold','site','darwin','resolveParentId','Analyzing\x20changes...','Site:\x20','totalEvents','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Options:\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','\x20kill','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Source:','\x20--interval\x20','in\x20','Apply\x20changes\x20to\x20\x27','Validate:','\x27\x20is\x20already\x20up\x20to\x20date','Master\x20+\x20Attributes','table','processedRows','56wysfmB','database','isDirectory','string','Updated','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','parent_segment','attribute','Get\x20SQL\x20query\x20for\x20parent\x20segment','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','segment:parent:desc','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Listing\x20fields\x20for\x20\x27','verbose','Error:\x20Parent\x20segment\x20name\x20is\x20required','/app/dw/parentSegments/','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20=\x20','Master\x20Table','3627248DTFmWB','573IumRom','Options:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','log','endsWith','Table:\x20','/app/workflows/','description','dirname','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Error:\x20--attribute\x20requires\x20a\x20name\x0a','Created','varchar','/{name}.yml\x0a','sort','workflowSessionId','using\x20the\x20default\x20path:\x20','2599254NhwMzV','\x20--attribute\x20\x22<name>\x22','234hjsnZr','addBehaviorsFile','Parent\x20segment:\x20','Behavior:','Error:','Resolving\x20parent\x20segment\x20\x27','limit','apply','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Validating\x20configuration...','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','✔\x20Found\x20','localeCompare','segment:parent:sql','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20is\x20already\x20up\x20to\x20date','master','setJobId','\x27\x20is\x20up\x20to\x20date','test','Master:','web','segment:parent:pull','addAttributes','customersWithEvents','stop','jobId','/\x20→\x20','unref','getParentSQL','Aborted.','join','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20rows)','pushParentYaml','errors','schemaValid','scheduleOption','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20field','output','\x0aChanges\x20to\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','runParent','segment:parent:update','12165690ZLvlxI','/\x20and\x20','Join:','Join\x20on:','\x20parent\x20segment','✔\x20Updated\x20parent\x20segment\x20\x27','Attribute:','error','allValid','10705jsKXsJ','\x20Configuration\x20is\x20valid','column','query','displayPreviewHints','repeat'];a23_0x3cfc=function(){return _0x12731b;};return a23_0x3cfc();}function formatProgressMessage(_0x2930ca){const _0x386c14=a23_0x3e3b9c,_0x4a0dd2=_0x2930ca['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x4a0dd2){const [,_0x119d16,_0x3612d4,_0x3eaca1='']=_0x4a0dd2;return a23_0xc71f68[_0x386c14(0x23d)](_0x119d16+':')+'\x20'+_0x3612d4+a23_0xc71f68[_0x386c14(0x23d)](_0x3eaca1);}return a23_0xc71f68[_0x386c14(0x23d)](_0x2930ca);}function showFileNotFoundError(_0x211d52,_0x5af26e){const _0x43a24e=a23_0x3e3b9c;console[_0x43a24e(0x2b4)](a23_0xc71f68['red']('Error:\x20File\x20not\x20found:\x20'+_0x211d52+'\x0a')),console[_0x43a24e(0x2b4)](a23_0xc71f68[_0x43a24e(0x2e7)](_0x43a24e(0x2df)+_0x5af26e+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x1f248b){const _0x1a56f0=a23_0x3e3b9c;console[_0x1a56f0(0x2b4)](a23_0xc71f68['yellow'](_0x1a56f0(0x2cf))),console['error'](_0x1f248b);}export class ParentSegmentListCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x209);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2ff);async[a23_0x3e3b9c(0x201)](_0x2127d4){const _0xf522c9=a23_0x3e3b9c,{options:_0x36e30d,args:_0x1ce214,tdx:_0x22930d}=_0x2127d4,_0x283866=_0x1ce214[0x0];_0x36e30d[_0xf522c9(0x263)]&&(console[_0xf522c9(0x2b4)](_0xf522c9(0x243)+_0x36e30d[_0xf522c9(0x23f)]),_0x283866&&console['error'](_0xf522c9(0x1f3)+_0x283866));const _0x658104=await withSpinner(_0x283866?_0xf522c9(0x300)+_0x283866+_0xf522c9(0x1d5):_0xf522c9(0x2c0),()=>_0x22930d[_0xf522c9(0x208)][_0xf522c9(0x2f2)](),{'verbose':_0x36e30d[_0xf522c9(0x263)]});let _0x213136=_0x658104[_0xf522c9(0x1ee)];if(_0x283866){const _0x3c2e23=_0x283866[_0xf522c9(0x20f)](/[.+^${}()|[\]\\]/g,_0xf522c9(0x212))['replace'](/\*/g,'.*')[_0xf522c9(0x20f)](/\?/g,'.'),_0xb55a01=new RegExp('^'+_0x3c2e23+'$','i');_0x213136=_0x213136[_0xf522c9(0x2ca)](_0x1efc06=>_0xb55a01[_0xf522c9(0x291)](_0x1efc06['attributes']['name']));}_0x213136[_0xf522c9(0x279)]((_0x60b048,_0x4fe338)=>_0x60b048[_0xf522c9(0x2e8)][_0xf522c9(0x2ee)][_0xf522c9(0x28a)](_0x4fe338[_0xf522c9(0x2e8)][_0xf522c9(0x2ee)])),console[_0xf522c9(0x2b4)]('✔\x20Found\x20'+_0x213136[_0xf522c9(0x2c3)]+_0xf522c9(0x2b1)+(_0x213136[_0xf522c9(0x2c3)]!==0x1?'s':''));const _0xb994fb=_0x17596c=>{const _0x1fbc8a=_0xf522c9;return getConsoleNextUrl(_0x36e30d[_0x1fbc8a(0x23f)],_0x1fbc8a(0x265)+_0x17596c);};if(_0x36e30d[_0xf522c9(0x1fc)]==='json'||_0x36e30d[_0xf522c9(0x1fc)]===_0xf522c9(0x1f8)){const _0x1f3171=_0x213136['map'](_0x32e774=>({..._0x32e774,'url':_0xb994fb(_0x32e774['id'])}));await handleSDKOutput(_0x1f3171,_0x36e30d);}else{if(_0x213136[_0xf522c9(0x2c3)]===0x0)_0x283866?console[_0xf522c9(0x26e)](_0xf522c9(0x2c6)+_0x283866):console[_0xf522c9(0x26e)]('No\x20parent\x20segments\x20found');else for(const _0x44423b of _0x213136){const _0xabe354=_0x44423b['attributes'][_0xf522c9(0x232)]?a23_0xc71f68[_0xf522c9(0x23d)]('\x20('+formatRows(_0x44423b[_0xf522c9(0x2e8)][_0xf522c9(0x232)])+')'):'',_0x5989e6=hyperlink(_0x44423b[_0xf522c9(0x2e8)][_0xf522c9(0x2ee)],_0xb994fb(_0x44423b['id']));console['log'](_0xf522c9(0x1e9)+_0x5989e6+_0xabe354);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2c1);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x249);async[a23_0x3e3b9c(0x201)](_0x30616a){const _0x230091=a23_0x3e3b9c,{options:_0x1a04bb,args:_0x30d7bd,tdx:_0x2651b9}=_0x30616a;console[_0x230091(0x2b4)](_0x230091(0x1fb)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x5b4793=_0x1a04bb;if(_0x30d7bd[_0x230091(0x2c3)]===0x0)return console[_0x230091(0x2b4)](a23_0xc71f68[_0x230091(0x22b)](_0x230091(0x264))),console[_0x230091(0x2b4)](_0x230091(0x247)),0x1;const _0x569a2=_0x30d7bd[0x0];if(!_0x5b4793[_0x230091(0x255)]||!_0x5b4793[_0x230091(0x252)])return console[_0x230091(0x2b4)](_0x230091(0x22c)),console[_0x230091(0x2b4)](_0x230091(0x247)),0x1;_0x5b4793[_0x230091(0x263)]&&(console['error']('Site:\x20'+_0x5b4793[_0x230091(0x23f)]),console[_0x230091(0x2b4)](_0x230091(0x21a)+_0x569a2),console[_0x230091(0x2b4)](_0x230091(0x1d6)+_0x5b4793[_0x230091(0x255)]),console['error'](_0x230091(0x270)+_0x5b4793[_0x230091(0x252)]));const _0xdda694=await loadJSONFromOptions(_0x5b4793[_0x230091(0x2e8)],_0x5b4793['attributesFile']),_0x4d6341=await loadJSONFromOptions(_0x5b4793['behaviors'],_0x5b4793[_0x230091(0x23a)]),_0x1ccb16=await loadJSONFromOptions(_0x5b4793['customerGroup'],_0x5b4793[_0x230091(0x2e6)]),_0x557696={'name':_0x569a2,'description':_0x5b4793['description'],'scheduleType':_0x5b4793[_0x230091(0x2d7)],'scheduleOption':_0x5b4793['scheduleOption'],'timezone':_0x5b4793[_0x230091(0x2eb)],'master':{'parentDatabaseName':_0x5b4793[_0x230091(0x255)],'parentTableName':_0x5b4793[_0x230091(0x252)]},'attributes':_0xdda694,'behaviors':_0x4d6341,'customerGroup':_0x1ccb16},_0x3e5d00=await withSpinner(_0x230091(0x1cd)+_0x569a2+_0x230091(0x1d5),()=>_0x2651b9[_0x230091(0x208)][_0x230091(0x1ce)](_0x557696),{'verbose':_0x1a04bb[_0x230091(0x263)]}),_0x4f63ad=_0x3e5d00[_0x230091(0x1ee)];return console[_0x230091(0x2b4)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x4f63ad[_0x230091(0x2ee)]+_0x230091(0x2d2)+_0x4f63ad['id']),await handleSDKOutput([_0x4f63ad],_0x1a04bb),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2ac);['description']=a23_0x3e3b9c(0x1f0);async[a23_0x3e3b9c(0x201)](_0x3ee88f){const _0x4fe67b=a23_0x3e3b9c,{options:_0x2871ec,args:_0x599afb,tdx:_0x7ebe7a}=_0x3ee88f;console[_0x4fe67b(0x2b4)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x4fe67b(0x21b)+_0x4fe67b(0x2a8));const _0x2491cb=_0x2871ec;if(_0x599afb[_0x4fe67b(0x2c3)]===0x0)return console[_0x4fe67b(0x2b4)](a23_0xc71f68['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x4fe67b(0x2b4)](_0x4fe67b(0x2f8)),0x1;const _0x32c689=_0x599afb[0x0];_0x2491cb[_0x4fe67b(0x263)]&&(console[_0x4fe67b(0x2b4)](_0x4fe67b(0x243)+_0x2491cb[_0x4fe67b(0x23f)]),console[_0x4fe67b(0x2b4)](_0x4fe67b(0x280)+_0x32c689));const _0x32ba2b=await withSpinner(_0x4fe67b(0x2dd)+_0x32c689+_0x4fe67b(0x1d5),()=>_0x7ebe7a[_0x4fe67b(0x208)][_0x4fe67b(0x2d6)](_0x32c689),{'verbose':_0x2491cb[_0x4fe67b(0x263)]}),_0x513120=_0x32ba2b[_0x4fe67b(0x1ee)],_0x43b886=await loadJSONFromOptions(_0x2491cb[_0x4fe67b(0x295)],_0x2491cb['addAttributesFile']),_0x466d85=await loadJSONFromOptions(_0x2491cb[_0x4fe67b(0x2fd)],_0x2491cb[_0x4fe67b(0x27f)]),_0x42fb79={'name':_0x513120['name'],'description':_0x2491cb[_0x4fe67b(0x272)]!==undefined?_0x2491cb[_0x4fe67b(0x272)]:_0x513120[_0x4fe67b(0x272)],'scheduleType':_0x2491cb[_0x4fe67b(0x2d7)]!==undefined?_0x2491cb[_0x4fe67b(0x2d7)]:_0x513120['scheduleType'],'scheduleOption':_0x2491cb[_0x4fe67b(0x2a3)]!==undefined?_0x2491cb[_0x4fe67b(0x2a3)]:_0x513120[_0x4fe67b(0x2a3)],'timezone':_0x2491cb[_0x4fe67b(0x2eb)]!==undefined?_0x2491cb[_0x4fe67b(0x2eb)]:_0x513120['timezone'],'master':_0x513120[_0x4fe67b(0x28e)],'attributes':_0x43b886?[..._0x513120['attributes']||[],..._0x43b886]:_0x513120[_0x4fe67b(0x2e8)],'behaviors':_0x466d85?[..._0x513120[_0x4fe67b(0x2c8)]||[],..._0x466d85]:_0x513120[_0x4fe67b(0x2c8)],'customerGroup':_0x513120[_0x4fe67b(0x215)]},_0x433868=await withSpinner(_0x4fe67b(0x2bd)+_0x32c689+_0x4fe67b(0x1d5),()=>_0x7ebe7a['segment']['updateParent'](_0x32c689,_0x42fb79),{'verbose':_0x2491cb[_0x4fe67b(0x263)]}),_0x412863=_0x433868['data'];return console[_0x4fe67b(0x2b4)](_0x4fe67b(0x2b2)+_0x412863['name']+'\x27'),await handleSDKOutput([_0x412863],_0x2491cb),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x294);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x1d8);async[a23_0x3e3b9c(0x201)](_0x5b6ab8){const _0x23d839=a23_0x3e3b9c,{options:_0x40578a,args:_0x54a7ac,tdx:_0x309ac1}=_0x5b6ab8,_0x4c6ee6=_0x40578a,_0x1339a5=_0x54a7ac[0x0]||_0x40578a[_0x23d839(0x1ea)];if(!_0x1339a5)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'+_0x23d839(0x1f2)),0x1;if(_0x4c6ee6[_0x23d839(0x22f)]&&_0x4c6ee6[_0x23d839(0x2a6)])return console['error'](a23_0xc71f68[_0x23d839(0x22b)](_0x23d839(0x20d))),console[_0x23d839(0x2b4)](a23_0xc71f68['dim'](_0x23d839(0x2e4))),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x23d)](_0x23d839(0x27b)+PARENT_SEGMENT_DIR+_0x23d839(0x278))),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x2e7)](_0x23d839(0x25e))),0x1;const _0x17505e=_0x4c6ee6['output']||a23_0xaa4e34['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1339a5)+_0x23d839(0x2ed));_0x4c6ee6[_0x23d839(0x263)]&&(console[_0x23d839(0x2b4)](_0x23d839(0x243)+_0x4c6ee6[_0x23d839(0x23f)]),console[_0x23d839(0x2b4)]('Parent\x20segment:\x20'+_0x1339a5),console[_0x23d839(0x2b4)](_0x23d839(0x1e5)+_0x17505e));const _0xbc626e=await withSpinner(_0x23d839(0x2f3)+_0x1339a5+_0x23d839(0x1d5),()=>_0x309ac1[_0x23d839(0x208)]['pullParentYaml'](_0x1339a5),{'verbose':_0x4c6ee6[_0x23d839(0x263)]}),_0x369066=_0xbc626e['data'];if(existsSync(_0x17505e)){const _0x123843=readFileSync(_0x17505e,_0x23d839(0x1da)),_0x17dffe=generateDiff(_0x123843,_0x369066);if(!hasChanges(_0x17dffe))console['error'](a23_0xc71f68[_0x23d839(0x239)]('✔')+_0x23d839(0x204)+a23_0xc71f68[_0x23d839(0x2e7)](_0x17505e)+_0x23d839(0x28d));else{console[_0x23d839(0x2b4)](_0x23d839(0x2a7)+_0x17505e+'\x27:'),console[_0x23d839(0x2b4)]('─'[_0x23d839(0x2bb)](0x3c)),console[_0x23d839(0x2b4)](formatDiffWithColors(_0x17dffe)),console[_0x23d839(0x2b4)]('─'[_0x23d839(0x2bb)](0x3c));if(!_0x4c6ee6[_0x23d839(0x221)]){const _0x34168b=await confirmKey(_0x23d839(0x210)+_0x17505e+'\x27?');if(!_0x34168b)return console[_0x23d839(0x2b4)](_0x23d839(0x29c)),0x1;}writeFileSync(_0x17505e,_0x369066,_0x23d839(0x1da)),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x239)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a23_0xc71f68[_0x23d839(0x2e7)](_0x17505e));}}else{const _0x562e85=a23_0xaa4e34[_0x23d839(0x273)](_0x17505e);!existsSync(_0x562e85)&&mkdirSync(_0x562e85,{'recursive':!![]}),writeFileSync(_0x17505e,_0x369066,'utf-8'),console['error'](a23_0xc71f68['green']('✔')+_0x23d839(0x2d4)+a23_0xc71f68['cyan'](_0x17505e));}return saveSessionContext({'parent_segment':_0x1339a5},_0x4c6ee6['session']),console[_0x23d839(0x2b4)](a23_0xc71f68[_0x23d839(0x239)]('✔')+_0x23d839(0x1e1)+a23_0xc71f68[_0x23d839(0x23d)](_0x23d839(0x25a))+'\x20=\x20'+a23_0xc71f68[_0x23d839(0x2e7)](_0x1339a5)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a23_0x3e3b9c(0x1ff);[a23_0x3e3b9c(0x272)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x18ad02){const _0x269f25=a23_0x3e3b9c,{options:_0x5ba816,args:_0x3b8d46,tdx:_0x1eeef7}=_0x18ad02,_0x3ace56=_0x5ba816,_0x1db2ca=_0x3b8d46[0x0]||_0x5ba816[_0x269f25(0x1ea)];if(!_0x1db2ca)return showParentSegmentNotSetError(_0x269f25(0x230)+_0x269f25(0x25f)),0x1;const _0x355894=resolveYamlFile(_0x1db2ca);if(!existsSync(_0x355894))return showFileNotFoundError(_0x355894,_0x1db2ca),0x1;_0x3ace56[_0x269f25(0x263)]&&(console[_0x269f25(0x2b4)](_0x269f25(0x243)+_0x3ace56[_0x269f25(0x23f)]),console[_0x269f25(0x2b4)]('YAML\x20file:\x20'+_0x355894));let _0x3790ac;try{_0x3790ac=readFileSync(_0x355894,'utf-8');}catch(_0x23aaba){const _0x52212f=_0x23aaba instanceof Error?_0x23aaba['message']:String(_0x23aaba);return console['error'](_0x269f25(0x226)+_0x52212f),0x1;}const _0x3c20e9=await withSpinner(_0x269f25(0x242),()=>_0x1eeef7['segment'][_0x269f25(0x2a0)](_0x3790ac),{'verbose':_0x3ace56[_0x269f25(0x263)]}),_0x42af9b=_0x3c20e9[_0x269f25(0x1ee)],{isNew:_0x34fbda,name:_0x56897f,hasChanges:_0x5ba756,diffFormatted:_0x4db5d4}=_0x42af9b;if(!_0x5ba756)return console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x56897f+_0x269f25(0x250)),0x0;_0x34fbda?console[_0x269f25(0x2b4)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x56897f+'\x27:'):console[_0x269f25(0x2b4)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x56897f+'\x27:');console[_0x269f25(0x2b4)]('─'[_0x269f25(0x2bb)](0x3c)),console['error'](_0x4db5d4),console[_0x269f25(0x2b4)]('─'['repeat'](0x3c));const _0x35ff1b=_0x34fbda?'Create\x20parent\x20segment\x20\x27'+_0x56897f+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x56897f+'\x27?';if(!_0x3ace56[_0x269f25(0x221)]){const _0x1bdc98=await confirmKey(_0x35ff1b);if(!_0x1bdc98)return console[_0x269f25(0x2b4)](_0x269f25(0x29c)),0x1;}const _0x23ea0e=_0x34fbda?_0x269f25(0x2fa):_0x269f25(0x1d1),_0x45c40a=await withSpinner(_0x23ea0e+_0x269f25(0x2d0)+_0x56897f+'\x27...',()=>_0x42af9b['apply'](),{'verbose':_0x3ace56[_0x269f25(0x263)]}),_0x148fdd=_0x45c40a[_0x269f25(0x1ee)],_0x1d12df=getConsoleNextUrl(_0x3ace56[_0x269f25(0x23f)],'/app/dw/parentSegments/'+_0x148fdd['id']),_0x16903b=_0x34fbda?_0x269f25(0x276):_0x269f25(0x258);return console[_0x269f25(0x2b4)]('✔\x20'+_0x16903b+_0x269f25(0x2d0)+_0x148fdd[_0x269f25(0x2ee)]+'\x27'),console['error']('\x20\x20'+_0x1d12df),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x1e0);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2be);async['execute'](_0x1cad42){const _0x4c9e0d=a23_0x3e3b9c,{options:_0x221639,args:_0x1da81a,tdx:_0x4cd6d8}=_0x1cad42,_0x1da40e=_0x221639,_0x4376ad=_0x1da81a[0x0]||_0x221639[_0x4c9e0d(0x1ea)];if(!_0x4376ad)return showParentSegmentNotSetError(_0x4c9e0d(0x21f)+_0x4c9e0d(0x26d)+'Options:\x0a'+_0x4c9e0d(0x29e)+_0x4c9e0d(0x238)+_0x4c9e0d(0x288)),0x1;const _0x28b415=resolveYamlFile(_0x4376ad);if(!existsSync(_0x28b415))return showFileNotFoundError(_0x28b415,_0x4376ad),0x1;_0x1da40e['verbose']&&(console[_0x4c9e0d(0x2b4)](_0x4c9e0d(0x243)+_0x1da40e['site']),console[_0x4c9e0d(0x2b4)]('YAML\x20file:\x20'+_0x28b415));let _0x4b604c;try{_0x4b604c=readFileSync(_0x28b415,'utf-8');}catch(_0x42be5f){const _0x4aa5ff=_0x42be5f instanceof Error?_0x42be5f[_0x4c9e0d(0x1e2)]:String(_0x42be5f);return console[_0x4c9e0d(0x2b4)](_0x4c9e0d(0x226)+_0x4aa5ff),0x1;}const _0x59115e=createCommandSpinner(a23_0xc71f68[_0x4c9e0d(0x23d)](_0x4c9e0d(0x287)),{'verbose':_0x1da40e[_0x4c9e0d(0x263)]});_0x59115e[_0x4c9e0d(0x1d7)]();const _0x5b3bb7={'onProgress':_0x58b1cf=>{_0x59115e['text']=formatProgressMessage(_0x58b1cf);}};if(_0x1da40e['master'])_0x5b3bb7['master']=!![];if(_0x1da40e[_0x4c9e0d(0x1f7)])_0x5b3bb7[_0x4c9e0d(0x1f7)]=!![];_0x1da40e[_0x4c9e0d(0x25b)]&&(_0x5b3bb7['attribute']=_0x1da40e[_0x4c9e0d(0x25b)]);_0x1da40e[_0x4c9e0d(0x2e2)]&&(_0x5b3bb7[_0x4c9e0d(0x2e2)]=_0x1da40e[_0x4c9e0d(0x2e2)]);if(_0x1da40e[_0x4c9e0d(0x2ea)])_0x5b3bb7[_0x4c9e0d(0x2ea)]=_0x1da40e[_0x4c9e0d(0x2ea)];let _0x416019;try{_0x416019=await _0x4cd6d8['segment']['validateParentYaml'](_0x4b604c,_0x5b3bb7),_0x59115e[_0x4c9e0d(0x297)]();}catch(_0x32aba9){_0x59115e[_0x4c9e0d(0x297)]();throw _0x32aba9;}const _0x378617=_0x1da40e[_0x4c9e0d(0x2ea)]||_0x4c9e0d(0x225);return this[_0x4c9e0d(0x2f4)](_0x416019,_0x5b3bb7,_0x28b415,_0x378617),_0x416019[_0x4c9e0d(0x2b5)]?0x0:0x1;}[a23_0x3e3b9c(0x2f4)](_0x581f3e,_0x21cd76,_0x4dc1e2,_0x5acfce){const _0x4085f7=a23_0x3e3b9c;console['error']('\x0a'+a23_0xc71f68[_0x4085f7(0x23e)](_0x4085f7(0x24f))+'\x20'+_0x581f3e[_0x4085f7(0x2ee)]),console[_0x4085f7(0x2b4)]('═'[_0x4085f7(0x2bb)](0x3c)),this[_0x4085f7(0x2f1)](_0x581f3e);if(typeof _0x21cd76[_0x4085f7(0x25b)]===_0x4085f7(0x257)){this['displayAttributesStats'](_0x581f3e),this[_0x4085f7(0x1e8)](_0x581f3e),this[_0x4085f7(0x2ba)](_0x4dc1e2,_0x5acfce,_0x4085f7(0x25b),_0x21cd76['attribute']);return;}if(_0x21cd76[_0x4085f7(0x25b)]===!![]){this['displayAttributesStats'](_0x581f3e),this[_0x4085f7(0x1e8)](_0x581f3e),this['displayPreviewHints'](_0x4dc1e2,_0x5acfce,_0x4085f7(0x2e8));return;}if(typeof _0x21cd76['behavior']===_0x4085f7(0x257)){this['displayBehaviorsStats'](_0x581f3e,_0x5acfce),this[_0x4085f7(0x1e8)](_0x581f3e),this[_0x4085f7(0x2ba)](_0x4dc1e2,_0x5acfce,'behavior',_0x21cd76['behavior']);return;}if(_0x21cd76[_0x4085f7(0x2e2)]===!![]){this[_0x4085f7(0x213)](_0x581f3e,_0x5acfce),this['displaySummary'](_0x581f3e),this['displayPreviewHints'](_0x4dc1e2,_0x5acfce,_0x4085f7(0x2c8));return;}this[_0x4085f7(0x22e)](_0x581f3e),this[_0x4085f7(0x213)](_0x581f3e,_0x5acfce),this[_0x4085f7(0x1e8)](_0x581f3e),this[_0x4085f7(0x2ba)](_0x4dc1e2,_0x5acfce,_0x4085f7(0x21c));}[a23_0x3e3b9c(0x2ba)](_0x141a67,_0x4b2078,_0xc7d755,_0x41f107){const _0x27f379=a23_0x3e3b9c;console['error']('\x0a'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x202)));const _0x285a30=_0x4b2078!==_0x27f379(0x225)?_0x27f379(0x24c)+_0x4b2078:'';if(_0xc7d755==='attribute'&&_0x41f107)console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68['dim'](_0x27f379(0x1ec)+_0x141a67+'\x20--attribute\x20\x22'+_0x41f107+'\x22'+_0x285a30));else{if(_0xc7d755===_0x27f379(0x2e2)&&_0x41f107)console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68['dim'](_0x27f379(0x1ec)+_0x141a67+'\x20--behavior\x20\x22'+_0x41f107+'\x22'+_0x285a30));else(_0xc7d755===_0x27f379(0x2e8)||_0xc7d755===_0x27f379(0x21c))&&console['error']('\x20\x20'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x1ec)+_0x141a67+_0x27f379(0x27d)+_0x285a30));}(_0xc7d755===_0x27f379(0x2c8)||_0xc7d755==='all')&&console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x1ec)+_0x141a67+_0x27f379(0x1f4)+_0x285a30)),_0xc7d755==='all'&&console[_0x27f379(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x27f379(0x23d)](_0x27f379(0x1ec)+_0x141a67+_0x27f379(0x2e9)+_0x285a30));}[a23_0x3e3b9c(0x2f1)](_0x39640b){const _0x468d18=a23_0x3e3b9c,{master:_0x581ad2}=_0x39640b,_0x55ad69=_0x581ad2[_0x468d18(0x2a2)]?a23_0xc71f68['green']('✔'):a23_0xc71f68['red']('✘');console[_0x468d18(0x2b4)]('\x0a'+a23_0xc71f68[_0x468d18(0x23d)](_0x468d18(0x268))),console[_0x468d18(0x2b4)](_0x55ad69+'\x20'+a23_0xc71f68[_0x468d18(0x23e)](_0x581ad2[_0x468d18(0x255)]+'.'+_0x581ad2[_0x468d18(0x252)])),_0x581ad2[_0x468d18(0x2a2)]?_0x581ad2[_0x468d18(0x2c5)]!==undefined&&console[_0x468d18(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x468d18(0x23d)](_0x468d18(0x1f1))+'\x20'+a23_0xc71f68[_0x468d18(0x2e7)](formatRows(_0x581ad2['rowCount']))):console['error']('\x20\x20'+a23_0xc71f68[_0x468d18(0x22b)](_0x468d18(0x282))+'\x20'+_0x581ad2['schemaError']);}['displayAttributesStats'](_0x233ce6){const _0x16c47c=a23_0x3e3b9c;if(_0x233ce6[_0x16c47c(0x2e8)]['length']===0x0)return;console[_0x16c47c(0x2b4)]('\x0a'+a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x2f6)));for(const _0x141d04 of _0x233ce6['attributes']){const _0x4906dd=_0x141d04['schemaValid']?a23_0xc71f68[_0x16c47c(0x239)]('✔'):a23_0xc71f68[_0x16c47c(0x22b)]('✘');let _0x41f884='';if(_0x141d04['schemaValid']&&_0x141d04[_0x16c47c(0x21e)]!==undefined&&_0x141d04['coveragePercent']!==undefined){const _0x103648=_0x141d04[_0x16c47c(0x1fd)][_0x16c47c(0x1d0)](0x1),_0x4fc2bd=_0x141d04[_0x16c47c(0x1fd)]>=0x50?a23_0xc71f68['green']:_0x141d04[_0x16c47c(0x1fd)]>=0x32?a23_0xc71f68[_0x16c47c(0x1d9)]:a23_0xc71f68[_0x16c47c(0x22b)];_0x41f884='\x20'+a23_0xc71f68['dim'](_0x16c47c(0x1fe))+'\x20'+_0x4fc2bd(_0x103648+'%')+'\x20('+formatRows(_0x141d04[_0x16c47c(0x21e)])+_0x16c47c(0x29f);}console[_0x16c47c(0x2b4)](_0x4906dd+'\x20'+a23_0xc71f68[_0x16c47c(0x23e)](_0x141d04[_0x16c47c(0x2ee)])+_0x41f884),console[_0x16c47c(0x2b4)]('\x20\x20'+a23_0xc71f68['dim']('Source:')+'\x20'+a23_0xc71f68['bold'](_0x141d04[_0x16c47c(0x255)]+'.'+_0x141d04[_0x16c47c(0x252)]));const _0x2c679b=_0x141d04['joinKey']===_0x141d04[_0x16c47c(0x2da)]?a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x2b0))+'\x20'+_0x141d04[_0x16c47c(0x1fa)]:a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x2af))+'\x20'+_0x141d04[_0x16c47c(0x1fa)]+_0x16c47c(0x267)+_0x141d04[_0x16c47c(0x2da)];console[_0x16c47c(0x2b4)]('\x20\x20'+_0x2c679b),console[_0x16c47c(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x16c47c(0x23d)](_0x16c47c(0x1eb))),this['displayColumns'](_0x141d04[_0x16c47c(0x234)]),!_0x141d04[_0x16c47c(0x2a2)]&&console['error']('\x20\x20'+a23_0xc71f68['red'](_0x16c47c(0x282))+'\x20'+_0x141d04[_0x16c47c(0x2d3)]);}}[a23_0x3e3b9c(0x213)](_0xd979b7,_0x1b4847){const _0x37fae5=a23_0x3e3b9c;if(_0xd979b7[_0x37fae5(0x2c8)][_0x37fae5(0x2c3)]===0x0)return;console[_0x37fae5(0x2b4)]('\x0a'+a23_0xc71f68[_0x37fae5(0x23d)]('Behaviors')+'\x20'+a23_0xc71f68[_0x37fae5(0x23d)]('('+_0x1b4847+')'));for(const _0x2ce40e of _0xd979b7[_0x37fae5(0x2c8)]){const _0x31fe6a=_0x2ce40e[_0x37fae5(0x2a2)]?a23_0xc71f68[_0x37fae5(0x239)]('✔'):a23_0xc71f68[_0x37fae5(0x22b)]('✘');let _0x10066c='';if(_0x2ce40e[_0x37fae5(0x2a2)]&&_0x2ce40e[_0x37fae5(0x296)]!==undefined&&_0x2ce40e[_0x37fae5(0x244)]!==undefined){const _0x2cef55=_0x2ce40e['customerPercent']?.[_0x37fae5(0x1d0)](0x1)||'?',_0x1ae851=(_0x2ce40e['customerPercent']??0x0)>=0x32?a23_0xc71f68[_0x37fae5(0x239)]:(_0x2ce40e[_0x37fae5(0x205)]??0x0)>=0x14?a23_0xc71f68[_0x37fae5(0x1d9)]:a23_0xc71f68[_0x37fae5(0x22b)];_0x10066c='\x20'+a23_0xc71f68[_0x37fae5(0x23d)](_0x37fae5(0x1f6))+'\x20'+_0x1ae851(formatRows(_0x2ce40e[_0x37fae5(0x296)]))+'\x20('+_0x2cef55+'%)\x20'+a23_0xc71f68[_0x37fae5(0x23d)](_0x37fae5(0x2bf))+'\x20'+a23_0xc71f68[_0x37fae5(0x2e7)](formatRows(_0x2ce40e[_0x37fae5(0x244)]));}console[_0x37fae5(0x2b4)](_0x31fe6a+'\x20'+a23_0xc71f68[_0x37fae5(0x23e)](_0x2ce40e[_0x37fae5(0x2ee)])+_0x10066c),console['error']('\x20\x20'+a23_0xc71f68[_0x37fae5(0x23d)](_0x37fae5(0x24b))+'\x20'+a23_0xc71f68[_0x37fae5(0x23e)](_0x2ce40e['database']+'.'+_0x2ce40e['table']));const _0x4af74c=_0x2ce40e[_0x37fae5(0x1fa)]===_0x2ce40e[_0x37fae5(0x2da)]?a23_0xc71f68['dim'](_0x37fae5(0x2b0))+'\x20'+_0x2ce40e[_0x37fae5(0x1fa)]:a23_0xc71f68[_0x37fae5(0x23d)]('Join:')+'\x20'+_0x2ce40e['joinKey']+_0x37fae5(0x267)+_0x2ce40e[_0x37fae5(0x2da)];console[_0x37fae5(0x2b4)]('\x20\x20'+_0x4af74c),console[_0x37fae5(0x2b4)]('\x20\x20'+a23_0xc71f68['dim']('Columns:')),this[_0x37fae5(0x2d8)](_0x2ce40e['columns']),!_0x2ce40e[_0x37fae5(0x2a2)]&&console[_0x37fae5(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x37fae5(0x22b)](_0x37fae5(0x282))+'\x20'+_0x2ce40e['schemaError']);}}['displayColumns'](_0x4171b0){const _0x19aa25=a23_0x3e3b9c;for(const _0x3cd9b6 of _0x4171b0){_0x3cd9b6[_0x19aa25(0x1f5)]===_0x3cd9b6['column']||_0x3cd9b6['column']==='*'?console[_0x19aa25(0x2b4)]('\x20\x20\x20\x20-\x20'+_0x3cd9b6['label']):console[_0x19aa25(0x2b4)]('\x20\x20\x20\x20-\x20'+_0x3cd9b6[_0x19aa25(0x1f5)]+'\x20'+a23_0xc71f68[_0x19aa25(0x23d)]('('+_0x3cd9b6[_0x19aa25(0x2b8)]+')'));}}['displaySummary'](_0x5f0879){const _0x530705=a23_0x3e3b9c;console[_0x530705(0x2b4)]('─'[_0x530705(0x2bb)](0x3c));if(_0x5f0879[_0x530705(0x2a1)][_0x530705(0x2c3)]>0x0){console[_0x530705(0x2b4)]('\x0a'+a23_0xc71f68[_0x530705(0x22b)](_0x530705(0x223)));for(const _0x42e111 of _0x5f0879[_0x530705(0x2a1)]){console[_0x530705(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x530705(0x22b)]('•')+'\x20'+_0x42e111);}}_0x5f0879[_0x530705(0x2b5)]&&console[_0x530705(0x2b4)]('\x0a'+a23_0xc71f68[_0x530705(0x239)]('✔')+_0x530705(0x2b7));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x1f9);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2c4);async[a23_0x3e3b9c(0x201)](_0xfbb4f0){const _0x3bf51c=a23_0x3e3b9c,{options:_0x8e067a,args:_0x493a3c,tdx:_0x5ced95}=_0xfbb4f0,_0x5bcdf4=_0x8e067a,_0x51b591=_0x493a3c[0x0]||_0x8e067a[_0x3bf51c(0x1ea)];if(!_0x51b591)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+'Options\x20(one\x20required):\x0a'+_0x3bf51c(0x24a)+_0x3bf51c(0x207)+_0x3bf51c(0x266)+_0x3bf51c(0x233)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x5bcdf4[_0x3bf51c(0x28e)]&&!_0x5bcdf4[_0x3bf51c(0x25b)]&&!_0x5bcdf4['behavior']&&!_0x5bcdf4[_0x3bf51c(0x1f7)])return console['error'](a23_0xc71f68['red'](_0x3bf51c(0x245))),console['error'](_0x3bf51c(0x2ec)),console['error'](_0x3bf51c(0x26b)),console['error'](_0x3bf51c(0x2a9)),console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2aa)),console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2a4)),console['error'](_0x3bf51c(0x286)),0x1;const _0x11f9e7=resolveYamlFile(_0x51b591);if(!existsSync(_0x11f9e7))return showFileNotFoundError(_0x11f9e7,_0x51b591),0x1;_0x5bcdf4[_0x3bf51c(0x263)]&&(console[_0x3bf51c(0x2b4)](_0x3bf51c(0x243)+_0x5bcdf4[_0x3bf51c(0x23f)]),console['error'](_0x3bf51c(0x23b)+_0x11f9e7));let _0x59ad84;try{_0x59ad84=readFileSync(_0x11f9e7,_0x3bf51c(0x1da));}catch(_0xab8d71){const _0x56a278=_0xab8d71 instanceof Error?_0xab8d71[_0x3bf51c(0x1e2)]:String(_0xab8d71);return console[_0x3bf51c(0x2b4)]('Error\x20reading\x20file:\x20'+_0x56a278),0x1;}let _0x4496d8;try{_0x4496d8=parseDef(_0x59ad84);}catch(_0x462e15){const _0x57b383=_0x462e15 instanceof Error?_0x462e15[_0x3bf51c(0x1e2)]:String(_0x462e15);return console[_0x3bf51c(0x2b4)](a23_0xc71f68[_0x3bf51c(0x22b)](_0x3bf51c(0x1e4)+_0x57b383)),0x1;}if(_0x5bcdf4[_0x3bf51c(0x25b)]===!![]||_0x5bcdf4[_0x3bf51c(0x25b)]===''){const _0x4f4c58=_0x4496d8['attributes']?.[_0x3bf51c(0x224)](_0x13e03b=>_0x13e03b[_0x3bf51c(0x2ee)])||[];if(_0x4f4c58[_0x3bf51c(0x2c3)]===0x0)console['error'](a23_0xc71f68[_0x3bf51c(0x22b)](_0x3bf51c(0x227)));else{console[_0x3bf51c(0x2b4)](a23_0xc71f68[_0x3bf51c(0x22b)](_0x3bf51c(0x275))),console[_0x3bf51c(0x2b4)](_0x3bf51c(0x20b));for(const _0x3281fa of _0x4f4c58){console[_0x3bf51c(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x3bf51c(0x2e7)](_0x3281fa));}console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2f0)+_0x51b591+_0x3bf51c(0x1d4)+_0x4f4c58[0x0]+'\x22');}return 0x1;}if(_0x5bcdf4[_0x3bf51c(0x2e2)]===!![]||_0x5bcdf4['behavior']===''){const _0x4f2f3d=_0x4496d8[_0x3bf51c(0x2c8)]?.[_0x3bf51c(0x224)](_0x16369e=>_0x16369e[_0x3bf51c(0x2ee)])||[];if(_0x4f2f3d[_0x3bf51c(0x2c3)]===0x0)console['error'](a23_0xc71f68[_0x3bf51c(0x22b)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x3bf51c(0x2b4)](a23_0xc71f68['red'](_0x3bf51c(0x25d))),console['error'](_0x3bf51c(0x236));for(const _0x74669b of _0x4f2f3d){console[_0x3bf51c(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x3bf51c(0x2e7)](_0x74669b));}console[_0x3bf51c(0x2b4)](_0x3bf51c(0x2f0)+_0x51b591+'\x20--behavior\x20\x22'+_0x4f2f3d[0x0]+'\x22');}return 0x1;}const _0x4c3170=createCommandSpinner(a23_0xc71f68[_0x3bf51c(0x23d)](_0x3bf51c(0x2ce)),{'verbose':_0x5bcdf4['verbose']});_0x4c3170['start']();const _0x370e3a={'onProgress':_0x3d838f=>{_0x4c3170['text']=formatProgressMessage(_0x3d838f);}};if(_0x5bcdf4[_0x3bf51c(0x28e)])_0x370e3a[_0x3bf51c(0x28e)]=!![];if(_0x5bcdf4['attribute']&&typeof _0x5bcdf4['attribute']===_0x3bf51c(0x257))_0x370e3a['attribute']=_0x5bcdf4[_0x3bf51c(0x25b)];if(_0x5bcdf4[_0x3bf51c(0x2e2)]&&typeof _0x5bcdf4[_0x3bf51c(0x2e2)]==='string')_0x370e3a['behavior']=_0x5bcdf4[_0x3bf51c(0x2e2)];if(_0x5bcdf4[_0x3bf51c(0x1f7)])_0x370e3a[_0x3bf51c(0x1f7)]=!![];if(_0x5bcdf4[_0x3bf51c(0x2ea)])_0x370e3a[_0x3bf51c(0x2ea)]=_0x5bcdf4[_0x3bf51c(0x2ea)];let _0x54b793;try{_0x54b793=await _0x5ced95[_0x3bf51c(0x208)]['previewParentYaml'](_0x59ad84,_0x370e3a),_0x4c3170[_0x3bf51c(0x297)]();}catch(_0x45caa1){_0x4c3170[_0x3bf51c(0x297)]();throw _0x45caa1;}return await this['displayPreviewResults'](_0x54b793,{'master':_0x5bcdf4[_0x3bf51c(0x28e)],'attribute':typeof _0x5bcdf4['attribute']===_0x3bf51c(0x257)?_0x5bcdf4['attribute']:undefined,'behavior':typeof _0x5bcdf4[_0x3bf51c(0x2e2)]===_0x3bf51c(0x257)?_0x5bcdf4[_0x3bf51c(0x2e2)]:undefined,'enriched':_0x5bcdf4['enriched']}),_0x54b793[_0x3bf51c(0x2b5)]?0x0:0x1;}async[a23_0x3e3b9c(0x219)](_0x277c62,_0x544158){const _0x366b92=a23_0x3e3b9c;console['error']('\x0a'+a23_0xc71f68[_0x366b92(0x23e)](_0x366b92(0x1dd))+'\x20'+_0x277c62['name']),console[_0x366b92(0x2b4)]('═'['repeat'](0x3c));if(_0x544158[_0x366b92(0x28e)]&&_0x277c62[_0x366b92(0x2cc)]){const _0x47f6f5=a23_0xc71f68[_0x366b92(0x23d)](_0x366b92(0x292))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x277c62[_0x366b92(0x28e)][_0x366b92(0x255)]+'.'+_0x277c62[_0x366b92(0x28e)][_0x366b92(0x252)]);await this[_0x366b92(0x2f7)](_0x47f6f5,_0x277c62[_0x366b92(0x2cc)]);}else{if(_0x544158['attribute']&&_0x277c62[_0x366b92(0x2cc)]){const _0x59b6ca=a23_0xc71f68[_0x366b92(0x23d)](_0x366b92(0x2b3))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x544158[_0x366b92(0x25b)]);await this[_0x366b92(0x2f7)](_0x59b6ca,_0x277c62[_0x366b92(0x2cc)]);}else{if(_0x544158[_0x366b92(0x2e2)]&&_0x277c62[_0x366b92(0x2cc)]){const _0x23078d=a23_0xc71f68[_0x366b92(0x23d)](_0x366b92(0x281))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x544158[_0x366b92(0x2e2)]);await this[_0x366b92(0x2f7)](_0x23078d,_0x277c62[_0x366b92(0x2cc)]);}else{if(_0x544158['enriched']&&_0x277c62[_0x366b92(0x2cc)]){const _0x57d015=a23_0xc71f68['dim'](_0x366b92(0x2e3))+'\x20'+a23_0xc71f68[_0x366b92(0x23e)](_0x366b92(0x251));await this[_0x366b92(0x2f7)](_0x57d015,_0x277c62[_0x366b92(0x2cc)]);}else!_0x277c62[_0x366b92(0x2cc)]&&console[_0x366b92(0x2b4)](_0x366b92(0x1dc));}}}if(_0x277c62[_0x366b92(0x2a1)][_0x366b92(0x2c3)]>0x0){console[_0x366b92(0x2b4)]('─'['repeat'](0x3c)),console[_0x366b92(0x2b4)]('\x0a'+a23_0xc71f68[_0x366b92(0x22b)](_0x366b92(0x223)));for(const _0x30bf7a of _0x277c62['errors']){console[_0x366b92(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x366b92(0x22b)]('•')+'\x20'+_0x30bf7a);}}}async[a23_0x3e3b9c(0x2f7)](_0x5c2dbb,_0x378661){const _0x2174cf=a23_0x3e3b9c;if(_0x378661[_0x2174cf(0x2c3)]===0x0){console['error']('\x0a'+_0x5c2dbb),console[_0x2174cf(0x2b4)](_0x2174cf(0x2c9));return;}console[_0x2174cf(0x2b4)]('\x0a'+_0x5c2dbb);const _0x4b5a67=Object[_0x2174cf(0x1e6)](_0x378661[0x0])['map'](_0x419ef9=>({'name':_0x419ef9,'type':typeof _0x378661[0x0][_0x419ef9]===_0x2174cf(0x222)?_0x2174cf(0x2c2):_0x2174cf(0x277)})),_0xd21c21={'queryId':'preview','columns':_0x4b5a67,'data':_0x378661,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x378661[_0x2174cf(0x2c3)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x389d40=formatAsTable(_0xd21c21,_0x378661['length'],!![]);await writeOutput(_0x389d40,undefined,_0x2174cf(0x252));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a23_0x3e3b9c(0x2d9);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2f5);async[a23_0x3e3b9c(0x201)](_0x4a4ea0){const _0x281af7=a23_0x3e3b9c,{options:_0x58d08f,args:_0x5d0044,tdx:_0x285ec3}=_0x4a4ea0,_0x2066d7=_0x58d08f,_0x54a1ba=_0x5d0044[0x0]||_0x58d08f[_0x281af7(0x1ea)];if(!_0x54a1ba)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment'),0x1;const _0x4af1b8=resolveYamlFile(_0x54a1ba);if(existsSync(_0x4af1b8)){_0x2066d7[_0x281af7(0x263)]&&console['error'](_0x281af7(0x1d2)+_0x4af1b8);let _0x23cbe5;try{_0x23cbe5=readFileSync(_0x4af1b8,'utf-8');}catch(_0xde2f63){const _0x2df3f9=_0xde2f63 instanceof Error?_0xde2f63[_0x281af7(0x1e2)]:String(_0xde2f63);return console[_0x281af7(0x2b4)]('Error\x20reading\x20file:\x20'+_0x2df3f9),0x1;}const _0x1d1ece=await withSpinner(_0x281af7(0x242),()=>_0x285ec3[_0x281af7(0x208)][_0x281af7(0x2a0)](_0x23cbe5),{'verbose':_0x2066d7[_0x281af7(0x263)]}),_0x1d7995=_0x1d1ece['data'],{isNew:_0x3e66c2,name:_0x158889,hasChanges:_0x1bd905,diffFormatted:_0x27b6dc}=_0x1d7995;if(_0x1bd905){_0x3e66c2?console[_0x281af7(0x2b4)](_0x281af7(0x20c)+_0x158889+'\x27:'):console[_0x281af7(0x2b4)](_0x281af7(0x22d)+_0x158889+'\x27:');console[_0x281af7(0x2b4)]('─'['repeat'](0x3c)),console[_0x281af7(0x2b4)](_0x27b6dc),console['error']('─'[_0x281af7(0x2bb)](0x3c));const _0x421ee4=_0x3e66c2?'Create\x20parent\x20segment\x20\x27'+_0x158889+'\x27\x20and\x20run\x20workflow?':_0x281af7(0x24e)+_0x158889+'\x27\x20and\x20run\x20workflow?';if(!_0x2066d7[_0x281af7(0x221)]){const _0x1a649a=await confirmKey(_0x421ee4);if(!_0x1a649a)return console[_0x281af7(0x2b4)](_0x281af7(0x29c)),0x1;}const _0x1e3182=_0x3e66c2?_0x281af7(0x2fa):'Updating';await withSpinner(_0x1e3182+_0x281af7(0x2d0)+_0x158889+_0x281af7(0x1d5),()=>_0x1d7995[_0x281af7(0x285)](),{'verbose':_0x2066d7[_0x281af7(0x263)]});const _0x3a8a71=_0x3e66c2?_0x281af7(0x276):'Updated';console[_0x281af7(0x2b4)]('✔\x20'+_0x3a8a71+_0x281af7(0x2d0)+_0x158889+'\x27');}else console['error'](_0x281af7(0x2d5)+_0x158889+_0x281af7(0x290));}const _0x59a004=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x54a1ba+_0x281af7(0x1d5),()=>_0x285ec3[_0x281af7(0x208)][_0x281af7(0x2ab)](_0x54a1ba),{'verbose':_0x2066d7[_0x281af7(0x263)]}),_0x4638a6=_0x59a004[_0x281af7(0x1ee)],_0xd2d863=getConsoleUrl(_0x2066d7[_0x281af7(0x23f)],_0x281af7(0x271)+_0x4638a6['workflowId']+_0x281af7(0x2ef)+_0x4638a6[_0x281af7(0x27a)]+_0x281af7(0x1ed)+_0x4638a6['workflowAttemptId']);return console[_0x281af7(0x2b4)](_0x281af7(0x2cb)),console[_0x281af7(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x281af7(0x23d)](_0x281af7(0x1e7))+'\x20'+_0x4638a6[_0x281af7(0x2fc)]),console['error']('\x20\x20'+a23_0xc71f68['dim'](_0x281af7(0x2f9))+'\x20'+_0x4638a6['status']),console[_0x281af7(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x281af7(0x23d)]('Session:')+'\x20'+_0x4638a6[_0x281af7(0x27a)]),console[_0x281af7(0x2b4)]('\x20\x20'+a23_0xc71f68[_0x281af7(0x23d)](_0x281af7(0x2e0))+'\x20'+_0x4638a6['workflowAttemptId']),console[_0x281af7(0x2b4)]('\x20\x20'+_0xd2d863),console[_0x281af7(0x2b4)]('\x0a'+a23_0xc71f68[_0x281af7(0x23d)](_0x281af7(0x20a))+_0x281af7(0x1df)+_0x4638a6[_0x281af7(0x2c7)]+_0x281af7(0x248)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]='segment:parent:fields';['description']=a23_0x3e3b9c(0x23c);async[a23_0x3e3b9c(0x201)](_0x3649ef){const _0x818f48=a23_0x3e3b9c,{options:_0x2b98c6,args:_0x41df14,tdx:_0xa9ed08}=_0x3649ef,_0x2b7700=_0x41df14[0x0]||_0x2b98c6[_0x818f48(0x1ea)];if(!_0x2b7700)return showParentSegmentNotSetError(_0x818f48(0x235)+_0x818f48(0x21d)),0x1;_0x2b98c6[_0x818f48(0x263)]&&(console[_0x818f48(0x2b4)]('Site:\x20'+_0x2b98c6[_0x818f48(0x23f)]),console['error'](_0x818f48(0x280)+_0x2b7700));const _0x240107=await withSpinner(_0x818f48(0x262)+_0x2b7700+'\x27...',()=>_0xa9ed08[_0x818f48(0x208)]['listFields'](_0x2b7700),{'verbose':_0x2b98c6['verbose']}),_0xbc66f1=_0x240107[_0x818f48(0x1ee)];console[_0x818f48(0x2b4)](_0x818f48(0x289)+_0xbc66f1['length']+_0x818f48(0x2a5)+(_0xbc66f1[_0x818f48(0x2c3)]!==0x1?'s':''));if(_0x2b98c6[_0x818f48(0x220)]||_0x2b98c6['jsonl'])return await handleSDKOutput(_0xbc66f1,_0x2b98c6),0x0;return displayFieldsHumanReadable(_0xbc66f1,_0x2b7700),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2fe);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x216);async[a23_0x3e3b9c(0x201)](_0x1a60bc){const _0x5422a2=a23_0x3e3b9c,{options:_0x93d62d,args:_0x35830f,tdx:_0x22700c}=_0x1a60bc,_0x5f4a89=_0x93d62d,_0x5d7a2a=_0x35830f[0x0]||_0x93d62d[_0x5422a2(0x1ea)];if(!_0x5d7a2a)return showParentSegmentNotSetError(_0x5422a2(0x228)+_0x5422a2(0x261)+_0x5422a2(0x246)+_0x5422a2(0x217)),0x1;_0x93d62d['verbose']&&(console[_0x5422a2(0x2b4)](_0x5422a2(0x243)+_0x93d62d[_0x5422a2(0x23f)]),console[_0x5422a2(0x2b4)](_0x5422a2(0x280)+_0x5d7a2a));const _0x130736=await withSpinner(_0x5422a2(0x2f3)+_0x5d7a2a+'\x27...',()=>_0x22700c[_0x5422a2(0x208)][_0x5422a2(0x2d6)](_0x5d7a2a),{'verbose':_0x93d62d[_0x5422a2(0x263)]}),_0x409279=_0x130736[_0x5422a2(0x1ee)];if(_0x5f4a89[_0x5422a2(0x293)]){const _0xf3990e=getConsoleNextUrl(_0x5f4a89[_0x5422a2(0x23f)],'/app/dw/parentSegments/'+_0x409279['id']);return console[_0x5422a2(0x2b4)](a23_0xc71f68['green']('✔')+'\x20Opening\x20'+a23_0xc71f68['cyan'](_0xf3990e)),openBrowser(_0xf3990e),0x0;}return await handleSingleObjectOutput(_0x409279,_0x93d62d),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x260);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x2dc);async['execute'](_0x4d86e1){const _0x311398=a23_0x3e3b9c,{options:_0x5ab689,args:_0x22a3cd,tdx:_0x263b4b}=_0x4d86e1,_0x3142ba=_0x22a3cd[0x0]||_0x5ab689[_0x311398(0x1ea)];if(!_0x3142ba)return showParentSegmentNotSetError(_0x311398(0x1db)+_0x311398(0x28c)),0x1;_0x5ab689['verbose']&&(console[_0x311398(0x2b4)](_0x311398(0x243)+_0x5ab689[_0x311398(0x23f)]),console[_0x311398(0x2b4)](_0x311398(0x280)+_0x3142ba));const _0x3871cf=await withSpinner(_0x311398(0x283)+_0x3142ba+'\x27...',()=>_0x263b4b[_0x311398(0x208)][_0x311398(0x241)](_0x3142ba),{'verbose':_0x5ab689['verbose']}),_0x1a9243=_0x3871cf[_0x311398(0x1ee)],_0x49cd05=await withSpinner(_0x311398(0x214)+_0x3142ba+_0x311398(0x1d5),()=>_0x263b4b[_0x311398(0x208)][_0x311398(0x29b)](_0x1a9243),{'verbose':_0x5ab689['verbose']}),_0x38bcc8=await executeSchemaQuery(_0x49cd05[_0x311398(0x1ee)],_0x263b4b,_0x5ab689);return await handleQueryOutput(_0x38bcc8,_0x5ab689),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x28b);[a23_0x3e3b9c(0x272)]=a23_0x3e3b9c(0x25c);async[a23_0x3e3b9c(0x201)](_0x47275b){const _0x2ef1f7=a23_0x3e3b9c,{options:_0x50959f,args:_0x2641bf,tdx:_0x90f30e}=_0x47275b,_0x278e26=_0x2641bf[0x0]||_0x50959f['parentSegment'];if(!_0x278e26)return showParentSegmentNotSetError(_0x2ef1f7(0x259)+'\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;_0x50959f[_0x2ef1f7(0x263)]&&(console[_0x2ef1f7(0x2b4)](_0x2ef1f7(0x243)+_0x50959f[_0x2ef1f7(0x23f)]),console['error']('Parent\x20segment:\x20'+_0x278e26));const _0x2cb0cf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x278e26+_0x2ef1f7(0x1d5),()=>_0x90f30e[_0x2ef1f7(0x208)][_0x2ef1f7(0x241)](_0x278e26),{'verbose':_0x50959f['verbose']}),_0x59a9a8=_0x2cb0cf[_0x2ef1f7(0x1ee)],_0x44c1cf=await withSpinner(_0x2ef1f7(0x214)+_0x278e26+_0x2ef1f7(0x1d5),()=>_0x90f30e[_0x2ef1f7(0x208)]['getParentSQL'](_0x59a9a8),{'verbose':_0x50959f[_0x2ef1f7(0x263)]}),_0x33fd90=_0x44c1cf[_0x2ef1f7(0x1ee)];return _0x50959f[_0x2ef1f7(0x1fc)]==='json'||_0x50959f[_0x2ef1f7(0x1fc)]===_0x2ef1f7(0x1f8)?await handleSDKOutput([{'sql':_0x33fd90}],_0x50959f):console[_0x2ef1f7(0x26e)](_0x33fd90),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a23_0x3e3b9c(0x2ee)]=a23_0x3e3b9c(0x2e1);[a23_0x3e3b9c(0x272)]='Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results';async['execute'](_0x5bc627){const _0x42891f=a23_0x3e3b9c,{options:_0x2d0294,args:_0x36d097,tdx:_0x10af00}=_0x5bc627,_0x4cdebb=_0x36d097[0x0]||_0x2d0294['parentSegment'];if(!_0x4cdebb)return showParentSegmentNotSetError(_0x42891f(0x26c)+_0x42891f(0x22a)),0x1;_0x2d0294[_0x42891f(0x263)]&&(console[_0x42891f(0x2b4)](_0x42891f(0x243)+_0x2d0294['site']),console['error'](_0x42891f(0x280)+_0x4cdebb));const _0x382b9d=await withSpinner(_0x42891f(0x283)+_0x4cdebb+_0x42891f(0x1d5),()=>_0x10af00[_0x42891f(0x208)][_0x42891f(0x241)](_0x4cdebb),{'verbose':_0x2d0294[_0x42891f(0x263)]}),_0x23b88a=_0x382b9d['data'],_0x578754=await withSpinner(_0x42891f(0x214)+_0x4cdebb+_0x42891f(0x1d5),()=>_0x10af00['segment'][_0x42891f(0x29b)](_0x23b88a),{'verbose':_0x2d0294[_0x42891f(0x263)]});let _0x354354=_0x578754[_0x42891f(0x1ee)];const _0x4a56a3=resolveLimit(_0x2d0294[_0x42891f(0x284)],DEFAULT_DISPLAY_LIMIT),_0x1ee408=/\bLIMIT\s+\d+/i[_0x42891f(0x291)](_0x354354);!_0x1ee408&&(_0x354354=_0x354354['trim']()['replace'](/;+$/,''),_0x354354=_0x42891f(0x229)+_0x354354+_0x42891f(0x274)+_0x4a56a3);_0x2d0294[_0x42891f(0x263)]&&console[_0x42891f(0x2b4)](_0x42891f(0x20e)+_0x354354);const _0x1dc520=await withProgressSpinner('Executing\x20parent\x20segment\x20query...',async _0x13a40d=>{const _0x58dbf2=_0x42891f,_0x52e30e=await _0x10af00[_0x58dbf2(0x2b9)][_0x58dbf2(0x201)](_0x354354,{'catalog':'td','schema':_0x58dbf2(0x206),'onJobId':_0x3c3681=>{const _0x3ce488=_0x58dbf2;_0x13a40d[_0x3ce488(0x28f)](_0x3c3681);}});return _0x52e30e;},{'verbose':_0x2d0294['verbose']}),_0x5e17a3=_0x1dc520[_0x42891f(0x1ee)],_0x48c583=_0x5e17a3[_0x42891f(0x298)]?_0x42891f(0x203)+_0x5e17a3[_0x42891f(0x298)]+']':'';return console[_0x42891f(0x2b4)](_0x42891f(0x2d1)+_0x5e17a3['stats'][_0x42891f(0x253)][_0x42891f(0x1e3)]()+_0x42891f(0x237)+(_0x42891f(0x24d)+formatElapsed(_0x5e17a3[_0x42891f(0x2db)][_0x42891f(0x2bc)])+_0x48c583)),await handleQueryOutput(_0x5e17a3,_0x2d0294),0x0;}}
@@ -1 +1 @@
1
- const a24_0x205caa=a24_0x4d45;(function(_0x2ba375,_0xa86f72){const _0x3653be=a24_0x4d45,_0x50c2c4=_0x2ba375();while(!![]){try{const _0x35cf78=-parseInt(_0x3653be(0x205))/0x1+parseInt(_0x3653be(0x209))/0x2*(parseInt(_0x3653be(0x216))/0x3)+parseInt(_0x3653be(0x204))/0x4*(-parseInt(_0x3653be(0x201))/0x5)+parseInt(_0x3653be(0x21f))/0x6+-parseInt(_0x3653be(0x1e0))/0x7+-parseInt(_0x3653be(0x1ea))/0x8+parseInt(_0x3653be(0x228))/0x9;if(_0x35cf78===_0xa86f72)break;else _0x50c2c4['push'](_0x50c2c4['shift']());}catch(_0x1a41e0){_0x50c2c4['push'](_0x50c2c4['shift']());}}}(a24_0x50c7,0xdb0be));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 a24_0x5f2b90 from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x5bba62 from'prompts';function a24_0x50c7(){const _0x4716a0=['\x27\x20does\x20not\x20exist.','password','log','customSite','Create\x20a\x20new\x20profile','join','\x27\x20created','profile','tdx.json','Default\x20profile\x20set\x20to:\x20','\x20Profile\x20\x27','377607CMQzFe','push','us01','Enter\x20profile\x20name:','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','value','\x27\x20requires\x20API\x20key\x20validation.','create','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','3227910CLomOB','description','\x20API\x20key\x20removed\x20from\x20system\x20keychain','logLevel','apiKey','\x20\x20-\x20','parent_segment','\x20API\x20key\x20saved\x20to\x20system\x20keychain','Remove\x20a\x20profile','29378223nSYExe','includes','llm_project','\x0aAvailable\x20profiles:','confirm','profile:set','Enter\x20your\x20TD\x20API\x20key:','You\x20can\x20find\x20your\x20API\x20key\x20at:','tdx:\x20profile\x20remove','\x20\x20(no\x20profiles\x20found)','Enter\x20custom\x20site','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x0aSetup\x20cancelled','Profile\x20\x27','Profile\x20name\x20cannot\x20be\x20empty','select','VALID_KEYS','getUserInfo','name','error','\x20\x20tdx\x20--profile\x20','text','Enter\x20site\x20name:','Enter\x20description\x20(optional):','Changing\x20site\x20to\x20\x27','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','site','test','✗\x20Validation\x20failed:\x20','profile:use','Validating\x20API\x20key...','split','red','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>','ERROR','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x20API\x20key\x20is\x20valid\x20(User:\x20','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','session','Site\x20was\x20not\x20changed.','(cleared)','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','config','trim','eu01','bold','default','7697095yLrzKI','dim','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','us\x20\x20\x20-\x20United\x20States','ap02\x20-\x20Korea','/app/mp/ak','findIndex','jp\x20\x20\x20-\x20Japan','execute','yellow','6368600kEyZVR','tdx:\x20profile\x20set','jp01','Failed\x20to\x20remove\x20profile:\x20','database','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','other','(session:\x20','Site\x20name\x20cannot\x20be\x20empty','Set\x20session\x20profile','\x27\x20does\x20not\x20exist.\x20Create\x20it?','message','warn','validate','profileName','profile:remove','email','length','\x27\x20removed\x20from\x20configuration','tdx:\x20profile\x20create','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','green','jobs','11635APTudu','toString','eu\x20\x20\x20-\x20Europe','796dIjnbK','672154xrBLle','Removal\x20cancelled','status','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','2zwtgCt','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.'];a24_0x50c7=function(){return _0x4716a0;};return a24_0x50c7();}import a24_0x5b98b0 from'chalk';function validateProfileName(_0x27d465){const _0xfc8579=a24_0x4d45;if(!_0x27d465||!_0x27d465[_0xfc8579(0x1dc)]())return _0xfc8579(0x1bd);const _0xee8c49=_0x27d465['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0xfc8579(0x1cc)](_0xee8c49))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0xee8c49))return _0xfc8579(0x1bc)+_0xee8c49+_0xfc8579(0x20a);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x205caa(0x220)]=a24_0x205caa(0x20f);async['execute'](_0x266516){const _0x2685bc=a24_0x205caa,{options:_0x2fb768,args:_0x5a74cb}=_0x266516;console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1de)](_0x2685bc(0x1fd)));let _0x5a7eeb;if(_0x5a74cb[_0x2685bc(0x1fb)]>0x0&&_0x5a74cb[0x0]){const _0x1bc143=_0x5a74cb[0x0][_0x2685bc(0x1dc)](),_0x55e10a=validateProfileName(_0x1bc143);if(_0x55e10a!==!![])return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x55e10a)),0x1;_0x5a7eeb=_0x1bc143;}else{const _0x8bd24=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x1f8),'message':_0x2685bc(0x219),'validate':validateProfileName});if(!_0x8bd24[_0x2685bc(0x1f8)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;_0x5a7eeb=_0x8bd24['profileName'][_0x2685bc(0x1dc)]();}const _0x5b694b=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':_0x2685bc(0x220),'message':_0x2685bc(0x1c6)}),_0xf28d44=_0x5b694b[_0x2685bc(0x220)]?.['trim']()||undefined,_0x20003b=_0x2fb768[_0x2685bc(0x1cb)]||_0x2685bc(0x218),_0x348e01=[{'title':_0x2685bc(0x1e3),'value':_0x2685bc(0x218)},{'title':_0x2685bc(0x1e7),'value':_0x2685bc(0x1ec)},{'title':_0x2685bc(0x203),'value':_0x2685bc(0x1dd)},{'title':_0x2685bc(0x1e4),'value':'ap02'}];let _0x891e62=_0x348e01[_0x2685bc(0x1e6)](_0x37adcb=>_0x37adcb[_0x2685bc(0x21b)]===_0x20003b);_0x891e62===-0x1&&_0x20003b!==_0x2685bc(0x218)&&(_0x348e01[_0x2685bc(0x217)]({'title':_0x20003b,'value':_0x20003b}),_0x891e62=_0x348e01[_0x2685bc(0x1fb)]-0x1);_0x348e01[_0x2685bc(0x217)]({'title':_0x2685bc(0x1b9),'value':_0x2685bc(0x1f0)});const _0x3f621a=await a24_0x5bba62({'type':_0x2685bc(0x1be),'name':'site','message':_0x2685bc(0x1fe)+_0x5a7eeb+'\x27:','choices':_0x348e01,'initial':_0x891e62>=0x0?_0x891e62:0x0});if(!_0x3f621a[_0x2685bc(0x1cb)])return console[_0x2685bc(0x20d)](_0x2685bc(0x1bb)),0x1;let _0x3567b1;if(_0x3f621a[_0x2685bc(0x1cb)]===_0x2685bc(0x1f0)){const _0x1d261a=await a24_0x5bba62({'type':_0x2685bc(0x1c4),'name':'customSite','message':_0x2685bc(0x1c5),'initial':_0x2685bc(0x218),'validate':_0xc5a508=>{const _0x28e780=_0x2685bc;if(!_0xc5a508||!_0xc5a508['trim']())return _0x28e780(0x1f2);if(!/^[a-z0-9-]+$/[_0x28e780(0x1cc)](_0xc5a508['trim']()))return _0x28e780(0x1c9);return!![];}});if(!_0x1d261a['customSite'])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;_0x3567b1=_0x1d261a[_0x2685bc(0x20e)];}else _0x3567b1=_0x3f621a['site'];const _0x13731f=resolveSite(_0x3567b1);console[_0x2685bc(0x20d)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x13731f),console[_0x2685bc(0x20d)](_0x2685bc(0x22f)),console[_0x2685bc(0x20d)]('\x20\x20'+getConsoleUrl(_0x13731f,_0x2685bc(0x1e5)));const _0x2ba9ad=await a24_0x5bba62({'type':_0x2685bc(0x20c),'name':_0x2685bc(0x223),'message':_0x2685bc(0x22e),'validate':_0x50b282=>{const _0x5e584b=_0x2685bc;if(!_0x50b282||!_0x50b282[_0x5e584b(0x1dc)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x2ba9ad[_0x2685bc(0x223)])return console[_0x2685bc(0x20d)]('\x0aSetup\x20cancelled'),0x1;const _0x34eea9=_0x2ba9ad[_0x2685bc(0x223)];console[_0x2685bc(0x20d)](_0x2685bc(0x1cf));try{const _0x1ea621=TDX[_0x2685bc(0x21d)]({'site':_0x13731f,'apiKey':_0x34eea9['trim'](),'logLevel':_0x2fb768[_0x2685bc(0x222)]??LogLevel[_0x2685bc(0x1d3)]}),_0x3d3387=await _0x1ea621[_0x2685bc(0x200)]['getUserInfo']();console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x3d3387[_0x2685bc(0x1fa)]+')');const _0xc7d0b1=await isKeychainAvailable();_0xc7d0b1?(await saveAPIKeyAsync(_0x34eea9[_0x2685bc(0x1dc)](),_0x13731f,_0x5a7eeb),console[_0x2685bc(0x20d)](a24_0x5b98b0[_0x2685bc(0x1ff)]('✓')+_0x2685bc(0x1ef)+_0x5a7eeb+')')):(console['warn'](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1c8))),console[_0x2685bc(0x1f6)](a24_0x5b98b0[_0x2685bc(0x1e9)](_0x2685bc(0x1d4))));const _0x38922e={'site':_0x13731f,..._0xf28d44&&{'description':_0xf28d44}};return saveProfileToUserConfig(_0x5a7eeb,_0x38922e),console['log'](a24_0x5b98b0['green']('✓')+'\x20Profile\x20\x27'+_0x5a7eeb+_0x2685bc(0x211)),console[_0x2685bc(0x20d)](),console['log'](_0x2685bc(0x1ca)),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+'\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication'),console[_0x2685bc(0x20d)](_0x2685bc(0x1c3)+_0x5a7eeb+_0x2685bc(0x1da)),0x0;}catch(_0x2168f3){if(_0x2168f3 instanceof HTTPClientError&&_0x2168f3[_0x2685bc(0x207)]===0x191)return printAuthError(_0x2168f3),0x1;return console[_0x2685bc(0x1c2)](a24_0x5b98b0[_0x2685bc(0x1d1)](_0x2685bc(0x1cd)+(_0x2168f3 instanceof Error?_0x2168f3[_0x2685bc(0x1f5)]:String(_0x2168f3)))),console[_0x2685bc(0x1c2)](_0x2685bc(0x208)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1f9);[a24_0x205caa(0x220)]=a24_0x205caa(0x227);[a24_0x205caa(0x1f7)](_0x4ceb69){const _0x2c13bc=a24_0x205caa,{args:_0x59ca9f}=_0x4ceb69;if(_0x59ca9f[_0x2c13bc(0x1fb)]===0x0)return _0x2c13bc(0x1d6);return undefined;}async[a24_0x205caa(0x1e8)](_0x2a7928){const _0x334238=a24_0x205caa,{args:_0x341c0b}=_0x2a7928,_0xfda6c3=_0x341c0b[0x0];console['log'](a24_0x5b98b0['bold'](_0x334238(0x230)));if(!profileExists(_0xfda6c3)){console['error'](a24_0x5b98b0['red'](_0x334238(0x1bc)+_0xfda6c3+_0x334238(0x20b))),console[_0x334238(0x20d)](_0x334238(0x22b));const _0x2f80a7=listProfiles();if(_0x2f80a7[_0x334238(0x1fb)]===0x0)console[_0x334238(0x20d)](_0x334238(0x1b8));else for(const _0x10a981 of _0x2f80a7){console[_0x334238(0x20d)]('\x20\x20-\x20'+_0x10a981[_0x334238(0x1c1)]);}return 0x1;}const _0x21e342=await a24_0x5bba62({'type':_0x334238(0x22c),'name':_0x334238(0x22c),'message':_0x334238(0x1ba)+_0xfda6c3+'\x27?','initial':![]});if(!_0x21e342['confirm'])return console[_0x334238(0x20d)](_0x334238(0x206)),0x0;try{removeProfileFromUserConfig(_0xfda6c3),console[_0x334238(0x20d)](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x215)+_0xfda6c3+_0x334238(0x1fc));}catch(_0x407956){return console[_0x334238(0x1c2)](a24_0x5b98b0['red'](_0x334238(0x1ed)+(_0x407956 instanceof Error?_0x407956[_0x334238(0x1f5)]:String(_0x407956)))),0x1;}const _0x1db22d=await isKeychainAvailable();if(_0x1db22d){const _0x231490=await deleteKeychainAPIKey(_0xfda6c3);_0x231490&&console['log'](a24_0x5b98b0[_0x334238(0x1ff)]('✓')+_0x334238(0x221));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x22d);[a24_0x205caa(0x220)]='Set\x20a\x20profile\x20configuration\x20value';static [a24_0x205caa(0x1bf)]=['site',a24_0x205caa(0x1ee),a24_0x205caa(0x225),a24_0x205caa(0x22a),'llm_agent','description'];[a24_0x205caa(0x1f7)](_0x2d8ce0){const _0x491e4a=a24_0x205caa,{args:_0x32fb7f,options:_0x25e9ba}=_0x2d8ce0,_0x4b47cc=_0x25e9ba[_0x491e4a(0x212)]||getActiveProfile();if(!_0x4b47cc)return _0x491e4a(0x1d2);if(_0x32fb7f[_0x491e4a(0x1fb)]===0x0)return _0x491e4a(0x21e)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const _0x8e921=_0x32fb7f[0x0];if(!_0x8e921[_0x491e4a(0x229)]('='))return _0x491e4a(0x1e2)+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');const [_0x9a8212]=_0x8e921[_0x491e4a(0x1d0)]('=',0x2);if(!ProfileSetCommand[_0x491e4a(0x1bf)][_0x491e4a(0x229)](_0x9a8212))return'Unknown\x20key\x20\x27'+_0x9a8212+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x491e4a(0x1bf)]['join'](',\x20');return undefined;}async[a24_0x205caa(0x1e8)](_0x3cc1e6){const _0x1f3339=a24_0x205caa,{args:_0x5870f1,options:_0x3f07d7}=_0x3cc1e6,_0x86ef11=_0x3f07d7[_0x1f3339(0x212)]||getActiveProfile(),[_0x6ad09f,..._0x2a3023]=_0x5870f1[0x0][_0x1f3339(0x1d0)]('='),_0x526f92=_0x2a3023[_0x1f3339(0x210)]('=');console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1de)](_0x1f3339(0x1eb)));if(!profileExists(_0x86ef11)){const _0x811cbb=await a24_0x5bba62({'type':_0x1f3339(0x22c),'name':'create','message':_0x1f3339(0x1bc)+_0x86ef11+_0x1f3339(0x1f4),'initial':!![]});if(!_0x811cbb[_0x1f3339(0x21d)])return console[_0x1f3339(0x20d)]('Operation\x20cancelled'),0x1;}const _0x580526=loadProfile(_0x86ef11),_0x27df9e=_0x580526?.[_0x1f3339(0x1db)]||{};if(_0x6ad09f===_0x1f3339(0x1cb)){const _0x57c9b2=resolveSite(_0x526f92);console[_0x1f3339(0x20d)](_0x1f3339(0x1c7)+_0x57c9b2+_0x1f3339(0x21c)),console[_0x1f3339(0x20d)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x1f3339(0x20d)]('\x20\x20'+getConsoleUrl(_0x57c9b2,_0x1f3339(0x1e5)));const _0x5e3451=await a24_0x5bba62({'type':_0x1f3339(0x20c),'name':_0x1f3339(0x223),'message':_0x1f3339(0x21a),'validate':_0x20d0de=>{if(!_0x20d0de||!_0x20d0de['trim']())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x5e3451[_0x1f3339(0x223)])return console[_0x1f3339(0x20d)]('\x0aOperation\x20cancelled'),0x1;console[_0x1f3339(0x20d)](_0x1f3339(0x1cf));try{const _0x32a455=TDX['create']({'site':_0x57c9b2,'apiKey':_0x5e3451['apiKey'][_0x1f3339(0x1dc)](),'logLevel':_0x3f07d7[_0x1f3339(0x222)]??LogLevel['ERROR']}),_0x3c8928=await _0x32a455[_0x1f3339(0x200)][_0x1f3339(0x1c0)]();console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x1d5)+_0x3c8928[_0x1f3339(0x1fa)]+')');const _0x9d7bac=await isKeychainAvailable();_0x9d7bac?(await saveAPIKeyAsync(_0x5e3451['apiKey']['trim'](),_0x57c9b2,_0x86ef11),console[_0x1f3339(0x20d)](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+_0x1f3339(0x226))):console[_0x1f3339(0x1f6)](a24_0x5b98b0[_0x1f3339(0x1e9)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x27df9e[_0x1f3339(0x1cb)]=_0x57c9b2;}catch(_0x140676){if(_0x140676 instanceof HTTPClientError&&_0x140676['status']===0x191)return printAuthError(_0x140676),0x1;return console['error'](a24_0x5b98b0[_0x1f3339(0x1d1)](_0x1f3339(0x1cd)+(_0x140676 instanceof Error?_0x140676['message']:String(_0x140676)))),console[_0x1f3339(0x1c2)](_0x1f3339(0x1d8)),0x1;}}else _0x27df9e[_0x6ad09f]=_0x526f92||undefined;return saveProfileToUserConfig(_0x86ef11,_0x27df9e),console['log'](a24_0x5b98b0[_0x1f3339(0x1ff)]('✓')+'\x20Profile\x20\x27'+_0x86ef11+'\x27\x20updated:\x20'+_0x6ad09f+'='+(_0x526f92||_0x1f3339(0x1d9))),0x0;}}function a24_0x4d45(_0x360aab,_0x51a32e){_0x360aab=_0x360aab-0x1b8;const _0x50c7fd=a24_0x50c7();let _0x4d458f=_0x50c7fd[_0x360aab];return _0x4d458f;}export class ProfileUseCommand extends BaseCommand{[a24_0x205caa(0x1c1)]=a24_0x205caa(0x1ce);[a24_0x205caa(0x220)]=a24_0x205caa(0x1f3);['validate'](_0x5a909f){const _0xd81bac=a24_0x205caa,{args:_0x2c26e0}=_0x5a909f;if(_0x2c26e0[_0xd81bac(0x1fb)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]';return undefined;}async[a24_0x205caa(0x1e8)](_0x2e301c){const _0x4972bc=a24_0x205caa,{args:_0x3980d1,options:_0xc9ebe9}=_0x2e301c,_0x3dc70b=_0x3980d1[0x0],_0x2aac15=_0xc9ebe9[_0x4972bc(0x1df)];cleanExpiredSessions();if(!profileExists(_0x3dc70b)){console[_0x4972bc(0x1c2)](a24_0x5b98b0[_0x4972bc(0x1d1)](_0x4972bc(0x1bc)+_0x3dc70b+_0x4972bc(0x20b))),console[_0x4972bc(0x20d)]('\x0aAvailable\x20profiles:');const _0x189dda=listProfiles();if(_0x189dda[_0x4972bc(0x1fb)]===0x0)console[_0x4972bc(0x20d)](_0x4972bc(0x1b8));else for(const _0x351b01 of _0x189dda){console['log'](_0x4972bc(0x224)+_0x351b01[_0x4972bc(0x1c1)]);}return 0x1;}if(_0x2aac15){const _0x725665=a24_0x5f2b90[_0x4972bc(0x210)](getConfigDir(),_0x4972bc(0x213));return saveActiveProfileToUserConfig(_0x3dc70b),console['log'](_0x4972bc(0x214)+a24_0x5b98b0[_0x4972bc(0x1ff)](_0x3dc70b)),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aSaved\x20to:\x20'+_0x725665)),0x0;}const _0x22a78a=_0xc9ebe9[_0x4972bc(0x1d7)]||getCurrentSessionPID()[_0x4972bc(0x202)]();return saveSessionContext({'profile':_0x3dc70b},_0xc9ebe9[_0x4972bc(0x1d7)]),console['log']('Session\x20profile\x20set\x20to:\x20'+a24_0x5b98b0['green'](_0x3dc70b)+'\x20'+a24_0x5b98b0[_0x4972bc(0x1e1)](_0x4972bc(0x1f1)+_0x22a78a+')')),console[_0x4972bc(0x20d)](a24_0x5b98b0[_0x4972bc(0x1e1)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x3dc70b+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a24_0x40cbdb=a24_0x5463;(function(_0x1b76d0,_0x3665f6){const _0xadee9e=a24_0x5463,_0x1e67fe=_0x1b76d0();while(!![]){try{const _0xcc9fd9=parseInt(_0xadee9e(0x24a))/0x1*(parseInt(_0xadee9e(0x239))/0x2)+-parseInt(_0xadee9e(0x203))/0x3+parseInt(_0xadee9e(0x211))/0x4*(-parseInt(_0xadee9e(0x253))/0x5)+-parseInt(_0xadee9e(0x1f8))/0x6*(parseInt(_0xadee9e(0x1f7))/0x7)+parseInt(_0xadee9e(0x1f2))/0x8*(parseInt(_0xadee9e(0x250))/0x9)+-parseInt(_0xadee9e(0x248))/0xa*(-parseInt(_0xadee9e(0x21d))/0xb)+-parseInt(_0xadee9e(0x21f))/0xc*(-parseInt(_0xadee9e(0x228))/0xd);if(_0xcc9fd9===_0x3665f6)break;else _0x1e67fe['push'](_0x1e67fe['shift']());}catch(_0x17e115){_0x1e67fe['push'](_0x1e67fe['shift']());}}}(a24_0x4170,0x77029));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 a24_0x779409 from'node:path';function a24_0x4170(){const _0x4f69d7=['profile','bold','507330KWGBzs','\x20\x20tdx\x20--profile\x20','join','599920cyFTzy','database','Profile\x20name\x20cannot\x20be\x20empty','validate','\x0aSetup\x20cancelled','includes','Validating\x20API\x20key...','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','status','customSite','site','tdx:\x20profile\x20set','\x0aOperation\x20cancelled','apiKey','✗\x20Validation\x20failed:\x20','eu\x20\x20\x20-\x20Europe','create','config','Site\x20was\x20not\x20changed.','Failed\x20to\x20remove\x20profile:\x20','eu01','execute','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','API\x20key\x20cannot\x20be\x20empty','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','jp\x20\x20\x20-\x20Japan','Default\x20profile\x20set\x20to:\x20','length','8KlKfTN','Enter\x20your\x20TD\x20API\x20key:','\x27\x20created','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','\x20\x20-\x20','4039NuIXoU','516vnvYgJ','trim','us01','description','VALID_KEYS','You\x20can\x20find\x20your\x20API\x20key\x20at:','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_agent','\x0aAvailable\x20profiles:','\x27\x20does\x20not\x20exist.','llm_project','2377050runxgr','warn','message','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','test','profileName','yellow','error','\x20Profile\x20\x27','profile:set','Changing\x20site\x20to\x20\x27','dim','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','text','32CKkMdk','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','select','Enter\x20profile\x20name:','Create\x20a\x20new\x20profile','Set\x20session\x20profile','split','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','default','jp01','/app/mp/ak','5203BPDdlK','name','12sDRkci','jobs','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','getUserInfo','Profile\x20\x27','ERROR','ap02','Set\x20a\x20profile\x20configuration\x20value','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','9849359kaUDbv','other','profile:use','password','Enter\x20site\x20name:','\x27.\x0a\x0aValid\x20keys:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','red','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','email','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x27\x20requires\x20API\x20key\x20validation.','value','(session:\x20','Enter\x20custom\x20site','(cleared)','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>','6xROdKX','Remove\x20a\x20profile','\x20API\x20key\x20saved\x20to\x20system\x20keychain','push','\x27\x20updated:\x20','Site\x20name\x20cannot\x20be\x20empty','findIndex','session','\x20\x20(no\x20profiles\x20found)','ap02\x20-\x20Korea','logLevel','toString','profile:remove','\x20--default\x27\x20to\x20save\x20permanently','green','18470nBhOnv','confirm','200555CNBiXM','\x27\x20removed\x20from\x20configuration','log','\x20API\x20key\x20is\x20valid\x20(User:\x20'];a24_0x4170=function(){return _0x4f69d7;};return a24_0x4170();}import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';function a24_0x5463(_0x599899,_0x577942){_0x599899=_0x599899-0x1e5;const _0x4170d8=a24_0x4170();let _0x5463d8=_0x4170d8[_0x599899];return _0x5463d8;}import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a24_0x15f9ca from'prompts';import a24_0xc6a15a from'chalk';function validateProfileName(_0x212286){const _0x5780da=a24_0x5463;if(!_0x212286||!_0x212286['trim']())return _0x5780da(0x255);const _0x493b98=_0x212286[_0x5780da(0x1f9)]();if(!/^[a-zA-Z0-9_-]+$/[_0x5780da(0x207)](_0x493b98))return _0x5780da(0x221);if(profileExists(_0x493b98))return _0x5780da(0x223)+_0x493b98+_0x5780da(0x227);return!![];}export class ProfileCreateCommand extends BaseCommand{['name']='profile:create';[a24_0x40cbdb(0x1fb)]=a24_0x40cbdb(0x216);async['execute'](_0x362699){const _0x114069=a24_0x40cbdb,{options:_0x1b1abd,args:_0x2b92f7}=_0x362699;console['log'](a24_0xc6a15a[_0x114069(0x24f)]('tdx:\x20profile\x20create'));let _0xf5682a;if(_0x2b92f7[_0x114069(0x1f1)]>0x0&&_0x2b92f7[0x0]){const _0x472cc1=_0x2b92f7[0x0][_0x114069(0x1f9)](),_0x2e9f86=validateProfileName(_0x472cc1);if(_0x2e9f86!==!![])return console[_0x114069(0x20a)](a24_0xc6a15a['red'](_0x2e9f86)),0x1;_0xf5682a=_0x472cc1;}else{const _0x39057c=await a24_0x15f9ca({'type':_0x114069(0x210),'name':_0x114069(0x208),'message':_0x114069(0x215),'validate':validateProfileName});if(!_0x39057c['profileName'])return console['log'](_0x114069(0x257)),0x1;_0xf5682a=_0x39057c[_0x114069(0x208)][_0x114069(0x1f9)]();}const _0x3608fd=await a24_0x15f9ca({'type':_0x114069(0x210),'name':'description','message':'Enter\x20description\x20(optional):'}),_0x44f7e6=_0x3608fd[_0x114069(0x1fb)]?.['trim']()||undefined,_0x4530f1=_0x1b1abd[_0x114069(0x25d)]||_0x114069(0x1fa),_0x1452bb=[{'title':'us\x20\x20\x20-\x20United\x20States','value':_0x114069(0x1fa)},{'title':_0x114069(0x1ef),'value':_0x114069(0x21b)},{'title':_0x114069(0x1e5),'value':_0x114069(0x1ea)},{'title':_0x114069(0x242),'value':_0x114069(0x225)}];let _0xf9073a=_0x1452bb[_0x114069(0x23f)](_0xde7c8b=>_0xde7c8b[_0x114069(0x234)]===_0x4530f1);_0xf9073a===-0x1&&_0x4530f1!==_0x114069(0x1fa)&&(_0x1452bb[_0x114069(0x23c)]({'title':_0x4530f1,'value':_0x4530f1}),_0xf9073a=_0x1452bb[_0x114069(0x1f1)]-0x1);_0x1452bb['push']({'title':_0x114069(0x236),'value':_0x114069(0x229)});const _0x35f49c=await a24_0x15f9ca({'type':_0x114069(0x214),'name':_0x114069(0x25d),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0xf5682a+'\x27:','choices':_0x1452bb,'initial':_0xf9073a>=0x0?_0xf9073a:0x0});if(!_0x35f49c[_0x114069(0x25d)])return console[_0x114069(0x24c)](_0x114069(0x257)),0x1;let _0x32c07d;if(_0x35f49c[_0x114069(0x25d)]===_0x114069(0x229)){const _0x34fa7e=await a24_0x15f9ca({'type':_0x114069(0x210),'name':_0x114069(0x25c),'message':_0x114069(0x22c),'initial':'us01','validate':_0x272282=>{const _0x3af165=_0x114069;if(!_0x272282||!_0x272282[_0x3af165(0x1f9)]())return _0x3af165(0x23e);if(!/^[a-z0-9-]+$/['test'](_0x272282[_0x3af165(0x1f9)]()))return _0x3af165(0x230);return!![];}});if(!_0x34fa7e[_0x114069(0x25c)])return console[_0x114069(0x24c)]('\x0aSetup\x20cancelled'),0x1;_0x32c07d=_0x34fa7e[_0x114069(0x25c)];}else _0x32c07d=_0x35f49c['site'];const _0x430553=resolveSite(_0x32c07d);console[_0x114069(0x24c)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x430553),console[_0x114069(0x24c)](_0x114069(0x1fd)),console['log']('\x20\x20'+getConsoleUrl(_0x430553,_0x114069(0x21c)));const _0x1c5a6c=await a24_0x15f9ca({'type':_0x114069(0x22b),'name':_0x114069(0x260),'message':_0x114069(0x1f3),'validate':_0x194454=>{const _0x3652f9=_0x114069;if(!_0x194454||!_0x194454[_0x3652f9(0x1f9)]())return _0x3652f9(0x1ed);return!![];}});if(!_0x1c5a6c[_0x114069(0x260)])return console[_0x114069(0x24c)]('\x0aSetup\x20cancelled'),0x1;const _0x1bdc24=_0x1c5a6c['apiKey'];console['log'](_0x114069(0x259));try{const _0x13f469=TDX['create']({'site':_0x430553,'apiKey':_0x1bdc24[_0x114069(0x1f9)](),'logLevel':_0x1b1abd[_0x114069(0x243)]??LogLevel[_0x114069(0x224)]}),_0x43f5bb=await _0x13f469[_0x114069(0x220)][_0x114069(0x222)]();console[_0x114069(0x24c)](a24_0xc6a15a['green']('✓')+_0x114069(0x24d)+_0x43f5bb['email']+')');const _0xa13994=await isKeychainAvailable();_0xa13994?(await saveAPIKeyAsync(_0x1bdc24[_0x114069(0x1f9)](),_0x430553,_0xf5682a),console[_0x114069(0x24c)](a24_0xc6a15a['green']('✓')+_0x114069(0x1f5)+_0xf5682a+')')):(console[_0x114069(0x204)](a24_0xc6a15a[_0x114069(0x209)](_0x114069(0x25a))),console[_0x114069(0x204)](a24_0xc6a15a[_0x114069(0x209)](_0x114069(0x219))));const _0x68be90={'site':_0x430553,..._0x44f7e6&&{'description':_0x44f7e6}};return saveProfileToUserConfig(_0xf5682a,_0x68be90),console[_0x114069(0x24c)](a24_0xc6a15a[_0x114069(0x247)]('✓')+'\x20Profile\x20\x27'+_0xf5682a+_0x114069(0x1f4)),console[_0x114069(0x24c)](),console[_0x114069(0x24c)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console['log']('\x20\x20tdx\x20--profile\x20'+_0xf5682a+_0x114069(0x212)),console[_0x114069(0x24c)](_0x114069(0x251)+_0xf5682a+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2b93d4){if(_0x2b93d4 instanceof HTTPClientError&&_0x2b93d4[_0x114069(0x25b)]===0x191)return printAuthError(_0x2b93d4),0x1;return console['error'](a24_0xc6a15a[_0x114069(0x22f)](_0x114069(0x261)+(_0x2b93d4 instanceof Error?_0x2b93d4[_0x114069(0x205)]:String(_0x2b93d4)))),console[_0x114069(0x20a)](_0x114069(0x20f)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{['name']=a24_0x40cbdb(0x245);['description']=a24_0x40cbdb(0x23a);[a24_0x40cbdb(0x256)](_0xd6653b){const _0x2815e5=a24_0x40cbdb,{args:_0x481fa6}=_0xd6653b;if(_0x481fa6[_0x2815e5(0x1f1)]===0x0)return _0x2815e5(0x213);return undefined;}async[a24_0x40cbdb(0x1eb)](_0x2ca29f){const _0x174698=a24_0x40cbdb,{args:_0x5acedb}=_0x2ca29f,_0x45ea93=_0x5acedb[0x0];console[_0x174698(0x24c)](a24_0xc6a15a[_0x174698(0x24f)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x45ea93)){console[_0x174698(0x20a)](a24_0xc6a15a['red'](_0x174698(0x223)+_0x45ea93+_0x174698(0x201))),console['log'](_0x174698(0x200));const _0x4cfa78=listProfiles();if(_0x4cfa78[_0x174698(0x1f1)]===0x0)console['log'](_0x174698(0x241));else for(const _0xb5f3d3 of _0x4cfa78){console[_0x174698(0x24c)](_0x174698(0x1f6)+_0xb5f3d3['name']);}return 0x1;}const _0x131228=await a24_0x15f9ca({'type':'confirm','name':_0x174698(0x249),'message':_0x174698(0x22e)+_0x45ea93+'\x27?','initial':![]});if(!_0x131228[_0x174698(0x249)])return console[_0x174698(0x24c)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x45ea93),console[_0x174698(0x24c)](a24_0xc6a15a[_0x174698(0x247)]('✓')+_0x174698(0x20b)+_0x45ea93+_0x174698(0x24b));}catch(_0x5412ef){return console[_0x174698(0x20a)](a24_0xc6a15a[_0x174698(0x22f)](_0x174698(0x1e9)+(_0x5412ef instanceof Error?_0x5412ef[_0x174698(0x205)]:String(_0x5412ef)))),0x1;}const _0x22733f=await isKeychainAvailable();if(_0x22733f){const _0x392467=await deleteKeychainAPIKey(_0x45ea93);_0x392467&&console[_0x174698(0x24c)](a24_0xc6a15a['green']('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a24_0x40cbdb(0x21e)]=a24_0x40cbdb(0x20c);['description']=a24_0x40cbdb(0x226);static [a24_0x40cbdb(0x1fc)]=[a24_0x40cbdb(0x25d),a24_0x40cbdb(0x254),'parent_segment',a24_0x40cbdb(0x202),a24_0x40cbdb(0x1ff),'description'];[a24_0x40cbdb(0x256)](_0x5bf499){const _0xc07b8a=a24_0x40cbdb,{args:_0x26b5a6,options:_0x2df9a9}=_0x5bf499,_0x18af58=_0x2df9a9[_0xc07b8a(0x24e)]||getActiveProfile();if(!_0x18af58)return _0xc07b8a(0x238);if(_0x26b5a6[_0xc07b8a(0x1f1)]===0x0)return _0xc07b8a(0x1fe)+ProfileSetCommand[_0xc07b8a(0x1fc)][_0xc07b8a(0x252)](',\x20');const _0x2a07b9=_0x26b5a6[0x0];if(!_0x2a07b9[_0xc07b8a(0x258)]('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0xc07b8a(0x1fc)]['join'](',\x20');const [_0x2ca15a]=_0x2a07b9['split']('=',0x2);if(!ProfileSetCommand[_0xc07b8a(0x1fc)]['includes'](_0x2ca15a))return'Unknown\x20key\x20\x27'+_0x2ca15a+_0xc07b8a(0x22d)+ProfileSetCommand[_0xc07b8a(0x1fc)]['join'](',\x20');return undefined;}async['execute'](_0x1ae3a3){const _0x4e3414=a24_0x40cbdb,{args:_0x3a90f0,options:_0x572c96}=_0x1ae3a3,_0x5289d2=_0x572c96[_0x4e3414(0x24e)]||getActiveProfile(),[_0x111533,..._0x27cbf0]=_0x3a90f0[0x0][_0x4e3414(0x218)]('='),_0x86d1e1=_0x27cbf0[_0x4e3414(0x252)]('=');console[_0x4e3414(0x24c)](a24_0xc6a15a[_0x4e3414(0x24f)](_0x4e3414(0x25e)));if(!profileExists(_0x5289d2)){const _0x5930f5=await a24_0x15f9ca({'type':'confirm','name':_0x4e3414(0x1e6),'message':_0x4e3414(0x223)+_0x5289d2+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x5930f5[_0x4e3414(0x1e6)])return console[_0x4e3414(0x24c)]('Operation\x20cancelled'),0x1;}const _0x5c5a70=loadProfile(_0x5289d2),_0x26e759=_0x5c5a70?.[_0x4e3414(0x1e7)]||{};if(_0x111533===_0x4e3414(0x25d)){const _0x23dca1=resolveSite(_0x86d1e1);console['log'](_0x4e3414(0x20d)+_0x23dca1+_0x4e3414(0x233)),console['log'](_0x4e3414(0x1ee)),console[_0x4e3414(0x24c)]('\x20\x20'+getConsoleUrl(_0x23dca1,_0x4e3414(0x21c)));const _0x55fb07=await a24_0x15f9ca({'type':_0x4e3414(0x22b),'name':_0x4e3414(0x260),'message':_0x4e3414(0x232),'validate':_0x558341=>{const _0x3ffd00=_0x4e3414;if(!_0x558341||!_0x558341['trim']())return _0x3ffd00(0x1ed);return!![];}});if(!_0x55fb07[_0x4e3414(0x260)])return console[_0x4e3414(0x24c)](_0x4e3414(0x25f)),0x1;console[_0x4e3414(0x24c)]('Validating\x20API\x20key...');try{const _0x1a26a1=TDX[_0x4e3414(0x1e6)]({'site':_0x23dca1,'apiKey':_0x55fb07[_0x4e3414(0x260)][_0x4e3414(0x1f9)](),'logLevel':_0x572c96[_0x4e3414(0x243)]??LogLevel['ERROR']}),_0x5cc4fa=await _0x1a26a1[_0x4e3414(0x220)][_0x4e3414(0x222)]();console['log'](a24_0xc6a15a[_0x4e3414(0x247)]('✓')+_0x4e3414(0x24d)+_0x5cc4fa[_0x4e3414(0x231)]+')');const _0x22b7db=await isKeychainAvailable();_0x22b7db?(await saveAPIKeyAsync(_0x55fb07['apiKey'][_0x4e3414(0x1f9)](),_0x23dca1,_0x5289d2),console[_0x4e3414(0x24c)](a24_0xc6a15a[_0x4e3414(0x247)]('✓')+_0x4e3414(0x23b))):console[_0x4e3414(0x204)](a24_0xc6a15a[_0x4e3414(0x209)](_0x4e3414(0x25a))),_0x26e759[_0x4e3414(0x25d)]=_0x23dca1;}catch(_0x1b1822){if(_0x1b1822 instanceof HTTPClientError&&_0x1b1822[_0x4e3414(0x25b)]===0x191)return printAuthError(_0x1b1822),0x1;return console[_0x4e3414(0x20a)](a24_0xc6a15a[_0x4e3414(0x22f)](_0x4e3414(0x261)+(_0x1b1822 instanceof Error?_0x1b1822[_0x4e3414(0x205)]:String(_0x1b1822)))),console[_0x4e3414(0x20a)](_0x4e3414(0x1e8)),0x1;}}else _0x26e759[_0x111533]=_0x86d1e1||undefined;return saveProfileToUserConfig(_0x5289d2,_0x26e759),console[_0x4e3414(0x24c)](a24_0xc6a15a['green']('✓')+'\x20Profile\x20\x27'+_0x5289d2+_0x4e3414(0x23d)+_0x111533+'='+(_0x86d1e1||_0x4e3414(0x237))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a24_0x40cbdb(0x21e)]=a24_0x40cbdb(0x22a);[a24_0x40cbdb(0x1fb)]=a24_0x40cbdb(0x217);['validate'](_0x5c5876){const _0x1b71ed=a24_0x40cbdb,{args:_0xafdf42}=_0x5c5876;if(_0xafdf42[_0x1b71ed(0x1f1)]===0x0)return _0x1b71ed(0x206);return undefined;}async['execute'](_0x1c7b4e){const _0x41341d=a24_0x40cbdb,{args:_0x27f1f4,options:_0x150302}=_0x1c7b4e,_0x324f=_0x27f1f4[0x0],_0x1f8d58=_0x150302[_0x41341d(0x21a)];cleanExpiredSessions();if(!profileExists(_0x324f)){console['error'](a24_0xc6a15a[_0x41341d(0x22f)](_0x41341d(0x223)+_0x324f+_0x41341d(0x201))),console[_0x41341d(0x24c)](_0x41341d(0x200));const _0x2f94a8=listProfiles();if(_0x2f94a8['length']===0x0)console[_0x41341d(0x24c)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x9af435 of _0x2f94a8){console['log'](_0x41341d(0x1f6)+_0x9af435[_0x41341d(0x21e)]);}return 0x1;}if(_0x1f8d58){const _0x4f43b1=a24_0x779409['join'](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x324f),console[_0x41341d(0x24c)](_0x41341d(0x1f0)+a24_0xc6a15a[_0x41341d(0x247)](_0x324f)),console['log'](a24_0xc6a15a[_0x41341d(0x20e)]('\x0aSaved\x20to:\x20'+_0x4f43b1)),0x0;}const _0x341523=_0x150302[_0x41341d(0x240)]||getCurrentSessionPID()[_0x41341d(0x244)]();return saveSessionContext({'profile':_0x324f},_0x150302[_0x41341d(0x240)]),console[_0x41341d(0x24c)]('Session\x20profile\x20set\x20to:\x20'+a24_0xc6a15a[_0x41341d(0x247)](_0x324f)+'\x20'+a24_0xc6a15a[_0x41341d(0x20e)](_0x41341d(0x235)+_0x341523+')')),console[_0x41341d(0x24c)](a24_0xc6a15a[_0x41341d(0x20e)](_0x41341d(0x1ec)+_0x324f+_0x41341d(0x246))),0x0;}}
@@ -1 +1 @@
1
- const a25_0x216c0c=a25_0x3ba0;function a25_0x3ba0(_0x97c13b,_0x47f9a5){_0x97c13b=_0x97c13b-0xd8;const _0x1be61c=a25_0x1be6();let _0x3ba077=_0x1be61c[_0x97c13b];return _0x3ba077;}(function(_0x33c8c3,_0xe8fa97){const _0x49e5ad=a25_0x3ba0,_0x4a04dd=_0x33c8c3();while(!![]){try{const _0x333efa=-parseInt(_0x49e5ad(0xdd))/0x1*(parseInt(_0x49e5ad(0xd8))/0x2)+parseInt(_0x49e5ad(0xe2))/0x3+-parseInt(_0x49e5ad(0xe7))/0x4+parseInt(_0x49e5ad(0xe4))/0x5*(-parseInt(_0x49e5ad(0xe6))/0x6)+-parseInt(_0x49e5ad(0xdc))/0x7*(-parseInt(_0x49e5ad(0xe0))/0x8)+parseInt(_0x49e5ad(0xdb))/0x9+parseInt(_0x49e5ad(0xea))/0xa*(parseInt(_0x49e5ad(0xdf))/0xb);if(_0x333efa===_0xe8fa97)break;else _0x4a04dd['push'](_0x4a04dd['shift']());}catch(_0x329f42){_0x4a04dd['push'](_0x4a04dd['shift']());}}}(a25_0x1be6,0x676cb));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';[a25_0x216c0c(0xec)]=a25_0x216c0c(0xe5);async['execute'](_0x37b531){const _0x1a279e=a25_0x216c0c,{options:_0x52c0d9}=_0x37b531;try{const _0x56b46a=listProfiles(),_0x3eea7f=getActiveProfile();if(_0x56b46a[_0x1a279e(0xeb)]===0x0)return console[_0x1a279e(0xde)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x1a279e(0xed)),console['log'](_0x1a279e(0xe1)),0x0;const _0x2fea1a=_0x56b46a['map'](_0x124688=>{const _0x5b8a88=_0x1a279e,_0x1bbaea=_0x124688[_0x5b8a88(0xe3)]===_0x3eea7f,_0x4fc05a=getProfileParams(_0x124688[_0x5b8a88(0xe9)]);return{'name':_0x124688[_0x5b8a88(0xe3)],'active':_0x1bbaea,'scope':_0x124688[_0x5b8a88(0xe8)],'description':_0x124688[_0x5b8a88(0xe9)][_0x5b8a88(0xec)]||'','params':_0x4fc05a};});return await handleSDKOutput(_0x2fea1a,_0x52c0d9),0x0;}catch(_0x906d4d){return _0x906d4d instanceof Error&&console[_0x1a279e(0xda)]('Error:\x20'+_0x906d4d[_0x1a279e(0xd9)]),0x1;}}}function a25_0x1be6(){const _0x4d75e9=['config','152980jSDnNp','length','description','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','37010IldXiw','message','error','862983cgceKb','7KixLRh','45jWGOzG','log','1221UbILmI','848440xbgOLX','\x20\x20Global:\x20~/.config/tdx/tdx.json','663255CnYfKK','name','889135LvYCTi','List\x20all\x20available\x20profiles','12XkJsZV','2036396RbTdjY','scope'];a25_0x1be6=function(){return _0x4d75e9;};return a25_0x1be6();}
1
+ const a25_0x19c7e1=a25_0x35ef;function a25_0x35ef(_0x29f4e7,_0x38eb2c){_0x29f4e7=_0x29f4e7-0x118;const _0x1d17a6=a25_0x1d17();let _0x35ef9f=_0x1d17a6[_0x29f4e7];return _0x35ef9f;}(function(_0x2dfb58,_0x436ea2){const _0x3c9bad=a25_0x35ef,_0x2b7fd0=_0x2dfb58();while(!![]){try{const _0x4e1d79=parseInt(_0x3c9bad(0x118))/0x1*(-parseInt(_0x3c9bad(0x126))/0x2)+-parseInt(_0x3c9bad(0x11e))/0x3*(-parseInt(_0x3c9bad(0x11b))/0x4)+parseInt(_0x3c9bad(0x120))/0x5*(-parseInt(_0x3c9bad(0x11c))/0x6)+parseInt(_0x3c9bad(0x121))/0x7+parseInt(_0x3c9bad(0x11d))/0x8*(parseInt(_0x3c9bad(0x12c))/0x9)+parseInt(_0x3c9bad(0x12a))/0xa+-parseInt(_0x3c9bad(0x125))/0xb;if(_0x4e1d79===_0x436ea2)break;else _0x2b7fd0['push'](_0x2b7fd0['shift']());}catch(_0x5a3f99){_0x2b7fd0['push'](_0x2b7fd0['shift']());}}}(a25_0x1d17,0x4a9b1));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a25_0x1d17(){const _0x34442a=['description','1075YICZaI','3480785iutAzZ','error','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','1052139VDFPzh','2rGyRIK','profiles','name','map','800400ykoiSS','scope','453861tDkOJN','452836eZqgeN','config','\x20\x20Global:\x20~/.config/tdx/tdx.json','963772aPGtzx','3222uWLuZf','24rOoEgn','3sMYABi'];a25_0x1d17=function(){return _0x34442a;};return a25_0x1d17();}export class ProfilesCommand extends BaseCommand{[a25_0x19c7e1(0x128)]=a25_0x19c7e1(0x127);[a25_0x19c7e1(0x11f)]='List\x20all\x20available\x20profiles';async['execute'](_0x59c058){const _0xfa0ea9=a25_0x19c7e1,{options:_0x3b752d}=_0x59c058;try{const _0x578d6c=listProfiles(),_0x176927=getActiveProfile();if(_0x578d6c['length']===0x0)return console[_0xfa0ea9(0x124)]('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0xfa0ea9(0x123)),console['log'](_0xfa0ea9(0x11a)),0x0;const _0x464661=_0x578d6c[_0xfa0ea9(0x129)](_0x3e4ac9=>{const _0x3a5d1f=_0xfa0ea9,_0x522bd6=_0x3e4ac9[_0x3a5d1f(0x128)]===_0x176927,_0x1603e7=getProfileParams(_0x3e4ac9[_0x3a5d1f(0x119)]);return{'name':_0x3e4ac9[_0x3a5d1f(0x128)],'active':_0x522bd6,'scope':_0x3e4ac9[_0x3a5d1f(0x12b)],'description':_0x3e4ac9[_0x3a5d1f(0x119)][_0x3a5d1f(0x11f)]||'','params':_0x1603e7};});return await handleSDKOutput(_0x464661,_0x3b752d),0x0;}catch(_0x667dd3){return _0x667dd3 instanceof Error&&console[_0xfa0ea9(0x122)]('Error:\x20'+_0x667dd3['message']),0x1;}}}
@@ -1 +1 @@
1
- const a26_0x4402e4=a26_0x2b6a;(function(_0x554d54,_0x3ff54e){const _0xfcd5c6=a26_0x2b6a,_0x1495a8=_0x554d54();while(!![]){try{const _0x99ba8a=parseInt(_0xfcd5c6(0xe6))/0x1+parseInt(_0xfcd5c6(0xdf))/0x2+-parseInt(_0xfcd5c6(0x101))/0x3*(-parseInt(_0xfcd5c6(0xe9))/0x4)+-parseInt(_0xfcd5c6(0xff))/0x5+parseInt(_0xfcd5c6(0xf2))/0x6+-parseInt(_0xfcd5c6(0xf8))/0x7*(parseInt(_0xfcd5c6(0xdc))/0x8)+parseInt(_0xfcd5c6(0x103))/0x9*(-parseInt(_0xfcd5c6(0xe5))/0xa);if(_0x99ba8a===_0x3ff54e)break;else _0x1495a8['push'](_0x1495a8['shift']());}catch(_0x4042be){_0x1495a8['push'](_0x1495a8['shift']());}}}(a26_0x2cb9,0xaa4f7));function a26_0x2b6a(_0x2504f1,_0x182040){_0x2504f1=_0x2504f1-0xda;const _0x2cb9de=a26_0x2cb9();let _0x2b6ac4=_0x2cb9de[_0x2504f1];return _0x2b6ac4;}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';import{formatRows}from'../sdk/util/formatters.js';function a26_0x2cb9(){const _0x4d23ad=['15xPbbVp','\x20[Job\x20ID:\x20','88227PJHOiC','Executing\x20query...','processedRows','error','totalSplits','in\x20','catalog','Executing\x20statement\x20','options','length','jobId','setJobId','7408tmUzfq','Error:\x20','Site:\x20','922800hqupqH','database','\x0aAll\x20results\x20saved\x20to\x20','\x20-\x20','data','file','1010RxtPQR','1057411xLgpQq','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','name','712688MLlEPq','elapsedTimeMillis','args','\x20rows\x20','Schema:\x20','query','Query\x20completed:\x20Processed\x20','Catalog:\x20','execute','4458978KYiIXg','verbose','No\x20SQL\x20provided','Statement\x20','completedSplits','site','7385gdtcTj','SQL:\x20','output','Run\x20Trino\x20queries\x20(streaming)','validate','\x20splits','stats','2441050LoLTuE','push'];a26_0x2cb9=function(){return _0x4d23ad;};return a26_0x2cb9();}export class QueryCommand extends BaseCommand{[a26_0x4402e4(0xe8)]=a26_0x4402e4(0xee);['description']=a26_0x4402e4(0xfb);async[a26_0x4402e4(0xf1)](_0x5073f0){const _0x259bd0=a26_0x4402e4,{options:_0x5e7855,args:_0x278ec9,tdx:_0x3d080d}=_0x5073f0,_0x23ab52=_0x278ec9[0x0],_0x16a31a=_0x5e7855[_0x259bd0(0xe4)];let _0x802af2;try{if(_0x16a31a)_0x802af2=readSqlStatementsFromFile(_0x16a31a);else{if(_0x23ab52==='-')_0x802af2=await readSqlStatementsFromStdin();else{if(_0x23ab52&&isSqlFilePath(_0x23ab52))_0x802af2=readSqlStatementsFromFile(_0x23ab52);else{if(_0x23ab52)_0x802af2=splitSqlStatements(_0x23ab52);else throw new Error(_0x259bd0(0xf4));}}}}catch(_0x4d9ffc){return console[_0x259bd0(0x106)](_0x259bd0(0xdd)+_0x4d9ffc['message']),0x1;}const _0x2dee46=_0x5e7855[_0x259bd0(0xe0)]||'information_schema',_0x2197d6=_0x5e7855[_0x259bd0(0x109)];try{const _0x457641=[],_0x4cd6fa=!!_0x5e7855[_0x259bd0(0xfa)];for(let _0x49d0a0=0x0;_0x49d0a0<_0x802af2[_0x259bd0(0x10c)];_0x49d0a0++){const _0x21d951=_0x802af2[_0x49d0a0],_0x85d2ff=_0x49d0a0+0x1,_0x19573e=_0x802af2[_0x259bd0(0x10c)],_0x6ff6cc=_0x19573e>0x1;_0x5e7855[_0x259bd0(0xf3)]&&(console[_0x259bd0(0x106)]('\x0a'+(_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+':':'')),console[_0x259bd0(0x106)](_0x259bd0(0xde)+_0x5e7855[_0x259bd0(0xf7)]),console[_0x259bd0(0x106)](_0x259bd0(0xf0)+(_0x2197d6||'td')),console['error'](_0x259bd0(0xed)+_0x2dee46),console['error'](_0x259bd0(0xf9)+_0x21d951));const _0x1e6f43=_0x6ff6cc?_0x259bd0(0x10a)+_0x85d2ff+'/'+_0x19573e+'...':_0x259bd0(0x104);try{const _0x4e93b8=await withProgressSpinner(_0x1e6f43,async _0x5d9dc6=>{const _0x4758d0=await _0x3d080d['query']['execute'](_0x21d951,{'catalog':_0x2197d6,'schema':_0x2dee46,'onJobId':_0x4c91bc=>{const _0x817481=a26_0x2b6a;_0x5d9dc6[_0x817481(0xdb)](_0x4c91bc);},'onProgress':_0x5b7a68=>{const _0x460a05=a26_0x2b6a;_0x5d9dc6['setPhase']('Executing\x20query\x20['+_0x5b7a68['state']+']'),_0x5d9dc6['setExtra'](formatRows(_0x5b7a68['processedRows'])+_0x460a05(0xec)+_0x5b7a68[_0x460a05(0xf6)]+'/'+_0x5b7a68[_0x460a05(0x107)]+_0x460a05(0xfd));}});return _0x4758d0;},{'verbose':_0x5e7855[_0x259bd0(0xf3)]}),_0x57eadc=_0x4e93b8[_0x259bd0(0xe3)],_0x52696d=_0x57eadc['jobId']?_0x259bd0(0x102)+_0x57eadc[_0x259bd0(0xda)]+']':'',_0x2fe8f3=_0x6ff6cc?_0x259bd0(0xf5)+_0x85d2ff+'/'+_0x19573e+_0x259bd0(0xe2):'';console['error']('✔\x20'+_0x2fe8f3+_0x259bd0(0xef)+formatRows(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0x105)])+_0x259bd0(0xec)+(_0x259bd0(0x108)+formatElapsed(_0x57eadc[_0x259bd0(0xfe)][_0x259bd0(0xea)])+_0x52696d));if(_0x6ff6cc&&_0x4cd6fa){const _0x53a5d6=resolveOutputOptions(_0x5e7855),_0x588a10=await formatQueryOutput(_0x57eadc,_0x53a5d6);_0x457641[_0x259bd0(0x100)](_0x588a10);}else await handleQueryOutput(_0x57eadc,_0x5e7855);}catch(_0x81ecb3){const _0x582818=_0x6ff6cc?'Statement\x20'+_0x85d2ff+'/'+_0x19573e+':\x0a':'',_0xa7cfb6=_0x81ecb3 instanceof SDKError?_0x81ecb3['originalMessage']:_0x81ecb3['message'];return console[_0x259bd0(0x106)](''+_0x582818+_0xa7cfb6),0x1;}}if(_0x802af2[_0x259bd0(0x10c)]>0x1&&_0x4cd6fa&&_0x457641['length']>0x0){const _0x2deea8=_0x457641['join']('\x0a');writeFileSync(_0x5e7855['output'],_0x2deea8),console['error'](_0x259bd0(0xe1)+_0x5e7855[_0x259bd0(0xfa)]);}return 0x0;}catch(_0x493cd6){throw _0x493cd6;}}[a26_0x4402e4(0xfc)](_0xfc7ddc){const _0x68fb88=a26_0x4402e4,_0x29d776=_0xfc7ddc[_0x68fb88(0xeb)][0x0],_0x30bee6=_0xfc7ddc[_0x68fb88(0x10b)][_0x68fb88(0xe4)];if(!_0x29d776&&!_0x30bee6)return _0x68fb88(0xe7);if(_0x29d776&&_0x30bee6)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a26_0x3cc7cb=a26_0x22ff;(function(_0x521e75,_0x1937f2){const _0x35f736=a26_0x22ff,_0x3aef30=_0x521e75();while(!![]){try{const _0x9f4551=-parseInt(_0x35f736(0xb1))/0x1*(-parseInt(_0x35f736(0xb4))/0x2)+-parseInt(_0x35f736(0x98))/0x3+-parseInt(_0x35f736(0xa9))/0x4*(parseInt(_0x35f736(0xa4))/0x5)+parseInt(_0x35f736(0xbe))/0x6*(-parseInt(_0x35f736(0x9d))/0x7)+-parseInt(_0x35f736(0xbb))/0x8*(-parseInt(_0x35f736(0x9e))/0x9)+parseInt(_0x35f736(0x99))/0xa*(parseInt(_0x35f736(0xae))/0xb)+-parseInt(_0x35f736(0xbd))/0xc*(parseInt(_0x35f736(0xb9))/0xd);if(_0x9f4551===_0x1937f2)break;else _0x3aef30['push'](_0x3aef30['shift']());}catch(_0x266269){_0x3aef30['push'](_0x3aef30['shift']());}}}(a26_0x443e,0xca017));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a26_0x22ff(_0x2aa844,_0x3a5866){_0x2aa844=_0x2aa844-0x94;const _0x443e6c=a26_0x443e();let _0x22ff42=_0x443e6c[_0x2aa844];return _0x22ff42;}function a26_0x443e(){const _0xdb85f2=['Statement\x20','catalog','query','44QJjXTg','Catalog:\x20','Site:\x20','138562YzeBkH','database','setPhase','16PTgyCZ','\x20-\x20','message','completedSplits','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','16466671FoXoXY','output','8RutkSz','Executing\x20query...','12IxtKTC','18tTloaA','No\x20SQL\x20provided','processedRows','Executing\x20statement\x20','join','\x20rows\x20','originalMessage','Query\x20completed:\x20Processed\x20','execute','Executing\x20query\x20[','1553670TjkkQq','1818370xzlEuR','length','verbose','file','1637167UoEsTK','14177655IavoTN','name','stats','setJobId','site','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','945ICZgjv','Run\x20Trino\x20queries\x20(streaming)','data','setExtra','validate','2064wRTqDf','error'];a26_0x443e=function(){return _0xdb85f2;};return a26_0x443e();}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{[a26_0x3cc7cb(0x9f)]=a26_0x3cc7cb(0xad);['description']=a26_0x3cc7cb(0xa5);async['execute'](_0x52fea8){const _0x53c5fd=a26_0x3cc7cb,{options:_0x1e1683,args:_0xa9e44b,tdx:_0x1f25f6}=_0x52fea8,_0x4af38a=_0xa9e44b[0x0],_0x14886b=_0x1e1683['file'];let _0x4d0bd8;try{if(_0x14886b)_0x4d0bd8=readSqlStatementsFromFile(_0x14886b);else{if(_0x4af38a==='-')_0x4d0bd8=await readSqlStatementsFromStdin();else{if(_0x4af38a&&isSqlFilePath(_0x4af38a))_0x4d0bd8=readSqlStatementsFromFile(_0x4af38a);else{if(_0x4af38a)_0x4d0bd8=splitSqlStatements(_0x4af38a);else throw new Error(_0x53c5fd(0xbf));}}}}catch(_0x5c93b6){return console[_0x53c5fd(0xaa)]('Error:\x20'+_0x5c93b6[_0x53c5fd(0xb6)]),0x1;}const _0x2ef55d=_0x1e1683[_0x53c5fd(0xb2)]||'information_schema',_0xedccd1=_0x1e1683[_0x53c5fd(0xac)];try{const _0x1f6736=[],_0x331531=!!_0x1e1683['output'];for(let _0x4a3332=0x0;_0x4a3332<_0x4d0bd8['length'];_0x4a3332++){const _0x343971=_0x4d0bd8[_0x4a3332],_0x588612=_0x4a3332+0x1,_0x7ffbc6=_0x4d0bd8[_0x53c5fd(0x9a)],_0x16dc06=_0x7ffbc6>0x1;_0x1e1683[_0x53c5fd(0x9b)]&&(console[_0x53c5fd(0xaa)]('\x0a'+(_0x16dc06?_0x53c5fd(0xab)+_0x588612+'/'+_0x7ffbc6+':':'')),console[_0x53c5fd(0xaa)](_0x53c5fd(0xb0)+_0x1e1683[_0x53c5fd(0xa2)]),console[_0x53c5fd(0xaa)](_0x53c5fd(0xaf)+(_0xedccd1||'td')),console[_0x53c5fd(0xaa)]('Schema:\x20'+_0x2ef55d),console[_0x53c5fd(0xaa)]('SQL:\x20'+_0x343971));const _0x11e17c=_0x16dc06?_0x53c5fd(0xc1)+_0x588612+'/'+_0x7ffbc6+'...':_0x53c5fd(0xbc);try{const _0x33769c=await withProgressSpinner(_0x11e17c,async _0x2de4d7=>{const _0x5a94dc=_0x53c5fd,_0x46a8fb=await _0x1f25f6[_0x5a94dc(0xad)][_0x5a94dc(0x96)](_0x343971,{'catalog':_0xedccd1,'schema':_0x2ef55d,'onJobId':_0x37ed7c=>{const _0x3bb4c5=_0x5a94dc;_0x2de4d7[_0x3bb4c5(0xa1)](_0x37ed7c);},'onProgress':_0x2b9f90=>{const _0x27f7a2=_0x5a94dc;_0x2de4d7[_0x27f7a2(0xb3)](_0x27f7a2(0x97)+_0x2b9f90['state']+']'),_0x2de4d7[_0x27f7a2(0xa7)](formatRows(_0x2b9f90[_0x27f7a2(0xc0)])+'\x20rows\x20'+_0x2b9f90[_0x27f7a2(0xb7)]+'/'+_0x2b9f90['totalSplits']+'\x20splits');}});return _0x46a8fb;},{'verbose':_0x1e1683['verbose']}),_0x572f9e=_0x33769c[_0x53c5fd(0xa6)],_0x302080=_0x572f9e['jobId']?'\x20[Job\x20ID:\x20'+_0x572f9e['jobId']+']':'',_0x1c32b6=_0x16dc06?'Statement\x20'+_0x588612+'/'+_0x7ffbc6+_0x53c5fd(0xb5):'';console[_0x53c5fd(0xaa)]('✔\x20'+_0x1c32b6+_0x53c5fd(0x95)+formatRows(_0x572f9e[_0x53c5fd(0xa0)][_0x53c5fd(0xc0)])+_0x53c5fd(0xc3)+('in\x20'+formatElapsed(_0x572f9e[_0x53c5fd(0xa0)]['elapsedTimeMillis'])+_0x302080));if(_0x16dc06&&_0x331531){const _0x598c85=resolveOutputOptions(_0x1e1683),_0x1d2926=await formatQueryOutput(_0x572f9e,_0x598c85);_0x1f6736['push'](_0x1d2926);}else await handleQueryOutput(_0x572f9e,_0x1e1683);}catch(_0x289846){const _0x4a5187=_0x16dc06?'Statement\x20'+_0x588612+'/'+_0x7ffbc6+':\x0a':'',_0x41ead1=_0x289846 instanceof SDKError?_0x289846[_0x53c5fd(0x94)]:_0x289846[_0x53c5fd(0xb6)];return console[_0x53c5fd(0xaa)](''+_0x4a5187+_0x41ead1),0x1;}}if(_0x4d0bd8[_0x53c5fd(0x9a)]>0x1&&_0x331531&&_0x1f6736[_0x53c5fd(0x9a)]>0x0){const _0x4ee5a2=_0x1f6736[_0x53c5fd(0xc2)]('\x0a');writeFileSync(_0x1e1683[_0x53c5fd(0xba)],_0x4ee5a2),console['error']('\x0aAll\x20results\x20saved\x20to\x20'+_0x1e1683[_0x53c5fd(0xba)]);}return 0x0;}catch(_0x4fa341){throw _0x4fa341;}}[a26_0x3cc7cb(0xa8)](_0x4d3c30){const _0xbf5224=a26_0x3cc7cb,_0x1d4cc0=_0x4d3c30['args'][0x0],_0x34cf46=_0x4d3c30['options'][_0xbf5224(0x9c)];if(!_0x1d4cc0&&!_0x34cf46)return _0xbf5224(0xb8);if(_0x1d4cc0&&_0x34cf46)return _0xbf5224(0xa3);return undefined;}}