PageSourceSearch

https://www.nutrient.io/_astro/CodeBlockPlus.astro_astro_type_script_index_0_lang.0r13OqkF.js

js nutrient.io collected 2026-09-24 21:50:20 UTC 4,103 bytes, 1 lines download raw bytes

1import{i as r,n as f,r as c,t as d}from"./code-block.DHIYH_v7.js";var p=class{constructor(e){this.element=e,this.lineLimit=parseInt(e.dataset.lineLimit||"0"),this.expandButton=e.querySelector(".expand-button"),this.expanderDiv=e.querySelector(".code-block-plus-expander"),this.lineLimit>0&&this.expandButton&&this.expanderDiv&&this.init()}element;lineLimit;expandButton;expanderDiv;maxLines=0;init(){this.expanderDiv.addEventListener("click",i=>{i.target!==this.expandButton&&!this.expandButton.contains(i.target)&&this.toggle()}),this.expandButton.addEventListener("click",()=>{this.toggle()});let e,t=!1;const n=new MutationObserver(i=>{(i.some(o=>Array.from(o.addedNodes).some(l=>{if(l.nodeType===Node.ELEMENT_NODE){const a=l;return a.classList?.contains("expressive-code")||a.querySelector?.(".expressive-code")!==null}return!1}))||this.element.querySelector(".code-block-plus-tab-content .expressive-code"))&&(e&&clearTimeout(e),e=setTimeout(()=>{this.checkLineCounts(),t=!0},200))});n.observe(this.element,{childList:!0,subtree:!0,attributes:!1,characterData:!1}),[100,300,500,1e3,1500].forEach(i=>{setTimeout(()=>{(!t||i>500)&&this.checkLineCounts(),i===1500&&n.disconnect()},i)});const s=this.element.querySelector("nutrient-tabs");s&&(s.querySelectorAll('[role="tab"]').forEach(i=>{i.addEventListener("click",()=>{requestAnimationFrame(()=>{this.checkLineCounts()})})}),s.querySelectorAll(".mobile-dropdown-item").forEach(i=>{i.addEventListener("click",()=>{requestAnimationFrame(()=>{this.checkLineCounts()})})}))}checkLineCounts(){const e=f(this.element);this.maxLines=e,e>this.lineLimit?(this.expanderDiv.style.display="",r(this.element,e),d(this.element,this.lineLimit)):(this.expanderDiv.style.display="none",c(this.element))}toggle(){const e=this.element.classList.contains("expanded");e?(this.element.classList.remove("expanded"),this.expandButton.setAttribute("aria-expanded","false"),d(this.element,this.lineLimit)):(this.element.classList.add("expanded"),this.expandButton.setAttribute("aria-expanded","true"),c(this.element)),r(this.element,this.maxLines),this.announceStateChange(!e)}announceStateChange(e){let t=document.getElementById("code-block-announcer");t||(t=document.createElement("div"),t.id="code-block-announcer",t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.className="sr-only",document.body.appendChild(t)),t.textContent=e?`Code block expanded. Showing all ${this.maxLines} lines.`:`Code block collapsed. Showing ${this.lineLimit} lines.`,setTimeout(()=>{t.textContent=""},1e3)}};function u(){document.querySelectorAll(".code-block-plus[data-line-limit]").forEach(e=>{e.dataset.controllerInitialized||(e.dataset.controllerInitialized="true",new p(e))})}document.addEventListener("DOMContentLoaded",u);document.addEventListener("api-fragment-loaded",u);function L(e){let t=!1,n=!1,s,i;e.addEventListener("mousedown",o=>{o.button===0&&(t=!0,n=!1,e.style.cursor="grabbing",s=o.pageX-e.offsetLeft,i=e.scrollLeft,o.preventDefault())}),e.addEventListener("mouseleave",()=>{t=!1,e.style.cursor=""}),e.addEventListener("mouseup",o=>{const l=t;if(t=!1,e.style.cursor="",l&&!n){const a=o.target.closest('[role="tab"]');a&&a.click()}}),e.addEventListener("mousemove",o=>{if(!t)return;const l=o.pageX-e.offsetLeft;if(Math.abs(l-s)>3){n=!0;const a=(l-s)*1.5;e.scrollLeft=i-a}})}function h(e){const t=e.querySelector('[aria-selected="true"]');if(!t)return;const n=t.getBoundingClientRect(),s=e.getBoundingClientRect();n.left<s.left?e.scrollLeft-=s.left-n.left+16:n.right>s.right&&(e.scrollLeft+=n.right-s.right+16)}function m(){const e=document.querySelectorAll(".code-block-plus .tablist-wrapper ul");e.forEach(t=>{t.dataset.dragScrollInitialized||(t.dataset.dragScrollInitialized="true",L(t))}),requestAnimationFrame(()=>{e.forEach(t=>{h(t)})})}document.addEventListener("DOMContentLoaded",()=>{m(),document.addEventListener("nutrient-tabs:change",e=>{const t=e.target.closest(".code-block-plus");if(!t)return;const n=t.querySelector(".tablist-wrapper ul");n&&requestAnimationFrame(()=>{h(n)})})});document.addEventListener("api-fragment-loaded",m);

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.