"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("vue"),b=require("../../_util/vnode.js"),j=require("../../table/context.js"),a=require("../constant.js"),k=require("../utils/legacyUtil.js");function C(o){return o.reduce((l,n)=>{const{fixed:r}=n,u=r===!0?"left":r,s=n.children;return s&&s.length>0?[...l,...C(s).map(f=>({fixed:u,...f}))]:[...l,{...n,fixed:u}]},[])}function I(o){return o.map(l=>{const{fixed:n,...r}=l;let u=n;return n==="left"?u="right":n==="right"&&(u="left"),{fixed:u,...r}})}function K({prefixCls:o,columns:l,expandable:n,expandedKeys:r,getRowKey:u,onTriggerExpand:s,expandIcon:f,rowExpandable:_,expandIconColumnIndex:v,direction:O,expandRowByClick:P,expandColumnWidth:L,expandFixed:c},N){const M=j.useInjectSlots(),A=d.computed(()=>{if(n.value){let e=l.value.slice();if(!e.includes(a.EXPAND_COLUMN)){const t=v.value||0;t>=0&&e.splice(t,0,a.EXPAND_COLUMN)}const m=e.indexOf(a.EXPAND_COLUMN);e=e.filter((t,x)=>t!==a.EXPAND_COLUMN||x===m);const E=l.value[m];let i;(c.value==="left"||c.value)&&!v.value?i="left":(c.value==="right"||c.value)&&v.value===l.value.length?i="right":i=E?E.fixed:null;const U=r.value,g=_.value,X=f.value,w=o.value,y=P.value,R={[k.INTERNAL_COL_DEFINE]:{class:`${o.value}-expand-icon-col`,columnType:"EXPAND_COLUMN"},title:b.customRenderSlot(M.value,"expandColumnTitle",{},()=>[""]),fixed:i,class:`${o.value}-row-expand-icon-cell`,width:L.value,customRender:({record:t,index:x})=>{const V=u.value(t,x),q=U.has(V),S=g?g(t):!0,h=X({prefixCls:w,expanded:q,expandable:S,record:t,onExpand:s});return y?d.createVNode("span",{onClick:T=>T.stopPropagation()},[h]):h}};return e.map(t=>t===a.EXPAND_COLUMN?R:t)}return l.value.filter(e=>e!==a.EXPAND_COLUMN)}),p=d.computed(()=>{let e=A.value;return N.value&&(e=N.value(e)),e.length||(e=[{customRender:()=>null}]),e}),D=d.computed(()=>O.value==="rtl"?I(C(p.value)):C(p.value));return[p,D]}exports.default=K;
