import{B as $,D as A,f as C,G as fe,P as G,s as u,H as w,S as pe,L as P,K as I,o as _,c as W,w as q,a6 as de,p as X,t as x,u as m,$ as j,a7 as he,aG as ye,ap as ge,m as D,j as F,F as we,C as be,ar as k,R as V,i as J,bg as Se,k as Q,I as ze,a5 as _e,ay as xe,bu as ke,r as Ee,Y as Le,V as Te,b6 as He,a0 as Re,__tla as Ce}from"./entry.b543c057.js";import{t as Be}from"./error.78e43d3e.js";let U,Ne=Promise.all([(()=>{try{return Ce}catch{}})()]).then(async()=>{const Z={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},ee=({move:f,size:c,bar:o})=>({[o.size]:c,transform:`translate${o.axis}(${f}%)`}),K=Symbol("scrollbarContextKey"),ae=$({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),le="Thumb",te=C({__name:"thumb",props:ae,setup(f){const c=f,o=fe(K),t=G("scrollbar");o||Be(le,"can not inject scrollbar context");const i=u(),l=u(),v=u({}),p=u(!1);let s=!1,h=!1,y=ge?document.onselectstart:null;const a=w(()=>Z[c.vertical?"vertical":"horizontal"]),b=w(()=>ee({size:c.size,move:c.move,bar:a.value})),S=w(()=>i.value[a.value.offset]**2/o.wrapElement[a.value.scrollSize]/c.ratio/l.value[a.value.offset]),E=r=>{var e;if(r.stopPropagation(),r.ctrlKey||[1,2].includes(r.button))return;(e=window.getSelection())==null||e.removeAllRanges(),N(r);const n=r.currentTarget;n&&(v.value[a.value.axis]=n[a.value.offset]-(r[a.value.client]-n.getBoundingClientRect()[a.value.direction]))},B=r=>{if(!l.value||!i.value||!o.wrapElement)return;const e=Math.abs(r.target.getBoundingClientRect()[a.value.direction]-r[a.value.client]),n=l.value[a.value.offset]/2,d=(e-n)*100*S.value/i.value[a.value.offset];o.wrapElement[a.value.scroll]=d*o.wrapElement[a.value.scrollSize]/100},N=r=>{r.stopImmediatePropagation(),s=!0,document.addEventListener("mousemove",L),document.addEventListener("mouseup",g),y=document.onselectstart,document.onselectstart=()=>!1},L=r=>{if(!i.value||!l.value||s===!1)return;const e=v.value[a.value.axis];if(!e)return;const n=(i.value.getBoundingClientRect()[a.value.direction]-r[a.value.client])*-1,d=l.value[a.value.offset]-e,z=(n-d)*100*S.value/i.value[a.value.offset];o.wrapElement[a.value.scroll]=z*o.wrapElement[a.value.scrollSize]/100},g=()=>{s=!1,v.value[a.value.axis]=0,document.removeEventListener("mousemove",L),document.removeEventListener("mouseup",g),T(),h&&(p.value=!1)},M=()=>{h=!1,p.value=!!c.size},Y=()=>{h=!0,p.value=s};pe(()=>{T(),document.removeEventListener("mouseup",g)});const T=()=>{document.onselectstart!==y&&(document.onselectstart=y)};return P(I(o,"scrollbarElement"),"mousemove",M),P(I(o,"scrollbarElement"),"mouseleave",Y),(r,e)=>(_(),W(ye,{name:m(t).b("fade"),persisted:""},{default:q(()=>[de(X("div",{ref_key:"instance",ref:i,class:x([m(t).e("bar"),m(t).is(m(a).key)]),onMousedown:B},[X("div",{ref_key:"thumb",ref:l,class:x(m(t).e("thumb")),style:j(m(b)),onMousedown:E},null,38)],34),[[he,r.always||p.value]])]),_:1},8,["name"]))}});var O=A(te,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);const se=$({always:{type:Boolean,default:!0},width:String,height:String,ratioX:{type:Number,default:1},ratioY:{type:Number,default:1}}),re=C({__name:"bar",props:se,setup(f,{expose:c}){const o=f,t=u(0),i=u(0);return c({handleScroll:l=>{if(l){const v=l.offsetHeight-4,p=l.offsetWidth-4;i.value=l.scrollTop*100/v*o.ratioY,t.value=l.scrollLeft*100/p*o.ratioX}}}),(l,v)=>(_(),D(we,null,[F(O,{move:t.value,ratio:l.ratioX,size:l.width,always:l.always},null,8,["move","ratio","size","always"]),F(O,{move:i.value,ratio:l.ratioY,size:l.height,vertical:"",always:l.always},null,8,["move","ratio","size","always"])],64))}});var oe=A(re,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);const ne=$({height:{type:[String,Number],default:""},maxHeight:{type:[String,Number],default:""},native:{type:Boolean,default:!1},wrapStyle:{type:be([String,Object,Array]),default:""},wrapClass:{type:[String,Array],default:""},viewClass:{type:[String,Array],default:""},viewStyle:{type:[String,Array,Object],default:""},noresize:Boolean,tag:{type:String,default:"div"},always:Boolean,minSize:{type:Number,default:20}}),ie={scroll:({scrollTop:f,scrollLeft:c})=>[f,c].every(k)},ue="ElScrollbar",ce=C({name:ue}),ve=C({...ce,props:ne,emits:ie,setup(f,{expose:c,emit:o}){const t=f,i=G("scrollbar");let l,v;const p=u(),s=u(),h=u(),y=u("0"),a=u("0"),b=u(),S=u(1),E=u(1),B=w(()=>{const e={};return t.height&&(e.height=V(t.height)),t.maxHeight&&(e.maxHeight=V(t.maxHeight)),[t.wrapStyle,e]}),N=w(()=>[t.wrapClass,i.e("wrap"),{[i.em("wrap","hidden-default")]:!t.native}]),L=w(()=>[i.e("view"),t.viewClass]),g=()=>{var e;s.value&&((e=b.value)==null||e.handleScroll(s.value),o("scroll",{scrollTop:s.value.scrollTop,scrollLeft:s.value.scrollLeft}))};function M(e,n){He(e)?s.value.scrollTo(e):k(e)&&k(n)&&s.value.scrollTo(e,n)}const Y=e=>{k(e)&&(s.value.scrollTop=e)},T=e=>{k(e)&&(s.value.scrollLeft=e)},r=()=>{if(!s.value)return;const e=s.value.offsetHeight-4,n=s.value.offsetWidth-4,d=e**2/s.value.scrollHeight,z=n**2/s.value.scrollWidth,H=Math.max(d,t.minSize),R=Math.max(z,t.minSize);S.value=d/(e-d)/(H/(e-H)),E.value=z/(n-z)/(R/(n-R)),a.value=H+4t.noresize,e=>{e?(l==null||l(),v==null||v()):({stop:l}=Se(h,r),v=P("resize",r))},{immediate:!0}),J(()=>[t.maxHeight,t.height],()=>{t.native||Q(()=>{var e;r(),s.value&&((e=b.value)==null||e.handleScroll(s.value))})}),ze(K,_e({scrollbarElement:p,wrapElement:s})),xe(()=>{t.native||Q(()=>{r()})}),ke(()=>r()),c({wrapRef:s,update:r,scrollTo:M,setScrollTop:Y,setScrollLeft:T,handleScroll:g}),(e,n)=>(_(),D("div",{ref_key:"scrollbarRef",ref:p,class:x(m(i).b())},[X("div",{ref_key:"wrapRef",ref:s,class:x(m(N)),style:j(m(B)),onScroll:g},[(_(),W(Le(e.tag),{ref_key:"resizeRef",ref:h,class:x(m(L)),style:j(e.viewStyle)},{default:q(()=>[Ee(e.$slots,"default")]),_:3},8,["class","style"]))],38),e.native?Te("v-if",!0):(_(),W(oe,{key:0,ref_key:"barRef",ref:b,height:a.value,width:y.value,always:e.always,"ratio-x":E.value,"ratio-y":S.value},null,8,["height","width","always","ratio-x","ratio-y"]))],2))}});var me=A(ve,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);U=Re(me)});export{U as E,Ne as __tla};