@treasuredata/tdx 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/client/cdp-api-client.js +1 -1
  8. package/dist/client/engage-api-client.js +1 -1
  9. package/dist/client/http-client.js +1 -1
  10. package/dist/client/llm-api-client.js +1 -1
  11. package/dist/client/rate-limiter.js +1 -1
  12. package/dist/client/td-api-client.d.ts +45 -1
  13. package/dist/client/td-api-client.d.ts.map +1 -1
  14. package/dist/client/td-api-client.js +1 -1
  15. package/dist/client/td-api-client.js.map +1 -1
  16. package/dist/client/trino-api-client.js +1 -1
  17. package/dist/client/workflow-client.js +1 -1
  18. package/dist/commands/activations.js +1 -1
  19. package/dist/commands/agent-command.js +1 -1
  20. package/dist/commands/api-command.js +1 -1
  21. package/dist/commands/auth-command.js +1 -1
  22. package/dist/commands/chat-command.js +1 -1
  23. package/dist/commands/claude-command.js +1 -1
  24. package/dist/commands/claude-statusline-command.js +1 -1
  25. package/dist/commands/claude-usage-command.js +1 -1
  26. package/dist/commands/command.js +1 -1
  27. package/dist/commands/connection-command.d.ts +35 -0
  28. package/dist/commands/connection-command.d.ts.map +1 -1
  29. package/dist/commands/connection-command.js +1 -1
  30. package/dist/commands/connection-command.js.map +1 -1
  31. package/dist/commands/context-command.js +1 -1
  32. package/dist/commands/databases.js +1 -1
  33. package/dist/commands/describe.js +1 -1
  34. package/dist/commands/engage-command.js +1 -1
  35. package/dist/commands/job-command.js +1 -1
  36. package/dist/commands/journey-command.d.ts.map +1 -1
  37. package/dist/commands/journey-command.js +1 -1
  38. package/dist/commands/journey-command.js.map +1 -1
  39. package/dist/commands/llm-command.js +1 -1
  40. package/dist/commands/llm-proxy.js +1 -1
  41. package/dist/commands/parent-segment-command.js +1 -1
  42. package/dist/commands/profiles-command.js +1 -1
  43. package/dist/commands/query-command.js +1 -1
  44. package/dist/commands/segment-command.js +1 -1
  45. package/dist/commands/segment-create-command.js +1 -1
  46. package/dist/commands/segment-fields-command.js +1 -1
  47. package/dist/commands/segment-pull-command.d.ts.map +1 -1
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-pull-command.js.map +1 -1
  50. package/dist/commands/segment-push-command.d.ts.map +1 -1
  51. package/dist/commands/segment-push-command.js +1 -1
  52. package/dist/commands/segment-push-command.js.map +1 -1
  53. package/dist/commands/segment-update-command.js +1 -1
  54. package/dist/commands/segment-use-command.js +1 -1
  55. package/dist/commands/segments.js +1 -1
  56. package/dist/commands/show.js +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/use-command.js +1 -1
  59. package/dist/commands/user-command.js +1 -1
  60. package/dist/commands/workflow-command.js +1 -1
  61. package/dist/core/auth.js +1 -1
  62. package/dist/core/config.js +1 -1
  63. package/dist/core/connection-cache.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/proxy/anthropic-adapter.js +1 -1
  73. package/dist/proxy/claude-usage-tracker.js +1 -1
  74. package/dist/proxy/context-signature.js +1 -1
  75. package/dist/proxy/conversation-utils.js +1 -1
  76. package/dist/proxy/server.js +1 -1
  77. package/dist/proxy/session-cache.js +1 -1
  78. package/dist/sdk/agent/agent-yaml.js +1 -1
  79. package/dist/sdk/api.js +1 -1
  80. package/dist/sdk/connection-validator.d.ts +119 -0
  81. package/dist/sdk/connection-validator.d.ts.map +1 -0
  82. package/dist/sdk/connection-validator.js +1 -0
  83. package/dist/sdk/connection-validator.js.map +1 -0
  84. package/dist/sdk/connection.d.ts +120 -1
  85. package/dist/sdk/connection.d.ts.map +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/connection.js.map +1 -1
  88. package/dist/sdk/engage.js +1 -1
  89. package/dist/sdk/errors.d.ts +4 -0
  90. package/dist/sdk/errors.d.ts.map +1 -1
  91. package/dist/sdk/errors.js +1 -1
  92. package/dist/sdk/errors.js.map +1 -1
  93. package/dist/sdk/index.js +1 -1
  94. package/dist/sdk/job.js +1 -1
  95. package/dist/sdk/journey.js +1 -1
  96. package/dist/sdk/llm.js +1 -1
  97. package/dist/sdk/query.js +1 -1
  98. package/dist/sdk/segment/child-segment-yaml.d.ts +22 -6
  99. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  100. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  101. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  102. package/dist/sdk/segment/journey-yaml.js +1 -1
  103. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  104. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  105. package/dist/sdk/segment.js +1 -1
  106. package/dist/sdk/user.js +1 -1
  107. package/dist/sdk/workflow.js +1 -1
  108. package/dist/types/connector-schema.d.ts +182 -0
  109. package/dist/types/connector-schema.d.ts.map +1 -0
  110. package/dist/types/connector-schema.js +1 -0
  111. package/dist/types/connector-schema.js.map +1 -0
  112. package/dist/types/endpoints.js +1 -1
  113. package/dist/types/index.d.ts +2 -0
  114. package/dist/types/index.d.ts.map +1 -1
  115. package/dist/types/index.js +1 -1
  116. package/dist/utils/agent-config.js +1 -1
  117. package/dist/utils/agent-ref-parser.js +1 -1
  118. package/dist/utils/async.js +1 -1
  119. package/dist/utils/chat-cache.js +1 -1
  120. package/dist/utils/colors.js +1 -1
  121. package/dist/utils/command-output.js +1 -1
  122. package/dist/utils/constants.js +1 -1
  123. package/dist/utils/diff.js +1 -1
  124. package/dist/utils/fields-display.js +1 -1
  125. package/dist/utils/file-permissions.js +1 -1
  126. package/dist/utils/format-detector.js +1 -1
  127. package/dist/utils/formatters.js +1 -1
  128. package/dist/utils/journey-utils.d.ts.map +1 -1
  129. package/dist/utils/journey-utils.js +1 -1
  130. package/dist/utils/journey-utils.js.map +1 -1
  131. package/dist/utils/json-loader.js +1 -1
  132. package/dist/utils/llm-backup-utils.js +1 -1
  133. package/dist/utils/model-aliases.js +1 -1
  134. package/dist/utils/model-factors.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/segment-path-parser.js +1 -1
  140. package/dist/utils/segment-ref-parser.js +1 -1
  141. package/dist/utils/spinner.js +1 -1
  142. package/dist/utils/sql-parser.js +1 -1
  143. package/dist/utils/sse-parser.js +1 -1
  144. package/dist/utils/string-utils.js +1 -1
  145. package/dist/utils/table-ref-parser.js +1 -1
  146. package/dist/utils/tdx-config.js +1 -1
  147. package/dist/utils/tdx-logger.js +1 -1
  148. package/dist/utils/tree-formatter.js +1 -1
  149. package/dist/utils/version-check.js +1 -1
  150. package/dist/utils/workflow-utils.js +1 -1
  151. package/package.json +1 -1
