1var H=Object.defineProperty;var x=(t,i,e)=>i in t?H(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e;var s=(t,i,e)=>x(t,typeof i!="symbol"?i+"":i,e);var O="1.3.15";function R(t,i,e){return Math.max(t,Math.min(i,e))}function M(t,i,e){return(1-e)*t+e*i}function k(t,i,e,o){return M(t,i,1-Math.exp(-e*o))}function D(t,i){return(t%i+i)%i}var C=class{constructor(){s(this,"isRunning",!1);s(this,"value",0);s(this,"from",0);s(this,"to",0);s(this,"currentTime",0);s(this,"lerp");s(this,"duration");s(this,"easing");s(this,"onUpdate")}advance(t){if(!this.isRunning)return;let i=!1;if(this.duration&&this.easing){this.currentTime+=t;const e=R(0,this.currentTime/this.duration,1);i=e>=1;const o=i?1:this.easing(e);this.value=this.from+(this.to-this.from)*o}else this.lerp?(this.value=k(this.value,this.to,this.lerp*60,t),Math.round(this.value)===this.to&&(this.value=this.to,i=!0)):(this.value=this.to,i=!0);i&&this.stop(),this.onUpdate?.(this.value,i)}stop(){this.isRunning=!1}fromTo(t,i,{lerp:e,duration:o,easing:l,onStart:n,onUpdate:h}){this.from=this.value=t,this.to=i,this.lerp=e,this.duration=o,this.easing=l,this.currentTime=0,this.isRunning=!0,n?.(),this.onUpdate=h}};function X(t,i){let e;return function(...o){let l=this;clearTimeout(e),e=setTimeout(()=>{e=void 0,t.apply(l,o)},i)}}var Y=class{constructor(t,i,{autoResize:e=!0,debounce:o=250}={}){s(this,"width",0);s(this,"height",0);s(this,"scrollHeight",0);s(this,"scrollWidth",0);s(this,"debouncedResize");s(this,"wrapperResizeObserver");s(this,"contentResizeObserver");s(this,"resize",()=>{this.onWrapperResize(),this.onContentResize()});s(this,"onWrapperResize",()=>{this.wrapper instanceof Window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)});s(this,"onContentResize",()=>{this.wrapper instanceof Window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)});this.wrapper=t,this.content=i,e&&(this.debouncedResize=X(this.resize,o),this.wrapper instanceof Window?window.addEventListener("resize",this.debouncedResize,!1):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){this.wrapperResizeObserver?.disconnect(),this.contentResizeObserver?.disconnect(),this.wrapper===window&&this.debouncedResize&&window.removeEventListener("resize",this.debouncedResize,!1)}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},W=class{constructor(){s(this,"events",{})}emit(t,...i){let e=this.events[t]||[];for(let o=0,l=e.length;o<l;o++)e[o]?.(...i)}on(t,i){return this.events[t]?.push(i)||(this.events[t]=[i]),()=>{this.events[t]=this.events[t]?.filter(e=>i!==e)}}off(t,i){this.events[t]=this.events[t]?.filter(e=>i!==e)}destroy(){this.events={}}},N=100/6,w={passive:!1},P=class{constructor(t,i={wheelMultiplier:1,touchMultiplier:1}){s(this,"touchStart",{x:0,y:0});s(this,"lastDelta",{x:0,y:0});s(this,"window",{width:0,height:0});s(this,"emitter",new W);s(this,"onTouchStart",t=>{const{clientX:i,clientY:e}=t.targetTouches?t.targetTouches[0]:t;this.touchStart.x=i,this.touchStart.y=e,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:t})});s(this,"onTouchMove",t=>{const{clientX:i,clientY:e}=t.targetTouches?t.targetTouches[0]:t,o=-(i-this.touchStart.x)*this.options.touchMultiplier,l=-(e-this.touchStart.y)*this.options.touchMultiplier;this.touchStart.x=i,this.touchStart.y=e,this.lastDelta={x:o,y:l},this.emitter.emit("scroll",{deltaX:o,deltaY:l,event:t})});s(this,"onTouchEnd",t=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:t})});s(this,"onWheel",t=>{let{deltaX:i,deltaY:e,deltaMode:o}=t;const l=o===1?N:o===2?this.window.width:1,n=o===1?N:o===2?this.window.height:1;i*=l,e*=n,i*=this.options.wheelMultiplier,e*=this.options.wheelMultiplier,this.emitter.emit("scroll",{deltaX:i,deltaY:e,event:t})});s(this,"onWindowResize",()=>{this.window={width:window.innerWidth,height:window.innerHeight}});this.element=t,this.options=i,window.addEventListener("resize",this.onWindowResize,!1),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,w),this.element.addEventListener("touchstart",this.onTouchStart,w),this.element.addEventListener("touchmove",this.onTouchMove,w),this.element.addEventListener("touchend",this.onTouchEnd,w)}on(t,i){return this.emitter.on(t,i)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize,!1),this.element.removeEventListener("wheel",this.onWheel,w),this.element.removeEventListener("touchstart",this.onTouchStart,w),this.element.removeEventListener("touchmove",this.onTouchMove,w),this.element.removeEventListener("touchend",this.onTouchEnd,w)}},_=t=>Math.min(1,1.001-Math.pow(2,-10*t)),A=class{constructor({wrapper:t=window,content:i=document.documentElement,eventsTarget:e=t,smoothWheel:o=!0,syncTouch:l=!1,syncTouchLerp:n=.075,touchInertiaExponent:h=1.7,duration:p,easing:a,lerp:u=.1,infinite:d=!1,orientation:v="vertical",gestureOrientation:r=v==="horizontal"?"both":"vertical",touchMultiplier:c=1,wheelMultiplier:f=1,autoResize:S=!0,prevent:m,virtualScroll:y,overscroll:E=!0,autoRaf:T=!1,anchors:L=!1,autoToggle:g=!1,allowNestedScroll:b=!1,__experimental__naiveDimensions:z=!1}={}){s(this,"_isScrolling",!1);s(this,"_isStopped",!1);s(this,"_isLocked",!1);s(this,"_preventNextNativeScrollEvent",!1);s(this,"_resetVelocityTimeout",null);s(this,"__rafID",null);s(this,"isTouching");s(this,"time",0);s(this,"userData",{});s(this,"lastVelocity",0);s(this,"velocity",0);s(this,"direction",0);s(this,"options");s(this,"targetScroll");s(this,"animatedScroll");s(this,"animate",new C);s(this,"emitter",new W);s(this,"dimensions");s(this,"virtualScroll");s(this,"onScrollEnd",t=>{t instanceof CustomEvent||(this.isScrolling==="smooth"||this.isScrolling===!1)&&t.stopPropagation()});s(this,"dispatchScrollendEvent",()=>{this.options.wrapper.dispatchEvent(new CustomEvent("scrollend",{bubbles:this.options.wrapper===window,detail:{lenisScrollEnd:!0}}))});s(this,"onTransitionEnd",t=>{if(t.propertyName.includes("overflow")){const i=this.isHorizontal?"overflow-x":"overflow-y",e=getComputedStyle(this.rootElement)[i];["hidden","clip"].includes(e)?this.internalStop():this.internalStart()}});s(this,"onClick",t=>{const e=t.composedPath().find(o=>o instanceof HTMLAnchorElement&&o.getAttribute("href")?.includes("#"));if(e){const o=e.getAttribute("href");if(o){const l=typeof this.options.anchors=="object"&&this.options.anchors?this.options.anchors:void 0,n=`#${o.split("#")[1]}`;this.scrollTo(n,l)}}});s(this,"onPointerDown",t=>{t.button===1&&this.reset()});s(this,"onVirtualScroll",t=>{if(typeof this.options.virtualScroll=="function"&&this.options.virtualScroll(t)===!1)return;const{deltaX:i,deltaY:e,event:o}=t;if(this.emitter.emit("virtual-scroll",{deltaX:i,deltaY:e,event:o}),o.ctrlKey||o.lenisStopPropagation)return;const l=o.type.includes("touch"),n=o.type.includes("wheel");this.isTouching=o.type==="touchstart"||o.type==="touchmove";
1const h=i===0&&e===0;if(this.options.syncTouch&&l&&o.type==="touchstart"&&h&&!this.isStopped&&!this.isLocked){this.reset();return}const a=this.options.gestureOrientation==="vertical"&&e===0||this.options.gestureOrientation==="horizontal"&&i===0;if(h||a)return;let u=o.composedPath();u=u.slice(0,u.indexOf(this.rootElement));const d=this.options.prevent;if(u.find(m=>m instanceof HTMLElement&&(typeof d=="function"&&d?.(m)||m.hasAttribute?.("data-lenis-prevent")||l&&m.hasAttribute?.("data-lenis-prevent-touch")||n&&m.hasAttribute?.("data-lenis-prevent-wheel")||this.options.allowNestedScroll&&this.checkNestedScroll(m,{deltaX:i,deltaY:e}))))return;if(this.isStopped||this.isLocked){o.cancelable&&o.preventDefault();return}if(!(this.options.syncTouch&&l||this.options.smoothWheel&&n)){this.isScrolling="native",this.animate.stop(),o.lenisStopPropagation=!0;return}let r=e;this.options.gestureOrientation==="both"?r=Math.abs(e)>Math.abs(i)?e:i:this.options.gestureOrientation==="horizontal"&&(r=i),(!this.options.overscroll||this.options.infinite||this.options.wrapper!==window&&this.limit>0&&(this.animatedScroll>0&&this.animatedScroll<this.limit||this.animatedScroll===0&&e>0||this.animatedScroll===this.limit&&e<0))&&(o.lenisStopPropagation=!0),o.cancelable&&o.preventDefault();const c=l&&this.options.syncTouch,S=l&&o.type==="touchend";S&&(r=Math.sign(this.velocity)*Math.pow(Math.abs(this.velocity),this.options.touchInertiaExponent)),this.scrollTo(this.targetScroll+r,{programmatic:!1,...c?{lerp:S?this.options.syncTouchLerp:1}:{lerp:this.options.lerp,duration:this.options.duration,easing:this.options.easing}})});s(this,"onNativeScroll",()=>{if(this._resetVelocityTimeout!==null&&(clearTimeout(this._resetVelocityTimeout),this._resetVelocityTimeout=null),this._preventNextNativeScrollEvent){this._preventNextNativeScrollEvent=!1;return}if(this.isScrolling===!1||this.isScrolling==="native"){const t=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity,this.velocity=this.animatedScroll-t,this.direction=Math.sign(this.animatedScroll-t),this.isStopped||(this.isScrolling="native"),this.emit(),this.velocity!==0&&(this._resetVelocityTimeout=setTimeout(()=>{this.lastVelocity=this.velocity,this.velocity=0,this.isScrolling=!1,this.emit()},400))}});s(this,"raf",t=>{const i=t-(this.time||t);this.time=t,this.animate.advance(i*.001),this.options.autoRaf&&(this.__rafID=requestAnimationFrame(this.raf))});window.lenisVersion=O,(!t||t===document.documentElement)&&(t=window),typeof p=="number"&&typeof a!="function"?a=_:typeof a=="function"&&typeof p!="number"&&(p=1),this.options={wrapper:t,content:i,eventsTarget:e,smoothWheel:o,syncTouch:l,syncTouchLerp:n,touchInertiaExponent:h,duration:p,easing:a,lerp:u,infinite:d,gestureOrientation:r,orientation:v,touchMultiplier:c,wheelMultiplier:f,autoResize:S,prevent:m,virtualScroll:y,overscroll:E,autoRaf:T,anchors:L,autoToggle:g,allowNestedScroll:b,__experimental__naiveDimensions:z},this.dimensions=new Y(t,i,{autoResize:S}),this.updateClassName(),this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll,!1),this.options.wrapper.addEventListener("scrollend",this.onScrollEnd,{capture:!0}),this.options.anchors&&this.options.wrapper===window&&this.options.wrapper.addEventListener("click",this.onClick,!1),this.options.wrapper.addEventListener("pointerdown",this.onPointerDown,!1),this.virtualScroll=new P(e,{touchMultiplier:c,wheelMultiplier:f}),this.virtualScroll.on("scroll",this.onVirtualScroll),this.options.autoToggle&&this.rootElement.addEventListener("transitionend",this.onTransitionEnd,{passive:!0}),this.options.autoRaf&&(this.__rafID=requestAnimationFrame(this.raf))}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll,!1),this.options.wrapper.removeEventListener("scrollend",this.onScrollEnd,{capture:!0}),this.options.wrapper.removeEventListener("pointerdown",this.onPointerDown,!1),this.options.anchors&&this.options.wrapper===window&&this.options.wrapper.removeEventListener("click",this.onClick,!1),this.virtualScroll.destroy(),this.dimensions.destroy(),this.cleanUpClassName(),this.__rafID&&cancelAnimationFrame(this.__rafID)}on(t,i){return this.emitter.on(t,i)}off(t,i){return this.emitter.off(t,i)}setScroll(t){this.isHorizontal?this.options.wrapper.scrollTo({left:t,behavior:"instant"}):this.options.wrapper.scrollTo({top:t,behavior:"instant"})}resize(){this.dimensions.resize(),this.animatedScroll=this.targetScroll=this.actualScroll,this.emit
1()}emit(){this.emitter.emit("scroll",this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity=0,this.animate.stop()}start(){if(this.isStopped){if(this.options.autoToggle){this.rootElement.style.removeProperty("overflow");return}this.internalStart()}}internalStart(){this.isStopped&&(this.reset(),this.isStopped=!1,this.emit())}stop(){if(!this.isStopped){if(this.options.autoToggle){this.rootElement.style.setProperty("overflow","clip");return}this.internalStop()}}internalStop(){this.isStopped||(this.reset(),this.isStopped=!0,this.emit())}scrollTo(t,{offset:i=0,immediate:e=!1,lock:o=!1,duration:l=this.options.duration,easing:n=this.options.easing,lerp:h=this.options.lerp,onStart:p,onComplete:a,force:u=!1,programmatic:d=!0,userData:v}={}){if(!((this.isStopped||this.isLocked)&&!u)){if(typeof t=="string"&&["top","left","start","#"].includes(t))t=0;else if(typeof t=="string"&&["bottom","right","end"].includes(t))t=this.limit;else{let r;if(typeof t=="string"?(r=document.querySelector(t),r||(t==="#top"?t=0:console.warn("Lenis: Target not found",t))):t instanceof HTMLElement&&t?.nodeType&&(r=t),r){if(this.options.wrapper!==window){const f=this.rootElement.getBoundingClientRect();i-=this.isHorizontal?f.left:f.top}const c=r.getBoundingClientRect();t=(this.isHorizontal?c.left:c.top)+this.animatedScroll}}if(typeof t=="number"){if(t+=i,t=Math.round(t),this.options.infinite){if(d){this.targetScroll=this.animatedScroll=this.scroll;const r=t-this.animatedScroll;r>this.limit/2?t=t-this.limit:r<-this.limit/2&&(t=t+this.limit)}}else t=R(0,t,this.limit);if(t===this.targetScroll){p?.(this),a?.(this);return}if(this.userData=v??{},e){this.animatedScroll=this.targetScroll=t,this.setScroll(this.scroll),this.reset(),this.preventNextNativeScrollEvent(),this.emit(),a?.(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()});return}d||(this.targetScroll=t),typeof l=="number"&&typeof n!="function"?n=_:typeof n=="function"&&typeof l!="number"&&(l=1),this.animate.fromTo(this.animatedScroll,t,{duration:l,easing:n,lerp:h,onStart:()=>{o&&(this.isLocked=!0),this.isScrolling="smooth",p?.(this)},onUpdate:(r,c)=>{this.isScrolling="smooth",this.lastVelocity=this.velocity,this.velocity=r-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=r,this.setScroll(this.scroll),d&&(this.targetScroll=r),c||this.emit(),c&&(this.reset(),this.emit(),a?.(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()}),this.preventNextNativeScrollEvent())}})}}}preventNextNativeScrollEvent(){this._preventNextNativeScrollEvent=!0,requestAnimationFrame(()=>{this._preventNextNativeScrollEvent=!1})}checkNestedScroll(t,{deltaX:i,deltaY:e}){const o=Date.now(),l=t._lenis??(t._lenis={});let n,h,p,a,u,d,v,r;const c=this.options.gestureOrientation;if(o-(l.time??0)>2e3){l.time=Date.now();const g=window.getComputedStyle(t);l.computedStyle=g;const b=g.overflowX,z=g.overflowY;if(n=["auto","overlay","scroll"].includes(b),h=["auto","overlay","scroll"].includes(z),l.hasOverflowX=n,l.hasOverflowY=h,!n&&!h||c==="vertical"&&!h||c==="horizontal"&&!n)return!1;u=t.scrollWidth,d=t.scrollHeight,v=t.clientWidth,r=t.clientHeight,p=u>v,a=d>r,l.isScrollableX=p,l.isScrollableY=a,l.scrollWidth=u,l.scrollHeight=d,l.clientWidth=v,l.clientHeight=r}else p=l.isScrollableX,a=l.isScrollableY,n=l.hasOverflowX,h=l.hasOverflowY,u=l.scrollWidth,d=l.scrollHeight,v=l.clientWidth,r=l.clientHeight;if(!n&&!h||!p&&!a||c==="vertical"&&(!h||!a)||c==="horizontal"&&(!n||!p))return!1;let f;if(c==="horizontal")f="x";else if(c==="vertical")f="y";else{const g=i!==0,b=e!==0;g&&n&&p&&(f="x"),b&&h&&a&&(f="y")}if(!f)return!1;let S,m,y,E,T;if(f==="x")S=t.scrollLeft,m=u-v,y=i,E=n,T=p;else if(f==="y")S=t.scrollTop,m=d-r,y=e,E=h,T=a;else return!1;return(y>0?S<m:S>0)&&E&&T}get rootElement(){return this.options.wrapper===window?document.documentElement:this.options.wrapper}get limit(){return this.options.__experimental__naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]}get isHorizontal(){return this.options.orientation==="horizontal"}get actualScroll(){const t=this.options.wrapper;return this.isHorizontal?t.scrollX??t.scrollLeft:t.scrollY??t.scrollTop}get scroll(){return this.options.infinite?D(this.animatedScroll,this.limit):this.animatedScroll}get progress(){return this.limit===0?1:this.scroll/this.limit}get isScrolling(){return this._isScrolling}set isScrolling(t){this._isScrolling!==t&&(this._isScrolling=t,this.updateClassName())}get isStopped(){return this._isStopped}set isStopped(t){this._isStopped!==t&&(this._isStopped=t,this.updateClassName())}get isLocked(){return this._isLocked}set isLocked(t){this._isLocked!==t&&(this._isLocked=t,this.updateClassName())}get isSmooth(){return this.isScrolling==="smooth"}get className(){let t="lenis";return this.options.autoToggle&&(t+=" lenis-autoToggle"),this.isStopped&&(t+=" lenis-stopped"),this.isLocked&&(t+=" lenis-locked"),this.isScrolling&&(t+=" lenis-scrolling"),this.isScrolling==="smooth"&&(t+=" lenis-smooth"),t}updateClassName(){this.cleanUpClassName(),this.rootElement.className=`${this.rootElement.className} ${this.className}`.trim()}cleanUpClassName(){this.rootElement.className=this.rootElement.className.replace(/lenis(-\w+)?/g,"").trim()}};export{A as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.