import{a9 as e,r as i,a7 as P,b7 as G,aT as K,j as u,l as Q,aU as _,aj as S}from"./index-91e9700c.js";import{g as X,a as Y,s as D,u as Z}from"./useThemeProps-1bc4d723.js";import{u as x}from"./useSlot-6d750ee3.js";function w(r){return X("MuiTypography",r)}Y("MuiTypography",["root","h1","h2","h3","h4","title-lg","title-md","title-sm","body-lg","body-md","body-sm","body-xs","noWrap","gutterBottom","startDecorator","endDecorator","colorPrimary","colorNeutral","colorDanger","colorSuccess","colorWarning","colorContext","variantPlain","variantOutlined","variantSoft","variantSolid"]);const oo=["color","textColor"],ro=["component","gutterBottom","noWrap","level","levelMapping","children","endDecorator","startDecorator","variant","slots","slotProps"],B=i.createContext(!1),eo=i.createContext(!1),to=r=>{const{gutterBottom:o,noWrap:n,level:l,color:a,variant:t}=r,s={root:["root",l,o&&"gutterBottom",n&&"noWrap",a&&`color${_(a)}`,t&&`variant${_(t)}`],startDecorator:["startDecorator"],endDecorator:["endDecorator"]};return S(s,w,{})},ao=D("span",{name:"JoyTypography",slot:"StartDecorator",overridesResolver:(r,o)=>o.startDecorator})({display:"inline-flex",marginInlineEnd:"clamp(4px, var(--Typography-gap, 0.375em), 0.75rem)"}),lo=D("span",{name:"JoyTypography",slot:"endDecorator",overridesResolver:(r,o)=>o.endDecorator})({display:"inline-flex",marginInlineStart:"clamp(4px, var(--Typography-gap, 0.375em), 0.75rem)"}),no=D("span",{name:"JoyTypography",slot:"Root",overridesResolver:(r,o)=>o.root})(({theme:r,ownerState:o})=>{var n,l,a,t,s;const y=o.level!=="inherit"?(n=r.typography[o.level])==null?void 0:n.lineHeight:"1";return e({"--Icon-fontSize":`calc(1em * ${y})`},o.color&&{"--Icon-color":"currentColor"},{margin:"var(--Typography-margin, 0px)"},o.nesting?{display:"inline"}:e({display:"block"},o.unstable_hasSkeleton&&{position:"relative"}),(o.startDecorator||o.endDecorator)&&e({display:"flex",alignItems:"center"},o.nesting&&e({display:"inline-flex"},o.startDecorator&&{verticalAlign:"bottom"})),o.level&&o.level!=="inherit"&&r.typography[o.level],{fontSize:`var(--Typography-fontSize, ${o.level&&o.level!=="inherit"&&(l=(a=r.typography[o.level])==null?void 0:a.fontSize)!=null?l:"inherit"})`},o.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o.gutterBottom&&{marginBottom:"0.35em"},o.color&&{color:`var(--variant-plainColor, rgba(${(t=r.vars.palette[o.color])==null?void 0:t.mainChannel} / 1))`},o.variant&&e({borderRadius:r.vars.radius.xs,paddingBlock:"min(0.1em, 4px)",paddingInline:"0.25em"},!o.nesting&&{marginInline:"-0.25em"},(s=r.variants[o.variant])==null?void 0:s[o.color]))}),I={h1:"h1",h2:"h2",h3:"h3",h4:"h4","title-lg":"p","title-md":"p","title-sm":"p","body-lg":"p","body-md":"p","body-sm":"p","body-xs":"span",inherit:"p"},R=i.forwardRef(function(o,n){var l;const a=Z({props:o,name:"JoyTypography"}),{color:t,textColor:s}=a,y=P(a,oo),d=i.useContext(B),W=i.useContext(eo),m=G(e({},y,{color:s})),{component:k,gutterBottom:E=!1,noWrap:M=!1,level:N="body-md",levelMapping:j=I,children:p,endDecorator:T,startDecorator:f,variant:b,slots:z={},slotProps:U={}}=m,J=P(m,ro),H=(l=o.color)!=null?l:b?t??"neutral":t,h=d||W?o.level||"inherit":N,C=K(p,["Skeleton"]),$=k||(d?"span":j[h]||I[h]||"span"),c=e({},m,{level:h,component:$,color:H,gutterBottom:E,noWrap:M,nesting:d,variant:b,unstable_hasSkeleton:C}),g=to(c),v=e({},J,{component:$,slots:z,slotProps:U}),[O,A]=x("root",{ref:n,className:g.root,elementType:no,externalForwardedProps:v,ownerState:c}),[F,L]=x("startDecorator",{className:g.startDecorator,elementType:ao,externalForwardedProps:v,ownerState:c}),[V,q]=x("endDecorator",{className:g.endDecorator,elementType:lo,externalForwardedProps:v,ownerState:c});return u(B.Provider,{value:!0,children:Q(O,e({},A,{children:[f&&u(F,e({},L,{children:f})),C?i.cloneElement(p,{variant:p.props.variant||"inline"}):p,T&&u(V,e({},q,{children:T}))]}))})});R.muiName="Typography";const co=R;export{co as T};
