const e=require("../_util/type.js"),t=require("../_util/classNames.js"),n=require("../_util/omit.js"),r=require("../config-provider/DisabledContext.js"),i=require("../_util/props-util/initDefaultProps.js"),a=require("../config-provider/hooks/useConfigInject.js"),o=require("../_util/vue-types/index.js"),s=require("../_util/statusUtils.js"),c=require("../_util/transition.js"),l=require("../form/FormItemContext.js"),u=require("../space/Compact.js"),d=require("../select/style/index.js"),f=require("../select/utils/iconUtil.js"),p=require("../vc-cascader/utils/commonUtil.js"),m=require("../vc-cascader/Cascader.js"),h=require("../vc-cascader/index.js"),g=require("./style/index.js");let _=require("vue"),v=require("@antsoo-lib/icons");function y(e,t,n){let r=e.toLowerCase().split(t).reduce((e,n,r)=>r===0?[n]:[...e,t,n],[]),i=[],a=0;return r.forEach((t,r)=>{let o=a+t.length,s=e.slice(a,o);a=o,r%2==1&&(s=(0,_.createVNode)(`span`,{class:`${n}-menu-item-keyword`,key:`seperator`},[s])),i.push(s)}),i}var b=({inputValue:e,path:t,prefixCls:n,fieldNames:r})=>{let i=[],a=e.toLowerCase();return t.forEach((e,t)=>{t!==0&&i.push(` / `);let o=e[r.label],s=typeof o;(s===`string`||s===`number`)&&(o=y(String(o),a,n)),i.push(o)}),i};function x(){return{...n.default(m.internalCascaderProps(),[`customSlots`,`checkable`,`options`]),multiple:{type:Boolean,default:void 0},size:String,bordered:{type:Boolean,default:void 0},placement:{type:String},suffixIcon:o.default.any,status:String,options:Array,popupClassName:String,dropdownClassName:String,"onUpdate:value":Function}}var S=(0,_.defineComponent)({compatConfig:{MODE:3},name:`ACascader`,inheritAttrs:!1,props:i.default(x(),{bordered:!0,choiceTransitionName:``,allowClear:!0}),setup(e,{attrs:n,expose:i,slots:o,emit:p}){let m=l.useInjectFormItemContext(),y=l.FormItemInputContext.useInject(),x=(0,_.computed)(()=>s.getMergedStatus(y.status,e.status)),{prefixCls:S,rootPrefixCls:C,getPrefixCls:w,direction:T,getPopupContainer:E,renderEmpty:D,size:O,disabled:k}=a.default(`cascader`,e),A=(0,_.computed)(()=>w(`select`,e.prefixCls)),{compactSize:j,compactItemClassnames:M}=u.useCompactItemContext(A,T),N=(0,_.computed)(()=>j.value||O.value),P=r.useInjectDisabled(),F=(0,_.computed)(()=>k.value??P.value),[I,L]=d.default(A),[R]=g.default(S),z=(0,_.computed)(()=>T.value===`rtl`),B=(0,_.computed)(()=>{if(!e.showSearch)return e.showSearch;let t={render:b};return typeof e.showSearch==`object`&&(t={...t,...e.showSearch}),t}),V=(0,_.computed)(()=>t.default(e.popupClassName||e.dropdownClassName,`${S.value}-dropdown`,{[`${S.value}-dropdown-rtl`]:z.value},L.value)),H=(0,_.ref)();i({focus(){H.value?.focus()},blur(){H.value?.blur()}});let U=(...e)=>{p(`update:value`,e[0]),p(`change`,...e),m.onFieldChange()},W=(...e)=>{p(`blur`,...e),m.onFieldBlur()},G=(0,_.computed)(()=>e.showArrow===void 0?e.loading||!e.multiple:e.showArrow),K=(0,_.computed)(()=>e.placement===void 0?T.value===`rtl`?`bottomRight`:`bottomLeft`:e.placement);return()=>{let{notFoundContent:t=o.notFoundContent?.(),expandIcon:r=o.expandIcon?.(),multiple:i,bordered:a,allowClear:l,choiceTransitionName:u,transitionName:d,id:p=m.id.value,...g}=e,b=t||D(`Cascader`),w=r;r||(w=z.value?(0,_.createVNode)(v.LeftOutlined,null,null):(0,_.createVNode)(v.RightOutlined,null,null));let O=(0,_.createVNode)(`span`,{class:`${A.value}-menu-item-loading-icon`},[(0,_.createVNode)(v.LoadingOutlined,{spin:!0},null)]),{suffixIcon:k,removeIcon:j,clearIcon:P}=f.default({...e,hasFeedback:y.hasFeedback,feedbackIcon:y.feedbackIcon,multiple:i,prefixCls:A.value,showArrow:G.value},o);return R(I((0,_.createVNode)(h.default,{...g,...n,id:p,prefixCls:A.value,class:[S.value,{[`${A.value}-lg`]:N.value===`large`,[`${A.value}-sm`]:N.value===`small`,[`${A.value}-rtl`]:z.value,[`${A.value}-borderless`]:!a,[`${A.value}-in-form-item`]:y.isFormItemInput},s.getStatusClassNames(A.value,x.value,y.hasFeedback),M.value,n.class,L.value],disabled:F.value,direction:T.value,placement:K.value,notFoundContent:b,allowClear:l,showSearch:B.value,expandIcon:w,inputIcon:k,removeIcon:j,clearIcon:P,loadingIcon:O,checkable:!!i,dropdownClassName:V.value,dropdownPrefixCls:S.value,choiceTransitionName:c.getTransitionName(C.value,``,u),transitionName:c.getTransitionName(C.value,c.getTransitionDirection(K.value),d),getPopupContainer:E?.value,customSlots:{...o,checkable:()=>(0,_.createVNode)(`span`,{class:`${S.value}-checkbox-inner`},null)},tagRender:e.tagRender||o.tagRender,displayRender:e.displayRender||o.displayRender,maxTagPlaceholder:e.maxTagPlaceholder||o.maxTagPlaceholder,showArrow:y.hasFeedback||e.showArrow,onChange:U,onBlur:W,ref:H},o)))}}}),C=e.withInstall(Object.assign(S,{SHOW_CHILD:p.SHOW_CHILD,SHOW_PARENT:p.SHOW_PARENT}));exports.cascaderProps=x,exports.default=C;