import e from"../_util/cssinjs/theme/createTheme.mjs";import{useProviderDisabled as t}from"./DisabledContext.mjs";import{useProviderSize as n}from"./SizeContext.mjs";import{configProviderProps as r,defaultIconPrefixCls as i,useConfigContextInject as a,useConfigContextProvider as o,useProvideGlobalForm as s}from"./context.mjs";import c from"../locale/en_US.mjs";import l from"../locale-provider/LocaleReceiver.mjs";import u from"../theme/themes/seed.mjs";import{DesignTokenProvider as d}from"../theme/internal.mjs";import f from"./renderEmpty.mjs";import{ANT_MARK as p}from"../locale/index.mjs";import m from"../locale-provider/index.mjs";import h from"../message/index.mjs";import g from"../notification/index.mjs";import{registerTheme as _}from"./cssVariables.mjs";import v from"./hooks/useTheme.mjs";import y from"./style/index.mjs";import{computed as b,createVNode as x,defineComponent as S,reactive as C,watch as w,watchEffect as T}from"vue";function E(){return k.prefixCls||`ant`}function D(){return k.iconPrefixCls||`anticon`}var O=C({}),k=C({});T(()=>{Object.assign(k,O),k.prefixCls=E(),k.iconPrefixCls=D(),k.getPrefixCls=(e,t)=>t||(e?`${k.prefixCls}-${e}`:k.prefixCls),k.getRootPrefixCls=()=>k.prefixCls?k.prefixCls:E()});var A,j=e=>{A&&A(),A=T(()=>{Object.assign(O,C(e)),Object.assign(k,C(e))}),e.theme&&_(E(),e.theme)},M=()=>({getPrefixCls:(e,t)=>t||(e?`${E()}-${e}`:E()),getIconPrefixCls:D,getRootPrefixCls:()=>k.prefixCls?k.prefixCls:E()}),N=S({compatConfig:{MODE:3},name:`AConfigProvider`,inheritAttrs:!1,props:r(),setup(r,{slots:i}){let _=a(),S=(e,t)=>{let{prefixCls:n=`ant`}=r;if(t)return t;let i=n||_.getPrefixCls(``);return e?`${i}-${e}`:i},C=b(()=>r.iconPrefixCls||_.iconPrefixCls.value||`anticon`),E=b(()=>C.value!==_.iconPrefixCls.value),D=b(()=>r.csp||_.csp?.value),k=y(C),A=v(b(()=>r.theme),b(()=>_.theme?.value)),j=e=>(r.renderEmpty||i.renderEmpty||_.renderEmpty||f)(e),M=b(()=>r.autoInsertSpaceInButton??_.autoInsertSpaceInButton?.value),N=b(()=>r.locale||_.locale?.value);w(N,()=>{O.locale=N.value},{immediate:!0});let P=b(()=>r.direction||_.direction?.value),F=b(()=>r.space??_.space?.value),I=b(()=>r.virtual??_.virtual?.value),L=b(()=>r.dropdownMatchSelectWidth??_.dropdownMatchSelectWidth?.value),R=b(()=>r.getTargetContainer===void 0?_.getTargetContainer?.value:r.getTargetContainer),z=b(()=>r.getPopupContainer===void 0?_.getPopupContainer?.value:r.getPopupContainer),B=b(()=>r.pageHeader===void 0?_.pageHeader?.value:r.pageHeader),V=b(()=>r.input===void 0?_.input?.value:r.input),H=b(()=>r.pagination===void 0?_.pagination?.value:r.pagination),U=b(()=>r.form===void 0?_.form?.value:r.form),W=b(()=>r.select===void 0?_.select?.value:r.select),G=b(()=>r.componentSize),K=b(()=>r.componentDisabled),q=b(()=>r.wave??_.wave?.value),J={csp:D,autoInsertSpaceInButton:M,locale:N,direction:P,space:F,virtual:I,dropdownMatchSelectWidth:L,getPrefixCls:S,iconPrefixCls:C,theme:b(()=>A.value??_.theme?.value),renderEmpty:j,getTargetContainer:R,getPopupContainer:z,pageHeader:B,input:V,pagination:H,form:U,select:W,componentSize:G,componentDisabled:K,transformCellText:b(()=>r.transformCellText),wave:q},Y=b(()=>{let{algorithm:t,token:n,...r}=A.value||{},i=t&&(!Array.isArray(t)||t.length>0)?e(t):void 0;return{...r,theme:i,token:{...u,...n}}}),X=b(()=>{let e={};return N.value&&(e=N.value.Form?.defaultValidateMessages||c.Form?.defaultValidateMessages||{}),r.form&&r.form.validateMessages&&(e={...e,...r.form.validateMessages}),e});o(J),s({validateMessages:X}),n(G),t(K);let Z=e=>{let t=E.value?k(i.default?.()):i.default?.();if(r.theme){let e=function(){return t}();t=x(d,{value:Y.value},{default:()=>[e]})}return x(m,{locale:N.value||e,ANT_MARK__:p},{default:()=>[t]})};return T(()=>{P.value&&(h.config({rtl:P.value===`rtl`}),g.config({rtl:P.value===`rtl`}))}),()=>x(l,{children:(e,t,n)=>Z(n)},null)}});N.config=j,N.install=function(e){e.component(N.name,N)};export{N as default,i as defaultIconPrefixCls,M as globalConfig,k as globalConfigForApi};