1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[14398],{10984:function(e,l,t){t.d(l,{K:function(){return f},UserContextProvider:function(){return p}});var n=t(16261),r=t(39372),a=t(29159),s=t(96043),o=t(16851),i=t.n(o),d=t(50563),c=t.n(d),u=t(78402),x=t(14500);let m=(0,x.createContext)({}),p=e=>{let{children:l}=e,t=(0,u.useRouter)(),o=(0,u.usePathname)(),[d,p]=(0,x.useState)(!1),[f,v]=(0,x.useState)(""),[h,b]=(0,x.useState)(),[g,y]=(0,x.useState)(!1),j=(e,l)=>{v(c()(e)?e.errors.message:e),p(!1),l&&l()},N=e=>{s.Xbq.get("user")&&s.Xbq.get("user").val&&b(JSON.parse(s.Xbq.get("user").val)),v(c()(e)?e.errors.message:e),p(!1)},w=e=>{if(p(!1),b(e),(0,s.Mtz)(e.isOttoTeamMember),s.Xbq.set("user",JSON.stringify(e)),o.startsWith("/auth")){let e=sessionStorage.getItem("oauth_return_url");e?(sessionStorage.removeItem("oauth_return_url"),t.push(e)):t.push("/dashboard")}},C=(0,x.useCallback)(async()=>{let e=(0,s.bWz)();return!d&&!!e&&(p(!0),r.dy.getMyprofile().then(w,N))},[g]),k=e=>{b(e),s.Xbq.set("user",JSON.stringify(e))},_=(e,l,n)=>{k(e),l&&(o.startsWith("/auth")||o.startsWith("/dashboard/onboarding"))&&((0,s.R29)(!0),t.push("/dashboard")),n&&n()},S=async(e,l,t,n)=>!d&&r.dy.updateMyProfile(e).then(e=>_(e,l,t),e=>j(e,n)),D=async(e,l,t,n)=>{let r={};if(e.firstName&&(r.firstName=e.firstName),e.lastName&&(r.lastName=e.lastName),e.legalFirstName&&(r.legalFirstName=e.legalFirstName),e.legalLastName&&(r.legalLastName=e.legalLastName),e.legal_address&&(r.legal_address=e.legal_address),e.mailing_address&&(r.mailing_address=e.mailing_address),e.phone&&(r.phone=e.phone,r.country_code=e.country_code),e.dob&&(r.dob=e.dob),e.photo&&(r.photo=e.photo),e.onboarding_completed&&(r.onboarding_completed=e.onboarding_completed),e.tax_id&&
1(r.tax_id=e.tax_id),e.tax_residence_country&&(r.tax_residence_country=e.tax_residence_country),!i()(r))return S(r,l,t,n)},z=async e=>D({photo:e}),I=async()=>D({photo:{}});return(0,x.useEffect)(()=>{(0,a.a3)()&&a.bw.DemoEnvToken&&(s.Xbq.remove("user"),(0,s.uBJ)(a.bw.DemoEnvToken),(0,s.R29)(!0))},[]),(0,x.useEffect)(()=>{i()(h)&&(s.Xbq.get("user")&&s.Xbq.get("user").val?b(JSON.parse(s.Xbq.get("user").val)):(y(!0),C()))},[]),(0,n.jsx)(m.Provider,{value:{loading:d,error:f,userData:h,isUserLoggedIn:!i()(h)&&!!(0,s.bWz)(),refetchUserData:g,setUserData:b,refreshUser:C,setRefetchUserData:y,updateUserLocalData:k,updateUserPhoto:z,removeUserPhoto:I,updateUserData:D},children:l})},f=()=>(0,x.useContext)(m)},5541:function(e,l,t){t.d(l,{OX:function(){return em},i3:function(){return ep},VS:function(){return G},z7:function(){return z},sm:function(){return ew},DZ:function(){return Q},Aq:function(){return eC},kx:function(){return y},m8:function(){return j},xG:function(){return h},sQ:function(){return p},kn:function(){return ea},sw:function(){return el},n:function(){return g},C:function(){return eS},Hm:function(){return eu},n0:function(){return ez},Ln:function(){return eI},qE:function(){return eR},fn:function(){return ec},ME:function(){return H},Fu:function(){return eE},PF:function(){return eL},IS:function(){return eF},IJ:function(){return eJ},VA:function(){return eo},Xl:function(){return es},D1:function(){return n.D1c},JW:function(){return eM},Rk:function(){return eD},S8:function(){return ex},Tf:function(){return x.TfF},g$:function(){return a},Wp:function(){return s},bu:function(){return o},O4:function(){return function e(l,t){if(!l)return null;let{shape:n}=l,r={};if(!n)return r;for(let l of Object.keys(n)){let d=n[l];if("ZodObject"===s(d)){let n=e(a(d),null==t?void 0:t[l]);if(null!==n)for(let e of Object.keys(n))r["".concat(l,".").concat(e)]=n[e]}else{var o,i;let e=function e(l){return"ZodDefault"===l._def.typeName?l._def.defaultValue():"innerType"in l._def?e(l._def.innerType):"schema"in l._def?e(l._def.schema):void 0}(d);(null===e||""===e)&&(null==t?void 0:null===(o=t[l])||void 0===o?void 0:o.inputProps)&&(e=(null==t?void 0:null===(i=t[l])||void 0===i?void 0:i.inputProps).defaultValue),void 0!==e&&(r[l]=e)}}return r}},xb:function(){return function e(l){return(null==l?void 0:l._def.typeName)==="ZodEffects"?e(l._def.schema):l}},av:function(){return function e(l){if("ZodEffects"===l._def.typeName)return e(l._def.schema);if(["ZodOptional","ZodNullable"].includes(l._def.typeName))return{...e(l._def.innerType),required:!1};if(!("checks"in l._def))return{required:!0};let{checks:t}=l._def,n={required:!0},r=s(l);for(let e of t)"min"===e.kind&&("ZodString"===r?n.minLength=e.value:n.min=e.value),"max"===e.kind&&("ZodString"===r?n.maxLength=e.value:n.max=e.value);return n}}});var n=t(49630),r=t(60165);function a(e){return e?"innerType"in e._def?a(e._def.innerType):"schema"in e._def?a(e._def.schema):e:null}function s(e){let l=a(e);return l?l._def.typeName:""}function o(e,l){if("object"!=typeof l||null===l||!(e instanceof r.Iy))return;let t=l[e.discriminator];return e.optionsMap.get(t)}let i={senderType:n.uCS,types_of_income:{W2:"W2",Consulting:"Consulting","Brand Deals":"Brand Deals",Royalties:"Royalties",Other:"Other"},retirement_savings_accounts:{"SEP IRA":"SEP IRA","Solo 401k":"Solo 401k","Roth IRA":"Roth IRA","High Yield Savings Account":"High Yield Savings Account","Life Insurance":"Life Insurance"},communication_preferences:{Text:"Text",Email:"Email",Call:"Call"},filingStatus:{SINGLE:"Single or Married filing separately",MARRIED_JOINTLY:"Married filing jointly",HEAD_OF_HOUSEHOLD:"Head of household"},multipleJobsOption:{USE_ESTIMATOR:"Use the IRS Tax Withholding Estimator at www.irs.gov/W4App for the most accurate withholding",USE_WORKSHEET:"Use the Multiple Jobs Worksheet on page 3 and enter the result in Step 4(c)",TWO_JOBS_ONLY:"If there are only two jobs total, check this box (do the same on Form W-4 for the other job)"}};function d(e){let l=String(e).split(".").pop();return i[l]?Object.values(i[l]):[]}var c=t(16261),u=t(71785),x=t(96043),m=t(4919),p=function(e){let{label:l,isRequired:t,tooltip:n,className:r}=e;return(0,c.jsxs)(u.lX,{className:(0,x.cn)(null!=r?r:"text-xs md:text-sm font-normal leading-4 md:leading-5"),children:[(0,c.jsxs)("div",{className:"flex gap-1",children:[(0,c.jsx)("div",{dangerouslySetInnerHTML:{__html:l}}),t&&(0,c.jsx)("span",{className:(0,x.cn)(null!=r?r:" text-xs md:text-sm font-normal"),children:"*"})]}),n&&(0,c.jsx)(m.e_,{description:n,contentClassName:"max-w-md"})]})},f=function(e){let{fieldConfigItem:l}=e;return(0,c.jsx)(c.Fragment,{children:(null==l?void 0:l.description)&&(0,c.jsx)("p",{className:"whitespace-break-spaces leading-[20px] font-[400] text-primary-grey-400 text-xs dar
1k:text-white",children:null==l?void 0:l.description})})};let v=e=>{var l;let t=e.toLowerCase(),n=null!==(l=t.split(".").pop())&&void 0!==l?l:t;return n.includes("ssn")?x.KYD.ssn:"ein"===n||n.startsWith("ein_")||n.endsWith("_ein")?x.KYD.ein:x.KYD[e]};function h(e){var l;let{label:t,isRequired:n,fieldConfigItem:r,fieldProps:a}=e,{showLabel:s,className:o,wrapperClassName:i,...d}=a,m=null!==(l=v(a.name))&&void 0!==l?l:{},h=a.type||"text",b=(0,x.YZY)(a.value);return(0,c.jsxs)("div",{className:(0,x.cn)("flex flex-col items-start gap-[6px] w-full",i),children:[(0,c.jsxs)(u.xJ,{className:"flex w-full gap-[6px] flex-col justify-start",children:[(void 0===s||s)&&(0,c.jsx)(p,{label:(null==r?void 0:r.label)||t,tooltip:null==r?void 0:r.tooltip,isRequired:n,className:(0,x.cn)(a.labelclass)}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.II,{type:h,...d,className:o,outerClassName:(0,x.cn)({"!border-[#d0327538]":!!a.error,"focus-within:!border-[#f093c0] focus-within:!border-b-[#d03275] focus-within:!border-b-[2px]":!!a.error}),onChange:e=>{var l;let t=null===(l=e.target)||void 0===l?void 0:l.value;m.unformat?a.onChange(m.unformat(t)):"email"===h?a.onChange(t.toLowerCase()):d.transformValue?a.onChange(d.transformValue(t)):a.onChange(e)},onKeyDown:"email"===h?e=>{" "===e.key&&e.preventDefault()}:null==d?void 0:d.onKeyDown,value:m.format&&a.value?m.format(a.value):a.value})}),(0,c.jsx)(f,{fieldConfigItem:r}),a.error?(0,c.jsx)(u.zG,{children:a.error}):(0,c.jsx)(u.zG,{})]}),a.name.endsWith("email")&&b&&(0,c.jsxs)(u.zx,{variant:"ghost",onClick:e=>{e.preventDefault(),a.onChange(b)},className:"hover:!bg-transparent mr-auto pl-0 !ml-0",children:["Did you mean\xa0",(0,c.jsx)("span",{className:"text-background-primary",children:b}),"?"]})]})}var b=function(e){let{notes:l,className:t}=e;return(0,c.jsxs)("div",{className:(0,x.cn)("text-[10px] md:text-xs text-primary-grey-400 leading-relaxed",t),children:[(0,c.jsx)("span",{className:"font-medium",children:"Note:"})," ",l]})};function g(e){var l,t,n;let{label:r,isRequired:a,fieldConfigItem:s,fieldProps:o}=e,{showLabel:i,...d}=o;return o.name.endsWith("country_code")?null:(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-2",children:[(void 0===i||i)&&(0,c.jsx)(p,{label:(null==s?void 0:s.label)||r,tooltip:null==s?void 0:s.tooltip,isRequired:a,className:o.labelclass}),(null==s?void 0:null===(l=s.inputProps)||void 0===l?void 0:l.note)&&(0,c.jsx)(b,{notes:(null==s?void 0:null===(t=s.inputProps)||void 0===t?void 0:t.note)||"",className:"mt-1 mb-2"}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.II,{startIcon:null==s?void 0:null===(n=s.inputProps)||void 0===n?void 0:n.startIcon,placeholder:(null==s?void 0:s.placeholder)||"",type:"number",...d})}),(0,c.jsx)(f,{fieldConfigItem:s}),o.error?(0,c.jsx)(u.zG,{children:o.error}):(0,c.jsx)(u.zG,{})]})}function y(e){let{label:l,isRequired:t,field:n,zodItem:r,fieldProps:a,fieldConfigItem:s}=e;return null}function j(e){let{label:l,isRequired:t,field:n,zodItem:r,fieldProps:a,fieldConfigItem:s}=e;return(0,c.jsx)("input",{type:"hidden",...a,...n,tabIndex:-1,"aria-hidden":"true",autoComplete:"off",className:"hidden"})}var N=t(82874),w=t(56067),C=t(34515),k=t(12729),_=t(56645),S=t(14500),D=t(89687);function z(e){let{label:l,isRequired:t,field:n,fieldConfigItem:r,fieldProps:a,titleDisabled:s}=e,[o,i]=(0,S.useState)(!1),[d,m]=(0,S.useState)(!1),v=(0,S.useRef)(),h=(0,S.useRef)(null),b=e=>{let l=new Date(e);return l.setHours(12,0,0,0),l};(0,S.useEffect)(()=>{let e=e=>{v.current&&!v.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);let g=(0,S.useCallback)(()=>{if(!o&&h.current){let e=h.current.getBoundingClientRect();m(window.innerHeight-e.bottom<350)}i(e=>!e)},[o]);return(0,c.jsxs)(u.xJ,{className:"flex w-full gap-[6px] flex-col justify-start",ref:v,children:[(0,c.jsx)(p,{label:(null==r?void 0:r.label)||l,tooltip:null==r?void 0:r.tooltip,isRequired:t,className:a.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)("div",{ref:h,className:(0,x.cn)("border border-input px-[10px] py-2 rounded-md cursor-pointer text-sm min-h-10",{"!border-b-[2px] !border-b-[#233ed6] !rounded-es-[2px] !rounded-ee-[2px]":o}),onClick:g,children:(()=>{let e="string"==typeof(null==n?void 0:n.value)?(0,N.D)(n.value):null==n?void 0:n.value;return(0,k.J)(e)?(0,_.WU)(e,"MM/dd/yyyy"):(0,c.jsx)("span",{className:"text-muted",children:"MM/DD/YYYY"})})()}),o&&(0,c.jsx)("div",{className:(0,x.cn)("absolute left-0 z-50 bg-white border border-input shadow-lg rounded-md p-2",d?"bottom-full mb-2":"top-full mt-2"),children:(0,c.jsx)(D._,{mode:"single",onMonthChange:e=>{let l=n.value instanceof Date?n.value:n.value?(0,N.D)(n.value):new Date,t=(0,w.q)(l,e.getMonth());t=(0,C.M)(l,e.getFullYear()),n.onChange(t)}
1,selected:n.value,formatters:"MM/dd/yyyy",onSelect:e=>{if(e){let l=b(e);n.onChange(l)}i(!1)},showOutsideDays:!0,fixedWeeks:!0,captionLayout:"dropdown",fromYear:(null==a?void 0:a.allowFutureDatesOnly)?x.zsK:1900,toYear:(null==a?void 0:a.allowFutureDatesOnly)?2050:x.zsK,value:n.value,styles:{caption:{fontWeight:400,fontSize:"0.875rem"},dropdown:{fontSize:"0.875rem"},day:{fontSize:"0.75rem"},day_selected:{backgroundColor:"#233ed6",color:"white"}},modifiersStyles:{today:{color:"inherit",fontWeight:700}},...a,disabled:(null==a?void 0:a.disableFutureDates)?{after:new Date}:(null==a?void 0:a.allowFutureDatesOnly)?{before:new Date}:void 0})})]})}),(0,c.jsx)(f,{fieldConfigItem:r}),a.error?(0,c.jsx)(u.zG,{children:a.error}):(0,c.jsx)(u.zG,{})]})}t(64775);var I=t(72770),R=t(28958),E=t.n(R),F=t(81783),P=t.n(F),O=t(16851),J=t.n(O),L=t(52789),A=t(34756),M=t(75925);let q=e=>{let{key:l,...t}=e;return(0,S.createElement)(A.c.DropdownIndicator,{...t,key:l},(0,c.jsx)(I.ZP,{icon:"Calendar",size:20,color:"#AEB3BD"}))};function G(e){var l,t,n;let{label:r,isRequired:a,field:s,fieldConfigItem:o,fieldProps:i,allowPastDates:d}=e,m=(0,S.useRef)(),f=(0,S.useRef)(null),[v,h]=(0,S.useState)(null),[b,g]=(0,S.useState)(),[y,j]=(0,S.useState)(!1),[N,w]=(0,S.useState)(),[C,k]=(0,S.useState)({x:0,y:0}),_=(0,S.useRef)(null),[z,I]=(0,S.useState)(),{labelclass:R,getOptions:F,disabled:O,...A}=i,G=F?F(N):[],W=G.filter(e=>e.value!==(null==N?void 0:N.value)),Y=e=>{let l=(0,x.IR2)(e),t=E()(G,e=>e.label===l.label);return J()(t)&&w(l),l};return(0,S.useEffect)(()=>{let e=e=>{let l=e.target;m.current&&m.current.contains(l)||f.current&&f.current.contains(l)||j(!1)};return I(s.value),document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[s.value]),(0,S.useEffect)(()=>{var e,l;if(!J()(v)&&(null==o?void 0:null===(e=o.inputProps)||void 0===e?void 0:e.onChange))return null==o?void 0:null===(l=o.inputProps)||void 0===l?void 0:l.onChange(v.value)},[v]),(0,S.useEffect)(()=>{let e="string"==typeof s.value?new Date(s.value):s.value;if(P()(e)&&!isNaN(e.getTime())){let l=Y(e);(null==v?void 0:v.value)!==l.value&&h(l)}else h(null)},[s.value]),(0,S.useEffect)(()=>{if(y&&(null==_?void 0:_.current)){let e=_.current.getBoundingClientRect(),l=window.scrollY||document.documentElement.scrollTop,t=window.scrollX||document.documentElement.scrollLeft,n=e.top>.6*window.innerHeight?e.top+l-360:e.bottom+l;k({x:e.left+t,y:n})}},[y]),(0,S.useEffect)(()=>{if(_.current){let e=_.current;(0,x.N7o)(e)?g("top"):g("auto")}},[]),(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-[6px] w-full",ref:m,children:[(0,c.jsx)(p,{label:(null==o?void 0:o.label)||r,tooltip:null==o?void 0:o.tooltip,isRequired:a,className:R}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)("div",{className:"relative flex flex-col w-full",ref:_,children:[(0,c.jsx)(M.ZP,{className:"w-full",options:W,onChange:e=>{(null==e?void 0:e.value)==="custom"?(h(v||null),j(!0)):0===G.length?j(!0):(h(e),s.onChange(e.value))},onMenuOpen:()=>{0===G.length&&j(!0)},placeholder:"Select "+(null!==(t=null==o?void 0:o.label)&&void 0!==t?t:r).toLowerCase(),styles:x.P7n,value:v,name:s.name,classNames:{control:e=>(0,x.cn)("!w-full h-10",{"!shadow-[0_0_0_#233ed6] !border-b-[1px] !border-b-[#233ed6] !rounded-es-[2px] !rounded-ee-[2px] !border-primary-grey-200":e.isFocused,"!border-grey":!e.isFocused})},isDisabled:y,isSearchable:!1,components:{DropdownIndicator:q},menuPlacement:b}),y&&(0,L.createPortal)((0,c.jsx)("div",{ref:f,className:(0,x.cn)("absolute z-50 bg-white border rounded-t-none rounded-b-md border-primary-grey-200 overflow-x-auto","min-w-[335px] w-full"),style:{top:C.y,left:C.x,pointerEvents:"auto",width:null!==(n=null===(l=_.current)||void 0===l?void 0:l.offsetWidth)&&void 0!==n?n:"100%"},children:(0,S.createElement)(D._,{className:"text-xs font-normal",classNames:{months:"flex justify-center",caption_label:"text-sm pl-3 ",caption:"flex justify-between items-center font-semibold",button_previous:"w-4 h-4",button_next:"w-4 h-4"},styles:{caption:{fontSize:"0.85rem"},button_previous:{scale:"0.85"},button_next:{scale:"0.85"},cell:{width:"36px",height:"36px"},day:{fontSize:"12px",width:"40px",height:"40px"}},mode:"single",month:z,onMonthChange:I,selected:s.value,onSelect:e=>{if(j(!1),!P()(e))return;let l=Y(e);h(l),s.onChange(new Date(l.value))},showOutsideDays:!0,fixedWeeks:!0,captionLayout:"dropdown-buttons",fromYear:2010,disabled:(null==i?void 0:i.allowPastDates)?void 0:{before:new Date},...A,key:A.key})}),document.body)]})}),(0,c.jsx)(u.zG,{})]})}var W=t(90401),Y=t(66106);let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Z(e){let{selectedYear:l,selectedMonth:t,disableFutureDates:n,allowFutureDatesOnly:r,onSelect:a}=e,s=new Date().getMonth(),o=e=>n&&l===x.zsK?e>s:r&&l===x.zsK?e<s:!!n&&l>x.zsK||!!r&&l<x.zsK;return(0,c.jsx)("div",{className:"w-[280px]",children:(0,c.jsx)("div",{className:"grid grid-cols-3 gap-1.5",children:T.map((e,l)=>{let n=o(l);return(0,c.jsx)(u.zx,{variant:"ghost",type:"button",onClick:()=>!n&&a(l),disabled:n,"aria-label":e,className:(0,x.cn)("text-sm py-3 rounded-md transition-colors hover:bg-primary-grey-100",l===t&&"bg-primary-blue-700 text-white hover:bg-primary-blue-700",n&&"opacity-40 pointer-events-none"),children:e},e)})})})}function U(e){let{title:l,onBack:t}=e;return(0,c.jsxs)("div",{className:"flex items-center gap-2 py-2 px-1 border-b border-input mb-2",children:[t&&(0,c.jsx)(u.zx,{type:"button",variant:"ghost",size:"sm",isIconOnly:!0,startIcon:"ChevronLeft",iconSize:16,onClick:t,"aria-label":"Go back",className:"p-0.5 rounded-md hover:bg-primary-grey-100"}),(0,c.jsx)("span",{className:"text-sm font-medium",children:l})]})}function V(e){let{fromYear:l,toYear:t,selectedYear:n,onSelect:r}=e,a=(0,S.useMemo)(()=>{let e=[];for(let n=t;n>=l;n--)e.push(n);return e},[l,t]),s=Math.ceil(a.length/20),[o,i]=(0,S.useState)(()=>
1{if(void 0!==n){let e=a.indexOf(n);if(e>=0)return Math.floor(e/20)}return 0}),d=a.slice(20*o,(o+1)*20),m=d[d.length-1],p=d[0];return(0,c.jsxs)("div",{className:"w-[280px]",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between mb-3 px-1",children:[(0,c.jsx)(u.zx,{variant:"ghost",type:"button",onClick:()=>i(e=>e+1),disabled:o>=s-1,className:"p-1 rounded-md hover:bg-primary-grey-100 transition-colors disabled:opacity-30 disabled:pointer-events-none","aria-label":"Newer years",startIcon:"ArrowLeft"}),(0,c.jsxs)("span",{className:"text-sm font-medium",children:[p," - ",m]}),(0,c.jsx)(u.zx,{variant:"ghost",type:"button",startIcon:"ArrowRight",onClick:()=>i(e=>e-1),disabled:0===o,className:"p-1 rounded-md hover:bg-primary-grey-100 transition-colors disabled:opacity-30 disabled:pointer-events-none","aria-label":"Older years"})]}),(0,c.jsx)("div",{className:"grid grid-cols-4 gap-1.5",children:d.map(e=>(0,c.jsx)(u.zx,{variant:"ghost",type:"button",onClick:()=>r(e),"aria-label":String(e),className:(0,x.cn)("text-sm py-2 rounded-md transition-colors hover:bg-primary-grey-100",e===n&&"bg-primary-blue-700 text-white hover:bg-primary-blue-700",e===t&&e!==n&&"ring-1 ring-primary-blue-700"),children:e},e))})]})}let X=["January","February","March","April","May","June","July","August","September","October","November","December"];function B(e){let{value:l,onChange:t,onComplete:n,fromYear:r=1900,toYear:a=x.zsK,disableFutureDates:s,allowFutureDatesOnly:o}=e,i=l instanceof Date&&(0,k.J)(l),[d,m]=(0,S.useState)("year"),[p,f]=(0,S.useState)(i?(0,W.S)(l):void 0),[v,h]=(0,S.useState)(i?(0,Y.j)(l):void 0);if("year"===d)return(0,c.jsxs)("div",{children:[(0,c.jsx)(U,{title:"Select Year"}),(0,c.jsx)(V,{fromYear:r,toYear:a,selectedYear:p,onSelect:e=>{f(e),m("month")}})]});if("month"===d)return(0,c.jsxs)("div",{children:[(0,c.jsx)(U,{title:String(p),onBack:()=>{m("year")}}),(0,c.jsx)(Z,{selectedYear:p,selectedMonth:v,disableFutureDates:s,allowFutureDatesOnly:o,onSelect:e=>{h(e),m("day")}})]});let b=new Date(p,v,1);return(0,c.jsxs)("div",{children:[(0,c.jsx)(U,{title:"".concat(X[v]," ").concat(p),onBack:()=>{m("month")}}),(0,c.jsx)(u.f,{mode:"single",month:b,onMonthChange:()=>{},selected:i?l:void 0,onSelect:e=>{e&&(t(e),null==n||n())},showOutsideDays:!1,fixedWeeks:!0,classNames:{nav:"hidden",month_caption:"hidden",weekday:"text-xs font-semibold text-muted-foreground w-9",day:"p-0",day_button:"h-9 w-9 text-sm font-medium rounded-full transition-colors hover:bg-none aria-selected:opacity-100",selected:"bg-[#233ed6] text-white hover:bg-none hover:text-white focus:bg-[#233ed6] focu
1s:text-white rounded-full ",today:"[&>button]:border [&>button]:border-[#233ed6] [&>button]:text-[#233ed6] [&>button]:font-semibold",disabled:"opacity-40 pointer-events-none",outside:"opacity-0 pointer-events-none"},disabled:s?{after:new Date}:o?{before:new Date}:void 0})]})}function H(e){let{label:l,isRequired:t,field:n,fieldConfigItem:r,fieldProps:a}=e,[s,o]=(0,S.useState)(!1),i=e=>{let l=new Date(e);return l.setHours(12,0,0,0),l},d="string"==typeof(null==n?void 0:n.value)?(0,N.D)(n.value):null==n?void 0:n.value,m=(0,k.J)(d)?(0,_.WU)(d,"MM/dd/yyyy"):null;return(0,c.jsxs)(u.xJ,{className:"flex w-full gap-[6px] flex-col justify-start",children:[(0,c.jsx)(p,{label:(null==r?void 0:r.label)||l,tooltip:null==r?void 0:r.tooltip,isRequired:t,className:a.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)(u.J2,{open:s,onOpenChange:o,children:[(0,c.jsx)(u.xo,{asChild:!0,children:(0,c.jsx)("div",{className:(0,x.cn)("border border-input px-[10px] py-2 rounded-md cursor-pointer text-sm min-h-10 flex items-center",{"!border-b-[2px] !border-b-primary-blue-700 !rounded-es-[2px] !rounded-ee-[2px]":s}),children:null!=m?m:(0,c.jsx)("span",{className:"text-muted",children:(null==a?void 0:a.placeholder)||"MM/DD/YYYY"})})}),(0,c.jsx)(u.yk,{className:"w-auto p-3 z-[200]",align:"start",sideOffset:4,children:(0,c.jsx)(B,{value:(0,k.J)(d)?d:void 0,onChange:e=>{n.onChange(i(e))},onComplete:()=>o(!1),fromYear:(null==a?void 0:a.allowFutureDatesOnly)?x.zsK:1900,toYear:(null==a?void 0:a.allowFutureDatesOnly)?2050:x.zsK,disableFutureDates:null==a?void 0:a.disableFutureDates,allowFutureDatesOnly:null==a?void 0:a.allowFutureDatesOnly})})]})}),(0,c.jsx)(f,{fieldConfigItem:r}),a.error?(0,c.jsx)(u.zG,{children:a.error}):(0,c.jsx)(u.zG,{})]})}var K=t(84685);function Q(e){var l,t,n,r,s,o,i,v,h,g,y,j;let{label:N,isRequired:w,field:C,fieldConfigItem:k,zodItem:_,fieldProps:D}=e,z=(0,K.Gc)(),[I,R]=(0,S.useState)((0,x.mfJ)()),[E,F]=(0,S.useState)((0,x.Sjs)()),[P,O]=(0,S.useState)(C.value?x.eWP.find(e=>e.value===C.value):void 0),J=null==z?void 0:z.watch("tax_residence_country"),L=null==z?void 0:z.watch("issuing_country"),A=[],M=[];if("state_of_incorporation"===C.name){let e=J||(0,x.mfJ)(),l=(0,x.oTR)(e),t=l;if("US"===e){let e=["Delaware","Wyoming","California","New York"],n=new Set(e);t=[...e,...l.filter(e=>!n.has(e))]}A=t}else if("issuing_state"===C.name&&L){let e=L||(0,x.mfJ)(),l=(0,x.oTR)(e),t=l;if("US"===e){let e=["Delaware","Wyoming","California","New York"],n=new Set(e);t=[...e,...l.filter(e=>!n.has(e))]}A=t}else(null==k?void 0:null===(l=k.inputProps)||void 0===l?void 0:l.options)?M=k.inputProps.options.map(e=>[e.value,e.label||e.value]):A=_?null!==(t=a(_)._def.values)&&void 0!==t?t:d(C.name):[];if(0===M.length&&(M=Array.isArray(A)?A.map(e=>[e,e]):Object.entries(A)),(0,S.useEffect)(()=>{"tax_classification"!==C.name||P||O(C.value?x.eWP.find(e=>e.value===C.value):void 0)},[C.value]),(0,S.useEffect)(()=>{if(I){var e;F(null===(e=x.ofk.find(e=>e.value===I))||void 0===e?void 0:e.label)}},[I]),"tax_classification"===C.name)return(0,c.jsxs)(u.xJ,{className:"flex flex-col",children:[(0,c.jsx)(p,{label:(null==k?void 0:k.label)||N,tooltip:null==k?void 0:k.tooltip,isRequired:w,className:D.labelclass}),(null==k?void 0:null===(n=k.inputProps)||void 0===n?void 0:n.note)&&(0,c.jsx)(b,{notes:(null==k?void 0:null===(r=k.inputProps)||void 0===r?void 0:r.note)||"",className:"mt-1 mb-2"}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(m.JV,{name:"Tax Classification",isSearchable:!0,placeholder:"Select Tax Classification",onChange:e=>{e&&(C.onChange(e.value),O(e))},value:P,options:x.eWP})}),(0,c.jsx)(f,{fieldConfigItem:k}),D.error?(0,c.jsx)(u.zG,{children:D.error}):(0,c.jsx)(u.zG,{})]});if(C.name.endsWith("address.country")||"tax_residence_country"===C.name||"issuing_country"===C.name)return(0,c.jsxs)(u.xJ,{className:"flex flex-col",children:[(0,c.jsx)(p,{label:(null==k?void 0:k.label)||N,tooltip:null==k?void 0:k.tooltip,isRequired:w,className:D.labelclass}),(null==k?void 0:null===(s=k.inputProps)||void 0===s?void 0:s.note)&&(0,c.jsx)(b,{notes:(null==k?void 0:null===(o=k.inputProps)||void 0===o?void 0:o.note)||"",className:"mt-1 mb-2"}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(m.JV,{name:"country",isSearchable:!0,placeholder:(null==k?void 0:null===(i=k.inputProps)||void 0===i?void 0:i.placeholder)||"Select Country",onChange:e=>{e&&(R(e.value),C.onChange(e.value),F(e.label))},value:{value:I,label:E},options:x.ofk})}),(0,c.jsx)(f,{fieldConfigItem:k}),D.error?(0,c.jsx)(u.zG,{children:D.error}):(0,c.jsx)(u.zG,{})]});if(M){let e=["business_industry","state_of_incorporation","issuing_state"].includes(C.name);return(0,c.jsxs)(u.xJ,{className:"flex flex-col w-full",children:[(0,c.jsx)(p,{label:(null==k?void 0:k.label)||N,tooltip:null==k?void 0:k.tooltip,isRequired:w,className:D.labelclass}),(null==k?void 0:null===(v=k.inputProps)||void 0===v?void 0:v.note)&&(0,c.jsx)(b,{notes:(null==k?void 0:null===(h=k.inputProps)||void 0===h?void 0:h.note)||"",className:"mt-1 mb-2"}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)(u.OC,{onValueChange:e=>{""!==e&&null!==e&&C.onChange(e)},value:C.value,...D,children:[(0,c.jsx)(u.i4,{className:D.className,children:(0,c.jsx)(u.ki,{placeholder:null==k?void 0:null===(g=k.inputProps)||void 0===g?void 0:g.placeholder,children:C.value?null===(j=C.value,y=M.find(e=>e[0]===j))||void 0===y?void 0:y[1]:"Select an option"})}),(0,c.jsxs)(u.Bw,{className:"overflow-visible",children:[e&&(0,c.jsx)("div",{role:"presentation","aria-label":"Recommended options",className:"px-6 py-2 text-sm font-semibold text-primary-grey-400 ",children:"Recommended"}),M.map((e,l)=>{var t;let[n,r]=e,a="overflow-visible flex gap-2";("business_industry"===C.name||"state_of_incorporation"===C.name||"issuing_state"===C.name)&&3===l&&(a+="border-b border-gray-200 pb-2 mb-2");let s=null==k?void 0:null===(t=k.inputProps)||void 0===t?void 0:t.optionDescriptions,o=s?s[r]:null;return(0,c.jsx)(u.Ql,{value:n,className:a,children:(0,c.jsxs)("div",{className:"flex flex-col",children:[(0,c.jsx)("span",{children:r}),o&&(0,c.jsx)("span",{className:"text-xs text-primary-grey-500",children:o})]})},n)})]})]})}),(0,c.jsx)(f,{fieldConfigItem:k}),!!D.error&&(0,c.jsx)(u.zG,{children:D.error})]})}}var $=t(60329),ee=t.n($);function el(e){var l,t,n,r;let{label:a,isRequired:s,field:o,fieldConfigItem:i,fieldProps:d}=e,[f,v]=(0,S.useState)(!1),[h,b]=(0,S.useState)([]),g=null!==(r=null==i?void 0:null===(t=i.inputProps)||void 0===t?void 0:null===(l=t.options)||void 0===l?void 0:l.map(e=>({value:e.value,label:e.label})))&&void 0!==r?r:[],y=e=>{let l;b(l=h.some(l=>l.value===e.value)?h.filter(l=>l.value!==e.value):[...h,e]),o.onChange(l.map(e=>e.value))},j=e=>h.some(l=>l.value===e.value);return(0,S.useEffect)(()=>{ee()(o.value)?b(g.filter(e=>o.value.includes(e.value))):b([])},[o.value]),(0,c.jsxs)(u.xJ,{className:"flex gap-[6px] w-full flex-col justify-start",children:[(0,c.jsx)(p,{isRequired:s,label:(null==i?void 0:i.label)||a,tooltip:null==i?void 0:i.tooltip,className:(0,x.cn)(d.labelclass)}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)(u.h_,{open:f,onOpenChange:v,children:[(0,c.jsx)(u.$F,{asChild:!0,children:(0,c.jsxs)("div",{className:(0,x.cn)("flex gap-2 border border-primary-grey-200 rounded-[8px] w-full items-center justify-between cursor-pointer",{"border-b-2 border-b-primary-blue-700":f}),children:[(0,c.jsx)("div",{className:"flex flex-wrap px-[10px] py-2",children:h.length>
10?(0,c.jsx)(m.L_,{className:"p-0 md:min-h-5 min-h-4",options:h.map(e=>e.label),handleDeleteOption:e=>{let l=h.filter((l,t)=>t!==e);b(l),o.onChange(l.map(e=>e.value))}}):(0,c.jsx)("span",{className:"text-primary-grey-400 text-xs font-normal md:text-sm",children:(null==i?void 0:null===(n=i.inputProps)||void 0===n?void 0:n.placeholder)||"Select options"})}),(0,c.jsx)("div",{className:"w-8",children:(0,c.jsx)(I.ZP,{icon:"ChevronDown",color:"#818898",size:24})})]})}),(0,c.jsx)(u.cq,{children:(0,c.jsx)(u.AW,{className:"p-0 border-primary-grey-200 w-[var(--radix-popper-anchor-width)] z-[200]",align:"start",sideOffset:0,onInteractOutside:()=>v(!1),children:0!==g.length&&(0,c.jsx)(u.Qk,{className:"flex flex-col max-h-72 p-2 min-h-40 overflow-y-scroll",children:g.map((e,l)=>(0,c.jsxs)(u.Xi,{className:"cursor-pointer flex items-center text-primary-grey-900 px-[10px] py-2 w-full hover:bg-accent rounded-sm",onSelect:e=>{e.preventDefault()},onPointerDown:e=>{e.preventDefault()},onPointerUp:()=>{y(e)},children:[(0,c.jsx)(u.XZ,{checked:j(e),className:"border-primary-grey-400 h-5 w-5 rounded-[4px] data-[state=checked]:bg-[#465AD1] data-[state=checked]:text-primary-foreground"}),(0,c.jsx)("span",{className:"ml-2 text-xs font-normal md:text-sm",children:e.label})]},l))})})})]})}),(0,c.jsx)(u.zG,{})]})}var et=t(53318),en=t.n(et);let er=e=>{let{value:l,field:t}=e,n="checkbox-".concat(l),r=Array.isArray(t.value)&&t.value.includes(l);return(0,c.jsx)("label",{htmlFor:n,className:(0,x.cn)("block cursor-pointer","transition-all duration-300"),children:(0,c.jsx)("div",{className:(0,x.cn)("flex items-center px-4 py-[10px] rounded-md","hover:bg-[#F5F9FF]",r?"shadow-[0_0_0_1px_rgba(154,196,255,0.4)] border border-[#C0DCFF] bg-[#F5F9FF]":"bg-white border border-[#eceffc]"),children:(0,c.jsxs)(u.xJ,{className:"m-0 p-0 space-y-0 flex items-center gap-2",children:[(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.XZ,{id:n,checked:r,onCheckedChange:e=>{let n=Array.isArray(t.value)?t.value:[];e?t.onChange([...n,l]):t.onChange(n.filter(e=>e!==l))},icon:(0,c.jsx)(I.ZP,{icon:"Check",className:"h-[14px] w-[14px]"}),className:"border-gray-400 h-5 w-5 data-[state=checked]:bg-[#233ed9] data-[state=checked]:!text-background-primary-light !text-background-primary-light"})}),(0,c.jsx)(u.lX,{className:"font-normal text-sm leading-4 cursor-pointer",htmlFor:n,children:en()(l)})]})})})};function ea(e){var l,t,n;let r,{label:s,isRequired:o,field:i,zodItem:x,fieldProps:m,fieldConfigItem:v}=e,h=a(x);if((null==h?void 0:null===(l=h._def)||void 0===l?void 0:l.typeName)==="ZodArray"){let e=h._def.type;(null==e?void 0:null===(t=e._def)||void 0===t?void 0:t.values)&&(r=e._def.values)}else r=null==h?void 0:null===(n=h._def)||void 0===n?void 0:n.values;r||(r=d(m.name));let b=[];return b=Array.isArray(r)?r:Object.entries(r).map(e=>e[0]),(0,c.jsxs)("div",{children:[(0,c.jsxs)(u.xJ,{className:"flex flex-col justify-start",children:[(0,c.jsx)(p,{label:(null==v?void 0:v.label)||s,tooltip:null==v?void 0:v.tooltip,isRequired:o,className:m.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsx)("div",{className:"space-y-2",children:null==b?void 0:b.map(e=>(0,c.jsx)(er,{value:e,field:i},e))})}),m.error?(0,c.jsx)(u.zG,{children:m.error}):(0,c.jsx)(u.zG,{})]}),(0,c.jsx)(f,{fieldConfigItem:v})]})}var es=e=>{var l;let{field:t,fieldConfigItem:n,fieldProps:r}=e,a=(null==n?void 0:n.variant)==="card",s=null==n?void 0:n.title;return a?(0,c.jsx)("div",{className:"border border-primary-grey-200 rounded-lg p-4 bg-primary-grey-50",children:(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-2 space-y-0",children:[(0,c.jsxs)("div",{className:"flex flex-row items-center gap-3",children:[(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.XZ,{checked:t.value,onCheckedChange:e=>{t.onChange(e)},icon:(0,c.jsx)(I.ZP,{icon:"Check",className:"h-[14px] w-[14px]"}),className:"border-gray-400 h-5 w-5 data-[state=checked]:bg-[#233ed9] data-[state=checked]:!text-background-primary-light !text-background-primary-light mt-1",disabled:!!(null==n?void 0:n.disabled)||(null==r?void 0:r.disabled)})}),(0,c.jsxs)("div",{className:"flex flex-col gap-1 flex-1",children:[s&&(0,c.jsx)("span",{className:"text-sm font-semibold text-primary-grey-900",children:s}),(0,c.jsx)("span",{className:"text-sm text-primary-grey-600 leading-relaxed",children:(null==n?void 0:n.description)||(null==n?void 0:n.label)})]})]}),(0,c.jsx)(u.zG,{})]})}):(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-2 space-y-0 mt-0",children:[(0,c.jsxs)("div",{className:"flex flex-row gap-3 items-start",children:[(0,c.jsx)(p,{label:null!==(l=null==n?void 0:n.label)&&void 0!==l?l:"",isRequired:!1,tooltip:null==n?void 0:n.tooltip}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)(u.XZ,{checked:t.value,onCheckedChange:e=>
1{t.onChange(e)},icon:(0,c.jsx)(I.ZP,{icon:"Check",className:"h-[14px] w-[14px]"}),className:"border-gray-400 h-5 w-5 data-[state=checked]:bg-[#233ed9] data-[state=checked]:!text-background-primary-light !text-background-primary-light",disabled:!!(null==n?void 0:n.disabled)||(null==r?void 0:r.disabled)}),(0,c.jsx)(u.lX,{className:"!mt-0 text-xs md:text-sm font-normal text-primary-grey-400",children:null==n?void 0:n.description})]})})]}),(0,c.jsx)(u.zG,{})]})};function eo(e){let{label:l,isRequired:t,fieldConfigItem:n,fieldProps:r}=e,[a,s]=(0,S.useState)();(0,S.useEffect)(()=>{a||s(r.value||!1)},[r.value]);let o=()=>{r.onChange(!a),s(!a)},i=(null==n?void 0:n.togglePosition)||"right",d=(null==n?void 0:n.parentClassName)||"";return(0,c.jsxs)("div",{className:(0,x.cn)("flex justify-between",d),children:["left"===i&&(0,c.jsx)(u.rs,{checked:a,onCheckedChange:o}),(0,c.jsx)(p,{label:(null==n?void 0:n.label)||l,tooltip:null==n?void 0:n.tooltip,isRequired:t,className:(0,x.cn)(r.labelclass,"text-title")}),"right"===i&&(0,c.jsx)(u.rs,{checked:a,onCheckedChange:o})]})}var ei=t(3735);let ed=[{label:"Dancing Script",value:"Dancing Script"},{label:"Pacifico",value:"Pacifico"},{label:"Great Vibes",value:"Great Vibes"},{label:"Allura",value:"Allura"}],ec=e=>{var l;let{label:t,isRequired:n,fieldConfigItem:r,fieldProps:a,containerClass:s}=e,{showLabel:o,...i}=a,[d,f]=(0,S.useState)(null!==(l=a.username)&&void 0!==l?l:""),[v,h]=(0,S.useState)("Dancing Script"),[b,g]=(0,S.useState)(!1),[y,j]=(0,S.useState)(!1),N=(0,S.useRef)(null),w=(0,S.useRef)(null),C=(0,S.useRef)(),k=(0,S.useRef)(!1),_=(0,S.useCallback)(e=>{N.current=e},[]),D=(0,S.useCallback)(()=>{(null==N?void 0:N.current)&&N.current.clear();let e=w.current;if(e){let l=e.getContext("2d");l&&(l.clearRect(0,0,e.width,e.height),l.beginPath())}a.onChange(""),j(!1)},[a]),z=(0,S.useCallback)(()=>{(null==N?void 0:N.current)&&!k.current&&a.onChange(N.current.toDataURL())},[a]),I=(0,S.useCallback)(function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v;if(!b||y||!e)return;let t=w.current;if(t){let n=t.getContext("2d");if(n){n.clearRect(0,0,t.width,t.height),n.font="48px '".concat(l,"', cursive"),n.fillStyle="black",n.fillText(e,50,100);let r=t.toDataURL("image/png");(null==N?void 0:N.current)&&(N.current.clear(),N.current.fromDataURL(r),a.onChange(r))}}},[b,y,v,a]);return(0,S.useEffect)(()=>{let e=null==N?void 0:N.current;if(e)return e.instance.addEventListener("endStroke",z),()=>{e.instance.removeEventListener("endStroke",z)}},[z]),(0,S.useEffect)(()=>{let e=null==N?void 0:N.current;e&&(a.disabled||b?e.off():e.on())},[a.disabled,b]),(0,S.useEffect)(()=>{a.value&&(null==N?void 0:N.current)&&!y&&!b&&N.current.fromDataURL(a.value)},[a.value,y,b]),(0,S.useEffect)(()=>()=>{C.current&&clearTimeout(C.current)},[]),(0,c.jsxs)("div",{className:(0,x.cn)("flex flex-col gap-4",s,{"cursor-not-allowed":a.disabled}),children:[(0,c.jsx)("header",{children:(0,c.jsx)("link",{href:"https://fonts.googleapis.com/css2?family=Dancing+Script&family=Pacifico&family=Great+Vibes&family=Allura&display=swap",rel:"stylesheet"})}),(0,c.jsxs)(u.xJ,{className:"flex flex-col",children:[(void 0===o||o)&&(0,c.jsx)(p,{label:(null==r?void 0:r.label)||t,isRequired:n,className:a.labelclass}),(0,c.jsxs)("div",{className:"flex flex-row gap-4 justify-between",children:[(0,c.jsxs)("div",{className:(0,x.cn)("flex flex-row gap-4",{"cursor-not-allowed":a.disabled}),children:[(0,c.jsx)(u.zx,{onClick:e=>{e.preventDefault(),g(!1),D()},className:(0,x.cn)("h-8 bg-muted flex gap-2 w-fit px-2 items-center justify-center rounded-md text-sm text-nowrap hover:bg-slate-300",{"bg-slate-300":!b,"pointer-events-none":a.disabled}),variant:"ghost",children:"Draw"}),(0,c.jsx)(u.zx,{onClick:e=>{e.preventDefault(),g(!0),D()},className:(0,x.cn)("h-8 bg-muted flex gap-2 w-fit px-2 items-center justify-center rounded-md text-sm text-nowrap hover:bg-slate-300",{"bg-slate-300":b,"pointer-events-none":a.disabled}),variant:"ghost",children:"Type"})]}),(0,c.jsx)(u.zx,{onClick:e=>{e.preventDefault(),j(!0),f(""),D()},className:(0,x.cn)("h-8 bg-muted flex gap-2 w-fit px-2 items-center justify-center rounded-md text-sm text-nowrap hover:bg-slate-300",{"pointer-events-none":a.disabled}),variant:"ghost",children:"Clear"})]}),(0,c.jsx)("div",{className:"flex gap-2",children:(0,c.jsx)(u.xJ,{className:"w-full",children:(0,c.jsx)(ei.Z,{...i,ref:_,canvasProps:{className:"h-[150px] w-[150] sm:w-[300px] border rounded-md"}})})}),b&&(0,c.jsxs)(S.Fragment,{children:[(0,c.jsxs)("div",{className:"flex flex-col xl:flex-row gap-2",children:[(0,c.jsx)(u.II,{type:"text",placeholder:"Enter your name",value:d,onChange:e=>{f(e.target.value),k.current=!0,C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{k.current=!1,I(e.target.value)},200)},style:{padding:"10px",fontSize:"16px"}}),(0,c.jsx)(m.JV,{options:ed,onChange:e=>{e.value!==v&&(h(e.value),d&&I(d,e.value))},placeholder:"Select Font",value:{value:v,label:v}})]}),(0,c.jsx)("canvas",{ref:w,width:500,height:200,style:{display:"none"}})]}),(null==r?void 0:r.description)&&(0,c.jsx)("p",{className:"text-sm text-gray-500 dark:text-white",children:null==r?void 0:r.description}),(0,c.jsx)(u.zG,{})]})]})};function eu(e){let{label:l,isRequired:t,field:n,fieldConfigItem:r,fieldProps:a}=e,s=ee()(n.value)?n.value:[],o=e=>{let l;l=s.includes(e)?s.filter(l=>l!==e):[...s,e],n.onChange(l)};return(0,c.jsxs)(u.xJ,{className:"flex gap-2 w-full flex-col justify-start",children:[(0,c.jsx)(p,{isRequired:t,label:(null==r?void 0:r.label)||l,tooltip:null==r?void 0:r.tooltip,className:(0,x.cn)(null==a?void 0:a.labelclass)}),(0,c.jsx)(u.NI,{children:(0,c.jsx)("div",{className:"grid grid-cols-3 gap-4",children:x.VBU.map(e=>{let l=s.includes(e.label);return(0,c.jsxs)("div",{onClick:()=>o(e.label),role:"button",tabIndex:0,onKeyDown:l=>
1{("Enter"===l.key||" "===l.key)&&(l.preventDefault(),o(e.label))},className:(0,x.cn)("relative flex flex-col items-center justify-center gap-2 h-auto p-4 rounded-xl border-2 transition-all duration-200 cursor-pointer",l?"border-primary-blue-700 bg-primary-blue-50":"border-primary-grey-200 bg-transparent hover:bg-primary-grey-50 hover:border-primary-grey-300"),children:[l&&(0,c.jsx)("div",{className:"absolute top-2 right-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary-blue-700",children:(0,c.jsx)(I.ZP,{icon:"Check",color:"#ffffff",applyHover:!1,size:12})}),(0,c.jsx)("div",{className:"flex h-12 w-12 items-center justify-center pointer-events-none",children:(0,c.jsx)(I.ZP,{icon:e.icon,size:24,applyHover:!1})}),(0,c.jsx)("span",{className:(0,x.cn)("text-sm font-medium pointer-events-none",l?"text-primary-blue-700":"text-primary-grey-700"),children:e.label})]},e.label)})})}),(0,c.jsx)(u.zG,{})]})}var ex=e=>{var l,t,n;let{field:r,fieldConfigItem:a,label:s,isRequired:o}=e,[i,d]=(0,S.useState)(!1),m=(0,S.useRef)(null),p=null==a?void 0:null===(l=a.inputProps)||void 0===l?void 0:l.icon,f=x.T5O[r.name],v=null!==(n=null==f?void 0:f.prefix)&&void 0!==n?n:"",h=(null==a?void 0:null===(t=a.inputProps)||void 0===t?void 0:t.placeholder)||"Enter value",b=(null==f?void 0:f.placeholder)||"username",g=r.value&&r.value.length>0,y=i||g,j=y&&v.length>0&&"spotify"!==r.name;return(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-2",children:[(0,c.jsx)(u.NI,{children:(0,c.jsx)("div",{className:"relative",children:(0,c.jsxs)("div",{onClick:()=>{var e;null===(e=m.current)||void 0===e||e.focus()},className:"\n flex items-center gap-3 border rounded-lg px-3 py-2\n transition-all duration-200 cursor-text\n ".concat(i?"border-[#465AD1] ring-2 ring-[#465AD1]/10":"border-primary-grey-200","\n hover:border-primary-grey-300\n "),children:[p&&(0,c.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gray-50",children:(0,c.jsx)(I.ZP,{icon:p,color:i?"#465AD1":"#64748B",size:20,applyHover:!1})}),(0,c.jsxs)("div",{className:"flex-1 relative min-w-0",children:[(0,c.jsx)(u.__,{className:"\n absolute left-0 transition-all duration-200 pointer-events-none\n ".concat(y?"text-xs -top-3 text-[#465AD1]":"text-[15px] top-1/2 -translate-y-1/2 text-gray-400","\n "),children:y?b:h}),(0,c.jsxs)("div",{className:"\n flex items-center gap-0 transition-opacity duration-200\n ".concat(y?"opacity-100":"opacity-0","\n "),children:[j&&(0,c.jsx)("span",{className:"text-[15px] text-gray-500 select-none whitespace-nowrap pointer-events-none",children:v}),(0,c.jsx)("input",{...r,ref:m,onFocus:()=>d(!0),onBlur:()=>d(!1),className:" w-full bg-transparent border-none outline-none text-[15px] "})]})]})]})})}),(0,c.jsx)(u.zG,{})]})},em=e=>{var l;let{field:t,fieldConfigItem:n,fieldProps:r}=e;return t.value?null:(0,c.jsxs)(u.xJ,{className:"space-y-0 mt-0",children:[(0,c.jsx)(p,{label:null!==(l=null==n?void 0:n.label)&&void 0!==l?l:"",isRequired:!1,tooltip:null==n?void 0:n.tooltip}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.xJ,{className:"flex items-center gap-2",children:(0,c.jsx)(u.zx,{onClick:e=>{t.onChange(!t.value)},startIcon:"Plus",variant:null,size:"md",iconColor:"#233ED9",className:"cursor-pointer p-0 flex gap-1",disabled:!!(null==n?void 0:n.disabled)||r.disabled,type:"button",children:(0,c.jsx)("span",{className:"text-primary-blue-700 text-xs md:text-sm font-normal",children:null==n?void 0:n.description})})})})]})};function ep(e){var l;let{label:t,isRequired:n,field:r,fieldConfigItem:a,fieldProps:s}=e;return(0,c.jsxs)(u.xJ,{className:"flex flex-col",children:[(0,c.jsx)(p,{label:(null==a?void 0:a.label)||t,tooltip:null==a?void 0:a.tooltip,isRequired:n,className:s.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)(u.OC,{onValueChange:e=>r.onChange("Yes"===e),defaultValue:r.value,...s,children:[(0,c.jsx)(u.i4,{className:s.className,children:(0,c.jsx)(u.ki,{placeholder:null==a?void 0:null===(l=a.inputProps)||void 0===l?void 0:l.placeholder,children:r.value?"Yes":"No"})}),(0,c.jsxs)(u.Bw,{children:[(0,c.jsx)(u.Ql,{value:"Yes",children:"Yes"},"Yes"),(0,c.jsx)(u.Ql,{value:"No",children:"No"},"No")]})]})}),(0,c.jsx)(f,{fieldConfigItem:a}),s.error?(0,c.jsx)(u.zG,{children:s.error}):(0,c.jsx)(u.zG,{})]})}var ef=t(73931),ev=t(83065),eh=t.n(ev),eb=t(73999),eg=t.n(eb),ey=t(63599);let ej={maxWidthOrHeight:250,useWebWorker:!0},eN=e=>{let{file:l,handleRemoveFile:t}=e;return(0,c.jsx)("div",{className:"w-full bg-muted p-8 flex items-center justify-center",children:(0,c.jsxs)("div",{className:"relative overflow-hidden rounded-lg object-cover",children:[(0,c.jsx)("div",{className:"absolute h-max w-max top-0 right-0 cursor-pointer",onClick:t,children:(0,c.jsx)(I.ZP,{icon:"CircleX"})}),(0,c.jsx)(ey.default,{src:URL.createObjectURL(l),alt:"Invoice logo",width:100,height:100,className:"rounded-md object-cover max-h-20 h-auto w-auto"})]})})};function ew(e){var l,t,n,r,a;let{label:s,isRequired:o,fieldConfigItem:i,fieldProps:d}=e,{showLabel:v,className:h,...b}=d,g=d.type||"text",[y,j]=(0,S.useState)(null==i?void 0:null===(l=i.inputProps)||void 0===l?void 0:l.files),[N,w]=(0,S.useState)(""),C=(0,S.useCallback)(async e=>{var l;w("");let t=null==i?void 0:null===(l=i.inputProps)||void 0===l?void 0:l.compressionOptions,n=J()(t)?ej:t,r=
1await Promise.all(e.map(async e=>{if(e.type.includes("image"))try{return await (0,ef.Z)(e,n)}catch(e){console.error("Error compressing file:",e)}return e}));d.onChange({target:{files:r}}),j(r)},[null==i?void 0:null===(t=i.inputProps)||void 0===t?void 0:t.compressionOptions,d]);return(0,c.jsx)("div",{className:"flex flex-row items-center space-x-2 w-full",children:(0,c.jsxs)(u.xJ,{className:"flex w-full flex-col justify-start",children:[(void 0===v||v)&&(0,c.jsx)(p,{label:(null==i?void 0:i.label)||s,tooltip:null==i?void 0:i.tooltip,isRequired:o,className:(0,x.cn)(d.labelclass)}),(0,c.jsx)(f,{fieldConfigItem:i}),(0,c.jsx)(u.NI,{children:(null==y?void 0:y.length)?(0,c.jsx)(eN,{file:y[0],handleRemoveFile:()=>{d.onChange({target:{files:[]}}),j([])}}):(0,c.jsx)(u.xJ,{className:"border border-input rounded-md",children:(0,c.jsx)(m.fh,{...b,accept:null==i?void 0:null===(n=i.inputProps)||void 0===n?void 0:n.acceptedTypes,className:(0,x.cn)(h,{"!border-[#d0327538]":!!d.error,"focus-visible:!border-b-[2px] focus-visible:!border-b-[#d03275]":!!d.error}),type:g,onDrop:C,onDropRejected:(e,l)=>{let t=eg()(eh()(e,"errors"),"code").map(e=>e.code),n="";if(t.includes("file-too-large")&&(n="Selected file is too large."),t.includes("too-many-files")){var r;n="Only ".concat(null==i?void 0:null===(r=i.inputProps)||void 0===r?void 0:r.maxFiles," file can be uploaded.")}w(n)},maxFiles:null==i?void 0:null===(r=i.inputProps)||void 0===r?void 0:r.maxFiles,maxSize:null==i?void 0:null===(a=i.inputProps)||void 0===a?void 0:a.maxSize})})}),d.error||N?(0,c.jsx)(u.zG,{children:d.error||N}):(0,c.jsx)(u.zG,{})]})})}function eC(e){let{label:l,isRequired:t,fieldConfigItem:n,fieldProps:r,field:a}=e,{showLabel:s}=r,[o,i]=(0,S.useState)(null);return(0,c.jsxs)(u.xJ,{children:[(void 0===s||s)&&(0,c.jsx)(p,{label:(null==n?void 0:n.label)||l,tooltip:null==n?void 0:n.tooltip,isRequired:t,className:r.labelclass}),o?(0,c.jsxs)("div",{className:"flex h-[40px] w-full flex-row items-center justify-between space-x-2 rounded-sm border p-2 text-black",children:[(0,c.jsx)("p",{className:"text-sm truncate",children:o}),(0,c.jsx)(u.zx,{type:"button",variant:"ghost",size:"sm",isIconOnly:!0,startIcon:"Trash2",iconSize:16,onClick:()=>{i(null),a.onChange(null)},"aria-label":"Remove file",className:"p-0 h-auto w-auto"})]}):(0,c.jsx)(m.fh,{onDrop:e=>{let l=e[0];if(!l)return;let t=new FileReader;t.onloadend=()=>{i(l.name),a.onChange(t.result)},t.readAsDataURL(l)},multiple:!1,button:!1,description:"Drag and drop here or Choose File to upload",subDescription:""}),(0,c.jsx)(f,{fieldConfigItem:n}),r.error?(0,c.jsx)(u.zG,{children:r.error}):(0,c.jsx)(u.zG,{})]})}var ek=t(11384),e_=t.n(ek);function eS(e){var l,t,n,r,a;let{label:s,isRequired:o,fieldConfigItem:i,fieldProps:d,form:m}=e,{showLabel:v}=d,h=(0,S.useRef)(null),b=Number(null!==(t=d.countryCode)&&void 0!==t?t:(0,x.u9Z)()),g=1===b?"us":(0,x.mfJ)().toLowerCase();(0,S.useEffect)(()=>{let e=h.current;if(!e)return;let l=()=>{let l=e.querySelector(".flag-dropdown");if(!(null==l?void 0:l.classList.contains("open")))return;let t=l.querySelector(".country-list");if(!t)return;let n=l.getBoundingClientRect(),r=window.innerHeight-n.bottom;t.style.position="fixed",t.style.left="".concat(n.left,"px"),t.style.zIndex="9999",r<210?t.style.top="".concat(n.top-210,"px"):t.style.top="".concat(n.bottom+2,"px")},t=e.querySelector(".flag-dropdown");if(!t)return;let n=new MutationObserver(()=>{let e=t.classList.contains("open"),n=t.querySelector(".country-list");n&&(e?(l(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l)):(n.style.cssText="",window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)))});return n.observe(t,{attributes:!0,attributeFilter:["class"]}),()=>{n.disconnect(),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[]);let y={outline:"none",padding:"0.5rem 1rem 0.5rem 2.8rem",border:"1px solid #dcdce4",borderRadius:"0.375rem",width:"100%",height:"2.5rem",fontSize:"0.875rem",lineHeight:"1.25rem",...d.disabled?{cursor:"not-allowed",opacity:.5,backgroundColor:"#ffffff"}:{}};return(0,c.jsx)("div",{ref:h,className:"flex flex-row items-center space-x-2 w-full",children:(0,c.jsxs)(u.xJ,{id:"phone",className:"flex w-full flex-col justify-start",children:[(void 0===v||v)&&(0,c.jsx)(p,{label:(null==i?void 0:i.label)||s,tooltip:null==i?void 0:i.tooltip,isRequired:o,className:(0,x.cn)(d.labelclass)}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(e_(),{country:g,specialLabel:"",onlyCountries:x.gUY.map(e=>e.toLowerCase()),placeholder:d.placeholder||"(000) 000-0000",inputProps:{placeholder:d.placeholder||"(123)-456-7890"},inputStyle:y,disabled:d.disabled,onChange:(e,l)=>{if(d.name.endsWith(".phone")){let t=d.name.slice(0,-6);
1m.setValue(t,{phone:e.slice(l.dialCode.length),country_code:parseInt(l.dialCode)})}else m.setValue("country_code",parseInt(l.dialCode)),m.setValue("phone",e.slice(l.dialCode.length))},value:d.name.endsWith(".phone")?"".concat(null!==(n=null===(l=m.getValues(d.name.slice(0,-6)))||void 0===l?void 0:l.country_code)&&void 0!==n?n:b," ").concat(m.getValues(d.name)):"".concat(null!==(r=m.getValues("country_code"))&&void 0!==r?r:b," ").concat(null!==(a=m.getValues("phone"))&&void 0!==a?a:""),countryCodeEditable:!1,dropdownStyle:{backgroundColor:"#ffffff"},dropdownClass:"bg-white rounded-md",inputClass:(0,x.cn)("focus-visible:!border-b-[2px] !border-input focus-visible:!border-b-[#233ed6] focus-visible:!rounded-es-[2px] focus-visible:!rounded-ee-[2px]",{"!border-[#d0327538]":!!d.error,"focus-visible:!border-b-[2px] focus-visible:!border-b-[#d03275]":!!d.error})})}),(0,c.jsx)(f,{fieldConfigItem:i}),!!d.error&&(0,c.jsx)(u.zG,{children:d.error})]})})}t(942);let eD=e=>{let{value:l,field:t,displayLabel:n}=e,r="radio-".concat(l);return(0,c.jsx)("label",{htmlFor:r,className:(0,x.cn)("block cursor-pointer","transition-all duration-300"),children:(0,c.jsx)("div",{className:(0,x.cn)("flex items-center px-4 py-[10px] rounded-md","hover:bg-[#F5F9FF]",t.value===l?"shadow-[0_0_0_1px_rgba(154,196,255,0.4)] border border-[#C0DCFF] bg-[#F5F9FF]":"bg-white border border-[#eceffc]"),children:(0,c.jsxs)(u.xJ,{className:"m-0 p-0 space-y-0 flex items-center gap-2",children:[(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.mJ,{id:r,value:l})}),(0,c.jsx)(u.lX,{className:"font-normal text-sm leading-4 cursor-pointer ",htmlFor:r,children:null!=n?n:en()(l)})]})})})};function ez(e){var l;let{label:t,isRequired:n,field:r,zodItem:s,fieldProps:o,fieldConfigItem:i}=e,x=null!==(l=a(s)._def.values)&&void 0!==l?l:d(o.name),m=[];return m=Array.isArray(x)?x:Object.entries(x).map(e=>e[0]),(0,c.jsxs)("div",{children:[(0,c.jsxs)(u.xJ,{className:"flex flex-col justify-start",children:[(0,c.jsx)(p,{label:(null==i?void 0:i.label)||t,tooltip:null==i?void 0:i.tooltip,isRequired:n,className:o.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.Ee,{onValueChange:r.onChange,value:r.value,className:"space-y-2",...o,children:null==m?void 0:m.map(e=>(0,c.jsx)(eD,{value:e,field:r},e))})}),o.error?(0,c.jsx)(u.zG,{children:o.error}):(0,c.jsx)(u.zG,{})]}),(0,c.jsx)(f,{fieldConfigItem:i})]})}function eI(e){var l;let{label:t,isRequired:n,field:r,zodItem:s,fieldProps:o,fieldConfigItem:i}=e,d=null==i?void 0:null===(l=i.inputProps)||void 0===l?void 0:l.options,m=a(s)._def.values,v=[];v=Array.isArray(m)?m:Object.entries(m).map(e=>e[0]);let h=d||v.map(e=>({value:e,label:e}));return(0,c.jsxs)("div",{children:[(0,c.jsxs)(u.xJ,{className:"flex flex-col justify-start gap-4",children:[(0,c.jsx)(p,{label:(null==i?void 0:i.label)||t,tooltip:null==i?void 0:i.tooltip,isRequired:n,className:o.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.Ee,{onValueChange:r.onChange,value:r.value,...o,children:null==h?void 0:h.map(e=>(0,c.jsx)("label",{htmlFor:"radio-".concat(r.name,"-").concat(e.value),className:"block cursor-pointer",children:(0,c.jsx)("div",{className:(0,x.cn)("flex items-start px-3 py-2 rounded-md transition-all duration-200","hover:bg-[#F5F9FF]",r.value===e.value?"shadow-[0_0_0_1px_rgba(154,196,255,0.4)] border border-[#C0DCFF] bg-[#F5F9FF]":"bg-white border border-[#eceffc]"),children:(0,c.jsxs)(u.xJ,{className:"flex items-center gap-3 space-y-0 m-0 p-0 w-full",children:[(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.mJ,{id:"radio-".concat(r.name,"-").concat(e.value),value:e.value,className:"mt-0.5"})}),(0,c.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,c.jsx)("span",{className:"font-medium text-primary-grey-700 text-sm leading-5 cursor-pointer",children:e.label}),e.description&&(0,c.jsx)("p",{className:"text-primary-grey-500 text-xs leading-4",children:e.description})]})]})})},e.value))})}),o.error?(0,c.jsx)(u.zG,{children:o.error}):(0,c.jsx)(u.zG,{})]}),(0,c.jsx)(f,{fieldConfigItem:i})]})}function eR(e){var l,t;let{label:n,isRequired:r,field:a,fieldConfigItem:s,fieldProps:o,t:i}=e,[d,f]=(0,S.useState)(!1),[v,h]=(0,S.useState)([]),{getOptions:b,...g}=o,y=(0,S.useMemo)(()=>b?b().filter(e=>"custom"!==e.value):[],[b]),j=e=>{let l;h(l=v.some(l=>l.value===e.value)?v.filter(l=>l.value!==e.value):[...v,e]),a.onChange(l.map(e=>e.value))},N=e=>v.some(l=>l.value===e.value);(0,S.useEffect)(()=>
1{if(ee()(a.value)){let e=a.value.map(e=>{let l=e instanceof Date?e:new Date(e);return(0,_.WU)(l,"yyyy-MM-dd")});h(y.filter(l=>{let t=l.value instanceof Date?l.value:new Date(l.value),n=(0,_.WU)(t,"yyyy-MM-dd");return e.includes(n)}))}else h([])},[a.value,y]);let w=e=>{let l="string"==typeof e?new Date(e):e;return(0,_.WU)(l,"MMM d, yyyy")};return(0,c.jsxs)(u.xJ,{className:"flex gap-[6px] w-full flex-col justify-start",children:[(0,c.jsx)(p,{isRequired:r,label:(null==s?void 0:s.label)||n,tooltip:null==s?void 0:s.tooltip,className:(0,x.cn)(o.labelclass)}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)(u.h_,{open:d,onOpenChange:f,children:[(0,c.jsx)(u.$F,{asChild:!0,children:(0,c.jsxs)("div",{className:(0,x.cn)("flex gap-2 border border-primary-grey-200 rounded-[8px] w-full items-center justify-between cursor-pointer",{"border-b-2 border-b-primary-blue-700":d}),children:[(0,c.jsx)("div",{className:"flex flex-wrap px-[10px] py-2 ",children:v.length>0?(0,c.jsx)(m.L_,{className:"p-0 md:min-h-5 min-h-4 ",options:null!==(t=v.map(e=>w(e.value)))&&void 0!==t?t:[],handleDeleteOption:e=>{let l=v.filter((l,t)=>t!==e);h(l),a.onChange(l.map(e=>e.value))}}):(0,c.jsx)("span",{className:"text-primary-grey-400 text-xs font-normal md:text-sm",children:(null==s?void 0:null===(l=s.inputProps)||void 0===l?void 0:l.placeholder)||"Select reminders"})}),(0,c.jsx)("div",{className:"w-8",children:(0,c.jsx)(I.ZP,{icon:"ChevronDown",color:"#818898",size:24})})]})}),(0,c.jsx)(u.AW,{className:"p-0 border-primary-grey-200 w-[var(--radix-popper-anchor-width)]",align:"start",sideOffset:0,onInteractOutside:()=>f(!1),children:0!==y.length&&(0,c.jsx)(u.Qk,{className:"flex flex-col max-h-72 p-2 min-h-72 overflow-y-scroll",children:y.map((e,l)=>(0,c.jsxs)(u.Xi,{className:"cursor-pointer flex items-center text-primary-grey-900 px-[10px] py-2 w-full hover:bg-accent rounded-sm",onSelect:e=>{e.preventDefault()},onPointerDown:e=>{e.preventDefault()},onPointerUp:()=>{j(e)},children:[(0,c.jsx)(u.XZ,{checked:N(e),className:"border-primary-grey-400 h-5 w-5 rounded-[4px] data-[state=checked]:bg-[#465AD1] data-[state=checked]:text-primary-foreground"}),(0,c.jsx)("span",{className:"ml-2 text-xs font-normal md:text-sm",children:e.label})]},l))})})]})}),(0,c.jsx)(u.zG,{})]})}function eE(e){let{label:l,isRequired:t,field:n,fieldConfigItem:r,fieldProps:a}=e;return(0,c.jsxs)("div",{children:[(0,c.jsx)(u.xJ,{children:(0,c.jsxs)("div",{className:"flex items-center gap-3",children:[(0,c.jsx)(u.NI,{children:(0,c.jsx)(u.rs,{checked:n.value,onCheckedChange:n.onChange,...a})}),(0,c.jsx)(p,{label:(null==r?void 0:r.label)||l,tooltip:null==r?void 0:r.tooltip,isRequired:t,className:a.labelclass})]})}),(0,c.jsx)(f,{fieldConfigItem:r})]})}function eF(e){let{label:l,isRequired:t,fieldConfigItem:n,fieldProps:r}=e,{showLabel:a,...s}=r;return(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-2",children:[(void 0===a||a)&&(0,c.jsx)(p,{label:(null==n?void 0:n.label)||l,tooltip:null==n?void 0:n.tooltip,isRequired:t,className:r.labelclass}),(0,c.jsx)(u.NI,{children:(0,S.createElement)(u.gx,{...s,key:s.key})}),(0,c.jsx)(f,{fieldConfigItem:n}),r.error?(0,c.jsx)(u.zG,{children:r.error}):(0,c.jsx)(u.zG,{})]})}var eP=t(38130),eO=t.n(eP);function eJ(e){var l,t,n;let{label:r,isRequired:a,fieldConfigItem:s,fieldProps:o,field:i}=e,{showLabel:d,...m}=o,[v,h]=(0,S.useState)([]),[b,g]=(0,S.useState)(!1),[y,j]=(0,S.useState)(-1),[N,w]=(0,S.useState)(!1),C=(0,S.useRef)(null),k=(0,S.useRef)(null),_=(0,S.useRef)(""),D=(0,S.useRef)(!1),z=null==s?void 0:null===(l=s.inputProps)||void 0===l?void 0:l.suggestions,I=(null==z?void 0:z.enabled)&&!!z.fetchSuggestions,R=null!==(t=null==z?void 0:z.minChars)&&void 0!==t?t:2,E=null!==(n=null==z?void 0:z.debounceMs)&&void 0!==n?n:300,F=async e=>{if(I){if(e===_.current&&D.current&&v.length>0){g(!0);return}w(!0),_.current=e;try{let l=await z.fetchSuggestions(e);h(l),g(l.length>0),j(-1),D.current=!0}catch(e){console.error("Error fetching suggestions:",e),h([]),g(!1),D.current=!1}finally{w(!1)}}},P=(0,S.useRef)(eO()(e=>{F(e)},E)).current,O=e=>{var l;i.onChange(e.text),g(!1),j(-1),null===(l=C.current)||void 0===l||l.focus()};return(0,S.useEffect)(()=>{let e=e=>{var l;!k.current||k.current.contains(e.target)||(null===(l=C.current)||void 0===l?void 0:l.contains(e.target))||g(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e),P.cancel()}},[P]),(0,S.useEffect)(()=>
1{if(y>=0&&k.current){let e=k.current.children[y];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[y]),(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-2 relative",children:[(void 0===d||d)&&(0,c.jsx)(p,{label:(null==s?void 0:s.label)||r,tooltip:null==s?void 0:s.tooltip,isRequired:a,className:o.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)("div",{className:"relative",children:[(0,S.createElement)(u.gx,{...m,...i,ref:C,onChange:e=>{if(i.onChange(e),I){let l=e.target.value;l!==_.current&&P(l)}},onKeyDown:e=>{if(b&&0!==v.length)switch(e.key){case"ArrowDown":e.preventDefault(),j(e=>e<v.length-1?e+1:e);break;case"ArrowUp":e.preventDefault(),j(e=>e>0?e-1:-1);break;case"Enter":y>=0&&(e.preventDefault(),O(v[y]));break;case"Escape":e.preventDefault(),g(!1),j(-1)}},onFocus:()=>{I&&((i.value||"").length<R?F(""):v.length>0&&!b&&(g(!0),j(-1)))},key:m.key,autoComplete:"off",className:(0,x.cn)({"rounded-es-none rounded-ee-none":b})}),b&&(0,c.jsx)("div",{ref:k,className:(0,x.cn)("absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-md shadow-lg max-h-60 overflow-auto","animate-in fade-in-0 zoom-in-95","rounded-ss-none rounded-se-none"),children:N?(0,c.jsxs)("div",{className:"px-4 py-3 text-sm text-gray-500 flex items-center gap-2",children:[(0,c.jsxs)("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,c.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,c.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Loading suggestions..."]}):v.map((e,l)=>(0,c.jsx)(u.zx,{type:"button",variant:"ghost",onClick:()=>O(e),className:(0,x.cn)("w-full px-4 py-3 text-left text-sm transition-colors rounded-none h-auto justify-start","hover:bg-gray-100 focus:bg-gray-100 focus:outline-none","border-b border-gray-100 last:border-b-0",y===l&&"bg-gray-100"),children:(0,c.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,c.jsx)("span",{className:"text-gray-900 line-clamp-2",children:e.text}),e.lastUsedAt&&(0,c.jsxs)("span",{className:"text-xs text-gray-500",children:["Last used:"," ",new Date(e.lastUsedAt).toLocaleDateString()]})]})},e.id))})]})}),(0,c.jsx)(f,{fieldConfigItem:s}),o.error?(0,c.jsx)(u.zG,{children:o.error}):(0,c.jsx)(u.zG,{})]})}function eL(e){let{label:l,isRequired:t,fieldConfigItem:n,fieldProps:r,field:a}=e,s=Array.isArray(a.value)?a.value:[],[o,i]=(0,S.useState)(""),d=(0,S.useRef)(null),{showLabel:m,placeholder:v,disabled:h,...b}=r,g=e=>{let l=e.trim();!l||s.includes(l)||a.onChange([...s,l])},y=()=>{o.trim()&&(g(o),i(""))};return(0,c.jsxs)(u.xJ,{className:"flex flex-col gap-2",children:[(void 0===m||m)&&(0,c.jsx)(p,{label:(null==n?void 0:n.label)||l,tooltip:null==n?void 0:n.tooltip,isRequired:t,className:b.labelclass}),(0,c.jsx)(u.NI,{children:(0,c.jsxs)("div",{className:(0,x.cn)("flex flex-wrap gap-1.5 p-2 border border-input rounded-md min-h-[38px] bg-background cursor-text","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",h&&"opacity-50 cursor-not-allowed"),onClick:()=>{var e;return!h&&(null===(e=d.current)||void 0===e?void 0:e.focus())},children:[s.map((e,l)=>(0,c.jsxs)("span",{className:"inline-flex items-center gap-1 bg-slate-100 text-slate-700 text-xs px-2 py-0.5 rounded-md",children:[e,!h&&(0,c.jsx)(u.zx,{type:"button",variant:"ghost",size:"sm",isIconOnly:!0,startIcon:"X",iconSize:10,onClick:e=>{e.stopPropagation(),a.onChange(s.filter((e,t)=>t!==l))},className:"text-slate-400 hover:text-slate-600 p-0 h-auto w-auto"})]},l)),!h&&(0,c.jsx)("input",{ref:d,type:"text",value:o,onChange:e=>{let l=e.target.value;l.endsWith(",")?(g(l.slice(0,-1)),i("")):i(l)},onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),y()):"Backspace"===e.key&&!o&&s.length>0&&a.onChange(s.slice(0,-1))},onBlur:y,placeholder:0===s.length?null!=v?v:"Type and press Enter or ,":"",disabled:h,autoComplete:"off",className:"flex-1 min-w-[140px] bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]})}),(0,c.jsx)(f,{fieldConfigItem:n}),(0,c.jsx)(u.zG,{})]})}let eA=e=>{if(!e)return{country_code:1,phone:""};let l=e.match(/^\+?(\d{1,3})(\d+)$/);return l?{country_code:Number(l[1]),phone:l[2]}:{country_code:1,phone:e}};var eM=e=>{let{initialPhoneNumber:l,rowId:t,disabled:n,onUpdateRecord:r}=e,[a,s]=(0,S.useState)(l||""),[o,i]=(0,S.useState)(!0),[d,m]=(0,S.useState)(!1);(0,S.useEffect)(()=>{s(l||""),i((0,x.Y08)(eA(l).phone)||""===l)},[l]);
1let{country_code:p,phone:f}=eA(a),v=(0,S.useCallback)((e,l)=>{let t=parseInt(l.dialCode),n=e.slice(l.dialCode.length),r=n?"+".concat(t).concat(n):"";i((0,x.Y08)(n)),s(r)},[]),h=(0,S.useCallback)(()=>{m(!0);let e=""===a.trim();(o||e)&&r(t,{phoneNumber:a})},[t,a,o,r]),b=!o&&d;return(0,c.jsxs)("div",{className:"w-full",children:[(0,c.jsx)(u.Z6,{value:f,country_code:p,disabled:n,onChange:v,onBlur:h}),b&&(0,c.jsx)("p",{className:"text-xs text-red-500",children:"Phone number must be exactly 10 digits."})]})}}}]);
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.