import{jsx as e,Fragment as d,jsxs as s}from"react/jsx-runtime";import{memo as p,useCallback as f}from"react";import{getPathPrefix as x,combineUrls as g}from"@redocly/theme/core/openapi";import{DocumentIcon as w}from"@redocly/theme/icons/DocumentIcon/DocumentIcon";import{JsonIcon as b}from"@redocly/theme/icons/JsonIcon/JsonIcon";import{FileIcon as u}from"@redocly/theme/icons/FileIcon/FileIcon";import{DownloadButton as h}from"@redocly/theme/components/Buttons/DownloadButton";import{useTelemetry as y}from"../../hooks/index.js";import{styled as r}from"../../styled-components.js";function v({downloadObjects:t}){const l=y(),n=x(),c=f(o=>{switch(o){case"yaml":return e(w,{});case"json":return e(b,{});default:return e(u,{})}},[]);return t?e(D,{children:(t||[]).map(({title:o,url:a,iconType:m})=>{const i=n?g(n,a):a;return s(k,{onClick:()=>{l.sendDownloadDefinitionClickedMessage()},children:[s(j,{children:[c(m),e("a",{href:i,target:"_blank",download:!0,rel:"noreferrer",children:o})]}),e(h,{data:i})]},o)})}):e(d,{})}const J=p(v),k=r.div`
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;

  border-bottom: 1px solid var(--border-color-secondary);
  padding-bottom: var(--spacing-sm);
  :last-of-type {
    padding-bottom: 0px;
    border-bottom: none;
  }
`,j=r.span`
  display: flex;
  width: calc(100% - 25px);
  gap: var(--spacing-xs);
  align-items: center;

  svg {
    flex-shrink: 0;
  }
  a {
    width: 100%;
    color: var(--text-color-primary);
    word-break: break-word;
    text-decoration: none;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
`,D=r.div`
  display: flex;
  align-items: center;
  align-self: flex-start;
  justify-content: space-between;
  flex-direction: column;
  gap: var(--spacing-sm);
  font-size: var(--font-size-base);
`;export{J as DownloadSpecification};
