!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).locomotivescroll=e()}(this,function(){function t(){return t=object.assign?object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var i=0,s=new array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new typeerror("invalid attempt to iterate non-iterable instance.\nin order to be iterable, non-array objects must have a [symbol.iterator]() method.")}function s(){return s=object.assign?object.assign.bind():function(t){for(var e=1;e=1;const s=i?1:this.easing(e);this.value=this.from+(this.to-this.from)*s}var s;null==(e=this.onupdate)||e.call(this,this.value,{completed:i}),i&&this.stop()}stop(){this.isrunning=!1}fromto(t,e,{lerp:i=.1,duration:s=1,easing:n=(t=>t),onupdate:r}){this.from=this.value=t,this.to=e,this.lerp=i,this.duration=s,this.easing=n,this.currenttime=0,this.isrunning=!0,this.onupdate=r}}function o(t,e){let i;return function(){let s=arguments,n=this;cleartimeout(i),i=settimeout(function(){t.apply(n,s)},e)}}class l{constructor(t,e){this.onwindowresize=()=>{this.width=window.innerwidth,this.height=window.innerheight},this.onwrapperresize=()=>{this.width=this.wrapper.clientwidth,this.height=this.wrapper.clientheight},this.oncontentresize=()=>{const t=this.wrapper===window?document.documentelement:this.wrapper;this.scrollheight=t.scrollheight,this.scrollwidth=t.scrollwidth},this.wrapper=t,this.content=e,this.wrapper===window?(window.addeventlistener("resize",this.onwindowresize,!1),this.onwindowresize()):(this.wrapperresizeobserver=new resizeobserver(o(this.onwrapperresize,100)),this.wrapperresizeobserver.observe(this.wrapper),this.onwrapperresize()),this.contentresizeobserver=new resizeobserver(o(this.oncontentresize,100)),this.contentresizeobserver.observe(this.content),this.oncontentresize()}destroy(){var t,e;window.removeeventlistener("resize",this.onwindowresize,!1),null==(t=this.wrapperresizeobserver)||t.disconnect(),null==(e=this.contentresizeobserver)||e.disconnect()}get limit(){return{x:this.scrollwidth-this.width,y:this.scrollheight-this.height}}}let a=()=>({events:{},emit(t,...e){let i=this.events[t]||[];for(let t=0,s=i.length;t{var i;this.events[t]=null==(i=this.events[t])?void 0:i.filter(t=>e!==t)}}});class h{constructor(t,{wheelmultiplier:e=1,touchmultiplier:i=2,normalizewheel:s=!1}){this.ontouchstart=t=>{const{clientx:e,clienty:i}=t.targettouches?t.targettouches[0]:t;this.touchstart.x=e,this.touchstart.y=i,this.lastdelta={x:0,y:0}},this.ontouchmove=t=>{const{clientx:e,clienty:i}=t.targettouches?t.targettouches[0]:t,s=-(e-this.touchstart.x)*this.touchmultiplier,n=-(i-this.touchstart.y)*this.touchmultiplier;this.touchstart.x=e,this.touchstart.y=i,this.lastdelta={x:s,y:n},this.emitter.emit("scroll",{type:"touch",deltax:s,deltay:n,event:t})},this.ontouchend=t=>{this.emitter.emit("scroll",{type:"touch",inertia:!0,deltax:this.lastdelta.x,deltay:this.lastdelta.y,event:t})},this.onwheel=t=>{let{deltax:e,deltay:i}=t;this.normalizewheel&&(e=n(-100,e,100),i=n(-100,i,100)),e*=this.wheelmultiplier,i*=this.wheelmultiplier,this.emitter.emit("scroll",{type:"wheel",deltax:e,deltay:i,event:t})},this.element=t,this.wheelmultiplier=e,this.touchmultiplier=i,this.normalizewheel=s,this.touchstart={x:null,y:null},this.emitter=a(),this.element.addeventlistener("wheel",this.onwheel,{passive:!1}),this.element.addeventlistener("touchstart",this.ontouchstart,{passive:!1}),this.element.addeventlistener("touchmove",this.ontouchmove,{passive:!1}),this.element.addeventlistener("touchend",this.ontouchend,{passive:!1})}on(t,e){return this.emitter.on(t,e)}destroy(){this.emitter.events={},this.element.removeeventlistener("wheel",this.onwheel,{passive:!1}),this.element.removeeventlistener("touchstart",this.ontouchstart,{passive:!1}),this.element.removeeventlistener("touchmove",this.ontouchmove,{passive:!1}),this.element.removeeventlistener("touchend",this.ontouchend,{passive:!1})}}class c{constructor({direction:t,gesturedirection:e,mousemultiplier:i,smooth:n,wrapper:o=window,content:c=document.documentelement,wheeleventstarget:u=o,smoothwheel:d=null==n||n,smoothtouch:m=!1,synctouch:v=!1,synctouchlerp:p=.1,touchinertiamultiplier:f=35,duration:g,easing:b=(t=>math.min(1,1.001-math.pow(2,-10*t))),lerp:s=(g?null:.1),infinite:w=!1,orientation:e=(null!=t?t:"vertical"),gestureorientation:i=(null!=e?e:"vertical"),touchmultiplier:o=1,wheelmultiplier:y=(null!=i?i:1),normalizewheel:r=!1}={}){this.onvirtualscroll=({type:t,inertia:e,deltax:i,deltay:n,event:r})=>{if(r.ctrlkey)return;const o="touch"===t,l="wheel"===t;if("vertical"===this.options.gestureorientation&&0===n||"horizontal"===this.options.gestureorientation&&0===i||o&&"vertical"===this.options.gestureorientation&&0===this.scroll&&!this.options.infinite&&n<=0)return;if(r.composedpath().find(t=>null==t||null==t.hasattribute?void 0:t.hasattribute("data-lenis-prevent")))return;if(this.isstopped||this.islocked)return void r.preventdefault();if(this.issmooth=(this.options.smoothtouch||this.options.synctouch)&&o||this.options.smoothwheel&&l,!this.issmooth)return this.isscrolling=!1,void this.animate.stop();r.preventdefault();let a=n;"both"===this.options.gestureorientation?a=math.abs(n)>math.abs(i)?n:i:"horizontal"===this.options.gestureorientation&&(a=i);const h=o&&this.options.synctouch,c=o&&e&&math.abs(a)>1;c&&(a=this.velocity*this.options.touchinertiamultiplier),this.scrollto(this.targetscroll+a,s({programmatic:!1},h&&{lerp:c?this.synctouchlerp:.4}))},this.onscroll=()=>{if(!this.isscrolling){const t=this.animatedscroll;this.animatedscroll=this.targetscroll=this.actualscroll,this.velocity=0,this.direction=math.sign(this.animatedscroll-t),this.emit()}},t&&console.warn("lenis: `direction` option is deprecated, use `orientation` instead"),e&&console.warn("lenis: `gesturedirection` option is deprecated, use `gestureorientation` instead"),i&&console.warn("lenis: `mousemultiplier` option is deprecated, use `wheelmultiplier` instead"),n&&console.warn("lenis: `smooth` option is deprecated, use `smoothwheel` instead"),window.lenisversion="1.0.11",o!==document.documentelement&&o!==document.body||(o=window),this.options={wrapper:o,content:c,wheeleventstarget:u,smoothwheel:d,smoothtouch:m,synctouch:v,synctouchlerp:p,touchinertiamultiplier:f,duration:g,easing:b,lerp:s,infinite:w,gestureorientation:i,orientation:e,touchmultiplier:o,wheelmultiplier:y,normalizewheel:r},this.dimensions=new l(o,c),this.rootelement.classlist.add("lenis"),this.velocity=0,this.isstopped=!1,this.issmooth=d||m,this.isscrolling=!1,this.targetscroll=this.animatedscroll=this.actualscroll,this.animate=new r,this.emitter=a(),this.options.wrapper.addeventlistener("scroll",this.onscroll,{passive:!1}),this.virtualscroll=new h(u,{touchmultiplier:o,wheelmultiplier:y,normalizewheel:r}),this.virtualscroll.on("scroll",this.onvirtualscroll)}destroy(){this.emitter.events={},this.options.wrapper.removeeventlistener("scroll",this.onscroll,{passive:!1}),this.virtualscroll.destroy()}on(t,e){return this.emitter.on(t,e)}off(t,e){var i;this.emitter.events[t]=null==(i=this.emitter.events[t])?void 0:i.filter(t=>e!==t)}setscroll(t){this.ishorizontal?this.rootelement.scrollleft=t:this.rootelement.scrolltop=t}emit(){this.emitter.emit("scroll",this)}reset(){this.islocked=!1,this.isscrolling=!1,this.velocity=0,this.animate.stop()}start(){this.isstopped=!1,this.reset()}stop(){this.isstopped=!0,this.animate.stop(),this.reset()}raf(t){const e=t-(this.time||t);this.time=t,this.animate.advance(.001*e)}scrollto(t,{offset:e=0,immediate:i=!1,lock:s=!1,duration:r=this.options.duration,easing:o=this.options.easing,lerp:l=!r&&this.options.lerp,oncomplete:a=null,force:h=!1,programmatic:c=!0}={}){if(!this.isstopped||h){if(["top","left","start"].includes(t))t=0;else if(["bottom","right","end"].includes(t))t=this.limit;else{var u;let i;if("string"==typeof t?i=document.queryselector(t):null!=(u=t)&&u.nodetype&&(i=t),i){if(this.options.wrapper!==window){const t=this.options.wrapper.getboundingclientrect();e-=this.ishorizontal?t.left:t.top}const s=i.getboundingclientrect();t=(this.ishorizontal?s.left:s.top)+this.animatedscroll}}if("number"==typeof t){if(t+=e,t=math.round(t),this.options.infinite?c&&(this.targetscroll=this.animatedscroll=this.scroll):t=n(0,t,this.limit),i)return this.animatedscroll=this.targetscroll=t,this.setscroll(this.scroll),this.reset(),this.emit(),void(null==a||a());if(!c){if(t===this.targetscroll)return;this.targetscroll=t}this.animate.fromto(this.animatedscroll,t,{duration:r,easing:o,lerp:l,onupdate:(t,{completed:e})=>{s&&(this.islocked=!0),this.isscrolling=!0,this.velocity=t-this.animatedscroll,this.direction=math.sign(this.velocity),this.animatedscroll=t,this.setscroll(this.scroll),c&&(this.targetscroll=t),e&&(s&&(this.islocked=!1),requestanimationframe(()=>{this.isscrolling=!1}),this.velocity=0,null==a||a()),this.emit()}})}}}get rootelement(){return this.options.wrapper===window?this.options.content:this.options.wrapper}get limit(){return this.ishorizontal?this.dimensions.limit.x:this.dimensions.limit.y}get ishorizontal(){return"horizontal"===this.options.orientation}get actualscroll(){return this.ishorizontal?this.rootelement.scrollleft:this.rootelement.scrolltop}get scroll(){return this.options.infinite?function(t,e){let i=t%e;return(e>0&&i<0||e<0&&i>0)&&(i+=e),i}(this.animatedscroll,this.limit):this.animatedscroll}get progress(){return 0===this.limit?1:this.scroll/this.limit}get issmooth(){return this.__issmooth}set issmooth(t){this.__issmooth!==t&&(this.rootelement.classlist.toggle("lenis-smooth",t),this.__issmooth=t)}get isscrolling(){return this.__isscrolling}set isscrolling(t){this.__isscrolling!==t&&(this.rootelement.classlist.toggle("lenis-scrolling",t),this.__isscrolling=t)}get isstopped(){return this.__isstopped}set isstopped(t){this.__isstopped!==t&&(this.rootelement.classlist.toggle("lenis-stopped",t),this.__isstopped=t)}}var u=/*#__pure__*/function(){function t(t){var e=t.scrollelements,i=t.rootmargin,s=void 0===i?"-1px -1px -1px -1px":i,n=t.ioraf;this.scrollelements=void 0,this.rootmargin=void 0,this.ioraf=void 0,this.observer=void 0,this.scrollelements=e,this.rootmargin=s,this.ioraf=n,this._init()}var e=t.prototype;return e._init=function(){var t=this;this.observer=new intersectionobserver(function(e){e.foreach(function(e){var i=t.scrollelements.find(function(t){return t.$el===e.target});e.isintersecting?(i&&(i.isalreadyintersected=!0),t._setinview(e)):i&&i.isalreadyintersected&&t._setoutofview(e)})},{rootmargin:this.rootmargin});for(var e,s=i(this.scrollelements);!(e=s()).done;)this.observe(e.value.$el)},e.destroy=function(){this.observer.disconnect()},e.observe=function(t){t&&this.observer.observe(t)},e.unobserve=function(t){t&&this.observer.unobserve(t)},e._setinview=function(t){var e=this.scrollelements.find(function(e){return e.$el===t.target});this.ioraf&&(null==e||e.setinteractivityon()),!this.ioraf&&(null==e||e.setinview())},e._setoutofview=function(t){var e=this.scrollelements.find(function(e){return e.$el===t.target});this.ioraf&&(null==e||e.setinteractivityoff()),!this.ioraf&&(null==e||e.setoutofview()),null!=e&&e.attributes.scrollrepeat||this.ioraf||this.unobserve(t.target)},t}();function d(t,e,i,s,n){return i+((n-t)/(e-t)*(s-i)||0)}function m(t,e){return t.reduce(function(t,i){return math.abs(i-e)1?1:e;if(this.progress=s,s!=this.lastprogress){if(this.lastprogress=s,this.attributes.scrollcssprogress&&this._setcssprogress(s),this.attributes.scrolleventprogress&&this._setcustomeventprogress(s),this.attributes.scrollmoduleprogress)for(var n,r=i(this.progressmodularmodules);!(n=r()).done;){var o=n.value;this.modularinstance&&this.modularinstance.call("onscrollprogress",s,o.modulename,o.moduleid)}s>0&&s<1&&this.setinview(),0===s&&this.setoutofview(),1===s&&this.setoutofview()}},e._setcssprogress=function(t){void 0===t&&(t=0),this.$el.style.setproperty("--progress",t.tostring())},e._setcustomeventprogress=function(t){void 0===t&&(t=0);var e=this.attributes.scrolleventprogress;if(e){var i=new customevent(e,{detail:{target:this.$el,progress:t}});window.dispatchevent(i)}},e._getprogressmodularmodules=function(){if(this.modularinstance){var t=object.keys(this.$el.dataset).filter(function(t){return t.includes("module")}),e=object.entries(this.modularinstance.modules);if(t.length)for(var s,n=i(t);!(s=n()).done;){var r=this.$el.dataset[s.value];if(!r)return;for(var o,l=i(e);!(o=l()).done;){var a=o.value;r in a[1]&&this.progressmodularmodules.push({modulename:a[0],moduleid:r})}}}},e._getscrollcallfrom=function(){var t=m([this.intersection.start,this.intersection.end],this.currentscroll);return this.intersection.start===t?"start":"end"},e._dispatchcall=function(t,e){var i,s,n=null==(i=this.attributes.scrollcall)?void 0:i.split(","),r=null==(s=this.attributes)?void 0:s.scrollcallself;if(n&&n.length>1){var o,l,a=n[0],h=n[1],c=n[2];l=r?this.$el.dataset["module"+h.trim()]:c,this.modularinstance&&this.modularinstance.call(a.trim(),{target:this.$el,way:t,from:e},h.trim(),null==(o=l)?void 0:o.trim())}else if(n){var u=new customevent(n[0],{detail:{target:this.$el,way:t,from:e}});window.dispatchevent(u)}},t}(),p=["scrolloffset","scrollposition","scrollmoduleprogress","scrollcssprogress","scrolleventprogress","scrollspeed"],f=/*#__pure__*/function(){function t(t){var e=t.$el,i=t.modularinstance,s=t.triggerrootmargin,n=t.rafrootmargin,r=t.scrollorientation;this.$scrollcontainer=void 0,this.modularinstance=void 0,this.triggerrootmargin=void 0,this.rafrootmargin=void 0,this.scrollelements=void 0,this.triggeredscrollelements=void 0,this.rafscrollelements=void 0,this.scrollelementstoupdate=void 0,this.iotriggerinstance=void 0,this.iorafinstance=void 0,this.scrollorientation=void 0,e?(this.$scrollcontainer=e,this.modularinstance=i,this.scrollorientation=r,this.triggerrootmargin=null!=s?s:"-1px -1px -1px -1px",this.rafrootmargin=null!=n?n:"100% 100% 100% 100%",this.scrollelements=[],this.triggeredscrollelements=[],this.rafscrollelements=[],this.scrollelementstoupdate=[],this._init()):console.error("please provide a dom element as scrollcontainer")}var e=t.prototype;return e._init=function(){var t=this.$scrollcontainer.queryselectorall("[data-scroll]"),e=array.from(t);this._subscribescrollelements(e),this.iotriggerinstance=new u({scrollelements:[].concat(this.triggeredscrollelements),rootmargin:this.triggerrootmargin,ioraf:!1}),this.iorafinstance=new u({scrollelements:[].concat(this.rafscrollelements),rootmargin:this.rafrootmargin,ioraf:!0})},e.destroy=function(){this.iotriggerinstance.destroy(),this.iorafinstance.destroy(),this._unsubscribeallscrollelements()},e.onresize=function(t){for(var e,s=t.currentscroll,n=i(this.rafscrollelements);!(e=n()).done;)e.value.onresize({currentscroll:s})},e.onrender=function(t){for(var e,s=t.currentscroll,n=t.smooth,r=i(this.scrollelementstoupdate);!(e=r()).done;)e.value.onrender({currentscroll:s,smooth:n})},e.removescrollelements=function(t){var e=this,i=t.queryselectorall("[data-scroll]");if(i.length){for(var s=0;s-1&&(this.iotriggerinstance.unobserve(n.$el),this.triggeredscrollelements.splice(s,1))}for(var r=0;r-1&&(this.iorafinstance.unobserve(o.$el),this.rafscrollelements.splice(r,1))}i.foreach(function(t){var i=e.scrollelementstoupdate.find(function(e){return e.$el===t}),s=e.scrollelements.find(function(e){return e.$el===t});i&&e._unsubscribeelementupdate(i),s&&(e.scrollelements=e.scrollelements.filter(function(t){return t.id!=s.id}))})}},e.addscrollelements=function(t){var e=t.queryselectorall("[data-scroll]"),i=[];this.scrollelements.foreach(function(t){i.push(t.id)});var s=math.max.apply(math,i)+1,n=array.from(e);this._subscribescrollelements(n,s,!0)},e._subscribescrollelements=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1);for(var s=0;s