(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{20063:(e,t,a)=>{"use strict";var s=a(47260);a.o(s,"usePathname")&&a.d(t,{usePathname:function(){return s.usePathname}}),a.o(s,"useRouter")&&a.d(t,{useRouter:function(){return s.useRouter}}),a.o(s,"useSearchParams")&&a.d(t,{useSearchParams:function(){return s.useSearchParams}})},31393:(e,t,a)=>{"use strict";a.d(t,{LoginForm:()=>i});var s=a(95155),r=a(12115),n=a(56502),l=a(95088),o=a(89678);function i(e){let{next:t,demoAccounts:a,demoPassword:i}=e,{t:d,locale:c}=(0,n.s)(),[u,m]=(0,r.useState)(""),[x,h]=(0,r.useState)(""),[p,b]=(0,r.useState)(null),[g,f]=(0,r.useState)({}),[j,v]=(0,r.useState)(!1),N=async(e,a)=>{if(!j){v(!0),b(null),f({});try{await o.FH.post("/api/auth/login",{email:e,password:a}),window.location.assign(t&&t.startsWith("/")?t:"/dashboard")}catch(e){e instanceof o.E6?(b((0,o.oh)(e.failure,c)),e.failure.details&&f(e.failure.details)):b(d("common.serverError")),v(!1)}}};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault(),N(u,x)},className:"space-y-4",noValidate:!0,children:[p?(0,s.jsx)(l.Notice,{tone:"danger",children:p}):null,(0,s.jsx)(l.D0,{label:d("auth.email"),htmlFor:"email",error:(0,o.qd)(g.email,d),children:(0,s.jsx)(l.pd,{id:"email",name:"email",type:"email",autoComplete:"username",required:!0,dir:"ltr",value:u,invalid:!!g.email,onChange:e=>m(e.target.value),placeholder:d("auth.emailPlaceholder")})}),(0,s.jsx)(l.D0,{label:d("auth.password"),htmlFor:"password",error:(0,o.qd)(g.password,d),children:(0,s.jsx)(l.pd,{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,dir:"ltr",value:x,invalid:!!g.password,onChange:e=>h(e.target.value),placeholder:d("auth.passwordPlaceholder")})}),(0,s.jsx)(l.$n,{type:"submit",size:"lg",loading:j,className:"w-full",children:j?d("auth.submitting"):d("auth.submit")})]}),a.length>0?(0,s.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,s.jsx)("h2",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-text-faint",children:d("auth.demoAccounts")}),i?(0,s.jsxs)("span",{className:"flex items-center gap-2 text-[11px]",children:[(0,s.jsx)("span",{className:"text-text-muted",children:d("auth.demoOneClick")}),(0,s.jsx)("span",{className:"font-mono text-text-muted",children:i})]}):(0,s.jsx)("span",{className:"text-[11px] text-text-muted",children:d("auth.demoPasswordHidden")})]}),(0,s.jsx)("ul",{className:"mt-3 grid gap-1.5 sm:grid-cols-2",children:a.map(e=>(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",onClick:()=>(e=>{var t;if(m(e.email),b(null),f({}),i){h(i),N(e.email,i);return}null==(t=document.getElementById("password"))||t.focus()})(e),disabled:j,"aria-busy":j&&u===e.email,className:"w-full rounded-lg border border-border bg-surface-2/60 px-3 py-2 text-start transition-colors hover:border-brand/40 hover:bg-brand/8 disabled:opacity-60",children:[(0,s.jsx)("span",{className:"block truncate text-xs font-medium text-text",children:"ar"===c?e.nameAr:e.name}),(0,s.jsx)("span",{className:"mt-0.5 block truncate text-[11px] text-brand",children:d("role.".concat(e.roleKey))}),(0,s.jsx)("span",{className:"mt-0.5 block truncate font-mono text-[11px] text-text-faint",children:j&&u===e.email?d("auth.submitting"):e.email})]})},e.email))}),(0,s.jsx)("p",{className:"mt-3 text-[11px] leading-relaxed text-text-faint",children:d("auth.demoAccountsNote")})]}):null]})}},36819:(e,t,a)=>{"use strict";a.d(t,{LanguageSwitcher:()=>d});var s=a(95155),r=a(20063),n=a(12115),l=a(56502),o=a(25803),i=a(76445);function d(e){let{className:t,compact:a=!1}=e,{locale:d,t:c}=(0,l.s)(),u=(0,r.useRouter)(),[m,x]=(0,n.useTransition)();return(0,s.jsx)("div",{role:"radiogroup","aria-label":c("common.language"),className:(0,i.cn)("inline-flex items-center gap-0.5 rounded-lg border border-border bg-surface-2 p-0.5",m&&"opacity-60",t),children:o.YZ.map(e=>(0,s.jsx)("button",{type:"button",role:"radio","aria-checked":e===d,onClick:()=>{e!==d&&(document.cookie="".concat(o.CL,"=").concat(e,"; path=/; max-age=").concat(31536e3,"; samesite=lax"),x(()=>u.refresh()))},className:(0,i.cn)("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",e===d?"bg-brand/18 text-brand":"text-text-muted hover:bg-surface-3 hover:text-text"),children:a?e.toUpperCase():o.vK[e].native},e))})}},95060:(e,t,a)=>{Promise.resolve().then(a.t.bind(a,52619,23)),Promise.resolve().then(a.bind(a,36819)),Promise.resolve().then(a.bind(a,31393))}},e=>{e.O(0,[2619,4909,4820,4672,8441,1255,7358],()=>e(e.s=95060)),_N_E=e.O()}]);