(function() { const t=document.createElement("link").relList; if(t&&t.supports&&t.supports("modulepreload"))return; for(const n of document.querySelectorAll('link[rel="modulepreload"]'))o(n); new MutationObserver(n=> { for(const s of n)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a) } ).observe(document, { childList:!0,subtree:!0 } ); function r(n) { const s={}; return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s } function o(n) { if(n.ep)return; n.ep=!0; const s=r(n); fetch(n.href,s) } } )(); const h=[ { label:"Name (A-Z)",value:"name",direction:"asc" } , { label:"Name (Z-A)",value:"name",direction:"desc" } , { label:"Author (A-Z)",value:"author",direction:"asc" } , { label:"Author (Z-A)",value:"author",direction:"desc" } ],g=new URLSearchParams(window.location.search); document.body.dataset.theme=g.get("theme")??"light"; async function m() { const e=await fetch("https://plugins-list.girafic.net/penpot-plugins.json"); if(!e.ok)throw new Error("Failed to fetch plugins data"); return e.json() } function f() { const e=document.createElement("div"); return e.className="loading-state",e.innerHTML=` Loading plugins... `,e } function v(e) { const t=document.createElement("div"); t.className="search-container",t.innerHTML=`
`,e.appendChild(t); const r=t.querySelector("#searchInput"),o=t.querySelector("#sortSelect"),n=t.querySelector("#searchClear"); if(r&&o&&n) { const s=()=> { let a=L(r.value); const[i,c]=o.value.split(","); i&&c&&(a=y(a,i,c)),w(a),n.style.display=r.value?"flex":"none" }; r.addEventListener("input",s),o.addEventListener("change",s),n.addEventListener("click",()=> { r.value="",r.focus(),s() } ),n.style.display="none" } } function y(e,t,r) { return[...e].sort((o,n)=> { const s=o[t].toString().toLowerCase(),a=n[t].toString().toLowerCase(); return r==="asc"?s.localeCompare(a):a.localeCompare(s) } ) } function L(e) { const t=document.querySelector("body"); if(!(t!=null&&t.dataset.plugins))return[]; const r=JSON.parse(t.dataset.plugins),o=e.toLowerCase().trim(); return o===""?r:r.filter(n=>n.name.toLowerCase().includes(o)||n.author.toLowerCase().includes(o)||n.description.toLowerCase().includes(o)) } function l(e) { return` ${e.name}

${e.name}

by

${e.description}

Install Details
` } function S(e) { const t=document.querySelector("#searchInput"),r=document.querySelector("#sortSelect"); t&&r&&(t.value=e,r.value="",t.dispatchEvent(new Event("input"))) } function u(e,t) { const r=e.querySelector(".author-button"); r&&r.addEventListener("click",()=> { S(t.author) } ) } function d(e,t,r) { return`
${e===t?`Showing all $ { t } plugins`:`Showing $ { e } of $ { t } plugins`}
Last updated: ${new Date(r).toLocaleString()}
` } function w(e) { const t=document.querySelector(".plugins-list"),r=document.querySelector("body"); if(!t||!(r!=null&&r.dataset.plugins))return; const o=JSON.parse(r.dataset.plugins),n=new Date().toISOString(); if(t.innerHTML="",e.length===0) { const a=document.createElement("div"); a.className="no-results",a.textContent="No plugins found",t.appendChild(a) } else e.forEach(a=> { const i=document.createElement("div"); i.className="plugin-item",i.innerHTML=l(a),u(i,a),t.appendChild(i) } ); const s=document.createElement("div"); s.innerHTML=d(e.length,o.length,n),t.appendChild(s) } async function p() { const e=document.querySelector("body"); if(!e)return; e.innerHTML="",v(e); const t=document.createElement("div"); t.className="plugins-list"; const r=f(); t.appendChild(r),e.appendChild(t); try { const o=await m(), { plugins:n,generated_at:s } =o; r.remove(),n.forEach(i=> { const c=document.createElement("div"); c.className="plugin-item",c.innerHTML=l(i),u(c,i),t.appendChild(c) } ); const a=document.createElement("div"); a.innerHTML=d(n.length,o.plugins.length,s),t.appendChild(a),e.dataset.plugins=JSON.stringify(n) } catch { r.innerHTML=`
Failed to load plugins
`; const n=r.querySelector(".retry-button"); n&&n.addEventListener("click",()=> { p() } ) } } p(); window.addEventListener("message",async e=> { e.data.type==="theme"&&(document.body.dataset.theme=e.data.content) } );