1import{u as R,j as e,B as g,a as O,s as w,X as B,p as M}from"./index-B8sBaXQd.js";import{r as c}from"./vendor-recharts-PDzeV0Q9.js";import{L as T}from"./Layout-DAWUt-Eh.js";import{H as I}from"./Header-BUQn9Pzh.js";import{B as d}from"./badge-CIMDk1D_.js";import{r as U,a as H,b as V,c as z,d as G,e as W,f as X}from"./retail-space-7-cMlj2NP1.js";import{M as F}from"./map-pin-BTYmtfJU.js";import{D as J}from"./dollar-sign-BBNzfv8H.js";import{L as Y}from"./lock-DBpijuC6.js";import{L as q}from"./layout-grid-DWUCVu2d.js";import{I as K}from"./input-CdVRlp_C.js";import{E as Q}from"./EmptyStateRetailSpace-CDoAogbi.js";import{S as Z,a as ee,b as te,c as se,d as S}from"./select-f6afgOXu.js";import{u as re}from"./use-categories-hnMt0uTt.js";import{S as ae}from"./SEO-Eo8PLAwa.js";import{M as oe}from"./menu-F0m0pTxR.js";import{P as D}from"./shield-BYC-J9mv.js";import{L as ie}from"./loader-circle-DttseWp6.js";import"./Footer-DeVgdLil.js";import"./search-ptOco6OC.js";import"./store-CnfieG8L.js";import"./building-x2E7TkaF.js";import"./popify-logo-j04LgRya.js";import"./list-CtVT9Y2l.js";import"./calendar-DmfXVeb3.js";import"./users-DHPuX-8_.js";import"./user-BT4chubZ.js";import"./use-platform-stats-BPW03EGM.js";import"./useQuery-9bnKLnUE.js";import"./sparkles-D9KK09iu.js";import"./shopping-bag-1MgTnGKM.js";import"./clock-C0bEwGpw.js";import"./gift-S8YIcwEh.js";import"./trending-up-CxKrPUSf.js";import"./trophy-C6J7-1he.js";import"./circle-check-big-BECeyRf0.js";import"./file-text-SdZWtsDM.js";import"./user-plus-D5K1YNSk.js";import"./index-DfEW_cST.js";import"./index-vzZ7al4T.js";import"./chevron-down-B1LDaoge.js";import"./check-CDWAMMC0.js";import"./chevron-up-uIN8WUTz.js";const L=[U,H,V,z,G,W,X],ne=(t,a)=>t==="monthly_rental"?"0% commission":t==="commission"&&a?`${a}% commission`:t==="hybrid"&&a?`Blended (${a}% or $XX/month)`:"",le=t=>{switch(t){case"no_contract":return"Month-to-month min";case"4_weeks":return"1 month min";case"3_months":return"3 months min";case"6_months":return"6 months min";case"1_year":return"1 year min";default:return""}},ce=(t,a)=>!t&&!a?"":t&&a&&t!==a?`$${t.toLocaleString()}-$${a.toLocaleString()}/month`:t?`$${t.toLocaleString()}/month`:a?`Up to $${a.toLocaleString()}/month`:"",me=t=>{switch(t){case"available":return{label:"Accepting Applications",className:"bg-lime-green text-foreground"};case"waitlist":return{label:"Waitlist",className:"bg-warning text-foreground"};case"full":return{label:"Full",className:"bg-destructive text-destructive-foreground"};default:return{label:t,className:"bg-muted text-muted-foreground"}}},de=(t,a)=>!t&&!a||t===a?1:t&&a?3:2;function ue({space:t,isAuthenticated:a=!1}){var f;const p=R(),x=()=>{const u=t.id.split("").reduce((N,C)=>N+C.charCodeAt(0),0);return L[u%L.length]},b=((f=t.photos)==null?void 0:f[0])||x(),l=me(t.status),h=ce(t.rental_amount_min,t.rental_amount_max),s=ne(t.commission_structure,t.commission_percentage),m=le(t.minimum_rental_duration),y=de(t.rental_amount_min,t.rental_amount_max);return e.jsxs("div",{className:"w-full min-w-0 bg-card rounded-xl overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200 group border border-border",onClick:()=>p(`/retail-space/${t.id}`),children:[e.jsxs("div",{className:"relative h-48 overflow-hidden",children:[e.jsx("img",{src:b,alt:t.store_name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",loading:"lazy"}),e.jsx(d,{variant:"secondary",className:"absolute top-3 left-3 bg-card shadow-md text-foreground text-xs font-medium",children:"Retail Space"}),e.jsx(d,{className:`absolute top-3 right-3 ${l.className} text-xs font-semibold shadow-md`,children:l.label})]}),e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx("h3",{className:"font-heading text-xl font-semibold text-foreground group-hover:text-primary transition-colors line-clamp-1",children:t.store_name}),e.jsxs("div",{className:"flex items-center gap-1.5 text-foreground/70 text-sm font-mono",children:[e.jsx(F,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"line-clamp-1",children:t.store_location||`${t.city}${t.province?`, ${t.province}`:""}`})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h?a?e.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-2",children:[e.jsx(J,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-mono",children:h})]}):e.jsxs("button",{onClick:u=>{u.stopPropagation(),p("/signup")},className:"flex items-center gap-2 bg-primary/5 border border-dashed border-primary/30 rounded-lg px-3 py-2 text-sm text-primary font-semibold hover:bg-primary/10 transition-colors",children:[e.jsx(Y,{className:"w-4 h-4"}),"Sign up for pricing"]}):null,e.jsxs("div",{className:"flex items-center gap-2 bg-lime-green/20 rounded-lg px-3 py-2",children:[e.jsx(q,{className:"w-4 h-4 text-foreground"}),e.jsxs("span",{className:"text-sm font-mono",children:[y," option",y!==1?"s":""]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[s&&e.jsx(d,{variant:"outline",className:"text-xs font-mono font-normal rounded-full px-3 py-1",children:s}),m&&e.jsx(d,{variant:"outline",className:"text-xs font-mono font-normal rounded-full px-3 py-1",children:m})]}),e.jsx(g,{variant:"secondary",className:"w-full mt-2 font-mono",onClick:u=>{u.stopPropagation(),p(`/retail-space/${t.id}`)},children:"View Details"})]})]})}const pe=[{value:"available",label:"Accepting",color:"bg-lime-green/20 text-foreground border-lime-green hover:bg-lime-green/30"},{value:"waitlist",label:"Waitlist",color:"bg-warning/30 text-foreground border-warning hover:bg-warning/40"}],xe=[{value:"4_weeks",label:"1 month"},{value:"3_months",label:"3 months"},{value:"6_months",label:"6 months"},{value:"no_contract",label:"Month-to-month"}],he=[{value:"monthly_rental",label:"Rental Only"},{value:"commission",label:"Commission Only"},{value:"hybrid",label:"Blended"}],fe=["Arts & Crafts","Jewelry & Accessories","Baked Goods & Confectionery","Home Decor","Vintage & Apparel","Health & Beauty","Food","Beverage"];function P({filters:t,onFilterChange:a,productCategories:p,onClearAll:x}){const b=t.city||t.productCategory||t.commissionStructure||t.minDuration||t.status&&t.status!=="available",l=(s,m)=>{t[s]===m?a(s,""):a(s,m)},h=[...new Set([...fe,...p])].sort((s,m)=>s==="Other"?1:m==="Other"?-1:s.localeCompare(m));return e.jsxs("aside",{className:"w-full lg:w-56 xl:w-64 shrink-0 space-y-6 font-mono text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"})}),e.jsx("span",{className:"font-medium",children:"Filters"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"City"}),e.jsx(K,{placeholder:"Filter by city...",value:t.city,onChange:s=>a("city",s.target.value),className:"h-9 bg-transparent border-border font-mono text-sm"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Show Spaces"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"outline",className:`curs
1or-pointer px-3 py-1.5 rounded-full text-xs font-normal transition-colors ${t.showSpaces==="available"?"bg-primary/20 border-primary text-primary":"hover:bg-muted"}`,onClick:()=>a("showSpaces","available"),children:"Available"}),e.jsx(d,{variant:"outline",className:`cursor-pointer px-3 py-1.5 rounded-full text-xs font-normal transition-colors ${t.showSpaces==="all"?"bg-primary/20 border-primary text-primary":"hover:bg-muted"}`,onClick:()=>a("showSpaces","all"),children:"All"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Status"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:pe.map(s=>e.jsxs(d,{variant:"outline",className:`cursor-pointer px-3 py-1.5 rounded-full text-xs font-normal transition-colors ${t.status===s.value?s.color:"hover:bg-muted"}`,onClick:()=>l("status",s.value),children:[e.jsx("span",{className:`w-2 h-2 rounded-full mr-1.5 ${s.value==="available"?"bg-lime-green":"bg-warning"}`}),s.label]},s.value))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Minimum Contract"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:xe.map(s=>e.jsx(d,{variant:"outline",className:`cursor-pointer px-3 py-1.5 rounded-full text-xs font-normal transition-colors ${t.minDuration===s.value?"bg-primary/20 border-primary text-primary":"hover:bg-muted"}`,onClick:()=>l("minDuration",s.value),children:s.label},s.value))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Fee Structure"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:he.map(s=>e.jsx(d,{variant:"outline",className:`cursor-pointer px-3 py-1.5 rounded-full text-xs font-normal transition-colors ${t.commissionStructure===s.value?"bg-primary/20 border-primary text-primary":"hover:bg-muted"}`,onClick:()=>l("commissionStructure",s.value),children:s.label},s.value))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs text-muted-foreground uppercase tracking-wide",children:"Category"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:h.map(s=>e.jsx(d,{variant:"outline",className:`cursor-pointer px-3 py-1.5 rounded-full text-xs font-normal transition-colors ${t.productCategory===s?"bg-primary/20 border-primary text-primary":"hover:bg-muted"}`,onClick:()=>l("productCategory",s),children:s},s))})]}),b&&e.jsx("button",{onClick:x,className:"text-xs text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Clear All Filters"})]})}function it(){const t=R(),[a,p]=O(),[x,b]=c.useState([]),[l,h]=c.useState(!0),[s,m]=c.useState(!1),[y,f]=c.useState(!1),[u,N]=c.useState("date_newest"),[C,_]=c.useState(!0),{categoryNames:k}=re(),[r,$]=c.useState(()=>({city:a.get("city")||"",productCategory:a.get("productCategory")||"",commissionStructure:a.get("commissionStructure")||"",minDuration:a.get("minDuration")||"",status:a.get("status")||"",showSpaces:a.get("showSpaces")||"available"}));c.useEffect(()=>{const o=new URLSearchParams(a);r.city?o.set("city",r.city):o.delete("city"),r.productCategory?o.set("productCategory",r.productCategory):o.delete("productCategory"),r.commissionStructure?o.set("commissionStructure",r.commissionStructure):o.delete("commissionStructure"),r.minDuration?o.set("minDuration",r.minDuration):o.delete("minDuration"),r.status?o.set("status",r.status):o.delete("status"),r.showSpaces!=="available"?o.set("showSpaces",r.showSpaces):o.delete("showSpaces");const i=a.toString(),n=o.toString();i!==n&&p(o,{replace:!0})},[r,a,p]),c.useEffect(()=>{(async()=>{const{data:{session:n}}=await w.auth.getSession();m(!!n)})();const{data:{subscription:i}}=w.auth.onAuthStateChange((n,E)=>{m(!!E)});return()=>i.unsubscribe()},[]),c.useEffect(()=>{(async()=>{h(!0);try{const{data:i,error:n}=await w.from("retail_spaces").select("*").order("created_at",{ascending:!1});if(n)throw n;b(i||[])}catch(i){console.error("Error fetching retail spaces:",i),M.error("Failed to load retail spaces")}finally{h(!1)}})()},[]),c.useEffect(()=>{(async()=>
1{if(!r.city.trim()){_(!0);return}const{count:i}=await w.from("retail_spaces").select("id",{count:"exact",head:!0}).ilike("city",r.city.trim());_((i||0)>0)})()},[r.city]);const v=c.useMemo(()=>{const o=x.filter(i=>{var n;return!(r.showSpaces==="available"&&i.status!=="available"||r.city&&!i.city.toLowerCase().includes(r.city.toLowerCase())||r.productCategory&&!((n=i.product_categories)!=null&&n.includes(r.productCategory))||r.commissionStructure&&i.commission_structure!==r.commissionStructure||r.minDuration&&i.minimum_rental_duration!==r.minDuration||r.status&&i.status!==r.status)});switch(u){case"price_low":o.sort((i,n)=>(i.rental_amount_min||0)-(n.rental_amount_min||0));break;case"price_high":o.sort((i,n)=>(n.rental_amount_min||0)-(i.rental_amount_min||0));break}return o},[x,r,u]),j=(o,i)=>{$(n=>({...n,[o]:i}))},A=()=>{$({city:"",productCategory:"",commissionStructure:"",minDuration:"",status:"",showSpaces:"available"})};return e.jsxs(T,{children:[e.jsx(ae,{title:"Retail Spaces for Pop-Up Vendors",description:"Find retail spaces and storefronts for your pop-up business. Browse available spaces in the US and Canada with pricing, reviews, and availability.",canonical:"/retail-spaces"}),e.jsx(I,{}),e.jsx("div",{className:"min-h-screen bg-background overflow-x-hidden",children:e.jsxs("div",{className:"flex w-full overflow-hidden",children:[e.jsx("div",{className:"hidden lg:block p-6 border-r border-border bg-card/50",children:e.jsx(P,{filters:r,onFilterChange:j,productCategories:k,onClearAll:A})}),y&&e.jsxs("div",{className:"fixed inset-0 z-50 lg:hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>f(!1)}),e.jsxs("div",{className:"absolute left-0 top-0 h-full w-[85vw] max-w-80 bg-card p-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("span",{className:"font-medium",children:"Filters"}),e.jsx(g,{variant:"ghost",size:"icon",onClick:()=>f(!1),children:e.jsx(B,{className:"w-5 h-5"})})]}),e.jsx(P,{filters:r,onFilterChange:j,productCategories:k,onClearAll:A})]})]}),e.jsxs("div",{className:"flex-1 p-4 sm:p-6 min-w-0 overflow-hidden",children:[!s&&e.jsx("div",{className:"mb-6 p-4 bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-xl",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground",children:"Unlock Full Space Details"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign up free to view pricing, contact info, and apply to spaces"})]}),e.jsx(g,{onClick:()=>t("/signup"),className:"whitespace-nowrap min-h-[44px]",children:"Sign Up Free"})]})}),e.jsx("div",{className:"mb-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Loading retail spaces...":`${v.length} retail space${v.length!==1?"s":""} found`})}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(g,{variant:"ghost",size:"icon",className:"lg:hidden mr-2",onClick:()=>f(!0),children:e.jsx(oe,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>j("showSpaces","available"),className:`font-mono text-sm px-1 pb-1 border-b-2 transition-colors ${r.showSpaces==="available"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Available Spaces"}),e.jsx("span",{className:"text-muted-foreground mx-2",children:"|"}),e.jsx("button",{onClick:()=>j("showSpaces","all"),className:`font-mono text-sm px-1 pb-1 border-b-2 transition-colors ${r.showSpaces==="all"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"All Spaces"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Z,{value:u,onValueChange:o=>N(o),children:[e.jsx(ee,{className:"w-32 sm:w-44 font-mono text-sm",children:e.jsx(te,{})}),e.jsxs(se,{children:[e.jsx(S,{value:"date_newest",children:"Date (Soonest)"}),e.jsx(S,{value:"price_low",children:"Price (Low to High)"}),e.jsx(S,{value:"price_high",children:"Price (High to Low)"}),e.jsx(S,{value:"rating",children:"Rating (Highest)"})]})]}),s&&e.jsxs(g,{size:"sm",onClick:()=>t("/add-retail-space"),className:"flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),"Add Space"]})]})]}),l&&e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(ie,{className:"w-8 h-8 animate-spin text-primary"})}),!l&&v.length===0&&(r.city.trim()&&!C?e.jsx(Q,{cityName:r.city.trim(),onSwitchToMarkets:()=>t(`/markets?city=${encodeURIComponent(r.city)}`)}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(F,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No retail spaces found"}),e.jsx("p",{className:"text-muted-foreground mb-4 font-mono text-sm",children:x.length===0?"Be the first to add a retail shelf space listing!":"Try adjusting your filters to
1see more results."}),s&&x.length===0&&e.jsxs(g,{onClick:()=>t("/add-retail-space"),children:[e.jsx(D,{className:"w-4 h-4 mr-2"}),"Add Retail Space"]})]})),!l&&v.length>0&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6 w-full",children:v.map(o=>e.jsx(ue,{space:o,isAuthenticated:s},o.id))})]})]})})]})}export{it 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.