"use client";
import{a as M}from"./chunk-W4XUJVWF.js";import{d as u,e as E}from"./chunk-CLTGASR6.js";import{a as A,d as k,m as p}from"./chunk-3CHPBNY2.js";import{v as N}from"./chunk-KEPQUAOX.js";import{forwardRef as ye}from"react";import ue from"clsx";import{forwardRef as K}from"react";import Q from"clsx";var G=A("EulTable",["alignLeft","alignRight","alignCenter","root","tableBody","tableCell","tableCellHead","tableHeader","tableRow","clickable","sortLabel","noPadding","sortActive","sortedAsc","sortedDesc","sticky","stickyLeft","stickyRight","firstStickyRight","lastStickyLeft"]),i=t=>E("EulTable",{root:["root",t?.noPadding&&"noPadding"],sortLabel:["sortLabel",t?.active&&"sortActive",t?.direction&&`sorted${k(t.direction)}`],tableBody:["tableBody"],tableCell:[t?.clickable&&"clickable",t?.align&&`align${k(t.align)}`,t?.sticky&&"sticky",t?.sticky&&typeof t.right>"u"&&"stickyLeft",t?.sticky&&typeof t.right<"u"&&typeof t.left>"u"&&"stickyRight"],tableCellBody:["tableCell"],tableCellHead:["tableCellHead"],tableHeader:["tableHeader"],tableRow:["tableRow",t?.clickable&&"clickable"]}),o=G;import{css as B}from"@emotion/react";var W=p("div")(({theme:t})=>B`
    display: none;
    width: 0;
    height: 0;
    color: ${t.palette.background[700]};
    border-right: 4px solid transparent;
    border-bottom: 5px solid currentColor;
    border-left: 4px solid transparent;

    .${o.sortLabel}.${o.sortActive} &,
    .${o.sortLabel}:hover & {
      display: block;
    }

    .${o.sortLabel}.${o.sortActive} & {
      color: ${t.palette.background[900]};
    }

    .${o.alignRight} & {
      order: -1;
    }

    .${o.sortedDesc}.${o.sortActive} & {
      border-top: 5px solid currentColor;
      border-bottom: 0;
    }
  `),D=p("button")(({theme:t})=>B`
    position: relative;
    display: flex;
    flex: 1;
    gap: ${t.spacing(3)};
    align-items: center;
    justify-content: inherit;
    width: 100%;
    color: inherit;
    background-color: transparent;
    border: none;
    cursor: pointer;
  `);import{jsx as X,jsxs as Z}from"react/jsx-runtime";var v=K(({active:t,children:r,className:l,direction:e,...a},s)=>{let b=i({active:t,direction:e});return Z(D,{...a,className:Q(l,b.sortLabel),ref:s,children:[r,X(W,{})]})});v.displayName="SortLabel";v.defaultProps={active:!1,direction:"asc"};var L=v;import{forwardRef as re,useContext as le}from"react";import ae from"clsx";import{createContext as _}from"react";var j=`${M.MissingProvider}: <TableSlot.Provider>`,ee=_({get variant(){throw new Error(j)}}),g=ee;import{css as te}from"@emotion/react";var c=t=>t.palette.background[500],I=p("div",{shouldForwardProp:t=>!["width","colSpan","left","right"].includes(String(t))})(({colSpan:t,left:r,right:l,theme:e,width:a})=>te`
    position: relative;
    display: flex;
    flex: 1;
    flex-basis: ${a&&`${a}px`};
    flex-grow: ${t};
    gap: ${e.spacing(3)};
    align-items: center;
    max-width: ${a&&`${a}px`};
    padding: ${e.spacing(4)};
    color: ${e.palette.background[1e3]};

    .${o.noPadding} & {
      padding: ${e.spacing(3,0)};
    }

    &.${o.alignRight} {
      justify-content: flex-end;
    }

    &.${o.alignCenter} {
      justify-content: center;
    }

    &.${o.clickable} {
      cursor: pointer;
    }

    &.${o.sticky} {
      position: sticky;
      z-index: 1;
    }

    &.${o.stickyRight} {
      right: ${l||0}px;
    }

    &.${o.stickyLeft} {
      left: ${r||0}px;
    }

    &.${o.lastStickyLeft} {
      box-shadow: inset -1px 0 0 0 ${e.palette.background[600]};
    }

    &.${o.firstStickyRight} {
      box-shadow: inset 1px 0 0 0 ${e.palette.background[600]};
    }

    &.${o.tableCell} {
      font-size: ${e.typography.body1.fontSize};
      line-height: ${e.typography.body1.lineHeight};
      background: ${e.palette.background[500]};

      &:before {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 0;
        width: 100%;
        height: 100%;
        background: ${N(e.palette.common.white,.02)};
        opacity: 0;
        transition: ${e.transitions.create("opacity")};
        content: "";
      }

      &:first-of-type {
        padding-left: ${e.spacing(8)};
        border-left: 1px solid ${c(e)};
      }

      &:last-of-type {
        padding-right: ${e.spacing(8)};
        border-right: 1px solid ${c(e)};
      }

      [role="row"].${o.clickable}:hover & {
        &:before {
          opacity: 1;
        }
      }

      [role="row"]:last-of-type & {
        border-bottom: 1px solid ${c(e)};

        &:first-of-type,
        &:first-of-type:before {
          border-bottom-left-radius: ${e.spacing(2)};
        }

        &:last-of-type,
        &:last-of-type:before {
          border-bottom-right-radius: ${e.spacing(2)};
        }
      }
    }

    &.${o.tableCellHead} {
      padding: ${e.spacing(3,4)};
      color: ${e.palette.background[900]};
      font-weight: ${e.typography.fontWeightRegular};
      font-size: ${e.typography.body2.fontSize};
      line-height: ${e.typography.body2.lineHeight};
      background: ${e.palette.background[400]};
      border: 1px solid ${c(e)};
      border-width: 1px 0 0;

      &:before {
        position: absolute;
        top: 50%;
        right: 1px;
        width: 1px;
        height: ${e.spacing(4)};
        background-color: ${e.palette.background[500]};
        transform: translateY(-50%);
        content: "";
      }

      &:last-of-type:before,
      &.${o.lastStickyLeft}:before, &.${o.firstStickyRight}:before {
        opacity: 0;
      }

      &:first-of-type {
        padding-left: ${e.spacing(8)};

        &,
        &:before {
          border-left: 1px solid ${c(e)};
          border-top-left-radius: ${e.spacing(2)};
        }
      }

      &:last-of-type {
        padding-right: ${e.spacing(8)};

        &,
        &:before {
          border-right: 1px solid ${c(e)};
          border-top-right-radius: ${e.spacing(2)};
        }
      }
    }
  `);import{jsx as se}from"react/jsx-runtime";var w=re(({align:t,children:r,className:l,colSpan:e,left:a,onClick:s,right:b,sticky:C,width:y,...d},n)=>{let f=u(d),{variant:m}=le(g),S=i({align:t,clickable:!!s,left:a,right:b,sticky:C});return a&&b&&console.warn("TableCell: left and right props are mutually exclusive. Please use only one."),se(I,{...f,className:ae(l,S.tableCell,m==="body"?S.tableCellBody:S.tableCellHead),colSpan:e,left:a,onClick:s,ref:n,right:b,role:m==="body"?"cell":"columnheader",width:y,children:r})});w.displayName="TableCell";w.defaultProps={align:"left"};var h=w;import{Children as z,cloneElement as ie,forwardRef as ne,isValidElement as O,useMemo as pe}from"react";import{Slot as be}from"@radix-ui/react-slot";import U from"clsx";import{jsx as de}from"react/jsx-runtime";var F=ne(({asChild:t,children:r,className:l,onClick:e,...a},s)=>{let b=i({clickable:!!e||!!t}),C=t?be:"div",y=pe(()=>z.toArray(r).reduce((n,f,m)=>(O(f)&&f.props.sticky&&(typeof f.props.right>"u"?n.lastLeftIndex=m:n.firstRightIndex===-1&&(n.firstRightIndex=m)),n),{firstRightIndex:-1,lastLeftIndex:-1}),[r]);return de(C,{...a,className:U(l,b.tableRow),onClick:e,ref:s,role:"row",children:z.map(r,(d,n)=>O(d)?ie(d,{className:U(d.props.className,{[o.firstStickyRight]:n===y.firstRightIndex,[o.lastStickyLeft]:n===y.lastLeftIndex})}):d)})});F.displayName="TableRow";var R=F;import{forwardRef as P}from"react";import fe from"clsx";var V=p("div")({display:"flex",flexDirection:"column",[`&.${o.tableBody}`]:{gap:1}});import{jsx as T}from"react/jsx-runtime";var H=P(({children:t,className:r,variant:l,...e},a)=>{let s=i();return T(g.Provider,{value:{variant:l},children:T(V,{...e,className:fe(r,l==="body"?s.tableBody:s.tableHeader),ref:a,role:"rowgroup",children:t})})});H.displayName="TableSlot";var x=P(({children:t,className:r,...l},e)=>T(H,{...l,className:r,ref:e,variant:"body",children:t}));x.displayName="TableBody";var $=P(({children:t,className:r,...l},e)=>T(H,{...l,className:r,ref:e,variant:"header",children:t}));$.displayName="TableHeader";import{css as me}from"@emotion/react";var Y=p("div")(()=>me`
    width: 100%;

    & .${o.tableRow} {
      position: relative;
      display: flex;
      align-items: stretch;
      text-decoration: none;

      &.${o.clickable} {
        cursor: pointer;
      }
    }
  `);import{jsx as $e}from"react/jsx-runtime";var q=ye(({children:t,className:r,...l},e)=>{let a=u(l),s=i({noPadding:l.noPadding});return $e(Y,{...a,className:ue(s.root,r),ref:e,role:"table",children:t})});q.displayName="Table";var Te=Object.assign(q,{Body:x,Cell:h,Header:$,Row:R,SortLabel:L}),xe=Te;export{o as a,xe as b};
