1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`019a3360-8875-462e-993e-e8d7888d87a4`,e._sentryDebugIdIdentifier=`sentry-dbid-019a3360-8875-462e-993e-e8d7888d87a4`)}catch{}})();import{r as e}from"./rolldown-runtime.ydZ5IrsR.js";import{t}from"./throttle.pxqAxeN4.js";import{t as n}from"./dom.0jvI7Qri.js";function r(e,t){return Number.isNaN(e)?t:e}function i(e){let t=e.getBoundingClientRect();return{x:t.x+window.scrollX,y:t.y+window.scrollY,width:t.width,height:t.height,left:t.left+window.scrollX,right:t.right+window.scrollX,top:t.top+window.scrollY,bottom:t.bottom+window.scrollY}}function a(e){let t=getComputedStyle(e),n=parseFloat(t.marginTop),a=parseFloat(t.marginBottom),o=r(parseFloat(t.top),0),s=i(e),c=s.y-n,l=s.height+n+a-o;return{marginTop:n,marginBottom:a,x:s.x,y:c,width:s.width,height:l,top:c,bottom:c+l,left:s.left,right:s.right}}function o(e,t){let n=[],r=new Set(e);outer:for(let i of e){let e=i.parentElement;for(;e&&e!==t;){if(r.has(e))continue outer;e=e.parentElement}n.push(i)}return n}function s(e,t,n){let r=t.top+n+t.marginTop;return r+t.height-t.marginTop>e.top&&r<e.bottom}var c=`debugCollisionSolver`,l=`front-pages:debugCollisionSolver`,u=`collision-solver-debug-overlay`;function d(e){if(e===!0)return!0;if(e!==`auto`)return!1;try{let e=new URLSearchParams(window.location.search).get(c);if(e!==null)return![`0`,`false`,`off`].includes(e.toLowerCase());let t=window.localStorage.getItem(l);return t===`1`||t===`true`}catch{return!1}}function f(e){return e.map(e=>({...e,label:m(e.element),rect:a(e.element)}))}var p=class{asideContainer;overlay=null;solveCount=0;constructor(e){this.asideContainer=e}renderAndLog({targets:e,items:t,feedGap:n}){this.renderOverlay(e,t),this.logSolve(e,t,n)}renderOverlay(e,t){this.overlay?.remove();let n=document.createElement(`div`);n.className=u,n.style.position=`absolute`,n.style.inset=`0 auto auto 0`,n.style.pointerEvents=`none`,n.style.zIndex=`2147483647`,document.body.appendChild(n),this.overlay=n;let r=i(this.asideContainer);for(let t of e)g(n,{rect:{...t.rect,left:r.left,right:r.right,width:r.width},border:`2px dashed rgba(220, 38, 38, 0.9)`,background:`rgba(220, 38, 38, 0.12)`,label:[`target ${t.index}: ${t.label}`,`${Math.round(t.rect.top)}-${Math.round(t.rect.bottom)}px`].join(` | `)});for(let e of t){let t=a(e.element);g(n,{rect:{...t,height:e.naturalBottom-e.naturalTop,top:e.naturalTop,bottom:e.naturalBottom,y:e.naturalTop},border:`1px dashed rgba(37, 99, 235, 0.7)`,background:`rgba(37, 99, 235, 0.06)`,label:[`item ${e.index} natural`,`${Math.round(e.naturalTop)}-${Math.round(e.naturalBottom)}px`].join(` | `)}),g(n,{rect:t,border:`2px solid rgba(37, 99, 235, 0.95)`,background:`rgba(37, 99, 235, 0.08)`,label:[`item ${e.index}: ${e.label}`,`margin ${Math.round(e.displacement)}px`,e.zone,`target ${e.targetBefore??`-`} -> ${e.targetAfter??`-`}`,`targets ${e.consumedTargets.join(`, `)||`-`}`].filter(Boolean).join(` | `)}),e.displacement!==0&&_(n,e,t)}}logSolve(e,t,n){this.solveCount++,console.groupCollapsed(`[CollisionSolver] solve ${this.solveCount}: ${t.length} items, ${e.length} targets`),console.table(e.map(e=>({index:e.index,label:e.label,top:Math.round(e.rect.top),bottom:Math.round(e.rect.bottom),height:Math.round(e.rect.height)}))),console.table(t.map(e=>({index:e.index,label:e.label,zone:e.zone??`-`,targetBefore:e.targetBefore??`-`,targetAfter:e.targetAfter??`-`,naturalTop:Math.round(e.naturalTop),naturalBottom:Math.round(e.naturalBottom),finalTop:Math.round(e.finalTop),finalBottom:Math.round(e.finalBottom),displacement:Math.round(e.displacement),consumedTargets:e.consumedTargets.join(`, `)||`-`,feedGap:Math.round(n)}))),console.groupEnd()}};function m(e){for(let t of[`data-edition-name`,`data-placement-id`,`data-component`,`data-testid`,`id`]){let n=e.getAttribute(t);if(n)return n}return e.querySelector(`h1, h2, h3`)?.textContent?.trim()||(typeof e.className==`string`&&e.className.length>0?`.${e.className.split(/\s+/)[0]}`:e.tagName.toLowerCase())}function h(e){return{height:`${Math.max(0,e.height)}px`,left:`${e.left}px`,top:`${e.top}px`,width:`${Math.max(0,e.width)}px`}}function g(e,{rect:t,border:n,background:r,label:i}){let a=document.createElement(`div`);Object.assign(a.style,h(t),{background:r,border:n,boxSizing:`border-box`,color:`#111827`,font:`12px/1.3 system-ui, sans-serif`,position:`absolute`});let o=document.createElement(`div`);o.textContent=i,Object.assign(o.style,{background:`rgba(255, 255, 255, 0.92)`,border:`1px solid rgba(17, 24, 39, 0.18)`,borderRadius:`3px`,boxShadow:`0 1px 2px rgba(17, 24, 39, 0.18)`,display:`inline-block`,left:`0`,maxWidth:`360px`,padding:`2px 4px`,position:`absolute`,top:`0`,whiteSpace:`normal`}),a.appendChild(o),e.appendChild(a)}function _(e,t,n){let r=document.createElement(`div`),i=Math.min(t.naturalTop,t.finalTop),a=Math.abs(t.displacement);Object.assign(r.style,{background:`rgba(37, 99, 235, 0.9)`,height:`${a}px`,left:`${n.right+6}px`,position:`absolute`,top:`${i}px`,width:`3px`}),e.appendChild(r)}var v=e(t(),1);function y(e){let t=[];for(let r of e){let e=n(r);e&&t.push({element:e,index:t.length})}return t}var b=class{asideContainer;container;debug;debugController=null;mode;prevHeight=null;repositionTargetSelector;resizeObservers=[];constructor({feedContainerSelector:e,asideContainerSelector:t,repositionTargetSelector:n,observerTargets:r=new Set([`feed`,`aside`]),debug:i,mode:a=`cursor`}){if(!e)throw Error(`feedContainerSelector is required`);if(!t)throw Error(`collidingElementsSelector is required`);if(!n)throw Error(`repositionTargetSelector is required`);let o=document.querySelector(e);
1if(!o)throw Error(`CollisionDetection: No feed container found for "${e}"`);this.container=o;let s=document.querySelector(t);if(!s)throw Error(`CollisionDetection: No aside container found for "${t}"`);this.asideContainer=s,this.debug=d(i),this.debugController=this.debug?new p(this.asideContainer):null,this.mode=a,this.repositionTargetSelector=n;let c=(0,v.default)(()=>{this.updateLayout()},64,{leading:!0,trailing:!0});if(r.has(`feed`)){let e=new ResizeObserver(e=>{e.length!==0&&c()});this.resizeObservers.push(e),e.observe(this.container)}if(r.has(`aside`)){let e=new ResizeObserver(e=>{e.length!==0&&c()});this.resizeObservers.push(e),e.observe(this.asideContainer)}}solveCollisions(e,t,r){let i=[],o=y(t),c=this.debug?f(o):[],l=[],u=0,d=o[u],p=null,h=0;Array.from(e).forEach((e,t)=>{let c=n(e);if(!c)return;let f=a(c);if(d)p||=a(d.element);else{i.push([c,0]),this.debug&&l.push({element:c,index:t,label:m(c),targetBefore:null,targetAfter:null,naturalTop:f.top,naturalBottom:f.bottom,finalTop:f.top,finalBottom:f.bottom,displacement:0,consumedTargets:[]});return}h-=f.marginTop;let g=f.top+h+f.marginTop,_=f.height-f.marginTop,v=d.index,y=[];if(s(p,f,h)){let e=p.bottom-g+r;for(h+=e,g+=e,i.push([c,e]),y.push(d.index);d;)if(d=o[++u],d){if(p=a(d.element),!s(p,f,h))break;let e=p.bottom-g+r;h+=e,g+=e,i[i.length-1][1]+=e,y.push(d.index)}}else i.push([c,0]);if(this.debug){let e=i[i.length-1][1],n=g-e,r=n+_;l.push({element:c,index:t,label:m(c),targetBefore:v,targetAfter:d?.index??null,naturalTop:n,naturalBottom:r,finalTop:n+e,finalBottom:r+e,displacement:e,consumedTargets:y})}});for(let[e,t]of i)e.style.marginTop=`${t}px`;this.debugController?.renderAndLog({targets:c,items:l,feedGap:r})}solveZoneCollisions(e,t,n){let r=[],i=y(t),o=this.createZones(i,n),s=this.debug?f(i):[],c=[],l=y(e);for(let e of l){let t=o[Math.min(e.index,o.length-1)];e.element.style.marginTop=``,Number.isFinite(t.height)?e.element.style.setProperty(`--collision-zone-height`,`${Math.max(0,t.height)}px`):e.element.style.removeProperty(`--collision-zone-height`)}let u=0;for(let e of l){let t=e.element,n=o[Math.min(e.index,o.length-1)],i=a(t),s=i.top+u+i.marginTop,l=Math.max(0,n.top-s);if(u+=l,r.push([t,l]),this.debug){let r=i.height-i.marginTop,a=s,o=a+r,u=Number.isFinite(n.bottom)?Math.round(n.bottom):`end`;c.push({element:t,index:e.index,label:m(t),zone:`zone ${n.index}: ${Math.round(n.top)}-${u}px`,targetBefore:n.startTargetIndex,targetAfter:n.endTargetIndex,naturalTop:a,naturalBottom:o,finalTop:a+l,finalBottom:o+l,displacement:l,consumedTargets:[]})}}for(let[e,t]of r)e.style.marginTop=`${t}px`;this.debugController?.renderAndLog({targets:s,items:c,feedGap:n})}createZones(e,t){let n=a(this.asideContainer),r=[],i=n.top,o=null;for(let n of e){let e=a(n.element);if(e.bottom<i){o=n.index;continue}e.top>i&&r.push({index:r.length,top:i,bottom:e.top,height:e.top-t-i,startTargetIndex:o,endTargetIndex:n.index}),i=Math.max(i,e.bottom+t),o=n.index}return r.push({index:r.length,top:i,bottom:1/0,height:1/0,startTargetIndex:o,endTargetIndex:null}),r}updateLayout(){let e=r(parseFloat(getComputedStyle(this.asideContainer).getPropertyValue(`gap`)),0),t=Array.from(this.asideContainer.children),n=o(Array.from(this.container.querySelectorAll(this.repositionTargetSelector)),this.container);n&&(this.mode===`zones`?this.solveZoneCollisions(t,n,e):this.solveCollisions(t,n,e))}};try{new b({feedContainerSelector:`#feed`,asideContainerSelector:`.aside`,repositionTargetSelector:`[data-two-column-ad-layout="true"]`,debug:`auto`})}catch{console.warn(`Failed to initialize CollisionSolver`)} 2//# sourceMappingURL=index.astro_astro_type_script_index_0_lang.BKiGQS2_.js.map
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.