-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2746.js
1 lines (1 loc) · 6.58 KB
/
2746.js
1
"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[2746],{42746:(e,t,n)=>{n.d(t,{FN:()=>B,TB:()=>x,Hv:()=>w,C_:()=>C});var l=n(30758),r=n(97500),o=n.n(r),s=n(81878),c=n(14259),i=n(49559);function a({isDisabled:e=!1,isMomentumScrollingSkipped:t=()=>!1}={isDisabled:!1,isMomentumScrollingSkipped:()=>!1}){const n=(0,l.useRef)(0),r=(0,i.J)(t),o=(0,l.useCallback)((({currentTarget:e,clientX:t,target:l})=>{if(!(e instanceof HTMLElement))return;const o=e.style.scrollBehavior;let s=!1;const c=e.scrollLeft,i=t;let a=0;e.style.userSelect="none",e.style.scrollBehavior="auto";const u=window.getComputedStyle(e).scrollSnapType;"none"!==u&&(e.style.scrollSnapType="none");const f=()=>{h(),e.style.scrollBehavior=o},d=()=>{e.scrollLeft+=a,a*=.95,Math.abs(a)>.5?n.current=requestAnimationFrame(d):(f(),e.style.scrollSnapType=u)};function h(){cancelAnimationFrame(n.current),document.removeEventListener("wheel",f)}h();const m=t=>{const n=t.clientX-i;Math.abs(n)>10&&(s=!0);const l=e.scrollLeft;e.scrollLeft=c-n,a=e.scrollLeft-l};document.addEventListener("mousemove",m),document.addEventListener("mouseup",(()=>{const t=e=>{e.preventDefault(),e.stopImmediatePropagation()};!0===s&&(e.addEventListener("click",t,{once:!0,capture:!0}),setTimeout((()=>{e.removeEventListener("click",t,{capture:!0})}))),e.style.removeProperty("user-select"),document.removeEventListener("mousemove",m);!r(l)?(h(),n.current=requestAnimationFrame(d),document.addEventListener("wheel",f,{once:!0})):e.style.scrollSnapType=u}),{once:!0})}),[r]),s=(0,l.useCallback)((()=>{}),[]);return e?s:o}var u=n(13867),f=n(70824),d=n(29844);const h="bMurPtRDRv5LuN78MTVG",m="KjPUGV8uMbl_0bvk9ePv",b="eRKQSDqbcx0NSAApALFA",v="xK5ehbekO6rilT0OXn_0",p="bdT2hWuSLE4HMyJ1ziC8",E="Yjx8QrpjqgjqQPj4KWCh",S="J4qD2RoZgGLbOdpfs63w",y="U8wi3gXSb248Imbxy4gc",T="a2NTH51fJWzWsds0OYv_",g="ijZQH9pePkbB2MbJHCJV",L="M0YO8cIVBxU1lnbzNPeP",N="e1CGifl7UjMqePPNhj5A",A="XTk61Y8OkBdUT6Wj4F6i",R="vzVooVFhdI7BIyM3fq0v",M="GwVDOOhNp0LMO_SFOqVp";var k=n(86070);let C=function(e){return e.NEVER="never",e.ALWAYS="always",e.ON_HOVER="on-hover",e}({}),w=function(e){return e.BY_RATIO="by-ratio",e.SNAP="snap",e}({}),x=function(e){return e.NONE="none",e.MASK="mask",e.LINEAR_GRADIENT="linear-gradient",e}({});var O=function(e){return e[e.START=-1]="START",e[e.END=1]="END",e}(O||{});function D(e,t,n){(0,f.MS)(e,t),function(e,t){const n=e.offsetLeft,l=e.offsetWidth,r=n+l,o=t.scrollLeft,s=t.offsetWidth;(o>0||(o+s)/2<=r)&&t.scroll({left:l/2+n-s/2})}(t,n)}function W(e,t){const n=e.querySelector('[tabindex="0"]')||e.firstElementChild;if(!(n&&n instanceof HTMLElement))return;const l=e.querySelectorAll("a[href], button, [role=button]");if(l&&l.length)if(t===O.END){if(document.activeElement===e||!n.nextElementSibling)return void D(n,l[0]??e,e);n.nextElementSibling instanceof HTMLElement&&D(n,n.nextElementSibling,e)}else if(t===O.START){if(document.activeElement===e||!n.previousElementSibling)return void D(n,l[l.length-1]??e,e);if(n.previousElementSibling instanceof HTMLElement)return void D(n,n.previousElementSibling,e)}}const B=({children:e,className:t,chevronsClassName:n,showButtons:r=C.ALWAYS,ariaLabel:i,applyLightThemeControls:f=!1,onlyHorizontalWheel:D=!1,wheelScrollEnabled:B=!0,scrollContentClassName:P,scrollerClassName:j,scrollRatio:H=.9,scrollingMethod:I=w.BY_RATIO,scrollPadding:_,scrollSnapAlign:V,scrollSnapByItems:Y=1,edgeGradients:q=x.MASK,dragToScrollOptions:z={isDisabled:!0},onScroll:F,activeElementThreshold:G=10,onNavigationClick:K})=>{const J=(0,u.W)(),X=(0,l.useRef)(null),U=(0,l.useRef)(null),Q=(0,l.useRef)(null),Z=(0,l.useRef)(-1),$=(0,l.useCallback)((()=>{const e=Math.abs(X.current?.scrollLeft??0);let t=null,n=-1;if(U.current?.children){let l=-1;for(const r of U.current.children)r instanceof HTMLElement&&(l++,Math.abs(r.offsetLeft-e)<=r.offsetWidth/G&&(t=r,n=l))}return{element:t,index:n}}),[G]),ee=(0,l.useCallback)((()=>{if(!F)return;const{index:e}=$();Z.current!==e&&(Z.current=e,F?.(e))}),[$,F]),te=(0,l.useCallback)((()=>{if(!X.current||!U.current||!Q.current)return;const e=X.current,t=U.current,n=e.scrollWidth-e.clientWidth,l=Math.abs(e.scrollLeft),r=l<1?Math.floor(l):Math.ceil(l),o=t.offsetWidth>e.clientWidth,s=o&&0!==r,c=o&&r<n;Q.current.classList.toggle(E,s),Q.current.classList.toggle(y,c)}),[]);(0,d.w)({refOrElement:U,observeOnly:"width",onResize:te}),(0,d.w)({refOrElement:X,observeOnly:"width",onResize:te});const ne=l.Children.toArray(e).length;(0,l.useLayoutEffect)(te,[ne,te]);const le=(0,l.useCallback)((e=>{switch(I){case w.SNAP:{const t=U.current.children[0].clientWidth,n=(J?-1:1)*Y*t*e;X.current?.scrollBy({left:n});break}case w.BY_RATIO:default:{const t=(J?-1:1)*e*(X.current.clientWidth*H);X.current.scrollBy({left:t});break}}te(),ee(),K?.()}),[I,te,ee,J,Y,H,K]),re=(0,l.useCallback)((e=>{"ArrowLeft"===e.key?(e.preventDefault(),W(X.current,J?O.END:O.START)):"ArrowRight"===e.key&&(e.preventDefault(),W(X.current,J?O.START:O.END))}),[J]),oe=r!==C.NEVER,se=a(z),ce=function({onlyHorizontalWheel:e}){const t=(0,l.useRef)(!0),n=(0,l.useRef)(null),r=(0,l.useRef)(null);return(0,l.useCallback)((l=>{if(!l.deltaY)return;if(e&&Math.abs(l.deltaY)>Math.abs(l.deltaX))return;const o=l.currentTarget;t.current&&(t.current=!1,n.current=o.style.scrollBehavior,o.style.scrollBehavior="auto"),o.scrollLeft+=l.deltaY+l.deltaX,r.current&&clearTimeout(r.current),r.current=setTimeout((()=>{t.current=!0,o.style.scrollBehavior=n.current??""}),100)}),[e])}({onlyHorizontalWheel:D}),ie=(0,l.useCallback)((()=>{}),[]),ae=B?ce:ie,ue={};return I===w.SNAP&&(ue.scrollPadding=_),(0,k.jsxs)("div",{ref:Q,className:o()(h,t,{[T]:q===x.LINEAR_GRADIENT}),children:[(0,k.jsx)("div",{ref:X,className:o()(m,{[b]:I===w.SNAP,[S]:q===x.MASK},j),onScroll:()=>{te(),ee()},onKeyDown:re,onMouseDown:se,onWheel:ae,role:"list","aria-label":i,style:ue,children:(0,k.jsx)("div",{ref:U,role:"presentation",className:o()(P,{[p]:"start"===V,[v]:"center"===V}),children:e})}),oe&&(0,k.jsxs)("div",{className:o()(g,n,r===C.ON_HOVER?L:N,{"encore-light-theme":f}),children:[(0,k.jsx)("button",{className:o()(A,R),tabIndex:-1,onClick:e=>{e.preventDefault(),e.stopPropagation(),le(O.START)},"aria-hidden":"true",children:(0,k.jsx)(s.g,{autoMirror:!1,semanticColor:"textBase",size:"small"})}),(0,k.jsx)("button",{className:o()(A,M),tabIndex:-1,onClick:e=>{e.preventDefault(),e.stopPropagation(),le(O.END)},"aria-hidden":"true",children:(0,k.jsx)(c.V,{autoMirror:!1,semanticColor:"textBase",size:"small"})})]})]})}},49559:(e,t,n)=>{n.d(t,{J:()=>r});var l=n(30758);function r(e){const t=(0,l.useRef)(e);return(0,l.useLayoutEffect)((()=>{t.current=e})),(0,l.useCallback)(((...e)=>t.current(...e)),[])}}}]);