PageSourceSearch

https://my.accuindex.com/_next/static/chunks/app/layout-41e2513a38cc7740.js

js accuindex.com collected 2026-09-26 07:55:19 UTC 127,990 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{2443:(e,t,a)=>{"use strict";a.d(t,{t:()=>s});var r=a(94915);let s={async sendVerificationCode(e){try{return(await r.A.post("/otp/send-verification-code",{action:e.action,payload:e.payload})).data}catch(r){var t,a;let e="Failed to send verification code";throw(null==(a=r.response)||null==(t=a.data)?void 0:t.message)&&(e=r.response.data.message),Error(e)}},async verifyPin(e){let{pin:t,verificationId:a}=e;try{return(await r.A.post("/otp/verify-pin",{pin:t,verificationId:a})).data}catch(t){var s,n;let e="Failed to verify pin";throw(null==(n=t.response)||null==(s=n.data)?void 0:s.message)&&(e=t.response.data.message),Error(e)}}}},5735:(e,t,a)=>{"use strict";a.d(t,{HydrationCheck:()=>n});var r=a(95155),s=a(12115);function n(e){let{children:t}=e,[a,n]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{n(!0)},[]),a?(0,r.jsx)(r.Fragment,{children:t}):null}},8377:(e,t,a)=>{"use strict";a.d(t,{default:()=>i});var r=a(95155),s=a(74852),n=a(99776),l=a(12115);function i(e){let{children:t}=e,[a]=(0,l.useState)(()=>new s.E({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1,retry:1}}}));return(0,r.jsx)(n.Ht,{client:a,children:t})}},10778:(e,t,a)=>{"use strict";a.d(t,{I18nProvider:()=>l});var r=a(95155),s=a(24274),n=a(13606);function l(e){let{children:t}=e;return(0,r.jsx)(s.xC,{i18n:n.A,children:t})}},11307:(e,t,a)=>{"use strict";a.d(t,{HB:()=>c,ZH:()=>u,Zl:()=>d,_e:()=>l,f9:()=>o,iK:()=>i,k9:()=>n,tc:()=>s});var r=a(94915);async function s(e){try{let{data:t}=await r.A.post("/promotions/deposit-preview",e);return null==t?void 0:t.result}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Unable to fetch deposit preview")}}async function n(e){var t,a,s;try{let{data:a}=await r.A.get("/promotions/banners",{params:e?{language:e}:{}});return(null==a||null==(t=a.result)?void 0:t.banners)||[]}catch(e){throw Error((null==e||null==(s=e.response)||null==(a=s.data)?void 0:a.message)||"Unable to fetch active banners")}}async function l(e){var t,a,s;try{let{data:a}=await r.A.get("/promotions/top-banner",{params:e?{language:e}:{}});return(null==a||null==(t=a.result)?void 0:t.banner)||null}catch(e){throw Error((null==e||null==(s=e.response)||null==(a=s.data)?void 0:a.message)||"Unable to fetch top banner")}}async function i(e){try{let{data:t}=await r.A.get("/promotions/my-bonuses",{params:e});return null==t?void 0:t.result}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Unable to fetch bonuses")}}async function o(e){var t,a,s,n,l,i,o;let d={rows:[],promotions:[],total:0,page:null!=(t=null==e?void 0:e.page)?t:1,limit:null!=(a=null==e?void 0:e.limit)?a:5,totalPages:0};try{let{data:t}=await r.A.get("/promotions/cashback-status",{params:{page:null!=(s=null==e?void 0:e.page)?s:1,limit:null!=(n=null==e?void 0:e.limit)?n:5}});return null!=(l=null==t?void 0:t.result)?l:d}catch(e){throw Error((null==e||null==(o=e.response)||null==(i=o.data)?void 0:i.message)||"Unable to fetch cashback status")}}async function d(){let{data:e}=await r.A.get("/promotions/cashback/enrollment");return e.result}async function c(){let{data:e}=await r.A.post("/promotions/cashback/enroll");return e.result}function u(e){r.A.post("/promotions/upsell-event",e).catch(()=>{})}},13606:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var r=a(30338),s=a(24274),n=a(91708),l=a(82372);r.Ay.use(l.A).use(n.A).use(s.r9).init({fallbackLng:"en",debug:!1,supportedLngs:["en","ar","vi","ch","fa"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]},backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},react:{useSuspense:!1}});let i=r.Ay},14747:(e,t,a)=>{"use strict";a.d(t,{AuthCheck:()=>c});var r=a(95155),s=a(12115),n=a(13606),l=a(20063),i=a(86600),o=a(70640),d=a(39887);function c(e){let{children:t}=e,[a,c]=(0,s.useState)(!1),u=(0,l.usePathname)(),m=(0,l.useRouter)(),p=(0,l.useSearchParams)(),{token:x,logout:h,login:f}=(0,o.n)(),v=(null==u?void 0:u.startsWith("/login"))||(null==u?void 0:u.startsWith("/forgot-password"))||(null==u?void 0:u.startsWith("/reset-password"))||(null==u?void 0:u.startsWith("/redirect"));return((0,s.useEffect)(()=>
1{if(!(()=>{if(x&&v)return m.push("/"),!0;if(x)try{let e=(0,i.s)(x);if(1e3*e.exp<Date.now())return h(),m.push("/login?expired=true"),!0}catch(e){return console.error("Token decode error:",e),h(),m.push("/login"),!0}return!(x||v||(()=>{if(!x){let e=localStorage.getItem(d.H);if(e)try{let{token:t,user:a,__expiresAt:r}=JSON.parse(e);if(t&&a&&r&&r>Date.now())return f(t),!0}catch(e){console.error("Failed to parse persisted auth state",e)}}return!1})())&&(m.push("/login"),!0)})()){let e=localStorage.getItem("i18nextLng")||"en";n.A.changeLanguage(e).then(()=>{let t=["ar","fa"].includes(e);document.documentElement.lang=e,document.documentElement.dir=t?"rtl":"ltr"}),c(!0)}},[x,v,u,m,h,p,f]),a)?(0,r.jsx)(r.Fragment,{children:t}):null}},16443:(e,t,a)=>{"use strict";a.d(t,{SL:()=>s,Sn:()=>n,dI:()=>l,nn:()=>i});var r=a(94915);async function s(){try{let{data:e}=await r.A.get("/transactions/fund/settings");return e}catch(a){var e,t;throw Error((null==a||null==(t=a.response)||null==(e=t.data)?void 0:e.message)||"Unable to fetch fund transfer settings")}}async function n(e){try{let{data:t}=await r.A.post("/transactions/fund/validate-account",{accountNumber:e});return t}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Account validation failed")}}async function l(e){try{let{data:t}=await r.A.post("/transactions/fund/transfer",e);return t}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Fund transfer failed")}}async function i(e){try{let{data:t}=await r.A.post("/transactions/fund/withdraw",e);return t}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Fund withdrawal failed")}}},21003:(e,t,a)=>{"use strict";a.d(t,{Toaster:()=>l});var r=a(95155);a(12115);var s=a(96410),n=a(50346);function l(){let{toasts:e}=(0,n.dj)();return(0,r.jsxs)(s.y8.Provider,{children:[e.map(function(e){let{id:t,title:a,description:n,action:l,...i}=e;return(0,r.jsxs)(s.y8,{duration:3e3,...i,children:[(0,r.jsxs)("div",{className:"grid gap-1",children:[a&&(0,r.jsx)(s.y8.Title,{children:a}),n&&(0,r.jsx)(s.y8.Description,{children:n})]}),l,(0,r.jsx)(s.y8.Close,{})]},t)}),(0,r.jsx)(s.y8.Viewport,{})]})}},35023:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var r=a(95155),s=a(21570),n=a(99229);function l(e){let{onRetry:t}=e,{t:a}=(0,n.Bd)();return(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{children:a("error.title")}),(0,r.jsx)(s.$,{className:"mt-2",variant:"default",onClick:t,children:a("error.reload")})]})}},42650:(e,t,a)=>{Promise.resolve().then(a.bind(a,65476)),Promise.resolve().then(a.t.bind(a,41402,23)),Promise.resolve().then(a.bind(a,14747)),Promise.resolve().then(a.bind(a,43009)),Promise.resolve().then(a.bind(a,5735)),Promise.resolve().then(a.bind(a,49447)),Promise.resolve().then(a.bind(a,21003)),Promise.resolve().then(a.bind(a,10778)),Promise.resolve().then(a.bind(a,72368)),Promise.resolve().then(a.bind(a,8377)),Promise.resolve().then(a.bind(a,52532)),Promise.resolve().then(a.t.bind(a,68380,23))},43009:(e,t,a)=>{"use strict";a.d(t,{AuthLayout:()=>tv});var r=a(95155),s=a(20063),n=a(33828),l=a(9577),i=a(42878),o=a(31185),d=a(15239);function c(e){let{src:t,alt:a="User Avatar",size:s="md",className:n,fallback:l="JD"}=e,i={sm:"h-6 w-6 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"};return t?(0,r.jsx)(d.default,{src:t,alt:a,width:32,height:32,className:(0,o.cn)("rounded-full object-cover",i[s],n)}):(0,r.jsx)("div",{className:(0,o.cn)("rounded-full bg-primary flex items-center justify-center text-white font-semibold",i[s],n),children:l})}var u=a(21570),m=a(27023),p=a(12115);let x=p.forwardRef((e,t)=>{let{className:a,checked:s,onCheckedChange:n,...l}=e;return(0,r.jsx)("button",{type:"button",className:(0,o.cn)("peer inline-flex h-4 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",s?"bg-primary":"bg-gray-200",a),onClick:()=>n(!s),ref:t,...l,children:(0,r.jsx)("span",{className:(0,o.cn)("pointer-events-none block h-3 w-3 rounded-full bg-white shadow-lg ring-0 transition-transform",s?"translate-x-[1.25rem] rtl:-translate-x-[1.25rem]":"translate-x-0")})})});x.displayName="Switch";var h=a(49447),f=a(99229),v=a(70640),g=a(72368),y=a(52619),j=a.n(y),b=a(48141),w=a(38585);let _=()=>{let{t:e}=(0,f.Bd)("translation"),t=((0,s.usePathname)()||"").includes("/ib"),{notifications:a,isPanelOpen:n,setIsPanelOpen:l,handleMarkAllAsRead:i,isLoadingNotifications:o,isMarkingAllAsRead:d,isMarkingAsRead:c}=(0,g.E)(),m=(0,p.useRef)(null);return((0,p.useEffect)(()=>
1{if(!n)return;let e=e=>{!m.current||m.current.contains(e.target)||e.target.closest(".notification-bell-container")||l(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n,l]),n)?(0,r.jsxs)("div",{ref:m,className:"absolute -right-30 mt-0 w-85 rounded-md border border-gray-200 bg-white shadow-lg z-50",children:[(0,r.jsx)("div",{className:"p-3 border-b border-gray-300",children:(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:e("notifications.title")}),a.length>0&&(0,r.jsx)(u.$,{variant:"outline",onClick:i,disabled:0===a.length||d,children:d?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(w.y,{className:"mr-2 h-4 w-4"})}):e("notifications.mark_all_as_read")})]})}),(0,r.jsx)("div",{className:"max-h-96 overflow-y-auto",children:o?(0,r.jsx)("div",{className:"flex justify-center p-4",children:(0,r.jsx)(w.y,{})}):a.length>0?a.map(e=>(0,r.jsx)(b.r,{notification:e,isMarkingAsRead:c},e.id)):(0,r.jsx)("div",{className:"p-4 text-center text-gray-500",children:e("notifications.no_notifications")})}),(0,r.jsx)("div",{className:"p-2 border-t border-gray-300",children:(0,r.jsx)(j(),{href:t?"/ib/notifications":"/notifications",className:"block w-full text-center text-sm font-medium text-primary hover:underline py-2",onClick:()=>l(!1),children:e("notifications.view_all")})})]}):null},N=()=>{let{unreadCount:e,setIsPanelOpen:t,isPanelOpen:a,isLoadingUnreadCount:s}=(0,g.E)();return(0,r.jsx)("div",{className:"relative",children:(0,r.jsx)("button",{className:"relative p-1 rounded-full hover:bg-gray-100 transition-colors",onClick:e=>{e.stopPropagation(),t(!a)},"aria-label":"Notifications",disabled:s,children:s?(0,r.jsx)(w.y,{className:"h-5 w-5"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.jNV,{className:"h-5 w-5 text-black"}),e>0&&(0,r.jsx)("span",{className:"absolute -top-0.5 -right-0 h-3.5 w-3.5 rounded-full bg-primary border-2 border-white"})]})})})};var k=a(64600),C=a(24395),S=a(56651),E=a(22544),A=a(58163),D=a(43336),I=a(47234),F=a(5390),P=a(522),q=a(69044),R=a(43282),O=a(91875),T=a(50346),z=a(775),L=a(89270);function V(){let{t:e}=(0,f.Bd)(),{profile:t}=(0,C.s)(),{toast:a}=(0,T.dj)(),[s,n]=(0,p.useState)(!1),[l,i]=(0,p.useState)(!1),{register:o,handleSubmit:d,formState:{errors:c},setValue:m,watch:x}=(0,E.mN)({defaultValues:{haveSite:"",refOther:"",targetCountries:[],getClient:"",expectedClients:0}}),h=x("haveSite"),v=x("refOther"),g=x("getClient"),y=x("targetCountries"),j=q.F.filter(e=>!!e).map(e=>({value:e.countryEn,label:e.countryEn}));(0,p.useEffect)(()=>{let e=()=>{var e;(null==t?void 0:t.isIb)&&!(null==t||null==(e=t.customerDetails)?void 0:e.submitIbQuestionaire)&&n(!0)};return window.addEventListener("show-ib-questionnaire",e),()=>window.removeEventListener("show-ib-questionnaire",e)},[t]);let b=async t=>{i(!0);try{await (0,R.a1)(t),a({variant:"success",title:e("partnership.request.success_title"),description:e("partnership.request.success_desc")}),n(!1),await (0,O.l2)()}catch(r){let t=r instanceof Error?(0,z.r)(r.message,e):e("partnership.request.error");a({variant:"destructive",title:e("partnership.request.error_title"),description:t})}finally{i(!1)}};return(0,r.jsx)(A.lG,{open:s,onOpenChange:n,children:(0,r.jsxs)(A.Cf,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[(0,r.jsx)(A.c7,{children:(0,r.jsx)(A.L3,{className:"!p-0"})}),(0,r.jsxs)("div",{className:"space-y-6 py-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-2xl mb-4 font-medium",children:e("partnership.request.title")}),(0,r.jsx)(D.J,{className:"mb-2 block",children:e("partnership.request.form.labels.financial")}),(0,r.jsxs)(F.l6,{value:h,onValueChange:e=>m("haveSite",e),children:[(0,r.jsx)("input",{type:"hidden",...o("haveSite",{required:e("partnership.request.error")})}),(0,r.jsx)(F.bq,{className:"w-full",children:(0,r.jsx)(F.yv,{placeholder:e("partnership.request.form.labels.select_placeholder")})}),(0,r.jsxs)(F.gC,{children:[(0,r.jsx)(F.eb,{value:"yes",children:e("partnership.request.form.yes")}),(0,r.jsx)(F.eb,{value:"no",children:e("partnership.request.form.no")})]})]}),c.haveSite&&(0,r.jsx)(P.A,{message:c.haveSite.message})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(D.J,{className:"mb-2 block",children:e("partnership.request.form.labels.reffered")}),(0,r.jsxs)(F.l6,{value:v,onValueChange:e=>m("refOther",e),children:[(0,r.jsx)("input",{type:"hidden",...o("refOther",{required:e("partnership.request.error")})}),(0,r.jsx)(F.bq,{className:"w-full",children:(0,r.jsx)(F.yv,{placeholder:e("partnership.request.form.labels.select_placeholder")})}),(0,r.jsxs)(F.gC,{children:[(0,r.jsx)(F.eb,{value:"yes",children:e("partnership.request.form.yes")}),(0,r.jsx)(F.eb,{value:"no",children:e("partnership.request.form.no")})]})]}),c.refOther&&(0,r.jsx)(P.A,{message:c.refOther.message})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(D.J,{className:"mb-2 block",children:e("partnership.request.form.labels.acquire")}),(0,r.jsxs)(F.l6,{value:g,onValueChange:e=>m("getClient",e),children:[(0,r.jsx)("input",{type:"hidden",...o("getClient",{required:e("partnership.request.error")})}),(0,r.jsx)(F.bq,{className:"w-full",children:(0,r.jsx)(F.yv,{placeholder:e("partnership.request.form.labels.select_placeholder")})}),(0,r.jsxs)(F.gC,{children:[(0,r.jsx)(F.eb,{value:"Wide range of personal network",children:e("partnership.request.form.options.personal_network")}),(0,r.jsx)(F.eb,{value:"Developing trading strategies and signals",children:e("partnership.request.form.options.trading_strategies")}),(0,r.jsx)(F.eb,{value:"Providing Forex education seminars",children:e("partnership.request.form.options.forex_education")}),(0,r.jsx)(F.eb,{value:"Other",children:e("partnership.request.form.options.other")})]})]}),c.getClient&&(0,r.jsx)(P.A,{message:c.getClient.message})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(D.J,{className:"mb-2 block",children:e("partnership.request.form.labels.countries")}),(0,r.jsx)("input",{type:"hidden",...o("targetCountries",{validate:t=>t&&t.length>0||e("partnership.request.error")})}),(0,r.jsx)(L.K,{options:j,selected:y,onChange:e=>m("targetCountries",e),placeholder:e("partnership.request.form.labels.select_countries_placeholder"),className:"w-full"}),c.targetCountries&&(0,r.jsx)(P.A,{message:c.targetCountries.message})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(D.J,{className:"mb-2 block",children:e("partnership.request.form.labels.expectedClients_clients")}),(0,r.jsx)(I.p,{type:"number",placeholder:e("partnership.request.form.labels.expectedClients_clients"),...o("expectedClients",{required:e("partnership.request.error"),min:{value:1,message:e("partnership.request.error")}})}),c.expectedClients&&(0,r.jsx)(P.A,{message:c.expectedClients.message})]}),(0,r.jsx)(u.$,{onClick:d(b),className:"w-full",disabled:l,children:l?(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(w.y,{className:"mr-2 h-4 w-4"})}):e("partnership.request.form.cta")})]})]})})}function K(){var e,t;
1let{t:a,i18n:o}=(0,f.Bd)(),d=(0,s.useRouter)(),g=(0,s.usePathname)()||"",y=(0,p.useRef)(g),j=g.includes("/ib"),{logout:b}=(0,v.n)(),[E,A]=(0,p.useState)(!1),{profile:D}=(0,C.s)();(0,p.useEffect)(()=>{g!==y.current&&(A(!1),y.current=g)},[g]);let I=async e=>{await o.changeLanguage(e),document.documentElement.lang=e,document.documentElement.dir=o.dir(e)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("header",{className:"flex items-center justify-between bg-body-bg h-16 md:px-10 px-4 md:mb-7 ",children:[(0,r.jsxs)("div",{className:"flex items-center gap-0 text-secondary",children:[(0,r.jsx)(h.x2,{className:"md:hidden"}),(0,S.b9)(D)===S.xN.Ib&&(0,r.jsxs)("div",{className:"flex items-center rounded-md p-1",children:[E?(0,r.jsx)(w.y,{className:"h-5 w-5"}):(0,r.jsx)(x,{checked:j,onCheckedChange:()=>{var e;A(!0),d.push(j?"/":"/ib"),j||null==D||!D.isIb||(null==D||null==(e=D.customerDetails)?void 0:e.submitIbQuestionaire)||setTimeout(()=>{window.dispatchEvent(new Event("show-ib-questionnaire"))},300)},disabled:E,"aria-label":j?"IB portal":"client portal"}),(0,r.jsx)("div",{className:"flex items-center gap-2 px-2 py-1",children:(0,r.jsx)("span",{className:"md:text-sm text-xs font-medium text-secondary",children:(0,r.jsx)("span",{className:"md:text-sm text-xs",children:j?a("header.ib_portal","IB Portal"):a("header.client_portal","Client Portal")})})})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-0",children:[(0,r.jsxs)("div",{className:"relative notification-bell-container",children:[(0,r.jsx)(N,{}),(0,r.jsx)(_,{})]}),(0,r.jsx)("div",{className:"flex items-center border-r-2 border-gray-200 pr-2",children:(0,r.jsxs)(m.rI,{children:[(0,r.jsx)(m.ty,{asChild:!0,children:(0,r.jsx)(u.$,{variant:"ghost",size:"sm",className:"gap-1","aria-label":"change language",children:(0,r.jsx)(l.aBt,{className:"!h-5 !w-5 text-secondary"})})}),(0,r.jsx)(m.SQ,{align:"end",children:Object.entries(k.s).map(e=>{let[t,a]=e;return(0,r.jsx)(m._2,{className:"text-sm cursor-pointer",onSelect:()=>I(t),children:a},t)})})]})}),(0,r.jsxs)(m.rI,{children:[(0,r.jsx)(m.ty,{asChild:!0,children:(0,r.jsx)(u.$,{variant:"ghost",className:"gap-2",size:"sm",children:(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(c,{src:"/assets/icons/user-avatar.svg",alt:"User Avatar",size:"md",fallback:"HB"}),(0,r.jsx)("div",{className:"text-right hidden md:block",children:(0,r.jsx)("p",{className:"text-sm font-medium text-secondary",children:D?"".concat(null!=(e=D.firstName)?e:""," ").concat(null!=(t=D.lastName)?t:"").trim():"User"})}),(0,r.jsx)(n.Vr3,{className:"h-2 w-2 text-sm text-secondary"})]})})}),(0,r.jsxs)(m.SQ,{align:"end",className:"w-auto p-0 rounded-lg shadow-lg mt-2",children:[(0,r.jsxs)(m._2,{className:"p-3 flex items-center gap-2 cursor-pointer text-md",onSelect:()=>{d.push(j?"/ib/settings":"/settings")},children:[(0,r.jsx)(i.EZW,{className:"!h-6 !w-6"}),(0,r.jsx)("span",{className:"w-full text-gray-600 text-base",children:a("header.menu.settings")})]}),(0,r.jsxs)(m._2,{className:"px-4  flex items-center gap-2 cursor-pointer text-md",onSelect:()=>{b(),d.push("/login")},children:[(0,r.jsx)(i.HSs,{className:"!h-4 !w-4"}),(0,r.jsx)("span",{className:"text-gray-600",children:a("header.menu.logout","Logout")})]})]})]})]})]}),(0,r.jsx)(V,{})]})}var M=a(56952),B=a(35200),$=a(33846),U=a(59475),H=a(70898),J=a(82636);function W(){var e,t,a,s;let{t:n}=(0,f.Bd)(),[l,i]=(0,p.useState)(!1),{profile:o}=(0,C.s)(),d=(null==o||null==(e=o.Agent)?void 0:e.firstName)&&(null==o||null==(t=o.Agent)?void 0:t.lastName)?"".concat(o.Agent.firstName," ").concat(o.Agent.lastName):"Support Team",{branding:c}=(0,J.Q)(),m=(null==o||null==(a=o.Agent)?void 0:a.email)||c.supportEmail||"[email protected]",x=null==o||null==(s=o.Agent)?void 0:s.phone,h=x?"https://wa.me/".concat(x.replace("+",""),"?text=").concat(encodeURIComponent("Hello")):null;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(M.Zp,{className:"mb-5 p-3",children:(0,r.jsxs)("div",{className:"sm:flex items-center justify-between sblock",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-bold",children:n("contact.need_help")}),(0,r.jsx)("span",{children:n("contact.contact_account_manager")})]}),(0,r.jsxs)(u.$,{variant:"outline",className:"font-bold gap-0 py-0.5 md:mt-0 h-auto text-sm md:mx-3 bg-transparent mt-2",onClick:()=>{i(!0)},children:[(0,r.jsx)(B.qdD,{className:"!w-7 !h-7"}),n("contact.contact_btn")]})]})}),(0,r.jsx)($.a,{isOpen:l,onClose:()=>{i(!1)},title:n("contact.contact_btn"),size:"sm",children:(0,r.jsx)("div",{className:"space-y-4",children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)(j(),{href:"mailto:".concat(m),className:"flex items-center gap-3 p-3 py-0 hover:bg-gray-50 transition-colors",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-10 h-10  rounded-full",children:(0,r.jsx)(U.zcx,{className:"!w-6 !h-6"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"font-medium text-gray-900",children:d}),(0,r.jsx)("div",{className:"text-sm text-gray-500",children:m})]})]}),x&&(0,r.jsxs)(j(),{href:h,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 py-6 border-t border-t-gray-200 hover:bg-gray-50 transition-colors",children:[(0,r.jsx)("div",{className:"flex items-center justify-center w-10 h-10",children:(0,r.jsx)(H.EcP,{className:"w-6 h-6 bg-green-500 text-white rounded-full"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"font-medium text-gray-900",children:n("contact.whatsapp")}),(0,r.jsx)("div",{className:"text-sm text-gray-500",children:x})]})]})]})})})]})}
1let Q=["mousemove","click","scroll","wheel","keydown","touchstart","resize"],Y=function(){let e=(0,p.useRef)(null),{logout:t}=(0,v.n)(),a=(0,p.useCallback)(()=>{e.current&&clearTimeout(e.current),e.current=setTimeout(t,18e5)},[t]);return(0,p.useEffect)(()=>(Q.forEach(e=>window.addEventListener(e,a)),a(),()=>{e.current&&clearTimeout(e.current),Q.forEach(e=>window.removeEventListener(e,a))}),[a]),null};var G=a(92387),Z=a(34334),X=a(73730),ee=a(3648),et=a(57830),ea=a(74854),er=a(93725);function es(){let e=(0,ee._)(["rtl:**:[.rdp-button_next>svg]:rotate-180"],["rtl:**:[.rdp-button\\_next>svg]:rotate-180"]);return es=function(){return e},e}function en(){let e=(0,ee._)(["rtl:**:[.rdp-button_previous>svg]:rotate-180"],["rtl:**:[.rdp-button\\_previous>svg]:rotate-180"]);return en=function(){return e},e}function el(e){let{className:t,classNames:a,showOutsideDays:s=!0,captionLayout:n="label",buttonVariant:l="ghost",formatters:d,components:c,...m}=e,p=(0,ea.a)();return(0,r.jsx)(er.h,{showOutsideDays:s,className:(0,o.cn)("bg-background group/calendar p-3 w-full [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw(es()),String.raw(en()),t),captionLayout:n,formatters:{formatMonthDropdown:e=>e.toLocaleString("default",{month:"short"}),...d},classNames:{root:(0,o.cn)("w-fit",p.root),months:(0,o.cn)("flex gap-4 flex-col md:flex-row relative",p.months),month:(0,o.cn)("flex flex-col w-full gap-4",p.month),nav:(0,o.cn)("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",p.nav),button_previous:(0,o.cn)((0,u.r)({variant:l}),"text-primary font-medium !h-5 !w-5 !px-2 mt-2 size-(--cell-size) aria-disabled:opacity-50 select-none",p.button_previous),button_next:(0,o.cn)((0,u.r)({variant:l}),"text-primary font-medium !h-5 !w-5 !px-2 mt-2 size-(--cell-size) aria-disabled:opacity-50 select-none d-none",p.button_next),month_caption:(0,o.cn)("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",p.month_caption),dropdowns:(0,o.cn)("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",p.dropdowns),dropdown_root:(0,o.cn)("relative has-focus:border-ring border border-gray-300 shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",p.dropdown_root),dropdown:(0,o.cn)("absolute bg-popover inset-0 opacity-0",p.dropdown),caption_label:(0,o.cn)("select-none font-medium","label"===n?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",p.caption_label),table:"w-full border-collapse",weekdays:(0,o.cn)("flex",p.weekdays),weekday:(0,o.cn)("text-muted-foreground rounded-md flex-1 font-medium text-[0.8rem] select-none text-primary",p.weekday),week:(0,o.cn)("flex w-full mt-2",p.week),week_number_header:(0,o.cn)("select-none w-(--cell-size)",p.week_number_header),week_number:(0,o.cn)("text-[0.8rem] select-none text-muted-foreground",p.week_number),day:(0,o.cn)("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",p.day),range_start:(0,o.cn)("rounded-l-md bg-accent",p.range_start),range_middle:(0,o.cn)("rounded-none",p.range_middle),range_end:(0,o.cn)("rounded-r-md bg-accent",p.range_end),today:(0,o.cn)("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",p.today),outside:(0,o.cn)("text-muted-foreground aria-selected:text-muted-foreground",p.outside),disabled:(0,o.cn)("text-muted-foreground opacity-50",p.disabled),hidden:(0,o.cn)("invisible",p.hidden),...a},components:{Root:e=>{let{className:t,rootRef:a,...s}=e;return(0,r.jsx)("div",{"data-slot":"calendar",ref:a,className:(0,o.cn)(t),...s})},Chevron:e=>{let{className:t,orientation:a,...s}=e,n="undefined"!=typeof document&&"rtl"===document.dir;return"left"===a?(0,r.jsx)(et.E_E,{className:(0,o.cn)("size-4",t),...s,style:{transform:n?"rotate(180deg)":void 0}}):"right"===a?(0,r.jsx)(et.xVu,{className:(0,o.cn)("size-4",t),...s,style:{transform:n?"rotate(180deg)":void 0}}):(0,r.jsx)(i._kA,{className:(0,o.cn)("size-4",t),...s})},DayButton:ei,WeekNumber:e=>{let{children:t,...a}=e;return(0,r.jsx)("td",{...a,children:(0,r.jsx)("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:t})})},...c},...m})}function ei(e){let{className:t,day:a,modifiers:s,...n}=e,l=(0,ea.a)(),i=p.useRef(null);return p.useEffect(()=>{var e;s.focused&&(null==(e=i.current)||e.focus())},[s.focused]),(0,r.jsx)(u.$,{ref:i,variant:"ghost",size:"icon","data-day":a.date.toLocaleDateString(),"data-selected-single":s.selected&&!s.range_start&&!s.range_end&&!s.range_middle,"data-range-start":s.range_start,"data-range-end":s.range_end,"data-range-middle":s.range_middle,className:(0,o.cn)("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",l.day,t),...n})}var eo=a(82286);function ed(e){let{...t}=e;return(0,r.jsx)(eo.bL,{"data-slot":"popover",...t})}function ec(e){let{...t}=e;return(0,r.jsx)(eo.l9,{"data-slot":"popover-trigger",...t})}function eu(e){let{className:t,align:a="center",sideOffset:s=4,...n}=e;return(0,r.jsx)(eo.ZL,{children:(0,r.jsx)(eo.UC,{"data-slot":"popover-content",align:a,sideOffset:s,className:(0,o.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...n})})}function em(e){let{name:t,defaultDate:a}=e,{setValue:s,trigger:n,watch:l}=(0,E.xW)(),[i,o]=(0,p.useState)(!1),{t:d}=(0,f.Bd)(),c=l(t)||a,m=c?(0,Z.qg)(c):void 0;return(0,r.jsxs)(ed,{open:i,onOpenChange:o,children:[(0,r.jsx)(ec,{asChild:!0,children:(0,r.jsxs)(u.$,{"data-empty":!c,variant:"outline",className:"data-[empty=true]:text-muted-foreground justify-start text-left font-normal border-gray-300 w-full",children:[(0,r.jsx)(H.mCR,{className:"mr-2"}),c||d("common.date")]})}),(0,r.jsx)(eu,{className:"p-0 bg-white border border-gray-300 w-fit",align:"start",children:(0,r.jsx)(el,{disabled:e=>e>new Date,mode:"single",captionLayout:"dropdown",selected:m,onSelect:e=>{e&&(s(t,(0,X.GP)(e,"yyyy-MM-dd")),n(t),o(!1))}})})]})}let ep=[{name:"Aviation",value:"Aviation",ar:"الطيران"},{name:"Agricultural",value:"Agricultural",ar:"الزراعة"},{name:"Financial industry",value:"Financial industry",ar:"الصناعة المالية"},{name:"Marketing",value:"Marketing",ar:"التسويق"},{name:"Retail industry",value:"Retail industry",ar:"التجزئة"},{name:"HR",value:"HR",ar:"الموارد البشرية"},{name:"Management",value:"Management",ar:"الإدارة"},{name:"Healthcare",value:"Healthcare",ar:"الرعاية الصحية"},{name:"Administration",value:"Administration",ar:"الإدارة"},{name:"Academic",value:"Academic",ar:"الأكاديمية"},{name:"Engineering",value:"Engineering",ar:"الهندسة"},{name:"Civil Engineering",value:"Civil Engineering",ar:"الهندسة المدنية"},{name:"Architecture",value:"Architecture",ar:"العمارة"},{name:"Media",value:"Media",ar:"الإعلام"},{name:"Chemical engineering",value:"Chemical engineering",ar:"الهندسة الكيميائية"},{name:"Power engineering",value:"Power engineering",ar:"الهندسة الكهربائية"},{name:"Other",value:"Other",ar:"آخر"}],ex=[{value:"Employment",name:"Employment",ar:"العمل"},{value:"Inheritance",name:"Inheritance",ar:"الإرث"},{value:"Third party",name:"Third party",ar:"جهة ثالثة"},{value:"Grant/ Loan",name:"Grant/ Loan",ar:"المنحة / القرض"}],eh=[{name:"more than $200,000",value:"more than $200,000",ar:"أكثر من 200,000 دولار"},{name:"$100,000-$200,000",value:"$100,000-$200,000",ar:"100,000-200,000 دولار"},{name:"$50,000- $100,000",value:"$50,000- $100,000",ar:"50,000-100,000 دولار"},{name:"$20,000 - $50,000",value:"$20,000 - $50,000",ar:"20,000-50,000 دولار"},{name:"$0 - $20,000",value:"$0 - $20,000",ar:"0-20,000 دولار"}],ef=[{name:"Employed (full time)",value:"Employed (full time)",ar:"موظف بدوام كامل"},{name:"Self Employed",value:"Self Employed",ar:"عامل حر"},{name:"Employed (part time )",value:"Employed (part time )",ar:"موظف بدوام جزئي"},{name:"unemployed",value:"unemployed",ar:"عاطل عن العمل"},{name:"Student",value:"Student",ar:"طالب"},{name:"Retired",value:"Retired",ar:"متقاعد"}],ev=[{name:"Mr",ar:"السيد",value:"Mr."},{name:"Mrs",ar:"السيدة",value:"Mrs."},{name:"Miss",ar:"الآنسة",value:"Miss"},{name:"Ms",ar:"السيدة",value:"Ms."},{name:"Dr",ar:"د.",value:"Dr."},{name:"Prof",ar:"الأستاذ",value:"Prof."},{name:"Mx",ar:"السيد/ة",value:"Mx."}],eg=q.F.map(e=>{var t,a;return{name:null!=(t=null==e?void 0:e.countryEn)?t:"",value:null!=(a=null==e?void 0:e.countryEn)?a:""}}),ey=e=>{var t,a,s,n,l,i,o,d,c,u,m,x,h,v,g,y;let{profile:j}=e,{register:b,formState:{errors:w},watch:_,setValue:N,trigger:k,clearErrors:C}=(0,E.xW)(),S=_("title")||(null==j||null==(t=j.customerDetails)?void 0:t.title)||"",A=_("nationality")||(null==j||null==(a=j.customerDetails)?void 0:a.nationality)||"",{t:q}=(0,f.Bd)();(0,p.useEffect)(()=>{var e;(null==j||null==(e=j.customerDetails)?void 0:e.title)&&N("title",j.customerDetails.title)},[null==j||null==(s=j.customerDetails)?void 0:s.title,N]);let R=async e=>{N("title",e),C("title"),await k("title")},O=async e=>{N("nationality",e),await k("nationality")};return(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,r.jsx)(D.J,{className:"mt-4 text-xl col-span-full",children:q("new_journey.personal_information_modal.personal_details")}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 font-medium",children:q("new_journey.title")}),(0,r.jsxs)(F.l6,{value:S,onValueChange:R,children:[(0,r.jsx)("input",{type:"text",hidden:!0,...b("title",{required:q("new_journey.required")})}),(0,r.jsx)(F.bq,{className:"w-full",children:(0,r.jsx)(F.yv,{placeholder:q("new_journey.title")||"Select title"})}),(0,r.jsx)(F.gC,{children:ev.map(e=>{let{name:t,value:a}=e;return(0,r.jsx)(F.eb,{value:a,children:t},a)})})]}),w.title&&(0,r.jsx)(P.A,{message:null==(n=w.title)?void 0:n.message})]}),(0,r.jsx)("div",{})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col w-full",children:[(0,r.jsx)(I.p,{defaultValue:null==j?void 0:j.firstName,...b("firstName",{required:!0}),placeholder:"First Name",className:"!text-neutral-500 w-full"}),w.firstName&&(0,r.jsx)(P.A,{message:null==(l=w.firstName)?void 0:l.message})]}),(0,r.jsxs)("div",{className:"flex flex-col w-full",children:[(0,r.jsx)(I.p,{defaultValue:null==j?void 0:j.lastName,...b("lastName",{required:!0}),placeholder:"Last Name",className:"!text-neutral-500 w-full"}),w.lastName&&(0,r.jsx)(P.A,{message:null==(i=w.lastName)?void 0:i.message})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col w-full",children:[(0,r.jsx)("p",{className:"mb-2 font-medium",children:q("new_journey.date_of_birth")}),(0,r.jsx)("input",{type:"text",className:"w-full",hidden:!0,...b("dob",{required:!0}),defaultValue:null==j||null==(o=j.customerDetails)?void 0:o.dob}),(0,r.jsx)(em,{name:"dob",defaultDate:null==j||null==(d=j.customerDetails)?void 0:d.dob}),w.dob&&(0,r.jsx)(P.A,{message:null==(c=w.nationality)?void 0:c.message})]}),(0,r.jsx)("div",{})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-col w-full",children:[(0,r.jsxs)(F.l6,{value:A,onValueChange:O,children:[(0,r.jsx)("input",{type:"text",hidden:!0,...b("nationality",{required:q("new_journey.required")}),defaultValue:null==j||null==(u=j.customerDetails)?void 0:u.nationality}),(0,r.jsx)(F.bq,{className:"w-full",children:(0,r.jsx)(F.yv,{placeholder:q("new_journey.nationality")})}),(0,r.jsx)(F.gC,{children:eg.map(e=>(0,r.jsx)(F.eb,{value:e.value,children:e.name},e.value))})]}),w.nationality&&(0,r.jsx)(P.A,{message:null==(m=w.nationality)?void 0:m.message})]}),(0,r.jsxs)("div",{className:"flex flex-col w-full",children:[(0,r.jsx)(I.p,{defaultValue:null==j||null==(x=j.customerDetails)?void 0:x.city,...b("city",{required:!0}),placeholder:q("new_journey.city"),className:"!text-neutral-500 w-full"}),w.city&&(0,r.jsx)(P.A,{message:null==(h=w.nationality)?void 0:h.message})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("div",{className:"w-1/3",children:[(0,r.jsx)(I.p,{defaultValue:null==j||null==(v=j.customerDetails)?void 0:v.address,...b("address",{required:!0}),placeholder:q("new_journey.address_line1"),className:"!text-neutral-400 !border-neutral-200"}),w.address&&(0,r.jsx)(P.A,{message:q("new_journey.required")})]}),(0,r.jsxs)("div",{className:"w-1/3",children:[(0,r.jsx)(I.p,{defaultValue:null==j||null==(g=j.customerDetails)?void 0:g.address2,...b("address2",{required:!0}),placeholder:q("new_journey.address_line2"),className:"!text-neutral-400 !border-neutral-200"}),w.address2&&(0,r.jsx)(P.A,{message:q("new_journey.required")})]}),(0,r.jsx)("div",{className:"w-1/3",children:(0,r.jsx)(I.p,{defaultValue:null==j||null==(y=j.customerDetails)?void 0:y.zipCode,...b("zipCode"),placeholder:q("new_journey.postal_code"),className:"!text-neutral-400 !border-neutral-200"})})]})]})},ej=async e=>{let t=await (0,O.k6)(e);t.isSuccess&&C.s.getState().store(t.result)};var eb=a(67190);let ew=e=>{var t;let{profile:a,setPin:s,handleSendOtp:n,isOtpMode:l,onOtpComplete:i}=e,{register:o,formState:{errors:d}}=(0,E.xW)(),{t:c}=(0,f.Bd)(),[u,m]=(0,p.useState)(!1);return(0,p.useEffect)(()=>{l&&!u&&(n(),m(!0))},[l,u,n]),(0,r.jsx)("div",{className:"flex justify-center mt-8",children:l?(0,r.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,r.jsx)(eb.A,{callback:e=>{s(e),i&&i(e)},autoSubmit:!0}),(0,r.jsx)("p",{children:c("new_journey.email_verification_modal.enter_otp")})]}):(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsx)(I.p,{autoFocus:!0,className:"!py-5 select-none",type:"email",defaultValue:null==a?void 0:a.email,placeholder:"Email",...o("email",{required:!0,pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Invalid email format"}}),onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()}}),d.email&&(0,r.jsx)(P.A,{message:null==(t=d.email)?void 0:t.message})]})})},e_=async e=>{try{let t=await (0,O.Ww)(e);if(t.isSuccess)C.s.getState().store(t.result);else throw Error(t.message||"Failed to update email")}catch(e){throw e}};var eN=a(23345);function ek(e){var t;let{label:a,name:s,options:n,value:l="",required:i=!0}=e,{register:o,setValue:d,trigger:c,formState:{errors:u}}=(0,E.xW)();return(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2",children:a}),(0,r.jsx)("input",{type:"hidden",...o(s,{required:i}),value:l||""}),(0,r.jsxs)(F.l6,{value:l||"",onValueChange:e=>{d(s,e,{shouldValidate:!0}),c(s)},children:[(0,r.jsx)(F.bq,{className:"w-full bg-gray-100 border-none outline-none border-gray-300\n                        focus:outline-none focus:ring-0 focus:border-transparent\n                        focus-visible:outline-none focus-visible:ring-0 focus-visible:border-transparent\n                        ".concat(l?"text-dark font-medium":"text-light-gray"),children:(0,r.jsx)(F.yv,{placeholder:"Select"})}),(0,r.jsx)(F.gC,{className:"max-h-60 overflow-y-auto",children:n.map(e=>{let{name:t,value:a}=e;return(0,r.jsx)(F.eb,{value:a,children:t},a)})})]}),u[s]&&(0,r.jsx)(P.A,{message:null==(t=u[s])?void 0:t.message})]})}let eC=e=>{var t,a,s,n,l,i,o,d,c,u,m,x,h;let{profile:v}=e,{watch:g,register:y,setValue:j,formState:{errors:b}}=(0,E.xW)(),w=g("profession")||(null==v||null==(t=v.customerDetails)?void 0:t.profession),_=g("employmentStatus")||(null==v||null==(a=v.customerDetails)?void 0:a.employmentStatus),N=g("sourceOfFunds")||(null==v||null==(s=v.customerDetails)?void 0:s.sourceOfFunds),k=g("annualIncome")||(null==v||null==(n=v.customerDetails)?void 0:n.annualIncome),C=g("jobTitle")||(null==v||null==(l=v.customerDetails)?void 0:l.jobTitle),S=g("nameOfEmployer")||(null==v||null==(i=v.customerDetails)?void 0:i.nameOfEmployer),A=g("authorizedHeirName")||(null==v||null==(o=v.customerDetails)?void 0:o.authorizedHeirName),F=g("authorizedHeirKinship")||(null==v||null==(d=v.customerDetails)?void 0:d.authorizedHeirKinship),q=g("designateAuthorizedHeir")||(null==v||null==(c=v.customerDetails)?void 0:c.designateAuthorizedHeir);(0,p.useEffect)(()=>{var e,t;j("designateAuthorizedHeir",null!=(t=null==v||null==(e=v.customerDetails)?void 0:e.designateAuthorizedHeir)&&t)},[v,j]);let{t:R}=(0,f.Bd)();return(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-4",children:[(0,r.jsx)(ek,{label:R("new_journey.complete_work_details_profile_modal.profession_label"),name:"profession",options:ep,value:w}),(0,r.jsx)(ek,{label:R("new_journey.complete_work_details_profile_modal.employment_status_label"),name:"employmentStatus",options:ef,value:_}),"Employed (full time)"===_&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(D.J,{className:"my-2",children:R("new_journey.complete_work_details_profile_modal.job_title_label")}),(0,r.jsx)(I.p,{defaultValue:C,...y("jobTitle",{required:"Employed (full time)"===_}),className:"!text-neutral-500"}),b.jobTitle&&(0,r.jsx)(P.A,{message:null==(u=b.jobTitle)?void 0:u.message})]}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(D.J,{className:"my-2",children:R("new_journey.complete_work_details_profile_modal.name_of_employer_label")}),(0,r.jsx)(I.p,{defaultValue:S,...y("nameOfEmployer",{required:"Employed (full time)"===_}),className:"!text-neutral-500"}
1),b.nameOfEmployer&&(0,r.jsx)(P.A,{message:null==(m=b.nameOfEmployer)?void 0:m.message})]})]}),(0,r.jsx)(ek,{label:R("new_journey.complete_work_details_profile_modal.source_of_funds_label"),name:"sourceOfFunds",options:ex,value:N}),(0,r.jsx)(ek,{label:R("new_journey.complete_work_details_profile_modal.annual_income_label"),name:"annualIncome",options:eh,value:k}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)("p",{children:R("new_journey.complete_work_details_profile_modal.heir_authorization")}),(0,r.jsxs)(eN.z,{value:q?"yes":"no",className:"flex flex-row rtl:flex-row-reverse gap-4",onValueChange:e=>j("designateAuthorizedHeir","yes"===e),children:[(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"yes",id:"yes"}),(0,r.jsx)(D.J,{htmlFor:"yes",children:R("option.yes")})]}),(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"no",id:"no"}),(0,r.jsx)(D.J,{htmlFor:"no",children:R("option.no")})]})]})]}),q&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col w-1/2",children:[(0,r.jsx)(D.J,{className:"my-2",children:R("profile.authorized_heir_name_label")}),(0,r.jsx)(I.p,{defaultValue:A,...y("authorizedHeirName",{required:q}),className:"!text-neutral-500"}),b.authorizedHeirName&&(0,r.jsx)(P.A,{message:null==(x=b.authorizedHeirName)?void 0:x.message})]}),(0,r.jsxs)("div",{className:"flex flex-col w-1/2",children:[(0,r.jsx)(D.J,{className:"my-2",children:R("profile.authorized_heir_kinship_label")}),(0,r.jsx)(I.p,{defaultValue:F,...y("authorizedHeirKinship",{required:q}),className:"!text-neutral-500"}),b.authorizedHeirKinship&&(0,r.jsx)(P.A,{message:null==(h=b.authorizedHeirKinship)?void 0:h.message})]})]})]})},eS=async e=>{let t=await (0,O.Q5)(e);t.isSuccess&&C.s.getState().store(t.result)},eE=e=>{var t;let{profile:a}=e,{watch:s,register:n,setValue:l,formState:{errors:i}}=(0,E.xW)(),o=s("politicallyExposed"),d=s("usCitizen"),c=s("taxIdentificationNumber"),u=s("financialServicesExperience"),{t:m}=(0,f.Bd)(),{branding:x}=(0,J.Q)(),h=x.entityName||x.legalName;return(0,p.useEffect)(()=>{var e,t,r,s,n,i,o,d;l("politicallyExposed",null!=(n=null==a||null==(e=a.customerDetails)?void 0:e.politicallyExposed)&&n),l("usCitizen",null!=(i=null==a||null==(t=a.customerDetails)?void 0:t.usCitizen)&&i),l("financialServicesExperience",null!=(o=null==a||null==(r=a.customerDetails)?void 0:r.workedInFinancial)&&o),l("taxIdentificationNumber",null!=(d=null==a||null==(s=a.customerDetails)?void 0:s.taxIdentificationNumber)?d:"")},[a,l]),(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-4",children:[(0,r.jsx)(D.J,{className:"text-1xl",children:m("new_journey.fatca_info_modal.fatca_title")}),(0,r.jsx)("p",{children:m("new_journey.fatca_info_modal.fatca_description",{entityName:h})}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)("p",{children:m("new_journey.fatca_info_modal.politically_exposed_label")}),(0,r.jsxs)(eN.z,{value:o?"yes":"no",className:"flex flex-row rtl:flex-row-reverse gap-4",onValueChange:e=>l("politicallyExposed","yes"===e),children:[(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"yes",id:"yes"}),(0,r.jsx)(D.J,{htmlFor:"yes",children:m("option.yes")})]}),(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"no",id:"no"}),(0,r.jsx)(D.J,{htmlFor:"no",children:m("option.no")})]})]})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)("p",{children:m("new_journey.fatca_info_modal.us_citizen_label")}),(0,r.jsxs)(eN.z,{value:d?"yes":"no",className:"flex flex-row rtl:flex-row-reverse gap-4",onValueChange:e=>l("usCitizen","yes"===e),children:[(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"yes",id:"yes"}),(0,r.jsx)(D.J,{htmlFor:"yes",children:m("option.yes")})]}),(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"no",id:"no"}),(0,r.jsx)(D.J,{htmlFor:"no",children:m("option.no")})]})]})]}),d&&(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("p",{className:"my-2",children:m("new_journey.fatca_info_modal.tax_identification_number_label")}),(0,r.jsx)(I.p,{defaultValue:c,...n("taxIdentificationNumber",{required:d}),className:"!text-neutral-500"}),i.taxIdentificationNumber&&(0,r.jsx)(P.A,{message:null==(t=i.taxIdentificationNumber)?void 0:t.message})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)("p",{children:m("new_journey.fatca_info_modal.financial_services_experience_label")}),(0,r.jsxs)(eN.z,{value:u?"yes":"no",className:"flex flex-row rtl:flex-row-reverse gap-4",onValueChange:e=>l("financialServicesExperience","yes"===e),children:[(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"yes",id:"yes"}),(0,r.jsx)(D.J,{htmlFor:"yes",children:m("option.yes")})]}),(0,r.jsxs)("div",{className:"flex items-center flex-row rtl:flex-row-reverse gap-2",children:[(0,r.jsx)(eN.C,{value:"no",id:"no"}),(0,r.jsx)(D.J,{htmlFor:"no",children:m("option.no")})]})]})]})]})},eA=async e=>{let t=await (0,O.eT)(e);t.isSuccess&&C.s.getState().store(t.result)};var eD=a(77667),eI=a(21630);function eF(e){let{className:t,...a}=e;return(0,r.jsx)(eI.bL,{"data-slot":"checkbox",className:(0,o.cn)("peer border-input cursor-pointer dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-sm border border-gray-400 shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:(0,r.jsx)(eI.C1,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,r.jsx)(n.CMH,{className:"size-3.5 "})})})}var eP=a(35627);let eq=["acknowledgePolicies","agreeClientAgreement","confirmRegulations","electronicSignatureAccepted"],eR=()=>{var e,t;let{watch:a,register:s,setValue:n,trigger:l,formState:{errors:i,submitCount:o}}=(0,E.xW)(),{profile:d}=(0,C.s)(),{branding:c}=(0,J.Q)(null==d?void 0:d.country),u=p.useMemo(()=>(0,eP.V6)(c.legalDocs),[c.legalDocs]),m=c.legalName,x=c.websiteUrl||"https://www.accuindex.com",h=x.replace(/^https?:\/\//,"").replace(/\/$/,""),f=(null==(e=(0,eP.Fv)(c.legalDocs,"privacyPolicy"))?void 0:e.url)||"https://www.accuindex.com/privacy-policy",v=(null==(t=(0,eP.Fv)(c.legalDocs,"clientAgreement"))?void 0:t.url)||"https://www.accuindex.com/client-agreement",g=a("acknowledgePolicies"),y=a("agreeClientAgreement"),j=a("confirmRegulations"),b=a("electronicSignatureAccepted"),w=null!=g&&g&&null!=y&&y&&null!=j&&j&&null!=b&&b,{t:_}=(0,eD.Bd)();p.useEffect(()=>{s("acknowledgePolicies",{validate:e=>{var t;return t=a(),eq.every(e=>!0===t[e])||_("new_journey.declarations_modal.all_declarations_required")}}),s("agreeClientAgreement"),s("confirmRegulations"),s("electronicSignatureAccepted"),s("acceptedDocuments"),s("legalName")},[s,a,_]);let N=p.useMemo(()=>(0,eP.Bc)(c.legalDocs),[c.legalDocs]),k=JSON.stringify(N);p.useEffect(()=>{n("acceptedDocuments",N)},[k,n]),p.useEffect(()=>{n("legalName",m)},[m,n]);let S=(e,t)=>{n(e,t,{shouldValidate:!0}),o>0&&l("acknowledgePolicies")};return(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-4",children:[(0,r.jsx)(D.J,{className:"text-1xl",children:_("new_journey.declarations_modal.confirm_and_agree")}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(eF,{onCheckedChange:e=>S("acknowledgePolicies",e),checked:null!=g&&g,className:"mt-1"}),(0,r.jsx)(D.J,{className:"font-normal inline leading-5",children:(0,r.jsxs)(eD.x6,{i18nKey:"new_journey.declarations_modal.acknowledge_policies_label",values:{legalName:m,website:h},components:{1:(0,r.jsx)("a",{className:"underline text-primary",href:x,target:"_blank",rel:"noopener noreferrer"})},children:["You have read, understood, acknowledged, and agreed to all ",{legalName:m},"'s policies, terms and conditions, and client agreements which are available on the company's website ",(0,r.jsx)("a",{className:"underline text-primary",href:x,target:"_blank",rel:"noopener noreferrer",children:"{{website}}"}),"."]})})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(eF,{onCheckedChange:e=>S("agreeClientAgreement",e),checked:null!=y&&y,className:"mt-1"}),(0,r.jsx)(D.J,{className:"font-normal inline leading-5",children:(0,r.jsxs)(eD.x6,{i18nKey:"new_journey.declarations_modal.agree_client_agreement_label",values:{legalName:m},components:{1:(0,r.jsx)("a",{className:"underline text-primary",href:f,target:"_blank",rel:"noopener noreferrer"}),5:(0,r.jsx)("a",{className:"underline text-primary",href:v,target:"_blank",rel:"noopener noreferrer"})},children:["You have read, understood, and agreed to ",{legalName:m},"'s client agreement which includes order execution policy, conflict of interest policy, ",(0,r.jsx)("a",{className:"underline text-primary",href:f,target:"_blank",rel:"noopener noreferrer",children:"privacy policy"}),", 3rd party disclosure policy and any other terms in the ",(0,r.jsx)("a",{className:"underline text-primary",href:v,target:"_blank",rel:"noopener noreferrer",children:"client agreement"}),"."]})})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(eF,{onCheckedChange:e=>S("confirmRegulations",e),checked:null!=j&&j,id:"confirmRegulations",className:"mt-1"}),(0,r.jsx)(D.J,{htmlFor:"confirmRegulations",className:"font-normal cursor-pointer leading-5",children:_("new_journey.declarations_modal.confirm_regulations_label",{legalName:m})})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(eF,{onCheckedChange:e=>S("electronicSignatureAccepted",e),checked:null!=b&&b,id:"electronicSignatureAccepted"}),(0,r.jsx)(D.J,{htmlFor:"electronicSignatureAccepted",className:"font-normal cursor-pointer",children:_("new_journey.declarations_modal.signature_label")})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)(eF,{id:"all",checked:null!=w&&w,onCheckedChange:e=>{eq.forEach(t=>S(t,e))},value:"selectAll"}),(0,r.jsx)(D.J,{htmlFor:"all",className:"font-normal cursor-pointer",children:_("new_journey.declarations_modal.select_all_label")})]}),i.acknowledgePolicies&&(0,r.jsx)(P.A,{message:i.acknowledgePolicies.message}),u.length>0&&(0,r.jsxs)("div",{className:"mt-2 rounded-md border border-gray-200 p-3 text-sm",children:[(0,r.jsx)("p",{className:"font-medium mb-2",children:_("new_journey.declarations_modal.legal_documents_title")}),(0,r.jsx)("ul",{className:"flex flex-col gap-1",children:u.map(e=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center gap-1",children:[(0,r.jsx)("a",{className:"underline text-primary",href:e.url,target:"_blank",rel:"noopener noreferrer",children:e.label}
1),e.version&&(0,r.jsxs)("span",{className:"text-gray-500",children:["(",e.version,")"]})]},e.key))})]})]})},eO=async e=>{var t;let a=(e=>({acknowledgePolicies:"I have read, understood, acknowledged, and agreed to all ".concat(e,"'s policies, terms and conditions, and client agreements."),agreeClientAgreement:"I have read, understood, and agreed to ".concat(e,"'s client agreement which includes order execution policy, conflict of interest policy, privacy policy, 3rd party disclosure policy and any other terms in the client agreement."),confirmRegulations:"I confirm that I understand and comply with all applicable regulations.",electronicSignatureAccepted:"Your electronic signature is considered a legal and official signature."}))(e.legalName||"Accuindex"),r=eq.filter(t=>!0===e[t]).map(e=>a[e]),s=await (0,O._Q)({declarations:r,...(null==(t=e.acceptedDocuments)?void 0:t.length)?{acceptedDocuments:e.acceptedDocuments}:{}});s.isSuccess&&C.s.getState().store(s.result)};var eT=a(85331),ez=a(86698),eL=a(89049),eV=a(99776);let eK={PENDING:"PENDING",APPROVED:"APPROVED",REJECTED:"REJECTED"},eM=q.F.map(e=>{var t,a;return{name:null!=(t=null==e?void 0:e.countryEn)?t:"",value:null!=(a=null==e?void 0:e.countryEn)?a:""}}),eB=(0,p.forwardRef)(function(e,t){let{documentType:a,setDocumentType:s,file:n,setFile:l,frontFile:i,setFrontFile:o,backFile:d,setBackFile:c,errors:u={},profile:m,onSuccess:x,globalSettings:h={KYC_CHECK_SUMSUB_DEPOSIT_REQUIREMENT:!0,KYC_CHECK_SUMSUB:!0,KYC_CHECK_SUMSUB_COUNTRIES_OVERIDE:[]},country:v="",setCountry:g=()=>{},validate:y=!1}=e,{t:j}=(0,f.Bd)(),b=(0,eV.jE)(),w=(()=>{if(!m)return!1;let e=(0,S.S3)(m,["levelOne"]),t=(0,S.W9)(h||{},m,e,"sumsub"),a=null==h||!h.KYC_CHECK_SUMSUB_DEPOSIT_REQUIREMENT||(null==m?void 0:m.isFunded)&&![eK.PENDING,eK.APPROVED,eK.REJECTED].includes(null==m?void 0:m.levelOneKYCStatus);return!t&&a})();return(0,p.useImperativeHandle)(t,()=>({getDocumentData:()=>{if(!a||!v)return null;let e=[];if("PASSPORT"===a&&n)e=[n];else{if("ID_CARD"!==a||!i||!d)return null;e=[i,d]}return{documentType:a,files:e,country:v}},validate:()=>a?v?"PASSPORT"!==a||n?"ID_CARD"!==a||!!i&&!!d||((0,T.oR)({variant:"destructive",title:j("documents.upload.upload_id_card_error")}),!1):((0,T.oR)({variant:"destructive",title:j("documents.upload.error")}),!1):((0,T.oR)({variant:"destructive",title:j("documents.upload.select_country_error")}),!1):((0,T.oR)({variant:"destructive",title:j("documents.upload.select_id_proof_type_error")}),!1)})),(0,r.jsx)("div",{className:"space-y-6",children:w?(0,r.jsx)(eL.Y,{userEmail:null==m?void 0:m.email,onError:e=>{console.error("Sumsub error:",e),(0,T.oR)({variant:"destructive",title:j("documents.upload.error")})},onMessage:e=>{"idCheck.completed"===e&&((0,T.oR)({variant:"success",title:j("documents.upload.verification_completed")}),b.invalidateQueries({queryKey:["documents"]}),x&&x())}}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(D.J,{htmlFor:"country",children:j("new_journey.nationality")}),(0,r.jsxs)(F.l6,{value:v,onValueChange:g,children:[(0,r.jsx)(F.bq,{className:"w-full",children:(0,r.jsx)(F.yv,{placeholder:j("new_journey.select_nationality")})}),(0,r.jsx)(F.gC,{children:eM.map(e=>(0,r.jsx)(F.eb,{value:e.value,children:e.name},e.value))})]}),u.country&&(0,r.jsx)("p",{className:"text-sm text-red-500 py-1",children:u.country})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(D.J,{htmlFor:"documentSubType",children:j("documents.upload.id_proof_type")}),(0,r.jsxs)(F.l6,{onValueChange:e=>{s(e),l(void 0),o(void 0),c(void 0)},value:a||"",children:[(0,r.jsx)(F.bq,{className:"w-full",children:(0,r.jsx)(F.yv,{placeholder:j("documents.upload.select_id_proof_type")})}),(0,r.jsxs)(F.gC,{children:[(0,r.jsx)(F.eb,{value:"PASSPORT",children:j("documents.upload.passport")}),(0,r.jsx)(F.eb,{value:"ID_CARD",children:j("documents.upload.id_card")})]})]}),u.documentType&&(0,r.jsx)("p",{className:"text-sm text-red-500 py-1",children:u.documentType})]}),"PASSPORT"===a&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(eT.E,{label:j("documents.upload.upload_passport"),name:"file",onChange:e=>{var t;return(null==(t=e.target.files)?void 0:t[0])&&l(e.target.files[0])},customError:u.file,className:"w-full"}),n&&(0,r.jsx)(ez.N,{file:n}),y&&!n&&(0,r.jsx)("p",{className:"text-sm text-red-500 py-1",children:j("documents.upload.error")})]}),"ID_CARD"===a&&(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(eT.E,{label:j("documents.upload.upload_front"),name:"frontFile",onChange:e=>{var t;return(null==(t=e.target.files)?void 0:t[0])&&o(e.target.files[0])},customError:u.frontFile,className:"w-full"}),i&&(0,r.jsx)(ez.N,{file:i}),y&&!i&&(0,r.jsx)("p",{className:"text-sm text-red-500 py-1",children:j("documents.upload.upload_front_error")}),(0,r.jsx)(eT.E,{label:j("documents.upload.upload_back"),name:"backFile",onChange:e=>{var t;return(null==(t=e.target.files)?void 0:t[0])&&c(e.target.files[0])},customError:u.backFile,className:"w-full"}),d&&(0,r.jsx)(ez.N,{file:d}),y&&!d&&(0,r.jsx)("p",{className:"text-sm text-red-500 py-1",children:j("documents.upload.upload_back_error")})]})]})})});eB.displayName="IDProofUpload";let e$=(0,p.forwardRef)((e,t)=>{var a;let{profile:s}=e,{formState:{errors:n}}=(0,E.xW)(),[l,i]=(0,p.useState)(null),[o,d]=(0,p.useState)(),[c,u]=(0,p.useState)(),[m,x]=(0,p.useState)(),h=(0,p.useRef)(null),[v,g]=(0,p.useState)((null==s||null==(a=s.customerDetails)?void 0:a.nationality)||""),[y,j]=(0,p.useState)(!1),[b,w]=(0,p.useState)({}),{t:_}=(0,f.Bd)();(0,p.useEffect)(()=>{(async()=>{try{let e=await (0,O.fv)();w(e)}catch(e){console.error("Error fetching global settings:",e)}})()},[]),(0,p.useImperativeHandle)(t,()=>({submitData:async()=>{var e,t;if(j(!0),!(null==(e=h.current)?void 0:e.validate()))throw Error(_("documents.upload.document_type_label"));let a=null==(t=h.current)?void 0:t.getDocumentData();if(!a)throw Error(_("documents.upload.document_type_label"));return a}}));let N=Object.fromEntries(Object.entries(n).map(e=>
1{let[t,a]=e;return[t,(null==a?void 0:a.message)||""]}));return(0,r.jsx)("div",{className:"py-4",children:(0,r.jsx)(eB,{documentType:l,setDocumentType:i,file:o,ref:h,setFile:d,frontFile:c,setFrontFile:u,backFile:m,setBackFile:x,errors:N,profile:s,country:v,setCountry:g,validate:y,globalSettings:b})})});e$.displayName="IdVerification";var eU=a(41441);let eH=(0,p.forwardRef)((e,t)=>{let{formState:{errors:a},setError:s,clearErrors:n}=(0,E.xW)(),[l,i]=(0,p.useState)(),{t:o}=(0,f.Bd)(),d=async()=>{if(!l)throw s("file",{type:"manual",message:o("new_journey.proof_of_address_modal.document_required")}),Error(o("new_journey.proof_of_address_modal.document_required"));return n("file"),l};return(0,p.useImperativeHandle)(t,()=>({submitData:d})),(0,r.jsxs)("div",{className:"space-y-5",children:[(0,r.jsx)("p",{className:"text-lg font-semibold py-3",children:o("new_journey.proof_of_address_modal.description")}),(0,r.jsxs)("ul",{className:"list-disc list-inside space-y-2 text-sm  px-6",children:[(0,r.jsx)("li",{children:o("new_journey.proof_of_address_modal.unhcr_statement")}),(0,r.jsx)("li",{children:o("new_journey.proof_of_address_modal.residence_permit")}),(0,r.jsxs)("li",{children:[o("new_journey.proof_of_address_modal.bank_statement"),(0,r.jsxs)("span",{className:"text-gray-500",children:[" (",o("new_journey.proof_of_address_modal.bank_statement_note"),")"]})]}),(0,r.jsx)("li",{children:o("new_journey.proof_of_address_modal.utility_bill")}),(0,r.jsx)("li",{children:o("new_journey.proof_of_address_modal.payment_system_statement")}),(0,r.jsx)("li",{children:o("new_journey.proof_of_address_modal.affidavit")})]}),(0,r.jsxs)("div",{className:"my-4",children:[(0,r.jsx)("h3",{className:"font-medium my-2",children:o("new_journey.proof_of_address_modal.take_photo_label")}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:o("new_journey.proof_of_address_modal.take_photo_description")})]}),(0,r.jsx)(eT.E,{label:o("documents.upload.upload_document"),name:"file",onChange:e=>{var t;(null==(t=e.target.files)?void 0:t[0])&&(i(e.target.files[0]),n("file"))},className:"w-full"}),l&&(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(ez.N,{file:l})}),a.file&&(0,r.jsx)("p",{className:"text-red-500",children:a.file.message})]})});eH.displayName="addressVerification";let eJ=()=>{var e;let{t}=(0,f.Bd)(),{profile:a}=(0,C.s)(),r=(null==a?void 0:a.emailChangedFromJourney)&&!(null==(e=a.customerDetails)?void 0:e.emailVerified);return[{key:"personalInformation",Step:ey,onSubmit:ej,title:t("new_journey.complete_your_profile"),description:t("new_journey.description")},{key:"emailVerification",Step:ew,onSubmit:e_,title:t(r?"new_journey.email_verification_modal.title":"new_journey.email_edit_modal.title"),description:t(r?"new_journey.email_verification_modal.description":"new_journey.email_edit_modal.description"),centerDescription:!0},{key:"financialInformation",Step:eC,onSubmit:eS,title:t("new_journey.complete_work_details_profile_modal.title"),description:t("new_journey.description")},{key:"fatca",Step:eE,onSubmit:eA,title:t("new_journey.journey_dashboard.completeProfile__fatca"),description:t("new_journey.description")},{key:"declarations",Step:eR,onSubmit:eO,title:t("new_journey.journey_dashboard.completeProfile__declarations"),description:t("new_journey.description")},{key:"idVerification",Step:e$,onSubmit:()=>{},title:t("new_journey.proof_of_identity_modal.title"),description:t("new_journey.proof_of_identity_modal.description")},{key:"addressVerification",Step:eH,onSubmit:()=>{},title:t("new_journey.proof_of_address_modal.title"),description:t("new_journey.description")},{key:"createAccount",Step:null,onSubmit:()=>{},title:t("new_journey.journey_dashboard.createAccount"),description:t("new_journey.create_account.description"),externalLink:"/accounts"},{key:"deposit",Step:null,onSubmit:()=>{},title:t("new_journey.journey_dashboard.deposit"),description:t("new_journey.deposit.description"),externalLink:"/deposits"}]};var eW=a(2443);let eQ=e=>{let{open:t,onOpenChange:a,onNext:s,showNextButton:n=!0}=e,{t:l}=(0,f.Bd)();return(0,r.jsx)(A.lG,{open:t,onOpenChange:a,children:(0,r.jsxs)(A.Cf,{className:"w-full max-w-lg p-6 bg-white border-none rounded-xl shadow-lg text-center",children:[(0,r.jsx)("div",{className:"flex justify-center my-4",children:(0,r.jsx)(d.default,{src:"/assets/images/time-search.svg",alt:l("new_journey.document_review_modal.alt_text"),width:80,height:80})}),(0,r.jsx)(A.c7,{className:"border-0 space-y-3",children:(0,r.jsx)(A.L3,{className:"text-2xl font-semibold text-gray-900 text-center md:px-15",children:l("new_journey.document_review_modal.title")})}),(0,r.jsx)(A.rr,{className:"text-gray-700 text-base",children:l("new_journey.journey_dashboard.verification_pending_message")}),n&&(0,r.jsx)("div",{className:"mt-6 flex justify-center",children:(0,r.jsx)(u.$,{className:"rounded px-6",onClick:()=>{a(!1),s&&s()},children:l("new_journey.document_review_modal.next_button")})})]})})},eY=e=>{let{open:t,onOpenChange:a,onNext:s,documentType:n="address"}=e,{t:l}=(0,f.Bd)();return(0,r.jsx)(A.lG,{open:t,onOpenChange:a,children:(0,r.jsxs)(A.Cf,{className:"p-6 bg-white border-none max-w-lg",children:[(0,r.jsxs)(A.c7,{className:"items-center text-center space-y-4",children:[(0,r.jsx)(d.default,{src:"/assets/images/warning.svg",alt:l("new_journey.verify_documents_modal.alt_text"),width:64,height:64,priority:!0,className:"mx-auto"}),(0,r.jsx)(A.L3,{className:"text-2xl font-semibold text-dark",children:l("identity"===n?"new_journey.verify_id_documents_modal.title":"new_journey.verify_address_documents_modal.title")}),(0,r.jsx)(A.rr,{className:"text-gray-600",children:l("identity"===n?"new_journey.verify_id_documents_modal.description":"new_journey.verify_address_documents_modal.description")})]}),(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsx)("h4",{className:"text-dark font-semibold mb-2",children:l("identity"===n?"new_journey.verify_id_documents_modal.proof_title":"new_journey.verify_address_documents_modal.proof_title")}),(0,r.jsx)("p",{className:"text-muted text-sm mb-3",children:l("identity"===n?"new_journey.verify_id_documents_modal.proof_description":"new_journey.verify_address_documents_modal.proof_description")}),(0,r.jsx)("ul",{className:"list-disc list-inside space-y-1 text-sm text-gray-600 pl-4",children:"address"===n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("li",{children:l("new_journey.verify_documents_modal.utility_bill")}),(0,r.jsx)("li",{children:l("new_journey.verify_documents_modal.bank_statement")}),(0,r.jsx)("li",{children:l("new_journey.verify_documents_modal.government_document")})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("li",{children:l("new_journey.verify_id_documents_modal.passport")}),(0,r.jsx)("li",{children:l("new_journey.verify_id_documents_modal.id_card")}),(0,r.jsx)("li",{children:l("new_journey.verify_id_documents_modal.drivers_license")})]})}),"address"===n&&(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-3",children:(0,r.jsx)("small",{children:l("new_journey.verify_documents_modal.note")})})]}),(0,r.jsx)(u.$,{className:"w-full mt-6",onClick:s,children:l("identity"===n?"new_journey.verify_id_documents_modal.next_button":"new_journey.verify_address_documents_modal.next_button")})]})})},eG=e=>{let{open:t,onOpenChange:a,documentType:s="address"}=e,{t:n}=(0,f.Bd)();return(0,r.jsx)(A.lG,{open:t,onOpenChange:a,children:(0,r.jsx)(A.Cf,{className:"p-6 bg-white border-none max-w-lg text-center",children:(0,r.jsxs)(A.c7,{className:"items-center space-y-4",children:[(0,r.jsx)(d.default,{src:"/assets/images/true.svg",alt:n("new_journey.verified_modal.alt_text"),width:64,height:64,priority:!0,className:"mx-auto"}),(0,r.jsx)(A.L3,{className:"text-2xl font-semibold text-dark md:px-15 text-center",children:n("identity"===s?"new_journey.identity_verified":"new_journey.address_verified")})]})})})};var eZ=a(22454);function eX(){var e,t,a,r,s;let{profile:n}=(0,C.s)(),l=!!(null==n||null==(a=n.customerDetails)||null==(t=a.journeyStatus)||null==(e=t.completeProfile__declarations)?void 0:e.status),i=(0,eZ.I)({queryKey:eP._V,queryFn:eP.__,enabled:!!n&&l,staleTime:3e5,retry:1}),o=null!=(s=null==(r=i.data)?void 0:r.pending)?s:[];return{...i,pending:o,hasPending:o.length>0,declarationsDone:l}}let e0="documentAcceptance",e1=()=>{let{t:e}=(0,f.Bd)(),{register:t,setValue:a,watch:s,formState:{errors:n}}=(0,E.xW)(),{pending:l}=eX(),{branding:i}=(0,J.Q)(),o=s("documentsAccepted");p.useEffect(()=>{t("documentsAccepted",{validate:t=>!0===t||e("agreements_modal.accept_required")}),t("pendingDocuments")},[t,e]);let d=JSON.stringify(l.map(e=>{let{key:t,version:a}=e;return{key:t,version:a}}));return p.useEffect(()=>{a("pendingDocuments",l.map(e=>{let{key:t,version:a}=e;return{key:t,...a?{version:a}:{}}}))},[d,a]),(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-4",children:[(0,r.jsx)("ul",{className:"flex flex-col gap-3",children:l.map(t=>(0,r.jsxs)("li",{className:"rounded-md border border-gray-200 p-3 text-sm",children:[(0,r.jsx)("a",{href:(0,eP.Ks)(i.legalDocs,t.key)||(0,eP.dB)(t.url),target:"_blank",rel:"noopener noreferrer",className:"font-medium underline text-primary",children:(0,eP.c2)(t.key,t.name)}
1),(0,r.jsxs)("div",{className:"text-gray-500 mt-1 flex flex-wrap gap-x-3",children:[t.version&&(0,r.jsx)("span",{children:e("agreements_modal.version",{version:t.version})}),t.effectiveFrom&&(0,r.jsx)("span",{children:e("agreements_modal.effective_from",{date:new Date(t.effectiveFrom).toLocaleDateString()})}),(0,r.jsx)("span",{children:t.previouslyAccepted?e("agreements_modal.previously_accepted",{version:t.previouslyAccepted}):e("agreements_modal.not_previously_accepted")})]})]},t.key))}),(0,r.jsxs)("div",{className:"flex gap-3 items-start",children:[(0,r.jsx)(eF,{id:"documentsAccepted",checked:null!=o&&o,onCheckedChange:e=>a("documentsAccepted",!0===e,{shouldValidate:!0}),className:"mt-1"}),(0,r.jsx)(D.J,{htmlFor:"documentsAccepted",className:"font-normal cursor-pointer leading-5",children:e("agreements_modal.accept_statement",{legalName:i.legalName})})]}),n.documentsAccepted&&(0,r.jsx)(P.A,{message:n.documentsAccepted.message})]})},e2=async e=>{var t;let a=null!=(t=e.pendingDocuments)?t:[];if(0===a.length)return;let r=await (0,O._Q)({declarations:["reaccept"],acceptedDocuments:a});r.isSuccess&&r.result&&C.s.getState().store(r.result)};function e5(e){var t,a,n;let{openModal:l,setOpenModal:i,isFirstLogin:o=!1}=e,{profile:d,getCurrentStep:c}=(0,C.s)(),m=(0,E.mN)({mode:"onSubmit",shouldUnregister:!0}),[x,h]=(0,p.useState)(0),[v,g]=(0,p.useState)(!1),[y,j]=(0,p.useState)(!1),[b,_]=(0,p.useState)(!1),[N,k]=(0,p.useState)(!1),[S,D]=(0,p.useState)(!1),[I,F]=(0,p.useState)(!1),[P,q]=(0,p.useState)(!1),[R,L]=(0,p.useState)("identity"),V=(0,p.useRef)(null),K=(0,p.useRef)(null),M=(0,p.useRef)(null),B=(0,s.useRouter)(),{t:$}=(0,f.Bd)(),U=(0,eV.jE)(),H=eJ(),{hasPending:J}=eX(),W=(0,p.useRef)(!1),Q=c(),Y=(0,p.useMemo)(()=>{if(!J)return H;let e=H.findIndex(e=>"declarations"===e.key),t={key:e0,Step:e1,onSubmit:e2,title:$("agreements_modal.step_title"),description:$("agreements_modal.step_description")};return[...H.slice(0,e+1),t,...H.slice(e+1)]},[H,J,$]),Z=(0,p.useCallback)(e=>{var t;let a=e?null==(t=H[e-1])?void 0:t.key:void 0,r=a?Y.findIndex(e=>e.key===a):-1;return r>=0?r:Math.min((null!=e?e:1)-1,Y.length-1)},[H,Y]),X=x<Y.length?Y[x]:null,{Step:ee,onSubmit:et,key:ea,title:er,description:es,centerDescription:en}=X||{},el="idVerification"===ea||"addressVerification"===ea,ei="emailVerification"===ea,eo=ea===e0,ed=ei&&(null==d?void 0:d.emailChangedFromJourney)&&!(null==(t=d.customerDetails)?void 0:t.emailVerified),ec="createAccount"===ea||"deposit"===ea;(0,p.useEffect)(()=>{ea&&("idVerification"===ea?L("identity"):"addressVerification"===ea&&L("address"))},[ea,d]),(0,p.useEffect)(()=>{var e;null!=d&&null!=(e=d.customerDetails)&&e.submitClientProfile||y||(h(Z(Q)),o&&i(!0),j(!0))},[d,Q,i,y,Z,o]),(0,p.useEffect)(()=>{if(!J){W.current=!1;return}if(W.current)return;W.current=!0;let e=Y.findIndex(e=>e.key===e0);e>=0&&h(e),i(!0)},[J,Y,i]),(0,p.useEffect)(()=>{ei||(k(!1),D(!1))},[ei]);let eu=()=>{eo||(i(!1),h(Z(Q)))},em=(0,p.useCallback)(()=>{m.reset(),x<Y.length-1?(h(e=>e+1),k(!1),D(!1)):i(!1)},[m,x,Y.length,i]),ep=(0,p.useCallback)(async()=>{try{return await (0,O.l2)()}catch(e){return console.error("Error refreshing profile data:",e),null}},[]),ex=async e=>{if(et){if("createAccount"===ea||"deposit"===ea){let e=Y.find(e=>e.key===ea);if(null==e?void 0:e.externalLink){B.push(e.externalLink),i(!1);return}}g(!0);try{var t,a,r,s,n;if("idVerification"===ea){let e=await (null==(t=M.current)?void 0:t.submitData());if(!e)throw Error("Please upload required file");let r={title:"ID_PROOF",customerId:null!=(a=null==d?void 0:d.id)?a:"",files:e.files,metadata:{documentType:e.documentType,country:e.country}},{result:s}=await (0,eU.HK)();s.rows.find(e=>"ID_PROOF"===e.documentType)?await (0,eU.kS)(r):await (0,eU.XX)(r),(0,T.oR)({variant:"success",title:$("documents.upload.success")}),await ep(),i(!1),L("identity"),_(!0)}else if("addressVerification"===ea){let e=await (null==(r=M.current)?void 0:r.submitData());if(!e)throw Error("Please upload required file");let t={title:"ADDRESS_PROOF",customerId:null!=(s=null==d?void 0:d.id)?s:"",files:[e]},{result:a}=await (0,eU.HK)();a.rows.find(e=>"ADDRESS_PROOF"===e.documentType)?await (0,eU.kS)(t):await (0,eU.XX)(t),(0,T.oR)({variant:"success",title:$
1("documents.upload.success")}),await ep(),i(!1),L("address"),_(!0)}else if("emailVerification"===ea){let t=e.email,a=null==d?void 0:d.email;if(t!==a&&await et(e),ed)return;k(!0)}else if(eo){await et(e),U.setQueryData(eP._V,e=>e?{...e,pending:[]}:e),U.invalidateQueries({queryKey:eP._V}),U.invalidateQueries({queryKey:["user-profile"]}),(0,T.oR)({variant:"success",description:$("agreements_modal.success")});let t=c(),a=t?null==(n=H[t-1])?void 0:n.key:void 0,r=a?H.findIndex(e=>e.key===a):-1;r<0||"createAccount"===a||"deposit"===a?i(!1):(m.reset(),h(r))}else await et(e),em()}catch(e){(0,T.oR)({variant:"destructive",description:(0,z.r)(e instanceof Error?e.message:void 0,$)})}finally{g(!1)}}};async function eh(){g(!0);try{let e=N?d.email:m.getValues("email"),t=await eW.t.sendVerificationCode({action:"EMAIL_VERIFICATION",payload:{email:e}});K.current=null==t?void 0:t.result,D(!0)}catch(e){throw(0,T.oR)({variant:"destructive",description:(0,z.r)(e instanceof Error?e.message:"Unable to send otp",$)}),e}finally{g(!1)}}async function ef(e){let t=null!=e?e:V.current;if(!t||!K.current)return void(0,T.oR)({variant:"destructive",description:$("new_journey.email_verification_modal.message")});g(!0);try{let e=await eW.t.verifyPin({pin:t,verificationId:K.current});e.result.verified?em():(0,T.oR)({variant:"destructive",description:e.result.message||"Invalid verification code"})}catch(e){(0,T.oR)({variant:"destructive",description:(0,z.r)(e instanceof Error?e.message:"Unable to verify otp",$)})}finally{g(!1)}}let ev=()=>{var e;m.reset(),N?(k(!1),D(!1)):"financialInformation"===ea&&(null==d||null==(e=d.customerDetails)?void 0:e.emailVerified)?h(0):x>0&&h(e=>e-1)};return!X||ec?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eY,{open:I,onOpenChange:F,onNext:()=>{if(F(!1),"identity"===R){let e=Y.findIndex(e=>"idVerification"===e.key);e>=0&&h(e)}else{let e=Y.findIndex(e=>"addressVerification"===e.key);e>=0&&h(e)}},documentType:R}),(0,r.jsx)(eQ,{open:b,onOpenChange:_,onNext:()=>{if(_(!1),"identity"===R){let e=Y.findIndex(e=>"idVerification"===e.key);e>=0&&h(e+1),i(!0)}else"address"===R&&q(!0)},documentType:R,showNextButton:"identity"===R}),(0,r.jsx)(eG,{open:P,onOpenChange:q,documentType:R,onNext:()=>{q(!1),em()}}),(0,r.jsx)(A.lG,{open:l,onOpenChange:eu,children:(0,r.jsx)(A.Cf,{className:"p-8 bg-white border-none max-h-[80vh] overflow-y-auto pb-2",showCloseButton:!eo,onEscapeKeyDown:e=>{eo&&e.preventDefault()},onPointerDownOutside:e=>{eo&&e.preventDefault()},onInteractOutside:e=>{eo&&e.preventDefault()},children:(0,r.jsx)(E.Op,{...m,children:(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),m.handleSubmit(ex)(e)},children:[(0,r.jsx)(A.L3,{className:"text-2xl mb-2 ".concat(en?"text-center":""),children:er}),(0,r.jsx)(A.rr,{className:"text-gray-500 ".concat(en?"text-center":""),children:es}),!N&&(0,r.jsxs)("div",{className:"mt-2 text-sm font-semibold text-light-gray",children:[(0,r.jsx)("p",{className:"text-gray-500",children:$("new_journey.of",{current:x+1,total:Y.length})}),(0,r.jsx)(G.k,{value:Math.round((x+1)/Y.length*100),className:"mt-1"})]}),ee&&(0,r.jsx)(ee,{profile:d,setPin:e=>{V.current=e},email:null!=(n=null==d?void 0:d.email)?n:"",emailVerified:!!(null==d||null==(a=d.customerDetails)?void 0:a.emailVerified),handleSendOtp:eh,isOtpMode:null!=N&&N||null!=ed&&ed,onOtpComplete:ef,...el?{ref:M}:{}}),N||ed?(0,r.jsxs)("div",{className:"d-inline",children:[(0,r.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 my-3 p-6",children:[(0,r.jsx)(u.$,{disabled:v,variant:"outline",type:"button",className:"flex-1",onClick:ev,children:$("button.back")}),(0,r.jsx)(u.$,{type:"button",className:"flex-1",onClick:()=>ef(),disabled:v||!S,children:v?(0,r.jsx)(w.y,{}):$("button.verify")})]}),(0,r.jsxs)("p",{className:"flex items-center justify-center text-sm mb-8",children:[$("new_journey.email_verification_modal.no_code_received")," ",(0,r.jsx)("span",{className:"cursor-pointer underline text-primary font-medium mx-1",onClick:eh,children:$("new_journey.email_verification_modal.resend_code")})]})]}):(0,r.jsxs)(A.Es,{className:"flex-row justify-end gap-4 mt-6 mb-8",children:[!eo&&(0,r.jsx)(A.HM,{asChild:!0,className:"w-1/4",onClick:eu,children:(0,r.jsx)(u.$,{variant:"ghost",disabled:v,className:"text-light-gray underline tracking-wide",children:$("button.later")})}),!["personalInformation","emailVerification",e0].includes(ea)&&(0,r.jsx)(u.$,{disabled:v,type:"button",className:"w-1/4",variant:"secondary",onClick:ev,children:$("button.back")}),(0,r.jsx)(u.$,{type:"submit",className:ei?"w-full":"md:w-full md:w-1/2",disabled:v,children:v?(0,r.jsx)(w.y,{}):eo?$("agreements_modal.accept_button"):ei?$("button.confirm"):$("button.next")})]}),(0,r.jsx)("div",{className:"text-sm text-gray-500 text-center",children:$("new_journey.encrypted_data")})]})})})})]})}
1var e4=a(6092),e3=a(10630),e6=a(50742),e8=a(6172),e7=a(53380),e9=a(16443);function te(){let{toggleSidebar:e,state:t,isMobile:a,setOpenMobile:s}=(0,h.cL)(),n="expanded"===t;return(0,r.jsx)(j(),{href:"/",onClick:()=>{a?s(!1):e()},className:"flex items-center justify-center p-3 py-5 cursor-pointer overflow-hidden",children:(0,r.jsx)("div",{className:"relative flex items-center justify-center transition-all duration-300 ease-in-out",style:{width:n?"120px":"50px",height:n?"85px":"50px"},children:(0,r.jsx)(d.default,{src:"/assets/images/accuindex-light-logo.png",alt:"Accuindex Logo",width:120,height:85,className:"h-full w-full object-contain transition-all duration-300 ease-in-out",priority:!0})})})}function tt(){var e,t,a,l,i,o;let{t:d}=(0,f.Bd)("translation"),c=(0,s.usePathname)()||"",u=c.toLowerCase().includes("/ib"),[m,x]=(0,p.useState)({clients:!0,funds:!0}),{state:g,setOpen:y,isMobile:b,setOpenMobile:w}=(0,h.cL)(),{logout:_}=(0,v.n)(),N=(0,s.useRouter)(),{profile:k}=(0,C.s)(),{data:S}=(0,eZ.I)({queryKey:["fund-transfer-settings"],queryFn:e9.SL}),{data:E}=(0,eZ.I)({queryKey:["global-settings"],queryFn:()=>(0,O.fv)()}),A=(null!=(o=null==k||null==(t=k.Settings)||null==(e=t.walletSettings)?void 0:e.enabled)?o:null==E||null==(a=E.WALLET_SETTINGS)?void 0:a.enabled)===!0,D=()=>{b&&w(!1)},I="flex items-center w-full py-1 my-0.5 mx-2 rounded-md font-medium transition-all duration-200",F=[{name:"dashboard",translationKey:"dashboard",icon:et._ht,path:"/"},{name:"accounts",translationKey:"accounts",icon:e6.RVu,path:"/accounts",hideForIb:!0},{name:"clients",translationKey:"clients",icon:n.YXz,path:"/clients",subItems:[{name:"clients_registration",translationKey:"clients_registration",path:"/clients/registration"},{name:"clients_activity",translationKey:"clients_activity",path:"/clients/activity"}],showOnlyForIb:!0},...A?[{name:"virtual_wallets",translationKey:"virtual_wallets",icon:H.lcY,path:"/virtual-wallets"}]:[],{name:"promotions",translationKey:"promotions",icon:H.Wp,path:"/bonuses",hideForIb:!0},{name:"funds",translationKey:"funds",icon:e3.vn3,path:"/funds",subItems:[{name:"funds_deposits",translationKey:"funds_deposits",path:"/deposits",hideForIb:!0},{name:"funds_withdrawals",translationKey:"funds_withdrawals",path:"/funds/withdrawals"},{name:"funds_internal_transfer",translationKey:"funds_internal_transfer",path:"/funds/internal-transfer"},...(null==S||null==(l=S.result)?void 0:l.ibFundTransferEnabled)?[{name:"fund_transfer",translationKey:"fund_transfer",path:"/funds/fund-transfer"}
1]:[],...(null==S||null==(i=S.result)?void 0:i.ibFundWithdrawalEnabled)?[{name:"fund_withdrawal",translationKey:"fund_withdrawal",path:"/funds/fund-withdrawal"}]:[],{name:"funds_bank_crypto",translationKey:"funds_bank_crypto",path:"/funds/bank-crypto"}]},{name:"accupay",translationKey:"accupay",icon:e4.Mz$,path:"/accu-pay"},{name:"transactions",translationKey:"transactions",icon:e6.b1S,path:"/transactions"},{name:"statement",translationKey:"statement",icon:e7.yzT,path:"/statement",showOnlyForIb:!0},{name:"platforms",translationKey:"platforms",icon:e8.SzP,path:"/platforms",hideForIb:!0},{name:"partner-ship",translationKey:"partner-ship",icon:e7.bQY,path:"/partner-ship",hideForIb:!0},{name:"web-trader",translationKey:"web-trader",icon:et.m6v,path:"/web-trader",hideForIb:!0}];return(0,r.jsxs)(h.Bx,{collapsible:"icon",className:"fixed top-0 h-full z-50 shadow-sm",onMouseEnter:()=>"collapsed"===g&&y(!0),onMouseLeave:()=>"expanded"===g&&y(!1),children:[(0,r.jsx)(h.Gh,{className:"p-0 md:py-[30px]",children:(0,r.jsx)(te,{})}),(0,r.jsx)(h.Yv,{className:"px-2 py-2",children:(0,r.jsx)(h.wZ,{children:F.filter(e=>u?!e.hideForIb:!e.showOnlyForIb).map(e=>{let{name:t,icon:a,path:s,subItems:n}=e,l=u?"/ib".concat(s):s,i=n?n.some(e=>c.includes(u?"/ib".concat(e.path):e.path)):"/"===s?c===l||c==="".concat(l,"/")||u&&("/ib"===c||"/ib/"===c):c.includes(l);return(0,r.jsx)(h.FX,{children:n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.Uj,{asChild:!0,onClick:()=>x(e=>({...e,[t]:!e[t]})),className:I,children:(0,r.jsxs)("div",{className:"flex items-center w-full cursor-pointer",children:[(0,r.jsx)(a,{className:"!h-5.5 !w-5.5 ".concat(i?"text-primary":"text-dark-gray")}),(0,r.jsx)("span",{className:i?"text-primary":"",children:d("sidebar.".concat(t),t.charAt(0).toUpperCase()+t.slice(1))})]})}),m[t]&&(0,r.jsx)(h.q9,{className:"ms-15 me-0",children:n.filter(e=>!(u&&e.hideForIb)).map(e=>(0,r.jsx)(h.Fg,{children:(0,r.jsx)(h.Cp,{asChild:!0,isActive:c.includes(u?"/ib".concat(e.path):e.path),className:"py-2 px-2 text-sm hover:text-primary data-[active=true]:text-primary data-[active=true]:font-medium",children:(0,r.jsx)(j(),{className:"text-dark-gray",href:u?"/ib".concat(e.path):e.path,onClick:D,children:d("sidebar.".concat(e.name),e.name.charAt(0).toUpperCase()+e.name.slice(1))})})},e.name))})]}):(0,r.jsx)(h.Uj,{asChild:!0,isActive:i,className:I,children:(0,r.jsxs)(j(),{href:l,className:"flex items-center w-full",onClick:D,children:[(0,r.jsx)(a,{className:"!h-5 !w-5 ".concat(i?"text-primary":"text-dark-gray")}),(0,r.jsx)("span",{className:"mr-3 ".concat(i?"text-primary font-medium":""),children:d("sidebar.".concat(t),t.charAt(0).toUpperCase()+t.slice(1))})]})})},t)})})}),(0,r.jsx)(h.CG,{className:"px-2 mt-auto",children:(0,r.jsx)(h.wZ,{children:(0,r.jsx)(h.FX,{children:(0,r.jsxs)(h.Uj,{onClick:()=>{_(),N.push("/login")},className:"".concat(I," mr-3 text-dark-gray cursor-pointer"),children:[(0,r.jsx)(U.hSA,{className:"!h-5 !w-5 text-dark-gray"}),(0,r.jsx)("span",{className:"mr-3",children:d("sidebar.logout","Logout")})]})})})})]})}var ta=a(94715),tr=a(87154);let ts=()=>{var e;let{getCurrentStep:t}=(0,C.s)(),a=eJ(),s=360/a.length-6,n=Math.min(null!=(e=t())?e:1,a.length),l=Math.round(n/a.length*100);return(0,r.jsx)("div",{className:"progress-ring",children:(0,r.jsxs)("svg",{width:"70",height:"70",viewBox:"0 0 120 120",children:[a.map((e,t)=>{let a=t*(s+6)-90,l=a+s,i=60+43*Math.cos(a*Math.PI/180),o=60+43*Math.sin(a*Math.PI/180),d=60+43*Math.cos(l*Math.PI/180),c=60+43*Math.sin(l*Math.PI/180);return(0,r.jsx)("path",{d:"M ".concat(i," ").concat(o," A ").concat(43," ").concat(43," 0 ").concat(l-a<=180?"0":"1"," 1 ").concat(d," ").concat(c),stroke:t<n?"#198754":"#e3e3e3",strokeWidth:14,fill:"transparent"},e.key)}),(0,r.jsxs)("text",{x:"60",y:"60",textAnchor:"middle",dominantBaseline:"middle",fontSize:"20",fontWeight:"bold",fill:"#333333",children:[l,"%"]})]})})},tn=e=>{var t;let{setOpenModal:a}=e,{profile:n,getCurrentStep:l}=(0,C.s)(),i=eJ(),o=l(),{t:d}=(0,f.Bd)(),c=(0,s.useRouter)(),m=null==n||null==(t=n.customerDetails)?void 0:t.journeyStatus,p=e=>{var t;let a=null==m?void 0:m[e];return null!=(t=null==a?void 0:a.status)&&t}
1,x=null==m?void 0:m.documentsLevelOne,h=x&&!0===x.status,v=null==m?void 0:m.documentsLevelTwo,g=v&&!0===v.status,y=null==m?void 0:m.createAccount,b=!!y&&!0===y.status,w=null==m?void 0:m.deposit,_=!!w&&!0===w.status,N=(null==n?void 0:n.levelOneKYCStatus)==="APPROVED"&&(null==n?void 0:n.levelTwoKYCStatus)==="APPROVED",k=(null==n?void 0:n.levelOneKYCStatus)==="PENDING"&&(null==n?void 0:n.levelTwoKYCStatus)==="PENDING",S=(null==n?void 0:n.levelOneKYCStatus)==="REJECTED"||(null==n?void 0:n.levelTwoKYCStatus)==="REJECTED",E=["completeProfile__personal","completeProfile__emailVerification","completeProfile__work","completeProfile__facta","completeProfile__declarations","documentsLevelOne","documentsLevelTwo"].every(e=>p(e)),A=[...E?["createAccount"]:[],"completeProfile__personal","completeProfile__emailVerification","completeProfile__work","completeProfile__facta","completeProfile__declarations","documentsLevelOne","documentsLevelTwo"].every(e=>p(e));if(_&&b&&o&&o>i.length)return null;let D=["completeProfile__personal","completeProfile__emailVerification","completeProfile__work","completeProfile__facta","completeProfile__declarations","documentsLevelOne","documentsLevelTwo","createAccount","deposit"].every(e=>{let t=null==m?void 0:m[e];return(null==t?void 0:t.status)===!0});if(D)return null;let I=h&&g&&(null==n?void 0:n.levelTwoKYCStatus)==="PENDING";return(0,r.jsxs)(M.Zp,{className:"md:flex justify-between items-center gap-2 mb-5 p-3 block",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(ts,{}),(0,r.jsxs)("div",{className:"flex flex-col gap-0",children:[(0,r.jsxs)("div",{className:"flex items-center text-lg font-bold gap-2",children:[d("new_journey.journey_dashboard.welcome")," ",null==n?void 0:n.firstName,g&&!S&&(0,r.jsx)(H.A7C,{className:"text-success"})]}),(0,r.jsx)("div",{className:"text-sm text-muted",children:(()=>{var e,t;return S?(0,r.jsx)("div",{className:"text-dark",children:(0,r.jsxs)("div",{className:"text-xs",children:[d("new_journey.journey_dashboard.current_step")," :",d("new_journey.proof_of_identity_modal.rejection_message")]})}):E&&N&&!b?(0,r.jsxs)("div",{className:"text-dark",children:[(0,r.jsx)("div",{className:"text-muted",children:(0,r.jsx)("div",{className:"text-xs",children:d("new_journey.journey_dashboard.poa_approval_complete_text")})}),h&&g&&!k&&(0,r.jsxs)("div",{className:"text-xs",children:[d("new_journey.journey_dashboard.create_account_message")," ",(0,r.jsx)(j(),{href:"/accounts",className:"text-primary underline",children:d("new_journey.journey_dashboard.create_account_link")})]})]}):E&&h&&N?(0,r.jsxs)("div",{className:"text-dark",children:[(0,r.jsx)("div",{className:"text-muted"}),(0,r.jsx)("div",{className:"text-xs",children:(0,r.jsx)(j(),{href:"/deposits",className:"text-primary underline",children:d("new_journey.journey_dashboard.make_deposit_link")})})]}):h&&g&&k?(0,r.jsx)("div",{className:"text-dark",children:(0,r.jsx)("div",{className:"text-xs",children:d("new_journey.journey_dashboard.complete_text")})}):h&&(null==n?void 0:n.levelOneKYCStatus)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-dark",children:(0,r.jsx)("div",{className:"text-xs",children:d("new_journey.journey_dashboard.complete_text")})}),(0,r.jsx)("div",{className:"text-dark",children:o&&o<=i.length&&"".concat(d("new_journey.journey_dashboard.current_step")," : ").concat(null==(e=i[o-1])?void 0:e.title)})]}):A&&!_?(0,r.jsxs)("div",{className:"text-dark",children:[(0,r.jsx)("div",{className:"text-muted",children:(0,r.jsx)("div",{className:"text-xs",children:d("new_journey.journey_dashboard.complete_text")})}),(0,r.jsxs)("div",{className:"text-xs",children:[d("new_journey.journey_dashboard.make_deposit_message")," ",(0,r.jsx)(j(),{href:"/deposits",className:"text-primary underline",children:d("new_journey.journey_dashboard.make_deposit_link")})]})]}):D?(0,r.jsx)("div",{className:"text-dark",children:(0,r.jsx)("div",{className:"text-xs",children:d("new_journey.journey_dashboard.all_steps_completed")})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"text-muted pb-0.5",children:(0,r.jsx)("div",{className:"text-xs",children:d("new_journey.journey_dashboard.complete_the_steps")})}),(0,r.jsx)("div",{className:"text-dark",children:o&&o<=i.length&&"".concat(d("new_journey.journey_dashboard.current_step")," : ").concat(null==(t=i[o-1])?void 0:t.t
1itle)})]})})()})]})]}),!I&&(0,r.jsx)(u.$,{onClick:()=>{if(E&&N&&b&&!_)return void c.push("/deposits");if(E&&N&&!b)return void c.push("/accounts");if(!o||o>i.length)return;let e=i[o-1];(null==e?void 0:e.externalLink)?c.push(e.externalLink):a(!0)},className:"mt-3 w-full md:w-auto",children:(()=>{if(E&&N&&b&&!_)return d("new_journey.journey_dashboard.make_deposit_link");if(E&&N&&!b)return d("login.create_account");if(o&&o<=i.length){var e;let t=null==(e=i[o-1])?void 0:e.key;if("createAccount"===t)return d("login.create_account");if("deposit"===t)return d("new_journey.journey_dashboard.make_deposit_link")}return d("new_journey.profile_journey.complete_profile_button")})()})]})};var tl=a(62343),ti=a.n(tl),to=a(53090);function td(e){let{open:t,onOpenChange:a}=e,{t:s}=(0,f.Bd)(),[n,l]=(0,p.useState)(""),[i,o]=(0,p.useState)(""),[c,m]=(0,p.useState)(""),[x,h]=(0,p.useState)(!1),[v,g]=(0,p.useState)(1),y=(0,p.useCallback)(async()=>{try{h(!0);let e=await (0,to.tm)();l(e.result.qrCode),o(e.result.secret)}catch(e){(0,T.oR)({description:s("twofa.errors.generateFailed"),variant:"destructive"}),console.error("2FA generation error:",e)}finally{h(!1)}},[s]);(0,p.useEffect)(()=>{t&&y()},[t,y]);let j=async()=>{if(6!==c.length)return void(0,T.oR)({description:s("twofa.errors.invalidCode"),variant:"destructive"});try{h(!0);let e=await (0,to.Hg)(c,i);if("Incorrect Two FA Code"===e.result.message)return void(0,T.oR)({description:s("twofa.errors.incorrectCode"),variant:"destructive"});(0,T.oR)({description:s("twofa.success.setupComplete"),variant:"success"}),a(!1)}catch(e){(0,T.oR)({description:s("twofa.errors.verificationFailed"),variant:"destructive"}),console.error("2FA verification error:",e)}finally{h(!1)}};return(0,r.jsx)(A.lG,{open:t,onOpenChange:()=>{m(""),g(1),a(!1)},children:(0,r.jsxs)(A.Cf,{className:"",children:[(0,r.jsx)(A.c7,{children:(0,r.jsx)(A.L3,{className:"!p-0"})}),(0,r.jsx)("h3",{className:"text-2xl mb-4 font-medium",children:s("twofa.title")}),x?(0,r.jsx)("div",{className:"flex justify-center py-8",children:(0,r.jsx)(w.y,{className:"h-8 w-8"})}):(0,r.jsxs)(r.Fragment,{children:[1===v&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold mb-3",children:s("twofa.step1.whyTitle")}),(0,r.jsxs)("ul",{className:"space-y-2 list-disc list-inside text-sm text-muted-foreground",children:[(0,r.jsx)("li",{children:s("twofa.step1.benefit1")}),(0,r.jsx)("li",{children:s("twofa.step1.benefit2")}),(0,r.jsx)("li",{children:s("twofa.step1.benefit3")})]})]}),(0,r.jsxs)("div",{className:"bg-muted p-6 rounded-lg bg-gray-100",children:[(0,r.jsx)("h4",{className:"font-semibold mb-3",children:s("twofa.step1.instructionsTitle")}),(0,r.jsxs)("ol",{className:"space-y-2 list-decimal list-inside text-sm",children:[(0,r.jsx)("li",{children:s("twofa.step1.instruction1")}),(0,r.jsx)("li",{children:s("twofa.step1.instruction2")}),(0,r.jsx)("li",{children:s("twofa.step1.instruction3")})]})]}),(0,r.jsx)("div",{className:"flex justify-center py-4",children:n&&(0,r.jsx)(d.default,{src:n,alt:s("twofa.step1.qrCodeAlt"),className:"border p-2 rounded border-gray-300",width:200,height:200})}),(0,r.jsx)(u.$,{className:"w-full",onClick:()=>g(2),children:s("twofa.step1.continueButton")})]}),2===v&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold mb-3",children:s("twofa.step2.verifyTitle")}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:s("twofa.step2.verifyDescription")})]}),(0,r.jsx)("div",{className:"flex justify-center py-4",children:(0,r.jsx)(ti(),{value:c,onChange:m,length:6,validChars:"0-9",placeholder:"",classNames:{container:"verification-input",character:"verification-character",characterInactive:"verification-character--inactive",characterSelected:"verification-character--selected"}})}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsx)(u.$,{variant:"outline",onClick:()=>g(1),children:s("twofa.step2.backButton")}
1),(0,r.jsx)(u.$,{onClick:j,disabled:6!==c.length||x,children:s("twofa.step2.completeButton")})]})]})]})]})})}var tc=a(11307),tu=a(72514);let tm="promo_top_banner_dismissed";function tp(){let e=(0,s.useRouter)(),{t,i18n:a}=(0,f.Bd)(),[n,l]=(0,p.useState)(!1),{data:o}=(0,eZ.I)({queryKey:["promotion-top-banner",a.language],queryFn:()=>(0,tc._e)(a.language),staleTime:3e5}),{data:d}=(0,eZ.I)({queryKey:["cashback-enrollment"],queryFn:tc.Zl,staleTime:6e4});return((0,p.useEffect)(()=>{(null==o?void 0:o.id)&&sessionStorage.getItem("".concat(tm,"_").concat(o.id))?l(!0):l(!1)},[null==o?void 0:o.id]),!n&&o&&("CASHBACK_ENROLL"!==o.ctaAction||!d||d.enrolled||d.eligible))?(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsxs)(M.Zp,{className:"mb-0 px-3 py-2 sm:p-3",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 sm:gap-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,r.jsx)("span",{className:"font-bold text-xs sm:text-sm md:text-base truncate",children:o.title}),o.subtitle&&(0,r.jsx)("span",{className:"hidden sm:inline text-sm text-muted-foreground truncate",children:o.subtitle})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 sm:gap-2 shrink-0",children:["CASHBACK_ENROLL"===o.ctaAction?(0,r.jsx)(tu.v,{label:o.ctaText,variant:"outline",className:"font-bold gap-0 px-2 py-0.5 sm:p-1 sm:mx-2 h-auto text-xs sm:text-sm bg-transparent whitespace-nowrap"}):(0,r.jsx)(u.$,{variant:"outline",className:"font-bold gap-0 px-2 py-0.5 sm:p-1 sm:mx-2 h-auto text-xs sm:text-sm bg-transparent whitespace-nowrap",onClick:()=>e.push("/deposits"),children:o.ctaText||t("promotions.deposit_now")}),(0,r.jsx)("button",{onClick:()=>{sessionStorage.setItem("".concat(tm,"_").concat(o.id),"1"),l(!0)},className:"text-muted-foreground hover:text-foreground p-1",children:(0,r.jsx)(i.$8F,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]}),o.subtitle&&(0,r.jsx)("p",{className:"sm:hidden text-xs text-muted-foreground mt-1 truncate",children:o.subtitle})]})}):null}function tx(){let{i18n:e}=(0,f.Bd)(),{profile:t}=(0,C.s)(),{branding:a}=(0,J.Q)(null==t?void 0:t.country),s=(0,eP.V6)(a.legalDocs),n=["ar","fa"].includes(e.language);return(0,r.jsxs)("footer",{dir:n?"rtl":"ltr",className:"mt-8 border-t border-gray-200 pt-4 pb-2 text-xs text-gray-500 space-y-2 text-start",children:[a.regulatoryStatement&&(0,r.jsx)("p",{children:a.regulatoryStatement}),a.riskWarning&&(0,r.jsx)("p",{children:a.riskWarning}),s.length>0&&(0,r.jsx)("p",{className:"flex flex-wrap gap-x-3 gap-y-1",children:s.map(e=>(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-primary",children:e.label},e.key))})]})}let th=(0,ta.A)(function(e){var t;let{children:a,data:n}=e,[l,i]=(0,p.useState)(!1),[o,d]=(0,p.useState)(!1),[c,u]=(0,p.useState)(!1),[m,x]=(0,p.useState)(!1),[h,f]=(0,p.useState)(!0),v=e=>i(e),g=(0,s.usePathname)(),y=null==n||null==(t=n.customerDetails)?void 0:t.journeyStatus,j=!!y&&Object.values(y).every(e=>!0===e.status),b=(null==n?void 0:n.currentStep)?n.currentStep-1:-1,w=eJ(),_=b>=0&&b<w.length?w[b]:null,N=(null==_?void 0:_.key)==="createAccount"||(null==_?void 0:_.key)==="deposit",{hasPending:k}=eX();return((0,p.useEffect)(()=>{if(!n||m)return;let e=setTimeout(()=>{var e,t,a;let r="true"===localStorage.getItem("firstLogin")||"true"===sessionStorage.getItem("firstLogin"),s=(null==n||null==(e=n.customerDetails)?void 0:e.twoFactorEnabled)||(null==n||null==(t=n.customerDetails)?void 0:t.twoFactorAuth)||(null==n||null==(a=n.customerDetails)?void 0:a.has2FA)||!1;r&&!s&&j?(u(!0),d(!0),localStorage.removeItem("firstLogin"),sessionStorage.removeItem("firstLogin")):r&&(localStorage.removeItem("firstLogin"),sessionStorage.removeItem("firstLogin")),x(!0),f(!1)},100);return()=>clearTimeout(e)},[n,m,j,N]),h)?(0,r.jsxs)("div",{className:"flex min-h-screen max-h-screen bg-sidebar-accent overflow-hidden",children:[(0,r.jsx)(tt,{}),(0,r.jsxs)("div",{className:"flex flex-col flex-1 transition-all duration-300 bg-body-bg overflow-hidden",children:[(0,r.jsx)(K,{}),(0,r.jsxs)("main",{className:"flex-1 px-4 py-2 md:px-10 overflow-y-auto overflow-x-hidden md:pb-20",children:[(0,r.jsx)(tp,{}),(0,r.jsx)(W,{}),a,(0,r.jsx)(tx,{})]})]})]}):(0,r.jsxs)("div",{className:"flex min-h-screen max-h-screen bg-sidebar-accent overflow-hidden",children:[(0,r.jsx)(tt,{}),(0,r.jsx)(Y,{}),(0,r.jsx)(td,{open:o,onOpenChange:e=>{d(e),e||!c||j||N||setTimeout(()=>{i(!0)},300)}}
1),(!N&&!j||k)&&(0,r.jsx)(e5,{openModal:l,setOpenModal:v,isFirstLogin:c}),(0,r.jsxs)("div",{className:"flex flex-col flex-1 transition-all duration-300 bg-body-bg overflow-hidden",children:[(0,r.jsx)(K,{}),(0,r.jsxs)("main",{className:"flex-1 px-4 py-2 md:px-10 overflow-y-auto overflow-x-hidden md:pb-20",children:[(0,r.jsx)(tp,{}),(0,r.jsx)(W,{}),"/"===g&&!j&&(0,r.jsx)(tn,{setOpenModal:v}),a,(0,r.jsx)(tx,{})]})]})]})});function tf(e){let{children:t}=e;return(0,r.jsx)(th,{queryKey:["user-profile"],queryFn:O.l2,loadingFallback:tr.O,children:t})}function tv(e){let{children:t}=e,a=(0,s.usePathname)();return(null==a?void 0:a.startsWith("/login"))||(null==a?void 0:a.startsWith("/forgot-password"))||(null==a?void 0:a.startsWith("/reset-password"))||(null==a?void 0:a.startsWith("/redirect"))?(0,r.jsx)(r.Fragment,{children:t}):(0,r.jsx)(tf,{children:t})}},43282:(e,t,a)=>{"use strict";a.d(t,{B4:()=>n,a1:()=>o,s1:()=>l,u3:()=>s,yE:()=>i});var r=a(94915);async function s(e){try{let{data:t}=await r.A.get("/ibs/clients",{params:e});return t}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Unable to fetch clients")}}async function n(e,t){try{let{data:a}=await r.A.get("/ibs/clients/".concat(e,"/accounts"),{params:t});return a}catch(e){var a,s;throw Error((null==e||null==(s=e.response)||null==(a=s.data)?void 0:a.message)||"Unable to fetch client accounts")}}async function l(e,t,a){try{let{data:s}=await r.A.get("/ibs/clients/".concat(e,"/accounts/").concat(t,"/open-positions"),{params:a});return s}catch(e){var s,n;throw Error((null==e||null==(n=e.response)||null==(s=n.data)?void 0:s.message)||"Unable to fetch open positions")}}async function i(e,t,a){try{let{data:s}=await r.A.get("/ibs/clients/".concat(e,"/accounts/").concat(t,"/close-positions"),{params:a});return s}catch(e){var s,n;throw Error((null==e||null==(n=e.response)||null==(s=n.data)?void 0:s.message)||"Unable to fetch close positions")}}async function o(e){try{let{data:t}=await r.A.patch("/ibs/questionnaire",e);return t}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Failed to submit questionnaire")}}},45191:(e,t,a)=>{"use strict";a.d(t,{$M:()=>n,Jj:()=>l,bb:()=>s,t_:()=>i});var r=a(94915);async function s(e){let{page:t=1,limit:a=10}=e;try{let{data:e}=await r.A.get("/notifications?page=".concat(t,"&limit=").concat(a));return{rows:e.result.rows,count:e.result.count}}catch(e){var s,n;throw Error((null==e||null==(n=e.response)||null==(s=n.data)?void 0:s.message)||"Unable to fetch notifications")}}async function n(){try{let{data:e}=await r.A.get("/notifications/unread-count");return e.result}catch(a){var e,t;throw Error((null==a||null==(t=a.response)||null==(e=t.data)?void 0:e.message)||"Unable to fetch unread count")}}async function l(e){try{let{data:t}=await r.A.patch("/notifications/".concat(e,"/read"));return t}catch(e){var t,a;throw Error((null==e||null==(a=e.response)||null==(t=a.data)?void 0:t.message)||"Unable to mark notification as read")}}async function i(){try{let{data:e}=await r.A.patch("/notifications/read-all");return e}catch(a){var e,t;throw Error((null==a||null==(t=a.response)||null==(e=t.data)?void 0:e.message)||"Unable to mark all notifications as read")}}},48141:(e,t,a)=>{"use strict";a.d(t,{r:()=>d});var r=a(95155),s=a(52619),n=a.n(s),l=a(72368),i=a(58352),o=a(31185);let d=e=>{let{notification:t}=e,{handleNotificationClick:a}=(0,l.E)();return(0,r.jsx)(n(),{href:t.link,className:(0,o.cn)("block px-4 py-3 hover:bg-gray-50 transition-colors border-b border-gray-200",!t.isRead&&"bg-blue-50"),onClick:e=>{e.preventDefault(),a(t)},children:(0,r.jsxs)("div",{className:"flex justify-between items-start",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-medium text-gray-900",children:t.title}),(0,r.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:t.message}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-2",children:(0,i.m)(new Date(t.createdAt),{addSuffix:!0})})]}),!t.isRead&&(0,r.jsx)("span",{className:"h-2 w-2 rounded-full bg-blue-500"})]})})}},49447:(e,t,a)=>{"use strict";a.d(t,{Bx:()=>_,Yv:()=>S,CG:()=>C,Gh:()=>k,wZ:()=>E,Uj:()=>I,FX:()=>A,q9:()=>F,Cp:()=>q,Fg:()=>P,SidebarProvider:()=>w,x2:()=>N,cL:()=>b});
1var r=a(95155),s=a(12115),n=a(32467),l=a(83101),i=a(53380),o=a(31185),d=a(21570);a(47234);var c=a(89511),u=a(74233);function m(e){let{...t}=e;return(0,r.jsx)(c.bL,{"data-slot":"sheet",...t})}function p(e){let{...t}=e;return(0,r.jsx)(c.ZL,{"data-slot":"sheet-portal",...t})}function x(e){let{...t}=e;return(0,r.jsx)(c.hJ,{"data-slot":"sheet-overlay",...t})}function h(e){let{className:t,children:a,side:s="right",...n}=e;return(0,r.jsxs)(p,{children:[(0,r.jsx)(x,{}),(0,r.jsxs)(c.UC,{"data-slot":"sheet-content",className:(0,o.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===s&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===s&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===s&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===s&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...n,children:[a,(0,r.jsxs)(c.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,r.jsx)(u.WQq,{className:"size-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function f(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sheet-header",className:(0,o.cn)("flex flex-col gap-1.5 p-4",t),...a})}function v(e){let{className:t,...a}=e;return(0,r.jsx)(c.hE,{"data-slot":"sheet-title",className:(0,o.cn)("text-foreground font-semibold",t),...a})}function g(e){let{className:t,...a}=e;return(0,r.jsx)(c.VY,{"data-slot":"sheet-description",className:(0,o.cn)("text-muted-foreground text-sm",t),...a})}a(151);var y=a(98171);let j=s.createContext(null);function b(){let e=s.useContext(j);if(!e)throw Error("useSidebar must be used within a SidebarProvider.");return e}function w(e){let{defaultOpen:t=!0,open:a,onOpenChange:n,style:l,children:i,...o}=e,d=function(){let[e,t]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=window.matchMedia("(max-width: ".concat(767,"px)")),a=()=>{t(window.innerWidth<768)};return e.addEventListener("change",a),t(window.innerWidth<768),()=>e.removeEventListener("change",a)},[]),e}(),[c,u]=s.useState(!1),[m,p]=s.useState(t),x=null!=a?a:m,h=s.useCallback(e=>{let t="function"==typeof e?e(x):e;n?n(t):p(t),document.cookie="".concat("sidebar_state","=").concat(t,"; path=/; max-age=").concat(604800)},[n,x]),f=s.useCallback(()=>d?u(e=>!e):h(e=>!e),[d,h,u]);s.useEffect(()=>{let e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);let v=x?"expanded":"collapsed",g=s.useMemo(()=>({state:v,open:x,setOpen:h,isMobile:d,openMobile:c,setOpenMobile:u,toggleSidebar:f}),[v,x,h,d,c,u,f]);return(0,r.jsx)(j.Provider,{value:g,children:(0,r.jsx)(y.Bc,{delayDuration:0,children:(0,r.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"250px","--sidebar-width-icon":"67px",...l},...o,children:i})})})}function _(e){let{side:t="left",variant:a="sidebar",collapsible:s="offcanvas",className:n,children:l,...i}=e,{isMobile:d,state:c,openMobile:u,setOpenMobile:p}=b();return"none"===s?(0,r.jsx)("div",{"data-slot":"sidebar",className:(0,o.cn)("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",n),...i,children:l}):d?(0,r.jsx)(m,{open:u,onOpenChange:p,...i,children:(0,r.jsxs)(h,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:t,children:[(0,r.jsxs)(f,{className:"sr-only",children:[(0,r.jsx)(v,{children:"Sidebar"}),(0,r.jsx)(g,{children:"Displays the mobile sidebar."})]}),(0,r.jsx)("div",{className:"flex h-full w-full flex-col bg-white",children:l})]})}):(0,r.jsxs)("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":c,"data-collapsible":"collapsed"===c?s:"","data-variant":a,"data-side":t,"data-slot":"sidebar",children:[(0,r.jsx)("div",{"data-slot":"sidebar-gap",className:(0,o.cn)("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===a||"inset"===a?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),(0,r.jsx)("div",{"data-slot":"sidebar-container",className:(0,o.cn)("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===t?" group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===a||"inset"===a?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",n),...i,children:(0,r.jsx)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:l})})]})}function N(e){let{className:t,onClick:a,...s}=e,{toggleSidebar:n}=b();return(0,r.jsxs)(d.$,{"data-sidebar":"trigger","data-slot":"sidebar-tr
1igger",variant:"ghost",size:"icon",className:(0,o.cn)("size-7",t),onClick:e=>{null==a||a(e),n()},...s,children:[(0,r.jsx)(i.E3,{className:"!h-5 !w-5"}),(0,r.jsx)("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function k(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:(0,o.cn)("flex flex-col gap-2 p-2",t),...a})}function C(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:(0,o.cn)("flex flex-col gap-2 p-2",t),...a})}function S(e){let{className:t,...a}=e;return(0,r.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:(0,o.cn)("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function E(e){let{className:t,...a}=e;return(0,r.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:(0,o.cn)("flex w-full min-w-0 flex-col gap-1",t),...a})}function A(e){let{className:t,...a}=e;return(0,r.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:(0,o.cn)("group/menu-item relative sidebar-menu-item py-0",t),...a})}let D=(0,l.F)("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-6! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-6 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 w-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function I(e){let{asChild:t=!1,isActive:a=!1,variant:s="default",size:l="default",tooltip:i,className:d,...c}=e,u=t?n.DX:"button",{isMobile:m,state:p}=b(),x=(0,r.jsx)(u,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":l,"data-active":a,className:(0,o.cn)(D({variant:s,size:l}),d),...c});return i?("string"==typeof i&&(i={children:i}),(0,r.jsxs)(y.m_,{children:[(0,r.jsx)(y.k$,{asChild:!0,children:x}),(0,r.jsx)(y.ZI,{side:"right",align:"center",hidden:"collapsed"!==p||m,...i})]})):x}function F(e){let{className:t,...a}=e;return(0,r.jsx)("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:(0,o.cn)("border-b-1 border-gray-200 mx-5 flex min-w-0 translate-x-px flex-col gap-1 list-disc px-2.5 py-2","group-data-[collapsible=icon]:hidden",t),...a})}function P(e){let{className:t,...a}=e;return(0,r.jsx)("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:(0,o.cn)("group/menu-sub-item relative",t),...a})}function q(e){let{asChild:t=!1,size:a="md",isActive:s=!1,className:l,...i}=e,d=t?n.DX:"a";return(0,r.jsx)(d,{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":s,className:(0,o.cn)("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-6 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===a&&"text-xs","md"===a&&"text-sm","group-data-[collapsible=icon]:hidden",l),...i})}},52532:(e,t,a)=>{"use strict";a.d(t,{SocketProvider:()=>g,F:()=>y});var r=a(95155),s=a(12115),n=a(9829),l=a(53090),i=a(74879);let o=null,d=null,c=!1,u=0,m=()=>{try{let e=localStorage.getItem("clientId");return e||(e=(0,i.A)(),localStorage.setItem("clientId",e)),e}catch(e){return console.error("Error accessing localStorage:",e),(0,i.A)()}},p=()=>{d&&(clearInterval(d),d=null)},x=()=>{p(),o&&(o.removeAllListeners(),o.close()),o=null,c=!1},h=()=>{o&&(o.disconnect(),x())};var f=a(70640);let v=(0,s.createContext)(null),g=e=>{let{children:t}
1=e,[a,i]=(0,s.useState)(null),[g,y]=(0,s.useState)(!1),{user:j,token:b}=(0,f.n)(),w=(0,s.useCallback)(()=>{j&&b?setTimeout(()=>{let e=(()=>{if(o&&o.connected)return o;if(c)return null;let e=(0,l.Yt)();if(!e)return null;c=!0;let t=m();try{let a="https://cp.api.accuindex.com";if(!a)return console.error("[SOCKET] NEXT_PUBLIC_SOCKET_URL is not defined"),c=!1,null;return(o=(0,n.Ay)(a,{auth:{token:e,type:"client",clientId:t},autoConnect:!1,transports:["websocket"],reconnection:!0,reconnectionAttempts:5,reconnectionDelay:8e3,reconnectionDelayMax:5e4,randomizationFactor:.5,timeout:2e4,upgrade:!0,forceNew:!0})).on("connect",()=>{c=!1,u=0,d&&clearInterval(d),d=setInterval(()=>{o&&o.connected&&o.emit("heartbeat",{type:"client",clientId:m()})},3e4)}),o.on("connect_error",e=>{console.error("Socket connection error:",e.message),c=!1,++u>=5&&(console.error("Max reconnection attempts reached"),x())}),o.on("disconnect",e=>{p(),("io server disconnect"===e||"io client disconnect"===e)&&x()}),o.on("force_disconnect",()=>{x()}),o.on("error",e=>{console.error("Socket error:",e)}),o.io.on("reconnect",()=>{u=0}),o.io.on("reconnect_failed",()=>{x()}),o.connect(),o}catch(e){return console.error("Error initializing socket:",e),c=!1,x(),null}})();e&&(i(e),e.on("connect",()=>{y(!0)}),e.on("disconnect",t=>{y(!1),("transport close"===t||"ping timeout"===t)&&setTimeout(()=>{!e.connected&&b&&e.connect()},2e3)}),e.on("connect_error",()=>{y(!1)}))},100):(y(!1),h(),i(null))},[j,b]);(0,s.useEffect)(()=>{w();let e=new BroadcastChannel("socket_state");return e.onmessage=e=>{e.data.connected||w()},()=>{e.close(),h(),i(null),y(!1)}},[w]);let _=(0,s.useCallback)((e,t)=>{a&&a.connected?a.emit(e,t):console.warn("Cannot emit: socket not connected")},[a]);return(0,r.jsx)(v.Provider,{value:{socket:a,isConnected:g,emit:_},children:t})},y=()=>{let e=(0,s.useContext)(v);if(!e)throw Error("useSocket must be used within a SocketProvider");return e}},64600:(e,t,a)=>{"use strict";a.d(t,{s:()=>r});let r={en:"En",ar:"العربية",vi:"Tiếng Việt",ch:"中文",fa:"فارسی"}},67190:(e,t,a)=>{"use strict";a.d(t,{A:()=>l});var r=a(95155);a(12115);var s=a(62343),n=a.n(s);function l(e){let{callback:t,autoSubmit:a=!1,onComplete:s}=e,l=e=>{t(Number(e)),s&&s(e)};return(0,r.jsx)(n(),{length:6,validChars:"0-9",onComplete:l,placeholder:"",inputProps:{"aria-label":"Verification code input",onKeyDown:e=>{if("Enter"===e.key&&a){let t=e.currentTarget.value;6===t.length&&l(t)}}},classNames:{character:"rounded !border-neutral-200 !border-2",characterInactive:"rounded !border-neutral-200 !border-2 !bg-light",characterSelected:"rounded !border-neutral-200 !border-2 !bg-light"}})}},68380:()=>{},72368:(e,t,a)=>{"use strict";a.d(t,{E:()=>g,NotificationProvider:()=>v});var r=a(95155),s=a(12115),n=a(99776),l=a(22454),i=a(80549),o=a(45191),d=a(70640),c=a(58352),u=a(20063),m=a(50346),p=a(52532),x=a(99229),h=a(775);let f=(0,s.createContext)(null),v=e=>{let{children:t}=e,a=(0,n.jE)(),[v,g]=(0,s.useState)(!1),y=(0,u.useRouter)(),{socket:j,isConnected:b}=(0,p.F)(),{token:w}=(0,d.n)(),{t:_}=(0,x.Bd)(),{data:N,isLoading:k,isFetching:C,refetch:S,error:E}=(0,l.I)({queryKey:["notifications",{limit:10,page:1}],queryFn:()=>(0,o.bb)({limit:10,page:1}),staleTime:3e5,enabled:!!w}),{data:A=0,isLoading:D,error:I}=(0,l.I)({queryKey:["unreadCount"],queryFn:o.$M,staleTime:3e5,enabled:!!w}),F=((null==N?void 0:N.rows)||[]).map(e=>{var t,a;return{id:e.id,title:e.title,message:e.message,link:null!=(t=e.link)?t:"",isRead:null!=(a=e.isRead)&&a,createdAt:e.createdAt}}),P=(0,i.n)({mutationFn:o.Jj,onSuccess:()=>{a.invalidateQueries({queryKey:["notifications"]}),a.invalidateQueries({queryKey:["unreadCount"]})},onError:e=>{(0,m.oR)({title:"Error",description:(0,h.r)(e.message,_),variant:"destructive"})}}),q=(0,i.n)({mutationFn:o.t_,onSuccess:()=>{a.invalidateQueries({queryKey:["notifications"]}),a.invalidateQueries({queryKey:["unreadCount"]})},onError:e=>{(0,m.oR)({title:"Error",description:(0,h.r)(e.message,_),variant:"destructive"})}}),R=(0,s.useCallback)(e=>{e.isRead||P.mutate(e.id),e.link&&(e.link.includes("documents")||e.link.includes("tab=documents"))&&a.invalidateQueries({queryKey:["documents"]}),y.push(e.link),g(!1)},[P,y,a]),O=(0,s.useCallback)(()=>{q.mutate()},[q]),T=(0,s.useCallback)(e=>
1{(0,m.oR)({title:e.title,description:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-sm",children:e.message}),(0,r.jsx)("small",{className:"text-xs text-gray-500",children:(0,c.m)(new Date(e.createdAt),{addSuffix:!0})})]}),action:(0,r.jsx)("button",{onClick:()=>{e.link&&(e.link.includes("documents")||e.link.includes("tab=documents"))&&a.invalidateQueries({queryKey:["documents"]}),R(e)},className:"text-sm font-medium underline text-primary cursor-pointer",children:_("documents.upload.table.view")}),duration:5e3})},[R,a,_]);return(0,s.useEffect)(()=>{E&&(0,m.oR)({title:"Error",description:E.message,variant:"destructive"}),I&&(0,m.oR)({title:"Error",description:I.message,variant:"destructive"})},[E,I]),(0,s.useEffect)(()=>{v&&w&&S()},[v,S,w]),(0,s.useEffect)(()=>{if(!j||!w||!b)return;let e=e=>{if(e&&"NEW_NOTIFICATION"===e.eventType&&e.eventData){let t=e.eventData;a.setQueryData(["notifications",{limit:10,page:1}],e=>e?{rows:[t,...e.rows.slice(0,9)],count:e.count+1}:{rows:[t],count:1}),a.setQueryData(["unreadCount"],e=>(e||0)+1),T(t)}};return j.on("notification",e),()=>{j.off("notification",e)}},[j,b,w,a,T]),(0,s.useEffect)(()=>{w&&(S(),a.invalidateQueries({queryKey:["unreadCount"]}))},[w,a,S]),(0,r.jsx)(f.Provider,{value:{notifications:F,unreadCount:A,isPanelOpen:v,setIsPanelOpen:g,handleNotificationClick:R,handleMarkAllAsRead:O,isLoadingNotifications:k,isFetchingNotifications:C,isLoadingUnreadCount:D,isMarkingAsRead:P.isPending,isMarkingAllAsRead:q.isPending},children:t})},g=()=>{let e=(0,s.useContext)(f);if(!e)throw Error("useNotifications must be used within a NotificationProvider");return e}},72514:(e,t,a)=>{"use strict";a.d(t,{v:()=>c});var r=a(95155),s=a(99776),n=a(22454),l=a(80549),i=a(99229),o=a(21570),d=a(11307);function c(e){let{label:t,className:a,variant:c,size:u="sm"}=e,{t:m}=(0,i.Bd)(),p=(0,s.jE)(),{data:x}=(0,n.I)({queryKey:["cashback-enrollment"],queryFn:d.Zl,staleTime:6e4}),{mutate:h,isPending:f}=(0,l.n)({mutationFn:d.HB,onSuccess:()=>{p.invalidateQueries({queryKey:["cashback-enrollment"]})}});return x&&!x.cashbackEnabled?null:(null==x?void 0:x.enrolled)?(0,r.jsx)(o.$,{size:u,variant:c,className:a,disabled:!0,children:m("promotions.cashback_enrolled","Enrolled ✓")}):x&&!x.eligible?null:(0,r.jsx)(o.$,{size:u,variant:c,className:a,disabled:f,onClick:()=>h(),children:f?m("promotions.cashback_enrolling","Enrolling…"):t||m("promotions.cashback_enroll_now","Enroll now")})}},77667:(e,t,a)=>{"use strict";a.d(t,{Bd:()=>r.Bd,x6:()=>r.x6});var r=a(24274)},87154:(e,t,a)=>{"use strict";a.d(t,{M:()=>s,O:()=>n});var r=a(95155);function s(){return(0,r.jsx)("div",{className:"flex-1 flex flex-col min-h-lvh","data-testid":"main-content-skeleton",children:(0,r.jsx)("div",{className:"flex-1 p-4 sm:p-6 bg-gray-50 overflow-y-auto",children:(0,r.jsx)("div",{className:"bg-white rounded-lg p-4 sm:p-6 h-full",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"h-8 w-40 sm:w-48 bg-gray-200 rounded animate-pulse"}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"h-12 w-full bg-gray-200 rounded animate-pulse"}),(0,r.jsx)("div",{className:"h-12 w-3/4 bg-gray-200 rounded animate-pulse"}),(0,r.jsx)("div",{className:"h-12 w-5/6 bg-gray-200 rounded animate-pulse"})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("div",{className:"h-12 w-full bg-gray-200 rounded animate-pulse"}),(0,r.jsx)("div",{className:"h-12 w-3/4 bg-gray-200 rounded animate-pulse"}),(0,r.jsx)("div",{className:"h-12 w-5/6 bg-gray-200 rounded animate-pulse"})]})]})})})})}function n(){return(0,r.jsxs)("div",{className:"flex h-screen bg-gray-50 overflow-hidden",children:[(0,r.jsxs)("div",{className:"hidden md:flex flex-col w-64 bg-white border-r border-gray-200 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center mb-8",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-gray-200 rounded animate-pulse mr-3"}),(0,r.jsx)("div",{className:"h-6 w-24 bg-gray-200 rounded animate-pulse"})]}),(0,r.jsx)("div",{className:"space-y-1",children:[{width:"w-20"},{width:"w-16"},{width:"w-28",sub:!0},{width:"w-24"},{width:"w-24"},{width:"w-24"},{width:"w-32"},{width:"w-28"},{width:"w-20"}].map((e,t)=>e.sub?(0,r.jsxs)("div",{className:"ml-8 space-y-1",children:[(0,r.jsx)("div",{className:"h-3 w-28 bg-gray-200 rounded animate-pulse"}),(0,r.jsx)("div",{className:"h-3 w-24 bg-gray-200 rounded animate-pulse"})]},t):(0,r.jsxs)("div",{className:"flex items-center p-2",children:[(0,r.jsx)("div",{className:"w-5 h-5 bg-gray-200 rounded animate-pulse mr-3"}),(0,r.jsx)("div",{className:"h-4 ".concat(e.width," bg-gray-200 rounded animate-pulse")})]},t))})]}),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-lvh",children:[(0,r.jsx)("div",{className:"bg-white px-4 sm:px-6 py-4 flex items-center justify-between flex-wrap gap-4",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded animate-pulse"}),(0,r.jsx)("div",{className:"w-6 h-6 bg-gray-200 rounded animate-pulse"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-gray-200 rounded-full animate-pulse"}),(0,r.jsxs)("div",{className:"hidden md:block",children:[(0,r.jsx)("div",{className:"h-4 w-20 bg-gray-200 rounded animate-pulse mb-1"}),(0,r.jsx)("div",{className:"h-3 w-16 bg-gray-200 rounded animate-pulse"})]})]})]})}),(0,r.jsx)(s,{})]})]})}},89270:(e,t,a)=>{"use strict";a.d(t,{K:()=>d});var r=a(95155),s=a(12115),n=a(31185),l=a(33828),i=a(42878),o=a(28122);let d=e=>{var t;let{options:a,selected:d,onChange:c,placeholder:u="Select...",className:m,size:p="default"}=e,[x,h]=s.useState(!1),[f,v]=s.useState(""),[g,y]=s.useState(-1),j=s.useMemo(()=>a.filter(e=>e.label.toLowerCase().includes(f.toLowerCase())),[a,f]),b=e=>{c(d.includes(e)?d.filter(t=>t!==e):[...d,e]),h(!1),y(-1)};s.useEffect(()=>{let e=e=>{e.target.closest(".multi-select-container")||(h(!1),y(-1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let w="undefined"!=typeof document&&(null==(t=document)?void 0:t.dir)&&"rtl"===document.dir;return(0,r.jsxs)("div",{className:(0,n.cn)("relative multi-select-container w-full",m),children:[(0,r.jsxs)("div",{className:(0,n.cn)("flex w-full flex-wrap items-center justify-between gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm shadow-xs transition focus-within:ring-2 focus-within:ring-ring/50",w&&"flex-row-reverse","default"===p?"min-h-9":"min-h-8"),onClick:()=>h(!0),"data-size":p,children:[(0,r.jsxs)("div",{className:(0,n.cn)("flex flex-1 flex-wrap gap-1",w&&"flex-row-reverse"),children:[d.map(e=>{let t=a.find(t=>t.value===e);return(0,r.jsxs)("div",{className:"flex items-center gap-1 rounded bg-gray-100 px-2 py-0 text-sm text-gray-800",children:[(0,r.jsx)("span",{className:"line-clamp-1",children:(null==t?void 0:t.label)||e}),(0,r.jsx)(o.yGN,{className:"h-3 w-3 cursor-pointer hover:text-gray-600",onClick:t=>{t.stopPropagation(),c(d.filter(t=>t!==e))}})]},e)}),(0,r.jsx)("input",{type:"text",className:(0,n.cn)("flex-1 min-w-[50px] bg-transparent outline-none text-sm",w?"text-right":"text-left"),value:f,onChange:e=>v(e.target.value),onFocus:()=>h(!0),onKeyDown:e=>
1{if(!x&&["ArrowDown","ArrowUp"].includes(e.key))return void h(!0);"ArrowDown"===e.key&&(e.preventDefault(),y(e=>e<j.length-1?e+1:0)),"ArrowUp"===e.key&&(e.preventDefault(),y(e=>e>0?e-1:j.length-1)),"Enter"===e.key&&g>=0&&g<j.length&&(e.preventDefault(),b(j[g].value)),"Escape"===e.key&&(h(!1),y(-1)),"Backspace"===e.key&&!f&&d.length>0&&c(d.slice(0,-1))},placeholder:0!==d.length||f?"":u})]}),(0,r.jsxs)("div",{className:(0,n.cn)("flex items-center gap-1",w?"order-first":"order-last"),children:[d.length>0&&(0,r.jsx)(o.yGN,{className:"h-4 w-4 cursor-pointer text-muted-foreground hover:text-foreground",onClick:e=>{e.stopPropagation(),c([]),v("")}}),(0,r.jsx)(i._kA,{className:"h-4 w-4 opacity-50"})]})]}),x&&(0,r.jsx)("div",{role:"listbox","aria-multiselectable":"true",className:(0,n.cn)("absolute mt-1 max-h-60 w-full overflow-y-auto rounded-md border border-gray-300 bg-white shadow-md z-[9999]",w?"right-0 origin-top-right text-right":"left-0 origin-top-left text-left"),children:(0,r.jsx)("div",{className:"p-1",children:0===j.length?(0,r.jsx)("div",{className:"px-2 py-1.5 text-sm text-muted-foreground",children:"No options found"}):j.map((e,t)=>{let a=d.includes(e.value);return(0,r.jsxs)("div",{role:"option","aria-selected":a,className:(0,n.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 px-2 text-sm","hover:bg-gray-200 focus:bg-accent focus:text-accent-foreground",t===g&&"bg-gray-100"),onClick:()=>b(e.value),onMouseEnter:()=>y(t),children:[(0,r.jsx)("span",{className:(0,n.cn)("absolute flex h-4 w-4 items-center justify-center",w?"left-2":"right-2"),children:a&&(0,r.jsx)(l.CMH,{className:"h-3 w-3"})}),e.label]},e.value)})})})]})}},92387:(e,t,a)=>{"use strict";a.d(t,{k:()=>l});var r=a(95155);a(12115);var s=a(9484),n=a(31185);function l(e){let{className:t,value:a,...l}=e;return(0,r.jsx)(s.bL,{"data-slot":"progress",className:(0,n.cn)("bg-border relative h-2 w-full overflow-hidden rounded-full",t),...l,children:(0,r.jsx)(s.C1,{"data-slot":"progress-indicator",className:"bg-success h-full w-full flex-1 transition-all",style:{transform:"translateX(-".concat(100-(a||0),"%)")}})})}},94715:(e,t,a)=>{"use strict";a.d(t,{A:()=>o});var r=a(95155);a(12115);var s=a(87154),n=a(99776),l=a(22454),i=a(35023);function o(e,t){return function(a){var o;let{queryKey:d,queryFn:c,loadingFallback:u=s.M,errorFallback:m=i.A,...p}=a,x=(0,n.jE)(),{data:h,isLoading:f,error:v,refetch:g,isFetching:y}=(0,l.I)({queryKey:d,queryFn:c,placeholderData:e=>e,staleTime:null!=(o=null==t?void 0:t.staleTime)?o:3e5,refetchInterval:null==t?void 0:t.refetchInterval});return f&&!h?(0,r.jsx)(u,{}):v?(0,r.jsx)(m,{onRetry:async()=>{await x.invalidateQueries({queryKey:d,exact:!0}),g()}}):(0,r.jsx)(e,{...p,data:h,isLoading:y})}}},96410:(e,t,a)=>{"use strict";a.d(t,{Qg:()=>p,y8:()=>v});var r=a(95155),s=a(12115),n=a(65476),l=a(83101),i=a(74233),o=a(31185);let d=n.Provider,c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.Viewport,{ref:t,className:(0,o.cn)("fixed top-0 right-0 z-[100] flex max-h-screen w-full flex-col p-4 md:max-w-[420px]",a),...s})});c.displayName=n.Viewport.displayName;let u=(0,l.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md bg-white shadow-lg shadow-gray-300/60 p-6 pr-8 transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"text-foreground",destructive:"text-red-600",success:"text-green-600"}},defaultVariants:{variant:"default"}}),m=s.forwardRef((e,t)=>{let{className:a,variant:s,...l}=e;return(0,r.jsx)(n.Root,{ref:t,className:(0,o.cn)(u({variant:s}),a),...l})});m.displayName=n.Root.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.Action,{ref:t,className:(0,o.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...s})});p.displayName=n.Action.displayName;let x=s.forwardRef((e,t)=>
1{let{className:a,...s}=e;return(0,r.jsx)(n.Close,{ref:t,className:(0,o.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...s,children:(0,r.jsx)(i.WQq,{className:"h-4 w-4"})})});x.displayName=n.Close.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.Title,{ref:t,className:(0,o.cn)("text-sm font-semibold",a),...s})});h.displayName=n.Title.displayName;let f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.Description,{ref:t,className:(0,o.cn)("text-sm opacity-90",a),...s})});f.displayName=n.Description.displayName;let v=Object.assign(m,{Provider:d,Viewport:c,Title:h,Description:f,Close:x,Action:p})}},e=>{e.O(0,[7743,512,5271,6446,8520,5479,844,8087,3873,2150,5897,6711,7128,4506,4206,9204,4274,1600,5125,6317,3148,4127,8017,5644,5239,2856,3730,3725,6059,1663,892,7821,9044,1063,3773,8441,1255,7358],()=>e(e.s=42650)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.