1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,30824,e=>{"use strict";var t=e.i(43476),s=e.i(32341),r=e.i(34900),l=e.i(46208),a=e.i(15990),i=e.i(8776),n=e.i(64516),o=e.i(531);function c(){let{showAuthModal:e,phoneNumber:r,closeAuthModal:l,onAuthSuccess:a}=(0,s.useAuth)();return r?(0,t.jsx)(o.AuthModal,{isOpen:e,onClose:l,onSuccess:()=>{a&&a(),l()},phoneNumber:r}):null}var d=e.i(18566),x=e.i(56420);let u=(0,x.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var m=e.i(51757);let f=(0,x.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var h=e.i(63676),p=e.i(83967),b=e.i(51360),g=e.i(24252),y=e.i(28129);function j(){let{toasts:e,hideToast:s}=(0,i.useToast)();return 0===e.length?null:(0,t.jsx)("div",{className:"fixed top-4 right-4 z-50 w-[min(24rem,calc(100vw-2rem))] space-y-2",children:e.map(e=>"notification"===e.kind?(0,t.jsx)(P,{toast:e,onClose:()=>s(e.id)},e.id):(0,t.jsx)(S,{toast:e,onClose:()=>s(e.id)},e.id))})}let v="relative flex items-start gap-3 overflow-hidden rounded-2xl border border-[#e8e8ed] bg-white py-3 pl-5 pr-3 shadow-lg animate-slide-in",N={success:{Icon:m.CheckCircle2,tone:"bg-green-50 text-green-600",accent:"bg-green-500"},error:{Icon:p.XCircle,tone:"bg-red-50 text-red-600",accent:"bg-red-500"},warning:{Icon:u,tone:"bg-amber-50 text-amber-600",accent:"bg-amber-500"},info:{Icon:f,tone:"bg-blue-50 text-[#0065f0]",accent:"bg-[#0065f0]"}};function w({className:e}){return(0,t.jsx)("span",{className:(0,b.cn)("absolute inset-y-0 left-0 w-1",e)})}function C({Icon:e,tone:s}){return(0,t.jsx)("span",{className:(0,b.cn)("flex h-8 w-8 shrink-0 items-center justify-center rounded-full",s),children:(0,t.jsx)(e,{className:"h-4 w-4"})})}function k({onClose:e}){return(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),e()},"aria-label":"Dismiss",className:"shrink-0 text-gray-400 transition-colors hover:text-gray-600",children:(0,t.jsx)(h.X,{className:"h-4 w-4"})})}function S({toast:e,onClose:s}){let{Icon:r,tone:l,accent:a}=N[e.type];return(0,t.jsxs)("div",{className:v,children:[(0,t.jsx)(w,{className:a}),(0,t.jsx)(C,{Icon:r,tone:l}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[#040036]",children:e.message}),e.description&&(0,t.jsx)("p",{className:"mt-0.5 text-sm text-gray-600",children:e.description})]}),(0,t.jsx)(k,{onClose:s})]})}function P({toast:e,onClose:s}){let r=(0,d.useRouter)(),{markRead:l}=(0,g.useNotifications)(),{Icon:a,tone:i,accent:n,href:o}=(0,y.notificationDisplay)(e.notification),c=()=>{l(e.notification.id),s(),o&&r.push(o)};return(0,t.jsxs)("div",{onClick:c,role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),c())},className:(0,b.cn)(v,"cursor-pointer transition-colors hover:bg-gray-50"),children:[(0,t.jsx)(w,{className:n}),(0,t.jsx)(C,{Icon:a,tone:i}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-sm font-semibold text-[#040036]",children:e.notification.title??"New notification"}),e.notification.body&&(0,t.jsx)("p",{className:"mt-0.5 line-clamp-2 text-sm text-gray-600",children:e.notification.body})]}),(0,t.jsx)(k,{onClose:s})]})}var I=e.i(76639),_=e.i(11241),R=e.i(66595),M=e.i(48161);let U=[{id:1,label:"Phone"},{id:2,label:"PIN"}
1,{id:3,label:"Choose"},{id:4,label:"Verify"},{id:5,label:"Done"}];function E(){let{step:e,path:s,claimSubStep:l}=(0,r.useProfileWizard)(),a="verify"===l||"merge"===l||"help"===l,i=U.map(e=>4===e.id&&"create"===s?{...e,label:"Profile"}:4===e.id&&"claim"===s?{...e,label:a?"Verify":"Search"}:e);return(0,t.jsx)("div",{className:"flex items-center justify-between px-6 py-4",children:i.map((s,r)=>{let l=e>s.id,a=e===s.id;return(0,t.jsxs)("div",{className:"flex items-center flex-1 last:flex-none",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,t.jsx)("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-semibold transition-all ${l?"bg-green-500 text-white":a?"bg-[#0065f0] text-white":"bg-gray-100 text-gray-400 border border-gray-200"}`,children:l?(0,t.jsx)(M.CheckCircle,{className:"w-4 h-4"}):s.id}),(0,t.jsx)("span",{className:`text-xs ${a?"text-[#0065f0] font-semibold":l?"text-gray-600":"text-gray-400"}`,children:s.label})]}),r<i.length-1&&(0,t.jsx)("div",{className:"flex-1 mx-2 mt-[-1rem]",children:(0,t.jsx)("div",{className:`h-0.5 ${e>s.id?"bg-green-500":"bg-gray-200"}`})})]},s.id)})})}var L=e.i(71645),O=e.i(75387),A=e.i(95187);let F=(0,A.createServerReference)("4017e6c4aeb77ca44de688a52859627b639fac099f",A.callServer,void 0,A.findSourceMapURL,"signUpOrSignIn");var T=e.i(52455);function $(e){let t=e.replace(/\D/g,"");return t.length<=3?t:t.length<=6?`(${t.slice(0,3)}) ${t.slice(3)}`:`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6,10)}`}function z(){let{setStep:e,setPhone:s,preselectedContractor:l}=(0,r.useProfileWizard)(),a=l?l.phone||l.google_phone:null,i=(0,T.isValidUsPhone)(a),[n,o]=(0,L.use
1State)(()=>a?$((0,T.normalizeUsPhone)(a)):""),[c,d]=(0,L.useState)(!1),[x,u]=(0,L.useState)(""),m=n.replace(/\D/g,""),f=10===m.length,h=async()=>{if(f){d(!0),u("");try{await F(m),s(m),e(2)}catch(e){u(e instanceof Error?e.message:"Failed to send verification code")}finally{d(!1)}}};return(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-semibold mb-2",children:"Mobile Phone Number"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 flex items-center gap-2 text-gray-400",children:[(0,t.jsx)(O.Phone,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"+1"}),(0,t.jsx)("div",{className:"w-px h-5 bg-gray-200"})]}),(0,t.jsx)("input",{type:"tel",value:n,onChange:e=>o($(e.target.value)),placeholder:"(555) 000-0000",maxLength:14,autoFocus:!i,readOnly:i,"aria-readonly":i,className:`w-full pl-20 pr-4 py-3 border rounded-xl text-sm focus:outline-none ${i?"border-gray-200 bg-gray-50 text-gray-500 cursor-not-allowed":"border-gray-200 focus:border-[#0065f0] focus:ring-1 focus:ring-[#0065f0]"}`,onKeyDown:e=>"Enter"===e.key&&h()})]}),(0,t.jsx)("p",{className:"text-gray-400 text-xs mt-1.5",children:i?"This is the number on the profile youâre claiming. Weâll send a one-time PIN to it.":"Weâll send a one-time PIN to verify your number."})]}),x&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:x}),(0,t.jsx)("button",{onClick:h,disabled:!f||c,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors",children:c?"Sending...":"Continue >"})]})}var D=e.i(20854),W=e.i(42356);let B=(0,A.createServerReference)("60b75ffba813080f746b0bc465e1329f95fc415b34",A.callServer,void 0,A.findSourceMapURL,"claimProfile");function V(){let{phone:e,setStep:l,setPath:a,setClaimSubStep:i,preselectedProfileId:n,preselectedContractor:o,markProfileClaimed:c}=(0,r.useProfileWizard)(),{login:d}=(0,s.useAuth)(),[x,u]=(0,L.useState)(""),[m,f]=(0,L.useState)(!1),[h,p]=(0,L.useState)(""),[b,g]=(0,L.useState)(30);(0,L.useEffect)(()=>{if(b<=0)return;let e=setInterval(()=>g(e=>e-1),1e3);return()=>clearInterval(e)},[b]);let y=async()=>{try{await F(e),g(30),p("")}catch(e){p(e instanceof Error?e.message:"Failed to resend code")}},j=async()=>{if(!o)return!1;let t=o.phone||o.google_phone;if(!(0,T.isValidUsPhone)(t)||(0,T.normalizeUsPhone)(t)!==(0,T.normalizeUsPhone)(e))return!1;let{user:s}=await (0,W.getUser)();if(!s)return!1;let r=await B(s.id,String(o.id));return r.success&&c(String(o.id)),r.success},v=async()=>{if(!(x.length<4)){f(!0),p("");try{if((await (0,D.verifyChallenge)(x,e)).success)if(d(),n){if(await j())return void l(5);a("claim"),i("results"),l(4)}else l(3);else p("Invalid or expired verification code")}catch(e){p(e instanceof Error?e.message:"Verification failed")}finally{f(!1)}}},N=e?`(${e.slice(0,3)}) ${e.slice(3,6)}-${e.slice(6)}`:"";return(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-semibold mb-2",children:"PIN"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 flex items-center gap-2 text-gray-400",children:[(0,t.jsx)(O.Phone,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"+1"}),(0,t.jsx)("div",{className:"w-px h-5 bg-gray-200"})]}),(0,t.jsx)("input",{type:"text",value:N,readOnly:!0,className:"w-full pl-20 pr-4 py-3 border border-gray-200 rounded-xl text-sm bg-gray-50 text-gray-500"})]}),(0,t.jsx)("p",{className:"text-gray-400 text-xs mt-1.5",children:"We'll send a one-time PIN to verify your number."})]}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"text",value:x,onChange:e=>u(e.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"Enter PIN",maxLength:6,autoFocus:!0,className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm text-center tracking-widest focus:outline-none focus:border-[#0065f0] focus:ring-1 focus:ring-[#0065f0]",onKeyDown:e=>"Enter"===e.key&&v()})}),h&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:h}),(0,t.jsx)("button",{onClick:v,disabled:x.length<4||m,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors",children:m?"Verifying...":"Continue >"}),(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)("button",{onClick:y,disabled:b>0,className:"text-sm text-[#0065f0] hover:text-blue-700 disabled:text-gray-400",children:b>0?`Resend code in ${b}s`:"Resend Code"})})]})}var q=e.i(57443),H=e.i(82954),Y=e.i(67927);function G(){let{setStep:e,setPath:s}=(0,r.useProfileWizard)();return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("button",{onClick:()=>{s("create"),e(4)},className:"w-full text-left p-5 border border-gray-200 rounded-xl hover:border-[#0065f0] hover:bg-blue-50/30 transition-all group",children:(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsx)("div",{className:"w-12 h-12 bg-[#0065f0] rounded-xl flex items-center justify-center shrink-0",children:(0,t.jsx)(q.UserPlus,{className:"w-6 h-6 text-white"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-gray-900 font-bold",children:"Create a New Profile"}),(0,t.jsx)(Y.ChevronRight,{className:"w-5 h-5 text-gray-400 group-hover:text-[#0065f0] transition-colors"})]}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-1",children:"I'm not listed in the directory yet. Start fresh and build my profile."}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-3",children:["Add your photo","Set your trade","List services"].map(e=>(0,t.jsx)("span",{className:"text-xs text-[#0065f0] border border-blue-200 rounded-full px-2.5 py-0.5",children:e},e))})]})]})}),(0,t.jsx)("button",{onClick:()=>{s("claim"),e(4)},className:"w-full text-left p-5 border border-gray-200 rounded-xl hover:border-gray-400 hover:bg-gray-50/50 transition-all group",children:(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsx)("div",{className:"w-12 h-12 bg-[#111827] rounded-xl flex items-center justify-center shrink-0",children:(0,t.jsx)(H.Shield,{className:"w-6 h-6 text-white"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-gray-900 font-bold",children:"Claim an Existing Profile"}),(0,t.jsx)(Y.ChevronRight,{className:"w-5 h-5 text-gray-400 group-hover:text-gray-600 transition-colors"})]}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-1",children:"My business is already listed. Search for it and take ownership."}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2 mt-3",children:["Search by name","Take control"].map(e=>(0,t.jsx)("span",{className:"text-xs text-gray-600 border border-gray-200 rounded-full px-2.5 py-0.5",children:e},e))})]})]})})]})}let K=(0,x.default)("building-2",[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}
1],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]]);function X(){let{setClaimSubStep:e,searchQuery:s,setSearchQuery:l,clearPreselection:a}=(0,r.useProfileWizard)();(0,L.useEffect)(()=>{a()},[a]);let i=()=>{s.trim()&&e("results")};return(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 text-gray-900 text-sm font-semibold mb-2",children:[(0,t.jsx)(K,{className:"w-4 h-4"}),"Search by company or your name"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("div",{className:"relative flex-1",children:[(0,t.jsx)(R.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,t.jsx)("input",{type:"text",value:s,onChange:e=>l(e.target.value),placeholder:"e.g. your business or full name...",className:"w-full pl-9 pr-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]",onKeyDown:e=>"Enter"===e.key&&i(),autoFocus:!0})]}),(0,t.jsxs)("button",{onClick:i,disabled:!s.trim(),className:"px-5 py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors flex items-center gap-1.5 shrink-0",children:[(0,t.jsx)(R.Search,{className:"w-4 h-4"}),"Search"]})]})]}),(0,t.jsx)("p",{className:"text-center text-gray-400 text-xs",children:"Search the directory for the profile you want to claim."})]})}var J=e.i(86563),Z=e.i(20865),Q=e.i(57688);let ee=(0,A.createServerReference)("40e572a958c1fd667dd1598b7ce47b0a7e18ecce08",A.callServer,void 0,A.findSourceMapURL,"searchClaimContractors"),et=(0,A.createServerReference)("40ca556c13c9178ef99c5463745b2437624fd0ad2d",A.callServer,void 0,A.findSourceMapURL,"getClaimContractor");var es=e.i(18064),er=e.i(89419);function el({photo:e,initials:s,name:r}){let l=(0,es.avatarColor)(r);return e?(0,t.jsx)(Q.default,{src:e,alt:r,width:48,height:48,className:"w-12 h-12 rounded-full object-cover",unoptimized:!0}):(0,t.jsx)("div",{className:"w-12 h-12 rounded-full flex items-center justify-center text-white text-sm font-bold",style:{backgroundColor:l},children:s})}function ea(){let{searchQuery:e,setStep:s,setClaimSubStep:l,setSelectedContractor:a,setClaimVerifyVariant:i,preselectedProfileId:n,preselectedContractor:o,phone:c,markProfileClaimed:d}=(0,r.useProfileWizard)(),[x,u]=(0,L.useState)(o?[o]:[]),[m,f]=(0,L.useState)(!o),[h,p]=(0,L.useState)(!1),[b,g]=(0,L.useState)("");(0,L.useEffect)(()=>{if(o){u([o]),f(!1);return}let t=!1;return async function(){f(!0),g("");try{if(n){let e=await et(n);t||u(e?[e]:[])}else if(e.trim()){let s=await ee(e);t||u(s)}else t||u([])}catch{t||g("Could not load profiles. Please try again.")}finally{t||f(!1)}}(),()=>{t=!0}},[o,n,e]);let y=async e=>{if(!e.claimed){p(!0),g(""),a(e);try{let t=(0,T.normalizeUsPhone)(c);if(!t){let{user:e}=await (0,W.getUser)();t=(0,T.normalizeUsPhone)(e?.phone)}let r=e.phone||e.google_phone,n=(0,T.isValidUsPhone)(r)?(0,T.normalizeUsPhone)(r):"";if(n&&n!==t)i("phone_different"),l("verify");else{let{user:t}=await (0,W.getUser)();if(!t){g("Authentication required"),a(null);return}let r=await B(t.id,String(e.id));r.success?(d(String(e.id)),s(5)):(g(r.error||"Failed to claim profile"),a(null))}}catch{g("Something went wrong. Please try again."),a(null)}finally{p(!1)}}};return(0,t.jsxs)("div",{className:"space-y-4",children:[m&&(0,t.jsx)("p",{className:"text-center text-gray-500 text-sm py-6",children:"Searching the directoryâ¦"}),!m&&x.map(e=>{let s=(0,er.displayName)(e),r=(0,er.initials)(e),l=[e.city,e.state].filter(Boolean).join(", "),a=1===x.length;return(0,t.jsxs)("div",{className:"flex items-center gap-4 p-4 border border-gray-200 rounded-xl",children:[(0,t.jsx)(el,{photo:e.photo??null,initials:r,name:s}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:`text-sm font-bold truncate ${a?"text-[#0065f0]":"text-gray-900"}`,children:a?`Claiming: ${s}`:s}),(0,t.jsx)("p",{className:"text-gray-500 text-xs",children:e.service?.label??"â"}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,t.jsx)(J.Star,{className:"w-3 h-3 text-[#0065f0] fill-[#0065f0]"}),(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:e.rating??"â"}),(0,t.jsx)(Z.MapPin,{className:"w-3 h-3 text-gray-400 ml-1"}),(0,t.jsx)("span",{className:"text-gray-400 text-xs",children:l||"â"})]}),e.claimed&&(0,t.jsx)("span",{className:"inline-block text-xs text-orange-600 bg-orange-50 border border-orange-200 rounded-full px-2 py-0.5 mt-1",children:"Already claimed"})]}),(0,t.jsx)("div",{children:e.claimed?(0,t.jsx)("span",{className:"text-xs text-gray-400 bg-gray-100 rounded-lg px-3 py-1.5",children:"Taken"}):(0,t.jsx)("button",{onClick:()=>y(e),disabled:h,className:"text-sm rounded-lg px-4 py-2 transition-colors font-medium disabled:opacity-50 bg-[#0065f0] text-white hover:bg-blue-700 shrink-0",children:h?"...":"This is me"})})]},e.id)}),!m&&0===x.length&&!b&&(0,t.jsx)("p",{className:"text-center text-gray-500 text-sm py-6",children:n?"We couldn't load that profile. Try searching for it instead.":`No results found for "${e}"`}),b&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:b}),(0,t.jsxs)("div",{className:"pt-2 text-center",children:[(0,t.jsx)("p",{className:"text-gray-500 text-sm mb-3",children:"Don't see your business?"}),(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)("button",{onClick:()=>l("search"),className:"flex-1 py-2.5 border border-gray-200 text-gray-700 rounded-xl text-sm hover:bg-gray-50 transition-colors",children:"Search again"}),(0,t.jsx)("button",{disabled:!0,className:"flex-1 py-2.5 border border-gray-200 text-gray-400 rounded-xl text-sm cursor-not-allowed",children:"Not listed"})]})]})]})}function ei(){let{close:e,path:s}=(0,r.useProfileWizard)(),l=(0,d.useRouter)();return(0,t.jsxs)("div",{className:"text-center py-6 space-y-4",children:[(0,t.jsxs)("div",{className:"p-5 border border-gray-200 rounded-xl",children:[(0,t.jsx)("h3",{className:"text-gray-900 font-bold text-lg",children:"claim"===s?"Profile Claimed":"Profile Created"}),(0,t.jsx)("p",{className:"text-gray-500 text-sm mt-1",children:"claim"===s?"We will verify that this profile belongs to you.":"Your profile has been created successfully."})]}),(0,t.jsx)("button",{onClick:()=>{l.refresh(),e()},className:"px-8 py-3 bg-[#0065f0] hover:bg-blue-700 text-white rounded-xl text-sm font-semibold transition-colors",children:"Great"})]})}var en=e.i(25981);let eo=(0,A.createServerReference)("0088f72affd81fd59d3d7754edcffb8bd3ed9711be",A.callServer,void 0,A.findSourceMapURL,"getWizardServices");function ec({formData:e,updateForm:s}){let{setCreateSubStep:l}
1=(0,r.useProfileWizard)(),[a,i]=(0,L.useState)(""),[n,o]=(0,L.useState)([]),[c,d]=(0,L.useState)(!0);(0,L.useEffect)(()=>{let e=!0;return eo().then(t=>{e&&o(t)}).catch(()=>{e&&o([])}).finally(()=>{e&&d(!1)}),()=>{e=!1}},[]),(0,L.useEffect)(()=>()=>{e.photoPreview&&URL.revokeObjectURL(e.photoPreview)},[e.photoPreview]);let x=e.fullName.trim()&&null!==e.serviceId;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("div",{className:"w-16 h-16 rounded-full bg-gray-100 flex items-center justify-center overflow-hidden shrink-0",children:e.photoPreview?(0,t.jsx)("img",{src:e.photoPreview,alt:"Profile",className:"w-full h-full object-cover"}):(0,t.jsx)("span",{className:"text-gray-400 text-2xl",children:"?"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm text-gray-900 font-medium",children:"Profile Photo"}),(0,t.jsxs)("label",{className:"inline-block mt-1 px-3 py-1.5 bg-[#0065f0] text-white text-xs font-semibold rounded-lg cursor-pointer hover:bg-blue-700 transition-colors",children:[(0,t.jsx)(en.Upload,{className:"w-3 h-3 inline mr-1"}),"Upload Photo",(0,t.jsx)("input",{type:"file",accept:"image/*",onChange:t=>{let r=t.target.files?.[0];if(r){if(r.size>5242880)return void i("File size must be under 5 MB");i(""),e.photoPreview&&URL.revokeObjectURL(e.photoPreview),s({photoPreview:URL.createObjectURL(r),photoFile:r})}},className:"hidden"})]}),(0,t.jsx)("p",{className:"text-gray-400 text-xs mt-0.5",children:"JPG, PNG or GIF · Max 5 MB"}),a&&(0,t.jsx)("p",{className:"text-red-500 text-xs mt-0.5",children:a})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Your Full Name *"}),(0,t.jsx)("input",{type:"text",value:e.fullName,onChange:e=>s({fullName:e.target.value}),placeholder:"e.g. John Smith",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Business / Company Name"}),(0,t.jsx)("input",{type:"text",value:e.companyName,onChange:e=>s({companyName:e.target.value}),placeholder:"e.g. Smith Electric LLC",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Trade / Category *"}),(0,t.jsxs)("select",{value:e.serviceId??"",disabled:c||0===n.length,onChange:e=>{let t=e.target.value,r=n.find(e=>String(e.value)===t);s({serviceId:r?r.value:null,trade:r?r.label:""})},className:"w-full pl-3 pr-8 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0] text-gray-700 disabled:bg-gray-50 disabled:text-gray-400",children:[(0,t.jsx)("option",{value:""}),n.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))]}),!c&&0===n.length&&(0,t.jsx)("p",{className:"text-red-500 text-xs mt-1",children:"Trades couldnât be loaded. Try again in a moment."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Primary Location"}),(0,t.jsx)("input",{type:"text",value:e.location,onChange:e=>s({location:e.target.value}),placeholder:"City, State",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Years of Experience"}),(0,t.jsx)("input",{type:"text",value:e.experience,onChange:e=>s({experience:e.target.value}),placeholder:"e.g. 10",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]}),(0,t.jsx)("button",{onClick:()=>l("contact"),disabled:!x,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors",children:"Continue to Contact >"}),(0,t.jsx)("p",{className:"text-center text-gray-400 text-xs",children:"Only Name & Trade are required"})]})}var ed=e.i(91511);function ex({formData:e,updateForm:s}){let{setCreateSubStep:l}=(0,r.useProfileWizard)();return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-gray-900 text-sm font-medium mb-1",children:[(0,t.jsx)(O.Phone,{className:"w-3.5 h-3.5"})," Business Phone"]}),(0,t.jsx)("input",{type:"tel",value:e.businessPhone,onChange:e=>s({businessPhone:e.target.value}),placeholder:"(520) 440-5571",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Hourly Rate"}),(0,t.jsx)("input",{type:"text",value:e.hourlyRate,onChange:e=>s({hourlyRate:e.target.value}),placeholder:"e.g. $85â$120",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Email"}),(0,t.jsx)("input",{type:"email",value:e.email,onChange:e=>s({email:e.target.value}),placeholder:"[email protected]",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-gray-900 text-sm font-medium mb-1",children:[(0,t.jsx)(ed.Globe,{className:"w-3.5 h-3.5"})," Website"]}),(0,t.jsx)("input",{type:"url",value:e.website,onChange:e=>s({website:e.target.value}),placeholder:"yoursite.com",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Google Review Profile Link"}),(0,t.jsx)("input",{type:"url",value:e.googleUrl,onChange:e=>s({googleUrl:e.target.value}),placeholder:"https://g.page/your-business/review",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"}),(0,t.jsx)("p",{className:"text-gray-400 text-xs mt-1",children:"Let clients leave you Google ratings directly"})]}),(0,t.jsx)("button",{onClick:()=>l("about"),className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 text-white rounded-xl text-sm font-semibold transition-colors",children:"Continue to About >"}),(0,t.jsx)("button",{onClick:()=>l("about"),className:"w-full text-gray-400 text-sm hover:text-gray-600",children:"Skip for now"})]})}function eu({label:e,placeholder:s,tags:r,onAdd:l,onRemove:a}
1){let[i,n]=(0,L.useState)(""),o=()=>{i.trim()&&!r.includes(i.trim())&&(l(i.trim()),n(""))};return(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:e}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("input",{type:"text",value:i,onChange:e=>n(e.target.value),placeholder:s,className:"flex-1 px-4 py-2.5 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]",onKeyDown:e=>"Enter"===e.key&&(e.preventDefault(),o())}),(0,t.jsx)("button",{onClick:o,disabled:!i.trim(),className:"px-3 py-2.5 bg-gray-100 hover:bg-gray-200 disabled:opacity-50 text-gray-600 rounded-xl text-sm font-medium transition-colors",children:"+ Add"})]}),r.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:r.map((e,s)=>(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs text-gray-600 border border-gray-200 rounded-full px-2.5 py-1",children:[e,(0,t.jsx)("button",{onClick:()=>a(s),className:"text-gray-400 hover:text-gray-600",children:(0,t.jsx)(h.X,{className:"w-3 h-3"})})]},e))})]})}function em({formData:e,updateForm:s}){let{setCreateSubStep:l}=(0,r.useProfileWizard)();return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Bio / About You"}),(0,t.jsx)("textarea",{value:e.bio,onChange:e=>s({bio:e.target.value}),placeholder:"Tell clients what makes you the right contractor for the job...",rows:4,className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0] resize-none"})]}),(0,t.jsx)(eu,{label:"Skills & Specialties",placeholder:"e.g. Panel Upgrades, EV Chargers...",tags:e.skills,onAdd:t=>s({skills:[...e.skills,t]}),onRemove:t=>s({skills:e.skills.filter((e,s)=>s!==t)})}),(0,t.jsx)(eu,{label:"Cities / Regions You Serve",placeholder:"e.g. Seattle, Bellevue, Tacoma...",tags:e.regions,onAdd:t=>s({regions:[...e.regions,t]}),onRemove:t=>s({regions:e.regions.filter((e,s)=>s!==t)})}),(0,t.jsx)(eu,{label:"Certifications & Licenses",placeholder:"e.g. WA State Contractor License...",tags:e.certs,onAdd:t=>s({certs:[...e.certs,t]}),onRemove:t=>s({certs:e.certs.filter((e,s)=>s!==t)})}),(0,t.jsx)("button",{onClick:()=>l("gallery"),className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 text-white rounded-xl text-sm font-semibold transition-colors",children:"Continue to Gallery >"}),(0,t.jsx)("button",{onClick:()=>l("gallery"),className:"w-full text-gray-400 text-sm hover:text-gray-600",children:"Skip for now"})]})}var ef=e.i(70990),eh=e.i(28623),ep=e.i(57557),eb=e.i(36173);function eg({formData:e,updateForm:s}){let{setStep:l}=(0,r.useProfileWizard)(),[a,i]=(0,L.useState)(!1),[n,o]=(0,L.use
1State)(""),c=(0,L.useRef)([]);(0,L.useEffect)(()=>{let e=c.current;return()=>{e.forEach(e=>URL.revokeObjectURL(e))}},[]);let d=async()=>{if(!e.photoFile&&0===e.photos.length)return"";let{user:t}=await (0,W.getUser)();if(!t)return"Your profile was saved, but your session could not be confirmed to upload photos. You can add them in Settings â Profile.";let r=Number(t.id),l=async e=>{let t=new FormData;return t.append("image",e),(0,eb.uploadProfilePhoto)(r,t)},a=[];for(let t of e.photos)(await l(t.file)).success||a.push(t);let i=null;e.photoFile&&((await l(e.photoFile)).success||(i=e.photoFile)),s({photos:a,photoFile:i});let n=a.length+ +!!i;return 0===n?"":`Your profile was saved, but ${n} photo${1===n?"":"s"} could not be uploaded. Press the button again to retry just those, or add them later in Settings â Profile.`},x=async()=>{i(!0),o("");let t=await (0,ep.updateProfile)(function(e){let t={},s={},r=e.fullName.trim();r&&(t.name=r);let l=e.email.trim();l&&(t.email=l);let a=e.companyName.trim();a&&(s.company=a),null!==e.serviceId&&(s.service_id=e.serviceId);let i=e.businessPhone.trim();i&&(s.phone=i);let n=e.website.trim();n&&(s.website_url=n);let o=e.bio.trim();o&&(s.about=o);let c=e.location.trim();if(c){let[e,...t]=c.split(",");e.trim()&&(s.city=e.trim());let r=t.join(",").trim();r&&(s.state=r)}let d=e.regions.map(e=>e.trim()).filter(Boolean);d.length>0&&(s.serving_locations=d.map(e=>({location:e})));let x=e.certs.map(e=>e.trim()).filter(Boolean);return x.length>0&&(s.certifications=x.map(e=>({name:e}))),Object.keys(s).length>0&&(t.business=s),t}(e));if(!t.success){i(!1),o(t.error||"Could not save your profile. Please try again.");return}let s=await d();(i(!1),s)?o(s):l(5)};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-gray-900 text-sm font-medium",children:"Project Gallery"}),(0,t.jsx)("p",{className:"text-gray-400 text-xs mt-0.5",children:"Upload photos of your past work â these appear at the top of your profile page. Up to 12 photos."})]}),(0,t.jsxs)("label",{className:"flex flex-col items-center justify-center w-full p-8 border-2 border-dashed border-gray-200 rounded-xl cursor-pointer hover:border-[#0065f0] hover:bg-blue-50/30 transition-colors",children:[(0,t.jsx)(ef.ImageIcon,{className:"w-8 h-8 text-gray-300 mb-2"}),(0,t.jsx)("span",{className:"text-gray-500 text-sm font-medium",children:"Click to upload photos"}),(0,t.jsx)("span",{className:"text-gray-400 text-xs mt-1",children:"JPG, PNG, WEBP · Multiple files supported"}),(0,t.jsx)("input",{type:"file",accept:"image/*",multiple:!0,onChange:t=>{let r=Array.from(t.target.files||[]).map(e=>{let t=URL.createObjectURL(e);return c.current.push(t),{file:e,preview:t}});s({photos:[...e.photos,...r].slice(0,12)})},className:"hidden"})]}),e.photos.length>0&&(0,t.jsx)("div",{className:"grid grid-cols-4 gap-2",children:e.photos.map((e,s)=>(0,t.jsx)("img",{src:e.preview,alt:`Upload ${s+1}`,className:"w-full aspect-square object-cover rounded-lg"},e.preview))}),n&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:n}),(0,t.jsxs)("button",{onClick:x,disabled:a,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors flex items-center justify-center gap-2",children:[(0,t.jsx)(eh.Sparkles,{className:"w-4 h-4"}),a?"Creating...":"Create My Profile"]}),(0,t.jsx)("button",{onClick:x,className:"w-full text-gray-400 text-sm hover:text-gray-600",children:"Skip gallery & finish"})]})}let ey={fullName:"",companyName:"",trade:"",serviceId:null,location:"",experience:"",photoPreview:null,photoFile:null,businessPhone:"",hourlyRate:"",email:"",website:"",googleUrl:"",bio:"",skills:[],regions:[],certs:[],photos:[]},ej=[{id:"identity",label:"Identity"},{id:"contact",label:"Contact"},{id:"about",label:"About"},{id:"gallery",label:"Gallery"}];function ev(){let{createSubStep:e,setCreateSubStep:s}=(0,r.useProfileWizard)(),[l,a]=(0,L.useState)(ey),i=e=>{a(t=>({...t,...e}))},n=ej.findIndex(t=>t.id===e)+1;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-gray-500 text-xs mb-4",children:["Step ",n," of ",ej.length," â"," ",ej.find(t=>
1t.id===e)?.label]}),(0,t.jsx)("div",{className:"flex border-b border-gray-200 mb-5",children:ej.map(r=>(0,t.jsx)("button",{onClick:()=>s(r.id),className:`flex-1 pb-2 text-sm font-medium border-b-2 transition-colors ${e===r.id?"border-[#0065f0] text-[#0065f0]":"border-transparent text-gray-400 hover:text-gray-600"}`,children:r.label},r.id))}),"identity"===e&&(0,t.jsx)(ec,{formData:l,updateForm:i}),"contact"===e&&(0,t.jsx)(ex,{formData:l,updateForm:i}),"about"===e&&(0,t.jsx)(em,{formData:l,updateForm:i}),"gallery"===e&&(0,t.jsx)(eg,{formData:l,updateForm:i})]})}var eN=e.i(96315),ew=e.i(89664);let eC=(0,A.createServerReference)("4093547f7a6c8226ef4eb3ca6a687aacc686340aee",A.callServer,void 0,A.findSourceMapURL,"requestVerification"),ek=(0,A.createServerReference)("609df4710be502bf6465f176c52b766bbd912db34e",A.callServer,void 0,A.findSourceMapURL,"verifyPhoneOwnership"),eS=(0,A.createServerReference)("407c28bae8583d0b5a53ca78766e302511ea76fc21",A.callServer,void 0,A.findSourceMapURL,"sendEmailVerificationPin"),eP=(0,A.createServerReference)("604968414eb8f07f4190a6ba43a7a74c4392f2a314",A.callServer,void 0,A.findSourceMapURL,"verifyEmailOwnership");function eI({value:e,onChange:s}){return(0,t.jsx)("input",{type:"text",inputMode:"numeric",value:e,onChange:e=>s(e.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"⢠⢠⢠⢠⢠â¢",maxLength:6,autoFocus:!0,className:"w-full px-4 py-3 border border-yellow-300 rounded-xl text-sm text-center tracking-[0.4em] focus:outline-none focus:border-[#0065f0] bg-white"})}function e_(){let{selectedContractor:e,setClaimSubStep:s}=(0,r.useProfileWizard)(),l=e?.name?.trim()||e?.company?.trim()||"this profile",a="this profile"===l?"?":l.split(/\s+/).slice(0,2).map(e=>e[0]).join("").toUpperCase(),i=[e?.service?.label??void 0,[e?.city,e?.state].filter(Boolean).join(", ")].filter(Boolean).join(" · ");return(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-blue-50 border border-blue-100 rounded-xl",children:[(0,t.jsx)("div",{className:"w-10 h-10 rounded-full bg-[#0065f0] flex items-center justify-center text-white text-sm font-bold shrink-0",children:a}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("p",{className:"text-blue-900 text-sm font-bold truncate",children:["Claiming: ",l]}),i&&(0,t.jsx)("p",{className:"text-blue-700 text-xs truncate",children:i})]}),(0,t.jsx)("button",{onClick:()=>s("search"),className:"text-[#0065f0] text-sm font-medium hover:underline shrink-0",children:"Change"})]})}function eR(){let{identityForm:e,setIdentityForm:s}=(0,r.useProfileWizard)(),l="w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]";return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:["First Name ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",value:e.firstName,onChange:e=>s({firstName:e.target.value}),className:l})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:["Last Name ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{type:"text",value:e.lastName,onChange:e=>s({lastName:e.target.value}),className:l})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:"Business Name"}),(0,t.jsx)("input",{type:"text",value:e.businessName,onChange:e=>s({businessName:e.target.value}),className:l})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:["Email ",(0,t.jsx)("span",{className:"text-gray-400 font-normal",children:"(optional)"})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(eN.Mail,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,t.jsx)("input",{type:"email",value:e.email,onChange:e=>s({email:e.target.value}),placeholder:"[email protected]",className:"w-full pl-9 pr-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0]"})]})]})]})}function eM(){let{claimVerifyVariant:e,selectedContractor:s,setStep:l,setClaimSubStep:a,setDuplicateData:i,identityForm:n,setIdentityForm:o,markProfileClaimed:c}
1=(0,r.useProfileWizard)(),[d,x]=(0,L.useState)(""),[u,f]=(0,L.useState)(!1),[h,p]=(0,L.useState)(!1),[b,g]=(0,L.useState)(!1),[y,j]=(0,L.useState)(""),v=s?.phone||s?.google_phone,N=(0,T.isValidUsPhone)(v)?(0,T.normalizeUsPhone)(v):"",w=(0,T.formatPhone)(N),C=s?.email??"the profile email";(0,L.useEffect)(()=>{if(!s||n.firstName||n.lastName||n.businessName||n.email)return;let e=(s.name??"").trim().split(/\s+/).filter(Boolean);o({firstName:s.first_name??e[0]??"",lastName:s.last_name??(e.length>1?e.slice(1).join(" "):""),businessName:s.company??"",email:s.email??""})},[s]);let k=async()=>{if(s){p(!0),j("");try{if("email"===e){let e=await eS(String(s.id));e.success?f(!0):j(e.error||"Failed to send PIN")}else{if(!N)return void j("No phone number on file");await eC(N),f(!0)}}catch{j("Failed to send PIN. Try again.")}finally{p(!1)}}},S=async()=>{if(!s)return;let{user:e}=await (0,W.getUser)();if(!e)return void j("Authentication required");let t=await B(e.id,String(s.id));t.success?(c(String(s.id)),l(5)):t.error?.includes("duplicate")||t.error?.includes("409")?(i({existingAccount:{name:{existing:e.name??"",profile:s.name??""},businessName:{existing:"",profile:s.company??""},email:{existing:e.email??"",profile:s.email??""},phone:{existing:e.phone??"",profile:N}},claimedProfile:{name:s.name??"",businessName:s.company??"",email:s.email??"",phone:N}}),a("merge")):j(t.error||"Failed to claim profile")},P=async()=>{if(s){g(!0),j("");try{if("phone_match"===e)await S();else if("phone_different"===e){let e=await ek(d,N);e.success?await S():j(e.error||"Invalid PIN")}else if("email"===e){let e=await eP(d,String(s.id));e.success?await S():j(e.error||"Invalid PIN")}}catch{j("Something went wrong. Please try again.")}finally{g(!1)}}},I=()=>(0,t.jsxs)("p",{className:"text-center text-sm text-gray-500",children:["Having Trouble?"," ",(0,t.jsx)("button",{onClick:()=>a("help"),className:"text-[#0065f0] hover:underline",children:"Email us"})]});return"phone_match"===e?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-4 bg-green-50 border border-green-200 rounded-xl",children:[(0,t.jsx)(m.CheckCircle2,{className:"w-4 h-4 text-green-600 shrink-0"}),(0,t.jsxs)("p",{className:"text-green-800 text-sm font-medium",children:["SMS verified â ",w]})]}),(0,t.jsx)(e_,{}),(0,t.jsxs)("div",{className:"p-4 bg-blue-50 border border-blue-100 rounded-xl",children:[(0,t.jsxs)("p",{className:"text-blue-900 text-sm font-semibold flex items-center gap-1.5",children:[(0,t.jsx)(ew.Check,{className:"w-4 h-4"})," Account phone same as directory profile"]}),(0,t.jsx)("p",{className:"text-blue-700 text-sm mt-1 pl-5",children:"No further verification needed"})]}),y&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:y}),(0,t.jsxs)("button",{onClick:P,disabled:b,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors flex items-center justify-center gap-2",children:[(0,t.jsx)(H.Shield,{className:"w-4 h-4"}),b?"Finishing...":"Finish Verification"]})]}):"phone_different"===e?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(e_,{}),(0,t.jsx)(eR,{}),(0,t.jsxs)("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-xl space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-orange-100 rounded-full flex items-center justify-center shrink-0 mt-0.5",children:(0,t.jsx)(O.Phone,{className:"w-4 h-4 text-orange-500"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-yellow-900 text-sm font-semibold",children:"Profile phone differs from yours"}),(0,t.jsx)("p",{className:"text-yellow-800 text-sm mt-1",children:u?"PIN sent to profile phone â":`PIN will be sent to profile phone : ${w}`})]})]}),u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eI,{value:d,onChange:x}),(0,t.jsx)("button",{onClick:k,disabled:h,className:"text-sm text-[#0065f0] hover:underline disabled:opacity-50",children:h?"Sending...":"Re Send Pin"})]}):(0,t.jsx)("button",{onClick:k,disabled:h,className:"w-full py-3 bg-orange-500 hover:bg-orange-600 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors",children:h?"Sending...":"Send Pin"})]}),y&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:y}),(0,t.jsxs)("button",{onClick:P,disabled:!u||d.length<4||b,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors flex items-center justify-center gap-2",children:[(0,t.jsx)(H.Shield,{className:"w-4 h-4"}),b?"Verifying...":"Finish Verification"]}),(0,t.jsx)(I,{})]}):"email"===e?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(e_,{}),(0,t.jsx)(eR,{}),(0,t.jsxs)("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-xl space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-orange-100 rounded-full flex items-center justify-center shrink-0 mt-0.5",children:(0,t.jsx)(eN.Mail,{className:"w-4 h-4 text-orange-500"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-yellow-900 text-sm font-semibold",children:"No profile phone available"}),(0,t.jsx)("p",{className:"text-yellow-800 text-sm mt-1",children:u?"PIN sent to profile email â":`PIN will be sent to profile email : ${C}`})]})]}),u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eI,{value:d,onChange:x}),(0,t.jsx)("button",{onClick:k,disabled:h,className:"text-sm text-[#0065f0] hover:underline disabled:opacity-50",children:h?"Sending...":"Re Send Pin"})]}):(0,t.jsx)("button",{onClick:k,disabled:h,className:"w-full py-3 bg-orange-500 hover:bg-orange-600 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors",children:h?"Sending...":"Send Pin"})]}),y&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:y}),(0,t.jsxs)("button",{onClick:P,disabled:!u||d.length<4||b,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors flex items-center justify-center gap-2",children:[(0,t.jsx)(H.Shield,{className:"w-4 h-4"}),b?"Verifying...":"Submit Claim"]}),(0,t.jsx)(I,{})]}):null}let eU=[{key:"name",label:"Name"},{key:"businessName",label:"Business"},{key:"email",label:"Email"},{key:"phone",label:"Phone"}];function eE(){let{duplicateData:e,selectedContractor:s,setStep:l,setClaimSubStep:a,setMergeChoices:i,markProfileClaimed:n}
1=(0,r.useProfileWizard)(),[o,c]=(0,L.useState)(!1),[d,x]=(0,L.useState)(""),[u,m]=(0,L.useState)(()=>{let e={};return eU.forEach(({key:t})=>{e[t]="profile"}),e}),f=(e,t)=>{m(s=>({...s,[e]:t}))},h=async()=>{if(s){c(!0),x(""),i(u);try{let{user:e}=await (0,W.getUser)();if(!e)return void x("Authentication required");let t=await B(e.id,String(s.id));t.success?(n(String(s.id)),l(5)):x(t.error||"Failed to finish claim")}catch{x("Something went wrong. Please try again.")}finally{c(!1)}}};if(!e)return null;let p=e.claimedProfile.name||s?.name||"this profile";return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"p-4 bg-yellow-50 border border-yellow-200 rounded-xl",children:[(0,t.jsx)("p",{className:"text-yellow-900 text-sm font-semibold",children:"Duplicate information found"}),(0,t.jsxs)("p",{className:"text-yellow-800 text-sm mt-1",children:["We found an existing account while claiming ",p,". Choose which details should remain on your dashboard profile."]})]}),(0,t.jsx)("div",{className:"space-y-3",children:eU.map(({key:s,label:r})=>{let l=e.existingAccount[s],a="object"==typeof l?l.existing:"",i="object"==typeof l?l.profile:"",n=u[s];return(0,t.jsxs)("div",{className:"border border-gray-200 rounded-xl overflow-hidden",children:[(0,t.jsx)("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:(0,t.jsx)("p",{className:"text-sm font-semibold text-gray-700",children:r})}),(0,t.jsxs)("div",{className:"grid grid-cols-2",children:[(0,t.jsxs)("button",{onClick:()=>f(s,"existing"),className:`p-4 text-left transition-colors ${"existing"===n?"bg-blue-50":"bg-white hover:bg-gray-50"}`,children:[(0,t.jsx)("p",{className:`text-[11px] font-semibold mb-1 tracking-wide ${"existing"===n?"text-[#0065f0]":"text-gray-400"}`,children:"EXISTING ACCOUNT"}),(0,t.jsx)("p",{className:"text-sm text-gray-900 break-words",children:a||"Not provided"})]}),(0,t.jsxs)("button",{onClick:()=>f(s,"profile"),className:`p-4 text-left transition-colors border-l border-gray-200 ${"profile"===n?"bg-blue-50":"bg-white hover:bg-gray-50"}`,children:[(0,t.jsx)("p",{className:`text-[11px] font-semibold mb-1 tracking-wide ${"profile"===n?"text-[#0065f0]":"text-gray-400"}`,children:"CLAIMED PROFILE"}),(0,t.jsx)("p",{className:"text-sm text-gray-900 break-words",children:i||"Not provided"})]})]})]},s)})}),d&&(0,t.jsx)("p",{className:"text-red-500 text-sm",children:d}),(0,t.jsx)("button",{onClick:h,disabled:o,className:"w-full py-3 bg-[#0065f0] hover:bg-blue-700 disabled:bg-gray-200 disabled:text-gray-400 text-white rounded-xl text-sm font-semibold transition-colors",children:o?"Saving...":"Save Choices & Finish Verification"}),(0,t.jsxs)("p",{className:"text-center text-sm text-gray-500",children:["Having Trouble?"," ",(0,t.jsx)("button",{onClick:()=>a("help"),className:"text-[#0065f0] hover:underline",children:"Email us"})]})]})}function eL({label:e,value:s}){return(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-gray-500 text-xs font-medium mb-1",children:e}),(0,t.jsx)("div",{className:"px-4 py-3 border border-gray-200 rounded-xl bg-gray-50 text-sm text-gray-700 truncate",children:s?.trim()||"Not provided"})]})}function eO(){let{selectedContractor:e}=(0,r.useProfileWizard)(),[s,l]=(0,L.useState)(null),[a,i]=(0,L.useState)("");(0,L.useEffect)(()=>{(0,W.getUser)().then(({user:e})=>l(e)).catch(()=>l(null))},[]);let n=e?.name?.trim()||e?.company?.trim()||"â",o=e?.service?.label??"",c=`mailto:[email protected]?subject=${encodeURIComponent(`Verification help â ${n}`)}&body=${encodeURIComponent(`Profile: ${n} 2Trade: ${o||"Not provided"} 3My phone: ${s?.phone||"Not provided"} 4My name: ${s?.name||"Not provided"} 5My email: ${s?.email||"Not provided"} 6 7Issue: 8${a}`)}`;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"p-4 bg-blue-50 border border-blue-100 rounded-xl",children:[(0,t.jsx)("p",{className:"text-blue-900 text-sm font-semibold",children:"Verification support request"}),(0,t.jsx)("p",{className:"text-blue-700 text-sm mt-1",children:"We'll prefill the profile and your current info so support can review the verification issue faster."})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(eL,{label:"Profile",value:n}),(0,t.jsx)(eL,{label:"Trade",value:o}),(0,t.jsx)(eL,{label:"Your phone",value:s?.phone}),(0,t.jsx)(eL,{label:"Your name",value:s?.name}),(0,t.jsx)(eL,{label:"Business",value:e?.company}),(0,t.jsx)(eL,{label:"Email",value:s?.email})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-gray-900 text-sm font-medium mb-1",children:["What issue are you having with verification? ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("textarea",{value:a,onChange:e=>i(e.target.value),rows:4,placeholder:"Example: I no longer have access to the phone/email on file, but I can provide license documents or business records.",className:"w-full px-4 py-3 border border-gray-200 rounded-xl text-sm focus:outline-none focus:border-[#0065f0] resize-none"})]}),(0,t.jsxs)("a",{href:c,className:`w-full py-3 bg-[#0065f0] hover:bg-blue-700 text-white rounded-xl text-sm font-semibold transition-colors flex items-center justify-center gap-2 ${a.trim()?"":"pointer-events-none opacity-50"}`,children:[(0,t.jsx)(eN.Mail,{className:"w-4 h-4"}),"Email Support"]})]})}function eA(){let{isOpen:e,close:s,step:l,path:a,claimSubStep:i,createSubStep:n,preselectedProfileId:o,selectedContractor:c,duplicateData:d,setStep:x,setPath:u,setClaimSubStep:m,setCreateSubStep:f}=(0,r.useProfileWizard)(),{title:p,subtitle:b}=function(e,t,s,r){if(e<=2)return{title:"Create Your Profile",subtitle:"Join the RevLink contractor network"};if(3===e)return{title:"How do you want to start?",subtitle:"Pick the path that fits your situation"};if(4===e){if("claim"===t){if("search"===s)return{title:"Find Your Business",subtitle:"Search by name or trade"};if("results"===s)return{title:"Is this you?",subtitle:""};if("verify"===s)return{title:"Confirm Your Identity",subtitle:r?`For: ${r}`:""};
8if("merge"===s)return{title:"Resolve Duplicates",subtitle:"Choose which account details to keep"};if("help"===s)return{title:"Verification Help",subtitle:r?`For: ${r}`:""}}return"create"===t?{title:"Build Your Profile",subtitle:""}:{title:"Find Your Business",subtitle:"Search by name or trade"}}return 5===e?{title:"Profile Claimed!",subtitle:""}:{title:"",subtitle:""}}(l,a,i,c?.name?.trim()||c?.company?.trim()||"");return(0,t.jsx)(I.Dialog,{open:e,onOpenChange:e=>!e&&s(),children:(0,t.jsxs)(I.DialogContent,{className:"sm:max-w-[480px] p-0 gap-0 border-0 overflow-hidden max-h-[90vh] overflow-y-auto [&>button:last-child]:hidden",children:[(0,t.jsxs)("div",{className:"bg-[#111827] px-5 py-4 flex items-center gap-3",children:[l>1&&l<5&&(0,t.jsx)("button",{onClick:()=>{if(4===l){if("claim"===a){if("help"===i)return void m(d?"merge":"verify");if("merge"===i)return void m("verify");if("verify"===i)return void m("results");if("results"===i)return void m("search")}if("create"===a){let e=["identity","contact","about","gallery"],t=e.indexOf(n);if(t>0)return void f(e[t-1])}return o?void s():(u(null),void x(3))}3===l?x(2):2===l&&x(1)},className:"text-gray-400 hover:text-white transition-colors",children:(0,t.jsx)(_.ArrowLeft,{className:"w-5 h-5"})}),(0,t.jsx)("div",{className:"w-9 h-9 bg-[#0065f0] rounded-xl flex items-center justify-center shrink-0",children:(0,t.jsx)(R.Search,{className:"w-5 h-5 text-white"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)(I.DialogTitle,{className:"text-white text-base font-bold leading-tight",children:p}),b&&(0,t.jsx)("p",{className:"text-gray-400 text-sm mt-0.5",children:b})]}),(0,t.jsx)("button",{onClick:s,className:"text-gray-400 hover:text-white transition-colors shrink-0",children:(0,t.jsx)(h.X,{className:"w-5 h-5"})})]}),(0,t.jsx)(E,{}),(0,t.jsxs)("div",{className:"px-5 pb-6",children:[1===l&&(0,t.jsx)(z,{}),2===l&&(0,t.jsx)(V,{}),3===l&&(0,t.jsx)(G,{}),4===l&&"claim"===a&&"search"===i&&(0,t.jsx)(X,{}),4===l&&"claim"===a&&"results"===i&&(0,t.jsx)(ea,{}),4===l&&"claim"===a&&"verify"===i&&(0,t.jsx)(eM,{}),4===l&&"claim"===a&&"merge"===i&&(0,t.jsx)(eE,{}),4===l&&"claim"===a&&"help"===i&&(0,t.jsx)(eO,{}),4===l&&"create"===a&&(0,t.jsx)(ev,{}),5===l&&(0,t.jsx)(ei,{})]})]})})}var eF=e.i(69756),eT=e.i(68905),e$=e.i(68590),ez=e.i(49546);function eD({className:e}){return(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",className:e,"aria-hidden":"true",focusable:"false",children:[(0,t.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3.5",stroke:"currentColor",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M6 4h3v16H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z",fill:"currentColor"}),(0,t.jsx)("path",{d:"M12.5 7h5M12.5 10.5h5M12.5 14h5M12.5 17.5h5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function eW(e){let t=e.other_participant;return t&&[t.service?.label,t.zip].filter(Boolean).join(" | ")||null}function eB({variant:e="dock"}){let{conversations:s,isLoadingList:r,openConversation:l,close:a,view:i,toggleExpanded:n,activeContact:o,contactConversationId:c}
8=(0,eT.useChat)(),[d,x]=(0,L.useState)("referral"),u=s.filter(e=>e.type===d),m="thread"===i.kind?i.conversationId:null,f="pane"===e;return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[f?(0,t.jsxs)("header",{className:"flex h-[84px] shrink-0 items-center justify-between border-b border-[#e8e8ed] px-6",children:[(0,t.jsx)("p",{className:"text-xl font-bold leading-none text-gray-900",children:"Recent Chats"}),(0,t.jsx)("button",{onClick:n,"aria-label":"Collapse conversation list",className:"text-gray-900 transition-colors hover:text-[#0065f0]",children:(0,t.jsx)(eD,{className:"h-6 w-6"})})]}):(0,t.jsxs)("header",{className:"flex shrink-0 items-center justify-between rounded-t-2xl bg-[#0065f0] px-4 py-3 text-white",children:[(0,t.jsx)("p",{className:"font-semibold",children:"Messages"}),(0,t.jsx)("button",{onClick:a,"aria-label":"Close chat",children:(0,t.jsx)(h.X,{className:"h-5 w-5"})})]}),(0,t.jsx)("div",{className:(0,b.cn)("flex shrink-0",f?"border-b border-[#e8e8ed] bg-[#f7f9fc]":"border-b border-gray-100"),children:["referral","direct"].map(e=>{let r="referral"===e?"Referrals":"Direct",l=s.reduce((t,s)=>s.type===e?t+s.unseen_messages:t,0),a=d===e;return(0,t.jsxs)("button",{onClick:()=>x(e),className:(0,b.cn)("flex flex-1 items-center justify-center gap-2 py-2.5 text-sm transition-colors",a&&f&&"-mb-px rounded-t-lg border border-[#e8e8ed] border-b-white bg-white font-semibold text-[#040036]",a&&!f&&"border-b-2 border-[#0065f0] font-semibold text-[#0065f0]",!a&&"text-gray-500 hover:text-gray-700"),children:[r,l>0&&(0,t.jsx)("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-[#0065f0] px-1.5 text-[11px] font-medium text-white",children:l})]},e)})}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[r&&0===s.length&&(0,t.jsx)("p",{className:"p-6 text-center text-sm text-gray-400",children:"Loadingâ¦"}),!r&&0===u.length&&(0,t.jsx)("p",{className:"p-6 text-center text-sm text-gray-400",children:"referral"===d?"No referral chats yet.":"No direct messages yet."}),(0,t.jsx)("ul",{children:u.map(e=>{let s=c===e.id?o?.name:null,{primary:r,secondary:a}=function(e,t){let s=e.other_participant?.name?.trim()||t?.trim()||null;if("referral"===e.type){let t=e.referral?.project?.description?.trim()||e.referral?.project?.message?.trim()||null;if(t)return{primary:t,secondary:s}}return{primary:s??"Unknown",secondary:eW(e)}}(e,s),i=e.other_participant?.name?.trim()||s||"Unknown",n=e.unseen_messages>0,d=e.id===m;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{onClick:()=>l(e.id),className:(0,b.cn)("flex w-full items-center gap-3 border-y px-4 py-3 text-left transition-colors",d?"border-[#dbe4f2] bg-[#eef3fc]":"border-transparent hover:bg-gray-50"),children:[(0,t.jsx)(ez.Monogram,{name:i,className:"h-10 w-10 text-sm"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:(0,b.cn)("truncate",f&&"font-semibold text-[#0065f0]",!f&&(n?"font-semibold text-gray-900":"text-gray-800")),children:r}),a&&(0,t.jsx)("p",{className:"truncate text-sm text-gray-500",children:a})]}),(0,t.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[!f&&e.last_message_sent_at&&(0,t.jsx)("span",{className:"text-[11px] text-gray-400",children:e.last_message_sent_at}),n&&(0,t.jsx)("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-[#0065f0] px-1.5 text-[11px] font-medium text-white",children:e.unseen_messages})]})]})},e.id)})})]})]})}var eV=e.i(99847);let eq=(0,A.createServerReference)("401436b074c0ac364ef377f343be37ce0653359099",A.callServer,void 0,A.findSourceMapURL,"getThreadHistory");function eH(e){return"system"in e&&!0===e.system?"system":"image"in e&&e.image?"image":"text"}function eY(e,t){return null!=t&&(!("system"in e)||!0!==e.system)&&e.user?._id===t}let eG=(0,A.createServerReference)("602ece27bc79a08d75bd65fa0a72fcca0711ab1023",A.callServer,void 0,A.findSourceMapURL,"sendMessage"),eK=0;function eX({text:e,createdAt:s,mine:r,pending:l=!1}){return(0,t.jsx)("div",{className:(0,b.cn)("flex",r?"justify-end":"justify-start"),children:(0,t.jsxs)("div",{className:(0,b.cn)("max-w-[78%] rounded-2xl px-4 py-2.5 transition-opacity",r?"bg-[#0065f0] text-white":"bg-gray-100 text-gray-900",l&&"opacity-70"),children:[(0,t.jsx)("p",{className:"whitespace-pre-line break-words text-sm leading-relaxed",children:e}),(0,t.jsx)("p",{className:(0,b.cn)("mt-1 text-[11px]",r?"text-blue-100":"text-gray-500"),children:l?"Sendingâ¦":(0,T.relativeTime)(s)})]})})}function eJ({text:e}){return(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)("span",{className:"rounded-full bg-gray-50 px-3 py-1 text-center text-xs text-gray-500",children:e})})}function eZ({image:e,mine:s,onOpen:r}){return(0,t.jsx)("div",{className:(0,b.cn)("flex",s?"justify-end":"justify-start"),children:(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":"Open photo",className:"max-w-[78%] curs
8or-zoom-in overflow-hidden rounded-2xl border border-gray-200 transition-opacity hover:opacity-90",children:(0,t.jsx)("img",{src:e,alt:"Shared image",className:"block max-w-full"})})})}var eQ=e.i(68208);function e0({items:e,currentUserId:s}){let[r,l]=(0,L.useState)(null),a=e.filter(e=>"image"===eH(e)),i=new Map(a.map((e,t)=>[e._id,t]));return(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[e.map(e=>{let r=eH(e);return"system"===r?(0,t.jsx)(eJ,{text:e.text},e._id):"image"===r?(0,t.jsx)(eZ,{image:e.image,mine:eY(e,s),onOpen:()=>l(i.get(e._id)??0)},e._id):(0,t.jsx)(eX,{text:e.text,createdAt:e.createdAt,mine:eY(e,s),pending:e._id<0},e._id)}),(0,t.jsx)(eQ.Lightbox,{images:a.map(e=>({src:e.image,title:"Shared image"})),index:r,onIndexChange:l,onClose:()=>l(null)})]})}function e5({title:e,subtitle:s}){let{openList:r,close:l,toggleExpanded:a,isExpanded:i}=(0,eT.useChat)();return(0,t.jsxs)("header",{className:"flex h-[84px] shrink-0 items-center gap-4 bg-[#0065f0] px-5 text-white",children:[(0,t.jsx)("button",{onClick:r,"aria-label":"Back to conversations",className:"lg:hidden",children:(0,t.jsx)(_.ArrowLeft,{className:"h-5 w-5"})}),!i&&(0,t.jsx)("button",{onClick:a,"aria-label":"Show conversation list",className:"hidden lg:inline-flex",children:(0,t.jsx)(eD,{className:"h-6 w-6"})}),(0,t.jsx)(ez.Monogram,{name:e,className:"h-11 w-11 bg-white/25 text-lg font-bold text-white"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-lg font-bold leading-tight",children:e}),(0,t.jsx)("p",{className:"truncate text-[13px] leading-tight text-blue-100",children:s})]}),(0,t.jsx)("button",{onClick:l,"aria-label":"Close chat",className:"text-white/70 transition-colors hover:text-white",children:(0,t.jsx)(h.X,{className:"h-5 w-5"})})]})}var e1=e.i(61246),e4=e.i(30274);function e2({onSend:e,disabled:s=!1}){let[r,l]=(0,L.useState)(""),a=r.trim(),i=a.length>0&&!s,n=()=>{i&&(e(a),l(""))};return(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-3 border-t border-gray-100 p-4",children:[(0,t.jsx)("input",{value:r,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),n())},placeholder:"Type a message...",disabled:s,className:"h-11 flex-1 rounded-[10px] border border-[#e3e5ee] px-4 text-sm outline-none placeholder:text-gray-400 focus:border-[#0065f0] disabled:bg-[#fafbfd]"}),(0,t.jsx)("button",{type:"button",onClick:n,disabled:!i,className:(0,b.cn)("flex h-11 w-11 shrink-0 items-center justify-center rounded-[10px] text-white transition-colors",i?"bg-[#0065f0] hover:bg-[#0057d4]":"bg-[#eceef6] text-gray-400"),"aria-label":"Send message",children:(0,t.jsx)(e4.Send,{className:"h-4 w-4"})})]})}var e6=e.i(73812);function e3({conversationId:e,onMessage:t}){return(0,e6.useEchoPublic)(`chat.${e}`,"MessageSent",e=>{t(e.message)}),null}var e7=e.i(38255);function e8(){return(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-8 text-center",children:[(0,t.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-[#eef4ff]",children:(0,t.jsx)(e$.MessageSquare,{className:"h-6 w-6 text-[#0065f0]"})}),(0,t.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:"No messages yet"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"Send the first message to start the conversation."})]})}function e9({onRetry:e}){return(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-8 text-center",children:[(0,t.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-[#fdeeea]",children:(0,t.jsx)(eV.AlertCircle,{className:"h-6 w-6 text-[#c2410c]"})}),(0,t.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:"Couldn't load this conversation"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"The messages didn't come through."}),(0,t.jsx)("button",{onClick:e,className:"mt-4 rounded-[10px] bg-[#0065f0] px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-[#0057d4]",children:"Try again"})]})}function te({conversationId:e}){let{currentUserId:s,conversations:r,activeContact:l,contactConversationId:a}=(0,eT.useChat)(),{messages:n,isLoading:o,error:c,refetch:d,appendMessage:x}
8=function(e){let[t,s]=(0,L.useState)([]),[r,l]=(0,L.useState)(!1),[a,i]=(0,L.useState)(null),n=(0,L.useCallback)(async()=>{l(!0);try{let t=await eq(e);t.ok?(s([...t.data].sort((e,t)=>{let s=Date.parse(e.createdAt)||0,r=Date.parse(t.createdAt)||0;return s===r?e._id-t._id:s-r})),i(null)):i(t.error)}finally{l(!1)}},[e]);return(0,L.useEffect)(()=>{n()},[n]),{messages:t,isLoading:r,error:a,refetch:n,appendMessage:(0,L.useCallback)(e=>{s(t=>[...t,e])},[])}}(e),{showToast:u}=(0,i.useToast)(),[,m]=(0,L.useTransition)(),f=(0,L.useRef)(null),[h,p]=(0,L.useOptimistic)(n,(e,t)=>[...e,t]),b=0===h.length,g=r.find(t=>t.id===e),y=g?.other_participant??null,j=l&&a===e?l:null,v=y?.name?.trim()||j?.name||"Conversation",N=(g?eW(g):null)||j?.role||(g?.type==="referral"?"Referral":"Direct message"),w=y?(0,e7.isLikelyOffline)(y):!!j?.offline;return(0,L.useEffect)(()=>{f.current?.scrollTo({top:f.current.scrollHeight})},[h.length]),(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[eF.isEchoConfigured&&(0,t.jsx)(e3,{conversationId:e,onMessage:x}),(0,t.jsx)(e5,{title:v,subtitle:N}),w&&(0,t.jsx)("p",{className:"shrink-0 bg-[#f7f8fc] px-6 py-3 text-center text-sm leading-snug text-[#e0492f]",children:e7.OFFLINE_WARNING}),(0,t.jsxs)("div",{ref:f,className:"min-h-0 flex-1 overflow-y-auto px-4 py-4",children:[b&&o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{role:"status",className:"sr-only",children:"Loading messagesâ¦"}),(0,t.jsx)(e1.default,{size:"md",color:"#0065f0",className:"h-full"})]}),b&&!o&&c&&(0,t.jsx)(e9,{onRetry:d}),b&&!o&&!c&&(0,t.jsx)(e8,{}),!b&&(0,t.jsx)(e0,{items:h,currentUserId:s})]}),(0,t.jsx)(e2,{onSend:t=>{null!=s&&m(async()=>{p({_id:-(eK+=1),text:t,createdAt:new Date().toISOString(),user:{_id:s,name:"You"}});let r=await eG(e,t);r.ok?await d():u(r.error,{type:"error"})})}})]})}var tt=e.i(72721);function ts({onClose:e}){return(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[(0,t.jsx)("header",{className:"flex shrink-0 items-center justify-end px-4 py-3",children:(0,t.jsx)("button",{onClick:e,"aria-label":"Close chat",className:"text-gray-400 transition-colors hover:text-gray-700",children:(0,t.jsx)(h.X,{className:"h-5 w-5"})})}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 px-8 pb-12 text-center",children:[(0,t.jsx)("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-[#eef4ff]",children:(0,t.jsx)(e$.MessageSquare,{className:"h-6 w-6 text-[#0065f0]"})}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Pick a conversation to start reading."})]})]})}function tr({contact:e}){return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,t.jsx)(e5,{title:e?.name||"Conversation",subtitle:e?.role||"Openingâ¦"}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-hidden px-4 py-4",children:[(0,t.jsx)("p",{role:"status",className:"sr-only",children:"Opening conversationâ¦"}),(0,t.jsx)(e1.default,{size:"md",color:"#0065f0",className:"h-full"})]}),(0,t.jsx)(e2,{onSend:()=>{},disabled:!0})]})}function tl(){let{view:e,anchor:s,isExpanded:r,close:l,isConnecting:a,connectingTo:i}=(0,eT.useChat)();return(0,t.jsxs)("div",{className:(0,b.cn)("panel"===s?tt.PANEL_ANCHOR:tt.DEFAULT_ANCHOR,"flex h-[70vh] max-h-[600px] overflow-hidden rounded-2xl bg-white shadow-2xl",r?"md:w-[380px] lg:w-[700px]":"md:w-[380px]"),children:[r&&(0,t.jsx)("aside",{className:"hidden w-[260px] shrink-0 border-r border-gray-100 bg-white lg:flex lg:flex-col",children:(0,t.jsx)(eB,{variant:"pane"})}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col",children:a?(0,t.jsx)(tr,{contact:i}):"thread"===e.kind?(0,t.jsx)(te,{conversationId:e.conversationId}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:(0,b.cn)("h-full min-h-0",r&&"lg:hidden"),children:(0,t.jsx)(eB,{})}),r&&(0,t.jsx)("div",{className:"hidden h-full lg:block",children:(0,t.jsx)(ts,{onClose:l})})]})})]})}function ta(){let{isAuthenticated:e}=(0,s.useAuth)(),{isOpen:r}=(0,eT.useChat)();return e&&r?(0,t.jsx)(tl,{}):null}function ti({children:e}){return(0,t.jsx)(s.AuthProvider,{children:(0,t.jsx)(i.ToastProvider,{children:(0,t.jsx)(r.ProfileWizardProvider,{children:(0,t.jsx)(n.BreadcrumbProvider,{children:(0,t.jsx)(a.SidebarDataProvider,{children:(0,t.jsx)(l.SidebarProvider,{children:(0,t.jsx)(eF.EchoProvider,{children:(0,t.jsx)(eT.ChatProvider,{children:(0,t.jsxs)(g.NotificationProvider,{children:[e,(0,t.jsx)(c,{}),(0,t.jsx)(eA,{}),(0,t.jsx)(j,{}),(0,t.jsx)(ta,{})]})})})})})})})})})}e.s(["Providers",()=>ti],30824)},61431,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(18566);e.i(84004);var l=e.i(63327),a=e.i(46208);function i(){let{isOpen:e,setIsOpen:i}=(0,a.useSidebar)(),n=(0,r.usePathname)(),o=(0,s.useCallback)(()=>{i(!1)},[i]);return n.startsWith("/review")||n.startsWith("/project")?null:(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"lg:hidden",children:(0,t.jsx)(l.Sidebar,{isOpen:e,onClose:o,variant:"drawer"})})})}e.s(["GlobalSidebar",()=>i])}
8,8341,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var r={cancelIdleCallback:function(){return i},requestIdleCallback:function(){return a}};for(var l in r)Object.defineProperty(s,l,{enumerable:!0,get:r[l]});let a="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},i="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esModule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},79520,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var r={default:function(){return y},handleClientScriptLoad:function(){return p},initScriptLoader:function(){return b}};for(var l in r)Object.defineProperty(s,l,{enumerable:!0,get:r[l]});let a=e.r(55682),i=e.r(90809),n=e.r(43476),o=a._(e.r(74080)),c=i._(e.r(71645)),d=e.r(42732),x=e.r(22737),u=e.r(8341),m=new Map,f=new Set,h=e=>{let{src:t,id:s,onLoad:r=()=>{},onReady:l=null,dangerouslySetInnerHTML:a,children:i="",strategy:n="afterInteractive",onError:c,stylesheets:d}=e,u=s||t;if(u&&f.has(u))return;if(m.has(t)){f.add(u),m.get(t).then(r,c);return}let h=()=>{l&&l(),f.add(u)},p=document.createElement("script"),b=new Promise((e,t)=>{p.addEventListener("load",function(t){e(),r&&r.call(this,t),h()}),p.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});a?(p.innerHTML=a.__html||"",h()):i?(p.textContent="string"==typeof i?i:Array.isArray(i)?i.join(""):"",h()):t&&(p.src=t,m.set(t,b)),(0,x.setAttributesFromProps)(p,e),"worker"===n&&p.setAttribute("type","text/partytown"),p.setAttribute("data-nscript",n),d&&(e=>{if(o.default.preinit)return e.forEach(e=>{o.default.preinit(e,{as:"style"})});if("undefined"!=typeof window){let t=document.head;e.forEach(e=>{let s=document.createElement("link");s.type="text/css",s.rel="stylesheet",s.href=e,t.appendChild(s)})}})(d),document.body.appendChild(p)};function p(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,u.requestIdleCallback)(()=>h(e))}):h(e)}function b(e){e.forEach(p),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");f.add(t)})}function g(e){let{id:t,src:s="",onLoad:r=()=>{},onReady:l=null,strategy:a="afterInteractive",onError:i,stylesheets:x,...m}=e,{updateScripts:p,scripts:b,getIsSsr:g,appDir:y,nonce:j}=(0,c.useContext)(d.HeadManagerContext);j=m.nonce||j;let v=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let e=t||s;v.current||(l&&e&&f.has(e)&&l(),v.current=!0)},[l,t,s]);let N=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!N.current){if("afterInteractive"===a)h(e);else"lazyOnload"===a&&("complete"===document.readyState?(0,u.requestIdleCallback)(()=>h(e)):window.addEventListener("load",()=>{(0,u.requestIdleCallback)(()=>h(e))}));N.current=!0}},[e,a]),("beforeInteractive"===a||"worker"===a)&&(p?(b[a]=(b[a]||[]).concat([{id:t,src:s,onLoad:r,onReady:l,onError:i,...m,nonce:j}]),p(b)):g&&g()?f.add(t||s):g&&!g()&&h({...e,nonce:j})),y){if(x&&x.forEach(e=>{o.default.preinit(e,{as:"style"})}),"beforeInteractive"===a)if(!s)return m.dangerouslySetInnerHTML&&(m.children=m.dangerouslySetInnerHTML.__html,delete m.dangerouslySetInnerHTML),(0,n.jsx)("script",{nonce:j,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([0,{...m,id:t}])})`}});else return o.default.preload(s,m.integrity?{as:"script",integrity:m.integrity,nonce:j,crossOrigin:m.crossOrigin}:{as:"script",nonce:j,crossOrigin:m.crossOrigin}),(0,n.jsx)("script",{nonce:j,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([s,{...m,id:t}])})`}});"afterInteractive"===a&&s&&o.default.preload(s,m.integrity?{as:"script",integrity:m.integrity,nonce:j,crossOrigin:m.crossOrigin}:{as:"script",nonce:j,crossOrigin:m.crossOrigin})}return null}Object.defineProperty(g,"__nextScript",{value:!0});let y=g;("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esMo
8dule",{value:!0}),Object.assign(s.default,s),t.exports=s.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.