PageSourceSearch

https://cypherscribe.com/_next/static/chunks/5337-ca8bef33e508d42a.js

js cypherscribe.com collected 2026-10-04 13:31:31 UTC 10,899 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5337],{65337:function(e,t,r){r.d(t,{Z:function(){return f}});var n=r(85893),a=r(34798);function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=[];function n(e){return Array.isArray(e)?e.map(e=>e.text||"").join(" "):""}return e.forEach(e=>{let a=function e(r){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=a;r.href&&(o="".concat(t).concat(a,"/").concat(r.href).replace(/\/+/g,"/"));let s=[],i={title:"",description:[],href:o,children:[]};return Array.isArray(r.content)&&(r.content.forEach(e=>{var t,r,a,c,l,d,h,p,u;switch(e.type){case"heading":i.title&&i.description.length>0&&s.push({title:i.title,description:i.description.join("\n"),href:o,children:[]}),i={title:n(e.content),description:[],href:o,children:[]};break;case"paragraph":{let t=n(e.content);t.trim()&&i.description.push(t);break}case"bulletListItem":case"numberedListItem":{let t=n(e.content);t.trim()&&i.description.push("• ".concat(t));break}case"warning":(null===(r=e.props)||void 0===r?void 0:null===(t=r.content)||void 0===t?void 0:t.trim())&&i.description.push("".concat(e.props.content));break;case"success":(null===(c=e.props)||void 0===c?void 0:null===(a=c.content)||void 0===a?void 0:a.trim())&&i.description.push("".concat(e.props.content));break;case"info":(null===(d=e.props)||void 0===d?void 0:null===(l=d.content)||void 0===l?void 0:l.trim())&&i.description.push("".concat(e.props.content));break;case"error":(null===(p=e.props)||void 0===p?void 0:null===(h=p.content)||void 0===h?void 0:h.trim())&&i.description.push("".concat(e.props.content));break;case"codeBlock":(null===(u=e.props)||void 0===u?void 0:u.code)&&i.description.push("Code (".concat(e.props.language||"text","): ").concat(e.props.code.slice(0,100),"..."))}}),i.title&&i.description.length>0&&s.push({title:i.title,description:i.description.join("\n"),href:o,children:[]})),Array.isArray(r.children)&&r.children.length>0&&r.children.forEach(t=>{let r=e(t,o);r&&(s=[...s,...r])}),s}(e);a&&a.length>0&&r.push(...a)}),r}class s{static getStorageKey(e){return"search_index_".concat(e)}static getTimestampKey(e){return"search_index_timestamp_".concat(e)}static getVersionKey(e){return"search_index_version_".concat(e)}static get(e){try{let t=localStorage.getItem(this.getStorageKey(e));if(!t)return null;return JSON.parse(t)}catch(e){return console.log("Error retrieving search index:",e),null}}static async checkDeploymentVersion(e){try{let t=e.replace(/^https?:\/\//,"").replace(/\/$/,""),r="".concat((0,a.D)(),"/check-search-deployment-version/").concat(t),n=await fetch(r,{method:"GET",headers:{Accept:"application/json","Content-Type":"application/json"}}),o=await n.text();try{return JSON.parse(o).version}catch(e){return console.log("Failed to parse version response:",e),null}}catch(e){return console.log("Version check failed:",e),null}}static async generateSearchIndex(e){try{let t=await fetch("".concat((0,a.D)(),"/tenant-search-data"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userID:e})});t.ok||console.log("Failed to fetch tenant data: ".concat(t.status));let r=await t.json();return r&&r.pages_content||console.log("Invalid tenant data response"),o(r.pages_content)}catch(e){console.log("Failed to generate search index:",e),console.log(e)}}static async generateAndStore(e,t){try{let r=await this.generateSearchIndex(e),n=await this.checkDeploymentVersion(t);n||console.log("Failed to get current version");try{return localStorage.setItem(this.getStorageKey(e),JSON.stringify(r)),localStorage.setItem(this.getTimestampKey(e),Date.now().toString()),localStorage.setItem(this.getVersionKey(e),n.toString()),r}catch(t){"QuotaExceededError"===t.name?(this.clearOldData(),localStorage.setItem(this.getStorageKey(e),JSON.stringify(r)),localStorage.setItem(this.getTimestampKey(e),Date.now().toString()),localStorage.setItem(this.getVersionKey(e),n.toString())):console.log(t)}}catch(e){return console.log("Generate and store failed:",e),null}}static clearOldData(){for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);t.startsWith("search_index_")&&localStorage.removeItem(t)}}static async getOrGenerate(e,t){try{let r=this.get(e),n=localStorage.getItem(this.getVersionKey(e)),a=await this.checkDeploymentVersion(t);if(!r||!n||n!==(null==a?void 0:a.toString()))return await this.generateAndStore(e,t);return r}catch(e){return console.log("getOrGenerate failed:",e),null}}}
1var i=r(69386),c=r(67294),l=r(41664),d=r.n(l),h=r(11163),p=r(49364),u=r(23493),g=r.n(u);let m=(0,c.memo)(e=>{let{open:t,setOpen:r,cusTheme:a,userID:l,prodSubDomainForSearch:u}=e,[m,f]=(0,c.useState)(""),[w,k]=(0,c.useState)(!1),[b,S]=(0,c.useState)(-1),[j,N]=(0,c.useState)(null),[E,_]=(0,c.useState)([]),[I,A]=(0,c.useState)(!1),D=(0,c.useRef)(null),K=(0,h.useRouter)(),O=()=>new Promise(async(e,t)=>{if(u){let t=await s.getOrGenerate(l,window.location.hostname);e(t?{status:!0,data:t}:{status:!1,data:null})}else{var r;let t=await p.Z.getItem("pageIDsWithNames");if(t&&Array.isArray(null==t?void 0:t.pages_hierarchy)&&(null==t?void 0:null===(r=t.pages_hierarchy)||void 0===r?void 0:r.length)>0){let r=o(t.pages_content);A(!0),e({status:!0,data:r})}}}),C=g()((e,t)=>{let{showResults:r,results:n,selectedIndex:a,setSelectedIndex:o,router:s,setOpen:i}=t;if(r)switch(e.key){case"ArrowDown":e.preventDefault(),o(e=>e<n.length-1?e+1:0);break;case"ArrowUp":e.preventDefault(),o(e=>e>0?e-1:n.length-1);break;case"Enter":if(1===n.length&&o(0),-1!==a&&n[a]){let e=n[a].item;e.href&&(s.push("/".concat(u?"docs":"preview","/").concat(e.href)),i(!1))}}},150);(0,c.useEffect)(()=>{(async()=>{try{if(!l){console.warn("No userID provided");return}let e=await O();if(!e.status||!e.data){console.warn("Failed to generate search index");return}let t=new i.Z(e.data,{keys:["title","description"],includeMatches:!0,threshold:.3,minMatchCharLength:2,ignoreLocation:!0,findAllMatches:!0,distance:1e3});N(t)}catch(e){console.error("Error initializing search:",e)}})()},[l,I]),(0,c.useEffect)(()=>{if(!j||!m.trim()){_([]),k(!1);return}_(j.search(m)),k(!0)},[m,j]),(0,c.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"k"===e.key&&(r(!0),e.preventDefault())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r]),(0,c.useEffect)(()=>{let e=e=>{C(e,{showResults:w,results:E,selectedIndex:b,setSelectedIndex:S,router:K,setOpen:r})};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[b,E,w]),(0,c.useEffect)(()=>{if(D.current&&-1!==b){let e=D.current.children[b];e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})}},[b]),(0,c.useEffect)(()=>{let e=e=>{"Escape"===e.key&&r(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r]),(0,c.useEffect)(()=>{t?document.body.style.overflow="hidden":(f(""),A(!1),document.body.style.overflow="auto")},[t]);let L=(e,t)=>{if(!e||!t||!Array.isArray(t)||0===t.length)return e;let r=[],o=0;return t.forEach(t=>{t.indices&&Array.isArray(t.indices)&&0!==t.indices.length&&t.indices.forEach(t=>{let[s,i]=t;s>o&&r.push(e.substring(o,s)),r.push((0,n.jsx)("span",{className:"".concat("dark"===a?"bg-[#f2a20d] bg-opacity-30 text-white":"bg-slate-200 text-black"),children:e.substring(s,i+1)},s)),o=i+1})}),o<e.length&&r.push(e.substring(o)),r};return(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-32 px-4 sm:px-6 md:px-8 transition-opacity duration-300 ease-in-out ".concat(t?"opacity-100":"opacity-0 pointer-events-none"),children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-gray-900/80 backdrop-blur-sm",onClick:()=>r(!1)}),(0,n.jsxs)("div",{className:"relative w-full max-w-2xl ".concat("dark"===a?"bg-black border-2 border-gray-700":"bg-white border border-gray-300"," rounded-lg shadow-xl transition-all duration-300 ease-in-out transform ").concat(w?"xl:max-h-[600px] max-h-[400px]":""," ").concat(t?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),children:[(0,n.jsxs)("div",{className:"flex items-center p-4",children:[(0,n.jsx)(v,{className:"w-5 h-5"}),(0,n.jsx)("input",{ref:e=>e&&e.focus(),type:"text",placeholder:"Search...",className:"flex-grow ml-3 bg-transparent outline-none ".concat("dark"===a?"text-white placeholder-gray-400":"text-black placeholder-gray-700"),value:m,onChange:e=>f(e.target.value),autoFocus:!0})]}),w&&(0,n.jsx)("div",{ref:D,className:"p-4 xl:max-h-[calc(600px-4rem)] max-h-[calc(400px-4rem)] overflow-y-auto ".concat("light"===a?"scrollbar-light":"scrollbar-dark"),children:m.trim().length>4&&0===E.length?(0,n.jsx)(y,{}):E.map((e,t)=>{var o,s,i;return(0,n.jsxs)(d(),{onClick:()=>{e.item.href&&r(!1)},href:"/".concat(u?"docs":"preview","/").concat(null!==(i=e.item.href)&&void 0!==i?i:"#"),className:"flex items-center gap-4 ".concat("dark"===a?"hover:bg-gray-800/70":"hover:bg-gray-100"," cursor-pointer rounded-md ").concat(t!==E.length-1&&"mb-5"," px-3 py-1 ").concat(t===b&&"".concat("dark"===a?"bg-gray-800":"bg-gray-100")),children:[(0,n.jsx)(x,{size:24}),(0,n.jsxs)("div",{className:"flex flex-col h-full justify-center items-center",children:[(0,n.jsx)("p",{className:"text-base font-semibold w-[520px] text-ellipsis overflow-hidden whitespace-nowrap",children:L(e.item.title,(null===(o=e.matches)||void 0===o?void 0:o.filter(e=>"title"===e.key))||[])}),(0,n.jsx)("p",{className:"text-[11px] text-slate-500 dark:text-gray-400 mt-1 w-[520px] text-ellipsis overflow-hidden whitespace-nowrap",children:L(e.item.description,(null===(s=e.matches)||void 0===s?void 0:s.filter(e=>"description"===e.key))||[])})]})]},t)})})]})]})});var f=m;m.displayName="ZoomInInputBoxSearch_Dark";let y=(0,c.memo)(()=>(0,n.jsxs)("div",{className:"flex flex-col justify-center items-center h-full",children:[(0,n.jsx)("p",{className:"text-2xl mb-6",children:"No results found"}),(0,n.jsx)("img",{src:"/_next/static/media/not-found-search-tenant.00a1c934.svg",className:"w-[300px] h-[300px] invert relative -left-1"})]}));y.displayName="NoResultFoundOnSearch";let x=()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","stroke-linejoin":"round",className:"text-gray-500 flex-shrink-0",children:[(0,n.jsx)("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),(0,n.jsx)("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),(0,n.jsx)("path",{d:"M10 9H8"}),(0,n.jsx)("path",{d:"M16 13H8"}),(0,n.jsx)("path",{d:"M16 17H8"})]}),v=()=>(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"text-gray-500 dark:text-gray-400",children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,n.jsx)("path",{d:"m21 21-4.3-4.3"})]})}}]);

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.