UNPKG

@anoki/fse-ui

Version:

FSE UI components library

1,219 lines • 82.6 kB
import { g as R, a as _ } from "./index.es567.js"; import { x as k, e as D, i as ie, c as Z, q as N, y as we, v as W, n as de, u as ce, k as Se, r as Te, t as xe, a as $, h as se, w as be, f as Y, b as ye } from "./index.es565.js"; let X; function Ee() { const i = _(), t = R(); return { smoothScroll: t.documentElement && t.documentElement.style && "scrollBehavior" in t.documentElement.style, touch: !!("ontouchstart" in i || i.DocumentTouch && t instanceof i.DocumentTouch) }; } function fe() { return X || (X = Ee()), X; } let q; function Pe(i) { let { userAgent: t } = i === void 0 ? {} : i; const e = fe(), s = _(), n = s.navigator.platform, r = t || s.navigator.userAgent, l = { ios: !1, android: !1 }, a = s.screen.width, d = s.screen.height, o = r.match(/(Android);?[\s\/]+([\d.]+)?/); let c = r.match(/(iPad).*OS\s([\d_]+)/); const f = r.match(/(iPod)(.*OS\s([\d_]+))?/), u = !c && r.match(/(iPhone\sOS|iOS)\s([\d_]+)/), p = n === "Win32"; let h = n === "MacIntel"; const v = ["1024x1366", "1366x1024", "834x1194", "1194x834", "834x1112", "1112x834", "768x1024", "1024x768", "820x1180", "1180x820", "810x1080", "1080x810"]; return !c && h && e.touch && v.indexOf(`${a}x${d}`) >= 0 && (c = r.match(/(Version)\/([\d.]+)/), c || (c = [0, 1, "13_0_0"]), h = !1), o && !p && (l.os = "android", l.android = !0), (c || u || f) && (l.os = "ios", l.ios = !0), l; } function ue(i) { return i === void 0 && (i = {}), q || (q = Pe(i)), q; } let j; function Me() { const i = _(), t = ue(); let e = !1; function s() { const a = i.navigator.userAgent.toLowerCase(); return a.indexOf("safari") >= 0 && a.indexOf("chrome") < 0 && a.indexOf("android") < 0; } if (s()) { const a = String(i.navigator.userAgent); if (a.includes("Version/")) { const [d, o] = a.split("Version/")[1].split(" ")[0].split(".").map((c) => Number(c)); e = d < 16 || d === 16 && o < 2; } } const n = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(i.navigator.userAgent), r = s(), l = r || n && t.ios; return { isSafari: e || r, needPerspectiveFix: e, need3dFix: l, isWebView: n }; } function pe() { return j || (j = Me()), j; } function Ie(i) { let { swiper: t, on: e, emit: s } = i; const n = _(); let r = null, l = null; const a = () => { !t || t.destroyed || !t.initialized || (s("beforeResize"), s("resize")); }, d = () => { !t || t.destroyed || !t.initialized || (r = new ResizeObserver((f) => { l = n.requestAnimationFrame(() => { const { width: u, height: p } = t; let h = u, v = p; f.forEach((E) => { let { contentBoxSize: m, contentRect: S, target: g } = E; g && g !== t.el || (h = S ? S.width : (m[0] || m).inlineSize, v = S ? S.height : (m[0] || m).blockSize); }), (h !== u || v !== p) && a(); }); }), r.observe(t.el)); }, o = () => { l && n.cancelAnimationFrame(l), r && r.unobserve && t.el && (r.unobserve(t.el), r = null); }, c = () => { !t || t.destroyed || !t.initialized || s("orientationchange"); }; e("init", () => { if (t.params.resizeObserver && typeof n.ResizeObserver < "u") { d(); return; } n.addEventListener("resize", a), n.addEventListener("orientationchange", c); }), e("destroy", () => { o(), n.removeEventListener("resize", a), n.removeEventListener("orientationchange", c); }); } function Ce(i) { let { swiper: t, extendParams: e, on: s, emit: n } = i; const r = [], l = _(), a = function(c, f) { f === void 0 && (f = {}); const u = l.MutationObserver || l.WebkitMutationObserver, p = new u((h) => { if (t.__preventObserver__) return; if (h.length === 1) { n("observerUpdate", h[0]); return; } const v = function() { n("observerUpdate", h[0]); }; l.requestAnimationFrame ? l.requestAnimationFrame(v) : l.setTimeout(v, 0); }); p.observe(c, { attributes: typeof f.attributes > "u" ? !0 : f.attributes, childList: t.isElement || (typeof f.childList > "u" ? !0 : f).childList, characterData: typeof f.characterData > "u" ? !0 : f.characterData }), r.push(p); }, d = () => { if (t.params.observer) { if (t.params.observeParents) { const c = ye(t.hostEl); for (let f = 0; f < c.length; f += 1) a(c[f]); } a(t.hostEl, { childList: t.params.observeSlideChildren }), a(t.wrapperEl, { attributes: !1 }); } }, o = () => { r.forEach((c) => { c.disconnect(); }), r.splice(0, r.length); }; e({ observer: !1, observeParents: !1, observeSlideChildren: !1 }), s("init", d), s("destroy", o); } var Le = { on(i, t, e) { const s = this; if (!s.eventsListeners || s.destroyed || typeof t != "function") return s; const n = e ? "unshift" : "push"; return i.split(" ").forEach((r) => { s.eventsListeners[r] || (s.eventsListeners[r] = []), s.eventsListeners[r][n](t); }), s; }, once(i, t, e) { const s = this; if (!s.eventsListeners || s.destroyed || typeof t != "function") return s; function n() { s.off(i, n), n.__emitterProxy && delete n.__emitterProxy; for (var r = arguments.length, l = new Array(r), a = 0; a < r; a++) l[a] = arguments[a]; t.apply(s, l); } return n.__emitterProxy = t, s.on(i, n, e); }, onAny(i, t) { const e = this; if (!e.eventsListeners || e.destroyed || typeof i != "function") return e; const s = t ? "unshift" : "push"; return e.eventsAnyListeners.indexOf(i) < 0 && e.eventsAnyListeners[s](i), e; }, offAny(i) { const t = this; if (!t.eventsListeners || t.destroyed || !t.eventsAnyListeners) return t; const e = t.eventsAnyListeners.indexOf(i); return e >= 0 && t.eventsAnyListeners.splice(e, 1), t; }, off(i, t) { const e = this; return !e.eventsListeners || e.destroyed || !e.eventsListeners || i.split(" ").forEach((s) => { typeof t > "u" ? e.eventsListeners[s] = [] : e.eventsListeners[s] && e.eventsListeners[s].forEach((n, r) => { (n === t || n.__emitterProxy && n.__emitterProxy === t) && e.eventsListeners[s].splice(r, 1); }); }), e; }, emit() { const i = this; if (!i.eventsListeners || i.destroyed || !i.eventsListeners) return i; let t, e, s; for (var n = arguments.length, r = new Array(n), l = 0; l < n; l++) r[l] = arguments[l]; return typeof r[0] == "string" || Array.isArray(r[0]) ? (t = r[0], e = r.slice(1, r.length), s = i) : (t = r[0].events, e = r[0].data, s = r[0].context || i), e.unshift(s), (Array.isArray(t) ? t : t.split(" ")).forEach((d) => { i.eventsAnyListeners && i.eventsAnyListeners.length && i.eventsAnyListeners.forEach((o) => { o.apply(s, [d, ...e]); }), i.eventsListeners && i.eventsListeners[d] && i.eventsListeners[d].forEach((o) => { o.apply(s, e); }); }), i; } }; function ze() { const i = this; let t, e; const s = i.el; typeof i.params.width < "u" && i.params.width !== null ? t = i.params.width : t = s.clientWidth, typeof i.params.height < "u" && i.params.height !== null ? e = i.params.height : e = s.clientHeight, !(t === 0 && i.isHorizontal() || e === 0 && i.isVertical()) && (t = t - parseInt(N(s, "padding-left") || 0, 10) - parseInt(N(s, "padding-right") || 0, 10), e = e - parseInt(N(s, "padding-top") || 0, 10) - parseInt(N(s, "padding-bottom") || 0, 10), Number.isNaN(t) && (t = 0), Number.isNaN(e) && (e = 0), Object.assign(i, { width: t, height: e, size: i.isHorizontal() ? t : e })); } function Oe() { const i = this; function t(w, x) { return parseFloat(w.getPropertyValue(i.getDirectionLabel(x)) || 0); } const e = i.params, { wrapperEl: s, slidesEl: n, size: r, rtlTranslate: l, wrongRTL: a } = i, d = i.virtual && e.virtual.enabled, o = d ? i.virtual.slides.length : i.slides.length, c = D(n, `.${i.params.slideClass}, swiper-slide`), f = d ? i.virtual.slides.length : c.length; let u = []; const p = [], h = []; let v = e.slidesOffsetBefore; typeof v == "function" && (v = e.slidesOffsetBefore.call(i)); let E = e.slidesOffsetAfter; typeof E == "function" && (E = e.slidesOffsetAfter.call(i)); const m = i.snapGrid.length, S = i.slidesGrid.length; let g = e.spaceBetween, b = -v, T = 0, C = 0; if (typeof r > "u") return; typeof g == "string" && g.indexOf("%") >= 0 ? g = parseFloat(g.replace("%", "")) / 100 * r : typeof g == "string" && (g = parseFloat(g)), i.virtualSize = -g, c.forEach((w) => { l ? w.style.marginLeft = "" : w.style.marginRight = "", w.style.marginBottom = "", w.style.marginTop = ""; }), e.centeredSlides && e.cssMode && ($(s, "--swiper-centered-offset-before", ""), $(s, "--swiper-centered-offset-after", "")); const I = e.grid && e.grid.rows > 1 && i.grid; I ? i.grid.initSlides(c) : i.grid && i.grid.unsetSlides(); let y; const O = e.slidesPerView === "auto" && e.breakpoints && Object.keys(e.breakpoints).filter((w) => typeof e.breakpoints[w].slidesPerView < "u").length > 0; for (let w = 0; w < f; w += 1) { y = 0; let x; if (c[w] && (x = c[w]), I && i.grid.updateSlide(w, x, c), !(c[w] && N(x, "display") === "none")) { if (e.slidesPerView === "auto") { O && (c[w].style[i.getDirectionLabel("width")] = ""); const M = getComputedStyle(x), L = x.style.transform, B = x.style.webkitTransform; if (L && (x.style.transform = "none"), B && (x.style.webkitTransform = "none"), e.roundLengths) y = i.isHorizontal() ? se(x, "width") : se(x, "height"); else { const F = t(M, "width"), P = t(M, "padding-left"), z = t(M, "padding-right"), A = t(M, "margin-left"), V = t(M, "margin-right"), te = M.getPropertyValue("box-sizing"); if (te && te === "border-box") y = F + A + V; else { const { clientWidth: ge, offsetWidth: ve } = x; y = F + P + z + A + V + (ve - ge); } } L && (x.style.transform = L), B && (x.style.webkitTransform = B), e.roundLengths && (y = Math.floor(y)); } else y = (r - (e.slidesPerView - 1) * g) / e.slidesPerView, e.roundLengths && (y = Math.floor(y)), c[w] && (c[w].style[i.getDirectionLabel("width")] = `${y}px`); c[w] && (c[w].swiperSlideSize = y), h.push(y), e.centeredSlides ? (b = b + y / 2 + T / 2 + g, T === 0 && w !== 0 && (b = b - r / 2 - g), w === 0 && (b = b - r / 2 - g), Math.abs(b) < 1 / 1e3 && (b = 0), e.roundLengths && (b = Math.floor(b)), C % e.slidesPerGroup === 0 && u.push(b), p.push(b)) : (e.roundLengths && (b = Math.floor(b)), (C - Math.min(i.params.slidesPerGroupSkip, C)) % i.params.slidesPerGroup === 0 && u.push(b), p.push(b), b = b + y + g), i.virtualSize += y + g, T = y, C += 1; } } if (i.virtualSize = Math.max(i.virtualSize, r) + E, l && a && (e.effect === "slide" || e.effect === "coverflow") && (s.style.width = `${i.virtualSize + g}px`), e.setWrapperSize && (s.style[i.getDirectionLabel("width")] = `${i.virtualSize + g}px`), I && i.grid.updateWrapperSize(y, u), !e.centeredSlides) { const w = []; for (let x = 0; x < u.length; x += 1) { let M = u[x]; e.roundLengths && (M = Math.floor(M)), u[x] <= i.virtualSize - r && w.push(M); } u = w, Math.floor(i.virtualSize - r) - Math.floor(u[u.length - 1]) > 1 && u.push(i.virtualSize - r); } if (d && e.loop) { const w = h[0] + g; if (e.slidesPerGroup > 1) { const x = Math.ceil((i.virtual.slidesBefore + i.virtual.slidesAfter) / e.slidesPerGroup), M = w * e.slidesPerGroup; for (let L = 0; L < x; L += 1) u.push(u[u.length - 1] + M); } for (let x = 0; x < i.virtual.slidesBefore + i.virtual.slidesAfter; x += 1) e.slidesPerGroup === 1 && u.push(u[u.length - 1] + w), p.push(p[p.length - 1] + w), i.virtualSize += w; } if (u.length === 0 && (u = [0]), g !== 0) { const w = i.isHorizontal() && l ? "marginLeft" : i.getDirectionLabel("marginRight"); c.filter((x, M) => !e.cssMode || e.loop ? !0 : M !== c.length - 1).forEach((x) => { x.style[w] = `${g}px`; }); } if (e.centeredSlides && e.centeredSlidesBounds) { let w = 0; h.forEach((M) => { w += M + (g || 0); }), w -= g; const x = w > r ? w - r : 0; u = u.map((M) => M <= 0 ? -v : M > x ? x + E : M); } if (e.centerInsufficientSlides) { let w = 0; h.forEach((M) => { w += M + (g || 0); }), w -= g; const x = (e.slidesOffsetBefore || 0) + (e.slidesOffsetAfter || 0); if (w + x < r) { const M = (r - w - x) / 2; u.forEach((L, B) => { u[B] = L - M; }), p.forEach((L, B) => { p[B] = L + M; }); } } if (Object.assign(i, { slides: c, snapGrid: u, slidesGrid: p, slidesSizesGrid: h }), e.centeredSlides && e.cssMode && !e.centeredSlidesBounds) { $(s, "--swiper-centered-offset-before", `${-u[0]}px`), $(s, "--swiper-centered-offset-after", `${i.size / 2 - h[h.length - 1] / 2}px`); const w = -i.snapGrid[0], x = -i.slidesGrid[0]; i.snapGrid = i.snapGrid.map((M) => M + w), i.slidesGrid = i.slidesGrid.map((M) => M + x); } if (f !== o && i.emit("slidesLengthChange"), u.length !== m && (i.params.watchOverflow && i.checkOverflow(), i.emit("snapGridLengthChange")), p.length !== S && i.emit("slidesGridLengthChange"), e.watchSlidesProgress && i.updateSlidesOffset(), i.emit("slidesUpdated"), !d && !e.cssMode && (e.effect === "slide" || e.effect === "fade")) { const w = `${e.containerModifierClass}backface-hidden`, x = i.el.classList.contains(w); f <= e.maxBackfaceHiddenSlides ? x || i.el.classList.add(w) : x && i.el.classList.remove(w); } } function Ae(i) { const t = this, e = [], s = t.virtual && t.params.virtual.enabled; let n = 0, r; typeof i == "number" ? t.setTransition(i) : i === !0 && t.setTransition(t.params.speed); const l = (a) => s ? t.slides[t.getSlideIndexByData(a)] : t.slides[a]; if (t.params.slidesPerView !== "auto" && t.params.slidesPerView > 1) if (t.params.centeredSlides) (t.visibleSlides || []).forEach((a) => { e.push(a); }); else for (r = 0; r < Math.ceil(t.params.slidesPerView); r += 1) { const a = t.activeIndex + r; if (a > t.slides.length && !s) break; e.push(l(a)); } else e.push(l(t.activeIndex)); for (r = 0; r < e.length; r += 1) if (typeof e[r] < "u") { const a = e[r].offsetHeight; n = a > n ? a : n; } (n || n === 0) && (t.wrapperEl.style.height = `${n}px`); } function Ge() { const i = this, t = i.slides, e = i.isElement ? i.isHorizontal() ? i.wrapperEl.offsetLeft : i.wrapperEl.offsetTop : 0; for (let s = 0; s < t.length; s += 1) t[s].swiperSlideOffset = (i.isHorizontal() ? t[s].offsetLeft : t[s].offsetTop) - e - i.cssOverflowAdjustment(); } const re = (i, t, e) => { t && !i.classList.contains(e) ? i.classList.add(e) : !t && i.classList.contains(e) && i.classList.remove(e); }; function ke(i) { i === void 0 && (i = this && this.translate || 0); const t = this, e = t.params, { slides: s, rtlTranslate: n, snapGrid: r } = t; if (s.length === 0) return; typeof s[0].swiperSlideOffset > "u" && t.updateSlidesOffset(); let l = -i; n && (l = i), t.visibleSlidesIndexes = [], t.visibleSlides = []; let a = e.spaceBetween; typeof a == "string" && a.indexOf("%") >= 0 ? a = parseFloat(a.replace("%", "")) / 100 * t.size : typeof a == "string" && (a = parseFloat(a)); for (let d = 0; d < s.length; d += 1) { const o = s[d]; let c = o.swiperSlideOffset; e.cssMode && e.centeredSlides && (c -= s[0].swiperSlideOffset); const f = (l + (e.centeredSlides ? t.minTranslate() : 0) - c) / (o.swiperSlideSize + a), u = (l - r[0] + (e.centeredSlides ? t.minTranslate() : 0) - c) / (o.swiperSlideSize + a), p = -(l - c), h = p + t.slidesSizesGrid[d], v = p >= 0 && p <= t.size - t.slidesSizesGrid[d], E = p >= 0 && p < t.size - 1 || h > 1 && h <= t.size || p <= 0 && h >= t.size; E && (t.visibleSlides.push(o), t.visibleSlidesIndexes.push(d)), re(o, E, e.slideVisibleClass), re(o, v, e.slideFullyVisibleClass), o.progress = n ? -f : f, o.originalProgress = n ? -u : u; } } function Ve(i) { const t = this; if (typeof i > "u") { const c = t.rtlTranslate ? -1 : 1; i = t && t.translate && t.translate * c || 0; } const e = t.params, s = t.maxTranslate() - t.minTranslate(); let { progress: n, isBeginning: r, isEnd: l, progressLoop: a } = t; const d = r, o = l; if (s === 0) n = 0, r = !0, l = !0; else { n = (i - t.minTranslate()) / s; const c = Math.abs(i - t.minTranslate()) < 1, f = Math.abs(i - t.maxTranslate()) < 1; r = c || n <= 0, l = f || n >= 1, c && (n = 0), f && (n = 1); } if (e.loop) { const c = t.getSlideIndexByData(0), f = t.getSlideIndexByData(t.slides.length - 1), u = t.slidesGrid[c], p = t.slidesGrid[f], h = t.slidesGrid[t.slidesGrid.length - 1], v = Math.abs(i); v >= u ? a = (v - u) / h : a = (v + h - p) / h, a > 1 && (a -= 1); } Object.assign(t, { progress: n, progressLoop: a, isBeginning: r, isEnd: l }), (e.watchSlidesProgress || e.centeredSlides && e.autoHeight) && t.updateSlidesProgress(i), r && !d && t.emit("reachBeginning toEdge"), l && !o && t.emit("reachEnd toEdge"), (d && !r || o && !l) && t.emit("fromEdge"), t.emit("progress", n); } const U = (i, t, e) => { t && !i.classList.contains(e) ? i.classList.add(e) : !t && i.classList.contains(e) && i.classList.remove(e); }; function De() { const i = this, { slides: t, params: e, slidesEl: s, activeIndex: n } = i, r = i.virtual && e.virtual.enabled, l = i.grid && e.grid && e.grid.rows > 1, a = (f) => D(s, `.${e.slideClass}${f}, swiper-slide${f}`)[0]; let d, o, c; if (r) if (e.loop) { let f = n - i.virtual.slidesBefore; f < 0 && (f = i.virtual.slides.length + f), f >= i.virtual.slides.length && (f -= i.virtual.slides.length), d = a(`[data-swiper-slide-index="${f}"]`); } else d = a(`[data-swiper-slide-index="${n}"]`); else l ? (d = t.find((f) => f.column === n), c = t.find((f) => f.column === n + 1), o = t.find((f) => f.column === n - 1)) : d = t[n]; d && (l || (c = Te(d, `.${e.slideClass}, swiper-slide`)[0], e.loop && !c && (c = t[0]), o = xe(d, `.${e.slideClass}, swiper-slide`)[0], e.loop && !o === 0 && (o = t[t.length - 1]))), t.forEach((f) => { U(f, f === d, e.slideActiveClass), U(f, f === c, e.slideNextClass), U(f, f === o, e.slidePrevClass); }), i.emitSlidesClasses(); } const H = (i, t) => { if (!i || i.destroyed || !i.params) return; const e = () => i.isElement ? "swiper-slide" : `.${i.params.slideClass}`, s = t.closest(e()); if (s) { let n = s.querySelector(`.${i.params.lazyPreloaderClass}`); !n && i.isElement && (s.shadowRoot ? n = s.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`) : requestAnimationFrame(() => { s.shadowRoot && (n = s.shadowRoot.querySelector(`.${i.params.lazyPreloaderClass}`), n && n.remove()); })), n && n.remove(); } }, K = (i, t) => { if (!i.slides[t]) return; const e = i.slides[t].querySelector('[loading="lazy"]'); e && e.removeAttribute("loading"); }, ee = (i) => { if (!i || i.destroyed || !i.params) return; let t = i.params.lazyPreloadPrevNext; const e = i.slides.length; if (!e || !t || t < 0) return; t = Math.min(t, e); const s = i.params.slidesPerView === "auto" ? i.slidesPerViewDynamic() : Math.ceil(i.params.slidesPerView), n = i.activeIndex; if (i.params.grid && i.params.grid.rows > 1) { const l = n, a = [l - t]; a.push(...Array.from({ length: t }).map((d, o) => l + s + o)), i.slides.forEach((d, o) => { a.includes(d.column) && K(i, o); }); return; } const r = n + s - 1; if (i.params.rewind || i.params.loop) for (let l = n - t; l <= r + t; l += 1) { const a = (l % e + e) % e; (a < n || a > r) && K(i, a); } else for (let l = Math.max(n - t, 0); l <= Math.min(r + t, e - 1); l += 1) l !== n && (l > r || l < n) && K(i, l); }; function Be(i) { const { slidesGrid: t, params: e } = i, s = i.rtlTranslate ? i.translate : -i.translate; let n; for (let r = 0; r < t.length; r += 1) typeof t[r + 1] < "u" ? s >= t[r] && s < t[r + 1] - (t[r + 1] - t[r]) / 2 ? n = r : s >= t[r] && s < t[r + 1] && (n = r + 1) : s >= t[r] && (n = r); return e.normalizeSlideIndex && (n < 0 || typeof n > "u") && (n = 0), n; } function Fe(i) { const t = this, e = t.rtlTranslate ? t.translate : -t.translate, { snapGrid: s, params: n, activeIndex: r, realIndex: l, snapIndex: a } = t; let d = i, o; const c = (p) => { let h = p - t.virtual.slidesBefore; return h < 0 && (h = t.virtual.slides.length + h), h >= t.virtual.slides.length && (h -= t.virtual.slides.length), h; }; if (typeof d > "u" && (d = Be(t)), s.indexOf(e) >= 0) o = s.indexOf(e); else { const p = Math.min(n.slidesPerGroupSkip, d); o = p + Math.floor((d - p) / n.slidesPerGroup); } if (o >= s.length && (o = s.length - 1), d === r && !t.params.loop) { o !== a && (t.snapIndex = o, t.emit("snapIndexChange")); return; } if (d === r && t.params.loop && t.virtual && t.params.virtual.enabled) { t.realIndex = c(d); return; } const f = t.grid && n.grid && n.grid.rows > 1; let u; if (t.virtual && n.virtual.enabled && n.loop) u = c(d); else if (f) { const p = t.slides.find((v) => v.column === d); let h = parseInt(p.getAttribute("data-swiper-slide-index"), 10); Number.isNaN(h) && (h = Math.max(t.slides.indexOf(p), 0)), u = Math.floor(h / n.grid.rows); } else if (t.slides[d]) { const p = t.slides[d].getAttribute("data-swiper-slide-index"); p ? u = parseInt(p, 10) : u = d; } else u = d; Object.assign(t, { previousSnapIndex: a, snapIndex: o, previousRealIndex: l, realIndex: u, previousIndex: r, activeIndex: d }), t.initialized && ee(t), t.emit("activeIndexChange"), t.emit("snapIndexChange"), (t.initialized || t.params.runCallbacksOnInit) && (l !== u && t.emit("realIndexChange"), t.emit("slideChange")); } function Ne(i, t) { const e = this, s = e.params; let n = i.closest(`.${s.slideClass}, swiper-slide`); !n && e.isElement && t && t.length > 1 && t.includes(i) && [...t.slice(t.indexOf(i) + 1, t.length)].forEach((a) => { !n && a.matches && a.matches(`.${s.slideClass}, swiper-slide`) && (n = a); }); let r = !1, l; if (n) { for (let a = 0; a < e.slides.length; a += 1) if (e.slides[a] === n) { r = !0, l = a; break; } } if (n && r) e.clickedSlide = n, e.virtual && e.params.virtual.enabled ? e.clickedIndex = parseInt(n.getAttribute("data-swiper-slide-index"), 10) : e.clickedIndex = l; else { e.clickedSlide = void 0, e.clickedIndex = void 0; return; } s.slideToClickedSlide && e.clickedIndex !== void 0 && e.clickedIndex !== e.activeIndex && e.slideToClickedSlide(); } var _e = { updateSize: ze, updateSlides: Oe, updateAutoHeight: Ae, updateSlidesOffset: Ge, updateSlidesProgress: ke, updateProgress: Ve, updateSlidesClasses: De, updateActiveIndex: Fe, updateClickedSlide: Ne }; function Re(i) { i === void 0 && (i = this.isHorizontal() ? "x" : "y"); const t = this, { params: e, rtlTranslate: s, translate: n, wrapperEl: r } = t; if (e.virtualTranslate) return s ? -n : n; if (e.cssMode) return n; let l = Se(r, i); return l += t.cssOverflowAdjustment(), s && (l = -l), l || 0; } function $e(i, t) { const e = this, { rtlTranslate: s, params: n, wrapperEl: r, progress: l } = e; let a = 0, d = 0; const o = 0; e.isHorizontal() ? a = s ? -i : i : d = i, n.roundLengths && (a = Math.floor(a), d = Math.floor(d)), e.previousTranslate = e.translate, e.translate = e.isHorizontal() ? a : d, n.cssMode ? r[e.isHorizontal() ? "scrollLeft" : "scrollTop"] = e.isHorizontal() ? -a : -d : n.virtualTranslate || (e.isHorizontal() ? a -= e.cssOverflowAdjustment() : d -= e.cssOverflowAdjustment(), r.style.transform = `translate3d(${a}px, ${d}px, ${o}px)`); let c; const f = e.maxTranslate() - e.minTranslate(); f === 0 ? c = 0 : c = (i - e.minTranslate()) / f, c !== l && e.updateProgress(i), e.emit("setTranslate", e.translate, t); } function He() { return -this.snapGrid[0]; } function We() { return -this.snapGrid[this.snapGrid.length - 1]; } function Ye(i, t, e, s, n) { i === void 0 && (i = 0), t === void 0 && (t = this.params.speed), e === void 0 && (e = !0), s === void 0 && (s = !0); const r = this, { params: l, wrapperEl: a } = r; if (r.animating && l.preventInteractionOnTransition) return !1; const d = r.minTranslate(), o = r.maxTranslate(); let c; if (s && i > d ? c = d : s && i < o ? c = o : c = i, r.updateProgress(c), l.cssMode) { const f = r.isHorizontal(); if (t === 0) a[f ? "scrollLeft" : "scrollTop"] = -c; else { if (!r.support.smoothScroll) return ce({ swiper: r, targetPosition: -c, side: f ? "left" : "top" }), !0; a.scrollTo({ [f ? "left" : "top"]: -c, behavior: "smooth" }); } return !0; } return t === 0 ? (r.setTransition(0), r.setTranslate(c), e && (r.emit("beforeTransitionStart", t, n), r.emit("transitionEnd"))) : (r.setTransition(t), r.setTranslate(c), e && (r.emit("beforeTransitionStart", t, n), r.emit("transitionStart")), r.animating || (r.animating = !0, r.onTranslateToWrapperTransitionEnd || (r.onTranslateToWrapperTransitionEnd = function(u) { !r || r.destroyed || u.target === this && (r.wrapperEl.removeEventListener("transitionend", r.onTranslateToWrapperTransitionEnd), r.onTranslateToWrapperTransitionEnd = null, delete r.onTranslateToWrapperTransitionEnd, r.animating = !1, e && r.emit("transitionEnd")); }), r.wrapperEl.addEventListener("transitionend", r.onTranslateToWrapperTransitionEnd))), !0; } var Xe = { getTranslate: Re, setTranslate: $e, minTranslate: He, maxTranslate: We, translateTo: Ye }; function qe(i, t) { const e = this; e.params.cssMode || (e.wrapperEl.style.transitionDuration = `${i}ms`, e.wrapperEl.style.transitionDelay = i === 0 ? "0ms" : ""), e.emit("setTransition", i, t); } function he(i) { let { swiper: t, runCallbacks: e, direction: s, step: n } = i; const { activeIndex: r, previousIndex: l } = t; let a = s; a || (r > l ? a = "next" : r < l ? a = "prev" : a = "reset"), t.emit(`transition${n}`), e && a === "reset" ? t.emit(`slideResetTransition${n}`) : e && r !== l && (t.emit(`slideChangeTransition${n}`), a === "next" ? t.emit(`slideNextTransition${n}`) : t.emit(`slidePrevTransition${n}`)); } function je(i, t) { i === void 0 && (i = !0); const e = this, { params: s } = e; s.cssMode || (s.autoHeight && e.updateAutoHeight(), he({ swiper: e, runCallbacks: i, direction: t, step: "Start" })); } function Ue(i, t) { i === void 0 && (i = !0); const e = this, { params: s } = e; e.animating = !1, !s.cssMode && (e.setTransition(0), he({ swiper: e, runCallbacks: i, direction: t, step: "End" })); } var Ke = { setTransition: qe, transitionStart: je, transitionEnd: Ue }; function Je(i, t, e, s, n) { i === void 0 && (i = 0), e === void 0 && (e = !0), typeof i == "string" && (i = parseInt(i, 10)); const r = this; let l = i; l < 0 && (l = 0); const { params: a, snapGrid: d, slidesGrid: o, previousIndex: c, activeIndex: f, rtlTranslate: u, wrapperEl: p, enabled: h } = r; if (!h && !s && !n || r.destroyed || r.animating && a.preventInteractionOnTransition) return !1; typeof t > "u" && (t = r.params.speed); const v = Math.min(r.params.slidesPerGroupSkip, l); let E = v + Math.floor((l - v) / r.params.slidesPerGroup); E >= d.length && (E = d.length - 1); const m = -d[E]; if (a.normalizeSlideIndex) for (let I = 0; I < o.length; I += 1) { const y = -Math.floor(m * 100), O = Math.floor(o[I] * 100), w = Math.floor(o[I + 1] * 100); typeof o[I + 1] < "u" ? y >= O && y < w - (w - O) / 2 ? l = I : y >= O && y < w && (l = I + 1) : y >= O && (l = I); } if (r.initialized && l !== f && (!r.allowSlideNext && (u ? m > r.translate && m > r.minTranslate() : m < r.translate && m < r.minTranslate()) || !r.allowSlidePrev && m > r.translate && m > r.maxTranslate() && (f || 0) !== l)) return !1; l !== (c || 0) && e && r.emit("beforeSlideChangeStart"), r.updateProgress(m); let S; l > f ? S = "next" : l < f ? S = "prev" : S = "reset"; const g = r.virtual && r.params.virtual.enabled; if (!(g && n) && (u && -m === r.translate || !u && m === r.translate)) return r.updateActiveIndex(l), a.autoHeight && r.updateAutoHeight(), r.updateSlidesClasses(), a.effect !== "slide" && r.setTranslate(m), S !== "reset" && (r.transitionStart(e, S), r.transitionEnd(e, S)), !1; if (a.cssMode) { const I = r.isHorizontal(), y = u ? m : -m; if (t === 0) g && (r.wrapperEl.style.scrollSnapType = "none", r._immediateVirtual = !0), g && !r._cssModeVirtualInitialSet && r.params.initialSlide > 0 ? (r._cssModeVirtualInitialSet = !0, requestAnimationFrame(() => { p[I ? "scrollLeft" : "scrollTop"] = y; })) : p[I ? "scrollLeft" : "scrollTop"] = y, g && requestAnimationFrame(() => { r.wrapperEl.style.scrollSnapType = "", r._immediateVirtual = !1; }); else { if (!r.support.smoothScroll) return ce({ swiper: r, targetPosition: y, side: I ? "left" : "top" }), !0; p.scrollTo({ [I ? "left" : "top"]: y, behavior: "smooth" }); } return !0; } const C = pe().isSafari; return g && !n && C && r.isElement && r.virtual.update(!1, !1, l), r.setTransition(t), r.setTranslate(m), r.updateActiveIndex(l), r.updateSlidesClasses(), r.emit("beforeTransitionStart", t, s), r.transitionStart(e, S), t === 0 ? r.transitionEnd(e, S) : r.animating || (r.animating = !0, r.onSlideToWrapperTransitionEnd || (r.onSlideToWrapperTransitionEnd = function(y) { !r || r.destroyed || y.target === this && (r.wrapperEl.removeEventListener("transitionend", r.onSlideToWrapperTransitionEnd), r.onSlideToWrapperTransitionEnd = null, delete r.onSlideToWrapperTransitionEnd, r.transitionEnd(e, S)); }), r.wrapperEl.addEventListener("transitionend", r.onSlideToWrapperTransitionEnd)), !0; } function Qe(i, t, e, s) { i === void 0 && (i = 0), e === void 0 && (e = !0), typeof i == "string" && (i = parseInt(i, 10)); const n = this; if (n.destroyed) return; typeof t > "u" && (t = n.params.speed); const r = n.grid && n.params.grid && n.params.grid.rows > 1; let l = i; if (n.params.loop) if (n.virtual && n.params.virtual.enabled) l = l + n.virtual.slidesBefore; else { let a; if (r) { const u = l * n.params.grid.rows; a = n.slides.find((p) => p.getAttribute("data-swiper-slide-index") * 1 === u).column; } else a = n.getSlideIndexByData(l); const d = r ? Math.ceil(n.slides.length / n.params.grid.rows) : n.slides.length, { centeredSlides: o } = n.params; let c = n.params.slidesPerView; c === "auto" ? c = n.slidesPerViewDynamic() : (c = Math.ceil(parseFloat(n.params.slidesPerView, 10)), o && c % 2 === 0 && (c = c + 1)); let f = d - a < c; if (o && (f = f || a < Math.ceil(c / 2)), s && o && n.params.slidesPerView !== "auto" && !r && (f = !1), f) { const u = o ? a < n.activeIndex ? "prev" : "next" : a - n.activeIndex - 1 < n.params.slidesPerView ? "next" : "prev"; n.loopFix({ direction: u, slideTo: !0, activeSlideIndex: u === "next" ? a + 1 : a - d + 1, slideRealIndex: u === "next" ? n.realIndex : void 0 }); } if (r) { const u = l * n.params.grid.rows; l = n.slides.find((p) => p.getAttribute("data-swiper-slide-index") * 1 === u).column; } else l = n.getSlideIndexByData(l); } return requestAnimationFrame(() => { n.slideTo(l, t, e, s); }), n; } function Ze(i, t, e) { t === void 0 && (t = !0); const s = this, { enabled: n, params: r, animating: l } = s; if (!n || s.destroyed) return s; typeof i > "u" && (i = s.params.speed); let a = r.slidesPerGroup; r.slidesPerView === "auto" && r.slidesPerGroup === 1 && r.slidesPerGroupAuto && (a = Math.max(s.slidesPerViewDynamic("current", !0), 1)); const d = s.activeIndex < r.slidesPerGroupSkip ? 1 : a, o = s.virtual && r.virtual.enabled; if (r.loop) { if (l && !o && r.loopPreventsSliding) return !1; if (s.loopFix({ direction: "next" }), s._clientLeft = s.wrapperEl.clientLeft, s.activeIndex === s.slides.length - 1 && r.cssMode) return requestAnimationFrame(() => { s.slideTo(s.activeIndex + d, i, t, e); }), !0; } return r.rewind && s.isEnd ? s.slideTo(0, i, t, e) : s.slideTo(s.activeIndex + d, i, t, e); } function et(i, t, e) { t === void 0 && (t = !0); const s = this, { params: n, snapGrid: r, slidesGrid: l, rtlTranslate: a, enabled: d, animating: o } = s; if (!d || s.destroyed) return s; typeof i > "u" && (i = s.params.speed); const c = s.virtual && n.virtual.enabled; if (n.loop) { if (o && !c && n.loopPreventsSliding) return !1; s.loopFix({ direction: "prev" }), s._clientLeft = s.wrapperEl.clientLeft; } const f = a ? s.translate : -s.translate; function u(S) { return S < 0 ? -Math.floor(Math.abs(S)) : Math.floor(S); } const p = u(f), h = r.map((S) => u(S)), v = n.freeMode && n.freeMode.enabled; let E = r[h.indexOf(p) - 1]; if (typeof E > "u" && (n.cssMode || v)) { let S; r.forEach((g, b) => { p >= g && (S = b); }), typeof S < "u" && (E = v ? r[S] : r[S > 0 ? S - 1 : S]); } let m = 0; if (typeof E < "u" && (m = l.indexOf(E), m < 0 && (m = s.activeIndex - 1), n.slidesPerView === "auto" && n.slidesPerGroup === 1 && n.slidesPerGroupAuto && (m = m - s.slidesPerViewDynamic("previous", !0) + 1, m = Math.max(m, 0))), n.rewind && s.isBeginning) { const S = s.params.virtual && s.params.virtual.enabled && s.virtual ? s.virtual.slides.length - 1 : s.slides.length - 1; return s.slideTo(S, i, t, e); } else if (n.loop && s.activeIndex === 0 && n.cssMode) return requestAnimationFrame(() => { s.slideTo(m, i, t, e); }), !0; return s.slideTo(m, i, t, e); } function tt(i, t, e) { t === void 0 && (t = !0); const s = this; if (!s.destroyed) return typeof i > "u" && (i = s.params.speed), s.slideTo(s.activeIndex, i, t, e); } function it(i, t, e, s) { t === void 0 && (t = !0), s === void 0 && (s = 0.5); const n = this; if (n.destroyed) return; typeof i > "u" && (i = n.params.speed); let r = n.activeIndex; const l = Math.min(n.params.slidesPerGroupSkip, r), a = l + Math.floor((r - l) / n.params.slidesPerGroup), d = n.rtlTranslate ? n.translate : -n.translate; if (d >= n.snapGrid[a]) { const o = n.snapGrid[a], c = n.snapGrid[a + 1]; d - o > (c - o) * s && (r += n.params.slidesPerGroup); } else { const o = n.snapGrid[a - 1], c = n.snapGrid[a]; d - o <= (c - o) * s && (r -= n.params.slidesPerGroup); } return r = Math.max(r, 0), r = Math.min(r, n.slidesGrid.length - 1), n.slideTo(r, i, t, e); } function st() { const i = this; if (i.destroyed) return; const { params: t, slidesEl: e } = i, s = t.slidesPerView === "auto" ? i.slidesPerViewDynamic() : t.slidesPerView; let n = i.getSlideIndexWhenGrid(i.clickedIndex), r; const l = i.isElement ? "swiper-slide" : `.${t.slideClass}`, a = i.grid && i.params.grid && i.params.grid.rows > 1; if (t.loop) { if (i.animating) return; r = parseInt(i.clickedSlide.getAttribute("data-swiper-slide-index"), 10), t.centeredSlides ? i.slideToLoop(r) : n > (a ? (i.slides.length - s) / 2 - (i.params.grid.rows - 1) : i.slides.length - s) ? (i.loopFix(), n = i.getSlideIndex(D(e, `${l}[data-swiper-slide-index="${r}"]`)[0]), de(() => { i.slideTo(n); })) : i.slideTo(n); } else i.slideTo(n); } var rt = { slideTo: Je, slideToLoop: Qe, slideNext: Ze, slidePrev: et, slideReset: tt, slideToClosest: it, slideToClickedSlide: st }; function nt(i, t) { const e = this, { params: s, slidesEl: n } = e; if (!s.loop || e.virtual && e.params.virtual.enabled) return; const r = () => { D(n, `.${s.slideClass}, swiper-slide`).forEach((p, h) => { p.setAttribute("data-swiper-slide-index", h); }); }, l = () => { const u = D(n, `.${s.slideBlankClass}`); u.forEach((p) => { p.remove(); }), u.length > 0 && (e.recalcSlides(), e.updateSlides()); }, a = e.grid && s.grid && s.grid.rows > 1; s.loopAddBlankSlides && (s.slidesPerGroup > 1 || a) && l(); const d = s.slidesPerGroup * (a ? s.grid.rows : 1), o = e.slides.length % d !== 0, c = a && e.slides.length % s.grid.rows !== 0, f = (u) => { for (let p = 0; p < u; p += 1) { const h = e.isElement ? Z("swiper-slide", [s.slideBlankClass]) : Z("div", [s.slideClass, s.slideBlankClass]); e.slidesEl.append(h); } }; if (o) { if (s.loopAddBlankSlides) { const u = d - e.slides.length % d; f(u), e.recalcSlides(), e.updateSlides(); } else W("Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)"); r(); } else if (c) { if (s.loopAddBlankSlides) { const u = s.grid.rows - e.slides.length % s.grid.rows; f(u), e.recalcSlides(), e.updateSlides(); } else W("Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)"); r(); } else r(); e.loopFix({ slideRealIndex: i, direction: s.centeredSlides ? void 0 : "next", initial: t }); } function at(i) { let { slideRealIndex: t, slideTo: e = !0, direction: s, setTranslate: n, activeSlideIndex: r, initial: l, byController: a, byMousewheel: d } = i === void 0 ? {} : i; const o = this; if (!o.params.loop) return; o.emit("beforeLoopFix"); const { slides: c, allowSlidePrev: f, allowSlideNext: u, slidesEl: p, params: h } = o, { centeredSlides: v, initialSlide: E } = h; if (o.allowSlidePrev = !0, o.allowSlideNext = !0, o.virtual && h.virtual.enabled) { e && (!h.centeredSlides && o.snapIndex === 0 ? o.slideTo(o.virtual.slides.length, 0, !1, !0) : h.centeredSlides && o.snapIndex < h.slidesPerView ? o.slideTo(o.virtual.slides.length + o.snapIndex, 0, !1, !0) : o.snapIndex === o.snapGrid.length - 1 && o.slideTo(o.virtual.slidesBefore, 0, !1, !0)), o.allowSlidePrev = f, o.allowSlideNext = u, o.emit("loopFix"); return; } let m = h.slidesPerView; m === "auto" ? m = o.slidesPerViewDynamic() : (m = Math.ceil(parseFloat(h.slidesPerView, 10)), v && m % 2 === 0 && (m = m + 1)); const S = h.slidesPerGroupAuto ? m : h.slidesPerGroup; let g = v ? Math.max(S, Math.ceil(m / 2)) : S; g % S !== 0 && (g += S - g % S), g += h.loopAdditionalSlides, o.loopedSlides = g; const b = o.grid && h.grid && h.grid.rows > 1; c.length < m + g || o.params.effect === "cards" && c.length < m + g * 2 ? W("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters") : b && h.grid.fill === "row" && W("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`"); const T = [], C = [], I = b ? Math.ceil(c.length / h.grid.rows) : c.length, y = l && I - E < m && !v; let O = y ? E : o.activeIndex; typeof r > "u" ? r = o.getSlideIndex(c.find((P) => P.classList.contains(h.slideActiveClass))) : O = r; const w = s === "next" || !s, x = s === "prev" || !s; let M = 0, L = 0; const F = (b ? c[r].column : r) + (v && typeof n > "u" ? -m / 2 + 0.5 : 0); if (F < g) { M = Math.max(g - F, S); for (let P = 0; P < g - F; P += 1) { const z = P - Math.floor(P / I) * I; if (b) { const A = I - z - 1; for (let V = c.length - 1; V >= 0; V -= 1) c[V].column === A && T.push(V); } else T.push(I - z - 1); } } else if (F + m > I - g) { L = Math.max(F - (I - g * 2), S), y && (L = Math.max(L, m - I + E + 1)); for (let P = 0; P < L; P += 1) { const z = P - Math.floor(P / I) * I; b ? c.forEach((A, V) => { A.column === z && C.push(V); }) : C.push(z); } } if (o.__preventObserver__ = !0, requestAnimationFrame(() => { o.__preventObserver__ = !1; }), o.params.effect === "cards" && c.length < m + g * 2 && (C.includes(r) && C.splice(C.indexOf(r), 1), T.includes(r) && T.splice(T.indexOf(r), 1)), x && T.forEach((P) => { c[P].swiperLoopMoveDOM = !0, p.prepend(c[P]), c[P].swiperLoopMoveDOM = !1; }), w && C.forEach((P) => { c[P].swiperLoopMoveDOM = !0, p.append(c[P]), c[P].swiperLoopMoveDOM = !1; }), o.recalcSlides(), h.slidesPerView === "auto" ? o.updateSlides() : b && (T.length > 0 && x || C.length > 0 && w) && o.slides.forEach((P, z) => { o.grid.updateSlide(z, P, o.slides); }), h.watchSlidesProgress && o.updateSlidesOffset(), e) { if (T.length > 0 && x) { if (typeof t > "u") { const P = o.slidesGrid[O], A = o.slidesGrid[O + M] - P; d ? o.setTranslate(o.translate - A) : (o.slideTo(O + Math.ceil(M), 0, !1, !0), n && (o.touchEventsData.startTranslate = o.touchEventsData.startTranslate - A, o.touchEventsData.currentTranslate = o.touchEventsData.currentTranslate - A)); } else if (n) { const P = b ? T.length / h.grid.rows : T.length; o.slideTo(o.activeIndex + P, 0, !1, !0), o.touchEventsData.currentTranslate = o.translate; } } else if (C.length > 0 && w) if (typeof t > "u") { const P = o.slidesGrid[O], A = o.slidesGrid[O - L] - P; d ? o.setTranslate(o.translate - A) : (o.slideTo(O - L, 0, !1, !0), n && (o.touchEventsData.startTranslate = o.touchEventsData.startTranslate - A, o.touchEventsData.currentTranslate = o.touchEventsData.currentTranslate - A)); } else { const P = b ? C.length / h.grid.rows : C.length; o.slideTo(o.activeIndex - P, 0, !1, !0); } } if (o.allowSlidePrev = f, o.allowSlideNext = u, o.controller && o.controller.control && !a) { const P = { slideRealIndex: t, direction: s, setTranslate: n, activeSlideIndex: r, byController: !0 }; Array.isArray(o.controller.control) ? o.controller.control.forEach((z) => { !z.destroyed && z.params.loop && z.loopFix({ ...P, slideTo: z.params.slidesPerView === h.slidesPerView ? e : !1 }); }) : o.controller.control instanceof o.constructor && o.controller.control.params.loop && o.controller.control.loopFix({ ...P, slideTo: o.controller.control.params.slidesPerView === h.slidesPerView ? e : !1 }); } o.emit("loopFix"); } function lt() { const i = this, { params: t, slidesEl: e } = i; if (!t.loop || !e || i.virtual && i.params.virtual.enabled) return; i.recalcSlides(); const s = []; i.slides.forEach((n) => { const r = typeof n.swiperSlideIndex > "u" ? n.getAttribute("data-swiper-slide-index") * 1 : n.swiperSlideIndex; s[r] = n; }), i.slides.forEach((n) => { n.removeAttribute("data-swiper-slide-index"); }), s.forEach((n) => { e.append(n); }), i.recalcSlides(), i.slideTo(i.realIndex, 0); } var ot = { loopCreate: nt, loopFix: at, loopDestroy: lt }; function dt(i) { const t = this; if (!t.params.simulateTouch || t.params.watchOverflow && t.isLocked || t.params.cssMode) return; const e = t.params.touchEventsTarget === "container" ? t.el : t.wrapperEl; t.isElement && (t.__preventObserver__ = !0), e.style.cursor = "move", e.style.cursor = i ? "grabbing" : "grab", t.isElement && requestAnimationFrame(() => { t.__preventObserver__ = !1; }); } function ct() { const i = this; i.params.watchOverflow && i.isLocked || i.params.cssMode || (i.isElement && (i.__preventObserver__ = !0), i[i.params.touchEventsTarget === "container" ? "el" : "wrapperEl"].style.cursor = "", i.isElement && requestAnimationFrame(() => { i.__preventObserver__ = !1; })); } var ft = { setGrabCursor: dt, unsetGrabCursor: ct }; function ut(i, t) { t === void 0 && (t = this); function e(s) { if (!s || s === R() || s === _()) return null; s.assignedSlot && (s = s.assignedSlot); const n = s.closest(i); return !n && !s.getRootNode ? null : n || e(s.getRootNode().host); } return e(t); } function ne(i, t, e) { const s = _(), { params: n } = i, r = n.edgeSwipeDetection, l = n.edgeSwipeThreshold; return r && (e <= l || e >= s.innerWidth - l) ? r === "prevent" ? (t.preventDefault(), !0) : !1 : !0; } function pt(i) { const t = this, e = R(); let s = i; s.originalEvent && (s = s.originalEvent); const n = t.touchEventsData; if (s.type === "pointerdown") { if (n.pointerId !== null && n.pointerId !== s.pointerId) return; n.pointerId = s.pointerId; } else s.type === "touchstart" && s.targetTouches.length === 1 && (n.touchId = s.targetTouches[0].identifier); if (s.type === "touchstart") { ne(t, s, s.targetTouches[0].pageX); return; } const { params: r, touches: l, enabled: a } = t; if (!a || !r.simulateTouch && s.pointerType === "mouse" || t.animating && r.preventInteractionOnTransition) return; !t.animating && r.cssMode && r.loop && t.loopFix(); let d = s.target; if (r.touchEventsTarget === "wrapper" && !be(d, t.wrapperEl) || "which" in s && s.which === 3 || "button" in s && s.button > 0 || n.isTouched && n.isMoved) return; const o = !!r.noSwipingClass && r.noSwipingClass !== "", c = s.composedPath ? s.composedPath() : s.path; o && s.target && s.target.shadowRoot && c && (d = c[0]); const f = r.noSwipingSelector ? r.noSwipingSelector : `.${r.noSwipingClass}`, u = !!(s.target && s.target.shadowRoot); if (r.noSwiping && (u ? ut(f, d) : d.closest(f))) { t.allowClick = !0; return; } if (r.swipeHandler && !d.closest(r.swipeHandler)) return; l.currentX = s.pageX, l.currentY = s.pageY; const p = l.currentX, h = l.currentY; if (!ne(t, s, p)) return; Object.assign(n, { isTouched: !0, isMoved: !1, allowTouchCallbacks: !0, isScrolling: void 0, startMoving: void 0 }), l.startX = p, l.startY = h, n.touchStartTime = Y(), t.allowClick = !0, t.updateSize(), t.swipeDirection = void 0, r.threshold > 0 && (n.allowThresholdMove = !1); let v = !0; d.matches(n.focusableElements) && (v = !1, d.nodeName === "SELECT" && (n.isTouched = !1)), e.activeElement && e.activeElement.matches(n.focusableElements) && e.activeElement !== d && (s.pointerType === "mouse" || s.pointerType !== "mouse" && !d.matches(n.focusableElements)) && e.activeElement.blur(); const E = v && t.allowTouchMove && r.touchStartPreventDefault; (r.touchStartForcePreventDefault || E) && !d.isContentEditable && s.preventDefault(), r.freeMode && r.freeMode.enabled && t.freeMode && t.animating && !r.cssMode && t.freeMode.onTouchStart(), t.emit("touchStart", s); } function ht(i) { const t = R(), e = this, s = e.touchEventsData, { params: n, touches: r, rtlTranslate: l, enabled: a } = e; if (!a || !n.simulateTouch && i.pointerType === "mouse") return; let d = i; if (d.originalEvent && (d = d.originalEvent), d.type === "pointermove" && (s.touchId !== null || d.pointerId !== s.pointerId)) return; let o; if (d.type === "touchmove") { if (o = [...d.changedTouches].find((T) => T.identifier === s.touchId), !o || o.identifier !== s.touchId) return; } else o = d; if (!s.isTouched) { s.startMoving && s.isScrolling && e.emit("touchMoveOpposite", d); return; } const c = o.pageX, f = o.pageY; if (d.preventedByNestedSwiper) { r.startX = c, r.startY = f; return; } if (!e.allowTouchMove) { d.target.matches(s.focusableElements) || (e.allowClick = !1), s.isTouched && (Object.assign(r, { startX: c, startY: f, currentX: c, currentY: f }), s.touchStartTime = Y()); return; } if (n.touchReleaseOnEdges && !n.loop) if (e.isVertical()) { if (f < r.startY && e.translate <= e.maxTranslate() || f > r.startY && e.translate >= e.minTranslate()) { s.isTouched = !1, s.isMoved = !1; return; } } else { if (l && (c > r.startX && -e.translate <= e.maxTranslate() || c < r.startX && -e.translate >= e.minTranslate())) return; if (!l && (c < r.startX && e.translate <= e.maxTranslate() || c > r.startX && e.translate >= e.minTranslate())) return; } if (t.activeElement && t.activeElement.matches(s.focusableElements) && t.activeElement !== d.target && d.pointerType !== "mouse" && t.activeElement.blur(), t.activeElement && d.target === t.activeElement && d.target.matches(s.focusableElements)) { s.isMoved = !0, e.allowClick = !1; return; } s.allowTouchCallbacks && e.emit("touchMove", d), r.previousX = r.currentX, r.previousY = r.currentY, r.currentX = c, r.currentY = f; const u = r.currentX - r.startX, p = r.currentY - r.startY; if (e.params.threshold && Math.sqrt(u ** 2 + p **