From 48811a58fa68b0772c5df9c013bb6e6bbfadc130 Mon Sep 17 00:00:00 2001 From: Marco Minerva Date: Tue, 19 Sep 2023 17:48:58 +0200 Subject: [PATCH] Libraries update --- .editorconfig | 10 +- .../RandomPhotos.BusinessLayer.csproj | 2 +- .../lib/photoswipe/photoswipe-lightbox.esm.js | 1949 +++++ .../photoswipe/photoswipe-lightbox.esm.js.map | 1 + .../photoswipe/photoswipe-lightbox.esm.min.js | 5 + .../wwwroot/lib/photoswipe/photoswipe.css | 420 + .../wwwroot/lib/photoswipe/photoswipe.esm.js | 7074 +++++++++++++++++ .../lib/photoswipe/photoswipe.esm.js.map | 1 + .../lib/photoswipe/photoswipe.esm.min.js | 5 + .../wwwroot/lib/photoswipe/photoswipe.min.css | 1 + .../lib/photoswipe/types/core/base.d.ts | 59 + .../lib/photoswipe/types/core/eventable.d.ts | 985 +++ .../types/gestures/drag-handler.d.ts | 58 + .../photoswipe/types/gestures/gestures.d.ts | 168 + .../types/gestures/tap-handler.d.ts | 40 + .../types/gestures/zoom-handler.d.ts | 48 + .../lib/photoswipe/types/keyboard.d.ts | 33 + .../photoswipe/types/lightbox/lightbox.d.ts | 104 + .../lib/photoswipe/types/main-scroll.d.ts | 90 + .../wwwroot/lib/photoswipe/types/opener.d.ts | 87 + .../lib/photoswipe/types/photoswipe.d.ts | 439 + .../lib/photoswipe/types/scroll-wheel.d.ts | 19 + .../lib/photoswipe/types/slide/content.d.ts | 134 + .../types/slide/get-thumb-bounds.d.ts | 23 + .../lib/photoswipe/types/slide/loader.d.ts | 70 + .../photoswipe/types/slide/pan-bounds.d.ts | 51 + .../photoswipe/types/slide/placeholder.d.ts | 16 + .../lib/photoswipe/types/slide/slide.d.ts | 230 + .../photoswipe/types/slide/zoom-level.d.ts | 83 + .../wwwroot/lib/photoswipe/types/types.d.ts | 7 + .../lib/photoswipe/types/ui/button-arrow.d.ts | 6 + .../lib/photoswipe/types/ui/button-close.d.ts | 3 + .../lib/photoswipe/types/ui/button-zoom.d.ts | 3 + .../types/ui/counter-indicator.d.ts | 2 + .../types/ui/loading-indicator.d.ts | 2 + .../lib/photoswipe/types/ui/ui-element.d.ts | 34 + .../wwwroot/lib/photoswipe/types/ui/ui.d.ts | 35 + .../lib/photoswipe/types/util/animations.d.ts | 64 + .../photoswipe/types/util/css-animation.d.ts | 51 + .../lib/photoswipe/types/util/dom-events.d.ts | 55 + .../types/util/spring-animation.d.ts | 33 + .../photoswipe/types/util/spring-easer.d.ts | 33 + .../lib/photoswipe/types/util/util.d.ts | 138 + .../photoswipe/types/util/viewport-size.d.ts | 58 + .../umd/photoswipe-lightbox.umd.min.js | 5 + .../lib/photoswipe/umd/photoswipe.umd.min.js | 5 + 46 files changed, 12736 insertions(+), 3 deletions(-) create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js.map create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.min.js create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.css create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.esm.js create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.esm.js.map create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.esm.min.js create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.min.css create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/core/base.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/core/eventable.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/gestures/drag-handler.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/gestures/gestures.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/gestures/tap-handler.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/gestures/zoom-handler.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/keyboard.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/lightbox/lightbox.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/main-scroll.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/opener.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/photoswipe.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/scroll-wheel.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/slide/content.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/slide/get-thumb-bounds.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/slide/loader.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/slide/pan-bounds.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/slide/placeholder.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/slide/slide.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/slide/zoom-level.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/types.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/ui/button-arrow.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/ui/button-close.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/ui/button-zoom.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/ui/counter-indicator.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/ui/loading-indicator.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/ui/ui-element.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/ui/ui.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/util/animations.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/util/css-animation.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/util/dom-events.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/util/spring-animation.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/util/spring-easer.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/util/util.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/types/util/viewport-size.d.ts create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/umd/photoswipe-lightbox.umd.min.js create mode 100644 src/RandomPhotos/wwwroot/lib/photoswipe/umd/photoswipe.umd.min.js diff --git a/.editorconfig b/.editorconfig index fe509d8..ccf30a8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -98,7 +98,10 @@ csharp_style_var_elsewhere = true:suggestion csharp_style_var_for_built_in_types = true:suggestion csharp_style_var_when_type_is_apparent = true:suggestion -# Expression-bodied members +# Constructor preferences +csharp_style_prefer_primary_constructors = true:suggestion + +# Expression-bodied members preferences csharp_style_expression_bodied_accessors = true:silent csharp_style_expression_bodied_constructors = false:silent csharp_style_expression_bodied_indexers = true:silent @@ -147,6 +150,7 @@ csharp_using_directive_placement = outside_namespace:suggestion # Struct preferences csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_prefer_readonly_struct_member = true:suggestion #### C# Formatting Rules #### @@ -161,6 +165,8 @@ csharp_new_line_between_query_expression_clauses = true csharp_style_allow_embedded_statements_on_same_line_experimental = false:error csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:error csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent # Indentation preferences csharp_indent_block_contents = true @@ -290,4 +296,4 @@ dotnet_diagnostic.IDE0058.severity = none dotnet_diagnostic.IDE0010.severity = none # IDE0072: Add missing cases -dotnet_diagnostic.IDE0072.severity = none +dotnet_diagnostic.IDE0072.severity = none \ No newline at end of file diff --git a/src/RandomPhotos.BusinessLayer/RandomPhotos.BusinessLayer.csproj b/src/RandomPhotos.BusinessLayer/RandomPhotos.BusinessLayer.csproj index 111ccfd..f462f8f 100644 --- a/src/RandomPhotos.BusinessLayer/RandomPhotos.BusinessLayer.csproj +++ b/src/RandomPhotos.BusinessLayer/RandomPhotos.BusinessLayer.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js new file mode 100644 index 0000000..f176363 --- /dev/null +++ b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js @@ -0,0 +1,1949 @@ +/*! + * PhotoSwipe Lightbox 5.4.1 - https://photoswipe.com + * (c) 2023 Dmytro Semenov + */ +/** @typedef {import('../photoswipe.js').Point} Point */ + +/** + * @template {keyof HTMLElementTagNameMap} T + * @param {string} className + * @param {T} tagName + * @param {Node} [appendToEl] + * @returns {HTMLElementTagNameMap[T]} + */ +function createElement(className, tagName, appendToEl) { + const el = document.createElement(tagName); + + if (className) { + el.className = className; + } + + if (appendToEl) { + appendToEl.appendChild(el); + } + + return el; +} +/** + * Get transform string + * + * @param {number} x + * @param {number} [y] + * @param {number} [scale] + * @returns {string} + */ + +function toTransformString(x, y, scale) { + let propValue = `translate3d(${x}px,${y || 0}px,0)`; + + if (scale !== undefined) { + propValue += ` scale3d(${scale},${scale},1)`; + } + + return propValue; +} +/** + * Apply width and height CSS properties to element + * + * @param {HTMLElement} el + * @param {string | number} w + * @param {string | number} h + */ + +function setWidthHeight(el, w, h) { + el.style.width = typeof w === 'number' ? `${w}px` : w; + el.style.height = typeof h === 'number' ? `${h}px` : h; +} +/** @typedef {LOAD_STATE[keyof LOAD_STATE]} LoadState */ + +/** @type {{ IDLE: 'idle'; LOADING: 'loading'; LOADED: 'loaded'; ERROR: 'error' }} */ + +const LOAD_STATE = { + IDLE: 'idle', + LOADING: 'loading', + LOADED: 'loaded', + ERROR: 'error' +}; +/** + * Check if click or keydown event was dispatched + * with a special key or via mouse wheel. + * + * @param {MouseEvent | KeyboardEvent} e + * @returns {boolean} + */ + +function specialKeyUsed(e) { + return 'button' in e && e.button === 1 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey; +} +/** + * Parse `gallery` or `children` options. + * + * @param {import('../photoswipe.js').ElementProvider} [option] + * @param {string} [legacySelector] + * @param {HTMLElement | Document} [parent] + * @returns HTMLElement[] + */ + +function getElementsFromOption(option, legacySelector, parent = document) { + /** @type {HTMLElement[]} */ + let elements = []; + + if (option instanceof Element) { + elements = [option]; + } else if (option instanceof NodeList || Array.isArray(option)) { + elements = Array.from(option); + } else { + const selector = typeof option === 'string' ? option : legacySelector; + + if (selector) { + elements = Array.from(parent.querySelectorAll(selector)); + } + } + + return elements; +} +/** + * Check if variable is PhotoSwipe class + * + * @param {any} fn + * @returns {boolean} + */ + +function isPswpClass(fn) { + return typeof fn === 'function' && fn.prototype && fn.prototype.goTo; +} +/** + * Check if browser is Safari + * + * @returns {boolean} + */ + +function isSafari() { + return !!(navigator.vendor && navigator.vendor.match(/apple/i)); +} + +/** @typedef {import('../lightbox/lightbox.js').default} PhotoSwipeLightbox */ + +/** @typedef {import('../photoswipe.js').default} PhotoSwipe */ + +/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */ + +/** @typedef {import('../photoswipe.js').DataSource} DataSource */ + +/** @typedef {import('../ui/ui-element.js').UIElementData} UIElementData */ + +/** @typedef {import('../slide/content.js').default} ContentDefault */ + +/** @typedef {import('../slide/slide.js').default} Slide */ + +/** @typedef {import('../slide/slide.js').SlideData} SlideData */ + +/** @typedef {import('../slide/zoom-level.js').default} ZoomLevel */ + +/** @typedef {import('../slide/get-thumb-bounds.js').Bounds} Bounds */ + +/** + * Allow adding an arbitrary props to the Content + * https://photoswipe.com/custom-content/#using-webp-image-format + * @typedef {ContentDefault & Record} Content + */ + +/** @typedef {{ x?: number; y?: number }} Point */ + +/** + * @typedef {Object} PhotoSwipeEventsMap https://photoswipe.com/events/ + * + * + * https://photoswipe.com/adding-ui-elements/ + * + * @prop {undefined} uiRegister + * @prop {{ data: UIElementData }} uiElementCreate + * + * + * https://photoswipe.com/events/#initialization-events + * + * @prop {undefined} beforeOpen + * @prop {undefined} firstUpdate + * @prop {undefined} initialLayout + * @prop {undefined} change + * @prop {undefined} afterInit + * @prop {undefined} bindEvents + * + * + * https://photoswipe.com/events/#opening-or-closing-transition-events + * + * @prop {undefined} openingAnimationStart + * @prop {undefined} openingAnimationEnd + * @prop {undefined} closingAnimationStart + * @prop {undefined} closingAnimationEnd + * + * + * https://photoswipe.com/events/#closing-events + * + * @prop {undefined} close + * @prop {undefined} destroy + * + * + * https://photoswipe.com/events/#pointer-and-gesture-events + * + * @prop {{ originalEvent: PointerEvent }} pointerDown + * @prop {{ originalEvent: PointerEvent }} pointerMove + * @prop {{ originalEvent: PointerEvent }} pointerUp + * @prop {{ bgOpacity: number }} pinchClose can be default prevented + * @prop {{ panY: number }} verticalDrag can be default prevented + * + * + * https://photoswipe.com/events/#slide-content-events + * + * @prop {{ content: Content }} contentInit + * @prop {{ content: Content; isLazy: boolean }} contentLoad can be default prevented + * @prop {{ content: Content; isLazy: boolean }} contentLoadImage can be default prevented + * @prop {{ content: Content; slide: Slide; isError?: boolean }} loadComplete + * @prop {{ content: Content; slide: Slide }} loadError + * @prop {{ content: Content; width: number; height: number }} contentResize can be default prevented + * @prop {{ content: Content; width: number; height: number; slide: Slide }} imageSizeChange + * @prop {{ content: Content }} contentLazyLoad can be default prevented + * @prop {{ content: Content }} contentAppend can be default prevented + * @prop {{ content: Content }} contentActivate can be default prevented + * @prop {{ content: Content }} contentDeactivate can be default prevented + * @prop {{ content: Content }} contentRemove can be default prevented + * @prop {{ content: Content }} contentDestroy can be default prevented + * + * + * undocumented + * + * @prop {{ point: Point; originalEvent: PointerEvent }} imageClickAction can be default prevented + * @prop {{ point: Point; originalEvent: PointerEvent }} bgClickAction can be default prevented + * @prop {{ point: Point; originalEvent: PointerEvent }} tapAction can be default prevented + * @prop {{ point: Point; originalEvent: PointerEvent }} doubleTapAction can be default prevented + * + * @prop {{ originalEvent: KeyboardEvent }} keydown can be default prevented + * @prop {{ x: number; dragging: boolean }} moveMainScroll + * @prop {{ slide: Slide }} firstZoomPan + * @prop {{ slide: Slide | undefined, data: SlideData, index: number }} gettingData + * @prop {undefined} beforeResize + * @prop {undefined} resize + * @prop {undefined} viewportSize + * @prop {undefined} updateScrollOffset + * @prop {{ slide: Slide }} slideInit + * @prop {{ slide: Slide }} afterSetContent + * @prop {{ slide: Slide }} slideLoad + * @prop {{ slide: Slide }} appendHeavy can be default prevented + * @prop {{ slide: Slide }} appendHeavyContent + * @prop {{ slide: Slide }} slideActivate + * @prop {{ slide: Slide }} slideDeactivate + * @prop {{ slide: Slide }} slideDestroy + * @prop {{ destZoomLevel: number, centerPoint: Point | undefined, transitionDuration: number | false | undefined }} beforeZoomTo + * @prop {{ slide: Slide }} zoomPanUpdate + * @prop {{ slide: Slide }} initialZoomPan + * @prop {{ slide: Slide }} calcSlideSize + * @prop {undefined} resolutionChanged + * @prop {{ originalEvent: WheelEvent }} wheel can be default prevented + * @prop {{ content: Content }} contentAppendImage can be default prevented + * @prop {{ index: number; itemData: SlideData }} lazyLoadSlide can be default prevented + * @prop {undefined} lazyLoad + * @prop {{ slide: Slide }} calcBounds + * @prop {{ zoomLevels: ZoomLevel, slideData: SlideData }} zoomLevelsUpdate + * + * + * legacy + * + * @prop {undefined} init + * @prop {undefined} initialZoomIn + * @prop {undefined} initialZoomOut + * @prop {undefined} initialZoomInEnd + * @prop {undefined} initialZoomOutEnd + * @prop {{ dataSource: DataSource | undefined, numItems: number }} numItems + * @prop {{ itemData: SlideData; index: number }} itemData + * @prop {{ index: number, itemData: SlideData, instance: PhotoSwipe }} thumbBounds + */ + +/** + * @typedef {Object} PhotoSwipeFiltersMap https://photoswipe.com/filters/ + * + * @prop {(numItems: number, dataSource: DataSource | undefined) => number} numItems + * Modify the total amount of slides. Example on Data sources page. + * https://photoswipe.com/filters/#numitems + * + * @prop {(itemData: SlideData, index: number) => SlideData} itemData + * Modify slide item data. Example on Data sources page. + * https://photoswipe.com/filters/#itemdata + * + * @prop {(itemData: SlideData, element: HTMLElement, linkEl: HTMLAnchorElement) => SlideData} domItemData + * Modify item data when it's parsed from DOM element. Example on Data sources page. + * https://photoswipe.com/filters/#domitemdata + * + * @prop {(clickedIndex: number, e: MouseEvent, instance: PhotoSwipeLightbox) => number} clickedIndex + * Modify clicked gallery item index. + * https://photoswipe.com/filters/#clickedindex + * + * @prop {(placeholderSrc: string | false, content: Content) => string | false} placeholderSrc + * Modify placeholder image source. + * https://photoswipe.com/filters/#placeholdersrc + * + * @prop {(isContentLoading: boolean, content: Content) => boolean} isContentLoading + * Modify if the content is currently loading. + * https://photoswipe.com/filters/#iscontentloading + * + * @prop {(isContentZoomable: boolean, content: Content) => boolean} isContentZoomable + * Modify if the content can be zoomed. + * https://photoswipe.com/filters/#iscontentzoomable + * + * @prop {(useContentPlaceholder: boolean, content: Content) => boolean} useContentPlaceholder + * Modify if the placeholder should be used for the content. + * https://photoswipe.com/filters/#usecontentplaceholder + * + * @prop {(isKeepingPlaceholder: boolean, content: Content) => boolean} isKeepingPlaceholder + * Modify if the placeholder should be kept after the content is loaded. + * https://photoswipe.com/filters/#iskeepingplaceholder + * + * + * @prop {(contentErrorElement: HTMLElement, content: Content) => HTMLElement} contentErrorElement + * Modify an element when the content has error state (for example, if image cannot be loaded). + * https://photoswipe.com/filters/#contenterrorelement + * + * @prop {(element: HTMLElement, data: UIElementData) => HTMLElement} uiElement + * Modify a UI element that's being created. + * https://photoswipe.com/filters/#uielement + * + * @prop {(thumbnail: HTMLElement | null | undefined, itemData: SlideData, index: number) => HTMLElement} thumbEl + * Modify the thumbnail element from which opening zoom animation starts or ends. + * https://photoswipe.com/filters/#thumbel + * + * @prop {(thumbBounds: Bounds | undefined, itemData: SlideData, index: number) => Bounds} thumbBounds + * Modify the thumbnail bounds from which opening zoom animation starts or ends. + * https://photoswipe.com/filters/#thumbbounds + * + * @prop {(srcsetSizesWidth: number, content: Content) => number} srcsetSizesWidth + * + * @prop {(preventPointerEvent: boolean, event: PointerEvent, pointerType: string) => boolean} preventPointerEvent + * + */ + +/** + * @template {keyof PhotoSwipeFiltersMap} T + * @typedef {{ fn: PhotoSwipeFiltersMap[T], priority: number }} Filter + */ + +/** + * @template {keyof PhotoSwipeEventsMap} T + * @typedef {PhotoSwipeEventsMap[T] extends undefined ? PhotoSwipeEvent : PhotoSwipeEvent & PhotoSwipeEventsMap[T]} AugmentedEvent + */ + +/** + * @template {keyof PhotoSwipeEventsMap} T + * @typedef {(event: AugmentedEvent) => void} EventCallback + */ + +/** + * Base PhotoSwipe event object + * + * @template {keyof PhotoSwipeEventsMap} T + */ +class PhotoSwipeEvent { + /** + * @param {T} type + * @param {PhotoSwipeEventsMap[T]} [details] + */ + constructor(type, details) { + this.type = type; + this.defaultPrevented = false; + + if (details) { + Object.assign(this, details); + } + } + + preventDefault() { + this.defaultPrevented = true; + } + +} +/** + * PhotoSwipe base class that can listen and dispatch for events. + * Shared by PhotoSwipe Core and PhotoSwipe Lightbox, extended by base.js + */ + + +class Eventable { + constructor() { + /** + * @type {{ [T in keyof PhotoSwipeEventsMap]?: ((event: AugmentedEvent) => void)[] }} + */ + this._listeners = {}; + /** + * @type {{ [T in keyof PhotoSwipeFiltersMap]?: Filter[] }} + */ + + this._filters = {}; + /** @type {PhotoSwipe | undefined} */ + + this.pswp = undefined; + /** @type {PhotoSwipeOptions | undefined} */ + + this.options = undefined; + } + /** + * @template {keyof PhotoSwipeFiltersMap} T + * @param {T} name + * @param {PhotoSwipeFiltersMap[T]} fn + * @param {number} priority + */ + + + addFilter(name, fn, priority = 100) { + var _this$_filters$name, _this$_filters$name2, _this$pswp; + + if (!this._filters[name]) { + this._filters[name] = []; + } + + (_this$_filters$name = this._filters[name]) === null || _this$_filters$name === void 0 || _this$_filters$name.push({ + fn, + priority + }); + (_this$_filters$name2 = this._filters[name]) === null || _this$_filters$name2 === void 0 || _this$_filters$name2.sort((f1, f2) => f1.priority - f2.priority); + (_this$pswp = this.pswp) === null || _this$pswp === void 0 || _this$pswp.addFilter(name, fn, priority); + } + /** + * @template {keyof PhotoSwipeFiltersMap} T + * @param {T} name + * @param {PhotoSwipeFiltersMap[T]} fn + */ + + + removeFilter(name, fn) { + if (this._filters[name]) { + // @ts-expect-error + this._filters[name] = this._filters[name].filter(filter => filter.fn !== fn); + } + + if (this.pswp) { + this.pswp.removeFilter(name, fn); + } + } + /** + * @template {keyof PhotoSwipeFiltersMap} T + * @param {T} name + * @param {Parameters} args + * @returns {Parameters[0]} + */ + + + applyFilters(name, ...args) { + var _this$_filters$name3; + + (_this$_filters$name3 = this._filters[name]) === null || _this$_filters$name3 === void 0 || _this$_filters$name3.forEach(filter => { + // @ts-expect-error + args[0] = filter.fn.apply(this, args); + }); + return args[0]; + } + /** + * @template {keyof PhotoSwipeEventsMap} T + * @param {T} name + * @param {EventCallback} fn + */ + + + on(name, fn) { + var _this$_listeners$name, _this$pswp2; + + if (!this._listeners[name]) { + this._listeners[name] = []; + } + + (_this$_listeners$name = this._listeners[name]) === null || _this$_listeners$name === void 0 || _this$_listeners$name.push(fn); // When binding events to lightbox, + // also bind events to PhotoSwipe Core, + // if it's open. + + (_this$pswp2 = this.pswp) === null || _this$pswp2 === void 0 || _this$pswp2.on(name, fn); + } + /** + * @template {keyof PhotoSwipeEventsMap} T + * @param {T} name + * @param {EventCallback} fn + */ + + + off(name, fn) { + var _this$pswp3; + + if (this._listeners[name]) { + // @ts-expect-error + this._listeners[name] = this._listeners[name].filter(listener => fn !== listener); + } + + (_this$pswp3 = this.pswp) === null || _this$pswp3 === void 0 || _this$pswp3.off(name, fn); + } + /** + * @template {keyof PhotoSwipeEventsMap} T + * @param {T} name + * @param {PhotoSwipeEventsMap[T]} [details] + * @returns {AugmentedEvent} + */ + + + dispatch(name, details) { + var _this$_listeners$name2; + + if (this.pswp) { + return this.pswp.dispatch(name, details); + } + + const event = + /** @type {AugmentedEvent} */ + new PhotoSwipeEvent(name, details); + (_this$_listeners$name2 = this._listeners[name]) === null || _this$_listeners$name2 === void 0 || _this$_listeners$name2.forEach(listener => { + listener.call(this, event); + }); + return event; + } + +} + +class Placeholder { + /** + * @param {string | false} imageSrc + * @param {HTMLElement} container + */ + constructor(imageSrc, container) { + // Create placeholder + // (stretched thumbnail or simple div behind the main image) + + /** @type {HTMLImageElement | HTMLDivElement | null} */ + this.element = createElement('pswp__img pswp__img--placeholder', imageSrc ? 'img' : 'div', container); + + if (imageSrc) { + const imgEl = + /** @type {HTMLImageElement} */ + this.element; + imgEl.decoding = 'async'; + imgEl.alt = ''; + imgEl.src = imageSrc; + imgEl.setAttribute('role', 'presentation'); + } + + this.element.setAttribute('aria-hidden', 'true'); + } + /** + * @param {number} width + * @param {number} height + */ + + + setDisplayedSize(width, height) { + if (!this.element) { + return; + } + + if (this.element.tagName === 'IMG') { + // Use transform scale() to modify img placeholder size + // (instead of changing width/height directly). + // This helps with performance, specifically in iOS15 Safari. + setWidthHeight(this.element, 250, 'auto'); + this.element.style.transformOrigin = '0 0'; + this.element.style.transform = toTransformString(0, 0, width / 250); + } else { + setWidthHeight(this.element, width, height); + } + } + + destroy() { + var _this$element; + + if ((_this$element = this.element) !== null && _this$element !== void 0 && _this$element.parentNode) { + this.element.remove(); + } + + this.element = null; + } + +} + +/** @typedef {import('./slide.js').default} Slide */ + +/** @typedef {import('./slide.js').SlideData} SlideData */ + +/** @typedef {import('../core/base.js').default} PhotoSwipeBase */ + +/** @typedef {import('../util/util.js').LoadState} LoadState */ + +class Content { + /** + * @param {SlideData} itemData Slide data + * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance + * @param {number} index + */ + constructor(itemData, instance, index) { + this.instance = instance; + this.data = itemData; + this.index = index; + /** @type {HTMLImageElement | HTMLDivElement | undefined} */ + + this.element = undefined; + /** @type {Placeholder | undefined} */ + + this.placeholder = undefined; + /** @type {Slide | undefined} */ + + this.slide = undefined; + this.displayedImageWidth = 0; + this.displayedImageHeight = 0; + this.width = Number(this.data.w) || Number(this.data.width) || 0; + this.height = Number(this.data.h) || Number(this.data.height) || 0; + this.isAttached = false; + this.hasSlide = false; + this.isDecoding = false; + /** @type {LoadState} */ + + this.state = LOAD_STATE.IDLE; + + if (this.data.type) { + this.type = this.data.type; + } else if (this.data.src) { + this.type = 'image'; + } else { + this.type = 'html'; + } + + this.instance.dispatch('contentInit', { + content: this + }); + } + + removePlaceholder() { + if (this.placeholder && !this.keepPlaceholder()) { + // With delay, as image might be loaded, but not rendered + setTimeout(() => { + if (this.placeholder) { + this.placeholder.destroy(); + this.placeholder = undefined; + } + }, 1000); + } + } + /** + * Preload content + * + * @param {boolean} isLazy + * @param {boolean} [reload] + */ + + + load(isLazy, reload) { + if (this.slide && this.usePlaceholder()) { + if (!this.placeholder) { + const placeholderSrc = this.instance.applyFilters('placeholderSrc', // use image-based placeholder only for the first slide, + // as rendering (even small stretched thumbnail) is an expensive operation + this.data.msrc && this.slide.isFirstSlide ? this.data.msrc : false, this); + this.placeholder = new Placeholder(placeholderSrc, this.slide.container); + } else { + const placeholderEl = this.placeholder.element; // Add placeholder to DOM if it was already created + + if (placeholderEl && !placeholderEl.parentElement) { + this.slide.container.prepend(placeholderEl); + } + } + } + + if (this.element && !reload) { + return; + } + + if (this.instance.dispatch('contentLoad', { + content: this, + isLazy + }).defaultPrevented) { + return; + } + + if (this.isImageContent()) { + this.element = createElement('pswp__img', 'img'); // Start loading only after width is defined, as sizes might depend on it. + // Due to Safari feature, we must define sizes before srcset. + + if (this.displayedImageWidth) { + this.loadImage(isLazy); + } + } else { + this.element = createElement('pswp__content', 'div'); + this.element.innerHTML = this.data.html || ''; + } + + if (reload && this.slide) { + this.slide.updateContentSize(true); + } + } + /** + * Preload image + * + * @param {boolean} isLazy + */ + + + loadImage(isLazy) { + var _this$data$src, _this$data$alt; + + if (!this.isImageContent() || !this.element || this.instance.dispatch('contentLoadImage', { + content: this, + isLazy + }).defaultPrevented) { + return; + } + + const imageElement = + /** @type HTMLImageElement */ + this.element; + this.updateSrcsetSizes(); + + if (this.data.srcset) { + imageElement.srcset = this.data.srcset; + } + + imageElement.src = (_this$data$src = this.data.src) !== null && _this$data$src !== void 0 ? _this$data$src : ''; + imageElement.alt = (_this$data$alt = this.data.alt) !== null && _this$data$alt !== void 0 ? _this$data$alt : ''; + this.state = LOAD_STATE.LOADING; + + if (imageElement.complete) { + this.onLoaded(); + } else { + imageElement.onload = () => { + this.onLoaded(); + }; + + imageElement.onerror = () => { + this.onError(); + }; + } + } + /** + * Assign slide to content + * + * @param {Slide} slide + */ + + + setSlide(slide) { + this.slide = slide; + this.hasSlide = true; + this.instance = slide.pswp; // todo: do we need to unset slide? + } + /** + * Content load success handler + */ + + + onLoaded() { + this.state = LOAD_STATE.LOADED; + + if (this.slide && this.element) { + this.instance.dispatch('loadComplete', { + slide: this.slide, + content: this + }); // if content is reloaded + + if (this.slide.isActive && this.slide.heavyAppended && !this.element.parentNode) { + this.append(); + this.slide.updateContentSize(true); + } + + if (this.state === LOAD_STATE.LOADED || this.state === LOAD_STATE.ERROR) { + this.removePlaceholder(); + } + } + } + /** + * Content load error handler + */ + + + onError() { + this.state = LOAD_STATE.ERROR; + + if (this.slide) { + this.displayError(); + this.instance.dispatch('loadComplete', { + slide: this.slide, + isError: true, + content: this + }); + this.instance.dispatch('loadError', { + slide: this.slide, + content: this + }); + } + } + /** + * @returns {Boolean} If the content is currently loading + */ + + + isLoading() { + return this.instance.applyFilters('isContentLoading', this.state === LOAD_STATE.LOADING, this); + } + /** + * @returns {Boolean} If the content is in error state + */ + + + isError() { + return this.state === LOAD_STATE.ERROR; + } + /** + * @returns {boolean} If the content is image + */ + + + isImageContent() { + return this.type === 'image'; + } + /** + * Update content size + * + * @param {Number} width + * @param {Number} height + */ + + + setDisplayedSize(width, height) { + if (!this.element) { + return; + } + + if (this.placeholder) { + this.placeholder.setDisplayedSize(width, height); + } + + if (this.instance.dispatch('contentResize', { + content: this, + width, + height + }).defaultPrevented) { + return; + } + + setWidthHeight(this.element, width, height); + + if (this.isImageContent() && !this.isError()) { + const isInitialSizeUpdate = !this.displayedImageWidth && width; + this.displayedImageWidth = width; + this.displayedImageHeight = height; + + if (isInitialSizeUpdate) { + this.loadImage(false); + } else { + this.updateSrcsetSizes(); + } + + if (this.slide) { + this.instance.dispatch('imageSizeChange', { + slide: this.slide, + width, + height, + content: this + }); + } + } + } + /** + * @returns {boolean} If the content can be zoomed + */ + + + isZoomable() { + return this.instance.applyFilters('isContentZoomable', this.isImageContent() && this.state !== LOAD_STATE.ERROR, this); + } + /** + * Update image srcset sizes attribute based on width and height + */ + + + updateSrcsetSizes() { + // Handle srcset sizes attribute. + // + // Never lower quality, if it was increased previously. + // Chrome does this automatically, Firefox and Safari do not, + // so we store largest used size in dataset. + if (!this.isImageContent() || !this.element || !this.data.srcset) { + return; + } + + const image = + /** @type HTMLImageElement */ + this.element; + const sizesWidth = this.instance.applyFilters('srcsetSizesWidth', this.displayedImageWidth, this); + + if (!image.dataset.largestUsedSize || sizesWidth > parseInt(image.dataset.largestUsedSize, 10)) { + image.sizes = sizesWidth + 'px'; + image.dataset.largestUsedSize = String(sizesWidth); + } + } + /** + * @returns {boolean} If content should use a placeholder (from msrc by default) + */ + + + usePlaceholder() { + return this.instance.applyFilters('useContentPlaceholder', this.isImageContent(), this); + } + /** + * Preload content with lazy-loading param + */ + + + lazyLoad() { + if (this.instance.dispatch('contentLazyLoad', { + content: this + }).defaultPrevented) { + return; + } + + this.load(true); + } + /** + * @returns {boolean} If placeholder should be kept after content is loaded + */ + + + keepPlaceholder() { + return this.instance.applyFilters('isKeepingPlaceholder', this.isLoading(), this); + } + /** + * Destroy the content + */ + + + destroy() { + this.hasSlide = false; + this.slide = undefined; + + if (this.instance.dispatch('contentDestroy', { + content: this + }).defaultPrevented) { + return; + } + + this.remove(); + + if (this.placeholder) { + this.placeholder.destroy(); + this.placeholder = undefined; + } + + if (this.isImageContent() && this.element) { + this.element.onload = null; + this.element.onerror = null; + this.element = undefined; + } + } + /** + * Display error message + */ + + + displayError() { + if (this.slide) { + var _this$instance$option, _this$instance$option2; + + let errorMsgEl = createElement('pswp__error-msg', 'div'); + errorMsgEl.innerText = (_this$instance$option = (_this$instance$option2 = this.instance.options) === null || _this$instance$option2 === void 0 ? void 0 : _this$instance$option2.errorMsg) !== null && _this$instance$option !== void 0 ? _this$instance$option : ''; + errorMsgEl = + /** @type {HTMLDivElement} */ + this.instance.applyFilters('contentErrorElement', errorMsgEl, this); + this.element = createElement('pswp__content pswp__error-msg-container', 'div'); + this.element.appendChild(errorMsgEl); + this.slide.container.innerText = ''; + this.slide.container.appendChild(this.element); + this.slide.updateContentSize(true); + this.removePlaceholder(); + } + } + /** + * Append the content + */ + + + append() { + if (this.isAttached || !this.element) { + return; + } + + this.isAttached = true; + + if (this.state === LOAD_STATE.ERROR) { + this.displayError(); + return; + } + + if (this.instance.dispatch('contentAppend', { + content: this + }).defaultPrevented) { + return; + } + + const supportsDecode = ('decode' in this.element); + + if (this.isImageContent()) { + // Use decode() on nearby slides + // + // Nearby slide images are in DOM and not hidden via display:none. + // However, they are placed offscreen (to the left and right side). + // + // Some browsers do not composite the image until it's actually visible, + // using decode() helps. + // + // You might ask "why dont you just decode() and then append all images", + // that's because I want to show image before it's fully loaded, + // as browser can render parts of image while it is loading. + // We do not do this in Safari due to partial loading bug. + if (supportsDecode && this.slide && (!this.slide.isActive || isSafari())) { + this.isDecoding = true; // purposefully using finally instead of then, + // as if srcset sizes changes dynamically - it may cause decode error + + /** @type {HTMLImageElement} */ + + this.element.decode().catch(() => {}).finally(() => { + this.isDecoding = false; + this.appendImage(); + }); + } else { + this.appendImage(); + } + } else if (this.slide && !this.element.parentNode) { + this.slide.container.appendChild(this.element); + } + } + /** + * Activate the slide, + * active slide is generally the current one, + * meaning the user can see it. + */ + + + activate() { + if (this.instance.dispatch('contentActivate', { + content: this + }).defaultPrevented || !this.slide) { + return; + } + + if (this.isImageContent() && this.isDecoding && !isSafari()) { + // add image to slide when it becomes active, + // even if it's not finished decoding + this.appendImage(); + } else if (this.isError()) { + this.load(false, true); // try to reload + } + + if (this.slide.holderElement) { + this.slide.holderElement.setAttribute('aria-hidden', 'false'); + } + } + /** + * Deactivate the content + */ + + + deactivate() { + this.instance.dispatch('contentDeactivate', { + content: this + }); + + if (this.slide && this.slide.holderElement) { + this.slide.holderElement.setAttribute('aria-hidden', 'true'); + } + } + /** + * Remove the content from DOM + */ + + + remove() { + this.isAttached = false; + + if (this.instance.dispatch('contentRemove', { + content: this + }).defaultPrevented) { + return; + } + + if (this.element && this.element.parentNode) { + this.element.remove(); + } + + if (this.placeholder && this.placeholder.element) { + this.placeholder.element.remove(); + } + } + /** + * Append the image content to slide container + */ + + + appendImage() { + if (!this.isAttached) { + return; + } + + if (this.instance.dispatch('contentAppendImage', { + content: this + }).defaultPrevented) { + return; + } // ensure that element exists and is not already appended + + + if (this.slide && this.element && !this.element.parentNode) { + this.slide.container.appendChild(this.element); + } + + if (this.state === LOAD_STATE.LOADED || this.state === LOAD_STATE.ERROR) { + this.removePlaceholder(); + } + } + +} + +/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */ + +/** @typedef {import('../core/base.js').default} PhotoSwipeBase */ + +/** @typedef {import('../photoswipe.js').Point} Point */ + +/** @typedef {import('../slide/slide.js').SlideData} SlideData */ + +/** + * @param {PhotoSwipeOptions} options + * @param {PhotoSwipeBase} pswp + * @returns {Point} + */ +function getViewportSize(options, pswp) { + if (options.getViewportSizeFn) { + const newViewportSize = options.getViewportSizeFn(options, pswp); + + if (newViewportSize) { + return newViewportSize; + } + } + + return { + x: document.documentElement.clientWidth, + // TODO: height on mobile is very incosistent due to toolbar + // find a way to improve this + // + // document.documentElement.clientHeight - doesn't seem to work well + y: window.innerHeight + }; +} +/** + * Parses padding option. + * Supported formats: + * + * // Object + * padding: { + * top: 0, + * bottom: 0, + * left: 0, + * right: 0 + * } + * + * // A function that returns the object + * paddingFn: (viewportSize, itemData, index) => { + * return { + * top: 0, + * bottom: 0, + * left: 0, + * right: 0 + * }; + * } + * + * // Legacy variant + * paddingLeft: 0, + * paddingRight: 0, + * paddingTop: 0, + * paddingBottom: 0, + * + * @param {'left' | 'top' | 'bottom' | 'right'} prop + * @param {PhotoSwipeOptions} options PhotoSwipe options + * @param {Point} viewportSize PhotoSwipe viewport size, for example: { x:800, y:600 } + * @param {SlideData} itemData Data about the slide + * @param {number} index Slide index + * @returns {number} + */ + +function parsePaddingOption(prop, options, viewportSize, itemData, index) { + let paddingValue = 0; + + if (options.paddingFn) { + paddingValue = options.paddingFn(viewportSize, itemData, index)[prop]; + } else if (options.padding) { + paddingValue = options.padding[prop]; + } else { + const legacyPropName = 'padding' + prop[0].toUpperCase() + prop.slice(1); // @ts-expect-error + + if (options[legacyPropName]) { + // @ts-expect-error + paddingValue = options[legacyPropName]; + } + } + + return Number(paddingValue) || 0; +} +/** + * @param {PhotoSwipeOptions} options + * @param {Point} viewportSize + * @param {SlideData} itemData + * @param {number} index + * @returns {Point} + */ + +function getPanAreaSize(options, viewportSize, itemData, index) { + return { + x: viewportSize.x - parsePaddingOption('left', options, viewportSize, itemData, index) - parsePaddingOption('right', options, viewportSize, itemData, index), + y: viewportSize.y - parsePaddingOption('top', options, viewportSize, itemData, index) - parsePaddingOption('bottom', options, viewportSize, itemData, index) + }; +} + +const MAX_IMAGE_WIDTH = 4000; +/** @typedef {import('../photoswipe.js').default} PhotoSwipe */ + +/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */ + +/** @typedef {import('../photoswipe.js').Point} Point */ + +/** @typedef {import('../slide/slide.js').SlideData} SlideData */ + +/** @typedef {'fit' | 'fill' | number | ((zoomLevelObject: ZoomLevel) => number)} ZoomLevelOption */ + +/** + * Calculates zoom levels for specific slide. + * Depends on viewport size and image size. + */ + +class ZoomLevel { + /** + * @param {PhotoSwipeOptions} options PhotoSwipe options + * @param {SlideData} itemData Slide data + * @param {number} index Slide index + * @param {PhotoSwipe} [pswp] PhotoSwipe instance, can be undefined if not initialized yet + */ + constructor(options, itemData, index, pswp) { + this.pswp = pswp; + this.options = options; + this.itemData = itemData; + this.index = index; + /** @type { Point | null } */ + + this.panAreaSize = null; + /** @type { Point | null } */ + + this.elementSize = null; + this.fit = 1; + this.fill = 1; + this.vFill = 1; + this.initial = 1; + this.secondary = 1; + this.max = 1; + this.min = 1; + } + /** + * Calculate initial, secondary and maximum zoom level for the specified slide. + * + * It should be called when either image or viewport size changes. + * + * @param {number} maxWidth + * @param {number} maxHeight + * @param {Point} panAreaSize + */ + + + update(maxWidth, maxHeight, panAreaSize) { + /** @type {Point} */ + const elementSize = { + x: maxWidth, + y: maxHeight + }; + this.elementSize = elementSize; + this.panAreaSize = panAreaSize; + const hRatio = panAreaSize.x / elementSize.x; + const vRatio = panAreaSize.y / elementSize.y; + this.fit = Math.min(1, hRatio < vRatio ? hRatio : vRatio); + this.fill = Math.min(1, hRatio > vRatio ? hRatio : vRatio); // zoom.vFill defines zoom level of the image + // when it has 100% of viewport vertical space (height) + + this.vFill = Math.min(1, vRatio); + this.initial = this._getInitial(); + this.secondary = this._getSecondary(); + this.max = Math.max(this.initial, this.secondary, this._getMax()); + this.min = Math.min(this.fit, this.initial, this.secondary); + + if (this.pswp) { + this.pswp.dispatch('zoomLevelsUpdate', { + zoomLevels: this, + slideData: this.itemData + }); + } + } + /** + * Parses user-defined zoom option. + * + * @private + * @param {'initial' | 'secondary' | 'max'} optionPrefix Zoom level option prefix (initial, secondary, max) + * @returns { number | undefined } + */ + + + _parseZoomLevelOption(optionPrefix) { + const optionName = + /** @type {'initialZoomLevel' | 'secondaryZoomLevel' | 'maxZoomLevel'} */ + optionPrefix + 'ZoomLevel'; + const optionValue = this.options[optionName]; + + if (!optionValue) { + return; + } + + if (typeof optionValue === 'function') { + return optionValue(this); + } + + if (optionValue === 'fill') { + return this.fill; + } + + if (optionValue === 'fit') { + return this.fit; + } + + return Number(optionValue); + } + /** + * Get zoom level to which image will be zoomed after double-tap gesture, + * or when user clicks on zoom icon, + * or mouse-click on image itself. + * If you return 1 image will be zoomed to its original size. + * + * @private + * @return {number} + */ + + + _getSecondary() { + let currZoomLevel = this._parseZoomLevelOption('secondary'); + + if (currZoomLevel) { + return currZoomLevel; + } // 3x of "fit" state, but not larger than original + + + currZoomLevel = Math.min(1, this.fit * 3); + + if (this.elementSize && currZoomLevel * this.elementSize.x > MAX_IMAGE_WIDTH) { + currZoomLevel = MAX_IMAGE_WIDTH / this.elementSize.x; + } + + return currZoomLevel; + } + /** + * Get initial image zoom level. + * + * @private + * @return {number} + */ + + + _getInitial() { + return this._parseZoomLevelOption('initial') || this.fit; + } + /** + * Maximum zoom level when user zooms + * via zoom/pinch gesture, + * via cmd/ctrl-wheel or via trackpad. + * + * @private + * @return {number} + */ + + + _getMax() { + // max zoom level is x4 from "fit state", + // used for zoom gesture and ctrl/trackpad zoom + return this._parseZoomLevelOption('max') || Math.max(1, this.fit * 4); + } + +} + +/** + * Lazy-load an image + * This function is used both by Lightbox and PhotoSwipe core, + * thus it can be called before dialog is opened. + * + * @param {SlideData} itemData Data about the slide + * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance + * @param {number} index + * @returns {Content} Image that is being decoded or false. + */ + +function lazyLoadData(itemData, instance, index) { + const content = instance.createContentFromData(itemData, index); + /** @type {ZoomLevel | undefined} */ + + let zoomLevel; + const { + options + } = instance; // We need to know dimensions of the image to preload it, + // as it might use srcset, and we need to define sizes + + if (options) { + zoomLevel = new ZoomLevel(options, itemData, -1); + let viewportSize; + + if (instance.pswp) { + viewportSize = instance.pswp.viewportSize; + } else { + viewportSize = getViewportSize(options, instance); + } + + const panAreaSize = getPanAreaSize(options, viewportSize, itemData, index); + zoomLevel.update(content.width, content.height, panAreaSize); + } + + content.lazyLoad(); + + if (zoomLevel) { + content.setDisplayedSize(Math.ceil(content.width * zoomLevel.initial), Math.ceil(content.height * zoomLevel.initial)); + } + + return content; +} +/** + * Lazy-loads specific slide. + * This function is used both by Lightbox and PhotoSwipe core, + * thus it can be called before dialog is opened. + * + * By default, it loads image based on viewport size and initial zoom level. + * + * @param {number} index Slide index + * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox eventable instance + * @returns {Content | undefined} + */ + +function lazyLoadSlide(index, instance) { + const itemData = instance.getItemData(index); + + if (instance.dispatch('lazyLoadSlide', { + index, + itemData + }).defaultPrevented) { + return; + } + + return lazyLoadData(itemData, instance, index); +} + +/** @typedef {import("../photoswipe.js").default} PhotoSwipe */ + +/** @typedef {import("../slide/slide.js").SlideData} SlideData */ + +/** + * PhotoSwipe base class that can retrieve data about every slide. + * Shared by PhotoSwipe Core and PhotoSwipe Lightbox + */ + +class PhotoSwipeBase extends Eventable { + /** + * Get total number of slides + * + * @returns {number} + */ + getNumItems() { + var _this$options; + + let numItems = 0; + const dataSource = (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.dataSource; + + if (dataSource && 'length' in dataSource) { + // may be an array or just object with length property + numItems = dataSource.length; + } else if (dataSource && 'gallery' in dataSource) { + // query DOM elements + if (!dataSource.items) { + dataSource.items = this._getGalleryDOMElements(dataSource.gallery); + } + + if (dataSource.items) { + numItems = dataSource.items.length; + } + } // legacy event, before filters were introduced + + + const event = this.dispatch('numItems', { + dataSource, + numItems + }); + return this.applyFilters('numItems', event.numItems, dataSource); + } + /** + * @param {SlideData} slideData + * @param {number} index + * @returns {Content} + */ + + + createContentFromData(slideData, index) { + return new Content(slideData, this, index); + } + /** + * Get item data by index. + * + * "item data" should contain normalized information that PhotoSwipe needs to generate a slide. + * For example, it may contain properties like + * `src`, `srcset`, `w`, `h`, which will be used to generate a slide with image. + * + * @param {number} index + * @returns {SlideData} + */ + + + getItemData(index) { + var _this$options2; + + const dataSource = (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.dataSource; + /** @type {SlideData | HTMLElement} */ + + let dataSourceItem = {}; + + if (Array.isArray(dataSource)) { + // Datasource is an array of elements + dataSourceItem = dataSource[index]; + } else if (dataSource && 'gallery' in dataSource) { + // dataSource has gallery property, + // thus it was created by Lightbox, based on + // gallery and children options + // query DOM elements + if (!dataSource.items) { + dataSource.items = this._getGalleryDOMElements(dataSource.gallery); + } + + dataSourceItem = dataSource.items[index]; + } + + let itemData = dataSourceItem; + + if (itemData instanceof Element) { + itemData = this._domElementToItemData(itemData); + } // Dispatching the itemData event, + // it's a legacy verion before filters were introduced + + + const event = this.dispatch('itemData', { + itemData: itemData || {}, + index + }); + return this.applyFilters('itemData', event.itemData, index); + } + /** + * Get array of gallery DOM elements, + * based on childSelector and gallery element. + * + * @param {HTMLElement} galleryElement + * @returns {HTMLElement[]} + */ + + + _getGalleryDOMElements(galleryElement) { + var _this$options3, _this$options4; + + if ((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.children || (_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.childSelector) { + return getElementsFromOption(this.options.children, this.options.childSelector, galleryElement) || []; + } + + return [galleryElement]; + } + /** + * Converts DOM element to item data object. + * + * @param {HTMLElement} element DOM element + * @returns {SlideData} + */ + + + _domElementToItemData(element) { + /** @type {SlideData} */ + const itemData = { + element + }; + const linkEl = + /** @type {HTMLAnchorElement} */ + element.tagName === 'A' ? element : element.querySelector('a'); + + if (linkEl) { + // src comes from data-pswp-src attribute, + // if it's empty link href is used + itemData.src = linkEl.dataset.pswpSrc || linkEl.href; + + if (linkEl.dataset.pswpSrcset) { + itemData.srcset = linkEl.dataset.pswpSrcset; + } + + itemData.width = linkEl.dataset.pswpWidth ? parseInt(linkEl.dataset.pswpWidth, 10) : 0; + itemData.height = linkEl.dataset.pswpHeight ? parseInt(linkEl.dataset.pswpHeight, 10) : 0; // support legacy w & h properties + + itemData.w = itemData.width; + itemData.h = itemData.height; + + if (linkEl.dataset.pswpType) { + itemData.type = linkEl.dataset.pswpType; + } + + const thumbnailEl = element.querySelector('img'); + + if (thumbnailEl) { + var _thumbnailEl$getAttri; + + // msrc is URL to placeholder image that's displayed before large image is loaded + // by default it's displayed only for the first slide + itemData.msrc = thumbnailEl.currentSrc || thumbnailEl.src; + itemData.alt = (_thumbnailEl$getAttri = thumbnailEl.getAttribute('alt')) !== null && _thumbnailEl$getAttri !== void 0 ? _thumbnailEl$getAttri : ''; + } + + if (linkEl.dataset.pswpCropped || linkEl.dataset.cropped) { + itemData.thumbCropped = true; + } + } + + return this.applyFilters('domItemData', itemData, element, linkEl); + } + /** + * Lazy-load by slide data + * + * @param {SlideData} itemData Data about the slide + * @param {number} index + * @returns {Content} Image that is being decoded or false. + */ + + + lazyLoadData(itemData, index) { + return lazyLoadData(itemData, this, index); + } + +} + +/** + * @template T + * @typedef {import('../types.js').Type} Type + */ + +/** @typedef {import('../photoswipe.js').default} PhotoSwipe */ + +/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */ + +/** @typedef {import('../photoswipe.js').DataSource} DataSource */ + +/** @typedef {import('../photoswipe.js').Point} Point */ + +/** @typedef {import('../slide/content.js').default} Content */ + +/** @typedef {import('../core/eventable.js').PhotoSwipeEventsMap} PhotoSwipeEventsMap */ + +/** @typedef {import('../core/eventable.js').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */ + +/** + * @template {keyof PhotoSwipeEventsMap} T + * @typedef {import('../core/eventable.js').EventCallback} EventCallback + */ + +/** + * PhotoSwipe Lightbox + * + * - If user has unsupported browser it falls back to default browser action (just opens URL) + * - Binds click event to links that should open PhotoSwipe + * - parses DOM strcture for PhotoSwipe (retrieves large image URLs and sizes) + * - Initializes PhotoSwipe + * + * + * Loader options use the same object as PhotoSwipe, and supports such options: + * + * gallery - Element | Element[] | NodeList | string selector for the gallery element + * children - Element | Element[] | NodeList | string selector for the gallery children + * + */ + +class PhotoSwipeLightbox extends PhotoSwipeBase { + /** + * @param {PhotoSwipeOptions} [options] + */ + constructor(options) { + super(); + /** @type {PhotoSwipeOptions} */ + + this.options = options || {}; + this._uid = 0; + this.shouldOpen = false; + /** + * @private + * @type {Content | undefined} + */ + + this._preloadedContent = undefined; + this.onThumbnailsClick = this.onThumbnailsClick.bind(this); + } + /** + * Initialize lightbox, should be called only once. + * It's not included in the main constructor, so you may bind events before it. + */ + + + init() { + // Bind click events to each gallery + getElementsFromOption(this.options.gallery, this.options.gallerySelector).forEach(galleryElement => { + galleryElement.addEventListener('click', this.onThumbnailsClick, false); + }); + } + /** + * @param {MouseEvent} e + */ + + + onThumbnailsClick(e) { + // Exit and allow default browser action if: + if (specialKeyUsed(e) // ... if clicked with a special key (ctrl/cmd...) + || window.pswp) { + // ... if PhotoSwipe is already open + return; + } // If both clientX and clientY are 0 or not defined, + // the event is likely triggered by keyboard, + // so we do not pass the initialPoint + // + // Note that some screen readers emulate the mouse position, + // so it's not the ideal way to detect them. + // + + /** @type {Point | null} */ + + + let initialPoint = { + x: e.clientX, + y: e.clientY + }; + + if (!initialPoint.x && !initialPoint.y) { + initialPoint = null; + } + + let clickedIndex = this.getClickedIndex(e); + clickedIndex = this.applyFilters('clickedIndex', clickedIndex, e, this); + /** @type {DataSource} */ + + const dataSource = { + gallery: + /** @type {HTMLElement} */ + e.currentTarget + }; + + if (clickedIndex >= 0) { + e.preventDefault(); + this.loadAndOpen(clickedIndex, dataSource, initialPoint); + } + } + /** + * Get index of gallery item that was clicked. + * + * @param {MouseEvent} e click event + * @returns {number} + */ + + + getClickedIndex(e) { + // legacy option + if (this.options.getClickedIndexFn) { + return this.options.getClickedIndexFn.call(this, e); + } + + const clickedTarget = + /** @type {HTMLElement} */ + e.target; + const childElements = getElementsFromOption(this.options.children, this.options.childSelector, + /** @type {HTMLElement} */ + e.currentTarget); + const clickedChildIndex = childElements.findIndex(child => child === clickedTarget || child.contains(clickedTarget)); + + if (clickedChildIndex !== -1) { + return clickedChildIndex; + } else if (this.options.children || this.options.childSelector) { + // click wasn't on a child element + return -1; + } // There is only one item (which is the gallery) + + + return 0; + } + /** + * Load and open PhotoSwipe + * + * @param {number} index + * @param {DataSource} dataSource + * @param {Point | null} [initialPoint] + * @returns {boolean} + */ + + + loadAndOpen(index, dataSource, initialPoint) { + // Check if the gallery is already open + if (window.pswp) { + return false; + } // set initial index + + + this.options.index = index; // define options for PhotoSwipe constructor + + this.options.initialPointerPos = initialPoint; + this.shouldOpen = true; + this.preload(index, dataSource); + return true; + } + /** + * Load the main module and the slide content by index + * + * @param {number} index + * @param {DataSource} [dataSource] + */ + + + preload(index, dataSource) { + const { + options + } = this; + + if (dataSource) { + options.dataSource = dataSource; + } // Add the main module + + /** @type {Promise>[]} */ + + + const promiseArray = []; + const pswpModuleType = typeof options.pswpModule; + + if (isPswpClass(options.pswpModule)) { + promiseArray.push(Promise.resolve( + /** @type {Type} */ + options.pswpModule)); + } else if (pswpModuleType === 'string') { + throw new Error('pswpModule as string is no longer supported'); + } else if (pswpModuleType === 'function') { + promiseArray.push( + /** @type {() => Promise>} */ + options.pswpModule()); + } else { + throw new Error('pswpModule is not valid'); + } // Add custom-defined promise, if any + + + if (typeof options.openPromise === 'function') { + // allow developers to perform some task before opening + promiseArray.push(options.openPromise()); + } + + if (options.preloadFirstSlide !== false && index >= 0) { + this._preloadedContent = lazyLoadSlide(index, this); + } // Wait till all promises resolve and open PhotoSwipe + + + const uid = ++this._uid; + Promise.all(promiseArray).then(iterableModules => { + if (this.shouldOpen) { + const mainModule = iterableModules[0]; + + this._openPhotoswipe(mainModule, uid); + } + }); + } + /** + * @private + * @param {Type | { default: Type }} module + * @param {number} uid + */ + + + _openPhotoswipe(module, uid) { + // Cancel opening if UID doesn't match the current one + // (if user clicked on another gallery item before current was loaded). + // + // Or if shouldOpen flag is set to false + // (developer may modify it via public API) + if (uid !== this._uid && this.shouldOpen) { + return; + } + + this.shouldOpen = false; // PhotoSwipe is already open + + if (window.pswp) { + return; + } + /** + * Pass data to PhotoSwipe and open init + * + * @type {PhotoSwipe} + */ + + + const pswp = typeof module === 'object' ? new module.default(this.options) // eslint-disable-line + : new module(this.options); // eslint-disable-line + + this.pswp = pswp; + window.pswp = pswp; // map listeners from Lightbox to PhotoSwipe Core + + /** @type {(keyof PhotoSwipeEventsMap)[]} */ + + Object.keys(this._listeners).forEach(name => { + var _this$_listeners$name; + + (_this$_listeners$name = this._listeners[name]) === null || _this$_listeners$name === void 0 || _this$_listeners$name.forEach(fn => { + pswp.on(name, + /** @type {EventCallback} */ + fn); + }); + }); // same with filters + + /** @type {(keyof PhotoSwipeFiltersMap)[]} */ + + Object.keys(this._filters).forEach(name => { + var _this$_filters$name; + + (_this$_filters$name = this._filters[name]) === null || _this$_filters$name === void 0 || _this$_filters$name.forEach(filter => { + pswp.addFilter(name, filter.fn, filter.priority); + }); + }); + + if (this._preloadedContent) { + pswp.contentLoader.addToCache(this._preloadedContent); + this._preloadedContent = undefined; + } + + pswp.on('destroy', () => { + // clean up public variables + this.pswp = undefined; + delete window.pswp; + }); + pswp.init(); + } + /** + * Unbinds all events, closes PhotoSwipe if it's open. + */ + + + destroy() { + var _this$pswp; + + (_this$pswp = this.pswp) === null || _this$pswp === void 0 || _this$pswp.destroy(); + this.shouldOpen = false; + this._listeners = {}; + getElementsFromOption(this.options.gallery, this.options.gallerySelector).forEach(galleryElement => { + galleryElement.removeEventListener('click', this.onThumbnailsClick, false); + }); + } + +} + +export { PhotoSwipeLightbox as default }; +//# sourceMappingURL=photoswipe-lightbox.esm.js.map diff --git a/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js.map b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js.map new file mode 100644 index 0000000..71c7ad8 --- /dev/null +++ b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"photoswipe-lightbox.esm.js","sources":["../../../src/js/util/util.js","../../../src/js/core/eventable.js","../../../src/js/slide/placeholder.js","../../../src/js/slide/content.js","../../../src/js/util/viewport-size.js","../../../src/js/slide/zoom-level.js","../../../src/js/slide/loader.js","../../../src/js/core/base.js","../../../src/js/lightbox/lightbox.js"],"sourcesContent":["/** @typedef {import('../photoswipe.js').Point} Point */\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} T\r\n * @param {string} className\r\n * @param {T} tagName\r\n * @param {Node} [appendToEl]\r\n * @returns {HTMLElementTagNameMap[T]}\r\n */\r\nexport function createElement(className, tagName, appendToEl) {\r\n const el = document.createElement(tagName);\r\n if (className) {\r\n el.className = className;\r\n }\r\n if (appendToEl) {\r\n appendToEl.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @returns {Point}\r\n */\r\nexport function equalizePoints(p1, p2) {\r\n p1.x = p2.x;\r\n p1.y = p2.y;\r\n if (p2.id !== undefined) {\r\n p1.id = p2.id;\r\n }\r\n return p1;\r\n}\r\n\r\n/**\r\n * @param {Point} p\r\n */\r\nexport function roundPoint(p) {\r\n p.x = Math.round(p.x);\r\n p.y = Math.round(p.y);\r\n}\r\n\r\n/**\r\n * Returns distance between two points.\r\n *\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @returns {number}\r\n */\r\nexport function getDistanceBetween(p1, p2) {\r\n const x = Math.abs(p1.x - p2.x);\r\n const y = Math.abs(p1.y - p2.y);\r\n return Math.sqrt((x * x) + (y * y));\r\n}\r\n\r\n/**\r\n * Whether X and Y positions of points are equal\r\n *\r\n * @param {Point} p1\r\n * @param {Point} p2\r\n * @returns {boolean}\r\n */\r\nexport function pointsEqual(p1, p2) {\r\n return p1.x === p2.x && p1.y === p2.y;\r\n}\r\n\r\n/**\r\n * The float result between the min and max values.\r\n *\r\n * @param {number} val\r\n * @param {number} min\r\n * @param {number} max\r\n * @returns {number}\r\n */\r\nexport function clamp(val, min, max) {\r\n return Math.min(Math.max(val, min), max);\r\n}\r\n\r\n/**\r\n * Get transform string\r\n *\r\n * @param {number} x\r\n * @param {number} [y]\r\n * @param {number} [scale]\r\n * @returns {string}\r\n */\r\nexport function toTransformString(x, y, scale) {\r\n let propValue = `translate3d(${x}px,${y || 0}px,0)`;\r\n\r\n if (scale !== undefined) {\r\n propValue += ` scale3d(${scale},${scale},1)`;\r\n }\r\n\r\n return propValue;\r\n}\r\n\r\n/**\r\n * Apply transform:translate(x, y) scale(scale) to element\r\n *\r\n * @param {HTMLElement} el\r\n * @param {number} x\r\n * @param {number} [y]\r\n * @param {number} [scale]\r\n */\r\nexport function setTransform(el, x, y, scale) {\r\n el.style.transform = toTransformString(x, y, scale);\r\n}\r\n\r\nconst defaultCSSEasing = 'cubic-bezier(.4,0,.22,1)';\r\n\r\n/**\r\n * Apply CSS transition to element\r\n *\r\n * @param {HTMLElement} el\r\n * @param {string} [prop] CSS property to animate\r\n * @param {number} [duration] in ms\r\n * @param {string} [ease] CSS easing function\r\n */\r\nexport function setTransitionStyle(el, prop, duration, ease) {\r\n // inOut: 'cubic-bezier(.4, 0, .22, 1)', // for \"toggle state\" transitions\r\n // out: 'cubic-bezier(0, 0, .22, 1)', // for \"show\" transitions\r\n // in: 'cubic-bezier(.4, 0, 1, 1)'// for \"hide\" transitions\r\n el.style.transition = prop\r\n ? `${prop} ${duration}ms ${ease || defaultCSSEasing}`\r\n : 'none';\r\n}\r\n\r\n/**\r\n * Apply width and height CSS properties to element\r\n *\r\n * @param {HTMLElement} el\r\n * @param {string | number} w\r\n * @param {string | number} h\r\n */\r\nexport function setWidthHeight(el, w, h) {\r\n el.style.width = (typeof w === 'number') ? `${w}px` : w;\r\n el.style.height = (typeof h === 'number') ? `${h}px` : h;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} el\r\n */\r\nexport function removeTransitionStyle(el) {\r\n setTransitionStyle(el);\r\n}\r\n\r\n/**\r\n * @param {HTMLImageElement} img\r\n * @returns {Promise}\r\n */\r\nexport function decodeImage(img) {\r\n if ('decode' in img) {\r\n return img.decode().catch(() => {});\r\n }\r\n\r\n if (img.complete) {\r\n return Promise.resolve(img);\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n img.onload = () => resolve(img);\r\n img.onerror = reject;\r\n });\r\n}\r\n\r\n/** @typedef {LOAD_STATE[keyof LOAD_STATE]} LoadState */\r\n/** @type {{ IDLE: 'idle'; LOADING: 'loading'; LOADED: 'loaded'; ERROR: 'error' }} */\r\nexport const LOAD_STATE = {\r\n IDLE: 'idle',\r\n LOADING: 'loading',\r\n LOADED: 'loaded',\r\n ERROR: 'error',\r\n};\r\n\r\n\r\n/**\r\n * Check if click or keydown event was dispatched\r\n * with a special key or via mouse wheel.\r\n *\r\n * @param {MouseEvent | KeyboardEvent} e\r\n * @returns {boolean}\r\n */\r\nexport function specialKeyUsed(e) {\r\n return ('button' in e && e.button === 1) || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey;\r\n}\r\n\r\n/**\r\n * Parse `gallery` or `children` options.\r\n *\r\n * @param {import('../photoswipe.js').ElementProvider} [option]\r\n * @param {string} [legacySelector]\r\n * @param {HTMLElement | Document} [parent]\r\n * @returns HTMLElement[]\r\n */\r\nexport function getElementsFromOption(option, legacySelector, parent = document) {\r\n /** @type {HTMLElement[]} */\r\n let elements = [];\r\n\r\n if (option instanceof Element) {\r\n elements = [option];\r\n } else if (option instanceof NodeList || Array.isArray(option)) {\r\n elements = Array.from(option);\r\n } else {\r\n const selector = typeof option === 'string' ? option : legacySelector;\r\n if (selector) {\r\n elements = Array.from(parent.querySelectorAll(selector));\r\n }\r\n }\r\n\r\n return elements;\r\n}\r\n\r\n/**\r\n * Check if variable is PhotoSwipe class\r\n *\r\n * @param {any} fn\r\n * @returns {boolean}\r\n */\r\nexport function isPswpClass(fn) {\r\n return typeof fn === 'function'\r\n && fn.prototype\r\n && fn.prototype.goTo;\r\n}\r\n\r\n/**\r\n * Check if browser is Safari\r\n *\r\n * @returns {boolean}\r\n */\r\nexport function isSafari() {\r\n return !!(navigator.vendor && navigator.vendor.match(/apple/i));\r\n}\r\n\r\n","/** @typedef {import('../lightbox/lightbox.js').default} PhotoSwipeLightbox */\r\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\r\n/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */\r\n/** @typedef {import('../photoswipe.js').DataSource} DataSource */\r\n/** @typedef {import('../ui/ui-element.js').UIElementData} UIElementData */\r\n/** @typedef {import('../slide/content.js').default} ContentDefault */\r\n/** @typedef {import('../slide/slide.js').default} Slide */\r\n/** @typedef {import('../slide/slide.js').SlideData} SlideData */\r\n/** @typedef {import('../slide/zoom-level.js').default} ZoomLevel */\r\n/** @typedef {import('../slide/get-thumb-bounds.js').Bounds} Bounds */\r\n\r\n/**\r\n * Allow adding an arbitrary props to the Content\r\n * https://photoswipe.com/custom-content/#using-webp-image-format\r\n * @typedef {ContentDefault & Record} Content\r\n */\r\n/** @typedef {{ x?: number; y?: number }} Point */\r\n\r\n/**\r\n * @typedef {Object} PhotoSwipeEventsMap https://photoswipe.com/events/\r\n *\r\n *\r\n * https://photoswipe.com/adding-ui-elements/\r\n *\r\n * @prop {undefined} uiRegister\r\n * @prop {{ data: UIElementData }} uiElementCreate\r\n *\r\n *\r\n * https://photoswipe.com/events/#initialization-events\r\n *\r\n * @prop {undefined} beforeOpen\r\n * @prop {undefined} firstUpdate\r\n * @prop {undefined} initialLayout\r\n * @prop {undefined} change\r\n * @prop {undefined} afterInit\r\n * @prop {undefined} bindEvents\r\n *\r\n *\r\n * https://photoswipe.com/events/#opening-or-closing-transition-events\r\n *\r\n * @prop {undefined} openingAnimationStart\r\n * @prop {undefined} openingAnimationEnd\r\n * @prop {undefined} closingAnimationStart\r\n * @prop {undefined} closingAnimationEnd\r\n *\r\n *\r\n * https://photoswipe.com/events/#closing-events\r\n *\r\n * @prop {undefined} close\r\n * @prop {undefined} destroy\r\n *\r\n *\r\n * https://photoswipe.com/events/#pointer-and-gesture-events\r\n *\r\n * @prop {{ originalEvent: PointerEvent }} pointerDown\r\n * @prop {{ originalEvent: PointerEvent }} pointerMove\r\n * @prop {{ originalEvent: PointerEvent }} pointerUp\r\n * @prop {{ bgOpacity: number }} pinchClose can be default prevented\r\n * @prop {{ panY: number }} verticalDrag can be default prevented\r\n *\r\n *\r\n * https://photoswipe.com/events/#slide-content-events\r\n *\r\n * @prop {{ content: Content }} contentInit\r\n * @prop {{ content: Content; isLazy: boolean }} contentLoad can be default prevented\r\n * @prop {{ content: Content; isLazy: boolean }} contentLoadImage can be default prevented\r\n * @prop {{ content: Content; slide: Slide; isError?: boolean }} loadComplete\r\n * @prop {{ content: Content; slide: Slide }} loadError\r\n * @prop {{ content: Content; width: number; height: number }} contentResize can be default prevented\r\n * @prop {{ content: Content; width: number; height: number; slide: Slide }} imageSizeChange\r\n * @prop {{ content: Content }} contentLazyLoad can be default prevented\r\n * @prop {{ content: Content }} contentAppend can be default prevented\r\n * @prop {{ content: Content }} contentActivate can be default prevented\r\n * @prop {{ content: Content }} contentDeactivate can be default prevented\r\n * @prop {{ content: Content }} contentRemove can be default prevented\r\n * @prop {{ content: Content }} contentDestroy can be default prevented\r\n *\r\n *\r\n * undocumented\r\n *\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} imageClickAction can be default prevented\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} bgClickAction can be default prevented\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} tapAction can be default prevented\r\n * @prop {{ point: Point; originalEvent: PointerEvent }} doubleTapAction can be default prevented\r\n *\r\n * @prop {{ originalEvent: KeyboardEvent }} keydown can be default prevented\r\n * @prop {{ x: number; dragging: boolean }} moveMainScroll\r\n * @prop {{ slide: Slide }} firstZoomPan\r\n * @prop {{ slide: Slide | undefined, data: SlideData, index: number }} gettingData\r\n * @prop {undefined} beforeResize\r\n * @prop {undefined} resize\r\n * @prop {undefined} viewportSize\r\n * @prop {undefined} updateScrollOffset\r\n * @prop {{ slide: Slide }} slideInit\r\n * @prop {{ slide: Slide }} afterSetContent\r\n * @prop {{ slide: Slide }} slideLoad\r\n * @prop {{ slide: Slide }} appendHeavy can be default prevented\r\n * @prop {{ slide: Slide }} appendHeavyContent\r\n * @prop {{ slide: Slide }} slideActivate\r\n * @prop {{ slide: Slide }} slideDeactivate\r\n * @prop {{ slide: Slide }} slideDestroy\r\n * @prop {{ destZoomLevel: number, centerPoint: Point | undefined, transitionDuration: number | false | undefined }} beforeZoomTo\r\n * @prop {{ slide: Slide }} zoomPanUpdate\r\n * @prop {{ slide: Slide }} initialZoomPan\r\n * @prop {{ slide: Slide }} calcSlideSize\r\n * @prop {undefined} resolutionChanged\r\n * @prop {{ originalEvent: WheelEvent }} wheel can be default prevented\r\n * @prop {{ content: Content }} contentAppendImage can be default prevented\r\n * @prop {{ index: number; itemData: SlideData }} lazyLoadSlide can be default prevented\r\n * @prop {undefined} lazyLoad\r\n * @prop {{ slide: Slide }} calcBounds\r\n * @prop {{ zoomLevels: ZoomLevel, slideData: SlideData }} zoomLevelsUpdate\r\n *\r\n *\r\n * legacy\r\n *\r\n * @prop {undefined} init\r\n * @prop {undefined} initialZoomIn\r\n * @prop {undefined} initialZoomOut\r\n * @prop {undefined} initialZoomInEnd\r\n * @prop {undefined} initialZoomOutEnd\r\n * @prop {{ dataSource: DataSource | undefined, numItems: number }} numItems\r\n * @prop {{ itemData: SlideData; index: number }} itemData\r\n * @prop {{ index: number, itemData: SlideData, instance: PhotoSwipe }} thumbBounds\r\n */\r\n\r\n/**\r\n * @typedef {Object} PhotoSwipeFiltersMap https://photoswipe.com/filters/\r\n *\r\n * @prop {(numItems: number, dataSource: DataSource | undefined) => number} numItems\r\n * Modify the total amount of slides. Example on Data sources page.\r\n * https://photoswipe.com/filters/#numitems\r\n *\r\n * @prop {(itemData: SlideData, index: number) => SlideData} itemData\r\n * Modify slide item data. Example on Data sources page.\r\n * https://photoswipe.com/filters/#itemdata\r\n *\r\n * @prop {(itemData: SlideData, element: HTMLElement, linkEl: HTMLAnchorElement) => SlideData} domItemData\r\n * Modify item data when it's parsed from DOM element. Example on Data sources page.\r\n * https://photoswipe.com/filters/#domitemdata\r\n *\r\n * @prop {(clickedIndex: number, e: MouseEvent, instance: PhotoSwipeLightbox) => number} clickedIndex\r\n * Modify clicked gallery item index.\r\n * https://photoswipe.com/filters/#clickedindex\r\n *\r\n * @prop {(placeholderSrc: string | false, content: Content) => string | false} placeholderSrc\r\n * Modify placeholder image source.\r\n * https://photoswipe.com/filters/#placeholdersrc\r\n *\r\n * @prop {(isContentLoading: boolean, content: Content) => boolean} isContentLoading\r\n * Modify if the content is currently loading.\r\n * https://photoswipe.com/filters/#iscontentloading\r\n *\r\n * @prop {(isContentZoomable: boolean, content: Content) => boolean} isContentZoomable\r\n * Modify if the content can be zoomed.\r\n * https://photoswipe.com/filters/#iscontentzoomable\r\n *\r\n * @prop {(useContentPlaceholder: boolean, content: Content) => boolean} useContentPlaceholder\r\n * Modify if the placeholder should be used for the content.\r\n * https://photoswipe.com/filters/#usecontentplaceholder\r\n *\r\n * @prop {(isKeepingPlaceholder: boolean, content: Content) => boolean} isKeepingPlaceholder\r\n * Modify if the placeholder should be kept after the content is loaded.\r\n * https://photoswipe.com/filters/#iskeepingplaceholder\r\n *\r\n *\r\n * @prop {(contentErrorElement: HTMLElement, content: Content) => HTMLElement} contentErrorElement\r\n * Modify an element when the content has error state (for example, if image cannot be loaded).\r\n * https://photoswipe.com/filters/#contenterrorelement\r\n *\r\n * @prop {(element: HTMLElement, data: UIElementData) => HTMLElement} uiElement\r\n * Modify a UI element that's being created.\r\n * https://photoswipe.com/filters/#uielement\r\n *\r\n * @prop {(thumbnail: HTMLElement | null | undefined, itemData: SlideData, index: number) => HTMLElement} thumbEl\r\n * Modify the thumbnail element from which opening zoom animation starts or ends.\r\n * https://photoswipe.com/filters/#thumbel\r\n *\r\n * @prop {(thumbBounds: Bounds | undefined, itemData: SlideData, index: number) => Bounds} thumbBounds\r\n * Modify the thumbnail bounds from which opening zoom animation starts or ends.\r\n * https://photoswipe.com/filters/#thumbbounds\r\n *\r\n * @prop {(srcsetSizesWidth: number, content: Content) => number} srcsetSizesWidth\r\n *\r\n * @prop {(preventPointerEvent: boolean, event: PointerEvent, pointerType: string) => boolean} preventPointerEvent\r\n *\r\n */\r\n\r\n/**\r\n * @template {keyof PhotoSwipeFiltersMap} T\r\n * @typedef {{ fn: PhotoSwipeFiltersMap[T], priority: number }} Filter\r\n */\r\n\r\n/**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @typedef {PhotoSwipeEventsMap[T] extends undefined ? PhotoSwipeEvent : PhotoSwipeEvent & PhotoSwipeEventsMap[T]} AugmentedEvent\r\n */\r\n\r\n/**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @typedef {(event: AugmentedEvent) => void} EventCallback\r\n */\r\n\r\n/**\r\n * Base PhotoSwipe event object\r\n *\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n */\r\nclass PhotoSwipeEvent {\r\n /**\r\n * @param {T} type\r\n * @param {PhotoSwipeEventsMap[T]} [details]\r\n */\r\n constructor(type, details) {\r\n this.type = type;\r\n this.defaultPrevented = false;\r\n if (details) {\r\n Object.assign(this, details);\r\n }\r\n }\r\n\r\n preventDefault() {\r\n this.defaultPrevented = true;\r\n }\r\n}\r\n\r\n/**\r\n * PhotoSwipe base class that can listen and dispatch for events.\r\n * Shared by PhotoSwipe Core and PhotoSwipe Lightbox, extended by base.js\r\n */\r\nclass Eventable {\r\n constructor() {\r\n /**\r\n * @type {{ [T in keyof PhotoSwipeEventsMap]?: ((event: AugmentedEvent) => void)[] }}\r\n */\r\n this._listeners = {};\r\n\r\n /**\r\n * @type {{ [T in keyof PhotoSwipeFiltersMap]?: Filter[] }}\r\n */\r\n this._filters = {};\r\n\r\n /** @type {PhotoSwipe | undefined} */\r\n this.pswp = undefined;\r\n\r\n /** @type {PhotoSwipeOptions | undefined} */\r\n this.options = undefined;\r\n }\r\n\r\n /**\r\n * @template {keyof PhotoSwipeFiltersMap} T\r\n * @param {T} name\r\n * @param {PhotoSwipeFiltersMap[T]} fn\r\n * @param {number} priority\r\n */\r\n addFilter(name, fn, priority = 100) {\r\n if (!this._filters[name]) {\r\n this._filters[name] = [];\r\n }\r\n\r\n this._filters[name]?.push({ fn, priority });\r\n this._filters[name]?.sort((f1, f2) => f1.priority - f2.priority);\r\n\r\n this.pswp?.addFilter(name, fn, priority);\r\n }\r\n\r\n /**\r\n * @template {keyof PhotoSwipeFiltersMap} T\r\n * @param {T} name\r\n * @param {PhotoSwipeFiltersMap[T]} fn\r\n */\r\n removeFilter(name, fn) {\r\n if (this._filters[name]) {\r\n // @ts-expect-error\r\n this._filters[name] = this._filters[name].filter(filter => (filter.fn !== fn));\r\n }\r\n\r\n if (this.pswp) {\r\n this.pswp.removeFilter(name, fn);\r\n }\r\n }\r\n\r\n /**\r\n * @template {keyof PhotoSwipeFiltersMap} T\r\n * @param {T} name\r\n * @param {Parameters} args\r\n * @returns {Parameters[0]}\r\n */\r\n applyFilters(name, ...args) {\r\n this._filters[name]?.forEach((filter) => {\r\n // @ts-expect-error\r\n args[0] = filter.fn.apply(this, args);\r\n });\r\n return args[0];\r\n }\r\n\r\n /**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @param {T} name\r\n * @param {EventCallback} fn\r\n */\r\n on(name, fn) {\r\n if (!this._listeners[name]) {\r\n this._listeners[name] = [];\r\n }\r\n this._listeners[name]?.push(fn);\r\n\r\n // When binding events to lightbox,\r\n // also bind events to PhotoSwipe Core,\r\n // if it's open.\r\n this.pswp?.on(name, fn);\r\n }\r\n\r\n /**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @param {T} name\r\n * @param {EventCallback} fn\r\n */\r\n off(name, fn) {\r\n if (this._listeners[name]) {\r\n // @ts-expect-error\r\n this._listeners[name] = this._listeners[name].filter(listener => (fn !== listener));\r\n }\r\n\r\n this.pswp?.off(name, fn);\r\n }\r\n\r\n /**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @param {T} name\r\n * @param {PhotoSwipeEventsMap[T]} [details]\r\n * @returns {AugmentedEvent}\r\n */\r\n dispatch(name, details) {\r\n if (this.pswp) {\r\n return this.pswp.dispatch(name, details);\r\n }\r\n\r\n const event = /** @type {AugmentedEvent} */ (new PhotoSwipeEvent(name, details));\r\n\r\n this._listeners[name]?.forEach((listener) => {\r\n listener.call(this, event);\r\n });\r\n\r\n return event;\r\n }\r\n}\r\n\r\nexport default Eventable;\r\n","import { createElement, setWidthHeight, toTransformString } from '../util/util.js';\r\n\r\nclass Placeholder {\r\n /**\r\n * @param {string | false} imageSrc\r\n * @param {HTMLElement} container\r\n */\r\n constructor(imageSrc, container) {\r\n // Create placeholder\r\n // (stretched thumbnail or simple div behind the main image)\r\n /** @type {HTMLImageElement | HTMLDivElement | null} */\r\n this.element = createElement(\r\n 'pswp__img pswp__img--placeholder',\r\n imageSrc ? 'img' : 'div',\r\n container\r\n );\r\n\r\n if (imageSrc) {\r\n const imgEl = /** @type {HTMLImageElement} */ (this.element);\r\n imgEl.decoding = 'async';\r\n imgEl.alt = '';\r\n imgEl.src = imageSrc;\r\n imgEl.setAttribute('role', 'presentation');\r\n }\r\n\r\n this.element.setAttribute('aria-hidden', 'true');\r\n }\r\n\r\n /**\r\n * @param {number} width\r\n * @param {number} height\r\n */\r\n setDisplayedSize(width, height) {\r\n if (!this.element) {\r\n return;\r\n }\r\n\r\n if (this.element.tagName === 'IMG') {\r\n // Use transform scale() to modify img placeholder size\r\n // (instead of changing width/height directly).\r\n // This helps with performance, specifically in iOS15 Safari.\r\n setWidthHeight(this.element, 250, 'auto');\r\n this.element.style.transformOrigin = '0 0';\r\n this.element.style.transform = toTransformString(0, 0, width / 250);\r\n } else {\r\n setWidthHeight(this.element, width, height);\r\n }\r\n }\r\n\r\n destroy() {\r\n if (this.element?.parentNode) {\r\n this.element.remove();\r\n }\r\n this.element = null;\r\n }\r\n}\r\n\r\nexport default Placeholder;\r\n","import { createElement, isSafari, LOAD_STATE, setWidthHeight } from '../util/util.js';\r\nimport Placeholder from './placeholder.js';\r\n\r\n/** @typedef {import('./slide.js').default} Slide */\r\n/** @typedef {import('./slide.js').SlideData} SlideData */\r\n/** @typedef {import('../core/base.js').default} PhotoSwipeBase */\r\n/** @typedef {import('../util/util.js').LoadState} LoadState */\r\n\r\nclass Content {\r\n /**\r\n * @param {SlideData} itemData Slide data\r\n * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance\r\n * @param {number} index\r\n */\r\n constructor(itemData, instance, index) {\r\n this.instance = instance;\r\n this.data = itemData;\r\n this.index = index;\r\n\r\n /** @type {HTMLImageElement | HTMLDivElement | undefined} */\r\n this.element = undefined;\r\n /** @type {Placeholder | undefined} */\r\n this.placeholder = undefined;\r\n /** @type {Slide | undefined} */\r\n this.slide = undefined;\r\n\r\n this.displayedImageWidth = 0;\r\n this.displayedImageHeight = 0;\r\n\r\n this.width = Number(this.data.w) || Number(this.data.width) || 0;\r\n this.height = Number(this.data.h) || Number(this.data.height) || 0;\r\n\r\n this.isAttached = false;\r\n this.hasSlide = false;\r\n this.isDecoding = false;\r\n /** @type {LoadState} */\r\n this.state = LOAD_STATE.IDLE;\r\n\r\n if (this.data.type) {\r\n this.type = this.data.type;\r\n } else if (this.data.src) {\r\n this.type = 'image';\r\n } else {\r\n this.type = 'html';\r\n }\r\n\r\n this.instance.dispatch('contentInit', { content: this });\r\n }\r\n\r\n removePlaceholder() {\r\n if (this.placeholder && !this.keepPlaceholder()) {\r\n // With delay, as image might be loaded, but not rendered\r\n setTimeout(() => {\r\n if (this.placeholder) {\r\n this.placeholder.destroy();\r\n this.placeholder = undefined;\r\n }\r\n }, 1000);\r\n }\r\n }\r\n\r\n /**\r\n * Preload content\r\n *\r\n * @param {boolean} isLazy\r\n * @param {boolean} [reload]\r\n */\r\n load(isLazy, reload) {\r\n if (this.slide && this.usePlaceholder()) {\r\n if (!this.placeholder) {\r\n const placeholderSrc = this.instance.applyFilters(\r\n 'placeholderSrc',\r\n // use image-based placeholder only for the first slide,\r\n // as rendering (even small stretched thumbnail) is an expensive operation\r\n (this.data.msrc && this.slide.isFirstSlide) ? this.data.msrc : false,\r\n this\r\n );\r\n this.placeholder = new Placeholder(\r\n placeholderSrc,\r\n this.slide.container\r\n );\r\n } else {\r\n const placeholderEl = this.placeholder.element;\r\n // Add placeholder to DOM if it was already created\r\n if (placeholderEl && !placeholderEl.parentElement) {\r\n this.slide.container.prepend(placeholderEl);\r\n }\r\n }\r\n }\r\n\r\n if (this.element && !reload) {\r\n return;\r\n }\r\n\r\n if (this.instance.dispatch('contentLoad', { content: this, isLazy }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n if (this.isImageContent()) {\r\n this.element = createElement('pswp__img', 'img');\r\n // Start loading only after width is defined, as sizes might depend on it.\r\n // Due to Safari feature, we must define sizes before srcset.\r\n if (this.displayedImageWidth) {\r\n this.loadImage(isLazy);\r\n }\r\n } else {\r\n this.element = createElement('pswp__content', 'div');\r\n this.element.innerHTML = this.data.html || '';\r\n }\r\n\r\n if (reload && this.slide) {\r\n this.slide.updateContentSize(true);\r\n }\r\n }\r\n\r\n /**\r\n * Preload image\r\n *\r\n * @param {boolean} isLazy\r\n */\r\n loadImage(isLazy) {\r\n if (!this.isImageContent()\r\n || !this.element\r\n || this.instance.dispatch('contentLoadImage', { content: this, isLazy }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n const imageElement = /** @type HTMLImageElement */ (this.element);\r\n\r\n this.updateSrcsetSizes();\r\n\r\n if (this.data.srcset) {\r\n imageElement.srcset = this.data.srcset;\r\n }\r\n\r\n imageElement.src = this.data.src ?? '';\r\n imageElement.alt = this.data.alt ?? '';\r\n\r\n this.state = LOAD_STATE.LOADING;\r\n\r\n if (imageElement.complete) {\r\n this.onLoaded();\r\n } else {\r\n imageElement.onload = () => {\r\n this.onLoaded();\r\n };\r\n\r\n imageElement.onerror = () => {\r\n this.onError();\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Assign slide to content\r\n *\r\n * @param {Slide} slide\r\n */\r\n setSlide(slide) {\r\n this.slide = slide;\r\n this.hasSlide = true;\r\n this.instance = slide.pswp;\r\n\r\n // todo: do we need to unset slide?\r\n }\r\n\r\n /**\r\n * Content load success handler\r\n */\r\n onLoaded() {\r\n this.state = LOAD_STATE.LOADED;\r\n\r\n if (this.slide && this.element) {\r\n this.instance.dispatch('loadComplete', { slide: this.slide, content: this });\r\n\r\n // if content is reloaded\r\n if (this.slide.isActive\r\n && this.slide.heavyAppended\r\n && !this.element.parentNode) {\r\n this.append();\r\n this.slide.updateContentSize(true);\r\n }\r\n\r\n if (this.state === LOAD_STATE.LOADED || this.state === LOAD_STATE.ERROR) {\r\n this.removePlaceholder();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Content load error handler\r\n */\r\n onError() {\r\n this.state = LOAD_STATE.ERROR;\r\n\r\n if (this.slide) {\r\n this.displayError();\r\n this.instance.dispatch('loadComplete', { slide: this.slide, isError: true, content: this });\r\n this.instance.dispatch('loadError', { slide: this.slide, content: this });\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Boolean} If the content is currently loading\r\n */\r\n isLoading() {\r\n return this.instance.applyFilters(\r\n 'isContentLoading',\r\n this.state === LOAD_STATE.LOADING,\r\n this\r\n );\r\n }\r\n\r\n /**\r\n * @returns {Boolean} If the content is in error state\r\n */\r\n isError() {\r\n return this.state === LOAD_STATE.ERROR;\r\n }\r\n\r\n /**\r\n * @returns {boolean} If the content is image\r\n */\r\n isImageContent() {\r\n return this.type === 'image';\r\n }\r\n\r\n /**\r\n * Update content size\r\n *\r\n * @param {Number} width\r\n * @param {Number} height\r\n */\r\n setDisplayedSize(width, height) {\r\n if (!this.element) {\r\n return;\r\n }\r\n\r\n if (this.placeholder) {\r\n this.placeholder.setDisplayedSize(width, height);\r\n }\r\n\r\n if (this.instance.dispatch(\r\n 'contentResize',\r\n { content: this, width, height }).defaultPrevented\r\n ) {\r\n return;\r\n }\r\n\r\n setWidthHeight(this.element, width, height);\r\n\r\n if (this.isImageContent() && !this.isError()) {\r\n const isInitialSizeUpdate = (!this.displayedImageWidth && width);\r\n\r\n this.displayedImageWidth = width;\r\n this.displayedImageHeight = height;\r\n\r\n if (isInitialSizeUpdate) {\r\n this.loadImage(false);\r\n } else {\r\n this.updateSrcsetSizes();\r\n }\r\n\r\n if (this.slide) {\r\n this.instance.dispatch(\r\n 'imageSizeChange',\r\n { slide: this.slide, width, height, content: this }\r\n );\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @returns {boolean} If the content can be zoomed\r\n */\r\n isZoomable() {\r\n return this.instance.applyFilters(\r\n 'isContentZoomable',\r\n this.isImageContent() && (this.state !== LOAD_STATE.ERROR),\r\n this\r\n );\r\n }\r\n\r\n /**\r\n * Update image srcset sizes attribute based on width and height\r\n */\r\n updateSrcsetSizes() {\r\n // Handle srcset sizes attribute.\r\n //\r\n // Never lower quality, if it was increased previously.\r\n // Chrome does this automatically, Firefox and Safari do not,\r\n // so we store largest used size in dataset.\r\n if (!this.isImageContent() || !this.element || !this.data.srcset) {\r\n return;\r\n }\r\n\r\n const image = /** @type HTMLImageElement */ (this.element);\r\n const sizesWidth = this.instance.applyFilters(\r\n 'srcsetSizesWidth',\r\n this.displayedImageWidth,\r\n this\r\n );\r\n\r\n if (\r\n !image.dataset.largestUsedSize\r\n || sizesWidth > parseInt(image.dataset.largestUsedSize, 10)\r\n ) {\r\n image.sizes = sizesWidth + 'px';\r\n image.dataset.largestUsedSize = String(sizesWidth);\r\n }\r\n }\r\n\r\n /**\r\n * @returns {boolean} If content should use a placeholder (from msrc by default)\r\n */\r\n usePlaceholder() {\r\n return this.instance.applyFilters(\r\n 'useContentPlaceholder',\r\n this.isImageContent(),\r\n this\r\n );\r\n }\r\n\r\n /**\r\n * Preload content with lazy-loading param\r\n */\r\n lazyLoad() {\r\n if (this.instance.dispatch('contentLazyLoad', { content: this }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n this.load(true);\r\n }\r\n\r\n /**\r\n * @returns {boolean} If placeholder should be kept after content is loaded\r\n */\r\n keepPlaceholder() {\r\n return this.instance.applyFilters(\r\n 'isKeepingPlaceholder',\r\n this.isLoading(),\r\n this\r\n );\r\n }\r\n\r\n /**\r\n * Destroy the content\r\n */\r\n destroy() {\r\n this.hasSlide = false;\r\n this.slide = undefined;\r\n\r\n if (this.instance.dispatch('contentDestroy', { content: this }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n this.remove();\r\n\r\n if (this.placeholder) {\r\n this.placeholder.destroy();\r\n this.placeholder = undefined;\r\n }\r\n\r\n if (this.isImageContent() && this.element) {\r\n this.element.onload = null;\r\n this.element.onerror = null;\r\n this.element = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Display error message\r\n */\r\n displayError() {\r\n if (this.slide) {\r\n let errorMsgEl = createElement('pswp__error-msg', 'div');\r\n errorMsgEl.innerText = this.instance.options?.errorMsg ?? '';\r\n errorMsgEl = /** @type {HTMLDivElement} */ (this.instance.applyFilters(\r\n 'contentErrorElement',\r\n errorMsgEl,\r\n this\r\n ));\r\n this.element = createElement('pswp__content pswp__error-msg-container', 'div');\r\n this.element.appendChild(errorMsgEl);\r\n this.slide.container.innerText = '';\r\n this.slide.container.appendChild(this.element);\r\n this.slide.updateContentSize(true);\r\n this.removePlaceholder();\r\n }\r\n }\r\n\r\n /**\r\n * Append the content\r\n */\r\n append() {\r\n if (this.isAttached || !this.element) {\r\n return;\r\n }\r\n\r\n this.isAttached = true;\r\n\r\n if (this.state === LOAD_STATE.ERROR) {\r\n this.displayError();\r\n return;\r\n }\r\n\r\n if (this.instance.dispatch('contentAppend', { content: this }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n const supportsDecode = ('decode' in this.element);\r\n\r\n if (this.isImageContent()) {\r\n // Use decode() on nearby slides\r\n //\r\n // Nearby slide images are in DOM and not hidden via display:none.\r\n // However, they are placed offscreen (to the left and right side).\r\n //\r\n // Some browsers do not composite the image until it's actually visible,\r\n // using decode() helps.\r\n //\r\n // You might ask \"why dont you just decode() and then append all images\",\r\n // that's because I want to show image before it's fully loaded,\r\n // as browser can render parts of image while it is loading.\r\n // We do not do this in Safari due to partial loading bug.\r\n if (supportsDecode && this.slide && (!this.slide.isActive || isSafari())) {\r\n this.isDecoding = true;\r\n // purposefully using finally instead of then,\r\n // as if srcset sizes changes dynamically - it may cause decode error\r\n /** @type {HTMLImageElement} */\r\n (this.element).decode().catch(() => {}).finally(() => {\r\n this.isDecoding = false;\r\n this.appendImage();\r\n });\r\n } else {\r\n this.appendImage();\r\n }\r\n } else if (this.slide && !this.element.parentNode) {\r\n this.slide.container.appendChild(this.element);\r\n }\r\n }\r\n\r\n /**\r\n * Activate the slide,\r\n * active slide is generally the current one,\r\n * meaning the user can see it.\r\n */\r\n activate() {\r\n if (this.instance.dispatch('contentActivate', { content: this }).defaultPrevented\r\n || !this.slide) {\r\n return;\r\n }\r\n\r\n if (this.isImageContent() && this.isDecoding && !isSafari()) {\r\n // add image to slide when it becomes active,\r\n // even if it's not finished decoding\r\n this.appendImage();\r\n } else if (this.isError()) {\r\n this.load(false, true); // try to reload\r\n }\r\n\r\n if (this.slide.holderElement) {\r\n this.slide.holderElement.setAttribute('aria-hidden', 'false');\r\n }\r\n }\r\n\r\n /**\r\n * Deactivate the content\r\n */\r\n deactivate() {\r\n this.instance.dispatch('contentDeactivate', { content: this });\r\n if (this.slide && this.slide.holderElement) {\r\n this.slide.holderElement.setAttribute('aria-hidden', 'true');\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Remove the content from DOM\r\n */\r\n remove() {\r\n this.isAttached = false;\r\n\r\n if (this.instance.dispatch('contentRemove', { content: this }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n if (this.element && this.element.parentNode) {\r\n this.element.remove();\r\n }\r\n\r\n if (this.placeholder && this.placeholder.element) {\r\n this.placeholder.element.remove();\r\n }\r\n }\r\n\r\n /**\r\n * Append the image content to slide container\r\n */\r\n appendImage() {\r\n if (!this.isAttached) {\r\n return;\r\n }\r\n\r\n if (this.instance.dispatch('contentAppendImage', { content: this }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n // ensure that element exists and is not already appended\r\n if (this.slide && this.element && !this.element.parentNode) {\r\n this.slide.container.appendChild(this.element);\r\n }\r\n\r\n if (this.state === LOAD_STATE.LOADED || this.state === LOAD_STATE.ERROR) {\r\n this.removePlaceholder();\r\n }\r\n }\r\n}\r\n\r\nexport default Content;\r\n","/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */\r\n/** @typedef {import('../core/base.js').default} PhotoSwipeBase */\r\n/** @typedef {import('../photoswipe.js').Point} Point */\r\n/** @typedef {import('../slide/slide.js').SlideData} SlideData */\r\n\r\n/**\r\n * @param {PhotoSwipeOptions} options\r\n * @param {PhotoSwipeBase} pswp\r\n * @returns {Point}\r\n */\r\nexport function getViewportSize(options, pswp) {\r\n if (options.getViewportSizeFn) {\r\n const newViewportSize = options.getViewportSizeFn(options, pswp);\r\n if (newViewportSize) {\r\n return newViewportSize;\r\n }\r\n }\r\n\r\n return {\r\n x: document.documentElement.clientWidth,\r\n\r\n // TODO: height on mobile is very incosistent due to toolbar\r\n // find a way to improve this\r\n //\r\n // document.documentElement.clientHeight - doesn't seem to work well\r\n y: window.innerHeight\r\n };\r\n}\r\n\r\n/**\r\n * Parses padding option.\r\n * Supported formats:\r\n *\r\n * // Object\r\n * padding: {\r\n * top: 0,\r\n * bottom: 0,\r\n * left: 0,\r\n * right: 0\r\n * }\r\n *\r\n * // A function that returns the object\r\n * paddingFn: (viewportSize, itemData, index) => {\r\n * return {\r\n * top: 0,\r\n * bottom: 0,\r\n * left: 0,\r\n * right: 0\r\n * };\r\n * }\r\n *\r\n * // Legacy variant\r\n * paddingLeft: 0,\r\n * paddingRight: 0,\r\n * paddingTop: 0,\r\n * paddingBottom: 0,\r\n *\r\n * @param {'left' | 'top' | 'bottom' | 'right'} prop\r\n * @param {PhotoSwipeOptions} options PhotoSwipe options\r\n * @param {Point} viewportSize PhotoSwipe viewport size, for example: { x:800, y:600 }\r\n * @param {SlideData} itemData Data about the slide\r\n * @param {number} index Slide index\r\n * @returns {number}\r\n */\r\nexport function parsePaddingOption(prop, options, viewportSize, itemData, index) {\r\n let paddingValue = 0;\r\n\r\n if (options.paddingFn) {\r\n paddingValue = options.paddingFn(viewportSize, itemData, index)[prop];\r\n } else if (options.padding) {\r\n paddingValue = options.padding[prop];\r\n } else {\r\n const legacyPropName = 'padding' + prop[0].toUpperCase() + prop.slice(1);\r\n // @ts-expect-error\r\n if (options[legacyPropName]) {\r\n // @ts-expect-error\r\n paddingValue = options[legacyPropName];\r\n }\r\n }\r\n\r\n return Number(paddingValue) || 0;\r\n}\r\n\r\n/**\r\n * @param {PhotoSwipeOptions} options\r\n * @param {Point} viewportSize\r\n * @param {SlideData} itemData\r\n * @param {number} index\r\n * @returns {Point}\r\n */\r\nexport function getPanAreaSize(options, viewportSize, itemData, index) {\r\n return {\r\n x: viewportSize.x\r\n - parsePaddingOption('left', options, viewportSize, itemData, index)\r\n - parsePaddingOption('right', options, viewportSize, itemData, index),\r\n y: viewportSize.y\r\n - parsePaddingOption('top', options, viewportSize, itemData, index)\r\n - parsePaddingOption('bottom', options, viewportSize, itemData, index)\r\n };\r\n}\r\n","const MAX_IMAGE_WIDTH = 4000;\r\n\r\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\r\n/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */\r\n/** @typedef {import('../photoswipe.js').Point} Point */\r\n/** @typedef {import('../slide/slide.js').SlideData} SlideData */\r\n\r\n/** @typedef {'fit' | 'fill' | number | ((zoomLevelObject: ZoomLevel) => number)} ZoomLevelOption */\r\n\r\n/**\r\n * Calculates zoom levels for specific slide.\r\n * Depends on viewport size and image size.\r\n */\r\nclass ZoomLevel {\r\n /**\r\n * @param {PhotoSwipeOptions} options PhotoSwipe options\r\n * @param {SlideData} itemData Slide data\r\n * @param {number} index Slide index\r\n * @param {PhotoSwipe} [pswp] PhotoSwipe instance, can be undefined if not initialized yet\r\n */\r\n constructor(options, itemData, index, pswp) {\r\n this.pswp = pswp;\r\n this.options = options;\r\n this.itemData = itemData;\r\n this.index = index;\r\n /** @type { Point | null } */\r\n this.panAreaSize = null;\r\n /** @type { Point | null } */\r\n this.elementSize = null;\r\n this.fit = 1;\r\n this.fill = 1;\r\n this.vFill = 1;\r\n this.initial = 1;\r\n this.secondary = 1;\r\n this.max = 1;\r\n this.min = 1;\r\n }\r\n\r\n /**\r\n * Calculate initial, secondary and maximum zoom level for the specified slide.\r\n *\r\n * It should be called when either image or viewport size changes.\r\n *\r\n * @param {number} maxWidth\r\n * @param {number} maxHeight\r\n * @param {Point} panAreaSize\r\n */\r\n update(maxWidth, maxHeight, panAreaSize) {\r\n /** @type {Point} */\r\n const elementSize = { x: maxWidth, y: maxHeight };\r\n this.elementSize = elementSize;\r\n this.panAreaSize = panAreaSize;\r\n\r\n const hRatio = panAreaSize.x / elementSize.x;\r\n const vRatio = panAreaSize.y / elementSize.y;\r\n\r\n this.fit = Math.min(1, hRatio < vRatio ? hRatio : vRatio);\r\n this.fill = Math.min(1, hRatio > vRatio ? hRatio : vRatio);\r\n\r\n // zoom.vFill defines zoom level of the image\r\n // when it has 100% of viewport vertical space (height)\r\n this.vFill = Math.min(1, vRatio);\r\n\r\n this.initial = this._getInitial();\r\n this.secondary = this._getSecondary();\r\n this.max = Math.max(\r\n this.initial,\r\n this.secondary,\r\n this._getMax()\r\n );\r\n\r\n this.min = Math.min(\r\n this.fit,\r\n this.initial,\r\n this.secondary\r\n );\r\n\r\n if (this.pswp) {\r\n this.pswp.dispatch('zoomLevelsUpdate', { zoomLevels: this, slideData: this.itemData });\r\n }\r\n }\r\n\r\n /**\r\n * Parses user-defined zoom option.\r\n *\r\n * @private\r\n * @param {'initial' | 'secondary' | 'max'} optionPrefix Zoom level option prefix (initial, secondary, max)\r\n * @returns { number | undefined }\r\n */\r\n _parseZoomLevelOption(optionPrefix) {\r\n const optionName = /** @type {'initialZoomLevel' | 'secondaryZoomLevel' | 'maxZoomLevel'} */ (\r\n optionPrefix + 'ZoomLevel'\r\n );\r\n const optionValue = this.options[optionName];\r\n\r\n if (!optionValue) {\r\n return;\r\n }\r\n\r\n if (typeof optionValue === 'function') {\r\n return optionValue(this);\r\n }\r\n\r\n if (optionValue === 'fill') {\r\n return this.fill;\r\n }\r\n\r\n if (optionValue === 'fit') {\r\n return this.fit;\r\n }\r\n\r\n return Number(optionValue);\r\n }\r\n\r\n /**\r\n * Get zoom level to which image will be zoomed after double-tap gesture,\r\n * or when user clicks on zoom icon,\r\n * or mouse-click on image itself.\r\n * If you return 1 image will be zoomed to its original size.\r\n *\r\n * @private\r\n * @return {number}\r\n */\r\n _getSecondary() {\r\n let currZoomLevel = this._parseZoomLevelOption('secondary');\r\n\r\n if (currZoomLevel) {\r\n return currZoomLevel;\r\n }\r\n\r\n // 3x of \"fit\" state, but not larger than original\r\n currZoomLevel = Math.min(1, this.fit * 3);\r\n\r\n if (this.elementSize && currZoomLevel * this.elementSize.x > MAX_IMAGE_WIDTH) {\r\n currZoomLevel = MAX_IMAGE_WIDTH / this.elementSize.x;\r\n }\r\n\r\n return currZoomLevel;\r\n }\r\n\r\n /**\r\n * Get initial image zoom level.\r\n *\r\n * @private\r\n * @return {number}\r\n */\r\n _getInitial() {\r\n return this._parseZoomLevelOption('initial') || this.fit;\r\n }\r\n\r\n /**\r\n * Maximum zoom level when user zooms\r\n * via zoom/pinch gesture,\r\n * via cmd/ctrl-wheel or via trackpad.\r\n *\r\n * @private\r\n * @return {number}\r\n */\r\n _getMax() {\r\n // max zoom level is x4 from \"fit state\",\r\n // used for zoom gesture and ctrl/trackpad zoom\r\n return this._parseZoomLevelOption('max') || Math.max(1, this.fit * 4);\r\n }\r\n}\r\n\r\nexport default ZoomLevel;\r\n","import { getViewportSize, getPanAreaSize } from '../util/viewport-size.js';\r\nimport ZoomLevel from './zoom-level.js';\r\n\r\n/** @typedef {import('./content.js').default} Content */\r\n/** @typedef {import('./slide.js').default} Slide */\r\n/** @typedef {import('./slide.js').SlideData} SlideData */\r\n/** @typedef {import('../core/base.js').default} PhotoSwipeBase */\r\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\r\n\r\nconst MIN_SLIDES_TO_CACHE = 5;\r\n\r\n/**\r\n * Lazy-load an image\r\n * This function is used both by Lightbox and PhotoSwipe core,\r\n * thus it can be called before dialog is opened.\r\n *\r\n * @param {SlideData} itemData Data about the slide\r\n * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox instance\r\n * @param {number} index\r\n * @returns {Content} Image that is being decoded or false.\r\n */\r\nexport function lazyLoadData(itemData, instance, index) {\r\n const content = instance.createContentFromData(itemData, index);\r\n /** @type {ZoomLevel | undefined} */\r\n let zoomLevel;\r\n\r\n const { options } = instance;\r\n\r\n // We need to know dimensions of the image to preload it,\r\n // as it might use srcset, and we need to define sizes\r\n if (options) {\r\n zoomLevel = new ZoomLevel(options, itemData, -1);\r\n\r\n let viewportSize;\r\n if (instance.pswp) {\r\n viewportSize = instance.pswp.viewportSize;\r\n } else {\r\n viewportSize = getViewportSize(options, instance);\r\n }\r\n\r\n const panAreaSize = getPanAreaSize(options, viewportSize, itemData, index);\r\n zoomLevel.update(content.width, content.height, panAreaSize);\r\n }\r\n\r\n content.lazyLoad();\r\n\r\n if (zoomLevel) {\r\n content.setDisplayedSize(\r\n Math.ceil(content.width * zoomLevel.initial),\r\n Math.ceil(content.height * zoomLevel.initial)\r\n );\r\n }\r\n\r\n return content;\r\n}\r\n\r\n\r\n/**\r\n * Lazy-loads specific slide.\r\n * This function is used both by Lightbox and PhotoSwipe core,\r\n * thus it can be called before dialog is opened.\r\n *\r\n * By default, it loads image based on viewport size and initial zoom level.\r\n *\r\n * @param {number} index Slide index\r\n * @param {PhotoSwipeBase} instance PhotoSwipe or PhotoSwipeLightbox eventable instance\r\n * @returns {Content | undefined}\r\n */\r\nexport function lazyLoadSlide(index, instance) {\r\n const itemData = instance.getItemData(index);\r\n\r\n if (instance.dispatch('lazyLoadSlide', { index, itemData }).defaultPrevented) {\r\n return;\r\n }\r\n\r\n return lazyLoadData(itemData, instance, index);\r\n}\r\n\r\nclass ContentLoader {\r\n /**\r\n * @param {PhotoSwipe} pswp\r\n */\r\n constructor(pswp) {\r\n this.pswp = pswp;\r\n // Total amount of cached images\r\n this.limit = Math.max(\r\n pswp.options.preload[0] + pswp.options.preload[1] + 1,\r\n MIN_SLIDES_TO_CACHE\r\n );\r\n /** @type {Content[]} */\r\n this._cachedItems = [];\r\n }\r\n\r\n /**\r\n * Lazy load nearby slides based on `preload` option.\r\n *\r\n * @param {number} [diff] Difference between slide indexes that was changed recently, or 0.\r\n */\r\n updateLazy(diff) {\r\n const { pswp } = this;\r\n\r\n if (pswp.dispatch('lazyLoad').defaultPrevented) {\r\n return;\r\n }\r\n\r\n const { preload } = pswp.options;\r\n const isForward = diff === undefined ? true : (diff >= 0);\r\n let i;\r\n\r\n // preload[1] - num items to preload in forward direction\r\n for (i = 0; i <= preload[1]; i++) {\r\n this.loadSlideByIndex(pswp.currIndex + (isForward ? i : (-i)));\r\n }\r\n\r\n // preload[0] - num items to preload in backward direction\r\n for (i = 1; i <= preload[0]; i++) {\r\n this.loadSlideByIndex(pswp.currIndex + (isForward ? (-i) : i));\r\n }\r\n }\r\n\r\n /**\r\n * @param {number} initialIndex\r\n */\r\n loadSlideByIndex(initialIndex) {\r\n const index = this.pswp.getLoopedIndex(initialIndex);\r\n // try to get cached content\r\n let content = this.getContentByIndex(index);\r\n if (!content) {\r\n // no cached content, so try to load from scratch:\r\n content = lazyLoadSlide(index, this.pswp);\r\n // if content can be loaded, add it to cache:\r\n if (content) {\r\n this.addToCache(content);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @param {Slide} slide\r\n * @returns {Content}\r\n */\r\n getContentBySlide(slide) {\r\n let content = this.getContentByIndex(slide.index);\r\n if (!content) {\r\n // create content if not found in cache\r\n content = this.pswp.createContentFromData(slide.data, slide.index);\r\n this.addToCache(content);\r\n }\r\n\r\n // assign slide to content\r\n content.setSlide(slide);\r\n\r\n return content;\r\n }\r\n\r\n /**\r\n * @param {Content} content\r\n */\r\n addToCache(content) {\r\n // move to the end of array\r\n this.removeByIndex(content.index);\r\n this._cachedItems.push(content);\r\n\r\n if (this._cachedItems.length > this.limit) {\r\n // Destroy the first content that's not attached\r\n const indexToRemove = this._cachedItems.findIndex((item) => {\r\n return !item.isAttached && !item.hasSlide;\r\n });\r\n if (indexToRemove !== -1) {\r\n const removedItem = this._cachedItems.splice(indexToRemove, 1)[0];\r\n removedItem.destroy();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Removes an image from cache, does not destroy() it, just removes.\r\n *\r\n * @param {number} index\r\n */\r\n removeByIndex(index) {\r\n const indexToRemove = this._cachedItems.findIndex(item => item.index === index);\r\n if (indexToRemove !== -1) {\r\n this._cachedItems.splice(indexToRemove, 1);\r\n }\r\n }\r\n\r\n /**\r\n * @param {number} index\r\n * @returns {Content | undefined}\r\n */\r\n getContentByIndex(index) {\r\n return this._cachedItems.find(content => content.index === index);\r\n }\r\n\r\n destroy() {\r\n this._cachedItems.forEach(content => content.destroy());\r\n this._cachedItems = [];\r\n }\r\n}\r\n\r\nexport default ContentLoader;\r\n","import Eventable from './eventable.js';\r\nimport { getElementsFromOption } from '../util/util.js';\r\nimport Content from '../slide/content.js';\r\nimport { lazyLoadData } from '../slide/loader.js';\r\n\r\n/** @typedef {import(\"../photoswipe.js\").default} PhotoSwipe */\r\n/** @typedef {import(\"../slide/slide.js\").SlideData} SlideData */\r\n\r\n/**\r\n * PhotoSwipe base class that can retrieve data about every slide.\r\n * Shared by PhotoSwipe Core and PhotoSwipe Lightbox\r\n */\r\nclass PhotoSwipeBase extends Eventable {\r\n /**\r\n * Get total number of slides\r\n *\r\n * @returns {number}\r\n */\r\n getNumItems() {\r\n let numItems = 0;\r\n const dataSource = this.options?.dataSource;\r\n\r\n if (dataSource && 'length' in dataSource) {\r\n // may be an array or just object with length property\r\n numItems = dataSource.length;\r\n } else if (dataSource && 'gallery' in dataSource) {\r\n // query DOM elements\r\n if (!dataSource.items) {\r\n dataSource.items = this._getGalleryDOMElements(dataSource.gallery);\r\n }\r\n\r\n if (dataSource.items) {\r\n numItems = dataSource.items.length;\r\n }\r\n }\r\n\r\n // legacy event, before filters were introduced\r\n const event = this.dispatch('numItems', {\r\n dataSource,\r\n numItems\r\n });\r\n return this.applyFilters('numItems', event.numItems, dataSource);\r\n }\r\n\r\n /**\r\n * @param {SlideData} slideData\r\n * @param {number} index\r\n * @returns {Content}\r\n */\r\n createContentFromData(slideData, index) {\r\n return new Content(slideData, this, index);\r\n }\r\n\r\n /**\r\n * Get item data by index.\r\n *\r\n * \"item data\" should contain normalized information that PhotoSwipe needs to generate a slide.\r\n * For example, it may contain properties like\r\n * `src`, `srcset`, `w`, `h`, which will be used to generate a slide with image.\r\n *\r\n * @param {number} index\r\n * @returns {SlideData}\r\n */\r\n getItemData(index) {\r\n const dataSource = this.options?.dataSource;\r\n /** @type {SlideData | HTMLElement} */\r\n let dataSourceItem = {};\r\n if (Array.isArray(dataSource)) {\r\n // Datasource is an array of elements\r\n dataSourceItem = dataSource[index];\r\n } else if (dataSource && 'gallery' in dataSource) {\r\n // dataSource has gallery property,\r\n // thus it was created by Lightbox, based on\r\n // gallery and children options\r\n\r\n // query DOM elements\r\n if (!dataSource.items) {\r\n dataSource.items = this._getGalleryDOMElements(dataSource.gallery);\r\n }\r\n\r\n dataSourceItem = dataSource.items[index];\r\n }\r\n\r\n let itemData = dataSourceItem;\r\n\r\n if (itemData instanceof Element) {\r\n itemData = this._domElementToItemData(itemData);\r\n }\r\n\r\n // Dispatching the itemData event,\r\n // it's a legacy verion before filters were introduced\r\n const event = this.dispatch('itemData', {\r\n itemData: itemData || {},\r\n index\r\n });\r\n\r\n return this.applyFilters('itemData', event.itemData, index);\r\n }\r\n\r\n /**\r\n * Get array of gallery DOM elements,\r\n * based on childSelector and gallery element.\r\n *\r\n * @param {HTMLElement} galleryElement\r\n * @returns {HTMLElement[]}\r\n */\r\n _getGalleryDOMElements(galleryElement) {\r\n if (this.options?.children || this.options?.childSelector) {\r\n return getElementsFromOption(\r\n this.options.children,\r\n this.options.childSelector,\r\n galleryElement\r\n ) || [];\r\n }\r\n\r\n return [galleryElement];\r\n }\r\n\r\n /**\r\n * Converts DOM element to item data object.\r\n *\r\n * @param {HTMLElement} element DOM element\r\n * @returns {SlideData}\r\n */\r\n _domElementToItemData(element) {\r\n /** @type {SlideData} */\r\n const itemData = {\r\n element\r\n };\r\n\r\n const linkEl = /** @type {HTMLAnchorElement} */ (\r\n element.tagName === 'A'\r\n ? element\r\n : element.querySelector('a')\r\n );\r\n\r\n if (linkEl) {\r\n // src comes from data-pswp-src attribute,\r\n // if it's empty link href is used\r\n itemData.src = linkEl.dataset.pswpSrc || linkEl.href;\r\n\r\n if (linkEl.dataset.pswpSrcset) {\r\n itemData.srcset = linkEl.dataset.pswpSrcset;\r\n }\r\n\r\n itemData.width = linkEl.dataset.pswpWidth ? parseInt(linkEl.dataset.pswpWidth, 10) : 0;\r\n itemData.height = linkEl.dataset.pswpHeight ? parseInt(linkEl.dataset.pswpHeight, 10) : 0;\r\n\r\n // support legacy w & h properties\r\n itemData.w = itemData.width;\r\n itemData.h = itemData.height;\r\n\r\n if (linkEl.dataset.pswpType) {\r\n itemData.type = linkEl.dataset.pswpType;\r\n }\r\n\r\n const thumbnailEl = element.querySelector('img');\r\n\r\n if (thumbnailEl) {\r\n // msrc is URL to placeholder image that's displayed before large image is loaded\r\n // by default it's displayed only for the first slide\r\n itemData.msrc = thumbnailEl.currentSrc || thumbnailEl.src;\r\n itemData.alt = thumbnailEl.getAttribute('alt') ?? '';\r\n }\r\n\r\n if (linkEl.dataset.pswpCropped || linkEl.dataset.cropped) {\r\n itemData.thumbCropped = true;\r\n }\r\n }\r\n\r\n return this.applyFilters('domItemData', itemData, element, linkEl);\r\n }\r\n\r\n /**\r\n * Lazy-load by slide data\r\n *\r\n * @param {SlideData} itemData Data about the slide\r\n * @param {number} index\r\n * @returns {Content} Image that is being decoded or false.\r\n */\r\n lazyLoadData(itemData, index) {\r\n return lazyLoadData(itemData, this, index);\r\n }\r\n}\r\n\r\nexport default PhotoSwipeBase;\r\n","import {\r\n specialKeyUsed,\r\n getElementsFromOption,\r\n isPswpClass\r\n} from '../util/util.js';\r\n\r\nimport PhotoSwipeBase from '../core/base.js';\r\nimport { lazyLoadSlide } from '../slide/loader.js';\r\n\r\n/**\r\n * @template T\r\n * @typedef {import('../types.js').Type} Type\r\n */\r\n\r\n/** @typedef {import('../photoswipe.js').default} PhotoSwipe */\r\n/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */\r\n/** @typedef {import('../photoswipe.js').DataSource} DataSource */\r\n/** @typedef {import('../photoswipe.js').Point} Point */\r\n/** @typedef {import('../slide/content.js').default} Content */\r\n/** @typedef {import('../core/eventable.js').PhotoSwipeEventsMap} PhotoSwipeEventsMap */\r\n/** @typedef {import('../core/eventable.js').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */\r\n\r\n/**\r\n * @template {keyof PhotoSwipeEventsMap} T\r\n * @typedef {import('../core/eventable.js').EventCallback} EventCallback\r\n */\r\n\r\n/**\r\n * PhotoSwipe Lightbox\r\n *\r\n * - If user has unsupported browser it falls back to default browser action (just opens URL)\r\n * - Binds click event to links that should open PhotoSwipe\r\n * - parses DOM strcture for PhotoSwipe (retrieves large image URLs and sizes)\r\n * - Initializes PhotoSwipe\r\n *\r\n *\r\n * Loader options use the same object as PhotoSwipe, and supports such options:\r\n *\r\n * gallery - Element | Element[] | NodeList | string selector for the gallery element\r\n * children - Element | Element[] | NodeList | string selector for the gallery children\r\n *\r\n */\r\nclass PhotoSwipeLightbox extends PhotoSwipeBase {\r\n /**\r\n * @param {PhotoSwipeOptions} [options]\r\n */\r\n constructor(options) {\r\n super();\r\n /** @type {PhotoSwipeOptions} */\r\n this.options = options || {};\r\n this._uid = 0;\r\n this.shouldOpen = false;\r\n /**\r\n * @private\r\n * @type {Content | undefined}\r\n */\r\n this._preloadedContent = undefined;\r\n\r\n this.onThumbnailsClick = this.onThumbnailsClick.bind(this);\r\n }\r\n\r\n /**\r\n * Initialize lightbox, should be called only once.\r\n * It's not included in the main constructor, so you may bind events before it.\r\n */\r\n init() {\r\n // Bind click events to each gallery\r\n getElementsFromOption(this.options.gallery, this.options.gallerySelector)\r\n .forEach((galleryElement) => {\r\n galleryElement.addEventListener('click', this.onThumbnailsClick, false);\r\n });\r\n }\r\n\r\n /**\r\n * @param {MouseEvent} e\r\n */\r\n onThumbnailsClick(e) {\r\n // Exit and allow default browser action if:\r\n if (specialKeyUsed(e) // ... if clicked with a special key (ctrl/cmd...)\r\n || window.pswp) { // ... if PhotoSwipe is already open\r\n return;\r\n }\r\n\r\n // If both clientX and clientY are 0 or not defined,\r\n // the event is likely triggered by keyboard,\r\n // so we do not pass the initialPoint\r\n //\r\n // Note that some screen readers emulate the mouse position,\r\n // so it's not the ideal way to detect them.\r\n //\r\n /** @type {Point | null} */\r\n let initialPoint = { x: e.clientX, y: e.clientY };\r\n\r\n if (!initialPoint.x && !initialPoint.y) {\r\n initialPoint = null;\r\n }\r\n\r\n let clickedIndex = this.getClickedIndex(e);\r\n clickedIndex = this.applyFilters('clickedIndex', clickedIndex, e, this);\r\n /** @type {DataSource} */\r\n const dataSource = {\r\n gallery: /** @type {HTMLElement} */ (e.currentTarget)\r\n };\r\n\r\n if (clickedIndex >= 0) {\r\n e.preventDefault();\r\n this.loadAndOpen(clickedIndex, dataSource, initialPoint);\r\n }\r\n }\r\n\r\n /**\r\n * Get index of gallery item that was clicked.\r\n *\r\n * @param {MouseEvent} e click event\r\n * @returns {number}\r\n */\r\n getClickedIndex(e) {\r\n // legacy option\r\n if (this.options.getClickedIndexFn) {\r\n return this.options.getClickedIndexFn.call(this, e);\r\n }\r\n\r\n const clickedTarget = /** @type {HTMLElement} */ (e.target);\r\n const childElements = getElementsFromOption(\r\n this.options.children,\r\n this.options.childSelector,\r\n /** @type {HTMLElement} */ (e.currentTarget)\r\n );\r\n const clickedChildIndex = childElements.findIndex(\r\n child => child === clickedTarget || child.contains(clickedTarget)\r\n );\r\n\r\n if (clickedChildIndex !== -1) {\r\n return clickedChildIndex;\r\n } else if (this.options.children || this.options.childSelector) {\r\n // click wasn't on a child element\r\n return -1;\r\n }\r\n\r\n // There is only one item (which is the gallery)\r\n return 0;\r\n }\r\n\r\n /**\r\n * Load and open PhotoSwipe\r\n *\r\n * @param {number} index\r\n * @param {DataSource} dataSource\r\n * @param {Point | null} [initialPoint]\r\n * @returns {boolean}\r\n */\r\n loadAndOpen(index, dataSource, initialPoint) {\r\n // Check if the gallery is already open\r\n if (window.pswp) {\r\n return false;\r\n }\r\n\r\n // set initial index\r\n this.options.index = index;\r\n\r\n // define options for PhotoSwipe constructor\r\n this.options.initialPointerPos = initialPoint;\r\n\r\n this.shouldOpen = true;\r\n this.preload(index, dataSource);\r\n return true;\r\n }\r\n\r\n /**\r\n * Load the main module and the slide content by index\r\n *\r\n * @param {number} index\r\n * @param {DataSource} [dataSource]\r\n */\r\n preload(index, dataSource) {\r\n const { options } = this;\r\n\r\n if (dataSource) {\r\n options.dataSource = dataSource;\r\n }\r\n\r\n // Add the main module\r\n /** @type {Promise>[]} */\r\n const promiseArray = [];\r\n\r\n const pswpModuleType = typeof options.pswpModule;\r\n if (isPswpClass(options.pswpModule)) {\r\n promiseArray.push(Promise.resolve(/** @type {Type} */ (options.pswpModule)));\r\n } else if (pswpModuleType === 'string') {\r\n throw new Error('pswpModule as string is no longer supported');\r\n } else if (pswpModuleType === 'function') {\r\n promiseArray.push(/** @type {() => Promise>} */ (options.pswpModule)());\r\n } else {\r\n throw new Error('pswpModule is not valid');\r\n }\r\n\r\n // Add custom-defined promise, if any\r\n if (typeof options.openPromise === 'function') {\r\n // allow developers to perform some task before opening\r\n promiseArray.push(options.openPromise());\r\n }\r\n\r\n if (options.preloadFirstSlide !== false && index >= 0) {\r\n this._preloadedContent = lazyLoadSlide(index, this);\r\n }\r\n\r\n // Wait till all promises resolve and open PhotoSwipe\r\n const uid = ++this._uid;\r\n Promise.all(promiseArray).then((iterableModules) => {\r\n if (this.shouldOpen) {\r\n const mainModule = iterableModules[0];\r\n this._openPhotoswipe(mainModule, uid);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * @private\r\n * @param {Type | { default: Type }} module\r\n * @param {number} uid\r\n */\r\n _openPhotoswipe(module, uid) {\r\n // Cancel opening if UID doesn't match the current one\r\n // (if user clicked on another gallery item before current was loaded).\r\n //\r\n // Or if shouldOpen flag is set to false\r\n // (developer may modify it via public API)\r\n if (uid !== this._uid && this.shouldOpen) {\r\n return;\r\n }\r\n\r\n this.shouldOpen = false;\r\n\r\n // PhotoSwipe is already open\r\n if (window.pswp) {\r\n return;\r\n }\r\n\r\n /**\r\n * Pass data to PhotoSwipe and open init\r\n *\r\n * @type {PhotoSwipe}\r\n */\r\n const pswp = typeof module === 'object'\r\n ? new module.default(this.options) // eslint-disable-line\r\n : new module(this.options); // eslint-disable-line\r\n\r\n this.pswp = pswp;\r\n window.pswp = pswp;\r\n\r\n // map listeners from Lightbox to PhotoSwipe Core\r\n /** @type {(keyof PhotoSwipeEventsMap)[]} */\r\n (Object.keys(this._listeners)).forEach((name) => {\r\n this._listeners[name]?.forEach((fn) => {\r\n pswp.on(name, /** @type {EventCallback} */(fn));\r\n });\r\n });\r\n\r\n // same with filters\r\n /** @type {(keyof PhotoSwipeFiltersMap)[]} */\r\n (Object.keys(this._filters)).forEach((name) => {\r\n this._filters[name]?.forEach((filter) => {\r\n pswp.addFilter(name, filter.fn, filter.priority);\r\n });\r\n });\r\n\r\n if (this._preloadedContent) {\r\n pswp.contentLoader.addToCache(this._preloadedContent);\r\n this._preloadedContent = undefined;\r\n }\r\n\r\n pswp.on('destroy', () => {\r\n // clean up public variables\r\n this.pswp = undefined;\r\n delete window.pswp;\r\n });\r\n\r\n pswp.init();\r\n }\r\n\r\n /**\r\n * Unbinds all events, closes PhotoSwipe if it's open.\r\n */\r\n destroy() {\r\n this.pswp?.destroy();\r\n\r\n this.shouldOpen = false;\r\n this._listeners = {};\r\n\r\n getElementsFromOption(this.options.gallery, this.options.gallerySelector)\r\n .forEach((galleryElement) => {\r\n galleryElement.removeEventListener('click', this.onThumbnailsClick, false);\r\n });\r\n }\r\n}\r\n\r\nexport default PhotoSwipeLightbox;\r\n"],"names":["createElement","className","tagName","appendToEl","el","document","appendChild","toTransformString","x","y","scale","propValue","undefined","setWidthHeight","w","h","style","width","height","LOAD_STATE","IDLE","LOADING","LOADED","ERROR","specialKeyUsed","e","button","ctrlKey","metaKey","altKey","shiftKey","getElementsFromOption","option","legacySelector","parent","elements","Element","NodeList","Array","isArray","from","selector","querySelectorAll","isPswpClass","fn","prototype","goTo","isSafari","navigator","vendor","match","PhotoSwipeEvent","constructor","type","details","defaultPrevented","Object","assign","preventDefault","Eventable","_listeners","_filters","pswp","options","addFilter","name","priority","push","sort","f1","f2","removeFilter","filter","applyFilters","args","forEach","apply","on","off","listener","dispatch","event","call","Placeholder","imageSrc","container","element","imgEl","decoding","alt","src","setAttribute","setDisplayedSize","transformOrigin","transform","destroy","parentNode","remove","Content","itemData","instance","index","data","placeholder","slide","displayedImageWidth","displayedImageHeight","Number","isAttached","hasSlide","isDecoding","state","content","removePlaceholder","keepPlaceholder","setTimeout","load","isLazy","reload","usePlaceholder","placeholderSrc","msrc","isFirstSlide","placeholderEl","parentElement","prepend","isImageContent","loadImage","innerHTML","html","updateContentSize","imageElement","updateSrcsetSizes","srcset","complete","onLoaded","onload","onerror","onError","setSlide","isActive","heavyAppended","append","displayError","isError","isLoading","isInitialSizeUpdate","isZoomable","image","sizesWidth","dataset","largestUsedSize","parseInt","sizes","String","lazyLoad","errorMsgEl","innerText","errorMsg","supportsDecode","decode","catch","finally","appendImage","activate","holderElement","deactivate","getViewportSize","getViewportSizeFn","newViewportSize","documentElement","clientWidth","window","innerHeight","parsePaddingOption","prop","viewportSize","paddingValue","paddingFn","padding","legacyPropName","toUpperCase","slice","getPanAreaSize","MAX_IMAGE_WIDTH","ZoomLevel","panAreaSize","elementSize","fit","fill","vFill","initial","secondary","max","min","update","maxWidth","maxHeight","hRatio","vRatio","Math","_getInitial","_getSecondary","_getMax","zoomLevels","slideData","_parseZoomLevelOption","optionPrefix","optionName","optionValue","currZoomLevel","lazyLoadData","createContentFromData","zoomLevel","ceil","lazyLoadSlide","getItemData","PhotoSwipeBase","getNumItems","numItems","dataSource","length","items","_getGalleryDOMElements","gallery","dataSourceItem","_domElementToItemData","galleryElement","children","childSelector","linkEl","querySelector","pswpSrc","href","pswpSrcset","pswpWidth","pswpHeight","pswpType","thumbnailEl","currentSrc","getAttribute","pswpCropped","cropped","thumbCropped","PhotoSwipeLightbox","_uid","shouldOpen","_preloadedContent","onThumbnailsClick","bind","init","gallerySelector","addEventListener","initialPoint","clientX","clientY","clickedIndex","getClickedIndex","currentTarget","loadAndOpen","getClickedIndexFn","clickedTarget","target","childElements","clickedChildIndex","findIndex","child","contains","initialPointerPos","preload","promiseArray","pswpModuleType","pswpModule","Promise","resolve","Error","openPromise","preloadFirstSlide","uid","all","then","iterableModules","mainModule","_openPhotoswipe","module","default","keys","contentLoader","addToCache","removeEventListener"],"mappings":";;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAuBC,SAAvB,EAAkCC,OAAlC,EAA2CC,UAA3C,EAAuD;AAC5D,EAAA,MAAMC,EAAE,GAAGC,QAAQ,CAACL,aAAT,CAAuBE,OAAvB,CAAX,CAAA;;AACA,EAAA,IAAID,SAAJ,EAAe;IACbG,EAAE,CAACH,SAAH,GAAeA,SAAf,CAAA;AACD,GAAA;;AACD,EAAA,IAAIE,UAAJ,EAAgB;IACdA,UAAU,CAACG,WAAX,CAAuBF,EAAvB,CAAA,CAAA;AACD,GAAA;;AACD,EAA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;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAN,CAAsB;AACpB;AACF;AACA;AACA;AACEC,EAAAA,WAAW,CAACC,IAAD,EAAOC,OAAP,EAAgB;IACzB,IAAKD,CAAAA,IAAL,GAAYA,IAAZ,CAAA;IACA,IAAKE,CAAAA,gBAAL,GAAwB,KAAxB,CAAA;;AACA,IAAA,IAAID,OAAJ,EAAa;AACXE,MAAAA,MAAM,CAACC,MAAP,CAAc,IAAd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MAAM,CAACN,QAAvC,CAAA,CAAA;OADF,CAAA,CAAA;KADF,CAAA,CAAA;;IAMA,IAAI,IAAA,CAAKqL,iBAAT,EAA4B;AAC1BzL,MAAAA,IAAI,CAACiO,aAAL,CAAmBC,UAAnB,CAA8B,KAAKzC,iBAAnC,CAAA,CAAA;MACA,IAAKA,CAAAA,iBAAL,GAAyB3O,SAAzB,CAAA;AACD,KAAA;;AAEDkD,IAAAA,IAAI,CAACe,EAAL,CAAQ,SAAR,EAAmB,MAAM;AACvB;MACA,IAAKf,CAAAA,IAAL,GAAYlD,SAAZ,CAAA;MACA,OAAOgK,MAAM,CAAC9G,IAAd,CAAA;KAHF,CAAA,CAAA;AAMAA,IAAAA,IAAI,CAAC4L,IAAL,EAAA,CAAA;AACD,GAAA;AAED;AACF;AACA;;;AACE3J,EAAAA,OAAO,GAAG;AAAA,IAAA,IAAA,UAAA,CAAA;;IACR,CAAKjC,UAAAA,GAAAA,IAAAA,CAAAA,IAAL,kDAAWiC,OAAX,EAAA,CAAA;IAEA,IAAKuJ,CAAAA,UAAL,GAAkB,KAAlB,CAAA;IACA,IAAK1L,CAAAA,UAAL,GAAkB,EAAlB,CAAA;AAEA7B,IAAAA,qBAAqB,CAAC,IAAA,CAAKgC,OAAL,CAAaiK,OAAd,EAAuB,IAAA,CAAKjK,OAAL,CAAa4L,eAApC,CAArB,CACGhL,OADH,CACYwJ,cAAD,IAAoB;MAC3BA,cAAc,CAAC8D,mBAAf,CAAmC,OAAnC,EAA4C,IAAKzC,CAAAA,iBAAjD,EAAoE,KAApE,CAAA,CAAA;KAFJ,CAAA,CAAA;AAID,GAAA;;AA3P6C;;;;"} \ No newline at end of file diff --git a/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.min.js b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.min.js new file mode 100644 index 0000000..e379247 --- /dev/null +++ b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe-lightbox.esm.min.js @@ -0,0 +1,5 @@ +/*! + * PhotoSwipe Lightbox 5.4.1 - https://photoswipe.com + * (c) 2023 Dmytro Semenov + */ +function t(t,i,s){const h=document.createElement(i);return t&&(h.className=t),s&&s.appendChild(h),h}function i(t,i,s){t.style.width="number"==typeof i?`${i}px`:i,t.style.height="number"==typeof s?`${s}px`:s}const s="idle",h="loading",e="loaded",n="error";function o(t,i,s=document){let h=[];if(t instanceof Element)h=[t];else if(t instanceof NodeList||Array.isArray(t))h=Array.from(t);else{const e="string"==typeof t?t:i;e&&(h=Array.from(s.querySelectorAll(e)))}return h}function r(){return!(!navigator.vendor||!navigator.vendor.match(/apple/i))}class l{constructor(t,i){this.type=t,this.defaultPrevented=!1,i&&Object.assign(this,i)}preventDefault(){this.defaultPrevented=!0}}class a{constructor(i,s){if(this.element=t("pswp__img pswp__img--placeholder",i?"img":"div",s),i){const t=this.element;t.decoding="async",t.alt="",t.src=i,t.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,s){this.element&&("IMG"===this.element.tagName?(i(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=function(t,i,s){let h=`translate3d(${t}px,${i||0}px,0)`;return void 0!==s&&(h+=` scale3d(${s},${s},1)`),h}(0,0,t/250)):i(this.element,t,s))}destroy(){var t;null!==(t=this.element)&&void 0!==t&&t.parentNode&&this.element.remove(),this.element=null}}class d{constructor(t,i,h){this.instance=i,this.data=t,this.index=h,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=s,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)}),1e3)}load(i,s){if(this.slide&&this.usePlaceholder())if(this.placeholder){const t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{const t=this.instance.applyFilters("placeholderSrc",!(!this.data.msrc||!this.slide.isFirstSlide)&&this.data.msrc,this);this.placeholder=new a(t,this.slide.container)}this.element&&!s||this.instance.dispatch("contentLoad",{content:this,isLazy:i}).defaultPrevented||(this.isImageContent()?(this.element=t("pswp__img","img"),this.displayedImageWidth&&this.loadImage(i)):(this.element=t("pswp__content","div"),this.element.innerHTML=this.data.html||""),s&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var i,s;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const e=this.element;this.updateSrcsetSizes(),this.data.srcset&&(e.srcset=this.data.srcset),e.src=null!==(i=this.data.src)&&void 0!==i?i:"",e.alt=null!==(s=this.data.alt)&&void 0!==s?s:"",this.state=h,e.complete?this.onLoaded():(e.onload=()=>{this.onLoaded()},e.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=e,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),this.state!==e&&this.state!==n||this.removePlaceholder())}onError(){this.state=n,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===h,this)}isError(){return this.state===n}isImageContent(){return"image"===this.type}setDisplayedSize(t,s){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,s),!this.instance.dispatch("contentResize",{content:this,width:t,height:s}).defaultPrevented&&(i(this.element,t,s),this.isImageContent()&&!this.isError()))){const i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=s,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:s,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==n,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,i=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||i>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=i+"px",t.dataset.largestUsedSize=String(i))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented||(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var i,s;let h=t("pswp__error-msg","div");h.innerText=null!==(i=null===(s=this.instance.options)||void 0===s?void 0:s.errorMsg)&&void 0!==i?i:"",h=this.instance.applyFilters("contentErrorElement",h,this),this.element=t("pswp__content pswp__error-msg-container","div"),this.element.appendChild(h),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===n)return void this.displayError();if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||r())?(this.isDecoding=!0,this.element.decode().catch((()=>{})).finally((()=>{this.isDecoding=!1,this.appendImage()}))):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){!this.instance.dispatch("contentActivate",{content:this}).defaultPrevented&&this.slide&&(this.isImageContent()&&this.isDecoding&&!r()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,this.instance.dispatch("contentRemove",{content:this}).defaultPrevented||(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),this.state!==e&&this.state!==n||this.removePlaceholder()))}}function c(t,i,s,h,e){let n=0;if(i.paddingFn)n=i.paddingFn(s,h,e)[t];else if(i.padding)n=i.padding[t];else{const s="padding"+t[0].toUpperCase()+t.slice(1);i[s]&&(n=i[s])}return Number(n)||0}class u{constructor(t,i,s,h){this.pswp=h,this.options=t,this.itemData=i,this.index=s,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,i,s){const h={x:t,y:i};this.elementSize=h,this.panAreaSize=s;const e=s.x/h.x,n=s.y/h.y;this.fit=Math.min(1,en?e:n),this.vFill=Math.min(1,n),this.initial=this.t(),this.secondary=this.i(),this.max=Math.max(this.initial,this.secondary,this.o()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}l(t){const i=t+"ZoomLevel",s=this.options[i];if(s)return"function"==typeof s?s(this):"fill"===s?this.fill:"fit"===s?this.fit:Number(s)}i(){let t=this.l("secondary");return t||(t=Math.min(1,3*this.fit),this.elementSize&&t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}t(){return this.l("initial")||this.fit}o(){return this.l("max")||Math.max(1,4*this.fit)}}function p(t,i,s){const h=i.createContentFromData(t,s);let e;const{options:n}=i;if(n){let o;e=new u(n,t,-1),o=i.pswp?i.pswp.viewportSize:function(t,i){if(t.getViewportSizeFn){const s=t.getViewportSizeFn(t,i);if(s)return s}return{x:document.documentElement.clientWidth,y:window.innerHeight}}(n,i);const r=function(t,i,s,h){return{x:i.x-c("left",t,i,s,h)-c("right",t,i,s,h),y:i.y-c("top",t,i,s,h)-c("bottom",t,i,s,h)}}(n,o,t,s);e.update(h.width,h.height,r)}return h.lazyLoad(),e&&h.setDisplayedSize(Math.ceil(h.width*e.initial),Math.ceil(h.height*e.initial)),h}class v extends class extends class{constructor(){this.u={},this.p={},this.pswp=void 0,this.options=void 0}addFilter(t,i,s=100){var h,e,n;this.p[t]||(this.p[t]=[]),null===(h=this.p[t])||void 0===h||h.push({fn:i,priority:s}),null===(e=this.p[t])||void 0===e||e.sort(((t,i)=>t.priority-i.priority)),null===(n=this.pswp)||void 0===n||n.addFilter(t,i,s)}removeFilter(t,i){this.p[t]&&(this.p[t]=this.p[t].filter((t=>t.fn!==i))),this.pswp&&this.pswp.removeFilter(t,i)}applyFilters(t,...i){var s;return null===(s=this.p[t])||void 0===s||s.forEach((t=>{i[0]=t.fn.apply(this,i)})),i[0]}on(t,i){var s,h;this.u[t]||(this.u[t]=[]),null===(s=this.u[t])||void 0===s||s.push(i),null===(h=this.pswp)||void 0===h||h.on(t,i)}off(t,i){var s;this.u[t]&&(this.u[t]=this.u[t].filter((t=>i!==t))),null===(s=this.pswp)||void 0===s||s.off(t,i)}dispatch(t,i){var s;if(this.pswp)return this.pswp.dispatch(t,i);const h=new l(t,i);return null===(s=this.u[t])||void 0===s||s.forEach((t=>{t.call(this,h)})),h}}{getNumItems(){var t;let i=0;const s=null===(t=this.options)||void 0===t?void 0:t.dataSource;s&&"length"in s?i=s.length:s&&"gallery"in s&&(s.items||(s.items=this.v(s.gallery)),s.items&&(i=s.items.length));const h=this.dispatch("numItems",{dataSource:s,numItems:i});return this.applyFilters("numItems",h.numItems,s)}createContentFromData(t,i){return new d(t,this,i)}getItemData(t){var i;const s=null===(i=this.options)||void 0===i?void 0:i.dataSource;let h={};Array.isArray(s)?h=s[t]:s&&"gallery"in s&&(s.items||(s.items=this.v(s.gallery)),h=s.items[t]);let e=h;e instanceof Element&&(e=this.m(e));const n=this.dispatch("itemData",{itemData:e||{},index:t});return this.applyFilters("itemData",n.itemData,t)}v(t){var i,s;return null!==(i=this.options)&&void 0!==i&&i.children||null!==(s=this.options)&&void 0!==s&&s.childSelector?o(this.options.children,this.options.childSelector,t)||[]:[t]}m(t){const i={element:t},s="A"===t.tagName?t:t.querySelector("a");if(s){i.src=s.dataset.pswpSrc||s.href,s.dataset.pswpSrcset&&(i.srcset=s.dataset.pswpSrcset),i.width=s.dataset.pswpWidth?parseInt(s.dataset.pswpWidth,10):0,i.height=s.dataset.pswpHeight?parseInt(s.dataset.pswpHeight,10):0,i.w=i.width,i.h=i.height,s.dataset.pswpType&&(i.type=s.dataset.pswpType);const e=t.querySelector("img");var h;if(e)i.msrc=e.currentSrc||e.src,i.alt=null!==(h=e.getAttribute("alt"))&&void 0!==h?h:"";(s.dataset.pswpCropped||s.dataset.cropped)&&(i.thumbCropped=!0)}return this.applyFilters("domItemData",i,t,s)}lazyLoadData(t,i){return p(t,this,i)}}{constructor(t){super(),this.options=t||{},this.g=0,this.shouldOpen=!1,this._=void 0,this.onThumbnailsClick=this.onThumbnailsClick.bind(this)}init(){o(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.addEventListener("click",this.onThumbnailsClick,!1)}))}onThumbnailsClick(t){if(function(t){return"button"in t&&1===t.button||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey}(t)||window.pswp)return;let i={x:t.clientX,y:t.clientY};i.x||i.y||(i=null);let s=this.getClickedIndex(t);s=this.applyFilters("clickedIndex",s,t,this);const h={gallery:t.currentTarget};s>=0&&(t.preventDefault(),this.loadAndOpen(s,h,i))}getClickedIndex(t){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,t);const i=t.target,s=o(this.options.children,this.options.childSelector,t.currentTarget).findIndex((t=>t===i||t.contains(i)));return-1!==s?s:this.options.children||this.options.childSelector?-1:0}loadAndOpen(t,i,s){return!window.pswp&&(this.options.index=t,this.options.initialPointerPos=s,this.shouldOpen=!0,this.preload(t,i),!0)}preload(t,i){const{options:s}=this;i&&(s.dataSource=i);const h=[],e=typeof s.pswpModule;if("function"==typeof(n=s.pswpModule)&&n.prototype&&n.prototype.goTo)h.push(Promise.resolve(s.pswpModule));else{if("string"===e)throw new Error("pswpModule as string is no longer supported");if("function"!==e)throw new Error("pswpModule is not valid");h.push(s.pswpModule())}var n;"function"==typeof s.openPromise&&h.push(s.openPromise()),!1!==s.preloadFirstSlide&&t>=0&&(this._=function(t,i){const s=i.getItemData(t);if(!i.dispatch("lazyLoadSlide",{index:t,itemData:s}).defaultPrevented)return p(s,i,t)}(t,this));const o=++this.g;Promise.all(h).then((t=>{if(this.shouldOpen){const i=t[0];this.I(i,o)}}))}I(t,i){if(i!==this.g&&this.shouldOpen)return;if(this.shouldOpen=!1,window.pswp)return;const s="object"==typeof t?new t.default(this.options):new t(this.options);this.pswp=s,window.pswp=s,Object.keys(this.u).forEach((t=>{var i;null===(i=this.u[t])||void 0===i||i.forEach((i=>{s.on(t,i)}))})),Object.keys(this.p).forEach((t=>{var i;null===(i=this.p[t])||void 0===i||i.forEach((i=>{s.addFilter(t,i.fn,i.priority)}))})),this._&&(s.contentLoader.addToCache(this._),this._=void 0),s.on("destroy",(()=>{this.pswp=void 0,delete window.pswp})),s.init()}destroy(){var t;null===(t=this.pswp)||void 0===t||t.destroy(),this.shouldOpen=!1,this.u={},o(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.removeEventListener("click",this.onThumbnailsClick,!1)}))}}export{v as default}; diff --git a/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.css b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.css new file mode 100644 index 0000000..686dfc3 --- /dev/null +++ b/src/RandomPhotos/wwwroot/lib/photoswipe/photoswipe.css @@ -0,0 +1,420 @@ +/*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */ + +.pswp { + --pswp-bg: #000; + --pswp-placeholder-bg: #222; + + + --pswp-root-z-index: 100000; + + --pswp-preloader-color: rgba(79, 79, 79, 0.4); + --pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9); + + /* defined via js: + --pswp-transition-duration: 333ms; */ + + --pswp-icon-color: #fff; + --pswp-icon-color-secondary: #4f4f4f; + --pswp-icon-stroke-color: #4f4f4f; + --pswp-icon-stroke-width: 2px; + + --pswp-error-text-color: var(--pswp-icon-color); +} + + +/* + Styles for basic PhotoSwipe (pswp) functionality (sliding area, open/close transitions) +*/ + +.pswp { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: var(--pswp-root-z-index); + display: none; + touch-action: none; + outline: 0; + opacity: 0.003; + contain: layout style size; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} + +/* Prevents focus outline on the root element, + (it may be focused initially) */ +.pswp:focus { + outline: 0; +} + +.pswp * { + box-sizing: border-box; +} + +.pswp img { + max-width: none; +} + +.pswp--open { + display: block; +} + +.pswp, +.pswp__bg { + transform: translateZ(0); + will-change: opacity; +} + +.pswp__bg { + opacity: 0.005; + background: var(--pswp-bg); +} + +.pswp, +.pswp__scroll-wrap { + overflow: hidden; +} + +.pswp__scroll-wrap, +.pswp__bg, +.pswp__container, +.pswp__item, +.pswp__content, +.pswp__img, +.pswp__zoom-wrap { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.pswp__img, +.pswp__zoom-wrap { + width: auto; + height: auto; +} + +.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img { + cursor: -webkit-zoom-in; + cursor: -moz-zoom-in; + cursor: zoom-in; +} + +.pswp--click-to-zoom.pswp--zoomed-in .pswp__img { + cursor: move; + cursor: -webkit-grab; + cursor: -moz-grab; + cursor: grab; +} + +.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active { + cursor: -webkit-grabbing; + cursor: -moz-grabbing; + cursor: grabbing; +} + +/* :active to override grabbing cursor */ +.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img, +.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active, +.pswp__img { + cursor: -webkit-zoom-out; + cursor: -moz-zoom-out; + cursor: zoom-out; +} + + +/* Prevent selection and tap highlights */ +.pswp__container, +.pswp__img, +.pswp__button, +.pswp__counter { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.pswp__item { + /* z-index for fade transition */ + z-index: 1; + overflow: hidden; +} + +.pswp__hidden { + display: none !important; +} + +/* Allow to click through pswp__content element, but not its children */ +.pswp__content { + pointer-events: none; +} +.pswp__content > * { + pointer-events: auto; +} + + +/* + + PhotoSwipe UI + +*/ + +/* + Error message appears when image is not loaded + (JS option errorMsg controls markup) +*/ +.pswp__error-msg-container { + display: grid; +} +.pswp__error-msg { + margin: auto; + font-size: 1em; + line-height: 1; + color: var(--pswp-error-text-color); +} + +/* +class pswp__hide-on-close is applied to elements that +should hide (for example fade out) when PhotoSwipe is closed +and show (for example fade in) when PhotoSwipe is opened + */ +.pswp .pswp__hide-on-close { + opacity: 0.005; + will-change: opacity; + transition: opacity var(--pswp-transition-duration) cubic-bezier(0.4, 0, 0.22, 1); + z-index: 10; /* always overlap slide content */ + pointer-events: none; /* hidden elements should not be clickable */ +} + +/* class pswp--ui-visible is added when opening or closing transition starts */ +.pswp--ui-visible .pswp__hide-on-close { + opacity: 1; + pointer-events: auto; +} + +/*