PageSourceSearch

https://mymila.ai/assets/PexelsBrowser-LfW83xYn.js

js mymila.ai collected 2026-10-02 01:12:39 UTC 5,342 bytes, 1 lines download raw bytes

1import{r as b,j as e,R as u}from"./vendor-react-qoIlJY3Q.js";import{c as f,aJ as x,X as v,S as g}from"./index-Cta_Khau.js";import"./vendor-syntax-CD3TIiSU.js";import"./vendor-firebase-DCRDAzws.js";import"./vendor-capacitor-vlFZfUi7.js";import"./vendor-icons-Dt5qvq6r.js";import"./vendor-motion-c5lv3sjG.js";import"./vendor-docs-C9lcdbhm.js";import"./vendor-charts-Cns13J0s.js";import"./vendor-grid-JssYbJ1L.js";const j=["Nature","Technology","Abstract","People","Business","Food","Travel","Animals"],y=()=>e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-8",children:[e.jsx(x,{className:"w-16 h-16 mb-4 text-red-500"}),e.jsx("h2",{className:"text-2xl font-bold text-red-400 mb-2",children:"Configuration Required"}),e.jsx("p",{className:"text-[var(--text-secondary)] max-w-lg mx-auto mb-6",children:"The Pexels photo library is not available because the API Key has not been set up."}),e.jsxs("div",{className:"text-left bg-red-500/10 border border-red-500/30 p-4 rounded-lg text-sm text-red-300 max-w-md w-full",children:[e.jsx("p",{className:"font-bold mb-2",children:"Action Required:"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-xs",children:[e.jsxs("li",{children:["Go to ",e.jsx("a",{href:"https://www.pexels.com/api/",target:"_blank",rel:"noopener noreferrer",className:"underline font-semibold",children:"Pexels API"})," and create an account."]}),e.jsx("li",{children:"Request an API key."}),e.jsx("li",{children:"Copy the API Key and set it as `PEXELS_API_KEY` in your environment config."})]})]})]}),N=({photo:t,onSelect:a})=>e.jsxs("div",{className:"relative group cursor-pointer aspect-[3/4] overflow-hidden rounded-lg bg-[var(--bg-inset)]",onClick:a,children:[e.jsx("img",{src:t.src.large,alt:t.alt,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105",loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end p-3",children:e.jsxs("p",{className:"text-white text-xs truncate w-full",children:["by ",t.photographer]})})]}),T=()=>{const{isPexelsBrowserOpen:t,closePexelsBrowser:a,searchPexels:c,pexelsPhotos:l,isLoadingPexels:o,errorPexels:s,selectPexelsPhoto:m}=f(),[n,d]=b.useState(""),p=r=>{r.preventDefault(),n.trim()&&c(n)},h=r=>{d(r),c(r)};if(!t)return null;const i=s&&s.includes("API Key is not configured");return e.jsx("div",{className:"fixed inset-0 bg-black/80 z-[100] flex items-center justify-center p-0 md:p-4 pt-[env(safe-area-inset-top,0px)]",onClick:a,children:e.jsxs("div",{className:"bg-[var(--bg-solid)] shadow-2xl w-full max-w-5xl h-full max-h-[100dvh] md:max-h-[90vh] flex flex-col pop-in mobile-fullscreen-modal md:rounded-2xl border border-[var(--border-primary)]",onClick:r=>r.stopPropagation(),children:[e.jsxs("header",{className:"flex items-center justify-between p-4 border-b border-[var(--border-primary)]",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{className:"w-6 h-6 text-[var(--accent-cyan)]"}),e.jsx("h3",{className:"font-semibold text-lg",children:"Pexels Photo Library"})]}),e.jsx("button",{onClick:a,className:"p-2 rounded-full text-[var(--text-secondary)] hover:bg-[var(--bg-inset)] hover:text-[var(--text-primary)]",children:e.jsx(v,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 border-b border-[var(--border-primary)] space-y-3",children:[e.jsxs("form",{onSubmit:p,className:"relative",children:[e.jsx("input",{type:"search",value:n,onChange:r=>d(r.target.value),placeholder:"Search for free photos...",className:"w-full bg-[var(--bg-input)] border border-[var(--border-primary)] rounded-lg px-4 py-3 pl-12 text-[var(--text-primary)] focus:ring-1 focus:ring-[var(--border-focus)] focus:border-[var(--border-focus)] transition"}),e.jsx(g,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-[var(--text-tertiary)]"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:j.map(r=>e.jsx("button",{onClick:()=>h(r),className:"px-3 py-1 text-xs bg-[var(--bg-inset)] rounded-full hover:bg-[var(--bg-main)] hover:text-[var(--accent-cyan)] transition-colors border border-transparent hover:border-[var(--accent-cyan)]",children:r},r))})]}),e.jsxs("main",{className:"flex-1 overflow-y-auto p-4 relative",children:[(o||i||s||l.length===0)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 p-4 pointer-events-none",children:e.jsxs("div",{className:"bg-[var(--bg-main)]/90 backdrop-blur-md p-6 rounded-xl border border-[var(--border-primary)] shadow-xl pointer-events-auto",children:[o&&e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-[var(--accent-cyan)] border-t-transparent roun
1ded-full animate-spin mb-2"}),e.jsx("p",{className:"text-sm",children:"Loading photos..."})]}),i&&e.jsx(y,{}),s&&!i&&e.jsx("p",{className:"text-red-400 text-center",children:s}),!o&&!s&&l.length===0&&e.jsx("p",{className:"text-center text-[var(--text-secondary)]",children:"No photos found. Try a different search."})]})}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:l.map(r=>e.jsx(u.Fragment,{children:e.jsx(N,{photo:r,onSelect:()=>m(r)})},r.id))})]})]})})};export{T as PexelsBrowser};

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.