@treasuredata/tdx 0.14.7 → 0.14.9

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 (145) hide show
  1. package/README.md +21 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-command.js +1 -1
  8. package/dist/commands/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/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/segment-command.js +1 -1
  29. package/dist/commands/segment-create-command.js +1 -1
  30. package/dist/commands/segment-fields-command.js +1 -1
  31. package/dist/commands/segment-pull-command.js +1 -1
  32. package/dist/commands/segment-push-command.js +1 -1
  33. package/dist/commands/segment-update-command.js +1 -1
  34. package/dist/commands/segment-use-command.js +1 -1
  35. package/dist/commands/segment-validate-command.js +1 -1
  36. package/dist/commands/segments.js +1 -1
  37. package/dist/commands/show.js +1 -1
  38. package/dist/commands/tables.js +1 -1
  39. package/dist/commands/unset-command.js +1 -1
  40. package/dist/commands/use-command.js +1 -1
  41. package/dist/commands/user-command.js +1 -1
  42. package/dist/commands/workflow-command.js +1 -1
  43. package/dist/core/auth.js +1 -1
  44. package/dist/core/command-output.js +1 -1
  45. package/dist/core/config.js +1 -1
  46. package/dist/core/connection-cache.js +1 -1
  47. package/dist/core/constants.js +1 -1
  48. package/dist/core/credential-cache.js +1 -1
  49. package/dist/core/global-context.js +1 -1
  50. package/dist/core/keychain.js +1 -1
  51. package/dist/core/profile.js +1 -1
  52. package/dist/core/project-config.js +1 -1
  53. package/dist/core/session.js +1 -1
  54. package/dist/core/user-cache.js +1 -1
  55. package/dist/core/version.js +1 -1
  56. package/dist/index.js +1 -1
  57. package/dist/proxy/anthropic-adapter.js +1 -1
  58. package/dist/proxy/claude-usage-tracker.js +1 -1
  59. package/dist/proxy/context-signature.js +1 -1
  60. package/dist/proxy/conversation-utils.js +1 -1
  61. package/dist/proxy/passthrough-server.js +1 -1
  62. package/dist/proxy/server.js +1 -1
  63. package/dist/proxy/session-cache.js +1 -1
  64. package/dist/proxy/sse-usage-parser.js +1 -1
  65. package/dist/sdk/agent/agent-config.js +1 -1
  66. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  67. package/dist/sdk/agent/agent-yaml.js +1 -1
  68. package/dist/sdk/api.js +1 -1
  69. package/dist/sdk/client/cdp-api-client.js +1 -1
  70. package/dist/sdk/client/endpoints.js +1 -1
  71. package/dist/sdk/client/engage-api-client.js +1 -1
  72. package/dist/sdk/client/http-client.js +1 -1
  73. package/dist/sdk/client/llm-api-client.js +1 -1
  74. package/dist/sdk/client/rate-limiter.js +1 -1
  75. package/dist/sdk/client/td-api-client.js +1 -1
  76. package/dist/sdk/client/trino-api-client.d.ts.map +1 -1
  77. package/dist/sdk/client/trino-api-client.js +1 -1
  78. package/dist/sdk/client/trino-api-client.js.map +1 -1
  79. package/dist/sdk/client/workflow-client.js +1 -1
  80. package/dist/sdk/connection-validator.js +1 -1
  81. package/dist/sdk/connection.js +1 -1
  82. package/dist/sdk/engage.js +1 -1
  83. package/dist/sdk/errors.js +1 -1
  84. package/dist/sdk/index.js +1 -1
  85. package/dist/sdk/io/index.js +1 -1
  86. package/dist/sdk/io/node-filesystem.js +1 -1
  87. package/dist/sdk/job.js +1 -1
  88. package/dist/sdk/journey.js +1 -1
  89. package/dist/sdk/llm/chat-cache.js +1 -1
  90. package/dist/sdk/llm/index.js +1 -1
  91. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  92. package/dist/sdk/llm/model-aliases.js +1 -1
  93. package/dist/sdk/llm/model-factors.js +1 -1
  94. package/dist/sdk/query/index.js +1 -1
  95. package/dist/sdk/query/sql-parser.js +1 -1
  96. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  97. package/dist/sdk/segment/fields-display.js +1 -1
  98. package/dist/sdk/segment/file-discovery.js +1 -1
  99. package/dist/sdk/segment/journey-utils.js +1 -1
  100. package/dist/sdk/segment/journey-yaml.js +1 -1
  101. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  102. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  103. package/dist/sdk/segment/pull-workflow.js +1 -1
  104. package/dist/sdk/segment/push-workflow.js +1 -1
  105. package/dist/sdk/segment/resolution-context.js +1 -1
  106. package/dist/sdk/segment/segment-path-parser.js +1 -1
  107. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  108. package/dist/sdk/segment/target-resolution.js +1 -1
  109. package/dist/sdk/segment/tdx-config.js +1 -1
  110. package/dist/sdk/segment/validate-files.js +1 -1
  111. package/dist/sdk/segment/yaml-validator.js +1 -1
  112. package/dist/sdk/segment.js +1 -1
  113. package/dist/sdk/types/index.js +1 -1
  114. package/dist/sdk/types/progress.js +1 -1
  115. package/dist/sdk/user.js +1 -1
  116. package/dist/sdk/util/format-detector.js +1 -1
  117. package/dist/sdk/util/formatters.js +1 -1
  118. package/dist/sdk/util/index.js +1 -1
  119. package/dist/sdk/util/tree-formatter.js +1 -1
  120. package/dist/sdk/workflow/clone-workflow.js +1 -1
  121. package/dist/sdk/workflow/index.js +1 -1
  122. package/dist/sdk/workflow/pull-workflow.js +1 -1
  123. package/dist/sdk/workflow/push-workflow.js +1 -1
  124. package/dist/sdk/workflow/tdx-config.js +1 -1
  125. package/dist/sdk/workflow/workflow-utils.js +1 -1
  126. package/dist/tdx +10 -0
  127. package/dist/utils/async.js +1 -1
  128. package/dist/utils/colors.d.ts +2 -1
  129. package/dist/utils/colors.d.ts.map +1 -1
  130. package/dist/utils/colors.js +1 -1
  131. package/dist/utils/colors.js.map +1 -1
  132. package/dist/utils/diff.js +1 -1
  133. package/dist/utils/file-permissions.js +1 -1
  134. package/dist/utils/json-loader.js +1 -1
  135. package/dist/utils/option-validation.js +1 -1
  136. package/dist/utils/port.js +1 -1
  137. package/dist/utils/process.js +1 -1
  138. package/dist/utils/prompt.js +1 -1
  139. package/dist/utils/spinner.js +1 -1
  140. package/dist/utils/sse-parser.js +1 -1
  141. package/dist/utils/string-utils.js +1 -1
  142. package/dist/utils/table-ref-parser.js +1 -1
  143. package/dist/utils/tdx-logger.js +1 -1
  144. package/dist/utils/version-check.js +1 -1
  145. package/package.json +2 -2