@@ -1 +1 @@
1
- const a29_0x367de6=a29_0x5e17;(function(_0xb7e2e6,_0x52d73c){const _0x14e270=a29_0x5e17,_0x36e10d=_0xb7e2e6();while(!![]){try{const _0x8c7734=parseInt(_0x14e270(0x1e5))/0x1*(parseInt(_0x14e270(0x2d7))/0x2)+parseInt(_0x14e270(0x24a))/0x3+parseInt(_0x14e270(0x207))/0x4+-parseInt(_0x14e270(0x2ba))/0x5+-parseInt(_0x14e270(0x2dc))/0x6+-parseInt(_0x14e270(0x272))/0x7+parseInt(_0x14e270(0x290))/0x8*(parseInt(_0x14e270(0x1e8))/0x9);if(_0x8c7734===_0x52d73c)break;else _0x36e10d['push'](_0x36e10d['shift']());}catch(_0xb5b95e){_0x36e10d['push'](_0x36e10d['shift']());}}}(a29_0x49f3,0x41220));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';function a29_0x49f3(){const _0x4ab331=['map','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','win32','Source:','workflowSessionId','\x0a⚠️\x20\x20Both\x20','✔\x20Created\x20parent\x20segment\x20\x27','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','open','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','ignore','Output\x20file:\x20','bold','attribute','apply','\x0aChanges\x20to\x20\x27','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','1241277YBZJww','segment:parent:list','processedRows','cyan','Options:\x0a','.yml','foreignKey','jsonl','Preview:','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','displayPreviewResults','resolveParentId','segment:parent:update','\x20Opening\x20','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','getParentSQL','error','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','segment:parent:preview','stats','Aborted.','utf-8','yellow','segment:parent:desc','Columns:','workflowId','sort','join','match','attributesFile','Table:\x20','localeCompare','web','Analyzing\x20changes...','database','text','Create\x20parent\x20segment\x20\x27','runParent','Apply\x20changes\x20to\x20\x27','execute','2668701FjhNfc','Attributes','tdx\x20segment\x20parent\x20preview\x20','toFixed','List\x20available\x20fields\x20for\x20segmentation','\x27\x20with\x20ID:\x20','\x0aNew\x20parent\x20segment\x20\x27','replace','in\x20','setJobId','displayColumns','\x20No\x20changes\x20-\x20','customerGroupFile','segment:parent:fields','Customers:','\x20\x20No\x20sample\x20data\x20available','red','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x27...','YAML\x20file:\x20','varchar','Database:\x20','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','verbose','Events:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','string','filter','Join:','Audience\x20ID:','8ubrOCd','\x20--interval\x20','length','behavior','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Enriched:','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','green','toLocaleString','displayBehaviorsStats','Error:\x20File\x20not\x20found:\x20','errors','Updating\x20parent\x20segment\x20\x27','scheduleOption','jobId','darwin','Parent\x20segment:\x20','displayAttributesStats','Site:\x20','Attribute:','addBehaviorsFile','segment:parent:show','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','✔\x20Renamed\x20directory\x20to\x20','audienceId','using\x20the\x20default\x20path:\x20','joinKey','✔\x20Query\x20completed:\x20Processed\x20','session','behaviors','Join\x20on:','xdg-open','Name:\x20','displayMasterInfo','pullParentYaml','displayValidateResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','all','Fetching\x20sample\x20data...','Options:','\x27\x20is\x20up\x20to\x20date','table','1406450OpKGjx','scheduleType','master','%)\x20','\x20is\x20already\x20up\x20to\x20date','segment:parent:push','segment:parent:create','customerPercent','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','Creating\x20parent\x20segment\x20\x27','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Behaviors','\x20--enriched','unref','segment','column','Updating','test','timezone','rowCount','Session:','allValid','\x20field','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\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','output','/\x20→\x20','Status:','Error:\x20--attribute\x20requires\x20a\x20name\x0a','2450ZmSTcW','SQL\x20query:\x0a','endsWith','description','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','2345538cennrk','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','repeat','\x0a⚠️\x20\x20Migrating:\x20','matchedCount','✔\x20No\x20changes\x20-\x20\x27','Error\x20parsing\x20YAML:\x20','\x20parent\x20segment\x20\x27','query','\x0aUsage:\x20tdx\x20ps\x20preview\x20','\x27\x20and\x20run\x20workflow?','Behavior:','✘\x20Failed\x20to\x20rename\x20directory:\x20','enriched','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','schemaError','platform','Master\x20+\x20Attributes','segment:parent:sql','message','dim','Created','workflowAttemptId','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','displayPreviewHints','pushParentYaml','\x20\x20\x20\x20-\x20','No\x20parent\x20segments\x20match\x20pattern:\x20','Errors:','addAttributesFile','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Get\x20SQL\x20query\x20for\x20parent\x20segment','Creating','dirname','To\x20cancel:','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','yes','Error:\x20Parent\x20segment\x20name\x20is\x20required','`\x20to\x20download\x20the\x20configuration\x20first','coveragePercent','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Rows:','100GOeoTT','\x20--behavior\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','4662612luqzkC','stop','Validate:','start','double','FINISHED','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','interval','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','log','segment:parent:validate','-1d','columns','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','\x20Context\x20set:\x20','validateParentYaml','sampleData','parentSegment','\x20--attribute\x20\x22<name>\x22','/\x20directories\x20exist.','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','displaySummary','\x0aChanges\x20to\x20apply\x20to\x20\x27','/app/dw/parentSegments/','Updated','addBehaviors','✔\x20Updated\x20parent\x20segment\x20\x27','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','Attempt:','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a','parent_segment','1063652rFarab','site','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','run','Executing\x20parent\x20segment\x20query...','Listing\x20fields\x20for\x20\x27','json','elapsedTimeMillis','data','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Resolving\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','getParentFull','✔\x20Found\x20','\x20--behavior\x20\x22<name>\x22','segment:parent:view','displaySampleData','/attempt/','Error:\x20--behavior\x20requires\x20a\x20name\x0a','Error\x20reading\x20file:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','\x20=\x20','listParents','customerGroup','status','\x20rows)','Error:','Validating\x20configuration...','Error:\x20--database\x20and\x20--table\x20are\x20required','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','preview','Fetching\x20parent\x20segment\x20\x27','\x27\x20is\x20already\x20up\x20to\x20date','SELECT\x20*\x20FROM\x20(\x0a','information_schema','Listing\x20parent\x20segments\x20matching\x20\x27','attributes','customersWithEvents','format','segment:parent:run','totalEvents','schemaValid','label','Fetching\x20SQL\x20for\x20\x27','\x20parent\x20segment'];a29_0x49f3=function(){return _0x4ab331;};return a29_0x49f3();}import{spawn}from'child_process';import a29_0x31c5f7 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x454280 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a29_0x367de6(0x206);function openBrowser(_0x2fd43f){const _0x39b447=a29_0x367de6,_0x55d5cf=process[_0x39b447(0x2ed)],_0x84cfc6=_0x55d5cf===_0x39b447(0x29f)?_0x39b447(0x241):_0x55d5cf===_0x39b447(0x23a)?_0x39b447(0x1eb):_0x39b447(0x2af);spawn(_0x84cfc6,[_0x2fd43f],{'detached':!![],'stdio':_0x39b447(0x243)})[_0x39b447(0x2c7)]();}function migrateLegacyDirectory(){const _0x3063a8=a29_0x367de6;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x3989ad=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x3989ad['isDirectory']())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x454280[_0x3063a8(0x260)](_0x3063a8(0x23d)+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x3063a8(0x1fb))),console['error'](a29_0x454280[_0x3063a8(0x1ce)](_0x3063a8(0x249)+LEGACY_PARENT_SEGMENT_DIR+'/\x20directory.\x0a')),![];console[_0x3063a8(0x25a)](a29_0x454280[_0x3063a8(0x260)](_0x3063a8(0x2df)+LEGACY_PARENT_SEGMENT_DIR+_0x3063a8(0x2d4)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a29_0x454280[_0x3063a8(0x297)](_0x3063a8(0x2a7)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x307257){const _0x16f4cb=_0x307257 instanceof Error?_0x307257[_0x3063a8(0x1cd)]:String(_0x307257);return console[_0x3063a8(0x25a)](a29_0x454280['red'](_0x3063a8(0x2e8)+_0x16f4cb+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x367de6(0x20a)](_0x331ee8){const _0xf00f64=a29_0x367de6;return migrateLegacyDirectory(),super[_0xf00f64(0x20a)](_0x331ee8);}}function resolveYamlFile(_0x1a2c2c){const _0x531ca6=a29_0x367de6;if(_0x1a2c2c['endsWith'](_0x531ca6(0x24f))||_0x1a2c2c[_0x531ca6(0x2d9)]('.yaml'))return _0x1a2c2c;return a29_0x31c5f7['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x1a2c2c)+_0x531ca6(0x24f));}function formatProgressMessage(_0x143e94){const _0x219a05=a29_0x367de6,_0x5067f5=_0x143e94[_0x219a05(0x266)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x5067f5){const [,_0x55aa3d,_0x5a88f4,_0x4aef75='']=_0x5067f5;return a29_0x454280[_0x219a05(0x1ce)](_0x55aa3d+':')+'\x20'+_0x5a88f4+a29_0x454280['dim'](_0x4aef75);}return a29_0x454280['dim'](_0x143e94);}function showFileNotFoundError(_0x9129eb,_0x559948){const _0x40cca0=a29_0x367de6;console[_0x40cca0(0x25a)](a29_0x454280['red'](_0x40cca0(0x29a)+_0x9129eb+'\x0a')),console[_0x40cca0(0x25a)](a29_0x454280[_0x40cca0(0x24d)](_0x40cca0(0x226)+_0x559948+_0x40cca0(0x1e1)));}function showParentSegmentNotSetError(_0x5199fa){const _0x532d4d=a29_0x367de6;console[_0x532d4d(0x25a)](a29_0x454280[_0x532d4d(0x260)](_0x532d4d(0x205))),console[_0x532d4d(0x25a)](_0x5199fa);}export class ParentSegmentListCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x24b);['description']='List\x20parent\x20segments';async[a29_0x367de6(0x271)](_0x53e9c0){const _0x482d85=a29_0x367de6,{options:_0x49691b,args:_0x3aaf05,tdx:_0x274151}=_0x53e9c0,_0x6a5bcf=_0x3aaf05[0x0];_0x49691b['verbose']&&(console[_0x482d85(0x25a)]('Site:\x20'+_0x49691b[_0x482d85(0x208)]),_0x6a5bcf&&console[_0x482d85(0x25a)]('Pattern:\x20'+_0x6a5bcf));const _0xd9eee1=await withSpinner(_0x6a5bcf?_0x482d85(0x22c)+_0x6a5bcf+_0x482d85(0x284):'Listing\x20parent\x20segments...',()=>_0x274151[_0x482d85(0x2c8)][_0x482d85(0x21f)](),{'verbose':_0x49691b[_0x482d85(0x289)]});let _0x17f4c6=_0xd9eee1[_0x482d85(0x20f)];if(_0x6a5bcf){const _0x16c7f1=_0x6a5bcf['replace'](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x482d85(0x279)](/\*/g,'.*')['replace'](/\?/g,'.'),_0x46091e=new RegExp('^'+_0x16c7f1+'$','i');_0x17f4c6=_0x17f4c6[_0x482d85(0x28d)](_0x52f43c=>_0x46091e['test'](_0x52f43c[_0x482d85(0x22d)]['name']));}_0x17f4c6[_0x482d85(0x264)]((_0x4fe153,_0x2d302b)=>_0x4fe153[_0x482d85(0x22d)][_0x482d85(0x238)][_0x482d85(0x269)](_0x2d302b['attributes'][_0x482d85(0x238)])),console[_0x482d85(0x25a)](_0x482d85(0x215)+_0x17f4c6[_0x482d85(0x292)]+_0x482d85(0x235)+(_0x17f4c6[_0x482d85(0x292)]!==0x1?'s':''));if(_0x49691b[_0x482d85(0x22f)]==='json'||_0x49691b['format']===_0x482d85(0x251))await handleSDKOutput(_0x17f4c6,_0x49691b);else{if(_0x17f4c6['length']===0x0)_0x6a5bcf?console['log'](_0x482d85(0x1d6)+_0x6a5bcf):console['log']('No\x20parent\x20segments\x20found');else for(const _0xc10964 of _0x17f4c6){const _0x10fc95=_0xc10964[_0x482d85(0x22d)]['population']?a29_0x454280[_0x482d85(0x1ce)]('\x20('+formatRows(_0xc10964['attributes']['population'])+')'):'';console[_0x482d85(0x1f1)]('👥\x20'+_0xc10964[_0x482d85(0x22d)]['name']+_0x10fc95);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x2c0);[a29_0x367de6(0x2da)]=a29_0x367de6(0x258);async['execute'](_0x352bdc){const _0x50525e=a29_0x367de6,{options:_0x24215b,args:_0x58486c,tdx:_0x16b3b4}=_0x352bdc;console[_0x50525e(0x25a)](_0x50525e(0x210)+_0x50525e(0x237)+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x42cf61=_0x24215b;if(_0x58486c['length']===0x0)return console[_0x50525e(0x25a)](a29_0x454280[_0x50525e(0x282)](_0x50525e(0x1e0))),console[_0x50525e(0x25a)](_0x50525e(0x1de)),0x1;const _0x2298d4=_0x58486c[0x0];if(!_0x42cf61[_0x50525e(0x26c)]||!_0x42cf61[_0x50525e(0x2b9)])return console[_0x50525e(0x25a)](_0x50525e(0x225)),console[_0x50525e(0x25a)]('Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>'),0x1;_0x42cf61['verbose']&&(console[_0x50525e(0x25a)](_0x50525e(0x2a2)+_0x42cf61[_0x50525e(0x208)]),console[_0x50525e(0x25a)](_0x50525e(0x2b0)+_0x2298d4),console[_0x50525e(0x25a)](_0x50525e(0x287)+_0x42cf61['database']),console[_0x50525e(0x25a)](_0x50525e(0x268)+_0x42cf61[_0x50525e(0x2b9)]));const _0x18c0c7=await loadJSONFromOptions(_0x42cf61[_0x50525e(0x22d)],_0x42cf61[_0x50525e(0x267)]),_0x477729=await loadJSONFromOptions(_0x42cf61[_0x50525e(0x2ad)],_0x42cf61['behaviorsFile']),_0x58b4c5=await loadJSONFromOptions(_0x42cf61[_0x50525e(0x220)],_0x42cf61[_0x50525e(0x27e)]),_0x51c59b={'name':_0x2298d4,'description':_0x42cf61['description'],'scheduleType':_0x42cf61[_0x50525e(0x2bb)],'scheduleOption':_0x42cf61[_0x50525e(0x29d)],'timezone':_0x42cf61['timezone'],'master':{'parentDatabaseName':_0x42cf61[_0x50525e(0x26c)],'parentTableName':_0x42cf61[_0x50525e(0x2b9)]},'attributes':_0x18c0c7,'behaviors':_0x477729,'customerGroup':_0x58b4c5},_0x22ee36=await withSpinner(_0x50525e(0x2c3)+_0x2298d4+'\x27...',()=>_0x16b3b4[_0x50525e(0x2c8)]['createParent'](_0x51c59b),{'verbose':_0x24215b[_0x50525e(0x289)]}),_0x35fd4a=_0x22ee36['data'];return console[_0x50525e(0x25a)](_0x50525e(0x23e)+_0x35fd4a[_0x50525e(0x238)]+_0x50525e(0x277)+_0x35fd4a['id']),await handleSDKOutput([_0x35fd4a],_0x24215b),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x256);['description']=a29_0x367de6(0x2db);async[a29_0x367de6(0x271)](_0xbe181){const _0x4d1eea=a29_0x367de6,{options:_0x4e9557,args:_0x2036df,tdx:_0x10f15e}=_0xbe181;console[_0x4d1eea(0x25a)](_0x4d1eea(0x1fc)+'\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a'+'\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a');const _0x341bc1=_0x4e9557;if(_0x2036df['length']===0x0)return console[_0x4d1eea(0x25a)](a29_0x454280[_0x4d1eea(0x282)](_0x4d1eea(0x1e0))),console[_0x4d1eea(0x25a)](_0x4d1eea(0x1f5)),0x1;const _0x24d32c=_0x2036df[0x0];_0x341bc1[_0x4d1eea(0x289)]&&(console[_0x4d1eea(0x25a)](_0x4d1eea(0x2a2)+_0x341bc1[_0x4d1eea(0x208)]),console['error'](_0x4d1eea(0x2a0)+_0x24d32c));const _0x565ccf=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x24d32c+_0x4d1eea(0x284),()=>_0x10f15e[_0x4d1eea(0x2c8)][_0x4d1eea(0x214)](_0x24d32c),{'verbose':_0x341bc1['verbose']}),_0x92afd7=_0x565ccf[_0x4d1eea(0x20f)],_0x378094=await loadJSONFromOptions(_0x341bc1['addAttributes'],_0x341bc1[_0x4d1eea(0x1d8)]),_0x5d488c=await loadJSONFromOptions(_0x341bc1[_0x4d1eea(0x201)],_0x341bc1[_0x4d1eea(0x2a4)]),_0x30a431={'name':_0x92afd7[_0x4d1eea(0x238)],'description':_0x341bc1[_0x4d1eea(0x2da)]!==undefined?_0x341bc1[_0x4d1eea(0x2da)]:_0x92afd7[_0x4d1eea(0x2da)],'scheduleType':_0x341bc1['scheduleType']!==undefined?_0x341bc1['scheduleType']:_0x92afd7[_0x4d1eea(0x2bb)],'scheduleOption':_0x341bc1[_0x4d1eea(0x29d)]!==undefined?_0x341bc1[_0x4d1eea(0x29d)]:_0x92afd7[_0x4d1eea(0x29d)],'timezone':_0x341bc1[_0x4d1eea(0x2cc)]!==undefined?_0x341bc1[_0x4d1eea(0x2cc)]:_0x92afd7[_0x4d1eea(0x2cc)],'master':_0x92afd7[_0x4d1eea(0x2bc)],'attributes':_0x378094?[..._0x92afd7['attributes']||[],..._0x378094]:_0x92afd7[_0x4d1eea(0x22d)],'behaviors':_0x5d488c?[..._0x92afd7['behaviors']||[],..._0x5d488c]:_0x92afd7[_0x4d1eea(0x2ad)],'customerGroup':_0x92afd7[_0x4d1eea(0x220)]},_0x1b6137=await withSpinner(_0x4d1eea(0x29c)+_0x24d32c+'\x27...',()=>_0x10f15e[_0x4d1eea(0x2c8)]['updateParent'](_0x24d32c,_0x30a431),{'verbose':_0x341bc1[_0x4d1eea(0x289)]}),_0x1d0764=_0x1b6137['data'];return console[_0x4d1eea(0x25a)](_0x4d1eea(0x202)+_0x1d0764[_0x4d1eea(0x238)]+'\x27'),await handleSDKOutput([_0x1d0764],_0x341bc1),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]='segment:parent:pull';[a29_0x367de6(0x2da)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a29_0x367de6(0x271)](_0x40563f){const _0x5f0fa4=a29_0x367de6,{options:_0x527f31,args:_0x321459,tdx:_0x2265e1}=_0x40563f,_0x201d8a=_0x527f31,_0x178bf5=_0x321459[0x0]||_0x527f31['parentSegment'];if(!_0x178bf5)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a'+_0x5f0fa4(0x28b)),0x1;if(_0x201d8a['use']&&_0x201d8a[_0x5f0fa4(0x2d3)])return console[_0x5f0fa4(0x25a)](a29_0x454280['red'](_0x5f0fa4(0x2c2))),console[_0x5f0fa4(0x25a)](a29_0x454280[_0x5f0fa4(0x1ce)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x5f0fa4(0x25a)](a29_0x454280['dim'](_0x5f0fa4(0x2a9)+PARENT_SEGMENT_DIR+'/{name}.yml\x0a')),console[_0x5f0fa4(0x25a)](a29_0x454280[_0x5f0fa4(0x24d)]('Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u')),0x1;const _0xd17662=_0x201d8a[_0x5f0fa4(0x2d3)]||a29_0x31c5f7[_0x5f0fa4(0x265)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x178bf5)+_0x5f0fa4(0x24f));_0x201d8a[_0x5f0fa4(0x289)]&&(console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x2a2)+_0x201d8a[_0x5f0fa4(0x208)]),console['error']('Parent\x20segment:\x20'+_0x178bf5),console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x244)+_0xd17662));const _0x584968=await withSpinner(_0x5f0fa4(0x228)+_0x178bf5+'\x27...',()=>_0x2265e1[_0x5f0fa4(0x2c8)][_0x5f0fa4(0x2b2)](_0x178bf5),{'verbose':_0x201d8a['verbose']}),_0x23e880=_0x584968['data'];if(existsSync(_0xd17662)){const _0x4e47ea=readFileSync(_0xd17662,'utf-8'),_0x26ac58=generateDiff(_0x4e47ea,_0x23e880);if(!hasChanges(_0x26ac58))console[_0x5f0fa4(0x25a)](a29_0x454280['green']('✔')+_0x5f0fa4(0x27d)+a29_0x454280['cyan'](_0xd17662)+_0x5f0fa4(0x2be));else{console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x248)+_0xd17662+'\x27:'),console[_0x5f0fa4(0x25a)]('─'[_0x5f0fa4(0x2de)](0x3c)),console['error'](formatDiffWithColors(_0x26ac58)),console[_0x5f0fa4(0x25a)]('─'[_0x5f0fa4(0x2de)](0x3c));if(!_0x201d8a[_0x5f0fa4(0x1df)]){const _0x3cdd98=await confirmKey('Overwrite\x20\x27'+_0xd17662+'\x27?');if(!_0x3cdd98)return console[_0x5f0fa4(0x25a)](_0x5f0fa4(0x25e)),0x1;}writeFileSync(_0xd17662,_0x23e880,_0x5f0fa4(0x25f)),console['error'](a29_0x454280[_0x5f0fa4(0x297)]('✔')+_0x5f0fa4(0x2ea)+a29_0x454280['cyan'](_0xd17662));}}else{const _0x1355e0=a29_0x31c5f7[_0x5f0fa4(0x1dc)](_0xd17662);!existsSync(_0x1355e0)&&mkdirSync(_0x1355e0,{'recursive':!![]}),writeFileSync(_0xd17662,_0x23e880,_0x5f0fa4(0x25f)),console['error'](a29_0x454280['green']('✔')+_0x5f0fa4(0x2ea)+a29_0x454280[_0x5f0fa4(0x24d)](_0xd17662));}return saveSessionContext({'parent_segment':_0x178bf5},_0x201d8a[_0x5f0fa4(0x2ac)]),console[_0x5f0fa4(0x25a)](a29_0x454280[_0x5f0fa4(0x297)]('✔')+_0x5f0fa4(0x1f6)+a29_0x454280[_0x5f0fa4(0x1ce)](_0x5f0fa4(0x206))+_0x5f0fa4(0x21e)+a29_0x454280[_0x5f0fa4(0x24d)](_0x178bf5)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x2bf);['description']='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0xd82408){const _0x2081ac=a29_0x367de6,{options:_0x2e5ad7,args:_0x7b0c82,tdx:_0xf363e5}=_0xd82408,_0x43db2f=_0x2e5ad7,_0x23afc8=_0x7b0c82[0x0]||_0x2e5ad7[_0x2081ac(0x1f9)];if(!_0x23afc8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x2081ac(0x2b4)),0x1;const _0x4c0591=resolveYamlFile(_0x23afc8);if(!existsSync(_0x4c0591))return showFileNotFoundError(_0x4c0591,_0x23afc8),0x1;_0x43db2f[_0x2081ac(0x289)]&&(console['error'](_0x2081ac(0x2a2)+_0x43db2f[_0x2081ac(0x208)]),console[_0x2081ac(0x25a)](_0x2081ac(0x285)+_0x4c0591));let _0x3ff4fd;try{_0x3ff4fd=readFileSync(_0x4c0591,_0x2081ac(0x25f));}catch(_0x1b2e3f){const _0x2e8026=_0x1b2e3f instanceof Error?_0x1b2e3f[_0x2081ac(0x1cd)]:String(_0x1b2e3f);return console['error'](_0x2081ac(0x21b)+_0x2e8026),0x1;}const _0x5997cf=await withSpinner(_0x2081ac(0x26b),()=>_0xf363e5[_0x2081ac(0x2c8)][_0x2081ac(0x1d4)](_0x3ff4fd),{'verbose':_0x43db2f[_0x2081ac(0x289)]}),_0x56d3b2=_0x5997cf[_0x2081ac(0x20f)],{isNew:_0x2256fc,name:_0x507cc4,hasChanges:_0x216d9d,diffFormatted:_0xd88ebb}=_0x56d3b2;if(!_0x216d9d)return console[_0x2081ac(0x25a)](_0x2081ac(0x2e1)+_0x507cc4+_0x2081ac(0x229)),0x0;_0x2256fc?console[_0x2081ac(0x25a)](_0x2081ac(0x278)+_0x507cc4+'\x27:'):console[_0x2081ac(0x25a)](_0x2081ac(0x1fe)+_0x507cc4+'\x27:');console[_0x2081ac(0x25a)]('─'[_0x2081ac(0x2de)](0x3c)),console[_0x2081ac(0x25a)](_0xd88ebb),console['error']('─'[_0x2081ac(0x2de)](0x3c));const _0x4d160a=_0x2256fc?_0x2081ac(0x26e)+_0x507cc4+'\x27?':_0x2081ac(0x270)+_0x507cc4+'\x27?';if(!_0x43db2f[_0x2081ac(0x1df)]){const _0x594701=await confirmKey(_0x4d160a);if(!_0x594701)return console[_0x2081ac(0x25a)](_0x2081ac(0x25e)),0x1;}const _0x44ee7d=_0x2256fc?_0x2081ac(0x1db):'Updating',_0x22c2d6=await withSpinner(_0x44ee7d+_0x2081ac(0x2e3)+_0x507cc4+_0x2081ac(0x284),()=>_0x56d3b2[_0x2081ac(0x247)](),{'verbose':_0x43db2f['verbose']}),_0x34fb6f=_0x22c2d6[_0x2081ac(0x20f)],_0x4d3e72=getConsoleNextUrl(_0x43db2f[_0x2081ac(0x208)],_0x2081ac(0x1ff)+_0x34fb6f['id']),_0x47c89c=_0x2256fc?_0x2081ac(0x1cf):'Updated';return console[_0x2081ac(0x25a)]('✔\x20'+_0x47c89c+_0x2081ac(0x2e3)+_0x34fb6f['name']+'\x27'),console[_0x2081ac(0x25a)]('\x20\x20'+_0x4d3e72),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x1f2);[a29_0x367de6(0x2da)]='Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics';async['execute'](_0x23648d){const _0x517b24=a29_0x367de6,{options:_0x5a4fd6,args:_0x3943ed,tdx:_0x151307}=_0x23648d,_0x2ddf53=_0x5a4fd6,_0x5de2b9=_0x3943ed[0x0]||_0x5a4fd6[_0x517b24(0x1f9)];if(!_0x5de2b9)return showParentSegmentNotSetError(_0x517b24(0x240)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a'+_0x517b24(0x24e)+_0x517b24(0x1f0)+_0x517b24(0x23f)+_0x517b24(0x242)),0x1;const _0x2f9441=resolveYamlFile(_0x5de2b9);if(!existsSync(_0x2f9441))return showFileNotFoundError(_0x2f9441,_0x5de2b9),0x1;_0x2ddf53[_0x517b24(0x289)]&&(console[_0x517b24(0x25a)](_0x517b24(0x2a2)+_0x2ddf53[_0x517b24(0x208)]),console[_0x517b24(0x25a)]('YAML\x20file:\x20'+_0x2f9441));let _0x3206b0;try{_0x3206b0=readFileSync(_0x2f9441,_0x517b24(0x25f));}catch(_0x41aea0){const _0x15ce8f=_0x41aea0 instanceof Error?_0x41aea0['message']:String(_0x41aea0);return console['error'](_0x517b24(0x21b)+_0x15ce8f),0x1;}const _0x43e5c0=createCommandSpinner(a29_0x454280[_0x517b24(0x1ce)](_0x517b24(0x224)),{'verbose':_0x2ddf53['verbose']});_0x43e5c0['start']();const _0x3c7786={'onProgress':_0x4f9be6=>{const _0x4bfd6e=_0x517b24;_0x43e5c0[_0x4bfd6e(0x26d)]=formatProgressMessage(_0x4f9be6);}};if(_0x2ddf53[_0x517b24(0x2bc)])_0x3c7786[_0x517b24(0x2bc)]=!![];if(_0x2ddf53[_0x517b24(0x2e9)])_0x3c7786['enriched']=!![];_0x2ddf53[_0x517b24(0x246)]&&(_0x3c7786['attribute']=_0x2ddf53[_0x517b24(0x246)]);_0x2ddf53['behavior']&&(_0x3c7786['behavior']=_0x2ddf53[_0x517b24(0x293)]);if(_0x2ddf53[_0x517b24(0x1ef)])_0x3c7786[_0x517b24(0x1ef)]=_0x2ddf53[_0x517b24(0x1ef)];let _0x350c60;try{_0x350c60=await _0x151307['segment'][_0x517b24(0x1f7)](_0x3206b0,_0x3c7786),_0x43e5c0['stop']();}catch(_0x275b6d){_0x43e5c0[_0x517b24(0x1e9)]();throw _0x275b6d;}const _0x4c2c76=_0x2ddf53['interval']||_0x517b24(0x1f3);return this['displayValidateResults'](_0x350c60,_0x3c7786,_0x2f9441,_0x4c2c76),_0x350c60[_0x517b24(0x2cf)]?0x0:0x1;}[a29_0x367de6(0x2b3)](_0x4c428f,_0x36cc2a,_0x421fc4,_0x458b6b){const _0x29b8bc=a29_0x367de6;console['error']('\x0a'+a29_0x454280[_0x29b8bc(0x245)](_0x29b8bc(0x1ea))+'\x20'+_0x4c428f['name']),console['error']('═'[_0x29b8bc(0x2de)](0x3c)),this[_0x29b8bc(0x2b1)](_0x4c428f);if(typeof _0x36cc2a[_0x29b8bc(0x246)]==='string'){this[_0x29b8bc(0x2a1)](_0x4c428f),this['displaySummary'](_0x4c428f),this[_0x29b8bc(0x1d3)](_0x421fc4,_0x458b6b,_0x29b8bc(0x246),_0x36cc2a[_0x29b8bc(0x246)]);return;}if(_0x36cc2a[_0x29b8bc(0x246)]===!![]){this[_0x29b8bc(0x2a1)](_0x4c428f),this['displaySummary'](_0x4c428f),this[_0x29b8bc(0x1d3)](_0x421fc4,_0x458b6b,'attributes');return;}if(typeof _0x36cc2a[_0x29b8bc(0x293)]===_0x29b8bc(0x28c)){this[_0x29b8bc(0x299)](_0x4c428f,_0x458b6b),this[_0x29b8bc(0x1fd)](_0x4c428f),this['displayPreviewHints'](_0x421fc4,_0x458b6b,_0x29b8bc(0x293),_0x36cc2a['behavior']);return;}if(_0x36cc2a[_0x29b8bc(0x293)]===!![]){this[_0x29b8bc(0x299)](_0x4c428f,_0x458b6b),this['displaySummary'](_0x4c428f),this['displayPreviewHints'](_0x421fc4,_0x458b6b,_0x29b8bc(0x2ad));return;}this['displayAttributesStats'](_0x4c428f),this['displayBehaviorsStats'](_0x4c428f,_0x458b6b),this[_0x29b8bc(0x1fd)](_0x4c428f),this[_0x29b8bc(0x1d3)](_0x421fc4,_0x458b6b,_0x29b8bc(0x2b5));}[a29_0x367de6(0x1d3)](_0x2fd187,_0x4bea79,_0x47dbf6,_0x29538a){const _0x45c4e1=a29_0x367de6;console[_0x45c4e1(0x25a)]('\x0a'+a29_0x454280['dim']('To\x20view\x20sample\x20data:'));const _0x46923d=_0x4bea79!==_0x45c4e1(0x1f3)?_0x45c4e1(0x291)+_0x4bea79:'';if(_0x47dbf6==='attribute'&&_0x29538a)console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280['dim'](_0x45c4e1(0x274)+_0x2fd187+'\x20--attribute\x20\x22'+_0x29538a+'\x22'+_0x46923d));else{if(_0x47dbf6===_0x45c4e1(0x293)&&_0x29538a)console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280[_0x45c4e1(0x1ce)](_0x45c4e1(0x274)+_0x2fd187+_0x45c4e1(0x1e6)+_0x29538a+'\x22'+_0x46923d));else(_0x47dbf6===_0x45c4e1(0x22d)||_0x47dbf6==='all')&&console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280[_0x45c4e1(0x1ce)]('tdx\x20segment\x20parent\x20preview\x20'+_0x2fd187+_0x45c4e1(0x1fa)+_0x46923d));}(_0x47dbf6===_0x45c4e1(0x2ad)||_0x47dbf6===_0x45c4e1(0x2b5))&&console['error']('\x20\x20'+a29_0x454280['dim'](_0x45c4e1(0x274)+_0x2fd187+_0x45c4e1(0x216)+_0x46923d)),_0x47dbf6===_0x45c4e1(0x2b5)&&console[_0x45c4e1(0x25a)]('\x20\x20'+a29_0x454280['dim'](_0x45c4e1(0x274)+_0x2fd187+_0x45c4e1(0x2c6)+_0x46923d));}[a29_0x367de6(0x2b1)](_0x280b69){const _0x6fdaf6=a29_0x367de6,{master:_0x25f3c9}=_0x280b69,_0x240777=_0x25f3c9[_0x6fdaf6(0x232)]?a29_0x454280[_0x6fdaf6(0x297)]('✔'):a29_0x454280[_0x6fdaf6(0x282)]('✘');console[_0x6fdaf6(0x25a)]('\x0a'+a29_0x454280[_0x6fdaf6(0x1ce)]('Master\x20Table')),console[_0x6fdaf6(0x25a)](_0x240777+'\x20'+a29_0x454280[_0x6fdaf6(0x245)](_0x25f3c9[_0x6fdaf6(0x26c)]+'.'+_0x25f3c9[_0x6fdaf6(0x2b9)])),_0x25f3c9['schemaValid']?_0x25f3c9[_0x6fdaf6(0x2cd)]!==undefined&&console['error']('\x20\x20'+a29_0x454280['dim'](_0x6fdaf6(0x1e4))+'\x20'+a29_0x454280[_0x6fdaf6(0x24d)](formatRows(_0x25f3c9[_0x6fdaf6(0x2cd)]))):console[_0x6fdaf6(0x25a)]('\x20\x20'+a29_0x454280[_0x6fdaf6(0x282)]('Error:')+'\x20'+_0x25f3c9[_0x6fdaf6(0x2ec)]);}[a29_0x367de6(0x2a1)](_0x35a044){const _0x56db89=a29_0x367de6;if(_0x35a044['attributes'][_0x56db89(0x292)]===0x0)return;console[_0x56db89(0x25a)]('\x0a'+a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x273)));for(const _0x140bbc of _0x35a044[_0x56db89(0x22d)]){const _0x29e85b=_0x140bbc[_0x56db89(0x232)]?a29_0x454280[_0x56db89(0x297)]('✔'):a29_0x454280['red']('✘');let _0x43c67e='';if(_0x140bbc[_0x56db89(0x232)]&&_0x140bbc['matchedCount']!==undefined&&_0x140bbc['coveragePercent']!==undefined){const _0x57379b=_0x140bbc[_0x56db89(0x1e2)]['toFixed'](0x1),_0x188fb8=_0x140bbc[_0x56db89(0x1e2)]>=0x50?a29_0x454280['green']:_0x140bbc[_0x56db89(0x1e2)]>=0x32?a29_0x454280[_0x56db89(0x260)]:a29_0x454280[_0x56db89(0x282)];_0x43c67e='\x20'+a29_0x454280[_0x56db89(0x1ce)]('Coverage:')+'\x20'+_0x188fb8(_0x57379b+'%')+'\x20('+formatRows(_0x140bbc[_0x56db89(0x2e0)])+_0x56db89(0x222);}console[_0x56db89(0x25a)](_0x29e85b+'\x20'+a29_0x454280[_0x56db89(0x245)](_0x140bbc[_0x56db89(0x238)])+_0x43c67e),console[_0x56db89(0x25a)]('\x20\x20'+a29_0x454280[_0x56db89(0x1ce)]('Source:')+'\x20'+a29_0x454280['bold'](_0x140bbc[_0x56db89(0x26c)]+'.'+_0x140bbc[_0x56db89(0x2b9)]));const _0x1dbd57=_0x140bbc[_0x56db89(0x2aa)]===_0x140bbc[_0x56db89(0x250)]?a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x2ae))+'\x20'+_0x140bbc[_0x56db89(0x2aa)]:a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x28e))+'\x20'+_0x140bbc[_0x56db89(0x2aa)]+_0x56db89(0x21e)+_0x140bbc[_0x56db89(0x250)];console['error']('\x20\x20'+_0x1dbd57),console['error']('\x20\x20'+a29_0x454280[_0x56db89(0x1ce)](_0x56db89(0x262))),this[_0x56db89(0x27c)](_0x140bbc[_0x56db89(0x1f4)]),!_0x140bbc[_0x56db89(0x232)]&&console['error']('\x20\x20'+a29_0x454280[_0x56db89(0x282)]('Error:')+'\x20'+_0x140bbc[_0x56db89(0x2ec)]);}}[a29_0x367de6(0x299)](_0x4859f4,_0x333efd){const _0x581163=a29_0x367de6;if(_0x4859f4[_0x581163(0x2ad)][_0x581163(0x292)]===0x0)return;console['error']('\x0a'+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x2c5))+'\x20'+a29_0x454280[_0x581163(0x1ce)]('('+_0x333efd+')'));for(const _0x2d2313 of _0x4859f4[_0x581163(0x2ad)]){const _0x470386=_0x2d2313[_0x581163(0x232)]?a29_0x454280['green']('✔'):a29_0x454280['red']('✘');let _0x4d956d='';if(_0x2d2313[_0x581163(0x232)]&&_0x2d2313['customersWithEvents']!==undefined&&_0x2d2313[_0x581163(0x231)]!==undefined){const _0xa4b1ba=_0x2d2313[_0x581163(0x2c1)]?.[_0x581163(0x275)](0x1)||'?',_0x4256ca=(_0x2d2313[_0x581163(0x2c1)]??0x0)>=0x32?a29_0x454280[_0x581163(0x297)]:(_0x2d2313[_0x581163(0x2c1)]??0x0)>=0x14?a29_0x454280['yellow']:a29_0x454280[_0x581163(0x282)];_0x4d956d='\x20'+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x280))+'\x20'+_0x4256ca(formatRows(_0x2d2313[_0x581163(0x22e)]))+'\x20('+_0xa4b1ba+_0x581163(0x2bd)+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x28a))+'\x20'+a29_0x454280[_0x581163(0x24d)](formatRows(_0x2d2313['totalEvents']));}console['error'](_0x470386+'\x20'+a29_0x454280[_0x581163(0x245)](_0x2d2313[_0x581163(0x238)])+_0x4d956d),console[_0x581163(0x25a)]('\x20\x20'+a29_0x454280[_0x581163(0x1ce)](_0x581163(0x23b))+'\x20'+a29_0x454280[_0x581163(0x245)](_0x2d2313[_0x581163(0x26c)]+'.'+_0x2d2313['table']));const _0x567b64=_0x2d2313[_0x581163(0x2aa)]===_0x2d2313['foreignKey']?a29_0x454280[_0x581163(0x1ce)](_0x581163(0x2ae))+'\x20'+_0x2d2313['joinKey']:a29_0x454280[_0x581163(0x1ce)](_0x581163(0x28e))+'\x20'+_0x2d2313[_0x581163(0x2aa)]+'\x20=\x20'+_0x2d2313[_0x581163(0x250)];console[_0x581163(0x25a)]('\x20\x20'+_0x567b64),console[_0x581163(0x25a)]('\x20\x20'+a29_0x454280[_0x581163(0x1ce)]('Columns:')),this[_0x581163(0x27c)](_0x2d2313['columns']),!_0x2d2313[_0x581163(0x232)]&&console[_0x581163(0x25a)]('\x20\x20'+a29_0x454280[_0x581163(0x282)](_0x581163(0x223))+'\x20'+_0x2d2313['schemaError']);}}[a29_0x367de6(0x27c)](_0x5032f7){const _0x418b3c=a29_0x367de6;for(const _0x8ae6a of _0x5032f7){_0x8ae6a['label']===_0x8ae6a[_0x418b3c(0x2c9)]||_0x8ae6a[_0x418b3c(0x2c9)]==='*'?console[_0x418b3c(0x25a)](_0x418b3c(0x1d5)+_0x8ae6a[_0x418b3c(0x233)]):console['error']('\x20\x20\x20\x20-\x20'+_0x8ae6a[_0x418b3c(0x233)]+'\x20'+a29_0x454280[_0x418b3c(0x1ce)]('('+_0x8ae6a['column']+')'));}}['displaySummary'](_0x2aed15){const _0x4bb93e=a29_0x367de6;console[_0x4bb93e(0x25a)]('─'[_0x4bb93e(0x2de)](0x3c));if(_0x2aed15['errors']['length']>0x0){console[_0x4bb93e(0x25a)]('\x0a'+a29_0x454280[_0x4bb93e(0x282)](_0x4bb93e(0x1d7)));for(const _0xe773df of _0x2aed15[_0x4bb93e(0x29b)]){console['error']('\x20\x20'+a29_0x454280[_0x4bb93e(0x282)]('•')+'\x20'+_0xe773df);}}_0x2aed15[_0x4bb93e(0x2cf)]&&console[_0x4bb93e(0x25a)]('\x0a'+a29_0x454280[_0x4bb93e(0x297)]('✔')+'\x20Configuration\x20is\x20valid');}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x25c);[a29_0x367de6(0x2da)]=a29_0x367de6(0x283);async[a29_0x367de6(0x271)](_0x54113a){const _0x1ddd85=a29_0x367de6,{options:_0x27edfb,args:_0x47d8dc,tdx:_0x213423}=_0x54113a,_0x47e210=_0x27edfb,_0x5a45a0=_0x47d8dc[0x0]||_0x27edfb[_0x1ddd85(0x1f9)];if(!_0x5a45a0)return showParentSegmentNotSetError(_0x1ddd85(0x1e3)+_0x1ddd85(0x239)+'Options\x20(one\x20required):\x0a'+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x1ddd85(0x203)+_0x1ddd85(0x1ee)+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x1ddd85(0x242)),0x1;if(!_0x47e210[_0x1ddd85(0x2bc)]&&!_0x47e210[_0x1ddd85(0x246)]&&!_0x47e210[_0x1ddd85(0x293)]&&!_0x47e210[_0x1ddd85(0x2e9)])return console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x209))),console[_0x1ddd85(0x25a)](_0x1ddd85(0x2c4)),console[_0x1ddd85(0x25a)](_0x1ddd85(0x2b7)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console[_0x1ddd85(0x25a)](_0x1ddd85(0x211)),console[_0x1ddd85(0x25a)](_0x1ddd85(0x296)),console[_0x1ddd85(0x25a)](_0x1ddd85(0x294)),0x1;const _0x286ab2=resolveYamlFile(_0x5a45a0);if(!existsSync(_0x286ab2))return showFileNotFoundError(_0x286ab2,_0x5a45a0),0x1;_0x47e210[_0x1ddd85(0x289)]&&(console[_0x1ddd85(0x25a)](_0x1ddd85(0x2a2)+_0x47e210[_0x1ddd85(0x208)]),console[_0x1ddd85(0x25a)]('YAML\x20file:\x20'+_0x286ab2));let _0x41f09a;try{_0x41f09a=readFileSync(_0x286ab2,_0x1ddd85(0x25f));}catch(_0x1676cd){const _0x38a59a=_0x1676cd instanceof Error?_0x1676cd[_0x1ddd85(0x1cd)]:String(_0x1676cd);return console['error']('Error\x20reading\x20file:\x20'+_0x38a59a),0x1;}let _0x591780;try{_0x591780=parseYamlString(_0x41f09a);}catch(_0x439848){const _0x2d2dad=_0x439848 instanceof Error?_0x439848[_0x1ddd85(0x1cd)]:String(_0x439848);return console[_0x1ddd85(0x25a)](a29_0x454280['red'](_0x1ddd85(0x2e2)+_0x2d2dad)),0x1;}if(_0x47e210[_0x1ddd85(0x246)]===!![]||_0x47e210[_0x1ddd85(0x246)]===''){const _0x35de20=_0x591780[_0x1ddd85(0x22d)]?.[_0x1ddd85(0x236)](_0x22b462=>_0x22b462[_0x1ddd85(0x238)])||[];if(_0x35de20[_0x1ddd85(0x292)]===0x0)console['error'](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x1d2)));else{console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x2d6))),console[_0x1ddd85(0x25a)]('Available\x20attributes:');for(const _0x275ddd of _0x35de20){console[_0x1ddd85(0x25a)]('\x20\x20'+a29_0x454280[_0x1ddd85(0x24d)](_0x275ddd));}console[_0x1ddd85(0x25a)](_0x1ddd85(0x2e5)+_0x5a45a0+'\x20--attribute\x20\x22'+_0x35de20[0x0]+'\x22');}return 0x1;}if(_0x47e210[_0x1ddd85(0x293)]===!![]||_0x47e210[_0x1ddd85(0x293)]===''){const _0x5b30d4=_0x591780['behaviors']?.[_0x1ddd85(0x236)](_0x481a44=>_0x481a44[_0x1ddd85(0x238)])||[];if(_0x5b30d4[_0x1ddd85(0x292)]===0x0)console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x1d9)));else{console[_0x1ddd85(0x25a)](a29_0x454280[_0x1ddd85(0x282)](_0x1ddd85(0x21a))),console['error']('Available\x20behaviors:');for(const _0x2636e8 of _0x5b30d4){console[_0x1ddd85(0x25a)]('\x20\x20'+a29_0x454280['cyan'](_0x2636e8));}console[_0x1ddd85(0x25a)](_0x1ddd85(0x2e5)+_0x5a45a0+_0x1ddd85(0x1e6)+_0x5b30d4[0x0]+'\x22');}return 0x1;}const _0xd31eb9=createCommandSpinner(a29_0x454280[_0x1ddd85(0x1ce)](_0x1ddd85(0x2b6)),{'verbose':_0x47e210[_0x1ddd85(0x289)]});_0xd31eb9['start']();const _0x184d15={'onProgress':_0xaef133=>{const _0x67d70c=_0x1ddd85;_0xd31eb9[_0x67d70c(0x26d)]=formatProgressMessage(_0xaef133);}};if(_0x47e210[_0x1ddd85(0x2bc)])_0x184d15[_0x1ddd85(0x2bc)]=!![];if(_0x47e210[_0x1ddd85(0x246)]&&typeof _0x47e210[_0x1ddd85(0x246)]==='string')_0x184d15[_0x1ddd85(0x246)]=_0x47e210[_0x1ddd85(0x246)];if(_0x47e210['behavior']&&typeof _0x47e210['behavior']===_0x1ddd85(0x28c))_0x184d15[_0x1ddd85(0x293)]=_0x47e210['behavior'];if(_0x47e210[_0x1ddd85(0x2e9)])_0x184d15['enriched']=!![];if(_0x47e210[_0x1ddd85(0x1ef)])_0x184d15['interval']=_0x47e210[_0x1ddd85(0x1ef)];let _0x2cd29e;try{_0x2cd29e=await _0x213423[_0x1ddd85(0x2c8)]['previewParentYaml'](_0x41f09a,_0x184d15),_0xd31eb9['stop']();}catch(_0x594dec){_0xd31eb9[_0x1ddd85(0x1e9)]();throw _0x594dec;}return await this[_0x1ddd85(0x254)](_0x2cd29e,{'master':_0x47e210['master'],'attribute':typeof _0x47e210[_0x1ddd85(0x246)]===_0x1ddd85(0x28c)?_0x47e210[_0x1ddd85(0x246)]:undefined,'behavior':typeof _0x47e210[_0x1ddd85(0x293)]==='string'?_0x47e210[_0x1ddd85(0x293)]:undefined,'enriched':_0x47e210[_0x1ddd85(0x2e9)]}),_0x2cd29e[_0x1ddd85(0x2cf)]?0x0:0x1;}async[a29_0x367de6(0x254)](_0x5d1272,_0x26d6ff){const _0x2b0b87=a29_0x367de6;console[_0x2b0b87(0x25a)]('\x0a'+a29_0x454280['bold'](_0x2b0b87(0x252))+'\x20'+_0x5d1272[_0x2b0b87(0x238)]),console['error']('═'['repeat'](0x3c));if(_0x26d6ff[_0x2b0b87(0x2bc)]&&_0x5d1272['sampleData']){const _0x5bf4f=a29_0x454280['dim']('Master:')+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x5d1272[_0x2b0b87(0x2bc)][_0x2b0b87(0x26c)]+'.'+_0x5d1272['master'][_0x2b0b87(0x2b9)]);await this[_0x2b0b87(0x218)](_0x5bf4f,_0x5d1272['sampleData']);}else{if(_0x26d6ff[_0x2b0b87(0x246)]&&_0x5d1272[_0x2b0b87(0x1f8)]){const _0x1bfc8d=a29_0x454280[_0x2b0b87(0x1ce)](_0x2b0b87(0x2a3))+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x26d6ff[_0x2b0b87(0x246)]);await this[_0x2b0b87(0x218)](_0x1bfc8d,_0x5d1272[_0x2b0b87(0x1f8)]);}else{if(_0x26d6ff[_0x2b0b87(0x293)]&&_0x5d1272[_0x2b0b87(0x1f8)]){const _0x275b17=a29_0x454280[_0x2b0b87(0x1ce)](_0x2b0b87(0x2e7))+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x26d6ff[_0x2b0b87(0x293)]);await this['displaySampleData'](_0x275b17,_0x5d1272[_0x2b0b87(0x1f8)]);}else{if(_0x26d6ff[_0x2b0b87(0x2e9)]&&_0x5d1272[_0x2b0b87(0x1f8)]){const _0x5b564a=a29_0x454280[_0x2b0b87(0x1ce)](_0x2b0b87(0x295))+'\x20'+a29_0x454280[_0x2b0b87(0x245)](_0x2b0b87(0x1cb));await this[_0x2b0b87(0x218)](_0x5b564a,_0x5d1272[_0x2b0b87(0x1f8)]);}else!_0x5d1272[_0x2b0b87(0x1f8)]&&console[_0x2b0b87(0x25a)]('\x0aNo\x20sample\x20data\x20available');}}}if(_0x5d1272[_0x2b0b87(0x29b)][_0x2b0b87(0x292)]>0x0){console[_0x2b0b87(0x25a)]('─'[_0x2b0b87(0x2de)](0x3c)),console[_0x2b0b87(0x25a)]('\x0a'+a29_0x454280[_0x2b0b87(0x282)](_0x2b0b87(0x1d7)));for(const _0x43db05 of _0x5d1272['errors']){console[_0x2b0b87(0x25a)]('\x20\x20'+a29_0x454280[_0x2b0b87(0x282)]('•')+'\x20'+_0x43db05);}}}async[a29_0x367de6(0x218)](_0x3a4241,_0x4d6b96){const _0x20ab14=a29_0x367de6;if(_0x4d6b96[_0x20ab14(0x292)]===0x0){console[_0x20ab14(0x25a)]('\x0a'+_0x3a4241),console[_0x20ab14(0x25a)](_0x20ab14(0x281));return;}console[_0x20ab14(0x25a)]('\x0a'+_0x3a4241);const _0x5ca5a4=Object['keys'](_0x4d6b96[0x0])[_0x20ab14(0x236)](_0x50308f=>({'name':_0x50308f,'type':typeof _0x4d6b96[0x0][_0x50308f]==='number'?_0x20ab14(0x1ec):_0x20ab14(0x286)})),_0x4091f3={'queryId':_0x20ab14(0x227),'columns':_0x5ca5a4,'data':_0x4d6b96,'stats':{'state':_0x20ab14(0x1ed),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x4d6b96[_0x20ab14(0x292)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x31f301=formatAsTable(_0x4091f3,_0x4d6b96[_0x20ab14(0x292)],!![]);await writeOutput(_0x31f301,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a29_0x367de6(0x230);[a29_0x367de6(0x2da)]=a29_0x367de6(0x2a6);async[a29_0x367de6(0x271)](_0x34ed95){const _0x310db8=a29_0x367de6,{options:_0x19f8ed,args:_0x25e149,tdx:_0x2d2d62}=_0x34ed95,_0x2413fa=_0x19f8ed,_0x487adc=_0x25e149[0x0]||_0x19f8ed['parentSegment'];if(!_0x487adc)return showParentSegmentNotSetError(_0x310db8(0x2dd)+_0x310db8(0x1e7)),0x1;const _0x1256c2=resolveYamlFile(_0x487adc);if(existsSync(_0x1256c2)){_0x2413fa['verbose']&&console['error']('Found\x20YAML\x20file:\x20'+_0x1256c2);let _0x131a94;try{_0x131a94=readFileSync(_0x1256c2,_0x310db8(0x25f));}catch(_0x5450ae){const _0x203dbd=_0x5450ae instanceof Error?_0x5450ae[_0x310db8(0x1cd)]:String(_0x5450ae);return console[_0x310db8(0x25a)](_0x310db8(0x21b)+_0x203dbd),0x1;}const _0x13499c=await withSpinner(_0x310db8(0x26b),()=>_0x2d2d62['segment'][_0x310db8(0x1d4)](_0x131a94),{'verbose':_0x2413fa[_0x310db8(0x289)]}),_0x26900f=_0x13499c[_0x310db8(0x20f)],{isNew:_0x57a733,name:_0x3bc031,hasChanges:_0x1e9900,diffFormatted:_0x3ae6c8}=_0x26900f;if(_0x1e9900){_0x57a733?console[_0x310db8(0x25a)](_0x310db8(0x278)+_0x3bc031+'\x27:'):console[_0x310db8(0x25a)](_0x310db8(0x1fe)+_0x3bc031+'\x27:');console[_0x310db8(0x25a)]('─'[_0x310db8(0x2de)](0x3c)),console['error'](_0x3ae6c8),console['error']('─'[_0x310db8(0x2de)](0x3c));const _0x19aaa2=_0x57a733?'Create\x20parent\x20segment\x20\x27'+_0x3bc031+'\x27\x20and\x20run\x20workflow?':'Apply\x20changes\x20to\x20\x27'+_0x3bc031+_0x310db8(0x2e6);if(!_0x2413fa[_0x310db8(0x1df)]){const _0x522aaa=await confirmKey(_0x19aaa2);if(!_0x522aaa)return console[_0x310db8(0x25a)](_0x310db8(0x25e)),0x1;}const _0x3e542a=_0x57a733?'Creating':_0x310db8(0x2ca);await withSpinner(_0x3e542a+'\x20parent\x20segment\x20\x27'+_0x3bc031+_0x310db8(0x284),()=>_0x26900f['apply'](),{'verbose':_0x2413fa[_0x310db8(0x289)]});const _0x1c2d95=_0x57a733?_0x310db8(0x1cf):_0x310db8(0x200);console[_0x310db8(0x25a)]('✔\x20'+_0x1c2d95+_0x310db8(0x2e3)+_0x3bc031+'\x27');}else console[_0x310db8(0x25a)]('✔\x20No\x20changes\x20-\x20\x27'+_0x3bc031+_0x310db8(0x2b8));}const _0x1a5a9e=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x487adc+_0x310db8(0x284),()=>_0x2d2d62[_0x310db8(0x2c8)][_0x310db8(0x26f)](_0x487adc),{'verbose':_0x2413fa[_0x310db8(0x289)]}),_0x2bf4d0=_0x1a5a9e['data'],_0x5af76c=getConsoleUrl(_0x2413fa['site'],'/app/workflows/'+_0x2bf4d0[_0x310db8(0x263)]+'/sessions/'+_0x2bf4d0['workflowSessionId']+_0x310db8(0x219)+_0x2bf4d0[_0x310db8(0x1d0)]);return console[_0x310db8(0x25a)]('\x0a✔\x20Workflow\x20started'),console['error']('\x20\x20'+a29_0x454280['dim'](_0x310db8(0x28f))+'\x20'+_0x2bf4d0[_0x310db8(0x2a8)]),console[_0x310db8(0x25a)]('\x20\x20'+a29_0x454280[_0x310db8(0x1ce)](_0x310db8(0x2d5))+'\x20'+_0x2bf4d0[_0x310db8(0x221)]),console[_0x310db8(0x25a)]('\x20\x20'+a29_0x454280['dim'](_0x310db8(0x2ce))+'\x20'+_0x2bf4d0[_0x310db8(0x23c)]),console[_0x310db8(0x25a)]('\x20\x20'+a29_0x454280[_0x310db8(0x1ce)](_0x310db8(0x204))+'\x20'+_0x2bf4d0['workflowAttemptId']),console['error']('\x20\x20'+_0x5af76c),console['error']('\x0a'+a29_0x454280[_0x310db8(0x1ce)](_0x310db8(0x1dd))+'\x20tdx\x20wf\x20attempt\x20'+_0x2bf4d0[_0x310db8(0x1d0)]+'\x20kill'),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x27f);['description']=a29_0x367de6(0x276);async[a29_0x367de6(0x271)](_0x9bb77f){const _0x106bac=a29_0x367de6,{options:_0x29b628,args:_0x172ea2,tdx:_0x1aad51}=_0x9bb77f,_0x1c893f=_0x172ea2[0x0]||_0x29b628[_0x106bac(0x1f9)];if(!_0x1c893f)return showParentSegmentNotSetError(_0x106bac(0x2d1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment'),0x1;_0x29b628['verbose']&&(console[_0x106bac(0x25a)](_0x106bac(0x2a2)+_0x29b628[_0x106bac(0x208)]),console[_0x106bac(0x25a)]('Parent\x20segment:\x20'+_0x1c893f));const _0xc66827=await withSpinner(_0x106bac(0x20c)+_0x1c893f+_0x106bac(0x284),()=>_0x1aad51[_0x106bac(0x2c8)]['listFields'](_0x1c893f),{'verbose':_0x29b628[_0x106bac(0x289)]}),_0x3621eb=_0xc66827['data'];console['error'](_0x106bac(0x215)+_0x3621eb[_0x106bac(0x292)]+_0x106bac(0x2d0)+(_0x3621eb[_0x106bac(0x292)]!==0x1?'s':''));if(_0x29b628[_0x106bac(0x20d)]||_0x29b628[_0x106bac(0x251)])return await handleSDKOutput(_0x3621eb,_0x29b628),0x0;return displayFieldsHumanReadable(_0x3621eb,_0x1c893f),0x0;}}function a29_0x5e17(_0x1f2980,_0x119c28){_0x1f2980=_0x1f2980-0x1cb;const _0x49f3df=a29_0x49f3();let _0x5e17ff=_0x49f3df[_0x1f2980];return _0x5e17ff;}export class ParentSegmentViewCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x217);[a29_0x367de6(0x2da)]='Show\x20parent\x20segment\x20details';async[a29_0x367de6(0x271)](_0x290cdd){const _0x11d7f0=a29_0x367de6,{options:_0x239753,args:_0x23f245,tdx:_0x16cc9a}=_0x290cdd,_0x43067c=_0x239753,_0x2b122b=_0x23f245[0x0]||_0x239753[_0x11d7f0(0x1f9)];if(!_0x2b122b)return showParentSegmentNotSetError(_0x11d7f0(0x288)+_0x11d7f0(0x25b)+'Options:\x0a'+_0x11d7f0(0x2eb)),0x1;_0x239753[_0x11d7f0(0x289)]&&(console['error'](_0x11d7f0(0x2a2)+_0x239753[_0x11d7f0(0x208)]),console[_0x11d7f0(0x25a)](_0x11d7f0(0x2a0)+_0x2b122b));const _0x9eeb2b=await withSpinner('Fetching\x20parent\x20segment\x20\x27'+_0x2b122b+_0x11d7f0(0x284),()=>_0x16cc9a[_0x11d7f0(0x2c8)][_0x11d7f0(0x214)](_0x2b122b),{'verbose':_0x239753['verbose']}),_0x4aaab2=_0x9eeb2b[_0x11d7f0(0x20f)];if(_0x43067c[_0x11d7f0(0x26a)]){const _0x5e7eb5=getConsoleNextUrl(_0x43067c[_0x11d7f0(0x208)],_0x11d7f0(0x1ff)+_0x4aaab2['id']);return console[_0x11d7f0(0x25a)](a29_0x454280[_0x11d7f0(0x297)]('✔')+_0x11d7f0(0x257)+a29_0x454280['cyan'](_0x5e7eb5)),openBrowser(_0x5e7eb5),0x0;}return await handleSingleObjectOutput(_0x4aaab2,_0x239753),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x261);[a29_0x367de6(0x2da)]=a29_0x367de6(0x213);async[a29_0x367de6(0x271)](_0x18b924){const _0x2c97ad=a29_0x367de6,{options:_0x55cee5,args:_0x569e85,tdx:_0x57cddb}=_0x18b924,_0x7cfa5=_0x569e85[0x0]||_0x55cee5[_0x2c97ad(0x1f9)];if(!_0x7cfa5)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'+_0x2c97ad(0x21d)),0x1;_0x55cee5[_0x2c97ad(0x289)]&&(console['error']('Site:\x20'+_0x55cee5[_0x2c97ad(0x208)]),console[_0x2c97ad(0x25a)]('Parent\x20segment:\x20'+_0x7cfa5));const _0x25649b=await withSpinner(_0x2c97ad(0x212)+_0x7cfa5+'\x27...',()=>_0x57cddb[_0x2c97ad(0x2c8)][_0x2c97ad(0x255)](_0x7cfa5),{'verbose':_0x55cee5[_0x2c97ad(0x289)]}),_0x2aa887=_0x25649b['data'],_0x10498f=await withSpinner(_0x2c97ad(0x234)+_0x7cfa5+_0x2c97ad(0x284),()=>_0x57cddb[_0x2c97ad(0x2c8)][_0x2c97ad(0x259)](_0x2aa887),{'verbose':_0x55cee5[_0x2c97ad(0x289)]}),_0x234118=await executeSchemaQuery(_0x10498f[_0x2c97ad(0x20f)],_0x57cddb,_0x55cee5);return await handleQueryOutput(_0x234118,_0x55cee5),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x1cc);[a29_0x367de6(0x2da)]=a29_0x367de6(0x1da);async[a29_0x367de6(0x271)](_0x321e74){const _0x272c85=a29_0x367de6,{options:_0xc8c6d,args:_0x421b11,tdx:_0x42d029}=_0x321e74,_0x50f48b=_0x421b11[0x0]||_0xc8c6d[_0x272c85(0x1f9)];if(!_0x50f48b)return showParentSegmentNotSetError(_0x272c85(0x2d2)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0xc8c6d[_0x272c85(0x289)]&&(console[_0x272c85(0x25a)](_0x272c85(0x2a2)+_0xc8c6d[_0x272c85(0x208)]),console['error']('Parent\x20segment:\x20'+_0x50f48b));const _0xb00b84=await withSpinner(_0x272c85(0x212)+_0x50f48b+'\x27...',()=>_0x42d029[_0x272c85(0x2c8)][_0x272c85(0x255)](_0x50f48b),{'verbose':_0xc8c6d['verbose']}),_0x1ad4ff=_0xb00b84['data'],_0x2541b1=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x50f48b+'\x27...',()=>_0x42d029[_0x272c85(0x2c8)][_0x272c85(0x259)](_0x1ad4ff),{'verbose':_0xc8c6d['verbose']}),_0x266f60=_0x2541b1[_0x272c85(0x20f)];return _0xc8c6d[_0x272c85(0x22f)]==='json'||_0xc8c6d[_0x272c85(0x22f)]==='jsonl'?await handleSDKOutput([{'sql':_0x266f60}],_0xc8c6d):console[_0x272c85(0x1f1)](_0x266f60),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x367de6(0x238)]=a29_0x367de6(0x2a5);[a29_0x367de6(0x2da)]=a29_0x367de6(0x1d1);async['execute'](_0x2813bf){const _0x299341=a29_0x367de6,{options:_0x20b98e,args:_0x55cdae,tdx:_0x5d1176}=_0x2813bf,_0x550c94=_0x55cdae[0x0]||_0x20b98e[_0x299341(0x1f9)];if(!_0x550c94)return showParentSegmentNotSetError(_0x299341(0x253)+_0x299341(0x21c)),0x1;_0x20b98e[_0x299341(0x289)]&&(console['error']('Site:\x20'+_0x20b98e[_0x299341(0x208)]),console[_0x299341(0x25a)](_0x299341(0x2a0)+_0x550c94));const _0x21f6c1=await withSpinner(_0x299341(0x212)+_0x550c94+'\x27...',()=>_0x5d1176[_0x299341(0x2c8)][_0x299341(0x255)](_0x550c94),{'verbose':_0x20b98e[_0x299341(0x289)]}),_0x2e3464=_0x21f6c1[_0x299341(0x20f)],_0x472454=await withSpinner(_0x299341(0x234)+_0x550c94+_0x299341(0x284),()=>_0x5d1176[_0x299341(0x2c8)][_0x299341(0x259)](_0x2e3464),{'verbose':_0x20b98e[_0x299341(0x289)]});let _0x378c05=_0x472454[_0x299341(0x20f)];const _0x351cfe=resolveLimit(_0x20b98e['limit'],DEFAULT_DISPLAY_LIMIT),_0x8bcfce=/\bLIMIT\s+\d+/i[_0x299341(0x2cb)](_0x378c05);!_0x8bcfce&&(_0x378c05=_0x378c05['trim']()[_0x299341(0x279)](/;+$/,''),_0x378c05=_0x299341(0x22a)+_0x378c05+'\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'+_0x351cfe);_0x20b98e['verbose']&&console['error'](_0x299341(0x2d8)+_0x378c05);const _0xdb2198=await withQuerySpinner(_0x299341(0x20b),async _0x497a08=>{const _0x21a171=_0x299341,_0x4a2966=await _0x5d1176[_0x21a171(0x2e4)]['execute'](_0x378c05,{'catalog':'td','schema':_0x21a171(0x22b),'onJobId':_0x38e40f=>{const _0x53b08f=_0x21a171;_0x497a08[_0x53b08f(0x27b)](_0x38e40f);}});return _0x4a2966;},{'verbose':_0x20b98e[_0x299341(0x289)]}),_0x3a5de2=_0xdb2198['data'],_0x1efd15=_0x3a5de2[_0x299341(0x29e)]?'\x20[Job\x20ID:\x20'+_0x3a5de2[_0x299341(0x29e)]+']':'';return console['error'](_0x299341(0x2ab)+_0x3a5de2[_0x299341(0x25d)][_0x299341(0x24c)][_0x299341(0x298)]()+'\x20rows\x20'+(_0x299341(0x27a)+formatElapsed(_0x3a5de2[_0x299341(0x25d)][_0x299341(0x20e)])+_0x1efd15)),await handleQueryOutput(_0x3a5de2,_0x20b98e),0x0;}}
1
+ const a29_0x1bdc06=a29_0x2a31;(function(_0x4e8968,_0x32c464){const _0x507347=a29_0x2a31,_0x64a617=_0x4e8968();while(!![]){try{const _0xcc0486=-parseInt(_0x507347(0x1ab))/0x1*(parseInt(_0x507347(0x1e9))/0x2)+-parseInt(_0x507347(0x213))/0x3+-parseInt(_0x507347(0x22c))/0x4*(-parseInt(_0x507347(0x214))/0x5)+parseInt(_0x507347(0x25f))/0x6+-parseInt(_0x507347(0x2a1))/0x7+parseInt(_0x507347(0x1e5))/0x8*(parseInt(_0x507347(0x2a7))/0x9)+-parseInt(_0x507347(0x2b7))/0xa*(parseInt(_0x507347(0x1ad))/0xb);if(_0xcc0486===_0x32c464)break;else _0x64a617['push'](_0x64a617['shift']());}catch(_0x51779a){_0x64a617['push'](_0x64a617['shift']());}}}(a29_0x52bc,0xcfdc9));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a29_0x583eca from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,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'../types/endpoints.js';import{formatRows,formatAsTable}from'../utils/formatters.js';import{parseYamlString}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import a29_0x2d2d64 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../utils/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR='parent_segments',LEGACY_PARENT_SEGMENT_DIR=a29_0x1bdc06(0x1fe);function openBrowser(_0x5011b7){const _0x5c1777=a29_0x1bdc06,_0x33bc38=process['platform'],_0x18252e=_0x33bc38===_0x5c1777(0x1db)?_0x5c1777(0x1fd):_0x33bc38===_0x5c1777(0x2c3)?_0x5c1777(0x22b):_0x5c1777(0x1d6);spawn(_0x18252e,[_0x5011b7],{'detached':!![],'stdio':_0x5c1777(0x24b)})[_0x5c1777(0x2ae)]();}function migrateLegacyDirectory(){const _0x234f80=a29_0x1bdc06;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x21cf97=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x21cf97[_0x234f80(0x1aa)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console['error'](a29_0x2d2d64[_0x234f80(0x251)](_0x234f80(0x1d5)+LEGACY_PARENT_SEGMENT_DIR+_0x234f80(0x1f0)+PARENT_SEGMENT_DIR+_0x234f80(0x25b))),console[_0x234f80(0x292)](a29_0x2d2d64['dim'](_0x234f80(0x21b)+LEGACY_PARENT_SEGMENT_DIR+_0x234f80(0x1d1))),![];console[_0x234f80(0x292)](a29_0x2d2d64['yellow']('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20→\x20'+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console['error'](a29_0x2d2d64[_0x234f80(0x1b5)](_0x234f80(0x1b6)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x563977){const _0x5d94f9=_0x563977 instanceof Error?_0x563977[_0x234f80(0x1e0)]:String(_0x563977);return console[_0x234f80(0x292)](a29_0x2d2d64[_0x234f80(0x29b)]('✘\x20Failed\x20to\x20rename\x20directory:\x20'+_0x5d94f9+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a29_0x1bdc06(0x20f)](_0xde9639){return migrateLegacyDirectory(),super['run'](_0xde9639);}}function resolveYamlFile(_0x322cdd){const _0xa6acb7=a29_0x1bdc06;if(_0x322cdd[_0xa6acb7(0x1bd)](_0xa6acb7(0x29c))||_0x322cdd[_0xa6acb7(0x1bd)](_0xa6acb7(0x272)))return _0x322cdd;return a29_0x583eca[_0xa6acb7(0x237)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x322cdd)+_0xa6acb7(0x29c));}function formatProgressMessage(_0x4ab595){const _0x2a22c3=a29_0x1bdc06,_0x249b91=_0x4ab595['match'](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x249b91){const [,_0x13a33e,_0xe3e906,_0x1217c5='']=_0x249b91;return a29_0x2d2d64['dim'](_0x13a33e+':')+'\x20'+_0xe3e906+a29_0x2d2d64[_0x2a22c3(0x2a2)](_0x1217c5);}return a29_0x2d2d64[_0x2a22c3(0x2a2)](_0x4ab595);}function a29_0x52bc(){const _0x27b9da=['isDirectory','526514TYYGeF','elapsedTimeMillis','396979QacvSD','✔\x20No\x20changes\x20-\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires','yes','\x20Configuration\x20is\x20valid','format','updateParent','green','✔\x20Renamed\x20directory\x20to\x20','all','\x27\x20and\x20run\x20workflow?','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','foreignKey','segment','map','endsWith','pushParentYaml','Coverage:','FINISHED','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','segment:parent:create','segment:parent:preview','\x20No\x20changes\x20-\x20','Fetching\x20SQL\x20for\x20\x27','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','replace','addBehaviors','sampleData','scheduleType','behavior','\x20is\x20already\x20up\x20to\x20date','Fetching\x20parent\x20segment\x20\x27','length','Updating','information_schema','/\x20directory.\x0a','attributesFile','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','column','\x0a⚠️\x20\x20Both\x20','xdg-open','✔\x20Found\x20','log','Errors:','\x20Opening\x20','darwin','matchedCount','name','`\x20to\x20download\x20the\x20configuration\x20first','\x20--behavior\x20\x22<name>\x22','message','\x0aChanges\x20to\x20apply\x20to\x20\x27','Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','repeat','cyan','8qyMkMW','toLocaleString','\x20parent\x20segment\x20\x27','Attempt:','2DfnUzn','Rows:','schemaValid','✔\x20Created\x20parent\x20segment\x20\x27','SQL\x20query:\x0a','customerGroup','Overwrite\x20\x27','/\x20and\x20','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','text','label','\x20--behavior\x20\x22','\x20--enriched','\x0aChanges\x20to\x20\x27','Master\x20Table','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','resolveParentId','totalEvents','description','open','parent_segment','Error:\x20File\x20not\x20found:\x20','toFixed','audienceId','rowCount','Creating','addBehaviorsFile','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20(requires\x20context)\x0a','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20specific\x20parent\x20segment','Customers:','Validating\x20configuration...','jobId','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','segment:parent:list','Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file','run','\x20rows)','Updating\x20parent\x20segment\x20\x27','To\x20view\x20sample\x20data:','1248816MrRzeD','20GTqAOl','database','verbose','Name:\x20','\x27...','attributes','data','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','Creating\x20parent\x20segment\x20\x27','\x20--attribute\x20\x22<name>\x22','\x0aNew\x20parent\x20segment\x20\x27','✔\x20Query\x20completed:\x20Processed\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','string','stats','/app/dw/parentSegments/','Error\x20reading\x20file:\x20','Pattern:\x20','/attempt/','Error:','Master\x20+\x20Attributes','To\x20cancel:','Error:\x20--behavior\x20requires\x20a\x20name\x0a','start','460436mBpvcO','displayValidateResults','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','utf-8','parentSegment','Error\x20parsing\x20YAML:\x20','getParentSQL','listFields','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','Attributes','join','Attribute:','Create\x20parent\x20segment\x20\x27','attribute','apply','Listing\x20parent\x20segments...','displayBehaviorsStats','execute','/{name}.yml\x0a','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','Events:','\x5c$&','tdx\x20segment\x20parent\x20preview\x20','👥\x20','segment:parent:fields','Available\x20attributes:','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','columns','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','ignore','Output\x20file:\x20','segment:parent:validate','coveragePercent','Analyzing\x20changes...','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','yellow','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','displaySampleData','getParentFull','limit','interval','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','sort','json','scheduleOption','/\x20directories\x20exist.','output','\x20Context\x20set:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20fields\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20for\x20specific\x20parent\x20segment','9027222byxUJP','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','Preview:','Audience\x20ID:','runParent','\x20field','workflowSessionId','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','enriched','Master:','preview','Session:','population','segment:parent:run','double','Site:\x20','Listing\x20parent\x20segments\x20matching\x20\x27','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Created','.yaml','Error:\x20--database\x20and\x20--table\x20are\x20required','Fetching\x20sample\x20data...','processedRows','Parent\x20segment:\x20','Resolving\x20parent\x20segment\x20\x27','displayPreviewHints','✔\x20Updated\x20parent\x20segment\x20\x27','Show\x20parent\x20segment\x20schema\x20(column\x20types)','use','segment:parent:sql','Options\x20(one\x20required):\x0a','master','jsonl','Source:','setJobId','segment:parent:update','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Available\x20behaviors:','Error:\x20Parent\x20segment\x20name\x20is\x20required','schemaError','List\x20parent\x20segments','workflowAttemptId','addAttributesFile','\x20tdx\x20wf\x20attempt\x20','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','site','allValid','/sessions/','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Error:\x20--attribute\x20requires\x20a\x20name\x0a','\x0aUsage:\x20tdx\x20ps\x20preview\x20','error','\x20=\x20','customersWithEvents','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','displayMasterInfo','dirname','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','displayPreviewResults','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','red','.yml','YAML\x20file:\x20','\x20rows\x20','customerPercent','test','7772639AVoSCf','dim','%)\x20','Options:\x0a','bold','\x20--attribute\x20\x22','12029130atPzmu','List\x20available\x20fields\x20for\x20segmentation','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','Join:','keys','segment:parent:view','unref','web','-1d','\x0aNo\x20sample\x20data\x20available','Status:','displayAttributesStats','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','Executing\x20parent\x20segment\x20query...','110YecGgC','stop','Options:','Aborted.','errors','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Listing\x20fields\x20for\x20\x27','joinKey','previewParentYaml','\x20kill','Table:\x20','Enriched:','win32','segment:parent:pull','displaySummary','timezone','Apply\x20changes\x20to\x20\x27','customerGroupFile','behaviors','table','Behavior:','Behaviors','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','Found\x20YAML\x20file:\x20'];a29_0x52bc=function(){return _0x27b9da;};return a29_0x52bc();}function showFileNotFoundError(_0x2b7e9b,_0x1a6d48){const _0x52ce34=a29_0x1bdc06;console[_0x52ce34(0x292)](a29_0x2d2d64['red'](_0x52ce34(0x1ff)+_0x2b7e9b+'\x0a')),console[_0x52ce34(0x292)](a29_0x2d2d64['cyan'](_0x52ce34(0x22e)+_0x1a6d48+_0x52ce34(0x1de)));}function showParentSegmentNotSetError(_0x9e6eaf){const _0x475608=a29_0x1bdc06;console[_0x475608(0x292)](a29_0x2d2d64[_0x475608(0x251)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x475608(0x292)](_0x9e6eaf);}export class ParentSegmentListCommand extends BaseCommand{['name']=a29_0x1bdc06(0x20d);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x287);async[a29_0x1bdc06(0x23e)](_0x5e6482){const _0x45af32=a29_0x1bdc06,{options:_0x16d6b3,args:_0x4deafd,tdx:_0x590919}=_0x5e6482,_0x177692=_0x4deafd[0x0];_0x16d6b3[_0x45af32(0x216)]&&(console[_0x45af32(0x292)]('Site:\x20'+_0x16d6b3[_0x45af32(0x28c)]),_0x177692&&console[_0x45af32(0x292)](_0x45af32(0x225)+_0x177692));const _0x58d6c5=await withSpinner(_0x177692?_0x45af32(0x26f)+_0x177692+_0x45af32(0x218):_0x45af32(0x23c),()=>_0x590919[_0x45af32(0x1bb)]['listParents'](),{'verbose':_0x16d6b3[_0x45af32(0x216)]});let _0x5f19e1=_0x58d6c5[_0x45af32(0x21a)];if(_0x177692){const _0x4c411e=_0x177692['replace'](/[.+^${}()|[\]\\]/g,_0x45af32(0x242))['replace'](/\*/g,'.*')['replace'](/\?/g,'.'),_0x425d46=new RegExp('^'+_0x4c411e+'$','i');_0x5f19e1=_0x5f19e1['filter'](_0x4a13c1=>_0x425d46[_0x45af32(0x2a0)](_0x4a13c1[_0x45af32(0x219)][_0x45af32(0x1dd)]));}_0x5f19e1[_0x45af32(0x258)]((_0x2f12f5,_0x1556a3)=>_0x2f12f5[_0x45af32(0x219)][_0x45af32(0x1dd)]['localeCompare'](_0x1556a3[_0x45af32(0x219)][_0x45af32(0x1dd)])),console[_0x45af32(0x292)](_0x45af32(0x1d7)+_0x5f19e1[_0x45af32(0x1ce)]+'\x20parent\x20segment'+(_0x5f19e1[_0x45af32(0x1ce)]!==0x1?'s':''));if(_0x16d6b3['format']===_0x45af32(0x259)||_0x16d6b3['format']===_0x45af32(0x27f))await handleSDKOutput(_0x5f19e1,_0x16d6b3);else{if(_0x5f19e1['length']===0x0)_0x177692?console[_0x45af32(0x1d8)]('No\x20parent\x20segments\x20match\x20pattern:\x20'+_0x177692):console[_0x45af32(0x1d8)]('No\x20parent\x20segments\x20found');else for(const _0xfa9692 of _0x5f19e1){const _0x28cbc4=_0xfa9692[_0x45af32(0x219)][_0x45af32(0x26b)]?a29_0x2d2d64[_0x45af32(0x2a2)]('\x20('+formatRows(_0xfa9692['attributes'][_0x45af32(0x26b)])+')'):'';console[_0x45af32(0x1d8)](_0x45af32(0x244)+_0xfa9692[_0x45af32(0x219)]['name']+_0x28cbc4);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x1c2);['description']=a29_0x1bdc06(0x1c6);async[a29_0x1bdc06(0x23e)](_0x3aaf9c){const _0x4b42d7=a29_0x1bdc06,{options:_0x338783,args:_0x4c6aaa,tdx:_0x4412ce}=_0x3aaf9c;console[_0x4b42d7(0x292)](_0x4b42d7(0x240)+_0x4b42d7(0x207)+_0x4b42d7(0x1f8));const _0x3c2376=_0x338783;if(_0x4c6aaa[_0x4b42d7(0x1ce)]===0x0)return console[_0x4b42d7(0x292)](a29_0x2d2d64[_0x4b42d7(0x29b)](_0x4b42d7(0x285))),console[_0x4b42d7(0x292)](_0x4b42d7(0x24a)),0x1;const _0x3fb39e=_0x4c6aaa[0x0];if(!_0x3c2376[_0x4b42d7(0x215)]||!_0x3c2376[_0x4b42d7(0x1a5)])return console[_0x4b42d7(0x292)](_0x4b42d7(0x273)),console[_0x4b42d7(0x292)](_0x4b42d7(0x24a)),0x1;_0x3c2376['verbose']&&(console[_0x4b42d7(0x292)](_0x4b42d7(0x26e)+_0x3c2376[_0x4b42d7(0x28c)]),console[_0x4b42d7(0x292)](_0x4b42d7(0x217)+_0x3fb39e),console['error']('Database:\x20'+_0x3c2376[_0x4b42d7(0x215)]),console[_0x4b42d7(0x292)](_0x4b42d7(0x2c1)+_0x3c2376[_0x4b42d7(0x1a5)]));const _0x267976=await loadJSONFromOptions(_0x3c2376[_0x4b42d7(0x219)],_0x3c2376[_0x4b42d7(0x1d2)]),_0x1c3058=await loadJSONFromOptions(_0x3c2376[_0x4b42d7(0x1a4)],_0x3c2376['behaviorsFile']),_0x30f502=await loadJSONFromOptions(_0x3c2376['customerGroup'],_0x3c2376[_0x4b42d7(0x1a3)]),_0x20e324={'name':_0x3fb39e,'description':_0x3c2376['description'],'scheduleType':_0x3c2376['scheduleType'],'scheduleOption':_0x3c2376[_0x4b42d7(0x25a)],'timezone':_0x3c2376['timezone'],'master':{'parentDatabaseName':_0x3c2376['database'],'parentTableName':_0x3c2376['table']},'attributes':_0x267976,'behaviors':_0x1c3058,'customerGroup':_0x30f502},_0x3c4198=await withSpinner(_0x4b42d7(0x21c)+_0x3fb39e+_0x4b42d7(0x218),()=>_0x4412ce[_0x4b42d7(0x1bb)]['createParent'](_0x20e324),{'verbose':_0x338783[_0x4b42d7(0x216)]}),_0x5da1b7=_0x3c4198[_0x4b42d7(0x21a)];return console['error'](_0x4b42d7(0x1ec)+_0x5da1b7[_0x4b42d7(0x1dd)]+'\x27\x20with\x20ID:\x20'+_0x5da1b7['id']),await handleSDKOutput([_0x5da1b7],_0x338783),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x282);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x266);async['execute'](_0x19d9cf){const _0x4e0cf7=a29_0x1bdc06,{options:_0x37c281,args:_0x1b405f,tdx:_0x1c0d28}=_0x19d9cf;console[_0x4e0cf7(0x292)](_0x4e0cf7(0x260)+_0x4e0cf7(0x207)+_0x4e0cf7(0x1f8));const _0x329e0e=_0x37c281;if(_0x1b405f['length']===0x0)return console[_0x4e0cf7(0x292)](a29_0x2d2d64[_0x4e0cf7(0x29b)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x4e0cf7(0x292)](_0x4e0cf7(0x2a9)),0x1;const _0x6f4d44=_0x1b405f[0x0];_0x329e0e['verbose']&&(console[_0x4e0cf7(0x292)](_0x4e0cf7(0x26e)+_0x329e0e[_0x4e0cf7(0x28c)]),console[_0x4e0cf7(0x292)](_0x4e0cf7(0x276)+_0x6f4d44));const _0x23b4f1=await withSpinner('Fetching\x20current\x20configuration\x20for\x20\x27'+_0x6f4d44+_0x4e0cf7(0x218),()=>_0x1c0d28[_0x4e0cf7(0x1bb)][_0x4e0cf7(0x254)](_0x6f4d44),{'verbose':_0x329e0e[_0x4e0cf7(0x216)]}),_0x1a6492=_0x23b4f1['data'],_0x11a2d0=await loadJSONFromOptions(_0x329e0e['addAttributes'],_0x329e0e[_0x4e0cf7(0x289)]),_0x46beae=await loadJSONFromOptions(_0x329e0e[_0x4e0cf7(0x1c8)],_0x329e0e[_0x4e0cf7(0x204)]),_0x3a827b={'name':_0x1a6492['name'],'description':_0x329e0e[_0x4e0cf7(0x1fc)]!==undefined?_0x329e0e[_0x4e0cf7(0x1fc)]:_0x1a6492[_0x4e0cf7(0x1fc)],'scheduleType':_0x329e0e[_0x4e0cf7(0x1ca)]!==undefined?_0x329e0e[_0x4e0cf7(0x1ca)]:_0x1a6492[_0x4e0cf7(0x1ca)],'scheduleOption':_0x329e0e[_0x4e0cf7(0x25a)]!==undefined?_0x329e0e[_0x4e0cf7(0x25a)]:_0x1a6492['scheduleOption'],'timezone':_0x329e0e[_0x4e0cf7(0x2c6)]!==undefined?_0x329e0e[_0x4e0cf7(0x2c6)]:_0x1a6492['timezone'],'master':_0x1a6492[_0x4e0cf7(0x27e)],'attributes':_0x11a2d0?[..._0x1a6492[_0x4e0cf7(0x219)]||[],..._0x11a2d0]:_0x1a6492[_0x4e0cf7(0x219)],'behaviors':_0x46beae?[..._0x1a6492[_0x4e0cf7(0x1a4)]||[],..._0x46beae]:_0x1a6492[_0x4e0cf7(0x1a4)],'customerGroup':_0x1a6492[_0x4e0cf7(0x1ee)]},_0x1533da=await withSpinner(_0x4e0cf7(0x211)+_0x6f4d44+_0x4e0cf7(0x218),()=>_0x1c0d28[_0x4e0cf7(0x1bb)][_0x4e0cf7(0x1b4)](_0x6f4d44,_0x3a827b),{'verbose':_0x329e0e[_0x4e0cf7(0x216)]}),_0x2fdc84=_0x1533da[_0x4e0cf7(0x21a)];return console[_0x4e0cf7(0x292)](_0x4e0cf7(0x279)+_0x2fdc84[_0x4e0cf7(0x1dd)]+'\x27'),await handleSDKOutput([_0x2fdc84],_0x329e0e),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x2c4);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x298);async[a29_0x1bdc06(0x23e)](_0x21ba0b){const _0x4c1560=a29_0x1bdc06,{options:_0x4e5ffa,args:_0x3a0efc,tdx:_0x15c0d6}=_0x21ba0b,_0x8ca58f=_0x4e5ffa,_0x5bde5e=_0x3a0efc[0x0]||_0x4e5ffa['parentSegment'];if(!_0x5bde5e)return showParentSegmentNotSetError(_0x4c1560(0x250)+_0x4c1560(0x1af)),0x1;if(_0x8ca58f[_0x4c1560(0x27b)]&&_0x8ca58f['output'])return console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x29b)]('Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a')),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x2a2)](_0x4c1560(0x1b0))),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x2a2)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x4c1560(0x23f))),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x1e4)](_0x4c1560(0x252))),0x1;const _0xa1a564=_0x8ca58f[_0x4c1560(0x25c)]||a29_0x583eca[_0x4c1560(0x237)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5bde5e)+_0x4c1560(0x29c));_0x8ca58f[_0x4c1560(0x216)]&&(console[_0x4c1560(0x292)](_0x4c1560(0x26e)+_0x8ca58f['site']),console[_0x4c1560(0x292)]('Parent\x20segment:\x20'+_0x5bde5e),console[_0x4c1560(0x292)](_0x4c1560(0x24c)+_0xa1a564));const _0x2b7a87=await withSpinner(_0x4c1560(0x1cd)+_0x5bde5e+_0x4c1560(0x218),()=>_0x15c0d6[_0x4c1560(0x1bb)]['pullParentYaml'](_0x5bde5e),{'verbose':_0x8ca58f[_0x4c1560(0x216)]}),_0x27949a=_0x2b7a87[_0x4c1560(0x21a)];if(existsSync(_0xa1a564)){const _0x90ffde=readFileSync(_0xa1a564,_0x4c1560(0x230)),_0x17d71f=generateDiff(_0x90ffde,_0x27949a);if(!hasChanges(_0x17d71f))console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x1b5)]('✔')+_0x4c1560(0x1c4)+a29_0x2d2d64[_0x4c1560(0x1e4)](_0xa1a564)+_0x4c1560(0x1cc));else{console[_0x4c1560(0x292)](_0x4c1560(0x1f6)+_0xa1a564+'\x27:'),console['error']('─'[_0x4c1560(0x1e3)](0x3c)),console['error'](formatDiffWithColors(_0x17d71f)),console[_0x4c1560(0x292)]('─'[_0x4c1560(0x1e3)](0x3c));if(!_0x8ca58f[_0x4c1560(0x1b1)]){const _0x11012b=await confirmKey(_0x4c1560(0x1ef)+_0xa1a564+'\x27?');if(!_0x11012b)return console[_0x4c1560(0x292)](_0x4c1560(0x2ba)),0x1;}writeFileSync(_0xa1a564,_0x27949a,'utf-8'),console['error'](a29_0x2d2d64[_0x4c1560(0x1b5)]('✔')+_0x4c1560(0x257)+a29_0x2d2d64[_0x4c1560(0x1e4)](_0xa1a564));}}else{const _0x25f682=a29_0x583eca[_0x4c1560(0x297)](_0xa1a564);!existsSync(_0x25f682)&&mkdirSync(_0x25f682,{'recursive':!![]}),writeFileSync(_0xa1a564,_0x27949a,_0x4c1560(0x230)),console[_0x4c1560(0x292)](a29_0x2d2d64['green']('✔')+_0x4c1560(0x257)+a29_0x2d2d64[_0x4c1560(0x1e4)](_0xa1a564));}return saveSessionContext({'parent_segment':_0x5bde5e},_0x8ca58f['session']),console[_0x4c1560(0x292)](a29_0x2d2d64[_0x4c1560(0x1b5)]('✔')+_0x4c1560(0x25d)+a29_0x2d2d64[_0x4c1560(0x2a2)](_0x4c1560(0x1fe))+_0x4c1560(0x293)+a29_0x2d2d64['cyan'](_0x5bde5e)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a29_0x1bdc06(0x1dd)]='segment:parent:push';[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x20e);async['execute'](_0x36b7fd){const _0x2e5e8b=a29_0x1bdc06,{options:_0x5486f0,args:_0x3ad309,tdx:_0x1c13b7}=_0x36b7fd,_0x2185cc=_0x5486f0,_0xa08233=_0x3ad309[0x0]||_0x5486f0['parentSegment'];if(!_0xa08233)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a'+_0x2e5e8b(0x1b9)),0x1;const _0x315bc5=resolveYamlFile(_0xa08233);if(!existsSync(_0x315bc5))return showFileNotFoundError(_0x315bc5,_0xa08233),0x1;_0x2185cc[_0x2e5e8b(0x216)]&&(console[_0x2e5e8b(0x292)](_0x2e5e8b(0x26e)+_0x2185cc['site']),console[_0x2e5e8b(0x292)](_0x2e5e8b(0x29d)+_0x315bc5));let _0xbf2528;try{_0xbf2528=readFileSync(_0x315bc5,_0x2e5e8b(0x230));}catch(_0xbce452){const _0x2e161b=_0xbce452 instanceof Error?_0xbce452[_0x2e5e8b(0x1e0)]:String(_0xbce452);return console[_0x2e5e8b(0x292)](_0x2e5e8b(0x224)+_0x2e161b),0x1;}const _0x142148=await withSpinner(_0x2e5e8b(0x24f),()=>_0x1c13b7[_0x2e5e8b(0x1bb)][_0x2e5e8b(0x1be)](_0xbf2528),{'verbose':_0x2185cc[_0x2e5e8b(0x216)]}),_0x5e0f4e=_0x142148[_0x2e5e8b(0x21a)],{isNew:_0x2b899c,name:_0x1ff284,hasChanges:_0x1d21db,diffFormatted:_0x1adeca}=_0x5e0f4e;if(!_0x1d21db)return console[_0x2e5e8b(0x292)](_0x2e5e8b(0x1ae)+_0x1ff284+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x2b899c?console[_0x2e5e8b(0x292)](_0x2e5e8b(0x21e)+_0x1ff284+'\x27:'):console[_0x2e5e8b(0x292)]('\x0aChanges\x20to\x20apply\x20to\x20\x27'+_0x1ff284+'\x27:');console[_0x2e5e8b(0x292)]('─'['repeat'](0x3c)),console[_0x2e5e8b(0x292)](_0x1adeca),console['error']('─'[_0x2e5e8b(0x1e3)](0x3c));const _0x2950b7=_0x2b899c?'Create\x20parent\x20segment\x20\x27'+_0x1ff284+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x1ff284+'\x27?';if(!_0x2185cc['yes']){const _0x3206de=await confirmKey(_0x2950b7);if(!_0x3206de)return console[_0x2e5e8b(0x292)](_0x2e5e8b(0x2ba)),0x1;}const _0x5e4bb1=_0x2b899c?_0x2e5e8b(0x203):_0x2e5e8b(0x1cf),_0xbb68f0=await withSpinner(_0x5e4bb1+_0x2e5e8b(0x1e7)+_0x1ff284+_0x2e5e8b(0x218),()=>_0x5e0f4e[_0x2e5e8b(0x23b)](),{'verbose':_0x2185cc[_0x2e5e8b(0x216)]}),_0x5cdf35=_0xbb68f0[_0x2e5e8b(0x21a)],_0x43c123=getConsoleNextUrl(_0x2185cc['site'],'/app/dw/parentSegments/'+_0x5cdf35['id']),_0x4bff13=_0x2b899c?_0x2e5e8b(0x271):'Updated';return console['error']('✔\x20'+_0x4bff13+'\x20parent\x20segment\x20\x27'+_0x5cdf35[_0x2e5e8b(0x1dd)]+'\x27'),console['error']('\x20\x20'+_0x43c123),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{['name']=a29_0x1bdc06(0x24d);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x28b);async[a29_0x1bdc06(0x23e)](_0x5fb112){const _0x2dcf10=a29_0x1bdc06,{options:_0x74136e,args:_0x282bc7,tdx:_0x54dd8e}=_0x5fb112,_0x1f0e48=_0x74136e,_0x2dbd0c=_0x282bc7[0x0]||_0x74136e[_0x2dcf10(0x231)];if(!_0x2dbd0c)return showParentSegmentNotSetError(_0x2dcf10(0x1e2)+_0x2dcf10(0x249)+_0x2dcf10(0x2a4)+'\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a'+_0x2dcf10(0x22f)+_0x2dcf10(0x295)),0x1;const _0x8282a6=resolveYamlFile(_0x2dbd0c);if(!existsSync(_0x8282a6))return showFileNotFoundError(_0x8282a6,_0x2dbd0c),0x1;_0x1f0e48[_0x2dcf10(0x216)]&&(console['error']('Site:\x20'+_0x1f0e48[_0x2dcf10(0x28c)]),console[_0x2dcf10(0x292)](_0x2dcf10(0x29d)+_0x8282a6));let _0x480b3c;try{_0x480b3c=readFileSync(_0x8282a6,_0x2dcf10(0x230));}catch(_0xef198e){const _0x3d31e9=_0xef198e instanceof Error?_0xef198e['message']:String(_0xef198e);return console[_0x2dcf10(0x292)](_0x2dcf10(0x224)+_0x3d31e9),0x1;}const _0x556870=createCommandSpinner(a29_0x2d2d64[_0x2dcf10(0x2a2)](_0x2dcf10(0x20a)),{'verbose':_0x1f0e48[_0x2dcf10(0x216)]});_0x556870[_0x2dcf10(0x22b)]();const _0x51f12f={'onProgress':_0x26eb0e=>{_0x556870['text']=formatProgressMessage(_0x26eb0e);}};if(_0x1f0e48[_0x2dcf10(0x27e)])_0x51f12f[_0x2dcf10(0x27e)]=!![];if(_0x1f0e48[_0x2dcf10(0x267)])_0x51f12f[_0x2dcf10(0x267)]=!![];_0x1f0e48[_0x2dcf10(0x23a)]&&(_0x51f12f[_0x2dcf10(0x23a)]=_0x1f0e48[_0x2dcf10(0x23a)]);_0x1f0e48[_0x2dcf10(0x1cb)]&&(_0x51f12f[_0x2dcf10(0x1cb)]=_0x1f0e48[_0x2dcf10(0x1cb)]);if(_0x1f0e48['interval'])_0x51f12f[_0x2dcf10(0x256)]=_0x1f0e48['interval'];let _0x28a144;try{_0x28a144=await _0x54dd8e[_0x2dcf10(0x1bb)]['validateParentYaml'](_0x480b3c,_0x51f12f),_0x556870['stop']();}catch(_0x5a9861){_0x556870['stop']();throw _0x5a9861;}const _0x1a89c8=_0x1f0e48[_0x2dcf10(0x256)]||'-1d';return this[_0x2dcf10(0x22d)](_0x28a144,_0x51f12f,_0x8282a6,_0x1a89c8),_0x28a144['allValid']?0x0:0x1;}[a29_0x1bdc06(0x22d)](_0x527932,_0x56be13,_0xe463ba,_0x407fc9){const _0x40468f=a29_0x1bdc06;console[_0x40468f(0x292)]('\x0a'+a29_0x2d2d64[_0x40468f(0x2a5)]('Validate:')+'\x20'+_0x527932[_0x40468f(0x1dd)]),console[_0x40468f(0x292)]('═'[_0x40468f(0x1e3)](0x3c)),this[_0x40468f(0x296)](_0x527932);if(typeof _0x56be13[_0x40468f(0x23a)]===_0x40468f(0x221)){this['displayAttributesStats'](_0x527932),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x23a),_0x56be13['attribute']);return;}if(_0x56be13[_0x40468f(0x23a)]===!![]){this[_0x40468f(0x2b3)](_0x527932),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,'attributes');return;}if(typeof _0x56be13[_0x40468f(0x1cb)]===_0x40468f(0x221)){this['displayBehaviorsStats'](_0x527932,_0x407fc9),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x1cb),_0x56be13['behavior']);return;}if(_0x56be13[_0x40468f(0x1cb)]===!![]){this[_0x40468f(0x23d)](_0x527932,_0x407fc9),this[_0x40468f(0x2c5)](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x1a4));return;}this[_0x40468f(0x2b3)](_0x527932),this[_0x40468f(0x23d)](_0x527932,_0x407fc9),this['displaySummary'](_0x527932),this[_0x40468f(0x278)](_0xe463ba,_0x407fc9,_0x40468f(0x1b7));}['displayPreviewHints'](_0x29abbb,_0xeab634,_0x5186a4,_0x4a26af){const _0x54182d=a29_0x1bdc06;console[_0x54182d(0x292)]('\x0a'+a29_0x2d2d64['dim'](_0x54182d(0x212)));const _0x5e7126=_0xeab634!==_0x54182d(0x2b0)?'\x20--interval\x20'+_0xeab634:'';if(_0x5186a4===_0x54182d(0x23a)&&_0x4a26af)console['error']('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)](_0x54182d(0x243)+_0x29abbb+_0x54182d(0x2a6)+_0x4a26af+'\x22'+_0x5e7126));else{if(_0x5186a4===_0x54182d(0x1cb)&&_0x4a26af)console['error']('\x20\x20'+a29_0x2d2d64['dim']('tdx\x20segment\x20parent\x20preview\x20'+_0x29abbb+_0x54182d(0x1f4)+_0x4a26af+'\x22'+_0x5e7126));else(_0x5186a4==='attributes'||_0x5186a4===_0x54182d(0x1b7))&&console[_0x54182d(0x292)]('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)](_0x54182d(0x243)+_0x29abbb+_0x54182d(0x21d)+_0x5e7126));}(_0x5186a4==='behaviors'||_0x5186a4==='all')&&console['error']('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)]('tdx\x20segment\x20parent\x20preview\x20'+_0x29abbb+_0x54182d(0x1df)+_0x5e7126)),_0x5186a4===_0x54182d(0x1b7)&&console[_0x54182d(0x292)]('\x20\x20'+a29_0x2d2d64[_0x54182d(0x2a2)](_0x54182d(0x243)+_0x29abbb+_0x54182d(0x1f5)+_0x5e7126));}[a29_0x1bdc06(0x296)](_0x21d839){const _0x38a891=a29_0x1bdc06,{master:_0x496e0c}=_0x21d839,_0xa4188c=_0x496e0c['schemaValid']?a29_0x2d2d64[_0x38a891(0x1b5)]('✔'):a29_0x2d2d64[_0x38a891(0x29b)]('✘');console['error']('\x0a'+a29_0x2d2d64[_0x38a891(0x2a2)](_0x38a891(0x1f7))),console['error'](_0xa4188c+'\x20'+a29_0x2d2d64[_0x38a891(0x2a5)](_0x496e0c[_0x38a891(0x215)]+'.'+_0x496e0c['table'])),_0x496e0c[_0x38a891(0x1eb)]?_0x496e0c[_0x38a891(0x202)]!==undefined&&console[_0x38a891(0x292)]('\x20\x20'+a29_0x2d2d64[_0x38a891(0x2a2)](_0x38a891(0x1ea))+'\x20'+a29_0x2d2d64['cyan'](formatRows(_0x496e0c[_0x38a891(0x202)]))):console[_0x38a891(0x292)]('\x20\x20'+a29_0x2d2d64[_0x38a891(0x29b)](_0x38a891(0x227))+'\x20'+_0x496e0c[_0x38a891(0x286)]);}[a29_0x1bdc06(0x2b3)](_0x3aa7cb){const _0x3b159c=a29_0x1bdc06;if(_0x3aa7cb[_0x3b159c(0x219)][_0x3b159c(0x1ce)]===0x0)return;console['error']('\x0a'+a29_0x2d2d64['dim'](_0x3b159c(0x236)));for(const _0x530119 of _0x3aa7cb[_0x3b159c(0x219)]){const _0x3b7cdc=_0x530119['schemaValid']?a29_0x2d2d64['green']('✔'):a29_0x2d2d64['red']('✘');let _0x27ee3e='';if(_0x530119[_0x3b159c(0x1eb)]&&_0x530119['matchedCount']!==undefined&&_0x530119['coveragePercent']!==undefined){const _0x431b3b=_0x530119[_0x3b159c(0x24e)][_0x3b159c(0x200)](0x1),_0x5e5c3b=_0x530119['coveragePercent']>=0x50?a29_0x2d2d64['green']:_0x530119[_0x3b159c(0x24e)]>=0x32?a29_0x2d2d64[_0x3b159c(0x251)]:a29_0x2d2d64['red'];_0x27ee3e='\x20'+a29_0x2d2d64[_0x3b159c(0x2a2)](_0x3b159c(0x1bf))+'\x20'+_0x5e5c3b(_0x431b3b+'%')+'\x20('+formatRows(_0x530119[_0x3b159c(0x1dc)])+_0x3b159c(0x210);}console[_0x3b159c(0x292)](_0x3b7cdc+'\x20'+a29_0x2d2d64['bold'](_0x530119['name'])+_0x27ee3e),console['error']('\x20\x20'+a29_0x2d2d64[_0x3b159c(0x2a2)](_0x3b159c(0x280))+'\x20'+a29_0x2d2d64[_0x3b159c(0x2a5)](_0x530119[_0x3b159c(0x215)]+'.'+_0x530119[_0x3b159c(0x1a5)]));const _0x10ed0a=_0x530119[_0x3b159c(0x2be)]===_0x530119['foreignKey']?a29_0x2d2d64[_0x3b159c(0x2a2)]('Join\x20on:')+'\x20'+_0x530119['joinKey']:a29_0x2d2d64[_0x3b159c(0x2a2)](_0x3b159c(0x2ab))+'\x20'+_0x530119['joinKey']+'\x20=\x20'+_0x530119[_0x3b159c(0x1ba)];console['error']('\x20\x20'+_0x10ed0a),console[_0x3b159c(0x292)]('\x20\x20'+a29_0x2d2d64['dim']('Columns:')),this['displayColumns'](_0x530119[_0x3b159c(0x248)]),!_0x530119['schemaValid']&&console[_0x3b159c(0x292)]('\x20\x20'+a29_0x2d2d64[_0x3b159c(0x29b)](_0x3b159c(0x227))+'\x20'+_0x530119[_0x3b159c(0x286)]);}}[a29_0x1bdc06(0x23d)](_0x44aca0,_0x374462){const _0x33a338=a29_0x1bdc06;if(_0x44aca0[_0x33a338(0x1a4)][_0x33a338(0x1ce)]===0x0)return;console[_0x33a338(0x292)]('\x0a'+a29_0x2d2d64['dim'](_0x33a338(0x1a7))+'\x20'+a29_0x2d2d64[_0x33a338(0x2a2)]('('+_0x374462+')'));for(const _0x5c38eb of _0x44aca0[_0x33a338(0x1a4)]){const _0x4bb594=_0x5c38eb[_0x33a338(0x1eb)]?a29_0x2d2d64[_0x33a338(0x1b5)]('✔'):a29_0x2d2d64['red']('✘');let _0x6e6619='';if(_0x5c38eb[_0x33a338(0x1eb)]&&_0x5c38eb[_0x33a338(0x294)]!==undefined&&_0x5c38eb[_0x33a338(0x1fb)]!==undefined){const _0x2612b7=_0x5c38eb[_0x33a338(0x29f)]?.[_0x33a338(0x200)](0x1)||'?',_0x59a92a=(_0x5c38eb[_0x33a338(0x29f)]??0x0)>=0x32?a29_0x2d2d64[_0x33a338(0x1b5)]:(_0x5c38eb[_0x33a338(0x29f)]??0x0)>=0x14?a29_0x2d2d64[_0x33a338(0x251)]:a29_0x2d2d64[_0x33a338(0x29b)];_0x6e6619='\x20'+a29_0x2d2d64[_0x33a338(0x2a2)](_0x33a338(0x209))+'\x20'+_0x59a92a(formatRows(_0x5c38eb[_0x33a338(0x294)]))+'\x20('+_0x2612b7+_0x33a338(0x2a3)+a29_0x2d2d64[_0x33a338(0x2a2)](_0x33a338(0x241))+'\x20'+a29_0x2d2d64[_0x33a338(0x1e4)](formatRows(_0x5c38eb[_0x33a338(0x1fb)]));}console['error'](_0x4bb594+'\x20'+a29_0x2d2d64[_0x33a338(0x2a5)](_0x5c38eb['name'])+_0x6e6619),console[_0x33a338(0x292)]('\x20\x20'+a29_0x2d2d64[_0x33a338(0x2a2)]('Source:')+'\x20'+a29_0x2d2d64['bold'](_0x5c38eb[_0x33a338(0x215)]+'.'+_0x5c38eb[_0x33a338(0x1a5)]));const _0x4112b7=_0x5c38eb[_0x33a338(0x2be)]===_0x5c38eb[_0x33a338(0x1ba)]?a29_0x2d2d64[_0x33a338(0x2a2)]('Join\x20on:')+'\x20'+_0x5c38eb[_0x33a338(0x2be)]:a29_0x2d2d64[_0x33a338(0x2a2)](_0x33a338(0x2ab))+'\x20'+_0x5c38eb[_0x33a338(0x2be)]+_0x33a338(0x293)+_0x5c38eb['foreignKey'];console['error']('\x20\x20'+_0x4112b7),console[_0x33a338(0x292)]('\x20\x20'+a29_0x2d2d64[_0x33a338(0x2a2)]('Columns:')),this['displayColumns'](_0x5c38eb['columns']),!_0x5c38eb[_0x33a338(0x1eb)]&&console['error']('\x20\x20'+a29_0x2d2d64[_0x33a338(0x29b)](_0x33a338(0x227))+'\x20'+_0x5c38eb['schemaError']);}}['displayColumns'](_0x4aefc1){const _0x580e60=a29_0x1bdc06;for(const _0x48b962 of _0x4aefc1){_0x48b962[_0x580e60(0x1f3)]===_0x48b962[_0x580e60(0x1d4)]||_0x48b962[_0x580e60(0x1d4)]==='*'?console['error']('\x20\x20\x20\x20-\x20'+_0x48b962['label']):console[_0x580e60(0x292)]('\x20\x20\x20\x20-\x20'+_0x48b962['label']+'\x20'+a29_0x2d2d64['dim']('('+_0x48b962[_0x580e60(0x1d4)]+')'));}}[a29_0x1bdc06(0x2c5)](_0x4c1c29){const _0x3865d4=a29_0x1bdc06;console[_0x3865d4(0x292)]('─'[_0x3865d4(0x1e3)](0x3c));if(_0x4c1c29[_0x3865d4(0x2bb)][_0x3865d4(0x1ce)]>0x0){console['error']('\x0a'+a29_0x2d2d64['red'](_0x3865d4(0x1d9)));for(const _0x46f7e4 of _0x4c1c29[_0x3865d4(0x2bb)]){console[_0x3865d4(0x292)]('\x20\x20'+a29_0x2d2d64[_0x3865d4(0x29b)]('•')+'\x20'+_0x46f7e4);}}_0x4c1c29['allValid']&&console[_0x3865d4(0x292)]('\x0a'+a29_0x2d2d64['green']('✔')+_0x3865d4(0x1b2));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x1c3);[a29_0x1bdc06(0x1fc)]='Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration';async[a29_0x1bdc06(0x23e)](_0xd91291){const _0x350c30=a29_0x1bdc06,{options:_0x2fb35a,args:_0x264588,tdx:_0x3087a4}=_0xd91291,_0x16e0ab=_0x2fb35a,_0x5833ec=_0x264588[0x0]||_0x2fb35a[_0x350c30(0x231)];if(!_0x5833ec)return showParentSegmentNotSetError(_0x350c30(0x1f1)+_0x350c30(0x29a)+_0x350c30(0x27d)+_0x350c30(0x2b5)+_0x350c30(0x247)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+'\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a'+_0x350c30(0x295)),0x1;if(!_0x16e0ab[_0x350c30(0x27e)]&&!_0x16e0ab[_0x350c30(0x23a)]&&!_0x16e0ab[_0x350c30(0x1cb)]&&!_0x16e0ab[_0x350c30(0x267)])return console['error'](a29_0x2d2d64[_0x350c30(0x29b)]('Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a')),console[_0x350c30(0x292)](_0x350c30(0x2bc)),console[_0x350c30(0x292)](_0x350c30(0x2b9)),console['error']('\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data'),console['error'](_0x350c30(0x235)),console[_0x350c30(0x292)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error']('\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data'),0x1;const _0x949e6d=resolveYamlFile(_0x5833ec);if(!existsSync(_0x949e6d))return showFileNotFoundError(_0x949e6d,_0x5833ec),0x1;_0x16e0ab['verbose']&&(console[_0x350c30(0x292)](_0x350c30(0x26e)+_0x16e0ab['site']),console[_0x350c30(0x292)](_0x350c30(0x29d)+_0x949e6d));let _0x59d227;try{_0x59d227=readFileSync(_0x949e6d,'utf-8');}catch(_0x1ae3ca){const _0x17d0ff=_0x1ae3ca instanceof Error?_0x1ae3ca['message']:String(_0x1ae3ca);return console[_0x350c30(0x292)](_0x350c30(0x224)+_0x17d0ff),0x1;}let _0x5965a1;try{_0x5965a1=parseYamlString(_0x59d227);}catch(_0x17531e){const _0x1e37ce=_0x17531e instanceof Error?_0x17531e[_0x350c30(0x1e0)]:String(_0x17531e);return console[_0x350c30(0x292)](a29_0x2d2d64['red'](_0x350c30(0x232)+_0x1e37ce)),0x1;}if(_0x16e0ab['attribute']===!![]||_0x16e0ab[_0x350c30(0x23a)]===''){const _0x83fe6=_0x5965a1[_0x350c30(0x219)]?.['map'](_0x2b314d=>_0x2b314d[_0x350c30(0x1dd)])||[];if(_0x83fe6['length']===0x0)console[_0x350c30(0x292)](a29_0x2d2d64[_0x350c30(0x29b)](_0x350c30(0x2aa)));else{console[_0x350c30(0x292)](a29_0x2d2d64[_0x350c30(0x29b)](_0x350c30(0x290))),console['error'](_0x350c30(0x246));for(const _0xfa3bcc of _0x83fe6){console['error']('\x20\x20'+a29_0x2d2d64[_0x350c30(0x1e4)](_0xfa3bcc));}console['error']('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x5833ec+_0x350c30(0x2a6)+_0x83fe6[0x0]+'\x22');}return 0x1;}if(_0x16e0ab[_0x350c30(0x1cb)]===!![]||_0x16e0ab[_0x350c30(0x1cb)]===''){const _0x39f3b8=_0x5965a1[_0x350c30(0x1a4)]?.[_0x350c30(0x1bc)](_0x68141b=>_0x68141b[_0x350c30(0x1dd)])||[];if(_0x39f3b8['length']===0x0)console[_0x350c30(0x292)](a29_0x2d2d64[_0x350c30(0x29b)](_0x350c30(0x206)));else{console['error'](a29_0x2d2d64['red'](_0x350c30(0x22a))),console[_0x350c30(0x292)](_0x350c30(0x284));for(const _0x3d7c87 of _0x39f3b8){console['error']('\x20\x20'+a29_0x2d2d64[_0x350c30(0x1e4)](_0x3d7c87));}console[_0x350c30(0x292)](_0x350c30(0x291)+_0x5833ec+_0x350c30(0x1f4)+_0x39f3b8[0x0]+'\x22');}return 0x1;}const _0x39bfed=createCommandSpinner(a29_0x2d2d64[_0x350c30(0x2a2)](_0x350c30(0x274)),{'verbose':_0x16e0ab[_0x350c30(0x216)]});_0x39bfed[_0x350c30(0x22b)]();const _0xec8f2e={'onProgress':_0x2e3269=>{const _0x5b4e4d=_0x350c30;_0x39bfed[_0x5b4e4d(0x1f2)]=formatProgressMessage(_0x2e3269);}};if(_0x16e0ab['master'])_0xec8f2e['master']=!![];if(_0x16e0ab[_0x350c30(0x23a)]&&typeof _0x16e0ab[_0x350c30(0x23a)]===_0x350c30(0x221))_0xec8f2e[_0x350c30(0x23a)]=_0x16e0ab[_0x350c30(0x23a)];if(_0x16e0ab[_0x350c30(0x1cb)]&&typeof _0x16e0ab[_0x350c30(0x1cb)]===_0x350c30(0x221))_0xec8f2e[_0x350c30(0x1cb)]=_0x16e0ab[_0x350c30(0x1cb)];if(_0x16e0ab['enriched'])_0xec8f2e['enriched']=!![];if(_0x16e0ab[_0x350c30(0x256)])_0xec8f2e[_0x350c30(0x256)]=_0x16e0ab[_0x350c30(0x256)];let _0x501149;try{_0x501149=await _0x3087a4[_0x350c30(0x1bb)][_0x350c30(0x2bf)](_0x59d227,_0xec8f2e),_0x39bfed[_0x350c30(0x2b8)]();}catch(_0x189f80){_0x39bfed[_0x350c30(0x2b8)]();throw _0x189f80;}return await this[_0x350c30(0x299)](_0x501149,{'master':_0x16e0ab[_0x350c30(0x27e)],'attribute':typeof _0x16e0ab[_0x350c30(0x23a)]===_0x350c30(0x221)?_0x16e0ab[_0x350c30(0x23a)]:undefined,'behavior':typeof _0x16e0ab['behavior']===_0x350c30(0x221)?_0x16e0ab[_0x350c30(0x1cb)]:undefined,'enriched':_0x16e0ab[_0x350c30(0x267)]}),_0x501149[_0x350c30(0x28d)]?0x0:0x1;}async[a29_0x1bdc06(0x299)](_0x29be02,_0x37e617){const _0x208232=a29_0x1bdc06;console[_0x208232(0x292)]('\x0a'+a29_0x2d2d64[_0x208232(0x2a5)](_0x208232(0x261))+'\x20'+_0x29be02[_0x208232(0x1dd)]),console[_0x208232(0x292)]('═'['repeat'](0x3c));if(_0x37e617['master']&&_0x29be02[_0x208232(0x1c9)]){const _0x26b8a6=a29_0x2d2d64[_0x208232(0x2a2)](_0x208232(0x268))+'\x20'+a29_0x2d2d64['bold'](_0x29be02['master'][_0x208232(0x215)]+'.'+_0x29be02['master'][_0x208232(0x1a5)]);await this[_0x208232(0x253)](_0x26b8a6,_0x29be02[_0x208232(0x1c9)]);}else{if(_0x37e617['attribute']&&_0x29be02[_0x208232(0x1c9)]){const _0x3f6097=a29_0x2d2d64[_0x208232(0x2a2)](_0x208232(0x238))+'\x20'+a29_0x2d2d64[_0x208232(0x2a5)](_0x37e617['attribute']);await this['displaySampleData'](_0x3f6097,_0x29be02[_0x208232(0x1c9)]);}else{if(_0x37e617[_0x208232(0x1cb)]&&_0x29be02[_0x208232(0x1c9)]){const _0x185997=a29_0x2d2d64['dim'](_0x208232(0x1a6))+'\x20'+a29_0x2d2d64[_0x208232(0x2a5)](_0x37e617[_0x208232(0x1cb)]);await this[_0x208232(0x253)](_0x185997,_0x29be02['sampleData']);}else{if(_0x37e617[_0x208232(0x267)]&&_0x29be02[_0x208232(0x1c9)]){const _0x24d47d=a29_0x2d2d64[_0x208232(0x2a2)](_0x208232(0x2c2))+'\x20'+a29_0x2d2d64[_0x208232(0x2a5)](_0x208232(0x228));await this[_0x208232(0x253)](_0x24d47d,_0x29be02[_0x208232(0x1c9)]);}else!_0x29be02[_0x208232(0x1c9)]&&console['error'](_0x208232(0x2b1));}}}if(_0x29be02[_0x208232(0x2bb)][_0x208232(0x1ce)]>0x0){console[_0x208232(0x292)]('─'[_0x208232(0x1e3)](0x3c)),console[_0x208232(0x292)]('\x0a'+a29_0x2d2d64[_0x208232(0x29b)](_0x208232(0x1d9)));for(const _0x431187 of _0x29be02['errors']){console[_0x208232(0x292)]('\x20\x20'+a29_0x2d2d64[_0x208232(0x29b)]('•')+'\x20'+_0x431187);}}}async['displaySampleData'](_0x4b25d6,_0x5a277b){const _0x46a8aa=a29_0x1bdc06;if(_0x5a277b['length']===0x0){console[_0x46a8aa(0x292)]('\x0a'+_0x4b25d6),console['error']('\x20\x20No\x20sample\x20data\x20available');return;}console[_0x46a8aa(0x292)]('\x0a'+_0x4b25d6);const _0x4b895a=Object[_0x46a8aa(0x2ac)](_0x5a277b[0x0])[_0x46a8aa(0x1bc)](_0xf440bd=>({'name':_0xf440bd,'type':typeof _0x5a277b[0x0][_0xf440bd]==='number'?_0x46a8aa(0x26d):'varchar'})),_0x1839a8={'queryId':_0x46a8aa(0x269),'columns':_0x4b895a,'data':_0x5a277b,'stats':{'state':_0x46a8aa(0x1c0),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x5a277b['length'],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x5574c4=formatAsTable(_0x1839a8,_0x5a277b['length'],!![]);await writeOutput(_0x5574c4,undefined,_0x46a8aa(0x1a5));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{['name']=a29_0x1bdc06(0x26c);[a29_0x1bdc06(0x1fc)]='Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)';async[a29_0x1bdc06(0x23e)](_0x18047d){const _0x2e0c98=a29_0x1bdc06,{options:_0x10c617,args:_0x29d12f,tdx:_0x2df8c2}=_0x18047d,_0x260262=_0x10c617,_0x2759f7=_0x29d12f[0x0]||_0x10c617['parentSegment'];if(!_0x2759f7)return showParentSegmentNotSetError(_0x2e0c98(0x1d3)+_0x2e0c98(0x28f)),0x1;const _0x4303a8=resolveYamlFile(_0x2759f7);if(existsSync(_0x4303a8)){_0x260262['verbose']&&console[_0x2e0c98(0x292)](_0x2e0c98(0x1a9)+_0x4303a8);let _0x4a42e9;try{_0x4a42e9=readFileSync(_0x4303a8,_0x2e0c98(0x230));}catch(_0x2298fb){const _0x5da219=_0x2298fb instanceof Error?_0x2298fb[_0x2e0c98(0x1e0)]:String(_0x2298fb);return console[_0x2e0c98(0x292)](_0x2e0c98(0x224)+_0x5da219),0x1;}const _0x4c4065=await withSpinner('Analyzing\x20changes...',()=>_0x2df8c2[_0x2e0c98(0x1bb)]['pushParentYaml'](_0x4a42e9),{'verbose':_0x260262[_0x2e0c98(0x216)]}),_0x49e470=_0x4c4065['data'],{isNew:_0x3b76fc,name:_0x5f593f,hasChanges:_0x22671f,diffFormatted:_0x3459c9}=_0x49e470;if(_0x22671f){_0x3b76fc?console[_0x2e0c98(0x292)]('\x0aNew\x20parent\x20segment\x20\x27'+_0x5f593f+'\x27:'):console['error'](_0x2e0c98(0x1e1)+_0x5f593f+'\x27:');console[_0x2e0c98(0x292)]('─'[_0x2e0c98(0x1e3)](0x3c)),console[_0x2e0c98(0x292)](_0x3459c9),console[_0x2e0c98(0x292)]('─'[_0x2e0c98(0x1e3)](0x3c));const _0x5868a8=_0x3b76fc?_0x2e0c98(0x239)+_0x5f593f+_0x2e0c98(0x1b8):_0x2e0c98(0x1a2)+_0x5f593f+_0x2e0c98(0x1b8);if(!_0x260262['yes']){const _0xbf8542=await confirmKey(_0x5868a8);if(!_0xbf8542)return console[_0x2e0c98(0x292)]('Aborted.'),0x1;}const _0x438ab1=_0x3b76fc?_0x2e0c98(0x203):'Updating';await withSpinner(_0x438ab1+_0x2e0c98(0x1e7)+_0x5f593f+_0x2e0c98(0x218),()=>_0x49e470[_0x2e0c98(0x23b)](),{'verbose':_0x260262[_0x2e0c98(0x216)]});const _0x3da91e=_0x3b76fc?'Created':'Updated';console[_0x2e0c98(0x292)]('✔\x20'+_0x3da91e+_0x2e0c98(0x1e7)+_0x5f593f+'\x27');}else console['error'](_0x2e0c98(0x1ae)+_0x5f593f+'\x27\x20is\x20up\x20to\x20date');}const _0x360f02=await withSpinner(_0x2e0c98(0x283)+_0x2759f7+_0x2e0c98(0x218),()=>_0x2df8c2[_0x2e0c98(0x1bb)][_0x2e0c98(0x263)](_0x2759f7),{'verbose':_0x260262[_0x2e0c98(0x216)]}),_0x4fd7a5=_0x360f02['data'],_0x332d86=getConsoleUrl(_0x260262['site'],'/app/workflows/'+_0x4fd7a5['workflowId']+_0x2e0c98(0x28e)+_0x4fd7a5['workflowSessionId']+_0x2e0c98(0x226)+_0x4fd7a5[_0x2e0c98(0x288)]);return console[_0x2e0c98(0x292)]('\x0a✔\x20Workflow\x20started'),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x262))+'\x20'+_0x4fd7a5[_0x2e0c98(0x201)]),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x2b2))+'\x20'+_0x4fd7a5['status']),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64['dim'](_0x2e0c98(0x26a))+'\x20'+_0x4fd7a5[_0x2e0c98(0x265)]),console[_0x2e0c98(0x292)]('\x20\x20'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x1e8))+'\x20'+_0x4fd7a5[_0x2e0c98(0x288)]),console[_0x2e0c98(0x292)]('\x20\x20'+_0x332d86),console[_0x2e0c98(0x292)]('\x0a'+a29_0x2d2d64[_0x2e0c98(0x2a2)](_0x2e0c98(0x229))+_0x2e0c98(0x28a)+_0x4fd7a5['workflowAttemptId']+_0x2e0c98(0x2c0)),0x0;}}export class ParentSegmentFieldsCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x245);[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x2a8);async['execute'](_0x273d4c){const _0x828aa0=a29_0x1bdc06,{options:_0x12d070,args:_0x2a8b4e,tdx:_0x39bec1}=_0x273d4c,_0x487f37=_0x2a8b4e[0x0]||_0x12d070['parentSegment'];if(!_0x487f37)return showParentSegmentNotSetError(_0x828aa0(0x1f9)+_0x828aa0(0x25e)),0x1;_0x12d070[_0x828aa0(0x216)]&&(console['error'](_0x828aa0(0x26e)+_0x12d070[_0x828aa0(0x28c)]),console[_0x828aa0(0x292)](_0x828aa0(0x276)+_0x487f37));const _0x145ab4=await withSpinner(_0x828aa0(0x2bd)+_0x487f37+'\x27...',()=>_0x39bec1['segment'][_0x828aa0(0x234)](_0x487f37),{'verbose':_0x12d070[_0x828aa0(0x216)]}),_0x31af5c=_0x145ab4['data'];console['error'](_0x828aa0(0x1d7)+_0x31af5c['length']+_0x828aa0(0x264)+(_0x31af5c[_0x828aa0(0x1ce)]!==0x1?'s':''));if(_0x12d070['json']||_0x12d070['jsonl'])return await handleSDKOutput(_0x31af5c,_0x12d070),0x0;return displayFieldsHumanReadable(_0x31af5c,_0x487f37),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{['name']=a29_0x1bdc06(0x2ad);[a29_0x1bdc06(0x1fc)]='Show\x20parent\x20segment\x20details';async[a29_0x1bdc06(0x23e)](_0x426b40){const _0x25c46a=a29_0x1bdc06,{options:_0x519de0,args:_0x452b0f,tdx:_0x26f01c}=_0x426b40,_0x402b40=_0x519de0,_0x4f7e96=_0x452b0f[0x0]||_0x519de0[_0x25c46a(0x231)];if(!_0x4f7e96)return showParentSegmentNotSetError(_0x25c46a(0x20c)+'\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'+_0x25c46a(0x1c1)),0x1;_0x519de0[_0x25c46a(0x216)]&&(console[_0x25c46a(0x292)](_0x25c46a(0x26e)+_0x519de0['site']),console[_0x25c46a(0x292)]('Parent\x20segment:\x20'+_0x4f7e96));const _0x5945cd=await withSpinner(_0x25c46a(0x1cd)+_0x4f7e96+_0x25c46a(0x218),()=>_0x26f01c[_0x25c46a(0x1bb)][_0x25c46a(0x254)](_0x4f7e96),{'verbose':_0x519de0['verbose']}),_0x512f02=_0x5945cd['data'];if(_0x402b40[_0x25c46a(0x2af)]){const _0x48dfab=getConsoleNextUrl(_0x402b40[_0x25c46a(0x28c)],_0x25c46a(0x223)+_0x512f02['id']);return console['error'](a29_0x2d2d64[_0x25c46a(0x1b5)]('✔')+_0x25c46a(0x1da)+a29_0x2d2d64['cyan'](_0x48dfab)),openBrowser(_0x48dfab),0x0;}return await handleSingleObjectOutput(_0x512f02,_0x519de0),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]='segment:parent:desc';[a29_0x1bdc06(0x1fc)]=a29_0x1bdc06(0x27a);async[a29_0x1bdc06(0x23e)](_0x50fe5d){const _0x345603=a29_0x1bdc06,{options:_0x4a27e1,args:_0x2d626f,tdx:_0x36bc6d}=_0x50fe5d,_0x305817=_0x2d626f[0x0]||_0x4a27e1[_0x345603(0x231)];if(!_0x305817)return showParentSegmentNotSetError(_0x345603(0x205)+_0x345603(0x208)),0x1;_0x4a27e1[_0x345603(0x216)]&&(console['error'](_0x345603(0x26e)+_0x4a27e1[_0x345603(0x28c)]),console[_0x345603(0x292)](_0x345603(0x276)+_0x305817));const _0x18084b=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x305817+_0x345603(0x218),()=>_0x36bc6d['segment']['resolveParentId'](_0x305817),{'verbose':_0x4a27e1[_0x345603(0x216)]}),_0x1b8649=_0x18084b['data'],_0x26c8c5=await withSpinner(_0x345603(0x1c5)+_0x305817+_0x345603(0x218),()=>_0x36bc6d['segment'][_0x345603(0x233)](_0x1b8649),{'verbose':_0x4a27e1[_0x345603(0x216)]}),_0x3f4efe=await executeSchemaQuery(_0x26c8c5['data'],_0x36bc6d,_0x4a27e1);return await handleQueryOutput(_0x3f4efe,_0x4a27e1),0x0;}}export class ParentSegmentSQLCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]=a29_0x1bdc06(0x27c);[a29_0x1bdc06(0x1fc)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x4d7a72){const _0x155b01=a29_0x1bdc06,{options:_0x53610b,args:_0xe67eef,tdx:_0x1d54d5}=_0x4d7a72,_0x36e272=_0xe67eef[0x0]||_0x53610b[_0x155b01(0x231)];if(!_0x36e272)return showParentSegmentNotSetError(_0x155b01(0x220)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment'),0x1;_0x53610b[_0x155b01(0x216)]&&(console['error'](_0x155b01(0x26e)+_0x53610b[_0x155b01(0x28c)]),console[_0x155b01(0x292)](_0x155b01(0x276)+_0x36e272));const _0x367d0b=await withSpinner(_0x155b01(0x277)+_0x36e272+'\x27...',()=>_0x1d54d5[_0x155b01(0x1bb)][_0x155b01(0x1fa)](_0x36e272),{'verbose':_0x53610b['verbose']}),_0x2d265a=_0x367d0b['data'],_0x33e1a9=await withSpinner(_0x155b01(0x1c5)+_0x36e272+_0x155b01(0x218),()=>_0x1d54d5['segment'][_0x155b01(0x233)](_0x2d265a),{'verbose':_0x53610b[_0x155b01(0x216)]}),_0xdd1e13=_0x33e1a9['data'];return _0x53610b[_0x155b01(0x1b3)]===_0x155b01(0x259)||_0x53610b[_0x155b01(0x1b3)]===_0x155b01(0x27f)?await handleSDKOutput([{'sql':_0xdd1e13}],_0x53610b):console[_0x155b01(0x1d8)](_0xdd1e13),0x0;}}function a29_0x2a31(_0x21f2e1,_0x4bbcbc){_0x21f2e1=_0x21f2e1-0x1a2;const _0x52bc93=a29_0x52bc();let _0x2a3151=_0x52bc93[_0x21f2e1];return _0x2a3151;}export class ParentSegmentShowCommand extends BaseCommand{[a29_0x1bdc06(0x1dd)]='segment:parent:show';['description']=a29_0x1bdc06(0x1a8);async[a29_0x1bdc06(0x23e)](_0x398510){const _0x21207c=a29_0x1bdc06,{options:_0x14581f,args:_0x321b01,tdx:_0x1139fd}=_0x398510,_0x22e597=_0x321b01[0x0]||_0x14581f[_0x21207c(0x231)];if(!_0x22e597)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'+_0x21207c(0x2b4)),0x1;_0x14581f[_0x21207c(0x216)]&&(console[_0x21207c(0x292)](_0x21207c(0x26e)+_0x14581f[_0x21207c(0x28c)]),console[_0x21207c(0x292)]('Parent\x20segment:\x20'+_0x22e597));const _0x4ee436=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x22e597+_0x21207c(0x218),()=>_0x1139fd[_0x21207c(0x1bb)]['resolveParentId'](_0x22e597),{'verbose':_0x14581f[_0x21207c(0x216)]}),_0x45ab62=_0x4ee436[_0x21207c(0x21a)],_0xbdeca=await withSpinner(_0x21207c(0x1c5)+_0x22e597+_0x21207c(0x218),()=>_0x1139fd[_0x21207c(0x1bb)][_0x21207c(0x233)](_0x45ab62),{'verbose':_0x14581f[_0x21207c(0x216)]});let _0x40cd1e=_0xbdeca['data'];const _0x544760=resolveLimit(_0x14581f[_0x21207c(0x255)],DEFAULT_DISPLAY_LIMIT),_0x3a97fe=/\bLIMIT\s+\d+/i[_0x21207c(0x2a0)](_0x40cd1e);!_0x3a97fe&&(_0x40cd1e=_0x40cd1e['trim']()[_0x21207c(0x1c7)](/;+$/,''),_0x40cd1e='SELECT\x20*\x20FROM\x20(\x0a'+_0x40cd1e+_0x21207c(0x270)+_0x544760);_0x14581f[_0x21207c(0x216)]&&console[_0x21207c(0x292)](_0x21207c(0x1ed)+_0x40cd1e);const _0x2f864f=await withQuerySpinner(_0x21207c(0x2b6),async _0x1b0f5f=>{const _0x381370=_0x21207c,_0x3a50ef=await _0x1139fd['query'][_0x381370(0x23e)](_0x40cd1e,{'catalog':'td','schema':_0x381370(0x1d0),'onJobId':_0xe9f9ec=>{const _0x25ae7b=_0x381370;_0x1b0f5f[_0x25ae7b(0x281)](_0xe9f9ec);}});return _0x3a50ef;},{'verbose':_0x14581f['verbose']}),_0x49e6f6=_0x2f864f[_0x21207c(0x21a)],_0x3f9768=_0x49e6f6[_0x21207c(0x20b)]?'\x20[Job\x20ID:\x20'+_0x49e6f6[_0x21207c(0x20b)]+']':'';return console['error'](_0x21207c(0x21f)+_0x49e6f6['stats'][_0x21207c(0x275)][_0x21207c(0x1e6)]()+_0x21207c(0x29e)+('in\x20'+formatElapsed(_0x49e6f6[_0x21207c(0x222)][_0x21207c(0x1ac)])+_0x3f9768)),await handleQueryOutput(_0x49e6f6,_0x14581f),0x0;}}
@@ -1 +1 @@
1
- const a30_0x54ecb6=a30_0x1f14;(function(_0x1bf2a3,_0x2e92c5){const _0x40ad49=a30_0x1f14,_0x2d8b96=_0x1bf2a3();while(!![]){try{const _0x5e7fac=-parseInt(_0x40ad49(0xf8))/0x1+-parseInt(_0x40ad49(0x10b))/0x2+parseInt(_0x40ad49(0x108))/0x3*(-parseInt(_0x40ad49(0x100))/0x4)+parseInt(_0x40ad49(0xff))/0x5+parseInt(_0x40ad49(0xfa))/0x6+-parseInt(_0x40ad49(0x106))/0x7*(-parseInt(_0x40ad49(0xf7))/0x8)+-parseInt(_0x40ad49(0x101))/0x9*(parseInt(_0x40ad49(0x107))/0xa);if(_0x5e7fac===_0x2e92c5)break;else _0x2d8b96['push'](_0x2d8b96['shift']());}catch(_0x50a91b){_0x2d8b96['push'](_0x2d8b96['shift']());}}}(a30_0x267e,0x8d830));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';function a30_0x1f14(_0x4f464e,_0x2bbe39){_0x4f464e=_0x4f464e-0xf7;const _0x267ea4=a30_0x267e();let _0x1f14bf=_0x267ea4[_0x4f464e];return _0x1f14bf;}import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x54ecb6(0x109)]='profiles';[a30_0x54ecb6(0x105)]=a30_0x54ecb6(0x10a);async[a30_0x54ecb6(0xf9)](_0x2bd21e){const _0x8fde12=a30_0x54ecb6,{options:_0x385e20}=_0x2bd21e;try{const _0x1d0b33=listProfiles(),_0x3262af=getActiveProfile();if(_0x1d0b33[_0x8fde12(0x103)]===0x0)return console['log'](_0x8fde12(0x10c)),console[_0x8fde12(0xfc)](_0x8fde12(0xfb)),console[_0x8fde12(0xfc)](_0x8fde12(0x104)),0x0;const _0x2dca28=_0x1d0b33['map'](_0xa74b4b=>{const _0x59b63a=_0x8fde12,_0x2732cd=_0xa74b4b[_0x59b63a(0x109)]===_0x3262af,_0x57c638=getProfileParams(_0xa74b4b[_0x59b63a(0xfd)]);return{'name':_0xa74b4b[_0x59b63a(0x109)],'active':_0x2732cd,'scope':_0xa74b4b['scope'],'description':_0xa74b4b[_0x59b63a(0xfd)][_0x59b63a(0x105)]||'','params':_0x57c638};});return await handleSDKOutput(_0x2dca28,_0x385e20),0x0;}catch(_0x191401){return _0x191401 instanceof Error&&console['error'](_0x8fde12(0x102)+_0x191401[_0x8fde12(0xfe)]),0x1;}}}function a30_0x267e(){const _0x3d1a82=['\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','log','config','message','5062085HZZcrl','32pKPxHE','9NCAJxc','Error:\x20','length','\x20\x20Global:\x20~/.config/tdx/tdx.json','description','287yJufpS','1343830eDHQyT','173055dsxmgL','name','List\x20all\x20available\x20profiles','1081110kVFIZp','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','101512cYvyzU','269683HBclIs','execute','2718402HBIKKp'];a30_0x267e=function(){return _0x3d1a82;};return a30_0x267e();}
1
+ const a30_0x2e0b55=a30_0x5bc4;function a30_0x2b21(){const _0xcaba62=['212965zljZNk','9905945JiRmTD','message','9278tOkIGN','config','3643340oPMsKs','10210470SZKkxn','1176981TcKZeE','500016waFlEI','Error:\x20','length','name','9auOibd','error','description','profiles','\x20\x20Global:\x20~/.config/tdx/tdx.json','log','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','scope','39lfRgzg','map','228kbbyox'];a30_0x2b21=function(){return _0xcaba62;};return a30_0x2b21();}function a30_0x5bc4(_0x35f372,_0x92bacd){_0x35f372=_0x35f372-0x1b4;const _0x2b2181=a30_0x2b21();let _0x5bc40f=_0x2b2181[_0x35f372];return _0x5bc40f;}(function(_0x4b1b75,_0x2d3ebf){const _0x1d2e9e=a30_0x5bc4,_0x34c738=_0x4b1b75();while(!![]){try{const _0x729353=-parseInt(_0x1d2e9e(0x1c0))/0x1+-parseInt(_0x1d2e9e(0x1bc))/0x2*(-parseInt(_0x1d2e9e(0x1b6))/0x3)+parseInt(_0x1d2e9e(0x1be))/0x4+parseInt(_0x1d2e9e(0x1b9))/0x5*(parseInt(_0x1d2e9e(0x1b8))/0x6)+-parseInt(_0x1d2e9e(0x1ba))/0x7+-parseInt(_0x1d2e9e(0x1c1))/0x8+-parseInt(_0x1d2e9e(0x1c5))/0x9*(-parseInt(_0x1d2e9e(0x1bf))/0xa);if(_0x729353===_0x2d3ebf)break;else _0x34c738['push'](_0x34c738['shift']());}catch(_0x585bb1){_0x34c738['push'](_0x34c738['shift']());}}}(a30_0x2b21,0xe96c9));import{BaseCommand}from'./command.js';import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../utils/command-output.js';export class ProfilesCommand extends BaseCommand{[a30_0x2e0b55(0x1c4)]=a30_0x2e0b55(0x1c8);[a30_0x2e0b55(0x1c7)]='List\x20all\x20available\x20profiles';async['execute'](_0x264054){const _0x157cbf=a30_0x2e0b55,{options:_0x3a0a20}=_0x264054;try{const _0x2d2e0e=listProfiles(),_0x5e5693=getActiveProfile();if(_0x2d2e0e[_0x157cbf(0x1c3)]===0x0)return console[_0x157cbf(0x1ca)](_0x157cbf(0x1b4)),console[_0x157cbf(0x1ca)]('\x20\x20Local:\x20\x20(project\x20folder)/tdx.json'),console[_0x157cbf(0x1ca)](_0x157cbf(0x1c9)),0x0;const _0x372929=_0x2d2e0e[_0x157cbf(0x1b7)](_0x5ba04a=>{const _0x22692c=_0x157cbf,_0x43d1df=_0x5ba04a[_0x22692c(0x1c4)]===_0x5e5693,_0x482ae7=getProfileParams(_0x5ba04a[_0x22692c(0x1bd)]);return{'name':_0x5ba04a[_0x22692c(0x1c4)],'active':_0x43d1df,'scope':_0x5ba04a[_0x22692c(0x1b5)],'description':_0x5ba04a['config'][_0x22692c(0x1c7)]||'','params':_0x482ae7};});return await handleSDKOutput(_0x372929,_0x3a0a20),0x0;}catch(_0x167f57){return _0x167f57 instanceof Error&&console[_0x157cbf(0x1c6)](_0x157cbf(0x1c2)+_0x167f57[_0x157cbf(0x1bb)]),0x1;}}}
@@ -1 +1 @@
1
- const a31_0x286302=a31_0x5a26;(function(_0x3e8679,_0x3b2534){const _0x1f1dc0=a31_0x5a26,_0x184727=_0x3e8679();while(!![]){try{const _0x4f9879=-parseInt(_0x1f1dc0(0x77))/0x1+parseInt(_0x1f1dc0(0x82))/0x2*(parseInt(_0x1f1dc0(0x92))/0x3)+parseInt(_0x1f1dc0(0x75))/0x4+parseInt(_0x1f1dc0(0x7f))/0x5+parseInt(_0x1f1dc0(0x7e))/0x6+-parseInt(_0x1f1dc0(0xa2))/0x7*(parseInt(_0x1f1dc0(0xa5))/0x8)+-parseInt(_0x1f1dc0(0x71))/0x9*(parseInt(_0x1f1dc0(0x8a))/0xa);if(_0x4f9879===_0x3b2534)break;else _0x184727['push'](_0x184727['shift']());}catch(_0x4ad0f2){_0x184727['push'](_0x184727['shift']());}}}(a31_0x34e0,0x1f102));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';function a31_0x5a26(_0x7a5379,_0xa3d131){_0x7a5379=_0x7a5379-0x71;const _0x34e085=a31_0x34e0();let _0x5a26e7=_0x34e085[_0x7a5379];return _0x5a26e7;}import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';import{writeFileSync}from'fs';import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';function a31_0x34e0(){const _0x954cff=['1013334blrygW','956670eGBezZ','file','No\x20SQL\x20provided','84698tjKyhI','...','processedRows','verbose','in\x20','push','SQL:\x20','\x20splits','5630vgIQkT','\x20rows\x20','name','options','Executing\x20query...','args','originalMessage','completedSplits','15RHnlZJ','description','message','query','database','elapsedTimeMillis','Executing\x20query\x20[','\x20-\x20','catalog','state','length','setExtra','output','Run\x20Trino\x20queries\x20(streaming)','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','jobId','6251YWaVwS','error','Schema:\x20','648VNjSkS','6885uuaBPA','setJobId','information_schema','validate','251268xyvkFP','data','4523WsyrpJ','Catalog:\x20','Statement\x20','stats','Error:\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','\x0aAll\x20results\x20saved\x20to\x20'];a31_0x34e0=function(){return _0x954cff;};return a31_0x34e0();}import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a31_0x286302(0x8c)]=a31_0x286302(0x95);[a31_0x286302(0x93)]=a31_0x286302(0x9f);async['execute'](_0x12a647){const _0x78c5f9=a31_0x286302,{options:_0x536049,args:_0x41cc3e,tdx:_0x43aa67}=_0x12a647,_0x414429=_0x41cc3e[0x0],_0x57801b=_0x536049[_0x78c5f9(0x80)];let _0x52c315;try{if(_0x57801b)_0x52c315=readSqlStatementsFromFile(_0x57801b);else{if(_0x414429==='-')_0x52c315=await readSqlStatementsFromStdin();else{if(_0x414429&&isSqlFilePath(_0x414429))_0x52c315=readSqlStatementsFromFile(_0x414429);else{if(_0x414429)_0x52c315=splitSqlStatements(_0x414429);else throw new Error(_0x78c5f9(0x81));}}}}catch(_0x5370c4){return console['error'](_0x78c5f9(0x7b)+_0x5370c4[_0x78c5f9(0x94)]),0x1;}const _0x1466c8=_0x536049[_0x78c5f9(0x96)]||_0x78c5f9(0x73),_0x57880c=_0x536049[_0x78c5f9(0x9a)];try{const _0x47e563=[],_0x2d4720=!!_0x536049[_0x78c5f9(0x9e)];for(let _0x1447ea=0x0;_0x1447ea<_0x52c315[_0x78c5f9(0x9c)];_0x1447ea++){const _0x2ae7c0=_0x52c315[_0x1447ea],_0x508467=_0x1447ea+0x1,_0x2d4aeb=_0x52c315[_0x78c5f9(0x9c)],_0x32544f=_0x2d4aeb>0x1;_0x536049[_0x78c5f9(0x85)]&&(console['error']('\x0a'+(_0x32544f?'Statement\x20'+_0x508467+'/'+_0x2d4aeb+':':'')),console[_0x78c5f9(0xa3)]('Site:\x20'+_0x536049['site']),console['error'](_0x78c5f9(0x78)+(_0x57880c||'td')),console[_0x78c5f9(0xa3)](_0x78c5f9(0xa4)+_0x1466c8),console[_0x78c5f9(0xa3)](_0x78c5f9(0x88)+_0x2ae7c0));const _0x3615b1=_0x32544f?'Executing\x20statement\x20'+_0x508467+'/'+_0x2d4aeb+_0x78c5f9(0x83):_0x78c5f9(0x8e);try{const _0x3fc1b8=await withQuerySpinner(_0x3615b1,async _0x4a0b8b=>{const _0x4be97a=_0x78c5f9,_0x5bad97=await _0x43aa67[_0x4be97a(0x95)]['execute'](_0x2ae7c0,{'catalog':_0x57880c,'schema':_0x1466c8,'onJobId':_0x51e7ab=>{const _0x4e0203=_0x4be97a;_0x4a0b8b[_0x4e0203(0x72)](_0x51e7ab);},'onProgress':_0x58b261=>{const _0x107512=_0x4be97a;_0x4a0b8b['setPhase'](_0x107512(0x98)+_0x58b261[_0x107512(0x9b)]+']'),_0x4a0b8b[_0x107512(0x9d)](formatRows(_0x58b261['processedRows'])+_0x107512(0x8b)+_0x58b261[_0x107512(0x91)]+'/'+_0x58b261['totalSplits']+_0x107512(0x89));}});return _0x5bad97;},{'verbose':_0x536049['verbose']}),_0x151fa1=_0x3fc1b8[_0x78c5f9(0x76)],_0x23bec1=_0x151fa1[_0x78c5f9(0xa1)]?'\x20[Job\x20ID:\x20'+_0x151fa1[_0x78c5f9(0xa1)]+']':'',_0x1987c5=_0x32544f?_0x78c5f9(0x79)+_0x508467+'/'+_0x2d4aeb+_0x78c5f9(0x99):'';console['error']('✔\x20'+_0x1987c5+'Query\x20completed:\x20Processed\x20'+formatRows(_0x151fa1[_0x78c5f9(0x7a)][_0x78c5f9(0x84)])+_0x78c5f9(0x8b)+(_0x78c5f9(0x86)+formatElapsed(_0x151fa1['stats'][_0x78c5f9(0x97)])+_0x23bec1));if(_0x32544f&&_0x2d4720){const _0x26691a=resolveOutputOptions(_0x536049),_0x179b32=await formatQueryOutput(_0x151fa1,_0x26691a);_0x47e563[_0x78c5f9(0x87)](_0x179b32);}else await handleQueryOutput(_0x151fa1,_0x536049);}catch(_0x94586f){const _0xd5e08a=_0x32544f?'Statement\x20'+_0x508467+'/'+_0x2d4aeb+':\x0a':'',_0xedb168=_0x94586f instanceof SDKError?_0x94586f[_0x78c5f9(0x90)]:_0x94586f[_0x78c5f9(0x94)];return console[_0x78c5f9(0xa3)](''+_0xd5e08a+_0xedb168),0x1;}}if(_0x52c315[_0x78c5f9(0x9c)]>0x1&&_0x2d4720&&_0x47e563[_0x78c5f9(0x9c)]>0x0){const _0x26c745=_0x47e563['join']('\x0a');writeFileSync(_0x536049[_0x78c5f9(0x9e)],_0x26c745),console['error'](_0x78c5f9(0x7d)+_0x536049['output']);}return 0x0;}catch(_0x9a3a9e){throw _0x9a3a9e;}}[a31_0x286302(0x74)](_0x154089){const _0x3a5d98=a31_0x286302,_0x1e74a0=_0x154089[_0x3a5d98(0x8f)][0x0],_0x27449f=_0x154089[_0x3a5d98(0x8d)][_0x3a5d98(0x80)];if(!_0x1e74a0&&!_0x27449f)return _0x3a5d98(0xa0);if(_0x1e74a0&&_0x27449f)return _0x3a5d98(0x7c);return undefined;}}
1
+ const a31_0x14b53a=a31_0x1225;(function(_0x5eb242,_0x56a527){const _0x9b45a=a31_0x1225,_0x1f7bf0=_0x5eb242();while(!![]){try{const _0x5e75eb=-parseInt(_0x9b45a(0xdd))/0x1+parseInt(_0x9b45a(0xe2))/0x2+-parseInt(_0x9b45a(0xcf))/0x3*(-parseInt(_0x9b45a(0xe4))/0x4)+-parseInt(_0x9b45a(0xe7))/0x5+-parseInt(_0x9b45a(0xec))/0x6*(parseInt(_0x9b45a(0xf5))/0x7)+-parseInt(_0x9b45a(0xd4))/0x8+parseInt(_0x9b45a(0xd6))/0x9;if(_0x5e75eb===_0x56a527)break;else _0x1f7bf0['push'](_0x1f7bf0['shift']());}catch(_0x3c0572){_0x1f7bf0['push'](_0x1f7bf0['shift']());}}}(a31_0x4cd2,0x7189d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../utils/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../utils/sql-parser.js';function a31_0x1225(_0x392d68,_0x14849f){_0x392d68=_0x392d68-0xc6;const _0x4cd2be=a31_0x4cd2();let _0x122586=_0x4cd2be[_0x392d68];return _0x122586;}import{writeFileSync}from'fs';function a31_0x4cd2(){const _0x77b0a=['catalog','Schema:\x20','Executing\x20query...','317926wHBTSr','verbose','\x0aAll\x20results\x20saved\x20to\x20','\x20rows\x20','in\x20','database','execute','setJobId','Query\x20completed:\x20Processed\x20','error','15kUEzLz','stats','information_schema','file','query','3855656rcXRcn','\x20-\x20','20720403MMxhxx','length','name','state','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','message','setPhase','412957rXrppj','push','Error:\x20','SQL:\x20','Executing\x20statement\x20','258154XYjmGo','\x20splits','399724RDLWOu','site','processedRows','3767540uzFwkg','validate','\x20[Job\x20ID:\x20','jobId','Statement\x20','108QSFIAF','output','Executing\x20query\x20[','Site:\x20','originalMessage','setExtra'];a31_0x4cd2=function(){return _0x77b0a;};return a31_0x4cd2();}import{withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../utils/formatters.js';export class QueryCommand extends BaseCommand{[a31_0x14b53a(0xd8)]=a31_0x14b53a(0xd3);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a31_0x14b53a(0xcb)](_0x254967){const _0x4429db=a31_0x14b53a,{options:_0x24a498,args:_0x5478a1,tdx:_0x4ec897}=_0x254967,_0x1836ff=_0x5478a1[0x0],_0xb7d700=_0x24a498[_0x4429db(0xd2)];let _0x30bc5f;try{if(_0xb7d700)_0x30bc5f=readSqlStatementsFromFile(_0xb7d700);else{if(_0x1836ff==='-')_0x30bc5f=await readSqlStatementsFromStdin();else{if(_0x1836ff&&isSqlFilePath(_0x1836ff))_0x30bc5f=readSqlStatementsFromFile(_0x1836ff);else{if(_0x1836ff)_0x30bc5f=splitSqlStatements(_0x1836ff);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0xd1f011){return console[_0x4429db(0xce)](_0x4429db(0xdf)+_0xd1f011[_0x4429db(0xdb)]),0x1;}const _0x36c2a4=_0x24a498[_0x4429db(0xca)]||_0x4429db(0xd1),_0x160007=_0x24a498[_0x4429db(0xf2)];try{const _0x1594e1=[],_0x15379e=!!_0x24a498['output'];for(let _0x5e9318=0x0;_0x5e9318<_0x30bc5f[_0x4429db(0xd7)];_0x5e9318++){const _0x3710c0=_0x30bc5f[_0x5e9318],_0x135ed5=_0x5e9318+0x1,_0x1ab23a=_0x30bc5f[_0x4429db(0xd7)],_0x47a5c9=_0x1ab23a>0x1;_0x24a498[_0x4429db(0xc6)]&&(console['error']('\x0a'+(_0x47a5c9?_0x4429db(0xeb)+_0x135ed5+'/'+_0x1ab23a+':':'')),console[_0x4429db(0xce)](_0x4429db(0xef)+_0x24a498[_0x4429db(0xe5)]),console['error']('Catalog:\x20'+(_0x160007||'td')),console[_0x4429db(0xce)](_0x4429db(0xf3)+_0x36c2a4),console[_0x4429db(0xce)](_0x4429db(0xe0)+_0x3710c0));const _0x2d50b4=_0x47a5c9?_0x4429db(0xe1)+_0x135ed5+'/'+_0x1ab23a+'...':_0x4429db(0xf4);try{const _0x215354=await withQuerySpinner(_0x2d50b4,async _0x172ae1=>{const _0x30ae2e=await _0x4ec897['query']['execute'](_0x3710c0,{'catalog':_0x160007,'schema':_0x36c2a4,'onJobId':_0x496bb5=>{const _0x294aa0=a31_0x1225;_0x172ae1[_0x294aa0(0xcc)](_0x496bb5);},'onProgress':_0x4107a0=>{const _0x38361b=a31_0x1225;_0x172ae1[_0x38361b(0xdc)](_0x38361b(0xee)+_0x4107a0[_0x38361b(0xd9)]+']'),_0x172ae1[_0x38361b(0xf1)](formatRows(_0x4107a0[_0x38361b(0xe6)])+_0x38361b(0xc8)+_0x4107a0['completedSplits']+'/'+_0x4107a0['totalSplits']+_0x38361b(0xe3));}});return _0x30ae2e;},{'verbose':_0x24a498[_0x4429db(0xc6)]}),_0x58d03c=_0x215354['data'],_0x1df7eb=_0x58d03c[_0x4429db(0xea)]?_0x4429db(0xe9)+_0x58d03c[_0x4429db(0xea)]+']':'',_0x44e0b1=_0x47a5c9?'Statement\x20'+_0x135ed5+'/'+_0x1ab23a+_0x4429db(0xd5):'';console[_0x4429db(0xce)]('✔\x20'+_0x44e0b1+_0x4429db(0xcd)+formatRows(_0x58d03c[_0x4429db(0xd0)][_0x4429db(0xe6)])+_0x4429db(0xc8)+(_0x4429db(0xc9)+formatElapsed(_0x58d03c[_0x4429db(0xd0)]['elapsedTimeMillis'])+_0x1df7eb));if(_0x47a5c9&&_0x15379e){const _0x22c2b9=resolveOutputOptions(_0x24a498),_0x390f38=await formatQueryOutput(_0x58d03c,_0x22c2b9);_0x1594e1[_0x4429db(0xde)](_0x390f38);}else await handleQueryOutput(_0x58d03c,_0x24a498);}catch(_0x5c76f7){const _0x565373=_0x47a5c9?_0x4429db(0xeb)+_0x135ed5+'/'+_0x1ab23a+':\x0a':'',_0x32d8da=_0x5c76f7 instanceof SDKError?_0x5c76f7[_0x4429db(0xf0)]:_0x5c76f7[_0x4429db(0xdb)];return console[_0x4429db(0xce)](''+_0x565373+_0x32d8da),0x1;}}if(_0x30bc5f['length']>0x1&&_0x15379e&&_0x1594e1[_0x4429db(0xd7)]>0x0){const _0x350cb1=_0x1594e1['join']('\x0a');writeFileSync(_0x24a498[_0x4429db(0xed)],_0x350cb1),console[_0x4429db(0xce)](_0x4429db(0xc7)+_0x24a498[_0x4429db(0xed)]);}return 0x0;}catch(_0x1f2191){throw _0x1f2191;}}[a31_0x14b53a(0xe8)](_0x4122b9){const _0x25921b=a31_0x14b53a,_0x24f889=_0x4122b9['args'][0x0],_0x5b27ee=_0x4122b9['options'][_0x25921b(0xd2)];if(!_0x24f889&&!_0x5b27ee)return _0x25921b(0xda);if(_0x24f889&&_0x5b27ee)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
@@ -1 +1 @@
1
- const a32_0x2274e8=a32_0x2bb6;(function(_0x1d7936,_0x982175){const _0x50f0f0=a32_0x2bb6,_0x31424a=_0x1d7936();while(!![]){try{const _0x4333f7=-parseInt(_0x50f0f0(0x21f))/0x1*(parseInt(_0x50f0f0(0x1fb))/0x2)+-parseInt(_0x50f0f0(0x27b))/0x3*(-parseInt(_0x50f0f0(0x273))/0x4)+-parseInt(_0x50f0f0(0x271))/0x5*(-parseInt(_0x50f0f0(0x1f2))/0x6)+parseInt(_0x50f0f0(0x20e))/0x7+-parseInt(_0x50f0f0(0x229))/0x8+-parseInt(_0x50f0f0(0x1f1))/0x9+-parseInt(_0x50f0f0(0x276))/0xa;if(_0x4333f7===_0x982175)break;else _0x31424a['push'](_0x31424a['shift']());}catch(_0x59d405){_0x31424a['push'](_0x31424a['shift']());}}}(a32_0xa8ad,0x3b6a2));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a32_0xa45164 from'chalk';function resolveSegmentTarget(_0x4480e5,_0x533144,_0x3b869c){const _0x220198=a32_0x2bb6;if(isYamlFilePath(_0x4480e5))try{const _0x8249ec=resolveYamlFilePath(_0x4480e5);return _0x3b869c&&(console['error'](_0x220198(0x27f)+_0x4480e5),console['error'](_0x220198(0x250)+_0x8249ec[_0x220198(0x1ff)]),console[_0x220198(0x24f)]('\x20\x20Segment\x20name:\x20'+_0x8249ec['segmentName']),console['error'](_0x220198(0x26b)+(_0x8249ec[_0x220198(0x23e)]||_0x220198(0x289))),console['error'](_0x220198(0x25a)+_0x8249ec['fullPath'])),_0x8249ec[_0x220198(0x253)];}catch(_0x4d609f){throw new SDKError(ErrorCode[_0x220198(0x1f4)],_0x220198(0x210)+_0x4d609f[_0x220198(0x202)]);}if(!_0x533144)throw new SDKError(ErrorCode[_0x220198(0x1f4)],_0x220198(0x20f));return _0x533144+'/'+_0x4480e5;}export class SegmentDescribeCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x1f6);['description']=a32_0x2274e8(0x265);async[a32_0x2274e8(0x213)](_0x45d228){const _0x40e85c=a32_0x2274e8,{options:_0x19c0fc,args:_0x2de484,tdx:_0x3a062b}=_0x45d228,_0x122317=_0x2de484[0x0],_0x5aec66=!_0x122317&&!!_0x19c0fc[_0x40e85c(0x1ff)],_0x566128=_0x122317||_0x19c0fc['parentSegment'];if(!_0x566128)return console[_0x40e85c(0x24f)](_0x40e85c(0x248)),console['error'](_0x40e85c(0x226)),console['error'](_0x40e85c(0x256)),console[_0x40e85c(0x24f)](_0x40e85c(0x22c)),console['error'](_0x40e85c(0x264)),console[_0x40e85c(0x24f)]('\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context'),console['error'](_0x40e85c(0x20a)),0x1;try{const _0x321e6a=_0x19c0fc[_0x40e85c(0x1f9)];let _0x1e712f=_0x566128;!_0x5aec66&&_0x321e6a&&!_0x566128['includes']('/')&&(_0x1e712f=_0x321e6a+'/'+_0x566128,_0x19c0fc[_0x40e85c(0x267)]&&console[_0x40e85c(0x24f)](_0x40e85c(0x279)+_0x1e712f));const _0x1075c6=await withSpinner(_0x40e85c(0x268)+_0x1e712f+_0x40e85c(0x26a),()=>_0x3a062b['segment'][_0x40e85c(0x282)](_0x1e712f),{'verbose':_0x19c0fc[_0x40e85c(0x267)]}),_0x5834e8=_0x1075c6[_0x40e85c(0x20c)];_0x19c0fc[_0x40e85c(0x267)]&&(console[_0x40e85c(0x24f)](_0x40e85c(0x217)+_0x5834e8[_0x40e85c(0x1f8)]),console[_0x40e85c(0x24f)](_0x40e85c(0x26c)+_0x5834e8[_0x40e85c(0x23f)]),_0x5834e8['folderId']&&console['error'](_0x40e85c(0x277)+_0x5834e8['folderId']),_0x5834e8['segmentId']&&console[_0x40e85c(0x24f)](_0x40e85c(0x21a)+_0x5834e8[_0x40e85c(0x237)]));if(_0x5834e8[_0x40e85c(0x1f8)]===_0x40e85c(0x28d)){const _0x397d71=await withSpinner(_0x40e85c(0x24d),()=>_0x3a062b[_0x40e85c(0x28e)][_0x40e85c(0x20d)](_0x5834e8[_0x40e85c(0x23f)]),{'verbose':_0x19c0fc['verbose']});await handleSingleObjectOutput(_0x397d71[_0x40e85c(0x20c)],_0x19c0fc);}else{if(_0x5834e8['type']===_0x40e85c(0x25c)){if(!_0x5834e8[_0x40e85c(0x228)])throw new SDKError(ErrorCode[_0x40e85c(0x283)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x332b5d=await withSpinner(_0x40e85c(0x284),()=>_0x3a062b[_0x40e85c(0x28e)][_0x40e85c(0x22d)](_0x5834e8['folderId']),{'verbose':_0x19c0fc['verbose']});await handleSingleObjectOutput(_0x332b5d[_0x40e85c(0x20c)],_0x19c0fc);}else{if(_0x5834e8[_0x40e85c(0x1f8)]===_0x40e85c(0x28e)){if(!_0x5834e8[_0x40e85c(0x237)])throw new SDKError(ErrorCode[_0x40e85c(0x200)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x53a438=await withSpinner(_0x40e85c(0x280),()=>_0x3a062b[_0x40e85c(0x28e)][_0x40e85c(0x247)](_0x5834e8[_0x40e85c(0x23f)],_0x5834e8[_0x40e85c(0x237)]),{'verbose':_0x19c0fc[_0x40e85c(0x267)]});await handleSingleObjectOutput(_0x53a438['data'],_0x19c0fc);}}}return 0x0;}catch(_0x55cd9f){if(_0x55cd9f instanceof SDKError)return console[_0x40e85c(0x24f)](_0x40e85c(0x1ef)+_0x55cd9f[_0x40e85c(0x202)]),_0x55cd9f[_0x40e85c(0x24c)]&&console[_0x40e85c(0x24f)](_0x40e85c(0x204)+_0x55cd9f[_0x40e85c(0x24c)]),0x1;throw _0x55cd9f;}}}export class SegmentShowCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x249);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x215);async[a32_0x2274e8(0x213)](_0x1d5d2b){const _0x446f49=a32_0x2274e8,{options:_0x492a2e,args:_0x27c2f5,tdx:_0x16e80f}=_0x1d5d2b,_0x44915a=_0x27c2f5[0x0];if(!_0x44915a)return console[_0x446f49(0x24f)]('Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required'),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x446f49(0x24f)](_0x446f49(0x27c)),console[_0x446f49(0x24f)](_0x446f49(0x256)),console[_0x446f49(0x24f)](_0x446f49(0x23d)),console['error'](_0x446f49(0x260)),0x1;try{const _0x34b2f7=_0x492a2e[_0x446f49(0x1ff)],_0x17bdfd=resolveSegmentTarget(_0x44915a,_0x34b2f7,_0x492a2e['verbose']);_0x492a2e[_0x446f49(0x267)]&&console['error'](_0x446f49(0x258)+_0x17bdfd);const _0x406c14=await withSpinner('Resolving\x20\x27'+_0x44915a+_0x446f49(0x26a),()=>_0x16e80f[_0x446f49(0x28e)][_0x446f49(0x282)](_0x17bdfd),{'verbose':_0x492a2e[_0x446f49(0x267)]}),_0x49cbf5=_0x406c14[_0x446f49(0x20c)];_0x492a2e[_0x446f49(0x267)]&&(console[_0x446f49(0x24f)]('Resolved\x20type:\x20'+_0x49cbf5[_0x446f49(0x1f8)]),console['error']('Parent\x20ID:\x20'+_0x49cbf5[_0x446f49(0x23f)]));if(_0x49cbf5['type']==='folder')return console[_0x446f49(0x24f)](_0x446f49(0x231)),console['error']('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x49cbf5[_0x446f49(0x1f8)]===_0x446f49(0x28d))return console[_0x446f49(0x24f)](_0x446f49(0x220)),console[_0x446f49(0x24f)](_0x446f49(0x244)),0x1;if(!_0x49cbf5[_0x446f49(0x237)])throw new SDKError(ErrorCode[_0x446f49(0x200)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x28a35a=await withSpinner(_0x446f49(0x22e),()=>_0x16e80f['segment'][_0x446f49(0x26f)](_0x49cbf5[_0x446f49(0x23f)],_0x49cbf5[_0x446f49(0x237)]),{'verbose':_0x492a2e[_0x446f49(0x267)]});let _0x214b3c=_0x28a35a[_0x446f49(0x20c)];const _0x3ca9bd=resolveLimit(_0x492a2e[_0x446f49(0x24e)],DEFAULT_DISPLAY_LIMIT),_0x8290b2=/\bLIMIT\s+\d+/i[_0x446f49(0x275)](_0x214b3c);!_0x8290b2&&(_0x214b3c=_0x214b3c['trim']()['replace'](/;+$/,''),_0x214b3c=_0x446f49(0x242)+_0x214b3c+_0x446f49(0x214)+_0x3ca9bd);_0x492a2e[_0x446f49(0x267)]&&console['error'](_0x446f49(0x234)+_0x214b3c);const _0xb96b41=await withQuerySpinner(_0x446f49(0x241),async _0x533b7c=>{const _0x25793a=_0x446f49,_0x29975f=await _0x16e80f[_0x25793a(0x286)][_0x25793a(0x213)](_0x214b3c,{'catalog':'td','schema':'information_schema','onJobId':_0x4bd363=>{const _0x51b659=_0x25793a;_0x533b7c[_0x51b659(0x205)](_0x4bd363);}});return _0x29975f;},{'verbose':_0x492a2e[_0x446f49(0x267)]}),_0x172d79=_0xb96b41['data'],_0x3d7e98=_0x172d79[_0x446f49(0x25e)]?'\x20[Job\x20ID:\x20'+_0x172d79['jobId']+']':'';return console[_0x446f49(0x24f)](_0x446f49(0x238)+_0x172d79[_0x446f49(0x259)][_0x446f49(0x23c)]['toLocaleString']()+_0x446f49(0x209)+('in\x20'+formatElapsed(_0x172d79[_0x446f49(0x259)][_0x446f49(0x24b)])+_0x3d7e98)),await handleQueryOutput(_0x172d79,_0x492a2e),0x0;}catch(_0x5bcb72){if(_0x5bcb72 instanceof SDKError)return console[_0x446f49(0x24f)](_0x446f49(0x251)+_0x5bcb72['code']+']'),console[_0x446f49(0x24f)]('\x0a'+_0x5bcb72['message']),0x1;throw _0x5bcb72;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x2274e8(0x239)]='segment:folder:list';[a32_0x2274e8(0x1f5)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async[a32_0x2274e8(0x213)](_0x5d35fe){const _0x488e13=a32_0x2274e8,{options:_0x17dcb0,args:_0x16fd8c,tdx:_0x5da57a}=_0x5d35fe;if(_0x16fd8c['length']===0x0)return console[_0x488e13(0x24f)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x488e13(0x24f)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x46a534=_0x16fd8c[0x0];try{_0x17dcb0[_0x488e13(0x267)]&&(console[_0x488e13(0x24f)](_0x488e13(0x25d)+_0x17dcb0['site']),console[_0x488e13(0x24f)](_0x488e13(0x285)+_0x46a534));const _0x2dd30=await withSpinner(_0x488e13(0x261)+_0x46a534+_0x488e13(0x26a),()=>_0x5da57a[_0x488e13(0x28e)][_0x488e13(0x243)](_0x46a534),{'verbose':_0x17dcb0[_0x488e13(0x267)]}),_0x434dd8=_0x2dd30['data'];_0x17dcb0[_0x488e13(0x267)]&&console[_0x488e13(0x24f)]('Resolved\x20parent\x20ID:\x20'+_0x434dd8);const _0x46c808=await withSpinner(_0x488e13(0x24a)+_0x46a534+_0x488e13(0x26a),()=>_0x5da57a[_0x488e13(0x28e)]['listFolders'](_0x434dd8),{'verbose':_0x17dcb0[_0x488e13(0x267)]}),_0x29117a=_0x46c808[_0x488e13(0x20c)];return console['error'](_0x488e13(0x252)+_0x29117a[_0x488e13(0x211)]+_0x488e13(0x27e)+(_0x29117a[_0x488e13(0x211)]!==0x1?'s':'')),await handleSDKOutput(_0x29117a,_0x17dcb0),0x0;}catch(_0x1df1ff){if(_0x1df1ff instanceof SDKError)return console[_0x488e13(0x24f)](_0x488e13(0x1ef)+_0x1df1ff[_0x488e13(0x202)]),_0x1df1ff['cause']&&console[_0x488e13(0x24f)]('\x20\x20Cause:\x20'+_0x1df1ff[_0x488e13(0x24c)]),0x1;throw _0x1df1ff;}}}export class SegmentFolderShowCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x1f7);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x21c);async['execute'](_0xf947aa){const _0x1e9669=a32_0x2274e8,{options:_0x1968b7,args:_0x11d9e7,tdx:_0x1dcccb}=_0xf947aa;if(_0x11d9e7[_0x1e9669(0x211)]===0x0)return console[_0x1e9669(0x24f)](_0x1e9669(0x21b)),console[_0x1e9669(0x24f)](_0x1e9669(0x27a)),0x1;try{const {parentId:_0x2aebed,childId:_0x4e4840}=parseSegmentRef(_0x11d9e7[0x0]);_0x1968b7[_0x1e9669(0x267)]&&(console[_0x1e9669(0x24f)](_0x1e9669(0x25d)+_0x1968b7[_0x1e9669(0x269)]),console[_0x1e9669(0x24f)]('Parent\x20name:\x20'+_0x2aebed),_0x4e4840&&console[_0x1e9669(0x24f)](_0x1e9669(0x219)+_0x4e4840));if(!_0x4e4840)return console['error']('Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)'),0x1;const _0x5cd8ac=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x2aebed+_0x1e9669(0x26a),()=>_0x1dcccb[_0x1e9669(0x28e)][_0x1e9669(0x243)](_0x2aebed),{'verbose':_0x1968b7[_0x1e9669(0x267)]}),_0x1c080f=_0x5cd8ac[_0x1e9669(0x20c)];_0x1968b7[_0x1e9669(0x267)]&&console[_0x1e9669(0x24f)](_0x1e9669(0x224)+_0x1c080f);const _0x2eb834=await withSpinner(_0x1e9669(0x221)+_0x4e4840+'\x27...',()=>_0x1dcccb['segment'][_0x1e9669(0x22f)](_0x1c080f,_0x4e4840),{'verbose':_0x1968b7['verbose']}),_0x470387=_0x2eb834[_0x1e9669(0x20c)];_0x1968b7['verbose']&&console[_0x1e9669(0x24f)](_0x1e9669(0x257)+_0x470387);const _0x18cde8=await withSpinner(_0x1e9669(0x208)+_0x4e4840+'\x27...',()=>_0x1dcccb['segment']['getFolder'](_0x470387),{'verbose':_0x1968b7[_0x1e9669(0x267)]});return await handleSDKOutput([_0x18cde8['data']],_0x1968b7),0x0;}catch(_0x93fc6){if(_0x93fc6 instanceof SDKError)return console[_0x1e9669(0x24f)](_0x1e9669(0x1ef)+_0x93fc6[_0x1e9669(0x202)]),_0x93fc6[_0x1e9669(0x24c)]&&console[_0x1e9669(0x24f)](_0x1e9669(0x204)+_0x93fc6[_0x1e9669(0x24c)]),0x1;throw _0x93fc6;}}}function a32_0x2bb6(_0x4d2503,_0x48c265){_0x4d2503=_0x4d2503-0x1ef;const _0xa8ad7a=a32_0xa8ad();let _0x2bb630=_0xa8ad7a[_0x4d2503];return _0x2bb630;}function a32_0xa8ad(){const _0x4af578=['Creating\x20folder\x20\x27','data','getParent','967960dgCrBZ','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','length','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','execute','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','cyan','Resolved\x20type:\x20','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Folder\x20name:\x20','Segment\x20ID:\x20','Error:\x20Folder\x20reference\x20is\x20required','Show\x20segment\x20folder\x20details','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','json','68WHQvwn','Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.','Resolving\x20folder\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>','Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.','Resolved\x20parent\x20ID:\x20','log','Usage:\x20tdx\x20segment\x20describe\x20<path>','Create\x20segment\x20folder\x20for\x20organization','folderId','3682664QmpgVS','/app/ps/','Segment\x20ID\x20missing\x20from\x20resolved\x20path','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','getFolder','Fetching\x20SQL\x20for\x20segment...','resolveFolderId','Show\x20folder\x20or\x20child\x20segment\x20details','Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.','Use:\x20tdx\x20ps\x20sql','\x27\x20with\x20ID:\x20','SQL\x20query:\x0a','\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml','\x20Opening\x20','segmentId','✔\x20Query\x20completed:\x20Processed\x20','name','Resolving\x20parent\x20folder\x20\x27','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','processedRows','\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22','folderPath','parentId','Usage:\x20tdx\x20sg\x20sql\x20<name>','Executing\x20segment\x20query...','SELECT\x20*\x20FROM\x20(\x0a','resolveParentId','Use:\x20tdx\x20ps\x20show','Options:','segment:sql','getSegment','Error:\x20Path\x20or\x20name\x20is\x20required','segment:show','Listing\x20folders\x20for\x20parent\x20\x27','elapsedTimeMillis','cause','Fetching\x20parent\x20segment\x20details...','limit','error','\x20\x20Parent\x20segment:\x20','✖\x20Query\x20failed\x20[','✔\x20Found\x20','fullPath','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','Examples:','Resolved\x20folder\x20ID:\x20','Target\x20path:\x20','stats','\x20\x20Full\x20path:\x20','\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details','folder','Site:\x20','jobId','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','Resolving\x20parent\x20segment\x20\x27','/e/','Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Show\x20segment\x20or\x20folder\x20details','Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.','verbose','Resolving\x20path\x20\x27','site','\x27...','\x20\x20Folder\x20path:\x20','Parent\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>','Use:\x20tdx\x20ps\x20desc','getSegmentSQL','Get\x20SQL\x20query\x20for\x20child\x20segment','405415dDjMoO','Resolving\x20\x27','100ltqomt','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','test','565030joRUMW','Folder\x20ID:\x20','✔\x20Created\x20folder\x20\x27','Resolved\x20relative\x20path\x20to:\x20','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','56538HGUMdV','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>','parentFolder','\x20folder','Resolved\x20YAML\x20file:\x20','Fetching\x20segment\x20details...','createFolder','resolvePathToResource','SEGMENT_FOLDER_NOT_FOUND','Fetching\x20folder\x20details...','Parent\x20name:\x20','query','Use:\x20tdx\x20ps\x20view','Parent\x20segment:\x20','(root)','Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required','segment:desc','\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22','parent','segment','Error:\x20','segment:folder:create','2217159TJhEbL','30bWzKsq','green','INVALID_ARGUMENT','description','segment:describe','segment:folder:show','type','segmentPath','Use:\x20tdx\x20ps\x20view\x20-w','244caASIi','jsonl','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','parentSegment','SEGMENT_NOT_FOUND','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','message','segment:view','\x20\x20Cause:\x20','setJobId','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','format','Fetching\x20folder\x20\x27','\x20rows\x20','\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>'];a32_0xa8ad=function(){return _0x4af578;};return a32_0xa8ad();}export class SegmentSQLCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x246);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x270);async[a32_0x2274e8(0x213)](_0x1020a0){const _0x535a8a=a32_0x2274e8,{options:_0x2d76d8,args:_0x41951b,tdx:_0x2aecd3}=_0x1020a0,_0x10541f=_0x41951b[0x0];if(!_0x10541f)return console[_0x535a8a(0x24f)](_0x535a8a(0x21d)),console[_0x535a8a(0x24f)](_0x535a8a(0x240)),console[_0x535a8a(0x24f)](_0x535a8a(0x201)),console[_0x535a8a(0x24f)](_0x535a8a(0x256)),console[_0x535a8a(0x24f)](_0x535a8a(0x28c)),console[_0x535a8a(0x24f)](_0x535a8a(0x235)),0x1;try{const _0x3795f1=_0x2d76d8[_0x535a8a(0x1ff)],_0x5645fe=resolveSegmentTarget(_0x10541f,_0x3795f1,_0x2d76d8['verbose']);_0x2d76d8[_0x535a8a(0x267)]&&console[_0x535a8a(0x24f)]('Target\x20path:\x20'+_0x5645fe);const _0x1e4313=await withSpinner(_0x535a8a(0x272)+_0x10541f+'\x27...',()=>_0x2aecd3[_0x535a8a(0x28e)][_0x535a8a(0x282)](_0x5645fe),{'verbose':_0x2d76d8[_0x535a8a(0x267)]}),_0x25b651=_0x1e4313[_0x535a8a(0x20c)];_0x2d76d8['verbose']&&(console[_0x535a8a(0x24f)](_0x535a8a(0x217)+_0x25b651[_0x535a8a(0x1f8)]),console['error']('Parent\x20ID:\x20'+_0x25b651[_0x535a8a(0x23f)]));if(_0x25b651[_0x535a8a(0x1f8)]===_0x535a8a(0x25c))return console[_0x535a8a(0x24f)]('Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.'),console[_0x535a8a(0x24f)](_0x535a8a(0x1fd)),0x1;if(_0x25b651[_0x535a8a(0x1f8)]===_0x535a8a(0x28d))return console[_0x535a8a(0x24f)](_0x535a8a(0x206)),console[_0x535a8a(0x24f)](_0x535a8a(0x232)),0x1;if(!_0x25b651[_0x535a8a(0x237)])throw new SDKError(ErrorCode['SEGMENT_NOT_FOUND'],_0x535a8a(0x22b));const _0x41d05d=await withSpinner(_0x535a8a(0x22e),()=>_0x2aecd3[_0x535a8a(0x28e)]['getSegmentSQL'](_0x25b651[_0x535a8a(0x23f)],_0x25b651[_0x535a8a(0x237)]),{'verbose':_0x2d76d8[_0x535a8a(0x267)]}),_0x1f82eb=_0x41d05d[_0x535a8a(0x20c)];return _0x2d76d8[_0x535a8a(0x207)]===_0x535a8a(0x21e)||_0x2d76d8[_0x535a8a(0x207)]===_0x535a8a(0x1fc)?await handleSDKOutput([{'sql':_0x1f82eb}],_0x2d76d8):console[_0x535a8a(0x225)](_0x1f82eb),0x0;}catch(_0xd6b956){if(_0xd6b956 instanceof SDKError)return console['error'](_0x535a8a(0x1ef)+_0xd6b956[_0x535a8a(0x202)]),_0xd6b956[_0x535a8a(0x24c)]&&console[_0x535a8a(0x24f)]('\x20\x20Cause:\x20'+_0xd6b956[_0x535a8a(0x24c)]),0x1;throw _0xd6b956;}}}export class SegmentFolderCreateCommand extends BaseCommand{['name']=a32_0x2274e8(0x1f0);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x227);async['execute'](_0x258700){const _0x1bf78d=a32_0x2274e8,{options:_0x35983f,args:_0x4f5dd1,tdx:_0x53e962}=_0x258700,_0x467ee3=_0x35983f;if(_0x4f5dd1[_0x1bf78d(0x211)]<0x2)return console[_0x1bf78d(0x24f)](_0x1bf78d(0x28a)),console[_0x1bf78d(0x24f)](_0x1bf78d(0x263)),0x1;const _0xe51827=_0x4f5dd1[0x0],_0x4cec4b=_0x4f5dd1[0x1];_0x467ee3[_0x1bf78d(0x267)]&&(console['error'](_0x1bf78d(0x25d)+_0x467ee3[_0x1bf78d(0x269)]),console[_0x1bf78d(0x24f)](_0x1bf78d(0x288)+_0xe51827),console[_0x1bf78d(0x24f)](_0x1bf78d(0x219)+_0x4cec4b));let _0x56c701;if(_0x467ee3['parentFolder']){const _0x4b8d59=_0x467ee3[_0x1bf78d(0x27d)],_0xc9e9d2=await withSpinner(_0x1bf78d(0x261)+_0xe51827+_0x1bf78d(0x26a),()=>_0x53e962[_0x1bf78d(0x28e)]['resolveParentId'](_0xe51827),{'verbose':_0x467ee3['verbose']}),_0x5dfc16=_0xc9e9d2['data'],_0x76b21f=await withSpinner(_0x1bf78d(0x23a)+_0x4b8d59+_0x1bf78d(0x26a),()=>_0x53e962[_0x1bf78d(0x28e)][_0x1bf78d(0x22f)](_0x5dfc16,_0x4b8d59),{'verbose':_0x467ee3[_0x1bf78d(0x267)]});_0x56c701=_0x76b21f['data'],_0x467ee3[_0x1bf78d(0x267)]&&console[_0x1bf78d(0x24f)]('Resolved\x20parent\x20folder\x20ID:\x20'+_0x56c701);}const _0xe71e5b={'name':_0x4cec4b,'description':_0x467ee3[_0x1bf78d(0x1f5)],'parentFolderId':_0x56c701},_0x5acf5a=await withSpinner(_0x1bf78d(0x20b)+_0x4cec4b+_0x1bf78d(0x26a),()=>_0x53e962['segment'][_0x1bf78d(0x281)](_0xe51827,_0xe71e5b),{'verbose':_0x467ee3[_0x1bf78d(0x267)]}),_0x371132=_0x5acf5a[_0x1bf78d(0x20c)];return console[_0x1bf78d(0x24f)](_0x1bf78d(0x278)+_0x371132[_0x1bf78d(0x239)]+_0x1bf78d(0x233)+_0x371132['id']),await handleSDKOutput([_0x371132],_0x467ee3),0x0;}}export class SegmentViewCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x203);[a32_0x2274e8(0x1f5)]=a32_0x2274e8(0x230);async[a32_0x2274e8(0x213)](_0x3e6914){const _0x55db7d=a32_0x2274e8,{options:_0x34514e,args:_0x4ccc9e,tdx:_0x5f5ec3}=_0x3e6914,_0x55b8a7=_0x4ccc9e[0x0];if(!_0x55b8a7)return console[_0x55db7d(0x24f)](_0x55db7d(0x218)),console[_0x55db7d(0x24f)](_0x55db7d(0x212)),console[_0x55db7d(0x24f)](_0x55db7d(0x26d)),console['error'](_0x55db7d(0x245)),console['error'](_0x55db7d(0x1fe)),console['error']('Examples:'),console['error'](_0x55db7d(0x25b)),console['error'](_0x55db7d(0x23b)),console[_0x55db7d(0x24f)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x55db7d(0x24f)]('\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x57740f=_0x34514e[_0x55db7d(0x1ff)],_0x19cabb=resolveSegmentTarget(_0x55b8a7,_0x57740f,_0x34514e[_0x55db7d(0x267)]);_0x34514e['verbose']&&console[_0x55db7d(0x24f)]('Target\x20path:\x20'+_0x19cabb);const _0x3301db=await withSpinner(_0x55db7d(0x272)+_0x55b8a7+_0x55db7d(0x26a),()=>_0x5f5ec3[_0x55db7d(0x28e)]['resolvePathToResource'](_0x19cabb),{'verbose':_0x34514e['verbose']}),_0x222ce3=_0x3301db[_0x55db7d(0x20c)];_0x34514e[_0x55db7d(0x267)]&&(console[_0x55db7d(0x24f)](_0x55db7d(0x217)+_0x222ce3[_0x55db7d(0x1f8)]),console[_0x55db7d(0x24f)](_0x55db7d(0x26c)+_0x222ce3['parentId']),_0x222ce3['folderId']&&console[_0x55db7d(0x24f)](_0x55db7d(0x277)+_0x222ce3[_0x55db7d(0x228)]),_0x222ce3['segmentId']&&console[_0x55db7d(0x24f)](_0x55db7d(0x21a)+_0x222ce3[_0x55db7d(0x237)]));if(_0x34514e['web']){if(_0x222ce3[_0x55db7d(0x1f8)]===_0x55db7d(0x25c))return console[_0x55db7d(0x24f)](_0x55db7d(0x266)),0x1;if(_0x222ce3[_0x55db7d(0x1f8)]===_0x55db7d(0x28d))return console[_0x55db7d(0x24f)](_0x55db7d(0x274)),console['error'](_0x55db7d(0x1fa)),0x1;if(!_0x222ce3[_0x55db7d(0x237)])throw new SDKError(ErrorCode[_0x55db7d(0x200)],'Segment\x20ID\x20missing\x20from\x20resolved\x20path');const _0x4c638a=getConsoleNextUrl(_0x34514e['site'],'/app/ps/'+_0x222ce3[_0x55db7d(0x23f)]+_0x55db7d(0x262)+_0x222ce3[_0x55db7d(0x237)]);return console[_0x55db7d(0x24f)](a32_0xa45164[_0x55db7d(0x1f3)]('✔')+_0x55db7d(0x236)+a32_0xa45164[_0x55db7d(0x216)](_0x4c638a)),openBrowser(_0x4c638a),0x0;}if(_0x222ce3['type']==='folder'){if(!_0x222ce3['folderId'])throw new SDKError(ErrorCode[_0x55db7d(0x283)],'Folder\x20ID\x20missing\x20from\x20resolved\x20path');const _0x477490=await withSpinner(_0x55db7d(0x284),()=>_0x5f5ec3[_0x55db7d(0x28e)][_0x55db7d(0x22d)](_0x222ce3[_0x55db7d(0x228)]),{'verbose':_0x34514e[_0x55db7d(0x267)]});await handleSingleObjectOutput(_0x477490[_0x55db7d(0x20c)],_0x34514e);}else{if(_0x222ce3[_0x55db7d(0x1f8)]===_0x55db7d(0x28e)){if(!_0x222ce3[_0x55db7d(0x237)])throw new SDKError(ErrorCode[_0x55db7d(0x200)],_0x55db7d(0x22b));const _0x3a9b44=await withSpinner(_0x55db7d(0x280),()=>_0x5f5ec3[_0x55db7d(0x28e)][_0x55db7d(0x247)](_0x222ce3['parentId'],_0x222ce3[_0x55db7d(0x237)]),{'verbose':_0x34514e[_0x55db7d(0x267)]}),_0x15f242=getConsoleNextUrl(_0x34514e[_0x55db7d(0x269)],_0x55db7d(0x22a)+_0x222ce3[_0x55db7d(0x23f)]+_0x55db7d(0x262)+_0x222ce3[_0x55db7d(0x237)]),_0x3446fb=_0x3a9b44[_0x55db7d(0x20c)];_0x3446fb['url']=_0x15f242,await handleSingleObjectOutput(_0x3446fb,_0x34514e);}else return console[_0x55db7d(0x24f)](_0x55db7d(0x25f)),console[_0x55db7d(0x24f)](_0x55db7d(0x287)),0x1;}return 0x0;}catch(_0x306240){if(_0x306240 instanceof SDKError)return console[_0x55db7d(0x24f)](_0x55db7d(0x1ef)+_0x306240['message']),_0x306240[_0x55db7d(0x24c)]&&console['error']('\x20\x20Cause:\x20'+_0x306240[_0x55db7d(0x24c)]),0x1;throw _0x306240;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a32_0x2274e8(0x239)]=a32_0x2274e8(0x28b);[a32_0x2274e8(0x1f5)]='Show\x20child\x20segment\x20schema\x20(column\x20types)';async[a32_0x2274e8(0x213)](_0x534fea){const _0x7c49cd=a32_0x2274e8,{options:_0x2a34be,args:_0x490059,tdx:_0x342f54}=_0x534fea,_0x32a981=_0x490059[0x0];if(!_0x32a981)return console['error'](_0x7c49cd(0x21d)),console['error']('Usage:\x20tdx\x20sg\x20desc\x20<name>'),console[_0x7c49cd(0x24f)](_0x7c49cd(0x222)),console['error'](_0x7c49cd(0x256)),console['error']('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x7c49cd(0x24f)](_0x7c49cd(0x255)),0x1;try{const _0x4c9fab=_0x2a34be['parentSegment'],_0x253825=resolveSegmentTarget(_0x32a981,_0x4c9fab,_0x2a34be[_0x7c49cd(0x267)]);_0x2a34be[_0x7c49cd(0x267)]&&console[_0x7c49cd(0x24f)]('Target\x20path:\x20'+_0x253825);const _0x245d50=await withSpinner(_0x7c49cd(0x272)+_0x32a981+_0x7c49cd(0x26a),()=>_0x342f54[_0x7c49cd(0x28e)][_0x7c49cd(0x282)](_0x253825),{'verbose':_0x2a34be[_0x7c49cd(0x267)]}),_0x4d4479=_0x245d50['data'];_0x2a34be['verbose']&&(console[_0x7c49cd(0x24f)](_0x7c49cd(0x217)+_0x4d4479[_0x7c49cd(0x1f8)]),console[_0x7c49cd(0x24f)](_0x7c49cd(0x26c)+_0x4d4479[_0x7c49cd(0x23f)]));if(_0x4d4479[_0x7c49cd(0x1f8)]===_0x7c49cd(0x25c))return console[_0x7c49cd(0x24f)](_0x7c49cd(0x223)),console[_0x7c49cd(0x24f)]('Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.'),0x1;if(_0x4d4479[_0x7c49cd(0x1f8)]===_0x7c49cd(0x28d))return console[_0x7c49cd(0x24f)](_0x7c49cd(0x254)),console[_0x7c49cd(0x24f)](_0x7c49cd(0x26e)),0x1;if(!_0x4d4479['segmentId'])throw new SDKError(ErrorCode[_0x7c49cd(0x200)],_0x7c49cd(0x22b));const _0x2a8789=await withSpinner(_0x7c49cd(0x22e),()=>_0x342f54[_0x7c49cd(0x28e)][_0x7c49cd(0x26f)](_0x4d4479[_0x7c49cd(0x23f)],_0x4d4479['segmentId']),{'verbose':_0x2a34be[_0x7c49cd(0x267)]}),_0x1be75b=_0x2a8789[_0x7c49cd(0x20c)],_0x3681fa=await executeSchemaQuery(_0x1be75b,_0x342f54,_0x2a34be);return await handleQueryOutput(_0x3681fa,_0x2a34be),0x0;}catch(_0x5f3da8){if(_0x5f3da8 instanceof SDKError)return console[_0x7c49cd(0x24f)](_0x7c49cd(0x1ef)+_0x5f3da8[_0x7c49cd(0x202)]),_0x5f3da8[_0x7c49cd(0x24c)]&&console[_0x7c49cd(0x24f)](_0x7c49cd(0x204)+_0x5f3da8[_0x7c49cd(0x24c)]),0x1;throw _0x5f3da8;}}}
1
+ const a32_0x5ca161=a32_0x3a09;(function(_0x459542,_0x346119){const _0x5422a8=a32_0x3a09,_0x4f472a=_0x459542();while(!![]){try{const _0x23fa86=parseInt(_0x5422a8(0x184))/0x1*(-parseInt(_0x5422a8(0x189))/0x2)+-parseInt(_0x5422a8(0x1ce))/0x3*(parseInt(_0x5422a8(0x1bf))/0x4)+parseInt(_0x5422a8(0x177))/0x5*(-parseInt(_0x5422a8(0x198))/0x6)+parseInt(_0x5422a8(0x19c))/0x7+parseInt(_0x5422a8(0x1cc))/0x8+-parseInt(_0x5422a8(0x1d2))/0x9*(parseInt(_0x5422a8(0x152))/0xa)+parseInt(_0x5422a8(0x161))/0xb*(parseInt(_0x5422a8(0x1b8))/0xc);if(_0x23fa86===_0x346119)break;else _0x4f472a['push'](_0x4f472a['shift']());}catch(_0x2c73ba){_0x4f472a['push'](_0x4f472a['shift']());}}}(a32_0x4542,0x5243f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a32_0x4542(){const _0x5ae38f=['\x20\x20Or\x20set\x20context:\x20tdx\x20use\x20parent_segment\x20<name>','folder','356885seTYqe','Error:\x20Cannot\x20open\x20parent\x20segment\x20with\x20this\x20command.','folderPath','getParent','\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20sql\x20<path/to/segment.yml>','\x20\x20tdx\x20sg\x20view\x20segments/my-audience/premium-users.yml','Error:\x20Cannot\x20get\x20SQL\x20query\x20for\x20a\x20folder.','getSegmentSQL','INVALID_ARGUMENT','\x20folder','Usage:\x20tdx\x20sg\x20desc\x20<name>','folderId','resolvePathToResource','65YhCjzf','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience\x22','Executing\x20segment\x20query...','Use:\x20tdx\x20ps\x20sql','Fetching\x20segment\x20details...','6638NbrMzW','segment:describe','format','/e/','url','\x20\x20Full\x20path:\x20','stats','parentId','jobId','replace','getSegment','Folder\x20ID:\x20','fullPath','type','\x20\x20tdx\x20sg\x20show\x20segments/my-audience/premium-users.yml','36nLCsFu','SEGMENT_FOLDER_NOT_FOUND','Resolved\x20type:\x20','Resolving\x20folder\x20\x27','2722097yGNfEB','error','Resolved\x20relative\x20path\x20to:\x20','Error:\x20Cannot\x20show\x20schema\x20for\x20parent\x20segment\x20with\x20this\x20command.','Examples:','code','cause','json','segmentId','Folder\x20name:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20segment\x20in\x20web\x20browser','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20','Show\x20child\x20segment\x20schema\x20(column\x20types)','query','includes','\x20\x20Parent\x20segment:\x20','\x27...','message','Error:\x20Child\x20segment\x20name\x20or\x20YAML\x20file\x20path\x20is\x20required','Creating\x20folder\x20\x27','\x20\x20Folder\x20path:\x20','parentFolder','SEGMENT_NOT_FOUND','resolveFolderId','segment:folder:show','Error:\x20Folder\x20or\x20segment\x20name,\x20or\x20YAML\x20file\x20path\x20is\x20required','Resolved\x20parent\x20ID:\x20','SELECT\x20*\x20FROM\x20(\x0a','1104kEwBtP','segment:folder:create','\x20[Job\x20ID:\x20','Segment\x20ID\x20missing\x20from\x20resolved\x20path','Listing\x20folders\x20for\x20parent\x20\x27','Error:\x20Folder\x20reference\x20is\x20required','Resolved\x20YAML\x20file:\x20','1044XvfvHQ','✔\x20Query\x20completed:\x20Processed\x20','Error:\x20','\x20\x20tdx\x20segment\x20describe\x20\x22High\x20Value\x22\x20\x20\x20\x20#\x20Relative\x20to\x20current\x20context','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Usage:\x20tdx\x20sg\x20sql\x20<name>','Fetching\x20SQL\x20for\x20segment...','Usage:\x20tdx\x20segment\x20folder\x20show\x20<parent_name/folder_name>','cyan','Error:\x20Cannot\x20get\x20SQL\x20for\x20parent\x20segment\x20with\x20this\x20command.','verbose','execute','Fetching\x20folder\x20details...','4017648DdRAse','parent','5739KfXwmt','site','Fetching\x20parent\x20segment\x20details...','data','913248McPsdf','\x20\x20tdx\x20segment\x20describe\x20\x22My\x20Audience/Marketing/High\x20Value\x22','Resolved\x20parent\x20folder\x20ID:\x20','\x20\x20tdx\x20sg\x20desc\x20segments/my-audience/premium-users.yml','segment','name','Resolving\x20parent\x20segment\x20\x27','Folders\x20are\x20organizational\x20containers,\x20not\x20queryable\x20segments.','getFolder','\x20Opening\x20','Show\x20segment\x20or\x20folder\x20details','✔\x20Created\x20folder\x20\x27','parentSegment','limit','description','✖\x20Query\x20failed\x20[','/app/ps/','SQL\x20query:\x0a','listFolders','✔\x20Found\x20','information_schema','10ySDFbq','\x20\x20Cause:\x20','setJobId','segment:show','Use:\x20tdx\x20ps\x20view','processedRows','elapsedTimeMillis','Folder\x20ID\x20missing\x20from\x20resolved\x20path','Parent\x20ID:\x20','web','\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20\x20\x20\x20\x20#\x20View\x20child\x20segment\x20details','Execute\x20child\x20segment\x20SQL\x20query\x20and\x20show\x20results','jsonl','Show\x20folder\x20or\x20child\x20segment\x20details','Show\x20segment\x20folder\x20details','82577ixMajO','Site:\x20','segmentPath','Target\x20path:\x20','Error:\x20Cannot\x20view\x20parent\x20segment\x20details\x20with\x20this\x20command.','\x20rows\x20','Segment\x20ID:\x20','green','createFolder','Usage:\x20tdx\x20sg\x20view\x20<name>\x20[-w]','Parent\x20name:\x20','Use:\x20tdx\x20ps\x20desc','Error:\x20Folder\x20name\x20is\x20required\x20(use\x20parent_name/folder_name\x20format)','Resolving\x20\x27','Get\x20SQL\x20query\x20for\x20child\x20segment','(root)','Parent\x20segment:\x20','resolveParentId','length','Resolved\x20folder\x20ID:\x20'];a32_0x4542=function(){return _0x5ae38f;};return a32_0x4542();}import{withSpinner,withQuerySpinner,formatElapsed}from'../utils/spinner.js';import{parseSegmentRef}from'../utils/segment-ref-parser.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../utils/constants.js';function a32_0x3a09(_0x105da2,_0x572bd8){_0x105da2=_0x105da2-0x149;const _0x454266=a32_0x4542();let _0x3a0903=_0x454266[_0x105da2];return _0x3a0903;}import{executeSchemaQuery}from'../utils/fields-display.js';import{isYamlFilePath,resolveYamlFilePath}from'../utils/segment-path-parser.js';import{getConsoleNextUrl}from'../types/endpoints.js';import{openBrowser}from'../utils/process.js';import a32_0x2f50a3 from'chalk';function resolveSegmentTarget(_0x18a252,_0x5ae00f,_0x456d89){const _0xb8a32d=a32_0x3a09;if(isYamlFilePath(_0x18a252))try{const _0x4142cc=resolveYamlFilePath(_0x18a252);return _0x456d89&&(console[_0xb8a32d(0x19d)](_0xb8a32d(0x1be)+_0x18a252),console['error'](_0xb8a32d(0x1ab)+_0x4142cc[_0xb8a32d(0x149)]),console[_0xb8a32d(0x19d)]('\x20\x20Segment\x20name:\x20'+_0x4142cc['segmentName']),console['error'](_0xb8a32d(0x1b0)+(_0x4142cc[_0xb8a32d(0x179)]||_0xb8a32d(0x170))),console[_0xb8a32d(0x19d)](_0xb8a32d(0x18e)+_0x4142cc['fullPath'])),_0x4142cc[_0xb8a32d(0x195)];}catch(_0x5b306f){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20'+_0x5b306f['message']);}if(!_0x5ae00f)throw new SDKError(ErrorCode[_0xb8a32d(0x17f)],_0xb8a32d(0x1c3));return _0x5ae00f+'/'+_0x18a252;}export class SegmentDescribeCommand extends BaseCommand{[a32_0x5ca161(0x1d7)]=a32_0x5ca161(0x18a);[a32_0x5ca161(0x14b)]=a32_0x5ca161(0x1dc);async['execute'](_0x217f7b){const _0x362cfa=a32_0x5ca161,{options:_0x3dc61d,args:_0x21cf88,tdx:_0x2bd33f}=_0x217f7b,_0x5f31ea=_0x21cf88[0x0],_0x1ad8be=!_0x5f31ea&&!!_0x3dc61d[_0x362cfa(0x149)],_0x213f05=_0x5f31ea||_0x3dc61d[_0x362cfa(0x149)];if(!_0x213f05)return console[_0x362cfa(0x19d)]('Error:\x20Path\x20or\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20segment\x20describe\x20<path>'),console[_0x362cfa(0x19d)](_0x362cfa(0x1a0)),console['error'](_0x362cfa(0x185)),console[_0x362cfa(0x19d)](_0x362cfa(0x1d3)),console[_0x362cfa(0x19d)](_0x362cfa(0x1c2)),console['error'](_0x362cfa(0x175)),0x1;try{const _0x5cfc2b=_0x3dc61d[_0x362cfa(0x163)];let _0x35f68f=_0x213f05;!_0x1ad8be&&_0x5cfc2b&&!_0x213f05[_0x362cfa(0x1aa)]('/')&&(_0x35f68f=_0x5cfc2b+'/'+_0x213f05,_0x3dc61d[_0x362cfa(0x1c9)]&&console[_0x362cfa(0x19d)](_0x362cfa(0x19e)+_0x35f68f));const _0x37bb3b=await withSpinner('Resolving\x20path\x20\x27'+_0x35f68f+_0x362cfa(0x1ac),()=>_0x2bd33f[_0x362cfa(0x1d6)][_0x362cfa(0x183)](_0x35f68f),{'verbose':_0x3dc61d[_0x362cfa(0x1c9)]}),_0x5a7789=_0x37bb3b[_0x362cfa(0x1d1)];_0x3dc61d[_0x362cfa(0x1c9)]&&(console['error']('Resolved\x20type:\x20'+_0x5a7789['type']),console[_0x362cfa(0x19d)](_0x362cfa(0x15a)+_0x5a7789['parentId']),_0x5a7789['folderId']&&console[_0x362cfa(0x19d)](_0x362cfa(0x194)+_0x5a7789[_0x362cfa(0x182)]),_0x5a7789[_0x362cfa(0x1a4)]&&console[_0x362cfa(0x19d)](_0x362cfa(0x167)+_0x5a7789[_0x362cfa(0x1a4)]));if(_0x5a7789[_0x362cfa(0x196)]===_0x362cfa(0x1cd)){const _0x4d0372=await withSpinner(_0x362cfa(0x1d0),()=>_0x2bd33f[_0x362cfa(0x1d6)][_0x362cfa(0x17a)](_0x5a7789[_0x362cfa(0x190)]),{'verbose':_0x3dc61d[_0x362cfa(0x1c9)]});await handleSingleObjectOutput(_0x4d0372[_0x362cfa(0x1d1)],_0x3dc61d);}else{if(_0x5a7789['type']===_0x362cfa(0x176)){if(!_0x5a7789['folderId'])throw new SDKError(ErrorCode[_0x362cfa(0x199)],_0x362cfa(0x159));const _0x5683d0=await withSpinner(_0x362cfa(0x1cb),()=>_0x2bd33f[_0x362cfa(0x1d6)][_0x362cfa(0x1da)](_0x5a7789[_0x362cfa(0x182)]),{'verbose':_0x3dc61d[_0x362cfa(0x1c9)]});await handleSingleObjectOutput(_0x5683d0[_0x362cfa(0x1d1)],_0x3dc61d);}else{if(_0x5a7789[_0x362cfa(0x196)]===_0x362cfa(0x1d6)){if(!_0x5a7789[_0x362cfa(0x1a4)])throw new SDKError(ErrorCode[_0x362cfa(0x1b2)],_0x362cfa(0x1bb));const _0x506e18=await withSpinner(_0x362cfa(0x188),()=>_0x2bd33f[_0x362cfa(0x1d6)][_0x362cfa(0x193)](_0x5a7789[_0x362cfa(0x190)],_0x5a7789[_0x362cfa(0x1a4)]),{'verbose':_0x3dc61d[_0x362cfa(0x1c9)]});await handleSingleObjectOutput(_0x506e18[_0x362cfa(0x1d1)],_0x3dc61d);}}}return 0x0;}catch(_0x35b5db){if(_0x35b5db instanceof SDKError)return console[_0x362cfa(0x19d)]('Error:\x20'+_0x35b5db[_0x362cfa(0x1ad)]),_0x35b5db[_0x362cfa(0x1a2)]&&console[_0x362cfa(0x19d)]('\x20\x20Cause:\x20'+_0x35b5db['cause']),0x1;throw _0x35b5db;}}}export class SegmentShowCommand extends BaseCommand{['name']=a32_0x5ca161(0x155);[a32_0x5ca161(0x14b)]=a32_0x5ca161(0x15d);async[a32_0x5ca161(0x1ca)](_0xf498f5){const _0x5d4f87=a32_0x5ca161,{options:_0x8f66fa,args:_0x11bf87,tdx:_0x2628c8}=_0xf498f5,_0x183a09=_0x11bf87[0x0];if(!_0x183a09)return console[_0x5d4f87(0x19d)](_0x5d4f87(0x1ae)),console['error']('Usage:\x20tdx\x20sg\x20show\x20<name>'),console[_0x5d4f87(0x19d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20show\x20<path/to/segment.yml>'),console[_0x5d4f87(0x19d)]('Examples:'),console['error']('\x20\x20tdx\x20sg\x20show\x20\x22Premium\x20Users\x22'),console[_0x5d4f87(0x19d)](_0x5d4f87(0x197)),0x1;try{const _0xc6daa1=_0x8f66fa[_0x5d4f87(0x149)],_0x1bdc53=resolveSegmentTarget(_0x183a09,_0xc6daa1,_0x8f66fa['verbose']);_0x8f66fa['verbose']&&console[_0x5d4f87(0x19d)](_0x5d4f87(0x164)+_0x1bdc53);const _0x3300dd=await withSpinner('Resolving\x20\x27'+_0x183a09+_0x5d4f87(0x1ac),()=>_0x2628c8[_0x5d4f87(0x1d6)][_0x5d4f87(0x183)](_0x1bdc53),{'verbose':_0x8f66fa[_0x5d4f87(0x1c9)]}),_0x2dfd6a=_0x3300dd[_0x5d4f87(0x1d1)];_0x8f66fa['verbose']&&(console[_0x5d4f87(0x19d)](_0x5d4f87(0x19a)+_0x2dfd6a[_0x5d4f87(0x196)]),console[_0x5d4f87(0x19d)]('Parent\x20ID:\x20'+_0x2dfd6a[_0x5d4f87(0x190)]));if(_0x2dfd6a[_0x5d4f87(0x196)]===_0x5d4f87(0x176))return console[_0x5d4f87(0x19d)]('Error:\x20Cannot\x20execute\x20SQL\x20query\x20on\x20a\x20folder.'),console[_0x5d4f87(0x19d)]('Use:\x20tdx\x20sg\x20view\x20<name>\x20\x20#\x20To\x20show\x20folder\x20details'),0x1;if(_0x2dfd6a[_0x5d4f87(0x196)]==='parent')return console[_0x5d4f87(0x19d)]('Error:\x20Cannot\x20execute\x20query\x20for\x20parent\x20segment\x20with\x20this\x20command.'),console[_0x5d4f87(0x19d)]('Use:\x20tdx\x20ps\x20show'),0x1;if(!_0x2dfd6a[_0x5d4f87(0x1a4)])throw new SDKError(ErrorCode[_0x5d4f87(0x1b2)],_0x5d4f87(0x1bb));const _0x5472cb=await withSpinner(_0x5d4f87(0x1c5),()=>_0x2628c8['segment']['getSegmentSQL'](_0x2dfd6a[_0x5d4f87(0x190)],_0x2dfd6a[_0x5d4f87(0x1a4)]),{'verbose':_0x8f66fa[_0x5d4f87(0x1c9)]});let _0x37739c=_0x5472cb['data'];const _0x96631e=resolveLimit(_0x8f66fa[_0x5d4f87(0x14a)],DEFAULT_DISPLAY_LIMIT),_0x410e46=/\bLIMIT\s+\d+/i['test'](_0x37739c);!_0x410e46&&(_0x37739c=_0x37739c['trim']()[_0x5d4f87(0x192)](/;+$/,''),_0x37739c=_0x5d4f87(0x1b7)+_0x37739c+_0x5d4f87(0x1a7)+_0x96631e);_0x8f66fa[_0x5d4f87(0x1c9)]&&console['error'](_0x5d4f87(0x14e)+_0x37739c);const _0x463540=await withQuerySpinner(_0x5d4f87(0x186),async _0x3ce212=>{const _0x240ee0=_0x5d4f87,_0x2e4a11=await _0x2628c8[_0x240ee0(0x1a9)][_0x240ee0(0x1ca)](_0x37739c,{'catalog':'td','schema':_0x240ee0(0x151),'onJobId':_0x3105c7=>{const _0x482ebb=_0x240ee0;_0x3ce212[_0x482ebb(0x154)](_0x3105c7);}});return _0x2e4a11;},{'verbose':_0x8f66fa['verbose']}),_0x56cecf=_0x463540['data'],_0x2a86d2=_0x56cecf[_0x5d4f87(0x191)]?_0x5d4f87(0x1ba)+_0x56cecf[_0x5d4f87(0x191)]+']':'';return console[_0x5d4f87(0x19d)](_0x5d4f87(0x1c0)+_0x56cecf['stats'][_0x5d4f87(0x157)]['toLocaleString']()+_0x5d4f87(0x166)+('in\x20'+formatElapsed(_0x56cecf[_0x5d4f87(0x18f)][_0x5d4f87(0x158)])+_0x2a86d2)),await handleQueryOutput(_0x56cecf,_0x8f66fa),0x0;}catch(_0xfb99e7){if(_0xfb99e7 instanceof SDKError)return console[_0x5d4f87(0x19d)](_0x5d4f87(0x14c)+_0xfb99e7[_0x5d4f87(0x1a1)]+']'),console[_0x5d4f87(0x19d)]('\x0a'+_0xfb99e7[_0x5d4f87(0x1ad)]),0x1;throw _0xfb99e7;}}}export class SegmentFolderListCommand extends BaseCommand{[a32_0x5ca161(0x1d7)]='segment:folder:list';[a32_0x5ca161(0x14b)]='List\x20segment\x20folders\x20under\x20a\x20parent\x20segment';async['execute'](_0x29b21b){const _0x231be4=a32_0x5ca161,{options:_0x56547f,args:_0x26e41d,tdx:_0x3a5de9}=_0x29b21b;if(_0x26e41d[_0x231be4(0x173)]===0x0)return console[_0x231be4(0x19d)]('Error:\x20Parent\x20segment\x20name\x20is\x20required'),console[_0x231be4(0x19d)]('Usage:\x20tdx\x20segment\x20folder\x20list\x20<parent_name>'),0x1;const _0x9db852=_0x26e41d[0x0];try{_0x56547f[_0x231be4(0x1c9)]&&(console[_0x231be4(0x19d)](_0x231be4(0x162)+_0x56547f['site']),console['error']('Parent\x20name:\x20'+_0x9db852));const _0x547b05=await withSpinner(_0x231be4(0x1d8)+_0x9db852+_0x231be4(0x1ac),()=>_0x3a5de9[_0x231be4(0x1d6)][_0x231be4(0x172)](_0x9db852),{'verbose':_0x56547f[_0x231be4(0x1c9)]}),_0x16174e=_0x547b05[_0x231be4(0x1d1)];_0x56547f[_0x231be4(0x1c9)]&&console['error']('Resolved\x20parent\x20ID:\x20'+_0x16174e);const _0x598578=await withSpinner(_0x231be4(0x1bc)+_0x9db852+_0x231be4(0x1ac),()=>_0x3a5de9['segment'][_0x231be4(0x14f)](_0x16174e),{'verbose':_0x56547f[_0x231be4(0x1c9)]}),_0x34bd1f=_0x598578[_0x231be4(0x1d1)];return console[_0x231be4(0x19d)](_0x231be4(0x150)+_0x34bd1f[_0x231be4(0x173)]+_0x231be4(0x180)+(_0x34bd1f[_0x231be4(0x173)]!==0x1?'s':'')),await handleSDKOutput(_0x34bd1f,_0x56547f),0x0;}catch(_0x20c208){if(_0x20c208 instanceof SDKError)return console[_0x231be4(0x19d)](_0x231be4(0x1c1)+_0x20c208['message']),_0x20c208[_0x231be4(0x1a2)]&&console['error'](_0x231be4(0x153)+_0x20c208['cause']),0x1;throw _0x20c208;}}}export class SegmentFolderShowCommand extends BaseCommand{[a32_0x5ca161(0x1d7)]=a32_0x5ca161(0x1b4);[a32_0x5ca161(0x14b)]=a32_0x5ca161(0x160);async[a32_0x5ca161(0x1ca)](_0x499437){const _0xc0bf76=a32_0x5ca161,{options:_0x4969ff,args:_0x2a97f7,tdx:_0x956e03}=_0x499437;if(_0x2a97f7['length']===0x0)return console[_0xc0bf76(0x19d)](_0xc0bf76(0x1bd)),console['error'](_0xc0bf76(0x1c6)),0x1;try{const {parentId:_0xae96ef,childId:_0x4687ec}=parseSegmentRef(_0x2a97f7[0x0]);_0x4969ff[_0xc0bf76(0x1c9)]&&(console['error'](_0xc0bf76(0x162)+_0x4969ff[_0xc0bf76(0x1cf)]),console[_0xc0bf76(0x19d)](_0xc0bf76(0x16b)+_0xae96ef),_0x4687ec&&console[_0xc0bf76(0x19d)](_0xc0bf76(0x1a5)+_0x4687ec));if(!_0x4687ec)return console[_0xc0bf76(0x19d)](_0xc0bf76(0x16d)),0x1;const _0x2cc5ff=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xae96ef+_0xc0bf76(0x1ac),()=>_0x956e03[_0xc0bf76(0x1d6)][_0xc0bf76(0x172)](_0xae96ef),{'verbose':_0x4969ff[_0xc0bf76(0x1c9)]}),_0x33b336=_0x2cc5ff[_0xc0bf76(0x1d1)];_0x4969ff['verbose']&&console[_0xc0bf76(0x19d)](_0xc0bf76(0x1b6)+_0x33b336);const _0x379f30=await withSpinner(_0xc0bf76(0x19b)+_0x4687ec+'\x27...',()=>_0x956e03['segment'][_0xc0bf76(0x1b3)](_0x33b336,_0x4687ec),{'verbose':_0x4969ff['verbose']}),_0x2f264b=_0x379f30[_0xc0bf76(0x1d1)];_0x4969ff['verbose']&&console[_0xc0bf76(0x19d)](_0xc0bf76(0x174)+_0x2f264b);const _0x428d91=await withSpinner('Fetching\x20folder\x20\x27'+_0x4687ec+_0xc0bf76(0x1ac),()=>_0x956e03[_0xc0bf76(0x1d6)][_0xc0bf76(0x1da)](_0x2f264b),{'verbose':_0x4969ff[_0xc0bf76(0x1c9)]});return await handleSDKOutput([_0x428d91['data']],_0x4969ff),0x0;}catch(_0x8b88a5){if(_0x8b88a5 instanceof SDKError)return console[_0xc0bf76(0x19d)](_0xc0bf76(0x1c1)+_0x8b88a5[_0xc0bf76(0x1ad)]),_0x8b88a5[_0xc0bf76(0x1a2)]&&console[_0xc0bf76(0x19d)]('\x20\x20Cause:\x20'+_0x8b88a5[_0xc0bf76(0x1a2)]),0x1;throw _0x8b88a5;}}}export class SegmentSQLCommand extends BaseCommand{[a32_0x5ca161(0x1d7)]='segment:sql';[a32_0x5ca161(0x14b)]=a32_0x5ca161(0x16f);async['execute'](_0x5a810b){const _0x1b1ed7=a32_0x5ca161,{options:_0x22f2bf,args:_0x2ac8cb,tdx:_0x348d58}=_0x5a810b,_0x2d3740=_0x2ac8cb[0x0];if(!_0x2d3740)return console['error'](_0x1b1ed7(0x1ae)),console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x1c4)),console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x17b)),console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x1a0)),console[_0x1b1ed7(0x19d)]('\x20\x20tdx\x20sg\x20sql\x20\x22Premium\x20Users\x22'),console[_0x1b1ed7(0x19d)]('\x20\x20tdx\x20sg\x20sql\x20segments/my-audience/premium-users.yml'),0x1;try{const _0x1911cb=_0x22f2bf['parentSegment'],_0x8c91fd=resolveSegmentTarget(_0x2d3740,_0x1911cb,_0x22f2bf['verbose']);_0x22f2bf['verbose']&&console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x164)+_0x8c91fd);const _0x27b0e4=await withSpinner('Resolving\x20\x27'+_0x2d3740+'\x27...',()=>_0x348d58[_0x1b1ed7(0x1d6)][_0x1b1ed7(0x183)](_0x8c91fd),{'verbose':_0x22f2bf['verbose']}),_0x2416cc=_0x27b0e4[_0x1b1ed7(0x1d1)];_0x22f2bf[_0x1b1ed7(0x1c9)]&&(console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x19a)+_0x2416cc[_0x1b1ed7(0x196)]),console[_0x1b1ed7(0x19d)]('Parent\x20ID:\x20'+_0x2416cc[_0x1b1ed7(0x190)]));if(_0x2416cc['type']===_0x1b1ed7(0x176))return console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x17d)),console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x1d9)),0x1;if(_0x2416cc[_0x1b1ed7(0x196)]==='parent')return console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x1c8)),console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x187)),0x1;if(!_0x2416cc[_0x1b1ed7(0x1a4)])throw new SDKError(ErrorCode[_0x1b1ed7(0x1b2)],_0x1b1ed7(0x1bb));const _0x5b583c=await withSpinner(_0x1b1ed7(0x1c5),()=>_0x348d58[_0x1b1ed7(0x1d6)][_0x1b1ed7(0x17e)](_0x2416cc[_0x1b1ed7(0x190)],_0x2416cc['segmentId']),{'verbose':_0x22f2bf[_0x1b1ed7(0x1c9)]}),_0x498ab3=_0x5b583c[_0x1b1ed7(0x1d1)];return _0x22f2bf[_0x1b1ed7(0x18b)]===_0x1b1ed7(0x1a3)||_0x22f2bf[_0x1b1ed7(0x18b)]===_0x1b1ed7(0x15e)?await handleSDKOutput([{'sql':_0x498ab3}],_0x22f2bf):console['log'](_0x498ab3),0x0;}catch(_0xca630d){if(_0xca630d instanceof SDKError)return console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x1c1)+_0xca630d[_0x1b1ed7(0x1ad)]),_0xca630d[_0x1b1ed7(0x1a2)]&&console[_0x1b1ed7(0x19d)](_0x1b1ed7(0x153)+_0xca630d['cause']),0x1;throw _0xca630d;}}}export class SegmentFolderCreateCommand extends BaseCommand{[a32_0x5ca161(0x1d7)]=a32_0x5ca161(0x1b9);[a32_0x5ca161(0x14b)]='Create\x20segment\x20folder\x20for\x20organization';async[a32_0x5ca161(0x1ca)](_0x5e696f){const _0x29c4c6=a32_0x5ca161,{options:_0x546592,args:_0x34ec13,tdx:_0x2df0fc}=_0x5e696f,_0x20ed3e=_0x546592;if(_0x34ec13[_0x29c4c6(0x173)]<0x2)return console[_0x29c4c6(0x19d)]('Error:\x20Parent\x20segment\x20name\x20and\x20folder\x20name\x20are\x20required'),console['error']('Usage:\x20tdx\x20segment\x20folder\x20create\x20<parent_name>\x20<folder_name>\x20[options]'),0x1;const _0x37904b=_0x34ec13[0x0],_0x4d4cbd=_0x34ec13[0x1];_0x20ed3e['verbose']&&(console[_0x29c4c6(0x19d)]('Site:\x20'+_0x20ed3e[_0x29c4c6(0x1cf)]),console[_0x29c4c6(0x19d)](_0x29c4c6(0x171)+_0x37904b),console[_0x29c4c6(0x19d)](_0x29c4c6(0x1a5)+_0x4d4cbd));let _0x1c7b8e;if(_0x20ed3e[_0x29c4c6(0x1b1)]){const _0x3f6960=_0x20ed3e[_0x29c4c6(0x1b1)],_0xaba7d1=await withSpinner(_0x29c4c6(0x1d8)+_0x37904b+_0x29c4c6(0x1ac),()=>_0x2df0fc['segment'][_0x29c4c6(0x172)](_0x37904b),{'verbose':_0x20ed3e[_0x29c4c6(0x1c9)]}),_0x56fe33=_0xaba7d1['data'],_0x5a016d=await withSpinner('Resolving\x20parent\x20folder\x20\x27'+_0x3f6960+_0x29c4c6(0x1ac),()=>_0x2df0fc['segment'][_0x29c4c6(0x1b3)](_0x56fe33,_0x3f6960),{'verbose':_0x20ed3e[_0x29c4c6(0x1c9)]});_0x1c7b8e=_0x5a016d['data'],_0x20ed3e['verbose']&&console['error'](_0x29c4c6(0x1d4)+_0x1c7b8e);}const _0x2d9749={'name':_0x4d4cbd,'description':_0x20ed3e[_0x29c4c6(0x14b)],'parentFolderId':_0x1c7b8e},_0x25b7f7=await withSpinner(_0x29c4c6(0x1af)+_0x4d4cbd+'\x27...',()=>_0x2df0fc['segment'][_0x29c4c6(0x169)](_0x37904b,_0x2d9749),{'verbose':_0x20ed3e[_0x29c4c6(0x1c9)]}),_0x4e90a0=_0x25b7f7['data'];return console['error'](_0x29c4c6(0x1dd)+_0x4e90a0[_0x29c4c6(0x1d7)]+'\x27\x20with\x20ID:\x20'+_0x4e90a0['id']),await handleSDKOutput([_0x4e90a0],_0x20ed3e),0x0;}}export class SegmentViewCommand extends BaseCommand{['name']='segment:view';[a32_0x5ca161(0x14b)]=a32_0x5ca161(0x15f);async[a32_0x5ca161(0x1ca)](_0x209a71){const _0x280ad0=a32_0x5ca161,{options:_0x2cf270,args:_0x5232fc,tdx:_0x47657c}=_0x209a71,_0x5840d3=_0x5232fc[0x0];if(!_0x5840d3)return console[_0x280ad0(0x19d)](_0x280ad0(0x1b5)),console['error'](_0x280ad0(0x16a)),console[_0x280ad0(0x19d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20view\x20<path/to/segment.yml>'),console[_0x280ad0(0x19d)]('Options:'),console[_0x280ad0(0x19d)](_0x280ad0(0x1a6)),console[_0x280ad0(0x19d)](_0x280ad0(0x1a0)),console[_0x280ad0(0x19d)]('\x20\x20tdx\x20sg\x20view\x20\x22Marketing\x22\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20folder\x20details'),console[_0x280ad0(0x19d)](_0x280ad0(0x15c)),console[_0x280ad0(0x19d)]('\x20\x20tdx\x20sg\x20view\x20\x22Premium\x20Users\x22\x20-w\x20\x20#\x20Open\x20segment\x20in\x20web\x20browser'),console[_0x280ad0(0x19d)](_0x280ad0(0x17c)),0x1;try{const _0x8c8652=_0x2cf270[_0x280ad0(0x149)],_0xcd70c4=resolveSegmentTarget(_0x5840d3,_0x8c8652,_0x2cf270[_0x280ad0(0x1c9)]);_0x2cf270[_0x280ad0(0x1c9)]&&console[_0x280ad0(0x19d)](_0x280ad0(0x164)+_0xcd70c4);const _0xff013a=await withSpinner(_0x280ad0(0x16e)+_0x5840d3+_0x280ad0(0x1ac),()=>_0x47657c[_0x280ad0(0x1d6)][_0x280ad0(0x183)](_0xcd70c4),{'verbose':_0x2cf270['verbose']}),_0x11cc85=_0xff013a['data'];_0x2cf270[_0x280ad0(0x1c9)]&&(console[_0x280ad0(0x19d)](_0x280ad0(0x19a)+_0x11cc85[_0x280ad0(0x196)]),console[_0x280ad0(0x19d)]('Parent\x20ID:\x20'+_0x11cc85[_0x280ad0(0x190)]),_0x11cc85['folderId']&&console[_0x280ad0(0x19d)](_0x280ad0(0x194)+_0x11cc85[_0x280ad0(0x182)]),_0x11cc85[_0x280ad0(0x1a4)]&&console[_0x280ad0(0x19d)]('Segment\x20ID:\x20'+_0x11cc85[_0x280ad0(0x1a4)]));if(_0x2cf270[_0x280ad0(0x15b)]){if(_0x11cc85[_0x280ad0(0x196)]===_0x280ad0(0x176))return console[_0x280ad0(0x19d)]('Error:\x20Cannot\x20open\x20folder\x20in\x20web\x20browser.\x20Use\x20a\x20segment\x20name\x20instead.'),0x1;if(_0x11cc85[_0x280ad0(0x196)]===_0x280ad0(0x1cd))return console['error'](_0x280ad0(0x178)),console[_0x280ad0(0x19d)]('Use:\x20tdx\x20ps\x20view\x20-w'),0x1;if(!_0x11cc85[_0x280ad0(0x1a4)])throw new SDKError(ErrorCode[_0x280ad0(0x1b2)],_0x280ad0(0x1bb));const _0x160783=getConsoleNextUrl(_0x2cf270[_0x280ad0(0x1cf)],_0x280ad0(0x14d)+_0x11cc85['parentId']+'/e/'+_0x11cc85[_0x280ad0(0x1a4)]);return console[_0x280ad0(0x19d)](a32_0x2f50a3[_0x280ad0(0x168)]('✔')+_0x280ad0(0x1db)+a32_0x2f50a3[_0x280ad0(0x1c7)](_0x160783)),openBrowser(_0x160783),0x0;}if(_0x11cc85[_0x280ad0(0x196)]==='folder'){if(!_0x11cc85[_0x280ad0(0x182)])throw new SDKError(ErrorCode[_0x280ad0(0x199)],_0x280ad0(0x159));const _0x5e0614=await withSpinner(_0x280ad0(0x1cb),()=>_0x47657c[_0x280ad0(0x1d6)][_0x280ad0(0x1da)](_0x11cc85[_0x280ad0(0x182)]),{'verbose':_0x2cf270['verbose']});await handleSingleObjectOutput(_0x5e0614[_0x280ad0(0x1d1)],_0x2cf270);}else{if(_0x11cc85[_0x280ad0(0x196)]===_0x280ad0(0x1d6)){if(!_0x11cc85[_0x280ad0(0x1a4)])throw new SDKError(ErrorCode[_0x280ad0(0x1b2)],_0x280ad0(0x1bb));const _0x221b22=await withSpinner('Fetching\x20segment\x20details...',()=>_0x47657c[_0x280ad0(0x1d6)][_0x280ad0(0x193)](_0x11cc85[_0x280ad0(0x190)],_0x11cc85[_0x280ad0(0x1a4)]),{'verbose':_0x2cf270['verbose']}),_0x52ef69=getConsoleNextUrl(_0x2cf270[_0x280ad0(0x1cf)],'/app/ps/'+_0x11cc85['parentId']+_0x280ad0(0x18c)+_0x11cc85[_0x280ad0(0x1a4)]),_0x577c26=_0x221b22['data'];_0x577c26[_0x280ad0(0x18d)]=_0x52ef69,await handleSingleObjectOutput(_0x577c26,_0x2cf270);}else return console['error'](_0x280ad0(0x165)),console[_0x280ad0(0x19d)](_0x280ad0(0x156)),0x1;}return 0x0;}catch(_0x4eee13){if(_0x4eee13 instanceof SDKError)return console[_0x280ad0(0x19d)](_0x280ad0(0x1c1)+_0x4eee13[_0x280ad0(0x1ad)]),_0x4eee13['cause']&&console[_0x280ad0(0x19d)](_0x280ad0(0x153)+_0x4eee13[_0x280ad0(0x1a2)]),0x1;throw _0x4eee13;}}}export const SegmentInfoCommand=SegmentViewCommand;export class SegmentDescCommand extends BaseCommand{[a32_0x5ca161(0x1d7)]='segment:desc';[a32_0x5ca161(0x14b)]=a32_0x5ca161(0x1a8);async[a32_0x5ca161(0x1ca)](_0x282696){const _0x4cef6e=a32_0x5ca161,{options:_0x48b709,args:_0x5b4633,tdx:_0x1a7472}=_0x282696,_0x3843e8=_0x5b4633[0x0];if(!_0x3843e8)return console['error'](_0x4cef6e(0x1ae)),console[_0x4cef6e(0x19d)](_0x4cef6e(0x181)),console[_0x4cef6e(0x19d)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20sg\x20desc\x20<path/to/segment.yml>'),console[_0x4cef6e(0x19d)](_0x4cef6e(0x1a0)),console[_0x4cef6e(0x19d)]('\x20\x20tdx\x20sg\x20desc\x20\x22Premium\x20Users\x22'),console[_0x4cef6e(0x19d)](_0x4cef6e(0x1d5)),0x1;try{const _0x447d8d=_0x48b709['parentSegment'],_0x37477a=resolveSegmentTarget(_0x3843e8,_0x447d8d,_0x48b709[_0x4cef6e(0x1c9)]);_0x48b709[_0x4cef6e(0x1c9)]&&console[_0x4cef6e(0x19d)](_0x4cef6e(0x164)+_0x37477a);const _0x133648=await withSpinner('Resolving\x20\x27'+_0x3843e8+_0x4cef6e(0x1ac),()=>_0x1a7472[_0x4cef6e(0x1d6)][_0x4cef6e(0x183)](_0x37477a),{'verbose':_0x48b709[_0x4cef6e(0x1c9)]}),_0x878225=_0x133648[_0x4cef6e(0x1d1)];_0x48b709[_0x4cef6e(0x1c9)]&&(console[_0x4cef6e(0x19d)](_0x4cef6e(0x19a)+_0x878225[_0x4cef6e(0x196)]),console[_0x4cef6e(0x19d)](_0x4cef6e(0x15a)+_0x878225['parentId']));if(_0x878225[_0x4cef6e(0x196)]==='folder')return console['error']('Error:\x20Cannot\x20show\x20schema\x20for\x20a\x20folder.'),console['error'](_0x4cef6e(0x1d9)),0x1;if(_0x878225['type']===_0x4cef6e(0x1cd))return console['error'](_0x4cef6e(0x19f)),console[_0x4cef6e(0x19d)](_0x4cef6e(0x16c)),0x1;if(!_0x878225['segmentId'])throw new SDKError(ErrorCode[_0x4cef6e(0x1b2)],_0x4cef6e(0x1bb));const _0x2bff35=await withSpinner(_0x4cef6e(0x1c5),()=>_0x1a7472['segment']['getSegmentSQL'](_0x878225[_0x4cef6e(0x190)],_0x878225[_0x4cef6e(0x1a4)]),{'verbose':_0x48b709[_0x4cef6e(0x1c9)]}),_0x117158=_0x2bff35['data'],_0x453ab6=await executeSchemaQuery(_0x117158,_0x1a7472,_0x48b709);return await handleQueryOutput(_0x453ab6,_0x48b709),0x0;}catch(_0x3fd6d9){if(_0x3fd6d9 instanceof SDKError)return console[_0x4cef6e(0x19d)](_0x4cef6e(0x1c1)+_0x3fd6d9[_0x4cef6e(0x1ad)]),_0x3fd6d9[_0x4cef6e(0x1a2)]&&console[_0x4cef6e(0x19d)](_0x4cef6e(0x153)+_0x3fd6d9[_0x4cef6e(0x1a2)]),0x1;throw _0x3fd6d9;}}}
@@ -1 +1 @@
1
- const a33_0x35c08b=a33_0x50ef;(function(_0x45974e,_0x1341a8){const _0x8889f9=a33_0x50ef,_0x751cb=_0x45974e();while(!![]){try{const _0x4cd013=parseInt(_0x8889f9(0x1e2))/0x1*(-parseInt(_0x8889f9(0x1de))/0x2)+parseInt(_0x8889f9(0x1fa))/0x3*(parseInt(_0x8889f9(0x1e3))/0x4)+parseInt(_0x8889f9(0x1f8))/0x5*(-parseInt(_0x8889f9(0x1ed))/0x6)+parseInt(_0x8889f9(0x1df))/0x7*(-parseInt(_0x8889f9(0x1f2))/0x8)+-parseInt(_0x8889f9(0x1cc))/0x9+-parseInt(_0x8889f9(0x1cb))/0xa*(-parseInt(_0x8889f9(0x1c5))/0xb)+parseInt(_0x8889f9(0x1c4))/0xc;if(_0x4cd013===_0x1341a8)break;else _0x751cb['push'](_0x751cb['shift']());}catch(_0x444876){_0x751cb['push'](_0x751cb['shift']());}}}(a33_0xbc7f,0x29a6d));import{BaseCommand}from'./command.js';function a33_0x50ef(_0x555855,_0x12fbe0){_0x555855=_0x555855-0x1c1;const _0xbc7f99=a33_0xbc7f();let _0x50ef46=_0xbc7f99[_0x555855];return _0x50ef46;}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';import a33_0x246cc4 from'chalk';export class SegmentCreateCommand extends BaseCommand{[a33_0x35c08b(0x1f7)]=a33_0x35c08b(0x1db);[a33_0x35c08b(0x1d6)]=a33_0x35c08b(0x1d1);async[a33_0x35c08b(0x1f1)](_0x1313a8){const _0x41e742=a33_0x35c08b;console[_0x41e742(0x1c9)](a33_0x246cc4[_0x41e742(0x1fc)](_0x41e742(0x1e4))),console[_0x41e742(0x1c9)](a33_0x246cc4[_0x41e742(0x1fc)](_0x41e742(0x1ea)));const {options:_0x356d1c,args:_0x5d57ab,tdx:_0x37809c}=_0x1313a8,_0x4db96b=_0x356d1c;if(_0x5d57ab[_0x41e742(0x1cd)]===0x0)return console[_0x41e742(0x1c9)]('Error:\x20Segment\x20path\x20or\x20name\x20is\x20required'),console[_0x41e742(0x1c9)](_0x41e742(0x1ec)),console[_0x41e742(0x1c9)](_0x41e742(0x1c7)),console[_0x41e742(0x1c9)]('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x41e742(0x1c9)](_0x41e742(0x1d9)),console[_0x41e742(0x1c9)](_0x41e742(0x1e6)),0x1;const _0xa0f0c0=_0x5d57ab[0x0],_0x3c3c91=_0x356d1c[_0x41e742(0x1c6)];let _0x377949=_0xa0f0c0;_0x3c3c91&&!_0xa0f0c0[_0x41e742(0x1cf)]('/')&&(_0x377949=_0x3c3c91+'/'+_0xa0f0c0,_0x4db96b[_0x41e742(0x1e1)]&&console[_0x41e742(0x1c9)](_0x41e742(0x1fb)+_0x377949));const _0x57cec9=parsePath(_0x377949);if(_0x57cec9[_0x41e742(0x1f0)][_0x41e742(0x1cd)]<0x2)return console[_0x41e742(0x1c9)](_0x41e742(0x1e8)),console['error'](_0x41e742(0x1c1)),0x1;const _0xd33804=_0x57cec9[_0x41e742(0x1f0)][0x0],_0x492cee=getBaseName(_0x377949),_0xd460dc=getParentPath(_0x377949);_0x4db96b[_0x41e742(0x1e1)]&&(console[_0x41e742(0x1c9)](_0x41e742(0x1d4)+_0x4db96b['site']),console['error'](_0x41e742(0x1c8)+_0x377949),console[_0x41e742(0x1c9)](_0x41e742(0x1dc)+_0xd33804),console[_0x41e742(0x1c9)](_0x41e742(0x1e9)+_0x492cee),console[_0x41e742(0x1c9)]('Parent\x20path:\x20'+_0xd460dc));const _0x47fcdf=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0xd33804+'\x27...',()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1d2)](_0xd33804),{'verbose':_0x4db96b[_0x41e742(0x1e1)]}),_0x457bb6=_0x47fcdf[_0x41e742(0x1c2)];let _0x2afd71;if(_0x57cec9[_0x41e742(0x1f0)]['length']>0x2){const _0x10b9a7=await withSpinner(_0x41e742(0x1ca)+_0xd460dc+_0x41e742(0x1da),()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1d0)](_0xd460dc),{'verbose':_0x4db96b[_0x41e742(0x1e1)]}),_0x1c0b59=_0x10b9a7[_0x41e742(0x1c2)];if(_0x1c0b59[_0x41e742(0x1ee)]!==_0x41e742(0x1d5)&&_0x1c0b59[_0x41e742(0x1ee)]!==_0x41e742(0x1c3))return console[_0x41e742(0x1c9)](_0x41e742(0x1e0)),0x1;_0x2afd71=_0x1c0b59[_0x41e742(0x1e7)];}else{if(_0x4db96b['folder']){const _0x360392=await withSpinner(_0x41e742(0x1d7)+_0x4db96b[_0x41e742(0x1d5)]+'\x27...',()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1f3)](_0x457bb6,_0x4db96b[_0x41e742(0x1d5)]),{'verbose':_0x4db96b[_0x41e742(0x1e1)]});_0x2afd71=_0x360392[_0x41e742(0x1c2)];}}_0x4db96b[_0x41e742(0x1e1)]&&_0x2afd71&&console[_0x41e742(0x1c9)]('Resolved\x20folder\x20ID:\x20'+_0x2afd71);const _0x57a0f0=await loadJSONFromOptions(_0x4db96b[_0x41e742(0x1eb)],_0x4db96b[_0x41e742(0x1ef)]),_0x19da05={'name':_0x492cee,'description':_0x4db96b[_0x41e742(0x1d6)],'rule':_0x57a0f0,'kind':_0x4db96b[_0x41e742(0x1f4)]!==undefined?parseInt(_0x4db96b[_0x41e742(0x1f4)],0xa):undefined,'isVisible':_0x4db96b[_0x41e742(0x1f5)]?![]:undefined,'segmentFolderId':_0x2afd71,'countPopulation':_0x4db96b[_0x41e742(0x1f9)]?![]:undefined},_0x2d7c6d=await withSpinner(_0x41e742(0x1f6)+_0x492cee+_0x41e742(0x1da),()=>_0x37809c[_0x41e742(0x1ce)][_0x41e742(0x1dd)](_0x457bb6,_0x19da05),{'verbose':_0x4db96b['verbose']}),_0x884783=_0x2d7c6d[_0x41e742(0x1c2)];return console['error'](_0x41e742(0x1d3)+_0x884783[_0x41e742(0x1f7)]+_0x41e742(0x1d8)+_0x884783['id']),_0x377949!==_0xa0f0c0&&console[_0x41e742(0x1c9)](_0x41e742(0x1e5)+_0x377949),await handleSDKOutput([_0x884783],_0x4db96b),0x0;}}function a33_0xbc7f(){const _0x2e2724=['type','ruleFile','segments','execute','88iMaRwa','resolveFolderId','kind','invisible','Creating\x20segment\x20\x27','name','205Qjzozb','noCountPopulation','82623TqOsNv','Resolved\x20relative\x20path\x20to:\x20','yellow','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','data','parent','8373204LvJnxh','11HWdRVs','segmentPath','Examples:','Target\x20path:\x20','error','Resolving\x20folder\x20path\x20\x27','1221430VYWueY','1685340RgVuTx','length','segment','includes','resolvePathToResource','Create\x20child\x20segment\x20with\x20filtering\x20rules','resolveParentId','✔\x20Created\x20segment\x20\x27','Site:\x20','folder','description','Resolving\x20folder\x20\x27','\x27\x20with\x20ID:\x20','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','\x27...','segment:create','Parent:\x20','createSegment','2WIEbrL','63119ejvCdB','Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.','verbose','268290XJouyT','8VMkZTE','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x20\x20\x20Path:\x20','\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context','folderId','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Segment\x20name:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','rule','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','21900AvTrXY'];a33_0xbc7f=function(){return _0x2e2724;};return a33_0xbc7f();}
1
+ const a33_0x55c0b3=a33_0x3ea3;(function(_0x28d012,_0x4d8a3f){const _0x5c9e8f=a33_0x3ea3,_0x313f95=_0x28d012();while(!![]){try{const _0x4397b3=parseInt(_0x5c9e8f(0x197))/0x1+parseInt(_0x5c9e8f(0x196))/0x2*(-parseInt(_0x5c9e8f(0x17f))/0x3)+parseInt(_0x5c9e8f(0x180))/0x4*(-parseInt(_0x5c9e8f(0x188))/0x5)+parseInt(_0x5c9e8f(0x178))/0x6*(-parseInt(_0x5c9e8f(0x19e))/0x7)+parseInt(_0x5c9e8f(0x171))/0x8*(-parseInt(_0x5c9e8f(0x189))/0x9)+-parseInt(_0x5c9e8f(0x190))/0xa+parseInt(_0x5c9e8f(0x199))/0xb;if(_0x4397b3===_0x4d8a3f)break;else _0x313f95['push'](_0x313f95['shift']());}catch(_0x4fa517){_0x313f95['push'](_0x313f95['shift']());}}}(a33_0x24da,0x92da8));import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a33_0x3ea3(_0x254ca1,_0x3da872){_0x254ca1=_0x254ca1-0x16c;const _0x24da49=a33_0x24da();let _0x3ea3eb=_0x24da49[_0x254ca1];return _0x3ea3eb;}import{loadJSONFromOptions}from'../utils/json-loader.js';import{parsePath,getParentPath,getBaseName}from'../utils/segment-path-parser.js';function a33_0x24da(){const _0x231f78=['10wjDQEe','36657KfXgDn','rule','segment:create','error','segments','createSegment','Create\x20child\x20segment\x20with\x20filtering\x20rules','1289420HnZxka','Target\x20path:\x20','⚠\x20Deprecation\x20warning:\x20`segment\x20create`\x20is\x20deprecated.','\x27...','invisible','Resolving\x20folder\x20path\x20\x27','10vGmmEf','537925diHZGF','noCountPopulation','29003755RpJFPF','site','name','\x27\x20with\x20ID:\x20','Creating\x20segment\x20\x27','534968BSjXaJ','Resolving\x20folder\x20\x27','✔\x20Created\x20segment\x20\x27','resolveParentId','Resolved\x20relative\x20path\x20to:\x20','length','parent','resolvePathToResource','Site:\x20','ruleFile','description','yellow','Resolving\x20parent\x20segment\x20\x27','88nrKWak','Parent:\x20','\x20\x20Use\x20`tdx\x20sg\x20push`\x20with\x20YAML\x20files\x20instead.\x0a','Usage:\x20tdx\x20segment\x20create\x20<parent/segment_name>\x20[options]','Error:\x20Full\x20path\x20required\x20(parent/segment_name\x20or\x20parent/folder/segment_name)','Resolved\x20folder\x20ID:\x20','Segment\x20name:\x20','78rREfdW','verbose','resolveFolderId','segment','Error:\x20Segment\x20path\x20or\x20name\x20is\x20required','folderId','Usage:\x20tdx\x20segment\x20create\x20<path>\x20[options]','440805oMXzqX','1342372JpKZQb','folder','data','\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/Marketing/Premium\x22\x20--rule\x20\x27...\x27','execute','type','Examples:','kind'];a33_0x24da=function(){return _0x231f78;};return a33_0x24da();}import a33_0x168e7b from'chalk';export class SegmentCreateCommand extends BaseCommand{['name']=a33_0x55c0b3(0x18b);[a33_0x55c0b3(0x16e)]=a33_0x55c0b3(0x18f);async[a33_0x55c0b3(0x184)](_0x19af63){const _0x56dc8b=a33_0x55c0b3;console['error'](a33_0x168e7b[_0x56dc8b(0x16f)](_0x56dc8b(0x192))),console[_0x56dc8b(0x18c)](a33_0x168e7b[_0x56dc8b(0x16f)](_0x56dc8b(0x173)));const {options:_0x164f44,args:_0x5e9014,tdx:_0x1372c4}=_0x19af63,_0x45ac0d=_0x164f44;if(_0x5e9014[_0x56dc8b(0x1a3)]===0x0)return console[_0x56dc8b(0x18c)](_0x56dc8b(0x17c)),console[_0x56dc8b(0x18c)](_0x56dc8b(0x17e)),console[_0x56dc8b(0x18c)](_0x56dc8b(0x186)),console['error']('\x20\x20tdx\x20segment\x20create\x20\x22My\x20Audience/High\x20Value\x22\x20--rule\x20\x27...\x27'),console[_0x56dc8b(0x18c)](_0x56dc8b(0x183)),console[_0x56dc8b(0x18c)]('\x20\x20tdx\x20segment\x20create\x20\x22Premium\x22\x20--rule\x20\x27...\x27\x20\x20#\x20Relative\x20to\x20context'),0x1;const _0xc6165=_0x5e9014[0x0],_0x2fd268=_0x164f44['segmentPath'];let _0x38c0f0=_0xc6165;_0x2fd268&&!_0xc6165['includes']('/')&&(_0x38c0f0=_0x2fd268+'/'+_0xc6165,_0x45ac0d['verbose']&&console[_0x56dc8b(0x18c)](_0x56dc8b(0x1a2)+_0x38c0f0));const _0x8bbd5e=parsePath(_0x38c0f0);if(_0x8bbd5e[_0x56dc8b(0x18d)][_0x56dc8b(0x1a3)]<0x2)return console[_0x56dc8b(0x18c)](_0x56dc8b(0x175)),console[_0x56dc8b(0x18c)](_0x56dc8b(0x174)),0x1;const _0x30697e=_0x8bbd5e[_0x56dc8b(0x18d)][0x0],_0x440918=getBaseName(_0x38c0f0),_0x210775=getParentPath(_0x38c0f0);_0x45ac0d['verbose']&&(console[_0x56dc8b(0x18c)](_0x56dc8b(0x16c)+_0x45ac0d[_0x56dc8b(0x19a)]),console[_0x56dc8b(0x18c)](_0x56dc8b(0x191)+_0x38c0f0),console[_0x56dc8b(0x18c)](_0x56dc8b(0x172)+_0x30697e),console[_0x56dc8b(0x18c)](_0x56dc8b(0x177)+_0x440918),console[_0x56dc8b(0x18c)]('Parent\x20path:\x20'+_0x210775));const _0x6868bb=await withSpinner(_0x56dc8b(0x170)+_0x30697e+_0x56dc8b(0x193),()=>_0x1372c4[_0x56dc8b(0x17b)][_0x56dc8b(0x1a1)](_0x30697e),{'verbose':_0x45ac0d[_0x56dc8b(0x179)]}),_0x4a1156=_0x6868bb[_0x56dc8b(0x182)];let _0x5426ab;if(_0x8bbd5e[_0x56dc8b(0x18d)]['length']>0x2){const _0x3020e2=await withSpinner(_0x56dc8b(0x195)+_0x210775+_0x56dc8b(0x193),()=>_0x1372c4[_0x56dc8b(0x17b)][_0x56dc8b(0x1a5)](_0x210775),{'verbose':_0x45ac0d[_0x56dc8b(0x179)]}),_0x2d3b00=_0x3020e2[_0x56dc8b(0x182)];if(_0x2d3b00[_0x56dc8b(0x185)]!=='folder'&&_0x2d3b00[_0x56dc8b(0x185)]!==_0x56dc8b(0x1a4))return console[_0x56dc8b(0x18c)]('Error:\x20Cannot\x20create\x20segment\x20in\x20a\x20segment.\x20Parent\x20path\x20must\x20be\x20a\x20folder\x20or\x20parent.'),0x1;_0x5426ab=_0x2d3b00[_0x56dc8b(0x17d)];}else{if(_0x45ac0d[_0x56dc8b(0x181)]){const _0x21b6b1=await withSpinner(_0x56dc8b(0x19f)+_0x45ac0d['folder']+_0x56dc8b(0x193),()=>_0x1372c4[_0x56dc8b(0x17b)][_0x56dc8b(0x17a)](_0x4a1156,_0x45ac0d[_0x56dc8b(0x181)]),{'verbose':_0x45ac0d[_0x56dc8b(0x179)]});_0x5426ab=_0x21b6b1[_0x56dc8b(0x182)];}}_0x45ac0d[_0x56dc8b(0x179)]&&_0x5426ab&&console[_0x56dc8b(0x18c)](_0x56dc8b(0x176)+_0x5426ab);const _0x18eca7=await loadJSONFromOptions(_0x45ac0d[_0x56dc8b(0x18a)],_0x45ac0d[_0x56dc8b(0x16d)]),_0x10e5dc={'name':_0x440918,'description':_0x45ac0d[_0x56dc8b(0x16e)],'rule':_0x18eca7,'kind':_0x45ac0d[_0x56dc8b(0x187)]!==undefined?parseInt(_0x45ac0d['kind'],0xa):undefined,'isVisible':_0x45ac0d[_0x56dc8b(0x194)]?![]:undefined,'segmentFolderId':_0x5426ab,'countPopulation':_0x45ac0d[_0x56dc8b(0x198)]?![]:undefined},_0x58db08=await withSpinner(_0x56dc8b(0x19d)+_0x440918+_0x56dc8b(0x193),()=>_0x1372c4[_0x56dc8b(0x17b)][_0x56dc8b(0x18e)](_0x4a1156,_0x10e5dc),{'verbose':_0x45ac0d[_0x56dc8b(0x179)]}),_0x4a7381=_0x58db08[_0x56dc8b(0x182)];return console['error'](_0x56dc8b(0x1a0)+_0x4a7381[_0x56dc8b(0x19b)]+_0x56dc8b(0x19c)+_0x4a7381['id']),_0x38c0f0!==_0xc6165&&console['error']('\x20\x20\x20Path:\x20'+_0x38c0f0),await handleSDKOutput([_0x4a7381],_0x45ac0d),0x0;}}