import e from"../_util/classNames.mjs";import t from"../locale/en_US.mjs";import{useLocaleReceiver as n}from"../locale/LocaleReceiver.mjs";import r from"../tooltip/index.mjs";import i from"../grid/Col.mjs";import{useInjectForm as a}from"./context.mjs";import{Fragment as o,createVNode as s}from"vue";import{QuestionCircleOutlined as c}from"@antsoo-lib/icons";var l=(l,{slots:u,emit:d,attrs:f})=>{let{prefixCls:p,htmlFor:m,labelCol:h,labelAlign:g,colon:_,required:v,requiredMark:y}={...l,...f},[b]=n(`Form`),x=l.label??u.label?.();if(!x)return null;let{vertical:S,labelAlign:C,labelCol:w,labelWrap:T,colon:E}=a(),D=h||w?.value||{},O=g||C?.value,k=`${p}-item-label`,A=e(k,O===`left`&&`${k}-left`,D.class,{[`${k}-wrap`]:!!T.value}),j=x,M=_===!0||E?.value!==!1&&_!==!1;if(M&&!S.value&&typeof x==`string`&&x.trim()!==``&&(j=x.replace(/[:|：]\s*$/,``)),l.tooltip||u.tooltip){let e=s(`span`,{class:`${p}-item-tooltip`},[s(r,{title:l.tooltip},{default:()=>[s(c,null,null)]})]);j=s(o,null,[j,u.tooltip?u.tooltip?.({class:`${p}-item-tooltip`}):e])}y===`optional`&&!v&&(j=s(o,null,[j,s(`span`,{class:`${p}-item-optional`},[b.value?.optional||t.Form?.optional])]));let N=e({[`${p}-item-required`]:v,[`${p}-item-required-mark-optional`]:y===`optional`,[`${p}-item-no-colon`]:!M});return s(i,{...D,class:A},{default:()=>[s(`label`,{for:m,class:N,title:typeof x==`string`?x:``,onClick:e=>d(`click`,e)},[j])]})};l.displayName=`FormItemLabel`,l.inheritAttrs=!1;export{l as default};