1import{B as t}from"./BaseElement.DAzHg0T6.min.js";import{d as e}from"./debounce.7obvWBYM.min.js";import{n as i,t as r}from"./vendor-lit.Cg17OMaX.min.js";var n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=(t,e,i,r)=>{for(var o,l=r>1?void 0:r?s(e,i):e,a=t.length-1;a>=0;a--)(o=t[a])&&(l=(r?o(e,i,l):o(l))||l);return r&&l&&n(e,i,l),l};let l=class extends t{constructor(){super(...arguments),this.scrollContainer=null,this.isDragging=!1,this.dragStarted=!1,this.startX=0,this.initialScrollLeft=0,this.animationFrameId=null,this.resizeObserver=null,this.blockType="regular",this.mobileGap=16,this.desktopGap=16,this.updateScrollKeyboardAccess=()=>{if(!this.scrollContainer)return;const t=this.scrollContainer,e=t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1,i=!!t.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');e&&!i?(t.setAttribute("tabindex","0"),t.getAttribute("role")||t.setAttribute("role","region"),t.getAttribute("aria-label")||t.getAttribute("aria-labelledby")||t.setAttribute("aria-label","Scrollable content")):"0"===t.getAttribute("tabindex")&&t.removeAttribute("tabindex")},this.handleFocusIn=t=>{const e=this.scrollContainer,i=t.target;if(!(e&&i instanceof HTMLElement))return;const r=i.getBoundingClientRect(),n=e.getBoundingClientRect();r.left>=n.left&&r.right<=n.right||i.scrollIntoView({block:"nearest",inline:"nearest"})},this.applyListSemantics=()=>{const t=this.scrollContainer;if(!t||"list"!==t.getAttribute("role"))return;const e=!!t.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');Array.from(t.children).forEach(t=>{t.getAttribute("role")||t.setAttribute("role","listitem"),e||t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")})},this.initDragScroll=()=>{if(this.scrollContainer){if("flyout-scroll"===this.blockType&&parseInt(this.getAttribute("data-badge-count")||"0")<=4)return;this.scrollContainer.style.cursor="grab",this.scrollContainer.style.userSelect="none",this.scrollContainer.addEventListener("pointerdown",this.handlePointerDown),this.scrollContainer.addEventListener("pointermove",this.handlePointerMove),this.scrollContainer.addEventListener("pointerup",this.handlePointerUp),this.scrollContainer.addEventListener("pointerleave",this.handlePointerUp)}},this.handlePointerDown=t=>{this.scrollContainer&&(this.dragStarted=!1,this.isDragging=!0,this.startX=t.pageX-this.scrollContainer.offsetLeft,this.initialScrollLeft=this.scrollContainer.scrollLeft)},this.handlePointerMove=t=>{if(this.scrollContainer){if(this.isDragging&&!this.dragStarted){const e=t.pageX-this.scrollContainer.offsetLeft;Math.abs(e-this.startX)>5&&(this.dragStarted=!0,this.scrollContainer.style.cursor="grabbing",this.scrollContainer.setPointerCapture(t.pointerId),this.startX=e,this.initialScrollLeft=this.scrollContainer.scrollLeft)}this.dragStarted&&(null!==this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{if(!this.scrollContainer)return;const e=t.pageX-this.scrollContainer.offsetLeft-this.startX;this.scrollContainer.scrollLeft=this.initialScrollLeft-e}))}},this.handlePointerUp=t=>{this.scrollContainer&&(this.isDragging=!1,this.dragStarted=!1,this.scrollContainer.style.cursor="grab",this.scrollContainer.hasPointerCapture(t.pointerId)&&this.scrollContainer.releasePointerCapture(t.pointerId),null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null))}}connectedCallback(){super.connectedCallback(),this.scrollContainer=this.querySelector("[data-scroll-container]"),this.scrollContainer&&(this.initDragScroll(),this.applyListSemantics(),this.updateScrollKeyboardAccess(),this.scrollContainer.addEventListener("focusin",this.handleFocusIn)),this.updateCardWidth=this.updateCardWidth.bind(this),this.updateCardWidth();const t=e(()=>{this.updateCardWidth(),this.updateScrollKeyboardAccess()},150);this.resizeObserver=new ResizeObserver(t),this.resizeObserver.observe(this)}updateCardWidth(){this.querySelectorAll(".overflow-card").forEach(t=>{var e;if("certification-products"===this.blockType){const i=16,r=2.05;let n=(null==(e=this.scrollContainer)?void 0:e.clientWidth)??0;if(this.scrollContainer&&n>0){const t=window.getComputedStyle(this.scrollContainer);n-=(parseFloat(t.paddingInlineStart)||0)+(parseFloat(t.paddingInlineEnd)||0)}if(n>0){const e=Math.max(155,(n-i*(r-1))/r);t.style.width=`${e}px`,t.style.minWidth="155px",t.style.flexShrink="0"}return}const i=window.matchMedia&&window.matchMedia("(max-width: 768px)").matches,r
1=window.innerWidth;if(i){let e=24;const i=24;let n=.66*(r-e-i)+"px";"circle"===this.blockType&&(e=72,n=.33*(r-e-i)+"px"),"product-cards-carousel"===this.blockType&&(e=1.5*this.mobileGap*2,n=.5*(r-e-i)+"px"),t.style.width=n}else{const e=64;let i=96,n=.25*(r-i-e)+"px";"article"===this.blockType?(i=72,n=.33*(r-i-e)+"px"):"circle"===this.blockType?n="135px":"product-cards-carousel"===this.blockType&&(i=1.5*this.desktopGap*4,n=.25*(r-i-e)+"px"),t.style.width=n}if("header-overflow"===this.blockType){const e=16,r=24,n=.66*((i?window.innerWidth:454)-e-r)+"px";t.style.width=n}if("flyout-scroll"===this.blockType){const e=96,r=24,n=.25*((i?window.innerWidth:375)-e-r)+"px";t.style.width=n}if("product-flyout-tab"===this.blockType&&(t.style.width="max-content"),"mini-cart-upsells"===this.blockType){const e=8,r=24,n=.8*((i?window.innerWidth:454)-e-r)+"px";t.style.width=n}})}disconnectedCallback(){this.scrollContainer&&(this.scrollContainer.removeEventListener("pointerdown",this.handlePointerDown),this.scrollContainer.removeEventListener("pointermove",this.handlePointerMove),this.scrollContainer.removeEventListener("pointerup",this.handlePointerUp),this.scrollContainer.removeEventListener("pointerleave",this.handlePointerUp),this.scrollContainer.removeEventListener("focusin",this.handleFocusIn),this.scrollContainer.style.cursor="",this.scrollContainer.style.userSelect=""),null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.resizeObserver&&this.resizeObserver.disconnect(),super.disconnectedCallback()}};o([i({type:String,attribute:"data-block-type"})],l.prototype,"blockType",2),o([i({type:Number,attribute:"mobile-gap"})],l.prototype,"mobileGap",2),o([i({type:Number,attribute:"desktop-gap"})],l.prototype,"desktopGap",2),l=o([r("overflow-scroll")],l);export{l as OverflowScroll};
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.