@@ -1 +1 @@
1
- const a21_0x6e5b10=a21_0x4dcf;(function(_0x2f70fc,_0x1c747a){const _0x1bcc6d=a21_0x4dcf,_0x50b523=_0x2f70fc();while(!![]){try{const _0x4cb388=-parseInt(_0x1bcc6d(0x276))/0x1+parseInt(_0x1bcc6d(0x2e2))/0x2+parseInt(_0x1bcc6d(0x24b))/0x3+-parseInt(_0x1bcc6d(0x2b0))/0x4*(-parseInt(_0x1bcc6d(0x22c))/0x5)+-parseInt(_0x1bcc6d(0x2a9))/0x6+parseInt(_0x1bcc6d(0x2bd))/0x7+parseInt(_0x1bcc6d(0x26b))/0x8;if(_0x4cb388===_0x1c747a)break;else _0x50b523['push'](_0x50b523['shift']());}catch(_0xa9bc18){_0x50b523['push'](_0x50b523['shift']());}}}(a21_0x4d9d,0x5638b));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';function a21_0x4dcf(_0x66008f,_0x576163){_0x66008f=_0x66008f-0x1be;const _0x4d9dd6=a21_0x4d9d();let _0x4dcf71=_0x4d9dd6[_0x66008f];return _0x4dcf71;}import a21_0x568a92 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a21_0x4d9d(){const _0x44cc82=['Created','Options:','\x20=\x20','displaySampleData','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','segment:parent:push','Preview:','behavior','Join:','tdx\x20segment\x20parent\x20preview\x20','Executing\x20parent\x20segment\x20query...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Error\x20reading\x20file:\x20','/app/workflows/','✔\x20Query\x20completed:\x20Processed\x20','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','platform','string','customerGroup','segment:parent:show','Options\x20(one\x20required):\x0a','displayValidateResults','✘\x20Failed\x20to\x20rename\x20directory:\x20','allValid','previewParentYaml','parent_segment','.yaml','pullParentYaml','execute','4035WnmkVv','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','Error:\x20--behavior\x20requires\x20a\x20name\x0a','interval','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','localeCompare','\x5c$&','Columns:','Behavior:','behaviorsFile','repeat','\x20--interval\x20','schemaValid','Error:\x20File\x20not\x20found:\x20','\x0a✔\x20Workflow\x20started','Audience\x20ID:','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','Updated','\x20\x20No\x20sample\x20data\x20available','jobId','customerGroupFile','utf-8','segment:parent:desc','double','✔\x20Updated\x20parent\x20segment\x20\x27','varchar','To\x20cancel:','\x0a⚠️\x20\x20Both\x20','segment:parent:fields','scheduleType','787260nggYVU','master','\x20kill','message','coveragePercent','✔\x20Created\x20parent\x20segment\x20\x27','segment:parent:update','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','resolveParentId','displayPreviewHints','verbose','use','displaySummary','bold','Fetching\x20SQL\x20for\x20\x27','Listing\x20fields\x20for\x20\x27','test','.yml','/attempt/','\x27\x20with\x20ID:\x20','👥\x20','table','runParent','rowCount','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','xdg-open','/\x20directory.\x0a','jsonl','Error:','stop','json','843888koRtKK','processedRows','segment:parent:pull','\x20--behavior\x20\x22','Master:','displayBehaviorsStats','workflowSessionId','\x20parent\x20segment\x20\x27','updateParent','/sessions/','run','489573lmDquS','\x20--behavior\x20\x22<name>\x22','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','replace','Available\x20behaviors:','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','Creating\x20parent\x20segment\x20\x27','unref','Resolving\x20parent\x20segment\x20\x27','\x20rows\x20','\x20Context\x20set:\x20','information_schema','listParents','join','/\x20and\x20','Table:\x20','joinKey','\x27\x20is\x20already\x20up\x20to\x20date','columns','in\x20','setJobId','Session:','Listing\x20parent\x20segments...','Error:\x20--attribute\x20requires\x20a\x20name\x0a','attribute','createParent','customerPercent','dim','\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','Available\x20attributes:','listFields','Attributes','\x0a⚠️\x20\x20Migrating:\x20','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x20--attribute\x20\x22<name>\x22','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20rows)','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','start','site','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','Site:\x20','text','scheduleOption','\x20is\x20already\x20up\x20to\x20date','Coverage:','\x0aNew\x20parent\x20segment\x20\x27','4125858VwJNla','workflowId','Enriched:','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','validateParentYaml','endsWith','Validate:','1692UTZYyQ','query','YAML\x20file:\x20','filter','sampleData','/{name}.yml\x0a','Error:\x20Parent\x20segment\x20name\x20is\x20required','-1d','\x20Opening\x20','web','segment:parent:run','all','Database:\x20','3825696gkTJYR','/\x20directories\x20exist.','Join\x20on:','using\x20the\x20default\x20path:\x20','✔\x20Renamed\x20directory\x20to\x20','data','Get\x20SQL\x20query\x20for\x20parent\x20segment','\x20No\x20changes\x20-\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','attributesFile','keys','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','displayAttributesStats','Parent\x20segment:\x20','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','segment','addBehaviorsFile','Updating\x20parent\x20segment\x20\x27','timezone','parent_segments','Behaviors','foreignKey','getParentSQL','segment:parent:preview','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','red','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','length','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','addAttributesFile','Rows:','Creating','displayPreviewResults','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','name','yellow','label','549168OIwTGf','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','customersWithEvents','Customers:','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','errors','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','Fetching\x20current\x20configuration\x20for\x20\x27','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','format','\x20--attribute\x20\x22','%)\x20','\x20tdx\x20wf\x20attempt\x20','cyan','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','win32','match','Master\x20+\x20Attributes','darwin','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','parentSegment','column','yes','segment:parent:create','Name:\x20','Options:\x0a','totalEvents','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','Status:','enriched','Found\x20YAML\x20file:\x20','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','population','Apply\x20changes\x20to\x20\x27','attributes','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','SQL\x20query:\x0a','No\x20parent\x20segments\x20found','✔\x20Found\x20','Fetching\x20parent\x20segment\x20\x27','description','\x27...','Analyzing\x20changes...','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Source:','\x27\x20and\x20run\x20workflow?','segment:parent:validate','SELECT\x20*\x20FROM\x20(\x0a','output','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','segment:parent:list','behaviors','Aborted.','database','green','\x20[Job\x20ID:\x20','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','status','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','apply','error','/app/dw/parentSegments/','session','List\x20parent\x20segments','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Error:\x20No\x20behaviors\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','log','workflowAttemptId','pushParentYaml','preview','Show\x20parent\x20segment\x20details','✔\x20No\x20changes\x20-\x20\x27','Master\x20Table','displayColumns','matchedCount','segment:parent:view','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','\x0aChanges\x20to\x20\x27','getParentFull','displayMasterInfo','Overwrite\x20\x27','\x20\x20\x20\x20-\x20','number','limit','Updating','Attempt:','map','Errors:'];a21_0x4d9d=function(){return _0x44cc82;};return a21_0x4d9d();}import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x5051ed from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a21_0x6e5b10(0x2d0),LEGACY_PARENT_SEGMENT_DIR=a21_0x6e5b10(0x228);function openBrowser(_0x10c64a){const _0x2c8e18=a21_0x6e5b10,_0xce3d6=process[_0x2c8e18(0x21f)],_0x49c46d=_0xce3d6===_0x2c8e18(0x1c2)?'open':_0xce3d6===_0x2c8e18(0x1bf)?_0x2c8e18(0x2a0):_0x2c8e18(0x265);spawn(_0x49c46d,[_0x10c64a],{'detached':!![],'stdio':'ignore'})[_0x2c8e18(0x27f)]();}function migrateLegacyDirectory(){const _0x585315=a21_0x6e5b10;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3d838f=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3d838f['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a21_0x5051ed[_0x585315(0x2e0)](_0x585315(0x248)+LEGACY_PARENT_SEGMENT_DIR+_0x585315(0x286)+PARENT_SEGMENT_DIR+_0x585315(0x2be))),console[_0x585315(0x1ee)](a21_0x5051ed[_0x585315(0x293)](_0x585315(0x2ac)+LEGACY_PARENT_SEGMENT_DIR+_0x585315(0x266))),![];console[_0x585315(0x1ee)](a21_0x5051ed[_0x585315(0x2e0)](_0x585315(0x299)+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x585315(0x1ee)](a21_0x5051ed['green'](_0x585315(0x2c1)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x16d8c3){const _0x412414=_0x16d8c3 instanceof Error?_0x16d8c3[_0x585315(0x24e)]:String(_0x16d8c3);return console[_0x585315(0x1ee)](a21_0x5051ed[_0x585315(0x2d6)](_0x585315(0x225)+_0x412414+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x6e5b10(0x275)](_0x24d878){return migrateLegacyDirectory(),super['run'](_0x24d878);}}function resolveYamlFile(_0xd31fd6){const _0x36296d=a21_0x6e5b10;if(_0xd31fd6[_0x36296d(0x2ae)](_0x36296d(0x25d))||_0xd31fd6[_0x36296d(0x2ae)](_0x36296d(0x229)))return _0xd31fd6;return a21_0x568a92[_0x36296d(0x285)](PARENT_SEGMENT_DIR,sanitizeFileName(_0xd31fd6)+_0x36296d(0x25d));}function formatProgressMessage(_0xe297f){const _0x335466=a21_0x6e5b10,_0xbc6547=_0xe297f[_0x335466(0x1c0)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0xbc6547){const [,_0x3aa9e2,_0x54878a,_0x542f9f='']=_0xbc6547;return a21_0x5051ed[_0x335466(0x293)](_0x3aa9e2+':')+'\x20'+_0x54878a+a21_0x5051ed['dim'](_0x542f9f);}return a21_0x5051ed[_0x335466(0x293)](_0xe297f);}function showFileNotFoundError(_0x569967,_0x4d4289){const _0x34830d=a21_0x6e5b10;console[_0x34830d(0x1ee)](a21_0x5051ed[_0x34830d(0x2d6)](_0x34830d(0x239)+_0x569967+'\x0a')),console[_0x34830d(0x1ee)](a21_0x5051ed[_0x34830d(0x2f0)](_0x34830d(0x252)+_0x4d4289+'`\x20to\x20download\x20the\x20configuration\x20first'));}function showParentSegmentNotSetError(_0x3e61cc){const _0xe90eec=a21_0x6e5b10;console['error'](a21_0x5051ed[_0xe90eec(0x2e0)](_0xe90eec(0x2e9))),console['error'](_0x3e61cc);}export class ParentSegmentListCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x1e3);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x1f1);async[a21_0x6e5b10(0x22b)](_0x2a9bf){const _0x5751f0=a21_0x6e5b10,{options:_0x5b4e7c,args:_0x23b469,tdx:_0x1a1577}=_0x2a9bf,_0x207812=_0x23b469[0x0];_0x5b4e7c[_0x5751f0(0x256)]&&(console[_0x5751f0(0x1ee)]('Site:\x20'+_0x5b4e7c[_0x5751f0(0x2a1)]),_0x207812&&console[_0x5751f0(0x1ee)]('Pattern:\x20'+_0x207812));const _0x58fffc=await withSpinner(_0x207812?'Listing\x20parent\x20segments\x20matching\x20\x27'+_0x207812+_0x5751f0(0x1da):_0x5751f0(0x28e),()=>_0x1a1577['segment'][_0x5751f0(0x284)](),{'verbose':_0x5b4e7c[_0x5751f0(0x256)]});let _0x3fafcf=_0x58fffc[_0x5751f0(0x2c2)];if(_0x207812){const _0x38b084=_0x207812[_0x5751f0(0x27a)](/[.+^${}()|[\]\\]/g,_0x5751f0(0x232))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x4ba212=new RegExp('^'+_0x38b084+'$','i');_0x3fafcf=_0x3fafcf[_0x5751f0(0x2b3)](_0x356983=>_0x4ba212[_0x5751f0(0x25c)](_0x356983[_0x5751f0(0x1d3)][_0x5751f0(0x2df)]));}_0x3fafcf['sort']((_0x1518f8,_0x123ad4)=>_0x1518f8[_0x5751f0(0x1d3)][_0x5751f0(0x2df)][_0x5751f0(0x231)](_0x123ad4[_0x5751f0(0x1d3)][_0x5751f0(0x2df)])),console[_0x5751f0(0x1ee)](_0x5751f0(0x1d7)+_0x3fafcf['length']+_0x5751f0(0x294)+(_0x3fafcf[_0x5751f0(0x2d8)]!==0x1?'s':''));const _0x20a319=_0x4a208a=>{const _0x509008=_0x5751f0;return getConsoleNextUrl(_0x5b4e7c[_0x509008(0x2a1)],_0x509008(0x1ef)+_0x4a208a);};if(_0x5b4e7c[_0x5751f0(0x2ec)]==='json'||_0x5b4e7c[_0x5751f0(0x2ec)]===_0x5751f0(0x267)){const _0x5a7dcf=_0x3fafcf[_0x5751f0(0x20d)](_0x26cc15=>({..._0x26cc15,'url':_0x20a319(_0x26cc15['id'])}));await handleSDKOutput(_0x5a7dcf,_0x5b4e7c);}else{if(_0x3fafcf[_0x5751f0(0x2d8)]===0x0)_0x207812?console['log'](_0x5751f0(0x1eb)+_0x207812):console[_0x5751f0(0x1f6)](_0x5751f0(0x1d6));else for(const _0x5d431c of _0x3fafcf){const _0x5795f8=_0x5d431c[_0x5751f0(0x1d3)]['population']?a21_0x5051ed[_0x5751f0(0x293)]('\x20('+formatRows(_0x5d431c[_0x5751f0(0x1d3)][_0x5751f0(0x1d1)])+')'):'',_0x2123ec=hyperlink(_0x5d431c[_0x5751f0(0x1d3)][_0x5751f0(0x2df)],_0x20a319(_0x5d431c['id']));console['log'](_0x5751f0(0x260)+_0x2123ec+_0x5795f8);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x1c8);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x203);async['execute'](_0x3bf2c2){const _0xc5ef6b=a21_0x6e5b10,{options:_0x4cc35e,args:_0x315597,tdx:_0x129497}=_0x3bf2c2;console['error'](_0xc5ef6b(0x2e3)+_0xc5ef6b(0x1d0)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1365fb=_0x4cc35e;if(_0x315597[_0xc5ef6b(0x2d8)]===0x0)return console['error'](a21_0x5051ed[_0xc5ef6b(0x2d6)](_0xc5ef6b(0x2b6))),console[_0xc5ef6b(0x1ee)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;const _0xc56707=_0x315597[0x0];if(!_0x1365fb[_0xc5ef6b(0x1e6)]||!_0x1365fb[_0xc5ef6b(0x261)])return console[_0xc5ef6b(0x1ee)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0xc5ef6b(0x202)),0x1;_0x1365fb[_0xc5ef6b(0x256)]&&(console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x2a3)+_0x1365fb[_0xc5ef6b(0x2a1)]),console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x1c9)+_0xc56707),console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x2bc)+_0x1365fb['database']),console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x287)+_0x1365fb[_0xc5ef6b(0x261)]));const _0x33e40c=await loadJSONFromOptions(_0x1365fb[_0xc5ef6b(0x1d3)],_0x1365fb[_0xc5ef6b(0x2c6)]),_0x3667fb=await loadJSONFromOptions(_0x1365fb[_0xc5ef6b(0x1e4)],_0x1365fb[_0xc5ef6b(0x235)]),_0x403930=await loadJSONFromOptions(_0x1365fb[_0xc5ef6b(0x221)],_0x1365fb[_0xc5ef6b(0x241)]),_0x23152e={'name':_0xc56707,'description':_0x1365fb[_0xc5ef6b(0x1d9)],'scheduleType':_0x1365fb[_0xc5ef6b(0x24a)],'scheduleOption':_0x1365fb[_0xc5ef6b(0x2a5)],'timezone':_0x1365fb[_0xc5ef6b(0x2cf)],'master':{'parentDatabaseName':_0x1365fb[_0xc5ef6b(0x1e6)],'parentTableName':_0x1365fb[_0xc5ef6b(0x261)]},'attributes':_0x33e40c,'behaviors':_0x3667fb,'customerGroup':_0x403930},_0x19ad61=await withSpinner(_0xc5ef6b(0x27e)+_0xc56707+_0xc5ef6b(0x1da),()=>_0x129497[_0xc5ef6b(0x2cc)][_0xc5ef6b(0x291)](_0x23152e),{'verbose':_0x4cc35e['verbose']}),_0x3e032e=_0x19ad61[_0xc5ef6b(0x2c2)];return console[_0xc5ef6b(0x1ee)](_0xc5ef6b(0x250)+_0x3e032e[_0xc5ef6b(0x2df)]+_0xc5ef6b(0x25f)+_0x3e032e['id']),await handleSDKOutput([_0x3e032e],_0x4cc35e),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x251);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x278);async['execute'](_0x498bd9){const _0xf30ffc=a21_0x6e5b10,{options:_0x50536c,args:_0x5c4a36,tdx:_0xae0a62}=_0x498bd9;console[_0xf30ffc(0x1ee)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0xf30ffc(0x1d0)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x1163cd=_0x50536c;if(_0x5c4a36[_0xf30ffc(0x2d8)]===0x0)return console[_0xf30ffc(0x1ee)](a21_0x5051ed['red']('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0xf30ffc(0x1ee)](_0xf30ffc(0x23c)),0x1;const _0x34b932=_0x5c4a36[0x0];_0x1163cd[_0xf30ffc(0x256)]&&(console['error']('Site:\x20'+_0x1163cd[_0xf30ffc(0x2a1)]),console[_0xf30ffc(0x1ee)](_0xf30ffc(0x2ca)+_0x34b932));const _0x56d4d0=await withSpinner(_0xf30ffc(0x2ea)+_0x34b932+'\x27...',()=>_0xae0a62['segment'][_0xf30ffc(0x205)](_0x34b932),{'verbose':_0x1163cd[_0xf30ffc(0x256)]}),_0x9dda23=_0x56d4d0[_0xf30ffc(0x2c2)],_0x1fce9e=await loadJSONFromOptions(_0x1163cd['addAttributes'],_0x1163cd[_0xf30ffc(0x2da)]),_0x3fd8fa=await loadJSONFromOptions(_0x1163cd['addBehaviors'],_0x1163cd[_0xf30ffc(0x2cd)]),_0x4f2f75={'name':_0x9dda23['name'],'description':_0x1163cd[_0xf30ffc(0x1d9)]!==undefined?_0x1163cd['description']:_0x9dda23[_0xf30ffc(0x1d9)],'scheduleType':_0x1163cd['scheduleType']!==undefined?_0x1163cd[_0xf30ffc(0x24a)]:_0x9dda23[_0xf30ffc(0x24a)],'scheduleOption':_0x1163cd[_0xf30ffc(0x2a5)]!==undefined?_0x1163cd[_0xf30ffc(0x2a5)]:_0x9dda23[_0xf30ffc(0x2a5)],'timezone':_0x1163cd['timezone']!==undefined?_0x1163cd['timezone']:_0x9dda23['timezone'],'master':_0x9dda23[_0xf30ffc(0x24c)],'attributes':_0x1fce9e?[..._0x9dda23[_0xf30ffc(0x1d3)]||[],..._0x1fce9e]:_0x9dda23[_0xf30ffc(0x1d3)],'behaviors':_0x3fd8fa?[..._0x9dda23[_0xf30ffc(0x1e4)]||[],..._0x3fd8fa]:_0x9dda23[_0xf30ffc(0x1e4)],'customerGroup':_0x9dda23[_0xf30ffc(0x221)]},_0x4fb62a=await withSpinner(_0xf30ffc(0x2ce)+_0x34b932+_0xf30ffc(0x1da),()=>_0xae0a62[_0xf30ffc(0x2cc)][_0xf30ffc(0x273)](_0x34b932,_0x4f2f75),{'verbose':_0x1163cd['verbose']}),_0xbb5943=_0x4fb62a[_0xf30ffc(0x2c2)];return console[_0xf30ffc(0x1ee)](_0xf30ffc(0x245)+_0xbb5943[_0xf30ffc(0x2df)]+'\x27'),await handleSDKOutput([_0xbb5943],_0x1163cd),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x26d);[a21_0x6e5b10(0x1d9)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a21_0x6e5b10(0x22b)](_0x16d7b2){const _0x32b190=a21_0x6e5b10,{options:_0x13409e,args:_0xf55739,tdx:_0x3c9d29}=_0x16d7b2,_0x5456bb=_0x13409e,_0x4b08bf=_0xf55739[0x0]||_0x13409e['parentSegment'];if(!_0x4b08bf)return showParentSegmentNotSetError(_0x32b190(0x23d)+_0x32b190(0x295)),0x1;if(_0x5456bb[_0x32b190(0x257)]&&_0x5456bb['output'])return console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x2d6)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console['error'](a21_0x5051ed[_0x32b190(0x293)](_0x32b190(0x2e6))),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x293)](_0x32b190(0x2c0)+PARENT_SEGMENT_DIR+_0x32b190(0x2b5))),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x2f0)](_0x32b190(0x1c3))),0x1;const _0x2700bf=_0x5456bb[_0x32b190(0x1e1)]||a21_0x568a92[_0x32b190(0x285)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4b08bf)+'.yml');_0x5456bb[_0x32b190(0x256)]&&(console[_0x32b190(0x1ee)](_0x32b190(0x2a3)+_0x5456bb[_0x32b190(0x2a1)]),console[_0x32b190(0x1ee)]('Parent\x20segment:\x20'+_0x4b08bf),console[_0x32b190(0x1ee)]('Output\x20file:\x20'+_0x2700bf));const _0x37ded5=await withSpinner(_0x32b190(0x1d8)+_0x4b08bf+_0x32b190(0x1da),()=>_0x3c9d29[_0x32b190(0x2cc)][_0x32b190(0x22a)](_0x4b08bf),{'verbose':_0x5456bb['verbose']}),_0x32e409=_0x37ded5[_0x32b190(0x2c2)];if(existsSync(_0x2700bf)){const _0x25700b=readFileSync(_0x2700bf,_0x32b190(0x242)),_0x29a24b=generateDiff(_0x25700b,_0x32e409);if(!hasChanges(_0x29a24b))console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x2c4)+a21_0x5051ed[_0x32b190(0x2f0)](_0x2700bf)+_0x32b190(0x2a6));else{console[_0x32b190(0x1ee)](_0x32b190(0x204)+_0x2700bf+'\x27:'),console['error']('─'[_0x32b190(0x236)](0x3c)),console[_0x32b190(0x1ee)](formatDiffWithColors(_0x29a24b)),console[_0x32b190(0x1ee)]('─'[_0x32b190(0x236)](0x3c));if(!_0x5456bb['yes']){const _0x266d60=await confirmKey(_0x32b190(0x207)+_0x2700bf+'\x27?');if(!_0x266d60)return console[_0x32b190(0x1ee)](_0x32b190(0x1e5)),0x1;}writeFileSync(_0x2700bf,_0x32e409,_0x32b190(0x242)),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x2c8)+a21_0x5051ed[_0x32b190(0x2f0)](_0x2700bf));}}else{const _0x4d2161=a21_0x568a92['dirname'](_0x2700bf);!existsSync(_0x4d2161)&&mkdirSync(_0x4d2161,{'recursive':!![]}),writeFileSync(_0x2700bf,_0x32e409,'utf-8'),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x2c8)+a21_0x5051ed[_0x32b190(0x2f0)](_0x2700bf));}return saveSessionContext({'parent_segment':_0x4b08bf},_0x5456bb[_0x32b190(0x1f0)]),console[_0x32b190(0x1ee)](a21_0x5051ed[_0x32b190(0x1e7)]('✔')+_0x32b190(0x282)+a21_0x5051ed[_0x32b190(0x293)]('parent_segment')+_0x32b190(0x211)+a21_0x5051ed[_0x32b190(0x2f0)](_0x4b08bf)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x214);['description']='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a21_0x6e5b10(0x22b)](_0x2de41b){const _0x36b9a4=a21_0x6e5b10,{options:_0x5256d6,args:_0x425df5,tdx:_0x698e87}=_0x2de41b,_0x408007=_0x5256d6,_0x3ec28c=_0x425df5[0x0]||_0x5256d6[_0x36b9a4(0x1c5)];if(!_0x3ec28c)return showParentSegmentNotSetError(_0x36b9a4(0x253)+_0x36b9a4(0x1f3)),0x1;const _0x1cdab5=resolveYamlFile(_0x3ec28c);if(!existsSync(_0x1cdab5))return showFileNotFoundError(_0x1cdab5,_0x3ec28c),0x1;_0x408007[_0x36b9a4(0x256)]&&(console[_0x36b9a4(0x1ee)]('Site:\x20'+_0x408007[_0x36b9a4(0x2a1)]),console['error'](_0x36b9a4(0x2b2)+_0x1cdab5));let _0x3e7ce6;try{_0x3e7ce6=readFileSync(_0x1cdab5,'utf-8');}catch(_0x2d7534){const _0x36c0c0=_0x2d7534 instanceof Error?_0x2d7534[_0x36b9a4(0x24e)]:String(_0x2d7534);return console['error'](_0x36b9a4(0x21b)+_0x36c0c0),0x1;}const _0xce2c4a=await withSpinner(_0x36b9a4(0x1db),()=>_0x698e87[_0x36b9a4(0x2cc)][_0x36b9a4(0x1f8)](_0x3e7ce6),{'verbose':_0x408007[_0x36b9a4(0x256)]}),_0x5bf998=_0xce2c4a[_0x36b9a4(0x2c2)],{isNew:_0x54fe8d,name:_0x41fc8c,hasChanges:_0x1b0f8f,diffFormatted:_0x243627}=_0x5bf998;if(!_0x1b0f8f)return console[_0x36b9a4(0x1ee)](_0x36b9a4(0x1fb)+_0x41fc8c+_0x36b9a4(0x289)),0x0;_0x54fe8d?console[_0x36b9a4(0x1ee)](_0x36b9a4(0x2a8)+_0x41fc8c+'\x27:'):console[_0x36b9a4(0x1ee)](_0x36b9a4(0x200)+_0x41fc8c+'\x27:');console[_0x36b9a4(0x1ee)]('─'[_0x36b9a4(0x236)](0x3c)),console[_0x36b9a4(0x1ee)](_0x243627),console[_0x36b9a4(0x1ee)]('─'['repeat'](0x3c));const _0x2bdaea=_0x54fe8d?'Create\x20parent\x20segment\x20\x27'+_0x41fc8c+'\x27?':_0x36b9a4(0x1d2)+_0x41fc8c+'\x27?';if(!_0x408007[_0x36b9a4(0x1c7)]){const _0x12b3b5=await confirmKey(_0x2bdaea);if(!_0x12b3b5)return console['error'](_0x36b9a4(0x1e5)),0x1;}const _0x172db3=_0x54fe8d?_0x36b9a4(0x2dc):_0x36b9a4(0x20b),_0x5573df=await withSpinner(_0x172db3+_0x36b9a4(0x272)+_0x41fc8c+_0x36b9a4(0x1da),()=>_0x5bf998['apply'](),{'verbose':_0x408007[_0x36b9a4(0x256)]}),_0x2c0162=_0x5573df['data'],_0x4f0a0c=getConsoleNextUrl(_0x408007['site'],_0x36b9a4(0x1ef)+_0x2c0162['id']),_0x906ce5=_0x54fe8d?_0x36b9a4(0x20f):'Updated';return console['error']('✔\x20'+_0x906ce5+_0x36b9a4(0x272)+_0x2c0162[_0x36b9a4(0x2df)]+'\x27'),console[_0x36b9a4(0x1ee)]('\x20\x20'+_0x4f0a0c),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a21_0x6e5b10(0x1df);['description']=a21_0x6e5b10(0x2eb);async[a21_0x6e5b10(0x22b)](_0x414242){const _0x487bfc=a21_0x6e5b10,{options:_0x51d452,args:_0x153aba,tdx:_0x4f7914}=_0x414242,_0xc4a2fb=_0x51d452,_0x5288cf=_0x153aba[0x0]||_0x51d452['parentSegment'];if(!_0x5288cf)return showParentSegmentNotSetError(_0x487bfc(0x213)+_0x487bfc(0x1c4)+_0x487bfc(0x1ca)+_0x487bfc(0x29e)+_0x487bfc(0x29c)+_0x487bfc(0x1ec)),0x1;const _0x3495f2=resolveYamlFile(_0x5288cf);if(!existsSync(_0x3495f2))return showFileNotFoundError(_0x3495f2,_0x5288cf),0x1;_0xc4a2fb['verbose']&&(console[_0x487bfc(0x1ee)]('Site:\x20'+_0xc4a2fb[_0x487bfc(0x2a1)]),console[_0x487bfc(0x1ee)]('YAML\x20file:\x20'+_0x3495f2));let _0x4ca39e;try{_0x4ca39e=readFileSync(_0x3495f2,_0x487bfc(0x242));}catch(_0x42e4ca){const _0x1f266b=_0x42e4ca instanceof Error?_0x42e4ca['message']:String(_0x42e4ca);return console[_0x487bfc(0x1ee)](_0x487bfc(0x21b)+_0x1f266b),0x1;}const _0x2937ae=createCommandSpinner(a21_0x5051ed[_0x487bfc(0x293)]('Validating\x20configuration...'),{'verbose':_0xc4a2fb[_0x487bfc(0x256)]});_0x2937ae[_0x487bfc(0x2a0)]();const _0x3dbc33={'onProgress':_0x4ef26a=>{const _0x1cb438=_0x487bfc;_0x2937ae[_0x1cb438(0x2a4)]=formatProgressMessage(_0x4ef26a);}};if(_0xc4a2fb[_0x487bfc(0x24c)])_0x3dbc33[_0x487bfc(0x24c)]=!![];if(_0xc4a2fb[_0x487bfc(0x1ce)])_0x3dbc33['enriched']=!![];_0xc4a2fb['attribute']&&(_0x3dbc33['attribute']=_0xc4a2fb[_0x487bfc(0x290)]);_0xc4a2fb[_0x487bfc(0x216)]&&(_0x3dbc33[_0x487bfc(0x216)]=_0xc4a2fb[_0x487bfc(0x216)]);if(_0xc4a2fb['interval'])_0x3dbc33[_0x487bfc(0x22f)]=_0xc4a2fb[_0x487bfc(0x22f)];let _0x36f93d;try{_0x36f93d=await _0x4f7914[_0x487bfc(0x2cc)][_0x487bfc(0x2ad)](_0x4ca39e,_0x3dbc33),_0x2937ae['stop']();}catch(_0x448c89){_0x2937ae['stop']();throw _0x448c89;}const _0x296765=_0xc4a2fb['interval']||_0x487bfc(0x2b7);return this[_0x487bfc(0x224)](_0x36f93d,_0x3dbc33,_0x3495f2,_0x296765),_0x36f93d['allValid']?0x0:0x1;}[a21_0x6e5b10(0x224)](_0xfcc5c2,_0x318d20,_0x14908a,_0x5d6d48){const _0x5f4d0b=a21_0x6e5b10;console[_0x5f4d0b(0x1ee)]('\x0a'+a21_0x5051ed['bold'](_0x5f4d0b(0x2af))+'\x20'+_0xfcc5c2[_0x5f4d0b(0x2df)]),console[_0x5f4d0b(0x1ee)]('═'[_0x5f4d0b(0x236)](0x3c)),this[_0x5f4d0b(0x206)](_0xfcc5c2);if(typeof _0x318d20[_0x5f4d0b(0x290)]===_0x5f4d0b(0x220)){this[_0x5f4d0b(0x2c9)](_0xfcc5c2),this[_0x5f4d0b(0x258)](_0xfcc5c2),this['displayPreviewHints'](_0x14908a,_0x5d6d48,'attribute',_0x318d20[_0x5f4d0b(0x290)]);return;}if(_0x318d20[_0x5f4d0b(0x290)]===!![]){this[_0x5f4d0b(0x2c9)](_0xfcc5c2),this[_0x5f4d0b(0x258)](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,'attributes');return;}if(typeof _0x318d20[_0x5f4d0b(0x216)]===_0x5f4d0b(0x220)){this['displayBehaviorsStats'](_0xfcc5c2,_0x5d6d48),this['displaySummary'](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,'behavior',_0x318d20['behavior']);return;}if(_0x318d20[_0x5f4d0b(0x216)]===!![]){this[_0x5f4d0b(0x270)](_0xfcc5c2,_0x5d6d48),this[_0x5f4d0b(0x258)](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,_0x5f4d0b(0x1e4));return;}this[_0x5f4d0b(0x2c9)](_0xfcc5c2),this[_0x5f4d0b(0x270)](_0xfcc5c2,_0x5d6d48),this[_0x5f4d0b(0x258)](_0xfcc5c2),this[_0x5f4d0b(0x255)](_0x14908a,_0x5d6d48,'all');}[a21_0x6e5b10(0x255)](_0x1ce74a,_0x39e361,_0x7e35df,_0x32c9b4){const _0x3c22c2=a21_0x6e5b10;console[_0x3c22c2(0x1ee)]('\x0a'+a21_0x5051ed[_0x3c22c2(0x293)]('To\x20view\x20sample\x20data:'));const _0xf252c6=_0x39e361!==_0x3c22c2(0x2b7)?_0x3c22c2(0x237)+_0x39e361:'';if(_0x7e35df===_0x3c22c2(0x290)&&_0x32c9b4)console[_0x3c22c2(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)](_0x3c22c2(0x218)+_0x1ce74a+_0x3c22c2(0x2ed)+_0x32c9b4+'\x22'+_0xf252c6));else{if(_0x7e35df==='behavior'&&_0x32c9b4)console[_0x3c22c2(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)](_0x3c22c2(0x218)+_0x1ce74a+'\x20--behavior\x20\x22'+_0x32c9b4+'\x22'+_0xf252c6));else(_0x7e35df==='attributes'||_0x7e35df===_0x3c22c2(0x2bb))&&console[_0x3c22c2(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1ce74a+_0x3c22c2(0x29b)+_0xf252c6));}(_0x7e35df===_0x3c22c2(0x1e4)||_0x7e35df===_0x3c22c2(0x2bb))&&console['error']('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)](_0x3c22c2(0x218)+_0x1ce74a+_0x3c22c2(0x277)+_0xf252c6)),_0x7e35df===_0x3c22c2(0x2bb)&&console['error']('\x20\x20'+a21_0x5051ed[_0x3c22c2(0x293)]('tdx\x20segment\x20parent\x20preview\x20'+_0x1ce74a+'\x20--enriched'+_0xf252c6));}['displayMasterInfo'](_0x16a7e7){const _0x213746=a21_0x6e5b10,{master:_0x1b59d0}=_0x16a7e7,_0x17660e=_0x1b59d0[_0x213746(0x238)]?a21_0x5051ed[_0x213746(0x1e7)]('✔'):a21_0x5051ed['red']('✘');console[_0x213746(0x1ee)]('\x0a'+a21_0x5051ed[_0x213746(0x293)](_0x213746(0x1fc))),console['error'](_0x17660e+'\x20'+a21_0x5051ed[_0x213746(0x259)](_0x1b59d0[_0x213746(0x1e6)]+'.'+_0x1b59d0['table'])),_0x1b59d0['schemaValid']?_0x1b59d0[_0x213746(0x263)]!==undefined&&console[_0x213746(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x213746(0x293)](_0x213746(0x2db))+'\x20'+a21_0x5051ed['cyan'](formatRows(_0x1b59d0[_0x213746(0x263)]))):console[_0x213746(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x213746(0x2d6)](_0x213746(0x268))+'\x20'+_0x1b59d0['schemaError']);}['displayAttributesStats'](_0x199ada){const _0x203785=a21_0x6e5b10;if(_0x199ada[_0x203785(0x1d3)][_0x203785(0x2d8)]===0x0)return;console[_0x203785(0x1ee)]('\x0a'+a21_0x5051ed[_0x203785(0x293)](_0x203785(0x298)));for(const _0x2573af of _0x199ada[_0x203785(0x1d3)]){const _0x22dc3=_0x2573af['schemaValid']?a21_0x5051ed[_0x203785(0x1e7)]('✔'):a21_0x5051ed[_0x203785(0x2d6)]('✘');let _0x5e5768='';if(_0x2573af[_0x203785(0x238)]&&_0x2573af['matchedCount']!==undefined&&_0x2573af[_0x203785(0x24f)]!==undefined){const _0x496d11=_0x2573af[_0x203785(0x24f)]['toFixed'](0x1),_0x344ed6=_0x2573af['coveragePercent']>=0x50?a21_0x5051ed['green']:_0x2573af[_0x203785(0x24f)]>=0x32?a21_0x5051ed['yellow']:a21_0x5051ed[_0x203785(0x2d6)];_0x5e5768='\x20'+a21_0x5051ed[_0x203785(0x293)](_0x203785(0x2a7))+'\x20'+_0x344ed6(_0x496d11+'%')+'\x20('+formatRows(_0x2573af[_0x203785(0x1fe)])+_0x203785(0x29d);}console[_0x203785(0x1ee)](_0x22dc3+'\x20'+a21_0x5051ed[_0x203785(0x259)](_0x2573af[_0x203785(0x2df)])+_0x5e5768),console[_0x203785(0x1ee)]('\x20\x20'+a21_0x5051ed['dim'](_0x203785(0x1dd))+'\x20'+a21_0x5051ed['bold'](_0x2573af[_0x203785(0x1e6)]+'.'+_0x2573af[_0x203785(0x261)]));const _0x5903ee=_0x2573af[_0x203785(0x288)]===_0x2573af['foreignKey']?a21_0x5051ed[_0x203785(0x293)]('Join\x20on:')+'\x20'+_0x2573af['joinKey']:a21_0x5051ed[_0x203785(0x293)](_0x203785(0x217))+'\x20'+_0x2573af[_0x203785(0x288)]+'\x20=\x20'+_0x2573af[_0x203785(0x2d2)];console[_0x203785(0x1ee)]('\x20\x20'+_0x5903ee),console[_0x203785(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x203785(0x293)](_0x203785(0x233))),this[_0x203785(0x1fd)](_0x2573af[_0x203785(0x28a)]),!_0x2573af[_0x203785(0x238)]&&console[_0x203785(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x203785(0x2d6)]('Error:')+'\x20'+_0x2573af['schemaError']);}}[a21_0x6e5b10(0x270)](_0x2efd96,_0x59888f){const _0x356438=a21_0x6e5b10;if(_0x2efd96['behaviors'][_0x356438(0x2d8)]===0x0)return;console[_0x356438(0x1ee)]('\x0a'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x2d1))+'\x20'+a21_0x5051ed['dim']('('+_0x59888f+')'));for(const _0x5614c8 of _0x2efd96[_0x356438(0x1e4)]){const _0x2b9870=_0x5614c8['schemaValid']?a21_0x5051ed[_0x356438(0x1e7)]('✔'):a21_0x5051ed[_0x356438(0x2d6)]('✘');let _0x5dd6b5='';if(_0x5614c8[_0x356438(0x238)]&&_0x5614c8['customersWithEvents']!==undefined&&_0x5614c8[_0x356438(0x1cb)]!==undefined){const _0x14125f=_0x5614c8['customerPercent']?.['toFixed'](0x1)||'?',_0x2fdb04=(_0x5614c8[_0x356438(0x292)]??0x0)>=0x32?a21_0x5051ed[_0x356438(0x1e7)]:(_0x5614c8[_0x356438(0x292)]??0x0)>=0x14?a21_0x5051ed[_0x356438(0x2e0)]:a21_0x5051ed[_0x356438(0x2d6)];_0x5dd6b5='\x20'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x2e5))+'\x20'+_0x2fdb04(formatRows(_0x5614c8[_0x356438(0x2e4)]))+'\x20('+_0x14125f+_0x356438(0x2ee)+a21_0x5051ed[_0x356438(0x293)]('Events:')+'\x20'+a21_0x5051ed['cyan'](formatRows(_0x5614c8[_0x356438(0x1cb)]));}console['error'](_0x2b9870+'\x20'+a21_0x5051ed[_0x356438(0x259)](_0x5614c8[_0x356438(0x2df)])+_0x5dd6b5),console[_0x356438(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x1dd))+'\x20'+a21_0x5051ed['bold'](_0x5614c8[_0x356438(0x1e6)]+'.'+_0x5614c8[_0x356438(0x261)]));const _0x395542=_0x5614c8[_0x356438(0x288)]===_0x5614c8[_0x356438(0x2d2)]?a21_0x5051ed['dim'](_0x356438(0x2bf))+'\x20'+_0x5614c8['joinKey']:a21_0x5051ed[_0x356438(0x293)](_0x356438(0x217))+'\x20'+_0x5614c8[_0x356438(0x288)]+'\x20=\x20'+_0x5614c8['foreignKey'];console['error']('\x20\x20'+_0x395542),console[_0x356438(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x356438(0x293)](_0x356438(0x233))),this[_0x356438(0x1fd)](_0x5614c8['columns']),!_0x5614c8[_0x356438(0x238)]&&console['error']('\x20\x20'+a21_0x5051ed[_0x356438(0x2d6)](_0x356438(0x268))+'\x20'+_0x5614c8['schemaError']);}}[a21_0x6e5b10(0x1fd)](_0x151aa0){const _0x178812=a21_0x6e5b10;for(const _0x2b45bd of _0x151aa0){_0x2b45bd[_0x178812(0x2e1)]===_0x2b45bd['column']||_0x2b45bd[_0x178812(0x1c6)]==='*'?console[_0x178812(0x1ee)]('\x20\x20\x20\x20-\x20'+_0x2b45bd[_0x178812(0x2e1)]):console[_0x178812(0x1ee)](_0x178812(0x208)+_0x2b45bd[_0x178812(0x2e1)]+'\x20'+a21_0x5051ed[_0x178812(0x293)]('('+_0x2b45bd['column']+')'));}}[a21_0x6e5b10(0x258)](_0x34a8b6){const _0x2c503a=a21_0x6e5b10;console[_0x2c503a(0x1ee)]('─'[_0x2c503a(0x236)](0x3c));if(_0x34a8b6['errors'][_0x2c503a(0x2d8)]>0x0){console['error']('\x0a'+a21_0x5051ed[_0x2c503a(0x2d6)]('Errors:'));for(const _0x12cc66 of _0x34a8b6['errors']){console[_0x2c503a(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x2c503a(0x2d6)]('•')+'\x20'+_0x12cc66);}}_0x34a8b6[_0x2c503a(0x226)]&&console['error']('\x0a'+a21_0x5051ed[_0x2c503a(0x1e7)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x2d4);['description']=a21_0x6e5b10(0x279);async['execute'](_0x271d5d){const _0x5c2344=a21_0x6e5b10,{options:_0x266065,args:_0x51d2f5,tdx:_0x5d42f1}=_0x271d5d,_0xa950cb=_0x266065,_0x5cc7ea=_0x51d2f5[0x0]||_0x266065['parentSegment'];if(!_0x5cc7ea)return showParentSegmentNotSetError(_0x5c2344(0x2d9)+_0x5c2344(0x201)+_0x5c2344(0x223)+_0x5c2344(0x1dc)+_0x5c2344(0x2d7)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x5c2344(0x2de)+_0x5c2344(0x1ec)),0x1;if(!_0xa950cb['master']&&!_0xa950cb['attribute']&&!_0xa950cb[_0x5c2344(0x216)]&&!_0xa950cb['enriched'])return console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)](_0x5c2344(0x22d))),console[_0x5c2344(0x1ee)](_0x5c2344(0x29f)),console[_0x5c2344(0x1ee)](_0x5c2344(0x210)),console['error'](_0x5c2344(0x1e9)),console[_0x5c2344(0x1ee)](_0x5c2344(0x21e)),console[_0x5c2344(0x1ee)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console[_0x5c2344(0x1ee)](_0x5c2344(0x264)),0x1;const _0x526c7e=resolveYamlFile(_0x5cc7ea);if(!existsSync(_0x526c7e))return showFileNotFoundError(_0x526c7e,_0x5cc7ea),0x1;_0xa950cb[_0x5c2344(0x256)]&&(console[_0x5c2344(0x1ee)](_0x5c2344(0x2a3)+_0xa950cb[_0x5c2344(0x2a1)]),console[_0x5c2344(0x1ee)](_0x5c2344(0x2b2)+_0x526c7e));let _0x22faad;try{_0x22faad=readFileSync(_0x526c7e,'utf-8');}catch(_0x439fff){const _0x1cb127=_0x439fff instanceof Error?_0x439fff[_0x5c2344(0x24e)]:String(_0x439fff);return console[_0x5c2344(0x1ee)](_0x5c2344(0x21b)+_0x1cb127),0x1;}let _0x1427cc;try{_0x1427cc=parseDef(_0x22faad);}catch(_0x4fc6f6){const _0x5cc4da=_0x4fc6f6 instanceof Error?_0x4fc6f6[_0x5c2344(0x24e)]:String(_0x4fc6f6);return console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)]('Error\x20parsing\x20YAML:\x20'+_0x5cc4da)),0x1;}if(_0xa950cb[_0x5c2344(0x290)]===!![]||_0xa950cb[_0x5c2344(0x290)]===''){const _0x33a698=_0x1427cc[_0x5c2344(0x1d3)]?.[_0x5c2344(0x20d)](_0x2a07b7=>_0x2a07b7['name'])||[];if(_0x33a698[_0x5c2344(0x2d8)]===0x0)console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)](_0x5c2344(0x1be)));else{console[_0x5c2344(0x1ee)](a21_0x5051ed[_0x5c2344(0x2d6)](_0x5c2344(0x28f))),console[_0x5c2344(0x1ee)](_0x5c2344(0x296));for(const _0x53e7d9 of _0x33a698){console['error']('\x20\x20'+a21_0x5051ed['cyan'](_0x53e7d9));}console[_0x5c2344(0x1ee)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5cc7ea+_0x5c2344(0x2ed)+_0x33a698[0x0]+'\x22');}return 0x1;}if(_0xa950cb['behavior']===!![]||_0xa950cb['behavior']===''){const _0x39d87b=_0x1427cc[_0x5c2344(0x1e4)]?.[_0x5c2344(0x20d)](_0x3cfb2a=>_0x3cfb2a[_0x5c2344(0x2df)])||[];if(_0x39d87b[_0x5c2344(0x2d8)]===0x0)console[_0x5c2344(0x1ee)](a21_0x5051ed['red'](_0x5c2344(0x1f4)));else{console['error'](a21_0x5051ed['red'](_0x5c2344(0x22e))),console[_0x5c2344(0x1ee)](_0x5c2344(0x27b));for(const _0x303ffe of _0x39d87b){console[_0x5c2344(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x5c2344(0x2f0)](_0x303ffe));}console['error'](_0x5c2344(0x29a)+_0x5cc7ea+_0x5c2344(0x26e)+_0x39d87b[0x0]+'\x22');}return 0x1;}const _0x438e4a=createCommandSpinner(a21_0x5051ed['dim']('Fetching\x20sample\x20data...'),{'verbose':_0xa950cb[_0x5c2344(0x256)]});_0x438e4a[_0x5c2344(0x2a0)]();const _0x25e6e4={'onProgress':_0xe0b983=>{_0x438e4a['text']=formatProgressMessage(_0xe0b983);}};if(_0xa950cb[_0x5c2344(0x24c)])_0x25e6e4['master']=!![];if(_0xa950cb[_0x5c2344(0x290)]&&typeof _0xa950cb['attribute']===_0x5c2344(0x220))_0x25e6e4[_0x5c2344(0x290)]=_0xa950cb['attribute'];if(_0xa950cb[_0x5c2344(0x216)]&&typeof _0xa950cb[_0x5c2344(0x216)]===_0x5c2344(0x220))_0x25e6e4['behavior']=_0xa950cb[_0x5c2344(0x216)];if(_0xa950cb[_0x5c2344(0x1ce)])_0x25e6e4['enriched']=!![];if(_0xa950cb[_0x5c2344(0x22f)])_0x25e6e4[_0x5c2344(0x22f)]=_0xa950cb[_0x5c2344(0x22f)];let _0x2a62a1;try{_0x2a62a1=await _0x5d42f1[_0x5c2344(0x2cc)][_0x5c2344(0x227)](_0x22faad,_0x25e6e4),_0x438e4a['stop']();}catch(_0x3d229f){_0x438e4a[_0x5c2344(0x269)]();throw _0x3d229f;}return await this['displayPreviewResults'](_0x2a62a1,{'master':_0xa950cb[_0x5c2344(0x24c)],'attribute':typeof _0xa950cb[_0x5c2344(0x290)]===_0x5c2344(0x220)?_0xa950cb[_0x5c2344(0x290)]:undefined,'behavior':typeof _0xa950cb['behavior']===_0x5c2344(0x220)?_0xa950cb[_0x5c2344(0x216)]:undefined,'enriched':_0xa950cb['enriched']}),_0x2a62a1[_0x5c2344(0x226)]?0x0:0x1;}async[a21_0x6e5b10(0x2dd)](_0x5755b0,_0x5a5c12){const _0x4dafd0=a21_0x6e5b10;console['error']('\x0a'+a21_0x5051ed[_0x4dafd0(0x259)](_0x4dafd0(0x215))+'\x20'+_0x5755b0[_0x4dafd0(0x2df)]),console[_0x4dafd0(0x1ee)]('═'['repeat'](0x3c));if(_0x5a5c12[_0x4dafd0(0x24c)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x31070f=a21_0x5051ed[_0x4dafd0(0x293)](_0x4dafd0(0x26f))+'\x20'+a21_0x5051ed[_0x4dafd0(0x259)](_0x5755b0[_0x4dafd0(0x24c)][_0x4dafd0(0x1e6)]+'.'+_0x5755b0[_0x4dafd0(0x24c)]['table']);await this['displaySampleData'](_0x31070f,_0x5755b0['sampleData']);}else{if(_0x5a5c12[_0x4dafd0(0x290)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x3046d0=a21_0x5051ed[_0x4dafd0(0x293)]('Attribute:')+'\x20'+a21_0x5051ed['bold'](_0x5a5c12[_0x4dafd0(0x290)]);await this['displaySampleData'](_0x3046d0,_0x5755b0['sampleData']);}else{if(_0x5a5c12[_0x4dafd0(0x216)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x56402c=a21_0x5051ed[_0x4dafd0(0x293)](_0x4dafd0(0x234))+'\x20'+a21_0x5051ed[_0x4dafd0(0x259)](_0x5a5c12[_0x4dafd0(0x216)]);await this[_0x4dafd0(0x212)](_0x56402c,_0x5755b0[_0x4dafd0(0x2b4)]);}else{if(_0x5a5c12[_0x4dafd0(0x1ce)]&&_0x5755b0[_0x4dafd0(0x2b4)]){const _0x88d261=a21_0x5051ed[_0x4dafd0(0x293)](_0x4dafd0(0x2ab))+'\x20'+a21_0x5051ed['bold'](_0x4dafd0(0x1c1));await this[_0x4dafd0(0x212)](_0x88d261,_0x5755b0[_0x4dafd0(0x2b4)]);}else!_0x5755b0[_0x4dafd0(0x2b4)]&&console['error']('\x0aNo\x20sample\x20data\x20available');}}}if(_0x5755b0[_0x4dafd0(0x2e7)]['length']>0x0){console['error']('─'[_0x4dafd0(0x236)](0x3c)),console[_0x4dafd0(0x1ee)]('\x0a'+a21_0x5051ed['red'](_0x4dafd0(0x20e)));for(const _0x2a2533 of _0x5755b0[_0x4dafd0(0x2e7)]){console['error']('\x20\x20'+a21_0x5051ed[_0x4dafd0(0x2d6)]('•')+'\x20'+_0x2a2533);}}}async['displaySampleData'](_0x97736c,_0x139034){const _0x2f5d35=a21_0x6e5b10;if(_0x139034[_0x2f5d35(0x2d8)]===0x0){console[_0x2f5d35(0x1ee)]('\x0a'+_0x97736c),console[_0x2f5d35(0x1ee)](_0x2f5d35(0x23f));return;}console[_0x2f5d35(0x1ee)]('\x0a'+_0x97736c);const _0x2a7fa5=Object[_0x2f5d35(0x2c7)](_0x139034[0x0])['map'](_0x10127e=>({'name':_0x10127e,'type':typeof _0x139034[0x0][_0x10127e]===_0x2f5d35(0x209)?_0x2f5d35(0x244):_0x2f5d35(0x246)})),_0x316311={'queryId':_0x2f5d35(0x1f9),'columns':_0x2a7fa5,'data':_0x139034,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x139034['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x118605=formatAsTable(_0x316311,_0x139034['length'],!![]);await writeOutput(_0x118605,undefined,_0x2f5d35(0x261));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x2ba);['description']=a21_0x6e5b10(0x27d);async[a21_0x6e5b10(0x22b)](_0x159e23){const _0x266890=a21_0x6e5b10,{options:_0x188f24,args:_0xbc0186,tdx:_0x14081b}=_0x159e23,_0x2404fb=_0x188f24,_0xb86aa0=_0xbc0186[0x0]||_0x188f24['parentSegment'];if(!_0xb86aa0)return showParentSegmentNotSetError(_0x266890(0x2e8)+_0x266890(0x21a)),0x1;const _0x3c04f7=resolveYamlFile(_0xb86aa0);if(existsSync(_0x3c04f7)){_0x2404fb['verbose']&&console[_0x266890(0x1ee)](_0x266890(0x1cf)+_0x3c04f7);let _0x582c13;try{_0x582c13=readFileSync(_0x3c04f7,_0x266890(0x242));}catch(_0xfa329a){const _0x4eca57=_0xfa329a instanceof Error?_0xfa329a[_0x266890(0x24e)]:String(_0xfa329a);return console['error'](_0x266890(0x21b)+_0x4eca57),0x1;}const _0x37e408=await withSpinner(_0x266890(0x1db),()=>_0x14081b[_0x266890(0x2cc)]['pushParentYaml'](_0x582c13),{'verbose':_0x2404fb[_0x266890(0x256)]}),_0xac66c6=_0x37e408['data'],{isNew:_0x5143fd,name:_0x4fdf6c,hasChanges:_0x4387e,diffFormatted:_0x10f1a1}=_0xac66c6;if(_0x4387e){_0x5143fd?console['error'](_0x266890(0x2a8)+_0x4fdf6c+'\x27:'):console['error'](_0x266890(0x200)+_0x4fdf6c+'\x27:');console['error']('─'[_0x266890(0x236)](0x3c)),console['error'](_0x10f1a1),console[_0x266890(0x1ee)]('─'[_0x266890(0x236)](0x3c));const _0x4d10da=_0x5143fd?'Create\x20parent\x20segment\x20\x27'+_0x4fdf6c+'\x27\x20and\x20run\x20workflow?':_0x266890(0x1d2)+_0x4fdf6c+_0x266890(0x1de);if(!_0x2404fb[_0x266890(0x1c7)]){const _0x16daf4=await confirmKey(_0x4d10da);if(!_0x16daf4)return console[_0x266890(0x1ee)](_0x266890(0x1e5)),0x1;}const _0x36f6b9=_0x5143fd?_0x266890(0x2dc):_0x266890(0x20b);await withSpinner(_0x36f6b9+_0x266890(0x272)+_0x4fdf6c+_0x266890(0x1da),()=>_0xac66c6[_0x266890(0x1ed)](),{'verbose':_0x2404fb[_0x266890(0x256)]});const _0x344778=_0x5143fd?_0x266890(0x20f):_0x266890(0x23e);console[_0x266890(0x1ee)]('✔\x20'+_0x344778+_0x266890(0x272)+_0x4fdf6c+'\x27');}else console[_0x266890(0x1ee)](_0x266890(0x1fb)+_0x4fdf6c+'\x27\x20is\x20up\x20to\x20date');}const _0x510d1e=await withSpinner(_0x266890(0x230)+_0xb86aa0+_0x266890(0x1da),()=>_0x14081b['segment'][_0x266890(0x262)](_0xb86aa0),{'verbose':_0x2404fb[_0x266890(0x256)]}),_0xe037ba=_0x510d1e[_0x266890(0x2c2)],_0x1c2bbd=getConsoleUrl(_0x2404fb['site'],_0x266890(0x21c)+_0xe037ba[_0x266890(0x2aa)]+_0x266890(0x274)+_0xe037ba[_0x266890(0x271)]+_0x266890(0x25e)+_0xe037ba[_0x266890(0x1f7)]);return console[_0x266890(0x1ee)](_0x266890(0x23a)),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x23b))+'\x20'+_0xe037ba['audienceId']),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x1cd))+'\x20'+_0xe037ba[_0x266890(0x1ea)]),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x28d))+'\x20'+_0xe037ba[_0x266890(0x271)]),console[_0x266890(0x1ee)]('\x20\x20'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x20c))+'\x20'+_0xe037ba[_0x266890(0x1f7)]),console[_0x266890(0x1ee)]('\x20\x20'+_0x1c2bbd),console[_0x266890(0x1ee)]('\x0a'+a21_0x5051ed[_0x266890(0x293)](_0x266890(0x247))+_0x266890(0x2ef)+_0xe037ba[_0x266890(0x1f7)]+_0x266890(0x24d)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{['name']=a21_0x6e5b10(0x249);['description']='List\x20available\x20fields\x20for\x20segmentation';async[a21_0x6e5b10(0x22b)](_0x48de83){const _0x480b10=a21_0x6e5b10,{options:_0x446bb7,args:_0x3f4461,tdx:_0x2ad519}=_0x48de83,_0x24268c=_0x3f4461[0x0]||_0x446bb7['parentSegment'];if(!_0x24268c)return showParentSegmentNotSetError(_0x480b10(0x1f2)+_0x480b10(0x1e2)),0x1;_0x446bb7[_0x480b10(0x256)]&&(console['error']('Site:\x20'+_0x446bb7[_0x480b10(0x2a1)]),console[_0x480b10(0x1ee)]('Parent\x20segment:\x20'+_0x24268c));const _0x366f1b=await withSpinner(_0x480b10(0x25b)+_0x24268c+_0x480b10(0x1da),()=>_0x2ad519[_0x480b10(0x2cc)][_0x480b10(0x297)](_0x24268c),{'verbose':_0x446bb7[_0x480b10(0x256)]}),_0x182135=_0x366f1b[_0x480b10(0x2c2)];console[_0x480b10(0x1ee)](_0x480b10(0x1d7)+_0x182135['length']+'\x20field'+(_0x182135[_0x480b10(0x2d8)]!==0x1?'s':''));if(_0x446bb7[_0x480b10(0x26a)]||_0x446bb7['jsonl'])return await handleSDKOutput(_0x182135,_0x446bb7),0x0;return displayFieldsHumanReadable(_0x182135,_0x24268c),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x1ff);[a21_0x6e5b10(0x1d9)]=a21_0x6e5b10(0x1fa);async['execute'](_0x50f6b8){const _0x3e80f4=a21_0x6e5b10,{options:_0x5d099b,args:_0x1ec199,tdx:_0x48cbb7}=_0x50f6b8,_0x549025=_0x5d099b,_0x36a713=_0x1ec199[0x0]||_0x5d099b[_0x3e80f4(0x1c5)];if(!_0x36a713)return showParentSegmentNotSetError(_0x3e80f4(0x1f5)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a'+'Options:\x0a'+'\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser'),0x1;_0x5d099b[_0x3e80f4(0x256)]&&(console[_0x3e80f4(0x1ee)](_0x3e80f4(0x2a3)+_0x5d099b[_0x3e80f4(0x2a1)]),console[_0x3e80f4(0x1ee)](_0x3e80f4(0x2ca)+_0x36a713));const _0x51ab22=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x36a713+_0x3e80f4(0x1da),()=>_0x48cbb7[_0x3e80f4(0x2cc)][_0x3e80f4(0x205)](_0x36a713),{'verbose':_0x5d099b['verbose']}),_0x108fcd=_0x51ab22[_0x3e80f4(0x2c2)];if(_0x549025[_0x3e80f4(0x2b9)]){const _0x843516=getConsoleNextUrl(_0x549025[_0x3e80f4(0x2a1)],_0x3e80f4(0x1ef)+_0x108fcd['id']);return console[_0x3e80f4(0x1ee)](a21_0x5051ed['green']('✔')+_0x3e80f4(0x2b8)+a21_0x5051ed['cyan'](_0x843516)),openBrowser(_0x843516),0x0;}return await handleSingleObjectOutput(_0x108fcd,_0x5d099b),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x243);['description']=a21_0x6e5b10(0x27c);async[a21_0x6e5b10(0x22b)](_0x13feb7){const _0x4ffd17=a21_0x6e5b10,{options:_0x418105,args:_0x552a12,tdx:_0x255ad0}=_0x13feb7,_0x5c9675=_0x552a12[0x0]||_0x418105[_0x4ffd17(0x1c5)];if(!_0x5c9675)return showParentSegmentNotSetError(_0x4ffd17(0x2c5)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment'),0x1;_0x418105['verbose']&&(console['error'](_0x4ffd17(0x2a3)+_0x418105[_0x4ffd17(0x2a1)]),console[_0x4ffd17(0x1ee)](_0x4ffd17(0x2ca)+_0x5c9675));const _0x422a7f=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x5c9675+_0x4ffd17(0x1da),()=>_0x255ad0[_0x4ffd17(0x2cc)][_0x4ffd17(0x254)](_0x5c9675),{'verbose':_0x418105[_0x4ffd17(0x256)]}),_0x22a1d7=_0x422a7f[_0x4ffd17(0x2c2)],_0x3358c3=await withSpinner(_0x4ffd17(0x25a)+_0x5c9675+'\x27...',()=>_0x255ad0[_0x4ffd17(0x2cc)][_0x4ffd17(0x2d3)](_0x22a1d7),{'verbose':_0x418105['verbose']}),_0x135179=await executeSchemaQuery(_0x3358c3['data'],_0x255ad0,_0x418105);return await handleQueryOutput(_0x135179,_0x418105),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]='segment:parent:sql';['description']=a21_0x6e5b10(0x2c3);async['execute'](_0x179f05){const _0x493982=a21_0x6e5b10,{options:_0x4d33a4,args:_0x54cc59,tdx:_0x476c11}=_0x179f05,_0x463f33=_0x54cc59[0x0]||_0x4d33a4[_0x493982(0x1c5)];if(!_0x463f33)return showParentSegmentNotSetError(_0x493982(0x2cb)+_0x493982(0x1cc)),0x1;_0x4d33a4[_0x493982(0x256)]&&(console[_0x493982(0x1ee)](_0x493982(0x2a3)+_0x4d33a4['site']),console[_0x493982(0x1ee)]('Parent\x20segment:\x20'+_0x463f33));const _0x2ec2a3=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x463f33+_0x493982(0x1da),()=>_0x476c11['segment']['resolveParentId'](_0x463f33),{'verbose':_0x4d33a4[_0x493982(0x256)]}),_0x3d4436=_0x2ec2a3[_0x493982(0x2c2)],_0x1b95c7=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x463f33+'\x27...',()=>_0x476c11[_0x493982(0x2cc)][_0x493982(0x2d3)](_0x3d4436),{'verbose':_0x4d33a4[_0x493982(0x256)]}),_0x1dbd46=_0x1b95c7[_0x493982(0x2c2)];return _0x4d33a4[_0x493982(0x2ec)]===_0x493982(0x26a)||_0x4d33a4['format']==='jsonl'?await handleSDKOutput([{'sql':_0x1dbd46}],_0x4d33a4):console[_0x493982(0x1f6)](_0x1dbd46),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a21_0x6e5b10(0x2df)]=a21_0x6e5b10(0x222);['description']=a21_0x6e5b10(0x2d5);async[a21_0x6e5b10(0x22b)](_0x160c58){const _0x1c48bf=a21_0x6e5b10,{options:_0x515c8a,args:_0x19230d,tdx:_0x41de13}=_0x160c58,_0x1f3deb=_0x19230d[0x0]||_0x515c8a[_0x1c48bf(0x1c5)];if(!_0x1f3deb)return showParentSegmentNotSetError(_0x1c48bf(0x2a2)+'\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;_0x515c8a[_0x1c48bf(0x256)]&&(console[_0x1c48bf(0x1ee)](_0x1c48bf(0x2a3)+_0x515c8a[_0x1c48bf(0x2a1)]),console[_0x1c48bf(0x1ee)](_0x1c48bf(0x2ca)+_0x1f3deb));const _0x4e9a4c=await withSpinner(_0x1c48bf(0x280)+_0x1f3deb+_0x1c48bf(0x1da),()=>_0x41de13[_0x1c48bf(0x2cc)]['resolveParentId'](_0x1f3deb),{'verbose':_0x515c8a[_0x1c48bf(0x256)]}),_0x2fed40=_0x4e9a4c['data'],_0x461c1c=await withSpinner(_0x1c48bf(0x25a)+_0x1f3deb+_0x1c48bf(0x1da),()=>_0x41de13[_0x1c48bf(0x2cc)][_0x1c48bf(0x2d3)](_0x2fed40),{'verbose':_0x515c8a[_0x1c48bf(0x256)]});let _0x238872=_0x461c1c['data'];const _0x1f3617=resolveLimit(_0x515c8a[_0x1c48bf(0x20a)],DEFAULT_DISPLAY_LIMIT),_0x154191=/\bLIMIT\s+\d+/i[_0x1c48bf(0x25c)](_0x238872);!_0x154191&&(_0x238872=_0x238872['trim']()[_0x1c48bf(0x27a)](/;+$/,''),_0x238872=_0x1c48bf(0x1e0)+_0x238872+_0x1c48bf(0x1d4)+_0x1f3617);_0x515c8a[_0x1c48bf(0x256)]&&console[_0x1c48bf(0x1ee)](_0x1c48bf(0x1d5)+_0x238872);const _0x5b043c=await withProgressSpinner(_0x1c48bf(0x219),async _0x343bbc=>{const _0x3484ef=_0x1c48bf,_0x531363=await _0x41de13[_0x3484ef(0x2b1)][_0x3484ef(0x22b)](_0x238872,{'catalog':'td','schema':_0x3484ef(0x283),'onJobId':_0x469b1d=>{const _0x33f9f8=_0x3484ef;_0x343bbc[_0x33f9f8(0x28c)](_0x469b1d);}});return _0x531363;},{'verbose':_0x515c8a[_0x1c48bf(0x256)]}),_0x38322b=_0x5b043c[_0x1c48bf(0x2c2)],_0x5bdde7=_0x38322b['jobId']?_0x1c48bf(0x1e8)+_0x38322b[_0x1c48bf(0x240)]+']':'';return console[_0x1c48bf(0x1ee)](_0x1c48bf(0x21d)+_0x38322b['stats'][_0x1c48bf(0x26c)]['toLocaleString']()+_0x1c48bf(0x281)+(_0x1c48bf(0x28b)+formatElapsed(_0x38322b['stats']['elapsedTimeMillis'])+_0x5bdde7)),await handleQueryOutput(_0x38322b,_0x515c8a),0x0;}}
1
+ const a21_0x504221=a21_0x520a;(function(_0x26fbb2,_0x1dbbfd){const _0x3f2567=a21_0x520a,_0x20d1dd=_0x26fbb2();while(!![]){try{const _0x265684=-parseInt(_0x3f2567(0x1a1))/0x1*(parseInt(_0x3f2567(0x2aa))/0x2)+parseInt(_0x3f2567(0x286))/0x3*(-parseInt(_0x3f2567(0x1d8))/0x4)+parseInt(_0x3f2567(0x1b1))/0x5*(-parseInt(_0x3f2567(0x23d))/0x6)+-parseInt(_0x3f2567(0x1c5))/0x7+parseInt(_0x3f2567(0x1ab))/0x8*(-parseInt(_0x3f2567(0x1c3))/0x9)+-parseInt(_0x3f2567(0x27a))/0xa*(parseInt(_0x3f2567(0x1f9))/0xb)+parseInt(_0x3f2567(0x1d0))/0xc;if(_0x265684===_0x1dbbfd)break;else _0x20d1dd['push'](_0x20d1dd['shift']());}catch(_0x41c774){_0x20d1dd['push'](_0x20d1dd['shift']());}}}(a21_0x5127,0x2ec17));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a21_0x11fd87 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';function a21_0x520a(_0x2d505c,_0x3bb70){_0x2d505c=_0x2d505c-0x18b;const _0x5127de=a21_0x5127();let _0x520a1a=_0x5127de[_0x2d505c];return _0x520a1a;}import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a21_0x16b0bb from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a21_0x504221(0x1c4),LEGACY_PARENT_SEGMENT_DIR=a21_0x504221(0x260);function openBrowser(_0x4306c5){const _0x1b35d4=a21_0x504221,_0x1f6f4a=process[_0x1b35d4(0x242)],_0x41468c=_0x1f6f4a===_0x1b35d4(0x251)?_0x1b35d4(0x222):_0x1f6f4a==='win32'?'start':'xdg-open';spawn(_0x41468c,[_0x4306c5],{'detached':!![],'stdio':_0x1b35d4(0x1f2)})[_0x1b35d4(0x1ed)]();}function migrateLegacyDirectory(){const _0x2a6c10=a21_0x504221;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x6b489=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x6b489[_0x2a6c10(0x1dd)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2a6c10(0x1c6)](a21_0x16b0bb[_0x2a6c10(0x1cf)](_0x2a6c10(0x21c)+LEGACY_PARENT_SEGMENT_DIR+_0x2a6c10(0x215)+PARENT_SEGMENT_DIR+_0x2a6c10(0x1ae))),console[_0x2a6c10(0x1c6)](a21_0x16b0bb[_0x2a6c10(0x29b)](_0x2a6c10(0x195)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x2a6c10(0x1c6)](a21_0x16b0bb[_0x2a6c10(0x1cf)](_0x2a6c10(0x199)+LEGACY_PARENT_SEGMENT_DIR+_0x2a6c10(0x28e)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a21_0x16b0bb['green'](_0x2a6c10(0x200)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x26a332){const _0x8bd6d=_0x26a332 instanceof Error?_0x26a332[_0x2a6c10(0x27d)]:String(_0x26a332);return console[_0x2a6c10(0x1c6)](a21_0x16b0bb[_0x2a6c10(0x25e)](_0x2a6c10(0x1a5)+_0x8bd6d+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a21_0x504221(0x21a)](_0x4c660e){return migrateLegacyDirectory(),super['run'](_0x4c660e);}}function resolveYamlFile(_0x4570d9){const _0x4a7107=a21_0x504221;if(_0x4570d9['endsWith'](_0x4a7107(0x2a0))||_0x4570d9[_0x4a7107(0x257)](_0x4a7107(0x27e)))return _0x4570d9;return a21_0x11fd87[_0x4a7107(0x1e2)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4570d9)+_0x4a7107(0x2a0));}function formatProgressMessage(_0x2e77a7){const _0xe1f2cf=a21_0x504221,_0x2cf47c=_0x2e77a7['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2cf47c){const [,_0x2dd090,_0x270750,_0x689095='']=_0x2cf47c;return a21_0x16b0bb[_0xe1f2cf(0x29b)](_0x2dd090+':')+'\x20'+_0x270750+a21_0x16b0bb[_0xe1f2cf(0x29b)](_0x689095);}return a21_0x16b0bb['dim'](_0x2e77a7);}function showFileNotFoundError(_0x238c29,_0x2fc37f){const _0x2cb7d1=a21_0x504221;console['error'](a21_0x16b0bb['red']('Error:\x20File\x20not\x20found:\x20'+_0x238c29+'\x0a')),console[_0x2cb7d1(0x1c6)](a21_0x16b0bb['cyan'](_0x2cb7d1(0x18c)+_0x2fc37f+_0x2cb7d1(0x1e0)));}function showParentSegmentNotSetError(_0x463da2){const _0x48e605=a21_0x504221;console[_0x48e605(0x1c6)](a21_0x16b0bb[_0x48e605(0x1cf)](_0x48e605(0x212))),console[_0x48e605(0x1c6)](_0x463da2);}export class ParentSegmentListCommand extends BaseCommand{['name']=a21_0x504221(0x289);[a21_0x504221(0x2a4)]='List\x20parent\x20segments';async['execute'](_0x4209f4){const _0x4d442e=a21_0x504221,{options:_0x3e122c,args:_0x3ae8e9,tdx:_0x435399}=_0x4209f4,_0x2a6a08=_0x3ae8e9[0x0];_0x3e122c[_0x4d442e(0x1bc)]&&(console[_0x4d442e(0x1c6)]('Site:\x20'+_0x3e122c['site']),_0x2a6a08&&console['error'](_0x4d442e(0x29f)+_0x2a6a08));const _0x466879=await withSpinner(_0x2a6a08?_0x4d442e(0x288)+_0x2a6a08+_0x4d442e(0x1de):_0x4d442e(0x25a),()=>_0x435399['segment'][_0x4d442e(0x1ac)](),{'verbose':_0x3e122c[_0x4d442e(0x1bc)]});let _0x52e8a6=_0x466879['data'];if(_0x2a6a08){const _0x6cd294=_0x2a6a08[_0x4d442e(0x1fa)](/[.+^${}()|[\]\\]/g,_0x4d442e(0x29c))[_0x4d442e(0x1fa)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x5ced00=new RegExp('^'+_0x6cd294+'$','i');_0x52e8a6=_0x52e8a6['filter'](_0xe29ecd=>_0x5ced00[_0x4d442e(0x232)](_0xe29ecd['attributes'][_0x4d442e(0x1cd)]));}_0x52e8a6[_0x4d442e(0x24d)]((_0x3c1be8,_0x54f356)=>_0x3c1be8[_0x4d442e(0x24a)][_0x4d442e(0x1cd)][_0x4d442e(0x1a3)](_0x54f356[_0x4d442e(0x24a)]['name'])),console['error'](_0x4d442e(0x219)+_0x52e8a6['length']+_0x4d442e(0x206)+(_0x52e8a6[_0x4d442e(0x24e)]!==0x1?'s':''));const _0x8a366e=_0x1d0982=>{const _0x97693f=_0x4d442e;return getConsoleNextUrl(_0x3e122c[_0x97693f(0x20a)],_0x97693f(0x1e3)+_0x1d0982);};if(_0x3e122c[_0x4d442e(0x223)]===_0x4d442e(0x280)||_0x3e122c[_0x4d442e(0x223)]===_0x4d442e(0x282)){const _0x155421=_0x52e8a6[_0x4d442e(0x285)](_0x498b9e=>({..._0x498b9e,'url':_0x8a366e(_0x498b9e['id'])}));await handleSDKOutput(_0x155421,_0x3e122c);}else{if(_0x52e8a6[_0x4d442e(0x24e)]===0x0)_0x2a6a08?console[_0x4d442e(0x1b7)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x2a6a08):console[_0x4d442e(0x1b7)](_0x4d442e(0x275));else for(const _0x387741 of _0x52e8a6){const _0x2924af=_0x387741['attributes'][_0x4d442e(0x196)]?a21_0x16b0bb[_0x4d442e(0x29b)]('\x20('+formatRows(_0x387741[_0x4d442e(0x24a)]['population'])+')'):'',_0x2c3b02=hyperlink(_0x387741[_0x4d442e(0x24a)][_0x4d442e(0x1cd)],_0x8a366e(_0x387741['id']));console[_0x4d442e(0x1b7)](_0x4d442e(0x2ba)+_0x2c3b02+_0x2924af);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a21_0x504221(0x22f);[a21_0x504221(0x2a4)]='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a21_0x504221(0x1ca)](_0x137ba6){const _0x17c87d=a21_0x504221,{options:_0x139fe7,args:_0xc8d098,tdx:_0x2fad37}=_0x137ba6;console[_0x17c87d(0x1c6)](_0x17c87d(0x1bb)+_0x17c87d(0x24c)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x4bc293=_0x139fe7;if(_0xc8d098[_0x17c87d(0x24e)]===0x0)return console['error'](a21_0x16b0bb[_0x17c87d(0x25e)](_0x17c87d(0x23c))),console[_0x17c87d(0x1c6)](_0x17c87d(0x28b)),0x1;const _0x1ada46=_0xc8d098[0x0];if(!_0x4bc293[_0x17c87d(0x21e)]||!_0x4bc293[_0x17c87d(0x267)])return console[_0x17c87d(0x1c6)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console[_0x17c87d(0x1c6)](_0x17c87d(0x28b)),0x1;_0x4bc293[_0x17c87d(0x1bc)]&&(console[_0x17c87d(0x1c6)]('Site:\x20'+_0x4bc293[_0x17c87d(0x20a)]),console[_0x17c87d(0x1c6)](_0x17c87d(0x28a)+_0x1ada46),console['error'](_0x17c87d(0x1f7)+_0x4bc293[_0x17c87d(0x21e)]),console[_0x17c87d(0x1c6)](_0x17c87d(0x22d)+_0x4bc293[_0x17c87d(0x267)]));const _0x310eaf=await loadJSONFromOptions(_0x4bc293[_0x17c87d(0x24a)],_0x4bc293['attributesFile']),_0x538e7f=await loadJSONFromOptions(_0x4bc293['behaviors'],_0x4bc293[_0x17c87d(0x1d7)]),_0x21da3b=await loadJSONFromOptions(_0x4bc293['customerGroup'],_0x4bc293[_0x17c87d(0x1dc)]),_0x3468f4={'name':_0x1ada46,'description':_0x4bc293[_0x17c87d(0x2a4)],'scheduleType':_0x4bc293[_0x17c87d(0x1b6)],'scheduleOption':_0x4bc293[_0x17c87d(0x28d)],'timezone':_0x4bc293['timezone'],'master':{'parentDatabaseName':_0x4bc293['database'],'parentTableName':_0x4bc293['table']},'attributes':_0x310eaf,'behaviors':_0x538e7f,'customerGroup':_0x21da3b},_0x3b09b2=await withSpinner(_0x17c87d(0x274)+_0x1ada46+'\x27...',()=>_0x2fad37['segment'][_0x17c87d(0x18e)](_0x3468f4),{'verbose':_0x139fe7['verbose']}),_0x305e1d=_0x3b09b2[_0x17c87d(0x18f)];return console[_0x17c87d(0x1c6)](_0x17c87d(0x234)+_0x305e1d[_0x17c87d(0x1cd)]+_0x17c87d(0x20e)+_0x305e1d['id']),await handleSDKOutput([_0x305e1d],_0x139fe7),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{['name']=a21_0x504221(0x228);[a21_0x504221(0x2a4)]=a21_0x504221(0x272);async[a21_0x504221(0x1ca)](_0x411977){const _0x14d776=a21_0x504221,{options:_0x35a359,args:_0x475aa8,tdx:_0x2c3306}=_0x411977;console[_0x14d776(0x1c6)](_0x14d776(0x1d4)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+_0x14d776(0x287));const _0x1c4669=_0x35a359;if(_0x475aa8[_0x14d776(0x24e)]===0x0)return console[_0x14d776(0x1c6)](a21_0x16b0bb['red'](_0x14d776(0x23c))),console[_0x14d776(0x1c6)](_0x14d776(0x269)),0x1;const _0x16a712=_0x475aa8[0x0];_0x1c4669[_0x14d776(0x1bc)]&&(console[_0x14d776(0x1c6)]('Site:\x20'+_0x1c4669[_0x14d776(0x20a)]),console[_0x14d776(0x1c6)]('Parent\x20segment:\x20'+_0x16a712));const _0x4f7b62=await withSpinner(_0x14d776(0x25f)+_0x16a712+'\x27...',()=>_0x2c3306[_0x14d776(0x29e)]['getParentFull'](_0x16a712),{'verbose':_0x1c4669[_0x14d776(0x1bc)]}),_0x52ec77=_0x4f7b62['data'],_0x2ce839=await loadJSONFromOptions(_0x1c4669[_0x14d776(0x26c)],_0x1c4669['addAttributesFile']),_0x1f1788=await loadJSONFromOptions(_0x1c4669[_0x14d776(0x19a)],_0x1c4669[_0x14d776(0x1fc)]),_0x4a4642={'name':_0x52ec77['name'],'description':_0x1c4669['description']!==undefined?_0x1c4669[_0x14d776(0x2a4)]:_0x52ec77[_0x14d776(0x2a4)],'scheduleType':_0x1c4669[_0x14d776(0x1b6)]!==undefined?_0x1c4669['scheduleType']:_0x52ec77[_0x14d776(0x1b6)],'scheduleOption':_0x1c4669[_0x14d776(0x28d)]!==undefined?_0x1c4669['scheduleOption']:_0x52ec77[_0x14d776(0x28d)],'timezone':_0x1c4669[_0x14d776(0x1e6)]!==undefined?_0x1c4669['timezone']:_0x52ec77['timezone'],'master':_0x52ec77['master'],'attributes':_0x2ce839?[..._0x52ec77[_0x14d776(0x24a)]||[],..._0x2ce839]:_0x52ec77[_0x14d776(0x24a)],'behaviors':_0x1f1788?[..._0x52ec77[_0x14d776(0x240)]||[],..._0x1f1788]:_0x52ec77[_0x14d776(0x240)],'customerGroup':_0x52ec77['customerGroup']},_0x2c9916=await withSpinner(_0x14d776(0x211)+_0x16a712+_0x14d776(0x1de),()=>_0x2c3306[_0x14d776(0x29e)][_0x14d776(0x226)](_0x16a712,_0x4a4642),{'verbose':_0x1c4669[_0x14d776(0x1bc)]}),_0x1339de=_0x2c9916[_0x14d776(0x18f)];return console[_0x14d776(0x1c6)](_0x14d776(0x2a7)+_0x1339de[_0x14d776(0x1cd)]+'\x27'),await handleSDKOutput([_0x1339de],_0x1c4669),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a21_0x504221(0x1cd)]=a21_0x504221(0x207);['description']='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a21_0x504221(0x1ca)](_0x6a84da){const _0x15175a=a21_0x504221,{options:_0x29ea5d,args:_0x16827b,tdx:_0x3daf92}=_0x6a84da,_0x266baf=_0x29ea5d,_0x31f3d0=_0x16827b[0x0]||_0x29ea5d['parentSegment'];if(!_0x31f3d0)return showParentSegmentNotSetError(_0x15175a(0x18d)+_0x15175a(0x1e9)),0x1;if(_0x266baf['use']&&_0x266baf[_0x15175a(0x1c8)])return console[_0x15175a(0x1c6)](a21_0x16b0bb[_0x15175a(0x25e)](_0x15175a(0x27c))),console[_0x15175a(0x1c6)](a21_0x16b0bb[_0x15175a(0x29b)](_0x15175a(0x2b6))),console[_0x15175a(0x1c6)](a21_0x16b0bb[_0x15175a(0x29b)](_0x15175a(0x19c)+PARENT_SEGMENT_DIR+_0x15175a(0x298))),console[_0x15175a(0x1c6)](a21_0x16b0bb['cyan'](_0x15175a(0x1ce))),0x1;const _0x27684e=_0x266baf['output']||a21_0x11fd87[_0x15175a(0x1e2)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x31f3d0)+_0x15175a(0x2a0));_0x266baf['verbose']&&(console[_0x15175a(0x1c6)](_0x15175a(0x1b3)+_0x266baf[_0x15175a(0x20a)]),console['error'](_0x15175a(0x1ef)+_0x31f3d0),console[_0x15175a(0x1c6)](_0x15175a(0x25b)+_0x27684e));const _0x5731e7=await withSpinner(_0x15175a(0x273)+_0x31f3d0+_0x15175a(0x1de),()=>_0x3daf92[_0x15175a(0x29e)][_0x15175a(0x2ab)](_0x31f3d0),{'verbose':_0x266baf[_0x15175a(0x1bc)]}),_0x1a61df=_0x5731e7['data'];if(existsSync(_0x27684e)){const _0x4bce08=readFileSync(_0x27684e,_0x15175a(0x255)),_0x2a4760=generateDiff(_0x4bce08,_0x1a61df);if(!hasChanges(_0x2a4760))console['error'](a21_0x16b0bb[_0x15175a(0x1cc)]('✔')+_0x15175a(0x19b)+a21_0x16b0bb['cyan'](_0x27684e)+_0x15175a(0x1f5));else{console['error'](_0x15175a(0x194)+_0x27684e+'\x27:'),console[_0x15175a(0x1c6)]('─'[_0x15175a(0x270)](0x3c)),console[_0x15175a(0x1c6)](formatDiffWithColors(_0x2a4760)),console[_0x15175a(0x1c6)]('─'['repeat'](0x3c));if(!_0x266baf[_0x15175a(0x233)]){const _0x5b9b7e=await confirmKey(_0x15175a(0x1da)+_0x27684e+'\x27?');if(!_0x5b9b7e)return console[_0x15175a(0x1c6)](_0x15175a(0x239)),0x1;}writeFileSync(_0x27684e,_0x1a61df,_0x15175a(0x255)),console['error'](a21_0x16b0bb[_0x15175a(0x1cc)]('✔')+_0x15175a(0x244)+a21_0x16b0bb[_0x15175a(0x1e8)](_0x27684e));}}else{const _0x1b2624=a21_0x11fd87[_0x15175a(0x283)](_0x27684e);!existsSync(_0x1b2624)&&mkdirSync(_0x1b2624,{'recursive':!![]}),writeFileSync(_0x27684e,_0x1a61df,'utf-8'),console[_0x15175a(0x1c6)](a21_0x16b0bb[_0x15175a(0x1cc)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a21_0x16b0bb[_0x15175a(0x1e8)](_0x27684e));}return saveSessionContext({'parent_segment':_0x31f3d0},_0x266baf['session']),console[_0x15175a(0x1c6)](a21_0x16b0bb[_0x15175a(0x1cc)]('✔')+_0x15175a(0x213)+a21_0x16b0bb[_0x15175a(0x29b)]('parent_segment')+'\x20=\x20'+a21_0x16b0bb[_0x15175a(0x1e8)](_0x31f3d0)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{['name']=a21_0x504221(0x293);[a21_0x504221(0x2a4)]=a21_0x504221(0x261);async['execute'](_0x2cc9cf){const _0xc72ac2=a21_0x504221,{options:_0x10fc0b,args:_0x2a97a5,tdx:_0x54d25b}=_0x2cc9cf,_0x131e56=_0x10fc0b,_0x4c6c94=_0x2a97a5[0x0]||_0x10fc0b['parentSegment'];if(!_0x4c6c94)return showParentSegmentNotSetError(_0xc72ac2(0x2b2)+_0xc72ac2(0x2b9)),0x1;const _0x19a759=resolveYamlFile(_0x4c6c94);if(!existsSync(_0x19a759))return showFileNotFoundError(_0x19a759,_0x4c6c94),0x1;_0x131e56[_0xc72ac2(0x1bc)]&&(console[_0xc72ac2(0x1c6)](_0xc72ac2(0x1b3)+_0x131e56[_0xc72ac2(0x20a)]),console[_0xc72ac2(0x1c6)](_0xc72ac2(0x201)+_0x19a759));let _0x2807c4;try{_0x2807c4=readFileSync(_0x19a759,'utf-8');}catch(_0x404935){const _0x125104=_0x404935 instanceof Error?_0x404935['message']:String(_0x404935);return console[_0xc72ac2(0x1c6)](_0xc72ac2(0x1fd)+_0x125104),0x1;}const _0x58ca3e=await withSpinner(_0xc72ac2(0x25c),()=>_0x54d25b['segment'][_0xc72ac2(0x292)](_0x2807c4),{'verbose':_0x131e56[_0xc72ac2(0x1bc)]}),_0x5730e2=_0x58ca3e[_0xc72ac2(0x18f)],{isNew:_0x29f503,name:_0xf49111,hasChanges:_0x3962b3,diffFormatted:_0xb985b6}=_0x5730e2;if(!_0x3962b3)return console[_0xc72ac2(0x1c6)](_0xc72ac2(0x214)+_0xf49111+_0xc72ac2(0x1b2)),0x0;_0x29f503?console[_0xc72ac2(0x1c6)](_0xc72ac2(0x20b)+_0xf49111+'\x27:'):console[_0xc72ac2(0x1c6)](_0xc72ac2(0x2a1)+_0xf49111+'\x27:');console[_0xc72ac2(0x1c6)]('─'['repeat'](0x3c)),console['error'](_0xb985b6),console[_0xc72ac2(0x1c6)]('─'[_0xc72ac2(0x270)](0x3c));const _0x3e2d24=_0x29f503?_0xc72ac2(0x18b)+_0xf49111+'\x27?':_0xc72ac2(0x205)+_0xf49111+'\x27?';if(!_0x131e56[_0xc72ac2(0x233)]){const _0x53ea0a=await confirmKey(_0x3e2d24);if(!_0x53ea0a)return console[_0xc72ac2(0x1c6)](_0xc72ac2(0x239)),0x1;}const _0x197ef8=_0x29f503?_0xc72ac2(0x210):'Updating',_0x392d15=await withSpinner(_0x197ef8+_0xc72ac2(0x2bd)+_0xf49111+_0xc72ac2(0x1de),()=>_0x5730e2[_0xc72ac2(0x229)](),{'verbose':_0x131e56[_0xc72ac2(0x1bc)]}),_0x204862=_0x392d15[_0xc72ac2(0x18f)],_0x209125=getConsoleNextUrl(_0x131e56[_0xc72ac2(0x20a)],_0xc72ac2(0x1e3)+_0x204862['id']),_0x41983b=_0x29f503?'Created':_0xc72ac2(0x264);return console['error']('✔\x20'+_0x41983b+'\x20parent\x20segment\x20\x27'+_0x204862[_0xc72ac2(0x1cd)]+'\x27'),console['error']('\x20\x20'+_0x209125),0x0;}}function a21_0x5127(){const _0x205007=['\x20--behavior\x20\x22<name>\x22','Options:','attributes','text','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','sort','length','\x0a✔\x20Workflow\x20started','displaySummary','darwin','trim','Show\x20parent\x20segment\x20schema\x20(column\x20types)','rowCount','utf-8','columns','endsWith','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','Resolving\x20parent\x20segment\x20\x27','Listing\x20parent\x20segments...','Output\x20file:\x20','Analyzing\x20changes...','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','red','Fetching\x20current\x20configuration\x20for\x20\x27','parent_segment','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','Available\x20behaviors:','Show\x20parent\x20segment\x20details','Updated','jobId','Rows:','table','\x27\x20and\x20run\x20workflow?','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','To\x20cancel:','Available\x20attributes:','addAttributes','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','tdx\x20segment\x20parent\x20preview\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','repeat','coveragePercent','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Fetching\x20parent\x20segment\x20\x27','Creating\x20parent\x20segment\x20\x27','No\x20parent\x20segments\x20found','resolveParentId','Get\x20SQL\x20query\x20for\x20parent\x20segment','limit','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','7570zGmeNV','Options:\x0a','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','message','.yaml','customerPercent','json','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','jsonl','dirname','workflowSessionId','map','3UnZafW','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Listing\x20parent\x20segments\x20matching\x20\x27','segment:parent:list','Name:\x20','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Join\x20on:','scheduleOption','/\x20→\x20','schemaError','segment:parent:fields','Error:\x20--behavior\x20requires\x20a\x20name\x0a','pushParentYaml','segment:parent:push','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','/sessions/','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x20\x20\x20\x20-\x20','/{name}.yml\x0a','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Validating\x20configuration...','dim','\x5c$&','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','segment','Pattern:\x20','.yml','\x0aChanges\x20to\x20apply\x20to\x20\x27','workflowAttemptId','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','description','attribute','FINISHED','✔\x20Updated\x20parent\x20segment\x20\x27','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20--behavior\x20\x22','2GBIZWB','pullParentYaml','/app/workflows/','Validate:','bold','all','toFixed','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','elapsedTimeMillis','varchar','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','processedRows','sampleData','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','👥\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','totalEvents','\x20parent\x20segment\x20\x27','Create\x20parent\x20segment\x20\x27','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','createParent','data','in\x20','interval','Behavior:','column','\x0aChanges\x20to\x20\x27','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','population','displayPreviewResults','customersWithEvents','\x0a⚠️\x20\x20Migrating:\x20','addBehaviors','\x20No\x20changes\x20-\x20','using\x20the\x20default\x20path:\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','enriched','-1d','288119fSgvtw','Fetching\x20sample\x20data...','localeCompare','errors','✘\x20Failed\x20to\x20rename\x20directory:\x20','segment:parent:sql','behavior','\x20--attribute\x20\x22','schemaValid','Attribute:','1964080kPlcXW','listParents','Events:','/\x20directories\x20exist.','Fetching\x20SQL\x20for\x20\x27','Master\x20Table','302195XPNUPL','\x27\x20is\x20already\x20up\x20to\x20date','Site:\x20','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','number','scheduleType','log','allValid','validateParentYaml','segment:parent:show','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','verbose','Attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','Session:','displaySampleData','Master:','getParentSQL','9WZDowR','parent_segments','1478288tMLDKW','error','master','output','double','execute','List\x20available\x20fields\x20for\x20segmentation','green','name','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','yellow','20935680tqrnOz','Preview:','Columns:','string','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Options\x20(one\x20required):\x0a','query','behaviorsFile','1444684jFcvAT','displayBehaviorsStats','Overwrite\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','customerGroupFile','isDirectory','\x27...','\x20[Job\x20ID:\x20','`\x20to\x20download\x20the\x20configuration\x20first','parentSegment','join','/app/dw/parentSegments/','stop','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','timezone','\x20\x20No\x20sample\x20data\x20available','cyan','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','joinKey','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','segment:parent:desc','unref','Found\x20YAML\x20file:\x20','Parent\x20segment:\x20','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Customers:','ignore','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20--enriched','\x20is\x20already\x20up\x20to\x20date','segment:parent:validate','Database:\x20','displayMasterInfo','4741LBnVpl','replace','displayValidateResults','addBehaviorsFile','Error\x20reading\x20file:\x20','Errors:','information_schema','✔\x20Renamed\x20directory\x20to\x20','YAML\x20file:\x20','Executing\x20parent\x20segment\x20query...','keys','listFields','Apply\x20changes\x20to\x20\x27','\x20parent\x20segment','segment:parent:pull','\x20Opening\x20','runParent','site','\x0aNew\x20parent\x20segment\x20\x27','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','status','\x27\x20with\x20ID:\x20','segment:parent:preview','Creating','Updating\x20parent\x20segment\x20\x27','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','\x20Context\x20set:\x20','✔\x20No\x20changes\x20-\x20\x27','/\x20and\x20','matchedCount','\x20rows)','web','✔\x20Found\x20','run','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','\x0a⚠️\x20\x20Both\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','database','Updating','\x27\x20is\x20up\x20to\x20date','Error:','open','format','To\x20view\x20sample\x20data:','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','updateParent','label','segment:parent:update','apply','SELECT\x20*\x20FROM\x20(\x0a','\x0aNo\x20sample\x20data\x20available','stats','Table:\x20','Master\x20+\x20Attributes','segment:parent:create','Behaviors','\x20=\x20','test','yes','✔\x20Created\x20parent\x20segment\x20\x27','foreignKey','displayPreviewHints','Join:','displayColumns','Aborted.','Status:','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Error:\x20Parent\x20segment\x20name\x20is\x20required','12eONXBA','Listing\x20fields\x20for\x20\x27','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','behaviors','\x20Configuration\x20is\x20valid','platform','displayAttributesStats','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Error\x20parsing\x20YAML:\x20','\x20--interval\x20','toLocaleString'];a21_0x5127=function(){return _0x205007;};return a21_0x5127();}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a21_0x504221(0x1cd)]=a21_0x504221(0x1f6);[a21_0x504221(0x2a4)]=a21_0x504221(0x2b1);async[a21_0x504221(0x1ca)](_0x3b4907){const _0x2cf5b1=a21_0x504221,{options:_0x53abc5,args:_0x5ae548,tdx:_0x193c51}=_0x3b4907,_0x4900e3=_0x53abc5,_0x5555ef=_0x5ae548[0x0]||_0x53abc5[_0x2cf5b1(0x1e1)];if(!_0x5555ef)return showParentSegmentNotSetError(_0x2cf5b1(0x281)+_0x2cf5b1(0x1f3)+_0x2cf5b1(0x27b)+_0x2cf5b1(0x2b5)+_0x2cf5b1(0x19d)+_0x2cf5b1(0x26d)),0x1;const _0x540213=resolveYamlFile(_0x5555ef);if(!existsSync(_0x540213))return showFileNotFoundError(_0x540213,_0x5555ef),0x1;_0x4900e3[_0x2cf5b1(0x1bc)]&&(console[_0x2cf5b1(0x1c6)](_0x2cf5b1(0x1b3)+_0x4900e3[_0x2cf5b1(0x20a)]),console[_0x2cf5b1(0x1c6)]('YAML\x20file:\x20'+_0x540213));let _0x5d343f;try{_0x5d343f=readFileSync(_0x540213,_0x2cf5b1(0x255));}catch(_0x2c1f53){const _0x3a1d27=_0x2c1f53 instanceof Error?_0x2c1f53[_0x2cf5b1(0x27d)]:String(_0x2c1f53);return console[_0x2cf5b1(0x1c6)]('Error\x20reading\x20file:\x20'+_0x3a1d27),0x1;}const _0x2f0793=createCommandSpinner(a21_0x16b0bb['dim'](_0x2cf5b1(0x29a)),{'verbose':_0x4900e3[_0x2cf5b1(0x1bc)]});_0x2f0793['start']();const _0x40dd00={'onProgress':_0xd1bbdf=>{const _0x1186fa=_0x2cf5b1;_0x2f0793[_0x1186fa(0x24b)]=formatProgressMessage(_0xd1bbdf);}};if(_0x4900e3[_0x2cf5b1(0x1c7)])_0x40dd00['master']=!![];if(_0x4900e3[_0x2cf5b1(0x19f)])_0x40dd00[_0x2cf5b1(0x19f)]=!![];_0x4900e3[_0x2cf5b1(0x2a5)]&&(_0x40dd00[_0x2cf5b1(0x2a5)]=_0x4900e3['attribute']);_0x4900e3[_0x2cf5b1(0x1a7)]&&(_0x40dd00[_0x2cf5b1(0x1a7)]=_0x4900e3[_0x2cf5b1(0x1a7)]);if(_0x4900e3[_0x2cf5b1(0x191)])_0x40dd00['interval']=_0x4900e3[_0x2cf5b1(0x191)];let _0x26aef4;try{_0x26aef4=await _0x193c51[_0x2cf5b1(0x29e)][_0x2cf5b1(0x1b9)](_0x5d343f,_0x40dd00),_0x2f0793[_0x2cf5b1(0x1e4)]();}catch(_0x218a44){_0x2f0793[_0x2cf5b1(0x1e4)]();throw _0x218a44;}const _0x5d876b=_0x4900e3[_0x2cf5b1(0x191)]||_0x2cf5b1(0x1a0);return this['displayValidateResults'](_0x26aef4,_0x40dd00,_0x540213,_0x5d876b),_0x26aef4[_0x2cf5b1(0x1b8)]?0x0:0x1;}[a21_0x504221(0x1fb)](_0x1600d3,_0x3076a4,_0x17d3c8,_0x2a16b4){const _0xf70e3c=a21_0x504221;console[_0xf70e3c(0x1c6)]('\x0a'+a21_0x16b0bb[_0xf70e3c(0x2ae)](_0xf70e3c(0x2ad))+'\x20'+_0x1600d3['name']),console[_0xf70e3c(0x1c6)]('═'[_0xf70e3c(0x270)](0x3c)),this['displayMasterInfo'](_0x1600d3);if(typeof _0x3076a4['attribute']===_0xf70e3c(0x1d3)){this[_0xf70e3c(0x243)](_0x1600d3),this[_0xf70e3c(0x250)](_0x1600d3),this[_0xf70e3c(0x236)](_0x17d3c8,_0x2a16b4,_0xf70e3c(0x2a5),_0x3076a4[_0xf70e3c(0x2a5)]);return;}if(_0x3076a4[_0xf70e3c(0x2a5)]===!![]){this[_0xf70e3c(0x243)](_0x1600d3),this[_0xf70e3c(0x250)](_0x1600d3),this[_0xf70e3c(0x236)](_0x17d3c8,_0x2a16b4,'attributes');return;}if(typeof _0x3076a4[_0xf70e3c(0x1a7)]===_0xf70e3c(0x1d3)){this[_0xf70e3c(0x1d9)](_0x1600d3,_0x2a16b4),this[_0xf70e3c(0x250)](_0x1600d3),this['displayPreviewHints'](_0x17d3c8,_0x2a16b4,'behavior',_0x3076a4[_0xf70e3c(0x1a7)]);return;}if(_0x3076a4[_0xf70e3c(0x1a7)]===!![]){this[_0xf70e3c(0x1d9)](_0x1600d3,_0x2a16b4),this[_0xf70e3c(0x250)](_0x1600d3),this['displayPreviewHints'](_0x17d3c8,_0x2a16b4,_0xf70e3c(0x240));return;}this['displayAttributesStats'](_0x1600d3),this[_0xf70e3c(0x1d9)](_0x1600d3,_0x2a16b4),this['displaySummary'](_0x1600d3),this[_0xf70e3c(0x236)](_0x17d3c8,_0x2a16b4,_0xf70e3c(0x2af));}['displayPreviewHints'](_0x15ad52,_0x169d6f,_0x2a02c5,_0x208791){const _0x1aa75b=a21_0x504221;console[_0x1aa75b(0x1c6)]('\x0a'+a21_0x16b0bb[_0x1aa75b(0x29b)](_0x1aa75b(0x224)));const _0x476643=_0x169d6f!==_0x1aa75b(0x1a0)?_0x1aa75b(0x246)+_0x169d6f:'';if(_0x2a02c5==='attribute'&&_0x208791)console[_0x1aa75b(0x1c6)]('\x20\x20'+a21_0x16b0bb['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x15ad52+_0x1aa75b(0x1a8)+_0x208791+'\x22'+_0x476643));else{if(_0x2a02c5===_0x1aa75b(0x1a7)&&_0x208791)console['error']('\x20\x20'+a21_0x16b0bb[_0x1aa75b(0x29b)](_0x1aa75b(0x26e)+_0x15ad52+_0x1aa75b(0x2a9)+_0x208791+'\x22'+_0x476643));else(_0x2a02c5===_0x1aa75b(0x24a)||_0x2a02c5==='all')&&console[_0x1aa75b(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x1aa75b(0x29b)](_0x1aa75b(0x26e)+_0x15ad52+'\x20--attribute\x20\x22<name>\x22'+_0x476643));}(_0x2a02c5===_0x1aa75b(0x240)||_0x2a02c5===_0x1aa75b(0x2af))&&console[_0x1aa75b(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x1aa75b(0x29b)](_0x1aa75b(0x26e)+_0x15ad52+_0x1aa75b(0x248)+_0x476643)),_0x2a02c5===_0x1aa75b(0x2af)&&console[_0x1aa75b(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x1aa75b(0x29b)](_0x1aa75b(0x26e)+_0x15ad52+_0x1aa75b(0x1f4)+_0x476643));}[a21_0x504221(0x1f8)](_0x86446a){const _0x4eaa5c=a21_0x504221,{master:_0x2086ca}=_0x86446a,_0x5a82f6=_0x2086ca[_0x4eaa5c(0x1a9)]?a21_0x16b0bb[_0x4eaa5c(0x1cc)]('✔'):a21_0x16b0bb[_0x4eaa5c(0x25e)]('✘');console[_0x4eaa5c(0x1c6)]('\x0a'+a21_0x16b0bb[_0x4eaa5c(0x29b)](_0x4eaa5c(0x1b0))),console['error'](_0x5a82f6+'\x20'+a21_0x16b0bb[_0x4eaa5c(0x2ae)](_0x2086ca[_0x4eaa5c(0x21e)]+'.'+_0x2086ca[_0x4eaa5c(0x267)])),_0x2086ca['schemaValid']?_0x2086ca[_0x4eaa5c(0x254)]!==undefined&&console[_0x4eaa5c(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x4eaa5c(0x29b)](_0x4eaa5c(0x266))+'\x20'+a21_0x16b0bb[_0x4eaa5c(0x1e8)](formatRows(_0x2086ca[_0x4eaa5c(0x254)]))):console[_0x4eaa5c(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x4eaa5c(0x25e)](_0x4eaa5c(0x221))+'\x20'+_0x2086ca[_0x4eaa5c(0x28f)]);}['displayAttributesStats'](_0x3803de){const _0x2a0b42=a21_0x504221;if(_0x3803de[_0x2a0b42(0x24a)][_0x2a0b42(0x24e)]===0x0)return;console['error']('\x0a'+a21_0x16b0bb['dim'](_0x2a0b42(0x1bd)));for(const _0x53c38f of _0x3803de[_0x2a0b42(0x24a)]){const _0x4d0665=_0x53c38f['schemaValid']?a21_0x16b0bb[_0x2a0b42(0x1cc)]('✔'):a21_0x16b0bb[_0x2a0b42(0x25e)]('✘');let _0x5e917b='';if(_0x53c38f['schemaValid']&&_0x53c38f[_0x2a0b42(0x216)]!==undefined&&_0x53c38f[_0x2a0b42(0x271)]!==undefined){const _0x2b5160=_0x53c38f[_0x2a0b42(0x271)][_0x2a0b42(0x2b0)](0x1),_0x2d9980=_0x53c38f[_0x2a0b42(0x271)]>=0x50?a21_0x16b0bb[_0x2a0b42(0x1cc)]:_0x53c38f['coveragePercent']>=0x32?a21_0x16b0bb[_0x2a0b42(0x1cf)]:a21_0x16b0bb[_0x2a0b42(0x25e)];_0x5e917b='\x20'+a21_0x16b0bb['dim']('Coverage:')+'\x20'+_0x2d9980(_0x2b5160+'%')+'\x20('+formatRows(_0x53c38f[_0x2a0b42(0x216)])+_0x2a0b42(0x217);}console[_0x2a0b42(0x1c6)](_0x4d0665+'\x20'+a21_0x16b0bb['bold'](_0x53c38f['name'])+_0x5e917b),console[_0x2a0b42(0x1c6)]('\x20\x20'+a21_0x16b0bb['dim']('Source:')+'\x20'+a21_0x16b0bb['bold'](_0x53c38f[_0x2a0b42(0x21e)]+'.'+_0x53c38f[_0x2a0b42(0x267)]));const _0x1dfa56=_0x53c38f[_0x2a0b42(0x1ea)]===_0x53c38f[_0x2a0b42(0x235)]?a21_0x16b0bb[_0x2a0b42(0x29b)](_0x2a0b42(0x28c))+'\x20'+_0x53c38f['joinKey']:a21_0x16b0bb[_0x2a0b42(0x29b)](_0x2a0b42(0x237))+'\x20'+_0x53c38f['joinKey']+_0x2a0b42(0x231)+_0x53c38f['foreignKey'];console[_0x2a0b42(0x1c6)]('\x20\x20'+_0x1dfa56),console[_0x2a0b42(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x2a0b42(0x29b)](_0x2a0b42(0x1d2))),this['displayColumns'](_0x53c38f[_0x2a0b42(0x256)]),!_0x53c38f[_0x2a0b42(0x1a9)]&&console[_0x2a0b42(0x1c6)]('\x20\x20'+a21_0x16b0bb['red'](_0x2a0b42(0x221))+'\x20'+_0x53c38f['schemaError']);}}[a21_0x504221(0x1d9)](_0x30cd9b,_0x4b8dec){const _0x10a5ee=a21_0x504221;if(_0x30cd9b[_0x10a5ee(0x240)][_0x10a5ee(0x24e)]===0x0)return;console[_0x10a5ee(0x1c6)]('\x0a'+a21_0x16b0bb[_0x10a5ee(0x29b)](_0x10a5ee(0x230))+'\x20'+a21_0x16b0bb[_0x10a5ee(0x29b)]('('+_0x4b8dec+')'));for(const _0x49bee5 of _0x30cd9b[_0x10a5ee(0x240)]){const _0x24fa36=_0x49bee5[_0x10a5ee(0x1a9)]?a21_0x16b0bb['green']('✔'):a21_0x16b0bb[_0x10a5ee(0x25e)]('✘');let _0x3944a3='';if(_0x49bee5['schemaValid']&&_0x49bee5[_0x10a5ee(0x198)]!==undefined&&_0x49bee5[_0x10a5ee(0x2bc)]!==undefined){const _0x5220ca=_0x49bee5['customerPercent']?.[_0x10a5ee(0x2b0)](0x1)||'?',_0x2fc8b2=(_0x49bee5[_0x10a5ee(0x27f)]??0x0)>=0x32?a21_0x16b0bb[_0x10a5ee(0x1cc)]:(_0x49bee5[_0x10a5ee(0x27f)]??0x0)>=0x14?a21_0x16b0bb[_0x10a5ee(0x1cf)]:a21_0x16b0bb[_0x10a5ee(0x25e)];_0x3944a3='\x20'+a21_0x16b0bb[_0x10a5ee(0x29b)](_0x10a5ee(0x1f1))+'\x20'+_0x2fc8b2(formatRows(_0x49bee5[_0x10a5ee(0x198)]))+'\x20('+_0x5220ca+'%)\x20'+a21_0x16b0bb[_0x10a5ee(0x29b)](_0x10a5ee(0x1ad))+'\x20'+a21_0x16b0bb[_0x10a5ee(0x1e8)](formatRows(_0x49bee5['totalEvents']));}console[_0x10a5ee(0x1c6)](_0x24fa36+'\x20'+a21_0x16b0bb[_0x10a5ee(0x2ae)](_0x49bee5[_0x10a5ee(0x1cd)])+_0x3944a3),console[_0x10a5ee(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x10a5ee(0x29b)]('Source:')+'\x20'+a21_0x16b0bb[_0x10a5ee(0x2ae)](_0x49bee5[_0x10a5ee(0x21e)]+'.'+_0x49bee5['table']));const _0x369418=_0x49bee5[_0x10a5ee(0x1ea)]===_0x49bee5[_0x10a5ee(0x235)]?a21_0x16b0bb[_0x10a5ee(0x29b)](_0x10a5ee(0x28c))+'\x20'+_0x49bee5[_0x10a5ee(0x1ea)]:a21_0x16b0bb['dim'](_0x10a5ee(0x237))+'\x20'+_0x49bee5[_0x10a5ee(0x1ea)]+_0x10a5ee(0x231)+_0x49bee5[_0x10a5ee(0x235)];console[_0x10a5ee(0x1c6)]('\x20\x20'+_0x369418),console[_0x10a5ee(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x10a5ee(0x29b)](_0x10a5ee(0x1d2))),this[_0x10a5ee(0x238)](_0x49bee5[_0x10a5ee(0x256)]),!_0x49bee5[_0x10a5ee(0x1a9)]&&console[_0x10a5ee(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x10a5ee(0x25e)]('Error:')+'\x20'+_0x49bee5[_0x10a5ee(0x28f)]);}}[a21_0x504221(0x238)](_0x2e4cc7){const _0x3365c6=a21_0x504221;for(const _0x4b1643 of _0x2e4cc7){_0x4b1643[_0x3365c6(0x227)]===_0x4b1643[_0x3365c6(0x193)]||_0x4b1643[_0x3365c6(0x193)]==='*'?console[_0x3365c6(0x1c6)](_0x3365c6(0x297)+_0x4b1643[_0x3365c6(0x227)]):console[_0x3365c6(0x1c6)](_0x3365c6(0x297)+_0x4b1643[_0x3365c6(0x227)]+'\x20'+a21_0x16b0bb[_0x3365c6(0x29b)]('('+_0x4b1643[_0x3365c6(0x193)]+')'));}}[a21_0x504221(0x250)](_0x5b1a90){const _0x36950f=a21_0x504221;console['error']('─'['repeat'](0x3c));if(_0x5b1a90[_0x36950f(0x1a4)][_0x36950f(0x24e)]>0x0){console[_0x36950f(0x1c6)]('\x0a'+a21_0x16b0bb[_0x36950f(0x25e)](_0x36950f(0x1fe)));for(const _0x2daaf3 of _0x5b1a90['errors']){console[_0x36950f(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x36950f(0x25e)]('•')+'\x20'+_0x2daaf3);}}_0x5b1a90[_0x36950f(0x1b8)]&&console[_0x36950f(0x1c6)]('\x0a'+a21_0x16b0bb[_0x36950f(0x1cc)]('✔')+_0x36950f(0x241));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a21_0x504221(0x1cd)]=a21_0x504221(0x20f);[a21_0x504221(0x2a4)]=a21_0x504221(0x2a8);async['execute'](_0x5472bd){const _0x4c125c=a21_0x504221,{options:_0x3c6ecf,args:_0x98eaf7,tdx:_0xfbdeba}=_0x5472bd,_0x404ef4=_0x3c6ecf,_0x35931e=_0x98eaf7[0x0]||_0x3c6ecf[_0x4c125c(0x1e1)];if(!_0x35931e)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'+_0x4c125c(0x1d5)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+'\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a'+_0x4c125c(0x1b4)+_0x4c125c(0x1eb)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x404ef4['master']&&!_0x404ef4[_0x4c125c(0x2a5)]&&!_0x404ef4['behavior']&&!_0x404ef4[_0x4c125c(0x19f)])return console[_0x4c125c(0x1c6)](a21_0x16b0bb['red'](_0x4c125c(0x25d))),console[_0x4c125c(0x1c6)]('Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a'),console[_0x4c125c(0x1c6)](_0x4c125c(0x249)),console[_0x4c125c(0x1c6)](_0x4c125c(0x258)),console[_0x4c125c(0x1c6)](_0x4c125c(0x2a3)),console['error'](_0x4c125c(0x20c)),console[_0x4c125c(0x1c6)](_0x4c125c(0x1f0)),0x1;const _0x78fe2e=resolveYamlFile(_0x35931e);if(!existsSync(_0x78fe2e))return showFileNotFoundError(_0x78fe2e,_0x35931e),0x1;_0x404ef4[_0x4c125c(0x1bc)]&&(console[_0x4c125c(0x1c6)](_0x4c125c(0x1b3)+_0x404ef4['site']),console[_0x4c125c(0x1c6)](_0x4c125c(0x201)+_0x78fe2e));let _0xeef140;try{_0xeef140=readFileSync(_0x78fe2e,_0x4c125c(0x255));}catch(_0x4b5183){const _0x434548=_0x4b5183 instanceof Error?_0x4b5183[_0x4c125c(0x27d)]:String(_0x4b5183);return console[_0x4c125c(0x1c6)]('Error\x20reading\x20file:\x20'+_0x434548),0x1;}let _0x49c03e;try{_0x49c03e=parseDef(_0xeef140);}catch(_0x274f7a){const _0x1e5529=_0x274f7a instanceof Error?_0x274f7a[_0x4c125c(0x27d)]:String(_0x274f7a);return console[_0x4c125c(0x1c6)](a21_0x16b0bb[_0x4c125c(0x25e)](_0x4c125c(0x245)+_0x1e5529)),0x1;}if(_0x404ef4[_0x4c125c(0x2a5)]===!![]||_0x404ef4[_0x4c125c(0x2a5)]===''){const _0xc67dbb=_0x49c03e[_0x4c125c(0x24a)]?.[_0x4c125c(0x285)](_0x2f2a3e=>_0x2f2a3e[_0x4c125c(0x1cd)])||[];if(_0xc67dbb[_0x4c125c(0x24e)]===0x0)console['error'](a21_0x16b0bb[_0x4c125c(0x25e)](_0x4c125c(0x1e5)));else{console[_0x4c125c(0x1c6)](a21_0x16b0bb[_0x4c125c(0x25e)](_0x4c125c(0x296))),console[_0x4c125c(0x1c6)](_0x4c125c(0x26b));for(const _0x470bf7 of _0xc67dbb){console[_0x4c125c(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x4c125c(0x1e8)](_0x470bf7));}console[_0x4c125c(0x1c6)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x35931e+'\x20--attribute\x20\x22'+_0xc67dbb[0x0]+'\x22');}return 0x1;}if(_0x404ef4[_0x4c125c(0x1a7)]===!![]||_0x404ef4[_0x4c125c(0x1a7)]===''){const _0x143984=_0x49c03e[_0x4c125c(0x240)]?.['map'](_0x21c5b7=>_0x21c5b7[_0x4c125c(0x1cd)])||[];if(_0x143984[_0x4c125c(0x24e)]===0x0)console[_0x4c125c(0x1c6)](a21_0x16b0bb[_0x4c125c(0x25e)](_0x4c125c(0x23b)));else{console[_0x4c125c(0x1c6)](a21_0x16b0bb['red'](_0x4c125c(0x291))),console['error'](_0x4c125c(0x262));for(const _0x431c1a of _0x143984){console[_0x4c125c(0x1c6)]('\x20\x20'+a21_0x16b0bb['cyan'](_0x431c1a));}console[_0x4c125c(0x1c6)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x35931e+_0x4c125c(0x2a9)+_0x143984[0x0]+'\x22');}return 0x1;}const _0x1632ee=createCommandSpinner(a21_0x16b0bb[_0x4c125c(0x29b)](_0x4c125c(0x1a2)),{'verbose':_0x404ef4[_0x4c125c(0x1bc)]});_0x1632ee['start']();const _0x4f541b={'onProgress':_0x1211eb=>{_0x1632ee['text']=formatProgressMessage(_0x1211eb);}};if(_0x404ef4['master'])_0x4f541b[_0x4c125c(0x1c7)]=!![];if(_0x404ef4[_0x4c125c(0x2a5)]&&typeof _0x404ef4['attribute']==='string')_0x4f541b[_0x4c125c(0x2a5)]=_0x404ef4[_0x4c125c(0x2a5)];if(_0x404ef4[_0x4c125c(0x1a7)]&&typeof _0x404ef4[_0x4c125c(0x1a7)]==='string')_0x4f541b[_0x4c125c(0x1a7)]=_0x404ef4['behavior'];if(_0x404ef4[_0x4c125c(0x19f)])_0x4f541b['enriched']=!![];if(_0x404ef4[_0x4c125c(0x191)])_0x4f541b[_0x4c125c(0x191)]=_0x404ef4[_0x4c125c(0x191)];let _0x278bc6;try{_0x278bc6=await _0xfbdeba[_0x4c125c(0x29e)]['previewParentYaml'](_0xeef140,_0x4f541b),_0x1632ee['stop']();}catch(_0x45d2a1){_0x1632ee['stop']();throw _0x45d2a1;}return await this[_0x4c125c(0x197)](_0x278bc6,{'master':_0x404ef4[_0x4c125c(0x1c7)],'attribute':typeof _0x404ef4[_0x4c125c(0x2a5)]===_0x4c125c(0x1d3)?_0x404ef4[_0x4c125c(0x2a5)]:undefined,'behavior':typeof _0x404ef4['behavior']===_0x4c125c(0x1d3)?_0x404ef4[_0x4c125c(0x1a7)]:undefined,'enriched':_0x404ef4['enriched']}),_0x278bc6['allValid']?0x0:0x1;}async['displayPreviewResults'](_0x5b321f,_0x176f99){const _0x537a7c=a21_0x504221;console[_0x537a7c(0x1c6)]('\x0a'+a21_0x16b0bb[_0x537a7c(0x2ae)](_0x537a7c(0x1d1))+'\x20'+_0x5b321f[_0x537a7c(0x1cd)]),console[_0x537a7c(0x1c6)]('═'[_0x537a7c(0x270)](0x3c));if(_0x176f99[_0x537a7c(0x1c7)]&&_0x5b321f['sampleData']){const _0x59328d=a21_0x16b0bb[_0x537a7c(0x29b)](_0x537a7c(0x1c1))+'\x20'+a21_0x16b0bb['bold'](_0x5b321f[_0x537a7c(0x1c7)]['database']+'.'+_0x5b321f[_0x537a7c(0x1c7)][_0x537a7c(0x267)]);await this[_0x537a7c(0x1c0)](_0x59328d,_0x5b321f['sampleData']);}else{if(_0x176f99[_0x537a7c(0x2a5)]&&_0x5b321f[_0x537a7c(0x2b8)]){const _0x15f94e=a21_0x16b0bb[_0x537a7c(0x29b)](_0x537a7c(0x1aa))+'\x20'+a21_0x16b0bb[_0x537a7c(0x2ae)](_0x176f99[_0x537a7c(0x2a5)]);await this[_0x537a7c(0x1c0)](_0x15f94e,_0x5b321f[_0x537a7c(0x2b8)]);}else{if(_0x176f99[_0x537a7c(0x1a7)]&&_0x5b321f['sampleData']){const _0x30c9a3=a21_0x16b0bb['dim'](_0x537a7c(0x192))+'\x20'+a21_0x16b0bb[_0x537a7c(0x2ae)](_0x176f99['behavior']);await this[_0x537a7c(0x1c0)](_0x30c9a3,_0x5b321f[_0x537a7c(0x2b8)]);}else{if(_0x176f99[_0x537a7c(0x19f)]&&_0x5b321f[_0x537a7c(0x2b8)]){const _0x196e0e=a21_0x16b0bb[_0x537a7c(0x29b)]('Enriched:')+'\x20'+a21_0x16b0bb[_0x537a7c(0x2ae)](_0x537a7c(0x22e));await this[_0x537a7c(0x1c0)](_0x196e0e,_0x5b321f[_0x537a7c(0x2b8)]);}else!_0x5b321f[_0x537a7c(0x2b8)]&&console['error'](_0x537a7c(0x22b));}}}if(_0x5b321f[_0x537a7c(0x1a4)][_0x537a7c(0x24e)]>0x0){console[_0x537a7c(0x1c6)]('─'['repeat'](0x3c)),console[_0x537a7c(0x1c6)]('\x0a'+a21_0x16b0bb[_0x537a7c(0x25e)](_0x537a7c(0x1fe)));for(const _0x5960d3 of _0x5b321f[_0x537a7c(0x1a4)]){console[_0x537a7c(0x1c6)]('\x20\x20'+a21_0x16b0bb['red']('•')+'\x20'+_0x5960d3);}}}async['displaySampleData'](_0x284440,_0x2f722f){const _0x46656b=a21_0x504221;if(_0x2f722f[_0x46656b(0x24e)]===0x0){console[_0x46656b(0x1c6)]('\x0a'+_0x284440),console[_0x46656b(0x1c6)](_0x46656b(0x1e7));return;}console[_0x46656b(0x1c6)]('\x0a'+_0x284440);const _0x380ec3=Object[_0x46656b(0x203)](_0x2f722f[0x0])['map'](_0x255df3=>({'name':_0x255df3,'type':typeof _0x2f722f[0x0][_0x255df3]===_0x46656b(0x1b5)?_0x46656b(0x1c9):_0x46656b(0x2b4)})),_0x4d553f={'queryId':'preview','columns':_0x380ec3,'data':_0x2f722f,'stats':{'state':_0x46656b(0x2a6),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2f722f[_0x46656b(0x24e)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5989be=formatAsTable(_0x4d553f,_0x2f722f['length'],!![]);await writeOutput(_0x5989be,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a21_0x504221(0x1cd)]='segment:parent:run';[a21_0x504221(0x2a4)]=a21_0x504221(0x23f);async['execute'](_0x27d719){const _0x247d4=a21_0x504221,{options:_0x2d9b96,args:_0x33b8ca,tdx:_0x26c90b}=_0x27d719,_0x441657=_0x2d9b96,_0x53f961=_0x33b8ca[0x0]||_0x2d9b96[_0x247d4(0x1e1)];if(!_0x53f961)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'+_0x247d4(0x29d)),0x1;const _0x52517c=resolveYamlFile(_0x53f961);if(existsSync(_0x52517c)){_0x441657['verbose']&&console['error'](_0x247d4(0x1ee)+_0x52517c);let _0x3209ca;try{_0x3209ca=readFileSync(_0x52517c,'utf-8');}catch(_0x4c16ec){const _0x55b0d8=_0x4c16ec instanceof Error?_0x4c16ec[_0x247d4(0x27d)]:String(_0x4c16ec);return console[_0x247d4(0x1c6)]('Error\x20reading\x20file:\x20'+_0x55b0d8),0x1;}const _0xdbfb=await withSpinner(_0x247d4(0x25c),()=>_0x26c90b['segment'][_0x247d4(0x292)](_0x3209ca),{'verbose':_0x441657[_0x247d4(0x1bc)]}),_0x3d90a7=_0xdbfb[_0x247d4(0x18f)],{isNew:_0x5ab3a3,name:_0x4c9038,hasChanges:_0x3d5e89,diffFormatted:_0x5bed67}=_0x3d90a7;if(_0x3d5e89){_0x5ab3a3?console[_0x247d4(0x1c6)](_0x247d4(0x20b)+_0x4c9038+'\x27:'):console[_0x247d4(0x1c6)](_0x247d4(0x2a1)+_0x4c9038+'\x27:');console['error']('─'[_0x247d4(0x270)](0x3c)),console['error'](_0x5bed67),console[_0x247d4(0x1c6)]('─'[_0x247d4(0x270)](0x3c));const _0x31ff0e=_0x5ab3a3?_0x247d4(0x18b)+_0x4c9038+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x4c9038+_0x247d4(0x268);if(!_0x441657['yes']){const _0x1385f1=await confirmKey(_0x31ff0e);if(!_0x1385f1)return console['error'](_0x247d4(0x239)),0x1;}const _0xc13a3a=_0x5ab3a3?'Creating':_0x247d4(0x21f);await withSpinner(_0xc13a3a+'\x20parent\x20segment\x20\x27'+_0x4c9038+'\x27...',()=>_0x3d90a7[_0x247d4(0x229)](),{'verbose':_0x441657[_0x247d4(0x1bc)]});const _0x315f35=_0x5ab3a3?'Created':_0x247d4(0x264);console[_0x247d4(0x1c6)]('✔\x20'+_0x315f35+_0x247d4(0x2bd)+_0x4c9038+'\x27');}else console['error']('✔\x20No\x20changes\x20-\x20\x27'+_0x4c9038+_0x247d4(0x220));}const _0x91f3f3=await withSpinner(_0x247d4(0x279)+_0x53f961+_0x247d4(0x1de),()=>_0x26c90b[_0x247d4(0x29e)][_0x247d4(0x209)](_0x53f961),{'verbose':_0x441657[_0x247d4(0x1bc)]}),_0xc136a9=_0x91f3f3['data'],_0x355607=getConsoleUrl(_0x441657[_0x247d4(0x20a)],_0x247d4(0x2ac)+_0xc136a9['workflowId']+_0x247d4(0x295)+_0xc136a9[_0x247d4(0x284)]+'/attempt/'+_0xc136a9[_0x247d4(0x2a2)]);return console['error'](_0x247d4(0x24f)),console[_0x247d4(0x1c6)]('\x20\x20'+a21_0x16b0bb['dim']('Audience\x20ID:')+'\x20'+_0xc136a9['audienceId']),console['error']('\x20\x20'+a21_0x16b0bb['dim'](_0x247d4(0x23a))+'\x20'+_0xc136a9[_0x247d4(0x20d)]),console[_0x247d4(0x1c6)]('\x20\x20'+a21_0x16b0bb['dim'](_0x247d4(0x1bf))+'\x20'+_0xc136a9[_0x247d4(0x284)]),console[_0x247d4(0x1c6)]('\x20\x20'+a21_0x16b0bb[_0x247d4(0x29b)]('Attempt:')+'\x20'+_0xc136a9[_0x247d4(0x2a2)]),console[_0x247d4(0x1c6)]('\x20\x20'+_0x355607),console[_0x247d4(0x1c6)]('\x0a'+a21_0x16b0bb[_0x247d4(0x29b)](_0x247d4(0x26a))+'\x20tdx\x20wf\x20attempt\x20'+_0xc136a9['workflowAttemptId']+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a21_0x504221(0x1cd)]=a21_0x504221(0x290);['description']=a21_0x504221(0x1cb);async['execute'](_0x334700){const _0x169d1a=a21_0x504221,{options:_0x4be5bf,args:_0x16ea03,tdx:_0x252a46}=_0x334700,_0x2468d8=_0x16ea03[0x0]||_0x4be5bf['parentSegment'];if(!_0x2468d8)return showParentSegmentNotSetError(_0x169d1a(0x2bb)+_0x169d1a(0x21b)),0x1;_0x4be5bf[_0x169d1a(0x1bc)]&&(console[_0x169d1a(0x1c6)](_0x169d1a(0x1b3)+_0x4be5bf['site']),console[_0x169d1a(0x1c6)]('Parent\x20segment:\x20'+_0x2468d8));const _0x4709d5=await withSpinner(_0x169d1a(0x23e)+_0x2468d8+_0x169d1a(0x1de),()=>_0x252a46[_0x169d1a(0x29e)][_0x169d1a(0x204)](_0x2468d8),{'verbose':_0x4be5bf[_0x169d1a(0x1bc)]}),_0x2d1a3b=_0x4709d5[_0x169d1a(0x18f)];console['error']('✔\x20Found\x20'+_0x2d1a3b['length']+'\x20field'+(_0x2d1a3b['length']!==0x1?'s':''));if(_0x4be5bf[_0x169d1a(0x280)]||_0x4be5bf['jsonl'])return await handleSDKOutput(_0x2d1a3b,_0x4be5bf),0x0;return displayFieldsHumanReadable(_0x2d1a3b,_0x2468d8),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a21_0x504221(0x1cd)]='segment:parent:view';[a21_0x504221(0x2a4)]=a21_0x504221(0x263);async[a21_0x504221(0x1ca)](_0x235451){const _0x489f01=a21_0x504221,{options:_0x42d553,args:_0x1f44ed,tdx:_0x2c1002}=_0x235451,_0x193dd2=_0x42d553,_0x31a7d7=_0x1f44ed[0x0]||_0x42d553['parentSegment'];if(!_0x31a7d7)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x489f01(0x1be)+_0x489f01(0x27b)+_0x489f01(0x26f)),0x1;_0x42d553[_0x489f01(0x1bc)]&&(console[_0x489f01(0x1c6)](_0x489f01(0x1b3)+_0x42d553['site']),console['error'](_0x489f01(0x1ef)+_0x31a7d7));const _0x577085=await withSpinner(_0x489f01(0x273)+_0x31a7d7+'\x27...',()=>_0x2c1002[_0x489f01(0x29e)]['getParentFull'](_0x31a7d7),{'verbose':_0x42d553[_0x489f01(0x1bc)]}),_0x1de6f9=_0x577085[_0x489f01(0x18f)];if(_0x193dd2[_0x489f01(0x218)]){const _0x17c743=getConsoleNextUrl(_0x193dd2[_0x489f01(0x20a)],_0x489f01(0x1e3)+_0x1de6f9['id']);return console[_0x489f01(0x1c6)](a21_0x16b0bb[_0x489f01(0x1cc)]('✔')+_0x489f01(0x208)+a21_0x16b0bb['cyan'](_0x17c743)),openBrowser(_0x17c743),0x0;}return await handleSingleObjectOutput(_0x1de6f9,_0x42d553),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a21_0x504221(0x1cd)]=a21_0x504221(0x1ec);[a21_0x504221(0x2a4)]=a21_0x504221(0x253);async['execute'](_0x21c0d8){const _0x4c7a79=a21_0x504221,{options:_0x53a0cb,args:_0x2ffd30,tdx:_0x3b1a3e}=_0x21c0d8,_0x25162c=_0x2ffd30[0x0]||_0x53a0cb['parentSegment'];if(!_0x25162c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a'+_0x4c7a79(0x19e)),0x1;_0x53a0cb[_0x4c7a79(0x1bc)]&&(console[_0x4c7a79(0x1c6)]('Site:\x20'+_0x53a0cb[_0x4c7a79(0x20a)]),console[_0x4c7a79(0x1c6)]('Parent\x20segment:\x20'+_0x25162c));const _0x17e552=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x25162c+'\x27...',()=>_0x3b1a3e[_0x4c7a79(0x29e)][_0x4c7a79(0x276)](_0x25162c),{'verbose':_0x53a0cb[_0x4c7a79(0x1bc)]}),_0x1292f6=_0x17e552['data'],_0x55fbe7=await withSpinner(_0x4c7a79(0x1af)+_0x25162c+_0x4c7a79(0x1de),()=>_0x3b1a3e[_0x4c7a79(0x29e)]['getParentSQL'](_0x1292f6),{'verbose':_0x53a0cb[_0x4c7a79(0x1bc)]}),_0x437d28=await executeSchemaQuery(_0x55fbe7['data'],_0x3b1a3e,_0x53a0cb);return await handleQueryOutput(_0x437d28,_0x53a0cb),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a21_0x504221(0x1cd)]=a21_0x504221(0x1a6);[a21_0x504221(0x2a4)]=a21_0x504221(0x277);async[a21_0x504221(0x1ca)](_0x49181f){const _0x143c11=a21_0x504221,{options:_0x139454,args:_0x7e5f43,tdx:_0x2deff4}=_0x49181f,_0x1e184e=_0x7e5f43[0x0]||_0x139454['parentSegment'];if(!_0x1e184e)return showParentSegmentNotSetError(_0x143c11(0x299)+_0x143c11(0x21d)),0x1;_0x139454[_0x143c11(0x1bc)]&&(console[_0x143c11(0x1c6)](_0x143c11(0x1b3)+_0x139454[_0x143c11(0x20a)]),console[_0x143c11(0x1c6)](_0x143c11(0x1ef)+_0x1e184e));const _0x27f4cf=await withSpinner(_0x143c11(0x259)+_0x1e184e+'\x27...',()=>_0x2deff4[_0x143c11(0x29e)][_0x143c11(0x276)](_0x1e184e),{'verbose':_0x139454[_0x143c11(0x1bc)]}),_0x28e9ee=_0x27f4cf[_0x143c11(0x18f)],_0x5baaa6=await withSpinner(_0x143c11(0x1af)+_0x1e184e+_0x143c11(0x1de),()=>_0x2deff4['segment'][_0x143c11(0x1c2)](_0x28e9ee),{'verbose':_0x139454[_0x143c11(0x1bc)]}),_0x3b9f64=_0x5baaa6['data'];return _0x139454[_0x143c11(0x223)]===_0x143c11(0x280)||_0x139454['format']===_0x143c11(0x282)?await handleSDKOutput([{'sql':_0x3b9f64}],_0x139454):console['log'](_0x3b9f64),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a21_0x504221(0x1cd)]=a21_0x504221(0x1ba);['description']=a21_0x504221(0x294);async[a21_0x504221(0x1ca)](_0x5134a8){const _0x256d5c=a21_0x504221,{options:_0x16509a,args:_0x3736e2,tdx:_0x4d6eb6}=_0x5134a8,_0x4d5621=_0x3736e2[0x0]||_0x16509a[_0x256d5c(0x1e1)];if(!_0x4d5621)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a'+_0x256d5c(0x1db)),0x1;_0x16509a[_0x256d5c(0x1bc)]&&(console[_0x256d5c(0x1c6)](_0x256d5c(0x1b3)+_0x16509a[_0x256d5c(0x20a)]),console['error']('Parent\x20segment:\x20'+_0x4d5621));const _0x4fd505=await withSpinner(_0x256d5c(0x259)+_0x4d5621+_0x256d5c(0x1de),()=>_0x4d6eb6[_0x256d5c(0x29e)]['resolveParentId'](_0x4d5621),{'verbose':_0x16509a[_0x256d5c(0x1bc)]}),_0x492294=_0x4fd505[_0x256d5c(0x18f)],_0x929eaa=await withSpinner(_0x256d5c(0x1af)+_0x4d5621+'\x27...',()=>_0x4d6eb6[_0x256d5c(0x29e)]['getParentSQL'](_0x492294),{'verbose':_0x16509a['verbose']});let _0x104649=_0x929eaa[_0x256d5c(0x18f)];const _0x21dfcf=resolveLimit(_0x16509a[_0x256d5c(0x278)],DEFAULT_DISPLAY_LIMIT),_0x19549a=/\bLIMIT\s+\d+/i['test'](_0x104649);!_0x19549a&&(_0x104649=_0x104649[_0x256d5c(0x252)]()[_0x256d5c(0x1fa)](/;+$/,''),_0x104649=_0x256d5c(0x22a)+_0x104649+_0x256d5c(0x225)+_0x21dfcf);_0x16509a['verbose']&&console[_0x256d5c(0x1c6)]('SQL\x20query:\x0a'+_0x104649);const _0x26e7fd=await withProgressSpinner(_0x256d5c(0x202),async _0x3c840c=>{const _0x244f5d=_0x256d5c,_0x2d7f6c=await _0x4d6eb6[_0x244f5d(0x1d6)][_0x244f5d(0x1ca)](_0x104649,{'catalog':'td','schema':_0x244f5d(0x1ff),'onJobId':_0x71ab7a=>{_0x3c840c['setJobId'](_0x71ab7a);}});return _0x2d7f6c;},{'verbose':_0x16509a[_0x256d5c(0x1bc)]}),_0x3cf3d3=_0x26e7fd['data'],_0x425d4a=_0x3cf3d3[_0x256d5c(0x265)]?_0x256d5c(0x1df)+_0x3cf3d3['jobId']+']':'';return console['error']('✔\x20Query\x20completed:\x20Processed\x20'+_0x3cf3d3[_0x256d5c(0x22c)][_0x256d5c(0x2b7)][_0x256d5c(0x247)]()+'\x20rows\x20'+(_0x256d5c(0x190)+formatElapsed(_0x3cf3d3[_0x256d5c(0x22c)][_0x256d5c(0x2b3)])+_0x425d4a)),await handleQueryOutput(_0x3cf3d3,_0x16509a),0x0;}}
@@ -1 +1 @@
1
- function a22_0x38b1(_0xb06f24,_0x59e7db){_0xb06f24=_0xb06f24-0x19a;const _0x185252=a22_0x1852();let _0x38b1ba=_0x185252[_0xb06f24];return _0x38b1ba;}const a22_0xcb5c1c=a22_0x38b1;(function(_0xcbcc61,_0x3703e9){const _0x5c3aff=a22_0x38b1,_0x4a1567=_0xcbcc61();while(!![]){try{const _0x5e269a=-parseInt(_0x5c3aff(0x1fa))/0x1+-parseInt(_0x5c3aff(0x1d7))/0x2*(-parseInt(_0x5c3aff(0x1c9))/0x3)+-parseInt(_0x5c3aff(0x20b))/0x4+parseInt(_0x5c3aff(0x19b))/0x5+-parseInt(_0x5c3aff(0x19f))/0x6*(parseInt(_0x5c3aff(0x207))/0x7)+-parseInt(_0x5c3aff(0x1c6))/0x8*(-parseInt(_0x5c3aff(0x1df))/0x9)+-parseInt(_0x5c3aff(0x1e0))/0xa*(-parseInt(_0x5c3aff(0x1b5))/0xb);if(_0x5e269a===_0x3703e9)break;else _0x4a1567['push'](_0x4a1567['shift']());}catch(_0x3ae728){_0x4a1567['push'](_0x4a1567['shift']());}}}(a22_0x1852,0xe26f5));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 a22_0x5aecbd from'node:path';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions}from'../core/session.js';function a22_0x1852(){const _0x56aacc=['trim','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','tdx:\x20profile\x20set','includes','Enter\x20profile\x20name:','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','Site\x20was\x20not\x20changed.','\x0aOperation\x20cancelled','findIndex','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','(session:\x20','jobs','green','message','apiKey','\x20API\x20key\x20saved\x20to\x20system\x20keychain','/app/mp/ak','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','text','us\x20\x20\x20-\x20United\x20States','681164wGjuxl','\x20\x20tdx\x20--profile\x20','session','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','Remove\x20a\x20profile','create','profile:create','\x20\x20-\x20','jp01','getUserInfo','error','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','VALID_KEYS','224FznpRN','\x27\x20updated:\x20','✗\x20Validation\x20failed:\x20','ERROR','6777788cjVdgH','ap02\x20-\x20Korea','1408465ZGnrwQ','Unknown\x20key\x20\x27','execute','Set\x20session\x20profile','22530bzXQAU','Validating\x20API\x20key...','\x0aSaved\x20to:\x20','Enter\x20your\x20TD\x20API\x20key:','description','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','dim','\x0aAvailable\x20profiles:','profile:remove','Profile\x20\x27','yellow','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','email','site','red','profile:use','Enter\x20custom\x20site','\x20Profile\x20\x27','\x27\x20removed\x20from\x20configuration','Failed\x20to\x20remove\x20profile:\x20','length','20282999OrQPDO','Changing\x20site\x20to\x20\x27','bold','API\x20key\x20cannot\x20be\x20empty','logLevel','test','select','parent_segment','push','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','profile:set','customSite','profileName','name','join','Operation\x20cancelled','validate','24iBKjbB','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','tdx:\x20profile\x20remove','3LwsUqz','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','confirm','llm_project','status','\x27\x20created','profile','\x0aSetup\x20cancelled','\x27\x20requires\x20API\x20key\x20validation.','tdx:\x20profile\x20create','Create\x20a\x20new\x20profile','\x20\x20(no\x20profiles\x20found)','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Site\x20name\x20cannot\x20be\x20empty','1980838sBRJSu','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>','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','warn','value','(cleared)','password','other','921681lLMpXL','10BXFFQW','us01','toString','log','Default\x20profile\x20set\x20to:\x20'];a22_0x1852=function(){return _0x56aacc;};return a22_0x1852();}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 a22_0x31010f from'prompts';import a22_0x29f13 from'chalk';function validateProfileName(_0x25ac48){const _0x1113da=a22_0x38b1;if(!_0x25ac48||!_0x25ac48[_0x1113da(0x1e5)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x432ba3=_0x25ac48['trim']();if(!/^[a-zA-Z0-9_-]+$/['test'](_0x432ba3))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x432ba3))return _0x1113da(0x1a9)+_0x432ba3+_0x1113da(0x1ee);return!![];}export class ProfileCreateCommand extends BaseCommand{[a22_0xcb5c1c(0x1c2)]=a22_0xcb5c1c(0x200);['description']=a22_0xcb5c1c(0x1d3);async[a22_0xcb5c1c(0x19d)](_0x4bcec6){const _0x80f196=a22_0xcb5c1c,{options:_0x5b4491,args:_0xff916c}=_0x4bcec6;console[_0x80f196(0x1e3)](a22_0x29f13[_0x80f196(0x1b7)](_0x80f196(0x1d2)));let _0x8fa9c1;if(_0xff916c[_0x80f196(0x1b4)]>0x0&&_0xff916c[0x0]){const _0x1785f8=_0xff916c[0x0][_0x80f196(0x1e5)](),_0x22fc4b=validateProfileName(_0x1785f8);if(_0x22fc4b!==!![])return console['error'](a22_0x29f13['red'](_0x22fc4b)),0x1;_0x8fa9c1=_0x1785f8;}else{const _0x1a330f=await a22_0x31010f({'type':_0x80f196(0x1f8),'name':_0x80f196(0x1c1),'message':_0x80f196(0x1e9),'validate':validateProfileName});if(!_0x1a330f[_0x80f196(0x1c1)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;_0x8fa9c1=_0x1a330f[_0x80f196(0x1c1)][_0x80f196(0x1e5)]();}const _0x282f11=await a22_0x31010f({'type':'text','name':_0x80f196(0x1a3),'message':'Enter\x20description\x20(optional):'}),_0x1d4658=_0x282f11[_0x80f196(0x1a3)]?.['trim']()||undefined,_0x342bad=_0x5b4491['site']||_0x80f196(0x1e1),_0x52c078=[{'title':_0x80f196(0x1f9),'value':_0x80f196(0x1e1)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x80f196(0x202)},{'title':'eu\x20\x20\x20-\x20Europe','value':'eu01'},{'title':_0x80f196(0x19a),'value':'ap02'}];let _0x384685=_0x52c078[_0x80f196(0x1ed)](_0x13777a=>_0x13777a[_0x80f196(0x1db)]===_0x342bad);_0x384685===-0x1&&_0x342bad!==_0x80f196(0x1e1)&&(_0x52c078[_0x80f196(0x1bd)]({'title':_0x342bad,'value':_0x342bad}),_0x384685=_0x52c078[_0x80f196(0x1b4)]-0x1);_0x52c078[_0x80f196(0x1bd)]({'title':_0x80f196(0x1b0),'value':_0x80f196(0x1de)});const _0x4766a2=await a22_0x31010f({'type':_0x80f196(0x1bb),'name':_0x80f196(0x1ad),'message':_0x80f196(0x1be)+_0x8fa9c1+'\x27:','choices':_0x52c078,'initial':_0x384685>=0x0?_0x384685:0x0});if(!_0x4766a2[_0x80f196(0x1ad)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;let _0x77e24f;if(_0x4766a2[_0x80f196(0x1ad)]===_0x80f196(0x1de)){const _0xcd3b9e=await a22_0x31010f({'type':'text','name':_0x80f196(0x1c0),'message':'Enter\x20site\x20name:','initial':_0x80f196(0x1e1),'validate':_0x5a39af=>{const _0x382192=_0x80f196;if(!_0x5a39af||!_0x5a39af['trim']())return _0x382192(0x1d6);if(!/^[a-z0-9-]+$/[_0x382192(0x1ba)](_0x5a39af[_0x382192(0x1e5)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0xcd3b9e[_0x80f196(0x1c0)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;_0x77e24f=_0xcd3b9e[_0x80f196(0x1c0)];}else _0x77e24f=_0x4766a2[_0x80f196(0x1ad)];const _0x4d6092=resolveSite(_0x77e24f);console[_0x80f196(0x1e3)]('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x4d6092),console[_0x80f196(0x1e3)]('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x4d6092,'/app/mp/ak'));const _0x3cf7a0=await a22_0x31010f({'type':_0x80f196(0x1dd),'name':_0x80f196(0x1f3),'message':_0x80f196(0x1a2),'validate':_0x1419fd=>{const _0x58167d=_0x80f196;if(!_0x1419fd||!_0x1419fd[_0x58167d(0x1e5)]())return _0x58167d(0x1b8);return!![];}});if(!_0x3cf7a0[_0x80f196(0x1f3)])return console[_0x80f196(0x1e3)](_0x80f196(0x1d0)),0x1;const _0x4c45c2=_0x3cf7a0[_0x80f196(0x1f3)];console[_0x80f196(0x1e3)]('Validating\x20API\x20key...');try{const _0xb07c8=TDX['create']({'site':_0x4d6092,'apiKey':_0x4c45c2[_0x80f196(0x1e5)](),'logLevel':_0x5b4491[_0x80f196(0x1b9)]??LogLevel[_0x80f196(0x20a)]}),_0x2f1f07=await _0xb07c8[_0x80f196(0x1f0)][_0x80f196(0x203)]();console['log'](a22_0x29f13[_0x80f196(0x1f1)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x2f1f07[_0x80f196(0x1ac)]+')');const _0x284bb8=await isKeychainAvailable();_0x284bb8?(await saveAPIKeyAsync(_0x4c45c2['trim'](),_0x4d6092,_0x8fa9c1),console['log'](a22_0x29f13[_0x80f196(0x1f1)]('✓')+_0x80f196(0x1a5)+_0x8fa9c1+')')):(console['warn'](a22_0x29f13[_0x80f196(0x1aa)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x80f196(0x1da)](a22_0x29f13[_0x80f196(0x1aa)](_0x80f196(0x1e6))));const _0x49490c={'site':_0x4d6092,..._0x1d4658&&{'description':_0x1d4658}};return saveProfileToUserConfig(_0x8fa9c1,_0x49490c),console['log'](a22_0x29f13[_0x80f196(0x1f1)]('✓')+_0x80f196(0x1b1)+_0x8fa9c1+_0x80f196(0x1ce)),console['log'](),console[_0x80f196(0x1e3)](_0x80f196(0x1ab)),console['log'](_0x80f196(0x1fb)+_0x8fa9c1+_0x80f196(0x1ea)),console[_0x80f196(0x1e3)](_0x80f196(0x1fb)+_0x8fa9c1+_0x80f196(0x1c7)),0x0;}catch(_0x336744){if(_0x336744 instanceof HTTPClientError&&_0x336744[_0x80f196(0x1cd)]===0x191)return printAuthError(_0x336744),0x1;return console['error'](a22_0x29f13[_0x80f196(0x1ae)](_0x80f196(0x209)+(_0x336744 instanceof Error?_0x336744[_0x80f196(0x1f2)]:String(_0x336744)))),console[_0x80f196(0x204)](_0x80f196(0x1f6)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0xcb5c1c(0x1c2)]=a22_0xcb5c1c(0x1a8);[a22_0xcb5c1c(0x1a3)]=a22_0xcb5c1c(0x1fe);[a22_0xcb5c1c(0x1c5)](_0x5494af){const _0x10847e=a22_0xcb5c1c,{args:_0x329d0e}=_0x5494af;if(_0x329d0e[_0x10847e(0x1b4)]===0x0)return _0x10847e(0x1d5);return undefined;}async[a22_0xcb5c1c(0x19d)](_0x48d9f1){const _0x25df46=a22_0xcb5c1c,{args:_0x4e36a6}=_0x48d9f1,_0x2d8493=_0x4e36a6[0x0];console['log'](a22_0x29f13['bold'](_0x25df46(0x1c8)));if(!profileExists(_0x2d8493)){console[_0x25df46(0x204)](a22_0x29f13[_0x25df46(0x1ae)](_0x25df46(0x1a9)+_0x2d8493+'\x27\x20does\x20not\x20exist.')),console[_0x25df46(0x1e3)]('\x0aAvailable\x20profiles:');const _0x2ba02b=listProfiles();if(_0x2ba02b[_0x25df46(0x1b4)]===0x0)console[_0x25df46(0x1e3)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x25d1bb of _0x2ba02b){console['log'](_0x25df46(0x201)+_0x25d1bb['name']);}return 0x1;}const _0x34c41f=await a22_0x31010f({'type':_0x25df46(0x1cb),'name':'confirm','message':_0x25df46(0x205)+_0x2d8493+'\x27?','initial':![]});if(!_0x34c41f[_0x25df46(0x1cb)])return console['log']('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x2d8493),console['log'](a22_0x29f13[_0x25df46(0x1f1)]('✓')+_0x25df46(0x1b1)+_0x2d8493+_0x25df46(0x1b2));}catch(_0x59baa9){return console[_0x25df46(0x204)](a22_0x29f13[_0x25df46(0x1ae)](_0x25df46(0x1b3)+(_0x59baa9 instanceof Error?_0x59baa9[_0x25df46(0x1f2)]:String(_0x59baa9)))),0x1;}const _0x286a70=await isKeychainAvailable();if(_0x286a70){const _0xf6d167=await deleteKeychainAPIKey(_0x2d8493);_0xf6d167&&console[_0x25df46(0x1e3)](a22_0x29f13[_0x25df46(0x1f1)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a22_0xcb5c1c(0x1bf);[a22_0xcb5c1c(0x1a3)]='Set\x20a\x20profile\x20configuration\x20value';static [a22_0xcb5c1c(0x206)]=[a22_0xcb5c1c(0x1ad),'database',a22_0xcb5c1c(0x1bc),a22_0xcb5c1c(0x1cc),'llm_agent',a22_0xcb5c1c(0x1a3)];[a22_0xcb5c1c(0x1c5)](_0x5624d1){const _0x40bf56=a22_0xcb5c1c,{args:_0x5ce7d7,options:_0x1c613c}=_0x5624d1,_0x3199aa=_0x1c613c[_0x40bf56(0x1cf)]||getActiveProfile();if(!_0x3199aa)return _0x40bf56(0x1d8);if(_0x5ce7d7[_0x40bf56(0x1b4)]===0x0)return _0x40bf56(0x1d9)+ProfileSetCommand['VALID_KEYS']['join'](',\x20');const _0x4f2b4d=_0x5ce7d7[0x0];if(!_0x4f2b4d['includes']('='))return'Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x40bf56(0x206)]['join'](',\x20');const [_0x43a714]=_0x4f2b4d['split']('=',0x2);if(!ProfileSetCommand[_0x40bf56(0x206)][_0x40bf56(0x1e8)](_0x43a714))return _0x40bf56(0x19c)+_0x43a714+'\x27.\x0a\x0aValid\x20keys:\x20'+ProfileSetCommand[_0x40bf56(0x206)][_0x40bf56(0x1c3)](',\x20');return undefined;}async[a22_0xcb5c1c(0x19d)](_0xca9761){const _0x586fc6=a22_0xcb5c1c,{args:_0x258116,options:_0x11c64f}=_0xca9761,_0x13969a=_0x11c64f[_0x586fc6(0x1cf)]||getActiveProfile(),[_0xfa2372,..._0x291d9b]=_0x258116[0x0]['split']('='),_0x4cd965=_0x291d9b[_0x586fc6(0x1c3)]('=');console['log'](a22_0x29f13['bold'](_0x586fc6(0x1e7)));if(!profileExists(_0x13969a)){const _0x180419=await a22_0x31010f({'type':_0x586fc6(0x1cb),'name':'create','message':_0x586fc6(0x1a9)+_0x13969a+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0x180419[_0x586fc6(0x1ff)])return console[_0x586fc6(0x1e3)](_0x586fc6(0x1c4)),0x1;}const _0x3ce146=loadProfile(_0x13969a),_0x14e5b3=_0x3ce146?.['config']||{};if(_0xfa2372===_0x586fc6(0x1ad)){const _0x14e7a9=resolveSite(_0x4cd965);console['log'](_0x586fc6(0x1b6)+_0x14e7a9+_0x586fc6(0x1d1)),console[_0x586fc6(0x1e3)]('\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:'),console['log']('\x20\x20'+getConsoleUrl(_0x14e7a9,_0x586fc6(0x1f5)));const _0x2bcce9=await a22_0x31010f({'type':_0x586fc6(0x1dd),'name':_0x586fc6(0x1f3),'message':_0x586fc6(0x1a4),'validate':_0x4906f0=>{const _0x3c3113=_0x586fc6;if(!_0x4906f0||!_0x4906f0[_0x3c3113(0x1e5)]())return _0x3c3113(0x1b8);return!![];}});if(!_0x2bcce9[_0x586fc6(0x1f3)])return console[_0x586fc6(0x1e3)](_0x586fc6(0x1ec)),0x1;console['log'](_0x586fc6(0x1a0));try{const _0x34ad14=TDX[_0x586fc6(0x1ff)]({'site':_0x14e7a9,'apiKey':_0x2bcce9[_0x586fc6(0x1f3)][_0x586fc6(0x1e5)](),'logLevel':_0x11c64f[_0x586fc6(0x1b9)]??LogLevel[_0x586fc6(0x20a)]}),_0x5a4514=await _0x34ad14['jobs']['getUserInfo']();console[_0x586fc6(0x1e3)](a22_0x29f13[_0x586fc6(0x1f1)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x5a4514[_0x586fc6(0x1ac)]+')');const _0x4d804a=await isKeychainAvailable();_0x4d804a?(await saveAPIKeyAsync(_0x2bcce9[_0x586fc6(0x1f3)][_0x586fc6(0x1e5)](),_0x14e7a9,_0x13969a),console[_0x586fc6(0x1e3)](a22_0x29f13[_0x586fc6(0x1f1)]('✓')+_0x586fc6(0x1f4))):console[_0x586fc6(0x1da)](a22_0x29f13[_0x586fc6(0x1aa)](_0x586fc6(0x1fd))),_0x14e5b3['site']=_0x14e7a9;}catch(_0x3ae367){if(_0x3ae367 instanceof HTTPClientError&&_0x3ae367[_0x586fc6(0x1cd)]===0x191)return printAuthError(_0x3ae367),0x1;return console[_0x586fc6(0x204)](a22_0x29f13[_0x586fc6(0x1ae)](_0x586fc6(0x209)+(_0x3ae367 instanceof Error?_0x3ae367['message']:String(_0x3ae367)))),console[_0x586fc6(0x204)](_0x586fc6(0x1eb)),0x1;}}else _0x14e5b3[_0xfa2372]=_0x4cd965||undefined;return saveProfileToUserConfig(_0x13969a,_0x14e5b3),console[_0x586fc6(0x1e3)](a22_0x29f13[_0x586fc6(0x1f1)]('✓')+_0x586fc6(0x1b1)+_0x13969a+_0x586fc6(0x208)+_0xfa2372+'='+(_0x4cd965||_0x586fc6(0x1dc))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0xcb5c1c(0x1c2)]=a22_0xcb5c1c(0x1af);[a22_0xcb5c1c(0x1a3)]=a22_0xcb5c1c(0x19e);[a22_0xcb5c1c(0x1c5)](_0x4c01e6){const _0xed9425=a22_0xcb5c1c,{args:_0x34acef}=_0x4c01e6;if(_0x34acef['length']===0x0)return _0xed9425(0x1f7);return undefined;}async[a22_0xcb5c1c(0x19d)](_0x89b56c){const _0x454027=a22_0xcb5c1c,{args:_0x233df4,options:_0x405ad0}=_0x89b56c,_0x2e103a=_0x233df4[0x0],_0x2c49c3=_0x405ad0['default'];cleanExpiredSessions();if(!profileExists(_0x2e103a)){console[_0x454027(0x204)](a22_0x29f13[_0x454027(0x1ae)](_0x454027(0x1a9)+_0x2e103a+'\x27\x20does\x20not\x20exist.')),console[_0x454027(0x1e3)](_0x454027(0x1a7));const _0x439209=listProfiles();if(_0x439209[_0x454027(0x1b4)]===0x0)console[_0x454027(0x1e3)](_0x454027(0x1d4));else for(const _0x511d74 of _0x439209){console[_0x454027(0x1e3)](_0x454027(0x201)+_0x511d74[_0x454027(0x1c2)]);}return 0x1;}if(_0x2c49c3){const _0x2f00d=a22_0x5aecbd[_0x454027(0x1c3)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x2e103a),console['log'](_0x454027(0x1e4)+a22_0x29f13[_0x454027(0x1f1)](_0x2e103a)),console[_0x454027(0x1e3)](a22_0x29f13[_0x454027(0x1a6)](_0x454027(0x1a1)+_0x2f00d)),0x0;}const _0x241414=_0x405ad0[_0x454027(0x1fc)]||getCurrentSessionPID()[_0x454027(0x1e2)]();return saveSessionContext({'profile':_0x2e103a},_0x405ad0[_0x454027(0x1fc)]),console[_0x454027(0x1e3)]('Session\x20profile\x20set\x20to:\x20'+a22_0x29f13[_0x454027(0x1f1)](_0x2e103a)+'\x20'+a22_0x29f13[_0x454027(0x1a6)](_0x454027(0x1ef)+_0x241414+')')),console[_0x454027(0x1e3)](a22_0x29f13['dim'](_0x454027(0x1ca)+_0x2e103a+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
1
+ const a22_0x1c01f6=a22_0x453c;(function(_0x1a9104,_0x46deeb){const _0x5870fc=a22_0x453c,_0x24e989=_0x1a9104();while(!![]){try{const _0x4fc018=parseInt(_0x5870fc(0x18a))/0x1+parseInt(_0x5870fc(0x150))/0x2+parseInt(_0x5870fc(0x13f))/0x3+parseInt(_0x5870fc(0x19e))/0x4+parseInt(_0x5870fc(0x1a4))/0x5+-parseInt(_0x5870fc(0x142))/0x6*(-parseInt(_0x5870fc(0x160))/0x7)+-parseInt(_0x5870fc(0x192))/0x8;if(_0x4fc018===_0x46deeb)break;else _0x24e989['push'](_0x24e989['shift']());}catch(_0x512982){_0x24e989['push'](_0x24e989['shift']());}}}(a22_0x42d8,0xd5d7a));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';function a22_0x42d8(){const _0x146ccd=['Create\x20a\x20new\x20profile','select','yellow','value','Enter\x20custom\x20site','execute','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','profile:create','findIndex','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','Set\x20session\x20profile','toString','Site\x20was\x20not\x20changed.','/app/mp/ak','confirm','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','green','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','Operation\x20cancelled','911726CmTKqZ','Enter\x20description\x20(optional):','split','Remove\x20a\x20profile','\x20API\x20key\x20is\x20valid\x20(User:\x20','validate','red','eu01','40787640sdsygG','Failed\x20to\x20remove\x20profile:\x20','tdx:\x20profile\x20set','profile:set','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','us\x20\x20\x20-\x20United\x20States','\x0aSaved\x20to:\x20','site','password','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','profileName','jobs','6591996JbsZZi','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','llm_agent','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','\x27.\x0a\x0aValid\x20keys:\x20','parent_segment','2838230zpNREB','warn','error','\x27\x20does\x20not\x20exist.','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','You\x20can\x20find\x20your\x20API\x20key\x20at:','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','Site\x20name\x20cannot\x20be\x20empty','create','log','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>','\x0aOperation\x20cancelled','ERROR','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','database','\x0aAvailable\x20profiles:','trim','default','2832012qIySYB','\x27\x20updated:\x20','status','323238qdWFla','test','config','dim','\x20\x20(no\x20profiles\x20found)','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','llm_project','profile:remove','customSite','ap02','Validating\x20API\x20key...','\x20Profile\x20\x27','join','eu\x20\x20\x20-\x20Europe','2405258AaaSnx','description','(session:\x20','length','\x20\x20tdx\x20--profile\x20','VALID_KEYS','tdx.json','Set\x20a\x20profile\x20configuration\x20value','name','(cleared)','profile','push','Enter\x20site\x20name:','\x20API\x20key\x20removed\x20from\x20system\x20keychain','text','✗\x20Validation\x20failed:\x20','91kiZTIm','logLevel','tdx:\x20profile\x20remove','profile:use','Default\x20profile\x20set\x20to:\x20','apiKey','us01','session','\x0aSetup\x20cancelled','API\x20key\x20cannot\x20be\x20empty','\x27\x20does\x20not\x20exist.\x20Create\x20it?','jp01','tdx:\x20profile\x20create','bold','getUserInfo','\x27\x20removed\x20from\x20configuration','message','Session\x20profile\x20set\x20to:\x20','Enter\x20profile\x20name:','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','\x27\x20requires\x20API\x20key\x20validation.','Profile\x20\x27','Unknown\x20key\x20\x27'];a22_0x42d8=function(){return _0x146ccd;};return a22_0x42d8();}import{getConfigDir}from'../core/config.js';import*as a22_0x23d0f3 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';function a22_0x453c(_0x445e62,_0x5dd86b){_0x445e62=_0x445e62-0x134;const _0x42d816=a22_0x42d8();let _0x453cfc=_0x42d816[_0x445e62];return _0x453cfc;}import a22_0x5267c0 from'prompts';import a22_0xfb9db5 from'chalk';function validateProfileName(_0x26aeac){const _0x1e324c=a22_0x453c;if(!_0x26aeac||!_0x26aeac[_0x1e324c(0x13d)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x2cf8b8=_0x26aeac['trim']();if(!/^[a-zA-Z0-9_-]+$/[_0x1e324c(0x143)](_0x2cf8b8))return _0x1e324c(0x188);if(profileExists(_0x2cf8b8))return _0x1e324c(0x175)+_0x2cf8b8+_0x1e324c(0x1ab);return!![];}export class ProfileCreateCommand extends BaseCommand{[a22_0x1c01f6(0x158)]=a22_0x1c01f6(0x17e);[a22_0x1c01f6(0x151)]=a22_0x1c01f6(0x177);async[a22_0x1c01f6(0x17c)](_0x5bfa06){const _0x5b2bac=a22_0x1c01f6,{options:_0x5b399d,args:_0x127362}=_0x5bfa06;console[_0x5b2bac(0x136)](a22_0xfb9db5['bold'](_0x5b2bac(0x16c)));let _0x13d639;if(_0x127362['length']>0x0&&_0x127362[0x0]){const _0x1141f2=_0x127362[0x0][_0x5b2bac(0x13d)](),_0x58197a=validateProfileName(_0x1141f2);if(_0x58197a!==!![])return console[_0x5b2bac(0x1a6)](a22_0xfb9db5['red'](_0x58197a)),0x1;_0x13d639=_0x1141f2;}else{const _0xf2768f=await a22_0x5267c0({'type':_0x5b2bac(0x15e),'name':'profileName','message':_0x5b2bac(0x172),'validate':validateProfileName});if(!_0xf2768f['profileName'])return console[_0x5b2bac(0x136)](_0x5b2bac(0x168)),0x1;_0x13d639=_0xf2768f[_0x5b2bac(0x19c)][_0x5b2bac(0x13d)]();}const _0x3f4ab1=await a22_0x5267c0({'type':'text','name':'description','message':_0x5b2bac(0x18b)}),_0x24e1c1=_0x3f4ab1[_0x5b2bac(0x151)]?.[_0x5b2bac(0x13d)]()||undefined,_0x5bc0b2=_0x5b399d[_0x5b2bac(0x199)]||'us01',_0x56857a=[{'title':_0x5b2bac(0x197),'value':_0x5b2bac(0x166)},{'title':'jp\x20\x20\x20-\x20Japan','value':_0x5b2bac(0x16b)},{'title':_0x5b2bac(0x14f),'value':_0x5b2bac(0x191)},{'title':'ap02\x20-\x20Korea','value':_0x5b2bac(0x14b)}];let _0x242619=_0x56857a[_0x5b2bac(0x17f)](_0x322b95=>_0x322b95[_0x5b2bac(0x17a)]===_0x5bc0b2);_0x242619===-0x1&&_0x5bc0b2!=='us01'&&(_0x56857a[_0x5b2bac(0x15b)]({'title':_0x5bc0b2,'value':_0x5bc0b2}),_0x242619=_0x56857a[_0x5b2bac(0x153)]-0x1);_0x56857a[_0x5b2bac(0x15b)]({'title':_0x5b2bac(0x17b),'value':'other'});const _0x535341=await a22_0x5267c0({'type':_0x5b2bac(0x178),'name':_0x5b2bac(0x199),'message':'Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27'+_0x13d639+'\x27:','choices':_0x56857a,'initial':_0x242619>=0x0?_0x242619:0x0});if(!_0x535341[_0x5b2bac(0x199)])return console[_0x5b2bac(0x136)](_0x5b2bac(0x168)),0x1;let _0x1b042e;if(_0x535341[_0x5b2bac(0x199)]==='other'){const _0x451fd9=await a22_0x5267c0({'type':'text','name':_0x5b2bac(0x14a),'message':_0x5b2bac(0x15c),'initial':_0x5b2bac(0x166),'validate':_0x553bde=>{const _0x3f29e7=_0x5b2bac;if(!_0x553bde||!_0x553bde[_0x3f29e7(0x13d)]())return _0x3f29e7(0x134);if(!/^[a-z0-9-]+$/[_0x3f29e7(0x143)](_0x553bde[_0x3f29e7(0x13d)]()))return'Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens';return!![];}});if(!_0x451fd9['customSite'])return console['log']('\x0aSetup\x20cancelled'),0x1;_0x1b042e=_0x451fd9[_0x5b2bac(0x14a)];}else _0x1b042e=_0x535341[_0x5b2bac(0x199)];const _0x586d61=resolveSite(_0x1b042e);console[_0x5b2bac(0x136)](_0x5b2bac(0x173)+_0x586d61),console[_0x5b2bac(0x136)](_0x5b2bac(0x1a9)),console[_0x5b2bac(0x136)]('\x20\x20'+getConsoleUrl(_0x586d61,_0x5b2bac(0x184)));const _0x4ce13f=await a22_0x5267c0({'type':_0x5b2bac(0x19a),'name':_0x5b2bac(0x165),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x190c1d=>{const _0x30b268=_0x5b2bac;if(!_0x190c1d||!_0x190c1d[_0x30b268(0x13d)]())return _0x30b268(0x169);return!![];}});if(!_0x4ce13f['apiKey'])return console[_0x5b2bac(0x136)](_0x5b2bac(0x168)),0x1;const _0x522157=_0x4ce13f['apiKey'];console['log'](_0x5b2bac(0x14c));try{const _0x3340d7=TDX[_0x5b2bac(0x135)]({'site':_0x586d61,'apiKey':_0x522157[_0x5b2bac(0x13d)](),'logLevel':_0x5b399d['logLevel']??LogLevel[_0x5b2bac(0x139)]}),_0x2a2e12=await _0x3340d7['jobs'][_0x5b2bac(0x16e)]();console['log'](a22_0xfb9db5['green']('✓')+_0x5b2bac(0x18e)+_0x2a2e12['email']+')');const _0x5ce0de=await isKeychainAvailable();_0x5ce0de?(await saveAPIKeyAsync(_0x522157[_0x5b2bac(0x13d)](),_0x586d61,_0x13d639),console[_0x5b2bac(0x136)](a22_0xfb9db5['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20'+_0x13d639+')')):(console[_0x5b2bac(0x1a5)](a22_0xfb9db5[_0x5b2bac(0x179)](_0x5b2bac(0x1aa))),console[_0x5b2bac(0x1a5)](a22_0xfb9db5[_0x5b2bac(0x179)](_0x5b2bac(0x1a1))));const _0x5a3ffb={'site':_0x586d61,..._0x24e1c1&&{'description':_0x24e1c1}};return saveProfileToUserConfig(_0x13d639,_0x5a3ffb),console[_0x5b2bac(0x136)](a22_0xfb9db5['green']('✓')+_0x5b2bac(0x14d)+_0x13d639+'\x27\x20created'),console[_0x5b2bac(0x136)](),console[_0x5b2bac(0x136)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x5b2bac(0x136)](_0x5b2bac(0x154)+_0x13d639+_0x5b2bac(0x13a)),console['log'](_0x5b2bac(0x154)+_0x13d639+'\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases'),0x0;}catch(_0x2c9fa3){if(_0x2c9fa3 instanceof HTTPClientError&&_0x2c9fa3[_0x5b2bac(0x141)]===0x191)return printAuthError(_0x2c9fa3),0x1;return console[_0x5b2bac(0x1a6)](a22_0xfb9db5['red'](_0x5b2bac(0x15f)+(_0x2c9fa3 instanceof Error?_0x2c9fa3[_0x5b2bac(0x170)]:String(_0x2c9fa3)))),console['error'](_0x5b2bac(0x19f)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a22_0x1c01f6(0x158)]=a22_0x1c01f6(0x149);[a22_0x1c01f6(0x151)]=a22_0x1c01f6(0x18d);[a22_0x1c01f6(0x18f)](_0x42256a){const _0x427940=a22_0x1c01f6,{args:_0x2be7f1}=_0x42256a;if(_0x2be7f1[_0x427940(0x153)]===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a22_0x1c01f6(0x17c)](_0xb59db8){const _0x4fadde=a22_0x1c01f6,{args:_0x1f9a6e}=_0xb59db8,_0x4251c4=_0x1f9a6e[0x0];console[_0x4fadde(0x136)](a22_0xfb9db5[_0x4fadde(0x16d)](_0x4fadde(0x162)));if(!profileExists(_0x4251c4)){console[_0x4fadde(0x1a6)](a22_0xfb9db5[_0x4fadde(0x190)]('Profile\x20\x27'+_0x4251c4+_0x4fadde(0x1a7))),console[_0x4fadde(0x136)]('\x0aAvailable\x20profiles:');const _0x17e0ea=listProfiles();if(_0x17e0ea[_0x4fadde(0x153)]===0x0)console['log'](_0x4fadde(0x146));else for(const _0x825774 of _0x17e0ea){console[_0x4fadde(0x136)]('\x20\x20-\x20'+_0x825774[_0x4fadde(0x158)]);}return 0x1;}const _0x213fc1=await a22_0x5267c0({'type':_0x4fadde(0x185),'name':_0x4fadde(0x185),'message':_0x4fadde(0x19b)+_0x4251c4+'\x27?','initial':![]});if(!_0x213fc1['confirm'])return console[_0x4fadde(0x136)]('Removal\x20cancelled'),0x0;try{removeProfileFromUserConfig(_0x4251c4),console[_0x4fadde(0x136)](a22_0xfb9db5['green']('✓')+_0x4fadde(0x14d)+_0x4251c4+_0x4fadde(0x16f));}catch(_0xd7dbc9){return console[_0x4fadde(0x1a6)](a22_0xfb9db5['red'](_0x4fadde(0x193)+(_0xd7dbc9 instanceof Error?_0xd7dbc9[_0x4fadde(0x170)]:String(_0xd7dbc9)))),0x1;}const _0x3f4b17=await isKeychainAvailable();if(_0x3f4b17){const _0x3bf100=await deleteKeychainAPIKey(_0x4251c4);_0x3bf100&&console['log'](a22_0xfb9db5['green']('✓')+_0x4fadde(0x15d));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a22_0x1c01f6(0x158)]=a22_0x1c01f6(0x195);[a22_0x1c01f6(0x151)]=a22_0x1c01f6(0x157);static [a22_0x1c01f6(0x155)]=[a22_0x1c01f6(0x199),a22_0x1c01f6(0x13b),a22_0x1c01f6(0x1a3),a22_0x1c01f6(0x148),a22_0x1c01f6(0x1a0),a22_0x1c01f6(0x151)];[a22_0x1c01f6(0x18f)](_0x183cfb){const _0x1c8f17=a22_0x1c01f6,{args:_0x172cb8,options:_0x4edad1}=_0x183cfb,_0x2d7a95=_0x4edad1[_0x1c8f17(0x15a)]||getActiveProfile();if(!_0x2d7a95)return _0x1c8f17(0x137);if(_0x172cb8['length']===0x0)return _0x1c8f17(0x196)+ProfileSetCommand[_0x1c8f17(0x155)][_0x1c8f17(0x14e)](',\x20');const _0x532a9b=_0x172cb8[0x0];if(!_0x532a9b['includes']('='))return _0x1c8f17(0x147)+ProfileSetCommand[_0x1c8f17(0x155)]['join'](',\x20');const [_0x52d5c0]=_0x532a9b[_0x1c8f17(0x18c)]('=',0x2);if(!ProfileSetCommand['VALID_KEYS']['includes'](_0x52d5c0))return _0x1c8f17(0x176)+_0x52d5c0+_0x1c8f17(0x1a2)+ProfileSetCommand[_0x1c8f17(0x155)][_0x1c8f17(0x14e)](',\x20');return undefined;}async[a22_0x1c01f6(0x17c)](_0x57d8d1){const _0x5a74e8=a22_0x1c01f6,{args:_0x369584,options:_0x20225e}=_0x57d8d1,_0x51a112=_0x20225e['profile']||getActiveProfile(),[_0x2f2645,..._0x356727]=_0x369584[0x0][_0x5a74e8(0x18c)]('='),_0x571f20=_0x356727['join']('=');console['log'](a22_0xfb9db5[_0x5a74e8(0x16d)](_0x5a74e8(0x194)));if(!profileExists(_0x51a112)){const _0x26635f=await a22_0x5267c0({'type':_0x5a74e8(0x185),'name':_0x5a74e8(0x135),'message':_0x5a74e8(0x175)+_0x51a112+_0x5a74e8(0x16a),'initial':!![]});if(!_0x26635f['create'])return console[_0x5a74e8(0x136)](_0x5a74e8(0x189)),0x1;}const _0x2ba69c=loadProfile(_0x51a112),_0x2fb924=_0x2ba69c?.[_0x5a74e8(0x144)]||{};if(_0x2f2645===_0x5a74e8(0x199)){const _0x99345b=resolveSite(_0x571f20);console[_0x5a74e8(0x136)]('Changing\x20site\x20to\x20\x27'+_0x99345b+_0x5a74e8(0x174)),console[_0x5a74e8(0x136)](_0x5a74e8(0x186)),console[_0x5a74e8(0x136)]('\x20\x20'+getConsoleUrl(_0x99345b,_0x5a74e8(0x184)));const _0x22f1a0=await a22_0x5267c0({'type':'password','name':_0x5a74e8(0x165),'message':_0x5a74e8(0x180),'validate':_0xfc8ecf=>{const _0x56b4b7=_0x5a74e8;if(!_0xfc8ecf||!_0xfc8ecf[_0x56b4b7(0x13d)]())return _0x56b4b7(0x169);return!![];}});if(!_0x22f1a0[_0x5a74e8(0x165)])return console[_0x5a74e8(0x136)](_0x5a74e8(0x138)),0x1;console['log'](_0x5a74e8(0x14c));try{const _0x136f8c=TDX['create']({'site':_0x99345b,'apiKey':_0x22f1a0[_0x5a74e8(0x165)][_0x5a74e8(0x13d)](),'logLevel':_0x20225e[_0x5a74e8(0x161)]??LogLevel[_0x5a74e8(0x139)]}),_0x39613f=await _0x136f8c[_0x5a74e8(0x19d)][_0x5a74e8(0x16e)]();console['log'](a22_0xfb9db5['green']('✓')+_0x5a74e8(0x18e)+_0x39613f['email']+')');const _0x59a265=await isKeychainAvailable();_0x59a265?(await saveAPIKeyAsync(_0x22f1a0[_0x5a74e8(0x165)]['trim'](),_0x99345b,_0x51a112),console[_0x5a74e8(0x136)](a22_0xfb9db5[_0x5a74e8(0x187)]('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console['warn'](a22_0xfb9db5['yellow']('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),_0x2fb924[_0x5a74e8(0x199)]=_0x99345b;}catch(_0x187b34){if(_0x187b34 instanceof HTTPClientError&&_0x187b34['status']===0x191)return printAuthError(_0x187b34),0x1;return console[_0x5a74e8(0x1a6)](a22_0xfb9db5[_0x5a74e8(0x190)]('✗\x20Validation\x20failed:\x20'+(_0x187b34 instanceof Error?_0x187b34[_0x5a74e8(0x170)]:String(_0x187b34)))),console[_0x5a74e8(0x1a6)](_0x5a74e8(0x183)),0x1;}}else _0x2fb924[_0x2f2645]=_0x571f20||undefined;return saveProfileToUserConfig(_0x51a112,_0x2fb924),console[_0x5a74e8(0x136)](a22_0xfb9db5['green']('✓')+_0x5a74e8(0x14d)+_0x51a112+_0x5a74e8(0x140)+_0x2f2645+'='+(_0x571f20||_0x5a74e8(0x159))),0x0;}}export class ProfileUseCommand extends BaseCommand{[a22_0x1c01f6(0x158)]=a22_0x1c01f6(0x163);[a22_0x1c01f6(0x151)]=a22_0x1c01f6(0x181);[a22_0x1c01f6(0x18f)](_0x36b132){const _0x487282=a22_0x1c01f6,{args:_0x21aafd}=_0x36b132;if(_0x21aafd[_0x487282(0x153)]===0x0)return _0x487282(0x17d);return undefined;}async[a22_0x1c01f6(0x17c)](_0x374f5b){const _0x33ddfa=a22_0x1c01f6,{args:_0x619788,options:_0x4cb090}=_0x374f5b,_0x5cd106=_0x619788[0x0],_0x37b292=_0x4cb090[_0x33ddfa(0x13e)];cleanExpiredSessions();if(!profileExists(_0x5cd106)){console[_0x33ddfa(0x1a6)](a22_0xfb9db5[_0x33ddfa(0x190)](_0x33ddfa(0x175)+_0x5cd106+_0x33ddfa(0x1a7))),console[_0x33ddfa(0x136)](_0x33ddfa(0x13c));const _0xbe87a3=listProfiles();if(_0xbe87a3[_0x33ddfa(0x153)]===0x0)console[_0x33ddfa(0x136)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x14985b of _0xbe87a3){console[_0x33ddfa(0x136)]('\x20\x20-\x20'+_0x14985b[_0x33ddfa(0x158)]);}return 0x1;}if(_0x37b292){const _0x48c8b4=a22_0x23d0f3[_0x33ddfa(0x14e)](getConfigDir(),_0x33ddfa(0x156));return saveActiveProfileToUserConfig(_0x5cd106),console[_0x33ddfa(0x136)](_0x33ddfa(0x164)+a22_0xfb9db5[_0x33ddfa(0x187)](_0x5cd106)),console[_0x33ddfa(0x136)](a22_0xfb9db5[_0x33ddfa(0x145)](_0x33ddfa(0x198)+_0x48c8b4)),0x0;}const _0x3a2cc6=_0x4cb090[_0x33ddfa(0x167)]||getCurrentSessionPID()[_0x33ddfa(0x182)]();return saveSessionContext({'profile':_0x5cd106},_0x4cb090['session']),console[_0x33ddfa(0x136)](_0x33ddfa(0x171)+a22_0xfb9db5[_0x33ddfa(0x187)](_0x5cd106)+'\x20'+a22_0xfb9db5[_0x33ddfa(0x145)](_0x33ddfa(0x152)+_0x3a2cc6+')')),console['log'](a22_0xfb9db5[_0x33ddfa(0x145)](_0x33ddfa(0x1a8)+_0x5cd106+'\x20--default\x27\x20to\x20save\x20permanently')),0x0;}}
@@ -1 +1 @@
1
- const a23_0x3f39b6=a23_0x4868;(function(_0x3878e5,_0x4caeea){const _0x26cfdd=a23_0x4868,_0x38450a=_0x3878e5();while(!![]){try{const _0x5f28e7=-parseInt(_0x26cfdd(0x202))/0x1+parseInt(_0x26cfdd(0x201))/0x2*(-parseInt(_0x26cfdd(0x1ff))/0x3)+parseInt(_0x26cfdd(0x1fe))/0x4*(parseInt(_0x26cfdd(0x20a))/0x5)+parseInt(_0x26cfdd(0x1f9))/0x6+parseInt(_0x26cfdd(0x1f7))/0x7*(-parseInt(_0x26cfdd(0x205))/0x8)+-parseInt(_0x26cfdd(0x204))/0x9+parseInt(_0x26cfdd(0x1fb))/0xa;if(_0x5f28e7===_0x4caeea)break;else _0x38450a['push'](_0x38450a['shift']());}catch(_0x8b2812){_0x38450a['push'](_0x38450a['shift']());}}}(a23_0x53f8,0x281ed));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a23_0x53f8(){const _0x4e9a13=['scope','121180yIAEvr','Error:\x20','config','\x20\x20Global:\x20~/.config/tdx/tdx.json','error','28wdIEIb','description','365568ZmIFcg','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','3011290xUqkZM','log','execute','48AWgcyI','6zczpDu','profiles','154578fbMWMj','76197TCdBtj','length','1928997BGzByl','86896MeriJV','map','message','name'];a23_0x53f8=function(){return _0x4e9a13;};return a23_0x53f8();}function a23_0x4868(_0x53347f,_0x45bb6e){_0x53347f=_0x53347f-0x1f3;const _0x53f83d=a23_0x53f8();let _0x4868e0=_0x53f83d[_0x53347f];return _0x4868e0;}import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a23_0x3f39b6(0x208)]=a23_0x3f39b6(0x200);['description']='List\x20all\x20available\x20profiles';async[a23_0x3f39b6(0x1fd)](_0x36fbe3){const _0x35ddd2=a23_0x3f39b6,{options:_0x25f281}=_0x36fbe3;try{const _0x5749f9=listProfiles(),_0x59ba0f=getActiveProfile();if(_0x5749f9[_0x35ddd2(0x203)]===0x0)return console[_0x35ddd2(0x1fc)](_0x35ddd2(0x1fa)),console[_0x35ddd2(0x1fc)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x35ddd2(0x1fc)](_0x35ddd2(0x1f5)),0x0;const _0x16b271=_0x5749f9[_0x35ddd2(0x206)](_0x454dfe=>{const _0x1a7d43=_0x35ddd2,_0x2a6c0d=_0x454dfe[_0x1a7d43(0x208)]===_0x59ba0f,_0x47520e=getProfileParams(_0x454dfe[_0x1a7d43(0x1f4)]);return{'name':_0x454dfe[_0x1a7d43(0x208)],'active':_0x2a6c0d,'scope':_0x454dfe[_0x1a7d43(0x209)],'description':_0x454dfe[_0x1a7d43(0x1f4)][_0x1a7d43(0x1f8)]||'','params':_0x47520e};});return await handleSDKOutput(_0x16b271,_0x25f281),0x0;}catch(_0x877f26){return _0x877f26 instanceof Error&&console[_0x35ddd2(0x1f6)](_0x35ddd2(0x1f3)+_0x877f26[_0x35ddd2(0x207)]),0x1;}}}
1
+ const a23_0x46672f=a23_0x87b9;(function(_0x4f6637,_0x4696e4){const _0x405541=a23_0x87b9,_0xf43b45=_0x4f6637();while(!![]){try{const _0x1ac14c=parseInt(_0x405541(0x170))/0x1*(-parseInt(_0x405541(0x169))/0x2)+-parseInt(_0x405541(0x165))/0x3*(parseInt(_0x405541(0x175))/0x4)+parseInt(_0x405541(0x176))/0x5*(-parseInt(_0x405541(0x16f))/0x6)+parseInt(_0x405541(0x167))/0x7+-parseInt(_0x405541(0x179))/0x8+parseInt(_0x405541(0x16a))/0x9+parseInt(_0x405541(0x16e))/0xa;if(_0x1ac14c===_0x4696e4)break;else _0xf43b45['push'](_0xf43b45['shift']());}catch(_0x459384){_0xf43b45['push'](_0xf43b45['shift']());}}}(a23_0x18fb,0xef7d4));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';function a23_0x87b9(_0xe8a286,_0x450fec){_0xe8a286=_0xe8a286-0x163;const _0x18fb03=a23_0x18fb();let _0x87b917=_0x18fb03[_0xe8a286];return _0x87b917;}function a23_0x18fb(){const _0x19659d=['error','execute','1230892hhibrN','5OFeNQX','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','description','8354656uiqlDt','message','config','12bPrkPC','log','8114162xKiBpG','scope','3048438gKBPqW','13100031BvBeIN','map','name','length','23820450BlVnQF','1298274luVEdr','1BZvbmA','\x20\x20Global:\x20~/.config/tdx/tdx.json','List\x20all\x20available\x20profiles'];a23_0x18fb=function(){return _0x19659d;};return a23_0x18fb();}export class ProfilesCommand extends BaseCommand{[a23_0x46672f(0x16c)]='profiles';[a23_0x46672f(0x178)]=a23_0x46672f(0x172);async[a23_0x46672f(0x174)](_0x5935e4){const _0x2c92b5=a23_0x46672f,{options:_0x2cedb7}=_0x5935e4;try{const _0xe66dd9=listProfiles(),_0x115ae3=getActiveProfile();if(_0xe66dd9[_0x2c92b5(0x16d)]===0x0)return console['log']('No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a'),console['log'](_0x2c92b5(0x177)),console[_0x2c92b5(0x166)](_0x2c92b5(0x171)),0x0;const _0x247cd4=_0xe66dd9[_0x2c92b5(0x16b)](_0x4f3ae5=>{const _0x51fdab=_0x2c92b5,_0x456bbe=_0x4f3ae5[_0x51fdab(0x16c)]===_0x115ae3,_0x5d7061=getProfileParams(_0x4f3ae5[_0x51fdab(0x164)]);return{'name':_0x4f3ae5[_0x51fdab(0x16c)],'active':_0x456bbe,'scope':_0x4f3ae5[_0x51fdab(0x168)],'description':_0x4f3ae5[_0x51fdab(0x164)][_0x51fdab(0x178)]||'','params':_0x5d7061};});return await handleSDKOutput(_0x247cd4,_0x2cedb7),0x0;}catch(_0x3dd273){return _0x3dd273 instanceof Error&&console[_0x2c92b5(0x173)]('Error:\x20'+_0x3dd273[_0x2c92b5(0x163)]),0x1;}}}
@@ -1 +1 @@
1
- const a24_0x3a03ee=a24_0x2f85;(function(_0x20b33c,_0x586c6e){const _0x10de1c=a24_0x2f85,_0x58a310=_0x20b33c();while(!![]){try{const _0x5dd61c=parseInt(_0x10de1c(0x72))/0x1*(-parseInt(_0x10de1c(0xa1))/0x2)+parseInt(_0x10de1c(0x75))/0x3+-parseInt(_0x10de1c(0x9c))/0x4*(-parseInt(_0x10de1c(0xa4))/0x5)+parseInt(_0x10de1c(0x83))/0x6+-parseInt(_0x10de1c(0x81))/0x7*(-parseInt(_0x10de1c(0x89))/0x8)+-parseInt(_0x10de1c(0x78))/0x9*(-parseInt(_0x10de1c(0x74))/0xa)+parseInt(_0x10de1c(0xa3))/0xb;if(_0x5dd61c===_0x586c6e)break;else _0x58a310['push'](_0x58a310['shift']());}catch(_0xb2b883){_0x58a310['push'](_0x58a310['shift']());}}}(a24_0x43b8,0x97e32));function a24_0x2f85(_0x41bdda,_0x14a7d7){_0x41bdda=_0x41bdda-0x72;const _0x43b804=a24_0x43b8();let _0x2f859a=_0x43b804[_0x41bdda];return _0x2f859a;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a24_0x43b8(){const _0x4acdfd=['\x0aAll\x20results\x20saved\x20to\x20','1043772pIxmts','output','data','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','information_schema','setJobId','2264ApaZtu','\x20-\x20','Schema:\x20','Statement\x20','completedSplits','Run\x20Trino\x20queries\x20(streaming)','...','SQL:\x20','database','\x20splits','site','query','message','\x20rows\x20','jobId','\x20[Job\x20ID:\x20','Error:\x20','description','execute','39572nbADEV','file','Site:\x20','name','processedRows','2KUqLcF','push','2389563JoqdqI','470JcsMpQ','totalSplits','1195823gsFzpg','Catalog:\x20','14460pojWgP','197211isLxMF','verbose','elapsedTimeMillis','2403UVLudY','length','join','validate','error','state','Executing\x20query\x20[','No\x20SQL\x20provided','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','1113YgLnmC'];a24_0x43b8=function(){return _0x4acdfd;};return a24_0x43b8();}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{[a24_0x3a03ee(0x9f)]=a24_0x3a03ee(0x94);[a24_0x3a03ee(0x9a)]=a24_0x3a03ee(0x8e);async[a24_0x3a03ee(0x9b)](_0x565d73){const _0x5d1db8=a24_0x3a03ee,{options:_0x5a384a,args:_0x5a758b,tdx:_0x552284}=_0x565d73,_0x6e5911=_0x5a758b[0x0],_0x41b28c=_0x5a384a[_0x5d1db8(0x9d)];let _0x28f4be;try{if(_0x41b28c)_0x28f4be=readSqlStatementsFromFile(_0x41b28c);else{if(_0x6e5911==='-')_0x28f4be=await readSqlStatementsFromStdin();else{if(_0x6e5911&&isSqlFilePath(_0x6e5911))_0x28f4be=readSqlStatementsFromFile(_0x6e5911);else{if(_0x6e5911)_0x28f4be=splitSqlStatements(_0x6e5911);else throw new Error(_0x5d1db8(0x7f));}}}}catch(_0x4ff5e3){return console[_0x5d1db8(0x7c)](_0x5d1db8(0x99)+_0x4ff5e3['message']),0x1;}const _0x2f41a1=_0x5a384a[_0x5d1db8(0x91)]||_0x5d1db8(0x87),_0x524f5c=_0x5a384a['catalog'];try{const _0x1970e7=[],_0x46332d=!!_0x5a384a['output'];for(let _0x3a742f=0x0;_0x3a742f<_0x28f4be[_0x5d1db8(0x79)];_0x3a742f++){const _0x2a0ff5=_0x28f4be[_0x3a742f],_0x22bb6e=_0x3a742f+0x1,_0x5c73bf=_0x28f4be[_0x5d1db8(0x79)],_0x484918=_0x5c73bf>0x1;_0x5a384a[_0x5d1db8(0x76)]&&(console['error']('\x0a'+(_0x484918?_0x5d1db8(0x8c)+_0x22bb6e+'/'+_0x5c73bf+':':'')),console[_0x5d1db8(0x7c)](_0x5d1db8(0x9e)+_0x5a384a[_0x5d1db8(0x93)]),console[_0x5d1db8(0x7c)](_0x5d1db8(0x73)+(_0x524f5c||'td')),console['error'](_0x5d1db8(0x8b)+_0x2f41a1),console[_0x5d1db8(0x7c)](_0x5d1db8(0x90)+_0x2a0ff5));const _0xb447da=_0x484918?'Executing\x20statement\x20'+_0x22bb6e+'/'+_0x5c73bf+_0x5d1db8(0x8f):'Executing\x20query...';try{const _0x313e66=await withProgressSpinner(_0xb447da,async _0x389fda=>{const _0x232a1a=_0x5d1db8,_0x13389c=await _0x552284[_0x232a1a(0x94)]['execute'](_0x2a0ff5,{'catalog':_0x524f5c,'schema':_0x2f41a1,'onJobId':_0x2839e2=>{const _0x9f78f1=_0x232a1a;_0x389fda[_0x9f78f1(0x88)](_0x2839e2);},'onProgress':_0x5329f2=>{const _0x1ea550=_0x232a1a;_0x389fda['setPhase'](_0x1ea550(0x7e)+_0x5329f2[_0x1ea550(0x7d)]+']'),_0x389fda['setExtra'](formatRows(_0x5329f2[_0x1ea550(0xa0)])+_0x1ea550(0x96)+_0x5329f2[_0x1ea550(0x8d)]+'/'+_0x5329f2[_0x1ea550(0xa5)]+_0x1ea550(0x92));}});return _0x13389c;},{'verbose':_0x5a384a[_0x5d1db8(0x76)]}),_0x1fe4a5=_0x313e66[_0x5d1db8(0x85)],_0x11be97=_0x1fe4a5[_0x5d1db8(0x97)]?_0x5d1db8(0x98)+_0x1fe4a5[_0x5d1db8(0x97)]+']':'',_0x142bad=_0x484918?'Statement\x20'+_0x22bb6e+'/'+_0x5c73bf+_0x5d1db8(0x8a):'';console[_0x5d1db8(0x7c)]('✔\x20'+_0x142bad+'Query\x20completed:\x20Processed\x20'+formatRows(_0x1fe4a5['stats'][_0x5d1db8(0xa0)])+_0x5d1db8(0x96)+('in\x20'+formatElapsed(_0x1fe4a5['stats'][_0x5d1db8(0x77)])+_0x11be97));if(_0x484918&&_0x46332d){const _0x2f7f53=resolveOutputOptions(_0x5a384a),_0x3ff670=await formatQueryOutput(_0x1fe4a5,_0x2f7f53);_0x1970e7[_0x5d1db8(0xa2)](_0x3ff670);}else await handleQueryOutput(_0x1fe4a5,_0x5a384a);}catch(_0x1fc191){const _0x2f6e85=_0x484918?_0x5d1db8(0x8c)+_0x22bb6e+'/'+_0x5c73bf+':\x0a':'',_0x190b28=_0x1fc191 instanceof SDKError?_0x1fc191['originalMessage']:_0x1fc191[_0x5d1db8(0x95)];return console[_0x5d1db8(0x7c)](''+_0x2f6e85+_0x190b28),0x1;}}if(_0x28f4be['length']>0x1&&_0x46332d&&_0x1970e7[_0x5d1db8(0x79)]>0x0){const _0x429f76=_0x1970e7[_0x5d1db8(0x7a)]('\x0a');writeFileSync(_0x5a384a[_0x5d1db8(0x84)],_0x429f76),console[_0x5d1db8(0x7c)](_0x5d1db8(0x82)+_0x5a384a[_0x5d1db8(0x84)]);}return 0x0;}catch(_0x3462b7){throw _0x3462b7;}}[a24_0x3a03ee(0x7b)](_0x127acb){const _0x1980d5=a24_0x3a03ee,_0x26ef34=_0x127acb['args'][0x0],_0x78b4e1=_0x127acb['options'][_0x1980d5(0x9d)];if(!_0x26ef34&&!_0x78b4e1)return _0x1980d5(0x80);if(_0x26ef34&&_0x78b4e1)return _0x1980d5(0x86);return undefined;}}
1
+ const a24_0x504f8a=a24_0x1081;function a24_0x1081(_0x3b47de,_0x50dd45){_0x3b47de=_0x3b47de-0x190;const _0x1bc5fb=a24_0x1bc5();let _0x1081ff=_0x1bc5fb[_0x3b47de];return _0x1081ff;}function a24_0x1bc5(){const _0x120fcd=['Executing\x20query\x20[','Executing\x20statement\x20','site','\x20-\x20','execute','setJobId','3uYSHhS','name','verbose','setPhase','jobId','length','push','1142496TiWfpK','in\x20','message','\x20splits','args','stats','description','join','529350LPvOOJ','validate','24sGTfuW','file','61965iBeCgM','totalSplits','Site:\x20','2022813XjBqXN','error','\x0aAll\x20results\x20saved\x20to\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','information_schema','catalog','Statement\x20','Executing\x20query...','784348fOgPcQ','No\x20SQL\x20provided','20049XIBbLW','Query\x20completed:\x20Processed\x20','originalMessage','...','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','SQL:\x20','\x20rows\x20','query','setExtra','1634535KlySTv'];a24_0x1bc5=function(){return _0x120fcd;};return a24_0x1bc5();}(function(_0x1a4692,_0x55a1c3){const _0x5c5ac0=a24_0x1081,_0x553ef0=_0x1a4692();while(!![]){try{const _0x15ba55=-parseInt(_0x5c5ac0(0x1a4))/0x1+parseInt(_0x5c5ac0(0x193))/0x2+-parseInt(_0x5c5ac0(0x1b4))/0x3*(-parseInt(_0x5c5ac0(0x1a2))/0x4)+parseInt(_0x5c5ac0(0x197))/0x5*(-parseInt(_0x5c5ac0(0x195))/0x6)+-parseInt(_0x5c5ac0(0x1ad))/0x7+-parseInt(_0x5c5ac0(0x1bb))/0x8+parseInt(_0x5c5ac0(0x19a))/0x9;if(_0x15ba55===_0x55a1c3)break;else _0x553ef0['push'](_0x553ef0['shift']());}catch(_0x29432f){_0x553ef0['push'](_0x553ef0['shift']());}}}(a24_0x1bc5,0x3a7dd));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';export class QueryCommand extends BaseCommand{[a24_0x504f8a(0x1b5)]=a24_0x504f8a(0x1ab);[a24_0x504f8a(0x191)]='Run\x20Trino\x20queries\x20(streaming)';async[a24_0x504f8a(0x1b2)](_0x5bbfd0){const _0x296e82=a24_0x504f8a,{options:_0xeb4946,args:_0x538790,tdx:_0x217a0c}=_0x5bbfd0,_0xd106b0=_0x538790[0x0],_0x3b470c=_0xeb4946[_0x296e82(0x196)];let _0x4866d6;try{if(_0x3b470c)_0x4866d6=readSqlStatementsFromFile(_0x3b470c);else{if(_0xd106b0==='-')_0x4866d6=await readSqlStatementsFromStdin();else{if(_0xd106b0&&isSqlFilePath(_0xd106b0))_0x4866d6=readSqlStatementsFromFile(_0xd106b0);else{if(_0xd106b0)_0x4866d6=splitSqlStatements(_0xd106b0);else throw new Error(_0x296e82(0x1a3));}}}}catch(_0x100970){return console['error']('Error:\x20'+_0x100970[_0x296e82(0x1bd)]),0x1;}const _0x19c566=_0xeb4946['database']||_0x296e82(0x19e),_0x3144c8=_0xeb4946[_0x296e82(0x19f)];try{const _0x49d753=[],_0x1b5d3b=!!_0xeb4946['output'];for(let _0x21a410=0x0;_0x21a410<_0x4866d6['length'];_0x21a410++){const _0x56363a=_0x4866d6[_0x21a410],_0x167840=_0x21a410+0x1,_0x22e0a9=_0x4866d6[_0x296e82(0x1b9)],_0x1a0d98=_0x22e0a9>0x1;_0xeb4946[_0x296e82(0x1b6)]&&(console[_0x296e82(0x19b)]('\x0a'+(_0x1a0d98?_0x296e82(0x1a0)+_0x167840+'/'+_0x22e0a9+':':'')),console['error'](_0x296e82(0x199)+_0xeb4946[_0x296e82(0x1b0)]),console[_0x296e82(0x19b)]('Catalog:\x20'+(_0x3144c8||'td')),console[_0x296e82(0x19b)]('Schema:\x20'+_0x19c566),console[_0x296e82(0x19b)](_0x296e82(0x1a9)+_0x56363a));const _0x464881=_0x1a0d98?_0x296e82(0x1af)+_0x167840+'/'+_0x22e0a9+_0x296e82(0x1a7):_0x296e82(0x1a1);try{const _0x4ab264=await withProgressSpinner(_0x464881,async _0x5060f8=>{const _0x5de479=await _0x217a0c['query']['execute'](_0x56363a,{'catalog':_0x3144c8,'schema':_0x19c566,'onJobId':_0x9e5b63=>{const _0x3f6b1b=a24_0x1081;_0x5060f8[_0x3f6b1b(0x1b3)](_0x9e5b63);},'onProgress':_0x36ea23=>{const _0x12d64d=a24_0x1081;_0x5060f8[_0x12d64d(0x1b7)](_0x12d64d(0x1ae)+_0x36ea23['state']+']'),_0x5060f8[_0x12d64d(0x1ac)](formatRows(_0x36ea23['processedRows'])+_0x12d64d(0x1aa)+_0x36ea23['completedSplits']+'/'+_0x36ea23[_0x12d64d(0x198)]+_0x12d64d(0x1be));}});return _0x5de479;},{'verbose':_0xeb4946[_0x296e82(0x1b6)]}),_0x3d4d01=_0x4ab264['data'],_0x3b2da0=_0x3d4d01[_0x296e82(0x1b8)]?'\x20[Job\x20ID:\x20'+_0x3d4d01[_0x296e82(0x1b8)]+']':'',_0x3ff4ba=_0x1a0d98?'Statement\x20'+_0x167840+'/'+_0x22e0a9+_0x296e82(0x1b1):'';console[_0x296e82(0x19b)]('✔\x20'+_0x3ff4ba+_0x296e82(0x1a5)+formatRows(_0x3d4d01['stats']['processedRows'])+'\x20rows\x20'+(_0x296e82(0x1bc)+formatElapsed(_0x3d4d01[_0x296e82(0x190)]['elapsedTimeMillis'])+_0x3b2da0));if(_0x1a0d98&&_0x1b5d3b){const _0x369cc6=resolveOutputOptions(_0xeb4946),_0x54beb8=await formatQueryOutput(_0x3d4d01,_0x369cc6);_0x49d753[_0x296e82(0x1ba)](_0x54beb8);}else await handleQueryOutput(_0x3d4d01,_0xeb4946);}catch(_0x2a3e1b){const _0x38a817=_0x1a0d98?_0x296e82(0x1a0)+_0x167840+'/'+_0x22e0a9+':\x0a':'',_0x2b8796=_0x2a3e1b instanceof SDKError?_0x2a3e1b[_0x296e82(0x1a6)]:_0x2a3e1b[_0x296e82(0x1bd)];return console['error'](''+_0x38a817+_0x2b8796),0x1;}}if(_0x4866d6['length']>0x1&&_0x1b5d3b&&_0x49d753[_0x296e82(0x1b9)]>0x0){const _0x5aa69c=_0x49d753[_0x296e82(0x192)]('\x0a');writeFileSync(_0xeb4946['output'],_0x5aa69c),console[_0x296e82(0x19b)](_0x296e82(0x19c)+_0xeb4946['output']);}return 0x0;}catch(_0x1b2de1){throw _0x1b2de1;}}[a24_0x504f8a(0x194)](_0x28ae65){const _0x317410=a24_0x504f8a,_0xf1d94b=_0x28ae65[_0x317410(0x1bf)][0x0],_0xdcc857=_0x28ae65['options'][_0x317410(0x196)];if(!_0xf1d94b&&!_0xdcc857)return _0x317410(0x19d);if(_0xf1d94b&&_0xdcc857)return _0x317410(0x1a8);return undefined;}}