@jpmorgan-payments/embedded-finance-components 0.6.25 → 0.6.26

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 ps = Object.defineProperty;
2
2
  var ws = (e, t, n) => t in e ? ps(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 { g as xs, c as M, a as m, b as be, d as K, o as Ot, e as B, P as qo, S as N, t as P, i as E, f as H, h as I, j as $s, k as tr, u as pe, l as G, s as Nn, m as Un, n as rt, p as T, q as Cs, r as kn, v as Ke, w as Ss, x as Dt, y as Tt, z as ks, A as Es, B as mn, F as Ds, C as zr, D as Ft, $ as Ro, E as Ms, G as As, H as j, I as Br, J as Ts, K as nr, L as Fs, M as Is, N as _n, O as Ls, Q as Os, R as te, T as Ps, U as _s } from "./production-CpFO7mL4.js";
4
+ import { g as xs, c as M, a as m, b as be, d as K, o as Ot, e as B, P as qo, S as N, t as P, i as E, f as H, h as I, j as $s, k as tr, u as pe, l as G, s as Nn, m as Un, n as rt, p as T, q as Cs, r as kn, v as Ke, w as Ss, x as Dt, y as Tt, z as ks, A as Es, B as mn, F as Ds, C as zr, D as Ft, $ as Ro, E as Ms, G as As, H as j, I as Br, J as Ts, K as nr, L as Fs, M as Is, N as _n, O as Ls, Q as Os, R as te, T as Ps, U as _s } from "./production-BMUR8ng5.js";
5
5
  var Ko = {
6
6
  À: "A",
7
7
  Á: "A",
@@ -1,4 +1,4 @@
1
- import { E as s, L as i, M as o, a as e, O as r, T as t, i as d } from "../index-Du3C_cSt.js";
1
+ import { E as s, L as i, M as o, a as e, O as r, T as t, i as d } from "../index-ClKA0nw4.js";
2
2
  export {
3
3
  s as EBComponentsProvider,
4
4
  i as LinkedAccountWidget,
@@ -50203,7 +50203,7 @@ const Zh = new Yoe(), pY = _n(void 0), hY = _n({
50203
50203
  }), X_ = B$.NODE_ENV === "development" ? Ite(
50204
50204
  () => import(
50205
50205
  // eslint-disable-next-line import/extensions
50206
- "./production-CpFO7mL4.js"
50206
+ "./production-BMUR8ng5.js"
50207
50207
  ).then((e) => e.V).then((e) => ({
50208
50208
  default: e.ReactQueryDevtools
50209
50209
  }))
@@ -89875,7 +89875,7 @@ const LPe = () => {
89875
89875
  Oo,
89876
89876
  {
89877
89877
  title: "Supporting documents",
89878
- description: "To satisfy regulatory requirements, we need to obtain the following",
89878
+ description: i === "success" && (e == null ? void 0 : e.status) === "INFORMATION_REQUESTED" && o ? "To satisfy regulatory requirements, we need to obtain the following" : void 0,
89879
89879
  children: [
89880
89880
  /* @__PURE__ */ l.jsx("div", { className: "eb-mt-6 eb-flex-auto eb-space-y-6", children: d() }),
89881
89881
  !t && /* @__PURE__ */ l.jsx("div", { className: "eb-mt-6 eb-space-y-6", children: /* @__PURE__ */ l.jsx("div", { className: "eb-flex eb-justify-between eb-gap-4", children: /* @__PURE__ */ l.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-Du3C_cSt.js";
7
+ import { u as jt, o as $t, j as _t } from "./index-ClKA0nw4.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-CZJKIixk.js")), C(this, ee, a)), dr(v(this, ge), v(this, X)), nn(a, sn({
1856
+ return v(this, ee) ? a = v(this, ee) : (a = ln(() => import("./2FJCTAHO-4DclqVTW.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
  },
@@ -7778,7 +7778,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7778
7778
  .block-interactivity-`.concat(e,` {pointer-events: none;}
7779
7779
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
7780
7780
  `)},wze=0,h2=[];function kze(e){var t=k.useRef([]),n=k.useRef([0,0]),r=k.useRef(),i=k.useState(wze++)[0],o=k.useState(nie)[0],a=k.useRef(e);k.useEffect(function(){a.current=e},[e]),k.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var g=EO([e.lockRef.current],(e.shards||[]).map(cie),!0).filter(Boolean);return g.forEach(function(v){return v.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=k.useCallback(function(g,v){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var x=_$(g),w=n.current,C="deltaX"in g?g.deltaX:w[0]-x[0],M="deltaY"in g?g.deltaY:w[1]-x[1],S,I=g.target,L=Math.abs(C)>Math.abs(M)?"h":"v";if("touches"in g&&L==="h"&&I.type==="range")return!1;var E=oie(L,I);if(!E)return!0;if(E?S=L:(S=L==="v"?"h":"v",E=oie(L,I)),!E)return!1;if(!r.current&&"changedTouches"in g&&(C||M)&&(r.current=S),!S)return!0;var N=r.current||S;return bze(N,v,g,N==="h"?C:M)},[]),l=k.useCallback(function(g){var v=g;if(!(!h2.length||h2[h2.length-1]!==o)){var x="deltaY"in v?lie(v):_$(v),w=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&vze(S.delta,x)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var C=(a.current.shards||[]).map(cie).filter(Boolean).filter(function(S){return S.contains(v.target)}),M=C.length>0?s(v,C[0]):!a.current.noIsolation;M&&v.cancelable&&v.preventDefault()}}},[]),d=k.useCallback(function(g,v,x,w){var C={name:g,delta:v,target:x,should:w,shadowParent:Cze(x)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(M){return M!==C})},1)},[]),p=k.useCallback(function(g){n.current=_$(g),r.current=void 0},[]),h=k.useCallback(function(g){d(g.type,lie(g),g.target,s(g,e.lockRef.current))},[]),f=k.useCallback(function(g){d(g.type,_$(g),g.target,s(g,e.lockRef.current))},[]);k.useEffect(function(){return h2.push(o),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,p2),document.addEventListener("touchmove",l,p2),document.addEventListener("touchstart",p,p2),function(){h2=h2.filter(function(g){return g!==o}),document.removeEventListener("wheel",l,p2),document.removeEventListener("touchmove",l,p2),document.removeEventListener("touchstart",p,p2)}},[]);var m=e.removeScrollBar,b=e.inert;return k.createElement(k.Fragment,null,b?k.createElement(o,{styles:xze(i)}):null,m?k.createElement(dze,{gapMode:e.gapMode}):null)}function Cze(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Sze=Jje(tie,kze);var uie=k.forwardRef(function(e,t){return k.createElement(j$,En({},e,{ref:t,sideCar:Sze}))});uie.classNames=j$.classNames;var NH=["Enter"," "],Mze=["ArrowDown","PageUp","Home"],die=["ArrowUp","PageDown","End"],Ize=[...Mze,...die],Lze={ltr:[...NH,"ArrowRight"],rtl:[...NH,"ArrowLeft"]},Eze={ltr:["ArrowLeft"],rtl:["ArrowRight"]},sf="Menu",[lf,Aze,Dze]=wOe(sf),[i1,pie]=fH(sf,[Dze,Nre,Wre]),R$=Nre(),hie=Wre(),[Tze,o1]=i1(sf),[Nze,cf]=i1(sf),fie=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:o,modal:a=!0}=e,s=R$(t),[l,d]=k.useState(null),p=k.useRef(!1),h=zs(o),f=COe(i);return k.useEffect(()=>{const m=()=>{p.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>p.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),u.jsx(oje,{...s,children:u.jsx(Tze,{scope:t,open:n,onOpenChange:h,content:l,onContentChange:d,children:u.jsx(Nze,{scope:t,onClose:k.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:p,dir:f,modal:a,children:r})})})};fie.displayName=sf;var Fze="MenuAnchor",FH=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=R$(n);return u.jsx(aje,{...i,...r,ref:t})});FH.displayName=Fze;var $H="MenuPortal",[$ze,mie]=i1($H,{forceMount:void 0}),gie=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,o=o1($H,t);return u.jsx($ze,{scope:t,forceMount:n,children:u.jsx(af,{present:n||o.open,children:u.jsx(Hre,{asChild:!0,container:i,children:r})})})};gie.displayName=$H;var Xi="MenuContent",[Pze,PH]=i1(Xi),yie=k.forwardRef((e,t)=>{const n=mie(Xi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=o1(Xi,e.__scopeMenu),a=cf(Xi,e.__scopeMenu);return u.jsx(lf.Provider,{scope:e.__scopeMenu,children:u.jsx(af,{present:r||o.open,children:u.jsx(lf.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Oze,{...i,ref:t}):u.jsx(jze,{...i,ref:t})})})})}),Oze=k.forwardRef((e,t)=>{const n=o1(Xi,e.__scopeMenu),r=k.useRef(null),i=Ni(t,r);return k.useEffect(()=>{const o=r.current;if(o)return Vje(o)},[]),u.jsx(OH,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:An(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),jze=k.forwardRef((e,t)=>{const n=o1(Xi,e.__scopeMenu);return u.jsx(OH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),zze=D$("MenuContent.ScrollLock"),OH=k.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:m,disableOutsideScroll:b,...g}=e,v=o1(Xi,n),x=cf(Xi,n),w=R$(n),C=hie(n),M=Aze(n),[S,I]=k.useState(null),L=k.useRef(null),E=Ni(t,L,v.onContentChange),N=k.useRef(0),$=k.useRef(""),_=k.useRef(0),T=k.useRef(null),F=k.useRef("right"),z=k.useRef(0),P=b?uie:k.Fragment,O=b?{as:zze,allowPinchZoom:!0}:void 0,H=G=>{var Y,K;const j=$.current+G,U=M().filter(ae=>!ae.disabled),D=document.activeElement,A=(Y=U.find(ae=>ae.ref.current===D))==null?void 0:Y.textValue,R=U.map(ae=>ae.textValue),B=Zze(R,j,A),J=(K=U.find(ae=>ae.textValue===B))==null?void 0:K.ref.current;(function ae(fe){$.current=fe,window.clearTimeout(N.current),fe!==""&&(N.current=window.setTimeout(()=>ae(""),1e3))})(j),J&&setTimeout(()=>J.focus())};k.useEffect(()=>()=>window.clearTimeout(N.current),[]),FOe();const V=k.useCallback(G=>{var U,D;return F.current===((U=T.current)==null?void 0:U.side)&&Qze(G,(D=T.current)==null?void 0:D.area)},[]);return u.jsx(Pze,{scope:n,searchRef:$,onItemEnter:k.useCallback(G=>{V(G)&&G.preventDefault()},[V]),onItemLeave:k.useCallback(G=>{var j;V(G)||((j=L.current)==null||j.focus(),I(null))},[V]),onTriggerLeave:k.useCallback(G=>{V(G)&&G.preventDefault()},[V]),pointerGraceTimerRef:_,onPointerGraceIntentChange:k.useCallback(G=>{T.current=G},[]),children:u.jsx(P,{...O,children:u.jsx(Sre,{asChild:!0,trapped:i,onMountAutoFocus:An(o,G=>{var j;G.preventDefault(),(j=L.current)==null||j.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(vre,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:m,children:u.jsx(_je,{asChild:!0,...C,dir:x.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:I,onEntryFocus:An(l,G=>{x.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(sje,{role:"menu","aria-orientation":"vertical","data-state":$ie(v.open),"data-radix-menu-content":"",dir:x.dir,...w,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:An(g.onKeyDown,G=>{const U=G.target.closest("[data-radix-menu-content]")===G.currentTarget,D=G.ctrlKey||G.altKey||G.metaKey,A=G.key.length===1;U&&(G.key==="Tab"&&G.preventDefault(),!D&&A&&H(G.key));const R=L.current;if(G.target!==R||!Ize.includes(G.key))return;G.preventDefault();const J=M().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);die.includes(G.key)&&J.reverse(),Kze(J)}),onBlur:An(e.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(N.current),$.current="")}),onPointerMove:An(e.onPointerMove,df(G=>{const j=G.target,U=z.current!==G.clientX;if(G.currentTarget.contains(j)&&U){const D=G.clientX>z.current?"right":"left";F.current=D,z.current=G.clientX}}))})})})})})})});yie.displayName=Xi;var _ze="MenuGroup",jH=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Lo.div,{role:"group",...r,ref:t})});jH.displayName=_ze;var Rze="MenuLabel",bie=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Lo.div,{...r,ref:t})});bie.displayName=Rze;var H$="MenuItem",vie="menu.itemSelect",q$=k.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,o=k.useRef(null),a=cf(H$,e.__scopeMenu),s=PH(H$,e.__scopeMenu),l=Ni(t,o),d=k.useRef(!1),p=()=>{const h=o.current;if(!n&&h){const f=new CustomEvent(vie,{bubbles:!0,cancelable:!0});h.addEventListener(vie,m=>r==null?void 0:r(m),{once:!0}),gre(h,f),f.defaultPrevented?d.current=!1:a.onClose()}};return u.jsx(xie,{...i,ref:l,disabled:n,onClick:An(e.onClick,p),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),d.current=!0},onPointerUp:An(e.onPointerUp,h=>{var f;d.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:An(e.onKeyDown,h=>{const f=s.searchRef.current!=="";n||f&&h.key===" "||NH.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});q$.displayName=H$;var xie=k.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=e,a=PH(H$,n),s=hie(n),l=k.useRef(null),d=Ni(t,l),[p,h]=k.useState(!1),[f,m]=k.useState("");return k.useEffect(()=>{const b=l.current;b&&m((b.textContent??"").trim())},[o.children]),u.jsx(lf.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:u.jsx(Rje,{asChild:!0,...s,focusable:!r,children:u.jsx(Lo.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:An(e.onPointerMove,df(b=>{r?a.onItemLeave(b):(a.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:An(e.onPointerLeave,df(b=>a.onItemLeave(b))),onFocus:An(e.onFocus,()=>h(!0)),onBlur:An(e.onBlur,()=>h(!1))})})})}),Hze="MenuCheckboxItem",wie=k.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return u.jsx(Iie,{scope:e.__scopeMenu,checked:n,children:u.jsx(q$,{role:"menuitemcheckbox","aria-checked":B$(n)?"mixed":n,...i,ref:t,"data-state":_H(n),onSelect:An(i.onSelect,()=>r==null?void 0:r(B$(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wie.displayName=Hze;var kie="MenuRadioGroup",[qze,Bze]=i1(kie,{value:void 0,onValueChange:()=>{}}),Cie=k.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,o=zs(r);return u.jsx(qze,{scope:e.__scopeMenu,value:n,onValueChange:o,children:u.jsx(jH,{...i,ref:t})})});Cie.displayName=kie;var Sie="MenuRadioItem",Mie=k.forwardRef((e,t)=>{const{value:n,...r}=e,i=Bze(Sie,e.__scopeMenu),o=n===i.value;return u.jsx(Iie,{scope:e.__scopeMenu,checked:o,children:u.jsx(q$,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":_H(o),onSelect:An(r.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,n)},{checkForDefaultPrevented:!1})})})});Mie.displayName=Sie;var zH="MenuItemIndicator",[Iie,Vze]=i1(zH,{checked:!1}),Lie=k.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,o=Vze(zH,n);return u.jsx(af,{present:r||B$(o.checked)||o.checked===!0,children:u.jsx(Lo.span,{...i,ref:t,"data-state":_H(o.checked)})})});Lie.displayName=zH;var Uze="MenuSeparator",Eie=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(Lo.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Eie.displayName=Uze;var Gze="MenuArrow",Aie=k.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=R$(n);return u.jsx(lje,{...i,...r,ref:t})});Aie.displayName=Gze;var Wze="MenuSub",[yXe,Die]=i1(Wze),uf="MenuSubTrigger",Tie=k.forwardRef((e,t)=>{const n=o1(uf,e.__scopeMenu),r=cf(uf,e.__scopeMenu),i=Die(uf,e.__scopeMenu),o=PH(uf,e.__scopeMenu),a=k.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,d={__scopeMenu:e.__scopeMenu},p=k.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return k.useEffect(()=>p,[p]),k.useEffect(()=>{const h=s.current;return()=>{window.clearTimeout(h),l(null)}},[s,l]),u.jsx(FH,{asChild:!0,...d,children:u.jsx(xie,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":$ie(n.open),...e,ref:mH(t,i.onTriggerChange),onClick:h=>{var f;(f=e.onClick)==null||f.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:An(e.onPointerMove,df(h=>{o.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:An(e.onPointerLeave,df(h=>{var m,b;p();const f=(m=n.content)==null?void 0:m.getBoundingClientRect();if(f){const g=(b=n.content)==null?void 0:b.dataset.side,v=g==="right",x=v?-5:5,w=f[v?"left":"right"],C=f[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:h.clientX+x,y:h.clientY},{x:w,y:f.top},{x:C,y:f.top},{x:C,y:f.bottom},{x:w,y:f.bottom}],side:g}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(h),h.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:An(e.onKeyDown,h=>{var m;const f=o.searchRef.current!=="";e.disabled||f&&h.key===" "||Lze[r.dir].includes(h.key)&&(n.onOpenChange(!0),(m=n.content)==null||m.focus(),h.preventDefault())})})})});Tie.displayName=uf;var Nie="MenuSubContent",Fie=k.forwardRef((e,t)=>{const n=mie(Xi,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,o=o1(Xi,e.__scopeMenu),a=cf(Xi,e.__scopeMenu),s=Die(Nie,e.__scopeMenu),l=k.useRef(null),d=Ni(t,l);return u.jsx(lf.Provider,{scope:e.__scopeMenu,children:u.jsx(af,{present:r||o.open,children:u.jsx(lf.Slot,{scope:e.__scopeMenu,children:u.jsx(OH,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:d,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var h;a.isUsingKeyboardRef.current&&((h=l.current)==null||h.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:An(e.onFocusOutside,p=>{p.target!==s.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:An(e.onEscapeKeyDown,p=>{a.onClose(),p.preventDefault()}),onKeyDown:An(e.onKeyDown,p=>{var m;const h=p.currentTarget.contains(p.target),f=Eze[a.dir].includes(p.key);h&&f&&(o.onOpenChange(!1),(m=s.trigger)==null||m.focus(),p.preventDefault())})})})})})});Fie.displayName=Nie;function $ie(e){return e?"open":"closed"}function B$(e){return e==="indeterminate"}function _H(e){return B$(e)?"indeterminate":e?"checked":"unchecked"}function Kze(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Yze(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Zze(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=Yze(e,Math.max(o,0));i.length===1&&(a=a.filter(d=>d!==n));const l=a.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Xze(e,t){const{x:n,y:r}=e;let i=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const s=t[o].x,l=t[o].y,d=t[a].x,p=t[a].y;l>r!=p>r&&n<(d-s)*(r-l)/(p-l)+s&&(i=!i)}return i}function Qze(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Xze(n,t)}function df(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Jze=fie,e_e=FH,t_e=gie,n_e=yie,r_e=jH,i_e=bie,o_e=q$,a_e=wie,s_e=Cie,l_e=Mie,c_e=Lie,u_e=Eie,d_e=Aie,p_e=Tie,h_e=Fie,f_e=globalThis!=null&&globalThis.document?k.useLayoutEffect:()=>{},m_e=k[" useId ".trim().toString()]||(()=>{}),g_e=0;function Pie(e){const[t,n]=k.useState(m_e());return f_e(()=>{n(r=>r??String(g_e++))},[e]),e||(t?`radix-${t}`:"")}var RH="DropdownMenu",[y_e,bXe]=rOe(RH,[pie]),Qr=pie(),[b_e,Oie]=y_e(RH),jie=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:a,modal:s=!0}=e,l=Qr(t),d=k.useRef(null),[p=!1,h]=oOe({prop:i,defaultProp:o,onChange:a});return u.jsx(b_e,{scope:t,triggerId:Pie(),triggerRef:d,contentId:Pie(),open:p,onOpenChange:h,onOpenToggle:k.useCallback(()=>h(f=>!f),[h]),modal:s,children:u.jsx(Jze,{...l,open:p,onOpenChange:h,dir:r,modal:s,children:n})})};jie.displayName=RH;var zie="DropdownMenuTrigger",_ie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=Oie(zie,n),a=Qr(n);return u.jsx(e_e,{asChild:!0,...a,children:u.jsx(fOe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:hre(t,o.triggerRef),onPointerDown:A$(e.onPointerDown,s=>{!r&&s.button===0&&s.ctrlKey===!1&&(o.onOpenToggle(),o.open||s.preventDefault())}),onKeyDown:A$(e.onKeyDown,s=>{r||(["Enter"," "].includes(s.key)&&o.onOpenToggle(),s.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});_ie.displayName=zie;var v_e="DropdownMenuPortal",Rie=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Qr(t);return u.jsx(t_e,{...r,...n})};Rie.displayName=v_e;var Hie="DropdownMenuContent",qie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Oie(Hie,n),o=Qr(n),a=k.useRef(!1);return u.jsx(n_e,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:t,onCloseAutoFocus:A$(e.onCloseAutoFocus,s=>{var l;a.current||(l=i.triggerRef.current)==null||l.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:A$(e.onInteractOutside,s=>{const l=s.detail.originalEvent,d=l.button===0&&l.ctrlKey===!0,p=l.button===2||d;(!i.modal||p)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});qie.displayName=Hie;var x_e="DropdownMenuGroup",w_e=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(r_e,{...i,...r,ref:t})});w_e.displayName=x_e;var k_e="DropdownMenuLabel",Bie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(i_e,{...i,...r,ref:t})});Bie.displayName=k_e;var C_e="DropdownMenuItem",Vie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(o_e,{...i,...r,ref:t})});Vie.displayName=C_e;var S_e="DropdownMenuCheckboxItem",Uie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(a_e,{...i,...r,ref:t})});Uie.displayName=S_e;var M_e="DropdownMenuRadioGroup",I_e=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(s_e,{...i,...r,ref:t})});I_e.displayName=M_e;var L_e="DropdownMenuRadioItem",Gie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(l_e,{...i,...r,ref:t})});Gie.displayName=L_e;var E_e="DropdownMenuItemIndicator",Wie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(c_e,{...i,...r,ref:t})});Wie.displayName=E_e;var A_e="DropdownMenuSeparator",Kie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(u_e,{...i,...r,ref:t})});Kie.displayName=A_e;var D_e="DropdownMenuArrow",T_e=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(d_e,{...i,...r,ref:t})});T_e.displayName=D_e;var N_e="DropdownMenuSubTrigger",Yie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(p_e,{...i,...r,ref:t})});Yie.displayName=N_e;var F_e="DropdownMenuSubContent",Zie=k.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Qr(n);return u.jsx(h_e,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Zie.displayName=F_e;var $_e=jie,P_e=_ie,O_e=Rie,Xie=qie,Qie=Bie,Jie=Vie,eoe=Uie,toe=Gie,noe=Wie,roe=Kie,ioe=Yie,ooe=Zie;const aoe=$_e,soe=P_e,j_e=k.forwardRef(({className:e,inset:t,children:n,...r},i)=>u.jsxs(ioe,{ref:i,className:ye("eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-gap-2 eb-rounded-sm eb-px-2 eb-py-1.5 eb-text-sm eb-outline-none focus:eb-bg-accent data-[state=open]:eb-bg-accent [&_svg]:eb-pointer-events-none [&_svg]:eb-size-4 [&_svg]:eb-shrink-0",t&&"eb-pl-8",e),...r,children:[n,u.jsx(wa,{className:"eb-ml-auto"})]}));j_e.displayName=ioe.displayName;const z_e=k.forwardRef(({className:e,...t},n)=>u.jsx(ooe,{ref:n,className:ye("eb-z-50 eb-min-w-[8rem] eb-origin-[--radix-dropdown-menu-content-transform-origin] eb-overflow-hidden eb-rounded-md eb-border eb-bg-popover eb-p-1 eb-text-popover-foreground eb-shadow-lg data-[state=open]:eb-animate-in data-[state=closed]:eb-animate-out data-[state=closed]:eb-fade-out-0 data-[state=open]:eb-fade-in-0 data-[state=closed]:eb-zoom-out-95 data-[state=open]:eb-zoom-in-95 data-[side=bottom]:eb-slide-in-from-top-2 data-[side=left]:eb-slide-in-from-right-2 data-[side=right]:eb-slide-in-from-left-2 data-[side=top]:eb-slide-in-from-bottom-2",e),...t}));z_e.displayName=ooe.displayName;const HH=k.forwardRef(({className:e,sideOffset:t=4,...n},r)=>u.jsx(O_e,{children:u.jsx(Xie,{ref:r,sideOffset:t,className:ye("eb-z-50 eb-max-h-[var(--radix-dropdown-menu-content-available-height)] eb-min-w-[8rem] eb-overflow-y-auto eb-overflow-x-hidden eb-rounded-md eb-border eb-bg-popover eb-p-1 eb-text-popover-foreground eb-shadow-md","eb-origin-[--radix-dropdown-menu-content-transform-origin] data-[state=open]:eb-animate-in data-[state=closed]:eb-animate-out data-[state=closed]:eb-fade-out-0 data-[state=open]:eb-fade-in-0 data-[state=closed]:eb-zoom-out-95 data-[state=open]:eb-zoom-in-95 data-[side=bottom]:eb-slide-in-from-top-2 data-[side=left]:eb-slide-in-from-right-2 data-[side=right]:eb-slide-in-from-left-2 data-[side=top]:eb-slide-in-from-bottom-2",e),...n})}));HH.displayName=Xie.displayName;const qH=k.forwardRef(({className:e,inset:t,...n},r)=>u.jsx(Jie,{ref:r,className:ye("eb-relative eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-gap-2 eb-rounded-sm eb-px-2 eb-py-1.5 eb-text-sm eb-outline-none eb-transition-colors focus:eb-bg-accent focus:eb-text-accent-foreground data-[disabled]:eb-pointer-events-none data-[disabled]:eb-opacity-50 [&>svg]:eb-size-4 [&>svg]:eb-shrink-0",t&&"eb-pl-8",e),...n}));qH.displayName=Jie.displayName;const __e=k.forwardRef(({className:e,children:t,checked:n,...r},i)=>u.jsxs(eoe,{ref:i,className:ye("eb-relative eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-rounded-sm eb-py-1.5 eb-pl-8 eb-pr-2 eb-text-sm eb-outline-none eb-transition-colors focus:eb-bg-accent focus:eb-text-accent-foreground data-[disabled]:eb-pointer-events-none data-[disabled]:eb-opacity-50",e),checked:n,...r,children:[u.jsx("span",{className:"eb-absolute eb-left-2 eb-flex eb-h-3.5 eb-w-3.5 eb-items-center eb-justify-center",children:u.jsx(noe,{children:u.jsx(Lr,{className:"eb-h-4 eb-w-4"})})}),t]}));__e.displayName=eoe.displayName;const R_e=k.forwardRef(({className:e,children:t,...n},r)=>u.jsxs(toe,{ref:r,className:ye("eb-relative eb-flex eb-cursor-pointer eb-select-none eb-items-center eb-rounded-sm eb-py-1.5 eb-pl-8 eb-pr-2 eb-text-sm eb-outline-none eb-transition-colors focus:eb-bg-accent focus:eb-text-accent-foreground data-[disabled]:eb-pointer-events-none data-[disabled]:eb-opacity-50",e),...n,children:[u.jsx("span",{className:"eb-absolute eb-left-2 eb-flex eb-h-3.5 eb-w-3.5 eb-items-center eb-justify-center",children:u.jsx(noe,{children:u.jsx(sc,{className:"eb-h-2 eb-w-2 eb-fill-current"})})}),t]}));R_e.displayName=toe.displayName;const H_e=k.forwardRef(({className:e,inset:t,...n},r)=>u.jsx(Qie,{ref:r,className:ye("eb-px-2 eb-py-1.5 eb-text-sm eb-font-semibold",t&&"eb-pl-8",e),...n}));H_e.displayName=Qie.displayName;const q_e=k.forwardRef(({className:e,...t},n)=>u.jsx(roe,{ref:n,className:ye("eb--mx-1 eb-my-1 eb-h-px eb-bg-muted",e),...t}));q_e.displayName=roe.displayName;const B_e=new Date().getFullYear(),V_e=/^[a-zA-Z0-9()_/&+%@#;,.: -?]*$/,U_e=/[()_/&+%@#;,.: -?]/,G_e=ne.object({description:ne.string().max(100,ee.t("onboarding:fields.organizationIds.description.validation.maxLength")).optional(),idType:ne.enum(["EIN","BUSINESS_REGISTRATION_ID","BUSINESS_NUMBER","BUSINESS_REGISTRATION_NUMBER"]),value:ne.string().min(1,ee.t("onboarding:fields.organizationIds.value.validation.required")).max(100,ee.t("onboarding:fields.organizationIds.value.validation.maxLength")).regex(/^[A-Za-z0-9-]+$/,ee.t("onboarding:fields.organizationIds.value.validation.format")),issuer:ne.string().min(1,ee.t("onboarding:fields.organizationIds.issuer.validation.required")).max(500,ee.t("onboarding:fields.organizationIds.issuer.validation.maxLength")),expiryDate:ne.string().refine(e=>/^\d{4}-\d{2}-\d{2}$/.test(e),{message:ee.t("onboarding:fields.organizationIds.expiryDate.validation.format")}).refine(e=>!Number.isNaN(new Date(e).getTime()),{message:ee.t("onboarding:fields.organizationIds.expiryDate.validation.invalid")}).refine(e=>new Date(e)>new Date,{message:ee.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:ee.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:ee.t(`onboarding:fields.organizationIds.value.validation.${e.idType.toLowerCase()}Format`),path:["value"]})),W_e=ne.object({countryOfFormation:ne.string().length(2,ee.t("onboarding:fields.countryOfFormation.validation.exactlyTwoChars")).refine(e=>xr.includes(e),ee.t("onboarding:fields.countryOfFormation.validation.invalidCountry")),organizationName:ne.string().min(2,ee.t("onboarding:fields.organizationName.validation.minLength")).max(100,ee.t("onboarding:fields.organizationName.validation.maxLength")).regex(V_e,ee.t("onboarding:fields.organizationName.validation.pattern")).refine(e=>!/\s\s/.test(e),ee.t("onboarding:fields.organizationName.validation.noConsecutiveSpaces")).refine(e=>!U_e.test(e.charAt(0)),ee.t("onboarding:fields.organizationName.validation.noSpecialAtStart")),yearOfFormation:ne.string().regex(/^(19|20)\d{2}$/,ee.t("onboarding:fields.yearOfFormation.validation.format")).refine(e=>parseInt(e,10)>=1800,ee.t("onboarding:fields.yearOfFormation.validation.min")).refine(e=>parseInt(e,10)<=B_e,ee.t("onboarding:fields.yearOfFormation.validation.max")),organizationIds:ne.array(G_e).max(6,ee.t("onboarding:fields.organizationIds.validation.maxIds")).refine(e=>{const t=e.map(n=>n.idType);return new Set(t).size===t.length},ee.t("onboarding:fields.organizationIds.validation.uniqueTypes"))}),loe=()=>{const{t:e}=Qt(["onboarding-overview","onboarding"]),t=ii(),n=a=>{switch(a){case"EIN":return"## - #######";default:return}},r=a=>e(a?[`idValueLabels.${a}`,`onboarding:idValueLabels.${a}`]:"onboarding:idValueLabels.placeholder"),i=a=>a?e([`idValueDescriptions.${a}`]):"",o=t.watch("organizationIds.0.idType");return c.useEffect(()=>{t.watch("organizationIds.0.issuer")!=="US"&&t.setValue("organizationIds.0.issuer","US")},[t.watch("organizationIds.0.issuer")]),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Ce,{control:t.control,name:"organizationName",type:"text"}),u.jsx(Ce,{control:t.control,name:"yearOfFormation",type:"text",inputProps:{maxLength:4}}),u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"countryOfFormation",type:"combobox",options:xr.map(a=>({value:a,label:u.jsxs("span",{children:[u.jsxs("span",{className:"eb-font-medium",children:["[",a,"]"]})," ",e([`common:countries.${a}`])]})}))}),u.jsxs(rn,{variant:"informative",density:"sm",noTitle:!0,children:[u.jsx(gr,{className:"eb-size-4"}),u.jsx(on,{children:"If your business is outside of the United States, please contact Platform operator."})]})]}),t.watch("countryOfFormation")==="US"&&u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"organizationIds.0.value",type:"text",label:r(o),description:i(o),maskFormat:n(o),maskChar:"_"},o),u.jsxs(aoe,{children:[u.jsx(soe,{asChild:!0,children:u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"",children:["Use a different ID type",u.jsx(ao,{})]})}),u.jsx(HH,{className:"eb-component",children:["EIN","BUSINESS_REGISTRATION_ID","BUSINESS_REGISTRATION_NUMBER"].map(a=>u.jsx(qH,{disabled:t.watch("organizationIds.0.idType")===a,onClick:()=>{t.setValue("organizationIds.0.idType",a),t.setValue("organizationIds.0.value","")},children:u.jsx("div",{className:"eb-flex eb-items-center eb-gap-2",children:r(a)})},a))})]})]})]})};loe.schema=W_e;const K_e=/^[a-zA-Z0-9()_/&+%@#;,.: -?]*$/,Y_e=ne.object({dbaName:ne.string().max(100,ee.t("onboarding:fields.dbaName.validation.maxLength")).regex(K_e,ee.t("onboarding:fields.dbaName.validation.pattern")).refine(e=>!e||!/\s\s/.test(e),ee.t("onboarding:fields.dbaName.validation.noConsecutiveSpaces")).refine(e=>!e||e.length>=2,ee.t("onboarding:fields.dbaName.validation.minLength")),dbaNameNotAvailable:ne.boolean(),organizationDescription:ne.string().min(10).max(500).transform(Kne),website:ne.string().regex(/^https?:\/\//,ee.t("onboarding:fields.website.validation.httpsRequired")).url(ee.t("onboarding:fields.website.validation.invalid")).max(500,ee.t("onboarding:fields.website.validation.maxLength")).refine(e=>!e||!/^https?:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.test(e),ee.t("onboarding:fields.website.validation.noIp")),websiteNotAvailable:ne.boolean()}),Z_e=e=>e.superRefine((t,n)=>{t.websiteNotAvailable===!1&&!t.website&&n.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.website.validation.required"),path:["website"]}),t.dbaNameNotAvailable===!1&&!t.dbaName&&n.addIssue({code:ne.ZodIssueCode.custom,message:"Required",path:["dbaName"]})}),V$=({currentPartyData:e})=>{var n;const t=ii();return c.useEffect(()=>{const r=t.watch((i,{name:o})=>{o==="dbaNameNotAvailable"&&i.dbaNameNotAvailable&&t.clearErrors("dbaName")});return()=>r.unsubscribe()},[t,e]),c.useEffect(()=>{const r=t.watch((i,{name:o})=>{o==="websiteNotAvailable"&&i.websiteNotAvailable&&t.clearErrors("website")});return()=>r.unsubscribe()},[t]),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"dbaName",type:"text",valueOverride:t.watch("dbaNameNotAvailable")?((n=e==null?void 0:e.organizationDetails)==null?void 0:n.organizationName)??"":void 0,disabled:t.watch("dbaNameNotAvailable"),required:!0}),u.jsx(Ce,{control:t.control,name:"dbaNameNotAvailable",type:"checkbox-basic",label:"Same as legal name of the company",noOptionalLabel:!0})]}),u.jsx("div",{children:u.jsx(Ce,{control:t.control,name:"organizationDescription",type:"textarea",popoutTooltip:!0,tooltip:u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Description example"}),u.jsx("p",{className:"eb-text-sm",children:"{Business name} creates sustainable and affordable beauty and hair care products that are vegan and cruelty free. Our top selling products are our organic citrus shampoo and conditioner line as well as our paraben and sulfate free mascara."}),u.jsx("p",{className:"eb-pb-1 eb-text-sm",children:"Please ensure this aligns with the business classification you have selected."}),u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Will my customers see this?"}),u.jsx("p",{className:"eb-pb-1 eb-text-sm",children:"No. This is used for compliance and regulatory purposes only."})]})})}),u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"website",type:"text",valueOverride:t.watch("websiteNotAvailable")?"N/A":void 0,disabled:t.watch("websiteNotAvailable"),required:!0}),u.jsx(Ce,{control:t.control,name:"websiteNotAvailable",type:"checkbox-basic",label:"My business doesn't have a website",noOptionalLabel:!0})]})]})};V$.schema=Y_e,V$.refineSchemaFn=Z_e,V$.modifyFormValuesBeforeSubmit=e=>{const{dbaName:t,website:n,dbaNameNotAvailable:r,websiteNotAvailable:i,...o}=e;return{...o,...r?{}:{dbaName:t},...i?{}:{website:n},websiteNotAvailable:i}};const X_e=ne.object({industry:ne.string().min(1,ee.t("onboarding:fields.industry.validation.required"))}),coe=()=>{const e=ii();return u.jsxs("div",{className:"eb-mt-1 eb-space-y-6",children:[u.jsxs(rn,{variant:"informative",density:"sm",noTitle:!0,className:"eb-mt-8",children:[u.jsx(gr,{className:"eb-size-4"}),u.jsx(on,{children:"This is used for regulatory and compliance purposes, so please ensure your selection is accurate."})]}),u.jsx(Ce,{control:e.control,name:"industry",type:"industrySelect",popoutTooltip:!0,tooltip:u.jsxs("div",{className:"eb-mb-6",children:[u.jsx("h2",{className:"eb-mb-0 eb-font-header eb-text-2xl eb-font-medium",children:"How do I make the right choice?"}),u.jsx("p",{className:"eb-mb-0 eb-mt-1 eb-text-sm",children:"Please select the same classification chosen when your business or organization was registered in North America."}),u.jsx("h3",{className:"eb-mb-0 eb-mt-3 eb-text-sm eb-font-medium",children:"If you are a sole proprietor or your business is registered outside of North America,"}),u.jsx("p",{className:"eb-mb-0 eb-mt-1 eb-text-sm",children:"You may not have previously selected a classification. In this case, please make the best choice based on your primary line of business."})]})})]})};coe.schema=X_e;const Q_e=()=>{const{organizationType:e}=Kr(),{goTo:t}=Io(),{t:n}=Qt(["onboarding-overview","onboarding","common"]);return u.jsxs(js,{subTitle:u.jsxs("div",{className:"eb-flex eb-h-6 eb-items-end eb-space-x-2",children:[u.jsx("p",{children:n(`onboarding:organizationTypes.${e}`)}),u.jsx(_e,{variant:"ghost",className:"eb-h-6 eb-w-6 eb-px-3",onClick:()=>t("gateway"),children:u.jsx(yi,{className:"eb-stroke-primary"})})]}),title:n("screens.checklist.title"),description:n("screens.checklist.description"),children:[u.jsx("div",{className:"eb-mt-1",children:u.jsxs(_e,{variant:"ghost",children:[u.jsx(N1,{})," Download checklist"]})}),u.jsxs("div",{className:"eb-mt-6 eb-max-h-[480px] eb-flex-auto eb-space-y-4 eb-overflow-y-scroll eb-border-y eb-py-2",children:[u.jsxs(dn,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Personal details"}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-font-semibold",children:"We'll need your information as the business's financial controller."}),u.jsxs("ul",{className:"eb-list-disc eb-pl-8",children:[u.jsx("li",{children:"Name and job title"}),u.jsx("li",{children:"Identity document details"}),u.jsx("li",{children:"Address and contact details"})]})]})]}),u.jsxs(dn,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Business details"}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-font-semibold",children:"Collect pertinent business details, typically found on official business registration documents."}),u.jsxs("ul",{className:"eb-list-disc eb-pl-8",children:[u.jsx("li",{children:"Business classification"}),u.jsx("li",{children:"Registration ID details"}),u.jsx("li",{children:"Location and contact details"})]})]})]}),u.jsxs(dn,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Owners and key roles"}),u.jsxs("div",{children:[u.jsx("p",{className:"eb-font-semibold",children:"Collect personal details for key stakeholders in your business."}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-font-semibold",children:"Controllers and beneficial owners"}),u.jsxs("ul",{className:"eb-list-disc eb-pl-8",children:[u.jsx("li",{children:"Name and job title"}),u.jsx("li",{children:"Identity document details"}),u.jsx("li",{children:"Address and contact details"})]})]})]})]}),u.jsxs(dn,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Bank account"}),u.jsx("div",{children:u.jsx("p",{className:"eb-font-semibold",children:"We'll need the details of the bank account you wish to receive payouts."})})]})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{variant:"secondary",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>t("gateway"),children:n("screens.checklist.prevButton")}),u.jsx(_e,{size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>t("overview"),children:n("screens.checklist.nextButton")})]})})]})},J_e={"application/pdf":[".pdf"],"image/jpeg":[".jpeg",".jpg"],"image/png":[".png"]},eRe=5*1024*1024,tRe=e=>e?e.split(`
7781
- `).map((t,n)=>{const r=/^\d+\./.test(t.trim());if(t.includes("[OR]")){let i=t.split("Acceptable documents are");if(i.length===2){const[o,a]=i,s=a.split(/\[AND\]|\[OR\]/g).map(l=>l.trim()).filter(l=>l);return u.jsxs("div",{className:"eb-mb-2",children:[u.jsx("p",{className:`eb-text-sm ${r?"eb-font-medium":""}`,children:o}),u.jsx("p",{className:"eb-ml-4 eb-mt-1 eb-text-sm",children:"Acceptable documents are:"}),u.jsx("ul",{className:"eb-ml-12 eb-mt-1 eb-list-disc eb-text-sm",children:s.map((l,d)=>u.jsx("li",{className:"eb-mb-1",children:l},`doc-${d}`))})]},`section-${n}`)}return i=t.split(/\[OR\]/g).map(o=>o.trim()).filter(o=>o),u.jsxs("div",{className:"eb-mb-2",children:[u.jsx("p",{className:`eb-text-sm ${r?"eb-font-medium":""}`,children:i[0]}),i.length>1&&u.jsx(u.Fragment,{children:u.jsx("ul",{className:"eb-ml-6 eb-list-disc eb-text-sm",children:i.slice(1).map((o,a)=>u.jsx("li",{className:"eb-mb-1",children:o},`part-${a}`))})})]},`section-${n}`)}if(t.includes("[AND]")){const i=t.split("[AND]").map(o=>o.trim()).filter(o=>o);return u.jsx("div",{className:"eb-mb-2",children:i.map((o,a)=>{const s=/^\d+\./.test(o.trim());return u.jsx("p",{className:`eb-text-sm ${s||r&&a===0?"eb-font-medium":""} ${a>0?"eb-mt-2":""}`,children:o},`and-part-${a}`)})},`section-${n}`)}return u.jsx("p",{className:`eb-mb-2 eb-text-sm ${r?"eb-font-medium":""}`,children:t},`section-${n}`)}):null,nRe=({documentRequestId:e,requirementIndex:t,uploadIndex:n,availableDocTypes:r,control:i,isReadOnly:o=!1,isOptional:a=!1})=>{const[s,l]=c.useState(!1),d=()=>{const{userAgent:b}=navigator,{width:g,height:v}=window.screen,x=/Android.*Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(b)||/iPad|Macintosh/i.test(b)&&"ontouchend"in document,w=/Windows NT/i.test(b),C=/Macintosh|MacIntel/i.test(b)&&!("ontouchend"in document),M=/Linux/i.test(b)&&!/Android/i.test(b),S=w||C||M,I="maxTouchPoints"in navigator&&navigator.maxTouchPoints>0&&!S&&(g<=768||v<=1024)&&g<1200;return x||I},p=()=>!!(navigator.mediaDevices&&"getUserMedia"in navigator.mediaDevices&&"enumerateDevices"in navigator.mediaDevices);c.useEffect(()=>{(async()=>{const g=d(),v=p();if(g&&v)try{const w=(await navigator.mediaDevices.enumerateDevices()).some(C=>C.kind==="videoinput");l(w)}catch{l(!0)}})()},[]);const h=n>0?`_${n}`:"",f=`${e}.requirement_${t}_docType${h}`,m=`${e}.requirement_${t}_files${h}`;return u.jsxs("div",{className:"eb-mb-6",children:[u.jsx(jt,{control:i,name:f,render:({field:b})=>u.jsxs(Ct,{className:"eb-mb-4",children:[u.jsxs($t,{asterisk:!a,className:"eb-text-sm eb-font-medium eb-text-gray-700",children:["Select Document Type",a&&u.jsx("span",{className:"eb-ml-2 eb-text-xs eb-font-normal eb-text-gray-500",children:"(Optional)"})]}),u.jsx(it,{children:u.jsxs(Pa,{onValueChange:b.onChange,value:b.value||"",disabled:o,children:[u.jsx(ea,{className:"eb-w-full",children:u.jsx(Oa,{placeholder:"Select a document type"})}),u.jsx(ta,{children:r.map(g=>{var v;return u.jsx(go,{value:g,children:((v=e2[g])==null?void 0:v.label)||g},g)})})]})}),u.jsx(Ht,{className:"eb-text-xs"})]})}),u.jsx(jt,{control:i,name:m,render:({field:{onChange:b,...g}})=>u.jsxs(Ct,{className:"eb-space-y-2",children:[u.jsxs($t,{asterisk:!a,className:"eb-text-sm eb-font-medium eb-text-gray-700",children:["Upload Document",a&&u.jsx("span",{className:"eb-ml-2 eb-text-xs eb-font-normal eb-text-gray-500",children:"(Optional)"})]}),u.jsx(it,{children:u.jsx(rte,{containerClassName:"eb-max-w-full",...g,multiple:!0,accept:J_e,onChange:b,compressionFunc:Ede,compressibleExtensions:[".jpeg",".jpg",".png"],fileMaxSize:eRe,compressionMaxDimension:1e3,showCompressionInfo:!0,enableCameraCapture:s,captureMode:"environment"})}),u.jsx(Ht,{className:"eb-text-xs"})]})})]})},rRe=({documentRequest:e,requirementIndex:t,isActive:n,isPastRequirement:r,satisfiedDocTypes:i,docTypesForRequirement:o,numFieldsToShow:a,control:s,watch:l,resetKey:d})=>{var m;const p=(m=e.requirements)==null?void 0:m[t];if(!p)return null;if(!n&&!r)return u.jsx("div",{className:"eb-rounded-md eb-border eb-border-gray-200 eb-p-3",children:u.jsx("h4",{className:"eb-text-sm eb-font-medium eb-text-gray-700",children:u.jsxs("div",{className:"eb-flex eb-items-center",children:[u.jsx(Oo,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-gray-400"}),u.jsxs("span",{className:"eb-font-medium",children:["Step ",t+1,"."]}),u.jsx("span",{className:"eb-ml-2 eb-text-gray-500",children:"Pending completion of previous steps"})]})})});const h=p.documentTypes.filter(b=>{const g=b,v=Array.from({length:a}).some((x,w)=>{const C=`${e.id}.requirement_${t}_docType${w>0?`_${w}`:""}`;return l(C)===g});return!i.includes(g)||v}),f=o.length>0?o:p.documentTypes.filter(b=>i.includes(b)).map(b=>b);return u.jsxs("div",{className:"eb-rounded-md eb-border eb-border-gray-200 eb-p-4",children:[u.jsx("h4",{className:"eb-mb-3 eb-text-sm eb-font-medium eb-text-gray-700",children:u.jsxs("div",{className:"eb-flex eb-items-center",children:[r?u.jsx(Ri,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-green-600"}):u.jsx(ul,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-amber-600"}),u.jsxs("span",{className:"eb-font-medium",children:["Step ",t+1]}),r?u.jsxs("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:["Completed - Documents provided:",u.jsx("span",{className:"eb-ml-1 eb-inline-flex eb-flex-wrap eb-gap-1",children:f.map(b=>{var g;return u.jsx("span",{className:"eb-inline-flex eb-items-center eb-rounded-full eb-bg-green-100 eb-px-2 eb-py-0.5 eb-text-xs eb-font-medium eb-text-green-800",children:((g=e2[b])==null?void 0:g.label)||b},b)})})]}):a>0?u.jsx("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:p.minRequired===0&&u.jsx("span",{className:"eb-ml-2 eb-inline-flex eb-items-center eb-rounded-full eb-bg-gray-100 eb-px-2 eb-py-0.5 eb-text-xs eb-font-medium eb-text-gray-500",children:"Optional"})}):u.jsx("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:"All required documents provided"})]})}),r||h.length>0&&a>0?u.jsx(u.Fragment,{children:Array.from({length:a}).map((b,g)=>u.jsx(nRe,{documentRequestId:e.id||"",requirementIndex:t,uploadIndex:g,availableDocTypes:h,control:s,isReadOnly:r,isOptional:p.minRequired===0},`${e.id}-${t}-${g}-${d}`))}):u.jsx("div",{className:"eb-rounded-md eb-bg-green-50 eb-p-2 eb-text-sm eb-font-medium eb-text-green-700",children:"All document types for this requirement have been provided. You can proceed to the next step."})]})},iRe=({documentRequest:e,activeRequirements:t,satisfiedDocTypes:n,requirementDocTypes:r,control:i,watch:o,resetKey:a,onReset:s})=>{var l;return!(e!=null&&e.id)||!((l=e.requirements)!=null&&l.length)?null:u.jsxs("div",{children:[e.description&&u.jsx(rn,{variant:"informative",density:"sm",noTitle:!0,children:u.jsx(on,{children:tRe(e.description)})}),u.jsxs(dn,{className:"eb-mt-6 eb-w-full eb-shadow-sm",children:[u.jsx("div",{className:"eb-flex eb-justify-end eb-px-4 eb-pb-0 eb-pt-3",children:u.jsxs(_e,{type:"button",variant:"outline",size:"sm",onClick:s,className:"eb-flex eb-items-center eb-gap-1 eb-text-xs",children:[u.jsx(ou,{className:"eb-h-3 eb-w-3"})," Reset form"]})}),u.jsx("div",{className:"eb-space-y-6 eb-p-4",children:e.requirements.map((d,p)=>{const h=t.includes(p),f=d.documentTypes.filter(x=>n.includes(x)).length,m=Math.max((d.minRequired||1)-f,0),b=f>0&&(f===d.documentTypes.length||m===0),g=r[p]||[];let v;return b?v=Math.max(g.length,d.minRequired||1):v=m+(g.length>0?g.length-1:0),u.jsx(rRe,{documentRequest:e,requirementIndex:p,isActive:h,isPastRequirement:b,satisfiedDocTypes:n,docTypesForRequirement:g,numFieldsToShow:v,control:i,watch:o,resetKey:a},`${e.id}-req-${p}`)})})]})]})},oRe=()=>{var _,T,F,z,P,O,H,V,G,j,U,D,A,R,B,J;const{clientData:e}=Kr(),t=Bi(),{goTo:n,editingPartyIds:r}=Io(),i=r["document-upload-form"],o=wX(),a=xX(),[s,l]=c.useState({}),[d,p]=c.useState([]),[h,f]=c.useState({}),[m,b]=c.useState(0),g=(_=e==null?void 0:e.parties)==null?void 0:_.find(Y=>Y.id===i),v=Array.from(new Set((P=(F=(T=e==null?void 0:e.parties)==null?void 0:T.map(Y=>{var K;return(K=Y==null?void 0:Y.validationResponse)==null?void 0:K.map(ae=>ae==null?void 0:ae.documentRequestIds)}))==null?void 0:F.flat(2))==null?void 0:P.filter(Y=>Y==null?void 0:Y.length).concat((z=e==null?void 0:e.outstanding)==null?void 0:z.documentRequestIds))),x=i?Array.from(new Set((D=(V=(H=(O=e==null?void 0:e.parties)==null?void 0:O.filter(Y=>Y.id===i))==null?void 0:H.map(Y=>{var K;return(K=Y==null?void 0:Y.validationResponse)==null?void 0:K.map(ae=>ae==null?void 0:ae.documentRequestIds)}))==null?void 0:V.flat(2))==null?void 0:D.filter(Y=>Y==null?void 0:Y.length).concat(((j=(G=e==null?void 0:e.parties)==null?void 0:G.find(Y=>Y.id===i))==null?void 0:j.partyType)==="ORGANIZATION"?((U=e==null?void 0:e.outstanding)==null?void 0:U.documentRequestIds)||[]:[]))):v,{data:w,status:C}=Zz({clientId:e==null?void 0:e.id,includeRelatedParty:!0}),M=((A=w==null?void 0:w.documentRequests)==null?void 0:A.filter(Y=>Y.status==="ACTIVE"&&x.includes(Y.id)))||[];c.useEffect(()=>{if(M!=null&&M.length){const Y={};M.forEach(K=>{var ae;K!=null&&K.id&&((ae=K.requirements)!=null&&ae.length)&&(Y[K.id]=[0])}),l(Y)}},[JSON.stringify(M)]);const S=c.useMemo(()=>{const Y={};return M.forEach(K=>{if(!(K!=null&&K.id)||!K.requirements)return;const ae={};K.requirements.forEach((fe,ue)=>{if(Math.max((fe.minRequired||1)-fe.documentTypes.filter(de=>d.includes(de)).length,0)>0){const de=fe.minRequired||1;for(let Z=0;Z<de;Z+=1){const he=Z>0?`_${Z}`:"";ae[`requirement_${ue}_docType${he}`]=ne.string().optional(),ae[`requirement_${ue}_files${he}`]=ne.array(ne.instanceof(File)).optional()}}}),Y[K.id]=ne.object(ae)}),ne.object(Y)},[JSON.stringify(M),JSON.stringify(d)]),I=ki({resolver:yo(S),mode:"onChange"});c.useEffect(()=>{const Y=setTimeout(()=>{I.trigger()},100);return()=>clearTimeout(Y)},[JSON.stringify(s),I]);const L=UO({control:I.control});c.useEffect(()=>{if(!L)return;const Y={},K=[],ae={};Object.entries(L).forEach(([ue,le])=>{Y[ue]=[],ae[ue]={},Object.entries(le).forEach(([de,Z])=>{var he;if(de.includes("_docType")&&Z){const Ae=de.split("_"),pe=parseInt(Ae[1],10),q=`requirement_${pe}_files`,W=de.replace(`requirement_${pe}_docType`,""),re=`${q}${W}`,we=le[re];if(we&&we.length>0){const ve=(he=I.formState.errors)==null?void 0:he[ue],be=!!(ve!=null&&ve[de]),me=!!(ve!=null&&ve[re]);if(!be&&!me){const ke=Z;Y[ue].push({documentType:ke,files:we}),K.includes(ke)||K.push(ke),ae[ue][pe]||(ae[ue][pe]=[]),ae[ue][pe].includes(ke)||ae[ue][pe].push(ke)}}}})}),p(K),f(ae);const fe={...s};M==null||M.forEach(ue=>{if(!(ue!=null&&ue.id))return;const le=ue.id;if(fe[le]||(fe[le]=[0]),ue.requirements){let de=!1;const Z=[];ue.requirements.forEach((he,Ae)=>{var q;(((q=Y[le])==null?void 0:q.filter(W=>he.documentTypes.includes(W.documentType)).length)||0)>=(he.minRequired||1)&&Z.push(Ae)});for(let he=0;he<ue.requirements.length;he+=1)if(!Z.includes(he)&&(he===0||ue.requirements.slice(0,he).every((pe,q)=>Z.includes(q)))){fe[le]=[he],de=!0;break}!de&&ue.requirements.length>0&&(Z.length===ue.requirements.length?fe[le]=[]:fe[le]=[0])}}),l(fe)},[L,JSON.stringify(M),I.formState.errors]);const E=I.handleSubmit(async()=>{I.clearErrors();const Y=I.getValues();try{const K=[];for(const[ae,fe]of Object.entries(Y)){K.push(ae);const ue=[];Object.entries(fe).forEach(([le,de])=>{if(le.includes("_docType")&&de){const Z=le.split("_"),he=parseInt(Z[1],10),Ae=`requirement_${he}_files`,pe=le.replace(`requirement_${he}_docType`,""),q=`${Ae}${pe}`,W=fe[q];W&&W.length>0&&W.forEach(re=>{ue.push({documentType:de,file:re})})}});for(const{documentType:le,file:de}of ue){const Z={documentRequestId:ae,documentType:le};await o.mutateAsync({data:{documentData:JSON.stringify(Z),file:de}})}}if(K.length>0)for(const ae of K)await a.mutateAsync({id:ae});t.invalidateQueries(),n("upload-documents-section")}catch(K){console.error("Error uploading documents:",K)}}),N=()=>{I.reset({}),p([]),f({});const Y={};M.forEach(K=>{K!=null&&K.id&&(Y[K.id]=[0])}),l(Y),o.reset(),a.reset(),b(K=>K+1)},$=c.useMemo(()=>{if(!(M!=null&&M.length))return!1;const Y=(ae,fe)=>{var he,Ae;if(!(ae!=null&&ae.id)||!ae.requirements)return!1;if((he=s[ae.id])==null?void 0:he.includes(fe)){const pe=(Ae=I.formState.errors)==null?void 0:Ae[ae.id];return pe&&Object.keys(pe).some(W=>W.includes(`requirement_${fe}_`)),!1}const le=ae.requirements[fe];if(!le)return!1;if(le.minRequired===0)return!0;const de=le.documentTypes.filter(pe=>d.includes(pe)).length;return de>0&&(de===le.documentTypes.length||de>=(le.minRequired||1))};return M.every(ae=>{var ue;return!(ae!=null&&ae.id)||!((ue=ae.requirements)!=null&&ue.length)?!0:ae.requirements.every((le,de)=>{var re,we;const Z=le.documentTypes.filter(ve=>d.includes(ve)).length,he=ae.id&&((re=s[ae.id])==null?void 0:re.includes(de)),Ae=Y(ae,de),pe=ae.id?(we=I.formState.errors)==null?void 0:we[ae.id]:void 0,q=pe?Object.keys(pe).some(ve=>ve.includes(`requirement_${de}_`)):!1;return le.minRequired===0?!0:Z>=(le.minRequired??1)&&!q&&(Ae||!he)})})},[JSON.stringify(M),JSON.stringify(s),d,I.formState.errors]);return C==="pending"?u.jsx(Ts,{message:"Fetching document requests..."}):u.jsx(ur,{...I,children:u.jsx("form",{onSubmit:E,className:"eb-flex eb-min-h-full eb-flex-col",children:u.jsxs(js,{title:rf(g),children:[u.jsxs("div",{className:"eb-flex-auto eb-space-y-6",children:[u.jsxs("div",{className:"eb-mb-6 eb-mt-1",children:[((R=g==null?void 0:g.roles)==null?void 0:R.includes("CLIENT"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Business"}),((B=g==null?void 0:g.roles)==null?void 0:B.includes("BENEFICIAL_OWNER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Owner"}),((J=g==null?void 0:g.roles)==null?void 0:J.includes("CONTROLLER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Controller"})]}),u.jsx("div",{className:"eb-space-y-4",children:M==null?void 0:M.map(Y=>u.jsx(iRe,{documentRequest:Y,activeRequirements:s[Y.id||""]||[0],satisfiedDocTypes:d,requirementDocTypes:h[Y.id||""]||{},control:I.control,watch:I.watch,resetKey:m,onReset:N},Y.id))})]}),u.jsxs("div",{className:"eb-mt-6 eb-flex eb-flex-col eb-gap-3",children:[u.jsx(Gr,{error:o.error||a.error,customErrorMessage:o.error?"There was an unexpected error uploading documents. Please try again.":a.error?"There was an unexpected error submitting document requests. Please try again.":void 0}),u.jsx(_e,{type:"submit",disabled:I.formState.isSubmitting||!$,children:I.formState.isSubmitting?"Uploading...":$?"Upload Documents":"Complete All Required Documents"}),u.jsx(_e,{variant:"ghost",onClick:()=>n("upload-documents-section"),className:"eb-text-primary hover:eb-bg-primary/5 hover:eb-text-primary",children:"Cancel"})]})]})})})},aRe=({party:e,docRequestStatus:t,onUploadClick:n})=>{var r,i,o;return u.jsxs(dn,{className:"eb-space-y-6 eb-rounded-lg eb-border eb-p-6 eb-shadow",children:[u.jsxs("div",{className:"eb-space-y-1.5",children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[u.jsx("h3",{className:"eb-font-header eb-text-lg eb-font-medium",children:rf(e)}),t==="ACTIVE"&&u.jsxs("span",{children:[u.jsx(Oo,{className:"eb-size-5 eb-text-muted-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Pending"})]}),t==="CLOSED"&&u.jsxs("span",{children:[u.jsx(so,{className:"eb-size-5 eb-stroke-green-700"}),u.jsx("span",{className:"eb-sr-only",children:"Completed"})]}),t==="EXPIRED"&&u.jsxs("span",{children:[u.jsx(Fn,{className:"eb-size-5 eb-stroke-[#C75300]"}),u.jsx("span",{className:"eb-sr-only",children:"Expired"})]})]}),u.jsxs("div",{className:"eb-flex eb-gap-2",children:[((r=e.roles)==null?void 0:r.includes("CLIENT"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Business"}),((i=e.roles)==null?void 0:i.includes("BENEFICIAL_OWNER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Owner"}),((o=e.roles)==null?void 0:o.includes("CONTROLLER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Controller"})]})]}),u.jsx("div",{children:t==="ACTIVE"?u.jsxs(_e,{variant:"outline",className:"eb-w-full eb-border-primary eb-text-primary",onClick:()=>n(e),children:[u.jsx(Ca,{})," Upload documents"]}):u.jsxs("div",{className:"eb-inline-flex eb-items-center eb-justify-center eb-gap-2 eb-text-xs eb-text-green-700",children:[u.jsx(Lr,{className:"eb-size-4"}),"Required documents successfully uploaded"]})})]})},uoe=({title:e,documentRequests:t,clientData:n,onPartySelect:r})=>n!=null&&n.parties?u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:e}),t.length>0?t.map(i=>{var a,s;const o=i.partyId?(a=n.parties)==null?void 0:a.find(l=>l.id===i.partyId):(s=n.parties)==null?void 0:s.find(l=>{var d;return(d=l.roles)==null?void 0:d.includes("CLIENT")});return o?u.jsx(aRe,{party:o,docRequestStatus:i.status,onUploadClick:r},o.id):null}):u.jsx(dn,{className:"eb-space-y-6 eb-rounded-lg eb-border eb-p-6 eb-shadow",children:u.jsx("p",{className:"eb-flex eb-items-center eb-justify-center eb-text-sm eb-font-medium",children:"No documents required"})})]}):null,sRe=(e,t)=>{var o;if(!(e!=null&&e.length)||!(t!=null&&t.parties))return{businessDocumentRequests:[],individualDocumentRequests:[]};const n=(o=t.parties.find(a=>{var s;return(s=a.roles)==null?void 0:s.includes("CLIENT")}))==null?void 0:o.id,r=e.filter(a=>!a.partyId&&a.clientId===t.id||a.partyId&&a.partyId===n),i=e.filter(a=>a.partyId&&a.partyId!==n);return{businessDocumentRequests:r,individualDocumentRequests:i}},lRe=({clientStatus:e,documentRequestStatus:t,hasDocumentRequests:n})=>{if(e==="REVIEW_IN_PROGRESS")return u.jsxs(rn,{variant:"informative",children:[u.jsx(gr,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"Review in progress"}),u.jsx(on,{children:"Your onboarding is currently under review. Please check back later."})]});if(e==="APPROVED")return u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(Lr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Your onboarding has been approved. No documents are required."})]});if(!e)return u.jsxs(rn,{variant:"destructive",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There was a problem"}),u.jsx(on,{children:"Unable to load client data. Please try again later."})]});if(t!=="pending"){if(t==="error")return u.jsxs(rn,{variant:"destructive",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There was a problem"}),u.jsx(on,{children:"Unable to load document requests. Please try again later."})]});if(!n)return u.jsxs(rn,{variant:"warning",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There is a problem"}),u.jsx(on,{children:"No document requests found."})]})}},cRe=()=>{const{clientData:e,docUploadOnlyMode:t}=Kr(),{goTo:n}=Io(),{data:r,status:i}=Zz({clientId:e==null?void 0:e.id,includeRelatedParty:!0}),o=r==null?void 0:r.documentRequests,a=!!(o!=null&&o.length),s=d=>{n("document-upload-form",{editingPartyId:d.id})},l=()=>{if(i==="pending")return u.jsx(Ts,{message:"Loading document requests"});const d=lRe({clientStatus:e==null?void 0:e.status,documentRequestStatus:i,hasDocumentRequests:a}),p=d!==null?d:null;if(p)return p;const{businessDocumentRequests:h,individualDocumentRequests:f}=sRe(o,e);return u.jsxs("div",{className:"eb-space-y-6",children:[u.jsx(uoe,{title:"For the business",documentRequests:h,clientData:e,onPartySelect:s}),u.jsx(uoe,{title:"For owners and key roles",documentRequests:f,clientData:e,onPartySelect:s})]})};return u.jsxs(js,{title:"Supporting documents",description:"To satisfy regulatory requirements, we need to obtain the following",children:[u.jsx("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:l()}),!t&&u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsx("div",{className:"eb-flex eb-justify-between eb-gap-4",children:u.jsx(_e,{type:"button",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>n("overview"),children:"Return to overview"})})})]})},doe=ne.object({organizationTypeHierarchy:ne.object({generalOrganizationType:ne.union([ne.enum(["SOLE_PROPRIETORSHIP","REGISTERED_BUSINESS","OTHER"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")}),specificOrganizationType:ne.union([ne.enum(["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP","NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","SOLE_PROPRIETORSHIP","UNINCORPORATED_ASSOCIATION","PUBLICLY_TRADED_COMPANY"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")})})}),BH={SOLE_PROPRIETORSHIP:["SOLE_PROPRIETORSHIP"],REGISTERED_BUSINESS:["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP"],OTHER:["NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","UNINCORPORATED_ASSOCIATION"]},uRe=()=>{var P;const e=Bi(),{clientData:t,setClientId:n,onPostClientSettled:r,onPostPartySettled:i,availableOrganizationTypes:o}=Kr(),{goTo:a,sessionData:s,updateSessionData:l}=Io(),{t:d}=Qt(["onboarding-overview","onboarding","common"]),p=OJ({clientData:t,schema:doe,defaultValues:{}}),h=(P=t==null?void 0:t.parties)==null?void 0:P.find(O=>O.partyType==="ORGANIZATION"),[f,m]=c.useState(!1),b=()=>{a("overview")};c.useEffect(()=>{if(t&&h&&!f){const O=Ah(t,h.id);p.reset($s(O,doe)),m(!0)}},[t,h,f,p]);const{mutate:g,error:v,status:x}=bX(),{mutate:w,error:C,status:M}=ra(),{mutate:S,error:I,status:L}=ia(),E=p.handleSubmit(O=>{var V;const H={roles:[vAe.CLIENT],partyType:bAe.ORGANIZATION,organizationDetails:{organizationName:"PLACEHOLDER_ORG_NAME",countryOfFormation:"US"}};if(t)if(t&&(h!=null&&h.id)){if(O.organizationTypeHierarchy.specificOrganizationType===((V=h.organizationDetails)==null?void 0:V.organizationType)){b();return}const G=Wp(O,{});S({partyId:h.id,data:G},{onSettled:(j,U)=>{var D;i==null||i(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:j=>{e.setQueryData(_a(t.id),U=>{var D;return{...U,parties:(D=U==null?void 0:U.parties)==null?void 0:D.map(A=>A.id===j.id?{...A,...j}:A)}}),b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,R=Gp(A);ci(p,R)}}})}else{const G=Fs(O,0,"addParties",{addParties:[H]});w({id:t.id,data:G},{onSettled:(j,U)=>{var D;r==null||r(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:()=>{b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,R=Ns(A,0,"addParties");ci(p,R)}}})}else{const G=Fs(O,0,"parties",{parties:[H]});g({data:{products:["EMBEDDED_PAYMENTS"],...G}},{onSettled:(j,U)=>{var D;r==null||r(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:j=>{n(j.id),e.setQueryData(_a(j.id),j),b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,R=Ns(A,0,"parties");ci(p,R)}}})}}),N=()=>{const O=[];return Object.entries(BH).forEach(([H,V])=>{const G=H;(o?V.some(U=>o.includes(U)):V.some(U=>nH.includes(U)))&&O.push(G)}),O.length?O:Object.keys(BH)},$=p.watch("organizationTypeHierarchy.generalOrganizationType"),_=O=>{if(O==="SOLE_PROPRIETORSHIP"){p.setValue("organizationTypeHierarchy.specificOrganizationType","SOLE_PROPRIETORSHIP");return}p.setValue("organizationTypeHierarchy.specificOrganizationType","")},T=M==="pending"||x==="pending"||L==="pending",z=T||h&&!f;return u.jsx(ur,{...p,children:u.jsxs("form",{onSubmit:E,className:"eb-flex eb-min-h-full eb-flex-col",children:[!s.hideGatewayInfoAlert&&u.jsxs(rn,{variant:"informative",density:"sm",className:"eb-mb-4",children:[u.jsx(gr,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{className:"eb-text-sm eb-font-semibold",children:"Is this you?"}),u.jsx(on,{children:"To keep your account details safe, we expect that the person completing this application holds primary control over financial and business operations for the business. If this is not you, please don't proceed below."}),u.jsxs("button",{type:"button",className:"eb-hover:eb-opacity-100 eb-focus:eb-outline-none eb-focus:eb-ring-2 eb-focus:eb-ring-ring eb-focus:eb-ring-offset-2 eb-disabled:eb-pointer-events-none eb-absolute eb-right-4 eb-top-3 eb-rounded-sm eb-opacity-70 eb-ring-offset-background eb-transition-opacity data-[state=open]:eb-bg-accent data-[state=open]:eb-text-muted-foreground [&&]:eb-pl-0",onClick:()=>{l({hideGatewayInfoAlert:!0})},children:[u.jsx(sr,{className:"eb-h-4 eb-w-4 eb-pl-0 eb-text-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Close"})]})]}),u.jsxs(js,{subTitle:d("welcomeText"),title:d("screens.gateway.title"),description:d("screens.gateway.description"),children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[u.jsx(Ce,{control:p.control,disableFieldRuleMapping:!0,name:"organizationTypeHierarchy.generalOrganizationType",type:"radio-group-blocks",options:N().map(O=>({value:O,label:d([`generalOrganizationTypes.${O}`]),description:d([`generalOrganizationTypeDescriptions.${O}`])})),onChange:_,required:!0,disabled:z}),($==="REGISTERED_BUSINESS"||$==="OTHER")&&u.jsx(Ce,{control:p.control,disableFieldRuleMapping:!0,name:"organizationTypeHierarchy.specificOrganizationType",type:"combobox",label:d([`fields.organizationTypeHierarchy.specificOrganizationType.label.${$}`]),description:d([`fields.organizationTypeHierarchy.specificOrganizationType.description.${$}`]),options:(o??nH).filter(O=>BH[$].includes(O)).map(O=>({value:O,label:d([`organizationTypes.${O}`,`onboarding:organizationTypes.${O}`]),description:d(`onboarding:organizationTypeDescriptions.${O}`)})),required:!0,disabled:z})]}),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Gr,{error:I||C||v}),u.jsxs(_e,{type:"submit",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",disabled:z,children:[T?u.jsx(Ln,{className:"eb-animate-spin"}):null,d("screens.gateway.nextButton")]})]})]})]})})},poe=["30071","30073"],dRe=["30005"],pRe=e=>{const t={};return e.forEach(n=>{var l,d,p,h,f,m,b,g,v,x;const r=((d=(l=n==null?void 0:n.responseSchema)==null?void 0:l.items)==null?void 0:d.type)??"string",i=(h=(p=n==null?void 0:n.responseSchema)==null?void 0:p.items)==null?void 0:h.enum,o=(m=(f=n==null?void 0:n.responseSchema)==null?void 0:f.items)==null?void 0:m.pattern,a=!!n.parentQuestionId;let s;if(n.id&&poe.includes(n.id))s=ne.string().regex(/^\d{4}-\d{2}-\d{2}$/,ee.t("onboarding:fields.additionalQuestions.validation.dateFormat"));else if(r)switch(r){case"boolean":s=ne.enum(["true","false"]);break;case"string":i?i.length>0?s=ne.enum([i[0],...i.slice(1)]):s=ne.string():(s=ne.string().min(1,ee.t("onboarding:fields.additionalQuestions.validation.required")),o&&(s=s.regex(new RegExp(o),ee.t("onboarding:fields.additionalQuestions.validation.invalidFormat"))));break;case"integer":s=ne.string().min(1,ee.t("onboarding:fields.additionalQuestions.validation.required")).regex(/^\d+$/,ee.t("onboarding:fields.additionalQuestions.validation.numberFormat"));break;default:s=ne.string()}else{console.log("Unknown question type",n);return}if(((b=n==null?void 0:n.responseSchema)==null?void 0:b.type)==="array"){const w=s;s=ne.array(w),a||(s=s.min(((g=n==null?void 0:n.responseSchema)==null?void 0:g.minItems)??1,ee.t("onboarding:fields.additionalQuestions.validation.required")).max(((v=n==null?void 0:n.responseSchema)==null?void 0:v.maxItems)??1,ee.t("onboarding:fields.additionalQuestions.validation.maxItems",{maxItems:(x=n==null?void 0:n.responseSchema)==null?void 0:x.maxItems})).superRefine((C,M)=>(C.forEach(S=>{const I=w.safeParse(S);I.error&&M.addIssue(I.error.issues[0])}),!0)))}t[`question_${n.id}`]=s}),ne.object(t).superRefine((n,r)=>{e.forEach(i=>{var o,a,s,l,d,p;if(i.parentQuestionId){const h=n==null?void 0:n[`question_${i.parentQuestionId}`],f=e.find(m=>m.id===i.parentQuestionId);if(f!=null&&f.subQuestions){const m=f.subQuestions.find(b=>{var g;return(g=b.questionIds)==null?void 0:g.includes(i.id??"")});m&&(typeof(m==null?void 0:m.anyValuesMatch)=="string"&&h.includes(m.anyValuesMatch)||Array.isArray(m==null?void 0:m.anyValuesMatch)&&h.some(b=>{var g;return(g=m.anyValuesMatch)==null?void 0:g.includes(b)}))&&(((o=i==null?void 0:i.responseSchema)==null?void 0:o.type)==="array"?((a=i==null?void 0:i.responseSchema)!=null&&a.minItems&&(!(n!=null&&n[`question_${i.id}`])||(n==null?void 0:n[`question_${i.id}`].length)<((s=i==null?void 0:i.responseSchema)==null?void 0:s.minItems))&&r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.required"),path:[`question_${i.id}`]}),(l=i==null?void 0:i.responseSchema)!=null&&l.maxItems&&(n==null?void 0:n[`question_${i.id}`].length)>((d=i==null?void 0:i.responseSchema)==null?void 0:d.maxItems)&&r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.maxItems",{maxItems:(p=i==null?void 0:i.responseSchema)==null?void 0:p.maxItems}),path:[`question_${i.id}`]})):n!=null&&n[`question_${i.id}`]||r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.required"),path:[`question_${i.id}`]}))}}})})},hRe=()=>{var N;const e=Bi(),{clientData:t}=Kr(),{originScreenId:n,goTo:r,updateSessionData:i}=Io(),o=n==="review-attest-section",a=((N=t==null?void 0:t.outstanding)==null?void 0:N.questionIds)??[],s=(t==null?void 0:t.questionResponses)??[],l=c.useMemo(()=>{const $=s.map(_=>_.questionId??"undefined");return[...new Set([...a,...$])]},[a,s]),{data:d,status:p,error:h}=jp({questionIds:l.join(",")}),f=c.useMemo(()=>l.reduce(($,_)=>{const T=s==null?void 0:s.find(F=>F.questionId===_);return $[`question_${_}`]=T?T.values:[],$},{}),[l,s]),m=_a((t==null?void 0:t.id)??""),{mutate:b,error:g,status:v}=ra({mutation:{onMutate:async $=>{await e.cancelQueries({queryKey:m});const _=e.getQueryData(["client",t==null?void 0:t.id]);return e.setQueryData(m,T=>{var F,z;return{...T,outstanding:{...T==null?void 0:T.outstanding,questionIds:((z=(F=T==null?void 0:T.outstanding)==null?void 0:F.questionIds)==null?void 0:z.filter(P=>!($.data.questionResponses??[]).some(O=>O.questionId===P)))??[]},questionResponses:[...$.data.questionResponses??[]]}}),{previousClientData:_}},onError:($,_,T)=>{e.setQueryData(m,T==null?void 0:T.previousClientData)},onSuccess:$=>{e.setQueryData(m,$),o?r("review-attest-section",{reviewScreenOpenedSectionId:"additional-questions-section"}):(r("overview"),i({mockedVerifyingSectionId:"additional-questions-section"}))}}}),x=$=>{var P,O,H,V,G,j,U,D;const _=`question_${$.id??"undefined"}`,T=((O=(P=$==null?void 0:$.responseSchema)==null?void 0:P.items)==null?void 0:O.type)??"string",F=(V=(H=$==null?void 0:$.responseSchema)==null?void 0:H.items)==null?void 0:V.enum,z=u.jsx("div",{className:"",children:(j=(G=$.description)==null?void 0:G.split(`
7781
+ `).map((t,n)=>{const r=/^\d+\./.test(t.trim());if(t.includes("[OR]")){let i=t.split("Acceptable documents are");if(i.length===2){const[o,a]=i,s=a.split(/\[AND\]|\[OR\]/g).map(l=>l.trim()).filter(l=>l);return u.jsxs("div",{className:"eb-mb-2",children:[u.jsx("p",{className:`eb-text-sm ${r?"eb-font-medium":""}`,children:o}),u.jsx("p",{className:"eb-ml-4 eb-mt-1 eb-text-sm",children:"Acceptable documents are:"}),u.jsx("ul",{className:"eb-ml-12 eb-mt-1 eb-list-disc eb-text-sm",children:s.map((l,d)=>u.jsx("li",{className:"eb-mb-1",children:l},`doc-${d}`))})]},`section-${n}`)}return i=t.split(/\[OR\]/g).map(o=>o.trim()).filter(o=>o),u.jsxs("div",{className:"eb-mb-2",children:[u.jsx("p",{className:`eb-text-sm ${r?"eb-font-medium":""}`,children:i[0]}),i.length>1&&u.jsx(u.Fragment,{children:u.jsx("ul",{className:"eb-ml-6 eb-list-disc eb-text-sm",children:i.slice(1).map((o,a)=>u.jsx("li",{className:"eb-mb-1",children:o},`part-${a}`))})})]},`section-${n}`)}if(t.includes("[AND]")){const i=t.split("[AND]").map(o=>o.trim()).filter(o=>o);return u.jsx("div",{className:"eb-mb-2",children:i.map((o,a)=>{const s=/^\d+\./.test(o.trim());return u.jsx("p",{className:`eb-text-sm ${s||r&&a===0?"eb-font-medium":""} ${a>0?"eb-mt-2":""}`,children:o},`and-part-${a}`)})},`section-${n}`)}return u.jsx("p",{className:`eb-mb-2 eb-text-sm ${r?"eb-font-medium":""}`,children:t},`section-${n}`)}):null,nRe=({documentRequestId:e,requirementIndex:t,uploadIndex:n,availableDocTypes:r,control:i,isReadOnly:o=!1,isOptional:a=!1})=>{const[s,l]=c.useState(!1),d=()=>{const{userAgent:b}=navigator,{width:g,height:v}=window.screen,x=/Android.*Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(b)||/iPad|Macintosh/i.test(b)&&"ontouchend"in document,w=/Windows NT/i.test(b),C=/Macintosh|MacIntel/i.test(b)&&!("ontouchend"in document),M=/Linux/i.test(b)&&!/Android/i.test(b),S=w||C||M,I="maxTouchPoints"in navigator&&navigator.maxTouchPoints>0&&!S&&(g<=768||v<=1024)&&g<1200;return x||I},p=()=>!!(navigator.mediaDevices&&"getUserMedia"in navigator.mediaDevices&&"enumerateDevices"in navigator.mediaDevices);c.useEffect(()=>{(async()=>{const g=d(),v=p();if(g&&v)try{const w=(await navigator.mediaDevices.enumerateDevices()).some(C=>C.kind==="videoinput");l(w)}catch{l(!0)}})()},[]);const h=n>0?`_${n}`:"",f=`${e}.requirement_${t}_docType${h}`,m=`${e}.requirement_${t}_files${h}`;return u.jsxs("div",{className:"eb-mb-6",children:[u.jsx(jt,{control:i,name:f,render:({field:b})=>u.jsxs(Ct,{className:"eb-mb-4",children:[u.jsxs($t,{asterisk:!a,className:"eb-text-sm eb-font-medium eb-text-gray-700",children:["Select Document Type",a&&u.jsx("span",{className:"eb-ml-2 eb-text-xs eb-font-normal eb-text-gray-500",children:"(Optional)"})]}),u.jsx(it,{children:u.jsxs(Pa,{onValueChange:b.onChange,value:b.value||"",disabled:o,children:[u.jsx(ea,{className:"eb-w-full",children:u.jsx(Oa,{placeholder:"Select a document type"})}),u.jsx(ta,{children:r.map(g=>{var v;return u.jsx(go,{value:g,children:((v=e2[g])==null?void 0:v.label)||g},g)})})]})}),u.jsx(Ht,{className:"eb-text-xs"})]})}),u.jsx(jt,{control:i,name:m,render:({field:{onChange:b,...g}})=>u.jsxs(Ct,{className:"eb-space-y-2",children:[u.jsxs($t,{asterisk:!a,className:"eb-text-sm eb-font-medium eb-text-gray-700",children:["Upload Document",a&&u.jsx("span",{className:"eb-ml-2 eb-text-xs eb-font-normal eb-text-gray-500",children:"(Optional)"})]}),u.jsx(it,{children:u.jsx(rte,{containerClassName:"eb-max-w-full",...g,multiple:!0,accept:J_e,onChange:b,compressionFunc:Ede,compressibleExtensions:[".jpeg",".jpg",".png"],fileMaxSize:eRe,compressionMaxDimension:1e3,showCompressionInfo:!0,enableCameraCapture:s,captureMode:"environment"})}),u.jsx(Ht,{className:"eb-text-xs"})]})})]})},rRe=({documentRequest:e,requirementIndex:t,isActive:n,isPastRequirement:r,satisfiedDocTypes:i,docTypesForRequirement:o,numFieldsToShow:a,control:s,watch:l,resetKey:d})=>{var m;const p=(m=e.requirements)==null?void 0:m[t];if(!p)return null;if(!n&&!r)return u.jsx("div",{className:"eb-rounded-md eb-border eb-border-gray-200 eb-p-3",children:u.jsx("h4",{className:"eb-text-sm eb-font-medium eb-text-gray-700",children:u.jsxs("div",{className:"eb-flex eb-items-center",children:[u.jsx(Oo,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-gray-400"}),u.jsxs("span",{className:"eb-font-medium",children:["Step ",t+1,"."]}),u.jsx("span",{className:"eb-ml-2 eb-text-gray-500",children:"Pending completion of previous steps"})]})})});const h=p.documentTypes.filter(b=>{const g=b,v=Array.from({length:a}).some((x,w)=>{const C=`${e.id}.requirement_${t}_docType${w>0?`_${w}`:""}`;return l(C)===g});return!i.includes(g)||v}),f=o.length>0?o:p.documentTypes.filter(b=>i.includes(b)).map(b=>b);return u.jsxs("div",{className:"eb-rounded-md eb-border eb-border-gray-200 eb-p-4",children:[u.jsx("h4",{className:"eb-mb-3 eb-text-sm eb-font-medium eb-text-gray-700",children:u.jsxs("div",{className:"eb-flex eb-items-center",children:[r?u.jsx(Ri,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-green-600"}):u.jsx(ul,{className:"eb-mr-2 eb-h-4 eb-w-4 eb-text-amber-600"}),u.jsxs("span",{className:"eb-font-medium",children:["Step ",t+1]}),r?u.jsxs("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:["Completed - Documents provided:",u.jsx("span",{className:"eb-ml-1 eb-inline-flex eb-flex-wrap eb-gap-1",children:f.map(b=>{var g;return u.jsx("span",{className:"eb-inline-flex eb-items-center eb-rounded-full eb-bg-green-100 eb-px-2 eb-py-0.5 eb-text-xs eb-font-medium eb-text-green-800",children:((g=e2[b])==null?void 0:g.label)||b},b)})})]}):a>0?u.jsx("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:p.minRequired===0&&u.jsx("span",{className:"eb-ml-2 eb-inline-flex eb-items-center eb-rounded-full eb-bg-gray-100 eb-px-2 eb-py-0.5 eb-text-xs eb-font-medium eb-text-gray-500",children:"Optional"})}):u.jsx("span",{className:"eb-ml-2 eb-font-normal eb-text-gray-600",children:"All required documents provided"})]})}),r||h.length>0&&a>0?u.jsx(u.Fragment,{children:Array.from({length:a}).map((b,g)=>u.jsx(nRe,{documentRequestId:e.id||"",requirementIndex:t,uploadIndex:g,availableDocTypes:h,control:s,isReadOnly:r,isOptional:p.minRequired===0},`${e.id}-${t}-${g}-${d}`))}):u.jsx("div",{className:"eb-rounded-md eb-bg-green-50 eb-p-2 eb-text-sm eb-font-medium eb-text-green-700",children:"All document types for this requirement have been provided. You can proceed to the next step."})]})},iRe=({documentRequest:e,activeRequirements:t,satisfiedDocTypes:n,requirementDocTypes:r,control:i,watch:o,resetKey:a,onReset:s})=>{var l;return!(e!=null&&e.id)||!((l=e.requirements)!=null&&l.length)?null:u.jsxs("div",{children:[e.description&&u.jsx(rn,{variant:"informative",density:"sm",noTitle:!0,children:u.jsx(on,{children:tRe(e.description)})}),u.jsxs(dn,{className:"eb-mt-6 eb-w-full eb-shadow-sm",children:[u.jsx("div",{className:"eb-flex eb-justify-end eb-px-4 eb-pb-0 eb-pt-3",children:u.jsxs(_e,{type:"button",variant:"outline",size:"sm",onClick:s,className:"eb-flex eb-items-center eb-gap-1 eb-text-xs",children:[u.jsx(ou,{className:"eb-h-3 eb-w-3"})," Reset form"]})}),u.jsx("div",{className:"eb-space-y-6 eb-p-4",children:e.requirements.map((d,p)=>{const h=t.includes(p),f=d.documentTypes.filter(x=>n.includes(x)).length,m=Math.max((d.minRequired||1)-f,0),b=f>0&&(f===d.documentTypes.length||m===0),g=r[p]||[];let v;return b?v=Math.max(g.length,d.minRequired||1):v=m+(g.length>0?g.length-1:0),u.jsx(rRe,{documentRequest:e,requirementIndex:p,isActive:h,isPastRequirement:b,satisfiedDocTypes:n,docTypesForRequirement:g,numFieldsToShow:v,control:i,watch:o,resetKey:a},`${e.id}-req-${p}`)})})]})]})},oRe=()=>{var _,T,F,z,P,O,H,V,G,j,U,D,A,R,B,J;const{clientData:e}=Kr(),t=Bi(),{goTo:n,editingPartyIds:r}=Io(),i=r["document-upload-form"],o=wX(),a=xX(),[s,l]=c.useState({}),[d,p]=c.useState([]),[h,f]=c.useState({}),[m,b]=c.useState(0),g=(_=e==null?void 0:e.parties)==null?void 0:_.find(Y=>Y.id===i),v=Array.from(new Set((P=(F=(T=e==null?void 0:e.parties)==null?void 0:T.map(Y=>{var K;return(K=Y==null?void 0:Y.validationResponse)==null?void 0:K.map(ae=>ae==null?void 0:ae.documentRequestIds)}))==null?void 0:F.flat(2))==null?void 0:P.filter(Y=>Y==null?void 0:Y.length).concat((z=e==null?void 0:e.outstanding)==null?void 0:z.documentRequestIds))),x=i?Array.from(new Set((D=(V=(H=(O=e==null?void 0:e.parties)==null?void 0:O.filter(Y=>Y.id===i))==null?void 0:H.map(Y=>{var K;return(K=Y==null?void 0:Y.validationResponse)==null?void 0:K.map(ae=>ae==null?void 0:ae.documentRequestIds)}))==null?void 0:V.flat(2))==null?void 0:D.filter(Y=>Y==null?void 0:Y.length).concat(((j=(G=e==null?void 0:e.parties)==null?void 0:G.find(Y=>Y.id===i))==null?void 0:j.partyType)==="ORGANIZATION"?((U=e==null?void 0:e.outstanding)==null?void 0:U.documentRequestIds)||[]:[]))):v,{data:w,status:C}=Zz({clientId:e==null?void 0:e.id,includeRelatedParty:!0}),M=((A=w==null?void 0:w.documentRequests)==null?void 0:A.filter(Y=>Y.status==="ACTIVE"&&x.includes(Y.id)))||[];c.useEffect(()=>{if(M!=null&&M.length){const Y={};M.forEach(K=>{var ae;K!=null&&K.id&&((ae=K.requirements)!=null&&ae.length)&&(Y[K.id]=[0])}),l(Y)}},[JSON.stringify(M)]);const S=c.useMemo(()=>{const Y={};return M.forEach(K=>{if(!(K!=null&&K.id)||!K.requirements)return;const ae={};K.requirements.forEach((fe,ue)=>{if(Math.max((fe.minRequired||1)-fe.documentTypes.filter(de=>d.includes(de)).length,0)>0){const de=fe.minRequired||1;for(let Z=0;Z<de;Z+=1){const he=Z>0?`_${Z}`:"";ae[`requirement_${ue}_docType${he}`]=ne.string().optional(),ae[`requirement_${ue}_files${he}`]=ne.array(ne.instanceof(File)).optional()}}}),Y[K.id]=ne.object(ae)}),ne.object(Y)},[JSON.stringify(M),JSON.stringify(d)]),I=ki({resolver:yo(S),mode:"onChange"});c.useEffect(()=>{const Y=setTimeout(()=>{I.trigger()},100);return()=>clearTimeout(Y)},[JSON.stringify(s),I]);const L=UO({control:I.control});c.useEffect(()=>{if(!L)return;const Y={},K=[],ae={};Object.entries(L).forEach(([ue,le])=>{Y[ue]=[],ae[ue]={},Object.entries(le).forEach(([de,Z])=>{var he;if(de.includes("_docType")&&Z){const Ae=de.split("_"),pe=parseInt(Ae[1],10),q=`requirement_${pe}_files`,W=de.replace(`requirement_${pe}_docType`,""),re=`${q}${W}`,we=le[re];if(we&&we.length>0){const ve=(he=I.formState.errors)==null?void 0:he[ue],be=!!(ve!=null&&ve[de]),me=!!(ve!=null&&ve[re]);if(!be&&!me){const ke=Z;Y[ue].push({documentType:ke,files:we}),K.includes(ke)||K.push(ke),ae[ue][pe]||(ae[ue][pe]=[]),ae[ue][pe].includes(ke)||ae[ue][pe].push(ke)}}}})}),p(K),f(ae);const fe={...s};M==null||M.forEach(ue=>{if(!(ue!=null&&ue.id))return;const le=ue.id;if(fe[le]||(fe[le]=[0]),ue.requirements){let de=!1;const Z=[];ue.requirements.forEach((he,Ae)=>{var q;(((q=Y[le])==null?void 0:q.filter(W=>he.documentTypes.includes(W.documentType)).length)||0)>=(he.minRequired||1)&&Z.push(Ae)});for(let he=0;he<ue.requirements.length;he+=1)if(!Z.includes(he)&&(he===0||ue.requirements.slice(0,he).every((pe,q)=>Z.includes(q)))){fe[le]=[he],de=!0;break}!de&&ue.requirements.length>0&&(Z.length===ue.requirements.length?fe[le]=[]:fe[le]=[0])}}),l(fe)},[L,JSON.stringify(M),I.formState.errors]);const E=I.handleSubmit(async()=>{I.clearErrors();const Y=I.getValues();try{const K=[];for(const[ae,fe]of Object.entries(Y)){K.push(ae);const ue=[];Object.entries(fe).forEach(([le,de])=>{if(le.includes("_docType")&&de){const Z=le.split("_"),he=parseInt(Z[1],10),Ae=`requirement_${he}_files`,pe=le.replace(`requirement_${he}_docType`,""),q=`${Ae}${pe}`,W=fe[q];W&&W.length>0&&W.forEach(re=>{ue.push({documentType:de,file:re})})}});for(const{documentType:le,file:de}of ue){const Z={documentRequestId:ae,documentType:le};await o.mutateAsync({data:{documentData:JSON.stringify(Z),file:de}})}}if(K.length>0)for(const ae of K)await a.mutateAsync({id:ae});t.invalidateQueries(),n("upload-documents-section")}catch(K){console.error("Error uploading documents:",K)}}),N=()=>{I.reset({}),p([]),f({});const Y={};M.forEach(K=>{K!=null&&K.id&&(Y[K.id]=[0])}),l(Y),o.reset(),a.reset(),b(K=>K+1)},$=c.useMemo(()=>{if(!(M!=null&&M.length))return!1;const Y=(ae,fe)=>{var he,Ae;if(!(ae!=null&&ae.id)||!ae.requirements)return!1;if((he=s[ae.id])==null?void 0:he.includes(fe)){const pe=(Ae=I.formState.errors)==null?void 0:Ae[ae.id];return pe&&Object.keys(pe).some(W=>W.includes(`requirement_${fe}_`)),!1}const le=ae.requirements[fe];if(!le)return!1;if(le.minRequired===0)return!0;const de=le.documentTypes.filter(pe=>d.includes(pe)).length;return de>0&&(de===le.documentTypes.length||de>=(le.minRequired||1))};return M.every(ae=>{var ue;return!(ae!=null&&ae.id)||!((ue=ae.requirements)!=null&&ue.length)?!0:ae.requirements.every((le,de)=>{var re,we;const Z=le.documentTypes.filter(ve=>d.includes(ve)).length,he=ae.id&&((re=s[ae.id])==null?void 0:re.includes(de)),Ae=Y(ae,de),pe=ae.id?(we=I.formState.errors)==null?void 0:we[ae.id]:void 0,q=pe?Object.keys(pe).some(ve=>ve.includes(`requirement_${de}_`)):!1;return le.minRequired===0?!0:Z>=(le.minRequired??1)&&!q&&(Ae||!he)})})},[JSON.stringify(M),JSON.stringify(s),d,I.formState.errors]);return C==="pending"?u.jsx(Ts,{message:"Fetching document requests..."}):u.jsx(ur,{...I,children:u.jsx("form",{onSubmit:E,className:"eb-flex eb-min-h-full eb-flex-col",children:u.jsxs(js,{title:rf(g),children:[u.jsxs("div",{className:"eb-flex-auto eb-space-y-6",children:[u.jsxs("div",{className:"eb-mb-6 eb-mt-1",children:[((R=g==null?void 0:g.roles)==null?void 0:R.includes("CLIENT"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Business"}),((B=g==null?void 0:g.roles)==null?void 0:B.includes("BENEFICIAL_OWNER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Owner"}),((J=g==null?void 0:g.roles)==null?void 0:J.includes("CONTROLLER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Controller"})]}),u.jsx("div",{className:"eb-space-y-4",children:M==null?void 0:M.map(Y=>u.jsx(iRe,{documentRequest:Y,activeRequirements:s[Y.id||""]||[0],satisfiedDocTypes:d,requirementDocTypes:h[Y.id||""]||{},control:I.control,watch:I.watch,resetKey:m,onReset:N},Y.id))})]}),u.jsxs("div",{className:"eb-mt-6 eb-flex eb-flex-col eb-gap-3",children:[u.jsx(Gr,{error:o.error||a.error,customErrorMessage:o.error?"There was an unexpected error uploading documents. Please try again.":a.error?"There was an unexpected error submitting document requests. Please try again.":void 0}),u.jsx(_e,{type:"submit",disabled:I.formState.isSubmitting||!$,children:I.formState.isSubmitting?"Uploading...":$?"Upload Documents":"Complete All Required Documents"}),u.jsx(_e,{variant:"ghost",onClick:()=>n("upload-documents-section"),className:"eb-text-primary hover:eb-bg-primary/5 hover:eb-text-primary",children:"Cancel"})]})]})})})},aRe=({party:e,docRequestStatus:t,onUploadClick:n})=>{var r,i,o;return u.jsxs(dn,{className:"eb-space-y-6 eb-rounded-lg eb-border eb-p-6 eb-shadow",children:[u.jsxs("div",{className:"eb-space-y-1.5",children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[u.jsx("h3",{className:"eb-font-header eb-text-lg eb-font-medium",children:rf(e)}),t==="ACTIVE"&&u.jsxs("span",{children:[u.jsx(Oo,{className:"eb-size-5 eb-text-muted-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Pending"})]}),t==="CLOSED"&&u.jsxs("span",{children:[u.jsx(so,{className:"eb-size-5 eb-stroke-green-700"}),u.jsx("span",{className:"eb-sr-only",children:"Completed"})]}),t==="EXPIRED"&&u.jsxs("span",{children:[u.jsx(Fn,{className:"eb-size-5 eb-stroke-[#C75300]"}),u.jsx("span",{className:"eb-sr-only",children:"Expired"})]})]}),u.jsxs("div",{className:"eb-flex eb-gap-2",children:[((r=e.roles)==null?void 0:r.includes("CLIENT"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Business"}),((i=e.roles)==null?void 0:i.includes("BENEFICIAL_OWNER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Owner"}),((o=e.roles)==null?void 0:o.includes("CONTROLLER"))&&u.jsx(cr,{variant:"subtle",size:"lg",children:"Controller"})]})]}),u.jsx("div",{children:t==="ACTIVE"?u.jsxs(_e,{variant:"outline",className:"eb-w-full eb-border-primary eb-text-primary",onClick:()=>n(e),children:[u.jsx(Ca,{})," Upload documents"]}):u.jsxs("div",{className:"eb-inline-flex eb-items-center eb-justify-center eb-gap-2 eb-text-xs eb-text-green-700",children:[u.jsx(Lr,{className:"eb-size-4"}),"Required documents successfully uploaded"]})})]})},uoe=({title:e,documentRequests:t,clientData:n,onPartySelect:r})=>n!=null&&n.parties?u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:e}),t.length>0?t.map(i=>{var a,s;const o=i.partyId?(a=n.parties)==null?void 0:a.find(l=>l.id===i.partyId):(s=n.parties)==null?void 0:s.find(l=>{var d;return(d=l.roles)==null?void 0:d.includes("CLIENT")});return o?u.jsx(aRe,{party:o,docRequestStatus:i.status,onUploadClick:r},o.id):null}):u.jsx(dn,{className:"eb-space-y-6 eb-rounded-lg eb-border eb-p-6 eb-shadow",children:u.jsx("p",{className:"eb-flex eb-items-center eb-justify-center eb-text-sm eb-font-medium",children:"No documents required"})})]}):null,sRe=(e,t)=>{var o;if(!(e!=null&&e.length)||!(t!=null&&t.parties))return{businessDocumentRequests:[],individualDocumentRequests:[]};const n=(o=t.parties.find(a=>{var s;return(s=a.roles)==null?void 0:s.includes("CLIENT")}))==null?void 0:o.id,r=e.filter(a=>!a.partyId&&a.clientId===t.id||a.partyId&&a.partyId===n),i=e.filter(a=>a.partyId&&a.partyId!==n);return{businessDocumentRequests:r,individualDocumentRequests:i}},lRe=({clientStatus:e,documentRequestStatus:t,hasDocumentRequests:n})=>{if(e==="REVIEW_IN_PROGRESS")return u.jsxs(rn,{variant:"informative",children:[u.jsx(gr,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"Review in progress"}),u.jsx(on,{children:"Your onboarding is currently under review. Please check back later."})]});if(e==="APPROVED")return u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(Lr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Your onboarding has been approved. No documents are required."})]});if(!e)return u.jsxs(rn,{variant:"destructive",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There was a problem"}),u.jsx(on,{children:"Unable to load client data. Please try again later."})]});if(t!=="pending"){if(t==="error")return u.jsxs(rn,{variant:"destructive",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There was a problem"}),u.jsx(on,{children:"Unable to load document requests. Please try again later."})]});if(!n)return u.jsxs(rn,{variant:"warning",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There is a problem"}),u.jsx(on,{children:"No document requests found."})]})}},cRe=()=>{const{clientData:e,docUploadOnlyMode:t}=Kr(),{goTo:n}=Io(),{data:r,status:i}=Zz({clientId:e==null?void 0:e.id,includeRelatedParty:!0}),o=r==null?void 0:r.documentRequests,a=!!(o!=null&&o.length),s=d=>{n("document-upload-form",{editingPartyId:d.id})},l=()=>{if(i==="pending")return u.jsx(Ts,{message:"Loading document requests"});const d=lRe({clientStatus:e==null?void 0:e.status,documentRequestStatus:i,hasDocumentRequests:a}),p=d!==null?d:null;if(p)return p;const{businessDocumentRequests:h,individualDocumentRequests:f}=sRe(o,e);return u.jsxs("div",{className:"eb-space-y-6",children:[u.jsx(uoe,{title:"For the business",documentRequests:h,clientData:e,onPartySelect:s}),u.jsx(uoe,{title:"For owners and key roles",documentRequests:f,clientData:e,onPartySelect:s})]})};return u.jsxs(js,{title:"Supporting documents",description:i==="success"&&(e==null?void 0:e.status)==="INFORMATION_REQUESTED"&&a?"To satisfy regulatory requirements, we need to obtain the following":void 0,children:[u.jsx("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:l()}),!t&&u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsx("div",{className:"eb-flex eb-justify-between eb-gap-4",children:u.jsx(_e,{type:"button",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>n("overview"),children:"Return to overview"})})})]})},doe=ne.object({organizationTypeHierarchy:ne.object({generalOrganizationType:ne.union([ne.enum(["SOLE_PROPRIETORSHIP","REGISTERED_BUSINESS","OTHER"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")}),specificOrganizationType:ne.union([ne.enum(["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP","NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","SOLE_PROPRIETORSHIP","UNINCORPORATED_ASSOCIATION","PUBLICLY_TRADED_COMPANY"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")})})}),BH={SOLE_PROPRIETORSHIP:["SOLE_PROPRIETORSHIP"],REGISTERED_BUSINESS:["LIMITED_LIABILITY_COMPANY","LIMITED_LIABILITY_PARTNERSHIP","GENERAL_PARTNERSHIP","LIMITED_PARTNERSHIP","C_CORPORATION","S_CORPORATION","PARTNERSHIP"],OTHER:["NON_PROFIT_CORPORATION","GOVERNMENT_ENTITY","UNINCORPORATED_ASSOCIATION"]},uRe=()=>{var P;const e=Bi(),{clientData:t,setClientId:n,onPostClientSettled:r,onPostPartySettled:i,availableOrganizationTypes:o}=Kr(),{goTo:a,sessionData:s,updateSessionData:l}=Io(),{t:d}=Qt(["onboarding-overview","onboarding","common"]),p=OJ({clientData:t,schema:doe,defaultValues:{}}),h=(P=t==null?void 0:t.parties)==null?void 0:P.find(O=>O.partyType==="ORGANIZATION"),[f,m]=c.useState(!1),b=()=>{a("overview")};c.useEffect(()=>{if(t&&h&&!f){const O=Ah(t,h.id);p.reset($s(O,doe)),m(!0)}},[t,h,f,p]);const{mutate:g,error:v,status:x}=bX(),{mutate:w,error:C,status:M}=ra(),{mutate:S,error:I,status:L}=ia(),E=p.handleSubmit(O=>{var V;const H={roles:[vAe.CLIENT],partyType:bAe.ORGANIZATION,organizationDetails:{organizationName:"PLACEHOLDER_ORG_NAME",countryOfFormation:"US"}};if(t)if(t&&(h!=null&&h.id)){if(O.organizationTypeHierarchy.specificOrganizationType===((V=h.organizationDetails)==null?void 0:V.organizationType)){b();return}const G=Wp(O,{});S({partyId:h.id,data:G},{onSettled:(j,U)=>{var D;i==null||i(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:j=>{e.setQueryData(_a(t.id),U=>{var D;return{...U,parties:(D=U==null?void 0:U.parties)==null?void 0:D.map(A=>A.id===j.id?{...A,...j}:A)}}),b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,R=Gp(A);ci(p,R)}}})}else{const G=Fs(O,0,"addParties",{addParties:[H]});w({id:t.id,data:G},{onSettled:(j,U)=>{var D;r==null||r(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:()=>{b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,R=Ns(A,0,"addParties");ci(p,R)}}})}else{const G=Fs(O,0,"parties",{parties:[H]});g({data:{products:["EMBEDDED_PAYMENTS"],...G}},{onSettled:(j,U)=>{var D;r==null||r(j,(D=U==null?void 0:U.response)==null?void 0:D.data)},onSuccess:j=>{n(j.id),e.setQueryData(_a(j.id),j),b()},onError:j=>{var U,D;if((D=(U=j.response)==null?void 0:U.data)!=null&&D.context){const{context:A}=j.response.data,R=Ns(A,0,"parties");ci(p,R)}}})}}),N=()=>{const O=[];return Object.entries(BH).forEach(([H,V])=>{const G=H;(o?V.some(U=>o.includes(U)):V.some(U=>nH.includes(U)))&&O.push(G)}),O.length?O:Object.keys(BH)},$=p.watch("organizationTypeHierarchy.generalOrganizationType"),_=O=>{if(O==="SOLE_PROPRIETORSHIP"){p.setValue("organizationTypeHierarchy.specificOrganizationType","SOLE_PROPRIETORSHIP");return}p.setValue("organizationTypeHierarchy.specificOrganizationType","")},T=M==="pending"||x==="pending"||L==="pending",z=T||h&&!f;return u.jsx(ur,{...p,children:u.jsxs("form",{onSubmit:E,className:"eb-flex eb-min-h-full eb-flex-col",children:[!s.hideGatewayInfoAlert&&u.jsxs(rn,{variant:"informative",density:"sm",className:"eb-mb-4",children:[u.jsx(gr,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{className:"eb-text-sm eb-font-semibold",children:"Is this you?"}),u.jsx(on,{children:"To keep your account details safe, we expect that the person completing this application holds primary control over financial and business operations for the business. If this is not you, please don't proceed below."}),u.jsxs("button",{type:"button",className:"eb-hover:eb-opacity-100 eb-focus:eb-outline-none eb-focus:eb-ring-2 eb-focus:eb-ring-ring eb-focus:eb-ring-offset-2 eb-disabled:eb-pointer-events-none eb-absolute eb-right-4 eb-top-3 eb-rounded-sm eb-opacity-70 eb-ring-offset-background eb-transition-opacity data-[state=open]:eb-bg-accent data-[state=open]:eb-text-muted-foreground [&&]:eb-pl-0",onClick:()=>{l({hideGatewayInfoAlert:!0})},children:[u.jsx(sr,{className:"eb-h-4 eb-w-4 eb-pl-0 eb-text-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Close"})]})]}),u.jsxs(js,{subTitle:d("welcomeText"),title:d("screens.gateway.title"),description:d("screens.gateway.description"),children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[u.jsx(Ce,{control:p.control,disableFieldRuleMapping:!0,name:"organizationTypeHierarchy.generalOrganizationType",type:"radio-group-blocks",options:N().map(O=>({value:O,label:d([`generalOrganizationTypes.${O}`]),description:d([`generalOrganizationTypeDescriptions.${O}`])})),onChange:_,required:!0,disabled:z}),($==="REGISTERED_BUSINESS"||$==="OTHER")&&u.jsx(Ce,{control:p.control,disableFieldRuleMapping:!0,name:"organizationTypeHierarchy.specificOrganizationType",type:"combobox",label:d([`fields.organizationTypeHierarchy.specificOrganizationType.label.${$}`]),description:d([`fields.organizationTypeHierarchy.specificOrganizationType.description.${$}`]),options:(o??nH).filter(O=>BH[$].includes(O)).map(O=>({value:O,label:d([`organizationTypes.${O}`,`onboarding:organizationTypes.${O}`]),description:d(`onboarding:organizationTypeDescriptions.${O}`)})),required:!0,disabled:z})]}),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Gr,{error:I||C||v}),u.jsxs(_e,{type:"submit",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",disabled:z,children:[T?u.jsx(Ln,{className:"eb-animate-spin"}):null,d("screens.gateway.nextButton")]})]})]})]})})},poe=["30071","30073"],dRe=["30005"],pRe=e=>{const t={};return e.forEach(n=>{var l,d,p,h,f,m,b,g,v,x;const r=((d=(l=n==null?void 0:n.responseSchema)==null?void 0:l.items)==null?void 0:d.type)??"string",i=(h=(p=n==null?void 0:n.responseSchema)==null?void 0:p.items)==null?void 0:h.enum,o=(m=(f=n==null?void 0:n.responseSchema)==null?void 0:f.items)==null?void 0:m.pattern,a=!!n.parentQuestionId;let s;if(n.id&&poe.includes(n.id))s=ne.string().regex(/^\d{4}-\d{2}-\d{2}$/,ee.t("onboarding:fields.additionalQuestions.validation.dateFormat"));else if(r)switch(r){case"boolean":s=ne.enum(["true","false"]);break;case"string":i?i.length>0?s=ne.enum([i[0],...i.slice(1)]):s=ne.string():(s=ne.string().min(1,ee.t("onboarding:fields.additionalQuestions.validation.required")),o&&(s=s.regex(new RegExp(o),ee.t("onboarding:fields.additionalQuestions.validation.invalidFormat"))));break;case"integer":s=ne.string().min(1,ee.t("onboarding:fields.additionalQuestions.validation.required")).regex(/^\d+$/,ee.t("onboarding:fields.additionalQuestions.validation.numberFormat"));break;default:s=ne.string()}else{console.log("Unknown question type",n);return}if(((b=n==null?void 0:n.responseSchema)==null?void 0:b.type)==="array"){const w=s;s=ne.array(w),a||(s=s.min(((g=n==null?void 0:n.responseSchema)==null?void 0:g.minItems)??1,ee.t("onboarding:fields.additionalQuestions.validation.required")).max(((v=n==null?void 0:n.responseSchema)==null?void 0:v.maxItems)??1,ee.t("onboarding:fields.additionalQuestions.validation.maxItems",{maxItems:(x=n==null?void 0:n.responseSchema)==null?void 0:x.maxItems})).superRefine((C,M)=>(C.forEach(S=>{const I=w.safeParse(S);I.error&&M.addIssue(I.error.issues[0])}),!0)))}t[`question_${n.id}`]=s}),ne.object(t).superRefine((n,r)=>{e.forEach(i=>{var o,a,s,l,d,p;if(i.parentQuestionId){const h=n==null?void 0:n[`question_${i.parentQuestionId}`],f=e.find(m=>m.id===i.parentQuestionId);if(f!=null&&f.subQuestions){const m=f.subQuestions.find(b=>{var g;return(g=b.questionIds)==null?void 0:g.includes(i.id??"")});m&&(typeof(m==null?void 0:m.anyValuesMatch)=="string"&&h.includes(m.anyValuesMatch)||Array.isArray(m==null?void 0:m.anyValuesMatch)&&h.some(b=>{var g;return(g=m.anyValuesMatch)==null?void 0:g.includes(b)}))&&(((o=i==null?void 0:i.responseSchema)==null?void 0:o.type)==="array"?((a=i==null?void 0:i.responseSchema)!=null&&a.minItems&&(!(n!=null&&n[`question_${i.id}`])||(n==null?void 0:n[`question_${i.id}`].length)<((s=i==null?void 0:i.responseSchema)==null?void 0:s.minItems))&&r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.required"),path:[`question_${i.id}`]}),(l=i==null?void 0:i.responseSchema)!=null&&l.maxItems&&(n==null?void 0:n[`question_${i.id}`].length)>((d=i==null?void 0:i.responseSchema)==null?void 0:d.maxItems)&&r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.maxItems",{maxItems:(p=i==null?void 0:i.responseSchema)==null?void 0:p.maxItems}),path:[`question_${i.id}`]})):n!=null&&n[`question_${i.id}`]||r.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.additionalQuestions.validation.required"),path:[`question_${i.id}`]}))}}})})},hRe=()=>{var N;const e=Bi(),{clientData:t}=Kr(),{originScreenId:n,goTo:r,updateSessionData:i}=Io(),o=n==="review-attest-section",a=((N=t==null?void 0:t.outstanding)==null?void 0:N.questionIds)??[],s=(t==null?void 0:t.questionResponses)??[],l=c.useMemo(()=>{const $=s.map(_=>_.questionId??"undefined");return[...new Set([...a,...$])]},[a,s]),{data:d,status:p,error:h}=jp({questionIds:l.join(",")}),f=c.useMemo(()=>l.reduce(($,_)=>{const T=s==null?void 0:s.find(F=>F.questionId===_);return $[`question_${_}`]=T?T.values:[],$},{}),[l,s]),m=_a((t==null?void 0:t.id)??""),{mutate:b,error:g,status:v}=ra({mutation:{onMutate:async $=>{await e.cancelQueries({queryKey:m});const _=e.getQueryData(["client",t==null?void 0:t.id]);return e.setQueryData(m,T=>{var F,z;return{...T,outstanding:{...T==null?void 0:T.outstanding,questionIds:((z=(F=T==null?void 0:T.outstanding)==null?void 0:F.questionIds)==null?void 0:z.filter(P=>!($.data.questionResponses??[]).some(O=>O.questionId===P)))??[]},questionResponses:[...$.data.questionResponses??[]]}}),{previousClientData:_}},onError:($,_,T)=>{e.setQueryData(m,T==null?void 0:T.previousClientData)},onSuccess:$=>{e.setQueryData(m,$),o?r("review-attest-section",{reviewScreenOpenedSectionId:"additional-questions-section"}):(r("overview"),i({mockedVerifyingSectionId:"additional-questions-section"}))}}}),x=$=>{var P,O,H,V,G,j,U,D;const _=`question_${$.id??"undefined"}`,T=((O=(P=$==null?void 0:$.responseSchema)==null?void 0:P.items)==null?void 0:O.type)??"string",F=(V=(H=$==null?void 0:$.responseSchema)==null?void 0:H.items)==null?void 0:V.enum,z=u.jsx("div",{className:"",children:(j=(G=$.description)==null?void 0:G.split(`
7782
7782
  `))==null?void 0:j.map((A,R)=>u.jsx("div",{children:u.jsx($t,{asterisk:R===0,className:ye({"eb-ml-4":R>0}),children:A},R)}))});if($.id&&poe.includes($.id))return u.jsx(jt,{control:C.control,name:_,render:({field:A})=>u.jsxs(Ct,{children:[z,u.jsx(it,{children:u.jsx(vn,{...A,type:"date",onChange:R=>A.onChange([R.target.value])})}),u.jsx(Ht,{})]})});if($.id&&dRe.includes($.id))return u.jsx(jt,{control:C.control,name:_,render:({field:A})=>{var R;return u.jsxs(Ct,{children:[z,u.jsx(it,{children:u.jsxs("div",{className:"eb-relative",children:[u.jsx("span",{className:"eb-absolute eb-left-3 eb-translate-y-2 eb-text-gray-500",children:"$"}),u.jsx(vn,{type:"number",min:0,max:1e10,step:.01,placeholder:"0.00",className:"eb-pl-7",...A,value:(R=A.value)==null?void 0:R[0],onChange:B=>{const J=parseFloat(B.target.value);J>=0&&J<=1e10&&A.onChange([B.target.value])},onBlur:B=>{const J=parseFloat(B.target.value);J<0&&A.onChange(["0"]),J>1e10&&A.onChange(["10000000000"])}})]})}),u.jsx(Ht,{})]})}});switch(T){case"boolean":return u.jsx(jt,{control:C.control,name:_,render:({field:A})=>{var R;return u.jsxs(Ct,{className:"eb-space-y-3",children:[z,u.jsx(it,{children:u.jsxs(kp,{onValueChange:B=>A.onChange([B]),defaultValue:(R=A==null?void 0:A.value)==null?void 0:R[0],className:"eb-flex eb-flex-col eb-space-y-1",children:[u.jsxs(Ct,{className:"eb-flex eb-items-center eb-space-x-3 eb-space-y-0",children:[u.jsx(it,{children:u.jsx(Ss,{value:"true"})}),u.jsx($t,{className:"eb-font-normal",children:"Yes"})]}),u.jsxs(Ct,{className:"eb-flex eb-items-center eb-space-x-3 eb-space-y-0",children:[u.jsx(it,{children:u.jsx(Ss,{value:"false"})}),u.jsx($t,{className:"eb-font-normal",children:"No"})]})]})}),u.jsx(Ht,{})]})}});case"string":return F?(U=$==null?void 0:$.responseSchema)!=null&&U.maxItems&&((D=$==null?void 0:$.responseSchema)==null?void 0:D.maxItems)>0?u.jsx(jt,{control:C.control,name:_,render:()=>u.jsxs(Ct,{children:[z,F.map(A=>u.jsx(jt,{control:C.control,name:_,render:({field:R})=>{var B;return u.jsxs(Ct,{className:"eb-flex eb-flex-row eb-items-start eb-space-x-3 eb-space-y-0",children:[u.jsx(it,{children:u.jsx(mo,{checked:(B=R.value)==null?void 0:B.includes(A),onCheckedChange:J=>{var Y;return J?R.onChange([...R.value,A]):R.onChange((Y=R.value)==null?void 0:Y.filter(K=>K!==A))}})}),u.jsx($t,{className:"eb-font-normal",children:A})]},A)}},A)),u.jsx(Ht,{})]})}):u.jsx(jt,{control:C.control,name:_,render:({field:A})=>{var R;return u.jsxs(Ct,{children:[z,u.jsxs(Pa,{onValueChange:B=>A.onChange([B]),defaultValue:(R=A==null?void 0:A.value)==null?void 0:R[0],children:[u.jsx(it,{children:u.jsx(ea,{children:u.jsx(Oa,{placeholder:"Select an option"})})}),u.jsx(ta,{children:F.map(B=>u.jsx(go,{value:B,children:B},B))})]}),u.jsx(Ht,{})]})}}):u.jsx(jt,{control:C.control,name:_,render:({field:A})=>u.jsxs(Ct,{children:[z,u.jsx(it,{children:u.jsx(vn,{...A,onChange:R=>A.onChange([R.target.value])})}),u.jsx(Ht,{})]})});case"integer":return u.jsx(jt,{control:C.control,name:_,render:({field:A})=>u.jsxs(Ct,{children:[z,u.jsx(it,{children:u.jsx(vn,{type:"number",...A,onChange:R=>A.onChange([R.target.value])})}),u.jsx(Ht,{})]})});default:return u.jsx(jt,{control:C.control,name:_,render:({field:A})=>u.jsxs(Ct,{children:[z,u.jsx(it,{children:u.jsx(vn,{...A,onChange:R=>A.onChange([R.target.value])})}),u.jsx(Ht,{})]})})}},w=c.useMemo(()=>{const $=(d==null?void 0:d.questions)??[];return $?pRe($):ne.object({})},[d]),C=ki({resolver:yo(w),defaultValues:f}),M=$=>{var z,P;if(!$.parentQuestionId)return!0;const _=(z=d==null?void 0:d.questions)==null?void 0:z.find(O=>O.id===$.parentQuestionId);if(!_)return!1;const T=C.watch(`question_${_.id}`);if(!T)return!1;const F=(P=_==null?void 0:_.subQuestions)==null?void 0:P.find(O=>{var H;return(H=O.questionIds)==null?void 0:H.includes($.id??"")});return typeof(F==null?void 0:F.anyValuesMatch)=="string"?T.includes(F.anyValuesMatch):Array.isArray(F==null?void 0:F.anyValuesMatch)?T.some(O=>{var H;return(H=F.anyValuesMatch)==null?void 0:H.includes(O)}):!1},S=$=>!$.parentQuestionId,I=$=>{if(t!=null&&t.id){const T={questionResponses:Object.entries($).map(([F,z])=>({questionId:F.replace("question_",""),values:Array.isArray(z)?z:[z]}))};b({id:t.id,data:T})}},L=()=>{var $;return d?($=d==null?void 0:d.questions)==null?void 0:$.filter(S).filter(M).map((_,T)=>{var F;return u.jsxs(c.Fragment,{children:[T!==0&&u.jsx(Mp,{}),u.jsx("div",{className:"eb-mb-6",children:x(_)}),(F=d==null?void 0:d.questions)==null?void 0:F.filter(z=>z.parentQuestionId===_.id).filter(M).map(z=>u.jsx("div",{className:"eb-mb-6",children:x(z)},z.id))]},_.id)}):u.jsx("div",{className:"eb-text-muted-foreground",children:"There are no additional questions. You may proceed to the next step."})},E=p==="pending"||v==="pending";return p==="pending"?u.jsx(Ts,{message:"Loading questions..."}):u.jsx(ur,{...C,children:u.jsx("form",{onSubmit:C.handleSubmit(I),className:"eb-space-y-6",children:u.jsx(js,{title:"Operational details",description:"Please answer these additional questions to help us understand your business operations.",children:u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[L(),u.jsx(Gr,{error:h||g}),u.jsxs(_e,{type:"submit",size:"lg",className:"eb-w-full eb-text-lg",disabled:E,children:[v==="pending"&&u.jsx(Ln,{className:"eb-animate-spin"}),o?"Save and return to review":"Save and return to overview"]})]})})})})},fRe=()=>{const{organizationType:e,clientData:t,documentRequests:n}=Kr(),{sections:r,goTo:i,sessionData:o,updateSessionData:a}=Io(),{sectionStatuses:s,stepValidations:l}=pH(r,o,t,n),{t:d}=Qt(["onboarding-overview","onboarding","common"]),p=o.mockedKycCompleted||(t==null?void 0:t.status)==="APPROVED",h=d(`organizationTypes.${e}`),f=cre(n);return u.jsx(js,{title:u.jsxs("div",{className:"eb-flex eb-items-center eb-justify-between",children:[u.jsx("p",{children:d("screens.overview.title")}),u.jsxs(_e,{variant:"outline",size:"sm",children:[u.jsx(N1,{})," Download Checklist"]})]}),subTitle:!o.hideOverviewInfoAlert&&(t==null?void 0:t.status)==="NEW"?u.jsxs(rn,{variant:"informative",density:"sm",noTitle:!0,children:[u.jsx(gr,{className:"eb-size-4"}),u.jsx(on,{children:d("screens.overview.infoAlert")}),u.jsxs("button",{type:"button",className:"eb-hover:eb-opacity-100 eb-focus:eb-outline-none eb-focus:eb-ring-2 eb-focus:eb-ring-ring eb-focus:eb-ring-offset-2 eb-disabled:eb-pointer-events-none eb-absolute eb-right-4 eb-top-3 eb-rounded-sm eb-opacity-70 eb-ring-offset-background eb-transition-opacity data-[state=open]:eb-bg-accent data-[state=open]:eb-text-muted-foreground [&&]:eb-pl-0",onClick:()=>{a({hideOverviewInfoAlert:!0})},children:[u.jsx(sr,{className:"eb-size-4 eb-pl-0 eb-text-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Close"})]})]}):void 0,description:d("screens.overview.description"),children:u.jsxs("div",{className:"eb-flex-auto eb-space-y-6",children:[u.jsxs(dn,{className:"eb-mt-6 eb-rounded-md eb-border-none eb-bg-card",children:[u.jsx(Ea,{className:"eb-p-3",children:u.jsx(wi,{children:u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Verify your business"})})}),u.jsxs(Yo,{className:"eb-p-3 eb-pt-0",children:[(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"&&!f&&u.jsxs(rn,{variant:"informative",density:"sm",className:"eb-mb-6",children:[u.jsx(D1,{className:"eb-size-4"}),u.jsx(vr,{children:"Great work!"}),u.jsxs(on,{children:["Please hang tight while we verify your details. This should only take a moment.",u.jsx(Ln,{className:"eb-mt-1.5 eb-size-9 eb-animate-spin eb-stroke-primary"})]})]}),(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"&&f&&u.jsxs(rn,{variant:"informative",density:"sm",className:"eb-mb-6",children:[u.jsx(D1,{className:"eb-size-4"}),u.jsx(vr,{children:"We have your documents"}),u.jsxs(on,{children:["Please hang tight if you can while we verify your documents.",u.jsx(Ln,{className:"eb-mt-1.5 eb-size-9 eb-animate-spin eb-stroke-primary"})]})]}),(t==null?void 0:t.status)==="INFORMATION_REQUESTED"&&u.jsxs(rn,{variant:"warning",density:"sm",className:"eb-mb-6",noTitle:!0,children:[u.jsx(Fn,{className:"eb-size-4"}),u.jsx(on,{children:"We're having trouble verifying your business. Please provide supporting documentation."})]}),(t==null?void 0:t.status)==="DECLINED"&&u.jsxs(rn,{variant:"destructive",density:"sm",children:[u.jsx(ar,{className:"eb-size-4"}),u.jsx(vr,{children:"Application declined"}),u.jsx(on,{children:"We're sorry, but we cannot proceed with your application at this time."})]}),(t==null?void 0:t.status)==="APPROVED"&&u.jsxs(rn,{variant:"success",density:"sm",children:[u.jsx(Lr,{className:"eb-size-4"}),u.jsx(vr,{children:"All set!"}),u.jsx(on,{children:"Your business details have been verified"})]}),u.jsxs("div",{className:"eb-space-y-3",children:[(t==null?void 0:t.status)==="NEW"&&u.jsxs("div",{className:"eb-space-y-3 eb-rounded eb-bg-accent eb-px-4 eb-py-3",children:[u.jsx("p",{className:"eb-text-xs eb-font-semibold eb-tracking-normal eb-text-muted-foreground",children:"Your selected business type"}),u.jsxs("div",{children:[u.jsxs("span",{id:"business-structure",className:"eb-inline-flex eb-h-10 eb-w-full eb-items-center eb-justify-between eb-gap-2 eb-rounded-input eb-border eb-py-2 eb-pl-3 eb-text-sm",children:[u.jsx("span",{className:"eb-flex eb-text-start eb-font-sans eb-text-sm eb-font-normal eb-normal-case eb-text-foreground",children:h}),u.jsxs(_e,{variant:"ghost",size:"sm",onClick:()=>i("gateway"),"aria-label":"Edit business type",className:"eb-rounded-input hover:eb-bg-black/5",children:[u.jsx(yi,{}),"Edit"]})]}),u.jsxs("p",{className:"eb-mt-3 eb-flex eb-gap-2 eb-text-xs eb-italic eb-text-muted-foreground",children:[u.jsx(Fn,{className:"eb-size-4"})," If you change this after starting the application, you may lose your saved progress."]})]})]}),r.map(m=>{var w,C,M;const b=s==null?void 0:s[m.id],g=b==="on_hold"||b==="completed_disabled",v=l[m.id]?(C=(w=m.stepperConfig)==null?void 0:w.steps.find(S=>l[m.id][S.id]&&!l[m.id][S.id].isValid))==null?void 0:C.id:void 0,x=dH(t,(M=m.stepperConfig)==null?void 0:M.associatedPartyFilters);return b==="hidden"?null:u.jsxs("div",{children:[b==="on_hold"&&m.sectionConfig.onHoldText&&u.jsxs("p",{className:ye("eb-mb-3 eb-mt-7 eb-flex eb-items-center eb-gap-2 eb-text-sm eb-font-medium",{"eb-text-muted-foreground":g}),children:[u.jsx(P1,{className:"eb-size-4"}),m.sectionConfig.onHoldText]}),u.jsxs(dn,{className:ye("eb-rounded-md eb-border eb-bg-card eb-p-3",{"eb-border-dashed eb-border-muted-foreground":g}),children:[u.jsxs("div",{className:"eb-flex eb-w-full eb-items-center eb-justify-between",children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-gap-2",children:[u.jsx(m.sectionConfig.icon,{className:ye("eb-size-4",{"eb-text-muted-foreground":g})}),u.jsx("h3",{className:ye("eb-font-header eb-text-lg eb-font-medium",{"eb-text-muted-foreground":g}),children:m.sectionConfig.label})]}),u.jsxs("div",{className:"eb-flex [&_svg]:eb-size-4",children:[(b==="completed"||b==="completed_disabled")&&u.jsxs(u.Fragment,{children:[u.jsx(so,{className:"eb-stroke-success"}),u.jsx("span",{className:"eb-sr-only",children:"Completed"})]}),["not_started","on_hold"].includes(b)&&u.jsxs(u.Fragment,{children:[u.jsx(Oo,{className:"eb-stroke-muted-foreground"}),u.jsx("span",{className:"eb-sr-only",children:"Not started"})]}),b==="missing_details"&&u.jsxs(u.Fragment,{children:[u.jsx(Fn,{className:"eb-stroke-warning"}),u.jsx("span",{className:"eb-sr-only",children:"Missing details"})]})]})]}),m.sectionConfig.requirementsList&&u.jsx("ul",{className:"eb-mt-1.5 eb-w-full eb-list-disc eb-whitespace-break-spaces eb-pl-8 eb-text-start eb-font-sans eb-text-sm eb-font-normal",children:m.sectionConfig.requirementsList.map((S,I)=>u.jsx("li",{children:S},I))}),u.jsx("div",{className:"eb-flex eb-justify-end",children:u.jsxs(_e,{variant:["completed","on_hold"].includes(b)?"secondary":"default",size:"sm",className:ye("eb-mt-3",{"eb-hidden":b==="completed_disabled"}),disabled:g,onClick:()=>{i(m.id,{editingPartyId:x.id,previouslyCompleted:b==="completed",initialStepperStepId:v})},children:[["on_hold","not_started"].includes(b)&&u.jsxs(u.Fragment,{children:[d("common:start"),u.jsx(wa,{})]}),b==="completed"&&u.jsxs(u.Fragment,{children:[d("common:edit"),u.jsx(yi,{})]}),b==="missing_details"&&u.jsxs(u.Fragment,{children:[d("common:continue"),u.jsx(wa,{})]})]})})]})]},m.id)})]})]})]}),u.jsxs(dn,{className:"eb-mt-6 eb-rounded-md eb-border-none eb-bg-card",children:[u.jsx(Ea,{className:"eb-p-3",children:u.jsx(wi,{children:u.jsx("h2",{className:"eb-font-header eb-text-2xl eb-font-medium",children:"Link a bank account for payouts"})})}),u.jsx(Yo,{className:"eb-p-3 eb-pt-0",children:u.jsx("div",{className:"eb-space-y-3",children:u.jsxs("div",{children:[u.jsxs("p",{className:ye("eb-mb-3 eb-flex eb-items-center eb-gap-2 eb-text-sm eb-font-medium",{"eb-text-muted-foreground":!p}),children:[u.jsx(P1,{className:"eb-size-4"}),"Available after business verification"]}),u.jsxs(dn,{className:ye("eb-rounded-md eb-border eb-bg-card eb-p-3",{"eb-border-dashed eb-border-muted-foreground":!p}),children:[u.jsxs("div",{className:"eb-flex eb-w-full eb-justify-between",children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-gap-2",children:[u.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("path",{d:"M5.5 4V3H6.5V4H5.5Z",fill:"#4C5157",fillOpacity:"0.4"}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 0L12 6H10V11H12V12H0V11L2 11V6H0L6 0ZM3 6V11H4V6H3ZM5 6V11H7V6H5ZM8 6V11H9V6H8ZM6 1.41421L9.58579 5H2.41421L6 1.41421Z",fill:"#4C5157",fillOpacity:p?"1":"0.8"})]}),u.jsx("h3",{className:ye("eb-font-header eb-text-lg eb-font-medium",{"eb-text-muted-foreground":!p}),children:"Link an account"})]}),u.jsxs("div",{className:"eb-flex [&_svg]:eb-size-4",children:[u.jsx(Oo,{className:"eb-stroke-gray-600"}),u.jsx("span",{className:"eb-sr-only",children:"Not started"})]})]}),u.jsxs(_e,{variant:"secondary",size:"sm",className:"eb-mt-3 eb-w-full",disabled:!p,children:[d("common:start"),u.jsx(wa,{})]})]})]})})})]})]})})},mRe=ne.object({controllerEmail:ne.string().email(ee.t("onboarding:fields.organizationEmail.validation.invalid")).max(100,ee.t("onboarding:fields.organizationEmail.validation.maxLength")),controllerPhone:jh,controllerAddresses:ne.array(zh).refine(e=>{const t=e.map(n=>n.addressType);return new Set(t).size===t.length},ee.t("onboarding:fields.controllerAddresses.validation.uniqueTypes"))}),U$=()=>{const{t:e}=Qt("onboarding-overview"),t=ii();return console.log(t.formState.errors),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Ce,{control:t.control,name:"controllerEmail",type:"email"}),u.jsx(Ce,{control:t.control,name:"controllerPhone.phoneNumber",type:"phone"}),u.jsxs("fieldset",{className:"eb-grid eb-gap-3",children:[u.jsx("legend",{className:"eb-mb-3 eb-font-header eb-text-lg eb-font-medium",children:"Personal address"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.country",type:"combobox",options:xr.map(n=>({value:n,label:u.jsxs("span",{children:[u.jsxs("span",{className:"eb-font-medium",children:["[",n,"]"]})," ",e([`common:countries.${n}`])]})}))}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.primaryAddressLine",type:"text"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.additionalAddressLines.0.value",type:"text",description:"Apt, Suite, Unit, Building etc."}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.additionalAddressLines.1.value",type:"text",description:""}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.postalCode",type:"text",className:"eb-max-w-48"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.city",type:"text"}),u.jsx(Ce,{control:t.control,name:"controllerAddresses.0.state",type:"combobox",options:Oh})]})]})};U$.schema=mRe,U$.modifyFormValuesBeforeSubmit=e=>({...e,controllerPhone:{...e.controllerPhone,phoneType:"MOBILE_PHONE"}});const gRe=18,yRe=120,bRe=ne.object({birthDate:ne.string().regex(/^\d{4}-\d{2}-\d{2}$/,ee.t("onboarding:fields.birthDate.validation.format")).refine(e=>!Number.isNaN(new Date(e).getTime()),ee.t("onboarding:fields.birthDate.validation.invalid")).refine(e=>new Date(e)<=new Date,ee.t("onboarding:fields.birthDate.validation.future")).refine(e=>{const t=new Date(e);return new Date().getFullYear()-t.getFullYear()>=gRe},ee.t("onboarding:fields.birthDate.validation.tooYoung")).refine(e=>{const t=new Date(e);return new Date().getFullYear()-t.getFullYear()<=yRe},ee.t("onboarding:fields.birthDate.validation.tooOld")),countryOfResidence:ne.string().length(2,ee.t("onboarding:fields.countryOfResidence.validation.exactlyTwoChars")).refine(e=>e==="US",{message:"Only US is supported at this time."}),controllerIds:ne.array(lte).refine(e=>{const t=e.map(n=>n.idType);return new Set(t).size===t.length},ee.t("onboarding:fields.controllerIds.validation.uniqueTypes"))}),VH=()=>{const{t:e}=Qt(["onboarding-overview","onboarding"]),t=ii(),n=o=>e(o?[`idValueLabels.${o}`,`onboarding:idValueLabels.${o}`]:["onboarding:idValueLabels.placeholder"]),r=o=>o?e([`idValueDescriptions.${o}`]):"",i=t.watch("controllerIds.0.idType");return c.useEffect(()=>{t.watch("controllerIds.0.issuer")!=="US"&&t.setValue("controllerIds.0.issuer","US")},[t.watch("controllerIds.0.issuer")]),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Ce,{control:t.control,name:"birthDate",type:"importantDate",labelClassName:"eb-mb-1 eb-font-header eb-text-lg eb-font-medium"}),u.jsx(Ce,{control:t.control,name:"countryOfResidence",type:"combobox",options:xr.map(o=>({value:o,label:u.jsxs("span",{children:[u.jsxs("span",{className:"eb-font-medium",children:["[",o,"]"]})," ",e([`common:countries.${o}`])]})}))}),t.watch("countryOfResidence")==="US"&&u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx(Ce,{control:t.control,name:"controllerIds.0.value",type:"text",maskFormat:"### - ## - ####",maskChar:"_",label:n(i),description:r(i)}),u.jsxs(aoe,{children:[u.jsx(soe,{asChild:!0,children:u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"",children:["Use a different ID type",u.jsx(ao,{})]})}),u.jsx(HH,{className:"eb-component",children:["SSN","ITIN"].map(o=>u.jsx(qH,{disabled:t.watch("controllerIds.0.idType")===o,onClick:()=>{t.setValue("controllerIds.0.idType",o),t.setValue("controllerIds.0.value","")},children:u.jsx("div",{className:"eb-flex eb-items-center eb-gap-2",children:n(o)})},o))})]})]})]})};VH.schema=bRe;const UH=/^[a-zA-Z0-9()_/\\&+%@#;,.: -?]*$/,vRe=/^[A-Za-z.IVX]*$/,xRe=ne.object({controllerFirstName:ne.string().min(2,ee.t("onboarding:fields.controllerFirstName.validation.minLength")).max(30,ee.t("onboarding:fields.controllerFirstName.validation.maxLength")).regex(UH,ee.t("onboarding:fields.firstName.validation.pattern")).refine(e=>!/\s\s/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveSpaces")).refine(e=>!/-{2,}/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveHyphens")),controllerMiddleName:ne.string().max(30,ee.t("onboarding:fields.controllerMiddleName.validation.maxLength")).regex(UH,ee.t("onboarding:fields.controllerMiddleName.validation.pattern")),controllerLastName:ne.string().min(2,ee.t("onboarding:fields.controllerLastName.validation.minLength")).max(30,ee.t("onboarding:fields.controllerLastName.validation.maxLength")).regex(UH,ee.t("onboarding:fields.controllerLastName.validation.pattern")).refine(e=>!/\s\s/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveSpaces")).refine(e=>!/-{2,}/.test(e),ee.t("onboarding:fields.controllerName.validation.noConsecutiveHyphens")),controllerNameSuffix:ne.string().min(1,ee.t("onboarding:fields.controllerNameSuffix.validation.minLength")).max(5,ee.t("onboarding:fields.controllerNameSuffix.validation.maxLength")).regex(vRe,ee.t("onboarding:fields.controllerNameSuffix.validation.pattern")),controllerJobTitle:ne.union([ne.enum(["CEO","CFO","COO","President","Chairman","Senior Branch Manager","Other"]),ne.literal("")]).refine(e=>e!=="",{message:ee.t("common:validation.required")}),controllerJobTitleDescription:ne.string().max(50,ee.t("onboarding:fields.controllerJobTitleDescription.validation.maxLength")).regex(/^[a-zA-Z0-9\s,.&-]+$/,ee.t("onboarding:fields.controllerJobTitleDescription.validation.pattern")).refine(e=>!/(<[^>]*>)/.test(e),ee.t("onboarding:fields.controllerJobTitleDescription.validation.noHtml")).refine(e=>!/https?:\/\/[^\s]+/.test(e),ee.t("onboarding:fields.controllerJobTitleDescription.validation.noUrls"))}),wRe=e=>e.superRefine((t,n)=>{t.controllerJobTitle==="Other"&&!t.controllerJobTitleDescription&&n.addIssue({code:ne.ZodIssueCode.custom,message:ee.t("onboarding:fields.controllerJobTitleDescription.validation.required"),path:["controllerJobTitleDescription"]})}),pf=()=>{const e=ii(),t=e.watch("controllerJobTitle");return u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsxs("fieldset",{className:"eb-grid eb-gap-y-3",children:[u.jsx("legend",{className:"eb-mb-1.5 eb-text-lg eb-font-medium",children:"Legal name"}),u.jsx("p",{className:"eb-text-sm",children:"Your full name as recorded with government agencies"}),u.jsx(Ce,{control:e.control,name:"controllerFirstName",type:"text"}),u.jsx(Ce,{control:e.control,name:"controllerMiddleName",type:"text"}),u.jsx(Ce,{control:e.control,name:"controllerLastName",type:"text"}),u.jsx(Ce,{control:e.control,name:"controllerNameSuffix",type:"text",className:"eb-max-w-48"})]}),u.jsxs("div",{className:"eb-space-y-6",children:[u.jsx(Ce,{control:e.control,name:"controllerJobTitle",type:"combobox",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"}]}),t==="Other"&&u.jsx(Ce,{control:e.control,name:"controllerJobTitleDescription",type:"text",required:!0})]})]})};pf.schema=xRe,pf.refineSchemaFn=wRe,pf.modifyFormValuesBeforeSubmit=(e,t)=>{var r;return e.controllerJobTitle!=="Other"&&delete e.controllerJobTitleDescription,{...e,countryOfResidence:((r=t==null?void 0:t.individualDetails)==null?void 0:r.countryOfResidence)??"US"}};const hf=[{id:"personal-details",stepType:"form",title:"Personal details",description:"We collect personal information to verify individuals for security and compliance.",Component:pf},{id:"identity-document",stepType:"form",title:"Identity document",description:"We need some additional details to verify individuals for security and compliance.",Component:VH},{id:"contact-details",stepType:"form",title:"Contact details",description:"We need some additional details to confirm your identity.",Component:U$},{id:"check-answers",stepType:"check-answers",title:"Check your answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}],kRe=()=>{var O,H,V;const{clientData:e,onPostPartySettled:t,organizationType:n,documentRequests:r}=Kr(),{t:i}=Qt(["onboarding","onboarding-overview","common"]),o=Bi(),a=(O=e==null?void 0:e.parties)==null?void 0:O.find(G=>{var j;return(G==null?void 0:G.partyType)==="INDIVIDUAL"&&((j=G==null?void 0:G.roles)==null?void 0:j.includes("CONTROLLER"))&&G.active}),{currentScreenId:s,originScreenId:l,goTo:d,previouslyCompletedScreens:p,sections:h,sessionData:f,updateSessionData:m}=Io(),{sectionStatuses:b}=pH(h,f,e,r),g=l==="review-attest-section",v=p[s],x=ki({defaultValues:{controllerIsAnOwner:a?(H=a.roles)!=null&&H.includes("BENEFICIAL_OWNER")?"yes":v?"no":void 0:void 0}}),{mutate:w,error:C,status:M}=ia();c.useEffect(()=>{const G=(j,U)=>{w({partyId:j,data:{roles:U}},{onSettled:(D,A)=>{var R;t==null||t(D,(R=A==null?void 0:A.response)==null?void 0:R.data)},onSuccess:D=>{e&&(o.setQueryData(_a(e.id),A=>{var R;return{...A,parties:(R=A==null?void 0:A.parties)==null?void 0:R.map(B=>B.id===D.id?{...B,...D,roles:U}:B)}}),o.invalidateQueries({queryKey:_a(e.id)}))},onError:D=>{var A,R,B,J,Y;x.setValue("controllerIsAnOwner",(A=a==null?void 0:a.roles)!=null&&A.includes("BENEFICIAL_OWNER")?"yes":"no"),x.setError("controllerIsAnOwner",{type:"server",message:(Y=(J=(B=(R=D==null?void 0:D.response)==null?void 0:R.data)==null?void 0:B.context)==null?void 0:J[0])==null?void 0:Y.message})}})};x.watch("controllerIsAnOwner")==="yes"&&(a!=null&&a.id)&&(a!=null&&a.roles)&&!a.roles.includes("BENEFICIAL_OWNER")?G(a.id,[...a.roles,"BENEFICIAL_OWNER"]):x.watch("controllerIsAnOwner")==="no"&&(a!=null&&a.id)&&(a!=null&&a.roles)&&a.roles.includes("BENEFICIAL_OWNER")&&G(a.id,[...a.roles.filter(j=>j!=="BENEFICIAL_OWNER")])},[x.watch("controllerIsAnOwner")]);const{mutate:S,error:I,status:L}=ia(),E=((V=e==null?void 0:e.parties)==null?void 0:V.filter(G=>{var j;return(G==null?void 0:G.partyType)==="INDIVIDUAL"&&((j=G==null?void 0:G.roles)==null?void 0:j.includes("BENEFICIAL_OWNER"))}))||[],N=E.filter(G=>G.active||G.status==="ACTIVE"),$=ure(hf,N,e),_=G=>{var j;if(G){const U=$[G]?(j=hf.find(D=>$[G].stepValidationMap[D.id]&&!$[G].stepValidationMap[D.id].isValid))==null?void 0:j.id:void 0;d("owner-stepper",{editingPartyId:G,previouslyCompleted:$[G].allStepsValid,shortLabelOverride:"Edit owner",initialStepperStepId:U})}else d("owner-stepper",{shortLabelOverride:"Add owner"})},T=G=>{S({partyId:G,data:{active:!1}},{onSuccess:j=>{if(e){const U=_a(e.id);o.setQueryData(U,D=>{var A;return{...D,parties:(A=D==null?void 0:D.parties)==null?void 0:A.map(R=>R.id===j.id?{...R,...j}:R)}}),z(!1),o.invalidateQueries({queryKey:U})}}})},[F,z]=c.useState(!1),P=M==="pending"||L==="pending";return u.jsxs(js,{title:"Owners and key roles",description:"Provide information for owners and senior managers for your company. Keep in mind that individual people may have multiple roles.",children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[u.jsxs(rn,{variant:"informative",children:[u.jsx(gr,{className:"eb-h-4 eb-w-4"}),u.jsxs(on,{className:"eb-flex eb-flex-col",children:[u.jsxs("p",{className:"eb-mb-2 eb-text-sm eb-font-semibold",children:["For a"," ",n&&i(`onboarding-overview:organizationTypes.${n}`)]}),u.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[u.jsx("span",{className:"eb-text-lg eb-font-bold",children:"Owners"}),u.jsx(Iee,{content:u.jsxs("div",{className:"eb-space-y-3",children:[u.jsx("h2",{className:"eb-font-header eb-text-xl eb-font-medium",children:"What is an owner?"}),u.jsx("p",{className:"eb-pb-1 eb-text-sm",children:"An owner is an individual or entity that ultimately owns at least part of a business, established through a chain of ownership or by means of control other than direct control."})]}),children:u.jsx(_e,{variant:"ghost",size:"icon",children:u.jsx(gr,{className:"eb-size-6 eb-stroke-primary"})})})]}),u.jsxs("p",{children:["Please add ",u.jsx("span",{className:"eb-font-semibold",children:"all owners"})," ","holding 25% or more of the business"]})]})]}),u.jsx(ur,{...x,children:u.jsxs("form",{children:[u.jsx(Ce,{control:x.control,disableFieldRuleMapping:!0,disabled:P||a===void 0||N.length>=4&&x.watch("controllerIsAnOwner")==="no",type:"radio-group",name:"controllerIsAnOwner",label:i("beneficialOwnerStepForm.controllerIsOwnerQuestion"),description:"",tooltip:"",options:[{value:"yes",label:i("common:yes")},{value:"no",label:i("common:no")}],noOptionalLabel:!0}),b["personal-section"]!=="completed"&&u.jsxs("div",{className:"eb-mt-2 eb-flex eb-items-center",children:[u.jsxs("p",{className:"eb-flex eb-h-8 eb-items-center eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," Please complete the personal details first."]}),u.jsxs(_e,{variant:"link",size:"sm",className:"eb-h-8",onClick:()=>{d("personal-section",{editingPartyId:a==null?void 0:a.id})},children:["Go now",u.jsx(ul,{})]})]}),N.length>=4&&x.watch("controllerIsAnOwner")==="no"&&M!=="pending"&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-blue-500",children:["ⓘ"," ",i("beneficialOwnerStepForm.controllerCannotBeOwnerWarning")]}),u.jsx("div",{className:"eb-mt-2 eb-inline-flex eb-h-4 eb-items-center eb-justify-center eb-gap-2 eb-text-sm eb-text-muted-foreground",children:M==="pending"&&u.jsxs(u.Fragment,{children:[u.jsx(Ln,{className:"eb-pointer-events-none eb-size-4 eb-shrink-0 eb-animate-spin"}),u.jsx("span",{children:i("beneficialOwnerStepForm.makingChanges")})]})})]})}),u.jsxs("div",{className:"eb-space-y-4",children:[u.jsxs(_e,{type:"button",variant:"secondary",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>_(""),disabled:P||N.length>=4,children:[u.jsx(O1,{})," Add Owner"]}),E.length>=4&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," ",i("beneficialOwnerStepForm.maxOwnersWarning")]}),N.length===0&&u.jsx(dn,{className:"eb-mt-6 eb-p-4 eb-shadow-md",children:u.jsxs("div",{className:"eb-flex eb-flex-col eb-items-center eb-space-y-3",children:[u.jsx("div",{className:"eb-flex eb-h-8 eb-w-8 eb-items-center eb-justify-center eb-rounded-full eb-bg-primary eb-stroke-white",children:u.jsx(z1,{className:"eb-size-4 eb-fill-white eb-stroke-white"})}),u.jsx("p",{className:"eb-text-sm",children:"No stakeholders added yet."})]})}),N.map(G=>{var j,U,D,A,R;return u.jsxs(dn,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:rf(G)}),u.jsx("p",{className:"eb-text-sm eb-font-medium",children:((j=G.individualDetails)==null?void 0:j.jobTitle)==="Other"?`${i("jobTitles.Other")} - ${G.individualDetails.jobTitleDescription}`:i([`jobTitles.${(U=G.individualDetails)==null?void 0:U.jobTitle}`])}),u.jsxs("div",{className:"eb-flex eb-gap-2 eb-pt-2",children:[u.jsx(cr,{variant:"outline",className:"eb-border-transparent eb-bg-[#EDF4FF] eb-text-[#355FA1]",children:"Owner"}),((D=G.roles)==null?void 0:D.includes("CONTROLLER"))&&u.jsx(cr,{variant:"outline",className:"eb-border-transparent eb-bg-[#FFEBD9] eb-text-[#8F521F]",children:"Controller"})]})]}),u.jsxs("div",{className:"eb-flex eb-gap-2 eb-pt-4",children:[!((A=G.roles)!=null&&A.includes("CONTROLLER"))&&u.jsxs(g0e,{open:F,onOpenChange:z,children:[u.jsx(y0e,{asChild:!0,children:u.jsxs(_e,{variant:"ghost",size:"sm",children:[u.jsx(hd,{}),"Remove"]})}),u.jsxs(FG,{className:"eb-component",children:[u.jsxs($G,{children:[u.jsx(OG,{children:"Remove Owner?"}),u.jsxs(jG,{children:["Are you sure you want to remove"," ",u.jsx("b",{children:rf(G)})," as an owner?"]})]}),u.jsxs(PG,{children:[u.jsx(_G,{children:"Cancel"}),u.jsxs(zG,{onClick:()=>G.id&&T(G.id),children:[L==="pending"&&u.jsx(Ln,{className:"eb-size-4 eb-animate-spin"}),"Remove"]})]})]})]}),u.jsxs(_e,{variant:"outline",size:"sm",onClick:()=>G.id&&_(G.id),children:[u.jsx(yi,{}),"Edit"]})]}),G.id&&!((R=$[G.id])!=null&&R.allStepsValid)&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," This individual is missing some details."]})]},G.id)})]})]}),u.jsxs("div",{className:"eb-mt-6 eb-space-y-6",children:[u.jsx(Gr,{error:C||I}),u.jsx("div",{className:"eb-flex eb-justify-between eb-gap-4",children:u.jsx(_e,{type:"button",variant:"default",size:"lg",className:"eb-w-full eb-text-lg",onClick:()=>{x.getValues("controllerIsAnOwner")!==void 0&&m({isOwnersSectionDone:!0,mockedVerifyingSectionId:"owners-section"}),g?d("review-attest-section",{reviewScreenOpenedSectionId:"owners-section"}):d("overview")},disabled:P,children:g?"Save and return to review":"Save and return to overview"})})]})]})},CRe=({handlePrev:e,handleNext:t,getPrevButtonLabel:n,getNextButtonLabel:r})=>{var E,N;const{clientData:i,documentRequests:o}=Kr(),{t:a}=Qt(["onboarding","common"]),{sections:s,goTo:l,sessionData:d,reviewScreenOpenedSectionId:p}=Io(),h=ki({defaultValues:{attested:!1},resolver:yo(ne.object({attested:ne.boolean().refine($=>$===!0,{message:"You must attest that the data is true, accurate, and complete."})}))}),{sectionStatuses:f}=pH(s,d,i,o),m=((E=i==null?void 0:i.outstanding)==null?void 0:E.questionIds)??[],b=(i==null?void 0:i.questionResponses)??[],g=c.useMemo(()=>{const $=b.map(_=>_.questionId??"undefined");return[...new Set([...m,...$])]},[m,b]),{data:v}=jp({questionIds:g.join(",")}),x=$=>{var z,P,O;if(!$.parentQuestionId)return!0;const _=(z=v==null?void 0:v.questions)==null?void 0:z.find(H=>H.id===$.parentQuestionId);if(!_)return!1;const T=(P=b.find(H=>H.questionId===_.id))==null?void 0:P.values;if(!T)return!1;const F=(O=_==null?void 0:_.subQuestions)==null?void 0:O.find(H=>{var V;return(V=H.questionIds)==null?void 0:V.includes($.id??"")});return typeof(F==null?void 0:F.anyValuesMatch)=="string"?T.includes(F.anyValuesMatch):Array.isArray(F==null?void 0:F.anyValuesMatch)?T.some(H=>{var V;return(V=F.anyValuesMatch)==null?void 0:V.includes(H)}):!1},w=((N=i==null?void 0:i.parties)==null?void 0:N.filter($=>{var _;return($==null?void 0:$.partyType)==="INDIVIDUAL"&&((_=$==null?void 0:$.roles)==null?void 0:_.includes("BENEFICIAL_OWNER"))&&$.active}))||[],C=ure(hf,w,i),M=["personal-section","business-section","owners-section","additional-questions-section"],S=M.some($=>f[$]!=="completed"),[I,L]=c.useState(!1);return u.jsx(ur,{...h,children:u.jsxs("form",{onSubmit:$=>{$.preventDefault(),S?L(!0):h.handleSubmit(()=>{t()})($)},className:"eb-flex eb-flex-auto eb-flex-col",children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(gr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Your application is not submitted yet. Review your data and continue to finish."})]}),S&&I&&u.jsxs(rn,{variant:"warning",children:[u.jsx(Fn,{className:"eb-h-4 eb-w-4"}),u.jsx(vr,{children:"There is a problem"}),u.jsx(on,{children:"Please provide missing details before finishing your application."})]}),u.jsx("div",{children:u.jsx(YF,{type:"single",collapsible:!0,className:"eb-w-full",defaultValue:p??void 0,children:s.filter($=>M.includes($.id)).map($=>{var F,z,P;let _=null;const T=f[$.id]==="completed";if($.type==="stepper"&&$.id!=="review-attest-section"){const O=(F=$.stepperConfig)==null?void 0:F.associatedPartyFilters,H=O?(z=i==null?void 0:i.parties)==null?void 0:z.find(V=>{var G;return(V==null?void 0:V.partyType)===O.partyType&&((G=O.roles)==null?void 0:G.every(j=>{var U;return(U=V==null?void 0:V.roles)==null?void 0:U.includes(j)}))&&V.active}):void 0;_=u.jsx(dre,{steps:$.stepperConfig.steps,partyData:H,onEditClick:V=>{l($.id,{initialStepperStepId:V,editingPartyId:H==null?void 0:H.id})}})}else if($.id==="owners-section"){const O=()=>{l("owners-section")};_=u.jsxs(dn,{className:"eb-mt-6 eb-p-4",children:[u.jsxs("div",{className:"eb-flex eb-items-start eb-justify-between",children:[u.jsx("h2",{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Owners"}),T?u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"eb-h-8 eb-p-2 eb-text-sm",onClick:O,children:[u.jsx(yi,{}),"Change"]}):u.jsxs(_e,{variant:"default",type:"button",size:"sm",className:"eb-bg-warning eb-text-sm hover:eb-bg-warning/90",onClick:O,children:[u.jsx(yi,{}),"Add"]})]}),u.jsxs("div",{className:"eb-mt-4 eb-space-y-4",children:[w.length===0&&u.jsx(dn,{className:"eb-mt-6 eb-p-4 eb-shadow-md",children:u.jsxs("div",{className:"eb-flex eb-flex-col eb-items-center eb-space-y-3",children:[u.jsx("div",{className:"eb-flex eb-h-8 eb-w-8 eb-items-center eb-justify-center eb-rounded-full eb-bg-primary eb-stroke-white",children:u.jsx(z1,{className:"eb-size-4 eb-fill-white eb-stroke-white"})}),u.jsx("p",{className:"eb-text-sm",children:"No stakeholders added yet."})]})}),w.map(H=>{var V,G,j;return u.jsxs(dn,{className:"eb-space-y-4 eb-rounded-lg eb-border eb-p-4",children:[u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx(wi,{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:rf(H)}),u.jsx("p",{className:"eb-text-sm eb-font-medium",children:((V=H.individualDetails)==null?void 0:V.jobTitle)==="Other"?`${a("jobTitles.Other")} - ${H.individualDetails.jobTitleDescription}`:a([`jobTitles.${(G=H.individualDetails)==null?void 0:G.jobTitle}`])}),u.jsxs("div",{className:"eb-flex eb-gap-2 eb-pt-2",children:[u.jsx(cr,{variant:"outline",className:"eb-border-transparent eb-bg-[#EDF4FF] eb-text-[#355FA1]",children:"Owner"}),((j=H.roles)==null?void 0:j.includes("CONTROLLER"))&&u.jsx(cr,{variant:"outline",className:"eb-border-transparent eb-bg-[#FFEBD9] eb-text-[#8F521F]",children:"Controller"})]})]}),H.id&&!C[H.id].allStepsValid&&u.jsxs("p",{className:"eb-mt-1 eb-text-sm eb-font-normal eb-text-orange-500",children:["ⓘ"," This individual is missing some details."]})]},H.id)})]})]})}else $.id==="additional-questions-section"&&(_=u.jsxs(dn,{className:"eb-mt-6 eb-space-y-3 eb-rounded-lg eb-border eb-p-4",children:[u.jsxs("div",{className:"eb-flex eb-items-start eb-justify-between",children:[u.jsx("h2",{className:"eb-text-xl eb-font-bold eb-tracking-tight",children:"Operational details"}),u.jsxs(_e,{variant:"ghost",type:"button",size:"sm",className:"eb-h-8 eb-p-2 eb-text-sm",onClick:()=>{l("additional-questions-section")},children:[u.jsx(yi,{}),"Change"]})]}),(P=v==null?void 0:v.questions)==null?void 0:P.map(O=>{var G,j;if(!x(O))return null;const H=(G=O.description)==null?void 0:G.split(`
7783
7783
  `).map((U,D)=>u.jsx("p",{className:ye({"eb-ml-4":D>0}),children:U},D));if(O.id&&((j=i==null?void 0:i.outstanding.questionIds)!=null&&j.includes(O.id)))return u.jsxs("div",{className:"eb-space-y-0.5",children:[u.jsx("div",{className:"eb-text-sm eb-font-medium",children:H}),u.jsxs("div",{className:"eb-flex eb-items-center eb-gap-1 eb-text-warning",children:[u.jsx(Fn,{className:"eb-size-4"}),u.jsx("p",{className:"eb-italic",children:"This field is missing"})]})]},O.id);const V=b==null?void 0:b.find(U=>U.questionId===O.id);return u.jsxs("div",{className:"eb-space-y-0.5",children:[u.jsx("div",{className:"eb-text-sm eb-font-medium",children:H}),u.jsxs("div",{children:[u.jsxs("b",{children:[a("reviewAndAttest.response"),":"]})," ",V&&QPe(V)||u.jsx("span",{className:"eb-italic eb-text-muted-foreground",children:a("common:empty")})]})]},O.id)})]}));return u.jsxs(Dh,{value:$.id,className:ye({"eb-border-success":T,"eb-border-warning":!T}),children:[u.jsxs(Th,{className:ye({"eb-bg-success-accent":T,"eb-bg-warning-accent":!T}),children:[u.jsx(ao,{className:"eb-ml-2 eb-h-4 eb-w-4 eb-shrink-0 eb-transition-transform eb-duration-200"}),u.jsx("div",{className:"eb-ml-2 eb-text-sm",children:$.sectionConfig.label}),u.jsx("div",{className:"eb-ml-auto eb-mr-2 eb-flex eb-items-center eb-gap-2 eb-text-sm eb-font-normal eb-text-muted-foreground",children:T?u.jsxs(u.Fragment,{children:[u.jsx("p",{children:"Complete"}),u.jsx(Lr,{className:"eb-size-4 eb-text-success"})]}):u.jsxs(u.Fragment,{children:[u.jsx("p",{children:"Missing details"}),u.jsx(Fn,{className:"eb-size-4 eb-text-warning"})]})})]}),u.jsx(ZF,{className:"eb-mt-4",children:_})]},$.id)})})}),u.jsxs("div",{className:"eb-space-y-2",children:[u.jsx("p",{className:"eb-text-sm eb-font-medium",children:"Data accuracy attestation"}),u.jsx(jt,{control:h.control,name:"attested",render:({field:$})=>u.jsxs(Ct,{children:[u.jsxs("div",{className:"eb-flex eb-items-start eb-space-x-3",children:[u.jsx(it,{children:u.jsx(mo,{className:"eb-mt-0.5 eb-rounded-sm",checked:$.value,onCheckedChange:$.onChange})}),u.jsx($t,{className:"eb-text-sm eb-font-normal eb-text-foreground peer-disabled:eb-cursor-not-allowed peer-disabled:eb-opacity-70",children:"The data I am providing is true, accurate and complete to the best of my knowledge."})]}),u.jsx(Ht,{})]})})]})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{onClick:e,variant:"secondary",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":n()===null}),children:n()}),u.jsx(_e,{type:"submit",variant:"default",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":r()===null}),children:r()})]})})]})})},SRe=()=>Zne().replace(/[^a-zA-Z0-9_-]/g,""),MRe=({handlePrev:e,handleNext:t,getPrevButtonLabel:n,getNextButtonLabel:r})=>{var _;const{clientData:i,onPostClientSettled:o}=Kr(),{updateSessionData:a}=Io(),{t:s}=Qt("onboarding"),l=ki({defaultValues:{attested:!1},resolver:yo(ne.object({attested:ne.boolean().refine(T=>T===!0,{message:"You must agree to all of the documents listed on this page."})}))}),{data:d}=Xne(),[p,h]=c.useState({}),[f,m]=c.useState({}),[b,g]=c.useState({}),{mutateAsync:v,error:x}=ra(),{mutateAsync:w,error:C}=vX(),M=((_=i==null?void 0:i.outstanding)==null?void 0:_.attestationDocumentIds)||[],S=sO({queries:M.map(T=>({queryKey:["documentDetail",T],queryFn:()=>kX(T)}))}),I=M.every(T=>p[T]||b[T]),L=T=>async()=>{try{g(H=>({...H,[T]:null})),m(H=>({...H,[T]:!0}));const F=await CX(T,{responseType:"blob"}),z=new Blob([F],{type:"application/pdf"}),P=URL.createObjectURL(z),O=window.open(P,"_blank");if(!O)throw new Error("Failed to open document. Please check your popup blocker settings.");O.focus(),h(H=>({...H,[T]:!0}))}catch(F){g(z=>({...z,[T]:F instanceof Error?F.message:"Failed to download document"})),h(z=>({...z,[T]:!0}))}finally{m(F=>({...F,[T]:!1}))}},E=async()=>{var T,F,z,P,O,H,V;if(i!=null&&i.id){const G={addAttestations:[{attestationTime:new Date().toISOString(),attesterFullName:(z=(F=(T=i==null?void 0:i.parties)==null?void 0:T.find(U=>(U==null?void 0:U.partyType)==="INDIVIDUAL"))==null?void 0:F.individualDetails)==null?void 0:z.firstName,ipAddress:d,documentId:(O=(P=i==null?void 0:i.outstanding)==null?void 0:P.attestationDocumentIds)==null?void 0:O[0]}]},j={consumerDevice:{ipAddress:d,sessionId:SRe()}};try{(V=(H=i==null?void 0:i.outstanding)==null?void 0:H.attestationDocumentIds)!=null&&V.length&&await v({id:i.id,data:G},{onSettled:(U,D)=>{var A;o==null||o(U,(A=D==null?void 0:D.response)==null?void 0:A.data)}}),await w({id:i.id,data:j},{onSuccess:()=>{a({mockedKycCompleted:!0}),t()}})}catch(U){console.error("Error completing KYC process:",U)}}};c.useEffect(()=>{const T=S.reduce((z,P)=>{var O;return(O=P.data)!=null&&O.id&&(z[P.data.id]=!1),z},{});Object.keys(T).some(z=>!(z in p))&&h(T)},[S.map(T=>{var F;return(F=T.data)==null?void 0:F.id}).filter(Boolean)]);const[N,$]=c.useState(!1);return u.jsx(ur,{...l,children:u.jsxs("form",{onSubmit:T=>{T.preventDefault(),I?l.handleSubmit(()=>{E()})(T):$(!0)},className:"eb-flex eb-flex-auto eb-flex-col",children:[u.jsxs("div",{className:"eb-mt-6 eb-flex-auto eb-space-y-6",children:[!I&&N&&u.jsxs(rn,{variant:"destructive",noTitle:!0,children:[u.jsx(ar,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"Please open the document links and confirm that you have read and agree to all documents."})]}),u.jsx("div",{className:"eb-mt-2 eb-flex eb-flex-col eb-gap-2",children:M.map(T=>{var z,P;const F=S.find(O=>{var H;return((H=O.data)==null?void 0:H.id)===T});return u.jsxs("div",{className:"eb-flex eb-flex-col eb-gap-1",children:[u.jsxs(_e,{type:"button",onClick:L(T),variant:"ghost",className:ye("eb-flex eb-h-14 eb-w-full eb-justify-between eb-rounded-md eb-border eb-bg-card eb-px-4 eb-py-2 eb-font-sans eb-text-sm eb-font-normal eb-shadow-md",{"eb-border-success eb-bg-success-accent hover:eb-bg-success-accent/80":p[T]}),disabled:(F==null?void 0:F.isFetching)||f[T],children:[u.jsxs("span",{className:"eb-flex eb-items-center eb-gap-2",children:[u.jsx($1,{}),u.jsx("p",{className:"eb-text-[#12647E] eb-underline",children:F!=null&&F.isFetching?"Loading...":(z=F==null?void 0:F.data)==null?void 0:z.documentType}),u.jsx(t0,{className:"eb-text-[#12647E]"})]}),u.jsxs("span",{children:[p[T]&&u.jsx(Ri,{className:"eb-text-success"}),f[T]&&s("reviewAndAttest.termsAndConditions.downloading")]})]}),((P=F==null?void 0:F.data)==null?void 0:P.id)&&b[F==null?void 0:F.data.id]&&u.jsxs("div",{className:"eb-ml-1 eb-text-sm eb-text-destructive",children:["Failed to download document: ",b[T]]}),!F&&b[T]&&u.jsxs("div",{className:"eb-ml-1 eb-text-sm eb-text-destructive",children:["Failed to fetch document details: ",b[T]]})]},T)})}),u.jsxs("div",{className:"eb-space-y-1",children:[u.jsx("p",{className:"eb-text-sm eb-font-medium",children:"Document attestation"}),u.jsx(jt,{control:l.control,name:"attested",disabled:!I,render:({field:T})=>u.jsxs(Ct,{children:[u.jsxs("div",{className:"eb-flex eb-items-center eb-space-x-2",children:[u.jsx(it,{children:u.jsx(mo,{checked:T.value,onCheckedChange:T.onChange,disabled:T.disabled})}),u.jsx($t,{className:"eb-text-sm eb-font-normal eb-text-foreground peer-disabled:eb-cursor-not-allowed peer-disabled:eb-opacity-70",children:"I have read and agree to all of the documents listed on this page"})]}),u.jsx(Ht,{})]})})]}),!I&&u.jsxs(rn,{variant:"informative",noTitle:!0,children:[u.jsx(gr,{className:"eb-h-4 eb-w-4"}),u.jsx(on,{children:"You must open and review all documents before selecting the checkbox"})]}),u.jsx(Gr,{error:x||C})]}),u.jsx("div",{className:"eb-mt-6 eb-space-y-6",children:u.jsxs("div",{className:"eb-flex eb-justify-between eb-gap-4",children:[u.jsx(_e,{onClick:e,variant:"secondary",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":n()===null}),children:n()}),u.jsx(_e,{type:"submit",variant:"default",size:"lg",className:ye("eb-w-full eb-text-lg",{"eb-hidden":r()===null}),children:r()})]})})]})})},IRe=[{id:"gateway",isSection:!1,type:"component",Component:uRe},{id:"checklist",isSection:!1,type:"component",Component:Q_e},{id:"overview",isSection:!1,type:"component",Component:fRe},{id:"owner-stepper",isSection:!1,type:"stepper",stepperConfig:{associatedPartyFilters:{partyType:"INDIVIDUAL",roles:["BENEFICIAL_OWNER"]},defaultPartyRequestBody:{partyType:"INDIVIDUAL",roles:["BENEFICIAL_OWNER"]},steps:hf}},{id:"document-upload-form",isSection:!1,type:"component",Component:oRe}],LRe=[{id:"personal-section",isSection:!0,type:"stepper",sectionConfig:{label:"Your personal details",shortLabel:"Personal details",icon:j1,requirementsList:["Your name and job title","Government issued identifier (e.g. social security number)","Address and contact details"],statusResolver:(e,t,n,r)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":Object.entries(r).some(([,o])=>o.isValid)?"missing_details":"not_started"},stepperConfig:{associatedPartyFilters:{partyType:"INDIVIDUAL",roles:["CONTROLLER"]},defaultPartyRequestBody:{partyType:"INDIVIDUAL",roles:["CONTROLLER"]},steps:[{id:"personal-details",title:"Your personal details",stepType:"form",description:"We collect your personal information as the primary person controlling business operations for the company.",Component:pf},{id:"identity-document",title:"Your ID details",stepType:"form",description:"We need some additional details to confirm your identity.",Component:VH},{id:"contact-details",title:"Your contact details",stepType:"form",description:"We need some additional details to confirm your identity.",Component:U$},{id:"check-answers",title:"Check your answers",stepType:"check-answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}]}},{id:"business-section",isSection:!0,type:"stepper",sectionConfig:{label:"Business details",icon:E1,requirementsList:["Industry classification code","Registration ID details (e.g. employer identification number)","Location and contact details"],statusResolver:(e,t,n)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":"not_started"},stepperConfig:{associatedPartyFilters:{partyType:"ORGANIZATION",roles:["CLIENT"]},defaultPartyRequestBody:{partyType:"ORGANIZATION",roles:["CLIENT"]},steps:[{id:"industry",stepType:"form",title:"Industry classification",description:"Choose a classification that best describes your income-producing lines of business.",Component:coe},{id:"company-identification",stepType:"form",title:"Business identity",description:"Please provide details about your business.",Component:loe},{id:"customer-facing-details",stepType:"form",title:"Description & website",description:"Please help us understand the products and services you offer.",Component:V$},{id:"contact-info",stepType:"form",title:"Contact information",description:"Please let us know how to get in touch.",Component:hH},{id:"check-answers",stepType:"check-answers",title:"Check your answers",description:"Please ensure your answers are accurate and complete anything you may have missed."}]}},{id:"owners-section",isSection:!0,type:"component",sectionConfig:{label:"Owners and key roles",icon:ls,requirementsList:["Name and job titles for all individuals","Government issued identifier (e.g. social security number)","Address and contact details"],statusResolver:(e,t)=>{const n=YPe(t),r=n==null?void 0:n.every(i=>{const{allStepsValid:o}=of(hf,i,t);return o});return e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":r?e.isOwnersSectionDone?"completed":"not_started":"missing_details"}},Component:kRe},{id:"additional-questions-section",isSection:!0,type:"component",sectionConfig:{label:"Operational details",icon:u0,requirementsList:["Total annual revenue","Additional questions based on your business profile"],statusResolver:(e,t)=>{var r,i;const n=((i=(r=t==null?void 0:t.outstanding)==null?void 0:r.questionIds)==null?void 0:i.length)===0;return e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":n?"completed":"not_started"}},Component:hRe},{id:"review-attest-section",isSection:!0,type:"stepper",sectionConfig:{label:"Review and attest",icon:$1,statusResolver:(e,t)=>e.mockedKycCompleted||(t==null?void 0:t.status)==="INFORMATION_REQUESTED"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"||(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":"not_started"},stepperConfig:{steps:[{id:"review",title:"Review your details",stepType:"static",description:"Please ensure your answers are accurate and complete anything you may have missed.",Component:CRe},{id:"documents",title:"Terms and conditions",stepType:"static",description:"Please open and review the following documents from J.P. Morgan to complete the process.",Component:MRe}]}},{id:"upload-documents-section",isSection:!0,type:"component",sectionConfig:{label:"Supporting documents",icon:Ca,onHoldText:"We'll let you know if any documents are needed",statusResolver:(e,t,n,r,i)=>{var s,l;const o=(s=t==null?void 0:t.parties)==null?void 0:s.some(d=>{var p;return(p=d.validationResponse)==null?void 0:p.some(h=>{var f;return!!((f=h.documentRequestIds)!=null&&f.length)})}),a=cre(i);return(t==null?void 0:t.status)==="INFORMATION_REQUESTED"&&((l=t.outstanding.documentRequestIds)!=null&&l.length||o)?"not_started":(t==null?void 0:t.status)==="NEW"||(t==null?void 0:t.status)==="REVIEW_IN_PROGRESS"?a?"completed_disabled":"on_hold":(t==null?void 0:t.status)==="APPROVED"||(t==null?void 0:t.status)==="DECLINED"?"hidden":"completed_disabled"}},Component:cRe}],hoe={screens:[...IRe,...LRe]},ERe=({initialClientId:e,onboardingContentTokens:t={},alertOnExit:n=!1,userEventsToTrack:r=[],userEventsHandler:i,height:o,onGetClientSettledSettled:a,...s})=>{var S,I;const[l,d]=c.useState(e??""),{interceptorReady:p}=dye(),{data:h,status:f,error:m}=Li(l,{query:{enabled:!!l&&p,refetchOnWindowFocus:!1}});c.useEffect(()=>{a&&a(h,f,m)},[h,f,m,a]);const{data:{documentRequests:b}={}}=Zz({clientId:l});c.useEffect(()=>{d(e??"")},[e]);const g=(S=h==null?void 0:h.parties)==null?void 0:S.find(L=>L.partyType==="ORGANIZATION"),v=(I=g==null?void 0:g.organizationDetails)==null?void 0:I.organizationType,{tokens:x={}}=WZ(),{i18n:w,t:C}=Qt(["onboarding-overview","onboarding"]);c.useEffect(()=>{j0(w.language,"onboarding",[x.onboarding,t])},[w.language,JSON.stringify(x.onboarding),JSON.stringify(t)]),c.useEffect(()=>{const L=E=>{E.preventDefault(),E.returnValue=!0};return n&&window.addEventListener("beforeunload",L),()=>{window.removeEventListener("beforeunload",L)}},[n]);const M=c.useCallback(L=>{var N;const E=L.target;Object.keys(E.dataset).includes("userEventTracking")&&(i==null||i({actionName:`${L.type} on ${(N=E.dataset)==null?void 0:N.userEventTracking}`}))},[]);return c.useEffect(()=>{if((r==null?void 0:r.length)>0&&i){const L=document.getElementById("eb-component");return r.forEach(E=>L==null?void 0:L.addEventListener(E,M)),()=>{r.forEach(E=>L==null?void 0:L.removeEventListener(E,M))}}return()=>{}},[]),yX({userEmail:"test@test.com",DOMElementToTrack:"embedded-component-layout",eventsToTrack:["click","blur"]}),u.jsx(ZJ.Provider,{value:{...s,clientData:h,setClientId:d,organizationType:v,documentRequests:b},children:u.jsx("div",{id:"embedded-component-layout",className:"eb-component eb-mx-auto eb-flex eb-flex-1 eb-flex-col eb-bg-background eb-p-4 eb-pb-6 eb-font-sans eb-text-foreground eb-antialiased sm:eb-max-w-screen-sm sm:eb-p-10 sm:eb-pb-12",style:{minHeight:o},children:m?u.jsx(Gr,{error:m}):f==="pending"&&e?u.jsx(Ts,{message:C("onboarding:fetchingClientData")}):u.jsx(WPe,{initialScreenId:s.docUploadOnlyMode?"upload-documents-section":v?"overview":"gateway",flowConfig:hoe,children:u.jsx(ARe,{})})},e)})},ARe=()=>{const{clientData:e,organizationType:t,docUploadOnlyMode:n}=Kr(),{currentScreenId:r,goTo:i,sessionData:o,updateSessionData:a}=Io(),s=c.useRef(null),l=c.useRef(!0);c.useEffect(()=>{var h;if(l.current){l.current=!1;return}(h=s.current)==null||h.scrollIntoView({behavior:"smooth",block:"start"})},[r]),c.useEffect(()=>{n&&!["upload-documents-section","document-upload-form"].includes(r)?i("upload-documents-section",{resetHistory:!0}):!n&&!t&&r!=="gateway"&&i("gateway",{resetHistory:!0})},[r,n,t]),c.useEffect(()=>{if(o.mockedVerifyingSectionId){const h=setTimeout(()=>{a({mockedVerifyingSectionId:void 0})},1500);return()=>clearTimeout(h)}return()=>{}},[o.mockedVerifyingSectionId]);const d=hoe.screens.find(h=>h.id===r),p=()=>{if(!d)return u.jsxs("div",{children:["Unknown screen id: ",r]});if(d.type==="component"){const h=d.Component;return u.jsx(h,{})}return d.type==="stepper"?u.jsx(JPe,{...d.stepperConfig}):u.jsx("div",{children:"Unhandled screen error"})};return u.jsx("div",{className:"eb-flex eb-flex-1 eb-scroll-mt-44 sm:eb-scroll-mt-48",ref:s,children:u.jsx("div",{className:"eb-w-full",children:p()})},e==null?void 0:e.id)};var zt={context:void 0,registry:void 0,getContextId(){return foe(this.context.count)},getNextContextId(){return foe(this.context.count++)}};function foe(e){const t=String(e),n=t.length-1;return zt.context.id+(n?String.fromCharCode(96+n):"")+t}function ff(e){zt.context=e}var DRe=(e,t)=>e===t,G$=Symbol("solid-proxy"),W$=Symbol("solid-track"),K$={equals:DRe},moe=koe,Ga=1,Y$=2,goe={owned:null,cleanups:null,context:null,owner:null},GH={},nn=null,WH=null,TRe=null,gn=null,$r=null,Wa=null,Z$=0;function Ka(e,t){const n=gn,r=nn,i=e.length===0,o=t===void 0?r:t,a=i?goe:{owned:null,cleanups:null,context:o?o.context:null,owner:o},s=i?e:()=>e(()=>jn(()=>eP(a)));nn=a,gn=null;try{return ca(s,!0)}finally{gn=n,nn=r}}function Ge(e,t){t=t?Object.assign({},K$,t):K$;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),woe(n,i));return[xoe.bind(n),r]}function yoe(e,t,n){const r=X$(e,t,!0,Ga);f2(r)}function ct(e,t,n){const r=X$(e,t,!1,Ga);f2(r)}function rt(e,t,n){moe=qRe;const r=X$(e,t,!1,Ga);(!n||!n.render)&&(r.user=!0),Wa?Wa.push(r):f2(r)}function Le(e,t,n){n=n?Object.assign({},K$,n):K$;const r=X$(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,f2(r),xoe.bind(r)}function NRe(e){return e&&typeof e=="object"&&"then"in e}function FRe(e,t,n){let r,i,o;arguments.length===1?(r=!0,i=e,o={}):(r=e,i=t,o={});let a=null,s=GH,l=null,d=!1,p="initialValue"in o,h=typeof r=="function"&&Le(r);const f=new Set,[m,b]=(o.storage||Ge)(o.initialValue),[g,v]=Ge(void 0),[x,w]=Ge(void 0,{equals:!1}),[C,M]=Ge(p?"ready":"unresolved");if(zt.context){l=zt.getNextContextId();let N;o.ssrLoadFrom==="initial"?s=o.initialValue:zt.load&&(N=zt.load(l))&&(s=N)}function S(N,$,_,T){return a===N&&(a=null,T!==void 0&&(p=!0),(N===s||$===s)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(T,{value:$})),s=GH,I($,_)),$}function I(N,$){ca(()=>{$===void 0&&b(()=>N),M($!==void 0?"errored":p?"ready":"unresolved"),v($);for(const _ of f.keys())_.decrement();f.clear()},!1)}function L(){const N=_Re,$=m(),_=g();if(_!==void 0&&!a)throw _;return gn&&gn.user,$}function E(N=!0){if(N!==!1&&d)return;d=!1;const $=h?h():r;if($==null||$===!1){S(a,jn(m));return}const _=s!==GH?s:jn(()=>i($,{value:m(),refetching:N}));return NRe(_)?(a=_,"value"in _?(_.status==="success"?S(a,_.value,void 0,$):S(a,void 0,KH(_.value),$),_):(d=!0,queueMicrotask(()=>d=!1),ca(()=>{M(p?"refreshing":"pending"),w()},!1),_.then(T=>S(_,T,void 0,$),T=>S(_,void 0,KH(T),$)))):(S(a,_,void 0,$),_)}return Object.defineProperties(L,{state:{get:()=>C()},error:{get:()=>g()},loading:{get(){const N=C();return N==="pending"||N==="refreshing"}},latest:{get(){if(!p)return L();const N=g();if(N&&!a)throw N;return m()}}}),h?yoe(()=>E(!1)):E(!1),[L,{refetch:E,mutate:b}]}function $Re(e){return ca(e,!1)}function jn(e){if(gn===null)return e();const t=gn;gn=null;try{return e()}finally{gn=t}}function Ya(e,t,n){const r=Array.isArray(e);let i,o=n&&n.defer;return a=>{let s;if(r){s=Array(e.length);for(let d=0;d<e.length;d++)s[d]=e[d]()}else s=e();if(o)return o=!1,a;const l=jn(()=>t(s,i,a));return i=s,l}}function a1(e){rt(()=>jn(e))}function ut(e){return nn===null||(nn.cleanups===null?nn.cleanups=[e]:nn.cleanups.push(e)),e}function boe(){return nn}function PRe(e,t){const n=nn,r=gn;nn=e,gn=null;try{return ca(t,!0)}catch(i){YH(i)}finally{nn=n,gn=r}}function ORe(e){const t=gn,n=nn;return Promise.resolve().then(()=>{gn=t,nn=n;let r;return ca(e,!1),gn=nn=null,r?r.done:void 0})}var[jRe,vXe]=Ge(!1);function zRe(){return[jRe,ORe]}function kr(e,t){const n=Symbol("context");return{id:n,Provider:BRe(n),defaultValue:e}}function Cr(e){let t;return nn&&nn.context&&(t=nn.context[e.id])!==void 0?t:e.defaultValue}function voe(e){const t=Le(e),n=Le(()=>ZH(t()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}var _Re;function xoe(){if(this.sources&&this.state)if(this.state===Ga)f2(this);else{const e=$r;$r=null,ca(()=>J$(this),!1),$r=e}if(gn){const e=this.observers?this.observers.length:0;gn.sources?(gn.sources.push(this),gn.sourceSlots.push(e)):(gn.sources=[this],gn.sourceSlots=[e]),this.observers?(this.observers.push(gn),this.observerSlots.push(gn.sources.length-1)):(this.observers=[gn],this.observerSlots=[gn.sources.length-1])}return this.value}function woe(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&ca(()=>{for(let i=0;i<e.observers.length;i+=1){const o=e.observers[i],a=WH&&WH.running;a&&WH.disposed.has(o),(a?!o.tState:!o.state)&&(o.pure?$r.push(o):Wa.push(o),o.observers&&Coe(o)),a||(o.state=Ga)}if($r.length>1e6)throw $r=[],new Error},!1)),t}function f2(e){if(!e.fn)return;eP(e);const t=Z$;RRe(e,e.value,t)}function RRe(e,t,n){let r;const i=nn,o=gn;gn=nn=e;try{r=e.fn(t)}catch(a){return e.pure&&(e.state=Ga,e.owned&&e.owned.forEach(eP),e.owned=null),e.updatedAt=n+1,YH(a)}finally{gn=o,nn=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?woe(e,r):e.value=r,e.updatedAt=n)}function X$(e,t,n,r=Ga,i){const o={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:nn,context:nn?nn.context:null,pure:n};return nn===null||nn!==goe&&(nn.owned?nn.owned.push(o):nn.owned=[o]),o}function Q$(e){if(e.state===0)return;if(e.state===Y$)return J$(e);if(e.suspense&&jn(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Z$);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===Ga)f2(e);else if(e.state===Y$){const r=$r;$r=null,ca(()=>J$(e,t[0]),!1),$r=r}}function ca(e,t){if($r)return e();let n=!1;t||($r=[]),Wa?n=!0:Wa=[],Z$++;try{const r=e();return HRe(n),r}catch(r){n||(Wa=null),$r=null,YH(r)}}function HRe(e){if($r&&(koe($r),$r=null),e)return;const t=Wa;Wa=null,t.length&&ca(()=>moe(t),!1)}function koe(e){for(let t=0;t<e.length;t++)Q$(e[t])}function qRe(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:Q$(r)}if(zt.context){if(zt.count){zt.effects||(zt.effects=[]),zt.effects.push(...e.slice(0,n));return}else zt.effects&&(e=[...zt.effects,...e],n+=zt.effects.length,delete zt.effects);ff()}for(t=0;t<n;t++)Q$(e[t])}function J$(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===Ga?r!==t&&(!r.updatedAt||r.updatedAt<Z$)&&Q$(r):i===Y$&&J$(r,t)}}}function Coe(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Y$,n.pure?$r.push(n):Wa.push(n),n.observers&&Coe(n))}}function eP(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(),a=n.observerSlots.pop();r<i.length&&(o.sourceSlots[a]=r,i[r]=o,n.observerSlots[r]=a)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)eP(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 KH(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function YH(e,t=nn){throw KH(e)}function ZH(e){if(typeof e=="function"&&!e.length)return ZH(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=ZH(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function BRe(e,t){return function(r){let i;return ct(()=>i=jn(()=>(nn.context={...nn.context,[e]:r.value},voe(()=>r.children))),void 0),i}}var XH=Symbol("fallback");function tP(e){for(let t=0;t<e.length;t++)e[t]()}function VRe(e,t,n={}){let r=[],i=[],o=[],a=0,s=t.length>1?[]:null;return ut(()=>tP(o)),()=>{let l=e()||[],d=l.length,p,h;return l[W$],jn(()=>{let m,b,g,v,x,w,C,M,S;if(d===0)a!==0&&(tP(o),o=[],r=[],i=[],a=0,s&&(s=[])),n.fallback&&(r=[XH],i[0]=Ka(I=>(o[0]=I,n.fallback())),a=1);else if(a===0){for(i=new Array(d),h=0;h<d;h++)r[h]=l[h],i[h]=Ka(f);a=d}else{for(g=new Array(d),v=new Array(d),s&&(x=new Array(d)),w=0,C=Math.min(a,d);w<C&&r[w]===l[w];w++);for(C=a-1,M=d-1;C>=w&&M>=w&&r[C]===l[M];C--,M--)g[M]=i[C],v[M]=o[C],s&&(x[M]=s[C]);for(m=new Map,b=new Array(M+1),h=M;h>=w;h--)S=l[h],p=m.get(S),b[h]=p===void 0?-1:p,m.set(S,h);for(p=w;p<=C;p++)S=r[p],h=m.get(S),h!==void 0&&h!==-1?(g[h]=i[p],v[h]=o[p],s&&(x[h]=s[p]),h=b[h],m.set(S,h)):o[p]();for(h=w;h<d;h++)h in g?(i[h]=g[h],o[h]=v[h],s&&(s[h]=x[h],s[h](h))):i[h]=Ka(f);i=i.slice(0,a=d),r=l.slice(0)}return i});function f(m){if(o[h]=m,s){const[b,g]=Ge(h);return s[h]=g,t(l[h],b)}return t(l[h])}}}function URe(e,t,n={}){let r=[],i=[],o=[],a=[],s=0,l;return ut(()=>tP(o)),()=>{const d=e()||[],p=d.length;return d[W$],jn(()=>{if(p===0)return s!==0&&(tP(o),o=[],r=[],i=[],s=0,a=[]),n.fallback&&(r=[XH],i[0]=Ka(f=>(o[0]=f,n.fallback())),s=1),i;for(r[0]===XH&&(o[0](),o=[],r=[],i=[],s=0),l=0;l<p;l++)l<r.length&&r[l]!==d[l]?a[l](()=>d[l]):l>=r.length&&(i[l]=Ka(h));for(;l<r.length;l++)o[l]();return s=a.length=o.length=p,r=d.slice(0),i=i.slice(0,s)});function h(f){o[l]=f;const[m,b]=Ge(d[l]);return a[l]=b,t(m,l)}}}function ie(e,t){return jn(()=>e(t||{}))}function nP(){return!0}var QH={get(e,t,n){return t===G$?n:e.get(t)},has(e,t){return t===G$?!0:e.has(t)},set:nP,deleteProperty:nP,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:nP,deleteProperty:nP}},ownKeys(e){return e.keys()}};function JH(e){return(e=typeof e=="function"?e():e)?e:{}}function GRe(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function Dt(...e){let t=!1;for(let a=0;a<e.length;a++){const s=e[a];t=t||!!s&&G$ in s,e[a]=typeof s=="function"?(t=!0,Le(s)):s}if(t)return new Proxy({get(a){for(let s=e.length-1;s>=0;s--){const l=JH(e[s])[a];if(l!==void 0)return l}},has(a){for(let s=e.length-1;s>=0;s--)if(a in JH(e[s]))return!0;return!1},keys(){const a=[];for(let s=0;s<e.length;s++)a.push(...Object.keys(JH(e[s])));return[...new Set(a)]}},QH);const n={},r=Object.create(null);for(let a=e.length-1;a>=0;a--){const s=e[a];if(!s)continue;const l=Object.getOwnPropertyNames(s);for(let d=l.length-1;d>=0;d--){const p=l[d];if(p==="__proto__"||p==="constructor")continue;const h=Object.getOwnPropertyDescriptor(s,p);if(!r[p])r[p]=h.get?{enumerable:!0,configurable:!0,get:GRe.bind(n[p]=[h.get.bind(s)])}:h.value!==void 0?h:void 0;else{const f=n[p];f&&(h.get?f.push(h.get.bind(s)):h.value!==void 0&&f.push(()=>h.value))}}}const i={},o=Object.keys(r);for(let a=o.length-1;a>=0;a--){const s=o[a],l=r[s];l&&l.get?Object.defineProperty(i,s,l):i[s]=l?l.value:void 0}return i}function ln(e,...t){if(G$ in e){const i=new Set(t.length>1?t.flat():t[0]),o=t.map(a=>new Proxy({get(s){return a.includes(s)?e[s]:void 0},has(s){return a.includes(s)&&s in e},keys(){return a.filter(s=>s in e)}},QH));return o.push(new Proxy({get(a){return i.has(a)?void 0:e[a]},has(a){return i.has(a)?!1:a in e},keys(){return Object.keys(e).filter(a=>!i.has(a))}},QH)),o}const n={},r=t.map(()=>({}));for(const i of Object.getOwnPropertyNames(e)){const o=Object.getOwnPropertyDescriptor(e,i),a=!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable;let s=!1,l=0;for(const d of t)d.includes(i)&&(s=!0,a?r[l][i]=o.value:Object.defineProperty(r[l],i,o)),++l;s||(a?n[i]=o.value:Object.defineProperty(n,i,o))}return[...r,n]}function WRe(e){let t,n;const r=i=>{const o=zt.context;if(o){const[s,l]=Ge();zt.count||(zt.count=0),zt.count++,(n||(n=e())).then(d=>{ff(o),zt.count--,l(()=>d.default),ff()}),t=s}else if(!t){const[s]=FRe(()=>(n||(n=e())).then(l=>l.default));t=s}let a;return Le(()=>(a=t())&&jn(()=>{if(!o)return a(i);const s=zt.context;ff(o);const l=a(i);return ff(s),l}))};return r.preload=()=>n||((n=e()).then(i=>t=()=>i.default),n),r}var KRe=0;function Qi(){return zt.context?zt.getNextContextId():`cl-${KRe++}`}var Soe=e=>`Stale read from <${e}>.`;function YRe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Le(VRe(()=>e.each,e.children,t||void 0))}function ZRe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Le(URe(()=>e.each,e.children,t||void 0))}function dt(e){const t=e.keyed,n=Le(()=>e.when,void 0,{equals:(r,i)=>t?r===i:!r==!i});return Le(()=>{const r=n();if(r){const i=e.children;return typeof i=="function"&&i.length>0?jn(()=>i(t?r:()=>{if(!jn(n))throw Soe("Show");return e.when})):i}return e.fallback},void 0,void 0)}function XRe(e){let t=!1;const n=(o,a)=>(t?o[1]===a[1]:!o[1]==!a[1])&&o[2]===a[2],r=voe(()=>e.children),i=Le(()=>{let o=r();Array.isArray(o)||(o=[o]);for(let a=0;a<o.length;a++){const s=o[a].when;if(s)return t=!!o[a].keyed,[a,s,o[a]]}return[-1]},void 0,{equals:n});return Le(()=>{const[o,a,s]=i();if(o<0)return e.fallback;const l=s.children;return typeof l=="function"&&l.length>0?jn(()=>l(t?a:()=>{if(jn(i)[0]!==o)throw Soe("Match");return s.when})):l},void 0,void 0)}function eq(e){return e}var QRe=["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"],JRe=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...QRe]),eHe=new Set(["innerHTML","textContent","innerText","children"]),tHe=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),nHe=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 rHe(e,t){const n=nHe[e];return typeof n=="object"?n[t]?n.$:void 0:n}var iHe=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),oHe=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"]),aHe={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function sHe(e,t,n){let r=n.length,i=t.length,o=r,a=0,s=0,l=t[i-1].nextSibling,d=null;for(;a<i||s<o;){if(t[a]===n[s]){a++,s++;continue}for(;t[i-1]===n[o-1];)i--,o--;if(i===a){const p=o<r?s?n[s-1].nextSibling:n[o-s]:l;for(;s<o;)e.insertBefore(n[s++],p)}else if(o===s)for(;a<i;)(!d||!d.has(t[a]))&&t[a].remove(),a++;else if(t[a]===n[o-1]&&n[s]===t[i-1]){const p=t[--i].nextSibling;e.insertBefore(n[s++],t[a++].nextSibling),e.insertBefore(n[--o],p),t[i]=n[o]}else{if(!d){d=new Map;let h=s;for(;h<o;)d.set(n[h],h++)}const p=d.get(t[a]);if(p!=null)if(s<p&&p<o){let h=a,f=1,m;for(;++h<i&&h<o&&!((m=d.get(t[h]))==null||m!==p+f);)f++;if(f>p-s){const b=t[a];for(;s<p;)e.insertBefore(n[s++],b)}else e.replaceChild(n[s++],t[a++])}else a++;else t[a++].remove()}}}var mf="_$DX_DELEGATE";function lHe(e,t,n,r={}){let i;return Ka(o=>{i=o,t===document?e():De(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=""}}function et(e,t,n){let r;const i=()=>{const a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},o=()=>(r||(r=i())).cloneNode(!0);return o.cloneNode=o,o}function rP(e,t=window.document){const n=t[mf]||(t[mf]=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,Aoe))}}function cHe(e=window.document){if(e[mf]){for(let t of e[mf].keys())e.removeEventListener(t,Aoe);delete e[mf]}}function $e(e,t,n){zt.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function uHe(e,t,n,r){zt.context&&e.isConnected||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function He(e,t){zt.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function Moe(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 dHe(e,t,n={}){const r=Object.keys(t||{}),i=Object.keys(n);let o,a;for(o=0,a=i.length;o<a;o++){const s=i[o];!s||s==="undefined"||t[s]||(Loe(e,s,!1),delete n[s])}for(o=0,a=r.length;o<a;o++){const s=r[o],l=!!t[s];!s||s==="undefined"||n[s]===l||!l||(Loe(e,s,!0),n[s]=l)}return n}function pHe(e,t,n){if(!t)return n?$e(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 Ioe(e,t={},n,r){const i={};return r||ct(()=>i.children=yf(e,t.children,i.children)),ct(()=>typeof t.ref=="function"&&gf(t.ref,e)),ct(()=>hHe(e,t,n,!0,i,!0)),i}function gf(e,t,n){return jn(()=>e(t,n))}function De(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return yf(e,t,r,n);ct(i=>yf(e,t(),i,n),r)}function hHe(e,t,n,r,i={},o=!1){t||(t={});for(const a in i)if(!(a in t)){if(a==="children")continue;i[a]=Eoe(e,a,null,i[a],n,o)}for(const a in t){if(a==="children")continue;const s=t[a];i[a]=Eoe(e,a,s,i[a],n,o)}}function fHe(e){let t,n;return!zt.context||!(t=zt.registry.get(n=gHe()))?e():(zt.completed&&zt.completed.add(t),zt.registry.delete(n),t)}function mHe(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Loe(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 Eoe(e,t,n,r,i,o){let a,s,l,d,p;if(t==="style")return pHe(e,n,r);if(t==="classList")return dHe(e,n,r);if(n===r)return r;if(t==="ref")o||n(e);else if(t.slice(0,3)==="on:"){const h=t.slice(3);r&&e.removeEventListener(h,r),n&&e.addEventListener(h,n)}else if(t.slice(0,10)==="oncapture:"){const h=t.slice(10);r&&e.removeEventListener(h,r,!0),n&&e.addEventListener(h,n,!0)}else if(t.slice(0,2)==="on"){const h=t.slice(2).toLowerCase(),f=iHe.has(h);if(!f&&r){const m=Array.isArray(r)?r[0]:r;e.removeEventListener(h,m)}(f||n)&&(Moe(e,h,n,f),f&&rP([h]))}else if(t.slice(0,5)==="attr:")$e(e,t.slice(5),n);else if((p=t.slice(0,5)==="prop:")||(l=eHe.has(t))||!i&&((d=rHe(t,e.tagName))||(s=JRe.has(t)))||(a=e.nodeName.includes("-"))){if(p)t=t.slice(5),s=!0;else if(zt.context&&e.isConnected)return n;t==="class"||t==="className"?He(e,n):a&&!s&&!l?e[mHe(t)]=n:e[d||t]=n}else{const h=i&&t.indexOf(":")>-1&&aHe[t.split(":")[0]];h?uHe(e,h,t,n):$e(e,tHe[t]||t,n)}return n}function Aoe(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}}),zt.registry&&!zt.done&&(zt.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 yf(e,t,n,r,i){const o=!!zt.context&&e.isConnected;if(o){!n&&(n=[...e.childNodes]);let l=[];for(let d=0;d<n.length;d++){const p=n[d];p.nodeType===8&&p.data.slice(0,2)==="!$"?p.remove():l.push(p)}n=l}for(;typeof n=="function";)n=n();if(t===n)return n;const a=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,a==="string"||a==="number"){if(o||a==="number"&&(t=t.toString(),t===n))return n;if(s){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=m2(e,n,r,l)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||a==="boolean"){if(o)return n;n=m2(e,n,r)}else{if(a==="function")return ct(()=>{let l=t();for(;typeof l=="function";)l=l();n=yf(e,l,n,r)}),()=>n;if(Array.isArray(t)){const l=[],d=n&&Array.isArray(n);if(tq(l,t,n,i))return ct(()=>n=yf(e,l,n,r,!0)),()=>n;if(o){if(!l.length)return n;if(r===void 0)return[...e.childNodes];let p=l[0],h=[p];for(;(p=p.nextSibling)!==r;)h.push(p);return n=h}if(l.length===0){if(n=m2(e,n,r),s)return n}else d?n.length===0?Doe(e,l,r):sHe(e,n,l):(n&&m2(e),Doe(e,l));n=l}else if(t.nodeType){if(o&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=m2(e,n,r,t);m2(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function tq(e,t,n,r){let i=!1;for(let o=0,a=t.length;o<a;o++){let s=t[o],l=n&&n[e.length],d;if(!(s==null||s===!0||s===!1))if((d=typeof s)=="object"&&s.nodeType)e.push(s);else if(Array.isArray(s))i=tq(e,s,l)||i;else if(d==="function")if(r){for(;typeof s=="function";)s=s();i=tq(e,Array.isArray(s)?s:[s],Array.isArray(l)?l:[l])||i}else e.push(s),i=!0;else{const p=String(s);l&&l.nodeType===3&&l.data===p?e.push(l):e.push(document.createTextNode(p))}}return i}function Doe(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function m2(e,t,n,r){if(n===void 0)return e.textContent="";const i=r||document.createTextNode("");if(t.length){let o=!1;for(let a=t.length-1;a>=0;a--){const s=t[a];if(i!==s){const l=s.parentNode===e;!o&&!a?l?e.replaceChild(i,s):e.insertBefore(i,n):l&&s.remove()}else o=!0}}else e.insertBefore(i,n);return[i]}function gHe(){return zt.getNextContextId()}var yHe="http://www.w3.org/2000/svg";function Toe(e,t=!1){return t?document.createElementNS(yHe,e):document.createElement(e)}function Noe(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,i=boe();let o,a=!!zt.context;return rt(()=>{a&&(boe().user=a=!1),o||(o=PRe(i,()=>Le(()=>e.children)));const s=r();if(s instanceof HTMLHeadElement){const[l,d]=Ge(!1),p=()=>d(!0);Ka(h=>De(s,()=>l()?h():o(),null)),ut(p)}else{const l=Toe(e.isSVG?"g":"div",e.isSVG),d=t&&l.attachShadow?l.attachShadow({mode:"open"}):l;Object.defineProperty(l,"_$host",{get(){return n.parentNode},configurable:!0}),De(d,o),s.appendChild(l),e.ref&&e.ref(l),ut(()=>s.removeChild(l))}},void 0,{render:!a}),n}function bHe(e){const[t,n]=ln(e,["component"]),r=Le(()=>t.component);return Le(()=>{const i=r();switch(typeof i){case"function":return jn(()=>i(n));case"string":const o=oHe.has(i),a=zt.context?fHe():Toe(i,o);return Ioe(a,n,o),a}})}var vHe=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()}},Foe=class{constructor(e){this.generateIdentifier=e,this.kv=new vHe}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)}},xHe=class extends Foe{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 wHe(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 kHe(e,t){const n=wHe(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 g2(e,t){Object.entries(e).forEach(([n,r])=>t(r,n))}function iP(e,t){return e.indexOf(t)!==-1}function $oe(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(t(r))return r}}var CHe=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return kHe(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},SHe=e=>Object.prototype.toString.call(e).slice(8,-1),Poe=e=>typeof e>"u",MHe=e=>e===null,bf=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,nq=e=>bf(e)&&Object.keys(e).length===0,Rs=e=>Array.isArray(e),IHe=e=>typeof e=="string",LHe=e=>typeof e=="number"&&!isNaN(e),EHe=e=>typeof e=="boolean",AHe=e=>e instanceof RegExp,vf=e=>e instanceof Map,xf=e=>e instanceof Set,Ooe=e=>SHe(e)==="Symbol",DHe=e=>e instanceof Date&&!isNaN(e.valueOf()),THe=e=>e instanceof Error,joe=e=>typeof e=="number"&&isNaN(e),NHe=e=>EHe(e)||MHe(e)||Poe(e)||LHe(e)||IHe(e)||Ooe(e),FHe=e=>typeof e=="bigint",$He=e=>e===1/0||e===-1/0,PHe=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),OHe=e=>e instanceof URL,zoe=e=>e.replace(/\./g,"\\."),rq=e=>e.map(String).map(zoe).join("."),wf=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 ua(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var _oe=[ua(Poe,"undefined",()=>null,()=>{}),ua(FHe,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),ua(DHe,"Date",e=>e.toISOString(),e=>new Date(e)),ua(THe,"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}),ua(AHe,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),ua(xf,"set",e=>[...e.values()],e=>new Set(e)),ua(vf,"map",e=>[...e.entries()],e=>new Map(e)),ua(e=>joe(e)||$He(e),"number",e=>joe(e)?"NaN":e>0?"Infinity":"-Infinity",Number),ua(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),ua(OHe,"URL",e=>e.toString(),e=>new URL(e))];function oP(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var Roe=oP((e,t)=>Ooe(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}),jHe=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Hoe=oP(PHe,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=jHe[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function qoe(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Boe=oP(qoe,(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)}),Voe=oP((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)}),zHe=[Boe,Roe,Voe,Hoe],Uoe=(e,t)=>{const n=$oe(zHe,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const r=$oe(_oe,i=>i.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation}},Goe={};_oe.forEach(e=>{Goe[e.annotation]=e});var _He=(e,t,n)=>{if(Rs(t))switch(t[0]){case"symbol":return Roe.untransform(e,t,n);case"class":return Boe.untransform(e,t,n);case"custom":return Voe.untransform(e,t,n);case"typed-array":return Hoe.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const r=Goe[t];if(!r)throw new Error("Unknown transformation: "+t);return r.untransform(e,n)}},y2=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Woe(e){if(iP(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(iP(e,"prototype"))throw new Error("prototype is not allowed as a property");if(iP(e,"constructor"))throw new Error("constructor is not allowed as a property")}var RHe=(e,t)=>{Woe(t);for(let n=0;n<t.length;n++){const r=t[n];if(xf(e))e=y2(e,+r);else if(vf(e)){const i=+r,o=+t[++n]==0?"key":"value",a=y2(e,i);switch(o){case"key":e=a;break;case"value":e=e.get(a);break}}else e=e[r]}return e},iq=(e,t,n)=>{if(Woe(t),t.length===0)return n(e);let r=e;for(let o=0;o<t.length-1;o++){const a=t[o];if(Rs(r)){const s=+a;r=r[s]}else if(bf(r))r=r[a];else if(xf(r)){const s=+a;r=y2(r,s)}else if(vf(r)){if(o===t.length-2)break;const l=+a,d=+t[++o]==0?"key":"value",p=y2(r,l);switch(d){case"key":r=p;break;case"value":r=r.get(p);break}}}const i=t[t.length-1];if(Rs(r)?r[+i]=n(r[+i]):bf(r)&&(r[i]=n(r[i])),xf(r)){const o=y2(r,+i),a=n(o);o!==a&&(r.delete(o),r.add(a))}if(vf(r)){const o=+t[t.length-2],a=y2(r,o);switch(+i==0?"key":"value"){case"key":{const l=n(a);r.set(l,r.get(a)),l!==a&&r.delete(a);break}case"value":{r.set(a,n(r.get(a)));break}}}return e};function oq(e,t,n=[]){if(!e)return;if(!Rs(e)){g2(e,(o,a)=>oq(o,t,[...n,...wf(a)]));return}const[r,i]=e;i&&g2(i,(o,a)=>{oq(o,t,[...n,...wf(a)])}),t(r,n)}function HHe(e,t,n){return oq(t,(r,i)=>{e=iq(e,i,o=>_He(o,r,n))}),e}function qHe(e,t){function n(r,i){const o=RHe(e,wf(i));r.map(wf).forEach(a=>{e=iq(e,a,()=>o)})}if(Rs(t)){const[r,i]=t;r.forEach(o=>{e=iq(e,wf(o),()=>e)}),i&&g2(i,n)}else g2(t,n);return e}var BHe=(e,t)=>bf(e)||Rs(e)||vf(e)||xf(e)||qoe(e,t);function VHe(e,t,n){const r=n.get(e);r?r.push(t):n.set(e,[t])}function UHe(e,t){const n={};let r;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(s=>s.map(String)).sort((s,l)=>s.length-l.length));const[o,...a]=i;o.length===0?r=a.map(rq):n[rq(o)]=a.map(rq)}),r?nq(n)?[r]:[r,n]:nq(n)?void 0:n}var Koe=(e,t,n,r,i=[],o=[],a=new Map)=>{const s=NHe(e);if(!s){VHe(e,i,t);const m=a.get(e);if(m)return r?{transformedValue:null}:m}if(!BHe(e,n)){const m=Uoe(e,n),b=m?{transformedValue:m.value,annotations:[m.type]}:{transformedValue:e};return s||a.set(e,b),b}if(iP(o,e))return{transformedValue:null};const l=Uoe(e,n),d=(l==null?void 0:l.value)??e,p=Rs(d)?[]:{},h={};g2(d,(m,b)=>{if(b==="__proto__"||b==="constructor"||b==="prototype")throw new Error(`Detected property ${b}. This is a prototype pollution risk, please remove it from your object.`);const g=Koe(m,t,n,r,[...i,b],[...o,e],a);p[b]=g.transformedValue,Rs(g.annotations)?h[b]=g.annotations:bf(g.annotations)&&g2(g.annotations,(v,x)=>{h[zoe(b)+"."+x]=v})});const f=nq(h)?{transformedValue:p,annotations:l?[l.type]:void 0}:{transformedValue:p,annotations:l?[l.type,h]:h};return s||a.set(e,f),f};function Yoe(e){return Object.prototype.toString.call(e).slice(8,-1)}function Zoe(e){return Yoe(e)==="Array"}function GHe(e){if(Yoe(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function WHe(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 aq(e,t={}){if(Zoe(e))return e.map(i=>aq(i,t));if(!GHe(e))return e;const n=Object.getOwnPropertyNames(e),r=Object.getOwnPropertySymbols(e);return[...n,...r].reduce((i,o)=>{if(Zoe(t.props)&&!t.props.includes(o))return i;const a=e[o],s=aq(a,t);return WHe(i,o,s,e,t.nonenumerable),i},{})}var yn=class{constructor({dedupe:e=!1}={}){this.classRegistry=new xHe,this.symbolRegistry=new Foe(t=>t.description??""),this.customTransformerRegistry=new CHe,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Koe(e,t,this,this.dedupe),r={json:n.transformedValue};n.annotations&&(r.meta={...r.meta,values:n.annotations});const i=UHe(t,this.dedupe);return i&&(r.meta={...r.meta,referentialEqualities:i}),r}deserialize(e){const{json:t,meta:n}=e;let r=aq(t);return n!=null&&n.values&&(r=HHe(r,n.values,this)),n!=null&&n.referentialEqualities&&(r=qHe(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)}};yn.defaultInstance=new yn,yn.serialize=yn.defaultInstance.serialize.bind(yn.defaultInstance),yn.deserialize=yn.defaultInstance.deserialize.bind(yn.defaultInstance),yn.stringify=yn.defaultInstance.stringify.bind(yn.defaultInstance),yn.parse=yn.defaultInstance.parse.bind(yn.defaultInstance),yn.registerClass=yn.defaultInstance.registerClass.bind(yn.defaultInstance),yn.registerSymbol=yn.defaultInstance.registerSymbol.bind(yn.defaultInstance),yn.registerCustom=yn.defaultInstance.registerCustom.bind(yn.defaultInstance),yn.allowErrorProps=yn.defaultInstance.allowErrorProps.bind(yn.defaultInstance);var KHe=yn.serialize,YHe=yn.stringify;function b2(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function ZHe(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function XHe({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function v2({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function QHe(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var aP=(e,t=!1)=>{const{json:n}=KHe(e);return JSON.stringify(n,null,t?2:void 0)},sP=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,JHe=(e,t)=>e.queryHash.localeCompare(t.queryHash),Xoe=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,eqe=(e,t)=>sP(e)===sP(t)?Xoe(e,t):sP(e)>sP(t)?1:-1,sq={status:eqe,"query hash":JHe,"last updated":Xoe},lP=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Qoe=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,tqe=(e,t)=>lP(e)===lP(t)?Qoe(e,t):lP(e)>lP(t)?1:-1,lq={status:tqe,"last updated":Qoe},Joe=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),nqe=()=>{const[e,t]=Ge("dark");return a1(()=>{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),ut(()=>n.removeEventListener("change",r))}),e},s1=(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,s1(r.get(i),o,n)),r}if(e instanceof Set){const r=s1(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]=s1(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]=s1(r[i],o,n),r}return e},kf=(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,kf(n.get(r),i)),n}if(e instanceof Set){const n=kf(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((o,a)=>a.toString()!==t[0]);const[r,...i]=t;return n[r]=kf(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]=kf(n[r],i),n}return e},rqe=(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)},iqe=(Rle=class{constructor(e){Xe(this,B2);Xe(this,Uf);Xe(this,Gf);Xe(this,Wf);Xe(this,w1,!1);Xe(this,Kf);Xe(this,V2);Xe(this,U2);Xe(this,G2);Xe(this,W2);Xe(this,K2);Xe(this,Y2);Xe(this,Yf);const{client:t,queryFlavor:n,version:r,onlineManager:i,buttonPosition:o,position:a,initialIsOpen:s,errorTypes:l,styleNonce:d,shadowDOMTarget:p}=e;Oe(this,B2,Ge(t)),Oe(this,Gf,n),Oe(this,Wf,r),Oe(this,Uf,i),Oe(this,Kf,d),Oe(this,V2,p),Oe(this,U2,Ge(o)),Oe(this,G2,Ge(a)),Oe(this,W2,Ge(s)),Oe(this,K2,Ge(l))}setButtonPosition(e){te(this,U2)[1](e)}setPosition(e){te(this,G2)[1](e)}setInitialIsOpen(e){te(this,W2)[1](e)}setErrorTypes(e){te(this,K2)[1](e)}setClient(e){te(this,B2)[1](e)}mount(e){if(te(this,w1))throw new Error("Devtools is already mounted");const t=lHe(()=>{const n=this,[r]=te(this,U2),[i]=te(this,G2),[o]=te(this,W2),[a]=te(this,K2),[s]=te(this,B2);let l;return te(this,Y2)?l=te(this,Y2):(l=WRe(()=>Promise.resolve().then(()=>qWe)),Oe(this,Y2,l)),rqe(te(this,Kf),te(this,V2)),ie(l,Dt({get queryFlavor(){return te(n,Gf)},get version(){return te(n,Wf)},get onlineManager(){return te(n,Uf)},get shadowDOMTarget(){return te(n,V2)}},{get client(){return s()},get buttonPosition(){return r()},get position(){return i()},get initialIsOpen(){return o()},get errorTypes(){return a()}}))},e);Oe(this,w1,!0),Oe(this,Yf,t)}unmount(){var e;if(!te(this,w1))throw new Error("Devtools is not mounted");(e=te(this,Yf))==null||e.call(this),Oe(this,w1,!1)}},B2=new WeakMap,Uf=new WeakMap,Gf=new WeakMap,Wf=new WeakMap,w1=new WeakMap,Kf=new WeakMap,V2=new WeakMap,U2=new WeakMap,G2=new WeakMap,W2=new WeakMap,K2=new WeakMap,Y2=new WeakMap,Yf=new WeakMap,Rle);function oqe(e){const t=Bi(e.client),n=k.useRef(null),{buttonPosition:r,position:i,initialIsOpen:o,errorTypes:a,styleNonce:s,shadowDOMTarget:l}=e,[d]=k.useState(new iqe({client:t,queryFlavor:"React Query",version:"5",onlineManager:_0,buttonPosition:r,position:i,initialIsOpen:o,errorTypes:a,styleNonce:s,shadowDOMTarget:l}));return k.useEffect(()=>{d.setClient(t)},[t,d]),k.useEffect(()=>{r&&d.setButtonPosition(r)},[r,d]),k.useEffect(()=>{i&&d.setPosition(i)},[i,d]),k.useEffect(()=>{d.setInitialIsOpen(o||!1)},[o,d]),k.useEffect(()=>{d.setErrorTypes(a||[])},[a,d]),k.useEffect(()=>(n.current&&d.mount(n.current),()=>{d.unmount()}),[d]),u.jsx("div",{className:"tsqd-parent-container",ref:n})}var aqe=oqe;const sqe=Object.freeze(Object.defineProperty({__proto__:null,ReactQueryDevtools:aqe},Symbol.toStringTag,{value:"Module"})),eae="[a-fA-F\\d:]",Hs=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${eae})|(?<=${eae})(?=\\s|$))`:"",Eo="(?: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}",Xn="[a-fA-F\\d]{1,4}",cP=`
7784
7784
  (?:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpmorgan-payments/embedded-finance-components",
3
- "version": "0.6.25",
3
+ "version": "0.6.26",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Embedded Finance Components",