1import{i as W,k as T,W as q,j as e,Z as f,L as H,y as B,b as s,u as R,az as L,aA as I,J as $,K as E,O,D as G,M as K,X as Y,a6 as y,w as U,r as v,aB as J,aC as Q,aD as X,B as F,ap as Z}from"./base-components-C_FoBiEZ.js";import{a3 as _,at as V,ar as ee,as as h,ak as te,F as ae,q as ne,a as re,L as ie}from"./index-RH5lj1ot.js";import{i as se,o as oe}from"./utils-DyyDGCWY.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="f335451f-c933-4d69-aa27-b75e122d232f",t._sentryDebugIdIdentifier="sentry-dbid-f335451f-c933-4d69-aa27-b75e122d232f")}catch{}const le=async t=>(await T(["post","/api/v1/admin/valuation-tool/predict"],t)).data,de=()=>W({mutationFn:le}),ue=async({queryKey:t})=>{const[,n]=t;return(await T(["get","api/v1/admin/valuation-tool/valuate"],n)).data},me=(t,n={})=>q({queryKey:["adminPredictValues",t],queryFn:ue,...n}),j=t=>{const{listings:n}=t;return n?n.length===0?e.jsx(f,{responsive:!0,title:"Comparables",children:"No comparables found"}):e.jsx(f,{responsive:!0,title:"Comparables","data-sentry-element":"Item","data-sentry-component":"Comparables","data-sentry-source-file":"Comparables.tsx",children:e.jsx(ce,{"data-sentry-element":"TableWrapper","data-sentry-source-file":"Comparables.tsx",children:e.jsxs(pe,{"data-sentry-element":"TableContainer","data-sentry-source-file":"Comparables.tsx",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Listing Number"}),e.jsx("th",{children:"Net Profit"}),e.jsx("th",{children:"Listing Price"}),e.jsx("th",{children:"Listing Multiple"}),e.jsx("th",{children:"Listing Status"}),e.jsx("th",{children:"Sold At"}),e.jsx("th",{children:"Monetization"})]})}),e.jsx("tbody",{children:n.map(a=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(H,{to:`/admin/listings?q=${a.listingNumber}`,children:a.listingNumber})}),e.jsx("td",{children:_(a.averageAnnualNetProfit)}),e.jsx("td",{children:_(a.listingPrice)}),e.jsx("td",{children:V(a.annualListingMultiple)}),e.jsx("td",{children:a.listingStatus}),e.jsx("td",{children:B.utc(a.soldAt).format("YYYY-MM-DD HH:mm:ss")}),e.jsx("td",{children:a.monetizations.join(", ")})]},a.id))})]})})}):null};j.displayName="Comparables";j.displayName="Comparables";const ce=s.div.withConfig({displayName:"Comparables__TableWrapper"})(["overflow-x:auto;"]),pe=s.table.withConfig({displayName:"Comparables__TableContainer"})(["width:100%;border-collapse:collapse;tbody > tr:nth-child(odd){background:",";}th,td{padding:0.5rem 2rem;white-space:nowrap;}th{text-align:left;font-size:0.875rem;color:",";}"],t=>t.theme.colors.lightBlue,t=>t.theme.colors.darkGray),C=t=>{var n;const{field:a,valuationToolFieldName:r,weight:m}=t,c=R(),[o]=L("monetization");return se(o==null||(n=o.value)===null||n===void 0?void 0:n.value,r,c.valuationToolHiddenFields)?null:e.jsx(I,{responsive:!0,close:!0,"data-sentry-element":"FormRow","data-sentry-component":"DynamicField","data-sentry-source-file":"DynamicField.tsx",children:e.jsxs($,{"data-sentry-element":"FormBlock","data-sentry-source-file":"DynamicField.tsx",children:[e.jsx(E,{htmlFor:r,"data-sentry-element":"FormLabel","data-sentry-source-file":"DynamicField.tsx",children:a.name}),e.jsxs(he,{"data-sentry-element":"ValuationGrouping","data-sentry-source-file":"DynamicField.tsx",children:[e.jsxs(fe,{"data-sentry-element":"ValuationInputContainer","data-sentry-source-file":"DynamicField.tsx",children:[a.description&&e.jsx(ye,{children:a.description}),a.values&&e.jsx(O,{name:r,options:a.values.map(d=>({value:d.id,label:d.name}))}),a.date&&e.jsx(G,{name:r,small:!0,isClearable:!0}),!a.date&&!a.values&&e.jsx(K,{small:!0,name:r,maxLength:1e4})]}),e.jsx(ge,{"data-sentry-element":"ValuationMultipleContainer","data-sentry-source-file":"DynamicField.tsx",children:e.jsxs("span",{children:[Number(m).toFixed(1),"x"]})})]})]})})};C.displayName="DynamicField";C.displayName="DynamicField";const ye=s.div.withConfig({displayName:"DynamicField__Description"})(["margin-bottom:0.5rem;font-size:0.875rem;"]),he=s.div.withConfig({displayName:"DynamicField__ValuationGrouping"})(["display:flex;align-items:center;"]),fe=s.div.withConfig({displayName:"DynamicField__ValuationInputContainer"})(["flex-grow:1;"]),ge=s.div.withConfig({displayName:"DynamicField__ValuationMultipleContainer"})(["max-width:3.5rem;text-align:center;flex-grow:1;"]),xe=[{name:"Absolute Low"},{name:"Typical Low"},{name:"Suggested Listing",isSuggested:!0},{name:"Typical High"},{name:"Absolute High"}],w=t=>{var n;const{valuationToolPrediction:a}=t,[r]=L("monetization"),m=typeof a?.isProfitMultiple=="boolean"&&(r==null||(n=r.value)===null||n===void 0?void 0:n.value)==="SaaS";return a?e.jsx(f,{responsive:!0,title:"Results","data-sentry-element":"Item","data-sentry-component":"Results","data-sentry-source-file":"Results.tsx",children:e.jsx(be,{"data-sentry-element":"TableWrapper","data-sentry-source-file":"Results.tsx",children:e.jsx(ve,{"data-sentry-element":"TableContainer","data-sentry-source-file":"Results.tsx",children:e.jsxs("tbody",{children:[e.jsxs("tr",{children:[e.jsx("td",{}),e.jsx("td",{children:"Multiple"}),e.jsx("td",{children:"Valuation / Price"})]}),xe.map(c=>{const{name:o,isSuggested:d}=c,i=Y.camelize(o),x=i.charAt(0).toUpperCase()+i.slice(1),p=V(a[`annual${x}Multiple`]),g=a[`${i}Valuation`]||a[`${i}Price`];return e.jsxs("tr",{className:d&&"strong",children:[e.jsx("td",{children:o}),e.jsx("td",{children:p}),e.jsx("td",{children:_(g)})]},i)}),m&&e.jsxs("tr",{className:"strong",children:[e.jsx("td",{children:"Valuation Type"}),e.jsx("td",{colSpan:2,children:a.isProfitMultiple?"Seller Discretionary Earnings":"Recurring Revenue"})]})]})})})}):e.jsx(f,{responsive:!0,title:"Results",children:"No result"})};w.displayName="Results";w.displayName="Results";const be=s.div.withConfig({displayName:"Results__TableWrapper"})(["overflow-x:auto;"]),ve=s.table.withConfig({displayName:"Results__TableContainer"})(["width:100%;border-collapse:collapse;tbody > tr:nth-child(odd){background:",";}tr.strong > td{font-weight:700;}th,td{padding:0.5rem 2rem;white-space:nowrap;}th{text-align:left;font-size:0.875rem;color:",";}"],t=>t.theme.colors.lightBlue,t=>t.theme.colors.darkGray),N=new ee().addPropertyMapping({from:"activeCustomers",to:"active_customers"}).addPropertyMapping({from:"averageMonthlyChurnPercent",to:"average_monthly_churn_percent"}).addPropertyMapping({from:"averageMonthlyNetProfit",to:"average_monthly_net_profit"}).addPropertyMapping({from:"averageMonthlyNetProfit3Months",to:"average_monthly_net_profit_3_months"}).addPropertyMapping({from:"averageMonthlyNetProfit6Months",to:"average_monthly_net_profit_6_months"}).addPropertyMapping({from:"businessCreatedAt",to:"business_created_at"}).addPropertyMapping({from:"emailSubscribers",to:"email_subscribers"}).addPropertyMapping({from:"firstSubscriberAt",to:"first_subscriber_at"}).addPropertyMapping({from:"hasTeam",to:"has_team"}
1).addPropertyMapping({from:"hoursWorkedPerWeek",to:"hours_worked_per_week"}).addMapping((t,n)=>{const a=y(t,"monetization.value");return h(n,"monetization",a),n}).addPropertyMapping({from:"mrr3MonthsAgo",to:"mrr_3_months_ago"}).addPropertyMapping({from:"mrr12MonthsAgo",to:"mrr_12_months_ago"}).addPropertyMapping({from:"mrrNow",to:"mrr_now"}).addPropertyMapping({from:"numberOfDownloads",to:"number_of_downloads"}).addPropertyMapping({from:"numberOfPaidSubscribers",to:"number_of_paid_subscribers"}).addPropertyMapping({from:"numberOfProducts",to:"number_of_products"}).addPropertyMapping({from:"numberOfRevenueChannels",to:"number_of_revenue_channels"}).addMapping((t,n)=>{const a=y(t,"saasModel.value");return h(n,"saas_model",a),n}).addPropertyMapping({from:"socialMediaFollowers",to:"social_media_followers"}).addPropertyMapping({from:"uniqueUsers",to:"unique_users"}).addPropertyMapping({from:"averageMonthlyGrossRevenue",to:"average_monthly_gross_revenue"}).addMapping(function(t,n){const a=y(t,"revenueDiversity.value");return h(n,"revenue_diversity",a),n}).addMapping(function(t,n){const a=y(t,"recurringRevenue.value");return h(n,"recurring_revenue",a),n}).addMapping(function(t,n){const a=y(t,"clientAcquisition.value");return h(n,"client_acquisition",a),n}),M=t=>{const{setValues:n,validateForm:a,values:r}=t,{mutate:m,isPending:c}=de(),{valuationToolParameters:o,valuationToolHiddenFields:d}=R(),[i,x]=v.useState(null),[p,g]=v.useState(null),P=oe(r,d),{data:l}=me(N.map(P),{enabled:!!(r!=null&&r.monetization)});l&&!te(p,l?.weights)&&g(l?.weights);const k=()=>{n({}),g(null),a()},z=()=>{m(N.map(P),{onSuccess:u=>{x(u)}})};return e.jsxs(J,{"data-sentry-element":"AdminContainerWrapper","data-sentry-component":"View","data-sentry-source-file":"index.tsx",children:[e.jsx(je,{title:"Valuation Tool","data-sentry-element":"CustomHeaderLayout","data-sentry-source-file":"index.tsx"}),e.jsx(Q,{"data-sentry-element":"AdminContainer","data-sentry-source-file":"index.tsx",children:e.jsxs(Ce,{"data-sentry-element":"CustomRow","data-sentry-source-file":"index.tsx",children:[e.jsx(D,{"data-sentry-element":"Column","data-sentry-source-file":"index.tsx",children:e.jsx(f,{responsive:!0,title:"Enter data (* required)","data-sentry-element":"Item","data-sentry-source-file":"index.tsx",children:e.jsxs(ae,{persistKey:"valuation-tool","data-sentry-element":"FormProvider","data-sentry-source-file":"index.tsx",children:[X(o).map(u=>{var b;const S=o[u],A=(b=p&&p[u])!==null&&b!==void 0?b:0;return e.jsx(C,{valuationToolFieldName:u,field:S,weight:A},u)}),e.jsxs(we,{"data-sentry-element":"ButtonWrapper","data-sentry-source-file":"index.tsx",children:[e.jsx(F,{small:!0,primary:!0,isLoading:c,disableWhileLoading:!0,hideContentWhileLoading:!0,onClick:z,"data-sentry-element":"Button","data-sentry-source-file":"index.tsx",children:"Predict"}),e.jsx(F,{type:"button",small:!0,onClick:k,"data-sentry-element":"Button","data-sentry-source-file":"index.tsx",children:"Clear"})]})]})})}),e.jsxs(D,{"data-sentry-element":"Column","data-sentry-source-file":"index.tsx",children:[e.jsx(w,{valuationToolPrediction:i?.valuationToolPrediction,"data-sentry-element":"Results","data-sentry-source-file":"index.tsx"}),e.jsx(j,{listings:i?.comparables,"data-sentry-element":"Comparables","data-sentry-source-file":"index.tsx"})]})]})})]})};M.displayName="View";M.displayName="View";const _e=U({displayName:"PredictForm",mapPropsToValues:()=>({}),handleSubmit:()=>{}})(M),je=s(ne).withConfig({displayName:"Controller__CustomHeaderLayout"})(["width:100%;max-width:120rem;margin:0 auto;padding-left:",";padding-right:",";"],t=>t.theme.layouts.basic.content.paddingHorizontal,t=>t.theme.layouts.basic.content.paddingHorizontal),Ce=s(Z).withConfig({displayName:"Controller__CustomRow"})(["display:grid;grid-template-columns:50% 50%;","{grid-template-columns:100%;}"],t=>t.theme.mq.tabletOrMobile),D=s.div.withConfig({displayName:"Controller__Column"})(["flex:1;&:first-child{margin-right:1.5rem;}> div:not(:last-child){margin-bottom:1.5rem;}","{&:not(:last-child){margin-bottom:1.5rem;}&:first-child{margin-right:0;}}"],t=>t.theme.mq.tabletOrMobile),we=s.div.withConfig({displayName:"Controller__ButtonWrapper"})(["> button:not(:last-of-type){margin-right:1rem;}","{> button{width:100%;margin:0 0 1rem;}}"],t=>t.theme.mq.mobile),Ne=v.memo(()=>(re({title:"Valuation Tool - Admin",withDefaultSuffix:!0}),e.jsx(ie,{skipPadding:!0,children:e.jsx(_e,{})})));export{Ne as default}; 2//# sourceMappingURL=index-DaqJ4b3f.js.map
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.