var sa=Object.defineProperty,va=Object.defineProperties;var da=Object.getOwnPropertyDescriptors;var Be=Object.getOwnPropertySymbols;var fa=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable;var We=(a,e,n)=>e in a?sa(a,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[e]=n,He=(a,e)=>{for(var n in e||(e={}))fa.call(e,n)&&We(a,n,e[n]);if(Be)for(var n of Be(e))pa.call(e,n)&&We(a,n,e[n]);return a},Ue=(a,e)=>va(a,da(e));var Ne=(a,e,n)=>new Promise((l,o)=>{var t=r=>{try{i(n.next(r))}catch(s){o(s)}},u=r=>{try{i(n.throw(r))}catch(s){o(s)}},i=r=>r.done?l(r.value):Promise.resolve(r.value).then(t,u);i((n=n.apply(a,e)).next())});import{f as I,Q as N,r as H,G as we,eT as xe,eZ as ne,T as K,fa as ha,eW as ga,p as ma,k as Ca,g3 as Me,fW as ya,e_ as ye,O as Oe,be as oe,b as B,d as Ie,b9 as Sa,P as ba,U as ce,N as na,g6 as wa,dO as Pe,fZ as ze,aN as ka,dg as Ke,g9 as Pa,V as je,ga as Oa,M as xa,de as Ia,da as _a,R as Va,ed as Aa,en as Ta,dh as ta,gb as Fa,g2 as qe,gl as La,ay as de,ar as Da,aj as Ge,aq as Ze,u as Qe,aT as Ra,aU as Xe,o as Na,a as Ea,bq as ja,w as Ye,j as Ma,h as Ka,t as $a}from"./index-f4658ae7.js";import{useRuleFormItem as Ba}from"./useFormItem-7226971e.js";import{a as Wa,u as Ha,d as Ee}from"./useMaxLevel-0b248899.js";import"./index-d51f1b4b.js";var $e="__RC_CASCADER_SPLIT__",Ua="SHOW_PARENT",za="SHOW_CHILD";function se(a){return a.join($e)}function ge(a){return a.map(se)}function qa(a){return a.split($e)}function Ga(a){var e=a||{},n=e.label,l=e.value,o=e.children,t=l||"value";return{label:n||"label",value:t,key:t,children:o||"children"}}function Ce(a,e){var n,l;return(n=a.isLeaf)!==null&&n!==void 0?n:!(!((l=a[e.children])===null||l===void 0)&&l.length)}function Za(a){var e=a.parentElement;if(e){var n=a.offsetTop-e.offsetTop;n-e.scrollTop<0?e.scrollTo({top:n}):n+a.offsetHeight-e.scrollTop>e.offsetHeight&&e.scrollTo({top:n+a.offsetHeight-e.offsetHeight})}}const Qa=function(a,e){var n=I(function(){return Wa(a.value,{fieldNames:e.value,initWrapper:function(o){return N(N({},o),{pathKeyEntities:{}})},processEntity:function(o,t){var u=o.nodes.map(function(i){return i[e.value.value]}).join($e);t.pathKeyEntities[u]=o,o.key=u}}).pathKeyEntities});return n};function Xa(a){var e=H(!1),n=H({});return we(function(){if(!a.value){e.value=!1,n.value={};return}var l={matchInputWidth:!0,limit:50};a.value&&xe(a.value)==="object"&&(l=N(N({},l),a.value)),l.limit<=0&&delete l.limit,e.value=!0,n.value=l}),{showSearch:e,searchConfig:n}}var Se="__rc_cascader_search_mark__",Ya=function(e,n,l){var o=l.label;return n.some(function(t){return String(t[o]).toLowerCase().includes(e.toLowerCase())})},Ja=function(e){var n=e.path,l=e.fieldNames;return n.map(function(o){return o[l.label]}).join(" / ")};const en=function(a,e,n,l,o,t){return I(function(){var u=o.value,i=u.filter,r=i===void 0?Ya:i,s=u.render,g=s===void 0?Ja:s,m=u.limit,d=m===void 0?50:m,c=u.sort,v=[];if(!a.value)return[];function O(C,f){C.forEach(function(S){if(!(!c&&d>0&&v.length>=d)){var w=[].concat(ne(f),[S]),p=S[n.value.children];if((!p||p.length===0||t.value)&&r(a.value,w,{label:n.value.label})){var h;v.push(N(N({},S),(h={},K(h,n.value.label,g({inputValue:a.value,path:w,prefixCls:l.value,fieldNames:n.value})),K(h,Se,w),h)))}p&&O(S[n.value.children],w)}})}return O(e.value,[]),c&&v.sort(function(C,f){return c(C[Se],f[Se],a.value,n.value)}),d>0?v.slice(0,d):v})};function Je(a,e,n){var l=new Set(a);return a.filter(function(o){var t=e[o],u=t?t.parent:null,i=t?t.children:null;return n===za?!(i&&i.some(function(r){return r.key&&l.has(r.key)})):!(u&&!u.node.disabled&&l.has(u.key))})}function be(a,e,n){for(var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o,t=e,u=[],i=function(g){var m=a[g],d=t==null?void 0:t.findIndex(function(v){var O=v[n.value];return l?String(O)===String(m):O===m}),c=d!==-1?t==null?void 0:t[d]:null;u.push({value:(o=c==null?void 0:c[n.value])!==null&&o!==void 0?o:m,index:d,option:c}),t=c==null?void 0:c[n.children]},r=0;r1){var f=s.value.slice(0,-1);d(f)}else u.toggleOpen(!1)},O=function(){var f,S=((f=m.value[g.value])===null||f===void 0?void 0:f[n.value.children])||[],w=S.find(function(h){return!h.disabled});if(w){var p=[].concat(ne(s.value),[w[n.value.value]]);d(p)}};a.expose({onKeydown:function(f){var S=f.which;switch(S){case oe.UP:case oe.DOWN:{var w=0;S===oe.UP?w=-1:S===oe.DOWN&&(w=1),w!==0&&c(w);break}case oe.LEFT:{i.value?O():v();break}case oe.RIGHT:{i.value?v():O();break}case oe.BACKSPACE:{u.searchValue||v();break}case oe.ENTER:{if(s.value.length){var p=m.value[g.value],h=(p==null?void 0:p[Se])||[];h.length?t(h.map(function(E){return E[n.value.value]}),h[h.length-1]):t(s.value,p)}break}case oe.ESC:u.toggleOpen(!1),open&&f.stopPropagation()}},onKeyup:function(){}})};function Ve(a){var e,n=a.prefixCls,l=a.checked,o=a.halfChecked,t=a.disabled,u=a.onClick,i=_e(),r=i.customSlots,s=i.checkable,g=s.value!==!1?r.value.checkable:s.value,m=typeof g=="function"?g():typeof g=="boolean"?null:g;return B("span",{class:(e={},K(e,n,!0),K(e,"".concat(n,"-checked"),l),K(e,"".concat(n,"-indeterminate"),!l&&o),K(e,"".concat(n,"-disabled"),t),e),onClick:u},[m])}Ve.props=["prefixCls","checked","halfChecked","disabled","onClick"];Ve.displayName="Checkbox";Ve.inheritAttrs=!1;var ra="__cascader_fix_label__";function Ae(a){var e=a.prefixCls,n=a.multiple,l=a.options,o=a.activeValue,t=a.prevValuePath,u=a.onToggleOpen,i=a.onSelect,r=a.onActive,s=a.checkedSet,g=a.halfCheckedSet,m=a.loadingKeys,d=a.isSelectable,c,v,O,C,f,S,w="".concat(e,"-menu"),p="".concat(e,"-menu-item"),h=_e(),E=h.fieldNames,U=h.changeOnSelect,G=h.expandTrigger,F=h.expandIcon,k=h.loadingIcon,A=h.dropdownMenuColumnStyle,T=h.customSlots,W=(c=F.value)!==null&&c!==void 0?c:(O=(v=T.value).expandIcon)===null||O===void 0?void 0:O.call(v),Z=(C=k.value)!==null&&C!==void 0?C:(S=(f=T.value).loadingIcon)===null||S===void 0?void 0:S.call(f),Y=G.value==="hover";return B("ul",{class:w,role:"menu"},[l.map(function(j){var Q,re,ee=j.disabled,_=j[Se],y=(re=j[ra])!==null&&re!==void 0?re:j[E.value.label],V=j[E.value.value],P=Ce(j,E.value),D=_?_.map(function(J){return J[E.value.value]}):[].concat(ne(t),[V]),R=se(D),z=m.includes(R),L=s.has(R),ae=g.has(R),q=function(){!ee&&(!Y||!P)&&r(D)},te=function(){d(j)&&i(D,P)},le;return typeof j.title=="string"?le=j.title:typeof y=="string"&&(le=y),B("li",{key:R,class:[p,(Q={},K(Q,"".concat(p,"-expand"),!P),K(Q,"".concat(p,"-active"),o===V),K(Q,"".concat(p,"-disabled"),ee),K(Q,"".concat(p,"-loading"),z),Q)],style:A.value,role:"menuitemcheckbox",title:le,"aria-checked":L,"data-path-key":R,onClick:function(){q(),(!n||P)&&te()},onDblclick:function(){U.value&&u(!1)},onMouseenter:function(){Y&&q()},onMousedown:function(ve){ve.preventDefault()}},[n&&B(Ve,{prefixCls:"".concat(e,"-checkbox"),checked:L,halfChecked:ae,disabled:ee,onClick:function(ve){ve.stopPropagation(),te()}},null),B("div",{class:"".concat(p,"-content")},[y]),!z&&W&&!P&&B("div",{class:"".concat(p,"-expand-icon")},[W]),z&&Z&&B("div",{class:"".concat(p,"-loading-icon")},[Z])])})])}Ae.props=["prefixCls","multiple","options","activeValue","prevValuePath","onToggleOpen","onSelect","onActive","checkedSet","halfCheckedSet","loadingKeys","isSelectable"];Ae.displayName="Column";Ae.inheritAttrs=!1;const on=Ie({name:"OptionList",inheritAttrs:!1,setup:function(e,n){var l=n.attrs,o=n.slots,t=Me(),u=H(),i=I(function(){return t.direction==="rtl"}),r=_e(),s=r.options,g=r.values,m=r.halfValues,d=r.fieldNames,c=r.changeOnSelect,v=r.onSelect,O=r.searchOptions,C=r.dropdownPrefixCls,f=r.loadData,S=r.expandTrigger,w=r.customSlots,p=I(function(){return C.value||t.prefixCls}),h=Sa([]),E=function(y){if(!(!f.value||t.searchValue)){var V=be(y,s.value,d.value),P=V.map(function(z){var L=z.option;return L}),D=P[P.length-1];if(D&&!Ce(D,d.value)){var R=se(y);h.value=[].concat(ne(h.value),[R]),f.value(P)}}};we(function(){h.value.length&&h.value.forEach(function(_){var y=qa(_),V=be(y,s.value,d.value,!0).map(function(D){var R=D.option;return R}),P=V[V.length-1];(!P||P[d.value.children]||Ce(P,d.value))&&(h.value=h.value.filter(function(D){return D!==_}))})});var U=I(function(){return new Set(ge(g.value))}),G=I(function(){return new Set(ge(m.value))}),F=ln(),k=ye(F,2),A=k[0],T=k[1],W=function(y){T(y),E(y)},Z=function(y){var V=y.disabled,P=Ce(y,d.value);return!V&&(P||c.value||t.multiple)},Y=function(y,V){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;v(y),!t.multiple&&(V||c.value&&(S.value==="hover"||P))&&t.toggleOpen(!1)},j=I(function(){return t.searchValue?O.value:s.value}),Q=I(function(){for(var _=[{options:j.value}],y=j.value,V=function(z){var L=A.value[z],ae=y.find(function(te){return te[d.value.value]===L}),q=ae==null?void 0:ae[d.value.children];if(!(q!=null&&q.length))return"break";y=q,_.push({options:q})},P=0;P({})},isLeaf:{type:Function,default:null},displayRenderArray:{type:Array}},emits:["change","defaultChange"],setup(a,{emit:e}){const n=H([]),l=H([]),o=H(!1),t=H([]),u=H(!0),[i]=Ba(a,"value","change",t);Oe(n,c=>{const v=r(c);l.value=v},{deep:!0});function r(c){const{labelField:v,valueField:O,numberToString:C,childrenField:f,isLeaf:S}=a;return c.reduce((w,p)=>{if(p){const h=p[O],E=Ue(He({},Da(p,[v,O])),{label:p[v],value:C?`${h}`:h,isLeaf:S&&typeof S=="function"?S(p):!1}),U=Reflect.get(p,f);U&&Reflect.set(E,f,r(U)),w.push(E)}return w},[])}function s(){return Ne(this,null,function*(){const c=a.api;if(!(!c||!Ge(c))){n.value=[],o.value=!0;try{const v=yield c(a.initFetchParams);if(Array.isArray(v)){n.value=v;return}a.resultField&&(n.value=Ze(v,a.resultField)||[])}catch(v){}finally{o.value=!1}}})}function g(c){return Ne(this,null,function*(){const v=c[c.length-1];v.loading=!0;const O=a.api;if(!(!O||!Ge(O)))try{const C=yield O({[a.asyncFetchParamKey]:Reflect.get(v,"value")});if(Array.isArray(C)){const f=r(C);v.children=f;return}if(a.resultField){const f=r(Ze(C,a.resultField)||[]);v.children=f}}catch(C){}finally{v.loading=!1}})}we(()=>{a.immediate&&s()}),Oe(()=>a.initFetchParams,()=>{!Qe(u)&&s()},{deep:!0});function m(c,v){t.value=c,e("defaultChange",c,v)}function d({labels:c,selectedOptions:v}){return Qe(t).length===v.length?c.join(" / "):a.displayRenderArray?a.displayRenderArray.join(" / "):""}return{state:i,options:l,loading:o,handleChange:m,loadData:g,handleRenderDisplay:d}}});function mn(a,e,n,l,o,t){const u=Xe("LoadingOutlined"),i=Xe("a-cascader");return Na(),Ea(i,{value:a.state,"onUpdate:value":e[0]||(e[0]=r=>a.state=r),options:a.options,"load-data":a.loadData,"change-on-select":"",onChange:a.handleChange,displayRender:a.handleRenderDisplay},ja({_:2},[a.loading?{name:"suffixIcon",fn:Ye(()=>[B(u,{spin:""})]),key:"0"}:void 0,a.loading?{name:"notFoundContent",fn:Ye(()=>[Ma("span",null,[B(u,{spin:"",class:"mr-1"}),Ka(" "+$a(a.t("component.form.apiSelectNotFound")),1)])]),key:"1"}:void 0]),1032,["value","options","load-data","onChange","displayRender"])}const Cn=Ra(gn,[["render",mn]]),Pn=Object.freeze(Object.defineProperty({__proto__:null,default:Cn},Symbol.toStringTag,{value:"Module"}));export{Cn as A,aa as C,Pn as a};