PageSourceSearch

https://www.wedypro.ai/_next/static/chunks/34593-a014ccf147c5937a.js?dpl=dpl_AHNLpxPe2gucefZiWgR4CAQP9Hn6

js wedypro.ai collected 2026-10-05 13:24:11 UTC 47,734 bytes, 1 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4d6d1d7c-a463-4b9d-b35c-a4b956a7dc1d",e._sentryDebugIdIdentifier="sentry-dbid-4d6d1d7c-a463-4b9d-b35c-a4b956a7dc1d")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[34593],{14517:(e,t,a)=>{a.d(t,{F:()=>f});var n=a(95155),s=a(12115),r=a(91394),l=a(30285),i=a(54165),o=a(92138),c=a(51154),d=a(5196),u=a(24357),m=a(33786),x=a(56671),p=a(97501),h=a(51824),g=a(20956);function f(e){var t,a,f;let{isOpen:v,onClose:y,smartDocument:j,onGenerateShareLink:b}=e,[w,N]=(0,s.useState)({}),[k,C]=(0,s.useState)(null),[A,S]=(0,s.useState)(null),{profile:P}=(0,h.x)(),F=null!=(a=j.requiresLoginToView)&&a,D=(0,p.Fw)(j.actionSummary),E=j.recipients||[],I=(null!=(f=null==P||null==(t=P.category)?void 0:t.toLowerCase())?f:"")!=="other",q=async e=>{if(w[e])return w[e];S(e);try{let t=await b(),a=(0,p.B0)(t,e);return N(t=>({...t,[e]:a})),a}finally{S(null)}},R=async e=>{try{let t=await q(e);await navigator.clipboard.writeText(t),C(e),setTimeout(()=>C(null),2e3),x.oR.success("Link copied to clipboard")}catch(e){console.error("Failed to generate share link:",e),x.oR.error("Failed to generate share link")}},_=async e=>{try{let t=await q(e);window.open(t,"_blank")}catch(e){console.error("Failed to generate share link:",e),x.oR.error("Failed to generate share link")}};return(0,n.jsx)(i.lG,{open:v,onOpenChange:y,children:(0,n.jsxs)(i.Cf,{className:"sm:max-w-[600px] max-h-[85vh] overflow-y-auto overflow-x-hidden [&>*]:min-w-0",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)(i.c7,{className:"space-y-1",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-primary",children:"Smart Document"}),(0,n.jsxs)(i.L3,{className:"text-2xl capitalize",children:["Share ",D]})]}),!F&&(0,n.jsxs)("div",{className:"rounded-lg border bg-muted/40 px-4 py-5",children:[(0,n.jsx)("div",{className:"flex items-center justify-center gap-2 sm:gap-3 overflow-x-auto",children:(I?["Planner","Client","Accountant"]:["Client","Partner","Accountant"]).map((e,t)=>(0,n.jsxs)(s.Fragment,{children:[t>0&&(0,n.jsx)(o.A,{className:"h-4 w-4 text-muted-foreground/50 shrink-0"}),(0,n.jsxs)("div",{className:"flex flex-col items-center gap-1.5 shrink-0",children:[(0,n.jsx)("div",{className:"flex h-10 w-10 sm:h-11 sm:w-11 items-center justify-center rounded-full bg-muted text-muted-foreground text-sm font-medium",children:e[0]}),(0,n.jsx)("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:e})]})]},e))}),(0,n.jsx)("p",{className:"text-center text-xs italic text-muted-foreground mt-3",children:"any of them can sign or pay"})]}),(0,n.jsx)(g.m,{isLocked:F}),(0,n.jsxs)("div",{className:"rounded-lg border p-3 space-y-1",children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary mb-1",children:"Recipients"}),(0,n.jsxs)("div",{className:"space-y-1 max-h-[280px] overflow-y-auto",children:[E.map(e=>{let t=e.leadId;if(!t||"string"==typeof t)return null;let a=t._id,s=t.name?t.name.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"??",i=A===a;return(0,n.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,n.jsx)(r.eu,{className:"h-9 w-9 flex-shrink-0",children:(0,n.jsx)(r.q5,{className:"bg-muted text-muted-foreground text-xs font-medium",children:s})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium truncate",children:t.name||"Unknown"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:t.email})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,n.jsxs)(l.$,{variant:"outline",size:"sm",className:"cursor-pointer h-8 px-3 text-xs",onClick:()=>R(a),disabled:i,children:[i?(0,n.jsx)(c.A,{className:"h-3.5 w-3.5 animate-spin"}):k===a?(0,n.jsx)(d.A,{className:"h-3.5 w-3.5 text-green-600"}):(0,n.jsx)(u.A,{className:"h-3.5 w-3.5"}),(0,n.jsx)("span",{className:"ml-1.5",children:k===a?"Copied":"Copy link"})]}),(0,n.jsxs)(l.$,{variant:"ghost",size:"sm",className:"cursor-pointer h-8 px-2 text-xs text-muted-foreground",onClick:()=>_(a),disabled:i,children:[(0,n.jsx)("span",{className:"mr-1",children:"Open"}),(0,n.jsx)(m.A,{className:"h-3.5 w-3.5"})]})]})]},a)}),0===E.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No recipients yet"})]})]}),(0,n.jsx)(i.Es,{children:(0,n.jsx)(l.$,{onClick:y,className:"cursor-pointer",children:"Done"})})]})})}},16654:(e,t,a)=>{a.d(t,{Y:()=>i});var n=a(98449),s=a(2845),r=a(52778),l=a(63008);function i(e){if(!(null==e?void 0:e.enabled)||!1===e.displayInDocument||!e.expiresAt)return null;let t="string"==typeof e.expiresAt?new Date(e.expiresAt):e.expiresAt;if(isNaN(t.getTime()))return null;let a=new Date,i=(0,n.c)(t,a),o=(0,s.M)(t,a),c=(0,r.R)(t),d="warning";return c?d="expired":i<=2&&(d="critical"),{expiresAt:t,formattedDate:(0,l.GP)(t,"EEEE, MMMM do yyyy, 'at' h:mm a"),shortDate:(0,l.GP)(t,"EEE, MMM d, yyyy"),daysUntilExpiry:i,hoursUntilExpiry:o,isExpired:c,urgency:d}}},20956:(e,t,a)=>{a.d(t,{m:()=>i});var n=a(95155),s=a(32919),r=a(50430),l=a(23861);function i(e){let{isLocked:t,className:a=""}=e;return(0,n.jsxs)("div",{className:"grid gap-3 ".concat(t?"":"sm:grid-cols-2"," ").concat(a),children:[(0,n.jsxs)("div",{className:"rounded-lg border bg-muted/40 p-3 flex items-start gap-2.5",children:[(0,n.jsx)("div",{className:"mt-0.5 flex h-7 w-7 items-center justify-center rounded-full bg-background text-muted-foreground shrink-0",children:t?(0,n.jsx)(s.A,{className:"h-3.5 w-3.5"}):(0,n.jsx)(r.A,{className:"h-3.5 w-3.5"})}),(0,n.jsxs)("div",{className:"text-sm min-w-0",children:[(0,n.jsx)("p",{className:"font-medium text-foreground",children:t?"Only people listed below can act":"Anyone can sign or pay"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t?"Anyone not on the list can request access.":"No accounts or passwords. Whoever you send it to can just open it and go."})]})]}),!t&&(0,n.jsxs)("div",{className:"rounded-lg border bg-muted/40 p-3 flex items-start gap-2.5",children:[(0,n.jsx)("div",{className:"mt-0.5 flex h-7 w-7 items-center justify-center rounded-full bg-background text-muted-foreground shrink-0",children:(0,n.jsx)(l.A,{className:"h-3.5 w-3.5"})}),(0,n.jsxs)("div",{className:"text-sm min-w-0",children:[(0,n.jsx)("p",{className:"font-medium text-foreground",children:"You’ll always know who acted"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Pick a name below and they get the updates, even if someone else does the signing or paying."})]})]})]})}},24372:(e,t,a)=>{a.d(t,{A:()=>
1o,V:()=>c});var n=a(95155),s=a(12115),r=a(46102);let l={dashed:"— — — —",dotted:"\xb7 \xb7 \xb7 \xb7 \xb7 \xb7 \xb7 \xb7"},i=(0,s.memo)(e=>{let{tooltip:t,variant:a="dashed",className:s=""}=e;return(0,n.jsxs)(r.m_,{children:[(0,n.jsx)(r.k$,{asChild:!0,children:(0,n.jsx)("span",{className:"\n              text-muted-foreground/60\n              cursor-help\n              border-b border-dashed border-muted-foreground/40\n              hover:text-muted-foreground hover:border-muted-foreground\n              transition-colors\n              ".concat(s,"\n            ").trim(),children:l[a]})}),(0,n.jsx)(r.ZI,{side:"top",className:"max-w-[250px]",children:(0,n.jsx)("p",{children:t})})]})});i.displayName="TemplateFieldPlaceholder";let o=i,c={companyInfo:"Company info is auto-filled from your profile when you create a file from the template.",billTo:"Bill to is auto-filled and can be edited when you create a file from the template.",invoiceNumber:"Invoice number will be generated when you create a file from the template.",projectDetails:"Project details will be filled when you create a file from the template.",clientSignature:"Client signature will be collected when you create a file from the template.",clientSignatureBlock:"Client signature block is configured when you create a file from the template. Add client details and collect their signature after creating the document.",vendorSignatureName:"Your name is auto-filled from your profile when you create a file from the template.",clientSignatureName:"Assigned when you create a file from the template. You can assign a lead to each signature.",vendorSignatureEmail:"Your email is auto-filled from your profile when you create a file from the template.",clientSignatureEmail:"Assigned when you create a file from the template. You can assign a lead to each signature.",paymentStatus:"Payment status will be tracked when you create a file from the template."}},34593:(e,t,a)=>{a.d(t,{gH:()=>d,f_:()=>H,LE:()=>f,V_:()=>n.V,iP:()=>n.A,e3:()=>y,i6:()=>v});var n=a(24372);a(58354);var s=a(95155),r=a(12115),l=a(5196);let i=e=>{let{count:t}=e;return t?(0,s.jsxs)("span",{className:"ml-1 text-xs text-amber-600 dark:text-amber-400 font-normal whitespace-nowrap",children:["\xb7 ",t," ACH payment",1===t?"":"s"," pending"]}):null},o=e=>{let{action:t,isLast:a}=e,n=void 0!==t.complete?t.complete:t.total>0&&t.completed>=t.total;return(0,s.jsxs)("div",{className:"flex gap-x-2 items-start",children:[(0,s.jsx)("div",{className:"relative ".concat(a?"":"after:absolute after:top-5 after:-bottom-1 after:start-3.5 after:w-px after:-translate-x-[0.5px] after:bg-gray-300 dark:after:bg-neutral-700"),children:(0,s.jsx)("div",{className:"relative z-10 size-7 flex justify-center items-center",children:(0,s.jsx)(l.A,{className:"h-4 w-4 ".concat(n?"text-primary":"text-primary/60 dark:text-primary/50")})})}),(0,s.jsx)("div",{className:"grow flex items-center",children:(0,s.jsxs)("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2 mt-0.5",children:[t.label,(0,s.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",t.completed," of ",t.total," ",t.statusSuffix,")"]}),(0,s.jsx)(i,{count:t.achPendingCount})]})})]})},c=e=>{let{action:t}=e,a=void 0!==t.complete?t.complete:t.total>0&&t.completed>=t.total,n=t.questionProgress&&t.questionProgress.totalQuestions>0,r=n&&(void 0!==t.questionProgress.complete?t.questionProgress.complete:t.questionProgress.answeredCount>=t.questionProgress.totalQuestions);return(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(l.A,{className:"size-4 ".concat(a?"text-primary":"text-muted-foreground")}),(0,s.jsxs)("span",{className:"text-sm text-foreground font-medium",children:[t.label,t.total>0&&(0,s.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(",t.completed," of ",t.total," ",t.statusSuffix,")"]}),(0,s.jsx)(i,{count:t.achPendingCount})]})]}),n&&(0,s.jsxs)("div",{className:"flex items-center gap-2 ml-6 text-xs text-muted-foreground",children:[(0,s.jsx)(l.A,{className:"size-3 ".concat(r?"text-primary":"text-muted-foreground")}),(0,s.jsxs)("span",{children:["Questions (",t.questionProgress.answeredCount," of ",t.questionProgress.totalQuestions," answered)"]})]})]})},d=e=>{let{actions:t,variant:a="timeline"}=e;return 0===t.length?(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"No actions yet"}):"flat"===a?(0,s.jsx)("div",{className:"space-y-2",children:t.map((e,t)=>(0,s.jsx)(c,{action:e},t))}):(0,s.jsx)("div",{children:t.map((e,a)=>(0,s.jsx)(o,{action:e,isLast:a===t.length-1},a))})};var u=a(66766),m=a(57434),x=a(56239),p=a(92009),h=a(59390),g=a(46102);let f=e=>{let{title:t,thumbnail:a,pagesViewed:n,totalPages:r,actions:l,circularProgressSize:i="sm",actionVariant:o="timeline",showDates:c=!1,dates:f,formatDate:v,headerAction:y,statusIndicator:j,thumbnailSlot:b,onClick:w,className:N=""}=e,k=n>r?r:n,C=function(e){let t=new Set((null!=e?e:[]).filter(e=>"contract"===e||"invoice"===e||"questionnaire"===e));return 1===t.size?(0,x.S3)([...t][0]):m.A}(l.map(e=>e.type)),A=(0,s.jsx)("div",{className:"w-full h-full rounded-lg overflow-hidden bg-muted",children:a?(0,s.jsx)(u.default,{src:(0,p.Ay)(a,192,144),alt:t,width:192,height:144,className:"w-full h-full object-cover"}):(0,s.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-muted to-muted/50",children:(0,s.jsx)(C,{className:"h-10 w-10 text-muted-foreground
1/30"})})});return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 sm:gap-6 ".concat(N),onClick:w,role:w?"button":void 0,tabIndex:w?0:void 0,children:[(0,s.jsx)("div",{className:"flex-shrink-0 w-full sm:w-48 h-48 sm:h-auto sm:aspect-[4/3] sm:self-start",children:b||A}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsxs)(g.m_,{children:[(0,s.jsx)(g.k$,{asChild:!0,children:(0,s.jsx)("h3",{className:"text-base font-semibold text-foreground min-w-0 truncate",children:t})}),(0,s.jsx)(g.ZI,{className:"max-w-[420px]",children:t})]}),y]}),j&&(0,s.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:j}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6 items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs font-semibold text-muted-foreground mb-3 tracking-wider uppercase",children:"PAGES"}),(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(h.P,{value:n,max:r,size:i}),(0,s.jsxs)("p",{className:"text-sm font-medium text-foreground",children:[k," of ",r," viewed"]})]})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs font-semibold text-muted-foreground mb-3 tracking-wider uppercase",children:"ACTIONS"}),(0,s.jsx)(d,{actions:l,variant:o})]}),c&&f&&v&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs font-semibold text-muted-foreground mb-3 tracking-wider uppercase",children:"DATES"}),(0,s.jsxs)("div",{className:"space-y-2",children:[f.sentAt&&(0,s.jsxs)("div",{className:"text-sm text-foreground",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"Sent: "}),v(f.sentAt)]}),f.lastViewedAt&&(0,s.jsxs)("div",{className:"text-sm text-foreground",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"Last viewed: "}),v(f.lastViewedAt)]})]})]})]})]})]})};function v(e){return e.map(e=>"invoice"===e.type?{type:"invoice",label:"Invoice",completed:e.paidCount||0,total:e.totalCount||0,statusSuffix:"paid",achPendingCount:e.achPendingCount||0}:"contract"===e.type?{type:"contract",label:"Contract",completed:e.signedCount||0,total:e.totalCount||0,statusSuffix:"signed"}:"questionnaire"===e.type?{type:"questionnaire",label:"cover"===e.templateOrigin?"Cover":"questionnaire"===e.templateOrigin?"Questionnaire":e.pageTitle||"Custom",completed:e.answeredCount||0,total:e.totalCount||0,statusSuffix:"answered",complete:e.complete}:"services"===e.type?{type:"services",label:e.pageTitle||"Services",completed:e.selectedCount||0,total:e.totalCount||0,statusSuffix:"selected"}:{type:e.type,label:e.type,completed:0,total:e.totalCount||0,statusSuffix:""})}function y(e){return e.map(e=>{var t,a,n,s,r,l,i,o,c,d,u,m,x,p,h,g,f,v,y,j,b,w,N;if("invoice"===e.type)return{type:"invoice",label:"Invoice",completed:null!=(l=null==(t=e.summary)?void 0:t.paidCount)?l:0,total:null!=(o=null==(a=e.summary)?void 0:a.paymentsCount)?o:null!=(i=null==(n=e.paymentSchedule)?void 0:n.length)?i:0,statusSuffix:"paid",achPendingCount:null!=(c=null==(s=e.summary)?void 0:s.achPendingCount)?c:0,questionProgress:(null==(r=e.questionProgress)?void 0:r.totalQuestions)?e.questionProgress:void 0};if("contract"===e.type){let t=null!=(u=e.signatures)?u:[];return{type:"contract",label:"Contract",completed:t.filter(e=>!!e.signedAt).length,total:t.length,statusSuffix:"signed",questionProgress:(null==(d=e.questionProgress)?void 0:d.totalQuestions)?e.questionProgress:void 0}}if("questionnaire"===e.type){let t="cover"===e.templateOrigin||"questionnaire"===e.templateOrigin,a="cover"===e.templateOrigin?"Cover":"questionnaire"===e.templateOrigin?"Questionnaire":e.pageTitle||"Custom",n=null!=(g=null==(m=e.summary)?void 0:m.totalQuestions)?g:0,s=null!=(f=null==(x=e.summary)?void 0:x.answeredCount)?f:0,r=null!=(v=null==(p=e.summary)?void 0:p.totalServices)?v:0,l=null!=(y=null==(h=e.summary)?void 0:h.selectedCount)?y:0;return!t&&r>0?{type:"services",label:a,completed:l,total:r,statusSuffix:"selected",questionProgress:n>0?{answeredCount:s,totalQuestions:n,complete:e.complete}:void 0}:{type:"questionnaire",label:a,completed:s,total:n,statusSuffix:"answered",complete:e.complete}}return"services"===e.type?{type:"services",label:e.pageTitle||"Services",completed:null!=(w=null==(j=e.summary)?void 0:j.selectedCount)?w:0,total:null!=(N=null==(b=e.summary)?void 0:b.totalServices)?N:0,statusSuffix:"selected"}:{type:e.type,label:e.type,completed:0,total:0,statusSuffix:""}})}var j=a(35695),b=a(44838),w=a(54165),N=a(30285),k=a(62523),C=a(85057),A=a(44020),S=a(92657),P=a(89917),F=a(13717),D=a(24357),E=a(29676),I=a(38164),q=a(66516),R=a(50430),_=a(32919),L=a(39022),T=a(40646),z=a(62525),O=a(51154),B=a(41670),Q=a(57166),$=a(38676),M=a(56671),G=a(93045);function K(e){let{open:t,onOpenChange:a,sourceDocument:n,defaultEventId:l}=e,i=(0,j.useRouter)(),{withReturnTo:o,currentUrlAsReturnTo:c}=(0,$.h)(),[d,u]=(0,r.useState)("title"),[m,x]=(0,r.useState)(""),[p,h]=(0,r.useState)(!1),{duplicateSmartDocument:g,isDuplicatingSmartDocument:f}=(0,B.Hz)();(0,r.useEffect)(()=>{t&&n&&(x("".concat(n.title," (Copy)")),u("title"))},[t,n]);let v=e=>{e||setTimeout(()=>{u("title"),x("")},200),a(e)},y=async e=>{if(!n)return void M.oR.error("Missing required information");h(!0);try{var t;let a=await g.mutateAsync({sourceSmartDocumentId:n.id,targetEventId:e.eventId,title:m.trim()});if(!(null==(t=a.smartDocument)?void 0:t._id))throw Error("Failed to duplicate document");i.push(o("/create/smart-flow/".concat(a.smartDocument._id,"/edit"),c)),v(!1)}catch(e){console.error("Error duplicating document:",e)}finally{h(!1)}};return n?(0,s.jsx)(w.lG,{open:t,onOpenChange:v,children:(0,s.jsxs)(w.Cf,{className:"sm:max-w-[500px] max-h-[90vh] flex flex-col",onClick:e=>e.stopPropagation(),children:["title"===d&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(w.c7,{children:[(0,s.jsxs)(w.L3,{className:"flex items-center gap-2",children:[(0,s.jsx)(D.A,{className:"h-5 w-5"}),"Duplicate Document"]}),(0,s.jsxs)(w.rr,{children:['Create a copy of "',n.title,'"']})]}),(0,s.jsx)("div",{className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(C.J,{htmlFor:"newTitle",children:"New Document Title"}),(0,s.jsx)(k.p,{id:"newTitle",placeholder:"Enter title for the duplicate...",value:m,onChange:e=>x(e.target.value),autoFocus:!0})]})}),(0,s.jsxs)(w.Es,{className:"gap-2",children:[(0,s.jsx)(N.$,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),(0,s.jsx)(N.$,{onClick:()=>
1{if(!m.trim())return void M.oR.error("Please enter a title for the duplicate");u("event")},disabled:!m.trim(),children:"Continue"})]})]}),"event"===d&&(0,s.jsx)(G.I,{onConfirm:y,onBack:()=>{u("title")},isLoading:p||f,confirmLabel:"Duplicate Document",defaultEventId:l})]})}):null}var V=a(14517),Y=a(75655);function H(e){let{smartDocumentId:t,title:a,status:n,eventId:l,isLocked:i,hasPartialPayments:o,allPaymentsComplete:c,align:d="end",showViewActivity:u=!0}=e,m=(0,j.useRouter)(),{withReturnTo:x,currentUrlAsReturnTo:p}=(0,$.h)(),{updateSettings:h,deleteSmartDocument:f,isUpdatingSettings:v,isDeletingDocument:y}=(0,B.Xc)(),{archiveSmartDocument:G,isArchivingSmartDocument:H}=(0,B.Hz)({enabled:!1}),[W,U]=(0,r.useState)(!1),[J,X]=(0,r.useState)(!1),[Z,ee]=(0,r.useState)(a),[et,ea]=(0,r.useState)(!1),[en,es]=(0,r.useState)(!1),[er,el]=(0,r.useState)(!1),[ei,eo]=(0,r.useState)(!1),ec=(0,Q.b)({smartDocumentId:t}),ed="draft"===n.toLowerCase(),eu="completed"===n.toLowerCase(),em=async()=>{if(!Z||Z===a)return void X(!1);try{await h.mutateAsync({smartDocumentId:t,eventId:l,settings:{title:Z}}),M.oR.success("Document renamed successfully"),X(!1)}catch(e){console.error("Failed to rename document:",e)}},ex=async()=>{if(ed)return void M.oR.error("Share the document first to generate a link");U(!1),await ec.handleShareLink("copy")},ep=async()=>{if(ed)return void M.oR.error("Share the document first to generate a view-only link");await ec.handleViewOnlyLink("copy")},eh=async()=>{U(!1);try{await h.mutateAsync({smartDocumentId:t,eventId:l,settings:{requiresLoginToView:!i}}),M.oR.success(i?"Email verification disabled":"Email verification required")}catch(e){console.error("Failed to toggle lock:",e)}},eg=async()=>{try{await G.mutateAsync(t),es(!1)}catch(e){console.error("Archive error:",e)}},ef=async()=>{U(!1);try{await h.mutateAsync({smartDocumentId:t,eventId:l,settings:{status:"completed"}}),M.oR.success("Document marked as complete")}catch(e){console.error("Failed to mark document as complete:",e)}},ev=async()=>{try{let e=await f.mutateAsync({smartDocumentId:t,eventId:l});"hard"===e.deleteType?M.oR.success("Document deleted successfully"):M.oR.success(e.hasSignedContract?"Document archived due to signed contract":"Document archived successfully"),ea(!1)}catch(e){console.error("Delete error:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(b.rI,{open:W,onOpenChange:U,children:[(0,s.jsx)(b.ty,{asChild:!0,children:(0,s.jsx)(N.$,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(A.A,{className:"h-4 w-4"})})}),(0,s.jsxs)(b.SQ,{align:d,onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)(b._2,{onClick:()=>{m.push(x("/create/smart-flow/".concat(t,"/preview?published=true"),p))},children:[(0,s.jsx)(S.A,{className:"mr-2 h-4 w-4"}),"Preview"]}),(0,s.jsxs)(b._2,{onClick:()=>{m.push(x("/create/smart-flow/".concat(t,"/edit"),p))},children:[(0,s.jsx)(P.A,{className:"mr-2 h-4 w-4"}),"Edit"]}),(0,s.jsxs)(b._2,{onClick:()=>{U(!1),ee(a),X(!0)},children:[(0,s.jsx)(F.A,{className:"mr-2 h-4 w-4"}),"Rename"]}),(0,s.jsxs)(b._2,{onClick:()=>{U(!1),el(!0)},children:[(0,s.jsx)(D.A,{className:"mr-2 h-4 w-4"}),"Duplicate"]}),(0,Y.a)(n)&&u&&(0,s.jsxs)(b._2,{onClick:()=>{U(!1),eo(!0)},children:[(0,s.jsx)(E.A,{className:"mr-2 h-4 w-4"}),"View activity"]}),!ed&&(0,s.jsxs)(b._2,{onClick:ex,disabled:ec.isGenerating,children:[(0,s.jsx)(I.A,{className:"mr-2 h-4 w-4"}),ec.isGenerating?"Generating...":"Copy link"]}),!ed&&(0,s.jsxs)(b._2,{onClick:ep,disabled:ec.isGenerating,children:[(0,s.jsx)(q.A,{className:"mr-2 h-4 w-4"}),ec.isGenerating?"Generating...":"Generate view-only link"]}),!ed&&void 0!==i&&(0,s.jsx)(b._2,{onClick:eh,children:i?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(R.A,{className:"mr-2 h-4 w-4"}),"Disable email verification"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(_.A,{className:"mr-2 h-4 w-4"}),"Require email verification"]})}),eu&&(0,s.jsxs)(b._2,{onClick:()=>{U(!1),es(!0)},children:[(0,s.jsx)(L.A,{className:"mr-2 h-4 w-4"}),"Archive"]}),o&&c&&!eu&&(0,s.jsxs)(b._2,{onClick:ef,children:[(0,s.jsx)(T.A,{className:"mr-2 h-4 w-4"}),"Mark as complete"]}),o?(0,s.jsxs)(g.m_,{children:[(0,s.jsx)(g.k$,{asChild:!0,children:(0,s.jsx)("div",{children:(0,s.jsxs)(b._2,{disabled:!0,className:"text-destructive opacity-50 cursor-not-allowed",children:[(0,s.jsx)(z.A,{className:"mr-2 h-4 w-4"}),"Delete"]})})}),(0,s.jsx)(g.ZI,{children:(0,s.jsx)("p",{children:"Cannot delete documents with partial payments"})})]}):(0,s.jsxs)(b._2,{className:"text-destructive",onClick:()=>{U(!1),ea(!0)},children:[(0,s.jsx)(z.A,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]}),(0,s.jsx)(w.lG,{open:J,onOpenChange:X,children:(0,s.jsxs)(w.Cf,{className:"sm:max-w-[425px]",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(w.c7,{children:(0,s.jsx)(w.L3,{children:"Rename Document"})}),(0,s.jsx)("div",{className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(C.J,{htmlFor:"doc-rename-title",children:"Document Title"}),(0,s.jsx)(k.p,{id:"doc-rename-title",value:Z,onChange:e=>ee(e.target.value),placeholder:"Enter document title",onKeyDown:e=>{"Enter"===e.key&&em()}})]})}),(0,s.jsxs)(w.Es,{children:[(0,s.jsx)(N.$,{variant:"outline",onClick:()=>X(!1),disabled:v,children:"Cancel"}),(0,s.jsx)(N.$,{onClick:em,disabled:v||!Z||Z===a,children:v?"Saving...":"Save"})]})]})}),(0,s.jsx)(w.lG,{open:et,onOpenChange:ea,children:(0,s.jsxs)(w.Cf,{className:"sm:max-w-[425px] overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)(w.c7,{children:[(0,s.jsxs)(w.L3,{className:"pr-6 line-clamp-2 break-all",children:['Delete "',a,'"?']}),(0,s.jsx)(w.rr,{asChild:!0,children:(0,s.jsx)("div",{className:"text-sm",children:"Are you sure you want to delete this document? This action cannot be undone."})})]}),(0,s.jsxs)(w.Es,{className:"gap-2",children:[(0,s.jsx)(N.$,{variant:"outline",onClick:()=>ea(!1),disabled:y,children:"Cancel"}),(0,s.jsxs)(N.$,{variant:"destructive",onClick:ev,disabled:y,children:[y&&(0,s.jsx)(O.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Delete Document"]})]})]})}),(0,s.jsx)(w.lG,{open:en,onOpenChange:es,children:(0,s.jsxs)(w.Cf,{className:"sm:max-w-[425px]",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)(w.c7,{children:[(0,s.jsxs)(w.L3,{children:['Archive "',a,'"?']}),(0,s.jsx)(w.rr,{asChild:!0,children:(0,s.jsx)("div",{className:"text-sm",children:"Are you sure you want to archive this document?"})})]}),(0,s.jsxs)(w.Es,{className:"gap-2",children:[(0,s.jsx)(N.$,{variant:"outline",onClick:()=>es(!1),disabled:H,children:"Cancel"}),(0,s.jsxs)(N.$,{onClick:eg,disabled:H,children:[H&&(0,s.jsx)(O.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Archive Document"]})]})]})}),(0,s.jsx)(K,{open:er,onOpenChange:el,sourceDocument:{id:t,title:a},defaultEventId:l}),u&&(0,s.jsx)(Y.L,{smartDocumentId:t,title:a,open:ei,onOpenChange:eo}),ec.summaryData&&(0,s.jsx)(V.F,{isOpen:ec.isModalOpen,onClose:ec.closeModal,smartDocument:ec.summaryData,onGenerateShareLink:ec.generateShareLink})]})}},37606:(e,t,a)=>{a.d(t,{AL:()=>c,DN:()=>d,MY:()=>m,bL:()=>u,j5:()=>l,pw:()=>i,wb:()=>o});var n=a(38176),s=a(92009);let r=(e,t)=>(0,s.Ue)(e,1920,1080,t,90);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,a=e.replace("#","");3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]);let n=parseInt(a.substring(0,2),16),s=parseInt(a.substring(2,4),16),r=parseInt(a.substring(4,6),16);return"rgba(".concat(n,", ").concat(s,", ").concat(r,", ").concat(t/100,")")}function i(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n={position:"absolute",inset:0,zIndex:0,borderRadius:"inherit",pointerEvents:"none"};
1if(!e)return{backgroundLayer:n,hasBackground:!1};let s=null!=(t=e.backgroundOpacity)?t:100,i=!1;if(e.backgroundImage){let t=a(e.backgroundImage,e.backgroundImageCrop);if(e.backgroundColor){let a=l(e.backgroundColor,100-s);n.backgroundImage="linear-gradient(".concat(a,", ").concat(a,"), url(").concat(t,")")}else n.backgroundImage="url(".concat(t,")"),n.opacity=s/100;n.backgroundSize="cover",n.backgroundPosition="center",n.backgroundRepeat="no-repeat",i=!0}else e.backgroundColor&&(n.backgroundColor=l(e.backgroundColor,s),i=!0);return{backgroundLayer:n,hasBackground:i}}let o=3e3;function c(e){if((null==e?void 0:e.minHeight)&&!(e.minHeight<=0))return{minHeight:Math.min(e.minHeight,o)}}function d(e,t){return i(e,t)}function u(e,t,a){return(null==e?void 0:e.backgroundImage)?i(e,a):(null==t?void 0:t.pageBackgroundImage)?i({backgroundColor:t.pageBackgroundColor,backgroundOpacity:t.pageBackgroundOpacity,backgroundImage:t.pageBackgroundImage,backgroundImageCrop:t.pageBackgroundImageCrop},a):(null==e?void 0:e.backgroundColor)?i(e,a):(null==t?void 0:t.pageBackgroun
1dColor)?i({backgroundColor:t.pageBackgroundColor,backgroundOpacity:t.pageBackgroundOpacity},void 0):{backgroundLayer:{position:"absolute",inset:0,zIndex:0,borderRadius:"inherit",pointerEvents:"none"},hasBackground:!1}}function m(e,t){return(null==e?void 0:e.backgroundColor)||(null==t?void 0:t.pageBackgroundColor)||(null==t?void 0:t.pageColor)||n.aO.pageColor}},51824:(e,t,a)=>{a.d(t,{x:()=>g});var n=a(12115),s=a(26715),r=a(95838),l=a(5041),i=a(56671),o=a(21457),c=a(95993),d=a(83906),u=a(17903),m=a(91737),x=a(63571),p=a(58182);let h={profile:e=>["profile",e]};function g(){var e,t,a,g,f,v,y,j,b,w;let N=(0,s.jE)(),{user:k,selectedOwnerUserId:C,selectedVendorId:A,setVendorContext:S}=(0,u.nc)(),P=(0,r.I)({queryKey:h.profile(C||""),queryFn:async()=>{if(!C)throw Error("No owner user ID found");return await (0,o.ShP)(C)},enabled:(0,x.uF)(!!C),staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>{if("object"==typeof t&&null!==t&&"response"in t){var a,n;if((null==(a=t.response)?void 0:a.status)===401||(null==(n=t.response)?void 0:n.status)===403)return!1}return e<3}});(0,n.useEffect)(()=>{var e,t;let a=null==(t=P.data)||null==(e=t.profile)?void 0:e._id;a&&C&&a!==A&&S(a,C)},[null==(t=P.data)||null==(e=t.profile)?void 0:e._id,C,A,S]),(0,n.useEffect)(()=>{var e;let t=null==(e=P.data)?void 0:e.permissions;t&&(0,c.jb)(t)},[null==(a=P.data)?void 0:a.permissions]),(0,n.useEffect)(()=>{var e,t;(0,d.PN)(null==(t=P.data)||null==(e=t.profile)?void 0:e.currency)},[null==(f=P.data)||null==(g=f.profile)?void 0:g.currency]);let F=(0,l.n)({mutationFn:e=>(0,o._rh)(e),onSuccess:e=>{(0,c.Sq)(!0),N.invalidateQueries({queryKey:h.profile(C||"")}),e.user&&N.invalidateQueries({queryKey:["user",C||""]}),A&&(0,m.YJ)(N,A),i.oR.success("Basic info updated successfully!")},onError:e=>{console.error("❌ Basic info update failed:",e);let t=(0,p.P)(e,"Failed to update basic info. Please try again.");i.oR.error(t)}}),D=(0,l.n)({mutationFn:e=>(0,o.sVJ)(e),onSuccess:e=>{i.oR.success("External links updated successfully!"),N.invalidateQueries({queryKey:["profile"]})},onError:e=>{console.error("❌ Failed to update external links:",e);let t=(0,p.P)(e,"Failed to update external links. Please try again.");i.oR.error(t)}}),E=(0,l.n)({mutationFn:e=>(0,o.KaT)({profilePhotos:e.profilePhotos}),onSuccess:(e,t)=>{t.silent||i.oR.success("Profile photos updated successfully!"),N.invalidateQueries({queryKey:["profile"]})},onError:(e,t)=>{if(console.error("❌ Failed to update profile photos:",e),!t.silent){let t=(0,p.P)(e,"Failed to update profile photos. Please try again.");i.oR.error(t)}}}),I=(0,l.n)({mutationFn:e=>(0,o.QBA)(e),onSuccess:e=>{i.oR.success("FAQ updated successfully!"),N.invalidateQueries({queryKey:["profile"]})},onError:e=>{console.error("❌ Failed to update FAQ:",e);let t=(0,p.P)(e,"Failed to update FAQ. Please try again.");i.oR.error(t)}}),q=(0,l.n)({mutationFn:e=>(0,o.TtB)(e),onSuccess:e=>{i.oR.success("Guidelines updated successfully!"),N.invalidateQueries({queryKey:["profile"]})},onError:e=>{console.error("❌ Failed to update guidelines:",e);let t=(0,p.P)(e,"Failed to update guidelines. Please try again.");i.oR.error(t)}}),R=(0,l.n)({mutationFn:e=>(0,o.Wwy)(e),onSuccess:e=>{i.oR.success("Image deleted successfully!")},onError:e=>{console.error("❌ Failed to delete image:",e);let t=(0,p.P)(e,"Failed to delete image. Please try again.");i.oR.error(t)}}),_=null==(v=P.data)?void 0:v.profile,L=null==(y=P.data)?void 0:y.bookings,T=null==(j=P.data)?void 0:j.role,z=null==(b=P.data)?void 0:b.isOwner,O=null==(w=P.data)?void 0:w.permissions,B=P.isLoading,Q=(0,l.n)({mutationFn:e=>(0,o.p4)(e),onSuccess:e=>{i.oR.success("Profile created successfully! Welcome to Wedy!"),(0,c.Sq)(!0),N.invalidateQueries({queryKey:["profile"]}),N.invalidateQueries({queryKey:["dashboard"]}),N.invalidateQueries({queryKey:["conversations"]}),N.invalidateQueries({queryKey:["messages"]}),N.invalidateQueries({queryKey:["packages"]}),N.invalidateQueries({queryKey:["projects"]}),A&&(0,m.YJ)(N,A)},onError:e=>{console.error("❌ Failed to create vendor profile:",e);let t="Failed to create profile. Please try again.";if(e&&"object"==typeof e&&"response"in e){var a,n;t=(null==(n=e.response)||null==(a=n.data)?void 0:a.message)||t}else e&&"object"==typeof e&&"message"in e&&(t=e.message||t);i.oR.error(t)}}),$=F.isPending,M=D.isPending,G=E.isPending,K=I.isPending,V=q.isPending,Y=R.isPending,H=Q.isPending;return{profile:_,bookings:L,user:k,isFirstTimeUser:!_,isProfileLoading:B,profileError:P.error,role:T,isOwner:z,permissions:O,createVendorProfile:Q,updateBasicInfo:F,updateExter
1nalLinks:D,updateProfilePhotos:E,updateFaq:I,updateGuidelines:q,deleteImage:R,isCreatingProfile:H,isUpdatingBasicInfo:$,isUpdatingExternalLinks:M,isUpdatingProfilePhotos:G,isUpdatingFaq:K,isUpdatingGuidelines:V,isDeletingImage:Y,refetchProfile:P.refetch,profileQuery:P}}},56239:(e,t,a)=>{a.d(t,{$n:()=>x,B8:()=>R,BU:()=>A,CA:()=>B,Fd:()=>j,HF:()=>T,HJ:()=>C,K$:()=>y,Mz:()=>D,QD:()=>z,S3:()=>G,VH:()=>f,Xx:()=>M,YP:()=>$,ZL:()=>w,cF:()=>Q,e$:()=>E,gm:()=>P,h:()=>p,j7:()=>S,jP:()=>h,jX:()=>L,mx:()=>k,nU:()=>g,tz:()=>v,uv:()=>I,xP:()=>N,y5:()=>q,y6:()=>b,zV:()=>F,zy:()=>_});var n=a(27213),s=a(17580),r=a(50142),l=a(38564),i=a(23562),o=a(59947),c=a(81586),d=a(57434),u=a(12715),m=a(37606);let x="var(--wedy-color-highlight, var(--primary))";function p(e){return"var(--wedy-color-text, ".concat(e,")")}let h={small:{rail:"13px",dock:"10px",link:"0.8125rem"},normal:{rail:"15px",dock:"11px",link:"0.875rem"},large:{rail:"17px",dock:"12px",link:"1rem"}},g=.82,f={sm:{small:20,normal:28,large:36},md:{small:28,normal:36,large:44}},v={sm:{small:"12px",normal:"13px",large:"15px"},md:{small:"13px",normal:"14px",large:"16px"}},y="[border-color:var(--wedy-input-border,rgba(0,0,0,0.08))]",j="relative shrink-0 border-b ".concat(y," px-3 py-4 sm:px-6"),b=72,w=56,N="4rem",k="data-nav-panel-open",C=28,A=20,S=24;function P(e,t){return e.length<=t?e:"".concat(e.slice(0,t).trimEnd(),"…")}let F=["backgroundColor","backgroundOpacity","textColor","accentColor","buttonColor","buttonTextColor","borderColor"],D={classic:{fontSize:"normal",itemDisplay:"text",showLogo:!1,brandDisplay:"both",logoSize:"normal",brandNameSize:"normal",brandAlignment:"left",side:"left",showPageCounter:!0},dock:{fontSize:"normal",itemDisplay:"both",showLogo:!0,brandDisplay:"both",logoSize:"normal",brandNameSize:"normal",brandAlignment:"left",side:"left",showPageCounter:!1},website:{fontSize:"normal",itemDisplay:"text",showLogo:!0,brandDisplay:"both",logoSize:"normal",brandNameSize:"normal",brandAlignment:"left",side:"right",showPageCounter:!1}};function E(e,t){var a;return{...e,preset:null!=(a=null==e?void 0:e.preset)?a:"classic",...t}}function I(e,t){return void 0===t||e.length<=t?{visible:e,overflow:[]}:{visible:e.slice(0,t),overflow:e.slice(t)}}function q(e,t){var a,n,s,r,l,i;let o=(null==e||null==(a=e.companyInfo)?void 0:a.logo)||(null==e||null==(s=e.smartFields)||null==(n=s.company)?void 0:n.logo)||void 0,c=(null==e||null==(r=e.companyInfo)?void 0:r.name)||(null==e||null==(i=e.smartFields)||null==(l=i.company)?void 0:l.name)||void 0;return!c&&(null==t?void 0:t.showPlaceholder)&&(null==e?void 0:e.isTemplate)?{logo:o,name:"Your company name"}:{logo:o,name:c}}function R(e,t,a){if(!e.showLogo)return{};let n="name"!==e.brandDisplay,s="logo"!==e.brandDisplay&&"full"===a;return{logo:n&&(null==t?void 0:t.logo)||void 0,name:s&&(null==t?void 0:t.name)||void 0}}function _(e,t,a){let n=R(e,t,a);return!!(n.logo||n.name)}function L(e){return"icon"===e.itemDisplay?"mark":"full"}function T(e){return"both"===e.brandDisplay?"left":e.brandAlignment}function z(e){let{backgroundColor:t,backgroundOpacity:a}=e;return t?void 0===a||a>=100?t:(0,m.j5)(t,a):"var(--wedy-page-color, var(--card))"}let O={textColor:"--wedy-color-text",accentColor:"--wedy-color-highlight",buttonColor:"--wedy-button-bg",buttonTextColor:"--wedy-button-text",borderColor:"--wedy-input-border"};function B(e){let t={};for(let a of Object.keys(O)){let n=e[a];n&&(t[O[a]]=n)}return t}function Q(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:60,a=z(e),{backgroundColor:n,backgroundOpacity:s}=e;return n&&void 0!==s&&s<100?a:"color-mix(in srgb, ".concat(a," ").concat(t,"%, transparent)")}function $(e,t){var a;let n=null==e||null==(a=e.buttonLabel)?void 0:a.trim();return n?P(n,S):t?"Complete":"Next"}let M={gallery:{icon:n.A,label:"Gallery"},about:{icon:s.A,label:"About us"},packages:{icon:r.A,label:"Packages"},reviews:{icon:l.A,label:"Reviews"},schedule:{icon:i.A,label:"Schedule"},faq:{icon:o.A,label:"FAQ"}};function G(e,t,a){var n;if(a){let e=M[a];if(e)return e.icon}if((null!=t?t:e)==="pay")return c.A;let s=null!=t?t:e,r=u.gu.find(e=>e.type===s);return null!=(n=null==r?void 0:r.icon)?n:d.A}},57166:(e,t,a)=>{a.d(t,{b:()=>c});var n=a(12115),s=a(26715),r=a(56671),l=a(41670),i=a(70551),o=a(97501);function c(e){let{smartDocumentId:t,recipients:a}
1=e,[c,d]=(0,n.useState)(!1),u=(0,s.jE)(),{generateShareLink:m,generateViewOnlyLink:x}=(0,l.Xc)(),{data:p}=(0,l.sN)(t,c),h=(0,n.useCallback)(async e=>{if(a)return a.map(e=>(0,o.N0)(e.leadId)).filter(Boolean);let t=await u.fetchQuery({queryKey:l.HD.summary(e),queryFn:async()=>(await (0,i.Xv)(e)).smartDocument,staleTime:12e4});return((null==t?void 0:t.recipients)||[]).map(e=>(0,o.N0)(e.leadId)).filter(Boolean)},[a,u]),g=(0,n.useCallback)(async(e,a)=>{let n=null!=a?a:t;if(!n)return;let s=await h(n);if(1!==s.length)return void d(!0);try{let t=await m.mutateAsync(n),a=(0,o.B0)(t,s[0]);"copy"===e?(await navigator.clipboard.writeText(a),r.oR.success("Link copied to clipboard")):window.open(a,"_blank")}catch(e){r.oR.error("Failed to generate share link")}},[t,h,m]);return{handleShareLink:g,handleViewOnlyLink:(0,n.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy",a=arguments.length>1?arguments[1]:void 0,n=null!=a?a:t;if(n)try{let t=await x.mutateAsync(n);"copy"===e?(await navigator.clipboard.writeText(t),r.oR.success("View-only link copied to clipboard")):window.open(t,"_blank")}catch(e){r.oR.error("Failed to generate view-only link")}},[t,x]),isModalOpen:c,openModal:()=>d(!0),closeModal:(0,n.useCallback)(()=>d(!1),[]),summaryData:p,generateShareLink:()=>m.mutateAsync(t),isGenerating:m.isPending||x.isPending}}},58354:(e,t,a)=>{a.d(t,{UX:()=>o});var n=a(95155),s=a(12115),r=a(14186),l=a(54416),i=a(16654);let o=e=>{let{expirationSettings:t,documentTitle:a,variant:o,companyLogo:c}=e,[d,u]=(0,s.useState)(!1),m=function(e){return(0,s.useMemo)(()=>(0,i.Y)(e),[e])}(t);return!m||d?null:"header"===o?(0,n.jsx)("div",{className:"border-b ".concat("expired"===m.urgency?"bg-red-50 border-red-200":"critical"===m.urgency?"bg-orange-50 border-orange-200":"bg-amber-50 border-amber-200"),children:(0,n.jsx)("div",{className:"px-4 py-2 text-center",children:(0,n.jsxs)("p",{className:"text-xs font-medium ".concat("expired"===m.urgency?"text-red-800":"critical"===m.urgency?"text-orange-800":"text-amber-800"),children:[(0,n.jsx)(r.A,{className:"inline-block h-3 w-3 mr-1.5 -mt-0.5"}),m.isExpired?"This document expired on ".concat(m.shortDate):"Expires: ".concat(m.shortDate)]})})}):(0,n.jsx)("div",{className:"fixed right-4 z-50 max-w-sm animate-in slide-in-from-bottom-4 fade-in duration-300",style:{bottom:"calc(1rem + var(--sd-dock-h, 0px))"},children:(0,n.jsxs)("div",{className:"rounded-lg shadow-lg border p-4 ".concat("expired"===m.urgency?"bg-red-50 border-red-200":"critical"===m.urgency?"bg-orange-50 border-orange-200":"bg-white border-gray-200"),children:[(0,n.jsx)("button",{onClick:()=>u(!0),className:"absolute top-2 right-2 p-1 rounded-full hover:bg-black/5 transition-colors","aria-label":"Dismiss",children:(0,n.jsx)(l.A,{className:"h-4 w-4 text-gray-500"})}),(0,n.jsxs)("div",{className:"flex items-start gap-3 pr-6",children:[c?(0,n.jsx)("div",{className:"h-10 w-10 rounded-full overflow-hidden flex-shrink-0 bg-gray-100",children:(0,n.jsx)("img",{src:c,alt:"",className:"h-full w-full object-cover"})}):(0,n.jsx)("div",{className:"h-10 w-10 rounded-full flex items-center justify-center flex-shrink-0 ".concat("expired"===m.urgency?"bg-red-100":"critical"===m.urgency?"bg-orange-100":"bg-amber-100"),children:(0,n.jsx)(r.A,{className:"h-5 w-5 ".concat("expired"===m.urgency?"text-red-600":"critical"===m.urgency?"text-orange-600":"text-amber-600")})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-semibold ".concat("expired"===m.urgency?"text-red-900":"critical"===m.urgency?"text-orange-900":"text-gray-900"),children:m.isExpired?"Document expired":"Don't miss out!"}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mt-0.5",children:a?(0,n.jsxs)(n.Fragment,{children:[a," ",m.isExpired?"expired":"will expire"," on"," ",m.formattedDate,"."]}):(0,n.jsxs)(n.Fragment,{children:["This document ",m.isExpired?"expired":"will expire"," ","on ",m.formattedDate,"."]})}),(null==t?void 0:t.message)&&(0,n.jsxs)("p",{className:"text-sm text-gray-600 mt-2 italic",children:["“",t.message,"”"]})]})]})]})})}},59390:(e,t,a)=>{a.d(t,{P:()=>l});var n=a(95155);a(12115);var s=a(5196);let r={sm:{container:"size-8",viewBox:"0 0 48 48",cx:24,cy:24,radiu
1s:20,strokeWidth:4,checkSize:"w-4 h-4"},lg:{container:"w-16 h-16",viewBox:"0 0 100 100",cx:50,cy:50,radius:30,strokeWidth:8,checkSize:"w-6 h-6"}},l=e=>{let{value:t,max:a,size:l="sm"}=e,i=r[l],o=a>0?t/a*100:0,c=2*Math.PI*i.radius,d=o>=100;return(0,n.jsxs)("div",{className:"relative ".concat(i.container),children:[(0,n.jsxs)("svg",{className:"".concat(i.container," transform -rotate-90"),viewBox:i.viewBox,children:[(0,n.jsx)("circle",{cx:i.cx,cy:i.cy,r:i.radius,stroke:"currentColor",strokeWidth:i.strokeWidth,fill:"none",className:"text-muted"}),(0,n.jsx)("circle",{cx:i.cx,cy:i.cy,r:i.radius,stroke:"currentColor",strokeWidth:i.strokeWidth,fill:"none",className:"transition-all duration-500 ease-in-out ".concat(d?"text-green-500":"text-primary"),strokeDasharray:c,strokeDashoffset:c-o/100*c,strokeLinecap:d?"butt":"round"})]}),d&&(0,n.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,n.jsx)(s.A,{className:"".concat(i.checkSize," text-green-500")})})]})}},93045:(e,t,a)=>{a.d(t,{I:()=>y});var n=a(95155),s=a(12115),r=a(54165),l=a(30285),i=a(62523),o=a(85057),c=a(66424),d=a(59409),u=a(84616),m=a(47924),x=a(69074),p=a(51154),h=a(17903),g=a(69072),f=a(11682),v=a(56671);function y(e){var t,a;let{onConfirm:y,onBack:j,isLoading:b=!1,confirmLabel:w,defaultEventId:N,initialMode:k="select",lockMode:C=!1,notice:A}=e,[S,P]=(0,s.useState)(k),[F,D]=(0,s.useState)(null),[E,I]=(0,s.useState)(""),[q,R]=(0,s.use
1State)(""),[_,L]=(0,s.useState)(!1),[T,z]=(0,s.useState)(""),[O,B]=(0,s.useState)(""),{selectedVendorId:Q}=(0,h.nc)(),{vendorSettings:$}=(0,g.t)(),M=(0,f.W0)();(0,s.useEffect)(()=>{let e=setTimeout(()=>{R(E)},300);return()=>clearTimeout(e)},[E]);let{events:G,isEventsLoading:K,eventsError:V}=(0,f.LJ)({page:1,limit:50,search:q||void 0,sortBy:"createdAt",sortOrder:"desc"});(0,s.useEffect)(()=>{if(N&&G&&!F){let e=G.find(e=>e._id===N);e&&D(e)}},[N,G,F]);let Y=e=>{D(e)},H=async()=>{if("select"===S&&F)y({eventId:F._id,eventName:F.name||"Untitled Project"});else if("create"===S&&T&&O){if(!Q)return void v.oR.error("Missing vendor information");L(!0);try{var e,t;let a=(null==$?void 0:$.timezone)||"America/New_York",n=(null==(e=U[0])?void 0:e.id)||"",s=await M.mutateAsync({name:T,type:O,timezone:a,currentStage:n});if(!(null==(t=s.event)?void 0:t._id))throw Error("Failed to create event");y({eventId:s.event._id,eventName:T})}catch(e){console.error("Error creating event:",e)}finally{L(!1)}}},W=(null==$||null==(t=$.eventSettings)?void 0:t.types)||[],U=(null==$||null==(a=$.eventSettings)?void 0:a.stages)||[];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(r.c7,{children:[(0,n.jsx)(r.L3,{children:"create"===S?"Create New Project":"Choose Project"}),(0,n.jsx)(r.rr,{children:"create"===S?"Enter project details to create a new project":"Select an existing event or create a new one"})]}),A,(0,n.jsx)("div",{className:"space-y-4 py-4 overflow-y-auto flex-1 min-h-0 px-1",children:"select"===S?(0,n.jsxs)(n.Fragment,{children:[!C&&(0,n.jsxs)(l.$,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{P("create"),D(null)},children:[(0,n.jsx)(u.A,{className:"h-4 w-4"}),"Create New Project"]}),!C&&(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)("p",{className:"text-sm font-medium mb-2",children:"Or select existing project:"})}),!F&&(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(m.A,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,n.jsx)(i.p,{placeholder:"Search projects by name...",value:E,onChange:e=>I(e.target.value),className:"pl-9"})]}),F?(0,n.jsxs)("div",{className:"p-4 bg-muted rounded-lg flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 flex-1",children:[(0,n.jsx)(x.A,{className:"h-5 w-5 text-muted-foreground"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"font-medium",children:F.name}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:F.type})]})]}),(0,n.jsx)(l.$,{variant:"ghost",size:"sm",onClick:()=>{D(null)},children:"Remove"})]}):(0,n.jsx)(c.F,{className:"h-[250px] border rounded-lg",children:K?(0,n.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,n.jsx)(p.A,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):V?(0,n.jsx)("div",{className:"p-8 text-center text-sm text-destructive",children:"Failed to load projects. Please try again."}):G&&0!==G.length?(0,n.jsx)("div",{className:"p-2 space-y-1",children:G.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>Y(e),className:"w-full p-3 hover:bg-muted rounded-lg flex items-start gap-3 transition-colors text-left",children:[(0,n.jsx)(x.A,{className:"h-5 w-5 text-muted-foreground mt-0.5"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("p",{className:"font-medium text-sm truncate",children:e.name||"Untitled Project"}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.type})]})]},e._id))}):(0,n.jsx)("div",{className:"p-8 text-center text-sm text-muted-foreground",children:E?"No projects found matching your search":"No projects available"})})]}):(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(o.J,{htmlFor:"eventName",children:"Project Name *"}),(0,n.jsx)(i.p,{id:"eventName",placeholder:"Enter project name...",value:T,onChange:e=>z(e.target.value)})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(o.J,{htmlFor:"eventType",children:"Project Type *"}),(0,n.jsxs)(d.l6,{value:O,onValueChange:B,children:[(0,n.jsx)(d.bq,{children:(0,n.jsx)(d.yv,{placeholder:"Select project type..."})}),(0,n.jsx)(d.gC,{children:0===W.length?(0,n.jsx)(d.eb,{value:"wedding",disabled:!0,children:"No project types available"}):W.map(e=>(0,n.jsx)(d.eb,{value:e.id,children:e.name},e.id))})]})]}),!C&&(0,n.jsxs)(l.$,{variant:"outline",onClick:()=>{P("select"),z(""),B("")},className:"w-full gap-2",children:[(0,n.jsx)(m.A,{className:"h-4 w-4"}),"Select from existing projects"]})]})})}),(0,n.jsxs)(r.Es,{children:[(0,n.jsx)(l.$,{variant:"outline",onClick:j,disabled:b||_||M.isPending,children:"Back"}),(0,n.jsx)(l.$,{onClick:H,disabled:b||_||M.isPending||"select"===S&&!F||"create"===S&&(!T||!O),children:b||_||M.isPending?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.A,{className:"mr-2 h-4 w-4 animate-spin"}),_||M.isPending?"Creating Project...":"Creating..."]}):w}
1)]})]})}},97501:(e,t,a)=>{function n(e,t){if(!t)return e;try{let a=new URL(e);return a.searchParams.set("leadId",t),a.toString()}catch(t){return e}}function s(e){let t=(e||[]).some(e=>"invoice"===e.type),a=(e||[]).some(e=>"contract"===e.type);return t&&a?"proposal":t?"invoice":a?"contract":"document"}function r(e){return e?"object"==typeof e?e._id:e:null}a.d(t,{B0:()=>n,Fw:()=>s,N0:()=>r})}}]);

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.