import{z as p,M as o,r as C,N as m,l as g,j as s,O as N,o as T,Q as b}from"./index.BN4Hj9cC.js";import{g as A,a as L,f as w}from"./pandasStylerUtils.Dn0wlQNv.js";import"./moment.C3j7ZXd7.js";import"./numbro.CV6ZOarr.js";import"./_baseIndexOf.BTknn6Gb.js";const M=p("div",{target:"e15vb32f0"})(({theme:t})=>({fontSize:t.fontSizes.md,fontFamily:t.genericFonts.bodyFont,lineHeight:t.lineHeights.small,captionSide:"bottom"})),h=p("div",{target:"e15vb32f1"})(({theme:t})=>({fontFamily:t.genericFonts.bodyFont,fontSize:t.fontSizes.sm,paddingTop:t.spacing.sm,paddingBottom:0,color:t.colors.fadedText60,textAlign:"left",wordWrap:"break-word",display:"inline-block"})),O=p("div",{target:"e15vb32f2"})(({theme:t,borderMode:e})=>({border:e===o.BorderMode.ALL?`${t.sizes.borderWidth} solid ${t.colors.dataframeBorderColor}`:"none",borderRadius:t.radii.default,overflow:"auto"})),v=p("table",{target:"e15vb32f3"})(({theme:t})=>({width:t.sizes.full,color:t.colors.bodyText,borderSpacing:0})),u=(t,e=o.BorderMode.ALL)=>({borderBottom:e!==o.BorderMode.NONE?`${t.sizes.borderWidth} solid ${t.colors.dataframeBorderColor}`:"none","tbody tr:last-child &":{borderBottom:e===o.BorderMode.ALL||e===o.BorderMode.HORIZONTAL?"none":void 0},borderRight:e===o.BorderMode.ALL?`${t.sizes.borderWidth} solid ${t.colors.dataframeBorderColor}`:"none","&:last-child":{borderRight:e===o.BorderMode.ALL?"none":void 0,paddingRight:e===o.BorderMode.NONE?"0":t.spacing.xs},verticalAlign:"middle",padding:`${t.spacing.twoXS} ${t.spacing.xs}`,"&:not(:first-of-type)":{paddingLeft:e===o.BorderMode.NONE||e===o.BorderMode.HORIZONTAL?t.spacing.lg:t.spacing.xs},"&:first-of-type":{paddingLeft:e===o.BorderMode.NONE?"0":t.spacing.xs},fontWeight:t.fontWeights.normal}),S=p("td",{target:"e15vb32f4"})(({theme:t,borderMode:e})=>u(t,e)),B=p("th",{target:"e15vb32f5"})(({theme:t,borderMode:e})=>({...u(t,e),textAlign:"inherit",color:t.colors.fadedText60,"&:first-of-type":{paddingLeft:e===o.BorderMode.NONE?"0":t.spacing.sm},"&:not(:first-of-type)":{paddingLeft:e===o.BorderMode.NONE||e===o.BorderMode.HORIZONTAL?t.spacing.lg:t.spacing.sm}})),H=p(S,{target:"e15vb32f6"})(({theme:t})=>({color:t.colors.gray70,fontStyle:"italic",fontSize:t.fontSizes.md,textAlign:"center"}));function R(t){const e=t.data,{cssId:l,cssStyles:n,caption:d}=e.styler??{},{numHeaderRows:f,numDataRows:c,numColumns:a}=e.dimensions,r=m(c),i=t.element.borderMode;return g(M,{className:"stTable","data-testid":"stTable",children:[n&&s("style",{children:n}),s(O,{borderMode:i,children:g(v,{id:l,"data-testid":"stTableStyledTable",children:[f>0&&E(e,i),s("tbody",{children:r.length===0?s("tr",{children:s(H,{"data-testid":"stTableStyledEmptyTableCell",colSpan:a||1,borderMode:i,children:"empty"})}):r.map(y=>z(e,y,a,i))})]})}),d&&s(h,{children:d})]})}function E(t,e){const l=e===o.BorderMode.NONE||e===o.BorderMode.HORIZONTAL;return s("thead",{children:A(t).map((n,d)=>s("tr",{children:n.map((f,c)=>{let a="inherit";if(l&&t.dimensions.numDataRows>0){const{contentType:r}=t.getCell(0,c);a=N(r)?"right":"left"}return s(B,{className:f.cssClass,scope:"col",borderMode:e,style:{textAlign:a},children:s(T,{source:f.name||" ",allowHTML:!1})},c)})},d))})}function z(t,e,l,n){return s("tr",{children:m(l).map(d=>$(t,e,d,n))},e)}function $(t,e,l,n){const{type:d,content:f,contentType:c}=t.getCell(e,l),a=L(t,e,l);let r=a?.displayContent||w(f,c),i=!1;const y={textAlign:N(c)?"right":"left"};switch(r?.endsWith('<span class="pd-t"></span>')&&(r=r.replace(/<span class="pd-t"><\/span>$/,""),i=!0),d){case b.INDEX:return g(B,{scope:"row",id:a?.cssId,className:a?.cssClass,borderMode:n,children:[i&&s("span",{className:"pd-t"}),s(T,{source:r||" ",allowHTML:!1})]},l);case b.DATA:return g(S,{id:a?.cssId,className:a?.cssClass,style:y,borderMode:n,children:[i&&s("span",{className:"pd-t"}),s(T,{source:r||" ",allowHTML:!1})]},l);default:throw new Error(`Cannot parse type "${d}".`)}}const j=C.memo(R);export{j as default};
