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