PageSourceSearch

https://www.kayak.com/news/wp-content/plugins/r9-multi-blocks/build/carousel-swiper.chunk.js

js kayak.com collected 2026-09-24 07:34:25 UTC 6,740 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkr9_multi_blocks||=[]).push([[4578],{43899(e,t,i){i.d(t,{default:()=>h});var s=i(51236),n=i(7936),a=i(48832),r=i(75103),o=i(43385);class l{constructor(e,t=!1){if(this.handlers=[],this.event=e,t){let e;window.addEventListener(this.event,()=>{e&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(this.fire.bind(this))},!1)}else window.addEventListener(this.event,this.fire.bind(this));"complete"===document.readyState||"loading"!==document.readyState&&!document.documentElement.doScroll?this.fire():document.addEventListener("DOMContentLoaded",()=>{this.fire()})}subscribe(e,t=!1){this.handlers.push(e),t&&e()}unsubscribe(e){this.handlers=this.handlers.filter(t=>{if(t!==e)return t})}fire(){this.handlers.forEach(e=>{e()})}}const d=new l("resize",!0);new l("scroll",!0);class h{constructor(e){this.swiper=null,this.initialized=!1,this.navigationParams={},this.paginationParams={},this.autoplayParams={},this.groupParams={},this.modules=[n.A,a.A],this.container=e.container,this.prevVisibleIndexes=[],this.lastActiveElement=null,this.onResizeCallbacks=[];const t=this.container.getAttribute("data-param-nav-type");if(e.paginationContainer&&t){let i;switch(!0){case t.includes("fraction"):i="fraction";break;case t.includes("bullets"):default:i="bullets"}this.paginationParams={pagination:{el:e.paginationContainer,type:i,clickable:!0}},this.modules.push(r.A)}e.prev&&e.next&&(this.navigationParams={navigation:{nextEl:e.next,prevEl:e.prev,addIcons:!1}},this.modules.push(o.A)),this.autoplayParams={autoplay:!1};const i=this.container.getAttribute("data-param-delay");i&&(this.autoplayParams={loop:!0,autoplay:{delay:1e3*i,disableOnInteraction:!0}});const s=this.container.getAttribute("data-param-slides-per-group");if(s&&(this.groupParams={slidesPerGroup:parseInt(s,10)}),this.initialized=this.init(),this.initialized){if(this.onSwiperInit(),this.prepareNavControls(),this.updateNavState(),i){this.onSwiperInitWithAutoplay();const e=this.swiper.wrapperEl;e.addEventListener("focusin",()=>{this.swiper.autoplay.stop()}),e.addEventListener("focusout",()=>{this.swiper.autoplay.start()})}this.swiper.on("slideChangeTransitionStart",()=>{this.prevVisibleIndexes=this.getVisibleSlideIndexes(),this.lastActiveElement=document.activeElement}),this.swiper.on("slideChangeTransitionEnd",this.onChangeEnd.bind(this)),this.swiper.on("navigationHide",this.updateNavState.bind(this)),this.swiper.on("navigationShow",this.updateNavState.bind(this)),this.swiper.on("snapGridLengthChange",this.updateNavState.bind(this)),this.swiper.on("slidePrevTransitionStart",this.updateNavState.bind(this)),this.swiper.on("slideNextTransitionStart",this.updateNavState.bind(this)),d.subscribe(this.onWindowResize.bind(this)),this.processVisibleAndInvisibleSlides(!0)}}init(){const e=Object.assign({},{watchOverflow:!0,slidesPerView:"auto",keyboard:{enabled:!0,onlyInViewport:!0},threshold:50},this.navigationParams,this.paginationParams,this.autoplayParams,this.groupParams);return s.A.use(this.modules),this.swiper=new s.A(this.container,e),!this.container.className.includes("swiper-nav-wrapper-position-")&&(this.adjustNavPosition(),this.onResizeCallbacks.push(this.adjustNavPosition.bind(this))),this.swiper.initialized&&this.swiper.slides.length>0}onSwiperInit(){const e=new CustomEvent("swiper-js-init",{bubbles:!0}),t=new CustomEvent("r9-multi-blocks-swiper-js-init",{bubbles:!0});this.container.dispatchEvent(e),this.container.dispatchEvent(t)}onSwiperInitWithAutoplay(){const e=new CustomEvent("swiper-js-init-with-autoplay",{bubbles:!0}),t=new CustomEvent("r9-multi-blocks-swiper-js-init-with-autoplay",{bubbles:!0});this.container.dispatchEvent(e),this.container.dispatchEvent(t)}onChangeEnd(){this.processVisibleAndInvisibleSlides()}processVisibleAndInvisibleSlides(e=!1){const t=this.getVisibleSlideIndexes();let i,s;if(i=e?[...Array(this.swiper.slides.length).keys()].filter(e=>!t.includes(e)):this.prevVisibleIndexes.filter(e=>!t.includes(e)),s=e?t:t.filter(e=>!this.prevVisibleIndexes.includes(e)),i.forEach(e=>{const t=this.getSlideByRealIndex(e);t.classList.remove("swiper-slide--is-visible"),t.classList.add("swiper-slide--is-not-visible");const i=t.querySelectorAll("a");h.disableFocus(i)}
1),s.forEach(e=>{const t=this.getSlideByRealIndex(e);t.classList.remove("swiper-slide--is-not-visible"),t.classList.add("swiper-slide--is-visible");const i=t.querySelectorAll("a");h.enableFocus(i)}),void 0!==i.find(e=>this.getSlideByRealIndex(e).contains(this.lastActiveElement))&&s.length>0){const e="next"==(this.swiper.activeIndex>this.swiper.previousIndex?"next":"prev")?[...t].shift():[...t].pop(),i=this.getSlideByRealIndex(e).querySelector("a");i&&i.focus()}}static enableFocus(e){e.forEach(e=>{e.setAttribute("tabIndex",0)})}static disableFocus(e){e.forEach(e=>{e.setAttribute("tabIndex",-1)})}prepareNavControls(){const{prevEl:e,nextEl:t}=this.useNavigation();e&&t&&(e.addEventListener("keydown",e=>{[13,32].includes(e.keyCode)&&this.swiper.slidePrev()}),t.addEventListener("keydown",e=>{[13,32].includes(e.keyCode)&&this.swiper.slideNext()}))}updateNavState(){const{prevEl:e,nextEl:t}=this.useNavigation();e&&t&&(e.setAttribute("tabindex",this.swiper.isBeginning?"-1":"0"),t.setAttribute("tabindex",this.swiper.isEnd?"-1":"0"))}adjustNavPosition(){const{prevEl:e,nextEl:t}=this.useNavigation();if(!e&&!t)return;const i=(e.offsetHeight+t.offsetHeight)/2;let s=[];const n=this.container.querySelectorAll(".card__thumbnail, .post-card__thumbnail");s=n.length?n:this.container.querySelectorAll(".card, .post-card");const a=Array.from(s).reduce((e,t)=>{const i=t.offsetHeight;return Math.max(e,i)},0)/2-i/2;e.style.top=a+"px",t.style.top=a+"px"}adjustWrapperElResponsiveWidth(){let e=this.swiper.wrapperEl,t=e.parentNode;e.style.width=t.offsetWidth+"px",this.swiper.update()}onWindowResize(){this.adjustWrapperElResponsiveWidth(),this.onResizeCallbacks.length>0&&this.onResizeCallbacks.forEach(e=>{"function"==typeof e&&e()})}useNavigation(){const e=e=>("object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType)||Array.isArray(e)&&e.length>0;return{prevEl:!!e(this.swiper.navigation?.prevEl)&&this.swiper.navigation.prevEl,nextEl:!!e(this.swiper.navigation?.nextEl)&&this.swiper.navigation.nextEl}}getVisibleSlideIndexes(){const e=this.swiper.el.getBoundingClientRect();return this._getIndexedSlides().filter(({slide:t})=>{const i=t.getBoundingClientRect();return i.left>=e.left-1&&i.right<=e.right+1&&i.width>0}).map(({index:e})=>e)}getSlideByRealIndex(e){return this._getIndexedSlides().find(({index:t})=>e===t).slide}_getIndexedSlides(){return Array.from(this.swiper.slides).map((e,t)=>{const i=e.dataset.swiperSlideIndex;return{slide:e,index:i?parseInt(i,10):t}})}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.