import{Y as e,r as i,W as $,ej as Y,j as u,f as q,aF as G,ay as P,a8 as K}from"./index-7ecf457b.js";import{g as Q,a as X,s as D,u as Z}from"./useThemeProps-71110af6.js";import{a as S,u as x}from"./useSlot-2c8854f2.js";function w(r){return Q("MuiTypography",r)}X("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:l,level:a,color:t,variant:n}=r,s={root:["root",a,o&&"gutterBottom",l&&"noWrap",t&&`color${P(t)}`,n&&`variant${P(n)}`],startDecorator:["startDecorator"],endDecorator:["endDecorator"]};return K(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)"}),no=D("span",{name:"JoyTypography",slot:"endDecorator",overridesResolver:(r,o)=>o.endDecorator})({display:"inline-flex",marginInlineStart:"clamp(4px, var(--Typography-gap, 0.375em), 0.75rem)"}),lo=D("span",{name:"JoyTypography",slot:"Root",overridesResolver:(r,o)=>o.root})(({theme:r,ownerState:o})=>{var l,a,t,n,s;const p=o.level!=="inherit"?(l=r.typography[o.level])==null?void 0:l.lineHeight:"1";return e({"--Icon-fontSize":`calc(1em * ${p})`},o.color&&{"--Icon-color":"currentColor"},{margin:"var(--Typography-margin, 0px)"},o.nesting?{display:"inline"}:{display:"block",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"&&(a=(t=r.typography[o.level])==null?void 0:t.fontSize)!=null?a:"inherit"})`},o.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o.gutterBottom&&{marginBottom:"0.35em"},o.color&&o.color!=="context"&&{color:`rgba(${(n=r.vars.palette[o.color])==null?void 0:n.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]))}),_={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"},I=i.forwardRef(function(o,l){const a=Z({props:o,name:"JoyTypography"}),{color:t,textColor:n}=a,s=$(a,oo),p=i.useContext(b),W=i.useContext(eo),d=Y(e({},s,{color:n})),{component:B,gutterBottom:R=!1,noWrap:E=!1,level:M="body-md",levelMapping:N=_,children:c,endDecorator:f,startDecorator:T,variant:m,slots:j={},slotProps:z={}}=d,J=$(d,ro),{getColor:U}=S(m),k=U(o.color,m?t??"neutral":t),g=p||W?o.level||"inherit":M,C=B||(p?"span":N[g]||_[g]||"span"),y=e({},d,{level:g,component:C,color:k,gutterBottom:R,noWrap:E,nesting:p,variant:m}),h=to(y),v=e({},J,{component:C,slots:j,slotProps:z}),[F,H]=x("root",{ref:l,className:h.root,elementType:lo,externalForwardedProps:v,ownerState:y}),[O,A]=x("startDecorator",{className:h.startDecorator,elementType:ao,externalForwardedProps:v,ownerState:y}),[L,V]=x("endDecorator",{className:h.endDecorator,elementType:no,externalForwardedProps:v,ownerState:y});return u(b.Provider,{value:!0,children:q(F,e({},H,{children:[T&&u(O,e({},A,{children:T})),G(c,["Skeleton"])?i.cloneElement(c,{variant:c.props.variant||"inline"}):c,f&&u(L,e({},V,{children:f}))]}))})});I.muiName="Typography";const co=I;export{co as T};
