1import{b as c,j as e,L as x}from"./vendor-De2NIrSl.js";import{B as i,A as N,O as v,e as k,v as C}from"./index-BNKu6i1-.js";import{C as o,a as w,R as b,M as p}from"./components-C8O-N17J.js";import{M as P}from"./MarkdownEditor-BxixOR88.js";import"./rails-B67Ydfiq.js";import"./useIncubators-kFgnae4p.js";import"./star-rating-CwUEp06m.js";import"./PostBody-BsdhG4pA.js";import"./useVibes-CYKyX4Nk.js";const M={service:"Sell your time in fixed blocks. Buyers book against your availability.",gig:"Post work you need done in USD. The network bids, you pick the contract.",app:"Sell a finished app, codebase, or template. Copies or an exclusive IP transfer.",bounty:"Post a task with a Credit prize. Proposals compete, the prize escrows on selection."},S={category:null,title:"",summary:"",tags:"",blocks:[],blockMinutes:"60",blockPrice:"",budgetMin:"",budgetMax:"",priceUsd:"",exclusive:!1,exclusivePrice:"",prizeCredits:"",refundPolicy:"moderate"};function Y(){const[r,n]=c.useState(1),[s,g]=c.useState(S),[h,f]=c.useState(!1),a=t=>g(l=>({...l,...t})),d=p.membershipCredits+p.purchasedCredits,m=Number(s.prizeCredits||0),u=s.category==="bounty"&&m>d,y=r===1?s.category!==null:r===2?!!s.title.trim()&&!!s.summary.trim():(()=>{switch(s.category){case"service":return s.blocks.length>0;case"gig":return!!s.budgetMin.trim()&&!!s.budgetMax.trim();case"app":return!!s.priceUsd.trim()&&(!s.exclusive||!!s.exclusivePrice.trim());case"bounty":return m>0&&!u;default:return!1}})();return h?e.jsx("div",{className:"mx-auto max-w-xl",children:e.jsxs("div",{role:"status",className:"rounded-lg border border-success/40 bg-success/10 p-6 text-sm",children:[e.jsx("p",{className:"font-semibold text-success",children:"Listing ready to publish"}),e.jsxs("p",{className:"mt-2 text-muted-foreground",children:["â",s.title,"â is set up as a ",s.category?o[s.category].label.toLowerCase():"",". Listing is free. You can promote it with Credits for extra reach anytime. Publishing is preview only until the Vibe Market release. Nothing was saved."]}),e.jsx(i,{asChild:!0,size:"sm",variant:"secondary",className:"mt-4",children:e.jsx(x,{to:"/marketplace",children:"Back to the market"})})]})}):e.jsxs("div",{className:"mx-auto max-w-2xl space-y-4",children:[e.jsxs(x,{to:"/marketplace",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(N,{className:"size-4"}),"Vibe Market"]}),e.jsxs("section",{className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:[e.jsxs("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Step ",r," of 4"]}),e.jsxs("h1",{className:"mt-1 font-display text-lg font-bold tracking-tight",children:[r===1&&"What are you listing?",r===2&&"Describe it",r===3&&"Pricing",r===4&&"Review & publish"]}),r===1&&e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[Object.keys(o).map(t=>e.jsxs("button",{type:"button","aria-pressed":s.category===t,onClick:()=>a({category:t}),className:k(C(s.category===t),"rounded-md p-4 text-left"),children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold",children:[o[t].label,t==="bounty"&&e.jsx(v,{className:"size-3.5 text-primary"})]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:M[t]})]},t)),e.jsx("p",{className:"text-[11px] text-muted-foreground sm:col-span-2",children:"Listing is free in every category. Promotion (extra reach) costs Credits."})]}),r===2&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Title"}),e.jsx("input",{value:s.title,onChange:t=>a({title:t.target.value}),"aria-label":"Listing title",className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsxs("div",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Summary"}),e.jsx(P,{value:s.summary,onChange:t=>a({summary:t}),ariaLabel:"Summary",minRows:4,className:"mt-1"})]}),e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Tags (comma-separated)"}),e.jsx("input",{value:s.tags,onChange:t=>a({tags:t.target.value}),"aria-label":"Tags",placeholder:"react, supabase, auth",className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]})]}),r===3&&s.category==="service"&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Services sell fixed-duration blocks at set prices. Add one or more block sizes; buyers book them against your availability (managed in the Seller Studio)."}),s.blocks.map((t,l)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border p-2.5 text-sm",children:[e.jsxs("span",{className:"font-medium",children:[t.minutes," min"]}),e.jsxs("span",{className:"text-muted-foreground",children:["· $",t.priceUsd]}),e.jsx(i,{size:"sm",variant:"ghost",className:"ml-auto text-muted-foreground","aria-label":`Remove ${t.minutes} minute block`,onClick:()=>a({blocks:s.blocks.filter((L,j)=>j!==l)}),children:"Remove"})]},`${t.minutes}-${l}`)),e.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Minutes"}),e.jsx("input",{type:"number",value:s.blockMinutes,onChange:t=>a({blockMinutes:t.target.value}),"aria-label":"Block minutes",className:"mt-1 w-28 rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Price (USD)"}),e.jsx("input",{type:"number",value:s.blockPrice,onChange:t=>a({blockPrice:t.target.value}),"aria-label":"Block price",className:"mt-1 w-28 rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsx(i,{size:"sm",variant:"secondary",disabled:!s.blockMinutes.trim()||!s.blockPrice.trim(),onClick:()=>a({blocks:[...s.blocks,{minutes:Number(s.blockMinutes),priceUsd:Number(s.blockPrice)}],blockPrice:""}),children:"Add block"})]})]}),r===3&&s.category==="gig"&&e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Budget min (USD)"}),e.jsx("input",{type:"number",value:s.budgetMin,onChange:t=>a({budgetMin:t.target.value}),"aria-label":"Budget minimum",className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Budget max (USD)"}),e.jsx("input",{type:"number",value:s.budgetMax,onChange:t=>a({budgetMax:t.target.value}),"aria-label":"Budget maximum",className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground sm:col-span-2",children:"Bids arrive with amount, proposal, and timeline. Selecting one forms the order/contract."})]}),r===3&&s.category==="app"&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Price per copy (USD)"}),e.jsx("input",{type:"number",value:s.priceUsd,onChange:t=>a({priceUsd:t.target.value}),"aria-label":"Copy price",className:"mt-1 w-40 rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:s.exclusive,onChange:t=>a({exclusive:t.target.checked}),className:"accent-primary"}),"Offer exclusive IP transfer (closes the listing when sold)"]}),s.exclusive&&e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Exclusive price (USD)"}),e.jsx("input",{type:"number",value:s.exclusivePrice,onChange:t=>a({exclusivePrice:t.target.value}),"aria-label":"Exclusive price",className:"mt-1 w-40 rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Delivery is off-platform (repo transfer, license keys); escrow holds funds until the buyer confirms receipt. Exclusive sales include the Protection-tier legal agreement."})]}),r===3&&s.category==="bounty"&&e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("label",{className:"block text-sm",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Prize (Credits)"}),e.jsx("input",{type:"number",value:s.prizeCredits,onChange:t=>a({prizeCredits:t.target.value}),"aria-label":"Prize credits",className:"mt-1 w-40 rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),e.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:["Your wallet: ",e.jsx(w,{credits:d,className:"text-xs"}),e.jsx("span",{children:"· the prize escrows from your wallet when you select a proposal."})]}),u&&e.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/40 bg-destructive/5 p-2.5 text-xs text-destructive",children:"That prize exceeds your Credit balance. Lower it or buy Credits first."})]}),r===4&&s.category&&e.jsxs("div",{className:"mt-4 space-y-3 text-sm",children:[e.jsxs("dl",{className:"space-y-2 rounded-lg border border-border p-4",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Category"}),e.jsx("dd",{className:"font-medium",children:o[s.category].label})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Title"}),e.jsx("dd",{className:"font-medium",children:s.title})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Pricing"}),e.jsxs("dd",{className:"text-right font-medium",children:[s.category==="service"&&`${s.blocks.length} block size(s)`,s.category==="gig"&&`$${s.budgetMin}â$${s.budgetMax} budget`,s.category==="app"&&`$${s.priceUsd}/copy${s.exclusive?` · $${s.exclusivePrice} exclusive`:""}`,s.category==="bounty"&&`${s.prizeCredits} Credit prize`]})]}),e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Listing fee"}),e.jsx("dd",{className:"font-medium text-success",children:"Free"})]})]}),s.category!=="bounty"&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Refund / cancellation policy"}),e.jsx("select",{value:s.refundPolicy,onChange:t=>a({refundPolicy:t.target.value}),"aria-label":"Refund policy",className:"mt-1 w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary",children:Object.keys(b).map(t=>e.jsx("option",{value:t,children:b[t]},t))})]})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[r>1&&e.jsx(i,{variant:"ghost",className:"text-muted-foreground",onClick:()=>n(t=>t-1),children:"Back"}),r<4?e.jsx(i,{className:"ml-auto",disabled:!y,onClick:()=>n(t=>t+1),children:"Continue"}):e.jsx(i,{className:"ml-auto",onClick:()=>f(!0),children:"Publish listing"})]})]})]})}export{Y as MarketplaceCreatePage};
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.