{"version":3,"file":"lg-thumbnail.umd.js","sources":["../../../src/plugins/thumbnail/lg-thumbnail-settings.ts","../../../src/lg-events.ts","../../../src/plugins/thumbnail/lg-thumbnail.ts"],"sourcesContent":["interface ThumbnailStrings {\n    toggleThumbnails: string;\n}\n\nexport interface ThumbnailsSettings {\n    /**\n     * Enable thumbnails for the gallery\n     */\n    thumbnail: boolean;\n\n    /*\n     * Enable thumbnail animation.\n     */\n    animateThumb: boolean;\n\n    /**\n     * Position of selected thumbnail.\n     */\n    currentPagerPosition: 'left' | 'middle' | 'right';\n\n    /**\n     * Position of thumbnails when the width of all thumbnails combined is less than the gallery's width.\n     *\n     */\n    alignThumbnails: 'left' | 'middle' | 'right';\n\n    /**\n     * Width of each thumbnails.\n     */\n    thumbWidth: number;\n\n    /**\n     * Height of each thumbnails.\n     */\n    thumbHeight: string;\n\n    /**\n     * Spacing between each thumbnails\n     */\n    thumbMargin: number;\n\n    /**\n     * control where the thumbnails should be appended.\n     * By default, thumbnails are appended to '.lg-components' which has inbuilt open close transitions\n     * If you don't want initial thumbnails transitions, or want to do more customization,\n     * you can append thumbnails to the lightGalley outer div -\n     * <a href=\"/demos/thumbnails/#static-thumbnails\">Demo</a>\n     */\n    appendThumbnailsTo: '.lg-outer' | '.lg-components';\n\n    /**\n     * Enable toggle captions and thumbnails.\n     * @description not applicable if allowMediaOverlap is false\n     */\n    toggleThumb: boolean;\n\n    /**\n     * Enables desktop mouse drag support for thumbnails.\n     */\n    enableThumbDrag: boolean;\n\n    /**\n     * Enables thumbnail touch/swipe support for touch devices\n     */\n    enableThumbSwipe: boolean;\n\n    /**\n     * By setting the thumbnailSwipeThreshold (in px) you can set how far the user must swipe for the next/prev slide.\n     */\n    thumbnailSwipeThreshold: number;\n\n    /**\n     * You can automatically load thumbnails for YouTube videos from YouTube by setting loadYouTubeThumbnail true\n     */\n    loadYouTubeThumbnail: boolean;\n\n    /**\n     * You can specify the thumbnail size by setting respective number.\n     */\n    //@todo add demo\n    youTubeThumbSize: number;\n\n    /**\n     * Custom translation strings for aria-labels\n     */\n    thumbnailPluginStrings: ThumbnailStrings;\n}\n\nexport const thumbnailsSettings: ThumbnailsSettings = {\n    thumbnail: true,\n\n    animateThumb: true,\n    currentPagerPosition: 'middle',\n    alignThumbnails: 'middle',\n\n    thumbWidth: 100,\n    thumbHeight: '80px',\n    thumbMargin: 5,\n\n    appendThumbnailsTo: '.lg-components',\n    toggleThumb: false,\n\n    enableThumbDrag: true,\n    enableThumbSwipe: true,\n    thumbnailSwipeThreshold: 10,\n\n    loadYouTubeThumbnail: true,\n    youTubeThumbSize: 1,\n\n    thumbnailPluginStrings: {\n        toggleThumbnails: 'Toggle thumbnails',\n    } as ThumbnailStrings,\n};\n","import { LightGallery } from './lightgallery';\nimport { VideoSource } from './plugins/video/types';\n\n/**\n * List of lightGallery events\n * All events should be documented here\n * Below interfaces are used to build the website documentations\n * */\nexport const lGEvents: {\n    [key: string]: string;\n} = {\n    afterAppendSlide: 'lgAfterAppendSlide',\n    init: 'lgInit',\n    hasVideo: 'lgHasVideo',\n    containerResize: 'lgContainerResize',\n    updateSlides: 'lgUpdateSlides',\n    afterAppendSubHtml: 'lgAfterAppendSubHtml',\n    beforeOpen: 'lgBeforeOpen',\n    afterOpen: 'lgAfterOpen',\n    slideItemLoad: 'lgSlideItemLoad',\n    beforeSlide: 'lgBeforeSlide',\n    afterSlide: 'lgAfterSlide',\n    posterClick: 'lgPosterClick',\n    dragStart: 'lgDragStart',\n    dragMove: 'lgDragMove',\n    dragEnd: 'lgDragEnd',\n    beforeNextSlide: 'lgBeforeNextSlide',\n    beforePrevSlide: 'lgBeforePrevSlide',\n    beforeClose: 'lgBeforeClose',\n    afterClose: 'lgAfterClose',\n    rotateLeft: 'lgRotateLeft',\n    rotateRight: 'lgRotateRight',\n    flipHorizontal: 'lgFlipHorizontal',\n    flipVertical: 'lgFlipVertical',\n    autoplay: 'lgAutoplay',\n    autoplayStart: 'lgAutoplayStart',\n    autoplayStop: 'lgAutoplayStop',\n};\n\n// Follow the below format for the event documentation\n// @method is the method name when event is used with Angular/React components\n\n/**\n * Fired only once when lightGallery is initialized\n * @name lgInit\n * @method onInit\n * @example\n *   const lg = document.getElementById('custom-events-demo');\n *   // Perform any action on lightGallery initialization.\n *   // Init event returns the plugin instance that can be used to call any lightGalley public method\n *   let pluginInstance = null;\n *   lg.addEventListener('lgInit', (event) => {\n *      pluginInstance = event.detail.instance;\n *   });\n *   lightGallery(lg);\n * @see <a href=\"/docs/methods\">Methods<a>\n */\nexport interface InitDetail {\n    /**\n     * lightGallery plugin instance\n     */\n    instance: LightGallery;\n}\n\n/**\n * Fired when the slide content has been inserted into it's slide container.\n * @name lgAfterAppendSlide\n * @method onAfterAppendSlide\n */\nexport interface AfterAppendSlideEventDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired immediately before opening the gallery\n * @name lgBeforeOpen\n * @method onBeforeOpen\n */\nexport interface BeforeOpenDetail {}\n\n/**\n * Fired immediately after opening the gallery\n * @name lgAfterOpen\n * @method onAfterOpen\n */\nexport interface AfterOpenDetail {}\n\n/**\n * Fired once the media inside the slide has been completely loaded .\n * @name lgSlideItemLoad\n * @method onSlideItemLoad\n */\nexport interface SlideItemLoadDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * For the first slide, lightGallery adds some delay for displaying the loaded slide item.\n     * This delay is required for the transition effect when the slide item is displayed\n     * Respect the delay when you use this event\n     */\n    delay: number;\n\n    // Will be true for the first slide\n    isFirstSlide: boolean;\n}\n\n/**\n * Fired immediately before each slide transition.\n * @name lgBeforeSlide\n * @method onBeforeSlide\n * @example\n *   const lg = document.getElementById('custom-events-demo');\n *   // Perform any action before each slide transition\n *   lg.addEventListener('lgBeforeSlide', (event) => {\n *       const { index, prevIndex } = event.detail;\n *       alert(index, prevIndex);\n *   });\n *   lightGallery(lg);\n */\nexport interface BeforeSlideDetail {\n    /**\n     * Index of the previous slide\n     */\n    prevIndex: number;\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n    /**\n     * true if slide function called via thumbnail click\n     */\n    fromThumb: boolean;\n}\n\n/**\n * Fired immediately after each slide transition.\n * @name lgAfterSlide\n * @method onAfterSlide\n */\nexport interface AfterSlideDetail {\n    /**\n     * Index of the previous slide\n     */\n    prevIndex: number;\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n    /**\n     * true if slide function called via thumbnail click\n     */\n    fromThumb: boolean;\n}\n\n/**\n * Fired when the video poster is clicked.\n * @name lgPosterClick\n * @method onPosterClick\n */\nexport interface PosterClickDetail {}\n\n/**\n * Fired when the drag event to move to different slide starts.\n * @name lgDragStart\n * @method onDragStart\n */\nexport interface DragStartDetail {}\n\n/**\n * Fired periodically during the drag operation.\n * @name lgDragMove\n * @method onDragMove\n */\nexport interface DragMoveDetail {}\n\n/**\n * Fired when the user has finished the drag operation\n * @name lgDragEnd\n * @method onDragEnd\n */\nexport interface DragEndDetail {}\n\n/**\n * Fired immediately before the start of the close process.\n * @name lgBeforeClose\n * @method onBeforeClose\n */\nexport interface BeforeCloseDetail {}\n\n/**\n * Fired immediately once lightGallery is closed.\n * @name lgAfterClose\n * @method onAfterClose\n */\nexport interface AfterCloseDetail {\n    /**\n     * lightGallery plugin instance\n     */\n    instance: LightGallery;\n}\n\n/**\n * Fired immediately before each \"next\" slide transition\n * @name lgBeforeNextSlide\n * @method onBeforeNextSlide\n */\nexport interface BeforeNextSlideDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n}\n\n/**\n * Fired immediately before each \"prev\" slide transition\n * @name lgBeforePrevSlide\n * @method onBeforePrevSlide\n */\nexport interface BeforePrevSlideDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n    /**\n     * true if slide function called via touch event or mouse drag\n     */\n    fromTouch: boolean;\n}\n\n/**\n * Fired when the sub-html content (ex : title/ description) has been appended into the slide.\n * @name lgAfterAppendSubHtml\n * @method onAfterAppendSubHtml\n */\nexport interface AfterAppendSubHtmlDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the lightGallery container has been resized.\n * @name lgContainerResize\n * @method onContainerResize\n */\nexport interface ContainerResizeDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when lightGallery detects video slide\n * @name lgHasVideo\n * @method onHasVideo\n */\nexport interface HasVideoDetail {\n    /**\n     * Index of the slide,\n     */\n    index: number;\n    /**\n     * Video source\n     */\n    src: string;\n    /**\n     * HTML5 video source if available\n     * <p>\n       HTML5 video source = source: {\n            src: string;\n            type: string;\n        }[];\n        attributes: HTMLVideoElement;\n     * </p>\n     */\n    html5Video: VideoSource;\n    /**\n     * True if video has poster\n     */\n    hasPoster: boolean;\n}\n\n/**\n * Fired when the image is rotated in anticlockwise direction\n * @name lgRotateLeft\n * @method onRotateLeft\n */\nexport interface RotateLeftDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the image is rotated in clockwise direction\n * @name lgRotateRight\n * @method onRotateRight\n */\nexport interface RotateRightDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the image is flipped horizontally\n * @name lgFlipHorizontal\n * @method onFlipHorizontal\n */\nexport interface FlipHorizontalDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n\n/**\n * Fired when the image is flipped vertically\n * @name lgFlipVertical\n * @method onFlipVertical\n */\nexport interface FlipVerticalDetail {\n    /**\n     * Index of the slide\n     */\n    index: number;\n}\n","import {\n    ThumbnailsSettings,\n    thumbnailsSettings,\n} from './lg-thumbnail-settings';\nimport { LgQuery, lgQuery } from '../../lgQuery';\nimport { LightGallery } from '../../lightgallery';\nimport { GalleryItem } from '../../lg-utils';\nimport { lGEvents } from '../../lg-events';\n\ninterface ThumbDragUtils {\n    cords: {\n        startX: number;\n        endX: number;\n    };\n    isMoved: boolean;\n    newTranslateX: number;\n    startTime: Date;\n    endTime: Date;\n    touchMoveTime: number;\n}\ninterface ThumbnailGalleryItem extends GalleryItem {\n    thumb: string;\n}\nexport default class Thumbnail {\n    private core: LightGallery;\n    private $thumbOuter!: lgQuery;\n    private $lgThumb!: lgQuery;\n    private thumbOuterWidth = 0;\n    private thumbTotalWidth = 0;\n    private translateX = 0;\n    private thumbClickable = false;\n    private settings!: ThumbnailsSettings;\n    private $LG!: LgQuery;\n    constructor(instance: LightGallery, $LG: LgQuery) {\n        // get lightGallery core plugin instance\n        this.core = instance;\n        this.$LG = $LG;\n\n        return this;\n    }\n\n    init(): void {\n        // extend module default settings with lightGallery core settings\n        this.settings = {\n            ...thumbnailsSettings,\n            ...this.core.settings,\n        };\n        this.thumbOuterWidth = 0;\n        this.thumbTotalWidth =\n            this.core.galleryItems.length *\n            (this.settings.thumbWidth + this.settings.thumbMargin);\n\n        // Thumbnail animation value\n        this.translateX = 0;\n\n        this.setAnimateThumbStyles();\n\n        if (!this.core.settings.allowMediaOverlap) {\n            this.settings.toggleThumb = false;\n        }\n\n        if (this.settings.thumbnail) {\n            this.build();\n            if (this.settings.animateThumb) {\n                if (this.settings.enableThumbDrag) {\n                    this.enableThumbDrag();\n                }\n\n                if (this.settings.enableThumbSwipe) {\n                    this.enableThumbSwipe();\n                }\n\n                this.thumbClickable = false;\n            } else {\n                this.thumbClickable = true;\n            }\n\n            this.toggleThumbBar();\n            this.thumbKeyPress();\n        }\n    }\n\n    build(): void {\n        this.setThumbMarkup();\n        this.manageActiveClassOnSlideChange();\n        this.$lgThumb.first().on('click.lg touchend.lg', (e: CustomEvent) => {\n            const $target = this.$LG(e.target);\n            if (!$target.hasAttribute('data-lg-item-id')) {\n                return;\n            }\n            setTimeout(() => {\n                // In IE9 and bellow touch does not support\n                // Go to slide if browser does not support css transitions\n                if (this.thumbClickable && !this.core.lgBusy) {\n                    const index = parseInt($target.attr('data-lg-item-id'));\n                    this.core.slide(index, false, true, false);\n                }\n            }, 50);\n        });\n\n        this.core.LGel.on(`${lGEvents.beforeSlide}.thumb`, (event) => {\n            const { index } = event.detail;\n            this.animateThumb(index);\n        });\n        this.core.LGel.on(`${lGEvents.beforeOpen}.thumb`, () => {\n            this.thumbOuterWidth = this.core.outer.get().offsetWidth;\n        });\n\n        this.core.LGel.on(`${lGEvents.updateSlides}.thumb`, () => {\n            this.rebuildThumbnails();\n        });\n        this.core.LGel.on(`${lGEvents.containerResize}.thumb`, () => {\n            if (!this.core.lgOpened) return;\n            setTimeout(() => {\n                this.thumbOuterWidth = this.core.outer.get().offsetWidth;\n                this.animateThumb(this.core.index);\n                this.thumbOuterWidth = this.core.outer.get().offsetWidth;\n            }, 50);\n        });\n    }\n\n    setThumbMarkup(): void {\n        let thumbOuterClassNames = 'lg-thumb-outer ';\n\n        if (this.settings.alignThumbnails) {\n            thumbOuterClassNames += `lg-thumb-align-${this.settings.alignThumbnails}`;\n        }\n\n        const html = `<div class=\"${thumbOuterClassNames}\">\n        <div class=\"lg-thumb lg-group\">\n        </div>\n        </div>`;\n\n        this.core.outer.addClass('lg-has-thumb');\n\n        if (this.settings.appendThumbnailsTo === '.lg-components') {\n            this.core.$lgComponents.append(html);\n        } else {\n            this.core.outer.append(html);\n        }\n\n        this.$thumbOuter = this.core.outer.find('.lg-thumb-outer').first();\n        this.$lgThumb = this.core.outer.find('.lg-thumb').first();\n\n        if (this.settings.animateThumb) {\n            this.core.outer\n                .find('.lg-thumb')\n                .css('transition-duration', this.core.settings.speed + 'ms')\n                .css('width', this.thumbTotalWidth + 'px')\n                .css('position', 'relative');\n        }\n\n        this.setThumbItemHtml(\n            (this.core.galleryItems as unknown) as ThumbnailGalleryItem[],\n        );\n    }\n\n    enableThumbDrag(): void {\n        let thumbDragUtils: ThumbDragUtils = {\n            cords: {\n                startX: 0,\n                endX: 0,\n            },\n            isMoved: false,\n            newTranslateX: 0,\n            startTime: new Date(),\n            endTime: new Date(),\n            touchMoveTime: 0,\n        };\n\n        let isDragging = false;\n\n        this.$thumbOuter.addClass('lg-grab');\n\n        this.core.outer\n            .find('.lg-thumb')\n            .first()\n            .on('mousedown.lg.thumb', (e) => {\n                if (this.thumbTotalWidth > this.thumbOuterWidth) {\n                    // execute only on .lg-object\n                    e.preventDefault();\n                    thumbDragUtils.cords.startX = e.pageX;\n\n                    thumbDragUtils.startTime = new Date();\n                    this.thumbClickable = false;\n\n                    isDragging = true;\n\n                    // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723\n                    this.core.outer.get().scrollLeft += 1;\n                    this.core.outer.get().scrollLeft -= 1;\n\n                    // *\n                    this.$thumbOuter\n                        .removeClass('lg-grab')\n                        .addClass('lg-grabbing');\n                }\n            });\n\n        this.$LG(window).on(\n            `mousemove.lg.thumb.global${this.core.lgId}`,\n            (e) => {\n                if (!this.core.lgOpened) return;\n                if (isDragging) {\n                    thumbDragUtils.cords.endX = e.pageX;\n\n                    thumbDragUtils = this.onThumbTouchMove(thumbDragUtils);\n                }\n            },\n        );\n\n        this.$LG(window).on(`mouseup.lg.thumb.global${this.core.lgId}`, () => {\n            if (!this.core.lgOpened) return;\n            if (thumbDragUtils.isMoved) {\n                thumbDragUtils = this.onThumbTouchEnd(thumbDragUtils);\n            } else {\n                this.thumbClickable = true;\n            }\n\n            if (isDragging) {\n                isDragging = false;\n                this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab');\n            }\n        });\n    }\n\n    enableThumbSwipe(): void {\n        let thumbDragUtils: ThumbDragUtils = {\n            cords: {\n                startX: 0,\n                endX: 0,\n            },\n            isMoved: false,\n            newTranslateX: 0,\n            startTime: new Date(),\n            endTime: new Date(),\n            touchMoveTime: 0,\n        };\n\n        this.$lgThumb.on('touchstart.lg', (e: TouchEvent) => {\n            if (this.thumbTotalWidth > this.thumbOuterWidth) {\n                e.preventDefault();\n                thumbDragUtils.cords.startX = e.targetTouches[0].pageX;\n                this.thumbClickable = false;\n                thumbDragUtils.startTime = new Date();\n            }\n        });\n\n        this.$lgThumb.on('touchmove.lg', (e: TouchEvent) => {\n            if (this.thumbTotalWidth > this.thumbOuterWidth) {\n                e.preventDefault();\n                thumbDragUtils.cords.endX = e.targetTouches[0].pageX;\n                thumbDragUtils = this.onThumbTouchMove(thumbDragUtils);\n            }\n        });\n\n        this.$lgThumb.on('touchend.lg', () => {\n            if (thumbDragUtils.isMoved) {\n                thumbDragUtils = this.onThumbTouchEnd(thumbDragUtils);\n            } else {\n                this.thumbClickable = true;\n            }\n        });\n    }\n\n    // Rebuild thumbnails\n    rebuildThumbnails(): void {\n        // Remove transitions\n        this.$thumbOuter.addClass('lg-rebuilding-thumbnails');\n        setTimeout(() => {\n            this.thumbTotalWidth =\n                this.core.galleryItems.length *\n                (this.settings.thumbWidth + this.settings.thumbMargin);\n            this.$lgThumb.css('width', this.thumbTotalWidth + 'px');\n            this.$lgThumb.empty();\n            this.setThumbItemHtml(\n                (this.core.galleryItems as unknown) as ThumbnailGalleryItem[],\n            );\n            this.animateThumb(this.core.index);\n        }, 50);\n        setTimeout(() => {\n            this.$thumbOuter.removeClass('lg-rebuilding-thumbnails');\n        }, 200);\n    }\n\n    // @ts-check\n\n    setTranslate(value: number): void {\n        this.$lgThumb.css(\n            'transform',\n            'translate3d(-' + value + 'px, 0px, 0px)',\n        );\n    }\n\n    getPossibleTransformX(left: number): number {\n        if (left > this.thumbTotalWidth - this.thumbOuterWidth) {\n            left = this.thumbTotalWidth - this.thumbOuterWidth;\n        }\n\n        if (left < 0) {\n            left = 0;\n        }\n        return left;\n    }\n\n    animateThumb(index: number): void {\n        this.$lgThumb.css(\n            'transition-duration',\n            this.core.settings.speed + 'ms',\n        );\n        if (this.settings.animateThumb) {\n            let position = 0;\n            switch (this.settings.currentPagerPosition) {\n                case 'left':\n                    position = 0;\n                    break;\n                case 'middle':\n                    position =\n                        this.thumbOuterWidth / 2 - this.settings.thumbWidth / 2;\n                    break;\n                case 'right':\n                    position = this.thumbOuterWidth - this.settings.thumbWidth;\n            }\n            this.translateX =\n                (this.settings.thumbWidth + this.settings.thumbMargin) * index -\n                1 -\n                position;\n            if (this.translateX > this.thumbTotalWidth - this.thumbOuterWidth) {\n                this.translateX = this.thumbTotalWidth - this.thumbOuterWidth;\n            }\n\n            if (this.translateX < 0) {\n                this.translateX = 0;\n            }\n\n            this.setTranslate(this.translateX);\n        }\n    }\n\n    onThumbTouchMove(thumbDragUtils: ThumbDragUtils): ThumbDragUtils {\n        thumbDragUtils.newTranslateX = this.translateX;\n        thumbDragUtils.isMoved = true;\n\n        thumbDragUtils.touchMoveTime = new Date().valueOf();\n\n        thumbDragUtils.newTranslateX -=\n            thumbDragUtils.cords.endX - thumbDragUtils.cords.startX;\n\n        thumbDragUtils.newTranslateX = this.getPossibleTransformX(\n            thumbDragUtils.newTranslateX,\n        );\n\n        // move current slide\n        this.setTranslate(thumbDragUtils.newTranslateX);\n        this.$thumbOuter.addClass('lg-dragging');\n\n        return thumbDragUtils;\n    }\n\n    onThumbTouchEnd(thumbDragUtils: ThumbDragUtils): ThumbDragUtils {\n        thumbDragUtils.isMoved = false;\n        thumbDragUtils.endTime = new Date();\n        this.$thumbOuter.removeClass('lg-dragging');\n\n        const touchDuration =\n            thumbDragUtils.endTime.valueOf() -\n            thumbDragUtils.startTime.valueOf();\n        let distanceXnew =\n            thumbDragUtils.cords.endX - thumbDragUtils.cords.startX;\n        let speedX = Math.abs(distanceXnew) / touchDuration;\n        // Some magical numbers\n        // Can be improved\n        if (\n            speedX > 0.15 &&\n            thumbDragUtils.endTime.valueOf() - thumbDragUtils.touchMoveTime < 30\n        ) {\n            speedX += 1;\n\n            if (speedX > 2) {\n                speedX += 1;\n            }\n            speedX =\n                speedX +\n                speedX * (Math.abs(distanceXnew) / this.thumbOuterWidth);\n            this.$lgThumb.css(\n                'transition-duration',\n                Math.min(speedX - 1, 2) + 'settings',\n            );\n\n            distanceXnew = distanceXnew * speedX;\n\n            this.translateX = this.getPossibleTransformX(\n                this.translateX - distanceXnew,\n            );\n            this.setTranslate(this.translateX);\n        } else {\n            this.translateX = thumbDragUtils.newTranslateX;\n        }\n        if (\n            Math.abs(thumbDragUtils.cords.endX - thumbDragUtils.cords.startX) <\n            this.settings.thumbnailSwipeThreshold\n        ) {\n            this.thumbClickable = true;\n        }\n\n        return thumbDragUtils;\n    }\n\n    getThumbHtml(thumb: string, index: number): string {\n        const slideVideoInfo =\n            this.core.galleryItems[index].__slideVideoInfo || {};\n        let thumbImg;\n\n        if (slideVideoInfo.youtube) {\n            if (this.settings.loadYouTubeThumbnail) {\n                thumbImg =\n                    '//img.youtube.com/vi/' +\n                    slideVideoInfo.youtube[1] +\n                    '/' +\n                    this.settings.youTubeThumbSize +\n                    '.jpg';\n            } else {\n                thumbImg = thumb;\n            }\n        } else {\n            thumbImg = thumb;\n        }\n\n        return `<div data-lg-item-id=\"${index}\" class=\"lg-thumb-item ${\n            index === this.core.index ? ' active' : ''\n        }\" \n        style=\"width:${this.settings.thumbWidth}px; height: ${\n            this.settings.thumbHeight\n        };\n            margin-right: ${this.settings.thumbMargin}px;\">\n            <img data-lg-item-id=\"${index}\" src=\"${thumbImg}\" />\n        </div>`;\n    }\n\n    getThumbItemHtml(items: ThumbnailGalleryItem[]): string {\n        let thumbList = '';\n        for (let i = 0; i < items.length; i++) {\n            thumbList += this.getThumbHtml(items[i].thumb, i);\n        }\n\n        return thumbList;\n    }\n\n    setThumbItemHtml(items: ThumbnailGalleryItem[]): void {\n        const thumbList = this.getThumbItemHtml(items);\n        this.$lgThumb.html(thumbList);\n    }\n\n    setAnimateThumbStyles(): void {\n        if (this.settings.animateThumb) {\n            this.core.outer.addClass('lg-animate-thumb');\n        }\n    }\n\n    // Manage thumbnail active calss\n    manageActiveClassOnSlideChange(): void {\n        // manage active class for thumbnail\n        this.core.LGel.on(\n            `${lGEvents.beforeSlide}.thumb`,\n            (event: CustomEvent) => {\n                const $thumb = this.core.outer.find('.lg-thumb-item');\n                const { index } = event.detail;\n                $thumb.removeClass('active');\n                $thumb.eq(index).addClass('active');\n            },\n        );\n    }\n\n    // Toggle thumbnail bar\n    toggleThumbBar(): void {\n        if (this.settings.toggleThumb) {\n            this.core.outer.addClass('lg-can-toggle');\n            this.core.$toolbar.append(\n                '<button type=\"button\" aria-label=\"' +\n                    this.settings.thumbnailPluginStrings['toggleThumbnails'] +\n                    '\" class=\"lg-toggle-thumb lg-icon\"></button>',\n            );\n            this.core.outer\n                .find('.lg-toggle-thumb')\n                .first()\n                .on('click.lg', () => {\n                    this.core.outer.toggleClass('lg-components-open');\n                });\n        }\n    }\n\n    thumbKeyPress(): void {\n        this.$LG(window).on(`keydown.lg.thumb.global${this.core.lgId}`, (e) => {\n            if (!this.core.lgOpened || !this.settings.toggleThumb) return;\n\n            if (e.keyCode === 38) {\n                e.preventDefault();\n                this.core.outer.addClass('lg-components-open');\n            } else if (e.keyCode === 40) {\n                e.preventDefault();\n                this.core.outer.removeClass('lg-components-open');\n            }\n        });\n    }\n\n    destroy(): void {\n        if (this.settings.thumbnail) {\n            this.$LG(window).off(`.lg.thumb.global${this.core.lgId}`);\n            this.core.LGel.off('.lg.thumb');\n            this.core.LGel.off('.thumb');\n            this.$thumbOuter.remove();\n            this.core.outer.removeClass('lg-has-thumb');\n        }\n    }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwFO,IAAM,kBAAkB,GAAuB;QAClD,SAAS,EAAE,IAAI;QAEf,YAAY,EAAE,IAAI;QAClB,oBAAoB,EAAE,QAAQ;QAC9B,eAAe,EAAE,QAAQ;QAEzB,UAAU,EAAE,GAAG;QACf,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,CAAC;QAEd,kBAAkB,EAAE,gBAAgB;QACpC,WAAW,EAAE,KAAK;QAElB,eAAe,EAAE,IAAI;QACrB,gBAAgB,EAAE,IAAI;QACtB,uBAAuB,EAAE,EAAE;QAE3B,oBAA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