@treasuredata/tdx 0.26.2 → 0.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/mcp-command.js +1 -1
  24. package/dist/commands/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/schedule-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/passthrough-server.js +1 -1
  66. package/dist/proxy/sse-usage-parser.js +1 -1
  67. package/dist/sdk/agent/agent-config.js +1 -1
  68. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.js +1 -1
  70. package/dist/sdk/agent/test/evaluator.js +1 -1
  71. package/dist/sdk/agent/test/executor.js +1 -1
  72. package/dist/sdk/agent/test/index.js +1 -1
  73. package/dist/sdk/agent/test/output.js +1 -1
  74. package/dist/sdk/agent/test/parser.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/client/cdp-api-client.js +1 -1
  77. package/dist/sdk/client/endpoints.js +1 -1
  78. package/dist/sdk/client/engage-api-client.js +1 -1
  79. package/dist/sdk/client/http-client.js +1 -1
  80. package/dist/sdk/client/llm-api-client.js +1 -1
  81. package/dist/sdk/client/rate-limiter.js +1 -1
  82. package/dist/sdk/client/td-api-client.js +1 -1
  83. package/dist/sdk/client/trino-api-client.js +1 -1
  84. package/dist/sdk/client/workflow-client.js +1 -1
  85. package/dist/sdk/connection-validator.js +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/engage.js +1 -1
  88. package/dist/sdk/errors.js +1 -1
  89. package/dist/sdk/index.js +1 -1
  90. package/dist/sdk/io/index.js +1 -1
  91. package/dist/sdk/io/node-filesystem.js +1 -1
  92. package/dist/sdk/job.js +1 -1
  93. package/dist/sdk/journey.js +1 -1
  94. package/dist/sdk/llm/chat-cache.js +1 -1
  95. package/dist/sdk/llm/index.js +1 -1
  96. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  97. package/dist/sdk/llm/model-factors.js +1 -1
  98. package/dist/sdk/personalization.js +1 -1
  99. package/dist/sdk/query/index.js +1 -1
  100. package/dist/sdk/query/sql-parser.js +1 -1
  101. package/dist/sdk/realtime.js +1 -1
  102. package/dist/sdk/schedule.js +1 -1
  103. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  104. package/dist/sdk/segment/fields-display.js +1 -1
  105. package/dist/sdk/segment/file-discovery.js +1 -1
  106. package/dist/sdk/segment/journey-utils.js +1 -1
  107. package/dist/sdk/segment/journey-validator.js +1 -1
  108. package/dist/sdk/segment/journey-yaml.js +1 -1
  109. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  110. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  111. package/dist/sdk/segment/pull-workflow.js +1 -1
  112. package/dist/sdk/segment/push-recovery.js +1 -1
  113. package/dist/sdk/segment/push-workflow.js +1 -1
  114. package/dist/sdk/segment/resolution-context.js +1 -1
  115. package/dist/sdk/segment/segment-path-parser.js +1 -1
  116. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  117. package/dist/sdk/segment/target-resolution.js +1 -1
  118. package/dist/sdk/segment/tdx-config.js +1 -1
  119. package/dist/sdk/segment/validate-files.js +1 -1
  120. package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
  121. package/dist/sdk/segment/yaml-validator.js +1 -1
  122. package/dist/sdk/segment/yaml-validator.js.map +1 -1
  123. package/dist/sdk/segment.js +1 -1
  124. package/dist/sdk/types/index.js +1 -1
  125. package/dist/sdk/types/progress.js +1 -1
  126. package/dist/sdk/user.js +1 -1
  127. package/dist/sdk/util/format-detector.js +1 -1
  128. package/dist/sdk/util/formatters.js +1 -1
  129. package/dist/sdk/util/index.js +1 -1
  130. package/dist/sdk/util/tree-formatter.js +1 -1
  131. package/dist/sdk/workflow/archive-validation.js +1 -1
  132. package/dist/sdk/workflow/clone-workflow.js +1 -1
  133. package/dist/sdk/workflow/index.js +1 -1
  134. package/dist/sdk/workflow/pull-workflow.js +1 -1
  135. package/dist/sdk/workflow/push-workflow.js +1 -1
  136. package/dist/sdk/workflow/tdx-config.js +1 -1
  137. package/dist/sdk/workflow/workflow-utils.js +1 -1
  138. package/dist/test-utils/command-runner.js +1 -1
  139. package/dist/test-utils/factories.js +1 -1
  140. package/dist/test-utils/fixtures.js +1 -1
  141. package/dist/test-utils/http-mock.js +1 -1
  142. package/dist/test-utils/index.js +1 -1
  143. package/dist/utils/async.js +1 -1
  144. package/dist/utils/colors.js +1 -1
  145. package/dist/utils/diff.js +1 -1
  146. package/dist/utils/file-permissions.js +1 -1
  147. package/dist/utils/global-cache.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/local-cache.js +1 -1
  150. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  151. package/dist/utils/logger/formatters/index.js +1 -1
  152. package/dist/utils/logger/handlers/console-handler.js +1 -1
  153. package/dist/utils/logger/handlers/file-handler.js +1 -1
  154. package/dist/utils/logger/handlers/index.js +1 -1
  155. package/dist/utils/logger/handlers/null-handler.js +1 -1
  156. package/dist/utils/logger/index.js +1 -1
  157. package/dist/utils/logger/logger.js +1 -1
  158. package/dist/utils/logger/types.js +1 -1
  159. package/dist/utils/option-validation.js +1 -1
  160. package/dist/utils/port.js +1 -1
  161. package/dist/utils/process.js +1 -1
  162. package/dist/utils/prompt.js +1 -1
  163. package/dist/utils/spinner.js +1 -1
  164. package/dist/utils/sse-parser.js +1 -1
  165. package/dist/utils/string-utils.js +1 -1
  166. package/dist/utils/table-ref-parser.js +1 -1
  167. package/dist/utils/tdx-logger.js +1 -1
  168. package/dist/utils/version-check.js +1 -1
  169. package/package.json +1 -1
