const w="modulepreload",y=function(f){return"/documentation-site/"+f},g={},E=function(m,c,l){let h=Promise.resolve();if(c&&c.length>0){let o=function(n){return Promise.all(n.map(a=>Promise.resolve(a).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};document.getElementsByTagName("link");const t=document.querySelector("meta[property=csp-nonce]"),u=t?.nonce||t?.getAttribute("nonce");h=o(c.map(n=>{if(n=y(n),n in g)return;g[n]=!0;const a=n.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${s}`))return;const e=document.createElement("link");if(e.rel=a?"stylesheet":w,a||(e.as="script"),e.crossOrigin="",e.href=n,u&&e.setAttribute("nonce",u),document.head.appendChild(e),a)return new Promise((i,r)=>{e.addEventListener("load",i),e.addEventListener("error",()=>r(new Error(`Unable to preload CSS for ${n}`)))})}))}function d(o){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=o,window.dispatchEvent(t),!t.defaultPrevented)throw o}return h.then(o=>{for(const t of o||[])t.status==="rejected"&&d(t.reason);return m().catch(d)})};class S extends HTMLElement{constructor(){super();const m=this.querySelector("button[data-open-modal]"),c=this.querySelector("button[data-close-modal]"),l=this.querySelector("dialog"),h=this.querySelector(".dialog-frame"),d=e=>{("href"in(e.target||{})||document.body.contains(e.target)&&!h.contains(e.target))&&t()},o=e=>{l.showModal(),document.body.toggleAttribute("data-search-modal-open",!0),this.querySelector("input")?.focus(),e?.stopPropagation(),window.addEventListener("click",d)},t=()=>l.close();m.addEventListener("click",o),m.disabled=!1,c.addEventListener("click",t),l.addEventListener("close",()=>{document.body.toggleAttribute("data-search-modal-open",!1),window.removeEventListener("click",d)}),window.addEventListener("keydown",e=>{(e.metaKey===!0||e.ctrlKey===!0)&&e.key==="k"&&(l.open?t():o(),e.preventDefault())});let u={};try{u=JSON.parse(this.dataset.translations||"{}")}catch{}const s=this.dataset.stripTrailingSlash!==void 0?e=>e.replace(/(.)\/(#.*)?$/,"$1$2"):e=>e;window.addEventListener("DOMContentLoaded",()=>{(window.requestIdleCallback||(i=>setTimeout(i,1)))(async()=>{const{PagefindUI:i}=await E(async()=>{const{PagefindUI:r}=await import("./ui-core.DPhtcP_e.js");return{PagefindUI:r}},[]);new i({element:"#starlight__search",baseUrl:"/documentation-site/",bundlePath:"/documentation-site/".replace(/\/$/,"")+"/pagefind/",showImages:!1,translations:u,showSubResults:!0,processResult:r=>{r.url=s(r.url),r.sub_results=r.sub_results.map(p=>(p.url=s(p.url),p))}})})})}}customElements.define("site-search",S);export{E as _};
