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