import{r as y,o as E,g as B}from"./chunk-Ci5y0mdV.js";const r=document.getElementById("grid"),h=document.getElementById("search"),i=document.getElementById("empty"),d=document.getElementById("no-match");let c=[],v="";function a(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function f(t){const n=t.path==="/"?"":t.path;return`${t.ensName}${n}`}function H(t,n){if(!n)return!0;const e=n.toLowerCase();return f(t).toLowerCase().includes(e)||(t.title?.toLowerCase().includes(e)??!1)||(t.description?.toLowerCase().includes(e)??!1)}const g='<span class="favicon fallback" aria-hidden="true"><svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M16 4 L8 17 L16 13 L24 17 Z" fill="#10b981"/><path d="M16 28 L8 19 L16 15 L24 19 Z" fill="#059669"/></svg></span>';function m(t){t.outerHTML=g}function M(t){const n=t.title?.trim(),e=n?`<div class="title" title="${a(n)}">${a(n)}</div>`:'<div class="title untitled">Untitled</div>',o=t.favicon?`<img class="favicon" src="${a(t.favicon)}" alt="" />`:g,s=t.description?.trim(),l=s?`<div class="desc">${a(s)}</div>`:"",L=t.path.startsWith("/")?t.path:`/${t.path}`,$=`http://${t.ensName}${L}`,k=f(t),u=t.path==="/"?"":t.path,w=`<span class="ens-host">${a(t.ensName)}</span>${u?`<span class="ens-path">${a(u)}</span>`:""}`;return`
    <a class="card" href="${a($)}" data-ens="${a(t.ensName)}" data-path="${a(t.path)}">
      <button class="remove" type="button" aria-label="remove bookmark" title="Remove bookmark">
        <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
          <path d="M3 3 L13 13 M13 3 L3 13"/>
        </svg>
      </button>
      <div class="card-head">
        ${o}
        ${e}
      </div>
      <div class="ens" title="${a(k)}">${w}</div>
      ${l}
    </a>
  `}function p(){const t=c.filter(e=>H(e,v));if(c.length===0){r.innerHTML="",i.hidden=!1,d.hidden=!0;return}if(t.length===0){r.innerHTML="",i.hidden=!0,d.hidden=!1;return}i.hidden=!0,d.hidden=!0,r.innerHTML=t.map(M).join(""),r.querySelectorAll("img.favicon").forEach(e=>{if(e.complete&&e.naturalWidth===0){m(e);return}e.addEventListener("error",()=>m(e),{once:!0})})}r.addEventListener("click",async t=>{const e=t.target.closest(".remove");if(!e)return;t.preventDefault(),t.stopPropagation();const o=e.closest(".card"),s=o?.dataset.ens,l=o?.dataset.path;!s||l==null||await y(s,l)});h.addEventListener("input",()=>{v=h.value.trim(),p()});E(t=>{c=t,p()});(async()=>(c=await B(),p()))();
//# sourceMappingURL=bookmarks-CDXJzK_x.js.map
