PageSourceSearch

https://floraflor.lovable.app/assets/PublicOrchids-DNFt261z.js

js floraflor.lovable.app collected 2026-10-03 03:32:18 UTC 8,137 bytes, 1 lines download raw bytes

1import{r,b as S,j as e,F as q,B as k,C as z,s as O}from"./index-RxDZGo8S.js";import{I as K}from"./input-CS9s6izM.js";import{P as R}from"./progress-Dp_Y5uLR.js";import{u as Y}from"./useDebounce-DcC59get.js";import{s as P,g as L}from"./localCache-CWb8_GG6.js";import{P as J,F as U,a as W}from"./PhotoLightbox-CHkEWssn.js";import{S as G}from"./search-Dss-hsDb.js";import{F as Q}from"./filter-C3YzNlq7.js";import"./check-dsJNWiFz.js";import"./copy-DsAYP70E.js";import"./download-C_n9HF-k.js";const E="public_orchids",M="public_orchid_colors",V=d=>{r.useEffect(()=>{const m="Orquídeas Disponibles | FloraFlor Chile - Compra Online",o=`Catálogo de ${d} variedades de orquídeas disponibles en FloraFlor Chile. Compra orquídeas online con envío a todo Chile. Phalaenopsis, Cattleya y más.`;document.title=m;let a=document.querySelector('meta[name="description"]');a&&a.setAttribute("content",o);let u=document.querySelector('meta[property="og:title"]');u&&u.setAttribute("content",m);let g=document.querySelector('meta[property="og:description"]');g&&g.setAttribute("content",o);let x=document.querySelector('meta[property="og:type"]');x&&x.setAttribute("content","website");let i=document.querySelector('link[rel="canonical"]');return i||(i=document.createElement("link"),i.rel="canonical",document.head.appendChild(i)),i.href="https://floraflor.lovable.app/orquideas-disponibles",()=>{document.title="Floraflor - Sistema de Gestión de Inventario"}},[d])},X=(d,m)=>{const o=d.filter(a=>a.first_photo_url).map((a,u)=>({"@type":"Product",position:u+1,name:`Orquídea ${a.name}`,image:a.first_photo_url,description:`Orquídea ${a.name}${a.height_cm?` - ${a.height_cm} cm`:""}${a.color_id&&m[a.color_id]?` - Color ${m[a.color_id].name}`:""} disponible en FloraFlor Chile`,brand:{"@type":"Brand",name:"FloraFlor"},offers:{"@type":"Offer",availability:"https://schema.org/InStock",priceCurrency:"CLP",seller:{"@type":"Organization",name:"FloraFlor"},...a.shopify_link?{url:a.shopify_link}:{}},...a.shopify_link?{url:a.shopify_link}:{}}));return{"@context":"https://schema.org","@type":"ItemList",name:"Orquídeas Disponibles - FloraFlor Chile",description:"Catálogo de orquídeas disponibles para compra online en FloraFlor Chile",numberOfItems:o.length,itemListElement:o}},de=()=>{const[d,m]=r.useState(""),[o,a]=r.useState(null),[u,g]=r.useState(new Map),x=Y(d,300),[i,T]=r.useState(0),[p,C]=r.useState(null),I=r.useCallback(()=>{T(t=>t+1)},[]),{data:f,isLoading:v}=S({queryKey:["public-orchids"],queryFn:async()=>{const{data:t,error:s}=await O.rpc("get_public_orchids");if(s)throw s;const l=t||[];return P(E,l,1e3*60*60),l},initialData:()=>L(E)??void 0,staleTime:1e3*60*15,gcTime:1e3*60*60,refetchOnWindowFocus:!1,networkMode:"offlineFirst"}),{data:h}=S({queryKey:["public-orchid-colors"],queryFn:async()=>{const{data:t,error:s}=await O.from("orchid_colors").select("id, name, hex_color").order("name");if(s)throw s;const l=t||[];return P(M,l,1e3*60*60*24),l},initialData:()=>L(M)??void 0,staleTime:1e3*60*60,gcTime:1e3*60*60*24,refetchOnWindowFocus:!1,networkMode:"offlineFirst"}),_=r.useMemo(()=>{const t={};return h==null||h.forEach(s=>{t[s.id]={name:s.name,hex_color:s.hex_color}}),t},[h]),n=r.useMemo(()=>f?f.filter(s=>{const l=!x||s.name.toLowerCase().includes(x.toLowerCase()),c=!o||s.color_id===o;return l&&c}).sort((s,l)=>{const c=s.first_photo_url?0:1,H=l.first_photo_url?0:1;return c-H}):[],[f,x,o]);V(n.length);const b=r.useMemo(()=>n.filter(t=>t.first_photo_url).length,[n]),D=b>0?Math.round(i/b*100):100,y=i>=b,[j,w]=r.useState(!0);r.useEffect(()=>{if(y&&j){const t=setTimeout(()=>w(!1),500);return()=>clearTimeout(t)}y||w(!0)},[y,j]);const $=r.useCallback(()=>g(new Map),[]),A=r.useCallback((t,s)=>{g(l=>{const c=new Map(l);return c.has(t)?c.delete(t):c.set(t,s),c})},[]);r.useCallback((t,s)=>{C({url:t,name:s})},[]);const B=r.useCallback(()=>{C(null)},[]),N=r.useMemo(()=>{if(!f||!h)return[];const t=new Set(f.map(s=>s.color_id).filter(Boolean));return h.filter(s=>t.has(s.id))},[f,h]),F=r.useMemo(()=>n.length?X(n,_):null,[n,_]);return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#d4e3b4]/20 to-white",children:[F&&e.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(F)}}),e.jsx("header",{className:"sticky top-0 z-10 bg-white/80 backdrop-blur-md border-b border-[#047373]/10 shadow-sm",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-7 w-7 text-[#047373]","aria-hidden":"true"}),e.jsx("h1",{className:"text-xl sm:text-2xl font-bold text-[#047373]",children:"FloraFlor - Orquídeas Disponibles"})]}),e.jsxs("span",{className:"text-sm text-[#047373]/70 font-medium","aria-live":"polite",children:[n.length," ",n.length===1?"variedad":"variedades"]})]}),e.jsxs("div",{className:"mt-3 relative",children:[e.jsx(G,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[#047373]/40","aria-hidden":"true"}),e.jsx(K,{placeholder:"Buscar variedad de orquídea...",value:d,onChange:t=>m(t.target.value),className:"pl-9 bg-white border-[#047373]/20 focus-visible:ring-[#047373]","aria-label":"Buscar variedad de orquídea"})]}),N.length>0&&e.jsxs("nav",{className:"mt-3 flex gap-2 overflow-x-auto pb-1 scrollbar-hide","aria-label":"Filtrar por color",children:[e.jsxs(k,{variant:o===null?"default":"outline",size:"sm",onClick:()=>a(null),className:`shrink-0 text-xs ${o===null?"bg-[#047373] hover:bg-[#047373]/90 text-white":"border-[#047373]/20 text-[#047373]"}`,children:[e.jsx(Q,{className:"h-3 w-3 mr-1","aria-hidden":"true"}),"Todas"]}),N.map(t=>e.jsxs(k,{variant:o===t.id?"default":"outline",size:"sm",onClick:()=>a(o===t.id?null:t.id),className:`shrink-0 text-xs ${o===t.id?"bg-[#047373] hover:bg-[#047373]/90 text-white":"border-[#047373]/20 text-[#047373]"}`,children:[e.jsx("span",{className:"h-3 w-3 rounded-full border border-gray-300 mr-1.5 shrink-0",style:{backgroundColor:t.hex_color},"aria-hidden":"true"}),t.name]},t.id))]})]})}),e.jsxs("div",{className:"max-w-6xl mx-auto px-4 pt-4 space-y-1",children:[!v&&b>0&&!y&&j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-[#047373]/50",children:[e.jsx("span",{children:"Cargando fotos..."}),e.jsxs("span",{children:[i,"/",b]})]}),e.jsx(R,{value:D,className:"h-1.5 [&>div]:bg-[#047373]"})]}),e.jsx("p",{className:"text-xs text-[#047373]/50 text-center",children:"Toca las orquídeas para seleccionarlas y copiar tu pedido"})]}),e.jsx("main",{className:"max-w-6xl mx-auto px-4 py-4 pb-24",children:e.jsx("section",{"aria-label":"Catálogo de orquídeas disponibles",children:v?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 sm:gap-4",children:Array.from({length:8}).map((t,s)=>e.jsxs(z,{className:"overflow-hidden animate-pulse",children:[e.jsx("div",{className:"aspect-square bg-[#d4e3b4]/30"}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsx("div",{className:"h-4 bg-[#d4e3b4]/40 rounded w-3/4"}),e.jsx("div",{className:"h-3 bg-[#d4e3b4]/20 rounded w-1/2"})]})]},s))}):n.length===0?e.jsxs("div",{className:"text-center py-20",children:[e.jsx(q,{className:"h-12 w-12 text-[#f39cc3] mx-auto mb-3","aria-hidden":"true"}),e.jsx("p",{className:"text-[#047373] font-medium",children:"No se encontraron variedades"}),e.jsx("p",{className:"text-sm text-[#047373]/50 mt-1",children:"Intenta con otro filtro"})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 sm:gap-4",role:"list",children:n.map(t=>e.jsx(J,{orchid:t,photoUrl:t.first_photo_url,isSelected:u.has(t.id),onToggleSelect:A,onPhotoLoaded:I},t.id))})})}),e.jsx(U,{selectedNames:Array.from(u.values()),onClear:$}),e.jsx("footer",{className:"text-center py-6 text-xs text-[#047373]/40",children:e.jsxs("p",{children:["FloraFlor © ",new Date().getFullYear()," — Orqu
1ídeas disponibles para compra online en Chile"]})}),e.jsx(W,{photoUrl:(p==null?void 0:p.url)||"",orchidName:(p==null?void 0:p.name)||"",isOpen:!!p,onClose:B})]})};export{de 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.