PageSourceSearch

https://trysteadier.app/assets/LibraryPage-CemUytBe.js

js trysteadier.app collected 2026-10-02 15:59:31 UTC 3,954 bytes, 1 lines download raw bytes

1import{j as e,m as j}from"./vendor-motion-CrVg7028.js";import{e as b,r as d,L as N}from"./vendor-react-CMYciJPr.js";import{u as v}from"./vendor-query-C4LcE4u2.js";import{u as k,h as A,i as C,g as L,L as S,X as w,S as P,C as I,b as _,s as D}from"./index-B58eJlvC.js";import{u as q}from"./usePurchasedPrograms-3Ic4yVoF.js";import{U as z}from"./UpgradeInlineCard-CAFx9s-o.js";import{B as U}from"./BreathworkCard-Cr117jcy.js";import{S as B}from"./search-D3eSUnYp.js";import"./vendor-supabase-XOXmZWMk.js";import"./arrow-right-knNoMMQa.js";const p=["All","5 min","10 min","15 min","20+ min"],F=t=>{if(t.duration_seconds)return t.duration_seconds;if(t.duration_display){const a=t.duration_display.split(":");if(a.length===2)return parseInt(a[0])*60+parseInt(a[1])}return null},E=t=>t<=450?"5 min":t<=750?"10 min":t<=1050?"15 min":"20+ min",J=()=>{const[t]=b(),a=t.get("duration"),[i,m]=d.useState(""),[n,x]=d.useState(p.includes(a)?a:"All"),c=q(),{profile:f,isAdmin:h}=k(),g=!h&&!A(f),{data:u=[]}=v({queryKey:["published-audio"],queryFn:async()=>{const{data:s,error:r}=await D.from("audio_catalog").select("*").eq("status","published").order("created_at",{ascending:!1});if(r)throw r;return s}}),l=d.useMemo(()=>{let s=[...u];if(s=s.filter(r=>C(r.access_type)?L(r.access_type).some(y=>c.has(y)):!0),i){const r=i.toLowerCase();s=s.filter(o=>o.title.toLowerCase().includes(r)||(o.description||"").toLowerCase().includes(r))}return n!=="All"&&(s=s.filter(r=>{const o=F(r);return o!==null&&E(o)===n})),s},[i,n,u,c]);return e.jsxs(S,{children:[e.jsx("header",{className:"px-5 pb-2 pt-0",children:e.jsx(j.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},children:e.jsx("h1",{className:"font-display text-2xl font-bold text-foreground",children:"Library"})})}),e.jsx("div",{className:"px-5 py-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(B,{size:18,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search by title or description...",value:i,onChange:s=>m(s.target.value),className:"w-full rounded-xl border border-border bg-card py-3 pl-10 pr-10 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"}),i&&e.jsx("button",{onClick:()=>m(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:e.jsx(w,{size:16})})]})}),e.jsx("div",{className:"px-5 pb-2",children:e.jsx(N,{to:"/picker",children:e.jsxs("div",{className:"flex items-center gap-2 rounded-xl bg-primary/8 p-3",children:[e.jsx(P,{size:16,className:"text-primary"}),e.jsx("span",{className:"text-sm font-medium text-primary",children:"Help me choose"})]})})}),e.jsx("div",{className:"px-5 pt-2",children:e.jsx(U,{delay:0})}),e.jsxs("div",{className:"px-5 pt-3 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(I,{size:12,className:"text-muted-foreground"}),e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Duration"})]}),e.jsx("div",{className:"flex gap-2 overflow-x-auto scrollbar-hide",children:p.map((s,r)=>e.jsx("button",{onClick:()=>x(s),className:`shrink-0 border-2 px-4 py-2 text-xs font-medium transition-colors ${r%2===0?"ink-pill":"ink-pill-alt"} ${n===s?"border-cocoa bg-calm text-cocoa":"border-cocoa/25 bg-muted text-muted-foreground"}`,children:s},s))})]}),e.jsx("div",{className:"space-y-2 px-5 pb-8 pt-2",children:l.length===0?e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"No sessions found"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Try different search terms or filters"})]}):l.map((s,r)=>e.jsxs("div",{children:[e.jsx(_,{audio:s,variant:"compact",index:r,purchasedProgramIds:c}),g&&r===3&&l.length>4&&e.jsx("div",{className:"pt-2",children:e.jsx(z,{index:r})})]},s.id))})]})};export{J as default};

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.