(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))f(e);new MutationObserver(e=>{for(const n of e)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&f(a)}).observe(document,{childList:!0,subtree:!0});function h(e){const n={};return e.integrity&&(n.integrity=e.integrity),e.referrerPolicy&&(n.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?n.credentials="include":e.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function f(e){if(e.ep)return;e.ep=!0;const n=h(e);fetch(e.href,n)}})();function M(g,t,h,f){if(!t||t.length===0)return;let e=0,n=!1,a=!1,b=null;f.forEach((s,l)=>{s.addEventListener("click",()=>{const m=s.getAttribute("set-current-index");m!==null&&(e=parseInt(m,10))})}),t[0].scrollIntoView({behavior:"smooth",block:"start"}),g.addEventListener("wheel",s=>{if(s.preventDefault(),n)return;n=!0;const l=s.deltaY;l>0?e<t.length-1?e++:a||(h.scrollIntoView({behavior:"smooth",block:"start"}),a=!0):l<0&&(a?(t[e].scrollIntoView({behavior:"smooth",block:"start"}),a=!1):e>0&&e--),!a&&e>=0&&e<t.length&&t[e].scrollIntoView({behavior:"smooth",block:"start"}),b&&clearTimeout(b),b=setTimeout(()=>{n=!1},400)},{passive:!1})}function D(){const g=[{name:"陨石坑",desc:"一个安静的角落",img:"/images/doge.png",link:"blog.starpixel.club"},{name:"状态监控",desc:"24h多节点展示站点健康度",text:'<i class="fa-solid fa-signal"></i>',link:"status.starpixel.club"},{name:"实验室",desc:"开发Demo初体验",text:'<i class="fa-solid fa-flask"></i>',link:"lab.starpixel.club",disabled:!0},{name:"建议反馈",desc:"提供宝贵意见",text:'<i class="fa-solid fa-comment"></i>',link:"feedback.starpixel.club",disabled:!0}],t=document.querySelector(".sites-section .content");if(!t)return;t.innerHTML="";function h(c){const r=document.createElement("div");r.className="carousel-container";const p=document.createElement("div");p.className="carousel";const x=document.createElement("button");x.className="carousel-arrow prev",x.innerHTML='<i class="fa-solid fa-angle-left"></i>',x.setAttribute("aria-label","上一个站点");const w=document.createElement("div");w.className="carousel-viewport";const C=document.createElement("div");C.className="carousel-track",c.forEach((i,N)=>{const u=document.createElement("div");u.className=`site-card ${i.disabled?"disabled":""}`,u.dataset.index=N;const E=document.createElement("div");if(E.className="card-image",i.text){const o=document.createElement("span");o.className="card-image-text",o.innerHTML=i.text,E.appendChild(o)}else if(i.img){const o=document.createElement("img");o.src=i.img,o.alt=i.name,E.appendChild(o)}else{const o=document.createElement("span");o.className="card-image-text",o.innerHTML="图片丢失",E.appendChild(o)}const T=document.createElement("div");T.className="card-name",T.textContent=i.name;const S=document.createElement("div");S.className="card-desc",S.textContent=i.desc;const y=document.createElement("div");if(y.className="card-link",i.disabled){const o=document.createElement("span");o.className="disabled",o.innerHTML='<i class="fa-solid fa-lock"></i>'+i.link,y.appendChild(o)}else{const o=document.createElement("a");let L=i.link;!L.startsWith("http://")&&!L.startsWith("https://")&&(L="https://"+L),o.href=L,o.target="_blank",o.rel="noopener noreferrer",o.innerHTML='<i class="fa-solid fa-link"></i>'+i.link,y.appendChild(o)}u.appendChild(E),u.appendChild(T),u.appendChild(S),u.appendChild(y),C.appendChild(u)}),w.appendChild(C);const v=document.createElement("button");v.className="carousel-arrow next",v.innerHTML='<i class="fa-thin fa-angle-right"></i>',v.setAttribute("aria-label","下一个站点"),p.appendChild(x),p.appendChild(w),p.appendChild(v);const k=document.createElement("div");return k.className="carousel-dots",c.forEach((i,N)=>{const u=document.createElement("span");u.className="dot",u.dataset.index=N,k.appendChild(u)}),r.appendChild(p),r.appendChild(k),{container:r,track:C,prevBtn:x,nextBtn:v,dotsDiv:k,total:c.length}}const{container:f,track:e,prevBtn:n,nextBtn:a,dotsDiv:b,total:s}=h(g);t.appendChild(f);let l=0;const m=Array.from(b.children);function d(c){c<0&&(c=0),c>=s&&(c=s-1),l=c,e.style.transform=`translateX(-${l*100}%)`,m.forEach((r,p)=>{p===l?r.classList.add("active"):r.classList.remove("active")}),n.disabled=l===0,a.disabled=l===s-1}n.addEventListener("click",()=>{d(l-1)}),a.addEventListener("click",()=>{d(l+1)}),b.addEventListener("click",c=>{const r=c.target.closest(".dot");if(!r)return;const p=r.dataset.index;p!==void 0&&d(parseInt(p,10))}),d(0)}const q=()=>{window.addEventListener("error",function(g){alert(`很抱歉 页面发生错误 详情请查看控制台
恳请您将错误信息截图并反馈给我们，以便我们尽快修复问题`),I(Date.now())})},A=()=>{console.log("%cStarpixel%cv0.1.0-260305-dev","padding: 2px 6px; border-radius: 3px 0 0 3px; color: #fff; background: rgb(247, 147, 31); font-weight: bold;","padding: 2px 6px; border-radius: 0 3px 3px 0; color: #fff; background: rgb(3, 220, 107); font-weight: bold;"),console.log("%cScroll Utils%cLoaded","padding: 2px 6px; border-radius: 3px 0 0 3px; color: #fff; background: #13a2e7; font-weight: bold;","padding: 2px 6px; border-radius: 0 3px 3px 0; color: #fff; background: rgb(3, 220, 107); font-weight: bold;"),console.log("%cStarpixel Utils%cv0.1.0-dev","padding: 2px 6px; border-radius: 3px 0 0 3px; color: #fff; background: rgb(139, 104, 200); font-weight: bold;","padding: 2px 6px; border-radius: 0 3px 3px 0; color: #fff; background: rgb(3, 220, 107); font-weight: bold;")},I=g=>{const t=document.getElementById("load");if(t){const h=t.querySelector(".load-fill"),f=t.querySelector(".load-percent");let e=0,n=null;const a=m=>{e=Math.max(0,Math.min(100,Math.round(m))),h&&(h.style.width=e+"%"),f&&(f.textContent=e+"%");const d=t.querySelector(".bar");d&&d.setAttribute("aria-valuenow",String(e))},b=()=>{t.classList.add("is-open");const m=setTimeout(()=>{t.classList.add("removed"),t.parentNode&&t.parentNode.removeChild(t)},950),d=r=>{r.target.classList&&r.target.classList.contains("load-panel")&&(clearTimeout(m),t.classList.add("removed"),t.parentNode&&t.parentNode.removeChild(t))};t.querySelectorAll(".load-panel").forEach(r=>r.addEventListener("transitionend",d,{once:!0}))},s=()=>{if(e>=100)return;const m=e<80?Math.random()*6+2:Math.random()*1.6+.2;a(e+m);const d=e<80?180+Math.random()*220:400+Math.random()*400;n=setTimeout(s,d)},l=()=>{n&&clearTimeout(n),a(100),setTimeout(b,400)};s(),document.readyState==="complete"?(setTimeout(l,200),document.getElementById("ping").textContent=Date.now()-g+"ms"):window.addEventListener("load",()=>{setTimeout(l,200),document.getElementById("ping").textContent=Date.now()-g+"ms"})}},B=()=>{q(),document.title="星像素 - Starpixel",document.getElementById("version").textContent="0.1.0-260305-dev",M(document.querySelector(".container"),document.querySelectorAll(".section"),document.getElementById("foot"),document.querySelectorAll("a[set-current-index]")),D(),A(),I(_time)};B();
