1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="163f851b-8ee9-5d16-a0e7-b4bb7c663687")}catch(e){}}(); 3import{l as $,e as D,r as f,j as e,F as I}from"./vendor-react-qLnyzkeB.js";import{R as K}from"./r_switch-D6MDnbnD.js";import{R as P}from"./index-9As2c7F9.js";import{S as U}from"./search_bar-CgJPFjSF.js";import{u as Y}from"./use_isomorphic_layout_effect-DY2OFFrO.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"13978386027a4a2683cfa43e79422df47742043f"}}catch{}})();function B(s,o=0){const a=f.useRef(null),[l,x]=f.useState();return Y(()=>{if(!a.current)return;a.current.textContent=s??"";const p=a.current.getBoundingClientRect();x(p.width+o)},[s,o]),{width:l,measureRef:a}}function O({languages:s,categories:o,filters:a,defaultType:l,defaultSort:x="bestsellers_last_week",category:p}){var S;const F=$(),c=new URLSearchParams(F.search),k=D(),j=f.useRef(null),d=c.get("sort")??x,u=a.find(t=>t.value===d),y=p??c.get("category")??"",w=o.find(t=>t.slug===y),h=c.get("language")??"",g=s.find(t=>t.code3===h),b=c.get("search")??"",z=l==="books"&&d==="first_published",N=c.get("filterHighVolumeAuthors")==="true",L={sort:x,category:"",language:""},T=[...u?[{type:"sort",value:d,label:u.label}]:[],...w?[{type:"category",value:y,label:w.name}]:[],...g?[{type:"language",value:h,label:g.name}]:[]].filter(t=>t.type==="category"&&L[t.type]!==t.value),_=b.trim().length>0,E=(u==null?void 0:u.label)??((S=a[0])==null?void 0:S.label)??d??"",{width:C,measureRef:H}=B(E),M=(g==null?void 0:g.name)??h??"",{width:R,measureRef:V}=B(M),i=f.useCallback((t,r,m)=>{if(!t)return;const n=new FormData(t);n.delete("page"),r&&r(n);const A=new Set((m==null?void 0:m.preserve)??[]);!A.has("category")&&n.get("category")===null&&n.set("category",L.category);for(const v of Array.from(n.keys())){const W=n.get(v);A.has(v)||(W===""||W===null)&&n.delete(v)}k(n,{method:"get",replace:!0,action:t.getAttribute("action")??void 0})},[k]);return e.jsxs(I,{ref:j,className:"flex flex-col items-center bg-white dark:bg-zinc-900",method:"get",action:`/store/${l}`,replace:!0,children:[e.jsx("input",{type:"hidden",name:"category",value:y}),z&&e.jsx("input",{type:"hidden",name:"filterHighVolumeAuthors",value:N?"true":""}),e.jsx("div",{className:"mx-auto flex w-full justify-center px-8 py-4",children:e.jsx(U,{defaultType:l,categories:o})}),e.jsxs("section",{className:"w-full","aria-labelledby":"filter-heading",children:[e.jsx("h2",{id:"filter-heading",className:"sr-only",children:"Filters"}),e.jsx("div",{className:"bg-gray-100 dark:bg-zinc-800",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl flex-wrap items-center justify-center gap-2 px-4 py-3 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"relative",children:[e.jsx("select",{className:"appearance-none rounded-full border border-gray-200 bg-white bg-none py-1.5 pr-7 pl-3 text-sm font-medium text-gray-900 shadow-sm transition hover:border-gray-300 hover:bg-gray-50 focus:border-blue-500 focus:ring-0 focus:outline-none dark:border-zinc-600 dark:bg-zinc-700 dark:text-white dark:hover:border-zinc-500 dark:hover:bg-zinc-600",name:"sort",value:d,style:{width:C?`${C}px`:void 0},onChange:t=>i(t.currentTarget.form,void 0,{preserve:["category"]}),children:a.map(({value:t,label:r})=>e.jsx("option",{value:t,children:r},t))}),e.jsx("span",{ref:H,"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 rounded-full border border-transparent bg-white px-3 py-1.5 pr-7 text-sm font-medium whitespace-nowrap opacity-0"}),e.jsx("div",{className:"pointer-events-none absolute top-1/2 right-2 inline-flex size-4 -translate-y-1/2 items-center justify-center text-gray-400",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M1 1.25L5 4.25L9 1.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("select",{className:"appearance-none rounded-full border border-gray-200 bg-white bg-none py-1.5 pr-7 pl-3 text-sm font-medium text-gray-900 shadow-sm transition hover:border-gray-300 hover:bg-gray-50 focus:border-blue-500 focus:ring-0 focus:outline-none dark:border-zinc-600 dark:bg-zinc-700 dark:text-white dark:hover:border-zinc-500 dark:hover:bg-zinc-600",name:"language",value:h,style:{width:R?`${R}px`:void 0},onChange:t=>i(t.currentTarget.form),children:s.map(t=>e.jsx("option",{value:t.code3,children:t.name},t.id))}),e.jsx("span",{ref:V,"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 rounded-full border border-transparent bg-white px-3 py-1.5 pr-7 text-sm font-medium whitespace-nowrap opacity-0"}),h?e.jsxs("button",{type:"button",className:"absolute top-1/2 right-2 inline-flex size-4 -translate-y-1/2 items-center justify-center rounded-full text-gray-400 transition hover:bg-gray-200 hover:text-gray-500 dark:text-zinc-400 dark:hover:bg-zinc-600 dark:hover:text-zinc-300",onClick:t=>i(t.currentTarget.form,r=>{r.delete("language")}),children:[e.jsx("span",{className:"sr-only",children:"Clear language filter"}),e.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 8 8",className:"size-2",children:e.jsx("path",{d:"M1 1l6 6m0-6L1 7",strokeWidth:"1.5",strokeLinecap:"round"})})]}):e.jsx("div",{className:"pointer-events-none absolute top-1/2 right-2 inline-flex size-4 -translate-y-1/2 items-center justify-center text-gray-400 dark:text-zinc-400",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 10 6",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M1 1.25L5 4.25L9
31.25",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),T.map(t=>e.jsxs("span",{className:"inline-flex items-center rounded-full border border-gray-200 bg-white py-1.5 pr-2 pl-3 text-sm font-medium text-gray-900 shadow-sm dark:border-zinc-600 dark:bg-zinc-700 dark:text-white",children:[e.jsxs("span",{children:['Category: "',t.label,'"']}),e.jsxs("button",{type:"button",className:"ml-1 inline-flex size-4 shrink-0 rounded-full p-1 text-gray-400 transition hover:bg-gray-200 hover:text-gray-500 dark:text-zinc-400 dark:hover:bg-zinc-600 dark:hover:text-zinc-300",onClick:r=>i(r.currentTarget.form,m=>{m.delete(t.type)}),children:[e.jsxs("span",{className:"sr-only",children:["Remove filter for category ",t.label]}),e.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 8 8",className:"size-2",children:e.jsx("path",{d:"M1 1l6 6m0-6L1 7",strokeWidth:"1.5",strokeLinecap:"round"})})]})]},t.value)),_&&e.jsxs("span",{className:"inline-flex items-center rounded-full border border-gray-200 bg-white py-1.5 pr-2 pl-3 text-sm font-medium text-gray-900 shadow-sm",children:[e.jsxs("span",{children:['Search: "',b,'"']}),e.jsxs("button",{type:"button",className:"ml-1 inline-flex size-4 shrink-0 rounded-full p-1 text-gray-400 transition hover:bg-gray-200 hover:text-gray-500 dark:text-zinc-400 dark:hover:bg-zinc-600 dark:hover:text-zinc-300",onClick:t=>i(t.currentTarget.form,r=>{r.delete("search")}),children:[e.jsxs("span",{className:"sr-only",children:["Remove filter for search ",b]}),e.jsx("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 8 8",className:"size-2",children:e.jsx("path",{d:"M1 1l6 6m0-6L1 7",strokeWidth:"1.5",strokeLinecap:"round"})})]})]}),z&&e.jsx(K,{className:"flex items-center",label:e.jsx(P,{k:"w_filter_high_volume_authors"}),hintHidden:!0,checked:N,onChange:t=>i(j.current,r=>{t?r.set("filterHighVolumeAuthors","true"):r.delete("filterHighVolumeAuthors")},{preserve:["category"]})})]})})]})]})}const ee=({children:s})=>e.jsx("h1",{className:"font-display mb-2 text-center text-3xl tracking-wider text-zinc-900 dark:text-white uppercase lg:text-xl",children:s});export{ee as S,O as T}; 4 5//# debugId=163f851b-8ee9-5d16-a0e7-b4bb7c663687
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.