"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServerList=void 0;const jsx_runtime_1=require("react/jsx-runtime"),theme_1=require("@redocly/theme"),styled_components_1=__importDefault(require("styled-components")),PanelItem_1=require("../PanelItem"),ViewNested_1=require("../ViewNested"),common_1=require("../common"),Markdown_1=require("../Markdown"),ServerList=({servers:e,path:r})=>(0,jsx_runtime_1.jsx)(ItemsList,{children:e.map((e=>{const t=e.url+r,i=Object.keys(e.variables||{}).length,s=`${1===Number(i)?"":i} ${1!==i?"variables":"variable"}`;return(0,jsx_runtime_1.jsxs)("div",{children:[(0,jsx_runtime_1.jsx)(PanelItem_1.PanelItemDescription,{children:e.description}),(0,jsx_runtime_1.jsxs)(TitleWrap,{children:[(0,jsx_runtime_1.jsx)(PanelItem_1.Title,{suppressHydrationWarning:!0,children:t}),(0,jsx_runtime_1.jsx)(theme_1.CopyButton,{data:t},t)]}),e.variables&&(0,jsx_runtime_1.jsx)(ViewNested_1.ViewNested,{expandText:`Show ${s}`,hideText:`Hide ${s}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:(0,jsx_runtime_1.jsx)(ServerVariablesContainer,{children:Object.entries(e.variables||{}).map((([e,r])=>(0,jsx_runtime_1.jsxs)(ServerVariableContainer,{children:[(0,jsx_runtime_1.jsx)(ServerVariableName,{children:e}),(0,jsx_runtime_1.jsxs)(Variable,{children:["Default ",(0,jsx_runtime_1.jsx)(StyledTag,{children:r.default})]}),(0,jsx_runtime_1.jsx)(Description,{source:r.description}),r.enum&&(0,jsx_runtime_1.jsxs)(Variable,{children:["Enum",(0,jsx_runtime_1.jsx)(TagWrapper,{children:r.enum.map((e=>(0,jsx_runtime_1.jsx)(StyledTag,{children:e},e)))})]})]},e)))})})]},e.url)}))});exports.ServerList=ServerList;const ItemsList=styled_components_1.default.div`
  & > div {
    border-bottom: 1px solid var(--border-color-secondary);
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-sm);
  }

  & > div:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }
`,ServerVariablesContainer=styled_components_1.default.div`
  padding-left: var(--spacing-xxs);
  & > div {
    border-bottom: 1px solid var(--border-color-secondary);
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-sm);
  }

  & > div:first-child {
    margin-top: var(--spacing-sm);
    padding-top: 0;
  }

  & > div:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }
`,ServerVariableContainer=styled_components_1.default.div`
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
`,Description=(0,styled_components_1.default)(Markdown_1.Markdown)`
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--text-color-primary);
`,Variable=styled_components_1.default.span`
  display: flex;
  gap: var(--spacing-xxs);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
  color: var(--text-color-primary);
`,ServerVariableName=(0,styled_components_1.default)(Variable)`
  padding-bottom: var(--spacing-xxs);
  font-weight: var(--font-weight-semibold);
`,TagWrapper=styled_components_1.default.span`
  display: flex;
  gap: var(--spacing-xxs);
  flex-wrap: wrap;
`,StyledTag=(0,styled_components_1.default)(common_1.Tag)`
  font-size: var(--font-size-sm);
  line-height: var(--line-height-sm);
`,TitleWrap=styled_components_1.default.div`
  display: flex;
  justify-content: space-between;
  align-items: center;
`;
//# sourceMappingURL=ServerList.js.map