@npm-zenwork/tax-remittance-ui 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/bankAccounts.d.ts +9 -7
- package/dist/api/entities.d.ts +10 -7
- package/dist/api/remittancePayments.d.ts +2 -0
- package/dist/components/dashboard/AddFirstPaymentModal.d.ts +12 -0
- package/dist/components/dashboard/SetupChecklist.d.ts +22 -0
- package/dist/components/dashboard/useSetupProgress.d.ts +25 -0
- package/dist/components/entities/EntityActionsMenu.d.ts +3 -1
- package/dist/components/entities/EntityCard.d.ts +8 -0
- package/dist/components/entities/EntityTypeFilter.d.ts +8 -0
- package/dist/components/entities/entityListUtils.d.ts +6 -0
- package/dist/components/forms/SegmentedControl.d.ts +5 -1
- package/dist/components/icons/BankIcon.d.ts +1 -0
- package/dist/components/icons/BusinessIcon.d.ts +1 -0
- package/dist/components/icons/CheckCircleIcon.d.ts +1 -0
- package/dist/components/icons/EmptyTaxAccountsIllustration.d.ts +5 -0
- package/dist/components/icons/EntitySuccessIllustration.d.ts +2 -0
- package/dist/components/icons/EyeIcon.d.ts +1 -0
- package/dist/components/icons/EyeOffIcon.d.ts +1 -0
- package/dist/components/icons/IndividualEntitySuccessIllustration.d.ts +2 -0
- package/dist/components/icons/PersonIcon.d.ts +1 -0
- package/dist/components/icons/XCircleIcon.d.ts +1 -0
- package/dist/components/onboarding/EntityAccountTypeRow.d.ts +14 -0
- package/dist/components/onboarding/EntityAddressFields.d.ts +17 -0
- package/dist/components/onboarding/EntityBusinessFields.d.ts +19 -0
- package/dist/components/onboarding/EntityCreatedModal.d.ts +14 -0
- package/dist/components/onboarding/EntityForm.d.ts +5 -0
- package/dist/components/onboarding/EntityFormHelpPanel.d.ts +8 -0
- package/dist/components/onboarding/EntityIdNumberInput.d.ts +14 -0
- package/dist/components/onboarding/EntityPhoneField.d.ts +10 -0
- package/dist/components/onboarding/EntityPrimaryTaxpayerFields.d.ts +17 -0
- package/dist/components/onboarding/EntitySuccessModal.d.ts +35 -0
- package/dist/components/onboarding/SecondaryTaxpayerSection.d.ts +21 -0
- package/dist/components/onboarding/entityHelpContent.d.ts +123 -0
- package/dist/components/onboarding/useEntityForm.d.ts +78 -0
- package/dist/components/payments/BankAccountCard.d.ts +16 -0
- package/dist/components/payments/BankAccountDrawer.d.ts +15 -0
- package/dist/components/payments/BankConnectionMethodModal.d.ts +11 -0
- package/dist/components/payments/BankConnectionMethodPicker.d.ts +10 -0
- package/dist/components/payments/InlineRowActions.d.ts +17 -0
- package/dist/components/payments/PaymentActionButton.d.ts +9 -0
- package/dist/components/payments/PaymentFormSection.d.ts +1 -1
- package/dist/components/payments/PaymentRowMenu.d.ts +14 -0
- package/dist/components/payments/PaymentStatusBadge.d.ts +7 -0
- package/dist/components/payments/PaymentStepper.d.ts +14 -0
- package/dist/components/payments/PaymentTableRow.d.ts +14 -0
- package/dist/components/payments/PaymentsNeedAttention.d.ts +14 -0
- package/dist/components/payments/RecurringPaymentToggle.d.ts +16 -0
- package/dist/components/payments/RecurringPeriodRows.d.ts +34 -0
- package/dist/components/payments/StateBankDetailsForm.d.ts +8 -0
- package/dist/components/payments/StatePaymentReviewPanel.d.ts +14 -0
- package/dist/components/payments/federalPaymentSteps.d.ts +6 -0
- package/dist/components/payments/federalPaymentUtils.d.ts +4 -0
- package/dist/components/payments/paymentsTableConfig.d.ts +20 -9
- package/dist/components/payments/remittancePaymentMappers.d.ts +3 -0
- package/dist/components/payments/statePaymentAuthorizationConfig.d.ts +1 -1
- package/dist/components/payments/useStatePaymentDraftSave.d.ts +11 -0
- package/dist/components/settings/BankAccountActionsMenu.d.ts +3 -1
- package/dist/components/settings/TaxAccountDrawer.d.ts +22 -0
- package/dist/components/settings/settingsNavConfig.d.ts +1 -1
- package/dist/components/settings/taxAccountDrawerConfig.d.ts +5 -0
- package/dist/components/tax-forms/TaxFormCard.d.ts +7 -0
- package/dist/components/tax-forms/TaxFormsGrid.d.ts +9 -0
- package/dist/components/ui/SideDrawer.d.ts +18 -0
- package/dist/components/ui/StatusPill.d.ts +10 -0
- package/dist/index.cjs +34 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13230 -10490
- package/dist/index.mjs.map +1 -1
- package/dist/lib/bankAccountInputRules.d.ts +17 -0
- package/dist/lib/entityFormUtils.d.ts +44 -1
- package/dist/lib/paymentsNavigation.d.ts +4 -2
- package/dist/pages/StateBankDetailsPage.d.ts +2 -0
- package/dist/styles.css +1 -1
- package/dist/types/entity.d.ts +24 -0
- package/dist/types/federalPaymentFlow.d.ts +2 -0
- package/dist/types/statePayment.d.ts +7 -0
- package/dist/types/statePaymentFlow.d.ts +3 -0
- package/package.json +1 -1
- package/dist/api/paymentTransactions.d.ts +0 -7
- package/dist/components/dashboard/EmptyPaymentCard.d.ts +0 -9
- package/dist/components/payments/PaymentRowActions.d.ts +0 -13
- package/dist/components/settings/AddBankAccountManualForm.d.ts +0 -7
- package/dist/components/settings/AddBankAccountModal.d.ts +0 -8
- package/dist/components/settings/EditBankAccountModal.d.ts +0 -8
- package/dist/components/settings/PaymentHistorySection.d.ts +0 -5
- package/dist/components/settings/SettingsPlaceholderSection.d.ts +0 -6
- package/dist/components/tax-forms/TaxFormsTable.d.ts +0 -8
- package/dist/pages/StatePaymentEditorPage.d.ts +0 -5
- package/dist/types/paymentHistory.d.ts +0 -26
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Gd=Object.defineProperty;var No=e=>{throw TypeError(e)};var Jd=(e,t,n)=>t in e?Gd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ar=(e,t,n)=>Jd(e,typeof t!="symbol"?t+"":t,n),ca=(e,t,n)=>t.has(e)||No("Cannot "+n);var w=(e,t,n)=>(ca(e,t,"read from private field"),n?n.call(e):t.get(e)),te=(e,t,n)=>t.has(e)?No("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),J=(e,t,n,s)=>(ca(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),le=(e,t,n)=>(ca(e,t,"access private method"),n);var es=(e,t,n,s)=>({set _(a){J(e,t,a,n)},get _(){return w(e,t,s)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),x=require("react"),jn=require("react-dom");function Xd(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const I=Xd(x);/**
|
|
2
2
|
* react-router v7.18.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
@@ -7,70 +7,70 @@
|
|
|
7
7
|
* LICENSE.md file in the root directory of this source tree.
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/var ii=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,jd=/^[\\/]{2}/;function wd(e,t){return t+e.replace(/\\/g,"/")}function mo(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Nd(e={}){let{initialEntries:t=["/"],initialIndex:n,v5Compat:r=!1}=e,a;a=t.map((p,g)=>u(p,typeof p=="string"?null:p.state,g===0?"default":void 0,typeof p=="string"?void 0:p.mask));let i=c(n??a.length-1),o="POP",l=null;function c(p){return Math.min(Math.max(p,0),a.length-1)}function d(){return a[i]}function u(p,g=null,x,b){let y=kd(a?d().pathname:"/",p,g,x,b);return mt(y.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(p)}`),y}function m(p){return typeof p=="string"?p:bs(p)}return{get index(){return i},get action(){return o},get location(){return d()},createHref:m,createURL(p){return new URL(m(p),"http://localhost")},encodeLocation(p){let g=typeof p=="string"?On(p):p;return{pathname:g.pathname||"",search:g.search||"",hash:g.hash||""}},push(p,g){o="PUSH";let x=mo(p)?p:u(p,g);i+=1,a.splice(i,a.length,x),r&&l&&l({action:o,location:x,delta:1})},replace(p,g){o="REPLACE";let x=mo(p)?p:u(p,g);a[i]=x,r&&l&&l({action:o,location:x,delta:0})},go(p){o="POP";let g=c(i+p),x=a[g];i=g,l&&l({action:o,location:x,delta:p})},listen(p){return l=p,()=>{l=null}}}}function Ee(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function mt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Sd(){return Math.random().toString(36).substring(2,10)}function kd(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?On(t):t,state:n,key:t&&t.key||r||Sd(),mask:a}}function bs({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function On(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Ml(e,t,n="/"){return Cd(e,t,n,!1)}function Cd(e,t,n,r,a){let i=typeof t=="string"?On(t):t,o=Gt(i.pathname||"/",n);if(o==null)return null;let l=Ad(e),c=null,d=Od(o);for(let u=0;c==null&&u<l.length;++u)c=$d(l[u],d,r);return c}function Ad(e){let t=ql(e);return Pd(t),t}function ql(e,t=[],n=[],r="",a=!1){let i=(o,l,c=a,d)=>{let u={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&c)return;Ee(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let m=At([r,u.relativePath]),h=n.concat(u);o.children&&o.children.length>0&&(Ee(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),ql(o.children,t,h,m,c)),!(o.path==null&&!o.index)&&t.push({path:m,score:Rd(m,o.index),routesMeta:h.map((p,g)=>{let[x,b]=Ul(p.relativePath,p.caseSensitive,g===h.length-1);return{...p,matcher:x,compiledParams:b}})})};return e.forEach((o,l)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,l);else for(let d of Bl(o.path))i(o,l,!0,d)}),t}function Bl(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=Bl(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Pd(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Ld(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Ed=/^:[\w-]+$/,Id=3,Td=2,_d=1,Dd=10,Fd=-2,ho=e=>e==="*";function Rd(e,t){let n=e.split("/"),r=n.length;return n.some(ho)&&(r+=Fd),t&&(r+=Td),n.filter(a=>!ho(a)).reduce((a,i)=>a+(Ed.test(i)?Id:i===""?_d:Dd),r)}function Ld(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function $d(e,t,n=!1){let{routesMeta:r}=e,a={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,u=i==="/"?t:t.slice(i.length)||"/",m={path:c.relativePath,caseSensitive:c.caseSensitive,end:d},h=c.matcher&&c.compiledParams?Vl(m,u,c.matcher,c.compiledParams):vs(m,u),p=c.route;if(!h&&d&&n&&!r[r.length-1].route.index&&(h=vs({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!h)return null;Object.assign(a,h.params),o.push({params:a,pathname:At([i,h.pathname]),pathnameBase:qd(At([i,h.pathnameBase])),route:p}),h.pathnameBase!=="/"&&(i=At([i,h.pathnameBase]))}return o}function vs(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ul(e.path,e.caseSensitive,e.end);return Vl(e,t,n,r)}function Vl(e,t,n,r){let a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((d,{paramName:u,isOptional:m},h)=>{if(u==="*"){let g=l[h]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const p=l[h];return m&&!p?d[u]=void 0:d[u]=(p||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function Ul(e,t=!1,n=!0){mt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c,d,u)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let m=u.charAt(d+o.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Od(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return mt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Gt(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function zd(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?On(e):e,i;return n?(n=Zl(n),n.startsWith("/")?i=fo(n.substring(1),"/"):i=fo(n,t)):i=t,{pathname:i,search:Bd(r),hash:Vd(a)}}function fo(e,t){let n=js(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function aa(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Md(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function oi(e){let t=Md(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function $s(e,t,n,r=!1){let a;typeof e=="string"?a=On(e):(a={...e},Ee(!a.pathname||!a.pathname.includes("?"),aa("?","pathname","search",a)),Ee(!a.pathname||!a.pathname.includes("#"),aa("#","pathname","hash",a)),Ee(!a.search||!a.search.includes("#"),aa("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=n;else{let m=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),m-=1;a.pathname=h.join("/")}l=m>=0?t[m]:"/"}let c=zd(a,l),d=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var Zl=e=>e.replace(/[\\/]{2,}/g,"/"),At=e=>Zl(e.join("/")),js=e=>e.replace(/\/+$/,""),qd=e=>js(e).replace(/^\/*/,"/"),Bd=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Vd=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ud=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Zd(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Wd(e){let t=e.map(n=>n.route.path).filter(Boolean);return At(t)||"/"}var Wl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Yl(e,t){let n=e;if(typeof n!="string"||!ii.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Wl)try{let i=new URL(window.location.href),o=jd.test(n)?new URL(wd(n,i.protocol)):new URL(n),l=Gt(o.pathname,t);o.origin===i.origin&&l!=null?n=l+o.search+o.hash:a=!0}catch{mt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Hl=["POST","PUT","PATCH","DELETE"];new Set(Hl);var Yd=["GET",...Hl];new Set(Yd);var Hd=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Kd(e){try{return Hd.includes(new URL(e).protocol)}catch{return!1}}var hr=P.createContext(null);hr.displayName="DataRouter";var Os=P.createContext(null);Os.displayName="DataRouterState";var Kl=P.createContext(!1);function Qd(){return P.useContext(Kl)}var Ql=P.createContext({isTransitioning:!1});Ql.displayName="ViewTransition";var Jd=P.createContext(new Map);Jd.displayName="Fetchers";var Gd=P.createContext(null);Gd.displayName="Await";var ht=P.createContext(null);ht.displayName="Navigation";var Br=P.createContext(null);Br.displayName="Location";var yt=P.createContext({outlet:null,matches:[],isDataRoute:!1});yt.displayName="Route";var li=P.createContext(null);li.displayName="RouteError";var Jl="REACT_ROUTER_ERROR",Xd="REDIRECT",em="ROUTE_ERROR_RESPONSE";function tm(e){if(e.startsWith(`${Jl}:${Xd}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function nm(e){if(e.startsWith(`${Jl}:${em}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ud(t.status,t.statusText,t.data)}catch{}}function rm(e,{relative:t}={}){Ee(fr(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=P.useContext(ht),{hash:a,pathname:i,search:o}=Vr(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:At([n,i])),r.createHref({pathname:l,search:o,hash:a})}function fr(){return P.useContext(Br)!=null}function Se(){return Ee(fr(),"useLocation() may be used only in the context of a <Router> component."),P.useContext(Br).location}var Gl="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Xl(e){P.useContext(ht).static||P.useLayoutEffect(e)}function ke(){let{isDataRoute:e}=P.useContext(yt);return e?gm():sm()}function sm(){Ee(fr(),"useNavigate() may be used only in the context of a <Router> component.");let e=P.useContext(hr),{basename:t,navigator:n}=P.useContext(ht),{matches:r}=P.useContext(yt),{pathname:a}=Se(),i=JSON.stringify(oi(r)),o=P.useRef(!1);return Xl(()=>{o.current=!0}),P.useCallback((c,d={})=>{if(mt(o.current,Gl),!o.current)return;if(typeof c=="number"){n.go(c);return}let u=$s(c,JSON.parse(i),a,d.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:At([t,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[t,n,i,a,e])}var ec=P.createContext(null);function ft(){return P.useContext(ec)}function am(e){let t=P.useContext(yt).outlet;return P.useMemo(()=>t&&P.createElement(ec.Provider,{value:e},t),[t,e])}function zs(){let{matches:e}=P.useContext(yt),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Vr(e,{relative:t}={}){let{matches:n}=P.useContext(yt),{pathname:r}=Se(),a=JSON.stringify(oi(n));return P.useMemo(()=>$s(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function im(e,t){return tc(e,t)}function tc(e,t,n){var b;Ee(fr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=P.useContext(ht),{matches:a}=P.useContext(yt),i=a[a.length-1],o=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",d=i&&i.route;{let y=d&&d.path||"";rc(l,!d||y.endsWith("*")||y.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${y}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
|
+
*/var pi=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,_d=/^[\\/]{2}/;function $d(e,t){return t+e.replace(/\\/g,"/")}function So(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function em(e={}){let{initialEntries:t=["/"],initialIndex:n,v5Compat:s=!1}=e,a;a=t.map((f,p)=>u(f,typeof f=="string"?null:f.state,p===0?"default":void 0,typeof f=="string"?void 0:f.mask));let i=c(n??a.length-1),o="POP",l=null;function c(f){return Math.min(Math.max(f,0),a.length-1)}function d(){return a[i]}function u(f,p=null,g,y){let C=nm(a?d().pathname:"/",f,p,g,y);return St(C.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(f)}`),C}function h(f){return typeof f=="string"?f:Cs(f)}return{get index(){return i},get action(){return o},get location(){return d()},createHref:h,createURL(f){return new URL(h(f),"http://localhost")},encodeLocation(f){let p=typeof f=="string"?Hn(f):f;return{pathname:p.pathname||"",search:p.search||"",hash:p.hash||""}},push(f,p){o="PUSH";let g=So(f)?f:u(f,p);i+=1,a.splice(i,a.length,g),s&&l&&l({action:o,location:g,delta:1})},replace(f,p){o="REPLACE";let g=So(f)?f:u(f,p);a[i]=g,s&&l&&l({action:o,location:g,delta:0})},go(f){o="POP";let p=c(i+f),g=a[p];i=p,l&&l({action:o,location:g,delta:f})},listen(f){return l=f,()=>{l=null}}}}function Le(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function St(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function tm(){return Math.random().toString(36).substring(2,10)}function nm(e,t,n=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Hn(t):t,state:n,key:t&&t.key||s||tm(),mask:a}}function Cs({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Hn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function ic(e,t,n="/"){return rm(e,t,n,!1)}function rm(e,t,n,s,a){let i=typeof t=="string"?Hn(t):t,o=rn(i.pathname||"/",n);if(o==null)return null;let l=sm(e),c=null,d=pm(o);for(let u=0;c==null&&u<l.length;++u)c=fm(l[u],d,s);return c}function sm(e){let t=oc(e);return am(t),t}function oc(e,t=[],n=[],s="",a=!1){let i=(o,l,c=a,d)=>{let u={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(s)&&c)return;Le(u.relativePath.startsWith(s),`Absolute route path "${u.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(s.length)}let h=qt([s,u.relativePath]),m=n.concat(u);o.children&&o.children.length>0&&(Le(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),oc(o.children,t,m,h,c)),!(o.path==null&&!o.index)&&t.push({path:h,score:mm(h,o.index),routesMeta:m.map((f,p)=>{let[g,y]=uc(f.relativePath,f.caseSensitive,p===m.length-1);return{...f,matcher:g,compiledParams:y}})})};return e.forEach((o,l)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,l);else for(let d of lc(o.path))i(o,l,!0,d)}),t}function lc(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return a?[i,""]:[i];let o=lc(s.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),a&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function am(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:hm(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var im=/^:[\w-]+$/,om=3,lm=2,cm=1,um=10,dm=-2,ko=e=>e==="*";function mm(e,t){let n=e.split("/"),s=n.length;return n.some(ko)&&(s+=dm),t&&(s+=lm),n.filter(a=>!ko(a)).reduce((a,i)=>a+(im.test(i)?om:i===""?cm:um),s)}function hm(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function fm(e,t,n=!1){let{routesMeta:s}=e,a={},i="/",o=[];for(let l=0;l<s.length;++l){let c=s[l],d=l===s.length-1,u=i==="/"?t:t.slice(i.length)||"/",h={path:c.relativePath,caseSensitive:c.caseSensitive,end:d},m=c.matcher&&c.compiledParams?cc(h,u,c.matcher,c.compiledParams):js(h,u),f=c.route;if(!m&&d&&n&&!s[s.length-1].route.index&&(m=js({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!m)return null;Object.assign(a,m.params),o.push({params:a,pathname:qt([i,m.pathname]),pathnameBase:ym(qt([i,m.pathnameBase])),route:f}),m.pathnameBase!=="/"&&(i=qt([i,m.pathnameBase]))}return o}function js(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=uc(e.path,e.caseSensitive,e.end);return cc(e,t,n,s)}function cc(e,t,n,s){let a=t.match(n);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:s.reduce((d,{paramName:u,isOptional:h},m)=>{if(u==="*"){let p=l[m]||"";o=i.slice(0,i.length-p.length).replace(/(.)\/+$/,"$1")}const f=l[m];return h&&!f?d[u]=void 0:d[u]=(f||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function uc(e,t=!1,n=!0){St(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c,d,u)=>{if(s.push({paramName:l,isOptional:c!=null}),c){let h=u.charAt(d+o.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function pm(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return St(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function rn(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}function xm(e,t="/"){let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?Hn(e):e,i;return n?(n=dc(n),n.startsWith("/")?i=Ao(n.substring(1),"/"):i=Ao(n,t)):i=t,{pathname:i,search:bm(s),hash:vm(a)}}function Ao(e,t){let n=ws(t).split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function ua(e,t,n,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function gm(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function xi(e){let t=gm(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function Zs(e,t,n,s=!1){let a;typeof e=="string"?a=Hn(e):(a={...e},Le(!a.pathname||!a.pathname.includes("?"),ua("?","pathname","search",a)),Le(!a.pathname||!a.pathname.includes("#"),ua("#","pathname","hash",a)),Le(!a.search||!a.search.includes("#"),ua("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,l;if(o==null)l=n;else{let h=t.length-1;if(!s&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;a.pathname=m.join("/")}l=h>=0?t[h]:"/"}let c=xm(a,l),d=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}var dc=e=>e.replace(/[\\/]{2,}/g,"/"),qt=e=>dc(e.join("/")),ws=e=>e.replace(/\/+$/,""),ym=e=>ws(e).replace(/^\/*/,"/"),bm=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,vm=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Cm=class{constructor(e,t,n,s=!1){this.status=e,this.statusText=t||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function jm(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function wm(e){let t=e.map(n=>n.route.path).filter(Boolean);return qt(t)||"/"}var mc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hc(e,t){let n=e;if(typeof n!="string"||!pi.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,a=!1;if(mc)try{let i=new URL(window.location.href),o=_d.test(n)?new URL($d(n,i.protocol)):new URL(n),l=rn(o.pathname,t);o.origin===i.origin&&l!=null?n=l+o.search+o.hash:a=!0}catch{St(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fc=["POST","PUT","PATCH","DELETE"];new Set(fc);var Nm=["GET",...fc];new Set(Nm);var Sm=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function km(e){try{return Sm.includes(new URL(e).protocol)}catch{return!1}}var gr=I.createContext(null);gr.displayName="DataRouter";var Us=I.createContext(null);Us.displayName="DataRouterState";var pc=I.createContext(!1);function Am(){return I.useContext(pc)}var xc=I.createContext({isTransitioning:!1});xc.displayName="ViewTransition";var Pm=I.createContext(new Map);Pm.displayName="Fetchers";var Im=I.createContext(null);Im.displayName="Await";var kt=I.createContext(null);kt.displayName="Navigation";var Kr=I.createContext(null);Kr.displayName="Location";var Rt=I.createContext({outlet:null,matches:[],isDataRoute:!1});Rt.displayName="Route";var gi=I.createContext(null);gi.displayName="RouteError";var gc="REACT_ROUTER_ERROR",Em="REDIRECT",Tm="ROUTE_ERROR_RESPONSE";function Lm(e){if(e.startsWith(`${gc}:${Em}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Fm(e){if(e.startsWith(`${gc}:${Tm}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Cm(t.status,t.statusText,t.data)}catch{}}function Rm(e,{relative:t}={}){Le(yr(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=I.useContext(kt),{hash:a,pathname:i,search:o}=Qr(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:qt([n,i])),s.createHref({pathname:l,search:o,hash:a})}function yr(){return I.useContext(Kr)!=null}function Ae(){return Le(yr(),"useLocation() may be used only in the context of a <Router> component."),I.useContext(Kr).location}var yc="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function bc(e){I.useContext(kt).static||I.useLayoutEffect(e)}function Ie(){let{isDataRoute:e}=I.useContext(Rt);return e?Qm():Dm()}function Dm(){Le(yr(),"useNavigate() may be used only in the context of a <Router> component.");let e=I.useContext(gr),{basename:t,navigator:n}=I.useContext(kt),{matches:s}=I.useContext(Rt),{pathname:a}=Ae(),i=JSON.stringify(xi(s)),o=I.useRef(!1);return bc(()=>{o.current=!0}),I.useCallback((c,d={})=>{if(St(o.current,yc),!o.current)return;if(typeof c=="number"){n.go(c);return}let u=Zs(c,JSON.parse(i),a,d.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:qt([t,u.pathname])),(d.replace?n.replace:n.push)(u,d.state,d)},[t,n,i,a,e])}var vc=I.createContext(null);function ht(){return I.useContext(vc)}function Mm(e){let t=I.useContext(Rt).outlet;return I.useMemo(()=>t&&I.createElement(vc.Provider,{value:e},t),[t,e])}function Bs(){let{matches:e}=I.useContext(Rt),t=e[e.length-1];return(t==null?void 0:t.params)??{}}function Qr(e,{relative:t}={}){let{matches:n}=I.useContext(Rt),{pathname:s}=Ae(),a=JSON.stringify(xi(n));return I.useMemo(()=>Zs(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function Om(e,t){return Cc(e,t)}function Cc(e,t,n){var y;Le(yr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=I.useContext(kt),{matches:a}=I.useContext(Rt),i=a[a.length-1],o=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",d=i&&i.route;{let C=d&&d.path||"";wc(l,!d||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
11
11
|
|
|
12
|
-
Please change the parent <Route path="${y}"> to <Route path="${y==="/"?"*":`${y}/*`}">.`)}let u=Se(),m;if(t){let y=typeof t=="string"?On(t):t;Ee(c==="/"||((b=y.pathname)==null?void 0:b.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${y.pathname}" was given in the \`location\` prop.`),m=y}else m=u;let h=m.pathname||"/",p=h;if(c!=="/"){let y=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=n&&n.state.matches.length?n.state.matches.map(y=>Object.assign(y,{route:n.manifest[y.route.id]||y.route})):Ml(e,{pathname:p});mt(d||g!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),mt(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let x=dm(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},o,y.params),pathname:At([c,r.encodeLocation?r.encodeLocation(y.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:At([c,r.encodeLocation?r.encodeLocation(y.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:y.pathnameBase])})),a,n);return t&&x?P.createElement(Br.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},x):x}function om(){let e=xm(),t=Zd(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=P.createElement(P.Fragment,null,P.createElement("p",null,"💿 Hey developer 👋"),P.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",P.createElement("code",{style:i},"ErrorBoundary")," or"," ",P.createElement("code",{style:i},"errorElement")," prop on your route.")),P.createElement(P.Fragment,null,P.createElement("h2",null,"Unexpected Application Error!"),P.createElement("h3",{style:{fontStyle:"italic"}},t),n?P.createElement("pre",{style:a},n):null,o)}var lm=P.createElement(om,null),nc=class extends P.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=nm(e.digest);n&&(e=n)}let t=e!==void 0?P.createElement(yt.Provider,{value:this.props.routeContext},P.createElement(li.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?P.createElement(cm,{error:e},t):t}};nc.contextType=Kl;var ia=new WeakMap;function cm({children:e,error:t}){let{basename:n}=P.useContext(ht);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=tm(t.digest);if(r){let a=ia.get(t);if(a)throw a;let i=Yl(r.location,n),o=i.absoluteURL||i.to;if(Kd(o))throw new Error("Invalid redirect location");if(Wl&&!ia.get(t))if(i.isExternal||r.reloadDocument)window.location.href=o;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw ia.set(t,l),l}return P.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function um({routeContext:e,match:t,children:n}){let r=P.useContext(hr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),P.createElement(yt.Provider,{value:e},n)}function dm(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,i=r==null?void 0:r.errors;if(i!=null){let u=a.findIndex(m=>m.route.id&&(i==null?void 0:i[m.route.id])!==void 0);Ee(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let o=!1,l=-1;if(n&&r){o=r.renderFallback;for(let u=0;u<a.length;u++){let m=a[u];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(l=u),m.route.id){let{loaderData:h,errors:p}=r,g=m.route.loader&&!h.hasOwnProperty(m.route.id)&&(!p||p[m.route.id]===void 0);if(m.route.lazy||g){n.isStatic&&(o=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=r&&c?(u,m)=>{var h,p;c(u,{location:r.location,params:((p=(h=r.matches)==null?void 0:h[0])==null?void 0:p.params)??{},pattern:Wd(r.matches),errorInfo:m})}:void 0;return a.reduceRight((u,m,h)=>{let p,g=!1,x=null,b=null;r&&(p=i&&m.route.id?i[m.route.id]:void 0,x=m.route.errorElement||lm,o&&(l<0&&h===0?(rc("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,b=null):l===h&&(g=!0,b=m.route.hydrateFallbackElement||null)));let y=t.concat(a.slice(0,h+1)),C=()=>{let j;return p?j=x:g?j=b:m.route.Component?j=P.createElement(m.route.Component,null):m.route.element?j=m.route.element:j=u,P.createElement(um,{match:m,routeContext:{outlet:u,matches:y,isDataRoute:r!=null},children:j})};return r&&(m.route.ErrorBoundary||m.route.errorElement||h===0)?P.createElement(nc,{location:r.location,revalidation:r.revalidation,component:x,error:p,children:C(),routeContext:{outlet:null,matches:y,isDataRoute:!0},onError:d}):C()},null)}function ci(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mm(e){let t=P.useContext(hr);return Ee(t,ci(e)),t}function hm(e){let t=P.useContext(Os);return Ee(t,ci(e)),t}function fm(e){let t=P.useContext(yt);return Ee(t,ci(e)),t}function ui(e){let t=fm(e),n=t.matches[t.matches.length-1];return Ee(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function pm(){return ui("useRouteId")}function xm(){var r;let e=P.useContext(li),t=hm("useRouteError"),n=ui("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function gm(){let{router:e}=mm("useNavigate"),t=ui("useNavigate"),n=P.useRef(!1);return Xl(()=>{n.current=!0}),P.useCallback(async(a,i={})=>{mt(n.current,Gl),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var po={};function rc(e,t,n){!t&&!po[e]&&(po[e]=!0,mt(!1,n))}P.memo(ym);function ym({routes:e,manifest:t,future:n,state:r,isStatic:a,onError:i}){return tc(e,void 0,{manifest:t,state:r,isStatic:a,onError:i})}function bm({basename:e,children:t,initialEntries:n,initialIndex:r,useTransitions:a}){let i=P.useRef();i.current==null&&(i.current=Nd({initialEntries:n,initialIndex:r,v5Compat:!0}));let o=i.current,[l,c]=P.useState({action:o.action,location:o.location}),d=P.useCallback(u=>{a===!1?c(u):P.startTransition(()=>c(u))},[a]);return P.useLayoutEffect(()=>o.listen(d),[o,d]),P.createElement(jm,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,useTransitions:a})}function Be({to:e,replace:t,state:n,relative:r}){Ee(fr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=P.useContext(ht);mt(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=P.useContext(yt),{pathname:o}=Se(),l=ke(),c=$s(e,oi(i),o,r==="path"),d=JSON.stringify(c);return P.useEffect(()=>{l(JSON.parse(d),{replace:t,state:n,relative:r})},[l,d,r,t,n]),null}function vm(e){return am(e.context)}function te(e){Ee(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function jm({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:i=!1,useTransitions:o}){Ee(!fr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=P.useMemo(()=>({basename:l,navigator:a,static:i,useTransitions:o,future:{}}),[l,a,i,o]);typeof n=="string"&&(n=On(n));let{pathname:d="/",search:u="",hash:m="",state:h=null,key:p="default",mask:g}=n,x=P.useMemo(()=>{let b=Gt(d,l);return b==null?null:{location:{pathname:b,search:u,hash:m,state:h,key:p,mask:g},navigationType:r}},[l,d,u,m,h,p,r,g]);return mt(x!=null,`<Router basename="${l}"> is not able to match the URL "${d}${u}${m}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:P.createElement(ht.Provider,{value:c},P.createElement(Br.Provider,{children:t,value:x}))}function di({children:e,location:t}){return im(Sa(e),t)}function Sa(e,t=[]){let n=[];return P.Children.forEach(e,(r,a)=>{if(!P.isValidElement(r))return;let i=[...t,a];if(r.type===P.Fragment){n.push.apply(n,Sa(r.props.children,i));return}Ee(r.type===te,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Ee(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Sa(r.props.children,i)),n.push(o)}),n}var fs="get",ps="application/x-www-form-urlencoded";function Ms(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function wm(e){return Ms(e)&&e.tagName.toLowerCase()==="button"}function Nm(e){return Ms(e)&&e.tagName.toLowerCase()==="form"}function Sm(e){return Ms(e)&&e.tagName.toLowerCase()==="input"}function km(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Cm(e,t){return e.button===0&&(!t||t==="_self")&&!km(e)}function ka(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function Am(e,t){let n=ka(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}var ts=null;function Pm(){if(ts===null)try{new FormData(document.createElement("form"),0),ts=!1}catch{ts=!0}return ts}var Em=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function oa(e){return e!=null&&!Em.has(e)?(mt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ps}"`),null):e}function Im(e,t){let n,r,a,i,o;if(Nm(e)){let l=e.getAttribute("action");r=l?Gt(l,t):null,n=e.getAttribute("method")||fs,a=oa(e.getAttribute("enctype"))||ps,i=new FormData(e)}else if(wm(e)||Sm(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?Gt(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||fs,a=oa(e.getAttribute("formenctype"))||oa(l.getAttribute("enctype"))||ps,i=new FormData(l,e),!Pm()){let{name:d,type:u,value:m}=e;if(u==="image"){let h=d?`${d}.`:"";i.append(`${h}x`,"0"),i.append(`${h}y`,"0")}else d&&i.append(d,m)}}else{if(Ms(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=fs,r=null,a=ps,o=e}return i&&a==="text/plain"&&(o=i,i=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function mi(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sc(e,t,n,r){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:t&&Gt(a.pathname,t)==="/"?a.pathname=`${js(t)}/_root.${r}`:a.pathname=`${js(a.pathname)}.${r}`,a}async function Tm(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function _m(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Dm(e,t,n){let r=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let o=await Tm(i,n);return o.links?o.links():[]}return[]}));return $m(r.flat(1).filter(_m).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function xo(e,t,n,r,a,i){let o=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>{var u;return n[d].pathname!==c.pathname||((u=n[d].route.path)==null?void 0:u.endsWith("*"))&&n[d].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,d)=>o(c,d)||l(c,d)):i==="data"?t.filter((c,d)=>{var m;let u=r.routes[c.route.id];if(!u||!u.hasLoader)return!1;if(o(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let h=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function Fm(e,t,{includeHydrateFallback:n}={}){return Rm(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function Rm(e){return[...new Set(e)]}function Lm(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function $m(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let i=JSON.stringify(Lm(a));return n.has(i)||(n.add(i),r.push({key:i,link:a})),r},[])}function hi(){let e=P.useContext(hr);return mi(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Om(){let e=P.useContext(Os);return mi(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var fi=P.createContext(void 0);fi.displayName="FrameworkContext";function qs(){let e=P.useContext(fi);return mi(e,"You must render this element inside a <HydratedRouter> element"),e}function zm(e,t){let n=P.useContext(fi),[r,a]=P.useState(!1),[i,o]=P.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:u,onTouchStart:m}=t,h=P.useRef(null);P.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let x=y=>{y.forEach(C=>{o(C.isIntersecting)})},b=new IntersectionObserver(x,{threshold:.5});return h.current&&b.observe(h.current),()=>{b.disconnect()}}},[e]),P.useEffect(()=>{if(r){let x=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(x)}}},[r]);let p=()=>{a(!0)},g=()=>{a(!1),o(!1)};return n?e!=="intent"?[i,h,{}]:[i,h,{onFocus:wr(l,p),onBlur:wr(c,g),onMouseEnter:wr(d,p),onMouseLeave:wr(u,g),onTouchStart:wr(m,p)}]:[!1,h,{}]}function wr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Mm({page:e,...t}){let n=Qd(),{nonce:r}=qs(),{router:a}=hi(),i=P.useMemo(()=>Ml(a.routes,e,a.basename),[a.routes,e,a.basename]);return i?(t.nonce==null&&r&&(t={...t,nonce:r}),n?P.createElement(Bm,{page:e,matches:i,...t}):P.createElement(Vm,{page:e,matches:i,...t})):null}function qm(e){let{manifest:t,routeModules:n}=qs(),[r,a]=P.useState([]);return P.useEffect(()=>{let i=!1;return Dm(e,t,n).then(o=>{i||a(o)}),()=>{i=!0}},[e,t,n]),r}function Bm({page:e,matches:t,...n}){let r=Se(),{future:a}=qs(),{basename:i}=hi(),o=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let l=sc(e,i,a.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,d=[];for(let u of t)typeof u.route.shouldRevalidate=="function"?c=!0:d.push(u.route.id);return c&&d.length>0&&l.searchParams.set("_routes",d.join(",")),[l.pathname+l.search]},[i,a.v8_trailingSlashAwareDataRequests,e,r,t]);return P.createElement(P.Fragment,null,o.map(l=>P.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...n})))}function Vm({page:e,matches:t,...n}){let r=Se(),{future:a,manifest:i,routeModules:o}=qs(),{basename:l}=hi(),{loaderData:c,matches:d}=Om(),u=P.useMemo(()=>xo(e,t,d,i,r,"data"),[e,t,d,i,r]),m=P.useMemo(()=>xo(e,t,d,i,r,"assets"),[e,t,d,i,r]),h=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let x=new Set,b=!1;if(t.forEach(C=>{var S;let j=i.routes[C.route.id];!j||!j.hasLoader||(!u.some(I=>I.route.id===C.route.id)&&C.route.id in c&&((S=o[C.route.id])!=null&&S.shouldRevalidate)||j.hasClientLoader?b=!0:x.add(C.route.id))}),x.size===0)return[];let y=sc(e,l,a.v8_trailingSlashAwareDataRequests,"data");return b&&x.size>0&&y.searchParams.set("_routes",t.filter(C=>x.has(C.route.id)).map(C=>C.route.id).join(",")),[y.pathname+y.search]},[l,a.v8_trailingSlashAwareDataRequests,c,r,i,u,t,e,o]),p=P.useMemo(()=>Fm(m,i),[m,i]),g=qm(m);return P.createElement(P.Fragment,null,h.map(x=>P.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),p.map(x=>P.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),g.map(({key:x,link:b})=>P.createElement("link",{key:x,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function Um(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Zm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Zm&&(window.__reactRouterVersion="7.18.1")}catch{}var ac=P.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:i,replace:o,mask:l,state:c,target:d,to:u,preventScrollReset:m,viewTransition:h,defaultShouldRevalidate:p,...g},x){let{basename:b,navigator:y,useTransitions:C}=P.useContext(ht),j=typeof u=="string"&&ii.test(u),S=Yl(u,b);u=S.to;let I=rm(u,{relative:a}),F=Se(),E=null;if(l){let Z=$s(l,[],F.mask?F.mask.pathname:"/",!0);b!=="/"&&(Z.pathname=Z.pathname==="/"?b:At([b,Z.pathname])),E=y.createHref(Z)}let[T,O,V]=zm(r,g),Q=Km(u,{replace:o,mask:l,state:c,target:d,preventScrollReset:m,relative:a,viewTransition:h,defaultShouldRevalidate:p,useTransitions:C});function X(Z){t&&t(Z),Z.defaultPrevented||Q(Z)}let H=!(S.isExternal||i),U=P.createElement("a",{...g,...V,href:(H?E:void 0)||S.absoluteURL||I,onClick:H?X:t,ref:Um(x,O),target:d,"data-discover":!j&&n==="render"?"true":void 0});return T&&!j?P.createElement(P.Fragment,null,U,P.createElement(Mm,{page:I})):U});ac.displayName="Link";var Wm=P.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:i,to:o,viewTransition:l,children:c,...d},u){let m=Vr(o,{relative:d.relative}),h=Se(),p=P.useContext(Os),{navigator:g,basename:x}=P.useContext(ht),b=p!=null&&th(m)&&l===!0,y=g.encodeLocation?g.encodeLocation(m).pathname:m.pathname,C=h.pathname,j=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(C=C.toLowerCase(),j=j?j.toLowerCase():null,y=y.toLowerCase()),j&&x&&(j=Gt(j,x)||j);const S=y!=="/"&&y.endsWith("/")?y.length-1:y.length;let I=C===y||!a&&C.startsWith(y)&&C.charAt(S)==="/",F=j!=null&&(j===y||!a&&j.startsWith(y)&&j.charAt(y.length)==="/"),E={isActive:I,isPending:F,isTransitioning:b},T=I?t:void 0,O;typeof r=="function"?O=r(E):O=[r,I?"active":null,F?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let V=typeof i=="function"?i(E):i;return P.createElement(ac,{...d,"aria-current":T,className:O,ref:u,style:V,to:o,viewTransition:l},typeof c=="function"?c(E):c)});Wm.displayName="NavLink";var Ym=P.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:i,method:o=fs,action:l,onSubmit:c,relative:d,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:h,...p},g)=>{let{useTransitions:x}=P.useContext(ht),b=Xm(),y=eh(l,{relative:d}),C=o.toLowerCase()==="get"?"get":"post",j=typeof l=="string"&&ii.test(l),S=I=>{if(c&&c(I),I.defaultPrevented)return;I.preventDefault();let F=I.nativeEvent.submitter,E=(F==null?void 0:F.getAttribute("formmethod"))||o,T=()=>b(F||I.currentTarget,{fetcherKey:t,method:E,navigate:n,replace:a,state:i,relative:d,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:h});x&&n!==!1?P.startTransition(()=>T()):T()};return P.createElement("form",{ref:g,method:C,action:y,onSubmit:r?c:S,...p,"data-discover":!j&&e==="render"?"true":void 0})});Ym.displayName="Form";function Hm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ic(e){let t=P.useContext(hr);return Ee(t,Hm(e)),t}function Km(e,{target:t,replace:n,mask:r,state:a,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c,useTransitions:d}={}){let u=ke(),m=Se(),h=Vr(e,{relative:o});return P.useCallback(p=>{if(Cm(p,t)){p.preventDefault();let g=n!==void 0?n:bs(m)===bs(h),x=()=>u(e,{replace:g,mask:r,state:a,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c});d?P.startTransition(()=>x()):x()}},[m,u,h,n,r,a,t,e,i,o,l,c,d])}function Qm(e){mt(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=P.useRef(ka(e)),n=P.useRef(!1),r=Se(),a=P.useMemo(()=>Am(r.search,n.current?null:t.current),[r.search]),i=ke(),o=P.useCallback((l,c)=>{const d=ka(typeof l=="function"?l(new URLSearchParams(a)):l);n.current=!0,i("?"+d,c)},[i,a]);return[a,o]}var Jm=0,Gm=()=>`__${String(++Jm)}__`;function Xm(){let{router:e}=ic("useSubmit"),{basename:t}=P.useContext(ht),n=pm(),r=e.fetch,a=e.navigate;return P.useCallback(async(i,o={})=>{let{action:l,method:c,encType:d,formData:u,body:m}=Im(i,t);if(o.navigate===!1){let h=o.fetcherKey||Gm();await r(h,n,o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:m,formMethod:o.method||c,formEncType:o.encType||d,flushSync:o.flushSync})}else await a(o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:m,formMethod:o.method||c,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,a,t,n])}function eh(e,{relative:t}={}){let{basename:n}=P.useContext(ht),r=P.useContext(yt);Ee(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),i={...Vr(e||".",{relative:t})},o=Se();if(e==null){i.search=o.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(u=>u==="")){l.delete("index"),c.filter(m=>m).forEach(m=>l.append("index",m));let u=l.toString();i.search=u?`?${u}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:At([n,i.pathname])),bs(i)}function th(e,{relative:t}={}){let n=P.useContext(Ql);Ee(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ic("useViewTransitionState"),a=Vr(e,{relative:t});if(!n.isTransitioning)return!1;let i=Gt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Gt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return vs(a.pathname,o)!=null||vs(a.pathname,i)!=null}var pr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Nn,sn,Kn,El,nh=(El=class extends pr{constructor(){super();ee(this,Nn);ee(this,sn);ee(this,Kn);Y(this,Kn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){w(this,sn)||this.setEventListener(w(this,Kn))}onUnsubscribe(){var t;this.hasListeners()||((t=w(this,sn))==null||t.call(this),Y(this,sn,void 0))}setEventListener(t){var n;Y(this,Kn,t),(n=w(this,sn))==null||n.call(this),Y(this,sn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){w(this,Nn)!==t&&(Y(this,Nn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof w(this,Nn)=="boolean"?w(this,Nn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Nn=new WeakMap,sn=new WeakMap,Kn=new WeakMap,El),pi=new nh,rh={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_t,Sn,Il,sh=(Il=class{constructor(){ee(this,_t,rh);ee(this,Sn,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&w(this,Sn)&&e!==w(this,_t)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:w(this,_t),provider:e}),Y(this,_t,e),process.env.NODE_ENV!=="production"&&Y(this,Sn,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Sn,!0),w(this,_t).setTimeout(e,t)}clearTimeout(e){w(this,_t).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&Y(this,Sn,!0),w(this,_t).setInterval(e,t)}clearInterval(e){w(this,_t).clearInterval(e)}},_t=new WeakMap,Sn=new WeakMap,Il),jn=new sh;function ah(e){setTimeout(e,0)}var ih=typeof window>"u"||"Deno"in globalThis;function tt(){}function oh(e,t){return typeof e=="function"?e(t):e}function Ca(e){return typeof e=="number"&&e>=0&&e!==1/0}function oc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function pn(e,t){return typeof e=="function"?e(t):e}function lt(e,t){return typeof e=="function"?e(t):e}function go(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==xi(o,t.options))return!1}else if(!_r(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function yo(e,t){const{exact:n,status:r,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Dn(t.options.mutationKey)!==Dn(i))return!1}else if(!_r(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function xi(e,t){return((t==null?void 0:t.queryKeyHashFn)||Dn)(e)}function Dn(e){return JSON.stringify(e,(t,n)=>Pa(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function _r(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>_r(e[n],t[n])):!1}var lh=Object.prototype.hasOwnProperty;function Aa(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=bo(e)&&bo(t);if(!r&&!(Pa(e)&&Pa(t)))return t;const i=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),l=o.length,c=r?new Array(l):{};let d=0;for(let u=0;u<l;u++){const m=r?u:o[u],h=e[m],p=t[m];if(h===p){c[m]=h,(r?u<i:lh.call(e,m))&&d++;continue}if(h===null||p===null||typeof h!="object"||typeof p!="object"){c[m]=p;continue}const g=Aa(h,p,n+1);c[m]=g,g===h&&d++}return i===l&&d===i?e:c}function ws(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function bo(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Pa(e){if(!vo(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!vo(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vo(e){return Object.prototype.toString.call(e)==="[object Object]"}function ch(e){return new Promise(t=>{jn.setTimeout(t,e)})}function Ea(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Aa(e,t)}catch(r){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`),r}return Aa(e,t)}return t}function uh(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function dh(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ns=Symbol();function lc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ns&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ns?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gi(e,t){return typeof e=="function"?e(...t):!!e}function mh(e,t,n){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var Dr=(()=>{let e=()=>ih;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ia(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var hh=ah;function fh(){let e=[],t=0,n=l=>{l()},r=l=>{l()},a=hh;const i=l=>{t?e.push(l):a(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&a(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{a=l}}}var ze=fh(),Qn,an,Jn,Tl,ph=(Tl=class extends pr{constructor(){super();ee(this,Qn,!0);ee(this,an);ee(this,Jn);Y(this,Jn,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){w(this,an)||this.setEventListener(w(this,Jn))}onUnsubscribe(){var t;this.hasListeners()||((t=w(this,an))==null||t.call(this),Y(this,an,void 0))}setEventListener(t){var n;Y(this,Jn,t),(n=w(this,an))==null||n.call(this),Y(this,an,t(this.setOnline.bind(this)))}setOnline(t){w(this,Qn)!==t&&(Y(this,Qn,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return w(this,Qn)}},Qn=new WeakMap,an=new WeakMap,Jn=new WeakMap,Tl),Ss=new ph;function xh(e){return Math.min(1e3*2**e,3e4)}function cc(e){return(e??"online")==="online"?Ss.isOnline():!0}var Ta=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function uc(e){let t=!1,n=0,r;const a=Ia(),i=()=>a.status!=="pending",o=x=>{var b;if(!i()){const y=new Ta(x);h(y),(b=e.onCancel)==null||b.call(e,y)}},l=()=>{t=!0},c=()=>{t=!1},d=()=>pi.isFocused()&&(e.networkMode==="always"||Ss.isOnline())&&e.canRun(),u=()=>cc(e.networkMode)&&e.canRun(),m=x=>{i()||(r==null||r(),a.resolve(x))},h=x=>{i()||(r==null||r(),a.reject(x))},p=()=>new Promise(x=>{var b;r=y=>{(i()||d())&&x(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var x;r=void 0,i()||(x=e.onContinue)==null||x.call(e)}),g=()=>{if(i())return;let x;const b=n===0?e.initialPromise:void 0;try{x=b??e.fn()}catch(y){x=Promise.reject(y)}Promise.resolve(x).then(m).catch(y=>{var F;if(i())return;const C=e.retry??(Dr.isServer()?0:3),j=e.retryDelay??xh,S=typeof j=="function"?j(n,y):j,I=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,y);if(t||!I){h(y);return}n++,(F=e.onFail)==null||F.call(e,n,y),ch(S).then(()=>d()?void 0:p()).then(()=>{t?h(y):g()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(r==null||r(),a),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?g():p().then(g),a)}}var kn,_l,dc=(_l=class{constructor(){ee(this,kn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ca(this.gcTime)&&Y(this,kn,jn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Dr.isServer()?1/0:300*1e3))}clearGcTimeout(){w(this,kn)!==void 0&&(jn.clearTimeout(w(this,kn)),Y(this,kn,void 0))}},kn=new WeakMap,_l);function gh(e){return{onFetch:(t,n)=>{var u,m,h,p,g;const r=t.options,a=(h=(m=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:m.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let x=!1;const b=j=>{mh(j,()=>t.signal,()=>x=!0)},y=lc(t.options,t.fetchOptions),C=async(j,S,I)=>{if(x)return Promise.reject(t.signal.reason);if(S==null&&j.pages.length)return Promise.resolve(j);const E=(()=>{const Q={client:t.client,queryKey:t.queryKey,pageParam:S,direction:I?"backward":"forward",meta:t.options.meta};return b(Q),Q})(),T=await y(E),{maxPages:O}=t.options,V=I?dh:uh;return{pages:V(j.pages,T,O),pageParams:V(j.pageParams,S,O)}};if(a&&i.length){const j=a==="backward",S=j?yh:jo,I={pages:i,pageParams:o},F=S(r,I);l=await C(I,F,j)}else{const j=e??i.length;do{const S=c===0?o[0]??r.initialPageParam:jo(r,l);if(c>0&&S==null)break;l=await C(l,S),c++}while(c<j)}return l};t.options.persister?t.fetchFn=()=>{var x,b;return(b=(x=t.options).persister)==null?void 0:b.call(x,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function jo(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function yh(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Gn,Cn,Xn,gt,An,qe,Lr,Pn,ot,mc,Wt,Dl,bh=(Dl=class extends dc{constructor(t){super();ee(this,ot);ee(this,Gn);ee(this,Cn);ee(this,Xn);ee(this,gt);ee(this,An);ee(this,qe);ee(this,Lr);ee(this,Pn);Y(this,Pn,!1),Y(this,Lr,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,An,t.client),Y(this,gt,w(this,An).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,Cn,No(this.options)),this.state=t.state??w(this,Cn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return w(this,Gn)}get promise(){var t;return(t=w(this,qe))==null?void 0:t.promise}setOptions(t){if(this.options={...w(this,Lr),...t},t!=null&&t._type&&Y(this,Gn,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=No(this.options);n.data!==void 0&&(this.setState(wo(n.data,n.dataUpdatedAt)),Y(this,Cn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&w(this,gt).remove(this)}setData(t,n){const r=Ea(this.state.data,t,this.options);return oe(this,ot,Wt).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){oe(this,ot,Wt).call(this,{type:"setState",state:t})}cancel(t){var r,a;const n=(r=w(this,qe))==null?void 0:r.promise;return(a=w(this,qe))==null||a.cancel(t),n?n.then(tt).catch(tt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return w(this,Cn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>lt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ns||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>pn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!oc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=w(this,qe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=w(this,qe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),w(this,gt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(w(this,qe)&&(w(this,Pn)||oe(this,ot,mc).call(this)?w(this,qe).cancel({revert:!0}):w(this,qe).cancelRetry()),this.scheduleGc()),w(this,gt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||oe(this,ot,Wt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,m,h,p,g,x,b,y,C,j;if(this.state.fetchStatus!=="idle"&&((d=w(this,qe))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(w(this,qe))return w(this,qe).continueRetry(),w(this,qe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(I=>I.options.queryFn);S&&this.setOptions(S.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,a=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(Y(this,Pn,!0),r.signal)})},i=()=>{const S=lc(this.options,n),F=(()=>{const E={client:w(this,An),queryKey:this.queryKey,meta:this.meta};return a(E),E})();return Y(this,Pn,!1),this.options.persister?this.options.persister(S,F,this):S(F)},l=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:w(this,An),state:this.state,fetchFn:i};return a(S),S})(),c=w(this,Gn)==="infinite"?gh(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),Y(this,Xn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&oe(this,ot,Wt).call(this,{type:"fetch",meta:(m=l.fetchOptions)==null?void 0:m.meta}),Y(this,qe,uc({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:S=>{S instanceof Ta&&S.revert&&this.setState({...w(this,Xn),fetchStatus:"idle"}),r.abort()},onFail:(S,I)=>{oe(this,ot,Wt).call(this,{type:"failed",failureCount:S,error:I})},onPause:()=>{oe(this,ot,Wt).call(this,{type:"pause"})},onContinue:()=>{oe(this,ot,Wt).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const S=await w(this,qe).start();if(S===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(S),(p=(h=w(this,gt).config).onSuccess)==null||p.call(h,S,this),(x=(g=w(this,gt).config).onSettled)==null||x.call(g,S,this.state.error,this),S}catch(S){if(S instanceof Ta){if(S.silent)return w(this,qe).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw oe(this,ot,Wt).call(this,{type:"error",error:S}),(y=(b=w(this,gt).config).onError)==null||y.call(b,S,this),(j=(C=w(this,gt).config).onSettled)==null||j.call(C,this.state.data,S,this),S}finally{this.scheduleGc()}}},Gn=new WeakMap,Cn=new WeakMap,Xn=new WeakMap,gt=new WeakMap,An=new WeakMap,qe=new WeakMap,Lr=new WeakMap,Pn=new WeakMap,ot=new WeakSet,mc=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Wt=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...hc(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...wo(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Y(this,Xn,t.manual?a:void 0),a;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),ze.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),w(this,gt).notify({query:this,type:"updated",action:t})})},Dl);function hc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function wo(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function No(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var st,me,$r,et,En,er,Yt,on,Or,tr,nr,In,Tn,ln,rr,ye,Ar,_a,Da,Fa,Ra,La,$a,Oa,fc,Fl,vh=(Fl=class extends pr{constructor(t,n){super();ee(this,ye);ee(this,st);ee(this,me);ee(this,$r);ee(this,et);ee(this,En);ee(this,er);ee(this,Yt);ee(this,on);ee(this,Or);ee(this,tr);ee(this,nr);ee(this,In);ee(this,Tn);ee(this,ln);ee(this,rr,new Set);this.options=n,Y(this,st,t),Y(this,on,null),Y(this,Yt,Ia()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(w(this,me).addObserver(this),So(w(this,me),this.options)?oe(this,ye,Ar).call(this):this.updateResult(),oe(this,ye,Ra).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return za(w(this,me),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return za(w(this,me),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,oe(this,ye,La).call(this),oe(this,ye,$a).call(this),w(this,me).removeObserver(this)}setOptions(t){const n=this.options,r=w(this,me);if(this.options=w(this,st).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof lt(this.options.enabled,w(this,me))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");oe(this,ye,Oa).call(this),w(this,me).setOptions(this.options),n._defaulted&&!ws(this.options,n)&&w(this,st).getQueryCache().notify({type:"observerOptionsUpdated",query:w(this,me),observer:this});const a=this.hasListeners();a&&ko(w(this,me),r,this.options,n)&&oe(this,ye,Ar).call(this),this.updateResult(),a&&(w(this,me)!==r||lt(this.options.enabled,w(this,me))!==lt(n.enabled,w(this,me))||pn(this.options.staleTime,w(this,me))!==pn(n.staleTime,w(this,me)))&&oe(this,ye,_a).call(this);const i=oe(this,ye,Da).call(this);a&&(w(this,me)!==r||lt(this.options.enabled,w(this,me))!==lt(n.enabled,w(this,me))||i!==w(this,ln))&&oe(this,ye,Fa).call(this,i)}getOptimisticResult(t){const n=w(this,st).getQueryCache().build(w(this,st),t),r=this.createResult(n,t);return wh(this,r)&&(Y(this,et,r),Y(this,er,this.options),Y(this,En,w(this,me).state)),r}getCurrentResult(){return w(this,et)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&w(this,Yt).status==="pending"&&w(this,Yt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){w(this,rr).add(t)}getCurrentQuery(){return w(this,me)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=w(this,st).defaultQueryOptions(t),r=w(this,st).getQueryCache().build(w(this,st),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return oe(this,ye,Ar).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),w(this,et)))}createResult(t,n){var O;const r=w(this,me),a=this.options,i=w(this,et),o=w(this,En),l=w(this,er),d=t!==r?t.state:w(this,$r),{state:u}=t;let m={...u},h=!1,p;if(n._optimisticResults){const V=this.hasListeners(),Q=!V&&So(t,n),X=V&&ko(t,r,n,a);(Q||X)&&(m={...m,...hc(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:g,errorUpdatedAt:x,status:b}=m;p=m.data;let y=!1;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let V;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(V=i.data,y=!0):V=typeof n.placeholderData=="function"?n.placeholderData((O=w(this,nr))==null?void 0:O.state.data,w(this,nr)):n.placeholderData,V!==void 0&&(b="success",p=Ea(i==null?void 0:i.data,V,n),h=!0)}if(n.select&&p!==void 0&&!y)if(i&&p===(o==null?void 0:o.data)&&n.select===w(this,Or))p=w(this,tr);else try{Y(this,Or,n.select),p=n.select(p),p=Ea(i==null?void 0:i.data,p,n),Y(this,tr,p),Y(this,on,null)}catch(V){Y(this,on,V)}w(this,on)&&(g=w(this,on),p=w(this,tr),x=Date.now(),b="error");const C=m.fetchStatus==="fetching",j=b==="pending",S=b==="error",I=j&&C,F=p!==void 0,T={status:b,fetchStatus:m.fetchStatus,isPending:j,isSuccess:b==="success",isError:S,isInitialLoading:I,isLoading:I,data:p,dataUpdatedAt:m.dataUpdatedAt,error:g,errorUpdatedAt:x,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:C,isRefetching:C&&!j,isLoadingError:S&&!F,isPaused:m.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:S&&F,isStale:yi(t,n),refetch:this.refetch,promise:w(this,Yt),isEnabled:lt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const V=T.data!==void 0,Q=T.status==="error"&&!V,X=Z=>{Q?Z.reject(T.error):V&&Z.resolve(T.data)},H=()=>{const Z=Y(this,Yt,T.promise=Ia());X(Z)},U=w(this,Yt);switch(U.status){case"pending":t.queryHash===r.queryHash&&X(U);break;case"fulfilled":(Q||T.data!==U.value)&&H();break;case"rejected":(!Q||T.error!==U.reason)&&H();break}}return T}updateResult(){const t=w(this,et),n=this.createResult(w(this,me),this.options);if(Y(this,En,w(this,me).state),Y(this,er,this.options),w(this,En).data!==void 0&&Y(this,nr,w(this,me)),ws(n,t))return;Y(this,et,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!w(this,rr).size)return!0;const o=new Set(i??w(this,rr));return this.options.throwOnError&&o.add("error"),Object.keys(w(this,et)).some(l=>{const c=l;return w(this,et)[c]!==t[c]&&o.has(c)})};oe(this,ye,fc).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&oe(this,ye,Ra).call(this)}},st=new WeakMap,me=new WeakMap,$r=new WeakMap,et=new WeakMap,En=new WeakMap,er=new WeakMap,Yt=new WeakMap,on=new WeakMap,Or=new WeakMap,tr=new WeakMap,nr=new WeakMap,In=new WeakMap,Tn=new WeakMap,ln=new WeakMap,rr=new WeakMap,ye=new WeakSet,Ar=function(t){oe(this,ye,Oa).call(this);let n=w(this,me).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(tt)),n},_a=function(){oe(this,ye,La).call(this);const t=pn(this.options.staleTime,w(this,me));if(Dr.isServer()||w(this,et).isStale||!Ca(t))return;const r=oc(w(this,et).dataUpdatedAt,t)+1;Y(this,In,jn.setTimeout(()=>{w(this,et).isStale||this.updateResult()},r))},Da=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(w(this,me)):this.options.refetchInterval)??!1},Fa=function(t){oe(this,ye,$a).call(this),Y(this,ln,t),!(Dr.isServer()||lt(this.options.enabled,w(this,me))===!1||!Ca(w(this,ln))||w(this,ln)===0)&&Y(this,Tn,jn.setInterval(()=>{(this.options.refetchIntervalInBackground||pi.isFocused())&&oe(this,ye,Ar).call(this)},w(this,ln)))},Ra=function(){oe(this,ye,_a).call(this),oe(this,ye,Fa).call(this,oe(this,ye,Da).call(this))},La=function(){w(this,In)!==void 0&&(jn.clearTimeout(w(this,In)),Y(this,In,void 0))},$a=function(){w(this,Tn)!==void 0&&(jn.clearInterval(w(this,Tn)),Y(this,Tn,void 0))},Oa=function(){const t=w(this,st).getQueryCache().build(w(this,st),this.options);if(t===w(this,me))return;const n=w(this,me);Y(this,me,t),Y(this,$r,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},fc=function(t){ze.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(w(this,et))}),w(this,st).getQueryCache().notify({query:w(this,me),type:"observerResultsUpdated"})})},Fl);function jh(e,t){return lt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&<(t.retryOnMount,e)===!1)}function So(e,t){return jh(e,t)||e.state.data!==void 0&&za(e,t,t.refetchOnMount)}function za(e,t,n){if(lt(t.enabled,e)!==!1&&pn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&yi(e,t)}return!1}function ko(e,t,n,r){return(e!==t||lt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&yi(e,n)}function yi(e,t){return lt(t.enabled,e)!==!1&&e.isStaleByTime(pn(t.staleTime,e))}function wh(e,t){return!ws(e.getCurrentResult(),t)}var zr,Dt,He,_n,Ft,tn,Rl,Nh=(Rl=class extends dc{constructor(t){super();ee(this,Ft);ee(this,zr);ee(this,Dt);ee(this,He);ee(this,_n);Y(this,zr,t.client),this.mutationId=t.mutationId,Y(this,He,t.mutationCache),Y(this,Dt,[]),this.state=t.state||pc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){w(this,Dt).includes(t)||(w(this,Dt).push(t),this.clearGcTimeout(),w(this,He).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,Dt,w(this,Dt).filter(n=>n!==t)),this.scheduleGc(),w(this,He).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){w(this,Dt).length||(this.state.status==="pending"?this.scheduleGc():w(this,He).remove(this))}continue(){var t;return((t=w(this,_n))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,d,u,m,h,p,g,x,b,y,C,j,S,I,F,E;const n=()=>{oe(this,Ft,tn).call(this,{type:"continue"})},r={client:w(this,zr),meta:this.options.meta,mutationKey:this.options.mutationKey};Y(this,_n,uc({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(T,O)=>{oe(this,Ft,tn).call(this,{type:"failed",failureCount:T,error:O})},onPause:()=>{oe(this,Ft,tn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>w(this,He).canRun(this)}));const a=this.state.status==="pending",i=!w(this,_n).canStart();try{if(a)n();else{oe(this,Ft,tn).call(this,{type:"pending",variables:t,isPaused:i}),w(this,He).config.onMutate&&await w(this,He).config.onMutate(t,this,r);const O=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,r));O!==this.state.context&&oe(this,Ft,tn).call(this,{type:"pending",context:O,variables:t,isPaused:i})}const T=await w(this,_n).start();return await((d=(c=w(this,He).config).onSuccess)==null?void 0:d.call(c,T,t,this.state.context,this,r)),await((m=(u=this.options).onSuccess)==null?void 0:m.call(u,T,t,this.state.context,r)),await((p=(h=w(this,He).config).onSettled)==null?void 0:p.call(h,T,null,this.state.variables,this.state.context,this,r)),await((x=(g=this.options).onSettled)==null?void 0:x.call(g,T,null,t,this.state.context,r)),oe(this,Ft,tn).call(this,{type:"success",data:T}),T}catch(T){try{await((y=(b=w(this,He).config).onError)==null?void 0:y.call(b,T,t,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((j=(C=this.options).onError)==null?void 0:j.call(C,T,t,this.state.context,r))}catch(O){Promise.reject(O)}try{await((I=(S=w(this,He).config).onSettled)==null?void 0:I.call(S,void 0,T,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((E=(F=this.options).onSettled)==null?void 0:E.call(F,void 0,T,t,this.state.context,r))}catch(O){Promise.reject(O)}throw oe(this,Ft,tn).call(this,{type:"error",error:T}),T}finally{w(this,He).runNext(this)}}},zr=new WeakMap,Dt=new WeakMap,He=new WeakMap,_n=new WeakMap,Ft=new WeakSet,tn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),ze.batch(()=>{w(this,Dt).forEach(r=>{r.onMutationUpdate(t)}),w(this,He).notify({mutation:this,type:"updated",action:t})})},Rl);function pc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ht,kt,Mr,Ll,Sh=(Ll=class extends pr{constructor(t={}){super();ee(this,Ht);ee(this,kt);ee(this,Mr);this.config=t,Y(this,Ht,new Set),Y(this,kt,new Map),Y(this,Mr,0)}build(t,n,r){const a=new Nh({client:t,mutationCache:this,mutationId:++es(this,Mr)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){w(this,Ht).add(t);const n=ns(t);if(typeof n=="string"){const r=w(this,kt).get(n);r?r.push(t):w(this,kt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(w(this,Ht).delete(t)){const n=ns(t);if(typeof n=="string"){const r=w(this,kt).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&w(this,kt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ns(t);if(typeof n=="string"){const r=w(this,kt).get(n),a=r==null?void 0:r.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=ns(t);if(typeof n=="string"){const a=(r=w(this,kt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ze.batch(()=>{w(this,Ht).forEach(t=>{this.notify({type:"removed",mutation:t})}),w(this,Ht).clear(),w(this,kt).clear()})}getAll(){return Array.from(w(this,Ht))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>yo(n,r))}findAll(t={}){return this.getAll().filter(n=>yo(t,n))}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ze.batch(()=>Promise.all(t.map(n=>n.continue().catch(tt))))}},Ht=new WeakMap,kt=new WeakMap,Mr=new WeakMap,Ll);function ns(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Kt,cn,at,Qt,Jt,xs,Ma,$l,kh=($l=class extends pr{constructor(t,n){super();ee(this,Jt);ee(this,Kt);ee(this,cn);ee(this,at);ee(this,Qt);Y(this,Kt,t),this.setOptions(n),this.bindMethods(),oe(this,Jt,xs).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=w(this,Kt).defaultMutationOptions(t),ws(this.options,n)||w(this,Kt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:w(this,at),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Dn(n.mutationKey)!==Dn(this.options.mutationKey)?this.reset():((r=w(this,at))==null?void 0:r.state.status)==="pending"&&w(this,at).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=w(this,at))==null||t.removeObserver(this)}onMutationUpdate(t){oe(this,Jt,xs).call(this),oe(this,Jt,Ma).call(this,t)}getCurrentResult(){return w(this,cn)}reset(){var t;(t=w(this,at))==null||t.removeObserver(this),Y(this,at,void 0),oe(this,Jt,xs).call(this),oe(this,Jt,Ma).call(this)}mutate(t,n){var r;return Y(this,Qt,n),(r=w(this,at))==null||r.removeObserver(this),Y(this,at,w(this,Kt).getMutationCache().build(w(this,Kt),this.options)),w(this,at).addObserver(this),w(this,at).execute(t)}},Kt=new WeakMap,cn=new WeakMap,at=new WeakMap,Qt=new WeakMap,Jt=new WeakSet,xs=function(){var n;const t=((n=w(this,at))==null?void 0:n.state)??pc();Y(this,cn,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Ma=function(t){ze.batch(()=>{var n,r,a,i,o,l,c,d;if(w(this,Qt)&&this.hasListeners()){const u=w(this,cn).variables,m=w(this,cn).context,h={client:w(this,Kt),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(n=w(this,Qt)).onSuccess)==null||r.call(n,t.data,u,m,h)}catch(p){Promise.reject(p)}try{(i=(a=w(this,Qt)).onSettled)==null||i.call(a,t.data,null,u,m,h)}catch(p){Promise.reject(p)}}else if((t==null?void 0:t.type)==="error"){try{(l=(o=w(this,Qt)).onError)==null||l.call(o,t.error,u,m,h)}catch(p){Promise.reject(p)}try{(d=(c=w(this,Qt)).onSettled)==null||d.call(c,void 0,t.error,u,m,h)}catch(p){Promise.reject(p)}}}this.listeners.forEach(u=>{u(w(this,cn))})})},$l),Rt,Ol,Ch=(Ol=class extends pr{constructor(t={}){super();ee(this,Rt);this.config=t,Y(this,Rt,new Map)}build(t,n,r){const a=n.queryKey,i=n.queryHash??xi(a,n);let o=this.get(i);return o||(o=new bh({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){w(this,Rt).has(t.queryHash)||(w(this,Rt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=w(this,Rt).get(t.queryHash);n&&(t.destroy(),n===t&&w(this,Rt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ze.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return w(this,Rt).get(t)}getAll(){return[...w(this,Rt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>go(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>go(t,r)):n}notify(t){ze.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ze.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ze.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Rt=new WeakMap,Ol),De,un,dn,sr,ar,mn,ir,or,zl,Ah=(zl=class{constructor(e={}){ee(this,De);ee(this,un);ee(this,dn);ee(this,sr);ee(this,ar);ee(this,mn);ee(this,ir);ee(this,or);Y(this,De,e.queryCache||new Ch),Y(this,un,e.mutationCache||new Sh),Y(this,dn,e.defaultOptions||{}),Y(this,sr,new Map),Y(this,ar,new Map),Y(this,mn,0)}mount(){es(this,mn)._++,w(this,mn)===1&&(Y(this,ir,pi.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(this,De).onFocus())})),Y(this,or,Ss.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(this,De).onOnline())})))}unmount(){var e,t;es(this,mn)._--,w(this,mn)===0&&((e=w(this,ir))==null||e.call(this),Y(this,ir,void 0),(t=w(this,or))==null||t.call(this),Y(this,or,void 0))}isFetching(e){return w(this,De).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return w(this,un).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=w(this,De).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=w(this,De).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(pn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return w(this,De).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=w(this,De).get(r.queryHash),i=a==null?void 0:a.state.data,o=oh(t,i);if(o!==void 0)return w(this,De).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return ze.batch(()=>w(this,De).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=w(this,De).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=w(this,De);ze.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=w(this,De);return ze.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ze.batch(()=>w(this,De).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(tt).catch(tt)}invalidateQueries(e,t={}){return ze.batch(()=>(w(this,De).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=ze.batch(()=>w(this,De).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(tt)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(tt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=w(this,De).build(this,t);return n.isStaleByTime(pn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(tt).catch(tt)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(tt).catch(tt)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ss.isOnline()?w(this,un).resumePausedMutations():Promise.resolve()}getQueryCache(){return w(this,De)}getMutationCache(){return w(this,un)}getDefaultOptions(){return w(this,dn)}setDefaultOptions(e){Y(this,dn,e)}setQueryDefaults(e,t){w(this,sr).set(Dn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...w(this,sr).values()],n={};return t.forEach(r=>{_r(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){w(this,ar).set(Dn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...w(this,ar).values()],n={};return t.forEach(r=>{_r(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...w(this,dn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xi(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ns&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...w(this,dn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){w(this,De).clear(),w(this,un).clear()}},De=new WeakMap,un=new WeakMap,dn=new WeakMap,sr=new WeakMap,ar=new WeakMap,mn=new WeakMap,ir=new WeakMap,or=new WeakMap,zl),xc=P.createContext(void 0),pt=e=>{const t=P.useContext(xc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ph=({client:e,children:t})=>(P.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(xc.Provider,{value:e,children:t})),gc=P.createContext(!1),Eh=()=>P.useContext(gc);gc.Provider;function Ih(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Th=P.createContext(Ih()),_h=()=>P.useContext(Th),Dh=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?gi(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Fh=e=>{P.useEffect(()=>{e.clearReset()},[e])},Rh=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||gi(n,[e.error,r])),Lh=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},$h=(e,t)=>e.isLoading&&e.isFetching&&!t,Oh=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Co=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function zh(e,t,n){var p,g,x,b;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=Eh(),a=_h(),i=pt(),o=i.defaultQueryOptions(e);(g=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||g.call(p,o);const l=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":c?"optimistic":void 0,Lh(o),Dh(o,a,l),Fh(a);const d=!i.getQueryCache().get(o.queryHash),[u]=P.useState(()=>new t(i,o)),m=u.getOptimisticResult(o),h=!r&&c;if(P.useSyncExternalStore(P.useCallback(y=>{const C=h?u.subscribe(ze.batchCalls(y)):tt;return u.updateResult(),C},[u,h]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),P.useEffect(()=>{u.setOptions(o)},[o,u]),Oh(o,m))throw Co(o,u,a);if(Rh({result:m,errorResetBoundary:a,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw m.error;if((b=(x=i.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||b.call(x,o,m),o.experimental_prefetchInRender&&!Dr.isServer()&&$h(m,r)){const y=d?Co(o,u,a):l==null?void 0:l.promise;y==null||y.catch(tt).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?m:u.trackResult(m)}function ge(e,t){return zh(e,vh)}function Mh(e,t){const n=pt(),[r]=P.useState(()=>new kh(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);const a=P.useSyncExternalStore(P.useCallback(o=>r.subscribe(ze.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=P.useCallback((o,l)=>{r.mutate(o,l).catch(tt)},[r]);if(a.error&&gi(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}function yc(e){return e.trim().replace(/\/+$/,"")}const Bs=new Map;function bc(e,t){Bs.set(e,t)}function qh(e){return Bs.get(e)}function Bh(e){Bs.delete(e)}function Vh(e){for(const[t,n]of Bs)if(n.accessToken===e)return t}let qa=null;function vc(e){qa=yc(e)}let jc=null;function Uh(e){jc=e}function Zh(){return jc}let wc=null;function Wh(e){wc=e.trim()}function Yh(){return wc}function Hh(){return qa!==null?qa:yc("")}const Ao={get apiBaseUrl(){return Hh()},apiVersion:"v1"};function Kh(e){const t=e.startsWith("/")?e:`/${e}`;return`${Ao.apiBaseUrl}/api/${Ao.apiVersion}${t}`}const Nc="auth:session-expired";function Qh(){window.dispatchEvent(new CustomEvent(Nc))}function Sc(e){return`${Nc}:${e}`}const Jh=v.createContext(null);function Gh({instanceId:e,accessToken:t,onSessionExpired:n,children:r}){const a=qh(e);return a&&bc(e,{...a,accessToken:t}),Uh(t),v.useEffect(()=>{if(!n)return;const i=Sc(e),o=()=>n();return window.addEventListener(i,o),()=>window.removeEventListener(i,o)},[e,n]),s.jsx(Jh.Provider,{value:{accessToken:t},children:r})}class xr extends Error{constructor(n,r,a,i,o){super(a??r);jr(this,"status");jr(this,"title");jr(this,"details");jr(this,"extensions");this.name="ApiError",this.status=n,this.title=r,this.details=i,this.extensions=o}}const kc="tax-remittance.auth";function Xh(){var t;const e=localStorage.getItem(kc);if(!e)return null;try{const n=JSON.parse(e);return!n.accessToken||!((t=n.user)!=null&&t.userId)?null:new Date(n.user.expiresAt)<=new Date?(Ba(),null):n}catch{return Ba(),null}}function Ba(){localStorage.removeItem(kc)}function ef(){var e;return((e=Xh())==null?void 0:e.accessToken)??null}async function tf(e){let t=null;try{t=await e.json()}catch{}const n=(t==null?void 0:t.title)??"Request failed",r=t==null?void 0:t.detail,a=t==null?void 0:t.errors;return new xr(e.status,n,r,a,t??void 0)}async function Ur(e,t={}){const{body:n,auth:r=!0,headers:a,responseType:i="json",...o}=t,l=new Headers(a);i==="blob"?l.set("Accept","application/pdf"):i==="text"?l.set("Accept","text/html"):l.set("Accept","application/json"),n!==void 0&&l.set("Content-Type","application/json");let c=null;if(r){const m=Zh()??ef();m&&(c=m,l.set("Authorization",`Bearer ${m}`))}const d=Yh();d&&l.set("X-Client-ID",d);const u=await fetch(Kh(e),{...o,headers:l,body:n!==void 0?JSON.stringify(n):void 0});if(!u.ok){const m=await tf(u);if(r&&m.status===401){Ba();const h=c?Vh(c):void 0;h?window.dispatchEvent(new CustomEvent(Sc(h))):Qh()}throw m}if(u.status!==204)return i==="blob"?await u.blob():i==="text"?await u.text():await u.json()}async function de(e,t={}){return(await Ur(e,t)).data}const it=10;function bi({search:e,pageNumber:t=1,pageSize:n=it}={}){const r=new URLSearchParams({pageNumber:String(t),pageSize:String(n)});return e!=null&&e.trim()&&r.set("search",e.trim()),de(`/portal/entities/mine?${r}`)}function nf(e){return de("/portal/entities",{method:"POST",body:e})}function rf(e,t){return de(`/portal/entities/${e}`,{method:"PATCH",body:t})}const Cc=v.createContext(null);function sf({onOrganizationCreated:e,enabledPayments:t=["federal","state"],onPaymentRequired:n,children:r}){var x;const[a,i]=v.useState(null),{data:o=[],isLoading:l,isError:c,refetch:d}=ge({queryKey:["entities","mine"],queryFn:async()=>(await bi({pageNumber:1,pageSize:100})).items}),u=v.useRef(new Set),m=v.useRef(!1);v.useEffect(()=>{if(l)return;if(!m.current){o.forEach(y=>u.current.add(y.entityId)),m.current=!0;return}o.filter(y=>!u.current.has(y.entityId)).forEach(y=>{u.current.add(y.entityId),e==null||e(y)})},[o,l,e]);const h=a!==null&&o.some(b=>b.entityId===a)?a:((x=o[0])==null?void 0:x.entityId)??null,p=o.find(b=>b.entityId===h)??null,g=async()=>{await d()};return s.jsx(Cc.Provider,{value:{entities:o,isLoading:l,isError:c,selectedEntity:p,setSelectedEntityId:i,refetchEntities:g,enabledPayments:t,onPaymentRequired:n},children:r})}function zn(){const e=v.useContext(Cc);if(!e)throw new Error("useEmbeddedContext must be used inside EmbeddedContextProvider");return e}const af=v.createContext(null);function of({theme:e,children:t}){const n={},r=n,a=(e==null?void 0:e.primaryColor)??"#2563eb";r["--embedded-primary"]=a,r["--embedded-primary-dark"]=`color-mix(in srgb, ${a} 82%, black)`,r["--embedded-primary-light"]=`color-mix(in srgb, ${a} 15%, white)`;const i=(e==null?void 0:e.secondaryColor)??"#0891b2";r["--embedded-secondary"]=i,r["--embedded-secondary-dark"]=`color-mix(in srgb, ${i} 82%, black)`,r["--embedded-secondary-light"]=`color-mix(in srgb, ${i} 15%, white)`;const o=(e==null?void 0:e.tertiaryColor)??"#7c3aed";return r["--embedded-tertiary"]=o,r["--embedded-tertiary-dark"]=`color-mix(in srgb, ${o} 82%, black)`,r["--embedded-tertiary-light"]=`color-mix(in srgb, ${o} 15%, white)`,e!=null&&e.borderRadius&&(r["--embedded-radius"]=e.borderRadius),e!=null&&e.fontFamily&&(n.fontFamily=e.fontFamily),r.minHeight="100%",s.jsx("div",{className:"tax-remittance-embedded",style:n,children:t})}const Ac=v.createContext(null),lf=6e3;function cf(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function uf({toast:e,onDismiss:t}){const n=e.variant==="success";return s.jsxs("div",{role:"alert",className:`w-full max-w-md overflow-hidden rounded-xl border shadow-lg ${n?"border-emerald-700 bg-[#E8F7C8]":"border-red-300 bg-[#FCE8EA]"}`,children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 px-5 py-4",children:[s.jsx("p",{className:"text-base font-bold text-slate-900",children:e.title}),s.jsx("button",{type:"button","aria-label":"Dismiss notification",onClick:()=>t(e.id),className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border transition hover:opacity-80 ${n?"border-emerald-800 text-emerald-900":"border-red-400 text-red-700"}`,children:s.jsx(df,{})})]}),s.jsx("div",{className:`mx-5 border-t ${n?"border-emerald-700":"border-red-300"}`}),s.jsx("p",{className:"px-5 py-4 text-sm text-slate-700",children:e.message})]})}function df(){return s.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function mf({children:e}){const[t,n]=v.useState([]),r=v.useCallback(o=>{n(l=>l.filter(c=>c.id!==o))},[]),a=v.useCallback((o,l,c)=>{const d=cf();n(u=>[...u,{id:d,variant:o,title:l,message:c}]),window.setTimeout(()=>{r(d)},lf)},[r]),i=v.useMemo(()=>({showSuccess:(o,l)=>a("success",o,l),showError:(o,l)=>a("error",o,l)}),[a]);return s.jsxs(Ac.Provider,{value:i,children:[e,qr.createPortal(s.jsx("div",{className:"pointer-events-none fixed right-4 top-4 z-[200] flex w-[min(100vw-2rem,28rem)] flex-col gap-3",children:t.map(o=>s.jsx("div",{className:"pointer-events-auto",children:s.jsx(uf,{toast:o,onDismiss:r})},o.id))}),document.body)]})}function Vs(){const e=v.useContext(Ac);if(!e)throw new Error("useToast must be used within ToastProvider");return e}class hf extends v.Component{constructor(t){super(t),this.state={hasError:!1,message:""}}static getDerivedStateFromError(t){return{hasError:!0,message:t instanceof Error?t.message:"Unexpected error"}}render(){return this.state.hasError?s.jsxs("div",{className:"flex min-h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[s.jsx("p",{className:"text-sm font-medium text-red-600",children:"Something went wrong loading this widget."}),s.jsx("p",{className:"text-xs text-slate-400",children:this.state.message}),s.jsx("button",{type:"button",className:"rounded-md bg-slate-100 px-4 py-2 text-sm text-slate-600 hover:bg-slate-200",onClick:()=>this.setState({hasError:!1,message:""}),children:"Try again"})]}):this.props.children}}function ff(e){return e.startsWith("/dashboard")?"dashboard":e.startsWith("/payments")?"payments":e.startsWith("/tax-forms")?"tax-forms":e.startsWith("/settings")?"settings":e.startsWith("/create-entity/form")?"create-entity-form":e.startsWith("/create-entity")?"create-entity":"other"}function pf({navigateFnRef:e,onNavigate:t}){const n=ke(),r=Se();return v.useEffect(()=>(e.current=n,()=>{e.current=null}),[n,e]),v.useEffect(()=>{t==null||t(ff(r.pathname),r.pathname)},[r.pathname,t]),null}function xf({selectEntityFnRef:e}){const{setSelectedEntityId:t}=zn();return v.useEffect(()=>(e.current=t,()=>{e.current=null}),[t,e]),null}function vi({appKey:e,accessToken:t,apiBaseUrl:n,theme:r,onSessionExpired:a,onOrganizationCreated:i,onNavigate:o,onPaymentRequired:l,navigateFnRef:c,selectEntityFnRef:d,enabledPayments:u,children:m}){const[h]=v.useState(()=>crypto.randomUUID());bc(h,{apiBaseUrl:n.trim().replace(/\/+$/,""),clientId:e.trim(),accessToken:t}),vc(n),Wh(e),v.useEffect(()=>()=>{Bh(h)},[h]);const[p]=v.useState(()=>new Ah({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}));return s.jsx(af.Provider,{value:h,children:s.jsx(of,{theme:r,children:s.jsx(Ph,{client:p,children:s.jsx(mf,{children:s.jsx(Gh,{instanceId:h,accessToken:t,onSessionExpired:a,children:s.jsx(bm,{children:s.jsxs(sf,{onOrganizationCreated:i,enabledPayments:u,onPaymentRequired:l,children:[s.jsx(pf,{navigateFnRef:c,onNavigate:o}),s.jsx(xf,{selectEntityFnRef:d}),s.jsx(hf,{children:m})]})})})})})})})}function ji(){const{entities:e,isLoading:t,isError:n,refetchEntities:r}=zn(),a=ke();return v.useEffect(()=>{t||n||a(e.length===0?"/create-entity":"/dashboard",{replace:!0})},[t,n,e,a]),t?s.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-slate-200 border-t-slate-600"})}):n?s.jsxs("div",{className:"flex min-h-[200px] flex-col items-center justify-center gap-3 px-4 text-center",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-red-50",children:s.jsx("svg",{className:"h-5 w-5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}),s.jsx("p",{className:"text-sm font-medium text-slate-700",children:"Unable to load your account"}),s.jsx("p",{className:"text-xs text-slate-500",children:"Check your connection and try again."}),s.jsx("button",{type:"button",onClick:r,className:"mt-1 rounded-md bg-slate-100 px-4 py-1.5 text-xs font-medium text-slate-600 hover:bg-slate-200",children:"Retry"})]}):null}function wi(){const{entities:e,selectedEntity:t,setSelectedEntityId:n}=zn(),r=ke(),i=Se().pathname.split("/").filter(Boolean).length>1;return s.jsxs("div",{className:"flex min-h-full flex-col bg-slate-50",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b border-slate-200 bg-white px-4 py-3",children:[i&&s.jsxs("button",{type:"button",onClick:()=>r(-1),className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-sm text-slate-500 transition hover:bg-slate-100 hover:text-slate-700",children:[s.jsx(gf,{}),"Back"]}),s.jsx("div",{className:"flex-1"})]}),s.jsx("main",{className:"flex-1 p-5",children:s.jsx(vm,{context:{entities:e,selectedEntity:t,setSelectedEntityId:n}})})]})}function gf(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}const yf=["Entity name & EIN","Business type & primary state","Automatic dashboard access","Start managing tax payments"];function bf({onCreateClick:e}){return s.jsxs("div",{className:"mx-auto w-full max-w-[528px]",children:[s.jsxs("div",{className:"overflow-hidden rounded-[20px] border border-[#f3f4f6] bg-white shadow-[0_20px_25px_-5px_rgba(0,0,0,0.1),0_8px_10px_-6px_rgba(0,0,0,0.1)] sm:rounded-[24px]",children:[s.jsxs("div",{className:"bg-[#bccadb] px-5 pb-6 pt-6 text-center sm:px-8 sm:pb-8 sm:pt-8",children:[s.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-2xl bg-white/20 sm:h-16 sm:w-16",children:s.jsx(Po,{className:"h-6 w-6 text-white sm:h-8 sm:w-8"})}),s.jsx("h2",{className:"mt-3 text-xl font-black tracking-tight text-[#1e2939] sm:mt-4 sm:text-2xl",children:"Add Your Entity"}),s.jsx("p",{className:"mt-1 text-sm text-[#1e2939]/80",children:"Get set up in under 1 minute"})]}),s.jsxs("div",{className:"bg-white px-5 py-5 sm:px-8 sm:py-6",children:[s.jsx("ul",{className:"space-y-2.5 sm:space-y-3",children:yf.map(t=>s.jsxs("li",{className:"flex items-center gap-3 text-sm text-[#4a5565]",children:[s.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[#dfeeff] text-[#156bd5]",children:s.jsx(rs,{})}),t]},t))}),s.jsxs("button",{type:"button",onClick:e,className:"mt-5 flex h-12 w-full items-center justify-center gap-2 rounded-2xl bg-[#156bd5] text-sm font-black text-white transition hover:bg-[#125bb8] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#156bd5] focus-visible:ring-offset-2 sm:mt-6 sm:h-14 sm:text-base",children:[s.jsx(Po,{className:"h-4 w-4 sm:h-[18px] sm:w-[18px]"}),"Add Entity",s.jsx(vf,{})]})]})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-x-3 gap-y-2 text-xs text-[#99a1af] sm:mt-5 sm:gap-x-4",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(rs,{className:"h-3 w-3 text-emerald-500"}),"SOC 2 Certified"]}),s.jsx("span",{className:"hidden h-3 w-px bg-[#e5e7eb] sm:block","aria-hidden":!0}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(rs,{className:"h-3 w-3 text-emerald-500"}),"Bank-grade encryption"]}),s.jsx("span",{className:"hidden h-3 w-px bg-[#e5e7eb] sm:block","aria-hidden":!0}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(rs,{className:"h-3 w-3 text-emerald-500"}),"Free to start"]})]})]})}function Po({className:e="h-5 w-5"}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 21h19.5m-18-18v18m10.5-18v18m6-13.5V21M6.75 6.75h.75m-.75 3h.75m-.75 3h.75m3-6h.75m-.75 3h.75m-.75 3h.75M6.75 21v-3.375c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21M3 21h18M12 3l9 4.5v1.5H3V7.5L12 3z"})})}function rs({className:e="h-3 w-3"}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 16 16",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5l3 3 6-6"})})}function vf(){return s.jsx("svg",{className:"h-4 w-4 sm:h-[18px] sm:w-[18px]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3"})})}function Ni(){const e=ke(),t=()=>{e("/create-entity/form",{state:{from:"/create-entity"}})};return s.jsx("div",{className:"flex items-center justify-center bg-transparent px-0 py-0",children:s.jsx(bf,{onCreateClick:t})})}var Zr=e=>e.type==="checkbox",hn=e=>e instanceof Date,Ze=e=>e==null;const Si=e=>typeof e=="object";var Pe=e=>!Ze(e)&&!Array.isArray(e)&&Si(e)&&!hn(e),Va=e=>Pe(e)&&e.target?Zr(e.target)?e.target.checked:e.target.value:e,Pc=(e,t)=>t.split(".").some((n,r,a)=>!isNaN(Number(n))&&e.has(a.slice(0,r).join("."))),Ec=e=>{const t=e.constructor&&e.constructor.prototype;return Pe(t)&&t.hasOwnProperty("isPrototypeOf")},Us=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _e(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Us&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Pe(e)&&Ec(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=_e(e[a]));return r}const nn={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Ct={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},St={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ic="root",ki=["__proto__","constructor","prototype"],jf=/^\w*$/;var Wr=e=>jf.test(e),je=e=>e===void 0;const wf=/[.[\]'"]/;var Zs=e=>e.split(wf).filter(Boolean),B=(e,t,n)=>{if(!t||!Pe(e))return n;const r=Wr(t)?[t]:Zs(t);if(r.some(i=>ki.includes(i)))return n;const a=r.reduce((i,o)=>Ze(i)?void 0:i[o],e);return je(a)||a===e?je(e[t])?n:e[t]:a},ct=e=>typeof e=="boolean",Ke=e=>typeof e=="function",xe=(e,t,n)=>{let r=-1;const a=Wr(t)?[t]:Zs(t),i=a.length,o=i-1;for(;++r<i;){const l=a[r];let c=n;if(r!==o){const d=e[l];c=Pe(d)||Array.isArray(d)?d:isNaN(+a[r+1])?{}:[]}if(ki.includes(l))return;e[l]=c,e=e[l]}};const Tc=v.createContext(null);Tc.displayName="HookFormControlContext";const Ci=()=>v.useContext(Tc);var _c=(e,t,n,r=!0)=>{const a={};for(const i in e)Object.defineProperty(a,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Ct.all&&(t._proxyFormState[o]=!r||Ct.all),n&&(n[o]=!0),e[o]}});return a};const Ai=Us?v.useLayoutEffect:v.useEffect;function Nf(e){const t=Ci(),{control:n=t,disabled:r,name:a,exact:i}=e||{},[o,l]=v.useState(()=>({...n._formState,defaultValues:n._defaultValues})),c=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ai(()=>n._subscribe({name:a,formState:c.current,exact:i,callback:d=>{!r&&l({...n._formState,...d,defaultValues:n._defaultValues})}}),[a,r,i]),v.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),v.useMemo(()=>_c(o,n,c.current,!1),[o,n])}var Qe=e=>typeof e=="string",Ua=(e,t,n,r,a)=>Qe(e)?(r&&t.watch.add(e),B(n,e,a)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),B(n,i))):(r&&(t.watchAll=!0),n),Za=e=>Ze(e)||!Si(e);const Eo=(e,t)=>t.length===0&&!Array.isArray(e)&&!Ec(e);function ut(e,t,n=new WeakMap){if(e===t)return!0;if(Za(e)||Za(t))return Object.is(e,t);if(hn(e)&&hn(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(Eo(e,r)||Eo(t,a))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;const i=n.get(e);if(i&&i.has(t))return!0;if(i)i.add(t);else{const o=new WeakSet;o.add(t),n.set(e,o)}for(const o of r){const l=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(hn(l)&&hn(c)||(Pe(l)||Array.isArray(l))&&(Pe(c)||Array.isArray(c))?!ut(l,c,n):!Object.is(l,c))return!1}}return!0}function Sf(e){const t=Ci(),{control:n=t,name:r,defaultValue:a,disabled:i,exact:o,compute:l}=e||{},c=v.useRef(a),d=v.useRef(l),u=v.useRef(void 0),m=v.useRef(n),h=v.useRef(r);d.current=l;const[p,g]=v.useState(()=>{const S=n._getWatch(r,c.current);return d.current?d.current(S):S}),x=v.useCallback(S=>{const I=Ua(r,n._names,S||n._formValues,!1,c.current);return d.current?d.current(I):I},[n._formValues,n._names,r]),b=v.useCallback(S=>{if(!i){const I=Ua(r,n._names,S||n._formValues,!1,c.current);if(d.current){const F=d.current(I);ut(F,u.current)||(g(F),u.current=F)}else g(I)}},[n._formValues,n._names,i,r]);Ai(()=>((m.current!==n||!ut(h.current,r))&&(m.current=n,h.current=r,b()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:S=>{b(S.values)}})),[n,o,r,b]),v.useEffect(()=>n._removeUnmounted());const y=m.current!==n,C=h.current,j=v.useMemo(()=>{if(i)return null;const S=!y&&!ut(C,r);return y||S?x():null},[i,y,r,C,x]);return j!==null?j:p}function kf(e){const t=Ci(),{name:n,disabled:r,control:a=t,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=Pc(a._names.array,n),d=v.useMemo(()=>B(a._formValues,n,B(a._defaultValues,n,o)),[a,n,o]),u=Sf({control:a,name:n,defaultValue:d,exact:l}),m=Nf({control:a,name:n,exact:l}),h=v.useRef(e),p=v.useRef(null),g=v.useRef(a.register(n,{...e.rules,value:u,...ct(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const x=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!B(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!B(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!B(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!B(m.validatingFields,n)},error:{enumerable:!0,get:()=>B(m.errors,n)}}),[m,n]),b=v.useCallback(S=>{const I=Va(S);return B(a._fields,n)||(g.current=a.register(n,{...h.current.rules,value:I})),g.current.onChange({target:{value:Va(S),name:n},type:nn.CHANGE})},[n,a]),y=v.useCallback(()=>g.current.onBlur({target:{value:B(a._formValues,n),name:n},type:nn.BLUR}),[n,a._formValues]),C=v.useCallback(S=>{S&&(p.current={focus:()=>Ke(S.focus)&&S.focus(),select:()=>Ke(S.select)&&S.select(),setCustomValidity:F=>Ke(S.setCustomValidity)&&S.setCustomValidity(F),reportValidity:()=>Ke(S.reportValidity)&&S.reportValidity()});const I=B(a._fields,n);I&&I._f&&S&&(I._f.ref=p.current)},[a._fields,n]),j=v.useMemo(()=>({name:n,value:u,...ct(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:b,onBlur:y,ref:C}),[n,r,m.disabled,b,y,C,u]);return v.useEffect(()=>{const S=a._options.shouldUnregister||i;a.register(n,{...h.current.rules,...ct(h.current.disabled)?{disabled:h.current.disabled}:{}});const I=(F,E)=>{const T=B(a._fields,F);T&&T._f&&(T._f.mount=E)};if(I(n,!0),S){const F=_e(B(i?a._defaultValues:a._options.values||a._defaultValues,n,B(a._options.defaultValues,n,h.current.defaultValue)));xe(a._defaultValues,n,F),je(B(a._formValues,n))&&xe(a._formValues,n,F)}if(!c&&a.register(n),p.current){const F=B(a._fields,n);F&&F._f&&(F._f.ref=p.current)}return()=>{(c?S&&!a._state.action:S)?a.unregister(n):I(n,!1)}},[n,a,c,i]),v.useEffect(()=>{a._setDisabledField({disabled:r,name:n})},[r,n,a]),v.useMemo(()=>({field:j,formState:m,fieldState:x}),[j,m,x])}const Ne=e=>e.render(kf(e)),Dc=e=>{const t={};for(const n of Object.keys(e))if(Si(e[n])&&e[n]!==null&&!hn(e[n])){const r=Dc(e[n]);for(const a of Object.keys(r))t[`${n}.${a}`]=r[a]}else t[n]=e[n];return t},Cf=v.createContext(null);Cf.displayName="HookFormContext";var Pi=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{},Fc=e=>Array.isArray(e)?e.filter(Boolean):[],gs=e=>Array.isArray(e)?e:[e],Io=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}};function Rc(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const a=e[r],i=t[r];if(a&&Pe(a)&&i){const o=Rc(a,i);Pe(o)&&(n[r]=o)}else e[r]&&(n[r]=i)}return n}var Ue=e=>Pe(e)&&!Object.keys(e).length,Ei=e=>e.type==="file",ks=e=>{if(!Us)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Lc=e=>e.type==="select-multiple",Ii=e=>e.type==="radio",Af=e=>Ii(e)||Zr(e),la=e=>ks(e)&&e.isConnected;function Pf(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;){if(Ze(e)){e=void 0;break}e=e[t[r]],r++}return e}function Ef(e){for(const t in e)if(e.hasOwnProperty(t)&&!je(e[t]))return!1;return!0}function $e(e,t){if(Qe(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:Wr(t)?[t]:Zs(t);if(n.some(o=>ki.includes(String(o))))return e;const r=n.length===1?e:Pf(e,n),a=n.length-1,i=n[a];return r&&delete r[i],a!==0&&(Pe(r)&&Ue(r)||Array.isArray(r)&&Ef(r))&&$e(e,n.slice(0,-1)),e}var If=e=>{for(const t in e)if(Ke(e[t]))return!0;return!1};function $c(e){return Array.isArray(e)||Pe(e)&&!If(e)}function Wa(e,t={}){for(const n in e){const r=e[n];$c(r)?(t[n]=Array.isArray(r)?[]:{},Wa(r,t[n])):je(r)||(t[n]=!0)}return t}function Ya(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(n=>Ya(n));return t.some(n=>n!==void 0)?t:void 0}if(Pe(e)){const t={};for(const n in e){const r=Ya(e[n]);je(r)||(t[n]=r)}return Object.keys(t).length?t:void 0}}}function vn(e,t,n){n||(n=Wa(t));for(const r in e){const a=e[r];if($c(a))je(t)||Za(n[r])?n[r]=Wa(a,Array.isArray(a)?[]:{}):vn(a,Ze(t)?{}:t[r],n[r]);else{const i=t[r];n[r]=!ut(a,i)}}return Ya(n)||{}}const To={value:!1,isValid:!1},_o={value:!0,isValid:!0};var Oc=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!je(e[0].attributes.value)?je(e[0].value)||e[0].value===""?_o:{value:e[0].value,isValid:!0}:_o:To}return To},zc=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>je(e)?e:t?e===""?NaN:e&&+e:n&&Qe(e)?new Date(e):r?r(e):e;const Do={isValid:!1,value:null};var Mc=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Do):Do;function Fo(e){const t=e.ref;return Ei(t)?t.files:Ii(t)?Mc(e.refs).value:Lc(t)?[...t.selectedOptions].map(({value:n})=>n):Zr(t)?Oc(e.refs).value:zc(je(t.value)?e.ref.value:t.value,e)}var Tf=(e,t,n,r)=>{const a={};for(const i of e){const o=B(t,i);o&&xe(a,i,o._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},Cs=e=>e instanceof RegExp,Nr=e=>je(e)?e:Cs(e)?e.source:Pe(e)?Cs(e.value)?e.value.source:e.value:e,ss=e=>({isOnSubmit:!e||e===Ct.onSubmit,isOnBlur:e===Ct.onBlur,isOnChange:e===Ct.onChange,isOnAll:e===Ct.all,isOnTouch:e===Ct.onTouched});const Ro="AsyncFunction";var _f=e=>{if(!e||!e.validate)return!1;if(Ke(e.validate))return e.validate.constructor.name===Ro;if(Pe(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===Ro)return!0}return!1},Df=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ca=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const r of t.watch)if(e.startsWith(r)&&e.charAt(r.length)===".")return!0;return!1};const Ir=(e,t,n,r)=>{for(const a of n||Object.keys(e)){const i=B(e,a);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],a)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(Ir(l,t))break}else if(Pe(l)&&Ir(l,t))break}}};function Lo(e,t,n){const r=B(e,n);if(r||Wr(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const i=a.join("."),o=B(t,i),l=B(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};a.pop()}return{name:n}}var Ff=(e,t,n,r)=>{n(e);const{name:a,...i}=e,o=Object.keys(i);return!o.length||r&&o.length>=Object.keys(t).length||o.find(l=>t[l]===(!r||Ct.all))},Rf=(e,t,n)=>!e||!t||e===t||gs(e).some(r=>r&&(n?r===t||r.startsWith(t+"."):r.startsWith(t)||t.startsWith(r))),Lf=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,$f=(e,t)=>!Fc(B(e,t)).length&&$e(e,t),$o=(e,t,n)=>{const r=B(e,n),a=Array.isArray(r)?r:[];return xe(a,Ic,t[n]),xe(e,n,a),e};function Oo(e,t,n="validate"){if(Qe(e)||Array.isArray(e)&&e.every(Qe)||ct(e)&&!e)return{type:n,message:Qe(e)?e:"",ref:t}}var Bn=e=>Pe(e)&&!Cs(e)?e:{value:e,message:""},zo=async(e,t,n,r,a,i)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:u,min:m,max:h,pattern:p,validate:g,name:x,valueAsNumber:b,mount:y}=e._f,C=B(n,x);if(!y||t.has(x))return{};const j=l?l[0]:o,S=X=>{if(a&&j.reportValidity){const H=ct(X)?"":X||"";l?l.forEach(U=>U.setCustomValidity(H)):j.setCustomValidity(H),j.reportValidity()}},I={},F=Ii(o),E=Zr(o),T=F||E,O=(b||Ei(o))&&je(o.value)&&je(C)||ks(o)&&o.value===""||C===""||Array.isArray(C)&&!C.length,V=Pi.bind(null,x,r,I),Q=(X,H,U,Z=St.maxLength,ie=St.minLength)=>{const G=X?H:U;I[x]={type:X?Z:ie,message:G,ref:o,...V(X?Z:ie,G)}};if(i?!Array.isArray(C)||!C.length:c&&(!T&&(O||Ze(C))||ct(C)&&!C||E&&!Oc(l).isValid||F&&!Mc(l).isValid)){const{value:X,message:H}=Qe(c)?{value:!!c,message:c}:Bn(c);if(X&&(I[x]={type:St.required,message:H,ref:j,...V(St.required,H)},!r))return S(H),I}if(!O&&(!Ze(m)||!Ze(h))){let X,H;const U=Bn(h),Z=Bn(m);if(!Ze(C)&&!isNaN(C)){const ie=o.valueAsNumber||C&&+C;Ze(U.value)||(X=ie>U.value),Ze(Z.value)||(H=ie<Z.value)}else{const ie=o.valueAsDate||new Date(C),G=Ae=>new Date(new Date().toDateString()+" "+Ae),W=o.type=="time",we=o.type=="week";Qe(U.value)&&C&&(X=W?G(C)>G(U.value):we?C>U.value:ie>new Date(U.value)),Qe(Z.value)&&C&&(H=W?G(C)<G(Z.value):we?C<Z.value:ie<new Date(Z.value))}if((X||H)&&(Q(!!X,U.message,Z.message,St.max,St.min),!r))return S(I[x].message),I}if((d||u)&&!O&&(Qe(C)||i&&Array.isArray(C))){const X=Bn(d),H=Bn(u),U=!Ze(X.value)&&C.length>+X.value,Z=!Ze(H.value)&&C.length<+H.value;if((U||Z)&&(Q(U,X.message,H.message),!r))return S(I[x].message),I}if(p&&!O&&Qe(C)){const{value:X,message:H}=Bn(p);if(Cs(X)&&!C.match(X)&&(I[x]={type:St.pattern,message:H,ref:o,...V(St.pattern,H)},!r))return S(H),I}if(g){if(Ke(g)){const X=await g(C,n),H=Oo(X,j);if(H&&(I[x]={...H,...V(St.validate,H.message)},!r))return S(H.message),I}else if(Pe(g)){let X={};for(const H in g){if(!Ue(X)&&!r)break;const U=Oo(await g[H](C,n),j,H);U&&(X={...U,...V(H,U.message)},S(U.message),r&&(I[x]=X))}if(!Ue(X)&&(I[x]={ref:j,...X},!r))return I}}return S(!0),I};const Of={mode:Ct.onSubmit,reValidateMode:Ct.onChange,shouldFocusError:!0},ua="form",qc={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function zf(e={}){let t={...Of,...e},n={..._e(qc),isLoading:Ke(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},a=Pe(t.defaultValues)||Pe(t.values)?_e(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:_e(a),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0,u=0,m=ss(t.mode),h=ss(t.reValidateMode);const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={...p};let x={...g};const b={array:Io(),state:Io()},y=t.criteriaMode===Ct.all,C=f=>N=>{clearTimeout(d),d=setTimeout(f,N)},j=async f=>{if(!o.keepIsValid&&!t.disabled&&(g.isValid||x.isValid||f)){let N;t.resolver?(N=Ue((await H()).errors),S()):N=await ie({fields:r,onlyCheckValid:!0,eventType:nn.VALID}),N!==n.isValid&&b.state.next({isValid:N})}},S=(f,N)=>{!t.disabled&&(g.isValidating||g.validatingFields||x.isValidating||x.validatingFields)&&((f||Array.from(l.mount)).forEach(A=>{A&&(N?xe(n.validatingFields,A,N):$e(n.validatingFields,A))}),b.state.next({validatingFields:n.validatingFields,isValidating:!Ue(n.validatingFields)}))},I=()=>{n.dirtyFields=vn(a,i)},F=(f,N=[],A,R,k=!0,$=!0)=>{if(R&&A&&!t.disabled){if(o.action=!0,$&&Array.isArray(B(r,f))){const M=A(B(r,f),R.argA,R.argB);k&&xe(r,f,M)}if($&&Array.isArray(B(n.errors,f))){const M=A(B(n.errors,f),R.argA,R.argB);k&&xe(n.errors,f,M),$f(n.errors,f)}if((g.touchedFields||x.touchedFields)&&$&&Array.isArray(B(n.touchedFields,f))){const M=A(B(n.touchedFields,f),R.argA,R.argB);k&&xe(n.touchedFields,f,M)}(g.dirtyFields||x.dirtyFields)&&I(),b.state.next({name:f,isDirty:W(f,N),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else xe(i,f,N)},E=(f,N)=>{xe(n.errors,f,N),n.errors={...n.errors},b.state.next({errors:n.errors})},T=f=>{n.errors=f,b.state.next({errors:n.errors,isValid:!1})},O=f=>{const N=Wr(f)?[f]:Zs(f);let A=i,R=a;for(let k=0;k<N.length-1;k++){const $=N[k];if(A=Ze(A)?A:A[$],R=Ze(R)?R:R[$],A===null&&R!==null)return!0}return!1},V=(f,N,A,R)=>{const k=B(r,f);if(k){if(O(f))return;const $=je(B(i,f)),M=B(i,f,je(A)?B(a,f):A);je(M)||R&&R.defaultChecked||N?xe(i,f,N?M:Fo(k._f)):Le(f,M),o.mount&&!o.action&&(j(),$&&n.isDirty&&(g.isDirty||x.isDirty)&&(W()||(n.isDirty=!1,b.state.next({...n}))),e.shouldUnregister&&$&&!je(B(i,f))&&ca(f,l)&&(o.watch=!0))}},Q=(f,N,A,R,k)=>{let $=!1,M=!1;const K={name:f};if(!t.disabled){if(!A||R){const q=ut(B(a,f),N);(g.isDirty||x.isDirty)&&(M=n.isDirty,n.isDirty=K.isDirty=!q||W(),$=M!==K.isDirty),M=!!B(n.dirtyFields,f),q!==n.isDirty?n.dirtyFields=vn(a,i):q?$e(n.dirtyFields,f):xe(n.dirtyFields,f,!0),K.dirtyFields=n.dirtyFields,$=$||(g.dirtyFields||x.dirtyFields)&&M!==!q}if(A){const q=B(n.touchedFields,f);q||(xe(n.touchedFields,f,A),K.touchedFields=n.touchedFields,$=$||(g.touchedFields||x.touchedFields)&&q!==A)}$&&k&&b.state.next(K)}return $?K:{}},X=(f,N,A,R)=>{const k=B(n.errors,f),$=(g.isValid||x.isValid)&&ct(N)&&n.isValid!==N;if(t.delayError&&A?(c=C(()=>E(f,A)),c(t.delayError)):(clearTimeout(d),c=null,A?xe(n.errors,f,A):$e(n.errors,f),n.errors={...n.errors}),(A?!ut(k,A):k)||!Ue(R)||$){const M={...R,...$&&ct(N)?{isValid:N}:{},errors:n.errors,name:f};n={...n,...M},b.state.next(M)}},H=async f=>(S(f,!0),await t.resolver(i,t.context,Tf(f||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),U=async f=>{const{errors:N}=await H(f);if(S(f),f){for(const A of f){const R=B(N,A);R?l.array.has(A)&&Pe(R)&&!Object.keys(R).some(k=>!Number.isNaN(Number(k)))?$o(n.errors,{[A]:R},A):xe(n.errors,A,R):$e(n.errors,A)}n.errors={...n.errors}}else n.errors=N;return N},Z=async({name:f,eventType:N})=>{if(e.validate){const A=await e.validate({formValues:i,formState:n,name:f,eventType:N});if(Pe(A))for(const R in A){const k=A[R];k&&be(`${ua}.${R}`,{message:Qe(k.message)?k.message:"",type:k.type||St.validate})}else Qe(A)||!A?be(ua,{message:A||"",type:St.validate}):le(ua);return A}return!0},ie=async({fields:f,onlyCheckValid:N,name:A,eventType:R,context:k={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(k.runRootValidation=!0,!await Z({name:A,eventType:R})&&(k.valid=!1,N)))return k.valid;for(const $ in f){const M=f[$];if(M){const{_f:K,...q}=M;if(K){const ae=l.array.has(K.name),Me=M._f&&_f(M._f),Ut=g.validatingFields||g.isValidating||x.validatingFields||x.isValidating;Me&&Ut&&S([K.name],!0);const Zt=await zo(M,l.disabled,i,y,t.shouldUseNativeValidation&&!N,ae);if(Me&&Ut&&S([K.name]),Zt[K.name]&&(k.valid=!1,N)||(!N&&(B(Zt,K.name)?ae?$o(n.errors,Zt,K.name):xe(n.errors,K.name,Zt[K.name]):$e(n.errors,K.name)),e.shouldUseNativeValidation&&Zt[K.name]))break}!Ue(q)&&await ie({context:k,onlyCheckValid:N,fields:q,name:$,eventType:R})}}return k.valid},G=()=>{for(const f of l.unMount){const N=B(r,f);N&&(N._f.refs?N._f.refs.every(A=>!la(A)):!la(N._f.ref))&&rt(f)}l.unMount=new Set},W=(f,N)=>!t.disabled&&(f&&N&&xe(i,f,N),!ut(o.mount?i:a,a)),we=(f,N,A)=>Ua(f,l,{...o.mount?i:je(N)?a:Qe(f)?{[f]:N}:N},A,N),Ae=f=>Fc(B(o.mount?i:a,f,t.shouldUnregister?B(a,f,[]):[])),Le=(f,N,A={},R=!1,k=!1)=>{const $=B(r,f);let M=N;if($){const K=$._f;K&&(!K.disabled&&xe(i,f,zc(N,K)),M=ks(K.ref)&&Ze(N)?"":N,Lc(K.ref)?[...K.ref.options].forEach(q=>q.selected=M.includes(q.value)):K.refs?Zr(K.ref)?K.refs.forEach(q=>{(!q.defaultChecked||!q.disabled)&&(Array.isArray(M)?q.checked=!!M.find(ae=>ae===q.value):q.checked=M===q.value||!!M)}):K.refs.forEach(q=>q.checked=q.value===M):Ei(K.ref)?K.ref.value="":(K.ref.value=M,!K.ref.type&&!k&&b.state.next({name:f,values:R?i:_e(i)})))}(A.shouldDirty||A.shouldTouch)&&Q(f,M,A.shouldTouch,A.shouldDirty,!k),A.shouldValidate&&Te(f)},ce=(f,N,A,R=!1,k=!1)=>{for(const $ in N){if(!N.hasOwnProperty($))return;const M=N[$],K=f+"."+$,q=B(r,K);(l.array.has(f)||Pe(M)||q&&!q._f)&&!hn(M)?ce(K,M,A,R,k):Le(K,M,A,R,k)}},pe=(f,N,A,R,k=!1)=>{const $=B(r,f),M=l.array.has(f),K=R?N:_e(N),q=B(i,f),ae=ut(q,K);if(ae||xe(i,f,K),M)b.array.next({name:f,values:R?i:_e(i)}),(g.isDirty||g.dirtyFields||x.isDirty||x.dirtyFields)&&A.shouldDirty&&(I(),k||b.state.next({name:f,dirtyFields:n.dirtyFields,isDirty:W(f,K)}));else{const Me=Array.isArray(K)&&!K.length||Ue(K);!$||$._f||Ze(K)||Me?Le(f,K,A,R,k):ce(f,K,A,R,k)}if(!ae&&!k){const Me=ca(f,l),Ut=R?i:_e(i);b.state.next({...Me&&n,name:o.mount||Me?f:void 0,values:Ut})}},L=(f,N,A={})=>pe(f,N,A,!1),fe=(f,N={})=>{const A=Ke(f)?f(i):f;if(!ut(i,A)){i={...i,...A};const R=Dc(A);for(const k of l.mount)k in R&&pe(k,R[k],N,!0,!0);b.state.next({...n,name:void 0,type:void 0,...u?{values:i}:{}}),N.shouldValidate&&j()}},z=async f=>{o.mount=!0;const N=f.target;let A=N.name,R=!0;const k=B(r,A),$=M=>{R=Number.isNaN(M)||hn(M)&&isNaN(M.getTime())||ut(M,B(i,A,M))};if(k){let M,K;const q=N.type?Fo(k._f):Va(f),ae=f.type===nn.BLUR||f.type===nn.FOCUS_OUT,Me=!Df(k._f)&&!e.validate&&!t.resolver&&!B(n.errors,A)&&!k._f.deps,Ut=Me||Lf(ae,B(n.touchedFields,A),n.isSubmitted,h,m),Zt=ca(A,l,ae);xe(i,A,q),ae?(!N||!N.readOnly)&&(k._f.onBlur&&k._f.onBlur(f),c&&c(0)):k._f.onChange&&k._f.onChange(f);const vr=Q(A,q,ae),xd=!Ue(vr)||Zt;if(!ae&&b.state.next({name:A,type:f.type,...u?{values:_e(i)}:{}}),Ut)return(!Me||!n.isValid)&&(g.isValid||x.isValid)&&(t.mode==="onBlur"?ae&&j():ae||j()),xd&&b.state.next({name:A,...Zt?{}:vr});if(!t.resolver&&e.validate&&await Z({name:A,eventType:f.type}),!ae&&Zt&&b.state.next({...n}),t.resolver){const{errors:lo}=await H([A]);if(S([A]),$(q),!R){!Ue(vr)&&b.state.next(vr);return}const gd=Lo(n.errors,r,A),co=Lo(lo,r,gd.name||A);M=co.error,A=co.name,K=Ue(lo)}else S([A],!0),M=(await zo(k,l.disabled,i,y,t.shouldUseNativeValidation))[A],S([A]),$(q),R&&(M?K=!1:(g.isValid||x.isValid)&&(K=await ie({fields:r,onlyCheckValid:!0,name:A,eventType:f.type})));R&&(k._f.deps&&(!Array.isArray(k._f.deps)||k._f.deps.length>0)&&Te(k._f.deps),X(A,K,M,vr))}},ue=(f,N)=>{if(B(n.errors,N)&&f.focus)return f.focus(),1},Te=async(f,N={})=>{let A,R;const k=gs(f);if(t.resolver){const $=await U(je(f)?f:k);A=Ue($),R=f?!k.some(M=>B($,M)):A}else f?(R=(await Promise.all(k.map(async $=>{const M=B(r,$);return await ie({fields:M&&M._f?{[$]:M}:M,eventType:nn.TRIGGER})}))).every(Boolean),!(!R&&!n.isValid)&&j()):R=A=await ie({fields:r,name:f,eventType:nn.TRIGGER});return b.state.next({...!Qe(f)||(g.isValid||x.isValid)&&A!==n.isValid?{}:{name:f},...t.resolver||!f?{isValid:A}:{},errors:n.errors}),N.shouldFocus&&!R&&Ir(r,ue,f?k:l.mount),R},Ge=(f,N)=>{let A={...o.mount?i:a};return N&&(A=Rc(N.dirtyFields?n.dirtyFields:n.touchedFields,A)),je(f)?A:Qe(f)?B(A,f):f.map(R=>B(A,R))},Oe=(f,N)=>({invalid:!!B((N||n).errors,f),isDirty:!!B((N||n).dirtyFields,f),error:B((N||n).errors,f),isValidating:!!B(n.validatingFields,f),isTouched:!!B((N||n).touchedFields,f)}),le=f=>{const N=f?gs(f):void 0;N==null||N.forEach(A=>$e(n.errors,A)),N?N.forEach(A=>{b.state.next({name:A,errors:n.errors})}):b.state.next({errors:{}})},be=(f,N,A)=>{const R=(B(r,f,{_f:{}})._f||{}).ref,k=B(n.errors,f)||{},{ref:$,message:M,type:K,...q}=k;xe(n.errors,f,{...q,...N,ref:R}),b.state.next({name:f,errors:n.errors,isValid:!1}),A&&A.shouldFocus&&R&&R.focus&&R.focus()},Ye=(f,N)=>{if(Ke(f)){u++;const{unsubscribe:A}=b.state.subscribe({next:k=>"values"in k&&f(k.values||we(void 0,N),k)});let R=!1;return{unsubscribe:()=>{R||(R=!0,u--,A())}}}return we(f,N,!0)},re=f=>{var N;const A=!!(!((N=f.formState)===null||N===void 0)&&N.values);A&&u++;const{unsubscribe:R}=b.state.subscribe({next:$=>{if(Rf(f.name,$.name,f.exact)&&Ff($,f.formState||g,Tt,f.reRenderRoot)){const M={...i};f.callback({values:M,...n,...$,defaultValues:a})}}});if(!A)return R;let k=!1;return()=>{k||(k=!0,u--,R())}},Ve=f=>(o.mount=!0,x={...x,...f.formState},re({...f,formState:{...p,...f.formState}})),rt=(f,N={})=>{for(const A of f?gs(f):l.mount)l.mount.delete(A),l.array.delete(A),N.keepValue||($e(r,A),$e(i,A)),!N.keepError&&$e(n.errors,A),!N.keepDirty&&$e(n.dirtyFields,A),!N.keepTouched&&$e(n.touchedFields,A),!N.keepIsValidating&&$e(n.validatingFields,A),!t.shouldUnregister&&!N.keepDefaultValue&&$e(a,A);b.state.next({values:_e(i)}),b.state.next({...n,...N.keepDirty?{isDirty:W()}:{}}),!N.keepIsValid&&j()},vt=({disabled:f,name:N})=>{if(ct(f)&&o.mount||f||l.disabled.has(N)){const k=l.disabled.has(N)!==!!f;f?l.disabled.add(N):l.disabled.delete(N),k&&o.mount&&!o.action&&j()}},xt=(f,N={})=>{let A=B(r,f);const R=ct(N.disabled)||ct(t.disabled),k=!l.registerName.has(f)&&A&&A._f&&!A._f.mount;return xe(r,f,{...A||{},_f:{...A&&A._f?A._f:{ref:{name:f}},name:f,mount:!0,...N}}),l.mount.add(f),A&&!k?vt({disabled:ct(N.disabled)?N.disabled:t.disabled,name:f}):V(f,!0,N.value),{...R?{disabled:N.disabled||t.disabled}:{},...t.progressive?{required:!!N.required,min:Nr(N.min),max:Nr(N.max),minLength:Nr(N.minLength),maxLength:Nr(N.maxLength),pattern:Nr(N.pattern)}:{},name:f,onChange:z,onBlur:z,ref:$=>{if($){l.registerName.add(f),xt(f,N),l.registerName.delete(f),A=B(r,f);const M=je($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,K=Af(M),q=A._f.refs||[];if(K?q.find(ae=>ae===M):M===A._f.ref)return;xe(r,f,{_f:{...A._f,...K?{refs:[...q.filter(la),M,...Array.isArray(B(a,f))?[{}]:[]],ref:{type:M.type,name:f}}:{ref:M}}}),V(f,!1,void 0,M)}else A=B(r,f,{}),A._f&&(A._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(Pc(l.array,f)&&o.action)&&l.unMount.add(f)}}},jt=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Ir(r,ue,l.mount),Mt=f=>{ct(f)&&(b.state.next({disabled:f}),Ir(r,(N,A)=>{const R=B(r,A);R&&(N.disabled=R._f.disabled||f,Array.isArray(R._f.refs)&&R._f.refs.forEach(k=>{k.disabled=R._f.disabled||f}))},0,!1))},wt=(f,N)=>async A=>{let R;A&&(A.preventDefault&&A.preventDefault(),A.persist&&A.persist());let k=_e(i);if(b.state.next({isSubmitting:!0}),t.resolver){const{errors:$,values:M}=await H();S(),n.errors=$,k=_e(M)}else await ie({fields:r,eventType:nn.SUBMIT});if(l.disabled.size)for(const $ of l.disabled)$e(k,$);if($e(n.errors,Ic),Ue(n.errors)){b.state.next({errors:{}});try{await f(k,A)}catch($){R=$}}else N&&await N({...n.errors},A),jt(),setTimeout(jt);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ue(n.errors)&&!R,submitCount:n.submitCount+1,errors:n.errors}),R)throw R},qt=(f,N={})=>{B(r,f)&&(je(N.defaultValue)?L(f,_e(B(a,f))):(L(f,N.defaultValue),xe(a,f,_e(N.defaultValue))),N.keepTouched||$e(n.touchedFields,f),N.keepDirty||($e(n.dirtyFields,f),n.isDirty=N.defaultValue?W(f,_e(B(a,f))):W()),N.keepError||($e(n.errors,f),g.isValid&&j()),b.state.next({...n}))},Pt=(f,N={})=>{const A=f?_e(f):a,R=_e(A),k=Ue(f),$=R;if(N.keepDefaultValues||(a=A),!N.keepValues){if(N.keepDirtyValues){const M=new Set([...l.mount,...Object.keys(vn(a,i))]);for(const K of Array.from(M)){const q=B(n.dirtyFields,K),ae=B(i,K),Me=B($,K);q&&!je(ae)?xe($,K,ae):!q&&!je(Me)&&L(K,Me)}}else{if(Us&&je(f))for(const M of l.mount){const K=B(r,M);if(K&&K._f){const q=Array.isArray(K._f.refs)?K._f.refs[0]:K._f.ref;if(ks(q)){const ae=q.closest("form");if(ae){ae.reset();break}}}}if(N.keepFieldsRef)for(const M of l.mount)L(M,B($,M));else r={}}if(t.shouldUnregister){if(i=N.keepDefaultValues?_e(a):{},N.keepFieldsRef)for(const M of l.mount)xe(i,M,B($,M))}else i=_e($);b.array.next({values:{...$}}),b.state.next({name:void 0,type:void 0,values:{...$}})}l={mount:N.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!g.isValid||!!N.keepIsValid||!!N.keepDirtyValues||!t.shouldUnregister&&!Ue($),o.watch=!!t.shouldUnregister,o.keepIsValid=!!N.keepIsValid,o.action=!1,N.keepErrors||(n.errors={}),b.state.next({submitCount:N.keepSubmitCount?n.submitCount:0,isDirty:k?!1:N.keepDirty?n.isDirty:N.keepValues?W():!!(N.keepDefaultValues&&!ut(f,a)),isSubmitted:N.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:k?{}:N.keepDirtyValues?N.keepDefaultValues&&i?vn(a,i):n.dirtyFields:N.keepDefaultValues&&f?vn(a,f):N.keepDirty?n.dirtyFields:{},touchedFields:N.keepTouched?n.touchedFields:{},errors:N.keepErrors?n.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Et=(f,N)=>Pt(Ke(f)?f(i):f,{...t.resetOptions,...N}),It=(f,N={})=>{const A=B(r,f),R=A&&A._f;if(R){const k=R.refs?R.refs[0]:R.ref;k.focus&&setTimeout(()=>{k.focus(),N.shouldSelect&&Ke(k.select)&&k.select()})}},Tt=f=>{const{name:N,type:A,values:R,...k}=f;n={...n,...k}},Nt={control:{register:xt,unregister:rt,getFieldState:Oe,handleSubmit:wt,setError:be,_subscribe:re,_runSchema:H,_updateIsValidating:S,_focusError:jt,_getWatch:we,_getDirty:W,_setValid:j,_setFieldArray:F,_setDisabledField:vt,_setErrors:T,_getFieldArray:Ae,_reset:Pt,_resetDefaultValues:()=>Ke(t.defaultValues)&&t.defaultValues().then(f=>{Et(f,t.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:G,_disableForm:Mt,_subjects:b,_proxyFormState:g,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(f){o=f},get _defaultValues(){return a},get _names(){return l},set _names(f){l=f},get _formState(){return n},get _options(){return t},set _options(f){t={...t,...f},m=ss(t.mode),h=ss(t.reValidateMode)}},subscribe:Ve,trigger:Te,register:xt,handleSubmit:wt,watch:Ye,setValue:L,setValues:fe,getValues:Ge,reset:Et,resetField:qt,resetDefaultValues:(f,N={})=>{if(a=_e(f),!N.keepDirty){const A=vn(a,i);n.dirtyFields=A,n.isDirty=!Ue(A)}N.keepIsValid||j(),b.state.next({...n,defaultValues:a})},clearErrors:le,unregister:rt,setError:be,setFocus:It,getFieldState:Oe};return{...Nt,formControl:Nt}}function Lt(e={}){const t=v.useRef(void 0),n=v.useRef(void 0),r=v.useRef(e.formControl),[a,i]=v.useState(()=>({..._e(qc),isLoading:Ke(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Ke(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl)if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:a},e.defaultValues&&!Ke(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...c}=zf(e);t.current={...c,formState:a}}const o=t.current.control;return o._options=e,Ai(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,l},[o]),v.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),v.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),v.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),v.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==a.isDirty&&o._subjects.state.next({isDirty:l})}},[o,a.isDirty]),v.useEffect(()=>{var l;e.values&&!ut(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((l=o._options.resetOptions)===null||l===void 0)&&l.keepIsValid||o._setValid(),n.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),v.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=v.useMemo(()=>_c(a,o),[o,a]),t.current}const Mo=(e,t,n)=>{if(e&&"reportValidity"in e){const r=B(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Ha=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Mo(r.ref,n,e):r&&r.refs&&r.refs.forEach(a=>Mo(a,n,e))}},qo=(e,t)=>{t.shouldUseNativeValidation&&Ha(e,t);const n={};for(const r in e){const a=B(t.fields,r),i=Object.assign(e[r]||{},{ref:a&&a.ref});if(Mf(t.names||Object.keys(e),r)){const o=Object.assign({},B(n,r));xe(o,"root",i),xe(n,r,o)}else xe(n,r,i)}return n},Mf=(e,t)=>{const n=Bo(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(r=>Bo(r).match(`^${n}\\.\\d+`))};function Bo(e){return e.replace(/[\[\]]/g,"")}var Vo;function D(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const d=o.prototype,u=Object.keys(d);for(let m=0;m<u.length;m++){const h=u[m];h in l||(l[h]=d[h].bind(l))}}const a=(n==null?void 0:n.Parent)??Object;class i extends a{}Object.defineProperty(i,"name",{value:e});function o(l){var c;const d=n!=null&&n.Parent?new i:this;r(d,l),(c=d._zod).deferred??(c.deferred=[]);for(const u of d._zod.deferred)u();return d}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:l=>{var c,d;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(d=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(o,"name",{value:e}),o}class Zn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Bc extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Vo=globalThis).__zod_globalConfig??(Vo.__zod_globalConfig={});const Ti=globalThis.__zod_globalConfig;function Fn(e){return Ti}function Vc(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function Ka(e,t){return typeof t=="bigint"?t.toString():t}function _i(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Di(e){return e==null}function Fi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Uo=Symbol("evaluating");function ve(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Uo)return r===void 0&&(r=Uo,r=n()),r},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Mn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function gn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Zo(e){return JSON.stringify(e)}function qf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Uc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function As(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Bf=_i(()=>{var e;if(Ti.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Fr(e){if(As(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(As(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Zc(e){return Fr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Vf=new Set(["string","number","symbol"]);function lr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function se(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Uf(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Zf(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=gn(e._zod.def,{get shape(){const o={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(o[l]=n.shape[l])}return Mn(this,"shape",o),o},checks:[]});return yn(e,i)}function Wf(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=gn(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete o[l]}return Mn(this,"shape",o),o},checks:[]});return yn(e,i)}function Yf(e,t){if(!Fr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const o in t)if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const a=gn(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Mn(this,"shape",i),i}});return yn(e,a)}function Hf(e,t){if(!Fr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=gn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Mn(this,"shape",r),r}});return yn(e,n)}function Kf(e,t){var r;if((r=e._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=gn(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Mn(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return yn(e,n)}function Qf(e,t,n){const a=t._zod.def.checks;if(a&&a.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=gn(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const d in n){if(!(d in l))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(c[d]=e?new e({type:"optional",innerType:l[d]}):l[d])}else for(const d in l)c[d]=e?new e({type:"optional",innerType:l[d]}):l[d];return Mn(this,"shape",c),c},checks:[]});return yn(t,o)}function Jf(e,t,n){const r=gn(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=new e({type:"nonoptional",innerType:a[o]}))}else for(const o in a)i[o]=new e({type:"nonoptional",innerType:a[o]});return Mn(this,"shape",i),i}});return yn(t,r)}function Vn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Gf(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function Wc(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function as(e){return typeof e=="string"?e:e==null?void 0:e.message}function Rn(e,t,n){var c,d,u,m,h,p;const r=e.message?e.message:as((u=(d=(c=e.inst)==null?void 0:c._zod.def)==null?void 0:d.error)==null?void 0:u.call(d,e))??as((m=t==null?void 0:t.error)==null?void 0:m.call(t,e))??as((h=n.customError)==null?void 0:h.call(n,e))??as((p=n.localeError)==null?void 0:p.call(n,e))??"Invalid input",{inst:a,continue:i,input:o,...l}=e;return l.path??(l.path=[]),l.message=r,t!=null&&t.reportInput&&(l.input=o),l}function Ri(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Rr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Yc=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ka,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Li=D("$ZodError",Yc),Ws=D("$ZodError",Yc,{Parent:Error});function Xf(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function ep(e,t=n=>n.message){const n={_errors:[]},r=(a,i=[])=>{for(const o of a.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(l=>r({issues:l},[...i,...o.path]));else if(o.code==="invalid_key")r({issues:o.issues},[...i,...o.path]);else if(o.code==="invalid_element")r({issues:o.issues},[...i,...o.path]);else{const l=[...i,...o.path];if(l.length===0)n._errors.push(t(o));else{let c=n,d=0;for(;d<l.length;){const u=l[d];d===l.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(o))):c[u]=c[u]||{_errors:[]},c=c[u],d++}}}};return r(e),n}const Ys=e=>(t,n,r,a)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new Zn;if(o.issues.length){const l=new((a==null?void 0:a.Err)??e)(o.issues.map(c=>Rn(c,i,Fn())));throw Uc(l,a==null?void 0:a.callee),l}return o.value},tp=Ys(Ws),Hs=e=>async(t,n,r,a)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const l=new((a==null?void 0:a.Err)??e)(o.issues.map(c=>Rn(c,i,Fn())));throw Uc(l,a==null?void 0:a.callee),l}return o.value},np=Hs(Ws),Ks=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new Zn;return i.issues.length?{success:!1,error:new(e??Li)(i.issues.map(o=>Rn(o,a,Fn())))}:{success:!0,data:i.value}},rp=Ks(Ws),Qs=e=>async(t,n,r)=>{const a=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},a);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(o=>Rn(o,a,Fn())))}:{success:!0,data:i.value}},sp=Qs(Ws),ap=e=>(t,n,r)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return Ys(e)(t,n,a)},ip=e=>(t,n,r)=>Ys(e)(t,n,r),op=e=>async(t,n,r)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return Hs(e)(t,n,a)},lp=e=>async(t,n,r)=>Hs(e)(t,n,r),cp=e=>(t,n,r)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return Ks(e)(t,n,a)},up=e=>(t,n,r)=>Ks(e)(t,n,r),dp=e=>async(t,n,r)=>{const a=r?{...r,direction:"backward"}:{direction:"backward"};return Qs(e)(t,n,a)},mp=e=>async(t,n,r)=>Qs(e)(t,n,r),hp=/^[cC][0-9a-z]{6,}$/,fp=/^[0-9a-z]+$/,pp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xp=/^[0-9a-vA-V]{20}$/,gp=/^[A-Za-z0-9]{27}$/,yp=/^[a-zA-Z0-9_-]{21}$/,bp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Wo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,jp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,wp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Np(){return new RegExp(wp,"u")}const Sp=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Cp=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ap=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Pp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hc=/^[A-Za-z0-9_-]*$/,Ep=/^https?$/,Ip=/^\+[1-9]\d{6,14}$/,Kc="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Tp=new RegExp(`^${Kc}$`);function Qc(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function _p(e){return new RegExp(`^${Qc(e)}$`)}function Dp(e){const t=Qc({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Kc}T(?:${r})$`)}const Fp=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Rp=/^(?:true|false)$/i,Lp=/^[^A-Z]*$/,$p=/^[^a-z]*$/,$t=D("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Op=D("$ZodCheckMaxLength",(e,t)=>{var n;$t.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Di(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;if(a.length<=t.maximum)return;const o=Ri(a);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),zp=D("$ZodCheckMinLength",(e,t)=>{var n;$t.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Di(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;if(a.length>=t.minimum)return;const o=Ri(a);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),Mp=D("$ZodCheckLengthEquals",(e,t)=>{var n;$t.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!Di(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=r=>{const a=r.value,i=a.length;if(i===t.length)return;const o=Ri(a),l=i>t.length;r.issues.push({origin:o,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Js=D("$ZodCheckStringFormat",(e,t)=>{var n,r;$t.init(e,t),e._zod.onattach.push(a=>{const i=a._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),qp=D("$ZodCheckRegex",(e,t)=>{Js.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Bp=D("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Lp),Js.init(e,t)}),Vp=D("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$p),Js.init(e,t)}),Up=D("$ZodCheckIncludes",(e,t)=>{$t.init(e,t);const n=lr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(a=>{const i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),Zp=D("$ZodCheckStartsWith",(e,t)=>{$t.init(e,t);const n=new RegExp(`^${lr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Wp=D("$ZodCheckEndsWith",(e,t)=>{$t.init(e,t);const n=new RegExp(`.*${lr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Yp=D("$ZodCheckOverwrite",(e,t)=>{$t.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Hp{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
13
|
-
`).filter(o=>o),a=Math.min(...
|
|
14
|
-
`))}}const
|
|
15
|
-
if (${
|
|
16
|
-
if (${
|
|
17
|
-
payload.issues = payload.issues.concat(${
|
|
12
|
+
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let u=Ae(),h;if(t){let C=typeof t=="string"?Hn(t):t;Le(c==="/"||((y=C.pathname)==null?void 0:y.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${C.pathname}" was given in the \`location\` prop.`),h=C}else h=u;let m=h.pathname||"/",f=m;if(c!=="/"){let C=c.replace(/^\//,"").split("/");f="/"+m.replace(/^\//,"").split("/").slice(C.length).join("/")}let p=n&&n.state.matches.length?n.state.matches.map(C=>Object.assign(C,{route:n.manifest[C.route.id]||C.route})):ic(e,{pathname:f});St(d||p!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),St(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=Um(p&&p.map(C=>Object.assign({},C,{params:Object.assign({},o,C.params),pathname:qt([c,s.encodeLocation?s.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?c:qt([c,s.encodeLocation?s.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),a,n);return t&&g?I.createElement(Kr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...h},navigationType:"POP"}},g):g}function zm(){let e=Km(),t=jm(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:s},i={padding:"2px 4px",backgroundColor:s},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=I.createElement(I.Fragment,null,I.createElement("p",null,"💿 Hey developer 👋"),I.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",I.createElement("code",{style:i},"ErrorBoundary")," or"," ",I.createElement("code",{style:i},"errorElement")," prop on your route.")),I.createElement(I.Fragment,null,I.createElement("h2",null,"Unexpected Application Error!"),I.createElement("h3",{style:{fontStyle:"italic"}},t),n?I.createElement("pre",{style:a},n):null,o)}var Vm=I.createElement(zm,null),jc=class extends I.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Fm(e.digest);n&&(e=n)}let t=e!==void 0?I.createElement(Rt.Provider,{value:this.props.routeContext},I.createElement(gi.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?I.createElement(qm,{error:e},t):t}};jc.contextType=pc;var da=new WeakMap;function qm({children:e,error:t}){let{basename:n}=I.useContext(kt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=Lm(t.digest);if(s){let a=da.get(t);if(a)throw a;let i=hc(s.location,n),o=i.absoluteURL||i.to;if(km(o))throw new Error("Invalid redirect location");if(mc&&!da.get(t))if(i.isExternal||s.reloadDocument)window.location.href=o;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:s.replace}));throw da.set(t,l),l}return I.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function Zm({routeContext:e,match:t,children:n}){let s=I.useContext(gr);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),I.createElement(Rt.Provider,{value:e},n)}function Um(e,t=[],n){let s=n==null?void 0:n.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let a=e,i=s==null?void 0:s.errors;if(i!=null){let u=a.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);Le(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),a=a.slice(0,Math.min(a.length,u+1))}let o=!1,l=-1;if(n&&s){o=s.renderFallback;for(let u=0;u<a.length;u++){let h=a[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=u),h.route.id){let{loaderData:m,errors:f}=s,p=h.route.loader&&!m.hasOwnProperty(h.route.id)&&(!f||f[h.route.id]===void 0);if(h.route.lazy||p){n.isStatic&&(o=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=s&&c?(u,h)=>{var m,f;c(u,{location:s.location,params:((f=(m=s.matches)==null?void 0:m[0])==null?void 0:f.params)??{},pattern:wm(s.matches),errorInfo:h})}:void 0;return a.reduceRight((u,h,m)=>{let f,p=!1,g=null,y=null;s&&(f=i&&h.route.id?i[h.route.id]:void 0,g=h.route.errorElement||Vm,o&&(l<0&&m===0?(wc("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,y=null):l===m&&(p=!0,y=h.route.hydrateFallbackElement||null)));let C=t.concat(a.slice(0,m+1)),b=()=>{let j;return f?j=g:p?j=y:h.route.Component?j=I.createElement(h.route.Component,null):h.route.element?j=h.route.element:j=u,I.createElement(Zm,{match:h,routeContext:{outlet:u,matches:C,isDataRoute:s!=null},children:j})};return s&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?I.createElement(jc,{location:s.location,revalidation:s.revalidation,component:g,error:f,children:b(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:d}):b()},null)}function yi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bm(e){let t=I.useContext(gr);return Le(t,yi(e)),t}function Wm(e){let t=I.useContext(Us);return Le(t,yi(e)),t}function Ym(e){let t=I.useContext(Rt);return Le(t,yi(e)),t}function bi(e){let t=Ym(e),n=t.matches[t.matches.length-1];return Le(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Hm(){return bi("useRouteId")}function Km(){var s;let e=I.useContext(gi),t=Wm("useRouteError"),n=bi("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function Qm(){let{router:e}=Bm("useNavigate"),t=bi("useNavigate"),n=I.useRef(!1);return bc(()=>{n.current=!0}),I.useCallback(async(a,i={})=>{St(n.current,yc),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...i}))},[e,t])}var Po={};function wc(e,t,n){!t&&!Po[e]&&(Po[e]=!0,St(!1,n))}I.memo(Gm);function Gm({routes:e,manifest:t,future:n,state:s,isStatic:a,onError:i}){return Cc(e,void 0,{manifest:t,state:s,isStatic:a,onError:i})}function Jm({basename:e,children:t,initialEntries:n,initialIndex:s,useTransitions:a}){let i=I.useRef();i.current==null&&(i.current=em({initialEntries:n,initialIndex:s,v5Compat:!0}));let o=i.current,[l,c]=I.useState({action:o.action,location:o.location}),d=I.useCallback(u=>{a===!1?c(u):I.startTransition(()=>c(u))},[a]);return I.useLayoutEffect(()=>o.listen(d),[o,d]),I.createElement(_m,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,useTransitions:a})}function He({to:e,replace:t,state:n,relative:s}){Le(yr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=I.useContext(kt);St(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=I.useContext(Rt),{pathname:o}=Ae(),l=Ie(),c=Zs(e,xi(i),o,s==="path"),d=JSON.stringify(c);return I.useEffect(()=>{l(JSON.parse(d),{replace:t,state:n,relative:s})},[l,d,s,t,n]),null}function Xm(e){return Mm(e.context)}function re(e){Le(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function _m({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:a,static:i=!1,useTransitions:o}){Le(!yr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=I.useMemo(()=>({basename:l,navigator:a,static:i,useTransitions:o,future:{}}),[l,a,i,o]);typeof n=="string"&&(n=Hn(n));let{pathname:d="/",search:u="",hash:h="",state:m=null,key:f="default",mask:p}=n,g=I.useMemo(()=>{let y=rn(d,l);return y==null?null:{location:{pathname:y,search:u,hash:h,state:m,key:f,mask:p},navigationType:s}},[l,d,u,h,m,f,s,p]);return St(g!=null,`<Router basename="${l}"> is not able to match the URL "${d}${u}${h}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:I.createElement(kt.Provider,{value:c},I.createElement(Kr.Provider,{children:t,value:g}))}function vi({children:e,location:t}){return Om(Ta(e),t)}function Ta(e,t=[]){let n=[];return I.Children.forEach(e,(s,a)=>{if(!I.isValidElement(s))return;let i=[...t,a];if(s.type===I.Fragment){n.push.apply(n,Ta(s.props.children,i));return}Le(s.type===re,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Le(!s.props.index||!s.props.children,"An index route cannot have child routes.");let o={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(o.children=Ta(s.props.children,i)),n.push(o)}),n}var ms="get",hs="application/x-www-form-urlencoded";function Ws(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function $m(e){return Ws(e)&&e.tagName.toLowerCase()==="button"}function e0(e){return Ws(e)&&e.tagName.toLowerCase()==="form"}function t0(e){return Ws(e)&&e.tagName.toLowerCase()==="input"}function n0(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function r0(e,t){return e.button===0&&(!t||t==="_self")&&!n0(e)}function La(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function s0(e,t){let n=La(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(i=>{n.append(a,i)})}),n}var ts=null;function a0(){if(ts===null)try{new FormData(document.createElement("form"),0),ts=!1}catch{ts=!0}return ts}var i0=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ma(e){return e!=null&&!i0.has(e)?(St(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${hs}"`),null):e}function o0(e,t){let n,s,a,i,o;if(e0(e)){let l=e.getAttribute("action");s=l?rn(l,t):null,n=e.getAttribute("method")||ms,a=ma(e.getAttribute("enctype"))||hs,i=new FormData(e)}else if($m(e)||t0(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(s=c?rn(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||ms,a=ma(e.getAttribute("formenctype"))||ma(l.getAttribute("enctype"))||hs,i=new FormData(l,e),!a0()){let{name:d,type:u,value:h}=e;if(u==="image"){let m=d?`${d}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else d&&i.append(d,h)}}else{if(Ws(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ms,s=null,a=hs,o=e}return i&&a==="text/plain"&&(o=i,i=void 0),{action:s,method:n.toLowerCase(),encType:a,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ci(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Nc(e,t,n,s){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${s}`:a.pathname=`${a.pathname}.${s}`:a.pathname==="/"?a.pathname=`_root.${s}`:t&&rn(a.pathname,t)==="/"?a.pathname=`${ws(t)}/_root.${s}`:a.pathname=`${ws(a.pathname)}.${s}`,a}async function l0(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function c0(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function u0(e,t,n){let s=await Promise.all(e.map(async a=>{let i=t.routes[a.route.id];if(i){let o=await l0(i,n);return o.links?o.links():[]}return[]}));return f0(s.flat(1).filter(c0).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Io(e,t,n,s,a,i){let o=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>{var u;return n[d].pathname!==c.pathname||((u=n[d].route.path)==null?void 0:u.endsWith("*"))&&n[d].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,d)=>o(c,d)||l(c,d)):i==="data"?t.filter((c,d)=>{var h;let u=s.routes[c.route.id];if(!u||!u.hasLoader)return!1;if(o(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let m=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function d0(e,t,{includeHydrateFallback:n}={}){return m0(e.map(s=>{let a=t.routes[s.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function m0(e){return[...new Set(e)]}function h0(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function f0(e,t){let n=new Set;return new Set(t),e.reduce((s,a)=>{let i=JSON.stringify(h0(a));return n.has(i)||(n.add(i),s.push({key:i,link:a})),s},[])}function ji(){let e=I.useContext(gr);return Ci(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function p0(){let e=I.useContext(Us);return Ci(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var wi=I.createContext(void 0);wi.displayName="FrameworkContext";function Ys(){let e=I.useContext(wi);return Ci(e,"You must render this element inside a <HydratedRouter> element"),e}function x0(e,t){let n=I.useContext(wi),[s,a]=I.useState(!1),[i,o]=I.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:u,onTouchStart:h}=t,m=I.useRef(null);I.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let g=C=>{C.forEach(b=>{o(b.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return m.current&&y.observe(m.current),()=>{y.disconnect()}}},[e]),I.useEffect(()=>{if(s){let g=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(g)}}},[s]);let f=()=>{a(!0)},p=()=>{a(!1),o(!1)};return n?e!=="intent"?[i,m,{}]:[i,m,{onFocus:Pr(l,f),onBlur:Pr(c,p),onMouseEnter:Pr(d,f),onMouseLeave:Pr(u,p),onTouchStart:Pr(h,f)}]:[!1,m,{}]}function Pr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function g0({page:e,...t}){let n=Am(),{nonce:s}=Ys(),{router:a}=ji(),i=I.useMemo(()=>ic(a.routes,e,a.basename),[a.routes,e,a.basename]);return i?(t.nonce==null&&s&&(t={...t,nonce:s}),n?I.createElement(b0,{page:e,matches:i,...t}):I.createElement(v0,{page:e,matches:i,...t})):null}function y0(e){let{manifest:t,routeModules:n}=Ys(),[s,a]=I.useState([]);return I.useEffect(()=>{let i=!1;return u0(e,t,n).then(o=>{i||a(o)}),()=>{i=!0}},[e,t,n]),s}function b0({page:e,matches:t,...n}){let s=Ae(),{future:a}=Ys(),{basename:i}=ji(),o=I.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let l=Nc(e,i,a.v8_trailingSlashAwareDataRequests,"rsc"),c=!1,d=[];for(let u of t)typeof u.route.shouldRevalidate=="function"?c=!0:d.push(u.route.id);return c&&d.length>0&&l.searchParams.set("_routes",d.join(",")),[l.pathname+l.search]},[i,a.v8_trailingSlashAwareDataRequests,e,s,t]);return I.createElement(I.Fragment,null,o.map(l=>I.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...n})))}function v0({page:e,matches:t,...n}){let s=Ae(),{future:a,manifest:i,routeModules:o}=Ys(),{basename:l}=ji(),{loaderData:c,matches:d}=p0(),u=I.useMemo(()=>Io(e,t,d,i,s,"data"),[e,t,d,i,s]),h=I.useMemo(()=>Io(e,t,d,i,s,"assets"),[e,t,d,i,s]),m=I.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let g=new Set,y=!1;if(t.forEach(b=>{var N;let j=i.routes[b.route.id];!j||!j.hasLoader||(!u.some(A=>A.route.id===b.route.id)&&b.route.id in c&&((N=o[b.route.id])!=null&&N.shouldRevalidate)||j.hasClientLoader?y=!0:g.add(b.route.id))}),g.size===0)return[];let C=Nc(e,l,a.v8_trailingSlashAwareDataRequests,"data");return y&&g.size>0&&C.searchParams.set("_routes",t.filter(b=>g.has(b.route.id)).map(b=>b.route.id).join(",")),[C.pathname+C.search]},[l,a.v8_trailingSlashAwareDataRequests,c,s,i,u,t,e,o]),f=I.useMemo(()=>d0(h,i),[h,i]),p=y0(h);return I.createElement(I.Fragment,null,m.map(g=>I.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),f.map(g=>I.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),p.map(({key:g,link:y})=>I.createElement("link",{key:g,nonce:n.nonce,...y,crossOrigin:y.crossOrigin??n.crossOrigin})))}function C0(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var j0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{j0&&(window.__reactRouterVersion="7.18.1")}catch{}var Sc=I.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:a,reloadDocument:i,replace:o,mask:l,state:c,target:d,to:u,preventScrollReset:h,viewTransition:m,defaultShouldRevalidate:f,...p},g){let{basename:y,navigator:C,useTransitions:b}=I.useContext(kt),j=typeof u=="string"&&pi.test(u),N=hc(u,y);u=N.to;let A=Rm(u,{relative:a}),S=Ae(),R=null;if(l){let B=Zs(l,[],S.mask?S.mask.pathname:"/",!0);y!=="/"&&(B.pathname=B.pathname==="/"?y:qt([y,B.pathname])),R=C.createHref(B)}let[E,z,X]=x0(s,p),H=k0(u,{replace:o,mask:l,state:c,target:d,preventScrollReset:h,relative:a,viewTransition:m,defaultShouldRevalidate:f,useTransitions:b});function _(B){t&&t(B),B.defaultPrevented||H(B)}let V=!(N.isExternal||i),q=I.createElement("a",{...p,...X,href:(V?R:void 0)||N.absoluteURL||A,onClick:V?_:t,ref:C0(g,z),target:d,"data-discover":!j&&n==="render"?"true":void 0});return E&&!j?I.createElement(I.Fragment,null,q,I.createElement(g0,{page:A})):q});Sc.displayName="Link";var w0=I.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:a=!1,style:i,to:o,viewTransition:l,children:c,...d},u){let h=Qr(o,{relative:d.relative}),m=Ae(),f=I.useContext(Us),{navigator:p,basename:g}=I.useContext(kt),y=f!=null&&L0(h)&&l===!0,C=p.encodeLocation?p.encodeLocation(h).pathname:h.pathname,b=m.pathname,j=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;n||(b=b.toLowerCase(),j=j?j.toLowerCase():null,C=C.toLowerCase()),j&&g&&(j=rn(j,g)||j);const N=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let A=b===C||!a&&b.startsWith(C)&&b.charAt(N)==="/",S=j!=null&&(j===C||!a&&j.startsWith(C)&&j.charAt(C.length)==="/"),R={isActive:A,isPending:S,isTransitioning:y},E=A?t:void 0,z;typeof s=="function"?z=s(R):z=[s,A?"active":null,S?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let X=typeof i=="function"?i(R):i;return I.createElement(Sc,{...d,"aria-current":E,className:z,ref:u,style:X,to:o,viewTransition:l},typeof c=="function"?c(R):c)});w0.displayName="NavLink";var N0=I.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:a,state:i,method:o=ms,action:l,onSubmit:c,relative:d,preventScrollReset:u,viewTransition:h,defaultShouldRevalidate:m,...f},p)=>{let{useTransitions:g}=I.useContext(kt),y=E0(),C=T0(l,{relative:d}),b=o.toLowerCase()==="get"?"get":"post",j=typeof l=="string"&&pi.test(l),N=A=>{if(c&&c(A),A.defaultPrevented)return;A.preventDefault();let S=A.nativeEvent.submitter,R=(S==null?void 0:S.getAttribute("formmethod"))||o,E=()=>y(S||A.currentTarget,{fetcherKey:t,method:R,navigate:n,replace:a,state:i,relative:d,preventScrollReset:u,viewTransition:h,defaultShouldRevalidate:m});g&&n!==!1?I.startTransition(()=>E()):E()};return I.createElement("form",{ref:p,method:b,action:C,onSubmit:s?c:N,...f,"data-discover":!j&&e==="render"?"true":void 0})});N0.displayName="Form";function S0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kc(e){let t=I.useContext(gr);return Le(t,S0(e)),t}function k0(e,{target:t,replace:n,mask:s,state:a,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c,useTransitions:d}={}){let u=Ie(),h=Ae(),m=Qr(e,{relative:o});return I.useCallback(f=>{if(r0(f,t)){f.preventDefault();let p=n!==void 0?n:Cs(h)===Cs(m),g=()=>u(e,{replace:p,mask:s,state:a,preventScrollReset:i,relative:o,viewTransition:l,defaultShouldRevalidate:c});d?I.startTransition(()=>g()):g()}},[h,u,m,n,s,a,t,e,i,o,l,c,d])}function A0(e){St(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=I.useRef(La(e)),n=I.useRef(!1),s=Ae(),a=I.useMemo(()=>s0(s.search,n.current?null:t.current),[s.search]),i=Ie(),o=I.useCallback((l,c)=>{const d=La(typeof l=="function"?l(new URLSearchParams(a)):l);n.current=!0,i("?"+d,c)},[i,a]);return[a,o]}var P0=0,I0=()=>`__${String(++P0)}__`;function E0(){let{router:e}=kc("useSubmit"),{basename:t}=I.useContext(kt),n=Hm(),s=e.fetch,a=e.navigate;return I.useCallback(async(i,o={})=>{let{action:l,method:c,encType:d,formData:u,body:h}=o0(i,t);if(o.navigate===!1){let m=o.fetcherKey||I0();await s(m,n,o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:h,formMethod:o.method||c,formEncType:o.encType||d,flushSync:o.flushSync})}else await a(o.action||l,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:h,formMethod:o.method||c,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[s,a,t,n])}function T0(e,{relative:t}={}){let{basename:n}=I.useContext(kt),s=I.useContext(Rt);Le(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),i={...Qr(e||".",{relative:t})},o=Ae();if(e==null){i.search=o.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(u=>u==="")){l.delete("index"),c.filter(h=>h).forEach(h=>l.append("index",h));let u=l.toString();i.search=u?`?${u}`:""}}return(!e||e===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:qt([n,i.pathname])),Cs(i)}function L0(e,{relative:t}={}){let n=I.useContext(xc);Le(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=kc("useViewTransitionState"),a=Qr(e,{relative:t});if(!n.isTransitioning)return!1;let i=rn(n.currentLocation.pathname,s)||n.currentLocation.pathname,o=rn(n.nextLocation.pathname,s)||n.nextLocation.pathname;return js(a.pathname,o)!=null||js(a.pathname,i)!=null}var br=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Tn,un,tr,Gl,F0=(Gl=class extends br{constructor(){super();te(this,Tn);te(this,un);te(this,tr);J(this,tr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){w(this,un)||this.setEventListener(w(this,tr))}onUnsubscribe(){var t;this.hasListeners()||((t=w(this,un))==null||t.call(this),J(this,un,void 0))}setEventListener(t){var n;J(this,tr,t),(n=w(this,un))==null||n.call(this),J(this,un,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){w(this,Tn)!==t&&(J(this,Tn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof w(this,Tn)=="boolean"?w(this,Tn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Tn=new WeakMap,un=new WeakMap,tr=new WeakMap,Gl),Ni=new F0,R0={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Wt,Ln,Jl,D0=(Jl=class{constructor(){te(this,Wt,R0);te(this,Ln,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&w(this,Ln)&&e!==w(this,Wt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:w(this,Wt),provider:e}),J(this,Wt,e),process.env.NODE_ENV!=="production"&&J(this,Ln,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&J(this,Ln,!0),w(this,Wt).setTimeout(e,t)}clearTimeout(e){w(this,Wt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&J(this,Ln,!0),w(this,Wt).setInterval(e,t)}clearInterval(e){w(this,Wt).clearInterval(e)}},Wt=new WeakMap,Ln=new WeakMap,Jl),En=new D0;function M0(e){setTimeout(e,0)}var O0=typeof window>"u"||"Deno"in globalThis;function ot(){}function z0(e,t){return typeof e=="function"?e(t):e}function Fa(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ac(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Cn(e,t){return typeof e=="function"?e(t):e}function vt(e,t){return typeof e=="function"?e(t):e}function Eo(e,t){const{type:n="all",exact:s,fetchStatus:a,predicate:i,queryKey:o,stale:l}=e;if(o){if(s){if(t.queryHash!==Si(o,t.options))return!1}else if(!Mr(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||i&&!i(t))}function To(e,t){const{exact:n,status:s,predicate:a,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Un(t.options.mutationKey)!==Un(i))return!1}else if(!Mr(t.options.mutationKey,i))return!1}return!(s&&t.state.status!==s||a&&!a(t))}function Si(e,t){return((t==null?void 0:t.queryKeyHashFn)||Un)(e)}function Un(e){return JSON.stringify(e,(t,n)=>Da(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function Mr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Mr(e[n],t[n])):!1}var V0=Object.prototype.hasOwnProperty;function Ra(e,t,n=0){if(e===t)return e;if(n>500)return t;const s=Lo(e)&&Lo(t);if(!s&&!(Da(e)&&Da(t)))return t;const i=(s?e:Object.keys(e)).length,o=s?t:Object.keys(t),l=o.length,c=s?new Array(l):{};let d=0;for(let u=0;u<l;u++){const h=s?u:o[u],m=e[h],f=t[h];if(m===f){c[h]=m,(s?u<i:V0.call(e,h))&&d++;continue}if(m===null||f===null||typeof m!="object"||typeof f!="object"){c[h]=f;continue}const p=Ra(m,f,n+1);c[h]=p,p===m&&d++}return i===l&&d===i?e:c}function Ns(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Lo(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Da(e){if(!Fo(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Fo(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Fo(e){return Object.prototype.toString.call(e)==="[object Object]"}function q0(e){return new Promise(t=>{En.setTimeout(t,e)})}function Ma(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Ra(e,t)}catch(s){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${s}`),s}return Ra(e,t)}return t}function Z0(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function U0(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var Ss=Symbol();function Pc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ss&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ss?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ki(e,t){return typeof e=="function"?e(...t):!!e}function B0(e,t,n){let s=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),s||(s=!0,a.aborted?n():a.addEventListener("abort",n,{once:!0})),a)}),e}var Or=(()=>{let e=()=>O0;return{isServer(){return e()},setIsServer(t){e=t}}})();function Oa(){let e,t;const n=new Promise((a,i)=>{e=a,t=i});n.status="pending",n.catch(()=>{});function s(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{s({status:"fulfilled",value:a}),e(a)},n.reject=a=>{s({status:"rejected",reason:a}),t(a)},n}var W0=M0;function Y0(){let e=[],t=0,n=l=>{l()},s=l=>{l()},a=W0;const i=l=>{t?e.push(l):a(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&a(()=>{s(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{s=l},setScheduler:l=>{a=l}}}var Ke=Y0(),nr,dn,rr,Xl,H0=(Xl=class extends br{constructor(){super();te(this,nr,!0);te(this,dn);te(this,rr);J(this,rr,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){w(this,dn)||this.setEventListener(w(this,rr))}onUnsubscribe(){var t;this.hasListeners()||((t=w(this,dn))==null||t.call(this),J(this,dn,void 0))}setEventListener(t){var n;J(this,rr,t),(n=w(this,dn))==null||n.call(this),J(this,dn,t(this.setOnline.bind(this)))}setOnline(t){w(this,nr)!==t&&(J(this,nr,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return w(this,nr)}},nr=new WeakMap,dn=new WeakMap,rr=new WeakMap,Xl),ks=new H0;function K0(e){return Math.min(1e3*2**e,3e4)}function Ic(e){return(e??"online")==="online"?ks.isOnline():!0}var za=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Ec(e){let t=!1,n=0,s;const a=Oa(),i=()=>a.status!=="pending",o=g=>{var y;if(!i()){const C=new za(g);m(C),(y=e.onCancel)==null||y.call(e,C)}},l=()=>{t=!0},c=()=>{t=!1},d=()=>Ni.isFocused()&&(e.networkMode==="always"||ks.isOnline())&&e.canRun(),u=()=>Ic(e.networkMode)&&e.canRun(),h=g=>{i()||(s==null||s(),a.resolve(g))},m=g=>{i()||(s==null||s(),a.reject(g))},f=()=>new Promise(g=>{var y;s=C=>{(i()||d())&&g(C)},(y=e.onPause)==null||y.call(e)}).then(()=>{var g;s=void 0,i()||(g=e.onContinue)==null||g.call(e)}),p=()=>{if(i())return;let g;const y=n===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(C){g=Promise.reject(C)}Promise.resolve(g).then(h).catch(C=>{var S;if(i())return;const b=e.retry??(Or.isServer()?0:3),j=e.retryDelay??K0,N=typeof j=="function"?j(n,C):j,A=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,C);if(t||!A){m(C);return}n++,(S=e.onFail)==null||S.call(e,n,C),q0(N).then(()=>d()?void 0:f()).then(()=>{t?m(C):p()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?p():f().then(p),a)}}var Fn,_l,Tc=(_l=class{constructor(){te(this,Fn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fa(this.gcTime)&&J(this,Fn,En.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Or.isServer()?1/0:300*1e3))}clearGcTimeout(){w(this,Fn)!==void 0&&(En.clearTimeout(w(this,Fn)),J(this,Fn,void 0))}},Fn=new WeakMap,_l);function Q0(e){return{onFetch:(t,n)=>{var u,h,m,f,p;const s=t.options,a=(m=(h=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,i=((f=t.state.data)==null?void 0:f.pages)||[],o=((p=t.state.data)==null?void 0:p.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const y=j=>{B0(j,()=>t.signal,()=>g=!0)},C=Pc(t.options,t.fetchOptions),b=async(j,N,A)=>{if(g)return Promise.reject(t.signal.reason);if(N==null&&j.pages.length)return Promise.resolve(j);const R=(()=>{const H={client:t.client,queryKey:t.queryKey,pageParam:N,direction:A?"backward":"forward",meta:t.options.meta};return y(H),H})(),E=await C(R),{maxPages:z}=t.options,X=A?U0:Z0;return{pages:X(j.pages,E,z),pageParams:X(j.pageParams,N,z)}};if(a&&i.length){const j=a==="backward",N=j?G0:Ro,A={pages:i,pageParams:o},S=N(s,A);l=await b(A,S,j)}else{const j=e??i.length;do{const N=c===0?o[0]??s.initialPageParam:Ro(s,l);if(c>0&&N==null)break;l=await b(l,N),c++}while(c<j)}return l};t.options.persister?t.fetchFn=()=>{var g,y;return(y=(g=t.options).persister)==null?void 0:y.call(g,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Ro(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function G0(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}var sr,Rn,ar,Et,Dn,Qe,Ur,Mn,bt,Lc,Xt,$l,J0=($l=class extends Tc{constructor(t){super();te(this,bt);te(this,sr);te(this,Rn);te(this,ar);te(this,Et);te(this,Dn);te(this,Qe);te(this,Ur);te(this,Mn);J(this,Mn,!1),J(this,Ur,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,Dn,t.client),J(this,Et,w(this,Dn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,Rn,Mo(this.options)),this.state=t.state??w(this,Rn),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return w(this,sr)}get promise(){var t;return(t=w(this,Qe))==null?void 0:t.promise}setOptions(t){if(this.options={...w(this,Ur),...t},t!=null&&t._type&&J(this,sr,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Mo(this.options);n.data!==void 0&&(this.setState(Do(n.data,n.dataUpdatedAt)),J(this,Rn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&w(this,Et).remove(this)}setData(t,n){const s=Ma(this.state.data,t,this.options);return le(this,bt,Xt).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t){le(this,bt,Xt).call(this,{type:"setState",state:t})}cancel(t){var s,a;const n=(s=w(this,Qe))==null?void 0:s.promise;return(a=w(this,Qe))==null||a.cancel(t),n?n.then(ot).catch(ot):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return w(this,Rn)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>vt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ss||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Cn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!Ac(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=w(this,Qe))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=w(this,Qe))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),w(this,Et).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(w(this,Qe)&&(w(this,Mn)||le(this,bt,Lc).call(this)?w(this,Qe).cancel({revert:!0}):w(this,Qe).cancelRetry()),this.scheduleGc()),w(this,Et).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||le(this,bt,Xt).call(this,{type:"invalidate"})}async fetch(t,n){var d,u,h,m,f,p,g,y,C,b,j;if(this.state.fetchStatus!=="idle"&&((d=w(this,Qe))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(w(this,Qe))return w(this,Qe).continueRetry(),w(this,Qe).promise}if(t&&this.setOptions(t),!this.options.queryFn){const N=this.observers.find(A=>A.options.queryFn);N&&this.setOptions(N.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const s=new AbortController,a=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(J(this,Mn,!0),s.signal)})},i=()=>{const N=Pc(this.options,n),S=(()=>{const R={client:w(this,Dn),queryKey:this.queryKey,meta:this.meta};return a(R),R})();return J(this,Mn,!1),this.options.persister?this.options.persister(N,S,this):N(S)},l=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:w(this,Dn),state:this.state,fetchFn:i};return a(N),N})(),c=w(this,sr)==="infinite"?Q0(this.options.pages):this.options.behavior;c==null||c.onFetch(l,this),J(this,ar,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&le(this,bt,Xt).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta}),J(this,Qe,Ec({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:N=>{N instanceof za&&N.revert&&this.setState({...w(this,ar),fetchStatus:"idle"}),s.abort()},onFail:(N,A)=>{le(this,bt,Xt).call(this,{type:"failed",failureCount:N,error:A})},onPause:()=>{le(this,bt,Xt).call(this,{type:"pause"})},onContinue:()=>{le(this,bt,Xt).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const N=await w(this,Qe).start();if(N===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(N),(f=(m=w(this,Et).config).onSuccess)==null||f.call(m,N,this),(g=(p=w(this,Et).config).onSettled)==null||g.call(p,N,this.state.error,this),N}catch(N){if(N instanceof za){if(N.silent)return w(this,Qe).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw le(this,bt,Xt).call(this,{type:"error",error:N}),(C=(y=w(this,Et).config).onError)==null||C.call(y,N,this),(j=(b=w(this,Et).config).onSettled)==null||j.call(b,this.state.data,N,this),N}finally{this.scheduleGc()}}},sr=new WeakMap,Rn=new WeakMap,ar=new WeakMap,Et=new WeakMap,Dn=new WeakMap,Qe=new WeakMap,Ur=new WeakMap,Mn=new WeakMap,bt=new WeakSet,Lc=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Xt=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Fc(s.data,this.options),fetchMeta:t.meta??null};case"success":const a={...s,...Do(t.data,t.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return J(this,ar,t.manual?a:void 0),a;case"error":const i=t.error;return{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),Ke.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),w(this,Et).notify({query:this,type:"updated",action:t})})},$l);function Fc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ic(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Do(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Mo(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var dt,ge,Br,it,On,ir,_t,mn,Wr,or,lr,zn,Vn,hn,cr,be,Lr,Va,qa,Za,Ua,Ba,Wa,Ya,Rc,ec,X0=(ec=class extends br{constructor(t,n){super();te(this,be);te(this,dt);te(this,ge);te(this,Br);te(this,it);te(this,On);te(this,ir);te(this,_t);te(this,mn);te(this,Wr);te(this,or);te(this,lr);te(this,zn);te(this,Vn);te(this,hn);te(this,cr,new Set);this.options=n,J(this,dt,t),J(this,mn,null),J(this,_t,Oa()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(w(this,ge).addObserver(this),Oo(w(this,ge),this.options)?le(this,be,Lr).call(this):this.updateResult(),le(this,be,Ua).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ha(w(this,ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ha(w(this,ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,le(this,be,Ba).call(this),le(this,be,Wa).call(this),w(this,ge).removeObserver(this)}setOptions(t){const n=this.options,s=w(this,ge);if(this.options=w(this,dt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vt(this.options.enabled,w(this,ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");le(this,be,Ya).call(this),w(this,ge).setOptions(this.options),n._defaulted&&!Ns(this.options,n)&&w(this,dt).getQueryCache().notify({type:"observerOptionsUpdated",query:w(this,ge),observer:this});const a=this.hasListeners();a&&zo(w(this,ge),s,this.options,n)&&le(this,be,Lr).call(this),this.updateResult(),a&&(w(this,ge)!==s||vt(this.options.enabled,w(this,ge))!==vt(n.enabled,w(this,ge))||Cn(this.options.staleTime,w(this,ge))!==Cn(n.staleTime,w(this,ge)))&&le(this,be,Va).call(this);const i=le(this,be,qa).call(this);a&&(w(this,ge)!==s||vt(this.options.enabled,w(this,ge))!==vt(n.enabled,w(this,ge))||i!==w(this,hn))&&le(this,be,Za).call(this,i)}getOptimisticResult(t){const n=w(this,dt).getQueryCache().build(w(this,dt),t),s=this.createResult(n,t);return $0(this,s)&&(J(this,it,s),J(this,ir,this.options),J(this,On,w(this,ge).state)),s}getCurrentResult(){return w(this,it)}trackResult(t,n){return new Proxy(t,{get:(s,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&w(this,_t).status==="pending"&&w(this,_t).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,a))})}trackProp(t){w(this,cr).add(t)}getCurrentQuery(){return w(this,ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=w(this,dt).defaultQueryOptions(t),s=w(this,dt).getQueryCache().build(w(this,dt),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return le(this,be,Lr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),w(this,it)))}createResult(t,n){var z;const s=w(this,ge),a=this.options,i=w(this,it),o=w(this,On),l=w(this,ir),d=t!==s?t.state:w(this,Br),{state:u}=t;let h={...u},m=!1,f;if(n._optimisticResults){const X=this.hasListeners(),H=!X&&Oo(t,n),_=X&&zo(t,s,n,a);(H||_)&&(h={...h,...Fc(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:y}=h;f=h.data;let C=!1;if(n.placeholderData!==void 0&&f===void 0&&y==="pending"){let X;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(X=i.data,C=!0):X=typeof n.placeholderData=="function"?n.placeholderData((z=w(this,lr))==null?void 0:z.state.data,w(this,lr)):n.placeholderData,X!==void 0&&(y="success",f=Ma(i==null?void 0:i.data,X,n),m=!0)}if(n.select&&f!==void 0&&!C)if(i&&f===(o==null?void 0:o.data)&&n.select===w(this,Wr))f=w(this,or);else try{J(this,Wr,n.select),f=n.select(f),f=Ma(i==null?void 0:i.data,f,n),J(this,or,f),J(this,mn,null)}catch(X){J(this,mn,X)}w(this,mn)&&(p=w(this,mn),f=w(this,or),g=Date.now(),y="error");const b=h.fetchStatus==="fetching",j=y==="pending",N=y==="error",A=j&&b,S=f!==void 0,E={status:y,fetchStatus:h.fetchStatus,isPending:j,isSuccess:y==="success",isError:N,isInitialLoading:A,isLoading:A,data:f,dataUpdatedAt:h.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:h.dataUpdateCount>d.dataUpdateCount||h.errorUpdateCount>d.errorUpdateCount,isFetching:b,isRefetching:b&&!j,isLoadingError:N&&!S,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&S,isStale:Ai(t,n),refetch:this.refetch,promise:w(this,_t),isEnabled:vt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const X=E.data!==void 0,H=E.status==="error"&&!X,_=B=>{H?B.reject(E.error):X&&B.resolve(E.data)},V=()=>{const B=J(this,_t,E.promise=Oa());_(B)},q=w(this,_t);switch(q.status){case"pending":t.queryHash===s.queryHash&&_(q);break;case"fulfilled":(H||E.data!==q.value)&&V();break;case"rejected":(!H||E.error!==q.reason)&&V();break}}return E}updateResult(){const t=w(this,it),n=this.createResult(w(this,ge),this.options);if(J(this,On,w(this,ge).state),J(this,ir,this.options),w(this,On).data!==void 0&&J(this,lr,w(this,ge)),Ns(n,t))return;J(this,it,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,i=typeof a=="function"?a():a;if(i==="all"||!i&&!w(this,cr).size)return!0;const o=new Set(i??w(this,cr));return this.options.throwOnError&&o.add("error"),Object.keys(w(this,it)).some(l=>{const c=l;return w(this,it)[c]!==t[c]&&o.has(c)})};le(this,be,Rc).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&le(this,be,Ua).call(this)}},dt=new WeakMap,ge=new WeakMap,Br=new WeakMap,it=new WeakMap,On=new WeakMap,ir=new WeakMap,_t=new WeakMap,mn=new WeakMap,Wr=new WeakMap,or=new WeakMap,lr=new WeakMap,zn=new WeakMap,Vn=new WeakMap,hn=new WeakMap,cr=new WeakMap,be=new WeakSet,Lr=function(t){le(this,be,Ya).call(this);let n=w(this,ge).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ot)),n},Va=function(){le(this,be,Ba).call(this);const t=Cn(this.options.staleTime,w(this,ge));if(Or.isServer()||w(this,it).isStale||!Fa(t))return;const s=Ac(w(this,it).dataUpdatedAt,t)+1;J(this,zn,En.setTimeout(()=>{w(this,it).isStale||this.updateResult()},s))},qa=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(w(this,ge)):this.options.refetchInterval)??!1},Za=function(t){le(this,be,Wa).call(this),J(this,hn,t),!(Or.isServer()||vt(this.options.enabled,w(this,ge))===!1||!Fa(w(this,hn))||w(this,hn)===0)&&J(this,Vn,En.setInterval(()=>{(this.options.refetchIntervalInBackground||Ni.isFocused())&&le(this,be,Lr).call(this)},w(this,hn)))},Ua=function(){le(this,be,Va).call(this),le(this,be,Za).call(this,le(this,be,qa).call(this))},Ba=function(){w(this,zn)!==void 0&&(En.clearTimeout(w(this,zn)),J(this,zn,void 0))},Wa=function(){w(this,Vn)!==void 0&&(En.clearInterval(w(this,Vn)),J(this,Vn,void 0))},Ya=function(){const t=w(this,dt).getQueryCache().build(w(this,dt),this.options);if(t===w(this,ge))return;const n=w(this,ge);J(this,ge,t),J(this,Br,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Rc=function(t){Ke.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(w(this,it))}),w(this,dt).getQueryCache().notify({query:w(this,ge),type:"observerResultsUpdated"})})},ec);function _0(e,t){return vt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&vt(t.retryOnMount,e)===!1)}function Oo(e,t){return _0(e,t)||e.state.data!==void 0&&Ha(e,t,t.refetchOnMount)}function Ha(e,t,n){if(vt(t.enabled,e)!==!1&&Cn(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&Ai(e,t)}return!1}function zo(e,t,n,s){return(e!==t||vt(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Ai(e,n)}function Ai(e,t){return vt(t.enabled,e)!==!1&&e.isStaleByTime(Cn(t.staleTime,e))}function $0(e,t){return!Ns(e.getCurrentResult(),t)}var Yr,Yt,et,qn,Ht,on,tc,e1=(tc=class extends Tc{constructor(t){super();te(this,Ht);te(this,Yr);te(this,Yt);te(this,et);te(this,qn);J(this,Yr,t.client),this.mutationId=t.mutationId,J(this,et,t.mutationCache),J(this,Yt,[]),this.state=t.state||Dc(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){w(this,Yt).includes(t)||(w(this,Yt).push(t),this.clearGcTimeout(),w(this,et).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,Yt,w(this,Yt).filter(n=>n!==t)),this.scheduleGc(),w(this,et).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){w(this,Yt).length||(this.state.status==="pending"?this.scheduleGc():w(this,et).remove(this))}continue(){var t;return((t=w(this,qn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,c,d,u,h,m,f,p,g,y,C,b,j,N,A,S,R;const n=()=>{le(this,Ht,on).call(this,{type:"continue"})},s={client:w(this,Yr),meta:this.options.meta,mutationKey:this.options.mutationKey};J(this,qn,Ec({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(new Error("No mutationFn found")),onFail:(E,z)=>{le(this,Ht,on).call(this,{type:"failed",failureCount:E,error:z})},onPause:()=>{le(this,Ht,on).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>w(this,et).canRun(this)}));const a=this.state.status==="pending",i=!w(this,qn).canStart();try{if(a)n();else{le(this,Ht,on).call(this,{type:"pending",variables:t,isPaused:i}),w(this,et).config.onMutate&&await w(this,et).config.onMutate(t,this,s);const z=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t,s));z!==this.state.context&&le(this,Ht,on).call(this,{type:"pending",context:z,variables:t,isPaused:i})}const E=await w(this,qn).start();return await((d=(c=w(this,et).config).onSuccess)==null?void 0:d.call(c,E,t,this.state.context,this,s)),await((h=(u=this.options).onSuccess)==null?void 0:h.call(u,E,t,this.state.context,s)),await((f=(m=w(this,et).config).onSettled)==null?void 0:f.call(m,E,null,this.state.variables,this.state.context,this,s)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,E,null,t,this.state.context,s)),le(this,Ht,on).call(this,{type:"success",data:E}),E}catch(E){try{await((C=(y=w(this,et).config).onError)==null?void 0:C.call(y,E,t,this.state.context,this,s))}catch(z){Promise.reject(z)}try{await((j=(b=this.options).onError)==null?void 0:j.call(b,E,t,this.state.context,s))}catch(z){Promise.reject(z)}try{await((A=(N=w(this,et).config).onSettled)==null?void 0:A.call(N,void 0,E,this.state.variables,this.state.context,this,s))}catch(z){Promise.reject(z)}try{await((R=(S=this.options).onSettled)==null?void 0:R.call(S,void 0,E,t,this.state.context,s))}catch(z){Promise.reject(z)}throw le(this,Ht,on).call(this,{type:"error",error:E}),E}finally{w(this,et).runNext(this)}}},Yr=new WeakMap,Yt=new WeakMap,et=new WeakMap,qn=new WeakMap,Ht=new WeakSet,on=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ke.batch(()=>{w(this,Yt).forEach(s=>{s.onMutationUpdate(t)}),w(this,et).notify({mutation:this,type:"updated",action:t})})},tc);function Dc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $t,zt,Hr,nc,t1=(nc=class extends br{constructor(t={}){super();te(this,$t);te(this,zt);te(this,Hr);this.config=t,J(this,$t,new Set),J(this,zt,new Map),J(this,Hr,0)}build(t,n,s){const a=new e1({client:t,mutationCache:this,mutationId:++es(this,Hr)._,options:t.defaultMutationOptions(n),state:s});return this.add(a),a}add(t){w(this,$t).add(t);const n=ns(t);if(typeof n=="string"){const s=w(this,zt).get(n);s?s.push(t):w(this,zt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(w(this,$t).delete(t)){const n=ns(t);if(typeof n=="string"){const s=w(this,zt).get(n);if(s)if(s.length>1){const a=s.indexOf(t);a!==-1&&s.splice(a,1)}else s[0]===t&&w(this,zt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ns(t);if(typeof n=="string"){const s=w(this,zt).get(n),a=s==null?void 0:s.find(i=>i.state.status==="pending");return!a||a===t}else return!0}runNext(t){var s;const n=ns(t);if(typeof n=="string"){const a=(s=w(this,zt).get(n))==null?void 0:s.find(i=>i!==t&&i.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ke.batch(()=>{w(this,$t).forEach(t=>{this.notify({type:"removed",mutation:t})}),w(this,$t).clear(),w(this,zt).clear()})}getAll(){return Array.from(w(this,$t))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>To(n,s))}findAll(t={}){return this.getAll().filter(n=>To(t,n))}notify(t){Ke.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ke.batch(()=>Promise.all(t.map(n=>n.continue().catch(ot))))}},$t=new WeakMap,zt=new WeakMap,Hr=new WeakMap,nc);function ns(e){var t;return(t=e.options.scope)==null?void 0:t.id}var en,fn,mt,tn,nn,fs,Ka,rc,n1=(rc=class extends br{constructor(t,n){super();te(this,nn);te(this,en);te(this,fn);te(this,mt);te(this,tn);J(this,en,t),this.setOptions(n),this.bindMethods(),le(this,nn,fs).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var s;const n=this.options;this.options=w(this,en).defaultMutationOptions(t),Ns(this.options,n)||w(this,en).getMutationCache().notify({type:"observerOptionsUpdated",mutation:w(this,mt),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Un(n.mutationKey)!==Un(this.options.mutationKey)?this.reset():((s=w(this,mt))==null?void 0:s.state.status)==="pending"&&w(this,mt).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=w(this,mt))==null||t.removeObserver(this)}onMutationUpdate(t){le(this,nn,fs).call(this),le(this,nn,Ka).call(this,t)}getCurrentResult(){return w(this,fn)}reset(){var t;(t=w(this,mt))==null||t.removeObserver(this),J(this,mt,void 0),le(this,nn,fs).call(this),le(this,nn,Ka).call(this)}mutate(t,n){var s;return J(this,tn,n),(s=w(this,mt))==null||s.removeObserver(this),J(this,mt,w(this,en).getMutationCache().build(w(this,en),this.options)),w(this,mt).addObserver(this),w(this,mt).execute(t)}},en=new WeakMap,fn=new WeakMap,mt=new WeakMap,tn=new WeakMap,nn=new WeakSet,fs=function(){var n;const t=((n=w(this,mt))==null?void 0:n.state)??Dc();J(this,fn,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Ka=function(t){Ke.batch(()=>{var n,s,a,i,o,l,c,d;if(w(this,tn)&&this.hasListeners()){const u=w(this,fn).variables,h=w(this,fn).context,m={client:w(this,en),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(s=(n=w(this,tn)).onSuccess)==null||s.call(n,t.data,u,h,m)}catch(f){Promise.reject(f)}try{(i=(a=w(this,tn)).onSettled)==null||i.call(a,t.data,null,u,h,m)}catch(f){Promise.reject(f)}}else if((t==null?void 0:t.type)==="error"){try{(l=(o=w(this,tn)).onError)==null||l.call(o,t.error,u,h,m)}catch(f){Promise.reject(f)}try{(d=(c=w(this,tn)).onSettled)==null||d.call(c,void 0,t.error,u,h,m)}catch(f){Promise.reject(f)}}}this.listeners.forEach(u=>{u(w(this,fn))})})},rc),Kt,sc,r1=(sc=class extends br{constructor(t={}){super();te(this,Kt);this.config=t,J(this,Kt,new Map)}build(t,n,s){const a=n.queryKey,i=n.queryHash??Si(a,n);let o=this.get(i);return o||(o=new J0({client:t,queryKey:a,queryHash:i,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){w(this,Kt).has(t.queryHash)||(w(this,Kt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=w(this,Kt).get(t.queryHash);n&&(t.destroy(),n===t&&w(this,Kt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ke.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return w(this,Kt).get(t)}getAll(){return[...w(this,Kt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Eo(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>Eo(t,s)):n}notify(t){Ke.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ke.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ke.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Kt=new WeakMap,sc),Me,pn,xn,ur,dr,gn,mr,hr,ac,s1=(ac=class{constructor(e={}){te(this,Me);te(this,pn);te(this,xn);te(this,ur);te(this,dr);te(this,gn);te(this,mr);te(this,hr);J(this,Me,e.queryCache||new r1),J(this,pn,e.mutationCache||new t1),J(this,xn,e.defaultOptions||{}),J(this,ur,new Map),J(this,dr,new Map),J(this,gn,0)}mount(){es(this,gn)._++,w(this,gn)===1&&(J(this,mr,Ni.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(this,Me).onFocus())})),J(this,hr,ks.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(this,Me).onOnline())})))}unmount(){var e,t;es(this,gn)._--,w(this,gn)===0&&((e=w(this,mr))==null||e.call(this),J(this,mr,void 0),(t=w(this,hr))==null||t.call(this),J(this,hr,void 0))}isFetching(e){return w(this,Me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return w(this,pn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=w(this,Me).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=w(this,Me).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Cn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return w(this,Me).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),a=w(this,Me).get(s.queryHash),i=a==null?void 0:a.state.data,o=z0(t,i);if(o!==void 0)return w(this,Me).build(this,s).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ke.batch(()=>w(this,Me).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=w(this,Me).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=w(this,Me);Ke.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=w(this,Me);return Ke.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=Ke.batch(()=>w(this,Me).findAll(e).map(a=>a.cancel(n)));return Promise.all(s).then(ot).catch(ot)}invalidateQueries(e,t={}){return Ke.batch(()=>(w(this,Me).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=Ke.batch(()=>w(this,Me).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,n);return n.throwOnError||(i=i.catch(ot)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(s).then(ot)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=w(this,Me).build(this,t);return n.isStaleByTime(Cn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ot).catch(ot)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ot).catch(ot)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ks.isOnline()?w(this,pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return w(this,Me)}getMutationCache(){return w(this,pn)}getDefaultOptions(){return w(this,xn)}setDefaultOptions(e){J(this,xn,e)}setQueryDefaults(e,t){w(this,ur).set(Un(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...w(this,ur).values()],n={};return t.forEach(s=>{Mr(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){w(this,dr).set(Un(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...w(this,dr).values()],n={};return t.forEach(s=>{Mr(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...w(this,xn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Si(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Ss&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...w(this,xn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){w(this,Me).clear(),w(this,pn).clear()}},Me=new WeakMap,pn=new WeakMap,xn=new WeakMap,ur=new WeakMap,dr=new WeakMap,gn=new WeakMap,mr=new WeakMap,hr=new WeakMap,ac),Mc=I.createContext(void 0),At=e=>{const t=I.useContext(Mc);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},a1=({client:e,children:t})=>(I.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(Mc.Provider,{value:e,children:t})),Oc=I.createContext(!1),i1=()=>I.useContext(Oc);Oc.Provider;function o1(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var l1=I.createContext(o1()),c1=()=>I.useContext(l1),u1=(e,t,n)=>{const s=n!=null&&n.state.error&&typeof e.throwOnError=="function"?ki(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||s)&&(t.isReset()||(e.retryOnMount=!1))},d1=e=>{I.useEffect(()=>{e.clearReset()},[e])},m1=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(a&&e.data===void 0||ki(n,[e.error,s])),h1=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...a)=>n(s(...a)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},f1=(e,t)=>e.isLoading&&e.isFetching&&!t,p1=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Vo=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function x1(e,t,n){var f,p,g,y;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const s=i1(),a=c1(),i=At(),o=i.defaultQueryOptions(e);(p=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,o);const l=i.getQueryCache().get(o.queryHash);process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`));const c=e.subscribed!==!1;o._optimisticResults=s?"isRestoring":c?"optimistic":void 0,h1(o),u1(o,a,l),d1(a);const d=!i.getQueryCache().get(o.queryHash),[u]=I.useState(()=>new t(i,o)),h=u.getOptimisticResult(o),m=!s&&c;if(I.useSyncExternalStore(I.useCallback(C=>{const b=m?u.subscribe(Ke.batchCalls(C)):ot;return u.updateResult(),b},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),I.useEffect(()=>{u.setOptions(o)},[o,u]),p1(o,h))throw Vo(o,u,a);if(m1({result:h,errorResetBoundary:a,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw h.error;if((y=(g=i.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||y.call(g,o,h),o.experimental_prefetchInRender&&!Or.isServer()&&f1(h,s)){const C=d?Vo(o,u,a):l==null?void 0:l.promise;C==null||C.catch(ot).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?h:u.trackResult(h)}function de(e,t){return x1(e,X0)}function g1(e,t){const n=At(),[s]=I.useState(()=>new n1(n,e));I.useEffect(()=>{s.setOptions(e)},[s,e]);const a=I.useSyncExternalStore(I.useCallback(o=>s.subscribe(Ke.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),i=I.useCallback((o,l)=>{s.mutate(o,l).catch(ot)},[s]);if(a.error&&ki(s.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:i,mutateAsync:a.mutate}}function zc(e){return e.trim().replace(/\/+$/,"")}const Hs=new Map;function Vc(e,t){Hs.set(e,t)}function y1(e){return Hs.get(e)}function b1(e){Hs.delete(e)}function v1(e){for(const[t,n]of Hs)if(n.accessToken===e)return t}let Qa=null;function qc(e){Qa=zc(e)}let Zc=null;function C1(e){Zc=e}function j1(){return Zc}let Uc=null;function w1(e){Uc=e.trim()}function N1(){return Uc}function S1(){return Qa!==null?Qa:zc("")}const qo={get apiBaseUrl(){return S1()},apiVersion:"v1"};function k1(e){const t=e.startsWith("/")?e:`/${e}`;return`${qo.apiBaseUrl}/api/${qo.apiVersion}${t}`}const Bc="auth:session-expired";function A1(){window.dispatchEvent(new CustomEvent(Bc))}function Wc(e){return`${Bc}:${e}`}const P1=x.createContext(null);function I1({instanceId:e,accessToken:t,onSessionExpired:n,children:s}){const a=y1(e);return a&&Vc(e,{...a,accessToken:t}),C1(t),x.useEffect(()=>{if(!n)return;const i=Wc(e),o=()=>n();return window.addEventListener(i,o),()=>window.removeEventListener(i,o)},[e,n]),r.jsx(P1.Provider,{value:{accessToken:t},children:s})}class vr extends Error{constructor(n,s,a,i,o){super(a??s);Ar(this,"status");Ar(this,"title");Ar(this,"details");Ar(this,"extensions");this.name="ApiError",this.status=n,this.title=s,this.details=i,this.extensions=o}}const Yc="tax-remittance.auth";function Hc(){var t;const e=localStorage.getItem(Yc);if(!e)return null;try{const n=JSON.parse(e);return!n.accessToken||!((t=n.user)!=null&&t.userId)?null:new Date(n.user.expiresAt)<=new Date?(Ga(),null):n}catch{return Ga(),null}}function Ga(){localStorage.removeItem(Yc)}function E1(){var e;return((e=Hc())==null?void 0:e.accessToken)??null}async function T1(e){let t=null;try{t=await e.json()}catch{}const n=(t==null?void 0:t.title)??"Request failed",s=t==null?void 0:t.detail,a=t==null?void 0:t.errors;return new vr(e.status,n,s,a,t??void 0)}async function Gr(e,t={}){const{body:n,auth:s=!0,headers:a,responseType:i="json",...o}=t,l=new Headers(a);i==="blob"?l.set("Accept","application/pdf"):i==="text"?l.set("Accept","text/html"):l.set("Accept","application/json"),n!==void 0&&l.set("Content-Type","application/json");let c=null;if(s){const h=j1()??E1();h&&(c=h,l.set("Authorization",`Bearer ${h}`))}const d=N1();d&&l.set("X-Client-ID",d);const u=await fetch(k1(e),{...o,headers:l,body:n!==void 0?JSON.stringify(n):void 0});if(!u.ok){const h=await T1(u);if(s&&h.status===401){Ga();const m=c?v1(c):void 0;m?window.dispatchEvent(new CustomEvent(Wc(m))):A1()}throw h}if(u.status!==204)return i==="blob"?await u.blob():i==="text"?await u.text():await u.json()}async function fe(e,t={}){return(await Gr(e,t)).data}async function Pi(){return(await fe("/portal/entities/mine?pageSize=1000")).items}function L1(e){return fe("/portal/entities",{method:"POST",body:e})}function F1(e,t){return fe(`/portal/entities/${e}`,{method:"PATCH",body:t})}const Kc=x.createContext(null);function R1({onOrganizationCreated:e,enabledPayments:t=["federal","state"],onPaymentRequired:n,children:s}){var g;const[a,i]=x.useState(null),{data:o=[],isLoading:l,isError:c,refetch:d}=de({queryKey:["entities","mine"],queryFn:Pi}),u=x.useRef(new Set),h=x.useRef(!1);x.useEffect(()=>{if(l)return;if(!h.current){o.forEach(C=>u.current.add(C.entityId)),h.current=!0;return}o.filter(C=>!u.current.has(C.entityId)).forEach(C=>{u.current.add(C.entityId),e==null||e(C)})},[o,l,e]);const m=a!==null&&o.some(y=>y.entityId===a)?a:((g=o[0])==null?void 0:g.entityId)??null,f=o.find(y=>y.entityId===m)??null,p=async()=>{await d()};return r.jsx(Kc.Provider,{value:{entities:o,isLoading:l,isError:c,selectedEntity:f,setSelectedEntityId:i,refetchEntities:p,enabledPayments:t,onPaymentRequired:n},children:s})}function Kn(){const e=x.useContext(Kc);if(!e)throw new Error("useEmbeddedContext must be used inside EmbeddedContextProvider");return e}const D1=x.createContext(null);function M1({theme:e,children:t}){const n={},s=n,a=(e==null?void 0:e.primaryColor)??"#2563eb";s["--embedded-primary"]=a,s["--embedded-primary-dark"]=`color-mix(in srgb, ${a} 82%, black)`,s["--embedded-primary-light"]=`color-mix(in srgb, ${a} 15%, white)`;const i=(e==null?void 0:e.secondaryColor)??"#0891b2";s["--embedded-secondary"]=i,s["--embedded-secondary-dark"]=`color-mix(in srgb, ${i} 82%, black)`,s["--embedded-secondary-light"]=`color-mix(in srgb, ${i} 15%, white)`;const o=(e==null?void 0:e.tertiaryColor)??"#7c3aed";return s["--embedded-tertiary"]=o,s["--embedded-tertiary-dark"]=`color-mix(in srgb, ${o} 82%, black)`,s["--embedded-tertiary-light"]=`color-mix(in srgb, ${o} 15%, white)`,e!=null&&e.borderRadius&&(s["--embedded-radius"]=e.borderRadius),e!=null&&e.fontFamily&&(n.fontFamily=e.fontFamily),s.minHeight="100%",r.jsx("div",{className:"tax-remittance-embedded",style:n,children:t})}const Qc=x.createContext(null),O1=6e3;function z1(){return`${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function V1({toast:e,onDismiss:t}){const n=e.variant==="success";return r.jsxs("div",{role:"alert",className:`w-full max-w-md overflow-hidden rounded-xl border shadow-lg ${n?"border-emerald-700 bg-[#E8F7C8]":"border-red-300 bg-[#FCE8EA]"}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 px-5 py-4",children:[r.jsx("p",{className:"text-base font-bold text-slate-900",children:e.title}),r.jsx("button",{type:"button","aria-label":"Dismiss notification",onClick:()=>t(e.id),className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border transition hover:opacity-80 ${n?"border-emerald-800 text-emerald-900":"border-red-400 text-red-700"}`,children:r.jsx(q1,{})})]}),r.jsx("div",{className:`mx-5 border-t ${n?"border-emerald-700":"border-red-300"}`}),r.jsx("p",{className:"px-5 py-4 text-sm text-slate-700",children:e.message})]})}function q1(){return r.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function Z1({children:e}){const[t,n]=x.useState([]),s=x.useCallback(o=>{n(l=>l.filter(c=>c.id!==o))},[]),a=x.useCallback((o,l,c)=>{const d=z1();n(u=>[...u,{id:d,variant:o,title:l,message:c}]),window.setTimeout(()=>{s(d)},O1)},[s]),i=x.useMemo(()=>({showSuccess:(o,l)=>a("success",o,l),showError:(o,l)=>a("error",o,l)}),[a]);return r.jsxs(Qc.Provider,{value:i,children:[e,jn.createPortal(r.jsx("div",{className:"pointer-events-none fixed right-4 top-4 z-[200] flex w-[min(100vw-2rem,28rem)] flex-col gap-3",children:t.map(o=>r.jsx("div",{className:"pointer-events-auto",children:r.jsx(V1,{toast:o,onDismiss:s})},o.id))}),document.body)]})}function Ks(){const e=x.useContext(Qc);if(!e)throw new Error("useToast must be used within ToastProvider");return e}class U1 extends x.Component{constructor(t){super(t),this.state={hasError:!1,message:""}}static getDerivedStateFromError(t){return{hasError:!0,message:t instanceof Error?t.message:"Unexpected error"}}render(){return this.state.hasError?r.jsxs("div",{className:"flex min-h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[r.jsx("p",{className:"text-sm font-medium text-red-600",children:"Something went wrong loading this widget."}),r.jsx("p",{className:"text-xs text-slate-400",children:this.state.message}),r.jsx("button",{type:"button",className:"rounded-md bg-slate-100 px-4 py-2 text-sm text-slate-600 hover:bg-slate-200",onClick:()=>this.setState({hasError:!1,message:""}),children:"Try again"})]}):this.props.children}}function B1(e){return e.startsWith("/dashboard")?"dashboard":e.startsWith("/payments")?"payments":e.startsWith("/tax-forms")?"tax-forms":e.startsWith("/settings")?"settings":e.startsWith("/create-entity/form")?"create-entity-form":e.startsWith("/create-entity")?"create-entity":"other"}function W1({navigateFnRef:e,onNavigate:t}){const n=Ie(),s=Ae();return x.useEffect(()=>(e.current=n,()=>{e.current=null}),[n,e]),x.useEffect(()=>{t==null||t(B1(s.pathname),s.pathname)},[s.pathname,t]),null}function Y1({selectEntityFnRef:e}){const{setSelectedEntityId:t}=Kn();return x.useEffect(()=>(e.current=t,()=>{e.current=null}),[t,e]),null}function Ii({appKey:e,accessToken:t,apiBaseUrl:n,theme:s,onSessionExpired:a,onOrganizationCreated:i,onNavigate:o,onPaymentRequired:l,navigateFnRef:c,selectEntityFnRef:d,enabledPayments:u,children:h}){const[m]=x.useState(()=>crypto.randomUUID());Vc(m,{apiBaseUrl:n.trim().replace(/\/+$/,""),clientId:e.trim(),accessToken:t}),qc(n),w1(e),x.useEffect(()=>()=>{b1(m)},[m]);const[f]=x.useState(()=>new s1({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}));return r.jsx(D1.Provider,{value:m,children:r.jsx(M1,{theme:s,children:r.jsx(a1,{client:f,children:r.jsx(Z1,{children:r.jsx(I1,{instanceId:m,accessToken:t,onSessionExpired:a,children:r.jsx(Jm,{children:r.jsxs(R1,{onOrganizationCreated:i,enabledPayments:u,onPaymentRequired:l,children:[r.jsx(W1,{navigateFnRef:c,onNavigate:o}),r.jsx(Y1,{selectEntityFnRef:d}),r.jsx(U1,{children:h})]})})})})})})})}function Ei(){const{entities:e,isLoading:t,isError:n,refetchEntities:s}=Kn(),a=Ie();return x.useEffect(()=>{t||n||a(e.length===0?"/create-entity":"/dashboard",{replace:!0})},[t,n,e,a]),t?r.jsx("div",{className:"flex min-h-[200px] items-center justify-center",children:r.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-slate-200 border-t-slate-600"})}):n?r.jsxs("div",{className:"flex min-h-[200px] flex-col items-center justify-center gap-3 px-4 text-center",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-red-50",children:r.jsx("svg",{className:"h-5 w-5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})}),r.jsx("p",{className:"text-sm font-medium text-slate-700",children:"Unable to load your account"}),r.jsx("p",{className:"text-xs text-slate-500",children:"Check your connection and try again."}),r.jsx("button",{type:"button",onClick:s,className:"mt-1 rounded-md bg-slate-100 px-4 py-1.5 text-xs font-medium text-slate-600 hover:bg-slate-200",children:"Retry"})]}):null}function Ti(){const{entities:e,selectedEntity:t,setSelectedEntityId:n}=Kn(),s=Ie(),i=Ae().pathname.split("/").filter(Boolean).length>1;return r.jsxs("div",{className:"flex min-h-full flex-col bg-slate-50",children:[r.jsxs("div",{className:"flex items-center gap-3 border-b border-slate-200 bg-white px-4 py-3",children:[i&&r.jsxs("button",{type:"button",onClick:()=>s(-1),className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-sm text-slate-500 transition hover:bg-slate-100 hover:text-slate-700",children:[r.jsx(H1,{}),"Back"]}),r.jsx("div",{className:"flex-1"})]}),r.jsx("main",{className:"flex-1 p-5",children:r.jsx(Xm,{context:{entities:e,selectedEntity:t,setSelectedEntityId:n}})})]})}function H1(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}const K1=["Entity name & EIN","Business type & primary state","Automatic dashboard access","Start managing tax payments"];function Q1({onCreateClick:e}){return r.jsxs("div",{className:"mx-auto w-full max-w-[528px]",children:[r.jsxs("div",{className:"overflow-hidden rounded-[20px] border border-[#f3f4f6] bg-white shadow-[0_20px_25px_-5px_rgba(0,0,0,0.1),0_8px_10px_-6px_rgba(0,0,0,0.1)] sm:rounded-[24px]",children:[r.jsxs("div",{className:"bg-[#bccadb] px-5 pb-6 pt-6 text-center sm:px-8 sm:pb-8 sm:pt-8",children:[r.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-2xl bg-white/20 sm:h-16 sm:w-16",children:r.jsx(Zo,{className:"h-6 w-6 text-white sm:h-8 sm:w-8"})}),r.jsx("h2",{className:"mt-3 text-xl font-black tracking-tight text-[#1e2939] sm:mt-4 sm:text-2xl",children:"Add Your Entity"}),r.jsx("p",{className:"mt-1 text-sm text-[#1e2939]/80",children:"Get set up in under 1 minute"})]}),r.jsxs("div",{className:"bg-white px-5 py-5 sm:px-8 sm:py-6",children:[r.jsx("ul",{className:"space-y-2.5 sm:space-y-3",children:K1.map(t=>r.jsxs("li",{className:"flex items-center gap-3 text-sm text-[#4a5565]",children:[r.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[#dfeeff] text-[#156bd5]",children:r.jsx(rs,{})}),t]},t))}),r.jsxs("button",{type:"button",onClick:e,className:"mt-5 flex h-12 w-full items-center justify-center gap-2 rounded-2xl bg-[#156bd5] text-sm font-black text-white transition hover:bg-[#125bb8] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#156bd5] focus-visible:ring-offset-2 sm:mt-6 sm:h-14 sm:text-base",children:[r.jsx(Zo,{className:"h-4 w-4 sm:h-[18px] sm:w-[18px]"}),"Add Entity",r.jsx(G1,{})]})]})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-x-3 gap-y-2 text-xs text-[#99a1af] sm:mt-5 sm:gap-x-4",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(rs,{className:"h-3 w-3 text-emerald-500"}),"SOC 2 Certified"]}),r.jsx("span",{className:"hidden h-3 w-px bg-[#e5e7eb] sm:block","aria-hidden":!0}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(rs,{className:"h-3 w-3 text-emerald-500"}),"Bank-grade encryption"]}),r.jsx("span",{className:"hidden h-3 w-px bg-[#e5e7eb] sm:block","aria-hidden":!0}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(rs,{className:"h-3 w-3 text-emerald-500"}),"Free to start"]})]})]})}function Zo({className:e="h-5 w-5"}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.5",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 21h19.5m-18-18v18m10.5-18v18m6-13.5V21M6.75 6.75h.75m-.75 3h.75m-.75 3h.75m3-6h.75m-.75 3h.75m-.75 3h.75M6.75 21v-3.375c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21M3 21h18M12 3l9 4.5v1.5H3V7.5L12 3z"})})}function rs({className:e="h-3 w-3"}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 16 16",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.5 8.5l3 3 6-6"})})}function G1(){return r.jsx("svg",{className:"h-4 w-4 sm:h-[18px] sm:w-[18px]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3"})})}function Li(){const e=Ie(),t=()=>{e("/create-entity/form",{state:{from:"/create-entity"}})};return r.jsx("div",{className:"flex items-center justify-center bg-transparent px-0 py-0",children:r.jsx(Q1,{onCreateClick:t})})}function Gc({onCancel:e,isSubmitting:t,submitLabel:n,submittingLabel:s,cancelLabel:a="Cancel",className:i=""}){return r.jsxs("div",{className:` flex flex-col gap-3 py-4 justify-end sm:flex-row sm:items-center ${i}`,children:[r.jsx("button",{type:"button",onClick:e,disabled:t,className:"inline-flex h-11 w-full items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:opacity-60 sm:w-auto",children:a}),r.jsx("button",{type:"submit",disabled:t,className:"inline-flex h-11 w-full items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:opacity-60 sm:w-auto",children:t?s:n})]})}function Zt({variant:e="error",title:t,message:n}){const s=e==="error"?"border-red-200 bg-red-50 text-red-800":"border-slate-200 bg-white text-slate-700";return r.jsxs("div",{className:`rounded-lg border px-4 py-3 text-sm ${s}`,role:"alert",children:[t?r.jsx("p",{className:"font-medium",children:t}):null,r.jsx("p",{className:t?"mt-1":void 0,children:n})]})}function Cr({label:e,required:t=!1,htmlFor:n,tooltip:s}){return r.jsxs("label",{htmlFor:n,className:"mb-1.5 flex items-center text-sm text-slate-600",children:[e,t?r.jsx("span",{className:"text-red-500",children:" *"}):null,s?r.jsx(J1,{text:s}):null]})}function J1({text:e}){return r.jsxs("span",{className:"group relative ml-1.5 inline-flex items-center",children:[r.jsxs("svg",{className:"h-4 w-4 cursor-help text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16v-4M12 8h.01"})]}),r.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-20 mb-1.5 w-max max-w-xs -translate-x-1/2 rounded-md bg-slate-800 px-2.5 py-1.5 text-xs font-normal leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100",children:e})]})}const ce=x.forwardRef(function({label:t,required:n=!1,error:s,tooltip:a,id:i,className:o="",...l},c){const d=i??l.name;return r.jsxs("div",{children:[r.jsx(Cr,{label:t,required:n,htmlFor:d,tooltip:a}),r.jsx("input",{ref:c,id:d,className:`block w-full rounded-lg border bg-white px-3 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 ${s?"border-red-300":"border-slate-200"} ${o}`,...l}),s?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:s}):null]})}),lt=x.forwardRef(function({label:t,required:n=!1,error:s,id:a,className:i="",children:o,...l},c){const d=a??l.name;return r.jsxs("div",{children:[r.jsx(Cr,{label:t,required:n,htmlFor:d}),r.jsxs("div",{className:"relative",children:[r.jsx("select",{ref:c,id:d,className:`block w-full appearance-none rounded-lg border bg-white px-3 py-2.5 pr-10 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 ${s?"border-red-300":"border-slate-200"} ${i}`,...l,children:o}),r.jsx(X1,{})]}),s?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:s}):null]})});function X1(){return r.jsx("svg",{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Jc({label:e,required:t=!1,options:n,value:s,onChange:a,fullWidth:i=!0,onFocus:o}){const l=x.useId(),c=x.useRef([]),d=n.findIndex(m=>m.value===s),u=m=>{var p;const f=(m+n.length)%n.length;a(n[f].value),(p=c.current[f])==null||p.focus()},h=m=>{m.key==="ArrowRight"||m.key==="ArrowDown"?(m.preventDefault(),u(d+1)):(m.key==="ArrowLeft"||m.key==="ArrowUp")&&(m.preventDefault(),u(d-1))};return r.jsxs("div",{children:[r.jsx(Cr,{label:e,required:t,htmlFor:l}),r.jsx("div",{id:l,role:"radiogroup","aria-label":e,onKeyDown:h,onFocus:o,className:i?"grid gap-3":"inline-flex flex-wrap gap-3 rounded-md border border-slate-200 p-1",style:i?{gridTemplateColumns:`repeat(${n.length}, minmax(0, 1fr))`}:void 0,children:n.map((m,f)=>{const p=m.value===s;return r.jsxs("button",{ref:g=>{c.current[f]=g},type:"button",role:"radio","aria-checked":p,tabIndex:p?0:-1,onClick:()=>{o==null||o(),a(m.value)},className:`flex items-center justify-center gap-2 rounded-md font-semibold transition focus:outline-none focus-visible:ring-2 focus-visible:ring-gov-500 focus-visible:ring-offset-1 ${i?"px-4 py-1 text-sm sm:text-base":"px-4 py-1 text-sm"} ${p?"border border-gov-400 bg-gov-50 text-gov-700 shadow-sm ring-1 ring-gov-200":""}`,children:[m.icon?r.jsx("span",{className:p?"text-gov-600":"text-slate-400",children:m.icon}):null,m.label]},m.value)})})]})}function _1(){return r.jsx("svg",{width:"18",height:"16",viewBox:"0 0 18 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:r.jsx("path",{d:"M18 4.37695C18 3.50462 17.2903 2.79492 16.418 2.79492H13.6055V1.66018C13.6055 0.74475 12.8607 0 11.9453 0H6.05472C5.13928 0 4.39453 0.74475 4.39453 1.66018V2.79492H1.58203C0.709699 2.79492 0 3.50462 0 4.37695V6.87294C0 7.33806 0.151453 7.9181 0.703125 8.48707V14.291C0.703125 15.1633 1.41282 15.873 2.28516 15.873H15.7148C16.5872 15.873 17.2969 15.1633 17.2969 14.291V8.48707C17.8483 7.91842 18 7.33855 18 6.87294V4.37695ZM5.44922 1.66018C5.44922 1.3263 5.72084 1.05469 6.05472 1.05469H11.9454C12.2792 1.05469 12.5508 1.3263 12.5508 1.66018V2.79492H5.44922V1.66018ZM1.05469 4.37695C1.05469 4.08618 1.29125 3.84961 1.58203 3.84961H16.418C16.7087 3.84961 16.9453 4.08618 16.9453 4.37695V6.87294C16.9453 8.17049 14.456 9.22936 10.8281 9.50678V9.01758C10.8281 8.72634 10.592 8.49023 10.3008 8.49023H7.69922C7.40798 8.49023 7.17188 8.72634 7.17188 9.01758V9.5066C3.5473 9.22883 1.05469 8.16718 1.05469 6.87294V4.37695ZM9.77344 9.54492V10.2305C9.77344 10.6085 9.46589 10.916 9.08789 10.916H8.91211C8.53411 10.916 8.22656 10.6085 8.22656 10.2305V9.54492H9.77344ZM15.7148 14.8184H2.28516C1.99438 14.8184 1.75781 14.5818 1.75781 14.291V9.26103C3.32803 10.0657 4.9782 10.3759 7.20478 10.5667C7.36189 11.3658 8.06759 11.9707 8.91211 11.9707H9.08789C9.93248 11.9707 10.6382 11.3658 10.7953 10.5665C12.6345 10.4333 14.2949 10.0957 15.5073 9.60514C15.7799 9.49482 16.0238 9.37958 16.2422 9.26093V14.291C16.2422 14.5818 16.0056 14.8184 15.7148 14.8184Z",fill:"#185BA5"})})}function $1(){return r.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M12 12.375C12.7664 12.375 13.5156 12.1477 14.1528 11.7219C14.7901 11.2962 15.2867 10.691 15.58 9.9829C15.8733 9.27484 15.9501 8.4957 15.8005 7.74403C15.651 6.99235 15.282 6.30189 14.74 5.75996C14.1981 5.21803 13.5077 4.84898 12.756 4.69946C12.0043 4.54994 11.2252 4.62668 10.5171 4.91997C9.80904 5.21326 9.20385 5.70993 8.77806 6.34717C8.35226 6.98441 8.125 7.7336 8.125 8.5C8.12615 9.52736 8.53478 10.5123 9.26123 11.2388C9.98769 11.9652 10.9726 12.3739 12 12.375ZM12 5.375C12.6181 5.375 13.2223 5.55828 13.7362 5.90166C14.2501 6.24504 14.6506 6.7331 14.8871 7.30412C15.1236 7.87514 15.1855 8.50347 15.065 9.10966C14.9444 9.71585 14.6467 10.2727 14.2097 10.7097C13.7727 11.1467 13.2158 11.4444 12.6097 11.565C12.0035 11.6855 11.3751 11.6236 10.8041 11.3871C10.2331 11.1506 9.74504 10.7501 9.40166 10.2362C9.05828 9.72226 8.875 9.11807 8.875 8.5C8.87593 7.67148 9.20546 6.87717 9.79131 6.29132C10.3772 5.70547 11.1715 5.37593 12 5.375Z",fill:"#434343",stroke:"#434343","stroke-width":"0.5"}),r.jsx("path",{d:"M18.875 19C18.8732 17.4424 18.2537 15.9491 17.1523 14.8477C16.0509 13.7463 14.5576 13.1268 13 13.125H11C10.2284 13.1246 9.46423 13.2763 8.75126 13.5714C8.03829 13.8665 7.39048 14.2992 6.84485 14.8449C6.29923 15.3905 5.8665 16.0383 5.57139 16.7513C5.27629 17.4642 5.1246 18.2284 5.125 19C5.125 19.2071 5.29289 19.375 5.5 19.375H18.5C18.7071 19.375 18.875 19.2071 18.875 19ZM6.96389 18.625C6.38301 18.625 5.91613 18.1262 6.07814 17.5684C6.33473 16.685 6.82664 15.8801 7.51021 15.2449C8.45855 14.3636 9.70542 13.8742 11 13.875H13C14.2939 13.8765 15.5394 14.3668 16.4872 15.2476C17.1698 15.8819 17.6617 16.6851 17.9195 17.5669C18.0826 18.1251 17.6156 18.625 17.034 18.625H6.96389Z",fill:"#434343",stroke:"#434343","stroke-width":"0.5"})]})}var Uo;function D(e,t,n){function s(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const d=o.prototype,u=Object.keys(d);for(let h=0;h<u.length;h++){const m=u[h];m in l||(l[m]=d[m].bind(l))}}const a=(n==null?void 0:n.Parent)??Object;class i extends a{}Object.defineProperty(i,"name",{value:e});function o(l){var c;const d=n!=null&&n.Parent?new i:this;s(d,l),(c=d._zod).deferred??(c.deferred=[]);for(const u of d._zod.deferred)u();return d}return Object.defineProperty(o,"init",{value:s}),Object.defineProperty(o,Symbol.hasInstance,{value:l=>{var c,d;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(d=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(o,"name",{value:e}),o}class $n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Xc extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Uo=globalThis).__zod_globalConfig??(Uo.__zod_globalConfig={});const Fi=globalThis.__zod_globalConfig;function Bn(e){return Fi}function _c(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,a])=>t.indexOf(+s)===-1).map(([s,a])=>a)}function Ja(e,t){return typeof t=="bigint"?t.toString():t}function Ri(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Di(e){return e==null}function Mi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const Bo=Symbol("evaluating");function je(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==Bo)return s===void 0&&(s=Bo,s=n()),s},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Qn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function wn(...e){const t={};for(const n of e){const s=Object.getOwnPropertyDescriptors(n);Object.assign(t,s)}return Object.defineProperties({},t)}function Wo(e){return JSON.stringify(e)}function eh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const $c="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function As(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const th=Ri(()=>{var e;if(Fi.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function zr(e){if(As(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(As(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function eu(e){return zr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const nh=new Set(["string","number","symbol"]);function fr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nn(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(s._zod.parent=e),s}function ae(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function rh(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function sh(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=wn(e._zod.def,{get shape(){const o={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(o[l]=n.shape[l])}return Qn(this,"shape",o),o},checks:[]});return Nn(e,i)}function ah(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=wn(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete o[l]}return Qn(this,"shape",o),o},checks:[]});return Nn(e,i)}function ih(e,t){if(!zr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const o in t)if(Object.getOwnPropertyDescriptor(i,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const a=wn(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Qn(this,"shape",i),i}});return Nn(e,a)}function oh(e,t){if(!zr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=wn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Qn(this,"shape",s),s}});return Nn(e,n)}function lh(e,t){var s;if((s=e._zod.def.checks)!=null&&s.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=wn(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Qn(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Nn(e,n)}function ch(e,t,n){const a=t._zod.def.checks;if(a&&a.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=wn(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const d in n){if(!(d in l))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(c[d]=e?new e({type:"optional",innerType:l[d]}):l[d])}else for(const d in l)c[d]=e?new e({type:"optional",innerType:l[d]}):l[d];return Qn(this,"shape",c),c},checks:[]});return Nn(t,o)}function uh(e,t,n){const s=wn(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=new e({type:"nonoptional",innerType:a[o]}))}else for(const o in a)i[o]=new e({type:"nonoptional",innerType:a[o]});return Qn(this,"shape",i),i}});return Nn(t,s)}function Xn(e,t=0){var n;if(e.aborted===!0)return!0;for(let s=t;s<e.issues.length;s++)if(((n=e.issues[s])==null?void 0:n.continue)!==!0)return!0;return!1}function dh(e,t=0){var n;if(e.aborted===!0)return!0;for(let s=t;s<e.issues.length;s++)if(((n=e.issues[s])==null?void 0:n.continue)===!1)return!0;return!1}function tu(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function ss(e){return typeof e=="string"?e:e==null?void 0:e.message}function Wn(e,t,n){var c,d,u,h,m,f;const s=e.message?e.message:ss((u=(d=(c=e.inst)==null?void 0:c._zod.def)==null?void 0:d.error)==null?void 0:u.call(d,e))??ss((h=t==null?void 0:t.error)==null?void 0:h.call(t,e))??ss((m=n.customError)==null?void 0:m.call(n,e))??ss((f=n.localeError)==null?void 0:f.call(n,e))??"Invalid input",{inst:a,continue:i,input:o,...l}=e;return l.path??(l.path=[]),l.message=s,t!=null&&t.reportInput&&(l.input=o),l}function Oi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Vr(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const nu=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ja,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zi=D("$ZodError",nu),Qs=D("$ZodError",nu,{Parent:Error});function mh(e,t=n=>n.message){const n={},s=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):s.push(t(a));return{formErrors:s,fieldErrors:n}}function hh(e,t=n=>n.message){const n={_errors:[]},s=(a,i=[])=>{for(const o of a.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(l=>s({issues:l},[...i,...o.path]));else if(o.code==="invalid_key")s({issues:o.issues},[...i,...o.path]);else if(o.code==="invalid_element")s({issues:o.issues},[...i,...o.path]);else{const l=[...i,...o.path];if(l.length===0)n._errors.push(t(o));else{let c=n,d=0;for(;d<l.length;){const u=l[d];d===l.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(o))):c[u]=c[u]||{_errors:[]},c=c[u],d++}}}};return s(e),n}const Gs=e=>(t,n,s,a)=>{const i=s?{...s,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new $n;if(o.issues.length){const l=new((a==null?void 0:a.Err)??e)(o.issues.map(c=>Wn(c,i,Bn())));throw $c(l,a==null?void 0:a.callee),l}return o.value},fh=Gs(Qs),Js=e=>async(t,n,s,a)=>{const i=s?{...s,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise&&(o=await o),o.issues.length){const l=new((a==null?void 0:a.Err)??e)(o.issues.map(c=>Wn(c,i,Bn())));throw $c(l,a==null?void 0:a.callee),l}return o.value},ph=Js(Qs),Xs=e=>(t,n,s)=>{const a=s?{...s,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new $n;return i.issues.length?{success:!1,error:new(e??zi)(i.issues.map(o=>Wn(o,a,Bn())))}:{success:!0,data:i.value}},xh=Xs(Qs),_s=e=>async(t,n,s)=>{const a=s?{...s,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},a);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(o=>Wn(o,a,Bn())))}:{success:!0,data:i.value}},gh=_s(Qs),yh=e=>(t,n,s)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return Gs(e)(t,n,a)},bh=e=>(t,n,s)=>Gs(e)(t,n,s),vh=e=>async(t,n,s)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return Js(e)(t,n,a)},Ch=e=>async(t,n,s)=>Js(e)(t,n,s),jh=e=>(t,n,s)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return Xs(e)(t,n,a)},wh=e=>(t,n,s)=>Xs(e)(t,n,s),Nh=e=>async(t,n,s)=>{const a=s?{...s,direction:"backward"}:{direction:"backward"};return _s(e)(t,n,a)},Sh=e=>async(t,n,s)=>_s(e)(t,n,s),kh=/^[cC][0-9a-z]{6,}$/,Ah=/^[0-9a-z]+$/,Ph=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ih=/^[0-9a-vA-V]{20}$/,Eh=/^[A-Za-z0-9]{27}$/,Th=/^[a-zA-Z0-9_-]{21}$/,Lh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fh=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Yo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Rh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Dh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mh(){return new RegExp(Dh,"u")}const Oh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vh=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ru=/^[A-Za-z0-9_-]*$/,Uh=/^https?$/,Bh=/^\+[1-9]\d{6,14}$/,su="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Wh=new RegExp(`^${su}$`);function au(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yh(e){return new RegExp(`^${au(e)}$`)}function Hh(e){const t=au({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${su}T(?:${s})$`)}const Kh=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Qh=/^(?:true|false)$/i,Gh=/^[^A-Z]*$/,Jh=/^[^a-z]*$/,Qt=D("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Xh=D("$ZodCheckMaxLength",(e,t)=>{var n;Qt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const a=s.value;return!Di(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const a=s.value;if(a.length<=t.maximum)return;const o=Oi(a);s.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),_h=D("$ZodCheckMinLength",(e,t)=>{var n;Qt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const a=s.value;return!Di(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const a=s.value;if(a.length>=t.minimum)return;const o=Oi(a);s.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),$h=D("$ZodCheckLengthEquals",(e,t)=>{var n;Qt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const a=s.value;return!Di(a)&&a.length!==void 0}),e._zod.onattach.push(s=>{const a=s._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=s=>{const a=s.value,i=a.length;if(i===t.length)return;const o=Oi(a),l=i>t.length;s.issues.push({origin:o,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),$s=D("$ZodCheckStringFormat",(e,t)=>{var n,s;Qt.init(e,t),e._zod.onattach.push(a=>{const i=a._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),ef=D("$ZodCheckRegex",(e,t)=>{$s.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),tf=D("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Gh),$s.init(e,t)}),nf=D("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Jh),$s.init(e,t)}),rf=D("$ZodCheckIncludes",(e,t)=>{Qt.init(e,t);const n=fr(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(a=>{const i=a._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),sf=D("$ZodCheckStartsWith",(e,t)=>{Qt.init(e,t);const n=new RegExp(`^${fr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),af=D("$ZodCheckEndsWith",(e,t)=>{Qt.init(e,t);const n=new RegExp(`.*${fr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),of=D("$ZodCheckOverwrite",(e,t)=>{Qt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class lf{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const s=t.split(`
|
|
13
|
+
`).filter(o=>o),a=Math.min(...s.map(o=>o.length-o.trimStart().length)),i=s.map(o=>o.slice(a)).map(o=>" ".repeat(this.indent*2)+o);for(const o of i)this.content.push(o)}compile(){const t=Function,n=this==null?void 0:this.args,a=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,a.join(`
|
|
14
|
+
`))}}const cf={major:4,minor:4,patch:3},qe=D("$ZodType",(e,t)=>{var a;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=cf;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const i of s)for(const o of i._zod.onattach)o(e);if(s.length===0)(n=e._zod).deferred??(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const i=(l,c,d)=>{let u=Xn(l),h;for(const m of c){if(m._zod.def.when){if(dh(l)||!m._zod.def.when(l))continue}else if(u)continue;const f=l.issues.length,p=m._zod.check(l);if(p instanceof Promise&&(d==null?void 0:d.async)===!1)throw new $n;if(h||p instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await p,l.issues.length!==f&&(u||(u=Xn(l,f)))});else{if(l.issues.length===f)continue;u||(u=Xn(l,f))}}return h?h.then(()=>l):l},o=(l,c,d)=>{if(Xn(l))return l.aborted=!0,l;const u=i(c,s,d);if(u instanceof Promise){if(d.async===!1)throw new $n;return u.then(h=>e._zod.parse(h,d))}return e._zod.parse(u,d)};e._zod.run=(l,c)=>{if(c.skipChecks)return e._zod.parse(l,c);if(c.direction==="backward"){const u=e._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(h=>o(h,l,c)):o(u,l,c)}const d=e._zod.parse(l,c);if(d instanceof Promise){if(c.async===!1)throw new $n;return d.then(u=>i(u,s,c))}return i(d,s,c)}}je(e,"~standard",()=>({validate:i=>{var o;try{const l=xh(e,i);return l.success?{value:l.data}:{issues:(o=l.error)==null?void 0:o.issues}}catch{return gh(e,i).then(c=>{var d;return c.success?{value:c.data}:{issues:(d=c.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),Vi=D("$ZodString",(e,t)=>{var n;qe.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Kh(e._zod.bag),e._zod.parse=(s,a)=>{if(t.coerce)try{s.value=String(s.value)}catch{}return typeof s.value=="string"||s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:e}),s}}),Ee=D("$ZodStringFormat",(e,t)=>{$s.init(e,t),Vi.init(e,t)}),uf=D("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fh),Ee.init(e,t)}),df=D("$ZodUUID",(e,t)=>{if(t.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(s===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Yo(s))}else t.pattern??(t.pattern=Yo());Ee.init(e,t)}),mf=D("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Rh),Ee.init(e,t)}),hf=D("$ZodURL",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{var s;try{const a=n.value.trim();if(!t.normalize&&((s=t.protocol)==null?void 0:s.source)===Uh.source&&!/^https?:\/\//i.test(a)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ff=D("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mh()),Ee.init(e,t)}),pf=D("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Th),Ee.init(e,t)}),xf=D("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=kh),Ee.init(e,t)}),gf=D("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ah),Ee.init(e,t)}),yf=D("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ph),Ee.init(e,t)}),bf=D("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ih),Ee.init(e,t)}),vf=D("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Eh),Ee.init(e,t)}),Cf=D("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Hh(t)),Ee.init(e,t)}),jf=D("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Wh),Ee.init(e,t)}),wf=D("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yh(t)),Ee.init(e,t)}),Nf=D("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Lh),Ee.init(e,t)}),Sf=D("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Oh),Ee.init(e,t),e._zod.bag.format="ipv4"}),kf=D("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zh),Ee.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Af=D("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Vh),Ee.init(e,t)}),Pf=D("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qh),Ee.init(e,t),e._zod.check=n=>{const s=n.value.split("/");try{if(s.length!==2)throw new Error;const[a,i]=s;if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${a}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function iu(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const If=D("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Zh),Ee.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{iu(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Ef(e){if(!ru.test(e))return!1;const t=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return iu(n)}const Tf=D("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ru),Ee.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Ef(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Lf=D("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Bh),Ee.init(e,t)});function Ff(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[s]=n;if(!s)return!1;const a=JSON.parse(atob(s));return!("typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const Rf=D("$ZodJWT",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{Ff(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Df=D("$ZodBoolean",(e,t)=>{qe.init(e,t),e._zod.pattern=Qh,e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=!!n.value}catch{}const a=n.value;return typeof a=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),n}}),Mf=D("$ZodUnknown",(e,t)=>{qe.init(e,t),e._zod.parse=n=>n}),Of=D("$ZodNever",(e,t)=>{qe.init(e,t),e._zod.parse=(n,s)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ho(e,t,n){e.issues.length&&t.issues.push(...tu(n,e.issues)),t.value[n]=e.value}const zf=D("$ZodArray",(e,t)=>{qe.init(e,t),e._zod.parse=(n,s)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const i=[];for(let o=0;o<a.length;o++){const l=a[o],c=t.element._zod.run({value:l,issues:[]},s);c instanceof Promise?i.push(c.then(d=>Ho(d,n,o))):Ho(c,n,o)}return i.length?Promise.all(i).then(()=>n):n}});function Ps(e,t,n,s,a,i){const o=n in s;if(e.issues.length){if(a&&i&&!o)return;t.issues.push(...tu(n,e.issues))}if(!o&&!a){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function ou(e){var s,a,i,o;const t=Object.keys(e.shape);for(const l of t)if(!((o=(i=(a=(s=e.shape)==null?void 0:s[l])==null?void 0:a._zod)==null?void 0:i.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const n=rh(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function lu(e,t,n,s,a,i){const o=[],l=a.keySet,c=a.catchall._zod,d=c.def.type,u=c.optin==="optional",h=c.optout==="optional";for(const m in t){if(m==="__proto__"||l.has(m))continue;if(d==="never"){o.push(m);continue}const f=c.run({value:t[m],issues:[]},s);f instanceof Promise?e.push(f.then(p=>Ps(p,n,m,t,u,h))):Ps(f,n,m,t,u,h)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Vf=D("$ZodObject",(e,t)=>{qe.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const s=Ri(()=>ou(t));je(e._zod,"propValues",()=>{const l=t.shape,c={};for(const d in l){const u=l[d]._zod;if(u.values){c[d]??(c[d]=new Set);for(const h of u.values)c[d].add(h)}}return c});const a=As,i=t.catchall;let o;e._zod.parse=(l,c)=>{o??(o=s.value);const d=l.value;if(!a(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value={};const u=[],h=o.shape;for(const m of o.keys){const f=h[m],p=f._zod.optin==="optional",g=f._zod.optout==="optional",y=f._zod.run({value:d[m],issues:[]},c);y instanceof Promise?u.push(y.then(C=>Ps(C,l,m,d,p,g))):Ps(y,l,m,d,p,g)}return i?lu(u,d,l,c,s.value,e):u.length?Promise.all(u).then(()=>l):l}}),qf=D("$ZodObjectJIT",(e,t)=>{Vf.init(e,t);const n=e._zod.parse,s=Ri(()=>ou(t)),a=m=>{var j,N;const f=new lf(["shape","payload","ctx"]),p=s.value,g=A=>{const S=Wo(A);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");const y=Object.create(null);let C=0;for(const A of p.keys)y[A]=`key_${C++}`;f.write("const newResult = {};");for(const A of p.keys){const S=y[A],R=Wo(A),E=m[A],z=((j=E==null?void 0:E._zod)==null?void 0:j.optin)==="optional",X=((N=E==null?void 0:E._zod)==null?void 0:N.optout)==="optional";f.write(`const ${S} = ${g(A)};`),z&&X?f.write(`
|
|
15
|
+
if (${S}.issues.length) {
|
|
16
|
+
if (${R} in input) {
|
|
17
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
18
18
|
...iss,
|
|
19
|
-
path: iss.path ? [${
|
|
19
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
20
20
|
})));
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
if (${
|
|
25
|
-
if (${
|
|
26
|
-
newResult[${
|
|
24
|
+
if (${S}.value === undefined) {
|
|
25
|
+
if (${R} in input) {
|
|
26
|
+
newResult[${R}] = undefined;
|
|
27
27
|
}
|
|
28
28
|
} else {
|
|
29
|
-
newResult[${
|
|
29
|
+
newResult[${R}] = ${S}.value;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
`):
|
|
33
|
-
if (${
|
|
34
|
-
payload.issues = payload.issues.concat(${
|
|
32
|
+
`):z?f.write(`
|
|
33
|
+
if (${S}.issues.length) {
|
|
34
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
35
35
|
...iss,
|
|
36
|
-
path: iss.path ? [${
|
|
36
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
37
37
|
})));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (${
|
|
41
|
-
if (${
|
|
42
|
-
newResult[${
|
|
40
|
+
if (${S}.value === undefined) {
|
|
41
|
+
if (${R} in input) {
|
|
42
|
+
newResult[${R}] = undefined;
|
|
43
43
|
}
|
|
44
44
|
} else {
|
|
45
|
-
newResult[${
|
|
45
|
+
newResult[${R}] = ${S}.value;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
`):
|
|
49
|
-
const ${
|
|
50
|
-
if (${
|
|
51
|
-
payload.issues = payload.issues.concat(${
|
|
48
|
+
`):f.write(`
|
|
49
|
+
const ${S}_present = ${R} in input;
|
|
50
|
+
if (${S}.issues.length) {
|
|
51
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
52
52
|
...iss,
|
|
53
|
-
path: iss.path ? [${
|
|
53
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
54
54
|
})));
|
|
55
55
|
}
|
|
56
|
-
if (!${
|
|
56
|
+
if (!${S}_present && !${S}.issues.length) {
|
|
57
57
|
payload.issues.push({
|
|
58
58
|
code: "invalid_type",
|
|
59
59
|
expected: "nonoptional",
|
|
60
60
|
input: undefined,
|
|
61
|
-
path: [${
|
|
61
|
+
path: [${R}]
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
if (${
|
|
66
|
-
if (${
|
|
67
|
-
newResult[${
|
|
65
|
+
if (${S}_present) {
|
|
66
|
+
if (${S}.value === undefined) {
|
|
67
|
+
newResult[${R}] = undefined;
|
|
68
68
|
} else {
|
|
69
|
-
newResult[${
|
|
69
|
+
newResult[${R}] = ${S}.value;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");const C=p.compile();return(I,F)=>C(h,I,F)};let i;const o=As,l=!Ti.jitless,d=l&&Bf.value,u=t.catchall;let m;e._zod.parse=(h,p)=>{m??(m=r.value);const g=h.value;return o(g)?l&&d&&(p==null?void 0:p.async)===!1&&p.jitless!==!0?(i||(i=a(t.shape)),h=i(h,p),u?Xc([],g,h,p,m,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h)}});function Ho(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const a=e.filter(i=>!Vn(i));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(o=>Rn(o,r,Fn())))}),t)}const Ax=D("$ZodUnion",(e,t)=>{Fe.init(e,t),ve(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ve(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ve(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),ve(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${r.map(a=>Fi(a.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,a)=>{if(n)return n(r,a);let i=!1;const o=[];for(const l of t.options){const c=l._zod.run({value:r.value,issues:[]},a);if(c instanceof Promise)o.push(c),i=!0;else{if(c.issues.length===0)return c;o.push(c)}}return i?Promise.all(o).then(l=>Ho(l,r,e,a)):Ho(o,r,e,a)}}),Px=D("$ZodIntersection",(e,t)=>{Fe.init(e,t),e._zod.parse=(n,r)=>{const a=n.value,i=t.left._zod.run({value:a,issues:[]},r),o=t.right._zod.run({value:a,issues:[]},r);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([c,d])=>Ko(n,c,d)):Ko(n,i,o)}});function Qa(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Fr(e)&&Fr(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),a={...e,...t};for(const i of r){const o=Qa(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};a[i]=o.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const a=e[r],i=t[r],o=Qa(a,i);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ko(e,t,n){const r=new Map;let a;for(const l of t.issues)if(l.code==="unrecognized_keys"){a??(a=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const i=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(i.length&&a&&e.issues.push({...a,keys:i}),Vn(e))return e;const o=Qa(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Ex=D("$ZodEnum",(e,t)=>{Fe.init(e,t);const n=Vc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(a=>Vf.has(typeof a)).map(a=>typeof a=="string"?lr(a):a.toString()).join("|")})$`),e._zod.parse=(a,i)=>{const o=a.value;return r.has(o)||a.issues.push({code:"invalid_value",values:n,input:o,inst:e}),a}}),Ix=D("$ZodLiteral",(e,t)=>{if(Fe.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?lr(r):r?lr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,a)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Tx=D("$ZodTransform",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Bc(e.constructor.name);const a=t.transform(n.value,n);if(r.async)return(a instanceof Promise?a:Promise.resolve(a)).then(o=>(n.value=o,n.fallback=!0,n));if(a instanceof Promise)throw new Zn;return n.value=a,n.fallback=!0,n}});function Qo(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const eu=D("$ZodOptional",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ve(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ve(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Fi(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const a=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Qo(o,a)):Qo(i,a)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),_x=D("$ZodExactOptional",(e,t)=>{eu.init(e,t),ve(e._zod,"values",()=>t.innerType._zod.values),ve(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Dx=D("$ZodNullable",(e,t)=>{Fe.init(e,t),ve(e._zod,"optin",()=>t.innerType._zod.optin),ve(e._zod,"optout",()=>t.innerType._zod.optout),ve(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Fi(n.source)}|null)$`):void 0}),ve(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Fx=D("$ZodDefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",ve(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>Jo(i,t)):Jo(a,t)}});function Jo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Rx=D("$ZodPrefault",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",ve(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Lx=D("$ZodNonOptional",(e,t)=>{Fe.init(e,t),ve(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>Go(i,e)):Go(a,e)}});function Go(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const $x=D("$ZodCatch",(e,t)=>{Fe.init(e,t),e._zod.optin="optional",ve(e._zod,"optout",()=>t.innerType._zod.optout),ve(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>Rn(o,r,Fn()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(i=>Rn(i,r,Fn()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Ox=D("$ZodPipe",(e,t)=>{Fe.init(e,t),ve(e._zod,"values",()=>t.in._zod.values),ve(e._zod,"optin",()=>t.in._zod.optin),ve(e._zod,"optout",()=>t.out._zod.optout),ve(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(o=>is(o,t.in,r)):is(i,t.in,r)}const a=t.in._zod.run(n,r);return a instanceof Promise?a.then(i=>is(i,t.out,r)):is(a,t.out,r)}});function is(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const zx=D("$ZodReadonly",(e,t)=>{Fe.init(e,t),ve(e._zod,"propValues",()=>t.innerType._zod.propValues),ve(e._zod,"values",()=>t.innerType._zod.values),ve(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ve(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(Xo):Xo(a)}});function Xo(e){return e.value=Object.freeze(e.value),e}const Mx=D("$ZodCustom",(e,t)=>{$t.init(e,t),Fe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,a=t.fn(r);if(a instanceof Promise)return a.then(i=>el(i,n,r,e));el(a,n,r,e)}});function el(e,t,n,r){if(!e){const a={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(a.params=r._zod.def.params),t.issues.push(Rr(a))}}var tl;class qx{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const a={...r,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Bx(){return new qx}(tl=globalThis).__zod_globalRegistry??(tl.__zod_globalRegistry=Bx());const Pr=globalThis.__zod_globalRegistry;function Vx(e,t){return new e({type:"string",...se(t)})}function tu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...se(t)})}function nl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...se(t)})}function Ux(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...se(t)})}function Zx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...se(t)})}function Wx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...se(t)})}function Yx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...se(t)})}function Hx(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...se(t)})}function Kx(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...se(t)})}function Qx(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...se(t)})}function Jx(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...se(t)})}function Gx(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...se(t)})}function Xx(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...se(t)})}function eg(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...se(t)})}function tg(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...se(t)})}function ng(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...se(t)})}function rg(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...se(t)})}function sg(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...se(t)})}function ag(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...se(t)})}function ig(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...se(t)})}function og(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...se(t)})}function lg(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...se(t)})}function cg(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...se(t)})}function ug(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...se(t)})}function dg(e,t){return new e({type:"string",format:"date",check:"string_format",...se(t)})}function mg(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...se(t)})}function hg(e,t){return new e({type:"string",format:"duration",check:"string_format",...se(t)})}function fg(e,t){return new e({type:"boolean",...se(t)})}function pg(e){return new e({type:"unknown"})}function xg(e,t){return new e({type:"never",...se(t)})}function nu(e,t){return new Op({check:"max_length",...se(t),maximum:e})}function Es(e,t){return new zp({check:"min_length",...se(t),minimum:e})}function ru(e,t){return new Mp({check:"length_equals",...se(t),length:e})}function gg(e,t){return new qp({check:"string_format",format:"regex",...se(t),pattern:e})}function yg(e){return new Bp({check:"string_format",format:"lowercase",...se(e)})}function bg(e){return new Vp({check:"string_format",format:"uppercase",...se(e)})}function vg(e,t){return new Up({check:"string_format",format:"includes",...se(t),includes:e})}function jg(e,t){return new Zp({check:"string_format",format:"starts_with",...se(t),prefix:e})}function wg(e,t){return new Wp({check:"string_format",format:"ends_with",...se(t),suffix:e})}function gr(e){return new Yp({check:"overwrite",tx:e})}function Ng(e){return gr(t=>t.normalize(e))}function Sg(){return gr(e=>e.trim())}function kg(){return gr(e=>e.toLowerCase())}function Cg(){return gr(e=>e.toUpperCase())}function Ag(){return gr(e=>qf(e))}function Pg(e,t,n){return new e({type:"array",element:t,...se(n)})}function Eg(e,t,n){return new e({type:"custom",check:"custom",fn:t,...se(n)})}function Ig(e,t){const n=Tg(r=>(r.addIssue=a=>{if(typeof a=="string")r.issues.push(Rr(a,r.value,n._zod.def));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Rr(i))}},e(r.value,r)),t);return n}function Tg(e,t){const n=new $t({check:"custom",...se(t)});return n._zod.check=e,n}function su(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Pr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function We(e,t,n={path:[],schemaPath:[]}){var u,m;var r;const a=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const l=(m=(u=e._zod).toJSONSchema)==null?void 0:m.call(u);if(l)o.schema=l;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,h);else{const g=o.schema,x=t.processors[a.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);x(e,t,g,h)}const p=e._zod.parent;p&&(o.ref||(o.ref=p),We(p,t,h),t.seen.get(p).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io==="input"&&Xe(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function au(e,t){var o,l,c,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const u of e.seen.entries()){const m=(o=e.metadataRegistry.get(u[0]))==null?void 0:o.id;if(m){const h=r.get(m);if(h&&h!==u[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,u[0])}}const a=u=>{var x;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const b=(x=e.external.registry.get(u[0]))==null?void 0:x.id,y=e.external.uri??(j=>j);if(b)return{ref:y(b)};const C=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=C,{defId:C,ref:`${y("__shared")}#/${m}/${C}`}}if(u[1]===n)return{ref:"#"};const p=`#/${m}/`,g=u[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:p+g}},i=u=>{if(u[1].schema.$ref)return;const m=u[1],{ref:h,defId:p}=a(u);m.def={...m.schema},p&&(m.defId=p);const g=m.schema;for(const x in g)delete g[x];g.$ref=h};if(e.cycles==="throw")for(const u of e.seen.entries()){const m=u[1];if(m.cycle)throw new Error(`Cycle detected: #/${(l=m.cycle)==null?void 0:l.join("/")}/<root>
|
|
73
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");const b=f.compile();return(A,S)=>b(m,A,S)};let i;const o=As,l=!Fi.jitless,d=l&&th.value,u=t.catchall;let h;e._zod.parse=(m,f)=>{h??(h=s.value);const p=m.value;return o(p)?l&&d&&(f==null?void 0:f.async)===!1&&f.jitless!==!0?(i||(i=a(t.shape)),m=i(m,f),u?lu([],p,m,f,h,e):m):n(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),m)}});function Ko(e,t,n,s){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const a=e.filter(i=>!Xn(i));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(o=>Wn(o,s,Bn())))}),t)}const Zf=D("$ZodUnion",(e,t)=>{qe.init(e,t),je(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),je(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),je(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),je(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${s.map(a=>Mi(a.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(s,a)=>{if(n)return n(s,a);let i=!1;const o=[];for(const l of t.options){const c=l._zod.run({value:s.value,issues:[]},a);if(c instanceof Promise)o.push(c),i=!0;else{if(c.issues.length===0)return c;o.push(c)}}return i?Promise.all(o).then(l=>Ko(l,s,e,a)):Ko(o,s,e,a)}}),Uf=D("$ZodIntersection",(e,t)=>{qe.init(e,t),e._zod.parse=(n,s)=>{const a=n.value,i=t.left._zod.run({value:a,issues:[]},s),o=t.right._zod.run({value:a,issues:[]},s);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([c,d])=>Qo(n,c,d)):Qo(n,i,o)}});function Xa(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(zr(e)&&zr(t)){const n=Object.keys(t),s=Object.keys(e).filter(i=>n.indexOf(i)!==-1),a={...e,...t};for(const i of s){const o=Xa(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};a[i]=o.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let s=0;s<e.length;s++){const a=e[s],i=t[s],o=Xa(a,i);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Qo(e,t,n){const s=new Map;let a;for(const l of t.issues)if(l.code==="unrecognized_keys"){a??(a=l);for(const c of l.keys)s.has(c)||s.set(c,{}),s.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)s.has(c)||s.set(c,{}),s.get(c).r=!0;else e.issues.push(l);const i=[...s].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(i.length&&a&&e.issues.push({...a,keys:i}),Xn(e))return e;const o=Xa(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Bf=D("$ZodEnum",(e,t)=>{qe.init(e,t);const n=_c(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(a=>nh.has(typeof a)).map(a=>typeof a=="string"?fr(a):a.toString()).join("|")})$`),e._zod.parse=(a,i)=>{const o=a.value;return s.has(o)||a.issues.push({code:"invalid_value",values:n,input:o,inst:e}),a}}),Wf=D("$ZodLiteral",(e,t)=>{if(qe.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(s=>typeof s=="string"?fr(s):s?fr(s.toString()):String(s)).join("|")})$`),e._zod.parse=(s,a)=>{const i=s.value;return n.has(i)||s.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),s}}),Yf=D("$ZodTransform",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new Xc(e.constructor.name);const a=t.transform(n.value,n);if(s.async)return(a instanceof Promise?a:Promise.resolve(a)).then(o=>(n.value=o,n.fallback=!0,n));if(a instanceof Promise)throw new $n;return n.value=a,n.fallback=!0,n}});function Go(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const cu=D("$ZodOptional",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",je(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),je(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Mi(n.source)})?$`):void 0}),e._zod.parse=(n,s)=>{if(t.innerType._zod.optin==="optional"){const a=n.value,i=t.innerType._zod.run(n,s);return i instanceof Promise?i.then(o=>Go(o,a)):Go(i,a)}return n.value===void 0?n:t.innerType._zod.run(n,s)}}),Hf=D("$ZodExactOptional",(e,t)=>{cu.init(e,t),je(e._zod,"values",()=>t.innerType._zod.values),je(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,s)=>t.innerType._zod.run(n,s)}),Kf=D("$ZodNullable",(e,t)=>{qe.init(e,t),je(e._zod,"optin",()=>t.innerType._zod.optin),je(e._zod,"optout",()=>t.innerType._zod.optout),je(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Mi(n.source)}|null)$`):void 0}),je(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,s)=>n.value===null?n:t.innerType._zod.run(n,s)}),Qf=D("$ZodDefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",je(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);if(n.value===void 0)return n.value=t.defaultValue,n;const a=t.innerType._zod.run(n,s);return a instanceof Promise?a.then(i=>Jo(i,t)):Jo(a,t)}});function Jo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Gf=D("$ZodPrefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",je(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>(s.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,s))}),Jf=D("$ZodNonOptional",(e,t)=>{qe.init(e,t),je(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,s)=>{const a=t.innerType._zod.run(n,s);return a instanceof Promise?a.then(i=>Xo(i,e)):Xo(a,e)}});function Xo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Xf=D("$ZodCatch",(e,t)=>{qe.init(e,t),e._zod.optin="optional",je(e._zod,"optout",()=>t.innerType._zod.optout),je(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const a=t.innerType._zod.run(n,s);return a instanceof Promise?a.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>Wn(o,s,Bn()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(i=>Wn(i,s,Bn()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),_f=D("$ZodPipe",(e,t)=>{qe.init(e,t),je(e._zod,"values",()=>t.in._zod.values),je(e._zod,"optin",()=>t.in._zod.optin),je(e._zod,"optout",()=>t.out._zod.optout),je(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,s)=>{if(s.direction==="backward"){const i=t.out._zod.run(n,s);return i instanceof Promise?i.then(o=>as(o,t.in,s)):as(i,t.in,s)}const a=t.in._zod.run(n,s);return a instanceof Promise?a.then(i=>as(i,t.out,s)):as(a,t.out,s)}});function as(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const $f=D("$ZodReadonly",(e,t)=>{qe.init(e,t),je(e._zod,"propValues",()=>t.innerType._zod.propValues),je(e._zod,"values",()=>t.innerType._zod.values),je(e._zod,"optin",()=>{var n,s;return(s=(n=t.innerType)==null?void 0:n._zod)==null?void 0:s.optin}),je(e._zod,"optout",()=>{var n,s;return(s=(n=t.innerType)==null?void 0:n._zod)==null?void 0:s.optout}),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const a=t.innerType._zod.run(n,s);return a instanceof Promise?a.then(_o):_o(a)}});function _o(e){return e.value=Object.freeze(e.value),e}const e5=D("$ZodCustom",(e,t)=>{Qt.init(e,t),qe.init(e,t),e._zod.parse=(n,s)=>n,e._zod.check=n=>{const s=n.value,a=t.fn(s);if(a instanceof Promise)return a.then(i=>$o(i,n,s,e));$o(a,n,s,e)}});function $o(e,t,n,s){if(!e){const a={code:"custom",input:n,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(a.params=s._zod.def.params),t.issues.push(Vr(a))}}var el;class t5{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const s=n[0];return this._map.set(t,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const s={...this.get(n)??{}};delete s.id;const a={...s,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function n5(){return new t5}(el=globalThis).__zod_globalRegistry??(el.__zod_globalRegistry=n5());const Fr=globalThis.__zod_globalRegistry;function r5(e,t){return new e({type:"string",...ae(t)})}function uu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ae(t)})}function tl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ae(t)})}function s5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ae(t)})}function a5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ae(t)})}function i5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ae(t)})}function o5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ae(t)})}function l5(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ae(t)})}function c5(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ae(t)})}function u5(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ae(t)})}function d5(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ae(t)})}function m5(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ae(t)})}function h5(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ae(t)})}function f5(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ae(t)})}function p5(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ae(t)})}function x5(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ae(t)})}function g5(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ae(t)})}function y5(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ae(t)})}function b5(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ae(t)})}function v5(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ae(t)})}function C5(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ae(t)})}function j5(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ae(t)})}function w5(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ae(t)})}function N5(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ae(t)})}function S5(e,t){return new e({type:"string",format:"date",check:"string_format",...ae(t)})}function k5(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ae(t)})}function A5(e,t){return new e({type:"string",format:"duration",check:"string_format",...ae(t)})}function P5(e,t){return new e({type:"boolean",...ae(t)})}function I5(e){return new e({type:"unknown"})}function E5(e,t){return new e({type:"never",...ae(t)})}function du(e,t){return new Xh({check:"max_length",...ae(t),maximum:e})}function Is(e,t){return new _h({check:"min_length",...ae(t),minimum:e})}function mu(e,t){return new $h({check:"length_equals",...ae(t),length:e})}function T5(e,t){return new ef({check:"string_format",format:"regex",...ae(t),pattern:e})}function L5(e){return new tf({check:"string_format",format:"lowercase",...ae(e)})}function F5(e){return new nf({check:"string_format",format:"uppercase",...ae(e)})}function R5(e,t){return new rf({check:"string_format",format:"includes",...ae(t),includes:e})}function D5(e,t){return new sf({check:"string_format",format:"starts_with",...ae(t),prefix:e})}function M5(e,t){return new af({check:"string_format",format:"ends_with",...ae(t),suffix:e})}function jr(e){return new of({check:"overwrite",tx:e})}function O5(e){return jr(t=>t.normalize(e))}function z5(){return jr(e=>e.trim())}function V5(){return jr(e=>e.toLowerCase())}function q5(){return jr(e=>e.toUpperCase())}function Z5(){return jr(e=>eh(e))}function U5(e,t,n){return new e({type:"array",element:t,...ae(n)})}function B5(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ae(n)})}function W5(e,t){const n=Y5(s=>(s.addIssue=a=>{if(typeof a=="string")s.issues.push(Vr(a,s.value,n._zod.def));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=s.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),s.issues.push(Vr(i))}},e(s.value,s)),t);return n}function Y5(e,t){const n=new Qt({check:"custom",...ae(t)});return n._zod.check=e,n}function hu(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Fr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function _e(e,t,n={path:[],schemaPath:[]}){var u,h;var s;const a=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const l=(h=(u=e._zod).toJSONSchema)==null?void 0:h.call(u);if(l)o.schema=l;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,m);else{const p=o.schema,g=t.processors[a.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);g(e,t,p,m)}const f=e._zod.parent;f&&(o.ref||(o.ref=f),_e(f,t,m),t.seen.get(f).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io==="input"&&at(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((s=o.schema).default??(s.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function fu(e,t){var o,l,c,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const u of e.seen.entries()){const h=(o=e.metadataRegistry.get(u[0]))==null?void 0:o.id;if(h){const m=s.get(h);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(h,u[0])}}const a=u=>{var g;const h=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=(g=e.external.registry.get(u[0]))==null?void 0:g.id,C=e.external.uri??(j=>j);if(y)return{ref:C(y)};const b=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=b,{defId:b,ref:`${C("__shared")}#/${h}/${b}`}}if(u[1]===n)return{ref:"#"};const f=`#/${h}/`,p=u[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:f+p}},i=u=>{if(u[1].schema.$ref)return;const h=u[1],{ref:m,defId:f}=a(u);h.def={...h.schema},f&&(h.defId=f);const p=h.schema;for(const g in p)delete p[g];p.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const h=u[1];if(h.cycle)throw new Error(`Cycle detected: #/${(l=h.cycle)==null?void 0:l.join("/")}/<root>
|
|
74
74
|
|
|
75
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const m=u[1];if(t===u[0]){i(u);continue}if(e.external){const p=(c=e.external.registry.get(u[0]))==null?void 0:c.id;if(t!==u[0]&&p){i(u);continue}}if((d=e.metadataRegistry.get(u[0]))==null?void 0:d.id){i(u);continue}if(m.cycle){i(u);continue}if(m.count>1&&e.reused==="ref"){i(u);continue}}}function iu(e,t){var l,c,d,u;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{const h=e.seen.get(m);if(h.ref===null)return;const p=h.def??h.schema,g={...p},x=h.ref;if(h.ref=null,x){r(x);const y=e.seen.get(x),C=y.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(C)):Object.assign(p,C),Object.assign(p,g),m._zod.parent===x)for(const S in p)S==="$ref"||S==="allOf"||S in g||delete p[S];if(C.$ref&&y.def)for(const S in p)S==="$ref"||S==="allOf"||S in y.def&&JSON.stringify(p[S])===JSON.stringify(y.def[S])&&delete p[S]}const b=m._zod.parent;if(b&&b!==x){r(b);const y=e.seen.get(b);if(y!=null&&y.schema.$ref&&(p.$ref=y.schema.$ref,y.def))for(const C in p)C==="$ref"||C==="allOf"||C in y.def&&JSON.stringify(p[C])===JSON.stringify(y.def[C])&&delete p[C]}e.override({zodSchema:m,jsonSchema:p,path:h.path??[]})};for(const m of[...e.seen.entries()].reverse())r(m[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,(l=e.external)!=null&&l.uri){const m=(c=e.external.registry.get(t))==null?void 0:c.id;if(!m)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(m)}Object.assign(a,n.def??n.schema);const i=(d=e.metadataRegistry.get(t))==null?void 0:d.id;i!==void 0&&a.id===i&&delete a.id;const o=((u=e.external)==null?void 0:u.defs)??{};for(const m of e.seen.entries()){const h=m[1];h.def&&h.defId&&(h.def.id===h.defId&&delete h.def.id,o[h.defId]=h.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?a.$defs=o:a.definitions=o);try{const m=JSON.parse(JSON.stringify(a));return Object.defineProperty(m,"~standard",{value:{...t["~standard"],jsonSchema:{input:Is(t,"input",e.processors),output:Is(t,"output",e.processors)}},enumerable:!1,writable:!1}),m}catch{throw new Error("Error converting schema to JSON.")}}function Xe(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Xe(r.element,n);if(r.type==="set")return Xe(r.valueType,n);if(r.type==="lazy")return Xe(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Xe(r.innerType,n);if(r.type==="intersection")return Xe(r.left,n)||Xe(r.right,n);if(r.type==="record"||r.type==="map")return Xe(r.keyType,n)||Xe(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Xe(r.in,n)||Xe(r.out,n);if(r.type==="object"){for(const a in r.shape)if(Xe(r.shape[a],n))return!0;return!1}if(r.type==="union"){for(const a of r.options)if(Xe(a,n))return!0;return!1}if(r.type==="tuple"){for(const a of r.items)if(Xe(a,n))return!0;return!!(r.rest&&Xe(r.rest,n))}return!1}const _g=(e,t={})=>n=>{const r=su({...n,processors:t});return We(e,r),au(r,e),iu(r,e)},Is=(e,t,n={})=>r=>{const{libraryOptions:a,target:i}=r??{},o=su({...a??{},target:i,io:t,processors:n});return We(e,o),au(o,e),iu(o,e)},Dg={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Fg=(e,t,n,r)=>{const a=n;a.type="string";const{minimum:i,maximum:o,format:l,patterns:c,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(a.minLength=i),typeof o=="number"&&(a.maxLength=o),l&&(a.format=Dg[l]??l,a.format===""&&delete a.format,l==="time"&&delete a.format),d&&(a.contentEncoding=d),c&&c.size>0){const u=[...c];u.length===1?a.pattern=u[0].source:u.length>1&&(a.allOf=[...u.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Rg=(e,t,n,r)=>{n.type="boolean"},Lg=(e,t,n,r)=>{n.not={}},$g=(e,t,n,r)=>{},Og=(e,t,n,r)=>{const a=e._zod.def,i=Vc(a.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},zg=(e,t,n,r)=>{const a=e._zod.def,i=[];for(const o of a.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){const o=i[0];n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[o]:n.const=o}else i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),i.every(o=>typeof o=="boolean")&&(n.type="boolean"),i.every(o=>o===null)&&(n.type="null"),n.enum=i},Mg=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},qg=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Bg=(e,t,n,r)=>{const a=n,i=e._zod.def,{minimum:o,maximum:l}=e._zod.bag;typeof o=="number"&&(a.minItems=o),typeof l=="number"&&(a.maxItems=l),a.type="array",a.items=We(i.element,t,{...r,path:[...r.path,"items"]})},Vg=(e,t,n,r)=>{var d;const a=n,i=e._zod.def;a.type="object",a.properties={};const o=i.shape;for(const u in o)a.properties[u]=We(o[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(o)),c=new Set([...l].filter(u=>{const m=i.shape[u]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));c.size>0&&(a.required=Array.from(c)),((d=i.catchall)==null?void 0:d._zod.def.type)==="never"?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=We(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},Ug=(e,t,n,r)=>{const a=e._zod.def,i=a.inclusive===!1,o=a.options.map((l,c)=>We(l,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=o:n.anyOf=o},Zg=(e,t,n,r)=>{const a=e._zod.def,i=We(a.left,t,{...r,path:[...r.path,"allOf",0]}),o=We(a.right,t,{...r,path:[...r.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,c=[...l(i)?i.allOf:[i],...l(o)?o.allOf:[o]];n.allOf=c},Wg=(e,t,n,r)=>{const a=e._zod.def,i=We(a.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=a.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Yg=(e,t,n,r)=>{const a=e._zod.def;We(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType},Hg=(e,t,n,r)=>{const a=e._zod.def;We(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},Kg=(e,t,n,r)=>{const a=e._zod.def;We(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},Qg=(e,t,n,r)=>{const a=e._zod.def;We(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType;let o;try{o=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},Jg=(e,t,n,r)=>{const a=e._zod.def,i=a.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?i?a.out:a.in:a.out;We(o,t,r);const l=t.seen.get(e);l.ref=o},Gg=(e,t,n,r)=>{const a=e._zod.def;We(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType,n.readOnly=!0},ou=(e,t,n,r)=>{const a=e._zod.def;We(a.innerType,t,r);const i=t.seen.get(e);i.ref=a.innerType};function Ja(){return Ja=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ja.apply(null,arguments)}function rl(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function Xg(e,t){for(var n={};e.length;){var r=e[0],a=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:a};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(m){return e.push(m)})}),t){var c=n[o].types,d=c&&c[r.code];n[o]=Pi(o,t,n,a,d?[].concat(d,r.message):r.message)}e.shift()}return n}function ey(e,t){for(var n={},r=function(){var a=e[0],i=a.code,o=a.message,l=a.path.join(".");if(!n[l])if(a.code==="invalid_union"&&a.errors.length>0){var c=a.errors[0][0];n[l]={message:c.message,type:c.code}}else n[l]={message:o,type:i};if(a.code==="invalid_union"&&a.errors.forEach(function(m){return m.forEach(function(h){return e.push(Ja({},h,{path:[].concat(a.path,h.path)}))})}),t){var d=n[l].types,u=d&&d[a.code];n[l]=Pi(l,t,n,i,u?[].concat(u,a.message):a.message)}e.shift()};e.length;)r();return n}function Ot(e,t,n){if(n===void 0&&(n={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(e))return function(r,a,i){try{return Promise.resolve(rl(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(o){return i.shouldUseNativeValidation&&Ha({},i),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(l){return Array.isArray(l==null?void 0:l.issues)})(o))return{values:{},errors:qo(Xg(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,a,i){try{return Promise.resolve(rl(function(){return Promise.resolve((n.mode==="sync"?tp:np)(e,r,t)).then(function(o){return i.shouldUseNativeValidation&&Ha({},i),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(l){return l instanceof Li})(o))return{values:{},errors:qo(ey(o.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}function Yr({label:e,required:t=!1,htmlFor:n,tooltip:r}){return s.jsxs("label",{htmlFor:n,className:"mb-1.5 flex items-center text-sm text-slate-600",children:[e,t?s.jsx("span",{className:"text-red-500",children:" *"}):null,r?s.jsx(ty,{text:r}):null]})}function ty({text:e}){return s.jsxs("span",{className:"group relative ml-1.5 inline-flex items-center",children:[s.jsxs("svg",{className:"h-4 w-4 cursor-help text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 16v-4M12 8h.01"})]}),s.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-20 mb-1.5 w-max max-w-xs -translate-x-1/2 rounded-md bg-slate-800 px-2.5 py-1.5 text-xs font-normal leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100",children:e})]})}const he=v.forwardRef(function({label:t,required:n=!1,error:r,tooltip:a,id:i,className:o="",...l},c){const d=i??l.name;return s.jsxs("div",{children:[s.jsx(Yr,{label:t,required:n,htmlFor:d,tooltip:a}),s.jsx("input",{ref:c,id:d,className:`block w-full rounded-lg border bg-white px-3 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 ${r?"border-red-300":"border-slate-200"} ${o}`,...l}),r?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:r}):null]})}),xn=v.forwardRef(function({label:t,required:n=!1,error:r,id:a,className:i="",children:o,...l},c){const d=a??l.name;return s.jsxs("div",{children:[s.jsx(Yr,{label:t,required:n,htmlFor:d}),s.jsxs("div",{className:"relative",children:[s.jsx("select",{ref:c,id:d,className:`block w-full appearance-none rounded-lg border bg-white px-3 py-2.5 pr-10 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 ${r?"border-red-300":"border-slate-200"} ${i}`,...l,children:o}),s.jsx(ny,{})]}),r?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:r}):null]})});function lu({step:e,title:t,muted:n=!1,children:r}){return s.jsxs("section",{className:"space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[e?s.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-gov-600 text-xs font-semibold text-white",children:e}):null,s.jsx("h3",{className:`text-sm font-semibold tracking-wide ${n?"text-slate-400":"text-gov-700"}`,children:t})]}),r]})}function ny(){return s.jsx("svg",{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Ts({title:e,subtitle:t,step:n,children:r,className:a=""}){return s.jsxs("section",{className:`rounded-xl border border-slate-200 bg-white ${a}`,children:[s.jsxs("div",{className:"flex items-center gap-3 border-b border-slate-100 px-6 py-4",children:[n?s.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-gov-600 text-xs font-semibold text-white",children:n}):null,s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:e}),t?s.jsx("p",{className:"mt-0.5 text-xs text-slate-500",children:t}):null]})]}),s.jsx("div",{className:"space-y-5 p-6",children:r})]})}function cu({label:e,required:t=!1,options:n,value:r,onChange:a}){const i=v.useId(),o=v.useRef([]),l=n.findIndex(u=>u.value===r),c=u=>{var h;const m=(u+n.length)%n.length;a(n[m].value),(h=o.current[m])==null||h.focus()},d=u=>{u.key==="ArrowRight"||u.key==="ArrowDown"?(u.preventDefault(),c(l+1)):(u.key==="ArrowLeft"||u.key==="ArrowUp")&&(u.preventDefault(),c(l-1))};return s.jsxs("div",{children:[s.jsx(Yr,{label:e,required:t,htmlFor:i}),s.jsx("div",{id:i,role:"radiogroup","aria-label":e,onKeyDown:d,className:"grid gap-3",style:{gridTemplateColumns:`repeat(${n.length}, minmax(0, 1fr))`},children:n.map((u,m)=>{const h=u.value===r;return s.jsxs("button",{ref:p=>{o.current[m]=p},type:"button",role:"radio","aria-checked":h,tabIndex:h?0:-1,onClick:()=>a(u.value),className:`flex items-center justify-center gap-2 rounded-lg border px-4 py-3 text-sm font-semibold transition focus:outline-none focus-visible:ring-2 focus-visible:ring-gov-500 focus-visible:ring-offset-1 sm:text-base ${h?"border-gov-400 bg-gov-50 text-gov-700 shadow-sm ring-1 ring-gov-200":"border-slate-200 bg-white text-slate-600 hover:border-slate-300 hover:bg-slate-50"}`,children:[u.icon?s.jsx("span",{className:h?"text-gov-600":"text-slate-400",children:u.icon}):null,u.label,h?s.jsx(ry,{}):null]},u.value)})})]})}function ry(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"3",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}function uu({label:e="Phone Number",required:t=!1,error:n,countryCodeSelectProps:r,phoneInputProps:a}){const i=a.id??a.name,o=n&&i?`${i}-error`:void 0;return s.jsxs("div",{children:[s.jsx(Yr,{label:e,required:t,htmlFor:i}),s.jsxs("div",{className:`flex overflow-hidden rounded-lg border bg-white transition focus-within:ring-2 focus-within:ring-gov-200 ${n?"border-red-300":"border-slate-200 focus-within:border-gov-400"}`,children:[s.jsx("select",{"aria-label":"Country code",...r,className:"shrink-0 border-r border-slate-200 bg-slate-50 px-3 py-2.5 text-sm text-slate-900 focus:outline-none",children:s.jsx("option",{value:"+1",children:"+1"})}),s.jsx("input",{type:"tel",inputMode:"numeric","aria-invalid":n?!0:void 0,"aria-describedby":o,...a,id:i,className:"block w-full border-0 px-3 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-0"})]}),n?s.jsx("p",{id:o,className:"mt-1 text-xs text-red-600",children:n}):null]})}function du({onCancel:e,isSubmitting:t,submitLabel:n,submittingLabel:r,cancelLabel:a="Cancel",className:i=""}){return s.jsxs("div",{className:`sticky bottom-0 flex flex-col-reverse gap-3 border-t border-slate-200 bg-white py-4 sm:flex-row sm:items-center ${i}`,children:[s.jsx("button",{type:"button",onClick:e,disabled:t,className:"inline-flex h-11 w-full items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:opacity-60 sm:w-auto",children:a}),s.jsx("button",{type:"submit",disabled:t,className:"inline-flex h-11 w-full items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:opacity-60 sm:w-auto",children:t?r:n})]})}function zt({variant:e="error",title:t,message:n}){const r=e==="error"?"border-red-200 bg-red-50 text-red-800":"border-slate-200 bg-white text-slate-700";return s.jsxs("div",{className:`rounded-lg border px-4 py-3 text-sm ${r}`,role:"alert",children:[t?s.jsx("p",{className:"font-medium",children:t}):null,s.jsx("p",{className:t?"mt-1":void 0,children:n})]})}function nt(e,t){var n;if(e instanceof xr){if(e.details){const r=(n=Object.values(e.details)[0])==null?void 0:n[0];if(r)return r}return e.message||t}return e instanceof Error&&e.message?e.message:t}const sy=D("ZodISODateTime",(e,t)=>{ox.init(e,t),Ie.init(e,t)});function ay(e){return ug(sy,e)}const iy=D("ZodISODate",(e,t)=>{lx.init(e,t),Ie.init(e,t)});function oy(e){return dg(iy,e)}const ly=D("ZodISOTime",(e,t)=>{cx.init(e,t),Ie.init(e,t)});function cy(e){return mg(ly,e)}const uy=D("ZodISODuration",(e,t)=>{ux.init(e,t),Ie.init(e,t)});function dy(e){return hg(uy,e)}const my=(e,t)=>{Li.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>ep(e,n)},flatten:{value:n=>Xf(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ka,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ka,2)}},isEmpty:{get(){return e.issues.length===0}}})},bt=D("ZodError",my,{Parent:Error}),hy=Ys(bt),fy=Hs(bt),py=Ks(bt),xy=Qs(bt),gy=ap(bt),yy=ip(bt),by=op(bt),vy=lp(bt),jy=cp(bt),wy=up(bt),Ny=dp(bt),Sy=mp(bt),sl=new WeakMap;function Gs(e,t,n){const r=Object.getPrototypeOf(e);let a=sl.get(r);if(a||(a=new Set,sl.set(r,a)),!a.has(t)){a.add(t);for(const i in n){const o=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const l=o.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}const Re=D("ZodType",(e,t)=>(Fe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Is(e,"input"),output:Is(e,"output")}}),e.toJSONSchema=_g(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>hy(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>py(e,n,r),e.parseAsync=async(n,r)=>fy(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>xy(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>gy(e,n,r),e.decode=(n,r)=>yy(e,n,r),e.encodeAsync=async(n,r)=>by(e,n,r),e.decodeAsync=async(n,r)=>vy(e,n,r),e.safeEncode=(n,r)=>jy(e,n,r),e.safeDecode=(n,r)=>wy(e,n,r),e.safeEncodeAsync=async(n,r)=>Ny(e,n,r),e.safeDecodeAsync=async(n,r)=>Sy(e,n,r),Gs(e,"ZodType",{check(...n){const r=this.def;return this.clone(gn(r,{checks:[...r.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return yn(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(xb(n,r))},superRefine(n,r){return this.check(gb(n,r))},overwrite(n){return this.check(gr(n))},optional(){return ol(this)},exactOptional(){return rb(this)},nullable(){return ll(this)},nullish(){return ol(ll(this))},nonoptional(n){return cb(this,n)},array(){return Hy(this)},or(n){return fu([this,n])},and(n){return Gy(this,n)},transform(n){return cl(this,tb(n))},default(n){return ib(this,n)},prefault(n){return lb(this,n)},catch(n){return db(this,n)},pipe(n){return cl(this,n)},readonly(){return fb(this)},describe(n){const r=this.clone();return Pr.add(r,{description:n}),r},meta(...n){if(n.length===0)return Pr.get(this);const r=this.clone();return Pr.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=Pr.get(e))==null?void 0:n.description},configurable:!0}),e)),mu=D("_ZodString",(e,t)=>{$i.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(r,a,i)=>Fg(e,r,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Gs(e,"_ZodString",{regex(...r){return this.check(gg(...r))},includes(...r){return this.check(vg(...r))},startsWith(...r){return this.check(jg(...r))},endsWith(...r){return this.check(wg(...r))},min(...r){return this.check(Es(...r))},max(...r){return this.check(nu(...r))},length(...r){return this.check(ru(...r))},nonempty(...r){return this.check(Es(1,...r))},lowercase(r){return this.check(yg(r))},uppercase(r){return this.check(bg(r))},trim(){return this.check(Sg())},normalize(...r){return this.check(Ng(...r))},toLowerCase(){return this.check(kg())},toUpperCase(){return this.check(Cg())},slugify(){return this.check(Ag())}})}),ky=D("ZodString",(e,t)=>{$i.init(e,t),mu.init(e,t),e.email=n=>e.check(tu(hu,n)),e.url=n=>e.check(Hx(Ay,n)),e.jwt=n=>e.check(cg(By,n)),e.emoji=n=>e.check(Kx(Py,n)),e.guid=n=>e.check(nl(al,n)),e.uuid=n=>e.check(Ux(os,n)),e.uuidv4=n=>e.check(Zx(os,n)),e.uuidv6=n=>e.check(Wx(os,n)),e.uuidv7=n=>e.check(Yx(os,n)),e.nanoid=n=>e.check(Qx(Ey,n)),e.guid=n=>e.check(nl(al,n)),e.cuid=n=>e.check(Jx(Iy,n)),e.cuid2=n=>e.check(Gx(Ty,n)),e.ulid=n=>e.check(Xx(_y,n)),e.base64=n=>e.check(ig(zy,n)),e.base64url=n=>e.check(og(My,n)),e.xid=n=>e.check(eg(Dy,n)),e.ksuid=n=>e.check(tg(Fy,n)),e.ipv4=n=>e.check(ng(Ry,n)),e.ipv6=n=>e.check(rg(Ly,n)),e.cidrv4=n=>e.check(sg($y,n)),e.cidrv6=n=>e.check(ag(Oy,n)),e.e164=n=>e.check(lg(qy,n)),e.datetime=n=>e.check(ay(n)),e.date=n=>e.check(oy(n)),e.time=n=>e.check(cy(n)),e.duration=n=>e.check(dy(n))});function _(e){return Vx(ky,e)}const Ie=D("ZodStringFormat",(e,t)=>{Ce.init(e,t),mu.init(e,t)}),hu=D("ZodEmail",(e,t)=>{Gp.init(e,t),Ie.init(e,t)});function Cy(e){return tu(hu,e)}const al=D("ZodGUID",(e,t)=>{Qp.init(e,t),Ie.init(e,t)}),os=D("ZodUUID",(e,t)=>{Jp.init(e,t),Ie.init(e,t)}),Ay=D("ZodURL",(e,t)=>{Xp.init(e,t),Ie.init(e,t)}),Py=D("ZodEmoji",(e,t)=>{ex.init(e,t),Ie.init(e,t)}),Ey=D("ZodNanoID",(e,t)=>{tx.init(e,t),Ie.init(e,t)}),Iy=D("ZodCUID",(e,t)=>{nx.init(e,t),Ie.init(e,t)}),Ty=D("ZodCUID2",(e,t)=>{rx.init(e,t),Ie.init(e,t)}),_y=D("ZodULID",(e,t)=>{sx.init(e,t),Ie.init(e,t)}),Dy=D("ZodXID",(e,t)=>{ax.init(e,t),Ie.init(e,t)}),Fy=D("ZodKSUID",(e,t)=>{ix.init(e,t),Ie.init(e,t)}),Ry=D("ZodIPv4",(e,t)=>{dx.init(e,t),Ie.init(e,t)}),Ly=D("ZodIPv6",(e,t)=>{mx.init(e,t),Ie.init(e,t)}),$y=D("ZodCIDRv4",(e,t)=>{hx.init(e,t),Ie.init(e,t)}),Oy=D("ZodCIDRv6",(e,t)=>{fx.init(e,t),Ie.init(e,t)}),zy=D("ZodBase64",(e,t)=>{px.init(e,t),Ie.init(e,t)}),My=D("ZodBase64URL",(e,t)=>{gx.init(e,t),Ie.init(e,t)}),qy=D("ZodE164",(e,t)=>{yx.init(e,t),Ie.init(e,t)}),By=D("ZodJWT",(e,t)=>{vx.init(e,t),Ie.init(e,t)}),Vy=D("ZodBoolean",(e,t)=>{jx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Rg(e,n,r)});function Wn(e){return fg(Vy,e)}const Uy=D("ZodUnknown",(e,t)=>{wx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>$g()});function il(){return pg(Uy)}const Zy=D("ZodNever",(e,t)=>{Nx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Lg(e,n,r)});function Wy(e){return xg(Zy,e)}const Yy=D("ZodArray",(e,t)=>{Sx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Bg(e,n,r,a),e.element=t.element,Gs(e,"ZodArray",{min(n,r){return this.check(Es(n,r))},nonempty(n){return this.check(Es(1,n))},max(n,r){return this.check(nu(n,r))},length(n,r){return this.check(ru(n,r))},unwrap(){return this.element}})});function Hy(e,t){return Pg(Yy,e,t)}const Ky=D("ZodObject",(e,t)=>{Cx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Vg(e,n,r,a),ve(e,"shape",()=>t.shape),Gs(e,"ZodObject",{keyof(){return Xs(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:il()})},loose(){return this.clone({...this._zod.def,catchall:il()})},strict(){return this.clone({...this._zod.def,catchall:Wy()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Yf(this,n)},safeExtend(n){return Hf(this,n)},merge(n){return Kf(this,n)},pick(n){return Zf(this,n)},omit(n){return Wf(this,n)},partial(...n){return Qf(pu,this,n[0])},required(...n){return Jf(xu,this,n[0])}})});function Xt(e,t){const n={type:"object",shape:e??{},...se(t)};return new Ky(n)}const Qy=D("ZodUnion",(e,t)=>{Ax.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Ug(e,n,r,a),e.options=t.options});function fu(e,t){return new Qy({type:"union",options:e,...se(t)})}const Jy=D("ZodIntersection",(e,t)=>{Px.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Zg(e,n,r,a)});function Gy(e,t){return new Jy({type:"intersection",left:e,right:t})}const Ga=D("ZodEnum",(e,t)=>{Ex.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(r,a,i)=>Og(e,r,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,a)=>{const i={};for(const o of r)if(n.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Ga({...t,checks:[],...se(a),entries:i})},e.exclude=(r,a)=>{const i={...t.entries};for(const o of r)if(n.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new Ga({...t,checks:[],...se(a),entries:i})}});function Xs(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ga({type:"enum",entries:n,...se(t)})}const Xy=D("ZodLiteral",(e,t)=>{Ix.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>zg(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function da(e,t){return new Xy({type:"literal",values:Array.isArray(e)?e:[e],...se(t)})}const eb=D("ZodTransform",(e,t)=>{Tx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>qg(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Bc(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Rr(i,n.value,t));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push(Rr(o))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function tb(e){return new eb({type:"transform",transform:e})}const pu=D("ZodOptional",(e,t)=>{eu.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>ou(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function ol(e){return new pu({type:"optional",innerType:e})}const nb=D("ZodExactOptional",(e,t)=>{_x.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>ou(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function rb(e){return new nb({type:"optional",innerType:e})}const sb=D("ZodNullable",(e,t)=>{Dx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Wg(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function ll(e){return new sb({type:"nullable",innerType:e})}const ab=D("ZodDefault",(e,t)=>{Fx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Hg(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ib(e,t){return new ab({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Zc(t)}})}const ob=D("ZodPrefault",(e,t)=>{Rx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Kg(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function lb(e,t){return new ob({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Zc(t)}})}const xu=D("ZodNonOptional",(e,t)=>{Lx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Yg(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function cb(e,t){return new xu({type:"nonoptional",innerType:e,...se(t)})}const ub=D("ZodCatch",(e,t)=>{$x.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Qg(e,n,r,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function db(e,t){return new ub({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const mb=D("ZodPipe",(e,t)=>{Ox.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Jg(e,n,r,a),e.in=t.in,e.out=t.out});function cl(e,t){return new mb({type:"pipe",in:e,out:t})}const hb=D("ZodReadonly",(e,t)=>{zx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Gg(e,n,r,a),e.unwrap=()=>e._zod.def.innerType});function fb(e){return new hb({type:"readonly",innerType:e})}const pb=D("ZodCustom",(e,t)=>{Mx.init(e,t),Re.init(e,t),e._zod.processJSONSchema=(n,r,a)=>Mg(e,n)});function xb(e,t={}){return Eg(pb,e,t)}function gb(e,t){return Ig(e,t)}const dt={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Oi(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[t.length-1][0]}`.toUpperCase()}function en(e){return e.tradeName.trim()?e.tradeName:e.accountType==="Business"?(e.lastName||e.firstName).trim():`${e.firstName} ${e.lastName}`.trim()}function zi(e){const t=e.replace(/\D/g,"");return t.length!==9?e:`${t.slice(0,2)}-${t.slice(2)}`}function yb(e){const t=e.replace(/\D/g,"");return t.length!==9?e:`${t.slice(0,3)}-${t.slice(3,5)}-${t.slice(5)}`}function Hr(e,t){return t==="Individual"?yb(e):zi(e)}function ul(e,t){const n=e.replace(/\D/g,"").slice(0,9);return t==="Individual"?n.length<=3?n:n.length<=5?`${n.slice(0,3)}-${n.slice(3)}`:`${n.slice(0,3)}-${n.slice(3,5)}-${n.slice(5)}`:n.length<=2?n:`${n.slice(0,2)}-${n.slice(2)}`}function Ln(e){const t=e.replace(/\D/g,""),n=t.length===11&&t.startsWith("1")?t.slice(1):t;return n.length!==10?e:`+1 (${n.slice(0,3)}) ${n.slice(3,6)}-${n.slice(6)}`}const gu=["LLP","LLC","Corporation","S-Corp","Partnership"],yu=["Sole Proprietorship"],bb=/^[A-Za-z][A-Za-z\s'.-]*$/,dl=/^[A-Za-z0-9][A-Za-z0-9\s,.'#/&-]*$/,Xa=10,bu=/^\d{5}(-\d{4})?$/,vb=/^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/;function Mi(e){const t=e.replace(/\D/g,"").slice(0,9);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`}function vu(e){const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6);return t.length<=3?t:`${t.slice(0,3)} ${t.slice(3)}`}const ju=Xt({accountType:Xs(["Business","Individual"]),firstName:_(),lastName:_(),tradeName:_(),ein:_(),entityType:_().min(1,"Entity type is required"),email:Cy("Enter a valid email"),countryCode:_().min(1),phoneNumber:_().min(1,"Phone number is required").refine(e=>e.replace(/\D/g,"").length===Xa,`Phone number must be ${Xa} digits`),address1:_().min(1,"Address is required"),address2:_(),city:_().min(1,"City is required"),state:_().min(1,"State is required"),zipCode:_().min(1,"ZIP code is required"),country:_().min(1,"Country is required")}).superRefine((e,t)=>{bb.test(e.city.trim())||t.addIssue({code:"custom",path:["city"],message:"City can only contain letters, spaces, apostrophes, and hyphens"}),dl.test(e.address1.trim())||t.addIssue({code:"custom",path:["address1"],message:"Address can only contain letters, numbers, spaces, and , . ' # / & -"}),e.address2.trim()&&!dl.test(e.address2.trim())&&t.addIssue({code:"custom",path:["address2"],message:"Address can only contain letters, numbers, spaces, and , . ' # / & -"}),e.country==="United States"&&!bu.test(e.zipCode.trim())?t.addIssue({code:"custom",path:["zipCode"],message:"Enter a 5-digit ZIP or ZIP+4 (e.g. 12345 or 12345-6789)"}):e.country==="Canada"&&!vb.test(e.zipCode.trim())&&t.addIssue({code:"custom",path:["zipCode"],message:"Enter a valid postal code (e.g. A1A 1A1)"});const n=e.accountType==="Individual"?"SSN":"EIN",r=e.ein.replace(/\D/g,"");if(r?r.length!==9&&t.addIssue({code:"custom",path:["ein"],message:`${n} must be 9 digits`}):t.addIssue({code:"custom",path:["ein"],message:`${n} is required`}),e.accountType==="Business"){e.lastName.trim()||t.addIssue({code:"custom",path:["lastName"],message:"Business name is required"});return}e.firstName.trim()||t.addIssue({code:"custom",path:["firstName"],message:"First name is required"}),e.lastName.trim()||t.addIssue({code:"custom",path:["lastName"],message:"Last name is required"})});function jb(e){const t=e.replace(/\D/g,"");return t.length===11&&t.startsWith("1")?{countryCode:"+1",national:t.slice(1)}:t.length===10?{countryCode:"+1",national:t}:{countryCode:"+1",national:t.slice(-Xa)}}function ml(e){const{countryCode:t,national:n}=jb(e.phoneNumber),r=e.accountType==="Individual",a=(e.lastName||e.firstName||"").trim();return{accountType:r?"Individual":"Business",firstName:r?e.firstName??"":"",lastName:r?e.lastName??"":a,tradeName:r?"":e.tradeName??"",ein:Hr(e.idNumber,e.accountType),entityType:e.entityType,email:e.email,countryCode:t,phoneNumber:n,address1:e.address1,address2:e.address2??"",city:e.city,state:e.state,zipCode:e.zipCode,country:e.country}}function wu(e,t,n,r){if(e!==t){if(e==="Business"&&t==="Individual"){n("firstName",""),n("lastName",r),n("tradeName","");return}e==="Individual"&&t==="Business"&&(n("firstName",""),n("lastName",r))}}function Nu(e){const t=e.lastName.trim();return e.accountType==="Business"?{accountType:e.accountType,firstName:"",lastName:t,idNumber:e.ein.replace(/\D/g,""),entityType:e.entityType,tradeName:e.tradeName.trim(),phoneNumber:`${e.countryCode}${e.phoneNumber.replace(/\D/g,"")}`,email:e.email,address1:e.address1,address2:e.address2||null,city:e.city,state:e.state,country:e.country,zipCode:e.zipCode}:{accountType:e.accountType,firstName:e.firstName.trim(),lastName:t,idNumber:e.ein.replace(/\D/g,""),entityType:e.entityType,tradeName:"",phoneNumber:`${e.countryCode}${e.phoneNumber.replace(/\D/g,"")}`,email:e.email,address1:e.address1,address2:e.address2||null,city:e.city,state:e.state,country:e.country,zipCode:e.zipCode}}function wb(e){const{idNumber:t,...n}=Nu(e);return n}function Nb(e){return de(`/portal/reference/states?country=${encodeURIComponent(e)}`)}function qi(e){const{data:t}=ge({queryKey:["reference","states",e],queryFn:()=>Nb(e),enabled:!!e,staleTime:1/0});return t??[]}function cr(e,t,n){const r=e.find(o=>o.code===t);if(!r||r.zipRanges.length===0)return!0;const a=n.replace(/\D/g,"");if(a.length<5)return!0;const i=Number(a.slice(0,3));return r.zipRanges.some(o=>i>=o.from&&i<=o.to)}function qn(e,t){const n=e==null?void 0:e.from;return n&&n.startsWith("/")&&!n.startsWith("//")?n:t}function Sb(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 21h18M5 21V6a1 1 0 011-1h4a1 1 0 011 1v15m0 0V3a1 1 0 011-1h4a1 1 0 011 1v18M9 9h.01M9 12h.01M9 15h.01"})})}function kb(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}function Cb(){var Ae,Le,ce,pe,L,fe,z,ue,Te,Ge,Oe,le,be,Ye;const e=ke(),t=Se(),n=pt(),{data:r=[]}=ge({queryKey:["entities","mine"],queryFn:async()=>(await bi({pageNumber:1,pageSize:100})).items}),[a,i]=v.useState(null),[o,l]=v.useState(!1),c=r.length===0,d=c?"/create-entity":"/dashboard",u=qn(t.state,d),m=()=>{e(u)},{register:h,handleSubmit:p,watch:g,setValue:x,getValues:b,formState:{errors:y}}=Lt({resolver:Ot(ju),shouldUnregister:!1,defaultValues:{accountType:"Business",firstName:"",lastName:"",tradeName:"",ein:"",entityType:"LLP",email:"",countryCode:"+1",phoneNumber:"",address1:"",address2:"",city:"",state:"",zipCode:"",country:"United States"}}),C=g("accountType"),j=g("entityType"),S=C==="Individual"?yu:gu,I=C==="Individual",F=I?"SSN":"EIN",E=I?"***-**-****":"**-*******",T=I?11:10,O=g("country"),V=g("state"),Q=g("zipCode"),X=O==="United States",H=qi(O),U=V.length>0&&Q.trim().length>0&&!cr(H,V,Q),Z=h("ein"),ie=h("phoneNumber"),G=h("zipCode");v.useEffect(()=>{V&&H.length>0&&!H.some(re=>re.code===V)&&x("state","")},[O,H]);const W=re=>{const Ve=b("accountType");if(Ve===re)return;const rt=b("lastName");wu(Ve,re,x,rt),x("accountType",re),x("ein",ul(b("ein"),re)),queueMicrotask(()=>{x("lastName",rt),x("firstName",""),Ve==="Business"&&re==="Individual"&&x("tradeName","")})};v.useEffect(()=>{S.includes(j)||x("entityType",C==="Individual"?"Sole Proprietorship":"LLP")},[C,j,S,x]);const we=p(async re=>{if(i(null),!cr(H,re.state,re.zipCode)){i(`ZIP code does not match the selected state (${re.state}).`);return}l(!0);try{await nf(Nu(re)),await n.invalidateQueries({queryKey:["entities","mine"]}),e(c?"/dashboard":u,{replace:!0})}catch(Ve){i(nt(Ve,"Unable to save entity. Please try again."))}finally{l(!1)}});return s.jsxs("form",{onSubmit:we,noValidate:!0,className:"w-full max-w-4xl space-y-6 lg:max-w-5xl xl:max-w-6xl",children:[a?s.jsx(zt,{message:a}):null,s.jsxs(Ts,{step:1,title:"Basic Information",subtitle:"Enter the primary details for this entity.",children:[s.jsx(cu,{label:"Account Type",required:!0,value:C,onChange:W,options:[{label:"Business",value:"Business",icon:s.jsx(Sb,{})},{label:"Individual",value:"Individual",icon:s.jsx(kb,{})}]}),s.jsx("div",{className:"grid gap-5 sm:grid-cols-2",children:C==="Individual"?s.jsxs(s.Fragment,{children:[s.jsx(he,{label:"First name",required:!0,maxLength:100,placeholder:"Enter first name",error:(Ae=y.firstName)==null?void 0:Ae.message,...h("firstName")},"entity-first-name"),s.jsx(he,{label:"Last name",required:!0,maxLength:100,placeholder:"Enter last name",error:(Le=y.lastName)==null?void 0:Le.message,...h("lastName")},"entity-last-name")]}):s.jsxs(s.Fragment,{children:[s.jsx(he,{label:"Business Name",required:!0,maxLength:150,placeholder:"Enter business name",error:(ce=y.lastName)==null?void 0:ce.message,...h("lastName")},"entity-business-name"),s.jsx(he,{label:"Trade Name, if any",maxLength:150,placeholder:"Enter trade name (optional)",error:(pe=y.tradeName)==null?void 0:pe.message,...h("tradeName")},"entity-trade-name")]})}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:F,required:!0,inputMode:"numeric",placeholder:E,maxLength:T,error:(L=y.ein)==null?void 0:L.message,...Z,onChange:re=>{re.target.value=ul(re.target.value,C),Z.onChange(re)}}),s.jsx(xn,{label:"Entity Type",required:!0,error:(fe=y.entityType)==null?void 0:fe.message,...h("entityType"),children:S.map(re=>s.jsx("option",{value:re,children:re},re))})]}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:"Email ID",required:!0,type:"email",maxLength:254,placeholder:"sample@mail.com",error:(z=y.email)==null?void 0:z.message,...h("email")}),s.jsx(uu,{required:!0,error:(ue=y.phoneNumber)==null?void 0:ue.message,countryCodeSelectProps:h("countryCode"),phoneInputProps:{placeholder:"Enter 10-digit phone number",maxLength:10,...ie,onChange:re=>{re.target.value=re.target.value.replace(/\D/g,"").slice(0,10),ie.onChange(re)}}})]})]}),s.jsxs(Ts,{step:2,title:"Address Information",subtitle:"Enter the registered address.",children:[s.jsx(he,{label:"Address Line 1",required:!0,maxLength:200,placeholder:"Enter address line 1",error:(Te=y.address1)==null?void 0:Te.message,...h("address1")}),s.jsx(he,{label:"Address Line 2",maxLength:200,placeholder:"Enter address line 2 (optional)",error:(Ge=y.address2)==null?void 0:Ge.message,...h("address2")}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:"City",required:!0,maxLength:100,placeholder:"Enter city",error:(Oe=y.city)==null?void 0:Oe.message,...h("city")}),s.jsxs(xn,{label:X?"State":"Province",required:!0,error:(le=y.state)==null?void 0:le.message,...h("state"),children:[s.jsx("option",{value:"",children:X?"Select state":"Select province"}),H.map(re=>s.jsx("option",{value:re.code,children:re.name},re.code))]})]}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:X?"ZIP Code":"Postal Code",required:!0,maxLength:10,placeholder:X?"12345 or 12345-6789":"A1A 1A1",error:((be=y.zipCode)==null?void 0:be.message)??(U?`ZIP code does not match the selected state (${V}).`:void 0),...G,onChange:re=>{re.target.value=X?Mi(re.target.value):vu(re.target.value),G.onChange(re)}}),s.jsxs(xn,{label:"Country",required:!0,error:(Ye=y.country)==null?void 0:Ye.message,...h("country"),children:[s.jsx("option",{value:"United States",children:"United States"}),s.jsx("option",{value:"Canada",children:"Canada"})]})]})]}),s.jsx(du,{onCancel:m,isSubmitting:o,submitLabel:"Add Entity",submittingLabel:"Creating…"})]})}function Bi(){const e=ke(),t=Se(),n=qn(t.state,"/create-entity");return s.jsx("div",{className:"min-h-full bg-slate-50 px-4 py-6 sm:px-8 sm:py-8",children:s.jsxs("div",{className:"mx-auto w-full max-w-4xl lg:max-w-5xl xl:max-w-6xl",children:[s.jsxs("button",{type:"button",onClick:()=>e(n),className:"inline-flex items-center gap-1.5 rounded-lg py-1 text-sm font-medium text-slate-600 transition hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gov-500",children:[s.jsx(Ab,{}),"Back"]}),s.jsxs("div",{className:"mb-6 mt-4",children:[s.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Add Entity"}),s.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Add the business or individual responsible for tax accounts and payments."})]}),s.jsx(Cb,{})]})})}function Ab(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}function Pb(e,t){const n=new URLSearchParams({entityId:String(e)});return t!==void 0&&n.set("taxYear",String(t)),de(`/portal/dashboard?${n}`)}function Eb(e,t,n){const r=new URLSearchParams({entityId:String(e),category:t,taxYear:String(n)});return de(`/portal/dashboard/summary?${r}`)}function Ib(e,t,n){const r=new URLSearchParams({entityId:String(e),month:String(t)});return n!==void 0&&r.set("year",String(n)),de(`/portal/dashboard/monthly-overview?${r}`)}function Tb({entityId:e,search:t,taxYear:n,status:r,page:a=1,pageSize:i=it}){const o=new URLSearchParams({entityId:String(e),page:String(a),pageSize:String(i)});return t&&o.set("search",t),n&&o.set("taxYear",n),r&&r!=="all"&&o.set("status",r),de(`/portal/dashboard/payments?${o}`)}function hl({entityCount:e,showPaymentActions:t=!0}){const n=ke(),{enabledPayments:r}=zn();return s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex flex-wrap gap-3",children:[t&&r.includes("federal")&&s.jsxs("button",{type:"button",onClick:()=>n("/payments/federal/new",{state:{from:"/"}}),className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700",children:[s.jsx(ma,{}),"Add Federal Payments"]}),t&&r.includes("state")&&s.jsxs("button",{type:"button",onClick:()=>n("/payments/state/new",{state:{from:"/",resetDraft:!0}}),className:"inline-flex items-center gap-2 rounded-lg border border-gov-600 bg-white px-4 py-2.5 text-sm font-semibold text-gov-600 transition hover:bg-gov-50",children:[s.jsx(ma,{}),"Add State Payment"]}),t&&s.jsxs("button",{type:"button",disabled:!0,title:"Coming soon",className:"inline-flex cursor-not-allowed items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-semibold text-slate-400",children:[s.jsx(ma,{}),"Add Local Payment",s.jsx("span",{className:"text-xs font-medium",children:"(Coming Soon)"})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsxs("button",{type:"button",onClick:()=>n("/entities"),className:"inline-flex items-center gap-1.5 rounded-[14px] border border-solid border-[#e5e7eb] bg-[#f9fafb] px-[15px] py-[9px] text-xs font-bold text-[#364153] transition hover:bg-slate-100",title:"View Entities",children:[s.jsx(_b,{}),"Entities (",e,")"]}),s.jsxs("button",{type:"button",onClick:()=>n("/create-entity/form",{state:{from:"/dashboard"}}),className:"inline-flex items-center gap-1.5 rounded-[14px] border-[1.5px] border-dashed border-[#16a34a] bg-[#f0fdf4] px-[15.5px] py-[9.5px] text-xs font-bold text-[#16a34a] transition hover:bg-green-50",children:[s.jsx(Db,{}),"Add Entity"]})]})]})}function ma(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}function _b(){return s.jsx("svg",{className:"h-[13px] w-[13px] shrink-0 text-[#364153]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z"})})}function Db(){return s.jsx("svg",{className:"h-[13px] w-[13px] shrink-0 text-[#16a34a]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zM4 19.235v-.11a6.375 6.375 0 0112.75 0v.109A12.318 12.318 0 0110.374 21c-2.356 0-4.564-.64-6.374-1.766z"})})}function Fb({title:e,description:t,buttonLabel:n,onAdd:r,comingSoon:a=!1}){return s.jsxs("article",{className:"flex flex-col rounded-2xl border border-slate-200 bg-white p-8 text-center shadow-sm",children:[s.jsx("h2",{className:"text-lg font-bold text-slate-900",children:e}),s.jsx("p",{className:"mx-auto mt-4 max-w-xs text-sm leading-relaxed text-slate-500",children:t}),a?s.jsx("span",{className:"mx-auto mt-8 inline-flex items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-5 py-2.5 text-sm font-semibold text-slate-500",children:"Coming Soon"}):s.jsxs("button",{type:"button",onClick:r,className:"mx-auto mt-8 inline-flex items-center gap-2 rounded-lg bg-gov-600 px-5 py-2.5 text-sm font-semibold text-white transition hover:bg-gov-700",children:[s.jsx(Rb,{}),n]})]})}function Rb(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}function yr({label:e="Loading…"}){return s.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-[inherit] bg-white/75","aria-live":"polite","aria-busy":"true",children:s.jsxs("div",{className:"flex items-center gap-2.5 text-sm text-slate-500",children:[s.jsx(Lb,{}),s.jsx("span",{children:e})]})})}function Lb(){return s.jsxs("svg",{className:"h-5 w-5 animate-spin text-gov-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[s.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),s.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"})]})}const $b={Draft:"Draft"};function Ob(e){switch((e??$b.Draft).trim().toLowerCase()){case"draft":case"pending":return"drafts";case"scheduled":return"scheduled";case"processing":return"submitted";case"rejected":return"rejected";case"accepted":return"paid";default:return"drafts"}}function Kr(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:e%1===0?0:2,maximumFractionDigits:2}).format(e)}function zb(e){const t=e.submitted+e.paid+e.scheduled+e.failed;return t<=0?[{color:"bg-emerald-400",width:0},{color:"bg-orange-400",width:0},{color:"bg-amber-400",width:0},{color:"bg-red-400",width:0}]:[{color:"bg-emerald-400",width:e.paid/t*100},{color:"bg-orange-400",width:e.submitted/t*100},{color:"bg-amber-400",width:e.scheduled/t*100},{color:"bg-red-400",width:e.failed/t*100}]}const Vi="drafts";function Je(){return ea(Vi)}function ea(e){return`/payments?tab=${e}`}function Su(e){return e==="failed"?"rejected":e}function Mb(e,t){return e==="draft"||t.trim().toLowerCase()==="draft"?Vi:Su(e)}const qb=["January","February","March","April","May","June","July","August","September","October","November","December"];function Bb({entityId:e,initialOverview:t,isDashboardLoading:n=!1}){const r=ke(),a=(t==null?void 0:t.year)??new Date().getFullYear(),[i,o]=v.useState(null);v.useEffect(()=>{o(null)},[e]);const l=i??(t==null?void 0:t.month)??new Date().getMonth()+1,c=i===null,{data:d,isFetching:u}=ge({queryKey:["dashboard","monthly-overview",e,i,a],queryFn:()=>Ib(e,i,a),enabled:e!==null&&i!==null,placeholderData:x=>x}),m={submitted:0,paid:0,scheduled:0,failed:0},h=c?t??m:d??m,p=n||u&&!c,g=[{key:"submitted",label:"Submitted to Fed/State",amount:h.submitted,icon:Ub,iconClassName:"rounded-xl bg-orange-50 text-orange-500",amountClassName:"text-orange-500"},{key:"paid",label:"Paid",amount:h.paid,icon:Zb,iconClassName:"rounded-full bg-emerald-50 text-emerald-600",amountClassName:"text-emerald-600"},{key:"scheduled",label:"Scheduled",amount:h.scheduled,icon:Wb,iconClassName:"rounded-xl bg-amber-50 text-amber-500",amountClassName:"text-amber-500"},{key:"failed",label:"Rejected",amount:h.failed,icon:Yb,iconClassName:"rounded-full bg-red-50 text-red-500",amountClassName:"text-red-500"}];return s.jsxs("section",{className:"relative rounded-xl border border-slate-200 bg-white p-6",children:[p?s.jsx(yr,{}):null,s.jsxs("div",{className:"mb-6 flex flex-wrap items-center gap-4",children:[s.jsx("h2",{className:"text-sm font-bold uppercase tracking-wide text-slate-500",children:"Overview of Month"}),s.jsxs("div",{className:"relative",children:[s.jsx("select",{value:l,onChange:x=>o(Number(x.target.value)),disabled:p,className:"appearance-none rounded-full border border-gov-600 bg-white py-1.5 pl-4 pr-8 text-sm font-medium text-gov-600 focus:border-gov-600 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:qb.map((x,b)=>s.jsx("option",{value:b+1,children:x},x))}),s.jsx(Vb,{className:"pointer-events-none absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-gov-600"})]})]}),s.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-4",children:g.map(x=>{const b=x.icon;return s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:`flex h-11 w-11 shrink-0 items-center justify-center ${x.iconClassName}`,children:s.jsx(b,{})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-xs leading-4 text-slate-500",children:x.label}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:[s.jsx("p",{className:`text-xl font-bold leading-7 ${x.amountClassName}`,children:Kr(x.amount)}),s.jsx("button",{type:"button",onClick:()=>r(ea(Su(x.key))),className:"text-sm font-medium text-gov-600 underline decoration-gov-600 underline-offset-2 hover:text-gov-700",children:"View Details"})]})]})]},x.key)})})]})}function Vb({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Ub(){return s.jsxs("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 14.25v-1.5M11.25 13.5h1.5"})]})}function Zb(){return s.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}function Wb(){return s.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})})}function Yb(){return s.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})})}function fl(e){return{count:e.count,submitted:e.submitted,paid:e.paid,scheduled:e.scheduled,failed:e.failed,percentDone:e.percentDone}}function Hb(e){return{id:e.id,jurisdiction:e.jurisdiction,period:e.period,amount:e.amount,paymentDate:e.paymentDate,status:e.status,statusLabel:e.statusLabel,formType:e.formType,category:e.category}}function pl(){return{count:0,submitted:0,paid:0,scheduled:0,failed:0,percentDone:0}}const Kb={primary:"bg-brand-600 text-white hover:bg-brand-700 focus-visible:ring-brand-500 disabled:bg-brand-600/60",secondary:"border border-slate-300 bg-white text-slate-700 hover:bg-slate-50 focus-visible:ring-slate-400",ghost:"text-slate-600 hover:bg-slate-100 focus-visible:ring-slate-400"};function Qb({variant:e="primary",isLoading:t=!1,className:n="",children:r,disabled:a,...i}){return s.jsx("button",{type:"button",className:`inline-flex h-10 items-center justify-center rounded-lg px-4 text-sm font-medium transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed ${Kb[e]} ${n}`,disabled:a||t,...i,children:t?"Please wait…":r})}const Jb=[10,20,50,100];function Gb(e,t){const n=e.trim();if(!/^\d+$/.test(n))return null;const r=Number(n);return!Number.isInteger(r)||r<1||r>t?null:r}function Xb(){return s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M12.5 4.5 7 10l5.5 5.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function e0(){return s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:s.jsx("path",{d:"M7.5 4.5 13 10l-5.5 5.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qr({page:e,pageSize:t,totalCount:n,onPageChange:r,onPageSizeChange:a,pageSizeOptions:i=Jb,disabled:o=!1,className:l=""}){const c=t>0?Math.max(1,Math.ceil(n/t)):1,d=n===0?0:c,u=e>1,m=d>0&&e<d,h=n===0?0:(e-1)*t+1,p=Math.min(e*t,n),[g,x]=v.useState(String(e)),b=v.useRef(g);b.current=g,v.useEffect(()=>{x(String(e))},[e]);function y(j=b.current){if(o||d===0){x(String(e));return}const S=Gb(j,d);if(S===null){x(String(e));return}if(S===e){x(String(e));return}r(S)}function C(j){j.key==="Enter"&&(j.preventDefault(),y(j.currentTarget.value))}return n===0?null:s.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 border-t border-slate-200 bg-white px-6 py-3 ${l}`,children:[s.jsxs("p",{className:"text-sm text-slate-500",children:["Showing ",s.jsx("span",{className:"font-medium text-slate-700",children:h}),"–",s.jsx("span",{className:"font-medium text-slate-700",children:p})," of ",s.jsx("span",{className:"font-medium text-slate-700",children:n})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a?s.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-600",children:[s.jsx("span",{className:"whitespace-nowrap",children:"Rows per page"}),s.jsx("select",{value:t,disabled:o,onChange:j=>a(Number(j.target.value)),className:"rounded-lg border border-slate-200 bg-white px-2 py-1.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:i.map(j=>s.jsx("option",{value:j,children:j},j))})]}):null,s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{type:"button",disabled:o||!u,onClick:()=>r(e-1),"aria-label":"Previous page",className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-700 transition hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gov-200 disabled:cursor-not-allowed disabled:text-slate-300 disabled:hover:bg-transparent",children:s.jsx(Xb,{})}),s.jsx("span",{className:"min-w-[5.5rem] text-center text-sm text-slate-600",children:d===0?"—":`Page ${e} of ${d}`}),s.jsx("button",{type:"button",disabled:o||!m,onClick:()=>r(e+1),"aria-label":"Next page",className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-700 transition hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gov-200 disabled:cursor-not-allowed disabled:text-slate-300 disabled:hover:bg-transparent",children:s.jsx(e0,{})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("label",{htmlFor:"pagination-go-to-page",className:"whitespace-nowrap text-sm text-slate-600",children:"Go to page"}),s.jsx("input",{id:"pagination-go-to-page",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:g,disabled:o||d===0,onChange:j=>x(j.target.value),onKeyDown:C,"aria-label":"Go to page number",className:"h-9 w-14 rounded-lg border border-slate-200 bg-white px-2 text-center text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60"}),s.jsx(Qb,{type:"button",variant:"secondary",disabled:o||d===0,className:"h-9 px-3",onMouseDown:j=>{j.preventDefault()},onClick:()=>y(),children:"Go"})]})]})]})}const t0=[{value:"all",label:"All"},{value:"draft",label:"Draft"},{value:"scheduled",label:"Scheduled"},{value:"paid",label:"Completed"},{value:"submitted",label:"Submitted"},{value:"failed",label:"Rejected"}],xl={total:0,page:1,pageSize:it,items:[]};function n0({label:e,status:t}){const n={draft:"bg-slate-100 text-slate-600",scheduled:"bg-amber-50 text-amber-700",paid:"bg-emerald-50 text-emerald-700",submitted:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-600"};return s.jsx("span",{className:`inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium ${n[t]}`,children:e})}function r0({entityId:e,initialPayments:t,isDashboardLoading:n=!1}){const r=ke(),[a,i]=v.useState(""),[o,l]=v.useState(""),[c,d]=v.useState(""),[u,m]=v.useState("all"),[h,p]=v.useState(1),[g,x]=v.useState(it);v.useEffect(()=>{const T=window.setTimeout(()=>l(a),300);return()=>window.clearTimeout(T)},[a]),v.useEffect(()=>{p(1)},[o,c,u,e,g]);const b=!!o||!!c||u!=="all",y=e!==null&&(b||h>1||g!==it),{data:C,isFetching:j}=ge({queryKey:["dashboard","payments",e,o,c,u,h,g],queryFn:()=>Tb({entityId:e,search:o||void 0,taxYear:c||void 0,status:u,page:h,pageSize:g}),enabled:y,placeholderData:T=>T}),S=v.useMemo(()=>y?C??xl:t&&h===1&&g===it?t:xl,[y,C,t,h,g]),I=v.useMemo(()=>S.items.map(Hb),[S.items]),F=v.useMemo(()=>{const T=new Date().getFullYear();return[T,T-1,T-2].map(String)},[]),E=n||y&&j;return s.jsxs("section",{className:"relative overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:[E?s.jsx(yr,{label:"Loading payments…"}):null,s.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-slate-200 px-6 py-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-gov-50 text-gov-600",children:s.jsx(a0,{})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-bold text-slate-900",children:"My Payments"}),s.jsxs("p",{className:"text-xs text-slate-500",children:[S.total," total payments"]})]})]})}),s.jsx("div",{className:"border-b border-slate-200 p-6",children:s.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,0.8fr)_minmax(0,0.8fr)] lg:items-end",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"payment-search",className:"mb-1.5 block text-sm text-slate-600",children:"Search by Jurisdiction/Form Type"}),s.jsxs("div",{className:"relative",children:[s.jsx(s0,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"}),s.jsx("input",{id:"payment-search",type:"text",value:a,onChange:T=>i(T.target.value),placeholder:"All",disabled:n,className:"block w-full rounded-lg border border-slate-200 bg-white py-2.5 pl-10 pr-3 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60"})]})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"tax-period-filter",className:"mb-1.5 block text-sm text-slate-600",children:"Filter by Tax Period"}),s.jsxs("div",{className:"relative",children:[s.jsxs("select",{id:"tax-period-filter",value:c,onChange:T=>d(T.target.value),disabled:n,className:"block w-full appearance-none rounded-lg border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:[s.jsx("option",{value:"",children:"Select Year"}),F.map(T=>s.jsx("option",{value:T,children:T},T))]}),s.jsx(gl,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"})]})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"status-filter",className:"mb-1.5 block text-sm text-slate-600",children:"Filter by Status"}),s.jsxs("div",{className:"relative",children:[s.jsx("select",{id:"status-filter",value:u,onChange:T=>m(T.target.value),disabled:n,className:"block w-full appearance-none rounded-lg border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:t0.map(T=>s.jsx("option",{value:T.value,children:T.label},T.value))}),s.jsx(gl,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"})]})]})]})}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[960px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[s.jsx("th",{className:"px-6 py-3",children:"ID"}),s.jsx("th",{className:"px-6 py-3",children:"Jurisdiction / Type"}),s.jsx("th",{className:"px-6 py-3",children:"Period"}),s.jsx("th",{className:"px-6 py-3",children:"Amount"}),s.jsx("th",{className:"px-6 py-3",children:"Payment"}),s.jsx("th",{className:"px-6 py-3",children:"Status"}),s.jsx("th",{className:"px-6 py-3",children:"Form Type"}),s.jsx("th",{className:"px-6 py-3",children:"Actions"})]})}),s.jsx("tbody",{children:!E&&I.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-slate-500",children:b?"No payments match your filters.":"No payments yet."})}):I.map(T=>s.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[s.jsxs("td",{className:"px-6 py-4 font-medium text-slate-900",children:["#",T.id]}),s.jsx("td",{className:"px-6 py-4 text-slate-700",children:T.jurisdiction}),s.jsx("td",{className:"px-6 py-4 text-slate-700",children:T.period}),s.jsx("td",{className:"px-6 py-4 font-medium text-slate-900",children:Kr(T.amount)}),s.jsx("td",{className:"px-6 py-4 text-slate-700",children:T.paymentDate}),s.jsx("td",{className:"px-6 py-4",children:s.jsx(n0,{label:T.statusLabel,status:T.status})}),s.jsx("td",{className:"px-6 py-4 text-slate-700",children:T.formType}),s.jsx("td",{className:"px-6 py-4",children:s.jsx("button",{type:"button",onClick:()=>r(ea(Mb(T.status,T.statusLabel))),className:"text-sm font-medium text-gov-600 hover:text-gov-700",children:"View"})})]},`${T.category}-${T.id}`))})]})}),s.jsx(Qr,{page:h,pageSize:g,totalCount:S.total,onPageChange:p,onPageSizeChange:x,disabled:E||e===null})]})}function s0({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})})}function gl({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function a0(){return s.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function ha({entityId:e,category:t,title:n,subtitlePrefix:r,defaultTaxYear:a,taxYearOptions:i,initialSummary:o,isDashboardLoading:l=!1,stats:c,comingSoon:d=!1}){const[u,m]=v.useState(a);if(v.useEffect(()=>{m(a)},[e,a]),d)return s.jsxs("article",{className:"flex min-h-[220px] flex-col rounded-2xl border border-slate-200 bg-white p-5 shadow-sm",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("h3",{className:"text-base font-bold text-slate-900",children:n}),s.jsx("p",{className:"mt-0.5 text-xs text-slate-500",children:r})]}),s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx("span",{className:"rounded-full border border-slate-200 bg-slate-50 px-4 py-2 text-sm font-semibold text-slate-500",children:"Coming Soon"})})]});const h=u===a,{data:p,isFetching:g}=ge({queryKey:["dashboard","summary",e,t,u],queryFn:()=>Eb(e,t,u),enabled:e!==null&&!h,placeholderData:C=>C}),x=h?o?fl(o):pl():p?fl(p):pl(),b=zb(x),y=l||g&&!h;return s.jsxs("article",{className:"relative flex flex-col rounded-2xl border border-slate-200 bg-white p-5 shadow-sm",children:[y?s.jsx(yr,{}):null,s.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-base font-bold text-slate-900",children:n}),s.jsxs("p",{className:"mt-0.5 text-xs text-slate-500",children:[r," (",x.count,")"]})]}),s.jsxs("div",{className:"relative shrink-0",children:[s.jsx("select",{value:u,onChange:C=>m(Number(C.target.value)),disabled:y,className:"appearance-none rounded-lg border border-slate-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-slate-700 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:i.map(C=>s.jsxs("option",{value:C,children:["TY ",C]},C))}),s.jsx(i0,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400"})]})]}),s.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:c.map(C=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:`h-2 w-2 rounded-full ${C.dotClassName}`}),s.jsx("span",{className:"text-xs text-slate-500",children:C.label})]}),s.jsx("p",{className:"mt-1 text-sm font-semibold text-slate-900",children:Kr(x[C.key])})]},C.label))}),s.jsxs("div",{className:"mt-5",children:[s.jsx("div",{className:"flex h-2 overflow-hidden rounded-full bg-slate-100",children:b.map((C,j)=>C.width>0?s.jsx("span",{className:`${C.color} h-full`,style:{width:`${C.width}%`}},j):null)}),s.jsxs("p",{className:"mt-2 text-xs font-medium text-slate-600",children:[x.percentDone,"% done"]})]})]})}function i0({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}const o0={federal:"Schedule federal tax deposits directly to the IRS — EFTPS payments, 941, 940, and more.",state:"Submit state tax remittances to the relevant state authority on time, every time.",local:"Local tax payment support is coming soon. Stay tuned for updates."},l0=[{key:"federal",title:"Add Your First Federal Payment",buttonLabel:"Add Federal Payment"},{key:"state",title:"Add Your First State Payment",buttonLabel:"Add State Payment"},{key:"local",title:"Add Your First Local Payment",buttonLabel:"Add Local Payments"}],rn=new Date().getFullYear(),fa=[rn,rn-1,rn-2],c0=[{label:"Submitted to IRS",key:"submitted",dotClassName:"bg-orange-400"},{label:"Paid",key:"paid",dotClassName:"bg-emerald-400"},{label:"Scheduled",key:"scheduled",dotClassName:"bg-amber-400"},{label:"Rejected",key:"failed",dotClassName:"bg-red-400"}],u0=[{label:"Submitted to State",key:"submitted",dotClassName:"bg-orange-400"},{label:"Paid",key:"paid",dotClassName:"bg-emerald-400"},{label:"Scheduled",key:"scheduled",dotClassName:"bg-amber-400"},{label:"Rejected",key:"failed",dotClassName:"bg-red-400"}],d0=[{label:"Submitted",key:"submitted",dotClassName:"bg-orange-400"},{label:"Paid",key:"paid",dotClassName:"bg-emerald-400"},{label:"Scheduled",key:"scheduled",dotClassName:"bg-amber-400"},{label:"Rejected",key:"failed",dotClassName:"bg-red-400"}];function Ui(){const e=ke(),{entities:t,selectedEntity:n,enabledPayments:r}=zn(),a=(n==null?void 0:n.entityId)??null,{data:i,isLoading:o}=ge({queryKey:["dashboard",a,rn],queryFn:()=>Pb(a,rn),enabled:a!==null});return!o&&i&&!i.hasPayments?s.jsxs("div",{className:"space-y-6",children:[s.jsx(hl,{entityCount:t.length,showPaymentActions:!1}),s.jsx("div",{className:"grid gap-6 sm:grid-cols-2 xl:grid-cols-3",children:l0.filter(l=>l.key==="local"||r.includes(l.key)).map(l=>s.jsx(Fb,{title:l.title,description:o0[l.key],buttonLabel:l.buttonLabel,onAdd:l.key==="federal"?()=>e("/payments/federal/new",{state:{from:"/dashboard"}}):l.key==="state"?()=>e("/payments/state/new",{state:{from:"/dashboard",resetDraft:!0}}):void 0,comingSoon:l.key==="local"},l.key))})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsx(hl,{entityCount:t.length}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2 xl:grid-cols-3",children:[r.includes("federal")&&s.jsx(ha,{entityId:a,category:"federal",title:"Federal Payments",subtitlePrefix:"IRS & Federal agencies",defaultTaxYear:rn,taxYearOptions:fa,initialSummary:i==null?void 0:i.federal,isDashboardLoading:o,stats:c0}),r.includes("state")&&s.jsx(ha,{entityId:a,category:"state",title:"All State Payments",subtitlePrefix:"State tax authorities",defaultTaxYear:rn,taxYearOptions:fa,initialSummary:i==null?void 0:i.state,isDashboardLoading:o,stats:u0}),s.jsx(ha,{entityId:a,category:"local",title:"Local Payments",subtitlePrefix:"Local tax authorities",defaultTaxYear:rn,taxYearOptions:fa,initialSummary:i==null?void 0:i.local,isDashboardLoading:o,stats:d0,comingSoon:!0})]}),s.jsx(Bb,{entityId:a,initialOverview:i==null?void 0:i.monthlyOverview,isDashboardLoading:o}),s.jsx(r0,{entityId:a,initialPayments:i==null?void 0:i.payments,isDashboardLoading:o})]})}const yl=160,m0=48,ls=8;function h0({entity:e,onEdit:t}){const n=v.useRef(null),r=v.useRef(null),[a,i]=v.useState(!1),[o,l]=v.useState({}),c=()=>{var g;const d=n.current;if(!d)return;const u=d.getBoundingClientRect(),m=((g=r.current)==null?void 0:g.offsetHeight)??m0,p=window.innerHeight-u.bottom<m+ls;l({position:"fixed",top:p?u.top-m-ls:u.bottom+ls,left:Math.max(ls,u.right-yl),width:yl,zIndex:50})};return v.useLayoutEffect(()=>{a&&(c(),requestAnimationFrame(c))},[a]),v.useEffect(()=>{if(!a)return;const d=m=>{var p,g;const h=m.target;(p=n.current)!=null&&p.contains(h)||(g=r.current)!=null&&g.contains(h)||i(!1)},u=()=>c();return document.addEventListener("mousedown",d),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{document.removeEventListener("mousedown",d),window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[a]),s.jsxs("div",{className:"inline-block text-left",children:[s.jsxs("button",{ref:n,type:"button",onClick:()=>i(d=>!d),className:"inline-flex items-center gap-1.5 rounded-lg bg-gov-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-gov-700",children:["Actions",s.jsx(f0,{})]}),a?qr.createPortal(s.jsx("div",{ref:r,style:o,className:"overflow-hidden rounded-lg border border-slate-200 bg-white py-1 shadow-lg",children:s.jsx("button",{type:"button",onClick:()=>{i(!1),t(e)},className:"block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-50",children:"Edit"})}),document.body):null]})}function f0(){return s.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})}function p0(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 21h18M5 21V6a1 1 0 011-1h4a1 1 0 011 1v15m0 0V3a1 1 0 011-1h4a1 1 0 011 1v18M9 9h.01M9 12h.01M9 15h.01"})})}function x0(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}function ku({open:e,entity:t,onClose:n}){var H,U,Z,ie,G,W,we,Ae,Le,ce,pe,L,fe;const r=pt(),[a,i]=v.useState(null),[o,l]=v.useState(!1),{register:c,handleSubmit:d,watch:u,reset:m,setValue:h,getValues:p,formState:{errors:g}}=Lt({resolver:Ot(ju),defaultValues:ml(t),shouldUnregister:!1}),x=u("accountType"),b=u("entityType"),y=x==="Individual"?yu:gu,C=x==="Individual"?"SSN":"EIN",j=u("country"),S=u("state"),I=u("zipCode"),F=j==="United States",E=qi(j),T=S.length>0&&I.trim().length>0&&!cr(E,S,I),O=c("phoneNumber"),V=c("zipCode");v.useEffect(()=>{S&&E.length>0&&!E.some(z=>z.code===S)&&h("state","")},[j,E]);const Q=z=>{const ue=p("accountType");if(ue===z)return;const Te=p("lastName");wu(ue,z,h,Te),h("accountType",z),queueMicrotask(()=>{h("lastName",Te),h("firstName",""),ue==="Business"&&z==="Individual"&&h("tradeName","")})};v.useEffect(()=>{if(e){const z=ml(t);m(z),i(null)}},[t,e,m]),v.useEffect(()=>{if(!e)return;const z=ue=>{ue.key==="Escape"&&n()};return document.addEventListener("keydown",z),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",z),document.body.style.overflow=""}},[e,n]),v.useEffect(()=>{y.includes(b)||h("entityType",x==="Individual"?"Sole Proprietorship":"LLP")},[x,b,y,h]);const X=d(async z=>{if(i(null),!cr(E,z.state,z.zipCode)){i(`ZIP code does not match the selected state (${z.state}).`);return}l(!0);try{await rf(t.entityId,wb(z)),await r.invalidateQueries({queryKey:["entities","mine"]}),n()}catch(ue){i(nt(ue,"Unable to update entity. Please try again."))}finally{l(!1)}});return e?qr.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[s.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:n}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edit-entity-title",className:"relative z-10 flex max-h-[90vh] w-full max-w-4xl flex-col overflow-hidden rounded-2xl bg-white shadow-xl",children:[s.jsxs("div",{className:"border-b border-slate-200 px-6 py-5",children:[s.jsx("h2",{id:"edit-entity-title",className:"text-lg font-bold text-slate-900",children:"Edit Entity"}),s.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Update your entity profile details."})]}),s.jsxs("form",{onSubmit:X,noValidate:!0,className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs("div",{className:"overflow-y-auto px-6 py-6",children:[a?s.jsx("div",{className:"mb-5",children:s.jsx(zt,{message:a})}):null,s.jsx("input",{type:"hidden",...c("ein")}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ts,{step:1,title:"Basic Information",subtitle:"Enter the primary details for this entity.",children:[s.jsx(cu,{label:"Account Type",required:!0,value:x,onChange:Q,options:[{label:"Business",value:"Business",icon:s.jsx(p0,{})},{label:"Individual",value:"Individual",icon:s.jsx(x0,{})}]}),s.jsx("div",{className:"grid gap-5 sm:grid-cols-2",children:x==="Individual"?s.jsxs(s.Fragment,{children:[s.jsx(he,{label:"First name",required:!0,maxLength:100,placeholder:"Enter first name",error:(H=g.firstName)==null?void 0:H.message,...c("firstName")},"entity-first-name"),s.jsx(he,{label:"Last name",required:!0,maxLength:100,placeholder:"Enter last name",error:(U=g.lastName)==null?void 0:U.message,...c("lastName")},"entity-last-name")]}):s.jsxs(s.Fragment,{children:[s.jsx(he,{label:"Business Name",required:!0,maxLength:150,placeholder:"Enter business name",error:(Z=g.lastName)==null?void 0:Z.message,...c("lastName")},"entity-business-name"),s.jsx(he,{label:"Trade Name, if any",maxLength:150,placeholder:"Enter trade name (optional)",error:(ie=g.tradeName)==null?void 0:ie.message,...c("tradeName")},"entity-trade-name")]})}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:C,required:!0,readOnly:!0,value:Hr(t.idNumber,x),className:"cursor-default bg-[#F9FAFB] text-slate-700"}),s.jsx(xn,{label:"Entity Type",required:!0,error:(G=g.entityType)==null?void 0:G.message,...c("entityType"),children:y.map(z=>s.jsx("option",{value:z,children:z},z))})]}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:"Email ID",required:!0,type:"email",maxLength:254,placeholder:"sample@mail.com",error:(W=g.email)==null?void 0:W.message,...c("email")}),s.jsx(uu,{required:!0,error:(we=g.phoneNumber)==null?void 0:we.message,countryCodeSelectProps:c("countryCode"),phoneInputProps:{placeholder:"Enter 10-digit phone number",maxLength:10,...O,onChange:z=>{z.target.value=z.target.value.replace(/\D/g,"").slice(0,10),O.onChange(z)}}})]})]}),s.jsxs(Ts,{step:2,title:"Address Information",subtitle:"Enter the registered address.",children:[s.jsx(he,{label:"Address Line 1",required:!0,maxLength:200,placeholder:"Enter address line 1",error:(Ae=g.address1)==null?void 0:Ae.message,...c("address1")}),s.jsx(he,{label:"Address Line 2",maxLength:200,placeholder:"Enter address line 2 (optional)",error:(Le=g.address2)==null?void 0:Le.message,...c("address2")}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:"City",required:!0,maxLength:100,placeholder:"Enter city",error:(ce=g.city)==null?void 0:ce.message,...c("city")}),s.jsxs(xn,{label:F?"State":"Province",required:!0,error:(pe=g.state)==null?void 0:pe.message,...c("state"),children:[s.jsx("option",{value:"",children:F?"Select state":"Select province"}),E.map(z=>s.jsx("option",{value:z.code,children:z.name},z.code))]})]}),s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:F?"ZIP Code":"Postal Code",required:!0,maxLength:10,placeholder:F?"12345 or 12345-6789":"A1A 1A1",error:((L=g.zipCode)==null?void 0:L.message)??(T?`ZIP code does not match the selected state (${S}).`:void 0),...V,onChange:z=>{z.target.value=F?Mi(z.target.value):vu(z.target.value),V.onChange(z)}}),s.jsxs(xn,{label:"Country",required:!0,error:(fe=g.country)==null?void 0:fe.message,...c("country"),children:[s.jsx("option",{value:"United States",children:"United States"}),s.jsx("option",{value:"Canada",children:"Canada"})]})]})]})]})]}),s.jsx(du,{className:"px-6",onCancel:n,isSubmitting:o,submitLabel:"Save Changes",submittingLabel:"Saving…"})]})]})]}),document.body):null}function Zi(){const{selectedEntity:e}=zn(),t=ke(),[n,r]=v.useState(""),[a,i]=v.useState(""),[o,l]=v.useState(1),[c,d]=v.useState(it),[u,m]=v.useState(null);v.useEffect(()=>{const j=window.setTimeout(()=>i(n.trim()),300);return()=>window.clearTimeout(j)},[n]),v.useEffect(()=>{l(1)},[a,c]);const{data:h,isLoading:p,isFetching:g,isError:x}=ge({queryKey:["entities","mine","paged",a,o,c],queryFn:()=>bi({search:a||void 0,pageNumber:o,pageSize:c}),placeholderData:j=>j}),b=(h==null?void 0:h.items)??[],y=(h==null?void 0:h.totalCount)??0,C=g;return s.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[s.jsxs("button",{type:"button",onClick:()=>t("/dashboard"),className:"inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-sm font-medium text-slate-600 transition hover:bg-white hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#156bd5]",children:[s.jsx(y0,{}),"Back"]}),s.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>t("/create-entity/form",{state:{from:"/entities"}}),className:"inline-flex shrink-0 items-center gap-2 rounded-[14px] bg-[#156bd5] px-4 py-2 text-sm font-semibold text-white transition hover:bg-[#1260be]",children:[s.jsx(b0,{}),"Add Entity"]}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"text-[11px] font-semibold text-[#6a7282]",children:"Search by Entity Name/Email/EIN"}),s.jsx("input",{type:"search",value:n,onChange:j=>r(j.target.value),placeholder:"All",className:"h-9.5 w-55 rounded-lg border-2 border-slate-400 bg-[#f9fafb] px-3 text-sm text-slate-700 placeholder-[#99a1af] focus:border-[#156bd5] focus:outline-none"})]})]}),u?s.jsx(ku,{open:!0,entity:u,onClose:()=>m(null)}):null,s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-black/[0.12] bg-white",children:[C?s.jsx(yr,{label:"Loading organizations…"}):null,s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"min-w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#f8f9fb]",children:[s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"Entity Name"}),s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"EIN / SSN"}),s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"Email"}),s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"Phone"}),s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"Business Type"}),s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"Status"}),s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"Joined Date"}),s.jsx("th",{className:"border-b border-[#e0e0e0] px-4 py-3 text-left text-[11px] font-bold tracking-wide text-[#374151]",children:"Action"})]})}),s.jsx("tbody",{children:p&&!h?s.jsx("tr",{children:s.jsx("td",{colSpan:8,className:"py-10 text-center text-sm text-slate-400",children:"Loading organizations…"})}):x?s.jsx("tr",{children:s.jsx("td",{colSpan:8,className:"py-10 text-center text-sm text-slate-400",children:"Unable to load organizations."})}):b.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:8,className:"py-10 text-center text-sm text-slate-400",children:a?"No organizations match your search.":"No organizations yet."})}):b.map(j=>s.jsx(g0,{entity:j,isSelected:j.entityId===(e==null?void 0:e.entityId),onEdit:m},j.entityId))})]})}),s.jsx(Qr,{page:o,pageSize:c,totalCount:y,onPageChange:l,onPageSizeChange:d,disabled:p||g})]})]})}function g0({entity:e,isSelected:t,onEdit:n}){var l;const r=en(e),a=Oi(r),i=((l=e.status)==null?void 0:l.toLowerCase())==="active",o=e.createdAt?new Date(e.createdAt).toISOString().slice(0,10):"—";return s.jsxs("tr",{className:["border-b border-[#e0e0e0] last:border-b-0 transition-colors",t?"bg-[#f0f7ff]":"hover:bg-slate-50"].join(" "),children:[s.jsx("td",{className:"px-4 py-2.5",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[10px] bg-[#156bd5] text-[11px] font-bold text-white",children:a}),s.jsx("span",{className:"font-semibold text-[#1e2939] text-[13px]",children:r})]})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:"font-mono text-[12px] text-[#374151]",children:Hr(e.idNumber,e.accountType)})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:"text-[12px] text-[#374151]",children:e.email||"—"})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:"text-[12px] text-[#374151]",children:e.phoneNumber||"—"})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:"text-[12px] text-[#374151]",children:e.entityType||"—"})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:["inline-flex items-center rounded-full px-2 py-0.5 text-[11px]",i?"bg-[#e1f6da] text-[#010d1d]":"bg-[#feeceb] text-[#010d1d]"].join(" "),children:i?"Active":"In-active"})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:"text-[12px] text-[#374151]",children:o})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx(h0,{entity:e,onEdit:n})})]})}function y0(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}function b0(){return s.jsx("svg",{className:"h-[15px] w-[15px]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}function Wi(e){return de(`/portal/federal-payments/${e}`)}function v0(e){return de(`/portal/federal-payments/form-types?entityId=${e}`)}function j0(e){const t=new URLSearchParams({formType:e});return de(`/portal/federal-payments/tax-type-codes?${t.toString()}`)}function Yi(e){return de("/portal/federal-payments",{method:"POST",body:e})}function Hi(e,t){return de(`/portal/federal-payments/${e}`,{method:"PATCH",body:t})}function w0(e){return de(`/portal/federal-payments/${e}/submit`,{method:"POST"})}function N0(e){return Ur(`/portal/federal-payments/${e}/pdf`,{responseType:"blob"})}function S0(e){return Ur(`/portal/state-payments/${e}/pdf`,{responseType:"blob"})}function k0(e){return Ur(`/portal/federal-payments/${e}/pdf-html`,{responseType:"text"})}function C0(e){return Ur(`/portal/state-payments/${e}/pdf-html`,{responseType:"text"})}function A0({entityId:e,status:t,category:n="all",pageNumber:r=1,pageSize:a=it}){const i=new URLSearchParams({entityId:String(e),pageNumber:String(r),pageSize:String(a)});return t&&i.set("status",t),n&&n!=="all"?i.set("category",n):n==="all"&&i.set("category","all"),de(`/portal/remittance-payments?${i}`)}function P0(e,t="all"){const n=new URLSearchParams({entityId:String(e)});return t&&n.set("category",t),de(`/portal/remittance-payments/status-counts?${n}`)}function E0(e){return de("/portal/state-payments/states",{signal:e})}function I0(e,t,n){const r=new URLSearchParams({entityId:String(e),state:t});return de(`/portal/state-payments/payment-reasons?${r}`,{signal:n})}function T0(e,t,n,r){const a=new URLSearchParams({entityId:String(e),state:t,reason:n});return de(`/portal/state-payments/validation-metadata?${a}`,{signal:r})}function _0(e,t,n,r){const a=new URLSearchParams({entityId:String(e),state:t,reason:n});return de(`/portal/state-payments/form-references?${a}`,{signal:r})}function Cu(e){return de(`/portal/state-payments/${e}`)}function D0(e){return de("/portal/state-payments",{method:"POST",body:e})}function F0(e,t){return de(`/portal/state-payments/${e}`,{method:"PATCH",body:t})}function R0(e){return de(`/portal/state-payments/${e}/submit`,{method:"POST"})}function L0({open:e,title:t,html:n,isLoading:r=!1,error:a=null,downloadFileName:i="payment.pdf",onDownload:o,onClose:l}){const[c,d]=v.useState(!1);v.useEffect(()=>{if(!e)return;const m=h=>{h.key==="Escape"&&l()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,l]);const u=async()=>{if(!(!o||c)){d(!0);try{const m=await o(),h=URL.createObjectURL(m),p=document.createElement("a");p.href=h,p.download=i,document.body.appendChild(p),p.click(),document.body.removeChild(p),setTimeout(()=>URL.revokeObjectURL(h),1e3)}finally{d(!1)}}};return e?s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[s.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:l}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"payment-pdf-title",className:"relative flex h-[90vh] w-full max-w-5xl flex-col overflow-hidden rounded-2xl bg-white shadow-xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-slate-200 px-5 py-4",children:[s.jsx("h2",{id:"payment-pdf-title",className:"text-base font-semibold text-slate-900",children:t}),s.jsxs("div",{className:"flex items-center gap-2",children:[o?s.jsx("button",{type:"button",onClick:()=>void u(),disabled:c||r||!!a,className:"rounded-lg border border-gov-200 bg-gov-50 px-3 py-1.5 text-sm font-medium text-gov-600 hover:bg-gov-100 disabled:opacity-60",children:c?"Downloading…":"Download"}):null,s.jsx("button",{type:"button",onClick:l,className:"rounded-lg border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 hover:bg-slate-50",children:"Close"})]})]}),s.jsx("div",{className:"flex-1 overflow-hidden bg-white",children:r?s.jsx("div",{className:"flex h-full items-center justify-center text-sm text-slate-500",children:"Loading…"}):a?s.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-red-600",children:a}):n?s.jsx("iframe",{title:t,srcDoc:n,sandbox:"",className:"h-full w-full border-0 bg-white"}):s.jsx("div",{className:"flex h-full items-center justify-center text-sm text-slate-500",children:"No content available."})})]})]}):null}function pa({onViewPdf:e,isViewPdfLoading:t}){return s.jsx("button",{type:"button",onClick:e,disabled:t,className:"rounded-lg border border-gov-200 bg-gov-50 px-4 py-1.5 text-sm font-medium text-gov-600 hover:bg-gov-100 disabled:opacity-60",children:t?"Loading…":"View PDF"})}function $0({actionType:e,onView:t,onViewPdf:n,onEdit:r,onSubmit:a,isSubmitting:i=!1,isViewPdfLoading:o=!1}){return e==="draft-actions"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{type:"button",onClick:t,className:"text-sm font-medium text-gov-600 hover:text-gov-700",children:"View"}),s.jsx("button",{type:"button",onClick:r,className:"text-sm font-medium text-gov-600 hover:text-gov-700",children:"Edit"}),s.jsx("button",{type:"button",onClick:a,disabled:i,className:"rounded-lg bg-gov-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-gov-700 disabled:opacity-60",children:i?"Submitting…":"Submit"})]}):e==="view-pdf"?s.jsx(pa,{onViewPdf:n,isViewPdfLoading:o}):e==="rejected-actions"?s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{type:"button",onClick:t,className:"text-sm font-medium text-gov-600 hover:text-gov-700",children:"View"}),s.jsx(pa,{onViewPdf:n,isViewPdfLoading:o}),s.jsx("button",{type:"button",className:"rounded-lg border border-red-200 bg-red-50 px-3 py-1.5 text-xs font-semibold text-red-600 hover:bg-red-100",children:"Re-Submit"})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{type:"button",onClick:t,className:"text-sm font-medium text-gov-600 hover:text-gov-700",children:"View"}),s.jsx(pa,{onViewPdf:n,isViewPdfLoading:o})]})}function O0(e){if(!(e!=null&&e.trim()))return"—";const t=/^(\d{4})-Q([1-4])$/.exec(e);if(t)return`Q${t[2]} ${t[1]}`;if(/^(Q[1-4]|ANNUAL|MONTHLY|ACCOUNT_ASSIGNED)$/i.test(e))return e.toUpperCase()==="ACCOUNT_ASSIGNED"?"Assigned schedule":e.toUpperCase();if(e.length!==6)return e;const n=e.slice(0,4),r=Number.parseInt(e.slice(4,6),10);return Number.isNaN(r)||r<1||r>12?e:`Q${Math.ceil(r/3)} ${n}`}function z0(e){return{id:e.id,category:e.category,referenceNo:e.referenceNumber??"—",jurisdiction:e.jurisdiction,period:O0(e.taxPeriod),amount:e.amount,paymentDate:e.paymentDate,status:e.status,reason:e.reason,tab:Ob(e.status)}}function M0({className:e,...t}){return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[s.jsx("path",{d:"M9.375 1.25H3.75C3.41848 1.25 3.10054 1.3817 2.86612 1.61612C2.6317 1.85054 2.5 2.16848 2.5 2.5V12.5C2.5 12.8315 2.6317 13.1495 2.86612 13.3839C3.10054 13.6183 3.41848 13.75 3.75 13.75H11.25C11.5815 13.75 11.8995 13.6183 12.1339 13.3839C12.3683 13.1495 12.5 12.8315 12.5 12.5V4.375L9.375 1.25Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M8.75 1.25V3.75C8.75 4.08152 8.8817 4.39946 9.11612 4.63388C9.35054 4.8683 9.66848 5 10 5H12.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M6.25 5.625H5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M10 8.125H5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M10 10.625H5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function q0({className:e,...t}){return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[s.jsxs("g",{clipPath:"url(#scheduled-tab-icon-clip)",children:[s.jsx("path",{d:"M7.5 13.75C10.9518 13.75 13.75 10.9518 13.75 7.5C13.75 4.04822 10.9518 1.25 7.5 1.25C4.04822 1.25 1.25 4.04822 1.25 7.5C1.25 10.9518 4.04822 13.75 7.5 13.75Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M7.5 3.75V7.5L10 8.75",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"scheduled-tab-icon-clip",children:s.jsx("rect",{width:"15",height:"15",fill:"white"})})})]})}function B0({className:e,...t}){return s.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:s.jsx("path",{d:"M0 10V0L11.875 5L0 10ZM1.25 8.125L8.65625 5L1.25 1.875V4.0625L5 5L1.25 5.9375V8.125Z",fill:"currentColor"})})}function V0({className:e,...t}){return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[s.jsxs("g",{clipPath:"url(#rejected-tab-icon-clip)",children:[s.jsx("path",{d:"M7.5 13.75C10.9518 13.75 13.75 10.9518 13.75 7.5C13.75 4.04822 10.9518 1.25 7.5 1.25C4.04822 1.25 1.25 4.04822 1.25 7.5C1.25 10.9518 4.04822 13.75 7.5 13.75Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M7.5 5V7.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M7.5 10H7.50625",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"rejected-tab-icon-clip",children:s.jsx("rect",{width:"15",height:"15",fill:"white"})})})]})}function U0({className:e,...t}){return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[s.jsxs("g",{clipPath:"url(#paid-tab-icon-clip)",children:[s.jsx("path",{d:"M7.5 13.75C10.9518 13.75 13.75 10.9518 13.75 7.5C13.75 4.04822 10.9518 1.25 7.5 1.25C4.04822 1.25 1.25 4.04822 1.25 7.5C1.25 10.9518 4.04822 13.75 7.5 13.75Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M5.625 7.5L6.875 8.75L9.375 6.25",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),s.jsx("defs",{children:s.jsx("clipPath",{id:"paid-tab-icon-clip",children:s.jsx("rect",{width:"15",height:"15",fill:"white"})})})]})}const Au=[{key:"drafts",label:"DRAFTS",Icon:M0,iconClassName:"text-gray-500"},{key:"scheduled",label:"SCHEDULED",Icon:q0,iconClassName:"text-yellow-500"},{key:"submitted",label:"SUBMITTED TO FED/STATE",Icon:B0,iconClassName:"text-[#FF733D]"},{key:"rejected",label:"REJECTED",Icon:V0,iconClassName:"text-red-500"},{key:"paid",label:"PAID",Icon:U0,iconClassName:"text-green-500"}],Z0={drafts:{columns:["ID","Jurisdiction / Type","Period","Amount","Payment Date","Actions"],emptyMessage:"No draft payments to display yet.",actionType:"draft-actions"},scheduled:{columns:["Reference No","Jurisdiction / Type","Period","Amount","Scheduled Date","Actions"],emptyMessage:"No scheduled payments to display yet.",actionType:"view-pdf"},submitted:{columns:["Reference No","Jurisdiction / Type","Period","Amount","Submitted Date","Actions"],emptyMessage:"No submitted to fed/state payments to display yet.",actionType:"view-link"},rejected:{columns:["Reference No","Jurisdiction / Type","Period","Amount","Rejected Date","Reason","Actions"],emptyMessage:"No rejected payments to display yet.",actionType:"rejected-actions"},paid:{columns:["Reference No","Jurisdiction / Type","Period","Amount","Actions"],emptyMessage:"No paid payments to display yet.",actionType:"view-link"}};function bl(e){return e!==null&&Au.some(t=>t.key===e)}function Ki({paymentsMode:e="all"}){var pe;const t=ke(),n=pt(),[r]=Qm(),{selectedEntity:a}=ft(),{onPaymentRequired:i}=zn(),o=(a==null?void 0:a.entityId)??null,l=r.get("tab"),[c,d]=v.useState(bl(l)?l:Vi),[u,m]=v.useState(e==="all"?"all":e),h=e!=="all"?e:u,[p,g]=v.useState(1),[x,b]=v.useState(it),[y,C]=v.useState(null),[j,S]=v.useState(null),[I,F]=v.useState(null);v.useEffect(()=>{bl(l)&&d(l)},[l]),v.useEffect(()=>{g(1),b(it)},[c,o,u]),v.useEffect(()=>{g(1)},[x]);const E=Z0[c],T=ge({queryKey:["remittance-payments","list",o,c,h,p,x],queryFn:()=>A0({entityId:o,status:c,category:h,pageNumber:p,pageSize:x}),enabled:o!==null,placeholderData:L=>L}),O=ge({queryKey:["remittance-payments","status-counts",o,h],queryFn:()=>P0(o,h),enabled:o!==null}),V=T.isLoading,Q=T.isFetching,X=o!==null&&Q,H=v.useMemo(()=>{var L,fe,z,ue,Te;return{drafts:((L=O.data)==null?void 0:L.drafts)??0,scheduled:((fe=O.data)==null?void 0:fe.scheduled)??0,submitted:((z=O.data)==null?void 0:z.submitted)??0,rejected:((ue=O.data)==null?void 0:ue.rejected)??0,paid:((Te=O.data)==null?void 0:Te.paid)??0}},[O.data]),U=v.useMemo(()=>{var L;return(((L=T.data)==null?void 0:L.items)??[]).map(z0)},[T.data]),Z=((pe=T.data)==null?void 0:pe.totalCount)??0,ie=Mh({mutationFn:async L=>{try{L.category==="federal"?await w0(L.id):await R0(L.id)}catch(fe){if(fe instanceof xr&&fe.status===402&&i){const z=fe.extensions,ue={paymentType:(z==null?void 0:z.paymentType)??L.category,paymentId:(z==null?void 0:z.paymentId)??L.id,expectedAmount:(z==null?void 0:z.expectedAmount)??"0.00",currency:(z==null?void 0:z.currency)??"USD",federalRecordCount:(z==null?void 0:z.federalRecordCount)??0,stateRecordCount:(z==null?void 0:z.stateRecordCount)??0,feePerFederal:(z==null?void 0:z.feePerFederal)??null,feePerState:(z==null?void 0:z.feePerState)??null};i(ue);return}throw fe}},onSuccess:async()=>{await n.invalidateQueries({queryKey:["remittance-payments"]}),await n.invalidateQueries({queryKey:["dashboard"]}),await n.invalidateQueries({queryKey:["federal-payments"]}),await n.invalidateQueries({queryKey:["state-payments"]})},onError:()=>C(null),onSettled:()=>C(null)});v.useEffect(()=>{const L=async()=>{await n.invalidateQueries({queryKey:["remittance-payments"]}),await n.invalidateQueries({queryKey:["dashboard"]}),await n.invalidateQueries({queryKey:["federal-payments"]}),await n.invalidateQueries({queryKey:["state-payments"]})};return window.addEventListener(ai,L),()=>window.removeEventListener(ai,L)},[n]);const G=L=>{C(`${L.category}-${L.id}`),ie.mutate(L)},W=L=>{L.category==="federal"?t(`/payments/federal/${L.id}/view`):t(`/payments/state/${L.id}/view`)},we=L=>{L.category==="federal"?t(`/payments/federal/${L.id}/edit`):t(`/payments/state/${L.id}/edit`)},Ae=async L=>{const fe=`${L.category}-${L.id}`,z=`payment-${L.referenceNo}.pdf`;S(fe),F({title:`Payment PDF — ${L.referenceNo}`,html:null,category:L.category,paymentId:L.id,downloadFileName:z,isLoading:!0,error:null});try{const ue=L.category==="federal"?await k0(L.id):await C0(L.id);F({title:`Payment PDF — ${L.referenceNo}`,html:ue,category:L.category,paymentId:L.id,downloadFileName:z,isLoading:!1,error:null})}catch(ue){F({title:`Payment PDF — ${L.referenceNo}`,html:null,category:L.category,paymentId:L.id,downloadFileName:z,isLoading:!1,error:nt(ue,"Unable to load payment PDF.")})}finally{S(null)}},Le=async()=>{if(!I)throw new Error("No payment selected");return I.category==="federal"?N0(I.paymentId):S0(I.paymentId)},ce=()=>F(null);return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"flex flex-wrap gap-3",children:[e!=="state"&&s.jsxs("button",{type:"button",onClick:()=>t("/payments/federal/new",{state:{from:"/payments"}}),className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700",children:[s.jsx(xa,{}),"Add Federal Payment"]}),e!=="federal"&&s.jsxs("button",{type:"button",onClick:()=>t("/payments/state/new",{state:{from:"/payments",resetDraft:!0}}),className:"inline-flex items-center gap-2 rounded-lg border border-gov-600 bg-white px-4 py-2.5 text-sm font-semibold text-gov-600 transition hover:bg-gov-50",children:[s.jsx(xa,{}),"Add State Payment"]}),e==="all"&&s.jsxs("button",{type:"button",disabled:!0,title:"Coming soon",className:"inline-flex cursor-not-allowed items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-semibold text-slate-400",children:[s.jsx(xa,{}),"Add Local Payments",s.jsx("span",{className:"text-xs font-medium",children:"(Coming Soon)"})]})]}),s.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:[X?s.jsx(yr,{label:"Loading payments…"}):null,s.jsx("div",{className:"flex flex-wrap gap-1 border-b border-slate-200 px-4 pt-4",children:Au.map(L=>{const fe=c===L.key,z=L.Icon;return s.jsxs("button",{type:"button",onClick:()=>{d(L.key),t(ea(L.key),{replace:!0})},className:`mb-[-1px] flex items-center gap-2 border-b-2 px-4 py-3 text-xs font-semibold tracking-wide transition ${fe?"border-gov-600 text-gov-600":"border-transparent text-slate-500 hover:text-slate-700"}`,children:[s.jsx(z,{className:`shrink-0 ${L.iconClassName}`}),L.label," (",H[L.key],")"]},L.key)})}),s.jsxs("div",{className:"border-b border-slate-200 px-6 py-4",children:[s.jsx("label",{className:"mb-1.5 block text-sm text-slate-600",children:"Select Payment Type"}),s.jsxs("select",{value:u,onChange:L=>m(L.target.value),disabled:e!=="all",className:"w-full max-w-xs rounded-lg border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:[s.jsx("option",{value:"all",children:"All"}),s.jsx("option",{value:"federal",children:"Federal"}),s.jsx("option",{value:"state",children:"State"}),s.jsx("option",{value:"local",disabled:!0,children:"Local (Coming Soon)"})]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[800px] text-left text-sm",children:[s.jsx("thead",{children:s.jsx("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-xs font-semibold uppercase tracking-wide text-slate-500",children:E.columns.map(L=>s.jsx("th",{className:"px-6 py-3",children:L},L))})}),s.jsx("tbody",{children:V&&!T.data?s.jsx("tr",{children:s.jsx("td",{colSpan:E.columns.length,className:"px-6 py-12 text-center text-slate-500",children:"Loading payments…"})}):U.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:E.columns.length,className:"px-6 py-12 text-center text-slate-500",children:E.emptyMessage})}):U.map(L=>s.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[s.jsx("td",{className:"px-6 py-4 font-medium text-slate-900",children:c==="drafts"?`#${L.id}`:L.referenceNo}),s.jsx("td",{className:"px-6 py-4 text-slate-700",children:L.jurisdiction}),s.jsx("td",{className:"px-6 py-4 text-slate-700",children:L.period}),s.jsx("td",{className:"px-6 py-4 font-medium text-slate-900",children:Kr(L.amount)}),c!=="paid"?s.jsx("td",{className:"px-6 py-4 text-slate-700",children:L.paymentDate}):null,c==="rejected"?s.jsx("td",{className:"px-6 py-4 text-slate-700",children:L.reason??"—"}):null,s.jsx("td",{className:"px-6 py-4",children:s.jsx($0,{actionType:E.actionType,onView:()=>W(L),onViewPdf:()=>Ae(L),onEdit:()=>we(L),onSubmit:()=>G(L),isSubmitting:y===`${L.category}-${L.id}`,isViewPdfLoading:j===`${L.category}-${L.id}`})})]},`${L.category}-${L.id}`))})]})}),s.jsx(Qr,{page:p,pageSize:x,totalCount:Z,onPageChange:g,onPageSizeChange:b,disabled:V||o===null||Q})]}),s.jsx(L0,{open:I!==null,title:(I==null?void 0:I.title)??"Payment PDF",html:(I==null?void 0:I.html)??null,downloadFileName:I==null?void 0:I.downloadFileName,isLoading:(I==null?void 0:I.isLoading)??!1,error:(I==null?void 0:I.error)??null,onDownload:I&&!I.error?Le:void 0,onClose:ce})]})}function xa(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}function Jr({entityId:e,pageNumber:t=1,pageSize:n=it}){const r=new URLSearchParams({entityId:String(e),pageNumber:String(t),pageSize:String(n)});return de(`/portal/bank-accounts?${r}`)}function W0(e){return de("/portal/bank-accounts",{method:"POST",body:e})}function Pu(e,t){return de(`/portal/bank-accounts/${e}`,{method:"PATCH",body:t})}function wn({title:e,children:t,isFirst:n=!1,headerAction:r}){return s.jsxs("section",{className:n?"":"mt-8 border-t border-slate-100 pt-8",children:[s.jsxs("div",{className:"mb-5 flex flex-wrap items-center justify-between gap-3",children:[s.jsx("h3",{className:"text-base font-semibold text-gov-600",children:e}),r]}),t]})}const ur=17,Eu=9;function Yn(e,t){return e.replace(/\D/g,"").slice(0,t)}const Iu=["Checking","Savings"],Y0=Xt({accountNumber:_().min(1,"Account number is required").regex(/^\d{1,17}$/,`Account number must be 1 to ${ur} digits`),confirmAccountNumber:_().min(1,"Please confirm the account number").regex(/^\d{1,17}$/,`Account number must be 1 to ${ur} digits`),routingNumber:_().min(1,"Routing number is required").regex(/^\d{9}$/,"Routing number must be exactly 9 digits"),accountType:Xs(Iu,{message:"Account type is required"}),bankName:_().min(1,"Bank name is required")}).refine(e=>e.accountNumber===e.confirmAccountNumber,{message:"Account numbers do not match",path:["confirmAccountNumber"]});function H0({entityId:e,onCancel:t,onSuccess:n}){const r=pt(),{showSuccess:a,showError:i}=Vs(),[o,l]=v.useState(null),[c,d]=v.useState(!1),{control:u,handleSubmit:m,formState:{errors:h}}=Lt({resolver:Ot(Y0),defaultValues:{accountNumber:"",confirmAccountNumber:"",routingNumber:"",accountType:"Checking",bankName:""}}),p=m(async g=>{l(null),d(!0);try{const x=await W0({entityId:e,bankName:g.bankName.trim(),accountNumber:g.accountNumber,routingNumber:g.routingNumber,accountType:g.accountType});await r.invalidateQueries({queryKey:["bank-accounts",e]}),a("Bank Account Added","Bank account added successfully."),n(x.bankAccountDetailId)}catch(x){const b=nt(x,"Unable to save bank account.");l(b),i("Action Not Completed",b)}finally{d(!1)}});return s.jsxs("form",{noValidate:!0,onSubmit:g=>{g.preventDefault(),g.stopPropagation(),p(g)},className:"space-y-6",children:[s.jsxs(lu,{step:2,title:"Add Bank Account Manually",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-slate-400",children:"Bank Account"}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsx(Ne,{name:"accountNumber",control:u,render:({field:g})=>{var x;return s.jsx(he,{label:"Account Number",required:!0,placeholder:"Bank account number",inputMode:"numeric",autoComplete:"off",value:g.value,onChange:b=>g.onChange(Yn(b.target.value,ur)),onBlur:g.onBlur,error:(x=h.accountNumber)==null?void 0:x.message})}}),s.jsx(Ne,{name:"confirmAccountNumber",control:u,render:({field:g})=>{var x;return s.jsx(he,{label:"Confirm Account Number",required:!0,placeholder:"Re-enter account number",inputMode:"numeric",autoComplete:"off",value:g.value,onChange:b=>g.onChange(Yn(b.target.value,ur)),onBlur:g.onBlur,error:(x=h.confirmAccountNumber)==null?void 0:x.message})}}),s.jsx(Ne,{name:"routingNumber",control:u,render:({field:g})=>{var x;return s.jsx(he,{label:"Routing Number",required:!0,placeholder:"9-digit ABA",inputMode:"numeric",autoComplete:"off",value:g.value,onChange:b=>g.onChange(Yn(b.target.value,Eu)),onBlur:g.onBlur,error:(x=h.routingNumber)==null?void 0:x.message})}}),s.jsx(Ne,{name:"accountType",control:u,render:({field:g})=>{var x;return s.jsx(xn,{label:"Account Type",required:!0,value:g.value,onChange:g.onChange,onBlur:g.onBlur,error:(x=h.accountType)==null?void 0:x.message,children:Iu.map(b=>s.jsx("option",{value:b,children:b},b))})}})]}),s.jsx(Ne,{name:"bankName",control:u,render:({field:g})=>{var x;return s.jsx(he,{label:"Account / Bank Name",required:!0,placeholder:"e.g. Chase Bank",value:g.value,onChange:g.onChange,onBlur:g.onBlur,error:(x=h.bankName)==null?void 0:x.message})}})]}),o?s.jsx(zt,{message:o}):null,s.jsxs("div",{className:"flex flex-wrap gap-3",children:[s.jsx("button",{type:"button",onClick:t,disabled:c,className:"inline-flex h-11 items-center justify-center rounded-lg border border-slate-200 bg-white px-6 text-sm font-semibold text-slate-700 transition hover:bg-slate-50 disabled:opacity-60",children:"Cancel"}),s.jsx("button",{type:"button",disabled:c,onClick:()=>void p(),className:"inline-flex h-11 items-center justify-center rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:opacity-60",children:c?"Saving…":"Save"})]})]})}function Tu({open:e,entityId:t,onClose:n,onAccountAdded:r}){const[a,i]=v.useState("choose");if(v.useEffect(()=>{e||i("choose")},[e]),v.useEffect(()=>{if(!e)return;const l=c=>{c.key==="Escape"&&n()};return document.addEventListener("keydown",l),()=>{document.removeEventListener("keydown",l)}},[e,n]),!e)return null;const o=a==="manual";return s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[s.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:n}),s.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"add-bank-account-title",className:`relative w-full rounded-3xl bg-white p-8 shadow-xl ${o?"max-w-2xl":"max-w-[420px]"}`,children:o&&t?s.jsx(H0,{entityId:t,onCancel:()=>i("choose"),onSuccess:l=>{r==null||r(l),n()}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gov-600 text-sm font-semibold text-white",children:"1"}),s.jsx("h2",{id:"add-bank-account-title",className:"text-sm font-medium uppercase tracking-[0.2em] text-slate-400",children:"Add Bank Account"})]}),s.jsx("div",{className:"my-6 h-px bg-slate-200"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("button",{type:"button",onClick:()=>i("manual"),disabled:!t,className:"flex w-full items-center gap-4 rounded-full border border-slate-200 px-5 py-4 text-left transition hover:border-slate-300 hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gov-600 text-white",children:s.jsx(K0,{className:"h-5 w-5"})}),s.jsx("span",{className:"text-base font-semibold text-slate-900",children:"Add Manually"})]}),s.jsxs("button",{type:"button",disabled:!0,title:"Coming soon",className:"flex w-full cursor-not-allowed items-center gap-4 rounded-full border border-slate-200 px-5 py-4 text-left opacity-60",children:[s.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-lg border border-slate-200 bg-white",children:s.jsx(Q0,{className:"h-6 w-6"})}),s.jsx("span",{className:"text-base font-medium text-slate-400",children:"Connect with Plaid"})]})]})]})})]})}function K0({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5h10.5M6.75 12h10.5m-10.5 4.5h10.5M3.75 6.75A2.25 2.25 0 016 3.75h12A2.25 2.25 0 0120.25 6.75v10.5A2.25 2.25 0 0118 21H6A2.25 2.25 0 013.75 18.75V6.75z"})})}function Q0({className:e}){return s.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[s.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1",fill:"#111827"}),s.jsx("rect",{x:"13",y:"3",width:"8",height:"8",rx:"1",fill:"#111827"}),s.jsx("rect",{x:"3",y:"13",width:"8",height:"8",rx:"1",fill:"#111827"}),s.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"1",fill:"#111827",opacity:"0.35"})]})}const J0=12,G0=["January","February","March","April","May","June","July","August","September","October","November","December"];function fn(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function _s(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const n=Number.parseInt(t[1],10),r=Number.parseInt(t[2],10)-1,a=Number.parseInt(t[3],10),i=new Date(n,r,a);return i.getFullYear()!==n||i.getMonth()!==r||i.getDate()!==a?null:i}function _u(e=new Date){const t=new Date(e);return e.getHours()>=J0&&t.setDate(t.getDate()+1),t.setHours(0,0,0,0),fn(t)}function Du(e=new Date){const t=new Date(e);return t.setFullYear(t.getFullYear()+1),t.setHours(0,0,0,0),fn(t)}function X0(e=18,t=new Date){const n=new Date(t);return n.setFullYear(n.getFullYear()-e),n.setHours(0,0,0,0),fn(n)}function ev(e,t,n=new Date){const r=_s(e);if(!r)return!1;const a=new Date(n);return a.setFullYear(a.getFullYear()-t),a.setHours(0,0,0,0),r.setHours(0,0,0,0),r<=a}function tv(e){const t=e.getDay();return t!==0&&t!==6}function ei(e,t=new Date){if(!tv(e))return!1;const n=fn(e);return n>=_u(t)&&n<=Du(t)}function ta(e,t=new Date){const n=_s(e);return n?ei(n,t):!1}function nv(e,t){return`${G0[t]} ${e}`}function rv(e,t){const n=new Date(e,t,1),r=new Date(e,t+1,0).getDate(),a=n.getDay(),i=[];for(let o=0;o<a;o+=1)i.push(null);for(let o=1;o<=r;o+=1)i.push(new Date(e,t,o));return i}function vl(e){return`******${e.replace(/\D/g,"").slice(-4)||e.slice(-4)}`}function Gr(e){const t=Number.parseFloat(e);return!e||Number.isNaN(t)?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(t)}function Fu({label:e,required:t=!1,htmlFor:n,info:r}){return s.jsxs("label",{htmlFor:n,className:"mb-1.5 flex items-center gap-1.5 text-sm text-slate-600",children:[s.jsxs("span",{children:[e,t?s.jsx("span",{className:"text-red-500",children:" *"}):null]}),r?s.jsxs("span",{className:"group relative inline-flex items-center",children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 cursor-help items-center justify-center rounded-full border border-slate-300 text-[10px] font-semibold leading-none text-slate-400","aria-label":r,role:"img",children:"i"}),s.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-20 mb-1.5 w-max max-w-xs -translate-x-1/2 rounded-md bg-slate-800 px-2.5 py-1.5 text-xs font-normal leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100",children:r})]}):null]})}function J({label:e,required:t,error:n,info:r,children:a}){return s.jsxs("div",{children:[s.jsx(Fu,{label:e,required:t,info:r}),a,n?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:n}):null]})}const Ru=e=>`block w-full rounded-lg border bg-white px-3 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 ${e?"border-red-300":"border-slate-200"}`;function ne(e,t=!1){return t?`block w-full cursor-default rounded-lg border bg-[#F9FAFB] px-3 py-2.5 text-sm text-slate-700 focus:outline-none ${e?"border-red-300":"border-[#E5E7EB]"}`:Ru(e)}function Hn(e){return`${Ru(e)} appearance-none`}function Un({className:e}){return s.jsx("svg",{className:e??"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Tr({children:e}){return s.jsx("div",{className:"relative",children:e})}function Lu({value:e,onChange:t,entityId:n,bankAccounts:r,isLoading:a=!1,disabled:i=!1,error:o,label:l="Bank Account Number",info:c}){const[d,u]=v.useState(!1),[m,h]=v.useState(!1),p=v.useRef(null),g=r.find(b=>String(b.bankAccountDetailId)===e);v.useEffect(()=>{if(!d)return;const b=y=>{var C;(C=p.current)!=null&&C.contains(y.target)||u(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[d]);const x=b=>{t(String(b)),h(!1),u(!1)};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{ref:p,className:"relative",children:[s.jsx(Fu,{label:l,required:!0,info:c}),s.jsxs("button",{type:"button",disabled:i||!n,onClick:()=>u(b=>!b),className:`flex w-full items-center justify-between rounded-lg border bg-white px-3 py-2.5 text-left text-sm transition focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:cursor-not-allowed disabled:opacity-60 ${o?"border-red-300":"border-slate-200"}`,children:[s.jsx("span",{className:g?"text-slate-900":"text-slate-400",children:a?"Loading accounts…":g?vl(g.accountNumber):"Bank account number"}),s.jsx(av,{className:`shrink-0 text-slate-400 transition ${d?"rotate-180":""}`})]}),o?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:o}):null,d?s.jsxs("div",{className:"absolute left-0 right-0 z-20 mt-2 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-lg",children:[s.jsx("div",{className:"p-3",children:s.jsxs("button",{type:"button",onClick:()=>{u(!1),h(!0)},className:"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white transition hover:bg-gov-700",children:[s.jsx(sv,{}),"Add Bank Account"]})}),s.jsx("div",{className:"border-t border-slate-200 px-4 py-2",children:s.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-400",children:"List of Bank Accounts"})}),s.jsx("div",{className:"max-h-64 overflow-y-auto pb-2",children:r.length===0?s.jsx("p",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No bank accounts yet."}):r.map(b=>{const y=String(b.bankAccountDetailId)===e;return s.jsxs("button",{type:"button",onClick:()=>{t(String(b.bankAccountDetailId)),u(!1)},className:`flex w-full items-center gap-3 px-4 py-3 text-left transition hover:bg-slate-50 ${y?"bg-gov-50":""}`,children:[s.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-gov-600 text-xs font-semibold text-white",children:Oi(b.bankName)}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-sm font-semibold text-slate-900",children:b.bankName}),s.jsxs("span",{className:"block truncate text-xs text-slate-500",children:[vl(b.accountNumber)," · ",b.accountType]})]})]},b.bankAccountDetailId)})})]}):null]}),s.jsx(Tu,{open:m,entityId:n,onClose:()=>h(!1),onAccountAdded:x})]})}function sv(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}function av({className:e=""}){return s.jsx("svg",{className:`h-4 w-4 ${e}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function iv(e){const t=e.address2?`, ${e.address2}`:"";return`${e.address1}${t}, ${e.city}, ${e.state} ${e.zipCode}`}function Xr({entity:e,remittanceAmount:t="—",className:n=""}){if(!e)return s.jsxs("aside",{className:`overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm ${n}`,children:[s.jsx("div",{className:"bg-[#7F95B0] px-5 py-3.5 text-xs font-semibold uppercase tracking-wider text-white",children:"Entity Details"}),s.jsx("div",{className:"p-5 text-sm text-slate-500",children:"No entity selected."})]});const r=en(e);return s.jsxs("aside",{className:`overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm ${n}`,children:[s.jsx("div",{className:"bg-[#7F95B0] px-5 py-3.5 text-xs font-semibold uppercase tracking-wider text-white",children:"Entity Details"}),s.jsxs("dl",{className:"space-y-4 p-5 text-sm",children:[s.jsx(Sr,{label:"Entity Name",value:r}),s.jsx(Sr,{label:e.accountType==="Individual"?"SSN":"Tax ID",value:Hr(e.idNumber,e.accountType)}),s.jsx(Sr,{label:"Email ID",value:e.email}),s.jsx(Sr,{label:"Phone Number",value:Ln(e.phoneNumber)}),s.jsx(Sr,{label:"Address",value:iv(e)})]}),s.jsxs("div",{className:"border-t border-slate-100 px-5 py-4",children:[s.jsx("p",{className:"text-sm font-medium text-[#99A1AF]",children:"Remittance Amount"}),s.jsx("p",{className:"mt-1.5 text-xl font-bold text-gov-600",children:t})]})]})}function Sr({label:e,value:t}){return s.jsxs("div",{children:[s.jsx("dt",{className:"text-sm font-medium text-slate-500",children:e}),s.jsx("dd",{className:"mt-0.5 text-sm leading-relaxed text-slate-800",children:t})]})}const ov=[0,1,3,4,6,7,9,10],lv=[0,1,2,3,4,5,6,7,8,9,10],cv=[0,1,2,3,4,5,6,8,9,10,11],uv=[0,1,2,3,4,5,6,7,9,10,11],dv=["720","941"],mv=["706-GS (D)","706-GS (T)","926","940","943","944","945","1042","2438","3520","6069","8752","CT-1"],hv=["7200D"],fv=["8963"];function $u(e){return dv.includes(e)?ov:mv.includes(e)?lv:hv.includes(e)?cv:fv.includes(e)?uv:[]}function pv(e){return e.length!==6?"":`${e.slice(0,4)}-${e.slice(4,6)}`}function Ds(e){if(e.length!==6)return null;const t=Number.parseInt(e.slice(0,4),10),n=Number.parseInt(e.slice(4,6),10);return Number.isNaN(t)||Number.isNaN(n)||n<1||n>12?null:{year:t,month:n-1}}function xv(e,t){return`${e}${String(t+1).padStart(2,"0")}`}function Ou(){const e=new Date().getFullYear();return{minYear:e-2,maxYear:e}}const Fs={941:"94105",944:"94405","CT-1":"10005"},kr={socialSecurity:"Social Security",medicare:"Medicare",withheld:"Withheld",tier1:"Tier 1(FICA)",tier2:"Tier 2 (Industry)"},Rs={regex:/^(?!0+(?:\.0+)?$)(?:100000000(?:\.00?)?|(?:\d{1,8}|\d{1,7}\d)(?:\.\d{1,2})?)$/,errorMessage:"Payment amount must be a number greater than 0, can include up to 2 decimal places, and must not exceed 100,000,000 (one hundred million)."};function Qi(e,t){return!e||!t?!1:Fs[e]===t}function na(e,t){return e==="CT-1"&&t===Fs["CT-1"]}function gv(e,t){return e==="941"&&t===Fs[941]||e==="944"&&t===Fs[944]}function yv(e){return e==="CT-1"?{code1:kr.tier1,code2:kr.tier2,code3:""}:{code1:kr.socialSecurity,code2:kr.medicare,code3:kr.withheld}}function Ls(e){return Rs.regex.test(e)}const bv=/^(?:\d{0,8}(?:\.\d{0,2})?|100000000(?:\.\d{0,2})?)$/,cs=1e8;function vv(e){if(!e)return"";let t="",n=!1;for(const c of e)c>="0"&&c<="9"?t+=c:c==="."&&!n&&(t+=c,n=!0);const r=t.indexOf(".");let a=r===-1?t:t.slice(0,r);const i=r===-1?"":t.slice(r+1,r+3),o=r!==-1&&t.endsWith(".");if(a.length>9&&(a=a.slice(0,9)),a.length===9&&a!=="100000000"&&(a=a.slice(0,8)),a.length>0&&!o&&i===""){const c=Number.parseInt(a,10);!Number.isNaN(c)&&c>cs&&(a=String(cs))}let l=r===-1?a:`${a}.${i}`;if(o&&(l=`${a}.`),bv.test(l)){if(!l.endsWith(".")&&l!==""){const c=Number.parseFloat(l);if(!Number.isNaN(c)&&c>cs)return String(cs)}return l}return""}function zu(e){return Ls(e)?Number.parseFloat(e):null}function jv(e,t,n,r){const a=[e,t];return r&&a.push(n),a.reduce((i,o)=>{const l=zu(o);return l===null?i:i+l},0)}function wv(e,t){return Math.abs(e-t)<.005}function Nv(e,t,n,r,a){if(!Qi(e,t))return{subcategoryCode1:null,subcategoryCode2:null,subcategoryCode3:null};const i=na(e,t);return{subcategoryCode1:n.trim()?"1":null,subcategoryCode2:r.trim()?"2":null,subcategoryCode3:!i&&a.trim()?"3":null}}const Sv=["Su","Mo","Tu","We","Th","Fr","Sa"];function kv(){return s.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2",className:"stroke-gov-600",strokeWidth:"1.5"}),s.jsx("path",{d:"M3 9h18",className:"stroke-gov-600",strokeWidth:"1.5"}),s.jsx("path",{d:"M8 3v4M16 3v4",className:"stroke-gov-600",strokeWidth:"1.5",strokeLinecap:"round"}),s.jsx("circle",{cx:"12",cy:"15",r:"1.5",className:"fill-gov-600"})]})}function Mu({value:e,onChange:t,disabled:n=!1,hasError:r=!1}){const a=_s(e),i=_u(),o=Du(),[l,c]=v.useState(!1),[d,u]=v.useState(()=>a??_s(i)??new Date),m=v.useRef(null),h=v.useId();v.useEffect(()=>{a&&u(a)},[e]),v.useEffect(()=>{if(!l)return;const y=C=>{var j;(j=m.current)!=null&&j.contains(C.target)||c(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]);const p=v.useMemo(()=>rv(d.getFullYear(),d.getMonth()),[d]),g=v.useMemo(()=>{const y=new Date(d.getFullYear(),d.getMonth()-1,1),C=new Date(y.getFullYear(),y.getMonth()+1,0);return fn(C)>=i},[d,i]),x=v.useMemo(()=>{const y=new Date(d.getFullYear(),d.getMonth()+1,1);return fn(y)<=o},[d,o]),b=y=>{ei(y)&&(t(fn(y)),c(!1))};return s.jsxs("div",{ref:m,className:"relative",children:[s.jsxs("div",{className:`flex items-center gap-2 rounded-lg border bg-white px-3 py-2.5 transition ${r?"border-red-300":"border-slate-200 focus-within:border-gov-400 focus-within:ring-2 focus-within:ring-gov-200"} ${n?"cursor-not-allowed bg-[#F9FAFB] opacity-60":""}`,children:[s.jsx("input",{id:h,type:"text",readOnly:!0,disabled:n,value:e,placeholder:"YYYY-MM-DD",onClick:()=>!n&&c(y=>!y),className:"w-full cursor-pointer border-0 bg-transparent p-0 text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-0 disabled:cursor-not-allowed"}),s.jsx("button",{type:"button",disabled:n,onClick:()=>c(y=>!y),className:"shrink-0 rounded p-0.5 text-gov-600 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open settlement date picker",children:s.jsx(kv,{})})]}),l?s.jsxs("div",{className:"absolute left-0 top-[calc(100%+8px)] z-50 w-[300px] rounded-xl border border-slate-200 bg-white shadow-lg",children:[s.jsx("div",{className:"absolute -top-2 left-8 h-4 w-4 rotate-45 border-l border-t border-slate-200 bg-white"}),s.jsxs("div",{className:"flex items-center justify-between rounded-t-xl bg-slate-50 px-4 py-3",children:[s.jsx("button",{type:"button",disabled:!g,onClick:()=>u(y=>new Date(y.getFullYear(),y.getMonth()-1,1)),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Previous month",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),s.jsx("span",{className:"text-sm font-semibold text-slate-900",children:nv(d.getFullYear(),d.getMonth())}),s.jsx("button",{type:"button",disabled:!x,onClick:()=>u(y=>new Date(y.getFullYear(),y.getMonth()+1,1)),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Next month",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),s.jsx("div",{className:"grid grid-cols-7 gap-1 px-3 pt-2 text-center text-xs font-medium text-slate-500",children:Sv.map(y=>s.jsx("div",{className:"py-1",children:y},y))}),s.jsx("div",{className:"grid grid-cols-7 gap-1 p-3 pt-1",children:p.map((y,C)=>{if(!y)return s.jsx("div",{},`empty-${C}`);const j=fn(y),S=e===j,I=!ei(y);return s.jsx("button",{type:"button","aria-disabled":I,onClick:()=>b(y),className:`rounded-lg px-1 py-2 text-sm transition ${I?"cursor-not-allowed text-slate-300 hover:bg-sky-50":S?"bg-sky-100 font-semibold text-slate-900":"font-medium text-slate-800 hover:bg-slate-50"}`,children:y.getDate()},j)})})]}):null]})}function Er({value:e,onChange:t,onBlur:n,name:r,disabled:a=!1,readOnly:i=!1,placeholder:o="0.00",hasError:l=!1}){return s.jsx("input",{type:"text",inputMode:"decimal",autoComplete:"off",name:r,value:e,disabled:a,readOnly:i,placeholder:o,className:ne(l,i),onChange:c=>t(vv(c.target.value)),onBlur:n})}const Cv=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Av(){return s.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2",className:"stroke-gov-600",strokeWidth:"1.5"}),s.jsx("path",{d:"M3 9h18",className:"stroke-gov-600",strokeWidth:"1.5"}),s.jsx("path",{d:"M8 3v4M16 3v4",className:"stroke-gov-600",strokeWidth:"1.5",strokeLinecap:"round"}),s.jsx("circle",{cx:"12",cy:"15",r:"1.5",className:"fill-gov-600"})]})}function Pv({value:e,onChange:t,disabled:n=!1,hasError:r=!1,disabledMonths:a=[]}){const{minYear:i,maxYear:o}=Ou(),l=Ds(e),[c,d]=v.useState(!1),[u,m]=v.useState((l==null?void 0:l.year)??o),h=v.useRef(null),p=v.useId();v.useEffect(()=>{l&&m(l.year)},[e]),v.useEffect(()=>{if(!c)return;const j=S=>{var I;(I=h.current)!=null&&I.contains(S.target)||d(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[c]);const g=pv(e),x=j=>!!a.includes(j),b=j=>{x(j)||(t(xv(u,j)),d(!1))},y=u>i,C=u<o;return s.jsxs("div",{ref:h,className:"relative",children:[s.jsxs("div",{className:`flex items-center gap-2 rounded-lg border bg-white px-3 py-2.5 transition ${r?"border-red-300":"border-slate-200 focus-within:border-gov-400 focus-within:ring-2 focus-within:ring-gov-200"} ${n?"cursor-not-allowed bg-[#F9FAFB] opacity-60":""}`,children:[s.jsx("input",{id:p,type:"text",readOnly:!0,disabled:n,value:g,placeholder:"YYYY-MM",onClick:()=>!n&&d(j=>!j),className:"w-full cursor-pointer border-0 bg-transparent p-0 text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-0 disabled:cursor-not-allowed"}),s.jsx("button",{type:"button",disabled:n,onClick:()=>d(j=>!j),className:"shrink-0 rounded p-0.5 text-gov-600 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open tax period picker",children:s.jsx(Av,{})})]}),c?s.jsxs("div",{className:"absolute left-0 top-[calc(100%+8px)] z-50 w-[280px] rounded-xl border border-slate-200 bg-white shadow-lg",children:[s.jsx("div",{className:"absolute -top-2 left-8 h-4 w-4 rotate-45 border-l border-t border-slate-200 bg-white"}),s.jsxs("div",{className:"flex items-center justify-between rounded-t-xl bg-slate-50 px-4 py-3",children:[s.jsx("button",{type:"button",disabled:!y,onClick:()=>m(j=>j-1),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Previous year",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),s.jsx("span",{className:"text-sm font-semibold text-slate-900",children:u}),s.jsx("button",{type:"button",disabled:!C,onClick:()=>m(j=>j+1),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Next year",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),s.jsx("div",{className:"grid grid-cols-3 gap-1 p-3",children:Cv.map((j,S)=>{const I=(l==null?void 0:l.year)===u&&l.month===S&&e.length===6,F=x(S);return s.jsx("button",{type:"button","aria-disabled":F,onClick:()=>b(S),className:`rounded-lg px-2 py-2.5 text-sm transition ${F?"cursor-not-allowed text-slate-300 hover:bg-sky-50":I?"bg-sky-100 font-semibold text-slate-900":"font-medium text-slate-800 hover:bg-slate-50"}`,children:j},j)})})]}):null]})}const qu="Active",Ev="Inactive";function br(e){return(e.status??qu).trim().toLowerCase()==="active"}function Iv(e){return br(e)?Ev:qu}function Tv(e){return br(e)?"Deactivate":"Activate"}function Ji(e){var t;return((t=e==null?void 0:e.accountType)==null?void 0:t.trim().toLowerCase())==="individual"}function _v(e){return Ji(e)?"/payments/federal/individual-enrollment":"/payments/federal/authorization"}function Bu(e){const t=Nv(e.taxFormType,e.taxTypeCode,e.subcategoryAmount1??"",e.subcategoryAmount2??"",e.subcategoryAmount3??""),n=na(e.taxFormType,e.taxTypeCode);return{subcategoryCode1:t.subcategoryCode1,subcategoryAmount1:e.subcategoryAmount1?Number.parseFloat(e.subcategoryAmount1):null,subcategoryCode2:t.subcategoryCode2,subcategoryAmount2:e.subcategoryAmount2?Number.parseFloat(e.subcategoryAmount2):null,subcategoryCode3:t.subcategoryCode3,subcategoryAmount3:!n&&e.subcategoryAmount3?Number.parseFloat(e.subcategoryAmount3):null}}function Gi(e,t){return{entityId:e,taxpayerPin:t.taxpayerPin||null,secondaryTin:t.secondaryTin||null,bankAccountDetailId:Number.parseInt(t.bankAccountDetailId,10),taxFormType:t.taxFormType,taxTypeCode:t.taxTypeCode,taxPeriod:t.taxPeriod,settlementDate:t.settlementDate,paymentAmount:Number.parseFloat(t.paymentAmount),...Bu(t)}}function Xi(e){return{taxpayerPin:e.taxpayerPin||null,secondaryTin:e.secondaryTin||null,bankAccountDetailId:Number.parseInt(e.bankAccountDetailId,10),taxFormType:e.taxFormType,taxTypeCode:e.taxTypeCode,taxPeriod:e.taxPeriod,settlementDate:e.settlementDate,paymentAmount:Number.parseFloat(e.paymentAmount),...Bu(e)}}const eo="federal-payment-draft";function to(e){sessionStorage.setItem(eo,JSON.stringify(e))}function ra(){const e=sessionStorage.getItem(eo);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function no(){sessionStorage.removeItem(eo)}function Dv(e,t={}){return{federalPaymentId:e.federalPaymentId,enrollmentId:e.enrollmentId,taxpayerPin:e.taxpayerPin??"",secondaryTin:e.secondaryTin??"",bankAccountDetailId:e.bankAccountDetailId?String(e.bankAccountDetailId):"",routingNumber:t.routingNumber??"",accountNumber:t.accountNumber??"",accountType:t.accountType??"",bankName:t.bankName??"",taxFormType:e.taxFormType,taxTypeCode:e.taxTypeCode,taxPeriod:e.taxPeriod,settlementDate:e.settlementDate,paymentAmount:String(e.paymentAmount),subcategoryAmount1:e.subcategoryAmount1!=null?String(e.subcategoryAmount1):"",subcategoryAmount2:e.subcategoryAmount2!=null?String(e.subcategoryAmount2):"",subcategoryAmount3:e.subcategoryAmount3!=null?String(e.subcategoryAmount3):""}}const Fv=Xt({taxpayerPin:_().max(4,"Taxpayer PIN must not exceed 4 characters").optional(),secondaryTin:_().max(9,"Secondary TIN must not exceed 9 characters").optional(),bankAccountDetailId:_().min(1,"Bank account is required"),routingNumber:_().optional(),accountType:_().optional(),bankName:_().optional(),taxFormType:_().min(1,"Tax form type is required"),taxTypeCode:_().min(1,"Payment type is required"),taxPeriod:_().min(1,"This field is required").regex(/^\d{6}$/,"Tax period must be in YYYY-MM format").refine(e=>{const t=Ds(e);if(!t)return!1;const{minYear:n,maxYear:r}=Ou();return t.year>=n&&t.year<=r},"Tax period must be within the last 3 years"),settlementDate:_().min(1,"This field is required").refine(e=>ta(e),"Settlement date must be a weekday within the allowed range"),paymentAmount:_().min(1,"This field is required").refine(e=>Ls(e),Rs.errorMessage),subcategoryCode1:_().optional(),subcategoryAmount1:_().optional(),subcategoryCode2:_().optional(),subcategoryAmount2:_().optional(),subcategoryCode3:_().optional(),subcategoryAmount3:_().optional()}).superRefine((e,t)=>{var l;if(e.taxPeriod&&e.taxFormType){const c=Ds(e.taxPeriod);c&&$u(e.taxFormType).includes(c.month)&&t.addIssue({code:dt.custom,message:"Tax period must be a valid month for the selected tax form",path:["taxPeriod"]})}if(!Qi(e.taxFormType,e.taxTypeCode))return;const n=na(e.taxFormType,e.taxTypeCode),r=gv(e.taxFormType,e.taxTypeCode),a=(c,d,u)=>{if(!(c!=null&&c.trim())){u&&t.addIssue({code:dt.custom,message:"This field is required",path:[d]});return}Ls(c)||t.addIssue({code:dt.custom,message:Rs.errorMessage,path:[d]})};a(e.subcategoryAmount1,"subcategoryAmount1",!0),a(e.subcategoryAmount2,"subcategoryAmount2",!0),a(e.subcategoryAmount3,"subcategoryAmount3",r);const i=zu(e.paymentAmount),o=jv(e.subcategoryAmount1??"",e.subcategoryAmount2??"",e.subcategoryAmount3??"",r);i!==null&&!wv(i,o)&&t.addIssue({code:dt.custom,message:"Payment amount must equal the sum of subcategory amounts",path:["paymentAmount"]}),n&&((l=e.subcategoryAmount3)!=null&&l.trim())&&t.addIssue({code:dt.custom,message:"Subcategory amount 3 is not used for CT-1 payments",path:["subcategoryAmount3"]})}),us="grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3";function ga(e){return{taxpayerPin:e.taxpayerPin??"",secondaryTin:e.secondaryTin??"",bankAccountDetailId:e.bankAccountDetailId,routingNumber:e.routingNumber??"",accountType:e.accountType??"",bankName:e.bankName??"",taxFormType:e.taxFormType,taxTypeCode:e.taxTypeCode,taxPeriod:e.taxPeriod,settlementDate:e.settlementDate,paymentAmount:e.paymentAmount,subcategoryCode1:e.subcategoryCode1??"",subcategoryAmount1:e.subcategoryAmount1??"",subcategoryCode2:e.subcategoryCode2??"",subcategoryAmount2:e.subcategoryAmount2??"",subcategoryCode3:e.subcategoryCode3??"",subcategoryAmount3:e.subcategoryAmount3??""}}const Rv={taxpayerPin:"",secondaryTin:"",bankAccountDetailId:"",routingNumber:"",accountType:"",bankName:"",taxFormType:"",taxTypeCode:"",taxPeriod:"",settlementDate:"",paymentAmount:"",subcategoryCode1:"",subcategoryAmount1:"",subcategoryCode2:"",subcategoryAmount2:"",subcategoryCode3:"",subcategoryAmount3:""};function Lv(e,t,n){if(e)return ga(e);if(t!=null&&t.paymentDraft)return ga(t.paymentDraft);const r=ra();return r&&r.entityId===n?ga(r):Rv}function Vu({entity:e,initialDraft:t,readonly:n=!1,onCancel:r}){var vt,xt,jt,Mt,wt,qt,Pt,Et,It,Tt,Bt,Vt,Nt;const a=ke(),i=Se(),o=pt(),l=qn(i.state,Je()),c=i.state,d=ra(),u=t??(c==null?void 0:c.paymentDraft)??(d&&d.entityId===(e==null?void 0:e.entityId)?d:null),m=v.useRef(u==null?void 0:u.federalPaymentId),h=v.useRef(u==null?void 0:u.enrollmentId),[p,g]=v.useState(null),[x,b]=v.useState(!1),y=v.useMemo(()=>Lv(t,c,e==null?void 0:e.entityId),[t,c==null?void 0:c.paymentDraft,e==null?void 0:e.entityId,i.key]);v.useEffect(()=>{u!=null&&u.federalPaymentId&&(m.current=u.federalPaymentId),u!=null&&u.enrollmentId&&(h.current=u.enrollmentId)},[u==null?void 0:u.federalPaymentId,u==null?void 0:u.enrollmentId]);const{data:C=[],isLoading:j}=ge({queryKey:["bank-accounts",e==null?void 0:e.entityId],queryFn:async()=>(await Jr({entityId:e.entityId,pageNumber:1,pageSize:100})).items,enabled:e!==null}),S=v.useMemo(()=>C.filter(br),[C]),{data:I=[],isLoading:F}=ge({queryKey:["federal-form-types",e==null?void 0:e.entityId],queryFn:()=>v0(e.entityId),enabled:e!==null}),{register:E,control:T,handleSubmit:O,watch:V,setValue:Q,getValues:X,trigger:H,formState:{errors:U}}=Lt({resolver:Ot(Fv),defaultValues:y}),Z=V("bankAccountDetailId"),ie=V("paymentAmount"),G=V("taxFormType"),W=V("taxTypeCode"),we=V("taxPeriod"),Ae=V("settlementDate"),Le=V("subcategoryAmount1"),ce=V("subcategoryAmount2"),pe=V("subcategoryAmount3"),L=v.useRef(G),fe=v.useMemo(()=>G?$u(G):[],[G]),z=v.useMemo(()=>Qi(G,W),[G,W]),ue=v.useMemo(()=>na(G,W),[G,W]),{data:Te=[],isLoading:Ge}=ge({queryKey:["federal-tax-type-codes",G],queryFn:()=>j0(G),enabled:!!G});v.useEffect(()=>{L.current&&L.current!==G&&Q("taxTypeCode",""),L.current=G},[G,Q]),v.useEffect(()=>{if(!we||!G)return;const f=Ds(we);f&&fe.includes(f.month)&&Q("taxPeriod","")},[G,we,fe,Q]),v.useEffect(()=>{Ae&&(ta(Ae)||Q("settlementDate",""))},[Ae,Q]),v.useEffect(()=>{if(!z){Q("subcategoryCode1",""),Q("subcategoryCode2",""),Q("subcategoryCode3",""),Q("subcategoryAmount1",""),Q("subcategoryAmount2",""),Q("subcategoryAmount3","");return}const f=yv(G);Q("subcategoryCode1",f.code1),Q("subcategoryCode2",f.code2),Q("subcategoryCode3",ue?"":f.code3),ue&&Q("subcategoryAmount3","")},[z,G,ue,Q]),v.useEffect(()=>{z&&(H("paymentAmount"),H("subcategoryAmount1"),H("subcategoryAmount2"),H("subcategoryAmount3"))},[Le,ce,pe,z,H]),v.useEffect(()=>{if(j)return;const f=S.find(N=>String(N.bankAccountDetailId)===Z);if(!f){Z&&(Q("bankAccountDetailId",""),Q("routingNumber",""),Q("accountType",""),Q("bankName",""));return}Q("routingNumber",f.routingNumber),Q("accountType",f.accountType),Q("bankName",f.bankName)},[S,Z,j,Q]);const Oe=f=>{const N=S.find(A=>String(A.bankAccountDetailId)===f.bankAccountDetailId);return{federalPaymentId:m.current,enrollmentId:h.current??(u==null?void 0:u.enrollmentId),form8655AuthorizationId:u==null?void 0:u.form8655AuthorizationId,form9783EnrollmentId:u==null?void 0:u.form9783EnrollmentId,taxpayerPin:f.taxpayerPin??"",secondaryTin:f.secondaryTin??"",bankAccountDetailId:f.bankAccountDetailId,routingNumber:f.routingNumber??(N==null?void 0:N.routingNumber)??"",accountNumber:(N==null?void 0:N.accountNumber)??"",accountType:f.accountType??(N==null?void 0:N.accountType)??"",bankName:f.bankName??(N==null?void 0:N.bankName)??"",taxFormType:f.taxFormType,taxTypeCode:f.taxTypeCode,taxPeriod:f.taxPeriod,settlementDate:f.settlementDate,paymentAmount:f.paymentAmount,subcategoryCode1:f.subcategoryCode1,subcategoryAmount1:f.subcategoryAmount1,subcategoryCode2:f.subcategoryCode2,subcategoryAmount2:f.subcategoryAmount2,subcategoryCode3:f.subcategoryCode3,subcategoryAmount3:f.subcategoryAmount3}},le=async()=>{await o.invalidateQueries({queryKey:["dashboard"]}),await o.invalidateQueries({queryKey:["federal-payments"]}),await o.invalidateQueries({queryKey:["remittance-payments"]}),m.current&&o.removeQueries({queryKey:["federal-payment",m.current],exact:!0})},be=async f=>{if(!e)return null;if(f.federalPaymentId){const A=await Hi(f.federalPaymentId,Xi(f));return m.current=A.federalPaymentId,h.current=A.enrollmentId,A}const N=await Yi(Gi(e.entityId,f));return m.current=N.federalPaymentId,h.current=N.enrollmentId,N},Ye=O(async f=>{if(!(n||!e)){g(null),b(!0);try{const N=Oe(f),A=await be(N);if(!A)return;const R={...N,entityId:e.entityId,federalPaymentId:A.federalPaymentId,enrollmentId:A.enrollmentId};await le(),to(R),a(_v(e),{state:{from:l,paymentDraft:R}})}catch(N){g(nt(N,"Failed to save payment details."))}finally{b(!1)}}}),re=async()=>{if(!(!e||n)){g(null),b(!0);try{const f=Oe(X());await be(f),await le(),no(),a(Je())}catch(f){g(nt(f,"Failed to save draft."))}finally{b(!1)}}},Ve=()=>{if(r){r();return}a(l)},rt=e?en(e):"Entity";return s.jsxs("form",{onSubmit:Ye,noValidate:!0,className:"w-full space-y-6",children:[p?s.jsx(zt,{message:p}):null,s.jsxs("div",{className:"relative w-full",children:[s.jsx("h2",{className:"mb-4 text-[28px] font-bold leading-tight text-slate-900 lg:pr-[324px]",children:rt}),s.jsx(Xr,{entity:e,remittanceAmount:Gr(ie),className:"mb-4 w-full lg:absolute lg:top-0 lg:right-0 lg:mb-0 lg:w-[300px]"}),s.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:mr-[324px] lg:p-8",children:[s.jsx(wn,{title:"Enrolment Details",isFirst:!0,children:s.jsxs("div",{className:us,children:[s.jsx(J,{label:"Taxpayer PIN",required:!0,info:"The 4-digit PIN assigned by the IRS for EFTPS enrollment.",error:(vt=U.taxpayerPin)==null?void 0:vt.message,children:s.jsx("input",{placeholder:"Taxpayer PIN",className:ne(!!U.taxpayerPin),maxLength:4,disabled:n,...E("taxpayerPin")})}),s.jsx(J,{label:"Secondary TIN",info:"An additional Taxpayer Identification Number, if the payment requires one.",error:(xt=U.secondaryTin)==null?void 0:xt.message,children:s.jsx("input",{placeholder:"Secondary TIN",className:ne(!!U.secondaryTin),maxLength:9,disabled:n,...E("secondaryTin")})}),s.jsx(Ne,{name:"bankAccountDetailId",control:T,render:({field:f})=>{var N;return s.jsx(Lu,{value:f.value,onChange:f.onChange,entityId:(e==null?void 0:e.entityId)??null,bankAccounts:S,isLoading:j,disabled:!e||n,info:"Select the bank account to debit for this payment, or add a new one.",error:(N=U.bankAccountDetailId)==null?void 0:N.message})}}),s.jsx(J,{label:"Routing Number",required:!0,info:"The 9-digit bank routing number, auto-filled from the selected bank account.",error:(jt=U.routingNumber)==null?void 0:jt.message,children:s.jsx("input",{readOnly:!0,placeholder:"Routing Number",className:ne(!!U.routingNumber,!0),...E("routingNumber")})}),s.jsx(J,{label:"Account Type",required:!0,info:"The bank account type (checking or savings), auto-filled from the selected bank account.",error:(Mt=U.accountType)==null?void 0:Mt.message,children:s.jsx("input",{readOnly:!0,placeholder:"Account Type",className:ne(!!U.accountType,!0),...E("accountType")})}),s.jsx(J,{label:"Bank Name",required:!0,info:"The name of the bank, auto-filled from the selected bank account.",error:(wt=U.bankName)==null?void 0:wt.message,children:s.jsx("input",{readOnly:!0,placeholder:"Bank Name",className:ne(!!U.bankName,!0),...E("bankName")})})]})}),s.jsx(wn,{title:"Federal Payment",children:s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:us,children:[s.jsx(J,{label:"Tax Form Type",required:!0,info:"The federal tax form this payment applies to (e.g. 941, 944, CT-1).",error:(qt=U.taxFormType)==null?void 0:qt.message,children:s.jsxs(Tr,{children:[s.jsx(Ne,{name:"taxFormType",control:T,render:({field:f})=>s.jsxs("select",{className:Hn(!!U.taxFormType),disabled:F||!e||n,...f,children:[s.jsx("option",{value:"",children:F?"Loading form types…":"Select form type"}),I.map(N=>s.jsx("option",{value:N.value,children:N.value},N.value))]})}),s.jsx(Un,{})]})}),s.jsx(J,{label:"Payment Type",required:!0,info:"The type of payment for the selected tax form.",error:(Pt=U.taxTypeCode)==null?void 0:Pt.message,children:s.jsxs(Tr,{children:[s.jsx(Ne,{name:"taxTypeCode",control:T,render:({field:f})=>s.jsxs("select",{className:Hn(!!U.taxTypeCode),disabled:!G||Ge||n,...f,children:[s.jsx("option",{value:"",children:G?Ge?"Loading payment types…":"Select payment type":"Select tax form first"}),Te.map(N=>s.jsxs("option",{value:N.code,children:[N.code," - ",N.codeName]},N.code))]})}),s.jsx(Un,{})]})}),s.jsx(J,{label:"Tax Period",required:!0,info:"The tax period (month and year) this payment covers.",error:(Et=U.taxPeriod)==null?void 0:Et.message,children:s.jsx(Ne,{name:"taxPeriod",control:T,render:({field:f})=>s.jsx(Pv,{value:f.value,onChange:f.onChange,hasError:!!U.taxPeriod,disabled:!G||n,disabledMonths:fe})})})]}),s.jsxs("div",{className:"grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3",children:[s.jsx(J,{label:"Settlement Date",required:!0,info:"The weekday the payment will be withdrawn and settled with the IRS.",error:(It=U.settlementDate)==null?void 0:It.message,children:s.jsx(Ne,{name:"settlementDate",control:T,render:({field:f})=>s.jsx(Mu,{value:f.value,onChange:f.onChange,hasError:!!U.settlementDate,disabled:n})})}),s.jsx(J,{label:"Payment Amount",required:!0,info:"The total amount to remit. Must equal the sum of subcategory amounts when applicable.",error:(Tt=U.paymentAmount)==null?void 0:Tt.message,children:s.jsx(Ne,{name:"paymentAmount",control:T,render:({field:f})=>s.jsx(Er,{name:f.name,value:f.value,onChange:f.onChange,onBlur:f.onBlur,disabled:n,hasError:!!U.paymentAmount})})})]}),z?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:us,children:[s.jsx(J,{label:"Subcategory Code 1",info:"The first subcategory code for the selected tax form, set automatically.",children:s.jsx("input",{readOnly:!0,className:ne(!1,!0),...E("subcategoryCode1")})}),s.jsx(J,{label:"Subcategory Code 2",info:"The second subcategory code for the selected tax form, set automatically.",children:s.jsx("input",{readOnly:!0,className:ne(!1,!0),...E("subcategoryCode2")})}),ue?null:s.jsx(J,{label:"Subcategory Code 3",info:"The third subcategory code for the selected tax form, set automatically.",children:s.jsx("input",{readOnly:!0,className:ne(!1,!0),...E("subcategoryCode3")})})]}),s.jsxs("div",{className:us,children:[s.jsx(J,{label:"Subcategory Amount 1",required:!0,info:"The amount allocated to Subcategory Code 1.",error:(Bt=U.subcategoryAmount1)==null?void 0:Bt.message,children:s.jsx(Ne,{name:"subcategoryAmount1",control:T,render:({field:f})=>s.jsx(Er,{name:f.name,value:f.value??"",onChange:f.onChange,onBlur:f.onBlur,disabled:n,placeholder:"Enter amount",hasError:!!U.subcategoryAmount1})})}),s.jsx(J,{label:"Subcategory Amount 2",required:!0,info:"The amount allocated to Subcategory Code 2.",error:(Vt=U.subcategoryAmount2)==null?void 0:Vt.message,children:s.jsx(Ne,{name:"subcategoryAmount2",control:T,render:({field:f})=>s.jsx(Er,{name:f.name,value:f.value??"",onChange:f.onChange,onBlur:f.onBlur,disabled:n,placeholder:"Enter amount",hasError:!!U.subcategoryAmount2})})}),ue?null:s.jsx(J,{label:"Subcategory Amount 3",required:!0,info:"The amount allocated to Subcategory Code 3.",error:(Nt=U.subcategoryAmount3)==null?void 0:Nt.message,children:s.jsx(Ne,{name:"subcategoryAmount3",control:T,render:({field:f})=>s.jsx(Er,{name:f.name,value:f.value??"",onChange:f.onChange,onBlur:f.onBlur,disabled:n,placeholder:"Enter amount",hasError:!!U.subcategoryAmount3})})})]})]}):null]})})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 lg:mr-[324px]",children:[s.jsx("button",{type:"button",onClick:Ve,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50",children:n?"Back":"Cancel"}),n?null:s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:re,disabled:!e||x,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:opacity-60",children:x?"Saving…":"Save as Draft"}),s.jsx("button",{type:"submit",disabled:!e||x,className:"inline-flex h-11 min-w-[160px] items-center justify-center rounded-lg bg-gov-600 px-10 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:opacity-60",children:x?"Saving…":"Next"})]})]})]},i.key)}function Uu(){const{selectedEntity:e}=ft();return s.jsx(Vu,{entity:e})}function Zu({mode:e}){var m;const t=ke(),{federalPaymentId:n}=zs(),{selectedEntity:r}=ft(),a=Number.parseInt(n??"",10),{data:i,isLoading:o,isError:l}=ge({queryKey:["federal-payment",a],queryFn:()=>Wi(a),enabled:Number.isFinite(a)}),{data:c=[]}=ge({queryKey:["bank-accounts",r==null?void 0:r.entityId],queryFn:async()=>(await Jr({entityId:r.entityId,pageNumber:1,pageSize:100})).items,enabled:r!==null&&i!==void 0}),d=v.useMemo(()=>{if(!i)return null;const h=c.find(p=>p.bankAccountDetailId===i.bankAccountDetailId);return Dv(i,{routingNumber:h==null?void 0:h.routingNumber,accountNumber:h==null?void 0:h.accountNumber,accountType:h==null?void 0:h.accountType,bankName:h==null?void 0:h.bankName})},[i,c]);if(!Number.isFinite(a))return s.jsx(Be,{to:Je(),replace:!0});if(o)return s.jsx("p",{className:"text-sm text-slate-600",children:"Loading federal payment…"});if(l||!i||!d)return s.jsx(Be,{to:Je(),replace:!0});if(!r||i.entityId!==r.entityId)return s.jsx(Be,{to:Je(),replace:!0});const u=e==="view"||((m=i.status)==null?void 0:m.toLowerCase())!=="draft";return s.jsx(Vu,{entity:r,initialDraft:d,readonly:u,onCancel:()=>t(Je())})}function Wu(){return ft(),s.jsx(Zu,{mode:"edit"})}function Yu(){return ft(),s.jsx(Zu,{mode:"view"})}function $v(e){const t=[];return e.includes("\\d")&&t.push("0-9"),/[A-Z]/.test(e)&&t.push("A-Z"),e.includes("-")&&t.push("\\-"),e.includes(" ")&&t.push(" "),e.includes("/")&&t.push("/"),t.length?t.join(""):null}function Ov(e,t){const n=e.toUpperCase();if(!t)return n;const r=$v(t);return r?n.replace(new RegExp(`[^${r}]`,"g"),""):n}function zv(e){if(!e)return null;const t=[];let n=0;try{for(;n<e.length;){if(e.startsWith("(?:",n))return null;const r=e[n];if(r==="-"||r===" "||r==="/"){t.push({type:"separator",char:r}),n+=1;continue}let a;if(r==="\\")a=e[n+1]==="d"?"digit":"letter",n+=2;else if(r==="["){const o=e.indexOf("]",n);if(o===-1)return null;a="letter",n=o+1}else a=r>="0"&&r<="9"?"digit":"letter",n+=1;const i=Mv(e,n);if(i===null)return null;for(let o=0;o<i.count;o+=1)t.push({type:"slot",kind:a});n=i.nextIndex}}catch{return null}return t}function Mv(e,t){if(e[t]!=="{")return{count:1,nextIndex:t};const n=e.indexOf("}",t);if(n===-1)throw new Error("Unterminated quantifier");const r=e.slice(t+1,n);if(r.includes(","))return null;const a=Number.parseInt(r,10);if(Number.isNaN(a))throw new Error("Bad quantifier");return{count:a,nextIndex:n+1}}function qv(e,t){const n=e.toUpperCase().replace(/[^0-9A-Z]/g,"").split("");let r="",a=0;for(const i of t){if(a>=n.length)break;if(i.type==="separator"){r+=i.char;continue}for(;a<n.length;){const o=n[a];a+=1;const l=o>="0"&&o<="9";if(i.kind==="digit"?l:!l){r+=o;break}}}return r}function Bv(e){if(e)try{const t=Hu(e,0);return t.index===e.length?t.length:void 0}catch{return}}function Hu(e,t){let n=t,r=0;for(;;){const a=Vv(e,n);if(r=Math.max(r,a.length),n=a.index,e[n]==="|"){n+=1;continue}return{length:r,index:n}}}function Vv(e,t){let n=t,r=0;for(;n<e.length&&e[n]!=="|"&&e[n]!==")";){const a=Uv(e,n);r+=a.length,n=a.index}return{length:r,index:n}}function Uv(e,t){let n=t,r;if(e.startsWith("(?:",n)){const a=Hu(e,n+3);if(e[a.index]!==")")throw new Error("Unbalanced group");r=a.length,n=a.index+1}else if(e[n]==="\\")r=1,n+=2;else if(e[n]==="["){const a=e.indexOf("]",n);if(a===-1)throw new Error("Unterminated class");r=1,n=a+1}else r=1,n+=1;if(e[n]==="{"){const a=e.indexOf("}",n);if(a===-1)throw new Error("Unterminated quantifier");const i=e.slice(n+1,a).split(","),o=i.length===2?i[1]:i[0],l=Number.parseInt(o,10);if(Number.isNaN(l))throw new Error("Bad quantifier");r*=l,n=a+1}return{length:r,index:n}}const ro="state-payment-draft";function ti(e){sessionStorage.setItem(ro,JSON.stringify(e))}function ni(){const e=sessionStorage.getItem(ro);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Ku(){sessionStorage.removeItem(ro)}function Zv(e,t){var n,r;return{entityId:e,state:t.state,reasonForPayment:t.reasonForPayment,stateAccountId:t.stateAccountId,accountId:t.accountId,letterId:(n=t.letterId)!=null&&n.trim()?t.letterId.trim().toUpperCase():null,taxYear:t.taxYear,taxPeriod:(r=t.taxPeriod)!=null&&r.trim()?t.taxPeriod.trim():null,taxAmount:Number.parseFloat(t.taxAmount),paymentDate:t.paymentDate,bankAccountDetailId:Number.parseInt(t.bankAccountDetailId,10)}}function Wv(e){var t,n;return{state:e.state,reasonForPayment:e.reasonForPayment,stateAccountId:e.stateAccountId,accountId:e.accountId,letterId:(t=e.letterId)!=null&&t.trim()?e.letterId.trim().toUpperCase():null,taxYear:e.taxYear,taxPeriod:(n=e.taxPeriod)!=null&&n.trim()?e.taxPeriod.trim():null,taxAmount:Number.parseFloat(e.taxAmount),paymentDate:e.paymentDate,bankAccountDetailId:Number.parseInt(e.bankAccountDetailId,10)}}const Yv="Enter the letter or notice ID in this format: L1234567890 (the letter L followed by 10 digits).",jl=/^L\d{10}$/,Qu=10,Hv=Qu+1;function Kv(e){const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"");if(!t)return"";const n=t.replace(/\D/g,"").slice(0,Qu);return!n&&!t.startsWith("L")?"":`L${n}`}function Qv(e){return Xt({state:_().min(1,"State is required"),reasonForPayment:_().min(1,"Reason for payment is required"),stateAccountId:_().min(1,"State ID is required"),accountId:_().min(1,"Account ID is required").refine(t=>/^\d{10,12}$/.test(t.trim()),"Account ID must be 10 to 12 digits"),letterId:_().optional(),taxYear:_().min(1,"Tax year is required"),taxPeriod:_().optional(),taxAmount:_().min(1,"Tax amount is required").refine(t=>Ls(t),Rs.errorMessage),paymentDate:_().min(1,"Payment date is required").refine(t=>ta(t),"Payment date must be a weekday within the allowed range"),bankAccountDetailId:_().min(1,"Bank account is required"),routingNumber:_().optional(),accountType:_().optional(),bankName:_().optional()}).superRefine((t,n)=>{var d,u;const r=e(),a=r==null?void 0:r.stateId.pattern;if(a)try{new RegExp(`^(?:${a})$`).test(t.stateAccountId.trim().toUpperCase())||n.addIssue({code:dt.custom,path:["stateAccountId"],message:r.stateId.message})}catch{n.addIssue({code:dt.custom,path:["stateAccountId"],message:"State ID validation is temporarily unavailable"})}const i=((d=t.letterId)==null?void 0:d.trim().toUpperCase())??"",o=(r==null?void 0:r.letterIdRequired)??!1,l=(r==null?void 0:r.letterId.message)??Yv;if(o&&!i)n.addIssue({code:dt.custom,path:["letterId"],message:"Letter ID is required for a bill payment"});else if(i)try{(r!=null&&r.letterId.pattern?new RegExp(`^(?:${r.letterId.pattern})$`):jl).test(i)||n.addIssue({code:dt.custom,path:["letterId"],message:l})}catch{jl.test(i)||n.addIssue({code:dt.custom,path:["letterId"],message:l})}((r==null?void 0:r.taxPeriodRequired)??!0)&&!((u=t.taxPeriod)!=null&&u.trim())&&n.addIssue({code:dt.custom,path:["taxPeriod"],message:"Tax period is required"})})}const ya="grid gap-x-6 gap-y-5 sm:grid-cols-3",wl="grid gap-x-6 gap-y-5 sm:grid-cols-2",Nl="w-full rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",Sl={state:"",reasonForPayment:"",stateAccountId:"",accountId:"",letterId:"",taxYear:"",taxPeriod:"",taxAmount:"",paymentDate:"",bankAccountDetailId:"",routingNumber:"",accountType:"",bankName:""};function ba(e){return{state:e.state,reasonForPayment:Ju(e.reasonForPayment),stateAccountId:e.stateAccountId,accountId:e.accountId,letterId:e.letterId??"",taxYear:e.taxYear,taxPeriod:e.taxPeriod,taxAmount:e.taxAmount,paymentDate:e.paymentDate,bankAccountDetailId:e.bankAccountDetailId,routingNumber:e.routingNumber??"",accountType:e.accountType??"",bankName:e.bankName??""}}const Jv={MAKE_A_BILL_PAYMENT:"BILL_PAYMENT"};function Ju(e){const t=e.trim().toUpperCase().replaceAll(" ","_");return Jv[t]??t}function Gu({entity:e,initialDraft:t,readonly:n=!1,onCancel:r}){var It,Tt,Bt,Vt,Nt,f,N,A,R;const a=ke(),i=Se(),o=qn(i.state,Je()),l=i.state,c=v.useMemo(()=>t??(l==null?void 0:l.paymentDraft)??ni()??null,[t,l==null?void 0:l.paymentDraft]),d=v.useRef(c==null?void 0:c.statePaymentDetailId),u=v.useMemo(()=>{if(t)return ba(t);if(l!=null&&l.paymentDraft)return ba(l.paymentDraft);if(l!=null&&l.resetDraft)return Ku(),Sl;const k=ni();return k?ba(k):Sl},[t,l==null?void 0:l.paymentDraft,l==null?void 0:l.resetDraft,i.key]),{data:m=[],isLoading:h,isError:p}=ge({queryKey:["state-payment-states"],queryFn:({signal:k})=>E0(k)}),{data:g=[],isLoading:x}=ge({queryKey:["bank-accounts",e==null?void 0:e.entityId],queryFn:async()=>(await Jr({entityId:e.entityId,pageNumber:1,pageSize:100})).items,enabled:e!==null}),b=v.useMemo(()=>g.filter(br),[g]),y=v.useRef(null),C=v.useMemo(()=>Qv(()=>y.current),[]),{register:j,control:S,handleSubmit:I,watch:F,setValue:E,clearErrors:T,formState:{errors:O}}=Lt({resolver:Ot(C),defaultValues:u}),V=F("state"),Q=F("reasonForPayment"),X=F("taxAmount"),H=F("paymentDate"),U=F("bankAccountDetailId"),{data:Z=[],isLoading:ie,isError:G}=ge({queryKey:["state-payment-reasons",e==null?void 0:e.entityId,V],queryFn:({signal:k})=>I0(e.entityId,V,k),enabled:e!==null&&!!V}),{data:W,isLoading:we,isError:Ae}=ge({queryKey:["state-payment-validation-metadata",e==null?void 0:e.entityId,V,Q],queryFn:({signal:k})=>T0(e.entityId,V,Q,k),enabled:e!==null&&!!(V&&Q)});ge({queryKey:["state-payment-form-references",e==null?void 0:e.entityId,V,Q],queryFn:({signal:k})=>_0(e.entityId,V,Q,k),enabled:e!==null&&!!(V&&Q)}),y.current=W??null;const Le=(W==null?void 0:W.taxYearOptions)??[],ce=(W==null?void 0:W.taxPeriodOptions)??[],pe=!!(W&&V&&Q),L=(W==null?void 0:W.stateId.pattern)??null,fe=Bv(L),z=v.useMemo(()=>zv(L),[L]),ue=j("stateAccountId"),Te=j("accountId"),Ge=j("letterId"),[Oe,le]=v.useState(!1),[be,Ye]=v.useState(""),re=v.useRef(null),Ve=(It=m.find(k=>k.code===V))==null?void 0:It.name,rt=v.useMemo(()=>{const k=be.trim().toLowerCase();return k?m.filter($=>$.name.toLowerCase().includes(k)||$.code.toLowerCase().includes(k)):m},[be,m]),vt=["stateAccountId","accountId","letterId","taxYear","taxPeriod","taxAmount","paymentDate"],xt=()=>{vt.forEach(k=>E(k,"")),T([...vt,"bankAccountDetailId"])},jt=k=>{E("state",k,{shouldValidate:!0}),E("reasonForPayment",""),T("reasonForPayment"),xt(),Ye(""),le(!1)},Mt=k=>{k!==Q&&(E("reasonForPayment",k,{shouldValidate:!0}),xt())};v.useEffect(()=>{c!=null&&c.statePaymentDetailId&&(d.current=c.statePaymentDetailId)},[c==null?void 0:c.statePaymentDetailId]),v.useEffect(()=>{var k;Oe&&((k=re.current)==null||k.focus())},[Oe]),v.useEffect(()=>{if(!Q||ie||G||Z.some($=>$.code===Q))return;const k=Z.find($=>Ju($.label)===Q);E("reasonForPayment",(k==null?void 0:k.code)??"")},[ie,G,Z,Q,E]);const wt=v.useRef(!1);v.useEffect(()=>{if(!n){if(!wt.current){wt.current=!0;return}H&&!ta(H)&&E("paymentDate","")}},[H,E,n]),v.useEffect(()=>{if(n||x)return;const k=b.find($=>String($.bankAccountDetailId)===U);if(!k){U&&(E("bankAccountDetailId",""),E("routingNumber",""),E("accountType",""),E("bankName",""));return}E("routingNumber",k.routingNumber),E("accountType",k.accountType),E("bankName",k.bankName)},[b,U,E,n,x]);const qt=I(k=>{var M;if(n||!W)return;const $={statePaymentDetailId:d.current,state:k.state,reasonForPayment:k.reasonForPayment,stateAccountId:k.stateAccountId.trim().toUpperCase(),accountId:k.accountId.trim(),letterId:(M=k.letterId)!=null&&M.trim()?k.letterId.trim().toUpperCase():"",taxYear:k.taxYear,taxPeriod:k.taxPeriod??"",taxAmount:k.taxAmount,paymentDate:k.paymentDate,bankAccountDetailId:k.bankAccountDetailId,routingNumber:k.routingNumber,accountType:k.accountType,bankName:k.bankName};ti($),a("/payments/state/authorization",{state:{from:o,paymentDraft:$}})}),Pt=()=>{if(r){r();return}a(o)},Et=e?en(e):"Entity";return s.jsx("form",{onSubmit:qt,noValidate:!0,className:"w-full",children:s.jsxs("div",{className:"relative w-full",children:[s.jsx("h2",{className:"mb-5 text-[28px] font-bold leading-tight text-slate-900 lg:pr-[324px]",children:Et}),s.jsx(Xr,{entity:e,remittanceAmount:Gr(X),className:"mb-4 w-full lg:absolute lg:top-0 lg:right-0 lg:mb-0 lg:w-[300px]"}),s.jsx("div",{className:"lg:mr-[324px]",children:s.jsxs("div",{className:"mx-auto w-full max-w-[720px] space-y-5",children:[s.jsxs("section",{className:Nl,children:[s.jsx(kl,{step:1,title:"Choose a State"}),s.jsxs("div",{className:"mt-5 space-y-5",children:[s.jsxs("div",{className:"relative",children:[s.jsxs("button",{type:"button",disabled:n||h||p,onClick:()=>{Ye(""),le(k=>!k)},className:"flex w-full items-center justify-between rounded-xl border border-slate-200 bg-slate-50/80 px-4 py-4 text-left transition hover:border-gov-300 hover:bg-gov-50/40 disabled:cursor-not-allowed disabled:opacity-70",children:[s.jsxs("span",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-gov-100 text-gov-600",children:s.jsx(Gv,{})}),s.jsxs("span",{children:[s.jsx("span",{className:"block text-sm font-semibold text-slate-900",children:h?"Loading states…":Ve??"Choose a state"}),s.jsx("span",{className:"block text-xs text-slate-500",children:"Tap to select the tax jurisdiction"})]})]}),s.jsx(Un,{className:`h-4 w-4 text-slate-400 transition ${Oe?"rotate-180":""}`})]}),Oe?s.jsxs("div",{className:"absolute left-0 right-0 z-20 mt-2 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-lg",children:[s.jsx("div",{className:"border-b border-slate-100 p-2",children:s.jsx("input",{ref:re,type:"search",value:be,onChange:k=>Ye(k.target.value),onKeyDown:k=>{k.key==="Escape"?le(!1):k.key==="Enter"&&k.preventDefault()},placeholder:"Search by state name or code","aria-label":"Search states",className:"w-full rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-gov-400 focus:bg-white focus:ring-2 focus:ring-gov-100"})}),s.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[rt.map(k=>s.jsxs("button",{type:"button",onClick:()=>jt(k.code),className:`flex w-full items-center justify-between px-4 py-3 text-left text-sm transition hover:bg-slate-50 ${V===k.code?"bg-gov-50 text-gov-700":"text-slate-700"}`,children:[s.jsx("span",{children:k.name}),s.jsx("span",{className:"text-xs font-medium text-slate-400",children:k.code})]},k.code)),rt.length===0?s.jsx("p",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No states found."}):null]})]}):null,O.state?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:O.state.message}):null,p?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:"Unable to load states."}):null]}),s.jsx(J,{label:"Reason for Payment",required:!0,info:"The reason for this state tax payment, filtered by the selected state and entity.",error:(Tt=O.reasonForPayment)==null?void 0:Tt.message,children:s.jsxs(Tr,{children:[s.jsxs("select",{disabled:n||!V||ie||G,className:Hn(!!O.reasonForPayment),value:Q,onChange:k=>Mt(k.target.value),children:[s.jsx("option",{value:"",children:ie?"Loading reasons…":"Select reason"}),Z.map(k=>s.jsx("option",{value:k.code,children:k.label},k.code))]}),s.jsx(Un,{})]})}),G?s.jsx("p",{className:"text-xs text-red-600",children:"Unable to load payment reasons."}):null,V&&!ie&&!G&&Z.length===0?s.jsx("p",{className:"text-xs text-slate-500",children:"No supported payment reasons are available for this entity and state."}):null]})]}),s.jsxs("section",{className:`${Nl} transition ${pe?"":"opacity-60"}`,children:[s.jsx(kl,{step:2,title:"Payment Form",className:"mb-5"}),s.jsxs("fieldset",{disabled:!pe||n,className:"min-w-0 border-0 p-0",children:[s.jsx(va,{title:"Payment Details",children:s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:ya,children:[s.jsx(J,{label:"State ID",required:(W==null?void 0:W.stateId.required)??!0,info:"Your state-issued tax account identifier for the selected state.",error:(Bt=O.stateAccountId)==null?void 0:Bt.message,children:s.jsx("input",{placeholder:(W==null?void 0:W.stateId.example)??"Enter ID",maxLength:fe,className:ne(!!O.stateAccountId),...ue,onChange:k=>{k.target.value=z?qv(k.target.value,z):Ov(k.target.value,L),ue.onChange(k)}})}),s.jsx(J,{label:"Account ID",required:(W==null?void 0:W.accountIdRequired)??!0,info:"Your 10 to 12 digit state tax account number.",error:(Vt=O.accountId)==null?void 0:Vt.message,children:s.jsx("input",{inputMode:"numeric",placeholder:"10–12 digits",maxLength:12,className:ne(!!O.accountId),...Te,onChange:k=>{k.target.value=k.target.value.replace(/\D/g,"").slice(0,12),Te.onChange(k)}})}),s.jsx(J,{label:"Letter ID",required:(W==null?void 0:W.letterIdRequired)??!1,info:"The letter or notice ID from the state bill (format L1234567890).",error:(Nt=O.letterId)==null?void 0:Nt.message,children:s.jsx("input",{placeholder:(W==null?void 0:W.letterId.example)??"L1234567890",maxLength:Hv,autoComplete:"off",className:ne(!!O.letterId),...Ge,onChange:k=>{k.target.value=Kv(k.target.value),Ge.onChange(k)}})})]}),s.jsxs("div",{className:wl,children:[s.jsx(J,{label:"Tax Year",required:!0,info:"The tax year this payment applies to.",error:(f=O.taxYear)==null?void 0:f.message,children:s.jsxs(Tr,{children:[s.jsx(Ne,{name:"taxYear",control:S,render:({field:k})=>s.jsxs("select",{className:Hn(!!O.taxYear),...k,children:[s.jsx("option",{value:"",children:"Select TY"}),Le.map($=>s.jsxs("option",{value:String($),children:["TY ",$]},$))]})}),s.jsx(Un,{})]})}),s.jsx(J,{label:(W==null?void 0:W.periodMode)==="account-assigned"?"Deposit Frequency":"Tax Period",required:(W==null?void 0:W.taxPeriodRequired)??!0,info:(W==null?void 0:W.periodMode)==="account-assigned"?"The deposit frequency assigned to your state tax account.":(W==null?void 0:W.taxPeriodRequired)===!1?"Optional for a bill payment — the notice already states the billed period.":"The tax period this payment covers.",error:(N=O.taxPeriod)==null?void 0:N.message,children:s.jsxs(Tr,{children:[s.jsx(Ne,{name:"taxPeriod",control:S,render:({field:k})=>s.jsxs("select",{className:Hn(!!O.taxPeriod),...k,children:[s.jsx("option",{value:"",children:"Select"}),ce.map($=>s.jsx("option",{value:$.value,children:$.label},$.value))]})}),s.jsx(Un,{})]})})]})]})}),s.jsx(va,{title:"Amount Info",children:s.jsxs("div",{className:wl,children:[s.jsx(J,{label:"Tax Amount",required:!0,info:"The total amount to remit to the state.",error:(A=O.taxAmount)==null?void 0:A.message,children:s.jsx(Ne,{name:"taxAmount",control:S,render:({field:k})=>s.jsx(Er,{name:k.name,value:k.value,onChange:k.onChange,onBlur:k.onBlur,disabled:n,hasError:!!O.taxAmount})})}),s.jsx(J,{label:"Payment Date",required:!0,info:"The weekday the payment will be withdrawn and settled with the state.",error:(R=O.paymentDate)==null?void 0:R.message,children:s.jsx(Ne,{name:"paymentDate",control:S,render:({field:k})=>s.jsx(Mu,{value:k.value,onChange:k.onChange,hasError:!!O.paymentDate,disabled:n})})})]})}),s.jsx(va,{title:"Bank Account",children:s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:ya,children:[s.jsx(Ne,{name:"bankAccountDetailId",control:S,render:({field:k})=>{var $;return s.jsx(Lu,{value:k.value,onChange:k.onChange,entityId:(e==null?void 0:e.entityId)??null,bankAccounts:b,isLoading:x,disabled:!e||!pe||n,error:($=O.bankAccountDetailId)==null?void 0:$.message,label:"Account Number",info:"Select the bank account to debit for this payment, or add a new one."})}}),s.jsx(J,{label:"Routing Number",required:!0,info:"The 9-digit bank routing number, auto-filled from the selected bank account.",children:s.jsx("input",{readOnly:!0,placeholder:"9-digit",className:ne(!1,!0),...j("routingNumber")})}),s.jsx(J,{label:"Account Type",required:!0,info:"The bank account type (checking or savings), auto-filled from the selected bank account.",children:s.jsx("input",{readOnly:!0,placeholder:"Select",className:ne(!1,!0),...j("accountType")})})]}),s.jsx("div",{className:ya,children:s.jsx(J,{label:"Bank Name",info:"The name of the bank, auto-filled from the selected bank account.",children:s.jsx("input",{readOnly:!0,placeholder:"e.g. Chase Bank",className:ne(!1,!0),...j("bankName")})})})]})}),W!=null&&W.notes.length?s.jsx("div",{className:"mt-5 rounded-lg bg-amber-50 px-4 py-3 text-xs text-amber-800",children:W.notes.map(k=>s.jsx("p",{children:k},k))}):null]}),pe?null:s.jsx("p",{className:"mt-4 text-sm text-slate-500",children:we?"Loading payment requirements…":Ae?"Unable to load payment requirements.":"Select a state and reason for payment to continue."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("button",{type:"button",onClick:Pt,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50",children:n?"Back":"Cancel"}),n?null:s.jsxs("button",{type:"submit",disabled:!e||!pe,className:"inline-flex h-11 min-w-[120px] items-center justify-center gap-2 rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:["Next",s.jsx(Xv,{})]})]})]})})]})},i.key)}function kl({step:e,title:t,className:n=""}){return s.jsxs("div",{className:`flex items-center gap-3 ${n}`,children:[s.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gov-600 text-sm font-semibold text-white",children:e}),s.jsx("h3",{className:"text-sm font-bold uppercase tracking-wide text-slate-900",children:t})]})}function va({title:e,children:t}){return s.jsxs("div",{className:"mt-6 first:mt-0",children:[s.jsx("h4",{className:"mb-4 text-xs font-semibold uppercase tracking-wide text-slate-400",children:e}),t]})}function Gv(){return s.jsxs("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:[s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"}),s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"})]})}function Xv(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"})})}function Xu(){const{selectedEntity:e}=ft();return s.jsx(Gu,{entity:e})}function ed(){var l;const{statePaymentId:e}=zs(),{selectedEntity:t}=ft(),n=Number.parseInt(e??"",10),{data:r,isLoading:a,isError:i}=ge({queryKey:["state-payments",n],queryFn:()=>Cu(n),enabled:t!==null&&Number.isFinite(n)}),o=v.useMemo(()=>r?{statePaymentDetailId:r.statePaymentDetailId,state:r.state,reasonForPayment:r.reasonForPayment??"",stateAccountId:r.stateAccountId??"",accountId:r.accountId??"",letterId:r.letterId??"",taxYear:r.taxYear??"",taxPeriod:r.taxPeriod??"",taxAmount:String(r.taxAmount),paymentDate:r.paymentDate,bankAccountDetailId:r.bankAccountDetailId?String(r.bankAccountDetailId):""}:null,[r]);return Number.isFinite(n)?a?s.jsx("p",{className:"px-6 py-12 text-sm text-slate-500",children:"Loading state payment…"}):i||!r||!o?s.jsx(Be,{to:Je(),replace:!0}):!t||r.entityId!==t.entityId?s.jsx(Be,{to:Je(),replace:!0}):((l=r.status)==null?void 0:l.toLowerCase())!=="draft"?s.jsx(Be,{to:`/payments/state/${n}/view`,replace:!0}):s.jsx(Gu,{entity:t,initialDraft:o}):s.jsx(Be,{to:Je(),replace:!0})}function td(){var l,c;const{statePaymentId:e}=zs(),t=ke(),{selectedEntity:n}=ft(),r=Number.parseInt(e??"",10),{data:a,isLoading:i,isError:o}=ge({queryKey:["state-payments",r],queryFn:()=>Cu(r),enabled:n!==null&&Number.isFinite(r)});return Number.isFinite(r)?i?s.jsx("p",{className:"px-6 py-12 text-sm text-slate-500",children:"Loading state payment…"}):o||!a?s.jsx(Be,{to:"/payments",replace:!0}):!n||a.entityId!==n.entityId?s.jsx(Be,{to:"/payments",replace:!0}):s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>t("/payments"),className:"inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50",children:[s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})}),"Back to Payments"]}),s.jsxs("h1",{className:"text-lg font-semibold text-slate-900",children:["State Payment ST-",a.statePaymentDetailId]})]}),s.jsx("div",{className:"w-full rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",children:s.jsxs("dl",{className:"grid gap-x-8 gap-y-5 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"State"}),s.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:a.state})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Tax Period"}),s.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:a.taxPeriod??"—"})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Amount"}),s.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:Kr(a.taxAmount)})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Payment Date"}),s.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:a.paymentDate})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Status"}),s.jsx("dd",{className:"mt-1",children:s.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${((l=a.status)==null?void 0:l.toLowerCase())==="paid"?"bg-green-100 text-green-800":((c=a.status)==null?void 0:c.toLowerCase())==="rejected"?"bg-red-100 text-red-800":"bg-slate-100 text-slate-700"}`,children:a.status??"—"})})]}),a.reason&&s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Rejection Reason"}),s.jsx("dd",{className:"mt-1 text-sm text-slate-700",children:a.reason})]})]})})]}):s.jsx(Be,{to:"/payments",replace:!0})}const ej="By proceeding, you authorize the payment to the selected tax authority and acknowledge that you are responsible for the accuracy of the information provided.",tj="I have reviewed the details and authorize this payment.",nd=/^[a-zA-Z\s]+$/;function rd(e){return e.replace(/[^a-zA-Z\s]/g,"")}const so=_().min(1,"Signature is required").regex(nd,"Signature must contain only letters").refine(e=>e.trim().length>0,{message:"Signature is required"}),nj=_().optional().refine(e=>!e||!e.trim()||nd.test(e),{message:"Signature must contain only letters"}),rj=Xt({agreementDate:_().min(1,"Date is required"),agreementAccepted:Wn().refine(e=>e,{message:"You must accept the authorization agreement"}),authorizationPersonName:_().min(1,"Name of authorization person is required"),signature:so,title:_().min(1,"Title is required")}),sj="w-full rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",ds="rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 text-center";function aj(e){const[t,n,r]=e.split("-");return!t||!n||!r?e:`${n}/${r}/${t}`}function ij(){return{agreementDate:new Date().toISOString().slice(0,10),agreementAccepted:!1,authorizationPersonName:"",signature:"",title:""}}function oj({entity:e,paymentDraft:t}){const n=ke(),r=Se(),a=pt(),i=qn(r.state,Je()),[o,l]=v.useState(null),[c,d]=v.useState(!1),u=v.useMemo(()=>ij(),[]),m=Gr(t.taxAmount),{register:h,handleSubmit:p,watch:g,formState:{errors:x}}=Lt({resolver:Ot(rj),defaultValues:u}),b=g("agreementDate"),y=g("signature"),C=!!(y!=null&&y.trim()),j=h("signature"),S=async O=>{await a.invalidateQueries({queryKey:["dashboard"]}),await a.invalidateQueries({queryKey:["state-payments"]}),await a.invalidateQueries({queryKey:["remittance-payments"]}),O&&a.removeQueries({queryKey:["state-payments",O],exact:!0})},I=async()=>{if(!e)return null;if(t.statePaymentDetailId){const V=await F0(t.statePaymentDetailId,Wv(t));return await S(V.statePaymentDetailId),V}const O=await D0(Zv(e.entityId,t));return ti({...t,statePaymentDetailId:O.statePaymentDetailId}),await S(O.statePaymentDetailId),O},F=async()=>{e&&(await I(),Ku(),n(Je()))},E=p(async()=>{if(e){l(null),d(!0);try{await F()}catch(O){l(nt(O,"Failed to save state payment."))}finally{d(!1)}}}),T=p(async()=>{if(e){l(null),d(!0);try{await F()}catch(O){l(nt(O,"Failed to save draft."))}finally{d(!1)}}});return s.jsx("form",{onSubmit:E,noValidate:!0,className:"w-full",children:s.jsxs("div",{className:"relative w-full",children:[s.jsx("h2",{className:"mb-5 text-[28px] font-bold leading-tight text-slate-900 lg:pr-[324px]",children:"Payment Authorization"}),s.jsx(Xr,{entity:e,remittanceAmount:m,className:"mb-4 w-full lg:absolute lg:top-0 lg:right-0 lg:mb-0 lg:w-[300px]"}),s.jsxs("div",{className:"lg:mr-[324px]",children:[s.jsxs("section",{className:sj,children:[s.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-slate-200 pb-5",children:[s.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Authorization Agreement"}),s.jsxs("div",{className:`${ds} min-w-[128px] py-2.5`,children:[s.jsx("p",{className:"text-[11px] font-medium text-slate-500",children:"Date"}),s.jsx("p",{className:"mt-0.5 text-sm font-semibold text-slate-800",children:aj(b)}),s.jsx("input",{type:"hidden",...h("agreementDate")})]})]}),s.jsx("p",{className:"mt-5 text-sm leading-relaxed text-slate-600",children:ej}),s.jsxs("label",{className:"mt-5 flex cursor-pointer items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...h("agreementAccepted")}),s.jsx("span",{className:"text-sm font-semibold leading-6 text-slate-800",children:tj})]}),x.agreementAccepted?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:x.agreementAccepted.message}):null,s.jsxs("div",{className:"mt-8 border-t border-slate-100 pt-8",children:[s.jsxs("p",{className:"mb-4 text-sm font-medium text-gov-600",children:["Taxpayer's Signature",s.jsx("span",{className:"text-red-500",children:" *"})]}),s.jsxs("div",{className:"grid gap-5 md:grid-cols-[minmax(0,1fr)_minmax(0,1.35fr)_minmax(0,1fr)] md:items-end",children:[s.jsxs("div",{children:[s.jsxs("div",{className:`${ds} py-7`,children:[s.jsx("input",{placeholder:"Enter name",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 placeholder:text-slate-400 focus:outline-none",...h("authorizationPersonName")}),s.jsx("div",{className:"mx-auto mt-6 w-full max-w-[180px] border-t border-slate-400"}),s.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"Name of Authorization Person"})]}),x.authorizationPersonName?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:x.authorizationPersonName.message}):null]}),s.jsxs("div",{children:[s.jsxs("div",{className:`${ds} py-5`,children:[s.jsx("input",{placeholder:"Sign here",autoComplete:"off",spellCheck:!1,className:`w-full border-0 bg-transparent text-center focus:outline-none ${C?"min-h-[52px] text-4xl leading-tight tracking-wide text-slate-800":"text-sm text-slate-400 placeholder:text-slate-400"}`,style:C?{fontFamily:"'Great Vibes', 'Segoe Script', cursive"}:void 0,name:j.name,ref:j.ref,onBlur:j.onBlur,onChange:O=>{const V=rd(O.target.value);O.target.value=V,j.onChange(O)}}),s.jsx("div",{className:"mx-auto mt-6 w-full max-w-[220px] border-t border-slate-400"}),s.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"Signature of Tax Payer"})]}),x.signature?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:x.signature.message}):null]}),s.jsxs("div",{children:[s.jsxs("div",{className:`${ds} py-7`,children:[s.jsx("input",{placeholder:"Enter title",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 placeholder:text-slate-400 focus:outline-none",...h("title")}),s.jsx("div",{className:"mx-auto mt-6 w-full max-w-[140px] border-t border-slate-400"}),s.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"Title"})]}),x.title?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:x.title.message}):null]})]})]})]}),o?s.jsx("div",{className:"mt-5",children:s.jsx(zt,{message:o})}):null,s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx("button",{type:"button",onClick:()=>{ti(t),n("/payments/state/new",{state:{from:i,paymentDraft:t}})},disabled:c,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:T,disabled:c||!e,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-gov-300 bg-gov-50 px-6 text-sm font-semibold text-gov-600 transition hover:bg-gov-100 disabled:cursor-not-allowed disabled:opacity-50",children:"Save as Draft"}),s.jsx("button",{type:"submit",disabled:c||!e,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:"Submit Now"})]})]})]})})}function sd(){const{selectedEntity:e}=ft(),t=Se(),{paymentDraft:n}=t.state??{},r=n??ni();return r?s.jsx(oj,{entity:e,paymentDraft:r}):s.jsx(Be,{to:"/payments/state/new",replace:!0})}const ao="/portal/federal-payments/form-8655-authorizations";function lj(e){return de(ao,{method:"POST",body:e})}function cj(e){return de(`${ao}/by-enrolment/${e}`)}function uj(e,t){return de(`${ao}/${e}`,{method:"PATCH",body:t})}async function ad(e){try{return await cj(e)}catch(t){if(t instanceof xr&&t.status===404)return null;throw t}}const ri=["720","940","941","943","944","945","990-PF","990-T","1041","1042","1120","CT-1"];function dj(e){const t=e.trim();return ri.includes(t)?t:""}const mj="I understand that this agreement does not relieve me, as the taxpayer, of the responsibility to ensure that all tax returns are filed and that all deposits and payments are made and that I may enroll in the Electronic Federal Tax Payment System (EFTPS) to view deposits and payments made on my behalf.",hj="I further understand that this agreement does not authorize the reporting agent to sign any tax returns, to otherwise act as a legal representative of the taxpayer, or to represent the taxpayer before the IRS. I also understand that the reporting agent is not responsible for any penalties or interest that may be assessed against the taxpayer. I authorize the reporting agent to complete Form 8655, Reporting Agent Authorization, and to make deposits and payments on my behalf for the tax return(s) indicated above. I also authorize the reporting agent to receive confidential information and to perform acts as specified on Form 2848, Power of Attorney and Declaration of Representative, or Form 8821, Tax Information Authorization, as applicable.";function fj(e){const[t,n,r]=e.split("-");return!t||!n||!r?e:`${n}/${r}/${t}`}function si({label:e,required:t=!1,signature:n,title:r,date:a,signatureValue:i,dateValue:o="",dateReadOnly:l=!0,errors:c,signatureCaption:d="Signature of taxpayer"}){const u=!!(i!=null&&i.trim()),{onChange:m,onBlur:h,name:p,ref:g}=n;return s.jsxs("div",{children:[e?s.jsxs("p",{className:"mb-3 text-sm font-medium text-gov-600",children:[e,t?s.jsx("span",{className:"text-red-500",children:" *"}):null]}):null,s.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,0.8fr)_minmax(0,0.8fr)] lg:items-end",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 py-6",children:[s.jsx("input",{ref:g,name:p,placeholder:"Sign here",autoComplete:"off",spellCheck:!1,className:`w-full border-0 bg-transparent text-center focus:outline-none ${u?"text-4xl leading-tight tracking-wide text-slate-800":"text-sm text-slate-400 placeholder:text-slate-400"}`,style:u?{fontFamily:"'Great Vibes', 'Segoe Script', cursive"}:void 0,onBlur:h,onChange:x=>{const b=rd(x.target.value);x.target.value=b,m(x)}}),s.jsx("div",{className:"mt-8 border-t border-slate-400"}),s.jsx("p",{className:"mt-2 text-center text-xs text-slate-500",children:d})]}),c!=null&&c.signature?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:c.signature}):null]}),s.jsxs("div",{children:[s.jsxs("div",{className:"rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 py-8",children:[s.jsx("input",{placeholder:"Enter title",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 placeholder:text-slate-400 focus:outline-none",...r}),s.jsx("div",{className:"mt-8 border-t border-slate-400"}),s.jsx("p",{className:"mt-2 text-center text-xs text-slate-500",children:"Title"})]}),c!=null&&c.title?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:c.title}):null]}),s.jsxs("div",{children:[s.jsxs("div",{className:"rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 py-8",children:[l?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-center text-sm text-slate-700",children:fj(o)}),s.jsx("input",{type:"hidden",...a})]}):s.jsx("input",{type:"date",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 focus:outline-none",...a}),s.jsx("div",{className:"mt-8 border-t border-slate-400"}),s.jsx("p",{className:"mt-2 text-center text-xs text-slate-500",children:"Date"})]}),c!=null&&c.date?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:c.date}):null]})]})]})}function pj(e){return e.replace(/\D/g,"")}function id(e,t){var n,r;return{enrollmentId:e,taxpayerName:t.taxpayerName.trim(),tradeName:t.tradeName.trim(),ein:pj(t.ein),address:t.address.trim(),city:t.city.trim(),state:t.state.trim(),zipCode:t.zipCode.trim(),country:t.country.trim(),isSeasonalEmployer:t.isSeasonalEmployer,otherIdentificationNumber:((n=t.otherIdentificationNumber)==null?void 0:n.trim())||null,contactPerson:t.contactPerson.trim(),daytimePhone:t.daytimePhone.trim(),faxNumber:t.faxNumber.trim(),authorizedTaxForm:t.authorizedTaxForm,authorizationStartMonth:((r=t.authorizationMonth)==null?void 0:r.trim())||null,agreementAccepted:t.agreementAccepted,taxpayerSignature:t.signature.trim()||null,taxpayerTitle:t.title.trim(),signatureDate:t.signatureDate}}function xj(e){const{enrollmentId:t,...n}=id(0,e);return n}function gj(e){return{taxpayerName:e.taxpayerName,tradeName:e.tradeName,ein:zi(e.ein),address:e.address,city:e.city,state:e.state,zipCode:e.zipCode,country:e.country,isSeasonalEmployer:e.isSeasonalEmployer,otherIdentificationNumber:e.otherIdentificationNumber??"",contactPerson:e.contactPerson,daytimePhone:Ln(e.daytimePhone),faxNumber:e.faxNumber,authorizedTaxForm:e.authorizedTaxForm,authorizationMonth:e.authorizationStartMonth??"",agreementAccepted:e.agreementAccepted,signature:e.taxpayerSignature??"",title:e.taxpayerTitle,signatureDate:e.signatureDate}}const yj=Xt({taxpayerName:_().min(1,"Taxpayer name is required"),tradeName:_().optional(),ein:_().min(1,"EIN is required"),address:_().min(1,"Address is required"),city:_().min(1,"City is required"),state:_().min(1,"State is required"),zipCode:_().min(1,"ZIP code is required"),country:_().min(1,"Country is required"),isSeasonalEmployer:Wn(),otherIdentificationNumber:_().optional(),contactPerson:_().optional(),daytimePhone:_().min(1,"Daytime telephone number is required"),faxNumber:_().default(""),authorizedTaxForm:_().min(1,"Select a tax form"),authorizationMonth:_().optional().refine(e=>!e||/^\d{4}\/(0[1-9]|1[0-2])$/.test(e),"Enter the month as YYYY/MM (e.g. 2024/08)"),agreementAccepted:Wn().refine(e=>e,{message:"You must accept the authorization agreement"}),signature:so,title:_().min(1,"Title is required"),signatureDate:_().min(1,"Date is required")}),ja="grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3";function bj(e,t){const n=new Date().toISOString().slice(0,10);return{taxpayerName:e?en(e):"",tradeName:(e==null?void 0:e.tradeName)??"",ein:e?zi(e.idNumber):"",address:[e==null?void 0:e.address1,e==null?void 0:e.address2].filter(Boolean).join(", "),city:(e==null?void 0:e.city)??"",state:(e==null?void 0:e.state)??"",zipCode:(e==null?void 0:e.zipCode)??"",country:(e==null?void 0:e.country)??"United States",isSeasonalEmployer:!1,otherIdentificationNumber:"",contactPerson:"",daytimePhone:e?Ln(e.phoneNumber):"",faxNumber:"",authorizedTaxForm:dj(t.taxFormType),authorizationMonth:"",agreementAccepted:!1,signature:"",title:"",signatureDate:n}}function vj({entity:e,paymentDraft:t,initialAuthorization:n=null,readonly:r=!1}){var ie,G,W,we,Ae,Le,ce,pe,L,fe,z,ue,Te,Ge,Oe;const a=ke(),i=Se(),o=pt(),l=qn(i.state,Je()),c=Gr(t.paymentAmount),[d,u]=v.useState(null),[m,h]=v.useState(!1),p=v.useMemo(()=>n?gj(n):bj(e,t),[e,n,t]),{register:g,handleSubmit:x,watch:b,setValue:y,reset:C,formState:{errors:j}}=Lt({resolver:Ot(yj),defaultValues:p});v.useEffect(()=>{C(p)},[p,C]);const S=b("authorizedTaxForm"),I=b("signature"),F=b("signatureDate"),E=e?en(e):"Entity",T=!0,O=!0,V=async()=>{await o.invalidateQueries({queryKey:["dashboard"]}),await o.invalidateQueries({queryKey:["federal-payments"]}),await o.invalidateQueries({queryKey:["remittance-payments"]})},Q=async()=>{if(!e)return null;if(t.federalPaymentId){const be=await Hi(t.federalPaymentId,Xi(t));return await V(),be}const le=await Yi(Gi(e.entityId,t));return to({...t,federalPaymentId:le.federalPaymentId,enrollmentId:le.enrollmentId}),await V(),le},X=async(le,be)=>{var Ve;const Ye=t.form8655AuthorizationId??((Ve=await ad(le))==null?void 0:Ve.form8655AuthorizationId),re=be;return Ye?uj(Ye,xj(re)):lj(id(le,re))},H=async le=>{if(!e)return;const be=await Q();be&&(await X(be.enrollmentId,le),await o.invalidateQueries({queryKey:["form-8655",be.enrollmentId]}),no(),a(Je()))},U=x(async le=>{if(!(!e||r)){u(null),h(!0);try{await H(le)}catch(be){u(nt(be,"Failed to save federal payment draft."))}finally{h(!1)}}}),Z=x(async le=>{if(!(!e||r)){u(null),h(!0);try{await H(le)}catch(be){u(nt(be,"Failed to save draft."))}finally{h(!1)}}});return s.jsxs("form",{onSubmit:U,noValidate:!0,className:"w-full space-y-6",children:[s.jsxs("div",{className:"relative w-full",children:[s.jsx("h2",{className:"mb-4 text-[28px] font-bold leading-tight text-slate-900 lg:pr-[324px]",children:E}),s.jsx(Xr,{entity:e,remittanceAmount:c,className:"mb-4 w-full lg:absolute lg:top-0 lg:right-0 lg:mb-0 lg:w-[300px]"}),s.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:mr-[324px] lg:p-8",children:s.jsxs("fieldset",{disabled:r,className:"min-w-0 border-0 p-0",children:[s.jsxs("section",{children:[s.jsxs("div",{className:ja,children:[s.jsx(J,{label:"1. a) Name of the Taxpayer",required:!0,error:(ie=j.taxpayerName)==null?void 0:ie.message,children:s.jsx("input",{placeholder:"Enter name",readOnly:T,className:ne(!!j.taxpayerName,T),...g("taxpayerName")})}),s.jsx(J,{label:"1. b) Trade Name, if any",error:(G=j.tradeName)==null?void 0:G.message,children:s.jsx("input",{placeholder:"Enter name",readOnly:T,className:ne(!!j.tradeName,T),...g("tradeName")})}),s.jsx(J,{label:"2. Employer Identification Number (EIN)",required:!0,error:(W=j.ein)==null?void 0:W.message,children:s.jsx("input",{placeholder:"Enter number",readOnly:T,className:ne(!!j.ein,T),...g("ein")})})]}),s.jsxs("div",{className:"mt-5 grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3",children:[s.jsx("div",{className:"sm:col-span-2",children:s.jsx(J,{label:"3. a) Address (Number, Street, and Room/Suite No)",required:!0,error:(we=j.address)==null?void 0:we.message,children:s.jsx("input",{placeholder:"Enter",readOnly:T,className:ne(!!j.address,T),...g("address")})})}),s.jsx(J,{label:"3. b) City or Town",required:!0,error:(Ae=j.city)==null?void 0:Ae.message,children:s.jsx("input",{placeholder:"Enter",readOnly:T,className:ne(!!j.city,T),...g("city")})})]}),s.jsxs("div",{className:`mt-5 ${ja}`,children:[s.jsx(J,{label:"3. c) State",required:!0,error:(Le=j.state)==null?void 0:Le.message,children:s.jsx("input",{placeholder:"Enter name",readOnly:T,className:ne(!!j.state,T),...g("state")})}),s.jsx(J,{label:"3. d) ZIP Code",required:!0,error:(ce=j.zipCode)==null?void 0:ce.message,children:s.jsx("input",{placeholder:"Enter",readOnly:T,className:ne(!!j.zipCode,T),...g("zipCode")})}),s.jsx(J,{label:"3. e) Country",required:!0,error:(pe=j.country)==null?void 0:pe.message,children:s.jsx("input",{placeholder:"Enter",readOnly:T,className:ne(!!j.country,T),...g("country")})})]}),s.jsxs("div",{className:`mt-5 ${ja}`,children:[s.jsx("div",{className:"flex items-end pb-2",children:s.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-700",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...g("isSeasonalEmployer")}),s.jsx("span",{children:"4. If you are a Seasonal Employer"})]})}),s.jsx(J,{label:"5. Other Identification Number (Optional)",children:s.jsx("input",{placeholder:"Enter name",readOnly:T,className:ne(!1,T),...g("otherIdentificationNumber")})}),s.jsx(J,{label:"6. Contact Person",error:(L=j.contactPerson)==null?void 0:L.message,children:s.jsx("input",{placeholder:"Enter name",className:ne(!!j.contactPerson),...g("contactPerson")})})]}),s.jsxs("div",{className:"mt-5 grid gap-x-6 gap-y-5 sm:grid-cols-2",children:[s.jsx(J,{label:"7. Daytime Telephone Number",required:!0,error:(fe=j.daytimePhone)==null?void 0:fe.message,children:s.jsx("input",{placeholder:"Enter number",readOnly:T,className:ne(!!j.daytimePhone,T),...g("daytimePhone")})}),s.jsx(J,{label:"8. Fax Number",error:(z=j.faxNumber)==null?void 0:z.message,children:s.jsx("input",{placeholder:"Enter number",className:ne(!!j.faxNumber),...g("faxNumber")})})]})]}),s.jsxs(wn,{title:"Authorization of Reporting Agent To Make and Deposits and Payments (Caution: See Authorization Agreement.)",children:[s.jsx("p",{className:"mb-5 text-sm leading-6 text-slate-600",children:"Indicate the tax return(s) for which the reporting agent is authorized to make deposits or payments. Use the 'YYYY/MM' format to enter the month in which the authorization begins (for example, '2024/8' for August 2024)"}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex flex-wrap gap-x-8 gap-y-3",children:ri.slice(0,6).map(le=>s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[s.jsx("input",{type:"radio",value:le,checked:S===le,disabled:O,onChange:()=>y("authorizedTaxForm",le,{shouldValidate:!0}),className:"h-4 w-4 border-slate-300 text-gov-600 focus:ring-gov-200 disabled:cursor-default"}),le]},le))}),s.jsx("div",{className:"flex flex-wrap gap-x-8 gap-y-3",children:ri.slice(6).map(le=>s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[s.jsx("input",{type:"radio",value:le,checked:S===le,disabled:O,onChange:()=>y("authorizedTaxForm",le,{shouldValidate:!0}),className:"h-4 w-4 border-slate-300 text-gov-600 focus:ring-gov-200 disabled:cursor-default"}),le]},le))})]}),j.authorizedTaxForm?s.jsx("p",{className:"mt-2 text-xs text-red-600",children:j.authorizedTaxForm.message}):null,s.jsx("div",{className:"mt-5 max-w-xs",children:s.jsx(J,{label:"Authorization begins (YYYY/MM)",error:(ue=j.authorizationMonth)==null?void 0:ue.message,children:s.jsx("input",{placeholder:"2024/08",className:ne(!!j.authorizationMonth,!1),...g("authorizationMonth")})})})]}),s.jsxs("section",{className:"mt-8 border-t border-slate-100 pt-8",children:[s.jsx("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:"Authorization Agreement"}),s.jsxs("div",{className:"border-t border-slate-200 pt-5",children:[s.jsxs("label",{className:"flex items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...g("agreementAccepted")}),s.jsxs("span",{className:"text-sm leading-6 text-slate-700",children:[s.jsx("span",{className:"font-semibold text-slate-900",children:mj})," ",hj]})]}),j.agreementAccepted?s.jsx("p",{className:"mt-2 text-xs text-red-600",children:j.agreementAccepted.message}):null]})]}),s.jsx("section",{className:"mt-8 border-t border-slate-100 pt-8",children:s.jsx(si,{label:"Taxpayer's Signature",required:!0,signature:g("signature"),title:g("title"),date:g("signatureDate"),signatureValue:I,dateValue:F,errors:{signature:(Te=j.signature)==null?void 0:Te.message,title:(Ge=j.title)==null?void 0:Ge.message,date:(Oe=j.signatureDate)==null?void 0:Oe.message}})})]})})]}),d?s.jsx("div",{className:"lg:mr-[324px]",children:s.jsx(zt,{message:d})}):null,s.jsxs("div",{className:"flex flex-wrap items-center gap-3 lg:mr-[324px]",children:[s.jsx("button",{type:"button",onClick:()=>a(l),disabled:m,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:Z,disabled:m||!e||r,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Save as Draft"}),s.jsx("button",{type:"submit",disabled:m||!e||r,className:"inline-flex h-11 min-w-[180px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:"Review and Submit"})]})]})}function od(){const{selectedEntity:e}=ft(),t=Se(),{paymentDraft:n}=t.state??{},r=n??ra(),{data:a,isLoading:i}=ge({queryKey:["federal-payment",r==null?void 0:r.federalPaymentId],queryFn:()=>Wi(r.federalPaymentId),enabled:(r==null?void 0:r.federalPaymentId)!=null&&r.enrollmentId==null}),o=(r==null?void 0:r.enrollmentId)??(a==null?void 0:a.enrollmentId),{data:l,isLoading:c}=ge({queryKey:["form-8655",o],queryFn:()=>ad(o),enabled:o!=null}),d=v.useMemo(()=>r?{...r,enrollmentId:o??r.enrollmentId,form8655AuthorizationId:r.form8655AuthorizationId??(l==null?void 0:l.form8655AuthorizationId)}:null,[r,o,l]);return r?Ji(e)?s.jsx(Be,{to:"/payments/federal/individual-enrollment",replace:!0,state:t.state}):r.federalPaymentId!=null&&r.enrollmentId==null&&i||o!=null&&c?s.jsx("p",{className:"text-sm text-slate-600",children:"Loading authorization form…"}):s.jsx(vj,{entity:e,paymentDraft:d??r,initialAuthorization:l}):s.jsx(Be,{to:"/payments/federal/new",replace:!0})}const io="/portal/federal-payments/form-9783-enrollments";function jj(e){return de(io,{method:"POST",body:e})}function wj(e){return de(`${io}/by-enrolment/${e}`)}function Nj(e,t){return de(`${io}/${e}`,{method:"PATCH",body:t})}async function ld(e){try{return await wj(e)}catch(t){if(t instanceof xr&&t.status===404)return null;throw t}}const Sj="I hereby authorize the contact person listed in item 5 on this form, and the financial institution(s) listed in items 9-11 on this form, to process EFTPS payments and to receive confidential information for enrollment purposes, to answer inquiries regarding my account, and to resolve any issues that may arise. This authorization includes passwords, payment instructions, taxpayer names, and identifying numbers.",kj="By completing the financial institution information in items 9-11 on this form, I authorize the designated Financial Agents of the U.S. Treasury to initiate EFTPS debit entries to my financial institution account for federal tax payments. All debits will be made in accordance with U.S. Treasury regulations. This authorization remains in effect until written notification of termination is received and the Financial Agent has had a reasonable opportunity to act on it.",Cj="Under penalties of perjury, I certify that I have the authority to sign this authorization on behalf of the taxpayer. If I am a corporate officer, partner, guardian, executor, receiver, administrator, trustee, or other party, I certify that I have the authority to execute this authorization on behalf of the taxpayer. If I am a tax practitioner, I certify that Form 2848 or Form 8655 is on file with the IRS.",wa=new Date().getFullYear(),Aj=[String(wa-1),String(wa-2),String(wa-3)];function ms(e){return e.replace(/\D/g,"")}function cd(e,t){var n,r,a,i;return{enrollmentId:e,primarySsn:ms(t.primarySsn),jointFilerSsn:t.jointFilerSsn?ms(t.jointFilerSsn):null,taxpayerNames:t.taxpayerNames.trim(),primaryAddress:t.primaryAddress.trim(),city:t.city.trim(),state:t.state.trim(),zipCode:t.zipCode.trim(),country:t.country.trim(),internationalAddress:((n=t.internationalAddress)==null?void 0:n.trim())||null,primaryPhone:t.primaryPhone.trim(),primaryContactName:t.primaryContactName.trim(),primaryContactAddress:t.primaryContactAddress.trim(),contactCity:t.contactCity.trim(),contactState:t.contactState.trim(),contactZipCode:t.contactZipCode.trim(),contactCountry:t.contactCountry.trim(),contactPhone:t.contactPhone.trim(),contactInternationalAddress:((r=t.contactInternationalAddress)==null?void 0:r.trim())||null,primaryTaxpayerPin:t.primaryTaxpayerPin.trim()||null,dateOfBirth:t.dateOfBirth||null,priorYearAgi:t.priorYearAgi.trim()?Number(t.priorYearAgi):null,agiTaxYear:t.agiTaxYear.trim()||null,financialPrimarySsn:ms(t.financialPrimarySsn),routingTransitNumber:ms(t.routingTransitNumber),accountNumber:t.accountNumber.trim(),accountType:t.accountType,disclosureAgreementOne:t.disclosureAgreementOne,disclosureAgreementTwo:t.disclosureAgreementTwo,authorityAgreement:t.authorityAgreement,taxpayerSignature:t.taxpayerSignature.trim()||null,taxpayerTitle:t.taxpayerTitle.trim(),taxpayerSignatureDate:t.taxpayerSignatureDate,jointFilerSignature:((a=t.jointFilerSignature)==null?void 0:a.trim())||null,jointFilerTitle:((i=t.jointFilerTitle)==null?void 0:i.trim())||null,jointFilerSignatureDate:t.jointFilerSignatureDate||null}}function Pj(e){const{enrollmentId:t,...n}=cd(0,e);return n}function Ej(e){var n;const t=((n=e.accountType)==null?void 0:n.toLowerCase())==="savings"?"Savings":"Checking";return{primarySsn:e.primarySsn,jointFilerSsn:e.jointFilerSsn??"",taxpayerNames:e.taxpayerNames,primaryAddress:e.primaryAddress,city:e.city,state:e.state,zipCode:e.zipCode,country:e.country,internationalAddress:e.internationalAddress??"",primaryPhone:Ln(e.primaryPhone),primaryContactName:e.primaryContactName,primaryContactAddress:e.primaryContactAddress,contactCity:e.contactCity,contactState:e.contactState,contactZipCode:e.contactZipCode,contactCountry:e.contactCountry,contactPhone:Ln(e.contactPhone),contactInternationalAddress:e.contactInternationalAddress??"",primaryTaxpayerPin:e.primaryTaxpayerPin??"",dateOfBirth:e.dateOfBirth??"",priorYearAgi:e.priorYearAgi!==null&&e.priorYearAgi!==void 0?String(e.priorYearAgi):"",agiTaxYear:e.agiTaxYear??"",financialPrimarySsn:e.financialPrimarySsn,routingTransitNumber:e.routingTransitNumber,accountNumber:e.accountNumber,accountType:t,disclosureAgreementOne:e.disclosureAgreementOne,disclosureAgreementTwo:e.disclosureAgreementTwo,authorityAgreement:e.authorityAgreement,taxpayerSignature:e.taxpayerSignature??"",taxpayerTitle:e.taxpayerTitle,taxpayerSignatureDate:e.taxpayerSignatureDate,jointFilerSignature:e.jointFilerSignature??"",jointFilerTitle:e.jointFilerTitle??"",jointFilerSignatureDate:e.jointFilerSignatureDate??""}}const Ij=Xt({primarySsn:_().min(1,"Primary SSN is required"),jointFilerSsn:_().optional(),taxpayerNames:_().min(1,"Taxpayer name is required"),primaryAddress:_().min(1,"Primary address is required"),city:_().min(1,"City is required"),state:_().min(1,"State is required"),zipCode:_().min(1,"ZIP code is required"),country:_().min(1,"Country is required"),internationalAddress:_().optional(),primaryPhone:_().min(1,"Primary phone number is required"),primaryContactName:_().min(1,"Primary contact name is required"),primaryContactAddress:_().min(1,"Primary contact address is required"),contactCity:_().min(1,"Contact city is required"),contactState:_().min(1,"Contact state is required"),contactZipCode:_().min(1,"Contact ZIP code is required"),contactCountry:_().min(1,"Contact country is required"),contactPhone:_().min(1,"Contact phone number is required"),contactInternationalAddress:_().optional(),primaryTaxpayerPin:_().min(1,"Primary taxpayer PIN is required").regex(/^\d{5}$/,"Primary taxpayer PIN must be exactly 5 digits"),dateOfBirth:_().min(1,"Date of birth is required").refine(e=>ev(e,ud),{message:"You must be at least 18 years old"}),priorYearAgi:_().min(1,"Prior year adjusted gross income is required").refine(e=>!Number.isNaN(Number(e))&&Number(e)>=0,{message:"Enter a valid amount"}),agiTaxYear:_().min(1,"Prior tax year is required"),financialPrimarySsn:_().min(1,"Primary SSN is required"),routingTransitNumber:_().min(1,"Routing transit number is required"),accountNumber:_().min(1,"Account number is required"),accountType:fu([da("Checking"),da("Savings"),da("")]).refine(e=>e==="Checking"||e==="Savings",{message:"Account type is required"}),disclosureAgreementOne:Wn().refine(e=>e,{message:"You must accept the disclosure authorization agreement"}),disclosureAgreementTwo:Wn().refine(e=>e,{message:"You must accept the disclosure authorization agreement"}),authorityAgreement:Wn().refine(e=>e,{message:"You must accept the authority agreement"}),taxpayerSignature:so,taxpayerTitle:_().min(1,"Title is required"),taxpayerSignatureDate:_().min(1,"Date is required"),jointFilerSignature:nj,jointFilerTitle:_().optional(),jointFilerSignatureDate:_().optional()}),bn="grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3",Tj="grid gap-x-6 gap-y-5 sm:grid-cols-2 lg:grid-cols-4",_j=5,ud=18;function dd(e){return e?e.toLowerCase()==="savings"?"Savings":"Checking":""}function md(e,t){return{financialPrimarySsn:(e==null?void 0:e.idNumber)??"",routingTransitNumber:t.routingNumber??"",accountNumber:t.accountNumber??"",accountType:dd(t.accountType)}}function Dj(e,t){const n=new Date().toISOString().slice(0,10),r=e?en(e):"";return{primarySsn:(e==null?void 0:e.idNumber)??"",jointFilerSsn:"",taxpayerNames:r,primaryAddress:(e==null?void 0:e.address1)??"",city:(e==null?void 0:e.city)??"",state:(e==null?void 0:e.state)??"",zipCode:(e==null?void 0:e.zipCode)??"",country:(e==null?void 0:e.country)??"US",internationalAddress:"",primaryPhone:e?Ln(e.phoneNumber):"",primaryContactName:"",primaryContactAddress:"",contactCity:"",contactState:"",contactZipCode:"",contactCountry:"",contactPhone:"",contactInternationalAddress:"",...md(e,t),primaryTaxpayerPin:"",dateOfBirth:"",priorYearAgi:"",agiTaxYear:"",disclosureAgreementOne:!1,disclosureAgreementTwo:!1,authorityAgreement:!1,taxpayerSignature:"",taxpayerTitle:"",taxpayerSignatureDate:n,jointFilerSignature:"",jointFilerTitle:"",jointFilerSignatureDate:n}}function Fj({entity:e,paymentDraft:t,initialEnrollment:n=null,readonly:r=!1}){var Ye,re,Ve,rt,vt,xt,jt,Mt,wt,qt,Pt,Et,It,Tt,Bt,Vt,Nt,f,N,A,R,k,$,M,K;const a=ke(),i=Se(),o=pt(),l=qn(i.state,Je()),c=Gr(t.paymentAmount),[d,u]=v.useState(null),[m,h]=v.useState(!1),[p,g]=v.useState(!1),{data:x=[]}=ge({queryKey:["bank-accounts",e==null?void 0:e.entityId],queryFn:async()=>(await Jr({entityId:e.entityId,pageNumber:1,pageSize:100})).items,enabled:(e==null?void 0:e.entityId)!=null}),b=v.useMemo(()=>{if(n)return Ej(n);const q=x.find(Me=>String(Me.bankAccountDetailId)===t.bankAccountDetailId),ae=md(e,t);return{...Dj(e,t),financialPrimarySsn:ae.financialPrimarySsn,routingTransitNumber:ae.routingTransitNumber||(q==null?void 0:q.routingNumber)||"",accountNumber:ae.accountNumber||(q==null?void 0:q.accountNumber)||"",accountType:dd(t.accountType||(q==null?void 0:q.accountType))}},[e,n,t,x]),{register:y,handleSubmit:C,watch:j,setValue:S,reset:I,control:F,formState:{errors:E}}=Lt({resolver:Ot(Ij),defaultValues:b});v.useEffect(()=>{I(b)},[b,I]);const T=j("taxpayerSignature"),O=j("jointFilerSignature"),V=j("taxpayerSignatureDate"),Q=j("jointFilerSignatureDate"),X=j("accountType"),H=j("taxpayerNames"),U=j("primaryAddress"),Z=j("city"),ie=j("state"),G=j("zipCode"),W=j("country"),we=j("primaryPhone"),Ae=j("internationalAddress"),Le=e?en(e):"Entity",ce=!0,pe=!0,L=v.useMemo(()=>X0(ud),[]),fe=()=>{S("primaryContactName",H,{shouldValidate:!0}),S("primaryContactAddress",U,{shouldValidate:!0}),S("contactCity",Z,{shouldValidate:!0}),S("contactState",ie,{shouldValidate:!0}),S("contactZipCode",G,{shouldValidate:!0}),S("contactCountry",W,{shouldValidate:!0}),S("contactPhone",we,{shouldValidate:!0}),S("contactInternationalAddress",Ae??"",{shouldValidate:!0})},z=()=>{S("primaryContactName","",{shouldValidate:!0}),S("primaryContactAddress","",{shouldValidate:!0}),S("contactCity","",{shouldValidate:!0}),S("contactState","",{shouldValidate:!0}),S("contactZipCode","",{shouldValidate:!0}),S("contactCountry","",{shouldValidate:!0}),S("contactPhone","",{shouldValidate:!0}),S("contactInternationalAddress","",{shouldValidate:!0})};v.useEffect(()=>{p&&fe()},[p,H,U,Z,ie,G,W,we,Ae]);const ue=async()=>{await o.invalidateQueries({queryKey:["dashboard"]}),await o.invalidateQueries({queryKey:["federal-payments"]}),await o.invalidateQueries({queryKey:["remittance-payments"]})},Te=async()=>{if(!e)return null;if(t.federalPaymentId){const ae=await Hi(t.federalPaymentId,Xi(t));return await ue(),ae}const q=await Yi(Gi(e.entityId,t));return to({...t,federalPaymentId:q.federalPaymentId,enrollmentId:q.enrollmentId}),await ue(),q},Ge=async(q,ae)=>{var Ut;const Me=t.form9783EnrollmentId??((Ut=await ld(q))==null?void 0:Ut.form9783EnrollmentId);return Me?Nj(Me,Pj(ae)):jj(cd(q,ae))},Oe=async q=>{if(!e)return;const ae=await Te();ae&&(await Ge(ae.enrollmentId,q),await o.invalidateQueries({queryKey:["form-9783",ae.enrollmentId]}),no(),a(Je()))},le=C(async q=>{if(!(!e||r)){u(null),h(!0);try{await Oe(q)}catch(ae){u(nt(ae,"Failed to save federal payment draft."))}finally{h(!1)}}}),be=C(async q=>{if(!(!e||r)){u(null),h(!0);try{await Oe(q)}catch(ae){u(nt(ae,"Failed to save draft."))}finally{h(!1)}}});return s.jsxs("form",{onSubmit:le,noValidate:!0,className:"w-full space-y-6",children:[s.jsxs("div",{className:"relative w-full",children:[s.jsx("h2",{className:"mb-4 text-[28px] font-bold leading-tight text-slate-900 lg:pr-[324px]",children:Le}),s.jsx(Xr,{entity:e,remittanceAmount:c,className:"mb-4 w-full lg:absolute lg:top-0 lg:right-0 lg:mb-0 lg:w-[300px]"}),s.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:mr-[324px] lg:p-8",children:s.jsxs("fieldset",{disabled:r,className:"min-w-0 border-0 p-0",children:[s.jsxs(wn,{title:"1. Taxpayer Information",isFirst:!0,children:[s.jsxs("div",{className:bn,children:[s.jsx(J,{label:"1. a) Primary Social Security Number (SSN)",required:!0,error:(Ye=E.primarySsn)==null?void 0:Ye.message,children:s.jsx("input",{placeholder:"Enter number",readOnly:ce,className:ne(!!E.primarySsn,ce),...y("primarySsn")})}),s.jsx(J,{label:"1. b) Joint filer's taxpayer ID No (SSN)",children:s.jsx("input",{placeholder:"Other Identification number (optional)",readOnly:ce,className:ne(!1,ce),...y("jointFilerSsn")})}),s.jsx(J,{label:"2. Taxpayer(S) name(S)",required:!0,error:(re=E.taxpayerNames)==null?void 0:re.message,children:s.jsx("input",{placeholder:"Enter name",readOnly:ce,className:ne(!!E.taxpayerNames,ce),...y("taxpayerNames")})})]}),s.jsxs("div",{className:`mt-5 ${bn}`,children:[s.jsx("div",{className:"sm:col-span-2 xl:col-span-2",children:s.jsx(J,{label:"3. a) Primary taxpayer address",required:!0,error:(Ve=E.primaryAddress)==null?void 0:Ve.message,children:s.jsx("input",{placeholder:"Enter",readOnly:ce,className:ne(!!E.primaryAddress,ce),...y("primaryAddress")})})}),s.jsx(J,{label:"3. b) City or Town",required:!0,error:(rt=E.city)==null?void 0:rt.message,children:s.jsx("input",{placeholder:"Enter",readOnly:ce,className:ne(!!E.city,ce),...y("city")})})]}),s.jsxs("div",{className:`mt-5 ${bn}`,children:[s.jsx(J,{label:"3. c) State",required:!0,error:(vt=E.state)==null?void 0:vt.message,children:s.jsx("input",{placeholder:"Enter name",readOnly:ce,className:ne(!!E.state,ce),...y("state")})}),s.jsx(J,{label:"3. d) ZIP code",required:!0,error:(xt=E.zipCode)==null?void 0:xt.message,children:s.jsx("input",{placeholder:"Enter",readOnly:ce,className:ne(!!E.zipCode,ce),...y("zipCode")})}),s.jsx(J,{label:"3. e) Country",required:!0,error:(jt=E.country)==null?void 0:jt.message,children:s.jsx("input",{placeholder:"Enter",readOnly:ce,className:ne(!!E.country,ce),...y("country")})})]}),s.jsxs("div",{className:`mt-5 ${bn}`,children:[s.jsx("div",{className:"sm:col-span-2 xl:col-span-2",children:s.jsx(J,{label:"3. f) International address",children:s.jsx("input",{placeholder:"phone number (International number)",readOnly:ce,className:ne(!1,ce),...y("internationalAddress")})})}),s.jsx(J,{label:"4. Primary taxpayer phone number",required:!0,error:(Mt=E.primaryPhone)==null?void 0:Mt.message,children:s.jsx("input",{placeholder:"Enter number",readOnly:ce,className:ne(!!E.primaryPhone,ce),...y("primaryPhone")})})]})]}),s.jsxs(wn,{title:"2. Contact Information",headerAction:s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[s.jsx("input",{type:"checkbox",checked:p,disabled:r,onChange:q=>{const ae=q.target.checked;g(ae),ae?fe():z()},className:"h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200"}),"Same as Taxpayer Information"]}),children:[s.jsxs("div",{className:bn,children:[s.jsx(J,{label:"5. Primary contact name",required:!0,error:(wt=E.primaryContactName)==null?void 0:wt.message,children:s.jsx("input",{placeholder:"Payer Name",readOnly:p,className:ne(!!E.primaryContactName,p),...y("primaryContactName")})}),s.jsx(J,{label:"6. a) Primary contact address",required:!0,error:(qt=E.primaryContactAddress)==null?void 0:qt.message,children:s.jsx("input",{placeholder:"Payer Address",readOnly:p,className:ne(!!E.primaryContactAddress,p),...y("primaryContactAddress")})}),s.jsx(J,{label:"6. b) City or Town",required:!0,error:(Pt=E.contactCity)==null?void 0:Pt.message,children:s.jsx("input",{placeholder:"City",readOnly:p,className:ne(!!E.contactCity,p),...y("contactCity")})})]}),s.jsxs("div",{className:`mt-5 ${bn}`,children:[s.jsx(J,{label:"6. c) State",required:!0,error:(Et=E.contactState)==null?void 0:Et.message,children:s.jsx("input",{placeholder:"Payer State",readOnly:p,className:ne(!!E.contactState,p),...y("contactState")})}),s.jsx(J,{label:"6. d) ZIP code",required:!0,error:(It=E.contactZipCode)==null?void 0:It.message,children:s.jsx("input",{placeholder:"ZIP code",readOnly:p,className:ne(!!E.contactZipCode,p),...y("contactZipCode")})}),s.jsx(J,{label:"6. f) Country",required:!0,error:(Tt=E.contactCountry)==null?void 0:Tt.message,children:s.jsx("input",{placeholder:"Country",readOnly:p,className:ne(!!E.contactCountry,p),...y("contactCountry")})})]}),s.jsxs("div",{className:"mt-5 grid gap-x-6 gap-y-5 sm:grid-cols-3",children:[s.jsx(J,{label:"7. Primary taxpayer phone number",required:!0,error:(Bt=E.contactPhone)==null?void 0:Bt.message,children:s.jsx("input",{placeholder:"Payer Phone",readOnly:p,className:ne(!!E.contactPhone,p),...y("contactPhone")})}),s.jsx("div",{className:"sm:col-span-2",children:s.jsx(J,{label:"8. International address",children:s.jsx("input",{placeholder:"Phone Number (International number)",readOnly:p,className:ne(!1,p),...y("contactInternationalAddress")})})})]})]}),s.jsx(wn,{title:"Taxpayer Details *",children:s.jsxs("div",{className:Tj,children:[s.jsx(J,{label:"1. Primary Taxpayer Pin",required:!0,error:(Vt=E.primaryTaxpayerPin)==null?void 0:Vt.message,children:s.jsx(Ne,{name:"primaryTaxpayerPin",control:F,render:({field:q})=>s.jsx("input",{placeholder:"Primary Taxpayer Pin",inputMode:"numeric",className:ne(!!E.primaryTaxpayerPin),value:q.value,onChange:ae=>q.onChange(Yn(ae.target.value,_j)),onBlur:q.onBlur})})}),s.jsx(J,{label:"2. Date of Birth",required:!0,error:(Nt=E.dateOfBirth)==null?void 0:Nt.message,children:s.jsx("input",{type:"date",max:L,className:ne(!!E.dateOfBirth),...y("dateOfBirth")})}),s.jsx(J,{label:"3. Prior year adjusted gross income",required:!0,error:(f=E.priorYearAgi)==null?void 0:f.message,children:s.jsx("input",{placeholder:"Prior Year Adjusted Gross Income",inputMode:"decimal",className:ne(!!E.priorYearAgi),...y("priorYearAgi")})}),s.jsx(J,{label:"4. Prior Tax Year",required:!0,error:(N=E.agiTaxYear)==null?void 0:N.message,children:s.jsxs("select",{className:Hn(!!E.agiTaxYear),...y("agiTaxYear"),children:[s.jsx("option",{value:"",disabled:!0,children:"AGI Tax Year"}),Aj.map(q=>s.jsx("option",{value:q,children:q},q))]})})]})}),s.jsxs(wn,{title:"3. Social Security Number and Financial Institution Information",children:[s.jsxs("div",{className:bn,children:[s.jsx(J,{label:"9. Primary SSN",required:!0,error:(A=E.financialPrimarySsn)==null?void 0:A.message,children:s.jsx("input",{placeholder:"Enter number",readOnly:pe,className:ne(!!E.financialPrimarySsn,pe),...y("financialPrimarySsn")})}),s.jsx(J,{label:"10. Routing Transit Number (RTN)",required:!0,error:(R=E.routingTransitNumber)==null?void 0:R.message,children:s.jsx("input",{placeholder:"Enter number",readOnly:pe,className:ne(!!E.routingTransitNumber,pe),...y("routingTransitNumber")})}),s.jsx(J,{label:"11. Account Number",required:!0,error:(k=E.accountNumber)==null?void 0:k.message,children:s.jsx("input",{placeholder:"Enter",readOnly:pe,className:ne(!!E.accountNumber,pe),...y("accountNumber")})})]}),s.jsxs("div",{className:"mt-5",children:[s.jsx("p",{className:"mb-3 text-sm text-slate-600",children:"12. Type of Account"}),s.jsx("div",{className:"flex flex-wrap gap-6",children:["Checking","Savings"].map(q=>s.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[s.jsx("input",{type:"radio",value:q,checked:X===q,disabled:pe,onChange:()=>S("accountType",q,{shouldValidate:!0}),className:"h-4 w-4 border-slate-300 text-gov-600 focus:ring-gov-200 disabled:cursor-default"}),q]},q))}),E.accountType?s.jsx("p",{className:"mt-2 text-xs text-red-600",children:E.accountType.message}):null]})]}),s.jsxs("section",{className:"mt-8 border-t border-slate-100 pt-8",children:[s.jsx("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:"Authorization Agreement"}),s.jsx("p",{className:"mb-5 text-sm text-slate-600",children:"Read the following authorization agreements"}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"mb-3 text-sm font-semibold text-slate-900",children:"Disclosure Authorization Agreement"}),s.jsxs("label",{className:"flex items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...y("disclosureAgreementOne")}),s.jsx("span",{className:"text-sm leading-6 text-slate-700",children:Sj})]}),E.disclosureAgreementOne?s.jsx("p",{className:"mt-2 text-xs text-red-600",children:E.disclosureAgreementOne.message}):null]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-3 text-sm font-semibold text-slate-900",children:"Disclosure Authorization Agreement"}),s.jsxs("label",{className:"flex items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...y("disclosureAgreementTwo")}),s.jsx("span",{className:"text-sm leading-6 text-slate-700",children:kj})]}),E.disclosureAgreementTwo?s.jsx("p",{className:"mt-2 text-xs text-red-600",children:E.disclosureAgreementTwo.message}):null]}),s.jsxs("div",{className:"border-t border-slate-200 pt-6",children:[s.jsx("p",{className:"mb-3 text-sm font-semibold text-slate-900",children:"Authority to Execute an Authorization"}),s.jsxs("label",{className:"flex items-start gap-3",children:[s.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...y("authorityAgreement")}),s.jsx("span",{className:"text-sm leading-6 text-slate-700",children:Cj})]}),E.authorityAgreement?s.jsx("p",{className:"mt-2 text-xs text-red-600",children:E.authorityAgreement.message}):null]})]})]}),s.jsxs("section",{className:"mt-8 space-y-8 border-t border-slate-100 pt-8",children:[s.jsx(si,{label:"Taxpayer's Signature",required:!0,signature:y("taxpayerSignature"),title:y("taxpayerTitle"),date:y("taxpayerSignatureDate"),signatureValue:T,dateValue:V,errors:{signature:($=E.taxpayerSignature)==null?void 0:$.message,title:(M=E.taxpayerTitle)==null?void 0:M.message,date:(K=E.taxpayerSignatureDate)==null?void 0:K.message}}),s.jsx(si,{label:"Joint filer(s) Signature (Optional)",signature:y("jointFilerSignature"),title:y("jointFilerTitle"),date:y("jointFilerSignatureDate"),signatureValue:O??"",dateValue:Q??"",signatureCaption:"Signature of joint filer"})]})]})})]}),d?s.jsx("div",{className:"lg:mr-[324px]",children:s.jsx(zt,{message:d})}):null,s.jsxs("div",{className:"flex flex-wrap items-center gap-3 lg:mr-[324px]",children:[s.jsx("button",{type:"button",onClick:()=>a(l),disabled:m,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:be,disabled:m||!e||r,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Save as Draft"}),s.jsx("button",{type:"submit",disabled:m||!e||r,className:"inline-flex h-11 min-w-[180px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:"Review and Submit"})]})]})}function hd(){const{selectedEntity:e}=ft(),t=Se(),{paymentDraft:n}=t.state??{},r=n??ra(),{data:a,isLoading:i}=ge({queryKey:["federal-payment",r==null?void 0:r.federalPaymentId],queryFn:()=>Wi(r.federalPaymentId),enabled:(r==null?void 0:r.federalPaymentId)!=null&&r.enrollmentId==null}),o=(r==null?void 0:r.enrollmentId)??(a==null?void 0:a.enrollmentId),{data:l,isLoading:c}=ge({queryKey:["form-9783",o],queryFn:()=>ld(o),enabled:o!=null}),d=v.useMemo(()=>r?{...r,enrollmentId:o??r.enrollmentId,form9783EnrollmentId:r.form9783EnrollmentId??(l==null?void 0:l.form9783EnrollmentId)}:null,[r,o,l]);return r?e&&!Ji(e)?s.jsx(Be,{to:"/payments/federal/authorization",replace:!0,state:t.state}):r.federalPaymentId!=null&&r.enrollmentId==null&&i||o!=null&&c?s.jsx("p",{className:"text-sm text-slate-600",children:"Loading enrollment form…"}):s.jsx(Fj,{entity:e,paymentDraft:d??r,initialEnrollment:l}):s.jsx(Be,{to:"/payments/federal/new",replace:!0})}function Rj(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function Lj({type:e}){return s.jsx("span",{className:"inline-flex rounded-full bg-gov-50 px-2.5 py-0.5 text-xs font-medium text-gov-700",children:e})}function $j({status:e}){const t=e.toLowerCase();let n="bg-slate-100 text-slate-600";return t.includes("submitted to state")||t.includes("submitted to fed")?n="bg-orange-50 text-orange-700":t.includes("irs accepted")?n="bg-emerald-50 text-emerald-700":t.includes("irs rejected")?n="bg-red-50 text-red-600":t.includes("pending")&&(n="bg-amber-50 text-amber-700"),s.jsx("span",{className:`inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium ${n}`,children:e})}function Oj({forms:e=[],isLoading:t=!1,isError:n=!1}){return s.jsx("div",{className:"overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[960px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[s.jsx("th",{className:"px-6 py-3",children:"File Name"}),s.jsx("th",{className:"px-6 py-3",children:"Type"}),s.jsx("th",{className:"px-6 py-3",children:"Client"}),s.jsx("th",{className:"px-6 py-3",children:"Status"}),s.jsx("th",{className:"px-6 py-3",children:"Date"}),s.jsx("th",{className:"px-6 py-3",children:"Action"})]})}),s.jsx("tbody",{children:t?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-slate-500",children:"Loading tax forms…"})}):n?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-slate-500",children:"Unable to load tax forms."})}):e.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-6 py-12 text-center text-slate-500",children:"No tax forms to display yet."})}):e.map(r=>s.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[s.jsx("td",{className:"px-6 py-4",children:s.jsxs("div",{className:"flex items-center gap-3 font-medium text-slate-900",children:[s.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gov-50 text-gov-600",children:s.jsx(zj,{className:"h-4 w-4"})}),r.fileName]})}),s.jsx("td",{className:"px-6 py-4",children:s.jsx(Lj,{type:r.type})}),s.jsx("td",{className:"px-6 py-4 text-slate-700",children:r.client}),s.jsx("td",{className:"px-6 py-4",children:s.jsx($j,{status:r.status})}),s.jsx("td",{className:"px-6 py-4 text-slate-600",children:Rj(r.date)}),s.jsx("td",{className:"px-6 py-4",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("button",{type:"button",className:"rounded-full border border-gov-200 bg-gov-50 px-4 py-1.5 text-xs font-semibold text-gov-600 transition hover:bg-gov-100",children:"View PDF"}),r.canSubmit?s.jsx("button",{type:"button",className:"rounded-full bg-gov-600 px-4 py-1.5 text-xs font-semibold text-white transition hover:bg-gov-700",children:"Submit"}):null]})})]},r.taxFormId))})]})})})}function zj({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V6A2.25 2.25 0 014.5 3.75h4.379a2.25 2.25 0 011.59.659l1.122 1.122A2.25 2.25 0 0013.128 6H19.5a2.25 2.25 0 012.25 2.25v10.5A2.25 2.25 0 0119.5 21H4.5a2.25 2.25 0 01-2.25-2.25v-6.75z"})})}function Mj(){return s.jsx(Oj,{})}const Cl=160,qj=88,hs=8;function Bj({account:e,entityId:t,onEdit:n}){const r=pt(),{showSuccess:a,showError:i}=Vs(),o=v.useRef(null),l=v.useRef(null),[c,d]=v.useState(!1),[u,m]=v.useState(!1),[h,p]=v.useState({}),g=()=>{var I;const b=o.current;if(!b)return;const y=b.getBoundingClientRect(),C=((I=l.current)==null?void 0:I.offsetHeight)??qj,S=window.innerHeight-y.bottom<C+hs;p({position:"fixed",top:S?y.top-C-hs:y.bottom+hs,left:Math.max(hs,y.right-Cl),width:Cl,zIndex:50})};v.useLayoutEffect(()=>{c&&(g(),requestAnimationFrame(g))},[c]),v.useEffect(()=>{if(!c)return;const b=C=>{var S,I;const j=C.target;(S=o.current)!=null&&S.contains(j)||(I=l.current)!=null&&I.contains(j)||d(!1)},y=()=>g();return document.addEventListener("mousedown",b),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),()=>{document.removeEventListener("mousedown",b),window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[c]);const x=async()=>{const b=br(e);m(!0);try{await Pu(e.bankAccountDetailId,{status:Iv(e)}),await r.invalidateQueries({queryKey:["bank-accounts",t]}),d(!1),b?a("Bank Account Deactivated","Bank account deactivated successfully."):a("Bank Account Activated","Bank account activated successfully.")}catch(y){i("Action Not Completed",nt(y,"Cannot deactivate this bank account because it is linked to a payment that has not been accepted yet."))}finally{m(!1)}};return s.jsxs("div",{className:"inline-block text-left",children:[s.jsxs("button",{ref:o,type:"button",disabled:u,onClick:()=>d(b=>!b),className:"inline-flex items-center gap-1.5 rounded-lg bg-gov-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:["Actions",s.jsx(Vj,{})]}),c?qr.createPortal(s.jsxs("div",{ref:l,style:h,className:"overflow-hidden rounded-lg border border-slate-200 bg-white py-1 shadow-lg",children:[s.jsx("button",{type:"button",onClick:()=>{d(!1),n(e)},className:"block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-50",children:"Edit"}),s.jsx("button",{type:"button",disabled:u,onClick:()=>void x(),className:"block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-50 disabled:opacity-60",children:Tv(e)})]}),document.body):null]})}function Vj(){return s.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})}const fd=["Checking","Savings"],Uj=Xt({accountNumber:_().min(1,"Account number is required").regex(/^\d{1,17}$/,`Account number must be 1 to ${ur} digits`),routingNumber:_().min(1,"Routing number is required").regex(/^\d{9}$/,"Routing number must be exactly 9 digits"),accountType:Xs(fd,{message:"Account type is required"}),bankName:_().min(1,"Bank name is required")});function Zj({open:e,account:t,onClose:n}){const r=pt(),{showSuccess:a,showError:i}=Vs(),[o,l]=v.useState(null),[c,d]=v.useState(!1),{control:u,handleSubmit:m,reset:h,formState:{errors:p}}=Lt({resolver:Ot(Uj),defaultValues:{accountNumber:"",routingNumber:"",accountType:"Checking",bankName:""}});v.useEffect(()=>{!e||!t||(h({accountNumber:t.accountNumber,routingNumber:t.routingNumber,accountType:t.accountType==="Savings"?"Savings":"Checking",bankName:t.bankName}),l(null))},[t,e,h]),v.useEffect(()=>{if(!e)return;const x=b=>{b.key==="Escape"&&n()};return document.addEventListener("keydown",x),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",x),document.body.style.overflow=""}},[e,n]);const g=m(async x=>{if(t){l(null),d(!0);try{await Pu(t.bankAccountDetailId,{bankName:x.bankName.trim(),accountNumber:x.accountNumber,routingNumber:x.routingNumber,accountType:x.accountType}),await r.invalidateQueries({queryKey:["bank-accounts",t.entityId]}),a("Bank Account Updated","Bank account updated successfully."),n()}catch(b){const y=nt(b,"Unable to update bank account.");l(y),i("Action Not Completed",y)}finally{d(!1)}}});return!e||!t?null:qr.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[s.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:n}),s.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edit-bank-account-title",className:"relative z-10 flex max-h-[90vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl bg-white shadow-xl",children:[s.jsxs("div",{className:"border-b border-slate-200 px-6 py-5",children:[s.jsx("h2",{id:"edit-bank-account-title",className:"text-lg font-bold text-slate-900",children:"Edit Bank Account"}),s.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Update bank account details."})]}),s.jsxs("form",{noValidate:!0,onSubmit:x=>{x.preventDefault(),g(x)},className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs("div",{className:"overflow-y-auto px-6 py-6",children:[o?s.jsx("div",{className:"mb-5",children:s.jsx(zt,{message:o})}):null,s.jsxs(lu,{title:"Bank Account",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsx(Ne,{name:"accountNumber",control:u,render:({field:x})=>{var b;return s.jsx(he,{label:"Account Number",required:!0,placeholder:"Bank account number",inputMode:"numeric",autoComplete:"off",value:x.value,onChange:y=>x.onChange(Yn(y.target.value,ur)),onBlur:x.onBlur,error:(b=p.accountNumber)==null?void 0:b.message})}}),s.jsx(Ne,{name:"routingNumber",control:u,render:({field:x})=>{var b;return s.jsx(he,{label:"Routing Number",required:!0,placeholder:"9-digit ABA",inputMode:"numeric",autoComplete:"off",value:x.value,onChange:y=>x.onChange(Yn(y.target.value,Eu)),onBlur:x.onBlur,error:(b=p.routingNumber)==null?void 0:b.message})}}),s.jsx(Ne,{name:"accountType",control:u,render:({field:x})=>{var b;return s.jsx(xn,{label:"Account Type",required:!0,value:x.value,onChange:x.onChange,onBlur:x.onBlur,error:(b=p.accountType)==null?void 0:b.message,children:fd.map(y=>s.jsx("option",{value:y,children:y},y))})}})]}),s.jsx(Ne,{name:"bankName",control:u,render:({field:x})=>{var b;return s.jsx(he,{label:"Account / Bank Name",required:!0,placeholder:"e.g. Chase Bank",value:x.value,onChange:x.onChange,onBlur:x.onBlur,error:(b=p.bankName)==null?void 0:b.message})}})]})]}),s.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-slate-200 px-6 py-4",children:[s.jsx("button",{type:"button",onClick:n,disabled:c,className:"inline-flex h-11 items-center justify-center rounded-lg border border-slate-200 bg-white px-6 text-sm font-semibold text-slate-700 transition hover:bg-slate-50 disabled:opacity-60",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:c,className:"inline-flex h-11 items-center justify-center rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:opacity-60",children:c?"Saving…":"Save Changes"})]})]})]})]}),document.body)}const $n=[{id:"bank-accounts",title:"Bank Accounts",subtitle:"Connected bank accounts",icon:Wj},{id:"tax-accounts",title:"Tax Accounts",subtitle:"IRS & state tax accounts",icon:Yj},{id:"payment-history",title:"Payment History",subtitle:"Past payment transactions",icon:Hj},{id:"entity-details",title:"Entity Details",subtitle:"Your account details",icon:Kj}];function Wj({className:e,...t}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",...t,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5z"})})}function Yj({className:e,...t}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",...t,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 21h19.5m-18-18v18m10.5-18v18m6-13.5V21M6.75 6.75h.75m-.75 3h.75m-.75 3h.75m3-6h.75m-.75 3h.75m-.75 3h.75M6.75 21v-3.375c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21M3 21h18M12 3l9 4.5v1.5H3V7.5L12 3z"})})}function Hj({className:e,...t}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",...t,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function Kj({className:e,...t}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",...t,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}function dr({title:e,subtitle:t,icon:n,action:r}){return s.jsxs("div",{className:"mb-6 flex flex-wrap items-start justify-between gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gov-50 text-gov-600",children:s.jsx(n,{className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-bold text-slate-900",children:e}),s.jsx("p",{className:"text-sm text-slate-500",children:t})]})]}),r]})}function Qj(e){return`******${e.replace(/\D/g,"").slice(-4)||e.slice(-4)}`}function Jj({status:e}){const t=br({status:e});return s.jsx("span",{className:`inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium ${t?"bg-emerald-50 text-emerald-700":"bg-red-50 text-red-600"}`,children:t?"Active":"In-active"})}function Gj({entityId:e}){const[t,n]=v.useState(!1),[r,a]=v.useState(null),[i,o]=v.useState(1),[l,c]=v.useState(it),d=$n.find(C=>C.id==="bank-accounts"),u=d.icon;v.useEffect(()=>{o(1)},[e,l]);const{data:m,isLoading:h,isError:p,isFetching:g}=ge({queryKey:["bank-accounts",e,i,l],queryFn:()=>Jr({entityId:e,pageNumber:i,pageSize:l}),enabled:e!==null,placeholderData:C=>C}),x=(m==null?void 0:m.items)??[],b=(m==null?void 0:m.totalCount)??0,y=e!==null&&g;return s.jsxs("div",{children:[s.jsx(dr,{title:d.title,subtitle:d.subtitle,icon:u,action:s.jsxs("button",{type:"button",disabled:!e,onClick:()=>n(!0),className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsx(Xj,{}),"Add Bank Account"]})}),s.jsx(Tu,{open:t,entityId:e,onClose:()=>n(!1)}),s.jsx(Zj,{open:r!==null,account:r,onClose:()=>a(null)}),s.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-slate-200",children:[y?s.jsx(yr,{label:"Loading bank accounts…"}):null,s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[700px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[s.jsx("th",{className:"px-5 py-3",children:"Bank"}),s.jsx("th",{className:"px-5 py-3",children:"Account"}),s.jsx("th",{className:"px-5 py-3",children:"Routing"}),s.jsx("th",{className:"px-5 py-3",children:"Type"}),s.jsx("th",{className:"px-5 py-3",children:"Status"}),s.jsx("th",{className:"px-5 py-3"})]})}),s.jsx("tbody",{children:h&&!m?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-5 py-12 text-center text-slate-500",children:"Loading bank accounts…"})}):p?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-5 py-12 text-center text-slate-500",children:"Unable to load bank accounts."})}):e?x.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-5 py-12 text-center text-slate-500",children:"No bank accounts connected yet."})}):x.map(C=>s.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[s.jsx("td",{className:"px-5 py-4 font-medium text-slate-900",children:C.bankName}),s.jsx("td",{className:"px-5 py-4 text-slate-600",children:Qj(C.accountNumber)}),s.jsx("td",{className:"px-5 py-4 text-slate-600",children:C.routingNumber}),s.jsx("td",{className:"px-5 py-4 text-slate-600",children:C.accountType}),s.jsx("td",{className:"px-5 py-4",children:s.jsx(Jj,{status:C.status})}),s.jsx("td",{className:"px-5 py-4 text-right",children:s.jsx(Bj,{account:C,entityId:e,onEdit:a})})]},C.bankAccountDetailId)):s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-5 py-12 text-center text-slate-500",children:"Create an entity to manage bank accounts."})})})]})}),e!==null?s.jsx(Qr,{page:i,pageSize:l,totalCount:b,onPageChange:o,onPageSizeChange:c,disabled:h||g}):null]})]})}function Xj(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}function e1({icon:e}){const t="h-5 w-5 text-gov-600";return e==="phone"?s.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"})}):e==="account"?s.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}):s.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})})}function Cr({label:e,value:t,icon:n}){return s.jsx("div",{className:"rounded-xl border border-slate-200 bg-[#F9FAFB] px-4 py-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gov-50",children:s.jsx(e1,{icon:n})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-xs text-slate-500",children:e}),s.jsx("p",{className:"mt-1 break-words text-sm font-semibold text-slate-900",children:t||"—"})]})]})})}function t1(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"—"}function n1({entity:e}){const[t,n]=v.useState(!1),r=$n.find(c=>c.id==="entity-details"),a=r.icon;if(!e)return s.jsxs("div",{children:[s.jsx(dr,{title:r.title,subtitle:r.subtitle,icon:a}),s.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 bg-slate-50/50 px-6 py-16 text-center",children:s.jsx("p",{className:"text-sm text-slate-500",children:"Select an entity to view its details."})})]});const i=en(e),o=e.accountType==="Business"?i:`${e.firstName} ${e.lastName}`.trim()||i,l=Oi(o);return s.jsxs("div",{children:[s.jsx(dr,{title:r.title,subtitle:r.subtitle,icon:a,action:s.jsx("button",{type:"button",onClick:()=>n(!0),className:"inline-flex items-center rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700",children:"Edit"})}),s.jsxs("div",{className:"mb-8 flex items-center gap-4 border-b border-slate-100 pb-8",children:[s.jsx("span",{className:"flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-gov-600 text-xl font-semibold text-white",children:l}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-xl font-bold text-slate-900",children:o}),s.jsx("p",{className:"mt-1 text-sm text-slate-500",children:e.email})]})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:[s.jsx(Cr,{label:"Entity Name",value:i,icon:"entity"}),s.jsx(Cr,{label:e.accountType==="Individual"?"SSN":"Tax ID",value:Hr(e.idNumber,e.accountType),icon:"tax"}),s.jsx(Cr,{label:"Email Address",value:e.email,icon:"email"}),s.jsx(Cr,{label:"Phone Number",value:Ln(e.phoneNumber),icon:"phone"}),s.jsx(Cr,{label:"Account Type",value:t1(e.accountType),icon:"account"})]}),s.jsx(ku,{open:t,entity:e,onClose:()=>n(!1)})]})}function pd({activeSection:e,onSectionChange:t,items:n}){return s.jsx("nav",{className:"space-y-2",children:n.map(r=>{const a=e===r.id,i=r.icon;return s.jsxs("button",{type:"button",onClick:()=>t(r.id),className:`flex w-full items-center gap-3 rounded-xl border px-4 py-3.5 text-left transition ${a?"border-gov-200 bg-gov-50 shadow-sm":"border-slate-200 bg-white hover:border-slate-300 hover:bg-slate-50"}`,children:[s.jsx("span",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg ${a?"bg-gov-600 text-white":"bg-slate-100 text-slate-500"}`,children:s.jsx(i,{className:"h-5 w-5"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:`block text-sm font-semibold ${a?"text-slate-900":"text-slate-700"}`,children:r.title}),s.jsx("span",{className:"block truncate text-xs text-slate-500",children:r.subtitle})]}),s.jsx(r1,{className:`h-4 w-4 shrink-0 ${a?"text-gov-600":"text-slate-300"}`})]},r.id)})})}function r1({className:e}){return s.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}function s1({entityId:e}){const t=$n.find(r=>r.id==="payment-history"),n=t.icon;return s.jsxs("div",{children:[s.jsx(dr,{title:t.title,subtitle:t.subtitle,icon:n,action:s.jsxs("button",{type:"button",disabled:!0,className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsx(a1,{}),"Export to Excel"]})}),s.jsx("div",{className:"relative overflow-hidden rounded-xl border border-slate-200",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[900px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[s.jsx("th",{className:"px-5 py-3",children:"Date"}),s.jsx("th",{className:"px-5 py-3",children:"Amount"}),s.jsx("th",{className:"px-5 py-3",children:"Jurisdiction / Type"}),s.jsx("th",{className:"px-5 py-3",children:"Type"}),s.jsx("th",{className:"px-5 py-3",children:"Account Name"}),s.jsx("th",{className:"px-5 py-3",children:"Reference"})]})}),s.jsx("tbody",{children:e?s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-5 py-12 text-center text-slate-500",children:"No payment transactions to display yet."})}):s.jsx("tr",{children:s.jsx("td",{colSpan:6,className:"px-5 py-12 text-center text-slate-500",children:"Create an entity to view payment history."})})})]})})})]})}function a1(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"})})}function i1({entityId:e,pageNumber:t=1,pageSize:n=it}){const r=new URLSearchParams({entityId:String(e),pageNumber:String(t),pageSize:String(n)});return de(`/portal/tax-accounts?${r}`)}function o1(e){return de(`/portal/tax-accounts/${e}`)}function l1(e){return de("/portal/tax-accounts",{method:"POST",body:e})}function c1(e,t){return de(`/portal/tax-accounts/${e}`,{method:"PATCH",body:t})}function u1({entityId:e}){const t=ke(),n=$n.find(p=>p.id==="tax-accounts"),r=n.icon,[a,i]=v.useState(1),[o,l]=v.useState(it);v.useEffect(()=>{i(1)},[e,o]);const{data:c,isLoading:d,isError:u}=ge({queryKey:["tax-accounts",e,a,o],queryFn:()=>i1({entityId:e,pageNumber:a,pageSize:o}),enabled:e!==null}),m=(c==null?void 0:c.items)??[],h=(c==null?void 0:c.totalCount)??0;return s.jsxs("div",{children:[s.jsx(dr,{title:n.title,subtitle:n.subtitle,icon:r,action:s.jsxs("button",{type:"button",disabled:!e,onClick:()=>t("/settings/tax-accounts/new"),className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:[s.jsx(d1,{}),"Add Tax Account"]})}),s.jsxs("div",{className:"overflow-hidden rounded-xl border border-slate-200",children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[s.jsx("th",{className:"px-5 py-3",children:"Account Name"}),s.jsx("th",{className:"px-5 py-3",children:"Federal/State ID"}),s.jsx("th",{className:"px-5 py-3",children:"Payments"}),s.jsx("th",{className:"px-5 py-3",children:"Form Type"}),s.jsx("th",{className:"px-5 py-3",children:"Actions"})]})}),s.jsx("tbody",{children:e===null?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"px-5 py-12 text-center text-slate-500",children:"Create an entity to manage tax accounts."})}):d?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"px-5 py-12 text-center text-slate-500",children:"Loading tax accounts…"})}):u?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"px-5 py-12 text-center text-slate-500",children:"Unable to load tax accounts."})}):h===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"px-5 py-12 text-center text-slate-500",children:"No tax accounts connected yet."})}):m.map(p=>s.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[s.jsx("td",{className:"px-5 py-4 font-medium text-slate-900",children:p.state}),s.jsx("td",{className:"px-5 py-4 text-slate-600",children:p.taxAccountDetailId}),s.jsx("td",{className:"px-5 py-4 text-slate-600",children:p.status}),s.jsx("td",{className:"px-5 py-4 text-slate-600",children:p.state}),s.jsx("td",{className:"px-5 py-4",children:s.jsx("button",{type:"button",onClick:()=>t(`/settings/tax-accounts/${p.taxAccountDetailId}/edit`),className:"rounded-md px-2.5 py-1.5 text-sm font-medium text-gov-600 transition hover:bg-gov-50 hover:text-gov-700",children:"Edit"})})]},p.taxAccountDetailId))})]})}),e!==null?s.jsx(Qr,{page:a,pageSize:o,totalCount:h,onPageChange:i,onPageSizeChange:l,disabled:d}):null]})]})}function d1(){return s.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}const Al="rounded-2xl border border-slate-200 bg-white shadow-sm";function m1(e){return e==="bank-accounts"||e==="tax-accounts"||e==="payment-history"||e==="entity-details"}function oo(){const{selectedEntity:e}=ft(),n=Se().state,[r,a]=v.useState(m1(n==null?void 0:n.section)?n.section:"bank-accounts");return s.jsxs("div",{className:"grid items-start gap-5 lg:grid-cols-[300px_minmax(0,1fr)]",children:[s.jsx("div",{className:`${Al} p-3`,children:s.jsx(pd,{items:$n,activeSection:r,onSectionChange:a})}),s.jsx("div",{className:`${Al} p-6 lg:p-8`,children:r==="bank-accounts"?s.jsx(Gj,{entityId:(e==null?void 0:e.entityId)??null}):r==="tax-accounts"?s.jsx(u1,{entityId:(e==null?void 0:e.entityId)??null}):r==="payment-history"?s.jsx(s1,{entityId:(e==null?void 0:e.entityId)??null}):s.jsx(n1,{entity:e})})]})}function h1({label:e,value:t,onChange:n,options:r,required:a=!1,disabled:i=!1,error:o,placeholder:l="Select a state"}){var C;const[c,d]=v.useState(!1),[u,m]=v.useState(""),h=v.useRef(null),p=v.useRef(null),g=v.useId(),x=(C=r.find(j=>j.code===t))==null?void 0:C.name,b=v.useMemo(()=>{const j=u.trim().toLowerCase();return j?r.filter(S=>S.name.toLowerCase().includes(j)||S.code.toLowerCase().includes(j)):r},[u,r]);v.useEffect(()=>{var j;c&&((j=p.current)==null||j.focus())},[c]),v.useEffect(()=>{if(!c)return;const j=S=>{var I;(I=h.current)!=null&&I.contains(S.target)||d(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[c]);const y=j=>{n(j),m(""),d(!1)};return s.jsxs("div",{ref:h,className:"relative",children:[s.jsx(Yr,{label:e,required:a,htmlFor:g}),s.jsxs("button",{id:g,type:"button",disabled:i,onClick:()=>{m(""),d(j=>!j)},className:`flex w-full items-center justify-between rounded-lg border bg-white px-3 py-2.5 text-left text-sm transition focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:cursor-not-allowed disabled:opacity-60 ${o?"border-red-300":"border-slate-200 focus:border-gov-400"}`,children:[s.jsx("span",{className:x?"text-slate-900":"text-slate-400",children:x??l}),s.jsx(f1,{open:c})]}),c?s.jsxs("div",{className:"absolute left-0 right-0 z-20 mt-2 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-lg",children:[s.jsx("div",{className:"border-b border-slate-100 p-2",children:s.jsx("input",{ref:p,type:"search",value:u,onChange:j=>m(j.target.value),onKeyDown:j=>{j.key==="Escape"?d(!1):j.key==="Enter"&&j.preventDefault()},placeholder:"Search by state name or code","aria-label":"Search states",className:"w-full rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-gov-400 focus:bg-white focus:ring-2 focus:ring-gov-100"})}),s.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[b.map(j=>s.jsxs("button",{type:"button",onClick:()=>y(j.code),className:`flex w-full items-center justify-between px-4 py-3 text-left text-sm transition hover:bg-slate-50 ${t===j.code?"bg-gov-50 text-gov-700":"text-slate-700"}`,children:[s.jsx("span",{children:j.name}),s.jsx("span",{className:"text-xs font-medium text-slate-400",children:j.code})]},j.code)),b.length===0?s.jsx("p",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No states found."}):null]})]}):null,o?s.jsx("p",{className:"mt-1 text-xs text-red-600",children:o}):null]})}function f1({open:e}){return s.jsx("svg",{className:`h-4 w-4 shrink-0 text-slate-400 transition ${e?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Pl({title:e,subtitle:t,children:n,className:r=""}){return s.jsxs("section",{className:`rounded-xl border border-slate-200 bg-white ${r}`,children:[s.jsxs("div",{className:"border-b border-slate-100 px-5 py-4",children:[s.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:e}),t?s.jsx("p",{className:"mt-0.5 text-xs text-slate-500",children:t}):null]}),s.jsx("div",{className:"space-y-5 p-5",children:n})]})}const p1=[{title:"Business Registration",fields:[{name:"virginiaTaxAccountId",label:"Virginia Tax Account ID",required:!0,placeholder:"e.g. 30123456789"},{name:"businessLocationCode",label:"Business Location Code",required:!0,placeholder:"e.g. 001"},{name:"virginiaDepartmentOfTaxationClientNumber",label:"Virginia Department of Taxation Client Number",required:!0,placeholder:"e.g. 12345678"}]},{title:"Payroll / Withholding",fields:[{name:"virginiaWithholdingAccountingId",label:"Virginia Withholding Accounting ID",required:!0,placeholder:"e.g. 30123456789-WTH"},{name:"unemploymentTaxAccountId",label:"Unemployment Tax Account ID",required:!0,placeholder:"e.g. 1234567"}]},{title:"Sales and Franchise Tax",fields:[{name:"franchiseTaxAccount",label:"Franchise Tax Account",required:!0,placeholder:"e.g. 30123456789-FRN"},{name:"transientOccupancyTaxAccountId",label:"Transient Occupancy Tax Account ID",required:!1,placeholder:"e.g. 30123456789-TOT"}]},{title:"Other Registrations",fields:[{name:"certificateOfAuthorityNumber",label:"Certificate of Authority Number (Foreign Entities)",required:!1,placeholder:"e.g. F123456789"},{name:"licensedProfessionalEmployerEntityNumber",label:"Licensed Professional Employer (POE) Entity Number",required:!1,placeholder:"e.g. POE-00123"}]}],x1={VA:p1},g1="United States",y1=Xt({state:_().min(1,"State is required"),city:_().min(1,"City is required"),zipCode:_().min(1,"ZIP code is required"),address1:_().min(1,"Address Line 1 is required"),address2:_().optional(),virginiaTaxAccountId:_().optional(),virginiaWithholdingAccountingId:_().optional(),unemploymentTaxAccountId:_().optional(),virginiaDepartmentOfTaxationClientNumber:_().optional(),businessLocationCode:_().optional(),franchiseTaxAccount:_().optional(),transientOccupancyTaxAccountId:_().optional(),certificateOfAuthorityNumber:_().optional(),licensedProfessionalEmployerEntityNumber:_().optional()}),b1=y1.superRefine((e,t)=>{if(bu.test(e.zipCode.trim())||t.addIssue({code:dt.custom,message:"Enter a 5-digit ZIP or ZIP+4 (e.g. 12345 or 12345-6789)",path:["zipCode"]}),e.state!=="VA")return;const n=[{key:"virginiaTaxAccountId",label:"Virginia Tax Account ID"},{key:"virginiaWithholdingAccountingId",label:"Virginia Withholding Accounting ID"},{key:"unemploymentTaxAccountId",label:"Unemployment Tax Account ID"},{key:"virginiaDepartmentOfTaxationClientNumber",label:"Virginia Department of Taxation Client Number"},{key:"businessLocationCode",label:"Business Location Code"},{key:"franchiseTaxAccount",label:"Franchise Tax Account"}];for(const r of n){const a=e[r.key];(typeof a!="string"||!a.trim())&&t.addIssue({code:dt.custom,message:`${r.label} is required`,path:[r.key]})}}),v1={state:"VA",city:"",zipCode:"",address1:"",address2:"",virginiaTaxAccountId:"",virginiaWithholdingAccountingId:"",unemploymentTaxAccountId:"",virginiaDepartmentOfTaxationClientNumber:"",businessLocationCode:"",franchiseTaxAccount:"",transientOccupancyTaxAccountId:"",certificateOfAuthorityNumber:"",licensedProfessionalEmployerEntityNumber:""};function j1(e){const t=e.virginia;return{state:e.state,city:e.city,zipCode:e.zipCode,address1:e.address1,address2:e.address2??"",virginiaTaxAccountId:(t==null?void 0:t.virginiaTaxAccountId)??"",virginiaWithholdingAccountingId:(t==null?void 0:t.virginiaWithholdingAccountingId)??"",unemploymentTaxAccountId:(t==null?void 0:t.unemploymentTaxAccountId)??"",virginiaDepartmentOfTaxationClientNumber:(t==null?void 0:t.virginiaDepartmentOfTaxationClientNumber)??"",businessLocationCode:(t==null?void 0:t.businessLocationCode)??"",franchiseTaxAccount:(t==null?void 0:t.franchiseTaxAccount)??"",transientOccupancyTaxAccountId:(t==null?void 0:t.transientOccupancyTaxAccountId)??"",certificateOfAuthorityNumber:(t==null?void 0:t.certificateOfAuthorityNumber)??"",licensedProfessionalEmployerEntityNumber:(t==null?void 0:t.licensedProfessionalEmployerEntityNumber)??""}}const ys=e=>{const t=e==null?void 0:e.trim();return t||null};function w1(e){var t,n,r,a,i,o;if(e.state==="VA")return{virginiaTaxAccountId:((t=e.virginiaTaxAccountId)==null?void 0:t.trim())??"",virginiaWithholdingAccountingId:((n=e.virginiaWithholdingAccountingId)==null?void 0:n.trim())??"",unemploymentTaxAccountId:((r=e.unemploymentTaxAccountId)==null?void 0:r.trim())??"",virginiaDepartmentOfTaxationClientNumber:((a=e.virginiaDepartmentOfTaxationClientNumber)==null?void 0:a.trim())??"",businessLocationCode:((i=e.businessLocationCode)==null?void 0:i.trim())??"",franchiseTaxAccount:((o=e.franchiseTaxAccount)==null?void 0:o.trim())??"",transientOccupancyTaxAccountId:ys(e.transientOccupancyTaxAccountId),certificateOfAuthorityNumber:ys(e.certificateOfAuthorityNumber),licensedProfessionalEmployerEntityNumber:ys(e.licensedProfessionalEmployerEntityNumber)}}function N1({entityId:e,taxAccountDetailId:t,initialValues:n,onCancel:r,onSuccess:a}){var O,V,Q,X,H,U;const{showSuccess:i}=Vs(),o=pt(),l=t!=null,[c,d]=v.useState(null),[u,m]=v.useState(!1),{register:h,handleSubmit:p,watch:g,setValue:x,formState:{errors:b}}=Lt({resolver:Ot(b1),defaultValues:n??v1}),y=h("zipCode"),C=g("state"),j=g("zipCode"),S=qi(g1),I=x1[C],F=((O=S.find(Z=>Z.code===C))==null?void 0:O.name)??C,E=C.length>0&&j.trim().length>0&&!cr(S,C,j),T=p(async Z=>{if(d(null),!cr(S,Z.state,Z.zipCode)){d(`ZIP code does not match the selected state (${Z.state}).`);return}m(!0);try{const ie={state:Z.state,city:Z.city.trim(),zipCode:Z.zipCode.trim(),address1:Z.address1.trim(),address2:ys(Z.address2),virginia:w1(Z)};if(l)await c1(t,ie);else{const G={entityId:e,...ie};await l1(G)}await o.invalidateQueries({queryKey:["tax-accounts",e]}),i(l?"Tax Account Updated":"Tax Account Added",l?"Tax account details were updated successfully.":"Tax account was created successfully."),a==null||a()}catch(ie){d(nt(ie,"Unable to save tax account. Please try again."))}finally{m(!1)}});return s.jsxs("form",{onSubmit:T,noValidate:!0,className:"max-w-4xl space-y-6",children:[c?s.jsx(zt,{message:c}):null,s.jsxs("div",{children:[s.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Tax jurisdiction"}),s.jsx("div",{className:"max-w-xs",children:s.jsx(h1,{label:"State",required:!0,value:C,onChange:Z=>x("state",Z,{shouldValidate:!0}),options:S.map(Z=>({code:Z.code,name:Z.name})),error:(V=b.state)==null?void 0:V.message})})]}),s.jsxs(Pl,{title:"Common Information",subtitle:"Applies to every state this entity is registered in.",children:[s.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[s.jsx(he,{label:"City",required:!0,placeholder:"e.g. Richmond",error:(Q=b.city)==null?void 0:Q.message,...h("city")}),s.jsx(he,{label:"Zip Code",required:!0,maxLength:10,placeholder:"12345 or 12345-6789",error:((X=b.zipCode)==null?void 0:X.message)??(E?`ZIP code does not match the selected state (${C}).`:void 0),...y,onChange:Z=>{Z.target.value=Mi(Z.target.value),y.onChange(Z)}})]}),s.jsx(he,{label:"Address Line 1",required:!0,placeholder:"e.g. 123 Main Street",error:(H=b.address1)==null?void 0:H.message,...h("address1")}),s.jsx(he,{label:"Address Line 2",placeholder:"Suite, unit, etc. (optional)",error:(U=b.address2)==null?void 0:U.message,...h("address2")})]}),I?s.jsx(Pl,{title:`${F} Tax Registration`,children:I.map((Z,ie)=>s.jsxs("div",{className:ie>0?"border-t border-slate-100 pt-5":"",children:[s.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wide text-gov-700",children:Z.title}),s.jsx("div",{className:"grid gap-5 sm:grid-cols-2",children:Z.fields.map(G=>{var W;return s.jsx(he,{label:G.label,required:G.required,placeholder:G.placeholder??"Enter",error:(W=b[G.name])==null?void 0:W.message,...h(G.name)},G.name)})})]},Z.title))}):null,s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-slate-200 pt-6",children:[s.jsx("button",{type:"button",onClick:r,disabled:u,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:opacity-60",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:u,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:opacity-60",children:u?"Saving…":"Save"})]})]})}const Na="rounded-2xl border border-slate-200 bg-white shadow-sm";function mr(){const e=ke(),{selectedEntity:t}=ft(),n=zs(),r=n.taxAccountDetailId?Number(n.taxAccountDetailId):void 0,a=r!=null,i=$n.find(m=>m.id==="tax-accounts"),o=i.icon,l=(m="tax-accounts")=>{e("/settings",{state:{section:m}})},{data:c,isLoading:d,isError:u}=ge({queryKey:["tax-account",r],queryFn:()=>o1(r),enabled:a});return t?s.jsxs("div",{className:"grid items-start gap-5 lg:grid-cols-[300px_minmax(0,1fr)]",children:[s.jsx("div",{className:`${Na} p-3`,children:s.jsx(pd,{items:$n,activeSection:"tax-accounts",onSectionChange:l})}),s.jsxs("div",{className:`${Na} p-6 lg:p-8`,children:[s.jsx(dr,{title:a?"Edit Tax Account":i.title,subtitle:i.subtitle,icon:o}),a&&d?s.jsx("p",{className:"text-sm text-slate-500",children:"Loading tax account…"}):a&&(u||!c)?s.jsx(zt,{message:"Unable to load this tax account. Please try again."}):s.jsx(N1,{entityId:t.entityId,taxAccountDetailId:r,initialValues:c?j1(c):void 0,onCancel:()=>l("tax-accounts"),onSuccess:()=>l("tax-accounts")})]})]}):s.jsx("div",{className:Na+" p-6 lg:p-8",children:s.jsx("p",{className:"text-sm text-slate-500",children:"Select an entity to add a tax account."})})}function S1({paymentsMode:e="all"}){return s.jsxs(di,{children:[s.jsx(te,{index:!0,element:s.jsx(ji,{})}),s.jsx(te,{path:"create-entity",element:s.jsx(Ni,{})}),s.jsx(te,{path:"create-entity/form",element:s.jsx(Bi,{})}),s.jsxs(te,{element:s.jsx(wi,{}),children:[s.jsx(te,{path:"entities",element:s.jsx(Zi,{})}),s.jsx(te,{path:"dashboard",element:s.jsx(Ui,{})}),s.jsx(te,{path:"payments",element:s.jsx(Ki,{paymentsMode:e})}),s.jsx(te,{path:"payments/federal/new",element:s.jsx(Uu,{})}),s.jsx(te,{path:"payments/federal/:federalPaymentId/edit",element:s.jsx(Wu,{})}),s.jsx(te,{path:"payments/federal/:federalPaymentId/view",element:s.jsx(Yu,{})}),s.jsx(te,{path:"payments/state/new",element:s.jsx(Xu,{})}),s.jsx(te,{path:"payments/state/:statePaymentId/edit",element:s.jsx(ed,{})}),s.jsx(te,{path:"payments/state/:statePaymentId/view",element:s.jsx(td,{})}),s.jsx(te,{path:"payments/state/authorization",element:s.jsx(sd,{})}),s.jsx(te,{path:"payments/federal/authorization",element:s.jsx(od,{})}),s.jsx(te,{path:"payments/federal/individual-enrollment",element:s.jsx(hd,{})}),s.jsx(te,{path:"tax-forms",element:s.jsx(Mj,{})}),s.jsx(te,{path:"settings",element:s.jsx(oo,{})}),s.jsx(te,{path:"settings/tax-accounts/new",element:s.jsx(mr,{})}),s.jsx(te,{path:"settings/tax-accounts/:taxAccountDetailId/edit",element:s.jsx(mr,{})})]}),s.jsx(te,{path:"*",element:s.jsx(Be,{to:"/",replace:!0})})]})}const ai="tax-remittance:payment-complete",k1=v.forwardRef(function(t,n){const r=v.useRef(null),a=v.useRef(null);return v.useImperativeHandle(n,()=>({navigate:i=>{var o;return(o=r.current)==null?void 0:o.call(r,i)},selectEntity:i=>{var o;return(o=a.current)==null?void 0:o.call(a,i)},notifyPaymentComplete:i=>{window.dispatchEvent(new CustomEvent(ai,{detail:{paymentId:i}}))}})),s.jsx(vi,{...t,navigateFnRef:r,selectEntityFnRef:a,onPaymentRequired:t.onPaymentRequired,children:s.jsx(S1,{paymentsMode:"all"})})}),C1=v.forwardRef(function(t,n){const r=v.useRef(null),a=v.useRef(null);return v.useImperativeHandle(n,()=>({navigate:i=>{var o;return(o=r.current)==null?void 0:o.call(r,i)},selectEntity:i=>{var o;return(o=a.current)==null?void 0:o.call(a,i)},notifyPaymentComplete:i=>{window.dispatchEvent(new CustomEvent("tax-remittance:payment-complete",{detail:{paymentId:i}}))}})),s.jsx(vi,{...t,navigateFnRef:r,selectEntityFnRef:a,enabledPayments:["federal"],children:s.jsxs(di,{children:[s.jsx(te,{index:!0,element:s.jsx(ji,{})}),s.jsx(te,{path:"create-entity",element:s.jsx(Ni,{})}),s.jsx(te,{path:"create-entity/form",element:s.jsx(Bi,{})}),s.jsxs(te,{element:s.jsx(wi,{}),children:[s.jsx(te,{path:"entities",element:s.jsx(Zi,{})}),s.jsx(te,{path:"dashboard",element:s.jsx(Ui,{})}),s.jsx(te,{path:"payments",element:s.jsx(Ki,{paymentsMode:"federal"})}),s.jsx(te,{path:"payments/federal/new",element:s.jsx(Uu,{})}),s.jsx(te,{path:"payments/federal/:federalPaymentId/edit",element:s.jsx(Wu,{})}),s.jsx(te,{path:"payments/federal/:federalPaymentId/view",element:s.jsx(Yu,{})}),s.jsx(te,{path:"payments/federal/authorization",element:s.jsx(od,{})}),s.jsx(te,{path:"payments/federal/individual-enrollment",element:s.jsx(hd,{})}),s.jsx(te,{path:"settings",element:s.jsx(oo,{})}),s.jsx(te,{path:"settings/tax-accounts/new",element:s.jsx(mr,{})}),s.jsx(te,{path:"settings/tax-accounts/:taxAccountDetailId/edit",element:s.jsx(mr,{})})]}),s.jsx(te,{path:"*",element:s.jsx(Be,{to:"/",replace:!0})})]})})}),A1=v.forwardRef(function(t,n){const r=v.useRef(null),a=v.useRef(null);return v.useImperativeHandle(n,()=>({navigate:i=>{var o;return(o=r.current)==null?void 0:o.call(r,i)},selectEntity:i=>{var o;return(o=a.current)==null?void 0:o.call(a,i)},notifyPaymentComplete:i=>{window.dispatchEvent(new CustomEvent("tax-remittance:payment-complete",{detail:{paymentId:i}}))}})),s.jsx(vi,{...t,navigateFnRef:r,selectEntityFnRef:a,enabledPayments:["state"],children:s.jsxs(di,{children:[s.jsx(te,{index:!0,element:s.jsx(ji,{})}),s.jsx(te,{path:"create-entity",element:s.jsx(Ni,{})}),s.jsx(te,{path:"create-entity/form",element:s.jsx(Bi,{})}),s.jsxs(te,{element:s.jsx(wi,{}),children:[s.jsx(te,{path:"entities",element:s.jsx(Zi,{})}),s.jsx(te,{path:"dashboard",element:s.jsx(Ui,{})}),s.jsx(te,{path:"payments",element:s.jsx(Ki,{paymentsMode:"state"})}),s.jsx(te,{path:"payments/state/new",element:s.jsx(Xu,{})}),s.jsx(te,{path:"payments/state/:statePaymentId/edit",element:s.jsx(ed,{})}),s.jsx(te,{path:"payments/state/:statePaymentId/view",element:s.jsx(td,{})}),s.jsx(te,{path:"payments/state/authorization",element:s.jsx(sd,{})}),s.jsx(te,{path:"settings",element:s.jsx(oo,{})}),s.jsx(te,{path:"settings/tax-accounts/new",element:s.jsx(mr,{})}),s.jsx(te,{path:"settings/tax-accounts/:taxAccountDetailId/edit",element:s.jsx(mr,{})})]}),s.jsx(te,{path:"*",element:s.jsx(Be,{to:"/",replace:!0})})]})})});exports.ApiError=xr;exports.FederalPaymentWidget=C1;exports.StatePaymentWidget=A1;exports.TaxRemittanceEmbedded=k1;exports.setRuntimeApiBaseUrl=vc;
|
|
75
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const h=u[1];if(t===u[0]){i(u);continue}if(e.external){const f=(c=e.external.registry.get(u[0]))==null?void 0:c.id;if(t!==u[0]&&f){i(u);continue}}if((d=e.metadataRegistry.get(u[0]))==null?void 0:d.id){i(u);continue}if(h.cycle){i(u);continue}if(h.count>1&&e.reused==="ref"){i(u);continue}}}function pu(e,t){var l,c,d,u;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=h=>{const m=e.seen.get(h);if(m.ref===null)return;const f=m.def??m.schema,p={...f},g=m.ref;if(m.ref=null,g){s(g);const C=e.seen.get(g),b=C.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(f.allOf=f.allOf??[],f.allOf.push(b)):Object.assign(f,b),Object.assign(f,p),h._zod.parent===g)for(const N in f)N==="$ref"||N==="allOf"||N in p||delete f[N];if(b.$ref&&C.def)for(const N in f)N==="$ref"||N==="allOf"||N in C.def&&JSON.stringify(f[N])===JSON.stringify(C.def[N])&&delete f[N]}const y=h._zod.parent;if(y&&y!==g){s(y);const C=e.seen.get(y);if(C!=null&&C.schema.$ref&&(f.$ref=C.schema.$ref,C.def))for(const b in f)b==="$ref"||b==="allOf"||b in C.def&&JSON.stringify(f[b])===JSON.stringify(C.def[b])&&delete f[b]}e.override({zodSchema:h,jsonSchema:f,path:m.path??[]})};for(const h of[...e.seen.entries()].reverse())s(h[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,(l=e.external)!=null&&l.uri){const h=(c=e.external.registry.get(t))==null?void 0:c.id;if(!h)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(h)}Object.assign(a,n.def??n.schema);const i=(d=e.metadataRegistry.get(t))==null?void 0:d.id;i!==void 0&&a.id===i&&delete a.id;const o=((u=e.external)==null?void 0:u.defs)??{};for(const h of e.seen.entries()){const m=h[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,o[m.defId]=m.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?a.$defs=o:a.definitions=o);try{const h=JSON.parse(JSON.stringify(a));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Es(t,"input",e.processors),output:Es(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function at(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return at(s.element,n);if(s.type==="set")return at(s.valueType,n);if(s.type==="lazy")return at(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return at(s.innerType,n);if(s.type==="intersection")return at(s.left,n)||at(s.right,n);if(s.type==="record"||s.type==="map")return at(s.keyType,n)||at(s.valueType,n);if(s.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:at(s.in,n)||at(s.out,n);if(s.type==="object"){for(const a in s.shape)if(at(s.shape[a],n))return!0;return!1}if(s.type==="union"){for(const a of s.options)if(at(a,n))return!0;return!1}if(s.type==="tuple"){for(const a of s.items)if(at(a,n))return!0;return!!(s.rest&&at(s.rest,n))}return!1}const H5=(e,t={})=>n=>{const s=hu({...n,processors:t});return _e(e,s),fu(s,e),pu(s,e)},Es=(e,t,n={})=>s=>{const{libraryOptions:a,target:i}=s??{},o=hu({...a??{},target:i,io:t,processors:n});return _e(e,o),fu(o,e),pu(o,e)},K5={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Q5=(e,t,n,s)=>{const a=n;a.type="string";const{minimum:i,maximum:o,format:l,patterns:c,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(a.minLength=i),typeof o=="number"&&(a.maxLength=o),l&&(a.format=K5[l]??l,a.format===""&&delete a.format,l==="time"&&delete a.format),d&&(a.contentEncoding=d),c&&c.size>0){const u=[...c];u.length===1?a.pattern=u[0].source:u.length>1&&(a.allOf=[...u.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},G5=(e,t,n,s)=>{n.type="boolean"},J5=(e,t,n,s)=>{n.not={}},X5=(e,t,n,s)=>{},_5=(e,t,n,s)=>{const a=e._zod.def,i=_c(a.entries);i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),n.enum=i},$5=(e,t,n,s)=>{const a=e._zod.def,i=[];for(const o of a.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){const o=i[0];n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[o]:n.const=o}else i.every(o=>typeof o=="number")&&(n.type="number"),i.every(o=>typeof o=="string")&&(n.type="string"),i.every(o=>typeof o=="boolean")&&(n.type="boolean"),i.every(o=>o===null)&&(n.type="null"),n.enum=i},ep=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},tp=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},np=(e,t,n,s)=>{const a=n,i=e._zod.def,{minimum:o,maximum:l}=e._zod.bag;typeof o=="number"&&(a.minItems=o),typeof l=="number"&&(a.maxItems=l),a.type="array",a.items=_e(i.element,t,{...s,path:[...s.path,"items"]})},rp=(e,t,n,s)=>{var d;const a=n,i=e._zod.def;a.type="object",a.properties={};const o=i.shape;for(const u in o)a.properties[u]=_e(o[u],t,{...s,path:[...s.path,"properties",u]});const l=new Set(Object.keys(o)),c=new Set([...l].filter(u=>{const h=i.shape[u]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));c.size>0&&(a.required=Array.from(c)),((d=i.catchall)==null?void 0:d._zod.def.type)==="never"?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=_e(i.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},sp=(e,t,n,s)=>{const a=e._zod.def,i=a.inclusive===!1,o=a.options.map((l,c)=>_e(l,t,{...s,path:[...s.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=o:n.anyOf=o},ap=(e,t,n,s)=>{const a=e._zod.def,i=_e(a.left,t,{...s,path:[...s.path,"allOf",0]}),o=_e(a.right,t,{...s,path:[...s.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,c=[...l(i)?i.allOf:[i],...l(o)?o.allOf:[o]];n.allOf=c},ip=(e,t,n,s)=>{const a=e._zod.def,i=_e(a.innerType,t,s),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=a.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},op=(e,t,n,s)=>{const a=e._zod.def;_e(a.innerType,t,s);const i=t.seen.get(e);i.ref=a.innerType},lp=(e,t,n,s)=>{const a=e._zod.def;_e(a.innerType,t,s);const i=t.seen.get(e);i.ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},cp=(e,t,n,s)=>{const a=e._zod.def;_e(a.innerType,t,s);const i=t.seen.get(e);i.ref=a.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},up=(e,t,n,s)=>{const a=e._zod.def;_e(a.innerType,t,s);const i=t.seen.get(e);i.ref=a.innerType;let o;try{o=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},dp=(e,t,n,s)=>{const a=e._zod.def,i=a.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?i?a.out:a.in:a.out;_e(o,t,s);const l=t.seen.get(e);l.ref=o},mp=(e,t,n,s)=>{const a=e._zod.def;_e(a.innerType,t,s);const i=t.seen.get(e);i.ref=a.innerType,n.readOnly=!0},xu=(e,t,n,s)=>{const a=e._zod.def;_e(a.innerType,t,s);const i=t.seen.get(e);i.ref=a.innerType},hp=D("ZodISODateTime",(e,t)=>{Cf.init(e,t),Fe.init(e,t)});function fp(e){return N5(hp,e)}const pp=D("ZodISODate",(e,t)=>{jf.init(e,t),Fe.init(e,t)});function xp(e){return S5(pp,e)}const gp=D("ZodISOTime",(e,t)=>{wf.init(e,t),Fe.init(e,t)});function yp(e){return k5(gp,e)}const bp=D("ZodISODuration",(e,t)=>{Nf.init(e,t),Fe.init(e,t)});function vp(e){return A5(bp,e)}const Cp=(e,t)=>{zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>hh(e,n)},flatten:{value:n=>mh(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ja,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ja,2)}},isEmpty:{get(){return e.issues.length===0}}})},Dt=D("ZodError",Cp,{Parent:Error}),jp=Gs(Dt),wp=Js(Dt),Np=Xs(Dt),Sp=_s(Dt),kp=yh(Dt),Ap=bh(Dt),Pp=vh(Dt),Ip=Ch(Dt),Ep=jh(Dt),Tp=wh(Dt),Lp=Nh(Dt),Fp=Sh(Dt),nl=new WeakMap;function ea(e,t,n){const s=Object.getPrototypeOf(e);let a=nl.get(s);if(a||(a=new Set,nl.set(s,a)),!a.has(t)){a.add(t);for(const i in n){const o=n[i];Object.defineProperty(s,i,{configurable:!0,enumerable:!1,get(){const l=o.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}const Ze=D("ZodType",(e,t)=>(qe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Es(e,"input"),output:Es(e,"output")}}),e.toJSONSchema=H5(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,s)=>jp(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>Np(e,n,s),e.parseAsync=async(n,s)=>wp(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>Sp(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>kp(e,n,s),e.decode=(n,s)=>Ap(e,n,s),e.encodeAsync=async(n,s)=>Pp(e,n,s),e.decodeAsync=async(n,s)=>Ip(e,n,s),e.safeEncode=(n,s)=>Ep(e,n,s),e.safeDecode=(n,s)=>Tp(e,n,s),e.safeEncodeAsync=async(n,s)=>Lp(e,n,s),e.safeDecodeAsync=async(n,s)=>Fp(e,n,s),ea(e,"ZodType",{check(...n){const s=this.def;return this.clone(wn(s,{checks:[...s.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,s){return Nn(this,n,s)},brand(){return this},register(n,s){return n.add(this,s),this},refine(n,s){return this.check(S2(n,s))},superRefine(n,s){return this.check(k2(n,s))},overwrite(n){return this.check(jr(n))},optional(){return al(this)},exactOptional(){return m2(this)},nullable(){return il(this)},nullish(){return al(il(this))},nonoptional(n){return y2(this,n)},array(){return r2(this)},or(n){return bu([this,n])},and(n){return o2(this,n)},transform(n){return ol(this,u2(n))},default(n){return p2(this,n)},prefault(n){return g2(this,n)},catch(n){return v2(this,n)},pipe(n){return ol(this,n)},readonly(){return w2(this)},describe(n){const s=this.clone();return Fr.add(s,{description:n}),s},meta(...n){if(n.length===0)return Fr.get(this);const s=this.clone();return Fr.add(s,n[0]),s},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=Fr.get(e))==null?void 0:n.description},configurable:!0}),e)),gu=D("_ZodString",(e,t)=>{Vi.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(s,a,i)=>Q5(e,s,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ea(e,"_ZodString",{regex(...s){return this.check(T5(...s))},includes(...s){return this.check(R5(...s))},startsWith(...s){return this.check(D5(...s))},endsWith(...s){return this.check(M5(...s))},min(...s){return this.check(Is(...s))},max(...s){return this.check(du(...s))},length(...s){return this.check(mu(...s))},nonempty(...s){return this.check(Is(1,...s))},lowercase(s){return this.check(L5(s))},uppercase(s){return this.check(F5(s))},trim(){return this.check(z5())},normalize(...s){return this.check(O5(...s))},toLowerCase(){return this.check(V5())},toUpperCase(){return this.check(q5())},slugify(){return this.check(Z5())}})}),Rp=D("ZodString",(e,t)=>{Vi.init(e,t),gu.init(e,t),e.email=n=>e.check(uu(yu,n)),e.url=n=>e.check(l5(Mp,n)),e.jwt=n=>e.check(w5(Xp,n)),e.emoji=n=>e.check(c5(Op,n)),e.guid=n=>e.check(tl(rl,n)),e.uuid=n=>e.check(s5(is,n)),e.uuidv4=n=>e.check(a5(is,n)),e.uuidv6=n=>e.check(i5(is,n)),e.uuidv7=n=>e.check(o5(is,n)),e.nanoid=n=>e.check(u5(zp,n)),e.guid=n=>e.check(tl(rl,n)),e.cuid=n=>e.check(d5(Vp,n)),e.cuid2=n=>e.check(m5(qp,n)),e.ulid=n=>e.check(h5(Zp,n)),e.base64=n=>e.check(v5(Qp,n)),e.base64url=n=>e.check(C5(Gp,n)),e.xid=n=>e.check(f5(Up,n)),e.ksuid=n=>e.check(p5(Bp,n)),e.ipv4=n=>e.check(x5(Wp,n)),e.ipv6=n=>e.check(g5(Yp,n)),e.cidrv4=n=>e.check(y5(Hp,n)),e.cidrv6=n=>e.check(b5(Kp,n)),e.e164=n=>e.check(j5(Jp,n)),e.datetime=n=>e.check(fp(n)),e.date=n=>e.check(xp(n)),e.time=n=>e.check(yp(n)),e.duration=n=>e.check(vp(n))});function F(e){return r5(Rp,e)}const Fe=D("ZodStringFormat",(e,t)=>{Ee.init(e,t),gu.init(e,t)}),yu=D("ZodEmail",(e,t)=>{mf.init(e,t),Fe.init(e,t)});function Dp(e){return uu(yu,e)}const rl=D("ZodGUID",(e,t)=>{uf.init(e,t),Fe.init(e,t)}),is=D("ZodUUID",(e,t)=>{df.init(e,t),Fe.init(e,t)}),Mp=D("ZodURL",(e,t)=>{hf.init(e,t),Fe.init(e,t)}),Op=D("ZodEmoji",(e,t)=>{ff.init(e,t),Fe.init(e,t)}),zp=D("ZodNanoID",(e,t)=>{pf.init(e,t),Fe.init(e,t)}),Vp=D("ZodCUID",(e,t)=>{xf.init(e,t),Fe.init(e,t)}),qp=D("ZodCUID2",(e,t)=>{gf.init(e,t),Fe.init(e,t)}),Zp=D("ZodULID",(e,t)=>{yf.init(e,t),Fe.init(e,t)}),Up=D("ZodXID",(e,t)=>{bf.init(e,t),Fe.init(e,t)}),Bp=D("ZodKSUID",(e,t)=>{vf.init(e,t),Fe.init(e,t)}),Wp=D("ZodIPv4",(e,t)=>{Sf.init(e,t),Fe.init(e,t)}),Yp=D("ZodIPv6",(e,t)=>{kf.init(e,t),Fe.init(e,t)}),Hp=D("ZodCIDRv4",(e,t)=>{Af.init(e,t),Fe.init(e,t)}),Kp=D("ZodCIDRv6",(e,t)=>{Pf.init(e,t),Fe.init(e,t)}),Qp=D("ZodBase64",(e,t)=>{If.init(e,t),Fe.init(e,t)}),Gp=D("ZodBase64URL",(e,t)=>{Tf.init(e,t),Fe.init(e,t)}),Jp=D("ZodE164",(e,t)=>{Lf.init(e,t),Fe.init(e,t)}),Xp=D("ZodJWT",(e,t)=>{Rf.init(e,t),Fe.init(e,t)}),_p=D("ZodBoolean",(e,t)=>{Df.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>G5(e,n,s)});function er(e){return P5(_p,e)}const $p=D("ZodUnknown",(e,t)=>{Mf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>X5()});function sl(){return I5($p)}const e2=D("ZodNever",(e,t)=>{Of.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>J5(e,n,s)});function t2(e){return E5(e2,e)}const n2=D("ZodArray",(e,t)=>{zf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>np(e,n,s,a),e.element=t.element,ea(e,"ZodArray",{min(n,s){return this.check(Is(n,s))},nonempty(n){return this.check(Is(1,n))},max(n,s){return this.check(du(n,s))},length(n,s){return this.check(mu(n,s))},unwrap(){return this.element}})});function r2(e,t){return U5(n2,e,t)}const s2=D("ZodObject",(e,t)=>{qf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>rp(e,n,s,a),je(e,"shape",()=>t.shape),ea(e,"ZodObject",{keyof(){return qi(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:sl()})},loose(){return this.clone({...this._zod.def,catchall:sl()})},strict(){return this.clone({...this._zod.def,catchall:t2()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return ih(this,n)},safeExtend(n){return oh(this,n)},merge(n){return lh(this,n)},pick(n){return sh(this,n)},omit(n){return ah(this,n)},partial(...n){return ch(vu,this,n[0])},required(...n){return uh(Cu,this,n[0])}})});function Gt(e,t){const n={type:"object",shape:e??{},...ae(t)};return new s2(n)}const a2=D("ZodUnion",(e,t)=>{Zf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>sp(e,n,s,a),e.options=t.options});function bu(e,t){return new a2({type:"union",options:e,...ae(t)})}const i2=D("ZodIntersection",(e,t)=>{Uf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>ap(e,n,s,a)});function o2(e,t){return new i2({type:"intersection",left:e,right:t})}const _a=D("ZodEnum",(e,t)=>{Bf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(s,a,i)=>_5(e,s,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,a)=>{const i={};for(const o of s)if(n.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new _a({...t,checks:[],...ae(a),entries:i})},e.exclude=(s,a)=>{const i={...t.entries};for(const o of s)if(n.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new _a({...t,checks:[],...ae(a),entries:i})}});function qi(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new _a({type:"enum",entries:n,...ae(t)})}const l2=D("ZodLiteral",(e,t)=>{Wf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>$5(e,n,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ha(e,t){return new l2({type:"literal",values:Array.isArray(e)?e:[e],...ae(t)})}const c2=D("ZodTransform",(e,t)=>{Yf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>tp(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new Xc(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Vr(i,n.value,t));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push(Vr(o))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function u2(e){return new c2({type:"transform",transform:e})}const vu=D("ZodOptional",(e,t)=>{cu.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>xu(e,n,s,a),e.unwrap=()=>e._zod.def.innerType});function al(e){return new vu({type:"optional",innerType:e})}const d2=D("ZodExactOptional",(e,t)=>{Hf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>xu(e,n,s,a),e.unwrap=()=>e._zod.def.innerType});function m2(e){return new d2({type:"optional",innerType:e})}const h2=D("ZodNullable",(e,t)=>{Kf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>ip(e,n,s,a),e.unwrap=()=>e._zod.def.innerType});function il(e){return new h2({type:"nullable",innerType:e})}const f2=D("ZodDefault",(e,t)=>{Qf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>lp(e,n,s,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function p2(e,t){return new f2({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():eu(t)}})}const x2=D("ZodPrefault",(e,t)=>{Gf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>cp(e,n,s,a),e.unwrap=()=>e._zod.def.innerType});function g2(e,t){return new x2({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():eu(t)}})}const Cu=D("ZodNonOptional",(e,t)=>{Jf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>op(e,n,s,a),e.unwrap=()=>e._zod.def.innerType});function y2(e,t){return new Cu({type:"nonoptional",innerType:e,...ae(t)})}const b2=D("ZodCatch",(e,t)=>{Xf.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>up(e,n,s,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function v2(e,t){return new b2({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const C2=D("ZodPipe",(e,t)=>{_f.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>dp(e,n,s,a),e.in=t.in,e.out=t.out});function ol(e,t){return new C2({type:"pipe",in:e,out:t})}const j2=D("ZodReadonly",(e,t)=>{$f.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>mp(e,n,s,a),e.unwrap=()=>e._zod.def.innerType});function w2(e){return new j2({type:"readonly",innerType:e})}const N2=D("ZodCustom",(e,t)=>{e5.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,s,a)=>ep(e,n)});function S2(e,t={}){return B5(N2,e,t)}function k2(e,t){return W5(e,t)}const wt={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function A2(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[t.length-1][0]}`.toUpperCase()}function Jr(e){return e.tradeName.trim()?e.tradeName:e.accountType==="Business"?(e.lastName||e.firstName).trim():`${e.firstName} ${e.lastName}`.trim()}function Zi(e){const t=e.replace(/\D/g,"");return t.length!==9?e:`${t.slice(0,2)}-${t.slice(2)}`}function P2(e){const t=e.replace(/\D/g,"");return t.length!==9?e:`${t.slice(0,3)}-${t.slice(3,5)}-${t.slice(5)}`}function I2(e){const t=e.replace(/\D/g,"");return t.length!==9?e:`**-***${t.slice(5)}`}function E2(e){const t=e.replace(/\D/g,"");return t.length!==9?e:`***-**-${t.slice(5)}`}function ps(e,t){return t==="Individual"?E2(e):I2(e)}function Zn(e,t){return t==="Individual"?P2(e):Zi(e)}function $a(e,t){const n=e.replace(/\D/g,"").slice(0,9);return t==="Individual"?n.length<=3?n:n.length<=5?`${n.slice(0,3)}-${n.slice(3)}`:`${n.slice(0,3)}-${n.slice(3,5)}-${n.slice(5)}`:n.length<=2?n:`${n.slice(0,2)}-${n.slice(2)}`}function sn(e){const t=e.replace(/\D/g,""),n=t.length===11&&t.startsWith("1")?t.slice(1):t;return n.length!==10?e:`+1 (${n.slice(0,3)}) ${n.slice(3,6)}-${n.slice(6)}`}const T2=["All","LLP","LLC","Corporation","S-Corp","Sole Proprietorship","Partnership"],ju=["LLP","LLC","Corporation","S-Corp","Partnership"],wu=["Sole Proprietorship"],L2=/^[A-Za-z][A-Za-z\s'.-]*$/,ll=/^[A-Za-z0-9][A-Za-z0-9\s,.'#/&-]*$/,ei=10,Nu=/^\d{5}(-\d{4})?$/,F2=/^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/;function Ui(e){const t=e.replace(/\D/g,"").slice(0,9);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`}function Su(e){const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6);return t.length<=3?t:`${t.slice(0,3)} ${t.slice(3)}`}const ta=["United States","Canada"],R2=["Single","Married Filing Jointly","Married Filing Separately","Head of Household","Qualifying Surviving Spouse"],D2="Married Filing Jointly",cl={firstName:"",lastName:"",ssn:"",email:"",phone:"",address1:"",address2:"",city:"",state:"",zipCode:"",country:"United States",sameAsPrimaryAddress:!1};function xs(e){return`${[e.address1,e.address2,e.city].map(n=>n.trim()).filter(n=>n.length>0).join(", ")}, ${e.state} ${e.zipCode}`.trim()}const ku=Gt({accountType:qi(["Business","Individual"]),firstName:F(),lastName:F(),tradeName:F(),ein:F(),entityType:F().min(1,"Entity type is required"),email:Dp("Enter a valid email"),countryCode:F().min(1),phoneNumber:F().min(1,"Phone number is required").refine(e=>e.replace(/\D/g,"").length===ei,`Phone number must be ${ei} digits`),address1:F().min(1,"Address is required"),address2:F(),city:F().min(1,"City is required"),state:F().min(1,"State is required"),zipCode:F().min(1,"ZIP code is required"),country:F().min(1,"Country is required")}).superRefine((e,t)=>{L2.test(e.city.trim())||t.addIssue({code:"custom",path:["city"],message:"City can only contain letters, spaces, apostrophes, and hyphens"}),ll.test(e.address1.trim())||t.addIssue({code:"custom",path:["address1"],message:"Address can only contain letters, numbers, spaces, and , . ' # / & -"}),e.address2.trim()&&!ll.test(e.address2.trim())&&t.addIssue({code:"custom",path:["address2"],message:"Address can only contain letters, numbers, spaces, and , . ' # / & -"}),e.country==="United States"&&!Nu.test(e.zipCode.trim())?t.addIssue({code:"custom",path:["zipCode"],message:"Enter a 5-digit ZIP or ZIP+4 (e.g. 12345 or 12345-6789)"}):e.country==="Canada"&&!F2.test(e.zipCode.trim())&&t.addIssue({code:"custom",path:["zipCode"],message:"Enter a valid postal code (e.g. A1A 1A1)"});const n=e.accountType==="Individual"?"SSN":"EIN",s=e.ein.replace(/\D/g,"");if(s?s.length!==9&&t.addIssue({code:"custom",path:["ein"],message:`${n} must be 9 digits`}):t.addIssue({code:"custom",path:["ein"],message:`${n} is required`}),e.accountType==="Business"){e.lastName.trim()||t.addIssue({code:"custom",path:["lastName"],message:"Business name is required"});return}e.firstName.trim()||t.addIssue({code:"custom",path:["firstName"],message:"First name is required"}),e.lastName.trim()||t.addIssue({code:"custom",path:["lastName"],message:"Last name is required"})});function M2(e){const t=e.replace(/\D/g,"");return t.length===11&&t.startsWith("1")?{countryCode:"+1",national:t.slice(1)}:t.length===10?{countryCode:"+1",national:t}:{countryCode:"+1",national:t.slice(-ei)}}function ul(e){const{countryCode:t,national:n}=M2(e.phoneNumber),s=e.accountType==="Individual",a=(e.lastName||e.firstName||"").trim();return{accountType:s?"Individual":"Business",firstName:s?e.firstName??"":"",lastName:s?e.lastName??"":a,tradeName:s?"":e.tradeName??"",ein:Zn(e.idNumber,e.accountType),entityType:e.entityType,email:e.email,countryCode:t,phoneNumber:n,address1:e.address1,address2:e.address2??"",city:e.city,state:e.state,zipCode:e.zipCode,country:e.country}}function Au(e,t,n,s){if(e!==t){if(e==="Business"&&t==="Individual"){n("firstName",""),n("lastName",s),n("tradeName","");return}e==="Individual"&&t==="Business"&&(n("firstName",""),n("lastName",s))}}function O2(e){const t=e==null?void 0:e.secondary;return t?{secondaryFirstName:t.firstName.trim(),secondaryLastName:t.lastName.trim(),secondarySsn:t.ssn.replace(/\D/g,""),secondaryEmail:t.email.trim(),secondaryPhoneNumber:t.phone.replace(/\D/g,""),secondaryAddress1:t.address1,secondaryAddress2:t.address2||null,secondaryCity:t.city,secondaryState:t.state,secondaryCountry:t.country,secondaryZipCode:t.zipCode}:{}}function Pu(e,t){const n=e.lastName.trim(),s=t==null?void 0:t.filingStatus,a=O2(t);return e.accountType==="Business"?{accountType:e.accountType,firstName:"",lastName:n,idNumber:e.ein.replace(/\D/g,""),entityType:e.entityType,tradeName:e.tradeName.trim(),phoneNumber:`${e.countryCode}${e.phoneNumber.replace(/\D/g,"")}`,email:e.email,address1:e.address1,address2:e.address2||null,city:e.city,state:e.state,country:e.country,zipCode:e.zipCode}:{accountType:e.accountType,firstName:e.firstName.trim(),lastName:n,idNumber:e.ein.replace(/\D/g,""),entityType:e.entityType,tradeName:"",phoneNumber:`${e.countryCode}${e.phoneNumber.replace(/\D/g,"")}`,email:e.email,address1:e.address1,address2:e.address2||null,city:e.city,state:e.state,country:e.country,zipCode:e.zipCode,filingStatus:s,...a}}function z2(e){const{idNumber:t,...n}=Pu(e);return n}function V2({accountType:e,onAccountTypeChange:t,isIndividual:n,filingStatus:s,onFilingStatusChange:a,focusHelp:i,resetHelp:o}){return r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(Jc,{label:"Account Type",required:!0,fullWidth:!1,value:e,onChange:t,onFocus:i("accountType"),options:[{label:"Business",value:"Business",icon:r.jsx(_1,{})},{label:"Individual",value:"Individual",icon:r.jsx($1,{})}]}),n?r.jsxs(lt,{label:"Filing Status",required:!0,value:s,onChange:l=>a(l.target.value),onFocus:o,children:[r.jsx("option",{value:"",children:"Select Filing Status"}),R2.map(l=>r.jsx("option",{value:l,children:l},l))]}):null]})}function q2({register:e,errors:t,zipRegister:n,isUS:s,state:a,stateOptions:i,zipStateMismatch:o,focusHelp:l}){var c,d,u,h,m,f;return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mt-6 h-px bg-slate-200"}),r.jsxs("div",{className:"border-t border-slate-100 pt-6",children:[r.jsx("h3",{className:"mb-5 text-sm font-semibold text-slate-900",children:"Address Details"}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx(ce,{label:"Address Line 1",required:!0,maxLength:200,placeholder:"Enter Address Line 1",error:(c=t.address1)==null?void 0:c.message,...e("address1"),onFocus:l("address1")}),r.jsx(ce,{label:"Address Line 2",maxLength:200,placeholder:"Enter Address Line 2",error:(d=t.address2)==null?void 0:d.message,...e("address2"),onFocus:l("address2")}),r.jsx(ce,{label:"City",required:!0,maxLength:100,placeholder:"Enter City",error:(u=t.city)==null?void 0:u.message,...e("city"),onFocus:l("city")})]}),r.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(lt,{label:s?"State":"Province",required:!0,error:(h=t.state)==null?void 0:h.message,...e("state"),onFocus:l("state"),children:[r.jsx("option",{value:"",children:s?"Select State":"Select Province"}),i.map(p=>r.jsx("option",{value:p.code,children:p.name},p.code))]}),r.jsx(ce,{label:s?"ZIP Code":"Postal Code",required:!0,maxLength:10,placeholder:s?"Enter ZIP Code":"A1A 1A1",error:((m=t.zipCode)==null?void 0:m.message)??(o?`ZIP code does not match the selected state (${a}).`:void 0),...n,onChange:p=>{p.target.value=s?Ui(p.target.value):Su(p.target.value),n.onChange(p)},onFocus:l("zipCode")}),r.jsx(lt,{label:"Country",required:!0,error:(f=t.country)==null?void 0:f.message,...e("country"),onFocus:l("country"),children:ta.map(p=>r.jsx("option",{value:p,children:p},p))})]})]})]})}function Iu({label:e,placeholder:t,maxLength:n,accountType:s,register:a,error:i,onFocus:o}){return r.jsx(ce,{label:e,required:!0,inputMode:"numeric",placeholder:t,maxLength:n,error:i,...a,onChange:l=>{l.target.value=$a(l.target.value,s),a.onChange(l)},onFocus:o})}function Eu({label:e="Phone Number",required:t=!1,error:n,countryCodeSelectProps:s,phoneInputProps:a}){const i=a.id??a.name,o=n&&i?`${i}-error`:void 0;return r.jsxs("div",{children:[r.jsx(Cr,{label:e,required:t,htmlFor:i}),r.jsxs("div",{className:`flex overflow-hidden rounded-lg border bg-white transition focus-within:ring-2 focus-within:ring-gov-200 ${n?"border-red-300":"border-slate-200 focus-within:border-gov-400"}`,children:[r.jsx("select",{"aria-label":"Country code",...s,className:"shrink-0 border-r border-slate-200 bg-slate-50 px-3 py-2.5 text-sm text-slate-900 focus:outline-none",children:r.jsx("option",{value:"+1",children:"+1"})}),r.jsx("input",{type:"tel",inputMode:"numeric","aria-invalid":n?!0:void 0,"aria-describedby":o,...a,id:i,className:"block w-full border-0 px-3 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-0"})]}),n?r.jsx("p",{id:o,className:"mt-1 text-xs text-red-600",children:n}):null]})}function Tu({countryCodeRegister:e,phoneRegister:t,error:n,onFocus:s}){return r.jsx(Eu,{required:!0,error:n,countryCodeSelectProps:e,phoneInputProps:{placeholder:"Enter Phone Number",maxLength:10,...t,onChange:a=>{a.target.value=a.target.value.replace(/\D/g,"").slice(0,10),t.onChange(a)},onFocus:s}})}function Z2({register:e,errors:t,einRegister:n,phoneRegister:s,countryCodeRegister:a,entityTypeOptions:i,accountType:o,idLabel:l,idPlaceholder:c,idMaxLength:d,focusHelp:u}){var h,m,f,p,g,y;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx(ce,{label:"Legal Business Name",required:!0,maxLength:150,placeholder:"Enter Legal Business Name",error:(h=t.lastName)==null?void 0:h.message,...e("lastName"),onFocus:u("legalBusinessName")},"entity-business-name"),r.jsx(ce,{label:"Business Display Name",maxLength:150,placeholder:"Enter Business Display Name",error:(m=t.tradeName)==null?void 0:m.message,...e("tradeName"),onFocus:u("businessDisplayName")},"entity-trade-name"),r.jsx(ce,{label:"Email",required:!0,type:"email",maxLength:254,placeholder:"Enter Email",error:(f=t.email)==null?void 0:f.message,...e("email"),onFocus:u("email")})]}),r.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx(Tu,{countryCodeRegister:a,phoneRegister:s,error:(p=t.phoneNumber)==null?void 0:p.message,onFocus:u("phoneNumber")}),r.jsx(lt,{label:"Entity Type",required:!0,error:(g=t.entityType)==null?void 0:g.message,...e("entityType"),onFocus:u("entityType"),children:i.map(C=>r.jsx("option",{value:C,children:C},C))}),r.jsx(Iu,{label:l,placeholder:c,maxLength:d,accountType:o,register:n,error:(y=t.ein)==null?void 0:y.message,onFocus:u("ein")})]})]})}const U2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZMAAACoCAMAAAASCPOJAAADAFBMVEUAljECn0gDok4DpUgEpE8GplAJqVELq1MNrFMOrFMPqVAbqVQItU0Or1QPr1URsVUSsVcUtFgXtlsau14dvmAgv2MlwmcryGsxy240zG81znA40HE80nM+z3Q+03Q/1HVKxH5F1Htd0Ixx15sIef0Xkf1yms5oq8JpzrUlmP0slf1Zqut4ntF6oNF7oNF6q81617l+otOApNSCptWDp9WA0rOHrNaR2rKcztSk0eOw3+Wk6L+u59y26uO36ea+7OS/6+e97+LB7+fC7+fC7+jE8Oetye20zu+z0vO40vC61e+94O3C1/LE7+nI2/TL4vPH8enT4vfa7vDj7PTb6PfY5vjk7vro8fv8yzX856T89dns+fHw+PTt9vfs8vjt8/jt9Prr8vvt9Pvr8/zs8/zt9P3z+P3q8P7r9f7r8f7r9P7r8/7s9f7s8/7s9P7t9f7t9P7t8/7t8v7t9f/6/P39ugH9ww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DOl034mnmycMXy7PVmS58xpJJQWM2lAHmxcKPw02FX6Psa77S+abx38xlPL/A0Q84jHd4l56AAAAAElFTkSuQmCC";function B2(){return r.jsx("img",{src:U2,alt:"",width:403,height:168,className:"h-32 w-auto"})}const W2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPIAAACoCAMAAADto0MHAAADAFBMVEUCoEIDplcCqFsCqFwCqV0EqV0CrVYErV0Gr10JsV4GtlgKtGAOtmESv18SumYYvGgdwWojxmwFtZAjvYEmyG4px3cRuKUcxKcOtawfwaoqxqsFYfYPafgacvUkd/QqfPYtf/Usfvctfvcufvcvf/cvf/gwgfgwgvgvgvoNsrAVob4wg/kau7UtxLM/xX04y6o4zK89zbFDzrVUyY5y0p78wQL8xRD800T944lK0rZM07dQ0rWG2bFQ07lV1bpZ17pa17tt2blS0r5Z1r1c171e2L5f2L9m2cN43MyI4M+q5Mcygvkzgvk0g/k1hflKkfh6vuyO4tWf6dir7Ny37ty/8ObX9Ozt+fQzg/o2hfs4hvtJkPtjov1+sPyqzP2z0v2+1/3Q4f3l8P3o8f3p8v36/PwYb/44iP6Xwf6ozf6y0v6/2v7Y6P7n8f7p8f3p8v3p8v7p8/7q8v7q8/7r8v3r8/3r9P38/f39/P0ZXv8aZP8baP8eY/8fZv87i/91rv+qz/+qy/+y0P+1z//B2//E3f/N4P/O4P/O2P/Q5P/R4//U5P/i7//j8P/k7//l8f/m8f/m8P/n8f/o8f/o8v/o8//p8v/p8//p8f/q8f7q9P7q8//q8v/q9P/r8/7r8v7r9P7r9f7r8//r8v/r9P/s9P7s8/7s9v7s9f7s8v7s8//s9v/s9P/t9f7t9P7t9f/t9v/t9P/u9P7u9f7u9v7u9v/u9f/u8//v9v7v9f7v9v/v9P/v9f/w9v7w9/7w9P7w9f7w9v/w8//w+f/+/v7+vwD+wAD/xQD/vwD+yAH+wwH+xQH+xQL/ygL+yAP+xgP/xQP+yAT+yQT+xQT+xgT+xwT+yAX/yAX+xwb+yAb+yQb/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BwXwJcwL2gXSJBwwlpsAczwNSB89SHOpYPM/2jHhWokTcNv3scBFEv41ONjMN7lA6j04wcnJNrBODgfTIjjtQuFBvmsZ5jkm3xzx1/OX/B5ZUR0aL50DQAAAAAElFTkSuQmCC";function Y2(){return r.jsx("img",{src:W2,alt:"",width:242,height:168,className:"h-32 w-auto"})}function Bi(){return r.jsxs("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12s3.75-7.5 9.75-7.5 9.75 7.5 9.75 7.5-3.75 7.5-9.75 7.5S2.25 12 2.25 12z"}),r.jsx("circle",{cx:"12",cy:"12",r:"2.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Lu(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 002.25 12s3.75 7.5 9.75 7.5c1.632 0 3.106-.328 4.396-.87M6.228 6.228A10.45 10.45 0 0112 4.5c6 0 9.75 7.5 9.75 7.5a10.49 10.49 0 01-4.293 4.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.243L9.88 9.88"})})}function H2({open:e,entityName:t,description:n,illustration:s,pages:a,onClose:i,onGoToDashboard:o,onStartPayment:l}){const[c,d]=x.useState(0),[u,h]=x.useState({});if(x.useEffect(()=>{if(!e)return;d(0),h({});const p=g=>{g.key==="Escape"&&i()};return document.addEventListener("keydown",p),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p),document.body.style.overflow=""}},[e,i]),!e||a.length===0)return null;const m=a[Math.min(c,a.length-1)],f=a.length>1;return jn.createPortal(r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[r.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:i}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"entity-success-title",className:"relative z-10 max-h-[90vh] w-full max-w-md overflow-y-auto rounded-2xl bg-white p-6 text-center shadow-xl sm:p-8",children:[r.jsx("button",{type:"button","aria-label":"Close dialog",onClick:i,className:"absolute right-4 top-4 rounded-lg p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600",children:r.jsx(K2,{})}),r.jsx("div",{className:"flex justify-center",children:s}),r.jsxs("h2",{id:"entity-success-title",className:"mt-2 text-xl font-bold text-slate-900",children:[t," Added Successfully!"]}),r.jsx("p",{className:"mt-2 text-sm text-slate-500",children:n}),r.jsxs("div",{className:"mt-6 overflow-hidden rounded-xl border border-slate-200 text-left",children:[m.title?r.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-slate-200 bg-slate-50 px-4 py-3 bg-[#F0F0F0]",children:[r.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:m.title}),f?r.jsxs("div",{className:"flex items-center gap-1 rounded-md border border-slate-200 bg-white px-1 py-0.5",children:[r.jsx("button",{type:"button","aria-label":"Previous details",disabled:c===0,onClick:()=>d(p=>Math.max(0,p-1)),className:"rounded p-0.5 text-slate-500 transition hover:bg-slate-100 hover:text-slate-700 disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(Q2,{})}),r.jsxs("span",{className:"text-xs text-slate-500",children:[c+1," / ",a.length]}),r.jsx("button",{type:"button","aria-label":"Next details",disabled:c>=a.length-1,onClick:()=>d(p=>Math.min(a.length-1,p+1)),className:"rounded p-0.5 text-slate-500 transition hover:bg-slate-100 hover:text-slate-700 disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(G2,{})})]}):null]}):null,r.jsx("div",{className:"divide-y divide-slate-100",children:m.rows.map(p=>{const g=`${c}:${p.label}`,y=u[g]===!0;return r.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[r.jsx("span",{className:"shrink-0 text-sm text-slate-500",children:p.label}),r.jsxs("span",{className:"flex items-center gap-2 text-right text-sm font-medium text-slate-900",children:[p.masked!==void 0&&!y?p.masked:p.value,p.masked!==void 0?r.jsx("button",{type:"button","aria-label":y?`Hide ${p.label}`:`Show ${p.label}`,onClick:()=>h(C=>({...C,[g]:!y})),className:"shrink-0 text-slate-400 transition hover:text-slate-600",children:y?r.jsx(Lu,{}):r.jsx(Bi,{})}):null]})]},p.label)})})]}),r.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row",children:[r.jsx("button",{type:"button",onClick:o,className:"inline-flex h-11 w-full items-center justify-center rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50 sm:w-1/2",children:"Go to Dashboard"}),r.jsx("button",{type:"button",onClick:l,className:"inline-flex h-11 w-full items-center justify-center rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 sm:w-1/2",children:"Start Payment"})]})]})]}),document.body)}function K2(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function Q2(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}function G2(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})}const J2="Your entity has been created successfully. Review the details below and create your first payment.",X2="Review the details below and create your first payment.";function _2({created:e,onClose:t,onGoToDashboard:n,onStartPayment:s}){const a=(e==null?void 0:e.values)??null,i=(e==null?void 0:e.secondary)??null,o=(a==null?void 0:a.accountType)==="Individual";return r.jsx(H2,{open:a!==null,entityName:a?$2(a,o):"",description:o?X2:J2,illustration:o?r.jsx(Y2,{}):r.jsx(B2,{}),pages:e6(a,i,o),onClose:t,onGoToDashboard:n,onStartPayment:s})}function $2(e,t){return t?`${e.firstName.trim()} ${e.lastName.trim()}`.trim():e.lastName.trim()}function e6(e,t,n){return e?n?[{title:"Primary Taxpayer Details",rows:[{label:"First Name",value:e.firstName.trim()},{label:"Last Name",value:e.lastName.trim()},{label:"Email",value:e.email},{label:"Phone Number",value:sn(`${e.countryCode}${e.phoneNumber}`)},{label:"SSN",value:Zn(e.ein,"Individual"),masked:ps(e.ein,"Individual")},{label:"Address",value:xs(e)}]},...t?[{title:"Secondary Taxpayer Details",rows:[{label:"First Name",value:t.firstName.trim()},{label:"Last Name",value:t.lastName.trim()},{label:"Email",value:t.email},{label:"Phone Number",value:t.phone},{label:"SSN",value:Zn(t.ssn,"Individual"),masked:ps(t.ssn,"Individual")},{label:"Address",value:xs(t)}]}]:[]]:[{rows:[{label:"Entity Name",value:e.lastName.trim()},{label:"Email",value:e.email},{label:"Phone Number",value:sn(`${e.countryCode}${e.phoneNumber}`)},{label:"Entity Type",value:e.entityType},{label:"EIN",value:Zn(e.ein,"Business"),masked:ps(e.ein,"Business")},{label:"Address",value:xs(e)}]}]:[]}function t6(){return r.jsxs("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.5 12.5l2.5 2.5 5-5"})]})}function n6(){return r.jsxs("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.5 9.5l5 5M14.5 9.5l-5 5"})]})}const r6={accountType:{title:"Account Type",required:!0,description:"Choose who the tax account and payments belong to. Your selection controls the identity fields and validation used on the form.",tips:[r.jsxs(r.Fragment,{children:["Choose ",r.jsx("strong",{children:"Business"})," for a registered organization using an EIN."]}),r.jsxs(r.Fragment,{children:["Choose ",r.jsx("strong",{children:"Individual"})," for personal obligations using an SSN or ITIN."]}),"Select the taxpayer that is legally responsible for the payment."],correct:"Business — ABC Consulting, LLC",mistake:"Individual — when the obligation belongs to the company EIN"},legalBusinessName:{title:"Legal Business Name",required:!0,description:r.jsxs(r.Fragment,{children:["Enter the exact legal name associated with the EIN in the business's ",r.jsx("strong",{children:"IRS records"}),"."]}),tips:[r.jsxs(r.Fragment,{children:["Use the name shown on ",r.jsx("strong",{children:"IRS Letter CP 575"}),", ",r.jsx("strong",{children:"Letter 147C"}),", or the latest tax return."]}),"Include punctuation and the full legal suffix, such as LLC, Inc., or Corp.","Do not enter a DBA, trade name, or shortened name here."],correct:"John's Consulting Services, LLC",mistake:`John's Consulting — when the IRS name includes "Services, LLC"`},businessDisplayName:{title:"Business Display Name",required:!1,description:"Add a familiar name to identify this entity in GovPay. This name is for your workspace and does not replace the legal business name.",tips:["Use a short name your team will easily recognize.","Add a location or division when managing similar entities.","Leave it blank if the legal name is already clear."],correct:"John's Consulting — West Office",mistake:"Using the legal name of a different business or taxpayer"},email:{title:"Email",required:!0,description:"Enter the primary email address for payment updates, verification messages, and action-required alerts.",tips:["Use an inbox that is actively monitored.","Prefer a business email accessible to the responsible user or team.","Check the spelling before continuing."],correct:"tax@johnsconsulting.com",mistake:"taxx@johnsconsulting.com — misspelled or inaccessible inbox"},phoneNumber:{title:"Phone Number",required:!0,description:"Provide the best contact number for account or payment-related questions.",tips:["Use an active number for the responsible contact.","Include the country code and area code.","Avoid shared numbers that your team cannot reliably access."],correct:"+1 (512) 555-0184",mistake:"555-0184 — missing the country code and area code"},entityType:{title:"Entity Type",required:!0,description:"Select the legal structure under which the business is registered.",tips:["Use formation or registration documents as your source.","Choose the full entity type, such as LLC, Corporation, or Partnership.","Do not guess from the business name or tax form alone."],correct:"Limited Liability Company (LLC)",mistake:"Corporation — when registration documents identify an LLC"},ein:{title:"EIN",required:!0,description:r.jsxs(r.Fragment,{children:["Enter the nine-digit ",r.jsx("strong",{children:"Employer Identification Number"})," assigned to the business by the IRS."]}),tips:["Use an IRS-issued document or the latest filed tax return.","Enter all nine digits in XX-XXXXXXX format.","Do not enter a state tax ID, account number, SSN, or ITIN."],correct:"12-3456789",mistake:"12345678 — incomplete, or a state account number"},address1:{title:"Address Line 1",required:!0,description:"Enter the primary street address used for the business's official mailing or tax correspondence.",tips:["Include the street number and full street name.","Use the address shown on current business or tax records.","Place suite, unit, floor, or attention details in Address Line 2."],correct:"245 Market Street",mistake:"Austin, Texas — city and state entered as the street address"},address2:{title:"Address Line 2",required:!1,description:"Add secondary delivery details needed to locate the business within the main street address.",tips:["Use this field for a suite, unit, floor, building, or attention line.","Leave it blank if no additional address information is required.","Do not repeat the city, state, ZIP Code, or country."],correct:"Suite 400",mistake:"Austin, TX 78701 — belongs in the city, state, and ZIP fields"},city:{title:"City",required:!0,description:"Enter the city associated with the business address and ZIP Code.",tips:["Use the official or USPS-recognized city name.","Make sure it matches the selected state and ZIP Code.","Do not include the state abbreviation or ZIP Code in this field."],correct:"Austin",mistake:"Austin, TX 78701"},state:{title:"State",required:!0,description:"Select the state in which this business address is physically located.",tips:["Match the state to the city and ZIP Code entered above.","Use the address state — not automatically the state of incorporation.","Select the state from the list instead of typing an abbreviation."],correct:"Texas (TX)",mistake:"Delaware — selected only because the business was incorporated there"},zipCode:{title:"ZIP Code",required:!0,description:"Enter the postal ZIP Code for the business address.",tips:["Use a five-digit ZIP Code or ZIP+4 when available.","Keep any leading zero.","Confirm that it matches the selected city and state."],correct:"78701 or 78701-1234",mistake:"7871 — fewer than five digits"},country:{title:"Country",required:!0,description:"Select the country where the business address is located. This controls the address format and available location fields.",tips:["Choose the country for the address entered — not the owner's residence.","Confirm that the state or region and postal code use that country's format.","Do not select United States only because the business has an EIN."],correct:"United States — for an address in Austin, Texas",mistake:"United States — when the entered business address is in Canada"}},s6=[r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-medium text-slate-700",children:"Business:"})," Have your IRS EIN confirmation letter (CP-575) on hand."]}),r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-medium text-slate-700",children:"Individual:"})," Have your Social Security card on hand for your name and SSN."]}),"Select any field and this box shows exactly how to write it."];function a6({active:e}){return r.jsxs("aside",{className:"w-full shrink-0 rounded-xl border border-slate-200 bg-white p-5 lg:sticky lg:top-6 lg:w-80 shadow-lg",children:[r.jsx("h3",{className:"border-l-2 border-gov-600 pl-2 text-xs font-semibold italic text-gov-700",children:"How to fill this"}),e?r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("h4",{className:"text-base font-semibold text-slate-900",children:e.title}),r.jsx("span",{className:`mt-0.5 shrink-0 rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${e.required?"bg-red-50 text-red-600":"bg-gov-50 text-gov-700"}`,children:e.required?"Required":"Optional"})]}),r.jsx("p",{className:"mt-2 text-sm text-slate-600",children:e.description}),r.jsx("ul",{className:"mt-3 list-disc space-y-2 pl-5 text-sm text-slate-600",children:e.tips.map((t,n)=>r.jsx("li",{children:t},n))}),e.correct?r.jsx(dl,{tone:"correct",label:"Correct format",value:e.correct}):null,e.mistake?r.jsx(dl,{tone:"mistake",label:"Common mistake",value:e.mistake}):null]}):r.jsxs("div",{className:"mt-3",children:[r.jsx("p",{className:"text-sm text-slate-600",children:"We verify these details against IRS records, so accuracy here determines whether your filings are accepted."}),r.jsx("ul",{className:"mt-3 list-disc space-y-2 pl-5 text-sm text-slate-600",children:s6.map((t,n)=>r.jsx("li",{children:t},n))})]})]})}function dl({tone:e,label:t,value:n}){const s=e==="correct";return r.jsxs("div",{className:s?"mt-4 rounded-lg border border-emerald-200 bg-emerald-50 p-3":"mt-3 rounded-lg border border-red-200 bg-red-50 p-3",children:[r.jsxs("p",{className:`flex items-center gap-1.5 text-xs font-semibold ${s?"text-emerald-700":"text-red-700"}`,children:[s?r.jsx(t6,{}):r.jsx(n6,{}),t]}),r.jsx("p",{className:`mt-1 text-sm ${s?"text-emerald-900":"text-red-900"}`,children:n})]})}function i6({register:e,errors:t,einRegister:n,phoneRegister:s,countryCodeRegister:a,accountType:i,idLabel:o,idPlaceholder:l,idMaxLength:c,resetHelp:d}){var u,h,m,f,p;return r.jsxs(r.Fragment,{children:[r.jsx("h3",{className:"mb-5 text-sm font-semibold text-slate-900",children:"Primary Taxpayer Details"}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx(ce,{label:"First Name",required:!0,maxLength:100,placeholder:"Enter First Name",error:(u=t.firstName)==null?void 0:u.message,...e("firstName"),onFocus:d},"entity-first-name"),r.jsx(ce,{label:"Last Name",required:!0,maxLength:100,placeholder:"Enter Last Name",error:(h=t.lastName)==null?void 0:h.message,...e("lastName"),onFocus:d},"entity-last-name"),r.jsx(Iu,{label:o,placeholder:l,maxLength:c,accountType:i,register:n,error:(m=t.ein)==null?void 0:m.message,onFocus:d})]}),r.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx(ce,{label:"Email",required:!0,type:"email",maxLength:254,placeholder:"Enter Email",error:(f=t.email)==null?void 0:f.message,...e("email"),onFocus:d}),r.jsx(Tu,{countryCodeRegister:a,phoneRegister:s,error:(p=t.phoneNumber)==null?void 0:p.message,onFocus:d})]})]})}function o6({values:e,address:t,stateOptions:n,onFieldChange:s,onSsnChange:a,onSameAsPrimaryChange:i}){const o=e.sameAsPrimaryAddress;return r.jsxs("section",{className:"space-y-6 rounded-xl border border-slate-200 bg-white p-6",children:[r.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:"Secondary Taxpayer Details (Optional)"}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{id:"secondary-first-name",label:"First Name",required:!0,maxLength:100,placeholder:"Enter First Name",value:e.firstName,onChange:s("firstName")}),r.jsx(ce,{id:"secondary-last-name",label:"Last Name",required:!0,maxLength:100,placeholder:"Enter Last Name",value:e.lastName,onChange:s("lastName")})]}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{id:"secondary-ssn",label:"SSN",required:!0,inputMode:"numeric",placeholder:"Enter SSN",maxLength:11,value:e.ssn,onChange:l=>a(l.target.value)}),r.jsx(ce,{id:"secondary-email",label:"Email",required:!0,type:"email",maxLength:254,placeholder:"Enter Email",value:e.email,onChange:s("email")})]}),r.jsx("div",{className:"grid gap-5 sm:grid-cols-2",children:r.jsx(ce,{id:"secondary-phone",label:"Phone Number",required:!0,type:"tel",placeholder:"+1 (999)999-9999",value:e.phone,onChange:s("phone")})}),r.jsxs("div",{className:"border-t border-slate-100 pt-6",children:[r.jsxs("div",{className:"mb-5 flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:"Address Details"}),r.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-600",children:[r.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-2 focus:ring-gov-200",checked:o,onChange:l=>i(l.target.checked)}),"Same as Primary Taxpayer's Address"]})]}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{id:"secondary-address1",label:"Address Line 1",required:!0,maxLength:200,placeholder:"Enter Address Line 1",value:t.address1,disabled:o,onChange:s("address1")}),r.jsx(ce,{id:"secondary-address2",label:"Address Line 2",maxLength:200,placeholder:"Enter Address Line 2",value:t.address2,disabled:o,onChange:s("address2")})]}),r.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{id:"secondary-city",label:"City",required:!0,maxLength:100,placeholder:"Enter City",value:t.city,disabled:o,onChange:s("city")}),r.jsxs(lt,{id:"secondary-state",label:"State",required:!0,value:t.state,disabled:o,onChange:s("state"),children:[r.jsx("option",{value:"",children:"Select State"}),n.map(l=>r.jsx("option",{value:l.code,children:l.name},l.code))]})]}),r.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{id:"secondary-zip",label:"ZIP Code",required:!0,maxLength:10,placeholder:"Enter ZIP Code",value:t.zipCode,disabled:o,onChange:s("zipCode")}),r.jsx(lt,{id:"secondary-country",label:"Country",required:!0,value:t.country,disabled:o,onChange:s("country"),children:ta.map(l=>r.jsx("option",{value:l,children:l},l))})]})]})]})}var Xr=e=>e.type==="checkbox",yn=e=>e instanceof Date,Xe=e=>e==null;const Wi=e=>typeof e=="object";var Te=e=>!Xe(e)&&!Array.isArray(e)&&Wi(e)&&!yn(e),ti=e=>Te(e)&&e.target?Xr(e.target)?e.target.checked:e.target.value:e,Fu=(e,t)=>t.split(".").some((n,s,a)=>!isNaN(Number(n))&&e.has(a.slice(0,s).join("."))),Ru=e=>{const t=e.constructor&&e.constructor.prototype;return Te(t)&&t.hasOwnProperty("isPrototypeOf")},na=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function De(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(na&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(Te(e)&&Ru(e)))return e;const s=n?[]:Object.create(Object.getPrototypeOf(e));for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(s[a]=De(e[a]));return s}const ln={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},Vt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ot={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Du="root",Yi=["__proto__","constructor","prototype"],l6=/^\w*$/;var _r=e=>l6.test(e),ke=e=>e===void 0;const c6=/[.[\]'"]/;var ra=e=>e.split(c6).filter(Boolean),Y=(e,t,n)=>{if(!t||!Te(e))return n;const s=_r(t)?[t]:ra(t);if(s.some(i=>Yi.includes(i)))return n;const a=s.reduce((i,o)=>Xe(i)?void 0:i[o],e);return ke(a)||a===e?ke(e[t])?n:e[t]:a},Ct=e=>typeof e=="boolean",tt=e=>typeof e=="function",ye=(e,t,n)=>{let s=-1;const a=_r(t)?[t]:ra(t),i=a.length,o=i-1;for(;++s<i;){const l=a[s];let c=n;if(s!==o){const d=e[l];c=Te(d)||Array.isArray(d)?d:isNaN(+a[s+1])?{}:[]}if(Yi.includes(l))return;e[l]=c,e=e[l]}};const Mu=x.createContext(null);Mu.displayName="HookFormControlContext";const Hi=()=>x.useContext(Mu);var Ou=(e,t,n,s=!0)=>{const a={};for(const i in e)Object.defineProperty(a,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Vt.all&&(t._proxyFormState[o]=!s||Vt.all),n&&(n[o]=!0),e[o]}});return a};const Ki=na?x.useLayoutEffect:x.useEffect;function u6(e){const t=Hi(),{control:n=t,disabled:s,name:a,exact:i}=e||{},[o,l]=x.useState(()=>({...n._formState,defaultValues:n._defaultValues})),c=x.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ki(()=>n._subscribe({name:a,formState:c.current,exact:i,callback:d=>{!s&&l({...n._formState,...d,defaultValues:n._defaultValues})}}),[a,s,i]),x.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),x.useMemo(()=>Ou(o,n,c.current,!1),[o,n])}var nt=e=>typeof e=="string",ni=(e,t,n,s,a)=>nt(e)?(s&&t.watch.add(e),Y(n,e,a)):Array.isArray(e)?e.map(i=>(s&&t.watch.add(i),Y(n,i))):(s&&(t.watchAll=!0),n),ri=e=>Xe(e)||!Wi(e);const ml=(e,t)=>t.length===0&&!Array.isArray(e)&&!Ru(e);function jt(e,t,n=new WeakMap){if(e===t)return!0;if(ri(e)||ri(t))return Object.is(e,t);if(yn(e)&&yn(t))return Object.is(e.getTime(),t.getTime());const s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;if(ml(e,s)||ml(t,a))return Object.is(e,t);if(!s.length&&Array.isArray(e)!==Array.isArray(t))return!1;const i=n.get(e);if(i&&i.has(t))return!0;if(i)i.add(t);else{const o=new WeakSet;o.add(t),n.set(e,o)}for(const o of s){const l=e[o];if(!(o in t))return!1;if(o!=="ref"){const c=t[o];if(yn(l)&&yn(c)||(Te(l)||Array.isArray(l))&&(Te(c)||Array.isArray(c))?!jt(l,c,n):!Object.is(l,c))return!1}}return!0}function d6(e){const t=Hi(),{control:n=t,name:s,defaultValue:a,disabled:i,exact:o,compute:l}=e||{},c=x.useRef(a),d=x.useRef(l),u=x.useRef(void 0),h=x.useRef(n),m=x.useRef(s);d.current=l;const[f,p]=x.useState(()=>{const N=n._getWatch(s,c.current);return d.current?d.current(N):N}),g=x.useCallback(N=>{const A=ni(s,n._names,N||n._formValues,!1,c.current);return d.current?d.current(A):A},[n._formValues,n._names,s]),y=x.useCallback(N=>{if(!i){const A=ni(s,n._names,N||n._formValues,!1,c.current);if(d.current){const S=d.current(A);jt(S,u.current)||(p(S),u.current=S)}else p(A)}},[n._formValues,n._names,i,s]);Ki(()=>((h.current!==n||!jt(m.current,s))&&(h.current=n,m.current=s,y()),n._subscribe({name:s,formState:{values:!0},exact:o,callback:N=>{y(N.values)}})),[n,o,s,y]),x.useEffect(()=>n._removeUnmounted());const C=h.current!==n,b=m.current,j=x.useMemo(()=>{if(i)return null;const N=!C&&!jt(b,s);return C||N?g():null},[i,C,s,b,g]);return j!==null?j:f}function m6(e){const t=Hi(),{name:n,disabled:s,control:a=t,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,c=Fu(a._names.array,n),d=x.useMemo(()=>Y(a._formValues,n,Y(a._defaultValues,n,o)),[a,n,o]),u=d6({control:a,name:n,defaultValue:d,exact:l}),h=u6({control:a,name:n,exact:l}),m=x.useRef(e),f=x.useRef(null),p=x.useRef(a.register(n,{...e.rules,value:u,...Ct(e.disabled)?{disabled:e.disabled}:{}}));m.current=e;const g=x.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Y(h.errors,n)},isDirty:{enumerable:!0,get:()=>!!Y(h.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Y(h.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Y(h.validatingFields,n)},error:{enumerable:!0,get:()=>Y(h.errors,n)}}),[h,n]),y=x.useCallback(N=>{const A=ti(N);return Y(a._fields,n)||(p.current=a.register(n,{...m.current.rules,value:A})),p.current.onChange({target:{value:ti(N),name:n},type:ln.CHANGE})},[n,a]),C=x.useCallback(()=>p.current.onBlur({target:{value:Y(a._formValues,n),name:n},type:ln.BLUR}),[n,a._formValues]),b=x.useCallback(N=>{N&&(f.current={focus:()=>tt(N.focus)&&N.focus(),select:()=>tt(N.select)&&N.select(),setCustomValidity:S=>tt(N.setCustomValidity)&&N.setCustomValidity(S),reportValidity:()=>tt(N.reportValidity)&&N.reportValidity()});const A=Y(a._fields,n);A&&A._f&&N&&(A._f.ref=f.current)},[a._fields,n]),j=x.useMemo(()=>({name:n,value:u,...Ct(s)||h.disabled?{disabled:h.disabled||s}:{},onChange:y,onBlur:C,ref:b}),[n,s,h.disabled,y,C,b,u]);return x.useEffect(()=>{const N=a._options.shouldUnregister||i;a.register(n,{...m.current.rules,...Ct(m.current.disabled)?{disabled:m.current.disabled}:{}});const A=(S,R)=>{const E=Y(a._fields,S);E&&E._f&&(E._f.mount=R)};if(A(n,!0),N){const S=De(Y(i?a._defaultValues:a._options.values||a._defaultValues,n,Y(a._options.defaultValues,n,m.current.defaultValue)));ye(a._defaultValues,n,S),ke(Y(a._formValues,n))&&ye(a._formValues,n,S)}if(!c&&a.register(n),f.current){const S=Y(a._fields,n);S&&S._f&&(S._f.ref=f.current)}return()=>{(c?N&&!a._state.action:N)?a.unregister(n):A(n,!1)}},[n,a,c,i]),x.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),x.useMemo(()=>({field:j,formState:h,fieldState:g}),[j,h,g])}const Ye=e=>e.render(m6(e)),zu=e=>{const t={};for(const n of Object.keys(e))if(Wi(e[n])&&e[n]!==null&&!yn(e[n])){const s=zu(e[n]);for(const a of Object.keys(s))t[`${n}.${a}`]=s[a]}else t[n]=e[n];return t},h6=x.createContext(null);h6.displayName="HookFormContext";var Qi=(e,t,n,s,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:a||!0}}:{},Vu=e=>Array.isArray(e)?e.filter(Boolean):[],gs=e=>Array.isArray(e)?e:[e],hl=()=>{let e=[];return{get observers(){return e},next:a=>{for(const i of e)i.next&&i.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(i=>i!==a)}}),unsubscribe:()=>{e=[]}}};function qu(e,t){const n={};for(const s in e)if(e.hasOwnProperty(s)){const a=e[s],i=t[s];if(a&&Te(a)&&i){const o=qu(a,i);Te(o)&&(n[s]=o)}else e[s]&&(n[s]=i)}return n}var Je=e=>Te(e)&&!Object.keys(e).length,Gi=e=>e.type==="file",Ts=e=>{if(!na)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Zu=e=>e.type==="select-multiple",Ji=e=>e.type==="radio",f6=e=>Ji(e)||Xr(e),fa=e=>Ts(e)&&e.isConnected;function p6(e,t){const n=t.slice(0,-1).length;let s=0;for(;s<n;){if(Xe(e)){e=void 0;break}e=e[t[s]],s++}return e}function x6(e){for(const t in e)if(e.hasOwnProperty(t)&&!ke(e[t]))return!1;return!0}function We(e,t){if(nt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const n=Array.isArray(t)?t:_r(t)?[t]:ra(t);if(n.some(o=>Yi.includes(String(o))))return e;const s=n.length===1?e:p6(e,n),a=n.length-1,i=n[a];return s&&delete s[i],a!==0&&(Te(s)&&Je(s)||Array.isArray(s)&&x6(s))&&We(e,n.slice(0,-1)),e}var g6=e=>{for(const t in e)if(tt(e[t]))return!0;return!1};function Uu(e){return Array.isArray(e)||Te(e)&&!g6(e)}function si(e,t={}){for(const n in e){const s=e[n];Uu(s)?(t[n]=Array.isArray(s)?[]:{},si(s,t[n])):ke(s)||(t[n]=!0)}return t}function ai(e){if(e!==!1){if(e===!0)return!0;if(Array.isArray(e)){const t=e.map(n=>ai(n));return t.some(n=>n!==void 0)?t:void 0}if(Te(e)){const t={};for(const n in e){const s=ai(e[n]);ke(s)||(t[n]=s)}return Object.keys(t).length?t:void 0}}}function In(e,t,n){n||(n=si(t));for(const s in e){const a=e[s];if(Uu(a))ke(t)||ri(n[s])?n[s]=si(a,Array.isArray(a)?[]:{}):In(a,Xe(t)?{}:t[s],n[s]);else{const i=t[s];n[s]=!jt(a,i)}}return ai(n)||{}}const fl={value:!1,isValid:!1},pl={value:!0,isValid:!0};var Bu=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!ke(e[0].attributes.value)?ke(e[0].value)||e[0].value===""?pl:{value:e[0].value,isValid:!0}:pl:fl}return fl},Wu=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:s})=>ke(e)?e:t?e===""?NaN:e&&+e:n&&nt(e)?new Date(e):s?s(e):e;const xl={isValid:!1,value:null};var Yu=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,xl):xl;function gl(e){const t=e.ref;return Gi(t)?t.files:Ji(t)?Yu(e.refs).value:Zu(t)?[...t.selectedOptions].map(({value:n})=>n):Xr(t)?Bu(e.refs).value:Wu(ke(t.value)?e.ref.value:t.value,e)}var y6=(e,t,n,s)=>{const a={};for(const i of e){const o=Y(t,i);o&&ye(a,i,o._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:s}},Ls=e=>e instanceof RegExp,Ir=e=>ke(e)?e:Ls(e)?e.source:Te(e)?Ls(e.value)?e.value.source:e.value:e,os=e=>({isOnSubmit:!e||e===Vt.onSubmit,isOnBlur:e===Vt.onBlur,isOnChange:e===Vt.onChange,isOnAll:e===Vt.all,isOnTouch:e===Vt.onTouched});const yl="AsyncFunction";var b6=e=>{if(!e||!e.validate)return!1;if(tt(e.validate))return e.validate.constructor.name===yl;if(Te(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===yl)return!0}return!1},v6=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),pa=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const s of t.watch)if(e.startsWith(s)&&e.charAt(s.length)===".")return!0;return!1};const Dr=(e,t,n,s)=>{for(const a of n||Object.keys(e)){const i=Y(e,a);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],a)&&!s)return!0;if(o.ref&&t(o.ref,o.name)&&!s)return!0;if(Dr(l,t))break}else if(Te(l)&&Dr(l,t))break}}};function bl(e,t,n){const s=Y(e,n);if(s||_r(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const i=a.join("."),o=Y(t,i),l=Y(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};a.pop()}return{name:n}}var C6=(e,t,n,s)=>{n(e);const{name:a,...i}=e,o=Object.keys(i);return!o.length||s&&o.length>=Object.keys(t).length||o.find(l=>t[l]===(!s||Vt.all))},j6=(e,t,n)=>!e||!t||e===t||gs(e).some(s=>s&&(n?s===t||s.startsWith(t+"."):s.startsWith(t)||t.startsWith(s))),w6=(e,t,n,s,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?s.isOnBlur:a.isOnBlur)?!e:(n?s.isOnChange:a.isOnChange)?e:!0,N6=(e,t)=>!Vu(Y(e,t)).length&&We(e,t),vl=(e,t,n)=>{const s=Y(e,n),a=Array.isArray(s)?s:[];return ye(a,Du,t[n]),ye(e,n,a),e};function Cl(e,t,n="validate"){if(nt(e)||Array.isArray(e)&&e.every(nt)||Ct(e)&&!e)return{type:n,message:nt(e)?e:"",ref:t}}var Jn=e=>Te(e)&&!Ls(e)?e:{value:e,message:""},jl=async(e,t,n,s,a,i)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:u,min:h,max:m,pattern:f,validate:p,name:g,valueAsNumber:y,mount:C}=e._f,b=Y(n,g);if(!C||t.has(g))return{};const j=l?l[0]:o,N=_=>{if(a&&j.reportValidity){const V=Ct(_)?"":_||"";l?l.forEach(q=>q.setCustomValidity(V)):j.setCustomValidity(V),j.reportValidity()}},A={},S=Ji(o),R=Xr(o),E=S||R,z=(y||Gi(o))&&ke(o.value)&&ke(b)||Ts(o)&&o.value===""||b===""||Array.isArray(b)&&!b.length,X=Qi.bind(null,g,s,A),H=(_,V,q,B=Ot.maxLength,ee=Ot.minLength)=>{const W=_?V:q;A[g]={type:_?B:ee,message:W,ref:o,...X(_?B:ee,W)}};if(i?!Array.isArray(b)||!b.length:c&&(!E&&(z||Xe(b))||Ct(b)&&!b||R&&!Bu(l).isValid||S&&!Yu(l).isValid)){const{value:_,message:V}=nt(c)?{value:!!c,message:c}:Jn(c);if(_&&(A[g]={type:Ot.required,message:V,ref:j,...X(Ot.required,V)},!s))return N(V),A}if(!z&&(!Xe(h)||!Xe(m))){let _,V;const q=Jn(m),B=Jn(h);if(!Xe(b)&&!isNaN(b)){const ee=o.valueAsNumber||b&&+b;Xe(q.value)||(_=ee>q.value),Xe(B.value)||(V=ee<B.value)}else{const ee=o.valueAsDate||new Date(b),W=Re=>new Date(new Date().toDateString()+" "+Re),ue=o.type=="time",we=o.type=="week";nt(q.value)&&b&&(_=ue?W(b)>W(q.value):we?b>q.value:ee>new Date(q.value)),nt(B.value)&&b&&(V=ue?W(b)<W(B.value):we?b<B.value:ee<new Date(B.value))}if((_||V)&&(H(!!_,q.message,B.message,Ot.max,Ot.min),!s))return N(A[g].message),A}if((d||u)&&!z&&(nt(b)||i&&Array.isArray(b))){const _=Jn(d),V=Jn(u),q=!Xe(_.value)&&b.length>+_.value,B=!Xe(V.value)&&b.length<+V.value;if((q||B)&&(H(q,_.message,V.message),!s))return N(A[g].message),A}if(f&&!z&&nt(b)){const{value:_,message:V}=Jn(f);if(Ls(_)&&!b.match(_)&&(A[g]={type:Ot.pattern,message:V,ref:o,...X(Ot.pattern,V)},!s))return N(V),A}if(p){if(tt(p)){const _=await p(b,n),V=Cl(_,j);if(V&&(A[g]={...V,...X(Ot.validate,V.message)},!s))return N(V.message),A}else if(Te(p)){let _={};for(const V in p){if(!Je(_)&&!s)break;const q=Cl(await p[V](b,n),j,V);q&&(_={...q,...X(V,q.message)},N(q.message),s&&(A[g]=_))}if(!Je(_)&&(A[g]={ref:j,..._},!s))return A}}return N(!0),A};const S6={mode:Vt.onSubmit,reValidateMode:Vt.onChange,shouldFocusError:!0},xa="form",Hu={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function k6(e={}){let t={...S6,...e},n={...De(Hu),isLoading:tt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},s={},a=Te(t.defaultValues)||Te(t.values)?De(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:De(a),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,d=0,u=0,h=os(t.mode),m=os(t.reValidateMode);const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={...f};let g={...p};const y={array:hl(),state:hl()},C=t.criteriaMode===Vt.all,b=v=>k=>{clearTimeout(d),d=setTimeout(v,k)},j=async v=>{if(!o.keepIsValid&&!t.disabled&&(p.isValid||g.isValid||v)){let k;t.resolver?(k=Je((await V()).errors),N()):k=await ee({fields:s,onlyCheckValid:!0,eventType:ln.VALID}),k!==n.isValid&&y.state.next({isValid:k})}},N=(v,k)=>{!t.disabled&&(p.isValidating||p.validatingFields||g.isValidating||g.validatingFields)&&((v||Array.from(l.mount)).forEach(P=>{P&&(k?ye(n.validatingFields,P,k):We(n.validatingFields,P))}),y.state.next({validatingFields:n.validatingFields,isValidating:!Je(n.validatingFields)}))},A=()=>{n.dirtyFields=In(a,i)},S=(v,k=[],P,M,O=!0,G=!0)=>{if(M&&P&&!t.disabled){if(o.action=!0,G&&Array.isArray(Y(s,v))){const T=P(Y(s,v),M.argA,M.argB);O&&ye(s,v,T)}if(G&&Array.isArray(Y(n.errors,v))){const T=P(Y(n.errors,v),M.argA,M.argB);O&&ye(n.errors,v,T),N6(n.errors,v)}if((p.touchedFields||g.touchedFields)&&G&&Array.isArray(Y(n.touchedFields,v))){const T=P(Y(n.touchedFields,v),M.argA,M.argB);O&&ye(n.touchedFields,v,T)}(p.dirtyFields||g.dirtyFields)&&A(),y.state.next({name:v,isDirty:ue(v,k),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ye(i,v,k)},R=(v,k)=>{ye(n.errors,v,k),n.errors={...n.errors},y.state.next({errors:n.errors})},E=v=>{n.errors=v,y.state.next({errors:n.errors,isValid:!1})},z=v=>{const k=_r(v)?[v]:ra(v);let P=i,M=a;for(let O=0;O<k.length-1;O++){const G=k[O];if(P=Xe(P)?P:P[G],M=Xe(M)?M:M[G],P===null&&M!==null)return!0}return!1},X=(v,k,P,M)=>{const O=Y(s,v);if(O){if(z(v))return;const G=ke(Y(i,v)),T=Y(i,v,ke(P)?Y(a,v):P);ke(T)||M&&M.defaultChecked||k?ye(i,v,k?T:gl(O._f)):Ce(v,T),o.mount&&!o.action&&(j(),G&&n.isDirty&&(p.isDirty||g.isDirty)&&(ue()||(n.isDirty=!1,y.state.next({...n}))),e.shouldUnregister&&G&&!ke(Y(i,v))&&pa(v,l)&&(o.watch=!0))}},H=(v,k,P,M,O)=>{let G=!1,T=!1;const Z={name:v};if(!t.disabled){if(!P||M){const se=jt(Y(a,v),k);(p.isDirty||g.isDirty)&&(T=n.isDirty,n.isDirty=Z.isDirty=!se||ue(),G=T!==Z.isDirty),T=!!Y(n.dirtyFields,v),se!==n.isDirty?n.dirtyFields=In(a,i):se?We(n.dirtyFields,v):ye(n.dirtyFields,v,!0),Z.dirtyFields=n.dirtyFields,G=G||(p.dirtyFields||g.dirtyFields)&&T!==!se}if(P){const se=Y(n.touchedFields,v);se||(ye(n.touchedFields,v,P),Z.touchedFields=n.touchedFields,G=G||(p.touchedFields||g.touchedFields)&&se!==P)}G&&O&&y.state.next(Z)}return G?Z:{}},_=(v,k,P,M)=>{const O=Y(n.errors,v),G=(p.isValid||g.isValid)&&Ct(k)&&n.isValid!==k;if(t.delayError&&P?(c=b(()=>R(v,P)),c(t.delayError)):(clearTimeout(d),c=null,P?ye(n.errors,v,P):We(n.errors,v),n.errors={...n.errors}),(P?!jt(O,P):O)||!Je(M)||G){const T={...M,...G&&Ct(k)?{isValid:k}:{},errors:n.errors,name:v};n={...n,...T},y.state.next(T)}},V=async v=>(N(v,!0),await t.resolver(i,t.context,y6(v||l.mount,s,t.criteriaMode,t.shouldUseNativeValidation))),q=async v=>{const{errors:k}=await V(v);if(N(v),v){for(const P of v){const M=Y(k,P);M?l.array.has(P)&&Te(M)&&!Object.keys(M).some(O=>!Number.isNaN(Number(O)))?vl(n.errors,{[P]:M},P):ye(n.errors,P,M):We(n.errors,P)}n.errors={...n.errors}}else n.errors=k;return k},B=async({name:v,eventType:k})=>{if(e.validate){const P=await e.validate({formValues:i,formState:n,name:v,eventType:k});if(Te(P))for(const M in P){const O=P[M];O&&Ue(`${xa}.${M}`,{message:nt(O.message)?O.message:"",type:O.type||Ot.validate})}else nt(P)||!P?Ue(xa,{message:P||"",type:Ot.validate}):pe(xa);return P}return!0},ee=async({fields:v,onlyCheckValid:k,name:P,eventType:M,context:O={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(O.runRootValidation=!0,!await B({name:P,eventType:M})&&(O.valid=!1,k)))return O.valid;for(const G in v){const T=v[G];if(T){const{_f:Z,...se}=T;if(Z){const L=l.array.has(Z.name),he=T._f&&b6(T._f),gt=p.validatingFields||p.isValidating||g.validatingFields||g.isValidating;he&>&&N([Z.name],!0);const yt=await jl(T,l.disabled,i,C,t.shouldUseNativeValidation&&!k,L);if(he&>&&N([Z.name]),yt[Z.name]&&(O.valid=!1,k)||(!k&&(Y(yt,Z.name)?L?vl(n.errors,yt,Z.name):ye(n.errors,Z.name,yt[Z.name]):We(n.errors,Z.name)),e.shouldUseNativeValidation&&yt[Z.name]))break}!Je(se)&&await ee({context:O,onlyCheckValid:k,fields:se,name:G,eventType:M})}}return O.valid},W=()=>{for(const v of l.unMount){const k=Y(s,v);k&&(k._f.refs?k._f.refs.every(P=>!fa(P)):!fa(k._f.ref))&&ze(v)}l.unMount=new Set},ue=(v,k)=>!t.disabled&&(v&&k&&ye(i,v,k),!jt(o.mount?i:a,a)),we=(v,k,P)=>ni(v,l,{...o.mount?i:ke(k)?a:nt(v)?{[v]:k}:k},P,k),Re=v=>Vu(Y(o.mount?i:a,v,t.shouldUnregister?Y(a,v,[]):[])),Ce=(v,k,P={},M=!1,O=!1)=>{const G=Y(s,v);let T=k;if(G){const Z=G._f;Z&&(!Z.disabled&&ye(i,v,Wu(k,Z)),T=Ts(Z.ref)&&Xe(k)?"":k,Zu(Z.ref)?[...Z.ref.options].forEach(se=>se.selected=T.includes(se.value)):Z.refs?Xr(Z.ref)?Z.refs.forEach(se=>{(!se.defaultChecked||!se.disabled)&&(Array.isArray(T)?se.checked=!!T.find(L=>L===se.value):se.checked=T===se.value||!!T)}):Z.refs.forEach(se=>se.checked=se.value===T):Gi(Z.ref)?Z.ref.value="":(Z.ref.value=T,!Z.ref.type&&!O&&y.state.next({name:v,values:M?i:De(i)})))}(P.shouldDirty||P.shouldTouch)&&H(v,T,P.shouldTouch,P.shouldDirty,!O),P.shouldValidate&&U(v)},Oe=(v,k,P,M=!1,O=!1)=>{for(const G in k){if(!k.hasOwnProperty(G))return;const T=k[G],Z=v+"."+G,se=Y(s,Z);(l.array.has(v)||Te(T)||se&&!se._f)&&!yn(T)?Oe(Z,T,P,M,O):Ce(Z,T,P,M,O)}},Ne=(v,k,P,M,O=!1)=>{const G=Y(s,v),T=l.array.has(v),Z=M?k:De(k),se=Y(i,v),L=jt(se,Z);if(L||ye(i,v,Z),T)y.array.next({name:v,values:M?i:De(i)}),(p.isDirty||p.dirtyFields||g.isDirty||g.dirtyFields)&&P.shouldDirty&&(A(),O||y.state.next({name:v,dirtyFields:n.dirtyFields,isDirty:ue(v,Z)}));else{const he=Array.isArray(Z)&&!Z.length||Je(Z);!G||G._f||Xe(Z)||he?Ce(v,Z,P,M,O):Oe(v,Z,P,M,O)}if(!L&&!O){const he=pa(v,l),gt=M?i:De(i);y.state.next({...he&&n,name:o.mount||he?v:void 0,values:gt})}},ve=(v,k,P={})=>Ne(v,k,P,!1),Pe=(v,k={})=>{const P=tt(v)?v(i):v;if(!jt(i,P)){i={...i,...P};const M=zu(P);for(const O of l.mount)O in M&&Ne(O,M[O],k,!0,!0);y.state.next({...n,name:void 0,type:void 0,...u?{values:i}:{}}),k.shouldValidate&&j()}},ne=async v=>{o.mount=!0;const k=v.target;let P=k.name,M=!0;const O=Y(s,P),G=T=>{M=Number.isNaN(T)||yn(T)&&isNaN(T.getTime())||jt(T,Y(i,P,T))};if(O){let T,Z;const se=k.type?gl(O._f):ti(v),L=v.type===ln.BLUR||v.type===ln.FOCUS_OUT,he=!v6(O._f)&&!e.validate&&!t.resolver&&!Y(n.errors,P)&&!O._f.deps,gt=he||w6(L,Y(n.touchedFields,P),n.isSubmitted,m,h),yt=pa(P,l,L);ye(i,P,se),L?(!k||!k.readOnly)&&(O._f.onBlur&&O._f.onBlur(v),c&&c(0)):O._f.onChange&&O._f.onChange(v);const kr=H(P,se,L),Kd=!Je(kr)||yt;if(!L&&y.state.next({name:P,type:v.type,...u?{values:De(i)}:{}}),gt)return(!he||!n.isValid)&&(p.isValid||g.isValid)&&(t.mode==="onBlur"?L&&j():L||j()),Kd&&y.state.next({name:P,...yt?{}:kr});if(!t.resolver&&e.validate&&await B({name:P,eventType:v.type}),!L&&yt&&y.state.next({...n}),t.resolver){const{errors:jo}=await V([P]);if(N([P]),G(se),!M){!Je(kr)&&y.state.next(kr);return}const Qd=bl(n.errors,s,P),wo=bl(jo,s,Qd.name||P);T=wo.error,P=wo.name,Z=Je(jo)}else N([P],!0),T=(await jl(O,l.disabled,i,C,t.shouldUseNativeValidation))[P],N([P]),G(se),M&&(T?Z=!1:(p.isValid||g.isValid)&&(Z=await ee({fields:s,onlyCheckValid:!0,name:P,eventType:v.type})));M&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&U(O._f.deps),_(P,Z,T,kr))}},Se=(v,k)=>{if(Y(n.errors,k)&&v.focus)return v.focus(),1},U=async(v,k={})=>{let P,M;const O=gs(v);if(t.resolver){const G=await q(ke(v)?v:O);P=Je(G),M=v?!O.some(T=>Y(G,T)):P}else v?(M=(await Promise.all(O.map(async G=>{const T=Y(s,G);return await ee({fields:T&&T._f?{[G]:T}:T,eventType:ln.TRIGGER})}))).every(Boolean),!(!M&&!n.isValid)&&j()):M=P=await ee({fields:s,name:v,eventType:ln.TRIGGER});return y.state.next({...!nt(v)||(p.isValid||g.isValid)&&P!==n.isValid?{}:{name:v},...t.resolver||!v?{isValid:P}:{},errors:n.errors}),k.shouldFocus&&!M&&Dr(s,Se,v?O:l.mount),M},me=(v,k)=>{let P={...o.mount?i:a};return k&&(P=qu(k.dirtyFields?n.dirtyFields:n.touchedFields,P)),ke(v)?P:nt(v)?Y(P,v):v.map(M=>Y(P,M))},Q=(v,k)=>({invalid:!!Y((k||n).errors,v),isDirty:!!Y((k||n).dirtyFields,v),error:Y((k||n).errors,v),isValidating:!!Y(n.validatingFields,v),isTouched:!!Y((k||n).touchedFields,v)}),pe=v=>{const k=v?gs(v):void 0;k==null||k.forEach(P=>We(n.errors,P)),k?k.forEach(P=>{y.state.next({name:P,errors:n.errors})}):y.state.next({errors:{}})},Ue=(v,k,P)=>{const M=(Y(s,v,{_f:{}})._f||{}).ref,O=Y(n.errors,v)||{},{ref:G,message:T,type:Z,...se}=O;ye(n.errors,v,{...se,...k,ref:M}),y.state.next({name:v,errors:n.errors,isValid:!1}),P&&P.shouldFocus&&M&&M.focus&&M.focus()},$e=(v,k)=>{if(tt(v)){u++;const{unsubscribe:P}=y.state.subscribe({next:O=>"values"in O&&v(O.values||we(void 0,k),O)});let M=!1;return{unsubscribe:()=>{M||(M=!0,u--,P())}}}return we(v,k,!0)},Be=v=>{var k;const P=!!(!((k=v.formState)===null||k===void 0)&&k.values);P&&u++;const{unsubscribe:M}=y.state.subscribe({next:G=>{if(j6(v.name,G.name,v.exact)&&C6(G,v.formState||p,ut,v.reRenderRoot)){const T={...i};v.callback({values:T,...n,...G,defaultValues:a})}}});if(!P)return M;let O=!1;return()=>{O||(O=!0,u--,M())}},ct=v=>(o.mount=!0,g={...g,...v.formState},Be({...v,formState:{...f,...v.formState}})),ze=(v,k={})=>{for(const P of v?gs(v):l.mount)l.mount.delete(P),l.array.delete(P),k.keepValue||(We(s,P),We(i,P)),!k.keepError&&We(n.errors,P),!k.keepDirty&&We(n.dirtyFields,P),!k.keepTouched&&We(n.touchedFields,P),!k.keepIsValidating&&We(n.validatingFields,P),!t.shouldUnregister&&!k.keepDefaultValue&&We(a,P);y.state.next({values:De(i)}),y.state.next({...n,...k.keepDirty?{isDirty:ue()}:{}}),!k.keepIsValid&&j()},ft=({disabled:v,name:k})=>{if(Ct(v)&&o.mount||v||l.disabled.has(k)){const O=l.disabled.has(k)!==!!v;v?l.disabled.add(k):l.disabled.delete(k),O&&o.mount&&!o.action&&j()}},pt=(v,k={})=>{let P=Y(s,v);const M=Ct(k.disabled)||Ct(t.disabled),O=!l.registerName.has(v)&&P&&P._f&&!P._f.mount;return ye(s,v,{...P||{},_f:{...P&&P._f?P._f:{ref:{name:v}},name:v,mount:!0,...k}}),l.mount.add(v),P&&!O?ft({disabled:Ct(k.disabled)?k.disabled:t.disabled,name:v}):X(v,!0,k.value),{...M?{disabled:k.disabled||t.disabled}:{},...t.progressive?{required:!!k.required,min:Ir(k.min),max:Ir(k.max),minLength:Ir(k.minLength),maxLength:Ir(k.maxLength),pattern:Ir(k.pattern)}:{},name:v,onChange:ne,onBlur:ne,ref:G=>{if(G){l.registerName.add(v),pt(v,k),l.registerName.delete(v),P=Y(s,v);const T=ke(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,Z=f6(T),se=P._f.refs||[];if(Z?se.find(L=>L===T):T===P._f.ref)return;ye(s,v,{_f:{...P._f,...Z?{refs:[...se.filter(fa),T,...Array.isArray(Y(a,v))?[{}]:[]],ref:{type:T.type,name:v}}:{ref:T}}}),X(v,!1,void 0,T)}else P=Y(s,v,{}),P._f&&(P._f.mount=!1),(t.shouldUnregister||k.shouldUnregister)&&!(Fu(l.array,v)&&o.action)&&l.unMount.add(v)}}},st=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&Dr(s,Se,l.mount),Pt=v=>{Ct(v)&&(y.state.next({disabled:v}),Dr(s,(k,P)=>{const M=Y(s,P);M&&(k.disabled=M._f.disabled||v,Array.isArray(M._f.refs)&&M._f.refs.forEach(O=>{O.disabled=M._f.disabled||v}))},0,!1))},It=(v,k)=>async P=>{let M;P&&(P.preventDefault&&P.preventDefault(),P.persist&&P.persist());let O=De(i);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:G,values:T}=await V();N(),n.errors=G,O=De(T)}else await ee({fields:s,eventType:ln.SUBMIT});if(l.disabled.size)for(const G of l.disabled)We(O,G);if(We(n.errors,Du),Je(n.errors)){y.state.next({errors:{}});try{await v(O,P)}catch(G){M=G}}else k&&await k({...n.errors},P),st(),setTimeout(st);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Je(n.errors)&&!M,submitCount:n.submitCount+1,errors:n.errors}),M)throw M},Mt=(v,k={})=>{Y(s,v)&&(ke(k.defaultValue)?ve(v,De(Y(a,v))):(ve(v,k.defaultValue),ye(a,v,De(k.defaultValue))),k.keepTouched||We(n.touchedFields,v),k.keepDirty||(We(n.dirtyFields,v),n.isDirty=k.defaultValue?ue(v,De(Y(a,v))):ue()),k.keepError||(We(n.errors,v),p.isValid&&j()),y.state.next({...n}))},xt=(v,k={})=>{const P=v?De(v):a,M=De(P),O=Je(v),G=M;if(k.keepDefaultValues||(a=P),!k.keepValues){if(k.keepDirtyValues){const T=new Set([...l.mount,...Object.keys(In(a,i))]);for(const Z of Array.from(T)){const se=Y(n.dirtyFields,Z),L=Y(i,Z),he=Y(G,Z);se&&!ke(L)?ye(G,Z,L):!se&&!ke(he)&&ve(Z,he)}}else{if(na&&ke(v))for(const T of l.mount){const Z=Y(s,T);if(Z&&Z._f){const se=Array.isArray(Z._f.refs)?Z._f.refs[0]:Z._f.ref;if(Ts(se)){const L=se.closest("form");if(L){L.reset();break}}}}if(k.keepFieldsRef)for(const T of l.mount)ve(T,Y(G,T));else s={}}if(t.shouldUnregister){if(i=k.keepDefaultValues?De(a):{},k.keepFieldsRef)for(const T of l.mount)ye(i,T,Y(G,T))}else i=De(G);y.array.next({values:{...G}}),y.state.next({name:void 0,type:void 0,values:{...G}})}l={mount:k.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!p.isValid||!!k.keepIsValid||!!k.keepDirtyValues||!t.shouldUnregister&&!Je(G),o.watch=!!t.shouldUnregister,o.keepIsValid=!!k.keepIsValid,o.action=!1,k.keepErrors||(n.errors={}),y.state.next({submitCount:k.keepSubmitCount?n.submitCount:0,isDirty:O?!1:k.keepDirty?n.isDirty:k.keepValues?ue():!!(k.keepDefaultValues&&!jt(v,a)),isSubmitted:k.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:O?{}:k.keepDirtyValues?k.keepDefaultValues&&i?In(a,i):n.dirtyFields:k.keepDefaultValues&&v?In(a,v):k.keepDirty?n.dirtyFields:{},touchedFields:k.keepTouched?n.touchedFields:{},errors:k.keepErrors?n.errors:{},isSubmitSuccessful:k.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},xe=(v,k)=>xt(tt(v)?v(i):v,{...t.resetOptions,...k}),Ve=(v,k={})=>{const P=Y(s,v),M=P&&P._f;if(M){const O=M.refs?M.refs[0]:M.ref;O.focus&&setTimeout(()=>{O.focus(),k.shouldSelect&&tt(O.select)&&O.select()})}},ut=v=>{const{name:k,type:P,values:M,...O}=v;n={...n,...O}},oe={control:{register:pt,unregister:ze,getFieldState:Q,handleSubmit:It,setError:Ue,_subscribe:Be,_runSchema:V,_updateIsValidating:N,_focusError:st,_getWatch:we,_getDirty:ue,_setValid:j,_setFieldArray:S,_setDisabledField:ft,_setErrors:E,_getFieldArray:Re,_reset:xt,_resetDefaultValues:()=>tt(t.defaultValues)&&t.defaultValues().then(v=>{xe(v,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:W,_disableForm:Pt,_subjects:y,_proxyFormState:p,get _fields(){return s},get _formValues(){return i},get _state(){return o},set _state(v){o=v},get _defaultValues(){return a},get _names(){return l},set _names(v){l=v},get _formState(){return n},get _options(){return t},set _options(v){t={...t,...v},h=os(t.mode),m=os(t.reValidateMode)}},subscribe:ct,trigger:U,register:pt,handleSubmit:It,watch:$e,setValue:ve,setValues:Pe,getValues:me,reset:xe,resetField:Mt,resetDefaultValues:(v,k={})=>{if(a=De(v),!k.keepDirty){const P=In(a,i);n.dirtyFields=P,n.isDirty=!Je(P)}k.keepIsValid||j(),y.state.next({...n,defaultValues:a})},clearErrors:pe,unregister:ze,setError:Ue,setFocus:Ve,getFieldState:Q};return{...oe,formControl:oe}}function Ut(e={}){const t=x.useRef(void 0),n=x.useRef(void 0),s=x.useRef(e.formControl),[a,i]=x.useState(()=>({...De(Hu),isLoading:tt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:tt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&s.current!==e.formControl)if(s.current=e.formControl,e.formControl)t.current={...e.formControl,formState:a},e.defaultValues&&!tt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...c}=k6(e);t.current={...c,formState:a}}const o=t.current.control;return o._options=e,Ki(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),o._formState.isReady=!0,l},[o]),x.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),x.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),x.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),x.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),x.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==a.isDirty&&o._subjects.state.next({isDirty:l})}},[o,a.isDirty]),x.useEffect(()=>{var l;e.values&&!jt(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),!((l=o._options.resetOptions)===null||l===void 0)&&l.keepIsValid||o._setValid(),n.current=e.values,i(c=>({...c}))):o._resetDefaultValues()},[o,e.values]),x.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=x.useMemo(()=>Ou(a,o),[o,a]),t.current}const wl=(e,t,n)=>{if(e&&"reportValidity"in e){const s=Y(n,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},ii=(e,t)=>{for(const n in t.fields){const s=t.fields[n];s&&s.ref&&"reportValidity"in s.ref?wl(s.ref,n,e):s&&s.refs&&s.refs.forEach(a=>wl(a,n,e))}},Nl=(e,t)=>{t.shouldUseNativeValidation&&ii(e,t);const n={};for(const s in e){const a=Y(t.fields,s),i=Object.assign(e[s]||{},{ref:a&&a.ref});if(A6(t.names||Object.keys(e),s)){const o=Object.assign({},Y(n,s));ye(o,"root",i),ye(n,s,o)}else ye(n,s,i)}return n},A6=(e,t)=>{const n=Sl(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(s=>Sl(s).match(`^${n}\\.\\d+`))};function Sl(e){return e.replace(/[\[\]]/g,"")}function oi(){return oi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},oi.apply(null,arguments)}function kl(e,t){try{var n=e()}catch(s){return t(s)}return n&&n.then?n.then(void 0,t):n}function P6(e,t){for(var n={};e.length;){var s=e[0],a=s.code,i=s.message,o=s.path.join(".");if(!n[o])if("unionErrors"in s){var l=s.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(u){return u.errors.forEach(function(h){return e.push(h)})}),t){var c=n[o].types,d=c&&c[s.code];n[o]=Qi(o,t,n,a,d?[].concat(d,s.message):s.message)}e.shift()}return n}function I6(e,t){for(var n={},s=function(){var a=e[0],i=a.code,o=a.message,l=a.path.join(".");if(!n[l])if(a.code==="invalid_union"&&a.errors.length>0){var c=a.errors[0][0];n[l]={message:c.message,type:c.code}}else n[l]={message:o,type:i};if(a.code==="invalid_union"&&a.errors.forEach(function(h){return h.forEach(function(m){return e.push(oi({},m,{path:[].concat(a.path,m.path)}))})}),t){var d=n[l].types,u=d&&d[a.code];n[l]=Qi(l,t,n,i,u?[].concat(u,a.message):a.message)}e.shift()};e.length;)s();return n}function Bt(e,t,n){if(n===void 0&&(n={}),(function(s){return"_def"in s&&typeof s._def=="object"&&"typeName"in s._def})(e))return function(s,a,i){try{return Promise.resolve(kl(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](s,t)).then(function(o){return i.shouldUseNativeValidation&&ii({},i),{errors:{},values:n.raw?Object.assign({},s):o}})},function(o){if((function(l){return Array.isArray(l==null?void 0:l.issues)})(o))return{values:{},errors:Nl(P6(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}};if((function(s){return"_zod"in s&&typeof s._zod=="object"})(e))return function(s,a,i){try{return Promise.resolve(kl(function(){return Promise.resolve((n.mode==="sync"?fh:ph)(e,s,t)).then(function(o){return i.shouldUseNativeValidation&&ii({},i),{errors:{},values:n.raw?Object.assign({},s):o}})},function(o){if((function(l){return l instanceof zi})(o))return{values:{},errors:Nl(I6(o.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}function rt(e,t){var n;if(e instanceof vr){if(e.details){const s=(n=Object.values(e.details)[0])==null?void 0:n[0];if(s)return s}return e.message||t}return e instanceof Error&&e.message?e.message:t}function E6(e){return fe(`/portal/reference/states?country=${encodeURIComponent(e)}`)}function Yn(e){const{data:t}=de({queryKey:["reference","states",e],queryFn:()=>E6(e),enabled:!!e,staleTime:1/0});return t??[]}function pr(e,t,n){const s=e.find(o=>o.code===t);if(!s||s.zipRanges.length===0)return!0;const a=n.replace(/\D/g,"");if(a.length<5)return!0;const i=Number(a.slice(0,3));return s.zipRanges.some(o=>i>=o.from&&i<=o.to)}function Sn(e,t){const n=e==null?void 0:e.from;return n&&n.startsWith("/")&&!n.startsWith("//")?n:t}function T6(){const e=Ie(),t=Ae(),n=At(),{data:s=[]}=de({queryKey:["entities","mine"],queryFn:Pi}),[a,i]=x.useState(null),[o,l]=x.useState(!1),[c,d]=x.useState(null),u=xe=>()=>d(xe),h=()=>d(null),[m,f]=x.useState(""),[p,g]=x.useState(cl),[y,C]=x.useState(null),b=xe=>Ve=>{g(ut=>({...ut,[xe]:Ve.target.value}))},j=xe=>{g(Ve=>({...Ve,ssn:$a(xe,"Individual")}))},N=xe=>{g(Ve=>({...Ve,sameAsPrimaryAddress:xe}))},S=s.length===0?"/create-entity":"/dashboard",R=Sn(t.state,S),E=()=>{e(R)},{register:z,handleSubmit:X,watch:H,setValue:_,getValues:V,formState:{errors:q}}=Ut({resolver:Bt(ku),shouldUnregister:!1,defaultValues:{accountType:"Business",firstName:"",lastName:"",tradeName:"",ein:"",entityType:"LLP",email:"",countryCode:"+1",phoneNumber:"",address1:"",address2:"",city:"",state:"",zipCode:"",country:"United States"}}),B=H("accountType"),ee=H("entityType"),W=B==="Individual"?wu:ju,ue=B==="Individual",we=ue?"SSN":"EIN",Re=ue?"***-**-****":"**-*******",Ce=ue?11:10,Oe=H("country"),Ne=H("state"),ve=H("zipCode"),Pe=H("address1"),ne=H("address2"),Se=H("city"),U=Oe==="United States",me=Yn(Oe),Q=Ne.length>0&&ve.trim().length>0&&!pr(me,Ne,ve),pe=z("ein"),Ue=z("phoneNumber"),$e=z("zipCode"),Be=z("countryCode"),ct=ue&&m===D2,ze=p.sameAsPrimaryAddress,ft=ze?Oe:p.country,pt=Yn(ft),st={address1:ze?Pe:p.address1,address2:ze?ne:p.address2,city:ze?Se:p.city,state:ze?Ne:p.state,zipCode:ze?ve:p.zipCode,country:ft},Pt=ct&&[p.firstName,p.lastName,p.ssn].some(xe=>xe.trim().length>0);x.useEffect(()=>{Ne&&me.length>0&&!me.some(xe=>xe.code===Ne)&&_("state","")},[Oe,me]);const It=xe=>{const Ve=V("accountType");if(Ve===xe)return;d("accountType"),xe==="Business"&&(f(""),g(cl));const ut=V("lastName");Au(Ve,xe,_,ut),_("accountType",xe),_("ein",$a(V("ein"),xe)),queueMicrotask(()=>{_("lastName",ut),_("firstName",""),Ve==="Business"&&xe==="Individual"&&_("tradeName","")})};x.useEffect(()=>{W.includes(ee)||_("entityType",B==="Individual"?"Sole Proprietorship":"LLP")},[B,ee,W,_]);const Mt=X(async xe=>{if(i(null),!pr(me,xe.state,xe.zipCode)){i(`ZIP code does not match the selected state (${xe.state}).`);return}l(!0);try{await L1(Pu(xe,{filingStatus:ue&&m||void 0,secondary:Pt?{...p,...st}:null})),await n.invalidateQueries({queryKey:["entities","mine"]}),C({values:xe,secondary:Pt?{...p,...st}:null})}catch(Ve){i(rt(Ve,"Unable to save entity. Please try again."))}finally{l(!1)}}),xt=()=>{C(null),e("/dashboard",{replace:!0})};return{register:z,errors:q,onSubmit:Mt,error:a,isSubmitting:o,einRegister:pe,phoneRegister:Ue,zipRegister:$e,countryCodeRegister:Be,accountType:B,isIndividual:ue,isUS:U,idLabel:we,idPlaceholder:Re,idMaxLength:Ce,entityTypeOptions:W,stateOptions:me,state:Ne,zipStateMismatch:Q,activeHelp:c?r6[c]:null,focusHelp:u,resetHelp:h,filingStatus:m,setFilingStatus:f,showSecondaryTaxpayer:ct,secondaryTaxpayer:p,secondaryAddress:st,secondaryStateOptions:pt,updateSecondaryField:b,setSecondarySsn:j,setSecondarySameAsPrimary:N,createdEntity:y,handleAccountTypeChange:It,handleCancel:E,goToDashboard:xt}}function L6(){const e=T6();return r.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start bg-white p-3 rounded-sm",children:[r.jsxs("form",{onSubmit:e.onSubmit,noValidate:!0,className:"min-w-0 flex-1 space-y-6",children:[e.error?r.jsx(Zt,{message:e.error}):null,r.jsxs("section",{className:"space-y-6 rounded-xl border border-slate-200 bg-white p-6",children:[r.jsx(V2,{accountType:e.accountType,onAccountTypeChange:e.handleAccountTypeChange,isIndividual:e.isIndividual,filingStatus:e.filingStatus,onFilingStatusChange:e.setFilingStatus,focusHelp:e.focusHelp,resetHelp:e.resetHelp}),r.jsxs("div",{className:"",children:[e.isIndividual?r.jsx(i6,{register:e.register,errors:e.errors,einRegister:e.einRegister,phoneRegister:e.phoneRegister,countryCodeRegister:e.countryCodeRegister,accountType:e.accountType,idLabel:e.idLabel,idPlaceholder:e.idPlaceholder,idMaxLength:e.idMaxLength,resetHelp:e.resetHelp}):r.jsx(Z2,{register:e.register,errors:e.errors,einRegister:e.einRegister,phoneRegister:e.phoneRegister,countryCodeRegister:e.countryCodeRegister,entityTypeOptions:e.entityTypeOptions,accountType:e.accountType,idLabel:e.idLabel,idPlaceholder:e.idPlaceholder,idMaxLength:e.idMaxLength,focusHelp:e.focusHelp}),r.jsx(q2,{register:e.register,errors:e.errors,zipRegister:e.zipRegister,isUS:e.isUS,state:e.state,stateOptions:e.stateOptions,zipStateMismatch:e.zipStateMismatch,focusHelp:e.focusHelp})]})]}),e.showSecondaryTaxpayer?r.jsx(o6,{values:e.secondaryTaxpayer,address:e.secondaryAddress,stateOptions:e.secondaryStateOptions,onFieldChange:e.updateSecondaryField,onSsnChange:e.setSecondarySsn,onSameAsPrimaryChange:e.setSecondarySameAsPrimary}):null,r.jsx(Gc,{onCancel:e.handleCancel,isSubmitting:e.isSubmitting,submitLabel:"Save",submittingLabel:"Creating…"})]}),r.jsx(a6,{active:e.activeHelp}),r.jsx(_2,{created:e.createdEntity,onClose:e.goToDashboard,onGoToDashboard:e.goToDashboard,onStartPayment:e.goToDashboard})]})}function Xi(){const e=Ie(),t=Ae(),n=Sn(t.state,"/create-entity");return r.jsx("div",{className:"min-h-full bg-slate-50 px-4 py-6 sm:px-8 sm:py-8",children:r.jsxs("div",{className:"w-full",children:[r.jsxs("button",{type:"button",onClick:()=>e(n),className:"inline-flex items-center gap-1.5 rounded-lg py-1 text-sm font-medium text-slate-600 transition hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gov-500",children:[r.jsx(F6,{}),"Back"]}),r.jsxs("div",{className:"mb-6 mt-4",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Add Entity"}),r.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Everything here is matched against IRS records, so enter it exactly as the IRS has it."})]}),r.jsx(L6,{})]})})}function F6(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})}const Ft=10;function R6(e,t){const n=new URLSearchParams({entityId:String(e)});return t!==void 0&&n.set("taxYear",String(t)),fe(`/portal/dashboard?${n}`)}function D6(e,t,n){const s=new URLSearchParams({entityId:String(e),category:t,taxYear:String(n)});return fe(`/portal/dashboard/summary?${s}`)}function M6(e,t,n){const s=new URLSearchParams({entityId:String(e),month:String(t)});return n!==void 0&&s.set("year",String(n)),fe(`/portal/dashboard/monthly-overview?${s}`)}function O6({entityId:e,search:t,taxYear:n,status:s,page:a=1,pageSize:i=Ft}){const o=new URLSearchParams({entityId:String(e),page:String(a),pageSize:String(i)});return t&&o.set("search",t),n&&o.set("taxYear",n),s&&s!=="all"&&o.set("status",s),fe(`/portal/dashboard/payments?${o}`)}function z6({open:e,onClose:t,enabledPayments:n,onSelectFederal:s,onSelectState:a}){return x.useEffect(()=>{if(!e)return;const i=o=>{o.key==="Escape"&&t()};return document.addEventListener("keydown",i),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}},[e,t]),e?jn.createPortal(r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[r.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:t}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"add-first-payment-title",className:"relative z-10 max-h-[90vh] w-full max-w-4xl overflow-y-auto rounded-2xl bg-white p-6 shadow-xl sm:p-8",children:[r.jsx("button",{type:"button","aria-label":"Close dialog",onClick:t,className:"absolute right-4 top-4 rounded-lg p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600",children:r.jsx(U6,{})}),r.jsx("h2",{id:"add-first-payment-title",className:"text-lg font-semibold text-slate-900",children:"Add Your First Payment"}),r.jsxs("div",{className:"mt-6 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:[n.includes("federal")?r.jsx(ga,{icon:r.jsx(V6,{}),title:"Federal Payment",description:"Make payments for federal tax obligations, including income tax and estimated tax.",actionLabel:"Federal Tax Payment",variant:"primary",onSelect:s}):null,n.includes("state")?r.jsx(ga,{icon:r.jsx(q6,{}),title:"State Payment",description:"Pay state tax obligations, including withholding, income, and estimated taxes.",actionLabel:"State Tax Payment",variant:"outline",onSelect:a}):null,r.jsx(ga,{icon:r.jsx(Z6,{}),title:"Local Payment",description:"Pay municipal and county taxes based on your local jurisdiction.",actionLabel:"Local Tax Payment",variant:"disabled",comingSoon:!0})]})]})]}),document.body):null}function ga({icon:e,title:t,description:n,actionLabel:s,variant:a,comingSoon:i=!1,onSelect:o}){const l=a==="primary"?"bg-gov-600 text-white shadow-sm hover:bg-gov-700":a==="outline"?"border border-gov-500 bg-white text-gov-700 hover:bg-gov-50":"cursor-not-allowed border border-gov-200 bg-white text-slate-300";return r.jsxs("div",{className:"relative flex flex-col rounded-xl border border-slate-200 p-5 text-center",children:[i?r.jsx("span",{className:"absolute -top-2.5 right-4 inline-flex items-center rounded-full bg-gov-100 px-2.5 py-0.5 text-[11px] font-semibold text-gov-600",children:"Coming Soon"}):null,r.jsx("span",{className:"mx-auto flex h-[104px] w-[104px] items-center justify-center rounded-2xl bg-gov-50 text-gov-600",children:e}),r.jsx("h3",{className:"mt-5 text-sm font-bold text-slate-900",children:t}),r.jsx("p",{className:"mt-2 flex-1 text-xs leading-relaxed text-slate-500",children:n}),r.jsx("button",{type:"button",onClick:o,disabled:a==="disabled",className:`mt-5 inline-flex h-11 w-full items-center justify-center rounded-lg px-4 text-sm font-semibold transition ${l}`,children:s})]})}function V6(){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",children:[r.jsx("path",{d:"M62.0432 6.53906C62.2466 6.58126 62.4611 6.61019 62.622 6.75213C62.9915 7.07829 62.8142 11.1504 62.8097 11.9086C64.8335 12.4737 65.2559 13.3107 65.5546 15.2975C65.9278 15.3554 66.3978 15.2472 66.6622 15.5573C67.1866 16.1729 66.3725 16.5641 66.3546 16.6859C66.1661 17.987 66.2421 20.6145 66.2436 21.8325C69.1665 22.4843 71.8413 23.9686 73.9486 26.1082C77.6864 29.8757 78.8394 34.2964 78.8156 39.4295C81.597 40.1678 81.3832 41.2697 81.3407 43.759C82.461 44.2702 83.0852 44.9927 81.9076 45.948L81.8927 54.2555C82.9094 54.3688 86.204 54.6451 87.0316 55.3779C87.3936 55.6986 87.2387 56.9965 87.2632 57.5347C87.2982 58.2777 87.1686 58.5558 86.6539 59.0725L86.6517 64.9197L101.774 64.9275C104.115 64.9269 106.453 64.9142 108.797 64.9374C109.925 64.9484 110.126 65.0763 110.148 66.2891C110.159 66.8192 110.157 67.4111 110.142 67.9405C110.102 69.3077 110.305 69.6929 108.803 69.7327C108.685 75.0298 108.796 80.7968 108.786 86.1277C109.628 86.5466 110.234 86.8704 111.002 87.4235C113.519 89.2401 115.214 91.9891 115.715 95.0641C116.278 98.5708 115.592 102.056 113.492 104.941C111.577 107.523 108.729 109.24 105.564 109.721C102.062 110.261 98.9518 109.338 96.1362 107.243L67.9151 107.258L33.0921 107.259C28.416 107.317 23.7395 107.333 19.0631 107.307C18.0288 107.308 12.6089 107.405 12.134 107.166C11.5865 106.556 11.7691 105.32 11.7565 104.537C11.7235 102.48 12.4007 102.739 13.9282 102.76C13.8415 101.892 13.9105 100.959 13.901 100.088C13.8849 98.6083 14.1926 98.4764 15.5226 98.5686C15.3898 89.0505 15.498 79.2604 15.5031 69.7319C14.9199 69.7222 14.2733 69.7559 14.2175 68.9622C14.1741 68.3469 14.189 67.7038 14.1921 67.0865C14.1952 66.4781 14.1094 65.6334 14.5032 65.1354C14.6292 64.9764 15.3336 64.9422 15.5469 64.9406C18.3443 64.9184 21.1429 64.9275 23.9404 64.9291L37.6786 64.9371L37.6979 59.0793C37.3965 58.842 37.0909 58.5219 37.0614 58.1598C37.0201 57.6549 36.9293 55.7092 37.2514 55.4017C38.0358 54.6529 41.3929 54.3956 42.4073 54.2731L42.3921 45.9165C41.1657 45.2012 41.9615 44.2519 42.9468 43.8167C42.9238 41.3094 42.7104 40.2809 45.4592 39.4412C45.4697 35.6803 45.9025 33.056 47.8274 29.716C50.0718 25.8492 53.7602 23.0461 58.0708 21.9315C58.0686 21.1723 58.1162 17.2145 58.0205 16.7113C57.8462 16.5749 57.5924 16.4164 57.529 16.1864C57.2377 15.1286 58.692 15.3846 58.7547 15.2625C59.0438 14.6989 58.892 13.9227 59.373 13.259C59.9448 12.4698 60.5267 12.1681 61.4779 11.9447C61.4816 10.4876 61.3535 8.4722 61.5591 7.02733C61.5948 6.77477 61.8317 6.65283 62.0432 6.53906ZM16.7834 98.5746C18.2815 98.4209 21.4252 98.5214 23.0207 98.5229L35.0265 98.5289C35.2595 98.1474 35.4334 97.7299 35.8696 97.6632C36.3869 97.5845 37.0094 97.6145 37.5361 97.6205C37.801 96.3337 37.0673 95.3924 38.7427 94.8221L38.7325 75.5012C37.5453 74.9751 37.6879 74.2976 37.6989 73.1367C37.3951 72.9748 37.127 72.8286 37.0363 72.4637C36.8502 71.7157 36.9645 70.6762 36.9549 69.8803C35.0672 69.6105 32.5473 69.7109 30.593 69.7124L20.9921 69.7192C19.6586 69.7184 18.0932 69.7716 16.7796 69.7259C16.7659 79.2859 16.6867 89.0273 16.7834 98.5746ZM87.328 69.8668C87.3251 71.0427 87.6878 72.4479 86.6353 73.1187C86.6189 74.3343 86.7336 74.8941 85.5731 75.4952C85.4264 81.8371 85.585 88.472 85.5463 94.8475C86.1243 94.9839 86.2241 95.0686 86.6174 95.5221C86.7649 96.2183 86.7321 96.9115 86.7329 97.6258C88.5027 97.6018 89.3474 97.4969 89.1962 99.6081C89.1582 100.137 89.1701 100.91 89.1798 101.442C90.1154 101.422 91.1664 101.398 92.1005 101.431C91.3474 99.0392 91.1999 96.7556 91.8398 94.3049C91.5828 94.2562 91.2297 94.2225 91.0904 93.9624C90.8617 93.533 90.9049 87.8184 91.1187 87.341C91.1373 87.2991 91.1582 87.2578 91.1776 87.2159C91.9686 86.4357 93.4174 86.6635 94.4699 86.7595C95.2409 87.2908 95.3019 87.5569 95.22 88.4899C98.2181 85.376 103.431 84.2818 107.483 85.6608C107.385 81.0621 107.531 76.4208 107.475 71.8184C107.467 71.1311 107.461 70.4012 107.481 69.7147L94.2457 69.7192L90.5616 69.7102C90.1504 69.7087 88.9109 69.6877 88.5586 69.7387C88.1616 69.7814 87.7228 69.8376 87.328 69.8668ZM104.779 108.418C110.812 107.807 115.205 102.384 114.583 96.3157C113.961 90.2474 108.56 85.8406 102.531 86.4814C96.522 87.1207 92.1608 92.531 92.7805 98.5783C93.4003 104.625 98.7679 109.026 104.779 108.418ZM43.6248 54.1264C50.5823 53.2332 58.6456 53.1748 65.6618 53.2251C70.6741 53.3448 75.6908 53.4686 80.6726 54.1055L80.6607 48.393C80.6599 47.516 80.6294 46.5066 80.7113 45.6316C80.7322 45.4036 80.8864 45.2348 81.0398 45.0778C75.086 42.8305 65.3058 42.3267 58.9736 42.6119C54.3156 42.8247 49.609 43.2238 45.0988 44.4781C44.6703 44.5972 43.6004 44.8336 43.3477 45.1639C43.4128 45.2466 43.6008 45.483 43.603 45.5788C43.6691 48.4164 43.569 51.2896 43.6248 54.1264ZM36.6599 68.6062C39.1965 68.3949 43.2791 68.523 45.9332 68.5208L62.4589 68.5335L79.2499 68.5245L84.0908 68.5193C85.1724 68.5178 86.5102 68.4691 87.5619 68.628C85.7303 67.5921 62.5051 56.6228 62.1021 56.5825L43.6613 65.2987C41.3396 66.3908 38.9866 67.5523 36.6599 68.6062ZM32.9001 105.917L70.9572 105.904L84.5333 105.897C86.6554 105.897 89.331 105.83 91.4092 105.915L91.4234 102.682L32.9265 102.685C32.9295 103.614 32.9735 105.027 32.9001 105.917ZM87.924 101.43C87.9284 100.695 87.9023 99.5781 87.9493 98.8736L54.7343 98.8818C48.674 98.8826 42.4058 98.9643 36.3645 98.8803C36.3647 99.7242 36.3517 100.619 36.3725 101.458C38.0079 101.334 40.8965 101.425 42.6011 101.425L54.7259 101.426L76.6294 101.425C80.3575 101.426 84.2085 101.372 87.924 101.43ZM38.3037 56.1781L38.2823 57.9352L51.9697 57.881C52.7891 57.8715 55.7672 57.968 56.3477 57.796C58.0633 57.2873 60.3881 55.7614 62.1416 55.2056C63.0145 55.4373 64.3978 56.1823 65.2924 56.5636C65.8898 56.8573 67.6939 57.7969 68.216 57.8509C69.5449 57.9885 71.2491 57.8701 72.6227 57.8762L80.8707 57.9029C82.5176 57.9005 84.4215 57.8466 86.0446 57.9221L86.0558 56.1713C79.7013 55.0049 73.0994 54.6403 66.6414 54.5212C63.8771 54.4701 60.5915 54.4148 57.8282 54.5287C51.1466 54.713 44.8868 54.9854 38.3037 56.1781ZM69.5106 75.4772C68.3173 74.9736 68.4596 74.2346 68.5021 73.1022L66.0961 73.0977C66.1177 74.4677 66.2272 74.8072 65.028 75.5641C65.0026 81.9045 65.1456 88.5327 65.0131 94.8498C66.5207 95.2897 66.254 96.3277 66.2384 97.6512C66.7739 97.607 67.8011 97.5913 68.3374 97.6512C68.3069 96.3472 68.044 95.3137 69.5166 94.8273L69.5106 75.4772ZM75.3281 75.5094V94.8423C75.8488 94.9914 76.0201 95.1241 76.397 95.5191C76.546 96.324 76.5043 96.8396 76.5095 97.6505C77.1694 97.6377 77.915 97.607 78.5683 97.6333L78.5743 97.5711C78.6852 96.243 78.2137 95.274 79.7973 94.8303L79.8026 75.4944C78.5795 75.0508 78.7247 74.2361 78.7493 73.1029C77.9709 73.0955 77.2335 73.0894 76.4543 73.1149C76.064 73.8172 76.9393 74.7173 75.3281 75.5094ZM44.5554 75.5079L44.5569 94.8663C45.9879 95.1586 45.6907 96.5106 45.697 97.6407C46.3801 97.64 47.0633 97.631 47.7462 97.6138L47.7973 97.5591C47.7657 96.3172 47.5252 95.2403 48.9863 94.8468L48.9745 82.3609C48.9744 80.2212 48.9096 77.6259 48.9977 75.5154C47.7868 74.9796 47.9065 74.3171 47.9225 73.1194C47.1418 73.0992 46.3608 73.0917 45.5798 73.0984C45.5861 74.2548 45.7113 74.9511 44.5554 75.5079ZM65.0421 16.6271C63.5263 16.5805 61.7684 16.5984 60.235 16.6092L59.3209 16.6404C59.3053 18.3011 59.3028 19.9619 59.3135 21.6226L60.242 21.5044C60.233 20.7063 60.1013 18.1639 60.3896 17.5984C60.5922 17.4419 60.479 17.4792 60.7486 17.5013C60.9907 17.6615 60.993 17.6128 61.0734 17.9151C61.2306 18.5069 61.0079 21.0447 61.1449 21.4415C61.4071 21.448 61.5181 21.471 61.7624 21.3685C61.8436 20.4347 61.5315 17.9735 62.0589 17.4959C62.3121 17.4637 62.1892 17.4477 62.4365 17.5753C62.701 17.9478 62.6332 18.388 62.6257 18.8562C62.625 19.5139 62.362 21.3632 63.0265 21.5133C63.8093 21.2058 62.5654 17.7399 63.7572 17.4973C64.3926 17.9089 64.0946 20.639 64.1535 21.5045C64.435 21.5286 64.7322 21.5487 65.0116 21.5845C65.0555 19.9669 64.9676 18.1876 65.0421 16.6271ZM79.8003 97.6438C81.6417 97.577 83.5322 97.652 85.3914 97.6145L85.5038 97.5448C85.5426 96.9902 85.5307 96.6545 85.5024 96.0954C83.7206 96.0774 81.6052 96.0347 79.8376 96.0946C79.7728 96.6215 79.7929 97.1146 79.8003 97.6438ZM54.7685 75.5199L54.7751 87.6266C54.7744 89.9776 54.8167 92.4755 54.7635 94.8161C55.3936 95.0521 55.5115 95.0956 55.9022 95.6652L55.9427 95.7229C55.9558 96.3202 55.9917 97.0577 55.9665 97.6438C56.6681 97.6288 57.37 97.6243 58.0717 97.631C58.0497 96.4281 57.7828 95.202 59.2348 94.8558L59.2365 81.6962C59.2355 80.2347 59.3378 76.8869 59.1968 75.5611L59.1097 75.5004C58.1062 74.7862 58.1852 74.2129 58.2038 73.0954C57.4112 73.0924 56.604 73.0805 55.813 73.1074C55.8606 74.3043 55.9631 74.9421 54.7685 75.5199ZM94.7306 105.963L94.6673 105.87C94.2904 105.32 93.8777 104.919 93.4547 104.243C93.2141 103.858 92.8081 103.097 92.6062 102.807C92.6256 103.825 92.6018 104.984 92.6457 105.977C93.2722 105.921 94.1087 105.889 94.7306 105.963ZM38.2222 71.8708L86.058 71.8379C86.061 71.293 86.0402 70.3712 86.0997 69.8586C81.4093 69.7431 76.3218 69.8481 71.6015 69.8451L38.2265 69.8406L38.2222 71.8708ZM54.1161 97.6198C54.4915 97.6303 54.4841 97.6977 54.6987 97.5171C54.859 97.1124 54.7461 96.5713 54.7234 96.1074C52.8804 96.0587 50.9371 96.0901 49.0845 96.0946C48.9791 96.5376 49.0154 97.1761 49.025 97.6475C50.6851 97.5853 52.4462 97.6318 54.1161 97.6198ZM35.1528 99.8344L21.6774 99.8336C19.5465 99.8336 17.2692 99.8734 15.1517 99.8284L15.1581 102.769C20.5054 102.7 26.3782 102.676 31.7193 102.763C31.7349 101.192 32.5821 101.419 33.8184 101.424L35.1364 101.423C35.1268 100.916 35.1145 100.34 35.1528 99.8344ZM69.6693 73.0969C69.676 73.4619 69.673 73.9138 69.6961 74.2713C70.4663 74.2818 74.5624 74.3478 75.156 74.2234C75.1702 73.8501 75.1821 73.4769 75.191 73.1037L69.6693 73.0969ZM75.2648 96.0939C73.4078 96.0901 71.4525 96.0594 69.603 96.1036C69.5866 96.6327 69.5702 97.1304 69.5799 97.6595C71.2767 97.5778 73.3594 97.6235 75.0845 97.6228L75.2462 97.58C75.34 97.2398 75.2819 96.4821 75.2648 96.0939ZM59.2731 97.6468C61.1174 97.616 62.9617 97.6063 64.806 97.616L64.9386 97.607C65.0347 97.2968 64.9877 96.4551 64.9825 96.0931C63.0913 96.0849 61.2008 96.0856 59.3099 96.0969C59.2831 96.6125 59.2709 97.1296 59.2731 97.6468ZM38.7843 97.6348L44.1399 97.6258L44.4019 97.6138C44.6172 97.299 44.4965 96.5068 44.484 96.0961C42.7436 96.0849 40.5467 96.0249 38.8339 96.1006C38.7788 96.6747 38.7773 97.0539 38.7843 97.6348ZM60.1003 15.3022L62.7099 15.2906C63.209 15.2976 63.7497 15.2949 64.2443 15.3225C64.114 13.7292 63.3609 13.0171 61.7237 13.1393C60.4998 13.623 60.2637 13.9897 60.1003 15.3022ZM79.9255 73.0939C79.9299 73.4672 79.9255 73.9011 79.9419 74.2698C80.6748 74.2893 84.8968 74.344 85.3973 74.2339C85.4212 73.8569 85.4383 73.4792 85.4487 73.1007C83.6834 73.0977 81.6692 73.1442 79.9255 73.0939ZM38.8797 73.0992L38.9125 74.2781C39.7431 74.2893 43.7674 74.3455 44.3912 74.2331L44.4054 73.1149C42.5644 73.0707 40.7218 73.1112 38.8797 73.0992ZM94.0193 89.788L94.0148 87.9968C93.3601 87.9091 92.8424 87.9278 92.1861 87.9368C92.1913 89.6898 92.1422 91.547 92.1645 93.2774C92.3373 92.8255 92.5437 92.2387 92.7426 91.8115C93.1269 91.101 93.5209 90.425 94.0193 89.788ZM59.384 73.0925C59.3917 73.4664 59.3891 73.8959 59.4182 74.2646C60.1078 74.2983 64.3442 74.3403 64.8857 74.2369L64.9378 73.1074C63.0816 73.0565 61.2283 73.1239 59.384 73.0925ZM13.0432 104.041C13.041 104.704 13.0489 105.391 13.0353 106.05C19.1618 105.89 25.5959 106.188 31.6982 105.993C31.6953 105.465 31.681 104.563 31.7505 104.046L13.0432 104.041ZM61.6075 37.6299C61.6075 36.3081 61.6581 22.8896 61.5471 22.7515L61.4913 22.7553C60.7345 22.7933 60.3373 22.7003 59.8064 23.3011C56.4124 27.1418 55.2031 32.6316 54.9825 37.6455C54.9898 37.7162 54.9971 37.787 55.0043 37.8577L55.1005 37.8815C57.3006 37.7598 59.3904 37.6126 61.6075 37.6299ZM54.6532 73.1082C52.8037 73.0924 50.9542 73.0902 49.1047 73.1014C49.1105 73.4709 49.1077 73.9019 49.126 74.2653C50.1049 74.3103 53.7297 74.3515 54.6227 74.2414L54.6532 73.1082ZM46.8264 39.0743C48.8918 38.6171 51.7836 38.1072 53.893 37.995C53.9769 33.2546 55.0536 28.406 57.6383 24.3756C57.777 24.1592 58.3839 23.4496 58.3716 23.2834L58.3367 23.2574C54.2039 24.4634 50.8821 27.0387 48.7888 30.8481C47.4365 33.3392 46.74 36.137 46.7653 38.9753L46.8264 39.0743ZM58.892 38.9385C56.4888 39.0517 45.9402 39.6585 44.4265 41.3883C44.0371 41.8333 44.1796 42.8869 44.1895 43.4545C50.9324 41.4509 58.1291 41.1957 65.1121 41.3096C69.606 41.4781 75.8219 41.9997 80.0923 43.4195C80.108 42.835 80.2316 41.6938 79.8309 41.319C79.1731 40.7037 77.6812 40.3734 76.8052 40.1928C71.2871 39.0553 64.9952 38.7427 59.3851 38.921L58.892 38.9385ZM39.9609 75.4974C40.0234 76.3383 39.9756 77.5509 39.974 78.4285L39.9685 83.8598L39.9769 91.7373C39.9752 92.6981 40.0181 93.9242 39.9825 94.8565C40.8955 94.8663 41.9316 94.9015 42.8318 94.8468L43.2057 94.8453C43.3544 94.601 43.2963 90.7263 43.2963 90.1455L43.3036 75.5064C42.2219 75.5072 41.0342 75.5319 39.9609 75.4974ZM63.9978 22.8214L62.6674 22.7111C62.7658 24.5464 62.7017 26.8503 62.7002 28.7315C62.7114 31.6956 62.7017 34.6597 62.6719 37.6236C64.549 37.6374 66.9937 37.649 68.8521 37.862L69.2246 37.86C69.4972 37.5742 69.2872 36.1484 69.2372 35.6631C68.7724 31.1188 67.4198 26.0229 63.9978 22.8214ZM15.4745 66.2263C15.4722 66.9795 15.4651 67.7329 15.4532 68.4863C16.9429 68.3754 19.4435 68.4533 20.9953 68.4541L31.319 68.4533C31.8763 68.4533 35.166 68.4983 35.5051 68.3739C35.6768 67.8279 35.6377 67.745 36.1311 67.4844C36.2964 67.3953 36.4651 67.3127 36.6368 67.2368C37.0012 67.0616 37.7816 66.7603 37.9249 66.4046C37.7425 66.2063 37.2057 66.2154 36.9303 66.2137C34.3069 66.1968 31.6778 66.2114 29.0548 66.2122L15.4745 66.2263ZM86.8379 66.2152C86.5005 66.2318 86.1452 66.2556 85.8092 66.2613C86.6346 66.78 87.5225 67.0693 88.35 67.5662C88.5876 67.7087 88.5511 68.1648 88.905 68.4076C89.626 68.4938 90.6964 68.4563 91.4591 68.4548L95.6185 68.4481C99.8159 68.4451 104.158 68.5051 108.343 68.4369C108.609 68.4309 108.702 68.4788 108.879 68.3522C108.927 67.6371 108.912 66.9169 108.909 66.1997L94.1578 66.2128C91.8658 66.212 89.1038 66.141 86.8379 66.2152ZM70.7717 59.1653C71.4406 59.5909 72.5385 59.9966 73.2968 60.3473C74.6071 60.9539 75.9165 61.6249 77.238 62.1994C79.956 63.3809 82.6383 64.901 85.3489 66.0644L85.4465 66.0409L85.4361 65.9054L85.4331 59.1817C81.1143 59.0916 76.7538 59.2255 72.4305 59.1693C71.9143 59.1626 71.2782 59.1336 70.7717 59.1653ZM81.013 94.8326C82.1653 94.8828 83.1836 94.8618 84.3336 94.855C84.2212 88.5162 84.3269 81.8625 84.3299 75.4967C83.2201 75.5072 82.1102 75.5087 80.9996 75.4997C81.0875 81.915 80.9221 88.4112 81.013 94.8326ZM38.8911 59.1642C38.9069 61.1404 38.9848 64.2007 38.8752 66.1331C42.1732 64.643 45.5342 62.8866 48.8317 61.4457C50.4686 60.6642 52.111 59.8943 53.7586 59.136C52.0693 59.2322 49.8665 59.1694 48.1373 59.166L38.8911 59.1642ZM70.7732 94.8805C71.7713 94.8206 72.7404 94.9053 73.7437 94.8445L74.032 94.84C74.213 94.4886 73.9583 77.6139 74.1125 75.5177L70.7225 75.5132C70.8253 76.5519 70.7359 77.7668 70.7486 78.8295C70.8112 84.1626 70.648 89.5534 70.7732 94.8805ZM60.4842 75.5042C60.5058 81.8633 60.3673 88.5274 60.5043 94.8655C61.6052 94.8528 62.7062 94.849 63.8078 94.8535L63.7944 81.7306L63.7937 77.7615C63.7937 77.102 63.7669 76.1367 63.8317 75.5162C62.7159 75.5244 61.6 75.5207 60.4842 75.5042ZM70.4834 37.9848C72.5937 38.1166 75.5121 38.5663 77.5486 39.088C77.5262 31.4815 73.445 24.9184 65.8257 23.1409C69.0354 27.0752 70.3821 32.9788 70.4834 37.9848ZM50.2212 75.5027C50.2198 81.9232 50.1563 88.4555 50.2282 94.867C51.3146 94.8355 52.4407 94.8603 53.5335 94.8535C53.6273 93.0151 53.5442 90.4445 53.543 88.5529L53.5589 75.5192C52.4463 75.5222 51.3337 75.5169 50.2212 75.5027Z",fill:"#013A9A"}),r.jsx("path",{d:"M20.8306 87.3741C21.7975 87.3931 22.9716 87.2834 23.7808 87.6627C24.0167 87.9389 24.1978 88.3692 24.2019 88.7133C24.2189 90.3084 24.2811 91.9224 24.1834 93.5143C24.1531 94.0079 23.337 93.9863 22.8942 93.989C22.0866 93.989 20.4435 94.1417 19.7401 93.9171C19.5898 93.8695 19.5357 93.7957 19.4778 93.684C19.1935 93.1343 19.1211 88.377 19.4804 87.9422C19.7993 87.5563 20.271 87.4525 20.8306 87.3741ZM20.7075 92.9149C21.4023 92.9077 22.0971 92.9038 22.792 92.9038C22.7912 91.4452 22.7685 89.9467 22.7949 88.4913C22.0999 88.4789 21.4046 88.4763 20.7095 88.4828L20.7075 92.9149Z",fill:"#013A9A"}),r.jsx("path",{d:"M20.3361 74.9483C21.2571 74.8873 22.6797 74.7512 23.5021 75.1234C23.805 75.261 23.9175 75.4361 24.0125 75.7134C24.2485 76.4042 24.377 81.6982 23.9934 82.1212C23.7865 82.35 23.406 82.3338 23.1049 82.339C22.4202 82.3456 19.8439 82.5082 19.4548 82.0594C19.1169 81.1575 19.2481 76.9531 19.3475 75.7392C19.3736 75.4228 19.9875 75.0962 20.3361 74.9483ZM20.6722 76.1541C20.671 76.9715 20.6027 80.4395 20.7189 81.0596C21.1142 81.1472 21.2323 81.1295 21.6502 81.1229L22.7457 81.12L22.7582 76.1556L22.1168 76.1497L20.6722 76.1541Z",fill:"#013A9A"}),r.jsx("path",{d:"M28.4596 74.9508C29.2074 74.8807 30.3356 74.7746 31.0301 75.0679C31.2627 75.166 31.4269 75.2692 31.5163 75.5213C31.6171 75.805 31.6607 76.1095 31.6822 76.4094C31.7337 77.1281 31.8113 81.6951 31.5777 82.0762C31.4349 82.3084 31.2117 82.3334 30.9725 82.3585C30.0372 82.3474 29.1034 82.4211 28.1771 82.3142C27.5629 82.3002 27.5735 81.3243 27.5815 80.8062C27.6073 79.1499 27.5021 77.4023 27.6581 75.7527C27.6923 75.3915 28.1896 75.1041 28.4596 74.9508ZM28.7652 81.143L30.5236 81.1371C30.4975 79.4802 30.4921 77.8224 30.5073 76.1655C29.8668 76.1271 29.4257 76.119 28.785 76.1426C28.7912 77.7509 28.8134 79.5406 28.7652 81.143Z",fill:"#013A9A"}),r.jsx("path",{d:"M28.4275 87.4501C29.1907 87.3828 30.2533 87.2867 30.9787 87.5266C31.2033 87.6005 31.4083 87.7019 31.5012 87.9124C31.6095 88.1576 31.6603 88.442 31.6822 88.7054C31.735 89.3383 31.8103 93.4127 31.5762 93.7566C31.4369 93.9619 31.2128 93.9848 30.9776 94.0109C30.0962 94.0005 29.1777 94.0874 28.303 94.0011C28.1437 93.9854 27.9503 93.9613 27.8498 93.839C27.4879 93.3983 27.5292 88.8891 27.685 88.1863C27.7677 87.813 28.1023 87.6397 28.4275 87.4501ZM28.7681 92.9185L30.5109 92.9191C30.5234 91.4455 30.5236 89.9718 30.5113 88.4988C29.9408 88.4858 29.3702 88.4792 28.7995 88.4792C28.8021 89.9404 28.8265 91.4618 28.7681 92.9185Z",fill:"#013A9A"}),r.jsx("path",{d:"M90.9327 74.9628C91.5906 74.8965 93.0511 74.7432 93.6054 75.1028C93.8658 75.2715 94.092 75.5876 94.1455 75.9022C94.2632 76.5984 94.3061 81.8301 94.0342 82.141C93.8837 82.3134 93.706 82.3289 93.4984 82.3502C92.5566 82.3443 91.6341 82.421 90.6959 82.3222C90.0859 82.3274 90.0744 81.4507 90.0823 80.9217C90.1087 79.2212 89.9988 77.4294 90.1629 75.7349C90.1972 75.3835 90.6673 75.1124 90.9327 74.9628ZM91.2388 81.1523L93.0118 81.1471L93.0104 76.1342C92.4439 76.1504 91.8981 76.1696 91.3309 76.1541C91.1604 76.899 91.2403 80.1812 91.2388 81.1523Z",fill:"#013A9A"}),r.jsx("path",{d:"M99.2878 74.9366C103.274 74.6226 102.448 75.3933 102.543 79.0362C102.561 79.7146 102.649 81.703 102.37 82.1612C102.153 82.3467 102.102 82.3304 101.824 82.3511C101.083 82.3481 100.34 82.3814 99.5995 82.371C99.3788 82.3681 98.7948 82.3555 98.6544 82.1604C98.3413 81.7267 98.3542 76.4965 98.5147 75.7746C98.6057 75.3637 98.9604 75.1383 99.2878 74.9366ZM99.6482 76.1544C99.6461 76.7367 99.5701 80.9811 99.7371 81.1614L100.069 81.1415L101.386 81.1355C101.384 80.3944 101.468 76.6561 101.339 76.1817C101.119 76.1418 101.083 76.1359 100.861 76.1381L99.6482 76.1544Z",fill:"#013A9A"}),r.jsx("path",{d:"M102.278 89.0396C103.503 89.0106 103.266 90.1429 103.257 91.0539C104.795 91.3165 105.793 91.9213 106.431 93.4064C106.491 93.6309 106.608 94.3165 106.398 94.499C104.836 95.8589 105.072 93.5957 104.206 93.0903C103.405 92.6214 102.795 92.4603 102.026 92.6115C100.94 92.8246 99.974 93.6782 100.234 94.8556C100.512 96.0155 102.045 96.2796 103.03 96.5293C104.573 96.905 106.382 97.4891 106.673 99.3361C107.069 101.86 105.592 103.323 103.278 103.69C103.251 104.608 103.555 105.429 102.474 105.706C101.491 105.463 101.708 104.544 101.731 103.724C100.279 103.355 99.1292 102.861 98.5047 101.324C98.2889 100.793 98.4006 99.6087 99.0176 99.5454C100.154 99.4285 99.9672 101.352 101.033 101.822C101.849 102.299 102.562 102.146 103.431 102.019C104.418 101.873 105.401 100.707 105.016 99.6881C104.366 97.9663 101.418 98.2183 100.058 97.2723C99.4234 96.8806 98.7415 96.2086 98.611 95.4069C98.206 92.9162 99.4732 91.541 101.732 91.0867C101.699 90.1529 101.499 89.6375 102.278 89.0396Z",fill:"#013A9A"}),r.jsx("path",{d:"M60.9254 44.886C61.4512 44.8298 62.2251 44.942 62.3545 45.5221C62.5741 46.5069 62.6877 51.5463 62.3914 52.1598C62.1928 52.3478 62.1123 52.3279 61.8453 52.35C61.2895 52.3631 60.6644 52.4563 60.2109 52.1433C60.0063 51.5611 60.056 46.6424 60.1658 45.6788C60.2049 45.3376 60.6539 45.0531 60.9254 44.886Z",fill:"#013A9A"}),r.jsx("path",{d:"M67.3348 44.8801C67.6645 44.8336 68.2433 45.0121 68.2778 45.556C68.3617 46.874 68.5073 51.0847 68.2896 52.1737C68.1538 52.3612 68.0478 52.3403 67.8642 52.3654C67.5421 52.3686 67.1053 52.4303 66.8491 52.1404C66.6824 51.4851 66.7313 46.6823 66.8064 45.6716C66.8321 45.3212 67.1418 45.0431 67.3348 44.8801Z",fill:"#013A9A"}),r.jsx("path",{d:"M53.9908 44.8915C54.5286 44.8239 54.6418 44.9216 55.0108 45.5312C55.0789 46.3005 55.1103 51.4813 54.9844 52.1049C54.8192 52.3305 54.9148 52.2512 54.6742 52.3072C54.2691 52.3289 53.8481 52.5041 53.5216 52.1745C53.3422 51.4406 53.4014 46.7016 53.4777 45.6709C53.5017 45.3469 53.8154 45.0536 53.9908 44.8915Z",fill:"#013A9A"}),r.jsx("path",{d:"M72.3236 44.8736C72.6871 44.8665 73.0882 44.9261 73.402 45.0689C73.7655 45.2328 74.0196 45.5052 74.0992 45.8179C74.3467 46.8242 74.1997 50.8448 74.1268 52.0773C74.0683 52.1386 74.0097 52.1999 73.9522 52.2611C73.6208 52.3809 73.6462 52.3853 73.2827 52.3618C72.5788 52.3498 71.7214 52.3902 71.1292 52.1256C70.8076 51.5687 70.8596 46.5136 71.0993 45.6101C71.1833 45.2929 71.938 45.0138 72.3236 44.8736Z",fill:"#013A9A"}),r.jsx("path",{d:"M49.5105 44.873C49.9458 44.8977 50.6954 45.1421 50.7428 45.6087C50.8483 46.6455 51.0578 51.5059 50.7166 52.1254C50.4794 52.3155 50.3242 52.2983 50.0205 52.3295C49.5244 52.3598 48.9619 52.463 48.5608 52.1812C48.3574 51.6724 48.3453 46.444 48.5608 45.5411C48.6379 45.2182 49.1776 44.9829 49.5105 44.873Z",fill:"#013A9A"}),r.jsx("path",{d:"M76.4545 45.707C76.5542 45.7088 76.6547 45.7101 76.7535 45.7185C77.0093 45.7401 77.1583 45.8213 77.3109 46.0251C77.6196 46.4387 77.6214 51.9402 77.4794 52.6615C77.4238 52.9433 77.2077 53.048 76.9978 53.207C76.6459 53.2042 76.3592 53.1725 76.092 52.942C75.7806 52.3349 75.9456 47.3526 75.9615 46.3145C75.965 46.0463 76.2419 45.8666 76.4545 45.707Z",fill:"#013A9A"}),r.jsx("path",{d:"M45.3396 45.7089C45.5469 45.7031 45.6525 45.6918 45.8052 46.0079C45.9712 46.7423 45.8785 51.4627 45.8732 52.5756C45.8719 52.8485 45.7334 53.0364 45.6247 53.2061C45.4317 53.2111 45.3268 53.2036 45.1703 52.9886C45.0059 52.5357 45.0931 47.523 45.097 46.6304C45.099 46.1682 45.1695 45.9878 45.3396 45.7089Z",fill:"#013A9A"}),r.jsx("path",{d:"M61.9591 59.8796C63.5655 59.7724 64.9544 60.986 65.0635 62.5916C65.1733 64.1972 63.961 65.5879 62.3559 65.6993C60.7475 65.8109 59.3534 64.5963 59.2439 62.9878C59.1344 61.3793 60.3507 59.9871 61.9591 59.8796ZM62.4875 64.5283C63.4401 64.3398 64.0619 63.4163 63.8771 62.4624C63.693 61.5084 62.7719 60.8832 61.8173 61.0636C60.8566 61.2451 60.2268 62.1727 60.4124 63.1323C60.5982 64.092 61.5282 64.718 62.4875 64.5283Z",fill:"#013A9A"})]})}function q6(){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",children:[r.jsx("path",{d:"M61.0831 6.26953C62.455 6.44182 62.1158 7.58499 62.0885 8.70912C66.4975 7.61502 68.0582 10.3258 72.1763 10.2735C73.0545 10.2623 74.793 9.48525 75.3881 9.90135C75.6151 10.5948 75.5347 16.2794 75.5012 17.2984C74.325 19.1281 70.8184 19.0327 69.0331 18.3712C66.0467 17.2643 65.3143 16.6419 62.0932 17.2538L62.0877 22.973C68.1065 23.323 72.9898 26.8237 75.4918 32.266C76.6212 34.7233 76.9215 37.1336 76.8653 39.8088C78.511 39.7984 79.7316 39.545 79.3214 41.8538C79.1638 42.7377 78.8214 43.1113 78.1039 43.5994C78.2341 45.8748 78.132 49.0067 78.1296 51.3618C78.7754 51.346 79.794 51.2619 80.3556 51.488C80.8313 51.967 80.6972 53.7277 80.6956 54.4092L80.7104 57.6615C83.4215 58.8859 86.1389 60.3934 88.8765 61.5806C89.4349 61.8228 89.6221 62.5434 89.9583 62.5891C90.8178 62.7056 91.9565 62.6635 92.8261 62.6619L98.5065 62.6639C100.306 62.6557 102.331 62.5535 104.121 62.7751C105.302 62.9213 104.851 66.7807 104.684 67.624C104.645 67.8207 103.86 68.1335 103.646 68.2214C103.557 68.7134 103.591 69.659 103.591 70.2018L103.592 73.7155L103.602 86.7367C107.25 87.377 110.142 88.9439 112.348 91.9904C114.324 94.7412 115.112 98.1699 114.537 101.508C113.999 104.693 112.113 107.766 109.463 109.628C106.643 111.64 103.131 112.429 99.72 111.817C96.6299 111.256 93.6404 109.394 91.852 106.801L90.3865 106.799L40.3051 106.795L24.8158 106.797C22.0855 106.799 19.3544 106.808 16.6243 106.797C15.9725 106.763 15.1392 106.857 15.1484 105.938C15.1627 104.511 15.152 103.13 15.0862 101.705C15.0213 100.302 16.2792 100.414 17.2536 100.44C17.2613 99.7454 17.2425 99.0013 17.2249 98.3095C17.1747 96.337 17.0066 95.6234 19.2011 95.6647L19.2107 68.1786C17.7863 67.9397 17.9251 66.9346 17.9268 65.7248C17.9279 64.9292 17.9588 64.1257 17.9769 63.33C18.1995 63.0314 18.4813 62.682 18.8793 62.6694C20.29 62.6246 21.7371 62.6576 23.1491 62.6585L32.9719 62.6526C33.0147 62.5089 33.1899 62.0884 33.3061 62.0154C34.2669 61.4111 35.4065 60.9141 36.4243 60.4222L42.1239 57.6499C42.1244 56.6692 41.9175 52.013 42.4095 51.5329C43.0374 51.2341 43.9398 51.3421 44.6588 51.3601C44.62 48.8533 44.6733 46.1619 44.671 43.6357C43.6779 42.9296 43.5607 42.25 43.5045 41.0666C43.4894 40.7482 43.5777 40.213 43.8645 40.0235C44.3741 39.6869 45.4447 39.8057 46.0572 39.8141C46.0461 38.8414 46.0675 37.7633 46.1772 36.8034C46.994 29.6521 53.0915 23.3627 60.4225 23.0253C60.5465 19.1474 60.3757 15.0541 60.4389 11.1509C60.4599 9.84761 60.3765 8.23757 60.4888 6.92671C60.5153 6.61692 60.8328 6.43566 61.0831 6.26953ZM20.746 95.6655C23.4106 95.6366 26.0754 95.6351 28.74 95.6616C30.1334 95.6725 31.5591 95.6764 32.9489 95.6374C33.1072 95.6335 33.8285 95.0407 34.4591 95.2318C34.5128 95.2482 35.6136 95.2459 35.7756 95.2521C35.7644 94.9081 35.7483 94.5938 35.7685 94.2491C35.7687 92.5449 35.6148 92.5472 37.0848 91.7751C37.2063 89.6575 37.1295 86.8841 37.1293 84.7267L37.1262 71.8576C35.762 71.1947 36.0186 70.0591 36.0392 68.751C35.2291 68.7444 35.0003 68.7698 34.4449 68.1297C32.9836 68.1779 31.5086 68.1626 30.0459 68.1404C26.9522 68.0935 23.8287 68.2035 20.7383 68.1328L20.7296 85.4084C20.7279 88.7224 20.6578 92.3686 20.746 95.6655ZM61.5425 63.9146L78.7177 63.9154C81.8398 63.9153 85.1062 63.9605 88.2213 63.8984L88.2182 63.088C83.9823 60.9366 79.0687 58.6151 74.8515 56.5234C73.198 55.7033 61.9309 49.9607 61.2477 49.9391C55.2418 53.0275 48.9087 56.0629 42.8345 59.0407L37.5352 61.6242C36.8308 61.9674 34.849 62.7652 34.3628 63.4523C34.2805 63.5688 34.3979 63.6925 34.4712 63.8122C34.804 64.0451 59.1152 63.915 61.5425 63.9146ZM103.229 110.395C109.33 109.751 113.751 104.28 113.102 98.18C112.452 92.0793 106.977 87.6632 100.877 88.3184C94.7853 88.972 90.3755 94.4386 91.0244 100.531C91.6734 106.624 97.1361 111.038 103.229 110.395ZM47.6377 39.823L62.4597 39.8242L75.2703 39.8159C75.3429 35.4832 74.2299 31.9201 71.1608 28.7303C68.7024 26.1526 65.3159 24.6637 61.7539 24.5943C61.4208 24.5886 60.7587 24.5935 60.4334 24.6364C56.8713 24.9094 53.5634 26.5852 51.2362 29.2955C48.4459 32.5319 47.65 35.6845 47.6377 39.823ZM87.7073 68.6934C87.698 70.0154 87.9881 71.2017 86.5912 71.86L86.5827 91.8726C88.3212 92.3382 87.9366 93.7304 87.9171 95.2349L90.1236 95.2451C90.6181 93.7842 91.3739 92.4248 92.3535 91.2338C92.2739 89.4891 92.3168 87.6952 92.3137 85.9458C92.3121 85.2298 92.1756 83.216 92.6038 82.7075C93.1397 82.3846 97.7468 82.1982 97.9379 82.8907C98.274 84.1121 98.1204 86.0433 98.1001 87.37C99.2536 86.9433 100.807 86.6571 102.036 86.6836L102.04 68.1451L88.2666 68.1459L87.7073 68.6934ZM32.7613 100.437C32.9236 100.165 32.8539 97.6777 32.8494 97.2113L18.7794 97.2027C18.772 98.2564 18.805 99.4264 18.7763 100.46C23.4011 100.404 28.1349 100.413 32.7613 100.437ZM81.6526 91.8944C82.6775 91.8266 83.9745 91.8601 85.0236 91.8625C85.0165 85.3172 84.9019 78.4076 85.0173 71.8912C83.8965 71.8787 82.7765 71.8795 81.6557 71.892C81.6394 78.4685 81.5364 85.3304 81.6526 91.8944ZM88.4483 65.4899L88.4553 66.6336L102.611 66.64L103.317 66.6393C103.298 65.8705 103.27 64.9704 103.335 64.2114C100.169 64.0791 96.7734 64.2472 93.5835 64.1891C92.4198 64.1678 90.9246 64.2576 89.8015 64.1665C89.5995 65.0426 89.3725 65.3572 88.4483 65.4899ZM43.2309 70.3508C43.3433 70.1535 43.3018 69.0491 43.3008 68.7428L37.5205 68.7437L37.5298 70.3804C39.234 70.2782 41.4705 70.3609 43.2309 70.3508ZM44.7798 68.745C44.8015 70.0497 45.0615 71.2126 43.6785 71.8623L43.6792 91.8882C44.3037 92.0145 44.5016 92.1495 44.8944 92.6705C45.0311 93.5581 45.0107 94.3598 45.006 95.2552C45.3155 95.2466 46.188 95.281 46.365 95.1296L46.3478 95.0727C46.3685 94.3232 46.2164 92.8467 46.6809 92.4162C47.5029 91.6542 47.7641 92.2236 47.7631 91.0474C47.7617 89.3674 47.7326 87.6702 47.7378 85.9848L47.7439 71.8732C46.2673 71.2641 46.565 70.0864 46.6325 68.7482L44.7798 68.745ZM74.4233 71.8779C73.3891 71.8795 71.9868 71.9247 70.983 71.8732L70.9853 91.8703C72.1365 91.8547 73.2659 91.8788 74.421 91.85L74.4233 71.8779ZM76.5908 51.3664L76.59 45.4265C76.59 44.9309 76.5635 43.8382 76.5869 43.4084C76.6118 42.9345 77.8403 42.2061 77.8293 41.5329C77.3894 41.2877 48.9446 41.4554 45.0559 41.4402C45.0703 42.8139 46.1718 42.1774 46.1901 44.0651C46.2137 46.4859 46.1343 48.9557 46.2008 51.3697C47.7283 51.3596 54.0509 51.5414 55.0762 51.2439C55.7863 51.0379 56.4722 50.6299 57.1328 50.2994C58.3011 49.7028 59.4764 49.1204 60.6588 48.5523C60.6596 46.9659 60.5645 45.3231 60.7095 43.7547C60.7563 43.2483 61.8225 42.9477 61.9894 43.6285C62.3256 44.9974 62.186 47.1199 62.1735 48.5395C64.082 49.3984 66.1723 50.6047 68.1213 51.3409C68.2937 51.4059 69.3771 51.359 69.6485 51.3497L76.5908 51.3664ZM19.4894 64.1872C19.479 65.0047 19.4783 65.8223 19.4875 66.6399L33.8322 66.6382L34.2051 66.616C34.4532 66.2748 34.3132 65.9635 34.3328 65.4853L34.2417 65.4726C33.3691 65.3426 33.1438 65.0866 32.9549 64.2557C32.4345 64.0676 21.7886 64.1841 20.416 64.1866L19.4894 64.1872ZM43.6359 52.9188C43.6295 54.1987 43.6598 55.663 43.6154 56.9227C45.4535 56.03 47.2864 55.1267 49.1142 54.2129C49.9438 53.8155 50.9952 53.3432 51.7841 52.9097C49.1506 52.9678 46.2788 52.9444 43.6359 52.9188ZM79.1708 52.9173C76.4972 52.9212 73.7299 52.8844 71.0641 52.9295C73.7019 54.2862 76.4902 55.5831 79.1591 56.9165L79.1708 52.9173ZM95.5544 88.4767L96.5745 87.9479C96.5667 86.6384 96.5761 85.3281 96.6034 84.0185L93.8486 84.024C93.8291 85.9208 93.8517 87.8512 93.8205 89.7379C94.3603 89.2668 94.9398 88.8448 95.5544 88.4767ZM68.3304 68.7392L55.4532 68.7459C55.4785 70.1589 55.7151 71.1105 54.2978 71.892L54.2941 84.7611C54.294 86.9067 54.2148 89.6622 54.3392 91.7673C54.8479 92.0988 55.4506 92.3718 55.5329 92.9684C55.6338 93.7 55.5855 94.5057 55.5631 95.2435C55.9378 95.2381 56.3126 95.2349 56.6873 95.2349L56.6895 86.4255C56.688 85.4942 56.6324 82.5686 56.7808 81.8363C56.9191 81.178 57.2474 80.5759 57.7251 80.1024C58.6792 79.1501 59.8251 79.0285 61.0901 79.0269C63.3216 79.0246 64.9524 78.8202 66.2877 80.997C66.7362 82.0141 66.694 83.1879 66.6839 84.2822C66.6512 87.937 66.7268 91.6066 66.6738 95.2599C67.1371 95.2482 67.6027 95.2303 68.0652 95.2412C68.0613 94.4449 67.8889 92.814 68.4653 92.3101C68.8405 91.9818 69.2289 92.0356 69.4083 91.7369C69.5206 85.1456 69.3381 78.4739 69.4488 71.8818C68.0075 71.2641 68.3023 70.0864 68.3304 68.7392ZM80.1762 95.2622C82.2446 95.2217 84.3122 95.2794 86.3799 95.2248L86.4072 93.4021C84.3302 93.3849 82.254 93.3795 80.177 93.3873C80.1777 94.005 80.1879 94.6461 80.1762 95.2622ZM49.288 91.896C50.2598 91.8274 51.7287 91.8367 52.7332 91.8547L52.7452 71.8771L49.2754 71.8857L49.288 91.896ZM75.4552 70.35C75.6775 70.1051 75.5979 69.1341 75.5924 68.7488C73.6909 68.7449 71.7286 68.7175 69.8318 68.7443C69.831 69.2791 69.8388 69.8415 69.8263 70.3742C70.9861 70.3172 74.3141 70.2892 75.4552 70.35ZM80.4227 70.3695C82.3109 70.2946 84.2818 70.4147 86.1701 70.3414C86.2067 69.8103 86.2091 69.2776 86.2176 68.7451L80.4234 68.7367C80.4234 69.276 80.4312 69.8321 80.4227 70.3695ZM54.0664 95.2069L54.0621 93.3997C52.0027 93.3724 49.9376 93.4208 47.8848 93.3833L47.8758 95.2537C49.9175 95.2498 52.0368 95.2794 54.0664 95.2069ZM69.5798 95.2537C71.6217 95.2412 73.7674 95.2856 75.7929 95.2334C75.7937 94.657 75.7765 93.973 75.8007 93.406C73.7307 93.3857 71.6615 93.3795 69.5915 93.3865C69.5908 93.9847 69.6048 94.6625 69.5798 95.2537ZM86.9336 67.1595C86.918 66.5948 86.9212 66.0298 86.9407 65.4653L35.8378 65.4609C35.8432 66.0219 35.8623 66.6375 35.8478 67.1936L75.587 67.1841L83.5518 67.1965C84.0369 67.1979 86.6014 67.261 86.9336 67.1595ZM48.0697 68.7471L48.0755 70.3734C50.0055 70.3289 51.981 70.3586 53.9161 70.3539L53.9425 68.7433L48.0697 68.7471ZM59.9522 80.6141C59.3563 80.7919 58.815 81.0649 58.4957 81.6241C57.8534 82.748 58.3796 93.1369 58.2104 95.2427L63.5571 95.2474C64.0758 95.242 64.6147 95.2287 65.131 95.2373L65.1342 86.3857C65.1349 85.1058 65.2075 83.4983 65.0671 82.2488C64.8253 80.1001 61.4575 80.586 59.9522 80.6141ZM62.1142 10.353C62.09 12.1027 62.1259 13.9164 62.0822 15.6499C64.2778 15.2224 65.9235 15.3626 67.9544 16.3099C69.388 16.9786 71.0422 17.3686 72.638 17.1647C73.1684 17.0894 73.4648 17.0248 73.9842 16.8889C74.0084 15.1289 73.946 13.2758 73.9889 11.5494C68.5332 12.6804 67.8499 9.88536 63.5766 10.0408C63.008 10.1335 62.6633 10.1909 62.1142 10.353ZM37.2292 93.3966C37.2672 93.9231 37.2672 94.6983 37.2464 95.2412L43.2832 95.2342L43.4197 95.1835C43.4896 94.7334 43.4599 93.8958 43.4567 93.4083C41.4647 93.3763 39.2138 93.3506 37.2292 93.3966ZM77.2935 95.2693C77.5556 95.2654 78.4283 95.2802 78.6303 95.192L78.6522 95.0766C78.6545 94.3669 78.5258 92.9762 78.9758 92.4115C79.2239 92.1019 80.0498 92.0418 79.9937 91.5848C80.1154 85.0247 79.9679 78.4334 80.035 71.8748C78.6951 71.1947 78.9337 70.0372 78.9618 68.7441L77.1266 68.7477C77.136 70.1519 77.416 71.1066 76.0339 71.8686C76.0027 78.4653 75.9614 85.2704 76.0378 91.8601C77.6772 92.3593 77.2966 93.8544 77.2935 95.2693ZM38.6419 91.889C39.4892 91.8227 41.0887 91.8422 41.9838 91.8578L42.1165 91.7891C42.2112 90.0717 42.1233 87.3559 42.1237 85.5753L42.1425 71.8896L38.6664 71.8881C38.5818 78.5082 38.7778 85.3093 38.6419 91.889ZM16.6457 101.975L16.6822 105.252L90.8817 105.249C90.3662 104.182 89.9044 103.17 89.7375 101.978L16.6457 101.975ZM89.392 100.433C89.2906 99.5465 89.3569 97.7035 89.3717 96.7621L34.3499 96.7605C34.3612 97.9772 34.3337 99.2649 34.3779 100.47C36.0279 100.361 38.5776 100.433 40.2916 100.434L51.0877 100.433H89.392Z",fill:"#0147A5"}),r.jsx("path",{d:"M25.3467 82.4823C26.0279 82.4418 30.2276 82.2015 30.3252 82.9565C30.6555 85.5124 30.5562 88.5207 30.3899 91.0992C30.3759 91.316 29.9574 91.5024 29.785 91.557C28.4265 91.589 27.0474 91.5819 25.6895 91.5554C24.9026 91.5398 24.6831 91.0204 24.6754 90.2911C24.6505 87.9224 24.6057 85.5241 24.7183 83.1601C24.733 82.8497 25.1212 82.6289 25.3467 82.4823ZM26.2093 90.0587L28.9561 90.0665C28.9545 88.1042 28.9159 85.9687 28.9787 84.0211L26.1969 84.025C26.1942 86.01 26.1652 88.0808 26.2093 90.0587Z",fill:"#0147A5"}),r.jsx("path",{d:"M25.6153 71.1209C26.7972 71.1841 28.8616 70.9018 29.8909 71.2684C30.0881 71.3386 30.2449 71.4259 30.3265 71.6295C30.5801 72.262 30.6384 79.3088 30.3791 79.7752C30.2247 80.0529 30.0148 80.1246 29.7299 80.2081C28.735 80.2159 25.6669 80.375 24.957 79.9897C24.8769 79.8696 24.828 79.7721 24.7919 79.6309C24.6122 78.929 24.5497 71.9258 24.838 71.5468C25.0411 71.2793 25.3011 71.195 25.6153 71.1209ZM28.9534 78.6919L28.966 72.6793C28.0429 72.6847 27.1199 72.684 26.1969 72.6777C26.192 74.6229 26.1417 76.7818 26.2108 78.7153C27.1099 78.702 28.0583 78.6732 28.9534 78.6919Z",fill:"#0147A5"}),r.jsx("path",{d:"M61.0257 53.5886C63.3297 53.3858 65.3606 55.0922 65.5587 57.397C65.7561 59.7016 64.0449 61.7288 61.7393 61.9208C59.4416 62.1122 57.4231 60.4079 57.2262 58.1108C57.0294 55.8138 58.729 53.7909 61.0257 53.5886ZM61.8938 60.3743C63.3429 60.0935 64.2874 58.6874 63.9988 57.2397C63.7103 55.7921 62.2986 54.8554 60.8526 55.1517C59.4175 55.4458 58.4895 56.844 58.7759 58.2807C59.0623 59.7174 60.4556 60.653 61.8938 60.3743Z",fill:"#0147A5"}),r.jsx("path",{d:"M101.959 91.0469C103.131 91.2419 102.893 92.1365 102.87 93.1005C104.232 93.4241 104.817 93.5879 105.74 94.7469C106.671 95.9153 105.831 97.8979 104.598 96.5073C104.272 96.1399 104.169 95.4239 103.579 95.0316C102.613 94.3889 100.727 94.5785 100.03 95.5573C98.9678 97.242 100.514 97.9775 101.956 98.3253C102.897 98.5531 104.264 98.8884 105.057 99.4453C105.733 99.9156 106.182 100.648 106.294 101.465C106.618 103.828 105.063 105.206 102.869 105.546C102.898 106.504 103.145 107.644 101.863 107.679C101.025 107.221 101.238 106.491 101.274 105.63C99.9311 105.289 98.6972 104.851 98.0732 103.475C97.7831 102.836 97.7223 101.879 98.4656 101.534C99.6776 101.446 99.474 103.007 100.465 103.631C101.899 104.532 105.05 103.862 104.586 101.715C104.351 100.629 102.698 100.296 101.796 100.072C100.113 99.6614 98.2324 99.099 98.0101 97.0782C97.7613 94.8124 99.1106 93.4967 101.247 93.1356C101.266 92.2254 100.996 91.4696 101.959 91.0469Z",fill:"#0147A5"}),r.jsx("path",{d:"M93.4615 71.1186C94.4848 71.1397 96.7903 70.919 97.6412 71.3159C97.8456 71.4111 97.9275 71.5094 97.9899 71.7262C98.1965 72.4508 98.255 79.443 97.9282 79.8891C97.7457 80.1379 97.4938 80.1831 97.2068 80.2104C96.2514 80.2159 93.4147 80.3516 92.6355 80.0295C92.0537 79.4937 92.4047 72.9998 92.3485 71.9508C92.3181 71.3729 92.9467 71.1584 93.4615 71.1186ZM96.5922 78.7083C96.5189 76.891 96.5493 74.5044 96.5953 72.6723C95.7101 72.6816 94.7094 72.7128 93.8351 72.6847C93.8335 74.6908 93.8171 76.7186 93.839 78.7223C94.509 78.709 95.9854 78.6482 96.5922 78.7083Z",fill:"#0147A5"}),r.jsx("path",{d:"M72.7069 43.2349C74.0523 43.2031 73.6826 44.5801 73.7099 45.5872C73.745 46.9034 73.7045 48.2716 73.6569 49.5856C73.6467 49.8496 73.3605 50.0293 73.1647 50.1698C72.756 50.1628 72.2436 50.0763 72.2109 49.5501C72.0978 47.7095 72.1485 45.826 72.1867 43.9812C72.1945 43.6165 72.4503 43.4349 72.7069 43.2349Z",fill:"#0147A5"}),r.jsx("path",{d:"M49.6362 43.2402C49.9342 43.2448 50.229 43.2282 50.4453 43.4737C50.8343 43.9152 50.7218 48.6229 50.6525 49.3771C50.6149 49.7865 50.4907 49.9056 50.1855 50.1555C49.746 50.1679 49.2679 50.1299 49.1924 49.572C49.0953 48.7558 49.134 47.9145 49.1361 47.0903C49.1389 46.0685 49.1249 45.0393 49.1597 44.0185C49.1739 43.6019 49.3394 43.486 49.6362 43.2402Z",fill:"#0147A5"}),r.jsx("path",{d:"M66.9481 43.2445C67.182 43.2315 67.6913 43.2315 67.8013 43.5045C68.0119 44.1445 68.079 45.3795 67.9971 46.0659C67.8645 47.1664 68.3574 49.4818 67.4948 50.1523C67.0799 50.1896 66.5612 50.1562 66.5082 49.6167C66.4348 48.8727 66.4614 48.0955 66.4598 47.3464C66.4582 46.2339 66.4465 45.1167 66.477 44.0051C66.4887 43.5995 66.6634 43.4785 66.9481 43.2445Z",fill:"#0147A5"}),r.jsx("path",{d:"M55.4025 43.2391C56.513 43.2104 56.4087 43.9682 56.408 44.8402C56.4066 46.4127 56.43 47.9941 56.3751 49.5643C56.3648 49.8578 56.1148 50.0127 55.9008 50.1655C54.6786 50.1843 54.9049 49.3194 54.8946 48.346C54.8787 46.8295 54.868 45.2911 54.9373 43.778C54.9469 43.5692 55.2471 43.3626 55.4025 43.2391Z",fill:"#0147A5"})]})}function Z6(){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",children:[r.jsx("path",{d:"M60.4647 6.45508C62.2783 6.46707 61.9811 7.78406 61.9579 9.17742C64.1179 8.61059 66.7507 8.19853 68.678 9.52663C69.5821 10.1496 70.1962 10.5332 71.3832 10.6936C72.6302 10.8621 74.4125 10.1475 75.5628 10.5169C75.7132 10.5653 75.9263 10.9282 75.9343 11.1041C76.0606 13.6548 75.9925 16.2639 75.9863 18.8258C75.9845 19.651 75.5038 19.9611 74.7635 20.0867C72.2158 20.5187 69.8471 20.8956 67.6745 19.1713C66.2852 18.0678 63.562 18.6558 61.9677 18.9923L61.9695 23.8401C65.0731 25.661 68.2367 27.4281 71.3161 29.2831C72.4682 29.3113 76.3936 29.1264 77.1249 29.4944C77.7972 30.2628 77.5663 31.9705 77.5833 32.9734C77.6182 35.0207 76.8134 34.768 75.3023 34.7394C75.3623 42.5903 75.2272 50.4779 75.3229 58.3278C76.6057 58.2574 78.3469 58.3074 79.6574 58.3075L87.6747 58.3089L97.1036 58.3098C98.074 58.3089 102.89 58.1873 103.492 58.5207C104.041 59.2005 103.891 60.9275 103.838 61.8243C103.762 63.0965 104.322 65.0499 103.455 65.9981C103.12 66.3636 102.4 66.2869 101.933 66.2788C102.015 72.6963 101.86 79.2499 101.928 85.7033C107.255 86.8393 111.445 92.4396 111.529 97.816C111.712 109.615 98.0561 115.638 89.3343 107.521L84.6624 107.526L38.3784 107.524L23.2507 107.526C20.6466 107.528 18.0438 107.542 15.4363 107.514C13.5854 107.463 13.4067 106.931 13.3546 105.282C13.255 102.129 13.7844 102.17 16.6878 102.083C16.7204 101.12 16.4396 99.3343 17.1039 98.6154C17.4669 98.2216 18.1708 98.3111 18.6752 98.3335C18.756 94.7572 18.7015 91.0126 18.6989 87.4248L18.7068 66.2987C17.8653 66.2978 16.91 66.4478 16.8331 65.2934C16.78 64.4964 16.7873 63.9221 16.827 62.9537C16.8743 61.7998 16.5503 59.7741 17.1289 58.7267C17.6446 58.3078 20.6714 58.4442 21.4299 58.4447L27.3268 58.4459L45.5801 58.4407L45.5834 34.7479C44.8122 34.7495 44.0503 34.8849 43.4613 34.444C43.03 33.7264 43.0406 30.1747 43.6509 29.4552C44.3904 29.1486 48.3976 29.2939 49.4864 29.301C52.6156 27.321 56.3145 25.3329 59.557 23.5086C59.5758 21.5722 59.3941 7.73528 59.6805 7.09504C59.8381 6.74413 60.138 6.6112 60.4647 6.45508ZM47.3969 58.4178C47.6922 58.4242 48.6489 58.4636 48.8735 58.3688C49.911 57.9308 51.0207 57.2678 52.0178 56.7172L57.2369 53.8467C58.3145 53.2546 59.2365 52.7 60.3546 52.1867L60.4208 52.1567C61.3491 52.487 62.9202 53.3981 63.8243 53.8937L68.9734 56.7296C71.1684 57.8695 71.1048 58.3022 73.5111 58.3252C73.4905 50.6042 73.3795 42.4433 73.5075 34.7506L47.3788 34.7479L47.3779 49.9248C47.3771 52.6979 47.3264 55.6572 47.3969 58.4178ZM37.0762 66.3149C31.6261 66.2678 26.1756 66.2631 20.7253 66.3006L20.5757 66.3725C20.4846 66.899 20.5324 68.9462 20.5353 69.606L20.5443 75.8993C20.5483 83.3168 20.4317 90.967 20.5594 98.3603C25.2575 98.1114 30.2231 98.4704 34.9464 98.3281C35.8416 98.3012 36.8835 98.3111 37.7784 98.3549L37.7445 96.7803C37.7635 95.3811 37.8091 94.8843 39.3862 94.8942L39.404 68.6741C37.0954 68.7161 36.9875 68.6327 37.0762 66.3149ZM15.1808 103.92C15.186 104.465 15.2133 105.197 15.1781 105.724L83.3196 105.729C84.7447 105.725 86.4008 105.68 87.8063 105.729C86.7464 104.059 85.8315 102.2 85.6596 100.195L42.5227 100.189C34.6535 100.189 26.3869 100.058 18.545 100.207C18.6093 103.868 18.9566 103.966 15.1808 103.92ZM68.8033 82.2658C68.9421 83.2272 68.874 86.4965 68.8732 87.5922L68.8561 98.3612C69.5061 98.3406 70.1022 98.3236 70.7512 98.337C70.7333 96.6962 70.2249 94.9165 72.3491 94.8834C72.3823 86.1751 72.2623 77.3602 72.3635 68.6721C64.4554 68.6746 56.1227 68.807 48.2443 68.6702C48.1591 77.2931 48.15 86.2745 48.2338 94.8977C50.4558 94.9058 49.8469 96.7006 49.8571 98.38C50.4882 98.346 51.1202 98.3299 51.7522 98.3335L51.7542 87.6235C51.7523 82.6284 51.0119 78.5956 57.7336 78.797C59.9025 78.8623 62.247 78.7558 64.4295 78.8104C65.6398 78.8167 66.9369 79.361 67.7381 80.2454C68.2546 80.821 68.6207 81.5148 68.8033 82.2658ZM81.2204 68.6687L81.207 85.2924C81.207 88.4471 81.1613 91.7333 81.2311 94.8798C83.5255 94.9201 82.8452 96.6451 82.9007 98.3782C83.7063 98.295 84.6749 98.3039 85.485 98.3567C85.5361 95.4134 86.1851 93.3034 87.8286 90.8605C87.2047 90.8712 85.2478 90.9715 85.0581 90.5633C84.6284 89.6439 84.7922 85.7329 84.7922 84.835L84.7958 75.7945C84.7823 75.0641 84.5845 73.6676 85.152 73.1305C85.5173 72.784 94.1549 72.8172 95.2014 72.9353C95.6185 72.9819 96.101 73.0526 96.4116 73.3561C96.5934 74.0928 96.5191 76.8616 96.5164 77.7317C96.5039 80.2785 96.5056 82.8253 96.5218 85.3721C97.5754 85.2217 99.0542 85.0928 100.095 85.3444L100.106 66.3084C94.8639 66.1667 89.0121 66.2687 83.7251 66.2835C83.7627 67.7126 83.9552 68.6822 82.1648 68.682C81.8506 68.6806 81.5355 68.6762 81.2204 68.6687ZM60.3528 54.1589C55.4446 56.954 50.4212 59.5819 45.4888 62.3378C43.4908 63.4542 41.4584 64.5138 39.4629 65.6347C39.1127 65.8293 38.7983 66.1177 38.7516 66.5303C39.0497 67.0121 40.4957 66.8481 41.1126 66.8487L45.3129 66.8476L60.5372 66.8421L75.5458 66.8481C76.4643 66.8475 81.1998 66.9014 81.7432 66.7357C82.2266 65.978 81.3323 65.6063 80.8059 65.315L65.6827 57.0152C64.7204 56.4874 61.0475 54.3291 60.3528 54.1589ZM79.4139 94.904C79.3548 92.2068 79.4202 89.3252 79.4211 86.6128L79.4238 68.6841L74.1789 68.6702C74.0795 74.9611 74.2147 81.3223 74.161 87.6181C74.1413 89.916 74.2532 92.6508 74.1691 94.896C75.8395 94.8968 77.7659 94.8476 79.4139 94.904ZM60.582 29.2954C62.5585 29.2874 66.0121 29.1789 67.8634 29.3537C66.8599 28.8204 60.7288 25.1538 60.3465 25.1553C57.892 26.5228 55.4464 27.9067 53.0103 29.3066C55.534 29.283 58.0585 29.2794 60.582 29.2954ZM99.4356 109.419C105.572 108.906 110.146 103.535 109.675 97.3953C109.204 91.2543 103.866 86.6442 97.7222 87.0721C91.5177 87.5044 86.852 92.9069 87.3273 99.1078C87.8027 105.31 93.2373 109.938 99.4356 109.419ZM72.5765 98.38C74.784 98.2135 78.7408 98.3406 81.0754 98.346C81.0772 97.7946 81.0745 97.2619 81.1076 96.7105C78.2547 96.6926 75.4017 96.6908 72.5488 96.7042C72.5747 97.2619 72.5837 97.8214 72.5765 98.38ZM48.0765 96.7132C45.2443 96.6917 42.4118 96.6872 39.5795 96.6997L39.5771 98.3934C42.1187 98.26 45.3283 98.3567 47.9424 98.3451L48.0586 98.2591C48.0755 97.7435 48.0815 97.2288 48.0765 96.7132ZM91.5222 81.0528C92.3323 81.0591 94.0126 81.0251 94.7529 81.0976C94.6902 79.0029 94.726 76.8097 94.7314 74.7078C93.6616 74.6935 92.5919 74.6899 91.5231 74.6953C91.5356 76.747 91.5795 79.0154 91.5222 81.0528ZM56.3522 98.3236L59.3788 98.3487C59.4361 92.6293 59.4773 86.3828 59.369 80.6706C58.5105 80.633 57.7457 80.5954 56.8836 80.6241C55.5457 80.6608 54.0317 80.8568 53.6773 82.4896C53.4745 83.4242 53.5386 84.6846 53.5484 85.663C53.591 89.8964 53.4953 94.1592 53.5651 98.389C54.4497 98.3066 55.4551 98.3272 56.3522 98.3236ZM86.596 81.0896C87.5413 81.0457 88.7596 81.0537 89.713 81.0851C89.8876 79.9983 89.722 76.1052 89.7694 74.7015L86.5897 74.6944C86.5888 76.8124 86.5673 78.9751 86.596 81.0896ZM61.1979 80.6097C61.1629 86.3443 61.0752 92.6705 61.2131 98.3863C62.5147 98.2609 65.6559 98.3021 67.072 98.3558C67.0479 94.8494 67.0488 91.3421 67.0747 87.8356C67.0774 86.3998 67.1822 84.0795 67.0013 82.7036C66.6459 79.9912 63.1762 80.7297 61.1979 80.6097ZM91.5759 82.8665C91.4595 83.5603 91.5159 86.4535 91.5195 87.2645C92.3036 86.8071 92.7199 86.594 93.5265 86.2207L94.7224 85.7624L94.7394 82.8933C93.6849 82.8907 92.6304 82.8817 91.5759 82.8665ZM89.7739 82.9104C88.7077 82.8808 87.6406 82.871 86.5745 82.8799C86.5861 84.7947 86.6443 87.1714 86.5664 89.0674C87.4697 89.0808 89.0264 89.2867 89.6297 88.7461C89.9117 88.1293 89.7058 84.0025 89.7739 82.9104ZM73.9121 18.1949C73.9318 16.4029 73.8835 14.3328 73.9399 12.5723C72.7296 12.7096 71.2964 12.8911 70.1148 12.5624C68.0004 11.9746 67.226 10.3736 64.6801 10.7957C63.7366 10.8698 62.8942 11.061 61.9704 11.2496L61.965 16.9437C63.7223 16.3934 66.304 16.0527 67.9923 16.9737C69.3959 17.7396 69.541 18.1665 71.1693 18.3648C72.2077 18.4343 72.8764 18.3418 73.9121 18.1949ZM75.8386 31.1488L44.9601 31.1038L44.9493 32.9556C52.0675 32.8782 59.2535 33.0207 66.3765 32.9564C69.2966 32.93 72.9534 33.0688 75.8305 32.9228L75.8386 31.1488ZM18.6406 60.2616L18.6496 64.4718L37.8479 64.4569C39.13 63.7474 41.4205 62.3908 42.6677 61.8164C43.6124 61.287 44.5603 60.7631 45.5111 60.2447C36.6429 60.2996 27.4748 60.0796 18.6406 60.2616ZM102.062 60.1556C96.0034 60.0897 89.8732 60.1487 83.8093 60.1454L78.0926 60.1387C77.5 60.1396 75.7875 60.1119 75.2594 60.1833C75.8878 60.5835 82.7279 64.335 82.9356 64.3483C87.1376 64.6186 92.8318 64.389 97.2218 64.46C98.0722 64.4737 101.456 64.5535 102.015 64.4248C102.052 63.002 102.067 61.5789 102.062 60.1556ZM41.2041 68.675C41.1677 77.3862 41.2945 86.2154 41.1986 94.9031C42.8501 94.9031 44.7947 94.9541 46.4209 94.8951L46.4152 77.6207C46.4125 75.1984 46.2803 70.9847 46.4533 68.6779L41.2041 68.675Z",fill:"#0146A3"}),r.jsx("path",{d:"M24.9559 72.9043C26.6109 72.907 34.5446 72.7307 35.5586 73.1433C36.2296 74.1961 35.7086 88.006 35.7827 90.2485C35.7902 90.475 35.3166 90.7364 35.1114 90.8348C33.1411 90.9073 31.1567 90.8187 29.1341 90.8527C28.5863 90.7874 24.3923 91.0676 24.3548 90.5009C23.9881 84.9624 24.1712 79.0542 24.2468 73.4808C24.25 73.2391 24.8022 72.975 24.9559 72.9043ZM30.8257 81.0791C31.8266 81.0648 33.0136 81.0514 34.0089 81.0863C34.1667 80.2001 34.0426 75.9023 34.0608 74.6983C32.9807 74.6947 31.9006 74.6992 30.8206 74.7117C30.8471 76.7384 30.8873 79.056 30.8257 81.0791ZM25.9472 82.8623C25.9317 84.4173 26.0421 87.6856 25.931 89.0749L29.0799 89.0543C29.1444 87.1144 29.1174 84.8586 29.0842 82.908C28.051 82.8946 26.9771 82.8946 25.9472 82.8623ZM29.1048 81.0899C29.0808 78.9638 29.0772 76.8369 29.0943 74.7108C28.035 74.692 26.9755 74.6911 25.9162 74.709C26.0679 76.016 25.9147 79.5099 25.9517 81.1042C27.0027 81.0935 28.0538 81.0881 29.1048 81.0899ZM30.8274 82.8704C30.8499 84.9347 30.8524 86.9981 30.835 89.0624C31.9057 89.057 32.9763 89.0597 34.0471 89.0686L34.0572 82.8811C33.3102 82.8865 31.489 82.942 30.8274 82.8704Z",fill:"#0146A3"}),r.jsx("path",{d:"M59.906 36.6388C63.6918 36.3029 67.0379 39.0873 67.396 42.871C67.7532 46.6546 64.9889 50.0171 61.2076 50.3971C57.3944 50.7802 53.998 47.9875 53.6372 44.1725C53.2762 40.3576 56.0886 36.9775 59.906 36.6388ZM61.1584 48.5741C63.9433 48.2168 65.9127 45.6711 65.5582 42.8859C65.2037 40.1006 62.6605 38.1288 59.8747 38.48C57.0849 38.8317 55.1095 41.38 55.4642 44.1696C55.819 46.9592 58.3699 48.9319 61.1584 48.5741Z",fill:"#0146A3"}),r.jsx("path",{d:"M60.0957 39.4857C61.5745 39.3905 61.3364 40.6109 61.3463 41.689C61.3507 42.1785 61.3382 42.6749 61.3346 43.1648C61.8619 43.1585 62.4375 43.1216 62.9585 43.1415C64.1616 43.1876 64.4328 44.3286 63.398 44.9592C58.9328 45.2885 59.4306 44.9933 59.5326 40.7826C59.5478 40.1502 59.6221 39.8909 60.0957 39.4857Z",fill:"#0146A3"}),r.jsx("path",{d:"M98.2232 89.8789C99.566 89.9702 99.3995 90.7956 99.3941 91.8868C100.396 92.1392 101.355 92.4633 102.009 93.3272C102.369 93.7694 102.925 94.8812 102.57 95.4407C101.987 96.3743 101.295 95.8193 100.86 95.0754C99.8453 93.3352 98.1427 93.0855 96.6057 94.3029C96.235 94.5974 96.0847 95.3897 96.2413 95.848C96.5636 96.7987 97.9735 97.1666 98.9474 97.3573C101.864 97.9275 103.879 99.7698 102.285 102.851C101.753 103.879 100.5 104.344 99.3583 104.615C99.4094 105.682 99.5794 106.265 98.4685 106.729C97.363 106.388 97.5778 105.613 97.6047 104.655C96.2019 104.274 95.1626 103.814 94.4017 102.481C94.1734 102.082 93.9461 101.46 94.2567 101.033C95.6147 99.1825 95.9101 102.008 96.9431 102.586C98.0496 103.206 99.9572 103.113 100.735 101.956C101.466 100.869 100.781 99.7841 99.5786 99.401C97.6629 98.7904 94.9236 98.6884 94.3856 96.266C93.9183 93.9708 95.381 92.3022 97.5859 91.9119C97.568 90.9737 97.397 90.4715 98.2232 89.8789Z",fill:"#0146A3"})]})}function U6(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}function Al({entityCount:e,showPaymentActions:t=!0}){const n=Ie(),{enabledPayments:s}=Kn();return r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap gap-3",children:[t&&s.includes("federal")&&r.jsxs("button",{type:"button",onClick:()=>n("/payments/federal/new",{state:{from:"/",resetDraft:!0}}),className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700",children:[r.jsx(ya,{}),"Add Federal Payments"]}),t&&s.includes("state")&&r.jsxs("button",{type:"button",onClick:()=>n("/payments/state/new",{state:{from:"/",resetDraft:!0}}),className:"inline-flex items-center gap-2 rounded-lg border border-gov-600 bg-white px-4 py-2.5 text-sm font-semibold text-gov-600 transition hover:bg-gov-50",children:[r.jsx(ya,{}),"Add State Payment"]}),t&&r.jsxs("button",{type:"button",disabled:!0,title:"Coming soon",className:"inline-flex cursor-not-allowed items-center gap-2 rounded-lg border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-semibold text-slate-400",children:[r.jsx(ya,{}),"Add Local Payment",r.jsx("span",{className:"text-xs font-medium",children:"(Coming Soon)"})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsxs("button",{type:"button",onClick:()=>n("/entities"),className:"inline-flex items-center gap-1.5 rounded-[14px] border border-solid border-[#e5e7eb] bg-[#f9fafb] px-[15px] py-[9px] text-xs font-bold text-[#364153] transition hover:bg-slate-100",title:"View Entities",children:[r.jsx(B6,{}),"Entities (",e,")"]}),r.jsxs("button",{type:"button",onClick:()=>n("/create-entity/form",{state:{from:"/dashboard"}}),className:"inline-flex items-center gap-1.5 rounded-[14px] border-[1.5px] border-dashed border-[#16a34a] bg-[#f0fdf4] px-[15.5px] py-[9.5px] text-xs font-bold text-[#16a34a] transition hover:bg-green-50",children:[r.jsx(W6,{}),"Add Entity"]})]})]})}function ya(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})})}function B6(){return r.jsx("svg",{className:"h-[13px] w-[13px] shrink-0 text-[#364153]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 002.625.372 9.337 9.337 0 004.121-.952 4.125 4.125 0 00-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 018.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0111.964-3.07M12 6.375a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zm8.25 2.25a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z"})})}function W6(){return r.jsx("svg",{className:"h-[13px] w-[13px] shrink-0 text-[#16a34a]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zM4 19.235v-.11a6.375 6.375 0 0112.75 0v.109A12.318 12.318 0 0110.374 21c-2.356 0-4.564-.64-6.374-1.766z"})})}function wr({label:e="Loading…"}){return r.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-[inherit] bg-white/75","aria-live":"polite","aria-busy":"true",children:r.jsxs("div",{className:"flex items-center gap-2.5 text-sm text-slate-500",children:[r.jsx(Y6,{}),r.jsx("span",{children:e})]})})}function Y6(){return r.jsxs("svg",{className:"h-5 w-5 animate-spin text-gov-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[r.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.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"})]})}const H6={Draft:"Draft"};function Ku(e){switch((e??H6.Draft).trim().toLowerCase()){case"draft":case"pending":return"drafts";case"scheduled":return"scheduled";case"processing":return"submitted";case"rejected":return"rejected";case"accepted":return"paid";default:return"drafts"}}function Nr(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:e%1===0?0:2,maximumFractionDigits:2}).format(e)}function K6(e){const t=e.submitted+e.paid+e.scheduled+e.failed;return t<=0?[{color:"bg-emerald-400",width:0},{color:"bg-orange-400",width:0},{color:"bg-amber-400",width:0},{color:"bg-red-400",width:0}]:[{color:"bg-emerald-400",width:e.paid/t*100},{color:"bg-orange-400",width:e.submitted/t*100},{color:"bg-amber-400",width:e.scheduled/t*100},{color:"bg-red-400",width:e.failed/t*100}]}const Qu="drafts",Q6="all";function Ge(){return qr(Qu)}function qr(e){return`/payments?tab=${e}`}function Gu(e){return e==="failed"?"rejected":e}function G6(e,t){return e==="draft"||t.trim().toLowerCase()==="draft"?Qu:Gu(e)}const J6=["January","February","March","April","May","June","July","August","September","October","November","December"];function X6({entityId:e,initialOverview:t,isDashboardLoading:n=!1}){const s=Ie(),a=(t==null?void 0:t.year)??new Date().getFullYear(),[i,o]=x.useState(null);x.useEffect(()=>{o(null)},[e]);const l=i??(t==null?void 0:t.month)??new Date().getMonth()+1,c=i===null,{data:d,isFetching:u}=de({queryKey:["dashboard","monthly-overview",e,i,a],queryFn:()=>M6(e,i,a),enabled:e!==null&&i!==null,placeholderData:g=>g}),h={submitted:0,paid:0,scheduled:0,failed:0},m=c?t??h:d??h,f=n||u&&!c,p=[{key:"submitted",label:"Submitted to Fed/State",amount:m.submitted,icon:$6,iconClassName:"rounded-xl bg-orange-50 text-orange-500",amountClassName:"text-orange-500"},{key:"paid",label:"Paid",amount:m.paid,icon:e4,iconClassName:"rounded-full bg-emerald-50 text-emerald-600",amountClassName:"text-emerald-600"},{key:"scheduled",label:"Scheduled",amount:m.scheduled,icon:t4,iconClassName:"rounded-xl bg-amber-50 text-amber-500",amountClassName:"text-amber-500"},{key:"failed",label:"Rejected",amount:m.failed,icon:n4,iconClassName:"rounded-full bg-red-50 text-red-500",amountClassName:"text-red-500"}];return r.jsxs("section",{className:"relative rounded-xl border border-slate-200 bg-white p-6",children:[f?r.jsx(wr,{}):null,r.jsxs("div",{className:"mb-6 flex flex-wrap items-center gap-4",children:[r.jsx("h2",{className:"text-sm font-bold uppercase tracking-wide text-slate-500",children:"Overview of Month"}),r.jsxs("div",{className:"relative",children:[r.jsx("select",{value:l,onChange:g=>o(Number(g.target.value)),disabled:f,className:"appearance-none rounded-full border border-gov-600 bg-white py-1.5 pl-4 pr-8 text-sm font-medium text-gov-600 focus:border-gov-600 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:J6.map((g,y)=>r.jsx("option",{value:y+1,children:g},g))}),r.jsx(_6,{className:"pointer-events-none absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-gov-600"})]})]}),r.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-4",children:p.map(g=>{const y=g.icon;return r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:`flex h-11 w-11 shrink-0 items-center justify-center ${g.iconClassName}`,children:r.jsx(y,{})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-xs leading-4 text-slate-500",children:g.label}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:[r.jsx("p",{className:`text-xl font-bold leading-7 ${g.amountClassName}`,children:Nr(g.amount)}),r.jsx("button",{type:"button",onClick:()=>s(qr(Gu(g.key))),className:"text-sm font-medium text-gov-600 underline decoration-gov-600 underline-offset-2 hover:text-gov-700",children:"View Details"})]})]})]},g.key)})})]})}function _6({className:e}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function $6(){return r.jsxs("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 14.25v-1.5M11.25 13.5h1.5"})]})}function e4(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}function t4(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})})}function n4(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})})}function Pl(e){return{count:e.count,submitted:e.submitted,paid:e.paid,scheduled:e.scheduled,failed:e.failed,percentDone:e.percentDone}}function r4(e){return{id:e.id,jurisdiction:e.jurisdiction,period:e.period,amount:e.amount,paymentDate:e.paymentDate,status:e.status,statusLabel:e.statusLabel,formType:e.formType,category:e.category}}function Il(){return{count:0,submitted:0,paid:0,scheduled:0,failed:0,percentDone:0}}const s4={primary:"bg-brand-600 text-white hover:bg-brand-700 focus-visible:ring-brand-500 disabled:bg-brand-600/60",secondary:"border border-slate-300 bg-white text-slate-700 hover:bg-slate-50 focus-visible:ring-slate-400",ghost:"text-slate-600 hover:bg-slate-100 focus-visible:ring-slate-400"};function a4({variant:e="primary",isLoading:t=!1,className:n="",children:s,disabled:a,...i}){return r.jsx("button",{type:"button",className:`inline-flex h-10 items-center justify-center rounded-lg px-4 text-sm font-medium transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed ${s4[e]} ${n}`,disabled:a||t,...i,children:t?"Please wait…":s})}const i4=[10,20,50,100];function o4(e,t){const n=e.trim();if(!/^\d+$/.test(n))return null;const s=Number(n);return!Number.isInteger(s)||s<1||s>t?null:s}function l4(){return r.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M12.5 4.5 7 10l5.5 5.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function c4(){return r.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:r.jsx("path",{d:"M7.5 4.5 13 10l-5.5 5.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function $r({page:e,pageSize:t,totalCount:n,onPageChange:s,onPageSizeChange:a,pageSizeOptions:i=i4,disabled:o=!1,className:l=""}){const c=t>0?Math.max(1,Math.ceil(n/t)):1,d=n===0?0:c,u=e>1,h=d>0&&e<d,m=n===0?0:(e-1)*t+1,f=Math.min(e*t,n),[p,g]=x.useState(String(e)),y=x.useRef(p);y.current=p,x.useEffect(()=>{g(String(e))},[e]);function C(j=y.current){if(o||d===0){g(String(e));return}const N=o4(j,d);if(N===null){g(String(e));return}if(N===e){g(String(e));return}s(N)}function b(j){j.key==="Enter"&&(j.preventDefault(),C(j.currentTarget.value))}return n===0?null:r.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 border-t border-slate-200 bg-white px-6 py-3 ${l}`,children:[r.jsxs("p",{className:"text-sm text-slate-500",children:["Showing ",r.jsx("span",{className:"font-medium text-slate-700",children:m}),"–",r.jsx("span",{className:"font-medium text-slate-700",children:f})," of ",r.jsx("span",{className:"font-medium text-slate-700",children:n})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a?r.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-600",children:[r.jsx("span",{className:"whitespace-nowrap",children:"Rows per page"}),r.jsx("select",{value:t,disabled:o,onChange:j=>a(Number(j.target.value)),className:"rounded-lg border border-slate-200 bg-white px-2 py-1.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:i.map(j=>r.jsx("option",{value:j,children:j},j))})]}):null,r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",disabled:o||!u,onClick:()=>s(e-1),"aria-label":"Previous page",className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-700 transition hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gov-200 disabled:cursor-not-allowed disabled:text-slate-300 disabled:hover:bg-transparent",children:r.jsx(l4,{})}),r.jsx("span",{className:"min-w-[5.5rem] text-center text-sm text-slate-600",children:d===0?"—":`Page ${e} of ${d}`}),r.jsx("button",{type:"button",disabled:o||!h,onClick:()=>s(e+1),"aria-label":"Next page",className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-700 transition hover:bg-slate-100 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gov-200 disabled:cursor-not-allowed disabled:text-slate-300 disabled:hover:bg-transparent",children:r.jsx(c4,{})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("label",{htmlFor:"pagination-go-to-page",className:"whitespace-nowrap text-sm text-slate-600",children:"Go to page"}),r.jsx("input",{id:"pagination-go-to-page",type:"text",inputMode:"numeric",pattern:"[0-9]*",value:p,disabled:o||d===0,onChange:j=>g(j.target.value),onKeyDown:b,"aria-label":"Go to page number",className:"h-9 w-14 rounded-lg border border-slate-200 bg-white px-2 text-center text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60"}),r.jsx(a4,{type:"button",variant:"secondary",disabled:o||d===0,className:"h-9 px-3",onMouseDown:j=>{j.preventDefault()},onClick:()=>C(),children:"Go"})]})]})]})}const u4=[{value:"all",label:"All"},{value:"draft",label:"Draft"},{value:"scheduled",label:"Scheduled"},{value:"paid",label:"Completed"},{value:"submitted",label:"Submitted"},{value:"failed",label:"Rejected"}],El={total:0,page:1,pageSize:Ft,items:[]};function d4({label:e,status:t}){const n={draft:"bg-slate-100 text-slate-600",scheduled:"bg-amber-50 text-amber-700",paid:"bg-emerald-50 text-emerald-700",submitted:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-600"};return r.jsx("span",{className:`inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium ${n[t]}`,children:e})}function m4({entityId:e,initialPayments:t,isDashboardLoading:n=!1}){const s=Ie(),[a,i]=x.useState(""),[o,l]=x.useState(""),[c,d]=x.useState(""),[u,h]=x.useState("all"),[m,f]=x.useState(1),[p,g]=x.useState(Ft);x.useEffect(()=>{const E=window.setTimeout(()=>l(a),300);return()=>window.clearTimeout(E)},[a]),x.useEffect(()=>{f(1)},[o,c,u,e,p]);const y=!!o||!!c||u!=="all",C=e!==null&&(y||m>1||p!==Ft),{data:b,isFetching:j}=de({queryKey:["dashboard","payments",e,o,c,u,m,p],queryFn:()=>O6({entityId:e,search:o||void 0,taxYear:c||void 0,status:u,page:m,pageSize:p}),enabled:C,placeholderData:E=>E}),N=x.useMemo(()=>C?b??El:t&&m===1&&p===Ft?t:El,[C,b,t,m,p]),A=x.useMemo(()=>N.items.map(r4),[N.items]),S=x.useMemo(()=>{const E=new Date().getFullYear();return[E,E-1,E-2].map(String)},[]),R=n||C&&j;return r.jsxs("section",{className:"relative overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:[R?r.jsx(wr,{label:"Loading payments…"}):null,r.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-slate-200 px-6 py-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-gov-50 text-gov-600",children:r.jsx(f4,{})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-base font-bold text-slate-900",children:"My Payments"}),r.jsxs("p",{className:"text-xs text-slate-500",children:[N.total," total payments"]})]})]})}),r.jsx("div",{className:"border-b border-slate-200 p-6",children:r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,0.8fr)_minmax(0,0.8fr)] lg:items-end",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"payment-search",className:"mb-1.5 block text-sm text-slate-600",children:"Search by Jurisdiction/Form Type"}),r.jsxs("div",{className:"relative",children:[r.jsx(h4,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"}),r.jsx("input",{id:"payment-search",type:"text",value:a,onChange:E=>i(E.target.value),placeholder:"All",disabled:n,className:"block w-full rounded-lg border border-slate-200 bg-white py-2.5 pl-10 pr-3 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60"})]})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"tax-period-filter",className:"mb-1.5 block text-sm text-slate-600",children:"Filter by Tax Period"}),r.jsxs("div",{className:"relative",children:[r.jsxs("select",{id:"tax-period-filter",value:c,onChange:E=>d(E.target.value),disabled:n,className:"block w-full appearance-none rounded-lg border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:[r.jsx("option",{value:"",children:"Select Year"}),S.map(E=>r.jsx("option",{value:E,children:E},E))]}),r.jsx(Tl,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"})]})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"status-filter",className:"mb-1.5 block text-sm text-slate-600",children:"Filter by Status"}),r.jsxs("div",{className:"relative",children:[r.jsx("select",{id:"status-filter",value:u,onChange:E=>h(E.target.value),disabled:n,className:"block w-full appearance-none rounded-lg border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:u4.map(E=>r.jsx("option",{value:E.value,children:E.label},E.value))}),r.jsx(Tl,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"})]})]})]})}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[960px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-xs font-semibold uppercase tracking-wide text-slate-500",children:[r.jsx("th",{className:"px-6 py-3",children:"ID"}),r.jsx("th",{className:"px-6 py-3",children:"Jurisdiction / Type"}),r.jsx("th",{className:"px-6 py-3",children:"Period"}),r.jsx("th",{className:"px-6 py-3",children:"Amount"}),r.jsx("th",{className:"px-6 py-3",children:"Payment"}),r.jsx("th",{className:"px-6 py-3",children:"Status"}),r.jsx("th",{className:"px-6 py-3",children:"Form Type"}),r.jsx("th",{className:"px-6 py-3",children:"Actions"})]})}),r.jsx("tbody",{children:!R&&A.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:8,className:"px-6 py-12 text-center text-slate-500",children:y?"No payments match your filters.":"No payments yet."})}):A.map(E=>r.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[r.jsxs("td",{className:"px-6 py-4 font-medium text-slate-900",children:["#",E.id]}),r.jsx("td",{className:"px-6 py-4 text-slate-700",children:E.jurisdiction}),r.jsx("td",{className:"px-6 py-4 text-slate-700",children:E.period}),r.jsx("td",{className:"px-6 py-4 font-medium text-slate-900",children:Nr(E.amount)}),r.jsx("td",{className:"px-6 py-4 text-slate-700",children:E.paymentDate}),r.jsx("td",{className:"px-6 py-4",children:r.jsx(d4,{label:E.statusLabel,status:E.status})}),r.jsx("td",{className:"px-6 py-4 text-slate-700",children:E.formType}),r.jsx("td",{className:"px-6 py-4",children:r.jsx("button",{type:"button",onClick:()=>s(qr(G6(E.status,E.statusLabel))),className:"text-sm font-medium text-gov-600 hover:text-gov-700",children:"View"})})]},`${E.category}-${E.id}`))})]})}),r.jsx($r,{page:m,pageSize:p,totalCount:N.total,onPageChange:f,onPageSizeChange:g,disabled:R||e===null})]})}function h4({className:e}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})})}function Tl({className:e}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function f4(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function ba({entityId:e,category:t,title:n,subtitlePrefix:s,defaultTaxYear:a,taxYearOptions:i,initialSummary:o,isDashboardLoading:l=!1,stats:c,comingSoon:d=!1}){const[u,h]=x.useState(a);x.useEffect(()=>{h(a)},[e,a]);const m=u===a,{data:f,isFetching:p}=de({queryKey:["dashboard","summary",e,t,u],queryFn:()=>D6(e,t,u),enabled:e!==null&&!m&&!d,placeholderData:b=>b});if(d)return r.jsxs("article",{className:"flex min-h-[220px] flex-col rounded-2xl border border-slate-200 bg-white p-5 shadow-sm",children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("h3",{className:"text-base font-bold text-slate-900",children:n}),r.jsx("p",{className:"mt-0.5 text-xs text-slate-500",children:s})]}),r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx("span",{className:"rounded-full border border-slate-200 bg-slate-50 px-4 py-2 text-sm font-semibold text-slate-500",children:"Coming Soon"})})]});const g=m?o?Pl(o):Il():f?Pl(f):Il(),y=K6(g),C=l||p&&!m;return r.jsxs("article",{className:"relative flex flex-col rounded-2xl border border-slate-200 bg-white p-5 shadow-sm",children:[C?r.jsx(wr,{}):null,r.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-base font-bold text-slate-900",children:n}),r.jsxs("p",{className:"mt-0.5 text-xs text-slate-500",children:[s," (",g.count,")"]})]}),r.jsxs("div",{className:"relative shrink-0",children:[r.jsx("select",{value:u,onChange:b=>h(Number(b.target.value)),disabled:C,className:"appearance-none rounded-lg border border-slate-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-slate-700 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:i.map(b=>r.jsxs("option",{value:b,children:["TY ",b]},b))}),r.jsx(p4,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400"})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:c.map(b=>r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:`h-2 w-2 rounded-full ${b.dotClassName}`}),r.jsx("span",{className:"text-xs text-slate-500",children:b.label})]}),r.jsx("p",{className:"mt-1 text-sm font-semibold text-slate-900",children:Nr(g[b.key])})]},b.label))}),r.jsxs("div",{className:"mt-5",children:[r.jsx("div",{className:"flex h-2 overflow-hidden rounded-full bg-slate-100",children:y.map((b,j)=>b.width>0?r.jsx("span",{className:`${b.color} h-full`,style:{width:`${b.width}%`}},j):null)}),r.jsxs("p",{className:"mt-2 text-xs font-medium text-slate-600",children:[g.percentDone,"% done"]})]})]})}function p4({className:e}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function x4({userName:e,steps:t}){const n=t.filter(i=>i.done).length,s=t.findIndex(i=>!i.done),a=Math.round(n/t.length*100);return r.jsxs("section",{className:"rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-10",children:[r.jsxs("h2",{className:"text-2xl font-bold text-slate-900",children:["Welcome",e?r.jsxs("span",{className:"italic",children:[", ",e,"!"]}):"!",r.jsx("span",{"aria-hidden":"true",children:" 👋"})]}),r.jsx("p",{className:"mt-1 text-sm text-slate-600",children:"New here? Take the five-minute tour to see how GovPay works."}),r.jsx("h3",{className:"mt-8 text-xl font-bold text-slate-900",children:"Complete your setup"}),r.jsx("p",{className:"mt-1 text-sm text-slate-600",children:"Four quick steps, then you're ready to make your first payment."}),r.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":t.length,"aria-valuenow":n,"aria-label":"Setup progress",className:"mt-5 h-2 w-full overflow-hidden rounded-full bg-slate-200",children:r.jsx("div",{className:"h-full rounded-full bg-gov-600 transition-all",style:{width:`${Math.max(a,1.5)}%`}})}),r.jsx("ol",{className:"mt-6 space-y-4",children:t.map((i,o)=>r.jsx(g4,{step:i,stepNumber:o+1,active:o===s},i.title))})]})}function g4({step:e,stepNumber:t,active:n}){return r.jsxs("li",{className:`flex flex-wrap items-center justify-between gap-4 rounded-xl border p-4 ${n?"border-gov-400 bg-gov-50/40":"border-slate-200 bg-slate-50/60"}`,children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[r.jsx("span",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-sm font-semibold ${e.done?"bg-gov-600 text-white":n?"border border-gov-400 bg-white text-gov-600":"bg-slate-200 text-slate-500"}`,children:e.done?r.jsx(y4,{}):t}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:`text-sm font-semibold ${e.done?"text-slate-400 line-through":n?"text-gov-700":"text-slate-900"}`,children:e.title}),r.jsx("p",{className:"mt-0.5 text-xs text-slate-500",children:e.description})]})]}),e.done?r.jsx("button",{type:"button",onClick:e.onView,disabled:!e.onView,className:"inline-flex h-10 min-w-[120px] items-center justify-center rounded-lg border border-gov-300 bg-white px-5 text-sm font-medium text-gov-700 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-50",children:"View"}):n?r.jsxs("button",{type:"button",onClick:e.onAction,disabled:!e.onAction,className:"inline-flex h-10 min-w-[140px] items-center justify-center gap-2 rounded-lg bg-gov-600 px-5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:[e.actionLabel,r.jsx(b4,{})]}):r.jsx("button",{type:"button",disabled:!0,className:"inline-flex h-10 min-w-[140px] cursor-not-allowed items-center justify-center rounded-lg border border-gov-200 bg-white px-5 text-sm font-medium text-gov-400",children:e.actionLabel})]})}function y4(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"3",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}function b4(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"})})}async function kn(e){return(await fe(`/portal/bank-accounts?entityId=${e}&pageSize=1000`)).items}function v4(e){return fe("/portal/bank-accounts",{method:"POST",body:e})}function Ju(e,t){return fe(`/portal/bank-accounts/${e}`,{method:"PATCH",body:t})}function C4({entityId:e,entityCount:t,dashboard:n}){const{data:s=[]}=de({queryKey:["bank-accounts",e],queryFn:()=>kn(e),enabled:e!==null}),a=t>0,i=(n==null?void 0:n.hasPayments)??!1,o=s.length>0,l=i;return{hasEntity:a,hasPayment:i,hasBankAccount:o,hasAuthorizedPayment:l,isComplete:a&&i&&o&&l,userName:j4()}}function j4(){var t,n;const e=(n=(t=Hc())==null?void 0:t.user.name)==null?void 0:n.trim();if(e)return e.split(/\s+/)[0]}const cn=new Date().getFullYear(),va=[cn,cn-1,cn-2],w4=[{label:"Submitted to IRS",key:"submitted",dotClassName:"bg-orange-400"},{label:"Paid",key:"paid",dotClassName:"bg-emerald-400"},{label:"Scheduled",key:"scheduled",dotClassName:"bg-amber-400"},{label:"Rejected",key:"failed",dotClassName:"bg-red-400"}],N4=[{label:"Submitted to State",key:"submitted",dotClassName:"bg-orange-400"},{label:"Paid",key:"paid",dotClassName:"bg-emerald-400"},{label:"Scheduled",key:"scheduled",dotClassName:"bg-amber-400"},{label:"Rejected",key:"failed",dotClassName:"bg-red-400"}],S4=[{label:"Submitted",key:"submitted",dotClassName:"bg-orange-400"},{label:"Paid",key:"paid",dotClassName:"bg-emerald-400"},{label:"Scheduled",key:"scheduled",dotClassName:"bg-amber-400"},{label:"Rejected",key:"failed",dotClassName:"bg-red-400"}];function _i(){const e=Ie(),{entities:t,selectedEntity:n,enabledPayments:s}=Kn(),a=(n==null?void 0:n.entityId)??null,[i,o]=x.useState(!1),{data:l,isLoading:c}=de({queryKey:["dashboard",a,cn],queryFn:()=>R6(a,cn),enabled:a!==null}),d=C4({entityId:a,entityCount:t.length,dashboard:l});return!c&&(a===null||l)&&!d.isComplete?r.jsxs("div",{className:"space-y-6",children:[r.jsx(Al,{entityCount:t.length,showPaymentActions:!1}),r.jsx(x4,{userName:d.userName,steps:[{title:"Add your first entity",description:"Add the business or individual you'll be filing and paying taxes for.",actionLabel:"Add Entity",done:d.hasEntity,onAction:()=>e("/create-entity/form",{state:{from:"/dashboard"}}),onView:()=>e("/entities")},{title:"Create your first payment",description:"Choose the tax authority, payment type, and amount.",actionLabel:"Create Payment",done:d.hasPayment,onAction:()=>o(!0),onView:()=>e("/payments")},{title:"Connect your bank account",description:"Link an account so payments can be sent securely and on time.",actionLabel:"Connect Bank",done:d.hasBankAccount,onAction:()=>e("/settings"),onView:()=>e("/settings")},{title:"Review & Authorize",description:"Check the details, then submit. You can still cancel before it processes.",actionLabel:"Review Payment",done:d.hasAuthorizedPayment,onAction:()=>e(Ge()),onView:()=>e("/payments")}]}),r.jsx(z6,{open:i,onClose:()=>o(!1),enabledPayments:s,onSelectFederal:()=>e("/payments/federal/new",{state:{from:"/dashboard",resetDraft:!0}}),onSelectState:()=>e("/payments/state/new",{state:{from:"/dashboard",resetDraft:!0}})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Al,{entityCount:t.length}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2 xl:grid-cols-3",children:[s.includes("federal")&&r.jsx(ba,{entityId:a,category:"federal",title:"Federal Payments",subtitlePrefix:"IRS & Federal agencies",defaultTaxYear:cn,taxYearOptions:va,initialSummary:l==null?void 0:l.federal,isDashboardLoading:c,stats:w4}),s.includes("state")&&r.jsx(ba,{entityId:a,category:"state",title:"All State Payments",subtitlePrefix:"State tax authorities",defaultTaxYear:cn,taxYearOptions:va,initialSummary:l==null?void 0:l.state,isDashboardLoading:c,stats:N4}),r.jsx(ba,{entityId:a,category:"local",title:"Local Payments",subtitlePrefix:"Local tax authorities",defaultTaxYear:cn,taxYearOptions:va,initialSummary:l==null?void 0:l.local,isDashboardLoading:c,stats:S4,comingSoon:!0})]}),r.jsx(X6,{entityId:a,initialOverview:l==null?void 0:l.monthlyOverview,isDashboardLoading:c}),r.jsx(m4,{entityId:a,initialPayments:l==null?void 0:l.payments,isDashboardLoading:c})]})}const Ll=160,k4=48,ls=8;function A4({entity:e,onEdit:t,variant:n="button"}){const s=x.useRef(null),a=x.useRef(null),[i,o]=x.useState(!1),[l,c]=x.useState({}),d=()=>{var g;const u=s.current;if(!u)return;const h=u.getBoundingClientRect(),m=((g=a.current)==null?void 0:g.offsetHeight)??k4,p=window.innerHeight-h.bottom<m+ls;c({position:"fixed",top:p?h.top-m-ls:h.bottom+ls,left:Math.max(ls,h.right-Ll),width:Ll,zIndex:50})};return x.useLayoutEffect(()=>{i&&(d(),requestAnimationFrame(d))},[i]),x.useEffect(()=>{if(!i)return;const u=m=>{var p,g;const f=m.target;(p=s.current)!=null&&p.contains(f)||(g=a.current)!=null&&g.contains(f)||o(!1)},h=()=>d();return document.addEventListener("mousedown",u),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),()=>{document.removeEventListener("mousedown",u),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0)}},[i]),r.jsxs("div",{className:"inline-block text-left",children:[r.jsx("button",{ref:s,type:"button","aria-label":n==="kebab"?"Entity actions":void 0,"aria-haspopup":"menu","aria-expanded":i,onClick:()=>o(u=>!u),className:n==="kebab"?"inline-flex h-7 w-7 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-600":"inline-flex items-center gap-1.5 rounded-lg bg-gov-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-gov-700",children:n==="kebab"?r.jsx(P4,{}):r.jsxs(r.Fragment,{children:["Actions",r.jsx(I4,{})]})}),i?jn.createPortal(r.jsx("div",{ref:a,role:"menu",style:l,className:"overflow-hidden rounded-lg border border-slate-200 bg-white py-1 shadow-lg",children:r.jsx("button",{type:"button",onClick:()=>{o(!1),t(e)},className:"block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-50",children:"Edit"})}),document.body):null]})}function P4(){return r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"5",r:"1.6"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.6"}),r.jsx("circle",{cx:"12",cy:"19",r:"1.6"})]})}function I4(){return r.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})}function $i({active:e,variant:t="filled",activeLabel:n="Active",inactiveLabel:s="Inactive"}){const a=t==="outline"?e?"border border-emerald-200 bg-white text-emerald-700":"border border-slate-200 bg-slate-50 text-slate-500":e?"bg-emerald-50 text-emerald-700":"bg-red-50 text-red-600",i=e?"bg-emerald-500":t==="outline"?"bg-slate-400":"bg-red-500";return r.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium ${a}`,children:[r.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${i}`}),e?n:s]})}function E4({entity:e,selected:t,onEdit:n}){const[s,a]=x.useState(!1),i=Jr(e),o=(e.status??"Active").trim().toLowerCase()==="active",c=e.accountType==="Individual"?"SSN":"EIN";return r.jsxs("div",{className:`rounded-xl border bg-white p-5 shadow-sm transition ${t?"border-gov-400 ring-1 ring-gov-200":"border-slate-200"}`,children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[r.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-gov-50 text-sm font-semibold text-gov-700",children:A2(i)}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"truncate text-base font-bold text-slate-900",children:i}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[r.jsx($i,{active:o}),r.jsx("span",{className:"text-xs text-slate-500",children:e.accountType})]})]})]}),r.jsx(A4,{variant:"kebab",entity:e,onEdit:n})]}),r.jsx("div",{className:"my-4 h-px bg-slate-200"}),r.jsxs("ul",{className:"space-y-3 text-sm text-slate-700",children:[r.jsx(Ca,{icon:r.jsx(T4,{}),value:e.email}),r.jsx(Ca,{icon:r.jsx(L4,{}),value:sn(e.phoneNumber)}),r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"shrink-0 text-slate-400",children:r.jsx(F4,{})}),r.jsx("span",{className:"min-w-0 truncate",children:s?Zn(e.idNumber,e.accountType):ps(e.idNumber,e.accountType)}),r.jsx("button",{type:"button","aria-label":s?`Hide ${c}`:`Show ${c}`,onClick:()=>a(d=>!d),className:"shrink-0 text-slate-400 transition hover:text-slate-600",children:s?r.jsx(Lu,{}):r.jsx(Bi,{})})]}),r.jsx(Ca,{icon:r.jsx(R4,{}),value:e.entityType})]})]})}function Ca({icon:e,value:t}){return r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"shrink-0 text-slate-400",children:e}),r.jsx("span",{className:"min-w-0 truncate",children:t||"—"})]})}function T4(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"12",viewBox:"0 0 15 12",fill:"none",children:r.jsx("path",{d:"M13.8345 2.4998L7.83998 6.31742C7.63656 6.43555 7.40551 6.49777 7.17026 6.49777C6.93502 6.49777 6.70396 6.43555 6.50054 6.31742L0.500061 2.4998M1.8335 0.5H12.501C13.2375 0.5 13.8345 1.09689 13.8345 1.8332V9.8324C13.8345 10.5687 13.2375 11.1656 12.501 11.1656H1.8335C1.09706 11.1656 0.500061 10.5687 0.500061 9.8324V1.8332C0.500061 1.09689 1.09706 0.5 1.8335 0.5Z",stroke:"#8E8E92","stroke-linecap":"round"})})}function L4(){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[r.jsx("g",{"clip-path":"url(#clip0_953_35331)",children:r.jsx("path",{d:"M9.66126 11.0858C9.51426 11.1225 9.35913 11.108 9.22143 11.0448C7.36957 10.1359 5.87095 8.63919 4.95976 6.78847C4.89228 6.65004 4.87479 6.49252 4.91028 6.34267C4.94577 6.19281 5.03204 6.05986 5.15444 5.9664L5.46647 5.73238C5.63207 5.60818 5.76649 5.44712 5.85907 5.26196C5.95164 5.07681 5.99984 4.87264 5.99984 4.66563V2.66547C5.99984 2.31182 5.85935 1.97266 5.60929 1.72259C5.35922 1.47252 5.02005 1.33203 4.6664 1.33203H2.66624C2.31259 1.33203 1.97343 1.47252 1.72336 1.72259C1.47329 1.97266 1.3328 2.31182 1.3328 2.66547C1.3328 5.84832 2.59719 8.90082 4.8478 11.1514C7.09842 13.402 10.1509 14.6664 13.3338 14.6664C13.6874 14.6664 14.0266 14.5259 14.2766 14.2759C14.5267 14.0258 14.6672 13.6866 14.6672 13.333V11.3328C14.6672 10.9792 14.5267 10.64 14.2766 10.3899C14.0266 10.1399 13.6874 9.99939 13.3338 9.99939H11.3336C11.1266 9.99939 10.9224 10.0476 10.7373 10.1402C10.5521 10.2327 10.3911 10.3672 10.2669 10.5328L10.0302 10.8428C9.93838 10.9634 9.80827 11.0491 9.66126 11.0858Z",stroke:"#8E8E92","stroke-linecap":"round"})}),r.jsx("defs",{children:r.jsx("clipPath",{id:"clip0_953_35331",children:r.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function F4(){return r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[r.jsx("path",{d:"M14.5271 2.25781H1.47294C0.649906 2.25781 0 2.92625 0 3.73075V12.2662C0 13.0892 0.668437 13.7391 1.47294 13.7391H14.5271C15.3501 13.7391 16 13.0706 16 12.2661V3.73075C16 2.90769 15.3316 2.25781 14.5271 2.25781ZM15.0625 12.2661C15.0625 12.5616 14.8232 12.8016 14.5271 12.8016H1.47294C1.17744 12.8016 0.9375 12.5622 0.9375 12.2661V3.73075C0.9375 3.43525 1.17681 3.19531 1.47294 3.19531H14.5271C14.8226 3.19531 15.0625 3.43462 15.0625 3.73075V12.2661Z",fill:"#8E8E92"}),r.jsx("path",{d:"M6.27309 8.14438C6.54547 7.83941 6.71144 7.4375 6.71144 6.99741C6.71144 6.04681 5.93806 5.27344 4.98747 5.27344C4.03688 5.27344 3.26353 6.04681 3.26353 6.99741C3.26353 7.4375 3.4295 7.83941 3.70184 8.14434C2.988 8.57953 2.51038 9.3655 2.51038 10.2609C2.51038 10.5198 2.72025 10.7297 2.97913 10.7297H6.99578C7.25466 10.7297 7.46453 10.5198 7.46453 10.2609C7.46453 9.3655 6.98691 8.57956 6.27309 8.14438ZM4.98747 6.21094C5.42113 6.21094 5.77394 6.56375 5.77394 6.99741C5.77394 7.43106 5.42113 7.78387 4.98747 7.78387C4.55381 7.78387 4.20103 7.43106 4.20103 6.99741C4.20103 6.56375 4.55381 6.21094 4.98747 6.21094ZM3.52081 9.79222C3.71956 9.17178 4.30191 8.72137 4.98747 8.72137C5.67303 8.72137 6.25534 9.17175 6.45413 9.79222H3.52081Z",fill:"#8E8E92"}),r.jsx("path",{d:"M13.0208 5.77734H9.50623C9.24735 5.77734 9.03748 5.98722 9.03748 6.24609C9.03748 6.50497 9.24735 6.71484 9.50623 6.71484H13.0208C13.2797 6.71484 13.4896 6.50497 13.4896 6.24609C13.4896 5.98722 13.2797 5.77734 13.0208 5.77734Z",fill:"#8E8E92"}),r.jsx("path",{d:"M13.0208 7.78516H9.50623C9.24735 7.78516 9.03748 7.99503 9.03748 8.25391C9.03748 8.51278 9.24735 8.72266 9.50623 8.72266H13.0208C13.2797 8.72266 13.4896 8.51278 13.4896 8.25391C13.4896 7.99503 13.2797 7.78516 13.0208 7.78516Z",fill:"#8E8E92"}),r.jsx("path",{d:"M12.0166 9.79297H9.50623C9.24735 9.79297 9.03748 10.0028 9.03748 10.2617C9.03748 10.5206 9.24735 10.7305 9.50623 10.7305H12.0166C12.2755 10.7305 12.4854 10.5206 12.4854 10.2617C12.4854 10.0028 12.2755 9.79297 12.0166 9.79297Z",fill:"#8E8E92"})]})}function R4(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:r.jsx("path",{d:"M10.6669 13.332V2.66536C10.6669 2.31174 10.5264 1.9726 10.2763 1.72256C10.0263 1.47251 9.68709 1.33203 9.33344 1.33203H6.66656C6.31291 1.33203 5.97375 1.47251 5.72368 1.72256C5.47361 1.9726 5.33312 2.31174 5.33312 2.66536V13.332M2.66624 3.9987H13.3338C14.0702 3.9987 14.6672 4.59565 14.6672 5.33203V11.9987C14.6672 12.7351 14.0702 13.332 13.3338 13.332H2.66624C1.9298 13.332 1.3328 12.7351 1.3328 11.9987V5.33203C1.3328 4.59565 1.9298 3.9987 2.66624 3.9987Z",stroke:"#8E8E92","stroke-linecap":"round"})})}const ys="All";function D4({value:e,onChange:t}){const[n,s]=x.useState(!1),a=x.useRef(null),i=e!==ys;return x.useEffect(()=>{if(!n)return;const o=c=>{var d;(d=a.current)!=null&&d.contains(c.target)||s(!1)},l=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l)}},[n]),r.jsxs("div",{ref:a,className:"relative",children:[r.jsxs("button",{type:"button","aria-label":i?`Filter by entity type: ${e}`:"Filter by entity type","aria-haspopup":"menu","aria-expanded":n,onClick:()=>s(o=>!o),className:`relative inline-flex h-10 w-10 items-center justify-center rounded-lg border transition ${i?"border-gov-300 bg-gov-50 text-gov-700":"border-slate-200 bg-white text-slate-500 hover:bg-slate-50"}`,children:[r.jsx(M4,{}),i?r.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-gov-600"}):null]}),n?r.jsxs("div",{role:"menu",className:"absolute right-0 z-20 mt-2 w-52 overflow-hidden rounded-lg border border-slate-200 bg-white py-1 shadow-lg",children:[r.jsx("p",{className:"px-4 py-2 text-xs font-semibold uppercase tracking-wide text-slate-400",children:"Entity Type"}),T2.map(o=>r.jsxs("button",{type:"button",onClick:()=>{t(o),s(!1)},className:`flex w-full items-center justify-between px-4 py-2 text-left text-sm transition hover:bg-slate-50 ${o===e?"font-semibold text-gov-700":"text-slate-700"}`,children:[o,o===e?r.jsx(O4,{}):null]},o))]}):null]})}function M4(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7h16M7 12h10M10 17h4"})})}function O4(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}function Fl({title:e,subtitle:t,step:n,children:s,className:a=""}){return r.jsxs("section",{className:`rounded-xl border border-slate-200 bg-white ${a}`,children:[r.jsxs("div",{className:"flex items-center gap-3 border-b border-slate-100 px-6 py-4",children:[n?r.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-gov-600 text-xs font-semibold text-white",children:n}):null,r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:e}),t?r.jsx("p",{className:"mt-0.5 text-xs text-slate-500",children:t}):null]})]}),r.jsx("div",{className:"space-y-5 p-6",children:s})]})}function z4(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 21h18M5 21V6a1 1 0 011-1h4a1 1 0 011 1v15m0 0V3a1 1 0 011-1h4a1 1 0 011 1v18M9 9h.01M9 12h.01M9 15h.01"})})}function V4(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}function Xu({open:e,entity:t,onClose:n}){var V,q,B,ee,W,ue,we,Re,Ce,Oe,Ne,ve,Pe;const s=At(),[a,i]=x.useState(null),[o,l]=x.useState(!1),{register:c,handleSubmit:d,watch:u,reset:h,setValue:m,getValues:f,formState:{errors:p}}=Ut({resolver:Bt(ku),defaultValues:ul(t),shouldUnregister:!1}),g=u("accountType"),y=u("entityType"),C=g==="Individual"?wu:ju,b=g==="Individual"?"SSN":"EIN",j=u("country"),N=u("state"),A=u("zipCode"),S=j==="United States",R=Yn(j),E=N.length>0&&A.trim().length>0&&!pr(R,N,A),z=c("phoneNumber"),X=c("zipCode");x.useEffect(()=>{N&&R.length>0&&!R.some(ne=>ne.code===N)&&m("state","")},[j,R]);const H=ne=>{const Se=f("accountType");if(Se===ne)return;const U=f("lastName");Au(Se,ne,m,U),m("accountType",ne),queueMicrotask(()=>{m("lastName",U),m("firstName",""),Se==="Business"&&ne==="Individual"&&m("tradeName","")})};x.useEffect(()=>{if(e){const ne=ul(t);h(ne),i(null)}},[t,e,h]),x.useEffect(()=>{if(!e)return;const ne=Se=>{Se.key==="Escape"&&n()};return document.addEventListener("keydown",ne),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",ne),document.body.style.overflow=""}},[e,n]),x.useEffect(()=>{C.includes(y)||m("entityType",g==="Individual"?"Sole Proprietorship":"LLP")},[g,y,C,m]);const _=d(async ne=>{if(i(null),!pr(R,ne.state,ne.zipCode)){i(`ZIP code does not match the selected state (${ne.state}).`);return}l(!0);try{await F1(t.entityId,z2(ne)),await s.invalidateQueries({queryKey:["entities","mine"]}),n()}catch(Se){i(rt(Se,"Unable to update entity. Please try again."))}finally{l(!1)}});return e?jn.createPortal(r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[r.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:n}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"edit-entity-title",className:"relative z-10 flex max-h-[90vh] w-full max-w-4xl flex-col overflow-hidden rounded-2xl bg-white shadow-xl",children:[r.jsxs("div",{className:"border-b border-slate-200 px-6 py-5",children:[r.jsx("h2",{id:"edit-entity-title",className:"text-lg font-bold text-slate-900",children:"Edit Entity"}),r.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Update your entity profile details."})]}),r.jsxs("form",{onSubmit:_,noValidate:!0,className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"overflow-y-auto px-6 py-6",children:[a?r.jsx("div",{className:"mb-5",children:r.jsx(Zt,{message:a})}):null,r.jsx("input",{type:"hidden",...c("ein")}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Fl,{step:1,title:"Basic Information",subtitle:"Enter the primary details for this entity.",children:[r.jsx(Jc,{label:"Account Type",required:!0,value:g,onChange:H,options:[{label:"Business",value:"Business",icon:r.jsx(z4,{})},{label:"Individual",value:"Individual",icon:r.jsx(V4,{})}]}),r.jsx("div",{className:"grid gap-5 sm:grid-cols-2",children:g==="Individual"?r.jsxs(r.Fragment,{children:[r.jsx(ce,{label:"First name",required:!0,maxLength:100,placeholder:"Enter first name",error:(V=p.firstName)==null?void 0:V.message,...c("firstName")},"entity-first-name"),r.jsx(ce,{label:"Last name",required:!0,maxLength:100,placeholder:"Enter last name",error:(q=p.lastName)==null?void 0:q.message,...c("lastName")},"entity-last-name")]}):r.jsxs(r.Fragment,{children:[r.jsx(ce,{label:"Business Name",required:!0,maxLength:150,placeholder:"Enter business name",error:(B=p.lastName)==null?void 0:B.message,...c("lastName")},"entity-business-name"),r.jsx(ce,{label:"Trade Name, if any",maxLength:150,placeholder:"Enter trade name (optional)",error:(ee=p.tradeName)==null?void 0:ee.message,...c("tradeName")},"entity-trade-name")]})}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{label:b,required:!0,readOnly:!0,value:Zn(t.idNumber,g),className:"cursor-default bg-[#F9FAFB] text-slate-700"}),r.jsx(lt,{label:"Entity Type",required:!0,error:(W=p.entityType)==null?void 0:W.message,...c("entityType"),children:C.map(ne=>r.jsx("option",{value:ne,children:ne},ne))})]}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{label:"Email ID",required:!0,type:"email",maxLength:254,placeholder:"sample@mail.com",error:(ue=p.email)==null?void 0:ue.message,...c("email")}),r.jsx(Eu,{required:!0,error:(we=p.phoneNumber)==null?void 0:we.message,countryCodeSelectProps:c("countryCode"),phoneInputProps:{placeholder:"Enter 10-digit phone number",maxLength:10,...z,onChange:ne=>{ne.target.value=ne.target.value.replace(/\D/g,"").slice(0,10),z.onChange(ne)}}})]})]}),r.jsxs(Fl,{step:2,title:"Address Information",subtitle:"Enter the registered address.",children:[r.jsx(ce,{label:"Address Line 1",required:!0,maxLength:200,placeholder:"Enter address line 1",error:(Re=p.address1)==null?void 0:Re.message,...c("address1")}),r.jsx(ce,{label:"Address Line 2",maxLength:200,placeholder:"Enter address line 2 (optional)",error:(Ce=p.address2)==null?void 0:Ce.message,...c("address2")}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{label:"City",required:!0,maxLength:100,placeholder:"Enter city",error:(Oe=p.city)==null?void 0:Oe.message,...c("city")}),r.jsxs(lt,{label:S?"State":"Province",required:!0,error:(Ne=p.state)==null?void 0:Ne.message,...c("state"),children:[r.jsx("option",{value:"",children:S?"Select state":"Select province"}),R.map(ne=>r.jsx("option",{value:ne.code,children:ne.name},ne.code))]})]}),r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{label:S?"ZIP Code":"Postal Code",required:!0,maxLength:10,placeholder:S?"12345 or 12345-6789":"A1A 1A1",error:((ve=p.zipCode)==null?void 0:ve.message)??(E?`ZIP code does not match the selected state (${N}).`:void 0),...X,onChange:ne=>{ne.target.value=S?Ui(ne.target.value):Su(ne.target.value),X.onChange(ne)}}),r.jsxs(lt,{label:"Country",required:!0,error:(Pe=p.country)==null?void 0:Pe.message,...c("country"),children:[r.jsx("option",{value:"United States",children:"United States"}),r.jsx("option",{value:"Canada",children:"Canada"})]})]})]})]})]}),r.jsx(Gc,{className:"px-6",onCancel:n,isSubmitting:o,submitLabel:"Save Changes",submittingLabel:"Saving…"})]})]})]}),document.body):null}const q4=[{id:"all",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"}];function Z4(e){return(e.status??"Active").trim().toLowerCase()==="active"}function U4(e,t){const n=t.toLowerCase();return Jr(e).toLowerCase().includes(n)||(e.email??"").toLowerCase().includes(n)||(e.idNumber??"").toLowerCase().includes(n)}function eo(){const{selectedEntity:e}=Kn(),t=Ie(),[n,s]=x.useState(""),[a,i]=x.useState(""),[o,l]=x.useState("all"),[c,d]=x.useState(ys),[u,h]=x.useState(1),[m,f]=x.useState(Ft),[p,g]=x.useState(null);x.useEffect(()=>{const E=window.setTimeout(()=>i(n.trim()),300);return()=>window.clearTimeout(E)},[n]),x.useEffect(()=>{h(1)},[a,o,c,m]);const{data:y=[],isLoading:C,isFetching:b,isError:j}=de({queryKey:["entities","mine"],queryFn:Pi}),N=x.useMemo(()=>y.filter(E=>a&&!U4(E,a)||o!=="all"&&Z4(E)!==(o==="active")?!1:c===ys||E.entityType===c),[y,a,o,c]),A=N.length,S=N.slice((u-1)*m,u*m),R=j?"Unable to load entities.":C?"Loading entities…":N.length===0?a?"No entities match your search.":c!==ys?`No ${c} entities${o==="all"?"":` that are ${o}`}.`:o==="all"?"No entities yet.":`No ${o} entities.`:null;return r.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"All Entities"}),r.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Manage tax payments and filings for each entity."})]}),r.jsx("button",{type:"button",onClick:()=>t("/create-entity/form",{state:{from:"/entities"}}),className:"inline-flex shrink-0 items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700",children:"Add Entity"})]}),p?r.jsx(Xu,{open:!0,entity:p,onClose:()=>g(null)}):null,r.jsxs("div",{className:"relative rounded-2xl border border-slate-200 bg-white p-6",children:[b?r.jsx(wr,{label:"Loading entities…"}):null,r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 border-b border-slate-200",children:[r.jsx("div",{className:"flex items-center gap-6",children:q4.map(E=>{const z=o===E.id;return r.jsx("button",{type:"button",onClick:()=>l(E.id),className:`-mb-px border-b-2 pb-3 text-sm transition ${z?"border-gov-600 font-semibold text-gov-600":"border-transparent text-slate-600 hover:text-slate-900"}`,children:E.label},E.id)})}),r.jsxs("div",{className:"flex items-center gap-2 pb-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400",children:r.jsx(B4,{})}),r.jsx("input",{type:"search",value:n,onChange:E=>s(E.target.value),placeholder:"Search","aria-label":"Search entities by name, email or EIN",className:"h-10 w-full rounded-lg border border-slate-200 bg-white pl-9 pr-3 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 sm:w-64"})]}),r.jsx(D4,{value:c,onChange:d})]})]}),R?r.jsx("p",{className:"py-16 text-center text-sm text-slate-500",children:R}):r.jsx("div",{className:"mt-6 grid gap-5 sm:grid-cols-2 xl:grid-cols-3",children:S.map(E=>r.jsx(E4,{entity:E,selected:E.entityId===(e==null?void 0:e.entityId),onEdit:g},E.entityId))}),A>m?r.jsx($r,{page:u,pageSize:m,totalCount:A,onPageChange:h,onPageSizeChange:f,disabled:C||b}):null]})]})}function B4(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-4.35-4.35M17 10.5a6.5 6.5 0 11-13 0 6.5 6.5 0 0113 0z"})})}function to(e){return fe(`/portal/federal-payments/${e}`)}function W4(e){return fe(`/portal/federal-payments/form-types?entityId=${e}`)}function Y4(e){const t=new URLSearchParams({formType:e});return fe(`/portal/federal-payments/tax-type-codes?${t.toString()}`)}function no(e){return fe("/portal/federal-payments",{method:"POST",body:e})}function ro(e,t){return fe(`/portal/federal-payments/${e}`,{method:"PATCH",body:t})}function H4(e){return fe(`/portal/federal-payments/${e}/submit`,{method:"POST"})}function K4(e){return Gr(`/portal/federal-payments/${e}/pdf`,{responseType:"blob"})}function Q4(e){return Gr(`/portal/state-payments/${e}/pdf`,{responseType:"blob"})}function G4(e){return Gr(`/portal/federal-payments/${e}/pdf-html`,{responseType:"text"})}function J4(e){return Gr(`/portal/state-payments/${e}/pdf-html`,{responseType:"text"})}function Rl({entityId:e,status:t,category:n="all",pageNumber:s=1,pageSize:a=Ft}){const i=new URLSearchParams({entityId:String(e),pageNumber:String(s),pageSize:String(a)});return t&&i.set("status",t),n&&n!=="all"?i.set("category",n):n==="all"&&i.set("category","all"),fe(`/portal/remittance-payments?${i}`)}function X4(e,t="all"){const n=new URLSearchParams({entityId:String(e)});return t&&n.set("category",t),fe(`/portal/remittance-payments/status-counts?${n}`)}function _u(e){return fe("/portal/state-payments/states",{signal:e})}function so(e,t,n){const s=new URLSearchParams({entityId:String(e),state:t});return fe(`/portal/state-payments/payment-reasons?${s}`,{signal:n})}function $u(e,t,n,s){const a=new URLSearchParams({entityId:String(e),state:t,reason:n});return fe(`/portal/state-payments/validation-metadata?${a}`,{signal:s})}function _4(e,t,n,s){const a=new URLSearchParams({entityId:String(e),state:t,reason:n});return fe(`/portal/state-payments/form-references?${a}`,{signal:s})}function ed(e){return fe(`/portal/state-payments/${e}`)}function $4(e){return fe("/portal/state-payments",{method:"POST",body:e})}function e9(e,t){return fe(`/portal/state-payments/${e}`,{method:"PATCH",body:t})}function t9(e){return fe(`/portal/state-payments/${e}/submit`,{method:"POST"})}function n9({open:e,title:t,html:n,isLoading:s=!1,error:a=null,downloadFileName:i="payment.pdf",onDownload:o,onClose:l}){const[c,d]=x.useState(!1);x.useEffect(()=>{if(!e)return;const h=m=>{m.key==="Escape"&&l()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,l]);const u=async()=>{if(!(!o||c)){d(!0);try{const h=await o(),m=URL.createObjectURL(h),f=document.createElement("a");f.href=m,f.download=i,document.body.appendChild(f),f.click(),document.body.removeChild(f),setTimeout(()=>URL.revokeObjectURL(m),1e3)}finally{d(!1)}}};return e?r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[r.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:l}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"payment-pdf-title",className:"relative flex h-[90vh] w-full max-w-5xl flex-col overflow-hidden rounded-2xl bg-white shadow-xl",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-200 px-5 py-4",children:[r.jsx("h2",{id:"payment-pdf-title",className:"text-base font-semibold text-slate-900",children:t}),r.jsxs("div",{className:"flex items-center gap-2",children:[o?r.jsx("button",{type:"button",onClick:()=>void u(),disabled:c||s||!!a,className:"rounded-lg border border-gov-200 bg-gov-50 px-3 py-1.5 text-sm font-medium text-gov-600 hover:bg-gov-100 disabled:opacity-60",children:c?"Downloading…":"Download"}):null,r.jsx("button",{type:"button",onClick:l,className:"rounded-lg border border-slate-200 px-3 py-1.5 text-sm font-medium text-slate-600 hover:bg-slate-50",children:"Close"})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden bg-white",children:s?r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-slate-500",children:"Loading…"}):a?r.jsx("div",{className:"flex h-full items-center justify-center px-6 text-center text-sm text-red-600",children:a}):n?r.jsx("iframe",{title:t,srcDoc:n,sandbox:"",className:"h-full w-full border-0 bg-white"}):r.jsx("div",{className:"flex h-full items-center justify-center text-sm text-slate-500",children:"No content available."})})]})]}):null}function r9({onClick:e,disabled:t=!1,children:n}){return r.jsx("button",{type:"button",onClick:e,disabled:t,className:"rounded-md border border-gov-200 bg-white px-3 py-1.5 text-xs font-medium text-gov-600 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-60",children:n})}function ja({onView:e,onEdit:t,button:n}){return r.jsxs("div",{className:"flex items-center gap-3",children:[e?r.jsx("button",{type:"button",onClick:e,"aria-label":"View payment",title:"View",className:"text-slate-400 transition hover:text-slate-600",children:r.jsx(Bi,{})}):null,t?r.jsx("button",{type:"button",onClick:t,"aria-label":"Edit payment",title:"Edit",className:"text-slate-400 transition hover:text-slate-600",children:r.jsx(s9,{})}):null,n?r.jsx(r9,{onClick:n.onClick,disabled:n.disabled,children:n.label}):null]})}function s9(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zM19.5 15v4.125A1.875 1.875 0 0117.625 21H4.875A1.875 1.875 0 013 19.125V6.375A1.875 1.875 0 014.875 4.5H9"})})}function a9(e){const{actionType:t,onView:n,onViewPdf:s,onEdit:a,onSubmit:i,onResubmit:o}=e,l={label:e.isViewPdfLoading?"Loading PDF…":"View PDF",onSelect:s,disabled:e.isViewPdfLoading};return t==="draft-actions"?[{label:"View",onSelect:n},{label:"Edit",onSelect:a},{label:e.isSubmitting?"Submitting…":"Submit",onSelect:i,disabled:e.isSubmitting}]:t==="view-pdf"?[l]:t==="rejected-actions"?[{label:"View",onSelect:n},l,{label:"Re-Submit",onSelect:o,tone:"danger"}]:[{label:"View",onSelect:n},l]}function i9(e){const[t,n]=x.useState(!1),s=x.useRef(null);x.useEffect(()=>{if(!t)return;const i=l=>{var c;(c=s.current)!=null&&c.contains(l.target)||n(!1)},o=l=>{l.key==="Escape"&&n(!1)};return document.addEventListener("mousedown",i),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",o)}},[t]);const a=a9(e);return r.jsxs("div",{ref:s,className:"relative flex justify-end",children:[r.jsx("button",{type:"button",onClick:()=>n(i=>!i),"aria-label":"Payment actions","aria-haspopup":"menu","aria-expanded":t,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-600",children:r.jsx(o9,{})}),t?r.jsx("div",{role:"menu",className:"absolute top-9 right-0 z-20 min-w-[152px] overflow-hidden rounded-lg border border-slate-200 bg-white py-1 shadow-lg",children:a.map(i=>r.jsx("button",{type:"button",role:"menuitem",disabled:i.disabled,onClick:()=>{var o;n(!1),(o=i.onSelect)==null||o.call(i)},className:`block w-full px-4 py-2 text-left text-sm transition disabled:cursor-not-allowed disabled:opacity-60 ${i.tone==="danger"?"text-red-600 hover:bg-red-50":"text-slate-700 hover:bg-slate-50"}`,children:i.label},i.label))}):null]})}function o9(){return r.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"10",cy:"4.5",r:"1.5"}),r.jsx("circle",{cx:"10",cy:"10",r:"1.5"}),r.jsx("circle",{cx:"10",cy:"15.5",r:"1.5"})]})}const l9={drafts:"bg-slate-100 text-slate-600",scheduled:"bg-amber-50 text-amber-700",submitted:"bg-orange-50 text-orange-700",rejected:"bg-red-50 text-red-600",paid:"bg-emerald-50 text-emerald-700"};function c9(e,t){switch(e){case"drafts":return"Draft";case"scheduled":return"Scheduled";case"submitted":return t==="federal"?"Submitted to Federal":"Submitted to State";case"rejected":return"Failed";case"paid":return"Paid"}}function u9({status:e,category:t}){const n=Ku(e);return r.jsx("span",{className:`inline-flex rounded-full px-2.5 py-1 text-xs font-medium ${l9[n]}`,children:c9(n,t)})}function d9({className:e,...t}){return r.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[r.jsx("path",{d:"M9.375 1.25H3.75C3.41848 1.25 3.10054 1.3817 2.86612 1.61612C2.6317 1.85054 2.5 2.16848 2.5 2.5V12.5C2.5 12.8315 2.6317 13.1495 2.86612 13.3839C3.10054 13.6183 3.41848 13.75 3.75 13.75H11.25C11.5815 13.75 11.8995 13.6183 12.1339 13.3839C12.3683 13.1495 12.5 12.8315 12.5 12.5V4.375L9.375 1.25Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M8.75 1.25V3.75C8.75 4.08152 8.8817 4.39946 9.11612 4.63388C9.35054 4.8683 9.66848 5 10 5H12.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M6.25 5.625H5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M10 8.125H5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M10 10.625H5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function m9({className:e,...t}){return r.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[r.jsxs("g",{clipPath:"url(#scheduled-tab-icon-clip)",children:[r.jsx("path",{d:"M7.5 13.75C10.9518 13.75 13.75 10.9518 13.75 7.5C13.75 4.04822 10.9518 1.25 7.5 1.25C4.04822 1.25 1.25 4.04822 1.25 7.5C1.25 10.9518 4.04822 13.75 7.5 13.75Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M7.5 3.75V7.5L10 8.75",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),r.jsx("defs",{children:r.jsx("clipPath",{id:"scheduled-tab-icon-clip",children:r.jsx("rect",{width:"15",height:"15",fill:"white"})})})]})}function h9({className:e,...t}){return r.jsx("svg",{width:"12",height:"10",viewBox:"0 0 12 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:r.jsx("path",{d:"M0 10V0L11.875 5L0 10ZM1.25 8.125L8.65625 5L1.25 1.875V4.0625L5 5L1.25 5.9375V8.125Z",fill:"currentColor"})})}function f9({className:e,...t}){return r.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[r.jsxs("g",{clipPath:"url(#rejected-tab-icon-clip)",children:[r.jsx("path",{d:"M7.5 13.75C10.9518 13.75 13.75 10.9518 13.75 7.5C13.75 4.04822 10.9518 1.25 7.5 1.25C4.04822 1.25 1.25 4.04822 1.25 7.5C1.25 10.9518 4.04822 13.75 7.5 13.75Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M7.5 5V7.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M7.5 10H7.50625",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),r.jsx("defs",{children:r.jsx("clipPath",{id:"rejected-tab-icon-clip",children:r.jsx("rect",{width:"15",height:"15",fill:"white"})})})]})}function p9({className:e,...t}){return r.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":!0,...t,children:[r.jsxs("g",{clipPath:"url(#paid-tab-icon-clip)",children:[r.jsx("path",{d:"M7.5 13.75C10.9518 13.75 13.75 10.9518 13.75 7.5C13.75 4.04822 10.9518 1.25 7.5 1.25C4.04822 1.25 1.25 4.04822 1.25 7.5C1.25 10.9518 4.04822 13.75 7.5 13.75Z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),r.jsx("path",{d:"M5.625 7.5L6.875 8.75L9.375 6.25",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),r.jsx("defs",{children:r.jsx("clipPath",{id:"paid-tab-icon-clip",children:r.jsx("rect",{width:"15",height:"15",fill:"white"})})})]})}const td=[{key:"all",label:"All"},{key:"drafts",label:"Draft",Icon:d9,iconClassName:"text-gray-500"},{key:"scheduled",label:"Scheduled",Icon:m9,iconClassName:"text-yellow-500"},{key:"submitted",label:"Submitted to Fed/State",Icon:h9,iconClassName:"text-[#FF733D]"},{key:"rejected",label:"Rejected",Icon:f9,iconClassName:"text-red-500"},{key:"paid",label:"Paid",Icon:p9,iconClassName:"text-green-500"}],x9={all:"default",drafts:"draft",scheduled:"view-action",submitted:"view-action",rejected:"rejected",paid:"view-action"},Dl=["Jurisdiction / Type","Period","Amount","Payment Date","Status","Form Type"],g9={default:Dl,"view-action":[...Dl,"Actions"],draft:["ID","Jurisdiction / Type","Period","Amount","Payment Date","Form Type","Actions"],rejected:["ID","Jurisdiction / Type","Period","Amount","Form Type","Rejected Date","Reason for Reject","Actions"]},y9={all:"No payments to display yet.",drafts:"No draft payments to display yet.",scheduled:"No scheduled payments to display yet.",submitted:"No submitted to fed/state payments to display yet.",rejected:"No rejected payments to display yet.",paid:"No paid payments to display yet."},b9={drafts:"draft-actions",scheduled:"view-pdf",submitted:"view-link",rejected:"rejected-actions",paid:"view-link"},an="px-6 py-4 text-slate-700";function v9(e){return e.referenceNo==="—"?`#${e.id}`:e.referenceNo}function C9({row:e,layout:t,isSubmitting:n,isViewPdfLoading:s,onView:a,onEdit:i,onViewPdf:o,onSubmit:l}){const c=t==="draft"||t==="rejected";return r.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[c?r.jsx("td",{className:an,children:v9(e)}):null,r.jsx("td",{className:an,children:e.jurisdiction}),r.jsx("td",{className:an,children:e.period}),r.jsx("td",{className:"px-6 py-4 font-semibold text-slate-900",children:Nr(e.amount)}),t==="rejected"?r.jsxs(r.Fragment,{children:[r.jsx("td",{className:an,children:e.formType}),r.jsx("td",{className:an,children:e.paymentDate}),r.jsx("td",{className:an,children:e.reason??"—"})]}):r.jsxs(r.Fragment,{children:[r.jsx("td",{className:an,children:e.paymentDate}),t==="draft"?null:r.jsx("td",{className:"px-6 py-4",children:r.jsx(u9,{status:e.status,category:e.category})}),r.jsx("td",{className:an,children:e.formType})]}),r.jsx("td",{className:"px-6 py-4",children:t==="draft"?r.jsx(ja,{onView:a,onEdit:i,button:{label:n?"Submitting…":"Submit & Pay",onClick:l,disabled:n}}):t==="rejected"?r.jsx(ja,{onView:a,button:{label:"Re-Submit",onClick:i}}):t==="view-action"?r.jsx(ja,{button:{label:"View",onClick:a}}):r.jsx(i9,{actionType:b9[e.tab],onView:a,onViewPdf:o,onEdit:i,onSubmit:l,onResubmit:i,isSubmitting:n,isViewPdfLoading:s})})]})}function j9(e){return[e.jurisdiction,e.formType,`Tax ${e.period}`].filter(t=>t&&t!=="—").join(" · ")}function w9({rows:e,onViewAll:t,onView:n,onResubmit:s}){const[a,i]=x.useState(0);if(x.useEffect(()=>{i(c=>c<e.length?c:0)},[e.length]),e.length===0)return null;const o=e[Math.min(a,e.length-1)],l=c=>i(d=>(d+c+e.length)%e.length);return r.jsxs("section",{className:"rounded-2xl border border-slate-200 bg-white p-4 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-slate-900",children:[r.jsx(N9,{}),"Need Attention"]}),r.jsx("button",{type:"button",onClick:t,className:"text-xs font-medium text-gov-600 transition hover:text-gov-700",children:"View All"})]}),r.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r.jsx(Ml,{direction:"previous",disabled:e.length<2,onClick:()=>l(-1)}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-between gap-3 rounded-lg border border-red-200 bg-red-50 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("p",{className:"text-sm font-semibold text-slate-900",children:[Nr(o.amount)," Payment Rejected"]}),r.jsx("p",{className:"mt-0.5 truncate text-xs text-slate-500",children:j9(o)})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>n(o),className:"rounded-md border border-gov-200 bg-white px-3 py-1.5 text-xs font-medium text-gov-600 transition hover:bg-gov-50",children:"View"}),r.jsx("button",{type:"button",onClick:()=>s(o),className:"rounded-md bg-red-500 px-3 py-1.5 text-xs font-semibold text-white transition hover:bg-red-600",children:"Re-Submit"})]})]}),r.jsx(Ml,{direction:"next",disabled:e.length<2,onClick:()=>l(1)})]}),e.length>1?r.jsx("div",{className:"mt-3 flex items-center justify-center gap-1.5",children:e.map((c,d)=>r.jsx("button",{type:"button","aria-label":`Show rejected payment ${d+1}`,"aria-current":d===a,onClick:()=>i(d),className:`h-1.5 rounded-full transition-all ${d===a?"w-5 bg-gov-600":"w-1.5 bg-slate-300 hover:bg-slate-400"}`},`${c.category}-${c.id}`))}):null]})}function Ml({direction:e,disabled:t,onClick:n}){return r.jsx("button",{type:"button",onClick:n,disabled:t,"aria-label":e==="previous"?"Previous payment":"Next payment",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-400 transition hover:bg-slate-50 hover:text-slate-600 disabled:cursor-not-allowed disabled:opacity-50",children:r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:e==="previous"?"M15 19.5L7.5 12l7.5-7.5":"M9 4.5l7.5 7.5L9 19.5"})})})}function N9(){return r.jsx("span",{className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-red-500 text-white",children:r.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M10 5a1 1 0 011 1v5a1 1 0 01-2 0V6a1 1 0 011-1zm0 8.25a1.15 1.15 0 110 2.3 1.15 1.15 0 010-2.3z"})})})}function S9(e){if(!(e!=null&&e.trim()))return"—";const t=/^(\d{4})-Q([1-4])$/.exec(e);if(t)return`Q${t[2]} ${t[1]}`;if(/^(Q[1-4]|ANNUAL|MONTHLY|ACCOUNT_ASSIGNED)$/i.test(e))return e.toUpperCase()==="ACCOUNT_ASSIGNED"?"Assigned schedule":e.toUpperCase();if(e.length!==6)return e;const n=e.slice(0,4),s=Number.parseInt(e.slice(4,6),10);return Number.isNaN(s)||s<1||s>12?e:`Q${Math.ceil(s/3)} ${n}`}function Ol(e){var t;return{id:e.id,category:e.category,referenceNo:e.referenceNumber??"—",jurisdiction:e.jurisdiction,period:S9(e.taxPeriod),amount:e.amount,paymentDate:e.paymentDate,status:e.status,reason:e.reason,formType:((t=e.formType)==null?void 0:t.trim())||"—",tab:Ku(e.status)}}const k9=5;function zl(e){return e!==null&&td.some(t=>t.key===e)}function ao({paymentsMode:e="all"}){var Se;const t=Ie(),n=At(),[s]=A0(),{selectedEntity:a}=ht(),{onPaymentRequired:i}=Kn(),o=(a==null?void 0:a.entityId)??null,l=s.get("tab"),[c,d]=x.useState(zl(l)?l:Q6),[u,h]=x.useState(e==="all"?"all":e),m=e!=="all"?e:u,[f,p]=x.useState(1),[g,y]=x.useState(Ft),[C,b]=x.useState(null),[j,N]=x.useState(null),[A,S]=x.useState(null);x.useEffect(()=>{zl(l)&&d(l)},[l]),x.useEffect(()=>{p(1),y(Ft)},[c,o,u]),x.useEffect(()=>{p(1)},[g]);const R=de({queryKey:["remittance-payments","list",o,c,m,f,g],queryFn:()=>Rl({entityId:o,status:c==="all"?void 0:c,category:m,pageNumber:f,pageSize:g}),enabled:o!==null,placeholderData:U=>U}),E=de({queryKey:["remittance-payments","need-attention",o,m],queryFn:()=>Rl({entityId:o,status:"rejected",category:m,pageNumber:1,pageSize:k9}),enabled:o!==null}),z=de({queryKey:["remittance-payments","status-counts",o,m],queryFn:()=>X4(o,m),enabled:o!==null}),X=R.isLoading,H=R.isFetching,_=o!==null&&H,V=x.useMemo(()=>{var me,Q,pe,Ue,$e;const U={drafts:((me=z.data)==null?void 0:me.drafts)??0,scheduled:((Q=z.data)==null?void 0:Q.scheduled)??0,submitted:((pe=z.data)==null?void 0:pe.submitted)??0,rejected:((Ue=z.data)==null?void 0:Ue.rejected)??0,paid:(($e=z.data)==null?void 0:$e.paid)??0};return{...U,all:Object.values(U).reduce((Be,ct)=>Be+ct,0)}},[z.data]),q=x.useMemo(()=>{var U;return(((U=R.data)==null?void 0:U.items)??[]).map(Ol)},[R.data]),B=x.useMemo(()=>{var U;return(((U=E.data)==null?void 0:U.items)??[]).map(Ol)},[E.data]),ee=((Se=R.data)==null?void 0:Se.totalCount)??0,W=g1({mutationFn:async U=>{try{U.category==="federal"?await H4(U.id):await t9(U.id)}catch(me){if(me instanceof vr&&me.status===402&&i){const Q=me.extensions,pe={paymentType:(Q==null?void 0:Q.paymentType)??U.category,paymentId:(Q==null?void 0:Q.paymentId)??U.id,expectedAmount:(Q==null?void 0:Q.expectedAmount)??"0.00",currency:(Q==null?void 0:Q.currency)??"USD",federalRecordCount:(Q==null?void 0:Q.federalRecordCount)??0,stateRecordCount:(Q==null?void 0:Q.stateRecordCount)??0,feePerFederal:(Q==null?void 0:Q.feePerFederal)??null,feePerState:(Q==null?void 0:Q.feePerState)??null};i(pe);return}throw me}},onSuccess:async()=>{await n.invalidateQueries({queryKey:["remittance-payments"]}),await n.invalidateQueries({queryKey:["dashboard"]}),await n.invalidateQueries({queryKey:["federal-payments"]}),await n.invalidateQueries({queryKey:["state-payments"]})},onError:()=>b(null),onSettled:()=>b(null)});x.useEffect(()=>{const U=async()=>{await n.invalidateQueries({queryKey:["remittance-payments"]}),await n.invalidateQueries({queryKey:["dashboard"]}),await n.invalidateQueries({queryKey:["federal-payments"]}),await n.invalidateQueries({queryKey:["state-payments"]})};return window.addEventListener(fi,U),()=>window.removeEventListener(fi,U)},[n]);const ue=U=>{b(`${U.category}-${U.id}`),W.mutate(U)},we=U=>{U.category==="federal"?t(`/payments/federal/${U.id}/view`):t(`/payments/state/${U.id}/view`)},Re=U=>{U.category==="federal"?t(`/payments/federal/${U.id}/edit`):t(`/payments/state/${U.id}/edit`)},Ce=async U=>{const me=`${U.category}-${U.id}`,Q=`payment-${U.referenceNo}.pdf`;N(me),S({title:`Payment PDF — ${U.referenceNo}`,html:null,category:U.category,paymentId:U.id,downloadFileName:Q,isLoading:!0,error:null});try{const pe=U.category==="federal"?await G4(U.id):await J4(U.id);S({title:`Payment PDF — ${U.referenceNo}`,html:pe,category:U.category,paymentId:U.id,downloadFileName:Q,isLoading:!1,error:null})}catch(pe){S({title:`Payment PDF — ${U.referenceNo}`,html:null,category:U.category,paymentId:U.id,downloadFileName:Q,isLoading:!1,error:rt(pe,"Unable to load payment PDF.")})}finally{N(null)}},Oe=async()=>{if(!A)throw new Error("No payment selected");return A.category==="federal"?K4(A.paymentId):Q4(A.paymentId)},Ne=()=>S(null),ve=x9[c],Pe=g9[ve],ne=ve==="default"?Pe.length+1:Pe.length;return r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:"Tax Payments"}),r.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"View, file, and track every tax payment in one place"})]}),r.jsxs("div",{className:"flex flex-wrap gap-3",children:[e!=="state"&&r.jsx("button",{type:"button",onClick:()=>t("/payments/federal/new",{state:{from:"/payments",resetDraft:!0}}),className:"inline-flex items-center rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700",children:"Add Federal Payment"}),e!=="federal"&&r.jsx("button",{type:"button",onClick:()=>t("/payments/state/new",{state:{from:"/payments",resetDraft:!0}}),className:"inline-flex items-center rounded-lg border border-gov-600 bg-white px-4 py-2.5 text-sm font-semibold text-gov-600 transition hover:bg-gov-50",children:"Add State Payment"}),e==="all"&&r.jsx("button",{type:"button",disabled:!0,title:"Coming soon",className:"inline-flex cursor-not-allowed items-center rounded-lg border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-semibold text-slate-400",children:"Add Local Payment"})]})]}),r.jsx(w9,{rows:B,onViewAll:()=>{d("rejected"),t(qr("rejected"),{replace:!0})},onView:we,onResubmit:Re}),r.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:[_?r.jsx(wr,{label:"Loading payments…"}):null,r.jsx("div",{className:"flex flex-wrap gap-1 border-b border-slate-200 px-4 pt-4",children:td.map(U=>{const me=c===U.key,Q=U.Icon;return r.jsxs("button",{type:"button",onClick:()=>{d(U.key),t(qr(U.key),{replace:!0})},className:`mb-[-1px] flex items-center gap-2 border-b-2 px-4 py-3 text-sm font-medium transition ${me?"border-gov-600 text-gov-600":"border-transparent text-slate-500 hover:text-slate-700"}`,children:[Q?r.jsx(Q,{className:`shrink-0 ${U.iconClassName??""}`}):null,U.label," (",V[U.key],")"]},U.key)})}),r.jsxs("div",{className:"border-b border-slate-200 px-6 py-4",children:[r.jsx("label",{className:"mb-1.5 block text-sm text-slate-600",children:"Select Payment Type"}),r.jsxs("select",{value:u,onChange:U=>h(U.target.value),disabled:e!=="all",className:"w-full max-w-xs rounded-lg border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:opacity-60",children:[r.jsx("option",{value:"all",children:"All"}),r.jsx("option",{value:"federal",children:"Federal"}),r.jsx("option",{value:"state",children:"State"}),r.jsx("option",{value:"local",disabled:!0,children:"Local (Coming Soon)"})]})]}),r.jsx("div",{className:"overflow-x-auto px-4 pt-4",children:r.jsxs("table",{className:"w-full min-w-[860px] overflow-hidden rounded-xl border border-slate-200 text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-slate-200 bg-slate-50/80 text-sm font-medium text-slate-500",children:[Pe.map(U=>r.jsx("th",{className:"px-6 py-3 font-medium",children:U},U)),ve==="default"?r.jsx("th",{className:"px-6 py-3",children:r.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),r.jsx("tbody",{children:X&&!R.data?r.jsx("tr",{children:r.jsx("td",{colSpan:ne,className:"px-6 py-12 text-center text-slate-500",children:"Loading payments…"})}):q.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:ne,className:"px-6 py-12 text-center text-slate-500",children:y9[c]})}):q.map(U=>r.jsx(C9,{row:U,layout:ve,isSubmitting:C===`${U.category}-${U.id}`,isViewPdfLoading:j===`${U.category}-${U.id}`,onView:()=>we(U),onEdit:()=>Re(U),onViewPdf:()=>Ce(U),onSubmit:()=>ue(U)},`${U.category}-${U.id}`))})]})}),r.jsx($r,{page:f,pageSize:g,totalCount:ee,onPageChange:p,onPageSizeChange:y,disabled:X||o===null||H})]}),r.jsx(n9,{open:A!==null,title:(A==null?void 0:A.title)??"Payment PDF",html:(A==null?void 0:A.html)??null,downloadFileName:A==null?void 0:A.downloadFileName,isLoading:(A==null?void 0:A.isLoading)??!1,error:(A==null?void 0:A.error)??null,onDownload:A&&!A.error?Oe:void 0,onClose:Ne})]})}function bn({title:e,children:t,isFirst:n=!1,headerAction:s}){return r.jsxs("section",{className:n?"":"mt-8 border-t border-slate-100 pt-8",children:[r.jsxs("div",{className:"mb-5 flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"text-base font-semibold text-gov-600",children:e}),s]}),t]})}function Fs(){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"15",viewBox:"0 0 14 15",fill:"none",children:r.jsx("path",{d:"M2.23556 11.5817V5.95669H3.36056V11.5817H2.23556ZM6.36056 11.5817V5.95669H7.48556V11.5817H6.36056ZM0 14.2067V13.0817H13.8461V14.2067H0ZM10.4856 11.5817V5.95669H11.6106V11.5817H10.4856ZM0 4.45669V3.38944L6.92306 0L13.8461 3.38944V4.45669H0ZM2.6595 3.33169H11.1866L6.92306 1.26919L2.6595 3.33169Z",fill:"#185BA5"})})}function nd({open:e,title:t,onClose:n,children:s,footer:a,labelledById:i="side-drawer-title",closeOnEscape:o=!0}){return x.useEffect(()=>{if(!e)return;const l=c=>{c.key==="Escape"&&o&&n()};return document.addEventListener("keydown",l),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",l),document.body.style.overflow=""}},[e,n,o]),e?jn.createPortal(r.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",children:[r.jsx("button",{type:"button","aria-label":"Close panel",className:"absolute inset-0 bg-slate-900/40",onClick:n}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":i,className:"relative z-10 flex h-full w-full max-w-[640px] flex-col bg-white shadow-xl",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-slate-200 px-6 py-4",children:[r.jsx("h2",{id:i,className:"text-lg font-semibold text-slate-900",children:t}),r.jsx("button",{type:"button","aria-label":"Close panel",onClick:n,className:"rounded-lg p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600",children:r.jsx(A9,{})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:s}),a?r.jsx("div",{className:"flex flex-wrap items-center justify-end gap-3 border-t border-slate-200 px-6 py-4",children:a}):null]})]}),document.body):null}function A9(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}const Rs=17,P9=9;function bs(e,t){return e.replace(/\D/g,"").slice(0,t)}const rd=["Checking","Savings"],I9=Gt({accountNumber:F().min(1,"Account number is required").regex(/^\d{1,17}$/,`Account number must be 1 to ${Rs} digits`),confirmAccountNumber:F().regex(/^\d{0,17}$/,`Account number must be 1 to ${Rs} digits`),routingNumber:F().min(1,"Routing number is required").regex(/^\d{9}$/,"Routing number must be exactly 9 digits"),accountType:qi(rd,{message:"Account type is required"}),bankName:F().min(1,"Account name is required")});function E9(e){return I9.superRefine((t,n)=>{if(e){if(!t.confirmAccountNumber){n.addIssue({code:"custom",path:["confirmAccountNumber"],message:"Please confirm the account number"});return}t.confirmAccountNumber!==t.accountNumber&&n.addIssue({code:"custom",path:["confirmAccountNumber"],message:"Account numbers do not match"})}})}const Vl={accountNumber:"",confirmAccountNumber:"",routingNumber:"",accountType:"Checking",bankName:""};function T9(e){return{accountNumber:e.accountNumber,confirmAccountNumber:e.accountNumber,routingNumber:e.routingNumber,accountType:e.accountType==="Savings"?"Savings":"Checking",bankName:e.bankName}}function Zr({open:e,entityId:t,account:n=null,onClose:s,onSaved:a}){const i=At(),{showSuccess:o,showError:l}=Ks(),[c,d]=x.useState(null),[u,h]=x.useState(!1),[m,f]=x.useState(!1),p=n!==null,g=x.useMemo(()=>E9(!p),[p]),{control:y,handleSubmit:C,reset:b,formState:{errors:j}}=Ut({resolver:Bt(g),defaultValues:Vl});x.useEffect(()=>{e&&(b(n?T9(n):Vl),f(!1),d(null))},[e,n,b]);const N=C(async A=>{if(t){d(null),h(!0);try{const S=n?await Ju(n.bankAccountDetailId,{bankName:A.bankName.trim(),accountNumber:A.accountNumber,routingNumber:A.routingNumber,accountType:A.accountType}):await v4({entityId:t,bankName:A.bankName.trim(),accountNumber:A.accountNumber,routingNumber:A.routingNumber,accountType:A.accountType});await i.invalidateQueries({queryKey:["bank-accounts",t]}),o(p?"Bank Account Updated":"Bank Account Added",p?"Bank account updated successfully.":"Bank account added successfully."),a==null||a(S.bankAccountDetailId),s()}catch(S){const R=rt(S,"Unable to save bank account.");d(R),l("Action Not Completed",R)}finally{h(!1)}}});return r.jsx(nd,{open:e,title:p?"Edit Bank Account":"Add Bank Account Manually",onClose:s,labelledById:"bank-account-drawer-title",footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:s,disabled:u,className:"inline-flex h-11 min-w-[110px] items-center justify-center rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50 disabled:opacity-60",children:"Cancel"}),r.jsx("button",{type:"button",onClick:()=>void N(),disabled:u||!t,className:"inline-flex h-11 min-w-[110px] items-center justify-center rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:u?"Saving…":"Save"})]}),children:r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"grid gap-x-6 gap-y-5 sm:grid-cols-2",children:[r.jsx(Ye,{name:"accountNumber",control:y,render:({field:A})=>{var S;return r.jsx(ce,{label:"Account Number",required:!0,placeholder:"Enter account number",inputMode:"numeric",autoComplete:"off",value:A.value,onChange:R=>A.onChange(bs(R.target.value,Rs)),onBlur:A.onBlur,error:(S=j.accountNumber)==null?void 0:S.message})}}),p?null:r.jsx(Ye,{name:"confirmAccountNumber",control:y,render:({field:A})=>{var S;return r.jsx(ce,{label:"Confirm Account Number",required:!0,placeholder:"Re-enter account number",inputMode:"numeric",autoComplete:"off",value:A.value,onChange:R=>A.onChange(bs(R.target.value,Rs)),onBlur:A.onBlur,error:(S=j.confirmAccountNumber)==null?void 0:S.message})}}),r.jsx(Ye,{name:"routingNumber",control:y,render:({field:A})=>{var S;return r.jsx(ce,{label:"Routing Number",required:!0,placeholder:"Enter routing number",inputMode:"numeric",autoComplete:"off",value:A.value,onChange:R=>A.onChange(bs(R.target.value,P9)),onBlur:A.onBlur,error:(S=j.routingNumber)==null?void 0:S.message})}}),r.jsx(Ye,{name:"accountType",control:y,render:({field:A})=>{var S;return r.jsx(lt,{label:"Account Type",required:!0,value:A.value,onChange:A.onChange,onBlur:A.onBlur,error:(S=j.accountType)==null?void 0:S.message,children:rd.map(R=>r.jsx("option",{value:R,children:R},R))})}})]}),r.jsx("div",{className:"grid gap-x-6 gap-y-5 sm:grid-cols-2",children:r.jsx(Ye,{name:"bankName",control:y,render:({field:A})=>{var S;return r.jsx(ce,{label:"Account Name",required:!0,placeholder:"Enter account name",value:A.value,onChange:A.onChange,onBlur:A.onBlur,error:(S=j.bankName)==null?void 0:S.message})}})}),p?null:r.jsxs("label",{className:"flex items-center gap-2 text-sm text-slate-600",children:[r.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-2 focus:ring-gov-200",checked:m,onChange:A=>f(A.target.checked)}),"Set As Primary Account"]}),c?r.jsx(Zt,{message:c}):null]})})}function io({open:e,onClose:t,onAddManually:n}){return x.useEffect(()=>{if(!e)return;const s=a=>{a.key==="Escape"&&t()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[e,t]),e?jn.createPortal(r.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[r.jsx("button",{type:"button","aria-label":"Close dialog",className:"absolute inset-0 bg-slate-900/40",onClick:t}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"bank-connection-method-title",className:"relative z-10 w-full max-w-[420px] rounded-2xl bg-white p-6 shadow-xl",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsx("h2",{id:"bank-connection-method-title",className:"text-lg font-semibold text-slate-900",children:"Connect Your Bank Account"}),r.jsx("button",{type:"button","aria-label":"Close dialog",onClick:t,className:"rounded-lg p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600",children:r.jsx(F9,{})})]}),r.jsxs("div",{className:"mt-5 space-y-3",children:[r.jsxs("div",{className:"relative rounded-xl border border-slate-200 bg-slate-50 p-4",children:[r.jsxs("span",{className:"absolute -top-2.5 right-4 inline-flex items-center gap-1 rounded-full border border-slate-200 bg-white px-2 py-0.5 text-[11px] font-semibold text-slate-500",children:[r.jsx(L9,{}),"Coming Soon"]}),r.jsx("p",{className:"text-sm font-semibold text-slate-400",children:"Connect with Plaid"}),r.jsx("p",{className:"mt-1 text-sm text-slate-400",children:"Securely sign in to your bank using Plaid."})]}),r.jsxs("button",{type:"button",onClick:n,className:"block w-full rounded-xl border border-slate-200 bg-white p-4 text-left transition hover:border-gov-300 hover:bg-gov-50/40",children:[r.jsx("p",{className:"text-sm font-semibold text-slate-900",children:"Add Manually"}),r.jsx("p",{className:"mt-1 text-sm text-slate-600",children:"Enter your bank account details yourself."}),r.jsxs("p",{className:"mt-2 text-xs italic text-slate-500",children:[r.jsx("span",{className:"font-semibold",children:"Note:"})," Payments will not be processed until the deposits are verified."]})]})]})]})]}),document.body):null}function L9(){return r.jsxs("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7.5V12l3 2"})]})}function F9(){return r.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}const R9=12,D9=["January","February","March","April","May","June","July","August","September","October","November","December"];function vn(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${s}`}function Ds(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;const n=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10)-1,a=Number.parseInt(t[3],10),i=new Date(n,s,a);return i.getFullYear()!==n||i.getMonth()!==s||i.getDate()!==a?null:i}function sd(e=new Date){const t=new Date(e);return e.getHours()>=R9&&t.setDate(t.getDate()+1),t.setHours(0,0,0,0),vn(t)}function ad(e=new Date){const t=new Date(e);return t.setFullYear(t.getFullYear()+1),t.setHours(0,0,0,0),vn(t)}function M9(e=18,t=new Date){const n=new Date(t);return n.setFullYear(n.getFullYear()-e),n.setHours(0,0,0,0),vn(n)}function O9(e,t,n=new Date){const s=Ds(e);if(!s)return!1;const a=new Date(n);return a.setFullYear(a.getFullYear()-t),a.setHours(0,0,0,0),s.setHours(0,0,0,0),s<=a}function z9(e){const t=e.getDay();return t!==0&&t!==6}function li(e,t=new Date){if(!z9(e))return!1;const n=vn(e);return n>=sd(t)&&n<=ad(t)}function sa(e,t=new Date){const n=Ds(e);return n?li(n,t):!1}function V9(e,t){return`${D9[t]} ${e}`}function q9(e,t){const n=new Date(e,t,1),s=new Date(e,t+1,0).getDate(),a=n.getDay(),i=[];for(let o=0;o<a;o+=1)i.push(null);for(let o=1;o<=s;o+=1)i.push(new Date(e,t,o));return i}function ci(e){return`XXXX-${e.replace(/\D/g,"").slice(-4)||e.slice(-4)}`}function oo(e){const[t,n,s]=e.split("-");return!t||!n||!s?e:`${n}/${s}/${t}`}function Z9(e){const t=Number.parseFloat(e);return!e||Number.isNaN(t)?"—":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}).format(t)}function id({label:e,required:t=!1,htmlFor:n,info:s}){return r.jsxs("label",{htmlFor:n,className:"mb-1.5 flex items-center gap-1.5 text-sm text-slate-600",children:[r.jsxs("span",{children:[e,t?r.jsx("span",{className:"text-red-500",children:" *"}):null]}),s?r.jsxs("span",{className:"group relative inline-flex items-center",children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 cursor-help items-center justify-center rounded-full border border-slate-300 text-[10px] font-semibold leading-none text-slate-400","aria-label":s,role:"img",children:"i"}),r.jsx("span",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-20 mb-1.5 w-max max-w-xs -translate-x-1/2 rounded-md bg-slate-800 px-2.5 py-1.5 text-xs font-normal leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100",children:s})]}):null]})}function $({label:e,required:t,error:n,info:s,children:a}){return r.jsxs("div",{children:[r.jsx(id,{label:e,required:t,info:s}),a,n?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:n}):null]})}const od=e=>`block w-full rounded-lg border bg-white px-3 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 ${e?"border-red-300":"border-slate-200"}`;function ie(e,t=!1){return t?`block w-full cursor-default rounded-lg border bg-[#F9FAFB] px-3 py-2.5 text-sm text-slate-700 focus:outline-none ${e?"border-red-300":"border-[#E5E7EB]"}`:od(e)}function Nt(e){return`${od(e)} appearance-none`}function Tt({className:e}){return r.jsx("svg",{className:e??"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Lt({children:e}){return r.jsx("div",{className:"relative",children:e})}function ld({value:e,onChange:t,entityId:n,bankAccounts:s,isLoading:a=!1,disabled:i=!1,error:o,label:l="Bank Account Number",info:c}){const[d,u]=x.useState(!1),[h,m]=x.useState(!1),[f,p]=x.useState(!1),g=x.useRef(null),y=s.find(b=>String(b.bankAccountDetailId)===e);x.useEffect(()=>{if(!d)return;const b=j=>{var N;(N=g.current)!=null&&N.contains(j.target)||u(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[d]);const C=b=>{t(String(b)),p(!1),u(!1)};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:g,className:"relative",children:[r.jsx(id,{label:l,required:!0,info:c}),r.jsxs("button",{type:"button",disabled:i||!n,onClick:()=>u(b=>!b),className:`flex w-full items-center justify-between rounded-lg border bg-white px-3 py-2.5 text-left text-sm transition focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:cursor-not-allowed disabled:opacity-60 ${o?"border-red-300":"border-slate-200"}`,children:[r.jsx("span",{className:y?"text-slate-900":"text-slate-400",children:a?"Loading accounts…":y?`${y.bankName} · ${ci(y.accountNumber)}`:"Select bank"}),r.jsx(U9,{className:`shrink-0 text-slate-400 transition ${d?"rotate-180":""}`})]}),o?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:o}):null,d?r.jsxs("div",{className:"absolute left-0 right-0 z-20 mt-2 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-lg",children:[r.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:s.length===0?r.jsx("p",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No bank accounts yet."}):s.map(b=>{const j=String(b.bankAccountDetailId)===e;return r.jsxs("button",{type:"button",onClick:()=>{t(String(b.bankAccountDetailId)),u(!1)},className:`block w-full px-4 py-3 text-left transition hover:bg-slate-50 ${j?"bg-gov-50":""}`,children:[r.jsx("span",{className:"block truncate text-sm font-semibold text-slate-900",children:b.bankName}),r.jsx("span",{className:"mt-0.5 block truncate text-xs text-slate-400",children:ci(b.accountNumber)})]},b.bankAccountDetailId)})}),r.jsxs("button",{type:"button",onClick:()=>{u(!1),m(!0)},className:"flex w-full items-center justify-center gap-2 border-t border-slate-200 px-4 py-3 text-sm font-semibold text-gov-600 transition hover:bg-gov-50",children:[r.jsx(Fs,{}),"Add New Account"]})]}):null]}),r.jsx(io,{open:h,onClose:()=>m(!1),onAddManually:()=>{m(!1),p(!0)}}),r.jsx(Zr,{open:f,entityId:n,onClose:()=>p(!1),onSaved:C})]})}function U9({className:e=""}){return r.jsx("svg",{className:`h-4 w-4 ${e}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Sr({steps:e,current:t,completed:n,className:s=""}){const a=n??t-1;return r.jsx("ol",{className:`flex flex-wrap items-center gap-3 ${s}`,children:e.map((i,o)=>{const l=o+1,c=l<=a,d=l===t;return r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${c?"bg-gov-600 text-white":d?"border border-gov-500 bg-white text-gov-600":"bg-slate-100 text-slate-400"}`,children:c?r.jsx(B9,{}):String(l).padStart(2,"0")}),r.jsx("span",{className:c||d?"text-sm font-semibold text-gov-600":"text-sm text-slate-500",children:i}),l<e.length?r.jsx("span",{className:"hidden h-px w-10 bg-slate-200 sm:block"}):null]},i)})})}function B9(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"3",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})}const lo=["Payment & Bank Details","Address & Authorize","Review & Submit"],W9=[0,1,3,4,6,7,9,10],Y9=[0,1,2,3,4,5,6,7,8,9,10],H9=[0,1,2,3,4,5,6,8,9,10,11],K9=[0,1,2,3,4,5,6,7,9,10,11],Q9=["720","941"],G9=["706-GS (D)","706-GS (T)","926","940","943","944","945","1042","2438","3520","6069","8752","CT-1"],J9=["7200D"],X9=["8963"];function cd(e){return Q9.includes(e)?W9:G9.includes(e)?Y9:J9.includes(e)?H9:X9.includes(e)?K9:[]}function _9(e){return e.length!==6?"":`${e.slice(0,4)}-${e.slice(4,6)}`}function Ms(e){if(e.length!==6)return null;const t=Number.parseInt(e.slice(0,4),10),n=Number.parseInt(e.slice(4,6),10);return Number.isNaN(t)||Number.isNaN(n)||n<1||n>12?null:{year:t,month:n-1}}function $9(e,t){return`${e}${String(t+1).padStart(2,"0")}`}function ud(){const e=new Date().getFullYear();return{minYear:e-2,maxYear:e}}const Os={941:"94105",944:"94405","CT-1":"10005"},Er={socialSecurity:"Social Security",medicare:"Medicare",withheld:"Withheld",tier1:"Tier 1(FICA)",tier2:"Tier 2 (Industry)"},zs={regex:/^(?!0+(?:\.0+)?$)(?:100000000(?:\.00?)?|(?:\d{1,8}|\d{1,7}\d)(?:\.\d{1,2})?)$/,errorMessage:"Payment amount must be a number greater than 0, can include up to 2 decimal places, and must not exceed 100,000,000 (one hundred million)."};function co(e,t){return!e||!t?!1:Os[e]===t}function aa(e,t){return e==="CT-1"&&t===Os["CT-1"]}function ex(e,t){return e==="941"&&t===Os[941]||e==="944"&&t===Os[944]}function tx(e){return e==="CT-1"?{code1:Er.tier1,code2:Er.tier2,code3:""}:{code1:Er.socialSecurity,code2:Er.medicare,code3:Er.withheld}}function Vs(e){return zs.regex.test(e)}const nx=/^(?:\d{0,8}(?:\.\d{0,2})?|100000000(?:\.\d{0,2})?)$/,cs=1e8;function rx(e){if(!e)return"";let t="",n=!1;for(const c of e)c>="0"&&c<="9"?t+=c:c==="."&&!n&&(t+=c,n=!0);const s=t.indexOf(".");let a=s===-1?t:t.slice(0,s);const i=s===-1?"":t.slice(s+1,s+3),o=s!==-1&&t.endsWith(".");if(a.length>9&&(a=a.slice(0,9)),a.length===9&&a!=="100000000"&&(a=a.slice(0,8)),a.length>0&&!o&&i===""){const c=Number.parseInt(a,10);!Number.isNaN(c)&&c>cs&&(a=String(cs))}let l=s===-1?a:`${a}.${i}`;if(o&&(l=`${a}.`),nx.test(l)){if(!l.endsWith(".")&&l!==""){const c=Number.parseFloat(l);if(!Number.isNaN(c)&&c>cs)return String(cs)}return l}return""}function dd(e){return Vs(e)?Number.parseFloat(e):null}function sx(e,t,n,s){const a=[e,t];return s&&a.push(n),a.reduce((i,o)=>{const l=dd(o);return l===null?i:i+l},0)}function ax(e,t){return Math.abs(e-t)<.005}function ix(e,t,n,s,a){if(!co(e,t))return{subcategoryCode1:null,subcategoryCode2:null,subcategoryCode3:null};const i=aa(e,t);return{subcategoryCode1:n.trim()?"1":null,subcategoryCode2:s.trim()?"2":null,subcategoryCode3:!i&&a.trim()?"3":null}}const ox=["Su","Mo","Tu","We","Th","Fr","Sa"];function lx(){return r.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[r.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2",className:"stroke-gov-600",strokeWidth:"1.5"}),r.jsx("path",{d:"M3 9h18",className:"stroke-gov-600",strokeWidth:"1.5"}),r.jsx("path",{d:"M8 3v4M16 3v4",className:"stroke-gov-600",strokeWidth:"1.5",strokeLinecap:"round"}),r.jsx("circle",{cx:"12",cy:"15",r:"1.5",className:"fill-gov-600"})]})}function uo({value:e,onChange:t,disabled:n=!1,hasError:s=!1}){const a=Ds(e),i=sd(),o=ad(),[l,c]=x.useState(!1),[d,u]=x.useState(()=>a??Ds(i)??new Date),h=x.useRef(null),m=x.useId();x.useEffect(()=>{a&&u(a)},[e]),x.useEffect(()=>{if(!l)return;const C=b=>{var j;(j=h.current)!=null&&j.contains(b.target)||c(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]);const f=x.useMemo(()=>q9(d.getFullYear(),d.getMonth()),[d]),p=x.useMemo(()=>{const C=new Date(d.getFullYear(),d.getMonth()-1,1),b=new Date(C.getFullYear(),C.getMonth()+1,0);return vn(b)>=i},[d,i]),g=x.useMemo(()=>{const C=new Date(d.getFullYear(),d.getMonth()+1,1);return vn(C)<=o},[d,o]),y=C=>{li(C)&&(t(vn(C)),c(!1))};return r.jsxs("div",{ref:h,className:"relative",children:[r.jsxs("div",{className:`flex items-center gap-2 rounded-lg border bg-white px-3 py-2.5 transition ${s?"border-red-300":"border-slate-200 focus-within:border-gov-400 focus-within:ring-2 focus-within:ring-gov-200"} ${n?"cursor-not-allowed bg-[#F9FAFB] opacity-60":""}`,children:[r.jsx("input",{id:m,type:"text",readOnly:!0,disabled:n,value:e,placeholder:"YYYY-MM-DD",onClick:()=>!n&&c(C=>!C),className:"w-full cursor-pointer border-0 bg-transparent p-0 text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-0 disabled:cursor-not-allowed"}),r.jsx("button",{type:"button",disabled:n,onClick:()=>c(C=>!C),className:"shrink-0 rounded p-0.5 text-gov-600 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open settlement date picker",children:r.jsx(lx,{})})]}),l?r.jsxs("div",{className:"absolute left-0 top-[calc(100%+8px)] z-50 w-[300px] rounded-xl border border-slate-200 bg-white shadow-lg",children:[r.jsx("div",{className:"absolute -top-2 left-8 h-4 w-4 rotate-45 border-l border-t border-slate-200 bg-white"}),r.jsxs("div",{className:"flex items-center justify-between rounded-t-xl bg-slate-50 px-4 py-3",children:[r.jsx("button",{type:"button",disabled:!p,onClick:()=>u(C=>new Date(C.getFullYear(),C.getMonth()-1,1)),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Previous month",children:r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),r.jsx("span",{className:"text-sm font-semibold text-slate-900",children:V9(d.getFullYear(),d.getMonth())}),r.jsx("button",{type:"button",disabled:!g,onClick:()=>u(C=>new Date(C.getFullYear(),C.getMonth()+1,1)),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Next month",children:r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),r.jsx("div",{className:"grid grid-cols-7 gap-1 px-3 pt-2 text-center text-xs font-medium text-slate-500",children:ox.map(C=>r.jsx("div",{className:"py-1",children:C},C))}),r.jsx("div",{className:"grid grid-cols-7 gap-1 p-3 pt-1",children:f.map((C,b)=>{if(!C)return r.jsx("div",{},`empty-${b}`);const j=vn(C),N=e===j,A=!li(C);return r.jsx("button",{type:"button","aria-disabled":A,onClick:()=>y(C),className:`rounded-lg px-1 py-2 text-sm transition ${A?"cursor-not-allowed text-slate-300 hover:bg-sky-50":N?"bg-sky-100 font-semibold text-slate-900":"font-medium text-slate-800 hover:bg-slate-50"}`,children:C.getDate()},j)})})]}):null]})}function _n({value:e,onChange:t,onBlur:n,name:s,disabled:a=!1,readOnly:i=!1,placeholder:o="0.00",hasError:l=!1}){return r.jsx("input",{type:"text",inputMode:"decimal",autoComplete:"off",name:s,value:e,disabled:a,readOnly:i,placeholder:o,className:ie(l,i),onChange:c=>t(rx(c.target.value)),onBlur:n})}const cx=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ux(){return r.jsxs("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[r.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2",className:"stroke-gov-600",strokeWidth:"1.5"}),r.jsx("path",{d:"M3 9h18",className:"stroke-gov-600",strokeWidth:"1.5"}),r.jsx("path",{d:"M8 3v4M16 3v4",className:"stroke-gov-600",strokeWidth:"1.5",strokeLinecap:"round"}),r.jsx("circle",{cx:"12",cy:"15",r:"1.5",className:"fill-gov-600"})]})}function dx({value:e,onChange:t,disabled:n=!1,hasError:s=!1,disabledMonths:a=[]}){const{minYear:i,maxYear:o}=ud(),l=Ms(e),[c,d]=x.useState(!1),[u,h]=x.useState((l==null?void 0:l.year)??o),m=x.useRef(null),f=x.useId();x.useEffect(()=>{l&&h(l.year)},[e]),x.useEffect(()=>{if(!c)return;const j=N=>{var A;(A=m.current)!=null&&A.contains(N.target)||d(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[c]);const p=_9(e),g=j=>!!a.includes(j),y=j=>{g(j)||(t($9(u,j)),d(!1))},C=u>i,b=u<o;return r.jsxs("div",{ref:m,className:"relative",children:[r.jsxs("div",{className:`flex items-center gap-2 rounded-lg border bg-white px-3 py-2.5 transition ${s?"border-red-300":"border-slate-200 focus-within:border-gov-400 focus-within:ring-2 focus-within:ring-gov-200"} ${n?"cursor-not-allowed bg-[#F9FAFB] opacity-60":""}`,children:[r.jsx("input",{id:f,type:"text",readOnly:!0,disabled:n,value:p,placeholder:"YYYY-MM",onClick:()=>!n&&d(j=>!j),className:"w-full cursor-pointer border-0 bg-transparent p-0 text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-0 disabled:cursor-not-allowed"}),r.jsx("button",{type:"button",disabled:n,onClick:()=>d(j=>!j),className:"shrink-0 rounded p-0.5 text-gov-600 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-60","aria-label":"Open tax period picker",children:r.jsx(ux,{})})]}),c?r.jsxs("div",{className:"absolute left-0 top-[calc(100%+8px)] z-50 w-[280px] rounded-xl border border-slate-200 bg-white shadow-lg",children:[r.jsx("div",{className:"absolute -top-2 left-8 h-4 w-4 rotate-45 border-l border-t border-slate-200 bg-white"}),r.jsxs("div",{className:"flex items-center justify-between rounded-t-xl bg-slate-50 px-4 py-3",children:[r.jsx("button",{type:"button",disabled:!C,onClick:()=>h(j=>j-1),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Previous year",children:r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),r.jsx("span",{className:"text-sm font-semibold text-slate-900",children:u}),r.jsx("button",{type:"button",disabled:!b,onClick:()=>h(j=>j+1),className:"rounded p-1 text-slate-500 transition hover:bg-white hover:text-slate-800 disabled:cursor-not-allowed disabled:opacity-30","aria-label":"Next year",children:r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})})]}),r.jsx("div",{className:"grid grid-cols-3 gap-1 p-3",children:cx.map((j,N)=>{const A=(l==null?void 0:l.year)===u&&l.month===N&&e.length===6,S=g(N);return r.jsx("button",{type:"button","aria-disabled":S,onClick:()=>y(N),className:`rounded-lg px-2 py-2.5 text-sm transition ${S?"cursor-not-allowed text-slate-300 hover:bg-sky-50":A?"bg-sky-100 font-semibold text-slate-900":"font-medium text-slate-800 hover:bg-slate-50"}`,children:j},j)})})]}):null]})}const md="Active",mx="Inactive";function Gn(e){return(e.status??md).trim().toLowerCase()==="active"}function hx(e){return Gn(e)?mx:md}function fx(e){return Gn(e)?"Deactivate":"Activate"}function mo(e){var t;return((t=e==null?void 0:e.accountType)==null?void 0:t.trim().toLowerCase())==="individual"}function px(e){return mo(e)?"/payments/federal/individual-enrollment":"/payments/federal/authorization"}function hd(e){const t=ix(e.taxFormType,e.taxTypeCode,e.subcategoryAmount1??"",e.subcategoryAmount2??"",e.subcategoryAmount3??""),n=aa(e.taxFormType,e.taxTypeCode);return{subcategoryCode1:t.subcategoryCode1,subcategoryAmount1:e.subcategoryAmount1?Number.parseFloat(e.subcategoryAmount1):null,subcategoryCode2:t.subcategoryCode2,subcategoryAmount2:e.subcategoryAmount2?Number.parseFloat(e.subcategoryAmount2):null,subcategoryCode3:t.subcategoryCode3,subcategoryAmount3:!n&&e.subcategoryAmount3?Number.parseFloat(e.subcategoryAmount3):null}}function ho(e,t){return{entityId:e,taxpayerPin:t.taxpayerPin||null,secondaryTin:t.secondaryTin||null,bankAccountDetailId:Number.parseInt(t.bankAccountDetailId,10),taxFormType:t.taxFormType,taxTypeCode:t.taxTypeCode,taxPeriod:t.taxPeriod,settlementDate:t.settlementDate,paymentAmount:Number.parseFloat(t.paymentAmount),...hd(t)}}function fo(e){return{taxpayerPin:e.taxpayerPin||null,secondaryTin:e.secondaryTin||null,bankAccountDetailId:Number.parseInt(e.bankAccountDetailId,10),taxFormType:e.taxFormType,taxTypeCode:e.taxTypeCode,taxPeriod:e.taxPeriod,settlementDate:e.settlementDate,paymentAmount:Number.parseFloat(e.paymentAmount),...hd(e)}}const po="federal-payment-draft";function xo(e){sessionStorage.setItem(po,JSON.stringify(e))}function ia(){const e=sessionStorage.getItem(po);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function oa(){sessionStorage.removeItem(po)}function xx(e,t={}){return{federalPaymentId:e.federalPaymentId,enrollmentId:e.enrollmentId,taxpayerPin:e.taxpayerPin??"",secondaryTin:e.secondaryTin??"",bankAccountDetailId:e.bankAccountDetailId?String(e.bankAccountDetailId):"",routingNumber:t.routingNumber??"",accountNumber:t.accountNumber??"",accountType:t.accountType??"",bankName:t.bankName??"",taxFormType:e.taxFormType,taxTypeCode:e.taxTypeCode,taxPeriod:e.taxPeriod,settlementDate:e.settlementDate,paymentAmount:String(e.paymentAmount),subcategoryAmount1:e.subcategoryAmount1!=null?String(e.subcategoryAmount1):"",subcategoryAmount2:e.subcategoryAmount2!=null?String(e.subcategoryAmount2):"",subcategoryAmount3:e.subcategoryAmount3!=null?String(e.subcategoryAmount3):""}}const gx=Gt({taxpayerPin:F().max(4,"Taxpayer PIN must not exceed 4 characters").optional(),secondaryTin:F().max(9,"Secondary TIN must not exceed 9 characters").optional(),bankAccountDetailId:F().min(1,"Bank account is required"),routingNumber:F().optional(),accountType:F().optional(),bankName:F().optional(),taxFormType:F().min(1,"Tax form type is required"),taxTypeCode:F().min(1,"Payment type is required"),taxPeriod:F().min(1,"This field is required").regex(/^\d{6}$/,"Tax period must be in YYYY-MM format").refine(e=>{const t=Ms(e);if(!t)return!1;const{minYear:n,maxYear:s}=ud();return t.year>=n&&t.year<=s},"Tax period must be within the last 3 years"),settlementDate:F().min(1,"This field is required").refine(e=>sa(e),"Settlement date must be a weekday within the allowed range"),paymentAmount:F().min(1,"This field is required").refine(e=>Vs(e),zs.errorMessage),subcategoryCode1:F().optional(),subcategoryAmount1:F().optional(),subcategoryCode2:F().optional(),subcategoryAmount2:F().optional(),subcategoryCode3:F().optional(),subcategoryAmount3:F().optional()}).superRefine((e,t)=>{var l;if(e.taxPeriod&&e.taxFormType){const c=Ms(e.taxPeriod);c&&cd(e.taxFormType).includes(c.month)&&t.addIssue({code:wt.custom,message:"Tax period must be a valid month for the selected tax form",path:["taxPeriod"]})}if(!co(e.taxFormType,e.taxTypeCode))return;const n=aa(e.taxFormType,e.taxTypeCode),s=ex(e.taxFormType,e.taxTypeCode),a=(c,d,u)=>{if(!(c!=null&&c.trim())){u&&t.addIssue({code:wt.custom,message:"This field is required",path:[d]});return}Vs(c)||t.addIssue({code:wt.custom,message:zs.errorMessage,path:[d]})};a(e.subcategoryAmount1,"subcategoryAmount1",!0),a(e.subcategoryAmount2,"subcategoryAmount2",!0),a(e.subcategoryAmount3,"subcategoryAmount3",s);const i=dd(e.paymentAmount),o=sx(e.subcategoryAmount1??"",e.subcategoryAmount2??"",e.subcategoryAmount3??"",s);i!==null&&!ax(i,o)&&t.addIssue({code:wt.custom,message:"Payment amount must equal the sum of subcategory amounts",path:["paymentAmount"]}),n&&((l=e.subcategoryAmount3)!=null&&l.trim())&&t.addIssue({code:wt.custom,message:"Subcategory amount 3 is not used for CT-1 payments",path:["subcategoryAmount3"]})}),Tr="grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3";function wa(e){return{taxpayerPin:e.taxpayerPin??"",secondaryTin:e.secondaryTin??"",bankAccountDetailId:e.bankAccountDetailId,routingNumber:e.routingNumber??"",accountType:e.accountType??"",bankName:e.bankName??"",taxFormType:e.taxFormType,taxTypeCode:e.taxTypeCode,taxPeriod:e.taxPeriod,settlementDate:e.settlementDate,paymentAmount:e.paymentAmount,subcategoryCode1:e.subcategoryCode1??"",subcategoryAmount1:e.subcategoryAmount1??"",subcategoryCode2:e.subcategoryCode2??"",subcategoryAmount2:e.subcategoryAmount2??"",subcategoryCode3:e.subcategoryCode3??"",subcategoryAmount3:e.subcategoryAmount3??""}}const ql={taxpayerPin:"",secondaryTin:"",bankAccountDetailId:"",routingNumber:"",accountType:"",bankName:"",taxFormType:"",taxTypeCode:"",taxPeriod:"",settlementDate:"",paymentAmount:"",subcategoryCode1:"",subcategoryAmount1:"",subcategoryCode2:"",subcategoryAmount2:"",subcategoryCode3:"",subcategoryAmount3:""};function yx(e,t,n){if(e)return wa(e);if(t!=null&&t.paymentDraft)return wa(t.paymentDraft);if(t!=null&&t.resetDraft)return oa(),ql;const s=ia();return s&&s.entityId===n?wa(s):ql}function fd({entity:e,initialDraft:t,readonly:n=!1,onCancel:s}){var ct,ze,ft,pt,st,Pt,It,Mt,xt,xe,Ve,ut,Jt;const a=Ie(),i=Ae(),o=At(),l=Sn(i.state,Ge()),c=i.state,d=c!=null&&c.resetDraft?null:ia(),u=t??(c==null?void 0:c.paymentDraft)??(d&&d.entityId===(e==null?void 0:e.entityId)?d:null),h=x.useRef(u==null?void 0:u.federalPaymentId),m=x.useRef(u==null?void 0:u.enrollmentId),[f,p]=x.useState(null),[g,y]=x.useState(!1),C=x.useMemo(()=>yx(t,c,e==null?void 0:e.entityId),[t,c==null?void 0:c.paymentDraft,c==null?void 0:c.resetDraft,e==null?void 0:e.entityId,i.key]);x.useEffect(()=>{u!=null&&u.federalPaymentId&&(h.current=u.federalPaymentId),u!=null&&u.enrollmentId&&(m.current=u.enrollmentId)},[u==null?void 0:u.federalPaymentId,u==null?void 0:u.enrollmentId]);const{data:b=[],isLoading:j}=de({queryKey:["bank-accounts",e==null?void 0:e.entityId],queryFn:()=>kn(e.entityId),enabled:e!==null}),N=x.useMemo(()=>b.filter(Gn),[b]),{data:A=[],isLoading:S}=de({queryKey:["federal-form-types",e==null?void 0:e.entityId],queryFn:()=>W4(e.entityId),enabled:e!==null}),{register:R,control:E,handleSubmit:z,watch:X,setValue:H,getValues:_,trigger:V,formState:{errors:q}}=Ut({resolver:Bt(gx),defaultValues:C}),B=X("bankAccountDetailId"),ee=X("taxFormType"),W=X("taxTypeCode"),ue=X("taxPeriod"),we=X("settlementDate"),Re=X("subcategoryAmount1"),Ce=X("subcategoryAmount2"),Oe=X("subcategoryAmount3"),Ne=x.useRef(ee),ve=x.useMemo(()=>ee?cd(ee):[],[ee]),Pe=x.useMemo(()=>co(ee,W),[ee,W]),ne=x.useMemo(()=>aa(ee,W),[ee,W]),{data:Se=[],isLoading:U}=de({queryKey:["federal-tax-type-codes",ee],queryFn:()=>Y4(ee),enabled:!!ee});x.useEffect(()=>{Ne.current&&Ne.current!==ee&&H("taxTypeCode",""),Ne.current=ee},[ee,H]),x.useEffect(()=>{if(!ue||!ee)return;const K=Ms(ue);K&&ve.includes(K.month)&&H("taxPeriod","")},[ee,ue,ve,H]),x.useEffect(()=>{we&&(sa(we)||H("settlementDate",""))},[we,H]),x.useEffect(()=>{if(!Pe){H("subcategoryCode1",""),H("subcategoryCode2",""),H("subcategoryCode3",""),H("subcategoryAmount1",""),H("subcategoryAmount2",""),H("subcategoryAmount3","");return}const K=tx(ee);H("subcategoryCode1",K.code1),H("subcategoryCode2",K.code2),H("subcategoryCode3",ne?"":K.code3),ne&&H("subcategoryAmount3","")},[Pe,ee,ne,H]),x.useEffect(()=>{Pe&&(V("paymentAmount"),V("subcategoryAmount1"),V("subcategoryAmount2"),V("subcategoryAmount3"))},[Re,Ce,Oe,Pe,V]),x.useEffect(()=>{if(j)return;const K=N.find(oe=>String(oe.bankAccountDetailId)===B);if(!K){B&&(H("bankAccountDetailId",""),H("routingNumber",""),H("accountType",""),H("bankName",""));return}H("routingNumber",K.routingNumber),H("accountType",K.accountType),H("bankName",K.bankName)},[N,B,j,H]);const me=K=>{const oe=N.find(v=>String(v.bankAccountDetailId)===K.bankAccountDetailId);return{federalPaymentId:h.current,enrollmentId:m.current??(u==null?void 0:u.enrollmentId),form8655AuthorizationId:u==null?void 0:u.form8655AuthorizationId,form9783EnrollmentId:u==null?void 0:u.form9783EnrollmentId,taxpayerPin:K.taxpayerPin??"",secondaryTin:K.secondaryTin??"",bankAccountDetailId:K.bankAccountDetailId,routingNumber:K.routingNumber??(oe==null?void 0:oe.routingNumber)??"",accountNumber:(oe==null?void 0:oe.accountNumber)??"",accountType:K.accountType??(oe==null?void 0:oe.accountType)??"",bankName:K.bankName??(oe==null?void 0:oe.bankName)??"",taxFormType:K.taxFormType,taxTypeCode:K.taxTypeCode,taxPeriod:K.taxPeriod,settlementDate:K.settlementDate,paymentAmount:K.paymentAmount,subcategoryCode1:K.subcategoryCode1,subcategoryAmount1:K.subcategoryAmount1,subcategoryCode2:K.subcategoryCode2,subcategoryAmount2:K.subcategoryAmount2,subcategoryCode3:K.subcategoryCode3,subcategoryAmount3:K.subcategoryAmount3}},Q=async()=>{await o.invalidateQueries({queryKey:["dashboard"]}),await o.invalidateQueries({queryKey:["federal-payments"]}),await o.invalidateQueries({queryKey:["remittance-payments"]}),h.current&&o.removeQueries({queryKey:["federal-payment",h.current],exact:!0})},pe=async K=>{if(!e)return null;if(K.federalPaymentId){const v=await ro(K.federalPaymentId,fo(K));return h.current=v.federalPaymentId,m.current=v.enrollmentId,v}const oe=await no(ho(e.entityId,K));return h.current=oe.federalPaymentId,m.current=oe.enrollmentId,oe},Ue=z(async K=>{if(!(n||!e)){p(null),y(!0);try{const oe=me(K),v=await pe(oe);if(!v)return;const k={...oe,entityId:e.entityId,federalPaymentId:v.federalPaymentId,enrollmentId:v.enrollmentId};await Q(),xo(k),a(px(e),{state:{from:l,paymentDraft:k}})}catch(oe){p(rt(oe,"Failed to save payment details."))}finally{y(!1)}}}),$e=async()=>{if(!(!e||n)){p(null),y(!0);try{const K=me(_());await pe(K),await Q(),oa(),a(Ge())}catch(K){p(rt(K,"Failed to save draft."))}finally{y(!1)}}},Be=()=>{if(s){s();return}a(l)};return r.jsxs("form",{onSubmit:Ue,noValidate:!0,className:"w-full space-y-6",children:[r.jsxs("div",{className:"mb-6 flex w-full flex-col gap-4 md:flex-row md:items-center",children:[r.jsx("h2",{className:"shrink-0 text-[28px] font-bold leading-tight text-slate-900",children:"Federal Tax Payment"}),!n&&r.jsx("div",{className:"flex min-w-0 flex-1 justify-center",children:r.jsx(Sr,{steps:lo,current:1})})]}),f?r.jsx(Zt,{message:f}):null,r.jsx("div",{className:"w-full",children:r.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",children:[r.jsx(bn,{title:"Enrollment Details",isFirst:!0,children:r.jsxs("div",{className:"space-y-5 w-3/4",children:[r.jsxs("div",{className:Tr,children:[r.jsx($,{label:"Taxpayer PIN",required:!0,info:"The 4-digit PIN assigned by the IRS for EFTPS enrollment.",error:(ct=q.taxpayerPin)==null?void 0:ct.message,children:r.jsx("input",{placeholder:"Enter Taxpayer PIN",className:ie(!!q.taxpayerPin),maxLength:4,disabled:n,...R("taxpayerPin")})}),r.jsx($,{label:"Secondary TIN",info:"An additional Taxpayer Identification Number, if the payment requires one.",error:(ze=q.secondaryTin)==null?void 0:ze.message,children:r.jsx("input",{placeholder:"Enter Secondary TIN",className:ie(!!q.secondaryTin),maxLength:9,disabled:n,...R("secondaryTin")})}),r.jsx(Ye,{name:"bankAccountDetailId",control:E,render:({field:K})=>{var oe;return r.jsx(ld,{value:K.value,onChange:K.onChange,entityId:(e==null?void 0:e.entityId)??null,bankAccounts:N,isLoading:j,disabled:!e||n,label:"Account Number",info:"Select the bank account to debit for this payment, or add a new one.",error:(oe=q.bankAccountDetailId)==null?void 0:oe.message})}})]}),r.jsxs("div",{className:Tr,children:[r.jsx($,{label:"Routing Number",required:!0,info:"The 9-digit bank routing number, auto-filled from the selected bank account.",error:(ft=q.routingNumber)==null?void 0:ft.message,children:r.jsx("input",{readOnly:!0,placeholder:"Enter Routing Number",className:ie(!!q.routingNumber,!0),...R("routingNumber")})}),r.jsx($,{label:"Account Type",required:!0,info:"The bank account type (checking or savings), auto-filled from the selected bank account.",error:(pt=q.accountType)==null?void 0:pt.message,children:r.jsx("input",{readOnly:!0,placeholder:"Select Account Type",className:ie(!!q.accountType,!0),...R("accountType")})}),r.jsx($,{label:"Bank Name",required:!0,info:"The name of the bank, auto-filled from the selected bank account.",error:(st=q.bankName)==null?void 0:st.message,children:r.jsx("input",{readOnly:!0,placeholder:"Bank Name",className:ie(!!q.bankName,!0),...R("bankName")})})]})]})}),r.jsx(bn,{title:"Federal Payment",children:r.jsxs("div",{className:"space-y-5 w-3/4",children:[r.jsxs("div",{className:Tr,children:[r.jsx($,{label:"Tax Form Type",required:!0,info:"The federal tax form this payment applies to (e.g. 941, 944, CT-1).",error:(Pt=q.taxFormType)==null?void 0:Pt.message,children:r.jsxs(Lt,{children:[r.jsx(Ye,{name:"taxFormType",control:E,render:({field:K})=>r.jsxs("select",{className:Nt(!!q.taxFormType),disabled:S||!e||n,...K,children:[r.jsx("option",{value:"",children:S?"Loading form types…":"Select form type"}),A.map(oe=>r.jsx("option",{value:oe.value,children:oe.value},oe.value))]})}),r.jsx(Tt,{})]})}),r.jsx($,{label:"Payment Type",required:!0,info:"The type of payment for the selected tax form.",error:(It=q.taxTypeCode)==null?void 0:It.message,children:r.jsxs(Lt,{children:[r.jsx(Ye,{name:"taxTypeCode",control:E,render:({field:K})=>r.jsxs("select",{className:Nt(!!q.taxTypeCode),disabled:!ee||U||n,...K,children:[r.jsx("option",{value:"",children:ee?U?"Loading payment types…":"Select payment type":"Select tax form first"}),Se.map(oe=>r.jsxs("option",{value:oe.code,children:[oe.code," - ",oe.codeName]},oe.code))]})}),r.jsx(Tt,{})]})}),r.jsx($,{label:"Tax Period",required:!0,info:"The tax period (month and year) this payment covers.",error:(Mt=q.taxPeriod)==null?void 0:Mt.message,children:r.jsx(Ye,{name:"taxPeriod",control:E,render:({field:K})=>r.jsx(dx,{value:K.value,onChange:K.onChange,hasError:!!q.taxPeriod,disabled:!ee||n,disabledMonths:ve})})})]}),r.jsxs("div",{className:"grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3",children:[r.jsx($,{label:"Settlement Date",required:!0,info:"The weekday the payment will be withdrawn and settled with the IRS.",error:(xt=q.settlementDate)==null?void 0:xt.message,children:r.jsx(Ye,{name:"settlementDate",control:E,render:({field:K})=>r.jsx(uo,{value:K.value,onChange:K.onChange,hasError:!!q.settlementDate,disabled:n})})}),r.jsx($,{label:"Payment Amount",required:!0,info:"The total amount to remit. Must equal the sum of subcategory amounts when applicable.",error:(xe=q.paymentAmount)==null?void 0:xe.message,children:r.jsx(Ye,{name:"paymentAmount",control:E,render:({field:K})=>r.jsx(_n,{name:K.name,value:K.value,onChange:K.onChange,onBlur:K.onBlur,disabled:n,hasError:!!q.paymentAmount})})})]}),Pe?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-px bg-slate-200"}),r.jsxs("div",{className:Tr,children:[r.jsx($,{label:"Subcategory Code 1",info:"The first subcategory code for the selected tax form, set automatically.",children:r.jsx("input",{readOnly:!0,className:ie(!1,!0),...R("subcategoryCode1")})}),r.jsx($,{label:"Subcategory Code 2",info:"The second subcategory code for the selected tax form, set automatically.",children:r.jsx("input",{readOnly:!0,className:ie(!1,!0),...R("subcategoryCode2")})}),ne?null:r.jsx($,{label:"Subcategory Code 3",info:"The third subcategory code for the selected tax form, set automatically.",children:r.jsx("input",{readOnly:!0,className:ie(!1,!0),...R("subcategoryCode3")})})]}),r.jsxs("div",{className:Tr,children:[r.jsx($,{label:"Subcategory Amount 1",required:!0,info:"The amount allocated to Subcategory Code 1.",error:(Ve=q.subcategoryAmount1)==null?void 0:Ve.message,children:r.jsx(Ye,{name:"subcategoryAmount1",control:E,render:({field:K})=>r.jsx(_n,{name:K.name,value:K.value??"",onChange:K.onChange,onBlur:K.onBlur,disabled:n,placeholder:"Enter amount",hasError:!!q.subcategoryAmount1})})}),r.jsx($,{label:"Subcategory Amount 2",required:!0,info:"The amount allocated to Subcategory Code 2.",error:(ut=q.subcategoryAmount2)==null?void 0:ut.message,children:r.jsx(Ye,{name:"subcategoryAmount2",control:E,render:({field:K})=>r.jsx(_n,{name:K.name,value:K.value??"",onChange:K.onChange,onBlur:K.onBlur,disabled:n,placeholder:"Enter amount",hasError:!!q.subcategoryAmount2})})}),ne?null:r.jsx($,{label:"Subcategory Amount 3",required:!0,info:"The amount allocated to Subcategory Code 3.",error:(Jt=q.subcategoryAmount3)==null?void 0:Jt.message,children:r.jsx(Ye,{name:"subcategoryAmount3",control:E,render:({field:K})=>r.jsx(_n,{name:K.name,value:K.value??"",onChange:K.onChange,onBlur:K.onBlur,disabled:n,placeholder:"Enter amount",hasError:!!q.subcategoryAmount3})})})]})]}):null]})})]})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n?r.jsx("button",{type:"button",onClick:Be,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50",children:"Back"}):r.jsx("span",{}),n?null:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:$e,disabled:!e||g,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-60",children:g?"Saving…":"Save as Draft"}),r.jsx("button",{type:"submit",disabled:!e||g,className:"inline-flex h-11 min-w-[160px] items-center justify-center rounded-lg bg-gov-600 px-10 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:g?"Saving…":"Next"})]})]})]},i.key)}function pd(){const{selectedEntity:e}=ht();return r.jsx(fd,{entity:e})}function xd({mode:e}){var h;const t=Ie(),{federalPaymentId:n}=Bs(),{selectedEntity:s}=ht(),a=Number.parseInt(n??"",10),{data:i,isLoading:o,isError:l}=de({queryKey:["federal-payment",a],queryFn:()=>to(a),enabled:Number.isFinite(a)}),{data:c=[]}=de({queryKey:["bank-accounts",s==null?void 0:s.entityId],queryFn:()=>kn(s.entityId),enabled:s!==null&&i!==void 0}),d=x.useMemo(()=>{if(!i)return null;const m=c.find(f=>f.bankAccountDetailId===i.bankAccountDetailId);return xx(i,{routingNumber:m==null?void 0:m.routingNumber,accountNumber:m==null?void 0:m.accountNumber,accountType:m==null?void 0:m.accountType,bankName:m==null?void 0:m.bankName})},[i,c]);if(!Number.isFinite(a))return r.jsx(He,{to:Ge(),replace:!0});if(o)return r.jsx("p",{className:"text-sm text-slate-600",children:"Loading federal payment…"});if(l||!i||!d)return r.jsx(He,{to:Ge(),replace:!0});if(!s||i.entityId!==s.entityId)return r.jsx(He,{to:Ge(),replace:!0});const u=e==="view"||((h=i.status)==null?void 0:h.toLowerCase())!=="draft";return r.jsx(fd,{entity:s,initialDraft:d,readonly:u,onCancel:()=>t(Ge())})}function gd(){return ht(),r.jsx(xd,{mode:"edit"})}function yd(){return ht(),r.jsx(xd,{mode:"view"})}function bx({enabled:e,onChange:t,frequency:n,endDate:s,onEndDateChange:a,endDateError:i,disabled:o=!1}){return r.jsxs("div",{className:"rounded-xl border border-slate-200 p-5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("h5",{className:"text-sm font-semibold text-slate-900",children:"Make This a Recurring Payment"}),r.jsxs("button",{type:"button",role:"switch","aria-checked":e,"aria-label":"Make this a recurring payment",disabled:o,onClick:()=>t(!e),className:`relative inline-flex h-6 w-[52px] shrink-0 items-center rounded-full text-[10px] font-semibold text-white transition focus:outline-none focus-visible:ring-2 focus-visible:ring-gov-300 disabled:cursor-not-allowed disabled:opacity-60 ${e?"bg-gov-600":"bg-slate-500"}`,children:[r.jsx("span",{className:`absolute h-4 w-4 rounded-full bg-white transition-all ${e?"left-[32px]":"left-1"}`}),r.jsx("span",{className:`w-full text-center ${e?"pr-5":"pl-5"}`,children:e?"Yes":"No"})]})]}),r.jsx("p",{className:"mt-3 text-sm text-slate-600",children:"Set a schedule once, and GovPay automatically submits each payment. Ideal for monthly or quarterly payments."}),e?r.jsxs("div",{className:"mt-4",children:[r.jsxs("label",{htmlFor:"recurring-end-date",className:"text-xs font-medium text-slate-700",children:[n||"Recurring"," until"]}),r.jsx("input",{id:"recurring-end-date",type:"date",value:s,onChange:l=>a(l.target.value),disabled:o,className:`mt-1.5 block w-full rounded-lg border px-3 py-2 text-sm text-slate-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-gov-300 disabled:cursor-not-allowed disabled:opacity-60 ${i?"border-red-400":"border-slate-300"}`}),i?r.jsx("p",{className:"mt-1.5 text-xs text-red-600",children:i}):null,r.jsx("p",{className:"mt-1.5 text-xs text-slate-500",children:"The last date this recurring payment will occur."})]}):null]})}function vx(e){return{id:e,taxPeriod:"",taxAmount:"",paymentDate:""}}function Cx({rows:e,taxPeriodOptions:t,onChange:n,onRemove:s,onAdd:a,disabled:i=!1}){return r.jsxs(r.Fragment,{children:[e.map(o=>r.jsxs("div",{className:"mt-5 flex items-start gap-3",children:[r.jsxs("div",{className:"grid flex-1 gap-x-6 gap-y-5 sm:grid-cols-3",children:[r.jsx($,{label:"Tax Period",required:!0,children:r.jsxs(Lt,{children:[r.jsxs("select",{className:Nt(!1),value:o.taxPeriod,onChange:l=>n(o.id,{taxPeriod:l.target.value}),children:[r.jsx("option",{value:"",children:"Select Tax Period"}),t.map(l=>r.jsx("option",{value:l.value,children:l.label},l.value))]}),r.jsx(Tt,{})]})}),r.jsx($,{label:"Tax Amount",required:!0,children:r.jsx(_n,{value:o.taxAmount,onChange:l=>n(o.id,{taxAmount:l}),disabled:i,placeholder:"$"})}),r.jsx($,{label:"Payment Date",required:!0,children:r.jsx(uo,{value:o.paymentDate,onChange:l=>n(o.id,{paymentDate:l}),disabled:i})})]}),r.jsx(bd,{onClick:()=>s(o.id),label:`Remove tax period row ${o.id}`})]},o.id)),r.jsxs("button",{type:"button",onClick:a,disabled:i,className:"mt-4 inline-flex items-center gap-2 text-sm font-semibold text-gov-600 transition hover:text-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(wx,{}),"Add New"]})]})}function bd({onClick:e,label:t,disabled:n=!1,title:s}){return r.jsx("button",{type:"button",onClick:e,disabled:n,"aria-label":t,title:s,className:"mt-[26px] inline-flex h-[42px] w-[42px] shrink-0 items-center justify-center rounded-lg border border-slate-200 text-slate-400 transition hover:bg-slate-50 hover:text-slate-600 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",children:r.jsx(jx,{})})}function jx(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 7.5h12M9.5 7.5V6a1 1 0 011-1h3a1 1 0 011 1v1.5M7.5 7.5l.6 11a1 1 0 001 .95h5.8a1 1 0 001-.95l.6-11M10.5 11v5M13.5 11v5"})})}function wx(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5v14m-7-7h14"})})}function Nx(e){const t=[];return e.includes("\\d")&&t.push("0-9"),/[A-Z]/.test(e)&&t.push("A-Z"),e.includes("-")&&t.push("\\-"),e.includes(" ")&&t.push(" "),e.includes("/")&&t.push("/"),t.length?t.join(""):null}function Sx(e,t){const n=e.toUpperCase();if(!t)return n;const s=Nx(t);return s?n.replace(new RegExp(`[^${s}]`,"g"),""):n}function kx(e){if(!e)return null;const t=[];let n=0;try{for(;n<e.length;){if(e.startsWith("(?:",n))return null;const s=e[n];if(s==="-"||s===" "||s==="/"){t.push({type:"separator",char:s}),n+=1;continue}let a;if(s==="\\")a=e[n+1]==="d"?"digit":"letter",n+=2;else if(s==="["){const o=e.indexOf("]",n);if(o===-1)return null;a="letter",n=o+1}else a=s>="0"&&s<="9"?"digit":"letter",n+=1;const i=Ax(e,n);if(i===null)return null;for(let o=0;o<i.count;o+=1)t.push({type:"slot",kind:a});n=i.nextIndex}}catch{return null}return t}function Ax(e,t){if(e[t]!=="{")return{count:1,nextIndex:t};const n=e.indexOf("}",t);if(n===-1)throw new Error("Unterminated quantifier");const s=e.slice(t+1,n);if(s.includes(","))return null;const a=Number.parseInt(s,10);if(Number.isNaN(a))throw new Error("Bad quantifier");return{count:a,nextIndex:n+1}}function Px(e,t){const n=e.toUpperCase().replace(/[^0-9A-Z]/g,"").split("");let s="",a=0;for(const i of t){if(a>=n.length)break;if(i.type==="separator"){s+=i.char;continue}for(;a<n.length;){const o=n[a];a+=1;const l=o>="0"&&o<="9";if(i.kind==="digit"?l:!l){s+=o;break}}}return s}function Ix(e){if(e)try{const t=vd(e,0);return t.index===e.length?t.length:void 0}catch{return}}function vd(e,t){let n=t,s=0;for(;;){const a=Ex(e,n);if(s=Math.max(s,a.length),n=a.index,e[n]==="|"){n+=1;continue}return{length:s,index:n}}}function Ex(e,t){let n=t,s=0;for(;n<e.length&&e[n]!=="|"&&e[n]!==")";){const a=Tx(e,n);s+=a.length,n=a.index}return{length:s,index:n}}function Tx(e,t){let n=t,s;if(e.startsWith("(?:",n)){const a=vd(e,n+3);if(e[a.index]!==")")throw new Error("Unbalanced group");s=a.length,n=a.index+1}else if(e[n]==="\\")s=1,n+=2;else if(e[n]==="["){const a=e.indexOf("]",n);if(a===-1)throw new Error("Unterminated class");s=1,n=a+1}else s=1,n+=1;if(e[n]==="{"){const a=e.indexOf("}",n);if(a===-1)throw new Error("Unterminated quantifier");const i=e.slice(n+1,a).split(","),o=i.length===2?i[1]:i[0],l=Number.parseInt(o,10);if(Number.isNaN(l))throw new Error("Bad quantifier");s*=l,n=a+1}return{length:s,index:n}}const go="state-payment-draft";function la(e){sessionStorage.setItem(go,JSON.stringify(e))}function qs(){const e=sessionStorage.getItem(go);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Cd(){sessionStorage.removeItem(go)}function Lx(e,t){var n,s;return{entityId:e,state:t.state,reasonForPayment:t.reasonForPayment,stateAccountId:t.stateAccountId,accountId:t.accountId,letterId:(n=t.letterId)!=null&&n.trim()?t.letterId.trim().toUpperCase():null,taxYear:t.taxYear,taxPeriod:(s=t.taxPeriod)!=null&&s.trim()?t.taxPeriod.trim():null,taxAmount:Number.parseFloat(t.taxAmount),paymentDate:t.paymentDate,bankAccountDetailId:Number.parseInt(t.bankAccountDetailId,10),isRecurring:t.isRecurring??!1,frequency:t.isRecurring?t.frequency:void 0,recurringEndDate:t.isRecurring?t.recurringEndDate:void 0}}function Fx(e){var t,n;return{state:e.state,reasonForPayment:e.reasonForPayment,stateAccountId:e.stateAccountId,accountId:e.accountId,letterId:(t=e.letterId)!=null&&t.trim()?e.letterId.trim().toUpperCase():null,taxYear:e.taxYear,taxPeriod:(n=e.taxPeriod)!=null&&n.trim()?e.taxPeriod.trim():null,taxAmount:Number.parseFloat(e.taxAmount),paymentDate:e.paymentDate,bankAccountDetailId:Number.parseInt(e.bankAccountDetailId,10)}}const Rx="Enter the letter or notice ID in this format: L1234567890 (the letter L followed by 10 digits).",Zl=/^L\d{10}$/,jd=10,Dx=jd+1;function Mx(e){const t=e.toUpperCase().replace(/[^A-Z0-9]/g,"");if(!t)return"";const n=t.replace(/\D/g,"").slice(0,jd);return!n&&!t.startsWith("L")?"":`L${n}`}function Ox(e){return Gt({state:F().min(1,"State is required"),reasonForPayment:F().min(1,"Reason for payment is required"),stateAccountId:F().min(1,"State ID is required"),accountId:F().min(1,"Account ID is required").refine(t=>/^\d{10,12}$/.test(t.trim()),"Account ID must be 10 to 12 digits"),letterId:F().optional(),taxYear:F().min(1,"Tax year is required"),taxPeriod:F().optional(),taxAmount:F().min(1,"Tax amount is required").refine(t=>Vs(t),zs.errorMessage),paymentDate:F().min(1,"Payment date is required").refine(t=>sa(t),"Payment date must be a weekday within the allowed range"),bankAccountDetailId:F().optional(),routingNumber:F().optional(),accountType:F().optional(),bankName:F().optional()}).superRefine((t,n)=>{var d,u;const s=e(),a=s==null?void 0:s.stateId.pattern;if(a)try{new RegExp(`^(?:${a})$`).test(t.stateAccountId.trim().toUpperCase())||n.addIssue({code:wt.custom,path:["stateAccountId"],message:s.stateId.message})}catch{n.addIssue({code:wt.custom,path:["stateAccountId"],message:"State ID validation is temporarily unavailable"})}const i=((d=t.letterId)==null?void 0:d.trim().toUpperCase())??"",o=(s==null?void 0:s.letterIdRequired)??!1,l=(s==null?void 0:s.letterId.message)??Rx;if(o&&!i)n.addIssue({code:wt.custom,path:["letterId"],message:"Letter ID is required for a bill payment"});else if(i)try{(s!=null&&s.letterId.pattern?new RegExp(`^(?:${s.letterId.pattern})$`):Zl).test(i)||n.addIssue({code:wt.custom,path:["letterId"],message:l})}catch{Zl.test(i)||n.addIssue({code:wt.custom,path:["letterId"],message:l})}((s==null?void 0:s.taxPeriodRequired)??!0)&&!((u=t.taxPeriod)!=null&&u.trim())&&n.addIssue({code:wt.custom,path:["taxPeriod"],message:"Tax period is required"})})}const Ul="grid gap-x-6 gap-y-5 sm:grid-cols-3",zx="grid gap-x-6 gap-y-5 sm:grid-cols-2 lg:grid-cols-4",Vx="w-full rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",Bl="mt-6 min-w-0 rounded-xl border border-slate-200 p-5 lg:p-6",Na="text-sm font-semibold text-slate-900",qx=["Payment Details","Bank Account","Review & Authorize"],Zx=["Monthly","Quarterly","Semi-annually","Annually"],Ux={Monthly:"Monthly",Quarterly:"Quarterly","Semi-annually":"SemiAnnually",Annually:"Annually"},Wl={state:"",reasonForPayment:"",stateAccountId:"",accountId:"",letterId:"",taxYear:"",taxPeriod:"",taxAmount:"",paymentDate:"",bankAccountDetailId:"",routingNumber:"",accountType:"",bankName:""};function Sa(e){return{state:e.state,reasonForPayment:wd(e.reasonForPayment),stateAccountId:e.stateAccountId,accountId:e.accountId,letterId:e.letterId??"",taxYear:e.taxYear,taxPeriod:e.taxPeriod,taxAmount:e.taxAmount,paymentDate:e.paymentDate,bankAccountDetailId:e.bankAccountDetailId,routingNumber:e.routingNumber??"",accountType:e.accountType??"",bankName:e.bankName??""}}const Bx={MAKE_A_BILL_PAYMENT:"BILL_PAYMENT"};function wd(e){const t=e.trim().toUpperCase().replaceAll(" ","_");return Bx[t]??t}function Nd({entity:e,initialDraft:t,readonly:n=!1,onCancel:s}){var v,k,P,M,O,G,T,Z,se;const a=Ie(),i=Ae(),o=Sn(i.state,Ge()),l=i.state,c=x.useMemo(()=>t??(l==null?void 0:l.paymentDraft)??(l!=null&&l.resetDraft?null:qs())??null,[t,l==null?void 0:l.paymentDraft,l==null?void 0:l.resetDraft]),d=x.useRef(c==null?void 0:c.statePaymentDetailId),u=x.useMemo(()=>{if(t)return Sa(t);if(l!=null&&l.paymentDraft)return Sa(l.paymentDraft);if(l!=null&&l.resetDraft)return Cd(),Wl;const L=qs();return L?Sa(L):Wl},[t,l==null?void 0:l.paymentDraft,l==null?void 0:l.resetDraft,i.key]),{data:h=[],isLoading:m,isError:f}=de({queryKey:["state-payment-states"],queryFn:({signal:L})=>_u(L)}),{data:p=[],isLoading:g}=de({queryKey:["bank-accounts",e==null?void 0:e.entityId],queryFn:()=>kn(e.entityId),enabled:e!==null}),y=x.useMemo(()=>p.filter(Gn),[p]),C=x.useRef(null),b=x.useMemo(()=>Ox(()=>C.current),[]),{register:j,control:N,handleSubmit:A,watch:S,setValue:R,clearErrors:E,formState:{errors:z}}=Ut({resolver:Bt(b),defaultValues:u}),X=S("state"),H=S("reasonForPayment"),_=S("paymentDate"),V=S("bankAccountDetailId"),{data:q=[],isLoading:B,isError:ee}=de({queryKey:["state-payment-reasons",e==null?void 0:e.entityId,X],queryFn:({signal:L})=>so(e.entityId,X,L),enabled:e!==null&&!!X}),{data:W}=de({queryKey:["state-payment-validation-metadata",e==null?void 0:e.entityId,X,H],queryFn:({signal:L})=>$u(e.entityId,X,H,L),enabled:e!==null&&!!(X&&H)});de({queryKey:["state-payment-form-references",e==null?void 0:e.entityId,X,H],queryFn:({signal:L})=>_4(e.entityId,X,H,L),enabled:e!==null&&!!(X&&H)}),C.current=W??null;const ue=(W==null?void 0:W.taxYearOptions)??[],we=(W==null?void 0:W.taxPeriodOptions)??[],Re=!!(W&&X&&H),Ce=(W==null?void 0:W.stateId.pattern)??null,Oe=Ix(Ce),Ne=x.useMemo(()=>kx(Ce),[Ce]),ve=j("stateAccountId"),Pe=j("accountId"),ne=j("letterId"),[Se,U]=x.useState((c==null?void 0:c.frequency)??""),[me,Q]=x.useState((c==null?void 0:c.isRecurring)??!1),[pe,Ue]=x.useState((c==null?void 0:c.recurringEndDate)??""),[$e,Be]=x.useState(null),[ct,ze]=x.useState([]),ft=x.useRef(1),pt=()=>{ze(L=>[...L,vx(ft.current++)])},st=(L,he)=>{ze(gt=>gt.map(yt=>yt.id===L?{...yt,...he}:yt))},Pt=L=>{ze(he=>he.filter(gt=>gt.id!==L))},It=L=>{Q(L),L||(ze([]),Ue(""),Be(null))},Mt=!!(W!=null&&W.letterIdRequired),xt=["stateAccountId","accountId","letterId","taxYear","taxPeriod","taxAmount","paymentDate"],xe=()=>{xt.forEach(L=>R(L,"")),E([...xt,"bankAccountDetailId"])},Ve=L=>{R("state",L,{shouldValidate:!0}),R("reasonForPayment",""),E("reasonForPayment"),xe()},ut=L=>{L!==H&&(R("reasonForPayment",L,{shouldValidate:!0}),xe())};x.useEffect(()=>{c!=null&&c.statePaymentDetailId&&(d.current=c.statePaymentDetailId)},[c==null?void 0:c.statePaymentDetailId]),x.useEffect(()=>{if(!H||B||ee||q.some(he=>he.code===H))return;const L=q.find(he=>wd(he.label)===H);R("reasonForPayment",(L==null?void 0:L.code)??"")},[B,ee,q,H,R]);const Jt=x.useRef(!1);x.useEffect(()=>{if(!n){if(!Jt.current){Jt.current=!0;return}_&&!sa(_)&&R("paymentDate","")}},[_,R,n]),x.useEffect(()=>{if(n||g)return;const L=y.find(he=>String(he.bankAccountDetailId)===V);if(!L){V&&(R("bankAccountDetailId",""),R("routingNumber",""),R("accountType",""),R("bankName",""));return}R("routingNumber",L.routingNumber),R("accountType",L.accountType),R("bankName",L.bankName)},[y,V,R,n,g]);const K=A(L=>{var gt;if(n||!W)return;if(me){if(!pe){Be("An end date is required for a recurring payment.");return}if(L.paymentDate&&pe<=L.paymentDate){Be("End date must be after the first payment date.");return}}Be(null);const he={statePaymentDetailId:d.current,state:L.state,reasonForPayment:L.reasonForPayment,stateAccountId:L.stateAccountId.trim().toUpperCase(),accountId:L.accountId.trim(),letterId:(gt=L.letterId)!=null&>.trim()?L.letterId.trim().toUpperCase():"",taxYear:L.taxYear,taxPeriod:L.taxPeriod??"",taxAmount:L.taxAmount,paymentDate:L.paymentDate,bankAccountDetailId:L.bankAccountDetailId??"",routingNumber:L.routingNumber,accountType:L.accountType,bankName:L.bankName,isRecurring:me,frequency:me?Ux[Se]:void 0,recurringEndDate:me?pe:void 0};la(he),a("/payments/state/bank-details",{state:{from:o,paymentDraft:he}})}),oe=()=>{if(s){s();return}a(o)};return r.jsxs("form",{onSubmit:K,noValidate:!0,className:"w-full",children:[r.jsxs("div",{className:"mb-6 flex w-full flex-col gap-4 md:flex-row md:items-center",children:[r.jsx("h2",{className:"shrink-0 text-[28px] font-bold leading-tight text-slate-900",children:"State Tax Payment"}),!n&&r.jsx("div",{className:"flex min-w-0 flex-1 justify-center",children:r.jsx(Sr,{steps:qx,current:1})})]}),r.jsxs("section",{className:Vx,children:[r.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Payment Details"}),r.jsxs("div",{className:"mt-5 grid gap-x-6 gap-y-5 sm:grid-cols-2 lg:grid-cols-3",children:[r.jsx($,{label:"State",required:!0,info:"The tax jurisdiction this payment is for.",error:(v=z.state)==null?void 0:v.message,children:r.jsxs(Lt,{children:[r.jsxs("select",{disabled:n||m||f,className:Nt(!!z.state),value:X,onChange:L=>Ve(L.target.value),children:[r.jsx("option",{value:"",children:m?"Loading states…":"Select State"}),h.map(L=>r.jsx("option",{value:L.code,children:L.name},L.code))]}),r.jsx(Tt,{})]})}),r.jsx($,{label:"Reason for Payment",required:!0,info:"The reason for this state tax payment, filtered by the selected state and entity.",error:(k=z.reasonForPayment)==null?void 0:k.message,children:r.jsxs(Lt,{children:[r.jsxs("select",{disabled:n||!X||B||ee,className:Nt(!!z.reasonForPayment),value:H,onChange:L=>ut(L.target.value),children:[r.jsx("option",{value:"",children:B?"Loading reasons…":"Select Reason for Payment"}),q.map(L=>r.jsx("option",{value:L.code,children:L.label},L.code))]}),r.jsx(Tt,{})]})})]}),f?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:"Unable to load states."}):null,ee?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:"Unable to load payment reasons."}):null,X&&!B&&!ee&&q.length===0?r.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"No supported payment reasons are available for this entity and state."}):null,r.jsxs("fieldset",{disabled:!Re||n,className:Bl,children:[r.jsx("h4",{className:Na,children:"Account Information"}),r.jsxs("div",{className:`mt-5 ${zx}`,children:[r.jsx($,{label:"State Tax ID",required:(W==null?void 0:W.stateId.required)??!0,info:"Your state-issued tax account identifier for the selected state.",error:(P=z.stateAccountId)==null?void 0:P.message,children:r.jsx("input",{placeholder:(W==null?void 0:W.stateId.example)??"Enter State Tax ID",maxLength:Oe,className:ie(!!z.stateAccountId),...ve,onChange:L=>{L.target.value=Ne?Px(L.target.value,Ne):Sx(L.target.value,Ce),ve.onChange(L)}})}),r.jsx($,{label:"Account ID",required:(W==null?void 0:W.accountIdRequired)??!0,info:"Your 10 to 12 digit state tax account number.",error:(M=z.accountId)==null?void 0:M.message,children:r.jsx("input",{inputMode:"numeric",placeholder:"Enter Account ID",maxLength:12,className:ie(!!z.accountId),...Pe,onChange:L=>{L.target.value=L.target.value.replace(/\D/g,"").slice(0,12),Pe.onChange(L)}})}),Mt?r.jsx($,{label:"Letter ID",required:(W==null?void 0:W.letterIdRequired)??!1,info:"The letter or notice ID from the state bill (format L1234567890).",error:(O=z.letterId)==null?void 0:O.message,children:r.jsx("input",{placeholder:(W==null?void 0:W.letterId.example)??"L1234567890",maxLength:Dx,autoComplete:"off",className:ie(!!z.letterId),...ne,onChange:L=>{L.target.value=Mx(L.target.value),ne.onChange(L)}})}):null,r.jsx($,{label:"Tax Year",required:!0,info:"The tax year this payment applies to.",error:(G=z.taxYear)==null?void 0:G.message,children:r.jsxs(Lt,{children:[r.jsx(Ye,{name:"taxYear",control:N,render:({field:L})=>r.jsxs("select",{className:Nt(!!z.taxYear),...L,children:[r.jsx("option",{value:"",children:"Select Tax Year"}),ue.map(he=>r.jsxs("option",{value:String(he),children:["TY ",he]},he))]})}),r.jsx(Tt,{})]})}),r.jsx($,{label:"Frequency",required:me,info:"How often this payment repeats. Only used for a recurring payment.",children:r.jsxs(Lt,{children:[r.jsxs("select",{className:Nt(!1),value:Se,onChange:L=>U(L.target.value),children:[r.jsx("option",{value:"",children:"Select Frequency"}),Zx.map(L=>r.jsx("option",{value:L,children:L},L))]}),r.jsx(Tt,{})]})})]}),r.jsx("h4",{className:`mt-6 ${Na}`,children:"Tax Periods & Amounts"}),r.jsxs("div",{className:"mt-4 grid items-start gap-5 lg:grid-cols-[minmax(0,1fr)_320px]",children:[r.jsxs("div",{className:"rounded-xl border border-slate-200 p-4 lg:p-5",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("div",{className:"grid flex-1 gap-x-6 gap-y-5 sm:grid-cols-3",children:[r.jsx($,{label:(W==null?void 0:W.periodMode)==="account-assigned"?"Deposit Frequency":"Tax Period",required:(W==null?void 0:W.taxPeriodRequired)??!0,info:(W==null?void 0:W.periodMode)==="account-assigned"?"The deposit frequency assigned to your state tax account.":(W==null?void 0:W.taxPeriodRequired)===!1?"Optional for a bill payment — the notice already states the billed period.":"The tax period this payment covers.",error:(T=z.taxPeriod)==null?void 0:T.message,children:r.jsxs(Lt,{children:[r.jsx(Ye,{name:"taxPeriod",control:N,render:({field:L})=>r.jsxs("select",{className:Nt(!!z.taxPeriod),...L,children:[r.jsx("option",{value:"",children:"Select Tax Period"}),we.map(he=>r.jsx("option",{value:he.value,children:he.label},he.value))]})}),r.jsx(Tt,{})]})}),r.jsx($,{label:"Tax Amount",required:!0,info:"The total amount to remit to the state.",error:(Z=z.taxAmount)==null?void 0:Z.message,children:r.jsx(Ye,{name:"taxAmount",control:N,render:({field:L})=>r.jsx(_n,{name:L.name,value:L.value,onChange:L.onChange,onBlur:L.onBlur,disabled:n,placeholder:"$",hasError:!!z.taxAmount})})}),r.jsx($,{label:"Payment Date",required:!0,info:"The weekday the payment will be withdrawn and settled with the state.",error:(se=z.paymentDate)==null?void 0:se.message,children:r.jsx(Ye,{name:"paymentDate",control:N,render:({field:L})=>r.jsx(uo,{value:L.value,onChange:L.onChange,hasError:!!z.paymentDate,disabled:n})})})]}),me?r.jsx(bd,{label:"Remove tax period row 1",title:"The first tax period can't be removed",disabled:!0}):null]}),me?r.jsx(Cx,{rows:ct,taxPeriodOptions:we,onChange:st,onRemove:Pt,onAdd:pt,disabled:n}):null]}),r.jsx(bx,{enabled:me,onChange:It,frequency:Se,endDate:pe,onEndDateChange:L=>{Ue(L),Be(null)},endDateError:$e??void 0,disabled:n})]})]}),n?r.jsxs("fieldset",{disabled:!0,className:Bl,children:[r.jsx("h4",{className:Na,children:"Bank Account"}),r.jsxs("div",{className:"mt-5 space-y-5",children:[r.jsxs("div",{className:Ul,children:[r.jsx(Ye,{name:"bankAccountDetailId",control:N,render:({field:L})=>{var he;return r.jsx(ld,{value:L.value??"",onChange:L.onChange,entityId:(e==null?void 0:e.entityId)??null,bankAccounts:y,isLoading:g,disabled:!e||!Re||n,error:(he=z.bankAccountDetailId)==null?void 0:he.message,label:"Account Number",info:"Select the bank account to debit for this payment, or add a new one."})}}),r.jsx($,{label:"Routing Number",required:!0,info:"The 9-digit bank routing number, auto-filled from the selected bank account.",children:r.jsx("input",{readOnly:!0,placeholder:"9-digit",className:ie(!1,!0),...j("routingNumber")})}),r.jsx($,{label:"Account Type",required:!0,info:"The bank account type (checking or savings), auto-filled from the selected bank account.",children:r.jsx("input",{readOnly:!0,placeholder:"Select",className:ie(!1,!0),...j("accountType")})})]}),r.jsx("div",{className:Ul,children:r.jsx($,{label:"Bank Name",info:"The name of the bank, auto-filled from the selected bank account.",children:r.jsx("input",{readOnly:!0,placeholder:"e.g. Chase Bank",className:ie(!1,!0),...j("bankName")})})})]})]}):null,W!=null&&W.notes.length?r.jsx("div",{className:"mt-5 rounded-lg bg-amber-50 px-4 py-3 text-xs text-amber-800",children:W.notes.map(L=>r.jsx("p",{children:L},L))}):null]}),r.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:oe,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50",children:n?"Back":"Cancel"}),n?null:r.jsxs("button",{type:"submit",disabled:!e||!Re,className:"inline-flex h-11 min-w-[120px] items-center justify-center gap-2 rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:["Next",r.jsx(Wx,{})]})]})]},i.key)}function Wx(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"})})}function Sd(){const{selectedEntity:e}=ht();return r.jsx(Nd,{entity:e})}function kd(){var l;const{statePaymentId:e}=Bs(),{selectedEntity:t}=ht(),n=Number.parseInt(e??"",10),{data:s,isLoading:a,isError:i}=de({queryKey:["state-payments",n],queryFn:()=>ed(n),enabled:t!==null&&Number.isFinite(n)}),o=x.useMemo(()=>s?{statePaymentDetailId:s.statePaymentDetailId,state:s.state,reasonForPayment:s.reasonForPayment??"",stateAccountId:s.stateAccountId??"",accountId:s.accountId??"",letterId:s.letterId??"",taxYear:s.taxYear??"",taxPeriod:s.taxPeriod??"",taxAmount:String(s.taxAmount),paymentDate:s.paymentDate,bankAccountDetailId:s.bankAccountDetailId?String(s.bankAccountDetailId):""}:null,[s]);return Number.isFinite(n)?a?r.jsx("p",{className:"px-6 py-12 text-sm text-slate-500",children:"Loading state payment…"}):i||!s||!o?r.jsx(He,{to:Ge(),replace:!0}):!t||s.entityId!==t.entityId?r.jsx(He,{to:Ge(),replace:!0}):((l=s.status)==null?void 0:l.toLowerCase())!=="draft"?r.jsx(He,{to:`/payments/state/${n}/view`,replace:!0}):r.jsx(Nd,{entity:t,initialDraft:o}):r.jsx(He,{to:Ge(),replace:!0})}function Ad(){var l,c;const{statePaymentId:e}=Bs(),t=Ie(),{selectedEntity:n}=ht(),s=Number.parseInt(e??"",10),{data:a,isLoading:i,isError:o}=de({queryKey:["state-payments",s],queryFn:()=>ed(s),enabled:n!==null&&Number.isFinite(s)});return Number.isFinite(s)?i?r.jsx("p",{className:"px-6 py-12 text-sm text-slate-500",children:"Loading state payment…"}):o||!a?r.jsx(He,{to:"/payments",replace:!0}):!n||a.entityId!==n.entityId?r.jsx(He,{to:"/payments",replace:!0}):r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>t("/payments"),className:"inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white px-3 py-2 text-sm font-medium text-slate-600 transition hover:bg-slate-50",children:[r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})}),"Back to Payments"]}),r.jsxs("h1",{className:"text-lg font-semibold text-slate-900",children:["State Payment ST-",a.statePaymentDetailId]})]}),r.jsx("div",{className:"w-full rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",children:r.jsxs("dl",{className:"grid gap-x-8 gap-y-5 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"State"}),r.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:a.state})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Tax Period"}),r.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:a.taxPeriod??"—"})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Amount"}),r.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:Nr(a.taxAmount)})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Payment Date"}),r.jsx("dd",{className:"mt-1 text-sm font-medium text-slate-900",children:a.paymentDate})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Status"}),r.jsx("dd",{className:"mt-1",children:r.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ${((l=a.status)==null?void 0:l.toLowerCase())==="paid"?"bg-green-100 text-green-800":((c=a.status)==null?void 0:c.toLowerCase())==="rejected"?"bg-red-100 text-red-800":"bg-slate-100 text-slate-700"}`,children:a.status??"—"})})]}),a.reason&&r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Rejection Reason"}),r.jsx("dd",{className:"mt-1 text-sm text-slate-700",children:a.reason})]})]})})]}):r.jsx(He,{to:"/payments",replace:!0})}const Yl=160,Yx=88,us=8;function Hx({account:e,entityId:t,onEdit:n,variant:s="button"}){const a=At(),{showSuccess:i,showError:o}=Ks(),l=x.useRef(null),c=x.useRef(null),[d,u]=x.useState(!1),[h,m]=x.useState(!1),[f,p]=x.useState({}),g=()=>{var S;const C=l.current;if(!C)return;const b=C.getBoundingClientRect(),j=((S=c.current)==null?void 0:S.offsetHeight)??Yx,A=window.innerHeight-b.bottom<j+us;p({position:"fixed",top:A?b.top-j-us:b.bottom+us,left:Math.max(us,b.right-Yl),width:Yl,zIndex:50})};x.useLayoutEffect(()=>{d&&(g(),requestAnimationFrame(g))},[d]),x.useEffect(()=>{if(!d)return;const C=j=>{var A,S;const N=j.target;(A=l.current)!=null&&A.contains(N)||(S=c.current)!=null&&S.contains(N)||u(!1)},b=()=>g();return document.addEventListener("mousedown",C),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{document.removeEventListener("mousedown",C),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[d]);const y=async()=>{const C=Gn(e);m(!0);try{await Ju(e.bankAccountDetailId,{status:hx(e)}),await a.invalidateQueries({queryKey:["bank-accounts",t]}),u(!1),C?i("Bank Account Deactivated","Bank account deactivated successfully."):i("Bank Account Activated","Bank account activated successfully.")}catch(b){o("Action Not Completed",rt(b,"Cannot deactivate this bank account because it is linked to a payment that has not been accepted yet."))}finally{m(!1)}};return r.jsxs("div",{className:"inline-block text-left",children:[r.jsx("button",{ref:l,type:"button",disabled:h,"aria-label":s==="kebab"?"Bank account actions":void 0,"aria-haspopup":"menu","aria-expanded":d,onClick:()=>u(C=>!C),className:s==="kebab"?"inline-flex h-7 w-7 items-center justify-center rounded-md text-slate-400 transition hover:bg-slate-100 hover:text-slate-600 disabled:cursor-not-allowed disabled:opacity-60":"inline-flex items-center gap-1.5 rounded-lg bg-gov-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:s==="kebab"?r.jsx(Kx,{}):r.jsxs(r.Fragment,{children:["Actions",r.jsx(Qx,{})]})}),d?jn.createPortal(r.jsxs("div",{ref:c,role:"menu",style:f,className:"overflow-hidden rounded-lg border border-slate-200 bg-white py-1 shadow-lg",children:[r.jsx("button",{type:"button",onClick:()=>{u(!1),n(e)},className:"block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-50",children:"Edit"}),r.jsx("button",{type:"button",disabled:h,onClick:()=>void y(),className:"block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-50 disabled:opacity-60",children:fx(e)})]}),document.body):null]})}function Kx(){return r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"5",r:"1.6"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.6"}),r.jsx("circle",{cx:"12",cy:"19",r:"1.6"})]})}function Qx(){return r.jsx("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})}function Pd({account:e,onEdit:t,onSelect:n,selected:s=!1}){const a=Gn(e),i=r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-slate-100 text-slate-500",children:r.jsx(Fs,{})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-semibold text-slate-900",children:e.bankName}),r.jsxs("span",{className:"mt-0.5 flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-slate-500",children:ci(e.accountNumber)}),r.jsx($i,{active:a})]}),r.jsx("span",{className:"mt-0.5 block truncate text-xs text-slate-400",children:e.accountType})]})]});return r.jsxs("div",{className:`flex items-start gap-2 rounded-xl border p-4 transition ${s?"border-gov-500 bg-gov-50/30 ring-1 ring-gov-200":"border-slate-200 bg-white"} ${a&&n?"hover:border-gov-300":""} ${a?"":"opacity-60"}`,children:[n?r.jsx("button",{type:"button",role:"radio","aria-checked":s,disabled:!a,onClick:()=>n(e.bankAccountDetailId),className:`flex min-w-0 flex-1 items-center gap-3 text-left ${a?"":"cursor-not-allowed"}`,children:i}):r.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:i}),r.jsx(Hx,{variant:"kebab",account:e,entityId:e.entityId,onEdit:t})]})}function Id({onAddManually:e,disabled:t=!1}){return r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-sm text-slate-600",children:"Connect Your Bank Account"}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-4",children:[r.jsxs("div",{className:"relative",children:[r.jsxs("span",{className:"absolute -top-2.5 right-3 z-10 inline-flex items-center gap-1 rounded-full border border-slate-200 bg-white px-2 py-0.5 text-[11px] font-semibold text-slate-500",children:[r.jsx(Gx,{}),"Coming Soon"]}),r.jsx("button",{type:"button",disabled:!0,"aria-label":"Connect with Plaid — coming soon",className:"flex h-[52px] w-[264px] cursor-not-allowed items-center rounded-lg border border-slate-200 bg-slate-50 px-4 text-sm font-semibold text-slate-400",children:"Connect with Plaid"})]}),r.jsx("button",{type:"button",onClick:e,disabled:t,className:"flex h-[52px] w-[264px] items-center rounded-lg border border-slate-400 bg-gov-50/40 px-4 text-sm font-semibold text-slate-900 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Add Manually"})]})]})}function Gx(){return r.jsxs("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("circle",{cx:"12",cy:"12",r:"9"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7.5V12l3 2"})]})}function Ed(e){const t=Ie(),n=At(),s=async o=>{await n.invalidateQueries({queryKey:["dashboard"]}),await n.invalidateQueries({queryKey:["state-payments"]}),await n.invalidateQueries({queryKey:["remittance-payments"]}),o&&n.removeQueries({queryKey:["state-payments",o],exact:!0})},a=async o=>{if(!e)return null;if(o.statePaymentDetailId){const c=await e9(o.statePaymentDetailId,Fx(o));return await s(c.statePaymentDetailId),c}const l=await $4(Lx(e.entityId,o));return la({...o,statePaymentDetailId:l.statePaymentDetailId}),await s(l.statePaymentDetailId),l};return{upsertPayment:a,saveAsDraft:async o=>{e&&(await a(o),Cd(),t(Ge()))}}}const Jx=Gt({bankAccountDetailId:F().min(1,"Select a bank account")}),Xx=["Payment Details","Bank Account","Review & Authorize"],_x="w-full rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8";function $x({entity:e,paymentDraft:t}){const n=Ie(),s=Ae(),a=Sn(s.state,Ge()),[i,o]=x.useState(null),[l,c]=x.useState(!1),[d,u]=x.useState(!1),[h,m]=x.useState(!1),[f,p]=x.useState(null),{saveAsDraft:g}=Ed(e),{data:y=[],isLoading:C}=de({queryKey:["bank-accounts",e==null?void 0:e.entityId],queryFn:()=>kn(e.entityId),enabled:e!==null}),b=x.useMemo(()=>y.filter(Gn),[y]),j=y.length>0,{handleSubmit:N,watch:A,setValue:S,formState:{errors:R}}=Ut({resolver:Bt(Jx),defaultValues:{bankAccountDetailId:t.bankAccountDetailId}}),E=A("bankAccountDetailId"),z=b.find(q=>String(q.bankAccountDetailId)===E);x.useEffect(()=>{C||E&&!z&&S("bankAccountDetailId","")},[C,z,E,S]);const X=q=>({...t,bankAccountDetailId:q.bankAccountDetailId,routingNumber:(z==null?void 0:z.routingNumber)??t.routingNumber,accountType:(z==null?void 0:z.accountType)??t.accountType,bankName:(z==null?void 0:z.bankName)??t.bankName}),H=N(q=>{const B=X(q);la(B),n("/payments/state/authorization",{state:{from:"/payments/state/bank-details",paymentDraft:B}})}),_=N(async q=>{if(e){o(null),c(!0);try{await g(X(q))}catch(B){o(rt(B,"Failed to save draft."))}finally{c(!1)}}}),V=()=>{n("/payments/state/new",{state:{from:a,paymentDraft:t}})};return r.jsxs("form",{onSubmit:H,noValidate:!0,className:"w-full",children:[r.jsxs("div",{className:"mb-6 flex w-full flex-col gap-4 md:flex-row md:items-center",children:[r.jsx("h2",{className:"shrink-0 text-[28px] font-bold leading-tight text-slate-900",children:"State Tax Payment"}),r.jsx("div",{className:"flex min-w-0 flex-1 justify-center",children:r.jsx(Sr,{steps:Xx,current:2,completed:E?2:1})})]}),i?r.jsx("div",{className:"mb-4",children:r.jsx(Zt,{message:i})}):null,r.jsxs("section",{className:`${_x} min-h-[420px]`,children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-lg border border-slate-200 bg-slate-50 text-slate-500",children:r.jsx(Fs,{})}),r.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Bank Details"})]}),j?r.jsxs("button",{type:"button",onClick:()=>u(!0),disabled:!e,className:"inline-flex h-10 items-center gap-2 rounded-lg border border-gov-300 bg-white px-4 text-sm font-medium text-gov-700 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(Fs,{}),"Add Bank"]}):null]}),j?r.jsxs(r.Fragment,{children:[r.jsx("div",{role:"radiogroup","aria-label":"Bank account to debit",className:"mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:y.map(q=>r.jsx(Pd,{account:q,selected:String(q.bankAccountDetailId)===E,onSelect:B=>S("bankAccountDetailId",String(B),{shouldValidate:!0}),onEdit:p},q.bankAccountDetailId))}),R.bankAccountDetailId?r.jsx("p",{className:"mt-3 text-xs text-red-600",children:R.bankAccountDetailId.message}):null]}):r.jsx("div",{className:"mt-6",children:r.jsx(Id,{onAddManually:()=>m(!0),disabled:!e})})]}),r.jsx(io,{open:d,onClose:()=>u(!1),onAddManually:()=>{u(!1),m(!0)}}),r.jsx(Zr,{open:h,entityId:(e==null?void 0:e.entityId)??null,onClose:()=>m(!1),onSaved:q=>S("bankAccountDetailId",String(q),{shouldValidate:!0})}),r.jsx(Zr,{open:f!==null,entityId:(e==null?void 0:e.entityId)??null,account:f,onClose:()=>p(null)}),r.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("button",{type:"button",onClick:V,className:"inline-flex h-11 min-w-[120px] items-center justify-center gap-2 rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50",children:[r.jsx(e7,{}),"Back"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:_,disabled:!e||l,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:l?"Saving…":"Save as Draft"}),r.jsx("button",{type:"submit",disabled:!e||!E,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:"Next"})]})]})]})}function e7(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})})}function Td(){const{selectedEntity:e}=ht(),t=Ae(),{paymentDraft:n}=t.state??{},s=n??qs();return s?r.jsx($x,{entity:e,paymentDraft:s}):r.jsx(He,{to:"/payments/state/new",replace:!0})}function t7({entity:e,paymentDraft:t}){var p,g,y;const n=(e==null?void 0:e.entityId)??null,{data:s=[]}=de({queryKey:["state-payment-states"],queryFn:({signal:C})=>_u(C)}),{data:a=[]}=de({queryKey:["state-payment-reasons",n,t.state],queryFn:({signal:C})=>so(n,t.state,C),enabled:n!==null&&!!t.state}),{data:i}=de({queryKey:["state-payment-validation-metadata",n,t.state,t.reasonForPayment],queryFn:({signal:C})=>$u(n,t.state,t.reasonForPayment,C),enabled:n!==null&&!!(t.state&&t.reasonForPayment)}),{data:o=[]}=de({queryKey:["bank-accounts",n],queryFn:()=>kn(n),enabled:n!==null}),l=(p=s.find(C=>C.code===t.state))==null?void 0:p.name,c=((g=a.find(C=>C.code===t.reasonForPayment))==null?void 0:g.label)??(i==null?void 0:i.reasonLabel),d=[l??t.state,c].filter(Boolean).join(" "),u=((y=i==null?void 0:i.taxPeriodOptions.find(C=>C.value===t.taxPeriod))==null?void 0:y.label)??t.taxPeriod,h=o.find(C=>String(C.bankAccountDetailId)===t.bankAccountDetailId),m=[(h==null?void 0:h.bankName)??t.bankName,h?`***${h.accountNumber.replace(/\D/g,"").slice(-4)}`:null].filter(Boolean).join(", "),f=[["Jurisdiction",d||"—"],["Tax Period",u||"—"],["Payment amount",Z9(t.taxAmount)],["Payment Date",t.paymentDate?oo(t.paymentDate):"—"],["Bank Details",m||"—"]];return r.jsxs("aside",{className:"rounded-2xl bg-gov-50/70 p-5",children:[r.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Review Payment"}),r.jsx("div",{className:"mt-4 rounded-xl bg-white p-4",children:r.jsx("dl",{className:"divide-y divide-slate-100",children:f.map(([C,b])=>r.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 first:pt-0 last:pb-0",children:[r.jsx("dt",{className:"text-xs text-slate-500",children:C}),r.jsx("dd",{className:"text-right text-sm font-semibold text-slate-900",children:b})]},C))})})]})}const n7="Before your payment is processed, please review the information carefully. By proceeding, you authorize to initiate this payment to the selected tax authority using your chosen bank account. You acknowledge that you are responsible for ensuring the accuracy of the payment information and for complying with all applicable tax filing and payment requirements.",r7="I have reviewed the details and authorize this payment.",Ld=/^[a-zA-Z\s]+$/;function Fd(e){return e.replace(/[^a-zA-Z\s]/g,"")}const yo=F().min(1,"Signature is required").regex(Ld,"Signature must contain only letters").refine(e=>e.trim().length>0,{message:"Signature is required"}),s7=F().optional().refine(e=>!e||!e.trim()||Ld.test(e),{message:"Signature must contain only letters"}),a7=Gt({agreementDate:F().min(1,"Date is required"),agreementAccepted:er().refine(e=>e,{message:"You must accept the authorization agreement"}),authorizationPersonName:F().min(1,"Name of authorization person is required"),signature:yo,title:F().min(1,"Title is required")}),i7="w-full rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",o7="rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 text-center",ka="rounded-t-lg border-b-2 border-slate-700 bg-[#F9FAFB] px-4 py-3",l7=["Payment Details","Bank Account","Review & Authorize"];function c7(){return{agreementDate:new Date().toISOString().slice(0,10),agreementAccepted:!1,authorizationPersonName:"",signature:"",title:""}}function u7({entity:e,paymentDraft:t}){const n=Ie(),s=Ae(),a=Sn(s.state,Ge()),[i,o]=x.useState(null),[l,c]=x.useState(!1),d=x.useMemo(()=>c7(),[]),{register:u,handleSubmit:h,watch:m,formState:{errors:f}}=Ut({resolver:Bt(a7),defaultValues:d}),p=m("agreementDate"),g=m("signature"),y=!!(g!=null&&g.trim()),C=u("signature"),{saveAsDraft:b}=Ed(e),j=()=>b(t),N=h(async()=>{if(e){o(null),c(!0);try{await j()}catch(S){o(rt(S,"Failed to save state payment."))}finally{c(!1)}}}),A=h(async()=>{if(e){o(null),c(!0);try{await j()}catch(S){o(rt(S,"Failed to save draft."))}finally{c(!1)}}});return r.jsxs("form",{onSubmit:N,noValidate:!0,className:"w-full",children:[r.jsxs("div",{className:"mb-6 flex w-full flex-col gap-4 md:flex-row md:items-center",children:[r.jsx("h2",{className:"shrink-0 text-[28px] font-bold leading-tight text-slate-900",children:"State Tax Payment"}),r.jsx("div",{className:"flex min-w-0 flex-1 justify-center",children:r.jsx(Sr,{steps:l7,current:3})})]}),r.jsxs("div",{className:"grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_390px]",children:[r.jsxs("section",{className:`${i7} min-h-[500px]`,children:[r.jsxs("div",{className:"flex items-end justify-between gap-4 border-b border-slate-300 pb-4",children:[r.jsx("h3",{className:"text-base font-semibold text-slate-900",children:"Authorization"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-slate-600",children:"Date"}),r.jsx("span",{className:`${o7} min-w-[128px] py-2 text-sm text-slate-500`,children:oo(p)}),r.jsx("input",{type:"hidden",...u("agreementDate")})]})]}),r.jsx("p",{className:"mt-5 text-sm leading-relaxed text-slate-600",children:n7}),r.jsxs("label",{className:"mt-5 flex cursor-pointer items-start gap-3",children:[r.jsx("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...u("agreementAccepted")}),r.jsx("span",{className:"text-sm leading-6 text-slate-700",children:r7})]}),f.agreementAccepted?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:f.agreementAccepted.message}):null,r.jsxs("div",{className:"mt-8 grid gap-6 sm:grid-cols-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:ka,children:r.jsx("input",{placeholder:"John Doe",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 placeholder:text-slate-400 focus:outline-none",...u("authorizationPersonName")})}),r.jsx("p",{className:"mt-2 text-center text-xs text-slate-700",children:"Name of Authorized Person"}),f.authorizationPersonName?r.jsx("p",{className:"mt-1 text-center text-xs text-red-600",children:f.authorizationPersonName.message}):null]}),r.jsxs("div",{children:[r.jsx("div",{className:ka,children:r.jsx("input",{placeholder:"Accountant",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 placeholder:text-slate-400 focus:outline-none",...u("title")})}),r.jsx("p",{className:"mt-2 text-center text-xs text-slate-700",children:"Title"}),f.title?r.jsx("p",{className:"mt-1 text-center text-xs text-red-600",children:f.title.message}):null]}),r.jsxs("div",{children:[r.jsx("div",{className:ka,children:r.jsx("input",{placeholder:"John Doe",autoComplete:"off",spellCheck:!1,className:`w-full border-0 bg-transparent text-center focus:outline-none ${y?"text-2xl leading-tight tracking-wide text-slate-800":"text-sm text-slate-400 placeholder:text-slate-400"}`,style:y?{fontFamily:"'Great Vibes', 'Segoe Script', cursive"}:void 0,name:C.name,ref:C.ref,onBlur:C.onBlur,onChange:S=>{const R=Fd(S.target.value);S.target.value=R,C.onChange(S)}})}),r.jsx("p",{className:"mt-2 text-center text-xs text-slate-700",children:"Signature"}),f.signature?r.jsx("p",{className:"mt-1 text-center text-xs text-red-600",children:f.signature.message}):null]})]})]}),r.jsx(t7,{entity:e,paymentDraft:t})]}),i?r.jsx("div",{className:"mt-5",children:r.jsx(Zt,{message:i})}):null,r.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>{la(t),n("/payments/state/bank-details",{state:{from:a,paymentDraft:t}})},disabled:l,className:"inline-flex h-11 min-w-[120px] items-center justify-center gap-2 rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(d7,{}),"Back"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:A,disabled:l||!e,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Save as Draft"}),r.jsx("button",{type:"submit",disabled:l||!e,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:"Submit Payment"})]})]})]})}function d7(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})})}function Rd(){const{selectedEntity:e}=ht(),t=Ae(),{paymentDraft:n}=t.state??{},s=n??qs();return s?s.bankAccountDetailId?r.jsx(u7,{entity:e,paymentDraft:s}):r.jsx(He,{to:"/payments/state/bank-details",replace:!0,state:{paymentDraft:s}}):r.jsx(He,{to:"/payments/state/new",replace:!0})}const bo="/portal/federal-payments/form-8655-authorizations";function m7(e){return fe(bo,{method:"POST",body:e})}function h7(e){return fe(`${bo}/by-enrolment/${e}`)}function f7(e,t){return fe(`${bo}/${e}`,{method:"PATCH",body:t})}async function Dd(e){try{return await h7(e)}catch(t){if(t instanceof vr&&t.status===404)return null;throw t}}const ui=["720","940","941","943","944","945","990-PF","990-T","1041","1042","1120","CT-1"];function p7(e){const t=e.trim();return ui.includes(t)?t:""}const x7="I understand that this agreement does not relieve me, as the taxpayer, of the responsibility to ensure that all tax returns are filed and that all deposits and payments are made and that I may enroll in the Electronic Federal Tax Payment System (EFTPS) to view deposits and payments made on my behalf.",g7="I further understand that this agreement does not authorize the reporting agent to sign any tax returns, to otherwise act as a legal representative of the taxpayer, or to represent the taxpayer before the IRS. I also understand that the reporting agent is not responsible for any penalties or interest that may be assessed against the taxpayer. I authorize the reporting agent to complete Form 8655, Reporting Agent Authorization, and to make deposits and payments on my behalf for the tax return(s) indicated above. I also authorize the reporting agent to receive confidential information and to perform acts as specified on Form 2848, Power of Attorney and Declaration of Representative, or Form 8821, Tax Information Authorization, as applicable.";function di({label:e,required:t=!1,signature:n,title:s,date:a,signatureValue:i,dateValue:o="",dateReadOnly:l=!0,errors:c,signatureCaption:d="Signature of taxpayer"}){const u=!!(i!=null&&i.trim()),{onChange:h,onBlur:m,name:f,ref:p}=n;return r.jsxs("div",{children:[e?r.jsxs("p",{className:"mb-3 text-sm font-medium text-gov-600",children:[e,t?r.jsx("span",{className:"text-red-500",children:" *"}):null]}):null,r.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,0.8fr)_minmax(0,0.8fr)] lg:items-end",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 py-6",children:[r.jsx("input",{ref:p,name:f,placeholder:"Sign here",autoComplete:"off",spellCheck:!1,className:`w-full border-0 bg-transparent text-center focus:outline-none ${u?"text-4xl leading-tight tracking-wide text-slate-800":"text-sm text-slate-400 placeholder:text-slate-400"}`,style:u?{fontFamily:"'Great Vibes', 'Segoe Script', cursive"}:void 0,onBlur:m,onChange:g=>{const y=Fd(g.target.value);g.target.value=y,h(g)}}),r.jsx("div",{className:"mt-8 border-t border-slate-400"}),r.jsx("p",{className:"mt-2 text-center text-xs text-slate-500",children:d})]}),c!=null&&c.signature?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:c.signature}):null]}),r.jsxs("div",{children:[r.jsxs("div",{className:"rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 py-8",children:[r.jsx("input",{placeholder:"Enter title",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 placeholder:text-slate-400 focus:outline-none",...s}),r.jsx("div",{className:"mt-8 border-t border-slate-400"}),r.jsx("p",{className:"mt-2 text-center text-xs text-slate-500",children:"Title"})]}),c!=null&&c.title?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:c.title}):null]}),r.jsxs("div",{children:[r.jsxs("div",{className:"rounded-lg border border-slate-200 bg-[#F9FAFB] px-4 py-8",children:[l?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-center text-sm text-slate-700",children:oo(o)}),r.jsx("input",{type:"hidden",...a})]}):r.jsx("input",{type:"date",className:"w-full border-0 bg-transparent text-center text-sm text-slate-700 focus:outline-none",...a}),r.jsx("div",{className:"mt-8 border-t border-slate-400"}),r.jsx("p",{className:"mt-2 text-center text-xs text-slate-500",children:"Date"})]}),c!=null&&c.date?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:c.date}):null]})]})]})}function y7(e){return e.replace(/\D/g,"")}function Md(e,t){var n,s;return{enrollmentId:e,taxpayerName:t.taxpayerName.trim(),tradeName:t.tradeName.trim(),ein:y7(t.ein),address:t.address.trim(),city:t.city.trim(),state:t.state.trim(),zipCode:t.zipCode.trim(),country:t.country.trim(),isSeasonalEmployer:t.isSeasonalEmployer,otherIdentificationNumber:((n=t.otherIdentificationNumber)==null?void 0:n.trim())||null,contactPerson:t.contactPerson.trim(),daytimePhone:t.daytimePhone.trim(),faxNumber:t.faxNumber.trim(),authorizedTaxForm:t.authorizedTaxForm,authorizationStartMonth:((s=t.authorizationMonth)==null?void 0:s.trim())||null,agreementAccepted:t.agreementAccepted,taxpayerSignature:t.signature.trim()||null,taxpayerTitle:t.title.trim(),signatureDate:t.signatureDate}}function b7(e){const{enrollmentId:t,...n}=Md(0,e);return n}function v7(e){return{taxpayerName:e.taxpayerName,tradeName:e.tradeName,ein:Zi(e.ein),address:e.address,city:e.city,state:e.state,zipCode:e.zipCode,country:e.country,isSeasonalEmployer:e.isSeasonalEmployer,otherIdentificationNumber:e.otherIdentificationNumber??"",contactPerson:e.contactPerson,daytimePhone:sn(e.daytimePhone),faxNumber:e.faxNumber,authorizedTaxForm:e.authorizedTaxForm,authorizationMonth:e.authorizationStartMonth??"",agreementAccepted:e.agreementAccepted,signature:e.taxpayerSignature??"",title:e.taxpayerTitle,signatureDate:e.signatureDate}}const C7=Gt({taxpayerName:F().min(1,"Taxpayer name is required"),tradeName:F().optional(),ein:F().min(1,"EIN is required"),address:F().min(1,"Address is required"),city:F().min(1,"City is required"),state:F().min(1,"State is required"),zipCode:F().min(1,"ZIP code is required"),country:F().min(1,"Country is required"),isSeasonalEmployer:er(),otherIdentificationNumber:F().optional(),contactPerson:F().optional(),daytimePhone:F().min(1,"Daytime telephone number is required"),faxNumber:F().default(""),authorizedTaxForm:F().min(1,"Select a tax form"),authorizationMonth:F().optional().refine(e=>!e||/^\d{4}\/(0[1-9]|1[0-2])$/.test(e),"Enter the month as YYYY/MM (e.g. 2024/08)"),agreementAccepted:er().refine(e=>e,{message:"You must accept the authorization agreement"}),signature:yo,title:F().min(1,"Title is required"),signatureDate:F().min(1,"Date is required")}),Aa="grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3";function j7(e,t){const n=new Date().toISOString().slice(0,10);return{taxpayerName:e?Jr(e):"",tradeName:(e==null?void 0:e.tradeName)??"",ein:e?Zi(e.idNumber):"",address:[e==null?void 0:e.address1,e==null?void 0:e.address2].filter(Boolean).join(", "),city:(e==null?void 0:e.city)??"",state:(e==null?void 0:e.state)??"",zipCode:(e==null?void 0:e.zipCode)??"",country:(e==null?void 0:e.country)??"United States",isSeasonalEmployer:!1,otherIdentificationNumber:"",contactPerson:"",daytimePhone:e?sn(e.phoneNumber):"",faxNumber:"",authorizedTaxForm:p7(t.taxFormType),authorizationMonth:"",agreementAccepted:!1,signature:"",title:"",signatureDate:n}}function w7({entity:e,paymentDraft:t,initialAuthorization:n=null,readonly:s=!1}){var ee,W,ue,we,Re,Ce,Oe,Ne,ve,Pe,ne,Se,U,me;const a=Ie(),i=Ae(),o=At(),l=Sn(i.state,Ge()),[c,d]=x.useState(null),[u,h]=x.useState(!1),m=x.useMemo(()=>n?v7(n):j7(e,t),[e,n,t]),{register:f,handleSubmit:p,watch:g,setValue:y,reset:C,formState:{errors:b}}=Ut({resolver:Bt(C7),defaultValues:m});x.useEffect(()=>{C(m)},[m,C]);const j=g("authorizedTaxForm"),N=g("signature"),A=g("signatureDate"),S=g("country"),R=g("isSeasonalEmployer"),E=Yn(S),z=!0,X=async()=>{await o.invalidateQueries({queryKey:["dashboard"]}),await o.invalidateQueries({queryKey:["federal-payments"]}),await o.invalidateQueries({queryKey:["remittance-payments"]})},H=async()=>{if(!e)return null;if(t.federalPaymentId){const pe=await ro(t.federalPaymentId,fo(t));return await X(),pe}const Q=await no(ho(e.entityId,t));return xo({...t,federalPaymentId:Q.federalPaymentId,enrollmentId:Q.enrollmentId}),await X(),Q},_=async(Q,pe)=>{var Be;const Ue=t.form8655AuthorizationId??((Be=await Dd(Q))==null?void 0:Be.form8655AuthorizationId),$e=pe;return Ue?f7(Ue,b7($e)):m7(Md(Q,$e))},V=async Q=>{if(!e)return;const pe=await H();pe&&(await _(pe.enrollmentId,Q),await o.invalidateQueries({queryKey:["form-8655",pe.enrollmentId]}),oa(),a(Ge()))},q=p(async Q=>{if(!(!e||s)){d(null),h(!0);try{await V(Q)}catch(pe){d(rt(pe,"Failed to save federal payment draft."))}finally{h(!1)}}}),B=p(async Q=>{if(!(!e||s)){d(null),h(!0);try{await V(Q)}catch(pe){d(rt(pe,"Failed to save draft."))}finally{h(!1)}}});return r.jsxs("form",{onSubmit:q,noValidate:!0,className:"w-full space-y-6",children:[r.jsxs("div",{className:"w-full",children:[r.jsxs("div",{className:"mb-4 flex w-full flex-col gap-4 md:flex-row md:items-center",children:[r.jsx("h2",{className:"shrink-0 text-[28px] font-bold leading-tight text-slate-900",children:"Federal Tax Payment"}),!s&&r.jsx("div",{className:"flex min-w-0 flex-1 justify-center",children:r.jsx(Sr,{steps:lo,current:2})})]}),r.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",children:r.jsxs("fieldset",{disabled:s,className:"min-w-0 border-0 p-0",children:[r.jsx(bn,{title:"Enrollment Details",isFirst:!0,children:r.jsxs("div",{className:"w-3/4",children:[r.jsxs("div",{className:Aa,children:[r.jsx($,{label:"1. a) Name of the Taxpayer",required:!0,info:"The taxpayer's legal name as registered with the IRS.",error:(ee=b.taxpayerName)==null?void 0:ee.message,children:r.jsx("input",{placeholder:"Enter Name of the Taxpayer",className:ie(!!b.taxpayerName),...f("taxpayerName")})}),r.jsx($,{label:"1. b) Trade Name, if any",error:(W=b.tradeName)==null?void 0:W.message,children:r.jsx("input",{placeholder:"Enter Trade Name, if any",className:ie(!!b.tradeName),...f("tradeName")})}),r.jsx($,{label:"2. Employer Identification Number (EIN)",required:!0,error:(ue=b.ein)==null?void 0:ue.message,children:r.jsx("input",{placeholder:"Enter EIN",className:ie(!!b.ein),...f("ein")})})]}),r.jsxs("div",{className:"mt-5 grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3",children:[r.jsx("div",{className:"sm:col-span-2",children:r.jsx($,{label:"3. a) Address (Number, Street, and Room/Suite No)",required:!0,error:(we=b.address)==null?void 0:we.message,children:r.jsx("input",{placeholder:"Enter Address",className:ie(!!b.address),...f("address")})})}),r.jsx($,{label:"3. b) City or Town",required:!0,error:(Re=b.city)==null?void 0:Re.message,children:r.jsx("input",{placeholder:"Enter City or Town",className:ie(!!b.city),...f("city")})})]}),r.jsxs("div",{className:`mt-5 ${Aa}`,children:[r.jsx($,{label:"3. c) State",required:!0,error:(Ce=b.state)==null?void 0:Ce.message,children:r.jsxs(Lt,{children:[r.jsxs("select",{className:Nt(!!b.state),...f("state"),children:[r.jsx("option",{value:"",children:"Select State"}),E.map(Q=>r.jsx("option",{value:Q.code,children:Q.name},Q.code))]}),r.jsx(Tt,{})]})}),r.jsx($,{label:"3. d) ZIP Code",required:!0,error:(Oe=b.zipCode)==null?void 0:Oe.message,children:r.jsx("input",{placeholder:"Enter ZIP Code",className:ie(!!b.zipCode),...f("zipCode")})}),r.jsx($,{label:"3. e) Country",required:!0,error:(Ne=b.country)==null?void 0:Ne.message,children:r.jsxs(Lt,{children:[r.jsxs("select",{className:Nt(!!b.country),...f("country"),children:[r.jsx("option",{value:"",children:"Select Country"}),ta.map(Q=>r.jsx("option",{value:Q,children:Q},Q))]}),r.jsx(Tt,{})]})})]}),r.jsxs("div",{className:`mt-5 ${Aa}`,children:[r.jsx($,{label:"4. Are a Seasonal Employer",children:r.jsxs("div",{className:"flex items-center gap-6 py-2.5",children:[r.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[r.jsx("input",{type:"checkbox",checked:R===!0,onChange:()=>y("isSeasonalEmployer",!0),className:"h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200"}),"Yes"]}),r.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[r.jsx("input",{type:"checkbox",checked:R===!1,onChange:()=>y("isSeasonalEmployer",!1),className:"h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200"}),"No"]})]})}),r.jsx($,{label:"5. Other Identification Number (Optional)",children:r.jsx("input",{placeholder:"Enter Other Identification Number",className:ie(!1),...f("otherIdentificationNumber")})}),r.jsx($,{label:"6. Contact Person",error:(ve=b.contactPerson)==null?void 0:ve.message,children:r.jsx("input",{placeholder:"Enter Contact Person",className:ie(!!b.contactPerson),...f("contactPerson")})})]}),r.jsxs("div",{className:"mt-5 grid gap-x-6 gap-y-5 sm:grid-cols-2",children:[r.jsx($,{label:"7. Daytime Telephone Number",required:!0,error:(Pe=b.daytimePhone)==null?void 0:Pe.message,children:r.jsx("input",{placeholder:"Enter Daytime Telephone Number",className:ie(!!b.daytimePhone),...f("daytimePhone")})}),r.jsx($,{label:"7. Fax Number",error:(ne=b.faxNumber)==null?void 0:ne.message,children:r.jsx("input",{placeholder:"Enter Fax Number",className:ie(!!b.faxNumber),...f("faxNumber")})})]})]})}),r.jsxs(bn,{title:r.jsxs(r.Fragment,{children:["Authorization of Reporting Agent To Make and Deposits and Payments"," ",r.jsx("span",{className:"font-normal",children:"(Caution: See Authorization Agreement.)"})]}),children:[r.jsx("p",{className:"mb-5 text-sm leading-6 text-slate-600",children:"Indicate the tax return(s) for which the reporting agent is authorized to make deposits or payments. Use the 'YYYY/MM' format to enter the month in which the authorization begins (for example, '2024/8' for August 2024)"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex flex-wrap gap-x-8 gap-y-3 justify-between",children:ui.slice(0,6).map(Q=>r.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[r.jsx("input",{type:"radio",value:Q,checked:j===Q,disabled:z,onChange:()=>y("authorizedTaxForm",Q,{shouldValidate:!0}),className:"h-4 w-4 border-slate-300 text-gov-600 focus:ring-gov-200 disabled:cursor-default"}),Q]},Q))}),r.jsx("div",{className:"flex flex-wrap gap-x-8 gap-y-3 justify-between",children:ui.slice(6).map(Q=>r.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[r.jsx("input",{type:"radio",value:Q,checked:j===Q,disabled:z,onChange:()=>y("authorizedTaxForm",Q,{shouldValidate:!0}),className:"h-4 w-4 border-slate-300 text-gov-600 focus:ring-gov-200 disabled:cursor-default"}),Q]},Q))})]}),b.authorizedTaxForm?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:b.authorizedTaxForm.message}):null]}),r.jsxs("section",{className:"mt-8 border-t border-slate-100 pt-8",children:[r.jsx("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:"Authorization Agreement"}),r.jsxs("div",{className:"border-t border-slate-200 pt-5",children:[r.jsxs("label",{className:"flex items-start gap-3",children:[r.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...f("agreementAccepted")}),r.jsxs("span",{className:"text-sm leading-6 text-slate-700",children:[r.jsx("span",{className:"font-semibold text-slate-900",children:x7})," ",g7]})]}),b.agreementAccepted?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:b.agreementAccepted.message}):null]})]}),r.jsx("section",{className:"mt-8 border-t border-slate-100 pt-8",children:r.jsx(di,{label:"Taxpayer's Signature",required:!0,signature:f("signature"),title:f("title"),date:f("signatureDate"),signatureValue:N,dateValue:A,errors:{signature:(Se=b.signature)==null?void 0:Se.message,title:(U=b.title)==null?void 0:U.message,date:(me=b.signatureDate)==null?void 0:me.message}})})]})})]}),c?r.jsx(Zt,{message:c}):null,r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:()=>a(l),disabled:u,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:B,disabled:u||!e||s,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Save as Draft"}),r.jsx("button",{type:"submit",disabled:u||!e||s,className:"inline-flex h-11 min-w-[180px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:"Review and Submit"})]})]})}function Od(){const{selectedEntity:e}=ht(),t=Ae(),{paymentDraft:n}=t.state??{},s=n??ia(),{data:a,isLoading:i}=de({queryKey:["federal-payment",s==null?void 0:s.federalPaymentId],queryFn:()=>to(s.federalPaymentId),enabled:(s==null?void 0:s.federalPaymentId)!=null&&s.enrollmentId==null}),o=(s==null?void 0:s.enrollmentId)??(a==null?void 0:a.enrollmentId),{data:l,isLoading:c}=de({queryKey:["form-8655",o],queryFn:()=>Dd(o),enabled:o!=null}),d=x.useMemo(()=>s?{...s,enrollmentId:o??s.enrollmentId,form8655AuthorizationId:s.form8655AuthorizationId??(l==null?void 0:l.form8655AuthorizationId)}:null,[s,o,l]);return s?mo(e)?r.jsx(He,{to:"/payments/federal/individual-enrollment",replace:!0,state:t.state}):s.federalPaymentId!=null&&s.enrollmentId==null&&i||o!=null&&c?r.jsx("p",{className:"text-sm text-slate-600",children:"Loading authorization form…"}):r.jsx(w7,{entity:e,paymentDraft:d??s,initialAuthorization:l}):r.jsx(He,{to:"/payments/federal/new",replace:!0})}const vo="/portal/federal-payments/form-9783-enrollments";function N7(e){return fe(vo,{method:"POST",body:e})}function S7(e){return fe(`${vo}/by-enrolment/${e}`)}function k7(e,t){return fe(`${vo}/${e}`,{method:"PATCH",body:t})}async function zd(e){try{return await S7(e)}catch(t){if(t instanceof vr&&t.status===404)return null;throw t}}const A7="I hereby authorize the contact person listed in item 5 on this form, and the financial institution(s) listed in items 9-11 on this form, to process EFTPS payments and to receive confidential information for enrollment purposes, to answer inquiries regarding my account, and to resolve any issues that may arise. This authorization includes passwords, payment instructions, taxpayer names, and identifying numbers.",P7="By completing the financial institution information in items 9-11 on this form, I authorize the designated Financial Agents of the U.S. Treasury to initiate EFTPS debit entries to my financial institution account for federal tax payments. All debits will be made in accordance with U.S. Treasury regulations. This authorization remains in effect until written notification of termination is received and the Financial Agent has had a reasonable opportunity to act on it.",I7="Under penalties of perjury, I certify that I have the authority to sign this authorization on behalf of the taxpayer. If I am a corporate officer, partner, guardian, executor, receiver, administrator, trustee, or other party, I certify that I have the authority to execute this authorization on behalf of the taxpayer. If I am a tax practitioner, I certify that Form 2848 or Form 8655 is on file with the IRS.",Pa=new Date().getFullYear(),E7=[String(Pa-1),String(Pa-2),String(Pa-3)];function ds(e){return e.replace(/\D/g,"")}function Vd(e,t){var n,s,a,i;return{enrollmentId:e,primarySsn:ds(t.primarySsn),jointFilerSsn:t.jointFilerSsn?ds(t.jointFilerSsn):null,taxpayerNames:t.taxpayerNames.trim(),primaryAddress:t.primaryAddress.trim(),city:t.city.trim(),state:t.state.trim(),zipCode:t.zipCode.trim(),country:t.country.trim(),internationalAddress:((n=t.internationalAddress)==null?void 0:n.trim())||null,primaryPhone:t.primaryPhone.trim(),primaryContactName:t.primaryContactName.trim(),primaryContactAddress:t.primaryContactAddress.trim(),contactCity:t.contactCity.trim(),contactState:t.contactState.trim(),contactZipCode:t.contactZipCode.trim(),contactCountry:t.contactCountry.trim(),contactPhone:t.contactPhone.trim(),contactInternationalAddress:((s=t.contactInternationalAddress)==null?void 0:s.trim())||null,primaryTaxpayerPin:t.primaryTaxpayerPin.trim()||null,dateOfBirth:t.dateOfBirth||null,priorYearAgi:t.priorYearAgi.trim()?Number(t.priorYearAgi):null,agiTaxYear:t.agiTaxYear.trim()||null,financialPrimarySsn:ds(t.financialPrimarySsn),routingTransitNumber:ds(t.routingTransitNumber),accountNumber:t.accountNumber.trim(),accountType:t.accountType,disclosureAgreementOne:t.disclosureAgreementOne,disclosureAgreementTwo:t.disclosureAgreementTwo,authorityAgreement:t.authorityAgreement,taxpayerSignature:t.taxpayerSignature.trim()||null,taxpayerTitle:t.taxpayerTitle.trim(),taxpayerSignatureDate:t.taxpayerSignatureDate,jointFilerSignature:((a=t.jointFilerSignature)==null?void 0:a.trim())||null,jointFilerTitle:((i=t.jointFilerTitle)==null?void 0:i.trim())||null,jointFilerSignatureDate:t.jointFilerSignatureDate||null}}function T7(e){const{enrollmentId:t,...n}=Vd(0,e);return n}function L7(e){var n;const t=((n=e.accountType)==null?void 0:n.toLowerCase())==="savings"?"Savings":"Checking";return{primarySsn:e.primarySsn,jointFilerSsn:e.jointFilerSsn??"",taxpayerNames:e.taxpayerNames,primaryAddress:e.primaryAddress,city:e.city,state:e.state,zipCode:e.zipCode,country:e.country,internationalAddress:e.internationalAddress??"",primaryPhone:sn(e.primaryPhone),primaryContactName:e.primaryContactName,primaryContactAddress:e.primaryContactAddress,contactCity:e.contactCity,contactState:e.contactState,contactZipCode:e.contactZipCode,contactCountry:e.contactCountry,contactPhone:sn(e.contactPhone),contactInternationalAddress:e.contactInternationalAddress??"",primaryTaxpayerPin:e.primaryTaxpayerPin??"",dateOfBirth:e.dateOfBirth??"",priorYearAgi:e.priorYearAgi!==null&&e.priorYearAgi!==void 0?String(e.priorYearAgi):"",agiTaxYear:e.agiTaxYear??"",financialPrimarySsn:e.financialPrimarySsn,routingTransitNumber:e.routingTransitNumber,accountNumber:e.accountNumber,accountType:t,disclosureAgreementOne:e.disclosureAgreementOne,disclosureAgreementTwo:e.disclosureAgreementTwo,authorityAgreement:e.authorityAgreement,taxpayerSignature:e.taxpayerSignature??"",taxpayerTitle:e.taxpayerTitle,taxpayerSignatureDate:e.taxpayerSignatureDate,jointFilerSignature:e.jointFilerSignature??"",jointFilerTitle:e.jointFilerTitle??"",jointFilerSignatureDate:e.jointFilerSignatureDate??""}}const F7=Gt({primarySsn:F().min(1,"Primary SSN is required"),jointFilerSsn:F().optional(),taxpayerNames:F().min(1,"Taxpayer name is required"),primaryAddress:F().min(1,"Primary address is required"),city:F().min(1,"City is required"),state:F().min(1,"State is required"),zipCode:F().min(1,"ZIP code is required"),country:F().min(1,"Country is required"),internationalAddress:F().optional(),primaryPhone:F().min(1,"Primary phone number is required"),primaryContactName:F().min(1,"Primary contact name is required"),primaryContactAddress:F().min(1,"Primary contact address is required"),contactCity:F().min(1,"Contact city is required"),contactState:F().min(1,"Contact state is required"),contactZipCode:F().min(1,"Contact ZIP code is required"),contactCountry:F().min(1,"Contact country is required"),contactPhone:F().min(1,"Contact phone number is required"),contactInternationalAddress:F().optional(),primaryTaxpayerPin:F().min(1,"Primary taxpayer PIN is required").regex(/^\d{5}$/,"Primary taxpayer PIN must be exactly 5 digits"),dateOfBirth:F().min(1,"Date of birth is required").refine(e=>O9(e,qd),{message:"You must be at least 18 years old"}),priorYearAgi:F().min(1,"Prior year adjusted gross income is required").refine(e=>!Number.isNaN(Number(e))&&Number(e)>=0,{message:"Enter a valid amount"}),agiTaxYear:F().min(1,"Prior tax year is required"),financialPrimarySsn:F().min(1,"Primary SSN is required"),routingTransitNumber:F().min(1,"Routing transit number is required"),accountNumber:F().min(1,"Account number is required"),accountType:bu([ha("Checking"),ha("Savings"),ha("")]).refine(e=>e==="Checking"||e==="Savings",{message:"Account type is required"}),disclosureAgreementOne:er().refine(e=>e,{message:"You must accept the disclosure authorization agreement"}),disclosureAgreementTwo:er().refine(e=>e,{message:"You must accept the disclosure authorization agreement"}),authorityAgreement:er().refine(e=>e,{message:"You must accept the authority agreement"}),taxpayerSignature:yo,taxpayerTitle:F().min(1,"Title is required"),taxpayerSignatureDate:F().min(1,"Date is required"),jointFilerSignature:s7,jointFilerTitle:F().optional(),jointFilerSignatureDate:F().optional()}),An="grid gap-x-6 gap-y-5 sm:grid-cols-2 xl:grid-cols-3",R7="grid gap-x-6 gap-y-5 sm:grid-cols-2 lg:grid-cols-4",D7=5,qd=18;function Zd(e){return e?e.toLowerCase()==="savings"?"Savings":"Checking":""}function Ud(e,t){return{financialPrimarySsn:(e==null?void 0:e.idNumber)??"",routingTransitNumber:t.routingNumber??"",accountNumber:t.accountNumber??"",accountType:Zd(t.accountType)}}function M7(e,t){const n=new Date().toISOString().slice(0,10),s=e?Jr(e):"";return{primarySsn:(e==null?void 0:e.idNumber)??"",jointFilerSsn:"",taxpayerNames:s,primaryAddress:(e==null?void 0:e.address1)??"",city:(e==null?void 0:e.city)??"",state:(e==null?void 0:e.state)??"",zipCode:(e==null?void 0:e.zipCode)??"",country:(e==null?void 0:e.country)??"United States",internationalAddress:"",primaryPhone:e?sn(e.phoneNumber):"",primaryContactName:"",primaryContactAddress:"",contactCity:"",contactState:"",contactZipCode:"",contactCountry:"",contactPhone:"",contactInternationalAddress:"",...Ud(e,t),primaryTaxpayerPin:"",dateOfBirth:"",priorYearAgi:"",agiTaxYear:"",disclosureAgreementOne:!1,disclosureAgreementTwo:!1,authorityAgreement:!1,taxpayerSignature:"",taxpayerTitle:"",taxpayerSignatureDate:n,jointFilerSignature:"",jointFilerTitle:"",jointFilerSignatureDate:n}}function O7({entity:e,paymentDraft:t,initialEnrollment:n=null,readonly:s=!1}){var pe,Ue,$e,Be,ct,ze,ft,pt,st,Pt,It,Mt,xt,xe,Ve,ut,Jt,K,oe,v,k,P,M,O,G;const a=Ie(),i=Ae(),o=At(),l=Sn(i.state,Ge()),[c,d]=x.useState(null),[u,h]=x.useState(!1),[m,f]=x.useState(!1),{data:p=[]}=de({queryKey:["bank-accounts",e==null?void 0:e.entityId],queryFn:()=>kn(e.entityId),enabled:(e==null?void 0:e.entityId)!=null}),g=x.useMemo(()=>{if(n)return L7(n);const T=p.find(se=>String(se.bankAccountDetailId)===t.bankAccountDetailId),Z=Ud(e,t);return{...M7(e,t),financialPrimarySsn:Z.financialPrimarySsn,routingTransitNumber:Z.routingTransitNumber||(T==null?void 0:T.routingNumber)||"",accountNumber:Z.accountNumber||(T==null?void 0:T.accountNumber)||"",accountType:Zd(t.accountType||(T==null?void 0:T.accountType))}},[e,n,t,p]),{register:y,handleSubmit:C,watch:b,setValue:j,reset:N,control:A,formState:{errors:S}}=Ut({resolver:Bt(F7),defaultValues:g});x.useEffect(()=>{N(g)},[g,N]);const R=b("taxpayerSignature"),E=b("jointFilerSignature"),z=b("taxpayerSignatureDate"),X=b("jointFilerSignatureDate"),H=b("accountType"),_=b("taxpayerNames"),V=b("primaryAddress"),q=b("city"),B=b("state"),ee=b("zipCode"),W=b("country"),ue=b("primaryPhone"),we=b("internationalAddress"),Re=Yn(W),Ce=!0,Oe=x.useMemo(()=>M9(qd),[]),Ne=()=>{j("primaryContactName",_,{shouldValidate:!0}),j("primaryContactAddress",V,{shouldValidate:!0}),j("contactCity",q,{shouldValidate:!0}),j("contactState",B,{shouldValidate:!0}),j("contactZipCode",ee,{shouldValidate:!0}),j("contactCountry",W,{shouldValidate:!0}),j("contactPhone",ue,{shouldValidate:!0}),j("contactInternationalAddress",we??"",{shouldValidate:!0})},ve=()=>{j("primaryContactName","",{shouldValidate:!0}),j("primaryContactAddress","",{shouldValidate:!0}),j("contactCity","",{shouldValidate:!0}),j("contactState","",{shouldValidate:!0}),j("contactZipCode","",{shouldValidate:!0}),j("contactCountry","",{shouldValidate:!0}),j("contactPhone","",{shouldValidate:!0}),j("contactInternationalAddress","",{shouldValidate:!0})};x.useEffect(()=>{m&&Ne()},[m,_,V,q,B,ee,W,ue,we]);const Pe=async()=>{await o.invalidateQueries({queryKey:["dashboard"]}),await o.invalidateQueries({queryKey:["federal-payments"]}),await o.invalidateQueries({queryKey:["remittance-payments"]})},ne=async()=>{if(!e)return null;if(t.federalPaymentId){const Z=await ro(t.federalPaymentId,fo(t));return await Pe(),Z}const T=await no(ho(e.entityId,t));return xo({...t,federalPaymentId:T.federalPaymentId,enrollmentId:T.enrollmentId}),await Pe(),T},Se=async(T,Z)=>{var L;const se=t.form9783EnrollmentId??((L=await zd(T))==null?void 0:L.form9783EnrollmentId);return se?k7(se,T7(Z)):N7(Vd(T,Z))},U=async T=>{if(!e)return;const Z=await ne();Z&&(await Se(Z.enrollmentId,T),await o.invalidateQueries({queryKey:["form-9783",Z.enrollmentId]}),oa(),a(Ge()))},me=C(async T=>{if(!(!e||s)){d(null),h(!0);try{await U(T)}catch(Z){d(rt(Z,"Failed to save federal payment draft."))}finally{h(!1)}}}),Q=C(async T=>{if(!(!e||s)){d(null),h(!0);try{await U(T)}catch(Z){d(rt(Z,"Failed to save draft."))}finally{h(!1)}}});return r.jsxs("form",{onSubmit:me,noValidate:!0,className:"w-full space-y-6",children:[r.jsxs("div",{className:"w-full",children:[r.jsxs("div",{className:"mb-4 flex w-full flex-col gap-4 md:flex-row md:items-center",children:[r.jsx("h2",{className:"shrink-0 text-[28px] font-bold leading-tight text-slate-900",children:"Federal Tax Payment"}),!s&&r.jsx("div",{className:"flex min-w-0 flex-1 justify-center",children:r.jsx(Sr,{steps:lo,current:2})})]}),r.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-6 shadow-sm lg:p-8",children:r.jsxs("fieldset",{disabled:s,className:"min-w-0 border-0 p-0",children:[r.jsxs(bn,{title:"1. Taxpayer Information",isFirst:!0,children:[r.jsxs("div",{className:An,children:[r.jsx($,{label:"1. a) Primary SSN",required:!0,info:"The primary taxpayer's Social Security Number.",error:(pe=S.primarySsn)==null?void 0:pe.message,children:r.jsx("input",{placeholder:"Enter Primary SSN",className:ie(!!S.primarySsn),...y("primarySsn")})}),r.jsx($,{label:"b) Joint Filer's Taxpayer ID No (SSN)",children:r.jsx("input",{placeholder:"Enter Joint Filer's Taxpayer ID No",className:ie(!1),...y("jointFilerSsn")})}),r.jsx($,{label:"2. Taxpayer(s) Name(s)",required:!0,error:(Ue=S.taxpayerNames)==null?void 0:Ue.message,children:r.jsx("input",{placeholder:"Enter Taxpayer(s) Name(s)",className:ie(!!S.taxpayerNames),...y("taxpayerNames")})})]}),r.jsxs("div",{className:`mt-5 ${An}`,children:[r.jsx("div",{className:"sm:col-span-2 xl:col-span-2",children:r.jsx($,{label:"3. a) Primary Address (Number, Street, and Room/Suite No)",required:!0,error:($e=S.primaryAddress)==null?void 0:$e.message,children:r.jsx("input",{placeholder:"Enter Primary Address",className:ie(!!S.primaryAddress),...y("primaryAddress")})})}),r.jsx($,{label:"3. b) City or Town",required:!0,error:(Be=S.city)==null?void 0:Be.message,children:r.jsx("input",{placeholder:"Enter City or Town",className:ie(!!S.city),...y("city")})})]}),r.jsxs("div",{className:`mt-5 ${An}`,children:[r.jsx($,{label:"3. c) State",required:!0,error:(ct=S.state)==null?void 0:ct.message,children:r.jsxs(Lt,{children:[r.jsxs("select",{className:Nt(!!S.state),...y("state"),children:[r.jsx("option",{value:"",children:"Select State"}),Re.map(T=>r.jsx("option",{value:T.code,children:T.name},T.code))]}),r.jsx(Tt,{})]})}),r.jsx($,{label:"3. d) ZIP Code",required:!0,error:(ze=S.zipCode)==null?void 0:ze.message,children:r.jsx("input",{placeholder:"Enter ZIP Code",className:ie(!!S.zipCode),...y("zipCode")})}),r.jsx($,{label:"3. e) Country",required:!0,error:(ft=S.country)==null?void 0:ft.message,children:r.jsxs(Lt,{children:[r.jsxs("select",{className:Nt(!!S.country),...y("country"),children:[r.jsx("option",{value:"",children:"Select Country"}),ta.map(T=>r.jsx("option",{value:T,children:T},T))]}),r.jsx(Tt,{})]})})]}),r.jsxs("div",{className:`mt-5 ${An}`,children:[r.jsx("div",{className:"sm:col-span-2 xl:col-span-2",children:r.jsx($,{label:"3. International Address",children:r.jsx("input",{placeholder:"Enter International Address",className:ie(!1),...y("internationalAddress")})})}),r.jsx($,{label:"4. Primary Taxpayer Phone Number",required:!0,error:(pt=S.primaryPhone)==null?void 0:pt.message,children:r.jsx("input",{placeholder:"Enter Primary Taxpayer Phone Number",className:ie(!!S.primaryPhone),...y("primaryPhone")})})]})]}),r.jsxs(bn,{title:"2. Contact Information",headerAction:r.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[r.jsx("input",{type:"checkbox",checked:m,disabled:s,onChange:T=>{const Z=T.target.checked;f(Z),Z?Ne():ve()},className:"h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200"}),"Same as Taxpayer Information"]}),children:[r.jsxs("div",{className:An,children:[r.jsx($,{label:"5. Primary contact name",required:!0,error:(st=S.primaryContactName)==null?void 0:st.message,children:r.jsx("input",{placeholder:"Payer Name",readOnly:m,className:ie(!!S.primaryContactName,m),...y("primaryContactName")})}),r.jsx($,{label:"6. a) Primary contact address",required:!0,error:(Pt=S.primaryContactAddress)==null?void 0:Pt.message,children:r.jsx("input",{placeholder:"Payer Address",readOnly:m,className:ie(!!S.primaryContactAddress,m),...y("primaryContactAddress")})}),r.jsx($,{label:"6. b) City or Town",required:!0,error:(It=S.contactCity)==null?void 0:It.message,children:r.jsx("input",{placeholder:"City",readOnly:m,className:ie(!!S.contactCity,m),...y("contactCity")})})]}),r.jsxs("div",{className:`mt-5 ${An}`,children:[r.jsx($,{label:"6. c) State",required:!0,error:(Mt=S.contactState)==null?void 0:Mt.message,children:r.jsx("input",{placeholder:"Payer State",readOnly:m,className:ie(!!S.contactState,m),...y("contactState")})}),r.jsx($,{label:"6. d) ZIP code",required:!0,error:(xt=S.contactZipCode)==null?void 0:xt.message,children:r.jsx("input",{placeholder:"ZIP code",readOnly:m,className:ie(!!S.contactZipCode,m),...y("contactZipCode")})}),r.jsx($,{label:"6. f) Country",required:!0,error:(xe=S.contactCountry)==null?void 0:xe.message,children:r.jsx("input",{placeholder:"Country",readOnly:m,className:ie(!!S.contactCountry,m),...y("contactCountry")})})]}),r.jsxs("div",{className:"mt-5 grid gap-x-6 gap-y-5 sm:grid-cols-3",children:[r.jsx($,{label:"7. Primary taxpayer phone number",required:!0,error:(Ve=S.contactPhone)==null?void 0:Ve.message,children:r.jsx("input",{placeholder:"Payer Phone",readOnly:m,className:ie(!!S.contactPhone,m),...y("contactPhone")})}),r.jsx("div",{className:"sm:col-span-2",children:r.jsx($,{label:"8. International address",children:r.jsx("input",{placeholder:"Phone Number (International number)",readOnly:m,className:ie(!1,m),...y("contactInternationalAddress")})})})]})]}),r.jsx(bn,{title:"Taxpayer Details *",children:r.jsxs("div",{className:R7,children:[r.jsx($,{label:"1. Primary Taxpayer Pin",required:!0,error:(ut=S.primaryTaxpayerPin)==null?void 0:ut.message,children:r.jsx(Ye,{name:"primaryTaxpayerPin",control:A,render:({field:T})=>r.jsx("input",{placeholder:"Primary Taxpayer Pin",inputMode:"numeric",className:ie(!!S.primaryTaxpayerPin),value:T.value,onChange:Z=>T.onChange(bs(Z.target.value,D7)),onBlur:T.onBlur})})}),r.jsx($,{label:"2. Date of Birth",required:!0,error:(Jt=S.dateOfBirth)==null?void 0:Jt.message,children:r.jsx("input",{type:"date",max:Oe,className:ie(!!S.dateOfBirth),...y("dateOfBirth")})}),r.jsx($,{label:"3. Prior year adjusted gross income",required:!0,error:(K=S.priorYearAgi)==null?void 0:K.message,children:r.jsx("input",{placeholder:"Prior Year Adjusted Gross Income",inputMode:"decimal",className:ie(!!S.priorYearAgi),...y("priorYearAgi")})}),r.jsx($,{label:"4. Prior Tax Year",required:!0,error:(oe=S.agiTaxYear)==null?void 0:oe.message,children:r.jsxs("select",{className:Nt(!!S.agiTaxYear),...y("agiTaxYear"),children:[r.jsx("option",{value:"",disabled:!0,children:"AGI Tax Year"}),E7.map(T=>r.jsx("option",{value:T,children:T},T))]})})]})}),r.jsxs(bn,{title:"3. Social Security Number and Financial Institution Information",children:[r.jsxs("div",{className:An,children:[r.jsx($,{label:"9. Primary SSN",required:!0,error:(v=S.financialPrimarySsn)==null?void 0:v.message,children:r.jsx("input",{placeholder:"Enter number",readOnly:Ce,className:ie(!!S.financialPrimarySsn,Ce),...y("financialPrimarySsn")})}),r.jsx($,{label:"10. Routing Transit Number (RTN)",required:!0,error:(k=S.routingTransitNumber)==null?void 0:k.message,children:r.jsx("input",{placeholder:"Enter number",readOnly:Ce,className:ie(!!S.routingTransitNumber,Ce),...y("routingTransitNumber")})}),r.jsx($,{label:"11. Account Number",required:!0,error:(P=S.accountNumber)==null?void 0:P.message,children:r.jsx("input",{placeholder:"Enter",readOnly:Ce,className:ie(!!S.accountNumber,Ce),...y("accountNumber")})})]}),r.jsxs("div",{className:"mt-5",children:[r.jsx("p",{className:"mb-3 text-sm text-slate-600",children:"12. Type of Account"}),r.jsx("div",{className:"flex flex-wrap gap-6",children:["Checking","Savings"].map(T=>r.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-slate-700",children:[r.jsx("input",{type:"radio",value:T,checked:H===T,disabled:Ce,onChange:()=>j("accountType",T,{shouldValidate:!0}),className:"h-4 w-4 border-slate-300 text-gov-600 focus:ring-gov-200 disabled:cursor-default"}),T]},T))}),S.accountType?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:S.accountType.message}):null]})]}),r.jsxs("section",{className:"mt-8 border-t border-slate-100 pt-8",children:[r.jsx("h3",{className:"mb-4 text-base font-semibold text-slate-900",children:"Authorization Agreement"}),r.jsx("p",{className:"mb-5 text-sm text-slate-600",children:"Read the following authorization agreements"}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("p",{className:"mb-3 text-sm font-semibold text-slate-900",children:"Disclosure Authorization Agreement"}),r.jsxs("label",{className:"flex items-start gap-3",children:[r.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...y("disclosureAgreementOne")}),r.jsx("span",{className:"text-sm leading-6 text-slate-700",children:A7})]}),S.disclosureAgreementOne?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:S.disclosureAgreementOne.message}):null]}),r.jsxs("div",{children:[r.jsx("p",{className:"mb-3 text-sm font-semibold text-slate-900",children:"Disclosure Authorization Agreement"}),r.jsxs("label",{className:"flex items-start gap-3",children:[r.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...y("disclosureAgreementTwo")}),r.jsx("span",{className:"text-sm leading-6 text-slate-700",children:P7})]}),S.disclosureAgreementTwo?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:S.disclosureAgreementTwo.message}):null]}),r.jsxs("div",{className:"border-t border-slate-200 pt-6",children:[r.jsx("p",{className:"mb-3 text-sm font-semibold text-slate-900",children:"Authority to Execute an Authorization"}),r.jsxs("label",{className:"flex items-start gap-3",children:[r.jsx("input",{type:"checkbox",className:"mt-1 h-4 w-4 rounded border-slate-300 text-gov-600 focus:ring-gov-200",...y("authorityAgreement")}),r.jsx("span",{className:"text-sm leading-6 text-slate-700",children:I7})]}),S.authorityAgreement?r.jsx("p",{className:"mt-2 text-xs text-red-600",children:S.authorityAgreement.message}):null]})]})]}),r.jsxs("section",{className:"mt-8 space-y-8 border-t border-slate-100 pt-8",children:[r.jsx(di,{label:"Taxpayer's Signature",required:!0,signature:y("taxpayerSignature"),title:y("taxpayerTitle"),date:y("taxpayerSignatureDate"),signatureValue:R,dateValue:z,errors:{signature:(M=S.taxpayerSignature)==null?void 0:M.message,title:(O=S.taxpayerTitle)==null?void 0:O.message,date:(G=S.taxpayerSignatureDate)==null?void 0:G.message}}),r.jsx(di,{label:"Joint filer(s) Signature (Optional)",signature:y("jointFilerSignature"),title:y("jointFilerTitle"),date:y("jointFilerSignatureDate"),signatureValue:E??"",dateValue:X??"",signatureCaption:"Signature of joint filer"})]})]})})]}),c?r.jsx(Zt,{message:c}):null,r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:()=>a(l),disabled:u,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:Q,disabled:u||!e||s,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Save as Draft"}),r.jsx("button",{type:"submit",disabled:u||!e||s,className:"inline-flex h-11 min-w-[180px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-50",children:"Review and Submit"})]})]})}function Bd(){const{selectedEntity:e}=ht(),t=Ae(),{paymentDraft:n}=t.state??{},s=n??ia(),{data:a,isLoading:i}=de({queryKey:["federal-payment",s==null?void 0:s.federalPaymentId],queryFn:()=>to(s.federalPaymentId),enabled:(s==null?void 0:s.federalPaymentId)!=null&&s.enrollmentId==null}),o=(s==null?void 0:s.enrollmentId)??(a==null?void 0:a.enrollmentId),{data:l,isLoading:c}=de({queryKey:["form-9783",o],queryFn:()=>zd(o),enabled:o!=null}),d=x.useMemo(()=>s?{...s,enrollmentId:o??s.enrollmentId,form9783EnrollmentId:s.form9783EnrollmentId??(l==null?void 0:l.form9783EnrollmentId)}:null,[s,o,l]);return s?e&&!mo(e)?r.jsx(He,{to:"/payments/federal/authorization",replace:!0,state:t.state}):s.federalPaymentId!=null&&s.enrollmentId==null&&i||o!=null&&c?r.jsx("p",{className:"text-sm text-slate-600",children:"Loading enrollment form…"}):r.jsx(O7,{entity:e,paymentDraft:d??s,initialEnrollment:l}):r.jsx(He,{to:"/payments/federal/new",replace:!0})}function z7(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toISOString().slice(0,10)}function V7({type:e}){return r.jsx("span",{className:"inline-flex rounded-md bg-slate-100 px-2 py-1 text-xs font-medium text-slate-600",children:e})}function q7({status:e}){const t=e.toLowerCase();let n="bg-slate-100 text-slate-600";return t.includes("submitted to state")||t.includes("submitted to fed")?n="bg-orange-50 text-orange-700":t.includes("irs accepted")?n="bg-emerald-50 text-emerald-700":t.includes("irs rejected")?n="bg-red-50 text-red-600":t.includes("pending")&&(n="bg-amber-50 text-amber-700"),r.jsx("span",{className:`inline-flex rounded-full px-2.5 py-1 text-xs font-medium ${n}`,children:e})}function Z7(e){const t=e.status.toLowerCase();return t.includes("rejected")?"Edit & Resubmit":e.canSubmit||t.includes("pending")?"Review & Submit":"View PDF"}function U7({form:e,onAction:t}){return r.jsxs("div",{className:"flex flex-col rounded-xl border border-slate-200 bg-white p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx(V7,{type:e.type}),r.jsx(q7,{status:e.status})]}),r.jsx("h3",{className:"mt-3 text-base font-semibold text-slate-900",children:e.fileName}),r.jsx("p",{className:"mt-1 text-sm text-slate-500",children:e.client}),r.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 border-t border-slate-200 pt-3",children:[r.jsx("span",{className:"text-sm text-slate-500",children:z7(e.date)}),r.jsx("button",{type:"button",onClick:t?()=>t(e):void 0,className:"rounded-md border border-gov-200 px-3 py-1.5 text-xs font-medium text-gov-600 transition hover:bg-gov-50",children:Z7(e)})]})]})}function B7({forms:e=[],isLoading:t=!1,isError:n=!1,onFormAction:s}){return t?r.jsx(Ia,{children:"Loading tax forms…"}):n?r.jsx(Ia,{children:"Unable to load tax forms."}):e.length===0?r.jsx(Ia,{children:"No tax forms to display yet."}):r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:e.map(a=>r.jsx(U7,{form:a,onAction:s},a.taxFormId))})}function Ia({children:e}){return r.jsx("p",{className:"py-12 text-center text-sm text-slate-500",children:e})}const W7=[{taxFormId:1,fileName:"VA-5",type:"W-2",client:"Axter Corporation",status:"Submitted to State",date:"2019-01-28",canSubmit:!1},{taxFormId:2,fileName:"1099-NEC Q3 2024",type:"1099",client:"YeSh Solutions LLC",status:"IRS Accepted",date:"2019-01-28",canSubmit:!1},{taxFormId:3,fileName:"Form 941 Q2 2024",type:"941",client:"Axter Corporation",status:"IRS Rejected",date:"2019-01-28",canSubmit:!1},{taxFormId:4,fileName:"State Tax Return CA 2024",type:"State",client:"Meridian Real Estate",status:"Pending",date:"2019-01-28",canSubmit:!0},{taxFormId:5,fileName:"Form 941 Q2 2024",type:"941",client:"Axter Corporation",status:"Submitted to State",date:"2019-01-28",canSubmit:!1}];function Y7(){return r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:"Tax Forms"}),r.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"View and download the forms filed for each entity"})]}),r.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-5 shadow-sm",children:r.jsx(B7,{forms:W7})})]})}function H7({entityId:e}){const[t,n]=x.useState(!1),[s,a]=x.useState(!1),[i,o]=x.useState(null),[l,c]=x.useState(1),[d,u]=x.useState(Ft);x.useEffect(()=>{c(1)},[e,d]);const{data:h=[],isLoading:m,isError:f,isFetching:p}=de({queryKey:["bank-accounts",e],queryFn:()=>kn(e),enabled:e!==null}),g=h.length,y=h.slice((l-1)*d,l*d),C=e!==null&&p,b=f?"error":e?m?"loading":g===0?"empty":"ready":"no-entity",j=b==="error"?"Unable to load bank accounts.":b==="no-entity"?"Create an entity to manage bank accounts.":b==="loading"?"Loading bank accounts…":null;return r.jsxs("div",{children:[r.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-4",children:[r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"Bank Accounts"}),b==="ready"?r.jsx("button",{type:"button",onClick:()=>n(!0),className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700",children:"Add Bank"}):null]}),r.jsx(io,{open:t,onClose:()=>n(!1),onAddManually:()=>{n(!1),a(!0)}}),r.jsx(Zr,{open:s,entityId:e,onClose:()=>a(!1)}),r.jsx(Zr,{open:i!==null,entityId:e,account:i,onClose:()=>o(null)}),r.jsxs("div",{className:"relative min-h-[120px]",children:[C?r.jsx(wr,{label:"Loading bank accounts…"}):null,j?r.jsx("p",{className:"py-12 text-center text-sm text-slate-500",children:j}):b==="empty"?r.jsx(Id,{onAddManually:()=>a(!0)}):r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:y.map(N=>r.jsx(Pd,{account:N,onEdit:o},N.bankAccountDetailId))}),b==="ready"&&g>d?r.jsx($r,{page:l,pageSize:d,totalCount:g,onPageChange:c,onPageSizeChange:u,disabled:m||p}):null]})]})}function Pn({label:e,value:t,icon:n,wide:s=!1}){return r.jsxs("div",{className:`flex items-center gap-3 rounded-xl border border-slate-200 bg-white px-4 py-3.5 ${s?"sm:col-span-2":""}`,children:[r.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-slate-100 text-slate-500",children:r.jsx(Q7,{icon:n})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"text-xs text-slate-500",children:e}),r.jsx("p",{className:"mt-0.5 break-words text-sm font-semibold text-slate-900",children:t||"—"})]})]})}function K7({entity:e}){const[t,n]=x.useState(!1);return r.jsxs("div",{children:[r.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-4",children:[r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"Entity Details"}),e?r.jsxs("button",{type:"button",onClick:()=>n(!0),className:"inline-flex items-center gap-2 rounded-lg border border-gov-300 bg-white px-4 py-2.5 text-sm font-medium text-gov-700 transition hover:bg-gov-50",children:[r.jsx(G7,{}),"Edit"]}):null]}),e?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsx(Pn,{label:"Entity Name",value:Jr(e),icon:"entity"}),r.jsx(Pn,{label:"Entity Type",value:e.entityType,icon:"type"}),r.jsx(Pn,{label:"Account Type",value:e.accountType,icon:"account"}),r.jsx(Pn,{label:e.accountType==="Individual"?"SSN":"Tax ID",value:Zn(e.idNumber,e.accountType),icon:"tax"}),r.jsx(Pn,{label:"Email Address",value:e.email,icon:"email"}),r.jsx(Pn,{label:"Phone Number",value:sn(e.phoneNumber),icon:"phone"}),r.jsx(Pn,{label:"Address",value:xs({address1:e.address1,address2:e.address2??"",city:e.city,state:e.state,zipCode:e.zipCode}),icon:"address",wide:!0})]}),r.jsx(Xu,{open:t,entity:e,onClose:()=>n(!1)})]}):r.jsx("div",{className:"rounded-xl border border-dashed border-slate-200 bg-slate-50/50 px-6 py-16 text-center",children:r.jsx("p",{className:"text-sm text-slate-500",children:"Select an entity to view its details."})})]})}function Q7({icon:e}){const n={className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.75};return e==="entity"?r.jsx("svg",{...n,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 21h16.5M4.5 21V6.75A1.5 1.5 0 016 5.25h6a1.5 1.5 0 011.5 1.5V21m0 0V11.25a1.5 1.5 0 011.5-1.5h2.25a1.5 1.5 0 011.5 1.5V21M7.5 8.25h3m-3 3h3m-3 3h3"})}):e==="type"||e==="account"?r.jsx("svg",{...n,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 14.15v4.075c0 1.313-.937 2.438-2.234 2.632A50.7 50.7 0 0112 21.5c-2.036 0-4.037-.12-6.016-.643A2.625 2.625 0 013.75 18.225V14.15M20.25 14.15A2.625 2.625 0 0021.75 11.7V8.7a2.625 2.625 0 00-2.625-2.625H4.875A2.625 2.625 0 002.25 8.7v3c0 1.09.663 2.03 1.5 2.45M14.25 6.075V4.5A1.5 1.5 0 0012.75 3h-1.5a1.5 1.5 0 00-1.5 1.5v1.575"})}):e==="tax"?r.jsxs("svg",{...n,children:[r.jsx("rect",{x:"2.75",y:"5.25",width:"18.5",height:"13.5",rx:"2"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.5 9.75h4.5M6.5 13h7M16 9.75h1.5"})]}):e==="phone"?r.jsx("svg",{...n,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"})}):e==="address"?r.jsxs("svg",{...n,children:[r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"}),r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"})]}):r.jsx("svg",{...n,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})})}function G7(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zM19.5 15v4.125A1.875 1.875 0 0117.625 21H4.875A1.875 1.875 0 013 19.125V6.375A1.875 1.875 0 014.875 4.5H9"})})}function Wd({activeSection:e,onSectionChange:t,items:n}){return r.jsx("nav",{className:"space-y-2",children:n.map(s=>{const a=e===s.id,i=s.icon;return r.jsxs("button",{type:"button",onClick:()=>t(s.id),className:`flex w-full items-center gap-3 rounded-xl border px-4 py-3.5 text-left transition ${a?"border-gov-200 bg-gov-50 shadow-sm":"border-slate-200 bg-white hover:border-slate-300 hover:bg-slate-50"}`,children:[r.jsx("span",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg ${a?"bg-gov-600 text-white":"bg-slate-100 text-slate-500"}`,children:r.jsx(i,{className:"h-5 w-5"})}),r.jsx("span",{className:`min-w-0 flex-1 text-sm font-semibold ${a?"text-gov-700":"text-slate-700"}`,children:s.title}),r.jsx(J7,{className:`h-4 w-4 shrink-0 ${a?"text-gov-600":"text-slate-300"}`})]},s.id)})})}function J7({className:e}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})}function X7({entityId:e,pageNumber:t=1,pageSize:n=Ft}){const s=new URLSearchParams({entityId:String(e),pageNumber:String(t),pageSize:String(n)});return fe(`/portal/tax-accounts?${s}`)}function _7(e){return fe(`/portal/tax-accounts/${e}`)}function Yd(e){return fe("/portal/tax-accounts",{method:"POST",body:e})}function Hd(e,t){return fe(`/portal/tax-accounts/${e}`,{method:"PATCH",body:t})}function $7(){return r.jsxs("svg",{viewBox:"0 0 120 96",className:"h-24 w-auto text-gov-600",fill:"none",stroke:"currentColor","aria-hidden":"true",children:[r.jsx("path",{d:"M22 42h76v28a8 8 0 0 1-8 8H30a8 8 0 0 1-8-8V42z",strokeWidth:"1.5",strokeLinejoin:"round"}),r.jsx("path",{d:"M22 42V32a6 6 0 0 1 6-6h18l7 8h37a6 6 0 0 1 6 6v2",strokeWidth:"1.5",strokeLinejoin:"round"}),r.jsx("path",{d:"M34 56h10M34 64h22",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 4",opacity:"0.7"}),r.jsx("path",{d:"M62 22c8-6 18-8 26-4",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:"2 5",opacity:"0.6"}),r.jsx("path",{d:"M96 14v5M93.5 16.5h5",strokeWidth:"1.5",strokeLinecap:"round",opacity:"0.7"}),r.jsx("circle",{cx:"42",cy:"24",r:"1.6",fill:"currentColor",stroke:"none",opacity:"0.5"}),r.jsx("circle",{cx:"52",cy:"16",r:"1.2",fill:"currentColor",stroke:"none",opacity:"0.35"}),r.jsx("circle",{cx:"88",cy:"70",r:"11",fill:"#DCE9FB",stroke:"currentColor",strokeWidth:"1.5"}),r.jsx("path",{d:"M88 64.5v11M82.5 70h11",strokeWidth:"1.75",strokeLinecap:"round"})]})}const e3=["Monthly","Quarterly","Semi-Annually","Annually"],t3=["Active","Inactive"];function n3(){const e=new Date().getUTCFullYear();return Array.from({length:5},(t,n)=>String(e-n))}const r3="United States",s3=Gt({state:F().min(1,"State is required"),reasonForPayment:F().min(1,"Reason for payment is required"),accountId:F().min(1,"Account ID is required"),stateTaxId:F().min(1,"State Tax ID is required"),taxYear:F().optional(),frequency:F().optional(),status:F().min(1,"Status is required"),notes:F().optional()}),mi={state:"",reasonForPayment:"",accountId:"",stateTaxId:"",taxYear:"",frequency:"",status:"Active",notes:""};function Hl(e){var t,n;return{...mi,state:e.state,stateTaxId:((t=e.virginia)==null?void 0:t.virginiaTaxAccountId)??"",status:((n=e.status)==null?void 0:n.trim())||"Active"}}function a3({open:e,entityId:t,account:n,onClose:s}){var S,R,E,z,X,H,_;const{showSuccess:a,showError:i}=Ks(),o=At(),l=n!=null,[c,d]=x.useState(null),[u,h]=x.useState(!1),{register:m,handleSubmit:f,watch:p,reset:g,formState:{errors:y}}=Ut({resolver:Bt(s3),defaultValues:n?Hl(n):mi});x.useEffect(()=>{e&&(d(null),g(n?Hl(n):mi))},[e,n,g]);const C=p("state"),b=Yn(r3),{data:j=[],isLoading:N}=de({queryKey:["state-payment-reasons",t,C],queryFn:()=>so(t,C),enabled:e&&t!==null&&C.length>0}),A=f(async V=>{if(t!==null){d(null),h(!0);try{l?await Hd(n.taxAccountDetailId,{state:V.state,status:V.status}):await Yd({entityId:t,state:V.state}),await o.invalidateQueries({queryKey:["tax-accounts",t]}),a(l?"Tax Account Updated":"Tax Account Added",l?"Tax account details were updated successfully.":"Tax account was created successfully."),s()}catch(q){const B=rt(q,"Unable to save tax account. Please try again.");d(B),i("Action Not Completed",B)}finally{h(!1)}}});return r.jsx(nd,{open:e,title:l?"Edit Tax Account":"Add Tax Account",onClose:s,labelledById:"tax-account-drawer-title",footer:r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:s,disabled:u,className:"inline-flex h-11 min-w-[110px] items-center justify-center rounded-lg border border-gov-300 bg-white px-6 text-sm font-medium text-gov-700 transition hover:bg-gov-50 disabled:opacity-60",children:"Cancel"}),r.jsx("button",{type:"button",onClick:()=>void A(),disabled:u||t===null,className:"inline-flex h-11 min-w-[110px] items-center justify-center rounded-lg bg-gov-600 px-6 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:u?"Saving…":l?"Save":"Add"})]}),children:r.jsxs("div",{className:"space-y-5",children:[r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsxs(lt,{label:"Select State",required:!0,error:(S=y.state)==null?void 0:S.message,...m("state"),children:[r.jsx("option",{value:"",children:"Select State"}),b.map(V=>r.jsx("option",{value:V.code,children:V.name},V.code))]}),r.jsxs(lt,{label:"Reason for Payment",required:!0,disabled:!C||N,error:(R=y.reasonForPayment)==null?void 0:R.message,...m("reasonForPayment"),children:[r.jsx("option",{value:"",children:N?"Loading reasons…":"Select Reason for Payment"}),j.map(V=>r.jsx("option",{value:V.code,children:V.label},V.code))]}),r.jsx(ce,{label:"Account ID",required:!0,placeholder:"Enter Account ID",error:(E=y.accountId)==null?void 0:E.message,...m("accountId")}),r.jsx(ce,{label:"State Tax ID",required:!0,placeholder:"Enter State Tax ID",error:(z=y.stateTaxId)==null?void 0:z.message,...m("stateTaxId")}),r.jsxs(lt,{label:"Tax Year",error:(X=y.taxYear)==null?void 0:X.message,...m("taxYear"),children:[r.jsx("option",{value:"",children:"Select Year"}),n3().map(V=>r.jsx("option",{value:V,children:V},V))]}),r.jsxs(lt,{label:"Frequency",error:(H=y.frequency)==null?void 0:H.message,...m("frequency"),children:[r.jsx("option",{value:"",children:"Select Frequency"}),e3.map(V=>r.jsx("option",{value:V,children:V},V))]}),r.jsxs(lt,{label:"Status",required:!0,error:(_=y.status)==null?void 0:_.message,...m("status"),children:[r.jsx("option",{value:"",children:"Select Status"}),t3.map(V=>r.jsx("option",{value:V,children:V},V))]})]}),r.jsxs("div",{children:[r.jsx(Cr,{label:"Notes",htmlFor:"tax-account-notes"}),r.jsx("textarea",{id:"tax-account-notes",rows:4,placeholder:"Enter Notes",className:"block w-full resize-y rounded-lg border border-slate-200 bg-white px-3 py-2.5 text-sm text-slate-900 placeholder:text-slate-400 focus:border-gov-400 focus:outline-none focus:ring-2 focus:ring-gov-200",...m("notes")})]}),c?r.jsx(Zt,{message:c}):null]})})}const Rr="—";function i3(e){return(e.status??"Active").trim().toLowerCase()==="active"}function o3(e){var t;return((t=e.virginia)==null?void 0:t.virginiaTaxAccountId)||Rr}function l3(e){const t=new Map;for(const n of e){const s=n.state||"Other",a=t.get(s);a?a.push(n):t.set(s,[n])}return[...t.entries()].map(([n,s])=>({state:n,accounts:s}))}function c3({entityId:e}){const[t,n]=x.useState(1),[s,a]=x.useState(Ft),[i,o]=x.useState({}),[l,c]=x.useState(null);x.useEffect(()=>{n(1)},[e,s]);const{data:d,isLoading:u,isError:h}=de({queryKey:["tax-accounts",e,t,s],queryFn:()=>X7({entityId:e,pageNumber:t,pageSize:s}),enabled:e!==null}),m=x.useMemo(()=>(d==null?void 0:d.items)??[],[d]),f=(d==null?void 0:d.totalCount)??0,p=x.useMemo(()=>l3(m),[m]),g=h?"Unable to load tax accounts.":e?u?"Loading tax accounts…":null:"Create an entity to manage tax accounts.",y=g===null&&m.length===0,C=b=>{o(j=>({...j,[b]:!j[b]}))};return r.jsxs("div",{children:[r.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-4",children:[r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:"Tax Accounts"}),r.jsx("button",{type:"button",disabled:!e,onClick:()=>c({mode:"create"}),className:"inline-flex items-center gap-2 rounded-lg bg-gov-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:cursor-not-allowed disabled:opacity-60",children:"Add Tax Account"})]}),g?r.jsx("p",{className:"py-12 text-center text-sm text-slate-500",children:g}):y?r.jsxs("div",{className:"flex flex-col items-center justify-center py-24",children:[r.jsx($7,{}),r.jsx("p",{className:"mt-4 text-base text-slate-700",children:"No Tax Accounts Yet"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("p",{className:"mb-4 text-sm text-slate-700",children:["State Tax Accounts (",p.length,")"]}),r.jsx("div",{className:"space-y-4",children:p.map(b=>{const j=i[b.state]===!0;return r.jsxs("div",{className:"overflow-hidden rounded-xl border border-slate-200",children:[r.jsxs("button",{type:"button","aria-expanded":!j,onClick:()=>C(b.state),className:"flex w-full items-center justify-between gap-3 bg-slate-50/70 px-4 py-3.5 text-left transition hover:bg-slate-100/70",children:[r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(u3,{expanded:!j}),r.jsx("span",{className:"text-base font-bold text-slate-900",children:b.state})]}),r.jsxs("span",{className:"text-sm text-slate-500",children:[b.accounts.length," ",b.accounts.length===1?"Account":"Accounts"]})]}),j?null:r.jsx("div",{className:"overflow-x-auto border-t border-slate-200",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-slate-200 text-xs font-semibold text-slate-700",children:[r.jsx("th",{className:"px-5 py-3",children:"Reason for Payment"}),r.jsx("th",{className:"px-5 py-3",children:"Account ID"}),r.jsx("th",{className:"px-5 py-3",children:"State Tax ID"}),r.jsx("th",{className:"px-5 py-3",children:"Tax Year"}),r.jsx("th",{className:"px-5 py-3",children:"Frequency"}),r.jsx("th",{className:"px-5 py-3",children:"Status"}),r.jsx("th",{className:"px-5 py-3",children:"Action"})]})}),r.jsx("tbody",{children:b.accounts.map(N=>r.jsxs("tr",{className:"border-b border-slate-100 last:border-0",children:[r.jsx("td",{className:"px-5 py-4 text-slate-700",children:Rr}),r.jsx("td",{className:"px-5 py-4 text-slate-700",children:Rr}),r.jsx("td",{className:"px-5 py-4 text-slate-700",children:o3(N)}),r.jsx("td",{className:"px-5 py-4 text-slate-700",children:Rr}),r.jsx("td",{className:"px-5 py-4 text-slate-700",children:Rr}),r.jsx("td",{className:"px-5 py-4",children:r.jsx($i,{active:i3(N),variant:"outline"})}),r.jsx("td",{className:"px-5 py-4",children:r.jsx("button",{type:"button","aria-label":`Edit ${b.state} tax account`,onClick:()=>c({mode:"edit",account:N}),className:"rounded-md p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600",children:r.jsx(d3,{})})})]},N.taxAccountDetailId))})]})})]},b.state)})}),f>s?r.jsx($r,{page:t,pageSize:s,totalCount:f,onPageChange:n,onPageSizeChange:a,disabled:u}):null]}),r.jsx(a3,{open:l!==null,entityId:e,account:(l==null?void 0:l.mode)==="edit"?l.account:null,onClose:()=>c(null)})]})}function u3({expanded:e}){return r.jsx("svg",{className:`h-4 w-4 shrink-0 text-slate-500 transition ${e?"":"-rotate-90"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function d3(){return r.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931z"})})}const hi=[{id:"bank-accounts",title:"Bank Accounts",subtitle:"Connected bank accounts",icon:m3},{id:"tax-accounts",title:"Tax Accounts",subtitle:"IRS & state tax accounts",icon:h3},{id:"entity-details",title:"Entity Details",subtitle:"Your account details",icon:f3}];function m3({className:e,...t}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",...t,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5z"})})}function h3({className:e,...t}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",...t,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 21h19.5m-18-18v18m10.5-18v18m6-13.5V21M6.75 6.75h.75m-.75 3h.75m-.75 3h.75m3-6h.75m-.75 3h.75m-.75 3h.75M6.75 21v-3.375c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21M3 21h18M12 3l9 4.5v1.5H3V7.5L12 3z"})})}function f3({className:e,...t}){return r.jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.75",...t,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})})}const Kl="rounded-2xl border border-slate-200 bg-white shadow-sm";function p3(e){return e==="bank-accounts"||e==="tax-accounts"||e==="entity-details"}function Co(){const{selectedEntity:e}=ht(),n=Ae().state,[s,a]=x.useState(p3(n==null?void 0:n.section)?n.section:"bank-accounts");return r.jsxs("div",{className:"grid items-start gap-5 lg:grid-cols-[300px_minmax(0,1fr)]",children:[r.jsx("div",{className:`${Kl} p-3`,children:r.jsx(Wd,{items:hi,activeSection:s,onSectionChange:a})}),r.jsx("div",{className:`${Kl} p-6 lg:p-8`,children:s==="bank-accounts"?r.jsx(H7,{entityId:(e==null?void 0:e.entityId)??null}):s==="tax-accounts"?r.jsx(c3,{entityId:(e==null?void 0:e.entityId)??null}):r.jsx(K7,{entity:e})})]})}function x3({label:e,value:t,onChange:n,options:s,required:a=!1,disabled:i=!1,error:o,placeholder:l="Select a state"}){var b;const[c,d]=x.useState(!1),[u,h]=x.useState(""),m=x.useRef(null),f=x.useRef(null),p=x.useId(),g=(b=s.find(j=>j.code===t))==null?void 0:b.name,y=x.useMemo(()=>{const j=u.trim().toLowerCase();return j?s.filter(N=>N.name.toLowerCase().includes(j)||N.code.toLowerCase().includes(j)):s},[u,s]);x.useEffect(()=>{var j;c&&((j=f.current)==null||j.focus())},[c]),x.useEffect(()=>{if(!c)return;const j=N=>{var A;(A=m.current)!=null&&A.contains(N.target)||d(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[c]);const C=j=>{n(j),h(""),d(!1)};return r.jsxs("div",{ref:m,className:"relative",children:[r.jsx(Cr,{label:e,required:a,htmlFor:p}),r.jsxs("button",{id:p,type:"button",disabled:i,onClick:()=>{h(""),d(j=>!j)},className:`flex w-full items-center justify-between rounded-lg border bg-white px-3 py-2.5 text-left text-sm transition focus:outline-none focus:ring-2 focus:ring-gov-200 disabled:cursor-not-allowed disabled:opacity-60 ${o?"border-red-300":"border-slate-200 focus:border-gov-400"}`,children:[r.jsx("span",{className:g?"text-slate-900":"text-slate-400",children:g??l}),r.jsx(g3,{open:c})]}),c?r.jsxs("div",{className:"absolute left-0 right-0 z-20 mt-2 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-lg",children:[r.jsx("div",{className:"border-b border-slate-100 p-2",children:r.jsx("input",{ref:f,type:"search",value:u,onChange:j=>h(j.target.value),onKeyDown:j=>{j.key==="Escape"?d(!1):j.key==="Enter"&&j.preventDefault()},placeholder:"Search by state name or code","aria-label":"Search states",className:"w-full rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-gov-400 focus:bg-white focus:ring-2 focus:ring-gov-100"})}),r.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[y.map(j=>r.jsxs("button",{type:"button",onClick:()=>C(j.code),className:`flex w-full items-center justify-between px-4 py-3 text-left text-sm transition hover:bg-slate-50 ${t===j.code?"bg-gov-50 text-gov-700":"text-slate-700"}`,children:[r.jsx("span",{children:j.name}),r.jsx("span",{className:"text-xs font-medium text-slate-400",children:j.code})]},j.code)),y.length===0?r.jsx("p",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No states found."}):null]})]}):null,o?r.jsx("p",{className:"mt-1 text-xs text-red-600",children:o}):null]})}function g3({open:e}){return r.jsx("svg",{className:`h-4 w-4 shrink-0 text-slate-400 transition ${e?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}function Ql({title:e,subtitle:t,children:n,className:s=""}){return r.jsxs("section",{className:`rounded-xl border border-slate-200 bg-white ${s}`,children:[r.jsxs("div",{className:"border-b border-slate-100 px-5 py-4",children:[r.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:e}),t?r.jsx("p",{className:"mt-0.5 text-xs text-slate-500",children:t}):null]}),r.jsx("div",{className:"space-y-5 p-5",children:n})]})}const y3=[{title:"Business Registration",fields:[{name:"virginiaTaxAccountId",label:"Virginia Tax Account ID",required:!0,placeholder:"e.g. 30123456789"},{name:"businessLocationCode",label:"Business Location Code",required:!0,placeholder:"e.g. 001"},{name:"virginiaDepartmentOfTaxationClientNumber",label:"Virginia Department of Taxation Client Number",required:!0,placeholder:"e.g. 12345678"}]},{title:"Payroll / Withholding",fields:[{name:"virginiaWithholdingAccountingId",label:"Virginia Withholding Accounting ID",required:!0,placeholder:"e.g. 30123456789-WTH"},{name:"unemploymentTaxAccountId",label:"Unemployment Tax Account ID",required:!0,placeholder:"e.g. 1234567"}]},{title:"Sales and Franchise Tax",fields:[{name:"franchiseTaxAccount",label:"Franchise Tax Account",required:!0,placeholder:"e.g. 30123456789-FRN"},{name:"transientOccupancyTaxAccountId",label:"Transient Occupancy Tax Account ID",required:!1,placeholder:"e.g. 30123456789-TOT"}]},{title:"Other Registrations",fields:[{name:"certificateOfAuthorityNumber",label:"Certificate of Authority Number (Foreign Entities)",required:!1,placeholder:"e.g. F123456789"},{name:"licensedProfessionalEmployerEntityNumber",label:"Licensed Professional Employer (POE) Entity Number",required:!1,placeholder:"e.g. POE-00123"}]}],b3={VA:y3},v3="United States",C3=Gt({state:F().min(1,"State is required"),city:F().min(1,"City is required"),zipCode:F().min(1,"ZIP code is required"),address1:F().min(1,"Address Line 1 is required"),address2:F().optional(),virginiaTaxAccountId:F().optional(),virginiaWithholdingAccountingId:F().optional(),unemploymentTaxAccountId:F().optional(),virginiaDepartmentOfTaxationClientNumber:F().optional(),businessLocationCode:F().optional(),franchiseTaxAccount:F().optional(),transientOccupancyTaxAccountId:F().optional(),certificateOfAuthorityNumber:F().optional(),licensedProfessionalEmployerEntityNumber:F().optional()}),j3=C3.superRefine((e,t)=>{if(Nu.test(e.zipCode.trim())||t.addIssue({code:wt.custom,message:"Enter a 5-digit ZIP or ZIP+4 (e.g. 12345 or 12345-6789)",path:["zipCode"]}),e.state!=="VA")return;const n=[{key:"virginiaTaxAccountId",label:"Virginia Tax Account ID"},{key:"virginiaWithholdingAccountingId",label:"Virginia Withholding Accounting ID"},{key:"unemploymentTaxAccountId",label:"Unemployment Tax Account ID"},{key:"virginiaDepartmentOfTaxationClientNumber",label:"Virginia Department of Taxation Client Number"},{key:"businessLocationCode",label:"Business Location Code"},{key:"franchiseTaxAccount",label:"Franchise Tax Account"}];for(const s of n){const a=e[s.key];(typeof a!="string"||!a.trim())&&t.addIssue({code:wt.custom,message:`${s.label} is required`,path:[s.key]})}}),w3={state:"VA",city:"",zipCode:"",address1:"",address2:"",virginiaTaxAccountId:"",virginiaWithholdingAccountingId:"",unemploymentTaxAccountId:"",virginiaDepartmentOfTaxationClientNumber:"",businessLocationCode:"",franchiseTaxAccount:"",transientOccupancyTaxAccountId:"",certificateOfAuthorityNumber:"",licensedProfessionalEmployerEntityNumber:""};function N3(e){const t=e.virginia;return{state:e.state,city:e.city,zipCode:e.zipCode,address1:e.address1,address2:e.address2??"",virginiaTaxAccountId:(t==null?void 0:t.virginiaTaxAccountId)??"",virginiaWithholdingAccountingId:(t==null?void 0:t.virginiaWithholdingAccountingId)??"",unemploymentTaxAccountId:(t==null?void 0:t.unemploymentTaxAccountId)??"",virginiaDepartmentOfTaxationClientNumber:(t==null?void 0:t.virginiaDepartmentOfTaxationClientNumber)??"",businessLocationCode:(t==null?void 0:t.businessLocationCode)??"",franchiseTaxAccount:(t==null?void 0:t.franchiseTaxAccount)??"",transientOccupancyTaxAccountId:(t==null?void 0:t.transientOccupancyTaxAccountId)??"",certificateOfAuthorityNumber:(t==null?void 0:t.certificateOfAuthorityNumber)??"",licensedProfessionalEmployerEntityNumber:(t==null?void 0:t.licensedProfessionalEmployerEntityNumber)??""}}const vs=e=>{const t=e==null?void 0:e.trim();return t||null};function S3(e){var t,n,s,a,i,o;if(e.state==="VA")return{virginiaTaxAccountId:((t=e.virginiaTaxAccountId)==null?void 0:t.trim())??"",virginiaWithholdingAccountingId:((n=e.virginiaWithholdingAccountingId)==null?void 0:n.trim())??"",unemploymentTaxAccountId:((s=e.unemploymentTaxAccountId)==null?void 0:s.trim())??"",virginiaDepartmentOfTaxationClientNumber:((a=e.virginiaDepartmentOfTaxationClientNumber)==null?void 0:a.trim())??"",businessLocationCode:((i=e.businessLocationCode)==null?void 0:i.trim())??"",franchiseTaxAccount:((o=e.franchiseTaxAccount)==null?void 0:o.trim())??"",transientOccupancyTaxAccountId:vs(e.transientOccupancyTaxAccountId),certificateOfAuthorityNumber:vs(e.certificateOfAuthorityNumber),licensedProfessionalEmployerEntityNumber:vs(e.licensedProfessionalEmployerEntityNumber)}}function k3({entityId:e,taxAccountDetailId:t,initialValues:n,onCancel:s,onSuccess:a}){var z,X,H,_,V,q;const{showSuccess:i}=Ks(),o=At(),l=t!=null,[c,d]=x.useState(null),[u,h]=x.useState(!1),{register:m,handleSubmit:f,watch:p,setValue:g,formState:{errors:y}}=Ut({resolver:Bt(j3),defaultValues:n??w3}),C=m("zipCode"),b=p("state"),j=p("zipCode"),N=Yn(v3),A=b3[b],S=((z=N.find(B=>B.code===b))==null?void 0:z.name)??b,R=b.length>0&&j.trim().length>0&&!pr(N,b,j),E=f(async B=>{if(d(null),!pr(N,B.state,B.zipCode)){d(`ZIP code does not match the selected state (${B.state}).`);return}h(!0);try{const ee={state:B.state,city:B.city.trim(),zipCode:B.zipCode.trim(),address1:B.address1.trim(),address2:vs(B.address2),virginia:S3(B)};if(l)await Hd(t,ee);else{const W={entityId:e,...ee};await Yd(W)}await o.invalidateQueries({queryKey:["tax-accounts",e]}),i(l?"Tax Account Updated":"Tax Account Added",l?"Tax account details were updated successfully.":"Tax account was created successfully."),a==null||a()}catch(ee){d(rt(ee,"Unable to save tax account. Please try again."))}finally{h(!1)}});return r.jsxs("form",{onSubmit:E,noValidate:!0,className:"max-w-4xl space-y-6",children:[c?r.jsx(Zt,{message:c}):null,r.jsxs("div",{children:[r.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Tax jurisdiction"}),r.jsx("div",{className:"max-w-xs",children:r.jsx(x3,{label:"State",required:!0,value:b,onChange:B=>g("state",B,{shouldValidate:!0}),options:N.map(B=>({code:B.code,name:B.name})),error:(X=y.state)==null?void 0:X.message})})]}),r.jsxs(Ql,{title:"Common Information",subtitle:"Applies to every state this entity is registered in.",children:[r.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[r.jsx(ce,{label:"City",required:!0,placeholder:"e.g. Richmond",error:(H=y.city)==null?void 0:H.message,...m("city")}),r.jsx(ce,{label:"Zip Code",required:!0,maxLength:10,placeholder:"12345 or 12345-6789",error:((_=y.zipCode)==null?void 0:_.message)??(R?`ZIP code does not match the selected state (${b}).`:void 0),...C,onChange:B=>{B.target.value=Ui(B.target.value),C.onChange(B)}})]}),r.jsx(ce,{label:"Address Line 1",required:!0,placeholder:"e.g. 123 Main Street",error:(V=y.address1)==null?void 0:V.message,...m("address1")}),r.jsx(ce,{label:"Address Line 2",placeholder:"Suite, unit, etc. (optional)",error:(q=y.address2)==null?void 0:q.message,...m("address2")})]}),A?r.jsx(Ql,{title:`${S} Tax Registration`,children:A.map((B,ee)=>r.jsxs("div",{className:ee>0?"border-t border-slate-100 pt-5":"",children:[r.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wide text-gov-700",children:B.title}),r.jsx("div",{className:"grid gap-5 sm:grid-cols-2",children:B.fields.map(W=>{var ue;return r.jsx(ce,{label:W.label,required:W.required,placeholder:W.placeholder??"Enter",error:(ue=y[W.name])==null?void 0:ue.message,...m(W.name)},W.name)})})]},B.title))}):null,r.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-slate-200 pt-6",children:[r.jsx("button",{type:"button",onClick:s,disabled:u,className:"inline-flex h-11 min-w-[120px] items-center justify-center rounded-lg border border-slate-300 bg-white px-6 text-sm font-medium text-slate-700 transition hover:bg-slate-50 disabled:opacity-60",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:u,className:"inline-flex h-11 min-w-[140px] items-center justify-center rounded-lg bg-gov-600 px-8 text-sm font-semibold text-white shadow-sm transition hover:bg-gov-700 disabled:opacity-60",children:u?"Saving…":"Save"})]})]})}function A3({title:e,subtitle:t,icon:n,action:s}){return r.jsxs("div",{className:"mb-6 flex flex-wrap items-start justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-gov-50 text-gov-600",children:r.jsx(n,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-bold text-slate-900",children:e}),r.jsx("p",{className:"text-sm text-slate-500",children:t})]})]}),s]})}const Ea="rounded-2xl border border-slate-200 bg-white shadow-sm";function xr(){const e=Ie(),{selectedEntity:t}=ht(),n=Bs(),s=n.taxAccountDetailId?Number(n.taxAccountDetailId):void 0,a=s!=null,i=hi.find(h=>h.id==="tax-accounts"),o=i.icon,l=(h="tax-accounts")=>{e("/settings",{state:{section:h}})},{data:c,isLoading:d,isError:u}=de({queryKey:["tax-account",s],queryFn:()=>_7(s),enabled:a});return t?r.jsxs("div",{className:"grid items-start gap-5 lg:grid-cols-[300px_minmax(0,1fr)]",children:[r.jsx("div",{className:`${Ea} p-3`,children:r.jsx(Wd,{items:hi,activeSection:"tax-accounts",onSectionChange:l})}),r.jsxs("div",{className:`${Ea} p-6 lg:p-8`,children:[r.jsx(A3,{title:a?"Edit Tax Account":i.title,subtitle:i.subtitle,icon:o}),a&&d?r.jsx("p",{className:"text-sm text-slate-500",children:"Loading tax account…"}):a&&(u||!c)?r.jsx(Zt,{message:"Unable to load this tax account. Please try again."}):r.jsx(k3,{entityId:t.entityId,taxAccountDetailId:s,initialValues:c?N3(c):void 0,onCancel:()=>l("tax-accounts"),onSuccess:()=>l("tax-accounts")})]})]}):r.jsx("div",{className:Ea+" p-6 lg:p-8",children:r.jsx("p",{className:"text-sm text-slate-500",children:"Select an entity to add a tax account."})})}function P3({paymentsMode:e="all"}){return r.jsxs(vi,{children:[r.jsx(re,{index:!0,element:r.jsx(Ei,{})}),r.jsx(re,{path:"create-entity",element:r.jsx(Li,{})}),r.jsx(re,{path:"create-entity/form",element:r.jsx(Xi,{})}),r.jsxs(re,{element:r.jsx(Ti,{}),children:[r.jsx(re,{path:"entities",element:r.jsx(eo,{})}),r.jsx(re,{path:"dashboard",element:r.jsx(_i,{})}),r.jsx(re,{path:"payments",element:r.jsx(ao,{paymentsMode:e})}),r.jsx(re,{path:"payments/federal/new",element:r.jsx(pd,{})}),r.jsx(re,{path:"payments/federal/:federalPaymentId/edit",element:r.jsx(gd,{})}),r.jsx(re,{path:"payments/federal/:federalPaymentId/view",element:r.jsx(yd,{})}),r.jsx(re,{path:"payments/state/new",element:r.jsx(Sd,{})}),r.jsx(re,{path:"payments/state/:statePaymentId/edit",element:r.jsx(kd,{})}),r.jsx(re,{path:"payments/state/:statePaymentId/view",element:r.jsx(Ad,{})}),r.jsx(re,{path:"payments/state/bank-details",element:r.jsx(Td,{})}),r.jsx(re,{path:"payments/state/authorization",element:r.jsx(Rd,{})}),r.jsx(re,{path:"payments/federal/authorization",element:r.jsx(Od,{})}),r.jsx(re,{path:"payments/federal/individual-enrollment",element:r.jsx(Bd,{})}),r.jsx(re,{path:"tax-forms",element:r.jsx(Y7,{})}),r.jsx(re,{path:"settings",element:r.jsx(Co,{})}),r.jsx(re,{path:"settings/tax-accounts/new",element:r.jsx(xr,{})}),r.jsx(re,{path:"settings/tax-accounts/:taxAccountDetailId/edit",element:r.jsx(xr,{})})]}),r.jsx(re,{path:"*",element:r.jsx(He,{to:"/",replace:!0})})]})}const fi="tax-remittance:payment-complete",I3=x.forwardRef(function(t,n){const s=x.useRef(null),a=x.useRef(null);return x.useImperativeHandle(n,()=>({navigate:i=>{var o;return(o=s.current)==null?void 0:o.call(s,i)},selectEntity:i=>{var o;return(o=a.current)==null?void 0:o.call(a,i)},notifyPaymentComplete:i=>{window.dispatchEvent(new CustomEvent(fi,{detail:{paymentId:i}}))}})),r.jsx(Ii,{...t,navigateFnRef:s,selectEntityFnRef:a,onPaymentRequired:t.onPaymentRequired,children:r.jsx(P3,{paymentsMode:"all"})})}),E3=x.forwardRef(function(t,n){const s=x.useRef(null),a=x.useRef(null);return x.useImperativeHandle(n,()=>({navigate:i=>{var o;return(o=s.current)==null?void 0:o.call(s,i)},selectEntity:i=>{var o;return(o=a.current)==null?void 0:o.call(a,i)},notifyPaymentComplete:i=>{window.dispatchEvent(new CustomEvent("tax-remittance:payment-complete",{detail:{paymentId:i}}))}})),r.jsx(Ii,{...t,navigateFnRef:s,selectEntityFnRef:a,enabledPayments:["federal"],children:r.jsxs(vi,{children:[r.jsx(re,{index:!0,element:r.jsx(Ei,{})}),r.jsx(re,{path:"create-entity",element:r.jsx(Li,{})}),r.jsx(re,{path:"create-entity/form",element:r.jsx(Xi,{})}),r.jsxs(re,{element:r.jsx(Ti,{}),children:[r.jsx(re,{path:"entities",element:r.jsx(eo,{})}),r.jsx(re,{path:"dashboard",element:r.jsx(_i,{})}),r.jsx(re,{path:"payments",element:r.jsx(ao,{paymentsMode:"federal"})}),r.jsx(re,{path:"payments/federal/new",element:r.jsx(pd,{})}),r.jsx(re,{path:"payments/federal/:federalPaymentId/edit",element:r.jsx(gd,{})}),r.jsx(re,{path:"payments/federal/:federalPaymentId/view",element:r.jsx(yd,{})}),r.jsx(re,{path:"payments/federal/authorization",element:r.jsx(Od,{})}),r.jsx(re,{path:"payments/federal/individual-enrollment",element:r.jsx(Bd,{})}),r.jsx(re,{path:"settings",element:r.jsx(Co,{})}),r.jsx(re,{path:"settings/tax-accounts/new",element:r.jsx(xr,{})}),r.jsx(re,{path:"settings/tax-accounts/:taxAccountDetailId/edit",element:r.jsx(xr,{})})]}),r.jsx(re,{path:"*",element:r.jsx(He,{to:"/",replace:!0})})]})})}),T3=x.forwardRef(function(t,n){const s=x.useRef(null),a=x.useRef(null);return x.useImperativeHandle(n,()=>({navigate:i=>{var o;return(o=s.current)==null?void 0:o.call(s,i)},selectEntity:i=>{var o;return(o=a.current)==null?void 0:o.call(a,i)},notifyPaymentComplete:i=>{window.dispatchEvent(new CustomEvent("tax-remittance:payment-complete",{detail:{paymentId:i}}))}})),r.jsx(Ii,{...t,navigateFnRef:s,selectEntityFnRef:a,enabledPayments:["state"],children:r.jsxs(vi,{children:[r.jsx(re,{index:!0,element:r.jsx(Ei,{})}),r.jsx(re,{path:"create-entity",element:r.jsx(Li,{})}),r.jsx(re,{path:"create-entity/form",element:r.jsx(Xi,{})}),r.jsxs(re,{element:r.jsx(Ti,{}),children:[r.jsx(re,{path:"entities",element:r.jsx(eo,{})}),r.jsx(re,{path:"dashboard",element:r.jsx(_i,{})}),r.jsx(re,{path:"payments",element:r.jsx(ao,{paymentsMode:"state"})}),r.jsx(re,{path:"payments/state/new",element:r.jsx(Sd,{})}),r.jsx(re,{path:"payments/state/:statePaymentId/edit",element:r.jsx(kd,{})}),r.jsx(re,{path:"payments/state/:statePaymentId/view",element:r.jsx(Ad,{})}),r.jsx(re,{path:"payments/state/bank-details",element:r.jsx(Td,{})}),r.jsx(re,{path:"payments/state/authorization",element:r.jsx(Rd,{})}),r.jsx(re,{path:"settings",element:r.jsx(Co,{})}),r.jsx(re,{path:"settings/tax-accounts/new",element:r.jsx(xr,{})}),r.jsx(re,{path:"settings/tax-accounts/:taxAccountDetailId/edit",element:r.jsx(xr,{})})]}),r.jsx(re,{path:"*",element:r.jsx(He,{to:"/",replace:!0})})]})})});exports.ApiError=vr;exports.FederalPaymentWidget=E3;exports.StatePaymentWidget=T3;exports.TaxRemittanceEmbedded=I3;exports.setRuntimeApiBaseUrl=qc;
|
|
76
76
|
//# sourceMappingURL=index.cjs.map
|