PageSourceSearch

https://marketing-production.aiven-prod.workers.dev/remix-chunks/blog-helpers-nJCTQ6fL.js

js marketing-production.aiven-prod.workers.dev collected 2026-10-03 08:09:43 UTC 3,912 bytes, 13 lines download raw bytes

1import{r as c,j as s}from"./typography-D-NzwYeN.js";import{u as h}from"./chunk-4ZMWKKQ3-B958uZRs.js";import{H as p}from"./honeypot-input-DcStLjrU.js";import{b,I as g}from"./button-CNOHhfws.js";import{d as S,f,l as w,q as y,s as x}from"./misc-DmjZsh7Y.js";import{a as m,b as v}from"./site-CwZyFWBf.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"2b0fe3811bebdbcabe8fab1fe85d8931350a430d"}}catch{}})();try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="150e7447-3055-41ef-b054-0635297565fb",e._sentryDebugIdIdentifier="sentry-dbid-150e7447-3055-41ef-b054-0635297565fb")})()}catch{}const I=[{value:"recent",label:"Most recent"},{value:"relevant",label:"Most relevant"}];function T(e,t){if(e.date&&t.date){if(new Date(e.date)<new Date(t.date))return 1;if(new Date(e.date)>new Date(t.date))return-1}return 0}function R(e){const t=e.authors?e.authors.map(r=>({name:f(r?.name),shortName:f(r?.shortName),imageBuilder:S(r?.image,{alt:w(e.mainImage,{fallback:f(r?.name)})})})):[];return{id:e._id,title:f(e.title),date:e.publishedAt,slug:e.slug.current,description:e.subtitle,authors:t,categories:e.categories}}function _(e,t){return e?e.filter(r=>r.categories?.some(a=>a.title&&a.title===t)).slice(0,3):[]}function k({sort:e,setSort:t}){const r=a=>{t(a),v({object:"sort",action:"order",value:a})};return s.jsxs("div",{className:"relative",children:[s.jsx("select",{className:`
2					border-stroke m-0 w-full appearance-none rounded-sm
3					border bg-transparent px-5 py-4 text-sm
4					font-medium
5					lg:w-layout7
6				`,onChange:a=>r(a.target.value),value:e,children:I.map(a=>s.jsx("option",{value:a.value,className:"capitalize",children:y(a.label)},a.value))}),s.jsx(g,{name:"chevron-down",color:"arrow",className:"pointer-events-none absolute top-[20px] right-5 z-1"})]})}function B({queryValue:e,onSearchChange:t,onSearchEnter:r,onHoneyPotChange:a}){const[n,o]=c.useState(""),l=i=>{m(i)},d=i=>{const u=i.currentTarget.value;o(u),a?.(u)};return s.jsx("div",{role:"search",className:`
7				flex flex-col gap-5
8				md:flex-row
9			`,children:s.jsxs("div",{className:"relative flex-1",children:[s.jsx(g,{name:"search",color:"current",className:"absolute top-1/2 left-5 -translate-y-1/2",width:"16",height:"16"}),s.jsx("input",{type:"search",name:"search",value:e,placeholder:"I want to read about",onChange:t,onKeyDown:r,onBlur:()=>e&&l(e),className:`
10						w-full rounded-sm border-b border-base bg-primary
11						p-5 pl-[56px] text-base outline-hidden
12					`}),s.jsx(p,{value:n,name:"language__option",onChange:d})]})})}function H(e,t,r){const a=o=>{o.key==="Enter"&&m(o.currentTarget.value.toLowerCase())};return{onSearchChange:c.useCallback(o=>{const l=o.currentTarget.value.toLowerCase();if(e){console.info("FAILED HONEYPOT WHEN SEARCHING: ",l);return}t(l),r&&r(l)},[e,t,r]),onSearchEnter:a}}function A(e=500){const[t,r]=h(),[a,n]=c.useState(()=>t.get("search")??""),o=c.useCallback(d=>{r(i=>{const u=new URLSearchParams(i);return d?u.set("search",d):u.delete("search"),u},{preventScrollReset:!0})},[r]),l=b(o,e);return{queryValue:a,setQueryValue:n,debouncedUpdateSearchParam:l}}function L(){const[e]=h(),t=e.get("sort"),[r,a]=c.useState(t||"recent");return{sort:r,setSort:a}}function O(){const[e]=h(),t=e.get("categories"),[r,a]=c.useState(()=>t?t.split(", ").map(n=>x(n)?decodeURIComponent(n):n):[]);return{selectedCategories:r,setSelectedCategories:a}}function z(e,t){const[r,a]=c.useState(t);return c.useEffect(()=>{a(t)},[e,t]),{indexToShow:r,setIndexToShow:a}}function M(e,t){return t==="recent"?[...e].sort(T):e}export{B as S,L as a,z as b,H as c,k as d,O as e,_ as f,R as m,M as s,A as u};
13//# sourceMappingURL=blog-helpers-nJCTQ6fL.js.map

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.