@@ -1 +1 @@
1
- const a22_0x498e22=a22_0x4b09;(function(_0x18f371,_0x2e531d){const _0xe53170=a22_0x4b09,_0x40a8f5=_0x18f371();while(!![]){try{const _0xd2624e=parseInt(_0xe53170(0x16c))/0x1+parseInt(_0xe53170(0x125))/0x2+-parseInt(_0xe53170(0x1e8))/0x3+parseInt(_0xe53170(0x196))/0x4+parseInt(_0xe53170(0x1d4))/0x5*(-parseInt(_0xe53170(0x122))/0x6)+-parseInt(_0xe53170(0x1b0))/0x7*(-parseInt(_0xe53170(0x1de))/0x8)+-parseInt(_0xe53170(0xb8))/0x9;if(_0xd2624e===_0x2e531d)break;else _0x40a8f5['push'](_0x40a8f5['shift']());}catch(_0x4db36c){_0x40a8f5['push'](_0x40a8f5['shift']());}}}(a22_0xed35,0x49f0a));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x454523 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x58cf01 from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x498e22(0x193),LEGACY_PARENT_SEGMENT_DIR=a22_0x498e22(0x138);function openBrowser(_0x2220ed){const _0x45e8ac=a22_0x498e22,_0x1a0d25=process[_0x45e8ac(0x203)],_0x28d987=_0x1a0d25===_0x45e8ac(0x161)?_0x45e8ac(0x1d5):_0x1a0d25===_0x45e8ac(0x179)?_0x45e8ac(0x166):_0x45e8ac(0xd2);spawn(_0x28d987,[_0x2220ed],{'detached':!![],'stdio':_0x45e8ac(0x10e)})[_0x45e8ac(0x12f)]();}function migrateLegacyDirectory(){const _0x2b7605=a22_0x498e22;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x5d9fe6=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x5d9fe6[_0x2b7605(0x1e0)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x2b7605(0x1a9)](a22_0x58cf01[_0x2b7605(0x204)]('\x0a⚠️\x20\x20Both\x20'+LEGACY_PARENT_SEGMENT_DIR+'/\x20and\x20'+PARENT_SEGMENT_DIR+_0x2b7605(0x1a1))),console[_0x2b7605(0x1a9)](a22_0x58cf01[_0x2b7605(0x1db)](_0x2b7605(0xab)+LEGACY_PARENT_SEGMENT_DIR+_0x2b7605(0x1c1))),![];console[_0x2b7605(0x1a9)](a22_0x58cf01[_0x2b7605(0x204)]('\x0a⚠️\x20\x20Migrating:\x20'+LEGACY_PARENT_SEGMENT_DIR+_0x2b7605(0xe3)+PARENT_SEGMENT_DIR+'/\x0a'));try{return renameSync(LEGACY_PARENT_SEGMENT_DIR,PARENT_SEGMENT_DIR),console[_0x2b7605(0x1a9)](a22_0x58cf01['green']('✔\x20Renamed\x20directory\x20to\x20'+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x3fdb1a){const _0x138f66=_0x3fdb1a instanceof Error?_0x3fdb1a['message']:String(_0x3fdb1a);return console[_0x2b7605(0x1a9)](a22_0x58cf01[_0x2b7605(0x20c)](_0x2b7605(0xb5)+_0x138f66+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x498e22(0x16a)](_0x4df6a6){const _0x37fc70=a22_0x498e22;return migrateLegacyDirectory(),super[_0x37fc70(0x16a)](_0x4df6a6);}}function resolveYamlFile(_0x312156){const _0x3de2e5=a22_0x498e22;if(_0x312156[_0x3de2e5(0x1a0)](_0x3de2e5(0x1d3))||_0x312156[_0x3de2e5(0x1a0)](_0x3de2e5(0x1fc)))return _0x312156;return a22_0x454523[_0x3de2e5(0x176)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x312156)+_0x3de2e5(0x1d3));}function formatProgressMessage(_0x3de770){const _0x5bf71b=a22_0x498e22,_0x2e74d7=_0x3de770[_0x5bf71b(0xa2)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x2e74d7){const [,_0x4bd687,_0x18c796,_0x10dd61='']=_0x2e74d7;return a22_0x58cf01['dim'](_0x4bd687+':')+'\x20'+_0x18c796+a22_0x58cf01[_0x5bf71b(0x1db)](_0x10dd61);}return a22_0x58cf01['dim'](_0x3de770);}function showFileNotFoundError(_0x486fe9,_0x191e0b){const _0x314664=a22_0x498e22;console[_0x314664(0x1a9)](a22_0x58cf01[_0x314664(0x20c)]('Error:\x20File\x20not\x20found:\x20'+_0x486fe9+'\x0a')),console[_0x314664(0x1a9)](a22_0x58cf01['cyan'](_0x314664(0x14d)+_0x191e0b+_0x314664(0x11d)));}function displayRealtimeValidation(_0x5b5ec3){const _0x10171c=a22_0x498e22;if(!_0x5b5ec3[_0x10171c(0x200)])return;const _0x57014a=_0x5b5ec3[_0x10171c(0x200)],_0x546968=_0x57014a['enabled']?a22_0x58cf01[_0x10171c(0xd7)](_0x10171c(0x167)):a22_0x58cf01[_0x10171c(0x204)](_0x10171c(0x116));console[_0x10171c(0x1a9)]('\x0a'+a22_0x58cf01[_0x10171c(0x1db)](_0x10171c(0x150))+'\x20'+_0x546968);if(_0x57014a[_0x10171c(0x17c)]&&_0x57014a[_0x10171c(0x17c)][_0x10171c(0x101)]>0x0){console[_0x10171c(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x10171c(0x1db)](_0x10171c(0x1ca))+'\x20'+_0x57014a['events'][_0x10171c(0x101)]+'\x20configured');for(const _0x2e0712 of _0x57014a[_0x10171c(0x17c)]){const _0xec07b4=_0x2e0712['sourceTableValid']===![]?a22_0x58cf01['red']('✘'):a22_0x58cf01[_0x10171c(0xd7)]('✔');console[_0x10171c(0x1a9)](_0x10171c(0xfa)+_0xec07b4+'\x20'+_0x2e0712[_0x10171c(0x1b8)]),_0x2e0712[_0x10171c(0x16d)]&&console[_0x10171c(0x1a9)](_0x10171c(0x190)+a22_0x58cf01[_0x10171c(0x20c)](_0x2e0712['sourceTableError']));}}if(_0x57014a['attributes']&&_0x57014a[_0x10171c(0x108)][_0x10171c(0x101)]>0x0){console[_0x10171c(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x10171c(0x1db)]('Attributes:')+'\x20'+_0x57014a[_0x10171c(0x108)][_0x10171c(0x101)]+_0x10171c(0xcb));for(const _0x39c8f5 of _0x57014a[_0x10171c(0x108)]){const _0x5d2987=_0x39c8f5[_0x10171c(0x19e)]?a22_0x58cf01['green']('✔'):a22_0x58cf01[_0x10171c(0x20c)]('✘');console['error'](_0x10171c(0xfa)+_0x5d2987+'\x20'+_0x39c8f5['name']+'\x20'+a22_0x58cf01[_0x10171c(0x1db)]('('+_0x39c8f5[_0x10171c(0xed)]+')'));}}if(_0x57014a[_0x10171c(0x140)]){const _0x27d984=_0x57014a[_0x10171c(0x140)][_0x10171c(0x15b)]?.[_0x10171c(0x101)]?'\x20+\x20['+_0x57014a[_0x10171c(0x140)][_0x10171c(0x15b)]['join'](',\x20')+']':'';console[_0x10171c(0x1a9)]('\x20\x20'+a22_0x58cf01['dim'](_0x10171c(0x188))+'\x20'+_0x57014a[_0x10171c(0x140)][_0x10171c(0xd3)]+_0x27d984);}if(_0x57014a[_0x10171c(0xf6)]&&_0x57014a[_0x10171c(0xf6)][_0x10171c(0x101)]>0x0){console['error']('\x20\x20'+a22_0x58cf01['dim']('Personalization:')+'\x20'+_0x57014a['personalizationServices']['length']+'\x20service'+(_0x57014a['personalizationServices'][_0x10171c(0x101)]!==0x1?'s':''));for(const _0x3f2b0b of _0x57014a[_0x10171c(0xf6)]){console[_0x10171c(0x1a9)](_0x10171c(0x20b)+_0x3f2b0b['name']);}}}function showParentSegmentNotSetError(_0x501a15){const _0x42b213=a22_0x498e22;console[_0x42b213(0x1a9)](a22_0x58cf01[_0x42b213(0x204)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x42b213(0x1a9)](_0x501a15);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x13e);[a22_0x498e22(0x147)]='List\x20parent\x20segments';async['execute'](_0x5f59b4){const _0xcc83e4=a22_0x498e22,{options:_0x36d1ba,args:_0x6e0e95,tdx:_0x4025f1}=_0x5f59b4,_0x1e3cc3=_0x6e0e95[0x0];_0x36d1ba[_0xcc83e4(0x1c5)]&&(console[_0xcc83e4(0x1a9)]('Site:\x20'+_0x36d1ba['site']),_0x1e3cc3&&console[_0xcc83e4(0x1a9)](_0xcc83e4(0xd9)+_0x1e3cc3));const _0x5d8ed1=await withSpinner(_0x1e3cc3?_0xcc83e4(0xdc)+_0x1e3cc3+'\x27...':_0xcc83e4(0x102),()=>_0x4025f1[_0xcc83e4(0x1f7)][_0xcc83e4(0x129)](),{'verbose':_0x36d1ba['verbose']});let _0x37f024=_0x5d8ed1[_0xcc83e4(0xba)];if(_0x1e3cc3){const _0x485644=_0x1e3cc3[_0xcc83e4(0x12a)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0xcc83e4(0x12a)](/\*/g,'.*')[_0xcc83e4(0x12a)](/\?/g,'.'),_0x58b5ba=new RegExp('^'+_0x485644+'$','i');_0x37f024=_0x37f024['filter'](_0x1383a7=>_0x58b5ba['test'](_0x1383a7[_0xcc83e4(0x108)]['name']));}_0x37f024['sort']((_0x459740,_0x495624)=>_0x459740['attributes'][_0xcc83e4(0x1b8)][_0xcc83e4(0xbb)](_0x495624[_0xcc83e4(0x108)][_0xcc83e4(0x1b8)])),console[_0xcc83e4(0x1a9)](_0xcc83e4(0x155)+_0x37f024[_0xcc83e4(0x101)]+_0xcc83e4(0x153)+(_0x37f024['length']!==0x1?'s':''));const _0x501217=_0x104f6d=>{const _0x50f9de=_0xcc83e4;return getConsoleNextUrl(_0x36d1ba[_0x50f9de(0x1c6)],_0x50f9de(0x18e)+_0x104f6d);};if(_0x36d1ba[_0xcc83e4(0x11e)]===_0xcc83e4(0x130)||_0x36d1ba['format']==='jsonl'){const _0x5da280=_0x37f024['map'](_0x51c52a=>({..._0x51c52a,'url':_0x501217(_0x51c52a['id'])}));await handleSDKOutput(_0x5da280,_0x36d1ba);}else{if(_0x37f024['length']===0x0)_0x1e3cc3?console[_0xcc83e4(0x146)](_0xcc83e4(0x14a)+_0x1e3cc3):console['log']('No\x20parent\x20segments\x20found');else for(const _0xa5801e of _0x37f024){const _0x2b73e1=_0xa5801e[_0xcc83e4(0x108)][_0xcc83e4(0x9e)]?a22_0x58cf01[_0xcc83e4(0x1db)]('\x20('+formatRows(_0xa5801e[_0xcc83e4(0x108)]['population'])+')'):'',_0x41dbed=hyperlink(_0xa5801e[_0xcc83e4(0x108)][_0xcc83e4(0x1b8)],_0x501217(_0xa5801e['id']));console[_0xcc83e4(0x146)]('👥\x20'+_0x41dbed+_0x2b73e1);}}return 0x0;}}export class ParentSegmentCreateCommand extends BaseCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x1d9);[a22_0x498e22(0x147)]=a22_0x498e22(0x1ad);async[a22_0x498e22(0x1ba)](_0x42709c){const _0x3f933a=a22_0x498e22,{options:_0x3289c5,args:_0x3aab7d,tdx:_0x231f04}=_0x42709c;console[_0x3f933a(0x1a9)](_0x3f933a(0x1c0)+_0x3f933a(0xf7)+_0x3f933a(0xf4));const _0xdc4439=_0x3289c5;if(_0x3aab7d[_0x3f933a(0x101)]===0x0)return console[_0x3f933a(0x1a9)](a22_0x58cf01[_0x3f933a(0x20c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x3f933a(0x1a9)](_0x3f933a(0xa8)),0x1;const _0x2f79b8=_0x3aab7d[0x0];if(!_0xdc4439[_0x3f933a(0x17d)]||!_0xdc4439[_0x3f933a(0x1ea)])return console[_0x3f933a(0x1a9)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0x3f933a(0xa8)),0x1;_0xdc4439[_0x3f933a(0x1c5)]&&(console[_0x3f933a(0x1a9)](_0x3f933a(0x9d)+_0xdc4439['site']),console[_0x3f933a(0x1a9)]('Name:\x20'+_0x2f79b8),console[_0x3f933a(0x1a9)](_0x3f933a(0x1ff)+_0xdc4439['database']),console[_0x3f933a(0x1a9)]('Table:\x20'+_0xdc4439['table']));const _0x268dab=await loadJSONFromOptions(_0xdc4439[_0x3f933a(0x108)],_0xdc4439['attributesFile']),_0x3f95f3=await loadJSONFromOptions(_0xdc4439['behaviors'],_0xdc4439[_0x3f933a(0x1cc)]),_0x4b9b9c=await loadJSONFromOptions(_0xdc4439[_0x3f933a(0x1dc)],_0xdc4439['customerGroupFile']),_0xd101de={'name':_0x2f79b8,'description':_0xdc4439[_0x3f933a(0x147)],'scheduleType':_0xdc4439[_0x3f933a(0x121)],'scheduleOption':_0xdc4439['scheduleOption'],'timezone':_0xdc4439[_0x3f933a(0xd0)],'master':{'parentDatabaseName':_0xdc4439[_0x3f933a(0x17d)],'parentTableName':_0xdc4439[_0x3f933a(0x1ea)]},'attributes':_0x268dab,'behaviors':_0x3f95f3,'customerGroup':_0x4b9b9c},_0xa18ca4=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x2f79b8+'\x27...',()=>_0x231f04[_0x3f933a(0x1f7)][_0x3f933a(0xda)](_0xd101de),{'verbose':_0x3289c5['verbose']}),_0x430028=_0xa18ca4[_0x3f933a(0xba)];return console[_0x3f933a(0x1a9)](_0x3f933a(0xb1)+_0x430028[_0x3f933a(0x1b8)]+_0x3f933a(0x1eb)+_0x430028['id']),await handleSDKOutput([_0x430028],_0x3289c5),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x498e22(0x1b8)]='segment:parent:update';[a22_0x498e22(0x147)]=a22_0x498e22(0x1d0);async[a22_0x498e22(0x1ba)](_0xb40c2a){const _0x3f394f=a22_0x498e22,{options:_0x4abade,args:_0x48f328,tdx:_0xb789a1}=_0xb40c2a;console[_0x3f394f(0x1a9)](_0x3f394f(0xe2)+'\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 _0x27b0e5=_0x4abade;if(_0x48f328[_0x3f394f(0x101)]===0x0)return console['error'](a22_0x58cf01[_0x3f394f(0x20c)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console[_0x3f394f(0x1a9)](_0x3f394f(0x124)),0x1;const _0x50d5d4=_0x48f328[0x0];_0x27b0e5[_0x3f394f(0x1c5)]&&(console[_0x3f394f(0x1a9)](_0x3f394f(0x9d)+_0x27b0e5['site']),console[_0x3f394f(0x1a9)](_0x3f394f(0x1e4)+_0x50d5d4));const _0x1dc4fa=await withSpinner(_0x3f394f(0x177)+_0x50d5d4+'\x27...',()=>_0xb789a1[_0x3f394f(0x1f7)][_0x3f394f(0x1ab)](_0x50d5d4),{'verbose':_0x27b0e5[_0x3f394f(0x1c5)]}),_0x2ba8ba=_0x1dc4fa[_0x3f394f(0xba)],_0x1ca443=await loadJSONFromOptions(_0x27b0e5[_0x3f394f(0xe1)],_0x27b0e5[_0x3f394f(0x1dd)]),_0x778374=await loadJSONFromOptions(_0x27b0e5[_0x3f394f(0x201)],_0x27b0e5['addBehaviorsFile']),_0x511cc1={'name':_0x2ba8ba[_0x3f394f(0x1b8)],'description':_0x27b0e5[_0x3f394f(0x147)]!==undefined?_0x27b0e5[_0x3f394f(0x147)]:_0x2ba8ba['description'],'scheduleType':_0x27b0e5[_0x3f394f(0x121)]!==undefined?_0x27b0e5[_0x3f394f(0x121)]:_0x2ba8ba[_0x3f394f(0x121)],'scheduleOption':_0x27b0e5[_0x3f394f(0x15e)]!==undefined?_0x27b0e5['scheduleOption']:_0x2ba8ba[_0x3f394f(0x15e)],'timezone':_0x27b0e5['timezone']!==undefined?_0x27b0e5['timezone']:_0x2ba8ba[_0x3f394f(0xd0)],'master':_0x2ba8ba[_0x3f394f(0x110)],'attributes':_0x1ca443?[..._0x2ba8ba[_0x3f394f(0x108)]||[],..._0x1ca443]:_0x2ba8ba['attributes'],'behaviors':_0x778374?[..._0x2ba8ba[_0x3f394f(0x1a8)]||[],..._0x778374]:_0x2ba8ba['behaviors'],'customerGroup':_0x2ba8ba[_0x3f394f(0x1dc)]},_0x1325cf=await withSpinner(_0x3f394f(0x1ed)+_0x50d5d4+'\x27...',()=>_0xb789a1['segment'][_0x3f394f(0x1be)](_0x50d5d4,_0x511cc1),{'verbose':_0x27b0e5[_0x3f394f(0x1c5)]}),_0xf38249=_0x1325cf[_0x3f394f(0xba)];return console[_0x3f394f(0x1a9)](_0x3f394f(0x160)+_0xf38249['name']+'\x27'),await handleSDKOutput([_0xf38249],_0x27b0e5),0x0;}}function a22_0xed35(){const _0xab1ac=['Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','Default','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','displayAttributesStats','sort','allValid','toFixed','varchar','\x0aNew\x20parent\x20segment\x20\x27','rowCount','Site:\x20','population','displayColumns','information_schema','\x20RT-enabled\x20parent\x20segment','match','SELECT\x20*\x20FROM\x20(\x0a','Options:\x0a','number','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','Listing\x20fields\x20for\x20\x27','Updated','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','\x0aNo\x20sample\x20data\x20available','test','Columns:','displayValidateResults','Available\x20attributes:','✔\x20Created\x20parent\x20segment\x20\x27','Updating','push','\x0aChanges\x20to\x20\x27','✘\x20Failed\x20to\x20rename\x20directory:\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','behavior_','3225294TlYeTH','\x20No\x20changes\x20-\x20','data','localeCompare','\x20is\x20already\x20up\x20to\x20date','getBehaviorNames','parentSegment','Resolving\x20parent\x20segment\x20\x27','tdx\x20ps\x20preview\x20','Fetching\x20sample\x20data...','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','displayBehaviorsStats','\x20Opening\x20','attribute','Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a','\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22','elapsedTimeMillis','To\x20view\x20sample\x20data:','\x20configured','Personalization\x20service\x20description','personalization','yes','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','timezone','Error\x20parsing\x20YAML:\x20','xdg-open','primaryKey','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','displaySampleData','filter','green','Overwrite\x20\x27','Pattern:\x20','createParent','\x0a\x20\x20]\x0a}\x0a','Listing\x20parent\x20segments\x20matching\x20\x27','Coverage:','getOutputDatabaseName','audienceId','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','addAttributes','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a','/\x20→\x20','session','\x20--attribute\x20\x22','label','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','Listing\x20personalization\x20services\x20for\x20\x27','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','indexOf','user_id','customerPercent','type','ps:rt:list','\x20--behavior\x20\x22','getParentSQL','segment:parent:fields','map','\x0aChanges\x20to\x20apply\x20to\x20\x27','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','Validate:','personalizationServices','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','\x20\x20No\x20sample\x20data\x20available','coveragePercent','\x20\x20\x20\x20','single','Options\x20(one\x20required):\x0a','utf-8','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','\x20trigger=','\x20Context\x20set:\x20','length','Listing\x20parent\x20segments...','jsonl','interval','\x0aUsage:\x20tdx\x20ps\x20preview\x20','foreignKey','\x20total','attributes','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','Created','Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a','Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27','matchedCount','ignore','parent_id','master','\x20Configuration\x20is\x20valid','My\x20Service','\x20\x20Note:\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','td_client_id','⚡\x20Not\x20enabled','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','workflowAttemptId','Schema\x20saved\x20to\x20','\x20--interval\x20','segment:parent:view','true','`\x20to\x20download\x20the\x20configuration\x20first','format','Master\x20Table','Error:','scheduleType','906ZrdsOv','in\x20','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','898160knzzQT','Join\x20on:','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','setJobId','listParents','replace','\x27...','\x20--behavior\x20\x22<name>\x22','To\x20cancel:','customersWithEvents','unref','json','\x20Added\x20RT\x202.0\x20template\x20section','Options:','ps:pz:init','Listing\x20RT-enabled\x20parent\x20segments...','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','column_name','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','parent_segment','text','Fetching\x20parent\x20segment\x20\x27','page_view','Available\x20behaviors:','all','segment:parent:list','Errors:','idStitching','collectSchema','Fetching\x20customers\x20schema...','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a','realtime:','Source:','log','description','ps:rt:validate','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','No\x20parent\x20segments\x20match\x20pattern:\x20','%)\x20','repeat','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','stats','\x20service(s)\x20configured','RT\x202.0:','List\x20available\x20fields\x20for\x20segmentation','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','\x20parent\x20segment','Create\x20parent\x20segment\x20\x27','✔\x20Found\x20','\x20to\x20push\x20the\x20configuration','YAML\x20file:\x20','tdx\x20ps\x20push\x20','Session:','joinKey','stitchingKeys','personalization_services','/{name}.yml\x0a','scheduleOption','pushParentYaml','✔\x20Updated\x20parent\x20segment\x20\x27','darwin','Join:','displayMasterInfo','\x27\x20is\x20up\x20to\x20date','behavior','start','⚡\x20Enabled','Show\x20parent\x20segment\x20schema\x20(column\x20types)','limit','run','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','351161zJsmrq','sourceTableError','\x20parent\x20segment\x20\x27','toLowerCase','Attributes','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20view\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20View\x20specific\x20parent\x20segment\x0a\x0a','trim','message','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20\x20Database:\x20','join','Fetching\x20current\x20configuration\x20for\x20\x27','segment:parent:validate','win32','Output\x20Database:','apply','events','database','\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\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a','\x20section','Executing\x20parent\x20segment\x20query...','\x0a\x20\x20\x20\x20]','segment:parent:run','✔\x20No\x20changes\x20-\x20\x27','\x20rows)','column','toLocaleString','ID\x20Stitching:','web','displaySummary','\x20\x20Tables:\x201\x20customers\x20+\x20','Aborted.','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','/app/dw/parentSegments/','segment:parent:pull','\x20\x20\x20\x20\x20\x20','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','cyan','parent_segments','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','\x20[Job\x20ID:\x20','1136996HkbICQ','schemaValid','-1d','list','runParent','segment:parent:preview','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','errors','valid','enriched','endsWith','/\x20directories\x20exist.','resolveParentId','using\x20the\x20default\x20path:\x20','validateParentYaml','Error:\x20No\x20behaviors\x20defined\x20in\x20configuration','Enriched:','\x20rows\x20','behaviors','error','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','getParentFull','segment:parent:sql','Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','Creating','\x0a\x20\x20\x20\x20}','3003NORXZA','Analyzing\x20changes...','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Error\x20reading\x20file:\x20','dirname','last_page_viewed','Error:\x20No\x20attributes\x20defined\x20in\x20configuration','name','\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML','execute','workflowId','SELECT\x20*\x20FROM\x20','previewParentYaml','updateParent','\x0a✔\x20Workflow\x20started','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','/\x20directory.\x0a','stop','\x27\x20and\x20run\x20workflow?','segment:parent:show','verbose','site','\x20kill','Audience\x20ID:','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Events:','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','behaviorsFile','SQL\x20query:\x0a','displayPreviewResults','schemaError','Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]','displayPreviewHints','<database>.<table>','.yml','8170UMwMsB','open','Validating\x20RT\x20configuration...','\x20\x202.\x20Run\x20','Behaviors','segment:parent:create','double','dim','customerGroup','addAttributesFile','6696TKUxyT','Master:','isDirectory','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','\x0aError:','output','Parent\x20segment:\x20','\x20behaviors','workflowSessionId','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','1606815DJFWpq','Customers:','table','\x27\x20with\x20ID:\x20','✔\x20Query\x20completed:\x20Processed\x20','Updating\x20parent\x20segment\x20\x27','string','trigger_event','\x20personalization\x20service','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','columns','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','bold','segment','listFields','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','displayRealtimeInfo','column_type','.yaml','use','No\x20RT-enabled\x20parent\x20segments\x20found','Database:\x20','realtime','addBehaviors','\x20=\x20','platform','yellow','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x20field','customers','formatSchemaJson','Rows:','\x20\x20\x20\x20-\x20','red','sampleData','\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','No\x20personalization\x20services\x20configured','\x0a)\x20AS\x20segment_query\x0aLIMIT\x20'];a22_0xed35=function(){return _0xab1ac;};return a22_0xed35();}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x18f);[a22_0x498e22(0x147)]='Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file';async[a22_0x498e22(0x1ba)](_0x4a462a){const _0xd5df93=a22_0x498e22,{options:_0x113514,args:_0x3c2d44,tdx:_0x158d1c}=_0x4a462a,_0x308263=_0x113514,_0x4dbe7b=_0x3c2d44[0x0]||_0x113514[_0xd5df93(0xbe)];if(!_0x4dbe7b)return showParentSegmentNotSetError(_0xd5df93(0xe9)+_0xd5df93(0x1f9)),0x1;if(_0x308263[_0xd5df93(0x1fd)]&&_0x308263[_0xd5df93(0x1e3)])return console[_0xd5df93(0x1a9)](a22_0x58cf01[_0xd5df93(0x20c)](_0xd5df93(0x149))),console[_0xd5df93(0x1a9)](a22_0x58cf01['dim']('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0xd5df93(0x1a9)](a22_0x58cf01[_0xd5df93(0x1db)](_0xd5df93(0x1a3)+PARENT_SEGMENT_DIR+_0xd5df93(0x15d))),console[_0xd5df93(0x1a9)](a22_0x58cf01[_0xd5df93(0x192)](_0xd5df93(0x1e1))),0x1;const _0x4063f9=_0x308263[_0xd5df93(0x1e3)]||a22_0x454523['join'](PARENT_SEGMENT_DIR,sanitizeFileName(_0x4dbe7b)+_0xd5df93(0x1d3));_0x308263[_0xd5df93(0x1c5)]&&(console['error'](_0xd5df93(0x9d)+_0x308263['site']),console[_0xd5df93(0x1a9)](_0xd5df93(0x1e4)+_0x4dbe7b),console[_0xd5df93(0x1a9)]('Output\x20file:\x20'+_0x4063f9));const _0x4f2865=await withSpinner(_0xd5df93(0x13a)+_0x4dbe7b+_0xd5df93(0x12b),()=>_0x158d1c['segment']['pullParentYaml'](_0x4dbe7b),{'verbose':_0x308263[_0xd5df93(0x1c5)]}),_0x505277=_0x4f2865[_0xd5df93(0xba)];if(existsSync(_0x4063f9)){const _0x24902b=readFileSync(_0x4063f9,_0xd5df93(0xfd)),_0x14f8e0=generateDiff(_0x24902b,_0x505277);if(!hasChanges(_0x14f8e0))console['error'](a22_0x58cf01[_0xd5df93(0xd7)]('✔')+_0xd5df93(0xb9)+a22_0x58cf01[_0xd5df93(0x192)](_0x4063f9)+_0xd5df93(0xbc));else{console['error'](_0xd5df93(0xb4)+_0x4063f9+'\x27:'),console[_0xd5df93(0x1a9)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x14f8e0)),console['error']('─'['repeat'](0x3c));if(!_0x308263[_0xd5df93(0xce)]){if(!isInteractive())return console['error'](a22_0x58cf01[_0xd5df93(0x20c)](_0xd5df93(0x1e2)),_0xd5df93(0x1b3)),console['error'](a22_0x58cf01[_0xd5df93(0x1db)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x59eebe=await confirmKey(_0xd5df93(0xd8)+_0x4063f9+'\x27?');if(!_0x59eebe)return console[_0xd5df93(0x1a9)](a22_0x58cf01[_0xd5df93(0x204)]('Aborted.')),0x1;}writeFileSync(_0x4063f9,_0x505277,_0xd5df93(0xfd)),console[_0xd5df93(0x1a9)](a22_0x58cf01[_0xd5df93(0xd7)]('✔')+_0xd5df93(0x93)+a22_0x58cf01[_0xd5df93(0x192)](_0x4063f9));}}else{const _0x1241bd=a22_0x454523[_0xd5df93(0x1b5)](_0x4063f9);!existsSync(_0x1241bd)&&mkdirSync(_0x1241bd,{'recursive':!![]}),writeFileSync(_0x4063f9,_0x505277,_0xd5df93(0xfd)),console['error'](a22_0x58cf01[_0xd5df93(0xd7)]('✔')+'\x20Saved\x20parent\x20segment\x20configuration\x20to\x20'+a22_0x58cf01[_0xd5df93(0x192)](_0x4063f9));}return saveSessionContext({'parent_segment':_0x4dbe7b},_0x308263[_0xd5df93(0xe4)]),console[_0xd5df93(0x1a9)](a22_0x58cf01[_0xd5df93(0xd7)]('✔')+_0xd5df93(0x100)+a22_0x58cf01[_0xd5df93(0x1db)](_0xd5df93(0x138))+_0xd5df93(0x202)+a22_0x58cf01[_0xd5df93(0x192)](_0x4dbe7b)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x498e22(0x1b8)]='segment:parent:push';['description']='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async['execute'](_0x47b023){const _0x67781d=a22_0x498e22,{options:_0x432979,args:_0x21caea,tdx:_0x2c9f72}=_0x47b023,_0x132046=_0x432979,_0x4650bd=_0x21caea[0x0]||_0x432979['parentSegment'];if(!_0x4650bd)return showParentSegmentNotSetError(_0x67781d(0x1f5)+_0x67781d(0x95)),0x1;const _0x37f828=resolveYamlFile(_0x4650bd);if(!existsSync(_0x37f828))return showFileNotFoundError(_0x37f828,_0x4650bd),0x1;_0x132046[_0x67781d(0x1c5)]&&(console[_0x67781d(0x1a9)]('Site:\x20'+_0x132046[_0x67781d(0x1c6)]),console[_0x67781d(0x1a9)](_0x67781d(0x157)+_0x37f828));let _0x35318d;try{_0x35318d=readFileSync(_0x37f828,_0x67781d(0xfd));}catch(_0x21b06e){const _0x1aacd9=_0x21b06e instanceof Error?_0x21b06e[_0x67781d(0x173)]:String(_0x21b06e);return console[_0x67781d(0x1a9)](_0x67781d(0x1b4)+_0x1aacd9),0x1;}const _0x4a668f=await withSpinner(_0x67781d(0x1b1),()=>_0x2c9f72[_0x67781d(0x1f7)][_0x67781d(0x15f)](_0x35318d),{'verbose':_0x132046['verbose']}),_0x7a2707=_0x4a668f[_0x67781d(0xba)],{isNew:_0x44498d,name:_0x35de82,hasChanges:_0x14c731,diffFormatted:_0x462ec2}=_0x7a2707;if(!_0x14c731)return console[_0x67781d(0x1a9)]('✔\x20No\x20changes\x20-\x20\x27'+_0x35de82+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x44498d?console[_0x67781d(0x1a9)](_0x67781d(0x9b)+_0x35de82+'\x27:'):console[_0x67781d(0x1a9)](_0x67781d(0xf3)+_0x35de82+'\x27:');console[_0x67781d(0x1a9)]('─'['repeat'](0x3c)),console[_0x67781d(0x1a9)](_0x462ec2),console[_0x67781d(0x1a9)]('─'[_0x67781d(0x14c)](0x3c));const _0x147553=_0x44498d?_0x67781d(0x154)+_0x35de82+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0x35de82+'\x27?';if(!_0x132046['yes']){if(!isInteractive())return console[_0x67781d(0x1a9)](a22_0x58cf01[_0x67781d(0x20c)](_0x67781d(0x1e2)),'Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode'),console[_0x67781d(0x1a9)](a22_0x58cf01[_0x67781d(0x1db)](_0x67781d(0x92))),0x1;const _0x7d9245=await confirmKey(_0x147553);if(!_0x7d9245)return console[_0x67781d(0x1a9)](a22_0x58cf01[_0x67781d(0x204)]('Aborted.')),0x1;}const _0x3d7395=_0x44498d?_0x67781d(0x1ae):_0x67781d(0xb2),_0xa5468e=await withSpinner(_0x3d7395+_0x67781d(0x16e)+_0x35de82+_0x67781d(0x12b),()=>_0x7a2707[_0x67781d(0x17b)](),{'verbose':_0x132046[_0x67781d(0x1c5)]}),_0x5117ee=_0xa5468e[_0x67781d(0xba)],_0x2d7b6f=getConsoleNextUrl(_0x132046['site'],'/app/dw/parentSegments/'+_0x5117ee['id']),_0x3c146c=_0x44498d?'Created':_0x67781d(0xaa);return console[_0x67781d(0x1a9)]('✔\x20'+_0x3c146c+_0x67781d(0x16e)+_0x5117ee['name']+'\x27'),console['error']('\x20\x20'+_0x2d7b6f),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x178);[a22_0x498e22(0x147)]=a22_0x498e22(0x205);async[a22_0x498e22(0x1ba)](_0x2c57f0){const _0x3c40a7=a22_0x498e22,{options:_0x56af39,args:_0x459266,tdx:_0x41125c}=_0x2c57f0,_0xeee1e=_0x56af39,_0x2c86fb=_0x459266[0x0]||_0x56af39[_0x3c40a7(0xbe)];if(!_0x2c86fb)return showParentSegmentNotSetError(_0x3c40a7(0x17f)+_0x3c40a7(0x17e)+_0x3c40a7(0xa4)+_0x3c40a7(0xfe)+'\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a'+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;const _0x1ff7ff=resolveYamlFile(_0x2c86fb);if(!existsSync(_0x1ff7ff))return showFileNotFoundError(_0x1ff7ff,_0x2c86fb),0x1;_0xeee1e[_0x3c40a7(0x1c5)]&&(console[_0x3c40a7(0x1a9)]('Site:\x20'+_0xeee1e['site']),console[_0x3c40a7(0x1a9)](_0x3c40a7(0x157)+_0x1ff7ff));let _0x5d7024;try{_0x5d7024=readFileSync(_0x1ff7ff,'utf-8');}catch(_0x4b5bcf){const _0x27053c=_0x4b5bcf instanceof Error?_0x4b5bcf['message']:String(_0x4b5bcf);return console[_0x3c40a7(0x1a9)](_0x3c40a7(0x1b4)+_0x27053c),0x1;}const _0x45f47b=createCommandSpinner(a22_0x58cf01[_0x3c40a7(0x1db)]('Validating\x20configuration...'),{'verbose':_0xeee1e['verbose']});_0x45f47b['start']();const _0x5c2128={'onProgress':_0x41a0de=>{const _0x46c570=_0x3c40a7;_0x45f47b[_0x46c570(0x139)]=formatProgressMessage(_0x41a0de);}};if(_0xeee1e['master'])_0x5c2128[_0x3c40a7(0x110)]=!![];if(_0xeee1e[_0x3c40a7(0x19f)])_0x5c2128[_0x3c40a7(0x19f)]=!![];_0xeee1e['attribute']&&(_0x5c2128[_0x3c40a7(0xc6)]=_0xeee1e[_0x3c40a7(0xc6)]);_0xeee1e[_0x3c40a7(0x165)]&&(_0x5c2128[_0x3c40a7(0x165)]=_0xeee1e[_0x3c40a7(0x165)]);if(_0xeee1e['interval'])_0x5c2128[_0x3c40a7(0x104)]=_0xeee1e[_0x3c40a7(0x104)];let _0x2ce0fc;try{_0x2ce0fc=await _0x41125c[_0x3c40a7(0x1f7)][_0x3c40a7(0x1a4)](_0x5d7024,_0x5c2128),_0x45f47b[_0x3c40a7(0x1c2)]();}catch(_0xfa45db){_0x45f47b['stop']();throw _0xfa45db;}const _0x2813fa=_0xeee1e['interval']||'-1d';return this[_0x3c40a7(0xaf)](_0x2ce0fc,_0x5c2128,_0x1ff7ff,_0x2813fa),_0x2ce0fc[_0x3c40a7(0x98)]?0x0:0x1;}['displayValidateResults'](_0x3367b5,_0x4cb1fa,_0x45a542,_0x35efc8){const _0x4965aa=a22_0x498e22;console['error']('\x0a'+a22_0x58cf01[_0x4965aa(0x1f6)](_0x4965aa(0xf5))+'\x20'+_0x3367b5[_0x4965aa(0x1b8)]),console[_0x4965aa(0x1a9)]('═'[_0x4965aa(0x14c)](0x3c)),this['displayMasterInfo'](_0x3367b5);if(typeof _0x4cb1fa[_0x4965aa(0xc6)]===_0x4965aa(0x1ee)){this[_0x4965aa(0x96)](_0x3367b5),this[_0x4965aa(0x18a)](_0x3367b5),this[_0x4965aa(0x1d1)](_0x45a542,_0x35efc8,_0x4965aa(0xc6),_0x4cb1fa[_0x4965aa(0xc6)]);return;}if(_0x4cb1fa[_0x4965aa(0xc6)]===!![]){this[_0x4965aa(0x96)](_0x3367b5),this[_0x4965aa(0x18a)](_0x3367b5),this[_0x4965aa(0x1d1)](_0x45a542,_0x35efc8,'attributes');return;}if(typeof _0x4cb1fa['behavior']==='string'){this[_0x4965aa(0xc4)](_0x3367b5,_0x35efc8),this[_0x4965aa(0x18a)](_0x3367b5),this[_0x4965aa(0x1d1)](_0x45a542,_0x35efc8,_0x4965aa(0x165),_0x4cb1fa[_0x4965aa(0x165)]);return;}if(_0x4cb1fa[_0x4965aa(0x165)]===!![]){this[_0x4965aa(0xc4)](_0x3367b5,_0x35efc8),this[_0x4965aa(0x18a)](_0x3367b5),this[_0x4965aa(0x1d1)](_0x45a542,_0x35efc8,_0x4965aa(0x1a8));return;}this[_0x4965aa(0x96)](_0x3367b5),this['displayBehaviorsStats'](_0x3367b5,_0x35efc8),this['displayRealtimeInfo'](_0x3367b5),this[_0x4965aa(0x18a)](_0x3367b5),this[_0x4965aa(0x1d1)](_0x45a542,_0x35efc8,_0x4965aa(0x13d));}[a22_0x498e22(0x1fa)](_0x541c63){displayRealtimeValidation(_0x541c63);}[a22_0x498e22(0x1d1)](_0xdb6c56,_0x2dab60,_0x5b7fe6,_0x390ce1){const _0x3a8eae=a22_0x498e22;console[_0x3a8eae(0x1a9)]('\x0a'+a22_0x58cf01[_0x3a8eae(0x1db)](_0x3a8eae(0xca)));const _0x2441d3=_0x2dab60!==_0x3a8eae(0x198)?_0x3a8eae(0x11a)+_0x2dab60:'';if(_0x5b7fe6===_0x3a8eae(0xc6)&&_0x390ce1)console[_0x3a8eae(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x3a8eae(0x1db)]('tdx\x20ps\x20preview\x20'+_0xdb6c56+_0x3a8eae(0xe5)+_0x390ce1+'\x22'+_0x2441d3));else{if(_0x5b7fe6===_0x3a8eae(0x165)&&_0x390ce1)console[_0x3a8eae(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x3a8eae(0x1db)](_0x3a8eae(0xc0)+_0xdb6c56+_0x3a8eae(0xef)+_0x390ce1+'\x22'+_0x2441d3));else(_0x5b7fe6===_0x3a8eae(0x108)||_0x5b7fe6==='all')&&console[_0x3a8eae(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x3a8eae(0x1db)](_0x3a8eae(0xc0)+_0xdb6c56+'\x20--attribute\x20\x22<name>\x22'+_0x2441d3));}(_0x5b7fe6===_0x3a8eae(0x1a8)||_0x5b7fe6===_0x3a8eae(0x13d))&&console[_0x3a8eae(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x3a8eae(0x1db)](_0x3a8eae(0xc0)+_0xdb6c56+_0x3a8eae(0x12c)+_0x2441d3)),_0x5b7fe6==='all'&&console['error']('\x20\x20'+a22_0x58cf01[_0x3a8eae(0x1db)](_0x3a8eae(0xc0)+_0xdb6c56+'\x20--enriched'+_0x2441d3));}[a22_0x498e22(0x163)](_0x409c0a){const _0x408de4=a22_0x498e22,{master:_0x42b874}=_0x409c0a,_0x1854d6=_0x42b874['schemaValid']?a22_0x58cf01[_0x408de4(0xd7)]('✔'):a22_0x58cf01[_0x408de4(0x20c)]('✘');console[_0x408de4(0x1a9)]('\x0a'+a22_0x58cf01[_0x408de4(0x1db)](_0x408de4(0x11f))),console[_0x408de4(0x1a9)](_0x1854d6+'\x20'+a22_0x58cf01[_0x408de4(0x1f6)](_0x42b874['database']+'.'+_0x42b874['table'])),_0x42b874[_0x408de4(0x197)]?_0x42b874[_0x408de4(0x9c)]!==undefined&&console[_0x408de4(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x408de4(0x1db)](_0x408de4(0x20a))+'\x20'+a22_0x58cf01[_0x408de4(0x192)](formatRows(_0x42b874[_0x408de4(0x9c)]))):console[_0x408de4(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x408de4(0x20c)](_0x408de4(0x120))+'\x20'+_0x42b874[_0x408de4(0x1cf)]);}[a22_0x498e22(0x96)](_0x1bcfba){const _0x4ae0bd=a22_0x498e22;if(_0x1bcfba[_0x4ae0bd(0x108)]['length']===0x0)return;console[_0x4ae0bd(0x1a9)]('\x0a'+a22_0x58cf01[_0x4ae0bd(0x1db)](_0x4ae0bd(0x170)));for(const _0xc2eaae of _0x1bcfba[_0x4ae0bd(0x108)]){const _0x42e7aa=_0xc2eaae['schemaValid']?a22_0x58cf01[_0x4ae0bd(0xd7)]('✔'):a22_0x58cf01['red']('✘');let _0x1e92d1='';if(_0xc2eaae[_0x4ae0bd(0x197)]&&_0xc2eaae['matchedCount']!==undefined&&_0xc2eaae[_0x4ae0bd(0xf9)]!==undefined){const _0x2f85d4=_0xc2eaae[_0x4ae0bd(0xf9)][_0x4ae0bd(0x99)](0x1),_0x49cb1d=_0xc2eaae[_0x4ae0bd(0xf9)]>=0x50?a22_0x58cf01[_0x4ae0bd(0xd7)]:_0xc2eaae[_0x4ae0bd(0xf9)]>=0x32?a22_0x58cf01[_0x4ae0bd(0x204)]:a22_0x58cf01[_0x4ae0bd(0x20c)];_0x1e92d1='\x20'+a22_0x58cf01['dim'](_0x4ae0bd(0xdd))+'\x20'+_0x49cb1d(_0x2f85d4+'%')+'\x20('+formatRows(_0xc2eaae[_0x4ae0bd(0x10d)])+_0x4ae0bd(0x185);}console['error'](_0x42e7aa+'\x20'+a22_0x58cf01[_0x4ae0bd(0x1f6)](_0xc2eaae[_0x4ae0bd(0x1b8)])+_0x1e92d1),console[_0x4ae0bd(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x4ae0bd(0x1db)]('Source:')+'\x20'+a22_0x58cf01['bold'](_0xc2eaae['database']+'.'+_0xc2eaae[_0x4ae0bd(0x1ea)]));const _0xe8b11c=_0xc2eaae[_0x4ae0bd(0x15a)]===_0xc2eaae[_0x4ae0bd(0x106)]?a22_0x58cf01[_0x4ae0bd(0x1db)](_0x4ae0bd(0x126))+'\x20'+_0xc2eaae[_0x4ae0bd(0x15a)]:a22_0x58cf01[_0x4ae0bd(0x1db)](_0x4ae0bd(0x162))+'\x20'+_0xc2eaae['joinKey']+_0x4ae0bd(0x202)+_0xc2eaae[_0x4ae0bd(0x106)];console['error']('\x20\x20'+_0xe8b11c),console['error']('\x20\x20'+a22_0x58cf01[_0x4ae0bd(0x1db)](_0x4ae0bd(0xae))),this['displayColumns'](_0xc2eaae[_0x4ae0bd(0x1f2)]),!_0xc2eaae[_0x4ae0bd(0x197)]&&console[_0x4ae0bd(0x1a9)]('\x20\x20'+a22_0x58cf01['red'](_0x4ae0bd(0x120))+'\x20'+_0xc2eaae[_0x4ae0bd(0x1cf)]);}}[a22_0x498e22(0xc4)](_0x58190e,_0x2453d0){const _0x2b4fb4=a22_0x498e22;if(_0x58190e['behaviors']['length']===0x0)return;console[_0x2b4fb4(0x1a9)]('\x0a'+a22_0x58cf01[_0x2b4fb4(0x1db)](_0x2b4fb4(0x1d8))+'\x20'+a22_0x58cf01[_0x2b4fb4(0x1db)]('('+_0x2453d0+')'));for(const _0xe21f72 of _0x58190e['behaviors']){const _0x33e199=_0xe21f72[_0x2b4fb4(0x197)]?a22_0x58cf01[_0x2b4fb4(0xd7)]('✔'):a22_0x58cf01[_0x2b4fb4(0x20c)]('✘');let _0x36bae2='';if(_0xe21f72[_0x2b4fb4(0x197)]&&_0xe21f72[_0x2b4fb4(0x12e)]!==undefined&&_0xe21f72['totalEvents']!==undefined){const _0x347dce=_0xe21f72[_0x2b4fb4(0xec)]?.['toFixed'](0x1)||'?',_0x1e4216=(_0xe21f72[_0x2b4fb4(0xec)]??0x0)>=0x32?a22_0x58cf01['green']:(_0xe21f72[_0x2b4fb4(0xec)]??0x0)>=0x14?a22_0x58cf01['yellow']:a22_0x58cf01[_0x2b4fb4(0x20c)];_0x36bae2='\x20'+a22_0x58cf01['dim'](_0x2b4fb4(0x1e9))+'\x20'+_0x1e4216(formatRows(_0xe21f72['customersWithEvents']))+'\x20('+_0x347dce+_0x2b4fb4(0x14b)+a22_0x58cf01[_0x2b4fb4(0x1db)](_0x2b4fb4(0x1ca))+'\x20'+a22_0x58cf01[_0x2b4fb4(0x192)](formatRows(_0xe21f72['totalEvents']));}console[_0x2b4fb4(0x1a9)](_0x33e199+'\x20'+a22_0x58cf01[_0x2b4fb4(0x1f6)](_0xe21f72[_0x2b4fb4(0x1b8)])+_0x36bae2),console[_0x2b4fb4(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x2b4fb4(0x1db)](_0x2b4fb4(0x145))+'\x20'+a22_0x58cf01[_0x2b4fb4(0x1f6)](_0xe21f72['database']+'.'+_0xe21f72[_0x2b4fb4(0x1ea)]));const _0x33efbf=_0xe21f72['joinKey']===_0xe21f72[_0x2b4fb4(0x106)]?a22_0x58cf01[_0x2b4fb4(0x1db)](_0x2b4fb4(0x126))+'\x20'+_0xe21f72['joinKey']:a22_0x58cf01[_0x2b4fb4(0x1db)](_0x2b4fb4(0x162))+'\x20'+_0xe21f72[_0x2b4fb4(0x15a)]+_0x2b4fb4(0x202)+_0xe21f72[_0x2b4fb4(0x106)];console[_0x2b4fb4(0x1a9)]('\x20\x20'+_0x33efbf),console[_0x2b4fb4(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x2b4fb4(0x1db)]('Columns:')),this[_0x2b4fb4(0x9f)](_0xe21f72[_0x2b4fb4(0x1f2)]),!_0xe21f72[_0x2b4fb4(0x197)]&&console[_0x2b4fb4(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x2b4fb4(0x20c)](_0x2b4fb4(0x120))+'\x20'+_0xe21f72[_0x2b4fb4(0x1cf)]);}}[a22_0x498e22(0x9f)](_0x17287b){const _0x3de094=a22_0x498e22;for(const _0x1420ec of _0x17287b){_0x1420ec[_0x3de094(0xe6)]===_0x1420ec[_0x3de094(0x186)]||_0x1420ec[_0x3de094(0x186)]==='*'?console['error'](_0x3de094(0x20b)+_0x1420ec[_0x3de094(0xe6)]):console[_0x3de094(0x1a9)](_0x3de094(0x20b)+_0x1420ec[_0x3de094(0xe6)]+'\x20'+a22_0x58cf01[_0x3de094(0x1db)]('('+_0x1420ec[_0x3de094(0x186)]+')'));}}[a22_0x498e22(0x18a)](_0xf3bb22){const _0x489cdf=a22_0x498e22;console[_0x489cdf(0x1a9)]('─'[_0x489cdf(0x14c)](0x3c));if(_0xf3bb22[_0x489cdf(0x19d)]['length']>0x0){console['error']('\x0a'+a22_0x58cf01[_0x489cdf(0x20c)]('Errors:'));for(const _0x2deee1 of _0xf3bb22[_0x489cdf(0x19d)]){console['error']('\x20\x20'+a22_0x58cf01[_0x489cdf(0x20c)]('•')+'\x20'+_0x2deee1);}}_0xf3bb22[_0x489cdf(0x98)]&&console['error']('\x0a'+a22_0x58cf01['green']('✔')+_0x489cdf(0x111));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x19b);['description']=a22_0x498e22(0x206);async[a22_0x498e22(0x1ba)](_0x5e12b4){const _0x1deebb=a22_0x498e22,{options:_0x178d91,args:_0x41f776,tdx:_0x10707d}=_0x5e12b4,_0x1d8272=_0x178d91,_0x4c0fb8=_0x41f776[0x0]||_0x178d91[_0x1deebb(0xbe)];if(!_0x4c0fb8)return showParentSegmentNotSetError(_0x1deebb(0x1c9)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a'+_0x1deebb(0xfc)+_0x1deebb(0x143)+_0x1deebb(0x194)+'\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a'+_0x1deebb(0x152)+_0x1deebb(0x1aa)),0x1;if(!_0x1d8272['master']&&!_0x1d8272[_0x1deebb(0xc6)]&&!_0x1d8272[_0x1deebb(0x165)]&&!_0x1d8272['enriched'])return console[_0x1deebb(0x1a9)](a22_0x58cf01[_0x1deebb(0x20c)](_0x1deebb(0xb6))),console[_0x1deebb(0x1a9)](_0x1deebb(0x1f4)),console[_0x1deebb(0x1a9)](_0x1deebb(0x132)),console[_0x1deebb(0x1a9)](_0x1deebb(0x16b)),console[_0x1deebb(0x1a9)]('\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute'),console[_0x1deebb(0x1a9)]('\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior'),console['error'](_0x1deebb(0x1b2)),0x1;const _0x4047b7=resolveYamlFile(_0x4c0fb8);if(!existsSync(_0x4047b7))return showFileNotFoundError(_0x4047b7,_0x4c0fb8),0x1;_0x1d8272[_0x1deebb(0x1c5)]&&(console[_0x1deebb(0x1a9)](_0x1deebb(0x9d)+_0x1d8272[_0x1deebb(0x1c6)]),console[_0x1deebb(0x1a9)](_0x1deebb(0x157)+_0x4047b7));let _0x290a3d;try{_0x290a3d=readFileSync(_0x4047b7,_0x1deebb(0xfd));}catch(_0x493c29){const _0x5cee79=_0x493c29 instanceof Error?_0x493c29[_0x1deebb(0x173)]:String(_0x493c29);return console[_0x1deebb(0x1a9)](_0x1deebb(0x1b4)+_0x5cee79),0x1;}let _0x5b2251;try{_0x5b2251=parseDef(_0x290a3d);}catch(_0x12d820){const _0x5cb76b=_0x12d820 instanceof Error?_0x12d820[_0x1deebb(0x173)]:String(_0x12d820);return console[_0x1deebb(0x1a9)](a22_0x58cf01[_0x1deebb(0x20c)](_0x1deebb(0xd1)+_0x5cb76b)),0x1;}if(_0x1d8272[_0x1deebb(0xc6)]===!![]||_0x1d8272[_0x1deebb(0xc6)]===''){const _0x2ec5c2=_0x5b2251[_0x1deebb(0x108)]?.[_0x1deebb(0xf2)](_0x156210=>_0x156210[_0x1deebb(0x1b8)])||[];if(_0x2ec5c2[_0x1deebb(0x101)]===0x0)console['error'](a22_0x58cf01[_0x1deebb(0x20c)](_0x1deebb(0x1b7)));else{console['error'](a22_0x58cf01[_0x1deebb(0x20c)]('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x1deebb(0xb0));for(const _0x1ddbfc of _0x2ec5c2){console[_0x1deebb(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x1deebb(0x192)](_0x1ddbfc));}console[_0x1deebb(0x1a9)](_0x1deebb(0x105)+_0x4c0fb8+_0x1deebb(0xe5)+_0x2ec5c2[0x0]+'\x22');}return 0x1;}if(_0x1d8272[_0x1deebb(0x165)]===!![]||_0x1d8272[_0x1deebb(0x165)]===''){const _0x4ebf79=_0x5b2251['behaviors']?.[_0x1deebb(0xf2)](_0x33782a=>_0x33782a['name'])||[];if(_0x4ebf79[_0x1deebb(0x101)]===0x0)console[_0x1deebb(0x1a9)](a22_0x58cf01[_0x1deebb(0x20c)](_0x1deebb(0x1a5)));else{console['error'](a22_0x58cf01['red']('Error:\x20--behavior\x20requires\x20a\x20name\x0a')),console[_0x1deebb(0x1a9)](_0x1deebb(0x13c));for(const _0x21cc5f of _0x4ebf79){console['error']('\x20\x20'+a22_0x58cf01[_0x1deebb(0x192)](_0x21cc5f));}console[_0x1deebb(0x1a9)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x4c0fb8+_0x1deebb(0xef)+_0x4ebf79[0x0]+'\x22');}return 0x1;}const _0x3e5616=createCommandSpinner(a22_0x58cf01['dim'](_0x1deebb(0xc1)),{'verbose':_0x1d8272['verbose']});_0x3e5616['start']();const _0x4bf515={'onProgress':_0x57b400=>{_0x3e5616['text']=formatProgressMessage(_0x57b400);}};if(_0x1d8272['master'])_0x4bf515[_0x1deebb(0x110)]=!![];if(_0x1d8272[_0x1deebb(0xc6)]&&typeof _0x1d8272[_0x1deebb(0xc6)]===_0x1deebb(0x1ee))_0x4bf515['attribute']=_0x1d8272[_0x1deebb(0xc6)];if(_0x1d8272[_0x1deebb(0x165)]&&typeof _0x1d8272['behavior']===_0x1deebb(0x1ee))_0x4bf515['behavior']=_0x1d8272['behavior'];if(_0x1d8272[_0x1deebb(0x19f)])_0x4bf515[_0x1deebb(0x19f)]=!![];if(_0x1d8272[_0x1deebb(0x104)])_0x4bf515['interval']=_0x1d8272['interval'];let _0x3b428e;try{_0x3b428e=await _0x10707d[_0x1deebb(0x1f7)][_0x1deebb(0x1bd)](_0x290a3d,_0x4bf515),_0x3e5616['stop']();}catch(_0x28d23f){_0x3e5616[_0x1deebb(0x1c2)]();throw _0x28d23f;}return await this['displayPreviewResults'](_0x3b428e,{'master':_0x1d8272[_0x1deebb(0x110)],'attribute':typeof _0x1d8272[_0x1deebb(0xc6)]===_0x1deebb(0x1ee)?_0x1d8272[_0x1deebb(0xc6)]:undefined,'behavior':typeof _0x1d8272[_0x1deebb(0x165)]==='string'?_0x1d8272[_0x1deebb(0x165)]:undefined,'enriched':_0x1d8272[_0x1deebb(0x19f)]}),_0x3b428e['allValid']?0x0:0x1;}async[a22_0x498e22(0x1ce)](_0x42817f,_0x3c6baf){const _0x577fff=a22_0x498e22;console[_0x577fff(0x1a9)]('\x0a'+a22_0x58cf01[_0x577fff(0x1f6)]('Preview:')+'\x20'+_0x42817f[_0x577fff(0x1b8)]),console[_0x577fff(0x1a9)]('═'['repeat'](0x3c));if(_0x3c6baf[_0x577fff(0x110)]&&_0x42817f[_0x577fff(0x20d)]){const _0x52ff80=a22_0x58cf01[_0x577fff(0x1db)](_0x577fff(0x1df))+'\x20'+a22_0x58cf01['bold'](_0x42817f['master']['database']+'.'+_0x42817f['master']['table']);await this[_0x577fff(0xd5)](_0x52ff80,_0x42817f['sampleData']);}else{if(_0x3c6baf[_0x577fff(0xc6)]&&_0x42817f[_0x577fff(0x20d)]){const _0x88ac05=a22_0x58cf01[_0x577fff(0x1db)]('Attribute:')+'\x20'+a22_0x58cf01[_0x577fff(0x1f6)](_0x3c6baf['attribute']);await this[_0x577fff(0xd5)](_0x88ac05,_0x42817f[_0x577fff(0x20d)]);}else{if(_0x3c6baf[_0x577fff(0x165)]&&_0x42817f[_0x577fff(0x20d)]){const _0x2d5bf8=a22_0x58cf01[_0x577fff(0x1db)]('Behavior:')+'\x20'+a22_0x58cf01[_0x577fff(0x1f6)](_0x3c6baf[_0x577fff(0x165)]);await this[_0x577fff(0xd5)](_0x2d5bf8,_0x42817f[_0x577fff(0x20d)]);}else{if(_0x3c6baf['enriched']&&_0x42817f[_0x577fff(0x20d)]){const _0x4b9d6b=a22_0x58cf01['dim'](_0x577fff(0x1a6))+'\x20'+a22_0x58cf01[_0x577fff(0x1f6)]('Master\x20+\x20Attributes');await this['displaySampleData'](_0x4b9d6b,_0x42817f['sampleData']);}else!_0x42817f[_0x577fff(0x20d)]&&console[_0x577fff(0x1a9)](_0x577fff(0xac));}}}if(_0x42817f['errors'][_0x577fff(0x101)]>0x0){console[_0x577fff(0x1a9)]('─'['repeat'](0x3c)),console[_0x577fff(0x1a9)]('\x0a'+a22_0x58cf01['red'](_0x577fff(0x13f)));for(const _0x405409 of _0x42817f[_0x577fff(0x19d)]){console['error']('\x20\x20'+a22_0x58cf01[_0x577fff(0x20c)]('•')+'\x20'+_0x405409);}}}async[a22_0x498e22(0xd5)](_0x8ff0d7,_0xd8b2f6){const _0x3fa153=a22_0x498e22;if(_0xd8b2f6[_0x3fa153(0x101)]===0x0){console[_0x3fa153(0x1a9)]('\x0a'+_0x8ff0d7),console['error'](_0x3fa153(0xf8));return;}console[_0x3fa153(0x1a9)]('\x0a'+_0x8ff0d7);const _0x2058eb=Object['keys'](_0xd8b2f6[0x0])[_0x3fa153(0xf2)](_0x757c60=>({'name':_0x757c60,'type':typeof _0xd8b2f6[0x0][_0x757c60]===_0x3fa153(0xa5)?_0x3fa153(0x1da):_0x3fa153(0x9a)})),_0x543a9b={'queryId':'preview','columns':_0x2058eb,'data':_0xd8b2f6,'stats':{'state':'FINISHED','queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0xd8b2f6[_0x3fa153(0x101)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x4898af=formatAsTable(_0x543a9b,_0xd8b2f6[_0x3fa153(0x101)],!![]);await writeOutput(_0x4898af,undefined,'table');}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x183);['description']=a22_0x498e22(0x114);async[a22_0x498e22(0x1ba)](_0x48099){const _0x3a7109=a22_0x498e22,{options:_0x3b5ee9,args:_0x36eaae,tdx:_0x46daf1}=_0x48099,_0x3f1db6=_0x3b5ee9,_0x3fe40c=_0x36eaae[0x0]||_0x3b5ee9[_0x3a7109(0xbe)];if(!_0x3fe40c)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a'+_0x3a7109(0xc3)),0x1;const _0x4d81f9=resolveYamlFile(_0x3fe40c);if(existsSync(_0x4d81f9)){_0x3f1db6[_0x3a7109(0x1c5)]&&console[_0x3a7109(0x1a9)]('Found\x20YAML\x20file:\x20'+_0x4d81f9);let _0xb33146;try{_0xb33146=readFileSync(_0x4d81f9,'utf-8');}catch(_0x191239){const _0x4cbbbb=_0x191239 instanceof Error?_0x191239['message']:String(_0x191239);return console[_0x3a7109(0x1a9)]('Error\x20reading\x20file:\x20'+_0x4cbbbb),0x1;}const _0x108c8c=await withSpinner(_0x3a7109(0x1b1),()=>_0x46daf1['segment'][_0x3a7109(0x15f)](_0xb33146),{'verbose':_0x3f1db6[_0x3a7109(0x1c5)]}),_0x197b7b=_0x108c8c[_0x3a7109(0xba)],{isNew:_0x1532dd,name:_0x3bb376,hasChanges:_0x22c2e3,diffFormatted:_0x489c8d}=_0x197b7b;if(_0x22c2e3){_0x1532dd?console['error'](_0x3a7109(0x9b)+_0x3bb376+'\x27:'):console[_0x3a7109(0x1a9)](_0x3a7109(0xf3)+_0x3bb376+'\x27:');console['error']('─'['repeat'](0x3c)),console[_0x3a7109(0x1a9)](_0x489c8d),console[_0x3a7109(0x1a9)]('─'[_0x3a7109(0x14c)](0x3c));const _0xfe3988=_0x1532dd?_0x3a7109(0x154)+_0x3bb376+_0x3a7109(0x1c3):'Apply\x20changes\x20to\x20\x27'+_0x3bb376+_0x3a7109(0x1c3);if(!_0x3f1db6['yes']){if(!isInteractive())return console['error'](a22_0x58cf01[_0x3a7109(0x20c)](_0x3a7109(0x1e2)),_0x3a7109(0x1b3)),console[_0x3a7109(0x1a9)](a22_0x58cf01[_0x3a7109(0x1db)](_0x3a7109(0x92))),0x1;const _0x36fb23=await confirmKey(_0xfe3988);if(!_0x36fb23)return console['error'](a22_0x58cf01[_0x3a7109(0x204)](_0x3a7109(0x18c))),0x1;}const _0x19e4c3=_0x1532dd?_0x3a7109(0x1ae):'Updating';await withSpinner(_0x19e4c3+_0x3a7109(0x16e)+_0x3bb376+_0x3a7109(0x12b),()=>_0x197b7b[_0x3a7109(0x17b)](),{'verbose':_0x3f1db6[_0x3a7109(0x1c5)]});const _0x510329=_0x1532dd?_0x3a7109(0x10a):_0x3a7109(0xaa);console[_0x3a7109(0x1a9)]('✔\x20'+_0x510329+_0x3a7109(0x16e)+_0x3bb376+'\x27');}else console[_0x3a7109(0x1a9)](_0x3a7109(0x184)+_0x3bb376+_0x3a7109(0x164));}const _0xc83303=await withSpinner('Running\x20parent\x20segment\x20workflow\x20for\x20\x27'+_0x3fe40c+_0x3a7109(0x12b),()=>_0x46daf1[_0x3a7109(0x1f7)][_0x3a7109(0x19a)](_0x3fe40c),{'verbose':_0x3f1db6[_0x3a7109(0x1c5)]}),_0x5dda40=_0xc83303[_0x3a7109(0xba)],_0x501c15=getConsoleUrl(_0x3f1db6[_0x3a7109(0x1c6)],'/app/workflows/'+_0x5dda40[_0x3a7109(0x1bb)]+'/sessions/'+_0x5dda40[_0x3a7109(0x1e6)]+'/attempt/'+_0x5dda40[_0x3a7109(0x118)]);return console['error'](_0x3a7109(0x1bf)),console[_0x3a7109(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x3a7109(0x1db)](_0x3a7109(0x1c8))+'\x20'+_0x5dda40[_0x3a7109(0xdf)]),console[_0x3a7109(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x3a7109(0x1db)]('Status:')+'\x20'+_0x5dda40['status']),console[_0x3a7109(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x3a7109(0x1db)](_0x3a7109(0x159))+'\x20'+_0x5dda40[_0x3a7109(0x1e6)]),console[_0x3a7109(0x1a9)]('\x20\x20'+a22_0x58cf01['dim']('Attempt:')+'\x20'+_0x5dda40['workflowAttemptId']),console[_0x3a7109(0x1a9)]('\x20\x20'+_0x501c15),console[_0x3a7109(0x1a9)]('\x0a'+a22_0x58cf01[_0x3a7109(0x1db)](_0x3a7109(0x12d))+'\x20tdx\x20wf\x20attempt\x20'+_0x5dda40[_0x3a7109(0x118)]+_0x3a7109(0x1c7)),0x0;}}function a22_0x4b09(_0x176d08,_0x3da343){_0x176d08=_0x176d08-0x90;const _0xed35d=a22_0xed35();let _0x4b096c=_0xed35d[_0x176d08];return _0x4b096c;}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0xf1);[a22_0x498e22(0x147)]=a22_0x498e22(0x151);async[a22_0x498e22(0x1ba)](_0x34976b){const _0xbd76bc=a22_0x498e22,{options:_0x163cee,args:_0x2b6444,tdx:_0x423f6e}=_0x34976b,_0x45a854=_0x2b6444[0x0]||_0x163cee[_0xbd76bc(0xbe)];if(!_0x45a854)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a'+'\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;_0x163cee[_0xbd76bc(0x1c5)]&&(console[_0xbd76bc(0x1a9)](_0xbd76bc(0x9d)+_0x163cee[_0xbd76bc(0x1c6)]),console[_0xbd76bc(0x1a9)](_0xbd76bc(0x1e4)+_0x45a854));const _0x4e1e37=await withSpinner(_0xbd76bc(0xa9)+_0x45a854+'\x27...',()=>_0x423f6e[_0xbd76bc(0x1f7)][_0xbd76bc(0x1f8)](_0x45a854),{'verbose':_0x163cee[_0xbd76bc(0x1c5)]}),_0x4856c5=_0x4e1e37[_0xbd76bc(0xba)];console['error']('✔\x20Found\x20'+_0x4856c5[_0xbd76bc(0x101)]+_0xbd76bc(0x207)+(_0x4856c5[_0xbd76bc(0x101)]!==0x1?'s':''));if(_0x163cee[_0xbd76bc(0x130)]||_0x163cee[_0xbd76bc(0x103)])return await handleSDKOutput(_0x4856c5,_0x163cee),0x0;return displayFieldsHumanReadable(_0x4856c5,_0x45a854),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x11b);[a22_0x498e22(0x147)]='Show\x20parent\x20segment\x20details';async[a22_0x498e22(0x1ba)](_0x31ebdb){const _0x2e0872=a22_0x498e22,{options:_0x43b6d1,args:_0x355dd9,tdx:_0x5db96e}=_0x31ebdb,_0x1c44c4=_0x43b6d1,_0x2778f9=_0x355dd9[0x0]||_0x43b6d1[_0x2e0872(0xbe)];if(!_0x2778f9)return showParentSegmentNotSetError(_0x2e0872(0xc7)+_0x2e0872(0x171)+_0x2e0872(0xa4)+_0x2e0872(0x20e)),0x1;_0x43b6d1[_0x2e0872(0x1c5)]&&(console['error'](_0x2e0872(0x9d)+_0x43b6d1[_0x2e0872(0x1c6)]),console[_0x2e0872(0x1a9)](_0x2e0872(0x1e4)+_0x2778f9));const _0x5b4ca1=await withSpinner(_0x2e0872(0x13a)+_0x2778f9+_0x2e0872(0x12b),()=>_0x5db96e[_0x2e0872(0x1f7)][_0x2e0872(0x1ab)](_0x2778f9),{'verbose':_0x43b6d1[_0x2e0872(0x1c5)]}),_0x285014=_0x5b4ca1[_0x2e0872(0xba)];if(_0x1c44c4[_0x2e0872(0x189)]){const _0x13035f=getConsoleNextUrl(_0x1c44c4[_0x2e0872(0x1c6)],_0x2e0872(0x18e)+_0x285014['id']);return console[_0x2e0872(0x1a9)](a22_0x58cf01[_0x2e0872(0xd7)]('✔')+_0x2e0872(0xc5)+a22_0x58cf01['cyan'](_0x13035f)),openBrowser(_0x13035f),0x0;}return await handleSingleObjectOutput(_0x285014,_0x43b6d1),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x498e22(0x1b8)]='segment:parent:desc';['description']=a22_0x498e22(0x168);async[a22_0x498e22(0x1ba)](_0x4e828f){const _0x1b0d73=a22_0x498e22,{options:_0x1f2c3a,args:_0x2ec66c,tdx:_0x469dd6}=_0x4e828f,_0x2cfdd3=_0x1f2c3a,_0x170e73=_0x2ec66c[0x0]||_0x1f2c3a[_0x1b0d73(0xbe)];if(!_0x170e73)return showParentSegmentNotSetError(_0x1b0d73(0x1f3)+_0x1b0d73(0xa6)+'Options:\x0a'+_0x1b0d73(0xe7)),0x1;_0x1f2c3a[_0x1b0d73(0x1c5)]&&(console[_0x1b0d73(0x1a9)](_0x1b0d73(0x9d)+_0x1f2c3a[_0x1b0d73(0x1c6)]),console[_0x1b0d73(0x1a9)]('Parent\x20segment:\x20'+_0x170e73));const _0x422416=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x170e73+_0x1b0d73(0x12b),()=>_0x469dd6[_0x1b0d73(0x1f7)][_0x1b0d73(0x1a2)](_0x170e73),{'verbose':_0x1f2c3a[_0x1b0d73(0x1c5)]}),_0x1b1e48=_0x422416[_0x1b0d73(0xba)],_0x282c3f=_0x469dd6['segment'][_0x1b0d73(0xde)](_0x1b1e48);if(_0x2cfdd3[_0x1b0d73(0x1e3)]){const _0x4be862=await this[_0x1b0d73(0x141)](_0x4e828f,_0x170e73,_0x1b1e48,_0x282c3f),_0x1d0b5a=this[_0x1b0d73(0x209)](_0x4be862);writeFileSync(_0x2cfdd3['output'],_0x1d0b5a);const _0x15ade0=_0x4be862[_0x1b0d73(0x208)][_0x1b0d73(0x1f2)][_0x1b0d73(0x101)]+_0x4be862[_0x1b0d73(0x1a8)]['reduce']((_0x55b741,_0x58cc5f)=>_0x55b741+_0x58cc5f[_0x1b0d73(0x1f2)][_0x1b0d73(0x101)],0x0),_0x3ba77a=_0x4be862[_0x1b0d73(0x1a8)]['filter'](_0xecfbd1=>_0xecfbd1[_0x1b0d73(0x1f2)][_0x1b0d73(0x101)]===0x0)[_0x1b0d73(0x101)];return console[_0x1b0d73(0x146)](_0x1b0d73(0x119)+_0x2cfdd3['output']),console['log'](_0x1b0d73(0x175)+_0x282c3f),console[_0x1b0d73(0x146)](_0x1b0d73(0x18b)+_0x4be862[_0x1b0d73(0x1a8)][_0x1b0d73(0x101)]+_0x1b0d73(0x1e5)),console[_0x1b0d73(0x146)]('\x20\x20Columns:\x20'+_0x15ade0+_0x1b0d73(0x107)),_0x3ba77a>0x0&&console[_0x1b0d73(0x146)](_0x1b0d73(0x113)+_0x3ba77a+_0x1b0d73(0x117)),0x0;}console[_0x1b0d73(0x1a9)]('\x0a'+a22_0x58cf01['bold'](_0x1b0d73(0x17a))+'\x20'+a22_0x58cf01['cyan'](_0x282c3f));const _0x12b0f2=await withSpinner(_0x1b0d73(0x142),()=>_0x469dd6[_0x1b0d73(0x1f7)]['getParentSQL'](_0x1b1e48),{'verbose':_0x1f2c3a[_0x1b0d73(0x1c5)]});console[_0x1b0d73(0x1a9)]('\x0a'+a22_0x58cf01['bold']('customers')+'\x20'+a22_0x58cf01['dim']('('+_0x282c3f+'.customers)'));const _0x409e97=await executeSchemaQuery(_0x12b0f2[_0x1b0d73(0xba)],_0x469dd6,_0x1f2c3a);await handleQueryOutput(_0x409e97,_0x1f2c3a);const _0x10be00=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x469dd6['segment'][_0x1b0d73(0xbd)](_0x1b1e48),{'verbose':_0x1f2c3a['verbose']});for(const _0x38ab62 of _0x10be00[_0x1b0d73(0xba)]){const _0x55f4ff=_0x1b0d73(0xb7)+_0x38ab62[_0x1b0d73(0x16f)]()[_0x1b0d73(0x12a)](/\s+/g,'_'),_0xe6267f=_0x1b0d73(0x1bc)+_0x282c3f+'.'+_0x55f4ff;console[_0x1b0d73(0x1a9)]('\x0a'+a22_0x58cf01[_0x1b0d73(0x1f6)](_0x38ab62)+'\x20'+a22_0x58cf01[_0x1b0d73(0x1db)]('('+_0x282c3f+'.'+_0x55f4ff+')'));try{const _0x56a4c6=await executeSchemaQuery(_0xe6267f,_0x469dd6,_0x1f2c3a);await handleQueryOutput(_0x56a4c6,_0x1f2c3a);}catch{console[_0x1b0d73(0x1a9)](a22_0x58cf01[_0x1b0d73(0x204)](_0x1b0d73(0x1cb)));}}return 0x0;}async[a22_0x498e22(0x141)](_0x2040e7,_0x590d3e,_0x4dfc48,_0x5d0bcc){const _0x58bf46=a22_0x498e22,{options:_0x4dc1cc,tdx:_0x3e9409}=_0x2040e7,_0x3bde80=await withSpinner(_0x58bf46(0x142),()=>_0x3e9409[_0x58bf46(0x1f7)][_0x58bf46(0xf0)](_0x4dfc48),{'verbose':_0x4dc1cc[_0x58bf46(0x1c5)]}),_0x560d26=await executeSchemaQuery(_0x3bde80[_0x58bf46(0xba)],_0x3e9409,_0x4dc1cc),_0x2f4180=_0x560d26[_0x58bf46(0xba)][_0x58bf46(0xf2)](_0x95b1dd=>({'name':_0x95b1dd[_0x58bf46(0x136)],'type':_0x95b1dd[_0x58bf46(0x1fb)]})),_0x4a1ff9=await withSpinner('Fetching\x20behavior\x20list...',()=>_0x3e9409[_0x58bf46(0x1f7)][_0x58bf46(0xbd)](_0x4dfc48),{'verbose':_0x4dc1cc[_0x58bf46(0x1c5)]}),_0x587ec2=[];for(const _0x4527ad of _0x4a1ff9[_0x58bf46(0xba)]){const _0x5da44a='behavior_'+_0x4527ad[_0x58bf46(0x16f)]()[_0x58bf46(0x12a)](/\s+/g,'_'),_0x1e4176=_0x58bf46(0x1bc)+_0x5d0bcc+'.'+_0x5da44a;let _0xe556b5=[];try{const _0x3e99e0=await executeSchemaQuery(_0x1e4176,_0x3e9409,_0x4dc1cc);_0xe556b5=_0x3e99e0[_0x58bf46(0xba)][_0x58bf46(0xf2)](_0x48f869=>({'name':_0x48f869['column_name'],'type':_0x48f869[_0x58bf46(0x1fb)]}));}catch{}_0x587ec2[_0x58bf46(0xb3)]({'table':_0x5da44a,'columns':_0xe556b5});}return{'database':_0x5d0bcc,'parent_segment':_0x590d3e,'parent_id':_0x4dfc48,'customers':{'table':_0x58bf46(0x208),'columns':_0x2f4180},'behaviors':_0x587ec2};}[a22_0x498e22(0x209)](_0x1eb4df){const _0x2f44c2=a22_0x498e22,_0x4bde6e=_0x430469=>{const _0x3221c5=a22_0x4b09;if(_0x430469[_0x3221c5(0x101)]===0x0)return'[]';const _0x20deec=_0x430469[_0x3221c5(0xf2)](_0x4b35c2=>_0x3221c5(0xc8)+_0x4b35c2[_0x3221c5(0x1b8)]+'\x22,\x20\x22type\x22:\x20\x22'+_0x4b35c2[_0x3221c5(0xed)]+'\x22\x20}');return'[\x0a'+_0x20deec['join'](',\x0a')+_0x3221c5(0x182);},_0x281a32=_0x1eb4df[_0x2f44c2(0x1a8)][_0x2f44c2(0xf2)](_0x3a327f=>{const _0x1590f6=_0x2f44c2;return _0x1590f6(0x174)+_0x3a327f[_0x1590f6(0x1ea)]+'\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20'+_0x4bde6e(_0x3a327f[_0x1590f6(0x1f2)])['replace'](/^/gm,'\x20\x20')[_0x1590f6(0x172)]()+_0x1590f6(0x1af);})[_0x2f44c2(0x176)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x1eb4df[_0x2f44c2(0x17d)]+_0x2f44c2(0x19c)+_0x1eb4df[_0x2f44c2(0x138)]+'\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22'+_0x1eb4df[_0x2f44c2(0x10f)]+_0x2f44c2(0xcf)+_0x1eb4df[_0x2f44c2(0x208)][_0x2f44c2(0x1ea)]+_0x2f44c2(0xd4)+_0x4bde6e(_0x1eb4df[_0x2f44c2(0x208)][_0x2f44c2(0x1f2)])[_0x2f44c2(0x12a)](/^/gm,'\x20\x20')[_0x2f44c2(0x172)]()+'\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a'+_0x281a32+_0x2f44c2(0xdb);}}export class ParentSegmentSQLCommand extends BaseCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x1ac);[a22_0x498e22(0x147)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async[a22_0x498e22(0x1ba)](_0x552ada){const _0x140e15=a22_0x498e22,{options:_0x397501,args:_0x48cd96,tdx:_0x5223b3}=_0x552ada,_0xc2fe64=_0x48cd96[0x0]||_0x397501[_0x140e15(0xbe)];if(!_0xc2fe64)return showParentSegmentNotSetError(_0x140e15(0x10b)+'\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;_0x397501[_0x140e15(0x1c5)]&&(console[_0x140e15(0x1a9)](_0x140e15(0x9d)+_0x397501[_0x140e15(0x1c6)]),console[_0x140e15(0x1a9)](_0x140e15(0x1e4)+_0xc2fe64));const _0x3306a5=await withSpinner(_0x140e15(0xbf)+_0xc2fe64+_0x140e15(0x12b),()=>_0x5223b3[_0x140e15(0x1f7)][_0x140e15(0x1a2)](_0xc2fe64),{'verbose':_0x397501[_0x140e15(0x1c5)]}),_0x58b9f5=_0x3306a5[_0x140e15(0xba)],_0x43b27f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0xc2fe64+_0x140e15(0x12b),()=>_0x5223b3[_0x140e15(0x1f7)]['getParentSQL'](_0x58b9f5),{'verbose':_0x397501[_0x140e15(0x1c5)]}),_0x5d491a=_0x43b27f[_0x140e15(0xba)];return _0x397501[_0x140e15(0x11e)]==='json'||_0x397501[_0x140e15(0x11e)]===_0x140e15(0x103)?await handleSDKOutput([{'sql':_0x5d491a}],_0x397501):console[_0x140e15(0x146)](_0x5d491a),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x1c4);[a22_0x498e22(0x147)]=a22_0x498e22(0xc2);async['execute'](_0x23b920){const _0x44a67d=a22_0x498e22,{options:_0x565d6b,args:_0x3f3202,tdx:_0x541178}=_0x23b920,_0x3326ad=_0x3f3202[0x0]||_0x565d6b[_0x44a67d(0xbe)];if(!_0x3326ad)return showParentSegmentNotSetError(_0x44a67d(0x1f1)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20show\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20for\x20specific\x20parent\x20segment'),0x1;_0x565d6b['verbose']&&(console[_0x44a67d(0x1a9)]('Site:\x20'+_0x565d6b[_0x44a67d(0x1c6)]),console[_0x44a67d(0x1a9)](_0x44a67d(0x1e4)+_0x3326ad));const _0x47cc66=await withSpinner(_0x44a67d(0xbf)+_0x3326ad+_0x44a67d(0x12b),()=>_0x541178['segment'][_0x44a67d(0x1a2)](_0x3326ad),{'verbose':_0x565d6b[_0x44a67d(0x1c5)]}),_0x3b7077=_0x47cc66[_0x44a67d(0xba)],_0x143d9f=await withSpinner('Fetching\x20SQL\x20for\x20\x27'+_0x3326ad+_0x44a67d(0x12b),()=>_0x541178[_0x44a67d(0x1f7)][_0x44a67d(0xf0)](_0x3b7077),{'verbose':_0x565d6b[_0x44a67d(0x1c5)]});let _0x270c75=_0x143d9f['data'];const _0x59d1ac=resolveLimit(_0x565d6b[_0x44a67d(0x169)],DEFAULT_DISPLAY_LIMIT),_0x9195fe=/\bLIMIT\s+\d+/i['test'](_0x270c75);!_0x9195fe&&(_0x270c75=_0x270c75['trim']()[_0x44a67d(0x12a)](/;+$/,''),_0x270c75=_0x44a67d(0xa3)+_0x270c75+_0x44a67d(0x91)+_0x59d1ac);_0x565d6b['verbose']&&console[_0x44a67d(0x1a9)](_0x44a67d(0x1cd)+_0x270c75);const _0x5236b8=await withProgressSpinner(_0x44a67d(0x181),async _0x47a811=>{const _0x2925f8=_0x44a67d,_0x1cd4cd=await _0x541178['query'][_0x2925f8(0x1ba)](_0x270c75,{'catalog':'td','schema':_0x2925f8(0xa0),'onJobId':_0x394fb4=>{const _0x526657=_0x2925f8;_0x47a811[_0x526657(0x128)](_0x394fb4);}});return _0x1cd4cd;},{'verbose':_0x565d6b[_0x44a67d(0x1c5)]}),_0x3ed02c=_0x5236b8['data'],_0xbaf4d3=_0x3ed02c['jobId']?_0x44a67d(0x195)+_0x3ed02c['jobId']+']':'';return console[_0x44a67d(0x1a9)](_0x44a67d(0x1ec)+_0x3ed02c[_0x44a67d(0x14e)]['processedRows'][_0x44a67d(0x187)]()+_0x44a67d(0x1a7)+(_0x44a67d(0x123)+formatElapsed(_0x3ed02c['stats'][_0x44a67d(0xc9)])+_0xbaf4d3)),await handleQueryOutput(_0x3ed02c,_0x565d6b),0x0;}}export class PSRtListCommand extends BaseCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0xee);[a22_0x498e22(0x147)]=a22_0x498e22(0xa7);async[a22_0x498e22(0x1ba)](_0x5203cd){const _0x56cfef=a22_0x498e22,{options:_0x413fbf,args:_0xef28ed,tdx:_0x3c735b}=_0x5203cd,_0x4f3092=_0xef28ed[0x0],_0x345043=await withSpinner(_0x4f3092?_0x56cfef(0x10c)+_0x4f3092+_0x56cfef(0x12b):_0x56cfef(0x134),()=>_0x3c735b[_0x56cfef(0x200)]['list'](),{'verbose':_0x413fbf[_0x56cfef(0x1c5)]});let _0x22d088=_0x345043['data'][_0x56cfef(0xd6)](_0x32068f=>_0x32068f['realtime_enabled']);if(_0x4f3092){const _0x37ff8b=_0x4f3092[_0x56cfef(0x12a)](/[.+^${}()|[\]\\]/g,'\x5c$&')[_0x56cfef(0x12a)](/\*/g,'.*')[_0x56cfef(0x12a)](/\?/g,'.'),_0x1d81ef=new RegExp('^'+_0x37ff8b+'$','i');_0x22d088=_0x22d088[_0x56cfef(0xd6)](_0x12b2a9=>_0x1d81ef[_0x56cfef(0xad)](_0x12b2a9['name']));}_0x22d088[_0x56cfef(0x97)]((_0x36f33b,_0x44eb2e)=>_0x36f33b[_0x56cfef(0x1b8)][_0x56cfef(0xbb)](_0x44eb2e[_0x56cfef(0x1b8)])),console[_0x56cfef(0x1a9)]('✔\x20Found\x20'+_0x22d088['length']+_0x56cfef(0xa1)+(_0x22d088[_0x56cfef(0x101)]!==0x1?'s':''));const _0x20b754=_0x37a621=>{const _0x44c612=_0x56cfef;return getConsoleNextUrl(_0x413fbf[_0x44c612(0x1c6)],_0x44c612(0x18e)+_0x37a621);};if(_0x413fbf[_0x56cfef(0x11e)]==='json'||_0x413fbf[_0x56cfef(0x11e)]===_0x56cfef(0x103)){const _0x172555=_0x22d088[_0x56cfef(0xf2)](_0x427f6c=>({..._0x427f6c,'url':_0x20b754(_0x427f6c['id'])}));await handleSDKOutput(_0x172555,_0x413fbf);}else{if(_0x22d088[_0x56cfef(0x101)]===0x0)console['log'](_0x56cfef(0x1fe));else for(const _0x768a08 of _0x22d088){const _0x2321da=_0x768a08[_0x56cfef(0x9e)]?a22_0x58cf01['dim']('\x20('+formatRows(_0x768a08['population'])+')'):'',_0x3b264e=hyperlink(_0x768a08[_0x56cfef(0x1b8)],_0x20b754(_0x768a08['id']));console['log']('⚡\x20'+_0x3b264e+_0x2321da);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{['name']=a22_0x498e22(0x148);[a22_0x498e22(0x147)]=a22_0x498e22(0x127);async[a22_0x498e22(0x1ba)](_0x41649a){const _0x359c24=a22_0x498e22,{options:_0x43cf57,args:_0x3d1499,tdx:_0x20b1ec}=_0x41649a,_0x376373=_0x3d1499[0x0]||_0x43cf57[_0x359c24(0xbe)];if(!_0x376373)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a'+_0x359c24(0x135)),0x1;const _0x2fcd81=resolveYamlFile(_0x376373);if(!existsSync(_0x2fcd81))return showFileNotFoundError(_0x2fcd81,_0x376373),0x1;let _0x3f7021;try{_0x3f7021=readFileSync(_0x2fcd81,_0x359c24(0xfd));}catch(_0x4de0c9){const _0x181042=_0x4de0c9 instanceof Error?_0x4de0c9[_0x359c24(0x173)]:String(_0x4de0c9);return console[_0x359c24(0x1a9)](_0x359c24(0x1b4)+_0x181042),0x1;}const _0x65a00f=createCommandSpinner(a22_0x58cf01['dim'](_0x359c24(0x1d6)),{'verbose':_0x43cf57[_0x359c24(0x1c5)]});_0x65a00f[_0x359c24(0x166)]();const _0x446d50={'realtime':!![],'onProgress':_0x50dcd1=>{_0x65a00f['text']=formatProgressMessage(_0x50dcd1);}};let _0x86ce0a;try{_0x86ce0a=await _0x20b1ec[_0x359c24(0x1f7)]['validateParentYaml'](_0x3f7021,_0x446d50),_0x65a00f['stop']();}catch(_0xaf870a){_0x65a00f[_0x359c24(0x1c2)]();throw _0xaf870a;}console['error']('\x0a'+a22_0x58cf01[_0x359c24(0x1f6)]('RT\x202.0\x20Validate:')+'\x20'+_0x86ce0a[_0x359c24(0x1b8)]),console['error']('═'[_0x359c24(0x14c)](0x3c)),displayRealtimeValidation(_0x86ce0a),console[_0x359c24(0x1a9)]('─'[_0x359c24(0x14c)](0x3c));if(_0x86ce0a['errors'][_0x359c24(0x101)]>0x0){console[_0x359c24(0x1a9)]('\x0a'+a22_0x58cf01[_0x359c24(0x20c)](_0x359c24(0x13f)));for(const _0x38da0d of _0x86ce0a[_0x359c24(0x19d)]){console[_0x359c24(0x1a9)]('\x20\x20'+a22_0x58cf01[_0x359c24(0x20c)]('•')+'\x20'+_0x38da0d);}}return _0x86ce0a['allValid']&&console[_0x359c24(0x1a9)]('\x0a'+a22_0x58cf01[_0x359c24(0xd7)]('✔')+'\x20RT\x20configuration\x20is\x20valid'),_0x86ce0a[_0x359c24(0x98)]?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{[a22_0x498e22(0x1b8)]='ps:pz:list';['description']=a22_0x498e22(0x191);async['execute'](_0xfc21c4){const _0x188799=a22_0x498e22,{options:_0x2d1e0a,args:_0x45af8e,tdx:_0x5839d2}=_0xfc21c4,_0x169800=_0x45af8e[0x0]||_0x2d1e0a[_0x188799(0xbe)];if(!_0x169800)return showParentSegmentNotSetError(_0x188799(0x18d)+_0x188799(0x137)),0x1;const _0x35c585=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x169800+_0x188799(0x12b),()=>_0x5839d2[_0x188799(0x1f7)][_0x188799(0x1a2)](_0x169800),{'verbose':_0x2d1e0a[_0x188799(0x1c5)]}),_0x3fedb9=_0x35c585[_0x188799(0xba)],_0x27edcc=await withSpinner(_0x188799(0xe8)+_0x169800+'\x27...',()=>_0x5839d2[_0x188799(0xcd)][_0x188799(0x199)](_0x3fedb9),{'verbose':_0x2d1e0a[_0x188799(0x1c5)]}),_0x1a2916=_0x27edcc[_0x188799(0xba)];console[_0x188799(0x1a9)](_0x188799(0x155)+_0x1a2916['length']+_0x188799(0x1f0)+(_0x1a2916[_0x188799(0x101)]!==0x1?'s':''));if(_0x2d1e0a[_0x188799(0x11e)]===_0x188799(0x130)||_0x2d1e0a[_0x188799(0x11e)]==='jsonl')await handleSDKOutput(_0x1a2916,_0x2d1e0a);else{if(_0x1a2916['length']===0x0)console[_0x188799(0x146)](_0x188799(0x90)),console[_0x188799(0x1a9)](a22_0x58cf01[_0x188799(0x192)](_0x188799(0x1b9)));else for(const _0x14037d of _0x1a2916){const _0xb20ba2=_0x14037d['sections']?.[_0x188799(0x101)]||0x0,_0xb4981f=_0x14037d[_0x188799(0x1ef)]?a22_0x58cf01[_0x188799(0x1db)](_0x188799(0xff)+_0x14037d[_0x188799(0x1ef)]):'',_0x30e3ec=a22_0x58cf01[_0x188799(0x1db)]('\x20('+_0xb20ba2+_0x188799(0x180)+(_0xb20ba2!==0x1?'s':'')+')');console[_0x188799(0x146)]('\x20\x20'+_0x14037d[_0x188799(0x1b8)]+_0xb4981f+_0x30e3ec),_0x14037d[_0x188799(0x147)]&&console[_0x188799(0x146)](_0x188799(0xfa)+a22_0x58cf01[_0x188799(0x1db)](_0x14037d[_0x188799(0x147)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x498e22(0x1b8)]=a22_0x498e22(0x133);[a22_0x498e22(0x147)]=a22_0x498e22(0xe0);async[a22_0x498e22(0x1ba)](_0x533b32){const _0x27ca6f=a22_0x498e22,{options:_0x5dab80,args:_0x53c26e}=_0x533b32,_0x4be650=_0x53c26e[0x0]||_0x5dab80[_0x27ca6f(0xbe)];if(!_0x4be650)return showParentSegmentNotSetError(_0x27ca6f(0x1e7)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment'),0x1;const _0x3aa90a=resolveYamlFile(_0x4be650);if(!existsSync(_0x3aa90a))return showFileNotFoundError(_0x3aa90a,_0x4be650),0x1;let _0x54549d;try{_0x54549d=readFileSync(_0x3aa90a,'utf-8');}catch(_0x463e37){const _0x1d2722=_0x463e37 instanceof Error?_0x463e37[_0x27ca6f(0x173)]:String(_0x463e37);return console[_0x27ca6f(0x1a9)](_0x27ca6f(0x1b4)+_0x1d2722),0x1;}let _0x5d767f;try{_0x5d767f=parseDef(_0x54549d);}catch(_0x2143a7){const _0x5164ef=_0x2143a7 instanceof Error?_0x2143a7[_0x27ca6f(0x173)]:String(_0x2143a7);return console[_0x27ca6f(0x1a9)](a22_0x58cf01[_0x27ca6f(0x20c)]('Error\x20parsing\x20YAML:\x20'+_0x5164ef)),0x1;}if(_0x5d767f[_0x27ca6f(0x15c)]&&_0x5d767f[_0x27ca6f(0x15c)]['length']>0x0)return console[_0x27ca6f(0x1a9)](a22_0x58cf01[_0x27ca6f(0x204)](_0x27ca6f(0x109)+_0x3aa90a)),console['error'](a22_0x58cf01[_0x27ca6f(0x1db)]('\x20\x20\x20'+_0x5d767f['personalization_services'][_0x27ca6f(0x101)]+_0x27ca6f(0x14f))),0x1;!_0x5d767f['realtime']&&(_0x5d767f[_0x27ca6f(0x200)]={'events':[{'name':'page_view','source_table':_0x27ca6f(0x1d2)}],'attributes':[{'name':_0x27ca6f(0x1b6),'type':_0x27ca6f(0xfb)}],'id_stitching':{'primary_key':_0x5d767f[_0x27ca6f(0x110)][_0x27ca6f(0x1ea)]===_0x27ca6f(0x208)?_0x27ca6f(0x115):_0x27ca6f(0xeb)}});_0x5d767f[_0x27ca6f(0x15c)]=[{'name':_0x27ca6f(0x112),'description':_0x27ca6f(0xcc),'trigger_event':_0x27ca6f(0x13b),'sections':[{'name':_0x27ca6f(0x94),'criteria':_0x27ca6f(0x11c),'attributes':[_0x27ca6f(0x1b6)]}]}];const _0x18d10a=serializeDef(_0x5d767f);return writeFileSync(_0x3aa90a,_0x18d10a,_0x27ca6f(0xfd)),console[_0x27ca6f(0x1a9)](a22_0x58cf01[_0x27ca6f(0xd7)]('✔')+'\x20Added\x20personalization\x20template\x20to\x20'+a22_0x58cf01[_0x27ca6f(0x192)](_0x3aa90a)),(!_0x5d767f[_0x27ca6f(0x200)]||_0x54549d[_0x27ca6f(0xea)](_0x27ca6f(0x144))===-0x1)&&console['error'](a22_0x58cf01[_0x27ca6f(0xd7)]('✔')+_0x27ca6f(0x131)),console['error']('\x0a'+a22_0x58cf01['dim']('Next\x20steps:')),console[_0x27ca6f(0x1a9)]('\x20\x201.\x20Edit\x20'+_0x3aa90a+'\x20to\x20configure\x20your\x20personalization\x20service'),console[_0x27ca6f(0x1a9)](_0x27ca6f(0x1d7)+a22_0x58cf01[_0x27ca6f(0x1db)](_0x27ca6f(0x158)+_0x4be650)+_0x27ca6f(0x156)),0x0;}}
1
+ const a22_0x8dcc7b=a22_0x4d07;(function(_0x29ce9c,_0x3ca694){const _0x10cadc=a22_0x4d07,_0x31121e=_0x29ce9c();while(!![]){try{const _0x3a2e0c=-parseInt(_0x10cadc(0x269))/0x1+parseInt(_0x10cadc(0x2bf))/0x2*(-parseInt(_0x10cadc(0x251))/0x3)+parseInt(_0x10cadc(0x303))/0x4+parseInt(_0x10cadc(0x1c8))/0x5*(parseInt(_0x10cadc(0x1f8))/0x6)+parseInt(_0x10cadc(0x2f5))/0x7*(-parseInt(_0x10cadc(0x2c6))/0x8)+-parseInt(_0x10cadc(0x1fb))/0x9*(-parseInt(_0x10cadc(0x29e))/0xa)+parseInt(_0x10cadc(0x2bd))/0xb;if(_0x3a2e0c===_0x3ca694)break;else _0x31121e['push'](_0x31121e['shift']());}catch(_0x5b49d0){_0x31121e['push'](_0x31121e['shift']());}}}(a22_0x4098,0x3a1c8));import{writeFileSync,readFileSync,existsSync,mkdirSync,renameSync,statSync}from'fs';import{spawn}from'child_process';import a22_0x2fdb40 from'path';import{BaseCommand}from'./command.js';import{handleSDKOutput,handleQueryOutput,handleSingleObjectOutput,writeOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner,createCommandSpinner,formatElapsed}from'../utils/spinner.js';import{loadJSONFromOptions}from'../utils/json-loader.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{getConsoleUrl,getConsoleNextUrl}from'../sdk/client/endpoints.js';import{formatRows,formatAsTable,hyperlink}from'../sdk/util/formatters.js';import{parseDef,serializeDef}from'../sdk/segment/parent-segment-yaml.js';import{confirmKey,isInteractive}from'../utils/prompt.js';import{DEFAULT_DISPLAY_LIMIT,resolveLimit}from'../core/constants.js';import a22_0x43697b from'chalk';import{displayFieldsHumanReadable,executeSchemaQuery}from'../sdk/segment/fields-display.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';const PARENT_SEGMENT_DIR=a22_0x8dcc7b(0x248),LEGACY_PARENT_SEGMENT_DIR='parent_segment';function openBrowser(_0x75ea67){const _0x6e4614=a22_0x8dcc7b,_0x23bf52=process['platform'],_0x2a2017=_0x23bf52==='darwin'?_0x6e4614(0x2ed):_0x23bf52===_0x6e4614(0x235)?'start':_0x6e4614(0x18d);spawn(_0x2a2017,[_0x75ea67],{'detached':!![],'stdio':'ignore'})['unref']();}function migrateLegacyDirectory(){const _0x1505f1=a22_0x8dcc7b;if(!existsSync(LEGACY_PARENT_SEGMENT_DIR))return![];const _0x397eae=statSync(LEGACY_PARENT_SEGMENT_DIR);if(!_0x397eae[_0x1505f1(0x2b8)]())return![];if(existsSync(PARENT_SEGMENT_DIR))return console[_0x1505f1(0x19c)](a22_0x43697b['yellow'](_0x1505f1(0x2ad)+LEGACY_PARENT_SEGMENT_DIR+_0x1505f1(0x26a)+PARENT_SEGMENT_DIR+_0x1505f1(0x23d))),console[_0x1505f1(0x19c)](a22_0x43697b[_0x1505f1(0x2af)](_0x1505f1(0x2f3)+LEGACY_PARENT_SEGMENT_DIR+_0x1505f1(0x2e1))),![];console[_0x1505f1(0x19c)](a22_0x43697b[_0x1505f1(0x250)]('\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'](a22_0x43697b[_0x1505f1(0x1b3)](_0x1505f1(0x18c)+PARENT_SEGMENT_DIR+'/\x0a')),!![];}catch(_0x2c6925){const _0x4f61f8=_0x2c6925 instanceof Error?_0x2c6925[_0x1505f1(0x186)]:String(_0x2c6925);return console[_0x1505f1(0x19c)](a22_0x43697b['red'](_0x1505f1(0x2f9)+_0x4f61f8+'\x0a')),![];}}class BaseParentSegmentCommand extends BaseCommand{async[a22_0x8dcc7b(0x28e)](_0x448b55){const _0x137099=a22_0x8dcc7b;return migrateLegacyDirectory(),super[_0x137099(0x28e)](_0x448b55);}}function resolveYamlFile(_0x5a43e1){const _0x142fde=a22_0x8dcc7b;if(_0x5a43e1[_0x142fde(0x18b)](_0x142fde(0x240))||_0x5a43e1[_0x142fde(0x18b)](_0x142fde(0x1b9)))return _0x5a43e1;return a22_0x2fdb40[_0x142fde(0x1c6)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x5a43e1)+_0x142fde(0x240));}function formatProgressMessage(_0x257a57){const _0x1472b2=a22_0x8dcc7b,_0x54ebda=_0x257a57[_0x1472b2(0x1b5)](/^(.+?):\s*(.+?)(\s*\(.+\))?$/);if(_0x54ebda){const [,_0x4d303d,_0x126844,_0x17c01d='']=_0x54ebda;return a22_0x43697b[_0x1472b2(0x2af)](_0x4d303d+':')+'\x20'+_0x126844+a22_0x43697b[_0x1472b2(0x2af)](_0x17c01d);}return a22_0x43697b[_0x1472b2(0x2af)](_0x257a57);}function showFileNotFoundError(_0x358c0c,_0x775688){const _0x280dc9=a22_0x8dcc7b;console[_0x280dc9(0x19c)](a22_0x43697b[_0x280dc9(0x2c5)](_0x280dc9(0x1c3)+_0x358c0c+'\x0a')),console['error'](a22_0x43697b[_0x280dc9(0x2b4)](_0x280dc9(0x2bb)+_0x775688+_0x280dc9(0x200)));}function displayRealtimeValidation(_0x392446){const _0x59397a=a22_0x8dcc7b;if(!_0x392446[_0x59397a(0x1b4)])return;const _0x3d4708=_0x392446[_0x59397a(0x1b4)],_0x4a3643=_0x3d4708['enabled']?a22_0x43697b[_0x59397a(0x1b3)](_0x59397a(0x1a6)):a22_0x43697b['yellow'](_0x59397a(0x204));console['error']('\x0a'+a22_0x43697b['dim'](_0x59397a(0x299))+'\x20'+_0x4a3643);if(_0x3d4708[_0x59397a(0x1e6)]&&_0x3d4708['events'][_0x59397a(0x28a)]>0x0){console['error']('\x20\x20'+a22_0x43697b[_0x59397a(0x2af)](_0x59397a(0x1cf))+'\x20'+_0x3d4708[_0x59397a(0x1e6)]['length']+_0x59397a(0x21d));for(const _0x173faf of _0x3d4708[_0x59397a(0x1e6)]){const _0x2c838c=_0x173faf[_0x59397a(0x21c)]===![]?a22_0x43697b[_0x59397a(0x2c5)]('✘'):a22_0x43697b[_0x59397a(0x1b3)]('✔');console[_0x59397a(0x19c)](_0x59397a(0x1b7)+_0x2c838c+'\x20'+_0x173faf[_0x59397a(0x300)]),_0x173faf[_0x59397a(0x1f7)]&&console[_0x59397a(0x19c)](_0x59397a(0x253)+a22_0x43697b[_0x59397a(0x2c5)](_0x173faf[_0x59397a(0x1f7)]));}}if(_0x3d4708[_0x59397a(0x210)]&&_0x3d4708[_0x59397a(0x210)][_0x59397a(0x28a)]>0x0){console['error']('\x20\x20'+a22_0x43697b['dim']('Attributes:')+'\x20'+_0x3d4708[_0x59397a(0x210)]['length']+'\x20configured');for(const _0x2a844b of _0x3d4708[_0x59397a(0x210)]){const _0x116308=_0x2a844b[_0x59397a(0x1ec)]?a22_0x43697b['green']('✔'):a22_0x43697b[_0x59397a(0x2c5)]('✘');console['error'](_0x59397a(0x1b7)+_0x116308+'\x20'+_0x2a844b[_0x59397a(0x300)]+'\x20'+a22_0x43697b['dim']('('+_0x2a844b['type']+')'));}}if(_0x3d4708[_0x59397a(0x2d5)]){const _0x3fe0fe=_0x3d4708['idStitching'][_0x59397a(0x1a8)]?.[_0x59397a(0x28a)]?_0x59397a(0x1ee)+_0x3d4708['idStitching']['stitchingKeys'][_0x59397a(0x1c6)](',\x20')+']':'';console[_0x59397a(0x19c)]('\x20\x20'+a22_0x43697b[_0x59397a(0x2af)](_0x59397a(0x2b0))+'\x20'+_0x3d4708[_0x59397a(0x2d5)][_0x59397a(0x22b)]+_0x3fe0fe);}if(_0x3d4708[_0x59397a(0x293)]&&_0x3d4708['personalizationServices']['length']>0x0){console[_0x59397a(0x19c)]('\x20\x20'+a22_0x43697b[_0x59397a(0x2af)](_0x59397a(0x20c))+'\x20'+_0x3d4708['personalizationServices'][_0x59397a(0x28a)]+'\x20service'+(_0x3d4708['personalizationServices'][_0x59397a(0x28a)]!==0x1?'s':''));for(const _0x3f53f5 of _0x3d4708[_0x59397a(0x293)]){console[_0x59397a(0x19c)](_0x59397a(0x2aa)+_0x3f53f5[_0x59397a(0x300)]);}}}function showParentSegmentNotSetError(_0x21869d){const _0x5b0655=a22_0x8dcc7b;console[_0x5b0655(0x19c)](a22_0x43697b[_0x5b0655(0x250)]('parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20ps\x20use\x20<name>`\x20to\x20set\x20it.\x0a')),console[_0x5b0655(0x19c)](_0x21869d);}export class ParentSegmentListCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2fe);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x23f);async[a22_0x8dcc7b(0x20b)](_0x17370b){const _0x595d05=a22_0x8dcc7b,{options:_0x13fefd,args:_0x20e0b9,tdx:_0x502cba}=_0x17370b,_0x2f151e=_0x20e0b9[0x0];_0x13fefd['verbose']&&(console[_0x595d05(0x19c)](_0x595d05(0x24f)+_0x13fefd['site']),_0x2f151e&&console[_0x595d05(0x19c)]('Pattern:\x20'+_0x2f151e));const _0x5a1c53=await withSpinner(_0x2f151e?_0x595d05(0x294)+_0x2f151e+_0x595d05(0x291):'Listing\x20parent\x20segments...',()=>_0x502cba[_0x595d05(0x286)]['listParents'](),{'verbose':_0x13fefd[_0x595d05(0x270)]});let _0x83eda0=_0x5a1c53[_0x595d05(0x207)];if(_0x2f151e){const _0x3808af=_0x2f151e[_0x595d05(0x2a7)](/[.+^${}()|[\]\\]/g,_0x595d05(0x221))[_0x595d05(0x2a7)](/\*/g,'.*')[_0x595d05(0x2a7)](/\?/g,'.'),_0x2c6894=new RegExp('^'+_0x3808af+'$','i');_0x83eda0=_0x83eda0[_0x595d05(0x241)](_0x3176ff=>_0x2c6894[_0x595d05(0x246)](_0x3176ff['attributes'][_0x595d05(0x300)]));}_0x83eda0[_0x595d05(0x228)]((_0x53d07a,_0x4eb829)=>_0x53d07a[_0x595d05(0x210)]['name']['localeCompare'](_0x4eb829[_0x595d05(0x210)]['name'])),console[_0x595d05(0x19c)]('✔\x20Found\x20'+_0x83eda0[_0x595d05(0x28a)]+'\x20parent\x20segment'+(_0x83eda0[_0x595d05(0x28a)]!==0x1?'s':''));const _0x2fbfd5=_0x3e3209=>{const _0x5b8eff=_0x595d05;return getConsoleNextUrl(_0x13fefd[_0x5b8eff(0x1f5)],_0x5b8eff(0x220)+_0x3e3209);};if(_0x13fefd[_0x595d05(0x222)]===_0x595d05(0x2a0)||_0x13fefd[_0x595d05(0x222)]===_0x595d05(0x2f7)){const _0x394ca6=_0x83eda0[_0x595d05(0x20d)](_0x4dd12f=>({..._0x4dd12f,'url':_0x2fbfd5(_0x4dd12f['id'])}));await handleSDKOutput(_0x394ca6,_0x13fefd);}else{if(_0x83eda0[_0x595d05(0x28a)]===0x0)_0x2f151e?console['log'](_0x595d05(0x281)+_0x2f151e):console[_0x595d05(0x2dc)](_0x595d05(0x2a3));else for(const _0x8bac28 of _0x83eda0){const _0x1e2d1a=_0x8bac28['attributes']['population']?a22_0x43697b['dim']('\x20('+formatRows(_0x8bac28['attributes'][_0x595d05(0x287)])+')'):'',_0x532352=hyperlink(_0x8bac28[_0x595d05(0x210)][_0x595d05(0x300)],_0x2fbfd5(_0x8bac28['id']));console[_0x595d05(0x2dc)](_0x595d05(0x236)+_0x532352+_0x1e2d1a);}}return 0x0;}}function a22_0x4098(){const _0x1b84e6=['\x20\x20-w,\x20--web\x20\x20Open\x20parent\x20segment\x20in\x20web\x20browser','Personalization\x20service\x20description','displayMasterInfo','\x20is\x20already\x20up\x20to\x20date','Options:','No\x20parent\x20segments\x20match\x20pattern:\x20','\x20field','Fetching\x20current\x20configuration\x20for\x20\x27','errors','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute\x0a','segment','population','.customers)','displaySampleData','length','limit','interval','ps:rt:validate','run','query','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20sql\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20for\x20specific\x20parent\x20segment','\x27...','start','personalizationServices','Listing\x20parent\x20segments\x20matching\x20\x27','\x20Context\x20set:\x20','column_name','\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)','table','RT\x202.0:','trigger_event','List\x20personalization\x20services\x20for\x20a\x20parent\x20segment','behaviorsFile','customers','20aaDlmM','\x0aUsage:\x20tdx\x20ps\x20preview\x20','json','status','parentSegment','No\x20parent\x20segments\x20found','workflowAttemptId','totalEvents','✔\x20No\x20changes\x20-\x20\x27','replace','No\x20RT-enabled\x20parent\x20segments\x20found','segment:parent:pull','\x20\x20\x20\x20-\x20','workflowSessionId','\x20\x20--attribute\x20<name>\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20attribute','\x0a⚠️\x20\x20Both\x20','Validating\x20configuration...','dim','ID\x20Stitching:','segment:parent:validate','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data','cyan','\x20No\x20changes\x20-\x20','\x20Opening\x20','stats','isDirectory','Listing\x20RT-enabled\x20parent\x20segments...','\x20Added\x20personalization\x20template\x20to\x20','Tip:\x20Run\x20`tdx\x20ps\x20pull\x20-u\x20','✔\x20Updated\x20parent\x20segment\x20\x27','2310396kQlyqr','list','8nmQhNz','Fetching\x20SQL\x20for\x20\x27','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20rt\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20for\x20specific\x20parent\x20segment','\x0aChanges\x20to\x20apply\x20to\x20\x27','behaviors','\x20Saved\x20parent\x20segment\x20configuration\x20to\x20','red','48HrTEMs','segment:parent:view','\x20=\x20','Fetching\x20parent\x20segment\x20\x27','My\x20Service','\x20\x20Tables:\x201\x20customers\x20+\x20','-1d','parent_segment','\x20[Job\x20ID:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20preview\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20specific\x20parent\x20segment\x0a\x0a','Options\x20(one\x20required):\x0a','Usage:\x20tdx\x20ps\x20pz\x20list\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20(requires\x20context)\x0a','Attribute:','\x20total','\x20\x20Note:\x20','idStitching','realtime_enabled','Listing\x20fields\x20for\x20\x27','pullParentYaml','text','Create\x20parent\x20segment\x20\x27','workflowId','log','preview','✔\x20Found\x20','ps:pz:init','Usage:\x20tdx\x20ps\x20show\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20config\x20(requires\x20context)\x0a','/\x20directory.\x0a','Session:','\x20\x20--enriched\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20enriched\x20master\x20data\x0a','addBehaviors','<database>.<table>','Database:\x20','\x20\x20Database:\x20','\x22,\x0a\x20\x20\x22parent_id\x22:\x20\x22','indexOf','\x0a\x20\x20\x20\x20}','setJobId','enriched','open','\x20--attribute\x20\x22<name>\x22','List\x20parent\x20segments\x20with\x20RT\x202.0\x20status','\x0a\x20\x20},\x0a\x20\x20\x22behaviors\x22:\x20[\x0a','\x20\x20Schema\x20not\x20available\x20(workflow\x20may\x20not\x20have\x20run\x20yet)','resolveParentId','\x20\x20\x20Please\x20manually\x20merge\x20or\x20remove\x20','in\x20','420707hMGNtd','pushParentYaml','jsonl','\x20Configuration\x20is\x20valid','✘\x20Failed\x20to\x20rename\x20directory:\x20','\x20service(s)\x20configured','trim','\x20\x20-o,\x20--output\x20<file>\x20\x20Output\x20file\x20path','FINISHED','segment:parent:list','Updating','name','schemaError','database','885892kXAGWm','Creating','\x20parent\x20segment\x20\x27','Behaviors','Usage:\x20tdx\x20parent-segment\x20preview\x20<name>\x20<option>\x0a','Fetching\x20sample\x20data...','Usage:\x20tdx\x20ps\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20(requires\x20context)\x0a','sampleData','last_page_viewed','\x20RT\x20configuration\x20is\x20valid','segment:parent:push','message','Errors:','To\x20view\x20sample\x20data:','\x0a)\x20AS\x20segment_query\x0aLIMIT\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','endsWith','✔\x20Renamed\x20directory\x20to\x20','xdg-open','segment:parent:sql','collectSchema','toLowerCase','displayRealtimeInfo','single','Preview\x20sample\x20data\x20from\x20parent\x20segment\x20YAML\x20configuration','\x22,\x0a\x20\x20\x20\x20\x22columns\x22:\x20','columns','personalization','apply','\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20create`\x20is\x20deprecated.\x0a','varchar','Validate\x20RT\x202.0\x20configuration\x20from\x20parent\x20segment\x20YAML','Usage:\x20tdx\x20ps\x20pz\x20init\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20(requires\x20context)\x0a','error','\x27\x20and\x20run\x20workflow?','td_client_id','\x20personalization\x20service','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20list\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20List\x20PZ\x20services\x20for\x20specific\x20parent\x20segment','\x20--behavior\x20\x22','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20push\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20specific\x20parent\x20segment','Default','\x20\x20Columns:\x20','displayAttributesStats','⚡\x20Enabled','string','stitchingKeys','double','Usage:\x20tdx\x20ps\x20preview\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Preview\x20(requires\x20context)\x0a','Join:','\x20behavior\x20tables\x20not\x20yet\x20generated\x20(workflow\x20may\x20not\x20have\x20run)','column_type','previewParentYaml','Coverage:','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20validate\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20specific\x20parent\x20segment\x0a\x0a','\x20\x20No\x20sample\x20data\x20available','listFields','green','realtime','match','processedRows','\x20\x20\x20\x20','Name:\x20','.yaml','Error:\x20-u\x20(--use)\x20and\x20-o\x20(--output)\x20cannot\x20be\x20used\x20together\x0a','allValid','\x20\x20\x20Use\x20`tdx\x20segment\x20parent\x20push\x20<file.yml>`\x20instead\x20for\x20better\x20configuration\x20management.\x0a','master','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pull\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20parent\x20segment','\x20\x20--behavior\x20[name]\x20\x20\x20\x20Show\x20only\x20behaviors\x20(or\x20specific\x20one)\x0a','✔\x20Query\x20completed:\x20Processed\x20','number','Validate\x20parent\x20segment\x20YAML\x20configuration\x20and\x20show\x20statistics','Error:\x20File\x20not\x20found:\x20','\x20trigger=','\x22,\x0a\x20\x20\x22parent_segment\x22:\x20\x22','join','behavior_','12275JXMzSe','schemaValid','\x20\x202.\x20Run\x20','Updated','rowCount','getParentFull','reduce','Events:','scheduleOption','\x20\x20--behavior\x20<name>\x20\x20\x20\x20Show\x20sample\x20data\x20for\x20specific\x20behavior\x0a','\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data','\x20rows\x20','Usage:\x20tdx\x20ps\x20desc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20(requires\x20context)\x0a','type','Audience\x20ID:','Fetching\x20customers\x20schema...','Join\x20on:','\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20behaviors','output','Show\x20parent\x20segment\x20details','Available\x20attributes:','repeat','\x20\x20--attribute\x20[name]\x20\x20\x20Show\x20only\x20attributes\x20(or\x20specific\x20one)\x0a','Master\x20+\x20Attributes','column','Updating\x20parent\x20segment\x20\x27','\x27\x20is\x20up\x20to\x20date','toLocaleString','foreignKey','events','\x20--enriched','realtime:','scheduleType','attribute','updateParent','valid','Validate:','\x20+\x20[','Table:\x20','customerGroup','SELECT\x20*\x20FROM\x20(\x0a','Usage:\x20tdx\x20ps\x20push\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Push\x20(requires\x20context)\x0a','coveragePercent','Error\x20parsing\x20YAML:\x20','site','\x0a✔\x20Workflow\x20started','sourceTableError','600vZBcDL','Error:\x20--behavior\x20requires\x20a\x20name\x0a','behavior','1318851hSKQiX','\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:run','Pull\x20parent\x20segment\x20configuration\x20to\x20YAML\x20file','parent_id','`\x20to\x20download\x20the\x20configuration\x20first','label','customerGroupFile','\x20rows)','⚡\x20Not\x20enabled','\x20Added\x20RT\x202.0\x20template\x20section','matchedCount','data','segment:parent:preview','Show\x20parent\x20segment\x20schema\x20(column\x20types)','Fetching\x20behavior\x20list...','execute','Personalization:','map','getOutputDatabaseName','Apply\x20changes\x20to\x20\x27','attributes','Enriched:','\x0aChanges\x20to\x20\x27','Error\x20reading\x20file:\x20','displayPreviewHints','getBehaviorNames','Usage:\x20tdx\x20segment\x20parent\x20update\x20<name>\x20[options]','⚠️\x20\x20personalization_services\x20section\x20already\x20exists\x20in\x20','use','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20pz\x20init\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Add\x20PZ\x20template\x20for\x20specific\x20parent\x20segment','Running\x20parent\x20segment\x20workflow\x20for\x20\x27','Executing\x20parent\x20segment\x20query...','sourceTableValid','\x20configured','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','Options:\x0a','/app/dw/parentSegments/','\x5c$&','format','\x22,\x0a\x20\x20\x20\x20\x20\x20\x22columns\x22:\x20','Usage:\x20tdx\x20ps\x20fields\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20fields\x20(requires\x20context)\x0a','Customers:','Resolving\x20parent\x20segment\x20\x27','timezone','sort','yes','/{name}.yml\x0a','primaryKey','displayPreviewResults','segment:parent:fields','stop','\x20tdx\x20wf\x20attempt\x20','Source:','personalization_services','joinKey','\x20--attribute\x20\x22','elapsedTimeMillis','win32','👥\x20','\x0aNo\x20sample\x20data\x20available','segment:parent:create','Output\x20file:\x20','Add\x20template\x20personalization\x20section\x20to\x20parent\x20segment\x20YAML','\x20section','Analyzing\x20changes...','/\x20directories\x20exist.','user_id','List\x20parent\x20segments','.yml','filter','Execute\x20parent\x20segment\x20SQL\x20query\x20and\x20show\x20results','all','tdx\x20ps\x20preview\x20','getParentSQL','test','displayBehaviorsStats','parent_segments','segment:parent:update','bold','Columns:','Master:','toFixed','\x0aNew\x20parent\x20segment\x20\x27','Site:\x20','yellow','197307lyFjgX','displaySummary','\x20\x20\x20\x20\x20\x20','Error:\x20At\x20least\x20one\x20preview\x20option\x20required\x0a','\x27\x20with\x20ID:\x20','utf-8','customerPercent','\x20to\x20push\x20the\x20configuration','\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20run\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20specific\x20parent\x20segment','Parent\x20segment:\x20','customersWithEvents','\x20\x20\x20See:\x20tdx\x20segment\x20parent\x20pull\x20--help\x0a','jobId','Tip:\x20Use\x20-u\x20without\x20-o,\x20or\x20-o\x20without\x20-u','/app/workflows/','\x0aError:','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','attributesFile','Aborted.','SELECT\x20*\x20FROM\x20','Run\x20parent\x20segment\x20workflow\x20(pushes\x20YAML\x20if\x20exists)','push','description','Usage:\x20tdx\x20segment\x20parent\x20create\x20<name>\x20--database\x20<db>\x20--table\x20<table>','108381afCoDG','/\x20and\x20','true','displayValidateResults','validateParentYaml','Error:','List\x20available\x20fields\x20for\x20segmentation','verbose','Usage:\x20tdx\x20ps\x20run\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Run\x20(requires\x20context)\x0a','Overwrite\x20\x27','segment:parent:show','displayColumns','ps:pz:list','\x22,\x0a\x20\x20\x22customers\x22:\x20{\x0a\x20\x20\x20\x20\x22table\x22:\x20\x22','\x20--interval\x20','session','Schema\x20saved\x20to\x20','formatSchemaJson','Found\x20YAML\x20file:\x20'];a22_0x4098=function(){return _0x1b84e6;};return a22_0x4098();}export class ParentSegmentCreateCommand extends BaseCommand{['name']=a22_0x8dcc7b(0x238);['description']='Create\x20new\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async[a22_0x8dcc7b(0x20b)](_0x147c9b){const _0x4a26f3=a22_0x8dcc7b,{options:_0x4277f0,args:_0x1f01be,tdx:_0x143948}=_0x147c9b;console['error'](_0x4a26f3(0x198)+_0x4a26f3(0x1bc)+_0x4a26f3(0x25c));const _0x146208=_0x4277f0;if(_0x1f01be[_0x4a26f3(0x28a)]===0x0)return console['error'](a22_0x43697b[_0x4a26f3(0x2c5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x4a26f3(0x268)),0x1;const _0x589201=_0x1f01be[0x0];if(!_0x146208[_0x4a26f3(0x302)]||!_0x146208[_0x4a26f3(0x298)])return console[_0x4a26f3(0x19c)]('Error:\x20--database\x20and\x20--table\x20are\x20required'),console['error'](_0x4a26f3(0x268)),0x1;_0x146208['verbose']&&(console[_0x4a26f3(0x19c)](_0x4a26f3(0x24f)+_0x146208['site']),console[_0x4a26f3(0x19c)](_0x4a26f3(0x1b8)+_0x589201),console[_0x4a26f3(0x19c)](_0x4a26f3(0x2e6)+_0x146208[_0x4a26f3(0x302)]),console[_0x4a26f3(0x19c)](_0x4a26f3(0x1ef)+_0x146208[_0x4a26f3(0x298)]));const _0x50d91a=await loadJSONFromOptions(_0x146208['attributes'],_0x146208[_0x4a26f3(0x262)]),_0x25e0c4=await loadJSONFromOptions(_0x146208[_0x4a26f3(0x2c3)],_0x146208[_0x4a26f3(0x29c)]),_0x53b174=await loadJSONFromOptions(_0x146208[_0x4a26f3(0x1f0)],_0x146208[_0x4a26f3(0x202)]),_0x3cf800={'name':_0x589201,'description':_0x146208[_0x4a26f3(0x267)],'scheduleType':_0x146208[_0x4a26f3(0x1e9)],'scheduleOption':_0x146208['scheduleOption'],'timezone':_0x146208[_0x4a26f3(0x227)],'master':{'parentDatabaseName':_0x146208[_0x4a26f3(0x302)],'parentTableName':_0x146208[_0x4a26f3(0x298)]},'attributes':_0x50d91a,'behaviors':_0x25e0c4,'customerGroup':_0x53b174},_0x4c82f0=await withSpinner('Creating\x20parent\x20segment\x20\x27'+_0x589201+_0x4a26f3(0x291),()=>_0x143948[_0x4a26f3(0x286)]['createParent'](_0x3cf800),{'verbose':_0x4277f0[_0x4a26f3(0x270)]}),_0x1a84f7=_0x4c82f0[_0x4a26f3(0x207)];return console[_0x4a26f3(0x19c)]('✔\x20Created\x20parent\x20segment\x20\x27'+_0x1a84f7['name']+_0x4a26f3(0x255)+_0x1a84f7['id']),await handleSDKOutput([_0x1a84f7],_0x4277f0),0x0;}}export class ParentSegmentUpdateCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x249);[a22_0x8dcc7b(0x267)]='Update\x20existing\x20parent\x20segment\x20(audience)\x20[DEPRECATED]';async['execute'](_0x350c0d){const _0x3f460f=a22_0x8dcc7b,{options:_0x24f0f1,args:_0x2a168b,tdx:_0x15432d}=_0x350c0d;console[_0x3f460f(0x19c)]('\x0a⚠️\x20\x20DEPRECATED:\x20`tdx\x20segment\x20parent\x20update`\x20is\x20deprecated.\x0a'+_0x3f460f(0x1bc)+_0x3f460f(0x25c));const _0x318661=_0x24f0f1;if(_0x2a168b[_0x3f460f(0x28a)]===0x0)return console[_0x3f460f(0x19c)](a22_0x43697b[_0x3f460f(0x2c5)]('Error:\x20Parent\x20segment\x20name\x20is\x20required')),console['error'](_0x3f460f(0x216)),0x1;const _0x3f1b4a=_0x2a168b[0x0];_0x318661[_0x3f460f(0x270)]&&(console[_0x3f460f(0x19c)](_0x3f460f(0x24f)+_0x318661[_0x3f460f(0x1f5)]),console[_0x3f460f(0x19c)](_0x3f460f(0x25a)+_0x3f1b4a));const _0x21c2d7=await withSpinner(_0x3f460f(0x283)+_0x3f1b4a+_0x3f460f(0x291),()=>_0x15432d[_0x3f460f(0x286)][_0x3f460f(0x1cd)](_0x3f1b4a),{'verbose':_0x318661[_0x3f460f(0x270)]}),_0x1790dc=_0x21c2d7[_0x3f460f(0x207)],_0x565394=await loadJSONFromOptions(_0x318661['addAttributes'],_0x318661['addAttributesFile']),_0x5919d0=await loadJSONFromOptions(_0x318661[_0x3f460f(0x2e4)],_0x318661['addBehaviorsFile']),_0x3aa780={'name':_0x1790dc[_0x3f460f(0x300)],'description':_0x318661['description']!==undefined?_0x318661[_0x3f460f(0x267)]:_0x1790dc['description'],'scheduleType':_0x318661[_0x3f460f(0x1e9)]!==undefined?_0x318661['scheduleType']:_0x1790dc[_0x3f460f(0x1e9)],'scheduleOption':_0x318661[_0x3f460f(0x1d0)]!==undefined?_0x318661[_0x3f460f(0x1d0)]:_0x1790dc[_0x3f460f(0x1d0)],'timezone':_0x318661[_0x3f460f(0x227)]!==undefined?_0x318661[_0x3f460f(0x227)]:_0x1790dc[_0x3f460f(0x227)],'master':_0x1790dc[_0x3f460f(0x1bd)],'attributes':_0x565394?[..._0x1790dc['attributes']||[],..._0x565394]:_0x1790dc[_0x3f460f(0x210)],'behaviors':_0x5919d0?[..._0x1790dc[_0x3f460f(0x2c3)]||[],..._0x5919d0]:_0x1790dc[_0x3f460f(0x2c3)],'customerGroup':_0x1790dc[_0x3f460f(0x1f0)]},_0x29fb82=await withSpinner(_0x3f460f(0x1e2)+_0x3f1b4a+_0x3f460f(0x291),()=>_0x15432d['segment'][_0x3f460f(0x1eb)](_0x3f1b4a,_0x3aa780),{'verbose':_0x318661[_0x3f460f(0x270)]}),_0x12dc89=_0x29fb82[_0x3f460f(0x207)];return console[_0x3f460f(0x19c)](_0x3f460f(0x2bc)+_0x12dc89[_0x3f460f(0x300)]+'\x27'),await handleSDKOutput([_0x12dc89],_0x318661),0x0;}}export class ParentSegmentPullCommand extends BaseParentSegmentCommand{['name']=a22_0x8dcc7b(0x2a9);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x1fe);async[a22_0x8dcc7b(0x20b)](_0x46e02f){const _0x31fe07=a22_0x8dcc7b,{options:_0x413916,args:_0x2630a9,tdx:_0x36f25e}=_0x46e02f,_0x358ae4=_0x413916,_0x461a43=_0x2630a9[0x0]||_0x413916['parentSegment'];if(!_0x461a43)return showParentSegmentNotSetError(_0x31fe07(0x309)+_0x31fe07(0x1be)),0x1;if(_0x358ae4[_0x31fe07(0x218)]&&_0x358ae4[_0x31fe07(0x1db)])return console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2c5)](_0x31fe07(0x1ba))),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2af)]('The\x20-u\x20flag\x20sets\x20the\x20context\x20to\x20the\x20pulled\x20segment,\x20which\x20requires')),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2af)]('using\x20the\x20default\x20path:\x20'+PARENT_SEGMENT_DIR+_0x31fe07(0x22a))),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2b4)](_0x31fe07(0x25e))),0x1;const _0x78db00=_0x358ae4[_0x31fe07(0x1db)]||a22_0x2fdb40[_0x31fe07(0x1c6)](PARENT_SEGMENT_DIR,sanitizeFileName(_0x461a43)+_0x31fe07(0x240));_0x358ae4[_0x31fe07(0x270)]&&(console[_0x31fe07(0x19c)]('Site:\x20'+_0x358ae4[_0x31fe07(0x1f5)]),console[_0x31fe07(0x19c)](_0x31fe07(0x25a)+_0x461a43),console['error'](_0x31fe07(0x239)+_0x78db00));const _0x4db05b=await withSpinner(_0x31fe07(0x2c9)+_0x461a43+_0x31fe07(0x291),()=>_0x36f25e[_0x31fe07(0x286)][_0x31fe07(0x2d8)](_0x461a43),{'verbose':_0x358ae4['verbose']}),_0xefbfd6=_0x4db05b[_0x31fe07(0x207)];if(existsSync(_0x78db00)){const _0x4cde5d=readFileSync(_0x78db00,_0x31fe07(0x256)),_0x4efecc=generateDiff(_0x4cde5d,_0xefbfd6);if(!hasChanges(_0x4efecc))console['error'](a22_0x43697b[_0x31fe07(0x1b3)]('✔')+_0x31fe07(0x2b5)+a22_0x43697b[_0x31fe07(0x2b4)](_0x78db00)+_0x31fe07(0x27f));else{console[_0x31fe07(0x19c)](_0x31fe07(0x212)+_0x78db00+'\x27:'),console[_0x31fe07(0x19c)]('─'['repeat'](0x3c)),console['error'](formatDiffWithColors(_0x4efecc)),console[_0x31fe07(0x19c)]('─'[_0x31fe07(0x1de)](0x3c));if(!_0x358ae4[_0x31fe07(0x229)]){if(!isInteractive())return console[_0x31fe07(0x19c)](a22_0x43697b['red'](_0x31fe07(0x260)),_0x31fe07(0x21e)),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x2af)]('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x2cad30=await confirmKey(_0x31fe07(0x272)+_0x78db00+'\x27?');if(!_0x2cad30)return console[_0x31fe07(0x19c)](a22_0x43697b['yellow'](_0x31fe07(0x263))),0x1;}writeFileSync(_0x78db00,_0xefbfd6,_0x31fe07(0x256)),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x1b3)]('✔')+_0x31fe07(0x2c4)+a22_0x43697b[_0x31fe07(0x2b4)](_0x78db00));}}else{const _0x24733e=a22_0x2fdb40['dirname'](_0x78db00);!existsSync(_0x24733e)&&mkdirSync(_0x24733e,{'recursive':!![]}),writeFileSync(_0x78db00,_0xefbfd6,_0x31fe07(0x256)),console[_0x31fe07(0x19c)](a22_0x43697b[_0x31fe07(0x1b3)]('✔')+_0x31fe07(0x2c4)+a22_0x43697b['cyan'](_0x78db00));}return saveSessionContext({'parent_segment':_0x461a43},_0x358ae4[_0x31fe07(0x278)]),console['error'](a22_0x43697b['green']('✔')+_0x31fe07(0x295)+a22_0x43697b[_0x31fe07(0x2af)](_0x31fe07(0x2cd))+'\x20=\x20'+a22_0x43697b[_0x31fe07(0x2b4)](_0x461a43)),0x0;}}export class ParentSegmentPushCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x185);[a22_0x8dcc7b(0x267)]='Push\x20parent\x20segment\x20configuration\x20from\x20YAML\x20file';async[a22_0x8dcc7b(0x20b)](_0x44d000){const _0x1f55ba=a22_0x8dcc7b,{options:_0x69ad61,args:_0x11aa78,tdx:_0x433a98}=_0x44d000,_0x34d24d=_0x69ad61,_0x466b21=_0x11aa78[0x0]||_0x69ad61[_0x1f55ba(0x2a2)];if(!_0x466b21)return showParentSegmentNotSetError(_0x1f55ba(0x1f2)+_0x1f55ba(0x1a2)),0x1;const _0x16c6b7=resolveYamlFile(_0x466b21);if(!existsSync(_0x16c6b7))return showFileNotFoundError(_0x16c6b7,_0x466b21),0x1;_0x34d24d[_0x1f55ba(0x270)]&&(console[_0x1f55ba(0x19c)](_0x1f55ba(0x24f)+_0x34d24d[_0x1f55ba(0x1f5)]),console[_0x1f55ba(0x19c)]('YAML\x20file:\x20'+_0x16c6b7));let _0x1b4762;try{_0x1b4762=readFileSync(_0x16c6b7,_0x1f55ba(0x256));}catch(_0x1ebee8){const _0x427afa=_0x1ebee8 instanceof Error?_0x1ebee8[_0x1f55ba(0x186)]:String(_0x1ebee8);return console[_0x1f55ba(0x19c)](_0x1f55ba(0x213)+_0x427afa),0x1;}const _0x3f3146=await withSpinner('Analyzing\x20changes...',()=>_0x433a98['segment'][_0x1f55ba(0x2f6)](_0x1b4762),{'verbose':_0x34d24d['verbose']}),_0x400a76=_0x3f3146[_0x1f55ba(0x207)],{isNew:_0x11294c,name:_0xaeb72c,hasChanges:_0x5e7371,diffFormatted:_0x54308f}=_0x400a76;if(!_0x5e7371)return console[_0x1f55ba(0x19c)](_0x1f55ba(0x2a6)+_0xaeb72c+'\x27\x20is\x20already\x20up\x20to\x20date'),0x0;_0x11294c?console[_0x1f55ba(0x19c)](_0x1f55ba(0x24e)+_0xaeb72c+'\x27:'):console[_0x1f55ba(0x19c)](_0x1f55ba(0x2c2)+_0xaeb72c+'\x27:');console[_0x1f55ba(0x19c)]('─'['repeat'](0x3c)),console[_0x1f55ba(0x19c)](_0x54308f),console['error']('─'['repeat'](0x3c));const _0x11677e=_0x11294c?'Create\x20parent\x20segment\x20\x27'+_0xaeb72c+'\x27?':'Apply\x20changes\x20to\x20\x27'+_0xaeb72c+'\x27?';if(!_0x34d24d[_0x1f55ba(0x229)]){if(!isInteractive())return console[_0x1f55ba(0x19c)](a22_0x43697b['red'](_0x1f55ba(0x260)),_0x1f55ba(0x21e)),console[_0x1f55ba(0x19c)](a22_0x43697b[_0x1f55ba(0x2af)](_0x1f55ba(0x261))),0x1;const _0x319326=await confirmKey(_0x11677e);if(!_0x319326)return console[_0x1f55ba(0x19c)](a22_0x43697b[_0x1f55ba(0x250)](_0x1f55ba(0x263))),0x1;}const _0x2760ff=_0x11294c?_0x1f55ba(0x304):_0x1f55ba(0x2ff),_0x242b24=await withSpinner(_0x2760ff+_0x1f55ba(0x305)+_0xaeb72c+_0x1f55ba(0x291),()=>_0x400a76[_0x1f55ba(0x197)](),{'verbose':_0x34d24d[_0x1f55ba(0x270)]}),_0x1a6598=_0x242b24[_0x1f55ba(0x207)],_0xcc2efc=getConsoleNextUrl(_0x34d24d['site'],_0x1f55ba(0x220)+_0x1a6598['id']),_0x22c7eb=_0x11294c?'Created':_0x1f55ba(0x1cb);return console[_0x1f55ba(0x19c)]('✔\x20'+_0x22c7eb+_0x1f55ba(0x305)+_0x1a6598['name']+'\x27'),console[_0x1f55ba(0x19c)]('\x20\x20'+_0xcc2efc),0x0;}}export class ParentSegmentValidateCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2b1);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x1c2);async[a22_0x8dcc7b(0x20b)](_0x4ad277){const _0x11b0d0=a22_0x8dcc7b,{options:_0x14e5cd,args:_0x1c0663,tdx:_0x4cd54a}=_0x4ad277,_0x3c172d=_0x14e5cd,_0x13452a=_0x1c0663[0x0]||_0x14e5cd['parentSegment'];if(!_0x13452a)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20(requires\x20context)\x0a'+_0x11b0d0(0x1b0)+_0x11b0d0(0x21f)+_0x11b0d0(0x1df)+_0x11b0d0(0x1bf)+_0x11b0d0(0x297)),0x1;const _0x146705=resolveYamlFile(_0x13452a);if(!existsSync(_0x146705))return showFileNotFoundError(_0x146705,_0x13452a),0x1;_0x3c172d[_0x11b0d0(0x270)]&&(console[_0x11b0d0(0x19c)](_0x11b0d0(0x24f)+_0x3c172d[_0x11b0d0(0x1f5)]),console[_0x11b0d0(0x19c)]('YAML\x20file:\x20'+_0x146705));let _0x53558a;try{_0x53558a=readFileSync(_0x146705,'utf-8');}catch(_0x44747c){const _0x41412e=_0x44747c instanceof Error?_0x44747c[_0x11b0d0(0x186)]:String(_0x44747c);return console['error'](_0x11b0d0(0x213)+_0x41412e),0x1;}const _0x3d11af=createCommandSpinner(a22_0x43697b[_0x11b0d0(0x2af)](_0x11b0d0(0x2ae)),{'verbose':_0x3c172d['verbose']});_0x3d11af[_0x11b0d0(0x292)]();const _0x540c72={'onProgress':_0x3e53bb=>{const _0x49af01=_0x11b0d0;_0x3d11af[_0x49af01(0x2d9)]=formatProgressMessage(_0x3e53bb);}};if(_0x3c172d[_0x11b0d0(0x1bd)])_0x540c72[_0x11b0d0(0x1bd)]=!![];if(_0x3c172d['enriched'])_0x540c72['enriched']=!![];_0x3c172d[_0x11b0d0(0x1ea)]&&(_0x540c72[_0x11b0d0(0x1ea)]=_0x3c172d[_0x11b0d0(0x1ea)]);_0x3c172d[_0x11b0d0(0x1fa)]&&(_0x540c72['behavior']=_0x3c172d[_0x11b0d0(0x1fa)]);if(_0x3c172d[_0x11b0d0(0x28c)])_0x540c72['interval']=_0x3c172d['interval'];let _0x30450e;try{_0x30450e=await _0x4cd54a['segment'][_0x11b0d0(0x26d)](_0x53558a,_0x540c72),_0x3d11af['stop']();}catch(_0x1c51d2){_0x3d11af[_0x11b0d0(0x22e)]();throw _0x1c51d2;}const _0x21450b=_0x3c172d[_0x11b0d0(0x28c)]||_0x11b0d0(0x2cc);return this['displayValidateResults'](_0x30450e,_0x540c72,_0x146705,_0x21450b),_0x30450e[_0x11b0d0(0x1bb)]?0x0:0x1;}[a22_0x8dcc7b(0x26c)](_0x53a8d2,_0x487511,_0x1b89c4,_0x3325b3){const _0x6bb4c3=a22_0x8dcc7b;console[_0x6bb4c3(0x19c)]('\x0a'+a22_0x43697b[_0x6bb4c3(0x24a)](_0x6bb4c3(0x1ed))+'\x20'+_0x53a8d2[_0x6bb4c3(0x300)]),console[_0x6bb4c3(0x19c)]('═'[_0x6bb4c3(0x1de)](0x3c)),this['displayMasterInfo'](_0x53a8d2);if(typeof _0x487511[_0x6bb4c3(0x1ea)]===_0x6bb4c3(0x1a7)){this[_0x6bb4c3(0x1a5)](_0x53a8d2),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x1ea),_0x487511[_0x6bb4c3(0x1ea)]);return;}if(_0x487511[_0x6bb4c3(0x1ea)]===!![]){this[_0x6bb4c3(0x1a5)](_0x53a8d2),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,'attributes');return;}if(typeof _0x487511[_0x6bb4c3(0x1fa)]===_0x6bb4c3(0x1a7)){this['displayBehaviorsStats'](_0x53a8d2,_0x3325b3),this['displaySummary'](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x1fa),_0x487511[_0x6bb4c3(0x1fa)]);return;}if(_0x487511[_0x6bb4c3(0x1fa)]===!![]){this[_0x6bb4c3(0x247)](_0x53a8d2,_0x3325b3),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x2c3));return;}this[_0x6bb4c3(0x1a5)](_0x53a8d2),this['displayBehaviorsStats'](_0x53a8d2,_0x3325b3),this['displayRealtimeInfo'](_0x53a8d2),this[_0x6bb4c3(0x252)](_0x53a8d2),this[_0x6bb4c3(0x214)](_0x1b89c4,_0x3325b3,_0x6bb4c3(0x243));}[a22_0x8dcc7b(0x191)](_0x5b17a2){displayRealtimeValidation(_0x5b17a2);}['displayPreviewHints'](_0x24d358,_0x4c02b5,_0x20134b,_0x3c7649){const _0xf75c7=a22_0x8dcc7b;console[_0xf75c7(0x19c)]('\x0a'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x188)));const _0x41bebd=_0x4c02b5!=='-1d'?_0xf75c7(0x277)+_0x4c02b5:'';if(_0x20134b==='attribute'&&_0x3c7649)console['error']('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+_0xf75c7(0x233)+_0x3c7649+'\x22'+_0x41bebd));else{if(_0x20134b===_0xf75c7(0x1fa)&&_0x3c7649)console[_0xf75c7(0x19c)]('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+_0xf75c7(0x1a1)+_0x3c7649+'\x22'+_0x41bebd));else(_0x20134b==='attributes'||_0x20134b===_0xf75c7(0x243))&&console['error']('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)]('tdx\x20ps\x20preview\x20'+_0x24d358+_0xf75c7(0x2ee)+_0x41bebd));}(_0x20134b===_0xf75c7(0x2c3)||_0x20134b==='all')&&console[_0xf75c7(0x19c)]('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+'\x20--behavior\x20\x22<name>\x22'+_0x41bebd)),_0x20134b===_0xf75c7(0x243)&&console[_0xf75c7(0x19c)]('\x20\x20'+a22_0x43697b[_0xf75c7(0x2af)](_0xf75c7(0x244)+_0x24d358+_0xf75c7(0x1e7)+_0x41bebd));}[a22_0x8dcc7b(0x27e)](_0x427f72){const _0x53a426=a22_0x8dcc7b,{master:_0xab8e2f}=_0x427f72,_0x4b005d=_0xab8e2f[_0x53a426(0x1c9)]?a22_0x43697b['green']('✔'):a22_0x43697b[_0x53a426(0x2c5)]('✘');console[_0x53a426(0x19c)]('\x0a'+a22_0x43697b[_0x53a426(0x2af)]('Master\x20Table')),console[_0x53a426(0x19c)](_0x4b005d+'\x20'+a22_0x43697b[_0x53a426(0x24a)](_0xab8e2f[_0x53a426(0x302)]+'.'+_0xab8e2f[_0x53a426(0x298)])),_0xab8e2f['schemaValid']?_0xab8e2f['rowCount']!==undefined&&console['error']('\x20\x20'+a22_0x43697b['dim']('Rows:')+'\x20'+a22_0x43697b[_0x53a426(0x2b4)](formatRows(_0xab8e2f[_0x53a426(0x1cc)]))):console[_0x53a426(0x19c)]('\x20\x20'+a22_0x43697b[_0x53a426(0x2c5)]('Error:')+'\x20'+_0xab8e2f[_0x53a426(0x301)]);}[a22_0x8dcc7b(0x1a5)](_0xdfae){const _0x498a2f=a22_0x8dcc7b;if(_0xdfae['attributes'][_0x498a2f(0x28a)]===0x0)return;console[_0x498a2f(0x19c)]('\x0a'+a22_0x43697b['dim']('Attributes'));for(const _0xb4b5f1 of _0xdfae[_0x498a2f(0x210)]){const _0x5c5da7=_0xb4b5f1[_0x498a2f(0x1c9)]?a22_0x43697b[_0x498a2f(0x1b3)]('✔'):a22_0x43697b[_0x498a2f(0x2c5)]('✘');let _0x520843='';if(_0xb4b5f1[_0x498a2f(0x1c9)]&&_0xb4b5f1[_0x498a2f(0x206)]!==undefined&&_0xb4b5f1['coveragePercent']!==undefined){const _0x1f9e64=_0xb4b5f1[_0x498a2f(0x1f3)]['toFixed'](0x1),_0x433886=_0xb4b5f1[_0x498a2f(0x1f3)]>=0x50?a22_0x43697b[_0x498a2f(0x1b3)]:_0xb4b5f1[_0x498a2f(0x1f3)]>=0x32?a22_0x43697b[_0x498a2f(0x250)]:a22_0x43697b[_0x498a2f(0x2c5)];_0x520843='\x20'+a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x1af))+'\x20'+_0x433886(_0x1f9e64+'%')+'\x20('+formatRows(_0xb4b5f1[_0x498a2f(0x206)])+_0x498a2f(0x203);}console[_0x498a2f(0x19c)](_0x5c5da7+'\x20'+a22_0x43697b[_0x498a2f(0x24a)](_0xb4b5f1[_0x498a2f(0x300)])+_0x520843),console[_0x498a2f(0x19c)]('\x20\x20'+a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x230))+'\x20'+a22_0x43697b['bold'](_0xb4b5f1['database']+'.'+_0xb4b5f1[_0x498a2f(0x298)]));const _0x3eb380=_0xb4b5f1[_0x498a2f(0x232)]===_0xb4b5f1[_0x498a2f(0x1e5)]?a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x1d8))+'\x20'+_0xb4b5f1[_0x498a2f(0x232)]:a22_0x43697b['dim']('Join:')+'\x20'+_0xb4b5f1[_0x498a2f(0x232)]+_0x498a2f(0x2c8)+_0xb4b5f1[_0x498a2f(0x1e5)];console['error']('\x20\x20'+_0x3eb380),console['error']('\x20\x20'+a22_0x43697b[_0x498a2f(0x2af)](_0x498a2f(0x24b))),this[_0x498a2f(0x274)](_0xb4b5f1[_0x498a2f(0x195)]),!_0xb4b5f1[_0x498a2f(0x1c9)]&&console['error']('\x20\x20'+a22_0x43697b[_0x498a2f(0x2c5)](_0x498a2f(0x26e))+'\x20'+_0xb4b5f1['schemaError']);}}[a22_0x8dcc7b(0x247)](_0x3c89e8,_0x3c98bf){const _0x2d5668=a22_0x8dcc7b;if(_0x3c89e8[_0x2d5668(0x2c3)][_0x2d5668(0x28a)]===0x0)return;console[_0x2d5668(0x19c)]('\x0a'+a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x306))+'\x20'+a22_0x43697b[_0x2d5668(0x2af)]('('+_0x3c98bf+')'));for(const _0x3699f6 of _0x3c89e8['behaviors']){const _0x3258af=_0x3699f6[_0x2d5668(0x1c9)]?a22_0x43697b[_0x2d5668(0x1b3)]('✔'):a22_0x43697b[_0x2d5668(0x2c5)]('✘');let _0x5e3367='';if(_0x3699f6['schemaValid']&&_0x3699f6[_0x2d5668(0x25b)]!==undefined&&_0x3699f6[_0x2d5668(0x2a5)]!==undefined){const _0x33d12e=_0x3699f6[_0x2d5668(0x257)]?.[_0x2d5668(0x24d)](0x1)||'?',_0x2cdb46=(_0x3699f6['customerPercent']??0x0)>=0x32?a22_0x43697b[_0x2d5668(0x1b3)]:(_0x3699f6[_0x2d5668(0x257)]??0x0)>=0x14?a22_0x43697b[_0x2d5668(0x250)]:a22_0x43697b[_0x2d5668(0x2c5)];_0x5e3367='\x20'+a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x225))+'\x20'+_0x2cdb46(formatRows(_0x3699f6[_0x2d5668(0x25b)]))+'\x20('+_0x33d12e+'%)\x20'+a22_0x43697b['dim'](_0x2d5668(0x1cf))+'\x20'+a22_0x43697b['cyan'](formatRows(_0x3699f6[_0x2d5668(0x2a5)]));}console['error'](_0x3258af+'\x20'+a22_0x43697b['bold'](_0x3699f6[_0x2d5668(0x300)])+_0x5e3367),console[_0x2d5668(0x19c)]('\x20\x20'+a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x230))+'\x20'+a22_0x43697b[_0x2d5668(0x24a)](_0x3699f6[_0x2d5668(0x302)]+'.'+_0x3699f6['table']));const _0x2b2db7=_0x3699f6['joinKey']===_0x3699f6[_0x2d5668(0x1e5)]?a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x1d8))+'\x20'+_0x3699f6[_0x2d5668(0x232)]:a22_0x43697b[_0x2d5668(0x2af)](_0x2d5668(0x1ab))+'\x20'+_0x3699f6['joinKey']+_0x2d5668(0x2c8)+_0x3699f6['foreignKey'];console['error']('\x20\x20'+_0x2b2db7),console['error']('\x20\x20'+a22_0x43697b[_0x2d5668(0x2af)]('Columns:')),this[_0x2d5668(0x274)](_0x3699f6[_0x2d5668(0x195)]),!_0x3699f6[_0x2d5668(0x1c9)]&&console[_0x2d5668(0x19c)]('\x20\x20'+a22_0x43697b[_0x2d5668(0x2c5)](_0x2d5668(0x26e))+'\x20'+_0x3699f6[_0x2d5668(0x301)]);}}[a22_0x8dcc7b(0x274)](_0x38e1f6){const _0x5b614b=a22_0x8dcc7b;for(const _0x591301 of _0x38e1f6){_0x591301[_0x5b614b(0x201)]===_0x591301[_0x5b614b(0x1e1)]||_0x591301[_0x5b614b(0x1e1)]==='*'?console[_0x5b614b(0x19c)](_0x5b614b(0x2aa)+_0x591301[_0x5b614b(0x201)]):console[_0x5b614b(0x19c)](_0x5b614b(0x2aa)+_0x591301[_0x5b614b(0x201)]+'\x20'+a22_0x43697b[_0x5b614b(0x2af)]('('+_0x591301[_0x5b614b(0x1e1)]+')'));}}[a22_0x8dcc7b(0x252)](_0x25b963){const _0x57c6e4=a22_0x8dcc7b;console[_0x57c6e4(0x19c)]('─'[_0x57c6e4(0x1de)](0x3c));if(_0x25b963[_0x57c6e4(0x284)][_0x57c6e4(0x28a)]>0x0){console[_0x57c6e4(0x19c)]('\x0a'+a22_0x43697b[_0x57c6e4(0x2c5)](_0x57c6e4(0x187)));for(const _0x3528b4 of _0x25b963[_0x57c6e4(0x284)]){console[_0x57c6e4(0x19c)]('\x20\x20'+a22_0x43697b[_0x57c6e4(0x2c5)]('•')+'\x20'+_0x3528b4);}}_0x25b963['allValid']&&console['error']('\x0a'+a22_0x43697b[_0x57c6e4(0x1b3)]('✔')+_0x57c6e4(0x2f8));}}export class ParentSegmentPreviewCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x208);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x193);async[a22_0x8dcc7b(0x20b)](_0x442a77){const _0x1787db=a22_0x8dcc7b,{options:_0x1f8048,args:_0x224e63,tdx:_0x457dbd}=_0x442a77,_0x2ac61f=_0x1f8048,_0x353216=_0x224e63[0x0]||_0x1f8048[_0x1787db(0x2a2)];if(!_0x353216)return showParentSegmentNotSetError(_0x1787db(0x1aa)+_0x1787db(0x2cf)+_0x1787db(0x2d0)+'\x20\x20--master\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20sample\x20master\x20table\x20data\x0a'+_0x1787db(0x285)+_0x1787db(0x1d1)+_0x1787db(0x2e3)+'\x20\x20--interval\x20<range>\x20\x20\x20TD_INTERVAL\x20time\x20range\x20for\x20behaviors\x20(default:\x20-1d)'),0x1;if(!_0x2ac61f[_0x1787db(0x1bd)]&&!_0x2ac61f[_0x1787db(0x1ea)]&&!_0x2ac61f['behavior']&&!_0x2ac61f[_0x1787db(0x2ec)])return console[_0x1787db(0x19c)](a22_0x43697b['red'](_0x1787db(0x254))),console[_0x1787db(0x19c)](_0x1787db(0x307)),console[_0x1787db(0x19c)](_0x1787db(0x280)),console[_0x1787db(0x19c)](_0x1787db(0x1d2)),console[_0x1787db(0x19c)](_0x1787db(0x2ac)),console[_0x1787db(0x19c)](_0x1787db(0x2b2)),console[_0x1787db(0x19c)](_0x1787db(0x2b3)),0x1;const _0xc2872b=resolveYamlFile(_0x353216);if(!existsSync(_0xc2872b))return showFileNotFoundError(_0xc2872b,_0x353216),0x1;_0x2ac61f[_0x1787db(0x270)]&&(console['error']('Site:\x20'+_0x2ac61f[_0x1787db(0x1f5)]),console[_0x1787db(0x19c)]('YAML\x20file:\x20'+_0xc2872b));let _0x472bd0;try{_0x472bd0=readFileSync(_0xc2872b,_0x1787db(0x256));}catch(_0x381f05){const _0x621083=_0x381f05 instanceof Error?_0x381f05[_0x1787db(0x186)]:String(_0x381f05);return console['error'](_0x1787db(0x213)+_0x621083),0x1;}let _0x52f6a5;try{_0x52f6a5=parseDef(_0x472bd0);}catch(_0x2a9bb9){const _0x5ea1be=_0x2a9bb9 instanceof Error?_0x2a9bb9[_0x1787db(0x186)]:String(_0x2a9bb9);return console[_0x1787db(0x19c)](a22_0x43697b[_0x1787db(0x2c5)](_0x1787db(0x1f4)+_0x5ea1be)),0x1;}if(_0x2ac61f[_0x1787db(0x1ea)]===!![]||_0x2ac61f[_0x1787db(0x1ea)]===''){const _0x414547=_0x52f6a5[_0x1787db(0x210)]?.[_0x1787db(0x20d)](_0x237965=>_0x237965[_0x1787db(0x300)])||[];if(_0x414547[_0x1787db(0x28a)]===0x0)console[_0x1787db(0x19c)](a22_0x43697b[_0x1787db(0x2c5)]('Error:\x20No\x20attributes\x20defined\x20in\x20configuration'));else{console[_0x1787db(0x19c)](a22_0x43697b['red']('Error:\x20--attribute\x20requires\x20a\x20name\x0a')),console['error'](_0x1787db(0x1dd));for(const _0x478a6b of _0x414547){console[_0x1787db(0x19c)]('\x20\x20'+a22_0x43697b[_0x1787db(0x2b4)](_0x478a6b));}console[_0x1787db(0x19c)]('\x0aUsage:\x20tdx\x20ps\x20preview\x20'+_0x353216+_0x1787db(0x233)+_0x414547[0x0]+'\x22');}return 0x1;}if(_0x2ac61f[_0x1787db(0x1fa)]===!![]||_0x2ac61f[_0x1787db(0x1fa)]===''){const _0x3290e4=_0x52f6a5[_0x1787db(0x2c3)]?.[_0x1787db(0x20d)](_0x53775c=>_0x53775c['name'])||[];if(_0x3290e4[_0x1787db(0x28a)]===0x0)console['error'](a22_0x43697b[_0x1787db(0x2c5)]('Error:\x20No\x20behaviors\x20defined\x20in\x20configuration'));else{console[_0x1787db(0x19c)](a22_0x43697b['red'](_0x1787db(0x1f9))),console[_0x1787db(0x19c)]('Available\x20behaviors:');for(const _0x2af782 of _0x3290e4){console[_0x1787db(0x19c)]('\x20\x20'+a22_0x43697b[_0x1787db(0x2b4)](_0x2af782));}console[_0x1787db(0x19c)](_0x1787db(0x29f)+_0x353216+_0x1787db(0x1a1)+_0x3290e4[0x0]+'\x22');}return 0x1;}const _0x26e55d=createCommandSpinner(a22_0x43697b[_0x1787db(0x2af)](_0x1787db(0x308)),{'verbose':_0x2ac61f[_0x1787db(0x270)]});_0x26e55d[_0x1787db(0x292)]();const _0x4eed73={'onProgress':_0x12560f=>{_0x26e55d['text']=formatProgressMessage(_0x12560f);}};if(_0x2ac61f[_0x1787db(0x1bd)])_0x4eed73['master']=!![];if(_0x2ac61f[_0x1787db(0x1ea)]&&typeof _0x2ac61f['attribute']==='string')_0x4eed73[_0x1787db(0x1ea)]=_0x2ac61f[_0x1787db(0x1ea)];if(_0x2ac61f[_0x1787db(0x1fa)]&&typeof _0x2ac61f[_0x1787db(0x1fa)]===_0x1787db(0x1a7))_0x4eed73[_0x1787db(0x1fa)]=_0x2ac61f['behavior'];if(_0x2ac61f[_0x1787db(0x2ec)])_0x4eed73[_0x1787db(0x2ec)]=!![];if(_0x2ac61f['interval'])_0x4eed73[_0x1787db(0x28c)]=_0x2ac61f[_0x1787db(0x28c)];let _0x1778c9;try{_0x1778c9=await _0x457dbd[_0x1787db(0x286)][_0x1787db(0x1ae)](_0x472bd0,_0x4eed73),_0x26e55d[_0x1787db(0x22e)]();}catch(_0x36e910){_0x26e55d[_0x1787db(0x22e)]();throw _0x36e910;}return await this[_0x1787db(0x22c)](_0x1778c9,{'master':_0x2ac61f[_0x1787db(0x1bd)],'attribute':typeof _0x2ac61f[_0x1787db(0x1ea)]==='string'?_0x2ac61f[_0x1787db(0x1ea)]:undefined,'behavior':typeof _0x2ac61f[_0x1787db(0x1fa)]===_0x1787db(0x1a7)?_0x2ac61f['behavior']:undefined,'enriched':_0x2ac61f[_0x1787db(0x2ec)]}),_0x1778c9['allValid']?0x0:0x1;}async[a22_0x8dcc7b(0x22c)](_0x1487db,_0x368a15){const _0x7a39c8=a22_0x8dcc7b;console[_0x7a39c8(0x19c)]('\x0a'+a22_0x43697b[_0x7a39c8(0x24a)]('Preview:')+'\x20'+_0x1487db[_0x7a39c8(0x300)]),console['error']('═'[_0x7a39c8(0x1de)](0x3c));if(_0x368a15['master']&&_0x1487db[_0x7a39c8(0x30a)]){const _0x123455=a22_0x43697b[_0x7a39c8(0x2af)](_0x7a39c8(0x24c))+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x1487db[_0x7a39c8(0x1bd)][_0x7a39c8(0x302)]+'.'+_0x1487db[_0x7a39c8(0x1bd)][_0x7a39c8(0x298)]);await this[_0x7a39c8(0x289)](_0x123455,_0x1487db[_0x7a39c8(0x30a)]);}else{if(_0x368a15[_0x7a39c8(0x1ea)]&&_0x1487db['sampleData']){const _0x4baa36=a22_0x43697b[_0x7a39c8(0x2af)](_0x7a39c8(0x2d2))+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x368a15[_0x7a39c8(0x1ea)]);await this[_0x7a39c8(0x289)](_0x4baa36,_0x1487db[_0x7a39c8(0x30a)]);}else{if(_0x368a15[_0x7a39c8(0x1fa)]&&_0x1487db[_0x7a39c8(0x30a)]){const _0x54fb2a=a22_0x43697b[_0x7a39c8(0x2af)]('Behavior:')+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x368a15[_0x7a39c8(0x1fa)]);await this['displaySampleData'](_0x54fb2a,_0x1487db[_0x7a39c8(0x30a)]);}else{if(_0x368a15[_0x7a39c8(0x2ec)]&&_0x1487db[_0x7a39c8(0x30a)]){const _0x30bcb6=a22_0x43697b['dim'](_0x7a39c8(0x211))+'\x20'+a22_0x43697b[_0x7a39c8(0x24a)](_0x7a39c8(0x1e0));await this[_0x7a39c8(0x289)](_0x30bcb6,_0x1487db[_0x7a39c8(0x30a)]);}else!_0x1487db[_0x7a39c8(0x30a)]&&console['error'](_0x7a39c8(0x237));}}}if(_0x1487db[_0x7a39c8(0x284)][_0x7a39c8(0x28a)]>0x0){console[_0x7a39c8(0x19c)]('─'[_0x7a39c8(0x1de)](0x3c)),console[_0x7a39c8(0x19c)]('\x0a'+a22_0x43697b[_0x7a39c8(0x2c5)](_0x7a39c8(0x187)));for(const _0x16ff6a of _0x1487db[_0x7a39c8(0x284)]){console['error']('\x20\x20'+a22_0x43697b[_0x7a39c8(0x2c5)]('•')+'\x20'+_0x16ff6a);}}}async['displaySampleData'](_0x5a4438,_0x2d693d){const _0x316e6d=a22_0x8dcc7b;if(_0x2d693d[_0x316e6d(0x28a)]===0x0){console[_0x316e6d(0x19c)]('\x0a'+_0x5a4438),console[_0x316e6d(0x19c)](_0x316e6d(0x1b1));return;}console['error']('\x0a'+_0x5a4438);const _0x464c95=Object['keys'](_0x2d693d[0x0])[_0x316e6d(0x20d)](_0x4c8fac=>({'name':_0x4c8fac,'type':typeof _0x2d693d[0x0][_0x4c8fac]===_0x316e6d(0x1c1)?_0x316e6d(0x1a9):_0x316e6d(0x199)})),_0x1cf992={'queryId':_0x316e6d(0x2dd),'columns':_0x464c95,'data':_0x2d693d,'stats':{'state':_0x316e6d(0x2fd),'queued':![],'scheduled':![],'nodes':0x0,'totalSplits':0x0,'queuedSplits':0x0,'runningSplits':0x0,'completedSplits':0x0,'cpuTimeMillis':0x0,'wallTimeMillis':0x0,'queuedTimeMillis':0x0,'elapsedTimeMillis':0x0,'processedRows':_0x2d693d[_0x316e6d(0x28a)],'processedBytes':0x0,'physicalInputBytes':0x0,'peakMemoryBytes':0x0,'spilledBytes':0x0}},_0x53498e=formatAsTable(_0x1cf992,_0x2d693d[_0x316e6d(0x28a)],!![]);await writeOutput(_0x53498e,undefined,_0x316e6d(0x298));}}export class ParentSegmentRunCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x1fd);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x265);async[a22_0x8dcc7b(0x20b)](_0x383f0f){const _0x398bcd=a22_0x8dcc7b,{options:_0x1e70f6,args:_0xb3067d,tdx:_0x494999}=_0x383f0f,_0xf8944=_0x1e70f6,_0x29bd95=_0xb3067d[0x0]||_0x1e70f6[_0x398bcd(0x2a2)];if(!_0x29bd95)return showParentSegmentNotSetError(_0x398bcd(0x271)+_0x398bcd(0x259)),0x1;const _0x481308=resolveYamlFile(_0x29bd95);if(existsSync(_0x481308)){_0xf8944[_0x398bcd(0x270)]&&console[_0x398bcd(0x19c)](_0x398bcd(0x27b)+_0x481308);let _0x801483;try{_0x801483=readFileSync(_0x481308,'utf-8');}catch(_0x4ce5bb){const _0x219e76=_0x4ce5bb instanceof Error?_0x4ce5bb[_0x398bcd(0x186)]:String(_0x4ce5bb);return console[_0x398bcd(0x19c)](_0x398bcd(0x213)+_0x219e76),0x1;}const _0x354ace=await withSpinner(_0x398bcd(0x23c),()=>_0x494999[_0x398bcd(0x286)]['pushParentYaml'](_0x801483),{'verbose':_0xf8944['verbose']}),_0xb83b2d=_0x354ace['data'],{isNew:_0x268ad9,name:_0xde9dfc,hasChanges:_0x57bd26,diffFormatted:_0x454b37}=_0xb83b2d;if(_0x57bd26){_0x268ad9?console[_0x398bcd(0x19c)]('\x0aNew\x20parent\x20segment\x20\x27'+_0xde9dfc+'\x27:'):console['error'](_0x398bcd(0x2c2)+_0xde9dfc+'\x27:');console[_0x398bcd(0x19c)]('─'[_0x398bcd(0x1de)](0x3c)),console[_0x398bcd(0x19c)](_0x454b37),console[_0x398bcd(0x19c)]('─'[_0x398bcd(0x1de)](0x3c));const _0x2a080c=_0x268ad9?_0x398bcd(0x2da)+_0xde9dfc+_0x398bcd(0x19d):_0x398bcd(0x20f)+_0xde9dfc+_0x398bcd(0x19d);if(!_0xf8944['yes']){if(!isInteractive())return console['error'](a22_0x43697b['red'](_0x398bcd(0x260)),_0x398bcd(0x21e)),console[_0x398bcd(0x19c)](a22_0x43697b[_0x398bcd(0x2af)](_0x398bcd(0x261))),0x1;const _0x4b7bcd=await confirmKey(_0x2a080c);if(!_0x4b7bcd)return console[_0x398bcd(0x19c)](a22_0x43697b[_0x398bcd(0x250)](_0x398bcd(0x263))),0x1;}const _0x347d10=_0x268ad9?_0x398bcd(0x304):_0x398bcd(0x2ff);await withSpinner(_0x347d10+_0x398bcd(0x305)+_0xde9dfc+_0x398bcd(0x291),()=>_0xb83b2d['apply'](),{'verbose':_0xf8944[_0x398bcd(0x270)]});const _0x5e49a9=_0x268ad9?'Created':_0x398bcd(0x1cb);console[_0x398bcd(0x19c)]('✔\x20'+_0x5e49a9+_0x398bcd(0x305)+_0xde9dfc+'\x27');}else console[_0x398bcd(0x19c)](_0x398bcd(0x2a6)+_0xde9dfc+_0x398bcd(0x1e3));}const _0x19e745=await withSpinner(_0x398bcd(0x21a)+_0x29bd95+_0x398bcd(0x291),()=>_0x494999[_0x398bcd(0x286)]['runParent'](_0x29bd95),{'verbose':_0xf8944[_0x398bcd(0x270)]}),_0x13ae8c=_0x19e745[_0x398bcd(0x207)],_0x5bc409=getConsoleUrl(_0xf8944[_0x398bcd(0x1f5)],_0x398bcd(0x25f)+_0x13ae8c[_0x398bcd(0x2db)]+'/sessions/'+_0x13ae8c[_0x398bcd(0x2ab)]+'/attempt/'+_0x13ae8c[_0x398bcd(0x2a4)]);return console[_0x398bcd(0x19c)](_0x398bcd(0x1f6)),console[_0x398bcd(0x19c)]('\x20\x20'+a22_0x43697b['dim'](_0x398bcd(0x1d6))+'\x20'+_0x13ae8c['audienceId']),console[_0x398bcd(0x19c)]('\x20\x20'+a22_0x43697b[_0x398bcd(0x2af)]('Status:')+'\x20'+_0x13ae8c[_0x398bcd(0x2a1)]),console['error']('\x20\x20'+a22_0x43697b[_0x398bcd(0x2af)](_0x398bcd(0x2e2))+'\x20'+_0x13ae8c[_0x398bcd(0x2ab)]),console['error']('\x20\x20'+a22_0x43697b[_0x398bcd(0x2af)]('Attempt:')+'\x20'+_0x13ae8c['workflowAttemptId']),console[_0x398bcd(0x19c)]('\x20\x20'+_0x5bc409),console['error']('\x0a'+a22_0x43697b[_0x398bcd(0x2af)]('To\x20cancel:')+_0x398bcd(0x22f)+_0x13ae8c[_0x398bcd(0x2a4)]+'\x20kill'),0x0;}}function a22_0x4d07(_0x908de4,_0x3adb1f){_0x908de4=_0x908de4-0x185;const _0x40984b=a22_0x4098();let _0x4d0770=_0x40984b[_0x908de4];return _0x4d0770;}export class ParentSegmentFieldsCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x22d);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x26f);async[a22_0x8dcc7b(0x20b)](_0x2145fb){const _0x413cbd=a22_0x8dcc7b,{options:_0xd507b9,args:_0x2ed9df,tdx:_0x512298}=_0x2145fb,_0x9f57bd=_0x2ed9df[0x0]||_0xd507b9[_0x413cbd(0x2a2)];if(!_0x9f57bd)return showParentSegmentNotSetError(_0x413cbd(0x224)+'\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;_0xd507b9[_0x413cbd(0x270)]&&(console[_0x413cbd(0x19c)](_0x413cbd(0x24f)+_0xd507b9['site']),console[_0x413cbd(0x19c)](_0x413cbd(0x25a)+_0x9f57bd));const _0x29f211=await withSpinner(_0x413cbd(0x2d7)+_0x9f57bd+_0x413cbd(0x291),()=>_0x512298[_0x413cbd(0x286)][_0x413cbd(0x1b2)](_0x9f57bd),{'verbose':_0xd507b9['verbose']}),_0x46e2fc=_0x29f211[_0x413cbd(0x207)];console[_0x413cbd(0x19c)](_0x413cbd(0x2de)+_0x46e2fc[_0x413cbd(0x28a)]+_0x413cbd(0x282)+(_0x46e2fc[_0x413cbd(0x28a)]!==0x1?'s':''));if(_0xd507b9[_0x413cbd(0x2a0)]||_0xd507b9[_0x413cbd(0x2f7)])return await handleSDKOutput(_0x46e2fc,_0xd507b9),0x0;return displayFieldsHumanReadable(_0x46e2fc,_0x9f57bd),0x0;}}export class ParentSegmentViewCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2c7);['description']=a22_0x8dcc7b(0x1dc);async[a22_0x8dcc7b(0x20b)](_0x1286f4){const _0x515496=a22_0x8dcc7b,{options:_0x3d422c,args:_0x1115a8,tdx:_0x28ca81}=_0x1286f4,_0x5577a6=_0x3d422c,_0x4ae31b=_0x1115a8[0x0]||_0x3d422c[_0x515496(0x2a2)];if(!_0x4ae31b)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20view\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20View\x20(requires\x20context)\x0a'+_0x515496(0x1fc)+_0x515496(0x21f)+_0x515496(0x27c)),0x1;_0x3d422c[_0x515496(0x270)]&&(console[_0x515496(0x19c)]('Site:\x20'+_0x3d422c[_0x515496(0x1f5)]),console[_0x515496(0x19c)]('Parent\x20segment:\x20'+_0x4ae31b));const _0x4ba14b=await withSpinner(_0x515496(0x2c9)+_0x4ae31b+_0x515496(0x291),()=>_0x28ca81[_0x515496(0x286)][_0x515496(0x1cd)](_0x4ae31b),{'verbose':_0x3d422c[_0x515496(0x270)]}),_0x49e0ab=_0x4ba14b['data'];if(_0x5577a6['web']){const _0x1887b4=getConsoleNextUrl(_0x5577a6['site'],'/app/dw/parentSegments/'+_0x49e0ab['id']);return console['error'](a22_0x43697b[_0x515496(0x1b3)]('✔')+_0x515496(0x2b6)+a22_0x43697b[_0x515496(0x2b4)](_0x1887b4)),openBrowser(_0x1887b4),0x0;}return await handleSingleObjectOutput(_0x49e0ab,_0x3d422c),0x0;}}export class ParentSegmentDescCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]='segment:parent:desc';[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x209);async[a22_0x8dcc7b(0x20b)](_0x29e1a5){const _0x494a4e=a22_0x8dcc7b,{options:_0x43dcf1,args:_0x254a9a,tdx:_0x5bc75c}=_0x29e1a5,_0x253608=_0x43dcf1,_0x55a821=_0x254a9a[0x0]||_0x43dcf1[_0x494a4e(0x2a2)];if(!_0x55a821)return showParentSegmentNotSetError(_0x494a4e(0x1d4)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20ps\x20desc\x20<name>\x20\x20\x20\x20\x20\x20\x20#\x20Describe\x20all\x20tables\x20for\x20parent\x20segment\x0a\x0a'+_0x494a4e(0x21f)+_0x494a4e(0x2fc)),0x1;_0x43dcf1[_0x494a4e(0x270)]&&(console['error']('Site:\x20'+_0x43dcf1[_0x494a4e(0x1f5)]),console[_0x494a4e(0x19c)](_0x494a4e(0x25a)+_0x55a821));const _0x56eed5=await withSpinner(_0x494a4e(0x226)+_0x55a821+_0x494a4e(0x291),()=>_0x5bc75c['segment'][_0x494a4e(0x2f2)](_0x55a821),{'verbose':_0x43dcf1[_0x494a4e(0x270)]}),_0x25b77f=_0x56eed5['data'],_0x858838=_0x5bc75c['segment'][_0x494a4e(0x20e)](_0x25b77f);if(_0x253608[_0x494a4e(0x1db)]){const _0x49a00c=await this[_0x494a4e(0x18f)](_0x29e1a5,_0x55a821,_0x25b77f,_0x858838),_0x325a10=this[_0x494a4e(0x27a)](_0x49a00c);writeFileSync(_0x253608[_0x494a4e(0x1db)],_0x325a10);const _0x4fe541=_0x49a00c['customers']['columns'][_0x494a4e(0x28a)]+_0x49a00c[_0x494a4e(0x2c3)][_0x494a4e(0x1ce)]((_0x3bacf8,_0x1eb086)=>_0x3bacf8+_0x1eb086[_0x494a4e(0x195)][_0x494a4e(0x28a)],0x0),_0x176b8e=_0x49a00c[_0x494a4e(0x2c3)][_0x494a4e(0x241)](_0x56d1e6=>_0x56d1e6['columns'][_0x494a4e(0x28a)]===0x0)[_0x494a4e(0x28a)];return console['log'](_0x494a4e(0x279)+_0x253608[_0x494a4e(0x1db)]),console[_0x494a4e(0x2dc)](_0x494a4e(0x2e7)+_0x858838),console[_0x494a4e(0x2dc)](_0x494a4e(0x2cb)+_0x49a00c['behaviors'][_0x494a4e(0x28a)]+_0x494a4e(0x1da)),console[_0x494a4e(0x2dc)](_0x494a4e(0x1a4)+_0x4fe541+_0x494a4e(0x2d3)),_0x176b8e>0x0&&console['log'](_0x494a4e(0x2d4)+_0x176b8e+_0x494a4e(0x1ac)),0x0;}console[_0x494a4e(0x19c)]('\x0a'+a22_0x43697b['bold']('Output\x20Database:')+'\x20'+a22_0x43697b[_0x494a4e(0x2b4)](_0x858838));const _0x453bed=await withSpinner(_0x494a4e(0x1d7),()=>_0x5bc75c[_0x494a4e(0x286)][_0x494a4e(0x245)](_0x25b77f),{'verbose':_0x43dcf1[_0x494a4e(0x270)]});console['error']('\x0a'+a22_0x43697b[_0x494a4e(0x24a)](_0x494a4e(0x29d))+'\x20'+a22_0x43697b[_0x494a4e(0x2af)]('('+_0x858838+_0x494a4e(0x288)));const _0x151c7f=await executeSchemaQuery(_0x453bed[_0x494a4e(0x207)],_0x5bc75c,_0x43dcf1);await handleQueryOutput(_0x151c7f,_0x43dcf1);const _0x52cf85=await withSpinner(_0x494a4e(0x20a),()=>_0x5bc75c[_0x494a4e(0x286)][_0x494a4e(0x215)](_0x25b77f),{'verbose':_0x43dcf1[_0x494a4e(0x270)]});for(const _0x165ef4 of _0x52cf85[_0x494a4e(0x207)]){const _0x307eb7=_0x494a4e(0x1c7)+_0x165ef4[_0x494a4e(0x190)]()[_0x494a4e(0x2a7)](/\s+/g,'_'),_0x1efc3a='SELECT\x20*\x20FROM\x20'+_0x858838+'.'+_0x307eb7;console['error']('\x0a'+a22_0x43697b[_0x494a4e(0x24a)](_0x165ef4)+'\x20'+a22_0x43697b[_0x494a4e(0x2af)]('('+_0x858838+'.'+_0x307eb7+')'));try{const _0x302492=await executeSchemaQuery(_0x1efc3a,_0x5bc75c,_0x43dcf1);await handleQueryOutput(_0x302492,_0x43dcf1);}catch{console[_0x494a4e(0x19c)](a22_0x43697b[_0x494a4e(0x250)](_0x494a4e(0x2f1)));}}return 0x0;}async[a22_0x8dcc7b(0x18f)](_0x36eee0,_0x9a49ad,_0x36ad13,_0x5ea9f3){const _0x2903ea=a22_0x8dcc7b,{options:_0x472309,tdx:_0x2fe135}=_0x36eee0,_0x7d79b1=await withSpinner('Fetching\x20customers\x20schema...',()=>_0x2fe135[_0x2903ea(0x286)][_0x2903ea(0x245)](_0x36ad13),{'verbose':_0x472309[_0x2903ea(0x270)]}),_0x37f543=await executeSchemaQuery(_0x7d79b1['data'],_0x2fe135,_0x472309),_0x2a1c1d=_0x37f543[_0x2903ea(0x207)][_0x2903ea(0x20d)](_0x51c30e=>({'name':_0x51c30e[_0x2903ea(0x296)],'type':_0x51c30e[_0x2903ea(0x1ad)]})),_0x4ac6c2=await withSpinner(_0x2903ea(0x20a),()=>_0x2fe135[_0x2903ea(0x286)]['getBehaviorNames'](_0x36ad13),{'verbose':_0x472309[_0x2903ea(0x270)]}),_0x3f2aa9=[];for(const _0x1aa9d2 of _0x4ac6c2[_0x2903ea(0x207)]){const _0x5697ea=_0x2903ea(0x1c7)+_0x1aa9d2['toLowerCase']()['replace'](/\s+/g,'_'),_0x3d41a0=_0x2903ea(0x264)+_0x5ea9f3+'.'+_0x5697ea;let _0x338c80=[];try{const _0x521cf0=await executeSchemaQuery(_0x3d41a0,_0x2fe135,_0x472309);_0x338c80=_0x521cf0['data'][_0x2903ea(0x20d)](_0x3988d5=>({'name':_0x3988d5[_0x2903ea(0x296)],'type':_0x3988d5[_0x2903ea(0x1ad)]}));}catch{}_0x3f2aa9[_0x2903ea(0x266)]({'table':_0x5697ea,'columns':_0x338c80});}return{'database':_0x5ea9f3,'parent_segment':_0x9a49ad,'parent_id':_0x36ad13,'customers':{'table':_0x2903ea(0x29d),'columns':_0x2a1c1d},'behaviors':_0x3f2aa9};}['formatSchemaJson'](_0x1ee494){const _0x52a350=a22_0x8dcc7b,_0x337694=_0x254e93=>{const _0x112167=a22_0x4d07;if(_0x254e93[_0x112167(0x28a)]===0x0)return'[]';const _0x1c9eea=_0x254e93['map'](_0x590590=>'\x20\x20\x20\x20\x20\x20{\x20\x22name\x22:\x20\x22'+_0x590590['name']+'\x22,\x20\x22type\x22:\x20\x22'+_0x590590[_0x112167(0x1d5)]+'\x22\x20}');return'[\x0a'+_0x1c9eea[_0x112167(0x1c6)](',\x0a')+'\x0a\x20\x20\x20\x20]';},_0x4473df=_0x1ee494[_0x52a350(0x2c3)][_0x52a350(0x20d)](_0x318be0=>{const _0x2ffb72=_0x52a350;return _0x2ffb72(0x1d9)+_0x318be0['table']+_0x2ffb72(0x223)+_0x337694(_0x318be0[_0x2ffb72(0x195)])[_0x2ffb72(0x2a7)](/^/gm,'\x20\x20')[_0x2ffb72(0x2fb)]()+_0x2ffb72(0x2ea);})[_0x52a350(0x1c6)](',\x0a');return'{\x0a\x20\x20\x22database\x22:\x20\x22'+_0x1ee494['database']+_0x52a350(0x1c5)+_0x1ee494[_0x52a350(0x2cd)]+_0x52a350(0x2e8)+_0x1ee494[_0x52a350(0x1ff)]+_0x52a350(0x276)+_0x1ee494[_0x52a350(0x29d)]['table']+_0x52a350(0x194)+_0x337694(_0x1ee494[_0x52a350(0x29d)][_0x52a350(0x195)])['replace'](/^/gm,'\x20\x20')['trim']()+_0x52a350(0x2f0)+_0x4473df+'\x0a\x20\x20]\x0a}\x0a';}}export class ParentSegmentSQLCommand extends BaseCommand{['name']=a22_0x8dcc7b(0x18e);[a22_0x8dcc7b(0x267)]='Get\x20SQL\x20query\x20for\x20parent\x20segment';async['execute'](_0x4878f8){const _0x3b1252=a22_0x8dcc7b,{options:_0x989c6b,args:_0x1f5df2,tdx:_0x414f59}=_0x4878f8,_0x1370d5=_0x1f5df2[0x0]||_0x989c6b[_0x3b1252(0x2a2)];if(!_0x1370d5)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20sql\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20SQL\x20(requires\x20context)\x0a'+_0x3b1252(0x290)),0x1;_0x989c6b['verbose']&&(console[_0x3b1252(0x19c)](_0x3b1252(0x24f)+_0x989c6b['site']),console[_0x3b1252(0x19c)](_0x3b1252(0x25a)+_0x1370d5));const _0x24ac8f=await withSpinner(_0x3b1252(0x226)+_0x1370d5+_0x3b1252(0x291),()=>_0x414f59[_0x3b1252(0x286)]['resolveParentId'](_0x1370d5),{'verbose':_0x989c6b[_0x3b1252(0x270)]}),_0x59af27=_0x24ac8f[_0x3b1252(0x207)],_0x3ea1ef=await withSpinner(_0x3b1252(0x2c0)+_0x1370d5+_0x3b1252(0x291),()=>_0x414f59[_0x3b1252(0x286)][_0x3b1252(0x245)](_0x59af27),{'verbose':_0x989c6b[_0x3b1252(0x270)]}),_0x29d28d=_0x3ea1ef[_0x3b1252(0x207)];return _0x989c6b[_0x3b1252(0x222)]==='json'||_0x989c6b[_0x3b1252(0x222)]==='jsonl'?await handleSDKOutput([{'sql':_0x29d28d}],_0x989c6b):console[_0x3b1252(0x2dc)](_0x29d28d),0x0;}}export class ParentSegmentShowCommand extends BaseCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x273);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x242);async[a22_0x8dcc7b(0x20b)](_0x176f5b){const _0x3ca176=a22_0x8dcc7b,{options:_0x227141,args:_0x54ff51,tdx:_0x17106b}=_0x176f5b,_0x533275=_0x54ff51[0x0]||_0x227141[_0x3ca176(0x2a2)];if(!_0x533275)return showParentSegmentNotSetError(_0x3ca176(0x2e0)+_0x3ca176(0x18a)),0x1;_0x227141[_0x3ca176(0x270)]&&(console[_0x3ca176(0x19c)]('Site:\x20'+_0x227141[_0x3ca176(0x1f5)]),console[_0x3ca176(0x19c)](_0x3ca176(0x25a)+_0x533275));const _0x26eb19=await withSpinner(_0x3ca176(0x226)+_0x533275+_0x3ca176(0x291),()=>_0x17106b[_0x3ca176(0x286)][_0x3ca176(0x2f2)](_0x533275),{'verbose':_0x227141['verbose']}),_0x561faf=_0x26eb19[_0x3ca176(0x207)],_0x2ae35b=await withSpinner(_0x3ca176(0x2c0)+_0x533275+_0x3ca176(0x291),()=>_0x17106b[_0x3ca176(0x286)][_0x3ca176(0x245)](_0x561faf),{'verbose':_0x227141[_0x3ca176(0x270)]});let _0x2a95fe=_0x2ae35b[_0x3ca176(0x207)];const _0x58184f=resolveLimit(_0x227141[_0x3ca176(0x28b)],DEFAULT_DISPLAY_LIMIT),_0x3af372=/\bLIMIT\s+\d+/i[_0x3ca176(0x246)](_0x2a95fe);!_0x3af372&&(_0x2a95fe=_0x2a95fe['trim']()['replace'](/;+$/,''),_0x2a95fe=_0x3ca176(0x1f1)+_0x2a95fe+_0x3ca176(0x189)+_0x58184f);_0x227141[_0x3ca176(0x270)]&&console[_0x3ca176(0x19c)]('SQL\x20query:\x0a'+_0x2a95fe);const _0x68ca12=await withProgressSpinner(_0x3ca176(0x21b),async _0x42fd97=>{const _0x40961c=_0x3ca176,_0x431724=await _0x17106b[_0x40961c(0x28f)][_0x40961c(0x20b)](_0x2a95fe,{'catalog':'td','schema':'information_schema','onJobId':_0x316e81=>{const _0x4e02b1=_0x40961c;_0x42fd97[_0x4e02b1(0x2eb)](_0x316e81);}});return _0x431724;},{'verbose':_0x227141[_0x3ca176(0x270)]}),_0xc17604=_0x68ca12[_0x3ca176(0x207)],_0x1e7f4e=_0xc17604[_0x3ca176(0x25d)]?_0x3ca176(0x2ce)+_0xc17604[_0x3ca176(0x25d)]+']':'';return console['error'](_0x3ca176(0x1c0)+_0xc17604[_0x3ca176(0x2b7)][_0x3ca176(0x1b6)][_0x3ca176(0x1e4)]()+_0x3ca176(0x1d3)+(_0x3ca176(0x2f4)+formatElapsed(_0xc17604[_0x3ca176(0x2b7)][_0x3ca176(0x234)])+_0x1e7f4e)),await handleQueryOutput(_0xc17604,_0x227141),0x0;}}export class PSRtListCommand extends BaseCommand{['name']='ps:rt:list';[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x2ef);async[a22_0x8dcc7b(0x20b)](_0x1a9308){const _0x1ac6da=a22_0x8dcc7b,{options:_0x22da4f,args:_0x51a412,tdx:_0x55b303}=_0x1a9308,_0x5249fd=_0x51a412[0x0],_0x703e1e=await withSpinner(_0x5249fd?'Listing\x20RT-enabled\x20parent\x20segments\x20matching\x20\x27'+_0x5249fd+'\x27...':_0x1ac6da(0x2b9),()=>_0x55b303[_0x1ac6da(0x1b4)][_0x1ac6da(0x2be)](),{'verbose':_0x22da4f[_0x1ac6da(0x270)]});let _0x1af3db=_0x703e1e[_0x1ac6da(0x207)][_0x1ac6da(0x241)](_0x37dafc=>_0x37dafc[_0x1ac6da(0x2d6)]);if(_0x5249fd){const _0x4e6ed4=_0x5249fd[_0x1ac6da(0x2a7)](/[.+^${}()|[\]\\]/g,_0x1ac6da(0x221))['replace'](/\*/g,'.*')[_0x1ac6da(0x2a7)](/\?/g,'.'),_0x3a14b2=new RegExp('^'+_0x4e6ed4+'$','i');_0x1af3db=_0x1af3db[_0x1ac6da(0x241)](_0x25b44f=>_0x3a14b2[_0x1ac6da(0x246)](_0x25b44f[_0x1ac6da(0x300)]));}_0x1af3db[_0x1ac6da(0x228)]((_0x4b63e5,_0x8df185)=>_0x4b63e5[_0x1ac6da(0x300)]['localeCompare'](_0x8df185['name'])),console[_0x1ac6da(0x19c)](_0x1ac6da(0x2de)+_0x1af3db[_0x1ac6da(0x28a)]+'\x20RT-enabled\x20parent\x20segment'+(_0x1af3db[_0x1ac6da(0x28a)]!==0x1?'s':''));const _0x3b9548=_0x4e18f0=>{const _0x33bdc6=_0x1ac6da;return getConsoleNextUrl(_0x22da4f[_0x33bdc6(0x1f5)],'/app/dw/parentSegments/'+_0x4e18f0);};if(_0x22da4f[_0x1ac6da(0x222)]===_0x1ac6da(0x2a0)||_0x22da4f[_0x1ac6da(0x222)]==='jsonl'){const _0x1c9a40=_0x1af3db['map'](_0x25a036=>({..._0x25a036,'url':_0x3b9548(_0x25a036['id'])}));await handleSDKOutput(_0x1c9a40,_0x22da4f);}else{if(_0x1af3db[_0x1ac6da(0x28a)]===0x0)console[_0x1ac6da(0x2dc)](_0x1ac6da(0x2a8));else for(const _0x57d609 of _0x1af3db){const _0x181c2a=_0x57d609['population']?a22_0x43697b['dim']('\x20('+formatRows(_0x57d609['population'])+')'):'',_0x5dbd5e=hyperlink(_0x57d609[_0x1ac6da(0x300)],_0x3b9548(_0x57d609['id']));console[_0x1ac6da(0x2dc)]('⚡\x20'+_0x5dbd5e+_0x181c2a);}}return 0x0;}}export class PSRtValidateCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x28d);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x19a);async[a22_0x8dcc7b(0x20b)](_0x54d00a){const _0x54c02c=a22_0x8dcc7b,{options:_0x4176c1,args:_0x4faac3,tdx:_0x5da382}=_0x54d00a,_0x281dc8=_0x4faac3[0x0]||_0x4176c1[_0x54c02c(0x2a2)];if(!_0x281dc8)return showParentSegmentNotSetError('Usage:\x20tdx\x20ps\x20rt\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20RT\x20config\x20(requires\x20context)\x0a'+_0x54c02c(0x2c1)),0x1;const _0x1904a0=resolveYamlFile(_0x281dc8);if(!existsSync(_0x1904a0))return showFileNotFoundError(_0x1904a0,_0x281dc8),0x1;let _0x13a7cf;try{_0x13a7cf=readFileSync(_0x1904a0,_0x54c02c(0x256));}catch(_0x4e5338){const _0x4af227=_0x4e5338 instanceof Error?_0x4e5338[_0x54c02c(0x186)]:String(_0x4e5338);return console[_0x54c02c(0x19c)](_0x54c02c(0x213)+_0x4af227),0x1;}const _0x481713=createCommandSpinner(a22_0x43697b[_0x54c02c(0x2af)]('Validating\x20RT\x20configuration...'),{'verbose':_0x4176c1[_0x54c02c(0x270)]});_0x481713['start']();const _0x1251a1={'realtime':!![],'onProgress':_0x22effa=>{const _0x37edc5=_0x54c02c;_0x481713[_0x37edc5(0x2d9)]=formatProgressMessage(_0x22effa);}};let _0x3611dd;try{_0x3611dd=await _0x5da382['segment'][_0x54c02c(0x26d)](_0x13a7cf,_0x1251a1),_0x481713[_0x54c02c(0x22e)]();}catch(_0x2b0885){_0x481713[_0x54c02c(0x22e)]();throw _0x2b0885;}console[_0x54c02c(0x19c)]('\x0a'+a22_0x43697b[_0x54c02c(0x24a)]('RT\x202.0\x20Validate:')+'\x20'+_0x3611dd[_0x54c02c(0x300)]),console['error']('═'[_0x54c02c(0x1de)](0x3c)),displayRealtimeValidation(_0x3611dd),console[_0x54c02c(0x19c)]('─'[_0x54c02c(0x1de)](0x3c));if(_0x3611dd['errors']['length']>0x0){console['error']('\x0a'+a22_0x43697b[_0x54c02c(0x2c5)](_0x54c02c(0x187)));for(const _0x22443d of _0x3611dd[_0x54c02c(0x284)]){console[_0x54c02c(0x19c)]('\x20\x20'+a22_0x43697b[_0x54c02c(0x2c5)]('•')+'\x20'+_0x22443d);}}return _0x3611dd[_0x54c02c(0x1bb)]&&console['error']('\x0a'+a22_0x43697b[_0x54c02c(0x1b3)]('✔')+_0x54c02c(0x30c)),_0x3611dd['allValid']?0x0:0x1;}}export class PSPzListCommand extends BaseCommand{['name']=a22_0x8dcc7b(0x275);['description']=a22_0x8dcc7b(0x29b);async[a22_0x8dcc7b(0x20b)](_0x2fadf4){const _0x45108e=a22_0x8dcc7b,{options:_0x544d66,args:_0x22972e,tdx:_0x2f919a}=_0x2fadf4,_0x3a5221=_0x22972e[0x0]||_0x544d66['parentSegment'];if(!_0x3a5221)return showParentSegmentNotSetError(_0x45108e(0x2d1)+_0x45108e(0x1a0)),0x1;const _0x1dffc2=await withSpinner('Resolving\x20parent\x20segment\x20\x27'+_0x3a5221+_0x45108e(0x291),()=>_0x2f919a[_0x45108e(0x286)][_0x45108e(0x2f2)](_0x3a5221),{'verbose':_0x544d66[_0x45108e(0x270)]}),_0x15ff8f=_0x1dffc2[_0x45108e(0x207)],_0x2af5eb=await withSpinner('Listing\x20personalization\x20services\x20for\x20\x27'+_0x3a5221+_0x45108e(0x291),()=>_0x2f919a[_0x45108e(0x196)]['list'](_0x15ff8f),{'verbose':_0x544d66[_0x45108e(0x270)]}),_0x475643=_0x2af5eb[_0x45108e(0x207)];console['error'](_0x45108e(0x2de)+_0x475643[_0x45108e(0x28a)]+_0x45108e(0x19f)+(_0x475643['length']!==0x1?'s':''));if(_0x544d66[_0x45108e(0x222)]===_0x45108e(0x2a0)||_0x544d66['format']===_0x45108e(0x2f7))await handleSDKOutput(_0x475643,_0x544d66);else{if(_0x475643[_0x45108e(0x28a)]===0x0)console[_0x45108e(0x2dc)]('No\x20personalization\x20services\x20configured'),console['error'](a22_0x43697b['cyan']('\x0aTip:\x20Run\x20`tdx\x20ps\x20pz\x20init`\x20to\x20add\x20a\x20template\x20personalization\x20section\x20to\x20your\x20YAML'));else for(const _0x2a96b5 of _0x475643){const _0x527eb3=_0x2a96b5['sections']?.[_0x45108e(0x28a)]||0x0,_0x4dd2a1=_0x2a96b5[_0x45108e(0x29a)]?a22_0x43697b[_0x45108e(0x2af)](_0x45108e(0x1c4)+_0x2a96b5[_0x45108e(0x29a)]):'',_0x30d883=a22_0x43697b[_0x45108e(0x2af)]('\x20('+_0x527eb3+_0x45108e(0x23b)+(_0x527eb3!==0x1?'s':'')+')');console[_0x45108e(0x2dc)]('\x20\x20'+_0x2a96b5[_0x45108e(0x300)]+_0x4dd2a1+_0x30d883),_0x2a96b5['description']&&console[_0x45108e(0x2dc)](_0x45108e(0x1b7)+a22_0x43697b[_0x45108e(0x2af)](_0x2a96b5[_0x45108e(0x267)]));}}return 0x0;}}export class PSPzInitCommand extends BaseParentSegmentCommand{[a22_0x8dcc7b(0x300)]=a22_0x8dcc7b(0x2df);[a22_0x8dcc7b(0x267)]=a22_0x8dcc7b(0x23a);async[a22_0x8dcc7b(0x20b)](_0x49733c){const _0x30037e=a22_0x8dcc7b,{options:_0xf894b,args:_0x5d873e}=_0x49733c,_0x580a1e=_0x5d873e[0x0]||_0xf894b[_0x30037e(0x2a2)];if(!_0x580a1e)return showParentSegmentNotSetError(_0x30037e(0x19b)+_0x30037e(0x219)),0x1;const _0x1867ac=resolveYamlFile(_0x580a1e);if(!existsSync(_0x1867ac))return showFileNotFoundError(_0x1867ac,_0x580a1e),0x1;let _0x276458;try{_0x276458=readFileSync(_0x1867ac,_0x30037e(0x256));}catch(_0x5d7436){const _0x3a7683=_0x5d7436 instanceof Error?_0x5d7436[_0x30037e(0x186)]:String(_0x5d7436);return console['error'](_0x30037e(0x213)+_0x3a7683),0x1;}let _0x178d5a;try{_0x178d5a=parseDef(_0x276458);}catch(_0x4fb165){const _0xb332a=_0x4fb165 instanceof Error?_0x4fb165[_0x30037e(0x186)]:String(_0x4fb165);return console[_0x30037e(0x19c)](a22_0x43697b[_0x30037e(0x2c5)](_0x30037e(0x1f4)+_0xb332a)),0x1;}if(_0x178d5a[_0x30037e(0x231)]&&_0x178d5a[_0x30037e(0x231)][_0x30037e(0x28a)]>0x0)return console['error'](a22_0x43697b[_0x30037e(0x250)](_0x30037e(0x217)+_0x1867ac)),console['error'](a22_0x43697b['dim']('\x20\x20\x20'+_0x178d5a[_0x30037e(0x231)][_0x30037e(0x28a)]+_0x30037e(0x2fa))),0x1;!_0x178d5a['realtime']&&(_0x178d5a[_0x30037e(0x1b4)]={'events':[{'name':'page_view','source_table':_0x30037e(0x2e5)}],'attributes':[{'name':'last_page_viewed','type':_0x30037e(0x192)}],'id_stitching':{'primary_key':_0x178d5a[_0x30037e(0x1bd)][_0x30037e(0x298)]===_0x30037e(0x29d)?_0x30037e(0x19e):_0x30037e(0x23e)}});_0x178d5a['personalization_services']=[{'name':_0x30037e(0x2ca),'description':_0x30037e(0x27d),'trigger_event':'page_view','sections':[{'name':_0x30037e(0x1a3),'criteria':_0x30037e(0x26b),'attributes':[_0x30037e(0x30b)]}]}];const _0x484314=serializeDef(_0x178d5a);return writeFileSync(_0x1867ac,_0x484314,_0x30037e(0x256)),console[_0x30037e(0x19c)](a22_0x43697b[_0x30037e(0x1b3)]('✔')+_0x30037e(0x2ba)+a22_0x43697b['cyan'](_0x1867ac)),(!_0x178d5a[_0x30037e(0x1b4)]||_0x276458[_0x30037e(0x2e9)](_0x30037e(0x1e8))===-0x1)&&console[_0x30037e(0x19c)](a22_0x43697b['green']('✔')+_0x30037e(0x205)),console[_0x30037e(0x19c)]('\x0a'+a22_0x43697b['dim']('Next\x20steps:')),console[_0x30037e(0x19c)]('\x20\x201.\x20Edit\x20'+_0x1867ac+'\x20to\x20configure\x20your\x20personalization\x20service'),console['error'](_0x30037e(0x1ca)+a22_0x43697b[_0x30037e(0x2af)]('tdx\x20ps\x20push\x20'+_0x580a1e)+_0x30037e(0x258)),0x0;}}
@@ -1 +1 @@
1
- const a23_0x1d8cf4=a23_0x4f7d;(function(_0x344d6e,_0x594c04){const _0x2347b4=a23_0x4f7d,_0x1415c7=_0x344d6e();while(!![]){try{const _0x614757=-parseInt(_0x2347b4(0x201))/0x1*(-parseInt(_0x2347b4(0x249))/0x2)+parseInt(_0x2347b4(0x24e))/0x3+parseInt(_0x2347b4(0x1f6))/0x4+-parseInt(_0x2347b4(0x1f0))/0x5+parseInt(_0x2347b4(0x24d))/0x6+parseInt(_0x2347b4(0x204))/0x7*(parseInt(_0x2347b4(0x242))/0x8)+-parseInt(_0x2347b4(0x205))/0x9;if(_0x614757===_0x594c04)break;else _0x1415c7['push'](_0x1415c7['shift']());}catch(_0x368840){_0x1415c7['push'](_0x1415c7['shift']());}}}(a23_0x3bd5,0xadc46));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0xd21185 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';function a23_0x4f7d(_0x5536ab,_0x3c1fc8){_0x5536ab=_0x5536ab-0x1e6;const _0x3bd575=a23_0x3bd5();let _0x4f7d7d=_0x3bd575[_0x5536ab];return _0x4f7d7d;}import a23_0x777a10 from'prompts';import a23_0x145e57 from'chalk';function validateProfileName(_0x1f07fe){const _0x15d119=a23_0x4f7d;if(!_0x1f07fe||!_0x1f07fe['trim']())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x3342e8=_0x1f07fe[_0x15d119(0x220)]();if(!/^[a-zA-Z0-9_-]+$/[_0x15d119(0x248)](_0x3342e8))return'Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore';if(profileExists(_0x3342e8))return _0x15d119(0x1f3)+_0x3342e8+'\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.';return!![];}export class ProfileCreateCommand extends BaseCommand{['name']=a23_0x1d8cf4(0x20d);[a23_0x1d8cf4(0x247)]=a23_0x1d8cf4(0x1ec);async['execute'](_0x19b913){const _0x5f3c68=a23_0x1d8cf4,{options:_0x3eaecc,args:_0x1270ad}=_0x19b913;console[_0x5f3c68(0x20f)](a23_0x145e57['bold'](_0x5f3c68(0x215)));let _0x49e8fd;if(_0x1270ad[_0x5f3c68(0x22d)]>0x0&&_0x1270ad[0x0]){const _0x29b718=_0x1270ad[0x0][_0x5f3c68(0x220)](),_0x41f02b=validateProfileName(_0x29b718);if(_0x41f02b!==!![])return console[_0x5f3c68(0x1ea)](a23_0x145e57[_0x5f3c68(0x24b)](_0x41f02b)),0x1;_0x49e8fd=_0x29b718;}else{const _0x2b4287=await a23_0x777a10({'type':'text','name':'profileName','message':_0x5f3c68(0x23e),'validate':validateProfileName});if(!_0x2b4287[_0x5f3c68(0x231)])return console[_0x5f3c68(0x20f)]('\x0aSetup\x20cancelled'),0x1;_0x49e8fd=_0x2b4287[_0x5f3c68(0x231)][_0x5f3c68(0x220)]();}const _0x17fbe4=await a23_0x777a10({'type':_0x5f3c68(0x241),'name':_0x5f3c68(0x247),'message':'Enter\x20description\x20(optional):'}),_0x30b6d0=_0x17fbe4[_0x5f3c68(0x247)]?.[_0x5f3c68(0x220)]()||undefined,_0x1d3ad9=_0x3eaecc['site']||'us01',{choices:_0x140079,initialIndex:_0x3f1a4e}=buildSiteChoices(_0x1d3ad9),_0x5a1fb8=await a23_0x777a10({'type':_0x5f3c68(0x245),'name':_0x5f3c68(0x1f9),'message':_0x5f3c68(0x21d)+_0x49e8fd+'\x27:','choices':_0x140079,'initial':_0x3f1a4e});if(!_0x5a1fb8['site'])return console[_0x5f3c68(0x20f)](_0x5f3c68(0x22c)),0x1;let _0x5163d5;if(_0x5a1fb8[_0x5f3c68(0x1f9)]===_0x5f3c68(0x1f7)){const _0xc6cecd=await a23_0x777a10({'type':_0x5f3c68(0x241),'name':_0x5f3c68(0x1e6),'message':_0x5f3c68(0x1ef),'initial':_0x5f3c68(0x20e),'validate':_0x21882c=>{const _0xedcbd8=_0x5f3c68;if(!_0x21882c||!_0x21882c['trim']())return _0xedcbd8(0x212);if(!/^[a-z0-9-]+$/[_0xedcbd8(0x248)](_0x21882c['trim']()))return _0xedcbd8(0x23f);return!![];}});if(!_0xc6cecd[_0x5f3c68(0x1e6)])return console[_0x5f3c68(0x20f)](_0x5f3c68(0x22c)),0x1;_0x5163d5=_0xc6cecd[_0x5f3c68(0x1e6)];}else _0x5163d5=_0x5a1fb8[_0x5f3c68(0x1f9)];const _0x2d94ab=resolveSite(_0x5163d5);console['log']('\x0aSetting\x20up\x20authentication\x20for\x20site:\x20'+_0x2d94ab),console[_0x5f3c68(0x20f)](_0x5f3c68(0x1f2)),console[_0x5f3c68(0x20f)]('\x20\x20'+getConsoleUrl(_0x2d94ab,'/app/mp/ak'));const _0x1f272d=await a23_0x777a10({'type':_0x5f3c68(0x1fb),'name':_0x5f3c68(0x1fa),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x1f3519=>{const _0x5220c9=_0x5f3c68;if(!_0x1f3519||!_0x1f3519['trim']())return _0x5220c9(0x211);return!![];}});if(!_0x1f272d[_0x5f3c68(0x1fa)])return console[_0x5f3c68(0x20f)](_0x5f3c68(0x22c)),0x1;const _0x56ab49=_0x1f272d[_0x5f3c68(0x1fa)];console[_0x5f3c68(0x20f)](_0x5f3c68(0x21c));try{const _0x930d1e=TDX[_0x5f3c68(0x232)]({'site':_0x2d94ab,'apiKey':_0x56ab49[_0x5f3c68(0x220)](),'logLevel':_0x3eaecc[_0x5f3c68(0x22a)]??LogLevel[_0x5f3c68(0x23d)]}),_0x393fe2=await _0x930d1e[_0x5f3c68(0x20a)]['getUserInfo']();console[_0x5f3c68(0x20f)](a23_0x145e57[_0x5f3c68(0x1e7)]('✓')+'\x20API\x20key\x20is\x20valid\x20(User:\x20'+_0x393fe2[_0x5f3c68(0x237)]+')');const _0x8a56ed=await isKeychainAvailable();_0x8a56ed?(await saveAPIKeyAsync(_0x56ab49[_0x5f3c68(0x220)](),_0x2d94ab,_0x49e8fd),console[_0x5f3c68(0x20f)](a23_0x145e57[_0x5f3c68(0x1e7)]('✓')+_0x5f3c68(0x246)+_0x49e8fd+')')):(console[_0x5f3c68(0x1f5)](a23_0x145e57[_0x5f3c68(0x1fc)]('⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.')),console[_0x5f3c68(0x1f5)](a23_0x145e57[_0x5f3c68(0x1fc)]('\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.')));const _0x1e2034={'site':_0x2d94ab,..._0x30b6d0&&{'description':_0x30b6d0}};return saveProfileToUserConfig(_0x49e8fd,_0x1e2034),console['log'](a23_0x145e57[_0x5f3c68(0x1e7)]('✓')+_0x5f3c68(0x224)+_0x49e8fd+_0x5f3c68(0x228)),console[_0x5f3c68(0x20f)](),console[_0x5f3c68(0x20f)]('You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:'),console[_0x5f3c68(0x20f)]('\x20\x20tdx\x20--profile\x20'+_0x49e8fd+_0x5f3c68(0x1ff)),console[_0x5f3c68(0x20f)](_0x5f3c68(0x229)+_0x49e8fd+_0x5f3c68(0x23a)),0x0;}catch(_0x3cf580){if(_0x3cf580 instanceof HTTPClientError&&_0x3cf580[_0x5f3c68(0x21f)]===0x191)return printAuthError(_0x3cf580),0x1;return console[_0x5f3c68(0x1ea)](a23_0x145e57[_0x5f3c68(0x24b)](_0x5f3c68(0x203)+(_0x3cf580 instanceof Error?_0x3cf580[_0x5f3c68(0x239)]:String(_0x3cf580)))),console[_0x5f3c68(0x1ea)](_0x5f3c68(0x1f8)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x1d8cf4(0x230)]=a23_0x1d8cf4(0x1ee);[a23_0x1d8cf4(0x247)]=a23_0x1d8cf4(0x22f);['validate'](_0x4adcb2){const _0x306382=a23_0x1d8cf4,{args:_0x22e91a}=_0x4adcb2;if(_0x22e91a[_0x306382(0x22d)]===0x0)return _0x306382(0x216);return undefined;}async['execute'](_0x544ff4){const _0x302b5c=a23_0x1d8cf4,{args:_0xcbec7e}=_0x544ff4,_0x346949=_0xcbec7e[0x0];console[_0x302b5c(0x20f)](a23_0x145e57[_0x302b5c(0x208)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x346949)){console['error'](a23_0x145e57[_0x302b5c(0x24b)](_0x302b5c(0x1f3)+_0x346949+_0x302b5c(0x1e8))),console[_0x302b5c(0x20f)](_0x302b5c(0x200));const _0x525b91=listProfiles();if(_0x525b91[_0x302b5c(0x22d)]===0x0)console[_0x302b5c(0x20f)]('\x20\x20(no\x20profiles\x20found)');else for(const _0x3aec8d of _0x525b91){console[_0x302b5c(0x20f)]('\x20\x20-\x20'+_0x3aec8d[_0x302b5c(0x230)]);}return 0x1;}const _0x111cd0=await a23_0x777a10({'type':_0x302b5c(0x1f4),'name':_0x302b5c(0x1f4),'message':_0x302b5c(0x233)+_0x346949+'\x27?','initial':![]});if(!_0x111cd0['confirm'])return console[_0x302b5c(0x20f)](_0x302b5c(0x240)),0x0;try{removeProfileFromUserConfig(_0x346949),console[_0x302b5c(0x20f)](a23_0x145e57[_0x302b5c(0x1e7)]('✓')+_0x302b5c(0x224)+_0x346949+_0x302b5c(0x207));}catch(_0x51b406){return console[_0x302b5c(0x1ea)](a23_0x145e57[_0x302b5c(0x24b)](_0x302b5c(0x243)+(_0x51b406 instanceof Error?_0x51b406[_0x302b5c(0x239)]:String(_0x51b406)))),0x1;}const _0x34c0f2=await isKeychainAvailable();if(_0x34c0f2){const _0x3c1a5c=await deleteKeychainAPIKey(_0x346949);_0x3c1a5c&&console['log'](a23_0x145e57[_0x302b5c(0x1e7)]('✓')+'\x20API\x20key\x20removed\x20from\x20system\x20keychain');}return 0x0;}}export class ProfileSetCommand extends BaseCommand{['name']=a23_0x1d8cf4(0x1fd);[a23_0x1d8cf4(0x247)]=a23_0x1d8cf4(0x24a);static [a23_0x1d8cf4(0x1ed)]=[a23_0x1d8cf4(0x1f9),a23_0x1d8cf4(0x206),a23_0x1d8cf4(0x1e9),a23_0x1d8cf4(0x202),a23_0x1d8cf4(0x24f),a23_0x1d8cf4(0x247)];[a23_0x1d8cf4(0x20b)](_0x5e542d){const _0x2dbb6f=a23_0x1d8cf4,{args:_0x10b118,options:_0x2725b7}=_0x5e542d,_0x367b92=_0x2725b7[_0x2dbb6f(0x1eb)]||getActiveProfile();if(!_0x367b92)return _0x2dbb6f(0x22b);if(_0x10b118[_0x2dbb6f(0x22d)]===0x0)return _0x2dbb6f(0x217)+ProfileSetCommand[_0x2dbb6f(0x1ed)]['join'](',\x20');const _0x4319a6=_0x10b118[0x0];if(!_0x4319a6[_0x2dbb6f(0x226)]('='))return _0x2dbb6f(0x210)+ProfileSetCommand['VALID_KEYS'][_0x2dbb6f(0x214)](',\x20');const [_0x404107]=_0x4319a6[_0x2dbb6f(0x234)]('=',0x2);if(!ProfileSetCommand[_0x2dbb6f(0x1ed)][_0x2dbb6f(0x226)](_0x404107))return _0x2dbb6f(0x21e)+_0x404107+_0x2dbb6f(0x225)+ProfileSetCommand[_0x2dbb6f(0x1ed)][_0x2dbb6f(0x214)](',\x20');return undefined;}async[a23_0x1d8cf4(0x219)](_0x48bbb7){const _0x25acb9=a23_0x1d8cf4,{args:_0x2339a2,options:_0x3aa1ea}=_0x48bbb7,_0x6affac=_0x3aa1ea[_0x25acb9(0x1eb)]||getActiveProfile(),[_0x4011e6,..._0xf4bf10]=_0x2339a2[0x0][_0x25acb9(0x234)]('='),_0x308722=_0xf4bf10[_0x25acb9(0x214)]('=');console[_0x25acb9(0x20f)](a23_0x145e57['bold'](_0x25acb9(0x238)));if(!profileExists(_0x6affac)){const _0xe1f6ee=await a23_0x777a10({'type':_0x25acb9(0x1f4),'name':_0x25acb9(0x232),'message':'Profile\x20\x27'+_0x6affac+'\x27\x20does\x20not\x20exist.\x20Create\x20it?','initial':!![]});if(!_0xe1f6ee[_0x25acb9(0x232)])return console[_0x25acb9(0x20f)]('Operation\x20cancelled'),0x1;}const _0x564daa=loadProfile(_0x6affac),_0x2c421b=_0x564daa?.[_0x25acb9(0x244)]||{};if(_0x4011e6===_0x25acb9(0x1f9)){const _0x430d5f=resolveSite(_0x308722);console[_0x25acb9(0x20f)](_0x25acb9(0x21b)+_0x430d5f+_0x25acb9(0x22e)),console[_0x25acb9(0x20f)](_0x25acb9(0x235)),console[_0x25acb9(0x20f)]('\x20\x20'+getConsoleUrl(_0x430d5f,_0x25acb9(0x23b)));const _0x998517=await a23_0x777a10({'type':_0x25acb9(0x1fb),'name':_0x25acb9(0x1fa),'message':_0x25acb9(0x20c),'validate':_0x30d5d4=>{const _0x293f62=_0x25acb9;if(!_0x30d5d4||!_0x30d5d4[_0x293f62(0x220)]())return _0x293f62(0x211);return!![];}});if(!_0x998517['apiKey'])return console[_0x25acb9(0x20f)]('\x0aOperation\x20cancelled'),0x1;console['log'](_0x25acb9(0x21c));try{const _0xbb27bf=TDX[_0x25acb9(0x232)]({'site':_0x430d5f,'apiKey':_0x998517[_0x25acb9(0x1fa)][_0x25acb9(0x220)](),'logLevel':_0x3aa1ea[_0x25acb9(0x22a)]??LogLevel['ERROR']}),_0x4d3d71=await _0xbb27bf[_0x25acb9(0x20a)]['getUserInfo']();console[_0x25acb9(0x20f)](a23_0x145e57[_0x25acb9(0x1e7)]('✓')+_0x25acb9(0x23c)+_0x4d3d71[_0x25acb9(0x237)]+')');const _0x3d8153=await isKeychainAvailable();_0x3d8153?(await saveAPIKeyAsync(_0x998517[_0x25acb9(0x1fa)][_0x25acb9(0x220)](),_0x430d5f,_0x6affac),console[_0x25acb9(0x20f)](a23_0x145e57['green']('✓')+'\x20API\x20key\x20saved\x20to\x20system\x20keychain')):console[_0x25acb9(0x1f5)](a23_0x145e57[_0x25acb9(0x1fc)](_0x25acb9(0x213))),_0x2c421b['site']=_0x430d5f;}catch(_0x1c1ce9){if(_0x1c1ce9 instanceof HTTPClientError&&_0x1c1ce9[_0x25acb9(0x21f)]===0x191)return printAuthError(_0x1c1ce9),0x1;return console['error'](a23_0x145e57['red'](_0x25acb9(0x203)+(_0x1c1ce9 instanceof Error?_0x1c1ce9[_0x25acb9(0x239)]:String(_0x1c1ce9)))),console[_0x25acb9(0x1ea)](_0x25acb9(0x221)),0x1;}}else _0x2c421b[_0x4011e6]=_0x308722||undefined;return saveProfileToUserConfig(_0x6affac,_0x2c421b),console[_0x25acb9(0x20f)](a23_0x145e57[_0x25acb9(0x1e7)]('✓')+_0x25acb9(0x224)+_0x6affac+'\x27\x20updated:\x20'+_0x4011e6+'='+(_0x308722||'(cleared)')),0x0;}}function a23_0x3bd5(){const _0x5aae3e=['\x20--default\x27\x20to\x20save\x20permanently','\x27\x20created','\x20\x20tdx\x20--profile\x20','logLevel','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','\x0aSetup\x20cancelled','length','\x27\x20requires\x20API\x20key\x20validation.','Remove\x20a\x20profile','name','profileName','create','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','split','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','profile:use','email','tdx:\x20profile\x20set','message','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','/app/mp/ak','\x20API\x20key\x20is\x20valid\x20(User:\x20','ERROR','Enter\x20profile\x20name:','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','Removal\x20cancelled','text','3168824MHlfEh','Failed\x20to\x20remove\x20profile:\x20','config','select','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','description','test','66ksxRPR','Set\x20a\x20profile\x20configuration\x20value','red','dim','7441986VpIQXi','770007jKwVWv','llm_agent','customSite','green','\x27\x20does\x20not\x20exist.','parent_segment','error','profile','Create\x20a\x20new\x20profile','VALID_KEYS','profile:remove','Enter\x20site\x20name:','452445VJSrPW','default','You\x20can\x20find\x20your\x20API\x20key\x20at:','Profile\x20\x27','confirm','warn','2507388cILWxg','other','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','site','apiKey','password','yellow','profile:set','(session:\x20','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','\x0aAvailable\x20profiles:','20123wJCXpG','llm_project','✗\x20Validation\x20failed:\x20','14LEijpc','25000857GBMtWm','database','\x27\x20removed\x20from\x20configuration','bold','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','jobs','validate','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','profile:create','us01','log','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','API\x20key\x20cannot\x20be\x20empty','Site\x20name\x20cannot\x20be\x20empty','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','join','tdx:\x20profile\x20create','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Default\x20profile\x20set\x20to:\x20','execute','\x20\x20(no\x20profiles\x20found)','Changing\x20site\x20to\x20\x27','Validating\x20API\x20key...','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','Unknown\x20key\x20\x27','status','trim','Site\x20was\x20not\x20changed.','Set\x20session\x20profile','session','\x20Profile\x20\x27','\x27.\x0a\x0aValid\x20keys:\x20','includes'];a23_0x3bd5=function(){return _0x5aae3e;};return a23_0x3bd5();}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x1d8cf4(0x236);['description']=a23_0x1d8cf4(0x222);['validate'](_0x62ef4c){const _0x3a548c=a23_0x1d8cf4,{args:_0xdb0247}=_0x62ef4c;if(_0xdb0247[_0x3a548c(0x22d)]===0x0)return _0x3a548c(0x209);return undefined;}async[a23_0x1d8cf4(0x219)](_0x59d1ca){const _0x6f99d2=a23_0x1d8cf4,{args:_0x374eeb,options:_0x544264}=_0x59d1ca,_0x4cd707=_0x374eeb[0x0],_0x2d708e=_0x544264[_0x6f99d2(0x1f1)];cleanExpiredSessions();if(!profileExists(_0x4cd707)){console[_0x6f99d2(0x1ea)](a23_0x145e57[_0x6f99d2(0x24b)](_0x6f99d2(0x1f3)+_0x4cd707+'\x27\x20does\x20not\x20exist.')),console[_0x6f99d2(0x20f)](_0x6f99d2(0x200));const _0x4c854d=listProfiles();if(_0x4c854d['length']===0x0)console['log'](_0x6f99d2(0x21a));else for(const _0x40088f of _0x4c854d){console['log']('\x20\x20-\x20'+_0x40088f[_0x6f99d2(0x230)]);}return 0x1;}if(_0x2d708e){const _0x28de85=a23_0xd21185[_0x6f99d2(0x214)](getConfigDir(),'tdx.json');return saveActiveProfileToUserConfig(_0x4cd707),console[_0x6f99d2(0x20f)](_0x6f99d2(0x218)+a23_0x145e57[_0x6f99d2(0x1e7)](_0x4cd707)),console[_0x6f99d2(0x20f)](a23_0x145e57[_0x6f99d2(0x24c)]('\x0aSaved\x20to:\x20'+_0x28de85)),0x0;}const _0x285f32=getSessionID(_0x544264[_0x6f99d2(0x223)]);return saveSessionContext({'profile':_0x4cd707},_0x544264['session']),console[_0x6f99d2(0x20f)]('Session\x20profile\x20set\x20to:\x20'+a23_0x145e57[_0x6f99d2(0x1e7)](_0x4cd707)+'\x20'+a23_0x145e57[_0x6f99d2(0x24c)](_0x6f99d2(0x1fe)+_0x285f32+')')),console[_0x6f99d2(0x20f)](a23_0x145e57[_0x6f99d2(0x24c)]('\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20'+_0x4cd707+_0x6f99d2(0x227))),0x0;}}
1
+ const a23_0x1b2570=a23_0x4150;(function(_0x59c86c,_0xa40a4f){const _0x406f95=a23_0x4150,_0x80edcd=_0x59c86c();while(!![]){try{const _0x37edf9=parseInt(_0x406f95(0x1fb))/0x1+parseInt(_0x406f95(0x1d2))/0x2*(parseInt(_0x406f95(0x1e3))/0x3)+-parseInt(_0x406f95(0x1da))/0x4+parseInt(_0x406f95(0x205))/0x5+-parseInt(_0x406f95(0x1fe))/0x6*(parseInt(_0x406f95(0x1f5))/0x7)+parseInt(_0x406f95(0x1f3))/0x8*(parseInt(_0x406f95(0x1fd))/0x9)+-parseInt(_0x406f95(0x202))/0xa*(parseInt(_0x406f95(0x214))/0xb);if(_0x37edf9===_0xa40a4f)break;else _0x80edcd['push'](_0x80edcd['shift']());}catch(_0x3db79b){_0x80edcd['push'](_0x80edcd['shift']());}}}(a23_0x16f2,0xd98c0));import{BaseCommand,printAuthError}from'./command.js';import{listProfiles,profileExists,saveProfileToUserConfig,removeProfileFromUserConfig,loadProfile,getActiveProfile,saveActiveProfileToUserConfig}from'../core/profile.js';import{getConfigDir}from'../core/config.js';import*as a23_0x279074 from'node:path';import{saveSessionContext,getSessionID,cleanExpiredSessions}from'../core/session.js';import{saveAPIKeyAsync,resolveSite}from'../core/config.js';import{getConsoleUrl}from'../sdk/client/endpoints.js';import{deleteKeychainAPIKey,isKeychainAvailable}from'../core/keychain.js';import{buildSiteChoices}from'../core/constants.js';import{HTTPClientError}from'../sdk/client/http-client.js';function a23_0x4150(_0xa468f9,_0x54a47e){_0xa468f9=_0xa468f9-0x1b0;const _0x16f278=a23_0x16f2();let _0x415054=_0x16f278[_0xa468f9];return _0x415054;}import{TDX}from'../sdk/index.js';import{LogLevel}from'../utils/tdx-logger.js';import a23_0x329b36 from'prompts';import a23_0x14a500 from'chalk';function validateProfileName(_0x5b2ed5){const _0x1f8d1c=a23_0x4150;if(!_0x5b2ed5||!_0x5b2ed5[_0x1f8d1c(0x1ce)]())return'Profile\x20name\x20cannot\x20be\x20empty';const _0x47d7c8=_0x5b2ed5[_0x1f8d1c(0x1ce)]();if(!/^[a-zA-Z0-9_-]+$/[_0x1f8d1c(0x1db)](_0x47d7c8))return _0x1f8d1c(0x1e9);if(profileExists(_0x47d7c8))return _0x1f8d1c(0x1f8)+_0x47d7c8+_0x1f8d1c(0x1d1);return!![];}function a23_0x16f2(){const _0x51b9b3=['Enter\x20description\x20(optional):','us01','\x27\x20does\x20not\x20exist.','parent_segment','8OawwOP','create','2863eFQEoI','\x27\x20does\x20not\x20exist.\x20Create\x20it?','\x0aSetting\x20up\x20authentication\x20for\x20site:\x20','Profile\x20\x27','\x27\x20created','Select\x20Treasure\x20Data\x20site\x20for\x20profile\x20\x27','1463790ELiqOK','\x27.\x0a\x0aValid\x20keys:\x20','5555538AJgPAF','16962GTlokq','email','Are\x20you\x20sure\x20you\x20want\x20to\x20remove\x20profile\x20\x27','\x20\x20tdx\x20--profile\x20','2230kaTOqI','jobs','error','7611945tHnNNw','Profile\x20was\x20not\x20created.\x20Please\x20try\x20again.','\x20auth\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20Verify\x20authentication','VALID_KEYS','profile','\x0aSaved\x20to:\x20','No\x20active\x20profile.\x20Use\x20--profile\x20flag\x20or\x20set\x20session\x20profile\x20with:\x20tdx\x20profile\x20use\x20<name>\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>','Session\x20profile\x20set\x20to:\x20','\x20API\x20key\x20is\x20valid\x20(User:\x20','\x20Profile\x20\x27','session','name','Key=value\x20pair\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','green','Removal\x20cancelled','121528uDXCQN','\x27\x20updated:\x20','ERROR','⚠\x20System\x20keychain\x20not\x20available.\x20API\x20key\x20not\x20saved.','\x20API\x20key\x20removed\x20from\x20system\x20keychain','status','\x20databases\x20\x20\x20\x20\x20-\x20List\x20databases','You\x20can\x20now\x20use\x20tdx\x20commands\x20with\x20this\x20profile.\x20Try:','Enter\x20profile\x20name:','config','description','\x20API\x20key\x20saved\x20to\x20system\x20keychain\x20(profile:\x20','tdx:\x20profile\x20create','\x20\x20(no\x20profiles\x20found)','\x20\x20Set\x20TDX_API_KEY\x20environment\x20variable\x20for\x20authentication.','message','\x0aYou\x20can\x20find\x20your\x20API\x20key\x20at:','confirm','execute','dim','\x27\x20removed\x20from\x20configuration','getUserInfo','Site\x20name\x20cannot\x20be\x20empty','\x0aOperation\x20cancelled','Create\x20a\x20new\x20profile','profileName','llm_agent','\x0aSetup\x20cancelled','red','tdx.json','site','customSite','Set\x20a\x20profile\x20configuration\x20value','/app/mp/ak','length','\x0aTip:\x20Use\x20\x27tdx\x20profile\x20use\x20','API\x20key\x20cannot\x20be\x20empty','Enter\x20site\x20name:','trim','yellow','bold','\x27\x20already\x20exists.\x20Use\x20\x27tdx\x20profile\x20set\x27\x20to\x20modify\x20it.','3365468kxtnvl','apiKey','\x20\x20-\x20','Enter\x20your\x20TD\x20API\x20key\x20for\x20the\x20new\x20site:','\x20API\x20key\x20saved\x20to\x20system\x20keychain','default','Site\x20name\x20must\x20contain\x20only\x20lowercase\x20letters,\x20numbers,\x20and\x20hyphens','text','3100704nOCvSb','test','logLevel','Operation\x20cancelled','profile:use','llm_project','Set\x20session\x20profile','database','\x20--default\x27\x20to\x20save\x20permanently','3RvLFUs','warn','select','tdx:\x20profile\x20set','profile:set','Invalid\x20format.\x20Use:\x20tdx\x20profile\x20set\x20[--profile\x20<name>]\x20<key>=<value>\x0a\x0aValid\x20keys:\x20','Profile\x20name\x20must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore','✗\x20Validation\x20failed:\x20','validate','Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20use\x20<name>\x20[--default]','log','join'];a23_0x16f2=function(){return _0x51b9b3;};return a23_0x16f2();}export class ProfileCreateCommand extends BaseCommand{[a23_0x1b2570(0x210)]='profile:create';[a23_0x1b2570(0x1b2)]=a23_0x1b2570(0x1c0);async[a23_0x1b2570(0x1ba)](_0x5d6f05){const _0x3fe039=a23_0x1b2570,{options:_0x4eb08e,args:_0x1cda52}=_0x5d6f05;console[_0x3fe039(0x1ed)](a23_0x14a500[_0x3fe039(0x1d0)](_0x3fe039(0x1b4)));let _0x298540;if(_0x1cda52[_0x3fe039(0x1ca)]>0x0&&_0x1cda52[0x0]){const _0x25c7ac=_0x1cda52[0x0][_0x3fe039(0x1ce)](),_0x54003=validateProfileName(_0x25c7ac);if(_0x54003!==!![])return console[_0x3fe039(0x204)](a23_0x14a500[_0x3fe039(0x1c4)](_0x54003)),0x1;_0x298540=_0x25c7ac;}else{const _0x34a8b1=await a23_0x329b36({'type':_0x3fe039(0x1d9),'name':_0x3fe039(0x1c1),'message':_0x3fe039(0x1b0),'validate':validateProfileName});if(!_0x34a8b1[_0x3fe039(0x1c1)])return console[_0x3fe039(0x1ed)](_0x3fe039(0x1c3)),0x1;_0x298540=_0x34a8b1[_0x3fe039(0x1c1)][_0x3fe039(0x1ce)]();}const _0xd5eec9=await a23_0x329b36({'type':_0x3fe039(0x1d9),'name':_0x3fe039(0x1b2),'message':_0x3fe039(0x1ef)}),_0xe98187=_0xd5eec9['description']?.[_0x3fe039(0x1ce)]()||undefined,_0x4f2580=_0x4eb08e['site']||_0x3fe039(0x1f0),{choices:_0x5f4122,initialIndex:_0x1f7440}=buildSiteChoices(_0x4f2580),_0x137a6e=await a23_0x329b36({'type':_0x3fe039(0x1e5),'name':'site','message':_0x3fe039(0x1fa)+_0x298540+'\x27:','choices':_0x5f4122,'initial':_0x1f7440});if(!_0x137a6e[_0x3fe039(0x1c6)])return console[_0x3fe039(0x1ed)](_0x3fe039(0x1c3)),0x1;let _0x2215ff;if(_0x137a6e[_0x3fe039(0x1c6)]==='other'){const _0x1c3c0a=await a23_0x329b36({'type':_0x3fe039(0x1d9),'name':_0x3fe039(0x1c7),'message':_0x3fe039(0x1cd),'initial':_0x3fe039(0x1f0),'validate':_0xaab445=>{const _0xf72fb7=_0x3fe039;if(!_0xaab445||!_0xaab445[_0xf72fb7(0x1ce)]())return _0xf72fb7(0x1be);if(!/^[a-z0-9-]+$/[_0xf72fb7(0x1db)](_0xaab445['trim']()))return _0xf72fb7(0x1d8);return!![];}});if(!_0x1c3c0a[_0x3fe039(0x1c7)])return console[_0x3fe039(0x1ed)](_0x3fe039(0x1c3)),0x1;_0x2215ff=_0x1c3c0a[_0x3fe039(0x1c7)];}else _0x2215ff=_0x137a6e[_0x3fe039(0x1c6)];const _0x15ff53=resolveSite(_0x2215ff);console[_0x3fe039(0x1ed)](_0x3fe039(0x1f7)+_0x15ff53),console['log']('You\x20can\x20find\x20your\x20API\x20key\x20at:'),console[_0x3fe039(0x1ed)]('\x20\x20'+getConsoleUrl(_0x15ff53,_0x3fe039(0x1c9)));const _0x1a7d09=await a23_0x329b36({'type':'password','name':_0x3fe039(0x1d3),'message':'Enter\x20your\x20TD\x20API\x20key:','validate':_0x5a7089=>{const _0x464a59=_0x3fe039;if(!_0x5a7089||!_0x5a7089[_0x464a59(0x1ce)]())return _0x464a59(0x1cc);return!![];}});if(!_0x1a7d09[_0x3fe039(0x1d3)])return console['log'](_0x3fe039(0x1c3)),0x1;const _0x173901=_0x1a7d09[_0x3fe039(0x1d3)];console[_0x3fe039(0x1ed)]('Validating\x20API\x20key...');try{const _0x26db5a=TDX[_0x3fe039(0x1f4)]({'site':_0x15ff53,'apiKey':_0x173901[_0x3fe039(0x1ce)](),'logLevel':_0x4eb08e[_0x3fe039(0x1dc)]??LogLevel[_0x3fe039(0x216)]}),_0x472f7b=await _0x26db5a[_0x3fe039(0x203)][_0x3fe039(0x1bd)]();console[_0x3fe039(0x1ed)](a23_0x14a500[_0x3fe039(0x212)]('✓')+_0x3fe039(0x20d)+_0x472f7b[_0x3fe039(0x1ff)]+')');const _0x152f82=await isKeychainAvailable();_0x152f82?(await saveAPIKeyAsync(_0x173901[_0x3fe039(0x1ce)](),_0x15ff53,_0x298540),console['log'](a23_0x14a500[_0x3fe039(0x212)]('✓')+_0x3fe039(0x1b3)+_0x298540+')')):(console[_0x3fe039(0x1e4)](a23_0x14a500[_0x3fe039(0x1cf)](_0x3fe039(0x217))),console[_0x3fe039(0x1e4)](a23_0x14a500[_0x3fe039(0x1cf)](_0x3fe039(0x1b6))));const _0x3d796f={'site':_0x15ff53,..._0xe98187&&{'description':_0xe98187}};return saveProfileToUserConfig(_0x298540,_0x3d796f),console[_0x3fe039(0x1ed)](a23_0x14a500[_0x3fe039(0x212)]('✓')+_0x3fe039(0x20e)+_0x298540+_0x3fe039(0x1f9)),console['log'](),console[_0x3fe039(0x1ed)](_0x3fe039(0x21b)),console[_0x3fe039(0x1ed)](_0x3fe039(0x201)+_0x298540+_0x3fe039(0x207)),console['log']('\x20\x20tdx\x20--profile\x20'+_0x298540+_0x3fe039(0x21a)),0x0;}catch(_0x3454b8){if(_0x3454b8 instanceof HTTPClientError&&_0x3454b8[_0x3fe039(0x219)]===0x191)return printAuthError(_0x3454b8),0x1;return console[_0x3fe039(0x204)](a23_0x14a500[_0x3fe039(0x1c4)]('✗\x20Validation\x20failed:\x20'+(_0x3454b8 instanceof Error?_0x3454b8['message']:String(_0x3454b8)))),console[_0x3fe039(0x204)](_0x3fe039(0x206)),0x1;}}}export class ProfileRemoveCommand extends BaseCommand{[a23_0x1b2570(0x210)]='profile:remove';[a23_0x1b2570(0x1b2)]='Remove\x20a\x20profile';[a23_0x1b2570(0x1eb)](_0xeb3bd9){const {args:_0x4de96a}=_0xeb3bd9;if(_0x4de96a['length']===0x0)return'Profile\x20name\x20is\x20required.\x0a\x0aUsage:\x20tdx\x20profile\x20remove\x20<name>';return undefined;}async[a23_0x1b2570(0x1ba)](_0x3b9402){const _0x5bf2e4=a23_0x1b2570,{args:_0x37e056}=_0x3b9402,_0x5a48bd=_0x37e056[0x0];console['log'](a23_0x14a500[_0x5bf2e4(0x1d0)]('tdx:\x20profile\x20remove'));if(!profileExists(_0x5a48bd)){console['error'](a23_0x14a500['red'](_0x5bf2e4(0x1f8)+_0x5a48bd+_0x5bf2e4(0x1f1))),console[_0x5bf2e4(0x1ed)]('\x0aAvailable\x20profiles:');const _0x1e7417=listProfiles();if(_0x1e7417['length']===0x0)console[_0x5bf2e4(0x1ed)](_0x5bf2e4(0x1b5));else for(const _0x40ff8b of _0x1e7417){console[_0x5bf2e4(0x1ed)](_0x5bf2e4(0x1d4)+_0x40ff8b[_0x5bf2e4(0x210)]);}return 0x1;}const _0x1ec981=await a23_0x329b36({'type':'confirm','name':_0x5bf2e4(0x1b9),'message':_0x5bf2e4(0x200)+_0x5a48bd+'\x27?','initial':![]});if(!_0x1ec981[_0x5bf2e4(0x1b9)])return console[_0x5bf2e4(0x1ed)](_0x5bf2e4(0x213)),0x0;try{removeProfileFromUserConfig(_0x5a48bd),console[_0x5bf2e4(0x1ed)](a23_0x14a500[_0x5bf2e4(0x212)]('✓')+_0x5bf2e4(0x20e)+_0x5a48bd+_0x5bf2e4(0x1bc));}catch(_0x3f9e21){return console['error'](a23_0x14a500[_0x5bf2e4(0x1c4)]('Failed\x20to\x20remove\x20profile:\x20'+(_0x3f9e21 instanceof Error?_0x3f9e21['message']:String(_0x3f9e21)))),0x1;}const _0x4f50ac=await isKeychainAvailable();if(_0x4f50ac){const _0x50e91c=await deleteKeychainAPIKey(_0x5a48bd);_0x50e91c&&console[_0x5bf2e4(0x1ed)](a23_0x14a500[_0x5bf2e4(0x212)]('✓')+_0x5bf2e4(0x218));}return 0x0;}}export class ProfileSetCommand extends BaseCommand{[a23_0x1b2570(0x210)]=a23_0x1b2570(0x1e7);['description']=a23_0x1b2570(0x1c8);static ['VALID_KEYS']=[a23_0x1b2570(0x1c6),a23_0x1b2570(0x1e1),a23_0x1b2570(0x1f2),a23_0x1b2570(0x1df),a23_0x1b2570(0x1c2),a23_0x1b2570(0x1b2)];[a23_0x1b2570(0x1eb)](_0x45790d){const _0x3767df=a23_0x1b2570,{args:_0x4b92c5,options:_0x3f2e9f}=_0x45790d,_0x17ca21=_0x3f2e9f['profile']||getActiveProfile();if(!_0x17ca21)return _0x3767df(0x20b);if(_0x4b92c5[_0x3767df(0x1ca)]===0x0)return _0x3767df(0x211)+ProfileSetCommand['VALID_KEYS'][_0x3767df(0x1ee)](',\x20');const _0x530d2c=_0x4b92c5[0x0];if(!_0x530d2c['includes']('='))return _0x3767df(0x1e8)+ProfileSetCommand['VALID_KEYS'][_0x3767df(0x1ee)](',\x20');const [_0x2e9c5c]=_0x530d2c['split']('=',0x2);if(!ProfileSetCommand[_0x3767df(0x208)]['includes'](_0x2e9c5c))return'Unknown\x20key\x20\x27'+_0x2e9c5c+_0x3767df(0x1fc)+ProfileSetCommand[_0x3767df(0x208)][_0x3767df(0x1ee)](',\x20');return undefined;}async[a23_0x1b2570(0x1ba)](_0x384bdc){const _0x30cf54=a23_0x1b2570,{args:_0x2d20b9,options:_0x43df88}=_0x384bdc,_0x33ce07=_0x43df88[_0x30cf54(0x209)]||getActiveProfile(),[_0x2777a4,..._0x5e7725]=_0x2d20b9[0x0]['split']('='),_0x1c0878=_0x5e7725['join']('=');console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x1d0)](_0x30cf54(0x1e6)));if(!profileExists(_0x33ce07)){const _0x4cc80e=await a23_0x329b36({'type':'confirm','name':_0x30cf54(0x1f4),'message':_0x30cf54(0x1f8)+_0x33ce07+_0x30cf54(0x1f6),'initial':!![]});if(!_0x4cc80e[_0x30cf54(0x1f4)])return console[_0x30cf54(0x1ed)](_0x30cf54(0x1dd)),0x1;}const _0x1a4ec0=loadProfile(_0x33ce07),_0x40e920=_0x1a4ec0?.[_0x30cf54(0x1b1)]||{};if(_0x2777a4===_0x30cf54(0x1c6)){const _0x5ed9c2=resolveSite(_0x1c0878);console[_0x30cf54(0x1ed)]('Changing\x20site\x20to\x20\x27'+_0x5ed9c2+'\x27\x20requires\x20API\x20key\x20validation.'),console[_0x30cf54(0x1ed)](_0x30cf54(0x1b8)),console[_0x30cf54(0x1ed)]('\x20\x20'+getConsoleUrl(_0x5ed9c2,_0x30cf54(0x1c9)));const _0x4150ef=await a23_0x329b36({'type':'password','name':_0x30cf54(0x1d3),'message':_0x30cf54(0x1d5),'validate':_0x57e9f3=>{const _0x138217=_0x30cf54;if(!_0x57e9f3||!_0x57e9f3[_0x138217(0x1ce)]())return'API\x20key\x20cannot\x20be\x20empty';return!![];}});if(!_0x4150ef['apiKey'])return console[_0x30cf54(0x1ed)](_0x30cf54(0x1bf)),0x1;console[_0x30cf54(0x1ed)]('Validating\x20API\x20key...');try{const _0x2858d7=TDX[_0x30cf54(0x1f4)]({'site':_0x5ed9c2,'apiKey':_0x4150ef[_0x30cf54(0x1d3)]['trim'](),'logLevel':_0x43df88[_0x30cf54(0x1dc)]??LogLevel[_0x30cf54(0x216)]}),_0x54e119=await _0x2858d7['jobs']['getUserInfo']();console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x212)]('✓')+_0x30cf54(0x20d)+_0x54e119[_0x30cf54(0x1ff)]+')');const _0x607e11=await isKeychainAvailable();_0x607e11?(await saveAPIKeyAsync(_0x4150ef[_0x30cf54(0x1d3)]['trim'](),_0x5ed9c2,_0x33ce07),console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x212)]('✓')+_0x30cf54(0x1d6))):console['warn'](a23_0x14a500['yellow'](_0x30cf54(0x217))),_0x40e920[_0x30cf54(0x1c6)]=_0x5ed9c2;}catch(_0x5ec8b4){if(_0x5ec8b4 instanceof HTTPClientError&&_0x5ec8b4['status']===0x191)return printAuthError(_0x5ec8b4),0x1;return console[_0x30cf54(0x204)](a23_0x14a500[_0x30cf54(0x1c4)](_0x30cf54(0x1ea)+(_0x5ec8b4 instanceof Error?_0x5ec8b4[_0x30cf54(0x1b7)]:String(_0x5ec8b4)))),console[_0x30cf54(0x204)]('Site\x20was\x20not\x20changed.'),0x1;}}else _0x40e920[_0x2777a4]=_0x1c0878||undefined;return saveProfileToUserConfig(_0x33ce07,_0x40e920),console[_0x30cf54(0x1ed)](a23_0x14a500[_0x30cf54(0x212)]('✓')+'\x20Profile\x20\x27'+_0x33ce07+_0x30cf54(0x215)+_0x2777a4+'='+(_0x1c0878||'(cleared)')),0x0;}}export class ProfileUseCommand extends BaseCommand{['name']=a23_0x1b2570(0x1de);[a23_0x1b2570(0x1b2)]=a23_0x1b2570(0x1e0);[a23_0x1b2570(0x1eb)](_0x1ce0fe){const _0x84b31e=a23_0x1b2570,{args:_0x4a9317}=_0x1ce0fe;if(_0x4a9317[_0x84b31e(0x1ca)]===0x0)return _0x84b31e(0x1ec);return undefined;}async[a23_0x1b2570(0x1ba)](_0x43e838){const _0x2947ce=a23_0x1b2570,{args:_0x579771,options:_0x48a6e8}=_0x43e838,_0x472241=_0x579771[0x0],_0xd4f8e1=_0x48a6e8[_0x2947ce(0x1d7)];cleanExpiredSessions();if(!profileExists(_0x472241)){console[_0x2947ce(0x204)](a23_0x14a500['red']('Profile\x20\x27'+_0x472241+_0x2947ce(0x1f1))),console['log']('\x0aAvailable\x20profiles:');const _0xbf90e2=listProfiles();if(_0xbf90e2[_0x2947ce(0x1ca)]===0x0)console['log']('\x20\x20(no\x20profiles\x20found)');else for(const _0x31eddb of _0xbf90e2){console['log'](_0x2947ce(0x1d4)+_0x31eddb[_0x2947ce(0x210)]);}return 0x1;}if(_0xd4f8e1){const _0x18b74b=a23_0x279074[_0x2947ce(0x1ee)](getConfigDir(),_0x2947ce(0x1c5));return saveActiveProfileToUserConfig(_0x472241),console[_0x2947ce(0x1ed)]('Default\x20profile\x20set\x20to:\x20'+a23_0x14a500[_0x2947ce(0x212)](_0x472241)),console[_0x2947ce(0x1ed)](a23_0x14a500['dim'](_0x2947ce(0x20a)+_0x18b74b)),0x0;}const _0x5aa3c8=getSessionID(_0x48a6e8[_0x2947ce(0x20f)]);return saveSessionContext({'profile':_0x472241},_0x48a6e8[_0x2947ce(0x20f)]),console['log'](_0x2947ce(0x20c)+a23_0x14a500[_0x2947ce(0x212)](_0x472241)+'\x20'+a23_0x14a500['dim']('(session:\x20'+_0x5aa3c8+')')),console['log'](a23_0x14a500[_0x2947ce(0x1bb)](_0x2947ce(0x1cb)+_0x472241+_0x2947ce(0x1e2))),0x0;}}
@@ -1 +1 @@
1
- function a24_0x38fb(_0x367c7c,_0x6b67e){_0x367c7c=_0x367c7c-0x19c;const _0x3f35de=a24_0x3f35();let _0x38fb9e=_0x3f35de[_0x367c7c];return _0x38fb9e;}const a24_0x38f286=a24_0x38fb;(function(_0x2199b2,_0xc18c4a){const _0x530e23=a24_0x38fb,_0x2ace9b=_0x2199b2();while(!![]){try{const _0x4d3b55=parseInt(_0x530e23(0x1a2))/0x1+-parseInt(_0x530e23(0x1aa))/0x2+parseInt(_0x530e23(0x19d))/0x3+parseInt(_0x530e23(0x1a3))/0x4+-parseInt(_0x530e23(0x19e))/0x5+-parseInt(_0x530e23(0x1a9))/0x6+-parseInt(_0x530e23(0x1a7))/0x7*(-parseInt(_0x530e23(0x1a5))/0x8);if(_0x4d3b55===_0xc18c4a)break;else _0x2ace9b['push'](_0x2ace9b['shift']());}catch(_0x151714){_0x2ace9b['push'](_0x2ace9b['shift']());}}}(a24_0x3f35,0xaae2b));import{BaseCommand}from'./command.js';function a24_0x3f35(){const _0x117696=['name','profiles','execute','scope','log','Error:\x20','2753097jycgyY','4704485FpatXH','message','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','\x20\x20Global:\x20~/.config/tdx/tdx.json','1077689PbxwIu','1030376LZbEiY','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','4259536twRtwC','List\x20all\x20available\x20profiles','7fEyoAX','error','5758368gduLxd','369704SkkjJu','length'];a24_0x3f35=function(){return _0x117696;};return a24_0x3f35();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x38f286(0x1ac)]=a24_0x38f286(0x1ad);['description']=a24_0x38f286(0x1a6);async[a24_0x38f286(0x1ae)](_0x52d0ad){const _0x19ce17=a24_0x38f286,{options:_0x5956a4}=_0x52d0ad;try{const _0x187ba9=listProfiles(),_0x592dd8=getActiveProfile();if(_0x187ba9[_0x19ce17(0x1ab)]===0x0)return console[_0x19ce17(0x1b0)](_0x19ce17(0x1a4)),console['log'](_0x19ce17(0x1a0)),console[_0x19ce17(0x1b0)](_0x19ce17(0x1a1)),0x0;const _0x29be7a=_0x187ba9['map'](_0x336b68=>{const _0x3ec999=_0x19ce17,_0x1c367a=_0x336b68[_0x3ec999(0x1ac)]===_0x592dd8,_0x2df803=getProfileParams(_0x336b68['config']);return{'name':_0x336b68[_0x3ec999(0x1ac)],'active':_0x1c367a,'scope':_0x336b68[_0x3ec999(0x1af)],'description':_0x336b68['config']['description']||'','params':_0x2df803};});return await handleSDKOutput(_0x29be7a,_0x5956a4),0x0;}catch(_0x39ad92){return _0x39ad92 instanceof Error&&console[_0x19ce17(0x1a8)](_0x19ce17(0x19c)+_0x39ad92[_0x19ce17(0x19f)]),0x1;}}}
1
+ const a24_0x3611cd=a24_0x2765;(function(_0xbf08f8,_0x5e47ae){const _0xe54207=a24_0x2765,_0x2e754b=_0xbf08f8();while(!![]){try{const _0x20edde=parseInt(_0xe54207(0x14b))/0x1*(-parseInt(_0xe54207(0x140))/0x2)+-parseInt(_0xe54207(0x141))/0x3+parseInt(_0xe54207(0x147))/0x4*(-parseInt(_0xe54207(0x150))/0x5)+-parseInt(_0xe54207(0x145))/0x6+parseInt(_0xe54207(0x153))/0x7*(parseInt(_0xe54207(0x151))/0x8)+-parseInt(_0xe54207(0x14e))/0x9+parseInt(_0xe54207(0x142))/0xa*(parseInt(_0xe54207(0x144))/0xb);if(_0x20edde===_0x5e47ae)break;else _0x2e754b['push'](_0x2e754b['shift']());}catch(_0x350d67){_0x2e754b['push'](_0x2e754b['shift']());}}}(a24_0x30d7,0x28584));function a24_0x2765(_0x50abee,_0x535f0a){_0x50abee=_0x50abee-0x13e;const _0x30d7ae=a24_0x30d7();let _0x27653f=_0x30d7ae[_0x50abee];return _0x27653f;}import{BaseCommand}from'./command.js';function a24_0x30d7(){const _0x50727d=['length','message','116079CWmxcj','No\x20profiles\x20found.\x20Define\x20profiles\x20in\x20tdx.json:\x0a','description','290142LhkTNf','config','3595szGFIu','8iLGdsx','\x20\x20Local:\x20\x20(project\x20folder)/tdx.json','299159LNhgZy','scope','Error:\x20','log','name','2bthseQ','91467uUcMcu','5394990lvkGlE','execute','11xpiDRV','18390ScLfRv','profiles','1308tDVBWb','map'];a24_0x30d7=function(){return _0x50727d;};return a24_0x30d7();}import{listProfiles,getActiveProfile,getProfileParams}from'../core/profile.js';import{handleSDKOutput}from'../core/command-output.js';export class ProfilesCommand extends BaseCommand{[a24_0x3611cd(0x13f)]=a24_0x3611cd(0x146);['description']='List\x20all\x20available\x20profiles';async[a24_0x3611cd(0x143)](_0x216888){const _0x1baea1=a24_0x3611cd,{options:_0x5cdf28}=_0x216888;try{const _0x7acbfd=listProfiles(),_0x5b2b90=getActiveProfile();if(_0x7acbfd[_0x1baea1(0x149)]===0x0)return console[_0x1baea1(0x13e)](_0x1baea1(0x14c)),console[_0x1baea1(0x13e)](_0x1baea1(0x152)),console['log']('\x20\x20Global:\x20~/.config/tdx/tdx.json'),0x0;const _0x1f80bb=_0x7acbfd[_0x1baea1(0x148)](_0x874543=>{const _0x432ab3=_0x1baea1,_0x2602d2=_0x874543['name']===_0x5b2b90,_0x4e110f=getProfileParams(_0x874543[_0x432ab3(0x14f)]);return{'name':_0x874543['name'],'active':_0x2602d2,'scope':_0x874543[_0x432ab3(0x154)],'description':_0x874543[_0x432ab3(0x14f)][_0x432ab3(0x14d)]||'','params':_0x4e110f};});return await handleSDKOutput(_0x1f80bb,_0x5cdf28),0x0;}catch(_0x27657a){return _0x27657a instanceof Error&&console['error'](_0x1baea1(0x155)+_0x27657a[_0x1baea1(0x14a)]),0x1;}}}
@@ -1 +1 @@
1
- const a25_0x3a7fd7=a25_0x23ad;(function(_0x2e0fdf,_0x5997e9){const _0xfc9bd5=a25_0x23ad,_0x67f637=_0x2e0fdf();while(!![]){try{const _0x35f211=-parseInt(_0xfc9bd5(0x1a7))/0x1*(parseInt(_0xfc9bd5(0x1b3))/0x2)+parseInt(_0xfc9bd5(0x1a9))/0x3*(-parseInt(_0xfc9bd5(0x1a6))/0x4)+-parseInt(_0xfc9bd5(0x195))/0x5+-parseInt(_0xfc9bd5(0x1c4))/0x6*(-parseInt(_0xfc9bd5(0x1a0))/0x7)+-parseInt(_0xfc9bd5(0x1bc))/0x8+-parseInt(_0xfc9bd5(0x1a8))/0x9*(-parseInt(_0xfc9bd5(0x199))/0xa)+parseInt(_0xfc9bd5(0x1bb))/0xb;if(_0x35f211===_0x5997e9)break;else _0x67f637['push'](_0x67f637['shift']());}catch(_0x514e57){_0x67f637['push'](_0x67f637['shift']());}}}(a25_0x40df,0xeae6c));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';function a25_0x40df(){const _0x3aa236=['setJobId','Executing\x20query\x20[','2446825qHPUDk','length','name','elapsedTimeMillis','103520ewruVV','totalSplits','output','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','args','stats','124327hVOkfe','join','No\x20SQL\x20provided','...','data','\x20splits','4mnpQmE','54492tYihKV','558sfdHdO','1450152aZdqSc','\x0aAll\x20results\x20saved\x20to\x20','Executing\x20query...','information_schema','originalMessage','state','site','Catalog:\x20','Site:\x20','verbose','36vPklpv','\x20-\x20','setExtra','Schema:\x20','catalog','options','Executing\x20statement\x20','file','36242415PLVYoe','10013768gmQwpk','execute','push','\x20[Job\x20ID:\x20','Statement\x20','error','Run\x20Trino\x20queries\x20(streaming)','\x20rows\x20','78BgmZwT','message','query'];a25_0x40df=function(){return _0x3aa236;};return a25_0x40df();}import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';import{formatRows}from'../sdk/util/formatters.js';function a25_0x23ad(_0x4fa431,_0x48eeb8){_0x4fa431=_0x4fa431-0x195;const _0x40df2b=a25_0x40df();let _0x23ad4a=_0x40df2b[_0x4fa431];return _0x23ad4a;}export class QueryCommand extends BaseCommand{[a25_0x3a7fd7(0x197)]=a25_0x3a7fd7(0x1c6);['description']=a25_0x3a7fd7(0x1c2);async[a25_0x3a7fd7(0x1bd)](_0x49f977){const _0x4cf6ad=a25_0x3a7fd7,{options:_0x1b65fe,args:_0x2be11a,tdx:_0x169d5e}=_0x49f977,_0x51cf2b=_0x2be11a[0x0],_0x1ad70f=_0x1b65fe[_0x4cf6ad(0x1ba)];let _0x456d7a;try{if(_0x1ad70f)_0x456d7a=readSqlStatementsFromFile(_0x1ad70f);else{if(_0x51cf2b==='-')_0x456d7a=await readSqlStatementsFromStdin();else{if(_0x51cf2b&&isSqlFilePath(_0x51cf2b))_0x456d7a=readSqlStatementsFromFile(_0x51cf2b);else{if(_0x51cf2b)_0x456d7a=splitSqlStatements(_0x51cf2b);else throw new Error(_0x4cf6ad(0x1a2));}}}}catch(_0x22ff63){return console[_0x4cf6ad(0x1c1)]('Error:\x20'+_0x22ff63[_0x4cf6ad(0x1c5)]),0x1;}const _0x3474eb=_0x1b65fe['database']||_0x4cf6ad(0x1ac),_0x1ee8cf=_0x1b65fe[_0x4cf6ad(0x1b7)];try{const _0x252053=[],_0x22cb96=!!_0x1b65fe[_0x4cf6ad(0x19b)];for(let _0x181250=0x0;_0x181250<_0x456d7a[_0x4cf6ad(0x196)];_0x181250++){const _0x1a07f9=_0x456d7a[_0x181250],_0x1618c7=_0x181250+0x1,_0x204f5e=_0x456d7a['length'],_0x1a7143=_0x204f5e>0x1;_0x1b65fe[_0x4cf6ad(0x1b2)]&&(console[_0x4cf6ad(0x1c1)]('\x0a'+(_0x1a7143?'Statement\x20'+_0x1618c7+'/'+_0x204f5e+':':'')),console[_0x4cf6ad(0x1c1)](_0x4cf6ad(0x1b1)+_0x1b65fe[_0x4cf6ad(0x1af)]),console[_0x4cf6ad(0x1c1)](_0x4cf6ad(0x1b0)+(_0x1ee8cf||'td')),console['error'](_0x4cf6ad(0x1b6)+_0x3474eb),console[_0x4cf6ad(0x1c1)]('SQL:\x20'+_0x1a07f9));const _0x2abe12=_0x1a7143?_0x4cf6ad(0x1b9)+_0x1618c7+'/'+_0x204f5e+_0x4cf6ad(0x1a3):_0x4cf6ad(0x1ab);try{const _0x5edb26=await withProgressSpinner(_0x2abe12,async _0x20ada6=>{const _0x260f19=_0x4cf6ad,_0x1f9d05=await _0x169d5e[_0x260f19(0x1c6)][_0x260f19(0x1bd)](_0x1a07f9,{'catalog':_0x1ee8cf,'schema':_0x3474eb,'onJobId':_0x293be2=>{const _0x16dfeb=_0x260f19;_0x20ada6[_0x16dfeb(0x1c7)](_0x293be2);},'onProgress':_0x44d898=>{const _0x2f64f6=_0x260f19;_0x20ada6['setPhase'](_0x2f64f6(0x1c8)+_0x44d898[_0x2f64f6(0x1ae)]+']'),_0x20ada6[_0x2f64f6(0x1b5)](formatRows(_0x44d898['processedRows'])+'\x20rows\x20'+_0x44d898['completedSplits']+'/'+_0x44d898[_0x2f64f6(0x19a)]+_0x2f64f6(0x1a5));}});return _0x1f9d05;},{'verbose':_0x1b65fe[_0x4cf6ad(0x1b2)]}),_0x823e=_0x5edb26[_0x4cf6ad(0x1a4)],_0x313d8b=_0x823e['jobId']?_0x4cf6ad(0x1bf)+_0x823e[_0x4cf6ad(0x19d)]+']':'',_0x29869a=_0x1a7143?'Statement\x20'+_0x1618c7+'/'+_0x204f5e+_0x4cf6ad(0x1b4):'';console['error']('✔\x20'+_0x29869a+'Query\x20completed:\x20Processed\x20'+formatRows(_0x823e['stats']['processedRows'])+_0x4cf6ad(0x1c3)+('in\x20'+formatElapsed(_0x823e[_0x4cf6ad(0x19f)][_0x4cf6ad(0x198)])+_0x313d8b));if(_0x1a7143&&_0x22cb96){const _0x145a9b=resolveOutputOptions(_0x1b65fe),_0x767464=await formatQueryOutput(_0x823e,_0x145a9b);_0x252053[_0x4cf6ad(0x1be)](_0x767464);}else await handleQueryOutput(_0x823e,_0x1b65fe);}catch(_0x4554ee){const _0x28686e=_0x1a7143?_0x4cf6ad(0x1c0)+_0x1618c7+'/'+_0x204f5e+':\x0a':'',_0xeeea5f=_0x4554ee instanceof SDKError?_0x4554ee[_0x4cf6ad(0x1ad)]:_0x4554ee[_0x4cf6ad(0x1c5)];return console[_0x4cf6ad(0x1c1)](''+_0x28686e+_0xeeea5f),0x1;}}if(_0x456d7a[_0x4cf6ad(0x196)]>0x1&&_0x22cb96&&_0x252053[_0x4cf6ad(0x196)]>0x0){const _0x5bfa6f=_0x252053[_0x4cf6ad(0x1a1)]('\x0a');writeFileSync(_0x1b65fe['output'],_0x5bfa6f),console[_0x4cf6ad(0x1c1)](_0x4cf6ad(0x1aa)+_0x1b65fe[_0x4cf6ad(0x19b)]);}return 0x0;}catch(_0x5eb190){throw _0x5eb190;}}['validate'](_0x2cbda4){const _0x345639=a25_0x3a7fd7,_0x4fa50f=_0x2cbda4[_0x345639(0x19e)][0x0],_0x5abb0f=_0x2cbda4[_0x345639(0x1b8)][_0x345639(0x1ba)];if(!_0x4fa50f&&!_0x5abb0f)return _0x345639(0x19c);if(_0x4fa50f&&_0x5abb0f)return'Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option';return undefined;}}
1
+ const a25_0x4c1d61=a25_0xecc7;(function(_0x1140ba,_0x1e9f97){const _0x5ba216=a25_0xecc7,_0x27482a=_0x1140ba();while(!![]){try{const _0x5b83f9=-parseInt(_0x5ba216(0x1ba))/0x1+-parseInt(_0x5ba216(0x1b5))/0x2*(parseInt(_0x5ba216(0x1d1))/0x3)+parseInt(_0x5ba216(0x1c1))/0x4+-parseInt(_0x5ba216(0x1c8))/0x5*(parseInt(_0x5ba216(0x1d3))/0x6)+parseInt(_0x5ba216(0x1ce))/0x7+-parseInt(_0x5ba216(0x1c4))/0x8*(parseInt(_0x5ba216(0x1b0))/0x9)+parseInt(_0x5ba216(0x1c2))/0xa;if(_0x5b83f9===_0x1e9f97)break;else _0x27482a['push'](_0x27482a['shift']());}catch(_0x40c59c){_0x27482a['push'](_0x27482a['shift']());}}}(a25_0x5818,0x1b14a));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleQueryOutput,formatQueryOutput,resolveOutputOptions}from'../core/command-output.js';import{readSqlStatementsFromFile,readSqlStatementsFromStdin,splitSqlStatements,isSqlFilePath}from'../sdk/query/sql-parser.js';import{writeFileSync}from'fs';import{withProgressSpinner,formatElapsed}from'../utils/spinner.js';function a25_0xecc7(_0x2f0120,_0x777bb4){_0x2f0120=_0x2f0120-0x1a5;const _0x58181a=a25_0x5818();let _0xecc71d=_0x58181a[_0x2f0120];return _0xecc71d;}import{formatRows}from'../sdk/util/formatters.js';export class QueryCommand extends BaseCommand{['name']=a25_0x4c1d61(0x1cd);['description']='Run\x20Trino\x20queries\x20(streaming)';async[a25_0x4c1d61(0x1bf)](_0x121966){const _0x3bb110=a25_0x4c1d61,{options:_0x6e82ab,args:_0x190f41,tdx:_0x1fe78c}=_0x121966,_0x257f29=_0x190f41[0x0],_0x5a676e=_0x6e82ab[_0x3bb110(0x1be)];let _0x2e5275;try{if(_0x5a676e)_0x2e5275=readSqlStatementsFromFile(_0x5a676e);else{if(_0x257f29==='-')_0x2e5275=await readSqlStatementsFromStdin();else{if(_0x257f29&&isSqlFilePath(_0x257f29))_0x2e5275=readSqlStatementsFromFile(_0x257f29);else{if(_0x257f29)_0x2e5275=splitSqlStatements(_0x257f29);else throw new Error('No\x20SQL\x20provided');}}}}catch(_0x52798c){return console[_0x3bb110(0x1a5)](_0x3bb110(0x1b1)+_0x52798c[_0x3bb110(0x1ad)]),0x1;}const _0x42345f=_0x6e82ab[_0x3bb110(0x1b3)]||'information_schema',_0x30438d=_0x6e82ab[_0x3bb110(0x1d0)];try{const _0x2af10a=[],_0x56fa35=!!_0x6e82ab['output'];for(let _0xef170c=0x0;_0xef170c<_0x2e5275[_0x3bb110(0x1a7)];_0xef170c++){const _0x1154ad=_0x2e5275[_0xef170c],_0x3e0546=_0xef170c+0x1,_0x5b3549=_0x2e5275['length'],_0x3e1616=_0x5b3549>0x1;_0x6e82ab[_0x3bb110(0x1b2)]&&(console[_0x3bb110(0x1a5)]('\x0a'+(_0x3e1616?_0x3bb110(0x1b8)+_0x3e0546+'/'+_0x5b3549+':':'')),console['error'](_0x3bb110(0x1d6)+_0x6e82ab[_0x3bb110(0x1c5)]),console[_0x3bb110(0x1a5)](_0x3bb110(0x1a6)+(_0x30438d||'td')),console[_0x3bb110(0x1a5)](_0x3bb110(0x1cb)+_0x42345f),console[_0x3bb110(0x1a5)](_0x3bb110(0x1d7)+_0x1154ad));const _0x21ea73=_0x3e1616?_0x3bb110(0x1c9)+_0x3e0546+'/'+_0x5b3549+'...':_0x3bb110(0x1ca);try{const _0x196078=await withProgressSpinner(_0x21ea73,async _0xe08efd=>{const _0x1efc47=_0x3bb110,_0x3a99ff=await _0x1fe78c[_0x1efc47(0x1cd)][_0x1efc47(0x1bf)](_0x1154ad,{'catalog':_0x30438d,'schema':_0x42345f,'onJobId':_0xe43369=>{_0xe08efd['setJobId'](_0xe43369);},'onProgress':_0xdff390=>{const _0x5bf4ca=_0x1efc47;_0xe08efd[_0x5bf4ca(0x1b6)](_0x5bf4ca(0x1af)+_0xdff390[_0x5bf4ca(0x1b7)]+']'),_0xe08efd[_0x5bf4ca(0x1cc)](formatRows(_0xdff390[_0x5bf4ca(0x1aa)])+_0x5bf4ca(0x1d2)+_0xdff390[_0x5bf4ca(0x1bc)]+'/'+_0xdff390[_0x5bf4ca(0x1b4)]+_0x5bf4ca(0x1b9));}});return _0x3a99ff;},{'verbose':_0x6e82ab[_0x3bb110(0x1b2)]}),_0x3638ca=_0x196078[_0x3bb110(0x1c6)],_0x1d5aab=_0x3638ca['jobId']?_0x3bb110(0x1a8)+_0x3638ca[_0x3bb110(0x1c0)]+']':'',_0x317637=_0x3e1616?_0x3bb110(0x1b8)+_0x3e0546+'/'+_0x5b3549+_0x3bb110(0x1bd):'';console[_0x3bb110(0x1a5)]('✔\x20'+_0x317637+_0x3bb110(0x1d4)+formatRows(_0x3638ca[_0x3bb110(0x1bb)][_0x3bb110(0x1aa)])+_0x3bb110(0x1d2)+(_0x3bb110(0x1c7)+formatElapsed(_0x3638ca['stats']['elapsedTimeMillis'])+_0x1d5aab));if(_0x3e1616&&_0x56fa35){const _0x3384b0=resolveOutputOptions(_0x6e82ab),_0x385303=await formatQueryOutput(_0x3638ca,_0x3384b0);_0x2af10a[_0x3bb110(0x1ac)](_0x385303);}else await handleQueryOutput(_0x3638ca,_0x6e82ab);}catch(_0x206d85){const _0xc0e2b0=_0x3e1616?'Statement\x20'+_0x3e0546+'/'+_0x5b3549+':\x0a':'',_0x2f4e43=_0x206d85 instanceof SDKError?_0x206d85[_0x3bb110(0x1ae)]:_0x206d85[_0x3bb110(0x1ad)];return console[_0x3bb110(0x1a5)](''+_0xc0e2b0+_0x2f4e43),0x1;}}if(_0x2e5275[_0x3bb110(0x1a7)]>0x1&&_0x56fa35&&_0x2af10a['length']>0x0){const _0x25ac95=_0x2af10a['join']('\x0a');writeFileSync(_0x6e82ab[_0x3bb110(0x1cf)],_0x25ac95),console[_0x3bb110(0x1a5)]('\x0aAll\x20results\x20saved\x20to\x20'+_0x6e82ab[_0x3bb110(0x1cf)]);}return 0x0;}catch(_0x1b8880){throw _0x1b8880;}}[a25_0x4c1d61(0x1c3)](_0x2bca62){const _0x2cb4e9=a25_0x4c1d61,_0x5b0dac=_0x2bca62[_0x2cb4e9(0x1ab)][0x0],_0x1bfb39=_0x2bca62['options'][_0x2cb4e9(0x1be)];if(!_0x5b0dac&&!_0x1bfb39)return _0x2cb4e9(0x1a9);if(_0x5b0dac&&_0x1bfb39)return _0x2cb4e9(0x1d5);return undefined;}}function a25_0x5818(){const _0x56dc1a=['\x20splits','108367NSzhKQ','stats','completedSplits','\x20-\x20','file','execute','jobId','658408wXckZX','4400370ZiNNmF','validate','2216tpfBYu','site','data','in\x20','52055kiIsKk','Executing\x20statement\x20','Executing\x20query...','Schema:\x20','setExtra','query','1197wTXgii','output','catalog','87snQqGU','\x20rows\x20','96wIxXMK','Query\x20completed:\x20Processed\x20','Cannot\x20specify\x20both\x20SQL\x20argument\x20and\x20--file\x20option','Site:\x20','SQL:\x20','error','Catalog:\x20','length','\x20[Job\x20ID:\x20','Usage:\x20tdx\x20query\x20\x22SELECT\x20*\x20FROM\x20table\x22\x0a\x20\x20\x20or:\x20tdx\x20query\x20query.sql\x0a\x20\x20\x20or:\x20echo\x20\x22SELECT\x201\x22\x20|\x20tdx\x20query\x20-\x0a\x0aRun\x20\x27tdx\x20query\x20--help\x27\x20for\x20more\x20options','processedRows','args','push','message','originalMessage','Executing\x20query\x20[','666CBTpPw','Error:\x20','verbose','database','totalSplits','13686gyMWJe','setPhase','state','Statement\x20'];a25_0x5818=function(){return _0x56dc1a;};return a25_0x5818();}