1import{j as i}from"./react-pdf-Cq6GPVDG.js";import{c as Y,u as Be,f as Ut,a as ie,B as je,eT as Gt,dc as yt,x as J,bc as Et,y as Yt,v as Vt,b0 as Wt,ae as Kt,K as Jt,aS as Xt,R as Qt,t as ei}from"./index-maVJ-geo.js";import{r as B,d as gt,R as Xe,a as ti,u as ii,L as ni}from"./react-router-BFySgQvb.js";import{t as si,r as ri}from"./orderContactDefault-DhdmXZki.js";import{m as lt}from"./index-CP91PI3S.js";import{i as oi}from"./orderUtils-J9jioWW3.js";import{b9 as ai,aB as li,N as ci,o as di,B as mi,C as Se,r as ui,ba as gi,S as fi,af as Tt,X as pi,bb as hi,f as yi,P as xt,w as vt,a as Ce}from"./icons-DcQvN3ix.js";import{h as it}from"./dates-moment-CiIaS07v.js";import{S as bt}from"./react-select.esm-PmxAy4C0.js";import{C as xi}from"./react-select-creatable.esm-6ZHLBdD-.js";import{C as vi}from"./CreateCompanyForm-CYF6DVT-.js";import{b as bi}from"./useStateManager-7e1e8489.esm-DvPWzAV4.js";import{d as _i,b as Ni,a as Si,C as Ci}from"./card-Cc2PDGT4.js";import{L as X,I as ze,S as ji}from"./separator-DJFybvQa.js";import{p as It,U as Ae,D as At,v as kt}from"./calendar-ui-BTeGO8Ej.js";/* empty css */import{G as wi}from"./index-QjgOdqGV.js";import{t as Ei,A as Ti}from"./tz-Cs9AL8lB.js";import{D as Ii}from"./DocumentUpload-BETrRVCM.js";import{O as Ai}from"./OrderSuccessComponent-n4itBhBG.js";import{d as ki,B as Ze}from"./bootstrap-CPno1dha.js";import{c as _t}from"./animation-CbTzt0YB.js";import{p as Di}from"./orderCompletionUtils-bseVpY8u.js";import"./pdfjs-CC5_zlEF.js";import"./react-core-9HpXahQi.js";import"./axios-4nCoxB4W.js";import"./@react-pdf-C0gzRH8D.js";import"./pdf-gen-CK9OQt9R.js";import"./markdown-DFjncyPT.js";import"./ckeditor-Chjiymov.js";import"./dates-fns-DyoRc1Ct.js";import"./tiptap-core-M6Q8ouaR.js";import"./NotaryFees-Bga6o_73.js";import"./forms-74xxAriz.js";import"./Helpers-qmJU60f7.js";import"./EventMonitor-YyWKHVnT.js";const ft={fileNumber:"",signingType:"",scanbacksRequired:"yes",ronSigning:"no",signerName:"",signerPhone:"",signerEmail:"",specificTime:"",signingTimeType:"",startTime:"",endTime:"",spouseName:"",coSignerName:"",coSignerSpouseName:"",coSignerPhone:"",coSignerEmail:"",additionalSigners:[],witnessCount:"",witnessProvider:"",witnessNotes:"",signerAccommodations:"",propertyAddress:"",propertyAddressLine2:"",signingAddress:"",city:"",signingCity:"",state:"",signingState:"",zipcode:"",signingZipcode:"",esigningPlatform:"",documentDelivery:"",language:"",lender:"",specialInstructions:"",privateNote:"",invoiceFee:"",isPropertyAddressSame:!0,propertyLatitude:"",propertyLongitude:"",signingLatitude:"",signingLongitude:"",timeZoneId:""},Dt={clientCompanyId:null,inHouseContact:null,inHouseContact2:null,observer:"",orderContactEmail:""},Oi={notaryPay:""},Ot={mode:"signing_service",contacts:{...Dt},details:{...ft},signingServiceId:null,customizations:null,hasCustomizations:!1,customizationsLoading:!1,documents:[],submitting:!1,errors:[],submitResult:null};function Li(){return{...Object.fromEntries(Object.entries(ft).filter(([e])=>e!=="privateNote")),...Oi}}function Lt(t="signing_service"){return{...Ot,mode:t,contacts:{...Dt},details:t==="notary"?Li():{...ft}}}const H={FIELD_CHANGED:"FIELD_CHANGED",CONTACT_CHANGED:"CONTACT_CHANGED",CLIENT_SELECTED:"CLIENT_SELECTED",SIGNING_SERVICE_SELECTED:"SIGNING_SERVICE_SELECTED",CUSTOMIZATIONS_LOADING:"CUSTOMIZATIONS_LOADING",CUSTOMIZATIONS_RESOLVED:"CUSTOMIZATIONS_RESOLVED",DOCUMENTS_CHANGED:"DOCUMENTS_CHANGED",HYDRATE:"HYDRATE",RESET:"RESET",SUBMIT_STARTED:"SUBMIT_STARTED",SUBMIT_SUCCEEDED:"SUBMIT_SUCCEEDED",SUBMIT_FAILED:"SUBMIT_FAILED",VALIDATION_FAILED:"VALIDATION_FAILED",ERRORS_CLEARED:"ERRORS_CLEARED"};function Pi(t,e){switch(e.type){case H.FIELD_CHANGED:return{...t,details:{...t.details,[e.field]:e.value},errors:t.errors.length?t.errors.filter(n=>n.field!==e.field):t.errors};case H.CONTACT_CHANGED:return{...t,contacts:{...t.contacts,[e.field]:e.value},errors:t.errors.length?t.errors.filter(n=>n.field!==e.field):t.errors};case H.CLIENT_SELECTED:return{...t,contacts:{...t.contacts,clientCompanyId:e.clientCompanyId,inHouseContact:null,inHouseContact2:null},customizations:null,hasCustomizations:!1};case H.SIGNING_SERVICE_SELECTED:return{...t,signingServiceId:e.signingServiceId};case H.CUSTOMIZATIONS_LOADING:return{...t,customizationsLoading:!0};case H.CUSTOMIZATIONS_RESOLVED:{const n=e.customizations,r=n?.use_default===!1;return{...t,customizationsLoading:!1,customizations:r?n:null,hasCustomizations:r}}case H.DOCUMENTS_CHANGED:return{...t,documents:e.documents};case H.HYDRATE:{const n=new Set([...Object.keys(e.contacts??{}),...Object.keys(e.details??{})]);return{...t,contacts:{...t.contacts,...e.contacts??{}},details:{...t.details,...e.details??{}},signingServiceId:e.signingServiceId??t.signingServiceId,documents:e.documents??t.documents,errors:t.errors.length&&n.size?t.errors.filter(r=>!n.has(r.field)):t.errors}}case H.RESET:return Lt(t.mode);case H.SUBMIT_STARTED:return{...t,submitting:!0,errors:[]};case H.SUBMIT_SUCCEEDED:return{...t,submitting:!1,submitResult:{success:!0,data:e.data,errorMessage:""}};case H.SUBMIT_FAILED:return{...t,submitting:!1,submitResult:{success:!1,data:e.data??null,errorMessage:e.errorMessage}};case H.VALIDATION_FAILED:return{...t,submitting:!1,errors:e.errors};case H.ERRORS_CLEARED:return{...t,errors:[]};default:return t}}const Pt=B.createContext(null);function Fi(t){const e=Y.c(11),{children:n,initialState:r}=t;let l;e[0]!==r?(l=r??{},e[0]=r,e[1]=l):l=e[1];let a;e[2]!==l?(a={...Ot,...l},e[2]=l,e[3]=a):a=e[3];const[o,d]=B.useReducer(Pi,a);let s;e[4]===Symbol.for("react.memo_cache_sentinel")?(s=(_,h)=>d({type:H.FIELD_CHANGED,field:_,value:h}),e[4]=s):s=e[4];const c=s;let g;e[5]===Symbol.for("react.memo_cache_sentinel")?(g=(_,h)=>d({type:H.CONTACT_CHANGED,field:_,value:h}),e[5]=g):g=e[5];const u=g;let m;e[6]!==o?(m={state:o,dispatch:d,setField:c,setContact:u},e[6]=o,e[7]=m):m=e[7];const C=m;let p;return e[8]!==n||e[9]!==C?(p=i.jsx(Pt.Provider,{value:C,children:n}),e[8]=n,e[9]=C,e[10]=p):p=e[10],p}function Q(){const t=B.useContext(Pt);if(!t)throw new Error("useOrderForm must be used within an OrderFormProvider");return t}function $i({edit:t,orderId:e}){const{user:n,endpoint:r}=Be(),{state:l,dispatch:a,setField:o,setContact:d}=Q(),{clientCompanyId:s}=l.contacts,c=l.signingServiceId,[g,u]=B.useState([]),[m,C]=B.useState([]),[p,_]=B.useState([]),[h,x]=B.useState(null),[y,v]=B.useState([]),[k,b]=B.use
1State([]),j=n?.userId,N=n?.user_account?.account_type,E=n?.user_account?.signing_service_id,A=N==="client",w=Ut().activeClientCompanyId,f=l.mode==="notary",L=n?.user_account?.notary_id,O=n?.email,F=!f||!!n?.permissions?.includes("contact_access");B.useEffect(()=>{let P=!1;if(f)return;const $=async()=>{if(A)try{const T=await ie.get(`/api/client-users/get-all-signing-services/${j}`);if(P)return;const R=T.data.result??[];C(R),R.length>0&&R[0]?.signingServiceId&&a({type:H.SIGNING_SERVICE_SELECTED,signingServiceId:R[0].signingServiceId})}catch(T){console.error("Error fetching signing services:",T)}else a({type:H.SIGNING_SERVICE_SELECTED,signingServiceId:E})};return(j!=null||E!=null)&&$(),()=>{P=!0}},[j,E,A,f,a]),B.useEffect(()=>{let P=!1;const $=async()=>{try{const T=f?await ie.post("/client-companies/all",{notaryOwnerId:L}):A?await ie.post(`${r}/client-companies/client-user/all`,{signingServiceId:c,userId:j}):await ie.post(`${r}/client-companies/all`,{signingServiceId:c});if(P)return;const R=(T.data.companies??[]).filter(Z=>Z.company_level!=="org"&&Z.company_level!=="group");u(R);const U=R.find(Z=>
1String(Z.client_company_id)===String(w))||(R.length===1?R[0]:null);U?.client_company_id&&!f&&!t&&!e&&!s&&a({type:H.CLIENT_SELECTED,clientCompanyId:U.client_company_id})}catch(T){console.error("Error fetching companies:",T),je.error("Error fetching companies: "+(T.response?.data?.error??""))}};return(f?L!=null:c&&j!=null)&&$(),()=>{P=!0}},[c,j,r,A,f,L,t,e,w]),B.useEffect(()=>{let P=!1;return s?(async()=>{try{const T=await ie.post("/api/contacts/all-contacts-for-client",{clientCompanyId:s,contactType:"client"});if(P)return;const R=T.data??[];_(R),R.length>0&&!l.contacts.inHouseContact&&!t&&F&&d("inHouseContact",R[0])}catch(T){console.error("Error fetching contacts:",T),f&&T?.response?.status===403&&je.error("You don't have access to this client company's contacts."),P||_([])}finally{P||x(s)}})():(_([]),x(null)),()=>{P=!0}},[s,t]),B.useEffect(()=>{let P=!1;return s?(async()=>{try{const T=await ie.get(`${r}/client-companies/fees?clientCompanyId=${s}`);if(P)return;const R=T.data?.fees;b(Array.isArray(R)?R:[])}catch(T){console.error("Error fetching fees:",T),P||b([])}})():b([]),()=>{P=!0}},[s,r]),B.useEffect(()=>{let P=!1;return s&&!t&&!f&&(async()=>{try{const T=await ie.get(`${r}/client-companies/${s}/special-instructions`);if(P)return;T?.data?.specialInstructions&&o("specialInstructions",T.data.specialInstructions)}catch(T){console.error("Error fetching special instructions:",T)}})(),()=>{P=!0}},[s,r,t,f]),B.useEffect(()=>{let P=!1;return c&&!t&&N==="signing_service"&&(async()=>{try{const T=await ie.get(`/api/signing-service-users/${c}/users`);if(P)return;const R=si(T.data);v(R);const M=await ie.get(`/api/order-management-settings/${c}`);if(P)return;const U=M.data?.order_contact_default_email,{email:Z,reason:W}=ri(R,U);W==="fallback-ineligible"&&console.warn(`[order-contact] Configured default "${U}" is not an eligible order contact for signing service ${c} (inactive, or not marked as an order contact). Falling back to "${Z}".`),Z&&d("orderContactEmail",Z)}catch(T){console.error("Error fetching data for signing service:",T)}})(),()=>{P=!0}},[c,t,N]),B.useEffect(()=>{!f||!O||l.contacts.orderContactEmail||d("orderContactEmail",O)},[f,O,l.contacts.orderContactEmail]);const S=B.useRef(!1);B.useEffect(()=>{if(!f||t||e||S.current)return;
1if(l.details.fileNumber){S.current=!0;return}let P=!1;return(async()=>{try{const T=await ie.get("/api/orders/generate-file-number");if(P||S.current)return;T.data?.fileNumber&&(S.current=!0,o("fileNumber",T.data.fileNumber))}catch(T){console.error("Error generating file number:",T)}})(),()=>{P=!0}},[f,t,e,l.details.fileNumber]);const z=B.useCallback(P=>{P?.client_company_id&&u($=>$.some(T=>T.client_company_id===P.client_company_id)?$:[...$,P])},[]),I=B.useCallback(P=>{!P?.contact_name&&!P?.contact_email||_($=>$.some(T=>T.contact_email===P.contact_email&&T.contact_name===P.contact_name)?$:[...$,P])},[]);return{clients:g,signingServices:m,contactOptions:p,contactsLoadedFor:h,orderContactEmailOptions:y,fees:k,addContactOption:I,addClient:z}}function Ri(){const{state:t,dispatch:e}=Q(),{clientCompanyId:n}=t.contacts,r=t.signingServiceId;B.useEffect(()=>{let l=!1;return!n||!r?void 0:((async()=>{e({type:H.CUSTOMIZATIONS_LOADING});try{const o=await ie.get(`/api/client-schedule-order-customizations/${n}?signingServiceId=${r}`);if(l)return;e({type:H.CUSTOMIZATIONS_RESOLVED,customizations:o.data?.customizations??null})}catch(o){console.error("Error checking for customizations:",o),l||e({type:H.CUSTOMIZATIONS_RESOLVED,customizations:null})}})(),()=>{l=!0})},[n,r,e])}function Ft(t){const e=String(t??"").replace(/\D/g,"").slice(0,10);return e.length===0?"":e.length<4?`(${e}`:e.length<7?`(${e.slice(0,3)}) ${e.slice(3)}`:`(${e.slice(0,3)}) ${e.slice(3,6)}-${e.slice(6)}`}const zi=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Mi=/^\d{5}(-\d{4})?$/;function ke(t,e){const n=String(e??"").trim();if(!n)return null;switch(t){case"phone":return n.replace(/\D/g,"").length===10?"valid":"invalid";case"email":return zi.test(n)?"valid":"invalid";case"zip":return Mi.test(n)?"valid":"invalid";case"text":return"valid";default:return null}}const ct={phone:"Enter a 10-digit phone number",email:"Enter a valid email address",zip:"Enter a valid ZIP code"},Ge=10,Bi=[{field:"signingType",message:"Signing Type is required"},{field:"propertyAddress",message:"Property Address is required"},{field:"signingDate",message:"Signing Date is required"},{field:"signingTimeType",message:"Signing Time is required"},{field:"scanbacksRequired",message:"Scanbacks is required"},{field:"fileNumber",message:"File Number is required"},{field:"signerName",message:"Signer Name is required"},{field:"zipcode",message:"Zipcode is required"}],qi={clientCompanyId:"order",inHouseContact:"order",orderContactEmail:"order",fileNumber:"order",signingType:"order",scanbacksRequired:"order",signerName:"signer",signerPhone:"signer",signerEmail:"signer",additionalSigners:"signer",witnessCount:"signer",witnessProvider:"signer",signingDate:"location",signingTimeType:"location",specificTime:"location",startTime:"location",endTime:"location",propertyAddress:"location",city:"location",state:"location",zipcode:"location",signingAddress:"location",signingCity:"location",signingState:"location",signingZipcode:"location",invoiceTo:"invoicing",invoiceName:"invoicing",invoiceEmail:"invoicing",invoicePhone:"invoicing",invoicePropertyAddress:"invoicing",invoiceCity:"invoicing",invoiceState:"invoicing",invoiceZipcode:"invoicing"};function $t({contacts:t={},details:e={},hasCustomizations:n=!1,mode:r="signing_service"}){const l=[],a=r==="notary",o=(u,m)=>l.push({field:u,message:m,section:qi[u]??"order"});for(const{field:u,message:m}of Bi)e[u]||o(u,m);a||(t.clientCompanyId||o("clientCompanyId","Client is required"),t.inHouseContact||o("inHouseContact","Client contact is required")),a&&(e.signingTimeType==="at"&&!e.specificTime?o("specificTime","Specific Time is required when 'At Time' is selected"):e.signingTimeType==="range"&&(e.startTime||o("startTime","Start Time is required for a range"),e.endTime||o("endTime","End Time is required for a range")));const d=Array.isArray(e.additionalSigners)?e.additionalSigners:[];d.some(u=>u&&!String(u.firstName??"").trim()&&!String(u.lastName??"").trim()&&(u.email||u.phone))&&o("additionalSigners","Every additional signer needs a name");const c=d.filter(u=>u&&(String(u.firstName??"").trim()||String(u.lastName??"").trim())).length;if(1+(e.coSignerName?1:0)+c>Ge&&o("additionalSigners",`An order can have at most ${Ge} signers`),e.witnessCount){const u=Number(e.witnessCount);(!Number.isInteger(u)||u<1||u>4)&&o("witnessCount","Witness count must be between 1 and 4"),e.witnessProvider||o("witnessProvider","Choose who will provide the witnesses")}else e.witnessProvider&&o("witnessCount","Witness count is required when a provider is chosen");for(const u of["propertyAddress","city","state","zipcode"])e[u]||o(u,`${u} is required`);if(!e.isPropertyAddressSame)for(const u of["signingAddress","signingCity","signingState","signingZipcode"])e[u]||o(u,`${u} is required`);if(n){const u=e.signerPhone&&e.signerPhone.trim()!=="",m=e.signerEmail&&e.signerEmail.trim()!=="";!u&&!m&&o("signerPhone","At least one signer contact method (email or phone) is required"),e.invoiceName||o("invoiceName","Invoice contact name is required"),e.invoiceEmail||o("invoiceEmail","Invoice email is required"),(e.invoiceTo||"advisor")==="advisor"&&(e.invoicePhone||o("invoicePhone","Invoice phone is required"),e.invoicePropertyAddress||o("invoicePropertyAddress","Invoice address is required"),e.invoiceCity||o("invoiceCity","Invoice city is required"),e.invoiceState||o("invoiceState","Invoice state is required"),e.invoiceZipcode||o("invoiceZipcode","Invoice zipcode is required"))}return{valid:l.length===0,errors:l}}function Hi({contacts:t={},details:e={},hasCustomizations:n=!1,mode:r="signing_service"}){const{errors:l}
1=$t({contacts:t,details:e,hasCustomizations:n,mode:r}),a=new Set(l.map(g=>g.section)),o=new Set,d=["order","location","signer"];n&&d.push("invoicing");for(const g of d)a.has(g)||o.add(g);t.orderContactEmail||o.delete("order");const s=e.signingTimeType;s==="at"&&!e.specificTime&&o.delete("location"),s==="range"&&(!e.startTime||!e.endTime)&&o.delete("location");const c={signerPhone:["phone","signer"],signerEmail:["email","signer"],coSignerPhone:["phone","signer"],coSignerEmail:["email","signer"],zipcode:["zip","location"],signingZipcode:["zip","location"],invoiceEmail:["email","invoicing"],invoicePhone:["phone","invoicing"],invoiceZipcode:["zip","invoicing"]};for(const[g,[u,m]]of Object.entries(c))ke(u,e[g])==="invalid"&&o.delete(m);for(const g of Array.isArray(e.additionalSigners)?e.additionalSigners:[])g&&(ke("email",g.email)==="invalid"||ke("phone",g.phone)==="invalid")&&o.delete("signer");return o}const pt=(...t)=>fetch(...t),dt="AIzaSyC_b6cIghZEgJRjt1lLhDdRtHXHB3KPDAU";function nt(t){if(!t)return[0,0];const[e,n]=String(t).split(":").map(r=>parseInt(r,10));return isNaN(e)||isNaN(n)?[0,0]:[e,n]}async function Zi(t,e,{fetchFn:n=pt,now:r=Date.now}={}){const l=Math.floor(r()/1e3),o=await(await n(`https://maps.googleapis.com/maps/api/timezone/json?location=${t},${e}×tamp=${l}&key=${dt}`)).json();return o.status==="OK"?o.timeZoneId:(console.error("Error fetching timezone:",o.status),null)}async function Ui(t,{fetchFn:e=pt,now:n=Date.now}={}){try{const l=await(await e(`https://maps.googleapis.com/maps/api/geocode/json?address=${t}&key=${dt}`)).json();if(l.status==="OK"&&l.results.length>0){const{lat:a,lng:o}=l.results[0].geometry.location,s=await(await e(`https://maps.googleapis.com/maps/api/timezone/json?location=${a},${o}×tamp=${Math.floor(n()/1e3)}&key=${dt}`)).json();if(s.status==="OK")return s.timeZoneId}return null}catch(r){return console.error("Error getting timezone from zipcode:",r),null}}async function Gi(t,e={}){const{fetchFn:n=pt,now:r=Date.now,guess:l=()=>lt.tz.guess()}=e;if(t.ronSigning==="yes")return t.timeZoneId;let a=t.timeZoneId;const o=t.isPropertyAddressSame,d=o?t.propertyLatitude:t.signingLatitude,s=o?t.propertyLongitude:t.signingLongitude;if(d&&s){const c=await Zi(d,s,{fetchFn:n,now:r});c&&(a=c)}if(!a){const c=o?t.zipcode:t.signingZipcode;if(c&&c.trim()!==""){const g=await Ui(c,{fetchFn:n,now:r});g&&(a=g)}}if(!a){const c=oi(o?t.city:t.signingCity,o?t.state:t.signingState);c&&(a=c)}return a||(a=l()),a}function Yi(t,e,{guess:n=()=>lt.tz.guess()}={}){const r=t.signingTimeType;if(r!=="at"&&r!=="range")return{utc:{},error:null};const l=t.signingDate;if(!l)return{utc:{},error:"Signing date is missing"};const a=lt.tz(l,e||n());if(!a.isValid())return{utc:{},error:`Invalid signing date: ${l}`};if(r==="at"){const[m,C]=nt(t.specificTime);return{utc:{utcTimeDate:a.clone().set({hour:m,minute:C}).utc().format()},error:null}}const[o,d]=nt(t.startTime),[s,c]=nt(t.endTime),g=a.clone().set({hour:o,minute:d}),u=a.clone().set({hour:s,minute:c});return u.isSameOrBefore(g)&&u.add(1,"day"),{utc:{utcStartTimeDate:g.utc().format(),utcEndTimeDate:u.utc().format(),utcTimeDate:g.utc().format()},error:null}}function Vi(t){const e=t.propertyAddressLine2;return t.propertyAddress+(e?` ${e}`:"")}function Wi(t,e="signing_service"){if(e==="notary")return{userId:t?.userId,userRole:"notary",notaryId:t?.user_account?.notary_id};const n=t?.user_account?.account_type==="client",r=typeof localStorage<"u"&&localStorage.getItem("activeClientCompanyId")||t?.user_account?.client_company_id;return n?{userId:t?.userId,userRole:"client",clientCompanyId:r,clientUserId:t?.user_account?.client_user_id}:{userId:t?.userId,userRole:"signing_service",signingServiceId:t?.user_account?.signing_service_id,signingServiceUserId:null}}function Ki({contacts:t,details:e,signingServiceId:n,utc:r={}}){const l={signingContactsFormData:t,signingDetailsFormData:{...e,propertyAddress:Vi(e),propertyAddressLine2:void 0},signingServiceId:n};return r.utcTimeDate!==void 0&&(l.utcTimeDate=r.utcTimeDate),r.utcStartTimeDate!==void 0&&(l.utcStartTimeDate=r.utcStartTimeDate),r.utcEndTimeDate!==void 0&&(l.utcEndTimeDate=r.utcEndTimeDate),l}function Ji(t){const e=t?.signingDetailsFormData?.documents;return!!(e&&e.length>0)}function Xi(t,e,n=FormData){const r=new n;return r.append("signingContactsFormData",JSON.stringify(t.signingContactsFormData)),r.append("signingDetailsFormData",JSON.stringify(t.signingDetailsFormData)),r.append("signingServiceId",t.signingServiceId),r.append("requestedBy",JSON.stringify(e)),t.utcTimeDate&&r.append("utcTimeDate",t.utcTimeDate),t.utcStartTimeDate&&r.append("utcStartTimeDate",t.utcStartTimeDate),t.utcEndTimeDate&&r.append("utcEndTimeDate",t.utcEndTimeDate),t.signingDetailsFormData.documents.forEac
1h(l=>{l.file&&l.isNew&&r.append("documents",l.file)}),r}function Qi({orderData:t,user:e,edit:n,orderId:r,mode:l="signing_service",bookingId:a=null,FormDataCtor:o=FormData}){const d=Wi(e,l);if(l==="notary"){const s=e?.user_account?.notary_id;return n?{method:"put",url:`/api/orders/edit/${r}`,body:{...t,ownerNotaryId:s,requestedBy:d},multipart:!1}:{method:"post",url:"/api/orders/notary-owned/create",body:{...t,ownerNotaryId:s,requestedBy:d,bookingId:a||null},multipart:!1}}return n?{method:"put",url:`/api/order/edit/${r}`,body:{...t,requestedBy:d},multipart:!1}:Ji(t)?{method:"post",url:"/api/order/create-with-documents",body:Xi(t,d,o),multipart:!0}:{method:"post",url:"/api/order/create",body:{...t,requestedBy:d},multipart:!1}}function en({edit:t,orderId:e,clients:n,bookingId:r=null}){const{user:l}=Be(),{showOptimisticXpGain:a,handleXpBoost:o}=B.useContext(Gt)??{},{state:d,dispatch:s}=Q(),c=B.useRef(!1);return B.useCallback(async g=>{if(g?.preventDefault?.(),c.current)return;const{contacts:u,details:m,documents:C,signingServiceId:p,hasCustomizations:_,mode:h}=d,x=h==="notary",y=C.length>0?{...m,documents:C}:{...m},{valid:v,errors:k}=$t({contacts:u,details:y,hasCustomizations:_,mode:h});if(!v){s({type:H.VALIDATION_FAILED,errors:k}),document.getElementById(k[0].section)?.scrollIntoView({behavior:"smooth",block:"start"});return}if(x&&!l?.user_account?.notary_id){s({type:H.SUBMIT_FAILED,errorMessage:"Notary ID not found. Please ensure you're logged in as a notary."});return}c.current=!0,s({type:H.SUBMIT_STARTED});try{const b=await Gi(y),j={...y,timeZoneId:b},{utc:N,error:E}=Yi(j,b);if(E){s({type:H.SUBMIT_FAILED,errorMessage:E});return}const A=Ki({contacts:u,details:j,signingServiceId:p,utc:N}),w=Qi({orderData:A,user:l,edit:t,orderId:e,mode:h,bookingId:r});x&&!t&&a?.("order_created");const D=await(w.multipart?ie.post(w.url,w.body,{headers:{"Content-Type":"multipart/form-data"}}
1):ie[w.method](w.url,w.body));if(x&&!t&&(D.data?.xp_boost&&o?.(D.data.xp_boost),r&&D.data?.order_id))try{await ie.patch(`/api/bookings/${r}/link-order`,{orderId:D.data.order_id})}catch(O){console.error("Error linking booking to order:",O)}const f=n.find(O=>O.client_company_id===u.clientCompanyId),L=f?l?.user_account?.account_type==="client"?f.client_company_name:f.name:"";s({type:H.SUBMIT_SUCCEEDED,data:{...A,orderId:t?e:D.data.order_id,clientName:L}})}catch(b){console.error("Error submitting order:",b);const j=b.data||b.response?.data;let N="An unexpected error occurred";j?.error==="ORDER_LIMIT_EXCEEDED"?N=j.message||`You've reached your plan's order limit (${j.orderCount??"?"}/${j.orderLimit??"?"}). Upgrade to keep scheduling.`:j?.validationErrors?.length>0?N=j.validationErrors.map(E=>E.message).join(", "):j?.message?N=j.message:b.message&&(N=b.message),s({type:H.SUBMIT_FAILED,data:{orderId:e},errorMessage:N})}finally{c.current=!1}},[d,l,t,e,n,r,a,o,s])}function tn(t,e){const n=Y.c(6);let r;n[0]!==e?(r={},n[0]=e,n[1]=r):r=n[1];const{readingLine:l}=r,a=l===void 0?140:l,[o,d]=B.useState(t[0]??null);let s,c;return n[2]!==a||n[3]!==t?(s=()=>{if(typeof window>"u"||t.length===0)return;let g=!1;const u=()=>{g=!1;const p=document.scrollingElement??document.documentElement;if(p.scrollHeight>window.innerHeight+80&&window.innerHeight+window.scrollY>=p.scrollHeight-4){d(t[t.length-1]);return}let x=t[0];for(const y of t){const v=document.getElementById(y);if(v)if(v.getBoundingClientRect().top<=a)x=y;else break}d(x)},m=()=>{g||(g=!0,requestAnimationFrame(u))};u();const C=setTimeout(u,250);return window.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",m,{passive:!0}),()=>{clearTimeout(C),window.removeEventListener("scroll",m),window.removeEventListener("resize",m)}},c=[t,a],n[2]=a,n[3]=t,n[4]=s,n[5]=c):(s=n[4],c=n[5]),B.useEffect(s,c),o}function Qe(){return typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function Rt(t){const e=document.getElementById(t);e&&(e.scrollIntoView({behavior:Qe(),block:"start"}),e.focus?.({preventScroll:!0}))}const Nt={use_default:!0,show_client_company_selector:!0,show_primary_contact:!0,show_client_contact:!0,client_contact_label:"Client Contact",show_additional_contacts:!0,show_observer:!0,show_file_number:!0,file_number_label:"File Number",file_number_description:null,show_signing_type:!0,signing_type_label:"Signing Type",show_scanbacks:!0,scanbacks_label:"Scanbacks Required?",show_ron_signing:!0,ron_signing_label:"RON Signing?",show_scheduling_section:!0,scheduling_section_title:"Scheduling",show_signing_date:!0,signing_date_label:"Signing Date",show_signing_time:!0,signing_time_label:"Signing Time",hidden_time_types:[],show_signer_section:!0,signer_section_title:"Signer Information",show_signer_name:!0,signer_name_label:"Signer Name",show_signer_phone:!0,signer_phone_label:"Cell Phone",show_signer_email:!0,signer_email_label:"Email Address",show_spouse_section:!0,spouse_name_label:"Spouse Name",show_cosigner_section:!0,cosigner_section_title:"Co-signer Information",show_location_section:!0,location_section_title:"Location Information",show_property_address:!0,property_address_label:"Property Address",show_property_city_state_zip:!0,show_address_same_checkbox:!0,address_same_label:"Signing address same as Property Address",show_signing_address:!0,signing_address_label:"Signing Address",show_signing_city_state_zip:!0,show_additional_details:!0,additional_details_title:"Additional Details",show_esigning_platform:!0,esigning_platform_label:"E-signing Platform(s)",show_document_delivery:!0,document_delivery_label:"Document Delivery",show_language_selection:!0,language_label:"Language (Other than English)",show_lender:!0,lender_label:"Lender (email)",show_special_instructions:!0,special_instructions_label:"Special Instructions",special_instructions_placeholder:"Enter any special instructions or notes here"};function nn(t){return!t||t.use_default!==!1?Nt:{...Nt,...t}}function G(t,e){const n=t?.[e];return n===void 0?!0:!!n}function K(t,e,n){const r=t?.[e];return r==null||r===""?n:r}function sn(t){const e=t?.hidden_time_types;return Array.isArray(e)?e:[]}const st="duplicateOrderData";function zt(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch{return[]}return Array.isArray(e)?e.filter(n=>n&&typeof n=="object").map(n=>({firstName:n.firstName??"",lastName:n.lastName??"",role:n.role??"other",email:n.email??"",phone:n.phone??""})):[]}function rn(t){return{contacts:{clientCompanyId:t.client_company_id,inHouseContact:{contact_name:t.contact1_name,contact_email:t.contact1_email,contact_phone:t.contact1_phone},inHouseContact2:{contact_name:t.contact2_name,contact_email:t.contact2_email,contact_phone:t.contact2_phone},observer:t.observer,orderContactEmail:t.order_contact_email},details:{fileNumber:t.file_number,signingType:t.signing_type,scanbacksRequired:t.scanbacks_required,ronSigning:t.ron_signing,signerName:t.signer_name,signerPhone:t.signer_phone,signerEmail:t.signer_email,specificTime:t.signing_specific_time,signingDate:t.signing_date,signingTimeType:t.signing_time_type,startTime:t.signing_start_time,endTime:t.signing_end_time,spouseName:t.spouse_name,coSignerName:t.co_signer_name,coSignerSpouseName:t.co_signer_spouse_name,coSignerPhone:t.co_signer_phone,coSignerEmail:t.co_signer_email,additionalSigners:zt(t.additional_signers_json),witnessCount:t.witness_count?String(t.witness_count):"",witnessProvider:t.witness_provider??"",witnessNotes:t.witness_notes??"",signerAccommodations:t.signer_accommodations??"",propertyAddress:t.property_address,propertyAddressLine2:t.property_address_line2||"",city:t.city,state:t.state,zipcode:t.zipcode,esigningPlatform:t.esigning_platform,documentDelivery:t.document_delivery,language:t.language,lender:t.lender,specialInstructions:t.special_instructions,...t.private_note!==void 0?{privateNote:t.private_note??""}:{},invoiceFee:t.invoice_fee,notaryPay:t.notary_pay||"",isPropertyAddressSame:t.is_property_address_same,signingAddress:t.signing_address,signingCity:t.signing_city,signingState:t.signing_state,signingZipcode:t.signing_zipcode,timeZoneId:t.signing_timezone_id,propertyLatitude:t.property_latitude||"",propertyLongitude:t.property_longitude||"",signingLatitude:t.signing_latitude||"",signingLongitude:t.signing_longitude||"",originalPropertyAddress:t.property_address,originalSigningAddress:t.signing_address,originalIsPropertyAddressSame:t.is_property_address_same,invoiceTo:t.invoice_to||"",invoiceName:t.invoice_name||"",invoicePhone:t.invoice_phone||"",invoiceEmail:t.invoice_email||"",invoiceCompanyName:t.invoice_company_name||"",invoicePropertyAddress:t.invoice_property_address||"",invoiceCity:t.invoice_city||"",invoiceState:t.invoice_state||"",invoiceZipcode:t.invoice_zipcode||""}}}function on(t){return{contacts:{clientCompanyId:t.clientCompanyId??null,inHouseContact:t.inHouseContact??null,inHouseContact2:t.inHouseContact2??null,observer:t.observer??"",orderContactEmail:t.orderContactEmail??""},details:{fileNumber:t.fileNumber??"",signingType:t.signingType??"",scanbacksRequired:t.scanbacksRequired??"yes",ronSigning:t.ronSigning??"no",signerName:t.signerName??"",signerPhone:t.signerPhone??"",signerEmail:t.signerEmail??"",specificTime:t.signingSpecificTime??"",signingDate:t.signingDate??"",signingTimeType:t.signingTimeType??"",startTime:t.signingStartTime??"",endTime:t.signingEndTime??"",spouseName:t.spouseName??"",coSignerName:t.coSignerName??"",coSignerSpouseName:t.coSignerSpouseName??"",coSignerPhone:t.coSignerPhone??"",coSignerEmail:t.coSignerEmail??"",additionalSigners:zt(t.additionalSigners),witnessCount:t.witnessCount?String(t.witnessCount):"",witnessProvider:t.witnessProvider??"",witnessNotes:t.witnessNotes??"",signerAccommodations:t.signerAccommodations??"",propertyAddress:t.propertyAddress??"",propertyAddressLine2:t.propertyAddressLine2??"",city:t.propertyCity??"",state:t.propertyState??"",zipcode:t.propertyZip??"",signingAddress:t.signingAddress??"",signingCity:t.signingCity??"",signingState:t.signingState??"",signingZipcode:t.signingZip??"",esigningPlatform:t.esigningPlatform??"",documentDelivery:t.documentDelivery??"",language:t.language??"",lender:t.lender??"",specialInstructions:t.specialInstructions??"",...typeof t.privateNote=="string"?{privateNote:t.privateNote}:{},invoiceFee:t.invoiceFee||"",timeZoneId:t.signingTimezoneId??""}}}function an(t=window.localStorage){const e=t.getItem(st);if(!e)return null;try{const n=JSON.parse(e);return t.removeItem(st),on(n)}catch(n){return console.error("Could not restore the duplicated order:",n),t.removeItem(st),null}}function ln(t){const e=new Date(t);return Number.isNaN(e.getTime())?null:e.toISOString().split("T")[0]}function cn(t){const e={},n=[];if(!t)return{details:e,filledFields:n};const r=(l,a)=>{a==null||a===""||(e[l]=a,n.push(l))};if(r("signerName",t.signerName),r("signerPhone",t.signerPhone),r("signerEmail",t.signerEmail),r("coSignerName",t.coSignerName),t.signingDate){const l=ln(t.signingDate);l&&(e.signingDate=l,n.push("signingDate"))}return t.signingTime&&(e.specificTime=t.signingTime,e.signingTimeType="at",n.push("specificTime")),r("signingAddress",t.signingAddress),r("signingCity",t.signingCity),r("signingState",t.signingState),r("signingZipcode",t.signingZipcode),t.propertyAddress&&(e.propertyAddress=t.propertyAddress,e.isPropertyAddressSame=!1,n.push("propertyAddress")),r("signingType",t.signingType),r("lender",t.lender),r("fileNumber",t.fileNumber),r("notaryPay",t.notaryFee||t.notaryPay),r("specialInstructions",t.specialInstructions),{details:e,filledFields:n}}function dn(t,e=""){const n={},r={};if(!t)return{contacts:r,details:n};const l=new Date(t.scheduled_time);if(!Number.isNaN(l.getTime())){const a=l.getFullYear(),o=String(l.getMonth()+1).padStart(2,"0"),d=String(l.getDate()).padStart(2,"0");n.signingDate=`${a}-${o}-${d}`,n.signingTimeType="at",n.specificTime=`${String(l.getHours()).padStart(2,"0")}
1:${String(l.getMinutes()).padStart(2,"0")}`}return t.client_name&&(n.signerName=t.client_name),t.client_phone&&(n.signerPhone=t.client_phone),t.client_email&&(n.signerEmail=t.client_email),t.notes&&(n.specialInstructions=e?`${e} 2 3Booking Notes: ${t.notes}`:`Booking Notes: ${t.notes}`),t.address&&(n.propertyAddress=t.address),t.signing_address&&(n.signingAddress=t.signing_address),t.city&&(n.city=t.city),t.signing_city&&(n.signingCity=t.signing_city),t.state&&(n.state=t.state),t.signing_state&&(n.signingState=t.signing_state),t.zipcode&&(n.zipcode=t.zipcode),t.signing_zipcode&&(n.signingZipcode=t.signing_zipcode),t.signing_type_data&&(n.signingType=t.signing_type_data.type||"",n.invoiceFee=t.signing_type_data.invoiceFee||"",n.notaryPay=t.signing_type_data.notaryPay||""),t.client_company_id&&(r.clientCompanyId=t.client_company_id),{contacts:r,details:n}}function mn({enabled:t,orderId:e}){const{user:n}=Be(),r=gt(),l=yt("pro_notary"),a=yt("pro_plus_accounting_notary");B.useEffect(()=>{if(!t||!e||!n)return;let o=!1;return(async()=>{try{if(n.user_account?.account_type!=="notary"){r(`/admin/orders/${e}`);return}const s=await ie.get(`/api/orders/${e}`);if(o)return;if(s.data?.owner_notary_id!==n.user_account?.notary_id){r(`/admin/orders/${e}`);return}l||a||(je.error("You need a PRO membership to edit orders you don't own"),r(`/admin/orders/${e}`))}catch(s){console.error("Error checking permissions:",s),o||r(`/admin/orders/${e}`)}})(),()=>{o=!0}},[t,e,n,r,l,a])}const Mt=[{id:"order",label:"Order",hint:"Client, file, signing type"},{id:"location",label:"Location & Appointment",hint:"Where and when"},{id:"signer",label:"Signer",hint:"Who is signing"},{id:"invoicing",label:"Invoicing",hint:"Who should be invoiced",customOnly:!0},{id:"finish",label:"Finish",hint:"Notes, documents, submit"}],un=new Set(["order","location","signer","invoicing"]);function ht(t){return Mt.filter(e=>!e.customOnly||t)}Mt.map(t=>t.id);const Bt=B.createContext({activeId:null,activate:()=>{},sections:[],doneIds:new Set});function gn(){return B.useContext(Bt)}const qt={order:mi,location:di,signer:ci,invoicing:li,finish:ai};function fn({activeId:t,errorSections:e=new Set,doneSections:n=new Set,hasCustomizations:r=!1}){const l=ht(r);return i.jsx("nav",{"aria-label":"Order sections","data-testid":"section-nav",children:i.jsx("ol",{className:"m-0 list-none space-y-1",style:{paddingLeft:0},children:l.map(a=>{const o=qt[a.id]??Se,d=a.id===t,s=e.has(a.id),g=un.has(a.id)&&n.has(a.id)&&!s;return i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>Rt(a.id),"aria-current":d?"step":void 0,"data-testid":`nav-${a.id}`,className:J("group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-sm transition-colors",d?"bg-ne-mist font-semibold text-ne-ink":"text-ne-gray hover:bg-ne-mist/60 hover:text-ne-ink"),children:[i.jsx("span",{className:J("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border transition-colors",d?"border-ne-ink bg-ne-ink text-white":g?"border-ne-line bg-white text-emerald-600/70":"border-ne-line bg-white text-ne-gray group-hover:border-ne-ink/40",s&&"border-red-500 bg-red-500 text-white"),children:g&&!d?i.jsx(Se,{size:15,strokeWidth:2.5,"aria-label":"complete"}):i.jsx(o,{size:15,strokeWidth:2,"aria-hidden":"true"})}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.label}),g&&i.jsx(Se,{size:13,strokeWidth:2.5,"aria-label":"complete","data-testid":`done-${a.id}`,className:"shrink-0 text-emerald-600/70"}),s&&i.jsx("span",{className:"text-xs font-medium text-red-600","aria-label":"section has errors",children:"!"})]})},a.id)})})})}function pn(t){const{signingDate:e,signingTimeType:n,specificTime:r,startTime:l,endTime:a}=t;if(!e)return"";const o=it(e,["YYYY-MM-DD",it.ISO_8601],!0),d=o.isValid()?o.format("ddd, MMM D"):e,s=c=>{const g=it(c,"HH:mm",!0);return g.isValid()?g.format("h:mm A"):c};if(n==="at"&&r)return`${d} · ${s(r)}`;if(n==="range"&&l&&a){const c=a<=l;return`${d} · ${s(l)}â${s(a)}${c?" (+1 day)":""}`}return n==="tbd"?`${d} · TBD`:n==="asap"?`${d} · ASAP`:d}function hn(t){const{signerName:e,coSignerName:n,additionalSigners:r}=t;if(!e)return"";const l=Array.isArray(r)?r.filter(o=>o&&(o.firstName||o.lastName)).length:0,a=n?`${e} + ${n}`:e;return l>0?`${a} +${l} more`:a}function yn(t){const e=t.isPropertyAddressSame,n=e?t.propertyAddress:t.signingAddress,r=e?t.city:t.signingCity,l=e?t.state:t.signingState,a=e?t.zipcode:t.signingZipcode;if(n&&r&&n.toLowerCase().includes(r.toLowerCase()))return n;
3const o=[r,[l,a].filter(Boolean).join(" ")].filter(Boolean).join(", ");return[n,o].filter(Boolean).join(", ")}function Ue(t){const e=Y.c(9),{label:n,value:r,testId:l,accent:a}=t,o=!r;let d;e[0]!==n?(d=i.jsx("dt",{className:"shrink-0 text-xs uppercase tracking-wide text-ne-gray",children:n}),e[0]=n,e[1]=d):d=e[1];const s=o?"text-right text-sm italic text-ne-gray/70":`min-w-0 text-right text-sm ${a?"font-semibold text-ne-ink":"font-medium text-ne-ink"}`,c=o?"not set":r;let g;e[2]!==s||e[3]!==c||e[4]!==l?(g=i.jsx("dd",{"data-testid":l,className:s,children:c}),e[2]=s,e[3]=c,e[4]=l,e[5]=g):g=e[5];let u;return e[6]!==d||e[7]!==g?(u=i.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-1.5",children:[d,g]}),e[6]=d,e[7]=g,e[8]=u):u=e[8],u}function xn(t){const e=Y.c(21),{clients:n}=t;let r;e[0]!==n?(r=n===void 0?[]:n,e[0]=n,e[1]=r):r=e[1];const l=r,{state:a}=Q(),{details:o,contacts:d,documents:s}=a;let c;if(e[2]!==l||e[3]!==d.clientCompanyId){let b;e[5]!==d.clientCompanyId?(b=j=>j.client_company_id===d.clientCompanyId,e[5]=d.clientCompanyId,e[6]=b):b=e[6],c=l.find(b),e[2]=l,e[3]=d.clientCompanyId,e[4]=c}else c=e[4];const g=c,u=g?g.client_company_name||g.name:"",m=o.ronSigning==="yes",C=o.scanbacksRequired==="yes",p=!!(d.clientCompanyId||o.fileNumber||o.signingType||o.signerName||o.signingDate||o.propertyAddress||o.signingAddress||o.invoiceFee||m||s.length>0),_=p?"mb-3":"mb-2";let h,x;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=i.jsx("h2",{className:"text-sm font-semibold text-ne-ink",children:"Summary"}),x=i.jsx("p",{className:"mt-0.5 text-xs text-ne-gray",children:"A live snapshot of the order as you fill it in."}),e[7]=h,e[8]=x):(h=e[7],x=e[8]);let y;e[9]!==_?(y=i.jsxs("div",{className:_,children:[h,x]}),e[9]=_,e[10]=y):y=e[10];let v;e[11]!==u||e[12]!==o||e[13]!==s||e[14]!==p||e[15]!==m||e[16]!==C?(v=p?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"border-y border-ne-line py-3",children:[i.jsx("p",{"data-testid":"summary-client",className:u?"truncate text-sm font-semibold text-ne-ink":"text-sm italic text-ne-gray/70",children:u||"No client selected"}),i.jsx("p",{"data-testid":"summary-fileNumber",className:"mt-0.5 truncate text-xs font-normal text-ne-gray",children:o.fileNumber||"no file number"}),i.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[m&&i.jsx("span",{"data-testid":"summary-tag-ron",className:"rounded-full bg-ne-ink px-2 py-0.5 text-[11px] font-semibold text-white",children:"RON"}),C&&i.jsx("span",{"data-testid":"summary-tag-scanbacks",className:"rounded-full bg-ne-mist px-2 py-0.5 text-[11px] font-medium text-ne-ink",children:"Scanbacks"}),s.length>0&&i.jsxs("span",{"data-testid":"summary-tag-docs",className:"rounded-full bg-ne-mist px-2 py-0.5 text-[11px] font-medium text-ne-ink",children:[s.length," doc",s.length===1?"":"s"]})]})]}),i.jsxs("dl",{className:"divide-y divide-ne-line/60",children:[i.jsx(Ue,{label:"Type",value:o.signingType,testId:"summary-signingType",accent:!0}),i.jsx(Ue,{label:"When",value:pn(o),testId:"summary-when",accent:!0}),i.jsx(Ue,{label:"Signer",value:hn(o),testId:"summary-signers"}),i.jsx(Ue,{label:"Where",value:yn(o),testId:"summary-location"}),i.jsx(Ue,{label:"Fee",value:o.invoiceFee?`$${o.invoiceFee}`:"",testId:"summary-invoiceFee"})]})]}):i.jsxs("div",{"data-testid":"summary-empty",className:"flex items-center gap-3 rounded-lg bg-ne-mist/60 px-3 py-3",children:[i.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-ne-line bg-white",children:i.jsx(ui,{size:16,className:"text-ne-ink/70","aria-hidden":"true"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-sm font-medium text-ne-ink",children:"Your order takes shape here"}),i.jsx("p",{className:"text-xs text-ne-gray",children:"Pick a client to get started."})]})]}),e[11]=u,e[12]=o,e[13]=s,e[14]=p,e[15]=m,e[16]=C,e[17]=v):v=e[17];let k;return e[18]!==y||e[19]!==v?(k=i.jsxs("div",{"data-testid":"summary-rail",className:"rounded-xl border border-ne-line bg-white p-3",children:[y,v]}),e[18]=y,e[19]=v,e[20]=k):k=e[20],k}const vn=8;function bn(){const t=document.querySelector('[data-testid="schedule-order-v2-form"]');if(!t)return[];const e=[],n=new Set,r=(l,a,o)=>{const d=(l??"").replace(/\s+/g," ").replace(/\*\s*$/,"").trim();if(!d||!a)return;const s=d.toLowerCase();if(n.has(s))return;n.add(s);const c=a.closest('[data-testid^="section-"]');e.push({label:d,el:a,kind:o,sectionId:c?.id??null,sectionTitle:c?.querySelector('[id$="-title"]')?.textContent?.trim()??""})};return t.querySelectorAll("label[for]").forEach(l=>{r(l.textContent,document.getElementById(l.htmlFor),"field")}),t.querySelectorAll("legend").forEach(l=>{r(l.textContent,l,"field")}),t.querySelectorAll('[data-testid^="disclosure-"]').forEach(l=>{r(l.textContent,l,"reveal")}),e}function _n(t,e){const n=e.trim().toLowerCase();if(!n)return[];const r=[],l=[];for(const a of t){const o=a.label.toLowerCase();o.startsWith(n)?r.push(a):o.includes(n)&&l.push(a)}return[...r,...l].slice(0,vn)}function Nn(t){const e=Y.c(33),{onNavigate:n}=t,[r,l]=B.useState("");let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];const[o,d]=B.useState(a),[s,c]=B.useState(0),[g,u]=B.useState(!1),m=B.useRef(null),C=B.useRef(null);let p,_;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const I=P=>{m.current&&!m.current.contains(P.target)&&(l(""),d([]))};return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},_=[],e[1]=p,e[2]=_):(p=e[1],_=e[2]),B.useEffect(p,_);let h,x;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{const I=P=>{if(P.key!=="/"||P.metaKey||P.ctrlKey||P.altKey)return;const $=P.target,T=$?.tagName?.toLowerCase();T==="input"||T==="textarea"||T==="select"||$?.isContentEditable||(P.preventDefault(),C.current?.focus())};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},x=[],e[3]=h,e[4]=x):(h=e[3],x=e[4]),B.useEffect(h,x);let y;e[5]===Symbol.for("react.memo_cache_sentinel")?(y=I=>
3{l(I),d(_n(bn(),I)),c(0)},e[5]=y):y=e[5];const v=y;let k;e[6]!==n?(k=I=>{I&&(I.sectionId&&n?.(I.sectionId),I.el.scrollIntoView({behavior:Qe(),block:"center"}),I.el.focus?.({preventScroll:!0}),l(""),d([]))},e[6]=n,e[7]=k):k=e[7];const b=k;let j;e[8]!==b||e[9]!==s||e[10]!==o?(j=I=>{o.length!==0&&(I.key==="ArrowDown"?(I.preventDefault(),c(P=>(P+1)%o.length)):I.key==="ArrowUp"?(I.preventDefault(),c(P=>(P-1+o.length)%o.length)):I.key==="Enter"?(I.preventDefault(),b(o[s])):I.key==="Escape"&&(l(""),d([])))},e[8]=b,e[9]=s,e[10]=o,e[11]=j):j=e[11];const N=j;let E;e[12]===Symbol.for("react.memo_cache_sentinel")?(E=i.jsx(fi,{size:13,className:"shrink-0 text-ne-gray","aria-hidden":"true"}),e[12]=E):E=e[12];const A=o.length>0;let w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=I=>v(I.target.value),e[13]=w):w=e[13];let D,f;e[14]===Symbol.for("react.memo_cache_sentinel")?(D=()=>u(!0),f=()=>u(!1),e[14]=D,e[15]=f):(D=e[14],f=e[15]);let L;e[16]!==N||e[17]!==r||e[18]!==A?(L=i.jsx("input",{ref:C,type:"text",role:"combobox","aria-expanded":A,"aria-label":"Search form fields","aria-keyshortcuts":"/","data-testid":"field-search",value:r,onChange:w,onKeyDown:N,onFocus:D,onBlur:f,placeholder:"Find a fieldâ¦",className:"w-36 bg-transparent text-xs text-ne-ink placeholder:text-ne-gray/70 focus:outline-none md:w-48"}),e[16]=N,e[17]=r,e[18]=A,e[19]=L):L=e[19];let O;e[20]!==g||e[21]!==r?(O=!g&&!r&&i.jsx("kbd",{"aria-hidden":"true",className:"rounded border border-ne-line bg-white px-1.5 py-0.5 text-[10px] font-medium leading-none text-ne-gray",children:"/"}),e[20]=g,e[21]=r,e[22]=O):O=e[22];let F;e[23]!==L||e[24]!==O?(F=i.jsxs("div",{className:"flex h-8 items-center gap-2 rounded-md border border-ne-line bg-ne-mist/50 px-2.5 focus-within:border-ne-ink/40 focu
3s-within:bg-white",children:[E,L,O]}),e[23]=L,e[24]=O,e[25]=F):F=e[25];let S;e[26]!==b||e[27]!==s||e[28]!==o?(S=o.length>0&&i.jsx("ul",{role:"listbox","data-testid":"field-search-results",className:"absolute right-0 top-9 z-30 m-0 w-72 list-none rounded-lg border border-ne-line bg-white py-1 shadow-lg shadow-ne-ink/10",style:{paddingLeft:0},children:o.map((I,P)=>i.jsx("li",{children:i.jsxs("button",{type:"button",role:"option","aria-selected":P===s,onPointerDown:$=>{$.preventDefault(),b(I)},onPointerEnter:()=>c(P),className:J("flex w-full items-center justify-between gap-3 px-3 py-1.5 text-left",P===s?"bg-ne-mist":"bg-white"),children:[i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block truncate text-xs font-medium text-ne-ink",children:I.kind==="reveal"?`Reveal: ${I.label}`:I.label}),I.sectionTitle&&i.jsx("span",{className:"block truncate text-[10px] text-ne-gray",children:I.sectionTitle})]}),P===s&&i.jsx(gi,{size:12,className:"shrink-0 text-ne-gray","aria-hidden":"true"})]})},`${I.label}-${P}`))}),e[26]=b,e[27]=s,e[28]=o,e[29]=S):S=e[29];let z;return e[30]!==F||e[31]!==S?(z=i.jsxs("div",{ref:m,className:"relative",children:[F,S]}),e[30]=F,e[31]=S,e[32]=z):z=e[32],z}const rt={control:(t,e)=>({...t,minHeight:"2.5rem",borderRadius:"0.375rem",fontSize:"0.875rem",borderColor:e.isFocused?"rgba(1, 24, 57, 0.4)":e.hasValue?"#6ee7b7":"#E4E7EB",backgroundColor:e.hasValue?"rgba(236, 253, 245, 0.4)":"#ffffff",boxShadow:e.isFocused?"0 0 0 2px rgba(1, 24, 57, 0.15)":"none","&:hover":{borderColor:e.hasValue?"#34d399":"rgba(1, 24, 57, 0.3)"}}),placeholder:t=>({...t,color:"rgba(144, 146, 148, 0.8)",fontSize:"0.875rem"}),singleValue:t=>({...t,color:"#011839"}),option:(t,e)=>({...t,fontSize:"0.875rem",color:"#011839",backgroundColor:e.isFocused?"#F4F6F8":"#ffffff"}),menu:t=>({...t,zIndex:30})},ot={SingleValue:t=>i.jsx(bi.SingleValue,{...t,children:i.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.375rem",maxWidth:"100%"},children:[i.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.children}),i.jsx(Se,{size:14,strokeWidth:2.5,"aria-hidden":"true",style:{flexShrink:0,color:"rgba(5, 150, 105, 0.8)"}})]})})},Sn=64;function Ve(t){const e=Y.c(58),{id:n,title:r,hint:l,children:a,action:o}=t,{activeId:d,activate:s,sections:c,doneIds:g}=gn();let u;e[0]!==g||e[1]!==n?(u=g?.has(n),e[0]=g,e[1]=n,e[2]=u):u=e[2];const m=!!u,C=qt[n],p=d===n,_=c.findIndex(Z=>Z.id===n),h=_>=0?c[_+1]:null;let x;e[3]!==s||e[4]!==h?(x=()=>{if(!h)return;s(h.id);const Z=document.getElementById(h.id);Z?.scrollIntoView({behavior:Qe(),block:"start"}),Z?.querySelector("input:not([type=hidden]), select, textarea")?.focus({preventScroll:!0})},e[3]=s,e[4]=h,e[5]=x):x=e[5];const y=x;let v;e[6]!==s||e[7]!==n?(v=Z=>{if(s(n),Z.target.closest("select"))return;const W=Z.currentTarget;Math.abs(W.getBoundingClientRect().top-Sn)>48&&W.scrollIntoView({behavior:Qe(),block:"start"})},e[6]=s,e[7]=n,e[8]=v):v=e[8];const k=v,b=`${n}-title`,j=`section-${n}`;let N;e[9]!==s||e[10]!==n?(N=()=>s(n),e[9]=s,e[10]=n,e[11]=N):N=e[11];const E=p?"shadow-md shadow-ne-ink/5":"shadow-sm",A=m&&"ne-done-card";let w;e[12]!==E||e[13]!==A?(w=J("scroll-mt-16 border-ne-line focus:outline-none","transition-shadow duration-300 ease-out motion-reduce:transition-none",E,A),e[12]=E,e[13]=A,e[14]=w):w=e[14];let D;e[15]!==C||e[16]!==m||e[17]!==n?(D=C&&i.jsx("span",{"aria-hidden":"true","data-testid":m?`card-icon-done-${n}`:void 0,className:J("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border transition-colors",m?"border-emerald-200 bg-emerald-50 text-emerald-600":"border-transparent bg-ne-mist text-ne-ink"),children:i.jsx(C,{size:16,strokeWidth:2})}),e[15]=C,e[16]=m,e[17]=n,e[18]=D):D=e[18];const f=`${n}-title`;let L;e[19]===Symbol.for("react.memo_cache_sentinel")?(L={margin:0},e[19]=L):L=e[19];const O=m?"text-emerald-700":"text-ne-ink";let F;e[20]!==O?(F=J("whitespace-nowrap text-base font-semibold leading-none",O),e[20]=O,e[21]=F):F=e[21];let S;e[22]!==f||e[23]!==F||e[24]!==r?(S=i.jsx(_i,{id:f,style:L,className:F,children:r}),e[22]=f,e[23]=F,e[24]=r,e[25]=S):S=e[25];let z;e[26]!==m||e[27]!==n?(z=m&&i.jsx(Se,{size:14,strokeWidth:2.5,"aria-label":"section complete","data-testid":`card-done-${n}`,className:"shrink-0 self-center text-emerald-600/70"}),e[26]=m,e[27]=n,e[28]=z):z=e[28];let I;e[29]!==l?(I=l&&i.jsx("p",{style:{margin:0},className:"min-w-0 truncate text-xs leading-none text-ne-gray",children:l}),e[29]=l,e[30]=I):I=e[30];let P;e[31]!==S||e[32]!==z||e[33]!==I?(P=i.jsxs("div",{className:"flex min-w-0 items-baseline gap-x-2",children:[S,z,I]}),e[31]=S,e[32]=z,e[33]=I,e[34]=P):P=e[34];let $;e[35]!==D||e[36]!==P?($=i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[D,P]}),e[35]=D,e[36]=P,e[37]=$):$=e[37];let T;e[38]!==o||e[39]!==$?(T=i.jsxs(Ni,{className:"flex flex-row items-center justify-between gap-4 space-y-0 px-6 py-3.5",children:[$,o]}),e[38]=o,e[39]=$,e[40]=T):T=e[40];let R;e[41]!==m||e[42]!==y||e[43]!==n||e[44]!==h?(R=h&&i.jsx("div",{className:"flex justify-end pt-1",children:i.jsxs("button",{type:"button",onClick:y,"data-testid":`next-${n}`,className:J("inline-flex items-center gap-1.5 rounded-md border border-ne-line bg-white px-3.5 py-1.5","text-xs font-medium text-ne-gray transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",m?"border-ne-ink/40 font-semibold text-ne-ink hover:border-ne-ink":"hover:border-ne-ink/40 hover:text-ne-ink"),children:["Next: ",h.label," ",i.jsx("span",{"aria-hidden":"true",children:"â"})]})}),e[41]=m,e[42]=y,e[43]=n,e[44]=h,e[45]=R):R=e[45];let M;e[46]!==a||e[47]!==R?(M=i.jsxs(Si,{className:"space-y-4",children:[a,R]}),e[46]=a,e[47]=R,e[48]=M):M=e[48];let U;return e[49]!==k||e[50]!==n||e[51]!==T||e[52]!==M||e[53]!==b||e[54]!==j||e[55]!==N||e[56]!==w?(U=i.jsxs(Ci,{id:n,tabIndex:-1,"aria-labelledby":b,"data-testid":j,onFocusCapture:N,onClickCapture:k,className:w,children:[T,M]}),e[49]=k,e[50]=n,e[51]=T,e[52]=M,e[53]=b,e[54]=j,e[55]=N,e[56]=w,e[57]=U):U=e[57],U}function Ne(t){const e=Y.c(6),{label:n,forceOpen:r,testId:l,children:a}=t,o=r===void 0?!1:r,[d,s]=B.useState(!1);if(!(d||o)){let c,g,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>s(!0),g=J("flex w-fit items-center gap-1 text-xs font-medium text-ne-ink/70","underline underline-offset-4 transition-colors hover:text-ne-ink","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30 rounded-sm"),u=i.jsx("span",{"aria-hidden":"true",children:"+"}),e[0]=c,e[1]=g,e[2]=u):(c=e[0],g=e[1],u=e[2]);let m;return e[3]!==n||e[4]!==l?(m=i.jsxs("button",{type:"button","data-testid":l,onClick:c,className:g,children:[u," ",n]}),e[3]=n,e[4]=l,e[5]=m):m=e[5],m}return a}const Cn=t=>e=>{e&&(e.classList.toggle("ne-tint",t),t?(e.style.setProperty("border-color","#6ee7b7","important"),e.style.setProperty("background-color","rgba(236, 253, 245, 0.4)","important")):(e.style.removeProperty("border-color"),e.style.removeProperty("background-color")))},et="flex h-10 w-full appearance-none rounded-md border border-ne-line bg-white py-2 pl-3 pr-9 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30 disabled:cursor-not-allowed disabled:opacity-50",tt=()=>{const t=Y.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(Tt,{size:15,"aria-hidden":"true",className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-ne-gray"}),t[0]=e):e=t[0],e};function jn({contactType:t,clientCompanyId:e,onCreate:n,testId:r}){const{user:l}
3=Be(),[a,o]=B.useState(!1),[d,s]=B.useState(!1),[c,g]=B.useState(!0),[u,m]=B.useState({first:"",last:"",email:"",phone:""}),C=y=>v=>m(k=>({...k,[y]:v.target.value})),p=[u.first.trim(),u.last.trim()].filter(Boolean).join(" "),_=!!(p&&(u.email.trim()||u.phone.trim())),h=()=>{m({first:"",last:"",email:"",phone:""}),g(!0),s(!1),o(!1)},x=async()=>{const y={contact_name:p,contact_email:u.email.trim(),contact_phone:u.phone.trim()};if(!c){n(y),h();return}s(!0);try{const v=await ie.post("/api/contacts",{...y,userId:l?.userId,clientCompanyId:e,contactType:t});je.success("Contact added"),n(v.data??y),h()}catch(v){console.error("Error adding contact:",v),je.error("Error adding contact"),s(!1)}};return a?i.jsxs("div",{"data-testid":r,className:"space-y-3 rounded-lg border border-ne-line bg-ne-mist/40 p-3",children:[i.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-ne-gray",children:"New contact"}),i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx(X,{htmlFor:`${r}-first`,className:"text-xs font-medium text-ne-ink",children:"First name"}),i.jsx(ze,{id:`${r}-first`,value:u.first,onChange:C("first"),className:"h-9 border-ne-line bg-white text-sm focus-visible:ring-ne-ink/30"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(X,{htmlFor:`${r}-last`,className:"text-xs font-medium text-ne-ink",children:"Last name"}),i.jsx(ze,{id:`${r}-last`,value:u.last,onChange:C("last"),className:"h-9 border-ne-line bg-white text-sm focus-visible:ring-ne-ink/30"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(X,{htmlFor:`${r}-email`,className:"text-xs font-medium text-ne-ink",children:"Email"}),i.jsx(ze,{id:`${r}-email`,type:"email",value:u.email,onChange:C("email"),placeholder:"[email protected]",className:"h-9 border-ne-line bg-white text-sm focus-visible:ring-ne-ink/30"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx(X,{htmlFor:`${r}-phone`,className:"text-xs font-medium text-ne-ink",children:"Phone"}),i.jsx(ze,{id:`${r}-phone`,type:"tel",value:u.phone,onChange:C("phone"),placeholder:"(555) 123-4567",className:"h-9 border-ne-line bg-white text-sm focus-visible:ring-ne-ink/30"})]})]}),i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("label",{className:"flex items-center gap-2 text-xs text-ne-ink",children:[i.jsx("input",{type:"checkbox",checked:c,onChange:y=>g(y.target.checked),className:"h-3.5 w-3.5 rounded border-ne-line text-ne-ink focus:ring-ne-ink/30"}),"Save to contact book"]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button",onClick:h,className:"rounded-md px-3 py-1.5 text-xs font-medium text-ne-gray hover:text-ne-ink",children:"Cancel"}),i.jsx("button",{type:"button","data-testid":`${r}-save`,onClick:x,disabled:!_||d,className:J("rounded-md bg-ne-ink px-3.5 py-1.5 text-xs font-semibold text-white","transition-colors hover:bg-ne-ink-light","disabled:cursor-not-allowed disabled:opacity-40"),children:d?"Addingâ¦":"Add contact"})]})]}),!_&&i.jsx("p",{className:"text-[11px] text-ne-gray",children:"A name and at least one of email or phone are required."})]}):i.jsxs("p",{className:"text-xs text-ne-gray",children:["Donât see the contact?"," ",i.jsx("button",{type:"button","data-testid":`${r}-open`,onClick:()=>o(!0),className:J("font-medium text-ne-ink/80 underline underline-offset-4 transition-colors hover:text-ne-ink","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30 rounded-sm"),children:"Create a new client contact"})]})}const Ie=t=>t?`${t.contact_email??""}|${t.contact_name??""}`:"",Ht=t=>t?[t.contact_name,t.contact_email].filter(Boolean).join(" â "):"";function St(t){const e=Y.c(55),{field:n,label:r,contacts:l,selected:a,disabled:o,required:d,placeholder:s,error:c,onSelect:g,contactType:u,clientCompanyId:m,onCreated:C}=t,p=`field-${n}`;let _;e[0]!==d?(_=d&&i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"}),e[0]=d,e[1]=_):_=e[1];let h;e[2]!==p||e[3]!==r||e[4]!==_?(h=i.jsxs(X,{htmlFor:p,className:"text-sm font-medium text-ne-ink",children:[r,_]}),e[2]=p,e[3]=r,e[4]=_,e[5]=h):h=e[5];let x;e[6]!==a?(x=Ie(a),e[6]=a,e[7]=x):x=e[7];let y;e[8]!==c||e[9]!==a?(y=Ie(a)!==""&&!c,e[8]=c,e[9]=a,e[10]=y):y=e[10];let v;e[11]!==y?(v=Cn(y),e[11]=y,e[12]=v):v=e[12];const k=d||void 0,b=c?"true":void 0;let j;e[13]!==l||e[14]!==g?(j=I=>{const P=l.find($=>Ie($)===I.target.value);g(P??null)},e[13]=l,e[14]=g,e[15]=j):j=e[15];const N=c&&"border-red-500";let E;e[16]!==N?(E=J(et,N),e[16]=N,e[17]=E):E=e[17];let A;e[18]!==s?(A=i.jsx("option",{value:"",children:s}),e[18]=s,e[19]=A):A=e[19];let w;e[20]!==l?(w=l.map(wn),e[20]=l,e[21]=w):w=e[21];let D;e[22]!==l||e[23]!==a?(D=a&&!l.some(I=>Ie(I)===Ie(a))&&i.jsx("option",{value:Ie(a),children:Ht(a)}),e[22]=l,e[23]=a,e[24]=D):D=e[24];let f;e[25]!==o||e[26]!==n||e[27]!==p||e[28]!==E||e[29]!==A||e[30]!==w||e[31]!==D||e[32]!==x||e[33]!==v||e[34]!==k||e[35]!==b||e[36]!==j?(f=i.jsxs("select",{id:p,name:n,value:x,disabled:o,ref:v,"aria-required":k,"aria-invalid":b,onChange:j,className:E,
3children:[A,w,D]}),e[25]=o,e[26]=n,e[27]=p,e[28]=E,e[29]=A,e[30]=w,e[31]=D,e[32]=x,e[33]=v,e[34]=k,e[35]=b,e[36]=j,e[37]=f):f=e[37];let L;e[38]===Symbol.for("react.memo_cache_sentinel")?(L=i.jsx(tt,{}),e[38]=L):L=e[38];let O;e[39]!==f?(O=i.jsxs("div",{className:"relative",children:[f,L]}),e[39]=f,e[40]=O):O=e[40];let F;e[41]!==c?(F=c&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:c}),e[41]=c,e[42]=F):F=e[42];let S;e[43]!==m||e[44]!==u||e[45]!==o||e[46]!==n||e[47]!==C||e[48]!==g?(S=u&&!o&&i.jsx(jn,{contactType:u,clientCompanyId:m,testId:`create-${n}`,onCreate:I=>{g(I),C?.(I)}}),e[43]=m,e[44]=u,e[45]=o,e[46]=n,e[47]=C,e[48]=g,e[49]=S):S=e[49];let z;return e[50]!==O||e[51]!==F||e[52]!==S||e[53]!==h?(z=i.jsxs("div",{className:"space-y-1.5",children:[h,O,F,S]}),e[50]=O,e[51]=F,e[52]=S,e[53]=h,e[54]=z):z=e[54],z}function wn(t){return i.jsx("option",{value:Ie(t),children:Ht(t)},Ie(t))}const qe="border-ne-line focus-visible:ring-ne-ink/30 focus-visible:ring-offset-0",We="ne-tint",En=t=>e=>{e&&(e.classList.toggle("ne-tint",t),t?(e.style.setProperty("border-color","#6ee7b7","important"),e.style.setProperty("background-color","rgba(236, 253, 245, 0.4)","important")):(e.style.removeProperty("border-color"),e.style.removeProperty("background-color")))};function He(t){const e=Y.c(16),{id:n,label:r,required:l,error:a,hint:o,children:d}=t;let s;e[0]!==l?(s=l&&i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"}),e[0]=l,e[1]=s):s=e[1];let c;e[2]!==n||e[3]!==r||e[4]!==s?(c=i.jsxs(X,{htmlFor:n,className:"text-sm font-medium text-ne-ink",children:[r,s]}),e[2]=n,e[3]=r,e[4]=s,e[5]=c):c=e[5];let g;e[6]!==a||e[7]!==o?(g=o&&!a&&i.jsx("p",{className:"text-xs text-ne-gray",children:o}),e[6]=a,e[7]=o,e[8]=g):g=e[8];let u;e[9]!==a?(u=a&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:a}),e[9]=a,e[10]=u):u=e[10];let m;return e[11]!==d||e[12]!==c||e[13]!==g||e[14]!==u?(m=i.jsxs("div",{className:"space-y-1.5",children:[c,d,g,u]}),e[11]=d,e[12]=c,e[13]=g,e[14]=u,e[15]=m):m=e[15],m}function V(t){const e=Y.c(51),{field:n,label:r,type:l,required:a,placeholder:o,hint:d,error:s,disabled:c,validate:g}=t,u=l===void 0?"text":l,m=a===void 0?!1:a,{state:C,setField:p}=Q(),[_,h]=Xe.useState(!1),x=`field-${n}`,y=C.details[n]??"";let v;e[0]!==_||e[1]!==g||e[2]!==y?(v=g&&_?ke(g,y):null,e[0]=_,e[1]=g,e[2]=y,e[3]=v):v=e[3];const b=v==="invalid"&&!s,j=b?ct[g]:void 0;let N;e[4]!==s||e[5]!==b||e[6]!==g||e[7]!==y?(N=!s&&!b&&y.trim()!==""&&(!g||ke(g,y)==="valid"),e[4]=s,e[5]=b,e[6]=g,e[7]=y,e[8]=N):N=e[8];const E=N;let A;e[9]!==n||e[10]!==p||e[11]!==g?(A=U=>{const Z=U.target.value;p(n,g==="phone"?Ft(Z):Z)},e[9]=n,e[10]=p,e[11]=g,e[12]=A):A=e[12];const w=A,D=s??j,f=s||b?"true":void 0,L=m||void 0;let O;e[13]!==g?(O=()=>g&&h(!0),e[13]=g,e[14]=O):O=e[14];const F=(g||E)&&"pr-8";let S;e[15]!==s||e[16]!==b||e[17]!==y?(S=y.trim()!==""&&!s&&!b&&We,e[15]=s,e[16]=b,e[17]=y,e[18]=S):S=e[18];const z=(s||b)&&"border-red-500 ne-tint-error";let I;e[19]!==F||e[20]!==S||e[21]!==z?(I=J(qe,F,S,z),e[19]=F,e[20]=S,e[21]=z,e[22]=I):I=e[22];let P;e[23]!==c||e[24]!==n||e[25]!==w||e[26]!==x||e[27]!==o||e[28]!==I||e[29]!==f||e[30]!==L||e[31]!==O||e[32]!==u||e[33]!==y?(P=i.jsx(ze,{id:x,name:n,type:u,value:y,placeholder:o,disabled:c,"aria-invalid":f,"aria-required":L,onChange:w,onBlur:O,className:I}),e[23]=c,e[24]=n,e[25]=w,e[26]=x,e[27]=o,e[28]=I,e[29]=f,e[30]=L,e[31]=O,e[32]=u,e[33]=y,e[34]=P):P=e[34];let $;e[35]!==n||e[36]!==E?($=E&&i.jsx(Se,{size:14,strokeWidth:2.5,"aria-hidden":"true","data-testid":`valid-${n}`,className:"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-emerald-600/80"}),e[35]=n,e[36]=E,e[37]=$):$=e[37];let T;e[38]!==b?(T=b&&i.jsx(pi,{size:14,strokeWidth:2.5,"aria-hidden":"true",className:"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-red-500"}),e[38]=b,e[39]=T):T=e[39];let R;e[40]!==P||e[41]!==$||e[42]!==T?(R=i.jsxs("div",{className:"relative",children:[P,$,T]}),e[40]=P,e[41]=$,e[42]=T,e[43]=R):R=e[43];let M;return e[44]!==d||e[45]!==x||e[46]!==r||e[47]!==m||e[48]!==R||e[49]!==D?(M=i.jsx(He,{id:x,label:r,required:m,error:D,hint:d,children:R}),e[44]=d,e[45]=x,e[46]=r,e[47]=m,e[48]=R,e[49]=D,e[50]=M):M=e[50],M}function Tn(t){const e=Y.c(66),{field:n,label:r,required:l,error:a,hint:o}=t,d=l===void 0?!1:l,{state:s,setField:c}=Q(),g=`field-${n}`,u=s.details[n]??"";let m,C,p,_,h,x,y,v,k,b,j,N,E,A,w,D,f,L,O,F,S,z;e[0]!==a||e[1]!==n||e[2]!==o||e[3]!==g||e[4]!==r||e[5]!==u||e[6]!==d||e[7]!==c?(p=u?It(u.slice(0,10),"yyyy-MM-dd",new Date):null,C=He,b=g,j=r,N=d,E=a,w=o,k="ne-datepicker-field relative",m=At,A=g,D=n,f=Ae(p)?p:null,e[30]!==n||e[31]!==c?(L=M=>c(n,M&&Ae(M)?kt(M,"yyyy-MM-dd"):""),e[30]=n,e[31]=c,e[32]=L):L=e[32],e[33]===Symbol.for("react.memo_cache_sentinel")?(O=["EEE, MMM d, yyyy","yyyy-MM-dd","MM/dd
3/yyyy"],e[33]=O):O=e[33],F="Pick a date",S="ne-datepicker",z="ne-datepicker-popper",_=!1,h="off",x=d||void 0,y=a?"true":void 0,v=J("flex h-10 w-full rounded-md border bg-white py-2 pl-3 pr-14 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",qe,Ae(p)&&!a&&We,a&&"border-red-500 ne-tint-error"),e[0]=a,e[1]=n,e[2]=o,e[3]=g,e[4]=r,e[5]=u,e[6]=d,e[7]=c,e[8]=m,e[9]=C,e[10]=p,e[11]=_,e[12]=h,e[13]=x,e[14]=y,e[15]=v,e[16]=k,e[17]=b,e[18]=j,e[19]=N,e[20]=E,e[21]=A,e[22]=w,e[23]=D,e[24]=f,e[25]=L,e[26]=O,e[27]=F,e[28]=S,e[29]=z):(m=e[8],C=e[9],p=e[10],_=e[11],h=e[12],x=e[13],y=e[14],v=e[15],k=e[16],b=e[17],j=e[18],N=e[19],E=e[20],A=e[21],w=e[22],D=e[23],f=e[24],L=e[25],O=e[26],F=e[27],S=e[28],z=e[29]);let I;e[34]!==m||e[35]!==_||e[36]!==h||e[37]!==x||e[38]!==y||e[39]!==v||e[40]!==A||e[41]!==D||e[42]!==f||e[43]!==L||e[44]!==O||e[45]!==F||e[46]!==S||e[47]!==z?(I=i.jsx(m,{id:A,name:D,selected:f,onChange:L,dateFormat:O,placeholderText:F,calendarClassName:S,popperClassName:z,showPopperArrow:_,autoComplete:h,"aria-required":x,"aria-invalid":y,className:v}),e[34]=m,e[35]=_,e[36]=h,e[37]=x,e[38]=y,e[39]=v,e[40]=A,e[41]=D,e[42]=f,e[43]=L,e[44]=O,e[45]=F,e[46]=S,e[47]=z,e[48]=I):I=e[48];let P;e[49]===Symbol.for("react.memo_cache_sentinel")?(P=i.jsx(hi,{size:15,"aria-hidden":"true",className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-ne-gray"}),e[49]=P):P=e[49];let $;e[50]!==a||e[51]!==n||e[52]!==p?($=Ae(p)&&!a&&i.jsx(Se,{size:14,strokeWidth:2.5,"aria-hidden":"true","data-testid":`valid-${n}`,className:"pointer-events-none absolute right-8 top-1/2 -translate-y-1/2 text-emerald-600/80"}),e[50]=a,e[51]=n,e[52]=p,e[53]=$):$=e[53];let T;e[54]!==k||e[55]!==I||e[56]!==$?(T=i.jsxs("div",{className:k,children:[I,P,$]}),e[54]=k,e[55]=I,e[56]=$,e[57]=T):T=e[57];let R;return e[58]!==C||e[59]!==b||e[60]!==j||e[61]!==N||e[62]!==E||e[63]!==w||e[64]!==T?(R=i.jsx(C,{id:b,label:j,required:N,error:E,hint:w,children:T}),e[58]=C,e[59]=b,e[60]=j,e[61]=N,e[62]=E,e[63]=w,e[64]=T,e[65]=R):R=e[65],R}function at(t){const e=Y.c(76),{field:n,label:r,required:l,error:a,hint:o}=t,d=l===void 0?!1:l,{state:s,setField:c}=Q(),g=`field-${n}`,u=s.details[n]??"";let m,C,p,_,h,x,y,v,k,b,j,N,E,A,w,D,f,L,O,F,S,z,I,P,$,T,R;e[0]!==a||e[1]!==n||e[2]!==o||e[3]!==g||e[4]!==r||e[5]!==u||e[6]!==d||e[7]!==c?(p=u?It(u,"HH:mm",new Date):null,C=He,D=g,f=r,L=d,O=a,F=o,w="ne-datepicker-field relative",m=At,A=g,S=n,z=Ae(p)?p:null,e[35]!==n||e[36]!==c?(I=ue=>c(n,ue&&Ae(ue)?kt(ue,"HH:mm"):""),e[35]=n,e[36]=c,e[37]=I):I=e[37],P=!0,$=!0,T=15,R="Time",_="h:mm aa",e[38]===Symbol.for("react.memo_cache_sentinel")?(h=["h:mm aa","HH:mm"],e[38]=h):h=e[38],x="Pick a time",y="ne-datepicker",v="ne-datepicker-popper",k=!1,b="off",j=d||void 0,N=a?"true":void 0,E=J("flex h-10 w-full rounded-md border bg-white py-2 pl-3 pr-14 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",qe,Ae(p)&&!a&&We,a&&"border-red-500 ne-tint-error"),e[0]=a,e[1]=n,e[2]=o,e[3]=g,e[4]=r,e[5]=u,e[6]=d,e[7]=c,e[8]=m,e[9]=C,e[10]=p,e[11]=_,e[12]=h,e[13]=x,e[14]=y,e[15]=v,e[16]=k,e[17]=b,e[18]=j,e[19]=N,e[20]=E,e[21]=A,e[22]=w,e[23]=D,e[24]=f,e[25]=L,e[26]=O,e[27]=F,e[28]=S,e[29]=z,e[30]=I,e[31]=P,e[32]=$,e[33]=T,e[34]=R):(m=e[8],C=e[9],p=e[10],_=e[11],h=e[12],x=e[13],y=e[14],v=e[15],k=e[16],b=e[17],j=e[18],N=e[19],E=e[20],A=e[21],w=e[22],D=e[23],f=e[24],L=e[25],O=e[26],F=e[27],S=e[28],z=e[29],I=e[30],P=e[31],$=e[32],T=e[33],R=e[34]);let M;e[39]!==m||e[40]!==_||e[41]!==h||e[42]!==x||e[43]!==y||e[44]!==v||e[45]!==k||e[46]!==b||e[47]!==j||e[48]!==N||e[49]!==E||e[50]!==A||e[51]!==S||e[52]!==z||e[53]!==I||e[54]!==P||e[55]!==$||e[56]!==T||e[57]!==R?(M=i.jsx(m,{id:A,name:S,selected:z,onChange:I,showTimeSelect:P,showTimeSelectOnly:$,timeIntervals:T,timeCaption:R,timeFormat:_,dateFormat:h,placeholderText:x,calendarClassName:y,popperClassName:v,showPopperArrow:k,autoComplete:b,"aria-required":j,"aria-invalid":N,className:E}),e[39]=m,e[40]=_,e[41]=h,e[42]=x,e[43]=y,e[44]=v,e[45]=k,e[46]=b,e[47]=j,e[48]=N,e[49]=E,e[50]=A,e[51]=S,e[52]=z,e[53]=I,e[54]=P,e[55]=$,e[56]=T,e[57]=R,e[58]=M):M=e[58];let U;e[59]!==a||e[60]!==n||e[61]!==p?(U=Ae(p)&&!a&&i.jsx(Se,{size:14,strokeWidth:2.5,"aria-hidden":"true","data-testid":`valid-${n}`,className:"pointer-events-none absolute right-8 top-1/2 -translate-y-1/2 text-emerald-600/80"}),e[59]=a,e[60]=n,e[61]=p,e[62]=U):U=e[62];let Z;e[63]===Symbol.for("react.memo_cache_sentinel")?(Z=i.jsx(yi,{size:15,"aria-hidden":"true",className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-ne-gray"}),e[63]=Z):Z=e[63];let W;e[64]!==w||e[65]!==M||e[66]!==U?(W=i.jsxs("div",{className:w,children:[M,U,Z]}),e[64]=w,e[65]=M,e[66]=U,e[67]=W):W=e[67];let ee;return e[68]!==C||e[69]!==D||e[70]!==f||e[71]!==L||e[72]!==O||e[73]!==F||e[74]!==W?(ee=i.jsx(C,{id:D,label:f,required:L,error:O,hint:F,children:W}),e[68]=C,e[69]=D,e[70]=f,e[71]=L,e[72]=O,e[73]=F,e[74]=W,e[75]=ee):ee=e[75],ee}function Ye(t){const e=Y.c(26),{field:n,label:r,rows:l,placeholder:a,hint:o,error:d,maxLength:s,className:c}=t,g=l===void 0?3:l,{state:u,setField:m}=Q(),C=`field-${n}`,p=u.details[n]??"";let _;e[0]!==n||e[1]!==m?(_=b=>
3m(n,b.target.value),e[0]=n,e[1]=m,e[2]=_):_=e[2];let h;e[3]!==d||e[4]!==n||e[5]!==u.details?(h=String(u.details[n]??"").trim()!==""&&!d&&We,e[3]=d,e[4]=n,e[5]=u.details,e[6]=h):h=e[6];const x=d&&"border-red-500 ne-tint-error";let y;e[7]!==c||e[8]!==h||e[9]!==x?(y=J("flex w-full rounded-md border bg-white px-3 py-2 text-sm placeholder:text-ne-gray/70","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",qe,h,x,c),e[7]=c,e[8]=h,e[9]=x,e[10]=y):y=e[10];let v;e[11]!==n||e[12]!==C||e[13]!==s||e[14]!==a||e[15]!==g||e[16]!==p||e[17]!==_||e[18]!==y?(v=i.jsx("textarea",{id:C,name:n,rows:g,maxLength:s,value:p,placeholder:a,onChange:_,className:y}),e[11]=n,e[12]=C,e[13]=s,e[14]=a,e[15]=g,e[16]=p,e[17]=_,e[18]=y,e[19]=v):v=e[19];let k;return e[20]!==d||e[21]!==o||e[22]!==C||e[23]!==r||e[24]!==v?(k=i.jsx(He,{id:C,label:r,error:d,hint:o,children:v}),e[20]=d,e[21]=o,e[22]=C,e[23]=r,e[24]=v,e[25]=k):k=e[25],k}function Me(t){const e=Y.c(38),{field:n,label:r,options:l,required:a,placeholder:o,hint:d,error:s,disabled:c}=t,g=a===void 0?!1:a,u=o===void 0?"Selectâ¦":o,{state:m,setField:C}=Q(),p=`field-${n}`,_=m.details[n]??"",h=(m.details[n]??"")!==""&&!s;let x;e[0]!==h?(x=En(h),e[0]=h,e[1]=x):x=e[1];const y=s?"true":void 0,v=g||void 0;let k;e[2]!==n||e[3]!==C?(k=O=>C(n,O.target.value),e[2]=n,e[3]=C,e[4]=k):k=e[4];const b=s&&"border-red-500 ne-tint-error";let j;e[5]!==b?(j=J("flex h-10 w-full appearance-none rounded-md border bg-white py-2 pl-3 pr-9 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30","disabled:cursor-not-allowed disabled:opacity-50",qe,b),e[5]=b,e[6]=j):j=e[6];let N;e[7]!==u?(N=i.jsx("option",{value:"",children:u}),e[7]=u,e[8]=N):N=e[8];let E;e[9]!==l?(E=l.map(In),e[9]=l,e[10]=E):E=e[10];let A;e[11]!==c||e[12]!==n||e[13]!==p||e[14]!==j||e[15]!==N||e[16]!==E||e[17]!==_||e[18]!==x||e[19]!==y||e[20]!==v||e[21]!==k?(A=i.jsxs("select",{id:p,name:n,value:_,disabled:c,ref:x,"aria-invalid":y,"aria-required":v,onChange:k,className:j,children:[N,E]}),e[11]=c,e[12]=n,e[13]=p,e[14]=j,e[15]=N,e[16]=E,e[17]=_,e[18]=x,e[19]=y,e[20]=v,e[21]=k,e[22]=A):A=e[22];let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=i.jsx(Tt,{size:15,"aria-hidden":"true",className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-ne-gray"}),e[23]=w):w=e[23];let D;e[24]!==s||e[25]!==n||e[26]!==m.details?(D=(m.details[n]??"")!==""&&!s&&i.jsx(Se,{size:14,strokeWidth:2.5,"aria-hidden":"true","data-testid":`valid-${n}`,className:"pointer-events-none absolute right-8 top-1/2 -translate-y-1/2 text-emerald-600/80"}),e[24]=s,e[25]=n,e[26]=m.details,e[27]=D):D=e[27];let f;e[28]!==A||e[29]!==D?(f=i.jsxs("div",{className:"relative",children:[A,w,D]}),e[28]=A,e[29]=D,e[30]=f):f=e[30];let L;return e[31]!==s||e[32]!==d||e[33]!==p||e[34]!==r||e[35]!==g||e[36]!==f?(L=i.jsx(He,{id:p,label:r,required:g,error:s,hint:d,children:f}),e[31]=s,e[32]=d,e[33]=p,e[34]=r,e[35]=g,e[36]=f,e[37]=L):L=e[37],L}function In(t){return i.jsx("option",{value:t.value,children:t.label},t.value)}function Ct(t){const e=Y.c(16),{field:n,label:r,hint:l,error:a}=t,{state:o,setField:d}=Q(),s=o.details[n];let c;e[0]!==r?(c=i.jsx("legend",{className:"text-sm font-medium text-ne-ink",children:r}),e[0]=r,e[1]=c):c=e[1];let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=["yes","no"],e[2]=g):g=e[2];let u;e[3]!==n||e[4]!==d||e[5]!==s?(u=i.jsx("div",{className:"flex gap-2",children:g.map(_=>{const h=`field-${n}-${_}`,x=s===_;return i.jsxs("label",{htmlFor:h,className:J("flex cursor-pointer items-center gap-2 rounded-md border px-3.5 py-1.5 text-sm capitalize transition-colors",x?J(We,"font-medium text-ne-ink"):"border-ne-line text-ne-gray hover:border-ne-ink/30 hover:text-ne-ink"),children:[i.jsx("input",{id:h,type:"radio",name:n,value:_,checked:x,onChange:()=>d(n,_),className:"h-3.5 w-3.5 border-ne-line text-emerald-600 focus:ring-ne-ink/30"}),_]},_)})}),e[3]=n,e[4]=d,e[5]=s,e[6]=u):u=e[6];let m;e[7]!==l?(m=l&&i.jsx("p",{className:"text-xs text-ne-gray",children:l}),e[7]=l,e[8]=m):m=e[8];let C;e[9]!==a?(C=a&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:a}),e[9]=a,e[10]=C):C=e[10];let p;return e[11]!==c||e[12]!==u||e[13]!==m||e[14]!==C?(p=i.jsxs("fieldset",{className:"space-y-1.5",children:[c,u,m,C]}),e[11]=c,e[12]=u,e[13]=m,e[14]=C,e[15]=p):p=e[15],p}function An(t){const e=Y.c(39),{field:n,label:r,options:l,hint:a,error:o}=t,{state:d,setField:s}=Q(),c=`field-${n}`,g=d.details[n]??"";let u,m,C,p,_,h,x,y,v,k,b,j;if(e[0]!==o||e[1]!==n||e[2]!==a||e[3]!==c||e[4]!==r||e[5]!==l||e[6]!==g||e[7]!==s){const w=g.split(",").map(kn).filter(
3Boolean),D=L=>{const O=w.includes(L)?w.filter(F=>F!==L):[...w,L];s(n,O.join(", "))};u=He,b=c,j=r,C=o,p=a,h=c,x="group",y=r,v=`multiselect-${n}`;const f=o&&"border-red-500 ne-tint-error";e[20]!==f?(k=J("max-h-36 overflow-y-auto rounded-md border bg-white p-2",qe,f),e[20]=f,e[21]=k):k=e[21],m="flex flex-wrap gap-x-4 gap-y-1.5",_=l.map(L=>{const O=`${c}-${L.value}`;return i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx("input",{id:O,type:"checkbox",checked:w.includes(L.value),onChange:()=>D(L.value),className:"h-3.5 w-3.5 rounded border-ne-line text-ne-ink focus:ring-ne-ink/30"}),i.jsx(X,{htmlFor:O,className:"text-xs text-ne-ink",children:L.label})]},L.value)}),e[0]=o,e[1]=n,e[2]=a,e[3]=c,e[4]=r,e[5]=l,e[6]=g,e[7]=s,e[8]=u,e[9]=m,e[10]=C,e[11]=p,e[12]=_,e[13]=h,e[14]=x,e[15]=y,e[16]=v,e[17]=k,e[18]=b,e[19]=j}else u=e[8],m=e[9],C=e[10],p=e[11],_=e[12],h=e[13],x=e[14],y=e[15],v=e[16],k=e[17],b=e[18],j=e[19];let N;e[22]!==m||e[23]!==_?(N=i.jsx("div",{className:m,children:_}),e[22]=m,e[23]=_,e[24]=N):N=e[24];let E;e[25]!==N||e[26]!==h||e[27]!==x||e[28]!==y||e[29]!==v||e[30]!==k?(E=i.jsx("div",{id:h,role:x,"aria-label":y,"data-testid":v,className:k,children:N}),e[25]=N,e[26]=h,e[27]=x,e[28]=y,e[29]=v,e[30]=k,e[31]=E):E=e[31];let A;return e[32]!==u||e[33]!==C||e[34]!==p||e[35]!==E||e[36]!==b||e[37]!==j?(A=i.jsx(u,{id:b,label:j,error:C,hint:p,children:E}),e[32]=u,e[33]=C,e[34]=p,e[35]=E,e[36]=b,e[37]=j,e[38]=A):A=e[38],A}function kn(t){return t.trim()}const Dn=["Refi 1st Only","Buyer Only 1st Only","1st and 2nd","1st and Bond","Buyer & Seller","Cash Deal","Seller Only","Loan Application","Loan Application, Reverse","Reverse Closing","Construction","Debt Settlement","Line of Credit","Deed Signing"].map(t=>({type:t,invoiceFee:"0.00",notaryPay:"0.00"})),On=[{type:"Refi 1st Only",invoiceFee:"125.00",notaryPay:"100.00"},{type:"Buyer Only",invoiceFee:"150.00",notaryPay:"125.00"},{type:"Buyer & Seller",invoiceFee:"175.00",notaryPay:"150.00"},{type:"Seller Only",invoiceFee:"100.00",notaryPay:"75.00"},{type:"Reverse Closing",invoiceFee:"175.00",notaryPay:"150.00"},{type:"Loan Modification",invoiceFee:"100.00",notaryPay:"75.00"}];function Ln(t){const e=Y.c(114),{clients:n,contactOptions:r,contactsLoadedFor:l,orderContactEmailOptions:a,signingServices:o,fees:d,config:s,errorsByField:c,onContactCreated:g,onClientCreated:u}=t;let m;e[0]!==n?(m=n===void 0?[]:n,e[0]=n,e[1]=m):m=e[1];const C=m;let p;e[2]!==r?(p=r===void 0?[]:r,e[2]=r,e[3]=p):p=e[3];const _=p,h=l===void 0?null:l;let x;e[4]!==a?(x=a===void 0?[]:a,e[4]=a,e[5]=x):x=e[5];const y=x;let v;e[6]!==o?(v=o===void 0?[]:o,e[6]=o,e[7]=v):v=e[7];const k=v,b=d===void 0?[]:d;let j;e[8]!==c?(j=c===void 0?{}:c,e[8]=c,e[9]=j):j=e[9];const N=j,{user:E}=Be(),{state:A,dispatch:w,setContact:D}=Q(),{contacts:f,customizationsLoading:L,hasCustomizations:O,mode:F}=A,S=F==="notary";let z;e[10]!==S||e[11]!==E?.permissions?(z=!S||!!E?.permissions?.includes("contact_access"),e[10]=S,e[11]=E?.permissions,e[12]=z):z=e[12];const I=z,[P,$]=B.useState(!1),T=zn;let R;if(e[13]!==C){let q;e[15]===Symbol.for("react.memo_cache_sentinel")?(q=(Te,Zt)=>T(Te).toLowerCase().localeCompare(T(Zt).toLowerCase()),e[15]=q):q=e[15];let _e;e[16]===Symbol.for("react.memo_cache_sentinel")?(_e=Te=>({value:Te.client_company_id,label:T(Te)}),e[16]=_e):_e=e[16],R=[...C].sort(q).map(_e),e[13]=C,e[14]=R}else R=e[14];const M=R,U=b.length>0?b:S?On:Dn,Z=q=>{const _e=U.find(Te=>Te?.type===q);w({type:H.HYDRATE,details:q?_e?{signingType:q,invoiceFee:_e.invoiceFee||"",notaryPay:_e.notaryPay||""}:{signingType:q,invoiceFee:"",notaryPay:"0.00"}:{signingType:"",invoiceFee:"",notaryPay:""}})},W=U.map(Rn),ee=A.details.signingType,ue=ee?W.find(q=>q.value===ee)??{value:ee,label:`${ee} (custom)`}:null,xe=!!ee&&!W.some(q=>q.value===ee),[ge,re]=B.useState(!1),se=!!f.clientCompanyId,De=se&&h===f.clientCompanyId,fe=De&&_.length===0&&!f.inHouseContact,de=N.inHouseContact;let pe;e[17]!==f.inHouseContact?(pe=f.inHouseContact?[f.inHouseContact.contact_name,f.inHouseContact.contact_email].filter(Boolean).join(" · "):null,e[17]=f.inHouseContact,e[18]=pe):pe=e[18];const me=pe;let he,we;e[19]!==ge?(he=()=>{ge==="contact"&&document.getElementById("field-inHouseContact")?.focus(),ge==="email"&&document.getElementById("field-orderContactEmail")?.focus()},we=[ge],e[19]=ge,e[20]=he,e[21]=we):(he=e[20],we=e[21]),B.useEffect(he,we);const ne=I&&se&&(S?!!ge||!!de:ge||fe||!!de||De&&!me);let ve;e[22]!==L||e[23]!==O?(ve=L?i.jsx("span",{className:"text-xs text-ne-gray","data-testid":"customizations-loading",children:"Loading client configâ¦"}):O?i.jsx("span",{className:"rounded-full bg-ne-mist px-2.5 py-1 text-xs font-medium text-ne-ink","data-testid":"custom-config-badge",children:"Custom form for this client"}):null,e[22]=L,e[23]=O,e[24]=ve):ve=e[24];let be;e[25]!==s||e[26]!==w||e[27]!==k||e[28]!==A.signingServiceId?(be=G(s,"show_signing_service_selector")&&k.length>1&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(X,{htmlFor:"field-signingServiceId",className:"text-sm font-medium text-ne-ink",children:["Signing Service",i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"})]}),i.jsxs("div",{className:"relative",children:[i.jsxs("select",{id:"field-signingServiceId",name:"signingServiceId",value:A.signingServiceId??"","aria-required":"true",onCh
3ange:q=>w({type:H.SIGNING_SERVICE_SELECTED,signingServiceId:q.target.value===""?null:Number(q.target.value)}),className:et,children:[i.jsx("option",{value:"",children:"Select a signing serviceâ¦"}),k.map($n)]}),i.jsx(tt,{})]})]}),e[25]=s,e[26]=w,e[27]=k,e[28]=A.signingServiceId,e[29]=be):be=e[29];let oe;e[30]!==M||e[31]!==s||e[32]!==f.clientCompanyId||e[33]!==w||e[34]!==N.clientCompanyId||e[35]!==S||e[36]!==$?(oe=G(s,"show_client_company_selector")&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(X,{htmlFor:"field-clientCompanyId",className:"text-sm font-medium text-ne-ink",children:["Client",!S&&i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("div",{className:"min-w-0 flex-1",children:i.jsx(bt,{inputId:"field-clientCompanyId",name:"clientCompanyId",options:M,value:f.clientCompanyId?M.find(q=>q.value===f.clientCompanyId)??{value:f.clientCompanyId,label:`Client ${f.clientCompanyId}`}:null,onChange:q=>{re(!1),w({type:H.CLIENT_SELECTED,clientCompanyId:q?q.value:null})},placeholder:S?"None (personal order)":"Select or search for a clientâ¦",isClearable:!0,isSearchable:!0,styles:rt,components:ot,"aria-invalid":N.clientCompanyId?"true":void 0})}),i.jsxs("button",{type:"button","data-testid":"create-company",onClick:()=>$(!0),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-md border border-ne-line bg-white px-3 text-xs font-semibold text-ne-ink hover:border-ne-ink/40",children:[i.jsx(xt,{size:13,strokeWidth:2,"aria-hidden":"true"})," New"]})]}),N.clientCompanyId&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:N.clientCompanyId})]}),e[30]=M,e[31]=s,e[32]=f.clientCompanyId,e[33]=w,e[34]=N.clientCompanyId,e[35]=S,e[36]=$,e[37]=oe):oe=e[37];let ae;e[38]!==w||e[39]!==u||e[40]!==$||e[41]!==P?(ae=P&&ti.createPortal(i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4","data-testid":"create-company-modal",onMouseDown:q=>{q.target===q.currentTarget&&$(!1)},onSubmit:Fn,children:i.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-xl bg-white p-5",children:[i.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[i.jsx("h2",{className:"m-0 text-base font-semibold text-ne-ink",children:"Create New Client Company"}),i.jsx("button",{type:"button","aria-label":"Close",onClick:()=>$(!1),className:"rounded p-1 text-ne-gray hover:text-ne-ink",children:"â"})]}),i.jsx(vi,{closeModal:()=>$(!1),createdCompanySuccessfulCallback:q=>{u?.(q),q?.client_company_id&&w({type:H.CLIENT_SELECTED,clientCompanyId:q.client_company_id})}})]})}),document.body),e[38]=w,e[39]=u,e[40]=$,e[41]=P,e[42]=ae):ae=e[42];let le;e[43]!==I||e[44]!==se||e[45]!==me||e[46]!==f.orderContactEmail||e[47]!==ne?(le=I&&se&&!ne&&me&&i.jsxs("div",{"data-testid":"contact-auto-line",className:"space-y-1 rounded-md bg-ne-mist/70 px-3 py-2 text-sm",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"shrink-0 text-ne-gray",children:"Contact:"}),i.jsx("span",{className:"min-w-0 truncate font-medium text-ne-ink",children:me}),i.jsx("button",{type:"button","data-testid":"contact-change","aria-label":"Change client contact",onClick:()=>re("contact"),className:"shrink-0 rounded p-1 text-ne-gray transition-colors hover:bg-white hover:text-ne-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",children:i.jsx(vt,{size:13,strokeWidth:2,"aria-hidden":"true"})})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"shrink-0 text-ne-gray",children:"Order email:"}),i.jsx("span",{className:"min-w-0 truncate font-medium text-ne-ink",children:f.orderContactEmail||i.jsx("em",{className:"font-normal text-ne-gray",children:"not set"})}),i.jsx("button",{type:"button","data-testid":"contact-change-email","aria-label":"Change order contact email",onClick:()=>re("email"),className:"shrink-0 rounded p-1 text-ne-gray transition-colors hover:bg-white hover:text-ne-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",children:i.jsx(vt,{size:13,strokeWidth:2,"aria-hidden":"true"})})]})]}),e[43]=I,e[44]=se,e[45]=me,e[46]=f.orderContactEmail,e[47]=ne,e[48]=le):le=e[48];let ce;e[49]!==s||e[50]!==de||e[51]!==_||e[52]!==f.clientCompanyId||e[53]!==f.inHouseContact||e[54]!==f.orderContactEmail||e[55]!==S||e[56]!==g||e[57]!==y||e[58]!==D||e[59]!==ne||e[60]!==fe?(ce=ne&&i.jsxs("div",{"data-testid":"contact-editor",className:"space-y-4 rounded-lg border border-ne-line bg-ne-mist/40 p-3",children:[fe&&i.jsx("p",{className:"m-0 text-xs text-ne-gray",children:S?"No saved contacts for this client yet â add one below (optional).":"No saved contacts for this client yet â add one below (a contact is required)."}),i.jsx(St,{field:"inHouseContact",label:K(s,"client_contact_label","Client Contact"),required:!S,contacts:_,selected:f.inHouseContact,placeholder:"Select a contactâ¦",error:de,onSelect:q=>D("inHouseContact",q),contactType:"client",clientCompanyId:f.clientCompanyId,onCreated:q=>{re(!0),g?.(q)}}),i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(X,{htmlFor:"field-orderContactEmail",className:"text-sm font-medium text-ne-ink",children:["Order Contact Email"," ",i.jsx("span",{className:"font-normal text-ne-gray",children:"(your team member responsible for this order â receives its emails)"})]}
3),i.jsx(bt,{inputId:"field-orderContactEmail",name:"orderContactEmail",options:y,value:f.orderContactEmail?{value:f.orderContactEmail,label:f.orderContactEmail}:null,onChange:q=>D("orderContactEmail",q?q.value:""),onInputChange:(q,_e)=>{const{action:Te}=_e;Te==="input-change"&&D("orderContactEmail",q)},placeholder:"Select a team member or type any emailâ¦",isClearable:!0,isSearchable:!0,styles:rt,components:ot})]}),(f.inHouseContact||S)&&i.jsx("button",{type:"button","data-testid":"contact-editor-done",onClick:()=>re(!1),className:"rounded-md bg-ne-ink px-3 py-1.5 text-xs font-semibold text-white hover:bg-ne-ink-light",children:"Done"})]}),e[49]=s,e[50]=de,e[51]=_,e[52]=f.clientCompanyId,e[53]=f.inHouseContact,e[54]=f.orderContactEmail,e[55]=S,e[56]=g,e[57]=y,e[58]=D,e[59]=ne,e[60]=fe,e[61]=ce):ce=e[61];let ye;e[62]!==I||e[63]!==se||e[64]!==me||e[65]!==S||e[66]!==ne?(ye=S&&I&&se&&!ne&&!me&&i.jsxs("button",{type:"button","data-testid":"contact-add-optional",onClick:()=>re("contact"),className:"inline-flex items-center gap-1.5 text-xs font-medium text-ne-gray underline underline-offset-4 hover:text-ne-ink",children:[i.jsx(xt,{size:13,strokeWidth:2,"aria-hidden":"true"})," Add client contact (optional)"]}),e[62]=I,e[63]=se,e[64]=me,e[65]=S,e[66]=ne,e[67]=ye):ye=e[67];let te;e[68]!==s||e[69]!==N.fileNumber?(te=G(s,"show_file_number")&&i.jsx(V,{field:"fileNumber",label:K(s,"file_number_label","File Number"),required:!0,validate:"text",placeholder:"FN-1001",hint:s?.file_number_description||void 0,error:N.fileNumber}),e[68]=s,e[69]=N.fileNumber,e[70]=te):te=e[70];let Ee;e[71]!==s||e[72]!==N.signingType||e[73]!==Z||e[74]!==xe||e[75]!==ue||e[76]!==W?(Ee=G(s,"show_signing_type")&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsxs(X,{htmlFor:"field-signingType",className:"text-sm font-medium text-ne-ink",children:[K(s,"signing_type_label","Signing Type"),i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"})]}),i.jsx(xi,{inputId:"field-signingType",name:"signingType",options:W,value:ue,onChange:q=>Z(q?q.value:""),onCreateOption:q=>Z(q.trim()),formatCreateLabel:Pn,placeholder:"Select or typeâ¦",isClearable:!0,isSearchable:!0,styles:rt,components:ot,"aria-invalid":N.signingType?"true":void 0}),xe&&i.jsx("p",{className:"text-xs text-ne-gray",children:"Custom type â notary pay defaults to $0.00; set the invoice fee beside this field."}),N.signingType&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:N.signingType})]}),e[71]=s,e[72]=N.signingType,e[73]=Z,e[74]=xe,e[75]=ue,e[76]=W,e[77]=Ee):Ee=e[77];let Ke;e[78]===Symbol.for("react.memo_cache_sentinel")?(Ke=i.jsx(V,{field:"invoiceFee",label:"Invoice Fee",type:"text",placeholder:"0.00",hint:"Auto-filled from signing type"}),e[78]=Ke):Ke=e[78];let Oe;e[79]!==S?(Oe=S&&i.jsx(V,{field:"notaryPay",label:"Notary Pay",type:"text",placeholder:"0.00",hint:"What you earn â auto-filled from signing type"}),e[79]=S,e[80]=Oe):Oe=e[80];let Le;e[81]!==te||e[82]!==Ee||e[83]!==Oe?(Le=i.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[te,Ee,Ke,Oe]}),e[81]=te,e[82]=Ee,e[83]=Oe,e[84]=Le):Le=e[84];let Pe;e[85]!==s||e[86]!==N.scanbacksRequired?(Pe=G(s,"show_scanbacks")&&i.jsx(Ct,{field:"scanbacksRequired",label:K(s,"scanbacks_label","Scanbacks Required?"),error:N.scanbacksRequired}),e[85]=s,e[86]=N.scanbacksRequired,e[87]=Pe):Pe=e[87];let Fe;e[88]!==s?(Fe=G(s,"show_ron_signing")&&i.jsx(Ct,{field:"ronSigning",label:K(s,"ron_signing_label","RON Signing?"),hint:"Remote online notarization â the timezone comes from the form, not the address."}),e[88]=s,e[89]=Fe):Fe=e[89];let $e;e[90]!==Pe||e[91]!==Fe?($e=i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[Pe,Fe]}),e[90]=Pe,e[91]=Fe,e[92]=$e):$e=e[92];let Re;e[93]!==I||e[94]!==se||e[95]!==s||e[96]!==_||e[97]!==f.clientCompanyId||e[98]!==f.inHouseContact2||e[99]!==f.observer||e[100]!==g||e[101]!==D?(Re=(G(s,"show_additional_contacts")||G(s,"show_observer"))&&i.jsx(Ne,{label:"Additional contacts & observer",testId:"disclosure-additional-contacts",forceOpen:!!(f.inHouseContact2||f.observer),children:i.jsxs("div",{className:"space-y-4",children:[I&&G(s,"show_additional_contacts")&&i.jsx(St,{field:"inHouseContact2",label:"Additional Contact",contacts:_,selected:f.inHouseContact2,disabled:!se,placeholder:"None",onSelect:q=>D("inHouseContact2",q),contactType:"client2",clientCompanyId:f.clientCompanyId,onCreated:g}),G(s,"show_observer")&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx(X,{htmlFor:"field-observer",className:"text-sm font-medium text-ne-ink",children:"Observer"}
3),i.jsx(ze,{id:"field-observer",name:"observer",value:f.observer??"",placeholder:"Observer email â cc'd on order emails",onChange:q=>D("observer",q.target.value),className:"border-ne-line focus-visible:ring-ne-ink/30"})]})]})}),e[93]=I,e[94]=se,e[95]=s,e[96]=_,e[97]=f.clientCompanyId,e[98]=f.inHouseContact2,e[99]=f.observer,e[100]=g,e[101]=D,e[102]=Re):Re=e[102];let Je;return e[103]!==ve||e[104]!==be||e[105]!==oe||e[106]!==ae||e[107]!==le||e[108]!==ce||e[109]!==ye||e[110]!==Le||e[111]!==$e||e[112]!==Re?(Je=i.jsxs(Ve,{id:"order",title:"Order",hint:"Client, file, signing type",action:ve,children:[be,oe,ae,le,ce,ye,Le,$e,Re]}),e[103]=ve,e[104]=be,e[105]=oe,e[106]=ae,e[107]=le,e[108]=ce,e[109]=ye,e[110]=Le,e[111]=$e,e[112]=Re,e[113]=Je):Je=e[113],Je}function Pn(t){return`Add "${t}" as a custom type`}function Fn(t){return t.stopPropagation()}function $n(t){return i.jsx("option",{value:t.signingServiceId,children:t.name??`Signing service ${t.signingServiceId}`},t.signingServiceId)}function Rn(t){return{value:t.type,label:`${t.type} â $${t.invoiceFee||"0.00"}`}}function zn(t){return t.client_company_name||t.name||`Client ${t.client_company_id}`}const Mn="AIzaSyC_b6cIghZEgJRjt1lLhDdRtHXHB3KPDAU";function Bn(t){let e="",n="",r="";const l=t?.address_components??[];for(const d of l)switch(d.types[0]){case"locality":e=d.long_name;break;case"administrative_area_level_1":n=d.short_name;break;case"postal_code":r=d.long_name;break}if(!e)for(const d of l){if(d.types.includes("neighborhood")){e=d.long_name;break}if(d.types.includes("sublocality")){e=d.long_name;break}if(d.types.includes("administrative_area_level_2")){e=d.long_name.replace(" County","");break}}let a="",o="";return t?.geometry&&(a=t.geometry.location.lat(),o=t.geometry.location.lng()),{city:e,state:n,zipcode:r,latitude:a,longitude:o,formattedAddress:t?.formatted_address??""}}function mt(t){const e=Y.c(46),{kind:n,label:r,required:l,error:a}=t,o=l===void 0?!1:l,{state:d,dispatch:s,setField:c}=Q();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={property:{address:"propertyAddress",city:"city",state:"state",zip:"zipcode",lat:"propertyLatitude",lng:"propertyLongitude"},signing:{address:"signingAddress",city:"signingCity",state:"signingState",zip:"signingZipcode",lat:"signingLatitude",lng:"signingLongitude"},invoice:{address:"invoicePropertyAddress",city:"invoiceCity",state:"invoiceState",zip:"invoiceZipcode",lat:null,lng:null}},e[0]=g):g=e[0];const u=g,m=u[n]??u.property,C=`field-${m.address}`;let p;e[1]!==s||e[2]!==m.address||e[3]!==m.city||e[4]!==m.lat||e[5]!==m.lng||e[6]!==m.state||e[7]!==m.zip||e[8]!==n||e[9]!==d.details.isPropertyAddressSame||e[10]!==d.details.timeZoneId?(p=F=>{const S=Bn(F);let z=d.details.timeZoneId;if(S.latitude&&S.longitude)try{z=Ei(S.latitude,S.longitude)}catch{}const I={[m.address]:S.formattedAddress,[m.city]:S.city,[m.state]:S.state,[m.zip]:S.zipcode},P=n==="signing"||n==="property"&&d.details.isPropertyAddressSame;m.lat&&m.lng&&(I[m.lat]=S.latitude,I[m.lng]=S.longitude,P&&(I.timeZoneId=z)),n==="property"&&d.details.isPropertyAddressSame&&(I.signingAddress=S.formattedAddress,I.signingCity=S.city,I.signingState=S.state,I.signingZipcode=S.zipcode,I.signingLatitude=S.latitude,I.signingLongitude=S.longitude),s({type:"HYDRATE",details:I})},e[1]=s,e[2]=m.address,e[3]=m.city,e[4]=m.lat,e[5]=m.lng,e[6]=m.state,e[7]=m.zip,e[8]=n,e[9]=d.details.isPropertyAddressSame,e[10]=d.details.timeZoneId,e[11]=p):p=e[11];const _=p;let h;e[12]!==o?(h=o&&i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"}),e[12]=o,e[13]=h):h=e[13];let x;e[14]!==C||e[15]!==r||e[16]!==h?(x=i.jsxs(X,{htmlFor:C,className:"text-sm font-medium text-ne-ink",children:[r,h]}),e[14]=C,e[15]=r,e[16]=h,e[17]=x):x=e[17];const y=m.address;let v;e[18]===Symbol.for("react.memo_cache_sentinel")?(v={types:["address"],componentRestrictions:{country:"us"}},e[18]=v):v=e[18];const k=d.details[m.address]??"";let b;e[19]!==m.address||e[20]!==c?(b=F=>c(m.address,F.target.value),e[19]=m.address,e[20]=c,e[21]=b):b=e[21];const j=a?"true":void 0,N=(d.details[m.address]??"")!==""&&!a&&"ne-tint pr-8",E=a&&"border-red-500 ne-tint-error";let A;e[22]!==N||e[23]!==E?(A=J("flex h-10 w-full rounded-md border bg-white px-3 py-2 text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30","border-ne-line",N,E),e[22]=N,e[23]=E,e[24]=A):A=e[24];let w;e[25]!==m.address||e[26]!==_||e[27]!==C||e[28]!==j||e[29]!==A||e[30]!==k||e[31]!==b?(w=i.jsx(wi,{id:C,name:y,apiKey:Mn,onPlaceSelected:_,options:v,value:k,onChange:b,"aria-invalid":j,className:A}),e[25]=m.address,e[26]=_,e[27]=C,e[28]=j,e[29]=A,e[30]=k,e[31]=b,e[32]=w):w=e[32];let D;e[33]!==a||e[34]!==m.address||e[35]!==d.details?(D=(d.details[m.address]??"")!==""&&!a&&i.jsx(Se,{size:14,strokeWidth:2.5,"aria-hidden":"true","data-testid":`valid-${m.address}`,className:"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-emerald-600/80"}
3),e[33]=a,e[34]=m.address,e[35]=d.details,e[36]=D):D=e[36];let f;e[37]!==w||e[38]!==D?(f=i.jsxs("div",{className:"relative",children:[w,D]}),e[37]=w,e[38]=D,e[39]=f):f=e[39];let L;e[40]!==a?(L=a&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:a}),e[40]=a,e[41]=L):L=e[41];let O;return e[42]!==f||e[43]!==L||e[44]!==x?(O=i.jsxs("div",{className:"space-y-1.5",children:[x,f,L]}),e[42]=f,e[43]=L,e[44]=x,e[45]=O):O=e[45],O}const ut=["AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"].map(t=>({value:t,label:t})),qn=[{value:"edocs",label:"E-docs"},{value:"overnight_to_closer",label:"Overnight to closer"},{value:"overnight_to_borrower",label:"Overnight to borrower"},{value:"overnight_to_location",label:"Overnight to location"},{value:"courier_to_closer",label:"Courier to closer"},{value:"courier_to_borrower",label:"Courier to borrower"},{value:"pickup",label:"Pickup"},{value:"in_office",label:"In office"},{value:"see_instructions",label:"See instructions"},{value:"other",label:"Other"}],Hn=["arabic","asl","cambodian","cherokee","chinese","mandarin","cantonese","dutch","english","finnish","french","gaelic","german","hebrew","ilocano","irish","italian","polish","portuguese","russian","spanish","swedish","tagalog","viet
3namese","welsh","yiddish","korean","persian"].map(t=>({value:t,label:t.charAt(0).toUpperCase()+t.slice(1)})),Zn=[{value:"America/New_York",label:"Eastern (America/New_York)"},{value:"America/Chicago",label:"Central (America/Chicago)"},{value:"America/Denver",label:"Mountain (America/Denver)"},{value:"America/Phoenix",label:"Arizona (America/Phoenix)"},{value:"America/Los_Angeles",label:"Pacific (America/Los_Angeles)"},{value:"America/Anchorage",label:"Alaska (America/Anchorage)"},{value:"Pacific/Honolulu",label:"Hawaii (Pacific/Honolulu)"}],Un=[{value:"at",label:"At a specific time"},{value:"range",label:"Within a window"},{value:"tbd",label:"TBD"},{value:"asap",label:"ASAP"}];function Gn(t){const e=Y.c(63),{config:n,errorsByField:r}=t;let l;e[0]!==r?(l=r===void 0?{}:r,e[0]=r,e[1]=l):l=e[1];const a=l,{state:o,dispatch:d}=Q(),{details:s}=o,c=!!s.isPropertyAddressSame,{signingTimeType:g,startTime:u,endTime:m,timeZoneId:C,ronSigning:p}=s,_=p==="yes";let h;if(e[2]!==n){const P=sn(n);h=Un.filter($=>!P.includes($.value)),e[2]=n,e[3]=h}else h=e[3];const x=h,y=g==="range"&&u&&m&&m<=u;let v;e[4]!==s.city||e[5]!==s.propertyAddress||e[6]!==s.propertyLatitude||e[7]!==s.propertyLongitude||e[8]!==s.state||e[9]!==s.zipcode||e[10]!==d?(v=()=>d({type:H.HYDRATE,details:{isPropertyAddressSame:!1,signingAddress:s.propertyAddress,signingCity:s.city,signingState:s.state,signingZipcode:s.zipcode,signingLatitude:s.propertyLatitude,signingLongitude:s.propertyLongitude,propertyAddress:"",city:"",state:"",zipcode:"",propertyLatitude:"",propertyLongitude:""}}),e[4]=s.city,e[5]=s.propertyAddress,e[6]=s.propertyLatitude,e[7]=s.propertyLongitude,e[8]=s.state,e[9]=s.zipcode,e[10]=d,e[11]=v):v=e[11];const k=v;let b;e[12]!==s.signingAddress||e[13]!==s.signingCity||e[14]!==s.signingLatitude||e[15]!==s.signingLongitude||e[16]!==s.signingState||e[17]!==s.signingZipcode||e[18]!==d?(b=()=>d({type:H.HYDRATE,details:{isPropertyAddressSame:!0,propertyAddress:s.signingAddress,city:s.signingCity,state:s.signingState,zipcode:s.signingZipcode,propertyLatitude:s.signingLatitude,propertyLongitude:s.signingLongitude}}),e[12]=s.signingAddress,e[13]=s.signingCity,e[14]=s.signingLatitude,e[15]=s.signingLongitude,e[16]=s.signingState,e[17]=s.signingZipcode,e[18]=d,e[19]=b):b=e[19];const j=b;let N;e[20]!==c?(N=c?{kind:"property",city:"city",state:"state",zip:"zipcode"}:{kind:"signing",city:"signingCity",state:"signingState",zip:"signingZipcode"},e[20]=c,e[21]=N):N=e[21];const E=N;let A;e[22]!==n?(A=K(n,"property_address_label","Property Address"),e[22]=n,e[23]=A):A=e[23];const w=A;let D;e[24]!==n||e[25]!==w||e[26]!==c?(D=c?w==="Property Address"?"Signing Address":w:K(n,"signing_address_label","Signing Address"),e[24]=n,e[25]=w,e[26]=c,e[27]=D):D=e[27];const f=D;if(!G(n,"show_location_section")&&!G(n,"show_scheduling_section"))return null;let L;e[28]!==E||e[29]!==f||e[30]!==n||e[31]!==a||e[32]!==c?(L=G(n,"show_property_address")&&i.jsx(mt,{kind:E.kind,label:f,required:!0,error:c?a.propertyAddress:a.signingAddress}),e[28]=E,e[29]=f,e[30]=n,e[31]=a,e[32]=c,e[33]=L):L=e[33];let O;e[34]!==E||e[35]!==n||e[36]!==a?(O=G(n,"show_property_city_state_zip")&&i.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[i.jsx(V,{field:E.city,label:"City",required:!0,validate:"text",error:a[E.city]}),i.jsx(Me,{field:E.state,label:"State",options:ut,required:!0,error:a[E.state]}),i.jsx(V,{field:E.zip,label:"ZIP",required:!0,validate:"zip",error:a[E.zip]})]}),e[34]=E,e[35]=n,e[36]=a,e[37]=O):O=e[37];let F;e[38]!==n||e[39]!==y||e[40]!==a||e[41]!==_||e[42]!==g||e[43]!==x||e[44]!==C?(F=G(n,"show_scheduling_section")&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[G(n,"show_signing_date")&&i.jsx(Tn,{field:"signingDate",label:K(n,"signing_date_label","Signing Date"),required:!0,error:a.signingDate}),G(n,"show_signing_time")&&i.jsx(Me,{field:"signingTimeType",label:K(n,"signing_time_label","Time"),options:x,required:!0,error:a.signingTimeType}),g==="at"&&i.jsx(at,{field:"specificTime",label:"At",required:!0})]}),g==="range"&&i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsx(at,{field:"startTime",label:"Window start",required:!0}),i.jsx(at,{field:"endTime",label:"Window end",required:!0,hint:y?"Ends the next day â this window crosses midnight.":void 0})]}),_?i.jsx("div",{className:"sm:w-1/2",children:i.jsx(Me,{field:"timeZoneId",label:"Timezone",options:Zn,placeholder:"Select a timezoneâ¦",hint:"Required for RON â there is no address to infer it from."})}):i.jsx("p",{className:"text-xs text-ne-gray","data-testid":"timezone-note",children:C?`Times are in ${C}.`:"Timezone is set automatically from the signing address."})]}),e[38]=n,e[39]=y,e[40]=a,e[41]=_,e[42]=g,e[43]=x,e[44]=C,e[45]=F):F=e[45];let S;e[46]!==s.propertyAddressLine2||e[47]!==c?(S=c&&i.jsx(Ne,{label:"Address line 2",testId:"disclosure-address-line2",forceOpen:!!s.propertyAddressLine2,children:i.jsx("div",{className:"sm:w-1/2",children:i.jsx(V,{field:"propertyAddressLine2",label:"Address line 2",placeholder:"Apt, suite, unit"})})}),e[46]=s.propertyAddressLine2,e[47]=c,e[48]=S):S=e[48];let z;e[49]!==n||e[50]!==w||e[51]!==s.propertyAddressLine2||e[52]!==a||e[53]!==k||e[54]!==c||e[55]!==j?(z=G(n,"show_signing_address")&&(c?i.jsxs("button",{type:"button","data-testid":"different-property-address",onClick:k,className:"flex w-fit items-center gap-1 rounded-sm text-xs font-medium text-ne-ink/70 underline underline-offset-4 transition-colors hover:text-ne-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",children:[i.jsx("span",{"aria-hidden":"true",children:"+"})," Property address differs from signing location"]}):i.jsxs("div",{className:"space-y-4 rounded-lg border border-ne-line bg-ne-mist/40 p-3","data-testid":"property-address-block",children:[i.jsx(mt,{kind:"property",label:w,required:!0,error:a.propertyAddress}),G(n,"show_signing_city_state_zip")&&i.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[i.jsx(V,{field:"city",label:"Property City",required:!0,error:a.city}),i.jsx(Me,{field:"state",label:"Property State",options:ut,required:!0,error:a.state}),i.jsx(V,{field:"zipcode",label:"Property ZIP",required:!0,validate:"zip",error:a.zipcode})]}),i.jsx(Ne,{label:"Address line 2",testId:"disclosure-address-line2",forceOpen:!!s.propertyAddressLine2,children:i.jsx("div",{className:"sm:w-1/2",children:i.jsx(V,{field:"propertyAddressLine2",label:"Address line 2",placeholder:"Apt, suite, unit"})})}),i.jsx("button",{type:"button","data-testid":"use-signing-address",onClick:j,className:"text-xs font-medium text-ne-ink/70 underline underline-offset-4 hover:text-ne-ink",children:"Same as signing address"})]})),e[49]=n,e[50]=w,e[51]=s.propertyAddressLine2,e[52]=a,e[53]=k,e[54]=c,e[55]=j,e[56]=z):z=e[56];let I;return e[57]!==O||e[58]!==F||e[59]!==S||e[60]!==z||e[61]!==L?(I=i.jsxs(Ve,{id:"location",title:"Location & Appointment",hint:"Where and when",children:[L,O,F,S,z]}),e[57]=O,e[58]=F,e[59]=S,e[60]=z,e[61]=L,e[62]=I):I=e[62],I}const Yn=[{value:"co_trustee",label:"Co-trustee"},{value:"spouse",label:"Spouse"},{value:"beneficiary",label:"Beneficiary"},{value:"other",label:"Other"}
3],Vn={firstName:"",lastName:"",role:"other",email:"",phone:""},Wn=[{value:"signer_provides",label:"Signer will provide"},{value:"notary_provides",label:"Notary will provide"}];function Kn(t){const e=Y.c(44),{errorsByField:n}=t,{state:r,setField:l,dispatch:a}=Q(),{details:o}=r;if(!!!(o.witnessCount||o.witnessNotes)){let O;e[0]!==l?(O=()=>l("witnessCount","1"),e[0]=l,e[1]=O):O=e[1];let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=i.jsx("span",{"aria-hidden":"true",children:"+"}),e[2]=F):F=e[2];let S;return e[3]!==O?(S=i.jsxs("button",{type:"button","data-testid":"add-witnesses",onClick:O,className:"flex w-fit items-center gap-1 rounded-sm text-xs font-medium text-ne-ink/70 underline underline-offset-4 transition-colors hover:text-ne-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",children:[F," Add witnesses"]}),e[3]=O,e[4]=S):S=e[4],S}let s;e[5]!==a?(s=()=>a({type:H.HYDRATE,details:{witnessCount:"",witnessProvider:"",witnessNotes:""}}),e[5]=a,e[6]=s):s=e[6];const c=s;let g;e[7]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx("p",{className:"m-0 text-xs font-semibold uppercase tracking-wide text-ne-gray",children:"Witnesses"}),e[7]=g):g=e[7];let u;e[8]!==c?(u=i.jsxs("div",{className:"flex items-center justify-between",children:[g,i.jsx("button",{type:"button","data-testid":"remove-witnesses",onClick:c,className:"text-xs font-medium text-ne-gray underline underline-offset-4 hover:text-red-600",children:"Remove"})]}),e[8]=c,e[9]=u):u=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsxs(X,{htmlFor:"field-witnessCount",className:"text-sm font-medium text-ne-ink",children:["Number of witnesses",i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"})]}),e[10]=m):m=e[10];const C=o.witnessCount;let p;e[11]!==l?(p=O=>l("witnessCount",O.target.value),e[11]=l,e[12]=p):p=e[12];let _,h;e[13]===Symbol.for("react.memo_cache_sentinel")?(_=i.jsx("option",{value:"",disabled:!0,hidden:!0}),h=["1","2","3","4"].map(Jn),e[13]=_,e[14]=h):(_=e[13],h=e[14]);let x;e[15]!==o.witnessCount||e[16]!==p?(x=i.jsxs("select",{id:"field-witnessCount",value:C,onChange:p,className:et,children:[_,h]}),e[15]=o.witnessCount,e[16]=p,e[17]=x):x=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=i.jsx(tt,{}),e[18]=y):y=e[18];let v;e[19]!==x?(v=i.jsxs("div",{className:"relative",children:[x,y]}),e[19]=x,e[20]=v):v=e[20];let k;e[21]!==n.witnessCount?(k=n.witnessCount&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:n.witnessCount}),e[21]=n.witnessCount,e[22]=k):k=e[22];let b;e[23]!==v||e[24]!==k?(b=i.jsxs("div",{className:"space-y-1.5",children:[m,v,k]}),e[23]=v,e[24]=k,e[25]=b):b=e[25];let j;e[26]===Symbol.for("react.memo_cache_sentinel")?(j=i.jsxs("legend",{className:"text-sm font-medium text-ne-ink",children:["Who will provide them?",i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"})]}),e[26]=j):j=e[26];let N;e[27]!==o.witnessProvider||e[28]!==l?(N=Wn.map(O=>i.jsxs("label",{htmlFor:`field-witnessProvider-${O.value}`,className:"flex cursor-pointer items-center gap-2 text-sm text-ne-ink",children:[i.jsx("input",{id:`field-witnessProvider-${O.value}`,type:"radio",name:"witnessProvider",value:O.value,checked:o.witnessProvider===O.value,onChange:()=>l("witnessProvider",O.value),className:"h-4 w-4 border-ne-line text-emerald-600 focus:ring-ne-ink/30"}),O.label]},O.value)),e[27]=o.witnessProvider,e[28]=l,e[29]=N):N=e[29];let E;e[30]!==N?(E=i.jsx("div",{className:"flex flex-col gap-2",children:N}),e[30]=N,e[31]=E):E=e[31];let A;e[32]!==n.witnessProvider?(A=n.witnessProvider&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:n.witnessProvider}),e[32]=n.witnessProvider,e[33]=A):A=e[33];let w;e[34]!==E||e[35]!==A?(w=i.jsxs("fieldset",{className:"space-y-1.5",children:[j,E,A]}),e[34]=E,e[35]=A,e[36]=w):w=e[36];let D;e[37]!==b||e[38]!==w?(D=i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[b,w]}),e[37]=b,e[38]=w,e[39]=D):D=e[39];let f;e[40]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(Ye,{field:"witnessNotes",label:"Witness instructions (optional)",rows:2,placeholder:"Anything the notary should know about the witnesses"}),e[40]=f):f=e[40];let L;return e[41]!==D||e[42]!==u?(L=i.jsxs("div",{"data-testid":"witness-fields",className:"space-y-3 rounded-lg border border-ne-line bg-ne-mist/40 p-3",children:[u,D,f]}),e[41]=D,e[42]=u,e[43]=L):L=e[43],L}function Jn(t){return i.jsx("option",{value:t,children:t},t)}function Xn(t){const e=Y.c(99),{index:n,signer:r,onChange:l,onRemove:a}=t;let o;e[0]!==l||e[1]!==r?(o=(te,Ee)=>l({...r,[te]:Ee}),e[0]=l,e[1]=r,e[2]=o):o=e[2];const d=o;let s;e[3]!==r.email?(s=ke("email",r.email),e[3]=r.email,e[4]=s):s=e[4];const c=s==="invalid";let g;e[5]!==r.phone?(g=ke("phone",r.phone),e[5]=r.phone,e[6]=g):g=e[6];const u=g==="invalid",m=`additional-signer-${n}`,C=n+3;let p;e[7]!==C?(p=i.jsxs("p",{className:"m-0 text-xs font-semibold uppercase tracking-wide text-ne-gray",children:["Signer ",C]}),e[7]=C,e[8]=p):p=e[8];const _=`remove-signer-${n}`;let h;e[9]!==a||e[10]!==_?(h=i.jsx("button",{type:"button","data-testid":_,onClick:a,className:"text-xs font-medium text-ne-gray underline underline-offset-4 hover:text-red-600",children:"Remove"}),e[9]=a,e[10]=_,e[11]=h):h=e[11];let x;e[12]!==p||e[13]!==h?(x=i.jsxs("div",{className:"flex items-center justify-between",children:[p,h]}),e[12]=p,e[13]=h,e[14]=x):x=e[14];const y=`additional-signer-first-${n}`;let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"}),e[15]=v):v=e[15];let k;e[16]!==y?(k=i.jsxs(X,{htmlFor:y,className:"text-sm font-medium text-ne-ink",children:["First name",v]}),e[16]=y,e[17]=k):k=e[17];const b=`additional-signer-first-${n}`;let j;e[18]!==d?(j=te=>d("firstName",te.target.value),e[18]=d,e[19]=j):j=e[19];const N="h-9 w-full rounded-md border border-ne-line bg-white px-3 text-sm text-ne-ink placeholder:text-ne-gray/70 focus:outline-none focus:ring-2 focus:ring-ne-ink/30"+(r.firstName?" ne-tint":"");let E;e[20]!==r.firstName||e[21]!==b||e[22]!==j||e[23]!==N?(E=i.jsx("input",{id:b,value:r.firstName,onChange:j,className:N}),e[20]=r.firstName,e[21]=b,e[22]=j,e[23]=N,e[24]=E):E=e[24];let A;e[25]!==k||e[26]!==E?(A=i.jsxs("div",{className:"space-y-1.5",children:[k,E]}),e[25]=k,e[26]=E,e[27]=A):A=e[27];const w=`additional-signer-last-${n}`;let D;e[28]!==w?(D=i.jsx(X,{htmlFor:w,className:"text-sm font-medium text-ne-ink",children:"Last name"}),e[28]=w,e[29]=D):D=e[29];const f=`additional-signer-last-${n}`;let L;e[30]!==d?(L=te=>d("lastName",te.target.value),e[30]=d,e[31]=L):L=e[31];const O="h-9 w-full rounded-md border border-ne-line bg-white px-3 text-sm text-ne-ink placeholder:text-ne-gray/70 focus:outline-none focus:ring-2 focus:ring-ne-ink/30"+(r.lastName?" ne-tint":"");let F;e[32]!==r.lastName||e[33]!==f||e[34]!==L||e[35]!==O?(F=i.jsx("input",{id:f,value:r.lastName,onChange:L,className:O}),e[32]=r.lastName,e[33]=f,e[34]=L,e[35]=O,e[36]=F):F=e[36];let S;e[37]!==D||e[38]!==F?(S=i.jsxs("div",{className:"space-y-1.5",children:[D,F]}),e[37]=D,e[38]=F,e[39]=S):S=e[39];const z=`additional-signer-role-${n}`;let I;e[40]!==z?(I=i.jsx(X,{htmlFor:z,className:"text-sm font-medium text-ne-ink",children:"Role"}),e[40]=z,e[41]=I):I=e[41];const P=`additional-signer-role-${n}`,$=r.role;let T;e[42]!==d?(T=te=>d("role",te.target.value),e[42]=d,e[43]=T):T=e[43];let R;e[44]===Symbol.for("react.memo_cache_sentinel")?(R=Yn.map(Qn),e[44]=R):R=e[44];let M;e[45]!==r.role||e[46]!==P||e[47]!==T?(M=i.jsx("select",{id:P,value:$,onChange:T,className:et,children:R}),e[45]=r.role,e[46]=P,e[47]=T,e[48]=M):M=e[48];let U;e[49]===Symbol.for("react.memo_cache_sentinel")?(U=i.jsx(tt,{}),e[49]=U):U=e[49];let Z;e[50]!==M?(Z=i.jsxs("div",{className:"relative",children:[M,U]}),e[50]=M,e[51]=Z):Z=e[51];let W;e[52]!==I||e[53]!==Z?(W=i.jsxs("div",{className:"space-y-1.5",children:[I,Z]}),e[52]=I,e[53]=Z,e[54]=W):W=e[54];let ee;e[55]!==A||e[56]!==S||e[57]!==W?(ee=i.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[A,S,W]}),e[55]=A,e[56]=S,e[57]=W,e[58]=ee):ee=e[58];const ue=`additional-signer-phone-${n}`;let xe;e[59]!==ue?(xe=i.jsx(X,{htmlFor:ue,className:"text-sm font-medium text-ne-ink",children:"Phone"}),e[59]=ue,e[60]=xe):xe=e[60];const ge=`additional-signer-phone-${n}`;let re;e[61]!==d?(re=te=>d("phone",Ft(te.target.value)),e[61]=d,e[62]=re):re=e[62];const se=u||void 0,De="h-9 w-full rounded-md border border-ne-line bg-white px-3 text-sm text-ne-ink placeholder:text-ne-gray/70 focus:outline-none focus:ring-2 focus:ring-ne-ink/30"+(u?" ne-tint-error":r.phone?" ne-tint":"");let fe;e[63]!==r.phone||e[64]!==ge||e[65]!==re||e[66]!==se||e[67]!==De?(fe=i.jsx("input",{id:ge,type:"tel",value:r.phone,placeholder:"(555) 123-4567",onChange:re,"aria-invalid":se,className:De}),e[63]=r.phone,e[64]=ge,e[65]=re,e[66]=se,e[67]=De,e[68]=fe):fe=e[68];let de;e[69]!==u?(de=u&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:ct.phone}),e[69]=u,e[70]=de):de=e[70];let pe;e[71]!==xe||e[72]!==fe||e[73]!==de?(pe=i.jsxs("div",{className:"space-y-1.5",children:[xe,fe,de]}),e[71]=xe,e[72]=fe,e[73]=de,e[74]=pe):pe=e[74];const me=`additional-signer-email-${n}`;let he;e[75]!==me?(he=i.jsx(X,{htmlFor:me,className:"text-sm font-medium text-ne-ink",children:"Email"}),e[75]=me,e[76]=he):he=e[76];const we=`additional-signer-email-${n}`;let ne;e[77]!==d?(ne=te=>d("email",te.target.value),e[77]=d,e[78]=ne):ne=e[78];const ve=c||void 0,be="h-9 w-full rounded-md border border-ne-line bg-white px-3 text-sm text-ne-ink placeholder:text-ne-gray/70 focus:outline-none focus:ring-2 focus:ring-ne-ink/30"+(c?" ne-tint-error":r.email?" ne-tint":"");let oe;e[79]!==r.email||e[80]!==we||e[81]!==ne||e[82]!==ve||e[83]!==be?(oe=i.jsx("input",{id:we,type:"email",value:r.email,onChange:ne,"aria-invalid":ve,className:be}),e[79]=r.email,e[80]=we,e[81]=ne,e[82]=ve,e[83]=be,e[84]=oe):oe=e[84];let ae;e[85]!==c?(ae=c&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:ct.email}),e[85]=c,e[86]=ae):ae=e[86];let le;e[87]!==he||e[88]!==oe||e[89]!==ae?(le=i.jsxs("div",{className:"space-y-1.5",children:[he,oe,ae]}),e[87]=he,e[88]=oe,e[89]=ae,e[90]=le):le=e[90];let ce;e[91]!==pe||e[92]!==le?(ce=i.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[pe,le]}),e[91]=pe,e[92]=le,e[93]=ce):ce=e[93];let ye;return e[94]!==ee||e[95]!==m||e[96]!==ce||e[97]!==x?(ye=i.jsxs("div",{"data-testid":m,className:"space-y-3 rounded-lg border border-ne-line bg-ne-mist/40 p-3",children:[x,ee,ce]}),e[94]=ee,e[95]=m,e[96]=ce,e[97]=x,e[98]=ye):ye=e[98],ye}function Qn(t){return i.jsx("option",{value:t.value,children:t.label},t.value)}function es(t){const e=Y.c(66),{config:n,errorsByField:r,hasCustomizations:l}=t;let a;e[0]!==r?(a=r===void 0?{}:r,e[0]=r,e[1]=a):a=e[1];const o=a,{state:d,setField:s}=Q(),{details:c}=d,g=d.mode==="notary";let u;e[2]!==c.additionalSigners?(u=Array.isArray(c.additionalSigners)?c.additionalSigners:[],e[2]=c.additionalSigners,e[3]=u):u=e[3];const m=u,C=1+(c.coSignerName?1:0)+m.length,p=C>=Ge;let _;e[4]!==m||e[5]!==s?(_=()=>s("additionalSigners",[...m,{...Vn}]),e[4]=m,e[5]=s,e[6]=_):_=e[6];const h=_;let x;e[7]!==m||e[8]!==s?(x=(P,$)=>s("additionalSigners",m.map((T,R)=>R===P?$:T)),e[7]=m,e[8]=s,e[9]=x):x=e[9];const y=x;let v;e[10]!==m||e[11]!==s?(v=P=>s("additionalSigners",m.filter(($,T)=>T!==P)),e[10]=m,e[11]=s,e[12]=v):v=e[12];const k=v;let b;e[13]!==n?(b=K(n,"signer_section_title","Signer Information"),e[13]=n,e[14]=b):b=e[14];let j;e[15]!==n||e[16]!==o?(j=G(n,"show_signer_name")&&i.jsx(V,{field:"signerName",label:K(n,"signer_name_label","Signer Name"),required:!0,validate:"text",error:o.signerName}),e[15]=n,e[16]=o,e[17]=j):j=e[17];let N;e[18]!==n||e[19]!==o||e[20]!==l?(N=G(n,"show_signer_phone")&&i.jsx(V,{field:"signerPhone",label:K(n,"signer_phone_label","Cell Phone"),type:"tel",validate:"phone",placeholder:"(555) 123-4567",hint:l?"Phone or email required for this client":void 0,error:o.signerPhone}),e[18]=n,e[19]=o,e[20]=l,e[21]=N):N=e[21];let E;e[22]!==n||e[23]!==o?(E=G(n,"show_signer_email")&&i.jsx(V,{field:"signerEmail",label:K(n,"signer_email_label","Email Address"),type:"email",validate:"email",error:o.signerEmail}),e[22]=n,e[23]=o,e[24]=E):E=e[24];let A;e[25]!==E||e[26]!==j||e[27]!==N?(A=i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[j,N,E]}),e[25]=E,e[26]=j,e[27]=N,e[28]=A):A=e[28];let w;e[29]!==n||e[30]!==c.spouseName?(w=G(n,"show_spouse_section")&&i.jsx(Ne,{label:"Add non-borrowing spouse",testId:"disclosure-spouse",forceOpen:!!c.spouseName,children:i.jsx("div",{className:"sm:w-1/2",children:i.jsx(V,{field:"spouseName",label:K(n,"spouse_name_label","Spouse Name")}
3)})}),e[29]=n,e[30]=c.spouseName,e[31]=w):w=e[31];let D;e[32]!==n||e[33]!==c.coSignerEmail||e[34]!==c.coSignerName||e[35]!==c.coSignerPhone||e[36]!==c.coSignerSpouseName?(D=G(n,"show_cosigner_section")&&i.jsx(Ne,{label:"Add co-signer",testId:"disclosure-cosigner",forceOpen:!!(c.coSignerName||c.coSignerPhone||c.coSignerEmail||c.coSignerSpouseName),children:i.jsxs("div",{children:[i.jsx(ji,{className:"mb-4 bg-ne-line"}),i.jsx("h3",{className:"mb-3 text-sm font-semibold text-ne-ink",children:K(n,"cosigner_section_title","Co-signer Information")}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i.jsx(V,{field:"coSignerName",label:"Co-signer Name"}),i.jsx(V,{field:"coSignerSpouseName",label:"Co-signer Spouse Name"}),i.jsx(V,{field:"coSignerPhone",label:"Co-signer Phone",type:"tel",validate:"phone"}),i.jsx(V,{field:"coSignerEmail",label:"Co-signer Email",type:"email",validate:"email"})]})]})}),e[32]=n,e[33]=c.coSignerEmail,e[34]=c.coSignerName,e[35]=c.coSignerPhone,e[36]=c.coSignerSpouseName,e[37]=D):D=e[37];let f;e[38]!==h||e[39]!==m||e[40]!==p||e[41]!==n||e[42]!==o||e[43]!==g||e[44]!==k||e[45]!==C||e[46]!==y?(f=!g&&G(n,"show_cosigner_section")&&i.jsxs("div",{className:"space-y-3",children:[m.length>0&&i.jsxs("div",{className:"flex items-baseline justify-between",children:[i.jsx("h3",{className:"m-0 text-sm font-semibold text-ne-ink",children:"Additional signers"}),i.jsxs("span",{className:"text-xs text-ne-gray","data-testid":"signer-count",children:[C," of ",Ge," signers"]})]}),m.map((P,$)=>i.jsx(Xn,{index:$,signer:P,onChange:T=>y($,T),onRemove:()=>k($)},$)),o.additionalSigners&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:o.additionalSigners}),p?i.jsxs("p",{className:"m-0 text-xs text-ne-gray","data-testid":"signer-cap-note",children:["Maximum of ",Ge," signers reached."]}):i.jsxs("button",{type:"button","data-testid":"add-signer",onClick:h,className:"flex w-fit items-center gap-1 rounded-sm text-xs font-medium text-ne-ink/70 underline underline-offset-4 transition-colors hover:text-ne-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",children:[i.jsx("span",{"aria-hidden":"true",children:"+"})," Add another signer"]})]}),e[38]=h,e[39]=m,e[40]=p,e[41]=n,e[42]=o,e[43]=g,e[44]=k,e[45]=C,e[46]=y,e[47]=f):f=e[47];let L;e[48]!==o?(L=i.jsx(Kn,{errorsByField:o}),e[48]=o,e[49]=L):L=e[49];const O=!!c.signerAccommodations;let F;e[50]===Symbol.for("react.memo_cache_sentinel")?(F=i.jsx(Ye,{field:"signerAccommodations",label:"Signer accommodations",rows:2,placeholder:"e.g. wheelchair access, hearing impaired, large-print documents",hint:"Accessibility needs the notary should prepare for."}),e[50]=F):F=e[50];let S;e[51]!==O?(S=i.jsx(Ne,{label:"Add signer accommodations",testId:"disclosure-signer-accommodations",forceOpen:O,children:F}),e[51]=O,e[52]=S):S=e[52];let z;e[53]!==n||e[54]!==c.additionalContactInfo||e[55]!==g?(z=!g&&G(n,"show_additional_contact_info")&&i.jsx(Ne,{label:"Add additional contact information",testId:"disclosure-contact-info",forceOpen:!!c.additionalContactInfo,children:i.jsx(Ye,{field:"additionalContactInfo",label:K(n,"additional_contact_info_label","Additional Contact Information"),rows:3,hint:"Anyone else the notary may need to reach."})}),e[53]=n,e[54]=c.additionalContactInfo,e[55]=g,e[56]=z):z=e[56];let I;return e[57]!==A||e[58]!==w||e[59]!==D||e[60]!==f||e[61]!==L||e[62]!==S||e[63]!==z||e[64]!==b?(I=i.jsxs(Ve,{id:"signer",title:b,hint:"Who is signing, plus any co-signer",children:[A,w,D,f,L,S,z]}),e[57]=A,e[58]=w,e[59]=D,e[60]=f,e[61]=L,e[62]=S,e[63]=z,e[64]=b,e[65]=I):I=e[65],I}const ts=[{value:"advisor",label:"Advisor"},{value:"signer",label:"Signer"},{value:"third_party",label:"Third party"}],is={advisor:"Advisor Name",signer:"Signer Name",third_party:"Contact Name"};function ns(t){const e=Y.c(33),{errorsByField:n}=t;let r;e[0]!==n?(r=n===void 0?{}:n,e[0]=n,e[1]=r):r=e[1];const l=r,{state:a,setField:o}=Q(),{details:d}=a,s=d.invoiceTo||"advisor",c=s==="advisor";let g;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsxs("legend",{className:"text-sm font-medium text-ne-ink",children:["Who should be invoiced?",i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"})]}),e[2]=g):g=e[2];let u;e[3]!==s||e[4]!==o?(u=ts.map(b=>{const j=`field-invoiceTo-${b.value}`;return i.jsxs("label",{htmlFor:j,className:J("flex cursor-pointer items-center gap-2 rounded-md border px-3.5 py-2 text-sm transition-colors",s===b.value?"ne-tint font-medium text-ne-ink":"border-ne-line text-ne-gray hover:border-ne-ink/30 hover:text-ne-ink"),children:[i.jsx("input",{id:j,type:"radio",name:"invoiceTo",value:b.value,checked:s===b.value,onChange:()=>o("invoiceTo",b.value),className:"h-4 w-4 border-ne-line text-emerald-600 focus:ring-ne-ink/30"}),b.label]},b.value)}),e[3]=s,e[4]=o,e[5]=u):u=e[5];let m;e[6]!==u?(m=i.jsxs("fieldset",{className:"space-y-1.5",children:[g,i.jsx("div",{className:"flex flex-wrap gap-4",children:u})]}),e[6]=u,e[7]=m):m=e[7];const C=is[s]??"Contact Name";let p;e[8]!==l.invoiceName||e[9]!==C?(p=i.jsx(V,{field:"invoiceName",label:C,required:!0,validate:"text",error:l.invoiceName}),e[8]=l.invoiceName,e[9]=C,e[10]=p):p=e[10];let _;e[11]!==l.invoiceEmail?(_=i.jsx(V,{field:"invoiceEmail",label:"Email Address",type:"email",required:!0,validate:"email",error:l.invoiceEmail}),e[11]=l.invoiceEmail,e[12]=_):_=e[12];let h;e[13]!==l.invoicePhone||e[14]!==c?(h=i.jsx(V,{field:"invoicePhone",label:"Phone Number",type:"tel",validate:"phone",required:c,error:l.invoicePhone}),e[13]=l.invoicePhone,e[14]=c,e[15]=h):h=e[15];let x;e[16]!==c?(x=c&&i.jsx(V,{field:"invoiceCompanyName",label:"Business N
3ame"}),e[16]=c,e[17]=x):x=e[17];let y;e[18]!==x||e[19]!==p||e[20]!==_||e[21]!==h?(y=i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[p,_,h,x]}),e[18]=x,e[19]=p,e[20]=_,e[21]=h,e[22]=y):y=e[22];let v;e[23]!==l.invoiceCity||e[24]!==l.invoicePropertyAddress||e[25]!==l.invoiceState||e[26]!==l.invoiceZipcode||e[27]!==c?(v=c&&i.jsxs("div",{className:"space-y-4","data-testid":"invoice-address-block",children:[i.jsx(mt,{kind:"invoice",label:"Address",required:!0,error:l.invoicePropertyAddress}),i.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[i.jsx(V,{field:"invoiceCity",label:"City",required:!0,error:l.invoiceCity}),i.jsx(Me,{field:"invoiceState",label:"State",options:ut,required:!0,error:l.invoiceState}),i.jsx(V,{field:"invoiceZipcode",label:"Zip",required:!0,validate:"zip",error:l.invoiceZipcode})]})]}),e[23]=l.invoiceCity,e[24]=l.invoicePropertyAddress,e[25]=l.invoiceState,e[26]=l.invoiceZipcode,e[27]=c,e[28]=v):v=e[28];let k;return e[29]!==y||e[30]!==v||e[31]!==m?(k=i.jsxs(Ve,{id:"invoicing",title:"Invoicing",hint:"Who should be invoiced for this order",children:[m,y,v]}),e[29]=y,e[30]=v,e[31]=m,e[32]=k):k=e[32],k}function jt(t){const e=Y.c(37),{field:n,label:r,contactType:l,placeholder:a,required:o,error:d}=t,s=a===void 0?"Add contact":a,c=o===void 0?!1:o,{state:g,setField:u}=Q(),{user:m}=Be(),[C,p]=B.useState(!1),_=g.details[n],h=`field-${n}`;let x;e[0]!==n||e[1]!==u?(x=z=>u(n,z),e[0]=n,e[1]=u,e[2]=x):x=e[2];const y=x;let v;e[3]!==c?(v=c&&i.jsx("span",{className:"ml-0.5 text-red-600","aria-hidden":"true",children:"*"}),e[3]=c,e[4]=v):v=e[4];let k;e[5]!==h||e[6]!==r||e[7]!==v?(k=i.jsxs(X,{htmlFor:h,className:"text-sm font-medium text-ne-ink",children:[r,v]}),e[5]=h,e[6]=r,e[7]=v,e[8]=k):k=e[8];const b=`contact-picker-${n}`;let j;e[9]===Symbol.for("react.memo_cache_sentinel")?(j=()=>p(!0),e[9]=j):j=e[9];const N=_?"border-ne-line text-ne-ink":"border-ne-line text-ne-gray",E=d&&"border-red-500";let A;e[10]!==N||e[11]!==E?(A=J("flex h-10 w-full items-center justify-between rounded-md border bg-white px-3 py-2 text-left text-sm","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ne-ink/30",N,E),e[10]=N,e[11]=E,e[12]=A):A=e[12];let w;e[13]!==_||e[14]!==s?(w=_?[_.contact_name,_.contact_email].filter(Boolean).join(" â "):s,e[13]=_,e[14]=s,e[15]=w):w=e[15];let D;e[16]!==w?(D=i.jsx("span",{className:"min-w-0 truncate",children:w}),e[16]=w,e[17]=D):D=e[17];let f;e[18]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(Ce,{icon:Et,className:"ml-2 shrink-0 text-xs text-ne-gray"}),e[18]=f):f=e[18];let L;e[19]!==h||e[20]!==A||e[21]!==D||e[22]!==b?(L=i.jsxs("button",{id:h,type:"button","data-testid":b,onClick:j,className:A,children:[D,f]}),e[19]=h,e[20]=A,e[21]=D,e[22]=b,e[23]=L):L=e[23];let O;e[24]!==d?(O=d&&i.jsx("p",{role:"alert",className:"text-xs font-medium text-red-600",children:d}),e[24]=d,e[25]=O):O=e[25];let F;e[26]!==l||e[27]!==C||e[28]!==y||e[29]!==g.contacts||e[30]!==m?.userId?(F=C&&i.jsx(Ti,{isOpen:C,toggleModal:()=>p(!1),addContact:y,setSelectedOrderContact:y,contactType:l,clientCompanyId:g.contacts.clientCompanyId,userId:m?.userId}),e[26]=l,e[27]=C,e[28]=y,e[29]=g.contacts,e[30]=m?.userId,e[31]=F):F=e[31];let S;return e[32]!==L||e[33]!==O||e[34]!==F||e[35]!==k?(S=i.jsxs("div",{className:"space-y-1.5",children:[k,L,O,F]}),e[32]=L,e[33]=O,e[34]=F,e[35]=k,e[36]=S):S=e[36],S}const ss=2e3,rs=[{value:"will_upload",label:"Upload documents",hint:"I have them and will attach them now"},{value:"signer_has_docs",label:"Signer already has documents",hint:"No upload needed"},{value:"docs_in_transit",label:"Documents in transit to signer",hint:"On their way"}];function os(t){const e=Y.c(60),{config:n,hasCustomizations:r,onSubmit:l,isEdit:a}=t,{state:o,dispatch:d}=Q(),{details:s,errors:c,submitting:g,documents:u}=o;let m;e[0]!==r?(m=M=>ht(r).find(U=>U.id===M)?.label??M,e[0]=r,e[1]=m):m=e[1];const C=m,p=s.documentStatus??"will_upload",_=r,h=o.mode==="notary",x=!h&&(!_||p==="will_upload");let y;e[2]!==n?(y=G(n,"show_special_instructions")&&i.jsx(Ye,{field:"specialInstructions",label:K(n,"special_instructions_label","Special Instructions"),rows:4,placeholder:K(n,"special_instructions_placeholder","Notes for the scheduler and/or notary â e.g. are funds due at closing?"),hint:"Visible to the notary"}),e[2]=n,e[3]=y):y=e[3];let v;e[4]!==h?(v=!h&&i.jsx(Ye,{field:"privateNote",label:i.jsx("span",{className:"font-normal text-ne-gray",children:"Private note"}),rows:2,maxLength:ss,placeholder:"Note to internal ops â not visible to the notary",className:"text-xs"}),e[4]=h,e[5]=v):v=e[5];let k;e[6]!==d||e[7]!==_||e[8]!==p?(k=_&&i.jsxs("fieldset",{className:"space-y-2",children:[i.jsx("legend",{className:"text-sm font-medium text-ne-ink",children:"Document status"}),i.jsx("div",{className:"grid gap-2 sm:grid-cols-3",children:rs.map(M=>{const U=`field-documentStatus-${M.value}`,Z=p===M.value;return i.jsx("label",{htmlFor:U,className:J("cursor-pointer rounded-lg border p-3 transition-colors",Z?"border-ne-ink bg-ne-mist":"border-ne-line bg-white hover:border-ne-ink/40"),children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("input",{id:U,type:"radio",name:"documentStatus",value:M.value,checked:Z,onChange:()=>d({type:H.FIELD_CHANGED,field:"documentStatus",value:M.value}),className:"mt-0.5 h-4 w-4 border-ne-line text-ne-ink focus:ring-ne-ink/30"}),i.jsxs("span",{children:[i.jsx(X,{htmlFor:U,className:"cursor-pointer text-sm font-medium text-ne-ink",children:M.label}),i.jsx("p",{className:"mt-0.5 text-xs text-ne-gray",children:M.hint})]})]})},M.value)})})]}),e[6]=d,e[7]=_,e[8]=p,e[9]=k):k=e[9];let b;
3e[10]!==x||e[11]!==d||e[12]!==u||e[13]!==_||e[14]!==p?(b=x&&i.jsx(Ne,{label:"Upload documents",testId:"disclosure-documents",forceOpen:u.length>0||_&&p==="will_upload",children:i.jsx(Ii,{title:"",description:"Upload supporting documents for this order (optional)",documents:u,onDocumentsChange:M=>d({type:H.DOCUMENTS_CHANGED,documents:M}),acceptedFileTypes:".pdf,.doc,.docx,.jpg,.jpeg,.png,.gif,.txt",maxFileSize:26214400})}),e[10]=x,e[11]=d,e[12]=u,e[13]=_,e[14]=p,e[15]=b):b=e[15];const j=!!(s.documentDelivery||s.esigningPlatform||s.language);let N;e[16]!==n?(N=G(n,"show_document_delivery")&&i.jsx(Me,{field:"documentDelivery",label:K(n,"document_delivery_label","Document Delivery"),options:qn}),e[16]=n,e[17]=N):N=e[17];let E;e[18]!==n?(E=G(n,"show_esigning_platform")&&i.jsx(V,{field:"esigningPlatform",label:K(n,"esigning_platform_label","E-signing Platform(s)"),placeholder:"DocuSign, Notarizeâ¦"}),e[18]=n,e[19]=E):E=e[19];let A;e[20]!==N||e[21]!==E?(A=i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[N,E]}),e[20]=N,e[21]=E,e[22]=A):A=e[22];let w;e[23]!==n?(w=G(n,"show_language_selection")&&i.jsx(An,{field:"language",label:K(n,"language_label","Language (Other than English)"),options:Hn,hint:"Leave empty for English. More than one may be selected."}),e[23]=n,e[24]=w):w=e[24];let D;e[25]!==w||e[26]!==A?(D=i.jsxs("div",{className:"space-y-4",children:[A,w]}),e[25]=w,e[26]=A,e[27]=D):D=e[27];let f;e[28]!==D||e[29]!==j?(f=i.jsx(Ne,{label:"Delivery & e-signing details",testId:"disclosure-delivery",forceOpen:j,children:D}),e[28]=D,e[29]=j,e[30]=f):f=e[30];const L=!!(s.lender||s.loanOfficer||s.invoiceOrderTo);let O;e[31]!==n?(O=G(n,"show_lender")&&i.jsx(V,{field:"lender",label:K(n,"lender_label","Lender (email)"),type:"email",validate:"email"}),e[31]=n,e[32]=O):O=e[32];let F;e[33]!==n?(F=G(n,"show_loan_officer")&&i.jsx(jt,{field:"loanOfficer",label:K(n,"loan_officer_label","Loan Officer"),contactType:"loan_officer",placeholder:"Add Loan Officer"}),e[33]=n,e[34]=F):F=e[34];let S;e[35]!==n?(S=G(n,"show_invoice_contact")&&i.jsx(jt,{field:"invoiceOrderTo",label:K(n,"invoice_contact_label","Invoice Order To"),contactType:"invoice_contact",placeholder:"Add invoice contact"}),e[35]=n,e[36]=S):S=e[36];let z;e[37]!==O||e[38]!==F||e[39]!==S?(z=i.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[O,F,S]}),e[37]=O,e[38]=F,e[39]=S,e[40]=z):z=e[40];let I;e[41]!==L||e[42]!==z?(I=i.jsx(Ne,{label:"Lender, loan officer & invoicing contacts",testId:"disclosure-additional-details",forceOpen:L,children:z}),e[41]=L,e[42]=z,e[43]=I):I=e[43];let P;e[44]!==c||e[45]!==C?(P=c.length>0&&i.jsxs("div",{role:"alert","data-testid":"validation-summary",className:"rounded-lg border border-red-200 bg-red-50 p-4",children:[i.jsxs("p",{className:"mb-2 text-sm font-semibold text-red-800",children:[c.length," field",c.length===1?"":"s"," need attention before this order can be scheduled:"]}),i.jsx("ul",{className:"m-0 list-none space-y-1",style:{paddingLeft:0},children:c.map(M=>i.jsx("li",{className:"text-sm text-red-700",children:i.jsxs("button",{type:"button",onClick:()=>Rt(M.section),className:"underline underline-offset-2 hover:text-red-900",children:[M.message,i.jsxs("span",{className:"ml-1 text-xs text-red-600",children:["(in ",C(M.section),")"]})]})},`${M.field}-${M.message}`))})]}),e[44]=c,e[45]=C,e[46]=P):P=e[46];const $=g?a?"Savingâ¦":"Schedulingâ¦":a?"Save changes":"Schedule Order";let T;e[47]!==l||e[48]!==g||e[49]!==$?(T=i.jsx("div",{className:"flex items-center justify-end pt-1",children:i.jsx(Yt,{type:"button",onClick:l,disabled:g,"data-testid":"submit-order",className:"h-11 bg-ne-ink px-8 text-sm font-semibold text-white hover:bg-ne-ink-light",children:$})}),e[47]=l,e[48]=g,e[49]=$,e[50]=T):T=e[50];let R;return e[51]!==f||e[52]!==I||e[53]!==P||e[54]!==y||e[55]!==T||e[56]!==v||e[57]!==k||e[58]!==b?(R=i.jsxs(Ve,{id:"finish",title:"Finish",hint:"Notes, documents, submit",children:[y,v,k,b,f,I,P,T]}),e[51]=f,e[52]=I,e[53]=P,e[54]=y,e[55]=T,e[56]=v,e[57]=k,e[58]=b,e[59]=R):R=e[59],R}const as=t=>{const e=Y.c(19),{success:n,orderData:r,errorMessage:l,isEdit:a}=t,o=n===void 0?!0:n,d=l===void 0?"":l,s=a===void 0?!1:a,c=gt(),[,g]=B.use
3State(!1);let u,m;e[0]!==r?(u=()=>{console.log("OrderSuccessComponent - orderData:",r)},m=[r],e[0]=r,e[1]=u,e[2]=m):(u=e[1],m=e[2]),B.useEffect(u,m);let C,p;e[3]!==s||e[4]!==o?(C=()=>{if(o&&!s){g(!0);const j=Date.now()+3e3,N=ls,E=setInterval(()=>{const A=j-Date.now();if(A<=0){clearInterval(E);return}const w=50*(A/3e3);_t({particleCount:w,origin:{x:N(.1,.3),y:.5},colors:["#00c853","#2196f3","#651fff","#ff9100"],shapes:["circle","square"],gravity:.8,scalar:1.2,drift:0,ticks:300}),_t({particleCount:w,origin:{x:N(.7,.9),y:.5},colors:["#00c853","#2196f3","#651fff","#ff9100"],shapes:["circle","square"],gravity:.8,scalar:1.2,drift:0,ticks:300})},250);return()=>clearInterval(E)}},p=[o,s],e[3]=s,e[4]=o,e[5]=C,e[6]=p):(C=e[5],p=e[6]),B.useEffect(C,p);const _=cs,h=ds;let x;e[7]!==r?(x=()=>{if(!r?.signingDetailsFormData)return"N/A";const{signingTimeType:j,specificTime:N,startTime:E,endTime:A}=r.signingDetailsFormData;return j==="at"&&N?h(N):j==="range"&&E&&A?`${h(E)} - ${h(A)}`:j==="flexible"?"Flexible":"N/A"},e[7]=r,e[8]=x):x=e[8];const y=x;let v;e[9]!==r?(v=()=>{if(!r?.signingDetailsFormData)return"N/A";const{isPropertyAddressSame:j,propertyAddress:N,city:E,state:A,zipcode:w,signingAddress:D,signingCity:f,signingState:L,signingZipcode:O,ronSigning:F}=r.signingDetailsFormData;return F==="yes"?"Remote Online Notarization":j?`${N||""}, ${E||""}, ${A||""} ${w||""}`:`${D||""}, ${f||""}, ${L||""} ${O||""}`},e[9]=r,e[10]=v):v=e[10];const k=v;let b;return e[11]!==d||e[12]!==k||e[13]!==y||e[14]!==s||e[15]!==c||e[16]!==r||e[17]!==o?(b=i.jsx("div",{className:"order-success-container",children:i.jsx(ki,{className:"order-success-card",children:o?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"order-success-header",children:[i.jsx("div",{className:"success-icon-container",children:i.jsx(Ce,{icon:Vt,className:"success-icon"})}),i.jsx("h2",{children:s?"Order Updated Successfully":"Order Created Successfully"}),i.jsx("p",{className:"success-message",children:s?"Your order has been updated and all parties have been notified.":"Your order has been created and all parties have been notified."})]}),i.jsxs("div",{className:"order-summary",children:[i.jsx("h3",{children:"Order Summary"}),i.jsxs("div",{className:"summary-item",children:[i.jsx(Ce,{icon:Wt,className:"summary-icon"}),i.jsxs("div",{className:"summary-content",children:[i.jsx("div",{className:"summary-label",children:"Date & Time"}),i.jsxs("div",{className:"summary-value",children:[_(r?.signingDetailsFormData?.signingDate)," ",y()]})]})]}),i.jsxs("div",{className:"summary-item",children:[i.jsx(Ce,{icon:Kt,className:"summary-icon"}),i.jsxs("div",{className:"summary-content",children:[i.jsx("div",{className:"summary-label",children:"Signer"}),i.jsx("div",{className:"summary-value",children:r?.signingDetailsFormData?.signerName||"N/A"})]})]}),i.jsxs("div",{className:"summary-item",children:[i.jsx(Ce,{icon:Jt,className:"summary-icon"}),i.jsxs("div",{className:"summary-content",children:[i.jsx("div",{className:"summary-label",children:"Location"}),i.jsx("div",{className:"summary-value",children:k()})]})]}),i.jsxs("div",{className:"summary-item",children:[i.jsx(Ce,{icon:Xt,className:"summary-icon"}),i.jsxs("div",{className:"summary-content",children:[i.jsx("div",{className:"summary-label",children:"Client"}),i.jsx("div",{className:"summary-value",children:r?.clientName||"N/A"})]})]})]}),i.jsxs("div",{className:"order-success-actions",children:[i.jsxs(Ze,{color:"primary",className:"view-order-btn",onClick:()=>c(`/admin/orders/${r.orderId}`),children:["View Order",i.jsx(Ce,{icon:Qt,className:"btn-icon"})]}),i.jsxs(Ze,{color:"success",className:"create-another-btn",onClick:ms,children:[i.jsx(Ce,{icon:Et,className:"btn-icon-left"}),"Create Another Signing"]}),i.jsx(Ze,{color:"light",className:"go-dashboard-btn",onClick:()=>c("/admin/orders"),children:"Go to Dashboard"})]})]}):i.jsxs("div",{className:"order-error",children:[i.jsx("div",{className:"error-icon-container",children:i.jsx(Ce,{icon:ei,className:"error-icon"})}),i.jsxs("h2",{children:["Order ",s?"Update":"Creation"," Failed"]}),i.jsx("p",{className:"error-message",children:d||"There was an error processing your order. Please try again."}),i.jsxs("div",{className:"order-error-actions",children:[i.jsx(Ze,{color:"primary",onClick:()=>c(s?`/notary/orders/${r?.orderId}/edit`:"/admin/notary/orders/new"),children:"Try Again"}),i.jsx(Ze,{color:"light",onClick:()=>c("/admin/orders"),children:"Back to Orders"})]})]})})}),e[11]=d,e[12]=k,e[13]=y,e[14]=s,e[15]=c,e[16]=r,e[17]=o,e[18]=b):b=e[18],b};function ls(t,e){return Math.random()*(e-t)+t}function cs(t){if(!t)return"N/A";const e=Di(t);return e?e.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"}):"N/A"}function ds(t){return t||""}function ms(){window.location.href="/admin/notary/orders/new"}const us="scheduleOrderV2Draft",gs="scheduleOrderV2Draft:notary";function wt(t,e,n=!1){return!!(t.clientCompanyId||!n&&e.fileNumber||e.signingType||e.signerName||e.signingDate||e.propertyAddress)}function fs({mode:t="signing_service",prefill:e=null}){const{orderId:n,bookingId:r}=ii(),l=gt(),a=!!n,o=t==="notary",d=o?gs:us;mn({enabled:o&&a,orderId:n});const{state:s,dispatch:c}=Q(),{clients:g,contactOptions:u,contactsLoadedFor:m,orderContactEmailOptions:C,fees:p,signingServices:_,addContactOption:h,addClient:x}=$i({edit:a,orderId:n});Ri();const y=en({edit:a,orderId:n,clients:g,bookingId:o?r:null}),v=B.useMemo(()=>ht(s.hasCustomizations),[s.hasCustomizations]),k=B.useMemo(()=>v.map(T=>T.id),[v]),b=tn(k),j=B.useMemo(()=>Hi({contacts:s.contacts,details:s.details,hasCustomizations:s.hasCustomizations,mode:t}),[s.contacts,s.details,s.hasCustomizations,t]),[N,E]=B.useState(()=>k[0]??null);B.useEffect(()=>{b&&E(b)},[b]);const A=B.useCallback(T=>E(T),[]),w=B.useMemo(()=>({activeId:N,activate:A,sections:v,doneIds:j}),[N,A,v,j]),D=B.useMemo(()=>nn(s.customizations),[s.customizations]);B.useEffect(()=>{let T=!1;return n?((async()=>{try{const M=await ie.get(`/api/orders/${n}`);if(T)return;const{contacts:U,details:Z}=rn(M.data);c({type:H.HYDRATE,contacts:U,details:Z})}catch(M){console.error("Error fetching order data:",M),je.error("Error fetching order data: "+(M.response?.data?.message??""))}})(),()=>{T=!0}):void 0},[n,c]);const f=Xe.useRef(!1);B.useEffect(()=>{if(a||n)return;const T=an();
3T&&o&&delete T.details.privateNote,T&&(f.current=!0,c({type:H.HYDRATE,...T}),je.info("Order details copied â review and schedule."))},[a,n,c,o]),B.useEffect(()=>{if(!o||!r||a)return;let T=!1;return(async()=>{try{const M=await ie.get(`/api/bookings/${r}`);if(T)return;c({type:H.HYDRATE,...dn(M.data)})}catch(M){console.error("Error fetching booking data:",M),je.error("Failed to load booking details. Please try again.")}})(),()=>{T=!0}},[o,r,a,c]),B.useEffect(()=>{if(!o||!e)return;const{details:T,filledFields:R}=cn(e);R.length>0&&(c({type:H.HYDRATE,details:T}),je.success(`${R.length} fields auto-filled from import!`,{position:"top-center",autoClose:3e3}))},[o,e,c]);const[L,O]=B.useState(null),F=Xe.useRef(!1),S=!!(r||e);B.useEffect(()=>{if(!(a||n||S)){if(f.current){localStorage.removeItem(d),F.current=!0;return}try{const T=localStorage.getItem(d);if(!T){F.current=!0;return}const R=JSON.parse(T);R?.details&&wt(R.contacts??{},R.details,o)?O(R):(localStorage.removeItem(d),F.current=!0)}catch{localStorage.removeItem(d),F.current=!0}}},[]),B.useEffect(()=>{if(a||n||S||!F.current||!wt(s.contacts,s.details,o))return;const T=setTimeout(()=>{try{const{documents:R,...M}=s.details;localStorage.setItem(d,JSON.stringify({contacts:s.contacts,details:M,savedAt:new Date().toISOString()}))}catch{}},600);return()=>clearTimeout(T)},[s.contacts,s.details,a,n,S,o,d]),B.useEffect(()=>{s.submitResult?.success&&localStorage.removeItem(d)},[s.submitResult,d]);const z=()=>{L&&c({type:H.HYDRATE,contacts:L.contacts,details:L.details}),F.current=!0,O(null)},I=()=>{localStorage.removeItem(d),F.current=!0,O(null)};if(s.submitResult)return o?i.jsx(as,{success:s.submitResult.success,orderData:s.submitResult.data,errorMessage:s.submitResult.errorMessage,isEdit:a,isNotaryOrder:!0}):i.jsx(Ai,{success:s.submitResult.success,orderData:s.submitResult.data,errorMessage:s.submitResult.errorMessage,isEdit:a});const P=new Set(s.errors.map(T=>T.section)),$=s.errors.reduce((T,R)=>(T[R.field]||(T[R.field]=R.message),T),{});return i.jsxs("div",{className:"min-h-screen bg-ne-mist",children:[i.jsx("header",{className:"sticky top-0 z-20 h-12 border-b border-ne-line bg-white/90 backdrop-blur",children:i.jsxs("div",{className:"mx-auto flex h-12 max-w-7xl items-center justify-between px-6",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-sm font-semibold text-ne-ink",children:a?"Edit Order":o?"New Signing":"New Order"}),i.jsx("span",{className:"rounded-full bg-ne-mist px-2.5 py-0.5 text-xs text-ne-gray",children:a?"Update an existing signing":o?"Schedule a signing you own":"Schedule a signing"})]}),i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Nn,{onNavigate:A}),!o&&i.jsx(ni,{to:a?`/admin/orders/${n}/edit`:"/admin/schedule-order",className:"text-xs text-ne-gray underline underline-offset-4 hover:text-ne-ink","data-testid":"back-to-classic",children:"Back to classic"})]})]})}),i.jsxs("main",{className:"mx-auto max-w-7xl px-6 py-6",children:[i.jsxs("div",{className:"mb-6",children:[i.jsxs("button",{type:"button",onClick:()=>l("/admin/orders"),className:"mb-2 inline-flex items-center gap-1.5 text-xs text-ne-gray hover:text-ne-ink","data-testid":"back-to-orders",children:[i.jsx("span",{"aria-hidden":"true",children:"â"})," Back to orders"]}),i.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[i.jsx("h1",{className:"text-2xl font-bold text-ne-ink",children:a?"Edit Order":"Schedule Order"}),i.jsx("span",{className:"text-xs font-medium uppercase tracking-widest text-ne-gray/80",children:a?"Editing":"Draft"})]}),i.jsxs("p",{className:"mt-1 text-sm text-ne-gray",children:[a?"Update the signing details and save. ":"Schedule and dispatch a signing. ","Fields marked ",i.jsx("span",{className:"text-red-600",children:"*"})," are required."]})]}),L&&i.jsxs("div",{"data-testid":"draft-banner",className:"mb-4 flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-2.5",children:[i.jsxs("p",{className:"m-0 text-sm text-ne-ink",children:["You have an unsaved draft from"," ",i.jsx("span",{className:"font-semibold",children:new Date(L.savedAt).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}),". Pick up where you left off?"]}),i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx("button",{type:"button","data-testid":"draft-resume",onClick:z,className:"rounded-md bg-ne-ink px-3 py-1.5 text-xs font-semibold text-white hover:bg-ne-ink-light",children:"Resume draft"}),i.jsx("button",{type:"button","data-testid":"draft-discard",onClick:I,className:"rounded-md px-3 py-1.5 text-xs font-medium text-ne-gray hover:text-ne-ink",children:"Discard"})]})]}),i.jsx(Bt.Provider,{value:w,children:i.jsxs("div",{className:"grid gap-8 lg:grid-cols-[1fr_320px]",children:[i.jsxs("form",{className:"space-y-6 pb-[35vh]",onSubmit:y,noValidate:!0,"data-testid":"schedule-order-v2-form",children:[i.jsx(Ln,{clients:g,contactOptions:u,contactsLoadedFor:m,orderContactEmailOptions:C,signingServices:_,fees:p,config:D,errorsByField:$,onContactCreated:h,onClientCreated:x}),i.jsx(Gn,{config:D,errorsByField:$}),i.jsx(es,{config:D,errorsByField:$,hasCustomizations:s.hasCustomizations}),s.hasCustomizations&&i.jsx(ns,{errorsByField:$}),i.jsx(os,{config:D,hasCustomizations:s.hasCustomizations,onSubmit:y,isEdit:a})]}),i.jsx("aside",{className:"hidden lg:block",children:i.jsxs("div",{className:"sticky top-[4.5rem] max-h-[calc(100vh-5.5rem)] space-y-3 overflow-y-auto pb-2",children:[i.jsx("div",{className:"rounded-xl border border-ne-line bg-white p-3",children:i.jsx(fn,{activeId:N,errorSections:P,doneSections:j,hasCustomizations:s.hasCustomizations})}),i.jsx(xn,{clients:g})]})})]})})]})]})}function Js(t){const e=Y.c(8),{mode:n,prefill:r}=t,l=n===void 0?"signing_service":n,a=r===void 0?null:r;let o;e[0]!==l?(o=()=>Lt(l),e[0]=l,e[1]=o):o=e[1];const[d]=Xe.useState(o);let s;e[2]!==l||e[3]!==a?(s=i.jsx(fs,{mode:l,prefill:a}),e[2]=l,e[3]=a,e[4]=s):s=e[4];let c;return e[5]!==d||e[6]!==s?(c=i.jsx(Fi,{initialState:d,children:s}),e[5]=d,e[6]=s,e[7]=c):c=e[7],c}export{Fi as OrderFormProvider,Js as default,Q as useOrderForm};
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.