1import{r as i,j as e,i as g,B as j,C as O,X as R,aA as I,l as $,u as B,E as M,aI as G}from"./index-BcveNVDT.js";import{C as _}from"./check-icSx31RP.js";import{u as x}from"./smartPages.store-xwlTYw9y.js";import{v as H,a as Y,b as X,C as K,S as W,e as V,d as q,f as Q,W as D,P as Z}from"./publishGate-5khB2BRO.js";import{I as S}from"./input-BmIPWblF.js";import{L as C}from"./label-TCaGuRp_.js";import{S as U}from"./smartPages.const-CE0-iL4A.js";import{T as J}from"./textarea-m5PC_7rj.js";import{C as ee,b as L,a as T}from"./theme-palettes-Ci6yQV6n.js";import{C as se}from"./copy-BgUEiiT6.js";import{R as ae}from"./rocket-CJ_GxYWp.js";import"./map-pin-DMh37jmz.js";import"./switch-C8s-Mf9p.js";import"./index-DwbhpvZT.js";import"./trash-2-BnQyaEWc.js";import"./link-qVkZ-VNP.js";import"./calendar-CgqwIqfW.js";import"./phone-D-eVOQjk.js";import"./headphones-BLJ2sjGF.js";import"./file-text-CRtVzXlD.js";function te({currentStep:r,orientation:a="horizontal",children:l,className:s}){const d=i.Children.toArray(l).filter(i.isValidElement),t=d.length;return e.jsx("div",{"data-slot":"stepper","data-orientation":a,role:"progressbar","aria-valuenow":r,"aria-valuemin":1,"aria-valuemax":t,className:g("flex w-full",a==="vertical"?"flex-col gap-1":"items-start gap-2",s),children:d.map((c,m)=>{const p=m+1,v=p<r?"completed":p===r?"active":"upcoming";return i.cloneElement(c,{index:m,state:v,orientation:a,isLast:m===t-1})})})}function E({label:r,description:a,icon:l,variant:s,className:d,index:t=0,state:c="upcoming",orientation:m="horizontal",isLast:p=!1}){const v=s??(r?"circle":"bar"),h=c!=="upcoming",f=c==="completed";if(v==="bar")return e.jsx("div",{"data-slot":"stepper-item","data-state":c,className:g("h-1 flex-1 rounded-full transition-colors",h?"bg-primary":"bg-border",d)});const n=e.jsx("span",{className:g("relative z-10 flex size-8 shrink-0 items-center justify-center rounded-full border text-sm font-medium transition-colors [&_svg]:size-4",h?"bg-primary text-primary-foreground border-primary":"bg-card text-muted-foreground border-border"),children:l??(f?e.jsx(_,{}):t+1)}),N=(r||a)&&e.jsxs("div",{className:m==="vertical"?"pb-6":void 0,children:[r&&e.jsx("div",{className:g("text-sm font-medium",h?"text-foreground":"text-muted-foreground"),children:r}),a&&e.jsx("p",{className:"text-muted-foreground text-xs",children:a})]});return m==="vertical"?e.jsxs("div",{"data-slot":"stepper-item","data-state":c,className:g("flex gap-3",d),children:[e.jsxs("div",{className:"flex flex-col items-center",children:[n,!p&&e.jsx("span",{className:g("my-1 min-h-6 w-0.5 flex-1 rounded-full",f?"bg-primary":"bg-border")})]}),N]}):e.jsxs("div",{"data-slot":"stepper-item","data-state":c,className:g("relative flex flex-1 flex-col items-center gap-2 text-center",d),children:[t>0&&e.jsx("span",{"aria-hidden":!0,className:g("absolute top-4 right-1/2 left-[-50%] h-0.5 -translate-y-1/2",h?"bg-primary":"bg-border")}),n,N]})}function A(r){return r.trim().toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"")}const le=500;function re({onNext:r}){const a=x(n=>n.draft),l=x(n=>n.setDraft),s=x(n=>n.slugStatus),d=x(n=>n.checkSlug),[t,c]=i.useState(a.page_slug),m=i.useRef(null);i.useEffect(()=>{if(m.current&&clearTimeout(m.current),!!t.trim())return m.current=setTimeout(()=>{const n=A(t);n&&d(n)},le),()=>{m.current&&clearTimeout(m.current)}},[t,d]);const p=i.useCallback(n=>{const N=n.target.value;c(N);const k=A(N);l({page_slug:k})},[l]),v=i.useCallback(()=>{s==="available"&&a.page_slug&&r()},[s,a.page_slug,r]),h=()=>{switch(s){case"checking":return e.jsx(I,{className:"h-4 w-4 animate-spin text-muted-foreground"});case"available":return e.jsx(_,{className:"h-4 w-4 text-green-600"});case"taken":return e.jsx(R,{className:"h-4 w-4 text-destructive"});case"error":return e.jsx(O,{className:"h-4 w-4 text-destructive"});default:return null}},f=()=>{switch(s){case"checking":return"Checking availability...";case"available":return"This slug is available!";case"taken":return"This slug is taken. Try another.";case"error":return"Could not check availability. Try again.";default:return null}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Claim your page"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a unique URL for your Smart Page. This is how clients will find you."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{htmlFor:"slug-input",children:"Your page URL"}),e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsx("span",{className:"flex h-9 items-center rounded-l-md border border-r-0 bg-muted px-3 text-sm text-muted-foreground",children:`${U}/`}),e.jsxs("div",{className:"relative flex-1",children:[e.jsx(S,{id:"slug-input",value:t,onChange:p,placeholder:"your-name",className:"rounded-l-none pr-9",autoFocus:!0}),e.jsx("div",{className:"absolute right-2.5 top-1/2 -translate-y-1/2",children:h()})]})]}),f()&&e.jsx("p",{className:g("text-xs",s==="available"?"text-green-600":s==="taken"||s==="error"?"text-destructive":"text-muted-foreground"),children:f()})]}),s==="taken"&&a.page_slug&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Try one of these:"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[`${a.page_slug}-travel`,`${a.page_slug}-advisor`,`the-${a.page_slug}`].map(n=>e.jsx("button",{type:"button",className:"rounded-md border px-2.5 py-1 text-xs hover:bg-foreground
1/8 transition-colors",onClick:()=>{c(n),l({page_slug:n}),d(n)},children:n},n))})]}),e.jsx(j,{onClick:v,disabled:s!=="available"||!a.page_slug,className:"w-full",children:"Continue"})]})}function ie({photoUrl:r,className:a}){const l=x(o=>o.uploadProfilePhoto),s=x(o=>o.setDraft),d=x(o=>o.isSaving),[t,c]=i.useState(!1),[m,p]=i.useState(null),v=i.useRef(null),h=i.useCallback(async o=>{p(null);const b=H(o);if(!b.valid){p(b.error??"Invalid photo");return}await l(o)||p("Upload failed. Please try again.")},[l]),f=i.useCallback(o=>{const b=o.target.files?.[0];b&&h(b),o.target.value=""},[h]),n=i.useCallback(o=>{o.preventDefault(),c(!1);const b=o.dataTransfer.files[0];b&&h(b)},[h]),N=i.useCallback(o=>{o.preventDefault(),c(!0)},[]),k=i.useCallback(()=>{c(!1)},[]),y=i.useCallback(()=>{s({profile_photo_url:""}),p(null),$.info("Smart Pages: profile photo removed")},[s]);return e.jsxs("div",{className:g("flex flex-col items-center gap-2",a),children:[e.jsx("div",{className:g("relative flex h-28 w-28 cursor-pointer items-center justify-center rounded-full border-2 border-dashed transition-colors",t?"border-primary bg-primary/5":"border-muted-foreground/30",r&&"border-solid border-transparent"),onClick:()=>v.current?.click(),onDrop:n,onDragOver:N,onDragLeave:k,role:"button",tabIndex:0,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),v.current?.click())},"aria-label":"Upload profile photo",children:d?e.jsx(I,{className:"h-8 w-8 animate-spin text-muted-foreground"}):r?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:r,alt:"Profile preview",className:"h-full w-full rounded-full object-cover"}),e.jsx(j,{type:"button",variant:"destructive",size:"icon",className:"absolute -top-1 -right-1 h-6 w-6 rounded-full",onClick:o=>{o.stopPropagation(),y()},"aria-label":"Remove photo",children:e.jsx(R,{className:"h-3 w-3"})})]}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-muted-foreground",children:[e.jsx(ee,{className:"h-6 w-6"}),e.jsx("span",{className:"text-xs",children:"Upload"})]})}),e.jsx("input",{ref:v,type:"file",accept:"image/jpeg,image/png",className:"hidden",onChange:f}),m&&e.jsx("p",{className:"text-xs text-destructive",children:m})]})}function ne({onNext:r,onBack:a}){const l=x(t=>t.draft),s=x(t=>t.setDraft),d=i.useCallback(()=>{l.display_name.trim()&&r()},[l.display_name,r]);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Build your profile"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add your details, links, and social accounts. You can always edit these later."})]}),e.jsx(ie,{photoUrl:l.profile_photo_url}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"display-name",children:["Display Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(S,{id:"display-name",value:l.display_name,onChange:t=>s({display_name:t.target.value}),placeholder:"Your full name"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"tagline",children:["Tagline"," ",e.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",l.tagline.length,"/",L,")"]})]}),e.jsx(S,{id:"tagline",value:l.tagline,onChange:t=>s({tagline:t.target.value.slice(0,L)}),placeholder:"e.g. Luxury Travel Specialist",maxLength:L})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"bio",children:["Bio"," ",e.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",l.bio.length,"/",T,")"]})]}),e.jsx(J,{id:"bio",value:l.bio,onChange:t=>s({bio:t.target.value.slice(0,T)}),placeholder:"Tell clients about yourself and what you specialize in...",rows:4,maxLength:T})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"location",children:"Location"}),e.jsx(S,{id:"location",value:l.location,onChange:t=>s({location:t.target.value}),placeholder:"e.g. Miami, FL"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Y,{selected:l.specialties,onChange:t=>s({specialties:t})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:X})]}),e.jsx(K,{links:l.links,onChange:t=>s({links:t})}),e.jsx(W,{socials:l.socials,onChange:t=>s({socials:t})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(j,{variant:"outline",onClick:a,className:"flex-1",children:"Back"}),e.jsx(j,{onClick:d,disabled:!l.display_name.trim(),className:"flex-1",children:"Continue"})]})]})}function ce({onBack:r,onClose:a}){const l=B(),s=x(u=>u.draft),d=x(u=>u.isSaving),t=x(u=>u.isPublished),c=x(u=>u.error),m=x(u=>u.saveDraft),p=x(u=>u.publish),[v,h]=i.useState(!1),[f,n]=i.useState(null),[N,k]=i.useState(0),y=`https://${U}/${s.page_slug}`,o=i.useCallback(async()=>{k(F=>F+1);const{ready:u,unmet:P}=V(s);if(!u){n(P);return}if(!await m())return;await p()&&(a(),l({to:"/tools/smart-pages"}))},[s,m,p,a,l]);i.useEffect(()=>{n(null)},[s.page_slug,s.display_name,s.profile_photo_url,s.bio,s.specialties]);const b=i.useCallback(async()=>{n(null),k(P=>P+1),await m()&&(a(),l({to:"/tools/smart-pages"}))},[m,a,l]),z=i.useCallback(async()=>{try{await navigator.clipboard.writeText(y),h(!0),setTimeout(()=>h(!1),2e3)}catch{}},[y]);return t?e.jsxs("div",{className:"flex flex-col items-center gap-6 py-8 text-center",children:[e.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-green-100",children:e.jsx(_,{className:"h-8 w-8 text-green-600"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Your page is live!"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Share your Smart Page with clients and start getting bookings."})]}),e.jsxs("div",{className:"flex w-full items-center gap-2 rounded-lg border bg-muted/50 px-4 py-3",children:[e.jsx("span",{className:"flex-1 truncate text-sm font-medium",children:y}),e.jsx(j,{variant:"ghost",size:"icon",onClick:z,"aria-label":"Copy URL",children:v?e.jsx(_,{className:"h-4 w-4 text-green-600"}):e.jsx(se,{className:"h-4 w-4"})}),e.jsx(j,{variant:"ghost",size:"icon",asChild:!0,children:e.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer","aria-label":"Open page",children:e.jsx(M,{className:"h-4 w-4"})})})]}),e.jsx(j,{onClick:a,className:"w-full",children:"Done"})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"Review & publish"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Review your Smart Page details before going live."})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border p-4",children:[e.jsx(w,{label:"URL",value:y}),e.jsx(w,{label:"Display Name",value:s.display_name}),s.tagline&&e.jsx(w,{label:"Tagline",value:s.tagline}),s.location&&e.jsx(w,{label:"Location",value:s.location}),s.specialties.length>0&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"w-28 shrink-0 text-xs text-muted-foreground",children:"Specialties"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.specialties.map(u=>e.jsx(G,{variant:"secondary",className:"text-xs",children:u},u))})]}),e.jsx(w,{label:"Links",value:`${s.links.length} custom link${s.links.length!==1?"s":""}`}),e.jsx(w,{label:"Socials",value:`${s.socials.filter(u=>u.url.trim()).length} connected`})]}),(f||c)&&e.jsx("div",{id:"wizard-publish-error",className:"text-sm text-destructive",role:"alert",children:f?e.jsxs(e.Fragment,{children:[e.jsx("p",{children:q}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:f.map(u=>e.jsx("li",{children:Q(u,"wizard")},u.id))})]}):e.jsx("p",{children:c})},N),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(j,{onClick:o,disabled:d,"aria-describedby":f||c?"wizard-publish-error":void 0,className:"w-full",children:[d?e.jsx(I,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(ae,{className:"mr-2 h-4 w-4"}),"Publish Page"]}),e.jsx(j,{variant:"outline",onClick:b,disabled:d,className:"w-full",children:"Save as Draft"})]}),e.jsx(j,{variant:"ghost",onClick:r,disabled:d,className:"w-full",children:"Back"})]})}function w({label:r,value:a}){return e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:g("w-28 shrink-0 text-xs text-muted-foreground"),children:r}),e.jsx("span",{className:"text-sm",children:a||"â"})]})}const oe=3;function de({onClose:r}){const a=x(c=>
1c.step),l=x(c=>c.setStep),s=x(c=>c.draft),d=i.useCallback(()=>{l(Math.min(a+1,oe-1))},[a,l]),t=i.useCallback(()=>{l(Math.max(a-1,0))},[a,l]);return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"relative flex h-full max-h-[90vh] w-full max-w-5xl overflow-hidden rounded-xl bg-background shadow-2xl",children:[e.jsx(j,{variant:"ghost",size:"icon",className:"absolute right-3 top-3 z-10",onClick:r,"aria-label":"Close wizard",children:e.jsx(R,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex flex-1 flex-col overflow-y-auto p-6 sm:p-8",children:[e.jsxs(te,{currentStep:a+1,className:"mb-8",children:[e.jsx(E,{label:D.claim}),e.jsx(E,{label:D.profileAndLinks}),e.jsx(E,{label:D.publish})]}),e.jsxs("div",{className:"flex-1",children:[a===0&&e.jsx(re,{onNext:d}),a===1&&e.jsx(ne,{onNext:d,onBack:t}),a===2&&e.jsx(ce,{onBack:t,onClose:r})]})]}),e.jsx("div",{className:"hidden w-[420px] shrink-0 items-center justify-center border-l bg-muted/30 p-6 lg:flex",children:e.jsx(Z,{data:{display_name:s.display_name,tagline:s.tagline,bio:s.bio,location:s.location,specialties:s.specialties,profile_photo_url:s.profile_photo_url,links:s.links,socials:s.socials,isPublished:!1}})})]})})}function Re(){const r=B(),a=i.useCallback(()=>{r({to:"/dashboard"})},[r]);return e.jsx(de,{onClose:a})}export{Re as component};
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.