PageSourceSearch

https://nalog.gov.by/local/templates/main_template/js/stickySidebar.js

js nalog.gov.by collected 2026-09-24 17:35:20 UTC 35,376 bytes, 700 lines download raw bytes

1(function (global, factory) {
2    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3        typeof define === 'function' && define.amd ? define(['exports'], factory) :
4            (factory((global.StickySidebar = {})));
5}(this, (function (exports) { 'use strict';
6
7    var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
9
10
11    function unwrapExports (x) {
12        return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
13    }
14
15    function createCommonjsModule(fn, module) {
16        return module = { exports: {} }, fn(module, module.exports), module.exports;
17    }
18
19    var stickySidebar = createCommonjsModule(function (module, exports) {
20        (function (global, factory) {
21            if (typeof undefined === "function" && undefined.amd) {
22                undefined(['exports'], factory);
23            } else {
24                factory(exports);
25            }
26        })(commonjsGlobal, function (exports) {
27            Object.defineProperty(exports, "__esModule", {
28                value: true
29            });
30
31            function _classCallCheck(instance, Constructor) {
32                if (!(instance instanceof Constructor)) {
33                    throw new TypeError("Cannot call a class as a function");
34                }
35            }
36
37            var _createClass = function () {
38                function defineProperties(target, props) {
39                    for (var i = 0; i < props.length; i++) {
40                        var descriptor = props[i];
41                        descriptor.enumerable = descriptor.enumerable || false;
42                        descriptor.configurable = true;
43                        if ("value" in descriptor) descriptor.writable = true;
44                        Object.defineProperty(target, descriptor.key, descriptor);
45                    }
46                }
47
48                return function (Constructor, protoProps, staticProps) {
49                    if (protoProps) defineProperties(Constructor.prototype, protoProps);
50                    if (staticProps) defineProperties(Constructor, staticProps);
51                    return Constructor;
52                };
53            }();
54
55            /**
56             * Sticky Sidebar JavaScript Plugin.
57             * @version 3.3.4
58             * @author Ahmed Bouhuolia <[email protected]>
59             * @license The MIT License (MIT)
60             */
61            var StickySidebar = function () {
62
63                // ---------------------------------
64                // # Define Constants
65                // ---------------------------------
66                //
67                var EVENT_KEY = '.stickySidebar';
68                var DEFAULTS = {
69                    /**
70                     * Additional top spacing of the element when it becomes sticky.
71                     * @type {Numeric|Function}
72                     */
73                    topSpacing: 0,
74
75                    /**
76                     * Additional bottom spacing of the element when it becomes sticky.
77                     * @type {Numeric|Function}
78                     */
79                    bottomSpacing: 0,
80
81                    /**
82                     * Container sidebar selector to know what the beginning and end of sticky element.
83                     * @type {String|False}
84                     */
85                    containerSelector: false,
86
87                    /**
88                     * Inner wrapper selector.
89                     * @type {String}
90                     */
91                    innerWrapperSelector: '.inner-wrapper-sticky',
92
93                    /**
94                     * The name of CSS class to apply to elements when they have become stuck.
95                     * @type {String|False}
96                     */
97                    stickyClass: 'is-affixed',
98
99                    /**
100                     * Detect when sidebar and its container change height so re-calculate their dimensions.
101                     * @type {Boolean}
102                     */
103                    resizeSensor: true,
104
105                    /**
106                     * The sidebar returns to its normal position if its width below this value.
107                     * @type {Numeric}
108                     */
109                    minWidth: false
110                };
111
112                // ---------------------------------
113                // # Class Definition
114                // ---------------------------------
115                //
116                /**
117                 * Sticky Sidebar Class.
118                 * @public
119                 */
120
121                var StickySidebar = function () {
122
123                    /**
124                     * Sticky Sidebar Constructor.
125                     * @constructor
126                     * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
127                     * @param {Object}
127 options - The options of sticky sidebar.
128                     */
129                    function StickySidebar(sidebar) {
130                        var _this = this;
131
132                        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
133
134                        _classCallCheck(this, StickySidebar);
135
136                        this.options = StickySidebar.extend(DEFAULTS, options);
137
138                        // Sidebar element query if there's no one, throw error.
139                        this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
140                        if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
141
142                        this.sidebarInner = false;
143                        if(this.sidebar){
144                          this.container = this.sidebar.parentElement;
145                        }
146
147                        // Current Affix Type of sidebar element.
148                        this.affixedType = 'STATIC';
149                        this.direction = 'down';
150                        this.support = {
151                            transform: false,
152                            transform3d: false
153                        };
154
155                        this._initialized = false;
156                        this._reStyle = false;
157                        this._breakpoint = false;
158
159                        // Dimensions of sidebar, container and screen viewport.
160                        this.dimensions = {
161                            translateY: 0,
162                            maxTranslateY: 0,
163                            topSpacing: 0,
164                            lastTopSpacing: 0,
165                            bottomSpacing: 0,
166                            lastBottomSpacing: 0,
167                            sidebarHeight: 0,
168                            sidebarWidth: 0,
169                            containerTop: 0,
170                            containerHeight: 0,
171                            viewportHeight: 0,
172                            viewportTop: 0,
173                            lastViewportTop: 0
174                        };
175
176                        // Bind event handlers for referencability.
177                        ['handleEvent'].forEach(function (method) {
178                            _this[method] = _this[method].bind(_this);
179                        });
180
181                        // Initialize sticky sidebar for first time.
182                        this.initialize();
183                    }
184
185                    /**
186                     * Initializes the sticky sidebar by adding inner wrapper, define its container,
187                     * min-width breakpoint, calculating dimensions, adding helper classes and inline style.
188                     * @private
189                     */
190
191
192                    _createClass(StickySidebar, [{
193                        key: 'initialize',
194                        value: function initialize() {
195                            var _this2 = this;
196
197                            this._setSupportFeatures();
198
199                            // Get sticky sidebar inner wrapper, if not found, will create one.
200                            if (this.options.innerWrapperSelector && this.sidebar) {
201                                this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
202
203                                if (null === this.sidebarInner) this.sidebarInner = false;
204                            }
205
206                            if (!this.sidebarInner) {
207                                var wrapper = document.createElement('div');
208                                wrapper.setAttribute('class', 'inner-wrapper-sticky');
209                                this.sidebar.appendChild(wrapper);
210
211                                while (this.sidebar.firstChild != wrapper) {
212                                    wrapper.appendChild(this.sidebar.firstChild);
213                                }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
214                            }
215
216                            // Container wrapper of the sidebar.
217                            if (this.options.containerSelector) {
218                                var containers = document.querySelectorAll(this.options.containerSelector);
219                                containers = Array.prototype.slice.call(containers
219);
220
221                                containers.forEach(function (container, item) {
222                                    if (!container.contains(_this2.sidebar)) return;
223                                    _this2.container = container;
224                                });
225
226                                if (!containers.length) throw new Error("The container does not contains on the sidebar.");
227                            }
228
229                            // If top/bottom spacing is not function parse value to integer.
230                            if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
231
232                            if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
233
234                            // Breakdown sticky sidebar if screen width below `options.minWidth`.
235                            this._widthBreakpoint();
236
237                            // Calculate dimensions of sidebar, container and viewport.
238                            this.calcDimensions();
239
240                            // Affix sidebar in proper position.
241                            this.stickyPosition();
242
243                            // Bind all events.
244                            this.bindEvents();
245
246                            // Inform other properties the sticky 
246sidebar is initialized.
247                            this._initialized = true;
248                        }
249                    }, {
250                        key: 'bindEvents',
251                        value: function bindEvents() {
252                            window.addEventListener('resize', this, { passive: true, capture: false });
253                            window.addEventListener('scroll', this, { passive: true, capture: false });
254
255                            this.sidebar.addEventListener('update' + EVENT_KEY, this);
256
257                            if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
258                                new ResizeSensor(this.sidebarInner, this.handleEvent);
259                                new ResizeSensor(this.container, this.handleEvent);
260                            }
261                        }
262                    }, {
263                        key: 'handleEvent',
264                        value: function handleEvent(event) {
265                            this.updateSticky(event);
266                        }
267                    }, {
268                        key: 'calcDimensions',
269                        value: function calcDimensions() {
270                            if (this._breakpoint) return;
271                            var dims = this.dimensions;
272
273                            // Container of sticky sidebar dimensions.
274                            dims.containerTop = StickySidebar.offsetRelative(this.container).top;
275                            dims.containerHeight = this.container.clientHeight;
276                            dims.containerBottom = dims.containerTop + dims.containerHeight;
277
278                            // Sidebar dimensions.
279                            dims.sidebarHeight = this.sidebarInner.offsetHeight;
280                            dims.sidebarWidth = this.sidebarInner.offsetWidth;
281
282                            // Screen viewport dimensions.
283                            dims.viewportHeight = window.innerHeight;
284
285                            // Maximum sidebar translate Y.
286                            dims.maxTranslateY = dims.containerHeight - dims.sidebarHeight;
287
288                            this._calcDimensionsWithScroll();
289                        }
290                    }, {
291                        key: '_calcDimensionsWithScroll',
292                        value: function _calcDimensionsWithScroll() {
293                            var dims = this.dimensions;
294
295                            dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
296
297                            dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
298                            dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
299                            dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
300
301                            dims.topSpacing = this.options.topSpacing;
302                            dims.bottomSpacing = this.options.bottomSpacing;
303
304                            if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
305
306                            if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
307
308                            if ('VIEWPORT-TOP' === this.affixedType) {
309                                // Adjust translate Y in the case decrease top spacing value.
310                                if (dims.topSpacing < dims.lastTopSpacing) {
311                                    dims.translateY += dims.lastTopSpacing - dims.topSpacing;
312                                    this._reStyle = true;
313                                }
314                            } else if ('VIEWPORT-BOTTOM' === this.affixedType) {
315                                // Adjust translate Y in the case decrease bottom spacing value.
316                                if (dims.bottomSpacing < dims.lastBottomSpacing) {
317                                    dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing;
318                                    this._reStyle = true;
319                                }
320                            }
321
322                            dims.lastTopSpacing = dims.topSpacing;
323                            dims.lastBottomSpacing = dims.bottomSpacing;
324                        }
325                    }, {
326                        key: 'isSidebarFitsViewport',
327                        value: function isSidebarFitsViewport() {
328                            var dims = this.dimensions;
329                            var offset = this.scrollDirection === 'down' ? dims.lastBottomSpacing : dims.lastTopSpacing;
330                            return this.dimensions.sidebarHeight + offset < this.dimensions.viewportHe
330ight;
331                        }
332                    }, {
333                        key: 'observeScrollDir',
334                        value: function observeScrollDir() {
335                            var dims = this.dimensions;
336                            if (dims.lastViewportTop === dims.viewportTop) return;
337
338                            var furthest = 'down' === this.direction ? Math.min : Math.max;
339
340                            // If the browser is scrolling not in the same direction.
341                            if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
342                        }
343                    }, {
344                        key: 'getAffixType',
345                        value: function getAffixType() {
346                            this._calcDimensionsWithScroll();
347                            var dims = this.dimensions;
348                            var colliderTop = dims.viewportTop + dims.topSpacing;
349                            var affixType = this.affixedType;
350
351                            if (colliderTop <= dims.containerTop || dims.containerHeight <= dims.sidebarHeight) {
352                                dims.translateY = 0;
353                                affixType = 'STATIC';
354                            } else {
355                                affixType = 'up' === this.direction ? this._getAffixTypeScrollingUp() : this._getAffixTypeScrollingDown();
356                            }
357
358                            // Make sure the translate Y is not bigger than container height.
359                            dims.translateY = Math.max(0, dims.translateY);
360                            dims.translateY = Math.min(dims.containerHeight, dims.translateY);
361                            dims.translateY = Math.round(dims.translateY);
362
363                            dims.lastViewportTop = dims.viewportTop;
364                            return affixType;
365                        }
366                    }, {
367                        key: '_getAffixTypeScrollingDown',
368                        value: function _getAffixTypeScrollingDown() {
369                            var dims = this.dimensions;
370                            var sidebarBottom = dims.sidebarHeight + dims.containerTop;
371                            var colliderTop = dims.viewportTop + dims.topSpacing;
372                            var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
373                            var affixType = this.affixedType;
374
375                            if (this.isSidebarFitsViewport()) {
376                                if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
377                                    dims.translateY = dims.containerBottom - sidebarBottom;
378                                    affixType = 'CONTAINER-BOTTOM';
379                                } else if (colliderTop >= dims.containerTop) {
380                                    dims.translateY = colliderTop - dims.containerTop;
381                                    affixType = 'VIEWPORT-TOP';
382                                }
383                            } else {
384                                if (dims.containerBottom <= colliderBottom) {
385                                    dims.translateY = dims.containerBottom - sidebarBottom;
386                                    affixType = 'CONTAINER-BOTTOM';
387                                } else if (sidebarBottom + dims.translateY <= colliderBottom) {
388                                    dims.translateY = colliderBottom - sidebarBottom;
389                                    affixType = 'VIEWPORT-BOTTOM';
390                                } else if (dims.containerTop + dims.translateY <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
391                                    affixType = 'VIEWPORT-UNBOTTOM';
392                                }
393                            }
394
395                            return affixType;
396                        }
397                    }, {
398                        key: '_getAffixTypeScrollingUp',
399                        value: function _getAffixTypeScrollingUp() {
400                            var dims = this.dimensions;
401                            var sidebarBottom = dims.sidebarHeight + dims.containerTop;
402                            var colliderTop = dims.viewportTop + dims.topSpacing;
403                            var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
404                            var affixType = this.affixedType;
405
406                            if (colliderTop <= dims.translateY + dims.containerTop) {
407                                dims.translateY = colliderTop - dims.containerTop;
408                                affixType = 'VIEWPORT-TOP';
409                            } else if (dims.containerBottom <= colliderBottom) {
410                                dims.translateY = dims.containerBottom - sidebarBottom;
411                                affixType = 'CONTAINER-BOTTOM';
412                            } else if (!this.isSidebarFitsViewport()) {
413
414                                if (dims.containerTop <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
415                                    affixType = 'VIEWPORT-UNBOTTOM';
416                                }
417                            }
418
419                            return affixType;
420                        }
421                    }, {
422                        key: '_getStyle',
423                        value: function _getStyle(affixType) {
424                            if ('undefined' === typeof affixType) return;
425
426                            var style = { inner: {}, outer: {} };
427                            var dims = this.dimensions;
428
429                            switch (affixType) {
430                                case 'VIEWPORT-TOP':
431                                    style.inner = { position: 'fixed', top: dims.topSpacing,
432                                        left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
433                                    break;
434                                case 'VIEWPORT-BOTTOM':
435                                    style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
436                                        bottom: dims.bottomSpacing, width: dims.sidebarWidth };
437                                    break;
438                                case 'CONTAINER-BOTTOM':
439                                case 'VIEWPORT-UNBOTTOM':
440                                    var translate = this._getTranslate(0, dims.translateY + 'px');
441
442                                    if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
443                                    break;
444                            }
445
446                            switch (affixType) {
447                                case 'VIEWPORT-TOP':
448                                case 'VIEWPORT-BOTTOM':
449                                case 'VIEWPORT-UNBOTTOM':
450                                case 'CONTAINER-BOTTOM':
451                                    style.outer = { height: dims.sidebarHeight, position: 'relative' };
452                                    break;
453                            }
454
455                            style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
456                            style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
457                                bottom: '', width: '', transform: '' }, style.inner);
458
459                            return style;
460                        }
461                    }, {
462                        key: 'stickyPosition',
463                        value: function stickyPosition(force) {
464                            if (this._breakpoint) return;
465
466                            force = this._reStyle || force || false;
467
468                            var offsetTop = this.options.topSpacing;
469                            var offsetBottom = this.options.bottomSpacing;
470
471                            var affixType = this.getAffixType();
472                            var style = this._getStyle(affixType);
473
474                            if ((this.affixedType != affixType || force) && affixType) {
475                                var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
476                                StickySidebar.eventTrigger(this.sidebar, affixEvent);
477
478                                if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
479
480                                for (var key in style.outer) {
481                                    var unit = 'number' === typeof style.outer[key] ? 'px' : '';
482                                    this.sidebar.style[key] = style.outer[key] + unit;
483                                }
484
485                                for (var _key in style.inner) {
486                                    var _unit = 'number' === typeof style.inner[_key] ? 'px' : '';
487                                    this.sidebarInner.style[_key] = style.inner[_key] + _unit;
488                                }
489
490                                var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
491                                StickySidebar.eventTrigger(this.sidebar, affixedEvent);
492                            } else {
493                                if (this._initialized) this.sidebarInner.style.left = style.inner.left;
494                            }
495
496                            this.affixedType = affixType;
497                        }
498                    }, {
499                        key: '_widthBreakpoint',
500                        value: function _widthBreakpoint() {
501
502                            if (window.innerWidth <= this.options.minWidth) {
503                                this._breakpoint = true;
504                                this.affixedType = 'STATIC';
505
506                                this.sidebar.removeAttribute('style');
507                                StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
508                                this.sidebarInner.removeAttribute('style');
509                            } else {
510                                this._breakpoint = false;
vendor: 5,281 bytes, lines 511-602
511                            }
512                        }
513                    }, {
514                        key: 'updateSticky',
515                        value: function updateSticky() {
516                            var _this3 = this;
517
518                            var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
519
520                            if (this._running) return;
521                            this._running = true;
522
523                            (function (eventType) {
524                                requestAnimationFrame(function () {
525                                    switch (eventType) {
526                                        // When browser is scrolling and re-calculate just dimensions
527                                        // within scroll.
528                                        case 'scroll':
529                                            _this3._calcDimensionsWithScroll();
530                                            _this3.observeScrollDir();
531                                            _this3.stickyPosition();
532                                            break;
533
534                                        // When browser is resizing or there's no event, observe width
535                                        // breakpoint and re-calculate dimensions.
536                                        case 'resize':
537                                        default:
538                                            _this3._widthBreakpoint();
539                                            _this3.calcDimensions();
540                                            _this3.stickyPosition(true);
541                                            break;
542                                    }
543                                    _this3._running = false;
544                                });
545                            })(event.type);
546                        }
547                    }, {
548                        key: '_setSupportFeatures',
549                        value: function _setSupportFeatures() {
550                            var support = this.support;
551
552                            support.transform = StickySidebar.supportTransform();
553                            support.transform3d = StickySidebar.supportTransform(true);
554                        }
555                    }, {
556                        key: '_getTranslate',
557                        value: function _getTranslate() {
558                            var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
559                            var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
560                            var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
561
562                            if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
563                        }
564                    }, {
565                        key: 'destroy',
566                        value: function destroy() {
567                            window.removeEventListener('resize', this, { capture: false });
568                            window.removeEventListener('scroll', this, { capture: false });
569
570                            this.sidebar.classList.remove(this.options.stickyClass);
571                            this.sidebar.style.minHeight = '';
572
573                            this.sidebar.removeEventListener('update' + EVENT_KEY, this);
574
575                            var styleReset = { inner: {}, outer: {} };
576
577                            styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
578                            styleReset.outer = { height: '', position: '' };
579
580                            for (var key in styleReset.outer) {
581                                this.sidebar.style[key] = styleReset.outer[key];
582                            }for (var _key2 in styleReset.inner) {
583                                this.sidebarInner.style[_key2] = styleReset.inner[_key2];
584                            }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
585                                ResizeSensor.detach(this.sidebarInner, this.handleEvent);
586                                ResizeSensor.detach(this.container, this.handleEvent);
587                            }
588                        }
589                    }], [{
590                        key: 'supportTransform',
591                        value: function supportTransform(transform3d) {
592                            var result = false,
593                                property = transform3d ? 'perspective' : 'transform',
594                                upper = property.charAt(0).toUpperCase() + property.slice(1),
595                                prefixes = ['Webkit', 'Moz', 'O', 'ms'],
596                                support = document.createElement('support'),
597                                style = support.style;
598
599                            (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
600                                if (style[property] !== undefined) {
601                                    result = property;
602                                    return false;
603                                }
604                            });
605                            return result;
606                        }
607                    }, {
608                        key: 'eventTrigger',
609                        value: function eventTrigger(element, eventName, data) {
610                            try {
611                                var event = new CustomEvent(eventName, { detail: data });
612                            } catch (e) {
613                                var event = document.createEvent('CustomEvent');
614                                event.initCustomEvent(eventName, true, true, data);
615                            }
616                            element.dispatchEvent(event);
617                        }
618                    }, {
619                        key: 'extend',
620                        value: function extend(defaults, options) {
621                            var results = {};
622                            for (var key in defaults) {
623                                if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
624                            }
625                            return results;
626                        }
627                    }, {
628                        key: 'offsetRelative',
629                        value: function offsetRelative(element) {
630                            var result = { left: 0, top: 0 };
631
632                            do {
633                                var offsetTop = element.offsetTop;
634                                var offsetLeft = element.offsetLeft;
635
636                                if (!isNaN(offsetTop)) result.top += offsetTop;
637
638                                if (!isNaN(offsetLeft)) result.left += offsetLeft;
639
640                                element = 'BODY' === element.tagName ? element.parentElement : element.offsetParent;
641                            } while (element);
642                            return result;
643                        }
644                    }, {
645                        key: 'addClass',
646                        value: function addClass(element, className) {
647                            if (!StickySidebar.hasClass(element, className)) {
648                                if (element.classList) element.classList.add(className);else element.className += ' ' + className;
649                            }
650                        }
651                    }, {
652                        key: 'removeClass',
653                        value: function removeClass(element, className) {
654                            if (StickySidebar.hasClass(element, className)) {
655                                if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
656                            }
657                        }
658                    }, {
659                        key: 'hasClass',
660                        value: function hasClass(element, className) {
661                            if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
662                        }
663                    }, {
664                        key: 'defaults',
665                        get: function () {
666                            return DEFAULTS;
667                        }
668                    }]);
669
670                    return StickySidebar;
671                }();
672
673                return StickySidebar;
674            }();
675
676            exports.default = StickySidebar;
677
678
679            // Global
680            // -------------------------
681            window.StickySidebar = StickySidebar;
682        });
683    });
684
685    var stickySidebar$1 = unwrapExports(stickySidebar);
686
687    exports['default'] = stickySidebar$1;
688    exports.__moduleExports = stickySidebar;
689
690    Object.defineProperty(exports, '__esModule', { value: true });
691
692})));
693
694const sidebarBlock = document.querySelector('.sidebar');
695if(sidebarBlock){
696  var sidebar = new StickySidebar(sidebarBlock, {
697    topSpacing: 20,
698  });
699  sidebar.updateSticky();
700}

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.