import{a0 as Ve,a as b,W as ge,p as x,a1 as xe,m as Z,n as K,o as X,_ as F,j as e,q as Ce,t as J,v as M,P as Fe,a2 as qe,w as Ge,a3 as Ue,V as Ye,a4 as Ze,y as R,Y as Ke,$ as Xe,Z as fe,r as $,i as _,S as p,T as C,B as j,a5 as Je,M as me,D,I as Qe}from"./index-BkkG8KUK.js";import{S as et,d as tt,a as rt}from"./VisibilityOff-Z1C_ryUW.js";import{P as at,C as G,G as L,A as nt}from"./PageHeader-ClrrZ_n7.js";import{B as N}from"./Button-BSTbu9TV.js";import{C as V}from"./Link--7InL3sU.js";import{T as A}from"./TextField-oZbmUKuy.js";import{L as ot}from"./LinearProgress-iCKLD5U_.js";import{I as st}from"./InputAdornment-BiRkmFSO.js";function it(t={}){const{autoHideDuration:r=null,disableWindowBlurListener:a=!1,onClose:n,open:d,resumeHideDuration:u}=t,l=Ve();b.useEffect(()=>{if(!d)return;function c(i){i.defaultPrevented||(i.key==="Escape"||i.key==="Esc")&&(n==null||n(i,"escapeKeyDown"))}return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c)}},[d,n]);const w=ge((c,i)=>{n==null||n(c,i)}),v=ge(c=>{!n||c==null||l.start(c,()=>{w(null,"timeout")})});b.useEffect(()=>(d&&v(r),l.clear),[d,r,v,l]);const y=c=>{n==null||n(c,"clickaway")},s=l.clear,h=b.useCallback(()=>{r!=null&&v(u??r*.5)},[r,u,v]),k=c=>i=>{const g=c.onBlur;g==null||g(i),h()},O=c=>i=>{const g=c.onFocus;g==null||g(i),s()},P=c=>i=>{const g=c.onMouseEnter;g==null||g(i),s()},T=c=>i=>{const g=c.onMouseLeave;g==null||g(i),h()};return b.useEffect(()=>{if(!a&&d)return window.addEventListener("focus",h),window.addEventListener("blur",s),()=>{window.removeEventListener("focus",h),window.removeEventListener("blur",s)}},[a,d,h,s]),{getRootProps:(c={})=>{const i=x({},xe(t),xe(c));return x({role:"presentation"},c,i,{onBlur:k(i),onFocus:O(i),onMouseEnter:P(i),onMouseLeave:T(i)})},onClickAway:y}}function lt(t){return Z("MuiSnackbarContent",t)}K("MuiSnackbarContent",["root","message","action"]);const ct=["action","className","message","role"],dt=t=>{const{classes:r}=t;return J({root:["root"],action:["action"],message:["message"]},lt,r)},ut=M(Fe,{name:"MuiSnackbarContent",slot:"Root",overridesResolver:(t,r)=>r.root})(({theme:t})=>{const r=t.palette.mode==="light"?.8:.98,a=qe(t.palette.background.default,r);return x({},t.typography.body2,{color:t.vars?t.vars.palette.SnackbarContent.color:t.palette.getContrastText(a),backgroundColor:t.vars?t.vars.palette.SnackbarContent.bg:a,display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",borderRadius:(t.vars||t).shape.borderRadius,flexGrow:1,[t.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}})}),ht=M("div",{name:"MuiSnackbarContent",slot:"Message",overridesResolver:(t,r)=>r.message})({padding:"8px 0"}),pt=M("div",{name:"MuiSnackbarContent",slot:"Action",overridesResolver:(t,r)=>r.action})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),vt=b.forwardRef(function(r,a){const n=X({props:r,name:"MuiSnackbarContent"}),{action:d,className:u,message:l,role:w="alert"}=n,v=F(n,ct),y=n,s=dt(y);return e.jsxs(ut,x({role:w,square:!0,elevation:6,className:Ce(s.root,u),ownerState:y,ref:a},v,{children:[e.jsx(ht,{className:s.message,ownerState:y,children:l}),d?e.jsx(pt,{className:s.action,ownerState:y,children:d}):null]}))});function gt(t){return Z("MuiSnackbar",t)}K("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);const xt=["onEnter","onExited"],ft=["action","anchorOrigin","autoHideDuration","children","className","ClickAwayListenerProps","ContentProps","disableWindowBlurListener","message","onBlur","onClose","onFocus","onMouseEnter","onMouseLeave","open","resumeHideDuration","TransitionComponent","transitionDuration","TransitionProps"],mt=t=>{const{classes:r,anchorOrigin:a}=t,n={root:["root",`anchorOrigin${R(a.vertical)}${R(a.horizontal)}`]};return J(n,gt,r)},be=M("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(t,r)=>{const{ownerState:a}=t;return[r.root,r[`anchorOrigin${R(a.anchorOrigin.vertical)}${R(a.anchorOrigin.horizontal)}`]]}})(({theme:t,ownerState:r})=>{const a={left:"50%",right:"auto",transform:"translateX(-50%)"};return x({zIndex:(t.vars||t).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center"},r.anchorOrigin.vertical==="top"?{top:8}:{bottom:8},r.anchorOrigin.horizontal==="left"&&{justifyContent:"flex-start"},r.anchorOrigin.horizontal==="right"&&{justifyContent:"flex-end"},{[t.breakpoints.up("sm")]:x({},r.anchorOrigin.vertical==="top"?{top:24}:{bottom:24},r.anchorOrigin.horizontal==="center"&&a,r.anchorOrigin.horizontal==="left"&&{left:24,right:"auto"},r.anchorOrigin.horizontal==="right"&&{right:24,left:"auto"})})}),bt=b.forwardRef(function(r,a){const n=X({props:r,name:"MuiSnackbar"}),d=Ge(),u={enter:d.transitions.duration.enteringScreen,exit:d.transitions.duration.leavingScreen},{action:l,anchorOrigin:{vertical:w,horizontal:v}={vertical:"bottom",horizontal:"left"},autoHideDuration:y=null,children:s,className:h,ClickAwayListenerProps:k,ContentProps:O,disableWindowBlurListener:P=!1,message:T,open:E,TransitionComponent:c=Ue,transitionDuration:i=u,TransitionProps:{onEnter:g,onExited:o}={}}=n,z=F(n.TransitionProps,xt),f=F(n,ft),H=x({},n,{anchorOrigin:{vertical:w,horizontal:v},autoHideDuration:y,disableWindowBlurListener:P,TransitionComponent:c,transitionDuration:i}),Le=mt(H),{getRootProps:Te,onClickAway:Ee}=it(x({},H)),[He,ve]=b.useState(!0),Ne=Ye({elementType:be,getSlotProps:Te,externalForwardedProps:f,ownerState:H,additionalProps:{ref:a},className:[Le.root,h]}),De=q=>{ve(!0),o&&o(q)},We=(q,Be)=>{ve(!1),g&&g(q,Be)};return!E&&He?null:e.jsx(Ze,x({onClickAway:Ee},k,{children:e.jsx(be,x({},Ne,{children:e.jsx(c,x({appear:!0,in:E,timeout:i,direction:w==="top"?"down":"up",onEnter:We,onExited:De},z,{children:s||e.jsx(vt,x({message:T,action:l},O))}))}))}))});function jt(t){return Z("MuiSwitch",t)}const m=K("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),wt=["className","color","edge","size","sx"],yt=t=>{const{classes:r,edge:a,size:n,color:d,checked:u,disabled:l}=t,w={root:["root",a&&`edge${R(a)}`,`size${R(n)}`],switchBase:["switchBase",`color${R(d)}`,u&&"checked",l&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},v=J(w,jt,r);return x({},r,v)},St=M("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(t,r)=>{const{ownerState:a}=t;return[r.root,a.edge&&r[`edge${R(a.edge)}`],r[`size${R(a.size)}`]]}})({display:"inline-flex",width:34+12*2,height:14+12*2,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"},variants:[{props:{edge:"start"},style:{marginLeft:-8}},{props:{edge:"end"},style:{marginRight:-8}},{props:{size:"small"},style:{width:40,height:24,padding:7,[`& .${m.thumb}`]:{width:16,height:16},[`& .${m.switchBase}`]:{padding:4,[`&.${m.checked}`]:{transform:"translateX(16px)"}}}}]}),Ct=M(et,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(t,r)=>{const{ownerState:a}=t;return[r.switchBase,{[`& .${m.input}`]:r.input},a.color!=="default"&&r[`color${R(a.color)}`]]}})(({theme:t})=>({position:"absolute",top:0,left:0,zIndex:1,color:t.vars?t.vars.palette.Switch.defaultColor:`${t.palette.mode==="light"?t.palette.common.white:t.palette.grey[300]}`,transition:t.transitions.create(["left","transform"],{duration:t.transitions.duration.shortest}),[`&.${m.checked}`]:{transform:"translateX(20px)"},[`&.${m.disabled}`]:{color:t.vars?t.vars.palette.Switch.defaultDisabledColor:`${t.palette.mode==="light"?t.palette.grey[100]:t.palette.grey[600]}`},[`&.${m.checked} + .${m.track}`]:{opacity:.5},[`&.${m.disabled} + .${m.track}`]:{opacity:t.vars?t.vars.opacity.switchTrackDisabled:`${t.palette.mode==="light"?.12:.2}`},[`& .${m.input}`]:{left:"-100%",width:"300%"}}),({theme:t})=>({"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette.action.activeChannel} / ${t.vars.palette.action.hoverOpacity})`:fe(t.palette.action.active,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(t.palette).filter(([,r])=>r.main&&r.light).map(([r])=>({props:{color:r},style:{[`&.${m.checked}`]:{color:(t.vars||t).palette[r].main,"&:hover":{backgroundColor:t.vars?`rgba(${t.vars.palette[r].mainChannel} / ${t.vars.palette.action.hoverOpacity})`:fe(t.palette[r].main,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${m.disabled}`]:{color:t.vars?t.vars.palette.Switch[`${r}DisabledColor`]:`${t.palette.mode==="light"?Ke(t.palette[r].main,.62):Xe(t.palette[r].main,.55)}`}},[`&.${m.checked} + .${m.track}`]:{backgroundColor:(t.vars||t).palette[r].main}}}))]})),kt=M("span",{name:"MuiSwitch",slot:"Track",overridesResolver:(t,r)=>r.track})(({theme:t})=>({height:"100%",width:"100%",borderRadius:14/2,zIndex:-1,transition:t.transitions.create(["opacity","background-color"],{duration:t.transitions.duration.shortest}),backgroundColor:t.vars?t.vars.palette.common.onBackground:`${t.palette.mode==="light"?t.palette.common.black:t.palette.common.white}`,opacity:t.vars?t.vars.opacity.switchTrack:`${t.palette.mode==="light"?.38:.3}`})),zt=M("span",{name:"MuiSwitch",slot:"Thumb",overridesResolver:(t,r)=>r.thumb})(({theme:t})=>({boxShadow:(t.vars||t).shadows[1],backgroundColor:"currentColor",width:20,height:20,borderRadius:"50%"})),W=b.forwardRef(function(r,a){const n=X({props:r,name:"MuiSwitch"}),{className:d,color:u="primary",edge:l=!1,size:w="medium",sx:v}=n,y=F(n,wt),s=x({},n,{color:u,edge:l,size:w}),h=yt(s),k=e.jsx(zt,{className:h.thumb,ownerState:s});return e.jsxs(St,{className:Ce(h.root,d),sx:v,ownerState:s,children:[e.jsx(Ct,x({type:"checkbox",icon:k,checkedIcon:k,ref:a,ownerState:s},y,{classes:x({},h,{root:h.switchBase})})),e.jsx(kt,{className:h.track,ownerState:s})]})});var Q={},$t=_;Object.defineProperty(Q,"__esModule",{value:!0});var ke=Q.default=void 0,_t=$t($()),Rt=e;ke=Q.default=(0,_t.default)((0,Rt.jsx)("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm2 16H5V5h11.17L19 7.83zm-7-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3M6 6h9v4H6z"}),"SaveOutlined");var ee={},Mt=_;Object.defineProperty(ee,"__esModule",{value:!0});var te=ee.default=void 0,Ot=Mt($()),Pt=e;te=ee.default=(0,Ot.default)((0,Pt.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");var re={},It=_;Object.defineProperty(re,"__esModule",{value:!0});var ae=re.default=void 0,At=It($()),Lt=e;ae=re.default=(0,At.default)((0,Lt.jsx)("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"}),"NotificationsNone");var ne={},Tt=_;Object.defineProperty(ne,"__esModule",{value:!0});var oe=ne.default=void 0,Et=Tt($()),Ht=e;oe=ne.default=(0,Et.default)((0,Ht.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"}),"LockOutlined");var se={},Nt=_;Object.defineProperty(se,"__esModule",{value:!0});var Y=se.default=void 0,Dt=Nt($()),Wt=e;Y=se.default=(0,Dt.default)((0,Wt.jsx)("path",{d:"M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25z"}),"ShieldOutlined");var ie={},Bt=_;Object.defineProperty(ie,"__esModule",{value:!0});var ze=ie.default=void 0,Vt=Bt($()),Ft=e;ze=ie.default=(0,Vt.default)((0,Ft.jsx)("path",{d:"M18 11v2h4v-2zm-2 6.61c.96.71 2.21 1.65 3.2 2.39.4-.53.8-1.07 1.2-1.6-.99-.74-2.24-1.68-3.2-2.4-.4.54-.8 1.08-1.2 1.61M20.4 5.6c-.4-.53-.8-1.07-1.2-1.6-.99.74-2.24 1.68-3.2 2.4.4.53.8 1.07 1.2 1.6.96-.72 2.21-1.65 3.2-2.4M4 9c-1.1 0-2 .9-2 2v2c0 1.1.9 2 2 2h1v4h2v-4h1l5 3V6L8 9zm5.03 1.71L11 9.53v4.94l-1.97-1.18-.48-.29H4v-2h4.55zM15.5 12c0-1.33-.58-2.53-1.5-3.35v6.69c.92-.81 1.5-2.01 1.5-3.34"}),"CampaignOutlined");var le={},qt=_;Object.defineProperty(le,"__esModule",{value:!0});var $e=le.default=void 0,Gt=qt($()),Ut=e;$e=le.default=(0,Gt.default)((0,Ut.jsx)("path",{d:"M12 7V3H2v18h20V7zM6 19H4v-2h2zm0-4H4v-2h2zm0-4H4V9h2zm0-4H4V5h2zm4 12H8v-2h2zm0-4H8v-2h2zm0-4H8V9h2zm0-4H8V5h2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8zm-2-8h-2v2h2zm0 4h-2v2h2z"}),"BusinessOutlined");var ce={},Yt=_;Object.defineProperty(ce,"__esModule",{value:!0});var _e=ce.default=void 0,Zt=Yt($()),je=e;_e=ce.default=(0,Zt.default)([(0,je.jsx)("path",{d:"M23 11.99 20.56 9.2l.34-3.69-3.61-.82L15.4 1.5 12 2.96 8.6 1.5 6.71 4.69 3.1 5.5l.34 3.7L1 11.99l2.44 2.79-.34 3.7 3.61.82 1.89 3.2 3.4-1.47 3.4 1.46 1.89-3.19 3.61-.82-.34-3.69zm-3.95 1.48-.56.65.08.85.18 1.95-1.9.43-.84.19-.44.74-.99 1.68-1.78-.77-.8-.34-.79.34-1.78.77-.99-1.67-.44-.74-.84-.19-1.9-.43.18-1.96.08-.85-.56-.65L3.67 12l1.29-1.48.56-.65-.09-.86-.18-1.94 1.9-.43.84-.19.44-.74.99-1.68 1.78.77.8.34.79-.34 1.78-.77.99 1.68.44.74.84.19 1.9.43-.18 1.95-.08.85.56.65 1.29 1.47z"},"0"),(0,je.jsx)("path",{d:"m10.09 13.75-2.32-2.33-1.48 1.49 3.8 3.81 7.34-7.36-1.48-1.49z"},"1")],"VerifiedOutlined");var de={},Kt=_;Object.defineProperty(de,"__esModule",{value:!0});var Re=de.default=void 0,Xt=Kt($()),Jt=e;Re=de.default=(0,Xt.default)((0,Jt.jsx)("path",{d:"M12 5.99 19.53 19H4.47zM2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1m0 5h2v2h-2z"}),"WarningAmberRounded");var ue={},Qt=_;Object.defineProperty(ue,"__esModule",{value:!0});var Me=ue.default=void 0,er=Qt($()),tr=e;Me=ue.default=(0,er.default)((0,tr.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m-1-4h2v2h-2zm1.61-9.96c-2.06-.3-3.88.97-4.43 2.79-.18.58.26 1.17.87 1.17h.2c.41 0 .74-.29.88-.67.32-.89 1.27-1.5 2.3-1.28.95.2 1.65 1.13 1.57 2.1-.1 1.34-1.62 1.63-2.45 2.88 0 .01-.01.01-.01.02-.01.02-.02.03-.03.05-.09.15-.18.32-.25.5-.01.03-.03.05-.04.08-.01.02-.01.04-.02.07-.12.34-.2.75-.2 1.25h2c0-.42.11-.77.28-1.07.02-.03.03-.06.05-.09.08-.14.18-.27.28-.39.01-.01.02-.03.03-.04.1-.12.21-.23.33-.34.96-.91 2.26-1.65 1.99-3.56-.24-1.74-1.61-3.21-3.35-3.47"}),"HelpOutlineRounded");var he={},rr=_;Object.defineProperty(he,"__esModule",{value:!0});var Oe=he.default=void 0,ar=rr($()),nr=e;Oe=he.default=(0,ar.default)((0,nr.jsx)("path",{d:"m17 8-1.41 1.41L17.17 11H9v2h8.17l-1.58 1.58L17 16l4-4zM5 5h7V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h7v-2H5z"}),"LogoutOutlined");var pe={},or=_;Object.defineProperty(pe,"__esModule",{value:!0});var Pe=pe.default=void 0,sr=or($()),ir=e;Pe=pe.default=(0,sr.default)((0,ir.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");const Ie=["Asia/Kolkata (IST)","Asia/Dubai (GST)","UTC","America/New_York (EST)"],Ae=["English","हिन्दी (Hindi)","العربية (Arabic)"],we={orgName:"Doormile Logistics Pvt. Ltd.",supportEmail:"support@doormile.in",contact:"+91 63749 46729",timezone:Ie[0],language:Ae[0]},ye={newClient:!0,contractStatus:!0,teamAccess:!1,databaseSync:!0,emailAlerts:!0,smsAlerts:!1},Se={currentPassword:"",newPassword:"",confirmPassword:"",twoFactor:!1},lr=[{icon:te,label:"General",desc:"Organisation profile"},{icon:ae,label:"Notifications",desc:"Alerts & channels"},{icon:oe,label:"Security",desc:"Password & 2FA"}],cr=[{k:"newClient",t:"New client onboarded",d:"Notify when a new client is added to the system"},{k:"contractStatus",t:"Contract status",d:"When a client contract becomes active or expires"},{k:"teamAccess",t:"Team access",d:"When a new team member is granted or revoked access"},{k:"databaseSync",t:"Database sync",d:"Alerts for vector database synchronization events"}],dr=[{label:"Too weak",color:"error"},{label:"Weak",color:"error"},{label:"Fair",color:"warning"},{label:"Good",color:"info"},{label:"Strong",color:"success"}],ur=t=>{let r=0;return t.length>=8&&r++,/[a-z]/.test(t)&&/[A-Z]/.test(t)&&r++,/\d/.test(t)&&r++,/[^A-Za-z0-9]/.test(t)&&r++,r};function I({icon:t,title:r,subtitle:a,color:n="primary",danger:d=!1,children:u}){return e.jsxs(V,{sx:d?{borderColor:"error.light"}:void 0,children:[e.jsxs(p,{direction:"row",spacing:1.75,alignItems:"center",sx:{px:3,py:2.25,borderBottom:1,borderColor:"divider",background:l=>`linear-gradient(90deg, ${l.palette[n].lighter}66 0%, ${l.palette.background.paper} 72%)`},children:[e.jsx(j,{sx:{width:40,height:40,borderRadius:2,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:`${n}.lighter`,color:`${n}.main`},children:e.jsx(t,{fontSize:"small"})}),e.jsxs(j,{sx:{minWidth:0},children:[e.jsx(C,{variant:"subtitle1",sx:{fontWeight:700,color:"grey.800",lineHeight:1.3},children:r}),a&&e.jsx(C,{variant:"caption",color:"text.secondary",children:a})]})]}),e.jsx(j,{sx:{px:3},children:u})]})}function S({label:t,description:r,children:a,align:n="center"}){return e.jsxs(L,{container:!0,spacing:2,alignItems:n,sx:{py:2.5,borderRadius:2,transition:"background-color .15s","&:hover":{bgcolor:"grey.50"}},children:[e.jsxs(L,{item:!0,xs:12,sm:5,children:[e.jsx(C,{variant:"subtitle2",sx:{fontWeight:600,color:"grey.800"},children:t}),r&&e.jsx(C,{variant:"caption",color:"text.secondary",children:r})]}),e.jsx(L,{item:!0,xs:12,sm:7,children:a})]})}const B={display:"flex",justifyContent:{sm:"flex-end"}};function U({label:t,value:r,onChange:a,autoComplete:n}){const[d,u]=b.useState(!1);return e.jsx(A,{fullWidth:!0,size:"small",type:d?"text":"password",label:t,value:r,onChange:a,autoComplete:n,InputProps:{endAdornment:e.jsx(st,{position:"end",children:e.jsx(Qe,{onClick:()=>u(l=>!l),edge:"end",size:"small",children:d?e.jsx(tt,{fontSize:"small"}):e.jsx(rt,{fontSize:"small"})})})}})}function jr(){const[t,r]=b.useState(0),[a,n]=b.useState(!1),[d,u]=b.useState(!1),[l,w]=b.useState(we),[v,y]=b.useState(ye),[s,h]=b.useState(Se),k=o=>z=>{w(f=>({...f,[o]:z.target.value})),u(!0)},O=o=>z=>{y(f=>({...f,[o]:z.target.checked})),u(!0)},P=o=>z=>{h(f=>({...f,[o]:z.target.value})),u(!0)},T=()=>{n(!0),u(!1)},E=()=>{w(we),y(ye),h(Se),u(!1)},c=ur(s.newPassword),i=dr[c],g=s.confirmPassword&&s.newPassword!==s.confirmPassword;return e.jsxs(e.Fragment,{children:[e.jsx(at,{title:"Settings",breadcrumbs:[{label:"Settings"}],action:e.jsxs(p,{direction:"row",spacing:1.5,alignItems:"center",children:[d&&e.jsx(G,{size:"small",label:"Unsaved changes",sx:{bgcolor:"warning.lighter",color:"warning.dark",fontWeight:600}}),e.jsx(N,{variant:"outlined",onClick:E,children:"Discard"}),e.jsx(N,{variant:"contained",startIcon:e.jsx(ke,{}),onClick:T,children:"Save Changes"})]})}),e.jsxs(L,{container:!0,spacing:2.5,children:[e.jsx(L,{item:!0,xs:12,md:3,children:e.jsxs(p,{spacing:2.5,sx:{position:{md:"sticky"},top:{md:88}},children:[e.jsxs(V,{sx:{p:1.5},children:[e.jsx(C,{variant:"overline",sx:{px:1,color:"text.secondary",fontWeight:700,letterSpacing:.6},children:"Preferences"}),e.jsx(p,{spacing:.25,sx:{mt:.5},children:lr.map((o,z)=>{const f=t===z,H=o.icon;return e.jsxs(p,{direction:"row",spacing:1.5,alignItems:"center",onClick:()=>r(z),sx:{px:1.5,py:1.25,borderRadius:2,cursor:"pointer",position:"relative",bgcolor:f?"primary.lighter":"transparent",transition:"background-color .15s","&:hover":{bgcolor:f?"primary.lighter":"grey.50"},"&::before":f?{content:'""',position:"absolute",left:0,top:9,bottom:9,width:3,borderRadius:3,bgcolor:"primary.main"}:{}},children:[e.jsx(j,{sx:{width:34,height:34,borderRadius:1.5,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:f?"primary.main":"grey.100",color:f?"#fff":"grey.600"},children:e.jsx(H,{fontSize:"small"})}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(C,{variant:"subtitle2",sx:{fontWeight:600,color:f?"primary.main":"grey.800"},children:o.label}),e.jsx(C,{variant:"caption",color:"text.secondary",children:o.desc})]}),e.jsx(Pe,{sx:{fontSize:18,color:f?"primary.main":"grey.300"}})]},o.label)})})]}),e.jsx(V,{sx:{p:2.5,bgcolor:"primary.lighter",borderColor:"primary.100"},children:e.jsxs(p,{spacing:1.25,children:[e.jsx(j,{sx:{width:38,height:38,borderRadius:2,bgcolor:"primary.main",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Me,{fontSize:"small"})}),e.jsxs(j,{children:[e.jsx(C,{variant:"subtitle2",sx:{fontWeight:700,color:"primary.dark"},children:"Need a hand?"}),e.jsx(C,{variant:"caption",sx:{color:"primary.dark",opacity:.85},children:"Our team is available 24/7 for operational support."})]}),e.jsx(N,{size:"small",variant:"contained",sx:{alignSelf:"flex-start"},children:"Contact support"})]})})]})}),e.jsxs(L,{item:!0,xs:12,md:9,children:[t===0&&e.jsxs(p,{spacing:2.5,children:[e.jsx(V,{sx:{overflow:"hidden"},children:e.jsxs(p,{direction:{xs:"column",sm:"row"},spacing:2.5,alignItems:{sm:"center"},sx:{p:3,background:o=>`linear-gradient(90deg, ${o.palette.primary.lighter}88 0%, ${o.palette.background.paper} 75%)`},children:[e.jsx(Je,{variant:"rounded",sx:{width:64,height:64,bgcolor:"primary.main",color:"#fff"},children:e.jsx($e,{})}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsxs(p,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[e.jsx(C,{variant:"h5",sx:{fontWeight:700,color:"grey.800"},children:l.orgName}),e.jsx(G,{size:"small",icon:e.jsx(_e,{sx:{fontSize:15,ml:.5}}),label:"Verified",sx:{fontWeight:700,bgcolor:"success.lighter",color:"success.dark","& .MuiChip-icon":{color:"inherit"}}})]}),e.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:.25},children:[l.supportEmail," · ",l.contact]})]}),e.jsx(N,{variant:"outlined",size:"small",children:"Change logo"})]})}),e.jsx(I,{icon:te,title:"Organisation",subtitle:"Profile and regional preferences",color:"primary",children:e.jsxs(p,{divider:e.jsx(D,{}),children:[e.jsx(S,{label:"Organisation name",description:"Shown on invoices and exports",children:e.jsx(A,{fullWidth:!0,size:"small",value:l.orgName,onChange:k("orgName")})}),e.jsx(S,{label:"Support email",description:"Where customer replies are routed",children:e.jsx(A,{fullWidth:!0,size:"small",value:l.supportEmail,onChange:k("supportEmail")})}),e.jsx(S,{label:"Contact number",description:"Primary operations line",children:e.jsx(A,{fullWidth:!0,size:"small",value:l.contact,onChange:k("contact")})}),e.jsx(S,{label:"Timezone",description:"Used for schedules and reports",children:e.jsx(A,{select:!0,fullWidth:!0,size:"small",value:l.timezone,onChange:k("timezone"),children:Ie.map(o=>e.jsx(me,{value:o,children:o},o))})}),e.jsx(S,{label:"Language",description:"Console display language",children:e.jsx(A,{select:!0,fullWidth:!0,size:"small",value:l.language,onChange:k("language"),children:Ae.map(o=>e.jsx(me,{value:o,children:o},o))})})]})})]}),t===1&&e.jsxs(p,{spacing:2.5,children:[e.jsx(I,{icon:ae,title:"Notification Preferences",subtitle:"Choose what you get alerted about",color:"primary",children:e.jsx(p,{divider:e.jsx(D,{}),children:cr.map(o=>e.jsx(S,{label:o.t,description:o.d,children:e.jsx(j,{sx:B,children:e.jsx(W,{checked:v[o.k],onChange:O(o.k)})})},o.k))})}),e.jsx(I,{icon:ze,title:"Delivery Channels",subtitle:"How alerts reach your team",color:"primary",children:e.jsxs(p,{divider:e.jsx(D,{}),children:[e.jsx(S,{label:"Email alerts",description:"Send notifications to the support inbox",children:e.jsx(j,{sx:B,children:e.jsx(W,{checked:v.emailAlerts,onChange:O("emailAlerts")})})}),e.jsx(S,{label:"SMS alerts",description:"Send notifications to the registered mobile",children:e.jsx(j,{sx:B,children:e.jsx(W,{checked:v.smsAlerts,onChange:O("smsAlerts")})})})]})})]}),t===2&&e.jsxs(p,{spacing:2.5,children:[e.jsx(I,{icon:oe,title:"Change Password",subtitle:"Use 8+ characters with a mix of letters, numbers & symbols",color:"primary",children:e.jsxs(p,{divider:e.jsx(D,{}),children:[e.jsx(S,{label:"Current password",description:"Enter your existing password",align:"flex-start",children:e.jsx(U,{label:"Current password",value:s.currentPassword,onChange:P("currentPassword"),autoComplete:"current-password"})}),e.jsx(S,{label:"New password",description:"Choose a strong, unique password",align:"flex-start",children:e.jsxs(j,{children:[e.jsx(U,{label:"New password",value:s.newPassword,onChange:P("newPassword"),autoComplete:"new-password"}),s.newPassword&&e.jsxs(p,{direction:"row",spacing:1.5,alignItems:"center",sx:{mt:1},children:[e.jsx(ot,{variant:"determinate",value:c/4*100,color:i.color,sx:{flexGrow:1,height:6,borderRadius:3}}),e.jsx(C,{variant:"caption",sx:{fontWeight:700,color:`${i.color}.main`,minWidth:56},children:i.label})]})]})}),e.jsx(S,{label:"Confirm new password",description:"Re-enter the new password",align:"flex-start",children:e.jsxs(j,{children:[e.jsx(U,{label:"Confirm new password",value:s.confirmPassword,onChange:P("confirmPassword"),autoComplete:"new-password"}),g&&e.jsx(C,{variant:"caption",color:"error.main",sx:{mt:.75,display:"block"},children:"Passwords do not match"})]})})]})}),e.jsx(I,{icon:Y,title:"Two-Factor Authentication",subtitle:"Add an extra layer of security to your account",color:"primary",children:e.jsx(S,{label:"Authenticator app",description:"Require a one-time code at sign-in for extra security",children:e.jsxs(p,{direction:"row",spacing:1.5,alignItems:"center",sx:{justifyContent:{sm:"flex-end"}},children:[e.jsx(G,{size:"small",icon:e.jsx(Y,{sx:{fontSize:15,ml:.5}}),label:s.twoFactor?"Enabled":"Disabled",sx:{fontWeight:700,bgcolor:s.twoFactor?"success.lighter":"grey.100",color:s.twoFactor?"success.dark":"grey.600","& .MuiChip-icon":{color:"inherit"}}}),e.jsx(W,{checked:s.twoFactor,onChange:o=>{h(z=>({...z,twoFactor:o.target.checked})),u(!0)}})]})})}),e.jsx(I,{icon:Re,title:"Danger Zone",subtitle:"Irreversible and high-impact actions",color:"error",danger:!0,children:e.jsx(S,{label:"Sign out of all sessions",description:"End every active session on all devices",children:e.jsx(j,{sx:B,children:e.jsx(N,{variant:"outlined",color:"error",startIcon:e.jsx(Oe,{}),onClick:()=>{localStorage.removeItem("auth_token"),window.location.href="/login"},children:"Sign out everywhere"})})})})]})]})]}),e.jsx(bt,{open:a,autoHideDuration:2500,onClose:()=>n(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},children:e.jsx(nt,{severity:"success",variant:"filled",onClose:()=>n(!1),sx:{width:"100%"},children:"Settings saved successfully."})})]})}export{jr as default};