PageSourceSearch

https://estimatekit.com/assets/NewEstimate-CEdNbMsl.js

js estimatekit.com collected 2026-10-04 03:34:08 UTC 42,592 bytes, 14 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/onboarding-flags-izowS2nh.js","assets/index-CbvCveKN.js","assets/index-DK9kCj9D.css"])))=>i.map(i=>d[i]);
2import{R as Y,k as At,j as l,aa as Mt,m as qt,r as ee,o as Je,ab as Bt,l as $t,D as zt,ac as Wt,ad as nt,ae as Ht,z as te,g as Ke,I as me,B as Qe,af as Jt,_ as ot}from"./index-CbvCveKN.js";import{a as Kt}from"./templates-DNmeeYY2.js";import{D as Qt,P as Gt,U as lt}from"./PageContainer-Bx7SVsdy.js";import{P as Yt}from"./PageHeader-ohyr15TW.js";import{T as Zt}from"./textarea-BGGCYgxW.js";import{C as Xt}from"./checkbox-DibQEMjb.js";import{C as es,a as ts,b as ss,c as rs,d as is,e as as}from"./command-DQeQBMoP.js";import{S as ns,a as os,b as ls,c as cs,d as ds}from"./select-C3XbO4_1.js";import{P as ct,a as dt,b as ut,C as us}from"./calendar-NMNG2jcx.js";import{A as fs,n as ft,i as ms,u as hs,a as ys,c as xs}from"./ActivityFeed-DKSo_sMt.js";import{C as Vt}from"./check-Bjw6cCk6.js";import{C as ps}from"./calendar-DxoECvrb.js";import{C as gs}from"./calculator-CahaH53a.js";import{o as bs,s as oe,l as vs,d as _s}from"./types-mFYcXcuq.js";import{f as js}from"./format-BZAqQT85.js";import"./index-Jf4OHjGl.js";import"./chevron-right-f4vsMuAf.js";import"./triangle-alert-BJBV5PBt.js";import"./en-US-wdCzBwgh.js";import"./plus-kYCBPFxU.js";import"./file-text-DDhZ7a0t.js";import"./users-BkZzL3s4.js";import"./layout-dashboard-rEexJXnQ.js";import"./ek-mark-light-Y4_w-cFG.js";import"./parseISO-B0WEjCD3.js";import"./plug-BAhKXAxN.js";import"./chevron-down-yKD6BMcU.js";import"./index-DlFerWUd.js";import"./search-fqqyqjqf.js";import"./index-CKxf6gP2.js";import"./isSameDay-m0yeLtak.js";import"./differenceInCalendarDays-BmAYwV3_.js";import"./isAfter-BG9KlOmt.js";import"./startOfMonth-D-6yZJC1.js";import"./addDays-eG_rRTHr.js";import"./subDays-Bv3fF7No.js";import"./external-link-DtZsaCxu.js";var ke=e=>e.type==="checkbox",be=e=>e instanceof Date,$=e=>e==null;const St=e=>typeof e=="object";var O=e=>!$(e)&&!Array.isArray(e)&&St(e)&&!be(e),Ns=e=>O(e)&&e.target?ke(e.target)?e.target.checked:e.target.value:e,Fs=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,ws=(e,r)=>e.has(Fs(r)),As=e=>{const r=e.constructor&&e.constructor.prototype;return O(r)&&r.hasOwnProperty("isPrototypeOf")},Ze=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function U(e){let r;const t=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)r=new Date(e);else if(!(Ze&&(e instanceof Blob||i))&&(t||O(e)))if(r=t?[]:{},!t&&!As(e))r=e;else for(const c in e)e.hasOwnProperty(c)&&(r[c]=U(e[c]));else return e;return r}var Be=e=>/^\w*$/.test(e),I=e=>e===void 0,Xe=e=>Array.isArray(e)?e.filter(Boolean):[],et=e=>Xe(e.replace(/["|']|\]/g,"").split(/\.|\[/)),x=(e,r,t)=>{if(!r||!O(e))return t;const i=(Be(r)?[r]:et(r)).reduce((c,n)=>$(c)?c:c[n],e);return I(i)||i===e?I(e[r])?t:e[r]:i},le=e=>typeof e=="boolean",S=(e,r,t)=>{let i=-1;const c=Be(r)?[r]:et(r),n=c.length,f=n-1;for(;++i<n;){const d=c[i];let N=t;if(i!==f){const E=e[d];N=O(E)||Array.isArray(E)?E:isNaN(+c[i+1])?{}:[]}if(d==="__proto__"||d==="constructor"||d==="prototype")return;e[d]=N,e=e[d]}};const mt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},re={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},de={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Vs=Y.createContext(null);Vs.displayName="HookFormContext";var Ss=(e,r,t,i=!0)=>{const c={defaultValues:r._defaultValues};for(const n in e)Object.defineProperty(c,n,{get:()=>{const f=n;return r._proxyFormState[f]!==re.all&&(r._proxyFormState[f]=!i||re.all),e[f]}});return c};const ks=typeof window<"u"?Y.useLayoutEffect:Y.useEffect;var ce=e=>typeof e=="string",Es=(e,r,t,i,c)=>ce(e)?(i&&r.watch.add(e),x(t,e,c)):Array.isArray(e)?e.map(n=>(i&&r.watch.add(n),x(t,n))):(i&&(r.watchAll=!0),t),Ye=e=>$(e)||!St(e);function he(e,r,t=new WeakSet){if(Ye(e)||Ye(r))return e===r;if(be(e)&&be(r))return e.getTime()===r.getTime();const i=Object.keys(e),c=Object.keys(r);if(i.length!==c.length)return!1;if(t.has(e)||t.has(r))return!0;t.add(e),t.add(r);for(const n of i){const f=e[n];if(!c.includes(n))return!1;if(n!=="ref"){const d=r[n];if(be(f)&&be(d)||O(f)&&O(d)||Array.isArray(f)&&Array.isArray(d)?!he(f,d,t):f!==d)return!1}}return!0}var kt=(e,r,t,i,c)=>r?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[i]:c||!0}}:{},Ve=e=>Array.isArray(e)?e:[e],ht=()=>{let e=[];return{get observers(){return e},next:c=>{for(const n of e)n.next&&n.next(c)},subscribe:c=>(e.push(c),{unsubscribe:()=>{e=e.filter(n=>n!==c)}}),unsubscribe:()=>{e=[]}}},z=e=>O(e)&&!Object.keys(e).length,tt=e=>e.type==="file",ie=e=>typeof e=="function",Ue=e=>{if(!Ze)return!1;const r=e?e.ownerDocument:0;return e instanceof(r&&r.defaultView?r.defaultView.HTMLElement:HTMLElement)},Et=e=>e.type==="select-multiple",st=e=>e.type==="radio",Cs=e=>st(e)||ke(e),Ge=e=>Ue(e)&&e.isConnected;function Ds(e,r){const t=r.slice(0,-1).length;let i=0;for(;i<t;)e=I(e)?i++:e[r[i++]];return e}function Ts(e){for(const r in e)if(e.hasOwnProperty(r)&&!I(e[r]))return!1;return!0}function L(e,r){const t=Array.isArray(r)?r:Be(r)?[r]:et(r),i=t.length===1?e:Ds(e,t),c=t.length-1,n=t[c];return i&&delete i[n],c!==0&&(O(i)&&z(i)||Array.isArray(i)&&Ts(i))&&L(e,t.slice(0,-1)),e}var Ct=e=>{for(const r in e)if(ie(e[r]))return!0;return!1};function Me(e,r={}){const t=Array.isArray(e);if(O(e)||t)for(const i in e)Array.isArray(e[i])||O(e[i])&&!Ct(e[i])?(r[i]=Array.isArray(e[i])?[]:{}
vendor: 5,996 bytes, line 2
2,Me(e[i],r[i])):$(e[i])||(r[i]=!0);return r}function Dt(e,r,t){const i=Array.isArray(e);if(O(e)||i)for(const c in e)Array.isArray(e[c])||O(e[c])&&!Ct(e[c])?I(r)||Ye(t[c])?t[c]=Array.isArray(e[c])?Me(e[c],[]):{...Me(e[c])}:Dt(e[c],$(r)?{}:r[c],t[c]):t[c]=!he(e[c],r[c]);return t}var we=(e,r)=>Dt(e,r,Me(r));const yt={value:!1,isValid:!1},xt={value:!0,isValid:!0};var Tt=e=>{if(Array.isArray(e)){if(e.length>1){const r=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:r,isValid:!!r.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!I(e[0].attributes.value)?I(e[0].value)||e[0].value===""?xt:{value:e[0].value,isValid:!0}:xt:yt}return yt},Pt=(e,{valueAsNumber:r,valueAsDate:t,setValueAs:i})=>I(e)?e:r?e===""?NaN:e&&+e:t&&ce(e)?new Date(e):i?i(e):e;const pt={isValid:!1,value:null};var Ot=e=>Array.isArray(e)?e.reduce((r,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:r,pt):pt;function gt(e){const r=e.ref;return tt(r)?r.files:st(r)?Ot(e.refs).value:Et(r)?[...r.selectedOptions].map(({value:t})=>t):ke(r)?Tt(e.refs).value:Pt(I(r.value)?e.ref.value:r.value,e)}var Ps=(e,r,t,i)=>{const c={};for(const n of e){const f=x(r,n);f&&S(c,n,f._f)}return{criteriaMode:t,names:[...e],fields:c,shouldUseNativeValidation:i}},qe=e=>e instanceof RegExp,Ae=e=>I(e)?e:qe(e)?e.source:O(e)?qe(e.value)?e.value.source:e.value:e,bt=e=>({isOnSubmit:!e||e===re.onSubmit,isOnBlur:e===re.onBlur,isOnChange:e===re.onChange,isOnAll:e===re.all,isOnTouch:e===re.onTouched});const vt="AsyncFunction";var Os=e=>!!e&&!!e.validate&&!!(ie(e.validate)&&e.validate.constructor.name===vt||O(e.validate)&&Object.values(e.validate).find(r=>r.constructor.name===vt)),Rs=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),_t=(e,r,t)=>!t&&(r.watchAll||r.watch.has(e)||[...r.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const Se=(e,r,t,i)=>{for(const c of t||Object.keys(e)){const n=x(e,c);if(n){const{_f:f,...d}=n;if(f){if(f.refs&&f.refs[0]&&r(f.refs[0],c)&&!i)return!0;if(f.ref&&r(f.ref,f.name)&&!i)return!0;if(Se(d,r))break}else if(O(d)&&Se(d,r))break}}};function jt(e,r,t){const i=x(e,t);if(i||Be(t))return{error:i,name:t};const c=t.split(".");for(;c.length;){const n=c.join("."),f=x(r,n),d=x(e,n);if(f&&!Array.isArray(f)&&t!==n)return{name:t};if(d&&d.type)return{name:n,error:d};if(d&&d.root&&d.root.type)return{name:`${n}.root`,error:d.root};c.pop()}return{name:t}}var Ls=(e,r,t,i)=>{t(e);const{name:c,...n}=e;return z(n)||Object.keys(n).length>=Object.keys(r).length||Object.keys(n).find(f=>r[f]===(!i||re.all))},Is=(e,r,t)=>!e||!r||e===r||Ve(e).some(i=>i&&(t?i===r:i.startsWith(r)||r.startsWith(i))),Us=(e,r,t,i,c)=>c.isOnAll?!1:!t&&c.isOnTouch?!(r||e):(t?i.isOnBlur:c.isOnBlur)?!e:(t?i.isOnChange:c.isOnChange)?e:!0,Ms=(e,r)=>!Xe(x(e,r)).length&&L(e,r),qs=(e,r,t)=>{const i=Ve(x(e,t));return S(i,"root",r[t]),S(e,t,i),e},Ie=e=>ce(e);function Nt(e,r,t="validate"){if(Ie(e)||Array.isArray(e)&&e.every(Ie)||le(e)&&!e)return{type:t,message:Ie(e)?e:"",ref:r}}var je=e=>O(e)&&!qe(e)?e:{value:e,message:""},Ft=async(e,r,t,i,c,n)=>{const{ref:f,refs:d,required:N,maxLength:E,minLength:j,min:w,max:v,pattern:W,validate:C,name:T,valueAsNumber:H,mount:Ne}=e._f,_=x(t,T);if(!Ne||r.has(T))return{};const J=d?d[0]:f,K=F=>{c&&J.reportValidity&&(J.setCustomValidity(le(F)?"":F||""),J.reportValidity())},D={},ye=st(f),ae=ke(f),ve=ye||ae,Q=(H||tt(f))&&I(f.value)&&I(_)||Ue(f)&&f.value===""||_===""||Array.isArray(_)&&!_.length,M=kt.bind(null,T,i,D),G=(F,p,V,R=de.maxLength,q=de.minLength)=>{const Z=F?p:V;D[T]={type:F?R:q,message:Z,ref:f,...M(F?R:q,Z)}};if(n?!Array.isArray(_)||!_.length:N&&(!ve&&(Q||$(_))||le(_)&&!_||ae&&!Tt(d).isValid||ye&&!Ot(d).isValid)){const{value:F,message:p}=Ie(N)?{value:!!N,message:N}:je(N);if(F&&(D[T]={type:de.required,message:p,ref:J,...M(de.required,p)},!i))return K(p),D}if(!Q&&(!$(w)||!$(v))){let F,p;const V=je(v),R=je(w);if(!$(_)&&!isNaN(_)){const q=f.valueAsNumber||_&&+_;$(V.value)||(F=q>V.value),$(R.value)||(p=q<R.value)}else{const q=f.valueAsDate||new Date(_),Z=_e=>new Date(new Date().toDateString()+" "+_e),xe=f.type=="time",ue=f.type=="week";ce(V.value)&&_&&(F=xe?Z(_)>Z(V.value):ue?_>V.value:q>new Date(V.value)),ce(R.value)&&_&&(p=xe?Z(_)<Z(R.value):ue?_<R.value:q<new Date(R.value))}if((F||p)&&(G(!!F,V.message,R.message,de.max,de.min),!i))return K(D[T].message),D}if((E||j)&&!Q&&(ce(_)||n&&Array.isArray(_))){const F=je(E),p=je(j),V=!$(F.value)&&_.length>+F.value,R=!$(p.value)&&_.length<+p.value;if((V||R)&&(G(V,F.message,p.message),!i))return K(D[T].message),D}if(W&&!Q&&ce(_)){const{value:F,message:p}=je(W);if(qe(F)&&!_.match(F)&&(D[T]={type:de.pattern,message:p,ref:f,...M(de.pattern,p)},!i))return K(p),D}if(C){if(ie(C)){const F=await C(_,t),p=Nt(F,J);if(p&&(D[T]={...p,...M(de.validate,p.message)},!i))return K(p.message),D}else if(O(C)){let F={};for(const p in C){if(!z(F)&&!i)break;const V=Nt(await C[p](_,t),J,p);V&&(F={...V,...M(p,V.message)},K(V.message),i&&(D[T]=F))}if(!z(F)&&(D[T]={ref:J,...F},!i))return D}}return K(!0),D};const Bs={mode:re.onSubmit,reValidateMode:re.onChange,shouldFocusError:!0};function $s(e={}){let r={...Bs,...e},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:ie(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},i={},c=O(r.defaultValues)||O(r.values)?U(r.defaultValues||r.values)||{}:{},n=r.shouldUnregister?{}:U(c),f={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},N,E=0;const j={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let w={...j};const v={array:ht(),state:ht()},W=r.criteriaMode===re.all,C=s=>a=>{clearTimeout(E),E=setTimeout(s,a)},T=async s=>{if(!r.disabled&&(j.isValid||w.isValid||s)){const a=r.resolver?z((await ae()).errors):await Q(i,!0);a!==t.isValid&&v.state.next({isValid:a})}},H=(s,a)=>
2{!r.disabled&&(j.isValidating||j.validatingFields||w.isValidating||w.validatingFields)&&((s||Array.from(d.mount)).forEach(o=>{o&&(a?S(t.validatingFields,o,a):L(t.validatingFields,o))}),v.state.next({validatingFields:t.validatingFields,isValidating:!z(t.validatingFields)}))},Ne=(s,a=[],o,y,u=!0,m=!0)=>{if(y&&o&&!r.disabled){if(f.action=!0,m&&Array.isArray(x(i,s))){const g=o(x(i,s),y.argA,y.argB);u&&S(i,s,g)}if(m&&Array.isArray(x(t.errors,s))){const g=o(x(t.errors,s),y.argA,y.argB);u&&S(t.errors,s,g),Ms(t.errors,s)}if((j.touchedFields||w.touchedFields)&&m&&Array.isArray(x(t.touchedFields,s))){const g=o(x(t.touchedFields,s),y.argA,y.argB);u&&S(t.touchedFields,s,g)}(j.dirtyFields||w.dirtyFields)&&(t.dirtyFields=we(c,n)),v.state.next({name:s,isDirty:G(s,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else S(n,s,a)},_=(s,a)=>{S(t.errors,s,a),v.state.next({errors:t.errors})},J=s=>{t.errors=s,v.state.next({errors:t.errors,isValid:!1})},K=(s,a,o,y)=>{const u=x(i,s);if(u){const m=x(n,s,I(o)?x(c,s):o);I(m)||y&&y.defaultChecked||a?S(n,s,a?m:gt(u._f)):V(s,m),f.mount&&T()}},D=(s,a,o,y,u)=>{let m=!1,g=!1;const A={name:s};if(!r.disabled){if(!o||y){(j.isDirty||w.isDirty)&&(g=t.isDirty,t.isDirty=A.isDirty=G(),m=g!==A.isDirty);const k=he(x(c,s),a);g=!!x(t.dirtyFields,s),k?L(t.dirtyFields,s):S(t.dirtyFields,s,!0),A.dirtyFields=t.dirtyFields,m=m||(j.dirtyFields||w.dirtyFields)&&g!==!k}if(o){const k=x(t.touchedFields,s);k||(S(t.touchedFields,s,o),A.touchedFields=t.touchedFields,m=m||(j.touchedFields||w.touchedFields)&&k!==o)}m&&u&&v.state.next(A)}return m?A:{}},ye=(s,a,o,y)=>{const u=x(t.errors,s),m=(j.isValid||w.isValid)&&le(a)&&t.isValid!==a;if(r.delayError&&o?(N=C(()=>_(s,o)),N(r.delayError)):(clearTimeout(E),N=null,o?S(t.errors,s,o):L(t.errors,s)),(o?!he(u,o):u)||!z(y)||m){const g={...y,...m&&le(a)?{isValid:a}:{},errors:t.errors,name:s};t={...t,...g},v.state.next(g)}},ae=async s=>{H(s,!0);const a=await r.resolver(n,r.context,Ps(s||d.mount,i,r.criteriaMode,r.shouldUseNativeValidation));return H(s),a},ve=async s=>{const{errors:a}=await ae(s);if(s)for(const o of s){const y=x(a,o);y?S(t.errors,o,y):L(t.errors,o)}else t.errors=a;return a},Q=async(s,a,o={valid:!0})=>{for(const y in s){const u=s[y];if(u){const{_f:m,...g}=u;if(m){const A=d.array.has(m.name),k=u._f&&Os(u._f);k&&j.validatingFields&&H([y],!0);const X=await Ft(u,d.disabled,n,W,r.shouldUseNativeValidation&&!a,A);if(k&&j.validatingFields&&H([y]),X[m.name]&&(o.valid=!1,a))break;!a&&(x(X,m.name)?A?qs(t.errors,X,m.name):S(t.errors,m.name,X[m.name]):L(t.errors,m.name))}!z(g)&&await Q(g,a,o)}}return o.valid},M=()=>{for(const s of d.unMount){const a=x(i,s);a&&(a._f.refs?a._f.refs.every(o=>!Ge(o)):!Ge(a._f.ref))&&se(s)}d.unMount=new Set},G=(s,a)=>!r.disabled&&(s&&a&&S(n,s,a),!he(_e(),c)),F=(s,a,o)=>Es(s,d,{...f.mount?n:I(a)?c:ce(s)?{[s]:a}:a},o,a),p=s=>Xe(x(f.mount?n:c,s,r.shouldUnregister?x(c,s,[]):[])),V=(s,a,o={})=>{const y=x(i,s);let u=a;if(y){const m=y._f;m&&(!m.disabled&&S(n,s,Pt(a,m)),u=Ue(m.ref)&&$(a)?"":a,Et(m.ref)?[...m.ref.options].forEach(g=>g.selected=u.includes(g.value)):m.refs?ke(m.ref)?m.refs.forEach(g=>{(!g.defaultChecked||!g.disabled)&&(Array.isArray(u)?g.checked=!!u.find(A=>A===g.value):g.checked=u===g.value||!!u)}):m.refs.forEach(g=>g.checked=g.value===u):tt(m.ref)?m.ref.value="":(m.ref.value=u,m.ref.type||v.state.next({name:s,values:U(n)})))}(o.shouldDirty||o.shouldTouch)&&D(s,u,o.shouldTouch,o.shouldDirty,!0),o.shouldValidate&&ue(s)},R=(s,a,o)=>{for(const y in a){if(!a.hasOwnProperty(y))return;const u=a[y],m=s+"."+y,g=x(i,m);(d.array.has(s)||O(u)||g&&!g._f)&&!be(u)?R(m,u,o):V(m,u,o)}},q=(s,a,o={})=>{const y=x(i,s),u=d.array.has(s),m=U(a);S(n,s,m),u?(v.array.next({name:s,values:U(n)}),(j.isDirty||j.dirtyFields||w.isDirty||w.dirtyFields)&&o.shouldDirty&&v.state.next({name:s,dirtyFields:we(c,n),isDirty:G(s,m)})):y&&!y._f&&!$(m)?R(s,m,o):V(s,m,o),_t(s,d)&&v.state.next({...t,name:s}),v.state.next({name:f.mount?s:void 0,values:U(n)})},Z=async s=>{f.mount=!0;const a=s.target;let o=a.name,y=!0;const u=x(i,o),m=k=>{y=Number.isNaN(k)||be(k)&&isNaN(k.getTime())||he(k,x(n,o,k))},g=bt(r.mode),A=bt(r.reValidateMode);if(u){let k,X;const Le=a.type?gt(u._f):Ns(s),fe=s.type===mt.BLUR||s.type===mt.FOCUS_OUT,Lt=!Rs(u._f)&&!r.resolver&&!x(t.errors,o)&&!u._f.deps||Us(fe,x(t.touchedFields,o),t.isSubmitted,A,g),We=_t(o,d,fe);S(n,o,Le),fe?(u._f.onBlur&&u._f.onBlur(s),N&&N(0)):u._f.onChange&&u._f.onChange(s);const He=D(o,Le,fe),It=!z(He)||We;if(!fe&&v.state.next({name:o,type:s.type,values:U(n)}),Lt)return(j.isValid||w.isValid)&&(r.mode==="onBlur"?fe&&T():fe||T()),It&&v.state.next({name:o,...We?{}:He});if(!fe&&We&&v.state.next({...t}),r.resolver){const{errors:it}=await ae([o]);if(m(Le),y){const Ut=jt(t.errors,i,o),at=jt(it,i,Ut.name||o);k=at.error,o=at.name,X=z(it)}}else H([o],!0),k=(await Ft(u,d.disabled,n,W,r.shouldUseNativeValidation))[o],H([o]),m(Le),y&&(k?X=!1:(j.isValid||w.isValid)&&(X=await Q(i,!0)));y&&(u._f.deps&&ue(u._f.deps),ye(o,X,k,He))}},xe=(s,a)=>
2{if(x(t.errors,a)&&s.focus)return s.focus(),1},ue=async(s,a={})=>{let o,y;const u=Ve(s);if(r.resolver){const m=await ve(I(s)?s:u);o=z(m),y=s?!u.some(g=>x(m,g)):o}else s?(y=(await Promise.all(u.map(async m=>{const g=x(i,m);return await Q(g&&g._f?{[m]:g}:g)}))).every(Boolean),!(!y&&!t.isValid)&&T()):y=o=await Q(i);return v.state.next({...!ce(s)||(j.isValid||w.isValid)&&o!==t.isValid?{}:{name:s},...r.resolver||!s?{isValid:o}:{},errors:t.errors}),a.shouldFocus&&!y&&Se(i,xe,s?u:d.mount),y},_e=s=>{const a={...f.mount?n:c};return I(s)?a:ce(s)?x(a,s):s.map(o=>x(a,o))},Ee=(s,a)=>({invalid:!!x((a||t).errors,s),isDirty:!!x((a||t).dirtyFields,s),error:x((a||t).errors,s),isValidating:!!x(t.validatingFields,s),isTouched:!!x((a||t).touchedFields,s)}),rt=s=>{s&&Ve(s).forEach(a=>L(t.errors,a)),v.state.next({errors:s?t.errors:{}})},Ce=(s,a,o)=>{const y=(x(i,s,{_f:{}})._f||{}).ref,u=x(t.errors,s)||{},{ref:m,message:g,type:A,...k}=u;S(t.errors,s,{...k,...a,ref:y}),v.state.next({name:s,errors:t.errors,isValid:!1}),o&&o.shouldFocus&&y&&y.focus&&y.focus()},$e=(s,a)=>ie(s)?v.state.subscribe({next:o=>"values"in o&&s(F(void 0,a),o)}):F(s,a,!0),De=s=>v.state.subscribe({next:a=>{Is(s.name,a.name,s.exact)&&Ls(a,s.formState||j,ne,s.reRenderRoot)&&s.callback({values:{...n},...t,...a,defaultValues:c})}}).unsubscribe,Te=s=>(f.mount=!0,w={...w,...s.formState},De({...s,formState:w})),se=(s,a={})=>
vendor: 5,604 bytes, line 2
2{for(const o of s?Ve(s):d.mount)d.mount.delete(o),d.array.delete(o),a.keepValue||(L(i,o),L(n,o)),!a.keepError&&L(t.errors,o),!a.keepDirty&&L(t.dirtyFields,o),!a.keepTouched&&L(t.touchedFields,o),!a.keepIsValidating&&L(t.validatingFields,o),!r.shouldUnregister&&!a.keepDefaultValue&&L(c,o);v.state.next({values:U(n)}),v.state.next({...t,...a.keepDirty?{isDirty:G()}:{}}),!a.keepIsValid&&T()},Pe=({disabled:s,name:a})=>{(le(s)&&f.mount||s||d.disabled.has(a))&&(s?d.disabled.add(a):d.disabled.delete(a))},B=(s,a={})=>{let o=x(i,s);const y=le(a.disabled)||le(r.disabled);return S(i,s,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:s}},name:s,mount:!0,...a}}),d.mount.add(s),o?Pe({disabled:le(a.disabled)?a.disabled:r.disabled,name:s}):K(s,!0,a.value),{...y?{disabled:a.disabled||r.disabled}:{},...r.progressive?{required:!!a.required,min:Ae(a.min),max:Ae(a.max),minLength:Ae(a.minLength),maxLength:Ae(a.maxLength),pattern:Ae(a.pattern)}:{},name:s,onChange:Z,onBlur:Z,ref:u=>{if(u){B(s,a),o=x(i,s);const m=I(u.value)&&u.querySelectorAll&&u.querySelectorAll("input,select,textarea")[0]||u,g=Cs(m),A=o._f.refs||[];if(g?A.find(k=>k===m):m===o._f.ref)return;S(i,s,{_f:{...o._f,...g?{refs:[...A.filter(Ge),m,...Array.isArray(x(c,s))?[{}]:[]],ref:{type:m.type,name:s}}:{ref:m}}}),K(s,!1,void 0,m)}else o=x(i,s,{}),o._f&&(o._f.mount=!1),(r.shouldUnregister||a.shouldUnregister)&&!(ws(d.array,s)&&f.action)&&d.unMount.add(s)}}},pe=()=>r.shouldFocusError&&Se(i,xe,d.mount),Oe=s=>{le(s)&&(v.state.next({disabled:s}),Se(i,(a,o)=>{const y=x(i,o);y&&(a.disabled=y._f.disabled||s,Array.isArray(y._f.refs)&&y._f.refs.forEach(u=>{u.disabled=y._f.disabled||s}))},0,!1))},h=(s,a)=>async o=>{let y;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let u=U(n);if(v.state.next({isSubmitting:!0}),r.resolver){const{errors:m,values:g}=await ae();t.errors=m,u=U(g)}else await Q(i);if(d.disabled.size)for(const m of d.disabled)L(u,m);if(L(t.errors,"root"),z(t.errors)){v.state.next({errors:{}});try{await s(u,o)}catch(m){y=m}}else a&&await a({...t.errors},o),pe(),setTimeout(pe);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:z(t.errors)&&!y,submitCount:t.submitCount+1,errors:t.errors}),y)throw y},b=(s,a={})=>{x(i,s)&&(I(a.defaultValue)?q(s,U(x(c,s))):(q(s,a.defaultValue),S(c,s,U(a.defaultValue))),a.keepTouched||L(t.touchedFields,s),a.keepDirty||(L(t.dirtyFields,s),t.isDirty=a.defaultValue?G(s,U(x(c,s))):G()),a.keepError||(L(t.errors,s),j.isValid&&T()),v.state.next({...t}))},P=(s,a={})=>{const o=s?U(s):c,y=U(o),u=z(s),m=u?c:y;if(a.keepDefaultValues||(c=o),!a.keepValues){if(a.keepDirtyValues){const g=new Set([...d.mount,...Object.keys(we(c,n))]);for(const A of Array.from(g))x(t.dirtyFields,A)?S(m,A,x(n,A)):q(A,x(m,A))}else{if(Ze&&I(s))for(const g of d.mount){const A=x(i,g);if(A&&A._f){const k=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(Ue(k)){const X=k.closest("form");if(X){X.reset();break}}}}if(a.keepFieldsRef)for(const g of d.mount)q(g,x(m,g));else i={}}n=r.shouldUnregister?a.keepDefaultValues?U(c):{}:U(m),v.array.next({values:{...m}}),v.state.next({values:{...m}})}d={mount:a.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!j.isValid||!!a.keepIsValid||!!a.keepDirtyValues,f.watch=!!r.shouldUnregister,v.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:u?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!he(s,c)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:u?{}:a.keepDirtyValues?a.keepDefaultValues&&n?we(c,n):t.dirtyFields:a.keepDefaultValues&&s?we(c,s):a.keepDirty?t.dirtyFields:{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},ge=(s,a)=>P(ie(s)?s(n):s,a),Fe=(s,a={})=>{const o=x(i,s),y=o&&o._f;if(y){const u=y.refs?y.refs[0]:y.ref;u.focus&&(u.focus(),a.shouldSelect&&ie(u.select)&&u.select())}},ne=s=>{t={...t,...s}},Re={control:{register:B,unregister:se,getFieldState:Ee,handleSubmit:h,setError:Ce,_subscribe:De,_runSchema:ae,_focusError:pe,_getWatch:F,_getDirty:G,_setValid:T,_setFieldArray:Ne,_setDisabledField:Pe,_setErrors:J,_getFieldArray:p,_reset:P,_resetDefaultValues:()=>ie(r.defaultValues)&&r.defaultValues().then(s=>{ge(s,r.resetOptions),v.state.next({isLoading:!1})}),_removeUnmounted:M,_disableForm:Oe,_subjects:v,_proxyFormState:j,get _fields(){return i},get _formValues(){return n},get _state(){return f},set _state(s){f=s},get _defaultValues(){return c},get _names(){return d},set _names(s){d=s},get _formState(){return t},get _options(){return r},set _options(s){r={...r,...s}}},subscribe:Te,trigger:ue,register:B,handleSubmit:h,watch:$e,setValue:q,getValues:_e,reset:ge,resetField:b,clearErrors:rt,unregister:se,setError:Ce,setFocus:Fe,getFieldState:Ee};return{...Re,formControl:Re}}function zs(e={}){const r=Y.useRef(void 0),t=Y.useRef(void 0),[i,c]=Y.useState({isDirty:!1,isValidating:!1,isLoading:ie(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ie(e.defaultValues)?void 0:e.defaultValues});if(!r.current)if(e.formControl)r.current={...e.formControl,formState:i},e.defaultValues&&!ie(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:f,...d}=$s(e);r.current={...d,formState:i}}const n=r.current.control;return n._options=e,ks(()=>{const f=n._subscribe({formState:n._proxyFormState,callback:()=>c({...n._formState}
2),reRenderRoot:!0});return c(d=>({...d,isReady:!0})),n._formState.isReady=!0,f},[n]),Y.useEffect(()=>n._disableForm(e.disabled),[n,e.disabled]),Y.useEffect(()=>{e.mode&&(n._options.mode=e.mode),e.reValidateMode&&(n._options.reValidateMode=e.reValidateMode)},[n,e.mode,e.reValidateMode]),Y.useEffect(()=>{e.errors&&(n._setErrors(e.errors),n._focusError())},[n,e.errors]),Y.useEffect(()=>{e.shouldUnregister&&n._subjects.state.next({values:n._getWatch()})},[n,e.shouldUnregister]),Y.useEffect(()=>{if(n._proxyFormState.isDirty){const f=n._getDirty();f!==i.isDirty&&n._subjects.state.next({isDirty:f})}},[n,i.isDirty]),Y.useEffect(()=>{e.values&&!he(e.values,t.current)?(n._reset(e.values,{keepFieldsRef:!0,...n._options.resetOptions}),t.current=e.values,c(f=>({...f}))):n._resetDefaultValues()},[n,e.values]),Y.useEffect(()=>{n._state.mount||(n._setValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()}),r.current.formState=Ss(i,n),r.current}const wt=(e,r,t)=>{if(e&&"reportValidity"in e){const i=x(t,r);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Rt=(e,r)=>{for(const t in r.fields){const i=r.fields[t];i&&i.ref&&"reportValidity"in i.ref?wt(i.ref,t,e):i.refs&&i.refs.forEach(c=>wt(c,t,e))}},Ws=(e,r)=>{r.shouldUseNativeValidation&&Rt(e,r);const t={};for(const i in e){const c=x(r.fields,i),n=Object.assign(e[i]||{},{ref:c&&c.ref});if(Hs(r.names||Object.keys(e),i)){const f=Object.assign({},x(t,i));S(f,"root",n),S(t,i,f)}else S(t,i,n)}return t},Hs=(e,r)=>e.some(t=>t.startsWith(r+"."));var Js=function(e,r){for(var t={};e.length;){var i=e[0],c=i.code,n=i.message,f=i.path.join(".");if(!t[f])if("unionErrors"in i){var d=i.unionErrors[0].errors[0];t[f]={message:d.message,type:d.code}}else t[f]={message:n,type:c};if("unionErrors"in i&&i.unionErrors.forEach(function(j){return j.errors.forEach(function(w){return e.push(w)})}),r){var N=t[f].types,E=N&&N[i.code];t[f]=kt(f,r,t,c,E?[].concat(E,i.message):i.message)}e.shift()}return t},Ks=function(e,r,t){return t===void 0&&(t={}),function(i,c,n){try{return Promise.resolve(function(f,d){try{var N=Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](i,r)).then(function(E){return n.shouldUseNativeValidation&&Rt({},n),{errors:{},values:t.raw?i:E}})}catch(E){return d(E)}return N&&N.then?N.then(void 0,d):N}(0,function(f){if(function(d){return Array.isArray(d==null?void 0:d.errors)}(f))return{values:{},errors:Ws(Js(f.errors,!n.shouldUseNativeValidation&&n.criteriaMode==="all"),n)};throw f}))}catch(f){return Promise.reject(f)}}};const Qs=[{label:"Client"},{label:"Items"},{label:"Review"}],Gs=({currentStep:e,totalSteps:r=3,estimateId:t,steps:i=Qs})=>{const c=At(),n=N=>{if(t)switch(N){case 1:return`/estimates/${t}/edit`;case 2:return`/estimates/${t}/add-items`;case 3:return`/estimates/${t}/review`;default:return}},f=N=>{if(N>e)return;const E=n(N);E&&c(E)},d=i.slice(0,r);return l.jsx("div",{className:"mb-6 flex items-center overflow-x-auto rounded-[14px] border border-ink/[0.06] bg-card px-2 py-2 scrollbar-hide sm:px-3",children:d.map((N,E)=>{const j=E+1,w=j<e,v=j===e,W=j<=e&&t,C=j>=r;return l.jsxs("div",{className:`flex items-center ${C?"flex-none":"flex-1"}`,children:[l.jsxs("button",{type:"button",onClick:()=>f(j),disabled:!W,className:`
3                flex min-h-[44px] md:min-h-0 shrink-0 items-center gap-2 whitespace-nowrap rounded-md px-2.5 transition-colors
4                ${W?"cursor-pointer hover:bg-ink/[0.04]":"cursor-default"}
5              `,children:[l.jsx("span",{className:`
6                  box-border inline-flex h-[22px] w-[22px] items-center justify-center rounded-full border-[1.5px] text-[11px] font-semibold
7                  ${w?"border-foreground bg-foreground text-background":v?"border-cta-orange bg-transparent text-cta-orange":"border-ink/[0.15] bg-transparent text-foreground-tertiary"}
8                `,children:w?l.jsx(Vt,{className:"h-3 w-3",strokeWidth:3}):j}),l.jsx("span",{className:`
9                  text-[12.5px] font-medium
10                  ${w?"text-ink/70":v?"text-foreground":"text-foreground-tertiary"}
11                `,children:N.label})]}),!C&&l.jsx("div",{className:`
12                  mx-1.5 h-[1.5px] min-w-[12px] flex-1
13                  ${w?"bg-ink/40":"bg-ink/10"}
14                `})]},j)})})},Ys=["Central AC Installation (New)","AC Replacement (Existing)","Gas Furn
14ace Installation","Furnace Replacement","Complete HVAC System (AC + Furnace)","Custom Estimate"],Zs=bs({clientName:oe().min(1,"Client name is required"),address:oe().optional(),city:oe().optional(),state:oe().optional(),zip:oe().optional(),phone:oe().optional(),email:oe().email("Invalid email").or(vs("")).optional(),jobType:oe().min(1,"Job type is required"),jobDescription:oe().optional(),squareFootage:oe().optional(),startDate:_s().optional()}),Rr=()=>{var Oe;const e=At(),{requireWrite:r}=Mt(),[t]=qt(),i=t.get("template"),c=t.get("customer"),[n,f]=ee.useState(null);ee.useEffect(()=>{i&&Je.from("templates").select("name").eq("id",i).maybeSingle().then(({data:h})=>f((h==null?void 0:h.name)??null))},[i]);const{id:d}=Bt(),{toast:N}=$t(),E=zt(),[j,w]=ee.useState(),[v,W]=ee.useState(!1),[C,T]=ee.useState(!1),[H,Ne]=ee.useState([]),[_,J]=ee.useState(""),[K,D]=ee.useState(!1),[ye,ae]=ee.useState(!1),[ve,Q]=ee.useState({default_materials_tax_rate:0,default_labor_tax_rate:0}),{register:M,handleSubmit:G,watch:F,setValue:p,formState:{errors:V}}=zs({resolver:Ks(Zs),defaultValues:{clientName:"",address:"",city:"",state:"",zip:"",phone:"",email:"",jobType:"",jobDescription:"",squareFootage:""}}),R=F("squareFootage"),q=F("jobType");ee.useEffect(()=>{Z(),xe()},[]),ee.useEffect(()=>{d&&(T(!0),Ee())},[d]);const Z=async()=>{try{const h=await Wt();if(Ne(h||[]),c&&!d){const b=(h||[]).find(P=>P.id===c);b&&(J(b.id),p("clientName",b.client_name),p("email",b.email||""),p("phone",b.phone||""),p("address",b.address||""),p("city",b.city||""),p("state",b.state||""),p("zip",b.zip||""))}}catch(h){console.error("Error fetching accounts:",h)}},xe=async()=>{try{const{data:{session:h}}=await Je.auth.getSession();if(!((h==null?void 0:h.user)??null))return;const P=await nt();P&&Q({default_materials_tax_rate:Number(P.default_materials_tax_rate??0),default_labor_tax_rate:Number(P.default_labor_tax_rate??0)})}catch(h){console.error("Error fetching user preferences:",h)}},ue=h=>{const b=H.find(P=>P.id===h);b&&(J(h),p("clientName",b.client_name),p("email",b.email||""),p("phone",b.phone||""),p("address",b.address||""),p("city",b.city||""),p("state",b.state||""),p("zip",b.zip||"")),D(!1)},_e=()=>{J(""),p("clientName",""),p("email",""),p("phone",""),p("address",""),p("city",""),p("state",""),p("zip","")},Ee=async()=>{W(!0);try{const h=await Ht(d),b=(h.client_address||"").split(", "),[P="",ge="",Fe="",ne=""]=b;p("clientName",h.client_name),p("address",P),p("city",ge),p("state",Fe),p("zip",ne),p("phone",h.client_phone||""),p("email",h.client_email||""),p("jobType",h.template_type||""),p("jobDescription",h.job_description||"")}catch(h){console.error("Error loading estimate:",h),N({title:"Error",description:"Failed to load estimate",variant:"destructive"})}finally{W(!1)}},Ce=(h=>{const b=parseFloat(h);if(isNaN(b)||b<=0)return 0;const P=b/600;return Math.round(P*2)/2})(R),$e=h=>{const b=h.replace(/\D/g,"");return b.length<=3?b:b.length<=6?`(${b.slice(0,3)}) ${b.slice(3)}`:`(${b.slice(0,3)}) ${b.slice(3,6)}-${b.slice(6,10)}`},De=h=>{const b=$e(h.target.value);p("phone",b)},Te=async h=>{if(r()&&!(!C&&!await Jt("create",()=>G(Te)()))){W(!0);try{const{data:{session:b}}=await Je.auth.getSession(),P=b==null?void 0:b.user;if(!P)throw new Error("Not authenticated");const ge=C&&d?d:ft(),Fe=[h.address,h.city,h.state,h.zip].filter(Boolean).join(", "),ne=await nt().catch(()=>null),ze=Number((ne==null?void 0:ne.default_materials_tax_rate)??ve.default_materials_tax_rate),Re=Number((ne==null?void 0:ne.default_labor_tax_rate)??ve.default_labor_tax_rate),s={client_name:h.clientName,client_address:Fe||null,client_phone:h.phone||null,client_email:h.email||null,job_description:h.jobDescription||null,template_type:h.jobType,status:"draft",materials_tax_rate:ze,labor_tax_rate:Re,tax_rate:ze};let a=_||null;if(ye&&!C&&!_){const y=ft();try{await ms(ge,{id:y,user_id:P.id,client_name:h.clientName,email:h.email||null,phone:h.phone||null,address:h.address||null,city:h.city||null,state:h.state||null,zip:h.zip||null}),a=y,ot(()=>import("./onboarding-flags-izowS2nh.js"),__vite__mapDeps([0,1,2])).then(u=>u.markOnboardingFlag("has_created_customer")).catch(()=>{}),N({title:"Account Saved",description:"Client information saved for future use"})}catch(u){console.error("Error saving account:",u)}}const o=a?{...s,account_id:a}:s;if(C&&d)await hs(d,o,"Save estimate details"),N({title:"Success",description:"Estimate updated successfully."}),await E.invalidateQueries({queryKey:["all-estimates"]}),e(`/estimates/${d}
14/add-items`);else{const y={id:ge,...o,user_id:P.id};if(await ys(y),ot(()=>import("./onboarding-flags-izowS2nh.js"),__vite__mapDeps([0,1,2])).then(u=>u.markOnboardingFlag("has_created_estimate")).catch(()=>{}),await xs(y.id,"created",`Estimate created for ${h.clientName}`,{client_name:h.clientName,job_type:h.jobType}),N({title:"Success",description:"Estimate draft saved. Continue to add items."}),await E.invalidateQueries({queryKey:["all-estimates"]}),i)try{const u=await Kt(y.id,i);N({title:"Template applied",description:u.optionsCreated>1?`${u.optionsCreated} pricing options are ready to review.`:`${u.itemsAdded} items added from the template.`})}catch(u){console.error("Error applying template:",u),N({title:"Template not applied",description:u instanceof Error?u.message:"You can add it from the next step.",variant:"destructive"})}e(`/estimates/${y.id}/add-items`)}}catch(b){N({title:"Error",description:b.message,variant:"destructive"})}finally{W(!1)}}},se=_?H.find(h=>h.id===_):void 0,Pe=h=>(h||"").split(/\s+/).filter(Boolean).slice(0,2).map(b=>{var P;return(P=b[0])==null?void 0:P.toUpperCase()}).join(""),B="text-[12.5px] font-normal text-foreground-secondary",pe="mt-1.5 text-[12.5px] text-bad";return l.jsxs("div",{className:"min-h-screen bg-background",children:[l.jsx(Qt,{}),l.jsxs(Gt,{width:"full",children:[l.jsx(Yt,{title:C?"Edit estimate":"New estimate",className:"mb-5 md:mb-6"}),l.jsx(Gs,{currentStep:1,totalSteps:3,estimateId:d}),i&&!C&&l.jsxs("p",{className:"-mt-2 mb-6 flex flex-wrap items-baseline gap-x-4 gap-y-1 rounded-[14px] border border-[#f26a1b]/[0.22] bg-[#f26a1b]/[0.06] px-[18px] py-4 text-sm",children:[l.jsx("span",{className:"font-mono text-[11.5px] uppercase tracking-[0.08em] text-cta-orange",children:"Starting from template"}),l.jsx("span",{className:"text-[14px] font-semibold",children:n||"…"})]}),l.jsxs("form",{onSubmit:G(Te),children:[l.jsxs("div",{className:"mb-6 grid grid-cols-1 items-start gap-6 lg:grid-cols-2",children:[l.jsxs("section",{className:"flex flex-col gap-5 rounded-xl border border-ink/[0.06] bg-card p-[18px] sm:p-5",children:[l.jsx("h2",{className:"text-[15px] font-semibold",children:"Client information"}),!C&&l.jsxs("div",{className:"flex flex-col gap-2 border-b border-ink/[0.06] pb-5",children:[l.jsx(te,{className:B,children:"Select Existing Account (Optional)"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(ct,{open:K,onOpenChange:D,children:[l.jsx(dt,{asChild:!0,children:l.jsxs("button",{type:"button",role:"combobox","aria-expanded":K,className:"flex min-h-[64px] min-w-0 flex-1 items-center gap-3.5 rounded-xl border border-ink/[0.06] bg-card px-3.5 py-3 text-left transition-colors hover:bg-ink/[0.04]",children:[se?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-ink/[0.06] text-sm font-semibold text-ink/80",children:Pe(se.client_name)}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[l.jsx("span",{className:"truncate text-[14px] font-semibold text-foreground",children:se.client_name}),(se.email||se.phone)&&l.jsx("span",{className:"truncate text-[13px] text-foreground-secondary",children:se.email||se.phone})]})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full border border-dashed border-ink/20 text-foreground-secondary",children:l.jsx(lt,{className:"h-4 w-4",strokeWidth:1.8})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-[14px] text-foreground-secondary",children:_?(Oe=H.find(h=>h.id===_))==null?void 0:Oe.client_name:"Select account…"})]}),l.jsx(es,{className:"h-4 w-4 shrink-0 text-foreground-tertiary",strokeWidth:1.8})]})}),l.jsx(ut,{className:"w-full p-0",align:"start",children:l.jsxs(ts,{children:[l.jsx(ss,{placeholder:"Search accounts…"}),l.jsx(rs,{children:"No account found."}),l.jsx(is,{className:"max-h-64 overflow-auto",children:H.map(h=>l.jsxs(as,{value:h.client_name,onSelect:()=>ue(h.id),children:[l.jsx(Vt,{className:Ke("mr-2 h-4 w-4 text-cta-orange",_===h.id?"opacity-100":"opacity-0")}),l.jsxs("div",{className:"flex-1",children:[l.jsx("div",{className:"font-medium",children:h.client_name}),h.email&&l.jsx("div",{className:"text-xs text-muted-foreground",children:h.email})]})]}
14,h.id))})]})})]}),_&&l.jsx("button",{type:"button",onClick:_e,className:"flex min-h-[44px] md:min-h-0 shrink-0 items-center px-2 text-[13px] font-medium text-cta-orange transition-colors hover:text-cta-orange-hover",children:"Clear"})]}),l.jsx("p",{className:"text-[12.5px] text-foreground-tertiary",children:"Select an existing account to auto-fill client information"})]}),l.jsxs("div",{children:[l.jsxs(te,{htmlFor:"clientName",className:B,children:["Client Name ",l.jsx("span",{className:"text-cta-orange",children:"*"})]}),l.jsx(me,{id:"clientName",...M("clientName"),className:"mt-2",placeholder:"John Smith"}),V.clientName&&l.jsx("p",{className:pe,children:V.clientName.message})]}),l.jsxs("div",{children:[l.jsx(te,{htmlFor:"address",className:B,children:"Address"}),l.jsx(me,{id:"address",...M("address"),className:"mt-2",placeholder:"123 Main Street"})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[l.jsxs("div",{className:"sm:col-span-3 md:col-span-1",children:[l.jsx(te,{htmlFor:"city",className:B,children:"City"}),l.jsx(me,{id:"city",...M("city"),className:"mt-2",placeholder:"City"})]}),l.jsxs("div",{className:"sm:col-span-2 md:col-span-1",children:[l.jsx(te,{htmlFor:"state",className:B,children:"State"}),l.jsx(me,{id:"state",...M("state"),className:"mt-2",placeholder:"State",maxLength:2})]}),l.jsxs("div",{className:"sm:col-span-1 md:col-span-1",children:[l.jsx(te,{htmlFor:"zip",className:B,children:"ZIP"}),l.jsx(me,{id:"zip",...M("zip"),className:"mt-2 font-mono",placeholder:"ZIP",maxLength:10})]})]}),l.jsxs("div",{children:[l.jsx(te,{htmlFor:"phone",className:B,children:"Phone"}),l.jsx(me,{id:"phone",...M("phone"),onChange:De,className:"mt-2 font-mono",placeholder:"(555) 123-4567",maxLength:14})]}),l.jsxs("div",{children:[l.jsx(te,{htmlFor:"email",className:B,children:"Email"}),l.jsx(me,{id:"email",type:"email",...M("email"),className:"mt-2",placeholder:"[email protected]"}),V.email&&l.jsx("p",{className:pe,children:V.email.message})]}),!C&&!_&&l.jsxs("div",{className:"flex min-h-[44px] md:min-h-0 items-center gap-3 border-t border-ink/[0.06] pt-4",children:[l.jsx(Xt,{id:"saveAsAccount",checked:ye,onCheckedChange:h=>ae(h===!0)}),l.jsx("label",{htmlFor:"saveAsAccount",className:"cursor-pointer text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(lt,{className:"h-4 w-4 text-foreground-secondary",strokeWidth:1.8}),"Save as new account for future estimates"]})})]})]}),l.jsxs("section",{className:"flex flex-col gap-5 rounded-xl border border-ink/[0.06] bg-card p-[18px] sm:p-5",children:[l.jsx("h2",{className:"text-[15px] font-semibold",children:"Job information"}),l.jsxs("div",{children:[l.jsxs(te,{htmlFor:"jobType",className:B,children:["Job Type ",l.jsx("span",{className:"text-cta-orange",children:"*"})]}),l.jsxs(ns,{value:q,onValueChange:h=>p("jobType",h),children:[l.jsx(os,{className:"mt-2 h-[50px] rounded-xl border-ink/[0.08] bg-card px-4 text-base font-medium",children:l.jsx(ls,{placeholder:"Select job type"})}),l.jsx(cs,{children:Ys.map(h=>l.jsx(ds,{value:h,children:h},h))})]}),V.jobType&&l.jsx("p",{className:pe,children:V.jobType.message})]}),l.jsxs("div",{children:[l.jsx(te,{htmlFor:"jobDescription",className:B,children:"Job Description"}),l.jsx(Zt,{id:"jobDescription",...M("jobDescription"),className:"mt-2 min-h-[100px]",placeholder:"Describe the job details, special requirements, etc."})]}),l.jsxs("div",{children:[l.jsx(te,{htmlFor:"squareFootage",className:B,children:"Square Footage (optional)"}),l.jsx(me,{id:"squareFootage",type:"number",...M("squareFootage"),className:"mt-2 font-mono",placeholder:"2000",min:"0"}),l.jsx("p",{className:"mt-1.5 text-[12.5px] text-foreground-tertiary",children:"Used to recommend system size. Can be added later."})]}),l.jsxs("div",{children:[l.jsx(te,{htmlFor:"startDate",className:B,children:"Estimated Start Date"}),l.jsxs(ct,{children:[l.jsx(dt,{asChild:!0,children:l.jsxs(Qe,{variant:"outline",className:Ke("mt-2 w-full justify-start rounded-xl border-ink/[0.08] bg-card text-left font-normal app:rounded-xl app:border-ink/[0.08] app:bg-card",!j&&"text-muted-foreground"),children:[l.jsx(ps,{className:"h-4 w-4 text-foreground-tertiary",strokeWidth:1.8}),j?l.jsx("span",{className:"font-mono text-sm",children:js(j,"PPP")}):l.jsx("span",{children:"Pick a date"})]})}),l.jsx(ut,{className:"w-auto p-0",align:"start",children:l.jsx(us,{mode:"single",selected:j,onSelect:h=>{w(h),p("startDate",h)},initialFocus:!0,className:Ke("p-3 pointer-events-auto")})})]})]})]})]}),R&&parseFloat(R)>0&&l.jsxs("div",{className:"mb-6 flex items-center gap-3.5 rounded-xl border border-[#f26a1b]/35 bg-card p-[18px] sm:p-5",children:[l.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#f26a1b]/[0.1]",children:l.jsx(gs,{className:"h-5 w-5 text-foreground-secondary",strokeWidth:1.8})}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"text-[14px] font-semibold",children:["Recommended System Size: ",l.jsx("span",{className:"font-mono",children:Ce})," Tons"]}),l.jsxs("div",{className:"mt-0.5 text-[13px] text-foreground-secondary",children:["Based on ",l.jsx("span",{className:"font-mono",children:R})," sq ft (Formula: sq ft ÷ 600)"]})]})]}),l.jsxs("div",{className:"flex flex-col-reverse gap-3 sm:flex-row sm:justify-between",children:[l.jsx(Qe,{type:"button",variant:"outline",className:"w-full sm:w-auto",onClick:()=>e(C&&d?`/estimates/${d}
14/add-items`:"/dashboard"),children:C?"Cancel":"Back to Dashboard"}),l.jsx(Qe,{type:"submit",variant:"orange",size:"lg",className:"w-full sm:w-auto",disabled:v,children:v?"Saving…":C?"Save & Continue →":"Next: Add Items →"})]})]}),C&&d&&l.jsx("div",{className:"mt-8",children:l.jsx(fs,{estimateId:d})})]})]})};export{Rr as 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.