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