@ehfuse/overlay-scrollbar 1.7.22 → 1.7.24
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/dist/OverlayScrollbar.d.ts.map +1 -1
- package/dist/index.esm.js +6 -6
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +6 -6
- package/dist/index.js.map +4 -4
- package/dist/utils/bottomSpacerUtils.d.ts +22 -0
- package/dist/utils/bottomSpacerUtils.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Ze=Object.defineProperty;var jt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Kt=Object.prototype.hasOwnProperty;var Vt=(d,f)=>{for(var g in f)Ze(d,g,{get:f[g],enumerable:!0})},Zt=(d,f,g,u)=>{if(f&&typeof f=="object"||typeof f=="function")for(let S of Gt(f))!Kt.call(d,S)&&S!==g&&Ze(d,S,{get:()=>f[S],enumerable:!(u=jt(f,S))||u.enumerable});return d};var Qt=d=>Zt(Ze({},"__esModule",{value:!0}),d);var so={};Vt(so,{OverlayScrollbar:()=>Qe,default:()=>Qe});module.exports=Qt(so);var e=require("react");var Jt=["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"],Re=(d,f)=>{if(d instanceof HTMLElement&&d.isContentEditable||d.closest('[role="textbox"],[role="searchbox"]'))return!0;let g=d.tagName.toLowerCase();if(g==="input"){let u=(d.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(u)}if(["textarea","select","button"].includes(g)||["svg","path","circle","rect","line","polygon","polyline"].includes(g)||d.getAttribute("contenteditable")==="true")return!0;if(f?.excludeSelectors){for(let u of f.excludeSelectors)if(d.matches(u))return!0}return eo(d,f)},eo=(d,f)=>{let g=[...Jt,...f?.excludeClasses||[]],u=d,S=0,O=5;for(;u&&S<=O;){if(g.some(D=>u.classList.contains(D)))return!0;if(u.classList.contains("MuiDialogContent-root"))break;u=u.parentElement,S++}return!1};var I=require("react"),vt=({containerRef:d,config:f})=>{let g=f.enabled??!0,u=f.threshold??80,S=f.maxDistance??u*2,O=f.onRefresh,[D,k]=(0,I.useState)(0),[$,U]=(0,I.useState)(!1),A=(0,I.useRef)(0),de=(0,I.useRef)(0),X=(0,I.useRef)(!1),Z=(0,I.useRef)(!1),oe=(0,I.useRef)(!1),q=(0,I.useRef)(0),re=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{re.current=$},[$]),(0,I.useEffect)(()=>{let C=d.current;if(!C||!(g&&typeof O=="function"))return;let we=p=>{let L=p instanceof Element?p:null;for(;L&&L!==C;){if(L instanceof HTMLElement&&L.scrollHeight>L.clientHeight+1&&L.scrollTop>0)return!1;L=L.parentElement}return!0},Pe=p=>{X.current=!1,Z.current=!1,oe.current=!1,!re.current&&p.touches.length===1&&C.scrollTop===0&&we(p.target)&&(X.current=!0,A.current=p.touches[0].clientY,de.current=p.touches[0].clientX)},Q=p=>{if(!X.current||re.current||p.touches.length!==1)return;let L=p.touches[0].clientY-A.current,Oe=p.touches[0].clientX-de.current;if(!Z.current){if(L<=0||C.scrollTop>0){X.current=!1;return}if(L>8&&L>Math.abs(Oe))Z.current=!0,oe.current=C.scrollTop<0;else return}!oe.current&&p.cancelable&&p.preventDefault();let le=Math.min(Math.max(L,0)*.5,S);q.current=le,k(le)},Y=()=>{if(!X.current||(X.current=!1,!Z.current))return;Z.current=!1,oe.current=!1;let p=q.current;q.current=0,p>=u&&!re.current?(U(!0),k(u),Promise.resolve().then(()=>O()).catch(()=>{}).finally(()=>{U(!1),k(0)})):k(0)};return C.addEventListener("touchstart",Pe,{passive:!0}),C.addEventListener("touchmove",Q,{passive:!1}),C.addEventListener("touchend",Y,{passive:!0}),C.addEventListener("touchcancel",Y,{passive:!0}),()=>{C.removeEventListener("touchstart",Pe),C.removeEventListener("touchmove",Q),C.removeEventListener("touchend",Y),C.removeEventListener("touchcancel",Y)}},[d,g,O,u,S]),{pullDistance:D,isRefreshing:$,pullProgress:Math.min(D/u,1),pullThreshold:u}};var Ie=require("react");function yt(){let[d,f]=(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 g=window.matchMedia("(pointer: coarse)"),u=S=>f(S.matches);return f(g.matches),typeof g.addEventListener=="function"?(g.addEventListener("change",u),()=>g.removeEventListener("change",u)):(g.addListener(u),()=>g.removeListener(u))},[]),d}var y=require("react/jsx-runtime"),to={},oo={},ro={},no={},lo={},io={},ao=(0,e.forwardRef)(({className:d="",style:f={},containerStyle:g={},contentStyle:u={},children:S,onScroll:O,thumb:D=to,track:k=oo,arrows:$=ro,dragScroll:U=no,autoHide:A=lo,pullToRefresh:de=io,showScrollbar:X=!0,showHorizontalScrollbar:Z=!0,detectInnerScroll:oe=!1,scrollTopFab:q=!1},re)=>{let C=yt(),ne=X,we=C?!1:Z,Q=`os-${(0,e.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,Y=q!==!1&&q!=null,p=typeof q=="object"?q:{},L=p.threshold??600,Oe=p.idleOpacity??p.scrollingOpacity??.45,le=p.hideDelay??1500,xt=p.position??"right",Je=p.offset??16,Tt=p.background??"#1976d2",wt=p.color??"#ffffff",Me=p.size??48,[$e,et]=(0,e.useState)(!1),[Mt,fe]=(0,e.useState)(!1),J=(0,e.useRef)(null),Et=(0,e.useRef)({});(0,e.useEffect)(()=>{Et.current={children:S,onScroll:O,showScrollbar:ne,showHorizontalScrollbar:we,thumb:D,track:k,arrows:$,dragScroll:U,autoHide:A}});let We=(0,e.useRef)(null),a=(0,e.useRef)(null),pe=(0,e.useRef)(null),he=(0,e.useRef)(null),St=(0,e.useRef)(null),F=(0,e.useRef)(null),{pullDistance:Ae,isRefreshing:Ee,pullProgress:ze}=vt({containerRef:a,config:de}),tt=de.indicatorColor??"#1976d2",Ct=Ae>0||Ee,[Se,M]=(0,e.useState)(!1),[N,ot]=(0,e.useState)(!1),[rt,nt]=(0,e.useState)(!1),[Fe,Ht]=(0,e.useState)({y:0,scrollTop:0}),[me,lt]=(0,e.useState)(0),[Lt,Ne]=(0,e.useState)(0),[ie,it]=(0,e.useState)(!1),[at,st]=(0,e.useState)(!1),[B,ct]=(0,e.useState)(!1),[Be,Dt]=(0,e.useState)({x:0,scrollLeft:0}),[_e,ut]=(0,e.useState)(0),[Ue,dt]=(0,e.useState)(0),[kt,ft]=(0,e.useState)(!1),ae=(0,e.useRef)(!1),[j,pt]=(0,e.useState)(!1),[be,Rt]=(0,e.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[co,uo]=(0,e.useState)(null),[Ce,He]=(0,e.useState)(null),[fo,It]=(0,e.useState)(!1),[Pt,Ot]=(0,e.useState)(0),ge=(0,e.useRef)(null),[ht,mt]=(0,e.useState)(!1),ve=(0,e.useRef)(null),ee=(0,e.useRef)(null),te=(0,e.useRef)(null),E=(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]),n=(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??E.radius??4,margin:k.margin??4,overflowX:k.overflowX??!0,overflowY:k.overflowY??!0}),[k,E.radius]),z=(0,e.useMemo)(()=>{let t=$.color??"#808080";return{visible:$.visible??!1,step:$.step??50,color:t,opacity:$.opacity??.6,hoverColor:$.hoverColor??t,hoverOpacity:$.hoverOpacity??1}},[$]),ye=(0,e.useMemo)(()=>({enabled:C?!1:U.enabled??!0,excludeClasses:U.excludeClasses??[],excludeSelectors:U.excludeSelectors??[]}),[U,C]),s=(0,e.useMemo)(()=>({enabled:A.enabled??!0,delay:A.delay??1500,delayOnWheel:A.delayOnWheel??700,initialDelay:A.initialDelay??200}),[A]),[se,$t]=(0,e.useState)(()=>(A.initialDelay??200)>0),x=E.width,Wt=n.width,Xe=E.minHeight,_=z.visible,Le=z.step,W=(0,e.useCallback)(()=>{if(!a.current)return;let t=document.activeElement;t&&a.current.contains(t)&&t!==a.current||a.current.focus()},[]);(0,e.useImperativeHandle)(re,()=>({getScrollContainer:()=>a.current,scrollTo:t=>{a.current&&a.current.scrollTo(t)},get scrollTop(){return a.current?.scrollTop||0},get scrollHeight(){return a.current?.scrollHeight||0},get clientHeight(){return a.current?.clientHeight||0}}),[]);let b=(0,e.useCallback)(()=>{if(F.current){let o=F.current;if(document.contains(o)&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return o;F.current=null}if(!a.current)return null;if(a.current.scrollHeight>a.current.clientHeight+2||a.current.scrollWidth>a.current.clientWidth+2)return F.current=a.current,a.current;if(!oe)return null;let t=a.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of t){let r=o;if(r!==a.current&&r.classList.contains("overlay-scrollbar-container"))continue;let l=r.parentElement,i=!1;for(;l&&l!==a.current;){if(l.classList.contains("overlay-scrollbar-container")&&l!==a.current){i=!0;break}l=l.parentElement}if(!i&&(r.scrollHeight>r.clientHeight+2||r.scrollWidth>r.clientWidth+2))return F.current=r,r}return null},[]),G=(0,e.useCallback)(()=>b()!==null,[b]),T=(0,e.useCallback)(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null)},[]),De=(0,e.useCallback)(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),bt=(0,e.useCallback)(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),At=(0,e.useCallback)(()=>{De(),!(N||B||j||ae.current)&&(T(),M(!1))},[T,De,N,B,j]),v=(0,e.useCallback)(t=>{s.enabled&&(T(),ve.current=setTimeout(()=>{M(!1),ve.current=null},t))},[T,s.enabled]),h=(0,e.useCallback)(()=>{let t=b()??a.current;if(!t){M(!1),it(!1),ft(!1),T();return}!s.enabled&&!se&&(M(!0),T());let o=t.clientHeight,r=t.scrollHeight,l=t.scrollTop,i=t.clientWidth,c=t.scrollWidth,w=t.scrollLeft,H=r-o>0,m=c-i>0,ce=H||m;it(H),ft(m),ce||(M(!1),T());let xe=0,P=0;if(We.current){let K=window.getComputedStyle(We.current),V=parseFloat(K.paddingTop)||0;P=parseFloat(K.paddingBottom)||0,xe=V+P,Ot(P)}if(H){let K=_?x*2+n.margin*4:n.margin*2,V=o-K+xe,ke=o/r,ue=Math.max(V*ke,Xe),gt=r-o,qt=V-ue,Yt=gt>0?l/gt*qt:0;lt(ue),Ne(Yt)}else lt(0),Ne(0);let Te=c-i;if(Te>0){let K=i/c,V=Math.max(i*K,50),ke=i-V,ue=Te>0?w/Te*ke:0;ut(V),dt(ue)}else ut(0),dt(0)},[b,T,_,x,Xe,s.enabled,se]),zt=(0,e.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=b();o&&(ot(!0),Ht({y:t.clientY,scrollTop:o.scrollTop}),T(),M(!0),W())},[b,T,W]),qe=(0,e.useCallback)(t=>{if(!N)return;let o=b();if(!o)return;let r=o.clientHeight,i=o.scrollHeight-r,c=t.clientY-Fe.y,w=r-me,H=c/w*i,m=Math.max(0,Math.min(i,Fe.scrollTop+H));o.scrollTop=m,h()},[N,Fe,me,h,b]),Ye=(0,e.useCallback)(()=>{ot(!1),G()&&v(s.delay)},[G,v,s.delay]),Ft=(0,e.useCallback)(t=>{if(!he.current)return;let r=he.current.getBoundingClientRect(),l=t.clientY-r.top,i=b();if(!i)return;let c=i.clientHeight,w=i.scrollHeight,m=l/c*(w-c);i.scrollTop=Math.max(0,Math.min(w-c,m)),h(),M(!0),v(s.delay),W()},[h,v,s.delay,b,W]),Nt=(0,e.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!a.current)return;let o=Math.max(0,a.current.scrollTop-Le);a.current.scrollTop=o,h(),M(!0),v(s.delay),W()},[h,v,Le,s.delay,W]),Bt=(0,e.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!a.current||!pe.current)return;let o=a.current,l=pe.current.scrollHeight-o.clientHeight,i=Math.min(l,o.scrollTop+Le);o.scrollTop=i,h(),M(!0),v(s.delay),W()},[h,v,Le,s.delay,W]),_t=(0,e.useCallback)(t=>{t.preventDefault(),t.stopPropagation();let o=b();o&&(ct(!0),Dt({x:t.clientX,scrollLeft:o.scrollLeft}),T(),M(!0),W())},[b,T,W]),je=(0,e.useCallback)(t=>{if(!B)return;let o=b();if(!o)return;let r=o.clientWidth,i=o.scrollWidth-r,c=t.clientX-Be.x,w=r-_e,H=c/w*i,m=Math.max(0,Math.min(i,Be.scrollLeft+H));o.scrollLeft=m,h()},[B,Be,_e,h,b]),Ge=(0,e.useCallback)(()=>{ct(!1),G()&&v(s.delay)},[G,v,s.delay]),Ut=(0,e.useCallback)(t=>{if(!he.current)return;let r=he.current.getBoundingClientRect(),l=t.clientX-r.left,i=b();if(!i)return;let c=i.clientWidth,w=i.scrollWidth,m=l/c*(w-c);i.scrollLeft=Math.max(0,Math.min(w-c,m)),h(),M(!0),v(s.delay),W()},[h,v,s.delay,b,W]),Xt=(0,e.useCallback)(t=>{if(!ye.enabled||t.defaultPrevented)return;let o=t.target,r=a.current;if(!r||!r.contains(o)||Re(o,ye)||t.button!==0)return;let l=b();l&&(l.scrollHeight<=l.clientHeight&&l.scrollWidth<=l.clientWidth||(t.preventDefault(),ae.current=!0,Rt({x:t.clientX,y:t.clientY,scrollTop:l.scrollTop,scrollLeft:l.scrollLeft||0}),T()))},[ye,Re,b,T]),Ke=(0,e.useCallback)(t=>{if(!ae.current&&!j)return;let o=b();if(!o)return;let r=be.x-t.clientX,l=be.y-t.clientY;if(Math.abs(l)<5&&Math.abs(r)<5)return;ae.current&&(ae.current=!1,pt(!0)),M(!0);let i=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,be.scrollTop+l)),c=Math.max(0,Math.min(o.scrollWidth-o.clientWidth,be.scrollLeft+r));o.scrollTop=i,o.scrollLeft=c,h()},[j,be,b,h]),Ve=(0,e.useCallback)(()=>{let t=j;ae.current=!1,pt(!1),t&&G()&&v(s.delay)},[j,G,v,s.delay]);(0,e.useEffect)(()=>{let t=c=>{if(h(),Y){let m=(c.target?.scrollTop??0)>L;et(m),J.current&&(clearTimeout(J.current),J.current=null),m&&le>0&&(J.current=setTimeout(()=>{J.current=null,et(!1)},le))}if(se){O&&O(c);return}T(),M(!0),bt();let w=ht?s.delayOnWheel:s.delay;v(w),O&&O(c)},o=()=>{mt(!0),ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>{mt(!1)},300),bt(),te.current=setTimeout(()=>{M(!0),te.current=null,v(s.delayOnWheel)},50)},r=[],l=b();l&&r.push(l);let i=a.current;return i&&!l&&(r.push(i),i.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(w=>{let H=w;if(H!==i&&H.classList.contains("overlay-scrollbar-container"))return;let m=H.parentElement;for(;m&&m!==i;){if(m.classList.contains("overlay-scrollbar-container")&&m!==i)return;m=m.parentElement}r.push(H)})),r.forEach(c=>{c.addEventListener("scroll",t,{passive:!0}),c.addEventListener("wheel",o,{passive:!0})}),()=>{r.forEach(c=>{c.removeEventListener("scroll",t),c.removeEventListener("wheel",o)}),ge.current&&clearTimeout(ge.current),te.current&&clearTimeout(te.current)}},[b,h,O,T,v,s,ht,se,Y,L,le]),(0,e.useEffect)(()=>()=>{J.current&&clearTimeout(J.current)},[]),(0,e.useEffect)(()=>{let t=r=>{let l=r.target;if(r.defaultPrevented||l instanceof Element&&Re(l,ye))return;let i=b();if(!i)return;let{key:c}=r,{scrollTop:w,scrollHeight:H,clientHeight:m}=i,ce=H-m,xe=50,P=null;switch(c){case"ArrowUp":r.preventDefault(),P=Math.max(0,w-xe);break;case"ArrowDown":r.preventDefault(),P=Math.min(ce,w+xe);break;case"PageUp":r.preventDefault(),P=Math.max(0,w-m);break;case"PageDown":r.preventDefault(),P=Math.min(ce,w+m);break;case"Home":r.preventDefault(),P=0;break;case"End":r.preventDefault(),P=ce;break;default:return}if(P!==null){let Te=P/ce,K=_?x*2+n.margin*4:n.margin*2,ue=(m-K-me)*Te;Ne(ue),i.scrollTop=P,T(),M(!0),v(s.delay)}},o=a.current;if(o)return o.addEventListener("keydown",t),()=>{o.removeEventListener("keydown",t)}},[b,_,x,n.margin,me,T,v,s.delay,ye]),(0,e.useEffect)(()=>(document.addEventListener("mousemove",Ke),document.addEventListener("mouseup",Ve),()=>{document.removeEventListener("mousemove",Ke),document.removeEventListener("mouseup",Ve)}),[j,Ke,Ve]),(0,e.useEffect)(()=>{if(N)return document.addEventListener("mousemove",qe),document.addEventListener("mouseup",Ye),()=>{document.removeEventListener("mousemove",qe),document.removeEventListener("mouseup",Ye)}},[N,qe,Ye]),(0,e.useEffect)(()=>{if(B)return document.addEventListener("mousemove",je),document.addEventListener("mouseup",Ge),()=>{document.removeEventListener("mousemove",je),document.removeEventListener("mouseup",Ge)}},[B,je,Ge]),(0,e.useEffect)(()=>{h();let t=setTimeout(()=>{h()},100);return()=>clearTimeout(t)},[h]),(0,e.useLayoutEffect)(()=>{It(!0),h(),!s.enabled&&!se&&G()&&M(!0)},[G,h,s.enabled,se]),(0,e.useEffect)(()=>{if(s.initialDelay>0){let t=setTimeout(()=>{$t(!1)},s.initialDelay);return()=>clearTimeout(t)}},[s.initialDelay]),(0,e.useEffect)(()=>{let t=new ResizeObserver(()=>{h()}),o=[];return a.current&&o.push(a.current),pe.current&&o.push(pe.current),F.current&&document.contains(F.current)&&o.push(F.current),o.forEach(r=>{t.observe(r)}),()=>t.disconnect()},[h]),(0,e.useEffect)(()=>{if(!a.current)return;let t=new MutationObserver(()=>{F.current=null,h()});return t.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>t.disconnect()},[h]);let R=Math.max(Wt,x);return(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 Qe=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Jt=Object.prototype.hasOwnProperty;var eo=(r,l)=>{for(var d in l)Qe(r,d,{get:l[d],enumerable:!0})},to=(r,l,d,u)=>{if(l&&typeof l=="object"||typeof l=="function")for(let v of Qt(l))!Jt.call(r,v)&&v!==d&&Qe(r,v,{get:()=>l[v],enumerable:!(u=Zt(l,v))||u.enumerable});return r};var oo=r=>to(Qe({},"__esModule",{value:!0}),r);var bo={};eo(bo,{OverlayScrollbar:()=>et,default:()=>et});module.exports=oo(bo);var t=require("react");var ro=["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,l)=>{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(l?.excludeSelectors){for(let u of l.excludeSelectors)if(r.matches(u))return!0}return no(r,l)},no=(r,l)=>{let d=[...ro,...l?.excludeClasses||[]],u=r,v=0,C=5;for(;u&&v<=C;){if(d.some(k=>u.classList.contains(k)))return!0;if(u.classList.contains("MuiDialogContent-root"))break;u=u.parentElement,v++}return!1};var lo=r=>{if(r==null)return null;if(typeof r=="number")return Number.isFinite(r)?r:null;let l=r.trim();if(l==="")return null;let d=/^(-?\d*\.?\d+)(px)?$/.exec(l);if(!d)return null;let u=Number.parseFloat(d[1]);return Number.isFinite(u)?u:null},io=r=>{if(r==null)return;if(typeof r=="number")return r;let l=r.trim().split(/\s+/);if(!(l.length===0||l[0]===""))return l.length===1||l.length===2?l[0]:l[2]},ao=r=>{let l=typeof r=="number"?[`${r}px`]:r.trim().split(/\s+/),[d,u=d,v=d,C=u]=l;return`${d} ${u} 0 ${C}`},Je=r=>{if(!r)return{style:r,spacerHeight:0};let l=r.paddingBottom!==void 0,d=r.padding!==void 0;if(!l&&!d)return{style:r,spacerHeight:0};let u=l?r.paddingBottom:io(r.padding),v=lo(u);if(v===null||v<=0)return{style:r,spacerHeight:0};let C={...r};return d&&r.padding!==void 0&&(C.padding=ao(r.padding)),l&&(C.paddingBottom=0),{style:C,spacerHeight:v}};var I=require("react"),xt=({containerRef:r,config:l})=>{let d=l.enabled??!0,u=l.threshold??80,v=l.maxDistance??u*2,C=l.onRefresh,[k,R]=(0,I.useState)(0),[O,U]=(0,I.useState)(!1),z=(0,I.useRef)(0),de=(0,I.useRef)(0),X=(0,I.useRef)(!1),Z=(0,I.useRef)(!1),oe=(0,I.useRef)(!1),q=(0,I.useRef)(0),re=(0,I.useRef)(!1);return(0,I.useEffect)(()=>{re.current=O},[O]),(0,I.useEffect)(()=>{let H=r.current;if(!H||!(d&&typeof C=="function"))return;let Te=h=>{let D=h instanceof Element?h:null;for(;D&&D!==H;){if(D instanceof HTMLElement&&D.scrollHeight>D.clientHeight+1&&D.scrollTop>0)return!1;D=D.parentElement}return!0},$e=h=>{X.current=!1,Z.current=!1,oe.current=!1,!re.current&&h.touches.length===1&&H.scrollTop===0&&Te(h.target)&&(X.current=!0,z.current=h.touches[0].clientY,de.current=h.touches[0].clientX)},Q=h=>{if(!X.current||re.current||h.touches.length!==1)return;let D=h.touches[0].clientY-z.current,Oe=h.touches[0].clientX-de.current;if(!Z.current){if(D<=0||H.scrollTop>0){X.current=!1;return}if(D>8&&D>Math.abs(Oe))Z.current=!0,oe.current=H.scrollTop<0;else return}!oe.current&&h.cancelable&&h.preventDefault();let le=Math.min(Math.max(D,0)*.5,v);q.current=le,R(le)},Y=()=>{if(!X.current||(X.current=!1,!Z.current))return;Z.current=!1,oe.current=!1;let h=q.current;q.current=0,h>=u&&!re.current?(U(!0),R(u),Promise.resolve().then(()=>C()).catch(()=>{}).finally(()=>{U(!1),R(0)})):R(0)};return H.addEventListener("touchstart",$e,{passive:!0}),H.addEventListener("touchmove",Q,{passive:!1}),H.addEventListener("touchend",Y,{passive:!0}),H.addEventListener("touchcancel",Y,{passive:!0}),()=>{H.removeEventListener("touchstart",$e),H.removeEventListener("touchmove",Q),H.removeEventListener("touchend",Y),H.removeEventListener("touchcancel",Y)}},[r,d,C,u,v]),{pullDistance:k,isRefreshing:O,pullProgress:Math.min(k/u,1),pullThreshold:u}};var Ie=require("react");function wt(){let[r,l]=(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=>l(v.matches);return l(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"),so={},co={},uo={},fo={},po={},ho={},mo=(0,t.forwardRef)(({className:r="",style:l={},containerStyle:d={},contentStyle:u={},children:v,onScroll:C,thumb:k=so,track:R=co,arrows:O=uo,dragScroll:U=fo,autoHide:z=po,pullToRefresh:de=ho,showScrollbar:X=!0,showHorizontalScrollbar:Z=!0,detectInnerScroll:oe=!1,scrollTopFab:q=!1},re)=>{let H=wt(),ne=X,Te=H?!1:Z,Q=`os-${(0,t.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,Y=q!==!1&&q!=null,h=typeof q=="object"?q:{},D=h.threshold??600,Oe=h.idleOpacity??h.scrollingOpacity??.45,le=h.hideDelay??1500,Tt=h.position??"right",tt=h.offset??16,St=h.background??"#1976d2",Ct=h.color??"#ffffff",Se=h.size??48,[We,ot]=(0,t.useState)(!1),[Et,fe]=(0,t.useState)(!1),J=(0,t.useRef)(null),Mt=(0,t.useRef)({});(0,t.useEffect)(()=>{Mt.current={children:v,onScroll:C,showScrollbar:ne,showHorizontalScrollbar:Te,thumb:k,track:R,arrows:O,dragScroll:U,autoHide:z}});let ze=(0,t.useRef)(null),c=(0,t.useRef)(null),pe=(0,t.useRef)(null),he=(0,t.useRef)(null),Ht=(0,t.useRef)(null),B=(0,t.useRef)(null),{pullDistance:Ae,isRefreshing:Ce,pullProgress:Be}=xt({containerRef:c,config:de}),rt=de.indicatorColor??"#1976d2",Lt=Ae>0||Ce,[Ee,E]=(0,t.useState)(!1),[F,nt]=(0,t.useState)(!1),[lt,it]=(0,t.useState)(!1),[Fe,Dt]=(0,t.useState)({y:0,scrollTop:0}),[me,at]=(0,t.useState)(0),[kt,Ne]=(0,t.useState)(0),[ie,st]=(0,t.useState)(!1),[ct,ut]=(0,t.useState)(!1),[N,dt]=(0,t.useState)(!1),[_e,Rt]=(0,t.useState)({x:0,scrollLeft:0}),[Ue,ft]=(0,t.useState)(0),[Xe,pt]=(0,t.useState)(0),[Pt,ht]=(0,t.useState)(!1),ae=(0,t.useRef)(!1),[j,mt]=(0,t.useState)(!1),[be,It]=(0,t.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[go,vo]=(0,t.useState)(null),[Me,He]=(0,t.useState)(null),[yo,$t]=(0,t.useState)(!1),[Ot,Wt]=(0,t.useState)(0),ge=(0,t.useRef)(null),[bt,gt]=(0,t.useState)(!1),ve=(0,t.useRef)(null),ee=(0,t.useRef)(null),te=(0,t.useRef)(null),M=(0,t.useMemo)(()=>{let e=k.color??"#606060";return{width:k.width??8,minHeight:k.minHeight??50,radius:k.radius??(k.width??8)/2,color:e,opacity:k.opacity??.6,hoverColor:k.hoverColor??e,hoverOpacity:k.hoverOpacity??1}},[k]),i=(0,t.useMemo)(()=>({width:R.width??16,color:R.color??"rgba(128, 128, 128, 0.1)",visible:R.visible??!0,alignment:R.alignment??"outside",radius:R.radius??M.radius??4,margin:R.margin??4,overflowX:R.overflowX??!0,overflowY:R.overflowY??!0}),[R,M.radius]),A=(0,t.useMemo)(()=>{let e=O.color??"#808080";return{visible:O.visible??!1,step:O.step??50,color:e,opacity:O.opacity??.6,hoverColor:O.hoverColor??e,hoverOpacity:O.hoverOpacity??1}},[O]),ye=(0,t.useMemo)(()=>({enabled:H?!1:U.enabled??!0,excludeClasses:U.excludeClasses??[],excludeSelectors:U.excludeSelectors??[]}),[U,H]),f=(0,t.useMemo)(()=>({enabled:z.enabled??!0,delay:z.delay??1500,delayOnWheel:z.delayOnWheel??700,initialDelay:z.initialDelay??200}),[z]),[se,zt]=(0,t.useState)(()=>(z.initialDelay??200)>0),w=M.width,At=i.width,qe=M.minHeight,_=A.visible,Le=A.step,W=(0,t.useCallback)(()=>{if(!c.current)return;let e=document.activeElement;e&&c.current.contains(e)&&e!==c.current||c.current.focus()},[]);(0,t.useImperativeHandle)(re,()=>({getScrollContainer:()=>c.current,scrollTo:e=>{c.current&&c.current.scrollTo(e)},get scrollTop(){return c.current?.scrollTop||0},get scrollHeight(){return c.current?.scrollHeight||0},get clientHeight(){return c.current?.clientHeight||0}}),[]);let g=(0,t.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(!oe)return null;let e=c.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of e){let n=o;if(n!==c.current&&n.classList.contains("overlay-scrollbar-container"))continue;let a=n.parentElement,s=!1;for(;a&&a!==c.current;){if(a.classList.contains("overlay-scrollbar-container")&&a!==c.current){s=!0;break}a=a.parentElement}if(!s&&(n.scrollHeight>n.clientHeight+2||n.scrollWidth>n.clientWidth+2))return B.current=n,n}return null},[]),G=(0,t.useCallback)(()=>g()!==null,[g]),T=(0,t.useCallback)(()=>{ve.current&&(clearTimeout(ve.current),ve.current=null)},[]),De=(0,t.useCallback)(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),vt=(0,t.useCallback)(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),Bt=(0,t.useCallback)(()=>{De(),!(F||N||j||ae.current)&&(T(),E(!1))},[T,De,F,N,j]),x=(0,t.useCallback)(e=>{f.enabled&&(T(),ve.current=setTimeout(()=>{E(!1),ve.current=null},e))},[T,f.enabled]),m=(0,t.useCallback)(()=>{let e=g()??c.current;if(!e){E(!1),st(!1),ht(!1),T();return}!f.enabled&&!se&&(E(!0),T());let o=e.clientHeight,n=e.scrollHeight,a=e.scrollTop,s=e.clientWidth,p=e.scrollWidth,S=e.scrollLeft,L=n-o>0,b=p-s>0,ce=L||b;st(L),ht(b),ce||(E(!1),T());let xe=0,$=0;if(ze.current){let K=window.getComputedStyle(ze.current),V=parseFloat(K.paddingTop)||0;$=parseFloat(K.paddingBottom)||0,xe=V+$,Wt($)}if(L){let K=_?w*2+i.margin*4:i.margin*2,V=o-K+xe,Re=o/n,ue=Math.max(V*Re,qe),yt=n-o,Kt=V-ue,Vt=yt>0?a/yt*Kt:0;at(ue),Ne(Vt)}else at(0),Ne(0);let we=p-s;if(we>0){let K=s/p,V=Math.max(s*K,50),Re=s-V,ue=we>0?S/we*Re:0;ft(V),pt(ue)}else ft(0),pt(0)},[g,T,_,w,qe,f.enabled,se]),Ft=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let o=g();o&&(nt(!0),Dt({y:e.clientY,scrollTop:o.scrollTop}),T(),E(!0),W())},[g,T,W]),Ye=(0,t.useCallback)(e=>{if(!F)return;let o=g();if(!o)return;let n=o.clientHeight,s=o.scrollHeight-n,p=e.clientY-Fe.y,S=n-me,L=p/S*s,b=Math.max(0,Math.min(s,Fe.scrollTop+L));o.scrollTop=b,m()},[F,Fe,me,m,g]),je=(0,t.useCallback)(()=>{nt(!1),G()&&x(f.delay)},[G,x,f.delay]),Nt=(0,t.useCallback)(e=>{if(!he.current)return;let n=he.current.getBoundingClientRect(),a=e.clientY-n.top,s=g();if(!s)return;let p=s.clientHeight,S=s.scrollHeight,b=a/p*(S-p);s.scrollTop=Math.max(0,Math.min(S-p,b)),m(),E(!0),x(f.delay),W()},[m,x,f.delay,g,W]),_t=(0,t.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!c.current)return;let o=Math.max(0,c.current.scrollTop-Le);c.current.scrollTop=o,m(),E(!0),x(f.delay),W()},[m,x,Le,f.delay,W]),Ut=(0,t.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!c.current||!pe.current)return;let o=c.current,a=pe.current.scrollHeight-o.clientHeight,s=Math.min(a,o.scrollTop+Le);o.scrollTop=s,m(),E(!0),x(f.delay),W()},[m,x,Le,f.delay,W]),Xt=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let o=g();o&&(dt(!0),Rt({x:e.clientX,scrollLeft:o.scrollLeft}),T(),E(!0),W())},[g,T,W]),Ge=(0,t.useCallback)(e=>{if(!N)return;let o=g();if(!o)return;let n=o.clientWidth,s=o.scrollWidth-n,p=e.clientX-_e.x,S=n-Ue,L=p/S*s,b=Math.max(0,Math.min(s,_e.scrollLeft+L));o.scrollLeft=b,m()},[N,_e,Ue,m,g]),Ke=(0,t.useCallback)(()=>{dt(!1),G()&&x(f.delay)},[G,x,f.delay]),qt=(0,t.useCallback)(e=>{if(!he.current)return;let n=he.current.getBoundingClientRect(),a=e.clientX-n.left,s=g();if(!s)return;let p=s.clientWidth,S=s.scrollWidth,b=a/p*(S-p);s.scrollLeft=Math.max(0,Math.min(S-p,b)),m(),E(!0),x(f.delay),W()},[m,x,f.delay,g,W]),Yt=(0,t.useCallback)(e=>{if(!ye.enabled||e.defaultPrevented)return;let o=e.target,n=c.current;if(!n||!n.contains(o)||Pe(o,ye)||e.button!==0)return;let a=g();a&&(a.scrollHeight<=a.clientHeight&&a.scrollWidth<=a.clientWidth||(e.preventDefault(),ae.current=!0,It({x:e.clientX,y:e.clientY,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft||0}),T()))},[ye,Pe,g,T]),Ve=(0,t.useCallback)(e=>{if(!ae.current&&!j)return;let o=g();if(!o)return;let n=be.x-e.clientX,a=be.y-e.clientY;if(Math.abs(a)<5&&Math.abs(n)<5)return;ae.current&&(ae.current=!1,mt(!0)),E(!0);let s=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,be.scrollTop+a)),p=Math.max(0,Math.min(o.scrollWidth-o.clientWidth,be.scrollLeft+n));o.scrollTop=s,o.scrollLeft=p,m()},[j,be,g,m]),Ze=(0,t.useCallback)(()=>{let e=j;ae.current=!1,mt(!1),e&&G()&&x(f.delay)},[j,G,x,f.delay]);(0,t.useEffect)(()=>{let e=p=>{if(m(),Y){let b=(p.target?.scrollTop??0)>D;ot(b),J.current&&(clearTimeout(J.current),J.current=null),b&&le>0&&(J.current=setTimeout(()=>{J.current=null,ot(!1)},le))}if(se){C&&C(p);return}T(),E(!0),vt();let S=bt?f.delayOnWheel:f.delay;x(S),C&&C(p)},o=()=>{gt(!0),ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>{gt(!1)},300),vt(),te.current=setTimeout(()=>{E(!0),te.current=null,x(f.delayOnWheel)},50)},n=[],a=g();a&&n.push(a);let s=c.current;return s&&!a&&(n.push(s),s.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(S=>{let L=S;if(L!==s&&L.classList.contains("overlay-scrollbar-container"))return;let b=L.parentElement;for(;b&&b!==s;){if(b.classList.contains("overlay-scrollbar-container")&&b!==s)return;b=b.parentElement}n.push(L)})),n.forEach(p=>{p.addEventListener("scroll",e,{passive:!0}),p.addEventListener("wheel",o,{passive:!0})}),()=>{n.forEach(p=>{p.removeEventListener("scroll",e),p.removeEventListener("wheel",o)}),ge.current&&clearTimeout(ge.current),te.current&&clearTimeout(te.current)}},[g,m,C,T,x,f,bt,se,Y,D,le]),(0,t.useEffect)(()=>()=>{J.current&&clearTimeout(J.current)},[]),(0,t.useEffect)(()=>{let e=n=>{let a=n.target;if(n.defaultPrevented||a instanceof Element&&Pe(a,ye))return;let s=g();if(!s)return;let{key:p}=n,{scrollTop:S,scrollHeight:L,clientHeight:b}=s,ce=L-b,xe=50,$=null;switch(p){case"ArrowUp":n.preventDefault(),$=Math.max(0,S-xe);break;case"ArrowDown":n.preventDefault(),$=Math.min(ce,S+xe);break;case"PageUp":n.preventDefault(),$=Math.max(0,S-b);break;case"PageDown":n.preventDefault(),$=Math.min(ce,S+b);break;case"Home":n.preventDefault(),$=0;break;case"End":n.preventDefault(),$=ce;break;default:return}if($!==null){let we=$/ce,K=_?w*2+i.margin*4:i.margin*2,ue=(b-K-me)*we;Ne(ue),s.scrollTop=$,T(),E(!0),x(f.delay)}},o=c.current;if(o)return o.addEventListener("keydown",e),()=>{o.removeEventListener("keydown",e)}},[g,_,w,i.margin,me,T,x,f.delay,ye]),(0,t.useEffect)(()=>(document.addEventListener("mousemove",Ve),document.addEventListener("mouseup",Ze),()=>{document.removeEventListener("mousemove",Ve),document.removeEventListener("mouseup",Ze)}),[j,Ve,Ze]),(0,t.useEffect)(()=>{if(F)return document.addEventListener("mousemove",Ye),document.addEventListener("mouseup",je),()=>{document.removeEventListener("mousemove",Ye),document.removeEventListener("mouseup",je)}},[F,Ye,je]),(0,t.useEffect)(()=>{if(N)return document.addEventListener("mousemove",Ge),document.addEventListener("mouseup",Ke),()=>{document.removeEventListener("mousemove",Ge),document.removeEventListener("mouseup",Ke)}},[N,Ge,Ke]),(0,t.useEffect)(()=>{m();let e=setTimeout(()=>{m()},100);return()=>clearTimeout(e)},[m]),(0,t.useLayoutEffect)(()=>{$t(!0),m(),!f.enabled&&!se&&G()&&E(!0)},[G,m,f.enabled,se]),(0,t.useEffect)(()=>{if(f.initialDelay>0){let e=setTimeout(()=>{zt(!1)},f.initialDelay);return()=>clearTimeout(e)}},[f.initialDelay]),(0,t.useEffect)(()=>{let e=new ResizeObserver(()=>{m()}),o=[];return c.current&&o.push(c.current),pe.current&&o.push(pe.current),B.current&&document.contains(B.current)&&o.push(B.current),o.forEach(n=>{e.observe(n)}),()=>e.disconnect()},[m]),(0,t.useEffect)(()=>{if(!c.current)return;let e=new MutationObserver(()=>{B.current=null,m()});return e.observe(c.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[m]);let P=Math.max(At,w);(0,t.useEffect)(()=>{let e="overlay-scrollbar-shared";if(document.getElementById(e))return;let o=document.createElement("style");o.id=e,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;
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
from { transform: rotate(0deg); }
|
|
28
28
|
to { transform: rotate(360deg); }
|
|
29
29
|
}
|
|
30
|
-
`,document.head.appendChild(o)},[]),(0,
|
|
31
|
-
${
|
|
30
|
+
`,document.head.appendChild(o)},[]),(0,t.useEffect)(()=>{let e=`overlay-scrollbar-instance-${Q}`,o=document.getElementById(e);o&&o.remove();let n=document.createElement("style");n.id=e;let a=`.${Q}`;return n.textContent=`
|
|
31
|
+
${a} {
|
|
32
32
|
scrollbar-width: none !important;
|
|
33
33
|
-ms-overflow-style: none !important;
|
|
34
34
|
}
|
|
35
|
-
${
|
|
35
|
+
${a}::-webkit-scrollbar {
|
|
36
36
|
display: none !important;
|
|
37
37
|
width: 0 !important;
|
|
38
38
|
height: 0 !important;
|
|
39
39
|
}
|
|
40
|
-
${
|
|
41
|
-
${
|
|
40
|
+
${a}::-webkit-scrollbar-track { display: none !important; }
|
|
41
|
+
${a}::-webkit-scrollbar-thumb { display: none !important; }`,document.head.appendChild(n),()=>{document.getElementById(e)?.remove()}},[Q]);let{normalizedContainerStyle:jt,normalizedContentStyle:Gt,bottomSpacerHeight:ke}=(0,t.useMemo)(()=>{let e=Je(d),o=Je(u);return{normalizedContainerStyle:e.style,normalizedContentStyle:o.style,bottomSpacerHeight:e.spacerHeight+o.spacerHeight}},[d,u]);return(0,y.jsxs)("div",{ref:ze,className:`overlay-scrollbar-wrapper ${r}`,onMouseLeave:Bt,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",overflow:"visible",...l},children:[Lt&&(0,y.jsx)("div",{className:"overlay-scrollbar-pull-indicator",style:{position:"absolute",top:0,left:"50%",transform:`translate(-50%, ${Ae-68}px)`,transition:Ce?"transform 0.15s ease-out":Ae===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:Ce?1:Math.min(Be*1.5,1)},children:Ce?(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:rt,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:rt})})}),(0,y.jsxs)("div",{ref:c,className:`overlay-scrollbar-container ${Q}`,tabIndex:-1,onMouseDown:Yt,style:{display:"flex",...ke>0?{flexDirection:"column"}:{},width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",outline:"none",userSelect:j?"none":"auto",...jt},children:[(0,y.jsx)("div",{ref:pe,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",boxSizing:"border-box",...Gt,...ke>0?{flexShrink:0}:{}},children:v}),ke>0&&(0,y.jsx)("div",{className:"overlay-scrollbar-bottom-spacer","aria-hidden":"true",style:{flex:"0 0 auto",height:ke}})]}),ne&&ie&&(i.overflowY??!0)&&(0,y.jsxs)("div",{ref:he,className:"overlay-scrollbar-track",onMouseEnter:()=>{T(),ee.current=setTimeout(()=>{E(!0),ee.current=null},100)},onMouseLeave:()=>{De(),F||x(f.delay)},style:{position:"absolute",top:0,right:0,width:`${P}px`,height:"100%",opacity:Ee?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[i.visible&&(0,y.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),Nt(e)},style:{position:"absolute",top:_?`${M.width+i.margin*2}px`:`${i.margin}px`,right:i.alignment==="outside"?"0px":`${(P-M.width)/2}px`,width:`${M.width}px`,height:_?`calc(100% - ${M.width*2+i.margin*4}px)`:`calc(100% - ${i.margin*2}px)`,backgroundColor:i.color,borderRadius:`${i.radius}px`,cursor:"pointer"}}),(0,y.jsx)("div",{ref:Ht,className:"overlay-scrollbar-thumb",onMouseDown:Ft,onMouseEnter:()=>it(!0),onMouseLeave:()=>it(!1),style:{position:"absolute",top:`${(_?w+i.margin*2:i.margin)+kt}px`,right:i.alignment==="outside"?"0px":`${(P-w)/2}px`,width:`${w}px`,height:`${Math.max(me,qe)}px`,backgroundColor:lt||F?M.hoverColor:M.color,opacity:lt||F?M.hoverOpacity:M.opacity,borderRadius:`${M.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),ne&&ie&&_&&(0,y.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:_t,onMouseEnter:()=>He("up"),onMouseLeave:()=>He(null),style:{position:"absolute",top:`${i.margin}px`,right:i.alignment==="outside"?"0px":`${(P-w)/2}px`,width:`${w}px`,height:`${w}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(w*.75,8)}px`,color:Me==="up"?A.hoverColor:A.color,userSelect:"none",zIndex:1001,opacity:Ee?Me==="up"?A.hoverOpacity:A.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),ne&&ie&&_&&(0,y.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:Ut,onMouseEnter:()=>He("down"),onMouseLeave:()=>He(null),style:{position:"absolute",bottom:`${i.margin}px`,right:i.alignment==="outside"?"0px":`${(P-w)/2}px`,width:`${w}px`,height:`${w}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(w*.75,8)}px`,color:Me==="down"?A.hoverColor:A.color,userSelect:"none",zIndex:1001,opacity:Ee?Me==="down"?A.hoverOpacity:A.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"}),ne&&Te&&Pt&&(i.overflowX??!0)&&(0,y.jsxs)("div",{className:"overlay-scrollbar-horizontal-track",onMouseEnter:()=>{T(),ee.current=setTimeout(()=>{E(!0),ee.current=null},100)},onMouseLeave:()=>{De(),N||x(f.delay)},style:{position:"absolute",bottom:`${Ot}px`,left:0,width:"100%",height:`${P}px`,opacity:Ee?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[i.visible&&(0,y.jsx)("div",{className:"overlay-scrollbar-horizontal-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),qt(e)},style:{position:"absolute",bottom:i.alignment==="outside"?"0px":`${(P-w)/2}px`,left:`${i.margin}px`,right:ie?i.alignment==="outside"?`${P-i.margin}px`:`${P}px`:`${i.margin}px`,height:`${w}px`,backgroundColor:i.color,borderRadius:`${i.radius}px`,cursor:"pointer"}}),(0,y.jsx)("div",{className:"overlay-scrollbar-horizontal-thumb",onMouseDown:Xt,onMouseEnter:()=>ut(!0),onMouseLeave:()=>ut(!1),style:{position:"absolute",bottom:i.alignment==="outside"?"0px":`${(P-w)/2}px`,left:`${i.margin+Xe}px`,right:ie?i.alignment==="outside"?`${P-i.margin}px`:`${P}px`:"auto",maxWidth:ie?i.alignment==="outside"?`calc(100% - ${i.margin+Xe+P-i.margin}px)`:`calc(100% - ${i.margin+Xe+P}px)`:"none",width:`${Math.max(Ue,50)}px`,height:`${w}px`,backgroundColor:ct||N?M.hoverColor:M.color,opacity:ct||N?M.hoverOpacity:M.opacity,borderRadius:`${M.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:()=>{fe(!1),c.current?.scrollTo({top:0,behavior:"smooth"})},onPointerDown:()=>fe(!0),onPointerUp:()=>fe(!1),onPointerLeave:()=>fe(!1),onPointerCancel:()=>fe(!1),style:{position:"absolute",[Tt]:tt,bottom:tt,zIndex:1200,width:Se,height:Se,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"50%",backgroundColor:St,color:Ct,boxShadow:"0 3px 8px rgba(15, 23, 42, 0.28)",cursor:"pointer",opacity:We?Et?1:Oe:0,pointerEvents:We?"auto":"none",transition:We?"opacity 0.15s ease":"opacity 0.45s ease"},children:(0,y.jsx)("svg",{width:Math.round(Se*.5),height:Math.round(Se*.5),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,y.jsx)("polyline",{points:"18 15 12 9 6 15"})})})]})}),et=mo;
|
|
42
42
|
//# sourceMappingURL=index.js.map
|