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