PageSourceSearch

https://www.astrumstudio.top/_next/static/chunks/3454.edbb98953f012000.js

js astrumstudio.top collected 2026-10-01 00:23:57 UTC 6,970 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3454,27063],{3454:(e,t,r)=>{r.r(t),r.d(t,{default:()=>g});var a=r(37876),l=r(27063),s=r(22507),n=r(95498),c=r(89852),i=r.n(c),o=r(88842),d=r.n(o),u=r(33035),x=r(89099),m=r(14232),h=r(29979);let f=[{key:"↑ ↓",action:"选择"},{key:"Enter",action:"跳转"},{key:"Esc",action:"关闭"}];function g(e){let{cRef:t}=e,[r,n]=(0,m.useState)([]),[c,o]=(0,m.useState)(!1),[u,g]=(0,m.useState)(0),[y,v]=(0,m.useState)(null),[j,k]=(0,m.useState)(0),[w,N]=(0,m.useState)(0),[C,A]=(0,m.useState)(0),[E,S]=(0,m.useState)(0),[I,_]=(0,m.useState)(!1),[P,T]=(0,m.useState)(!1),L=(0,m.useRef)(null),D=(0,x.useRouter)();(0,h.vC)("ctrl+k",e=>{e.preventDefault(),o(!0)}),(0,h.vC)("down",e=>{P&&(e.preventDefault(),E<r.length-1&&S(E+1))},{enableOnFormTags:!0}),(0,h.vC)("up",e=>{P&&(e.preventDefault(),E>0&&S(E-1))},{enableOnFormTags:!0}),(0,h.vC)("esc",e=>{P&&(e.preventDefault(),o(!1))},{enableOnFormTags:!0}),(0,h.vC)("enter",e=>{P&&r.length>0&&F(O)},{enableOnFormTags:!0});let F=()=>{if(r.length>0){let e=r[E];window.location.href="".concat((0,s.CQ)("SUB_PATH",""),"/").concat(e.slug||e.objectID)}};(0,m.useEffect)(()=>{o(!1)},[D]),(0,m.useEffect)(()=>{c?setTimeout(()=>{var e;null==(e=L.current)||e.focus()},100):(S(0),v(""),n([]),A(0),k(0),N(0),L.current&&(L.current.value=""))},[c]),(0,m.useImperativeHandle)(t,()=>({openSearch:()=>{o(!0)}}));let O=i()((0,s.CQ)("ALGOLIA_APP_ID"),(0,s.CQ)("ALGOLIA_SEARCH_ONLY_APP_KEY")).initIndex((0,s.CQ)("ALGOLIA_INDEX")),R=async(e,t)=>{if(v(e),g(t),n([]),A(0),k(0),N(0),S(0),e&&""!==e){_(!0);try{let{hits:r,nbHits:a,nbPages:s,processingTimeMS:c}=await O.search(e,{page:t,hitsPerPage:10});A(c),k(s),N(a),n(r),_(!1);let i=document.getElementById("search-wrapper").getElementsByClassName("replace");setTimeout(()=>{(0,l.default)({doms:i,search:e,target:{element:"span",className:"font-bold border-b border-dashed"}})},200)}catch(e){console.error("Algolia search error:",e)}}},H=(0,m.useRef)(d()(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;R(e,t)},1e3)),Q=(0,m.useRef)(null),B=()=>{o(!1)};return(0,s.CQ)("ALGOLIA_APP_ID")?(0,a.jsxs)("div",{id:"search-wrapper",className:"".concat(c?"opacity-100":"invisible opacity-0 pointer-events-none"," z-30 fixed h-screen w-screen left-0 top-0 sm:mt-[10vh] flex items-start justify-center mt-0"),children:[(0,a.jsxs)("div",{className:"".concat(c?"opacity-100":"invisible opacity-0 translate-y-10"," max-h-[80vh] flex flex-col justify-between w-full min-h-[10rem] h-full md:h-fit max-w-xl dark:bg-hexo-black-gray dark:border-gray-800 bg-white dark:bg- p-5 rounded-lg z-50 shadow border hover:border-blue-600 duration-300 transition-all "),children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("div",{className:"text-2xl text-blue-600 dark:text-yellow-600 font-bold",children:"搜索"}),(0,a.jsx)("div",{children:(0,a.jsx)("i",{className:"text-gray-600 fa-solid fa-xmark p-1 cursor-pointer hover:text-blue-600",onClick:B})})]}),(0,a.jsx)("input",{type:"text",placeholder:"在这里输入搜索关键词...",onChange:e=>(e=>{let t=e.target.value;Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{H.current(t)},800)})(e),onFocus:()=>T(!0),onBlur:()=>T(!1),className:"text-black dark:text-gray-200 bg-gray-50 dark:bg-gray-600 outline-blue-500 w-full px-4 my-2 py-1 mb-4 border rounded-md",ref:L}),(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(p,{})}),0===r.length&&y&&!I&&(0,a.jsx)("div",{children:(0,a.jsxs)("p",{className:" text-slate-600 text-center my-4 text-base",children:[" ","无法找到相关结果",(0,a.jsxs)("span",{className:"font-semibold",children:['"',y,'"']})]})}),(0,a.jsx)("ul",{className:"flex-1 overflow-auto",children:r.map((e,t)=>(0,a.jsx)("li",{onMouseEnter:()=>S(t),onClick:()=>F(t),className:"cursor-pointer replace my-2 p-2 duration-100 \n              rounded-lg\n              ".concat(E===t?"bg-blue-600 dark:bg-yellow-600":""),children:(0,a.jsx)("a",{className:"".concat(E===t?" text-white":" text-black dark:text-gray-300 "),children:e.title})},e.objectID))}),(0,a.jsx)(b,{totalPage:j,page:u,switchPage:e=>{H.current(y,e)}}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-2 sm:text-sm text-xs dar
1k:text-gray-300",children:[0===w&&(0,a.jsx)("div",{className:"flex items-center",children:f.map((e,t)=>(0,a.jsxs)(m.Fragment,{children:[(0,a.jsx)("div",{className:"border-gray-300 dark:text-gray-300 text-gray-600 px-2 rounded border inline-block",children:e.key}),(0,a.jsx)("span",{className:"ml-2 mr-4  text-gray-600 dark:text-gray-300",children:e.action})]},t))}),(0,a.jsx)("div",{children:w>0&&(0,a.jsxs)("p",{children:["共搜索到 ",w," 条结果,用时 ",C," 毫秒"]})}),(0,a.jsx)("div",{className:"text-gray-600 dark:text-gray-300  text-right",children:(0,a.jsxs)("span",{children:[(0,a.jsx)("i",{className:"fa-brands fa-algolia"})," Algolia 提供搜索服务"]})})]})]}),(0,a.jsx)("div",{onClick:B,className:"z-30 fixed top-0 left-0 w-full h-full flex items-center justify-center glassmorphism"})]}):(0,a.jsx)(a.Fragment,{})}function p(){let{tagOptions:e}=(0,n.PC)(),t=null==e?void 0:e.slice(0,10);return(0,a.jsx)("div",{id:"tags-group",className:"dark:border-gray-700 space-y-2",children:null==t?void 0:t.map((e,t)=>(0,a.jsx)(u.A,{passHref:!0,href:"/tag/".concat(encodeURIComponent(e.name)),className:"cursor-pointer inline-block whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex items-center text-black dark:text-gray-300 hover:bg-blue-600 dark:hover:bg-yellow-600 hover:scale-110 hover:text-white rounded-lg px-2 py-0.5 duration-150 transition-all",children:[(0,a.jsxs)("div",{className:"text-lg",children:[e.name," "]}),e.count?(0,a.jsx)("sup",{className:"relative ml-1",children:e.count}):(0,a.jsx)(a.Fragment,{})]})},t))})}function b(e){let{totalPage:t,page:r,switchPage:l}=e;return t<=0?(0,a.jsx)(a.Fragment,{}):(0,a.jsx)("div",{className:"flex space-x-1 w-full justify-center py-1",children:Array.from({length:t},(e,t)=>{let s=r===t?"font-bold text-white bg-blue-600 dark:bg-yellow-600 rounded":"hover:text-blue-600 hover:font-bold dark:text-gray-300";return(0,a.jsx)("div",{onClick:()=>l(t),className:"text-center cursor-pointer w-6 h-6 ".concat(s),children:t+1},t)})})}},27063:(e,t,r)=>{r.r(t),r.d(t,{default:()=>s});var a=r(14969);let l=null;async function s(e){let{doms:t,search:r,target:s}=e;if(!t||!r||!s)return;let n=String(r).trim();if(n)try{await (!l&&(l=(0,a.loadExternalResource)("https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js","js")),l),await new Promise(e=>{let t=()=>e();if("function"!=typeof window.requestIdleCallback)return void setTimeout(t,0);window.requestIdleCallback(t,{timeout:800})});let e=window.Mark;if(!e)return;let r=RegExp(String(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gim"),c=t=>{new e(t).markRegExp(r,s)};t instanceof HTMLCollection?Array.from(t).forEach(c):c(t)}catch(e){console.error("Search highlight failed:",e)}}}}]);

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.