@jpmorgan-payments/embedded-finance-components 0.5.73 → 0.5.74
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var xs = Object.defineProperty;
|
|
2
2
|
var ws = (e, t, n) => t in e ? xs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var Le = (e, t, n) => ws(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { c as R, d as tr, s as Nn, m as Un, a as B, b as m, e as j, f as te, S as N, g as M, h as pe, u as be, i as H, j as T, k as Re, o as rt, P as zo, l as G, n as $s, p as Ot, q as E, r as I, t as Cs, v as Tt, w as Ss, x as ks, y as mn, F as Es, z as Ds, D as Ms, A as P, I as As, B as nr, C as kn, E as Kr, G as Ts, H as Dt, J as Ft, $ as Ro, K as Br, L as Fs, M as Is, N as Ls, O as qn, Q as Os, R as Ps, T as qs, U as _s } from "./production-
|
|
4
|
+
import { c as R, d as tr, s as Nn, m as Un, a as B, b as m, e as j, f as te, S as N, g as M, h as pe, u as be, i as H, j as T, k as Re, o as rt, P as zo, l as G, n as $s, p as Ot, q as E, r as I, t as Cs, v as Tt, w as Ss, x as ks, y as mn, F as Es, z as Ds, D as Ms, A as P, I as As, B as nr, C as kn, E as Kr, G as Ts, H as Dt, J as Ft, $ as Ro, K as Br, L as Fs, M as Is, N as Ls, O as qn, Q as Os, R as Ps, T as qs, U as _s } from "./production-4tcD7Dmw.js";
|
|
5
5
|
var Ko = {
|
|
6
6
|
À: "A",
|
|
7
7
|
Á: "A",
|
|
@@ -22217,7 +22217,7 @@ var Fh = {};
|
|
|
22217
22217
|
const Gc = new ME(), z6 = Un(void 0), r3 = Fh.NODE_ENV === "development" ? K7(
|
|
22218
22218
|
() => import(
|
|
22219
22219
|
// eslint-disable-next-line import/extensions
|
|
22220
|
-
"./production-
|
|
22220
|
+
"./production-4tcD7Dmw.js"
|
|
22221
22221
|
).then((e) => e.V).then((e) => ({
|
|
22222
22222
|
default: e.ReactQueryDevtools
|
|
22223
22223
|
}))
|
|
@@ -44057,8 +44057,7 @@ const tQ = /* @__PURE__ */ Zo(eQ), nQ = ({ className: e }) => /* @__PURE__ */ c.
|
|
|
44057
44057
|
options: (s ?? pQ).map((Y) => ({
|
|
44058
44058
|
value: Y,
|
|
44059
44059
|
label: d(`organizationTypes.${Y}`)
|
|
44060
|
-
}))
|
|
44061
|
-
disabled: !0
|
|
44060
|
+
}))
|
|
44062
44061
|
}
|
|
44063
44062
|
),
|
|
44064
44063
|
/* @__PURE__ */ c.jsx(
|
|
@@ -4,7 +4,7 @@ var Ye = (e) => {
|
|
|
4
4
|
var Ze = (e, t, n) => t.has(e) || Ye("Cannot " + n);
|
|
5
5
|
var v = (e, t, n) => (Ze(e, t, "read from private field"), n ? n.call(e) : t.get(e)), T = (e, t, n) => t.has(e) ? Ye("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), C = (e, t, n, r) => (Ze(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n);
|
|
6
6
|
import * as _ from "react";
|
|
7
|
-
import { u as jt, o as $t, j as _t } from "./index-
|
|
7
|
+
import { u as jt, o as $t, j as _t } from "./index-BTDljd27.js";
|
|
8
8
|
var d = {
|
|
9
9
|
context: void 0,
|
|
10
10
|
registry: void 0,
|
|
@@ -1853,7 +1853,7 @@ var Br = (e, t = !1) => {
|
|
|
1853
1853
|
const t = vn(() => {
|
|
1854
1854
|
const n = this, [r] = v(this, W), [s] = v(this, Y), [i] = v(this, Z), [o] = v(this, J), [l] = v(this, Q);
|
|
1855
1855
|
let a;
|
|
1856
|
-
return v(this, ee) ? a = v(this, ee) : (a = ln(() => import("./2FJCTAHO-
|
|
1856
|
+
return v(this, ee) ? a = v(this, ee) : (a = ln(() => import("./2FJCTAHO-1UT9hKrN.js")), C(this, ee, a)), dr(v(this, ge), v(this, X)), nn(a, sn({
|
|
1857
1857
|
get queryFlavor() {
|
|
1858
1858
|
return v(n, de);
|
|
1859
1859
|
},
|
|
@@ -296,7 +296,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
296
296
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oC(e,t){if(e){if(typeof e=="string")return Og(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Og(e,t)}}function Og(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function nre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,s,a;try{for(n=n.call(e);!(i=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw a}}return r}}function rre(e){if(Array.isArray(e))return e}var ire="file-invalid-type",ore="file-too-large",sre="file-too-small",are="too-many-files",lre=function(t){t=Array.isArray(t)&&t.length===1?t[0]:t;var n=Array.isArray(t)?"one of ".concat(t.join(", ")):t;return{code:ire,message:"File type must be ".concat(n)}},sC=function(t){return{code:ore,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},aC=function(t){return{code:sre,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},cre={code:are,message:"Too many files"};function lC(e,t){var n=e.type==="application/x-moz-file"||Qne(e,t);return[n,n?null:lre(t)]}function cC(e,t,n){if(pa(e.size))if(pa(t)&&pa(n)){if(e.size>n)return[!1,sC(n)];if(e.size<t)return[!1,aC(t)]}else{if(pa(t)&&e.size<t)return[!1,aC(t)];if(pa(n)&&e.size>n)return[!1,sC(n)]}return[!0,null]}function pa(e){return e!=null}function ure(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,o=e.multiple,s=e.maxFiles,a=e.validator;return!o&&t.length>1||o&&s>=1&&t.length>s?!1:t.every(function(c){var u=lC(c,n),f=id(u,1),p=f[0],m=cC(c,r,i),h=id(m,1),v=h[0],g=a?a(c):null;return p&&v&&!g})}function wp(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Cp(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function uC(e){e.preventDefault()}function dre(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function fre(e){return e.indexOf("Edge/")!==-1}function pre(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return dre(e)||fre(e)}function Ji(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return!wp(r)&&a&&a.apply(void 0,[r].concat(o)),wp(r)})}}function mre(){return"showOpenFilePicker"in window}function hre(e){if(pa(e)){var t=Object.entries(e).filter(function(n){var r=id(n,2),i=r[0],o=r[1],s=!0;return dC(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),s=!1),(!Array.isArray(o)||!o.every(fC))&&(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),s=!1),s}).reduce(function(n,r){var i=id(r,2),o=i[0],s=i[1];return rC(rC({},n),{},iC({},o,s))},{});return[{description:"Files",accept:t}]}return e}function gre(e){if(pa(e))return Object.entries(e).reduce(function(t,n){var r=id(n,2),i=r[0],o=r[1];return[].concat(tC(t),[i],tC(o))},[]).filter(function(t){return dC(t)||fC(t)}).join(",")}function vre(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function bre(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function dC(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function fC(e){return/^.*\.[\w]+$/.test(e)}var yre=["children"],xre=["open"],wre=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Cre=["refKey","onChange","onClick"];function Sre(e){return Lre(e)||Ire(e)||pC(e)||Ere()}function Ere(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
297
297
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ire(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lre(e){if(Array.isArray(e))return zg(e)}function _g(e,t){return Mre(e)||Dre(e,t)||pC(e,t)||Are()}function Are(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
298
298
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pC(e,t){if(e){if(typeof e=="string")return zg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zg(e,t)}}function zg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Dre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,s,a;try{for(n=n.call(e);!(i=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw a}}return r}}function Mre(e){if(Array.isArray(e))return e}function mC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mC(Object(n),!0).forEach(function(r){kg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sp(e,t){if(e==null)return{};var n=$re(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $re(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var jg=l.forwardRef(function(e,t){var n=e.children,r=Sp(e,yre),i=gC(r),o=i.open,s=Sp(i,xre);return l.useImperativeHandle(t,function(){return{open:o}},[o]),l.createElement(l.Fragment,null,n(dn(dn({},s),{},{open:o})))});jg.displayName="Dropzone";var hC={disabled:!1,getFilesFromEvent:Rne,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};jg.defaultProps=hC,jg.propTypes={children:ce.func,accept:ce.objectOf(ce.arrayOf(ce.string)),multiple:ce.bool,preventDropOnDocument:ce.bool,noClick:ce.bool,noKeyboard:ce.bool,noDrag:ce.bool,noDragEventsBubbling:ce.bool,minSize:ce.number,maxSize:ce.number,maxFiles:ce.number,disabled:ce.bool,getFilesFromEvent:ce.func,onFileDialogCancel:ce.func,onFileDialogOpen:ce.func,useFsAccessApi:ce.bool,autoFocus:ce.bool,onDragEnter:ce.func,onDragLeave:ce.func,onDragOver:ce.func,onDrop:ce.func,onDropAccepted:ce.func,onDropRejected:ce.func,onError:ce.func,validator:ce.func};var Rg={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function gC(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=dn(dn({},hC),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,o=t.maxSize,s=t.minSize,a=t.multiple,c=t.maxFiles,u=t.onDragEnter,f=t.onDragLeave,p=t.onDragOver,m=t.onDrop,h=t.onDropAccepted,v=t.onDropRejected,g=t.onFileDialogCancel,b=t.onFileDialogOpen,y=t.useFsAccessApi,x=t.autoFocus,C=t.preventDropOnDocument,E=t.noClick,w=t.noKeyboard,I=t.noDrag,L=t.noDragEventsBubbling,A=t.onError,D=t.validator,F=l.useMemo(function(){return gre(n)},[n]),B=l.useMemo(function(){return hre(n)},[n]),N=l.useMemo(function(){return typeof b=="function"?b:vC},[b]),R=l.useMemo(function(){return typeof g=="function"?g:vC},[g]),q=l.useRef(null),G=l.useRef(null),V=l.useReducer(Tre,Rg),k=_g(V,2),Q=k[0],Z=k[1],se=Q.isFocused,_=Q.isFileDialogActive,$=l.useRef(typeof window<"u"&&window.isSecureContext&&y&&mre()),J=function(){!$.current&&_&&setTimeout(function(){if(G.current){var fe=G.current.files;fe.length||(Z({type:"closeDialog"}),R())}},300)};l.useEffect(function(){return window.addEventListener("focus",J,!1),function(){window.removeEventListener("focus",J,!1)}},[G,_,R,$]);var H=l.useRef([]),K=function(fe){q.current&&q.current.contains(fe.target)||(fe.preventDefault(),H.current=[])};l.useEffect(function(){return C&&(document.addEventListener("dragover",uC,!1),document.addEventListener("drop",K,!1)),function(){C&&(document.removeEventListener("dragover",uC),document.removeEventListener("drop",K))}},[q,C]),l.useEffect(function(){return!r&&x&&q.current&&q.current.focus(),function(){}},[q,x,r]);var X=l.useCallback(function(ee){A?A(ee):console.error(ee)},[A]),oe=l.useCallback(function(ee){ee.preventDefault(),ee.persist(),T(ee),H.current=[].concat(Sre(H.current),[ee.target]),Cp(ee)&&Promise.resolve(i(ee)).then(function(fe){if(!(wp(ee)&&!L)){var Ne=fe.length,Je=Ne>0&&ure({files:fe,accept:F,minSize:s,maxSize:o,multiple:a,maxFiles:c,validator:D}),Pt=Ne>0&&!Je;Z({isDragAccept:Je,isDragReject:Pt,isDragActive:!0,type:"setDraggedFiles"}),u&&u(ee)}}).catch(function(fe){return X(fe)})},[i,u,X,L,F,s,o,a,c,D]),re=l.useCallback(function(ee){ee.preventDefault(),ee.persist(),T(ee);var fe=Cp(ee);if(fe&&ee.dataTransfer)try{ee.dataTransfer.dropEffect="copy"}catch{}return fe&&p&&p(ee),!1},[p,L]),ue=l.useCallback(function(ee){ee.preventDefault(),ee.persist(),T(ee);var fe=H.current.filter(function(Je){return q.current&&q.current.contains(Je)}),Ne=fe.indexOf(ee.target);Ne!==-1&&fe.splice(Ne,1),H.current=fe,!(fe.length>0)&&(Z({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Cp(ee)&&f&&f(ee))},[q,f,L]),pe=l.useCallback(function(ee,fe){var Ne=[],Je=[];ee.forEach(function(Pt){var cn=lC(Pt,F),Qt=_g(cn,2),$n=Qt[0],wn=Qt[1],Cn=cC(Pt,s,o),rn=_g(Cn,2),on=rn[0],pn=rn[1],Bn=D?D(Pt):null;if($n&&on&&!Bn)Ne.push(Pt);else{var rt=[wn,pn];Bn&&(rt=rt.concat(Bn)),Je.push({file:Pt,errors:rt.filter(function(Ct){return Ct})})}}),(!a&&Ne.length>1||a&&c>=1&&Ne.length>c)&&(Ne.forEach(function(Pt){Je.push({file:Pt,errors:[cre]})}),Ne.splice(0)),Z({acceptedFiles:Ne,fileRejections:Je,type:"setFiles"}),m&&m(Ne,Je,fe),Je.length>0&&v&&v(Je,fe),Ne.length>0&&h&&h(Ne,fe)},[Z,a,F,s,o,c,m,h,v,D]),Se=l.useCallback(function(ee){ee.preventDefault(),ee.persist(),T(ee),H.current=[],Cp(ee)&&Promise.resolve(i(ee)).then(function(fe){wp(ee)&&!L||pe(fe,ee)}).catch(function(fe){return X(fe)}),Z({type:"reset"})},[i,pe,X,L]),$e=l.useCallback(function(){if($.current){Z({type:"openDialog"}),N();var ee={multiple:a,types:B};window.showOpenFilePicker(ee).then(function(fe){return i(fe)}).then(function(fe){pe(fe,null),Z({type:"closeDialog"})}).catch(function(fe){vre(fe)?(R(fe),Z({type:"closeDialog"})):bre(fe)?($.current=!1,G.current?(G.current.value=null,G.current.click()):X(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):X(fe)});return}G.current&&(Z({type:"openDialog"}),N(),G.current.value=null,G.current.click())},[Z,N,R,y,pe,X,B,a]),de=l.useCallback(function(ee){!q.current||!q.current.isEqualNode(ee.target)||(ee.key===" "||ee.key==="Enter"||ee.keyCode===32||ee.keyCode===13)&&(ee.preventDefault(),$e())},[q,$e]),nt=l.useCallback(function(){Z({type:"focus"})},[]),Ie=l.useCallback(function(){Z({type:"blur"})},[]),it=l.useCallback(function(){E||(pre()?setTimeout($e,0):$e())},[E,$e]),ge=function(fe){return r?null:fe},M=function(fe){return w?null:ge(fe)},j=function(fe){return I?null:ge(fe)},T=function(fe){L&&fe.stopPropagation()},ie=l.useMemo(function(){return function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=ee.refKey,Ne=fe===void 0?"ref":fe,Je=ee.role,Pt=ee.onKeyDown,cn=ee.onFocus,Qt=ee.onBlur,$n=ee.onClick,wn=ee.onDragEnter,Cn=ee.onDragOver,rn=ee.onDragLeave,on=ee.onDrop,pn=Sp(ee,wre);return dn(dn(kg({onKeyDown:M(Ji(Pt,de)),onFocus:M(Ji(cn,nt)),onBlur:M(Ji(Qt,Ie)),onClick:ge(Ji($n,it)),onDragEnter:j(Ji(wn,oe)),onDragOver:j(Ji(Cn,re)),onDragLeave:j(Ji(rn,ue)),onDrop:j(Ji(on,Se)),role:typeof Je=="string"&&Je!==""?Je:"presentation"},Ne,q),!r&&!w?{tabIndex:0}:{}),pn)}},[q,de,nt,Ie,it,oe,re,ue,Se,w,I,r]),te=l.useCallback(function(ee){ee.stopPropagation()},[]),ne=l.useMemo(function(){return function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},fe=ee.refKey,Ne=fe===void 0?"ref":fe,Je=ee.onChange,Pt=ee.onClick,cn=Sp(ee,Cre),Qt=kg({accept:F,multiple:a,type:"file",style:{display:"none"},onChange:ge(Ji(Je,Se)),onClick:ge(Ji(Pt,te)),tabIndex:-1},Ne,G);return dn(dn({},Qt),cn)}},[G,n,a,Se,r]);return dn(dn({},Q),{},{isFocused:se&&!r,getRootProps:ie,getInputProps:ne,rootRef:q,inputRef:G,open:ge($e)})}function Tre(e,t){switch(t.type){case"focus":return dn(dn({},e),{},{isFocused:!0});case"blur":return dn(dn({},e),{},{isFocused:!1});case"openDialog":return dn(dn({},Rg),{},{isFileDialogActive:!0});case"closeDialog":return dn(dn({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return dn(dn({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return dn(dn({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return dn({},Rg);default:return e}}function vC(){}var Hg={exports:{}},bC;function Fre(){return bC||(bC=1,function(e){(function(t,n){var r="…",i=/(((ftp|https?):\/\/)[\-\w@:%_\+.~#?,&\/\/=]+)|((mailto:)?[_.\w-]{1,300}@(.{1,300}\.)[a-zA-Z]{2,3})/g;function o(a,c,u){return u.length===a.length||!c.ellipsis||(u+=c.ellipsis),u}function s(a,c,u){var f="",p=!0,m=c,h,v;if(u=u||{},u.ellipsis=typeof u.ellipsis>"u"?r:u.ellipsis,!a||a.length===0)return"";for(p=!0;p;){if(i.lastIndex=f.length,p=i.exec(a),!p||p.index-f.length>=m||i.lastIndex>=c+3e3)return f+=a.substring(f.length,c),o(a,u,f);if(h=p[0],v=p.index,f+=a.substring(f.length,v+h.length),m-=v+h.length,m<=0)break}return o(a,u,f)}e.exports?e.exports=s:t.truncate=s})(String)}(Hg)),Hg.exports}var Nre=Fre();const Pre=zs(Nre),Ore=({className:e})=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:ye("lucide lucide-upload",e),children:[d.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),d.jsx("polyline",{points:"17 8 12 3 7 8"}),d.jsx("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]}),_re=({className:e})=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:ye("lucide lucide-file-text",e),children:[d.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),d.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),d.jsx("path",{d:"M10 9H8"}),d.jsx("path",{d:"M16 13H8"}),d.jsx("path",{d:"M16 17H8"})]}),zre=({className:e})=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:ye("lucide lucide-image",e),children:[d.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),d.jsx("circle",{cx:"9",cy:"9",r:"2"}),d.jsx("path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"})]}),kre=({className:e})=>d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:ye("lucide lucide-trash",e),children:[d.jsx("path",{d:"M3 6h18"}),d.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),d.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),jre=({containerClassName:e,dropZoneClassName:t,children:n,showFilesList:r=!0,showErrorMessage:i=!0,onChange:o,...s})=>{const a=gC({...s,onDrop(h,v,g){if(s.onDrop)s.onDrop(h,v,g);else if(o==null||o([...c,...h]),u(b=>[...b,...h]),v.length>0){let b=`Could not upload ${v[0].file.name}`;v.length>1&&(b+=`, and ${v.length-1} other files.`),p(b)}else p("")}}),[c,u]=l.useState([]),[f,p]=l.useState(),m=h=>{o==null||o([...c.slice(0,h),...c.slice(h+1)]),u(v=>[...v.slice(0,h),...v.slice(h+1)])};return d.jsxs("div",{className:ye("eb-flex eb-flex-col eb-gap-2",e),children:[!(s.multiple===!1&&c.length>0)&&d.jsxs("div",{...a.getRootProps(),className:ye("eb-flex eb-h-32 eb-w-full eb-cursor-pointer eb-select-none eb-items-center eb-justify-center eb-rounded-lg eb-border-2 eb-border-dashed eb-border-gray-200 eb-p-4 eb-transition-all hover:eb-bg-accent hover:eb-text-accent-foreground",t),children:[d.jsx("input",{...a.getInputProps()}),n?n(a):a.isDragAccept?d.jsx("div",{className:"eb-text-sm eb-font-medium",children:"Drop your files here!"}):d.jsxs("div",{className:"eb-flex eb-flex-col eb-items-center eb-gap-1.5",children:[d.jsxs("div",{className:"eb-flex eb-flex-row eb-items-center eb-gap-0.5 eb-text-sm eb-font-medium",children:[d.jsx(Ore,{className:"eb-mr-2 eb-h-4 eb-w-4"})," Drag and drop a file or click to browse"]}),s.maxSize&&d.jsxs("div",{className:"eb-text-xs eb-font-medium eb-text-gray-400",children:["Max. file size: ",(s.maxSize/(1024*1024)).toFixed(2)," ","MB"]})]})]}),i&&f&&d.jsx("span",{className:"eb-mt-3 eb-text-xs eb-text-red-600",children:f}),r&&c.length>0&&d.jsx("div",{className:`eb-flex eb-w-full eb-flex-col eb-gap-2 ${c.length>2?"eb-h-48":"eb-h-fit"} ${c.length>0?"eb-pb-2":""}`,children:d.jsx("div",{className:"eb-w-full",children:c.map((h,v)=>d.jsxs("div",{className:"eb-mt-2 eb-flex eb-h-16 eb-w-full eb-flex-row eb-items-center eb-justify-between eb-rounded-lg eb-border-2 eb-border-solid eb-border-gray-200 eb-px-4 eb-shadow-sm",children:[d.jsxs("div",{className:"eb-flex eb-h-full eb-flex-row eb-items-center eb-gap-4",children:[h.type==="application/pdf"?d.jsx(_re,{className:"eb-h-6 eb-w-6 eb-text-rose-700"}):d.jsx(zre,{className:"eb-h-6 eb-w-6 eb-text-rose-700"}),d.jsxs("div",{className:"eb-flex eb-flex-col eb-gap-0",children:[d.jsx("div",{className:"eb-text-[0.85rem] eb-font-medium eb-leading-snug",children:Pre(h.name.split(".").slice(0,-1).join("."),30)}),d.jsxs("div",{className:"eb-text-[0.7rem] eb-leading-tight eb-text-gray-500",children:[".",h.name.split(".").pop()," •"," ",(h.size/(1024*1024)).toFixed(2)," MB"]})]})]}),d.jsx(_8,{className:"eb-cursor-pointer eb-select-none eb-rounded-full eb-border-2 eb-border-solid eb-border-gray-100 eb-p-2 eb-shadow-sm eb-transition-all hover:eb-bg-accent",onClick:()=>m(v),children:d.jsx(kre,{className:"eb-h-4 eb-w-4"})})]},v))})})]})},yC={ANNUAL_FILINGS:{label:"Annual Filings",description:""},ARTICLES_OF_ASSOCIATION:{label:"Articles Of Association",description:""},ARTICLES_OF_INCORPORATION:{label:"Articles Of Incorporation",description:""},BANK_STATEMENT:{label:"Bank Statement",description:"From last 3 month"},BANKING_LICENSE:{label:"Banking License",description:""},BEARER_SHARES_ATTESTATION:{label:"Bearer Shares Attestation",description:""},BENEFICIAL_OWNER_INFORMATION:{label:"Beneficial Owner Information",description:""},BRAND_LOGO:{label:"Brand Logo",description:""},BULK_PARTY:{label:"Bulk Party",description:""},BUSINESS_LICENSE:{label:"Business License",description:""},BUSINESS_REGISTRATION_CERT:{label:"Business Registration Cert",description:""},CERTIFICATE_OF_STATUS:{label:"Certificate Of Status",description:""},COMMERCIAL_REGISTRY:{label:"Commercial Registry",description:""},CONSTITUTIONAL_DOCUMENT:{label:"Constitutional Document",description:""},CREDIT_CARD_STATEMENT:{label:"Credit Card Statement",description:"Dated within the past 6 months"},DETAILS_OF_DIRECTORS:{label:"Details Of Directors",description:""},DISCLOSURE_AND_CONSENT:{label:"Disclosure And Consent",description:""},DRIVERS_LICENSE:{label:"Drivers License",description:"Include front and back"},EIN:{label:"Ein",description:""},EVIDENCE:{label:"Evidence",description:""},FILING_RECEIPT:{label:"Filing Receipt",description:""},GOV_ISSUED_ID_CARD:{label:"Government Issued ID Card",description:""},GOVERNMENT_REGISTERED_DOCUMENT:{label:"Government Registered Document",description:""},IDENTIFICATION_DOCUMENT:{label:"Identification Document",description:""},INCUMBENCY_CERTIFICATE:{label:"Certificate of Incumbency",description:""},INSURANCE_DOCUMENT:{label:"Insurance Document",description:"Dated within the past"},IRS_DOCUMENT_TIN:{label:"IRS Document TIN",description:""},JPMC_DISCLOSURE:{label:"JPMC Disclosure",description:""},LEGAL_DOCUMENTS:{label:"Legal Documents",description:""},LLC_AGREEMENT:{label:"LLC Agreement",description:""},LOAN_ACCOUNT_STATEMENT:{label:"Loan Account Statement",description:"Dated within the past"},MAA:{label:"MAA",description:""},MOA:{label:"MOA",description:""},OFFERING_MEMO:{label:"Offering Memo",description:""},OPERATING_AGREEMENT:{label:"Operating Agreement",description:""},OTHER_GOV_REGISTRATION_DOCS:{label:"Other Gov Registration Docs",description:""},PARTNERSHIP_AGREEMENT:{label:"Partnership Agreement",description:""},PASSPORT:{label:"Passport",description:"Cover page and id page"},SEC_FILINGS_10K:{label:"SEC Filings 10K",description:""},SIGNATURE_CARD:{label:"Signature Card",description:""},SSN_CARD:{label:"SSN Card",description:""},STANDARD_OPERATING_PROCEDURE:{label:"Standard Operating Procedure",description:""},SUPPORT_CONTACT:{label:"Support Contact",description:""},TAX_DOCUMENT:{label:"Tax Document",description:""},TERMS_CONDITIONS:{label:"Terms and Conditions",description:""},TRUST_AGREEMENT:{label:"Trust Agreement",description:""},TRUST_DEED:{label:"Trust Deed",description:""},UTILITY_BILL:{label:"Utility Bill",description:"Dated within the past"},CERTIFICATE_OF_GOOD_STANDING:{label:"Certificate Of Good Standing",description:""},OWNERSHIP_ATTESTATION:{label:"Ownership Attestation",description:""}},Rre=()=>Uw().replace(/[^a-zA-Z0-9_-]/g,"").slice(0,32),xC=({standalone:e=!1,onSubmit:t})=>{var h,v,g,b,y;const{nextStep:n}=Rn(),{clientId:r}=ri(),i=Qa(),o=CR(),s=yR(),{data:a}=Li(r??""),c=Array.from(new Set((b=(v=(h=a==null?void 0:a.parties)==null?void 0:h.map(x=>{var C;return(C=x==null?void 0:x.validationResponse)==null?void 0:C.map(E=>E==null?void 0:E.documentRequestIds)}))==null?void 0:v.flat(2))==null?void 0:b.filter(x=>x==null?void 0:x.length).concat((g=a==null?void 0:a.outstanding)==null?void 0:g.documentRequestIds))),u=qb({queries:(c??[]).map(x=>({queryKey:["documentRequest",x],queryFn:()=>x&&gR(x)})),combine:x=>({data:x.map(C=>C.data),pending:x.some(C=>C.isPending)})}),f=l.useMemo(()=>{var C;const x={};return(C=u==null?void 0:u.data)==null||C.forEach(E=>{var I;if(!(E!=null&&E.id))return;const w={};(I=E==null?void 0:E.requirements)==null||I.forEach(L=>{const A=L.documentTypes[0];w[A]=we.array(we.instanceof(File)).nonempty("Document is required")}),x[E.id]=we.object(w)}),we.object(x)},[JSON.stringify(u==null?void 0:u.data)]),p=Js({resolver:wo(f)}),m=p.handleSubmit(async x=>{try{for(const[C,E]of Object.entries(x)){for(const[w,I]of Object.entries(E))for(const L of I){const A=await new Promise(F=>{const B=new FileReader;B.onloadend=()=>{const N=B.result;F(N.split(",")[1])},B.readAsDataURL(L)}),D={requestId:Rre(),documentContent:A,documentName:L.name,documentType:w,documentMetadata:{documentRequestId:C}};await o.mutateAsync({data:D})}await s.mutateAsync({id:C})}i.invalidateQueries(),t?t(x):n()}catch(C){console.error("Error uploading documents:",C),bn.error("Error uploading document")}});return u!=null&&u.pending?d.jsx(jr,{message:"Fetching document requests..."}):(c==null?void 0:c.length)===0&&!e?d.jsx("p",{className:"eb-text-sm",children:"No document requests found. Please proceed to the next step."}):d.jsx(wi,{...p,children:d.jsxs("form",{onSubmit:m,className:"eb-grid eb-w-full eb-items-start eb-gap-6 eb-overflow-auto eb-p-1",children:[(y=u==null?void 0:u.data)==null?void 0:y.map(x=>{var w,I,L,A,D,F;const C=(w=a==null?void 0:a.parties)==null?void 0:w.find(B=>B.id===(x==null?void 0:x.partyId)),E=(C==null?void 0:C.partyType)==="INDIVIDUAL"?`${(I=C==null?void 0:C.individualDetails)==null?void 0:I.firstName} ${(L=C==null?void 0:C.individualDetails)==null?void 0:L.lastName}`:(A=C==null?void 0:C.organizationDetails)==null?void 0:A.organizationName;return d.jsxs(l.Fragment,{children:[(x==null?void 0:x.partyId)&&d.jsx("h2",{className:"eb-mt-4 eb-text-lg eb-font-semibold",children:`Document request for ${E}`}),d.jsx("div",{className:"eb-border-l-4 eb-border-yellow-500 eb-bg-yellow-100 eb-p-4 eb-text-yellow-700",children:(D=x==null?void 0:x.description)==null?void 0:D.split(`
|
|
299
|
-
`).map((B,N)=>d.jsx("p",{className:"eb-text-sm",children:B},N))}),d.jsx(yl,{}),(F=x==null?void 0:x.requirements)==null?void 0:F.map((B,N)=>{const R=B.documentTypes[0];return d.jsx(Ke,{control:p.control,name:`${x==null?void 0:x.id}.${R}`,render:({field:{onChange:q,...G}})=>d.jsxs(d.Fragment,{children:[d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:!0,children:yC[R].label}),d.jsx(Xf,{children:yC[R].description}),d.jsx(Be,{children:d.jsx(jre,{containerClassName:"eb-max-w-xl",...G,multiple:(B.minRequired??0)>1,accept:{"application/pdf":[".pdf"],"image/jpeg":[".jpeg",".jpg"],"image/png":[".png"],"image/gif":[".gif"],"image/bmp":[".bmp"],"image/tiff":[".tiff",".tif"],"image/webp":[".webp"]},onChange:V=>{const Q=V.filter(Z=>Z.size>2097152?(p.setError(`${x==null?void 0:x.id}.${R}`,{message:"Each file must be less than 2MB"}),!1):(p.clearErrors(`${x==null?void 0:x.id}.${R}`),!0));q(Q)}})}),d.jsx(Ye,{})]}),d.jsx(yl,{})]})},N)})]},x==null?void 0:x.id)}),!e&&d.jsx(Pl,{}),e&&(c==null?void 0:c.length)!==0&&d.jsx(Qe,{type:"submit",disabled:!p.formState.isValid||p.formState.isSubmitting,className:"eb-ml-auto",children:p.formState.isSubmitting?"Uploading...":"Upload Documents"})]})})},wC={APPROVED:{icon:d.jsx(AL,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-green-100 eb-text-green-800"},DECLINED:{icon:d.jsx(gv,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-red-100 eb-text-red-800"},INFORMATION_REQUESTED:{icon:d.jsx(hm,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-blue-100 eb-text-blue-800"},NEW:{icon:d.jsx(vv,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-purple-100 eb-text-purple-800"},REVIEW_IN_PROGRESS:{icon:d.jsx(ML,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-yellow-100 eb-text-yellow-800"},SUSPENDED:{icon:d.jsx(DL,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-orange-100 eb-text-orange-800"},TERMINATED:{icon:d.jsx(gv,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-gray-100 eb-text-gray-800"}},Hre={NEW:"A new client application has been submitted and is awaiting review.",REVIEW_IN_PROGRESS:"The client application is currently under review.",INFORMATION_REQUESTED:"Additional information has been requested from the client.",APPROVED:"The client application has been approved.",DECLINED:"The client application has been declined.",SUSPENDED:"The client account has been temporarily suspended.",TERMINATED:"The client account has been terminated."},Bg=({label:e,value:t})=>d.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[d.jsxs("span",{className:"eb-text-sm eb-font-medium eb-text-gray-500",children:[e,":"]}),d.jsx("span",{className:"eb-text-sm eb-font-bold",children:t})]}),Bre=()=>d.jsxs(ur,{className:"eb-w-full",children:[d.jsx(Nr,{children:d.jsx(M8,{className:"eb-h-6 eb-w-48"})}),d.jsx(dr,{children:d.jsx("div",{className:"eb-space-y-4",children:[1,2,3,4].map(e=>d.jsx(M8,{className:"eb-h-4 eb-w-full"},e))})})]}),qre=()=>{var c,u,f;const{clientId:e}=ri(),{data:t,isLoading:n,error:r}=Li(e??"");if(n)return d.jsx(Bre,{});if(r||!t)return d.jsx(ur,{className:"eb-w-full",children:d.jsx(dr,{className:"eb-p-6",children:d.jsx("div",{className:"eb-text-center eb-text-red-600",children:r?"Error loading client information":"No client data available"})})});const i=(c=t.parties)==null?void 0:c.find(p=>(p==null?void 0:p.partyType)==="ORGANIZATION"),o=t.status,{icon:s,color:a}=wC[o]||wC.NEW;return d.jsxs(ur,{className:"eb-w-full",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-xl eb-font-bold",children:"Client Onboarding Status"})}),d.jsxs(dr,{children:[d.jsxs("div",{className:"eb-space-y-4",children:[d.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[d.jsx("span",{className:"eb-text-sm eb-font-medium eb-text-gray-500",children:"Status:"}),d.jsxs(vu,{className:`eb-flex eb-items-center eb-gap-1 ${a}`,children:[s,o]})]}),d.jsx(Bg,{label:"Client ID",value:t.id}),d.jsx(Bg,{label:"Organization",value:((u=i==null?void 0:i.organizationDetails)==null?void 0:u.organizationName)||"N/A"}),d.jsx(Bg,{label:"Organization Type",value:((f=i==null?void 0:i.organizationDetails)==null?void 0:f.organizationType)||"N/A"}),d.jsx("div",{className:"eb-mt-4 eb-text-sm eb-text-gray-500",children:d.jsx("p",{children:Hre[o]})})]}),d.jsx(xC,{standalone:!0})]})]})},Vre=()=>{var N;const{nextStep:e,prevStep:t,isDisabledStep:n}=Rn(),{clientId:r,onPostClientResponse:i}=ri(),[o,s]=l.useState(!1),[a,c]=l.useState(null),{data:u,status:f,refetch:p}=Li(r??""),{clientContext:m}=Hl(u),h=Js({resolver:wo(Ig)}),v=((N=u==null?void 0:u.parties)==null?void 0:N.filter(R=>{var q;return(R==null?void 0:R.partyType)==="INDIVIDUAL"&&((q=R==null?void 0:R.roles)==null?void 0:q.includes("DECISION_MAKER"))}))||[],{fields:g,append:b,remove:y}=Yi({control:h.control,name:"individualAddresses"}),{fields:x,append:C,remove:E}=Yi({control:h.control,name:"individualIds"}),{mutate:w,error:I,status:L}=da({mutation:{onSettled:(R,q)=>{var G;i==null||i(R,(G=q==null?void 0:q.response)==null?void 0:G.data)},onSuccess:()=>{bn.success("Decision maker details updated successfully"),s(!1),c(null),h.reset({}),p()},onError:()=>{bn.error("Failed to update decision maker details")}}}),A=R=>{if(f==="success"&&u){c(R);const q=Ju(u,R);h.reset(q),s(!0)}},D=()=>{c(null),h.reset({}),s(!0)},F=R=>{r&&w({id:r,data:{removeParties:[{id:R}]}})},B=R=>{if(r){const q={addParties:[{...a?{id:a}:{},...R}]};w({id:r,data:q})}};return L==="pending"?d.jsx(jr,{message:"Submitting..."}):d.jsxs("div",{className:"eb-space-y-6",children:[d.jsx("h2",{className:"eb-text-2xl eb-font-bold",children:"Decision Makers"}),d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[v.map(R=>{var q,G,V;return d.jsxs(ur,{children:[d.jsx(Nr,{children:d.jsx(yi,{children:`${(q=R==null?void 0:R.individualDetails)==null?void 0:q.firstName} ${(G=R==null?void 0:R.individualDetails)==null?void 0:G.lastName}`})}),d.jsxs(dr,{children:[d.jsx("p",{children:((V=R==null?void 0:R.individualDetails)==null?void 0:V.jobTitle)??""}),d.jsxs("div",{className:"eb-mt-4 eb-space-x-2",children:[d.jsxs(Qe,{variant:"outline",size:"sm",onClick:()=>(R==null?void 0:R.id)&&A(R==null?void 0:R.id),children:[d.jsx(bv,{className:"eb-mr-2 eb-h-4 eb-w-4"}),"Edit"]}),d.jsxs(Qe,{variant:"outline",size:"sm",onClick:()=>(R==null?void 0:R.id)&&F(R==null?void 0:R.id),children:[d.jsx(yv,{className:"eb-mr-2 eb-h-4 eb-w-4"}),"Delete"]})]})]})]},R.id)}),d.jsx(ur,{className:"eb-flex eb-cursor-pointer eb-items-center eb-justify-center",onClick:D,children:d.jsxs(dr,{className:"eb-flex eb-items-center eb-justify-center",children:[d.jsx(PL,{className:"eb-h-6 eb-w-6"}),d.jsx("p",{className:"eb-mt-2",children:"Add Decision Maker"})]})})]}),d.jsx(jf,{open:o,onOpenChange:s,children:d.jsxs(yu,{className:"eb-max-h-full eb-max-w-3xl eb-overflow-auto",children:[d.jsx(xu,{children:d.jsx(wu,{children:a?"Edit Decision Maker":"Add Decision Maker"})}),d.jsx(wi,{...h,children:d.jsxs("form",{onSubmit:h.handleSubmit(B),className:"eb-space-y-6",children:[d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-6 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:"firstName",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"First Name"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Enter first name"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"middleName",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Middle Name"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Enter middle name (optional)"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"lastName",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Last Name"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Enter last name"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"birthDate",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Date of Birth"}),d.jsx(Be,{children:d.jsx(bt,{...R,type:"date"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"countryOfResidence",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Country of Residence"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"e.g., US",maxLength:2})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"jobTitle",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Job Title"}),d.jsxs(Ci,{onValueChange:R.onChange,defaultValue:R.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select job title"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"CEO",children:"CEO"}),d.jsx(_t,{value:"CFO",children:"CFO"}),d.jsx(_t,{value:"COO",children:"COO"}),d.jsx(_t,{value:"President",children:"President"}),d.jsx(_t,{value:"Chairman",children:"Chairman"}),d.jsx(_t,{value:"Senior Branch Manager",children:"Senior Branch Manager"}),d.jsx(_t,{value:"Other",children:"Other"})]})]}),d.jsx(Ye,{})]})}),h.watch("jobTitle")==="Other"&&d.jsx(Ke,{control:h.control,name:"jobTitleDescription",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Job Title Description"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Describe your job title"})}),d.jsx(Ye,{})]})})]}),d.jsxs(ur,{className:"eb-mt-6",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-lg eb-font-medium",children:"Phone Information"})}),d.jsxs(dr,{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:"individualPhone.phoneType",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Phone Type"}),d.jsxs(Ci,{onValueChange:R.onChange,defaultValue:R.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select phone type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"BUSINESS_PHONE",children:"Business Phone"}),d.jsx(_t,{value:"MOBILE_PHONE",children:"Mobile Phone"}),d.jsx(_t,{value:"ALTERNATE_PHONE",children:"Alternate Phone"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"individualPhone.phoneNumber",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Phone Number"}),d.jsx(Be,{children:d.jsx(td,{...R,countries:["CA","US"],placeholder:"Enter phone number",international:!1,defaultCountry:m.jurisdiction==="CanadaMS"?"CA":"US"})},m.jurisdiction),d.jsx(Ye,{})]})})]})]}),d.jsxs(ur,{className:"eb-mt-6",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-lg eb-font-medium",children:"Addresses"})}),d.jsxs(dr,{className:"eb-space-y-4",children:[g==null?void 0:g.map((R,q)=>d.jsxs("div",{className:"eb-space-y-4 eb-rounded-md eb-border eb-p-4",children:[d.jsxs("h4",{className:"eb-font-medium",children:["Address ",q+1]}),d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.addressType`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Address Type"}),d.jsxs(Ci,{onValueChange:G.onChange,defaultValue:G.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select address type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"LEGAL_ADDRESS",children:"Legal Address"}),d.jsx(_t,{value:"MAILING_ADDRESS",children:"Mailing Address"}),d.jsx(_t,{value:"BUSINESS_ADDRESS",children:"Business Address"}),d.jsx(_t,{value:"RESIDENTIAL_ADDRESS",children:"Residential Address"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.addressLines.0`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Address Line 1"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter address line 1"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.city`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"City"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter city"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.state`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"State"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter state"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.postalCode`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Postal Code"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter postal code"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.country`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Country"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter country code",maxLength:2})}),d.jsx(Ye,{})]})})]}),d.jsx(Qe,{type:"button",onClick:()=>y(q),variant:"outline",size:"sm",className:"eb-mt-2",children:"Remove Address"})]},R==null?void 0:R.id)),d.jsx(Qe,{type:"button",onClick:()=>b({addressType:"RESIDENTIAL_ADDRESS",addressLines:[""],state:"",city:"",postalCode:"",country:""}),variant:"outline",size:"sm",children:"Add Address"})]})]}),d.jsxs(ur,{className:"eb-mt-6",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-lg eb-font-medium",children:"Individual IDs"})}),d.jsxs(dr,{className:"eb-space-y-4",children:[x.map((R,q)=>d.jsxs("div",{className:"eb-space-y-4 eb-rounded-md eb-border eb-p-4",children:[d.jsxs("h4",{className:"eb-font-medium",children:["ID ",q+1]}),d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:`individualIds.${q}.idType`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"ID Type"}),d.jsxs(Ci,{onValueChange:G.onChange,defaultValue:G.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select ID type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"SSN",children:"SSN"}),d.jsx(_t,{value:"ITIN",children:"ITIN"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.value`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"ID Value"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter ID value"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.issuer`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Issuer"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter issuer country code",maxLength:2})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.expiryDate`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Expiry Date"}),d.jsx(Be,{children:d.jsx(bt,{...G,type:"date"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.description`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Description"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter description (optional)"})}),d.jsx(Ye,{})]})})]}),d.jsx(Qe,{type:"button",onClick:()=>E(q),variant:"outline",size:"sm",className:"eb-mt-2",children:"Remove ID"})]},R.id)),d.jsx(Qe,{type:"button",onClick:()=>C({idType:"SSN",value:"",issuer:""}),variant:"outline",size:"sm",children:"Add ID"})]})]}),d.jsxs(Qe,{type:"submit",children:[a?"Update":"Add"," Decision Maker"]})]})})]})}),d.jsx(Eo,{error:I}),d.jsxs("div",{className:"eb-flex eb-w-full eb-justify-end eb-gap-4",children:[d.jsx(Qe,{disabled:n,variant:"secondary",onClick:t,children:"Previous"}),d.jsx(Qe,{onClick:e,children:"Next"})]})]})},CC=[{label:"Alabama",value:"AL"},{label:"Alaska",value:"AK"},{label:"Arizona",value:"AZ"},{label:"Arkansas",value:"AR"},{label:"California",value:"CA"},{label:"Colorado",value:"CO"},{label:"Connecticut",value:"CT"},{label:"Delaware",value:"DE"},{label:"Florida",value:"FL"},{label:"Georgia",value:"GA"},{label:"Hawaii",value:"HI"},{label:"Idaho",value:"ID"},{label:"Illinois",value:"IL"},{label:"Indiana",value:"IN"},{label:"Iowa",value:"IA"},{label:"Kansas",value:"KS"},{label:"Kentucky",value:"KY"},{label:"Louisiana",value:"LA"},{label:"Maine",value:"ME"},{label:"Maryland",value:"MD"},{label:"Massachusetts",value:"MA"},{label:"Michigan",value:"MI"},{label:"Minnesota",value:"MN"},{label:"Mississippi",value:"MS"},{label:"Missouri",value:"MO"},{label:"Montana",value:"MT"},{label:"Nebraska",value:"NE"},{label:"Nevada",value:"NV"},{label:"New Hampshire",value:"NH"},{label:"New Jersey",value:"NJ"},{label:"New Mexico",value:"NM"},{label:"New York",value:"NY"},{label:"North Carolina",value:"NC"},{label:"North Dakota",value:"ND"},{label:"Ohio",value:"OH"},{label:"Oklahoma",value:"OK"},{label:"Oregon",value:"OR"},{label:"Pennsylvania",value:"PA"},{label:"Rhode Island",value:"RI"},{label:"South Carolina",value:"SC"},{label:"South Dakota",value:"SD"},{label:"Tennessee",value:"TN"},{label:"Texas",value:"TX"},{label:"Utah",value:"UT"},{label:"Vermont",value:"VT"},{label:"Virginia",value:"VA"},{label:"Washington",value:"WA"},{label:"West Virginia",value:"WV"},{label:"Wisconsin",value:"WI"},{label:"Wyoming",value:"WY"}],Gre=()=>{var Q;const{nextStep:e}=Rn(),{clientId:t,onPostClientResponse:n,usePartyResource:r,onPostPartyResponse:i}=ri(),{t:o}=uo("onboarding"),{data:s,status:a}=Li(t??""),{filterDefaultValues:c,filterSchema:u,getFieldRule:f,isFieldDisabled:p,isFieldRequired:m,isFieldVisible:h,clientContext:v}=Hl(s),g=ed({resolver:wo(u(Ig)),defaultValues:c({individualAddresses:[{addressType:"RESIDENTIAL_ADDRESS",addressLines:[""],state:"",city:"",postalCode:"",country:""}],individualIds:[{idType:"SSN",value:"",issuer:"",expiryDate:"",description:""}],individualPhone:{phoneType:"MOBILE_PHONE",phoneNumber:""}})}),{fields:b,append:y,remove:x}=Yi({control:g.control,name:"individualAddresses"}),{fields:C,append:E,remove:w}=Yi({control:g.control,name:"individualIds"}),I=(Q=s==null?void 0:s.parties)==null?void 0:Q.find(Z=>{var se;return(Z==null?void 0:Z.partyType)==="INDIVIDUAL"&&((se=Z==null?void 0:Z.roles)==null?void 0:se.includes("CONTROLLER"))}),[L,A]=l.useState(!1);l.useEffect(()=>{if(a==="success"&&s&&(I!=null&&I.id)&&!L){const Z=Ju(s,I.id);g.reset({...g.getValues(),...Z}),A(!0)}},[s,a,g.reset,I==null?void 0:I.id,L]);const{mutate:D,error:F,status:B}=da(),{mutate:N,error:R,status:q}=Fl(),G=g.handleSubmit(Z=>{if(t){const se=Xu(Z,0,"addParties",{addParties:[{partyType:"INDIVIDUAL",roles:["CONTROLLER"]}]}),_=lp(Z,{});r&&(I!=null&&I.id)?N({partyId:I==null?void 0:I.id,data:_},{onSettled:($,J)=>{var H;i==null||i($,(H=J==null?void 0:J.response)==null?void 0:H.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:$=>{var J,H;if((H=(J=$.response)==null?void 0:J.data)!=null&&H.context){const{context:K}=$.response.data,X=gs(K,0,"addParties");vs(g,X)}}}):D({id:t,data:se},{onSettled:($,J)=>{var H;n==null||n($,(H=J==null?void 0:J.response)==null?void 0:H.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:$=>{var J,H;if((H=(J=$.response)==null?void 0:J.data)!=null&&H.context){const{context:K}=$.response.data,X=gs(K,0,"addParties");vs(g,X)}}})}});if(s&&!L)return d.jsx(jr,{message:"Loading..."});if(B==="pending")return d.jsx(jr,{message:"Submitting..."});if(r&&q==="pending")return d.jsx(jr,{message:"Submitting..."});const V=Z=>{switch(Z){case"SSN":return"### - ## - ####";case"ITIN":return"### - ## - ####";default:return}},k=Z=>o(Z?`idValueLabels.individual.${Z}`:"idValueLabels.placeholder");return d.jsx(wi,{...g,children:d.jsxs("form",{onSubmit:G,className:"eb-space-y-6",children:[d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"General"}),d.jsx(We,{control:g.control,name:"firstName",type:"text"}),d.jsx(We,{control:g.control,name:"middleName",type:"text"}),d.jsx(We,{control:g.control,name:"lastName",type:"text",required:!0}),d.jsx(We,{control:g.control,name:"birthDate",type:"date",required:!0}),d.jsx(We,{control:g.control,name:"countryOfResidence",type:"combobox",options:$o.map(Z=>({value:Z,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",Z,"]"]})," ",o([`common:countries.${Z}`])]})})),required:!0}),d.jsx(We,{control:g.control,name:"jobTitle",type:"select",required:!0,options:[{value:"CEO",label:"CEO"},{value:"CFO",label:"CFO"},{value:"COO",label:"COO"},{value:"President",label:"President"},{value:"Chairman",label:"Chairman"},{value:"Senior Branch Manager",label:"Senior Branch Manager"},{value:"Other",label:"Other"}]})]}),d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"Individual Phone Information"}),d.jsx(Ke,{control:g.control,name:"individualPhone.phoneType",disabled:p("individualPhone"),render:({field:Z})=>d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:m("individualPhone"),children:"Phone Type"}),d.jsxs(Ci,{value:Z.value,onValueChange:Z.onChange,children:[d.jsx(Be,{children:d.jsx(ti,{ref:Z.ref,children:d.jsx(Si,{placeholder:"Select phone type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"BUSINESS_PHONE",children:"Business Phone"}),d.jsx(_t,{value:"MOBILE_PHONE",children:"Mobile Phone"}),d.jsx(_t,{value:"ALTERNATE_PHONE",children:"Alternate Phone"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:g.control,name:"individualPhone.phoneNumber",disabled:p("individualPhone"),render:({field:Z})=>d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:m("individualPhone"),children:"Phone Number"}),d.jsx(Be,{children:d.jsx(td,{...Z,countries:["CA","US"],placeholder:"Enter phone number",international:!1,defaultCountry:v.jurisdiction==="CanadaMS"?"CA":"US"})},v.jurisdiction),d.jsx(Ye,{})]})})]}),h("individualAddresses")&&d.jsx(d.Fragment,{children:b.map((Z,se)=>d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsxs("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:["Individual Address ",se+1]}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.addressType`,type:"select",required:!0,options:[{value:"MAILING_ADDRESS",label:o("addressTypes.MAILING_ADDRESS")}]}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.addressLines.0`,label:"Address Line 1",type:"text",required:!0}),d.jsx(We,{control:g.control,label:"Address Line 2",name:`individualAddresses.${se}.addressLines.1`,type:"text"}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.city`,type:"text",required:!0}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.state`,type:"select",options:CC,required:!0}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.postalCode`,type:"text",required:!0}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.country`,type:"combobox",options:$o.map(_=>({value:_,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",_,"]"]})," ",o([`common:countries.${_}`])]})})),required:!0}),d.jsx("div",{className:"eb-col-span-full",children:d.jsx(Qe,{type:"button",onClick:()=>x(se),variant:"outline",size:"sm",className:"eb-mt-2",disabled:b.length<=(f("individualAddresses").minItems??1),children:"Remove Address"})})]},`individual-address-${se}`))}),d.jsx(Qe,{type:"button",onClick:()=>y({addressType:"RESIDENTIAL_ADDRESS",addressLines:[""],state:"",city:"",postalCode:"",country:""}),disabled:C.length>=(f("addresses").maxItems??50),variant:"outline",size:"sm",children:"Add Address"}),h("individualIds")&&d.jsx(d.Fragment,{children:C.map((Z,se)=>d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsxs("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:["Individual ID ",se+1]}),d.jsx(We,{control:g.control,name:`individualIds.${se}.idType`,type:"select",options:[{value:"SSN",label:"SSN"},{value:"ITIN",label:"ITIN"}],required:!0}),d.jsx(We,{control:g.control,name:`individualIds.${se}.value`,type:V(g.watch(`individualIds.${se}.idType`))?"text-with-mask":"text",...V(g.watch(`individualIds.${se}.idType`))&&{maskFormat:V(g.watch(`individualIds.${se}.idType`)),maskChar:"_"},label:k(g.watch(`individualIds.${se}.idType`)),required:!0}),d.jsx(We,{control:g.control,name:`individualIds.${se}.issuer`,type:"combobox",options:$o.map(_=>({value:_,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",_,"]"]})," ",o([`common:countries.${_}`])]})})),required:!0}),d.jsx(We,{control:g.control,name:`individualIds.${se}.expiryDate`,type:"date",label:"Expiry Date"}),d.jsx(We,{control:g.control,name:`individualIds.${se}.description`,type:"textarea"}),d.jsx("div",{className:"eb-col-span-full",children:d.jsx(Qe,{type:"button",disabled:C.length<=(f("organizationIds").minItems??0),onClick:()=>w(se),variant:"outline",size:"sm",className:"eb-mt-2",children:"Remove Individual ID"})})]},`individual-id-${se}`))}),d.jsx(Qe,{type:"button",onClick:()=>E({idType:"SSN",value:"",issuer:""}),disabled:C.length>=(f("individualIds").maxItems??50),variant:"outline",size:"sm",children:"Add Individual ID"}),d.jsx(Eo,{error:r?R:F}),d.jsx(Pl,{})]})})},Wre=["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP","PUBLICLY_TRADED_COMPANY","NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","SOLE_PROPRIETORSHIP","UNINCORPORATED_ASSOCIATION"],Ure=we.object({organizationName:we.string().min(1,le.t("common:validation.required")),organizationType:we.enum(["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP","PUBLICLY_TRADED_COMPANY","NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","SOLE_PROPRIETORSHIP","UNINCORPORATED_ASSOCIATION"]),countryOfFormation:we.string().min(1,le.t("common:validation.required")).length(2,le.t("onboarding:fields.countryOfFormation.validation.exactlyTwoChars")),jurisdiction:we.enum(["US","CA"]),product:we.enum(["EMBEDDED_PAYMENTS","MERCHANT_SERVICES"]),organizationEmail:we.string().email()}),Kre=()=>{var G;const{nextStep:e}=Rn(),{clientId:t,onPostClientResponse:n,setClientId:r,availableProducts:i,availableJurisdictions:o,availableOrganizationTypes:s,usePartyResource:a,onPostPartyResponse:c}=ri(),{t:u}=uo(["onboarding","common"]),{data:f,status:p}=Li(t??""),{filterDefaultValues:m,filterSchema:h}=Hl(f),v=(i==null?void 0:i.length)===1?i[0]:void 0,g=(o==null?void 0:o.length)===1?o[0]:void 0,b=ed({resolver:wo(h(Ure)),defaultValues:m({jurisdiction:g,product:v})});l.useEffect(()=>{v&&b.setValue("product",v)},[v]),l.useEffect(()=>{g&&b.setValue("jurisdiction",g)},[g]);const y=(G=f==null?void 0:f.parties)==null?void 0:G.find(V=>(V==null?void 0:V.partyType)==="ORGANIZATION"),[x,C]=l.useState(!1);l.useEffect(()=>{var V;if(f&&p==="success"&&(y!=null&&y.id)&&!x){const k=Ju(f,y.id);k.product=((V=f.products)==null?void 0:V[0])??v,k.jurisdiction=k.jurisdiction??g,b.reset({...b.getValues(),...k}),C(!0)}},[f,p,b.reset,y==null?void 0:y.id,x,v,g]);const{mutate:E,error:w,status:I}=iR(),{mutate:L,error:A,status:D}=da(),{mutate:F,error:B,status:N}=Fl(),R=b.handleSubmit(V=>{if(t){const k=Xu(V,0,"addParties",{addParties:[{...y!=null&&y.id?{id:y==null?void 0:y.id,partyType:y==null?void 0:y.partyType,roles:y==null?void 0:y.roles}:{partyType:"ORGANIZATION",roles:["CLIENT"]}}]}),Q=lp(V,{...y!=null&&y.id?{id:y==null?void 0:y.id,partyType:y==null?void 0:y.partyType,roles:y==null?void 0:y.roles}:{partyType:"ORGANIZATION",roles:["CLIENT"]}});a&&(y!=null&&y.id)?F({partyId:y==null?void 0:y.id,data:Q},{onSettled:(Z,se)=>{var _;c==null||c(Z,(_=se==null?void 0:se.response)==null?void 0:_.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:Z=>{var se,_;if((_=(se=Z.response)==null?void 0:se.data)!=null&&_.context){const{context:$}=Z.response.data,J=gs($,0,"addParties");vs(b,J)}}}):L({id:t,data:k},{onSettled:(Z,se)=>{var _;n==null||n(Z,(_=se==null?void 0:se.response)==null?void 0:_.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:Z=>{var se,_;if((_=(se=Z.response)==null?void 0:se.data)!=null&&_.context){const{context:$}=Z.response.data,J=gs($,0,"addParties");vs(b,J)}}})}else{const k=Xu(V,0,"parties",{products:V.product?[V.product]:[],parties:[{partyType:"ORGANIZATION",roles:["CLIENT"]}]});E({data:k},{onSettled:(Q,Z)=>{var se;n==null||n(Q,(se=Z==null?void 0:Z.response)==null?void 0:se.data)},onSuccess:async Q=>{await(r==null?void 0:r(Q.id)),bn.success(`Client created successfully with ID: ${Q.id}`,{}),e()},onError:Q=>{var Z,se;if((se=(Z=Q.response)==null?void 0:Z.data)!=null&&se.context){const{context:_}=Q.response.data,$=gs(_,0,"parties");vs(b,$)}}})}});if(D==="pending"||I==="pending"||a&&N==="pending")return d.jsx(jr,{message:"Submitting..."});function q(V,k,Q){if(!V)return{fields:{},notes:[]};const Z=Object.entries(Wn).filter(([,se])=>se.baseRule.required?se.conditionalRules?!se.conditionalRules.some(_=>(!_.condition.product||k)&&(!_.condition.jurisdiction||Q)&&_.rule.visibility==="hidden"):!0:!1).reduce((se,[_,$])=>{const J=$.path.includes(".")?$.path.split(".")[0]:"generic",H=J==="generic"?"0_generic":J;return se[H]||(se[H]=[]),se[H].push(`fields.${_}.label`),se},{});return Z["0_generic"]&&(Z.generic=Z["0_generic"],delete Z["0_generic"]),{fields:Z,notes:["initialStepNotes.additionalQuestions",...V==="LIMITED_LIABILITY_COMPANY"?["initialStepNotes.llcOwners"]:[],"initialStepNotes.attestation","initialStepNotes.kycProcess"]}}return f&&!x?d.jsx(jr,{message:"Loading..."}):d.jsx(wi,{...b,children:d.jsx("form",{onSubmit:R,children:d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-8 md:eb-grid-cols-2",children:[d.jsxs("fieldset",{className:"eb-space-y-6",children:[d.jsx(We,{control:b.control,name:"product",type:"select",options:i.map(V=>({value:V,label:u(`clientProducts.${V}`)})),visibility:v||t?"readonly":"visible"}),d.jsx(We,{control:b.control,name:"jurisdiction",visibility:(o==null?void 0:o.length)===1?"readonly":"visible",type:"select",options:o.map(V=>({value:V,label:`${u(`clientJurisdictions.${V}`)} (${V})`}))}),d.jsx(We,{control:b.control,name:"organizationType",type:"select",options:(s??Wre).map(V=>({value:V,label:u(`organizationTypes.${V}`)})),disabled:!0}),d.jsx(We,{control:b.control,name:"organizationName",type:"text"}),d.jsx(We,{control:b.control,name:"organizationEmail",type:"email"}),d.jsx(We,{control:b.control,name:"countryOfFormation",type:"combobox",options:$o.map(V=>({value:V,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",V,"]"]})," ",u([`common:countries.${V}`])]})}))}),d.jsx(Eo,{error:a?B:A||w}),d.jsx(Pl,{})]}),d.jsxs(ur,{className:"eb-hidden md:eb-block",children:[d.jsxs(Nr,{className:"eb-border-l-2 eb-bg-gray-100",children:[d.jsx(Af,{children:u("initialStepDescription1")}),d.jsx(Af,{children:u("initialStepDescription2")})]}),d.jsx(dr,{children:b.watch("organizationType")?d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"eb-my-4 eb-text-sm",children:d.jsx(Vv,{t:u,i18nKey:b.watch("product")&&b.watch("jurisdiction")?"initialStepOrganizationTypeInformationFull":"initialStepOrganizationTypeInformationBasic",values:{organizationType:b.watch("organizationType"),product:b.watch("product")?u(`clientProducts.${b.watch("product")}`):"",jurisdiction:b.watch("jurisdiction")?u(`clientJurisdictions.${b.watch("jurisdiction")}`):""}})}),Object.entries(q(b.watch("organizationType")).fields).map(([V,k])=>d.jsxs("div",{className:"eb-mb-4",children:[d.jsx("h4",{className:"eb-mb-2 eb-text-sm eb-font-medium",children:u(`stepLabels.${V}`,{defaultValue:V})}),d.jsx("ul",{children:k.map(Q=>d.jsxs("li",{className:"eb-text-sm",children:["- ",u(Q,{defaultValue:Q})]},Q))})]},V)),d.jsxs("div",{className:"eb-mt-6",children:[d.jsx("h4",{className:"eb-mb-2 eb-text-sm eb-font-medium",children:u("initialStepNotes.title")}),d.jsx("ul",{children:q(b.watch("organizationType")).notes.map(V=>d.jsxs("li",{className:"eb-text-sm",children:["- ",u(V,{defaultValue:V})]},V))})]})]}):d.jsx("p",{className:"eb-my-4 eb-text-sm",children:d.jsx(Vv,{t:u,i18nKey:"initialStepNoOrganizationType"})})})]})]})})})};/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:SC,setPrototypeOf:EC,isFrozen:Yre,getPrototypeOf:Zre,getOwnPropertyDescriptor:Qre}=Object;let{freeze:gr,seal:ii,create:IC}=Object,{apply:qg,construct:Vg}=typeof Reflect<"u"&&Reflect;gr||(gr=function(t){return t}),ii||(ii=function(t){return t}),qg||(qg=function(t,n,r){return t.apply(n,r)}),Vg||(Vg=function(t,n){return new t(...n)});const Ep=Rr(Array.prototype.forEach),LC=Rr(Array.prototype.pop),od=Rr(Array.prototype.push),Ip=Rr(String.prototype.toLowerCase),Gg=Rr(String.prototype.toString),AC=Rr(String.prototype.match),sd=Rr(String.prototype.replace),Xre=Rr(String.prototype.indexOf),Jre=Rr(String.prototype.trim),$i=Rr(Object.prototype.hasOwnProperty),vr=Rr(RegExp.prototype.test),ad=eie(TypeError);function Rr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return qg(e,t,r)}}function eie(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Vg(e,n)}}function Mt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ip;EC&&EC(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const o=n(i);o!==i&&(Yre(t)||(t[r]=o),i=o)}e[i]=!0}return e}function tie(e){for(let t=0;t<e.length;t++)$i(e,t)||(e[t]=null);return e}function ma(e){const t=IC(null);for(const[n,r]of SC(e))$i(e,n)&&(Array.isArray(r)?t[n]=tie(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=ma(r):t[n]=r);return t}function ld(e,t){for(;e!==null;){const r=Qre(e,t);if(r){if(r.get)return Rr(r.get);if(typeof r.value=="function")return Rr(r.value)}e=Zre(e)}function n(){return null}return n}const DC=gr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Wg=gr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ug=gr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),nie=gr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Kg=gr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),rie=gr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),MC=gr(["#text"]),$C=gr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Yg=gr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),TC=gr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Lp=gr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),iie=ii(/\{\{[\w\W]*|[\w\W]*\}\}/gm),oie=ii(/<%[\w\W]*|[\w\W]*%>/gm),sie=ii(/\$\{[\w\W]*}/gm),aie=ii(/^data-[\-\w.\u00B7-\uFFFF]+$/),lie=ii(/^aria-[\-\w]+$/),FC=ii(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cie=ii(/^(?:\w+script|data):/i),uie=ii(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),NC=ii(/^html$/i),die=ii(/^[a-z][.\w]*(-[.\w]+)+$/i);var PC=Object.freeze({__proto__:null,ARIA_ATTR:lie,ATTR_WHITESPACE:uie,CUSTOM_ELEMENT:die,DATA_ATTR:aie,DOCTYPE_NAME:NC,ERB_EXPR:oie,IS_ALLOWED_URI:FC,IS_SCRIPT_OR_DATA:cie,MUSTACHE_EXPR:iie,TMPLIT_EXPR:sie});const cd={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},fie=function(){return typeof window>"u"?null:window},pie=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},OC=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _C(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fie();const t=De=>_C(De);if(t.version="3.2.3",t.removed=[],!e||!e.document||e.document.nodeType!==cd.document)return t.isSupported=!1,t;let{document:n}=e;const r=n,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:a,Element:c,NodeFilter:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:h}=e,v=c.prototype,g=ld(v,"cloneNode"),b=ld(v,"remove"),y=ld(v,"nextSibling"),x=ld(v,"childNodes"),C=ld(v,"parentNode");if(typeof s=="function"){const De=n.createElement("template");De.content&&De.content.ownerDocument&&(n=De.content.ownerDocument)}let E,w="";const{implementation:I,createNodeIterator:L,createDocumentFragment:A,getElementsByTagName:D}=n,{importNode:F}=r;let B=OC();t.isSupported=typeof SC=="function"&&typeof C=="function"&&I&&I.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:R,TMPLIT_EXPR:q,DATA_ATTR:G,ARIA_ATTR:V,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:Q,CUSTOM_ELEMENT:Z}=PC;let{IS_ALLOWED_URI:se}=PC,_=null;const $=Mt({},[...DC,...Wg,...Ug,...Kg,...MC]);let J=null;const H=Mt({},[...$C,...Yg,...TC,...Lp]);let K=Object.seal(IC(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,oe=null,re=!0,ue=!0,pe=!1,Se=!0,$e=!1,de=!0,nt=!1,Ie=!1,it=!1,ge=!1,M=!1,j=!1,T=!0,ie=!1;const te="user-content-";let ne=!0,ee=!1,fe={},Ne=null;const Je=Mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Pt=null;const cn=Mt({},["audio","video","img","source","image","track"]);let Qt=null;const $n=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),wn="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",rn="http://www.w3.org/1999/xhtml";let on=rn,pn=!1,Bn=null;const rt=Mt({},[wn,Cn,rn],Gg);let Ct=Mt({},["mi","mo","mn","ms","mtext"]),Et=Mt({},["annotation-xml"]);const Sn=Mt({},["title","style","font","a","script"]);let mn=null;const Kr=["application/xhtml+xml","text/html"],Vo="text/html";let hn=null,fi=null;const Dc=n.createElement("form"),Ps=function(Y){return Y instanceof RegExp||Y instanceof Function},Go=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(fi&&fi===Y)){if((!Y||typeof Y!="object")&&(Y={}),Y=ma(Y),mn=Kr.indexOf(Y.PARSER_MEDIA_TYPE)===-1?Vo:Y.PARSER_MEDIA_TYPE,hn=mn==="application/xhtml+xml"?Gg:Ip,_=$i(Y,"ALLOWED_TAGS")?Mt({},Y.ALLOWED_TAGS,hn):$,J=$i(Y,"ALLOWED_ATTR")?Mt({},Y.ALLOWED_ATTR,hn):H,Bn=$i(Y,"ALLOWED_NAMESPACES")?Mt({},Y.ALLOWED_NAMESPACES,Gg):rt,Qt=$i(Y,"ADD_URI_SAFE_ATTR")?Mt(ma($n),Y.ADD_URI_SAFE_ATTR,hn):$n,Pt=$i(Y,"ADD_DATA_URI_TAGS")?Mt(ma(cn),Y.ADD_DATA_URI_TAGS,hn):cn,Ne=$i(Y,"FORBID_CONTENTS")?Mt({},Y.FORBID_CONTENTS,hn):Je,X=$i(Y,"FORBID_TAGS")?Mt({},Y.FORBID_TAGS,hn):{},oe=$i(Y,"FORBID_ATTR")?Mt({},Y.FORBID_ATTR,hn):{},fe=$i(Y,"USE_PROFILES")?Y.USE_PROFILES:!1,re=Y.ALLOW_ARIA_ATTR!==!1,ue=Y.ALLOW_DATA_ATTR!==!1,pe=Y.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=Y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$e=Y.SAFE_FOR_TEMPLATES||!1,de=Y.SAFE_FOR_XML!==!1,nt=Y.WHOLE_DOCUMENT||!1,ge=Y.RETURN_DOM||!1,M=Y.RETURN_DOM_FRAGMENT||!1,j=Y.RETURN_TRUSTED_TYPE||!1,it=Y.FORCE_BODY||!1,T=Y.SANITIZE_DOM!==!1,ie=Y.SANITIZE_NAMED_PROPS||!1,ne=Y.KEEP_CONTENT!==!1,ee=Y.IN_PLACE||!1,se=Y.ALLOWED_URI_REGEXP||FC,on=Y.NAMESPACE||rn,Ct=Y.MATHML_TEXT_INTEGRATION_POINTS||Ct,Et=Y.HTML_INTEGRATION_POINTS||Et,K=Y.CUSTOM_ELEMENT_HANDLING||{},Y.CUSTOM_ELEMENT_HANDLING&&Ps(Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(K.tagNameCheck=Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&Ps(Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(K.attributeNameCheck=Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&typeof Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$e&&(ue=!1),M&&(ge=!0),fe&&(_=Mt({},MC),J=[],fe.html===!0&&(Mt(_,DC),Mt(J,$C)),fe.svg===!0&&(Mt(_,Wg),Mt(J,Yg),Mt(J,Lp)),fe.svgFilters===!0&&(Mt(_,Ug),Mt(J,Yg),Mt(J,Lp)),fe.mathMl===!0&&(Mt(_,Kg),Mt(J,TC),Mt(J,Lp))),Y.ADD_TAGS&&(_===$&&(_=ma(_)),Mt(_,Y.ADD_TAGS,hn)),Y.ADD_ATTR&&(J===H&&(J=ma(J)),Mt(J,Y.ADD_ATTR,hn)),Y.ADD_URI_SAFE_ATTR&&Mt(Qt,Y.ADD_URI_SAFE_ATTR,hn),Y.FORBID_CONTENTS&&(Ne===Je&&(Ne=ma(Ne)),Mt(Ne,Y.FORBID_CONTENTS,hn)),ne&&(_["#text"]=!0),nt&&Mt(_,["html","head","body"]),_.table&&(Mt(_,["tbody"]),delete X.tbody),Y.TRUSTED_TYPES_POLICY){if(typeof Y.TRUSTED_TYPES_POLICY.createHTML!="function")throw ad('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ad('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=Y.TRUSTED_TYPES_POLICY,w=E.createHTML("")}else E===void 0&&(E=pie(h,i)),E!==null&&typeof w=="string"&&(w=E.createHTML(""));gr&&gr(Y),fi=Y}},Ta=Mt({},[...Wg,...Ug,...nie]),Fa=Mt({},[...Kg,...rie]),Na=function(Y){let be=C(Y);(!be||!be.tagName)&&(be={namespaceURI:on,tagName:"template"});const Fe=Ip(Y.tagName),$t=Ip(be.tagName);return Bn[Y.namespaceURI]?Y.namespaceURI===Cn?be.namespaceURI===rn?Fe==="svg":be.namespaceURI===wn?Fe==="svg"&&($t==="annotation-xml"||Ct[$t]):!!Ta[Fe]:Y.namespaceURI===wn?be.namespaceURI===rn?Fe==="math":be.namespaceURI===Cn?Fe==="math"&&Et[$t]:!!Fa[Fe]:Y.namespaceURI===rn?be.namespaceURI===Cn&&!Et[$t]||be.namespaceURI===wn&&!Ct[$t]?!1:!Fa[Fe]&&(Sn[Fe]||!Ta[Fe]):!!(mn==="application/xhtml+xml"&&Bn[Y.namespaceURI]):!1},ar=function(Y){od(t.removed,{element:Y});try{C(Y).removeChild(Y)}catch{b(Y)}},Wo=function(Y,be){try{od(t.removed,{attribute:be.getAttributeNode(Y),from:be})}catch{od(t.removed,{attribute:null,from:be})}if(be.removeAttribute(Y),Y==="is")if(ge||M)try{ar(be)}catch{}else try{be.setAttribute(Y,"")}catch{}},Pa=function(Y){let be=null,Fe=null;if(it)Y="<remove></remove>"+Y;else{const sn=AC(Y,/^[\r\n\t ]+/);Fe=sn&&sn[0]}mn==="application/xhtml+xml"&&on===rn&&(Y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Y+"</body></html>");const $t=E?E.createHTML(Y):Y;if(on===rn)try{be=new m().parseFromString($t,mn)}catch{}if(!be||!be.documentElement){be=I.createDocument(on,"template",null);try{be.documentElement.innerHTML=pn?w:$t}catch{}}const gn=be.body||be.documentElement;return Y&&Fe&&gn.insertBefore(n.createTextNode(Fe),gn.childNodes[0]||null),on===rn?D.call(be,nt?"html":"body")[0]:nt?be.documentElement:gn},Oa=function(Y){return L.call(Y.ownerDocument||Y,Y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},_a=function(Y){return Y instanceof p&&(typeof Y.nodeName!="string"||typeof Y.textContent!="string"||typeof Y.removeChild!="function"||!(Y.attributes instanceof f)||typeof Y.removeAttribute!="function"||typeof Y.setAttribute!="function"||typeof Y.namespaceURI!="string"||typeof Y.insertBefore!="function"||typeof Y.hasChildNodes!="function")},U=function(Y){return typeof a=="function"&&Y instanceof a};function Ce(De,Y,be){Ep(De,Fe=>{Fe.call(t,Y,be,fi)})}const Re=function(Y){let be=null;if(Ce(B.beforeSanitizeElements,Y,null),_a(Y))return ar(Y),!0;const Fe=hn(Y.nodeName);if(Ce(B.uponSanitizeElement,Y,{tagName:Fe,allowedTags:_}),Y.hasChildNodes()&&!U(Y.firstElementChild)&&vr(/<[/\w]/g,Y.innerHTML)&&vr(/<[/\w]/g,Y.textContent)||Y.nodeType===cd.progressingInstruction||de&&Y.nodeType===cd.comment&&vr(/<[/\w]/g,Y.data))return ar(Y),!0;if(!_[Fe]||X[Fe]){if(!X[Fe]&&kt(Fe)&&(K.tagNameCheck instanceof RegExp&&vr(K.tagNameCheck,Fe)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Fe)))return!1;if(ne&&!Ne[Fe]){const $t=C(Y)||Y.parentNode,gn=x(Y)||Y.childNodes;if(gn&&$t){const sn=gn.length;for(let Gt=sn-1;Gt>=0;--Gt){const $r=g(gn[Gt],!0);$r.__removalCount=(Y.__removalCount||0)+1,$t.insertBefore($r,y(Y))}}}return ar(Y),!0}return Y instanceof c&&!Na(Y)||(Fe==="noscript"||Fe==="noembed"||Fe==="noframes")&&vr(/<\/no(script|embed|frames)/i,Y.innerHTML)?(ar(Y),!0):($e&&Y.nodeType===cd.text&&(be=Y.textContent,Ep([N,R,q],$t=>{be=sd(be,$t," ")}),Y.textContent!==be&&(od(t.removed,{element:Y.cloneNode()}),Y.textContent=be)),Ce(B.afterSanitizeElements,Y,null),!1)},dt=function(Y,be,Fe){if(T&&(be==="id"||be==="name")&&(Fe in n||Fe in Dc))return!1;if(!(ue&&!oe[be]&&vr(G,be))){if(!(re&&vr(V,be))){if(!J[be]||oe[be]){if(!(kt(Y)&&(K.tagNameCheck instanceof RegExp&&vr(K.tagNameCheck,Y)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Y))&&(K.attributeNameCheck instanceof RegExp&&vr(K.attributeNameCheck,be)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(be))||be==="is"&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&vr(K.tagNameCheck,Fe)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Fe))))return!1}else if(!Qt[be]){if(!vr(se,sd(Fe,Q,""))){if(!((be==="src"||be==="xlink:href"||be==="href")&&Y!=="script"&&Xre(Fe,"data:")===0&&Pt[Y])){if(!(pe&&!vr(k,sd(Fe,Q,"")))){if(Fe)return!1}}}}}}return!0},kt=function(Y){return Y!=="annotation-xml"&&AC(Y,Z)},Vt=function(Y){Ce(B.beforeSanitizeAttributes,Y,null);const{attributes:be}=Y;if(!be||_a(Y))return;const Fe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let $t=be.length;for(;$t--;){const gn=be[$t],{name:sn,namespaceURI:Gt,value:$r}=gn,za=hn(sn);let Xn=sn==="value"?$r:Jre($r);if(Fe.attrName=za,Fe.attrValue=Xn,Fe.keepAttr=!0,Fe.forceKeepAttr=void 0,Ce(B.uponSanitizeAttribute,Y,Fe),Xn=Fe.attrValue,ie&&(za==="id"||za==="name")&&(Wo(sn,Y),Xn=te+Xn),de&&vr(/((--!?|])>)|<\/(style|title)/i,Xn)){Wo(sn,Y);continue}if(Fe.forceKeepAttr||(Wo(sn,Y),!Fe.keepAttr))continue;if(!Se&&vr(/\/>/i,Xn)){Wo(sn,Y);continue}$e&&Ep([N,R,q],pL=>{Xn=sd(Xn,pL," ")});const fL=hn(Y.nodeName);if(dt(fL,za,Xn)){if(E&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Gt)switch(h.getAttributeType(fL,za)){case"TrustedHTML":{Xn=E.createHTML(Xn);break}case"TrustedScriptURL":{Xn=E.createScriptURL(Xn);break}}try{Gt?Y.setAttributeNS(Gt,sn,Xn):Y.setAttribute(sn,Xn),_a(Y)?ar(Y):LC(t.removed)}catch{}}}Ce(B.afterSanitizeAttributes,Y,null)},Ft=function De(Y){let be=null;const Fe=Oa(Y);for(Ce(B.beforeSanitizeShadowDOM,Y,null);be=Fe.nextNode();)Ce(B.uponSanitizeShadowNode,be,null),Re(be),Vt(be),be.content instanceof o&&De(be.content);Ce(B.afterSanitizeShadowDOM,Y,null)};return t.sanitize=function(De){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},be=null,Fe=null,$t=null,gn=null;if(pn=!De,pn&&(De="<!-->"),typeof De!="string"&&!U(De))if(typeof De.toString=="function"){if(De=De.toString(),typeof De!="string")throw ad("dirty is not a string, aborting")}else throw ad("toString is not a function");if(!t.isSupported)return De;if(Ie||Go(Y),t.removed=[],typeof De=="string"&&(ee=!1),ee){if(De.nodeName){const $r=hn(De.nodeName);if(!_[$r]||X[$r])throw ad("root node is forbidden and cannot be sanitized in-place")}}else if(De instanceof a)be=Pa("<!---->"),Fe=be.ownerDocument.importNode(De,!0),Fe.nodeType===cd.element&&Fe.nodeName==="BODY"||Fe.nodeName==="HTML"?be=Fe:be.appendChild(Fe);else{if(!ge&&!$e&&!nt&&De.indexOf("<")===-1)return E&&j?E.createHTML(De):De;if(be=Pa(De),!be)return ge?null:j?w:""}be&&it&&ar(be.firstChild);const sn=Oa(ee?De:be);for(;$t=sn.nextNode();)Re($t),Vt($t),$t.content instanceof o&&Ft($t.content);if(ee)return De;if(ge){if(M)for(gn=A.call(be.ownerDocument);be.firstChild;)gn.appendChild(be.firstChild);else gn=be;return(J.shadowroot||J.shadowrootmode)&&(gn=F.call(r,gn,!0)),gn}let Gt=nt?be.outerHTML:be.innerHTML;return nt&&_["!doctype"]&&be.ownerDocument&&be.ownerDocument.doctype&&be.ownerDocument.doctype.name&&vr(NC,be.ownerDocument.doctype.name)&&(Gt="<!DOCTYPE "+be.ownerDocument.doctype.name+`>
|
|
299
|
+
`).map((B,N)=>d.jsx("p",{className:"eb-text-sm",children:B},N))}),d.jsx(yl,{}),(F=x==null?void 0:x.requirements)==null?void 0:F.map((B,N)=>{const R=B.documentTypes[0];return d.jsx(Ke,{control:p.control,name:`${x==null?void 0:x.id}.${R}`,render:({field:{onChange:q,...G}})=>d.jsxs(d.Fragment,{children:[d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:!0,children:yC[R].label}),d.jsx(Xf,{children:yC[R].description}),d.jsx(Be,{children:d.jsx(jre,{containerClassName:"eb-max-w-xl",...G,multiple:(B.minRequired??0)>1,accept:{"application/pdf":[".pdf"],"image/jpeg":[".jpeg",".jpg"],"image/png":[".png"],"image/gif":[".gif"],"image/bmp":[".bmp"],"image/tiff":[".tiff",".tif"],"image/webp":[".webp"]},onChange:V=>{const Q=V.filter(Z=>Z.size>2097152?(p.setError(`${x==null?void 0:x.id}.${R}`,{message:"Each file must be less than 2MB"}),!1):(p.clearErrors(`${x==null?void 0:x.id}.${R}`),!0));q(Q)}})}),d.jsx(Ye,{})]}),d.jsx(yl,{})]})},N)})]},x==null?void 0:x.id)}),!e&&d.jsx(Pl,{}),e&&(c==null?void 0:c.length)!==0&&d.jsx(Qe,{type:"submit",disabled:!p.formState.isValid||p.formState.isSubmitting,className:"eb-ml-auto",children:p.formState.isSubmitting?"Uploading...":"Upload Documents"})]})})},wC={APPROVED:{icon:d.jsx(AL,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-green-100 eb-text-green-800"},DECLINED:{icon:d.jsx(gv,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-red-100 eb-text-red-800"},INFORMATION_REQUESTED:{icon:d.jsx(hm,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-blue-100 eb-text-blue-800"},NEW:{icon:d.jsx(vv,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-purple-100 eb-text-purple-800"},REVIEW_IN_PROGRESS:{icon:d.jsx(ML,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-yellow-100 eb-text-yellow-800"},SUSPENDED:{icon:d.jsx(DL,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-orange-100 eb-text-orange-800"},TERMINATED:{icon:d.jsx(gv,{className:"eb-h-4 eb-w-4"}),color:"eb-bg-gray-100 eb-text-gray-800"}},Hre={NEW:"A new client application has been submitted and is awaiting review.",REVIEW_IN_PROGRESS:"The client application is currently under review.",INFORMATION_REQUESTED:"Additional information has been requested from the client.",APPROVED:"The client application has been approved.",DECLINED:"The client application has been declined.",SUSPENDED:"The client account has been temporarily suspended.",TERMINATED:"The client account has been terminated."},Bg=({label:e,value:t})=>d.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[d.jsxs("span",{className:"eb-text-sm eb-font-medium eb-text-gray-500",children:[e,":"]}),d.jsx("span",{className:"eb-text-sm eb-font-bold",children:t})]}),Bre=()=>d.jsxs(ur,{className:"eb-w-full",children:[d.jsx(Nr,{children:d.jsx(M8,{className:"eb-h-6 eb-w-48"})}),d.jsx(dr,{children:d.jsx("div",{className:"eb-space-y-4",children:[1,2,3,4].map(e=>d.jsx(M8,{className:"eb-h-4 eb-w-full"},e))})})]}),qre=()=>{var c,u,f;const{clientId:e}=ri(),{data:t,isLoading:n,error:r}=Li(e??"");if(n)return d.jsx(Bre,{});if(r||!t)return d.jsx(ur,{className:"eb-w-full",children:d.jsx(dr,{className:"eb-p-6",children:d.jsx("div",{className:"eb-text-center eb-text-red-600",children:r?"Error loading client information":"No client data available"})})});const i=(c=t.parties)==null?void 0:c.find(p=>(p==null?void 0:p.partyType)==="ORGANIZATION"),o=t.status,{icon:s,color:a}=wC[o]||wC.NEW;return d.jsxs(ur,{className:"eb-w-full",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-xl eb-font-bold",children:"Client Onboarding Status"})}),d.jsxs(dr,{children:[d.jsxs("div",{className:"eb-space-y-4",children:[d.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[d.jsx("span",{className:"eb-text-sm eb-font-medium eb-text-gray-500",children:"Status:"}),d.jsxs(vu,{className:`eb-flex eb-items-center eb-gap-1 ${a}`,children:[s,o]})]}),d.jsx(Bg,{label:"Client ID",value:t.id}),d.jsx(Bg,{label:"Organization",value:((u=i==null?void 0:i.organizationDetails)==null?void 0:u.organizationName)||"N/A"}),d.jsx(Bg,{label:"Organization Type",value:((f=i==null?void 0:i.organizationDetails)==null?void 0:f.organizationType)||"N/A"}),d.jsx("div",{className:"eb-mt-4 eb-text-sm eb-text-gray-500",children:d.jsx("p",{children:Hre[o]})})]}),d.jsx(xC,{standalone:!0})]})]})},Vre=()=>{var N;const{nextStep:e,prevStep:t,isDisabledStep:n}=Rn(),{clientId:r,onPostClientResponse:i}=ri(),[o,s]=l.useState(!1),[a,c]=l.useState(null),{data:u,status:f,refetch:p}=Li(r??""),{clientContext:m}=Hl(u),h=Js({resolver:wo(Ig)}),v=((N=u==null?void 0:u.parties)==null?void 0:N.filter(R=>{var q;return(R==null?void 0:R.partyType)==="INDIVIDUAL"&&((q=R==null?void 0:R.roles)==null?void 0:q.includes("DECISION_MAKER"))}))||[],{fields:g,append:b,remove:y}=Yi({control:h.control,name:"individualAddresses"}),{fields:x,append:C,remove:E}=Yi({control:h.control,name:"individualIds"}),{mutate:w,error:I,status:L}=da({mutation:{onSettled:(R,q)=>{var G;i==null||i(R,(G=q==null?void 0:q.response)==null?void 0:G.data)},onSuccess:()=>{bn.success("Decision maker details updated successfully"),s(!1),c(null),h.reset({}),p()},onError:()=>{bn.error("Failed to update decision maker details")}}}),A=R=>{if(f==="success"&&u){c(R);const q=Ju(u,R);h.reset(q),s(!0)}},D=()=>{c(null),h.reset({}),s(!0)},F=R=>{r&&w({id:r,data:{removeParties:[{id:R}]}})},B=R=>{if(r){const q={addParties:[{...a?{id:a}:{},...R}]};w({id:r,data:q})}};return L==="pending"?d.jsx(jr,{message:"Submitting..."}):d.jsxs("div",{className:"eb-space-y-6",children:[d.jsx("h2",{className:"eb-text-2xl eb-font-bold",children:"Decision Makers"}),d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[v.map(R=>{var q,G,V;return d.jsxs(ur,{children:[d.jsx(Nr,{children:d.jsx(yi,{children:`${(q=R==null?void 0:R.individualDetails)==null?void 0:q.firstName} ${(G=R==null?void 0:R.individualDetails)==null?void 0:G.lastName}`})}),d.jsxs(dr,{children:[d.jsx("p",{children:((V=R==null?void 0:R.individualDetails)==null?void 0:V.jobTitle)??""}),d.jsxs("div",{className:"eb-mt-4 eb-space-x-2",children:[d.jsxs(Qe,{variant:"outline",size:"sm",onClick:()=>(R==null?void 0:R.id)&&A(R==null?void 0:R.id),children:[d.jsx(bv,{className:"eb-mr-2 eb-h-4 eb-w-4"}),"Edit"]}),d.jsxs(Qe,{variant:"outline",size:"sm",onClick:()=>(R==null?void 0:R.id)&&F(R==null?void 0:R.id),children:[d.jsx(yv,{className:"eb-mr-2 eb-h-4 eb-w-4"}),"Delete"]})]})]})]},R.id)}),d.jsx(ur,{className:"eb-flex eb-cursor-pointer eb-items-center eb-justify-center",onClick:D,children:d.jsxs(dr,{className:"eb-flex eb-items-center eb-justify-center",children:[d.jsx(PL,{className:"eb-h-6 eb-w-6"}),d.jsx("p",{className:"eb-mt-2",children:"Add Decision Maker"})]})})]}),d.jsx(jf,{open:o,onOpenChange:s,children:d.jsxs(yu,{className:"eb-max-h-full eb-max-w-3xl eb-overflow-auto",children:[d.jsx(xu,{children:d.jsx(wu,{children:a?"Edit Decision Maker":"Add Decision Maker"})}),d.jsx(wi,{...h,children:d.jsxs("form",{onSubmit:h.handleSubmit(B),className:"eb-space-y-6",children:[d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-6 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:"firstName",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"First Name"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Enter first name"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"middleName",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Middle Name"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Enter middle name (optional)"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"lastName",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Last Name"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Enter last name"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"birthDate",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Date of Birth"}),d.jsx(Be,{children:d.jsx(bt,{...R,type:"date"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"countryOfResidence",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Country of Residence"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"e.g., US",maxLength:2})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"jobTitle",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Job Title"}),d.jsxs(Ci,{onValueChange:R.onChange,defaultValue:R.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select job title"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"CEO",children:"CEO"}),d.jsx(_t,{value:"CFO",children:"CFO"}),d.jsx(_t,{value:"COO",children:"COO"}),d.jsx(_t,{value:"President",children:"President"}),d.jsx(_t,{value:"Chairman",children:"Chairman"}),d.jsx(_t,{value:"Senior Branch Manager",children:"Senior Branch Manager"}),d.jsx(_t,{value:"Other",children:"Other"})]})]}),d.jsx(Ye,{})]})}),h.watch("jobTitle")==="Other"&&d.jsx(Ke,{control:h.control,name:"jobTitleDescription",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Job Title Description"}),d.jsx(Be,{children:d.jsx(bt,{...R,placeholder:"Describe your job title"})}),d.jsx(Ye,{})]})})]}),d.jsxs(ur,{className:"eb-mt-6",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-lg eb-font-medium",children:"Phone Information"})}),d.jsxs(dr,{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:"individualPhone.phoneType",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Phone Type"}),d.jsxs(Ci,{onValueChange:R.onChange,defaultValue:R.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select phone type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"BUSINESS_PHONE",children:"Business Phone"}),d.jsx(_t,{value:"MOBILE_PHONE",children:"Mobile Phone"}),d.jsx(_t,{value:"ALTERNATE_PHONE",children:"Alternate Phone"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:"individualPhone.phoneNumber",render:({field:R})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Phone Number"}),d.jsx(Be,{children:d.jsx(td,{...R,countries:["CA","US"],placeholder:"Enter phone number",international:!1,defaultCountry:m.jurisdiction==="CanadaMS"?"CA":"US"})},m.jurisdiction),d.jsx(Ye,{})]})})]})]}),d.jsxs(ur,{className:"eb-mt-6",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-lg eb-font-medium",children:"Addresses"})}),d.jsxs(dr,{className:"eb-space-y-4",children:[g==null?void 0:g.map((R,q)=>d.jsxs("div",{className:"eb-space-y-4 eb-rounded-md eb-border eb-p-4",children:[d.jsxs("h4",{className:"eb-font-medium",children:["Address ",q+1]}),d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.addressType`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Address Type"}),d.jsxs(Ci,{onValueChange:G.onChange,defaultValue:G.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select address type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"LEGAL_ADDRESS",children:"Legal Address"}),d.jsx(_t,{value:"MAILING_ADDRESS",children:"Mailing Address"}),d.jsx(_t,{value:"BUSINESS_ADDRESS",children:"Business Address"}),d.jsx(_t,{value:"RESIDENTIAL_ADDRESS",children:"Residential Address"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.addressLines.0`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Address Line 1"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter address line 1"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.city`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"City"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter city"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.state`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"State"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter state"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.postalCode`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Postal Code"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter postal code"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualAddresses.${q}.country`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Country"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter country code",maxLength:2})}),d.jsx(Ye,{})]})})]}),d.jsx(Qe,{type:"button",onClick:()=>y(q),variant:"outline",size:"sm",className:"eb-mt-2",children:"Remove Address"})]},R==null?void 0:R.id)),d.jsx(Qe,{type:"button",onClick:()=>b({addressType:"RESIDENTIAL_ADDRESS",addressLines:[""],state:"",city:"",postalCode:"",country:""}),variant:"outline",size:"sm",children:"Add Address"})]})]}),d.jsxs(ur,{className:"eb-mt-6",children:[d.jsx(Nr,{children:d.jsx(yi,{className:"eb-text-lg eb-font-medium",children:"Individual IDs"})}),d.jsxs(dr,{className:"eb-space-y-4",children:[x.map((R,q)=>d.jsxs("div",{className:"eb-space-y-4 eb-rounded-md eb-border eb-p-4",children:[d.jsxs("h4",{className:"eb-font-medium",children:["ID ",q+1]}),d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx(Ke,{control:h.control,name:`individualIds.${q}.idType`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"ID Type"}),d.jsxs(Ci,{onValueChange:G.onChange,defaultValue:G.value,children:[d.jsx(Be,{children:d.jsx(ti,{children:d.jsx(Si,{placeholder:"Select ID type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"SSN",children:"SSN"}),d.jsx(_t,{value:"ITIN",children:"ITIN"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.value`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"ID Value"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter ID value"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.issuer`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Issuer"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter issuer country code",maxLength:2})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.expiryDate`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Expiry Date"}),d.jsx(Be,{children:d.jsx(bt,{...G,type:"date"})}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:h.control,name:`individualIds.${q}.description`,render:({field:G})=>d.jsxs(Ve,{children:[d.jsx(Ge,{children:"Description"}),d.jsx(Be,{children:d.jsx(bt,{...G,placeholder:"Enter description (optional)"})}),d.jsx(Ye,{})]})})]}),d.jsx(Qe,{type:"button",onClick:()=>E(q),variant:"outline",size:"sm",className:"eb-mt-2",children:"Remove ID"})]},R.id)),d.jsx(Qe,{type:"button",onClick:()=>C({idType:"SSN",value:"",issuer:""}),variant:"outline",size:"sm",children:"Add ID"})]})]}),d.jsxs(Qe,{type:"submit",children:[a?"Update":"Add"," Decision Maker"]})]})})]})}),d.jsx(Eo,{error:I}),d.jsxs("div",{className:"eb-flex eb-w-full eb-justify-end eb-gap-4",children:[d.jsx(Qe,{disabled:n,variant:"secondary",onClick:t,children:"Previous"}),d.jsx(Qe,{onClick:e,children:"Next"})]})]})},CC=[{label:"Alabama",value:"AL"},{label:"Alaska",value:"AK"},{label:"Arizona",value:"AZ"},{label:"Arkansas",value:"AR"},{label:"California",value:"CA"},{label:"Colorado",value:"CO"},{label:"Connecticut",value:"CT"},{label:"Delaware",value:"DE"},{label:"Florida",value:"FL"},{label:"Georgia",value:"GA"},{label:"Hawaii",value:"HI"},{label:"Idaho",value:"ID"},{label:"Illinois",value:"IL"},{label:"Indiana",value:"IN"},{label:"Iowa",value:"IA"},{label:"Kansas",value:"KS"},{label:"Kentucky",value:"KY"},{label:"Louisiana",value:"LA"},{label:"Maine",value:"ME"},{label:"Maryland",value:"MD"},{label:"Massachusetts",value:"MA"},{label:"Michigan",value:"MI"},{label:"Minnesota",value:"MN"},{label:"Mississippi",value:"MS"},{label:"Missouri",value:"MO"},{label:"Montana",value:"MT"},{label:"Nebraska",value:"NE"},{label:"Nevada",value:"NV"},{label:"New Hampshire",value:"NH"},{label:"New Jersey",value:"NJ"},{label:"New Mexico",value:"NM"},{label:"New York",value:"NY"},{label:"North Carolina",value:"NC"},{label:"North Dakota",value:"ND"},{label:"Ohio",value:"OH"},{label:"Oklahoma",value:"OK"},{label:"Oregon",value:"OR"},{label:"Pennsylvania",value:"PA"},{label:"Rhode Island",value:"RI"},{label:"South Carolina",value:"SC"},{label:"South Dakota",value:"SD"},{label:"Tennessee",value:"TN"},{label:"Texas",value:"TX"},{label:"Utah",value:"UT"},{label:"Vermont",value:"VT"},{label:"Virginia",value:"VA"},{label:"Washington",value:"WA"},{label:"West Virginia",value:"WV"},{label:"Wisconsin",value:"WI"},{label:"Wyoming",value:"WY"}],Gre=()=>{var Q;const{nextStep:e}=Rn(),{clientId:t,onPostClientResponse:n,usePartyResource:r,onPostPartyResponse:i}=ri(),{t:o}=uo("onboarding"),{data:s,status:a}=Li(t??""),{filterDefaultValues:c,filterSchema:u,getFieldRule:f,isFieldDisabled:p,isFieldRequired:m,isFieldVisible:h,clientContext:v}=Hl(s),g=ed({resolver:wo(u(Ig)),defaultValues:c({individualAddresses:[{addressType:"RESIDENTIAL_ADDRESS",addressLines:[""],state:"",city:"",postalCode:"",country:""}],individualIds:[{idType:"SSN",value:"",issuer:"",expiryDate:"",description:""}],individualPhone:{phoneType:"MOBILE_PHONE",phoneNumber:""}})}),{fields:b,append:y,remove:x}=Yi({control:g.control,name:"individualAddresses"}),{fields:C,append:E,remove:w}=Yi({control:g.control,name:"individualIds"}),I=(Q=s==null?void 0:s.parties)==null?void 0:Q.find(Z=>{var se;return(Z==null?void 0:Z.partyType)==="INDIVIDUAL"&&((se=Z==null?void 0:Z.roles)==null?void 0:se.includes("CONTROLLER"))}),[L,A]=l.useState(!1);l.useEffect(()=>{if(a==="success"&&s&&(I!=null&&I.id)&&!L){const Z=Ju(s,I.id);g.reset({...g.getValues(),...Z}),A(!0)}},[s,a,g.reset,I==null?void 0:I.id,L]);const{mutate:D,error:F,status:B}=da(),{mutate:N,error:R,status:q}=Fl(),G=g.handleSubmit(Z=>{if(t){const se=Xu(Z,0,"addParties",{addParties:[{partyType:"INDIVIDUAL",roles:["CONTROLLER"]}]}),_=lp(Z,{});r&&(I!=null&&I.id)?N({partyId:I==null?void 0:I.id,data:_},{onSettled:($,J)=>{var H;i==null||i($,(H=J==null?void 0:J.response)==null?void 0:H.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:$=>{var J,H;if((H=(J=$.response)==null?void 0:J.data)!=null&&H.context){const{context:K}=$.response.data,X=gs(K,0,"addParties");vs(g,X)}}}):D({id:t,data:se},{onSettled:($,J)=>{var H;n==null||n($,(H=J==null?void 0:J.response)==null?void 0:H.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:$=>{var J,H;if((H=(J=$.response)==null?void 0:J.data)!=null&&H.context){const{context:K}=$.response.data,X=gs(K,0,"addParties");vs(g,X)}}})}});if(s&&!L)return d.jsx(jr,{message:"Loading..."});if(B==="pending")return d.jsx(jr,{message:"Submitting..."});if(r&&q==="pending")return d.jsx(jr,{message:"Submitting..."});const V=Z=>{switch(Z){case"SSN":return"### - ## - ####";case"ITIN":return"### - ## - ####";default:return}},k=Z=>o(Z?`idValueLabels.individual.${Z}`:"idValueLabels.placeholder");return d.jsx(wi,{...g,children:d.jsxs("form",{onSubmit:G,className:"eb-space-y-6",children:[d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"General"}),d.jsx(We,{control:g.control,name:"firstName",type:"text"}),d.jsx(We,{control:g.control,name:"middleName",type:"text"}),d.jsx(We,{control:g.control,name:"lastName",type:"text",required:!0}),d.jsx(We,{control:g.control,name:"birthDate",type:"date",required:!0}),d.jsx(We,{control:g.control,name:"countryOfResidence",type:"combobox",options:$o.map(Z=>({value:Z,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",Z,"]"]})," ",o([`common:countries.${Z}`])]})})),required:!0}),d.jsx(We,{control:g.control,name:"jobTitle",type:"select",required:!0,options:[{value:"CEO",label:"CEO"},{value:"CFO",label:"CFO"},{value:"COO",label:"COO"},{value:"President",label:"President"},{value:"Chairman",label:"Chairman"},{value:"Senior Branch Manager",label:"Senior Branch Manager"},{value:"Other",label:"Other"}]})]}),d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"Individual Phone Information"}),d.jsx(Ke,{control:g.control,name:"individualPhone.phoneType",disabled:p("individualPhone"),render:({field:Z})=>d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:m("individualPhone"),children:"Phone Type"}),d.jsxs(Ci,{value:Z.value,onValueChange:Z.onChange,children:[d.jsx(Be,{children:d.jsx(ti,{ref:Z.ref,children:d.jsx(Si,{placeholder:"Select phone type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"BUSINESS_PHONE",children:"Business Phone"}),d.jsx(_t,{value:"MOBILE_PHONE",children:"Mobile Phone"}),d.jsx(_t,{value:"ALTERNATE_PHONE",children:"Alternate Phone"})]})]}),d.jsx(Ye,{})]})}),d.jsx(Ke,{control:g.control,name:"individualPhone.phoneNumber",disabled:p("individualPhone"),render:({field:Z})=>d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:m("individualPhone"),children:"Phone Number"}),d.jsx(Be,{children:d.jsx(td,{...Z,countries:["CA","US"],placeholder:"Enter phone number",international:!1,defaultCountry:v.jurisdiction==="CanadaMS"?"CA":"US"})},v.jurisdiction),d.jsx(Ye,{})]})})]}),h("individualAddresses")&&d.jsx(d.Fragment,{children:b.map((Z,se)=>d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsxs("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:["Individual Address ",se+1]}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.addressType`,type:"select",required:!0,options:[{value:"MAILING_ADDRESS",label:o("addressTypes.MAILING_ADDRESS")}]}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.addressLines.0`,label:"Address Line 1",type:"text",required:!0}),d.jsx(We,{control:g.control,label:"Address Line 2",name:`individualAddresses.${se}.addressLines.1`,type:"text"}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.city`,type:"text",required:!0}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.state`,type:"select",options:CC,required:!0}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.postalCode`,type:"text",required:!0}),d.jsx(We,{control:g.control,name:`individualAddresses.${se}.country`,type:"combobox",options:$o.map(_=>({value:_,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",_,"]"]})," ",o([`common:countries.${_}`])]})})),required:!0}),d.jsx("div",{className:"eb-col-span-full",children:d.jsx(Qe,{type:"button",onClick:()=>x(se),variant:"outline",size:"sm",className:"eb-mt-2",disabled:b.length<=(f("individualAddresses").minItems??1),children:"Remove Address"})})]},`individual-address-${se}`))}),d.jsx(Qe,{type:"button",onClick:()=>y({addressType:"RESIDENTIAL_ADDRESS",addressLines:[""],state:"",city:"",postalCode:"",country:""}),disabled:C.length>=(f("addresses").maxItems??50),variant:"outline",size:"sm",children:"Add Address"}),h("individualIds")&&d.jsx(d.Fragment,{children:C.map((Z,se)=>d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsxs("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:["Individual ID ",se+1]}),d.jsx(We,{control:g.control,name:`individualIds.${se}.idType`,type:"select",options:[{value:"SSN",label:"SSN"},{value:"ITIN",label:"ITIN"}],required:!0}),d.jsx(We,{control:g.control,name:`individualIds.${se}.value`,type:V(g.watch(`individualIds.${se}.idType`))?"text-with-mask":"text",...V(g.watch(`individualIds.${se}.idType`))&&{maskFormat:V(g.watch(`individualIds.${se}.idType`)),maskChar:"_"},label:k(g.watch(`individualIds.${se}.idType`)),required:!0}),d.jsx(We,{control:g.control,name:`individualIds.${se}.issuer`,type:"combobox",options:$o.map(_=>({value:_,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",_,"]"]})," ",o([`common:countries.${_}`])]})})),required:!0}),d.jsx(We,{control:g.control,name:`individualIds.${se}.expiryDate`,type:"date",label:"Expiry Date"}),d.jsx(We,{control:g.control,name:`individualIds.${se}.description`,type:"textarea"}),d.jsx("div",{className:"eb-col-span-full",children:d.jsx(Qe,{type:"button",disabled:C.length<=(f("organizationIds").minItems??0),onClick:()=>w(se),variant:"outline",size:"sm",className:"eb-mt-2",children:"Remove Individual ID"})})]},`individual-id-${se}`))}),d.jsx(Qe,{type:"button",onClick:()=>E({idType:"SSN",value:"",issuer:""}),disabled:C.length>=(f("individualIds").maxItems??50),variant:"outline",size:"sm",children:"Add Individual ID"}),d.jsx(Eo,{error:r?R:F}),d.jsx(Pl,{})]})})},Wre=["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP","PUBLICLY_TRADED_COMPANY","NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","SOLE_PROPRIETORSHIP","UNINCORPORATED_ASSOCIATION"],Ure=we.object({organizationName:we.string().min(1,le.t("common:validation.required")),organizationType:we.enum(["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP","PUBLICLY_TRADED_COMPANY","NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","SOLE_PROPRIETORSHIP","UNINCORPORATED_ASSOCIATION"]),countryOfFormation:we.string().min(1,le.t("common:validation.required")).length(2,le.t("onboarding:fields.countryOfFormation.validation.exactlyTwoChars")),jurisdiction:we.enum(["US","CA"]),product:we.enum(["EMBEDDED_PAYMENTS","MERCHANT_SERVICES"]),organizationEmail:we.string().email()}),Kre=()=>{var G;const{nextStep:e}=Rn(),{clientId:t,onPostClientResponse:n,setClientId:r,availableProducts:i,availableJurisdictions:o,availableOrganizationTypes:s,usePartyResource:a,onPostPartyResponse:c}=ri(),{t:u}=uo(["onboarding","common"]),{data:f,status:p}=Li(t??""),{filterDefaultValues:m,filterSchema:h}=Hl(f),v=(i==null?void 0:i.length)===1?i[0]:void 0,g=(o==null?void 0:o.length)===1?o[0]:void 0,b=ed({resolver:wo(h(Ure)),defaultValues:m({jurisdiction:g,product:v})});l.useEffect(()=>{v&&b.setValue("product",v)},[v]),l.useEffect(()=>{g&&b.setValue("jurisdiction",g)},[g]);const y=(G=f==null?void 0:f.parties)==null?void 0:G.find(V=>(V==null?void 0:V.partyType)==="ORGANIZATION"),[x,C]=l.useState(!1);l.useEffect(()=>{var V;if(f&&p==="success"&&(y!=null&&y.id)&&!x){const k=Ju(f,y.id);k.product=((V=f.products)==null?void 0:V[0])??v,k.jurisdiction=k.jurisdiction??g,b.reset({...b.getValues(),...k}),C(!0)}},[f,p,b.reset,y==null?void 0:y.id,x,v,g]);const{mutate:E,error:w,status:I}=iR(),{mutate:L,error:A,status:D}=da(),{mutate:F,error:B,status:N}=Fl(),R=b.handleSubmit(V=>{if(t){const k=Xu(V,0,"addParties",{addParties:[{...y!=null&&y.id?{id:y==null?void 0:y.id,partyType:y==null?void 0:y.partyType,roles:y==null?void 0:y.roles}:{partyType:"ORGANIZATION",roles:["CLIENT"]}}]}),Q=lp(V,{...y!=null&&y.id?{id:y==null?void 0:y.id,partyType:y==null?void 0:y.partyType,roles:y==null?void 0:y.roles}:{partyType:"ORGANIZATION",roles:["CLIENT"]}});a&&(y!=null&&y.id)?F({partyId:y==null?void 0:y.id,data:Q},{onSettled:(Z,se)=>{var _;c==null||c(Z,(_=se==null?void 0:se.response)==null?void 0:_.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:Z=>{var se,_;if((_=(se=Z.response)==null?void 0:se.data)!=null&&_.context){const{context:$}=Z.response.data,J=gs($,0,"addParties");vs(b,J)}}}):L({id:t,data:k},{onSettled:(Z,se)=>{var _;n==null||n(Z,(_=se==null?void 0:se.response)==null?void 0:_.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:Z=>{var se,_;if((_=(se=Z.response)==null?void 0:se.data)!=null&&_.context){const{context:$}=Z.response.data,J=gs($,0,"addParties");vs(b,J)}}})}else{const k=Xu(V,0,"parties",{products:V.product?[V.product]:[],parties:[{partyType:"ORGANIZATION",roles:["CLIENT"]}]});E({data:k},{onSettled:(Q,Z)=>{var se;n==null||n(Q,(se=Z==null?void 0:Z.response)==null?void 0:se.data)},onSuccess:async Q=>{await(r==null?void 0:r(Q.id)),bn.success(`Client created successfully with ID: ${Q.id}`,{}),e()},onError:Q=>{var Z,se;if((se=(Z=Q.response)==null?void 0:Z.data)!=null&&se.context){const{context:_}=Q.response.data,$=gs(_,0,"parties");vs(b,$)}}})}});if(D==="pending"||I==="pending"||a&&N==="pending")return d.jsx(jr,{message:"Submitting..."});function q(V,k,Q){if(!V)return{fields:{},notes:[]};const Z=Object.entries(Wn).filter(([,se])=>se.baseRule.required?se.conditionalRules?!se.conditionalRules.some(_=>(!_.condition.product||k)&&(!_.condition.jurisdiction||Q)&&_.rule.visibility==="hidden"):!0:!1).reduce((se,[_,$])=>{const J=$.path.includes(".")?$.path.split(".")[0]:"generic",H=J==="generic"?"0_generic":J;return se[H]||(se[H]=[]),se[H].push(`fields.${_}.label`),se},{});return Z["0_generic"]&&(Z.generic=Z["0_generic"],delete Z["0_generic"]),{fields:Z,notes:["initialStepNotes.additionalQuestions",...V==="LIMITED_LIABILITY_COMPANY"?["initialStepNotes.llcOwners"]:[],"initialStepNotes.attestation","initialStepNotes.kycProcess"]}}return f&&!x?d.jsx(jr,{message:"Loading..."}):d.jsx(wi,{...b,children:d.jsx("form",{onSubmit:R,children:d.jsxs("div",{className:"eb-grid eb-grid-cols-1 eb-gap-8 md:eb-grid-cols-2",children:[d.jsxs("fieldset",{className:"eb-space-y-6",children:[d.jsx(We,{control:b.control,name:"product",type:"select",options:i.map(V=>({value:V,label:u(`clientProducts.${V}`)})),visibility:v||t?"readonly":"visible"}),d.jsx(We,{control:b.control,name:"jurisdiction",visibility:(o==null?void 0:o.length)===1?"readonly":"visible",type:"select",options:o.map(V=>({value:V,label:`${u(`clientJurisdictions.${V}`)} (${V})`}))}),d.jsx(We,{control:b.control,name:"organizationType",type:"select",options:(s??Wre).map(V=>({value:V,label:u(`organizationTypes.${V}`)}))}),d.jsx(We,{control:b.control,name:"organizationName",type:"text"}),d.jsx(We,{control:b.control,name:"organizationEmail",type:"email"}),d.jsx(We,{control:b.control,name:"countryOfFormation",type:"combobox",options:$o.map(V=>({value:V,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",V,"]"]})," ",u([`common:countries.${V}`])]})}))}),d.jsx(Eo,{error:a?B:A||w}),d.jsx(Pl,{})]}),d.jsxs(ur,{className:"eb-hidden md:eb-block",children:[d.jsxs(Nr,{className:"eb-border-l-2 eb-bg-gray-100",children:[d.jsx(Af,{children:u("initialStepDescription1")}),d.jsx(Af,{children:u("initialStepDescription2")})]}),d.jsx(dr,{children:b.watch("organizationType")?d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"eb-my-4 eb-text-sm",children:d.jsx(Vv,{t:u,i18nKey:b.watch("product")&&b.watch("jurisdiction")?"initialStepOrganizationTypeInformationFull":"initialStepOrganizationTypeInformationBasic",values:{organizationType:b.watch("organizationType"),product:b.watch("product")?u(`clientProducts.${b.watch("product")}`):"",jurisdiction:b.watch("jurisdiction")?u(`clientJurisdictions.${b.watch("jurisdiction")}`):""}})}),Object.entries(q(b.watch("organizationType")).fields).map(([V,k])=>d.jsxs("div",{className:"eb-mb-4",children:[d.jsx("h4",{className:"eb-mb-2 eb-text-sm eb-font-medium",children:u(`stepLabels.${V}`,{defaultValue:V})}),d.jsx("ul",{children:k.map(Q=>d.jsxs("li",{className:"eb-text-sm",children:["- ",u(Q,{defaultValue:Q})]},Q))})]},V)),d.jsxs("div",{className:"eb-mt-6",children:[d.jsx("h4",{className:"eb-mb-2 eb-text-sm eb-font-medium",children:u("initialStepNotes.title")}),d.jsx("ul",{children:q(b.watch("organizationType")).notes.map(V=>d.jsxs("li",{className:"eb-text-sm",children:["- ",u(V,{defaultValue:V})]},V))})]})]}):d.jsx("p",{className:"eb-my-4 eb-text-sm",children:d.jsx(Vv,{t:u,i18nKey:"initialStepNoOrganizationType"})})})]})]})})})};/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:SC,setPrototypeOf:EC,isFrozen:Yre,getPrototypeOf:Zre,getOwnPropertyDescriptor:Qre}=Object;let{freeze:gr,seal:ii,create:IC}=Object,{apply:qg,construct:Vg}=typeof Reflect<"u"&&Reflect;gr||(gr=function(t){return t}),ii||(ii=function(t){return t}),qg||(qg=function(t,n,r){return t.apply(n,r)}),Vg||(Vg=function(t,n){return new t(...n)});const Ep=Rr(Array.prototype.forEach),LC=Rr(Array.prototype.pop),od=Rr(Array.prototype.push),Ip=Rr(String.prototype.toLowerCase),Gg=Rr(String.prototype.toString),AC=Rr(String.prototype.match),sd=Rr(String.prototype.replace),Xre=Rr(String.prototype.indexOf),Jre=Rr(String.prototype.trim),$i=Rr(Object.prototype.hasOwnProperty),vr=Rr(RegExp.prototype.test),ad=eie(TypeError);function Rr(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return qg(e,t,r)}}function eie(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Vg(e,n)}}function Mt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ip;EC&&EC(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const o=n(i);o!==i&&(Yre(t)||(t[r]=o),i=o)}e[i]=!0}return e}function tie(e){for(let t=0;t<e.length;t++)$i(e,t)||(e[t]=null);return e}function ma(e){const t=IC(null);for(const[n,r]of SC(e))$i(e,n)&&(Array.isArray(r)?t[n]=tie(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=ma(r):t[n]=r);return t}function ld(e,t){for(;e!==null;){const r=Qre(e,t);if(r){if(r.get)return Rr(r.get);if(typeof r.value=="function")return Rr(r.value)}e=Zre(e)}function n(){return null}return n}const DC=gr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Wg=gr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ug=gr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),nie=gr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Kg=gr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),rie=gr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),MC=gr(["#text"]),$C=gr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Yg=gr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),TC=gr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Lp=gr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),iie=ii(/\{\{[\w\W]*|[\w\W]*\}\}/gm),oie=ii(/<%[\w\W]*|[\w\W]*%>/gm),sie=ii(/\$\{[\w\W]*}/gm),aie=ii(/^data-[\-\w.\u00B7-\uFFFF]+$/),lie=ii(/^aria-[\-\w]+$/),FC=ii(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cie=ii(/^(?:\w+script|data):/i),uie=ii(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),NC=ii(/^html$/i),die=ii(/^[a-z][.\w]*(-[.\w]+)+$/i);var PC=Object.freeze({__proto__:null,ARIA_ATTR:lie,ATTR_WHITESPACE:uie,CUSTOM_ELEMENT:die,DATA_ATTR:aie,DOCTYPE_NAME:NC,ERB_EXPR:oie,IS_ALLOWED_URI:FC,IS_SCRIPT_OR_DATA:cie,MUSTACHE_EXPR:iie,TMPLIT_EXPR:sie});const cd={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},fie=function(){return typeof window>"u"?null:window},pie=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},OC=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _C(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fie();const t=De=>_C(De);if(t.version="3.2.3",t.removed=[],!e||!e.document||e.document.nodeType!==cd.document)return t.isSupported=!1,t;let{document:n}=e;const r=n,i=r.currentScript,{DocumentFragment:o,HTMLTemplateElement:s,Node:a,Element:c,NodeFilter:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:h}=e,v=c.prototype,g=ld(v,"cloneNode"),b=ld(v,"remove"),y=ld(v,"nextSibling"),x=ld(v,"childNodes"),C=ld(v,"parentNode");if(typeof s=="function"){const De=n.createElement("template");De.content&&De.content.ownerDocument&&(n=De.content.ownerDocument)}let E,w="";const{implementation:I,createNodeIterator:L,createDocumentFragment:A,getElementsByTagName:D}=n,{importNode:F}=r;let B=OC();t.isSupported=typeof SC=="function"&&typeof C=="function"&&I&&I.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:N,ERB_EXPR:R,TMPLIT_EXPR:q,DATA_ATTR:G,ARIA_ATTR:V,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:Q,CUSTOM_ELEMENT:Z}=PC;let{IS_ALLOWED_URI:se}=PC,_=null;const $=Mt({},[...DC,...Wg,...Ug,...Kg,...MC]);let J=null;const H=Mt({},[...$C,...Yg,...TC,...Lp]);let K=Object.seal(IC(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),X=null,oe=null,re=!0,ue=!0,pe=!1,Se=!0,$e=!1,de=!0,nt=!1,Ie=!1,it=!1,ge=!1,M=!1,j=!1,T=!0,ie=!1;const te="user-content-";let ne=!0,ee=!1,fe={},Ne=null;const Je=Mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Pt=null;const cn=Mt({},["audio","video","img","source","image","track"]);let Qt=null;const $n=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),wn="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",rn="http://www.w3.org/1999/xhtml";let on=rn,pn=!1,Bn=null;const rt=Mt({},[wn,Cn,rn],Gg);let Ct=Mt({},["mi","mo","mn","ms","mtext"]),Et=Mt({},["annotation-xml"]);const Sn=Mt({},["title","style","font","a","script"]);let mn=null;const Kr=["application/xhtml+xml","text/html"],Vo="text/html";let hn=null,fi=null;const Dc=n.createElement("form"),Ps=function(Y){return Y instanceof RegExp||Y instanceof Function},Go=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(fi&&fi===Y)){if((!Y||typeof Y!="object")&&(Y={}),Y=ma(Y),mn=Kr.indexOf(Y.PARSER_MEDIA_TYPE)===-1?Vo:Y.PARSER_MEDIA_TYPE,hn=mn==="application/xhtml+xml"?Gg:Ip,_=$i(Y,"ALLOWED_TAGS")?Mt({},Y.ALLOWED_TAGS,hn):$,J=$i(Y,"ALLOWED_ATTR")?Mt({},Y.ALLOWED_ATTR,hn):H,Bn=$i(Y,"ALLOWED_NAMESPACES")?Mt({},Y.ALLOWED_NAMESPACES,Gg):rt,Qt=$i(Y,"ADD_URI_SAFE_ATTR")?Mt(ma($n),Y.ADD_URI_SAFE_ATTR,hn):$n,Pt=$i(Y,"ADD_DATA_URI_TAGS")?Mt(ma(cn),Y.ADD_DATA_URI_TAGS,hn):cn,Ne=$i(Y,"FORBID_CONTENTS")?Mt({},Y.FORBID_CONTENTS,hn):Je,X=$i(Y,"FORBID_TAGS")?Mt({},Y.FORBID_TAGS,hn):{},oe=$i(Y,"FORBID_ATTR")?Mt({},Y.FORBID_ATTR,hn):{},fe=$i(Y,"USE_PROFILES")?Y.USE_PROFILES:!1,re=Y.ALLOW_ARIA_ATTR!==!1,ue=Y.ALLOW_DATA_ATTR!==!1,pe=Y.ALLOW_UNKNOWN_PROTOCOLS||!1,Se=Y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$e=Y.SAFE_FOR_TEMPLATES||!1,de=Y.SAFE_FOR_XML!==!1,nt=Y.WHOLE_DOCUMENT||!1,ge=Y.RETURN_DOM||!1,M=Y.RETURN_DOM_FRAGMENT||!1,j=Y.RETURN_TRUSTED_TYPE||!1,it=Y.FORCE_BODY||!1,T=Y.SANITIZE_DOM!==!1,ie=Y.SANITIZE_NAMED_PROPS||!1,ne=Y.KEEP_CONTENT!==!1,ee=Y.IN_PLACE||!1,se=Y.ALLOWED_URI_REGEXP||FC,on=Y.NAMESPACE||rn,Ct=Y.MATHML_TEXT_INTEGRATION_POINTS||Ct,Et=Y.HTML_INTEGRATION_POINTS||Et,K=Y.CUSTOM_ELEMENT_HANDLING||{},Y.CUSTOM_ELEMENT_HANDLING&&Ps(Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(K.tagNameCheck=Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&Ps(Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(K.attributeNameCheck=Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&typeof Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$e&&(ue=!1),M&&(ge=!0),fe&&(_=Mt({},MC),J=[],fe.html===!0&&(Mt(_,DC),Mt(J,$C)),fe.svg===!0&&(Mt(_,Wg),Mt(J,Yg),Mt(J,Lp)),fe.svgFilters===!0&&(Mt(_,Ug),Mt(J,Yg),Mt(J,Lp)),fe.mathMl===!0&&(Mt(_,Kg),Mt(J,TC),Mt(J,Lp))),Y.ADD_TAGS&&(_===$&&(_=ma(_)),Mt(_,Y.ADD_TAGS,hn)),Y.ADD_ATTR&&(J===H&&(J=ma(J)),Mt(J,Y.ADD_ATTR,hn)),Y.ADD_URI_SAFE_ATTR&&Mt(Qt,Y.ADD_URI_SAFE_ATTR,hn),Y.FORBID_CONTENTS&&(Ne===Je&&(Ne=ma(Ne)),Mt(Ne,Y.FORBID_CONTENTS,hn)),ne&&(_["#text"]=!0),nt&&Mt(_,["html","head","body"]),_.table&&(Mt(_,["tbody"]),delete X.tbody),Y.TRUSTED_TYPES_POLICY){if(typeof Y.TRUSTED_TYPES_POLICY.createHTML!="function")throw ad('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ad('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=Y.TRUSTED_TYPES_POLICY,w=E.createHTML("")}else E===void 0&&(E=pie(h,i)),E!==null&&typeof w=="string"&&(w=E.createHTML(""));gr&&gr(Y),fi=Y}},Ta=Mt({},[...Wg,...Ug,...nie]),Fa=Mt({},[...Kg,...rie]),Na=function(Y){let be=C(Y);(!be||!be.tagName)&&(be={namespaceURI:on,tagName:"template"});const Fe=Ip(Y.tagName),$t=Ip(be.tagName);return Bn[Y.namespaceURI]?Y.namespaceURI===Cn?be.namespaceURI===rn?Fe==="svg":be.namespaceURI===wn?Fe==="svg"&&($t==="annotation-xml"||Ct[$t]):!!Ta[Fe]:Y.namespaceURI===wn?be.namespaceURI===rn?Fe==="math":be.namespaceURI===Cn?Fe==="math"&&Et[$t]:!!Fa[Fe]:Y.namespaceURI===rn?be.namespaceURI===Cn&&!Et[$t]||be.namespaceURI===wn&&!Ct[$t]?!1:!Fa[Fe]&&(Sn[Fe]||!Ta[Fe]):!!(mn==="application/xhtml+xml"&&Bn[Y.namespaceURI]):!1},ar=function(Y){od(t.removed,{element:Y});try{C(Y).removeChild(Y)}catch{b(Y)}},Wo=function(Y,be){try{od(t.removed,{attribute:be.getAttributeNode(Y),from:be})}catch{od(t.removed,{attribute:null,from:be})}if(be.removeAttribute(Y),Y==="is")if(ge||M)try{ar(be)}catch{}else try{be.setAttribute(Y,"")}catch{}},Pa=function(Y){let be=null,Fe=null;if(it)Y="<remove></remove>"+Y;else{const sn=AC(Y,/^[\r\n\t ]+/);Fe=sn&&sn[0]}mn==="application/xhtml+xml"&&on===rn&&(Y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Y+"</body></html>");const $t=E?E.createHTML(Y):Y;if(on===rn)try{be=new m().parseFromString($t,mn)}catch{}if(!be||!be.documentElement){be=I.createDocument(on,"template",null);try{be.documentElement.innerHTML=pn?w:$t}catch{}}const gn=be.body||be.documentElement;return Y&&Fe&&gn.insertBefore(n.createTextNode(Fe),gn.childNodes[0]||null),on===rn?D.call(be,nt?"html":"body")[0]:nt?be.documentElement:gn},Oa=function(Y){return L.call(Y.ownerDocument||Y,Y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},_a=function(Y){return Y instanceof p&&(typeof Y.nodeName!="string"||typeof Y.textContent!="string"||typeof Y.removeChild!="function"||!(Y.attributes instanceof f)||typeof Y.removeAttribute!="function"||typeof Y.setAttribute!="function"||typeof Y.namespaceURI!="string"||typeof Y.insertBefore!="function"||typeof Y.hasChildNodes!="function")},U=function(Y){return typeof a=="function"&&Y instanceof a};function Ce(De,Y,be){Ep(De,Fe=>{Fe.call(t,Y,be,fi)})}const Re=function(Y){let be=null;if(Ce(B.beforeSanitizeElements,Y,null),_a(Y))return ar(Y),!0;const Fe=hn(Y.nodeName);if(Ce(B.uponSanitizeElement,Y,{tagName:Fe,allowedTags:_}),Y.hasChildNodes()&&!U(Y.firstElementChild)&&vr(/<[/\w]/g,Y.innerHTML)&&vr(/<[/\w]/g,Y.textContent)||Y.nodeType===cd.progressingInstruction||de&&Y.nodeType===cd.comment&&vr(/<[/\w]/g,Y.data))return ar(Y),!0;if(!_[Fe]||X[Fe]){if(!X[Fe]&&kt(Fe)&&(K.tagNameCheck instanceof RegExp&&vr(K.tagNameCheck,Fe)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Fe)))return!1;if(ne&&!Ne[Fe]){const $t=C(Y)||Y.parentNode,gn=x(Y)||Y.childNodes;if(gn&&$t){const sn=gn.length;for(let Gt=sn-1;Gt>=0;--Gt){const $r=g(gn[Gt],!0);$r.__removalCount=(Y.__removalCount||0)+1,$t.insertBefore($r,y(Y))}}}return ar(Y),!0}return Y instanceof c&&!Na(Y)||(Fe==="noscript"||Fe==="noembed"||Fe==="noframes")&&vr(/<\/no(script|embed|frames)/i,Y.innerHTML)?(ar(Y),!0):($e&&Y.nodeType===cd.text&&(be=Y.textContent,Ep([N,R,q],$t=>{be=sd(be,$t," ")}),Y.textContent!==be&&(od(t.removed,{element:Y.cloneNode()}),Y.textContent=be)),Ce(B.afterSanitizeElements,Y,null),!1)},dt=function(Y,be,Fe){if(T&&(be==="id"||be==="name")&&(Fe in n||Fe in Dc))return!1;if(!(ue&&!oe[be]&&vr(G,be))){if(!(re&&vr(V,be))){if(!J[be]||oe[be]){if(!(kt(Y)&&(K.tagNameCheck instanceof RegExp&&vr(K.tagNameCheck,Y)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Y))&&(K.attributeNameCheck instanceof RegExp&&vr(K.attributeNameCheck,be)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(be))||be==="is"&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&vr(K.tagNameCheck,Fe)||K.tagNameCheck instanceof Function&&K.tagNameCheck(Fe))))return!1}else if(!Qt[be]){if(!vr(se,sd(Fe,Q,""))){if(!((be==="src"||be==="xlink:href"||be==="href")&&Y!=="script"&&Xre(Fe,"data:")===0&&Pt[Y])){if(!(pe&&!vr(k,sd(Fe,Q,"")))){if(Fe)return!1}}}}}}return!0},kt=function(Y){return Y!=="annotation-xml"&&AC(Y,Z)},Vt=function(Y){Ce(B.beforeSanitizeAttributes,Y,null);const{attributes:be}=Y;if(!be||_a(Y))return;const Fe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let $t=be.length;for(;$t--;){const gn=be[$t],{name:sn,namespaceURI:Gt,value:$r}=gn,za=hn(sn);let Xn=sn==="value"?$r:Jre($r);if(Fe.attrName=za,Fe.attrValue=Xn,Fe.keepAttr=!0,Fe.forceKeepAttr=void 0,Ce(B.uponSanitizeAttribute,Y,Fe),Xn=Fe.attrValue,ie&&(za==="id"||za==="name")&&(Wo(sn,Y),Xn=te+Xn),de&&vr(/((--!?|])>)|<\/(style|title)/i,Xn)){Wo(sn,Y);continue}if(Fe.forceKeepAttr||(Wo(sn,Y),!Fe.keepAttr))continue;if(!Se&&vr(/\/>/i,Xn)){Wo(sn,Y);continue}$e&&Ep([N,R,q],pL=>{Xn=sd(Xn,pL," ")});const fL=hn(Y.nodeName);if(dt(fL,za,Xn)){if(E&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Gt)switch(h.getAttributeType(fL,za)){case"TrustedHTML":{Xn=E.createHTML(Xn);break}case"TrustedScriptURL":{Xn=E.createScriptURL(Xn);break}}try{Gt?Y.setAttributeNS(Gt,sn,Xn):Y.setAttribute(sn,Xn),_a(Y)?ar(Y):LC(t.removed)}catch{}}}Ce(B.afterSanitizeAttributes,Y,null)},Ft=function De(Y){let be=null;const Fe=Oa(Y);for(Ce(B.beforeSanitizeShadowDOM,Y,null);be=Fe.nextNode();)Ce(B.uponSanitizeShadowNode,be,null),Re(be),Vt(be),be.content instanceof o&&De(be.content);Ce(B.afterSanitizeShadowDOM,Y,null)};return t.sanitize=function(De){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},be=null,Fe=null,$t=null,gn=null;if(pn=!De,pn&&(De="<!-->"),typeof De!="string"&&!U(De))if(typeof De.toString=="function"){if(De=De.toString(),typeof De!="string")throw ad("dirty is not a string, aborting")}else throw ad("toString is not a function");if(!t.isSupported)return De;if(Ie||Go(Y),t.removed=[],typeof De=="string"&&(ee=!1),ee){if(De.nodeName){const $r=hn(De.nodeName);if(!_[$r]||X[$r])throw ad("root node is forbidden and cannot be sanitized in-place")}}else if(De instanceof a)be=Pa("<!---->"),Fe=be.ownerDocument.importNode(De,!0),Fe.nodeType===cd.element&&Fe.nodeName==="BODY"||Fe.nodeName==="HTML"?be=Fe:be.appendChild(Fe);else{if(!ge&&!$e&&!nt&&De.indexOf("<")===-1)return E&&j?E.createHTML(De):De;if(be=Pa(De),!be)return ge?null:j?w:""}be&&it&&ar(be.firstChild);const sn=Oa(ee?De:be);for(;$t=sn.nextNode();)Re($t),Vt($t),$t.content instanceof o&&Ft($t.content);if(ee)return De;if(ge){if(M)for(gn=A.call(be.ownerDocument);be.firstChild;)gn.appendChild(be.firstChild);else gn=be;return(J.shadowroot||J.shadowrootmode)&&(gn=F.call(r,gn,!0)),gn}let Gt=nt?be.outerHTML:be.innerHTML;return nt&&_["!doctype"]&&be.ownerDocument&&be.ownerDocument.doctype&&be.ownerDocument.doctype.name&&vr(NC,be.ownerDocument.doctype.name)&&(Gt="<!DOCTYPE "+be.ownerDocument.doctype.name+`>
|
|
300
300
|
`+Gt),$e&&Ep([N,R,q],$r=>{Gt=sd(Gt,$r," ")}),E&&j?E.createHTML(Gt):Gt},t.setConfig=function(){let De=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Go(De),Ie=!0},t.clearConfig=function(){fi=null,Ie=!1},t.isValidAttribute=function(De,Y,be){fi||Go({});const Fe=hn(De),$t=hn(Y);return dt(Fe,$t,be)},t.addHook=function(De,Y){typeof Y=="function"&&od(B[De],Y)},t.removeHook=function(De){return LC(B[De])},t.removeHooks=function(De){B[De]=[]},t.removeAllHooks=function(){B=OC()},t}var mie=_C();const hie=new Date().getFullYear(),zC=/^[a-zA-Z0-9()_/&+%@#;,.: -?]*$/,gie=/[()_/&+%@#;,.: -?]/,vie=/^[a-zA-Z0-9\s,.&-]+$/,bie=we.object({description:we.string().max(100,le.t("onboarding:fields.organizationIds.description.validation.maxLength")).optional(),idType:we.enum(["EIN","BUSINESS_REGISTRATION_ID","BUSINESS_NUMBER","BUSINESS_REGISTRATION_NUMBER"]),value:we.string().min(1,le.t("onboarding:fields.organizationIds.value.validation.required")).max(100,le.t("onboarding:fields.organizationIds.value.validation.maxLength")).regex(/^[A-Za-z0-9-]+$/,le.t("onboarding:fields.organizationIds.value.validation.format")),issuer:we.string().min(1,le.t("onboarding:fields.organizationIds.issuer.validation.required")).max(500,le.t("onboarding:fields.organizationIds.issuer.validation.maxLength")),expiryDate:we.string().refine(e=>/^\d{4}-\d{2}-\d{2}$/.test(e),{message:le.t("onboarding:fields.organizationIds.expiryDate.validation.format")}).refine(e=>!Number.isNaN(new Date(e).getTime()),{message:le.t("onboarding:fields.organizationIds.expiryDate.validation.invalid")}).refine(e=>new Date(e)>new Date,{message:le.t("onboarding:fields.organizationIds.expiryDate.validation.future")}).refine(e=>{const t=new Date(e),n=new Date,r=new Date(n.setFullYear(n.getFullYear()+10));return t<r},{message:le.t("onboarding:fields.organizationIds.expiryDate.validation.maxYears")}).optional()}).refine(e=>{switch(e.idType){case"EIN":return/^\d{9}$/.test(e.value);case"BUSINESS_REGISTRATION_ID":return/^[A-Za-z0-9]{5,15}$/.test(e.value);case"BUSINESS_NUMBER":return/^\d{9,12}$/.test(e.value);case"BUSINESS_REGISTRATION_NUMBER":return/^[A-Za-z0-9-]{6,15}$/.test(e.value);default:return!0}},e=>({message:le.t(`onboarding:fields.organizationIds.value.validation.${e.idType.toLowerCase()}Format`),path:["value"]})),yie=we.object({country:we.string().length(2,le.t("onboarding:fields.countryOfFormation.validation.exactlyTwoChars"))}),xie=we.object({mcc:we.string().regex(/^\d{4}$/,le.t("onboarding:fields.secondaryMccList.mcc.validation.format"))}),wie=e=>{let t=mie.sanitize(e,{ALLOWED_TAGS:[],ALLOWED_ATTR:[],KEEP_CONTENT:!0});return t=t.replace(/https?:\/\/[^\s]+/g,"").replace(/\s+/g," ").replace(/[<>]/g,"").trim(),t},Cie=we.object({organizationName:we.string().min(2,le.t("onboarding:fields.organizationName.validation.minLength")).max(100,le.t("onboarding:fields.organizationName.validation.maxLength")).regex(zC,le.t("onboarding:fields.organizationName.validation.pattern")).refine(e=>!/\s\s/.test(e),le.t("onboarding:fields.organizationName.validation.noConsecutiveSpaces")).refine(e=>!gie.test(e.charAt(0)),le.t("onboarding:fields.organizationName.validation.noSpecialAtStart")).transform(e=>e.trim()),dbaName:we.string().max(100,le.t("onboarding:fields.dbaName.validation.maxLength")).regex(zC,le.t("onboarding:fields.dbaName.validation.pattern")).refine(e=>!e||!/\s\s/.test(e),le.t("onboarding:fields.dbaName.validation.noConsecutiveSpaces")).refine(e=>!e||e.length>=2,le.t("onboarding:fields.dbaName.validation.minLength")).transform(e=>e.trim()).optional(),countryOfFormation:we.string().length(2,le.t("onboarding:fields.countryOfFormation.validation.exactlyTwoChars")).refine(e=>$o.includes(e),le.t("onboarding:fields.countryOfFormation.validation.invalidCountry")),organizationEmail:we.string().email(le.t("onboarding:fields.organizationEmail.validation.invalid")).max(100,le.t("onboarding:fields.organizationEmail.validation.maxLength")).transform(e=>e.trim()),yearOfFormation:we.string().regex(/^(19|20)\d{2}$/,le.t("onboarding:fields.yearOfFormation.validation.format")).refine(e=>parseInt(e,10)>=1800,le.t("onboarding:fields.yearOfFormation.validation.min")).refine(e=>parseInt(e,10)<=hie,le.t("onboarding:fields.yearOfFormation.validation.max")),addresses:we.array(Tw).min(1,le.t("onboarding:fields.addresses.validation.minAddresses")).max(5,le.t("onboarding:fields.addresses.validation.maxAddresses")),associatedCountries:we.array(yie).max(100,le.t("onboarding:fields.associatedCountries.validation.maxCountries")),entitiesInOwnership:we.enum(["yes","no"]),industryCategory:we.string().min(3,le.t("onboarding:fields.industryCategory.validation.minLength")).max(100,le.t("onboarding:fields.industryCategory.validation.maxLength")).regex(vie,le.t("onboarding:fields.industryCategory.validation.format")),industryType:we.string().min(3,le.t("onboarding:fields.industryType.validation.minLength")).max(100,le.t("onboarding:fields.industryType.validation.maxLength")),organizationDescription:we.string().min(10).max(500).transform(wie),organizationIds:we.array(bie).max(6,le.t("onboarding:fields.organizationIds.validation.maxIds")).refine(e=>{const t=e.map(n=>n.idType);return new Set(t).size===t.length},le.t("onboarding:fields.organizationIds.validation.uniqueTypes")),organizationPhone:$w,website:we.string().url(le.t("onboarding:fields.website.validation.invalid")).max(500,le.t("onboarding:fields.website.validation.maxLength")).refine(e=>!e||e.startsWith("https://"),le.t("onboarding:fields.website.validation.httpsRequired")).refine(e=>!e||!/^https?:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.test(e),le.t("onboarding:fields.website.validation.noIp")).or(we.literal("")),websiteAvailable:we.boolean(),mcc:we.string().refine(e=>e===""||/^\d{4}$/.test(e),le.t("onboarding:fields.mcc.validation.format")).refine(e=>{if(!e)return!0;const t=parseInt(e,10);return t>=1&&t<=9999},le.t("onboarding:fields.mcc.validation.range")),secondaryMccList:we.array(xie).max(50,le.t("onboarding:fields.secondaryMccList.validation.maxMcc"))}),Sie=e=>e.superRefine((t,n)=>{t.websiteAvailable&&!t.website&&n.addIssue({code:we.ZodIssueCode.custom,message:le.t("onboarding:fields.website.validation.required"),path:["website"]})}),Eie=()=>{var H;const{nextStep:e}=Rn(),{clientId:t,onPostClientResponse:n,onPostPartyResponse:r,usePartyResource:i}=ri(),{t:o}=uo("onboarding"),{data:s,status:a}=Li(t??""),{filterDefaultValues:c,filterSchema:u,getFieldRule:f,isFieldDisabled:p,isFieldRequired:m,isFieldVisible:h,clientContext:v}=Hl(s),g=ed({resolver:wo(u(Cie,Sie)),defaultValues:c({addresses:[{addressType:"BUSINESS_ADDRESS",city:"",state:"",postalCode:"",country:"",addressLines:[""]}],organizationIds:[{value:"",idType:"BUSINESS_REGISTRATION_ID",issuer:""}],organizationPhone:{phoneType:"BUSINESS_PHONE",phoneNumber:""}})}),{fields:b,append:y,remove:x}=Yi({control:g.control,name:"addresses"}),{fields:C,append:E,remove:w}=Yi({control:g.control,name:"organizationIds"}),{fields:I,append:L,remove:A}=Yi({control:g.control,name:"associatedCountries"}),{fields:D,append:F,remove:B}=Yi({control:g.control,name:"secondaryMccList"}),N=(H=s==null?void 0:s.parties)==null?void 0:H.find(K=>(K==null?void 0:K.partyType)==="ORGANIZATION"),[R,q]=l.useState(!1);l.useEffect(()=>{if(a==="success"&&s&&(N!=null&&N.id)&&!R){const K=Ju(s,N.id);g.reset({...g.getValues(),...K}),q(!0)}},[s,a,g.reset,N==null?void 0:N.id,R]);const{mutate:G,error:V,status:k}=da(),{mutate:Q,error:Z,status:se}=Fl(),_=g.handleSubmit(K=>{if(t){const X={...K,website:K.websiteAvailable?K.website:""},oe=Xu(X,0,"addParties",{addParties:[{...N!=null&&N.id?{id:N==null?void 0:N.id,partyType:N==null?void 0:N.partyType,roles:N==null?void 0:N.roles}:{partyType:"ORGANIZATION",roles:["CLIENT"]}}]}),re=lp(X,{...N!=null&&N.id?{id:N==null?void 0:N.id,partyType:N==null?void 0:N.partyType,roles:N==null?void 0:N.roles}:{partyType:"ORGANIZATION",roles:["CLIENT"]}});i&&(N!=null&&N.id)?Q({partyId:N==null?void 0:N.id,data:re},{onSettled:(ue,pe)=>{var Se;r==null||r(ue,(Se=pe==null?void 0:pe.response)==null?void 0:Se.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:ue=>{var pe,Se;if((Se=(pe=ue.response)==null?void 0:pe.data)!=null&&Se.context){const{context:$e}=ue.response.data,de=gs($e,0,"addParties");vs(g,de)}}}):G({id:t,data:oe},{onSettled:(ue,pe)=>{var Se;n==null||n(ue,(Se=pe==null?void 0:pe.response)==null?void 0:Se.data)},onSuccess:()=>{e(),bn.success("Client's organization details updated successfully")},onError:ue=>{var pe,Se;if((Se=(pe=ue.response)==null?void 0:pe.data)!=null&&Se.context){const{context:$e}=ue.response.data,de=gs($e,0,"addParties");vs(g,de)}}})}});if(s&&!R)return d.jsx(jr,{message:"Loading..."});if(k==="pending")return d.jsx(jr,{message:"Submitting..."});if(i&&se==="pending")return d.jsx(jr,{message:"Submitting..."});const $=K=>{switch(K){case"EIN":return"## - #######";default:return}},J=K=>o(K?`idValueLabels.organization.${K}`:"idValueLabels.placeholder");return d.jsx(wi,{...g,children:d.jsxs("form",{onSubmit:_,className:"eb-grid eb-w-full eb-items-start eb-gap-6 eb-overflow-auto eb-p-1",children:[d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"General"}),d.jsx(We,{control:g.control,name:"organizationName",type:"text"}),d.jsx(We,{control:g.control,name:"dbaName",type:"text"}),d.jsx(We,{control:g.control,name:"organizationDescription",type:"textarea"}),d.jsx(We,{control:g.control,name:"organizationEmail",type:"email"}),d.jsx(We,{control:g.control,name:"countryOfFormation",type:"combobox",options:$o.map(K=>({value:K,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",K,"]"]})," ",o([`common:countries.${K}`])]})}))}),d.jsx(We,{control:g.control,name:"yearOfFormation",type:"text",inputProps:{maxLength:4}})]}),d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"Organization Phone Information"}),h("organizationPhone")&&d.jsx(Ke,{control:g.control,name:"organizationPhone.phoneType",disabled:p("organizationPhone"),render:({field:K})=>d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:m("organizationPhone"),children:"Phone Type"}),d.jsxs(Ci,{value:K.value,onValueChange:K.onChange,children:[d.jsx(Be,{children:d.jsx(ti,{ref:K.ref,children:d.jsx(Si,{placeholder:"Select phone type"})})}),d.jsxs(ni,{children:[d.jsx(_t,{value:"BUSINESS_PHONE",children:"Business Phone"}),d.jsx(_t,{value:"MOBILE_PHONE",children:"Mobile Phone"}),d.jsx(_t,{value:"ALTERNATE_PHONE",children:"Alternate Phone"})]})]}),d.jsx(Ye,{})]})}),h("organizationPhone")&&d.jsx(Ke,{control:g.control,name:"organizationPhone.phoneNumber",disabled:p("organizationPhone"),render:({field:K})=>d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:m("organizationPhone"),children:"Phone Number"}),d.jsx(Be,{children:d.jsx(td,{...K,countries:["CA","US"],placeholder:"Enter phone number",international:!1,defaultCountry:v.jurisdiction==="CanadaMS"?"CA":"US"})},v.jurisdiction),d.jsx(Ye,{})]})})]}),d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"Industry Info"}),d.jsx(We,{form:g,control:g.control,name:"industryType",type:"industrySelect"}),d.jsx(We,{control:g.control,name:"mcc",type:"text",inputProps:{pattern:"[0-9]{4}",maxLength:4,inputMode:"numeric"}}),d.jsx(We,{control:g.control,name:"entitiesInOwnership",type:"radio-group",options:[{value:"yes",label:"Yes"},{value:"no",label:"No"}]})]}),h("addresses")&&d.jsx(d.Fragment,{children:b.map((K,X)=>d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsxs("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:["Organization Address ",X+1]}),d.jsx(We,{control:g.control,name:`addresses.${X}.addressType`,type:"select",required:!0,options:[{value:"LEGAL_ADDRESS",label:o("addressTypes.LEGAL_ADDRESS")},{value:"MAILING_ADDRESS",label:o("addressTypes.MAILING_ADDRESS")},{value:"BUSINESS_ADDRESS",label:o("addressTypes.BUSINESS_ADDRESS")},{value:"RESIDENTIAL_ADDRESS",label:o("addressTypes.RESIDENTIAL_ADDRESS")}]}),d.jsx(We,{control:g.control,name:`addresses.${X}.addressLines.0`,label:"Address Line 1",type:"text",required:!0}),d.jsx(We,{control:g.control,label:"Address Line 2",name:`addresses.${X}.addressLines.1`,type:"text"}),d.jsx(We,{control:g.control,name:`addresses.${X}.city`,type:"text",required:!0}),d.jsx(We,{control:g.control,name:`addresses.${X}.state`,type:"select",options:CC,required:!0}),d.jsx(We,{control:g.control,name:`addresses.${X}.postalCode`,type:"text",inputProps:{pattern:"[0-9]{5}",maxLength:5,inputMode:"numeric"},required:!0}),d.jsx(We,{control:g.control,name:`addresses.${X}.country`,type:"combobox",options:$o.map(oe=>({value:oe,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",oe,"]"]})," ",o([`common:countries.${oe}`])]})}))}),d.jsx("div",{className:"eb-col-span-full",children:d.jsx(Qe,{type:"button",onClick:()=>x(X),variant:"outline",size:"sm",className:"eb-mt-2",disabled:b.length<=(f("addresses").minItems??1),children:"Remove Address"})})]},`address-${X}`))}),d.jsx(Qe,{type:"button",disabled:b.length>=(f("addresses").maxItems??5),onClick:()=>y({addressType:"BUSINESS_ADDRESS",city:"",state:"",postalCode:"",country:"",addressLines:[""]},{shouldFocus:!1}),variant:"outline",size:"sm",className:"eb-mt-2",children:"Add Address"}),h("organizationIds")&&d.jsx(d.Fragment,{children:C.map((K,X)=>d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsxs("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:["Organization ID ",X+1]}),d.jsx(We,{control:g.control,name:`organizationIds.${X}.idType`,type:"select",options:[{value:"EIN",label:"EIN"},{value:"BUSINESS_REGISTRATION_ID",label:"Business Registration ID"},{value:"BUSINESS_NUMBER",label:"Business Number"},{value:"BUSINESS_REGISTRATION_NUMBER",label:"Business Registration Number"}],required:!0}),d.jsx(We,{control:g.control,name:`organizationIds.${X}.value`,type:$(g.watch(`organizationIds.${X}.idType`))?"text-with-mask":"text",...$(g.watch(`organizationIds.${X}.idType`))&&{maskFormat:$(g.watch(`organizationIds.${X}.idType`)),maskChar:"_"},label:J(g.watch(`organizationIds.${X}.idType`)),required:!0}),d.jsx(We,{control:g.control,name:`organizationIds.${X}.issuer`,type:"combobox",options:$o.map(oe=>({value:oe,label:d.jsxs("span",{children:[d.jsxs("span",{className:"eb-font-medium",children:["[",oe,"]"]})," ",o([`common:countries.${oe}`])]})})),required:!0}),d.jsx(We,{control:g.control,name:`organizationIds.${X}.expiryDate`,type:"date"}),d.jsx(We,{control:g.control,name:`organizationIds.${X}.description`,type:"text"}),d.jsx("div",{className:"eb-col-span-full",children:d.jsx(Qe,{type:"button",disabled:C.length<(f("organizationIds").minItems??0),onClick:()=>w(X),variant:"outline",size:"sm",className:"eb-mt-2",children:"Remove Organization ID"})})]},`organization-id-${X}`))}),d.jsx(Qe,{type:"button",disabled:C.length>=(f("organizationIds").maxItems??6),onClick:()=>E({idType:"EIN",value:"",issuer:""}),variant:"outline",size:"sm",children:"Add Organization ID"}),d.jsxs("fieldset",{className:"eb-grid eb-grid-cols-1 eb-gap-6 eb-rounded-lg eb-border eb-p-4 md:eb-grid-cols-2 lg:eb-grid-cols-3",children:[d.jsx("legend",{className:"eb-m-1 eb-px-1 eb-text-sm eb-font-medium",children:"Additional Fields"}),h("associatedCountries")&&d.jsxs("div",{className:"eb-space-y-4",children:[d.jsx("h3",{className:"eb-text-lg eb-font-medium",children:"Associated Countries"}),I.map((K,X)=>d.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[d.jsx(Ke,{control:g.control,name:`associatedCountries.${X}.country`,render:({field:oe})=>d.jsxs(Ve,{className:"eb-grow",children:[d.jsx(Be,{children:d.jsx(bt,{...oe,maxLength:2,placeholder:"Country code (e.g., US)"})}),d.jsx(Ye,{})]})}),d.jsx(Qe,{type:"button",disabled:I.length<=(f("associatedCountries").minItems??0),onClick:()=>A(X),variant:"outline",size:"sm",children:"Remove"})]},`associated-country-${X}`)),d.jsx(Qe,{type:"button",disabled:I.length>=(f("associatedCountries").maxItems??100),onClick:()=>L({country:""}),variant:"outline",size:"sm",children:"Add Associated Country"})]}),h("secondaryMccList")&&d.jsxs("div",{className:"eb-space-y-4",children:[d.jsx("h3",{className:"eb-text-lg eb-font-medium",children:"Secondary MCC"}),D.map((K,X)=>d.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[d.jsx(Ke,{control:g.control,name:`secondaryMccList.${X}.mcc`,render:({field:oe})=>d.jsxs(Ve,{className:"eb-grow",children:[d.jsx(Be,{children:d.jsx(bt,{...oe,maxLength:4,placeholder:"Secondary MCC"})}),d.jsx(Ye,{})]})}),d.jsx(Qe,{type:"button",disabled:D.length<=(f("secondaryMccList").minItems??0),onClick:()=>B(X),variant:"outline",size:"sm",children:"Remove"})]},`secondary-mcc-${X}`)),d.jsx(Qe,{type:"button",disabled:D.length>=(f("secondaryMccList").maxItems??50),onClick:()=>F({mcc:""}),variant:"outline",size:"sm",children:"Add Secondary MCC"})]}),d.jsx(We,{control:g.control,name:"websiteAvailable",type:"checkbox"}),h("website")&&d.jsx(Ke,{control:g.control,name:"website",disabled:p("website")||!g.getValues("websiteAvailable"),render:({field:K})=>d.jsxs(Ve,{children:[d.jsx(Ge,{asterisk:m("website"),children:"Website"}),d.jsx(Be,{children:d.jsx(bt,{...K,value:g.getValues("websiteAvailable")?K.value:"N/A",type:"url"})}),d.jsx(Ye,{})]})})]}),d.jsx(Eo,{error:i?Z:V}),d.jsx(Pl,{})]})})};var Iie={};const Lie=()=>Ws({queryKey:["useIPAddress"],queryFn:async()=>{if(Iie.NODE_ENV!=="test"){const{publicIpv4:e}=await Promise.resolve().then(()=>$se);return e({fallbackUrls:["https://ifconfig.co/ip","https://api64.ipify.org/","https://ipapi.co/ip"]})}return new Promise(e=>{e("1.1.1.1")})},retry:5}),Aie=({partyId:e})=>{var r,i,o;const{data:t}=DR(e),n=(o=(i=(r=t==null?void 0:t.validationResponse)==null?void 0:r.filter(s=>s.validationStatus==="NEEDS_INFO"))==null?void 0:i[0])==null?void 0:o.fields;return n?d.jsxs("div",{className:"eb-mt-2",children:[d.jsxs("h4",{className:"eb-font-semibold",children:["Missing fields for Party ID: ",e]}),d.jsx("ul",{className:"eb-list-inside eb-list-disc",children:n.map((s,a)=>d.jsxs("li",{children:[s.name,": ",s.type]},a))})]},e):null},Die=({clientData:e,isAttestationInfoIncluded:t})=>{var i,o,s,a,c,u,f;const n=e==null?void 0:e.outstanding,{data:r}=I2({questionIds:(o=(i=e==null?void 0:e.outstanding)==null?void 0:i.questionIds)==null?void 0:o.join(",")});return d.jsxs(hu,{variant:"destructive",className:"eb-max-w-2xl eb-outline-none",children:[d.jsx(gm,{className:"eb-outline-orange eb-h-4 eb-w-4"}),d.jsx(gu,{children:"Outstanding KYC Requirements"}),d.jsxs(sl,{children:[d.jsx("p",{children:"Please complete the following before initiating KYC:"}),!!((s=n==null?void 0:n.attestationDocumentIds)!=null&&s.length)&&!!t&&d.jsxs("div",{className:"eb-mt-2",children:[d.jsx("h4",{className:"eb-font-semibold",children:"Missing Attestations"}),d.jsx("ul",{className:"eb-list-inside eb-list-disc",children:n.attestationDocumentIds.map(p=>d.jsxs("li",{children:["Attestation Document ID: ",p]},p))})]}),!!((a=n==null?void 0:n.documentRequestIds)!=null&&a.length)&&d.jsxs("div",{className:"eb-mt-2",children:[d.jsx("h4",{className:"eb-font-semibold",children:"Missing Documents"}),d.jsx("ul",{className:"eb-list-inside eb-list-disc",children:n.documentRequestIds.map(p=>d.jsxs("li",{children:["Document Request ID: ",p]},p))})]}),!!((c=n==null?void 0:n.questionIds)!=null&&c.length)&&d.jsxs("div",{className:"eb-mt-2",children:[d.jsx("h4",{className:"eb-font-semibold",children:"Unanswered Questions"}),d.jsx("ul",{className:"eb-list-inside eb-list-disc",children:n.questionIds.map(p=>{var m,h;return d.jsxs("li",{children:["Question (",p,"):"," ",(h=(m=r==null?void 0:r.questions)==null?void 0:m.find(v=>v.id===p))==null?void 0:h.description]},p)})})]}),!!((u=n==null?void 0:n.partyIds)!=null&&u.length)&&d.jsx("div",{className:"eb-mt-2",children:n.partyIds.map(p=>d.jsx(Aie,{partyId:p}))}),!!((f=n==null?void 0:n.partyRoles)!=null&&f.length)&&d.jsxs("div",{className:"eb-mt-2",children:[d.jsx("h4",{className:"eb-font-semibold",children:"Missing Parties"}),d.jsx("ul",{className:"eb-list-inside eb-list-disc",children:n.partyRoles.map(p=>d.jsxs("li",{children:["Missing party with role: ",p]},p))})]})]})]})},Mie=[{label:"Legal Business Name",path:"organizationDetails.organizationName"},{label:"Organization Type",path:"organizationDetails.organizationType"},{label:"Industry Category",path:"organizationDetails.industryCategory"},{label:"Industry Type",path:"organizationDetails.industryType"},{label:"Country of Formation",path:"organizationDetails.countryOfFormation"},{label:"Year of Formation",path:"organizationDetails.yearOfFormation"},{label:"Email",path:"email"},{label:"Addresses",path:"organizationDetails.addresses",transformFunc:e=>e==null?void 0:e.map(t=>{var n;return`${t==null?void 0:t.addressType}: ${(n=t==null?void 0:t.addressLines)==null?void 0:n.join(" ")}, ${t==null?void 0:t.city}, ${t==null?void 0:t.state}, ${t==null?void 0:t.country}, ${t==null?void 0:t.postalCode}`})}],$ie=[{label:"Email",path:"email"},{label:"Roles",path:"roles"},{label:"First Name",path:"individualDetails.firstName"},{label:"Last Name",path:"individualDetails.lastName"},{label:"Country of Residence",path:"individualDetails.countryOfResidence"},{label:"Nature of Ownership",path:"individualDetails.natureOfOwnership"},{label:"Job Title",path:"individualDetails.jobTitle"},{label:"Job Title Description",path:"individualDetails.jobTitleDescription"},{label:"Sole Owner",path:"individualDetails.soleOwner"},{label:"Addresses",path:"individualDetails.addresses",transformFunc:e=>e==null?void 0:e.map(t=>{var n;return`${t==null?void 0:t.addressType}: ${(n=t==null?void 0:t.addressLines)==null?void 0:n.join(" ")}, ${t==null?void 0:t.city}, ${t==null?void 0:t.state}, ${t==null?void 0:t.country}, ${t==null?void 0:t.postalCode}`})}],Tie=()=>Uw().replace(/[^a-zA-Z0-9_-]/g,""),Ap=e=>!e||typeof e!="object"?!1:Object.keys(e).every(t=>t==="attestationDocumentIds"?!0:Array.isArray(e[t])&&e[t].length===0),Fie=()=>{var N,R,q,G,V;const e=Qa(),{prevStep:t,isDisabledStep:n}=Rn(),{clientId:r,onPostClientResponse:i,blockPostVerification:o}=ri(),[s,a]=l.useState({dataAccuracy:!1,termsAndConditions:!1}),[c,u]=l.useState({}),[f,p]=l.useState({}),{data:m}=Li(r??""),{data:h}=Lie(),{mutateAsync:v,error:g}=da(),{mutateAsync:b,error:y}=fR(),x=((N=m==null?void 0:m.outstanding)==null?void 0:N.attestationDocumentIds)||[],C=qb({queries:x.map(k=>({queryKey:["documentDetail",k],queryFn:()=>SR(k)}))}),{data:E}=I2({questionIds:(R=m==null?void 0:m.questionResponses)==null?void 0:R.map(k=>k.questionId).join(",")}),w=Object.values(s).every(Boolean),I=Object.values(c).every(Boolean),L=w&&I,A=k=>Q=>{a(Z=>({...Z,[k]:Q}))},D=k=>async()=>{var Q;try{p($=>({...$,[k]:!0}));const Z=await ER(k,{responseType:"blob"}),se=new Blob([Z],{type:"application/pdf"}),_=URL.createObjectURL(se);(Q=window.open(_,"_blank"))==null||Q.focus(),u($=>({...$,[k]:!0}))}catch(Z){console.error("Error downloading document:",Z),bn.error("Failed to download document")}finally{p(Z=>({...Z,[k]:!1}))}},F=async()=>{var k,Q,Z,se,_,$,J;if(r){const H={addAttestations:[{attestationTime:new Date().toISOString(),attesterFullName:(Z=(Q=(k=m==null?void 0:m.parties)==null?void 0:k.find(X=>(X==null?void 0:X.partyType)==="INDIVIDUAL"))==null?void 0:Q.individualDetails)==null?void 0:Z.firstName,ipAddress:h,documentId:(_=(se=m==null?void 0:m.outstanding)==null?void 0:se.attestationDocumentIds)==null?void 0:_[0]}]},K={consumerDevice:{ipAddress:h,sessionId:Tie()}};try{(J=($=m==null?void 0:m.outstanding)==null?void 0:$.attestationDocumentIds)!=null&&J.length&&await v({id:r,data:H},{onSettled:(X,oe)=>{var re;i==null||i(X,(re=oe==null?void 0:oe.response)==null?void 0:re.data)},onSuccess:()=>{bn.success("Attestation details updated successfully")},onError:()=>{bn.error("Failed to update attestation details")}}),o||await b({id:r,data:K},{onSuccess:()=>{bn.success("KYC initiated successfully"),e.invalidateQueries()},onError:()=>{bn.error("Failed to initiate KYC")}})}catch(X){console.error("Error completing KYC process:",X),bn.error("An error occurred while completing the KYC process")}}},B=(k,Q)=>d.jsxs("div",{className:"eb-mb-4 eb-p-4",children:[d.jsx("h2",{className:"eb-mb-4 eb-text-xl eb-font-bold",children:k==null?void 0:k.partyType}),d.jsx("dl",{className:"eb-ml-2 eb-space-y-2",children:Q.map(({label:Z,path:se,transformFunc:_})=>{const $=aM(k,se);return $!=null?d.jsxs("div",{className:"eb-flex eb-border-b eb-border-dotted eb-border-gray-300 sm:eb-justify-between",children:[d.jsxs("dt",{className:"eb-w-1/3 sm:eb-mb-0",children:[Z,":"]}),d.jsx("dd",{className:"sm:eb-w-2/3 sm:eb-pl-4",children:_?_($):typeof $=="boolean"?$.toString():Array.isArray($)?$.join(", "):$})]},se):null})})]},((k==null?void 0:k.id)??"")+((k==null?void 0:k.partyType)??""));return d.jsx(d.Fragment,{children:d.jsxs($8,{className:"eb-w-full eb-text-sm",children:[d.jsx(I0,{as:"h2",className:"eb-mb-4",children:"Review"}),!Ap(m==null?void 0:m.outstanding)&&m&&d.jsx(Die,{clientData:m}),Ap(m==null?void 0:m.outstanding)&&m&&d.jsx("div",{className:"eb-mb-4 eb-bg-green-100 eb-p-4 eb-text-green-800",children:"All outstanding KYC requirements have been addressed."}),d.jsx("div",{className:"eb-w-xl eb-px-4",children:(q=m==null?void 0:m.parties)==null?void 0:q.map(k=>(k==null?void 0:k.partyType)==="ORGANIZATION"?B(k,Mie):B(k,$ie))}),!!((G=m==null?void 0:m.questionResponses)!=null&&G.length)&&d.jsxs("div",{className:"eb-w-xl eb-px-4",children:[d.jsx("h2",{className:"eb-mb-4 eb-text-xl eb-font-bold",children:"Question Responses"}),(V=m==null?void 0:m.questionResponses)==null?void 0:V.map(k=>{var Q,Z,se,_;return d.jsx(d.Fragment,{children:!!((Q=k==null?void 0:k.values)!=null&&Q.length)&&d.jsx("div",{className:"eb-p-4",children:d.jsxs("dl",{className:"eb-ml-2",children:[d.jsx("dt",{className:"",children:(se=(Z=E==null?void 0:E.questions)==null?void 0:Z.find($=>$.id===k.questionId))==null?void 0:se.description}),d.jsxs("dd",{className:"",children:[d.jsx("b",{children:"Response:"})," ",(_=k==null?void 0:k.values)==null?void 0:_.join(", ")]})]})},k.questionId)})})]}),d.jsxs("div",{className:"eb-mt-8 eb-border-t eb-pt-4",children:[d.jsx(I0,{as:"h3",className:"eb-mb-4",children:"Terms and Conditions"}),d.jsx("p",{className:"eb-mb-4",children:"Please read and attest the below documents by J.P. Morgan to complete the process."}),d.jsxs("div",{className:"eb-space-y-6",children:[d.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[d.jsx(al,{id:"dataAccuracy",checked:s.dataAccuracy,onCheckedChange:A("dataAccuracy"),className:"eb-mr-4"}),d.jsx(Zf,{htmlFor:"dataAccuracy",className:"eb-peer-disabled:eb-cursor-not-allowed eb-peer-disabled:eb-opacity-70 eb-text-sm eb-leading-none",children:"The data I am providing is true, accurate, current and complete to the best of my knowledge."})]}),d.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[d.jsx(al,{id:"termsAndConditions",checked:s.termsAndConditions,onCheckedChange:A("termsAndConditions"),className:"eb-mr-4"}),d.jsxs(Zf,{htmlFor:"termsAndConditions",className:"eb-peer-disabled:eb-cursor-not-allowed eb-peer-disabled:eb-opacity-70 eb-text-sm eb-leading-none",children:["I have read and agree to the below attestation documents:",C.map((k,Q)=>{var Z,se,_,$,J;return d.jsx("div",{children:d.jsxs(Qe,{onClick:D(((Z=k.data)==null?void 0:Z.id)??""),className:"eb-text-blue-600 eb-underline",variant:"link",disabled:(se=k.data)!=null&&se.id?f[k.data.id]:!1,children:[d.jsx("span",{className:"",children:(_=k.data)!=null&&_.id&&c[k.data.id]?d.jsx(ka,{className:"eb-h-4 eb-w-4"}):d.jsx("span",{className:"eb-h-4"})}),($=k.data)!=null&&$.id&&f[k.data.id]?"Downloading...":(J=k.data)==null?void 0:J.documentType]})},Q)}),!I&&d.jsx("p",{className:"eb-text-sm eb-font-semibold eb-text-red-600",children:"Please open the documents links to enable the terms and conditions checkbox."})]})]})]})]}),d.jsx(Eo,{error:g||y}),d.jsxs("div",{className:"eb-mt-8 eb-flex eb-w-full eb-justify-end eb-gap-4",children:[d.jsx(Qe,{disabled:n,variant:"secondary",onClick:t,children:"Previous"}),d.jsx(Qe,{onClick:F,disabled:!L||!Ap(m==null?void 0:m.outstanding),children:L?Ap(m==null?void 0:m.outstanding)?"Submit":"Please address all outstanding items":"Please agree to all terms and review all documents"})]})]})})},Nie=({clientData:e})=>{var a;const[t,n]=l.useState(!1),r=()=>{var u,f,p;const c=[];return(u=e==null?void 0:e.outstanding)!=null&&u.attestationDocumentIds&&e.outstanding.attestationDocumentIds.length>0&&c.push(`Missing attestation documents (${e.outstanding.attestationDocumentIds.length})`),(f=e==null?void 0:e.outstanding)!=null&&f.partyRoles&&e.outstanding.partyRoles.length>0&&c.push(`Missing parties with roles: ${e.outstanding.partyRoles.join(", ")}`),(p=e==null?void 0:e.outstanding)!=null&&p.questionIds&&e.outstanding.questionIds.length>0&&c.push(`Missing answers for ${e.outstanding.questionIds.length} questions`),c},i=c=>{if(!c.validationResponse)return null;const u=c.validationResponse.flatMap(f=>{var p;return((p=f.fields)==null?void 0:p.map(m=>m.name))??[]});return u.length>0?u:null},o=r();return!(o.length>0||(e==null?void 0:e.parties)&&e.parties.some(c=>{const u=i(c);return u&&u.length>0}))||t?null:d.jsxs("div",{className:"eb-relative eb-mb-4 eb-rounded-md eb-border eb-border-blue-200 eb-bg-blue-50 eb-p-3 eb-text-sm eb-text-blue-900",children:[d.jsx(Qe,{onClick:()=>n(!0),variant:"ghost",size:"icon",className:"eb-absolute eb-right-2 eb-top-2 eb-h-6 eb-w-6 eb-p-0","aria-label":"Dismiss alert",children:d.jsx(Fc,{className:"eb-h-4 eb-w-4"})}),d.jsx("div",{className:"eb-mb-2 eb-font-medium",children:"Missing Information:"}),d.jsxs("div",{className:"eb-space-y-2",children:[o.length>0&&d.jsx("div",{className:"eb-flex eb-flex-wrap eb-gap-2",children:o.map((c,u)=>d.jsx("span",{className:"eb-rounded-full eb-bg-blue-100 eb-px-2 eb-py-1 eb-text-xs eb-font-medium eb-text-blue-800",children:c},u))}),(a=e==null?void 0:e.parties)==null?void 0:a.map(c=>{const u=i(c);return u?d.jsxs("div",{children:[d.jsxs("div",{className:"eb-mb-1 eb-text-xs eb-font-medium",children:[c.partyType," (",c.id,"):"]}),d.jsx("div",{className:"eb-flex eb-flex-wrap eb-gap-2",children:u.map((f,p)=>d.jsx("span",{className:"eb-rounded-full eb-bg-blue-100 eb-px-2 eb-py-1 eb-text-xs eb-font-medium eb-text-blue-800",children:f},p))})]},c.id):null})]})]})},Pie=({initialStep:e,variant:t,onboardingContentTokens:n={},alertOnExit:r=!1,userEventsToTrack:i=[],userEventsHandler:o,usePartyResource:s=!0,...a})=>{const{tokens:c={}}=ej(),{i18n:u}=uo("onboarding");l.useEffect(()=>{hf(u.language,"onboarding",[c.onboarding,n])},[hf,JSON.stringify(c.onboarding),JSON.stringify(n),u.language]),l.useEffect(()=>{const p=m=>{m.preventDefault(),m.returnValue=!0};return r&&window.addEventListener("beforeunload",p),()=>{window.removeEventListener("beforeunload",p)}},[r]);const f=l.useCallback(p=>{var h;const m=p.target;Object.keys(m.dataset).includes("userEventTracking")&&(o==null||o({actionName:`${p.type} on ${(h=m.dataset)==null?void 0:h.userEventTracking}`}))},[]);return l.useEffect(()=>{if((i==null?void 0:i.length)>0&&o){const p=document.getElementById("eb-component");return i.forEach(m=>p==null?void 0:p.addEventListener(m,f)),()=>{i.forEach(m=>p==null?void 0:p.removeEventListener(m,f))}}return()=>{}},[]),d.jsx(KR,{...a,usePartyResource:s,children:d.jsx(Oie,{initialStep:e,variant:t})})},Oie=({initialStep:e=0,variant:t="circle-alt"})=>{var v,g,b;const{t:n}=uo("onboarding"),{clientId:r,wasClientIdCreated:i}=ri(),{data:o,status:s,error:a,refetch:c}=Li(r??"",{query:{enabled:!!r}}),u=(v=o==null?void 0:o.products)==null?void 0:v[0],f=(b=(g=o==null?void 0:o.parties)==null?void 0:g.find(y=>(y==null?void 0:y.partyType)==="ORGANIZATION"))==null?void 0:b.organizationDetails,p=[{label:n("stepLabels.initialDetails"),children:d.jsx(Kre,{})},{label:n("stepLabels.organizationDetails"),children:d.jsx(Eie,{})},{label:n("stepLabels.individualDetails"),children:d.jsx(Gre,{})},{label:n("stepLabels.decisionMakers"),children:d.jsx(Vre,{}),onlyVisibleFor:{organizationType:["LIMITED_LIABILITY_COMPANY"],product:["MERCHANT_SERVICES"]}},{label:n("stepLabels.businessOwners"),children:d.jsx(Nne,{}),onlyVisibleFor:{organizationType:["LIMITED_LIABILITY_COMPANY"]}},{label:n("stepLabels.additionalQuestions"),children:d.jsx(ZG,{})},{id:"documentUpload",label:n("stepLabels.uploadDocuments"),children:d.jsx(xC,{})},{label:n("stepLabels.reviewAndAttest"),children:d.jsx(Fie,{})}],m=l.useCallback((y,x,C,E)=>p.filter(w=>{var I,L,A,D,F;return!(((L=(I=E==null?void 0:E.outstanding)==null?void 0:I.documentRequestIds)==null?void 0:L.length)===0&&(w==null?void 0:w.id)==="documentUpload")&&(!((A=w.onlyVisibleFor)!=null&&A.jurisdiction)||x&&w.onlyVisibleFor.jurisdiction.includes(x))&&(!((D=w.onlyVisibleFor)!=null&&D.organizationType)||C&&w.onlyVisibleFor.organizationType.includes(C))&&(!((F=w.onlyVisibleFor)!=null&&F.product)||y&&w.onlyVisibleFor.product.includes(y))}),[p]),h=l.useMemo(()=>m(u,f==null?void 0:f.jurisdiction,f==null?void 0:f.organizationType,o),[u,f==null?void 0:f.jurisdiction,f==null?void 0:f.organizationType]);return d.jsxs(ur,{className:"eb-component",children:[d.jsx(Nr,{children:d.jsx(yi,{children:n("title")})}),d.jsxs(dr,{className:"eb-flex eb-w-full eb-flex-col eb-gap-4",children:[o&&d.jsx(Nie,{clientData:o}),(o==null?void 0:o.status)==="NEW"||!r||s==="pending"?d.jsx(s9,{initialStep:i&&!e?1:e,steps:h,variant:t,mobileBreakpoint:"1279px",children:h.map((y,x)=>{const{children:C,...E}=y;return d.jsx(a9,{...E,children:d.jsx("div",{className:"eb-px-2",children:r&&s==="pending"?d.jsx(jr,{message:n("fetchingClientData")}):s==="error"?d.jsx(Eo,{error:a,tryAgainAction:c,customErrorMessage:{default:n("errorMessages.default"),404:n("errorMessages.clientNotFound")}}):C})},x)})}):d.jsx(qre,{})]})]})};var At={context:void 0,registry:void 0,getContextId(){return kC(this.context.count)},getNextContextId(){return kC(this.context.count++)}};function kC(e){const t=String(e),n=t.length-1;return At.context.id+(n?String.fromCharCode(96+n):"")+t}function ud(e){At.context=e}var _ie=(e,t)=>e===t,Dp=Symbol("solid-proxy"),Mp=Symbol("solid-track"),$p={equals:_ie},jC=WC,To=1,Tp=2,RC={owned:null,cleanups:null,context:null,owner:null},Zg={},jt=null,Qg=null,zie=null,Kt=null,rr=null,Fo=null,Fp=0;function No(e,t){const n=Kt,r=jt,i=e.length===0,o=t===void 0?r:t,s=i?RC:{owned:null,cleanups:null,context:o?o.context:null,owner:o},a=i?e:()=>e(()=>fn(()=>_p(s)));jt=s,Kt=null;try{return eo(a,!0)}finally{Kt=n,jt=r}}function ze(e,t){t=t?Object.assign({},$p,t):$p;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),GC(n,i));return[VC.bind(n),r]}function HC(e,t,n){const r=Np(e,t,!0,To);Wl(r)}function ot(e,t,n){const r=Np(e,t,!1,To);Wl(r)}function Ze(e,t,n){jC=Kie;const r=Np(e,t,!1,To);(!n||!n.render)&&(r.user=!0),Fo?Fo.push(r):Wl(r)}function he(e,t,n){n=n?Object.assign({},$p,n):$p;const r=Np(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Wl(r),VC.bind(r)}function kie(e){return e&&typeof e=="object"&&"then"in e}function jie(e,t,n){let r,i,o;arguments.length===1?(r=!0,i=e,o={}):(r=e,i=t,o={});let s=null,a=Zg,c=null,u=!1,f="initialValue"in o,p=typeof r=="function"&&he(r);const m=new Set,[h,v]=(o.storage||ze)(o.initialValue),[g,b]=ze(void 0),[y,x]=ze(void 0,{equals:!1}),[C,E]=ze(f?"ready":"unresolved");if(At.context){c=At.getNextContextId();let D;o.ssrLoadFrom==="initial"?a=o.initialValue:At.load&&(D=At.load(c))&&(a=D)}function w(D,F,B,N){return s===D&&(s=null,N!==void 0&&(f=!0),(D===a||F===a)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(N,{value:F})),a=Zg,I(F,B)),F}function I(D,F){eo(()=>{F===void 0&&v(()=>D),E(F!==void 0?"errored":f?"ready":"unresolved"),b(F);for(const B of m.keys())B.decrement();m.clear()},!1)}function L(){const D=Gie,F=h(),B=g();if(B!==void 0&&!s)throw B;return Kt&&Kt.user,F}function A(D=!0){if(D!==!1&&u)return;u=!1;const F=p?p():r;if(F==null||F===!1){w(s,fn(h));return}const B=a!==Zg?a:fn(()=>i(F,{value:h(),refetching:D}));return kie(B)?(s=B,"value"in B?(B.status==="success"?w(s,B.value,void 0,F):w(s,void 0,Xg(B.value),F),B):(u=!0,queueMicrotask(()=>u=!1),eo(()=>{E(f?"refreshing":"pending"),x()},!1),B.then(N=>w(B,N,void 0,F),N=>w(B,void 0,Xg(N),F)))):(w(s,B,void 0,F),B)}return Object.defineProperties(L,{state:{get:()=>C()},error:{get:()=>g()},loading:{get(){const D=C();return D==="pending"||D==="refreshing"}},latest:{get(){if(!f)return L();const D=g();if(D&&!s)throw D;return h()}}}),p?HC(()=>A(!1)):A(!1),[L,{refetch:A,mutate:v}]}function Rie(e){return eo(e,!1)}function fn(e){if(Kt===null)return e();const t=Kt;Kt=null;try{return e()}finally{Kt=t}}function Po(e,t,n){const r=Array.isArray(e);let i,o=n&&n.defer;return s=>{let a;if(r){a=Array(e.length);for(let u=0;u<e.length;u++)a[u]=e[u]()}else a=e();if(o)return o=!1,s;const c=fn(()=>t(a,i,s));return i=a,c}}function ha(e){Ze(()=>fn(e))}function st(e){return jt===null||(jt.cleanups===null?jt.cleanups=[e]:jt.cleanups.push(e)),e}function BC(){return jt}function Hie(e,t){const n=jt,r=Kt;jt=e,Kt=null;try{return eo(t,!0)}catch(i){Jg(i)}finally{jt=n,Kt=r}}function Bie(e){const t=Kt,n=jt;return Promise.resolve().then(()=>{Kt=t,jt=n;let r;return eo(e,!1),Kt=jt=null,r?r.done:void 0})}var[qie,Z1e]=ze(!1);function Vie(){return[qie,Bie]}function Kn(e,t){const n=Symbol("context");return{id:n,Provider:Yie(n),defaultValue:e}}function Yn(e){let t;return jt&&jt.context&&(t=jt.context[e.id])!==void 0?t:e.defaultValue}function qC(e){const t=he(e),n=he(()=>e3(t()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}var Gie;function VC(){if(this.sources&&this.state)if(this.state===To)Wl(this);else{const e=rr;rr=null,eo(()=>Op(this),!1),rr=e}if(Kt){const e=this.observers?this.observers.length:0;Kt.sources?(Kt.sources.push(this),Kt.sourceSlots.push(e)):(Kt.sources=[this],Kt.sourceSlots=[e]),this.observers?(this.observers.push(Kt),this.observerSlots.push(Kt.sources.length-1)):(this.observers=[Kt],this.observerSlots=[Kt.sources.length-1])}return this.value}function GC(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&eo(()=>{for(let i=0;i<e.observers.length;i+=1){const o=e.observers[i],s=Qg&&Qg.running;s&&Qg.disposed.has(o),(s?!o.tState:!o.state)&&(o.pure?rr.push(o):Fo.push(o),o.observers&&UC(o)),s||(o.state=To)}if(rr.length>1e6)throw rr=[],new Error},!1)),t}function Wl(e){if(!e.fn)return;_p(e);const t=Fp;Wie(e,e.value,t)}function Wie(e,t,n){let r;const i=jt,o=Kt;Kt=jt=e;try{r=e.fn(t)}catch(s){return e.pure&&(e.state=To,e.owned&&e.owned.forEach(_p),e.owned=null),e.updatedAt=n+1,Jg(s)}finally{Kt=o,jt=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?GC(e,r):e.value=r,e.updatedAt=n)}function Np(e,t,n,r=To,i){const o={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:jt,context:jt?jt.context:null,pure:n};return jt===null||jt!==RC&&(jt.owned?jt.owned.push(o):jt.owned=[o]),o}function Pp(e){if(e.state===0)return;if(e.state===Tp)return Op(e);if(e.suspense&&fn(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Fp);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===To)Wl(e);else if(e.state===Tp){const r=rr;rr=null,eo(()=>Op(e,t[0]),!1),rr=r}}function eo(e,t){if(rr)return e();let n=!1;t||(rr=[]),Fo?n=!0:Fo=[],Fp++;try{const r=e();return Uie(n),r}catch(r){n||(Fo=null),rr=null,Jg(r)}}function Uie(e){if(rr&&(WC(rr),rr=null),e)return;const t=Fo;Fo=null,t.length&&eo(()=>jC(t),!1)}function WC(e){for(let t=0;t<e.length;t++)Pp(e[t])}function Kie(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:Pp(r)}if(At.context){if(At.count){At.effects||(At.effects=[]),At.effects.push(...e.slice(0,n));return}else At.effects&&(e=[...At.effects,...e],n+=At.effects.length,delete At.effects);ud()}for(t=0;t<n;t++)Pp(e[t])}function Op(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const r=e.sources[n];if(r.sources){const i=r.state;i===To?r!==t&&(!r.updatedAt||r.updatedAt<Fp)&&Pp(r):i===Tp&&Op(r,t)}}}function UC(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Tp,n.pure?rr.push(n):Fo.push(n),n.observers&&UC(n))}}function _p(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),r=e.sourceSlots.pop(),i=n.observers;if(i&&i.length){const o=i.pop(),s=n.observerSlots.pop();r<i.length&&(o.sourceSlots[s]=r,i[r]=o,n.observerSlots[r]=s)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)_p(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function Xg(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Jg(e,t=jt){throw Xg(e)}function e3(e){if(typeof e=="function"&&!e.length)return e3(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=e3(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Yie(e,t){return function(r){let i;return ot(()=>i=fn(()=>(jt.context={...jt.context,[e]:r.value},qC(()=>r.children))),void 0),i}}var t3=Symbol("fallback");function zp(e){for(let t=0;t<e.length;t++)e[t]()}function Zie(e,t,n={}){let r=[],i=[],o=[],s=0,a=t.length>1?[]:null;return st(()=>zp(o)),()=>{let c=e()||[],u=c.length,f,p;return c[Mp],fn(()=>{let h,v,g,b,y,x,C,E,w;if(u===0)s!==0&&(zp(o),o=[],r=[],i=[],s=0,a&&(a=[])),n.fallback&&(r=[t3],i[0]=No(I=>(o[0]=I,n.fallback())),s=1);else if(s===0){for(i=new Array(u),p=0;p<u;p++)r[p]=c[p],i[p]=No(m);s=u}else{for(g=new Array(u),b=new Array(u),a&&(y=new Array(u)),x=0,C=Math.min(s,u);x<C&&r[x]===c[x];x++);for(C=s-1,E=u-1;C>=x&&E>=x&&r[C]===c[E];C--,E--)g[E]=i[C],b[E]=o[C],a&&(y[E]=a[C]);for(h=new Map,v=new Array(E+1),p=E;p>=x;p--)w=c[p],f=h.get(w),v[p]=f===void 0?-1:f,h.set(w,p);for(f=x;f<=C;f++)w=r[f],p=h.get(w),p!==void 0&&p!==-1?(g[p]=i[f],b[p]=o[f],a&&(y[p]=a[f]),p=v[p],h.set(w,p)):o[f]();for(p=x;p<u;p++)p in g?(i[p]=g[p],o[p]=b[p],a&&(a[p]=y[p],a[p](p))):i[p]=No(m);i=i.slice(0,s=u),r=c.slice(0)}return i});function m(h){if(o[p]=h,a){const[v,g]=ze(p);return a[p]=g,t(c[p],v)}return t(c[p])}}}function Qie(e,t,n={}){let r=[],i=[],o=[],s=[],a=0,c;return st(()=>zp(o)),()=>{const u=e()||[],f=u.length;return u[Mp],fn(()=>{if(f===0)return a!==0&&(zp(o),o=[],r=[],i=[],a=0,s=[]),n.fallback&&(r=[t3],i[0]=No(m=>(o[0]=m,n.fallback())),a=1),i;for(r[0]===t3&&(o[0](),o=[],r=[],i=[],a=0),c=0;c<f;c++)c<r.length&&r[c]!==u[c]?s[c](()=>u[c]):c>=r.length&&(i[c]=No(p));for(;c<r.length;c++)o[c]();return a=s.length=o.length=f,r=u.slice(0),i=i.slice(0,a)});function p(m){o[c]=m;const[h,v]=ze(u[c]);return s[c]=v,t(h,c)}}}function W(e,t){return fn(()=>e(t||{}))}function kp(){return!0}var n3={get(e,t,n){return t===Dp?n:e.get(t)},has(e,t){return t===Dp?!0:e.has(t)},set:kp,deleteProperty:kp,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:kp,deleteProperty:kp}},ownKeys(e){return e.keys()}};function r3(e){return(e=typeof e=="function"?e():e)?e:{}}function Xie(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function wt(...e){let t=!1;for(let s=0;s<e.length;s++){const a=e[s];t=t||!!a&&Dp in a,e[s]=typeof a=="function"?(t=!0,he(a)):a}if(t)return new Proxy({get(s){for(let a=e.length-1;a>=0;a--){const c=r3(e[a])[s];if(c!==void 0)return c}},has(s){for(let a=e.length-1;a>=0;a--)if(s in r3(e[a]))return!0;return!1},keys(){const s=[];for(let a=0;a<e.length;a++)s.push(...Object.keys(r3(e[a])));return[...new Set(s)]}},n3);const n={},r=Object.create(null);for(let s=e.length-1;s>=0;s--){const a=e[s];if(!a)continue;const c=Object.getOwnPropertyNames(a);for(let u=c.length-1;u>=0;u--){const f=c[u];if(f==="__proto__"||f==="constructor")continue;const p=Object.getOwnPropertyDescriptor(a,f);if(!r[f])r[f]=p.get?{enumerable:!0,configurable:!0,get:Xie.bind(n[f]=[p.get.bind(a)])}:p.value!==void 0?p:void 0;else{const m=n[f];m&&(p.get?m.push(p.get.bind(a)):p.value!==void 0&&m.push(()=>p.value))}}}const i={},o=Object.keys(r);for(let s=o.length-1;s>=0;s--){const a=o[s],c=r[a];c&&c.get?Object.defineProperty(i,a,c):i[a]=c?c.value:void 0}return i}function Bt(e,...t){if(Dp in e){const i=new Set(t.length>1?t.flat():t[0]),o=t.map(s=>new Proxy({get(a){return s.includes(a)?e[a]:void 0},has(a){return s.includes(a)&&a in e},keys(){return s.filter(a=>a in e)}},n3));return o.push(new Proxy({get(s){return i.has(s)?void 0:e[s]},has(s){return i.has(s)?!1:s in e},keys(){return Object.keys(e).filter(s=>!i.has(s))}},n3)),o}const n={},r=t.map(()=>({}));for(const i of Object.getOwnPropertyNames(e)){const o=Object.getOwnPropertyDescriptor(e,i),s=!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable;let a=!1,c=0;for(const u of t)u.includes(i)&&(a=!0,s?r[c][i]=o.value:Object.defineProperty(r[c],i,o)),++c;a||(s?n[i]=o.value:Object.defineProperty(n,i,o))}return[...r,n]}function Jie(e){let t,n;const r=i=>{const o=At.context;if(o){const[a,c]=ze();At.count||(At.count=0),At.count++,(n||(n=e())).then(u=>{ud(o),At.count--,c(()=>u.default),ud()}),t=a}else if(!t){const[a]=jie(()=>(n||(n=e())).then(c=>c.default));t=a}let s;return he(()=>(s=t())&&fn(()=>{if(!o)return s(i);const a=At.context;ud(o);const c=s(i);return ud(a),c}))};return r.preload=()=>n||((n=e()).then(i=>t=()=>i.default),n),r}var eoe=0;function oi(){return At.context?At.getNextContextId():`cl-${eoe++}`}var KC=e=>`Stale read from <${e}>.`;function toe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return he(Zie(()=>e.each,e.children,t||void 0))}function noe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return he(Qie(()=>e.each,e.children,t||void 0))}function at(e){const t=e.keyed,n=he(()=>e.when,void 0,{equals:(r,i)=>t?r===i:!r==!i});return he(()=>{const r=n();if(r){const i=e.children;return typeof i=="function"&&i.length>0?fn(()=>i(t?r:()=>{if(!fn(n))throw KC("Show");return e.when})):i}return e.fallback},void 0,void 0)}function roe(e){let t=!1;const n=(o,s)=>(t?o[1]===s[1]:!o[1]==!s[1])&&o[2]===s[2],r=qC(()=>e.children),i=he(()=>{let o=r();Array.isArray(o)||(o=[o]);for(let s=0;s<o.length;s++){const a=o[s].when;if(a)return t=!!o[s].keyed,[s,a,o[s]]}return[-1]},void 0,{equals:n});return he(()=>{const[o,s,a]=i();if(o<0)return e.fallback;const c=a.children;return typeof c=="function"&&c.length>0?fn(()=>c(t?s:()=>{if(fn(i)[0]!==o)throw KC("Match");return a.when})):c},void 0,void 0)}function i3(e){return e}var ioe=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],ooe=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...ioe]),soe=new Set(["innerHTML","textContent","innerText","children"]),aoe=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),loe=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function coe(e,t){const n=loe[e];return typeof n=="object"?n[t]?n.$:void 0:n}var uoe=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),doe=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),foe={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function poe(e,t,n){let r=n.length,i=t.length,o=r,s=0,a=0,c=t[i-1].nextSibling,u=null;for(;s<i||a<o;){if(t[s]===n[a]){s++,a++;continue}for(;t[i-1]===n[o-1];)i--,o--;if(i===s){const f=o<r?a?n[a-1].nextSibling:n[o-a]:c;for(;a<o;)e.insertBefore(n[a++],f)}else if(o===a)for(;s<i;)(!u||!u.has(t[s]))&&t[s].remove(),s++;else if(t[s]===n[o-1]&&n[a]===t[i-1]){const f=t[--i].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--o],f),t[i]=n[o]}else{if(!u){u=new Map;let p=a;for(;p<o;)u.set(n[p],p++)}const f=u.get(t[s]);if(f!=null)if(a<f&&f<o){let p=s,m=1,h;for(;++p<i&&p<o&&!((h=u.get(t[p]))==null||h!==f+m);)m++;if(m>f-a){const v=t[s];for(;a<f;)e.insertBefore(n[a++],v)}else e.replaceChild(n[a++],t[s++])}else s++;else t[s++].remove()}}}var dd="_$DX_DELEGATE";function moe(e,t,n,r={}){let i;return No(o=>{i=o,t===document?e():xe(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=""}}function qe(e,t,n){let r;const i=()=>{const s=document.createElement("template");return s.innerHTML=e,s.content.firstChild},o=()=>(r||(r=i())).cloneNode(!0);return o.cloneNode=o,o}function jp(e,t=window.document){const n=t[dd]||(t[dd]=new Set);for(let r=0,i=e.length;r<i;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,JC))}}function hoe(e=window.document){if(e[dd]){for(let t of e[dd].keys())e.removeEventListener(t,JC);delete e[dd]}}function Le(e,t,n){At.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function goe(e,t,n,r){At.context&&e.isConnected||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function Te(e,t){At.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function YC(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=o=>i.call(e,n[1],o))}else e.addEventListener(t,n)}function voe(e,t,n={}){const r=Object.keys(t||{}),i=Object.keys(n);let o,s;for(o=0,s=i.length;o<s;o++){const a=i[o];!a||a==="undefined"||t[a]||(QC(e,a,!1),delete n[a])}for(o=0,s=r.length;o<s;o++){const a=r[o],c=!!t[a];!a||a==="undefined"||n[a]===c||!c||(QC(e,a,!0),n[a]=c)}return n}function boe(e,t,n){if(!t)return n?Le(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let i,o;for(o in n)t[o]==null&&r.removeProperty(o),delete n[o];for(o in t)i=t[o],i!==n[o]&&(r.setProperty(o,i),n[o]=i);return n}function ZC(e,t={},n,r){const i={};return r||ot(()=>i.children=pd(e,t.children,i.children)),ot(()=>typeof t.ref=="function"&&fd(t.ref,e)),ot(()=>yoe(e,t,n,!0,i,!0)),i}function fd(e,t,n){return fn(()=>e(t,n))}function xe(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return pd(e,t,r,n);ot(i=>pd(e,t(),i,n),r)}function yoe(e,t,n,r,i={},o=!1){t||(t={});for(const s in i)if(!(s in t)){if(s==="children")continue;i[s]=XC(e,s,null,i[s],n,o)}for(const s in t){if(s==="children")continue;const a=t[s];i[s]=XC(e,s,a,i[s],n,o)}}function xoe(e){let t,n;return!At.context||!(t=At.registry.get(n=Coe()))?e():(At.completed&&At.completed.add(t),At.registry.delete(n),t)}function woe(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function QC(e,t,n){const r=t.trim().split(/\s+/);for(let i=0,o=r.length;i<o;i++)e.classList.toggle(r[i],n)}function XC(e,t,n,r,i,o){let s,a,c,u,f;if(t==="style")return boe(e,n,r);if(t==="classList")return voe(e,n,r);if(n===r)return r;if(t==="ref")o||n(e);else if(t.slice(0,3)==="on:"){const p=t.slice(3);r&&e.removeEventListener(p,r),n&&e.addEventListener(p,n)}else if(t.slice(0,10)==="oncapture:"){const p=t.slice(10);r&&e.removeEventListener(p,r,!0),n&&e.addEventListener(p,n,!0)}else if(t.slice(0,2)==="on"){const p=t.slice(2).toLowerCase(),m=uoe.has(p);if(!m&&r){const h=Array.isArray(r)?r[0]:r;e.removeEventListener(p,h)}(m||n)&&(YC(e,p,n,m),m&&jp([p]))}else if(t.slice(0,5)==="attr:")Le(e,t.slice(5),n);else if((f=t.slice(0,5)==="prop:")||(c=soe.has(t))||!i&&((u=coe(t,e.tagName))||(a=ooe.has(t)))||(s=e.nodeName.includes("-"))){if(f)t=t.slice(5),a=!0;else if(At.context&&e.isConnected)return n;t==="class"||t==="className"?Te(e,n):s&&!a&&!c?e[woe(t)]=n:e[u||t]=n}else{const p=i&&t.indexOf(":")>-1&&foe[t.split(":")[0]];p?goe(e,p,t,n):Le(e,aoe[t]||t,n)}return n}function JC(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}}),At.registry&&!At.done&&(At.done=_$HY.done=!0);n;){const r=n[t];if(r&&!n.disabled){const i=n[`${t}Data`];if(i!==void 0?r.call(n,i,e):r.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function pd(e,t,n,r,i){const o=!!At.context&&e.isConnected;if(o){!n&&(n=[...e.childNodes]);let c=[];for(let u=0;u<n.length;u++){const f=n[u];f.nodeType===8&&f.data.slice(0,2)==="!$"?f.remove():c.push(f)}n=c}for(;typeof n=="function";)n=n();if(t===n)return n;const s=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,s==="string"||s==="number"){if(o||s==="number"&&(t=t.toString(),t===n))return n;if(a){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=Ul(e,n,r,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||s==="boolean"){if(o)return n;n=Ul(e,n,r)}else{if(s==="function")return ot(()=>{let c=t();for(;typeof c=="function";)c=c();n=pd(e,c,n,r)}),()=>n;if(Array.isArray(t)){const c=[],u=n&&Array.isArray(n);if(o3(c,t,n,i))return ot(()=>n=pd(e,c,n,r,!0)),()=>n;if(o){if(!c.length)return n;if(r===void 0)return[...e.childNodes];let f=c[0],p=[f];for(;(f=f.nextSibling)!==r;)p.push(f);return n=p}if(c.length===0){if(n=Ul(e,n,r),a)return n}else u?n.length===0?eS(e,c,r):poe(e,n,c):(n&&Ul(e),eS(e,c));n=c}else if(t.nodeType){if(o&&t.parentNode)return n=a?[t]:t;if(Array.isArray(n)){if(a)return n=Ul(e,n,r,t);Ul(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function o3(e,t,n,r){let i=!1;for(let o=0,s=t.length;o<s;o++){let a=t[o],c=n&&n[e.length],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))i=o3(e,a,c)||i;else if(u==="function")if(r){for(;typeof a=="function";)a=a();i=o3(e,Array.isArray(a)?a:[a],Array.isArray(c)?c:[c])||i}else e.push(a),i=!0;else{const f=String(a);c&&c.nodeType===3&&c.data===f?e.push(c):e.push(document.createTextNode(f))}}return i}function eS(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Ul(e,t,n,r){if(n===void 0)return e.textContent="";const i=r||document.createTextNode("");if(t.length){let o=!1;for(let s=t.length-1;s>=0;s--){const a=t[s];if(i!==a){const c=a.parentNode===e;!o&&!s?c?e.replaceChild(i,a):e.insertBefore(i,n):c&&a.remove()}else o=!0}}else e.insertBefore(i,n);return[i]}function Coe(){return At.getNextContextId()}var Soe="http://www.w3.org/2000/svg";function tS(e,t=!1){return t?document.createElementNS(Soe,e):document.createElement(e)}function nS(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,i=BC();let o,s=!!At.context;return Ze(()=>{s&&(BC().user=s=!1),o||(o=Hie(i,()=>he(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[c,u]=ze(!1),f=()=>u(!0);No(p=>xe(a,()=>c()?p():o(),null)),st(f)}else{const c=tS(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),xe(u,o),a.appendChild(c),e.ref&&e.ref(c),st(()=>a.removeChild(c))}},void 0,{render:!s}),n}function Eoe(e){const[t,n]=Bt(e,["component"]),r=he(()=>t.component);return he(()=>{const i=r();switch(typeof i){case"function":return fn(()=>i(n));case"string":const o=doe.has(i),s=At.context?xoe():tS(i,o);return ZC(s,n,o),s}})}var Ioe=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},rS=class{constructor(e){this.generateIdentifier=e,this.kv=new Ioe}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},Loe=class extends rS{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function Aoe(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function Doe(e,t){const n=Aoe(e);if("find"in n)return n.find(t);const r=n;for(let i=0;i<r.length;i++){const o=r[i];if(t(o))return o}}function Kl(e,t){Object.entries(e).forEach(([n,r])=>t(r,n))}function Rp(e,t){return e.indexOf(t)!==-1}function iS(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(t(r))return r}}var Moe=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Doe(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},$oe=e=>Object.prototype.toString.call(e).slice(8,-1),oS=e=>typeof e>"u",Toe=e=>e===null,md=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,s3=e=>md(e)&&Object.keys(e).length===0,bs=e=>Array.isArray(e),Foe=e=>typeof e=="string",Noe=e=>typeof e=="number"&&!isNaN(e),Poe=e=>typeof e=="boolean",Ooe=e=>e instanceof RegExp,hd=e=>e instanceof Map,gd=e=>e instanceof Set,sS=e=>$oe(e)==="Symbol",_oe=e=>e instanceof Date&&!isNaN(e.valueOf()),zoe=e=>e instanceof Error,aS=e=>typeof e=="number"&&isNaN(e),koe=e=>Poe(e)||Toe(e)||oS(e)||Noe(e)||Foe(e)||sS(e),joe=e=>typeof e=="bigint",Roe=e=>e===1/0||e===-1/0,Hoe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Boe=e=>e instanceof URL,lS=e=>e.replace(/\./g,"\\."),a3=e=>e.map(String).map(lS).join("."),vd=e=>{const t=[];let n="";for(let i=0;i<e.length;i++){let o=e.charAt(i);if(o==="\\"&&e.charAt(i+1)==="."){n+=".",i++;continue}if(o==="."){t.push(n),n="";continue}n+=o}const r=n;return t.push(r),t};function to(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var cS=[to(oS,"undefined",()=>null,()=>{}),to(joe,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),to(_oe,"Date",e=>e.toISOString(),e=>new Date(e)),to(zoe,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(r=>{n[r]=e[r]}),n}),to(Ooe,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),to(gd,"set",e=>[...e.values()],e=>new Set(e)),to(hd,"map",e=>[...e.entries()],e=>new Map(e)),to(e=>aS(e)||Roe(e),"number",e=>aS(e)?"NaN":e>0?"Infinity":"-Infinity",Number),to(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),to(Boe,"URL",e=>e.toString(),e=>new URL(e))];function Hp(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var uS=Hp((e,t)=>sS(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const r=n.symbolRegistry.getValue(t[1]);if(!r)throw new Error("Trying to deserialize unknown symbol");return r}),qoe=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),dS=Hp(Hoe,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=qoe[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function fS(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var pS=Hp(fS,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const r={};return n.forEach(i=>{r[i]=e[i]}),r},(e,t,n)=>{const r=n.classRegistry.getValue(t[1]);if(!r)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(r.prototype),e)}),mS=Hp((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw new Error("Trying to deserialize unknown custom value");return r.deserialize(e)}),Voe=[pS,uS,mS,dS],hS=(e,t)=>{const n=iS(Voe,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const r=iS(cS,i=>i.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},gS={};cS.forEach(e=>{gS[e.annotation]=e});var Goe=(e,t,n)=>{if(bs(t))switch(t[0]){case"symbol":return uS.untransform(e,t,n);case"class":return pS.untransform(e,t,n);case"custom":return mS.untransform(e,t,n);case"typed-array":return dS.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const r=gS[t];if(!r)throw new Error("Unknown transformation: "+t);return r.untransform(e,n)}},Yl=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function vS(e){if(Rp(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Rp(e,"prototype"))throw new Error("prototype is not allowed as a property");if(Rp(e,"constructor"))throw new Error("constructor is not allowed as a property")}var Woe=(e,t)=>{vS(t);for(let n=0;n<t.length;n++){const r=t[n];if(gd(e))e=Yl(e,+r);else if(hd(e)){const i=+r,o=+t[++n]==0?"key":"value",s=Yl(e,i);switch(o){case"key":e=s;break;case"value":e=e.get(s);break}}else e=e[r]}return e},l3=(e,t,n)=>{if(vS(t),t.length===0)return n(e);let r=e;for(let o=0;o<t.length-1;o++){const s=t[o];if(bs(r)){const a=+s;r=r[a]}else if(md(r))r=r[s];else if(gd(r)){const a=+s;r=Yl(r,a)}else if(hd(r)){if(o===t.length-2)break;const c=+s,u=+t[++o]==0?"key":"value",f=Yl(r,c);switch(u){case"key":r=f;break;case"value":r=r.get(f);break}}}const i=t[t.length-1];if(bs(r)?r[+i]=n(r[+i]):md(r)&&(r[i]=n(r[i])),gd(r)){const o=Yl(r,+i),s=n(o);o!==s&&(r.delete(o),r.add(s))}if(hd(r)){const o=+t[t.length-2],s=Yl(r,o);switch(+i==0?"key":"value"){case"key":{const c=n(s);r.set(c,r.get(s)),c!==s&&r.delete(s);break}case"value":{r.set(s,n(r.get(s)));break}}}return e};function c3(e,t,n=[]){if(!e)return;if(!bs(e)){Kl(e,(o,s)=>c3(o,t,[...n,...vd(s)]));return}const[r,i]=e;i&&Kl(i,(o,s)=>{c3(o,t,[...n,...vd(s)])}),t(r,n)}function Uoe(e,t,n){return c3(t,(r,i)=>{e=l3(e,i,o=>Goe(o,r,n))}),e}function Koe(e,t){function n(r,i){const o=Woe(e,vd(i));r.map(vd).forEach(s=>{e=l3(e,s,()=>o)})}if(bs(t)){const[r,i]=t;r.forEach(o=>{e=l3(e,vd(o),()=>e)}),i&&Kl(i,n)}else Kl(t,n);return e}var Yoe=(e,t)=>md(e)||bs(e)||hd(e)||gd(e)||fS(e,t);function Zoe(e,t,n){const r=n.get(e);r?r.push(t):n.set(e,[t])}function Qoe(e,t){const n={};let r;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(a=>a.map(String)).sort((a,c)=>a.length-c.length));const[o,...s]=i;o.length===0?r=s.map(a3):n[a3(o)]=s.map(a3)}),r?s3(n)?[r]:[r,n]:s3(n)?void 0:n}var bS=(e,t,n,r,i=[],o=[],s=new Map)=>{const a=koe(e);if(!a){Zoe(e,i,t);const h=s.get(e);if(h)return r?{transformedValue:null}:h}if(!Yoe(e,n)){const h=hS(e,n),v=h?{transformedValue:h.value,annotations:[h.type]}:{transformedValue:e};return a||s.set(e,v),v}if(Rp(o,e))return{transformedValue:null};const c=hS(e,n),u=(c==null?void 0:c.value)??e,f=bs(u)?[]:{},p={};Kl(u,(h,v)=>{if(v==="__proto__"||v==="constructor"||v==="prototype")throw new Error(`Detected property ${v}. This is a prototype pollution risk, please remove it from your object.`);const g=bS(h,t,n,r,[...i,v],[...o,e],s);f[v]=g.transformedValue,bs(g.annotations)?p[v]=g.annotations:md(g.annotations)&&Kl(g.annotations,(b,y)=>{p[lS(v)+"."+y]=b})});const m=s3(p)?{transformedValue:f,annotations:c?[c.type]:void 0}:{transformedValue:f,annotations:c?[c.type,p]:p};return a||s.set(e,m),m};function yS(e){return Object.prototype.toString.call(e).slice(8,-1)}function xS(e){return yS(e)==="Array"}function Xoe(e){if(yS(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Joe(e,t,n,r,i){const o={}.propertyIsEnumerable.call(r,t)?"enumerable":"nonenumerable";o==="enumerable"&&(e[t]=n),i&&o==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function u3(e,t={}){if(xS(e))return e.map(i=>u3(i,t));if(!Xoe(e))return e;const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((i,o)=>{if(xS(t.props)&&!t.props.includes(o))return i;const s=e[o],a=u3(s,t);return Joe(i,o,a,e,t.nonenumerable),i},{})}var Yt=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Loe,this.symbolRegistry=new rS(t=>t.description??""),this.customTransformerRegistry=new Moe,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=bS(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});const i=Qoe(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r}deserialize(e){const{json:t,meta:n}=e;let r=u3(t);return n!=null&&n.values&&(r=Uoe(r,n.values,this)),n!=null&&n.referentialEqualities&&(r=Koe(r,n.referentialEqualities)),r}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};Yt.defaultInstance=new Yt,Yt.serialize=Yt.defaultInstance.serialize.bind(Yt.defaultInstance),Yt.deserialize=Yt.defaultInstance.deserialize.bind(Yt.defaultInstance),Yt.stringify=Yt.defaultInstance.stringify.bind(Yt.defaultInstance),Yt.parse=Yt.defaultInstance.parse.bind(Yt.defaultInstance),Yt.registerClass=Yt.defaultInstance.registerClass.bind(Yt.defaultInstance),Yt.registerSymbol=Yt.defaultInstance.registerSymbol.bind(Yt.defaultInstance),Yt.registerCustom=Yt.defaultInstance.registerCustom.bind(Yt.defaultInstance),Yt.allowErrorProps=Yt.defaultInstance.allowErrorProps.bind(Yt.defaultInstance);var ese=Yt.serialize,tse=Yt.stringify;function Zl(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function nse(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function rse({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function Ql({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function ise(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var Bp=(e,t=!1)=>{const{json:n}=ese(e);return JSON.stringify(n,null,t?2:void 0)},qp=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,ose=(e,t)=>e.queryHash.localeCompare(t.queryHash),wS=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,sse=(e,t)=>qp(e)===qp(t)?wS(e,t):qp(e)>qp(t)?1:-1,d3={status:sse,"query hash":ose,"last updated":wS},Vp=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,CS=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,ase=(e,t)=>Vp(e)===Vp(t)?CS(e,t):Vp(e)>Vp(t)?1:-1,f3={status:ase,"last updated":CS},SS=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),lse=()=>{const[e,t]=ze("dark");return ha(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const r=i=>{t(i.matches?"dark":"light")};n.addEventListener("change",r),st(()=>n.removeEventListener("change",r))}),e},ga=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const r=new Map(e);if(t.length===1)return r.set(t[0],n),r;const[i,...o]=t;return r.set(i,ga(r.get(i),o,n)),r}if(e instanceof Set){const r=ga(Array.from(e),t,n);return new Set(r)}if(Array.isArray(e)){const r=[...e];if(t.length===1)return r[t[0]]=n,r;const[i,...o]=t;return r[i]=ga(r[i],o,n),r}if(e instanceof Object){const r={...e};if(t.length===1)return r[t[0]]=n,r;const[i,...o]=t;return r[i]=ga(r[i],o,n),r}return e},bd=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[r,...i]=t;return n.set(r,bd(n.get(r),i)),n}if(e instanceof Set){const n=bd(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((o,s)=>s.toString()!==t[0]);const[r,...i]=t;return n[r]=bd(n[r],i),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[r,...i]=t;return n[r]=bd(n[r],i),n}return e},cse=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const r=document.createElement("style"),i=document.createTextNode("");r.appendChild(i),r.id="_goober",r.setAttribute("nonce",e),t?t.appendChild(r):document.head.appendChild(r)},use=(dL=class{constructor(e){He(this,wc);He(this,Hd);He(this,Bd);He(this,qd);He(this,$a,!1);He(this,Vd);He(this,Cc);He(this,Sc);He(this,Ec);He(this,Ic);He(this,Lc);He(this,Ac);He(this,Gd);const{client:t,queryFlavor:n,version:r,onlineManager:i,buttonPosition:o,position:s,initialIsOpen:a,errorTypes:c,styleNonce:u,shadowDOMTarget:f}=e;Ae(this,wc,ze(t)),Ae(this,Bd,n),Ae(this,qd,r),Ae(this,Hd,i),Ae(this,Vd,u),Ae(this,Cc,f),Ae(this,Sc,ze(o)),Ae(this,Ec,ze(s)),Ae(this,Ic,ze(a)),Ae(this,Lc,ze(c))}setButtonPosition(e){z(this,Sc)[1](e)}setPosition(e){z(this,Ec)[1](e)}setInitialIsOpen(e){z(this,Ic)[1](e)}setErrorTypes(e){z(this,Lc)[1](e)}setClient(e){z(this,wc)[1](e)}mount(e){if(z(this,$a))throw new Error("Devtools is already mounted");const t=moe(()=>{const n=this,[r]=z(this,Sc),[i]=z(this,Ec),[o]=z(this,Ic),[s]=z(this,Lc),[a]=z(this,wc);let c;return z(this,Ac)?c=z(this,Ac):(c=Jie(()=>Promise.resolve().then(()=>Kde)),Ae(this,Ac,c)),cse(z(this,Vd),z(this,Cc)),W(c,wt({get queryFlavor(){return z(n,Bd)},get version(){return z(n,qd)},get onlineManager(){return z(n,Hd)},get shadowDOMTarget(){return z(n,Cc)}},{get client(){return a()},get buttonPosition(){return r()},get position(){return i()},get initialIsOpen(){return o()},get errorTypes(){return s()}}))},e);Ae(this,$a,!0),Ae(this,Gd,t)}unmount(){var e;if(!z(this,$a))throw new Error("Devtools is not mounted");(e=z(this,Gd))==null||e.call(this),Ae(this,$a,!1)}},wc=new WeakMap,Hd=new WeakMap,Bd=new WeakMap,qd=new WeakMap,$a=new WeakMap,Vd=new WeakMap,Cc=new WeakMap,Sc=new WeakMap,Ec=new WeakMap,Ic=new WeakMap,Lc=new WeakMap,Ac=new WeakMap,Gd=new WeakMap,dL);function dse(e){const t=Qa(e.client),n=S.useRef(null),{buttonPosition:r,position:i,initialIsOpen:o,errorTypes:s,styleNonce:a,shadowDOMTarget:c}=e,[u]=S.useState(new use({client:t,queryFlavor:"React Query",version:"5",onlineManager:ru,buttonPosition:r,position:i,initialIsOpen:o,errorTypes:s,styleNonce:a,shadowDOMTarget:c}));return S.useEffect(()=>{u.setClient(t)},[t,u]),S.useEffect(()=>{r&&u.setButtonPosition(r)},[r,u]),S.useEffect(()=>{i&&u.setPosition(i)},[i,u]),S.useEffect(()=>{u.setInitialIsOpen(o||!1)},[o,u]),S.useEffect(()=>{u.setErrorTypes(s||[])},[s,u]),S.useEffect(()=>(n.current&&u.mount(n.current),()=>{u.unmount()}),[u]),d.jsx("div",{className:"tsqd-parent-container",ref:n})}var fse=dse;const pse=Object.freeze(Object.defineProperty({__proto__:null,ReactQueryDevtools:fse},Symbol.toStringTag,{value:"Module"})),ES="[a-fA-F\\d:]",ys=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${ES})|(?<=${ES})(?=\\s|$))`:"",Ti="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",Dn="[a-fA-F\\d]{1,4}",Gp=`
|
|
301
301
|
(?:
|
|
302
302
|
(?:${Dn}:){7}(?:${Dn}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|