morphing-scroll 2.10.4 → 2.10.5
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/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("keytask-core"),n=function(){return n=Object.assign||function(e){for(var r,t=1,n=arguments.length;n>t;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},n.apply(this,arguments)};function o(e,r,t,n){return new(t||(t=Promise))((function(o,i){function l(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(l,c)}a((n=n.apply(e,r||[])).next())}))}function i(e,r){var t,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(e,i)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function l(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),l=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)l.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return l}function c(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;i>o;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var a=function(e,r,t){void 0===r&&(r=!1);var n=[];if(n=Array.isArray(e)?2===e.length?[e[1],e[0],e[1],e[0]]:c([],l(e),!1):[e,e,e,e],r&&(n=[n[1],n[0],n[3],n[2]]),t){for(var o=[],i=0;t>i;i++)o.push(n[i%4]);n=o}return n},u=function(t){var n=t.className,o=t.children,i=t.style,c=t.root,u=t.threshold,s=t.rootMargin,f=t.visibleContent,d=void 0!==f&&f,v=t.onIntersection,h=l(r.useState(!1),2),m=h[0],p=h[1],y=r.useRef(null),g=r.useMemo((function(){if(!s)return"";var e=a(s);return"".concat(e[0],"px ").concat(e[1],"px ").concat(e[2],"px ").concat(e[3],"px")}),[s]),b=r.useCallback((function(e){var r=l(e,1)[0];p(r.isIntersecting),v&&v({time:r.time,rootBounds:r.rootBounds,boundingClientRect:r.boundingClientRect,intersectionRect:r.intersectionRect,isIntersecting:r.isIntersecting,intersectionRatio:r.intersectionRatio,target:r.target})}),[v]);return r.useEffect((function(){var e=new IntersectionObserver(b,{root:c,threshold:u,rootMargin:g});return y.current&&e.observe(y.current),function(){e.disconnect()}}),[b,c,u,g]),e.jsx("div",{"intersection-tracker":"",className:n,ref:y,style:i,children:d||m?o:null})};u.displayName="IntersectionTracker";var s=function(t){var o=t.className,i=t.children,l=t.style,c=t.measure,a=void 0===c?"inner":c,u=t.onResize,s=r.useRef(null);r.useEffect((function(){var e=s.current;if(e){var r=new ResizeObserver((function(e){var r,t;try{for(var n=function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),o=n.next();!o.done;o=n.next()){var i=o.value;u&&u(i.contentRect)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(r)throw r.error}}}));return r.observe(e),function(){r.unobserve(e),r.disconnect()}}}),[a,u]);var f={width:"max-content",height:"max-content"},d={inner:n({},f),outer:n({},{width:"100%",height:"100%"}),all:n({minWidth:"100%",minHeight:"100%"},f)};return e.jsx("div",{"resize-tracker":"",className:o,ref:s,style:n(n({willChange:"width, height"},d[a]),l),children:i})};s.displayName="ResizeTracker";var f=1;function d(e,r,t,n){return void 0===r&&(r=0),void 0===t&&(t=1/0),void 0===n&&(n=!0),Math.max(r,Math.min(n?Math.round(e):e,t))}var v="wrap-id";function h(e,r,t,n,o){r.matches(":focus")||r.focus(),n.animating||(n.targetScrollX=d(r.scrollLeft,0,t[0]),n.targetScrollY=d(r.scrollTop,0,t[1])),"x"===o?n.targetScrollX=d(n.targetScrollX+e.deltaY,0,t[0]):n.targetScrollY=d(n.targetScrollY+e.deltaY,0,t[1]),n.animating||(n.animating=!0,n.animationFrameId=requestAnimationFrame((function e(){var i;if("x"===o){var l=d(r.scrollLeft+.4*(n.targetScrollX-r.scrollLeft),0,t[0]);r.scrollLeft=l,i=Math.abs(l-n.targetScrollX)}else{var c=d(r.scrollTop+.4*(n.targetScrollY-r.scrollTop),0,t[1]);r.scrollTop=c,i=Math.abs(c-n.targetScrollY)}i>2.5?n.animationFrameId=requestAnimationFrame(e):("x"===o?r.scrollLeft=d(n.targetScrollX,0,t[0]):r.scrollTop=d(n.targetScrollY,0,t[1]),n.animating=!1,n.animationFrameId=null)})))}var m=function(t){var o=t.type,i=t.direction,l=t.progressReverse,c=t.size,a=t.progressTrigger,u=t.scrollBarOnHover,s=t.scrollBarEvent,f=t.thumbSize,d=t.thumbSpace,v=t.objLengthPerSize,m=t.sliderCheckLocal,p=t.duration,y=t.isTouched,g=t.scrollStateRef,b=t.scrollEl,x=t.scrollBarsRef,w=t.triggerUpdate,S=t.overscroll,M=t.maxScrollSize,E=r.useRef(null),k=r.useRef(null),j=["hybrid","y"].includes(i)?"y":"x",L=Math.abs(S.current[j])*(f/200),A=f-L,R=0>S.current[j]?d+L:d,z=r.useMemo((function(){if("scroll"!==o){var r=c["x"===j?0:1];return Array.from({length:v},(function(t,i){return e.jsx("div",{className:"ms-slider-element",style:n({},"sliderMenu"===o&&{cursor:"pointer"}),onClick:"sliderMenu"===o?function(){s(r*i,j,p,m)}:void 0,children:Array.isArray(a[0].progressElement)?a[0].progressElement[i]:a[0].progressElement},i)}))}}),[v,o,a[1],p,m,c[0],c[1],s]),T=r.useMemo((function(){return"x"!==i?"y":"x"}),[i]),C=c["x"===T?0:1],F="scroll"!==o?"":f+2*d>C?"flex-end":"flex-start";r.useEffect((function(){if(!y&&a[0].wheel){var e=E.current,r=b.current;if(e&&r){for(var t=e.previousElementSibling;t&&!t.classList.contains("ms-element");)t=t.previousElementSibling;var n=function(e){return h(e,r,M,g.current,T)};return e.addEventListener("wheel",n,{passive:!1}),function(){return e.removeEventListener("wheel",n)}}}}),[T]),r.useEffect((function(){var e="slider"===o?E.current:k.current;if(e&&"sliderMenu"!==o){var r=function(e){return s(e)};return e.addEventListener("pointerdown",r),function(){return e.removeEventListener("pointerdown",r)}}}),[s,o]),r.useEffect((function(){var e=E.current;if(e)return x.current.add(e),w(),function(){x.current.delete(e)}}),[f]);var O=n({position:"absolute"},u&&{opacity:0,transition:"opacity 0.2s ease-in-out"});return e.jsx(r.Fragment,{children:"scroll"===o?e.jsx("div",{className:"ms-bar ms-".concat(T),ref:E,"data-direction":T,style:n(n(n({},O),{width:"fit-content",height:"".concat(C,"px")}),"x"===i?n({transformOrigin:"left top",left:"50%"},l?{top:0,transform:"rotate(-90deg) translate(-100%, -50%)"}:{transform:"rotate(-90deg) translateY(-50%)"}):n({top:"50%",transform:"translateY(-50%)"},l?{left:0}:{right:0})),children:e.jsx("div",{className:"ms-thumb",ref:k,style:n(n({height:"".concat(A,"px"),transform:"translateY(".concat(R,"px)")},a[0].progressElement&&{cursor:"grab"}),{display:"flex",alignItems:F}),children:a[0].progressElement})}):v>1&&a[0].progressElement&&e.jsx("div",{className:"ms-slider ms-".concat(T),ref:E,"data-direction":T,style:n(n(n(n({},O),{display:"flex"}),"slider"===o&&{cursor:"grab"}),"x"===i?n({transformOrigin:"left top",left:"50%",transform:"translateX(-50%)"},l?{top:0}:{bottom:0}):n({flexDirection:"column",top:"50%",transform:"translateY(-50%)"},l?{left:0}:{right:0})),children:z})})};m.displayName="ScrollBar";var p=function(r){var t,o=r.edgeGradient,i=r.visibility,l=r.edgeType;r.size;var c=n(n(n(((t={position:"absolute"})[l]=0,t.pointerEvents="none",t.transition="opacity 0.2s ease-in-out",t["--edge-visibility"]=i?1:0,t.opacity="var(--edge-visibility)",t),o.color&&{background:o.color&&"linear-gradient(".concat(["left","right"].includes(l)?"270deg, ":"").concat(o.color,", transparent)")}),["left","right"].includes(l)?{height:"100%",width:"".concat(o.size,"px"),top:0}:{width:"100%",height:"".concat(o.size,"px"),left:0}),"left"===l?{transform:"scaleX(-1)"}:"bottom"===l?{transform:"scaleY(-1)"}:{}),a="ms-edge ".concat(l).concat(i?"":" ms-disabled");return e.jsx("div",{className:a,style:c})};p.displayName="Edge";var y=r.memo(p),g=function(t){var o,i=t.visibility,l=t.arrows,c=t.arrowType,a=t.handleArrow,u=t.size,s=r.useRef(null),f=n(n(n(n(n({position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",width:"".concat(l.size,"px")},c?((o={})[c]=0,o):{}),"top"===c&&{transform:"rotate(-90deg) translateX(-100%)",transformOrigin:"left top"}),"bottom"===c&&{transform:"rotate(90deg) translateX(-100%)",transformOrigin:"left bottom"}),"left"===c&&{transform:"scaleX(-1)"}),["top","bottom"].includes(c)?{height:"".concat(u,"px")}:{height:"100%",top:0});return r.useEffect((function(){var e=s.current;if(e){var r=function(){return a(c)};return e.addEventListener("click",r),function(){e.removeEventListener("click",r)}}}),[a,c]),e.jsx("div",{className:"ms-arrow-box ".concat(c).concat(i?" active":""),ref:s,style:f,children:l.element})};g.displayName="Arrow";var b,x=r.memo(g),w=function(e){var r=e.getAttribute("data-direction");e.style.opacity="0",e.classList.remove("hover"),e.classList.add("leave"),t.cancelTask("remove".concat(r)),t.setTask((function(){return e.classList.remove("leave")}),200,"remove".concat(r))},S=function(e){var r=e.getAttribute("data-direction");t.cancelTask("remove".concat(r)),e.style.opacity="1",e.classList.remove("leave"),e.classList.add("hover")},M=function(){var e=null,r=0,t=new Map,n=function(){t.forEach((function(e,r){e()||t.delete(r)})),e=0!==t.size?requestAnimationFrame(n):null};return{start:function(o,i){var l=null!=i?i:++r;return t.delete(l),t.set(l,o),null===e&&(e=requestAnimationFrame(n)),l},stop:function(r){void 0!==r?(t.delete(r),0===t.size&&null!==e&&(cancelAnimationFrame(e),e=null)):(t.clear(),null!==e&&(cancelAnimationFrame(e),e=null))},isRunning:function(e){return void 0===e?t.size>0:t.has(e)}}}(),E=function(e,r,t){var n=e.current[r],o=performance.now();M.start((function(){var i=performance.now(),l=Math.min((i-o)/140,1);return 1>l?(e.current[r]=n*(1-l),t(),!0):(e.current[r]=0,t(),!1)}))},k={x:0,y:0},j={x:0,y:0},L={x:0,y:0,t:0,distX:0,distY:0},A=null,R=function(e,r,t,n){if(e){var o=null;["thumb","slider"].includes(e)?o="slider"===e?null==r?void 0:r.closest(".ms-slider"):r:"wrapp"===e&&(o=t),function(e,r){if(e){var t,n=window.matchMedia("(pointer: coarse)").matches;"start"===r?(n||(t=document.getElementById("ms-cursor-lock"))||((t=document.createElement("style")).id="ms-cursor-lock",t.textContent="\n * {\n cursor: grabbing !important;\n user-select: none;\n }\n ",document.head.appendChild(t)),e.style.cursor="grabbing",e.classList.add("active")):(n||(t=document.getElementById("ms-cursor-lock"))&&t.remove(),e.style.cursor="grab",e.classList.remove("active"))}}(o,n)}},z=function(e,r,t,n){"x"===e?(t.scrollStateRef.targetScrollX=n,r.scrollLeft!==n&&(r.scrollLeft=n)):(t.scrollStateRef.targetScrollY=n,r.scrollTop!==n&&(r.scrollTop=n))},T=function(e,r,t,n){var o,i,l=n.scrollElement;if(l){var c="x"===e,a={x:n.event.clientX,y:n.event.clientY};if(a){var u=function(e,r,t){if(0===e)return 0;var o="x"===r?n.sizeLocal[0]:n.sizeLocal[1],i=.14*Math.max(600,o),l=Math.abs(e);return d(e*i/(i+(t?-l:l)),-150,150)};if(A){var s=A,f={x:a.x-s.x.value,y:a.y-s.y.value},v=Math.abs(k[e]);if(v>2?n.isDraggingRef.current=!0:3>v&&(k[e]+=f[e]),n.isTouched){var h=performance.now();if(L.t){var m=Math.max(h-L.t,8);L={x:.8*L.x+f.x/m*.2,y:.8*L.y+f.y/m*.2,t:h,distX:(null!==(o=L.distX)&&void 0!==o?o:0)+Math.abs(f.x),distY:(null!==(i=L.distY)&&void 0!==i?i:0)+Math.abs(f.y)}}else L.t=h}var p="wrapp"===n.clickedObject.current?-f[e]:f[e],y=c?"scrollLeft":"scrollTop",g=c?0:1,b=function(r,t,o){var i=A[e],a=c?n.maxScrollSize[0]:n.maxScrollSize[1];if(Number.isFinite(r)&&Number.isFinite(t)){if(0!==i.raw){var s=i.raw;return i.raw+=.6*t,o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()),Math.sign(i.raw)!==Math.sign(s)?(i.raw=0,void(o&&(n.overscrollRef.current[e]=0,n.triggerUpdate()))):void 0}if(a>0){var f=l[y];if(0>=f&&0>r||f>=a&&r>0)return i.raw+=t,void(o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()));var v=d(l[y]+r,0,a);z(e,l,n,v)}else z(e,l,n,0)}else A=null};if("thumb"===n.clickedObject.current&&"slider"!==n.type){var x=p*r+s[e].rest,w=Math.trunc(x);return s[e].rest=x-w,void b(w,p,!1)}if("slider"===n.type&&(j[e]+=p),"wrapp"!==n.clickedObject.current){var S=l[y];if(!n.sliderElSize||Math.abs(j[e])>=n.sliderElSize[c?0:1]){var M=function(e){var r=l[c?"clientWidth":"clientHeight"]+n.gap[g];return r*(Math.floor(Math.max(0,S)/r)+e)},E=p>0&&S+n.sizeLocal[g]<n.wrapElWH[g]?M(1):0>p&&S>0?M(-1):null;j[e]=0,n.smoothScroll(E,e,10)}}else b(p/t[g],f[e],!0)}else A={x:{value:a.x,rest:0,raw:u(n.overscrollRef.current.x,"x",!0)},y:{value:a.y,rest:0,raw:u(n.overscrollRef.current.y,"y",!0)}}}}};function C(e){M.stop(),["x","y"].forEach((function(r){e.rafScrollAnim.cancel(),t.cancelTask("smoothScrollBlock".concat(r))}));var r=e.scrollElement;if(r){e.scrollStateRef.targetScrollX=r.scrollLeft,e.scrollStateRef.targetScrollY=r.scrollTop,L={x:0,y:0,t:0,distX:0,distY:0};var o=[r.scrollWidth,r.scrollHeight],i=["scroll","slider"].includes(e.type)?function(e){var r=e.getBoundingClientRect();return[r.width/e.clientWidth,r.height/e.clientHeight]}(r):[],c=1;if("thumb"===e.clickedObject.current&&e.axisFromAtr){var a="x"===e.axisFromAtr?0:1,u=(e.sizeLocal[a]-e.scrollBarEdge[a]-e.thumbSize)*i[a];c=e.maxScrollSize[a]/u,Number.isFinite(c)&&c>0||(c=1)}R(e.clickedObject.current,e.target,r,"start"),null==b||b.abort();var s=new AbortController;b=s;var f=s.signal;document.addEventListener("pointermove",(function(r){!function(r){var t,l;if("thumb"===e.clickedObject.current&&"slider"===e.type){var a=null===(t=e.target)||void 0===t?void 0:t.closest(".ms-slider");if(!a)return;var u=function(r){var t=a.getBoundingClientRect();return Math.round(("x"===r?t.width:t.height)/e.objLengthPerSize["x"===r?0:1])};l=[u("x"),u("y")]}!function(e){var r=e.direction||"y";"hybrid"===r?["wrapp","slider"].includes(e.clickedObject.current)?["x","y"].forEach((function(r){return T(r,e.thumbRatio,e.visualDiff,e)})):e.axisFromAtr&&T(e.axisFromAtr,e.thumbRatio,e.visualDiff,e):T(e.axisFromAtr?e.axisFromAtr:r,e.thumbRatio,e.visualDiff,e);var t={x:e.event.clientX,y:e.event.clientY};A&&(A.x.value=t.x,A.y.value=t.y)}(n(n({},e),{event:r,wrapElWH:o,visualDiff:i,thumbRatio:c,sliderElSize:l}))}(r)}),{signal:f});var v=function(r){e.isDraggingRef.current=!1,function(e){null==b||b.abort();var r=e.scrollElement;if(r){if(R(e.clickedObject.current,e.target,r,"end"),"slider"===e.type&&"thumb"!==e.clickedObject.current){var t=j,n=function(t,n){var o="x"===t,i=o?e.maxScrollSize[0]:e.maxScrollSize[1],l=r[o?"scrollLeft":"scrollTop"],c=o?e.gap[0]:e.gap[1],a=r[o?"clientWidth":"clientHeight"]+c,u=(Math[n?n>0?"floor":"ceil":"round"](l/a)+(null!=n?n:0))*a;u>i||0>u||e.smoothScroll(u,t,e.duration)},o=function(e,r){Math.abs(r)>20?n(e,r>0?1:-1):n(e)};0===t.x&&0===t.y?"hybrid"===e.direction?["x","y"].forEach((function(e){return o(e,t[e])})):o(e.direction,t[e.direction]):Object.entries(t).forEach((function(e){var r=l(e,2),t=r[0],n=r[1];0!==n&&o(t,n)}))}if(e.isTouched&&"scroll"===e.type&&"slider"!==e.clickedObject.current){var i=function(t){var n=L[t]*e.thumbRatio,o="x"===t?L.distX:L.distY;80>performance.now()-L.t&&Math.abs(n)>.05&&o>12&&function(e){var r=e.el,t=e.axis,n=e.velocity,o=e.rafSchedule,i=Math.sign(n),l=Math.abs(n);.2>(l=Math.pow(l,.92))&&(l=.2),n=l*i;var c="y"===t?"scrollTop":"scrollLeft",a="y"===t?r.scrollHeight-r.clientHeight:r.scrollWidth-r.clientWidth,u=performance.now(),s=function(){var e=performance.now(),t=e-u;if(u=e,Math.abs(n*=Math.exp(-.0025*t))>=.02){var i=r[c]+n*t;(0>i||i>a)&&(n*=.4,i=d(i,0,a)),r[c]=i,o("step",s)}};o("step",s)}({el:r,axis:t,velocity:"thumb"===e.clickedObject.current?n:-n,rafSchedule:e.rafScrollAnim.schedule})};"hybrid"===e.direction?"wrapp"===e.clickedObject.current?["x","y"].forEach((function(e){return i(e)})):i(e.axisFromAtr):i(e.axisFromAtr?e.axisFromAtr:e.direction)}A=null,0!==e.overscrollRef.current.x&&E(e.overscrollRef,"x",e.triggerUpdate),0!==e.overscrollRef.current.y&&E(e.overscrollRef,"y",e.triggerUpdate),e.clickedObject.current=null,L={x:0,y:0,t:0,distX:0,distY:0},k={x:0,y:0},j={x:0,y:0},e.triggerUpdate()}}(n(n({},e),{event:r,thumbRatio:c}))};document.addEventListener("pointerup",v,{signal:f}),document.addEventListener("pointercancel",v,{signal:f})}}function F(e,r){return e>r?Math.floor(e/r):1}function O(e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?[3,2]:[4,new Promise((function(e){return requestAnimationFrame(e)}))];case 1:return r.sent(),[3,0];case 2:return[2]}}))}))}var I=new WeakMap,N=function(e){return e?"start"===e?"flex-start":"center"===e?"center":"flex-end":void 0};function Y(e,r,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),function(o){var i,l,c,a,u=!1,s={width:(null!==(i=o.width)&&void 0!==i?i:0)-t,height:(null!==(l=o.height)&&void 0!==l?l:0)-n},f=0===s.width&&0===s.height;f&&!u&&(u=!0),(null===(c=e.current)||void 0===c?void 0:c.width)===s.width&&(null===(a=e.current)||void 0===a?void 0:a.height)===s.height||f&&u||(e.current=s,r())}}var H=function(){var e,r;return"undefined"!=typeof window&&null!==(r=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(pointer: coarse)").matches)&&void 0!==r&&r};function W(e,r,t){return r?d(Math.round(e/r*e),t,e):0}function X(e,r,t,n){return r?d(e/r*(t-n),0,t-n):0}function B(){var e=null,r=new Map;return{schedule:function(t,n){r.set(t,n),null===e&&(e=requestAnimationFrame((function(){e=null;var t=Array.from(r.values());r.clear(),t.forEach((function(e){return e()}))})))},cancel:function(){null!==e&&(cancelAnimationFrame(e),e=null,r.clear())}}}var P,D=function(e){if(null==e)return[];if(r.isValidElement(e)){var t=e;return t.type===r.Fragment?r.Children.toArray(t.props.children).flatMap(D):[t]}return[e]},q=function(e){var r=e.lastIndexOf(":$");return-1!==r?e.slice(r+2).replace(/=0/g,"=").replace(/=2/g,":"):e.startsWith(".$")?e.slice(2).replace(/=0/g,"=").replace(/=2/g,":"):e},V=40,U="ms-under-drag",K=null,_=!1,G={x:0,y:0},$={x:0,y:0},Z=!1,J=null,Q="",ee=null,re=null,te=null,ne=B(),oe=function(){re&&re.removeAttribute(U),J=null,re=null,ee=null,Q="",te=null};function ie(e,r,t,n,o,i){var l=e-r,c=t-e;return V>l&&n>0?{dir:-1,distance:l}:V>c&&i>n+o?{dir:1,distance:c}:null}function le(e){var r=d((V-Math.abs(e))/V,0,1,!1);return r*r*20|0}function ce(){if(J){var e=J.parent,r=J.element,t=J.direction,n=r.getBoundingClientRect(),o=$.x,i=$.y;if(o<n.left-V||o>n.right+V||i<n.top-V||i>n.bottom+V)oe();else{var l=null,c=null,a=0,u=0,s="x"!==t?ie(i,n.top,n.bottom,r.scrollTop,r.clientHeight,r.scrollHeight):null;s&&(l=-1===s.dir?"top":"bottom",u=le(s.distance)*s.dir);var f="y"!==t?ie(o,n.left,n.right,r.scrollLeft,r.clientWidth,r.scrollWidth):null;f&&(c=-1===f.dir?"left":"right",a=le(f.distance)*f.dir),(Q=[l,c].filter(Boolean).join(" "))!==te&&(e.setAttribute(U,Q),te=Q),(a||u)&&r.scrollBy(a,u),ne.schedule("autoScrollLoop",ce)}}}function ae(e){e instanceof DragEvent&&0===e.buttons?ue():$.x===e.clientX&&$.y===e.clientY||($.x=e.clientX,$.y=e.clientY,ne.schedule("onMove",(function(){if(!Z){var e=$.x-G.x,r=$.y-G.y;if(10>Math.hypot(e,r))return;Z=!0}var t=document.elementFromPoint($.x,$.y);if(t){var n=t.closest("[morph-scroll]");if(n||J){var o=n?fe.get(n):J;o&&(J=o,ee!==o.element&&(re&&re!==o.parent&&re.removeAttribute(U),ee=o.element,(re=o.parent).setAttribute(U,Q),te=Q,ce()))}else oe()}})))}function ue(){null==K||K.abort(),K=null,Z=!1,ne.cancel(),oe()}function se(e){var r=e instanceof PointerEvent;if(!r||e.target.closest("[ms-custom-drag]")){G.x=e.clientX,G.y=e.clientY,null==K||K.abort();var t=new AbortController;K=t;var n=t.signal;r?(document.addEventListener("pointermove",ae,{signal:n}),document.addEventListener("pointerup",ue,{signal:n})):(document.addEventListener("dragover",ae,{signal:n}),document.addEventListener("dragend",ue,{signal:n}),document.addEventListener("drop",ue,{signal:n}),document.addEventListener("pointerdown",ue,{signal:n}),window.addEventListener("blur",ue,{signal:n}))}}var fe=new Map;var de=function(u){var p,g,b,M,E,k,j,L,A=u.className,R=u.children,z=u.type,T=void 0===z?"scroll":z,V=u.direction,U=void 0===V?"y":V,G=u.scrollPosition,$=u.onScrollValue,Z=u.isScrolling,J=u.onRenderedKeysChange,Q=u.size,ee=u.objectsSize,re=u.crossCount,te=u.gap,ne=u.wrapperMargin,oe=u.wrapperMinSize,ie=u.wrapperAlign,le=u.elementsAlign,ce=u.elementsDirection,ae=void 0===ce?"row":ce,ue=u.edgeGradient,de=u.progressTrigger,ve=void 0===de?{wheel:!0}:de,he=u.progressReverse,me=void 0!==he&&he,pe=u.scrollBarOnHover,ye=void 0!==pe&&pe,ge=u.scrollBarEdge,be=u.thumbMinSize,xe=u.render,we=u.emptyElements,Se=u.suspending,Me=void 0!==Se&&Se,Ee=u.fallback,ke=u.dragScroll,je=(j=l(r.useState({}),2)[1],r.useCallback((function(){j({})}),[])),Le=(null===(L=r.useRef(null)).current&&(L.current="".concat(f++)),L.current),Ae=B(),Re=function(){return Ae.schedule("triggerUpdate",je)},ze=B();if(!Q)throw Error('prop "size" is not provided'.concat("\n morph-scroll ".concat(Le)));Object.keys(ve).length,"none"===ee||Array.isArray(ee)&&("none"===ee[0]||ee[1]);var Te=r.useRef(null),Ce=r.useRef(null),Fe=r.useRef(null),Oe=r.useRef(null),Ie=r.useRef(new Set),Ne=r.useRef(H()),Ye=r.useRef(!0),He=r.useRef(null),We=r.useRef({loaded:new Set,empty:new Set}),Xe=r.useRef({targetScrollY:0,targetScrollX:0,animating:!1,animationFrameId:0}),Be=r.useRef(!1),Pe=r.useRef(!1),De=r.useRef(function(e){void 0===e&&(e=2);var r=0,t=0,n=null,o=null;return{update:function(i,l){var c=i-r,a=l-t;Math.abs(c)>e&&(n=c>0?"right":"left",r=i),Math.abs(a)>e&&(o=a>0?"down":"up",t=l)},reset:function(){n=null,o=null},get:function(){return{x:n,y:o}}}}()),qe=r.useRef({x:null,y:null}),Ve=r.useRef({x:0,y:0}),Ue=r.useRef(!1),Ke=r.useRef(null),_e=r.useRef(J);function Ge(){return r.useRef({width:0,height:0})}var $e=Ge(),Ze=Ge(),Je=Ge(),Qe=l(function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];var n=new WeakMap,o=function(e){if(null===e)return 1;if("boolean"==typeof e)return e?2:3;if("number"==typeof e||"bigint"==typeof e)return 0|+e;if("string"==typeof e){for(var t=0,i=0;i<e.length;i++)t=31*t+e.charCodeAt(i)>>>0;return t}if(void 0===e)return 4;if("function"==typeof e)return 5;if(r.isValidElement(e))return 6;if(Array.isArray(e)){for(t=0,i=0;i<e.length;i++)t=31*t+o(e[i])>>>0;return t}if(e instanceof Set)return Array.from(e).map(o).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if(e instanceof Map)return Array.from(e.entries()).map((function(e){var r=l(e,2),t=r[0],n=r[1];return 31*o(t)+o(n)>>>0})).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if("object"==typeof e&&null!==e){if(n.has(e))return n.get(e);var c=Object.entries(e).sort((function(e,r){var t=l(e,1)[0],n=l(r,1)[0];return t.localeCompare(n)})).map((function(e){var r=l(e,2)[1];return o(r)})).reduce((function(e,r){return 31*e+r>>>0}),0);return n.set(e,c),c}return 7};return e.map(o)}(G,xe,Q,ee,we,oe,ie,te,ve,We.current.empty,ge),11),er=Qe[0],rr=Qe[1],tr=Qe[2],nr=Qe[3],or=Qe[4],ir=Qe[5],lr=Qe[6],cr=Qe[7],ar=Qe[8],ur=Qe[9],sr=Qe[10],fr=r.useMemo((function(){var e,r,t=[null],n=200,o=null;if(null!=G)if("number"==typeof G||"end"===G)t=[G,G];else if(Array.isArray(G))t=G;else if("object"==typeof G){var i=G.value;"number"==typeof i||"end"===i?t=[i,i]:Array.isArray(i)&&(t=i),n=null!==(e=G.duration)&&void 0!==e?e:200,o=null!==(r=G.updater)&&void 0!==r?r:null}return{value:t,duration:n,updater:o}}),[er]),dr={color:null,size:40},vr=r.useMemo((function(){return"object"==typeof ue?n(n({},dr),ue):"string"==typeof ue?{color:ue,size:40}:dr}),[ue]),hr=r.useMemo((function(){var e=ve.arrows,t={size:40,contentReduce:!0,loop:!1};return r.isValidElement(e)?n(n({},t),{element:e}):"object"==typeof e&&null!==e?n(n({},t),e):t}),[ar]),mr=r.useMemo((function(){return r.Children.toArray(R).flatMap(D)}),[R]),pr=r.useMemo((function(){return mr.map((function(e){return r.isValidElement(e)&&e.key?e.key+"":null})).filter((function(e){return null!==e})).filter((function(e){var r;return!("clear"===we||we&&"object"==typeof we&&"mode"in we&&"clear"===we.mode)||!(null===(r=We.current.empty)||void 0===r?void 0:r.has(e))}))}),[R,or,ur]),yr=l(ne?a(ne):[0,0,0,0],4),gr=yr[0],br=yr[1],xr=yr[2],wr=yr[3],Sr=gr+xr,Mr=wr+br,Er=r.useMemo((function(){var e,r;return"number"==typeof te?[te,te]:Array.isArray(te)?[null!==(e=te[1])&&void 0!==e?e:0,null!==(r=te[0])&&void 0!==r?r:0]:[0,0]}),[te]),kr=r.useMemo((function(){var e={type:void 0,rootMargin:0,stopLoadOnScroll:!1,trackVisibility:!1};if("string"==typeof xe)return n(n({},e),{type:xe});if("object"==typeof xe&&null!==xe){var r=xe.type,t=xe.rootMargin,o=void 0===t?e.rootMargin:t,i=xe.stopLoadOnScroll,l=void 0===i?e.stopLoadOnScroll:i,c=xe.trackVisibility;return{type:r,rootMargin:o,stopLoadOnScroll:l,trackVisibility:void 0===c?e.trackVisibility:c}}return e}),[rr]),jr=r.useMemo((function(){return a(kr.rootMargin)}),[kr.rootMargin,U]),Lr=r.useMemo((function(){var e=l(Array.isArray(Q)?Q:"number"==typeof Q?[Q,Q]:[$e.current.width,$e.current.height],2),r=e[0],t=e[1];if(!ve.arrows||!hr.size||!hr.contentReduce)return[r,t,r,t];var n=2*hr.size,o=r,i=t;return"x"===U?o=r-n:"y"===U?i=t-n:"hybrid"===U&&(o=r-n,i=t-n),[o,i,r,t]}),[tr,ar,U,hr,$e.current.height,$e.current.width]),Ar="x"===U?Lr[0]:Lr[1],Rr=r.useMemo((function(){if(!ge)return[0,0];if("number"==typeof ge){var e=2*ge;return[e,e]}if(Array.isArray(ge)){var r=l(ge,2),t=r[0],n=void 0===t?0:t,o=r[1];return[2*n,2*(null!=o?o:n)]}return[0,0]}),[sr]),zr=r.useMemo((function(){return[Lr[0]-Rr[0],Lr[1]-Rr[1]]}),[Rr.join(),Lr[0],Lr[1]]),Tr=r.useMemo((function(){return ee?Array.isArray(ee)?ee:a(ee,!0,2):[null,null]}),[nr]),Cr=r.useMemo((function(){var e=Je.current,r=e.height,t=e.width,n=function(e,r,t){return r||("number"==typeof e?e:"size"===e?t:0)};return[n(Tr[0],t,Lr[0]),n(Tr[1],r,Lr[1])]}),[Tr.join(),U,Je.current.width,Je.current.height,Lr.join()]),Fr=r.useMemo((function(){return xe&&we&&!Ee?e.jsx("div",{className:"ms-empty-element"}):Ee}),[!!Ee,rr,or]),Or=r.useMemo((function(){if("none"===Tr[0]||"none"===Tr[1])return[1,pr.length];var e="x"===U?1:0,r="row"===ae,t=Lr[e],n=Cr[e]?Cr[e]+Er[e]:0,o="hybrid"===U&&t?n*pr.length:t,i=n?Math.floor(o/n):1,l=re&&i>=re?"hybrid"===U?Math.ceil(i/re):re:i,c=l>1&&l<pr.length?Math.ceil(pr.length/l):l<pr.length?pr.length:1;r||(l=Math.ceil(pr.length/c));var a=re&&re<pr.length,u=function(e){return Number.isFinite(e)&&e>0?e:1};if("hybrid"===U){var s=a?r?re:l:r?pr.length:1,f=a?r?l:re:r?1:pr.length;return[u(s),u(f)]}return[u(l),u(c)]}),[ae,Er[0],Er[1],Cr[0],Cr[1],pr.length,U,Lr.join(),re]),Ir=r.useMemo((function(){var e=1>Or[0]?1:Or[0]*Er[1]-Er[1],r=Or["x"===U?1:0],t=pr.length<r?pr.length:r;return Cr[0]?(Cr[0]+Er[1])*t-Er[1]:kr.type?Je.current.width+e:Ze.current.width}),[U,Cr[0],Or[0],Or[1],Er[1],Ze.current.width,Je.current.width,kr.type,pr.length]),Nr=r.useMemo((function(){var e=1>Or[1]?1:Or[0]*Er[0]-Er[0];return Cr[1]?"x"===U?(Cr[1]+Er[0])*Or[0]-Er[0]:(Cr[1]+Er[0])*Or[1]-Er[0]:kr.type?Je.current.height+e:Ze.current.height}),[U,Cr[1],Or[0],Or[1],Er[0],Ze.current.height,Je.current.height,kr.type]),Yr=r.useMemo((function(){return Nr+Sr}),[Nr,Sr]),Hr=r.useMemo((function(){return Ir+Mr}),[Ir,Mr]),Wr="x"===U?Hr:Yr,Xr=r.useMemo((function(){return[Math.max(0,Hr-Lr[0]),Math.max(0,Yr-Lr[1])]}),[Lr.join(),Yr,Hr]),Br="x"===U?(null===(p=Fe.current)||void 0===p?void 0:p.scrollLeft)||0:(null===(g=Fe.current)||void 0===g?void 0:g.scrollTop)||0,Pr=Br>1&&!0,Dr=Wr>Math.round(Br+Ar),qr=!1,Vr=!1;"hybrid"===U&&(qr=((null===(b=Fe.current)||void 0===b?void 0:b.scrollLeft)||0)>1&&!0,Vr=Math.round(((null===(M=Fe.current)||void 0===M?void 0:M.scrollLeft)||0)+Lr[0])<Hr);var Ur=r.useMemo((function(){return null!=be?be:30}),[be]),Kr=r.useCallback((function(e){return ve.progressElement&&Wr?"x"===e?W(Lr[0]-Rr[0],Hr,Ur):W(Lr[1]-Rr[1],Yr,Ur):0}),[ar,Wr,Lr[0],Lr[1],Hr,Ur,Rr.join()]),_r=r.useMemo((function(){return{x:"y"!==U?Kr("x"):0,y:"x"!==U?Kr("y"):0}}),[Kr,U]),Gr=r.useMemo((function(){return{w:Lr[0]?Hr-Lr[0]:Hr,h:Lr[1]?Yr-Lr[1]:Yr}}),[Hr,Yr,Lr[0],Lr[1]]),$r={x:"y"!==U?X((null===(E=Fe.current)||void 0===E?void 0:E.scrollLeft)||0,Gr.w,zr[0],_r.x):0,y:"x"!==U?X((null===(k=Fe.current)||void 0===k?void 0:k.scrollTop)||0,Gr.h,zr[1],_r.y):0},Zr=r.useMemo((function(){if(!kr.type)return[{top:0,bottom:0,left:0,right:0}];for(var e=0,r="x"===U,t="row"===ae,n=r&&!t||!r&&t,o=Cr[0]+Er[1],i=Cr[1]+Er[0],l=new Set,c=n?Or[0]:Or[1],a=Cr[t?0:1],u=Er[t?1:0],s=Math.floor((pr.length-1)/c)*c;s<pr.length;s++)l.add(s);var f=c-l.size,d=f>0?(a+u)*f:0;return"center"===le?e=Math.round(d/2):"end"===le&&(e=d),pr.map((function(r,c){var a,u,s=n?c%Or[0]:Math.floor(c/Or[1]),f=n?Math.floor(c/Or[0]):c%Or[1];"x"===U?(a=f,u=s):(a=s,u=f);var d=l.size>0&&l.has(c),v=(d&&!t?e:0)+i*u,h=(d&&t?e:0)+o*a;return{top:v,left:h,bottom:v+Cr[1],right:h+Cr[0]}}))}),[Cr[0],Cr[1],Er[0],Er[1],le,pr.length,Or[0],Or[1],kr.type,ae,U]),Jr=r.useMemo((function(){return(null==Lr?void 0:Lr.length)&&ie?function(e,r,t,n){var o=l("string"==typeof e?[e,e]:e,2),i=o[0],c=o[1],a=void 0===c?"start":c,u={display:"flex"};return r[0]>t&&(u.justifyContent=N(i)),r[1]>n&&(u.alignItems=N(a)),u}(ie,Lr,Hr,Yr):{}}),[ie,Lr.join(),Yr,Hr]),Qr=r.useMemo((function(){return[F(Hr,Lr[0]),F(Yr,Lr[1])]}),[Hr,Yr,Lr.join()]),et=r.useMemo((function(){return"x"===U?Qr[0]:Qr[1]}),[U,Qr[0],Qr[1]]),rt=r.useCallback(Y($e,Re),[]),tt=r.useCallback(Y(Ze,Re,Mr,Sr),[Mr,Sr]),nt=r.useCallback(Y(Je,Re),[]),ot=r.useCallback((function(e,r,n){var l=Fe.current;return l&&null!==e?function(e,r,n,l,c,a){return o(this,void 0,void 0,(function(){var o,u,s,f,v;return i(this,(function(i){switch(i.label){case 0:return u=(o="y"===e)?"scrollTop":"scrollLeft",s=o?a[1]:a[0],f=d(l,0,s),(v=d(r[u],0,s))===f?[2]:null!==n?[3,2]:[4,O(r)];case 1:return i.sent(),r[u]=l,[2];case 2:return t.setLockTask((function(){var e=performance.now(),t=function(){var o=performance.now(),i=Math.min((o-e)/n,1),l=d(v+(f-v)*i,0,s);r[u]=l,1>i&&l!==f&&c("smoothScroll",t)};c("smoothScroll",t)}),n,"smoothScrollBlock".concat(e)),[2]}}))}))}(r,l,Ye.current?null:n,e,ze.schedule,Xr):null}),[Xr.join()]),it=r.useMemo((function(){var e=n(n(n({margin:ne?"".concat(gr,"px ").concat(br,"px ").concat(xr,"px ").concat(wr,"px"):"",height:Tr[1]&&"none"!==Tr[1]?"".concat(Nr,"px"):"fit-content",width:Tr[0]&&"none"!==Tr[0]?"".concat(Ir,"px"):"fit-content"},te&&!kr.type&&{gap:"".concat(Er[0],"px ").concat(Er[1],"px")}),oe&&function(e,r,t,n,o){var i,c,a,u=function(e,r){return"full"===e?("x"===r?t[0]:t[1])-("x"===r?n:o):e};if("hybrid"!==r&&!Array.isArray(e)){var s="".concat(u(e,r),"px");return"x"===r?{minWidth:s}:{minHeight:s}}return Array.isArray(e)?(c=(i=l(e,2))[0],a=i[1]):c=a=e,{minWidth:"".concat(u(c,"x"),"px"),minHeight:"".concat(u(a,"y"),"px")}}(oe,U,Lr,Mr,Sr)),("hybrid"===U||"x"===U)&&{flexShrink:0});if(kr.type)return n(n({},e),{position:"relative"});var r=1===Or[0]?"y"===U?"column":"row":ae,t=Tr[0]&&"none"!==Tr[0]&&Tr[1]&&"none"!==Tr[1]?"wrap":void 0;return n(n({},e),{display:"flex",flexDirection:r,flexWrap:t,justifyContent:N(le)})}),[ne,lr,ir,[gr,br,xr,wr,Mr,Sr,Er[0],Er[1]].join(),Lr.join(),cr,Tr[1],Nr,Ir,cr,kr.type,U,Or[0],ae,le]),lt=r.useCallback((function(e,r,t){var n;Ne.current=H();var o=r.target;if(!o.closest('\n [ms-custom-drag], [draggable="true"], [contenteditable],\n input, textarea, select, button, a\n ')){var i=null;t&&(i=null===(n=o.closest("scroll"===T?".ms-bar":".ms-slider"))||void 0===n?void 0:n.getAttribute("data-direction")),He.current=e,C({scrollElement:Fe.current,target:o,clickedObject:He,scrollStateRef:Xe.current,type:T,triggerUpdate:Re,direction:U,smoothScroll:ot,sizeLocal:[Lr[0],Lr[1]],thumbSize:"x"===i?_r.x:_r.y,axisFromAtr:i,duration:fr.duration,scrollBarEdge:Rr,rafScrollAnim:ze,isTouched:Ne.current,gap:Er,overscrollRef:Ve,objLengthPerSize:Qr,isDraggingRef:Ue,maxScrollSize:Xr})}}),[U,T,Lr.join(),fr.duration,ot,Rr.join(),_r.x,_r.y,Er.join(),Qr,Xr.join()]),ct=r.useCallback((function(e){lt("thumb",e,!0)}),[lt]),at=r.useCallback((function(e){Fe.current&&function(e){var r=e.arrowType,t=e.scrollElement,n=e.wrapSize,o=e.scrollSize,i=e.smoothScroll,l=e.duration,c=e.loop,a=e.gap,u=n[0],s=n[1],f=t.scrollTop,d=t.scrollLeft,v=function(e,r,n){var o=n?function(e,r){return"x"===e?r>0?0:u:r>0?0:s}(e,r):function(e,r){var n="x"===e,o=n?d:f,i=n?a[0]:a[1],l=t[n?"clientWidth":"clientHeight"]+i;return l*(Math.floor(Math.max(0,o)/l)+r)}(e,r);i(o,e,l)};switch(r){case"top":f>0?v("y",-1):c&&v("y",-1,!0);break;case"left":d>0?v("x",-1):c&&v("x",-1,!0);break;case"right":d+o[0]<u?v("x",1):c&&v("x",1,!0);break;case"bottom":f+o[1]<s?v("y",1):c&&v("y",1,!0)}}({arrowType:e,scrollElement:Fe.current,wrapSize:[Hr,Yr],scrollSize:Lr,smoothScroll:ot,duration:fr.duration,loop:hr.loop,gap:Er})}),[Lr.join(),Hr,Yr,fr.duration,ot,hr.loop,Er[0],Er[1]]),ut=r.useCallback((function(){"scroll"!==T&&Lr[0]&&Lr[1]&&Ce.current&&Fe.current&&Ie.current.size&&function(e,r,t,n){c([],l(r),!1).forEach((function(r,o){var i,l,c=I.get(r),a=0===o?t:"x",u="x"===a?0:1;if(c&&c.elements.length===n[u]||(c={elements:Array.from(r.querySelectorAll(".ms-slider-element")),lastIndex:-1},I.set(r,c)),c.elements.length){var s="x"===a?e.scrollLeft:e.scrollTop,f="x"===a?e.clientWidth:e.clientHeight,d=Math.floor((s+f/2)/f);d!==c.lastIndex&&(-1!==c.lastIndex&&(null===(i=c.elements[c.lastIndex])||void 0===i||i.classList.remove("active")),null===(l=c.elements[d])||void 0===l||l.classList.add("active"),c.lastIndex=d)}}))}(Fe.current,Ie.current,U,Qr)}),[Lr.join(),U,T,Qr.join()]),st=r.useCallback((function(e){if(e){var r=(o=Oe.current)?Array.from(o.children).flatMap((function(e){if(!(e instanceof HTMLElement))return[];var r=e.getAttribute(v);return r?[q(r)]:[]})):[];Ke.current&&(t=Ke.current,n=r,t.length===n.length&&t.every((function(e,r){return e===n[r]})))||(Ke.current=r,e(r))}var t,n,o}),[]),ft=r.useCallback((function(){Oe.current&&function(e,r,t,n){for(var o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return e instanceof Element&&e.hasAttribute(v)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=o.nextNode();i;){var l=i,c=l.getAttribute(v);if(c){var a=0===l.children.length;a&&(r.current.empty||(r.current.empty=new Set),r.current.empty.add(c)),"virtual"===n&&a||r.current.loaded.add(c)}i=o.nextNode()}t()}(Oe.current,We,Re,kr.type)}),[rr]),dt=r.useCallback((function(e){"object"==typeof we&&"clickTrigger"in we&&void 0!==we.clickTrigger&&function(e,r,n){var o="string"==typeof r?{selector:r}:r,i=o.selector,l=o.delay,c=void 0===l?0:l,a=e.target;if(a.closest(i)){var u=a.closest("[wrap-id]");null==u||u.classList.add("remove"),t.setTask((function(){null==u||u.classList.remove("remove"),n()}),c)}}(e,we.clickTrigger,ft)}),[or,ft]),vt=r.useCallback((function(e){t.cancelTask("removeHover");var r=Ce.current,n=Te.current,o=Fe.current;if(r&&n&&o){if(fr.value.includes("end")){var i=e.currentTarget,l=i.scrollLeft,c=i.scrollTop;De.current.update(l,c)}null==$||$(o.scrollLeft,o.scrollTop);var a=r.querySelectorAll("scroll"===T?".ms-bar":".ms-slider");ye&&a.length>0&&!Be.current&&a.forEach((function(e){e.classList.contains("hover")||S(e)})),Be.current=!0,null==Z||Z(!0),t.setTask((function(){De.current.reset(),Be.current=!1,null==Z||Z(!1),kr.type&&ft(),ye&&a.length>0&&!He.current&&a.forEach((function(e){t.setTask((function(){e.hasAttribute("ms-manual-hover")||w(e)}),1e3,"removeHover")}))}),200,"isScrolling"),t.setTask((function(){return st(_e.current)}),"raf","onRenderedKeysChange"),Ae.schedule("sliderCheckLocal",(function(){"scroll"!==T&&ut(),je()}))}}),[$,Z,T,ut,ft,ye,kr.type]),ht=r.useCallback((function(e){if(!Pe.current){var r="object"==typeof ve.wheel&&"string"==typeof ve.wheel.changeDirectionKey?ve.wheel.changeDirectionKey:"KeyX";e.code!==r||"hybrid"!==U||Pe.current||(e.stopPropagation(),Pe.current=!0,Re())}}),[U,ar]),mt=r.useCallback((function(e){Pe.current&&(e.stopPropagation(),Pe.current=!1,Re())}),[]);r.useEffect((function(){if(!J)return _e.current=void 0,void(Ke.current=null);_e.current=J,Ke.current=null,st(J)}),[J,st]),r.useEffect((function(){_e.current&&Lr[0]&&Lr[1]&&st(_e.current)}),[pr.join("|"),Lr.join()]),r.useEffect((function(){if(!Ne.current&&"hybrid"===U){var e=Oe.current,r=Fe.current;if(e&&r)return e.clientWidth+Mr>r.clientWidth&&e.clientHeight+Sr>r.clientHeight&&(r.addEventListener("keydown",ht),r.addEventListener("keyup",mt)),function(){r.removeEventListener("keydown",ht),r.removeEventListener("keyup",mt)}}}),[U,ar,tr,nr,pr.join(),Mr,Sr]),r.useEffect((function(){we&&kr.type&&ft()}),[or,kr.type,ft,pr.length]),r.useEffect((function(){if(!Ne.current){var e=Fe.current,r=Oe.current;if(e&&r){var t="hybrid"===U&&"object"==typeof ve.wheel&&ve.wheel.changeDirection?"x":U,n="hybrid"===U&&Nr+Sr<=Lr[1]||Pe.current?["hybrid","y"].includes(t)?"x":"y":t,o=function(r){r.preventDefault(),h(r,e,Xr,Xe.current,n)};return ve.wheel&&e.addEventListener("wheel",o,{passive:!1}),function(){e.removeEventListener("wheel",o)}}}}),[U,ar,Nr,Lr[1],Sr,Pe.current,Xr.join()]),r.useEffect((function(){Ae.schedule("smoothScrollLocal",(function(){("hybrid"===U?["x","y"]:[U]).forEach((function(e){var r=fr.value["x"===e?0:1];if("end"===r){if(De.current.get()[e]===("x"===e?"left":"up"))return;ot("x"===e?Gr.w:Gr.h,e,fr.duration)}else"number"==typeof r&&qe.current[e]!==r&&(qe.current[e]=r,ot(r,e,fr.duration))}))}))}),[U,er,Gr.w,Gr.h,fr.value.join()]),r.useEffect((function(){var e=Xe.current.animationFrameId;return(kr.type||Z)&&Z&&Z(!1),requestAnimationFrame((function(){return Ye.current=!1})),function(){e&&cancelAnimationFrame(e),Xe.current.animationFrameId&&cancelAnimationFrame(Xe.current.animationFrameId),ze.cancel()}}),[]),r.useEffect((function(){if(ke){var e=Te.current,r=Fe.current;if(e&&r){var t={parent:e,element:r,direction:U};return function(e){fe.set(e.parent,e),1===fe.size&&function(){if(!_){var e=(P=new AbortController).signal;document.addEventListener("pointerdown",se,{signal:e}),document.addEventListener("dragstart",se,{signal:e}),_=!0}}()}(t),function(){!function(e){fe.delete(e.parent),0===fe.size&&_&&(null==P||P.abort(),null==K||K.abort(),_=!1)}(t)}}}}),[ke,U]),r.useEffect((function(){var e=Fe.current;if(e){var r=function(e){lt("wrapp",e)};if(ve.content||!ve.content&&Ne.current&&ve.wheel){if(!0===ve.progressElement)return;e.addEventListener("pointerdown",r)}return function(){e.removeEventListener("pointerdown",r)}}}),[ar,lt]),r.useEffect((function(){var e=Ce.current;if(e&&ye&&Ie.current.size){var r=function(e){"mouseenter"===e.type&&document.removeEventListener("mouseup",r),"mouseleave"===e.type&&He.current?document.addEventListener("mouseup",r):Array.from(Ie.current).forEach((function(r){!function(e){var r=e.el,t=e.event,n=e.isScrolling,o=function(e){if(["mouseleave","mouseup","pointerup","pointercancel"].includes(t.type)){if(e.removeAttribute("ms-manual-hover"),null==n?void 0:n.current)return;w(e)}else e.setAttribute("ms-manual-hover",""),S(e)};Array.isArray(r)?r.map((function(e){return o(e)})):o(r)}({el:r,event:e,isScrolling:Be})}))},t=function(r,t){Ne.current?(Array.from(Ie.current).forEach((function(e){return e[r]("pointerdown",t)})),document[r]("pointerup",t),document[r]("pointercancel",t)):(e[r]("mouseenter",t),e[r]("mouseleave",t))};return t("addEventListener",r),function(){t("removeEventListener",r)}}}),[ye,T,U,Ie.current.size]),r.useEffect((function(){"scroll"!==T&&Ae.schedule("sliderCheckLocal",ut)}),[T,ut,Lr.join()]);var pt,yt=r.useCallback((function(t,o,i,l,c){var a,u=n(n({width:Cr[0]?"".concat(Cr[0],"px"):void 0,height:Cr[1]?"".concat(Cr[1],"px"):void 0},kr.type&&{position:"absolute",transform:"translate(".concat(i,"px, ").concat(o,"px)")}),"number"==typeof c&&{"--content-visibility":c}),s=Me?e.jsx(r.Suspense,{fallback:Fr,children:l}):l;return e.jsx("div",n({},kr.type||we?((a={})[v]="".concat(t),a):{},{className:"ms-object-box",style:u,onClick:we?dt:void 0,children:s}),t)}),[Me,!!Fr,Cr[0],Cr[1],rr,or,Or[0],dt,kr.type]),gt=r.useMemo((function(){var e=new Map;return mr.forEach((function(t){r.isValidElement(t)&&null!=t.key&&e.set(t.key+"",t)})),e}),[mr]),bt=r.useMemo((function(){return c([{positionType:"x"===U?"left":"top",visibility:Pr},{positionType:"x"===U?"right":"bottom",visibility:Dr}],l("hybrid"===U?[{positionType:"left",visibility:qr},{positionType:"right",visibility:Vr}]:[]),!1)}),[Pr,Dr,U,qr,Vr]),xt=r.useMemo((function(){return{width:"".concat(Lr[2],"px"),height:"".concat(Lr[3],"px")}}),[Lr]),wt=r.useMemo((function(){var e;return null!==(e={x:Hr>Lr[0]?"scroll hidden":"hidden",y:Yr>Lr[1]?"hidden scroll":"hidden",hybrid:"".concat(Hr>Lr[0]?"scroll":"hidden"," ").concat(Yr>Lr[1]?"scroll":"hidden"),hide:"hidden"}[ve.wheel||ve.content&&"scroll"===T?U:"hide"])&&void 0!==e?e:"hidden"}),[Hr,Yr,Lr,ar,U]),St=r.useMemo((function(){return ue?bt.map((function(r){var t=r.positionType,n=r.visibility;return e.jsx(y,{edgeGradient:vr,visibility:n,edgeType:t,size:Lr},"edge-".concat(t))})):null}),[ue,bt,vr,tr]),Mt=r.useMemo((function(){return ve.arrows?bt.map((function(r){var t=r.positionType,n=r.visibility;return e.jsx(x,{visibility:n,arrows:hr,arrowType:t,handleArrow:at,size:Lr[0]},"arrow-".concat(t))})):null}),[ar,bt,hr,at,Lr[0]]),Et=function(){var t,o,i=(null===(t=Fe.current)||void 0===t?void 0:t.scrollLeft)||0,l=(null===(o=Fe.current)||void 0===o?void 0:o.scrollTop)||0;return e.jsx("div",{className:"ms-objects-wrapper",ref:Oe,style:n(n(n({},it),(Ve.current.x||Ve.current.y)&&{transform:"translate(".concat(Ve.current.x,"px, ").concat(Ve.current.y,"px)")}),Ue.current&&{pointerEvents:"none"}),children:pr.map((function(t,n){return function(t,n,o,i){var l,c=gt.get(t),a=kr.stopLoadOnScroll&&Be.current&&!We.current.loaded.has(t)?Fr:(null===(l=We.current.empty)||void 0===l?void 0:l.has(t))?we&&"object"==typeof we&&r.isValidElement(we)?we:we&&"object"==typeof we&&"mode"in we&&"object"==typeof we.mode&&"fallback"in we.mode?we.mode.fallback:Fr:c,u="firstChild"!==Tr[0]&&"firstChild"!==Tr[1]||0!==n?a:e.jsx(s,{onResize:nt,children:a});if(!kr.type)return yt(t,0,0,u);var f=Zr[n],d=f.top,v=f.bottom,h=f.left,m=f.right,p=function(e){void 0===e&&(e=!0);var r=e?jr:[0,0,0,0],t=function(e){var t="x"===e?o:i,n=t+("x"===e?Lr[0]:Lr[1]),l="x"===e?h-r[3]:d-r[2],c="x"===e?m+r[1]:v+r[0],a=c-l;if(0>=a)return 0;var u=Math.min(c,n)-Math.max(l,t);return u>0?Math.round(10*Math.min(1,u/a))/10:0};if("hybrid"===U){var n=t("x"),l=t("y");return Math.min(n,l)}return t("x"===U?"x":"y")},y=p(),g=kr.trackVisibility?p(!1):null;if("lazy"===kr.type){var b=We.current.loaded.has(t);if(y&&!b){if(Be.current&&kr.stopLoadOnScroll)return;We.current.loaded.add(t)}return b?yt(t,d,h,u,g):null}return y?yt(t,d,h,u,g):(We.current.loaded.delete(t),null)}(t,n,i,l)}))})},kt=r.useMemo((function(){var e={position:"relative",width:"".concat(Lr[0],"px"),height:"".concat(Lr[1],"px")};return ve.arrows&&hr.contentReduce&&hr.size&&("x"===U?e.left="".concat(hr.size,"px"):"y"===U?e.top="".concat(hr.size,"px"):(e.top="".concat(hr.size,"px"),e.left="".concat(hr.size,"px"))),e}),[Lr,ar,hr,U]),jt=e.jsxs("div",{"morph-scroll":"".concat(Le),className:A,ref:Te,style:xt,children:[e.jsxs("div",{className:"ms-content",ref:Ce,style:n(n(n({},kt),{transform:"translateZ(0)"}),Ne.current&&{touchAction:"pinch-zoom"}),children:[e.jsx("div",{className:"ms-element",ref:Fe,onScroll:vt,tabIndex:0,style:n(n(n({width:"100%",height:"100%",outline:"none"},Jr),"boolean"!=typeof ve.progressElement||!1===ve.progressElement?{scrollbarWidth:"none",overflow:"hidden"}:{overflow:wt}),ve.content&&{cursor:"grab"}),children:Cr[0]&&Cr[1]?Et():e.jsx(s,{onResize:tt,style:Jr,children:Et()})}),St,ve.progressElement&&!0!==ve.progressElement?(pt="x"!==U,[{shouldRender:Wr>Lr[pt?1:0],direction:U,thumbSize:pt?_r.y:_r.x,thumbSpace:pt?$r.y:$r.x,objLengthPerSize:et,progressReverseIndex:0},{shouldRender:"hybrid"===U&&Hr>Lr[0],direction:"x",thumbSize:_r.x,thumbSpace:$r.x,objLengthPerSize:Qr[0],progressReverseIndex:1}].filter((function(e){return e.shouldRender}))).map((function(r){var t="boolean"==typeof me?me:me[r.progressReverseIndex];return e.jsx(m,{type:T,direction:r.direction,progressReverse:t,size:zr,progressTrigger:[ve,ar],scrollBarOnHover:ye,scrollBarEvent:"sliderMenu"===T?ot:ct,thumbSize:r.thumbSize,thumbSpace:r.thumbSpace,objLengthPerSize:r.objLengthPerSize,sliderCheckLocal:ut,duration:fr.duration,isTouched:Ne.current,scrollStateRef:Xe,scrollEl:Fe,scrollBarsRef:Ie,triggerUpdate:Re,overscroll:Ve,maxScrollSize:Xr},r.direction)})):null]}),Mt]});return"auto"===Q?e.jsx(s,{measure:"outer",onResize:rt,children:jt}):jt};de.displayName="MorphScroll";var ve={MorphScroll:de,ResizeTracker:s,IntersectionTracker:u};exports.IntersectionTracker=u,exports.MorphScroll=de,exports.ResizeTracker=s,exports.default=ve;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("keytask-core"),n=function(){return n=Object.assign||function(e){for(var r,t=1,n=arguments.length;n>t;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},n.apply(this,arguments)};function o(e,r,t,n){return new(t||(t=Promise))((function(o,i){function l(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(l,c)}a((n=n.apply(e,r||[])).next())}))}function i(e,r){var t,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(e,i)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function l(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),l=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)l.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return l}function c(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;i>o;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var a=function(e,r,t){void 0===r&&(r=!1);var n=[];if(n=Array.isArray(e)?2===e.length?[e[1],e[0],e[1],e[0]]:c([],l(e),!1):[e,e,e,e],r&&(n=[n[1],n[0],n[3],n[2]]),t){for(var o=[],i=0;t>i;i++)o.push(n[i%4]);n=o}return n},u=function(t){var n=t.className,o=t.children,i=t.style,c=t.root,u=t.threshold,s=t.rootMargin,f=t.visibleContent,d=void 0!==f&&f,v=t.onIntersection,h=l(r.useState(!1),2),m=h[0],p=h[1],y=r.useRef(null),g=r.useMemo((function(){if(!s)return"";var e=a(s);return"".concat(e[0],"px ").concat(e[1],"px ").concat(e[2],"px ").concat(e[3],"px")}),[s]),b=r.useCallback((function(e){var r=l(e,1)[0];p(r.isIntersecting),v&&v({time:r.time,rootBounds:r.rootBounds,boundingClientRect:r.boundingClientRect,intersectionRect:r.intersectionRect,isIntersecting:r.isIntersecting,intersectionRatio:r.intersectionRatio,target:r.target})}),[v]);return r.useEffect((function(){var e=new IntersectionObserver(b,{root:c,threshold:u,rootMargin:g});return y.current&&e.observe(y.current),function(){e.disconnect()}}),[b,c,u,g]),e.jsx("div",{"intersection-tracker":"",className:n,ref:y,style:i,children:d||m?o:null})};u.displayName="IntersectionTracker";var s=function(t){var o=t.className,i=t.children,l=t.style,c=t.measure,a=void 0===c?"inner":c,u=t.onResize,s=r.useRef(null);r.useEffect((function(){var e=s.current;if(e){var r=new ResizeObserver((function(e){var r,t;try{for(var n=function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),o=n.next();!o.done;o=n.next()){var i=o.value;u&&u(i.contentRect)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(r)throw r.error}}}));return r.observe(e),function(){r.unobserve(e),r.disconnect()}}}),[a,u]);var f={width:"max-content",height:"max-content"},d={inner:n({},f),outer:n({},{width:"100%",height:"100%"}),all:n({minWidth:"100%",minHeight:"100%"},f)};return e.jsx("div",{"resize-tracker":"",className:o,ref:s,style:n(n({willChange:"width, height"},d[a]),l),children:i})};s.displayName="ResizeTracker";var f=t.createTaskManager(),d=f.cancelTask,v=f.setLockTask,h=f.setTask,m=1;function p(e,r,t,n){return void 0===r&&(r=0),void 0===t&&(t=1/0),void 0===n&&(n=!0),Math.max(r,Math.min(n?Math.round(e):e,t))}var y="wrap-id";function g(e,r,t,n,o){r.matches(":focus")||r.focus(),n.animating||(n.targetScrollX=p(r.scrollLeft,0,t[0]),n.targetScrollY=p(r.scrollTop,0,t[1])),"x"===o?n.targetScrollX=p(n.targetScrollX+e.deltaY,0,t[0]):n.targetScrollY=p(n.targetScrollY+e.deltaY,0,t[1]),n.animating||(n.animating=!0,n.animationFrameId=requestAnimationFrame((function e(){var i;if("x"===o){var l=p(r.scrollLeft+.4*(n.targetScrollX-r.scrollLeft),0,t[0]);r.scrollLeft=l,i=Math.abs(l-n.targetScrollX)}else{var c=p(r.scrollTop+.4*(n.targetScrollY-r.scrollTop),0,t[1]);r.scrollTop=c,i=Math.abs(c-n.targetScrollY)}i>2.5?n.animationFrameId=requestAnimationFrame(e):("x"===o?r.scrollLeft=p(n.targetScrollX,0,t[0]):r.scrollTop=p(n.targetScrollY,0,t[1]),n.animating=!1,n.animationFrameId=null)})))}var b=function(t){var o=t.type,i=t.direction,l=t.progressReverse,c=t.size,a=t.progressTrigger,u=t.scrollBarOnHover,s=t.scrollBarEvent,f=t.thumbSize,d=t.thumbSpace,v=t.objLengthPerSize,h=t.sliderCheckLocal,m=t.duration,p=t.isTouched,y=t.scrollStateRef,b=t.scrollEl,x=t.scrollBarsRef,w=t.triggerUpdate,M=t.overscroll,S=t.maxScrollSize,E=r.useRef(null),j=r.useRef(null),L=["hybrid","y"].includes(i)?"y":"x",k=Math.abs(M.current[L])*(f/200),A=f-k,R=0>M.current[L]?d+k:d,z=r.useMemo((function(){if("scroll"!==o){var r=c["x"===L?0:1];return Array.from({length:v},(function(t,i){return e.jsx("div",{className:"ms-slider-element",style:n({},"sliderMenu"===o&&{cursor:"pointer"}),onClick:"sliderMenu"===o?function(){s(r*i,L,m,h)}:void 0,children:Array.isArray(a[0].progressElement)?a[0].progressElement[i]:a[0].progressElement},i)}))}}),[v,o,a[1],m,h,c[0],c[1],s]),T=r.useMemo((function(){return"x"!==i?"y":"x"}),[i]),C=c["x"===T?0:1],F="scroll"!==o?"":f+2*d>C?"flex-end":"flex-start";r.useEffect((function(){if(!p&&a[0].wheel){var e=E.current,r=b.current;if(e&&r){for(var t=e.previousElementSibling;t&&!t.classList.contains("ms-element");)t=t.previousElementSibling;var n=function(e){return g(e,r,S,y.current,T)};return e.addEventListener("wheel",n,{passive:!1}),function(){return e.removeEventListener("wheel",n)}}}}),[T]),r.useEffect((function(){var e="slider"===o?E.current:j.current;if(e&&"sliderMenu"!==o){var r=function(e){return s(e)};return e.addEventListener("pointerdown",r),function(){return e.removeEventListener("pointerdown",r)}}}),[s,o]),r.useEffect((function(){var e=E.current;if(e)return x.current.add(e),w(),function(){x.current.delete(e)}}),[f]);var O=n({position:"absolute"},u&&{opacity:0,transition:"opacity 0.2s ease-in-out"});return e.jsx(r.Fragment,{children:"scroll"===o?e.jsx("div",{className:"ms-bar ms-".concat(T),ref:E,"data-direction":T,style:n(n(n({},O),{width:"fit-content",height:"".concat(C,"px")}),"x"===i?n({transformOrigin:"left top",left:"50%"},l?{top:0,transform:"rotate(-90deg) translate(-100%, -50%)"}:{transform:"rotate(-90deg) translateY(-50%)"}):n({top:"50%",transform:"translateY(-50%)"},l?{left:0}:{right:0})),children:e.jsx("div",{className:"ms-thumb",ref:j,style:n(n({height:"".concat(A,"px"),transform:"translateY(".concat(R,"px)")},a[0].progressElement&&{cursor:"grab"}),{display:"flex",alignItems:F}),children:a[0].progressElement})}):v>1&&a[0].progressElement&&e.jsx("div",{className:"ms-slider ms-".concat(T),ref:E,"data-direction":T,style:n(n(n(n({},O),{display:"flex"}),"slider"===o&&{cursor:"grab"}),"x"===i?n({transformOrigin:"left top",left:"50%",transform:"translateX(-50%)"},l?{top:0}:{bottom:0}):n({flexDirection:"column",top:"50%",transform:"translateY(-50%)"},l?{left:0}:{right:0})),children:z})})};b.displayName="ScrollBar";var x=function(r){var t,o=r.edgeGradient,i=r.visibility,l=r.edgeType;r.size;var c=n(n(n(((t={position:"absolute"})[l]=0,t.pointerEvents="none",t.transition="opacity 0.2s ease-in-out",t["--edge-visibility"]=i?1:0,t.opacity="var(--edge-visibility)",t),o.color&&{background:o.color&&"linear-gradient(".concat(["left","right"].includes(l)?"270deg, ":"").concat(o.color,", transparent)")}),["left","right"].includes(l)?{height:"100%",width:"".concat(o.size,"px"),top:0}:{width:"100%",height:"".concat(o.size,"px"),left:0}),"left"===l?{transform:"scaleX(-1)"}:"bottom"===l?{transform:"scaleY(-1)"}:{}),a="ms-edge ".concat(l).concat(i?"":" ms-disabled");return e.jsx("div",{className:a,style:c})};x.displayName="Edge";var w=r.memo(x),M=function(t){var o,i=t.visibility,l=t.arrows,c=t.arrowType,a=t.handleArrow,u=t.size,s=r.useRef(null),f=n(n(n(n(n({position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",width:"".concat(l.size,"px")},c?((o={})[c]=0,o):{}),"top"===c&&{transform:"rotate(-90deg) translateX(-100%)",transformOrigin:"left top"}),"bottom"===c&&{transform:"rotate(90deg) translateX(-100%)",transformOrigin:"left bottom"}),"left"===c&&{transform:"scaleX(-1)"}),["top","bottom"].includes(c)?{height:"".concat(u,"px")}:{height:"100%",top:0});return r.useEffect((function(){var e=s.current;if(e){var r=function(){return a(c)};return e.addEventListener("click",r),function(){e.removeEventListener("click",r)}}}),[a,c]),e.jsx("div",{className:"ms-arrow-box ".concat(c).concat(i?" active":""),ref:s,style:f,children:l.element})};M.displayName="Arrow";var S,E=r.memo(M),j=function(e){var r=e.getAttribute("data-direction");e.style.opacity="0",e.classList.remove("hover"),e.classList.add("leave"),d("remove".concat(r)),h((function(){return e.classList.remove("leave")}),200,"remove".concat(r))},L=function(e){var r=e.getAttribute("data-direction");d("remove".concat(r)),e.style.opacity="1",e.classList.remove("leave"),e.classList.add("hover")},k=function(){var e=null,r=0,t=new Map,n=function(){t.forEach((function(e,r){e()||t.delete(r)})),e=0!==t.size?requestAnimationFrame(n):null};return{start:function(o,i){var l=null!=i?i:++r;return t.delete(l),t.set(l,o),null===e&&(e=requestAnimationFrame(n)),l},stop:function(r){void 0!==r?(t.delete(r),0===t.size&&null!==e&&(cancelAnimationFrame(e),e=null)):(t.clear(),null!==e&&(cancelAnimationFrame(e),e=null))},isRunning:function(e){return void 0===e?t.size>0:t.has(e)}}}(),A=function(e,r,t){var n=e.current[r],o=performance.now();k.start((function(){var i=performance.now(),l=Math.min((i-o)/140,1);return 1>l?(e.current[r]=n*(1-l),t(),!0):(e.current[r]=0,t(),!1)}))},R={x:0,y:0},z={x:0,y:0},T={x:0,y:0,t:0,distX:0,distY:0},C=null,F=function(e,r,t,n){if(e){var o=null;["thumb","slider"].includes(e)?o="slider"===e?null==r?void 0:r.closest(".ms-slider"):r:"wrapp"===e&&(o=t),function(e,r){if(e){var t,n=window.matchMedia("(pointer: coarse)").matches;"start"===r?(n||(t=document.getElementById("ms-cursor-lock"))||((t=document.createElement("style")).id="ms-cursor-lock",t.textContent="\n * {\n cursor: grabbing !important;\n user-select: none;\n }\n ",document.head.appendChild(t)),e.style.cursor="grabbing",e.classList.add("active")):(n||(t=document.getElementById("ms-cursor-lock"))&&t.remove(),e.style.cursor="grab",e.classList.remove("active"))}}(o,n)}},O=function(e,r,t,n){"x"===e?(t.scrollStateRef.targetScrollX=n,r.scrollLeft!==n&&(r.scrollLeft=n)):(t.scrollStateRef.targetScrollY=n,r.scrollTop!==n&&(r.scrollTop=n))},I=function(e,r,t,n){var o,i,l=n.scrollElement;if(l){var c="x"===e,a={x:n.event.clientX,y:n.event.clientY};if(a){var u=function(e,r,t){if(0===e)return 0;var o="x"===r?n.sizeLocal[0]:n.sizeLocal[1],i=.14*Math.max(600,o),l=Math.abs(e);return p(e*i/(i+(t?-l:l)),-150,150)};if(C){var s=C,f={x:a.x-s.x.value,y:a.y-s.y.value},d=Math.abs(R[e]);if(d>2?n.isDraggingRef.current=!0:3>d&&(R[e]+=f[e]),n.isTouched){var v=performance.now();if(T.t){var h=Math.max(v-T.t,8);T={x:.8*T.x+f.x/h*.2,y:.8*T.y+f.y/h*.2,t:v,distX:(null!==(o=T.distX)&&void 0!==o?o:0)+Math.abs(f.x),distY:(null!==(i=T.distY)&&void 0!==i?i:0)+Math.abs(f.y)}}else T.t=v}var m="wrapp"===n.clickedObject.current?-f[e]:f[e],y=c?"scrollLeft":"scrollTop",g=c?0:1,b=function(r,t,o){var i=C[e],a=c?n.maxScrollSize[0]:n.maxScrollSize[1];if(Number.isFinite(r)&&Number.isFinite(t)){if(0!==i.raw){var s=i.raw;return i.raw+=.6*t,o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()),Math.sign(i.raw)!==Math.sign(s)?(i.raw=0,void(o&&(n.overscrollRef.current[e]=0,n.triggerUpdate()))):void 0}if(a>0){var f=l[y];if(0>=f&&0>r||f>=a&&r>0)return i.raw+=t,void(o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()));var d=p(l[y]+r,0,a);O(e,l,n,d)}else O(e,l,n,0)}else C=null};if("thumb"===n.clickedObject.current&&"slider"!==n.type){var x=m*r+s[e].rest,w=Math.trunc(x);return s[e].rest=x-w,void b(w,m,!1)}if("slider"===n.type&&(z[e]+=m),"wrapp"!==n.clickedObject.current){var M=l[y];if(!n.sliderElSize||Math.abs(z[e])>=n.sliderElSize[c?0:1]){var S=function(e){var r=l[c?"clientWidth":"clientHeight"]+n.gap[g];return r*(Math.floor(Math.max(0,M)/r)+e)},E=m>0&&M+n.sizeLocal[g]<n.wrapElWH[g]?S(1):0>m&&M>0?S(-1):null;z[e]=0,n.smoothScroll(E,e,10)}}else b(m/t[g],f[e],!0)}else C={x:{value:a.x,rest:0,raw:u(n.overscrollRef.current.x,"x",!0)},y:{value:a.y,rest:0,raw:u(n.overscrollRef.current.y,"y",!0)}}}}};function N(e){k.stop(),["x","y"].forEach((function(r){e.rafScrollAnim.cancel(),d("smoothScrollBlock".concat(r))}));var r=e.scrollElement;if(r){e.scrollStateRef.targetScrollX=r.scrollLeft,e.scrollStateRef.targetScrollY=r.scrollTop,T={x:0,y:0,t:0,distX:0,distY:0};var t=[r.scrollWidth,r.scrollHeight],o=["scroll","slider"].includes(e.type)?function(e){var r=e.getBoundingClientRect();return[r.width/e.clientWidth,r.height/e.clientHeight]}(r):[],i=1;if("thumb"===e.clickedObject.current&&e.axisFromAtr){var c="x"===e.axisFromAtr?0:1,a=(e.sizeLocal[c]-e.scrollBarEdge[c]-e.thumbSize)*o[c];i=e.maxScrollSize[c]/a,Number.isFinite(i)&&i>0||(i=1)}F(e.clickedObject.current,e.target,r,"start"),null==S||S.abort();var u=new AbortController;S=u;var s=u.signal;document.addEventListener("pointermove",(function(r){!function(r){var l,c;if("thumb"===e.clickedObject.current&&"slider"===e.type){var a=null===(l=e.target)||void 0===l?void 0:l.closest(".ms-slider");if(!a)return;var u=function(r){var t=a.getBoundingClientRect();return Math.round(("x"===r?t.width:t.height)/e.objLengthPerSize["x"===r?0:1])};c=[u("x"),u("y")]}!function(e){var r=e.direction||"y";"hybrid"===r?["wrapp","slider"].includes(e.clickedObject.current)?["x","y"].forEach((function(r){return I(r,e.thumbRatio,e.visualDiff,e)})):e.axisFromAtr&&I(e.axisFromAtr,e.thumbRatio,e.visualDiff,e):I(e.axisFromAtr?e.axisFromAtr:r,e.thumbRatio,e.visualDiff,e);var t={x:e.event.clientX,y:e.event.clientY};C&&(C.x.value=t.x,C.y.value=t.y)}(n(n({},e),{event:r,wrapElWH:t,visualDiff:o,thumbRatio:i,sliderElSize:c}))}(r)}),{signal:s});var f=function(r){e.isDraggingRef.current=!1,function(e){null==S||S.abort();var r=e.scrollElement;if(r){if(F(e.clickedObject.current,e.target,r,"end"),"slider"===e.type&&"thumb"!==e.clickedObject.current){var t=z,n=function(t,n){var o="x"===t,i=o?e.maxScrollSize[0]:e.maxScrollSize[1],l=r[o?"scrollLeft":"scrollTop"],c=o?e.gap[0]:e.gap[1],a=r[o?"clientWidth":"clientHeight"]+c,u=(Math[n?n>0?"floor":"ceil":"round"](l/a)+(null!=n?n:0))*a;u>i||0>u||e.smoothScroll(u,t,e.duration)},o=function(e,r){Math.abs(r)>20?n(e,r>0?1:-1):n(e)};0===t.x&&0===t.y?"hybrid"===e.direction?["x","y"].forEach((function(e){return o(e,t[e])})):o(e.direction,t[e.direction]):Object.entries(t).forEach((function(e){var r=l(e,2),t=r[0],n=r[1];0!==n&&o(t,n)}))}if(e.isTouched&&"scroll"===e.type&&"slider"!==e.clickedObject.current){var i=function(t){var n=T[t]*e.thumbRatio,o="x"===t?T.distX:T.distY;80>performance.now()-T.t&&Math.abs(n)>.05&&o>12&&function(e){var r=e.el,t=e.axis,n=e.velocity,o=e.rafSchedule,i=Math.sign(n),l=Math.abs(n);.2>(l=Math.pow(l,.92))&&(l=.2),n=l*i;var c="y"===t?"scrollTop":"scrollLeft",a="y"===t?r.scrollHeight-r.clientHeight:r.scrollWidth-r.clientWidth,u=performance.now(),s=function(){var e=performance.now(),t=e-u;if(u=e,Math.abs(n*=Math.exp(-.0025*t))>=.02){var i=r[c]+n*t;(0>i||i>a)&&(n*=.4,i=p(i,0,a)),r[c]=i,o("step",s)}};o("step",s)}({el:r,axis:t,velocity:"thumb"===e.clickedObject.current?n:-n,rafSchedule:e.rafScrollAnim.schedule})};"hybrid"===e.direction?"wrapp"===e.clickedObject.current?["x","y"].forEach((function(e){return i(e)})):i(e.axisFromAtr):i(e.axisFromAtr?e.axisFromAtr:e.direction)}C=null,0!==e.overscrollRef.current.x&&A(e.overscrollRef,"x",e.triggerUpdate),0!==e.overscrollRef.current.y&&A(e.overscrollRef,"y",e.triggerUpdate),e.clickedObject.current=null,T={x:0,y:0,t:0,distX:0,distY:0},R={x:0,y:0},z={x:0,y:0},e.triggerUpdate()}}(n(n({},e),{event:r,thumbRatio:i}))};document.addEventListener("pointerup",f,{signal:s}),document.addEventListener("pointercancel",f,{signal:s})}}function Y(e,r){return e>r?Math.floor(e/r):1}function H(e){return o(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?[3,2]:[4,new Promise((function(e){return requestAnimationFrame(e)}))];case 1:return r.sent(),[3,0];case 2:return[2]}}))}))}var W=new WeakMap,X=function(e){return e?"start"===e?"flex-start":"center"===e?"center":"flex-end":void 0};function B(e,r,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),function(o){var i,l,c,a,u=!1,s={width:(null!==(i=o.width)&&void 0!==i?i:0)-t,height:(null!==(l=o.height)&&void 0!==l?l:0)-n},f=0===s.width&&0===s.height;f&&!u&&(u=!0),(null===(c=e.current)||void 0===c?void 0:c.width)===s.width&&(null===(a=e.current)||void 0===a?void 0:a.height)===s.height||f&&u||(e.current=s,r())}}var P=function(){var e,r;return"undefined"!=typeof window&&null!==(r=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(pointer: coarse)").matches)&&void 0!==r&&r};function D(e,r,t){return r?p(Math.round(e/r*e),t,e):0}function q(e,r,t,n){return r?p(e/r*(t-n),0,t-n):0}function V(){var e=null,r=new Map;return{schedule:function(t,n){r.set(t,n),null===e&&(e=requestAnimationFrame((function(){e=null;var t=Array.from(r.values());r.clear(),t.forEach((function(e){return e()}))})))},cancel:function(){null!==e&&(cancelAnimationFrame(e),e=null,r.clear())}}}var U,K=function(e){if(null==e)return[];if(r.isValidElement(e)){var t=e;return t.type===r.Fragment?r.Children.toArray(t.props.children).flatMap(K):[t]}return[e]},_=function(e){var r=e.lastIndexOf(":$");return-1!==r?e.slice(r+2).replace(/=0/g,"=").replace(/=2/g,":"):e.startsWith(".$")?e.slice(2).replace(/=0/g,"=").replace(/=2/g,":"):e},G=40,$="ms-under-drag",Z=null,J=!1,Q={x:0,y:0},ee={x:0,y:0},re=!1,te=null,ne="",oe=null,ie=null,le=null,ce=V(),ae=function(){ie&&ie.removeAttribute($),te=null,ie=null,oe=null,ne="",le=null};function ue(e,r,t,n,o,i){var l=e-r,c=t-e;return G>l&&n>0?{dir:-1,distance:l}:G>c&&i>n+o?{dir:1,distance:c}:null}function se(e){var r=p((G-Math.abs(e))/G,0,1,!1);return r*r*20|0}function fe(){if(te){var e=te.parent,r=te.element,t=te.direction,n=r.getBoundingClientRect(),o=ee.x,i=ee.y;if(o<n.left-G||o>n.right+G||i<n.top-G||i>n.bottom+G)ae();else{var l=null,c=null,a=0,u=0,s="x"!==t?ue(i,n.top,n.bottom,r.scrollTop,r.clientHeight,r.scrollHeight):null;s&&(l=-1===s.dir?"top":"bottom",u=se(s.distance)*s.dir);var f="y"!==t?ue(o,n.left,n.right,r.scrollLeft,r.clientWidth,r.scrollWidth):null;f&&(c=-1===f.dir?"left":"right",a=se(f.distance)*f.dir),(ne=[l,c].filter(Boolean).join(" "))!==le&&(e.setAttribute($,ne),le=ne),(a||u)&&r.scrollBy(a,u),ce.schedule("autoScrollLoop",fe)}}}function de(e){e instanceof DragEvent&&0===e.buttons?ve():ee.x===e.clientX&&ee.y===e.clientY||(ee.x=e.clientX,ee.y=e.clientY,ce.schedule("onMove",(function(){if(!re){var e=ee.x-Q.x,r=ee.y-Q.y;if(10>Math.hypot(e,r))return;re=!0}var t=document.elementFromPoint(ee.x,ee.y);if(t){var n=t.closest("[morph-scroll]");if(n||te){var o=n?me.get(n):te;o&&(te=o,oe!==o.element&&(ie&&ie!==o.parent&&ie.removeAttribute($),oe=o.element,(ie=o.parent).setAttribute($,ne),le=ne,fe()))}else ae()}})))}function ve(){null==Z||Z.abort(),Z=null,re=!1,ce.cancel(),ae()}function he(e){var r=e instanceof PointerEvent;if(!r||e.target.closest("[ms-custom-drag]")){Q.x=e.clientX,Q.y=e.clientY,null==Z||Z.abort();var t=new AbortController;Z=t;var n=t.signal;r?(document.addEventListener("pointermove",de,{signal:n}),document.addEventListener("pointerup",ve,{signal:n})):(document.addEventListener("dragover",de,{signal:n}),document.addEventListener("dragend",ve,{signal:n}),document.addEventListener("drop",ve,{signal:n}),document.addEventListener("pointerdown",ve,{signal:n}),window.addEventListener("blur",ve,{signal:n}))}}var me=new Map;var pe=function(t){var u,f,x,M,S,k,A,R,z=t.className,T=t.children,C=t.type,F=void 0===C?"scroll":C,O=t.direction,I=void 0===O?"y":O,G=t.scrollPosition,$=t.onScrollValue,Q=t.isScrolling,ee=t.onRenderedKeysChange,re=t.size,te=t.objectsSize,ne=t.crossCount,oe=t.gap,ie=t.wrapperMargin,le=t.wrapperMinSize,ce=t.wrapperAlign,ae=t.elementsAlign,ue=t.elementsDirection,se=void 0===ue?"row":ue,fe=t.edgeGradient,de=t.progressTrigger,ve=void 0===de?{wheel:!0}:de,pe=t.progressReverse,ye=void 0!==pe&&pe,ge=t.scrollBarOnHover,be=void 0!==ge&&ge,xe=t.scrollBarEdge,we=t.thumbMinSize,Me=t.render,Se=t.emptyElements,Ee=t.suspending,je=void 0!==Ee&&Ee,Le=t.fallback,ke=t.dragScroll,Ae=(A=l(r.useState({}),2)[1],r.useCallback((function(){A({})}),[])),Re=(null===(R=r.useRef(null)).current&&(R.current="".concat(m++)),R.current),ze=V(),Te=function(){return ze.schedule("triggerUpdate",Ae)},Ce=V();if(!re)throw Error('prop "size" is not provided'.concat("\n morph-scroll ".concat(Re)));Object.keys(ve).length,"none"===te||Array.isArray(te)&&("none"===te[0]||te[1]);var Fe=r.useRef(null),Oe=r.useRef(null),Ie=r.useRef(null),Ne=r.useRef(null),Ye=r.useRef(new Set),He=r.useRef(P()),We=r.useRef(!0),Xe=r.useRef(null),Be=r.useRef({loaded:new Set,empty:new Set}),Pe=r.useRef({targetScrollY:0,targetScrollX:0,animating:!1,animationFrameId:0}),De=r.useRef(!1),qe=r.useRef(!1),Ve=r.useRef(function(e){void 0===e&&(e=2);var r=0,t=0,n=null,o=null;return{update:function(i,l){var c=i-r,a=l-t;Math.abs(c)>e&&(n=c>0?"right":"left",r=i),Math.abs(a)>e&&(o=a>0?"down":"up",t=l)},reset:function(){n=null,o=null},get:function(){return{x:n,y:o}}}}()),Ue=r.useRef({x:null,y:null}),Ke=r.useRef({x:0,y:0}),_e=r.useRef(!1),Ge=r.useRef(null),$e=r.useRef(ee);function Ze(){return r.useRef({width:0,height:0})}var Je=Ze(),Qe=Ze(),er=Ze(),rr=l(function(){for(var e=[],t=0;arguments.length>t;t++)e[t]=arguments[t];var n=new WeakMap,o=function(e){if(null===e)return 1;if("boolean"==typeof e)return e?2:3;if("number"==typeof e||"bigint"==typeof e)return 0|+e;if("string"==typeof e){for(var t=0,i=0;i<e.length;i++)t=31*t+e.charCodeAt(i)>>>0;return t}if(void 0===e)return 4;if("function"==typeof e)return 5;if(r.isValidElement(e))return 6;if(Array.isArray(e)){for(t=0,i=0;i<e.length;i++)t=31*t+o(e[i])>>>0;return t}if(e instanceof Set)return Array.from(e).map(o).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if(e instanceof Map)return Array.from(e.entries()).map((function(e){var r=l(e,2),t=r[0],n=r[1];return 31*o(t)+o(n)>>>0})).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if("object"==typeof e&&null!==e){if(n.has(e))return n.get(e);var c=Object.entries(e).sort((function(e,r){var t=l(e,1)[0],n=l(r,1)[0];return t.localeCompare(n)})).map((function(e){var r=l(e,2)[1];return o(r)})).reduce((function(e,r){return 31*e+r>>>0}),0);return n.set(e,c),c}return 7};return e.map(o)}(G,Me,re,te,Se,le,ce,oe,ve,Be.current.empty,xe),11),tr=rr[0],nr=rr[1],or=rr[2],ir=rr[3],lr=rr[4],cr=rr[5],ar=rr[6],ur=rr[7],sr=rr[8],fr=rr[9],dr=rr[10],vr=r.useMemo((function(){var e,r,t=[null],n=200,o=null;if(null!=G)if("number"==typeof G||"end"===G)t=[G,G];else if(Array.isArray(G))t=G;else if("object"==typeof G){var i=G.value;"number"==typeof i||"end"===i?t=[i,i]:Array.isArray(i)&&(t=i),n=null!==(e=G.duration)&&void 0!==e?e:200,o=null!==(r=G.updater)&&void 0!==r?r:null}return{value:t,duration:n,updater:o}}),[tr]),hr={color:null,size:40},mr=r.useMemo((function(){return"object"==typeof fe?n(n({},hr),fe):"string"==typeof fe?{color:fe,size:40}:hr}),[fe]),pr=r.useMemo((function(){var e=ve.arrows,t={size:40,contentReduce:!0,loop:!1};return r.isValidElement(e)?n(n({},t),{element:e}):"object"==typeof e&&null!==e?n(n({},t),e):t}),[sr]),yr=r.useMemo((function(){return r.Children.toArray(T).flatMap(K)}),[T]),gr=r.useMemo((function(){return yr.map((function(e){return r.isValidElement(e)&&e.key?e.key+"":null})).filter((function(e){return null!==e})).filter((function(e){var r;return!("clear"===Se||Se&&"object"==typeof Se&&"mode"in Se&&"clear"===Se.mode)||!(null===(r=Be.current.empty)||void 0===r?void 0:r.has(e))}))}),[T,lr,fr]),br=l(ie?a(ie):[0,0,0,0],4),xr=br[0],wr=br[1],Mr=br[2],Sr=br[3],Er=xr+Mr,jr=Sr+wr,Lr=r.useMemo((function(){var e,r;return"number"==typeof oe?[oe,oe]:Array.isArray(oe)?[null!==(e=oe[1])&&void 0!==e?e:0,null!==(r=oe[0])&&void 0!==r?r:0]:[0,0]}),[oe]),kr=r.useMemo((function(){var e={type:void 0,rootMargin:0,stopLoadOnScroll:!1,trackVisibility:!1};if("string"==typeof Me)return n(n({},e),{type:Me});if("object"==typeof Me&&null!==Me){var r=Me.type,t=Me.rootMargin,o=void 0===t?e.rootMargin:t,i=Me.stopLoadOnScroll,l=void 0===i?e.stopLoadOnScroll:i,c=Me.trackVisibility;return{type:r,rootMargin:o,stopLoadOnScroll:l,trackVisibility:void 0===c?e.trackVisibility:c}}return e}),[nr]),Ar=r.useMemo((function(){return a(kr.rootMargin)}),[kr.rootMargin,I]),Rr=r.useMemo((function(){var e=l(Array.isArray(re)?re:"number"==typeof re?[re,re]:[Je.current.width,Je.current.height],2),r=e[0],t=e[1];if(!ve.arrows||!pr.size||!pr.contentReduce)return[r,t,r,t];var n=2*pr.size,o=r,i=t;return"x"===I?o=r-n:"y"===I?i=t-n:"hybrid"===I&&(o=r-n,i=t-n),[o,i,r,t]}),[or,sr,I,pr,Je.current.height,Je.current.width]),zr="x"===I?Rr[0]:Rr[1],Tr=r.useMemo((function(){if(!xe)return[0,0];if("number"==typeof xe){var e=2*xe;return[e,e]}if(Array.isArray(xe)){var r=l(xe,2),t=r[0],n=void 0===t?0:t,o=r[1];return[2*n,2*(null!=o?o:n)]}return[0,0]}),[dr]),Cr=r.useMemo((function(){return[Rr[0]-Tr[0],Rr[1]-Tr[1]]}),[Tr.join(),Rr[0],Rr[1]]),Fr=r.useMemo((function(){return te?Array.isArray(te)?te:a(te,!0,2):[null,null]}),[ir]),Or=r.useMemo((function(){var e=er.current,r=e.height,t=e.width,n=function(e,r,t){return r||("number"==typeof e?e:"size"===e?t:0)};return[n(Fr[0],t,Rr[0]),n(Fr[1],r,Rr[1])]}),[Fr.join(),I,er.current.width,er.current.height,Rr.join()]),Ir=r.useMemo((function(){return Me&&Se&&!Le?e.jsx("div",{className:"ms-empty-element"}):Le}),[!!Le,nr,lr]),Nr=r.useMemo((function(){if("none"===Fr[0]||"none"===Fr[1])return[1,gr.length];var e="x"===I?1:0,r="row"===se,t=Rr[e],n=Or[e]?Or[e]+Lr[e]:0,o="hybrid"===I&&t?n*gr.length:t,i=n?Math.floor(o/n):1,l=ne&&i>=ne?"hybrid"===I?Math.ceil(i/ne):ne:i,c=l>1&&l<gr.length?Math.ceil(gr.length/l):l<gr.length?gr.length:1;r||(l=Math.ceil(gr.length/c));var a=ne&&ne<gr.length,u=function(e){return Number.isFinite(e)&&e>0?e:1};if("hybrid"===I){var s=a?r?ne:l:r?gr.length:1,f=a?r?l:ne:r?1:gr.length;return[u(s),u(f)]}return[u(l),u(c)]}),[se,Lr[0],Lr[1],Or[0],Or[1],gr.length,I,Rr.join(),ne]),Yr=r.useMemo((function(){var e=1>Nr[0]?1:Nr[0]*Lr[1]-Lr[1],r=Nr["x"===I?1:0],t=gr.length<r?gr.length:r;return Or[0]?(Or[0]+Lr[1])*t-Lr[1]:kr.type?er.current.width+e:Qe.current.width}),[I,Or[0],Nr[0],Nr[1],Lr[1],Qe.current.width,er.current.width,kr.type,gr.length]),Hr=r.useMemo((function(){var e=1>Nr[1]?1:Nr[0]*Lr[0]-Lr[0];return Or[1]?"x"===I?(Or[1]+Lr[0])*Nr[0]-Lr[0]:(Or[1]+Lr[0])*Nr[1]-Lr[0]:kr.type?er.current.height+e:Qe.current.height}),[I,Or[1],Nr[0],Nr[1],Lr[0],Qe.current.height,er.current.height,kr.type]),Wr=r.useMemo((function(){return Hr+Er}),[Hr,Er]),Xr=r.useMemo((function(){return Yr+jr}),[Yr,jr]),Br="x"===I?Xr:Wr,Pr=r.useMemo((function(){return[Math.max(0,Xr-Rr[0]),Math.max(0,Wr-Rr[1])]}),[Rr.join(),Wr,Xr]),Dr="x"===I?(null===(u=Ie.current)||void 0===u?void 0:u.scrollLeft)||0:(null===(f=Ie.current)||void 0===f?void 0:f.scrollTop)||0,qr=Dr>1&&!0,Vr=Br>Math.round(Dr+zr),Ur=!1,Kr=!1;"hybrid"===I&&(Ur=((null===(x=Ie.current)||void 0===x?void 0:x.scrollLeft)||0)>1&&!0,Kr=Math.round(((null===(M=Ie.current)||void 0===M?void 0:M.scrollLeft)||0)+Rr[0])<Xr);var _r=r.useMemo((function(){return null!=we?we:30}),[we]),Gr=r.useCallback((function(e){return ve.progressElement&&Br?"x"===e?D(Rr[0]-Tr[0],Xr,_r):D(Rr[1]-Tr[1],Wr,_r):0}),[sr,Br,Rr[0],Rr[1],Xr,_r,Tr.join()]),$r=r.useMemo((function(){return{x:"y"!==I?Gr("x"):0,y:"x"!==I?Gr("y"):0}}),[Gr,I]),Zr=r.useMemo((function(){return{w:Rr[0]?Xr-Rr[0]:Xr,h:Rr[1]?Wr-Rr[1]:Wr}}),[Xr,Wr,Rr[0],Rr[1]]),Jr={x:"y"!==I?q((null===(S=Ie.current)||void 0===S?void 0:S.scrollLeft)||0,Zr.w,Cr[0],$r.x):0,y:"x"!==I?q((null===(k=Ie.current)||void 0===k?void 0:k.scrollTop)||0,Zr.h,Cr[1],$r.y):0},Qr=r.useMemo((function(){if(!kr.type)return[{top:0,bottom:0,left:0,right:0}];for(var e=0,r="x"===I,t="row"===se,n=r&&!t||!r&&t,o=Or[0]+Lr[1],i=Or[1]+Lr[0],l=new Set,c=n?Nr[0]:Nr[1],a=Or[t?0:1],u=Lr[t?1:0],s=Math.floor((gr.length-1)/c)*c;s<gr.length;s++)l.add(s);var f=c-l.size,d=f>0?(a+u)*f:0;return"center"===ae?e=Math.round(d/2):"end"===ae&&(e=d),gr.map((function(r,c){var a,u,s=n?c%Nr[0]:Math.floor(c/Nr[1]),f=n?Math.floor(c/Nr[0]):c%Nr[1];"x"===I?(a=f,u=s):(a=s,u=f);var d=l.size>0&&l.has(c),v=(d&&!t?e:0)+i*u,h=(d&&t?e:0)+o*a;return{top:v,left:h,bottom:v+Or[1],right:h+Or[0]}}))}),[Or[0],Or[1],Lr[0],Lr[1],ae,gr.length,Nr[0],Nr[1],kr.type,se,I]),et=r.useMemo((function(){return(null==Rr?void 0:Rr.length)&&ce?function(e,r,t,n){var o=l("string"==typeof e?[e,e]:e,2),i=o[0],c=o[1],a=void 0===c?"start":c,u={display:"flex"};return r[0]>t&&(u.justifyContent=X(i)),r[1]>n&&(u.alignItems=X(a)),u}(ce,Rr,Xr,Wr):{}}),[ce,Rr.join(),Wr,Xr]),rt=r.useMemo((function(){return[Y(Xr,Rr[0]),Y(Wr,Rr[1])]}),[Xr,Wr,Rr.join()]),tt=r.useMemo((function(){return"x"===I?rt[0]:rt[1]}),[I,rt[0],rt[1]]),nt=r.useCallback(B(Je,Te),[]),ot=r.useCallback(B(Qe,Te,jr,Er),[jr,Er]),it=r.useCallback(B(er,Te),[]),lt=r.useCallback((function(e,r,t){var n=Ie.current;return n&&null!==e?function(e,r,t,n,l,c){return o(this,void 0,void 0,(function(){var o,a,u,s,f;return i(this,(function(i){switch(i.label){case 0:return a=(o="y"===e)?"scrollTop":"scrollLeft",u=o?c[1]:c[0],s=p(n,0,u),(f=p(r[a],0,u))===s?[2]:null!==t?[3,2]:[4,H(r)];case 1:return i.sent(),r[a]=n,[2];case 2:return v((function(){var e=performance.now(),n=function(){var o=performance.now(),i=Math.min((o-e)/t,1),c=p(f+(s-f)*i,0,u);r[a]=c,1>i&&c!==s&&l("smoothScroll",n)};l("smoothScroll",n)}),t,"smoothScrollBlock".concat(e)),[2]}}))}))}(r,n,We.current?null:t,e,Ce.schedule,Pr):null}),[Pr.join()]),ct=r.useMemo((function(){var e=n(n(n({margin:ie?"".concat(xr,"px ").concat(wr,"px ").concat(Mr,"px ").concat(Sr,"px"):"",height:Fr[1]&&"none"!==Fr[1]?"".concat(Hr,"px"):"fit-content",width:Fr[0]&&"none"!==Fr[0]?"".concat(Yr,"px"):"fit-content"},oe&&!kr.type&&{gap:"".concat(Lr[0],"px ").concat(Lr[1],"px")}),le&&function(e,r,t,n,o){var i,c,a,u=function(e,r){return"full"===e?("x"===r?t[0]:t[1])-("x"===r?n:o):e};if("hybrid"!==r&&!Array.isArray(e)){var s="".concat(u(e,r),"px");return"x"===r?{minWidth:s}:{minHeight:s}}return Array.isArray(e)?(c=(i=l(e,2))[0],a=i[1]):c=a=e,{minWidth:"".concat(u(c,"x"),"px"),minHeight:"".concat(u(a,"y"),"px")}}(le,I,Rr,jr,Er)),("hybrid"===I||"x"===I)&&{flexShrink:0});if(kr.type)return n(n({},e),{position:"relative"});var r=1===Nr[0]?"y"===I?"column":"row":se,t=Fr[0]&&"none"!==Fr[0]&&Fr[1]&&"none"!==Fr[1]?"wrap":void 0;return n(n({},e),{display:"flex",flexDirection:r,flexWrap:t,justifyContent:X(ae)})}),[ie,ar,cr,[xr,wr,Mr,Sr,jr,Er,Lr[0],Lr[1]].join(),Rr.join(),ur,Fr[1],Hr,Yr,ur,kr.type,I,Nr[0],se,ae]),at=r.useCallback((function(e,r,t){var n;He.current=P();var o=r.target;if(!o.closest('\n [ms-custom-drag], [draggable="true"], [contenteditable],\n input, textarea, select, button, a\n ')){var i=null;t&&(i=null===(n=o.closest("scroll"===F?".ms-bar":".ms-slider"))||void 0===n?void 0:n.getAttribute("data-direction")),Xe.current=e,N({scrollElement:Ie.current,target:o,clickedObject:Xe,scrollStateRef:Pe.current,type:F,triggerUpdate:Te,direction:I,smoothScroll:lt,sizeLocal:[Rr[0],Rr[1]],thumbSize:"x"===i?$r.x:$r.y,axisFromAtr:i,duration:vr.duration,scrollBarEdge:Tr,rafScrollAnim:Ce,isTouched:He.current,gap:Lr,overscrollRef:Ke,objLengthPerSize:rt,isDraggingRef:_e,maxScrollSize:Pr})}}),[I,F,Rr.join(),vr.duration,lt,Tr.join(),$r.x,$r.y,Lr.join(),rt,Pr.join()]),ut=r.useCallback((function(e){at("thumb",e,!0)}),[at]),st=r.useCallback((function(e){Ie.current&&function(e){var r=e.arrowType,t=e.scrollElement,n=e.wrapSize,o=e.scrollSize,i=e.smoothScroll,l=e.duration,c=e.loop,a=e.gap,u=n[0],s=n[1],f=t.scrollTop,d=t.scrollLeft,v=function(e,r,n){var o=n?function(e,r){return"x"===e?r>0?0:u:r>0?0:s}(e,r):function(e,r){var n="x"===e,o=n?d:f,i=n?a[0]:a[1],l=t[n?"clientWidth":"clientHeight"]+i;return l*(Math.floor(Math.max(0,o)/l)+r)}(e,r);i(o,e,l)};switch(r){case"top":f>0?v("y",-1):c&&v("y",-1,!0);break;case"left":d>0?v("x",-1):c&&v("x",-1,!0);break;case"right":d+o[0]<u?v("x",1):c&&v("x",1,!0);break;case"bottom":f+o[1]<s?v("y",1):c&&v("y",1,!0)}}({arrowType:e,scrollElement:Ie.current,wrapSize:[Xr,Wr],scrollSize:Rr,smoothScroll:lt,duration:vr.duration,loop:pr.loop,gap:Lr})}),[Rr.join(),Xr,Wr,vr.duration,lt,pr.loop,Lr[0],Lr[1]]),ft=r.useCallback((function(){"scroll"!==F&&Rr[0]&&Rr[1]&&Oe.current&&Ie.current&&Ye.current.size&&function(e,r,t,n){c([],l(r),!1).forEach((function(r,o){var i,l,c=W.get(r),a=0===o?t:"x",u="x"===a?0:1;if(c&&c.elements.length===n[u]||(c={elements:Array.from(r.querySelectorAll(".ms-slider-element")),lastIndex:-1},W.set(r,c)),c.elements.length){var s="x"===a?e.scrollLeft:e.scrollTop,f="x"===a?e.clientWidth:e.clientHeight,d=Math.floor((s+f/2)/f);d!==c.lastIndex&&(-1!==c.lastIndex&&(null===(i=c.elements[c.lastIndex])||void 0===i||i.classList.remove("active")),null===(l=c.elements[d])||void 0===l||l.classList.add("active"),c.lastIndex=d)}}))}(Ie.current,Ye.current,I,rt)}),[Rr.join(),I,F,rt.join()]),dt=r.useCallback((function(e){if(e){var r=(o=Ne.current)?Array.from(o.children).flatMap((function(e){if(!(e instanceof HTMLElement))return[];var r=e.getAttribute(y);return r?[_(r)]:[]})):[];Ge.current&&(t=Ge.current,n=r,t.length===n.length&&t.every((function(e,r){return e===n[r]})))||(Ge.current=r,e(r))}var t,n,o}),[]),vt=r.useCallback((function(){Ne.current&&function(e,r,t,n){for(var o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return e instanceof Element&&e.hasAttribute(y)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=o.nextNode();i;){var l=i,c=l.getAttribute(y);if(c){var a=0===l.children.length;a&&(r.current.empty||(r.current.empty=new Set),r.current.empty.add(c)),"virtual"===n&&a||r.current.loaded.add(c)}i=o.nextNode()}t()}(Ne.current,Be,Te,kr.type)}),[nr]),ht=r.useCallback((function(e){"object"==typeof Se&&"clickTrigger"in Se&&void 0!==Se.clickTrigger&&function(e,r,t){var n="string"==typeof r?{selector:r}:r,o=n.selector,i=n.delay,l=void 0===i?0:i,c=e.target;if(c.closest(o)){var a=c.closest("[wrap-id]");null==a||a.classList.add("remove"),h((function(){null==a||a.classList.remove("remove"),t()}),l)}}(e,Se.clickTrigger,vt)}),[lr,vt]),mt=r.useCallback((function(e){d("removeHover");var r=Oe.current,t=Fe.current,n=Ie.current;if(r&&t&&n){if(vr.value.includes("end")){var o=e.currentTarget,i=o.scrollLeft,l=o.scrollTop;Ve.current.update(i,l)}null==$||$(n.scrollLeft,n.scrollTop);var c=r.querySelectorAll("scroll"===F?".ms-bar":".ms-slider");be&&c.length>0&&!De.current&&c.forEach((function(e){e.classList.contains("hover")||L(e)})),De.current=!0,null==Q||Q(!0),h((function(){Ve.current.reset(),De.current=!1,null==Q||Q(!1),kr.type&&vt(),be&&c.length>0&&!Xe.current&&c.forEach((function(e){h((function(){e.hasAttribute("ms-manual-hover")||j(e)}),1e3,"removeHover")}))}),200,"isScrolling"),h((function(){return dt($e.current)}),"raf","onRenderedKeysChange"),ze.schedule("sliderCheckLocal",(function(){"scroll"!==F&&ft(),Ae()}))}}),[$,Q,F,ft,vt,be,kr.type]),pt=r.useCallback((function(e){if(!qe.current){var r="object"==typeof ve.wheel&&"string"==typeof ve.wheel.changeDirectionKey?ve.wheel.changeDirectionKey:"KeyX";e.code!==r||"hybrid"!==I||qe.current||(e.stopPropagation(),qe.current=!0,Te())}}),[I,sr]),yt=r.useCallback((function(e){qe.current&&(e.stopPropagation(),qe.current=!1,Te())}),[]);r.useEffect((function(){if(!ee)return $e.current=void 0,void(Ge.current=null);$e.current=ee,Ge.current=null,dt(ee)}),[ee,dt]),r.useEffect((function(){$e.current&&Rr[0]&&Rr[1]&&dt($e.current)}),[gr.join("|"),Rr.join()]),r.useEffect((function(){if(!He.current&&"hybrid"===I){var e=Ne.current,r=Ie.current;if(e&&r)return e.clientWidth+jr>r.clientWidth&&e.clientHeight+Er>r.clientHeight&&(r.addEventListener("keydown",pt),r.addEventListener("keyup",yt)),function(){r.removeEventListener("keydown",pt),r.removeEventListener("keyup",yt)}}}),[I,sr,or,ir,gr.join(),jr,Er]),r.useEffect((function(){Se&&kr.type&&vt()}),[lr,kr.type,vt,gr.length]),r.useEffect((function(){if(!He.current){var e=Ie.current,r=Ne.current;if(e&&r){var t="hybrid"===I&&"object"==typeof ve.wheel&&ve.wheel.changeDirection?"x":I,n="hybrid"===I&&Hr+Er<=Rr[1]||qe.current?["hybrid","y"].includes(t)?"x":"y":t,o=function(r){r.preventDefault(),g(r,e,Pr,Pe.current,n)};return ve.wheel&&e.addEventListener("wheel",o,{passive:!1}),function(){e.removeEventListener("wheel",o)}}}}),[I,sr,Hr,Rr[1],Er,qe.current,Pr.join()]),r.useEffect((function(){ze.schedule("smoothScrollLocal",(function(){("hybrid"===I?["x","y"]:[I]).forEach((function(e){var r=vr.value["x"===e?0:1];if("end"===r){if(Ve.current.get()[e]===("x"===e?"left":"up"))return;lt("x"===e?Zr.w:Zr.h,e,vr.duration)}else"number"==typeof r&&Ue.current[e]!==r&&(Ue.current[e]=r,lt(r,e,vr.duration))}))}))}),[I,tr,Zr.w,Zr.h,vr.value.join()]),r.useEffect((function(){var e=Pe.current.animationFrameId;return(kr.type||Q)&&Q&&Q(!1),requestAnimationFrame((function(){return We.current=!1})),function(){e&&cancelAnimationFrame(e),Pe.current.animationFrameId&&cancelAnimationFrame(Pe.current.animationFrameId),Ce.cancel()}}),[]),r.useEffect((function(){if(ke){var e=Fe.current,r=Ie.current;if(e&&r){var t={parent:e,element:r,direction:I};return function(e){me.set(e.parent,e),1===me.size&&function(){if(!J){var e=(U=new AbortController).signal;document.addEventListener("pointerdown",he,{signal:e}),document.addEventListener("dragstart",he,{signal:e}),J=!0}}()}(t),function(){!function(e){me.delete(e.parent),0===me.size&&J&&(null==U||U.abort(),null==Z||Z.abort(),J=!1)}(t)}}}}),[ke,I]),r.useEffect((function(){var e=Ie.current;if(e){var r=function(e){at("wrapp",e)};if(ve.content||!ve.content&&He.current&&ve.wheel){if(!0===ve.progressElement)return;e.addEventListener("pointerdown",r)}return function(){e.removeEventListener("pointerdown",r)}}}),[sr,at]),r.useEffect((function(){var e=Oe.current;if(e&&be&&Ye.current.size){var r=function(e){"mouseenter"===e.type&&document.removeEventListener("mouseup",r),"mouseleave"===e.type&&Xe.current?document.addEventListener("mouseup",r):Array.from(Ye.current).forEach((function(r){!function(e){var r=e.el,t=e.event,n=e.isScrolling,o=function(e){if(["mouseleave","mouseup","pointerup","pointercancel"].includes(t.type)){if(e.removeAttribute("ms-manual-hover"),null==n?void 0:n.current)return;j(e)}else e.setAttribute("ms-manual-hover",""),L(e)};Array.isArray(r)?r.map((function(e){return o(e)})):o(r)}({el:r,event:e,isScrolling:De})}))},t=function(r,t){He.current?(Array.from(Ye.current).forEach((function(e){return e[r]("pointerdown",t)})),document[r]("pointerup",t),document[r]("pointercancel",t)):(e[r]("mouseenter",t),e[r]("mouseleave",t))};return t("addEventListener",r),function(){t("removeEventListener",r)}}}),[be,F,I,Ye.current.size]),r.useEffect((function(){"scroll"!==F&&ze.schedule("sliderCheckLocal",ft)}),[F,ft,Rr.join()]);var gt,bt=r.useCallback((function(t,o,i,l,c){var a,u=n(n({width:Or[0]?"".concat(Or[0],"px"):void 0,height:Or[1]?"".concat(Or[1],"px"):void 0},kr.type&&{position:"absolute",transform:"translate(".concat(i,"px, ").concat(o,"px)")}),"number"==typeof c&&{"--content-visibility":c}),s=je?e.jsx(r.Suspense,{fallback:Ir,children:l}):l;return e.jsx("div",n({},kr.type||Se?((a={})[y]="".concat(t),a):{},{className:"ms-object-box",style:u,onClick:Se?ht:void 0,children:s}),t)}),[je,!!Ir,Or[0],Or[1],nr,lr,Nr[0],ht,kr.type]),xt=r.useMemo((function(){var e=new Map;return yr.forEach((function(t){r.isValidElement(t)&&null!=t.key&&e.set(t.key+"",t)})),e}),[yr]),wt=r.useMemo((function(){return c([{positionType:"x"===I?"left":"top",visibility:qr},{positionType:"x"===I?"right":"bottom",visibility:Vr}],l("hybrid"===I?[{positionType:"left",visibility:Ur},{positionType:"right",visibility:Kr}]:[]),!1)}),[qr,Vr,I,Ur,Kr]),Mt=r.useMemo((function(){return{width:"".concat(Rr[2],"px"),height:"".concat(Rr[3],"px")}}),[Rr]),St=r.useMemo((function(){var e;return null!==(e={x:Xr>Rr[0]?"scroll hidden":"hidden",y:Wr>Rr[1]?"hidden scroll":"hidden",hybrid:"".concat(Xr>Rr[0]?"scroll":"hidden"," ").concat(Wr>Rr[1]?"scroll":"hidden"),hide:"hidden"}[ve.wheel||ve.content&&"scroll"===F?I:"hide"])&&void 0!==e?e:"hidden"}),[Xr,Wr,Rr,sr,I]),Et=r.useMemo((function(){return fe?wt.map((function(r){var t=r.positionType,n=r.visibility;return e.jsx(w,{edgeGradient:mr,visibility:n,edgeType:t,size:Rr},"edge-".concat(t))})):null}),[fe,wt,mr,or]),jt=r.useMemo((function(){return ve.arrows?wt.map((function(r){var t=r.positionType,n=r.visibility;return e.jsx(E,{visibility:n,arrows:pr,arrowType:t,handleArrow:st,size:Rr[0]},"arrow-".concat(t))})):null}),[sr,wt,pr,st,Rr[0]]),Lt=function(){var t,o,i=(null===(t=Ie.current)||void 0===t?void 0:t.scrollLeft)||0,l=(null===(o=Ie.current)||void 0===o?void 0:o.scrollTop)||0;return e.jsx("div",{className:"ms-objects-wrapper",ref:Ne,style:n(n(n({},ct),(Ke.current.x||Ke.current.y)&&{transform:"translate(".concat(Ke.current.x,"px, ").concat(Ke.current.y,"px)")}),_e.current&&{pointerEvents:"none"}),children:gr.map((function(t,n){return function(t,n,o,i){var l,c=xt.get(t),a=kr.stopLoadOnScroll&&De.current&&!Be.current.loaded.has(t)?Ir:(null===(l=Be.current.empty)||void 0===l?void 0:l.has(t))?Se&&"object"==typeof Se&&r.isValidElement(Se)?Se:Se&&"object"==typeof Se&&"mode"in Se&&"object"==typeof Se.mode&&"fallback"in Se.mode?Se.mode.fallback:Ir:c,u="firstChild"!==Fr[0]&&"firstChild"!==Fr[1]||0!==n?a:e.jsx(s,{onResize:it,children:a});if(!kr.type)return bt(t,0,0,u);var f=Qr[n],d=f.top,v=f.bottom,h=f.left,m=f.right,p=function(e){void 0===e&&(e=!0);var r=e?Ar:[0,0,0,0],t=function(e){var t="x"===e?o:i,n=t+("x"===e?Rr[0]:Rr[1]),l="x"===e?h-r[3]:d-r[2],c="x"===e?m+r[1]:v+r[0],a=c-l;if(0>=a)return 0;var u=Math.min(c,n)-Math.max(l,t);return u>0?Math.round(10*Math.min(1,u/a))/10:0};if("hybrid"===I){var n=t("x"),l=t("y");return Math.min(n,l)}return t("x"===I?"x":"y")},y=p(),g=kr.trackVisibility?p(!1):null;if("lazy"===kr.type){var b=Be.current.loaded.has(t);if(y&&!b){if(De.current&&kr.stopLoadOnScroll)return;Be.current.loaded.add(t)}return b?bt(t,d,h,u,g):null}return y?bt(t,d,h,u,g):(Be.current.loaded.delete(t),null)}(t,n,i,l)}))})},kt=r.useMemo((function(){var e={position:"relative",width:"".concat(Rr[0],"px"),height:"".concat(Rr[1],"px")};return ve.arrows&&pr.contentReduce&&pr.size&&("x"===I?e.left="".concat(pr.size,"px"):"y"===I?e.top="".concat(pr.size,"px"):(e.top="".concat(pr.size,"px"),e.left="".concat(pr.size,"px"))),e}),[Rr,sr,pr,I]),At=e.jsxs("div",{"morph-scroll":"".concat(Re),className:z,ref:Fe,style:Mt,children:[e.jsxs("div",{className:"ms-content",ref:Oe,style:n(n(n({},kt),{transform:"translateZ(0)"}),He.current&&{touchAction:"pinch-zoom"}),children:[e.jsx("div",{className:"ms-element",ref:Ie,onScroll:mt,tabIndex:0,style:n(n(n({width:"100%",height:"100%",outline:"none"},et),"boolean"!=typeof ve.progressElement||!1===ve.progressElement?{scrollbarWidth:"none",overflow:"hidden"}:{overflow:St}),ve.content&&{cursor:"grab"}),children:Or[0]&&Or[1]?Lt():e.jsx(s,{onResize:ot,style:et,children:Lt()})}),Et,ve.progressElement&&!0!==ve.progressElement?(gt="x"!==I,[{shouldRender:Br>Rr[gt?1:0],direction:I,thumbSize:gt?$r.y:$r.x,thumbSpace:gt?Jr.y:Jr.x,objLengthPerSize:tt,progressReverseIndex:0},{shouldRender:"hybrid"===I&&Xr>Rr[0],direction:"x",thumbSize:$r.x,thumbSpace:Jr.x,objLengthPerSize:rt[0],progressReverseIndex:1}].filter((function(e){return e.shouldRender}))).map((function(r){var t="boolean"==typeof ye?ye:ye[r.progressReverseIndex];return e.jsx(b,{type:F,direction:r.direction,progressReverse:t,size:Cr,progressTrigger:[ve,sr],scrollBarOnHover:be,scrollBarEvent:"sliderMenu"===F?lt:ut,thumbSize:r.thumbSize,thumbSpace:r.thumbSpace,objLengthPerSize:r.objLengthPerSize,sliderCheckLocal:ft,duration:vr.duration,isTouched:He.current,scrollStateRef:Pe,scrollEl:Ie,scrollBarsRef:Ye,triggerUpdate:Te,overscroll:Ke,maxScrollSize:Pr},r.direction)})):null]}),jt]});return"auto"===re?e.jsx(s,{measure:"outer",onResize:nt,children:At}):At};pe.displayName="MorphScroll";var ye={MorphScroll:pe,ResizeTracker:s,IntersectionTracker:u};exports.IntersectionTracker=u,exports.MorphScroll=pe,exports.ResizeTracker=s,exports.default=ye;
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import t,{useRef as n,useState as o,useCallback as i}from"react";import{cancelTask as l,setTask as c,setLockTask as a}from"keytask-core";var u=function(){return u=Object.assign||function(e){for(var r,t=1,n=arguments.length;n>t;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},u.apply(this,arguments)};function s(e,r,t,n){return new(t||(t=Promise))((function(o,i){function l(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(l,c)}a((n=n.apply(e,r||[])).next())}))}function f(e,r){var t,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(e,i)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function d(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),l=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)l.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return l}function v(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;i>o;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var h=function(e,r,t){void 0===r&&(r=!1);var n=[];if(n=Array.isArray(e)?2===e.length?[e[1],e[0],e[1],e[0]]:v([],d(e),!1):[e,e,e,e],r&&(n=[n[1],n[0],n[3],n[2]]),t){for(var o=[],i=0;t>i;i++)o.push(n[i%4]);n=o}return n},m=function(r){var n=r.className,o=r.children,i=r.style,l=r.root,c=r.threshold,a=r.rootMargin,u=r.visibleContent,s=void 0!==u&&u,f=r.onIntersection,v=d(t.useState(!1),2),m=v[0],p=v[1],y=t.useRef(null),g=t.useMemo((function(){if(!a)return"";var e=h(a);return"".concat(e[0],"px ").concat(e[1],"px ").concat(e[2],"px ").concat(e[3],"px")}),[a]),b=t.useCallback((function(e){var r=d(e,1)[0];p(r.isIntersecting),f&&f({time:r.time,rootBounds:r.rootBounds,boundingClientRect:r.boundingClientRect,intersectionRect:r.intersectionRect,isIntersecting:r.isIntersecting,intersectionRatio:r.intersectionRatio,target:r.target})}),[f]);return t.useEffect((function(){var e=new IntersectionObserver(b,{root:l,threshold:c,rootMargin:g});return y.current&&e.observe(y.current),function(){e.disconnect()}}),[b,l,c,g]),e("div",{"intersection-tracker":"",className:n,ref:y,style:i,children:s||m?o:null})};m.displayName="IntersectionTracker";var p=function(r){var n=r.className,o=r.children,i=r.style,l=r.measure,c=void 0===l?"inner":l,a=r.onResize,s=t.useRef(null);t.useEffect((function(){var e=s.current;if(e){var r=new ResizeObserver((function(e){var r,t;try{for(var n=function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),o=n.next();!o.done;o=n.next()){var i=o.value;a&&a(i.contentRect)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(r)throw r.error}}}));return r.observe(e),function(){r.unobserve(e),r.disconnect()}}}),[c,a]);var f={width:"max-content",height:"max-content"},d={inner:u({},f),outer:u({},{width:"100%",height:"100%"}),all:u({minWidth:"100%",minHeight:"100%"},f)};return e("div",{"resize-tracker":"",className:n,ref:s,style:u(u({willChange:"width, height"},d[c]),i),children:o})};p.displayName="ResizeTracker";var y=1;function g(e,r,t,n){return void 0===r&&(r=0),void 0===t&&(t=1/0),void 0===n&&(n=!0),Math.max(r,Math.min(n?Math.round(e):e,t))}var b="wrap-id";function x(e,r,t,n,o){r.matches(":focus")||r.focus(),n.animating||(n.targetScrollX=g(r.scrollLeft,0,t[0]),n.targetScrollY=g(r.scrollTop,0,t[1])),"x"===o?n.targetScrollX=g(n.targetScrollX+e.deltaY,0,t[0]):n.targetScrollY=g(n.targetScrollY+e.deltaY,0,t[1]),n.animating||(n.animating=!0,n.animationFrameId=requestAnimationFrame((function e(){var i;if("x"===o){var l=g(r.scrollLeft+.4*(n.targetScrollX-r.scrollLeft),0,t[0]);r.scrollLeft=l,i=Math.abs(l-n.targetScrollX)}else{var c=g(r.scrollTop+.4*(n.targetScrollY-r.scrollTop),0,t[1]);r.scrollTop=c,i=Math.abs(c-n.targetScrollY)}i>2.5?n.animationFrameId=requestAnimationFrame(e):("x"===o?r.scrollLeft=g(n.targetScrollX,0,t[0]):r.scrollTop=g(n.targetScrollY,0,t[1]),n.animating=!1,n.animationFrameId=null)})))}var w=function(r){var n=r.type,o=r.direction,i=r.progressReverse,l=r.size,c=r.progressTrigger,a=r.scrollBarOnHover,s=r.scrollBarEvent,f=r.thumbSize,d=r.thumbSpace,v=r.objLengthPerSize,h=r.sliderCheckLocal,m=r.duration,p=r.isTouched,y=r.scrollStateRef,g=r.scrollEl,b=r.scrollBarsRef,w=r.triggerUpdate,S=r.overscroll,M=r.maxScrollSize,E=t.useRef(null),L=t.useRef(null),A=["hybrid","y"].includes(o)?"y":"x",R=Math.abs(S.current[A])*(f/200),k=f-R,z=0>S.current[A]?d+R:d,j=t.useMemo((function(){if("scroll"!==n){var r=l["x"===A?0:1];return Array.from({length:v},(function(t,o){return e("div",{className:"ms-slider-element",style:u({},"sliderMenu"===n&&{cursor:"pointer"}),onClick:"sliderMenu"===n?function(){s(r*o,A,m,h)}:void 0,children:Array.isArray(c[0].progressElement)?c[0].progressElement[o]:c[0].progressElement},o)}))}}),[v,n,c[1],m,h,l[0],l[1],s]),T=t.useMemo((function(){return"x"!==o?"y":"x"}),[o]),C=l["x"===T?0:1],F="scroll"!==n?"":f+2*d>C?"flex-end":"flex-start";t.useEffect((function(){if(!p&&c[0].wheel){var e=E.current,r=g.current;if(e&&r){for(var t=e.previousElementSibling;t&&!t.classList.contains("ms-element");)t=t.previousElementSibling;var n=function(e){return x(e,r,M,y.current,T)};return e.addEventListener("wheel",n,{passive:!1}),function(){return e.removeEventListener("wheel",n)}}}}),[T]),t.useEffect((function(){var e="slider"===n?E.current:L.current;if(e&&"sliderMenu"!==n){var r=function(e){return s(e)};return e.addEventListener("pointerdown",r),function(){return e.removeEventListener("pointerdown",r)}}}),[s,n]),t.useEffect((function(){var e=E.current;if(e)return b.current.add(e),w(),function(){b.current.delete(e)}}),[f]);var O=u({position:"absolute"},a&&{opacity:0,transition:"opacity 0.2s ease-in-out"});return e(t.Fragment,{children:"scroll"===n?e("div",{className:"ms-bar ms-".concat(T),ref:E,"data-direction":T,style:u(u(u({},O),{width:"fit-content",height:"".concat(C,"px")}),"x"===o?u({transformOrigin:"left top",left:"50%"},i?{top:0,transform:"rotate(-90deg) translate(-100%, -50%)"}:{transform:"rotate(-90deg) translateY(-50%)"}):u({top:"50%",transform:"translateY(-50%)"},i?{left:0}:{right:0})),children:e("div",{className:"ms-thumb",ref:L,style:u(u({height:"".concat(k,"px"),transform:"translateY(".concat(z,"px)")},c[0].progressElement&&{cursor:"grab"}),{display:"flex",alignItems:F}),children:c[0].progressElement})}):v>1&&c[0].progressElement&&e("div",{className:"ms-slider ms-".concat(T),ref:E,"data-direction":T,style:u(u(u(u({},O),{display:"flex"}),"slider"===n&&{cursor:"grab"}),"x"===o?u({transformOrigin:"left top",left:"50%",transform:"translateX(-50%)"},i?{top:0}:{bottom:0}):u({flexDirection:"column",top:"50%",transform:"translateY(-50%)"},i?{left:0}:{right:0})),children:j})})};w.displayName="ScrollBar";var S=function(r){var t,n=r.edgeGradient,o=r.visibility,i=r.edgeType;r.size;var l=u(u(u(((t={position:"absolute"})[i]=0,t.pointerEvents="none",t.transition="opacity 0.2s ease-in-out",t["--edge-visibility"]=o?1:0,t.opacity="var(--edge-visibility)",t),n.color&&{background:n.color&&"linear-gradient(".concat(["left","right"].includes(i)?"270deg, ":"").concat(n.color,", transparent)")}),["left","right"].includes(i)?{height:"100%",width:"".concat(n.size,"px"),top:0}:{width:"100%",height:"".concat(n.size,"px"),left:0}),"left"===i?{transform:"scaleX(-1)"}:"bottom"===i?{transform:"scaleY(-1)"}:{}),c="ms-edge ".concat(i).concat(o?"":" ms-disabled");return e("div",{className:c,style:l})};S.displayName="Edge";var M=t.memo(S),E=function(r){var n,o=r.visibility,i=r.arrows,l=r.arrowType,c=r.handleArrow,a=r.size,s=t.useRef(null),f=u(u(u(u(u({position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",width:"".concat(i.size,"px")},l?((n={})[l]=0,n):{}),"top"===l&&{transform:"rotate(-90deg) translateX(-100%)",transformOrigin:"left top"}),"bottom"===l&&{transform:"rotate(90deg) translateX(-100%)",transformOrigin:"left bottom"}),"left"===l&&{transform:"scaleX(-1)"}),["top","bottom"].includes(l)?{height:"".concat(a,"px")}:{height:"100%",top:0});return t.useEffect((function(){var e=s.current;if(e){var r=function(){return c(l)};return e.addEventListener("click",r),function(){e.removeEventListener("click",r)}}}),[c,l]),e("div",{className:"ms-arrow-box ".concat(l).concat(o?" active":""),ref:s,style:f,children:i.element})};E.displayName="Arrow";var L,A=t.memo(E),R=function(e){var r=e.getAttribute("data-direction");e.style.opacity="0",e.classList.remove("hover"),e.classList.add("leave"),l("remove".concat(r)),c((function(){return e.classList.remove("leave")}),200,"remove".concat(r))},k=function(e){var r=e.getAttribute("data-direction");l("remove".concat(r)),e.style.opacity="1",e.classList.remove("leave"),e.classList.add("hover")},z=function(){var e=null,r=0,t=new Map,n=function(){t.forEach((function(e,r){e()||t.delete(r)})),e=0!==t.size?requestAnimationFrame(n):null};return{start:function(o,i){var l=null!=i?i:++r;return t.delete(l),t.set(l,o),null===e&&(e=requestAnimationFrame(n)),l},stop:function(r){void 0!==r?(t.delete(r),0===t.size&&null!==e&&(cancelAnimationFrame(e),e=null)):(t.clear(),null!==e&&(cancelAnimationFrame(e),e=null))},isRunning:function(e){return void 0===e?t.size>0:t.has(e)}}}(),j=function(e,r,t){var n=e.current[r],o=performance.now();z.start((function(){var i=performance.now(),l=Math.min((i-o)/140,1);return 1>l?(e.current[r]=n*(1-l),t(),!0):(e.current[r]=0,t(),!1)}))},T={x:0,y:0},C={x:0,y:0},F={x:0,y:0,t:0,distX:0,distY:0},O=null,I=function(e,r,t,n){if(e){var o=null;["thumb","slider"].includes(e)?o="slider"===e?null==r?void 0:r.closest(".ms-slider"):r:"wrapp"===e&&(o=t),function(e,r){if(e){var t,n=window.matchMedia("(pointer: coarse)").matches;"start"===r?(n||(t=document.getElementById("ms-cursor-lock"))||((t=document.createElement("style")).id="ms-cursor-lock",t.textContent="\n * {\n cursor: grabbing !important;\n user-select: none;\n }\n ",document.head.appendChild(t)),e.style.cursor="grabbing",e.classList.add("active")):(n||(t=document.getElementById("ms-cursor-lock"))&&t.remove(),e.style.cursor="grab",e.classList.remove("active"))}}(o,n)}},N=function(e,r,t,n){"x"===e?(t.scrollStateRef.targetScrollX=n,r.scrollLeft!==n&&(r.scrollLeft=n)):(t.scrollStateRef.targetScrollY=n,r.scrollTop!==n&&(r.scrollTop=n))},Y=function(e,r,t,n){var o,i,l=n.scrollElement;if(l){var c="x"===e,a={x:n.event.clientX,y:n.event.clientY};if(a){var u=function(e,r,t){if(0===e)return 0;var o="x"===r?n.sizeLocal[0]:n.sizeLocal[1],i=.14*Math.max(600,o),l=Math.abs(e);return g(e*i/(i+(t?-l:l)),-150,150)};if(O){var s=O,f={x:a.x-s.x.value,y:a.y-s.y.value},d=Math.abs(T[e]);if(d>2?n.isDraggingRef.current=!0:3>d&&(T[e]+=f[e]),n.isTouched){var v=performance.now();if(F.t){var h=Math.max(v-F.t,8);F={x:.8*F.x+f.x/h*.2,y:.8*F.y+f.y/h*.2,t:v,distX:(null!==(o=F.distX)&&void 0!==o?o:0)+Math.abs(f.x),distY:(null!==(i=F.distY)&&void 0!==i?i:0)+Math.abs(f.y)}}else F.t=v}var m="wrapp"===n.clickedObject.current?-f[e]:f[e],p=c?"scrollLeft":"scrollTop",y=c?0:1,b=function(r,t,o){var i=O[e],a=c?n.maxScrollSize[0]:n.maxScrollSize[1];if(Number.isFinite(r)&&Number.isFinite(t)){if(0!==i.raw){var s=i.raw;return i.raw+=.6*t,o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()),Math.sign(i.raw)!==Math.sign(s)?(i.raw=0,void(o&&(n.overscrollRef.current[e]=0,n.triggerUpdate()))):void 0}if(a>0){var f=l[p];if(0>=f&&0>r||f>=a&&r>0)return i.raw+=t,void(o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()));var d=g(l[p]+r,0,a);N(e,l,n,d)}else N(e,l,n,0)}else O=null};if("thumb"===n.clickedObject.current&&"slider"!==n.type){var x=m*r+s[e].rest,w=Math.trunc(x);return s[e].rest=x-w,void b(w,m,!1)}if("slider"===n.type&&(C[e]+=m),"wrapp"!==n.clickedObject.current){var S=l[p];if(!n.sliderElSize||Math.abs(C[e])>=n.sliderElSize[c?0:1]){var M=function(e){var r=l[c?"clientWidth":"clientHeight"]+n.gap[y];return r*(Math.floor(Math.max(0,S)/r)+e)},E=m>0&&S+n.sizeLocal[y]<n.wrapElWH[y]?M(1):0>m&&S>0?M(-1):null;C[e]=0,n.smoothScroll(E,e,10)}}else b(m/t[y],f[e],!0)}else O={x:{value:a.x,rest:0,raw:u(n.overscrollRef.current.x,"x",!0)},y:{value:a.y,rest:0,raw:u(n.overscrollRef.current.y,"y",!0)}}}}};function H(e){z.stop(),["x","y"].forEach((function(r){e.rafScrollAnim.cancel(),l("smoothScrollBlock".concat(r))}));var r=e.scrollElement;if(r){e.scrollStateRef.targetScrollX=r.scrollLeft,e.scrollStateRef.targetScrollY=r.scrollTop,F={x:0,y:0,t:0,distX:0,distY:0};var t=[r.scrollWidth,r.scrollHeight],n=["scroll","slider"].includes(e.type)?function(e){var r=e.getBoundingClientRect();return[r.width/e.clientWidth,r.height/e.clientHeight]}(r):[],o=1;if("thumb"===e.clickedObject.current&&e.axisFromAtr){var i="x"===e.axisFromAtr?0:1,c=(e.sizeLocal[i]-e.scrollBarEdge[i]-e.thumbSize)*n[i];o=e.maxScrollSize[i]/c,Number.isFinite(o)&&o>0||(o=1)}I(e.clickedObject.current,e.target,r,"start"),null==L||L.abort();var a=new AbortController;L=a;var s=a.signal;document.addEventListener("pointermove",(function(r){!function(r){var i,l;if("thumb"===e.clickedObject.current&&"slider"===e.type){var c=null===(i=e.target)||void 0===i?void 0:i.closest(".ms-slider");if(!c)return;var a=function(r){var t=c.getBoundingClientRect();return Math.round(("x"===r?t.width:t.height)/e.objLengthPerSize["x"===r?0:1])};l=[a("x"),a("y")]}!function(e){var r=e.direction||"y";"hybrid"===r?["wrapp","slider"].includes(e.clickedObject.current)?["x","y"].forEach((function(r){return Y(r,e.thumbRatio,e.visualDiff,e)})):e.axisFromAtr&&Y(e.axisFromAtr,e.thumbRatio,e.visualDiff,e):Y(e.axisFromAtr?e.axisFromAtr:r,e.thumbRatio,e.visualDiff,e);var t={x:e.event.clientX,y:e.event.clientY};O&&(O.x.value=t.x,O.y.value=t.y)}(u(u({},e),{event:r,wrapElWH:t,visualDiff:n,thumbRatio:o,sliderElSize:l}))}(r)}),{signal:s});var f=function(r){e.isDraggingRef.current=!1,function(e){null==L||L.abort();var r=e.scrollElement;if(r){if(I(e.clickedObject.current,e.target,r,"end"),"slider"===e.type&&"thumb"!==e.clickedObject.current){var t=C,n=function(t,n){var o="x"===t,i=o?e.maxScrollSize[0]:e.maxScrollSize[1],l=r[o?"scrollLeft":"scrollTop"],c=o?e.gap[0]:e.gap[1],a=r[o?"clientWidth":"clientHeight"]+c,u=(Math[n?n>0?"floor":"ceil":"round"](l/a)+(null!=n?n:0))*a;u>i||0>u||e.smoothScroll(u,t,e.duration)},o=function(e,r){Math.abs(r)>20?n(e,r>0?1:-1):n(e)};0===t.x&&0===t.y?"hybrid"===e.direction?["x","y"].forEach((function(e){return o(e,t[e])})):o(e.direction,t[e.direction]):Object.entries(t).forEach((function(e){var r=d(e,2),t=r[0],n=r[1];0!==n&&o(t,n)}))}if(e.isTouched&&"scroll"===e.type&&"slider"!==e.clickedObject.current){var i=function(t){var n=F[t]*e.thumbRatio,o="x"===t?F.distX:F.distY;80>performance.now()-F.t&&Math.abs(n)>.05&&o>12&&function(e){var r=e.el,t=e.axis,n=e.velocity,o=e.rafSchedule,i=Math.sign(n),l=Math.abs(n);.2>(l=Math.pow(l,.92))&&(l=.2),n=l*i;var c="y"===t?"scrollTop":"scrollLeft",a="y"===t?r.scrollHeight-r.clientHeight:r.scrollWidth-r.clientWidth,u=performance.now(),s=function(){var e=performance.now(),t=e-u;if(u=e,Math.abs(n*=Math.exp(-.0025*t))>=.02){var i=r[c]+n*t;(0>i||i>a)&&(n*=.4,i=g(i,0,a)),r[c]=i,o("step",s)}};o("step",s)}({el:r,axis:t,velocity:"thumb"===e.clickedObject.current?n:-n,rafSchedule:e.rafScrollAnim.schedule})};"hybrid"===e.direction?"wrapp"===e.clickedObject.current?["x","y"].forEach((function(e){return i(e)})):i(e.axisFromAtr):i(e.axisFromAtr?e.axisFromAtr:e.direction)}O=null,0!==e.overscrollRef.current.x&&j(e.overscrollRef,"x",e.triggerUpdate),0!==e.overscrollRef.current.y&&j(e.overscrollRef,"y",e.triggerUpdate),e.clickedObject.current=null,F={x:0,y:0,t:0,distX:0,distY:0},T={x:0,y:0},C={x:0,y:0},e.triggerUpdate()}}(u(u({},e),{event:r,thumbRatio:o}))};document.addEventListener("pointerup",f,{signal:s}),document.addEventListener("pointercancel",f,{signal:s})}}function W(e,r){return e>r?Math.floor(e/r):1}function X(e){return s(this,void 0,void 0,(function(){return f(this,(function(r){switch(r.label){case 0:return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?[3,2]:[4,new Promise((function(e){return requestAnimationFrame(e)}))];case 1:return r.sent(),[3,0];case 2:return[2]}}))}))}var B=new WeakMap,P=function(e){return e?"start"===e?"flex-start":"center"===e?"center":"flex-end":void 0};function D(e,r,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),function(o){var i,l,c,a,u=!1,s={width:(null!==(i=o.width)&&void 0!==i?i:0)-t,height:(null!==(l=o.height)&&void 0!==l?l:0)-n},f=0===s.width&&0===s.height;f&&!u&&(u=!0),(null===(c=e.current)||void 0===c?void 0:c.width)===s.width&&(null===(a=e.current)||void 0===a?void 0:a.height)===s.height||f&&u||(e.current=s,r())}}var V=function(){var e,r;return"undefined"!=typeof window&&null!==(r=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(pointer: coarse)").matches)&&void 0!==r&&r};function U(e,r,t){return r?g(Math.round(e/r*e),t,e):0}function q(e,r,t,n){return r?g(e/r*(t-n),0,t-n):0}function K(){var e=null,r=new Map;return{schedule:function(t,n){r.set(t,n),null===e&&(e=requestAnimationFrame((function(){e=null;var t=Array.from(r.values());r.clear(),t.forEach((function(e){return e()}))})))},cancel:function(){null!==e&&(cancelAnimationFrame(e),e=null,r.clear())}}}var G,_=function(e){if(null==e)return[];if(t.isValidElement(e)){var r=e;return r.type===t.Fragment?t.Children.toArray(r.props.children).flatMap(_):[r]}return[e]},$=function(e){var r=e.lastIndexOf(":$");return-1!==r?e.slice(r+2).replace(/=0/g,"=").replace(/=2/g,":"):e.startsWith(".$")?e.slice(2).replace(/=0/g,"=").replace(/=2/g,":"):e},Z=40,J="ms-under-drag",Q=null,ee=!1,re={x:0,y:0},te={x:0,y:0},ne=!1,oe=null,ie="",le=null,ce=null,ae=null,ue=K(),se=function(){ce&&ce.removeAttribute(J),oe=null,ce=null,le=null,ie="",ae=null};function fe(e,r,t,n,o,i){var l=e-r,c=t-e;return Z>l&&n>0?{dir:-1,distance:l}:Z>c&&i>n+o?{dir:1,distance:c}:null}function de(e){var r=g((Z-Math.abs(e))/Z,0,1,!1);return r*r*20|0}function ve(){if(oe){var e=oe.parent,r=oe.element,t=oe.direction,n=r.getBoundingClientRect(),o=te.x,i=te.y;if(o<n.left-Z||o>n.right+Z||i<n.top-Z||i>n.bottom+Z)se();else{var l=null,c=null,a=0,u=0,s="x"!==t?fe(i,n.top,n.bottom,r.scrollTop,r.clientHeight,r.scrollHeight):null;s&&(l=-1===s.dir?"top":"bottom",u=de(s.distance)*s.dir);var f="y"!==t?fe(o,n.left,n.right,r.scrollLeft,r.clientWidth,r.scrollWidth):null;f&&(c=-1===f.dir?"left":"right",a=de(f.distance)*f.dir),(ie=[l,c].filter(Boolean).join(" "))!==ae&&(e.setAttribute(J,ie),ae=ie),(a||u)&&r.scrollBy(a,u),ue.schedule("autoScrollLoop",ve)}}}function he(e){e instanceof DragEvent&&0===e.buttons?me():te.x===e.clientX&&te.y===e.clientY||(te.x=e.clientX,te.y=e.clientY,ue.schedule("onMove",(function(){if(!ne){var e=te.x-re.x,r=te.y-re.y;if(10>Math.hypot(e,r))return;ne=!0}var t=document.elementFromPoint(te.x,te.y);if(t){var n=t.closest("[morph-scroll]");if(n||oe){var o=n?ye.get(n):oe;o&&(oe=o,le!==o.element&&(ce&&ce!==o.parent&&ce.removeAttribute(J),le=o.element,(ce=o.parent).setAttribute(J,ie),ae=ie,ve()))}else se()}})))}function me(){null==Q||Q.abort(),Q=null,ne=!1,ue.cancel(),se()}function pe(e){var r=e instanceof PointerEvent;if(!r||e.target.closest("[ms-custom-drag]")){re.x=e.clientX,re.y=e.clientY,null==Q||Q.abort();var t=new AbortController;Q=t;var n=t.signal;r?(document.addEventListener("pointermove",he,{signal:n}),document.addEventListener("pointerup",me,{signal:n})):(document.addEventListener("dragover",he,{signal:n}),document.addEventListener("dragend",me,{signal:n}),document.addEventListener("drop",me,{signal:n}),document.addEventListener("pointerdown",me,{signal:n}),window.addEventListener("blur",me,{signal:n}))}}var ye=new Map;var ge=function(m){var S,E,L,z,j,T,C,F,O=m.className,I=m.children,N=m.type,Y=void 0===N?"scroll":N,Z=m.direction,J=void 0===Z?"y":Z,re=m.scrollPosition,te=m.onScrollValue,ne=m.isScrolling,oe=m.onRenderedKeysChange,ie=m.size,le=m.objectsSize,ce=m.crossCount,ae=m.gap,ue=m.wrapperMargin,se=m.wrapperMinSize,fe=m.wrapperAlign,de=m.elementsAlign,ve=m.elementsDirection,he=void 0===ve?"row":ve,me=m.edgeGradient,ge=m.progressTrigger,be=void 0===ge?{wheel:!0}:ge,xe=m.progressReverse,we=void 0!==xe&&xe,Se=m.scrollBarOnHover,Me=void 0!==Se&&Se,Ee=m.scrollBarEdge,Le=m.thumbMinSize,Ae=m.render,Re=m.emptyElements,ke=m.suspending,ze=void 0!==ke&&ke,je=m.fallback,Te=m.dragScroll,Ce=(C=d(o({}),2)[1],i((function(){C({})}),[])),Fe=(null===(F=n(null)).current&&(F.current="".concat(y++)),F.current),Oe=K(),Ie=function(){return Oe.schedule("triggerUpdate",Ce)},Ne=K();if(!ie)throw Error('prop "size" is not provided'.concat("\n morph-scroll ".concat(Fe)));Object.keys(be).length,"none"===le||Array.isArray(le)&&("none"===le[0]||le[1]);var Ye=t.useRef(null),He=t.useRef(null),We=t.useRef(null),Xe=t.useRef(null),Be=t.useRef(new Set),Pe=t.useRef(V()),De=t.useRef(!0),Ve=t.useRef(null),Ue=t.useRef({loaded:new Set,empty:new Set}),qe=t.useRef({targetScrollY:0,targetScrollX:0,animating:!1,animationFrameId:0}),Ke=t.useRef(!1),Ge=t.useRef(!1),_e=t.useRef(function(e){void 0===e&&(e=2);var r=0,t=0,n=null,o=null;return{update:function(i,l){var c=i-r,a=l-t;Math.abs(c)>e&&(n=c>0?"right":"left",r=i),Math.abs(a)>e&&(o=a>0?"down":"up",t=l)},reset:function(){n=null,o=null},get:function(){return{x:n,y:o}}}}()),$e=t.useRef({x:null,y:null}),Ze=t.useRef({x:0,y:0}),Je=t.useRef(!1),Qe=t.useRef(null),er=t.useRef(oe);function rr(){return t.useRef({width:0,height:0})}var tr=rr(),nr=rr(),or=rr(),ir=d(function(){for(var e=[],r=0;arguments.length>r;r++)e[r]=arguments[r];var n=new WeakMap,o=function(e){if(null===e)return 1;if("boolean"==typeof e)return e?2:3;if("number"==typeof e||"bigint"==typeof e)return 0|+e;if("string"==typeof e){for(var r=0,i=0;i<e.length;i++)r=31*r+e.charCodeAt(i)>>>0;return r}if(void 0===e)return 4;if("function"==typeof e)return 5;if(t.isValidElement(e))return 6;if(Array.isArray(e)){for(r=0,i=0;i<e.length;i++)r=31*r+o(e[i])>>>0;return r}if(e instanceof Set)return Array.from(e).map(o).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if(e instanceof Map)return Array.from(e.entries()).map((function(e){var r=d(e,2),t=r[0],n=r[1];return 31*o(t)+o(n)>>>0})).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if("object"==typeof e&&null!==e){if(n.has(e))return n.get(e);var l=Object.entries(e).sort((function(e,r){var t=d(e,1)[0],n=d(r,1)[0];return t.localeCompare(n)})).map((function(e){var r=d(e,2)[1];return o(r)})).reduce((function(e,r){return 31*e+r>>>0}),0);return n.set(e,l),l}return 7};return e.map(o)}(re,Ae,ie,le,Re,se,fe,ae,be,Ue.current.empty,Ee),11),lr=ir[0],cr=ir[1],ar=ir[2],ur=ir[3],sr=ir[4],fr=ir[5],dr=ir[6],vr=ir[7],hr=ir[8],mr=ir[9],pr=ir[10],yr=t.useMemo((function(){var e,r,t=[null],n=200,o=null;if(null!=re)if("number"==typeof re||"end"===re)t=[re,re];else if(Array.isArray(re))t=re;else if("object"==typeof re){var i=re.value;"number"==typeof i||"end"===i?t=[i,i]:Array.isArray(i)&&(t=i),n=null!==(e=re.duration)&&void 0!==e?e:200,o=null!==(r=re.updater)&&void 0!==r?r:null}return{value:t,duration:n,updater:o}}),[lr]),gr={color:null,size:40},br=t.useMemo((function(){return"object"==typeof me?u(u({},gr),me):"string"==typeof me?{color:me,size:40}:gr}),[me]),xr=t.useMemo((function(){var e=be.arrows,r={size:40,contentReduce:!0,loop:!1};return t.isValidElement(e)?u(u({},r),{element:e}):"object"==typeof e&&null!==e?u(u({},r),e):r}),[hr]),wr=t.useMemo((function(){return t.Children.toArray(I).flatMap(_)}),[I]),Sr=t.useMemo((function(){return wr.map((function(e){return t.isValidElement(e)&&e.key?e.key+"":null})).filter((function(e){return null!==e})).filter((function(e){var r;return!("clear"===Re||Re&&"object"==typeof Re&&"mode"in Re&&"clear"===Re.mode)||!(null===(r=Ue.current.empty)||void 0===r?void 0:r.has(e))}))}),[I,sr,mr]),Mr=d(ue?h(ue):[0,0,0,0],4),Er=Mr[0],Lr=Mr[1],Ar=Mr[2],Rr=Mr[3],kr=Er+Ar,zr=Rr+Lr,jr=t.useMemo((function(){var e,r;return"number"==typeof ae?[ae,ae]:Array.isArray(ae)?[null!==(e=ae[1])&&void 0!==e?e:0,null!==(r=ae[0])&&void 0!==r?r:0]:[0,0]}),[ae]),Tr=t.useMemo((function(){var e={type:void 0,rootMargin:0,stopLoadOnScroll:!1,trackVisibility:!1};if("string"==typeof Ae)return u(u({},e),{type:Ae});if("object"==typeof Ae&&null!==Ae){var r=Ae.type,t=Ae.rootMargin,n=void 0===t?e.rootMargin:t,o=Ae.stopLoadOnScroll,i=void 0===o?e.stopLoadOnScroll:o,l=Ae.trackVisibility;return{type:r,rootMargin:n,stopLoadOnScroll:i,trackVisibility:void 0===l?e.trackVisibility:l}}return e}),[cr]),Cr=t.useMemo((function(){return h(Tr.rootMargin)}),[Tr.rootMargin,J]),Fr=t.useMemo((function(){var e=d(Array.isArray(ie)?ie:"number"==typeof ie?[ie,ie]:[tr.current.width,tr.current.height],2),r=e[0],t=e[1];if(!be.arrows||!xr.size||!xr.contentReduce)return[r,t,r,t];var n=2*xr.size,o=r,i=t;return"x"===J?o=r-n:"y"===J?i=t-n:"hybrid"===J&&(o=r-n,i=t-n),[o,i,r,t]}),[ar,hr,J,xr,tr.current.height,tr.current.width]),Or="x"===J?Fr[0]:Fr[1],Ir=t.useMemo((function(){if(!Ee)return[0,0];if("number"==typeof Ee){var e=2*Ee;return[e,e]}if(Array.isArray(Ee)){var r=d(Ee,2),t=r[0],n=void 0===t?0:t,o=r[1];return[2*n,2*(null!=o?o:n)]}return[0,0]}),[pr]),Nr=t.useMemo((function(){return[Fr[0]-Ir[0],Fr[1]-Ir[1]]}),[Ir.join(),Fr[0],Fr[1]]),Yr=t.useMemo((function(){return le?Array.isArray(le)?le:h(le,!0,2):[null,null]}),[ur]),Hr=t.useMemo((function(){var e=or.current,r=e.height,t=e.width,n=function(e,r,t){return r||("number"==typeof e?e:"size"===e?t:0)};return[n(Yr[0],t,Fr[0]),n(Yr[1],r,Fr[1])]}),[Yr.join(),J,or.current.width,or.current.height,Fr.join()]),Wr=t.useMemo((function(){return Ae&&Re&&!je?e("div",{className:"ms-empty-element"}):je}),[!!je,cr,sr]),Xr=t.useMemo((function(){if("none"===Yr[0]||"none"===Yr[1])return[1,Sr.length];var e="x"===J?1:0,r="row"===he,t=Fr[e],n=Hr[e]?Hr[e]+jr[e]:0,o="hybrid"===J&&t?n*Sr.length:t,i=n?Math.floor(o/n):1,l=ce&&i>=ce?"hybrid"===J?Math.ceil(i/ce):ce:i,c=l>1&&l<Sr.length?Math.ceil(Sr.length/l):l<Sr.length?Sr.length:1;r||(l=Math.ceil(Sr.length/c));var a=ce&&ce<Sr.length,u=function(e){return Number.isFinite(e)&&e>0?e:1};if("hybrid"===J){var s=a?r?ce:l:r?Sr.length:1,f=a?r?l:ce:r?1:Sr.length;return[u(s),u(f)]}return[u(l),u(c)]}),[he,jr[0],jr[1],Hr[0],Hr[1],Sr.length,J,Fr.join(),ce]),Br=t.useMemo((function(){var e=1>Xr[0]?1:Xr[0]*jr[1]-jr[1],r=Xr["x"===J?1:0],t=Sr.length<r?Sr.length:r;return Hr[0]?(Hr[0]+jr[1])*t-jr[1]:Tr.type?or.current.width+e:nr.current.width}),[J,Hr[0],Xr[0],Xr[1],jr[1],nr.current.width,or.current.width,Tr.type,Sr.length]),Pr=t.useMemo((function(){var e=1>Xr[1]?1:Xr[0]*jr[0]-jr[0];return Hr[1]?"x"===J?(Hr[1]+jr[0])*Xr[0]-jr[0]:(Hr[1]+jr[0])*Xr[1]-jr[0]:Tr.type?or.current.height+e:nr.current.height}),[J,Hr[1],Xr[0],Xr[1],jr[0],nr.current.height,or.current.height,Tr.type]),Dr=t.useMemo((function(){return Pr+kr}),[Pr,kr]),Vr=t.useMemo((function(){return Br+zr}),[Br,zr]),Ur="x"===J?Vr:Dr,qr=t.useMemo((function(){return[Math.max(0,Vr-Fr[0]),Math.max(0,Dr-Fr[1])]}),[Fr.join(),Dr,Vr]),Kr="x"===J?(null===(S=We.current)||void 0===S?void 0:S.scrollLeft)||0:(null===(E=We.current)||void 0===E?void 0:E.scrollTop)||0,Gr=Kr>1&&!0,_r=Ur>Math.round(Kr+Or),$r=!1,Zr=!1;"hybrid"===J&&($r=((null===(L=We.current)||void 0===L?void 0:L.scrollLeft)||0)>1&&!0,Zr=Math.round(((null===(z=We.current)||void 0===z?void 0:z.scrollLeft)||0)+Fr[0])<Vr);var Jr=t.useMemo((function(){return null!=Le?Le:30}),[Le]),Qr=t.useCallback((function(e){return be.progressElement&&Ur?"x"===e?U(Fr[0]-Ir[0],Vr,Jr):U(Fr[1]-Ir[1],Dr,Jr):0}),[hr,Ur,Fr[0],Fr[1],Vr,Jr,Ir.join()]),et=t.useMemo((function(){return{x:"y"!==J?Qr("x"):0,y:"x"!==J?Qr("y"):0}}),[Qr,J]),rt=t.useMemo((function(){return{w:Fr[0]?Vr-Fr[0]:Vr,h:Fr[1]?Dr-Fr[1]:Dr}}),[Vr,Dr,Fr[0],Fr[1]]),tt={x:"y"!==J?q((null===(j=We.current)||void 0===j?void 0:j.scrollLeft)||0,rt.w,Nr[0],et.x):0,y:"x"!==J?q((null===(T=We.current)||void 0===T?void 0:T.scrollTop)||0,rt.h,Nr[1],et.y):0},nt=t.useMemo((function(){if(!Tr.type)return[{top:0,bottom:0,left:0,right:0}];for(var e=0,r="x"===J,t="row"===he,n=r&&!t||!r&&t,o=Hr[0]+jr[1],i=Hr[1]+jr[0],l=new Set,c=n?Xr[0]:Xr[1],a=Hr[t?0:1],u=jr[t?1:0],s=Math.floor((Sr.length-1)/c)*c;s<Sr.length;s++)l.add(s);var f=c-l.size,d=f>0?(a+u)*f:0;return"center"===de?e=Math.round(d/2):"end"===de&&(e=d),Sr.map((function(r,c){var a,u,s=n?c%Xr[0]:Math.floor(c/Xr[1]),f=n?Math.floor(c/Xr[0]):c%Xr[1];"x"===J?(a=f,u=s):(a=s,u=f);var d=l.size>0&&l.has(c),v=(d&&!t?e:0)+i*u,h=(d&&t?e:0)+o*a;return{top:v,left:h,bottom:v+Hr[1],right:h+Hr[0]}}))}),[Hr[0],Hr[1],jr[0],jr[1],de,Sr.length,Xr[0],Xr[1],Tr.type,he,J]),ot=t.useMemo((function(){return(null==Fr?void 0:Fr.length)&&fe?function(e,r,t,n){var o=d("string"==typeof e?[e,e]:e,2),i=o[0],l=o[1],c=void 0===l?"start":l,a={display:"flex"};return r[0]>t&&(a.justifyContent=P(i)),r[1]>n&&(a.alignItems=P(c)),a}(fe,Fr,Vr,Dr):{}}),[fe,Fr.join(),Dr,Vr]),it=t.useMemo((function(){return[W(Vr,Fr[0]),W(Dr,Fr[1])]}),[Vr,Dr,Fr.join()]),lt=t.useMemo((function(){return"x"===J?it[0]:it[1]}),[J,it[0],it[1]]),ct=t.useCallback(D(tr,Ie),[]),at=t.useCallback(D(nr,Ie,zr,kr),[zr,kr]),ut=t.useCallback(D(or,Ie),[]),st=t.useCallback((function(e,r,t){var n=We.current;return n&&null!==e?function(e,r,t,n,o,i){return s(this,void 0,void 0,(function(){var l,c,u,s,d;return f(this,(function(f){switch(f.label){case 0:return c=(l="y"===e)?"scrollTop":"scrollLeft",u=l?i[1]:i[0],s=g(n,0,u),(d=g(r[c],0,u))===s?[2]:null!==t?[3,2]:[4,X(r)];case 1:return f.sent(),r[c]=n,[2];case 2:return a((function(){var e=performance.now(),n=function(){var i=performance.now(),l=Math.min((i-e)/t,1),a=g(d+(s-d)*l,0,u);r[c]=a,1>l&&a!==s&&o("smoothScroll",n)};o("smoothScroll",n)}),t,"smoothScrollBlock".concat(e)),[2]}}))}))}(r,n,De.current?null:t,e,Ne.schedule,qr):null}),[qr.join()]),ft=t.useMemo((function(){var e=u(u(u({margin:ue?"".concat(Er,"px ").concat(Lr,"px ").concat(Ar,"px ").concat(Rr,"px"):"",height:Yr[1]&&"none"!==Yr[1]?"".concat(Pr,"px"):"fit-content",width:Yr[0]&&"none"!==Yr[0]?"".concat(Br,"px"):"fit-content"},ae&&!Tr.type&&{gap:"".concat(jr[0],"px ").concat(jr[1],"px")}),se&&function(e,r,t,n,o){var i,l,c,a=function(e,r){return"full"===e?("x"===r?t[0]:t[1])-("x"===r?n:o):e};if("hybrid"!==r&&!Array.isArray(e)){var u="".concat(a(e,r),"px");return"x"===r?{minWidth:u}:{minHeight:u}}return Array.isArray(e)?(l=(i=d(e,2))[0],c=i[1]):l=c=e,{minWidth:"".concat(a(l,"x"),"px"),minHeight:"".concat(a(c,"y"),"px")}}(se,J,Fr,zr,kr)),("hybrid"===J||"x"===J)&&{flexShrink:0});if(Tr.type)return u(u({},e),{position:"relative"});var r=1===Xr[0]?"y"===J?"column":"row":he,t=Yr[0]&&"none"!==Yr[0]&&Yr[1]&&"none"!==Yr[1]?"wrap":void 0;return u(u({},e),{display:"flex",flexDirection:r,flexWrap:t,justifyContent:P(de)})}),[ue,dr,fr,[Er,Lr,Ar,Rr,zr,kr,jr[0],jr[1]].join(),Fr.join(),vr,Yr[1],Pr,Br,vr,Tr.type,J,Xr[0],he,de]),dt=t.useCallback((function(e,r,t){var n;Pe.current=V();var o=r.target;if(!o.closest('\n [ms-custom-drag], [draggable="true"], [contenteditable],\n input, textarea, select, button, a\n ')){var i=null;t&&(i=null===(n=o.closest("scroll"===Y?".ms-bar":".ms-slider"))||void 0===n?void 0:n.getAttribute("data-direction")),Ve.current=e,H({scrollElement:We.current,target:o,clickedObject:Ve,scrollStateRef:qe.current,type:Y,triggerUpdate:Ie,direction:J,smoothScroll:st,sizeLocal:[Fr[0],Fr[1]],thumbSize:"x"===i?et.x:et.y,axisFromAtr:i,duration:yr.duration,scrollBarEdge:Ir,rafScrollAnim:Ne,isTouched:Pe.current,gap:jr,overscrollRef:Ze,objLengthPerSize:it,isDraggingRef:Je,maxScrollSize:qr})}}),[J,Y,Fr.join(),yr.duration,st,Ir.join(),et.x,et.y,jr.join(),it,qr.join()]),vt=t.useCallback((function(e){dt("thumb",e,!0)}),[dt]),ht=t.useCallback((function(e){We.current&&function(e){var r=e.arrowType,t=e.scrollElement,n=e.wrapSize,o=e.scrollSize,i=e.smoothScroll,l=e.duration,c=e.loop,a=e.gap,u=n[0],s=n[1],f=t.scrollTop,d=t.scrollLeft,v=function(e,r,n){var o=n?function(e,r){return"x"===e?r>0?0:u:r>0?0:s}(e,r):function(e,r){var n="x"===e,o=n?d:f,i=n?a[0]:a[1],l=t[n?"clientWidth":"clientHeight"]+i;return l*(Math.floor(Math.max(0,o)/l)+r)}(e,r);i(o,e,l)};switch(r){case"top":f>0?v("y",-1):c&&v("y",-1,!0);break;case"left":d>0?v("x",-1):c&&v("x",-1,!0);break;case"right":d+o[0]<u?v("x",1):c&&v("x",1,!0);break;case"bottom":f+o[1]<s?v("y",1):c&&v("y",1,!0)}}({arrowType:e,scrollElement:We.current,wrapSize:[Vr,Dr],scrollSize:Fr,smoothScroll:st,duration:yr.duration,loop:xr.loop,gap:jr})}),[Fr.join(),Vr,Dr,yr.duration,st,xr.loop,jr[0],jr[1]]),mt=t.useCallback((function(){"scroll"!==Y&&Fr[0]&&Fr[1]&&He.current&&We.current&&Be.current.size&&function(e,r,t,n){v([],d(r),!1).forEach((function(r,o){var i,l,c=B.get(r),a=0===o?t:"x",u="x"===a?0:1;if(c&&c.elements.length===n[u]||(c={elements:Array.from(r.querySelectorAll(".ms-slider-element")),lastIndex:-1},B.set(r,c)),c.elements.length){var s="x"===a?e.scrollLeft:e.scrollTop,f="x"===a?e.clientWidth:e.clientHeight,d=Math.floor((s+f/2)/f);d!==c.lastIndex&&(-1!==c.lastIndex&&(null===(i=c.elements[c.lastIndex])||void 0===i||i.classList.remove("active")),null===(l=c.elements[d])||void 0===l||l.classList.add("active"),c.lastIndex=d)}}))}(We.current,Be.current,J,it)}),[Fr.join(),J,Y,it.join()]),pt=t.useCallback((function(e){if(e){var r=(o=Xe.current)?Array.from(o.children).flatMap((function(e){if(!(e instanceof HTMLElement))return[];var r=e.getAttribute(b);return r?[$(r)]:[]})):[];Qe.current&&(t=Qe.current,n=r,t.length===n.length&&t.every((function(e,r){return e===n[r]})))||(Qe.current=r,e(r))}var t,n,o}),[]),yt=t.useCallback((function(){Xe.current&&function(e,r,t,n){for(var o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return e instanceof Element&&e.hasAttribute(b)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=o.nextNode();i;){var l=i,c=l.getAttribute(b);if(c){var a=0===l.children.length;a&&(r.current.empty||(r.current.empty=new Set),r.current.empty.add(c)),"virtual"===n&&a||r.current.loaded.add(c)}i=o.nextNode()}t()}(Xe.current,Ue,Ie,Tr.type)}),[cr]),gt=t.useCallback((function(e){"object"==typeof Re&&"clickTrigger"in Re&&void 0!==Re.clickTrigger&&function(e,r,t){var n="string"==typeof r?{selector:r}:r,o=n.selector,i=n.delay,l=void 0===i?0:i,a=e.target;if(a.closest(o)){var u=a.closest("[wrap-id]");null==u||u.classList.add("remove"),c((function(){null==u||u.classList.remove("remove"),t()}),l)}}(e,Re.clickTrigger,yt)}),[sr,yt]),bt=t.useCallback((function(e){l("removeHover");var r=He.current,t=Ye.current,n=We.current;if(r&&t&&n){if(yr.value.includes("end")){var o=e.currentTarget,i=o.scrollLeft,a=o.scrollTop;_e.current.update(i,a)}null==te||te(n.scrollLeft,n.scrollTop);var u=r.querySelectorAll("scroll"===Y?".ms-bar":".ms-slider");Me&&u.length>0&&!Ke.current&&u.forEach((function(e){e.classList.contains("hover")||k(e)})),Ke.current=!0,null==ne||ne(!0),c((function(){_e.current.reset(),Ke.current=!1,null==ne||ne(!1),Tr.type&&yt(),Me&&u.length>0&&!Ve.current&&u.forEach((function(e){c((function(){e.hasAttribute("ms-manual-hover")||R(e)}),1e3,"removeHover")}))}),200,"isScrolling"),c((function(){return pt(er.current)}),"raf","onRenderedKeysChange"),Oe.schedule("sliderCheckLocal",(function(){"scroll"!==Y&&mt(),Ce()}))}}),[te,ne,Y,mt,yt,Me,Tr.type]),xt=t.useCallback((function(e){if(!Ge.current){var r="object"==typeof be.wheel&&"string"==typeof be.wheel.changeDirectionKey?be.wheel.changeDirectionKey:"KeyX";e.code!==r||"hybrid"!==J||Ge.current||(e.stopPropagation(),Ge.current=!0,Ie())}}),[J,hr]),wt=t.useCallback((function(e){Ge.current&&(e.stopPropagation(),Ge.current=!1,Ie())}),[]);t.useEffect((function(){if(!oe)return er.current=void 0,void(Qe.current=null);er.current=oe,Qe.current=null,pt(oe)}),[oe,pt]),t.useEffect((function(){er.current&&Fr[0]&&Fr[1]&&pt(er.current)}),[Sr.join("|"),Fr.join()]),t.useEffect((function(){if(!Pe.current&&"hybrid"===J){var e=Xe.current,r=We.current;if(e&&r)return e.clientWidth+zr>r.clientWidth&&e.clientHeight+kr>r.clientHeight&&(r.addEventListener("keydown",xt),r.addEventListener("keyup",wt)),function(){r.removeEventListener("keydown",xt),r.removeEventListener("keyup",wt)}}}),[J,hr,ar,ur,Sr.join(),zr,kr]),t.useEffect((function(){Re&&Tr.type&&yt()}),[sr,Tr.type,yt,Sr.length]),t.useEffect((function(){if(!Pe.current){var e=We.current,r=Xe.current;if(e&&r){var t="hybrid"===J&&"object"==typeof be.wheel&&be.wheel.changeDirection?"x":J,n="hybrid"===J&&Pr+kr<=Fr[1]||Ge.current?["hybrid","y"].includes(t)?"x":"y":t,o=function(r){r.preventDefault(),x(r,e,qr,qe.current,n)};return be.wheel&&e.addEventListener("wheel",o,{passive:!1}),function(){e.removeEventListener("wheel",o)}}}}),[J,hr,Pr,Fr[1],kr,Ge.current,qr.join()]),t.useEffect((function(){Oe.schedule("smoothScrollLocal",(function(){("hybrid"===J?["x","y"]:[J]).forEach((function(e){var r=yr.value["x"===e?0:1];if("end"===r){if(_e.current.get()[e]===("x"===e?"left":"up"))return;st("x"===e?rt.w:rt.h,e,yr.duration)}else"number"==typeof r&&$e.current[e]!==r&&($e.current[e]=r,st(r,e,yr.duration))}))}))}),[J,lr,rt.w,rt.h,yr.value.join()]),t.useEffect((function(){var e=qe.current.animationFrameId;return(Tr.type||ne)&&ne&&ne(!1),requestAnimationFrame((function(){return De.current=!1})),function(){e&&cancelAnimationFrame(e),qe.current.animationFrameId&&cancelAnimationFrame(qe.current.animationFrameId),Ne.cancel()}}),[]),t.useEffect((function(){if(Te){var e=Ye.current,r=We.current;if(e&&r){var t={parent:e,element:r,direction:J};return function(e){ye.set(e.parent,e),1===ye.size&&function(){if(!ee){var e=(G=new AbortController).signal;document.addEventListener("pointerdown",pe,{signal:e}),document.addEventListener("dragstart",pe,{signal:e}),ee=!0}}()}(t),function(){!function(e){ye.delete(e.parent),0===ye.size&&ee&&(null==G||G.abort(),null==Q||Q.abort(),ee=!1)}(t)}}}}),[Te,J]),t.useEffect((function(){var e=We.current;if(e){var r=function(e){dt("wrapp",e)};if(be.content||!be.content&&Pe.current&&be.wheel){if(!0===be.progressElement)return;e.addEventListener("pointerdown",r)}return function(){e.removeEventListener("pointerdown",r)}}}),[hr,dt]),t.useEffect((function(){var e=He.current;if(e&&Me&&Be.current.size){var r=function(e){"mouseenter"===e.type&&document.removeEventListener("mouseup",r),"mouseleave"===e.type&&Ve.current?document.addEventListener("mouseup",r):Array.from(Be.current).forEach((function(r){!function(e){var r=e.el,t=e.event,n=e.isScrolling,o=function(e){if(["mouseleave","mouseup","pointerup","pointercancel"].includes(t.type)){if(e.removeAttribute("ms-manual-hover"),null==n?void 0:n.current)return;R(e)}else e.setAttribute("ms-manual-hover",""),k(e)};Array.isArray(r)?r.map((function(e){return o(e)})):o(r)}({el:r,event:e,isScrolling:Ke})}))},t=function(r,t){Pe.current?(Array.from(Be.current).forEach((function(e){return e[r]("pointerdown",t)})),document[r]("pointerup",t),document[r]("pointercancel",t)):(e[r]("mouseenter",t),e[r]("mouseleave",t))};return t("addEventListener",r),function(){t("removeEventListener",r)}}}),[Me,Y,J,Be.current.size]),t.useEffect((function(){"scroll"!==Y&&Oe.schedule("sliderCheckLocal",mt)}),[Y,mt,Fr.join()]);var St,Mt=t.useCallback((function(r,n,o,i,l){var c,a=u(u({width:Hr[0]?"".concat(Hr[0],"px"):void 0,height:Hr[1]?"".concat(Hr[1],"px"):void 0},Tr.type&&{position:"absolute",transform:"translate(".concat(o,"px, ").concat(n,"px)")}),"number"==typeof l&&{"--content-visibility":l}),s=ze?e(t.Suspense,{fallback:Wr,children:i}):i;return e("div",u({},Tr.type||Re?((c={})[b]="".concat(r),c):{},{className:"ms-object-box",style:a,onClick:Re?gt:void 0,children:s}),r)}),[ze,!!Wr,Hr[0],Hr[1],cr,sr,Xr[0],gt,Tr.type]),Et=t.useMemo((function(){var e=new Map;return wr.forEach((function(r){t.isValidElement(r)&&null!=r.key&&e.set(r.key+"",r)})),e}),[wr]),Lt=t.useMemo((function(){return v([{positionType:"x"===J?"left":"top",visibility:Gr},{positionType:"x"===J?"right":"bottom",visibility:_r}],d("hybrid"===J?[{positionType:"left",visibility:$r},{positionType:"right",visibility:Zr}]:[]),!1)}),[Gr,_r,J,$r,Zr]),At=t.useMemo((function(){return{width:"".concat(Fr[2],"px"),height:"".concat(Fr[3],"px")}}),[Fr]),Rt=t.useMemo((function(){var e;return null!==(e={x:Vr>Fr[0]?"scroll hidden":"hidden",y:Dr>Fr[1]?"hidden scroll":"hidden",hybrid:"".concat(Vr>Fr[0]?"scroll":"hidden"," ").concat(Dr>Fr[1]?"scroll":"hidden"),hide:"hidden"}[be.wheel||be.content&&"scroll"===Y?J:"hide"])&&void 0!==e?e:"hidden"}),[Vr,Dr,Fr,hr,J]),kt=t.useMemo((function(){return me?Lt.map((function(r){var t=r.positionType,n=r.visibility;return e(M,{edgeGradient:br,visibility:n,edgeType:t,size:Fr},"edge-".concat(t))})):null}),[me,Lt,br,ar]),zt=t.useMemo((function(){return be.arrows?Lt.map((function(r){var t=r.positionType,n=r.visibility;return e(A,{visibility:n,arrows:xr,arrowType:t,handleArrow:ht,size:Fr[0]},"arrow-".concat(t))})):null}),[hr,Lt,xr,ht,Fr[0]]),jt=function(){var r,n,o=(null===(r=We.current)||void 0===r?void 0:r.scrollLeft)||0,i=(null===(n=We.current)||void 0===n?void 0:n.scrollTop)||0;return e("div",{className:"ms-objects-wrapper",ref:Xe,style:u(u(u({},ft),(Ze.current.x||Ze.current.y)&&{transform:"translate(".concat(Ze.current.x,"px, ").concat(Ze.current.y,"px)")}),Je.current&&{pointerEvents:"none"}),children:Sr.map((function(r,n){return function(r,n,o,i){var l,c=Et.get(r),a=Tr.stopLoadOnScroll&&Ke.current&&!Ue.current.loaded.has(r)?Wr:(null===(l=Ue.current.empty)||void 0===l?void 0:l.has(r))?Re&&"object"==typeof Re&&t.isValidElement(Re)?Re:Re&&"object"==typeof Re&&"mode"in Re&&"object"==typeof Re.mode&&"fallback"in Re.mode?Re.mode.fallback:Wr:c,u="firstChild"!==Yr[0]&&"firstChild"!==Yr[1]||0!==n?a:e(p,{onResize:ut,children:a});if(!Tr.type)return Mt(r,0,0,u);var s=nt[n],f=s.top,d=s.bottom,v=s.left,h=s.right,m=function(e){void 0===e&&(e=!0);var r=e?Cr:[0,0,0,0],t=function(e){var t="x"===e?o:i,n=t+("x"===e?Fr[0]:Fr[1]),l="x"===e?v-r[3]:f-r[2],c="x"===e?h+r[1]:d+r[0],a=c-l;if(0>=a)return 0;var u=Math.min(c,n)-Math.max(l,t);return u>0?Math.round(10*Math.min(1,u/a))/10:0};if("hybrid"===J){var n=t("x"),l=t("y");return Math.min(n,l)}return t("x"===J?"x":"y")},y=m(),g=Tr.trackVisibility?m(!1):null;if("lazy"===Tr.type){var b=Ue.current.loaded.has(r);if(y&&!b){if(Ke.current&&Tr.stopLoadOnScroll)return;Ue.current.loaded.add(r)}return b?Mt(r,f,v,u,g):null}return y?Mt(r,f,v,u,g):(Ue.current.loaded.delete(r),null)}(r,n,o,i)}))})},Tt=t.useMemo((function(){var e={position:"relative",width:"".concat(Fr[0],"px"),height:"".concat(Fr[1],"px")};return be.arrows&&xr.contentReduce&&xr.size&&("x"===J?e.left="".concat(xr.size,"px"):"y"===J?e.top="".concat(xr.size,"px"):(e.top="".concat(xr.size,"px"),e.left="".concat(xr.size,"px"))),e}),[Fr,hr,xr,J]),Ct=r("div",{"morph-scroll":"".concat(Fe),className:O,ref:Ye,style:At,children:[r("div",{className:"ms-content",ref:He,style:u(u(u({},Tt),{transform:"translateZ(0)"}),Pe.current&&{touchAction:"pinch-zoom"}),children:[e("div",{className:"ms-element",ref:We,onScroll:bt,tabIndex:0,style:u(u(u({width:"100%",height:"100%",outline:"none"},ot),"boolean"!=typeof be.progressElement||!1===be.progressElement?{scrollbarWidth:"none",overflow:"hidden"}:{overflow:Rt}),be.content&&{cursor:"grab"}),children:Hr[0]&&Hr[1]?jt():e(p,{onResize:at,style:ot,children:jt()})}),kt,be.progressElement&&!0!==be.progressElement?(St="x"!==J,[{shouldRender:Ur>Fr[St?1:0],direction:J,thumbSize:St?et.y:et.x,thumbSpace:St?tt.y:tt.x,objLengthPerSize:lt,progressReverseIndex:0},{shouldRender:"hybrid"===J&&Vr>Fr[0],direction:"x",thumbSize:et.x,thumbSpace:tt.x,objLengthPerSize:it[0],progressReverseIndex:1}].filter((function(e){return e.shouldRender}))).map((function(r){var t="boolean"==typeof we?we:we[r.progressReverseIndex];return e(w,{type:Y,direction:r.direction,progressReverse:t,size:Nr,progressTrigger:[be,hr],scrollBarOnHover:Me,scrollBarEvent:"sliderMenu"===Y?st:vt,thumbSize:r.thumbSize,thumbSpace:r.thumbSpace,objLengthPerSize:r.objLengthPerSize,sliderCheckLocal:mt,duration:yr.duration,isTouched:Pe.current,scrollStateRef:qe,scrollEl:We,scrollBarsRef:Be,triggerUpdate:Ie,overscroll:Ze,maxScrollSize:qr},r.direction)})):null]}),zt]});return"auto"===ie?e(p,{measure:"outer",onResize:ct,children:Ct}):Ct};ge.displayName="MorphScroll";var be={MorphScroll:ge,ResizeTracker:p,IntersectionTracker:m};export{m as IntersectionTracker,ge as MorphScroll,p as ResizeTracker,be as default};
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import t,{useRef as n,useState as o,useCallback as i}from"react";import{createTaskManager as l}from"keytask-core";var c=function(){return c=Object.assign||function(e){for(var r,t=1,n=arguments.length;n>t;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},c.apply(this,arguments)};function a(e,r,t,n){return new(t||(t=Promise))((function(o,i){function l(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(l,c)}a((n=n.apply(e,r||[])).next())}))}function u(e,r){var t,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function c(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(e,i)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function s(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),l=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)l.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return l}function f(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;i>o;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var d=function(e,r,t){void 0===r&&(r=!1);var n=[];if(n=Array.isArray(e)?2===e.length?[e[1],e[0],e[1],e[0]]:f([],s(e),!1):[e,e,e,e],r&&(n=[n[1],n[0],n[3],n[2]]),t){for(var o=[],i=0;t>i;i++)o.push(n[i%4]);n=o}return n},v=function(r){var n=r.className,o=r.children,i=r.style,l=r.root,c=r.threshold,a=r.rootMargin,u=r.visibleContent,f=void 0!==u&&u,v=r.onIntersection,h=s(t.useState(!1),2),m=h[0],p=h[1],y=t.useRef(null),g=t.useMemo((function(){if(!a)return"";var e=d(a);return"".concat(e[0],"px ").concat(e[1],"px ").concat(e[2],"px ").concat(e[3],"px")}),[a]),b=t.useCallback((function(e){var r=s(e,1)[0];p(r.isIntersecting),v&&v({time:r.time,rootBounds:r.rootBounds,boundingClientRect:r.boundingClientRect,intersectionRect:r.intersectionRect,isIntersecting:r.isIntersecting,intersectionRatio:r.intersectionRatio,target:r.target})}),[v]);return t.useEffect((function(){var e=new IntersectionObserver(b,{root:l,threshold:c,rootMargin:g});return y.current&&e.observe(y.current),function(){e.disconnect()}}),[b,l,c,g]),e("div",{"intersection-tracker":"",className:n,ref:y,style:i,children:f||m?o:null})};v.displayName="IntersectionTracker";var h=function(r){var n=r.className,o=r.children,i=r.style,l=r.measure,a=void 0===l?"inner":l,u=r.onResize,s=t.useRef(null);t.useEffect((function(){var e=s.current;if(e){var r=new ResizeObserver((function(e){var r,t;try{for(var n=function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),o=n.next();!o.done;o=n.next()){var i=o.value;u&&u(i.contentRect)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(r)throw r.error}}}));return r.observe(e),function(){r.unobserve(e),r.disconnect()}}}),[a,u]);var f={width:"max-content",height:"max-content"},d={inner:c({},f),outer:c({},{width:"100%",height:"100%"}),all:c({minWidth:"100%",minHeight:"100%"},f)};return e("div",{"resize-tracker":"",className:n,ref:s,style:c(c({willChange:"width, height"},d[a]),i),children:o})};h.displayName="ResizeTracker";var m=l(),p=m.cancelTask,y=m.setLockTask,g=m.setTask,b=1;function x(e,r,t,n){return void 0===r&&(r=0),void 0===t&&(t=1/0),void 0===n&&(n=!0),Math.max(r,Math.min(n?Math.round(e):e,t))}var w="wrap-id";function S(e,r,t,n,o){r.matches(":focus")||r.focus(),n.animating||(n.targetScrollX=x(r.scrollLeft,0,t[0]),n.targetScrollY=x(r.scrollTop,0,t[1])),"x"===o?n.targetScrollX=x(n.targetScrollX+e.deltaY,0,t[0]):n.targetScrollY=x(n.targetScrollY+e.deltaY,0,t[1]),n.animating||(n.animating=!0,n.animationFrameId=requestAnimationFrame((function e(){var i;if("x"===o){var l=x(r.scrollLeft+.4*(n.targetScrollX-r.scrollLeft),0,t[0]);r.scrollLeft=l,i=Math.abs(l-n.targetScrollX)}else{var c=x(r.scrollTop+.4*(n.targetScrollY-r.scrollTop),0,t[1]);r.scrollTop=c,i=Math.abs(c-n.targetScrollY)}i>2.5?n.animationFrameId=requestAnimationFrame(e):("x"===o?r.scrollLeft=x(n.targetScrollX,0,t[0]):r.scrollTop=x(n.targetScrollY,0,t[1]),n.animating=!1,n.animationFrameId=null)})))}var M=function(r){var n=r.type,o=r.direction,i=r.progressReverse,l=r.size,a=r.progressTrigger,u=r.scrollBarOnHover,s=r.scrollBarEvent,f=r.thumbSize,d=r.thumbSpace,v=r.objLengthPerSize,h=r.sliderCheckLocal,m=r.duration,p=r.isTouched,y=r.scrollStateRef,g=r.scrollEl,b=r.scrollBarsRef,x=r.triggerUpdate,w=r.overscroll,M=r.maxScrollSize,E=t.useRef(null),L=t.useRef(null),k=["hybrid","y"].includes(o)?"y":"x",A=Math.abs(w.current[k])*(f/200),R=f-A,z=0>w.current[k]?d+A:d,j=t.useMemo((function(){if("scroll"!==n){var r=l["x"===k?0:1];return Array.from({length:v},(function(t,o){return e("div",{className:"ms-slider-element",style:c({},"sliderMenu"===n&&{cursor:"pointer"}),onClick:"sliderMenu"===n?function(){s(r*o,k,m,h)}:void 0,children:Array.isArray(a[0].progressElement)?a[0].progressElement[o]:a[0].progressElement},o)}))}}),[v,n,a[1],m,h,l[0],l[1],s]),T=t.useMemo((function(){return"x"!==o?"y":"x"}),[o]),C=l["x"===T?0:1],F="scroll"!==n?"":f+2*d>C?"flex-end":"flex-start";t.useEffect((function(){if(!p&&a[0].wheel){var e=E.current,r=g.current;if(e&&r){for(var t=e.previousElementSibling;t&&!t.classList.contains("ms-element");)t=t.previousElementSibling;var n=function(e){return S(e,r,M,y.current,T)};return e.addEventListener("wheel",n,{passive:!1}),function(){return e.removeEventListener("wheel",n)}}}}),[T]),t.useEffect((function(){var e="slider"===n?E.current:L.current;if(e&&"sliderMenu"!==n){var r=function(e){return s(e)};return e.addEventListener("pointerdown",r),function(){return e.removeEventListener("pointerdown",r)}}}),[s,n]),t.useEffect((function(){var e=E.current;if(e)return b.current.add(e),x(),function(){b.current.delete(e)}}),[f]);var O=c({position:"absolute"},u&&{opacity:0,transition:"opacity 0.2s ease-in-out"});return e(t.Fragment,{children:"scroll"===n?e("div",{className:"ms-bar ms-".concat(T),ref:E,"data-direction":T,style:c(c(c({},O),{width:"fit-content",height:"".concat(C,"px")}),"x"===o?c({transformOrigin:"left top",left:"50%"},i?{top:0,transform:"rotate(-90deg) translate(-100%, -50%)"}:{transform:"rotate(-90deg) translateY(-50%)"}):c({top:"50%",transform:"translateY(-50%)"},i?{left:0}:{right:0})),children:e("div",{className:"ms-thumb",ref:L,style:c(c({height:"".concat(R,"px"),transform:"translateY(".concat(z,"px)")},a[0].progressElement&&{cursor:"grab"}),{display:"flex",alignItems:F}),children:a[0].progressElement})}):v>1&&a[0].progressElement&&e("div",{className:"ms-slider ms-".concat(T),ref:E,"data-direction":T,style:c(c(c(c({},O),{display:"flex"}),"slider"===n&&{cursor:"grab"}),"x"===o?c({transformOrigin:"left top",left:"50%",transform:"translateX(-50%)"},i?{top:0}:{bottom:0}):c({flexDirection:"column",top:"50%",transform:"translateY(-50%)"},i?{left:0}:{right:0})),children:j})})};M.displayName="ScrollBar";var E=function(r){var t,n=r.edgeGradient,o=r.visibility,i=r.edgeType;r.size;var l=c(c(c(((t={position:"absolute"})[i]=0,t.pointerEvents="none",t.transition="opacity 0.2s ease-in-out",t["--edge-visibility"]=o?1:0,t.opacity="var(--edge-visibility)",t),n.color&&{background:n.color&&"linear-gradient(".concat(["left","right"].includes(i)?"270deg, ":"").concat(n.color,", transparent)")}),["left","right"].includes(i)?{height:"100%",width:"".concat(n.size,"px"),top:0}:{width:"100%",height:"".concat(n.size,"px"),left:0}),"left"===i?{transform:"scaleX(-1)"}:"bottom"===i?{transform:"scaleY(-1)"}:{}),a="ms-edge ".concat(i).concat(o?"":" ms-disabled");return e("div",{className:a,style:l})};E.displayName="Edge";var L=t.memo(E),k=function(r){var n,o=r.visibility,i=r.arrows,l=r.arrowType,a=r.handleArrow,u=r.size,s=t.useRef(null),f=c(c(c(c(c({position:"absolute",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",width:"".concat(i.size,"px")},l?((n={})[l]=0,n):{}),"top"===l&&{transform:"rotate(-90deg) translateX(-100%)",transformOrigin:"left top"}),"bottom"===l&&{transform:"rotate(90deg) translateX(-100%)",transformOrigin:"left bottom"}),"left"===l&&{transform:"scaleX(-1)"}),["top","bottom"].includes(l)?{height:"".concat(u,"px")}:{height:"100%",top:0});return t.useEffect((function(){var e=s.current;if(e){var r=function(){return a(l)};return e.addEventListener("click",r),function(){e.removeEventListener("click",r)}}}),[a,l]),e("div",{className:"ms-arrow-box ".concat(l).concat(o?" active":""),ref:s,style:f,children:i.element})};k.displayName="Arrow";var A,R=t.memo(k),z=function(e){var r=e.getAttribute("data-direction");e.style.opacity="0",e.classList.remove("hover"),e.classList.add("leave"),p("remove".concat(r)),g((function(){return e.classList.remove("leave")}),200,"remove".concat(r))},j=function(e){var r=e.getAttribute("data-direction");p("remove".concat(r)),e.style.opacity="1",e.classList.remove("leave"),e.classList.add("hover")},T=function(){var e=null,r=0,t=new Map,n=function(){t.forEach((function(e,r){e()||t.delete(r)})),e=0!==t.size?requestAnimationFrame(n):null};return{start:function(o,i){var l=null!=i?i:++r;return t.delete(l),t.set(l,o),null===e&&(e=requestAnimationFrame(n)),l},stop:function(r){void 0!==r?(t.delete(r),0===t.size&&null!==e&&(cancelAnimationFrame(e),e=null)):(t.clear(),null!==e&&(cancelAnimationFrame(e),e=null))},isRunning:function(e){return void 0===e?t.size>0:t.has(e)}}}(),C=function(e,r,t){var n=e.current[r],o=performance.now();T.start((function(){var i=performance.now(),l=Math.min((i-o)/140,1);return 1>l?(e.current[r]=n*(1-l),t(),!0):(e.current[r]=0,t(),!1)}))},F={x:0,y:0},O={x:0,y:0},I={x:0,y:0,t:0,distX:0,distY:0},N=null,Y=function(e,r,t,n){if(e){var o=null;["thumb","slider"].includes(e)?o="slider"===e?null==r?void 0:r.closest(".ms-slider"):r:"wrapp"===e&&(o=t),function(e,r){if(e){var t,n=window.matchMedia("(pointer: coarse)").matches;"start"===r?(n||(t=document.getElementById("ms-cursor-lock"))||((t=document.createElement("style")).id="ms-cursor-lock",t.textContent="\n * {\n cursor: grabbing !important;\n user-select: none;\n }\n ",document.head.appendChild(t)),e.style.cursor="grabbing",e.classList.add("active")):(n||(t=document.getElementById("ms-cursor-lock"))&&t.remove(),e.style.cursor="grab",e.classList.remove("active"))}}(o,n)}},H=function(e,r,t,n){"x"===e?(t.scrollStateRef.targetScrollX=n,r.scrollLeft!==n&&(r.scrollLeft=n)):(t.scrollStateRef.targetScrollY=n,r.scrollTop!==n&&(r.scrollTop=n))},W=function(e,r,t,n){var o,i,l=n.scrollElement;if(l){var c="x"===e,a={x:n.event.clientX,y:n.event.clientY};if(a){var u=function(e,r,t){if(0===e)return 0;var o="x"===r?n.sizeLocal[0]:n.sizeLocal[1],i=.14*Math.max(600,o),l=Math.abs(e);return x(e*i/(i+(t?-l:l)),-150,150)};if(N){var s=N,f={x:a.x-s.x.value,y:a.y-s.y.value},d=Math.abs(F[e]);if(d>2?n.isDraggingRef.current=!0:3>d&&(F[e]+=f[e]),n.isTouched){var v=performance.now();if(I.t){var h=Math.max(v-I.t,8);I={x:.8*I.x+f.x/h*.2,y:.8*I.y+f.y/h*.2,t:v,distX:(null!==(o=I.distX)&&void 0!==o?o:0)+Math.abs(f.x),distY:(null!==(i=I.distY)&&void 0!==i?i:0)+Math.abs(f.y)}}else I.t=v}var m="wrapp"===n.clickedObject.current?-f[e]:f[e],p=c?"scrollLeft":"scrollTop",y=c?0:1,g=function(r,t,o){var i=N[e],a=c?n.maxScrollSize[0]:n.maxScrollSize[1];if(Number.isFinite(r)&&Number.isFinite(t)){if(0!==i.raw){var s=i.raw;return i.raw+=.6*t,o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()),Math.sign(i.raw)!==Math.sign(s)?(i.raw=0,void(o&&(n.overscrollRef.current[e]=0,n.triggerUpdate()))):void 0}if(a>0){var f=l[p];if(0>=f&&0>r||f>=a&&r>0)return i.raw+=t,void(o&&(n.overscrollRef.current[e]=u(i.raw,e),n.triggerUpdate()));var d=x(l[p]+r,0,a);H(e,l,n,d)}else H(e,l,n,0)}else N=null};if("thumb"===n.clickedObject.current&&"slider"!==n.type){var b=m*r+s[e].rest,w=Math.trunc(b);return s[e].rest=b-w,void g(w,m,!1)}if("slider"===n.type&&(O[e]+=m),"wrapp"!==n.clickedObject.current){var S=l[p];if(!n.sliderElSize||Math.abs(O[e])>=n.sliderElSize[c?0:1]){var M=function(e){var r=l[c?"clientWidth":"clientHeight"]+n.gap[y];return r*(Math.floor(Math.max(0,S)/r)+e)},E=m>0&&S+n.sizeLocal[y]<n.wrapElWH[y]?M(1):0>m&&S>0?M(-1):null;O[e]=0,n.smoothScroll(E,e,10)}}else g(m/t[y],f[e],!0)}else N={x:{value:a.x,rest:0,raw:u(n.overscrollRef.current.x,"x",!0)},y:{value:a.y,rest:0,raw:u(n.overscrollRef.current.y,"y",!0)}}}}};function X(e){T.stop(),["x","y"].forEach((function(r){e.rafScrollAnim.cancel(),p("smoothScrollBlock".concat(r))}));var r=e.scrollElement;if(r){e.scrollStateRef.targetScrollX=r.scrollLeft,e.scrollStateRef.targetScrollY=r.scrollTop,I={x:0,y:0,t:0,distX:0,distY:0};var t=[r.scrollWidth,r.scrollHeight],n=["scroll","slider"].includes(e.type)?function(e){var r=e.getBoundingClientRect();return[r.width/e.clientWidth,r.height/e.clientHeight]}(r):[],o=1;if("thumb"===e.clickedObject.current&&e.axisFromAtr){var i="x"===e.axisFromAtr?0:1,l=(e.sizeLocal[i]-e.scrollBarEdge[i]-e.thumbSize)*n[i];o=e.maxScrollSize[i]/l,Number.isFinite(o)&&o>0||(o=1)}Y(e.clickedObject.current,e.target,r,"start"),null==A||A.abort();var a=new AbortController;A=a;var u=a.signal;document.addEventListener("pointermove",(function(r){!function(r){var i,l;if("thumb"===e.clickedObject.current&&"slider"===e.type){var a=null===(i=e.target)||void 0===i?void 0:i.closest(".ms-slider");if(!a)return;var u=function(r){var t=a.getBoundingClientRect();return Math.round(("x"===r?t.width:t.height)/e.objLengthPerSize["x"===r?0:1])};l=[u("x"),u("y")]}!function(e){var r=e.direction||"y";"hybrid"===r?["wrapp","slider"].includes(e.clickedObject.current)?["x","y"].forEach((function(r){return W(r,e.thumbRatio,e.visualDiff,e)})):e.axisFromAtr&&W(e.axisFromAtr,e.thumbRatio,e.visualDiff,e):W(e.axisFromAtr?e.axisFromAtr:r,e.thumbRatio,e.visualDiff,e);var t={x:e.event.clientX,y:e.event.clientY};N&&(N.x.value=t.x,N.y.value=t.y)}(c(c({},e),{event:r,wrapElWH:t,visualDiff:n,thumbRatio:o,sliderElSize:l}))}(r)}),{signal:u});var f=function(r){e.isDraggingRef.current=!1,function(e){null==A||A.abort();var r=e.scrollElement;if(r){if(Y(e.clickedObject.current,e.target,r,"end"),"slider"===e.type&&"thumb"!==e.clickedObject.current){var t=O,n=function(t,n){var o="x"===t,i=o?e.maxScrollSize[0]:e.maxScrollSize[1],l=r[o?"scrollLeft":"scrollTop"],c=o?e.gap[0]:e.gap[1],a=r[o?"clientWidth":"clientHeight"]+c,u=(Math[n?n>0?"floor":"ceil":"round"](l/a)+(null!=n?n:0))*a;u>i||0>u||e.smoothScroll(u,t,e.duration)},o=function(e,r){Math.abs(r)>20?n(e,r>0?1:-1):n(e)};0===t.x&&0===t.y?"hybrid"===e.direction?["x","y"].forEach((function(e){return o(e,t[e])})):o(e.direction,t[e.direction]):Object.entries(t).forEach((function(e){var r=s(e,2),t=r[0],n=r[1];0!==n&&o(t,n)}))}if(e.isTouched&&"scroll"===e.type&&"slider"!==e.clickedObject.current){var i=function(t){var n=I[t]*e.thumbRatio,o="x"===t?I.distX:I.distY;80>performance.now()-I.t&&Math.abs(n)>.05&&o>12&&function(e){var r=e.el,t=e.axis,n=e.velocity,o=e.rafSchedule,i=Math.sign(n),l=Math.abs(n);.2>(l=Math.pow(l,.92))&&(l=.2),n=l*i;var c="y"===t?"scrollTop":"scrollLeft",a="y"===t?r.scrollHeight-r.clientHeight:r.scrollWidth-r.clientWidth,u=performance.now(),s=function(){var e=performance.now(),t=e-u;if(u=e,Math.abs(n*=Math.exp(-.0025*t))>=.02){var i=r[c]+n*t;(0>i||i>a)&&(n*=.4,i=x(i,0,a)),r[c]=i,o("step",s)}};o("step",s)}({el:r,axis:t,velocity:"thumb"===e.clickedObject.current?n:-n,rafSchedule:e.rafScrollAnim.schedule})};"hybrid"===e.direction?"wrapp"===e.clickedObject.current?["x","y"].forEach((function(e){return i(e)})):i(e.axisFromAtr):i(e.axisFromAtr?e.axisFromAtr:e.direction)}N=null,0!==e.overscrollRef.current.x&&C(e.overscrollRef,"x",e.triggerUpdate),0!==e.overscrollRef.current.y&&C(e.overscrollRef,"y",e.triggerUpdate),e.clickedObject.current=null,I={x:0,y:0,t:0,distX:0,distY:0},F={x:0,y:0},O={x:0,y:0},e.triggerUpdate()}}(c(c({},e),{event:r,thumbRatio:o}))};document.addEventListener("pointerup",f,{signal:u}),document.addEventListener("pointercancel",f,{signal:u})}}function B(e,r){return e>r?Math.floor(e/r):1}function P(e){return a(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth?[3,2]:[4,new Promise((function(e){return requestAnimationFrame(e)}))];case 1:return r.sent(),[3,0];case 2:return[2]}}))}))}var D=new WeakMap,V=function(e){return e?"start"===e?"flex-start":"center"===e?"center":"flex-end":void 0};function U(e,r,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),function(o){var i,l,c,a,u=!1,s={width:(null!==(i=o.width)&&void 0!==i?i:0)-t,height:(null!==(l=o.height)&&void 0!==l?l:0)-n},f=0===s.width&&0===s.height;f&&!u&&(u=!0),(null===(c=e.current)||void 0===c?void 0:c.width)===s.width&&(null===(a=e.current)||void 0===a?void 0:a.height)===s.height||f&&u||(e.current=s,r())}}var q=function(){var e,r;return"undefined"!=typeof window&&null!==(r=null===(e=window.matchMedia)||void 0===e?void 0:e.call(window,"(pointer: coarse)").matches)&&void 0!==r&&r};function K(e,r,t){return r?x(Math.round(e/r*e),t,e):0}function G(e,r,t,n){return r?x(e/r*(t-n),0,t-n):0}function _(){var e=null,r=new Map;return{schedule:function(t,n){r.set(t,n),null===e&&(e=requestAnimationFrame((function(){e=null;var t=Array.from(r.values());r.clear(),t.forEach((function(e){return e()}))})))},cancel:function(){null!==e&&(cancelAnimationFrame(e),e=null,r.clear())}}}var $,Z=function(e){if(null==e)return[];if(t.isValidElement(e)){var r=e;return r.type===t.Fragment?t.Children.toArray(r.props.children).flatMap(Z):[r]}return[e]},J=function(e){var r=e.lastIndexOf(":$");return-1!==r?e.slice(r+2).replace(/=0/g,"=").replace(/=2/g,":"):e.startsWith(".$")?e.slice(2).replace(/=0/g,"=").replace(/=2/g,":"):e},Q=40,ee="ms-under-drag",re=null,te=!1,ne={x:0,y:0},oe={x:0,y:0},ie=!1,le=null,ce="",ae=null,ue=null,se=null,fe=_(),de=function(){ue&&ue.removeAttribute(ee),le=null,ue=null,ae=null,ce="",se=null};function ve(e,r,t,n,o,i){var l=e-r,c=t-e;return Q>l&&n>0?{dir:-1,distance:l}:Q>c&&i>n+o?{dir:1,distance:c}:null}function he(e){var r=x((Q-Math.abs(e))/Q,0,1,!1);return r*r*20|0}function me(){if(le){var e=le.parent,r=le.element,t=le.direction,n=r.getBoundingClientRect(),o=oe.x,i=oe.y;if(o<n.left-Q||o>n.right+Q||i<n.top-Q||i>n.bottom+Q)de();else{var l=null,c=null,a=0,u=0,s="x"!==t?ve(i,n.top,n.bottom,r.scrollTop,r.clientHeight,r.scrollHeight):null;s&&(l=-1===s.dir?"top":"bottom",u=he(s.distance)*s.dir);var f="y"!==t?ve(o,n.left,n.right,r.scrollLeft,r.clientWidth,r.scrollWidth):null;f&&(c=-1===f.dir?"left":"right",a=he(f.distance)*f.dir),(ce=[l,c].filter(Boolean).join(" "))!==se&&(e.setAttribute(ee,ce),se=ce),(a||u)&&r.scrollBy(a,u),fe.schedule("autoScrollLoop",me)}}}function pe(e){e instanceof DragEvent&&0===e.buttons?ye():oe.x===e.clientX&&oe.y===e.clientY||(oe.x=e.clientX,oe.y=e.clientY,fe.schedule("onMove",(function(){if(!ie){var e=oe.x-ne.x,r=oe.y-ne.y;if(10>Math.hypot(e,r))return;ie=!0}var t=document.elementFromPoint(oe.x,oe.y);if(t){var n=t.closest("[morph-scroll]");if(n||le){var o=n?be.get(n):le;o&&(le=o,ae!==o.element&&(ue&&ue!==o.parent&&ue.removeAttribute(ee),ae=o.element,(ue=o.parent).setAttribute(ee,ce),se=ce,me()))}else de()}})))}function ye(){null==re||re.abort(),re=null,ie=!1,fe.cancel(),de()}function ge(e){var r=e instanceof PointerEvent;if(!r||e.target.closest("[ms-custom-drag]")){ne.x=e.clientX,ne.y=e.clientY,null==re||re.abort();var t=new AbortController;re=t;var n=t.signal;r?(document.addEventListener("pointermove",pe,{signal:n}),document.addEventListener("pointerup",ye,{signal:n})):(document.addEventListener("dragover",pe,{signal:n}),document.addEventListener("dragend",ye,{signal:n}),document.addEventListener("drop",ye,{signal:n}),document.addEventListener("pointerdown",ye,{signal:n}),window.addEventListener("blur",ye,{signal:n}))}}var be=new Map;var xe=function(l){var v,m,E,k,A,T,C,F,O=l.className,I=l.children,N=l.type,Y=void 0===N?"scroll":N,H=l.direction,W=void 0===H?"y":H,Q=l.scrollPosition,ee=l.onScrollValue,ne=l.isScrolling,oe=l.onRenderedKeysChange,ie=l.size,le=l.objectsSize,ce=l.crossCount,ae=l.gap,ue=l.wrapperMargin,se=l.wrapperMinSize,fe=l.wrapperAlign,de=l.elementsAlign,ve=l.elementsDirection,he=void 0===ve?"row":ve,me=l.edgeGradient,pe=l.progressTrigger,ye=void 0===pe?{wheel:!0}:pe,xe=l.progressReverse,we=void 0!==xe&&xe,Se=l.scrollBarOnHover,Me=void 0!==Se&&Se,Ee=l.scrollBarEdge,Le=l.thumbMinSize,ke=l.render,Ae=l.emptyElements,Re=l.suspending,ze=void 0!==Re&&Re,je=l.fallback,Te=l.dragScroll,Ce=(C=s(o({}),2)[1],i((function(){C({})}),[])),Fe=(null===(F=n(null)).current&&(F.current="".concat(b++)),F.current),Oe=_(),Ie=function(){return Oe.schedule("triggerUpdate",Ce)},Ne=_();if(!ie)throw Error('prop "size" is not provided'.concat("\n morph-scroll ".concat(Fe)));Object.keys(ye).length,"none"===le||Array.isArray(le)&&("none"===le[0]||le[1]);var Ye=t.useRef(null),He=t.useRef(null),We=t.useRef(null),Xe=t.useRef(null),Be=t.useRef(new Set),Pe=t.useRef(q()),De=t.useRef(!0),Ve=t.useRef(null),Ue=t.useRef({loaded:new Set,empty:new Set}),qe=t.useRef({targetScrollY:0,targetScrollX:0,animating:!1,animationFrameId:0}),Ke=t.useRef(!1),Ge=t.useRef(!1),_e=t.useRef(function(e){void 0===e&&(e=2);var r=0,t=0,n=null,o=null;return{update:function(i,l){var c=i-r,a=l-t;Math.abs(c)>e&&(n=c>0?"right":"left",r=i),Math.abs(a)>e&&(o=a>0?"down":"up",t=l)},reset:function(){n=null,o=null},get:function(){return{x:n,y:o}}}}()),$e=t.useRef({x:null,y:null}),Ze=t.useRef({x:0,y:0}),Je=t.useRef(!1),Qe=t.useRef(null),er=t.useRef(oe);function rr(){return t.useRef({width:0,height:0})}var tr=rr(),nr=rr(),or=rr(),ir=s(function(){for(var e=[],r=0;arguments.length>r;r++)e[r]=arguments[r];var n=new WeakMap,o=function(e){if(null===e)return 1;if("boolean"==typeof e)return e?2:3;if("number"==typeof e||"bigint"==typeof e)return 0|+e;if("string"==typeof e){for(var r=0,i=0;i<e.length;i++)r=31*r+e.charCodeAt(i)>>>0;return r}if(void 0===e)return 4;if("function"==typeof e)return 5;if(t.isValidElement(e))return 6;if(Array.isArray(e)){for(r=0,i=0;i<e.length;i++)r=31*r+o(e[i])>>>0;return r}if(e instanceof Set)return Array.from(e).map(o).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if(e instanceof Map)return Array.from(e.entries()).map((function(e){var r=s(e,2),t=r[0],n=r[1];return 31*o(t)+o(n)>>>0})).sort((function(e,r){return e-r})).reduce((function(e,r){return 31*e+r>>>0}),0);if("object"==typeof e&&null!==e){if(n.has(e))return n.get(e);var l=Object.entries(e).sort((function(e,r){var t=s(e,1)[0],n=s(r,1)[0];return t.localeCompare(n)})).map((function(e){var r=s(e,2)[1];return o(r)})).reduce((function(e,r){return 31*e+r>>>0}),0);return n.set(e,l),l}return 7};return e.map(o)}(Q,ke,ie,le,Ae,se,fe,ae,ye,Ue.current.empty,Ee),11),lr=ir[0],cr=ir[1],ar=ir[2],ur=ir[3],sr=ir[4],fr=ir[5],dr=ir[6],vr=ir[7],hr=ir[8],mr=ir[9],pr=ir[10],yr=t.useMemo((function(){var e,r,t=[null],n=200,o=null;if(null!=Q)if("number"==typeof Q||"end"===Q)t=[Q,Q];else if(Array.isArray(Q))t=Q;else if("object"==typeof Q){var i=Q.value;"number"==typeof i||"end"===i?t=[i,i]:Array.isArray(i)&&(t=i),n=null!==(e=Q.duration)&&void 0!==e?e:200,o=null!==(r=Q.updater)&&void 0!==r?r:null}return{value:t,duration:n,updater:o}}),[lr]),gr={color:null,size:40},br=t.useMemo((function(){return"object"==typeof me?c(c({},gr),me):"string"==typeof me?{color:me,size:40}:gr}),[me]),xr=t.useMemo((function(){var e=ye.arrows,r={size:40,contentReduce:!0,loop:!1};return t.isValidElement(e)?c(c({},r),{element:e}):"object"==typeof e&&null!==e?c(c({},r),e):r}),[hr]),wr=t.useMemo((function(){return t.Children.toArray(I).flatMap(Z)}),[I]),Sr=t.useMemo((function(){return wr.map((function(e){return t.isValidElement(e)&&e.key?e.key+"":null})).filter((function(e){return null!==e})).filter((function(e){var r;return!("clear"===Ae||Ae&&"object"==typeof Ae&&"mode"in Ae&&"clear"===Ae.mode)||!(null===(r=Ue.current.empty)||void 0===r?void 0:r.has(e))}))}),[I,sr,mr]),Mr=s(ue?d(ue):[0,0,0,0],4),Er=Mr[0],Lr=Mr[1],kr=Mr[2],Ar=Mr[3],Rr=Er+kr,zr=Ar+Lr,jr=t.useMemo((function(){var e,r;return"number"==typeof ae?[ae,ae]:Array.isArray(ae)?[null!==(e=ae[1])&&void 0!==e?e:0,null!==(r=ae[0])&&void 0!==r?r:0]:[0,0]}),[ae]),Tr=t.useMemo((function(){var e={type:void 0,rootMargin:0,stopLoadOnScroll:!1,trackVisibility:!1};if("string"==typeof ke)return c(c({},e),{type:ke});if("object"==typeof ke&&null!==ke){var r=ke.type,t=ke.rootMargin,n=void 0===t?e.rootMargin:t,o=ke.stopLoadOnScroll,i=void 0===o?e.stopLoadOnScroll:o,l=ke.trackVisibility;return{type:r,rootMargin:n,stopLoadOnScroll:i,trackVisibility:void 0===l?e.trackVisibility:l}}return e}),[cr]),Cr=t.useMemo((function(){return d(Tr.rootMargin)}),[Tr.rootMargin,W]),Fr=t.useMemo((function(){var e=s(Array.isArray(ie)?ie:"number"==typeof ie?[ie,ie]:[tr.current.width,tr.current.height],2),r=e[0],t=e[1];if(!ye.arrows||!xr.size||!xr.contentReduce)return[r,t,r,t];var n=2*xr.size,o=r,i=t;return"x"===W?o=r-n:"y"===W?i=t-n:"hybrid"===W&&(o=r-n,i=t-n),[o,i,r,t]}),[ar,hr,W,xr,tr.current.height,tr.current.width]),Or="x"===W?Fr[0]:Fr[1],Ir=t.useMemo((function(){if(!Ee)return[0,0];if("number"==typeof Ee){var e=2*Ee;return[e,e]}if(Array.isArray(Ee)){var r=s(Ee,2),t=r[0],n=void 0===t?0:t,o=r[1];return[2*n,2*(null!=o?o:n)]}return[0,0]}),[pr]),Nr=t.useMemo((function(){return[Fr[0]-Ir[0],Fr[1]-Ir[1]]}),[Ir.join(),Fr[0],Fr[1]]),Yr=t.useMemo((function(){return le?Array.isArray(le)?le:d(le,!0,2):[null,null]}),[ur]),Hr=t.useMemo((function(){var e=or.current,r=e.height,t=e.width,n=function(e,r,t){return r||("number"==typeof e?e:"size"===e?t:0)};return[n(Yr[0],t,Fr[0]),n(Yr[1],r,Fr[1])]}),[Yr.join(),W,or.current.width,or.current.height,Fr.join()]),Wr=t.useMemo((function(){return ke&&Ae&&!je?e("div",{className:"ms-empty-element"}):je}),[!!je,cr,sr]),Xr=t.useMemo((function(){if("none"===Yr[0]||"none"===Yr[1])return[1,Sr.length];var e="x"===W?1:0,r="row"===he,t=Fr[e],n=Hr[e]?Hr[e]+jr[e]:0,o="hybrid"===W&&t?n*Sr.length:t,i=n?Math.floor(o/n):1,l=ce&&i>=ce?"hybrid"===W?Math.ceil(i/ce):ce:i,c=l>1&&l<Sr.length?Math.ceil(Sr.length/l):l<Sr.length?Sr.length:1;r||(l=Math.ceil(Sr.length/c));var a=ce&&ce<Sr.length,u=function(e){return Number.isFinite(e)&&e>0?e:1};if("hybrid"===W){var s=a?r?ce:l:r?Sr.length:1,f=a?r?l:ce:r?1:Sr.length;return[u(s),u(f)]}return[u(l),u(c)]}),[he,jr[0],jr[1],Hr[0],Hr[1],Sr.length,W,Fr.join(),ce]),Br=t.useMemo((function(){var e=1>Xr[0]?1:Xr[0]*jr[1]-jr[1],r=Xr["x"===W?1:0],t=Sr.length<r?Sr.length:r;return Hr[0]?(Hr[0]+jr[1])*t-jr[1]:Tr.type?or.current.width+e:nr.current.width}),[W,Hr[0],Xr[0],Xr[1],jr[1],nr.current.width,or.current.width,Tr.type,Sr.length]),Pr=t.useMemo((function(){var e=1>Xr[1]?1:Xr[0]*jr[0]-jr[0];return Hr[1]?"x"===W?(Hr[1]+jr[0])*Xr[0]-jr[0]:(Hr[1]+jr[0])*Xr[1]-jr[0]:Tr.type?or.current.height+e:nr.current.height}),[W,Hr[1],Xr[0],Xr[1],jr[0],nr.current.height,or.current.height,Tr.type]),Dr=t.useMemo((function(){return Pr+Rr}),[Pr,Rr]),Vr=t.useMemo((function(){return Br+zr}),[Br,zr]),Ur="x"===W?Vr:Dr,qr=t.useMemo((function(){return[Math.max(0,Vr-Fr[0]),Math.max(0,Dr-Fr[1])]}),[Fr.join(),Dr,Vr]),Kr="x"===W?(null===(v=We.current)||void 0===v?void 0:v.scrollLeft)||0:(null===(m=We.current)||void 0===m?void 0:m.scrollTop)||0,Gr=Kr>1&&!0,_r=Ur>Math.round(Kr+Or),$r=!1,Zr=!1;"hybrid"===W&&($r=((null===(E=We.current)||void 0===E?void 0:E.scrollLeft)||0)>1&&!0,Zr=Math.round(((null===(k=We.current)||void 0===k?void 0:k.scrollLeft)||0)+Fr[0])<Vr);var Jr=t.useMemo((function(){return null!=Le?Le:30}),[Le]),Qr=t.useCallback((function(e){return ye.progressElement&&Ur?"x"===e?K(Fr[0]-Ir[0],Vr,Jr):K(Fr[1]-Ir[1],Dr,Jr):0}),[hr,Ur,Fr[0],Fr[1],Vr,Jr,Ir.join()]),et=t.useMemo((function(){return{x:"y"!==W?Qr("x"):0,y:"x"!==W?Qr("y"):0}}),[Qr,W]),rt=t.useMemo((function(){return{w:Fr[0]?Vr-Fr[0]:Vr,h:Fr[1]?Dr-Fr[1]:Dr}}),[Vr,Dr,Fr[0],Fr[1]]),tt={x:"y"!==W?G((null===(A=We.current)||void 0===A?void 0:A.scrollLeft)||0,rt.w,Nr[0],et.x):0,y:"x"!==W?G((null===(T=We.current)||void 0===T?void 0:T.scrollTop)||0,rt.h,Nr[1],et.y):0},nt=t.useMemo((function(){if(!Tr.type)return[{top:0,bottom:0,left:0,right:0}];for(var e=0,r="x"===W,t="row"===he,n=r&&!t||!r&&t,o=Hr[0]+jr[1],i=Hr[1]+jr[0],l=new Set,c=n?Xr[0]:Xr[1],a=Hr[t?0:1],u=jr[t?1:0],s=Math.floor((Sr.length-1)/c)*c;s<Sr.length;s++)l.add(s);var f=c-l.size,d=f>0?(a+u)*f:0;return"center"===de?e=Math.round(d/2):"end"===de&&(e=d),Sr.map((function(r,c){var a,u,s=n?c%Xr[0]:Math.floor(c/Xr[1]),f=n?Math.floor(c/Xr[0]):c%Xr[1];"x"===W?(a=f,u=s):(a=s,u=f);var d=l.size>0&&l.has(c),v=(d&&!t?e:0)+i*u,h=(d&&t?e:0)+o*a;return{top:v,left:h,bottom:v+Hr[1],right:h+Hr[0]}}))}),[Hr[0],Hr[1],jr[0],jr[1],de,Sr.length,Xr[0],Xr[1],Tr.type,he,W]),ot=t.useMemo((function(){return(null==Fr?void 0:Fr.length)&&fe?function(e,r,t,n){var o=s("string"==typeof e?[e,e]:e,2),i=o[0],l=o[1],c=void 0===l?"start":l,a={display:"flex"};return r[0]>t&&(a.justifyContent=V(i)),r[1]>n&&(a.alignItems=V(c)),a}(fe,Fr,Vr,Dr):{}}),[fe,Fr.join(),Dr,Vr]),it=t.useMemo((function(){return[B(Vr,Fr[0]),B(Dr,Fr[1])]}),[Vr,Dr,Fr.join()]),lt=t.useMemo((function(){return"x"===W?it[0]:it[1]}),[W,it[0],it[1]]),ct=t.useCallback(U(tr,Ie),[]),at=t.useCallback(U(nr,Ie,zr,Rr),[zr,Rr]),ut=t.useCallback(U(or,Ie),[]),st=t.useCallback((function(e,r,t){var n=We.current;return n&&null!==e?function(e,r,t,n,o,i){return a(this,void 0,void 0,(function(){var l,c,a,s,f;return u(this,(function(u){switch(u.label){case 0:return c=(l="y"===e)?"scrollTop":"scrollLeft",a=l?i[1]:i[0],s=x(n,0,a),(f=x(r[c],0,a))===s?[2]:null!==t?[3,2]:[4,P(r)];case 1:return u.sent(),r[c]=n,[2];case 2:return y((function(){var e=performance.now(),n=function(){var i=performance.now(),l=Math.min((i-e)/t,1),u=x(f+(s-f)*l,0,a);r[c]=u,1>l&&u!==s&&o("smoothScroll",n)};o("smoothScroll",n)}),t,"smoothScrollBlock".concat(e)),[2]}}))}))}(r,n,De.current?null:t,e,Ne.schedule,qr):null}),[qr.join()]),ft=t.useMemo((function(){var e=c(c(c({margin:ue?"".concat(Er,"px ").concat(Lr,"px ").concat(kr,"px ").concat(Ar,"px"):"",height:Yr[1]&&"none"!==Yr[1]?"".concat(Pr,"px"):"fit-content",width:Yr[0]&&"none"!==Yr[0]?"".concat(Br,"px"):"fit-content"},ae&&!Tr.type&&{gap:"".concat(jr[0],"px ").concat(jr[1],"px")}),se&&function(e,r,t,n,o){var i,l,c,a=function(e,r){return"full"===e?("x"===r?t[0]:t[1])-("x"===r?n:o):e};if("hybrid"!==r&&!Array.isArray(e)){var u="".concat(a(e,r),"px");return"x"===r?{minWidth:u}:{minHeight:u}}return Array.isArray(e)?(l=(i=s(e,2))[0],c=i[1]):l=c=e,{minWidth:"".concat(a(l,"x"),"px"),minHeight:"".concat(a(c,"y"),"px")}}(se,W,Fr,zr,Rr)),("hybrid"===W||"x"===W)&&{flexShrink:0});if(Tr.type)return c(c({},e),{position:"relative"});var r=1===Xr[0]?"y"===W?"column":"row":he,t=Yr[0]&&"none"!==Yr[0]&&Yr[1]&&"none"!==Yr[1]?"wrap":void 0;return c(c({},e),{display:"flex",flexDirection:r,flexWrap:t,justifyContent:V(de)})}),[ue,dr,fr,[Er,Lr,kr,Ar,zr,Rr,jr[0],jr[1]].join(),Fr.join(),vr,Yr[1],Pr,Br,vr,Tr.type,W,Xr[0],he,de]),dt=t.useCallback((function(e,r,t){var n;Pe.current=q();var o=r.target;if(!o.closest('\n [ms-custom-drag], [draggable="true"], [contenteditable],\n input, textarea, select, button, a\n ')){var i=null;t&&(i=null===(n=o.closest("scroll"===Y?".ms-bar":".ms-slider"))||void 0===n?void 0:n.getAttribute("data-direction")),Ve.current=e,X({scrollElement:We.current,target:o,clickedObject:Ve,scrollStateRef:qe.current,type:Y,triggerUpdate:Ie,direction:W,smoothScroll:st,sizeLocal:[Fr[0],Fr[1]],thumbSize:"x"===i?et.x:et.y,axisFromAtr:i,duration:yr.duration,scrollBarEdge:Ir,rafScrollAnim:Ne,isTouched:Pe.current,gap:jr,overscrollRef:Ze,objLengthPerSize:it,isDraggingRef:Je,maxScrollSize:qr})}}),[W,Y,Fr.join(),yr.duration,st,Ir.join(),et.x,et.y,jr.join(),it,qr.join()]),vt=t.useCallback((function(e){dt("thumb",e,!0)}),[dt]),ht=t.useCallback((function(e){We.current&&function(e){var r=e.arrowType,t=e.scrollElement,n=e.wrapSize,o=e.scrollSize,i=e.smoothScroll,l=e.duration,c=e.loop,a=e.gap,u=n[0],s=n[1],f=t.scrollTop,d=t.scrollLeft,v=function(e,r,n){var o=n?function(e,r){return"x"===e?r>0?0:u:r>0?0:s}(e,r):function(e,r){var n="x"===e,o=n?d:f,i=n?a[0]:a[1],l=t[n?"clientWidth":"clientHeight"]+i;return l*(Math.floor(Math.max(0,o)/l)+r)}(e,r);i(o,e,l)};switch(r){case"top":f>0?v("y",-1):c&&v("y",-1,!0);break;case"left":d>0?v("x",-1):c&&v("x",-1,!0);break;case"right":d+o[0]<u?v("x",1):c&&v("x",1,!0);break;case"bottom":f+o[1]<s?v("y",1):c&&v("y",1,!0)}}({arrowType:e,scrollElement:We.current,wrapSize:[Vr,Dr],scrollSize:Fr,smoothScroll:st,duration:yr.duration,loop:xr.loop,gap:jr})}),[Fr.join(),Vr,Dr,yr.duration,st,xr.loop,jr[0],jr[1]]),mt=t.useCallback((function(){"scroll"!==Y&&Fr[0]&&Fr[1]&&He.current&&We.current&&Be.current.size&&function(e,r,t,n){f([],s(r),!1).forEach((function(r,o){var i,l,c=D.get(r),a=0===o?t:"x",u="x"===a?0:1;if(c&&c.elements.length===n[u]||(c={elements:Array.from(r.querySelectorAll(".ms-slider-element")),lastIndex:-1},D.set(r,c)),c.elements.length){var s="x"===a?e.scrollLeft:e.scrollTop,f="x"===a?e.clientWidth:e.clientHeight,d=Math.floor((s+f/2)/f);d!==c.lastIndex&&(-1!==c.lastIndex&&(null===(i=c.elements[c.lastIndex])||void 0===i||i.classList.remove("active")),null===(l=c.elements[d])||void 0===l||l.classList.add("active"),c.lastIndex=d)}}))}(We.current,Be.current,W,it)}),[Fr.join(),W,Y,it.join()]),pt=t.useCallback((function(e){if(e){var r=(o=Xe.current)?Array.from(o.children).flatMap((function(e){if(!(e instanceof HTMLElement))return[];var r=e.getAttribute(w);return r?[J(r)]:[]})):[];Qe.current&&(t=Qe.current,n=r,t.length===n.length&&t.every((function(e,r){return e===n[r]})))||(Qe.current=r,e(r))}var t,n,o}),[]),yt=t.useCallback((function(){Xe.current&&function(e,r,t,n){for(var o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:function(e){return e instanceof Element&&e.hasAttribute(w)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=o.nextNode();i;){var l=i,c=l.getAttribute(w);if(c){var a=0===l.children.length;a&&(r.current.empty||(r.current.empty=new Set),r.current.empty.add(c)),"virtual"===n&&a||r.current.loaded.add(c)}i=o.nextNode()}t()}(Xe.current,Ue,Ie,Tr.type)}),[cr]),gt=t.useCallback((function(e){"object"==typeof Ae&&"clickTrigger"in Ae&&void 0!==Ae.clickTrigger&&function(e,r,t){var n="string"==typeof r?{selector:r}:r,o=n.selector,i=n.delay,l=void 0===i?0:i,c=e.target;if(c.closest(o)){var a=c.closest("[wrap-id]");null==a||a.classList.add("remove"),g((function(){null==a||a.classList.remove("remove"),t()}),l)}}(e,Ae.clickTrigger,yt)}),[sr,yt]),bt=t.useCallback((function(e){p("removeHover");var r=He.current,t=Ye.current,n=We.current;if(r&&t&&n){if(yr.value.includes("end")){var o=e.currentTarget,i=o.scrollLeft,l=o.scrollTop;_e.current.update(i,l)}null==ee||ee(n.scrollLeft,n.scrollTop);var c=r.querySelectorAll("scroll"===Y?".ms-bar":".ms-slider");Me&&c.length>0&&!Ke.current&&c.forEach((function(e){e.classList.contains("hover")||j(e)})),Ke.current=!0,null==ne||ne(!0),g((function(){_e.current.reset(),Ke.current=!1,null==ne||ne(!1),Tr.type&&yt(),Me&&c.length>0&&!Ve.current&&c.forEach((function(e){g((function(){e.hasAttribute("ms-manual-hover")||z(e)}),1e3,"removeHover")}))}),200,"isScrolling"),g((function(){return pt(er.current)}),"raf","onRenderedKeysChange"),Oe.schedule("sliderCheckLocal",(function(){"scroll"!==Y&&mt(),Ce()}))}}),[ee,ne,Y,mt,yt,Me,Tr.type]),xt=t.useCallback((function(e){if(!Ge.current){var r="object"==typeof ye.wheel&&"string"==typeof ye.wheel.changeDirectionKey?ye.wheel.changeDirectionKey:"KeyX";e.code!==r||"hybrid"!==W||Ge.current||(e.stopPropagation(),Ge.current=!0,Ie())}}),[W,hr]),wt=t.useCallback((function(e){Ge.current&&(e.stopPropagation(),Ge.current=!1,Ie())}),[]);t.useEffect((function(){if(!oe)return er.current=void 0,void(Qe.current=null);er.current=oe,Qe.current=null,pt(oe)}),[oe,pt]),t.useEffect((function(){er.current&&Fr[0]&&Fr[1]&&pt(er.current)}),[Sr.join("|"),Fr.join()]),t.useEffect((function(){if(!Pe.current&&"hybrid"===W){var e=Xe.current,r=We.current;if(e&&r)return e.clientWidth+zr>r.clientWidth&&e.clientHeight+Rr>r.clientHeight&&(r.addEventListener("keydown",xt),r.addEventListener("keyup",wt)),function(){r.removeEventListener("keydown",xt),r.removeEventListener("keyup",wt)}}}),[W,hr,ar,ur,Sr.join(),zr,Rr]),t.useEffect((function(){Ae&&Tr.type&&yt()}),[sr,Tr.type,yt,Sr.length]),t.useEffect((function(){if(!Pe.current){var e=We.current,r=Xe.current;if(e&&r){var t="hybrid"===W&&"object"==typeof ye.wheel&&ye.wheel.changeDirection?"x":W,n="hybrid"===W&&Pr+Rr<=Fr[1]||Ge.current?["hybrid","y"].includes(t)?"x":"y":t,o=function(r){r.preventDefault(),S(r,e,qr,qe.current,n)};return ye.wheel&&e.addEventListener("wheel",o,{passive:!1}),function(){e.removeEventListener("wheel",o)}}}}),[W,hr,Pr,Fr[1],Rr,Ge.current,qr.join()]),t.useEffect((function(){Oe.schedule("smoothScrollLocal",(function(){("hybrid"===W?["x","y"]:[W]).forEach((function(e){var r=yr.value["x"===e?0:1];if("end"===r){if(_e.current.get()[e]===("x"===e?"left":"up"))return;st("x"===e?rt.w:rt.h,e,yr.duration)}else"number"==typeof r&&$e.current[e]!==r&&($e.current[e]=r,st(r,e,yr.duration))}))}))}),[W,lr,rt.w,rt.h,yr.value.join()]),t.useEffect((function(){var e=qe.current.animationFrameId;return(Tr.type||ne)&&ne&&ne(!1),requestAnimationFrame((function(){return De.current=!1})),function(){e&&cancelAnimationFrame(e),qe.current.animationFrameId&&cancelAnimationFrame(qe.current.animationFrameId),Ne.cancel()}}),[]),t.useEffect((function(){if(Te){var e=Ye.current,r=We.current;if(e&&r){var t={parent:e,element:r,direction:W};return function(e){be.set(e.parent,e),1===be.size&&function(){if(!te){var e=($=new AbortController).signal;document.addEventListener("pointerdown",ge,{signal:e}),document.addEventListener("dragstart",ge,{signal:e}),te=!0}}()}(t),function(){!function(e){be.delete(e.parent),0===be.size&&te&&(null==$||$.abort(),null==re||re.abort(),te=!1)}(t)}}}}),[Te,W]),t.useEffect((function(){var e=We.current;if(e){var r=function(e){dt("wrapp",e)};if(ye.content||!ye.content&&Pe.current&&ye.wheel){if(!0===ye.progressElement)return;e.addEventListener("pointerdown",r)}return function(){e.removeEventListener("pointerdown",r)}}}),[hr,dt]),t.useEffect((function(){var e=He.current;if(e&&Me&&Be.current.size){var r=function(e){"mouseenter"===e.type&&document.removeEventListener("mouseup",r),"mouseleave"===e.type&&Ve.current?document.addEventListener("mouseup",r):Array.from(Be.current).forEach((function(r){!function(e){var r=e.el,t=e.event,n=e.isScrolling,o=function(e){if(["mouseleave","mouseup","pointerup","pointercancel"].includes(t.type)){if(e.removeAttribute("ms-manual-hover"),null==n?void 0:n.current)return;z(e)}else e.setAttribute("ms-manual-hover",""),j(e)};Array.isArray(r)?r.map((function(e){return o(e)})):o(r)}({el:r,event:e,isScrolling:Ke})}))},t=function(r,t){Pe.current?(Array.from(Be.current).forEach((function(e){return e[r]("pointerdown",t)})),document[r]("pointerup",t),document[r]("pointercancel",t)):(e[r]("mouseenter",t),e[r]("mouseleave",t))};return t("addEventListener",r),function(){t("removeEventListener",r)}}}),[Me,Y,W,Be.current.size]),t.useEffect((function(){"scroll"!==Y&&Oe.schedule("sliderCheckLocal",mt)}),[Y,mt,Fr.join()]);var St,Mt=t.useCallback((function(r,n,o,i,l){var a,u=c(c({width:Hr[0]?"".concat(Hr[0],"px"):void 0,height:Hr[1]?"".concat(Hr[1],"px"):void 0},Tr.type&&{position:"absolute",transform:"translate(".concat(o,"px, ").concat(n,"px)")}),"number"==typeof l&&{"--content-visibility":l}),s=ze?e(t.Suspense,{fallback:Wr,children:i}):i;return e("div",c({},Tr.type||Ae?((a={})[w]="".concat(r),a):{},{className:"ms-object-box",style:u,onClick:Ae?gt:void 0,children:s}),r)}),[ze,!!Wr,Hr[0],Hr[1],cr,sr,Xr[0],gt,Tr.type]),Et=t.useMemo((function(){var e=new Map;return wr.forEach((function(r){t.isValidElement(r)&&null!=r.key&&e.set(r.key+"",r)})),e}),[wr]),Lt=t.useMemo((function(){return f([{positionType:"x"===W?"left":"top",visibility:Gr},{positionType:"x"===W?"right":"bottom",visibility:_r}],s("hybrid"===W?[{positionType:"left",visibility:$r},{positionType:"right",visibility:Zr}]:[]),!1)}),[Gr,_r,W,$r,Zr]),kt=t.useMemo((function(){return{width:"".concat(Fr[2],"px"),height:"".concat(Fr[3],"px")}}),[Fr]),At=t.useMemo((function(){var e;return null!==(e={x:Vr>Fr[0]?"scroll hidden":"hidden",y:Dr>Fr[1]?"hidden scroll":"hidden",hybrid:"".concat(Vr>Fr[0]?"scroll":"hidden"," ").concat(Dr>Fr[1]?"scroll":"hidden"),hide:"hidden"}[ye.wheel||ye.content&&"scroll"===Y?W:"hide"])&&void 0!==e?e:"hidden"}),[Vr,Dr,Fr,hr,W]),Rt=t.useMemo((function(){return me?Lt.map((function(r){var t=r.positionType,n=r.visibility;return e(L,{edgeGradient:br,visibility:n,edgeType:t,size:Fr},"edge-".concat(t))})):null}),[me,Lt,br,ar]),zt=t.useMemo((function(){return ye.arrows?Lt.map((function(r){var t=r.positionType,n=r.visibility;return e(R,{visibility:n,arrows:xr,arrowType:t,handleArrow:ht,size:Fr[0]},"arrow-".concat(t))})):null}),[hr,Lt,xr,ht,Fr[0]]),jt=function(){var r,n,o=(null===(r=We.current)||void 0===r?void 0:r.scrollLeft)||0,i=(null===(n=We.current)||void 0===n?void 0:n.scrollTop)||0;return e("div",{className:"ms-objects-wrapper",ref:Xe,style:c(c(c({},ft),(Ze.current.x||Ze.current.y)&&{transform:"translate(".concat(Ze.current.x,"px, ").concat(Ze.current.y,"px)")}),Je.current&&{pointerEvents:"none"}),children:Sr.map((function(r,n){return function(r,n,o,i){var l,c=Et.get(r),a=Tr.stopLoadOnScroll&&Ke.current&&!Ue.current.loaded.has(r)?Wr:(null===(l=Ue.current.empty)||void 0===l?void 0:l.has(r))?Ae&&"object"==typeof Ae&&t.isValidElement(Ae)?Ae:Ae&&"object"==typeof Ae&&"mode"in Ae&&"object"==typeof Ae.mode&&"fallback"in Ae.mode?Ae.mode.fallback:Wr:c,u="firstChild"!==Yr[0]&&"firstChild"!==Yr[1]||0!==n?a:e(h,{onResize:ut,children:a});if(!Tr.type)return Mt(r,0,0,u);var s=nt[n],f=s.top,d=s.bottom,v=s.left,m=s.right,p=function(e){void 0===e&&(e=!0);var r=e?Cr:[0,0,0,0],t=function(e){var t="x"===e?o:i,n=t+("x"===e?Fr[0]:Fr[1]),l="x"===e?v-r[3]:f-r[2],c="x"===e?m+r[1]:d+r[0],a=c-l;if(0>=a)return 0;var u=Math.min(c,n)-Math.max(l,t);return u>0?Math.round(10*Math.min(1,u/a))/10:0};if("hybrid"===W){var n=t("x"),l=t("y");return Math.min(n,l)}return t("x"===W?"x":"y")},y=p(),g=Tr.trackVisibility?p(!1):null;if("lazy"===Tr.type){var b=Ue.current.loaded.has(r);if(y&&!b){if(Ke.current&&Tr.stopLoadOnScroll)return;Ue.current.loaded.add(r)}return b?Mt(r,f,v,u,g):null}return y?Mt(r,f,v,u,g):(Ue.current.loaded.delete(r),null)}(r,n,o,i)}))})},Tt=t.useMemo((function(){var e={position:"relative",width:"".concat(Fr[0],"px"),height:"".concat(Fr[1],"px")};return ye.arrows&&xr.contentReduce&&xr.size&&("x"===W?e.left="".concat(xr.size,"px"):"y"===W?e.top="".concat(xr.size,"px"):(e.top="".concat(xr.size,"px"),e.left="".concat(xr.size,"px"))),e}),[Fr,hr,xr,W]),Ct=r("div",{"morph-scroll":"".concat(Fe),className:O,ref:Ye,style:kt,children:[r("div",{className:"ms-content",ref:He,style:c(c(c({},Tt),{transform:"translateZ(0)"}),Pe.current&&{touchAction:"pinch-zoom"}),children:[e("div",{className:"ms-element",ref:We,onScroll:bt,tabIndex:0,style:c(c(c({width:"100%",height:"100%",outline:"none"},ot),"boolean"!=typeof ye.progressElement||!1===ye.progressElement?{scrollbarWidth:"none",overflow:"hidden"}:{overflow:At}),ye.content&&{cursor:"grab"}),children:Hr[0]&&Hr[1]?jt():e(h,{onResize:at,style:ot,children:jt()})}),Rt,ye.progressElement&&!0!==ye.progressElement?(St="x"!==W,[{shouldRender:Ur>Fr[St?1:0],direction:W,thumbSize:St?et.y:et.x,thumbSpace:St?tt.y:tt.x,objLengthPerSize:lt,progressReverseIndex:0},{shouldRender:"hybrid"===W&&Vr>Fr[0],direction:"x",thumbSize:et.x,thumbSpace:tt.x,objLengthPerSize:it[0],progressReverseIndex:1}].filter((function(e){return e.shouldRender}))).map((function(r){var t="boolean"==typeof we?we:we[r.progressReverseIndex];return e(M,{type:Y,direction:r.direction,progressReverse:t,size:Nr,progressTrigger:[ye,hr],scrollBarOnHover:Me,scrollBarEvent:"sliderMenu"===Y?st:vt,thumbSize:r.thumbSize,thumbSpace:r.thumbSpace,objLengthPerSize:r.objLengthPerSize,sliderCheckLocal:mt,duration:yr.duration,isTouched:Pe.current,scrollStateRef:qe,scrollEl:We,scrollBarsRef:Be,triggerUpdate:Ie,overscroll:Ze,maxScrollSize:qr},r.direction)})):null]}),zt]});return"auto"===ie?e(h,{measure:"outer",onResize:ct,children:Ct}):Ct};xe.displayName="MorphScroll";var we={MorphScroll:xe,ResizeTracker:h,IntersectionTracker:v};export{v as IntersectionTracker,xe as MorphScroll,h as ResizeTracker,we as default};
|