PageSourceSearch

https://www.gtha.com/wp-content/themes/uncode/library/js/lib/lenis.js?ver=18435497

js gtha.com collected 2026-09-25 05:44:53 UTC 32,179 bytes, 819 lines download raw bytes

1"use strict";
2
3function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9(function (global, factory) {
10  (typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Lenis = factory());
11})(void 0, function () {
12  'use strict';
13
14  var version = "1.1.9";
15
16  // Clamp a value between a minimum and maximum value
17  function clamp(min, input, max) {
18    return Math.max(min, Math.min(input, max));
19  }
20
21  // Linearly interpolate between two values using an amount (0 <= t <= 1)
22  function lerp(x, y, t) {
23    return (1 - t) * x + t * y;
24  }
25
26  // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
27  function damp(x, y, lambda, dt) {
28    return lerp(x, y, 1 - Math.exp(-lambda * dt));
29  }
30
31  // Calculate the modulo of the dividend and divisor while keeping the result within the same sign as the divisor
32  // https://anguscroll.com/just/just-modulo
33  function modulo(n, d) {
34    return (n % d + d) % d;
35  }
36  var Animate = /*#__PURE__*/function () {
37    function Animate() {
38      _classCallCheck(this, Animate);
39      this.isRunning = false;
40      this.value = 0;
41      this.from = 0;
42      this.to = 0;
43      this.duration = 0;
44      this.currentTime = 0;
45    }
46    _createClass(Animate, [{
47      key: "advance",
48      value: function advance(deltaTime) {
49        var _a;
50        if (!this.isRunning) return;
51        var completed = false;
52        if (this.duration && this.easing) {
53          this.currentTime += deltaTime;
54          var linearProgress = clamp(0, this.currentTime / this.duration, 1);
55          completed = linearProgress >= 1;
56          var easedProgress = completed ? 1 : this.easing(linearProgress);
57          this.value = this.from + (this.to - this.from) * easedProgress;
58        } else if (this.lerp) {
59          this.value = damp(this.value, this.to, this.lerp * 60, deltaTime);
60          if (Math.round(this.value) === this.to) {
61            this.value = this.to;
62            completed = true;
63          }
64        } else {
65          this.value = this.to;
66          completed = true;
67        }
68        if (completed) {
69          this.stop();
70        }
71        (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.call(this, this.value, completed);
72      }
73    }, {
74      key: "stop",
75      value: function stop() {
76        this.isRunning = false;
77      }
78    }, {
79      key: "fromTo",
80      value: function fromTo(from, to, _ref) {
81        var lerp = _ref.lerp,
82          duration = _ref.duration,
83          easing = _ref.easing,
84          onStart = _ref.onStart,
85          onUpdate = _ref.onUpdate;
86        this.from = this.value = from;
87        this.to = to;
88        this.lerp = lerp;
89        this.duration = duration;
90        this.easing = easing;
91        this.currentTime = 0;
92        this.isRunning = true;
93        onStart === null || onStart === void 0 ? void 0 : onStart();
94        this.onUpdate = onUpdate;
95      }
96    }]);
97    return Animate;
98  }();
99  function debounce(callback, delay) {
100    var timer;
101    return function () {
102      var args = arguments;
103      var context = this;
104      clearTimeout(timer);
105      timer = setTimeout(function () {
106        callback.apply(context, args);
107      }, delay);
108    };
109  }
110  var Dimensions = /*#__PURE__*/function () {
111    function Dimensions() {
112      var _this = this;
113      var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
114        wrapper = _ref2.wrapper,
115        content = _ref2.content,
116        _ref2$autoResize = _ref2.autoResize,
117        autoResize = _ref2$autoResize === void 0 ? true : _ref2$autoResize,
118        _ref2$debounce = _ref2.debounce,
119        debounceValue = _ref2$debounce === void 0 ? 250 : _ref2$debounce;
120      _classCallCheck(this, Dimensions);
121      this.width = 0;
122      this.height = 0;
123      this.scrollWidth = 0;
124      this.scrollHeight = 0;
125      this.resize = function () {
126        _this.onWrapperResize();
127        _this.onContentResize();
128      };
129      this.onWrapperResize = function () {
130        if (_this.wrapper === window) {
131          _this.width = window.innerWidth;
132          _this.height = window.innerHeight;
133        } else if (_this.wrapper instanceof HTMLElement) {
134          _this.width = _this.wrapper.clientWidth;
135          _this.height = _this.wrapper.clientHeight;
136        }
137      };
138      this.onContentResize = function () {
139        if (_this.wrapper === window) {
140          _this.scrollHeight = _this.content.scrollHeight;
141          _this.scrollWidth = _this.content.scrollWidth;
142        } else if (_this.wrapper instanceof HTMLElement) {
143          _this.scrollHeight = _this.wrapper.scrollHeight;
144          _this.scrollWidth = _this.wrapper.scrollWidth;
145        }
146      };
147      this.wrapper = wrapper;
148      this.content = content;
149      if (autoResize) {
150        this.debouncedResize = debounce(this.resize, debounceValue);
151        if (this.wrapper === window) {
152          window.addEventListener('resize', this.debouncedResize, false);
153        } else {
154          this.wrapperResizeObserver = new ResizeObserver(this.debouncedResize);
155          this.wrapperResizeObserver.observe(this.wrapper);
156        }
157        this.contentResizeObserver = new ResizeObserver(this.debouncedResize);
158        this.contentResizeObserver.observe(this.content);
159      }
160      this.resize();
161    }
162    _createClass(Dimensions, [{
163      key: "destroy",
164      value: function destroy() {
165        var _a, _b;
166        (_a = this.wrapperResizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
167        (_b = this.contentResizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
168        window.removeEventListener('resize', this.debouncedResize, false);
169      }
170    }, {
171      key: "limit",
172      get: function get() {
173        return {
174          x: this.scrollWidth - this.width,
175          y: this.scrollHeight - this.height
176        };
177      }
178    }]);
179    return Dimensions;
180  }();
181  var Emitter = /*#__PURE__*/function () {
182    function Emitter() {
183      _classCallCheck(this, Emitter);
184      this.events = {};
185    }
186    _createClass(Emitter, [{
187      key: "emit",
188      value: function emit(event) {
189        var callbacks = this.events[event] || [];
190        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
191          args[_key - 1] = arguments[_key];
192        }
193        for (var i = 0, length = callbacks.length; i < length; i++) {
194          callbacks[i].apply(callbacks, args);
195        }
196      }
197    }, {
198      key: "on",
199      value: function on(event, callback) {
200        var _this2 = this;
201        var _a;
202        ((_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.push(callback)) || (this.events[event] = [callback]);
203        return function () {
204          var _a;
205          _this2.events[event] = (_a = _this2.events[event]) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
206            return callback !== i;
207          });
208        };
209      }
210    }, {
211      key: "off",
212      value: function off(event, callback) {
213        var _a;
214        this.events[event] = (_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
215          return callback !== i;
216        });
217      }
218    }, {
219      key: "destroy",
220      value: function destroy() {
221        this.events = {};
222      }
223    }]);
224    return Emitter;
225  }();
226  var LINE_HEIGHT = 100 / 6;
227  var VirtualScroll = /*#__PURE__*/function () {
228    function VirtualScroll(element, _ref3) {
229      var _this3 = this;
230      var _ref3$wheelMultiplier = _ref3.wheelMultiplier,
231        wheelMultiplier = _ref3$wheelMultiplier === void 0 ? 1 : _ref3$wheelMultiplier,
232        _ref3$touchMultiplier = _ref3.touchMultiplier,
233        touchMultiplier = _ref3$touchMultiplier === void 0 ? 1 : _ref3$touchMultiplier;
234      _classCallCheck(this, VirtualScroll);
235      this.lastDelta = {
236        x: 0,
237        y: 0
238      };
239      this.windowWidth = 0;
240      this.windowHeight = 0;
241      this.onTouchStart = function (event) {
242        var _ref4 = event.targetTouches ? event.targetTouches[0] : event,
243          clientX = _ref4.clientX,
244          clientY = _ref4.clientY;
245        _this3.touchStart.x = clientX;
246        _this3.touchStart.y = clientY;
247        _this3.lastDelta = {
248          x: 0,
249          y: 0
250        };
251        _this3.emitter.emit('scroll', {
252          deltaX: 0,
253          deltaY: 0,
254          event: event
255        });
256      };
257      this.onTouchMove = function (event) {
258        var _a, _b, _c, _d;
259        var _ref5 = event.targetTouches ? event.targetTouches[0] : event,
260          clientX = _ref5.clientX,
261          clientY = _ref5.clientY;
262        var deltaX = -(clientX - ((_b = (_a = _this3.touchStart) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0)) * _this3.touchMultiplier;
263        var deltaY = -(clientY - ((_d = (_c = _this3.touchStart) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0)) * _this3.touchMultiplier;
264        _this3.touchStart.x = clientX;
265        _this3.touchStart.y = clientY;
266        _this3.lastDelta = {
267          x: deltaX,
268          y: deltaY
269        };
270        _this3.emitter.emit('scroll', {
271          deltaX: deltaX,
272          deltaY: deltaY,
273          event: event
274        });
275      };
276      this.onTouchEnd = function (event) {
277        _this3.emitter.emit('scroll', {
278          deltaX: _this3.lastDelta.x,
279          deltaY: _this3.lastDelta.y,
280          event: event
281        });
282      };
283      this.onWheel = function (event) {
284        var deltaX = event.deltaX,
285          deltaY = event.deltaY,
286          deltaMode = event.deltaMode;
287        var multiplierX = deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? _this3.windowWidth : 1;
288        var multiplierY = deltaMode === 1 ? LINE_HEIGHT : deltaMode === 2 ? _this3.windowHeight : 1;
289        deltaX *= multiplierX;
290        deltaY *= multiplierY;
291        deltaX *= _this3.wheelMultiplier;
292        deltaY *= _this3.wheelMultiplier;
293        _this3.emitter.emit('scroll', {
294          deltaX: deltaX,
295          deltaY: deltaY,
296          event: event
297        });
298      };
299      this.onWindowResize = function () {
300        _this3.windowWidth = window.innerWidth;
301        _this3.windowHeight = window.innerHeight;
302      };
303      this.element = element;
304      this.wheelMultiplier = wheelMultiplier;
305      this.touchMultiplier = touchMultiplier;
306      this.touchStart = {
307        x: null,
308        y: null
309      };
310      this.emitter = new Emitter();
311      window.addEventListener('resize', this.onWindowResize, false);
312      this.onWindowResize();
313      this.element.addEventListener('wheel', this.onWheel, {
314        passive: false
315      });
316      this.element.addEventListener('touchstart', this.onTouchStart, {
317        passive: false
318      });
319      this.element.addEventListener('touchmove', this.onTouchMove, {
320        passive: false
321      });
322      this.element.addEventListener('touchend', this.onTouchEnd, {
323        passive: false
324      });
325    }
326    _createClass(VirtualScroll, [{
327      key: "on",
328      value: function on(event, callback) {
329        return this.emitter.on(event, callback);
330      }
331    }, {
332      key: "destroy",
333      value: function destroy() {
334        this.emitter.destroy();
335        window.removeEventListener('resize', this.onWindowResize, false);
336        this.element.removeEventListener('wheel', this.onWheel);
337        this.element.removeEventListener('touchstart', this.onTouchStart);
338        this.element.removeEventListener('touchmove', this.onTouchMove);
339        this.element.removeEventListener('touchend', this.onTouchEnd);
340      }
341    }]);
342    return VirtualScroll;
343  }();
344  var Lenis = /*#__PURE__*/function () {
345    function Lenis() {
346      var _this4 = this;
347      var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
348        _ref6$wrapper = _ref6.wrapper,
349        wrapper = _ref6$wrapper === void 0 ? window : _ref6$wrapper,
350        _ref6$content = _ref6.content,
351        content = _ref6$content === void 0 ? document.documentElement : _ref6$content,
352        _ref6$wheelEventsTarg = _ref6.wheelEventsTarget,
353        wheelEventsTarget = _ref6$wheelEventsTarg === void 0 ? wrapper : _ref6$wheelEventsTarg,
354        _ref6$eventsTarget = _ref6.eventsTarget,
355        eventsTarget = _ref6$eventsTarget === void 0 ? wheelEventsTarget : _ref6$eventsTarget,
356        _ref6$smoothWheel = _ref6.smoothWheel,
357        smoothWheel = _ref6$smoothWheel === void 0 ? true : _ref6$smoothWheel,
358        _ref6$syncTouch = _ref6.syncTouch,
359        syncTouch = _ref6$syncTouch === void 0 ? false : _ref6$syncTouch,
360        _ref6$syncTouchLerp = _ref6.syncTouchLerp,
361        syncTouchLerp = _ref6$syncTouchLerp === void 0 ? 0.075 : _ref6$syncTouchLerp,
362        _ref6$touchInertiaMul = _ref6.touchInertiaMultiplier,
363        touchInertiaMultiplier = _ref6$touchInertiaMul === void 0 ? 35 : _ref6$touchInertiaMul,
364        duration = _ref6.duration,
365        _ref6$easing = _ref6.easing,
366        easing = _ref6$easing === void 0 ? function (t) {
367          return Math.min(1, 1.001 - Math.pow(2, -10 * t));
368        } : _ref6$easing,
369        _ref6$lerp = _ref6.lerp,
370        lerp = _ref6$lerp === void 0 ? 0.1 : _ref6$lerp,
371        _ref6$infinite = _ref6.infinite,
372        infinite = _ref6$infinite === void 0 ? false : _ref6$infinite,
373        _ref6$orientation = _ref6.orientation,
374        orientation = _ref6$orientation === void 0 ? 'vertical' : _ref6$orientation,
375        _ref6$gestureOrientat = _ref6.gestureOrientation,
376        gestureOrientation = _ref6$gestureOrientat === void 0 ? 'vertical' : _ref6$gestureOrientat,
377        _ref6$touchMultiplier = _ref6.touchMultiplier,
378        touchMultiplier = _ref6$touchMultiplier === void 0 ? 1 : _ref6$touchMultiplier,
379        _ref6$wheelMultiplier = _ref6.wheelMultiplier,
380        wheelMultiplier = _ref6$wheelMultiplier === void 0 ? 1 : _ref6$wheelMultiplier,
381        _ref6$autoResize = _ref6.autoResize,
382        autoResize = _ref6$autoResize === void 0 ? true : _ref6$autoResize,
383        prevent = _ref6.prevent,
384        virtualScroll = _ref6.virtualScroll,
385        _ref6$__experimental_ = _ref6.__experimental__naiveDimensions,
386        __experimental__naiveDimensions = _ref6$__experimental_ === void 0 ? false : _ref6$__experimental_;
387      _classCallCheck(this, Lenis);
388      this.__isScrolling = false;
389      this.__isStopped = false;
390      this.__isLocked = false;
391      this.userData = {};
392      this.lastVelocity = 0;
393      this.velocity = 0;
394      this.direction = 0;
395      this.onPointerDown = function (event) {
396        if (event.button === 1) {
397          _this4.reset();
398        }
399      };
400      this.onVirtualScroll = function (data) {
401        if (typeof _this4.options.virtualScroll === 'function' && _this4.options.virtualScroll(data) === false) return;
402        var deltaX = data.deltaX,
403          deltaY = data.deltaY,
404          event = data.event;
405        _this4.emitter.emit('virtual-scroll', {
406          deltaX: deltaX,
407          deltaY: deltaY,
408          event: event
409        });
410        if (event.ctrlKey) return;
411        var isTouch = event.type.includes('touch');
412        var isWheel = event.type.includes('wheel');
413        _this4.isTouching = event.type === 'touchstart' || event.type === 'touchmove';
414        var isTapToStop = _this4.options.syncTouch && isTouch && event.type === 'touchstart' && !_this4.isStopped && !_this4.isLocked;
415        if (isTapToStop) {
416          _this4.reset();
417          return;
418        }
419        var isClick = deltaX === 0 && deltaY === 0;
420        var isUnknownGesture = _this4.options.gestureOrientation === 'vertical' && deltaY === 0 || _this4.options.gestureOrientation === 'horizontal' && deltaX === 0;
421        if (isClick || isUnknownGesture) {
422          return;
423        }
424        var composedPath = event.composedPath();
425        composedPath = composedPath.slice(0, composedPath.indexOf(_this4.rootElement));
426        var prevent = _this4.options.prevent;
427        if (!!composedPath.find(function (node) {
428          var _a, _b, _c, _d, _e;
429          return node instanceof Element && (typeof prevent === 'function' && (prevent === null || prevent === void 0 ? void 0 : prevent(node)) || ((_a = node.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(node, 'data-lenis-prevent')) || isTouch && ((_b = node.hasAttribute) === null || _b === void 0 ? void 0 : _b.call(node, 'data-lenis-prevent-touch')) || isWheel && ((_c = node.hasAttribute) === null || _c === void 0 ? void 0 : _c.call(node, 'data-lenis-prevent-wheel')) || ((_d = node.classList) === null || _d === void 0 ? void 0 : _d.contains('lenis')) && !((_e = node.classList) === null || _e === void 0 ? void 0 : _e.contains('lenis-stopped')));
430        })) return;
431        if (_this4.isStopped || _this4.isLocked) {
432          event.preventDefault();
433          return;
434        }
435        var isSmooth = _this4.options.syncTouch && isTouch || _this4.options.smoothWheel && isWheel;
436        if (!isSmooth) {
437          _this4.isScrolling = 'native';
438          _this4.animate.stop();
439          return;
440        }
441        event.preventDefault();
442        var delta = deltaY;
443        if (_this4.options.gestureOrientation === 'both') {
444          delta = Math.abs(deltaY) > Math.abs(deltaX) ? deltaY : deltaX;
445        } else if (_this4.options.gestureOrientation === 'horizontal') {
446          delta = deltaX;
447        }
448        var syncTouch = isTouch && _this4.options.syncTouch;
449        var isTouchEnd = isTouch && event.type === 'touchend';
450        var hasTouchInertia = isTouchEnd && Math.abs(delta) > 5;
451        if (hasTouchInertia) {
452          delta = _this4.velocity * _this4.options.touchInertiaMultiplier;
453        }
454        _this4.scrollTo(_this4.targetScroll + delta, Object.assign({
455          programmatic: false
456        }, syncTouch ? {
457          lerp: hasTouchInertia ? _this4.options.syncTouchLerp : 1
458        } : {
459          lerp: _this4.options.lerp,
460          duration: _this4.options.duration,
461          easing: _this4.options.easing
462        }));
463      };
464      this.onNativeScroll = function () {
465        clearTimeout(_this4.__resetVelocityTimeout);
466        delete _this4.__resetVelocityTimeout;
467        if (_this4.__preventNextNativeScrollEvent) {
468          delete _this4.__preventNextNativeScrollEvent;
469          return;
470        }
471        if (_this4.isScrolling === false || _this4.isScrolling === 'native') {
472          var lastScroll = _this4.animatedScroll;
473          _this4.animatedScroll = _this4.targetScroll = _this4.actualScroll;
474          _this4.lastVelocity = _this4.velocity;
475          _this4.velocity = _this4.animatedScroll - lastScroll;
476          _this4.direction = Math.sign(_this4.animatedScroll - lastScroll);
477          _this4.isScrolling = 'native';
478          _this4.emit();
479          if (_this4.velocity !== 0) {
480            _this4.__resetVelocityTimeout = setTimeout(function () {
481              _this4.lastVelocity = _this4.velocity;
482              _this4.velocity = 0;
483              _this4.isScrolling = false;
484              _this4.emit();
485            }, 400);
486          }
487        }
488      };
489      window.lenisVersion = version;
490      if (!wrapper || wrapper === document.documentElement || wrapper === document.body) {
491        wrapper = window;
492      }
493      this.options = {
494        wrapper: wrapper,
495        content: content,
496        wheelEventsTarget: wheelEventsTarget,
497        eventsTarget: eventsTarget,
498        smoothWheel: smoothWheel,
499        syncTouch: syncTouch,
500        syncTouchLerp: syncTouchLerp,
501        touchInertiaMultiplier: touchInertiaMultiplier,
502        duration: duration,
503        easing: easing,
504        lerp: lerp,
505        infinite: infinite,
506        gestureOrientation: gestureOrientation,
507        orientation: orientation,
508        touchMultiplier: touchMultiplier,
509        wheelMultiplier: wheelMultiplier,
510        autoResize: autoResize,
511        prevent: prevent,
512        virtualScroll: virtualScroll,
513        __experimental__naiveDimensions: __experimental__naiveDimensions
514      };
515      this.animate = new Animate();
516      this.emitter = new Emitter();
517      this.dimensions = new Dimensions({
518        wrapper: wrapper,
519        content: content,
520        autoResize: autoResize
521      });
522      this.updateClassName();
523      this.userData = {};
524      this.time = 0;
525      this.velocity = this.lastVelocity = 0;
526      this.isLocked = false;
527      this.isStopped = false;
528      this.isScrolling = false;
529      this.targetScroll = this.animatedScroll = this.actualScroll;
530      this.options.wrapper.addEventListener('scroll', this.onNativeScroll, false);
531      this.options.wrapper.addEventListener('pointerdown', this.onPointerDown, false);
532      this.virtualScroll = new VirtualScroll(eventsTarget, {
533        touchMultiplier: touchMultiplier,
534        wheelMultiplier: wheelMultiplier
535      });
536      this.virtualScroll.on('scroll', this.onVirtualScroll);
537    }
538    _createClass(Lenis, [{
539      key: "destroy",
540      value: function destroy() {
541        this.emitter.destroy();
542        this.options.wrapper.removeEventListener('scroll', this.onNativeScroll, false);
543        this.options.wrapper.removeEventListener('pointerdown', this.onPointerDown, false);
544        this.virtualScroll.destroy();
545        this.dimensions.destroy();
546        this.cleanUpClassName();
547      }
548    }, {
549      key: "on",
550      value: function on(event, callback) {
551        return this.emitter.on(event, callback);
552      }
553    }, {
554      key: "off",
555      value: function off(event, callback) {
556        return this.emitter.off(event, callback);
557      }
558    }, {
559      key: "setScroll",
560      value: function setScroll(scroll) {
561        if (this.isHorizontal) {
562          this.rootElement.scrollLeft = scroll;
563        } else {
564          this.rootElement.scrollTop = scroll;
565        }
566      }
567    }, {
568      key: "resize",
569      value: function resize() {
570        this.dimensions.resize();
571      }
572    }, {
573      key: "emit",
574      value: function emit() {
575        this.emitter.emit('scroll', this);
576      }
577    }, {
578      key: "reset",
579      value: function reset() {
580        this.isLocked = false;
581        this.isScrolling = false;
582        this.animatedScroll = this.targetScroll = this.actualScroll;
583        this.lastVelocity = this.velocity = 0;
584        this.animate.stop();
585      }
586    }, {
587      key: "start",
588      value: function start() {
589        if (!this.isStopped) return;
590        this.isStopped = false;
591        this.reset();
592      }
593    }, {
594      key: "stop",
595      value: function stop() {
596        if (this.isStopped) return;
597        this.isStopped = true;
598        this.animate.stop();
599        this.reset();
600      }
601    }, {
602      key: "raf",
603      value: function raf(time) {
604        var deltaTime = time - (this.time || time);
605        this.time = time;
606        this.animate.advance(deltaTime * 0.001);
607      }
608    }, {
609      key: "scrollTo",
610      value: function scrollTo(target) {
611        var _this5 = this;
612        var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
613          _ref7$offset = _ref7.offset,
614          offset = _ref7$offset === void 0 ? 0 : _ref7$offset,
615          _ref7$immediate = _ref7.immediate,
616          immediate = _ref7$immediate === void 0 ? false : _ref7$immediate,
617          _ref7$lock = _ref7.lock,
618          lock = _ref7$lock === void 0 ? false : _ref7$lock,
619          _ref7$duration = _ref7.duration,
620          duration = _ref7$duration === void 0 ? this.options.duration : _ref7$duration,
621          _ref7$easing = _ref7.easing,
622          easing = _ref7$easing === void 0 ? this.options.easing : _ref7$easing,
623          _ref7$lerp = _ref7.lerp,
624          lerp = _ref7$lerp === void 0 ? this.options.lerp : _ref7$lerp,
625          _onStart = _ref7.onStart,
626          onComplete = _ref7.onComplete,
627          _ref7$force = _ref7.force,
628          force = _ref7$force === void 0 ? false : _ref7$force,
629          _ref7$programmatic = _ref7.programmatic,
630          programmatic = _ref7$programmatic === void 0 ? true : _ref7$programmatic,
631          _ref7$userData = _ref7.userData,
632          userData = _ref7$userData === void 0 ? {} : _ref7$userData;
633        if ((this.isStopped || this.isLocked) && !force) return;
634        if (typeof target === 'string' && ['top', 'left', 'start'].includes(target)) {
635          target = 0;
636        } else if (typeof target === 'string' && ['bottom', 'right', 'end'].includes(target)) {
637          target = this.limit;
638        } else {
639          var node;
640          if (typeof target === 'string') {
641            node = document.querySelector(target);
642          } else if (target instanceof HTMLElement && (target === null || target === void 0 ? void 0 : target.nodeType)) {
643            node = target;
644          }
645          if (node) {
646            if (this.options.wrapper !== window) {
647              var wrapperRect = this.rootElement.getBoundingClientRect();
648              offset -= this.isHorizontal ? wrapperRect.left : wrapperRect.top;
649            }
650            var rect = node.getBoundingClientRect();
651            target = (this.isHorizontal ? rect.left : rect.top) + this.animatedScroll;
652          }
653        }
654        if (typeof target !== 'number') return;
655        target += offset;
656        target = Math.round(target);
657        if (this.options.infinite) {
658          if (programmatic) {
659            this.targetScroll = this.animatedScroll = this.scroll;
660          }
661        } else {
662          target = clamp(0, target, this.limit);
663        }
664        if (target === this.targetScroll) return;
665        this.userData = userData;
666        if (immediate) {
667          this.animatedScroll = this.targetScroll = target;
668          this.setScroll(this.scroll);
669          this.reset();
670          this.preventNextNativeScrollEvent();
671          this.emit();
672          onComplete === null || onComplete === void 0 ? void 0 : onComplete(this);
673          this.userData = {};
674          return;
675        }
676        if (!programmatic) {
677          this.targetScroll = target;
678        }
679        this.animate.fromTo(this.animatedScroll, target, {
680          duration: duration,
681          easing: easing,
682          lerp: lerp,
683          onStart: function onStart() {
684            if (lock) _this5.isLocked = true;
685            _this5.isScrolling = 'smooth';
686            _onStart === null || _onStart === void 0 ? void 0 : _onStart(_this5);
687          },
688          onUpdate: function onUpdate(value, completed) {
689            _this5.isScrolling = 'smooth';
690            _this5.lastVelocity = _this5.velocity;
691            _this5.velocity = value - _this5.animatedScroll;
692            _this5.direction = Math.sign(_this5.velocity);
693            _this5.animatedScroll = value;
694            _this5.setScroll(_this5.scroll);
695            if (programmatic) {
696              _this5.targetScroll = value;
697            }
698            if (!completed) _this5.emit();
699            if (completed) {
700              _this5.reset();
701              _this5.emit();
702              onComplete === null || onComplete === void 0 ? void 0 : onComplete(_this5);
703              _this5.userData = {};
704              _this5.preventNextNativeScrollEvent();
705            }
706          }
707        });
708      }
709    }, {
710      key: "preventNextNativeScrollEvent",
711      value: function preventNextNativeScrollEvent() {
712        var _this6 = this;
713        this.__preventNextNativeScrollEvent = true;
714        requestAnimationFrame(function () {
715          delete _this6.__preventNextNativeScrollEvent;
716        });
717      }
718    }, {
719      key: "rootElement",
720      get: function get() {
721        return this.options.wrapper === window ? document.documentElement : this.options.wrapper;
722      }
723    }, {
724      key: "limit",
725      get: function get() {
726        if (this.options.__experimental__naiveDimensions) {
727          if (this.isHorizontal) {
728            return this.rootElement.scrollWidth - this.rootElement.clientWidth;
729          } else {
730            return this.rootElement.scrollHeight - this.rootElement.clientHeight;
731          }
732        } else {
733          return this.dimensions.limit[this.isHorizontal ? 'x' : 'y'];
734        }
735      }
736    }, {
737      key: "isHorizontal",
738      get: function get() {
739        return this.options.orientation === 'horizontal';
740      }
741    }, {
742      key: "actualScroll",
743      get: function get() {
744        return this.isHorizontal ? this.rootElement.scrollLeft : this.rootElement.scrollTop;
745      }
746    }, {
747      key: "scroll",
748      get: function get() {
749        return this.options.infinite ? modulo(this.animatedScroll, this.limit) : this.animatedScroll;
750      }
751    }, {
752      key: "progress",
753      get: function get() {
754        return this.limit === 0 ? 1 : this.scroll / this.limit;
755      }
756    }, {
757      key: "isScrolling",
758      get: function get() {
759        return this.__isScrolling;
760      },
761      set: function set(value) {
762        if (this.__isScrolling !== value) {
763          this.__isScrolling = value;
764          this.updateClassName();
765        }
766      }
767    }, {
768      key: "isStopped",
769      get: function get() {
770        return this.__isStopped;
771      },
772      set: function set(value) {
773        if (this.__isStopped !== value) {
774          this.__isStopped = value;
775          this.updateClassName();
776        }
777      }
778    }, {
779      key: "isLocked",
780      get: function get() {
781        return this.__isLocked;
782      },
783      set: function set(value) {
784        if (this.__isLocked !== value) {
785          this.__isLocked = value;
786          this.updateClassName();
787        }
788      }
789    }, {
790      key: "isSmooth",
791      get: function get() {
792        return this.isScrolling === 'smooth';
793      }
794    }, {
795      key: "className",
796      get: function get() {
797        var className = 'lenis';
798        if (this.isStopped) className += ' lenis-stopped';
799        if (this.isLocked) className += ' lenis-locked';
800        if (this.isScrolling) className += ' lenis-scrolling';
801        if (this.isScrolling === 'smooth') className += ' lenis-smooth';
802        return className;
803      }
804    }, {
805      key: "updateClassName",
806      value: function updateClassName() {
807        this.cleanUpClassName();
808        this.rootElement.className = "".concat(this.rootElement.className, " ").concat(this.className).trim();
809      }
810    }, {
811      key: "cleanUpClassName",
812      value: function cleanUpClassName() {
813        this.rootElement.className = this.rootElement.className.replace(/lenis(-\w+)?/g, '').trim();
814      }
815    }]);
816    return Lenis;
817  }();
818  return Lenis;
819});

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.