@ehfuse/overlay-scrollbar 1.7.31 → 1.7.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +160 -160
- package/dist/OverlayScrollbar.d.ts.map +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/utils/dragScrollUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var tt=Object.defineProperty;var to=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ro=Object.prototype.hasOwnProperty;var no=(r,i)=>{for(var d in i)tt(r,d,{get:i[d],enumerable:!0})},lo=(r,i,d,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let v of oo(i))!ro.call(r,v)&&v!==d&&tt(r,v,{get:()=>i[v],enumerable:!(u=to(i,v))||u.enumerable});return r};var io=r=>lo(tt({},"__esModule",{value:!0}),r);var xo={};no(xo,{OverlayScrollbar:()=>rt,default:()=>rt});module.exports=io(xo);var e=require("react");var ao=["editor","textarea","input","select","textfield","form-control","contenteditable","MuiInputBase-input","MuiSelect-select","MuiOutlinedInput-input","MuiFilledInput-input","MuiInput-input","MuiFormControl-root","MuiTextField-root","MuiSelect-root","MuiOutlinedInput-root","MuiFilledInput-root","MuiInput-root","MuiAutocomplete-input","MuiDatePicker-input","MuiSlider-thumb","MuiSlider-rail","MuiSlider-track","MuiSlider-mark","MuiSlider-markLabel","MuiSlider-root","MuiSlider-colorPrimary","MuiSlider-sizeMedium","MuiIconButton-root","MuiButton-root","MuiButtonBase-root","MuiTouchRipple-root","MuiCheckbox-root","MuiRadio-root","MuiSwitch-root","PrivateSwitchBase-root","ant-input","ant-input-affix-wrapper","ant-input-group-addon","ant-input-number","ant-input-number-handler","ant-select","ant-select-selector","ant-select-selection-search","ant-select-dropdown","ant-cascader","ant-cascader-input","ant-picker","ant-picker-input","ant-time-picker","ant-calendar-picker","ant-slider","ant-slider-track","ant-slider-handle","ant-switch","ant-checkbox","ant-checkbox-wrapper","ant-radio","ant-radio-wrapper","ant-rate","ant-upload","ant-upload-drag","ant-form-item","ant-form-item-control","ant-btn","ant-dropdown","ant-dropdown-trigger","ant-menu","ant-menu-item","ant-tooltip","ant-popover","ant-modal","ant-drawer","ant-tree-select","ant-auto-complete","ant-mentions","ant-transfer","ui-input","ui-textarea","ui-select","ui-select-trigger","ui-select-content","ui-select-item","ui-button","ui-checkbox","ui-radio-group","ui-switch","ui-slider","ui-range-slider","ui-calendar","ui-date-picker","ui-combobox","ui-command","ui-command-input","ui-popover","ui-dialog","ui-sheet","ui-dropdown-menu","ui-context-menu","ui-menubar","ui-navigation-menu","ui-form","ui-form-control","ui-form-item","ui-form-field","ui-label","radix-ui","radix-select","radix-dropdown","radix-dialog","radix-popover","radix-accordion","radix-tabs","radix-slider","radix-switch","radix-checkbox","radix-radio","ql-editor","ql-container","ql-toolbar","ql-picker","ql-picker-label","ql-picker-options","ql-formats","ql-snow","ql-bubble","quill","quilleditor","monaco-editor","monaco-editor-background","view-lines","decorationsOverviewRuler","monaco-scrollable-element","CodeMirror","CodeMirror-code","CodeMirror-lines","CodeMirror-scroll","CodeMirror-sizer","cm-editor","cm-focused","cm-content","tox-editor-container","tox-editor-header","tox-edit-area","tox-tinymce","mce-content-body","ck-editor","ck-content","ck-toolbar","ck-editor__editable","ck-widget","slate-editor","slate-content","DraftEditor-root","DraftEditor-editorContainer","public-DraftEditor-content","ehfuse-editor","ehfuse-editor-wrapper","ehfuse-editor-content","ehfuse-toolbar","ehfuse-toolbar-group","ehfuse-cursor","text-editor","rich-text-editor","wysiwyg","ace_editor","ace_content"],Ie=(r,i)=>{if(r instanceof HTMLElement&&r.isContentEditable||r.closest('[role="textbox"],[role="searchbox"]'))return!0;let d=r.tagName.toLowerCase();if(d==="input"){let u=(r.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(u)}if(["textarea","select","button"].includes(d)||["svg","path","circle","rect","line","polygon","polyline"].includes(d)||r.getAttribute("contenteditable")==="true")return!0;if(i?.excludeSelectors){for(let u of i.excludeSelectors)if(r.matches(u))return!0}return so(r,i)},so=(r,i)=>{let d=[...ao,...i?.excludeClasses||[]],u=r,v=0,E=5;for(;u&&v<=E;){if(d.some(R=>u.classList.contains(R)))return!0;if(u.classList.contains("MuiDialogContent-root"))break;u=u.parentElement,v++}return!1};var co=r=>{if(r==null)return null;if(typeof r=="number")return Number.isFinite(r)?r:null;let i=r.trim();if(i==="")return null;let d=/^(-?\d*\.?\d+)(px)?$/.exec(i);if(!d)return null;let u=Number.parseFloat(d[1]);return Number.isFinite(u)?u:null},uo=r=>{if(r==null)return;if(typeof r=="number")return r;let i=r.trim().split(/\s+/);if(!(i.length===0||i[0]===""))return i.length===1||i.length===2?i[0]:i[2]},fo=r=>{let i=typeof r=="number"?[`${r}px`]:r.trim().split(/\s+/),[d,u=d,v=d,E=u]=i;return`${d} ${u} 0 ${E}`},ot=r=>{if(!r)return{style:r,spacerHeight:0};let i=r.paddingBottom!==void 0,d=r.padding!==void 0;if(!i&&!d)return{style:r,spacerHeight:0};let u=i?r.paddingBottom:uo(r.padding),v=co(u);if(v===null||v<=0)return{style:r,spacerHeight:0};let E={...r};return d&&r.padding!==void 0&&(E.padding=fo(r.padding)),i&&(E.paddingBottom=0),{style:E,spacerHeight:v}};var I=require("react"),St=({containerRef:r,config:i})=>{let d=i.enabled??!0,u=i.threshold??80,v=i.maxDistance??u*2,E=i.onRefresh,[R,k]=(0,I.useState)(0),[O,_]=(0,I.useState)(!1),W=(0,I.useRef)(0),fe=(0,I.useRef)(0),q=(0,I.useRef)(!1),V=(0,I.useRef)(!1),te=(0,I.useRef)(!1),X=(0,I.useRef)(0),oe=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{oe.current=O},[O]),(0,I.useEffect)(()=>{let S=r.current;if(!S||!(d&&typeof E=="function"))return;let Se=m=>{let D=m instanceof Element?m:null;for(;D&&D!==S;){if(D instanceof HTMLElement&&D.scrollHeight>D.clientHeight+1&&D.scrollTop>0)return!1;D=D.parentElement}return!0},Oe=m=>{q.current=!1,V.current=!1,te.current=!1,!oe.current&&m.touches.length===1&&S.scrollTop===0&&Se(m.target)&&(q.current=!0,W.current=m.touches[0].clientY,fe.current=m.touches[0].clientX)},Z=m=>{if(!q.current||oe.current||m.touches.length!==1)return;let D=m.touches[0].clientY-W.current,Ae=m.touches[0].clientX-fe.current;if(!V.current){if(D<=0||S.scrollTop>0){q.current=!1;return}if(D>8&&D>Math.abs(Ae))V.current=!0,te.current=S.scrollTop<0;else return}!te.current&&m.cancelable&&m.preventDefault();let ne=Math.min(Math.max(D,0)*.5,v);X.current=ne,k(ne)},Y=()=>{if(!q.current||(q.current=!1,!V.current))return;V.current=!1,te.current=!1;let m=X.current;X.current=0,m>=u&&!oe.current?(_(!0),k(u),Promise.resolve().then(()=>E()).catch(()=>{}).finally(()=>{_(!1),k(0)})):k(0)};return S.addEventListener("touchstart",Oe,{passive:!0}),S.addEventListener("touchmove",Z,{passive:!1}),S.addEventListener("touchend",Y,{passive:!0}),S.addEventListener("touchcancel",Y,{passive:!0}),()=>{S.removeEventListener("touchstart",Oe),S.removeEventListener("touchmove",Z),S.removeEventListener("touchend",Y),S.removeEventListener("touchcancel",Y)}},[r,d,E,u,v]),{pullDistance:R,isRefreshing:O,pullProgress:Math.min(R/u,1),pullThreshold:u}};var $e=require("react");function Et(){let[r,i]=(0,$e.useState)(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(pointer: coarse)").matches);return(0,$e.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let d=window.matchMedia("(pointer: coarse)"),u=v=>i(v.matches);return i(d.matches),typeof d.addEventListener=="function"?(d.addEventListener("change",u),()=>d.removeEventListener("change",u)):(d.addListener(u),()=>d.removeListener(u))},[]),r}var y=require("react/jsx-runtime"),po={},mo={},ho={},bo={},go={},vo={},yo=(0,e.forwardRef)(({className:r="",style:i={},containerStyle:d={},contentStyle:u={},children:v,onScroll:E,thumb:R=po,track:k=mo,arrows:O=ho,dragScroll:_=bo,autoHide:W=go,pullToRefresh:fe=vo,showScrollbar:q=!0,showHorizontalScrollbar:V=!0,detectInnerScroll:te=!1,scrollTopFab:X=!1},oe)=>{let S=Et(),re=q,Se=S?!1:V,Z=`os-${(0,e.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,Y=X!==!1&&X!=null,m=typeof X=="object"?X:{},D=m.threshold??600,Ae=m.idleOpacity??m.scrollingOpacity??.45,ne=m.hideDelay??1500,Mt=m.position??"right",nt=m.offset??16,Ct=m.offsetBottom??nt,Ht=m.background??"#1976d2",Lt=m.color??"#ffffff",Ee=m.size??48,[We,lt]=(0,e.useState)(!1),[Dt,pe]=(0,e.useState)(!1),Q=(0,e.useRef)(null),Rt=(0,e.useRef)({});(0,e.useEffect)(()=>{Rt.current={children:v,onScroll:E,showScrollbar:re,showHorizontalScrollbar:Se,thumb:R,track:k,arrows:O,dragScroll:_,autoHide:W}});let ze=(0,e.useRef)(null),c=(0,e.useRef)(null),me=(0,e.useRef)(null),he=(0,e.useRef)(null),kt=(0,e.useRef)(null),B=(0,e.useRef)(null),{pullDistance:Be,isRefreshing:Me,pullProgress:Fe}=St({containerRef:c,config:fe}),it=fe.indicatorColor??"#1976d2",Pt=Be>0||Me,[Ce,M]=(0,e.useState)(!1),[F,at]=(0,e.useState)(!1),[st,ct]=(0,e.useState)(!1),[Ne,It]=(0,e.useState)({y:0,scrollTop:0}),[be,ut]=(0,e.useState)(0),[$t,Ue]=(0,e.useState)(0),[le,dt]=(0,e.useState)(!1),[ft,pt]=(0,e.useState)(!1),[N,mt]=(0,e.useState)(!1),[_e,Ot]=(0,e.useState)({x:0,scrollLeft:0}),[qe,ht]=(0,e.useState)(0),[Xe,bt]=(0,e.useState)(0),[At,gt]=(0,e.useState)(!1),ie=(0,e.useRef)(!1),[ae,vt]=(0,e.useState)(!1),Ye=(0,e.useRef)(!1),[ge,Wt]=(0,e.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[To,wo]=(0,e.useState)(null),[He,Le]=(0,e.useState)(null),[So,zt]=(0,e.useState)(!1),[Bt,Ft]=(0,e.useState)(0),ve=(0,e.useRef)(null),je=(0,e.useRef)(!1),ye=(0,e.useRef)(null),J=(0,e.useRef)(null),ee=(0,e.useRef)(null),C=(0,e.useMemo)(()=>{let t=R.color??"#606060";return{width:R.width??8,minHeight:R.minHeight??50,radius:R.radius??(R.width??8)/2,color:t,opacity:R.opacity??.6,hoverColor:R.hoverColor??t,hoverOpacity:R.hoverOpacity??1}},[R]),a=(0,e.useMemo)(()=>({width:k.width??16,color:k.color??"rgba(128, 128, 128, 0.1)",visible:k.visible??!0,alignment:k.alignment??"outside",radius:k.radius??C.radius??4,margin:k.margin??4,overflowX:k.overflowX??!0,overflowY:k.overflowY??!0}),[k,C.radius]),z=(0,e.useMemo)(()=>{let t=O.color??"#808080";return{visible:O.visible??!1,step:O.step??50,color:t,opacity:O.opacity??.6,hoverColor:O.hoverColor??t,hoverOpacity:O.hoverOpacity??1}},[O]),xe=(0,e.useMemo)(()=>({enabled:S?!1:_.enabled??!0,excludeClasses:_.excludeClasses??[],excludeSelectors:_.excludeSelectors??[]}),[_,S]),f=(0,e.useMemo)(()=>({enabled:W.enabled??!0,delay:W.delay??1500,delayOnWheel:W.delayOnWheel??700,initialDelay:W.initialDelay??200}),[W]),[se,Nt]=(0,e.useState)(()=>(W.initialDelay??200)>0),T=C.width,Ut=a.width,Ge=C.minHeight,U=z.visible,De=z.step,A=(0,e.useCallback)(()=>{if(!c.current)return;let t=document.activeElement;t&&c.current.contains(t)&&t!==c.current||c.current.focus()},[]);(0,e.useImperativeHandle)(oe,()=>({getScrollContainer:()=>c.current,scrollTo:t=>{c.current&&c.current.scrollTo(t)},get scrollTop(){return c.current?.scrollTop||0},get scrollHeight(){return c.current?.scrollHeight||0},get clientHeight(){return c.current?.clientHeight||0}}),[]);let b=(0,e.useCallback)(()=>{if(B.current){let o=B.current;if(document.contains(o)&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return o;B.current=null}if(!c.current)return null;if(c.current.scrollHeight>c.current.clientHeight+2||c.current.scrollWidth>c.current.clientWidth+2)return B.current=c.current,c.current;if(!te)return null;let t=c.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of t){let n=o;if(n!==c.current&&n.classList.contains("overlay-scrollbar-container"))continue;let s=n.parentElement,l=!1;for(;s&&s!==c.current;){if(s.classList.contains("overlay-scrollbar-container")&&s!==c.current){l=!0;break}s=s.parentElement}if(!l&&(n.scrollHeight>n.clientHeight+2||n.scrollWidth>n.clientWidth+2))return B.current=n,n}return null},[]),j=(0,e.useCallback)(()=>b()!==null,[b]),H=(0,e.useCallback)(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null)},[]),Re=(0,e.useCallback)(()=>{J.current&&(clearTimeout(J.current),J.current=null)},[]),yt=(0,e.useCallback)(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),_t=(0,e.useCallback)(()=>{Re(),!(F||N||ae||ie.current)&&(H(),M(!1))},[H,Re,F,N,ae]),x=(0,e.useCallback)(t=>{f.enabled&&(H(),ye.current=setTimeout(()=>{M(!1),ye.current=null},t))},[H,f.enabled]),g=(0,e.useCallback)(()=>{let t=b()??c.current;if(!t){M(!1),dt(!1),gt(!1),H();return}!f.enabled&&!se&&(M(!0),H());let o=t.clientHeight,n=t.scrollHeight,s=t.scrollTop,l=t.clientWidth,p=t.scrollWidth,w=t.scrollLeft,L=n-o>0,h=p-l>0,ue=L||h;dt(L),gt(h),ue||(M(!1),H());let Te=0,$=0;if(ze.current){let G=window.getComputedStyle(ze.current),K=parseFloat(G.paddingTop)||0;$=parseFloat(G.paddingBottom)||0,Te=K+$,Ft($)}if(L){let G=U?T*2+a.margin*4:a.margin*2,K=o-G+Te,Pe=o/n,de=Math.max(K*Pe,Ge),wt=n-o,Jt=K-de,eo=wt>0?s/wt*Jt:0;ut(de),Ue(eo)}else ut(0),Ue(0);let we=p-l;if(we>0){let G=l/p,K=Math.max(l*G,50),Pe=l-K,de=we>0?w/we*Pe:0;ht(K),bt(de)}else ht(0),bt(0)},[b,H,U,T,Ge,f.enabled,se]),qt=(0,e.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=b();o&&(at(!0),It({y:t.clientY,scrollTop:o.scrollTop}),H(),M(!0),A())},[b,H,A]),Ke=(0,e.useCallback)(t=>{if(!F)return;let o=b();if(!o)return;let n=o.clientHeight,l=o.scrollHeight-n,p=t.clientY-Ne.y,w=n-be,L=p/w*l,h=Math.max(0,Math.min(l,Ne.scrollTop+L));o.scrollTop=h,g()},[F,Ne,be,g,b]),Ve=(0,e.useCallback)(()=>{at(!1),j()&&x(f.delay)},[j,x,f.delay]),Xt=(0,e.useCallback)(t=>{if(!he.current)return;let n=he.current.getBoundingClientRect(),s=t.clientY-n.top,l=b();if(!l)return;let p=l.clientHeight,w=l.scrollHeight,h=s/p*(w-p);l.scrollTop=Math.max(0,Math.min(w-p,h)),g(),M(!0),x(f.delay),A()},[g,x,f.delay,b,A]),Yt=(0,e.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!c.current)return;let o=Math.max(0,c.current.scrollTop-De);c.current.scrollTop=o,g(),M(!0),x(f.delay),A()},[g,x,De,f.delay,A]),jt=(0,e.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!c.current||!me.current)return;let o=c.current,s=me.current.scrollHeight-o.clientHeight,l=Math.min(s,o.scrollTop+De);o.scrollTop=l,g(),M(!0),x(f.delay),A()},[g,x,De,f.delay,A]),Gt=(0,e.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=b();o&&(mt(!0),Ot({x:t.clientX,scrollLeft:o.scrollLeft}),H(),M(!0),A())},[b,H,A]),Ze=(0,e.useCallback)(t=>{if(!N)return;let o=b();if(!o)return;let n=o.clientWidth,l=o.scrollWidth-n,p=t.clientX-_e.x,w=n-qe,L=p/w*l,h=Math.max(0,Math.min(l,_e.scrollLeft+L));o.scrollLeft=h,g()},[N,_e,qe,g,b]),Qe=(0,e.useCallback)(()=>{mt(!1),j()&&x(f.delay)},[j,x,f.delay]),Kt=(0,e.useCallback)(t=>{if(!he.current)return;let n=he.current.getBoundingClientRect(),s=t.clientX-n.left,l=b();if(!l)return;let p=l.clientWidth,w=l.scrollWidth,h=s/p*(w-p);l.scrollLeft=Math.max(0,Math.min(w-p,h)),g(),M(!0),x(f.delay),A()},[g,x,f.delay,b,A]),Vt=(0,e.useCallback)(t=>{if(!xe.enabled||t.defaultPrevented)return;let o=t.target,n=c.current;if(!n||!n.contains(o)||Ie(o,xe)||t.button!==0)return;let s=b();if(!s||s.scrollHeight<=s.clientHeight&&s.scrollWidth<=s.clientWidth)return;t.preventDefault();let l=document.activeElement;l instanceof HTMLElement&&l!==document.body&&!l.contains(o)&&l.blur(),ie.current=!0,Wt({x:t.clientX,y:t.clientY,scrollTop:s.scrollTop,scrollLeft:s.scrollLeft||0})},[xe,Ie,b]),Je=(0,e.useCallback)(t=>{if(!ie.current&&!ae)return;let o=b();if(!o)return;let n=ge.x-t.clientX,s=ge.y-t.clientY;if(Math.abs(s)<5&&Math.abs(n)<5)return;ie.current&&(ie.current=!1,Ye.current=!0,vt(!0)),M(!0);let l=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,ge.scrollTop+s)),p=Math.max(0,Math.min(o.scrollWidth-o.clientWidth,ge.scrollLeft+n));o.scrollTop=l,o.scrollLeft=p,g()},[ae,ge,b,g]),et=(0,e.useCallback)(()=>{let t=Ye.current;ie.current=!1,Ye.current=!1,vt(!1),t&&j()&&x(f.delay)},[j,x,f.delay]);(0,e.useEffect)(()=>{let t=p=>{if(g(),Y){let h=(p.target?.scrollTop??0)>D;lt(h),Q.current&&(clearTimeout(Q.current),Q.current=null),h&&ne>0&&(Q.current=setTimeout(()=>{Q.current=null,lt(!1)},ne))}if(se){E&&E(p);return}H(),M(!0),yt();let w=je.current?f.delayOnWheel:f.delay;x(w),E&&E(p)},o=()=>{je.current=!0,ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{je.current=!1},300),yt(),ee.current=setTimeout(()=>{M(!0),ee.current=null,x(f.delayOnWheel)},50)},n=[],s=b();s&&n.push(s);let l=c.current;return l&&!s&&(n.push(l),l.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(w=>{let L=w;if(L!==l&&L.classList.contains("overlay-scrollbar-container"))return;let h=L.parentElement;for(;h&&h!==l;){if(h.classList.contains("overlay-scrollbar-container")&&h!==l)return;h=h.parentElement}n.push(L)})),n.forEach(p=>{p.addEventListener("scroll",t,{passive:!0}),p.addEventListener("wheel",o,{passive:!0})}),()=>{n.forEach(p=>{p.removeEventListener("scroll",t),p.removeEventListener("wheel",o)})}},[b,g,E,H,x,f,se,Y,D,ne]),(0,e.useEffect)(()=>()=>{Q.current&&clearTimeout(Q.current),ve.current&&clearTimeout(ve.current),ee.current&&clearTimeout(ee.current)},[]),(0,e.useEffect)(()=>{let t=n=>{let s=n.target;if(n.defaultPrevented||s instanceof Element&&Ie(s,xe))return;let l=b();if(!l)return;let{key:p}=n,{scrollTop:w,scrollHeight:L,clientHeight:h}=l,ue=L-h,Te=50,$=null;switch(p){case"ArrowUp":n.preventDefault(),$=Math.max(0,w-Te);break;case"ArrowDown":n.preventDefault(),$=Math.min(ue,w+Te);break;case"PageUp":n.preventDefault(),$=Math.max(0,w-h);break;case"PageDown":n.preventDefault(),$=Math.min(ue,w+h);break;case"Home":n.preventDefault(),$=0;break;case"End":n.preventDefault(),$=ue;break;default:return}if($!==null){let we=$/ue,G=U?T*2+a.margin*4:a.margin*2,de=(h-G-be)*we;Ue(de),l.scrollTop=$,H(),M(!0),x(f.delay)}},o=c.current;if(o)return o.addEventListener("keydown",t),()=>{o.removeEventListener("keydown",t)}},[b,U,T,a.margin,be,H,x,f.delay,xe]),(0,e.useEffect)(()=>(document.addEventListener("mousemove",Je),document.addEventListener("mouseup",et),()=>{document.removeEventListener("mousemove",Je),document.removeEventListener("mouseup",et)}),[ae,Je,et]),(0,e.useEffect)(()=>{if(F)return document.addEventListener("mousemove",Ke),document.addEventListener("mouseup",Ve),()=>{document.removeEventListener("mousemove",Ke),document.removeEventListener("mouseup",Ve)}},[F,Ke,Ve]),(0,e.useEffect)(()=>{if(N)return document.addEventListener("mousemove",Ze),document.addEventListener("mouseup",Qe),()=>{document.removeEventListener("mousemove",Ze),document.removeEventListener("mouseup",Qe)}},[N,Ze,Qe]),(0,e.useEffect)(()=>{g();let t=setTimeout(()=>{g()},100);return()=>clearTimeout(t)},[g]),(0,e.useLayoutEffect)(()=>{zt(!0),g(),!f.enabled&&!se&&j()&&M(!0)},[j,g,f.enabled,se]),(0,e.useEffect)(()=>{if(f.initialDelay>0){let t=setTimeout(()=>{Nt(!1)},f.initialDelay);return()=>clearTimeout(t)}},[f.initialDelay]);let xt=(0,e.useRef)(g);xt.current=g;let ce=(0,e.useRef)(null),ke=(0,e.useCallback)(()=>{ce.current===null&&(ce.current=requestAnimationFrame(()=>{ce.current=null,xt.current()}))},[]);(0,e.useEffect)(()=>()=>{ce.current!==null&&(cancelAnimationFrame(ce.current),ce.current=null)},[]),(0,e.useEffect)(()=>{let t=new ResizeObserver(()=>{ke()}),o=[];return c.current&&o.push(c.current),me.current&&o.push(me.current),B.current&&document.contains(B.current)&&o.push(B.current),o.forEach(n=>{t.observe(n)}),()=>t.disconnect()},[g,ke]),(0,e.useEffect)(()=>{if(!c.current)return;let t=new MutationObserver(()=>{B.current=null,ke()});return t.observe(c.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[ke]);let P=Math.max(Ut,T);(0,e.useEffect)(()=>{let t="overlay-scrollbar-shared";if(document.getElementById(t))return;let o=document.createElement("style");o.id=t,o.textContent=`
|
|
1
|
+
"use strict";var et=Object.defineProperty;var to=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ro=Object.prototype.hasOwnProperty;var no=(r,i)=>{for(var d in i)et(r,d,{get:i[d],enumerable:!0})},lo=(r,i,d,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let v of oo(i))!ro.call(r,v)&&v!==d&&et(r,v,{get:()=>i[v],enumerable:!(u=to(i,v))||u.enumerable});return r};var io=r=>lo(et({},"__esModule",{value:!0}),r);var xo={};no(xo,{OverlayScrollbar:()=>ot,default:()=>ot});module.exports=io(xo);var e=require("react");var ao=["editor","textarea","input","select","textfield","form-control","contenteditable","MuiInputBase-input","MuiSelect-select","MuiOutlinedInput-input","MuiFilledInput-input","MuiInput-input","MuiFormControl-root","MuiTextField-root","MuiSelect-root","MuiOutlinedInput-root","MuiFilledInput-root","MuiInput-root","MuiAutocomplete-input","MuiDatePicker-input","MuiSlider-thumb","MuiSlider-rail","MuiSlider-track","MuiSlider-mark","MuiSlider-markLabel","MuiSlider-root","MuiSlider-colorPrimary","MuiSlider-sizeMedium","MuiIconButton-root","MuiButton-root","MuiButtonBase-root","MuiTouchRipple-root","MuiCheckbox-root","MuiRadio-root","MuiSwitch-root","PrivateSwitchBase-root","ant-input","ant-input-affix-wrapper","ant-input-group-addon","ant-input-number","ant-input-number-handler","ant-select","ant-select-selector","ant-select-selection-search","ant-select-dropdown","ant-cascader","ant-cascader-input","ant-picker","ant-picker-input","ant-time-picker","ant-calendar-picker","ant-slider","ant-slider-track","ant-slider-handle","ant-switch","ant-checkbox","ant-checkbox-wrapper","ant-radio","ant-radio-wrapper","ant-rate","ant-upload","ant-upload-drag","ant-form-item","ant-form-item-control","ant-btn","ant-dropdown","ant-dropdown-trigger","ant-menu","ant-menu-item","ant-tooltip","ant-popover","ant-modal","ant-drawer","ant-tree-select","ant-auto-complete","ant-mentions","ant-transfer","ui-input","ui-textarea","ui-select","ui-select-trigger","ui-select-content","ui-select-item","ui-button","ui-checkbox","ui-radio-group","ui-switch","ui-slider","ui-range-slider","ui-calendar","ui-date-picker","ui-combobox","ui-command","ui-command-input","ui-popover","ui-dialog","ui-sheet","ui-dropdown-menu","ui-context-menu","ui-menubar","ui-navigation-menu","ui-form","ui-form-control","ui-form-item","ui-form-field","ui-label","radix-ui","radix-select","radix-dropdown","radix-dialog","radix-popover","radix-accordion","radix-tabs","radix-slider","radix-switch","radix-checkbox","radix-radio","ql-editor","ql-container","ql-toolbar","ql-picker","ql-picker-label","ql-picker-options","ql-formats","ql-snow","ql-bubble","quill","quilleditor","monaco-editor","monaco-editor-background","view-lines","decorationsOverviewRuler","monaco-scrollable-element","CodeMirror","CodeMirror-code","CodeMirror-lines","CodeMirror-scroll","CodeMirror-sizer","cm-editor","cm-focused","cm-content","tox-editor-container","tox-editor-header","tox-edit-area","tox-tinymce","mce-content-body","ck-editor","ck-content","ck-toolbar","ck-editor__editable","ck-widget","slate-editor","slate-content","DraftEditor-root","DraftEditor-editorContainer","public-DraftEditor-content","ehfuse-editor","ehfuse-editor-wrapper","ehfuse-editor-content","ehfuse-toolbar","ehfuse-toolbar-group","ehfuse-cursor","text-editor","rich-text-editor","wysiwyg","ace_editor","ace_content"],Pe=(r,i)=>{if(r instanceof HTMLElement&&r.isContentEditable||r.closest('[role="textbox"],[role="searchbox"]'))return!0;let d=r.tagName.toLowerCase();if(d==="input"){let u=(r.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(u)}if(["textarea","select","button"].includes(d)||["svg","path","circle","rect","line","polygon","polyline"].includes(d)||r.getAttribute("contenteditable")==="true")return!0;if(i?.excludeSelectors){for(let u of i.excludeSelectors)if(r.matches(u))return!0}return so(r,i)},so=(r,i)=>{if(r.closest('[data-drag-scroll="off"]'))return!0;let d=[...ao,...i?.excludeClasses||[]],u=r,v=0,E=5;for(;u&&v<=E;){if(d.some(D=>u.classList.contains(D)))return!0;if(u.classList.contains("MuiDialogContent-root"))break;u=u.parentElement,v++}return!1};var co=r=>{if(r==null)return null;if(typeof r=="number")return Number.isFinite(r)?r:null;let i=r.trim();if(i==="")return null;let d=/^(-?\d*\.?\d+)(px)?$/.exec(i);if(!d)return null;let u=Number.parseFloat(d[1]);return Number.isFinite(u)?u:null},uo=r=>{if(r==null)return;if(typeof r=="number")return r;let i=r.trim().split(/\s+/);if(!(i.length===0||i[0]===""))return i.length===1||i.length===2?i[0]:i[2]},fo=r=>{let i=typeof r=="number"?[`${r}px`]:r.trim().split(/\s+/),[d,u=d,v=d,E=u]=i;return`${d} ${u} 0 ${E}`},tt=r=>{if(!r)return{style:r,spacerHeight:0};let i=r.paddingBottom!==void 0,d=r.padding!==void 0;if(!i&&!d)return{style:r,spacerHeight:0};let u=i?r.paddingBottom:uo(r.padding),v=co(u);if(v===null||v<=0)return{style:r,spacerHeight:0};let E={...r};return d&&r.padding!==void 0&&(E.padding=fo(r.padding)),i&&(E.paddingBottom=0),{style:E,spacerHeight:v}};var I=require("react"),St=({containerRef:r,config:i})=>{let d=i.enabled??!0,u=i.threshold??80,v=i.maxDistance??u*2,E=i.onRefresh,[D,k]=(0,I.useState)(0),[O,_]=(0,I.useState)(!1),A=(0,I.useRef)(0),fe=(0,I.useRef)(0),q=(0,I.useRef)(!1),V=(0,I.useRef)(!1),te=(0,I.useRef)(!1),X=(0,I.useRef)(0),oe=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{oe.current=O},[O]),(0,I.useEffect)(()=>{let S=r.current;if(!S||!(d&&typeof E=="function"))return;let Se=m=>{let R=m instanceof Element?m:null;for(;R&&R!==S;){if(R instanceof HTMLElement&&R.scrollHeight>R.clientHeight+1&&R.scrollTop>0)return!1;R=R.parentElement}return!0},$e=m=>{q.current=!1,V.current=!1,te.current=!1,!oe.current&&m.touches.length===1&&S.scrollTop===0&&Se(m.target)&&(q.current=!0,A.current=m.touches[0].clientY,fe.current=m.touches[0].clientX)},Z=m=>{if(!q.current||oe.current||m.touches.length!==1)return;let R=m.touches[0].clientY-A.current,Oe=m.touches[0].clientX-fe.current;if(!V.current){if(R<=0||S.scrollTop>0){q.current=!1;return}if(R>8&&R>Math.abs(Oe))V.current=!0,te.current=S.scrollTop<0;else return}!te.current&&m.cancelable&&m.preventDefault();let ne=Math.min(Math.max(R,0)*.5,v);X.current=ne,k(ne)},Y=()=>{if(!q.current||(q.current=!1,!V.current))return;V.current=!1,te.current=!1;let m=X.current;X.current=0,m>=u&&!oe.current?(_(!0),k(u),Promise.resolve().then(()=>E()).catch(()=>{}).finally(()=>{_(!1),k(0)})):k(0)};return S.addEventListener("touchstart",$e,{passive:!0}),S.addEventListener("touchmove",Z,{passive:!1}),S.addEventListener("touchend",Y,{passive:!0}),S.addEventListener("touchcancel",Y,{passive:!0}),()=>{S.removeEventListener("touchstart",$e),S.removeEventListener("touchmove",Z),S.removeEventListener("touchend",Y),S.removeEventListener("touchcancel",Y)}},[r,d,E,u,v]),{pullDistance:D,isRefreshing:O,pullProgress:Math.min(D/u,1),pullThreshold:u}};var Ie=require("react");function Et(){let[r,i]=(0,Ie.useState)(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(pointer: coarse)").matches);return(0,Ie.useEffect)(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let d=window.matchMedia("(pointer: coarse)"),u=v=>i(v.matches);return i(d.matches),typeof d.addEventListener=="function"?(d.addEventListener("change",u),()=>d.removeEventListener("change",u)):(d.addListener(u),()=>d.removeListener(u))},[]),r}var y=require("react/jsx-runtime"),po={},mo={},ho={},bo={},go={},vo={},yo=(0,e.forwardRef)(({className:r="",style:i={},containerStyle:d={},contentStyle:u={},children:v,onScroll:E,thumb:D=po,track:k=mo,arrows:O=ho,dragScroll:_=bo,autoHide:A=go,pullToRefresh:fe=vo,showScrollbar:q=!0,showHorizontalScrollbar:V=!0,detectInnerScroll:te=!1,scrollTopFab:X=!1},oe)=>{let S=Et(),re=q,Se=S?!1:V,Z=`os-${(0,e.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,Y=X!==!1&&X!=null,m=typeof X=="object"?X:{},R=m.threshold??600,Oe=m.idleOpacity??m.scrollingOpacity??.45,ne=m.hideDelay??1500,Mt=m.position??"right",rt=m.offset??16,Ct=m.offsetBottom??rt,Ht=m.background??"#1976d2",Lt=m.color??"#ffffff",Ee=m.size??48,[ze,nt]=(0,e.useState)(!1),[Rt,pe]=(0,e.useState)(!1),Q=(0,e.useRef)(null),Dt=(0,e.useRef)({});(0,e.useEffect)(()=>{Dt.current={children:v,onScroll:E,showScrollbar:re,showHorizontalScrollbar:Se,thumb:D,track:k,arrows:O,dragScroll:_,autoHide:A}});let Ae=(0,e.useRef)(null),c=(0,e.useRef)(null),me=(0,e.useRef)(null),he=(0,e.useRef)(null),kt=(0,e.useRef)(null),B=(0,e.useRef)(null),{pullDistance:We,isRefreshing:Me,pullProgress:Be}=St({containerRef:c,config:fe}),lt=fe.indicatorColor??"#1976d2",Pt=We>0||Me,[Ce,M]=(0,e.useState)(!1),[F,it]=(0,e.useState)(!1),[at,st]=(0,e.useState)(!1),[Fe,It]=(0,e.useState)({y:0,scrollTop:0}),[be,ct]=(0,e.useState)(0),[$t,Ne]=(0,e.useState)(0),[le,ut]=(0,e.useState)(!1),[dt,ft]=(0,e.useState)(!1),[N,pt]=(0,e.useState)(!1),[Ue,Ot]=(0,e.useState)({x:0,scrollLeft:0}),[_e,mt]=(0,e.useState)(0),[qe,ht]=(0,e.useState)(0),[zt,bt]=(0,e.useState)(!1),ie=(0,e.useRef)(!1),[ae,gt]=(0,e.useState)(!1),Xe=(0,e.useRef)(!1),[ge,At]=(0,e.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[To,wo]=(0,e.useState)(null),[He,Le]=(0,e.useState)(null),[So,Wt]=(0,e.useState)(!1),[Bt,Ft]=(0,e.useState)(0),ve=(0,e.useRef)(null),Ye=(0,e.useRef)(!1),ye=(0,e.useRef)(null),J=(0,e.useRef)(null),ee=(0,e.useRef)(null),C=(0,e.useMemo)(()=>{let t=D.color??"#606060";return{width:D.width??8,minHeight:D.minHeight??50,radius:D.radius??(D.width??8)/2,color:t,opacity:D.opacity??.6,hoverColor:D.hoverColor??t,hoverOpacity:D.hoverOpacity??1}},[D]),a=(0,e.useMemo)(()=>({width:k.width??16,color:k.color??"rgba(128, 128, 128, 0.1)",visible:k.visible??!0,alignment:k.alignment??"outside",radius:k.radius??C.radius??4,margin:k.margin??4,overflowX:k.overflowX??!0,overflowY:k.overflowY??!0}),[k,C.radius]),W=(0,e.useMemo)(()=>{let t=O.color??"#808080";return{visible:O.visible??!1,step:O.step??50,color:t,opacity:O.opacity??.6,hoverColor:O.hoverColor??t,hoverOpacity:O.hoverOpacity??1}},[O]),xe=(0,e.useMemo)(()=>({enabled:S?!1:_.enabled??!0,excludeClasses:_.excludeClasses??[],excludeSelectors:_.excludeSelectors??[]}),[_,S]),f=(0,e.useMemo)(()=>({enabled:A.enabled??!0,delay:A.delay??1500,delayOnWheel:A.delayOnWheel??700,initialDelay:A.initialDelay??200}),[A]),[se,Nt]=(0,e.useState)(()=>(A.initialDelay??200)>0),T=C.width,Ut=a.width,je=C.minHeight,U=W.visible,Re=W.step,z=(0,e.useCallback)(()=>{if(!c.current)return;let t=document.activeElement;t&&c.current.contains(t)&&t!==c.current||c.current.focus()},[]);(0,e.useImperativeHandle)(oe,()=>({getScrollContainer:()=>c.current,scrollTo:t=>{c.current&&c.current.scrollTo(t)},get scrollTop(){return c.current?.scrollTop||0},get scrollHeight(){return c.current?.scrollHeight||0},get clientHeight(){return c.current?.clientHeight||0}}),[]);let g=(0,e.useCallback)(()=>{if(B.current){let o=B.current;if(document.contains(o)&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return o;B.current=null}if(!c.current)return null;if(c.current.scrollHeight>c.current.clientHeight+2||c.current.scrollWidth>c.current.clientWidth+2)return B.current=c.current,c.current;if(!te)return null;let t=c.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of t){let n=o;if(n!==c.current&&n.classList.contains("overlay-scrollbar-container"))continue;let s=n.parentElement,l=!1;for(;s&&s!==c.current;){if(s.classList.contains("overlay-scrollbar-container")&&s!==c.current){l=!0;break}s=s.parentElement}if(!l&&(n.scrollHeight>n.clientHeight+2||n.scrollWidth>n.clientWidth+2))return B.current=n,n}return null},[]),j=(0,e.useCallback)(()=>g()!==null,[g]),H=(0,e.useCallback)(()=>{ye.current&&(clearTimeout(ye.current),ye.current=null)},[]),De=(0,e.useCallback)(()=>{J.current&&(clearTimeout(J.current),J.current=null)},[]),vt=(0,e.useCallback)(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),_t=(0,e.useCallback)(()=>{De(),!(F||N||ae||ie.current)&&(H(),M(!1))},[H,De,F,N,ae]),x=(0,e.useCallback)(t=>{f.enabled&&(H(),ye.current=setTimeout(()=>{M(!1),ye.current=null},t))},[H,f.enabled]),h=(0,e.useCallback)(()=>{let t=g()??c.current;if(!t){M(!1),ut(!1),bt(!1),H();return}!f.enabled&&!se&&(M(!0),H());let o=t.clientHeight,n=t.scrollHeight,s=t.scrollTop,l=t.clientWidth,p=t.scrollWidth,w=t.scrollLeft,L=n-o>0,b=p-l>0,ue=L||b;ut(L),bt(b),ue||(M(!1),H());let Te=0,$=0;if(Ae.current){let G=window.getComputedStyle(Ae.current),K=parseFloat(G.paddingTop)||0;$=parseFloat(G.paddingBottom)||0,Te=K+$,Ft($)}if(L){let G=U?T*2+a.margin*4:a.margin*2,K=o-G+Te,ke=o/n,de=Math.max(K*ke,je),wt=n-o,Jt=K-de,eo=wt>0?s/wt*Jt:0;ct(de),Ne(eo)}else ct(0),Ne(0);let we=p-l;if(we>0){let G=l/p,K=Math.max(l*G,50),ke=l-K,de=we>0?w/we*ke:0;mt(K),ht(de)}else mt(0),ht(0)},[g,H,U,T,je,f.enabled,se]),qt=(0,e.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=g();o&&(it(!0),It({y:t.clientY,scrollTop:o.scrollTop}),H(),M(!0),z())},[g,H,z]),Ge=(0,e.useCallback)(t=>{if(!F)return;let o=g();if(!o)return;let n=o.clientHeight,l=o.scrollHeight-n,p=t.clientY-Fe.y,w=n-be,L=p/w*l,b=Math.max(0,Math.min(l,Fe.scrollTop+L));o.scrollTop=b,h()},[F,Fe,be,h,g]),Ke=(0,e.useCallback)(()=>{it(!1),j()&&x(f.delay)},[j,x,f.delay]),Xt=(0,e.useCallback)(t=>{if(!he.current)return;let n=he.current.getBoundingClientRect(),s=t.clientY-n.top,l=g();if(!l)return;let p=l.clientHeight,w=l.scrollHeight,b=s/p*(w-p);l.scrollTop=Math.max(0,Math.min(w-p,b)),h(),M(!0),x(f.delay),z()},[h,x,f.delay,g,z]),Yt=(0,e.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!c.current)return;let o=Math.max(0,c.current.scrollTop-Re);c.current.scrollTop=o,h(),M(!0),x(f.delay),z()},[h,x,Re,f.delay,z]),jt=(0,e.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!c.current||!me.current)return;let o=c.current,s=me.current.scrollHeight-o.clientHeight,l=Math.min(s,o.scrollTop+Re);o.scrollTop=l,h(),M(!0),x(f.delay),z()},[h,x,Re,f.delay,z]),Gt=(0,e.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=g();o&&(pt(!0),Ot({x:t.clientX,scrollLeft:o.scrollLeft}),H(),M(!0),z())},[g,H,z]),Ve=(0,e.useCallback)(t=>{if(!N)return;let o=g();if(!o)return;let n=o.clientWidth,l=o.scrollWidth-n,p=t.clientX-Ue.x,w=n-_e,L=p/w*l,b=Math.max(0,Math.min(l,Ue.scrollLeft+L));o.scrollLeft=b,h()},[N,Ue,_e,h,g]),Ze=(0,e.useCallback)(()=>{pt(!1),j()&&x(f.delay)},[j,x,f.delay]),Kt=(0,e.useCallback)(t=>{if(!he.current)return;let n=he.current.getBoundingClientRect(),s=t.clientX-n.left,l=g();if(!l)return;let p=l.clientWidth,w=l.scrollWidth,b=s/p*(w-p);l.scrollLeft=Math.max(0,Math.min(w-p,b)),h(),M(!0),x(f.delay),z()},[h,x,f.delay,g,z]),Vt=(0,e.useCallback)(t=>{if(!xe.enabled||t.defaultPrevented)return;let o=t.target,n=c.current;if(!n||!n.contains(o)||Pe(o,xe)||t.button!==0)return;let s=g();if(!s||s.scrollHeight<=s.clientHeight&&s.scrollWidth<=s.clientWidth)return;t.preventDefault();let l=document.activeElement;l instanceof HTMLElement&&l!==document.body&&!l.contains(o)&&l.blur(),ie.current=!0,At({x:t.clientX,y:t.clientY,scrollTop:s.scrollTop,scrollLeft:s.scrollLeft||0})},[xe,Pe,g]),Qe=(0,e.useCallback)(t=>{if(!ie.current&&!ae)return;let o=g();if(!o)return;let n=ge.x-t.clientX,s=ge.y-t.clientY;if(Math.abs(s)<5&&Math.abs(n)<5)return;ie.current&&(ie.current=!1,Xe.current=!0,gt(!0)),M(!0);let l=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,ge.scrollTop+s)),p=Math.max(0,Math.min(o.scrollWidth-o.clientWidth,ge.scrollLeft+n));o.scrollTop=l,o.scrollLeft=p,h()},[ae,ge,g,h]),Je=(0,e.useCallback)(()=>{let t=Xe.current;ie.current=!1,Xe.current=!1,gt(!1),t&&j()&&x(f.delay)},[j,x,f.delay]);(0,e.useEffect)(()=>{let t=p=>{if(h(),Y){let b=(p.target?.scrollTop??0)>R;nt(b),Q.current&&(clearTimeout(Q.current),Q.current=null),b&&ne>0&&(Q.current=setTimeout(()=>{Q.current=null,nt(!1)},ne))}if(se){E&&E(p);return}H(),M(!0),vt();let w=Ye.current?f.delayOnWheel:f.delay;x(w),E&&E(p)},o=()=>{Ye.current=!0,ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{Ye.current=!1},300),vt(),ee.current=setTimeout(()=>{M(!0),ee.current=null,x(f.delayOnWheel)},50)},n=[],s=g();s&&n.push(s);let l=c.current;return l&&!s&&(n.push(l),l.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(w=>{let L=w;if(L!==l&&L.classList.contains("overlay-scrollbar-container"))return;let b=L.parentElement;for(;b&&b!==l;){if(b.classList.contains("overlay-scrollbar-container")&&b!==l)return;b=b.parentElement}n.push(L)})),n.forEach(p=>{p.addEventListener("scroll",t,{passive:!0}),p.addEventListener("wheel",o,{passive:!0})}),()=>{n.forEach(p=>{p.removeEventListener("scroll",t),p.removeEventListener("wheel",o)})}},[g,h,E,H,x,f,se,Y,R,ne]),(0,e.useEffect)(()=>()=>{Q.current&&clearTimeout(Q.current),ve.current&&clearTimeout(ve.current),ee.current&&clearTimeout(ee.current)},[]),(0,e.useEffect)(()=>{let t=n=>{let s=n.target;if(n.defaultPrevented||s instanceof Element&&Pe(s,xe))return;let l=g();if(!l)return;let{key:p}=n,{scrollTop:w,scrollHeight:L,clientHeight:b}=l,ue=L-b,Te=50,$=null;switch(p){case"ArrowUp":n.preventDefault(),$=Math.max(0,w-Te);break;case"ArrowDown":n.preventDefault(),$=Math.min(ue,w+Te);break;case"PageUp":n.preventDefault(),$=Math.max(0,w-b);break;case"PageDown":n.preventDefault(),$=Math.min(ue,w+b);break;case"Home":n.preventDefault(),$=0;break;case"End":n.preventDefault(),$=ue;break;default:return}if($!==null){let we=$/ue,G=U?T*2+a.margin*4:a.margin*2,de=(b-G-be)*we;Ne(de),l.scrollTop=$,H(),M(!0),x(f.delay)}},o=c.current;if(o)return o.addEventListener("keydown",t),()=>{o.removeEventListener("keydown",t)}},[g,U,T,a.margin,be,H,x,f.delay,xe]),(0,e.useEffect)(()=>(document.addEventListener("mousemove",Qe),document.addEventListener("mouseup",Je),()=>{document.removeEventListener("mousemove",Qe),document.removeEventListener("mouseup",Je)}),[ae,Qe,Je]),(0,e.useEffect)(()=>{if(F)return document.addEventListener("mousemove",Ge),document.addEventListener("mouseup",Ke),()=>{document.removeEventListener("mousemove",Ge),document.removeEventListener("mouseup",Ke)}},[F,Ge,Ke]),(0,e.useEffect)(()=>{if(N)return document.addEventListener("mousemove",Ve),document.addEventListener("mouseup",Ze),()=>{document.removeEventListener("mousemove",Ve),document.removeEventListener("mouseup",Ze)}},[N,Ve,Ze]),(0,e.useEffect)(()=>{h();let t=setTimeout(()=>{h()},100);return()=>clearTimeout(t)},[h]),(0,e.useLayoutEffect)(()=>{Wt(!0),h(),!f.enabled&&!se&&j()&&M(!0)},[j,h,f.enabled,se]),(0,e.useEffect)(()=>{if(f.initialDelay>0){let t=setTimeout(()=>{Nt(!1)},f.initialDelay);return()=>clearTimeout(t)}},[f.initialDelay]);let yt=(0,e.useRef)(h);yt.current=h;let ce=(0,e.useRef)(null),xt=(0,e.useCallback)(()=>{ce.current===null&&(ce.current=requestAnimationFrame(()=>{ce.current=null,yt.current()}))},[]);(0,e.useEffect)(()=>()=>{ce.current!==null&&(cancelAnimationFrame(ce.current),ce.current=null)},[]),(0,e.useEffect)(()=>{let t=new ResizeObserver(()=>{xt()}),o=[];return c.current&&o.push(c.current),me.current&&o.push(me.current),B.current&&document.contains(B.current)&&o.push(B.current),o.forEach(n=>{t.observe(n)}),()=>t.disconnect()},[h,xt]),(0,e.useEffect)(()=>{if(!c.current)return;let t=new MutationObserver(()=>{B.current=null,h()});return t.observe(c.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[h]);let P=Math.max(Ut,T);(0,e.useEffect)(()=>{let t="overlay-scrollbar-shared";if(document.getElementById(t))return;let o=document.createElement("style");o.id=t,o.textContent=`
|
|
2
2
|
/* ehfuse-editor-content\uB294 \uC2A4\uD06C\uB864\uBC14 \uC720\uC9C0 */
|
|
3
3
|
.overlay-scrollbar-container .ehfuse-editor-content {
|
|
4
4
|
scrollbar-width: thin !important;
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
height: 0 !important;
|
|
39
39
|
}
|
|
40
40
|
${s}::-webkit-scrollbar-track { display: none !important; }
|
|
41
|
-
${s}::-webkit-scrollbar-thumb { display: none !important; }`,document.head.appendChild(n),()=>{document.getElementById(t)?.remove()}},[Z]);let{normalizedContainerStyle:Zt,normalizedContentStyle:Qt,bottomSpacerHeight:Tt}=(0,e.useMemo)(()=>{let t=
|
|
41
|
+
${s}::-webkit-scrollbar-thumb { display: none !important; }`,document.head.appendChild(n),()=>{document.getElementById(t)?.remove()}},[Z]);let{normalizedContainerStyle:Zt,normalizedContentStyle:Qt,bottomSpacerHeight:Tt}=(0,e.useMemo)(()=>{let t=tt(d),o=tt(u);return{normalizedContainerStyle:t.style,normalizedContentStyle:o.style,bottomSpacerHeight:t.spacerHeight+o.spacerHeight}},[d,u]);return(0,y.jsxs)("div",{ref:Ae,className:`overlay-scrollbar-wrapper ${r}`,onMouseLeave:_t,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",overflow:"visible",...i},children:[Pt&&(0,y.jsx)("div",{className:"overlay-scrollbar-pull-indicator",style:{position:"absolute",top:0,left:"50%",transform:`translate(-50%, ${We-68}px)`,transition:Me?"transform 0.15s ease-out":We===0?"transform 0.2s ease-out":"none",width:60,height:60,borderRadius:"50%",background:"#ffffff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.25)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1001,pointerEvents:"none",opacity:Me?1:Math.min(Be*1.5,1)},children:Me?(0,y.jsx)("svg",{width:"36",height:"36",viewBox:"0 0 24 24",style:{animation:"overlay-scrollbar-ptr-spin 0.8s linear infinite"},children:(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:lt,strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:"42",strokeDashoffset:"14"})}):(0,y.jsx)("svg",{width:"36",height:"36",viewBox:"0 0 24 24",style:{transform:`rotate(${Be*270}deg)`,opacity:Be>=1?1:.6},children:(0,y.jsx)("path",{d:"M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z",fill:lt})})}),(0,y.jsx)("div",{ref:c,className:`overlay-scrollbar-container ${Z}`,tabIndex:-1,onMouseDown:Vt,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",outline:"none",userSelect:ae?"none":"auto",...Zt},children:(0,y.jsxs)("div",{ref:me,className:"overlay-scrollbar-content",style:{flex:"1 1 auto",display:"flex",flexDirection:"column",boxSizing:"border-box",...Qt},children:[v,Tt>0&&(0,y.jsx)("div",{className:"overlay-scrollbar-bottom-spacer","aria-hidden":"true",style:{flex:"0 0 auto",height:Tt}})]})}),re&&le&&(a.overflowY??!0)&&(0,y.jsxs)("div",{ref:he,className:"overlay-scrollbar-track",onMouseEnter:()=>{S||(H(),J.current=setTimeout(()=>{M(!0),J.current=null},100))},onMouseLeave:()=>{De(),F||x(f.delay)},style:{position:"absolute",top:0,right:0,width:`${P}px`,height:"100%",opacity:Ce?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[a.visible&&(0,y.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:t=>{t.preventDefault(),t.stopPropagation(),Xt(t)},style:{position:"absolute",top:U?`${C.width+a.margin*2}px`:`${a.margin}px`,right:a.alignment==="outside"?"0px":`${(P-C.width)/2}px`,width:`${C.width}px`,height:U?`calc(100% - ${C.width*2+a.margin*4}px)`:`calc(100% - ${a.margin*2}px)`,backgroundColor:a.color,borderRadius:`${a.radius}px`,cursor:"pointer"}}),(0,y.jsx)("div",{ref:kt,className:"overlay-scrollbar-thumb",onMouseDown:qt,onMouseEnter:()=>st(!0),onMouseLeave:()=>st(!1),style:{position:"absolute",top:`${(U?T+a.margin*2:a.margin)+$t}px`,right:a.alignment==="outside"?"0px":`${(P-T)/2}px`,width:`${T}px`,height:`${Math.max(be,je)}px`,backgroundColor:at||F?C.hoverColor:C.color,opacity:at||F?C.hoverOpacity:C.opacity,borderRadius:`${C.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),re&&le&&U&&(0,y.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:Yt,onMouseEnter:()=>Le("up"),onMouseLeave:()=>Le(null),style:{position:"absolute",top:`${a.margin}px`,right:a.alignment==="outside"?"0px":`${(P-T)/2}px`,width:`${T}px`,height:`${T}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(T*.75,8)}px`,color:He==="up"?W.hoverColor:W.color,userSelect:"none",zIndex:1001,opacity:Ce?He==="up"?W.hoverOpacity:W.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),re&&le&&U&&(0,y.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:jt,onMouseEnter:()=>Le("down"),onMouseLeave:()=>Le(null),style:{position:"absolute",bottom:`${a.margin}px`,right:a.alignment==="outside"?"0px":`${(P-T)/2}px`,width:`${T}px`,height:`${T}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(T*.75,8)}px`,color:He==="down"?W.hoverColor:W.color,userSelect:"none",zIndex:1001,opacity:Ce?He==="down"?W.hoverOpacity:W.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"}),re&&Se&&zt&&(a.overflowX??!0)&&(0,y.jsxs)("div",{className:"overlay-scrollbar-horizontal-track",onMouseEnter:()=>{S||(H(),J.current=setTimeout(()=>{M(!0),J.current=null},100))},onMouseLeave:()=>{De(),N||x(f.delay)},style:{position:"absolute",bottom:`${Bt}px`,left:0,width:"100%",height:`${P}px`,opacity:Ce?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[a.visible&&(0,y.jsx)("div",{className:"overlay-scrollbar-horizontal-track-background",onClick:t=>{t.preventDefault(),t.stopPropagation(),Kt(t)},style:{position:"absolute",bottom:a.alignment==="outside"?"0px":`${(P-T)/2}px`,left:`${a.margin}px`,right:le?a.alignment==="outside"?`${P-a.margin}px`:`${P}px`:`${a.margin}px`,height:`${T}px`,backgroundColor:a.color,borderRadius:`${a.radius}px`,cursor:"pointer"}}),(0,y.jsx)("div",{className:"overlay-scrollbar-horizontal-thumb",onMouseDown:Gt,onMouseEnter:()=>ft(!0),onMouseLeave:()=>ft(!1),style:{position:"absolute",bottom:a.alignment==="outside"?"0px":`${(P-T)/2}px`,left:`${a.margin+qe}px`,right:le?a.alignment==="outside"?`${P-a.margin}px`:`${P}px`:"auto",maxWidth:le?a.alignment==="outside"?`calc(100% - ${a.margin+qe+P-a.margin}px)`:`calc(100% - ${a.margin+qe+P}px)`:"none",width:`${Math.max(_e,50)}px`,height:`${T}px`,backgroundColor:dt||N?C.hoverColor:C.color,opacity:dt||N?C.hoverOpacity:C.opacity,borderRadius:`${C.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),Y&&(0,y.jsx)("button",{type:"button","aria-label":"\uB9E8 \uC704\uB85C",onClick:()=>{pe(!1),c.current?.scrollTo({top:0,behavior:"smooth"})},onPointerDown:()=>pe(!0),onPointerUp:()=>pe(!1),onPointerLeave:()=>pe(!1),onPointerCancel:()=>pe(!1),style:{position:"absolute",[Mt]:rt,bottom:Ct,zIndex:1200,width:Ee,height:Ee,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"50%",backgroundColor:Ht,color:Lt,boxShadow:"0 3px 8px rgba(15, 23, 42, 0.28)",cursor:"pointer",opacity:ze?Rt?1:Oe:0,pointerEvents:ze?"auto":"none",transition:ze?"opacity 0.15s ease":"opacity 0.45s ease"},children:(0,y.jsxs)("svg",{width:Math.round(Ee*.5),height:Math.round(Ee*.5),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,y.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),(0,y.jsx)("polyline",{points:"5 12 12 5 19 12"})]})})]})}),ot=yo;
|
|
42
42
|
//# sourceMappingURL=index.js.map
|