1document.addEventListener("DOMContentLoaded",function(){class e extends HTMLElement{constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.iframe=null,this.messageHandler=this.handleMessage.bind(this)}connectedCallback(){var e=this.getAttribute("src"),t=this.getAttribute("embed-id"),i=this.getAttribute("aspect-ratio");e?(this.render(e,t,i),window.addEventListener("message",this.messageHandler)):this.showError("No source URL provided")}disconnectedCallback(){window.removeEventListener("message",this.messageHandler)}handleMessage(e){this.iframe&&e.source===this.iframe.contentWindow&&e.data&&e.data.data&&void 0!==e.data.data.height&&(e=e.data.data.height,this.adjustHeight(e))}adjustHeight(e){this.iframe&&0<e&&(this.iframe.style.height=(e=e+2)+"px",this.style.minHeight=e+"px",this.dispatchEvent(new CustomEvent("ai2html-resized",{detail:{height:e},bubbles:!0})))}render(e,t,i=!1){this.shadow.innerHTML=` 2 <style> 3 :host { 4 display: block; 5 width: 100%; 6 min-height: 400px; 7 transition: min-height 0.3s ease; 8 } 9 10 iframe { 11 width: 100%; 12 border: none; 13 overflow: hidden; 14 margin: 0; 15 padding: 0; 16 height: ${i?"100%":"400px"}; 17 ${i?`aspect-ratio: ${i};`:""} 18 transition: height 0.3s ease; 19 } 20 21 .error-container { 22 display: flex; 23 flex-direction: column; 24 align-items: center; 25 justify-content: center; 26 min-height: 400px; 27 background: #fff3cd; 28 border: 1px solid #ffeaa7; 29 border-radius: 4px; 30 padding: 20px; 31 } 32 33 .error-message { 34 color: #856404; 35 font-size: 16px; 36 text-align: center; 37 } 38 </style> 39 <iframe 40 src="${e}" 41 id="ai2html-iframe-${t}" 42 scrolling="no" 43 marginheight="0" 44 frameborder="0" 45 loading="lazy"> 46 </iframe> 47 `,this.iframe=this.shadow.querySelector("iframe"),this.setupIframeHandling()}setupIframeHandling(){this.iframe&&(this.iframe.addEventListener("load",()=>{var e=this.querySelector(".ai2html-loading");e&&(e.style.display="none"),this.requestHeight()}),this.iframe.addEventListener("error",()=>{this.showError("Failed to load content")}))}requestHeight(){if(this.iframe&&this.iframe.contentWindow)try{this.iframe.contentWindow.postMessage({action:"requestHeight"},"*")}catch(e){console.log("Could not request height from iframe:",e)}}showError(e){this.shadow.innerHTML=` 48 <style> 49 .error-container { 50 display: flex; 51 flex-direction: column; 52 align-items: center; 53 justify-content: center; 54 min-height: 400px; 55 background: #fff3cd; 56 border: 1px solid #ffeaa7; 57 border-radius: 4px; 58 padding: 20px; 59 } 60 61 .error-message { 62 color: #856404; 63 font-size: 16px; 64 text-align: center; 65 } 66 </style> 67 <div class="error-container"> 68 <div class="error-message">${e}</div> 69 </div> 70 `}refresh(){var e;this.iframe&&(e=this.iframe.src,this.iframe.src=e+(e.includes("?")?"&":"?")+"reload=true")}updateHeight(){this.requestHeight()}}function t(){document.querySelectorAll("ai2html-embed").forEach(function(e){var t=e.getBoundingClientRect();window.scrollY+window.innerHeight>t.top+window.scrollY&&window.scrollY<t.bottom+window.scrollY&&e.hasAttribute("data-needs-refresh")&&(e.refresh(),e.removeAttribute("data-needs-refresh"))})}customElements.get("ai2html-embed")||customElements.define("ai2html-embed",e),t(),window.addEventListener("resize",t),window.addEventListener("resize",function(){document.querySelectorAll("ai2html-embed").forEach(function(e){"function"==typeof e.updateHeight&&e.updateHeight()})}),window.addEventListener("scroll",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.