"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),U=require("lodash-unified");require("../config-provider/index.js");require("../resize-observer/index.js");const V=require("./hooks/useItems.js"),F=require("./hooks/useResizable.js"),L=require("./hooks/useResize.js"),j=require("./hooks/useSizes.js");require("./Panel.vue.js");require("./SplitBar.vue.js");const A=require("./style/index.js"),D=require("../config-provider/hooks/use-namespace.js"),H=require("../resize-observer/index.vue.js"),T=require("./Panel.vue2.js"),W=require("./SplitBar.vue2.js"),$=e.defineComponent({name:"Splitter",__name:"Splitter",props:{prefixCls:{},className:{},style:{},rootClassName:{},layout:{default:"horizontal"},onResizeStart:{},onResize:{},onResizeEnd:{},lazy:{type:Boolean},draggerIcon:{},collapsibleIcon:{}},setup(o){const r=o,{b:u}=D.useNamespace("splitter"),v=A.default("splitter"),i=V.useItems(),c=e.ref(),b=t=>{const{offsetWidth:s,offsetHeight:a}=t.target,n=r.layout==="vertical"?a:s;c.value!==0&&(c.value=n)},[y,m,d,k,_,h]=j.useSizes(i,c),l=F.useResizable(i,m,!1),[C,R,B,E,S]=L.useResize(i,l,d,c,h,!1),q=t=>{C(t),r.onResizeStart?.(e.unref(m))},I=(t,s)=>{const a=R(t,s);r.onResize?.(a)},w=()=>{B(),r.onResizeEnd?.(e.unref(m))},N=(t,s)=>{const a=E(t,s);r.onResize?.(a),r.onResizeEnd?.(a)},P=e.computed(()=>[u(),r.className,u(r.layout),v.value]),g=e.computed(()=>{const t=[];let s=0;for(let a=0;a<i.value.length;a+=1)s+=e.unref(d)[a],t.push(s);return t}),f=t=>{const s=e.unref(g),a=e.unref(k),n=e.unref(_);return{minStart:(s[t-1]||0)+a[t],minEnd:(s[t+1]||100)-n[t+1],maxStart:(s[t-1]||0)+n[t],maxEnd:(s[t+1]||100)-a[t+1]}};return(t,s)=>(e.openBlock(),e.createBlock(e.unref(H.default),{onResize:b},{default:e.withCtx(()=>[e.createElementVNode("div",{style:e.normalizeStyle(o.style),class:e.normalizeClass(P.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),(a,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[e.createVNode(T.default,e.mergeProps({ref_for:!0},e.unref(U.omit)(a,"_child"),{size:e.unref(y)[n]}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a._child,(z,p)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(z),{key:p}))),128))]),_:2},1040,["size"]),e.unref(l)[n]?(e.openBlock(),e.createBlock(W.default,{key:0,lazy:o.lazy,index:n,active:e.unref(S)===n,vertical:o.layout==="vertical",resizable:e.unref(l)[n].resizable,"aria-now":g.value[n]*100,"aria-min":Math.max(f(n).minStart,f(n).minEnd)*100,"aria-max":Math.min(f(n).maxStart,f(n).maxEnd)*100,"start-collapsible":e.unref(l)[n].startCollapsible,"end-collapsible":e.unref(l)[n].endCollapsible,"show-start-collapsible-icon":e.unref(l)[n].showStartCollapsibleIcon,"show-end-collapsible-icon":e.unref(l)[n].showEndCollapsibleIcon,"container-size":c.value||0,"dragger-icon":o.draggerIcon,"collapsible-icon":o.collapsibleIcon,onOffsetStart:q,onOffsetUpdate:(z,p,M)=>{let O=o.layout==="vertical"?M:p;I(z,O)},onOffsetEnd:w,onCollapse:N},null,8,["lazy","index","active","vertical","resizable","aria-now","aria-min","aria-max","start-collapsible","end-collapsible","show-start-collapsible-icon","show-end-collapsible-icon","container-size","dragger-icon","collapsible-icon","onOffsetUpdate"])):e.createCommentVNode("",!0)],64))),128)),typeof e.unref(S)=="number"?(e.openBlock(),e.createElementBlock("div",{key:0,"aria-hidden":"",class:e.normalizeClass([e.unref(u)("mask"),e.unref(u)(`mask-${o.layout}`)])},null,2)):e.createCommentVNode("",!0)],6)]),_:1}))}});exports.default=$;
